Fix rogue results processing
This commit is contained in:
@@ -770,7 +770,7 @@ void rogue_progress(struct rogue_state *rs,int32_t waitflag,uint64_t seed,char *
|
|||||||
{
|
{
|
||||||
if ( (retjson= cJSON_Parse(retstr)) != 0 )
|
if ( (retjson= cJSON_Parse(retstr)) != 0 )
|
||||||
{
|
{
|
||||||
if ( (keys= jstr(retjson,"keystrokes")) != 0 )
|
if ( (resobj= jobj(retjson,"result")) != 0 && (keys= jstr(resobj,"keystrokes")) != 0 )
|
||||||
{
|
{
|
||||||
len = strlen(keys) / 2;
|
len = strlen(keys) / 2;
|
||||||
pastcmp = (char *)malloc(len + 1);
|
pastcmp = (char *)malloc(len + 1);
|
||||||
@@ -791,7 +791,7 @@ void rogue_progress(struct rogue_state *rs,int32_t waitflag,uint64_t seed,char *
|
|||||||
free(retstr);
|
free(retstr);
|
||||||
} else fprintf(stderr,"error extracting game\n");
|
} else fprintf(stderr,"error extracting game\n");
|
||||||
free(pastkeys);
|
free(pastkeys);
|
||||||
} else fprintf(stderr,"no pastkeys\n");
|
} // else fprintf(stderr,"no pastkeys\n");
|
||||||
|
|
||||||
for (i=0; i<num; i++)
|
for (i=0; i<num; i++)
|
||||||
sprintf(&hexstr[i<<1],"%02x",keystrokes[i]&0xff);
|
sprintf(&hexstr[i<<1],"%02x",keystrokes[i]&0xff);
|
||||||
@@ -818,13 +818,13 @@ void rogue_progress(struct rogue_state *rs,int32_t waitflag,uint64_t seed,char *
|
|||||||
}
|
}
|
||||||
if ( (retjson= cJSON_Parse(retstr)) != 0 )
|
if ( (retjson= cJSON_Parse(retstr)) != 0 )
|
||||||
{
|
{
|
||||||
if ( (rawtx= jstr(retjson,"hex")) != 0 )
|
if ( (resobj= jobj(retjson,"result")) != 0 && (rawtx= jstr(resobj,"hex")) != 0 )
|
||||||
{
|
{
|
||||||
if ( rs->keystrokeshex != 0 )
|
if ( rs->keystrokeshex != 0 )
|
||||||
free(rs->keystrokeshex);
|
free(rs->keystrokeshex);
|
||||||
rs->keystrokeshex = (char *)malloc(strlen(rawtx)+1);
|
rs->keystrokeshex = (char *)malloc(strlen(rawtx)+1);
|
||||||
strcpy(rs->keystrokeshex,rawtx);
|
strcpy(rs->keystrokeshex,rawtx);
|
||||||
//fprintf(stderr,"set keystrokestx <- %s\n",rs->keystrokeshex);
|
fprintf(stderr,"set keystrokestx <- %s\n",rs->keystrokeshex);
|
||||||
}
|
}
|
||||||
free_json(retjson);
|
free_json(retjson);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user