#include "version.h"
#include "ui_interface.h"
-#include <boost/algorithm/string/join.hpp>
-#include <boost/algorithm/string/case_conv.hpp> // for to_lower()
+#include <random>
+
#include <boost/program_options/detail/config_file.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/filesystem.hpp>
str = str.substr(0, is_index);
}
#ifdef WIN32
- boost::to_lower(str);
+ transform(str.begin(), str.end(), str.begin(), ::tolower);
if (str.compare(0,1, "/") == 0)
str = "-" + str.substr(1);
#endif
return path;
}
-string randomStrGen(int length) {
- static string charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
+string randomStrGen(size_t length) {
+ std::mt19937 mtrand;
+ mtrand.seed(static_cast<unsigned int>(time(NULL)));
+ static const string charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
string result;
result.resize(length);
- for (int32_t i = 0; i < length; i++)
- result[i] = charset[rand() % charset.length()];
-
+ for (size_t i = 0; i < length; ++i)
+ result[i] = charset[mtrand() % charset.length()];
return result;
}
void createConf()
{
- srand(static_cast<unsigned int>(time(NULL)));
-
ofstream pConf;
#if BOOST_FILESYSTEM_VERSION >= 3
pConf.open(GetConfigFile().generic_string().c_str());
ss << "/";
ss << name << ":" << FormatVersion(nClientVersion);
if (!comments.empty())
- ss << "(" << boost::algorithm::join(comments, "; ") << ")";
+ {
+ ss << "(";
+ for (const auto& st : comments)
+ {
+ ss << st;
+ if (st == comments.back()) break;
+ ss << "; ";
+ }
+ ss << ")";
+ }
ss << "/";
return ss.str();
}