for(i=1, j=0; z[i]; i++){
if( z[i]==quote ){
if( z[i+1]==quote ){
- z[j++] = quote;
+ z[j++] = (char)quote;
i++;
}else{
z[j++] = 0;
const char *zTokenizer = 0; /* Name of tokenizer to use */
sqlite3_tokenizer *pTokenizer = 0; /* Tokenizer for this table */
- nDb = strlen(argv[1]) + 1;
- nName = strlen(argv[2]) + 1;
+ nDb = (int)strlen(argv[1]) + 1;
+ nName = (int)strlen(argv[2]) + 1;
for(i=3; i<argc; i++){
char const *z = argv[i];
rc = sqlite3Fts3InitTokenizer(pHash, z, &pTokenizer, &zTokenizer, pzErr);
return rc;
}
if( z!=zTokenizer ){
- nString += strlen(z) + 1;
+ nString += (int)(strlen(z) + 1);
}
}
nCol = argc - 3 - (zTokenizer!=0);
static int fts3OpenMethod(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCsr){
sqlite3_vtab_cursor *pCsr; /* Allocated cursor */
+ UNUSED_PARAMETER(pVTab);
+
/* Allocate a buffer large enough for an Fts3Cursor structure. If the
** allocation succeeds, zero it and return SQLITE_OK. Otherwise,
** if the allocation fails, return SQLITE_NOMEM.
while( *pEnd | c ) c = *pEnd++ & 0x80;
pEnd++;
if( pp ){
- int n = pEnd - *ppPoslist;
+ int n = (int)(pEnd - *ppPoslist);
char *p = *pp;
memcpy(p, *ppPoslist, n);
p += n;
char c = 0;
while( 0xFE & (*pEnd | c) ) c = *pEnd++ & 0x80;
if( pp ){
- int n = pEnd - *ppPoslist;
+ int n = (int)(pEnd - *ppPoslist);
char *p = *pp;
memcpy(p, *ppPoslist, n);
p += n;
assert(!"Invalid mergetype value passed to fts3DoclistMerge()");
}
- *pnBuffer = (p-aBuffer);
+ *pnBuffer = (int)(p-aBuffer);
return SQLITE_OK;
}
int nNew = pTS->nOutput + nDoclist;
char *aNew = sqlite3_malloc(nNew);
+ UNUSED_PARAMETER(p);
+ UNUSED_PARAMETER(zTerm);
+ UNUSED_PARAMETER(nTerm);
+
if( !aNew ){
return SQLITE_NOMEM;
}
Fts3Table *p = (Fts3Table *)pCursor->pVtab;
Fts3Cursor *pCsr = (Fts3Cursor *)pCursor;
+ UNUSED_PARAMETER(idxStr);
+ UNUSED_PARAMETER(nVal);
+
assert( idxNum>=0 && idxNum<=(FTS3_FULLTEXT_SEARCH+p->nColumn) );
assert( nVal==0 || nVal==1 );
assert( (nVal==0)==(idxNum==FTS3_FULLSCAN_SEARCH) );
sqlite3_free(zSql);
}
if( rc!=SQLITE_OK ) return rc;
- pCsr->eSearch = idxNum;
+ pCsr->eSearch = (i16)idxNum;
if( idxNum==FTS3_DOCID_SEARCH ){
rc = sqlite3_bind_value(pCsr->pStmt, 1, apVal[0]);
** Implementation of xBegin() method. This is a no-op.
*/
static int fts3BeginMethod(sqlite3_vtab *pVtab){
+ UNUSED_PARAMETER(pVtab);
assert( ((Fts3Table *)pVtab)->nPendingData==0 );
return SQLITE_OK;
}
** by fts3SyncMethod().
*/
static int fts3CommitMethod(sqlite3_vtab *pVtab){
+ UNUSED_PARAMETER(pVtab);
assert( ((Fts3Table *)pVtab)->nPendingData==0 );
return SQLITE_OK;
}
){
Fts3Cursor *pCsr; /* Cursor handle passed through apVal[0] */
+ UNUSED_PARAMETER(nVal);
+
assert( nVal==1 );
if( fts3FunctionArg(pContext, "offsets", apVal[0], &pCsr) ) return;
assert( pCsr );
Fts3Table *p; /* Virtual table handle */
Fts3Cursor *pCursor; /* Cursor handle passed through apVal[0] */
+ UNUSED_PARAMETER(nVal);
+
assert( nVal==1 );
if( fts3FunctionArg(pContext, "optimize", apVal[0], &pCursor) ) return;
p = (Fts3Table *)pCursor->base.pVtab;
{ "optimize", fts3OptimizeFunc },
};
int i; /* Iterator variable */
+
+ UNUSED_PARAMETER(pVtab);
+ UNUSED_PARAMETER(nArg);
+ UNUSED_PARAMETER(ppArg);
+
for(i=0; i<SizeofArray(aOverload); i++){
if( strcmp(zName, aOverload[i].zName)==0 ){
*pxFunc = aOverload[i].xFunc;
*/
#define FTS3_VARINT_MAX 10
+/*
+** This section provides definitions to allow the
+** FTS3 extension to be compiled outside of the
+** amalgamation.
+*/
+#ifndef SQLITE_AMALGAMATION
/*
** Macros indicating that conditional expressions are always true or
** false.
*/
-#ifndef SQLITE_AMALGAMATION
# define ALWAYS(x) (x)
# define NEVER(X) (x)
+/*
+** Internal types used by SQLite.
+*/
typedef unsigned char u8; /* 1-byte (or larger) unsigned integer */
typedef short int i16; /* 2-byte (or larger) signed integer */
+/*
+** Macro used to suppress compiler warnings for unused parameters.
+*/
+#define UNUSED_PARAMETER(x) (void)(x)
#endif
typedef struct Fts3Table Fts3Table;
if( rc==SQLITE_DONE ){
int jj;
- char *zNew;
+ char *zNew = NULL;
int nNew = 0;
int nByte = sizeof(Fts3Expr) + sizeof(Fts3Phrase);
nByte += (p?(p->pPhrase->nToken-1):0) * sizeof(struct PhraseToken);
int *pnConsumed /* OUT: Number of bytes consumed */
){
static const struct Fts3Keyword {
- char z[4]; /* Keyword text */
+ char *z; /* Keyword text */
unsigned char n; /* Length of the keyword */
unsigned char parenOnly; /* Only valid in paren mode */
unsigned char eType; /* Keyword code */
pRet->eType = pKey->eType;
pRet->nNear = nNear;
*ppExpr = pRet;
- *pnConsumed = (zInput - z) + nKey;
+ *pnConsumed = (int)((zInput - z) + nKey);
return SQLITE_OK;
}
if( rc==SQLITE_OK && !*ppExpr ){
rc = SQLITE_DONE;
}
- *pnConsumed = (zInput - z) + 1 + nConsumed;
+ *pnConsumed = (int)((zInput - z) + 1 + nConsumed);
return rc;
}
/* Check for a close bracket. */
if( *zInput==')' ){
pParse->nNest--;
- *pnConsumed = (zInput - z) + 1;
+ *pnConsumed = (int)((zInput - z) + 1);
return SQLITE_DONE;
}
}
*/
if( *zInput=='"' ){
for(ii=1; ii<nInput && zInput[ii]!='"'; ii++);
- *pnConsumed = (zInput - z) + ii + 1;
+ *pnConsumed = (int)((zInput - z) + ii + 1);
if( ii==nInput ){
return SQLITE_ERROR;
}
iColLen = 0;
for(ii=0; ii<pParse->nCol; ii++){
const char *zStr = pParse->azCol[ii];
- int nStr = strlen(zStr);
+ int nStr = (int)strlen(zStr);
if( nInput>nStr && zInput[nStr]==':'
&& sqlite3_strnicmp(zStr, zInput, nStr)==0
){
iCol = ii;
- iColLen = ((zInput - z) + nStr + 1);
+ iColLen = (int)((zInput - z) + nStr + 1);
break;
}
}
return SQLITE_OK;
}
if( n<0 ){
- n = strlen(z);
+ n = (int)strlen(z);
}
rc = fts3ExprParse(&sParse, z, n, ppExpr, &nParsed);
sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC);
if( SQLITE_ROW==sqlite3_step(pStmt) ){
if( sqlite3_column_type(pStmt, 0)==SQLITE_BLOB ){
- memcpy(pp, sqlite3_column_blob(pStmt, 0), sizeof(*pp));
+ memcpy((void *)pp, sqlite3_column_blob(pStmt, 0), sizeof(*pp));
}
}
** true if the hash table should make its own private copy of keys and
** false if it should just use the supplied pointer.
*/
-void sqlite3Fts3HashInit(Fts3Hash *pNew, int keyClass, int copyKey){
+void sqlite3Fts3HashInit(Fts3Hash *pNew, char keyClass, char copyKey){
assert( pNew!=0 );
assert( keyClass>=FTS3_HASH_STRING && keyClass<=FTS3_HASH_BINARY );
pNew->keyClass = keyClass;
/*
** Access routines. To delete, insert a NULL pointer.
*/
-void sqlite3Fts3HashInit(Fts3Hash*, int keytype, int copyKey);
+void sqlite3Fts3HashInit(Fts3Hash *pNew, char keyClass, char copyKey);
void *sqlite3Fts3HashInsert(Fts3Hash*, const void *pKey, int nKey, void *pData);
void *sqlite3Fts3HashFind(const Fts3Hash*, const void *pKey, int nKey);
void sqlite3Fts3HashClear(Fts3Hash*);
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
+#include "fts3Int.h"
#include <assert.h>
#include <stdlib.h>
} porter_tokenizer_cursor;
-/* Forward declaration */
-static const sqlite3_tokenizer_module porterTokenizerModule;
-
-
/*
** Create a new tokenizer instance.
*/
sqlite3_tokenizer **ppTokenizer
){
porter_tokenizer *t;
+
+ UNUSED_PARAMETER(argc);
+ UNUSED_PARAMETER(argv);
+
t = (porter_tokenizer *) sqlite3_malloc(sizeof(*t));
if( t==NULL ) return SQLITE_NOMEM;
memset(t, 0, sizeof(*t));
){
porter_tokenizer_cursor *c;
+ UNUSED_PARAMETER(pTokenizer);
+
c = (porter_tokenizer_cursor *) sqlite3_malloc(sizeof(*c));
if( c==NULL ) return SQLITE_NOMEM;
int i, mx, j;
int hasDigit = 0;
for(i=0; i<nIn; i++){
- int c = zIn[i];
+ char c = zIn[i];
if( c>='A' && c<='Z' ){
zOut[i] = c - 'A' + 'a';
}else{
** no chance of overflowing the zOut buffer.
*/
static void porter_stemmer(const char *zIn, int nIn, char *zOut, int *pnOut){
- int i, j, c;
+ int i, j;
char zReverse[28];
char *z, *z2;
if( nIn<3 || nIn>=sizeof(zReverse)-7 ){
return;
}
for(i=0, j=sizeof(zReverse)-6; i<nIn; i++, j--){
- c = zIn[i];
+ char c = zIn[i];
if( c>='A' && c<='Z' ){
zReverse[j] = c + 'a' - 'A';
}else if( c>='a' && c<='z' ){
/* z[] is now the stemmed word in reverse order. Flip it back
** around into forward order and return.
*/
- *pnOut = i = strlen(z);
+ *pnOut = i = (int)strlen(z);
zOut[i] = 0;
while( *z ){
zOut[--i] = *(z++);
*/
static void fts3SnippetAppend(StringBuffer *p, const char *zNew, int nNew){
if( p->z==0 ) return;
- if( nNew<0 ) nNew = strlen(zNew);
+ if( nNew<0 ) nNew = (int)strlen(zNew);
if( p->nUsed + nNew >= p->nAlloc ){
int nAlloc;
char *zNew;
}
i = p->nMatch++;
pMatch = &p->aMatch[i];
- pMatch->iCol = iCol;
- pMatch->iTerm = iTerm;
+ pMatch->iCol = (short)iCol;
+ pMatch->iTerm = (short)iTerm;
pMatch->iToken = iToken;
pMatch->iStart = iStart;
- pMatch->nByte = nByte;
+ pMatch->nByte = (short)nByte;
return SQLITE_OK;
}
}
}
- *pn = (z2-z1);
+ *pn = (int)(z2-z1);
return z1;
}
z[n] = '\0';
sqlite3Fts3Dequote(z);
- m = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash, z, strlen(z)+1);
+ m = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash, z, (int)strlen(z)+1);
if( !m ){
*pzErr = sqlite3_mprintf("unknown tokenizer: %s", z);
rc = SQLITE_ERROR;
char const **aArg = 0;
int iArg = 0;
z = &z[n+1];
- while( z<zEnd && (z = (char *)sqlite3Fts3NextToken(z, &n)) ){
+ while( z<zEnd && (NULL!=(z = (char *)sqlite3Fts3NextToken(z, &n))) ){
int nNew = sizeof(char *)*(iArg+1);
- char const **aNew = (const char **)sqlite3_realloc(aArg, nNew);
+ char const **aNew = (const char **)sqlite3_realloc((void *)aArg, nNew);
if( !aNew ){
sqlite3_free(zCopy);
- sqlite3_free(aArg);
+ sqlite3_free((void *)aArg);
return SQLITE_NOMEM;
}
aArg = aNew;
}else{
(*ppTok)->pModule = m;
}
- sqlite3_free(aArg);
+ sqlite3_free((void *)aArg);
}
sqlite3_free(zCopy);
sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC);
if( SQLITE_ROW==sqlite3_step(pStmt) ){
if( sqlite3_column_type(pStmt, 0)==SQLITE_BLOB ){
- memcpy(pp, sqlite3_column_blob(pStmt, 0), sizeof(*pp));
+ memcpy((void *)pp, sqlite3_column_blob(pStmt, 0), sizeof(*pp));
}
}
const sqlite3_tokenizer_module *p2;
sqlite3 *db = (sqlite3 *)sqlite3_user_data(context);
+ UNUSED_PARAMETER(argc);
+ UNUSED_PARAMETER(argv);
+
/* Test the query function */
sqlite3Fts3SimpleTokenizerModule(&p1);
rc = queryTokenizer(db, "simple", &p2);
}
#endif
- if( rc!=SQLITE_OK
- || (rc = sqlite3_create_function(db, zName, 1, any, p, scalarFunc, 0, 0))
- || (rc = sqlite3_create_function(db, zName, 2, any, p, scalarFunc, 0, 0))
+ if( SQLITE_OK!=rc
+ || SQLITE_OK!=(rc = sqlite3_create_function(db, zName, 1, any, p, scalarFunc, 0, 0))
+ || SQLITE_OK!=(rc = sqlite3_create_function(db, zName, 2, any, p, scalarFunc, 0, 0))
#ifdef SQLITE_TEST
- || (rc = sqlite3_create_function(db, zTest, 2, any, p, testFunc, 0, 0))
- || (rc = sqlite3_create_function(db, zTest, 3, any, p, testFunc, 0, 0))
- || (rc = sqlite3_create_function(db, zTest2, 0, any, pdb, intTestFunc, 0, 0))
+ || SQLITE_OK!=(rc = sqlite3_create_function(db, zTest, 2, any, p, testFunc, 0, 0))
+ || SQLITE_OK!=(rc = sqlite3_create_function(db, zTest, 3, any, p, testFunc, 0, 0))
+ || SQLITE_OK!=(rc = sqlite3_create_function(db, zTest2, 0, any, pdb, intTestFunc, 0, 0))
#endif
);
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
+#include "fts3Int.h"
#include <assert.h>
#include <stdlib.h>
} simple_tokenizer_cursor;
-/* Forward declaration */
-static const sqlite3_tokenizer_module simpleTokenizerModule;
-
static int simpleDelim(simple_tokenizer *t, unsigned char c){
return c<0x80 && t->delim[c];
}
** information on the initial create.
*/
if( argc>1 ){
- int i, n = strlen(argv[1]);
+ int i, n = (int)strlen(argv[1]);
for(i=0; i<n; i++){
unsigned char ch = argv[1][i];
/* We explicitly don't support UTF-8 delimiters for now. */
/* Mark non-alphanumeric ASCII characters as delimiters */
int i;
for(i=1; i<0x80; i++){
- t->delim[i] = !isalnum(i);
+ t->delim[i] = !isalnum(i) ? -1 : 0;
}
}
){
simple_tokenizer_cursor *c;
+ UNUSED_PARAMETER(pTokenizer);
+
c = (simple_tokenizer_cursor *) sqlite3_malloc(sizeof(*c));
if( c==NULL ) return SQLITE_NOMEM;
** case-insensitivity.
*/
unsigned char ch = p[iStartOffset+i];
- c->pToken[i] = ch<0x80 ? tolower(ch) : ch;
+ c->pToken[i] = (char)(ch<0x80 ? tolower(ch) : ch);
}
*ppToken = c->pToken;
*pnBytes = n;
static int fts3AllocateSegdirIdx(Fts3Table *p, int iLevel, int *piIdx){
int rc; /* Return Code */
sqlite3_stmt *pNextIdx; /* Query for next idx at level iLevel */
- int iNext; /* Result of query pNextIdx */
+ int iNext = 0; /* Result of query pNextIdx */
/* Set variable iNext to the next available segdir index at level iLevel. */
rc = fts3SqlStmt(p, SQL_NEXT_SEGMENT_INDEX, &pNextIdx, 0);
if( rc==SQLITE_OK ){
sqlite3_bind_int(pNextIdx, 1, iLevel);
if( SQLITE_ROW==sqlite3_step(pNextIdx) ){
- iNext = sqlite3_column_int64(pNextIdx, 0);
+ iNext = sqlite3_column_int(pNextIdx, 0);
}
rc = sqlite3_reset(pNextIdx);
}
*/
if( ppOffsetList ){
*ppOffsetList = pReader->pOffsetList;
- *pnOffsetList = p - pReader->pOffsetList - 1;
+ *pnOffsetList = (int)(p - pReader->pOffsetList - 1);
}
/* If there are no more entries in the doclist, set pOffsetList to
int nNext /* Size of buffer zNext in bytes */
){
int n;
+ UNUSED_PARAMETER(nNext);
for(n=0; n<nPrev && zPrev[n]==zNext[n]; n++);
return n;
}
){
int rc; /* Return code */
if( pWriter->pTree ){
- sqlite3_int64 iLast; /* Largest block id written to database */
+ sqlite3_int64 iLast = 0; /* Largest block id written to database */
sqlite3_int64 iLastLeaf; /* Largest leaf block id written to db */
- char *zRoot; /* Pointer to buffer containing root node */
- int nRoot; /* Size of buffer zRoot */
+ char *zRoot = NULL; /* Pointer to buffer containing root node */
+ int nRoot = 0; /* Size of buffer zRoot */
iLastLeaf = pWriter->iFree;
rc = fts3WriteSegment(p, pWriter->iFree++, pWriter->aData, pWriter->nData);
while( p<pEnd && (c | *p)&0xFE ) c = *p++ & 0x80;
if( iCol==iCurrent ){
- nList = (p - pList);
+ nList = (int)(p - pList);
break;
}
- nList -= (p - pList);
+ nList -= (int)(p - pList);
pList = p;
if( nList==0 ){
break;
Fts3Table *p = (Fts3Table *)pVtab;
int rc = SQLITE_OK; /* Return Code */
int isRemove = 0; /* True for an UPDATE or DELETE */
- sqlite3_int64 iRemove; /* Rowid removed by UPDATE or DELETE */
+ sqlite3_int64 iRemove = 0; /* Rowid removed by UPDATE or DELETE */
/* If this is a DELETE or UPDATE operation, remove the old record. */
if( sqlite3_value_type(apVal[0])!=SQLITE_NULL ){
-C Fix\sa\scouple\sof\scompiler\swarnings\sunder\sMSVC.
-D 2009-12-03T04:40:48
+C Updates\sto\sFTS3\sto\scorrect\scompiler\swarnings\sunder\sMSVC.
+D 2009-12-03T06:26:46
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
F ext/fts3/README.tokenizers 998756696647400de63d5ba60e9655036cb966e9
F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
-F ext/fts3/fts3.c eca3828c5ef6efd4297c8b917d69ec11b9d223a9
+F ext/fts3/fts3.c 8352dc3506c3b30fde126ea5da9c431d3c243522
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
-F ext/fts3/fts3Int.h 7bc65d9ada6715ecd11ed83513013d4c7bbc2eeb
-F ext/fts3/fts3_expr.c bdf11f3602f62f36f0e42823680bf22033dae0de
-F ext/fts3/fts3_hash.c 29fba5a01e51c53e37040e53821e6b2cec18c8fb
-F ext/fts3/fts3_hash.h 39524725425078bf9e814e9569c74a8e5a21b9fb
+F ext/fts3/fts3Int.h 515132f0ae6b35eccbeef72a2bafb16d7e251953
+F ext/fts3/fts3_expr.c c18794a62c257d3456d3314c5a18e348ae0d84bd
+F ext/fts3/fts3_hash.c 18feef38fca216992725e9eae775a0c7735e6724
+F ext/fts3/fts3_hash.h d410ff2c93c81a56b927fcf07b2099ccbfa7a479
F ext/fts3/fts3_icu.c ac494aed69835008185299315403044664bda295
-F ext/fts3/fts3_porter.c 4248815484f9c7e9d4f3c72c1149464485c08abe
-F ext/fts3/fts3_snippet.c 84ba2fad73aa12628f1950aed74babbf3975e73a
-F ext/fts3/fts3_tokenizer.c 17335e980994e112c5d332d5bc391f9089350761
+F ext/fts3/fts3_porter.c a651e287e02b49b565a6ccf9441959d434489156
+F ext/fts3/fts3_snippet.c 6c2eb6d872d66b2a9aa5663f2662e993f18a6496
+F ext/fts3/fts3_tokenizer.c 73a4e0e068720153901622f215298b73e7c976c7
F ext/fts3/fts3_tokenizer.h 7ff73caa3327589bf6550f60d93ebdd1f6a0fb5c
-F ext/fts3/fts3_tokenizer1.c 0a5bcc579f35de5d24a9345d7908dc25ae403ee7
-F ext/fts3/fts3_write.c 5d3849443746f41ea4af96dac08d79f2bf75f204
+F ext/fts3/fts3_tokenizer1.c 11a604a53cff5e8c28882727bf794e5252e5227b
+F ext/fts3/fts3_write.c 6c59b1d6eed759815151298c132d79301c205fce
F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100
F ext/icu/README.txt 3b130aa66e7a681136f6add198b076a2f90d1e33
F ext/icu/icu.c 12e763d288d23b5a49de37caa30737b971a2f1e2
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 59e2e2c6301e189a1a6601c681bbb0937a5cd14e
-R 4cd225486b10b23f8eba14d67e73bbe4
+P e3aa0870fce0666bf8c67ad6ec23e135d03b604a
+R 8d9ad89e2fac8a1d1d94a1d048213789
U shaneh
-Z ef9e7d1e0537cf470262f7210a98337f
+Z 7667ec8a886e15725b2ab6f5b341cdfd
-e3aa0870fce0666bf8c67ad6ec23e135d03b604a
\ No newline at end of file
+37495b55ffbdc2db4482367ac7d8e32d4d71d58e
\ No newline at end of file