From d5a336ef58537565087b5184b6bc9e6d39f948e8 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 19 Apr 2012 15:49:19 +0000 Subject: [PATCH 1/3] Fix harmless compiler warnings (unused parameter warnings) in the aggregate query analyzer. FossilOrigin-Name: 2d43562084316ec180a4c2cfc3fee08d58432204 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/expr.c | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 3fe3810d0e..ddca71d490 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sharmless\scompiler\swarning\sin\sthe\smkkeywordhash.c\sutility\sprogram. -D 2012-04-18T10:13:20.705 +C Fix\sharmless\scompiler\swarnings\s(unused\sparameter\swarnings)\sin\sthe\saggregate\nquery\sanalyzer. +D 2012-04-19T15:49:19.250 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -135,7 +135,7 @@ F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac F src/ctime.c a9c26822515f81ec21588cbb482ca6724be02e33 F src/date.c 067a81c9942c497aafd2c260e13add8a7d0c7dd4 F src/delete.c 4c20ea4f6213b3bc1c6a510586864b679946e05e -F src/expr.c 1b2383adc4391ddae38abb71fd4690a3af8efb01 +F src/expr.c eefabaa4a3dc67309a754eb0eab1a163ff4c2bf3 F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c 657212460bf5cfd3ae607d12ea62092844c227b5 F src/func.c c6b3c94320253a35bda43fb69cc292618e3285d6 @@ -1000,7 +1000,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh a8a0a3babda96dfb1ff51adda3cbbf3dfb7266c2 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P 4a5641cc0aa4c49762f4fe73dab4a6612631c0d2 -R 9331d8fd78cc0caf6b6610e6acb41aab +P 6015200beb3be7ec141ce36de694278e3ba11a02 +R 9257b7e12fe23b672785f7fcab3d866f U drh -Z a487d3c4edeae5b06a7f847c65e40582 +Z 56d6ab47e198788c5ca35282ff366bc4 diff --git a/manifest.uuid b/manifest.uuid index b3be873e6b..366c76a5aa 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6015200beb3be7ec141ce36de694278e3ba11a02 \ No newline at end of file +2d43562084316ec180a4c2cfc3fee08d58432204 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 328de4e5ea..10d9f775d9 100644 --- a/src/expr.c +++ b/src/expr.c @@ -4009,6 +4009,8 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){ return WRC_Continue; } static int analyzeAggregatesInSelect(Walker *pWalker, Select *pSelect){ + UNUSED_PARAMETER(pWalker); + UNUSED_PARAMETER(pSelect); return WRC_Continue; } From 7ed243b71abf1f989e9c6ba2904b6f84a8cecaa7 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 19 Apr 2012 17:19:51 +0000 Subject: [PATCH 2/3] Fix a harmless compiler warning in tclsqlite.c for MSVC x64. Fix a test case associated with the FTS4 merge feature. FossilOrigin-Name: de3f7187eb2ff24683a1854ae523e7d30c290893 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/tclsqlite.c | 2 +- test/fts4merge3.test | 5 ++++- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index ddca71d490..4cb6899a83 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sharmless\scompiler\swarnings\s(unused\sparameter\swarnings)\sin\sthe\saggregate\nquery\sanalyzer. -D 2012-04-19T15:49:19.250 +C Fix\sa\sharmless\scompiler\swarning\sin\stclsqlite.c\sfor\sMSVC\sx64.\s\sFix\sa\stest\ncase\sassociated\swith\sthe\sFTS4\smerge\sfeature. +D 2012-04-19T17:19:51.813 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -189,7 +189,7 @@ F src/sqliteInt.h c5e917c4f1453f3972b1fd0c81105dfe4f09cc32 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 35939e7e03abf1b7577ce311f48f682c40de3208 F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e -F src/tclsqlite.c 086dfdd72e5892de223968a258e1ccbd9693e717 +F src/tclsqlite.c c936d7e673e6bd8b00a704afe52eb4dc9227e819 F src/test1.c 8631f728c9c3afcf79e3e22b510e451435e3d15e F src/test2.c 711555927f1f7e8db9aab86b512bc6934a774abe F src/test3.c f82399ec50d9cd7378bf9d6db6c1409d5e77b042 @@ -502,7 +502,7 @@ F test/fts4content.test 17b2360f7d1a9a7e5aa8022783f5c5731b6dfd4f F test/fts4langid.test 24a6e41063b416bbdf371ff6b4476fa41c194aa7 F test/fts4merge.test c424309743fdd203f8e56a1f1cd7872cd66cc0ee F test/fts4merge2.test 5faa558d1b672f82b847d2a337465fa745e46891 -F test/fts4merge3.test 125c3334f49bc171b3310efc99358cd05475c1d6 +F test/fts4merge3.test aab02a09f50fe6baaddc2e159c3eabc116d45fc7 F test/func.test 9809b7622d721904a8cc33c1ffb87f46d506ed01 F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f F test/func3.test 001021e5b88bd02a3b365a5c5fd8f6f49d39744a @@ -1000,7 +1000,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh a8a0a3babda96dfb1ff51adda3cbbf3dfb7266c2 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P 6015200beb3be7ec141ce36de694278e3ba11a02 -R 9257b7e12fe23b672785f7fcab3d866f +P 2d43562084316ec180a4c2cfc3fee08d58432204 +R b4d15b45430ec8317ad8235bfccc7422 U drh -Z 56d6ab47e198788c5ca35282ff366bc4 +Z 90af5bda362fb4ffad168e2931647669 diff --git a/manifest.uuid b/manifest.uuid index 366c76a5aa..55713ed71a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2d43562084316ec180a4c2cfc3fee08d58432204 \ No newline at end of file +de3f7187eb2ff24683a1854ae523e7d30c290893 \ No newline at end of file diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 9161088e08..e1ae8eb8ed 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -1163,7 +1163,7 @@ static int dbPrepareAndBind( memset(pPreStmt, 0, nByte); pPreStmt->pStmt = pStmt; - pPreStmt->nSql = (*pzOut - zSql); + pPreStmt->nSql = (int)(*pzOut - zSql); pPreStmt->zSql = sqlite3_sql(pStmt); pPreStmt->apParm = (Tcl_Obj **)&pPreStmt[1]; #ifdef SQLITE_TEST diff --git a/test/fts4merge3.test b/test/fts4merge3.test index 3fd300daf9..329b4d2cc4 100644 --- a/test/fts4merge3.test +++ b/test/fts4merge3.test @@ -44,7 +44,10 @@ do_all_bc_test { do_test 1.2 { sql1 "SELECT docid FROM t2 WHERE t2 MATCH 'abc'" } {1485} do_test 1.3 { sql2 "SELECT docid FROM t2 WHERE t2 MATCH 'abc'" } {1485} - do_test 1.4 { sql2 "PRAGMA page_count" } {1286} + do_test 1.4 { + set x [sql2 "PRAGMA page_count"] + expr {$x>=1284 && $x<=1286} + } {1} do_test 1.5 { sql2 { SELECT level, count(*) FROM t2_segdir GROUP BY level ORDER BY 1 } } [list 0 15 1 1 2 14 3 4] From 83cc139231e651c3aba29f3b6620e26e7bae45c3 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 19 Apr 2012 18:04:28 +0000 Subject: [PATCH 3/3] Fix harmless compiler warnings on x64 MSVC, mostly in test code, but also in tclsqlite.c and in the FTS4 module. FossilOrigin-Name: 3281972eaa46cb57fd9f0387063f47430dc0a3b4 --- ext/fts3/fts3_term.c | 4 ++-- ext/fts3/fts3_test.c | 10 +++++----- manifest | 44 ++++++++++++++++++++++---------------------- manifest.uuid | 2 +- src/tclsqlite.c | 4 ++-- src/test1.c | 12 ++++++------ src/test2.c | 2 +- src/test3.c | 2 +- src/test6.c | 4 ++-- src/test8.c | 4 ++-- src/test_func.c | 2 +- src/test_fuzzer.c | 16 ++++++++-------- src/test_hexio.c | 4 ++-- src/test_journal.c | 6 +++--- src/test_multiplex.c | 2 +- src/test_onefile.c | 6 +++--- src/test_osinst.c | 4 ++-- src/test_quota.c | 14 +++++++------- src/test_vfs.c | 8 ++++---- 19 files changed, 75 insertions(+), 75 deletions(-) diff --git a/ext/fts3/fts3_term.c b/ext/fts3/fts3_term.c index f4215baf51..c49d5cb65d 100644 --- a/ext/fts3/fts3_term.c +++ b/ext/fts3/fts3_term.c @@ -88,9 +88,9 @@ static int fts3termConnectMethod( } zDb = argv[1]; - nDb = strlen(zDb); + nDb = (int)strlen(zDb); zFts3 = argv[3]; - nFts3 = strlen(zFts3); + nFts3 = (int)strlen(zFts3); rc = sqlite3_declare_vtab(db, FTS3_TERMS_SCHEMA); if( rc!=SQLITE_OK ) return rc; diff --git a/ext/fts3/fts3_test.c b/ext/fts3/fts3_test.c index 2244c9f736..4da0b8f13d 100644 --- a/ext/fts3/fts3_test.c +++ b/ext/fts3/fts3_test.c @@ -390,7 +390,7 @@ static int testTokenizerOpen( memset(pCsr, 0, sizeof(test_tokenizer_cursor)); pCsr->aInput = pInput; if( nBytes<0 ){ - pCsr->nInput = strlen(pInput); + pCsr->nInput = (int)strlen(pInput); }else{ pCsr->nInput = nBytes; } @@ -443,7 +443,7 @@ static int testTokenizerNext( const char *pToken = p; int nToken; while( ppCsr->nBuffer ){ @@ -461,12 +461,12 @@ static int testTokenizerNext( for(i=0; iaBuffer[i] = testTolower(pToken[i]); } pCsr->iToken++; - pCsr->iInput = p - pCsr->aInput; + pCsr->iInput = (int)(p - pCsr->aInput); *ppToken = pCsr->aBuffer; *pnBytes = nToken; - *piStartOffset = pToken - pCsr->aInput; - *piEndOffset = p - pCsr->aInput; + *piStartOffset = (int)(pToken - pCsr->aInput); + *piEndOffset = (int)(p - pCsr->aInput); *piPosition = pCsr->iToken; } } diff --git a/manifest b/manifest index 4cb6899a83..1c11ae957b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sharmless\scompiler\swarning\sin\stclsqlite.c\sfor\sMSVC\sx64.\s\sFix\sa\stest\ncase\sassociated\swith\sthe\sFTS4\smerge\sfeature. -D 2012-04-19T17:19:51.813 +C Fix\sharmless\scompiler\swarnings\son\sx64\sMSVC,\smostly\sin\stest\scode,\sbut\salso\sin\ntclsqlite.c\sand\sin\sthe\sFTS4\smodule. +D 2012-04-19T18:04:28.392 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -73,8 +73,8 @@ F ext/fts3/fts3_hash.h 8331fb2206c609f9fc4c4735b9ab5ad6137c88ec F ext/fts3/fts3_icu.c 62ec177c55f6a5c6e994dd3e5fd3194b4045c347 F ext/fts3/fts3_porter.c a465b49fcb8249a755792f87516eff182efa42b3 F ext/fts3/fts3_snippet.c 51a3a34c217e24678a133782c1dfb6f2f70fe559 -F ext/fts3/fts3_term.c 41e82ad335213d1c24356cf310dca1d3c13e7366 -F ext/fts3/fts3_test.c f153a121c763993e3d94cc99c012ee68d13231ae +F ext/fts3/fts3_term.c a521f75132f9a495bdca1bdd45949b3191c52763 +F ext/fts3/fts3_test.c 348f7d08cae05285794e23dc4fe8b8fdf66e264a F ext/fts3/fts3_tokenizer.c 3da7254a9881f7e270ab28e2004e0d22b3212bce F ext/fts3/fts3_tokenizer.h 66dec98e365854b6cd2d54f1a96bb6d428fc5a68 F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004 @@ -189,15 +189,15 @@ F src/sqliteInt.h c5e917c4f1453f3972b1fd0c81105dfe4f09cc32 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 35939e7e03abf1b7577ce311f48f682c40de3208 F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e -F src/tclsqlite.c c936d7e673e6bd8b00a704afe52eb4dc9227e819 -F src/test1.c 8631f728c9c3afcf79e3e22b510e451435e3d15e -F src/test2.c 711555927f1f7e8db9aab86b512bc6934a774abe -F src/test3.c f82399ec50d9cd7378bf9d6db6c1409d5e77b042 +F src/tclsqlite.c fe5406573e1527957e00dcaf51edd9d8bd31b918 +F src/test1.c a808bfa548a501b513579bdbaf83901c98e059c9 +F src/test2.c 4178056dd1e7d70f954ad8a1e3edb71a2a784daf +F src/test3.c 3c3c2407fa6ec7a19e24ae23f7cb439d0275a60d F src/test4.c d1e5a5e904d4b444cf572391fdcb017638e36ff7 F src/test5.c a6d1ac55ac054d0b2b8f37b5e655b6c92645a013 -F src/test6.c 3329df2dbc0293031d763947ec08c9eef982ef1d +F src/test6.c 417e1e214734393c24a8ee80b41485a9c4169123 F src/test7.c 2e0781754905c8adc3268d8f0967e7633af58843 -F src/test8.c 61b41d79509a479dec1ac32b6d4209b27c4b1ba5 +F src/test8.c 5ecbffe6712da81d5d10454e9d77d6c5bac95fe8 F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60 F src/test_async.c 0612a752896fad42d55c3999a5122af10dcf22ad F src/test_autoext.c 30e7bd98ab6d70a62bb9ba572e4c7df347fe645e @@ -206,22 +206,22 @@ F src/test_btree.c 47cd771250f09cdc6e12dda5bc71bc0b3abc96e2 F src/test_config.c 0de329e736eb4aa5845069bed630e5c72f012264 F src/test_demovfs.c 20a4975127993f4959890016ae9ce5535a880094 F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc -F src/test_func.c 6232d722a4ddb193035aa13a03796bf57d6c12fd -F src/test_fuzzer.c 7e431cb04f4457b676a2764839d2857fdd91ec4e -F src/test_hexio.c c4773049603151704a6ab25ac5e936b5109caf5a +F src/test_func.c 090f2c3339e85c2c964435f99aed6f3da9d59525 +F src/test_fuzzer.c 1d26aa965120420bc14807da29d4d4541bfa6148 +F src/test_hexio.c abfdecb6fa58c354623978efceb088ca18e379cd F src/test_init.c 3cbad7ce525aec925f8fda2192d576d47f0d478a F src/test_intarray.c d879bbf8e4ce085ab966d1f3c896a7c8b4f5fc99 F src/test_intarray.h 489edb9068bb926583445cb02589344961054207 -F src/test_journal.c b964473ff1b7a65626763f068fa6a810385d1fbf +F src/test_journal.c f5c0a05b7b3d5930db769b5ee6c3766dc2221a64 F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e F src/test_malloc.c 3f5903a1528fd32fe4c472a3bd0259128d8faaef -F src/test_multiplex.c 3dffd0fe6c96ac7c5150485b55244e73faab5380 +F src/test_multiplex.c 66dcfca001ee22f04ef31ad353772ed05a017e53 F src/test_multiplex.h e99c571bc4968b7a9363b661481f3934bfead61d F src/test_mutex.c a6bd7b9cf6e19d989e31392b06ac8d189f0d573e -F src/test_onefile.c 5e1382e7844c703c77c4c2aee82f8359555b5a8e -F src/test_osinst.c 7f790ac89c5a585d51b341274d9691c3391e0923 +F src/test_onefile.c 0396f220561f3b4eedc450cef26d40c593c69a25 +F src/test_osinst.c 90a845c8183013d80eccb1f29e8805608516edba F src/test_pcache.c a5cd24730cb43c5b18629043314548c9169abb00 -F src/test_quota.c 2ab468f5817b84f7105f78b77c300649ea5af8d1 +F src/test_quota.c 9d6be9cd3bb132df2b964193b6a4ec850f50a210 F src/test_quota.h ee5da2ae7f84d1c8e0e0e2ab33f01d69f10259b5 F src/test_rtree.c aba603c949766c4193f1068b91c787f57274e0d9 F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0 @@ -231,7 +231,7 @@ F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd F src/test_syscall.c a992d8c80ea91fbf21fb2dd570db40e77dd7e6ae F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa F src/test_thread.c e286f2173563f2a1747c24bcda6b9d030bf4f4e4 -F src/test_vfs.c 73f46bd9b5183ebcb77da22773886b81157cdc3d +F src/test_vfs.c 9d934e111021d56c629efc73a796648c9519ad12 F src/test_vfstrace.c 6b28adb2a0e8ecd0f2e3581482e1f658b11b4067 F src/test_wholenumber.c 3d2b9ed1505c40ad5c5ca2ad16ae7a289d6cc251 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 @@ -1000,7 +1000,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh a8a0a3babda96dfb1ff51adda3cbbf3dfb7266c2 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P 2d43562084316ec180a4c2cfc3fee08d58432204 -R b4d15b45430ec8317ad8235bfccc7422 +P de3f7187eb2ff24683a1854ae523e7d30c290893 +R 93ef8dac16d8fdeed30c697eb50ecf5c U drh -Z 90af5bda362fb4ffad168e2931647669 +Z 1cd21a56051e90b0bfc0e250c8d84f38 diff --git a/manifest.uuid b/manifest.uuid index 55713ed71a..50f325473a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -de3f7187eb2ff24683a1854ae523e7d30c290893 \ No newline at end of file +3281972eaa46cb57fd9f0387063f47430dc0a3b4 \ No newline at end of file diff --git a/src/tclsqlite.c b/src/tclsqlite.c index e1ae8eb8ed..51f8c517df 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -3470,7 +3470,7 @@ static int md5file_cmd(void*cd, Tcl_Interp*interp, int argc, const char **argv){ MD5Init(&ctx); for(;;){ int n; - n = fread(zBuf, 1, sizeof(zBuf), in); + n = (int)fread(zBuf, 1, sizeof(zBuf), in); if( n<=0 ) break; MD5Update(&ctx, (unsigned char*)zBuf, (unsigned)n); } @@ -3516,7 +3516,7 @@ static void md5step(sqlite3_context *context, int argc, sqlite3_value **argv){ for(i=0; inUsed + n + 2 > p->nAlloc ){ char *zNew; p->nAlloc = p->nAlloc*2 + n + 200; @@ -3609,10 +3609,10 @@ static int test_prepare( if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR; if( zTail && objc>=5 ){ if( bytes>=0 ){ - bytes = bytes - (zTail-zSql); + bytes = bytes - (int)(zTail-zSql); } if( (int)strlen(zTail)=5 ){ if( bytes>=0 ){ - bytes = bytes - (zTail-zSql); + bytes = bytes - (int)(zTail-zSql); } Tcl_ObjSetVar2(interp, objv[4], 0, Tcl_NewStringObj(zTail, bytes), 0); } @@ -3768,7 +3768,7 @@ static int test_prepare16( if( objc>=5 ){ if( zTail ){ - objlen = objlen - ((u8 *)zTail-(u8 *)zSql); + objlen = objlen - (int)((u8 *)zTail-(u8 *)zSql); }else{ objlen = 0; } @@ -3828,7 +3828,7 @@ static int test_prepare16_v2( if( objc>=5 ){ if( zTail ){ - objlen = objlen - ((u8 *)zTail-(u8 *)zSql); + objlen = objlen - (int)((u8 *)zTail-(u8 *)zSql); }else{ objlen = 0; } diff --git a/src/test2.c b/src/test2.c index 8343692f6a..8acdf6f4ef 100644 --- a/src/test2.c +++ b/src/test2.c @@ -547,7 +547,7 @@ static int fake_big_file( if( Tcl_GetInt(interp, argv[1], &n) ) return TCL_ERROR; pVfs = sqlite3_vfs_find(0); - nFile = strlen(argv[2]); + nFile = (int)strlen(argv[2]); zFile = sqlite3_malloc( nFile+2 ); if( zFile==0 ) return TCL_ERROR; memcpy(zFile, argv[2], nFile+1); diff --git a/src/test3.c b/src/test3.c index 947ded7d91..e460c42e46 100644 --- a/src/test3.c +++ b/src/test3.c @@ -80,7 +80,7 @@ static int btree_open( sDb.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE); sqlite3_mutex_enter(sDb.mutex); } - n = strlen(argv[1]); + n = (int)strlen(argv[1]); zFilename = sqlite3_malloc( n+2 ); if( zFilename==0 ) return TCL_ERROR; memcpy(zFilename, argv[1], n+1); diff --git a/src/test6.c b/src/test6.c index e2cee09193..bae6b65dc2 100644 --- a/src/test6.c +++ b/src/test6.c @@ -468,8 +468,8 @@ static int cfSync(sqlite3_file *pFile, int flags){ const char *zName = pCrash->zName; const char *zCrashFile = g.zCrashFile; - int nName = strlen(zName); - int nCrashFile = strlen(zCrashFile); + int nName = (int)strlen(zName); + int nCrashFile = (int)strlen(zCrashFile); if( nCrashFile>0 && zCrashFile[nCrashFile-1]=='*' ){ nCrashFile--; diff --git a/src/test8.c b/src/test8.c index 80e7adaf2c..ba7e37372c 100644 --- a/src/test8.c +++ b/src/test8.c @@ -192,7 +192,7 @@ static int getColumnNames( rc = SQLITE_NOMEM; goto out; } - nBytes += strlen(zName)+1; + nBytes += (int)strlen(zName)+1; } aCol = (char **)sqlite3MallocZero(nBytes); if( !aCol ){ @@ -1217,7 +1217,7 @@ static int echoRename(sqlite3_vtab *vtab, const char *zNewName){ } if( p->isPattern ){ - int nThis = strlen(p->zThis); + int nThis = (int)strlen(p->zThis); char *zSql = sqlite3_mprintf("ALTER TABLE %s RENAME TO %s%s", p->zTableName, zNewName, &p->zTableName[nThis] ); diff --git a/src/test_func.c b/src/test_func.c index fff070e7ee..c4fe351cb9 100644 --- a/src/test_func.c +++ b/src/test_func.c @@ -202,7 +202,7 @@ static void test_auxdata( }else { zRet[i*2] = '0'; } - n = strlen(z) + 1; + n = (int)strlen(z) + 1; zAux = testContextMalloc(pCtx, n); if( zAux ){ memcpy(zAux, z, n); diff --git a/src/test_fuzzer.c b/src/test_fuzzer.c index d32a39c155..10496f2ea7 100644 --- a/src/test_fuzzer.c +++ b/src/test_fuzzer.c @@ -308,8 +308,8 @@ static int fuzzerLoadOneRule( if( zFrom==0 ) zFrom = ""; if( zTo==0 ) zTo = ""; - nFrom = strlen(zFrom); - nTo = strlen(zTo); + nFrom = (int)strlen(zFrom); + nTo = (int)strlen(zTo); /* Silently ignore null transformations */ if( strcmp(zFrom, zTo)==0 ){ @@ -448,7 +448,7 @@ static char *fuzzerDequote(const char *zIn){ int nIn; /* Size of input string, in bytes */ char *zOut; /* Output (dequoted) string */ - nIn = strlen(zIn); + nIn = (int)strlen(zIn); zOut = sqlite3_malloc(nIn+1); if( zOut ){ char q = zIn[0]; /* Quote character (if any ) */ @@ -465,7 +465,7 @@ static char *fuzzerDequote(const char *zIn){ zOut[iOut++] = zIn[iIn]; } } - assert( strlen(zOut)<=nIn ); + assert( (int)strlen(zOut)<=nIn ); } return zOut; } @@ -513,7 +513,7 @@ static int fuzzerConnect( }else{ int nModule; /* Length of zModule, in bytes */ - nModule = strlen(zModule); + nModule = (int)strlen(zModule); pNew = sqlite3_malloc( sizeof(*pNew) + nModule + 1); if( pNew==0 ){ rc = SQLITE_NOMEM; @@ -870,11 +870,11 @@ static fuzzer_stem *fuzzerNewStem( fuzzer_rule *pRule; unsigned int h; - pNew = sqlite3_malloc( sizeof(*pNew) + strlen(zWord) + 1 ); + pNew = sqlite3_malloc( sizeof(*pNew) + (int)strlen(zWord) + 1 ); if( pNew==0 ) return 0; memset(pNew, 0, sizeof(*pNew)); pNew->zBasis = (char*)&pNew[1]; - pNew->nBasis = strlen(zWord); + pNew->nBasis = (int)strlen(zWord); memcpy(pNew->zBasis, zWord, pNew->nBasis+1); pRule = pCur->pVtab->pRule; while( fuzzerSkipRule(pRule, pNew, pCur->iRuleset) ){ @@ -997,7 +997,7 @@ static int fuzzerFilter( /* If the query term is longer than FUZZER_MX_OUTPUT_LENGTH bytes, this ** query will return zero rows. */ - if( strlen(zWord)pStem = pStem = fuzzerNewStem(pCur, zWord, (fuzzer_cost)0); if( pStem==0 ) return SQLITE_NOMEM; pStem->pRule = &pCur->nullRule; diff --git a/src/test_hexio.c b/src/test_hexio.c index e3258e869e..b20b5ce730 100644 --- a/src/test_hexio.c +++ b/src/test_hexio.c @@ -126,7 +126,7 @@ static int hexio_read( return TCL_ERROR; } fseek(in, offset, SEEK_SET); - got = fread(zBuf, 1, amt, in); + got = (int)fread(zBuf, 1, amt, in); fclose(in); if( got<0 ){ got = 0; @@ -178,7 +178,7 @@ static int hexio_write( return TCL_ERROR; } fseek(out, offset, SEEK_SET); - written = fwrite(aOut, 1, nOut, out); + written = (int)fwrite(aOut, 1, nOut, out); sqlite3_free(aOut); fclose(out); Tcl_SetObjResult(interp, Tcl_NewIntObj(written)); diff --git a/src/test_journal.c b/src/test_journal.c index 4cb51fbcf5..e8701a4eea 100644 --- a/src/test_journal.c +++ b/src/test_journal.c @@ -290,9 +290,9 @@ static jt_file *locateDatabaseHandle(const char *zJournal){ jt_file *pMain = 0; enterJtMutex(); for(pMain=g.pList; pMain; pMain=pMain->pNext){ - int nName = strlen(zJournal) - strlen("-journal"); + int nName = (int)(strlen(zJournal) - strlen("-journal")); if( (pMain->flags&SQLITE_OPEN_MAIN_DB) - && (strlen(pMain->zName)==nName) + && ((int)strlen(pMain->zName)==nName) && 0==memcmp(pMain->zName, zJournal, nName) && (pMain->eLock>=SQLITE_LOCK_RESERVED) ){ @@ -723,7 +723,7 @@ static int jtOpen( ** returning. */ static int jtDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){ - int nPath = strlen(zPath); + int nPath = (int)strlen(zPath); if( nPath>8 && 0==strcmp("-journal", &zPath[nPath-8]) ){ /* Deleting a journal file. The end of a transaction. */ jt_file *pMain = locateDatabaseHandle(zPath); diff --git a/src/test_multiplex.c b/src/test_multiplex.c index 62b4902a8d..a3b3e2f271 100644 --- a/src/test_multiplex.c +++ b/src/test_multiplex.c @@ -650,7 +650,7 @@ static int multiplexDelete( /* If the main chunk was deleted successfully, also delete any subsequent ** chunks - starting with the last (highest numbered). */ - int nName = strlen(zName); + int nName = (int)strlen(zName); char *z; z = sqlite3_malloc(nName + 5); if( z==0 ){ diff --git a/src/test_onefile.c b/src/test_onefile.c index adc0d13d9f..69867441b8 100644 --- a/src/test_onefile.c +++ b/src/test_onefile.c @@ -606,7 +606,7 @@ static int fsOpen( p->eType = eType; assert(strlen("-journal")==8); - nName = strlen(zName)-((eType==JOURNAL_FILE)?8:0); + nName = (int)strlen(zName)-((eType==JOURNAL_FILE)?8:0); pReal=pFsVfs->pFileList; for(; pReal && strncmp(pReal->zName, zName, nName); pReal=pReal->pNext); @@ -687,7 +687,7 @@ static int fsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){ fs_vfs_t *pFsVfs = (fs_vfs_t *)pVfs; fs_real_file *pReal; sqlite3_file *pF; - int nName = strlen(zPath) - 8; + int nName = (int)strlen(zPath) - 8; assert(strlen("-journal")==8); assert(strcmp("-journal", &zPath[nName])==0); @@ -717,7 +717,7 @@ static int fsAccess( fs_vfs_t *pFsVfs = (fs_vfs_t *)pVfs; fs_real_file *pReal; int isJournal = 0; - int nName = strlen(zPath); + int nName = (int)strlen(zPath); if( flags!=SQLITE_ACCESS_EXISTS ){ sqlite3_vfs *pParent = ((fs_vfs_t *)pVfs)->pParent; diff --git a/src/test_osinst.c b/src/test_osinst.c index 35e168c418..531433313e 100644 --- a/src/test_osinst.c +++ b/src/test_osinst.c @@ -671,7 +671,7 @@ static void vfslog_call( static void vfslog_string(sqlite3_vfs *pVfs, const char *zStr){ VfslogVfs *p = (VfslogVfs *)pVfs; unsigned char *zRec; - int nStr = zStr ? strlen(zStr) : 0; + int nStr = zStr ? (int)strlen(zStr) : 0; if( (4+nStr+p->nBuf)>sizeof(p->aBuf) ){ vfslog_flush(p); } @@ -720,7 +720,7 @@ int sqlite3_vfslog_new( return SQLITE_ERROR; } - nVfs = strlen(zVfs); + nVfs = (int)strlen(zVfs); nByte = sizeof(VfslogVfs) + pParent->szOsFile + nVfs+1+pParent->mxPathname+1; p = (VfslogVfs *)sqlite3_malloc(nByte); memset(p, 0, nByte); diff --git a/src/test_quota.c b/src/test_quota.c index 6514a28a13..87bd1e9183 100644 --- a/src/test_quota.c +++ b/src/test_quota.c @@ -344,7 +344,7 @@ static quotaFile *quotaFindFile( pFile = pFile->pNext; } if( pFile==0 && createFlag ){ - int nName = strlen(zName); + int nName = (int)(strlen(zName) & 0x3fffffff); pFile = (quotaFile *)sqlite3_malloc( sizeof(*pFile) + nName + 1 ); if( pFile ){ memset(pFile, 0, sizeof(*pFile)); @@ -422,7 +422,7 @@ static quotaFile *quotaFindFile( */ static char *quota_utf8_to_mbcs(const char *zUtf8){ #if SQLITE_OS_WIN - int n; /* Bytes in zUtf8 */ + size_t n; /* Bytes in zUtf8 */ int nWide; /* number of UTF-16 characters */ int nMbcs; /* Bytes of MBCS */ LPWSTR zTmpWide; /* The UTF16 text */ @@ -900,7 +900,7 @@ int sqlite3_quota_set( pGroup = pGroup->pNext; } if( pGroup==0 ){ - int nPattern = strlen(zPattern); + int nPattern = (int)(strlen(zPattern) & 0x3fffffff); if( iLimit<=0 ){ quotaLeave(); return SQLITE_OK; @@ -1242,7 +1242,7 @@ sqlite3_int64 sqlite3_quota_file_size(quota_FILE *p){ */ int sqlite3_quota_remove(const char *zFilename){ char *zFull; /* Full pathname for zFilename */ - int nFull; /* Number of bytes in zFilename */ + size_t nFull; /* Number of bytes in zFilename */ int rc; /* Result code */ quotaGroup *pGroup; /* Group containing zFilename */ quotaFile *pFile; /* A file in the group */ @@ -1582,7 +1582,7 @@ static int test_quota_fread( char *zBuf; int sz; int nElem; - int got; + size_t got; if( objc!=4 ){ Tcl_WrongNumArgs(interp, 1, objv, "HANDLE SIZE NELEM"); @@ -1617,7 +1617,7 @@ static int test_quota_fwrite( char *zBuf; int sz; int nElem; - int got; + size_t got; if( objc!=5 ){ Tcl_WrongNumArgs(interp, 1, objv, "HANDLE SIZE NELEM CONTENT"); @@ -1628,7 +1628,7 @@ static int test_quota_fwrite( if( Tcl_GetIntFromObj(interp, objv[3], &nElem) ) return TCL_ERROR; zBuf = Tcl_GetString(objv[4]); got = sqlite3_quota_fwrite(zBuf, sz, nElem, p); - Tcl_SetObjResult(interp, Tcl_NewIntObj(got)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(got)); return TCL_OK; } diff --git a/src/test_vfs.c b/src/test_vfs.c index bab67798cc..d1c34a38e4 100644 --- a/src/test_vfs.c +++ b/src/test_vfs.c @@ -784,7 +784,7 @@ static int tvfsShmOpen(sqlite3_file *pFile){ if( 0==strcmp(pFd->zFilename, pBuffer->zFile) ) break; } if( !pBuffer ){ - int nByte = sizeof(TestvfsBuffer) + strlen(pFd->zFilename) + 1; + int nByte = sizeof(TestvfsBuffer) + (int)strlen(pFd->zFilename) + 1; pBuffer = (TestvfsBuffer *)ckalloc(nByte); memset(pBuffer, 0, nByte); pBuffer->zFile = (char *)&pBuffer[1]; @@ -866,13 +866,13 @@ static int tvfsShmLock( if( p->pScript && p->mask&TESTVFS_SHMLOCK_MASK ){ sqlite3_snprintf(sizeof(zLock), zLock, "%d %d", ofst, n); - nLock = strlen(zLock); + nLock = (int)strlen(zLock); if( flags & SQLITE_SHM_LOCK ){ strcpy(&zLock[nLock], " lock"); }else{ strcpy(&zLock[nLock], " unlock"); } - nLock += strlen(&zLock[nLock]); + nLock += (int)strlen(&zLock[nLock]); if( flags & SQLITE_SHM_SHARED ){ strcpy(&zLock[nLock], " shared"); }else{ @@ -1396,7 +1396,7 @@ static int testvfs_cmd( } zVfs = Tcl_GetString(objv[1]); - nByte = sizeof(Testvfs) + strlen(zVfs)+1; + nByte = sizeof(Testvfs) + (int)strlen(zVfs)+1; p = (Testvfs *)ckalloc(nByte); memset(p, 0, nByte); p->iDevchar = -1;