mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Fix compiler warnings discovered while building SQLite on [http://www.devio.us/].
FossilOrigin-Name: 5602ec95aa2a74d0624bb6c7d53e7a0d35536253
This commit is contained in:
@ -785,47 +785,53 @@ static int queryTestTokenizer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** This function is part of the test interface for the query parser. It
|
** Return a pointer to a buffer containing a text representation of the
|
||||||
** writes a text representation of the query expression pExpr into the
|
** expression passed as the first argument. The buffer is obtained from
|
||||||
** buffer pointed to by argument zBuf. It is assumed that zBuf is large
|
** sqlite3_malloc(). It is the responsibility of the caller to use
|
||||||
** enough to store the required text representation.
|
** sqlite3_free() to release the memory. If an OOM condition is encountered,
|
||||||
|
** NULL is returned.
|
||||||
|
**
|
||||||
|
** If the second argument is not NULL, then its contents are prepended to
|
||||||
|
** the returned expression text and then freed using sqlite3_free().
|
||||||
*/
|
*/
|
||||||
static void exprToString(Fts3Expr *pExpr, char *zBuf){
|
static char *exprToString(Fts3Expr *pExpr, char *zBuf){
|
||||||
switch( pExpr->eType ){
|
switch( pExpr->eType ){
|
||||||
case FTSQUERY_PHRASE: {
|
case FTSQUERY_PHRASE: {
|
||||||
Fts3Phrase *pPhrase = pExpr->pPhrase;
|
Fts3Phrase *pPhrase = pExpr->pPhrase;
|
||||||
int i;
|
int i;
|
||||||
zBuf += sprintf(zBuf, "PHRASE %d %d", pPhrase->iColumn, pPhrase->isNot);
|
zBuf = sqlite3_mprintf(
|
||||||
for(i=0; i<pPhrase->nToken; i++){
|
"%zPHRASE %d %d", zBuf, pPhrase->iColumn, pPhrase->isNot);
|
||||||
zBuf += sprintf(zBuf," %.*s",pPhrase->aToken[i].n,pPhrase->aToken[i].z);
|
for(i=0; zBuf && i<pPhrase->nToken; i++){
|
||||||
zBuf += sprintf(zBuf,"%s", (pPhrase->aToken[i].isPrefix?"+":""));
|
zBuf = sqlite3_mprintf("%z %.*s%s", zBuf,
|
||||||
|
pPhrase->aToken[i].n, pPhrase->aToken[i].z,
|
||||||
|
(pPhrase->aToken[i].isPrefix?"+":"")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return;
|
return zBuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
case FTSQUERY_NEAR:
|
case FTSQUERY_NEAR:
|
||||||
zBuf += sprintf(zBuf, "NEAR/%d ", pExpr->nNear);
|
zBuf = sqlite3_mprintf("%zNEAR/%d ", zBuf, pExpr->nNear);
|
||||||
break;
|
break;
|
||||||
case FTSQUERY_NOT:
|
case FTSQUERY_NOT:
|
||||||
zBuf += sprintf(zBuf, "NOT ");
|
zBuf = sqlite3_mprintf("%zNOT ", zBuf);
|
||||||
break;
|
break;
|
||||||
case FTSQUERY_AND:
|
case FTSQUERY_AND:
|
||||||
zBuf += sprintf(zBuf, "AND ");
|
zBuf = sqlite3_mprintf("%zAND ", zBuf);
|
||||||
break;
|
break;
|
||||||
case FTSQUERY_OR:
|
case FTSQUERY_OR:
|
||||||
zBuf += sprintf(zBuf, "OR ");
|
zBuf = sqlite3_mprintf("%zOR ", zBuf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
zBuf += sprintf(zBuf, "{");
|
if( zBuf ) zBuf = sqlite3_mprintf("%z{", zBuf);
|
||||||
exprToString(pExpr->pLeft, zBuf);
|
if( zBuf ) zBuf = exprToString(pExpr->pLeft, zBuf);
|
||||||
zBuf += strlen(zBuf);
|
if( zBuf ) zBuf = sqlite3_mprintf("%z} {", zBuf);
|
||||||
zBuf += sprintf(zBuf, "} ");
|
|
||||||
|
|
||||||
zBuf += sprintf(zBuf, "{");
|
if( zBuf ) zBuf = exprToString(pExpr->pRight, zBuf);
|
||||||
exprToString(pExpr->pRight, zBuf);
|
if( zBuf ) zBuf = sqlite3_mprintf("%z}", zBuf);
|
||||||
zBuf += strlen(zBuf);
|
|
||||||
zBuf += sprintf(zBuf, "}");
|
return zBuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -856,6 +862,7 @@ static void fts3ExprTest(
|
|||||||
int nCol;
|
int nCol;
|
||||||
int ii;
|
int ii;
|
||||||
Fts3Expr *pExpr;
|
Fts3Expr *pExpr;
|
||||||
|
char *zBuf = 0;
|
||||||
sqlite3 *db = sqlite3_context_db_handle(context);
|
sqlite3 *db = sqlite3_context_db_handle(context);
|
||||||
|
|
||||||
if( argc<3 ){
|
if( argc<3 ){
|
||||||
@ -898,18 +905,17 @@ static void fts3ExprTest(
|
|||||||
rc = sqlite3Fts3ExprParse(
|
rc = sqlite3Fts3ExprParse(
|
||||||
pTokenizer, azCol, nCol, nCol, zExpr, nExpr, &pExpr
|
pTokenizer, azCol, nCol, nCol, zExpr, nExpr, &pExpr
|
||||||
);
|
);
|
||||||
if( rc==SQLITE_NOMEM ){
|
if( rc!=SQLITE_OK && rc!=SQLITE_NOMEM ){
|
||||||
sqlite3_result_error_nomem(context);
|
|
||||||
goto exprtest_out;
|
|
||||||
}else if( rc==SQLITE_OK ){
|
|
||||||
char zBuf[4096];
|
|
||||||
exprToString(pExpr, zBuf);
|
|
||||||
sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
|
|
||||||
sqlite3Fts3ExprFree(pExpr);
|
|
||||||
}else{
|
|
||||||
sqlite3_result_error(context, "Error parsing expression", -1);
|
sqlite3_result_error(context, "Error parsing expression", -1);
|
||||||
|
}else if( rc==SQLITE_NOMEM || !(zBuf = exprToString(pExpr, 0)) ){
|
||||||
|
sqlite3_result_error_nomem(context);
|
||||||
|
}else{
|
||||||
|
sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
|
||||||
|
sqlite3_free(zBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sqlite3Fts3ExprFree(pExpr);
|
||||||
|
|
||||||
exprtest_out:
|
exprtest_out:
|
||||||
if( pModule && pTokenizer ){
|
if( pModule && pTokenizer ){
|
||||||
rc = pModule->xDestroy(pTokenizer);
|
rc = pModule->xDestroy(pTokenizer);
|
||||||
|
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
|||||||
C Add\stests\sfor\svery\ssmall\scache-sizes\s(less\sthan\s10\spages).
|
C Fix\scompiler\swarnings\sdiscovered\swhile\sbuilding\sSQLite\son\s[http://www.devio.us/].
|
||||||
D 2010-11-29T16:10:02
|
D 2010-11-29T17:55:19
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in 4547616ad2286053af6ccccefa242dc925e49bf0
|
F Makefile.in 4547616ad2286053af6ccccefa242dc925e49bf0
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@ -64,7 +64,7 @@ F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
|
|||||||
F ext/fts3/fts3.c bae65cf771cd2c1dbcc972b064f770737cdbfca4
|
F ext/fts3/fts3.c bae65cf771cd2c1dbcc972b064f770737cdbfca4
|
||||||
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
|
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
|
||||||
F ext/fts3/fts3Int.h a6c69c1c5e2c8c19172ddff42d262c087dcd7337
|
F ext/fts3/fts3Int.h a6c69c1c5e2c8c19172ddff42d262c087dcd7337
|
||||||
F ext/fts3/fts3_expr.c f1cd71e78f73c99341d979619c14cac8b5c4f56f
|
F ext/fts3/fts3_expr.c 5f49e0deaf723724b08100bb3ff40aab02ad0c93
|
||||||
F ext/fts3/fts3_hash.c 3c8f6387a4a7f5305588b203fa7c887d753e1f1c
|
F ext/fts3/fts3_hash.c 3c8f6387a4a7f5305588b203fa7c887d753e1f1c
|
||||||
F ext/fts3/fts3_hash.h 8331fb2206c609f9fc4c4735b9ab5ad6137c88ec
|
F ext/fts3/fts3_hash.h 8331fb2206c609f9fc4c4735b9ab5ad6137c88ec
|
||||||
F ext/fts3/fts3_icu.c ac494aed69835008185299315403044664bda295
|
F ext/fts3/fts3_icu.c ac494aed69835008185299315403044664bda295
|
||||||
@ -160,7 +160,7 @@ F src/os.c 22ac61d06e72a0dac900400147333b07b13d8e1d
|
|||||||
F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9
|
F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9
|
||||||
F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
|
F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
|
||||||
F src/os_os2.c 72d0b2e562952a2464308c4ce5f7913ac10bef3e
|
F src/os_os2.c 72d0b2e562952a2464308c4ce5f7913ac10bef3e
|
||||||
F src/os_unix.c 6bbb2ac121efad111c8955d03d667946c73b1b42
|
F src/os_unix.c b392967bbf41f0563fdd8ad8bace6267db61270f
|
||||||
F src/os_win.c 2f90f7bdec714fad51cd31b4ecad3cc1b4bb5aad
|
F src/os_win.c 2f90f7bdec714fad51cd31b4ecad3cc1b4bb5aad
|
||||||
F src/pager.c c0aca5c733c15a16fe158c3215d857841a4e5381
|
F src/pager.c c0aca5c733c15a16fe158c3215d857841a4e5381
|
||||||
F src/pager.h 0ea59db2a33bc6c2c02cae34de33367e1effdf76
|
F src/pager.h 0ea59db2a33bc6c2c02cae34de33367e1effdf76
|
||||||
@ -890,7 +890,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 d23ef9b88c6705219e5138e50f0f351f6401c401
|
P 46b3fbdafe191cd0974cc3f46bc6aa52b3f1270e
|
||||||
R 546e2f66b6314089f25fcec06a2c561d
|
R 94418d1da4fe65366c1a1f528b5cbf20
|
||||||
U dan
|
U dan
|
||||||
Z cb014287023453ee46a4e79687ff5135
|
Z 9cee6345784230c66d992ddab0e65ff9
|
||||||
|
@ -1 +1 @@
|
|||||||
46b3fbdafe191cd0974cc3f46bc6aa52b3f1270e
|
5602ec95aa2a74d0624bb6c7d53e7a0d35536253
|
@ -5457,27 +5457,27 @@ static int proxyBreakConchLock(unixFile *pFile, uuid_t myHostID){
|
|||||||
pathLen = strlcpy(tPath, cPath, MAXPATHLEN);
|
pathLen = strlcpy(tPath, cPath, MAXPATHLEN);
|
||||||
if( pathLen>MAXPATHLEN || pathLen<6 ||
|
if( pathLen>MAXPATHLEN || pathLen<6 ||
|
||||||
(strlcpy(&tPath[pathLen-5], "break", 6) != 5) ){
|
(strlcpy(&tPath[pathLen-5], "break", 6) != 5) ){
|
||||||
sprintf(errmsg, "path error (len %d)", (int)pathLen);
|
sqlite3_snprintf(sizeof(errmsg),errmsg,"path error (len %d)",(int)pathLen);
|
||||||
goto end_breaklock;
|
goto end_breaklock;
|
||||||
}
|
}
|
||||||
/* read the conch content */
|
/* read the conch content */
|
||||||
readLen = pread(conchFile->h, buf, PROXY_MAXCONCHLEN, 0);
|
readLen = pread(conchFile->h, buf, PROXY_MAXCONCHLEN, 0);
|
||||||
if( readLen<PROXY_PATHINDEX ){
|
if( readLen<PROXY_PATHINDEX ){
|
||||||
sprintf(errmsg, "read error (len %d)", (int)readLen);
|
sqlite3_snprintf(sizeof(errmsg),errmsg,"read error (len %d)",(int)readLen);
|
||||||
goto end_breaklock;
|
goto end_breaklock;
|
||||||
}
|
}
|
||||||
/* write it out to the temporary break file */
|
/* write it out to the temporary break file */
|
||||||
fd = open(tPath, (O_RDWR|O_CREAT|O_EXCL), SQLITE_DEFAULT_FILE_PERMISSIONS);
|
fd = open(tPath, (O_RDWR|O_CREAT|O_EXCL), SQLITE_DEFAULT_FILE_PERMISSIONS);
|
||||||
if( fd<0 ){
|
if( fd<0 ){
|
||||||
sprintf(errmsg, "create failed (%d)", errno);
|
sqlite3_snprintf(sizeof(errmsg), errmsg, "create failed (%d)", errno);
|
||||||
goto end_breaklock;
|
goto end_breaklock;
|
||||||
}
|
}
|
||||||
if( pwrite(fd, buf, readLen, 0) != (ssize_t)readLen ){
|
if( pwrite(fd, buf, readLen, 0) != (ssize_t)readLen ){
|
||||||
sprintf(errmsg, "write failed (%d)", errno);
|
sqlite3_snprintf(sizeof(errmsg), errmsg, "write failed (%d)", errno);
|
||||||
goto end_breaklock;
|
goto end_breaklock;
|
||||||
}
|
}
|
||||||
if( rename(tPath, cPath) ){
|
if( rename(tPath, cPath) ){
|
||||||
sprintf(errmsg, "rename failed (%d)", errno);
|
sqlite3_snprintf(sizeof(errmsg), errmsg, "rename failed (%d)", errno);
|
||||||
goto end_breaklock;
|
goto end_breaklock;
|
||||||
}
|
}
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
Reference in New Issue
Block a user