mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Updates to FTS3 to correct compiler warnings under MSVC.
FossilOrigin-Name: 37495b55ffbdc2db4482367ac7d8e32d4d71d58e
This commit is contained in:
@ -447,7 +447,7 @@ void sqlite3Fts3Dequote(char *z){
|
||||
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;
|
||||
@ -653,8 +653,8 @@ int fts3InitVtab(
|
||||
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);
|
||||
@ -662,7 +662,7 @@ int fts3InitVtab(
|
||||
return rc;
|
||||
}
|
||||
if( z!=zTokenizer ){
|
||||
nString += strlen(z) + 1;
|
||||
nString += (int)(strlen(z) + 1);
|
||||
}
|
||||
}
|
||||
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){
|
||||
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.
|
||||
@ -1024,7 +1026,7 @@ static void fts3PoslistCopy(char **pp, char **ppPoslist){
|
||||
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;
|
||||
@ -1038,7 +1040,7 @@ static void fts3ColumnlistCopy(char **pp, char **ppPoslist){
|
||||
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;
|
||||
@ -1425,7 +1427,7 @@ static int fts3DoclistMerge(
|
||||
assert(!"Invalid mergetype value passed to fts3DoclistMerge()");
|
||||
}
|
||||
|
||||
*pnBuffer = (p-aBuffer);
|
||||
*pnBuffer = (int)(p-aBuffer);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
@ -1457,6 +1459,10 @@ static int fts3TermSelectCb(
|
||||
int nNew = pTS->nOutput + nDoclist;
|
||||
char *aNew = sqlite3_malloc(nNew);
|
||||
|
||||
UNUSED_PARAMETER(p);
|
||||
UNUSED_PARAMETER(zTerm);
|
||||
UNUSED_PARAMETER(nTerm);
|
||||
|
||||
if( !aNew ){
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
@ -1798,6 +1804,9 @@ static int fts3FilterMethod(
|
||||
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) );
|
||||
@ -1820,7 +1829,7 @@ static int fts3FilterMethod(
|
||||
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]);
|
||||
@ -1930,6 +1939,7 @@ static int fts3SyncMethod(sqlite3_vtab *pVtab){
|
||||
** 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;
|
||||
}
|
||||
@ -1940,6 +1950,7 @@ static int fts3BeginMethod(sqlite3_vtab *pVtab){
|
||||
** by fts3SyncMethod().
|
||||
*/
|
||||
static int fts3CommitMethod(sqlite3_vtab *pVtab){
|
||||
UNUSED_PARAMETER(pVtab);
|
||||
assert( ((Fts3Table *)pVtab)->nPendingData==0 );
|
||||
return SQLITE_OK;
|
||||
}
|
||||
@ -2018,6 +2029,8 @@ static void fts3OffsetsFunc(
|
||||
){
|
||||
Fts3Cursor *pCsr; /* Cursor handle passed through apVal[0] */
|
||||
|
||||
UNUSED_PARAMETER(nVal);
|
||||
|
||||
assert( nVal==1 );
|
||||
if( fts3FunctionArg(pContext, "offsets", apVal[0], &pCsr) ) return;
|
||||
assert( pCsr );
|
||||
@ -2042,6 +2055,8 @@ static void fts3OptimizeFunc(
|
||||
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;
|
||||
@ -2082,6 +2097,11 @@ static int fts3FindFunctionMethod(
|
||||
{ "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;
|
||||
|
@ -53,15 +53,27 @@
|
||||
*/
|
||||
#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;
|
||||
|
@ -252,7 +252,7 @@ static int getNextString(
|
||||
|
||||
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);
|
||||
@ -311,7 +311,7 @@ static int getNextNode(
|
||||
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 */
|
||||
@ -381,7 +381,7 @@ static int getNextNode(
|
||||
pRet->eType = pKey->eType;
|
||||
pRet->nNear = nNear;
|
||||
*ppExpr = pRet;
|
||||
*pnConsumed = (zInput - z) + nKey;
|
||||
*pnConsumed = (int)((zInput - z) + nKey);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
@ -401,14 +401,14 @@ static int getNextNode(
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -420,7 +420,7 @@ static int getNextNode(
|
||||
*/
|
||||
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;
|
||||
}
|
||||
@ -443,12 +443,12 @@ static int getNextNode(
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -714,7 +714,7 @@ int sqlite3Fts3ExprParse(
|
||||
return SQLITE_OK;
|
||||
}
|
||||
if( n<0 ){
|
||||
n = strlen(z);
|
||||
n = (int)strlen(z);
|
||||
}
|
||||
rc = fts3ExprParse(&sParse, z, n, ppExpr, &nParsed);
|
||||
|
||||
@ -769,7 +769,7 @@ static int queryTestTokenizer(
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ static void fts3HashFree(void *p){
|
||||
** 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;
|
||||
|
@ -71,7 +71,7 @@ struct Fts3HashElem {
|
||||
/*
|
||||
** 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*);
|
||||
|
@ -24,6 +24,7 @@
|
||||
*/
|
||||
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
|
||||
|
||||
#include "fts3Int.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
@ -54,10 +55,6 @@ typedef struct porter_tokenizer_cursor {
|
||||
} porter_tokenizer_cursor;
|
||||
|
||||
|
||||
/* Forward declaration */
|
||||
static const sqlite3_tokenizer_module porterTokenizerModule;
|
||||
|
||||
|
||||
/*
|
||||
** Create a new tokenizer instance.
|
||||
*/
|
||||
@ -66,6 +63,10 @@ static int porterCreate(
|
||||
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));
|
||||
@ -94,6 +95,8 @@ static int porterOpen(
|
||||
){
|
||||
porter_tokenizer_cursor *c;
|
||||
|
||||
UNUSED_PARAMETER(pTokenizer);
|
||||
|
||||
c = (porter_tokenizer_cursor *) sqlite3_malloc(sizeof(*c));
|
||||
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 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{
|
||||
@ -338,7 +341,7 @@ static void copy_stemmer(const char *zIn, int nIn, char *zOut, int *pnOut){
|
||||
** 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 ){
|
||||
@ -348,7 +351,7 @@ static void porter_stemmer(const char *zIn, int nIn, char *zOut, int *pnOut){
|
||||
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' ){
|
||||
@ -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
|
||||
** around into forward order and return.
|
||||
*/
|
||||
*pnOut = i = strlen(z);
|
||||
*pnOut = i = (int)strlen(z);
|
||||
zOut[i] = 0;
|
||||
while( *z ){
|
||||
zOut[--i] = *(z++);
|
||||
|
@ -78,7 +78,7 @@ static void fts3SnippetSbInit(StringBuffer *p){
|
||||
*/
|
||||
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;
|
||||
@ -155,11 +155,11 @@ static int snippetAppendMatch(
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ const char *sqlite3Fts3NextToken(const char *zStr, int *pn){
|
||||
}
|
||||
}
|
||||
|
||||
*pn = (z2-z1);
|
||||
*pn = (int)(z2-z1);
|
||||
return z1;
|
||||
}
|
||||
|
||||
@ -183,7 +183,7 @@ int sqlite3Fts3InitTokenizer(
|
||||
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;
|
||||
@ -191,12 +191,12 @@ int sqlite3Fts3InitTokenizer(
|
||||
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;
|
||||
@ -212,7 +212,7 @@ int sqlite3Fts3InitTokenizer(
|
||||
}else{
|
||||
(*ppTok)->pModule = m;
|
||||
}
|
||||
sqlite3_free(aArg);
|
||||
sqlite3_free((void *)aArg);
|
||||
}
|
||||
|
||||
sqlite3_free(zCopy);
|
||||
@ -380,7 +380,7 @@ int queryTokenizer(
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -417,6 +417,9 @@ static void intTestFunc(
|
||||
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);
|
||||
@ -476,13 +479,13 @@ int sqlite3Fts3InitHashTable(
|
||||
}
|
||||
#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
|
||||
);
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
*/
|
||||
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
|
||||
|
||||
#include "fts3Int.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
@ -49,9 +50,6 @@ typedef struct simple_tokenizer_cursor {
|
||||
} 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];
|
||||
}
|
||||
@ -75,7 +73,7 @@ static int simpleCreate(
|
||||
** 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. */
|
||||
@ -89,7 +87,7 @@ static int simpleCreate(
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,6 +116,8 @@ static int simpleOpen(
|
||||
){
|
||||
simple_tokenizer_cursor *c;
|
||||
|
||||
UNUSED_PARAMETER(pTokenizer);
|
||||
|
||||
c = (simple_tokenizer_cursor *) sqlite3_malloc(sizeof(*c));
|
||||
if( c==NULL ) return SQLITE_NOMEM;
|
||||
|
||||
@ -191,7 +191,7 @@ static int simpleNext(
|
||||
** 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;
|
||||
|
@ -682,14 +682,14 @@ static int fts3SegmentMerge(Fts3Table *, int);
|
||||
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);
|
||||
}
|
||||
@ -807,7 +807,7 @@ static void fts3SegReaderNextDocid(
|
||||
*/
|
||||
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
|
||||
@ -1160,6 +1160,7 @@ static int fts3PrefixCompress(
|
||||
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;
|
||||
}
|
||||
@ -1520,10 +1521,10 @@ static int fts3SegWriterFlush(
|
||||
){
|
||||
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);
|
||||
@ -1696,11 +1697,11 @@ static void fts3ColumnFilter(
|
||||
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;
|
||||
@ -2105,7 +2106,7 @@ int sqlite3Fts3UpdateMethod(
|
||||
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 ){
|
||||
|
Reference in New Issue
Block a user