diff --git a/src/api/API.cpp b/src/api/API.cpp index ffa1a77..de05fcb 100644 --- a/src/api/API.cpp +++ b/src/api/API.cpp @@ -21,14 +21,12 @@ std::string API::request(std::string myurl) { std::string API::request(std::string myurl, bool post, Hashmap &map, std::vector &headers) { CURL *curl; - CURLcode res; - curl = curl_easy_init(); struct curl_slist *list = nullptr; for (int j = 0; j < headers.size(); ++j) { - list = curl_slist_append(list, headers.at(j).c_str()); + list = curl_slist_append(list, headers.at((unsigned long)(j)).c_str()); } std::string readString; @@ -73,7 +71,7 @@ API::request(std::string myurl, bool post, Hashmap &ma curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readString); - res = curl_easy_perform(curl); + curl_easy_perform(curl); curl_easy_cleanup(curl); } diff --git a/src/api/Hashmap.h b/src/api/Hashmap.h index 4fc90d5..34abdac 100644 --- a/src/api/Hashmap.h +++ b/src/api/Hashmap.h @@ -43,7 +43,7 @@ valuetype Hashmap::getValue(int position) { template int Hashmap::size() { - return keys.size(); + return (int)(keys.size()); } diff --git a/src/main.cpp b/src/main.cpp index 8797dab..08d237c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,6 @@ #include #include +#include #include "api/API.h" #include "Logger.h" @@ -24,7 +25,7 @@ int main(int argc, char *argv[]) { std::string ip = api.request("https://api.ipify.org"); - if (ip == "") { + if (ip.empty()) { //no internet connection logger.logToLogfile("[WARNING] no internet connection"); std::cout << "[WARNING] no internet connection" << std::endl;