1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Fix some strict-aliasing problems in fts3_expr.c. (CVS 6035)

FossilOrigin-Name: 20a4ca5d361ecbb982129171f10cccac4f5ad093
This commit is contained in:
danielk1977
2008-12-17 15:49:51 +00:00
parent 33e8903540
commit f0f9f75443
3 changed files with 15 additions and 15 deletions

View File

@ -155,12 +155,12 @@ static int getNextToken(
return rc;
}
void realloc_or_free(void **ppOrig, int nNew){
void *pRet = sqlite3_realloc(*ppOrig, nNew);
void *realloc_or_free(void *pOrig, int nNew){
void *pRet = sqlite3_realloc(pOrig, nNew);
if( !pRet ){
sqlite3_free(*ppOrig);
sqlite3_free(pOrig);
}
*ppOrig = pRet;
return pRet;
}
/*
@ -198,8 +198,8 @@ static int getNextString(
rc = pModule->xNext(pCursor, &zToken, &nToken, &iBegin, &iEnd, &iPos);
if( rc==SQLITE_OK ){
int nByte = sizeof(Fts3Expr) + sizeof(Fts3Phrase);
realloc_or_free((void **)&p, nByte+ii*sizeof(struct PhraseToken));
realloc_or_free((void **)&zTemp, nTemp + nToken);
p = realloc_or_free(p, nByte+ii*sizeof(struct PhraseToken));
zTemp = realloc_or_free(zTemp, nTemp + nToken);
if( !p || !zTemp ){
goto no_mem;
}
@ -232,7 +232,7 @@ static int getNextString(
int nNew = 0;
int nByte = sizeof(Fts3Expr) + sizeof(Fts3Phrase);
nByte += (p->pPhrase->nToken-1) * sizeof(struct PhraseToken);
realloc_or_free((void **)&p, nByte + nTemp);
p = realloc_or_free(p, nByte + nTemp);
if( !p ){
goto no_mem;
}
@ -308,7 +308,7 @@ static int getNextNode(
}
/* See if we are dealing with a keyword. */
for(ii=0; ii<sizeof(aKeyword)/sizeof(struct Fts3Keyword); ii++){
for(ii=0; ii<(int)(sizeof(aKeyword)/sizeof(struct Fts3Keyword)); ii++){
struct Fts3Keyword *pKey = &aKeyword[ii];
if( (0==sqlite3_fts3_enable_parentheses)