From d1167393512012788bbe2b59dc9ebc1195e3148d Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 23 Jan 2006 13:00:35 +0000 Subject: [PATCH] Fix additional compiler warnings. Tickets #1615, #1616, #1627 (CVS 2994) FossilOrigin-Name: 6385628edd79187dff1687815d0101c31248e54f --- manifest | 22 +++++++++++----------- manifest.uuid | 2 +- src/btree.c | 8 ++++---- src/sqliteInt.h | 27 +++++++++++++++------------ src/tclsqlite.c | 6 +++++- src/util.c | 11 ++++++----- src/where.c | 12 +----------- 7 files changed, 43 insertions(+), 45 deletions(-) diff --git a/manifest b/manifest index 8b24ac78d7..3c1afefe7c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fixes\sfor\sOMIT_UTF16\sand\sOMIT_COMPOUND\s(CVS\s2993) -D 2006-01-23T07:52:38 +C Fix\sadditional\scompiler\swarnings.\s\sTickets\s#1615,\s#1616,\s#1627\s(CVS\s2994) +D 2006-01-23T13:00:36 F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967 F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -34,7 +34,7 @@ F src/alter.c 90b779cf00489535cab6490df6dc050f40e4e874 F src/analyze.c 7d2b7ab9a9c2fd6e55700f69064dfdd3e36d7a8a F src/attach.c 0081040e9a5d13669b6712e947688c10f030bfc1 F src/auth.c 9ae84d2d94eb96195e04515715e08e85963e96c2 -F src/btree.c 9de685a11ede765542a644441340cbed32380c3d +F src/btree.c ab0f6813b32e0db14883a71bd228470989dea609 F src/btree.h 5663c4f43e8521546ccebc8fc95acb013b8f3184 F src/build.c 15224e2fd348ad32b9044aaa5bdc912e4067da15 F src/callback.c 1bf497306c32229114f826707054df7ebe10abf2 @@ -70,9 +70,9 @@ F src/select.c 11ad28afb33bb83b655074c87557d4686c67f92f F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96 F src/shell.c 66b073375efbdee19045e7e0cd38b85f9aff71da F src/sqlite.h.in 492580f7e3ff71eb43193eb7bb98e2d549889ce3 -F src/sqliteInt.h 8cbeb4346a70ca47a2ec5935ec26b5c7f0b1948f +F src/sqliteInt.h fba26ce93a090aed928bcb1edcc58c0c1717c5b0 F src/table.c 486dcfce532685b53b5a2b5da8bba0ded6fb2316 -F src/tclsqlite.c d650bea0248fc0a310ddc2cb94273a3a5021fddf +F src/tclsqlite.c 7764ab34df617b3d3cfd5f0fdf3444ed219c11d6 F src/test1.c 846b3731af01ac90bad583f55e7969c8fb232172 F src/test2.c ca74a1d8aeb7d9606e8f6b762c5daf85c1a3f92b F src/test3.c 86e99724ee898b119ed575ef9f98618afe7e5e5d @@ -85,7 +85,7 @@ F src/tokenize.c 9ae9a59238eb97fbc61baea280563b91100518fb F src/trigger.c 4d3644cbd16959b568c95ae73493402be8021b08 F src/update.c 14be4ba2f438919b4217085c02feff569e6cf1f2 F src/utf.c 5ab8ca05d4e9ec81174b010f01ab12a232f0087d -F src/util.c 2510e040166cb07b7e8ed0c1ccaec22350d57df4 +F src/util.c 8c2e824e0bab3e5d1673213235e5dc0bdec441d4 F src/vacuum.c 3865673cc66acd0717ecd517f6b8fdb2a5e7924b F src/vdbe.c e04bf3035a7dc547e80ba1130a716a7e8c9f7c93 F src/vdbe.h 8729a4ee16ff9aeab2af9667df3cf300ff978e13 @@ -94,7 +94,7 @@ F src/vdbeapi.c dcb2636f49b4807e34960d52a2fc257b3a751140 F src/vdbeaux.c 1dce6e5f51d6119220e12ecbceccccf97ca8b8be F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5 F src/vdbemem.c 2034e93b32c14bda6e306bb54e3a8e930b963027 -F src/where.c 7ce7a52fdc696d26cd9f9c939dc972585d3dd72d +F src/where.c 4c77a9dc132095a73021186a90fe44ba086f67ce F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42 F test/aggerror.test b854de90f530ae37be68fbfe6de40e111358cbb2 F test/all.test 5df90d015ca63fcef2a4b62c24f7316b66c4bfd4 @@ -344,7 +344,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 -P cc2e8e87cfd474b4dc6833ee0c38e2cd2dd3a494 -R e7686387c0d32f2c77df0a39b8385c89 -U danielk1977 -Z de4e011a442de96ed72224d63af9baef +P f58bbdc0ac6e618686c598aaafb3a41b972e078e +R 0db26160e071e13e253b47ccdbdc4fe3 +U drh +Z bfce48ac39b5c5b64554076983aa10ce diff --git a/manifest.uuid b/manifest.uuid index a708a94a20..826610e05e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f58bbdc0ac6e618686c598aaafb3a41b972e078e \ No newline at end of file +6385628edd79187dff1687815d0101c31248e54f \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 52a127a338..89c3f9750f 100644 --- a/src/btree.c +++ b/src/btree.c @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btree.c,v 1.307 2006/01/22 21:52:57 drh Exp $ +** $Id: btree.c,v 1.308 2006/01/23 13:00:36 drh Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** For a detailed discussion of BTrees, refer to @@ -5282,9 +5282,9 @@ int sqlite3BtreeDelete(BtCursor *pCur){ ** that the entry will be deleted from. */ if( - (rc = restoreOrClearCursorPosition(pCur, 1)) || - (rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur)) || - (rc = sqlite3pager_write(pPage->aData)) + (rc = restoreOrClearCursorPosition(pCur, 1))!=0 || + (rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur))!=0 || + (rc = sqlite3pager_write(pPage->aData))!=0 ){ return rc; } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index cee8fc834c..0814b1418c 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.476 2006/01/23 00:04:55 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.477 2006/01/23 13:00:38 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -73,10 +73,15 @@ #ifdef SQLITE_OMIT_FLOATING_POINT # define double sqlite_int64 # define LONGDOUBLE_TYPE sqlite_int64 -# define SQLITE_BIG_DBL (0x7fffffffffffffff) +# ifndef SQLITE_BIG_DBL +# define SQLITE_BIG_DBL (0x7fffffffffffffff) +# endif # define SQLITE_OMIT_DATETIME_FUNCS 1 # define SQLITE_OMIT_TRACE 1 #endif +#ifndef SQLITE_BIG_DBL +# define SQLITE_BIG_DBL (1e99) +#endif /* ** The maximum number of in-memory pages to use for the main database @@ -693,7 +698,6 @@ struct Table { int tnum; /* Root BTree node for this table (see note above) */ Select *pSelect; /* NULL for tables. Points to definition if a view. */ u8 readOnly; /* True if this table should not be written by the user */ -// u8 iDb; /* Index into sqlite.aDb[] of the backend for this table */ u8 isTransient; /* True if automatically deleted when VDBE finishes */ u8 hasPrimKey; /* True if there exists a primary key */ u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */ @@ -957,7 +961,6 @@ struct AggInfo { struct Expr { u8 op; /* Operation performed by this node */ char affinity; /* The affinity of the column or 0 if not a column */ -//u8 iDb; /* Database referenced by this expression */ u8 flags; /* Various flags. See below */ CollSeq *pColl; /* The collation type of the column or 0 */ Expr *pLeft, *pRight; /* Left and right subnodes */ @@ -1742,8 +1745,8 @@ int sqlite3CreateFunc(sqlite3 *, const char *, int, int, void *, void (*)(sqlite3_context*,int,sqlite3_value **), void (*)(sqlite3_context*,int,sqlite3_value **), void (*)(sqlite3_context*)); int sqlite3ApiExit(sqlite3 *db, int); -int sqlite3MallocFailed(); -void sqlite3FailedMalloc(); +int sqlite3MallocFailed(void); +void sqlite3FailedMalloc(void); #ifndef SQLITE_OMIT_SHARED_CACHE void sqlite3TableLock(Parse *, int, int, u8, const char *); @@ -1752,13 +1755,13 @@ void sqlite3FailedMalloc(); #endif #ifdef SQLITE_MEMDEBUG - void sqlite3MallocDisallow(); - void sqlite3MallocAllow(); - int sqlite3TestMallocFail(); + void sqlite3MallocDisallow(void); + void sqlite3MallocAllow(void); + int sqlite3TestMallocFail(void); #else - #define sqlite3TestMallocFail() 0 - #define sqlite3MallocDisallow() - #define sqlite3MallocAllow() + #define sqlite3TestMallocFail(void) 0 + #define sqlite3MallocDisallow(void) + #define sqlite3MallocAllow(void) #endif #ifdef SQLITE_SSE diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 96e8e274bf..427bc45ddb 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -11,7 +11,7 @@ ************************************************************************* ** A TCL Interface to SQLite ** -** $Id: tclsqlite.c,v 1.149 2006/01/09 23:40:25 drh Exp $ +** $Id: tclsqlite.c,v 1.150 2006/01/23 13:00:38 drh Exp $ */ #ifndef NO_TCL /* Omit this whole file if TCL is unavailable */ @@ -256,6 +256,7 @@ static int DbProgressHandler(void *cd){ return 0; } +#ifndef SQLITE_OMIT_TRACE /* ** This routine is called by the SQLite trace handler whenever a new ** block of SQL is executed. The TCL script in pDb->zTrace is executed. @@ -271,7 +272,9 @@ static void DbTraceHandler(void *cd, const char *zSql){ Tcl_DStringFree(&str); Tcl_ResetResult(pDb->interp); } +#endif +#ifndef SQLITE_OMIT_TRACE /* ** This routine is called by the SQLite profile handler after a statement ** SQL has executed. The TCL script in pDb->zProfile is evaluated. @@ -290,6 +293,7 @@ static void DbProfileHandler(void *cd, const char *zSql, sqlite_uint64 tm){ Tcl_DStringFree(&str); Tcl_ResetResult(pDb->interp); } +#endif /* ** This routine is called when a transaction is committed. The diff --git a/src/util.c b/src/util.c index 233aa7bb5c..9f4d082467 100644 --- a/src/util.c +++ b/src/util.c @@ -14,7 +14,7 @@ ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** -** $Id: util.c,v 1.180 2006/01/20 17:56:33 drh Exp $ +** $Id: util.c,v 1.181 2006/01/23 13:00:38 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -559,7 +559,7 @@ static int handleSoftLimit(int n){ void *sqlite3MallocRaw(int n){ void *p = 0; if( n>0 && !sqlite3MallocFailed() && !handleSoftLimit(n) ){ - while( !(p = OSMALLOC(n)) && sqlite3_release_memory(n) ); + while( (p = OSMALLOC(n))==0 && sqlite3_release_memory(n) ); if( !p ){ /* If the allocation failed, call handleSoftLimit() again, this time ** with the additive inverse of the argument passed to @@ -589,7 +589,7 @@ void *sqlite3Realloc(void *p, int n){ }else{ void *np = 0; if( !handleSoftLimit(n - OSSIZEOF(p)) ){ - while( !(np = OSREALLOC(p, n)) && sqlite3_release_memory(n) ); + while( (np = OSREALLOC(p, n))==0 && sqlite3_release_memory(n) ); if( !np ){ /* If the allocation failed, call handleSoftLimit() again, this time ** with the additive inverse of the argument passed to @@ -743,7 +743,7 @@ void sqlite3SetString(char **pz, ...){ ** to NULL. */ void sqlite3Error(sqlite3 *db, int err_code, const char *zFormat, ...){ - if( db && (db->pErr || (db->pErr = sqlite3ValueNew()))!=0 ){ + if( db && (db->pErr || (db->pErr = sqlite3ValueNew())!=0) ){ db->errCode = err_code; if( zFormat ){ char *z; @@ -1337,7 +1337,8 @@ ThreadData *sqlite3ThreadData(){ ** to a substitute ThreadData structure that is all zeros. */ const ThreadData *sqlite3ThreadDataReadOnly(){ - static const ThreadData zeroData; + static const ThreadData zeroData = {0}; /* Initializer to silence warnings + ** from broken compilers */ const ThreadData *pTd = sqlite3OsThreadSpecificData(0); return pTd ? pTd : &zeroData; } diff --git a/src/where.c b/src/where.c index 42766195cf..8130bb1ee2 100644 --- a/src/where.c +++ b/src/where.c @@ -16,7 +16,7 @@ ** so is applicable. Because this module is responsible for selecting ** indices, you might also think of this module as the "query optimizer". ** -** $Id: where.c,v 1.200 2006/01/20 18:10:57 drh Exp $ +** $Id: where.c,v 1.201 2006/01/23 13:00:38 drh Exp $ */ #include "sqliteInt.h" @@ -40,16 +40,6 @@ int sqlite3_where_trace = 0; # define TRACE(X) #endif -/* -** A large value which is the maximum cost of using an index. -** By default this is a large floating point value. When compiling -** SQLite for a processor that lacks floating point support, simply -** redefine this constant to a large integer. -*/ -#ifndef SQLITE_BIG_DBL -# define SQLITE_BIG_DBL (1.0e+99) -#endif - /* Forward reference */ typedef struct WhereClause WhereClause; -- 2.47.2