X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Futil.cpp;h=a3848fd38432081e01ee399f1e59131e42af13d7;hb=9d14e64825d95061ea0857267646dfcb3d62e07a;hp=7fb43bc1b487e75c9bdb93c0dbc6fe0560313e45;hpb=31e9cb26642187e571f178ddcfa268ce7c4e56cc;p=novacoin.git diff --git a/src/util.cpp b/src/util.cpp index 7fb43bc..a3848fd 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -31,6 +31,7 @@ namespace boost { #include #include #include +#include #ifdef WIN32 #ifdef _MSC_VER @@ -127,6 +128,13 @@ public: ppmutexOpenSSL[i] = new CCriticalSection(); CRYPTO_set_locking_callback(locking_callback); + // OpenSSL can optionally load a config file which lists optional loadable modules and engines. + // We don't use them so we don't require the config. However some of our libs may call functions + // which attempt to load the config file, possibly resulting in an exit() or crash if it is missing + // or corrupt. Explicitly tell OpenSSL not to try to load the file. The result for our libs will be + // that the config appears to have been loaded and there are no modules/engines available. + OPENSSL_no_config(); + #ifdef WIN32 // Seed random number generator with screen scrape and other hardware sources RAND_screen(); @@ -400,16 +408,16 @@ string FormatMoney(int64_t n, bool fPlus) string str = strprintf("%" PRId64 ".%06" PRId64, quotient, remainder); // Right-trim excess zeros before the decimal point: - int nTrim = 0; + size_t nTrim = 0; for (size_t i = str.size()-1; (str[i] == '0' && isdigit(str[i-2])); --i) ++nTrim; if (nTrim) str.erase(str.size()-nTrim, nTrim); if (n < 0) - str.insert((unsigned int)0, 1, '-'); + str.insert(0u, 1, '-'); else if (fPlus && n > 0) - str.insert((unsigned int)0, 1, '+'); + str.insert(0u, 1, '+'); return str; } @@ -1180,13 +1188,11 @@ void createConf() pConf << "rpcuser=user\nrpcpassword=" + randomStrGen(15) + "\nrpcport=8344" - + "\nport=7777" + "\n#(0=off, 1=on) daemon - run in the background as a daemon and accept commands" + "\ndaemon=0" + "\n#(0=off, 1=on) server - accept command line and JSON-RPC commands" + "\nserver=0" - + "\nrpcallowip=127.0.0.1" - + "\ntestnet=0"; + + "\nrpcallowip=127.0.0.1"; pConf.close(); } @@ -1494,4 +1500,4 @@ std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime) ss.imbue(loc); ss << boost::posix_time::from_time_t(nTime); return ss.str(); -} \ No newline at end of file +}