Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
1108243f1f
  1. 3
      iguana/iguana_rpc.c
  2. 18
      iguana/main.c

3
iguana/iguana_rpc.c

@ -34,7 +34,8 @@ char *sglue(GLUEARGS,char *agent,char *method)
{ {
if ( (retjson= cJSON_Parse(retstr)) != 0 ) if ( (retjson= cJSON_Parse(retstr)) != 0 )
{ {
jdelete(retjson,"tag"); if ( jobj(retjson,"tag") != 0 )
jdelete(retjson,"tag");
///printf("RPCret.(%s) n.%d\n",jprint(retjson,0),cJSON_GetArraySize(retjson)); ///printf("RPCret.(%s) n.%d\n",jprint(retjson,0),cJSON_GetArraySize(retjson));
result = cJSON_GetObjectItem(retjson,"result"); result = cJSON_GetObjectItem(retjson,"result");
error = cJSON_GetObjectItem(retjson,"error"); error = cJSON_GetObjectItem(retjson,"error");

18
iguana/main.c

@ -304,15 +304,19 @@ char *SuperNET_processJSON(struct supernet_info *myinfo,cJSON *json,char *remote
{ {
if ( (retjsonstr[0] == '{' || retjsonstr[0] == '[') && (retjson= cJSON_Parse(retjsonstr)) != 0 ) if ( (retjsonstr[0] == '{' || retjsonstr[0] == '[') && (retjson= cJSON_Parse(retjsonstr)) != 0 )
{ {
if ( j64bits(retjson,"tag") != tag ) if ( is_cJSON_Array(retjson) == 0 )
{ {
if ( jobj(retjson,"tag") != 0 ) if ( j64bits(retjson,"tag") != tag )
jdelete(retjson,"tag"); {
jadd64bits(retjson,"tag",tag); if ( jobj(retjson,"tag") != 0 )
jdelete(retjson,"tag");
jadd64bits(retjson,"tag",tag);
}
retstr = jprint(retjson,1);
//printf("retstr.(%s) retjsonstr.%p retjson.%p\n",retstr,retjsonstr,retjson);
} }
retstr = jprint(retjson,1); else retstr = retjsonstr;
//printf("retstr.(%s) retjsonstr.%p retjson.%p\n",retstr,retjsonstr,retjson); free(retjsonstr);
free(retjsonstr);//,strlen(retjsonstr)+1);
} else retstr = retjsonstr; } else retstr = retjsonstr;
} }
free(jsonstr); free(jsonstr);

Loading…
Cancel
Save