From bc50070c53be07ed388b5c2c7285f5700895aecc Mon Sep 17 00:00:00 2001 From: Jay Carlson Date: Sat, 30 Apr 2016 18:16:06 -0400 Subject: [PATCH 1/4] Various hacks to make this build on clang on OS X 10.11 and Boost 1.60. Don't just blindly pull it. I have not tested this. --- src/bitcoinrpc.cpp | 4 +- src/net.cpp | 2 +- src/qt/bitcoingui.h | 2 + src/qt/rpcconsole.cpp | 2 + src/rpcblockchain.cpp | 20 +++++----- src/rpcdump.cpp | 4 +- src/rpcmining.cpp | 22 +++++----- src/rpcnet.cpp | 10 ++--- src/rpcrawtransaction.cpp | 12 +++--- src/rpcwallet.cpp | 84 +++++++++++++++++++-------------------- src/scrypt-x86_64.S | 14 +++---- src/serialize.h | 2 + 12 files changed, 92 insertions(+), 86 deletions(-) diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 99fb1dd..e73008b 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -194,7 +194,7 @@ string CRPCTable::help(string strCommand) const Value help(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) - return NULL; + return Value(); /*dvd throw runtime_error( "help [command]\n" "List commands, or get help for a command."); @@ -210,7 +210,7 @@ Value help(const Array& params, bool fHelp) Value stop(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) - return NULL; + return Value(); /*dvd throw runtime_error( "stop \n" " is true or false to detach the database or not for this stop only\n" diff --git a/src/net.cpp b/src/net.cpp index d16d2c3..eabbfbc 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -60,7 +60,7 @@ static bool vfLimited[NET_MAX] = {}; static CNode* pnodeLocalHost = NULL; CAddress addrSeenByPeer(CService("0.0.0.0", 0), nLocalServices); uint64 nLocalHostNonce = 0; -array vnThreadsRunning; +boost::array vnThreadsRunning; static std::vector vhListenSocket; CAddrMan addrman; diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 835cc2d..a2e331b 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -4,8 +4,10 @@ #include #include +#ifndef Q_MOC_RUN #include "util.h" // for uint64 //#include "banner.h" +#endif class StyleSheetEditor; diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index af13973..b8f2de0 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -1,9 +1,11 @@ +#ifndef Q_MOC_RUN #include "rpcconsole.h" #include "ui_rpcconsole.h" #include "clientmodel.h" #include "bitcoinrpc.h" #include "guiutil.h" +#endif #include #include diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 3aae7b9..2778b0c 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -122,7 +122,7 @@ Object blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool fPri Value getblockcount(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) - return NULL; + return Value(); /* dvd throw runtime_error( "getblockcount\n" "Returns the number of blocks in the longest block chain."); @@ -134,7 +134,7 @@ Value getblockcount(const Array& params, bool fHelp) Value getdifficulty(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) - return NULL; + return Value(); /*dvd throw runtime_error( "getdifficulty\n" @@ -151,7 +151,7 @@ Value getdifficulty(const Array& params, bool fHelp) Value settxfee(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 1 || AmountFromZeroValue(params[0]) < MIN_TX_FEE) - return NULL; + return Value(); /*dvd throw runtime_error( "settxfee \n" " is a real and is rounded to the nearest 0.01"); @@ -165,7 +165,7 @@ Value settxfee(const Array& params, bool fHelp) Value getrawmempool(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) - return NULL; + return Value(); /*dvd throw runtime_error( "getrawmempool\n" "Returns all transaction ids in memory pool."); @@ -183,14 +183,14 @@ Value getrawmempool(const Array& params, bool fHelp) Value getblockhash(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) - return NULL; + return Value(); /*dvd throw runtime_error( "getblockhash \n" "Returns hash of block in best-block-chain at ."); */ int nHeight = params[0].get_int(); if (nHeight < 0 || nHeight > nBestHeight) - return NULL; + return Value(); //dvd throw runtime_error("Block number out of range."); CBlockIndex* pblockindex = FindBlockByHeight(nHeight); @@ -200,7 +200,7 @@ Value getblockhash(const Array& params, bool fHelp) Value getblock(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) - return NULL; + return Value(); /*dvd throw runtime_error( "getblock [txinfo]\n" "txinfo optional to print more detailed tx info\n" @@ -222,7 +222,7 @@ Value getblock(const Array& params, bool fHelp) Value getblockbynumber(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) - return NULL; + return Value(); /*dvd throw runtime_error( "getblock [txinfo]\n" "txinfo optional to print more detailed tx info\n" @@ -230,7 +230,7 @@ Value getblockbynumber(const Array& params, bool fHelp) */ int nHeight = params[0].get_int(); if (nHeight < 0 || nHeight > nBestHeight) - return NULL; + return Value(); //dvd throw runtime_error("Block number out of range."); CBlock block; @@ -250,7 +250,7 @@ Value getblockbynumber(const Array& params, bool fHelp) Value getcheckpoint(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) - return NULL; + return Value(); /*dvd throw runtime_error( "getcheckpoint\n" "Show info of synchronized checkpoint.\n"); diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp index eda3c06..96a2758 100644 --- a/src/rpcdump.cpp +++ b/src/rpcdump.cpp @@ -37,7 +37,7 @@ class CTxDump Value importprivkey(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) - return NULL; + return Value(); /*dvd throw runtime_error( "importprivkey <2GiveCoinprivkey> [label]\n" "Adds a private key (as returned by dumpprivkey) to your wallet."); @@ -77,7 +77,7 @@ Value importprivkey(const Array& params, bool fHelp) Value dumpprivkey(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) - return NULL; + return Value(); /* throw runtime_error( "dumpprivkey <2GiveCoinaddress>\n" "Reveals the private key corresponding to <2GiveCoinaddress>."); diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index a1dd4a3..47c747d 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -16,7 +16,7 @@ using namespace std; Value getgenerate(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) - return NULL; + return Value(); /*dvd throw std::runtime_error( "getgenerate\n" "Returns true or false."); @@ -29,7 +29,7 @@ Value getgenerate(const Array& params, bool fHelp) Value setgenerate(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) - return NULL; + return Value(); /*dvd throw runtime_error( "setgenerate [genproclimit]\n" " is true or false to turn generation on or off.\n" @@ -56,7 +56,7 @@ Value setgenerate(const Array& params, bool fHelp) Value getmint(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) - return NULL; + return Value(); /*dvd throw std::runtime_error( "getmint\n" "Returns true or false."); @@ -67,7 +67,7 @@ Value getmint(const Array& params, bool fHelp) Value setmint(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 1) - return NULL; + return Value(); /*dvd throw runtime_error( "setmint \n" " is true or false to turn proof of stake minting on or off." @@ -88,7 +88,7 @@ Value setmint(const Array& params, bool fHelp) Value gethashespersec(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) - return NULL; + return Value(); /*dvd throw runtime_error( "gethashespersec\n" "Returns a recent hashes per second performance measurement while generating."); @@ -102,7 +102,7 @@ Value gethashespersec(const Array& params, bool fHelp) Value getmininginfo(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) - return NULL; + return Value(); /*dvd throw runtime_error( "getmininginfo\n" "Returns an object containing mining-related information."); @@ -148,7 +148,7 @@ Value GetNetworkHashPS(int lookup) { Value getnetworkhashps(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) - return NULL; + return Value(); /*dvd throw runtime_error( "getnetworkhashps [blocks]\n" "Returns the estimated network hashes per second based on the last 120 blocks.\n" @@ -161,7 +161,7 @@ Value getnetworkhashps(const Array& params, bool fHelp) Value getworkex(const Array& params, bool fHelp) { if (fHelp || params.size() > 2) - return NULL; + return Value(); /* throw runtime_error( "getworkex [data, coinbase]\n" "If [data, coinbase] is not specified, returns extended work data.\n" @@ -292,7 +292,7 @@ Value getworkex(const Array& params, bool fHelp) Value getwork(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) - return NULL; + return Value(); /*dvd throw runtime_error( "getwork [data]\n" "If [data] is not specified, returns formatted hash data to work on:\n" @@ -410,7 +410,7 @@ Value getwork(const Array& params, bool fHelp) Value getblocktemplate(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) - return NULL; + return Value(); /*dvd throw runtime_error( "getblocktemplate [params]\n" "Returns data needed to construct a block to work on:\n" @@ -568,7 +568,7 @@ Value getblocktemplate(const Array& params, bool fHelp) Value submitblock(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) - return NULL; + return Value(); /*dvd throw runtime_error( "submitblock [optional-params-obj]\n" "[optional-params-obj] parameter is currently ignored.\n" diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp index 26bae8c..002b309 100644 --- a/src/rpcnet.cpp +++ b/src/rpcnet.cpp @@ -17,7 +17,7 @@ using namespace std; Value getconnectioncount(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) - return NULL; + return Value(); /*dvd throw runtime_error( "getconnectioncount\n" "Returns the number of connections to other nodes."); @@ -42,7 +42,7 @@ static void CopyNodeStats(std::vector& vstats) Value getpeerinfo(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) - return NULL; + return Value(); /*dvd throw runtime_error( "getpeerinfo\n" "Returns data about each connected network node."); @@ -80,7 +80,7 @@ Value addnode(const Array& params, bool fHelp) strCommand = params[1].get_str(); if (fHelp || params.size() != 2 || (strCommand != "onetry" && strCommand != "add" && strCommand != "remove")) - return NULL; + return Value(); /*dvd throw runtime_error( "addnode \n" "Attempts add or remove from the addnode list or try a connection to once."); @@ -119,7 +119,7 @@ Value addnode(const Array& params, bool fHelp) Value getaddednodeinfo(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) - return NULL; + return Value(); /*dvd throw runtime_error( "getaddednodeinfo [node]\n" "Returns information about the given added node, or all added nodes\n" @@ -223,7 +223,7 @@ extern map mapAlerts; Value sendalert(const Array& params, bool fHelp) { if (fHelp || params.size() < 6) - return NULL; + return Value(); /*dvd throw runtime_error( "sendalert [cancelupto]\n" " is the alert text message\n" diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index ca2e140..2bc3835 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -105,7 +105,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry) Value getrawtransaction(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) - return NULL; + return Value(); /* throw runtime_error( "getrawtransaction [verbose=0]\n" "If verbose=0, returns a string that is\n" @@ -141,7 +141,7 @@ Value getrawtransaction(const Array& params, bool fHelp) Value listunspent(const Array& params, bool fHelp) { if (fHelp || params.size() > 3) - return NULL; + return Value(); /*dvd throw runtime_error( "listunspent [minconf=1] [maxconf=9999999] [\"address\",...]\n" "Returns array of unspent transaction outputs\n" @@ -210,7 +210,7 @@ Value listunspent(const Array& params, bool fHelp) Value createrawtransaction(const Array& params, bool fHelp) { if (fHelp || params.size() != 2) - return NULL; + return Value(); /* throw runtime_error( "createrawtransaction [{\"txid\":txid,\"vout\":n},...] {address:amount,...}\n" "Create a transaction spending given inputs\n" @@ -276,7 +276,7 @@ Value createrawtransaction(const Array& params, bool fHelp) Value decoderawtransaction(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) - return NULL; + return Value(); /*dvd throw runtime_error( "decoderawtransaction \n" "Return a JSON object representing the serialized, hex-encoded transaction."); @@ -302,7 +302,7 @@ Value decoderawtransaction(const Array& params, bool fHelp) Value signrawtransaction(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 4) - return NULL; + return Value(); /* throw runtime_error( "signrawtransaction [{\"txid\":txid,\"vout\":n,\"scriptPubKey\":hex},...] [,...] [sighashtype=\"ALL\"]\n" "Sign inputs for raw transaction (serialized, hex-encoded).\n" @@ -493,7 +493,7 @@ Value signrawtransaction(const Array& params, bool fHelp) Value sendrawtransaction(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 1) - return NULL; + return Value(); /* throw runtime_error( "sendrawtransaction \n" "Submits raw transaction (serialized, hex-encoded) to local node and network."); diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index e05a02e..479177c 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -64,7 +64,7 @@ string AccountFromValue(const Value& value) Value getinfo(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) - return NULL; + return Value(); /*dvd throw runtime_error( "getinfo\n" "Returns an object containing various state info."); @@ -99,7 +99,7 @@ Value getinfo(const Array& params, bool fHelp) Value getnewpubkey(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) - return NULL; + return Value(); /* throw runtime_error( "getnewpubkey [account]\n" "Returns new public key for coinbase generation."); @@ -128,7 +128,7 @@ Value getnewpubkey(const Array& params, bool fHelp) Value getnewaddress(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) - return NULL; + return Value(); /*dvd throw runtime_error( "getnewaddress [account]\n" "Returns a new 2GiveCoin address for receiving payments. " @@ -198,7 +198,7 @@ CBitcoinAddress GetAccountAddress(string strAccount, bool bForceNew=false) Value getaccountaddress(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) - return NULL; + return Value(); /*dvd throw runtime_error( "getaccountaddress \n" "Returns the current 2GiveCoin address for receiving payments to this account."); @@ -218,7 +218,7 @@ Value getaccountaddress(const Array& params, bool fHelp) Value setaccount(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) - return NULL; + return Value(); /*dvd throw runtime_error( "setaccount <2GiveCoinaddress> \n" "Sets the account associated with the given address."); @@ -249,7 +249,7 @@ Value setaccount(const Array& params, bool fHelp) Value getaccount(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) - return NULL; + return Value(); /*dvd throw runtime_error( "getaccount <2GiveCoinaddress>\n" "Returns the account associated with the given address."); @@ -269,7 +269,7 @@ Value getaccount(const Array& params, bool fHelp) Value getaddressesbyaccount(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) - return NULL; + return Value(); /*dvd throw runtime_error( "getaddressesbyaccount \n" "Returns the list of addresses for the given account."); @@ -291,7 +291,7 @@ Value getaddressesbyaccount(const Array& params, bool fHelp) Value setdefaultaddress(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) - return NULL; + return Value(); /*dvd throw runtime_error( "setdefaultaddress <2GiveCoinaddress>\n" "sets the default receiving address in the wallet" @@ -332,7 +332,7 @@ Value setdefaultaddress(const Array& params, bool fHelp) Value sendtoaddress(const Array& params, bool fHelp) { if (fHelp || params.size() < 2 || params.size() > 4) - return NULL; + return Value(); /*dvd throw runtime_error( "sendtoaddress <2GiveCoinaddress> [comment] [comment-to]\n" " is a real and is rounded to the nearest 0.000001" @@ -368,7 +368,7 @@ Value sendtoaddress(const Array& params, bool fHelp) Value listaddressgroupings(const Array& params, bool fHelp) { if (fHelp) - return NULL; + return Value(); /*dvd throw runtime_error( "listaddressgroupings\n" "Lists groups of addresses which have had their common ownership\n" @@ -400,7 +400,7 @@ Value listaddressgroupings(const Array& params, bool fHelp) Value signmessage(const Array& params, bool fHelp) { if (fHelp || params.size() != 2) - return NULL; + return Value(); /*dvd throw runtime_error( "signmessage <2GiveCoinaddress> \n" "Sign a message with the private key of an address"); @@ -436,7 +436,7 @@ Value signmessage(const Array& params, bool fHelp) Value verifymessage(const Array& params, bool fHelp) { if (fHelp || params.size() != 3) - return NULL; + return Value(); /*dvd throw runtime_error( "verifymessage <2GiveCoinaddress> \n" "Verify a signed message"); @@ -474,7 +474,7 @@ Value verifymessage(const Array& params, bool fHelp) Value getreceivedbyaddress(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) - return NULL; + return Value(); /* throw runtime_error( "getreceivedbyaddress <2GiveCoinaddress> [minconf=1]\n" "Returns the total amount received by <2GiveCoinaddress> in transactions with at least [minconf] confirmations."); @@ -525,7 +525,7 @@ void GetAccountAddresses(string strAccount, set& setAddress) Value getreceivedbyaccount(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) - return NULL; + return Value(); /*dvd throw runtime_error( "getreceivedbyaccount [minconf=1]\n" "Returns the total amount received by addresses with in transactions with at least [minconf] confirmations."); @@ -601,7 +601,7 @@ int64 GetAccountBalance(const string& strAccount, int nMinDepth) Value getbalance(const Array& params, bool fHelp) { if (fHelp || params.size() > 2) - return NULL; + return Value(); /*dvd throw runtime_error( "getbalance [account] [minconf=1]\n" "If [account] is not specified, returns the server's total available balance.\n" @@ -661,7 +661,7 @@ Value getbalance(const Array& params, bool fHelp) Value movecmd(const Array& params, bool fHelp) { if (fHelp || params.size() < 3 || params.size() > 5) - return NULL; + return Value(); /*dvd throw runtime_error( "move [minconf=1] [comment]\n" "Move from one account in your wallet to another."); @@ -716,7 +716,7 @@ Value movecmd(const Array& params, bool fHelp) Value sendfrom(const Array& params, bool fHelp) { if (fHelp || params.size() < 3 || params.size() > 6) - return NULL; + return Value(); /*dvd throw runtime_error( "sendfrom [minconf=1] [comment] [comment-to]\n" " is a real and is rounded to the nearest 0.000001" @@ -761,7 +761,7 @@ Value sendfrom(const Array& params, bool fHelp) Value sendmany(const Array& params, bool fHelp) { if (fHelp || params.size() < 2 || params.size() > 4) - return NULL; + return Value(); /*dvd throw runtime_error( "sendmany {address:amount,...} [minconf=1] [comment]\n" "amounts are double-precision floating point numbers" @@ -833,7 +833,7 @@ Value addmultisigaddress(const Array& params, bool fHelp) { if (fHelp || params.size() < 2 || params.size() > 3) { - return NULL; // dvd + return Value(); // dvd string msg = "addmultisigaddress <'[\"key\",\"key\"]'> [account]\n" "Add a nrequired-to-sign multisignature address to the wallet\"\n" "each key is a 2GiveCoin address or hex-encoded public key\n" @@ -1004,7 +1004,7 @@ Value ListReceived(const Array& params, bool fByAccounts) Value listreceivedbyaddress(const Array& params, bool fHelp) { if (fHelp || params.size() > 2) - return NULL; + return Value(); /*dvd throw runtime_error( "listreceivedbyaddress [minconf=1] [includeempty=false]\n" "[minconf] is the minimum number of confirmations before payments are included.\n" @@ -1021,7 +1021,7 @@ Value listreceivedbyaddress(const Array& params, bool fHelp) Value listreceivedbyaccount(const Array& params, bool fHelp) { if (fHelp || params.size() > 2) - return NULL; + return Value(); /*dvd throw runtime_error( "listreceivedbyaccount [minconf=1] [includeempty=false]\n" "[minconf] is the minimum number of confirmations before payments are included.\n" @@ -1135,7 +1135,7 @@ void AcentryToJSON(const CAccountingEntry& acentry, const string& strAccount, Ar Value listtransactions(const Array& params, bool fHelp) { if (fHelp || params.size() > 3) - return NULL; + return Value(); /*dvd throw runtime_error( "listtransactions [account] [count=10] [from=0]\n" "Returns up to [count] most recent transactions skipping the first [from] transactions for account [account]."); @@ -1194,7 +1194,7 @@ Value listtransactions(const Array& params, bool fHelp) Value listaccounts(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) - return NULL; + return Value(); /*dvd throw runtime_error( "listaccounts [minconf=1]\n" "Returns Object that has account names as keys, account balances as values."); @@ -1257,7 +1257,7 @@ Value listaccounts(const Array& params, bool fHelp) Value listsinceblock(const Array& params, bool fHelp) { if (fHelp) - return NULL; + return Value(); /* throw runtime_error( "listsinceblock [blockhash] [target-confirmations]\n" "Get all transactions in blocks since block [blockhash], or all transactions if omitted"); @@ -1321,7 +1321,7 @@ Value listsinceblock(const Array& params, bool fHelp) Value gettransaction(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) - return NULL; + return Value(); /*dvd throw runtime_error( "gettransaction \n" "Get detailed information about "); @@ -1391,7 +1391,7 @@ Value gettransaction(const Array& params, bool fHelp) Value backupwallet(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) - return NULL; + return Value(); /* throw runtime_error( "backupwallet \n" "Safely copies wallet.dat to destination, which can be a directory or a path with filename."); @@ -1407,7 +1407,7 @@ Value backupwallet(const Array& params, bool fHelp) Value keypoolrefill(const Array& params, bool fHelp) { if (fHelp || params.size() > 0) - return NULL; + return Value(); /* throw runtime_error( "keypoolrefill\n" "Fills the keypool." @@ -1479,7 +1479,7 @@ void Thread2GiveCoinWalletPassphrase(void* parg) Value walletpassphrase(const Array& params, bool fHelp) { if (pwalletMain->IsCrypted() && (fHelp || params.size() < 2 || params.size() > 3)) - return NULL; + return Value(); /*dvd throw runtime_error( "walletpassphrase [mintonly]\n" "Stores the wallet decryption key in memory for seconds.\n" @@ -1505,7 +1505,7 @@ Value walletpassphrase(const Array& params, bool fHelp) throw JSONRPCError(RPC_WALLET_PASSPHRASE_INCORRECT, "Error: The wallet passphrase entered was incorrect."); } else - return NULL; + return Value(); /*dvd throw runtime_error( "walletpassphrase \n" "Stores the wallet decryption key in memory for seconds."); @@ -1527,7 +1527,7 @@ Value walletpassphrase(const Array& params, bool fHelp) Value walletpassphrasechange(const Array& params, bool fHelp) { if (pwalletMain->IsCrypted() && (fHelp || params.size() != 2)) - return NULL; + return Value(); /*dvd throw runtime_error( "walletpassphrasechange \n" "Changes the wallet passphrase from to ."); @@ -1548,7 +1548,7 @@ Value walletpassphrasechange(const Array& params, bool fHelp) strNewWalletPass = params[1].get_str().c_str(); if (strOldWalletPass.length() < 1 || strNewWalletPass.length() < 1) - return NULL; + return Value(); /*dvd throw runtime_error( "walletpassphrasechange \n" "Changes the wallet passphrase from to ."); @@ -1563,7 +1563,7 @@ Value walletpassphrasechange(const Array& params, bool fHelp) Value walletlock(const Array& params, bool fHelp) { if (pwalletMain->IsCrypted() && (fHelp || params.size() != 0)) - return NULL; + return Value(); /*dvd throw runtime_error( "walletlock\n" "Removes the wallet encryption key from memory, locking the wallet.\n" @@ -1588,7 +1588,7 @@ Value walletlock(const Array& params, bool fHelp) Value encryptwallet(const Array& params, bool fHelp) { if (!pwalletMain->IsCrypted() && (fHelp || params.size() != 1)) - return NULL; + return Value(); /*dvd throw runtime_error( "encryptwallet \n" "Encrypts the wallet with ."); @@ -1605,7 +1605,7 @@ Value encryptwallet(const Array& params, bool fHelp) strWalletPass = params[0].get_str().c_str(); if (strWalletPass.length() < 1) - return NULL; + return Value(); /*dvd throw runtime_error( "encryptwallet \n" "Encrypts the wallet with ."); @@ -1658,7 +1658,7 @@ class DescribeAddressVisitor : public boost::static_visitor Value validateaddress(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) - return NULL; + return Value(); /*dvd throw runtime_error( "validateaddress <2GiveCoinaddress>\n" "Return information about <2GiveCoinaddress>."); @@ -1688,7 +1688,7 @@ Value validateaddress(const Array& params, bool fHelp) Value validatepubkey(const Array& params, bool fHelp) { if (fHelp || !params.size() || params.size() > 2) - return NULL; + return Value(); /*dvd throw runtime_error( "validatepubkey <2GiveCoinpubkey>\n" "Return information about <2GiveCoinpubkey>."); @@ -1727,7 +1727,7 @@ Value validatepubkey(const Array& params, bool fHelp) Value reservebalance(const Array& params, bool fHelp) { if (fHelp || params.size() > 2) - return NULL; + return Value(); /*dvd throw runtime_error( "reservebalance [ [amount]]\n" " is true or false to turn balance reserve on or off.\n" @@ -1741,7 +1741,7 @@ Value reservebalance(const Array& params, bool fHelp) if (fReserve) { if (params.size() == 1) - return NULL; + return Value(); //dvd throw runtime_error("must provide amount to reserve balance.\n"); int64 nAmount = AmountFromValue(params[1]); nAmount = (nAmount / CENT) * CENT; // round to cent @@ -1771,7 +1771,7 @@ Value reservebalance(const Array& params, bool fHelp) Value checkwallet(const Array& params, bool fHelp) { if (fHelp || params.size() > 0) - return NULL; + return Value(); /*dvd throw runtime_error( "checkwallet\n" "Check wallet for integrity.\n"); @@ -1795,7 +1795,7 @@ Value checkwallet(const Array& params, bool fHelp) Value repairwallet(const Array& params, bool fHelp) { if (fHelp || params.size() > 0) - return NULL; + return Value(); /*dvd throw runtime_error( "repairwallet\n" "Repair wallet if checkwallet reports any problem.\n"); @@ -1818,7 +1818,7 @@ Value repairwallet(const Array& params, bool fHelp) Value resendtx(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) - return NULL; + return Value(); /*dvd throw runtime_error( "resendtx\n" "Re-send unconfirmed transactions.\n" @@ -1833,7 +1833,7 @@ Value resendtx(const Array& params, bool fHelp) Value makekeypair(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) - return NULL; + return Value(); /* throw runtime_error( "makekeypair [prefix]\n" "Make a public/private key pair.\n" diff --git a/src/scrypt-x86_64.S b/src/scrypt-x86_64.S index f0a3fdd..dcc8f85 100644 --- a/src/scrypt-x86_64.S +++ b/src/scrypt-x86_64.S @@ -175,7 +175,7 @@ .text - .align 32 + .align 16 gen_salsa8_core: # 0: %rdx, %rdi, %rcx, %rsi movq 8(%rsp), %rdi @@ -274,7 +274,7 @@ gen_salsa8_core: .text - .align 32 + .align 16 .globl scrypt_core .globl _scrypt_core scrypt_core: @@ -525,7 +525,7 @@ gen_scrypt_core_loop2: xmm_salsa8_core_doubleround(); \ - .align 32 + .align 16 xmm_scrypt_core: # shuffle 1st block into %xmm8-%xmm11 movl 60(%rdi), %edx @@ -837,7 +837,7 @@ xmm_scrypt_core_loop2: .text - .align 32 + .align 16 .globl scrypt_best_throughput .globl _scrypt_best_throughput scrypt_best_throughput: @@ -999,7 +999,7 @@ scrypt_best_throughput_exit: .text - .align 32 + .align 16 .globl scrypt_core_2way .globl _scrypt_core_2way scrypt_core_2way: @@ -1461,7 +1461,7 @@ scrypt_core_2way_loop2: .text - .align 32 + .align 16 .globl scrypt_core_3way .globl _scrypt_core_3way scrypt_core_3way: @@ -1828,4 +1828,4 @@ scrypt_core_3way_loop2: popq %rbx ret -#endif \ No newline at end of file +#endif diff --git a/src/serialize.h b/src/serialize.h index 3b3dcd4..f09dff1 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -824,6 +824,7 @@ class CDataStream vch.insert(it, first, last); } +#if 0 void insert(iterator it, std::vector::const_iterator first, std::vector::const_iterator last) { assert(last - first >= 0); @@ -836,6 +837,7 @@ class CDataStream else vch.insert(it, first, last); } +#endif #if !defined(_MSC_VER) || _MSC_VER >= 1300 void insert(iterator it, const char* first, const char* last) From ac6348a2523606b7c9db045313c72ba5fbb404f3 Mon Sep 17 00:00:00 2001 From: Jay Carlson Date: Sun, 1 May 2016 13:32:17 -0400 Subject: [PATCH 2/4] On Qt5 on OS X, only use QSystemTray for notifications. In Qt5, qt_mac_execute_apple_script got desupported. Luckily, QSystemTrayIcon appears to handle Notifications Center, and handles Growl prior to that. "The Growl notification system must be installed for QSystemTrayIcon::showMessage() to display messages on Mac OS X prior to 10.8 (Mountain Lion)." http://doc.qt.io/qt-5/qsystemtrayicon.html --- src/qt/notificator.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qt/notificator.cpp b/src/qt/notificator.cpp index 8028190..2329c0b 100644 --- a/src/qt/notificator.cpp +++ b/src/qt/notificator.cpp @@ -16,7 +16,7 @@ #include #endif -#ifdef Q_OS_MAC +#if QT_VERSION < 0x050000 && defined(Q_OS_MAC) #include extern bool qt_mac_execute_apple_script(const QString &script, AEDesc *ret); #endif @@ -46,7 +46,7 @@ Notificator::Notificator(const QString &programName, QSystemTrayIcon *trayicon, mode = Freedesktop; } #endif -#ifdef Q_OS_MAC +#if QT_VERSION < 0x050000 && defined(Q_OS_MAC) // Check if Growl is installed (based on Qt's tray icon implementation) CFURLRef cfurl; OSStatus status = LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator, CFSTR("growlTicket"), kLSRolesAll, 0, &cfurl); @@ -225,7 +225,7 @@ void Notificator::notifySystray(Class cls, const QString &title, const QString & } // Based on Qt's tray icon implementation -#ifdef Q_OS_MAC +#if QT_VERSION < 0x050000 && defined(Q_OS_MAC) void Notificator::notifyGrowl(Class cls, const QString &title, const QString &text, const QIcon &icon) { const QString script( @@ -285,7 +285,7 @@ void Notificator::notify(Class cls, const QString &title, const QString &text, c case QSystemTray: notifySystray(cls, title, text, icon, millisTimeout); break; -#ifdef Q_OS_MAC +#if 0 && defined(Q_OS_MAC) case Growl12: case Growl13: notifyGrowl(cls, title, text, icon); From f35b05a95bdd97dc2de85f77440c2ffb8e99de93 Mon Sep 17 00:00:00 2001 From: Jay Carlson Date: Sun, 1 May 2016 13:59:22 -0400 Subject: [PATCH 3/4] OS X: pick OS deplyment version vs which stdc++ lib At some point, Apple changed over from libstdc++ to libc++. Modern homebrew builds expect libc++. Change the minimum deployment target to 10.9 temporarily; 10.7 support may be possible. 10.6 support would seem to require custom Homebrew builds of (at least) Boost and libdb_cxx with CXXFLAGS += -stdlib=libstdc++, or the equivalent deployment target. --- 2GiveCoin.pro | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/2GiveCoin.pro b/2GiveCoin.pro index 3838e61..6bfd17b 100644 --- a/2GiveCoin.pro +++ b/2GiveCoin.pro @@ -20,6 +20,8 @@ BDB_INCLUDE_PATH=/usr/local/opt/berkeley-db4/include BDB_LIB_PATH=/usr/local/opt/berkeley-db4/lib OPENSSL_INCLUDE_PATH=/usr/local/opt/openssl/include OPENSSL_LIB_PATH=/usr/local/opt/openssl/lib +QRENCODE_INCLUDE_PATH=/usr/local/opt/qrencode/include +QRENCODE_LIB_PATH=/usr/local/opt/qrencode/lib CONFIG += static @@ -40,6 +42,8 @@ UI_DIR = build # use: qmake "RELEASE=1" contains(RELEASE, 1) { # Mac: compile for maximum compatibility (10.5, 32-bit) + # This may be broken for Qt5. 10.7 is the last version with CI. For 10.6, "support is limited." + # See http://doc.qt.io/qt-5/osx.html macx:QMAKE_CXXFLAGS += -mmacosx-version-min=10.5 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk !windows:!macx { @@ -396,9 +400,28 @@ macx:DEFINES += MAC_OSX MSG_NOSIGNAL=0 macx:ICON = src/qt/res/icons/givecoin.icns macx:TARGET = "2GiveCoin-Qt" macx:QMAKE_CFLAGS_THREAD += -pthread + +# Since Mavericks, -stdlib=libc++ is the default, and bottled homebrew +# libraries will expect it. I am not clear what effect this will have +# on actual deployment. + +# Original, won't work with modern homebrew: +# macx:QMAKE_LFLAGS_THREAD += -pthread +# macx:QMAKE_CXXFLAGS_THREAD += -pthread + +# Working: +# +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9 macx:QMAKE_LFLAGS_THREAD += -pthread macx:QMAKE_CXXFLAGS_THREAD += -pthread +# Works on 10.11. Not clear whether it would actually work on +# 10.7. Shouldn't work on 10.6. +# +# QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7 +# macx:QMAKE_LFLAGS_THREAD += -pthread -stdlib=libc++ +# macx:QMAKE_CXXFLAGS_THREAD += -pthread -stdlib=libc++ + # Set libraries and includes at end, to use platform-defined defaults if not overridden INCLUDEPATH += $$BOOST_INCLUDE_PATH $$BDB_INCLUDE_PATH $$OPENSSL_INCLUDE_PATH $$QRENCODE_INCLUDE_PATH LIBS += $$join(BOOST_LIB_PATH,,-L,) $$join(BDB_LIB_PATH,,-L,) $$join(OPENSSL_LIB_PATH,,-L,) $$join(QRENCODE_LIB_PATH,,-L,) From bedcb8225319faa4c1b1d32fc746ba5a519e57f9 Mon Sep 17 00:00:00 2001 From: Jay Carlson Date: Sun, 1 May 2016 15:08:36 -0400 Subject: [PATCH 4/4] Ignore a C++11-related warning; clean up macx:CXXFLAGS --- 2GiveCoin.pro | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/2GiveCoin.pro b/2GiveCoin.pro index 6bfd17b..38c887d 100644 --- a/2GiveCoin.pro +++ b/2GiveCoin.pro @@ -133,6 +133,8 @@ contains(BITCOIN_NEED_QT_PLUGINS, 1) { QMAKE_CXXFLAGS += -msse2 QMAKE_CFLAGS += -msse2 QMAKE_CXXFLAGS_WARN_ON = -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector +# This may be necessary for other platforms besides the Mac: +macx:QMAKE_CXXFLAGS_WARN_ON += -Wno-reserved-user-defined-literal # Input DEPENDPATH += src src/json src/qt @@ -401,26 +403,23 @@ macx:ICON = src/qt/res/icons/givecoin.icns macx:TARGET = "2GiveCoin-Qt" macx:QMAKE_CFLAGS_THREAD += -pthread +macx:QMAKE_LFLAGS_THREAD += -pthread +macx:QMAKE_CXXFLAGS_THREAD += -pthread + # Since Mavericks, -stdlib=libc++ is the default, and bottled homebrew # libraries will expect it. I am not clear what effect this will have # on actual deployment. -# Original, won't work with modern homebrew: -# macx:QMAKE_LFLAGS_THREAD += -pthread -# macx:QMAKE_CXXFLAGS_THREAD += -pthread - # Working: # -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9 -macx:QMAKE_LFLAGS_THREAD += -pthread -macx:QMAKE_CXXFLAGS_THREAD += -pthread +#QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9 # Works on 10.11. Not clear whether it would actually work on # 10.7. Shouldn't work on 10.6. # -# QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7 -# macx:QMAKE_LFLAGS_THREAD += -pthread -stdlib=libc++ -# macx:QMAKE_CXXFLAGS_THREAD += -pthread -stdlib=libc++ +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7 +macx:QMAKE_LFLAGS += -stdlib=libc++ +macx:QMAKE_CXXFLAGS += -stdlib=libc++ # Set libraries and includes at end, to use platform-defined defaults if not overridden INCLUDEPATH += $$BOOST_INCLUDE_PATH $$BDB_INCLUDE_PATH $$OPENSSL_INCLUDE_PATH $$QRENCODE_INCLUDE_PATH