From 4e2d3d40dcc32a70d3a481bae9a5707fc93237fc Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 1 Apr 2019 03:07:21 +0000 Subject: [PATCH] Fix harmless compiler warnings seen with MSVC. FossilOrigin-Name: 6cf8b18ec20f11c25ff7396f29c742404d3a88d5e97a5fd53ccfaff51dec3f33 --- Makefile.msc | 1 + ext/session/changesetfuzz.c | 23 +++++++++++------------ manifest | 20 ++++++++++---------- manifest.uuid | 2 +- src/btree.c | 2 +- tool/dbtotxt.c | 2 +- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index 07b9cfbc4a..7921c0b68a 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -2560,6 +2560,7 @@ clean: del /Q .target_source 2>NUL del /Q tclsqlite3.exe $(SQLITETCLH) $(SQLITETCLDECLSH) 2>NUL del /Q lsm.dll lsmtest.exe 2>NUL + del /Q atrc.exe changesetfuzz.exe dbtotxt.exe index_usage.exe 2>NUL del /Q testloadext.dll 2>NUL del /Q testfixture.exe test.db 2>NUL del /Q LogEst.exe fts3view.exe rollback-test.exe showdb.exe dbdump.exe 2>NUL diff --git a/ext/session/changesetfuzz.c b/ext/session/changesetfuzz.c index 8cbca80414..bbd72f6d9d 100644 --- a/ext/session/changesetfuzz.c +++ b/ext/session/changesetfuzz.c @@ -154,17 +154,18 @@ static void fuzzReadFile(const char *zFilename, int *pSz, void **ppBuf){ pBuf = sqlite3_malloc64( sz ? sz : 1 ); if( pBuf==0 ){ fprintf(stderr, "cannot allocate %d to hold content of \"%s\"\n", - sz, zFilename); + (int)sz, zFilename); exit(1); } if( sz>0 ){ - if( fread(pBuf, sz, 1, f)!=1 ){ - fprintf(stderr, "cannot read all %d bytes of \"%s\"\n", sz, zFilename); + if( fread(pBuf, (size_t)sz, 1, f)!=1 ){ + fprintf(stderr, "cannot read all %d bytes of \"%s\"\n", + (int)sz, zFilename); exit(1); } fclose(f); } - *pSz = sz; + *pSz = (int)sz; *ppBuf = pBuf; } @@ -343,7 +344,7 @@ struct FuzzChange { static void *fuzzMalloc(sqlite3_int64 nByte){ void *pRet = sqlite3_malloc64(nByte); if( pRet ){ - memset(pRet, 0, nByte); + memset(pRet, 0, (size_t)nByte); } return pRet; } @@ -384,7 +385,7 @@ static int fuzzGetVarint(u8 *p, int *pnVal){ static int fuzzPutVarint(u8 *p, int nVal){ assert( nVal>0 && nVal<2097152 ); if( nVal<128 ){ - p[0] = nVal; + p[0] = (u8)nVal; return 1; } if( nVal<16384 ){ @@ -459,7 +460,7 @@ static int fuzzParseHeader( pGrp->aPK = p; p += pGrp->nCol; pGrp->zTab = (const char*)p; - p = &p[strlen(p)+1]; + p = &p[strlen((const char*)p)+1]; if( p>=pEnd ){ rc = fuzzCorrupt(); @@ -695,8 +696,6 @@ static int fuzzPrintRecord(FuzzChangesetGroup *pGrp, u8 **ppRec, int bPKOnly){ case 0x03: /* text */ case 0x04: { /* blob */ int nTxt; - int sz; - int i; p += fuzzGetVarint(p, &nTxt); printf("%s%s", zPre, eType==0x03 ? "'" : "X'"); for(i=0; iaSub[1] = nByte; + pChange->aSub[1] = (u8)nByte; fuzzRandomBlob(nByte, &pChange->aSub[2]); if( pChange->aSub[0]==0x03 ){ int i; @@ -1004,7 +1003,7 @@ static int fuzzCopyChange( }else if( p==pFuzz->pSub2 ){ pCopy = pFuzz->pSub1; }else if( i==iUndef ){ - pCopy = "\0"; + pCopy = (u8*)"\0"; } if( pCopy[0]==0x00 && eNew!=eType && eType==SQLITE_UPDATE && iRec==0 ){ @@ -1067,7 +1066,7 @@ static int fuzzCopyChange( for(i=0; inCol; i++){ int sz; u8 *pCopy = pCsr; - if( pGrp->aPK[i] ) pCopy = "\0"; + if( pGrp->aPK[i] ) pCopy = (u8*)"\0"; fuzzChangeSize(pCopy, &sz); memcpy(pOut, pCopy, sz); pOut += sz; diff --git a/manifest b/manifest index 5fdfa0eb7a..f7619df53a 100644 --- a/manifest +++ b/manifest @@ -1,11 +1,11 @@ -C Early\sdetection\sof\stoo\smany\scolumns\sin\san\sindex\savoid\sa\spossible\s16-bit\nsigned\sinteger\soverflow. -D 2019-03-31T21:09:33.346 +C Fix\sharmless\scompiler\swarnings\sseen\swith\sMSVC. +D 2019-04-01T03:07:21.080 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F Makefile.in 236d2739dc3e823c3c909bca2d6cef93009bafbefd7018a8f3281074ecb92954 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 -F Makefile.msc fb6dc0c6b09e491b3ad87fed2e1c63ace1b474d4c01091157d63839d376e54c8 +F Makefile.msc 6c2faad38c42216b29ce76d1731802f724d8c64d673309a156d2e3ea65195a76 F README.md 623c225551b176659e443ae9e466e91a2c8ff16157260618295db91aef0800b7 F VERSION 288d756b1b7be03ecdbf1795c23af2c8425f2e46ba6979a14ef53360308f080d F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -402,7 +402,7 @@ F ext/rtree/util/randomshape.tcl 54ee03d0d4a1c621806f7f44d5b78d2db8fac26e0e8687c F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024 F ext/rtree/visual01.txt e9c2564083bcd30ec51b07f881bffbf0e12b50a3f6fced0c222c5c1d2f94ac66 F ext/session/changeset.c 7a1e6a14c7e92d36ca177e92e88b5281acd709f3b726298dc34ec0fb58869cb5 -F ext/session/changesetfuzz.c 01023c41cfb02e191d144ea8bfdc46443393b62d13873f5fa044fc9886e60142 +F ext/session/changesetfuzz.c 227076ab0ae4447d742c01ee88a564da6478bbf26b65108bf8fac9cd8b0b24aa F ext/session/changesetfuzz1.test 2e1b90d888fbf0eea5e1bd2f1e527a48cc85f8e0ff75df1ec4e320b21f580b3a F ext/session/session1.test 0b2f88995832ea040ae8e83a1ad4afa99c00b85c779d213da73a95ea4113233e F ext/session/session2.test 284de45abae4cc1082bc52012ee81521d5ac58e0 @@ -458,7 +458,7 @@ F src/auth.c 0fac71038875693a937e506bceb492c5f136dd7b1249fbd4ae70b4e8da14f9df F src/backup.c 78d3cecfbe28230a3a9a1793e2ead609f469be43e8f486ca996006be551857ab F src/bitvec.c 17ea48eff8ba979f1f5b04cc484c7bb2be632f33 F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6 -F src/btree.c 0799c2764874a0bcd84a17c4848f8faf16cceb3081c4117b88470c84ee0dfcad +F src/btree.c d1261e5ed32d6bb659744866694da507544b46a6cdd565518fd12f34f859f789 F src/btree.h c11446f07ec0e9dc85af8041cb0855c52f5359c8b2a43e47e02a685282504d89 F src/btreeInt.h 6111c15868b90669f79081039d19e7ea8674013f907710baa3c814dc3f8bfd3f F src/build.c cb2cddfbb2a3844e38c3d2232cda6791314d12f7f0abd8ece11ff9370b3d2ef1 @@ -1721,7 +1721,7 @@ F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367 F tool/cg_anno.tcl c1f875f5a4c9caca3d59937b16aff716f8b1883935f1b4c9ae23124705bc8099 x F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2 F tool/dbhash.c a06228aa21ebc4e6ea8daa486601d938499238a5 -F tool/dbtotxt.c 04e25f26be7c7743cdfb4111a8483de0b111925d6afeeb7559ade0ceb73f7f52 +F tool/dbtotxt.c b2221864a20fb391c46bd31bc1fbdc4a96f5c8a89bef58f421eb9b9c36b1702c F tool/dbtotxt.md c9a57af8739957ef36d2cfad5c4b1443ff3688ed33e4901ee200c8b651f43f3c F tool/extract-sqlite3h.tcl 069ceab0cee26cba99952bfa08c0b23e35941c837acabe143f0c355d96c9e2eb x F tool/extract.c 054069d81b095fbdc189a6f5d4466e40380505e2 @@ -1814,7 +1814,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d03b611302f68483770d49b113b4ed685ba03526d2007647c306f8ec7ae697d2 -R 03e19b143fe407c9923b219a08b9f16f -U drh -Z 59892c2a609d0c6fb52021c844100aa4 +P 8af0caeb6d1e55f66ad2f12af94845dccfe1d0420faf326f5917fc07f8aa6050 +R 0ebc92059ac52cf79481c34130a62587 +U mistachkin +Z ab5e758b856a2e9e8e0418f7339f90e0 diff --git a/manifest.uuid b/manifest.uuid index bd25bb6544..a28744ffba 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8af0caeb6d1e55f66ad2f12af94845dccfe1d0420faf326f5917fc07f8aa6050 \ No newline at end of file +6cf8b18ec20f11c25ff7396f29c742404d3a88d5e97a5fd53ccfaff51dec3f33 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index a52db1e2f4..1c63a2f7be 100644 --- a/src/btree.c +++ b/src/btree.c @@ -833,7 +833,7 @@ moveto_done: */ static int btreeRestoreCursorPosition(BtCursor *pCur){ int rc; - int skipNext; + int skipNext = 0; assert( cursorOwnsBtShared(pCur) ); assert( pCur->eState>=CURSOR_REQUIRESEEK ); if( pCur->eState==CURSOR_FAULT ){ diff --git a/tool/dbtotxt.c b/tool/dbtotxt.c index ddc9e34196..8b0600fa51 100644 --- a/tool/dbtotxt.c +++ b/tool/dbtotxt.c @@ -51,7 +51,7 @@ int main(int argc, char **argv){ unsigned char bShow[256]; /* Characters ok to display */ memset(bShow, '.', sizeof(bShow)); for(i=' '; i<='~'; i++){ - if( i!='{' && i!='}' && i!='"' && i!='\\' ) bShow[i] = i; + if( i!='{' && i!='}' && i!='"' && i!='\\' ) bShow[i] = (unsigned char)i; } for(i=1; i