1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-10-28 10:57:26 +03:00

Fix harmless compiler warnings in the zonefile extension seen with MSVC.

FossilOrigin-Name: d28003941ceca7fb707fcdb09bf8b00a6c1b728956e018d7ecfb6852d7dd469b
This commit is contained in:
mistachkin
2018-02-23 14:00:38 +00:00
parent 241676abcc
commit 7f837b66fa
4 changed files with 24 additions and 23 deletions

View File

@@ -1494,6 +1494,7 @@ TESTEXT = \
$(TOP)\ext\misc\eval.c \
$(TOP)\ext\misc\fileio.c \
$(TOP)\ext\misc\fuzzer.c \
$(TOP)\ext\zonefile\zonefile.c \
$(TOP)\ext\fts5\fts5_tcl.c \
$(TOP)\ext\fts5\fts5_test_mi.c \
$(TOP)\ext\fts5\fts5_test_tok.c \

View File

@@ -1002,11 +1002,11 @@ static void zonefileAppendBlob(ZonefileBuffer *pBuf, const u8 *p, int n){
static int zonefileFileWrite(FILE *pFd, const u8 *aBuf, int nBuf){
size_t res = fwrite(aBuf, 1, nBuf, pFd);
return res!=nBuf ? SQLITE_ERROR : SQLITE_OK;
return res!=(size_t)nBuf ? SQLITE_ERROR : SQLITE_OK;
}
static int zonefileFileRead(FILE *pFd, u8 *aBuf, int nBuf, i64 iOff){
int rc = fseek(pFd, iOff, SEEK_SET);
int rc = fseek(pFd, (long)iOff, SEEK_SET);
if( rc==0 ){
rc = fread(aBuf, 1, nBuf, pFd);
rc = (rc==nBuf) ? SQLITE_OK : SQLITE_ERROR;
@@ -1076,7 +1076,7 @@ static int zonefilePad(FILE *pFd, int nByte){
assert( nByte>=0 && nByte<256 );
if( nByte ){
int nRem = nByte;
u8 buf[16] = "0123456789ABCDEF";
u8 buf[17] = "0123456789ABCDEF";
while( nRem>0 ){
int n = MIN(nRem, sizeof(buf));
if( zonefileFileWrite(pFd, buf, n) ) return SQLITE_ERROR;
@@ -1102,7 +1102,7 @@ static void zonefileWriteFunc(
int nFrame = 0; /* Number of frames in new zonefile */
sqlite3_stmt *pStmt = 0; /* SQL used to read data from source table */
FILE *pFd = 0;
int rc;
int rc = SQLITE_OK;
sqlite3_value *pPrev = 0;
char *zErr = 0;
void *pCmp = 0; /* Data compressor handle */
@@ -1295,17 +1295,17 @@ static void zonefileWriteFunc(
/* Create the zonefile header in the in-memory buffer */
memset(aHdr, 0, ZONEFILE_SZ_HEADER);
zonefilePut32(&aHdr[0], ZONEFILE_MAGIC_NUMBER);
aHdr[4] = sParam.pCmpIdx->eType;
aHdr[5] = sParam.pCmpData->eType;
aHdr[4] = (u8)sParam.pCmpIdx->eType;
aHdr[5] = (u8)sParam.pCmpData->eType;
iOff = ZONEFILE_SZ_HEADER + sFrameIdx.n + sKeyIdx.n;
zonefilePut32(&aHdr[6], sDict.n ? iOff+sParam.debugExtendedHeaderSize : 0);
zonefilePut32(&aHdr[10], iOff + sParam.debugExtendedHeaderSize + sDict.n);
zonefilePut32(&aHdr[14], nFrame);
zonefilePut32(&aHdr[18], nKey);
aHdr[22] = sParam.encryptionType;
aHdr[22] = (u8)sParam.encryptionType;
aHdr[23] = 0; /* Encryption key index */
aHdr[24] = 0; /* extended header version */
aHdr[25] = sParam.debugExtendedHeaderSize;
aHdr[25] = (u8)sParam.debugExtendedHeaderSize;
assert( ZONEFILE_SZ_HEADER>=26 );
rc = zonefileFileWrite(pFd, aHdr, ZONEFILE_SZ_HEADER);
@@ -1554,7 +1554,7 @@ static void zonefileJsonHeader(sqlite3_context *pCtx, const char *zFile){
FILE *pFd = zonefileFileOpen(zFile, 0, &zErr);
if( pFd ){
int rc;
ZonefileHeader hdr;
ZonefileHeader hdr = { 0 };
u8 aBuf[ZONEFILE_SZ_HEADER];
rc = zonefileFileRead(pFd, aBuf, ZONEFILE_SZ_HEADER, 0);
@@ -1767,7 +1767,7 @@ static int zonefilePopulateIndex(
const char *zFile,
i64 iFileid
){
ZonefileHeader hdr;
ZonefileHeader hdr = { 0 };
int rc;
FILE *pFd = zonefileFileOpen(zFile, 0, &pTab->base.zErrMsg);
@@ -1792,7 +1792,7 @@ static int zonefilePopulateIndex(
);
}
for(i=0; i<hdr.numKeys && rc==SQLITE_OK; i++){
for(i=0; (u32)i<hdr.numKeys && rc==SQLITE_OK; i++){
u8 *aEntry = &aKey[4*hdr.numFrames + ZONEFILE_SZ_KEYOFFSETS_ENTRY * i];
int iFrame = zonefileGet32(&aEntry[8]);
i64 iFrameOff = 0; /* Offset of frame */
@@ -1803,7 +1803,7 @@ static int zonefilePopulateIndex(
szFrame = zonefileGet32(&aKey[iFrame*4]);
if( iFrame>0 ){
iFrameOff = zonefileGet32(&aKey[(iFrame-1)*4]);
szFrame -= iFrameOff;
szFrame -= (int)iFrameOff;
}
iFrameOff += hdr.byteOffsetFrames;
iOff = (i64)zonefileGet32(&aEntry[12]);
@@ -2537,7 +2537,7 @@ static int zonefileValueReadCache(sqlite3_context *pCtx, ZonefileCsr *pCsr){
i64 iFile = sqlite3_column_int64(pCsr->pSelect, 1);
i64 iFrameOff = sqlite3_column_int64(pCsr->pSelect, 2);
i64 iKeyOff = sqlite3_column_int64(pCsr->pSelect, 4);
int nKeySz = sqlite3_column_int64(pCsr->pSelect, 5);
int nKeySz = sqlite3_column_int(pCsr->pSelect, 5);
/* Check if this frame is already in the cache. If not, read it from
** the file. */
@@ -2546,7 +2546,7 @@ static int zonefileValueReadCache(sqlite3_context *pCtx, ZonefileCsr *pCsr){
const char *zFile = 0;
char *zErr = 0;
FILE *pFd = 0;
ZonefileHeader hdr;
ZonefileHeader hdr = { 0 };
ZonefileCompress *pCmpMethod = 0;
ZonefileCodec *pCodec = 0;
void *pCmp = 0;

View File

@@ -1,10 +1,10 @@
C Avoid\srunning\sa\stest\scase\sthat\srequires\szstd\sin\snon-SQLITE_HAVE_ZSTD\sbuilds.
D 2018-02-23T13:58:17.194
C Fix\sharmless\scompiler\swarnings\sin\sthe\szonefile\sextension\sseen\swith\sMSVC.
D 2018-02-23T14:00:38.536
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in a2d2fb8d17c39ab5ec52beb27850b903949080848236923f436156b72a958737
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc bf19d3a0eb849bd3b114653b0e455aa5b2799a96f413287a5866013db0e47f30
F Makefile.msc 738b130a37c8855f46c519cdeab968a483042017b8e90a04a8156e26d6a3769d
F README.md 1d5342ebda97420f114283e604e5fe99b0da939d63b76d492eabbaae23488276
F VERSION cdf91ac446255ecf3d8f6d8c3ee40d64123235ae5b3cef29d344e61b45ec3759
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
@@ -409,7 +409,7 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
F ext/userauth/userauth.c 3410be31283abba70255d71fd24734e017a4497f
F ext/zonefile/README.md df86ef5b4f9aa8b07e1c8124b3f2dcea616927385aad59d525b784f0a06d446c
F ext/zonefile/zonefile.c f43dd41bd121ce8ab4f46ba3c8136e674df88ec2eb7ccc1c974e8e8b5aaa6e99
F ext/zonefile/zonefile.c 4cab22c4b43499099f2ff3bdb0292f9bdf0dfd077948c4ed9a6479532011d2ae
F ext/zonefile/zonefile1.test d80e8fd9db0b4b942628d00136ee448ce5b1b5e09f4b85a25aef500b888d62e9
F ext/zonefile/zonefileenc.test f23e16fc8810c95588dfd528af8e4332f0d1d13370fdd7163226ec886715058e
F ext/zonefile/zonefilefault.test 7f93ba8420d6f6a461d2fbbce30a04f744764f584c0c17361a867db8088f5595
@@ -1712,7 +1712,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 53f2100a296f64d206f1caf2d754820a7898bb33b31a6ab2169957d228d5d2a0
R 0e212e0e9239ba8677898e0760493590
U dan
Z c33750ba5a66f2c197371c0a690fad0a
P d716dff4441b4d28e0184ce06508bc9122451103ead8edbfbf3c87b666445ee6
R 712509a970c46f53beac46f7a0038889
U mistachkin
Z 2cb656811a0799bf4622d31d9206483b

View File

@@ -1 +1 @@
d716dff4441b4d28e0184ce06508bc9122451103ead8edbfbf3c87b666445ee6
d28003941ceca7fb707fcdb09bf8b00a6c1b728956e018d7ecfb6852d7dd469b