diff options
author | drh <drh@noemail.net> | 2008-12-05 17:17:07 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2008-12-05 17:17:07 +0000 |
commit | 902b9ee436e98111b2ec1ecf95dd869673d5f568 (patch) | |
tree | b12b30a122c35e0ce80037412b3a5e3586d1f356 /src | |
parent | 6a1e071f3d8701fd1d60610727ce085ce494f6d7 (diff) | |
download | sqlite-902b9ee436e98111b2ec1ecf95dd869673d5f568.tar.gz sqlite-902b9ee436e98111b2ec1ecf95dd869673d5f568.zip |
Fix harmless compiler warnings. Improved comments in the query optimizer. (CVS 5982)
FossilOrigin-Name: adedd697b475dadaa2eeae0d0413603195c955cf
Diffstat (limited to 'src')
-rw-r--r-- | src/mem2.c | 10 | ||||
-rw-r--r-- | src/mutex_noop.c | 4 | ||||
-rw-r--r-- | src/shell.c | 15 | ||||
-rw-r--r-- | src/sqliteInt.h | 4 | ||||
-rw-r--r-- | src/test1.c | 6 | ||||
-rw-r--r-- | src/where.c | 6 |
6 files changed, 27 insertions, 18 deletions
diff --git a/src/mem2.c b/src/mem2.c index 1fce769bf..aaa58e2d1 100644 --- a/src/mem2.c +++ b/src/mem2.c @@ -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); diff --git a/src/mutex_noop.c b/src/mutex_noop.c index ecee9a9a2..7c13244db 100644 --- a/src/mutex_noop.c +++ b/src/mutex_noop.c @@ -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; diff --git a/src/shell.c b/src/shell.c index 0581807b5..141b1256f 100644 --- a/src/shell.c +++ b/src/shell.c @@ -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]; diff --git a/src/sqliteInt.h b/src/sqliteInt.h index c03b6b476..5758aa407 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -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 */ diff --git a/src/test1.c b/src/test1.c index 807ad61a7..4e7ba565e 100644 --- a/src/test1.c +++ b/src/test1.c @@ -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 \"", diff --git a/src/where.c b/src/where.c index c2693ba03..2794d4f0a 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.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;} |