diff --git a/casinocoin-qt-windows.pro b/casinocoin-qt-windows.pro index 576e08f..266594e 100644 --- a/casinocoin-qt-windows.pro +++ b/casinocoin-qt-windows.pro @@ -1,6 +1,5 @@ TEMPLATE = app TARGET = casinocoin-qt -macx:TARGET = "CasinoCoin-Qt" VERSION = 2.0.0.0 INCLUDEPATH += src src/json src/qt QT += core gui network widgets qml quick @@ -119,7 +118,7 @@ contains(USE_BUILD_INFO, 1) { QMAKE_CXXFLAGS_WARN_ON = -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wno-strict-aliasing -Wstack-protector -QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-local-typedefs +QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-local-typedefs -Wno-maybe-uninitialized ##### Start Project Files ##### diff --git a/casinocoin-qt-windows.pro.user b/casinocoin-qt-windows.pro.user index 7c11a0c..343f951 100644 --- a/casinocoin-qt-windows.pro.user +++ b/casinocoin-qt-windows.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -73,7 +73,7 @@ QtProjectManager.QMakeBuildStep false - true + false USE_UPNP=0 USE_QRCODE=1 USE_IPV6=1 false false @@ -120,7 +120,7 @@ true - C:/Users/a.jochems/Documents/GitHub/casinocoin-GUI-2.0 + C:/Users/a.jochems/Documents/GitHub/casinocoin-issue-13 true @@ -128,7 +128,7 @@ QtProjectManager.QMakeBuildStep false - true + false USE_UPNP=0 USE_QRCODE=1 USE_IPV6=1 false false @@ -227,8 +227,8 @@ 2 casinocoin-qt-windows - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/a.jochems/Documents/GitHub/casinocoin-GUI-2.0/casinocoin-qt-windows.pro + casinocoin-qt-windows2 + Qt4ProjectManager.Qt4RunConfiguration:C:/Users/a.jochems/Documents/GitHub/casinocoin-issue-13/casinocoin-qt-windows.pro casinocoin-qt-windows.pro false diff --git a/src/alert.cpp b/src/alert.cpp index adf5f8b..b99d75b 100644 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -51,8 +51,8 @@ std::string CUnsignedAlert::ToString() const return strprintf( "CAlert(\n" " nVersion = %d\n" - " nRelayUntil = %"PRI64d"\n" - " nExpiration = %"PRI64d"\n" + " nRelayUntil = %" PRI64d "\n" + " nExpiration = %" PRI64d "\n" " nID = %d\n" " nCancel = %d\n" " setCancel = %s\n" diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index a4ac78f..6990fea 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -182,10 +182,10 @@ Value stop(const Array& params, bool fHelp) if (fHelp || params.size() > 1) throw runtime_error( "stop\n" - "Stop CasinoCoin server."); + "Stop "+ COIN_NAME_DISPLAY + " server."); // Shutdown will take long enough that the response should get back StartShutdown(); - return "CasinoCoin server stopping"; + return ""+ COIN_NAME_DISPLAY + " server stopping"; } @@ -299,7 +299,7 @@ string HTTPPost(const string& strMsg, const map& mapRequestHeader { ostringstream s; s << "POST / HTTP/1.1\r\n" - << "User-Agent: casinocoin-json-rpc/" << FormatFullVersion() << "\r\n" + << "User-Agent: "+ COIN_NAME + "-json-rpc/" << FormatFullVersion() << "\r\n" << "Host: 127.0.0.1\r\n" << "Content-Type: application/json\r\n" << "Content-Length: " << strMsg.size() << "\r\n" @@ -330,7 +330,7 @@ static string HTTPReply(int nStatus, const string& strMsg, bool keepalive) if (nStatus == HTTP_UNAUTHORIZED) return strprintf("HTTP/1.0 401 Authorization Required\r\n" "Date: %s\r\n" - "Server: casinocoin-json-rpc/%s\r\n" + "Server: "+ COIN_NAME + "-json-rpc/%s\r\n" "WWW-Authenticate: Basic realm=\"jsonrpc\"\r\n" "Content-Type: text/html\r\n" "Content-Length: 296\r\n" @@ -357,7 +357,7 @@ static string HTTPReply(int nStatus, const string& strMsg, bool keepalive) "Connection: %s\r\n" "Content-Length: %"PRIszu"\r\n" "Content-Type: application/json\r\n" - "Server: casinocoin-json-rpc/%s\r\n" + "Server: "+ COIN_NAME + "-json-rpc/%s\r\n" "\r\n" "%s", nStatus, @@ -737,7 +737,7 @@ void StartRPCThreads() { unsigned char rand_pwd[32]; RAND_bytes(rand_pwd, 32); - string strWhatAmI = "To use casinocoind"; + string strWhatAmI = "To use "+ COIN_NAME + "d"; if (mapArgs.count("-server")) strWhatAmI = strprintf(_("To use the %s option"), "\"-server\""); else if (mapArgs.count("-daemon")) @@ -746,13 +746,13 @@ void StartRPCThreads() _("%s, you must set a rpcpassword in the configuration file:\n" "%s\n" "It is recommended you use the following random password:\n" - "rpcuser=casinocoinrpc\n" + "rpcuser=")+ COIN_NAME + _("rpc\n" "rpcpassword=%s\n" "(you do not need to remember this password)\n" "The username and password MUST NOT be the same.\n" "If the file does not exist, create it with owner-readable-only file permissions.\n" "It is also recommended to set alertnotify so you are notified of problems;\n" - "for example: alertnotify=echo %%s | mail -s \"CasinoCoin Alert\" admin@foo.com\n"), + "for example: alertnotify=echo %%s | mail -s \"")+ COIN_NAME_DISPLAY + _(" Alert\" admin@foo.com\n"), strWhatAmI.c_str(), GetConfigFile().string().c_str(), EncodeBase58(&rand_pwd[0],&rand_pwd[0]+32).c_str()), diff --git a/src/compat.h b/src/compat.h index 7062216..8053fdd 100644 --- a/src/compat.h +++ b/src/compat.h @@ -12,7 +12,7 @@ #define NOMINMAX #endif #define FD_SETSIZE 1024 // max number of fds in fd_set -#include +#include #include #include #else diff --git a/src/db.cpp b/src/db.cpp index 2bda065..d1a60d0 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -456,7 +456,7 @@ void CDBEnv::Flush(bool fShutdown) else mi++; } - printf("DBFlush(%s)%s ended %15"PRI64d"ms\n", fShutdown ? "true" : "false", fDbEnvInit ? "" : " db not started", GetTimeMillis() - nStart); + printf("DBFlush(%s)%s ended %15" PRI64d "ms\n", fShutdown ? "true" : "false", fDbEnvInit ? "" : " db not started", GetTimeMillis() - nStart); if (fShutdown) { char** listp; diff --git a/src/init.cpp b/src/init.cpp index 69d930d..4699a31 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -10,6 +10,7 @@ #include "init.h" #include "util.h" #include "ui_interface.h" +#include "version.h" #include #include @@ -78,7 +79,7 @@ volatile bool fRequestShutdown = false; void StartShutdown() { - boost::this_thread::sleep_for( boost::chrono::seconds( 1 ) ); + boost::this_thread::sleep_for( boost::chrono::seconds( 1 ) ); fRequestShutdown = true; } bool ShutdownRequested() @@ -180,12 +181,12 @@ bool AppInit(int argc, char* argv[]) if (mapArgs.count("-?") || mapArgs.count("--help")) { // First part of help message is specific to bitcoind / RPC client - std::string strUsage = _("CasinoCoin version") + " " + FormatFullVersion() + "\n\n" + + std::string strUsage = COIN_NAME_DISPLAY + " version" + " " + FormatFullVersion() + "\n\n" + _("Usage:") + "\n" + - " casinocoind [options] " + "\n" + - " casinocoind [options] [params] " + _("Send command to -server or casinocoind") + "\n" + - " casinocoind [options] help " + _("List commands") + "\n" + - " casinocoind [options] help " + _("Get help for a command") + "\n"; + " "+ COIN_NAME + "d [options] " + "\n" + + " "+ COIN_NAME + "d [options] [params] " + "Send command to -server or "+ COIN_NAME + "d" + "\n" + + " "+ COIN_NAME + "d [options] help " + "List commands" + "\n" + + " "+ COIN_NAME + "d [options] help " + "Get help for a command" + "\n"; strUsage += "\n" + HelpMessage(); @@ -195,7 +196,7 @@ bool AppInit(int argc, char* argv[]) // Command-line RPC for (int i = 1; i < argc; i++) - if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], "casinocoin:")) + if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], (std::string("") + COIN_NAME + ":").c_str())) fCommandLine = true; if (fCommandLine) @@ -298,8 +299,8 @@ std::string HelpMessage() { string strUsage = _("Options:") + "\n" + " -? " + _("This help message") + "\n" + - " -conf= " + _("Specify configuration file (default: casinocoin.conf)") + "\n" + - " -pid= " + _("Specify pid file (default: casinocoind.pid)") + "\n" + + " -conf= " + "Specify configuration file (default: "+ COIN_NAME + ".conf)" + "\n" + + " -pid= " + "Specify pid file (default: "+ COIN_NAME + "d.pid)" + "\n" + " -gen " + _("Generate coins (default: 0)") + "\n" + " -datadir= " + _("Specify data directory") + "\n" + " -dbcache= " + _("Set database cache size in megabytes (default: 25)") + "\n" + @@ -376,7 +377,7 @@ std::string HelpMessage() " -blockmaxsize= " + _("Set maximum block size in bytes (default: 250000)") + "\n" + " -blockprioritysize= " + _("Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)") + "\n" + - "\n" + _("SSL options: (see the CasinoCoin Wiki for SSL setup instructions)") + "\n" + + "\n" + "SSL options: (see the "+ COIN_NAME_DISPLAY + " Wiki for SSL setup instructions)" + "\n" + " -rpcssl " + _("Use OpenSSL (https) for JSON-RPC connections") + "\n" + " -rpcsslcertificatechainfile= " + _("Server certificate file (default: server.cert)") + "\n" + " -rpcsslprivatekeyfile= " + _("Server private key (default: server.pem)") + "\n" + @@ -645,12 +646,13 @@ bool AppInit2(boost::thread_group& threadGroup) if (file) fclose(file); static boost::interprocess::file_lock lock(pathLockFile.string().c_str()); if (!lock.try_lock()) - return InitError(strprintf(_("Cannot obtain a lock on data directory %s. CasinoCoin is probably already running."), strDataDir.c_str())); + return InitError(strprintf((std::string("Cannot obtain a lock on data directory %s. ")+ COIN_NAME_DISPLAY + " is probably already running.").c_str(), strDataDir.c_str())); if (GetBoolArg("-shrinkdebugfile", !fDebug)) ShrinkDebugFile(); printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); - printf("CasinoCoin version %s (%s)\n", FormatFullVersion().c_str(), CLIENT_DATE.c_str()); + std::string versionString = COIN_NAME_DISPLAY + " version %s (%s)\n"; + printf(versionString.c_str(), FormatFullVersion().c_str(), CLIENT_DATE.c_str()); printf("Using OpenSSL version %s\n", SSLeay_version(SSLEAY_VERSION)); if (!fLogTimestamps) printf("Startup time: %s\n", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()).c_str()); @@ -660,8 +662,9 @@ bool AppInit2(boost::thread_group& threadGroup) std::ostringstream strErrors; if (fDaemon) - fprintf(stdout, "CasinoCoin server starting\n"); - + { + fprintf(stdout, "%s server starting\n", COIN_NAME_DISPLAY.c_str()); + } if (nScriptCheckThreads) { printf("Using %u threads for script verification\n", nScriptCheckThreads); for (int i=0; inHeight - pindexRescan->nHeight, pindexRescan->nHeight); nStart = GetTimeMillis(); pwalletMain->ScanForWalletTransactions(pindexRescan, true); - printf(" rescan %15"PRI64d"ms\n", GetTimeMillis() - nStart); + printf(" rescan %15" PRI64d "ms\n", GetTimeMillis() - nStart); pwalletMain->SetBestChain(CBlockLocator(pindexBest)); nWalletDBUpdated++; } @@ -1099,7 +1102,7 @@ bool AppInit2(boost::thread_group& threadGroup) printf("Invalid or missing peers.dat; recreating\n"); } - printf("Loaded %i addresses from peers.dat %"PRI64d"ms\n", + printf("Loaded %i addresses from peers.dat %" PRI64d "ms\n", addrman.size(), GetTimeMillis() - nStart); // ********************************************************* Step 11: start node @@ -1113,11 +1116,11 @@ bool AppInit2(boost::thread_group& threadGroup) RandAddSeedPerfmon(); //// debug print - printf("mapBlockIndex.size() = %"PRIszu"\n", mapBlockIndex.size()); + printf("mapBlockIndex.size() = %" PRIszu "\n", mapBlockIndex.size()); printf("nBestHeight = %d\n", nBestHeight); - printf("setKeyPool.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->setKeyPool.size() : 0); - printf("mapWallet.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->mapWallet.size() : 0); - printf("mapAddressBook.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0); + printf("setKeyPool.size() = %" PRIszu "\n", pwalletMain ? pwalletMain->setKeyPool.size() : 0); + printf("mapWallet.size() = %" PRIszu "\n", pwalletMain ? pwalletMain->mapWallet.size() : 0); + printf("mapAddressBook.size() = %" PRIszu "\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0); StartNode(threadGroup); diff --git a/src/main.cpp b/src/main.cpp index 553d005..8deb005 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -66,7 +66,7 @@ map > mapOrphanTransactionsByPrev; // Constant stuff for coinbase transactions we create: CScript COINBASE_FLAGS; -const string strMessageMagic = "CasinoCoin Signed Message:\n"; +const string strMessageMagic = COIN_NAME_DISPLAY + " Signed Message:\n"; double dHashesPerSec = 0.0; int64 nHPSTimerStart = 0; @@ -309,7 +309,7 @@ bool AddOrphanTx(const CTransaction& tx) BOOST_FOREACH(const CTxIn& txin, tx.vin) mapOrphanTransactionsByPrev[txin.prevout.hash].insert(hash); - printf("stored orphan tx %s (mapsz %"PRIszu")\n", hash.ToString().c_str(), + printf("stored orphan tx %s (mapsz %" PRIszu ")\n", hash.ToString().c_str(), mapOrphanTransactions.size()); return true; } @@ -755,7 +755,7 @@ bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fCheckIn // Don't accept it if it can't get into a block int64 txMinFee = tx.GetMinFee(1000, true, GMF_RELAY); if (fLimitFree && nFees < txMinFee) - return error("CTxMemPool::accept() : not enough fees %s, %"PRI64d" < %"PRI64d, + return error("CTxMemPool::accept() : not enough fees %s, %" PRI64d " < %" PRI64d, hash.ToString().c_str(), nFees, txMinFee); @@ -1239,7 +1239,7 @@ unsigned int static GetNextWorkRequired_V1(const CBlockIndex* pindexLast, const // Limit adjustment step int64 nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime(); - printf(" nActualTimespan = %"PRI64d" before bounds\n", nActualTimespan); + printf(" nActualTimespan = %" PRI64d " before bounds\n", nActualTimespan); if (nActualTimespan < nTargetTimespan/4) nActualTimespan = nTargetTimespan/4; if (nActualTimespan > nTargetTimespan*4) @@ -1256,7 +1256,7 @@ unsigned int static GetNextWorkRequired_V1(const CBlockIndex* pindexLast, const /// debug print printf("Difficulty Retarget - GetNextWorkRequired_V1 RETARGET\n"); - printf("nTargetTimespan = %"PRI64d" nActualTimespan = %"PRI64d"\n", nTargetTimespan, nActualTimespan); + printf("nTargetTimespan = %" PRI64d " nActualTimespan = %" PRI64d "\n", nTargetTimespan, nActualTimespan); printf("Before: %08x %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str()); printf("After: %08x %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); @@ -1390,7 +1390,7 @@ unsigned int static DigiShield(const CBlockIndex* pindexLast, const CBlockHeader // Limit adjustment step int64 nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime(); - printf(" nActualTimespan = %"PRI64d" before bounds\n", nActualTimespan); + printf(" nActualTimespan = %" PRI64d " before bounds\n", nActualTimespan); @@ -1406,7 +1406,7 @@ unsigned int static DigiShield(const CBlockIndex* pindexLast, const CBlockHeader /// debug print printf("DigiShield RETARGET \n"); - printf("retargetTimespan = %"PRI64d" nActualTimespan = %"PRI64d"\n", retargetTimespan, nActualTimespan); + printf("retargetTimespan = %" PRI64d " nActualTimespan = %" PRI64d "\n", retargetTimespan, nActualTimespan); printf("Before: %08x %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str()); printf("After: %08x %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); @@ -1964,7 +1964,7 @@ bool CBlock::ConnectBlock(CValidationState &state, CBlockIndex* pindex, CCoinsVi printf("- Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin)\n", (unsigned)vtx.size(), 0.001 * nTime, 0.001 * nTime / vtx.size(), nInputs <= 1 ? 0 : 0.001 * nTime / (nInputs-1)); if (vtx[0].GetValueOut() > GetBlockValue(pindex->nHeight, nFees)) - return state.DoS(100, error("ConnectBlock() : coinbase pays too much (actual=%"PRI64d" vs limit=%"PRI64d")", vtx[0].GetValueOut(), GetBlockValue(pindex->nHeight, nFees))); + return state.DoS(100, error("ConnectBlock() : coinbase pays too much (actual=%" PRI64d " vs limit=%" PRI64d ")", vtx[0].GetValueOut(), GetBlockValue(pindex->nHeight, nFees))); if (!control.Wait()) return state.DoS(100, false); @@ -2044,8 +2044,8 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew) reverse(vConnect.begin(), vConnect.end()); if (vDisconnect.size() > 0) { - printf("REORGANIZE: Disconnect %"PRIszu" blocks; %s..\n", vDisconnect.size(), pfork->GetBlockHash().ToString().c_str()); - printf("REORGANIZE: Connect %"PRIszu" blocks; ..%s\n", vConnect.size(), pindexNew->GetBlockHash().ToString().c_str()); + printf("REORGANIZE: Disconnect %" PRIszu " blocks; %s..\n", vDisconnect.size(), pfork->GetBlockHash().ToString().c_str()); + printf("REORGANIZE: Connect %" PRIszu " blocks; ..%s\n", vConnect.size(), pindexNew->GetBlockHash().ToString().c_str()); } // Disconnect shorter branch @@ -3153,7 +3153,7 @@ void PrintBlockTree() // print item CBlock block; block.ReadFromDisk(pindex); - printf("%d (blk%05u.dat:0x%x) %s tx %"PRIszu"", + printf("%d (blk%05u.dat:0x%x) %s tx %" PRIszu "", pindex->nHeight, pindex->GetBlockPos().nFile, pindex->GetBlockPos().nPos, DateTimeStrFormat("%Y-%m-%d %H:%M:%S", block.GetBlockTime()).c_str(), @@ -3246,7 +3246,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp) AbortNode(_("Error: system error: ") + e.what()); } if (nLoaded > 0) - printf("Loaded %i blocks from external file in %"PRI64d"ms\n", nLoaded, GetTimeMillis() - nStart); + printf("Loaded %i blocks from external file in %" PRI64d "ms\n", nLoaded, GetTimeMillis() - nStart); return nLoaded > 0; } @@ -3498,7 +3498,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) { RandAddSeedPerfmon(); if (fDebug) - printf("received: %s (%"PRIszu" bytes)\n", strCommand.c_str(), vRecv.size()); + printf("received: %s (%" PRIszu " bytes)\n", strCommand.c_str(), vRecv.size()); if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0) { printf("dropmessagestest DROPPING RECV MESSAGE\n"); @@ -3637,7 +3637,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) if (vAddr.size() > 1000) { pfrom->Misbehaving(20); - return error("message addr size() = %"PRIszu"", vAddr.size()); + return error("message addr size() = %" PRIszu "", vAddr.size()); } // Store the new addresses @@ -3700,7 +3700,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) if (vInv.size() > MAX_INV_SZ) { pfrom->Misbehaving(20); - return error("message inv size() = %"PRIszu"", vInv.size()); + return error("message inv size() = %" PRIszu "", vInv.size()); } // find last block in inv vector @@ -3749,11 +3749,11 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) if (vInv.size() > MAX_INV_SZ) { pfrom->Misbehaving(20); - return error("message getdata size() = %"PRIszu"", vInv.size()); + return error("message getdata size() = %" PRIszu "", vInv.size()); } if (fDebugNet || (vInv.size() != 1)) - printf("received getdata (%"PRIszu" invsz)\n", vInv.size()); + printf("received getdata (%" PRIszu " invsz)\n", vInv.size()); if ((fDebugNet && vInv.size() > 0) || (vInv.size() == 1)) printf("received getdata for: %s\n", vInv[0].ToString().c_str()); @@ -3854,7 +3854,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) vWorkQueue.push_back(inv.hash); vEraseQueue.push_back(inv.hash); - printf("AcceptToMemoryPool: %s %s : accepted %s (poolsz %"PRIszu")\n", + printf("AcceptToMemoryPool: %s %s : accepted %s (poolsz %" PRIszu ")\n", pfrom->addr.ToString().c_str(), pfrom->cleanSubVer.c_str(), tx.GetHash().ToString().c_str(), mempool.mapTx.size()); @@ -4703,7 +4703,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) nLastBlockTx = nBlockTx; nLastBlockSize = nBlockSize; - printf("CreateNewBlock(): total size %"PRI64u"\n", nBlockSize); + printf("CreateNewBlock(): total size %" PRI64u "\n", nBlockSize); pblock->vtx[0].vout[0].nValue = GetBlockValue(pindexPrev->nHeight+1, nFees); pblocktemplate->vTxFees[0] = -nFees; @@ -4866,7 +4866,7 @@ void static CasinoCoinMiner(CWallet *pwallet) CBlock *pblock = &pblocktemplate->block; IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); - printf("Running CasinoCoinMiner with %"PRIszu" transactions in block (%u bytes)\n", pblock->vtx.size(), + printf("Running CasinoCoinMiner with %" PRIszu " transactions in block (%u bytes)\n", pblock->vtx.size(), ::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION)); // diff --git a/src/main.h b/src/main.h index 32fd37e..d31da58 100644 --- a/src/main.h +++ b/src/main.h @@ -448,7 +448,7 @@ public: { if (scriptPubKey.size() < 6) return "CTxOut(error)"; - return strprintf("CTxOut(nValue=%"PRI64d".%08"PRI64d", scriptPubKey=%s)", nValue / COIN, nValue % COIN, scriptPubKey.ToString().substr(0,30).c_str()); + return strprintf("CTxOut(nValue=%" PRI64d ".%08" PRI64d ", scriptPubKey=%s)", nValue / COIN, nValue % COIN, scriptPubKey.ToString().substr(0,30).c_str()); } void print() const @@ -644,7 +644,7 @@ void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCach std::string ToString() const { std::string str; - str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%"PRIszu", vout.size=%"PRIszu", nLockTime=%u)\n", + str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%" PRIszu ", vout.size=%" PRIszu ", nLockTime=%u)\n", GetHash().ToString().c_str(), nVersion, vin.size(), @@ -1488,7 +1488,7 @@ public: void print() const { - printf("CBlock(hash=%s, input=%s, PoW=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%"PRIszu")\n", + printf("CBlock(hash=%s, input=%s, PoW=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%" PRIszu ")\n", GetHash().ToString().c_str(), HexStr(BEGIN(nVersion),BEGIN(nVersion)+80,false).c_str(), GetPoWHash().ToString().c_str(), diff --git a/src/net.cpp b/src/net.cpp index dd59baf..52f4ce0 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1262,7 +1262,7 @@ void DumpAddresses() CAddrDB adb; adb.Write(addrman); - printf("Flushed %d addresses to peers.dat %"PRI64d"ms\n", + printf("Flushed %d addresses to peers.dat %" PRI64d "ms\n", addrman.size(), GetTimeMillis() - nStart); } diff --git a/src/net.h b/src/net.h index 0f4ba4f..e9d3343 100644 --- a/src/net.h +++ b/src/net.h @@ -366,7 +366,7 @@ public: else nRequestTime = 0; if (fDebugNet) - printf("askfor %s %"PRI64d" (%s)\n", inv.ToString().c_str(), nRequestTime, DateTimeStrFormat("%H:%M:%S", nRequestTime/1000000).c_str()); + printf("askfor %s %" PRI64d " (%s)\n", inv.ToString().c_str(), nRequestTime, DateTimeStrFormat("%H:%M:%S", nRequestTime/1000000).c_str()); // Make sure not to reuse time indexes to keep things in the same order int64 nNow = (GetTime() - 1) * 1000000; diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp index 5362e37..8a8b47f 100644 --- a/src/qt/askpassphrasedialog.cpp +++ b/src/qt/askpassphrasedialog.cpp @@ -3,6 +3,7 @@ #include "guiconstants.h" #include "walletmodel.h" +#include "version.h" #include #include @@ -98,7 +99,8 @@ void AskPassphraseDialog::accept() break; } QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm wallet encryption"), - tr("Warning: If you encrypt your wallet and lose your passphrase, you will LOSE ALL OF YOUR CASINOCOINS!") + "

" + tr("Are you sure you wish to encrypt your wallet?"), + tr((std::string("Warning: If you encrypt your wallet and lose your passphrase, you will LOSE ALL OF YOUR ") + + COIN_NAME_DISPLAY + "!").c_str()) + "

" + tr("Are you sure you wish to encrypt your wallet?"), QMessageBox::Yes|QMessageBox::Cancel, QMessageBox::Cancel); if(retval == QMessageBox::Yes) @@ -109,9 +111,9 @@ void AskPassphraseDialog::accept() { QMessageBox::warning(this, tr("Wallet encrypted"), "" + - tr("CasinoCoin will close now to finish the encryption process. " + tr((std::string("")+ COIN_NAME_DISPLAY + " will close now to finish the encryption process. " "Remember that encrypting your wallet cannot fully protect " - "your casinocoins from being stolen by malware infecting your computer.") + + "your "+ COIN_NAME + " from being stolen by malware infecting your computer.").c_str()) + "

" + tr("IMPORTANT: Any previous backups you have made of your wallet file " "should be replaced with the newly generated, encrypted wallet file. " diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 79c063a..d123c8b 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -110,7 +110,7 @@ static std::string Translate(const char* psz) static void handleRunawayException(std::exception *e) { PrintExceptionContinue(e, "Runaway exception"); - QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. CasinoCoin can no longer continue safely and will quit.") + QString("\n\n") + QString::fromStdString(strMiscWarning)); + QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr(("A fatal error occurred. "+ COIN_NAME_DISPLAY + " can no longer continue safely and will quit.").c_str()) + QString("\n\n") + QString::fromStdString(strMiscWarning)); exit(1); } @@ -146,7 +146,7 @@ int main(int argc, char *argv[]) { // This message can not be translated, as translation is not initialized yet // (which not yet possible because lang=XX can be overridden in bitcoin.conf in the data directory) - QMessageBox::critical(0, "CasinoCoin", + QMessageBox::critical(0, COIN_NAME_DISPLAY.c_str(), QString("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(mapArgs["-datadir"]))); return 1; } @@ -154,12 +154,12 @@ int main(int argc, char *argv[]) // Application identification (must be set before OptionsModel is initialized, // as it is used to locate QSettings) - QApplication::setOrganizationName("CasinoCoin"); + QApplication::setOrganizationName(COIN_NAME_DISPLAY.c_str()); QApplication::setOrganizationDomain("casinocoin.org"); if(GetBoolArg("-testnet")) // Separate UI settings for testnet - QApplication::setApplicationName("CasinoCoin-Qt-testnet"); + QApplication::setApplicationName((""+ COIN_NAME_DISPLAY + "-Qt-testnet").c_str()); else - QApplication::setApplicationName("CasinoCoin-Qt"); + QApplication::setApplicationName((""+ COIN_NAME_DISPLAY + "-Qt").c_str()); // ... then GUI settings: OptionsModel optionsModel; diff --git a/src/qt/bitcoinstrings.cpp b/src/qt/bitcoinstrings.cpp index 72311f6..36105bd 100644 --- a/src/qt/bitcoinstrings.cpp +++ b/src/qt/bitcoinstrings.cpp @@ -1,4 +1,5 @@ #include +#include "version.h" // Automatically generated by extract_strings.py #ifdef __GNUC__ #define UNUSED __attribute__((unused)) @@ -6,18 +7,19 @@ #define UNUSED #endif static const char UNUSED *bitcoin_strings[] = { -QT_TRANSLATE_NOOP("bitcoin-core", "" -"%s, you must set a rpcpassword in the configuration file:\n" -"%s\n" -"It is recommended you use the following random password:\n" -"rpcuser=casinocoinrpc\n" -"rpcpassword=%s\n" -"(you do not need to remember this password)\n" -"The username and password MUST NOT be the same.\n" -"If the file does not exist, create it with owner-readable-only file " -"permissions.\n" -"It is also recommended to set alertnotify so you are notified of problems;\n" -"for example: alertnotify=echo %%s | mail -s \"CasinoCoin Alert\" admin@foo.com\n"), +QT_TRANSLATE_NOOP("bitcoin-core", (std::string("") + +"%s, you must set a rpcpassword in the configuration file:\n" + +"%s\n" + +"It is recommended you use the following random password:\n" + +"rpcuser=" + COIN_NAME +"rpc\n" + +"rpcpassword=%s\n" + +"(you do not need to remember this password)\n" + +"The username and password MUST NOT be the same.\n" + +"If the file does not exist, create it with owner-readable-only file " + +"permissions.\n" + +"It is also recommended to set alertnotify so you are notified of problems;\n" + +"for example: alertnotify=echo %%s | mail -s \"" + COIN_NAME_DISPLAY + +" Alert\" admin@foo.com\n").c_str()), QT_TRANSLATE_NOOP("bitcoin-core", "" "Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:" "@STRENGTH)"), @@ -29,9 +31,9 @@ QT_TRANSLATE_NOOP("bitcoin-core", "" QT_TRANSLATE_NOOP("bitcoin-core", "" "Bind to given address and always listen on it. Use [host]:port notation for " "IPv6"), -QT_TRANSLATE_NOOP("bitcoin-core", "" -"Cannot obtain a lock on data directory %s. CasinoCoin is probably already " -"running."), +QT_TRANSLATE_NOOP("bitcoin-core", (std::string("") + +"Cannot obtain a lock on data directory %s. "+ COIN_NAME_DISPLAY + " is probably already " +"running.").c_str()), QT_TRANSLATE_NOOP("bitcoin-core", "" "Error: The transaction was rejected! This might happen if some of the coins " "in your wallet were already spent, such as if you used a copy of wallet.dat " @@ -62,17 +64,17 @@ QT_TRANSLATE_NOOP("bitcoin-core", "" QT_TRANSLATE_NOOP("bitcoin-core", "" "This is a pre-release test build - use at your own risk - do not use for " "mining or merchant applications"), -QT_TRANSLATE_NOOP("bitcoin-core", "" -"Unable to bind to %s on this computer. CasinoCoin is probably already running."), +QT_TRANSLATE_NOOP("bitcoin-core", (std::string("") + +"Unable to bind to %s on this computer. "+ COIN_NAME_DISPLAY + " is probably already running.").c_str()), QT_TRANSLATE_NOOP("bitcoin-core", "" "Warning: -paytxfee is set very high! This is the transaction fee you will " "pay if you send a transaction."), QT_TRANSLATE_NOOP("bitcoin-core", "" "Warning: Displayed transactions may not be correct! You may need to upgrade, " "or other nodes may need to upgrade."), -QT_TRANSLATE_NOOP("bitcoin-core", "" +QT_TRANSLATE_NOOP("bitcoin-core", (std::string("") + "Warning: Please check that your computer's date and time are correct! If " -"your clock is wrong CasinoCoin will not work properly."), +"your clock is wrong "+ COIN_NAME_DISPLAY + " will not work properly.").c_str()), QT_TRANSLATE_NOOP("bitcoin-core", "" "Warning: error reading wallet.dat! All keys read correctly, but transaction " "data or address book entries might be missing or incorrect."), @@ -91,7 +93,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Add a node to connect to and attempt to keep QT_TRANSLATE_NOOP("bitcoin-core", "Allow DNS lookups for -addnode, -seednode and -connect"), QT_TRANSLATE_NOOP("bitcoin-core", "Allow JSON-RPC connections from specified IP address"), QT_TRANSLATE_NOOP("bitcoin-core", "Attempt to recover private keys from a corrupt wallet.dat"), -QT_TRANSLATE_NOOP("bitcoin-core", "CasinoCoin version"), +QT_TRANSLATE_NOOP("bitcoin-core", (COIN_NAME_DISPLAY + " version").c_str()), QT_TRANSLATE_NOOP("bitcoin-core", "Block creation options:"), QT_TRANSLATE_NOOP("bitcoin-core", "Cannot downgrade wallet"), QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -bind address: '%s'"), @@ -109,7 +111,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Error initializing wallet database environmen QT_TRANSLATE_NOOP("bitcoin-core", "Error loading block database"), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat"), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet corrupted"), -QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet requires newer version of CasinoCoin"), +QT_TRANSLATE_NOOP("bitcoin-core", (std::string("Error loading wallet.dat: Wallet requires newer version of ")+ COIN_NAME_DISPLAY + "").c_str()), QT_TRANSLATE_NOOP("bitcoin-core", "Error opening block database"), QT_TRANSLATE_NOOP("bitcoin-core", "Error"), QT_TRANSLATE_NOOP("bitcoin-core", "Error: Disk space is low!"), @@ -162,9 +164,9 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Rebuild block chain index from current blk000 QT_TRANSLATE_NOOP("bitcoin-core", "Rescan the block chain for missing wallet transactions"), QT_TRANSLATE_NOOP("bitcoin-core", "Rescanning..."), QT_TRANSLATE_NOOP("bitcoin-core", "Run in the background as a daemon and accept commands"), -QT_TRANSLATE_NOOP("bitcoin-core", "SSL options: (see the CasinoCoin Wiki for SSL setup instructions)"), +QT_TRANSLATE_NOOP("bitcoin-core", (std::string("SSL options: (see the ") + COIN_NAME_DISPLAY + " Wiki for SSL setup instructions)").c_str()), QT_TRANSLATE_NOOP("bitcoin-core", "Select the version of socks proxy to use (4-5, default: 5)"), -QT_TRANSLATE_NOOP("bitcoin-core", "Send command to -server or casinocoind"), +QT_TRANSLATE_NOOP("bitcoin-core", (std::string("Send command to -server or ") + COIN_NAME + "d").c_str()), QT_TRANSLATE_NOOP("bitcoin-core", "Send commands to node running on (default: 127.0.0.1)"), QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to console instead of debug.log file"), QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to debugger"), @@ -177,10 +179,10 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Set minimum block size in bytes (default: 0)" QT_TRANSLATE_NOOP("bitcoin-core", "Set the number of threads to service RPC calls (default: 4)"), QT_TRANSLATE_NOOP("bitcoin-core", "Shrink debug.log file on client startup (default: 1 when no -debug)"), QT_TRANSLATE_NOOP("bitcoin-core", "Signing transaction failed"), -QT_TRANSLATE_NOOP("bitcoin-core", "Specify configuration file (default: casinocoin.conf)"), +QT_TRANSLATE_NOOP("bitcoin-core", (std::string("Specify configuration file (default: ") + COIN_NAME + ".conf)").c_str()), QT_TRANSLATE_NOOP("bitcoin-core", "Specify connection timeout in milliseconds (default: 5000)"), QT_TRANSLATE_NOOP("bitcoin-core", "Specify data directory"), -QT_TRANSLATE_NOOP("bitcoin-core", "Specify pid file (default: casinocoind.pid)"), +QT_TRANSLATE_NOOP("bitcoin-core", (std::string("Specify pid file (default: ") + COIN_NAME + "d.pid)").c_str()), QT_TRANSLATE_NOOP("bitcoin-core", "Specify your own public address"), QT_TRANSLATE_NOOP("bitcoin-core", "System error: "), QT_TRANSLATE_NOOP("bitcoin-core", "This help message"), @@ -202,7 +204,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Use the test network"), QT_TRANSLATE_NOOP("bitcoin-core", "Username for JSON-RPC connections"), QT_TRANSLATE_NOOP("bitcoin-core", "Verifying blocks..."), QT_TRANSLATE_NOOP("bitcoin-core", "Verifying wallet..."), -QT_TRANSLATE_NOOP("bitcoin-core", "Wallet needed to be rewritten: restart CasinoCoin to complete"), +QT_TRANSLATE_NOOP("bitcoin-core", (std::string("Wallet needed to be rewritten: restart ")+ COIN_NAME_DISPLAY + " to complete").c_str()), QT_TRANSLATE_NOOP("bitcoin-core", "Warning"), QT_TRANSLATE_NOOP("bitcoin-core", "Warning: This version is obsolete, upgrade required!"), QT_TRANSLATE_NOOP("bitcoin-core", "You need to rebuild the database using -reindex to change -txindex"), diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 48dcf98..eaa4ce3 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -84,7 +84,7 @@ void setupAmountWidget(QLineEdit *widget, QWidget *parent) bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out) { // return if URI is not valid or is no bitcoin URI - if(!uri.isValid() || uri.scheme() != QString("casinocoin")) + if(!uri.isValid() || uri.scheme() != QString(COIN_NAME.c_str())) return false; SendCoinsRecipient rv; @@ -139,9 +139,9 @@ bool parseBitcoinURI(QString uri, SendCoinsRecipient *out) // // Cannot handle this later, because bitcoin:// will cause Qt to see the part after // as host, // which will lower-case it (and thus invalidate the address). - if(uri.startsWith("casinocoin://")) + if(uri.startsWith(QString((COIN_NAME + "://").c_str()))) { - uri.replace(0, 11, "casinocoin:"); + uri.replace(0, (COIN_NAME.length()+1), QString((COIN_NAME + ":").c_str())); } QUrl uriInstance(uri); return parseBitcoinURI(uriInstance, out); @@ -301,7 +301,7 @@ bool ToolTipToRichTextFilter::eventFilter(QObject *obj, QEvent *evt) #ifdef WIN32 boost::filesystem::path static StartupShortcutPath() { - return GetSpecialFolderPath(CSIDL_STARTUP) / "CasinoCoin.lnk"; + return GetSpecialFolderPath(CSIDL_STARTUP) / (COIN_NAME_DISPLAY + ".lnk").c_str(); } bool GetStartOnSystemStartup() @@ -383,7 +383,7 @@ boost::filesystem::path static GetAutostartDir() boost::filesystem::path static GetAutostartFilePath() { - return GetAutostartDir() / "casinocoin.desktop"; + return GetAutostartDir() / ""+ COIN_NAME + ".desktop"; } bool GetStartOnSystemStartup() @@ -424,7 +424,7 @@ bool SetStartOnSystemStartup(bool fAutoStart) // Write a bitcoin.desktop file to the autostart directory: optionFile << "[Desktop Entry]\n"; optionFile << "Type=Application\n"; - optionFile << "Name=CasinoCoin\n"; + optionFile << "Name="+ COIN_NAME_DISPLAY + "\n"; optionFile << "Exec=" << pszExePath << " -min\n"; optionFile << "Terminal=false\n"; optionFile << "Hidden=false\n"; @@ -495,10 +495,10 @@ bool SetStartOnSystemStartup(bool fAutoStart) { return false; } HelpMessageBox::HelpMessageBox(QWidget *parent) : QMessageBox(parent) { - header = tr("CasinoCoin-Qt") + " " + tr("version") + " " + + header = tr((COIN_NAME_DISPLAY + "-Qt").c_str()) + " " + tr("version") + " " + QString::fromStdString(FormatFullVersion()) + "\n\n" + tr("Usage:") + "\n" + - " casinocoin-qt [" + tr("command-line options") + "] " + "\n"; + QString::fromStdString(" "+ COIN_NAME + "-qt [") + tr("command-line options") + "] " + "\n"; coreOptions = QString::fromStdString(HelpMessage()); @@ -507,7 +507,7 @@ HelpMessageBox::HelpMessageBox(QWidget *parent) : " -min " + tr("Start minimized") + "\n" + " -splash " + tr("Show splash screen on startup (default: 1)") + "\n"; - setWindowTitle(tr("CasinoCoin-Qt")); + setWindowTitle(tr((COIN_NAME_DISPLAY + "-Qt").c_str())); setTextFormat(Qt::PlainText); // setMinimumWidth is ignored for QMessageBox so put in non-breaking spaces to make it wider. setText(header + QString(QChar(0x2003)).repeated(50)); diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index 3514664..ed14302 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -106,7 +106,7 @@ PaymentServer::PaymentServer(QApplication* parent) : QObject(parent), saveURIs(t uriServer = new QLocalServer(this); if (!uriServer->listen(name)) - qDebug() << tr("Cannot start casinocoin: click-to-pay handler"); + qDebug() << tr((std::string("Cannot start ")+ COIN_NAME + ": click-to-pay handler").c_str()); else connect(uriServer, SIGNAL(newConnection()), this, SLOT(handleURIConnection())); } diff --git a/src/qt/qrcodedialog.cpp b/src/qt/qrcodedialog.cpp index c4b26c3..e41af51 100644 --- a/src/qt/qrcodedialog.cpp +++ b/src/qt/qrcodedialog.cpp @@ -5,6 +5,7 @@ #include "guiconstants.h" #include "guiutil.h" #include "optionsmodel.h" +#include "version.h" #include #if QT_VERSION < 0x050000 @@ -85,7 +86,7 @@ void QRCodeDialog::genCode() QString QRCodeDialog::getURI() { - QString ret = QString("casinocoin:%1").arg(address); + QString ret = QString((COIN_NAME + ":%1").c_str()).arg(address); int paramCount = 0; ui->outUri->clear(); diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp index 42d107c..6cc6d14 100644 --- a/src/rpcdump.cpp +++ b/src/rpcdump.cpp @@ -36,7 +36,7 @@ Value importprivkey(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 3) throw runtime_error( - "importprivkey [label] [rescan=true]\n" + "importprivkey <"+ COIN_NAME + "privkey> [label] [rescan=true]\n" "Adds a private key (as returned by dumpprivkey) to your wallet."); string strSecret = params[0].get_str(); @@ -79,13 +79,13 @@ Value dumpprivkey(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( - "dumpprivkey \n" - "Reveals the private key corresponding to ."); + "dumpprivkey <"+ COIN_NAME + "address>\n" + "Reveals the private key corresponding to <"+ COIN_NAME + "address>."); string strAddress = params[0].get_str(); CBitcoinAddress address; if (!address.SetString(strAddress)) - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid CasinoCoin address"); + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid "+ COIN_NAME_DISPLAY + " address"); CKeyID keyID; if (!address.GetKeyID(keyID)) throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to a key"); diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 3b899fc..55d8a65 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -171,10 +171,10 @@ Value getworkex(const Array& params, bool fHelp) ); if (vNodes.empty()) - throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "CasinoCoin is not connected!"); + throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, ""+ COIN_NAME_DISPLAY + " is not connected!"); if (IsInitialBlockDownload()) - throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "CasinoCoin is downloading blocks..."); + throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, ""+ COIN_NAME_DISPLAY + " is downloading blocks..."); typedef map > mapNewBlock_t; static mapNewBlock_t mapNewBlock; // FIXME: thread safety @@ -311,10 +311,10 @@ Value getwork(const Array& params, bool fHelp) "If [data] is specified, tries to solve the block and returns true if it was successful."); if (vNodes.empty()) - throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "CasinoCoin is not connected!"); + throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, ""+ COIN_NAME_DISPLAY + " is not connected!"); if (IsInitialBlockDownload()) - throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "CasinoCoin is downloading blocks..."); + throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, ""+ COIN_NAME_DISPLAY + " is downloading blocks..."); typedef map > mapNewBlock_t; static mapNewBlock_t mapNewBlock; // FIXME: thread safety @@ -453,10 +453,10 @@ Value getblocktemplate(const Array& params, bool fHelp) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); if (vNodes.empty()) - throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "CasinoCoin is not connected!"); + throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, ""+ COIN_NAME_DISPLAY + " is not connected!"); if (IsInitialBlockDownload()) - throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "CasinoCoin is downloading blocks..."); + throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, ""+ COIN_NAME_DISPLAY + " is downloading blocks..."); // Update block static unsigned int nTransactionsUpdatedLast; diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp index 1228cb4..c175837 100644 --- a/src/rpcnet.cpp +++ b/src/rpcnet.cpp @@ -48,7 +48,7 @@ Value getpeerinfo(const Array& params, bool fHelp) Object obj; obj.push_back(Pair("addr", stats.addrName)); - obj.push_back(Pair("services", strprintf("%08"PRI64x, stats.nServices))); + obj.push_back(Pair("services", strprintf("%08" PRI64x, stats.nServices))); obj.push_back(Pair("lastsend", (boost::int64_t)stats.nLastSend)); obj.push_back(Pair("lastrecv", (boost::int64_t)stats.nLastRecv)); obj.push_back(Pair("bytessent", (boost::int64_t)stats.nSendBytes)); diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index 65aa0fe..95a4406 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -195,7 +195,7 @@ Value listunspent(const Array& params, bool fHelp) { CBitcoinAddress address(input.get_str()); if (!address.IsValid()) - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid CasinoCoin address: ")+input.get_str()); + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid "+ COIN_NAME_DISPLAY + " address: ")+input.get_str()); if (setAddress.count(address)) throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+input.get_str()); setAddress.insert(address); @@ -294,7 +294,7 @@ Value createrawtransaction(const Array& params, bool fHelp) { CBitcoinAddress address(s.name_); if (!address.IsValid()) - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid CasinoCoin address: ")+s.name_); + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid "+ COIN_NAME_DISPLAY + " address: ")+s.name_); if (setAddress.count(address)) throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+s.name_); diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index 5748c5d..692a735 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -101,7 +101,7 @@ Value getnewaddress(const Array& params, bool fHelp) if (fHelp || params.size() > 1) throw runtime_error( "getnewaddress [account]\n" - "Returns a new CasinoCoin address for receiving payments. " + "Returns a new " + COIN_NAME_DISPLAY + " address for receiving payments. " "If [account] is specified (recommended), it is added to the address book " "so payments received with the address will be credited to [account]."); @@ -145,8 +145,10 @@ CBitcoinAddress GetAccountAddress(string strAccount, bool bForceNew=false) { const CWalletTx& wtx = (*it).second; BOOST_FOREACH(const CTxOut& txout, wtx.vout) + { if (txout.scriptPubKey == scriptPubKey) bKeyUsed = true; + } } } @@ -168,7 +170,7 @@ Value getaccountaddress(const Array& params, bool fHelp) if (fHelp || params.size() != 1) throw runtime_error( "getaccountaddress \n" - "Returns the current CasinoCoin address for receiving payments to this account."); + "Returns the current " + COIN_NAME_DISPLAY + " address for receiving payments to this account."); // Parse the account first so we don't generate a key if there's an error string strAccount = AccountFromValue(params[0]); @@ -186,12 +188,12 @@ Value setaccount(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( - "setaccount \n" + "setaccount <" + COIN_NAME + "address> \n" "Sets the account associated with the given address."); CBitcoinAddress address(params[0].get_str()); if (!address.IsValid()) - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid CasinoCoin address"); + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid " + COIN_NAME_DISPLAY + " address"); string strAccount; @@ -216,12 +218,12 @@ Value getaccount(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( - "getaccount \n" + "getaccount <" + COIN_NAME + "address>\n" "Returns the account associated with the given address."); CBitcoinAddress address(params[0].get_str()); if (!address.IsValid()) - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid CasinoCoin address"); + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid " + COIN_NAME_DISPLAY + " address"); string strAccount; map::iterator mi = pwalletMain->mapAddressBook.find(address.Get()); @@ -274,13 +276,13 @@ Value sendtoaddress(const Array& params, bool fHelp) { if (fHelp || params.size() < 2 || params.size() > 4) throw runtime_error( - "sendtoaddress [comment] [comment-to]\n" + "sendtoaddress <"+ COIN_NAME + "address> [comment] [comment-to]\n" " is a real and is rounded to the nearest 0.00000001" + HelpRequiringPassphrase()); CBitcoinAddress address(params[0].get_str()); if (!address.IsValid()) - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid CasinoCoin address"); + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid "+ COIN_NAME_DISPLAY + " address"); // Amount int64 nAmount = AmountFromValue(params[1]); @@ -337,7 +339,7 @@ Value signmessage(const Array& params, bool fHelp) { if (fHelp || params.size() != 2) throw runtime_error( - "signmessage \n" + "signmessage <"+ COIN_NAME + "address> \n" "Sign a message with the private key of an address"); EnsureWalletIsUnlocked(); @@ -372,7 +374,7 @@ Value verifymessage(const Array& params, bool fHelp) { if (fHelp || params.size() != 3) throw runtime_error( - "verifymessage \n" + "verifymessage <" + COIN_NAME + "address> \n" "Verify a signed message"); string strAddress = params[0].get_str(); @@ -409,14 +411,14 @@ Value getreceivedbyaddress(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( - "getreceivedbyaddress [minconf=1]\n" - "Returns the total amount received by in transactions with at least [minconf] confirmations."); + "getreceivedbyaddress <" + COIN_NAME + "address> [minconf=1]\n" + "Returns the total amount received by <" + COIN_NAME + "address> in transactions with at least [minconf] confirmations."); // Bitcoin address CBitcoinAddress address = CBitcoinAddress(params[0].get_str()); CScript scriptPubKey; if (!address.IsValid()) - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid CasinoCoin address"); + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid " + COIN_NAME_DISPLAY + " address"); scriptPubKey.SetDestination(address.Get()); if (!IsMine(*pwalletMain,scriptPubKey)) return (double)0.0; @@ -630,14 +632,14 @@ Value sendfrom(const Array& params, bool fHelp) { if (fHelp || params.size() < 3 || params.size() > 6) throw runtime_error( - "sendfrom [minconf=1] [comment] [comment-to]\n" + "sendfrom [minconf=1] [comment] [comment-to]\n" " is a real and is rounded to the nearest 0.00000001" + HelpRequiringPassphrase()); string strAccount = AccountFromValue(params[0]); CBitcoinAddress address(params[1].get_str()); if (!address.IsValid()) - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid CasinoCoin address"); + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid " + COIN_NAME_DISPLAY + " address"); int64 nAmount = AmountFromValue(params[2]); int nMinDepth = 1; if (params.size() > 3) @@ -693,7 +695,7 @@ Value sendmany(const Array& params, bool fHelp) { CBitcoinAddress address(s.name_); if (!address.IsValid()) - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid CasinoCoin address: ")+s.name_); + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid " + COIN_NAME_DISPLAY + " address: ")+s.name_); if (setAddress.count(address)) throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+s.name_); @@ -789,7 +791,7 @@ Value addmultisigaddress(const Array& params, bool fHelp) { string msg = "addmultisigaddress <'[\"key\",\"key\"]'> [account]\n" "Add a nrequired-to-sign multisignature address to the wallet\"\n" - "each key is a CasinoCoin address or hex-encoded public key\n" + "each key is a " + COIN_NAME_DISPLAY + " address or hex-encoded public key\n" "If [account] is specified, assign address to [account]."; throw runtime_error(msg); } @@ -814,7 +816,7 @@ Value createmultisig(const Array& params, bool fHelp) string msg = "createmultisig <'[\"key\",\"key\"]'>\n" "Creates a multi-signature address and returns a json object\n" "with keys:\n" - "address : casinocoin address\n" + "address : " + COIN_NAME + " address\n" "redeemScript : hex-encoded redemption script"; throw runtime_error(msg); } @@ -1469,7 +1471,7 @@ Value encryptwallet(const Array& params, bool fHelp) // slack space in .dat files; that is bad if the old data is // unencrypted private keys. So: StartShutdown(); - return "wallet encrypted; CasinoCoin server stopping, restart to run with encrypted wallet. The keypool has been flushed, you need to make a new backup."; + return "wallet encrypted; " + COIN_NAME_DISPLAY + " server stopping, restart to run with encrypted wallet. The keypool has been flushed, you need to make a new backup."; } class DescribeAddressVisitor : public boost::static_visitor @@ -1511,8 +1513,8 @@ Value validateaddress(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( - "validateaddress \n" - "Return information about ."); + "validateaddress <"+ COIN_NAME + "address>\n" + "Return information about <"+ COIN_NAME + "address>."); CBitcoinAddress address(params[0].get_str()); bool isValid = address.IsValid(); diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp index 6c7e74e..bdbd0fa 100644 --- a/src/test/test_bitcoin.cpp +++ b/src/test/test_bitcoin.cpp @@ -23,7 +23,7 @@ struct TestingSetup { fPrintToDebugger = true; // don't want to write to debug.log file noui_connect(); bitdb.MakeMock(); - pathTemp = GetTempPath() / strprintf("test_casinocoin_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000))); + pathTemp = GetTempPath() / strprintf("test_"+ COIN_NAME + "_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000))); boost::filesystem::create_directories(pathTemp); mapArgs["-datadir"] = pathTemp.string(); pblocktree = new CBlockTreeDB(1 << 20, true); diff --git a/src/util.cpp b/src/util.cpp index 9fc4557..b1dc5e6 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -995,7 +995,7 @@ static std::string FormatException(std::exception* pex, const char* pszThread) char pszModule[MAX_PATH] = ""; GetModuleFileNameA(NULL, pszModule, sizeof(pszModule)); #else - const char* pszModule = "casinocoin"; + const char* pszModule = COIN_NAME; #endif if (pex) return strprintf( @@ -1037,7 +1037,7 @@ boost::filesystem::path GetDefaultDataDir() // Unix: ~/.bitcoin #ifdef WIN32 // Windows - return GetSpecialFolderPath(CSIDL_APPDATA) / "CasinoCoin"; + return GetSpecialFolderPath(CSIDL_APPDATA) / COIN_NAME_DISPLAY; #else fs::path pathRet; char* pszHome = getenv("HOME"); @@ -1049,10 +1049,10 @@ boost::filesystem::path GetDefaultDataDir() // Mac pathRet /= "Library/Application Support"; fs::create_directory(pathRet); - return pathRet / "CasinoCoin"; + return pathRet / COIN_NAME_DISPLAY; #else // Unix - return pathRet / ".casinocoin"; + return pathRet / "."+ COIN_NAME + ""; #endif #endif } @@ -1093,7 +1093,7 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific) boost::filesystem::path GetConfigFile() { - boost::filesystem::path pathConfigFile(GetArg("-conf", "casinocoin.conf")); + boost::filesystem::path pathConfigFile(GetArg("-conf", ""+ COIN_NAME + ".conf")); if (!pathConfigFile.is_complete()) pathConfigFile = GetDataDir(false) / pathConfigFile; return pathConfigFile; } @@ -1127,7 +1127,7 @@ void ReadConfigFile(map& mapSettingsRet, boost::filesystem::path GetPidFile() { - boost::filesystem::path pathPidFile(GetArg("-pid", "casinocoind.pid")); + boost::filesystem::path pathPidFile(GetArg("-pid", ""+ COIN_NAME + "d.pid")); if (!pathPidFile.is_complete()) pathPidFile = GetDataDir() / pathPidFile; return pathPidFile; } @@ -1356,7 +1356,7 @@ void AddTimeData(const CNetAddr& ip, int64 nTime) if (!fMatch) { fDone = true; - string strMessage = _("Warning: Please check that your computer's date and time are correct! If your clock is wrong CasinoCoin will not work properly."); + string strMessage = _("Warning: Please check that your computer's date and time are correct! If your clock is wrong ")+ COIN_NAME_DISPLAY + _(" will not work properly."); strMiscWarning = strMessage; printf("*** %s\n", strMessage.c_str()); uiInterface.ThreadSafeMessageBox(strMessage, "", CClientUIInterface::MSG_WARNING); diff --git a/src/util.h b/src/util.h index 2e15480..487df65 100644 --- a/src/util.h +++ b/src/util.h @@ -242,7 +242,7 @@ void runCommand(std::string strCommand); inline std::string i64tostr(int64 n) { - return strprintf("%"PRI64d, n); + return strprintf("%" PRI64d, n); } inline std::string itostr(int n) diff --git a/src/version.h b/src/version.h index da9a737..e820978 100644 --- a/src/version.h +++ b/src/version.h @@ -21,6 +21,10 @@ extern const std::string CLIENT_NAME; extern const std::string CLIENT_BUILD; extern const std::string CLIENT_DATE; +// Coin Name +static const std::string COIN_NAME("casinocoin"); +static const std::string COIN_NAME_DISPLAY("CasinoCoin"); + // // network protocol versioning // diff --git a/src/wallet.cpp b/src/wallet.cpp index f9ffd8e..6d2b6f7 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1487,7 +1487,7 @@ void CWallet::PrintWallet(const CBlock& block) if (mapWallet.count(block.vtx[0].GetHash())) { CWalletTx& wtx = mapWallet[block.vtx[0].GetHash()]; - printf(" mine: %d %d %"PRI64d"", wtx.GetDepthInMainChain(), wtx.GetBlocksToMaturity(), wtx.GetCredit()); + printf(" mine: %d %d %" PRI64d "", wtx.GetDepthInMainChain(), wtx.GetBlocksToMaturity(), wtx.GetCredit()); } } printf("\n"); @@ -1549,7 +1549,7 @@ bool CWallet::NewKeyPool() walletdb.WritePool(nIndex, CKeyPool(GenerateNewKey())); setKeyPool.insert(nIndex); } - printf("CWallet::NewKeyPool wrote %"PRI64d" new keys\n", nKeys); + printf("CWallet::NewKeyPool wrote %" PRI64d " new keys\n", nKeys); } return true; } @@ -1574,7 +1574,7 @@ bool CWallet::TopUpKeyPool() if (!walletdb.WritePool(nEnd, CKeyPool(GenerateNewKey()))) throw runtime_error("TopUpKeyPool() : writing generated key failed"); setKeyPool.insert(nEnd); - printf("keypool added key %"PRI64d", size=%"PRIszu"\n", nEnd, setKeyPool.size()); + printf("keypool added key %" PRI64d ", size=%" PRIszu "\n", nEnd, setKeyPool.size()); } } return true; @@ -1603,7 +1603,7 @@ void CWallet::ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool) if (!HaveKey(keypool.vchPubKey.GetID())) throw runtime_error("ReserveKeyFromKeyPool() : unknown key in key pool"); assert(keypool.vchPubKey.IsValid()); - printf("keypool reserve %"PRI64d"\n", nIndex); + printf("keypool reserve %" PRI64d "\n", nIndex); } } @@ -1630,7 +1630,7 @@ void CWallet::KeepKey(int64 nIndex) CWalletDB walletdb(strWalletFile); walletdb.ErasePool(nIndex); } - printf("keypool keep %"PRI64d"\n", nIndex); + printf("keypool keep %" PRI64d "\n", nIndex); } void CWallet::ReturnKey(int64 nIndex) @@ -1640,7 +1640,7 @@ void CWallet::ReturnKey(int64 nIndex) LOCK(cs_wallet); setKeyPool.insert(nIndex); } - printf("keypool return %"PRI64d"\n", nIndex); + printf("keypool return %" PRI64d "\n", nIndex); } bool CWallet::GetKeyFromPool(CPubKey& result, bool fAllowReuse) diff --git a/src/walletdb.cpp b/src/walletdb.cpp index cdc692f..ac7d4b1 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -520,7 +520,7 @@ void ThreadFlushWalletDB(const string& strFile) bitdb.CheckpointLSN(strFile); bitdb.mapFileUseCount.erase(mi++); - printf("Flushed wallet.dat %"PRI64d"ms\n", GetTimeMillis() - nStart); + printf("Flushed wallet.dat %" PRI64d "ms\n", GetTimeMillis() - nStart); } } } @@ -550,11 +550,7 @@ bool BackupWallet(const CWallet& wallet, const string& strDest) pathDest /= wallet.strWalletFile; try { -#if BOOST_VERSION >= 104000 filesystem::copy_file(pathSrc, pathDest, filesystem::copy_option::overwrite_if_exists); -#else - filesystem::copy_file(pathSrc, pathDest); -#endif printf("copied wallet.dat to %s\n", pathDest.string().c_str()); return true; } catch(const filesystem::filesystem_error &e) { @@ -581,7 +577,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys) // Set -rescan so any missing transactions will be // found. int64 now = GetTime(); - std::string newFilename = strprintf("wallet.%"PRI64d".bak", now); + std::string newFilename = strprintf("wallet.%" PRI64d ".bak", now); int result = dbenv.dbenv.dbrename(NULL, filename.c_str(), NULL, newFilename.c_str(), DB_AUTO_COMMIT); @@ -600,7 +596,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys) printf("Salvage(aggressive) found no records in %s.\n", newFilename.c_str()); return false; } - printf("Salvage(aggressive) found %"PRIszu" records\n", salvagedData.size()); + printf("Salvage(aggressive) found %" PRIszu " records\n", salvagedData.size()); bool fSuccess = allOK; Db* pdbCopy = new Db(&dbenv.dbenv, 0);