Enhancements

Fix support for generating Loon configs.
Refactor libraries.
This commit is contained in:
Tindy X committed 2023-07-03 13:52:52 +08:00
1 parent 4205dee94a
commit deb73c5669
24 files changed
+605 -618

No files matched your search

+2 -2
View File
@@ -2,7 +2,7 @@
#include <fstream>
#include <sys/stat.h>
#include "string.h"
#include "utils/string.h"
bool isInScope(const std::string &path)
{
@@ -22,7 +22,7 @@ std::string fileGet(const std::string &path, bool scope_limit)
std::string content;
if(scope_limit && !isInScope(path))
return std::string();
return "";
std::FILE *fp = std::fopen(path.c_str(), "rb");
if(fp)
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -18,7 +18,7 @@ std::string hostnameToIPAddr(const std::string &host)
if(retVal != 0)
{
freeaddrinfo(retAddrInfo);
return std::string();
return "";
}
for(cur = retAddrInfo; cur != NULL; cur = cur->ai_next)
+2 -2
View File
@@ -21,7 +21,7 @@ template <typename T> void exception_thrower(T e)
inline void operator >> (const rapidjson::Value& value, std::string& i)
{
if(value.IsNull())
i = std::string();
i = "";
else if(value.IsString())
i = std::string(value.GetString());
else if(value.IsInt64())
@@ -31,7 +31,7 @@ inline void operator >> (const rapidjson::Value& value, std::string& i)
else if(value.IsDouble())
i = std::to_string(value.GetDouble());
else
i = std::string();
i = "";
}
inline void operator >> (const rapidjson::Value& value, int& i)
+3 -3
View File
@@ -234,13 +234,13 @@ std::string trimWhitespace(const std::string &str, bool before, bool after)
{
epos = str.find_last_not_of(whitespaces);
if(epos == std::string::npos)
return std::string();
return "";
}
if(before)
{
bpos = str.find_first_not_of(whitespaces);
if(bpos == std::string::npos)
return std::string();
return "";
}
return str.substr(bpos, epos - bpos + 1);
}
@@ -295,7 +295,7 @@ std::string getUrlArg(const std::string &url, const std::string &request)
break;
pos--;
}
return std::string();
return "";
}
std::string replaceAllDistinct(std::string str, const std::string &old_value, const std::string &new_value)
+1
View File
@@ -7,6 +7,7 @@
#include <vector>
#include <map>
using string = std::string;
using string_size = std::string::size_type;
using string_array = std::vector<std::string>;
using string_map = std::map<std::string, std::string>;
+4 -4
View File
@@ -50,7 +50,7 @@ std::string getSystemProxy()
if(ret != ERROR_SUCCESS)
{
//std::cout << "open failed: " << ret << std::endl;
return std::string();
return "";
}
DWORD values_count, max_value_name_len, max_value_len;
@@ -59,7 +59,7 @@ std::string getSystemProxy()
if(ret != ERROR_SUCCESS)
{
//std::cout << "query failed" << std::endl;
return std::string();
return "";
}
std::vector<std::tuple<std::shared_ptr<char>, DWORD, std::shared_ptr<BYTE>>> values;
@@ -103,7 +103,7 @@ std::string getSystemProxy()
}
*/
//return 0;
return std::string();
return "";
#else
string_array proxy_env = {"all_proxy", "ALL_PROXY", "http_proxy", "HTTP_PROXY", "https_proxy", "HTTPS_PROXY"};
for(std::string &x : proxy_env)
@@ -112,6 +112,6 @@ std::string getSystemProxy()
if(proxy != NULL)
return std::string(proxy);
}
return std::string();
return "";
#endif // _WIN32
}