From 2f99f0b86dfc030ceda2a5968032b0f07914d5f8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 4 Sep 2018 18:30:22 -1100 Subject: [PATCH] Fix --- src/cc/dapps/oraclefeed.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/cc/dapps/oraclefeed.c b/src/cc/dapps/oraclefeed.c index 65edbf835..c4916935d 100644 --- a/src/cc/dapps/oraclefeed.c +++ b/src/cc/dapps/oraclefeed.c @@ -360,7 +360,7 @@ void komodobroadcast(cJSON *hexjson) int32_t main(int32_t argc,char **argv) { - cJSON *clijson,*clijson2,*regjson,*item; int32_t i,j,n; char *retstr,*pkstr,hexstr[64]; uint64_t price; + cJSON *clijson,*clijson2,*regjson,*item; int32_t i,j,n; char *retstr,*retstr2,*pkstr,hexstr[64]; uint64_t price; printf("Powered by CoinDesk (%s) %.8f\n","https://www.coindesk.com/price/",dstr(get_btcusd())); while ( 1 ) { @@ -375,14 +375,19 @@ int32_t main(int32_t argc,char **argv) if ( (pkstr= jstr(item,"provider")) != 0 && strcmp(pkstr,MYPUBKEY) == 0 ) { for (j=0; j<8; j++) - sprintf(&hexstr[j*2],"%02x",(price >> (j*8)) & 0xff); + sprintf(&hexstr[j*2],"%02x",(uint8_t)((price >> (j*8)) & 0xff)); hexstr[16] = 0; - if ( (clijson2= get_komodocli("AT5","oraclesdata",ORACLETXID,hexstr,"")) != 0 ) + if ( (clijson2= get_komodocli(&retstr2,"AT5","oraclesdata",ORACLETXID,hexstr,"")) != 0 ) { printf("data.(%s)\n",jprint(clijson2,0)); komodobroadcast(clijson2); free_json(clijson2); } + else if ( retstr2 != 0 ) + { + printf("error parsing oraclesdata.(%s)\n",retstr2); + free(retstr2); + } break; } }