diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp b/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp index 5740d61e..f0a1e85c 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp @@ -206,7 +206,6 @@ bool CMonitorData::processHierarchyRequestBlock(UdpConnection *con, short & sequ send(con, sequence, MON_MSG_REPLY_HIERARCHY_BLOCK, m_buffer, size + 1); memset(m_buffer, 0, 16); count++; - size = 0; } memset(m_buffer, 0, 16); send(con, sequence, MON_MSG_REPLY_HIERARCHY_BLOCK_END, m_buffer); diff --git a/external/3rd/library/platform/utils/Base/Config.cpp b/external/3rd/library/platform/utils/Base/Config.cpp index 6351686f..f0ad8ff1 100755 --- a/external/3rd/library/platform/utils/Base/Config.cpp +++ b/external/3rd/library/platform/utils/Base/Config.cpp @@ -21,7 +21,7 @@ namespace Base bool CConfig::LoadFile(char * file) //----------------------------------- { - char ch; + char ch; FILE * fp; UnloadFile(); @@ -31,7 +31,7 @@ bool CConfig::LoadFile(char * file) if (fp == nullptr || fp == (FILE *)-1) { //fprintf(stderr,"Failed to open config file %s!",file); - delete fp; + fclose(fp); return false; } @@ -63,7 +63,7 @@ bool CConfig::LoadFile(char * file) } pConfig[i] = 0; // mark end of file buffer - fclose(fp); + fclose(fp); return true; } diff --git a/external/3rd/library/webAPI/webAPI.cpp b/external/3rd/library/webAPI/webAPI.cpp index b03ea28c..78f64853 100644 --- a/external/3rd/library/webAPI/webAPI.cpp +++ b/external/3rd/library/webAPI/webAPI.cpp @@ -115,18 +115,18 @@ bool webAPI::fetch(const int &getPost, const int &mimeType) // 0 for json 1 for slist = curl_slist_append(slist, "charsets: utf-8"); - CURLcode res = curl_easy_setopt(curl, CURLOPT_USERAGENT, userAgent.c_str()); - res = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeCallback); // place the data into readBuffer using writeCallback - res = curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); // specify readBuffer as the container for data - res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist); + curl_easy_setopt(curl, CURLOPT_USERAGENT, userAgent.c_str()); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeCallback); // place the data into readBuffer using writeCallback + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); // specify readBuffer as the container for data + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist); switch (getPost) { case HTTP::GET: - res = curl_easy_setopt(curl, CURLOPT_URL, std::string(uri + "?" + sRequest).c_str()); + curl_easy_setopt(curl, CURLOPT_URL, std::string(uri + "?" + sRequest).c_str()); break; case HTTP::POST: - res = curl_easy_setopt(curl, CURLOPT_POSTFIELDS, sRequest.c_str()); - res = curl_easy_setopt(curl, CURLOPT_URL, uri.c_str()); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, sRequest.c_str()); + curl_easy_setopt(curl, CURLOPT_URL, uri.c_str()); break; // want to do a put, or whatever other type? feel free to add here } @@ -135,8 +135,9 @@ bool webAPI::fetch(const int &getPost, const int &mimeType) // 0 for json 1 for // the public one will verify but since this is pinned we don't care about the CA // to grab/generate, see https://curl.haxx.se/libcurl/c/CURLOPT_PINNEDPUBLICKEY.html // under the PUBLIC KEY EXTRACTION heading - res = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + CURLcode res = CURLE_OK; // if you want to pin to your own cert or cloudflares, learn how and use the below //res = curl_easy_setopt(curl, CURLOPT_PINNEDPUBLICKEY, "sha256//YOURKEYHERE");