]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix harmless compiler warnings. Improved comments in the query optimizer. (CVS 5982)
authordrh <drh@noemail.net>
Fri, 5 Dec 2008 17:17:07 +0000 (17:17 +0000)
committerdrh <drh@noemail.net>
Fri, 5 Dec 2008 17:17:07 +0000 (17:17 +0000)
FossilOrigin-Name: adedd697b475dadaa2eeae0d0413603195c955cf

manifest
manifest.uuid
src/mem2.c
src/mutex_noop.c
src/shell.c
src/sqliteInt.h
src/test1.c
src/where.c

index ad9f74259efcf54cd6c26a3c2e892d7732d37e3a..84e5f781ddb07f1f489114372e9dcfd8fffca20d 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Make\suse\sof\ssqlite3DbMallocSize\sto\smaximize\sthe\ssize\sof\sgrowable\sbuffers\nafter\seach\sreallocation.\s\sAdded\snew\scomments\sand\stestcase()\smacros\sto\nwhere.c.\s(CVS\s5981)
-D 2008-12-05T15:24:16
+C Fix\sharmless\scompiler\swarnings.\s\sImproved\scomments\sin\sthe\squery\soptimizer.\s(CVS\s5982)
+D 2008-12-05T17:17:08
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in f7e4c81c347b04f7b0f1c1b081a168645d7b8af7
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -123,13 +123,13 @@ F src/main.c d67d2eee7a643a4a894e5de91231a99ad88400b9
 F src/malloc.c 89c7c58fbec06b80101fdc6dcdf9ee849b7cd7ac
 F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c
 F src/mem1.c bb8e26adde7d463270e961f045802c61dbabc8f1
-F src/mem2.c 5d9968f576ba1babc787adbfb613cf428ab484ec
+F src/mem2.c 7029ff791a248a634b1cad2c92f8cda100e09c16
 F src/mem3.c 67153ec933e08b70714055e872efb58a6b287939
 F src/mem5.c 838309b521c96a2a34507f74a5a739d28de4aac6
 F src/memjournal.c bd536c4d6d701b4fa7428545128c5684d2adf779
 F src/mutex.c e9cb5fbe94afb4328869afaf3ac49bd1327559eb
 F src/mutex.h 9e686e83a88838dac8b9c51271c651e833060f1e
-F src/mutex_noop.c 0004efdbc2fd48d261d5b3416fe537e888c79a54
+F src/mutex_noop.c f5a07671f25a1a9bd7c10ad7107bc2585446200f
 F src/mutex_os2.c 6b5a74f812082a8483c3df05b47bbaac2424b9a0
 F src/mutex_unix.c 3b1c895a044d45812ea1eae9019daeff8cfb27ce
 F src/mutex_w32.c 017b522f63ef09b834fefc9daa876c9ec167e7b5
@@ -152,15 +152,15 @@ F src/random.c a87afbd598aa877e23ac676ee92fd8ee5c786a51
 F src/resolve.c 4af5391d2b4c1d6c583a6805ac6660181de4545b
 F src/rowset.c 2256fa4a928f750e2f3d6fc733523034beceb1d6
 F src/select.c e2127ce827914824c284046c66bf9259745b6be8
-F src/shell.c 838c745e7ac5c9fe17bc996224ed2f928d178bb2
+F src/shell.c be9eeb5811d1ad6ebbf6ae8b5aa04ae1368af033
 F src/sqlite.h.in b5d50f12fb9c7460a4ddfef8c1e799afaabefebf
 F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
-F src/sqliteInt.h c8c99ad0d006f0e9957dc3e859ef53dd4a781a06
+F src/sqliteInt.h 391992f5bd54560758c618f7b858c1c4ea060883
 F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
 F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76
 F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8
 F src/tclsqlite.c 96049bd454f1547abff0a57c45f0dfa57701e076
-F src/test1.c 81063a634c0970a7dcb8ba8b58b7645be166a328
+F src/test1.c 30986773b10d75904f21bae5c3e8e8b9f20fa479
 F src/test2.c 897528183edf2839c2a3c991d415905db56f1240
 F src/test3.c 88a246b56b824275300e6c899634fbac1dc94b14
 F src/test4.c f79ab52d27ff49b784b631a42e2ccd52cfd5c84c
@@ -203,7 +203,7 @@ F src/vdbeblob.c b0dcebfafedcf9c0addc7901ad98f6f986c08935
 F src/vdbemem.c 360396ac77b2da36a8cfc280e7c055482f0254e8
 F src/vtab.c 02c51eac45dbff1a1d6e73f58febf92ecb563f7f
 F src/walker.c 488c2660e13224ff70c0c82761118efb547f8f0d
-F src/where.c 78ecad37fdbb8df030c532a77d5c99b8c8f2b7ae
+F src/where.c d27611213e9fcbe99f4158bffd7c917a2b8672f0
 F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/alias.test 597662c5d777a122f9a3df0047ea5c5bd383a911
@@ -663,7 +663,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 81bd0b5ce8a1cf057064c44e9b5371502cb8c58c
-R 53922c8edc023a196f42abe6cad4dc9c
+P 46f2d08959423e130a5b346138311649d92f0fde
+R 96105d8de358fb97d30ada8cbb7880b2
 U drh
-Z 347f5152aa243c9ea5c9c8cc7007f532
+Z d6ba8ef05cc5f5653a1e2350d4d75f6c
index 97ec2be3d9014e4223e3f8c139ca5326529306aa..3978b918715779783c93efc46960198ea1c5fce7 100644 (file)
@@ -1 +1 @@
-46f2d08959423e130a5b346138311649d92f0fde
\ No newline at end of file
+adedd697b475dadaa2eeae0d0413603195c955cf
\ No newline at end of file
index 1fce769bf08647330b9cc32e4c66d17ef4ed1d72..aaa58e2d10cc3a151c7c7741b64a91a54665945e 100644 (file)
@@ -19,7 +19,7 @@
 ** This file contains implementations of the low-level memory allocation
 ** routines specified in the sqlite3_mem_methods object.
 **
-** $Id: mem2.c,v 1.40 2008/10/28 18:58:20 drh Exp $
+** $Id: mem2.c,v 1.41 2008/12/05 17:17:08 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -158,11 +158,11 @@ static struct MemBlockHdr *sqlite3MemsysGetHeader(void *pAllocation){
 
   p = (struct MemBlockHdr*)pAllocation;
   p--;
-  assert( p->iForeGuard==FOREGUARD );
+  assert( p->iForeGuard==(int)FOREGUARD );
   nReserve = (p->iSize+7)&~7;
   pInt = (int*)pAllocation;
   pU8 = (u8*)pAllocation;
-  assert( pInt[nReserve/sizeof(int)]==REARGUARD );
+  assert( pInt[nReserve/sizeof(int)]==(int)REARGUARD );
   assert( (nReserve-0)<=p->iSize || pU8[nReserve-1]==0x65 );
   assert( (nReserve-1)<=p->iSize || pU8[nReserve-2]==0x65 );
   assert( (nReserve-2)<=p->iSize || pU8[nReserve-3]==0x65 );
@@ -185,6 +185,7 @@ static int sqlite3MemSize(void *p){
 ** Initialize the memory allocation subsystem.
 */
 static int sqlite3MemInit(void *NotUsed){
+  UNUSED_PARAMETER(NotUsed);
   if( !sqlite3GlobalConfig.bMemstat ){
     /* If memory status is enabled, then the malloc.c wrapper will already
     ** hold the STATIC_MEM mutex when the routines here are invoked. */
@@ -197,6 +198,7 @@ static int sqlite3MemInit(void *NotUsed){
 ** Deinitialize the memory allocation subsystem.
 */
 static void sqlite3MemShutdown(void *NotUsed){
+  UNUSED_PARAMETER(NotUsed);
   mem.mutex = 0;
 }
 
@@ -361,7 +363,7 @@ void sqlite3MemdebugBacktraceCallback(void (*xBacktrace)(int, int, void **)){
 ** Set the title string for subsequent allocations.
 */
 void sqlite3MemdebugSettitle(const char *zTitle){
-  int n = strlen(zTitle) + 1;
+  unsigned int n = strlen(zTitle) + 1;
   sqlite3_mutex_enter(mem.mutex);
   if( n>=sizeof(mem.zTitle) ) n = sizeof(mem.zTitle)-1;
   memcpy(mem.zTitle, zTitle, n);
index ecee9a9a21083278fe0775e363d8e962a7878e79..7c13244dbde9cb03177a7cab00ab0adfb074ab4d 100644 (file)
@@ -25,7 +25,7 @@
 ** that does error checking on mutexes to make sure they are being
 ** called correctly.
 **
-** $Id: mutex_noop.c,v 1.2 2008/10/15 19:03:03 drh Exp $
+** $Id: mutex_noop.c,v 1.3 2008/12/05 17:17:08 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -116,7 +116,7 @@ static sqlite3_mutex *debugMutexAlloc(int id){
     }
     default: {
       assert( id-2 >= 0 );
-      assert( id-2 < sizeof(aStatic)/sizeof(aStatic[0]) );
+      assert( id-2 < (int)(sizeof(aStatic)/sizeof(aStatic[0])) );
       pNew = &aStatic[id-2];
       pNew->id = id;
       break;
index 0581807b5f68024c093a3bfda5e6e372eb2fcccf..141b1256fd2954ff64ab7602a418538d43d534c1 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains code to implement the "sqlite" command line
 ** utility for accessing SQLite databases.
 **
-** $Id: shell.c,v 1.189 2008/12/04 12:26:01 drh Exp $
+** $Id: shell.c,v 1.190 2008/12/05 17:17:08 drh Exp $
 */
 #include <stdlib.h>
 #include <string.h>
@@ -66,6 +66,12 @@ extern int isatty();
 #include <sys/time.h>
 #include <sys/resource.h>
 
+/*
+** Used to prevent warnings about unused parameters
+*/
+#define UNUSED_PARAMETER(x) (void)(x)
+
+
 /* Saved resource information for the beginning of an operation */
 static struct rusage sBegin;
 
@@ -216,6 +222,7 @@ static void shellstaticFunc(
 ){
   assert( 0==argc );
   assert( zShellStatic );
+  UNUSED_PARAMETER(argv);
   sqlite3_result_text(context, zShellStatic, -1, SQLITE_STATIC);
 }
 
@@ -355,7 +362,7 @@ static const char *modeDescr[] = {
 /*
 ** Number of elements in an array
 */
-#define ArraySize(X)  (sizeof(X)/sizeof(X[0]))
+#define ArraySize(X)  (int)(sizeof(X)/sizeof(X[0]))
 
 /*
 ** Output the given string as a quoted string using SQL quoting conventions.
@@ -502,6 +509,7 @@ static void output_csv(struct callback_data *p, const char *z, int bSep){
 ** This routine runs when the user presses Ctrl-C
 */
 static void interrupt_handler(int NotUsed){
+  UNUSED_PARAMETER(NotUsed);
   seenInterrupt = 1;
   if( db ) sqlite3_interrupt(db);
 }
@@ -574,7 +582,7 @@ static int callback(void *pArg, int nArg, char **azArg, char **azCol){
         }else{
            w = 10;
         }
-        if( p->mode==MODE_Explain && azArg[i] && strlen(azArg[i])>w ){
+        if( p->mode==MODE_Explain && azArg[i] && strlen(azArg[i])>(unsigned)w ){
           w = strlen(azArg[i]);
         }
         fprintf(p->out,"%-*.*s%s",w,w,
@@ -793,6 +801,7 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azCol){
   const char *zSql;
   struct callback_data *p = (struct callback_data *)pArg;
 
+  UNUSED_PARAMETER(azCol);
   if( nArg!=3 ) return 1;
   zTable = azArg[0];
   zType = azArg[1];
index c03b6b476ca88016126496c5ec45b26564e8374c..5758aa4078335cd2be42e1defc05b1a684a05c09 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** Internal interface definitions for SQLite.
 **
-** @(#) $Id: sqliteInt.h,v 1.801 2008/12/05 02:36:34 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.802 2008/12/05 17:17:08 drh Exp $
 */
 #ifndef _SQLITEINT_H_
 #define _SQLITEINT_H_
@@ -1517,7 +1517,7 @@ struct SrcList {
 */
 struct WhereLevel {
   int iFrom;            /* Which entry in the FROM clause */
-  int wsFlags;          /* "Where-Scan Flags" associated with this level */
+  int wsFlags;          /* "Where-Scan" flags show the choosen scan strategy */
   int iMem;             /* First memory cell used by this level */
   int iLeftJoin;        /* Memory cell used to implement LEFT OUTER JOIN */
   Index *pIdx;          /* Index used.  NULL if no index */
index 807ad61a7ca816b134cfa15ddbab2c678b9e4c20..4e7ba565e0a96f3a32d0f90a6d670a238fb5a7c6 100644 (file)
@@ -13,7 +13,7 @@
 ** is not included in the SQLite library.  It is used for automated
 ** testing of the SQLite library.
 **
-** $Id: test1.c,v 1.335 2008/12/03 22:32:45 drh Exp $
+** $Id: test1.c,v 1.336 2008/12/05 17:17:08 drh Exp $
 */
 #include "sqliteInt.h"
 #include "tcl.h"
@@ -3915,7 +3915,7 @@ static int sqlite_set_magic(
     db->magic = SQLITE_MAGIC_BUSY;
   }else if( strcmp(argv[2], "SQLITE_MAGIC_ERROR")==0 ){
     db->magic = SQLITE_MAGIC_ERROR;
-  }else if( Tcl_GetInt(interp, argv[2], &db->magic) ){
+  }else if( Tcl_GetInt(interp, argv[2], (int*)&db->magic) ){
     return TCL_ERROR;
   }
   return TCL_OK;
@@ -4516,9 +4516,7 @@ static int file_control_lockproxy_test(
   int objc,              /* Number of arguments */
   Tcl_Obj *CONST objv[]  /* Command arguments */
 ){
-  int iArg = 0;
   sqlite3 *db;
-  int rc;
   
   if( objc!=2 ){
     Tcl_AppendResult(interp, "wrong # args: should be \"",
index c2693ba030fe62bde68d1387f01c792433182a5a..2794d4f0a28b2c47676659b4f627368ccfa28c6b 100644 (file)
@@ -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.332 2008/12/05 15:24:17 drh Exp $
+** $Id: where.c,v 1.333 2008/12/05 17:17:08 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -280,7 +280,7 @@ static int whereClauseInsert(WhereClause *pWC, Expr *p, int wtFlags){
 ** does is make slot[] entries point to substructure within pExpr.
 **
 ** In the previous sentence and in the diagram, "slot[]" refers to
-** the WhereClause.a[] array.  This array grows as needed to contain
+** the WhereClause.a[] array.  The slot[] array grows as needed to contain
 ** all terms of the WHERE clause.
 */
 static void whereSplit(WhereClause *pWC, Expr *pExpr, int op){
@@ -391,7 +391,7 @@ static int allowedOp(int op){
 }
 
 /*
-** Swap two objects of type T.
+** Swap two objects of type TYPE.
 */
 #define SWAP(TYPE,A,B) {TYPE t=A; A=B; B=t;}