diff --git a/src/cc/musig.cpp b/src/cc/musig.cpp index 800102e13..04f3fe35d 100755 --- a/src/cc/musig.cpp +++ b/src/cc/musig.cpp @@ -86,7 +86,7 @@ int32_t musig_prevoutmsg(uint8_t *msg,uint256 sendtxid,CScript scriptPubKey) UniValue musig_calcmsg(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) { UniValue result(UniValue::VOBJ); uint256 sendtxid; int32_t i; uint8_t msg[32]; char *scriptstr,str[65]; int32_t n; - if ( (params= cclib_reparse(&n,params)) != 0 ) + if ( params != 0 && (n= cJSON_GetArraySize()) > 0 ) { if ( n == 2 ) { @@ -183,7 +183,7 @@ UniValue musig_send(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) txfee = MUSIG_TXFEE; mypk = pubkey2pk(Mypubkey()); musigpk = GetUnspendable(cp,0); - if ( (params= cclib_reparse(&n,params)) != 0 ) + if ( params != 0 && (n= cJSON_GetArraySize()) > 0 ) { if ( n == 2 && (hexstr= jstr(jitem(params,0),0)) != 0 && is_hexstr(hexstr,0) == 66 ) { @@ -206,7 +206,7 @@ UniValue musig_spend(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) UniValue result(UniValue::VOBJ); std::string rawtx; CPubKey mypk,pk; secp256k1_pubkey combined_pk; char *scriptstr,*musigstr; uint8_t msg[32]; CTransaction vintx; uint256 prevhash,hashBlock; int32_t n,numvouts; CTxOut vout; secp256k1_schnorrsig musig; if ( ctx == 0 ) ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY); - if ( (params= cclib_reparse(&n,params)) != 0 ) + if ( params != 0 && (n= cJSON_GetArraySize()) > 0 ) { if ( n == 3 ) { diff --git a/src/cc/rogue_rpc.cpp b/src/cc/rogue_rpc.cpp index 2d34d27c8..60d9a5cfd 100644 --- a/src/cc/rogue_rpc.cpp +++ b/src/cc/rogue_rpc.cpp @@ -657,7 +657,7 @@ UniValue rogue_newgame(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) UniValue result(UniValue::VOBJ); std::string rawtx; CPubKey roguepk,mypk; char *jsonstr; uint64_t inputsum,change,required,buyin=0; int32_t i,n,maxplayers = 1; if ( txfee == 0 ) txfee = 10000; - if ( (params= cclib_reparse(&n,params)) != 0 ) + if ( params != 0 && (n= cJSON_GetArraySize()) > 0 ) { if ( n > 0 ) { @@ -693,7 +693,7 @@ UniValue rogue_playerinfo(uint64_t txfee,struct CCcontract_info *cp,cJSON *param UniValue result(UniValue::VOBJ); std::vector playerdata; uint256 playertxid,tokenid,origplayergame;int32_t n; CPubKey pk; bits256 t; std::string symbol,pname; result.push_back(Pair("result","success")); rogue_univalue(result,"playerinfo",-1,-1); - if ( (params= cclib_reparse(&n,params)) != 0 ) + if ( params != 0 && (n= cJSON_GetArraySize()) > 0 ) { if ( n > 0 ) { @@ -723,7 +723,7 @@ UniValue rogue_register(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) roguepk = GetUnspendable(cp,0); rogue_univalue(result,"register",-1,-1); playertxid = tokenid = zeroid; - if ( (params= cclib_reparse(&n,params)) != 0 ) + if ( params != 0 && (n= cJSON_GetArraySize()) > 0 ) { if ( n > 0 ) { @@ -803,7 +803,7 @@ UniValue rogue_keystrokes(uint64_t txfee,struct CCcontract_info *cp,cJSON *param if ( txfee == 0 ) txfee = 10000; rogue_univalue(result,"keystrokes",-1,-1); - if ( (params= cclib_reparse(&n,params)) != 0 && n == 2 && (keystrokestr= jstr(jitem(params,1),0)) != 0 ) + if ( params != 0 && (n= cJSON_GetArraySize()) == 2 && (keystrokestr= jstr(jitem(params,1),0)) != 0 ) { gametxid = juint256(jitem(params,0)); result.push_back(Pair("gametxid",gametxid.GetHex())); @@ -896,7 +896,7 @@ UniValue rogue_extract(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) roguepk = GetUnspendable(cp,0); result.push_back(Pair("name","rogue")); result.push_back(Pair("method","extract")); - if ( (params= cclib_reparse(&n,params)) != 0 ) + if ( params != 0 && (n= cJSON_GetArraySize()) > 0 ) { if ( n > 0 ) { @@ -968,7 +968,7 @@ UniValue rogue_finishgame(uint64_t txfee,struct CCcontract_info *cp,cJSON *param funcid = 'H'; mult = 200000; } - if ( (params= cclib_reparse(&n,params)) != 0 ) + if ( params != 0 && (n= cJSON_GetArraySize()) > 0 ) { if ( n > 0 ) { @@ -1081,7 +1081,7 @@ UniValue rogue_gameinfo(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) UniValue result(UniValue::VOBJ),a(UniValue::VARR); int32_t i,n,gameheight,maxplayers,numvouts; uint256 txid; CTransaction tx; int64_t buyin; uint64_t seed; bits256 t; char myrogueaddr[64]; CPubKey mypk,roguepk; result.push_back(Pair("name","rogue")); result.push_back(Pair("method","gameinfo")); - if ( (params= cclib_reparse(&n,params)) != 0 ) + if ( params != 0 && (n= cJSON_GetArraySize()) > 0 ) { if ( n > 0 ) { @@ -1212,7 +1212,7 @@ UniValue rogue_setname(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) { UniValue result(UniValue::VOBJ); int32_t n; char *namestr = 0; rogue_univalue(result,"setname",-1,-1); - if ( (params= cclib_reparse(&n,params)) != 0 ) + if ( params != 0 && (n= cJSON_GetArraySize()) > 0 ) { if ( n > 0 ) { diff --git a/src/cc/sudoku.cpp b/src/cc/sudoku.cpp index d48a1bc2c..a8e7c651b 100644 --- a/src/cc/sudoku.cpp +++ b/src/cc/sudoku.cpp @@ -2817,7 +2817,7 @@ UniValue sudoku_solution(uint64_t txfee,struct CCcontract_info *cp,cJSON *params good = 0; if ( params != 0 ) { - if ( (params= cclib_reparse(&n,params)) != 0 ) + if ( params != 0 && (n= cJSON_GetArraySize()) > 0 ) { if ( n > 2 && n <= (sizeof(timestamps)/sizeof(*timestamps))+2 ) {