]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix some warnings about unused and uninitialized variables. (CVS 3788)
authordrh <drh@noemail.net>
Sun, 1 Apr 2007 23:49:51 +0000 (23:49 +0000)
committerdrh <drh@noemail.net>
Sun, 1 Apr 2007 23:49:51 +0000 (23:49 +0000)
FossilOrigin-Name: 18aec1ddfb08b74f0ef9cf1215eac7af71449db3

manifest
manifest.uuid
src/insert.c
src/os_common.h
src/os_unix.c
src/os_win.c
src/pager.c
src/select.c
src/vdbeaux.c
src/vdbemem.c

index b20049d87b7dc8640051f59f0cc93e96e0a1dccd..f8bd4593250ebd844a11d5a0a0443072d4a87a4f 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Make\sunix\sbuilds\sthreadsafe\sby\sdefault.\s(CVS\s3787)
-D 2007-04-01T18:46:19
+C Fix\ssome\swarnings\sabout\sunused\sand\suninitialized\svariables.\s(CVS\s3788)
+D 2007-04-01T23:49:52
 F Makefile.in 2f2c3bf69faf0ae7b8e8af4f94f1986849034530
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -70,30 +70,30 @@ F src/expr.c a8740c24af3f39f2d502be1a1c640c96435eaac0
 F src/func.c 94372fe3cf26b81d4dcdc15f98ff240c37c8c708
 F src/hash.c 67b23e14f0257b69a3e8aa663e4eeadc1a2b6fd5
 F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564
-F src/insert.c 664e4ccabc6393dc3be08ce2c47ccfea4b049e15
+F src/insert.c 967be8c143d64c904ba4e6f66760824898a75e3c
 F src/legacy.c 2631df6a861f830d6b1c0fe92b9fdd745b2c0cd6
 F src/loadext.c 146fb9b9dc6133e763888d710205c32ebf8eeca2
 F src/main.c a0e10c0888bdf40b7a10f11bc2581b1da3a9077a
 F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
 F src/os.c 5a194b9b9a10dc66543d4ca22bc0db40c5cc5ef1
 F src/os.h 506acdfd0a63802434ceacdbfd7c006e5d90fc53
-F src/os_common.h c86e8cbd6150ca06d46b09ec02ff5fc5d4b05285
+F src/os_common.h 0969285cc1e0b1ccc7a2cd7ce8eb144176ce3369
 F src/os_os2.c 2ce97909b926a598823f97338027dbec1dcf4165
 F src/os_os2.h e5f17dd69333632bbc3112881ea407c37d245eb3
 F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
 F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
-F src/os_unix.c 5e3cbef7efc5f8481c2242fb2cad3577dcbfb8f9
+F src/os_unix.c ccb003fb9fadc032924d3efb3fa8cc69fd9e176b
 F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
-F src/os_win.c c3a8403ea28bbb89d6507fa984c5919bd3fe7539
+F src/os_win.c c9a99524d6b2bdec636264cad1b67553925e3309
 F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
-F src/pager.c 5d07eba846ef4f2067e6640d3f941dbf7668b8f6
+F src/pager.c 84072e9b5f370752176e5f7575557496bf239bc3
 F src/pager.h e79a24cf200b8771366217f5bca414f5b7823f42
 F src/parse.y 207ab04273ae13aa4a729b96008d294d5f334ab3
 F src/pragma.c 3b992b5b2640d6ae25cef05aa6a42cd1d6c43234
 F src/prepare.c 37207b2b2ccb41d379b01dd62231686bcc48ef1f
 F src/printf.c 0c6f40648770831341ac45ab32423a80b4c87f05
 F src/random.c 6119474a6f6917f708c1dee25b9a8e519a620e88
-F src/select.c 30af458c6a0a4a283c67b56c70ff0712b67d42ae
+F src/select.c 41b1997441ee314e681e981346d328665263bc44
 F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
 F src/shell.c 3ae4654560e91220a95738a73d135d91d937cda1
 F src/sqlite.h.in e429f66f9245c7f8675db24b230c950b8672ad1c
@@ -127,9 +127,9 @@ F src/vdbe.c 87e31f0790ac8a5aad7b7fcd5b97948943fccba3
 F src/vdbe.h 0025259af1939fb264a545816c69e4b5b8d52691
 F src/vdbeInt.h 4b19fd8febad3fd14c4c97adaefc06754d323132
 F src/vdbeapi.c 7ac14f2e3b2283dcd35f5edefd31a8342cff783c
-F src/vdbeaux.c a77bf70260ac1802dccf1076088700cc51d81fa3
+F src/vdbeaux.c 464df6616ea25b2f750b714f9bc2df45aa5e9f6e
 F src/vdbefifo.c 3ca8049c561d5d67cbcb94dc909ae9bb68c0bf8f
-F src/vdbemem.c d3696b4b0e5f32272659816cdfa2348c650b1ba0
+F src/vdbemem.c 981a113405bd9b80aeb71fe246a2f01708e8a8f7
 F src/vtab.c 7fbda947e28cbe7adb3ba752a76ca9ef29936750
 F src/where.c 25e0dbb96c6980d11cc756c2b4abdfda80cd67a5
 F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
@@ -447,7 +447,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P a5070a2d11b4dad550a889d5fc005302208b6d75
-R a9d9872807c3c8809d1d420db21f68d7
+P ddfc3b2df0b37be66fc55bb216cdcb6ba67aa7fd
+R 6aaccc938ac434f31b7ba1499b082549
 U drh
-Z 410804ccf938e00b1fc895783b26c1d2
+Z 1690edfe26c670d8db633c5c98f82e61
index 66fdf71a646f0478dd303b5ac95476508ebddf38..410946c1a83feb7c5e82a1a064191b89d3c10e50 100644 (file)
@@ -1 +1 @@
-ddfc3b2df0b37be66fc55bb216cdcb6ba67aa7fd
\ No newline at end of file
+18aec1ddfb08b74f0ef9cf1215eac7af71449db3
\ No newline at end of file
index da2f8644c918aeb33cddca52bda8a92d40f7608e..34f87432dc98947fd5198b24d2ea0ee9c89ccda2 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains C code routines that are called by the parser
 ** to handle INSERT statements in SQLite.
 **
-** $Id: insert.c,v 1.182 2007/03/31 13:00:26 drh Exp $
+** $Id: insert.c,v 1.183 2007/04/01 23:49:52 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -1374,7 +1374,7 @@ static int xferOptimization(
   int addr1, addr2;                /* Loop addresses */
   int emptyDestTest;               /* Address of test for empty pDest */
   int emptySrcTest;                /* Address of test for empty pSrc */
-  int memRowid;                    /* A memcell containing a rowid from pSrc */
+  int memRowid = 0;                /* A memcell containing a rowid from pSrc */
   Vdbe *v;                         /* The VDBE we are building */
   KeyInfo *pKey;                   /* Key information for an index */
   int counterMem;                  /* Memory register used by AUTOINC */
index e6e7fd97823ff4a6346fe0d24f10e8875b8aff86..6aa244f9c81f77271b5204e48eb3f0677148c71a 100644 (file)
@@ -38,8 +38,6 @@ unsigned int sqlite3_pending_byte = 0x40000000;
 
 int sqlite3_os_trace = 0;
 #ifdef SQLITE_DEBUG
-static int last_page = 0;
-#define SEEK(X)           last_page=(X)
 #define OSTRACE1(X)         if( sqlite3_os_trace ) sqlite3DebugPrintf(X)
 #define OSTRACE2(X,Y)       if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y)
 #define OSTRACE3(X,Y,Z)     if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y,Z)
@@ -50,7 +48,6 @@ static int last_page = 0;
 #define OSTRACE7(X,Y,Z,A,B,C,D) \
     if(sqlite3_os_trace) sqlite3DebugPrintf(X,Y,Z,A,B,C,D)
 #else
-#define SEEK(X)
 #define OSTRACE1(X)
 #define OSTRACE2(X,Y)
 #define OSTRACE3(X,Y,Z)
index dedb6b6b999c283975eaa9ffa62a4f703cee1e9b..2fff26852d480d3d2a67841905128351473169e1 100644 (file)
@@ -2486,6 +2486,7 @@ static int allocateUnixFile(
   unixFile f;
   int rc;
 
+  memset(&f, 0, sizeof(f));
   lockingStyle = sqlite3DetectLockingStyle(zFilename, h);
   if ( lockingStyle == posixLockingStyle ) {
     sqlite3OsEnterMutex();
@@ -2505,9 +2506,6 @@ static int allocateUnixFile(
     unlink(zFilename);
   }
   f.dirfd = -1;
-  f.fullSync = 0;
-  f.locktype = 0;
-  f.offset = 0;
   f.h = h;
   SET_THREADID(&f);
   pNew = sqlite3ThreadSafeMalloc( sizeof(unixFile) );
@@ -2574,6 +2572,7 @@ static int allocateUnixFile(
   unixFile f;
   int rc;
 
+  memset(&f, 0, sizeof(f));
   sqlite3OsEnterMutex();
   rc = findLockInfo(h, &f.pLock, &f.pOpen);
   sqlite3OsLeaveMutex();
@@ -2586,9 +2585,6 @@ static int allocateUnixFile(
   }
   OSTRACE3("OPEN    %-3d %s\n", h, zFilename);
   f.dirfd = -1;
-  f.fullSync = 0;
-  f.locktype = 0;
-  f.offset = 0;
   f.h = h;
   SET_THREADID(&f);
   pNew = sqlite3ThreadSafeMalloc( sizeof(unixFile) );
index 7096bc1c9754bb3d7cec97f01525087836e04ab9..9da53e9feeef6d3f9ccfbba94c546fc5f48f6f68 100644 (file)
@@ -1049,7 +1049,6 @@ static int winSeek(OsFile *id, i64 offset){
 #ifdef SQLITE_TEST
   if( offset ) SimulateDiskfullError(return SQLITE_FULL);
 #endif
-  SEEK(offset/1024 + 1);
   rc = SetFilePointer(((winFile*)id)->h, lowerBits, &upperBits, FILE_BEGIN);
   OSTRACE3("SEEK %d %lld\n", ((winFile*)id)->h, offset);
   if( rc==INVALID_SET_FILE_POINTER && GetLastError()!=NO_ERROR ){
index 264c3ac82d7d17a086e73f582b32069990cfe1f7..18f737e54136cea0ab6072aab4d7aac1a63d701b 100644 (file)
@@ -18,7 +18,7 @@
 ** file simultaneously, or one process from reading the database while
 ** another is writing.
 **
-** @(#) $Id: pager.c,v 1.312 2007/03/31 10:00:48 danielk1977 Exp $
+** @(#) $Id: pager.c,v 1.313 2007/04/01 23:49:52 drh Exp $
 */
 #ifndef SQLITE_OMIT_DISKIO
 #include "sqliteInt.h"
@@ -606,7 +606,6 @@ static int readMasterJournal(OsFile *pJrnl, char **pzMaster){
 ** 
 */
 static int seekJournalHdr(Pager *pPager){
-  int rc;
   i64 offset = 0;
   i64 c = pPager->journalOff;
   if( c ){
index b5062393a37f42f18c37d909af35d417fd4e0ab6..077c2bb0c236dff53e1690ae80ff0af46ec99103 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains C code routines that are called by the parser
 ** to handle SELECT statements in SQLite.
 **
-** $Id: select.c,v 1.331 2007/03/29 05:51:49 drh Exp $
+** $Id: select.c,v 1.332 2007/04/01 23:49:52 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -694,7 +694,7 @@ static void generateSortTail(
   int cont = sqlite3VdbeMakeLabel(v);
   int addr;
   int iTab;
-  int pseudoTab;
+  int pseudoTab = 0;
   ExprList *pOrderBy = p->pOrderBy;
 
   iTab = pOrderBy->iECursor;
index 1c06d4bf343c19c670b03ad1be7b6e1a1080ce80..c849d54208d9232693d97e3f85f9d0858eb70a4e 100644 (file)
@@ -2026,7 +2026,7 @@ int sqlite3VdbeIdxRowidLen(const u8 *aKey){
 ** Return SQLITE_OK if everything works, or an error code otherwise.
 */
 int sqlite3VdbeIdxRowid(BtCursor *pCur, i64 *rowid){
-  i64 nCellKey;
+  i64 nCellKey = 0;
   int rc;
   u32 szHdr;        /* Size of the header */
   u32 typeRowid;    /* Serial type of the rowid */
@@ -2065,7 +2065,7 @@ int sqlite3VdbeIdxKeyCompare(
   int nKey, const u8 *pKey,   /* The key to compare */
   int *res                    /* Write the comparison result here */
 ){
-  i64 nCellKey;
+  i64 nCellKey = 0;
   int rc;
   BtCursor *pCur = pC->pCursor;
   int lenRowid;
index e35fa601d0120989df1f23a4afa44a0c0b37aaa5..5aed1df3dbc9f7598ef7be4c603cd090895dea10 100644 (file)
@@ -637,14 +637,15 @@ int sqlite3VdbeMemFromBtree(
   int key,          /* If true, retrieve from the btree key, not data. */
   Mem *pMem         /* OUT: Return data in this Mem structure. */
 ){
-  char *zData;      /* Data from the btree layer */
-  int available;    /* Number of bytes available on the local btree page */
+  char *zData;       /* Data from the btree layer */
+  int available = 0; /* Number of bytes available on the local btree page */
 
   if( key ){
     zData = (char *)sqlite3BtreeKeyFetch(pCur, &available);
   }else{
     zData = (char *)sqlite3BtreeDataFetch(pCur, &available);
   }
+  assert( zData!=0 );
 
   pMem->n = amt;
   if( offset+amt<=available ){