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 */
};
/*
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 */
};
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.
*/
/* 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 ){
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;
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;
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;
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 */
};
/*
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);
** 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 ){
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 ){
}
}
- return (int)iSegid;
+ return iSegid;
}
/*
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 */
};
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);
-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
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
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
-9a592cf91c74b369bacf6a0e69d45f3e73dfdbce
\ No newline at end of file
+e9bf275cd969eca6fb41384d3637528d6a19f819
\ No newline at end of file