From: drh Date: Fri, 21 Aug 2015 20:37:12 +0000 (+0000) Subject: Fixes for compiler warnings and errors in the makefiles. Rename the X-Git-Tag: version-3.9.0~204^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fheads%2Fjson;p=thirdparty%2Fsqlite.git Fixes for compiler warnings and errors in the makefiles. Rename the one test script to json101.test. FossilOrigin-Name: 9ff6ccde5f26f18073587c320290570854ffc833 --- diff --git a/Makefile.in b/Makefile.in index 38df655816..8f3d6f7dfe 100644 --- a/Makefile.in +++ b/Makefile.in @@ -417,7 +417,7 @@ TESTSRC += \ $(TOP)/ext/fts5/fts5_tcl.c \ $(TOP)/ext/fts5/fts5_test_mi.c \ $(TOP)/ext/misc/ieee754.c \ - $(TOP)/ext/misc/json.c \ + $(TOP)/ext/misc/json1.c \ $(TOP)/ext/misc/nextchar.c \ $(TOP)/ext/misc/percentile.c \ $(TOP)/ext/misc/regexp.c \ diff --git a/Makefile.msc b/Makefile.msc index 5f64dfcc5e..441c499df8 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1083,7 +1083,7 @@ TESTEXT = \ $(TOP)\ext\fts5\fts5_tcl.c \ $(TOP)\ext\fts5\fts5_test_mi.c \ $(TOP)\ext\misc\ieee754.c \ - $(TOP)\ext\misc\json.c \ + $(TOP)\ext\misc\json1.c \ $(TOP)\ext\misc\nextchar.c \ $(TOP)\ext\misc\percentile.c \ $(TOP)\ext\misc\regexp.c \ diff --git a/ext/misc/json1.c b/ext/misc/json1.c index 9d9bf63896..66173482c4 100644 --- a/ext/misc/json1.c +++ b/ext/misc/json1.c @@ -29,6 +29,8 @@ SQLITE_EXTENSION_INIT1 #include #include +#define UNUSED_PARAM(X) (void)(X) + /* Unsigned integer types */ typedef sqlite3_uint64 u64; typedef unsigned int u32; @@ -159,7 +161,7 @@ static int jsonGrow(JsonString *p, u32 N){ jsonOom(p); return SQLITE_NOMEM; } - memcpy(zNew, p->zBuf, p->nUsed); + memcpy(zNew, p->zBuf, (size_t)p->nUsed); p->zBuf = zNew; p->bStatic = 0; }else{ @@ -578,7 +580,6 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ if( c=='{' ){ /* Parse object */ iThis = jsonParseAddNode(pParse, JSON_OBJECT, 0, 0); - if( iThis<0 ) return -1; for(j=i+1;;j++){ while( isspace(pParse->zJson[j]) ){ j++; } x = jsonParseValue(pParse, j); @@ -605,7 +606,6 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ }else if( c=='[' ){ /* Parse array */ iThis = jsonParseAddNode(pParse, JSON_ARRAY, 0, 0); - if( iThis<0 ) return -1; for(j=i+1;;j++){ while( isspace(pParse->zJson[j]) ){ j++; } x = jsonParseValue(pParse, j); @@ -938,7 +938,7 @@ static void jsonNodeCountFunc( ){ JsonParse x; /* The parse */ if( jsonParse(&x, (const char*)sqlite3_value_text(argv[0])) ) return; - sqlite3_result_int64(context, x.nNode); + sqlite3_result_int64(context, (sqlite3_int64)x.nNode); jsonParseReset(&x); } #endif /* SQLITE_DEBUG */ @@ -1099,7 +1099,7 @@ static void jsonRemoveFunc( if( argc<1 ) return; if( jsonParse(&x, (const char*)sqlite3_value_text(argv[0])) ) return; if( x.nNode ){ - for(i=1; iiRowid; } - sqlite3_result_int64(ctx, iKey); + sqlite3_result_int64(ctx, (sqlite3_int64)iKey); } break; } @@ -1453,12 +1459,12 @@ static int jsonEachColumn( break; } case JEACH_ID: { - sqlite3_result_int64(ctx, p->i + (p->eType==JSON_OBJECT)); + sqlite3_result_int64(ctx, (sqlite3_int64)p->i + (p->eType==JSON_OBJECT)); break; } case JEACH_PARENT: { if( p->i>0 && p->bRecursive ){ - sqlite3_result_int64(ctx, p->sParse.aUp[p->i]); + sqlite3_result_int64(ctx, (sqlite3_int64)p->sParse.aUp[p->i]); } break; } @@ -1526,6 +1532,8 @@ static int jsonEachBestIndex( int jsonIdx = -1; int pathIdx = -1; const struct sqlite3_index_constraint *pConstraint; + + UNUSED_PARAM(tab); pConstraint = pIdxInfo->aConstraint; for(i=0; inConstraint; i++, pConstraint++){ if( pConstraint->usable==0 ) continue; @@ -1565,6 +1573,8 @@ static int jsonEachFilter( const char *zPath; sqlite3_int64 n; + UNUSED_PARAM(idxStr); + UNUSED_PARAM(argc); jsonEachCursorReset(p); if( idxNum==0 ) return SQLITE_OK; z = (const char*)sqlite3_value_text(argv[0]); @@ -1574,9 +1584,9 @@ static int jsonEachFilter( if( zPath==0 || zPath[0]!='$' ) return SQLITE_OK; } n = sqlite3_value_bytes(argv[0]); - p->zJson = sqlite3_malloc( n+1 ); + p->zJson = sqlite3_malloc64( n+1 ); if( p->zJson==0 ) return SQLITE_NOMEM; - memcpy(p->zJson, z, n+1); + memcpy(p->zJson, z, (size_t)n+1); if( jsonParse(&p->sParse, p->zJson) || (p->bRecursive && jsonParseFindParents(&p->sParse)) ){ @@ -1586,9 +1596,9 @@ static int jsonEachFilter( if( idxNum==3 ){ p->bRecursive = 0; n = sqlite3_value_bytes(argv[1]); - p->zPath = sqlite3_malloc( n+1 ); + p->zPath = sqlite3_malloc64( n+1 ); if( p->zPath==0 ) return SQLITE_NOMEM; - memcpy(p->zPath, zPath, n+1); + memcpy(p->zPath, zPath, (size_t)n+1); pNode = jsonLookup(&p->sParse, 0, p->zPath+1, 0); if( pNode==0 ){ jsonEachCursorReset(p); @@ -1631,6 +1641,9 @@ static sqlite3_module jsonEachModule = { 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ + 0, /* xSavepoint */ + 0, /* xRelease */ + 0 /* xRollbackTo */ }; /* The methods of the json_tree virtual table. */ @@ -1655,6 +1668,9 @@ static sqlite3_module jsonTreeModule = { 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ + 0, /* xSavepoint */ + 0, /* xRelease */ + 0 /* xRollbackTo */ }; /**************************************************************************** @@ -1672,7 +1688,7 @@ int sqlite3_json_init( const sqlite3_api_routines *pApi ){ int rc = SQLITE_OK; - int i; + unsigned int i; static const struct { const char *zName; int nArg; diff --git a/main.mk b/main.mk index e18370a3a1..9988fe2775 100644 --- a/main.mk +++ b/main.mk @@ -297,7 +297,7 @@ TESTSRC += \ $(TOP)/ext/misc/fileio.c \ $(TOP)/ext/misc/fuzzer.c \ $(TOP)/ext/misc/ieee754.c \ - $(TOP)/ext/misc/json.c \ + $(TOP)/ext/misc/json1.c \ $(TOP)/ext/misc/nextchar.c \ $(TOP)/ext/misc/percentile.c \ $(TOP)/ext/misc/regexp.c \ diff --git a/manifest b/manifest index 25d78bc23f..3c1e7613e4 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Change\sthe\sname\sof\sthe\sjson\sloadable\sextension\sto\s"json1.c",\sin\santicipation\nof\shaving\sfuture\smajor\schanges\sto\sthe\sinterface. -D 2015-08-21T20:12:43.689 +C Fixes\sfor\scompiler\swarnings\sand\serrors\sin\sthe\smakefiles.\s\sRename\sthe\none\stest\sscript\sto\sjson101.test. +D 2015-08-21T20:37:12.208 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in 90f3097efb9a53f5fc59a4f8a08be07cf9f52c02 +F Makefile.in e2218eb228374422969de7b1680eda6864affcef F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc f6ed2ce438f711641dc63d762bb0d41aa659518f +F Makefile.msc 10af19cc089862481d49b347acd99c02635ddc49 F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 F VERSION ccfc4d1576dbfdeece0a4372a2e6a2e37d3e7975 @@ -192,7 +192,7 @@ F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2 F ext/misc/fileio.c d4171c815d6543a9edef8308aab2951413cd8d0f F ext/misc/fuzzer.c 4c84635c71c26cfa7c2e5848cf49fe2d2cfcd767 F ext/misc/ieee754.c b0362167289170627659e84173f5d2e8fee8566e -F ext/misc/json1.c 92bb4e5fe2956564d23f933e2140ce8e086d988b w ext/misc/json.c +F ext/misc/json1.c f83f02ec4d7cc18794bd7ac046f1bb5905805b44 F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342 F ext/misc/percentile.c bcbee3c061b884eccb80e21651daaae8e1e43c63 F ext/misc/regexp.c af92cdaa5058fcec1451e49becc7ba44dba023dc @@ -258,7 +258,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 -F main.mk a551a3b8a398e1e64fefbb14bc142aa9584238fc +F main.mk 04840e8277ab5159af16172eafd214dae7cffff5 F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea F mkopcodeh.awk 0e7f04a8eb90f92259e47d80110e4e98d7ce337a F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 @@ -810,7 +810,7 @@ F test/journal3.test ff8af941f9e06161d3db1b46bb9f965ff0e7f307 F test/jrnlmode.test 7864d59cf7f6e552b9b99ba0f38acd167edc10fa F test/jrnlmode2.test 81610545a4e6ed239ea8fa661891893385e23a1d F test/jrnlmode3.test 556b447a05be0e0963f4311e95ab1632b11c9eaa -F test/json1.test 950ed4e8deb8ad4c10bd4fbc858eb54143de9867 +F test/json101.test 950ed4e8deb8ad4c10bd4fbc858eb54143de9867 w test/json1.test F test/keyword1.test 37ef6bba5d2ed5b07ecdd6810571de2956599dff F test/lastinsert.test 42e948fd6442f07d60acbd15d33fb86473e0ef63 F test/laststmtchanges.test ae613f53819206b3222771828d024154d51db200 @@ -1378,7 +1378,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 15dd99431e9ddd0fbdbb8dcc921687b0c6d26a29 -R 46781c36cc64ae92318031e0c6494ecf +P d0d4bec9e3d8829a2d488f2742f1650214fa716a +R 0dbca2db2baae780df721a60ce2b8302 U drh -Z cf5f4e21b0acc856e5deddedc237451f +Z f736e312f15e55183b503d223fff9c6b diff --git a/manifest.uuid b/manifest.uuid index 02752a564b..a805312be8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d0d4bec9e3d8829a2d488f2742f1650214fa716a \ No newline at end of file +9ff6ccde5f26f18073587c320290570854ffc833 \ No newline at end of file diff --git a/test/json1.test b/test/json101.test similarity index 100% rename from test/json1.test rename to test/json101.test