diff options
author | drh <> | 2023-10-06 14:59:40 +0000 |
---|---|---|
committer | drh <> | 2023-10-06 14:59:40 +0000 |
commit | e690d5ad80ae90573fce913b0c01d05aaac0c769 (patch) | |
tree | 731bb2c95455620b608643d42db84c0acff36074 /src/json.c | |
parent | e1e2f2dcc5b76ef2bb2ce7c0e59f67b8913b74a2 (diff) | |
download | sqlite-e690d5ad80ae90573fce913b0c01d05aaac0c769.tar.gz sqlite-e690d5ad80ae90573fce913b0c01d05aaac0c769.zip |
Fix compiler warnings.
FossilOrigin-Name: 5227add3c8d509de2e081249163fafdf30ac3173a6d710957f3c3b6f03e7017e
Diffstat (limited to 'src/json.c')
-rw-r--r-- | src/json.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/json.c b/src/json.c index 69c9e67b6..b2053af9e 100644 --- a/src/json.c +++ b/src/json.c @@ -3267,7 +3267,7 @@ static u32 jsonRenderBlob( break; } case JSONB_INT5: { /* Integer literal in hexadecimal notation */ - int k = 2; + u32 k = 2; sqlite3_uint64 u = 0; const char *zIn = (const char*)&pParse->aBlob[i+n]; if( zIn[0]=='+' || zIn[0]=='-' ){ @@ -3281,7 +3281,7 @@ static u32 jsonRenderBlob( break; } case JSONB_FLOAT5: { /* Float literal missing digits beside "." */ - int k = 0; + u32 k = 0; const char *zIn = (const char*)&pParse->aBlob[i+n]; if( zIn[0]=='+' || zIn[0]=='-' ){ if( zIn[0]=='-' ) jsonAppendChar(pOut, '-'); @@ -3753,14 +3753,14 @@ static u32 jsonLookupBlobStep( k = jsonbArrayCount(pParse, iRoot); i = 2; if( zPath[2]=='-' && sqlite3Isdigit(zPath[3]) ){ - unsigned int x = 0; + unsigned int nn = 0; i = 3; do{ - x = x*10 + zPath[i] - '0'; + nn = nn*10 + zPath[i] - '0'; i++; }while( sqlite3Isdigit(zPath[i]) ); - if( x>k ) return 0; - k -= x; + if( nn>k ) return 0; + k -= nn; } if( zPath[i]!=']' ){ *pzErr = zPath; @@ -3997,7 +3997,7 @@ static void jsonExtractFromBlob( ){ const char *zPath = (const char*)sqlite3_value_text(pPath); const char *zErr = 0; - u32 i; + u32 i = 0; JsonParse px; if( zPath==0 ) return; memset(&px, 0, sizeof(px)); @@ -4031,6 +4031,9 @@ static void jsonExtractFromBlob( } i = jsonLookupBlobStep(&px, 0, zPath, &zErr); jsonStringReset(&jx); + }else{ + sqlite3_result_error(ctx, "bad path", -1); + return; } if( i<px.nBlob ){ jsonReturnFromBlob(&px, i, ctx); |