mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-14 23:07:48 -04:00
more static analysis
This commit is contained in:
@@ -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);
|
||||
|
||||
+3
-3
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+9
-8
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user