upgrade cJSON and move customizations to komodo_cJSON

This commit is contained in:
Scott Sadler
2017-10-22 21:57:07 -07:00
parent 890374f4b0
commit d430a5e8ca
8 changed files with 3516 additions and 1222 deletions

View File

@@ -141,7 +141,7 @@ int32_t Jumblr_depositaddradd(char *depositaddr) // external
{
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
if ( (ismine= jobj(retjson,(char *)"ismine")) != 0 && is_cJSON_True(ismine) != 0 )
if ( (ismine= jobj(retjson,(char *)"ismine")) != 0 && cJSON_IsTrue(ismine) != 0 )
{
retval = 0;
safecopy(Jumblr_deposit,depositaddr,sizeof(Jumblr_deposit));
@@ -149,7 +149,7 @@ int32_t Jumblr_depositaddradd(char *depositaddr) // external
else
{
retval = JUMBLR_ERROR_NOTINWALLET;
printf("%s not in wallet: ismine.%p %d %s\n",depositaddr,ismine,is_cJSON_True(ismine),jprint(retjson,0));
printf("%s not in wallet: ismine.%p %d %s\n",depositaddr,ismine,cJSON_IsTrue(ismine),jprint(retjson,0));
}
free_json(retjson);
}
@@ -366,7 +366,7 @@ int64_t jumblr_balance(char *addr)
//printf("jumblr.[%s].(%s)\n","KMD",retstr);
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
if ( (n= cJSON_GetArraySize(retjson)) > 0 && is_cJSON_Array(retjson) != 0 )
if ( (n= cJSON_GetArraySize(retjson)) > 0 && cJSON_IsArray(retjson) != 0 )
for (i=0; i<n; i++)
balance += SATOSHIDEN * jdouble(jitem(retjson,i),(char *)"amount");
free_json(retjson);
@@ -436,7 +436,7 @@ void jumblr_opidupdate(struct jumblr_item *ptr)
{
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
if ( cJSON_GetArraySize(retjson) == 1 && is_cJSON_Array(retjson) != 0 )
if ( cJSON_GetArraySize(retjson) == 1 && cJSON_IsArray(retjson) != 0 )
{
item = jitem(retjson,0);
//printf("%s\n",jprint(item,0));
@@ -496,6 +496,10 @@ void jumblr_prune(struct jumblr_item *ptr)
}
}
bits256 jbits256(cJSON *json,char *field);
void jumblr_zaddrinit(char *zaddr)
{
struct jumblr_item *ptr; char *retstr,*totalstr; cJSON *item,*array; double total; bits256 txid; char txidstr[65],t_z,z_z;
@@ -508,7 +512,7 @@ void jumblr_zaddrinit(char *zaddr)
if ( (array= cJSON_Parse(retstr)) != 0 )
{
t_z = z_z = 0;
if ( cJSON_GetArraySize(array) == 1 && is_cJSON_Array(array) != 0 )
if ( cJSON_GetArraySize(array) == 1 && cJSON_IsArray(array) != 0 )
{
item = jitem(array,0);
if ( (uint64_t)((total+0.0000000049) * SATOSHIDEN) == (uint64_t)((jdouble(item,(char *)"amount")+0.0000000049) * SATOSHIDEN) )
@@ -559,7 +563,7 @@ void jumblr_opidsupdate()
{
if ( (array= cJSON_Parse(retstr)) != 0 )
{
if ( (n= cJSON_GetArraySize(array)) > 0 && is_cJSON_Array(array) != 0 )
if ( (n= cJSON_GetArraySize(array)) > 0 && cJSON_IsArray(array) != 0 )
{
//printf("%s -> n%d\n",retstr,n);
for (i=0; i<n; i++)
@@ -631,7 +635,7 @@ void jumblr_iteration()
{
if ( (array= cJSON_Parse(retstr)) != 0 )
{
if ( (n= cJSON_GetArraySize(array)) > 0 && is_cJSON_Array(array) != 0 )
if ( (n= cJSON_GetArraySize(array)) > 0 && cJSON_IsArray(array) != 0 )
{
for (i=0; i<n; i++)
jumblr_zaddrinit(jstri(array,i));