1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Updates to FTS3 to correct compiler warnings under MSVC.

FossilOrigin-Name: 37495b55ffbdc2db4482367ac7d8e32d4d71d58e
This commit is contained in:
shaneh
2009-12-03 06:26:46 +00:00
parent 5e17e8b7dd
commit e585b8f05c
12 changed files with 116 additions and 77 deletions

View File

@ -447,7 +447,7 @@ void sqlite3Fts3Dequote(char *z){
for(i=1, j=0; z[i]; i++){ for(i=1, j=0; z[i]; i++){
if( z[i]==quote ){ if( z[i]==quote ){
if( z[i+1]==quote ){ if( z[i+1]==quote ){
z[j++] = quote; z[j++] = (char)quote;
i++; i++;
}else{ }else{
z[j++] = 0; z[j++] = 0;
@ -653,8 +653,8 @@ int fts3InitVtab(
const char *zTokenizer = 0; /* Name of tokenizer to use */ const char *zTokenizer = 0; /* Name of tokenizer to use */
sqlite3_tokenizer *pTokenizer = 0; /* Tokenizer for this table */ sqlite3_tokenizer *pTokenizer = 0; /* Tokenizer for this table */
nDb = strlen(argv[1]) + 1; nDb = (int)strlen(argv[1]) + 1;
nName = strlen(argv[2]) + 1; nName = (int)strlen(argv[2]) + 1;
for(i=3; i<argc; i++){ for(i=3; i<argc; i++){
char const *z = argv[i]; char const *z = argv[i];
rc = sqlite3Fts3InitTokenizer(pHash, z, &pTokenizer, &zTokenizer, pzErr); rc = sqlite3Fts3InitTokenizer(pHash, z, &pTokenizer, &zTokenizer, pzErr);
@ -662,7 +662,7 @@ int fts3InitVtab(
return rc; return rc;
} }
if( z!=zTokenizer ){ if( z!=zTokenizer ){
nString += strlen(z) + 1; nString += (int)(strlen(z) + 1);
} }
} }
nCol = argc - 3 - (zTokenizer!=0); nCol = argc - 3 - (zTokenizer!=0);
@ -842,6 +842,8 @@ static int fts3BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){
static int fts3OpenMethod(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCsr){ static int fts3OpenMethod(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCsr){
sqlite3_vtab_cursor *pCsr; /* Allocated cursor */ sqlite3_vtab_cursor *pCsr; /* Allocated cursor */
UNUSED_PARAMETER(pVTab);
/* Allocate a buffer large enough for an Fts3Cursor structure. If the /* Allocate a buffer large enough for an Fts3Cursor structure. If the
** allocation succeeds, zero it and return SQLITE_OK. Otherwise, ** allocation succeeds, zero it and return SQLITE_OK. Otherwise,
** if the allocation fails, return SQLITE_NOMEM. ** if the allocation fails, return SQLITE_NOMEM.
@ -1024,7 +1026,7 @@ static void fts3PoslistCopy(char **pp, char **ppPoslist){
while( *pEnd | c ) c = *pEnd++ & 0x80; while( *pEnd | c ) c = *pEnd++ & 0x80;
pEnd++; pEnd++;
if( pp ){ if( pp ){
int n = pEnd - *ppPoslist; int n = (int)(pEnd - *ppPoslist);
char *p = *pp; char *p = *pp;
memcpy(p, *ppPoslist, n); memcpy(p, *ppPoslist, n);
p += n; p += n;
@ -1038,7 +1040,7 @@ static void fts3ColumnlistCopy(char **pp, char **ppPoslist){
char c = 0; char c = 0;
while( 0xFE & (*pEnd | c) ) c = *pEnd++ & 0x80; while( 0xFE & (*pEnd | c) ) c = *pEnd++ & 0x80;
if( pp ){ if( pp ){
int n = pEnd - *ppPoslist; int n = (int)(pEnd - *ppPoslist);
char *p = *pp; char *p = *pp;
memcpy(p, *ppPoslist, n); memcpy(p, *ppPoslist, n);
p += n; p += n;
@ -1425,7 +1427,7 @@ static int fts3DoclistMerge(
assert(!"Invalid mergetype value passed to fts3DoclistMerge()"); assert(!"Invalid mergetype value passed to fts3DoclistMerge()");
} }
*pnBuffer = (p-aBuffer); *pnBuffer = (int)(p-aBuffer);
return SQLITE_OK; return SQLITE_OK;
} }
@ -1457,6 +1459,10 @@ static int fts3TermSelectCb(
int nNew = pTS->nOutput + nDoclist; int nNew = pTS->nOutput + nDoclist;
char *aNew = sqlite3_malloc(nNew); char *aNew = sqlite3_malloc(nNew);
UNUSED_PARAMETER(p);
UNUSED_PARAMETER(zTerm);
UNUSED_PARAMETER(nTerm);
if( !aNew ){ if( !aNew ){
return SQLITE_NOMEM; return SQLITE_NOMEM;
} }
@ -1798,6 +1804,9 @@ static int fts3FilterMethod(
Fts3Table *p = (Fts3Table *)pCursor->pVtab; Fts3Table *p = (Fts3Table *)pCursor->pVtab;
Fts3Cursor *pCsr = (Fts3Cursor *)pCursor; Fts3Cursor *pCsr = (Fts3Cursor *)pCursor;
UNUSED_PARAMETER(idxStr);
UNUSED_PARAMETER(nVal);
assert( idxNum>=0 && idxNum<=(FTS3_FULLTEXT_SEARCH+p->nColumn) ); assert( idxNum>=0 && idxNum<=(FTS3_FULLTEXT_SEARCH+p->nColumn) );
assert( nVal==0 || nVal==1 ); assert( nVal==0 || nVal==1 );
assert( (nVal==0)==(idxNum==FTS3_FULLSCAN_SEARCH) ); assert( (nVal==0)==(idxNum==FTS3_FULLSCAN_SEARCH) );
@ -1820,7 +1829,7 @@ static int fts3FilterMethod(
sqlite3_free(zSql); sqlite3_free(zSql);
} }
if( rc!=SQLITE_OK ) return rc; if( rc!=SQLITE_OK ) return rc;
pCsr->eSearch = idxNum; pCsr->eSearch = (i16)idxNum;
if( idxNum==FTS3_DOCID_SEARCH ){ if( idxNum==FTS3_DOCID_SEARCH ){
rc = sqlite3_bind_value(pCsr->pStmt, 1, apVal[0]); rc = sqlite3_bind_value(pCsr->pStmt, 1, apVal[0]);
@ -1930,6 +1939,7 @@ static int fts3SyncMethod(sqlite3_vtab *pVtab){
** Implementation of xBegin() method. This is a no-op. ** Implementation of xBegin() method. This is a no-op.
*/ */
static int fts3BeginMethod(sqlite3_vtab *pVtab){ static int fts3BeginMethod(sqlite3_vtab *pVtab){
UNUSED_PARAMETER(pVtab);
assert( ((Fts3Table *)pVtab)->nPendingData==0 ); assert( ((Fts3Table *)pVtab)->nPendingData==0 );
return SQLITE_OK; return SQLITE_OK;
} }
@ -1940,6 +1950,7 @@ static int fts3BeginMethod(sqlite3_vtab *pVtab){
** by fts3SyncMethod(). ** by fts3SyncMethod().
*/ */
static int fts3CommitMethod(sqlite3_vtab *pVtab){ static int fts3CommitMethod(sqlite3_vtab *pVtab){
UNUSED_PARAMETER(pVtab);
assert( ((Fts3Table *)pVtab)->nPendingData==0 ); assert( ((Fts3Table *)pVtab)->nPendingData==0 );
return SQLITE_OK; return SQLITE_OK;
} }
@ -2018,6 +2029,8 @@ static void fts3OffsetsFunc(
){ ){
Fts3Cursor *pCsr; /* Cursor handle passed through apVal[0] */ Fts3Cursor *pCsr; /* Cursor handle passed through apVal[0] */
UNUSED_PARAMETER(nVal);
assert( nVal==1 ); assert( nVal==1 );
if( fts3FunctionArg(pContext, "offsets", apVal[0], &pCsr) ) return; if( fts3FunctionArg(pContext, "offsets", apVal[0], &pCsr) ) return;
assert( pCsr ); assert( pCsr );
@ -2042,6 +2055,8 @@ static void fts3OptimizeFunc(
Fts3Table *p; /* Virtual table handle */ Fts3Table *p; /* Virtual table handle */
Fts3Cursor *pCursor; /* Cursor handle passed through apVal[0] */ Fts3Cursor *pCursor; /* Cursor handle passed through apVal[0] */
UNUSED_PARAMETER(nVal);
assert( nVal==1 ); assert( nVal==1 );
if( fts3FunctionArg(pContext, "optimize", apVal[0], &pCursor) ) return; if( fts3FunctionArg(pContext, "optimize", apVal[0], &pCursor) ) return;
p = (Fts3Table *)pCursor->base.pVtab; p = (Fts3Table *)pCursor->base.pVtab;
@ -2082,6 +2097,11 @@ static int fts3FindFunctionMethod(
{ "optimize", fts3OptimizeFunc }, { "optimize", fts3OptimizeFunc },
}; };
int i; /* Iterator variable */ int i; /* Iterator variable */
UNUSED_PARAMETER(pVtab);
UNUSED_PARAMETER(nArg);
UNUSED_PARAMETER(ppArg);
for(i=0; i<SizeofArray(aOverload); i++){ for(i=0; i<SizeofArray(aOverload); i++){
if( strcmp(zName, aOverload[i].zName)==0 ){ if( strcmp(zName, aOverload[i].zName)==0 ){
*pxFunc = aOverload[i].xFunc; *pxFunc = aOverload[i].xFunc;

View File

@ -53,15 +53,27 @@
*/ */
#define FTS3_VARINT_MAX 10 #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 ** Macros indicating that conditional expressions are always true or
** false. ** false.
*/ */
#ifndef SQLITE_AMALGAMATION
# define ALWAYS(x) (x) # define ALWAYS(x) (x)
# define NEVER(X) (x) # define NEVER(X) (x)
/*
** Internal types used by SQLite.
*/
typedef unsigned char u8; /* 1-byte (or larger) unsigned integer */ typedef unsigned char u8; /* 1-byte (or larger) unsigned integer */
typedef short int i16; /* 2-byte (or larger) signed 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 #endif
typedef struct Fts3Table Fts3Table; typedef struct Fts3Table Fts3Table;

View File

@ -252,7 +252,7 @@ static int getNextString(
if( rc==SQLITE_DONE ){ if( rc==SQLITE_DONE ){
int jj; int jj;
char *zNew; char *zNew = NULL;
int nNew = 0; int nNew = 0;
int nByte = sizeof(Fts3Expr) + sizeof(Fts3Phrase); int nByte = sizeof(Fts3Expr) + sizeof(Fts3Phrase);
nByte += (p?(p->pPhrase->nToken-1):0) * sizeof(struct PhraseToken); nByte += (p?(p->pPhrase->nToken-1):0) * sizeof(struct PhraseToken);
@ -311,7 +311,7 @@ static int getNextNode(
int *pnConsumed /* OUT: Number of bytes consumed */ int *pnConsumed /* OUT: Number of bytes consumed */
){ ){
static const struct Fts3Keyword { static const struct Fts3Keyword {
char z[4]; /* Keyword text */ char *z; /* Keyword text */
unsigned char n; /* Length of the keyword */ unsigned char n; /* Length of the keyword */
unsigned char parenOnly; /* Only valid in paren mode */ unsigned char parenOnly; /* Only valid in paren mode */
unsigned char eType; /* Keyword code */ unsigned char eType; /* Keyword code */
@ -381,7 +381,7 @@ static int getNextNode(
pRet->eType = pKey->eType; pRet->eType = pKey->eType;
pRet->nNear = nNear; pRet->nNear = nNear;
*ppExpr = pRet; *ppExpr = pRet;
*pnConsumed = (zInput - z) + nKey; *pnConsumed = (int)((zInput - z) + nKey);
return SQLITE_OK; return SQLITE_OK;
} }
@ -401,14 +401,14 @@ static int getNextNode(
if( rc==SQLITE_OK && !*ppExpr ){ if( rc==SQLITE_OK && !*ppExpr ){
rc = SQLITE_DONE; rc = SQLITE_DONE;
} }
*pnConsumed = (zInput - z) + 1 + nConsumed; *pnConsumed = (int)((zInput - z) + 1 + nConsumed);
return rc; return rc;
} }
/* Check for a close bracket. */ /* Check for a close bracket. */
if( *zInput==')' ){ if( *zInput==')' ){
pParse->nNest--; pParse->nNest--;
*pnConsumed = (zInput - z) + 1; *pnConsumed = (int)((zInput - z) + 1);
return SQLITE_DONE; return SQLITE_DONE;
} }
} }
@ -420,7 +420,7 @@ static int getNextNode(
*/ */
if( *zInput=='"' ){ if( *zInput=='"' ){
for(ii=1; ii<nInput && zInput[ii]!='"'; ii++); for(ii=1; ii<nInput && zInput[ii]!='"'; ii++);
*pnConsumed = (zInput - z) + ii + 1; *pnConsumed = (int)((zInput - z) + ii + 1);
if( ii==nInput ){ if( ii==nInput ){
return SQLITE_ERROR; return SQLITE_ERROR;
} }
@ -443,12 +443,12 @@ static int getNextNode(
iColLen = 0; iColLen = 0;
for(ii=0; ii<pParse->nCol; ii++){ for(ii=0; ii<pParse->nCol; ii++){
const char *zStr = pParse->azCol[ii]; const char *zStr = pParse->azCol[ii];
int nStr = strlen(zStr); int nStr = (int)strlen(zStr);
if( nInput>nStr && zInput[nStr]==':' if( nInput>nStr && zInput[nStr]==':'
&& sqlite3_strnicmp(zStr, zInput, nStr)==0 && sqlite3_strnicmp(zStr, zInput, nStr)==0
){ ){
iCol = ii; iCol = ii;
iColLen = ((zInput - z) + nStr + 1); iColLen = (int)((zInput - z) + nStr + 1);
break; break;
} }
} }
@ -714,7 +714,7 @@ int sqlite3Fts3ExprParse(
return SQLITE_OK; return SQLITE_OK;
} }
if( n<0 ){ if( n<0 ){
n = strlen(z); n = (int)strlen(z);
} }
rc = fts3ExprParse(&sParse, z, n, ppExpr, &nParsed); rc = fts3ExprParse(&sParse, z, n, ppExpr, &nParsed);
@ -769,7 +769,7 @@ static int queryTestTokenizer(
sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC); sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC);
if( SQLITE_ROW==sqlite3_step(pStmt) ){ if( SQLITE_ROW==sqlite3_step(pStmt) ){
if( sqlite3_column_type(pStmt, 0)==SQLITE_BLOB ){ 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));
} }
} }

View File

@ -56,7 +56,7 @@ static void fts3HashFree(void *p){
** true if the hash table should make its own private copy of keys and ** true if the hash table should make its own private copy of keys and
** false if it should just use the supplied pointer. ** 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( pNew!=0 );
assert( keyClass>=FTS3_HASH_STRING && keyClass<=FTS3_HASH_BINARY ); assert( keyClass>=FTS3_HASH_STRING && keyClass<=FTS3_HASH_BINARY );
pNew->keyClass = keyClass; pNew->keyClass = keyClass;

View File

@ -71,7 +71,7 @@ struct Fts3HashElem {
/* /*
** Access routines. To delete, insert a NULL pointer. ** 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 *sqlite3Fts3HashInsert(Fts3Hash*, const void *pKey, int nKey, void *pData);
void *sqlite3Fts3HashFind(const Fts3Hash*, const void *pKey, int nKey); void *sqlite3Fts3HashFind(const Fts3Hash*, const void *pKey, int nKey);
void sqlite3Fts3HashClear(Fts3Hash*); void sqlite3Fts3HashClear(Fts3Hash*);

View File

@ -24,6 +24,7 @@
*/ */
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
#include "fts3Int.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
@ -54,10 +55,6 @@ typedef struct porter_tokenizer_cursor {
} porter_tokenizer_cursor; } porter_tokenizer_cursor;
/* Forward declaration */
static const sqlite3_tokenizer_module porterTokenizerModule;
/* /*
** Create a new tokenizer instance. ** Create a new tokenizer instance.
*/ */
@ -66,6 +63,10 @@ static int porterCreate(
sqlite3_tokenizer **ppTokenizer sqlite3_tokenizer **ppTokenizer
){ ){
porter_tokenizer *t; porter_tokenizer *t;
UNUSED_PARAMETER(argc);
UNUSED_PARAMETER(argv);
t = (porter_tokenizer *) sqlite3_malloc(sizeof(*t)); t = (porter_tokenizer *) sqlite3_malloc(sizeof(*t));
if( t==NULL ) return SQLITE_NOMEM; if( t==NULL ) return SQLITE_NOMEM;
memset(t, 0, sizeof(*t)); memset(t, 0, sizeof(*t));
@ -94,6 +95,8 @@ static int porterOpen(
){ ){
porter_tokenizer_cursor *c; porter_tokenizer_cursor *c;
UNUSED_PARAMETER(pTokenizer);
c = (porter_tokenizer_cursor *) sqlite3_malloc(sizeof(*c)); c = (porter_tokenizer_cursor *) sqlite3_malloc(sizeof(*c));
if( c==NULL ) return SQLITE_NOMEM; if( c==NULL ) return SQLITE_NOMEM;
@ -294,7 +297,7 @@ static void copy_stemmer(const char *zIn, int nIn, char *zOut, int *pnOut){
int i, mx, j; int i, mx, j;
int hasDigit = 0; int hasDigit = 0;
for(i=0; i<nIn; i++){ for(i=0; i<nIn; i++){
int c = zIn[i]; char c = zIn[i];
if( c>='A' && c<='Z' ){ if( c>='A' && c<='Z' ){
zOut[i] = c - 'A' + 'a'; zOut[i] = c - 'A' + 'a';
}else{ }else{
@ -338,7 +341,7 @@ static void copy_stemmer(const char *zIn, int nIn, char *zOut, int *pnOut){
** no chance of overflowing the zOut buffer. ** no chance of overflowing the zOut buffer.
*/ */
static void porter_stemmer(const char *zIn, int nIn, char *zOut, int *pnOut){ static void porter_stemmer(const char *zIn, int nIn, char *zOut, int *pnOut){
int i, j, c; int i, j;
char zReverse[28]; char zReverse[28];
char *z, *z2; char *z, *z2;
if( nIn<3 || nIn>=sizeof(zReverse)-7 ){ if( nIn<3 || nIn>=sizeof(zReverse)-7 ){
@ -348,7 +351,7 @@ static void porter_stemmer(const char *zIn, int nIn, char *zOut, int *pnOut){
return; return;
} }
for(i=0, j=sizeof(zReverse)-6; i<nIn; i++, j--){ for(i=0, j=sizeof(zReverse)-6; i<nIn; i++, j--){
c = zIn[i]; char c = zIn[i];
if( c>='A' && c<='Z' ){ if( c>='A' && c<='Z' ){
zReverse[j] = c + 'a' - 'A'; zReverse[j] = c + 'a' - 'A';
}else if( c>='a' && c<='z' ){ }else if( c>='a' && c<='z' ){
@ -547,7 +550,7 @@ static void porter_stemmer(const char *zIn, int nIn, char *zOut, int *pnOut){
/* z[] is now the stemmed word in reverse order. Flip it back /* z[] is now the stemmed word in reverse order. Flip it back
** around into forward order and return. ** around into forward order and return.
*/ */
*pnOut = i = strlen(z); *pnOut = i = (int)strlen(z);
zOut[i] = 0; zOut[i] = 0;
while( *z ){ while( *z ){
zOut[--i] = *(z++); zOut[--i] = *(z++);

View File

@ -78,7 +78,7 @@ static void fts3SnippetSbInit(StringBuffer *p){
*/ */
static void fts3SnippetAppend(StringBuffer *p, const char *zNew, int nNew){ static void fts3SnippetAppend(StringBuffer *p, const char *zNew, int nNew){
if( p->z==0 ) return; if( p->z==0 ) return;
if( nNew<0 ) nNew = strlen(zNew); if( nNew<0 ) nNew = (int)strlen(zNew);
if( p->nUsed + nNew >= p->nAlloc ){ if( p->nUsed + nNew >= p->nAlloc ){
int nAlloc; int nAlloc;
char *zNew; char *zNew;
@ -155,11 +155,11 @@ static int snippetAppendMatch(
} }
i = p->nMatch++; i = p->nMatch++;
pMatch = &p->aMatch[i]; pMatch = &p->aMatch[i];
pMatch->iCol = iCol; pMatch->iCol = (short)iCol;
pMatch->iTerm = iTerm; pMatch->iTerm = (short)iTerm;
pMatch->iToken = iToken; pMatch->iToken = iToken;
pMatch->iStart = iStart; pMatch->iStart = iStart;
pMatch->nByte = nByte; pMatch->nByte = (short)nByte;
return SQLITE_OK; return SQLITE_OK;
} }

View File

@ -145,7 +145,7 @@ const char *sqlite3Fts3NextToken(const char *zStr, int *pn){
} }
} }
*pn = (z2-z1); *pn = (int)(z2-z1);
return z1; return z1;
} }
@ -183,7 +183,7 @@ int sqlite3Fts3InitTokenizer(
z[n] = '\0'; z[n] = '\0';
sqlite3Fts3Dequote(z); 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 ){ if( !m ){
*pzErr = sqlite3_mprintf("unknown tokenizer: %s", z); *pzErr = sqlite3_mprintf("unknown tokenizer: %s", z);
rc = SQLITE_ERROR; rc = SQLITE_ERROR;
@ -191,12 +191,12 @@ int sqlite3Fts3InitTokenizer(
char const **aArg = 0; char const **aArg = 0;
int iArg = 0; int iArg = 0;
z = &z[n+1]; 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); 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 ){ if( !aNew ){
sqlite3_free(zCopy); sqlite3_free(zCopy);
sqlite3_free(aArg); sqlite3_free((void *)aArg);
return SQLITE_NOMEM; return SQLITE_NOMEM;
} }
aArg = aNew; aArg = aNew;
@ -212,7 +212,7 @@ int sqlite3Fts3InitTokenizer(
}else{ }else{
(*ppTok)->pModule = m; (*ppTok)->pModule = m;
} }
sqlite3_free(aArg); sqlite3_free((void *)aArg);
} }
sqlite3_free(zCopy); sqlite3_free(zCopy);
@ -380,7 +380,7 @@ int queryTokenizer(
sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC); sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC);
if( SQLITE_ROW==sqlite3_step(pStmt) ){ if( SQLITE_ROW==sqlite3_step(pStmt) ){
if( sqlite3_column_type(pStmt, 0)==SQLITE_BLOB ){ 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));
} }
} }
@ -417,6 +417,9 @@ static void intTestFunc(
const sqlite3_tokenizer_module *p2; const sqlite3_tokenizer_module *p2;
sqlite3 *db = (sqlite3 *)sqlite3_user_data(context); sqlite3 *db = (sqlite3 *)sqlite3_user_data(context);
UNUSED_PARAMETER(argc);
UNUSED_PARAMETER(argv);
/* Test the query function */ /* Test the query function */
sqlite3Fts3SimpleTokenizerModule(&p1); sqlite3Fts3SimpleTokenizerModule(&p1);
rc = queryTokenizer(db, "simple", &p2); rc = queryTokenizer(db, "simple", &p2);
@ -476,13 +479,13 @@ int sqlite3Fts3InitHashTable(
} }
#endif #endif
if( rc!=SQLITE_OK if( SQLITE_OK!=rc
|| (rc = sqlite3_create_function(db, zName, 1, any, p, scalarFunc, 0, 0)) || 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)) || SQLITE_OK!=(rc = sqlite3_create_function(db, zName, 2, any, p, scalarFunc, 0, 0))
#ifdef SQLITE_TEST #ifdef SQLITE_TEST
|| (rc = sqlite3_create_function(db, zTest, 2, any, p, testFunc, 0, 0)) || SQLITE_OK!=(rc = sqlite3_create_function(db, zTest, 2, any, p, testFunc, 0, 0))
|| (rc = sqlite3_create_function(db, zTest, 3, any, p, testFunc, 0, 0)) || SQLITE_OK!=(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, zTest2, 0, any, pdb, intTestFunc, 0, 0))
#endif #endif
); );

View File

@ -24,6 +24,7 @@
*/ */
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
#include "fts3Int.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
@ -49,9 +50,6 @@ typedef struct simple_tokenizer_cursor {
} simple_tokenizer_cursor; } simple_tokenizer_cursor;
/* Forward declaration */
static const sqlite3_tokenizer_module simpleTokenizerModule;
static int simpleDelim(simple_tokenizer *t, unsigned char c){ static int simpleDelim(simple_tokenizer *t, unsigned char c){
return c<0x80 && t->delim[c]; return c<0x80 && t->delim[c];
} }
@ -75,7 +73,7 @@ static int simpleCreate(
** information on the initial create. ** information on the initial create.
*/ */
if( argc>1 ){ if( argc>1 ){
int i, n = strlen(argv[1]); int i, n = (int)strlen(argv[1]);
for(i=0; i<n; i++){ for(i=0; i<n; i++){
unsigned char ch = argv[1][i]; unsigned char ch = argv[1][i];
/* We explicitly don't support UTF-8 delimiters for now. */ /* We explicitly don't support UTF-8 delimiters for now. */
@ -89,7 +87,7 @@ static int simpleCreate(
/* Mark non-alphanumeric ASCII characters as delimiters */ /* Mark non-alphanumeric ASCII characters as delimiters */
int i; int i;
for(i=1; i<0x80; i++){ for(i=1; i<0x80; i++){
t->delim[i] = !isalnum(i); t->delim[i] = !isalnum(i) ? -1 : 0;
} }
} }
@ -118,6 +116,8 @@ static int simpleOpen(
){ ){
simple_tokenizer_cursor *c; simple_tokenizer_cursor *c;
UNUSED_PARAMETER(pTokenizer);
c = (simple_tokenizer_cursor *) sqlite3_malloc(sizeof(*c)); c = (simple_tokenizer_cursor *) sqlite3_malloc(sizeof(*c));
if( c==NULL ) return SQLITE_NOMEM; if( c==NULL ) return SQLITE_NOMEM;
@ -191,7 +191,7 @@ static int simpleNext(
** case-insensitivity. ** case-insensitivity.
*/ */
unsigned char ch = p[iStartOffset+i]; 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; *ppToken = c->pToken;
*pnBytes = n; *pnBytes = n;

View File

@ -682,14 +682,14 @@ static int fts3SegmentMerge(Fts3Table *, int);
static int fts3AllocateSegdirIdx(Fts3Table *p, int iLevel, int *piIdx){ static int fts3AllocateSegdirIdx(Fts3Table *p, int iLevel, int *piIdx){
int rc; /* Return Code */ int rc; /* Return Code */
sqlite3_stmt *pNextIdx; /* Query for next idx at level iLevel */ 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. */ /* Set variable iNext to the next available segdir index at level iLevel. */
rc = fts3SqlStmt(p, SQL_NEXT_SEGMENT_INDEX, &pNextIdx, 0); rc = fts3SqlStmt(p, SQL_NEXT_SEGMENT_INDEX, &pNextIdx, 0);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
sqlite3_bind_int(pNextIdx, 1, iLevel); sqlite3_bind_int(pNextIdx, 1, iLevel);
if( SQLITE_ROW==sqlite3_step(pNextIdx) ){ if( SQLITE_ROW==sqlite3_step(pNextIdx) ){
iNext = sqlite3_column_int64(pNextIdx, 0); iNext = sqlite3_column_int(pNextIdx, 0);
} }
rc = sqlite3_reset(pNextIdx); rc = sqlite3_reset(pNextIdx);
} }
@ -807,7 +807,7 @@ static void fts3SegReaderNextDocid(
*/ */
if( ppOffsetList ){ if( ppOffsetList ){
*ppOffsetList = pReader->pOffsetList; *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 /* If there are no more entries in the doclist, set pOffsetList to
@ -1160,6 +1160,7 @@ static int fts3PrefixCompress(
int nNext /* Size of buffer zNext in bytes */ int nNext /* Size of buffer zNext in bytes */
){ ){
int n; int n;
UNUSED_PARAMETER(nNext);
for(n=0; n<nPrev && zPrev[n]==zNext[n]; n++); for(n=0; n<nPrev && zPrev[n]==zNext[n]; n++);
return n; return n;
} }
@ -1520,10 +1521,10 @@ static int fts3SegWriterFlush(
){ ){
int rc; /* Return code */ int rc; /* Return code */
if( pWriter->pTree ){ 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 */ sqlite3_int64 iLastLeaf; /* Largest leaf block id written to db */
char *zRoot; /* Pointer to buffer containing root node */ char *zRoot = NULL; /* Pointer to buffer containing root node */
int nRoot; /* Size of buffer zRoot */ int nRoot = 0; /* Size of buffer zRoot */
iLastLeaf = pWriter->iFree; iLastLeaf = pWriter->iFree;
rc = fts3WriteSegment(p, pWriter->iFree++, pWriter->aData, pWriter->nData); rc = fts3WriteSegment(p, pWriter->iFree++, pWriter->aData, pWriter->nData);
@ -1696,11 +1697,11 @@ static void fts3ColumnFilter(
while( p<pEnd && (c | *p)&0xFE ) c = *p++ & 0x80; while( p<pEnd && (c | *p)&0xFE ) c = *p++ & 0x80;
if( iCol==iCurrent ){ if( iCol==iCurrent ){
nList = (p - pList); nList = (int)(p - pList);
break; break;
} }
nList -= (p - pList); nList -= (int)(p - pList);
pList = p; pList = p;
if( nList==0 ){ if( nList==0 ){
break; break;
@ -2105,7 +2106,7 @@ int sqlite3Fts3UpdateMethod(
Fts3Table *p = (Fts3Table *)pVtab; Fts3Table *p = (Fts3Table *)pVtab;
int rc = SQLITE_OK; /* Return Code */ int rc = SQLITE_OK; /* Return Code */
int isRemove = 0; /* True for an UPDATE or DELETE */ 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 this is a DELETE or UPDATE operation, remove the old record. */
if( sqlite3_value_type(apVal[0])!=SQLITE_NULL ){ if( sqlite3_value_type(apVal[0])!=SQLITE_NULL ){

View File

@ -1,5 +1,5 @@
C Fix\sa\scouple\sof\scompiler\swarnings\sunder\sMSVC. C Updates\sto\sFTS3\sto\scorrect\scompiler\swarnings\sunder\sMSVC.
D 2009-12-03T04:40:48 D 2009-12-03T06:26:46
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3 F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -56,19 +56,19 @@ F ext/fts2/mkfts2amal.tcl 974d5d438cb3f7c4a652639262f82418c1e4cff0
F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
F ext/fts3/README.tokenizers 998756696647400de63d5ba60e9655036cb966e9 F ext/fts3/README.tokenizers 998756696647400de63d5ba60e9655036cb966e9
F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d 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/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
F ext/fts3/fts3Int.h 7bc65d9ada6715ecd11ed83513013d4c7bbc2eeb F ext/fts3/fts3Int.h 515132f0ae6b35eccbeef72a2bafb16d7e251953
F ext/fts3/fts3_expr.c bdf11f3602f62f36f0e42823680bf22033dae0de F ext/fts3/fts3_expr.c c18794a62c257d3456d3314c5a18e348ae0d84bd
F ext/fts3/fts3_hash.c 29fba5a01e51c53e37040e53821e6b2cec18c8fb F ext/fts3/fts3_hash.c 18feef38fca216992725e9eae775a0c7735e6724
F ext/fts3/fts3_hash.h 39524725425078bf9e814e9569c74a8e5a21b9fb F ext/fts3/fts3_hash.h d410ff2c93c81a56b927fcf07b2099ccbfa7a479
F ext/fts3/fts3_icu.c ac494aed69835008185299315403044664bda295 F ext/fts3/fts3_icu.c ac494aed69835008185299315403044664bda295
F ext/fts3/fts3_porter.c 4248815484f9c7e9d4f3c72c1149464485c08abe F ext/fts3/fts3_porter.c a651e287e02b49b565a6ccf9441959d434489156
F ext/fts3/fts3_snippet.c 84ba2fad73aa12628f1950aed74babbf3975e73a F ext/fts3/fts3_snippet.c 6c2eb6d872d66b2a9aa5663f2662e993f18a6496
F ext/fts3/fts3_tokenizer.c 17335e980994e112c5d332d5bc391f9089350761 F ext/fts3/fts3_tokenizer.c 73a4e0e068720153901622f215298b73e7c976c7
F ext/fts3/fts3_tokenizer.h 7ff73caa3327589bf6550f60d93ebdd1f6a0fb5c F ext/fts3/fts3_tokenizer.h 7ff73caa3327589bf6550f60d93ebdd1f6a0fb5c
F ext/fts3/fts3_tokenizer1.c 0a5bcc579f35de5d24a9345d7908dc25ae403ee7 F ext/fts3/fts3_tokenizer1.c 11a604a53cff5e8c28882727bf794e5252e5227b
F ext/fts3/fts3_write.c 5d3849443746f41ea4af96dac08d79f2bf75f204 F ext/fts3/fts3_write.c 6c59b1d6eed759815151298c132d79301c205fce
F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100 F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100
F ext/icu/README.txt 3b130aa66e7a681136f6add198b076a2f90d1e33 F ext/icu/README.txt 3b130aa66e7a681136f6add198b076a2f90d1e33
F ext/icu/icu.c 12e763d288d23b5a49de37caa30737b971a2f1e2 F ext/icu/icu.c 12e763d288d23b5a49de37caa30737b971a2f1e2
@ -775,7 +775,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 59e2e2c6301e189a1a6601c681bbb0937a5cd14e P e3aa0870fce0666bf8c67ad6ec23e135d03b604a
R 4cd225486b10b23f8eba14d67e73bbe4 R 8d9ad89e2fac8a1d1d94a1d048213789
U shaneh U shaneh
Z ef9e7d1e0537cf470262f7210a98337f Z 7667ec8a886e15725b2ab6f5b341cdfd

View File

@ -1 +1 @@
e3aa0870fce0666bf8c67ad6ec23e135d03b604a 37495b55ffbdc2db4482367ac7d8e32d4d71d58e