X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Futil.cpp;h=80186e5fa13652d981278155478ac1a9f3f5c77b;hp=f6d80f70dad29be2a75a496a7c0b36e2a523cc4a;hb=6aba6f08af53e3fa49ab4d1ef002e6771d0ce358;hpb=35d53cc54ae590fad75cf9fa038c0e0568157f7e diff --git a/src/util.cpp b/src/util.cpp index f6d80f7..80186e5 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -33,12 +33,6 @@ namespace boost { #include #ifdef WIN32 -#ifdef _MSC_VER -#pragma warning(disable:4786) -#pragma warning(disable:4804) -#pragma warning(disable:4805) -#pragma warning(disable:4717) -#endif #ifdef _WIN32_WINNT #undef _WIN32_WINNT #endif @@ -331,7 +325,7 @@ string vstrprintf(const char *format, va_list ap) if (p != buffer) delete[] p; limit *= 2; - p = new char[limit]; + p = new(nothrow) char[limit]; if (p == NULL) throw std::bad_alloc(); } @@ -400,16 +394,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 +1174,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 +1486,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 +}