Fix compiler warnings in fts5 code.
FossilOrigin-Name: e9bf275cd969eca6fb41384d3637528d6a19f819
This commit is contained in:
parent
939d4bcd77
commit
8694d6049f
@ -83,7 +83,7 @@ struct Fts5ExprPhrase {
|
||||
Fts5ExprNode *pNode; /* FTS5_STRING node this phrase is part of */
|
||||
Fts5Buffer poslist; /* Current position list */
|
||||
int nTerm; /* Number of entries in aTerm[] */
|
||||
Fts5ExprTerm aTerm[0]; /* Terms that make up this phrase */
|
||||
Fts5ExprTerm aTerm[1]; /* Terms that make up this phrase */
|
||||
};
|
||||
|
||||
/*
|
||||
@ -104,7 +104,7 @@ struct Fts5ExprNearset {
|
||||
int nNear; /* NEAR parameter */
|
||||
Fts5ExprColset *pColset; /* Columns to search (NULL -> all columns) */
|
||||
int nPhrase; /* Number of entries in aPhrase[] array */
|
||||
Fts5ExprPhrase *apPhrase[0]; /* Array of phrase pointers */
|
||||
Fts5ExprPhrase *apPhrase[1]; /* Array of phrase pointers */
|
||||
};
|
||||
|
||||
|
||||
|
@ -66,9 +66,16 @@ struct Fts5HashEntry {
|
||||
int iCol; /* Column of last value written */
|
||||
int iPos; /* Position of last value written */
|
||||
i64 iRowid; /* Rowid of last value written */
|
||||
char zKey[0]; /* Nul-terminated entry key */
|
||||
char zKey[8]; /* Nul-terminated entry key */
|
||||
};
|
||||
|
||||
/*
|
||||
** Size of Fts5HashEntry without the zKey[] array.
|
||||
*/
|
||||
#define FTS5_HASHENTRYSIZE (sizeof(Fts5HashEntry)-8)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** Allocate a new hash table.
|
||||
*/
|
||||
@ -220,7 +227,7 @@ int sqlite3Fts5HashWrite(
|
||||
|
||||
/* If an existing hash entry cannot be found, create a new one. */
|
||||
if( p==0 ){
|
||||
int nByte = sizeof(Fts5HashEntry) + (nToken+1) + 1 + 64;
|
||||
int nByte = FTS5_HASHENTRYSIZE + (nToken+1) + 1 + 64;
|
||||
if( nByte<128 ) nByte = 128;
|
||||
|
||||
if( (pHash->nEntry*2)>=pHash->nSlot ){
|
||||
@ -231,13 +238,13 @@ int sqlite3Fts5HashWrite(
|
||||
|
||||
p = (Fts5HashEntry*)sqlite3_malloc(nByte);
|
||||
if( !p ) return SQLITE_NOMEM;
|
||||
memset(p, 0, sizeof(Fts5HashEntry));
|
||||
memset(p, 0, FTS5_HASHENTRYSIZE);
|
||||
p->nAlloc = nByte;
|
||||
p->zKey[0] = bByte;
|
||||
memcpy(&p->zKey[1], pToken, nToken);
|
||||
assert( iHash==fts5HashKey(pHash->nSlot, p->zKey, nToken+1) );
|
||||
p->zKey[nToken+1] = '\0';
|
||||
p->nData = nToken+1 + 1 + sizeof(Fts5HashEntry);
|
||||
p->nData = nToken+1 + 1 + FTS5_HASHENTRYSIZE;
|
||||
p->nData += sqlite3Fts5PutVarint(&((u8*)p)[p->nData], iRowid);
|
||||
p->iSzPoslist = p->nData;
|
||||
p->nData += 1;
|
||||
@ -417,7 +424,7 @@ int sqlite3Fts5HashQuery(
|
||||
if( p ){
|
||||
fts5HashAddPoslistSize(p);
|
||||
*ppDoclist = (const u8*)&p->zKey[nTerm+1];
|
||||
*pnDoclist = p->nData - (sizeof(*p) + nTerm + 1);
|
||||
*pnDoclist = p->nData - (FTS5_HASHENTRYSIZE + nTerm + 1);
|
||||
}else{
|
||||
*ppDoclist = 0;
|
||||
*pnDoclist = 0;
|
||||
@ -454,7 +461,7 @@ void sqlite3Fts5HashScanEntry(
|
||||
fts5HashAddPoslistSize(p);
|
||||
*pzTerm = p->zKey;
|
||||
*ppDoclist = (const u8*)&p->zKey[nTerm+1];
|
||||
*pnDoclist = p->nData - (sizeof(*p) + nTerm + 1);
|
||||
*pnDoclist = p->nData - (FTS5_HASHENTRYSIZE + nTerm + 1);
|
||||
}else{
|
||||
*pzTerm = 0;
|
||||
*ppDoclist = 0;
|
||||
|
@ -368,7 +368,7 @@ struct Fts5Structure {
|
||||
u64 nWriteCounter; /* Total leaves written to level 0 */
|
||||
int nSegment; /* Total segments in this structure */
|
||||
int nLevel; /* Number of levels in this index */
|
||||
Fts5StructureLevel aLevel[0]; /* Array of nLevel level objects */
|
||||
Fts5StructureLevel aLevel[1]; /* Array of nLevel level objects */
|
||||
};
|
||||
|
||||
/*
|
||||
@ -929,7 +929,7 @@ static int fts5StructureDecode(
|
||||
i += fts5GetVarint32(&pData[i], nSegment);
|
||||
nByte = (
|
||||
sizeof(Fts5Structure) + /* Main structure */
|
||||
sizeof(Fts5StructureLevel) * (nLevel) /* aLevel[] array */
|
||||
sizeof(Fts5StructureLevel) * (nLevel-1) /* aLevel[] array */
|
||||
);
|
||||
pRet = (Fts5Structure*)sqlite3Fts5MallocZero(&rc, nByte);
|
||||
|
||||
@ -3070,7 +3070,7 @@ static void fts5ChunkIterate(
|
||||
** returned in this case.
|
||||
*/
|
||||
static int fts5AllocateSegid(Fts5Index *p, Fts5Structure *pStruct){
|
||||
u32 iSegid = 0;
|
||||
int iSegid = 0;
|
||||
|
||||
if( p->rc==SQLITE_OK ){
|
||||
if( pStruct->nSegment>=FTS5_MAX_SEGMENT ){
|
||||
@ -3079,8 +3079,7 @@ static int fts5AllocateSegid(Fts5Index *p, Fts5Structure *pStruct){
|
||||
while( iSegid==0 ){
|
||||
int iLvl, iSeg;
|
||||
sqlite3_randomness(sizeof(u32), (void*)&iSegid);
|
||||
iSegid = (iSegid % ((1 << FTS5_DATA_ID_B) - 2)) + 1;
|
||||
assert( iSegid>0 && iSegid<=65535 );
|
||||
iSegid = iSegid & ((1 << FTS5_DATA_ID_B)-1);
|
||||
for(iLvl=0; iLvl<pStruct->nLevel; iLvl++){
|
||||
for(iSeg=0; iSeg<pStruct->aLevel[iLvl].nSeg; iSeg++){
|
||||
if( iSegid==pStruct->aLevel[iLvl].aSeg[iSeg].iSegid ){
|
||||
@ -3092,7 +3091,7 @@ static int fts5AllocateSegid(Fts5Index *p, Fts5Structure *pStruct){
|
||||
}
|
||||
}
|
||||
|
||||
return (int)iSegid;
|
||||
return iSegid;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -145,7 +145,7 @@ struct Fts5Sorter {
|
||||
i64 iRowid; /* Current rowid */
|
||||
const u8 *aPoslist; /* Position lists for current row */
|
||||
int nIdx; /* Number of entries in aIdx[] */
|
||||
int aIdx[0]; /* Offsets into aPoslist for current row */
|
||||
int aIdx[1]; /* Offsets into aPoslist for current row */
|
||||
};
|
||||
|
||||
|
||||
@ -808,7 +808,7 @@ static int fts5CursorFirstSorted(Fts5Table *pTab, Fts5Cursor *pCsr, int bDesc){
|
||||
const char *zRankArgs = pCsr->zRankArgs;
|
||||
|
||||
nPhrase = sqlite3Fts5ExprPhraseCount(pCsr->pExpr);
|
||||
nByte = sizeof(Fts5Sorter) + sizeof(int) * nPhrase;
|
||||
nByte = sizeof(Fts5Sorter) + sizeof(int) * (nPhrase-1);
|
||||
pSorter = (Fts5Sorter*)sqlite3_malloc(nByte);
|
||||
if( pSorter==0 ) return SQLITE_NOMEM;
|
||||
memset(pSorter, 0, nByte);
|
||||
|
20
manifest
20
manifest
@ -1,5 +1,5 @@
|
||||
C Fix\sharmless\scompiler\swarnings.
|
||||
D 2015-07-16T18:37:53.565
|
||||
C Fix\scompiler\swarnings\sin\sfts5\scode.
|
||||
D 2015-07-16T20:17:57.553
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 6e8af213d49e6325bf283ebed7662254f8e15bda
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -110,10 +110,10 @@ F ext/fts5/fts5Int.h 8d9bce1847a10df2e4ed9492ea4f3868276748fb
|
||||
F ext/fts5/fts5_aux.c 044cb176a815f4388308738437f6e130aa384fb0
|
||||
F ext/fts5/fts5_buffer.c 80f9ba4431848cb857e3d2158f5280093dcd8015
|
||||
F ext/fts5/fts5_config.c b2456e9625bca41c51d54c363e369c6356895c90
|
||||
F ext/fts5/fts5_expr.c d2e148345639c5a5583e0daa39a639bf298ae6a7
|
||||
F ext/fts5/fts5_hash.c 219f4edd72e5cf95b19c33f1058809a18fad5229
|
||||
F ext/fts5/fts5_index.c cfd41d49591e4e4ce2a5f84de35512f59fbb360d
|
||||
F ext/fts5/fts5_main.c 8f279999deb204b0c7760464f60f88666046398b
|
||||
F ext/fts5/fts5_expr.c ac0614f843cf5c80a85c4c6aa44bbede62a51bb2
|
||||
F ext/fts5/fts5_hash.c ff07722c73587c12781213133edbdb22cd156378
|
||||
F ext/fts5/fts5_index.c d6ad9293280f39c56343ef5035b0475ff2a6be12
|
||||
F ext/fts5/fts5_main.c 0de7ba81488d2c502c8e794eaf7983d468e4c6e9
|
||||
F ext/fts5/fts5_storage.c 1c35a38a564ee9cadcbd7ae0b13a806bdda722bd
|
||||
F ext/fts5/fts5_tcl.c 85eb4e0d0fefa9420b78151496ad4599a1783e20
|
||||
F ext/fts5/fts5_tokenize.c 30f97a8c74683797b4cd233790444fbefb3b0708
|
||||
@ -1365,7 +1365,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 b79a4affe44bd0c8e155cae19f3f62c715684cd6
|
||||
R 46ffb58e9bbf5b7d344569559372c137
|
||||
U drh
|
||||
Z fc33a5797b3dc2992ffe746880c5611b
|
||||
P 9a592cf91c74b369bacf6a0e69d45f3e73dfdbce
|
||||
R 7a5b6f6204af419d579789c3ece1729c
|
||||
U dan
|
||||
Z a4633be21e523e4e841d0095eaa70845
|
||||
|
@ -1 +1 @@
|
||||
9a592cf91c74b369bacf6a0e69d45f3e73dfdbce
|
||||
e9bf275cd969eca6fb41384d3637528d6a19f819
|
Loading…
Reference in New Issue
Block a user