/ Check-in [18aec1dd]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix some warnings about unused and uninitialized variables. (CVS 3788)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 18aec1ddfb08b74f0ef9cf1215eac7af71449db3
User & Date: drh 2007-04-01 23:49:52
Context
2007-04-02
00:53
Update the version number and change comments in preparation for the release of 3.3.14. (CVS 3789) check-in: d9f6fdb7 user: drh tags: trunk
2007-04-01
23:49
Fix some warnings about unused and uninitialized variables. (CVS 3788) check-in: 18aec1dd user: drh tags: trunk
18:46
Make unix builds threadsafe by default. (CVS 3787) check-in: ddfc3b2d user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/insert.c.

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains C code routines that are called by the parser
    13     13   ** to handle INSERT statements in SQLite.
    14     14   **
    15         -** $Id: insert.c,v 1.182 2007/03/31 13:00:26 drh Exp $
           15  +** $Id: insert.c,v 1.183 2007/04/01 23:49:52 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   /*
    20     20   ** Set P3 of the most recently inserted opcode to a column affinity
    21     21   ** string for index pIdx. A column affinity string has one character
    22     22   ** for each column in the table, according to the affinity of the column:
................................................................................
  1370   1370     struct SrcList_item *pItem;      /* An element of pSelect->pSrc */
  1371   1371     int i;                           /* Loop counter */
  1372   1372     int iDbSrc;                      /* The database of pSrc */
  1373   1373     int iSrc, iDest;                 /* Cursors from source and destination */
  1374   1374     int addr1, addr2;                /* Loop addresses */
  1375   1375     int emptyDestTest;               /* Address of test for empty pDest */
  1376   1376     int emptySrcTest;                /* Address of test for empty pSrc */
  1377         -  int memRowid;                    /* A memcell containing a rowid from pSrc */
         1377  +  int memRowid = 0;                /* A memcell containing a rowid from pSrc */
  1378   1378     Vdbe *v;                         /* The VDBE we are building */
  1379   1379     KeyInfo *pKey;                   /* Key information for an index */
  1380   1380     int counterMem;                  /* Memory register used by AUTOINC */
  1381   1381   
  1382   1382     if( pSelect==0 ){
  1383   1383       return 0;   /* Must be of the form  INSERT INTO ... SELECT ... */
  1384   1384     }

Changes to src/os_common.h.

    34     34    */
    35     35   #ifdef SQLITE_TEST
    36     36   unsigned int sqlite3_pending_byte = 0x40000000;
    37     37   #endif
    38     38   
    39     39   int sqlite3_os_trace = 0;
    40     40   #ifdef SQLITE_DEBUG
    41         -static int last_page = 0;
    42         -#define SEEK(X)           last_page=(X)
    43     41   #define OSTRACE1(X)         if( sqlite3_os_trace ) sqlite3DebugPrintf(X)
    44     42   #define OSTRACE2(X,Y)       if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y)
    45     43   #define OSTRACE3(X,Y,Z)     if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y,Z)
    46     44   #define OSTRACE4(X,Y,Z,A)   if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y,Z,A)
    47     45   #define OSTRACE5(X,Y,Z,A,B) if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y,Z,A,B)
    48     46   #define OSTRACE6(X,Y,Z,A,B,C) \
    49     47       if(sqlite3_os_trace) sqlite3DebugPrintf(X,Y,Z,A,B,C)
    50     48   #define OSTRACE7(X,Y,Z,A,B,C,D) \
    51     49       if(sqlite3_os_trace) sqlite3DebugPrintf(X,Y,Z,A,B,C,D)
    52     50   #else
    53         -#define SEEK(X)
    54     51   #define OSTRACE1(X)
    55     52   #define OSTRACE2(X,Y)
    56     53   #define OSTRACE3(X,Y,Z)
    57     54   #define OSTRACE4(X,Y,Z,A)
    58     55   #define OSTRACE5(X,Y,Z,A,B)
    59     56   #define OSTRACE6(X,Y,Z,A,B,C)
    60     57   #define OSTRACE7(X,Y,Z,A,B,C,D)

Changes to src/os_unix.c.

  2482   2482     int delFlag             /* Delete-on-or-before-close flag */
  2483   2483   ){
  2484   2484     sqlite3LockingStyle lockingStyle;
  2485   2485     unixFile *pNew;
  2486   2486     unixFile f;
  2487   2487     int rc;
  2488   2488   
         2489  +  memset(&f, 0, sizeof(f));
  2489   2490     lockingStyle = sqlite3DetectLockingStyle(zFilename, h);
  2490   2491     if ( lockingStyle == posixLockingStyle ) {
  2491   2492       sqlite3OsEnterMutex();
  2492   2493       rc = findLockInfo(h, &f.pLock, &f.pOpen);
  2493   2494       sqlite3OsLeaveMutex();
  2494   2495       if( rc ){
  2495   2496         close(h);
................................................................................
  2501   2502       f.pLock = NULL;
  2502   2503       f.pOpen = NULL;
  2503   2504     }
  2504   2505     if( delFlag ){
  2505   2506       unlink(zFilename);
  2506   2507     }
  2507   2508     f.dirfd = -1;
  2508         -  f.fullSync = 0;
  2509         -  f.locktype = 0;
  2510         -  f.offset = 0;
  2511   2509     f.h = h;
  2512   2510     SET_THREADID(&f);
  2513   2511     pNew = sqlite3ThreadSafeMalloc( sizeof(unixFile) );
  2514   2512     if( pNew==0 ){
  2515   2513       close(h);
  2516   2514       sqlite3OsEnterMutex();
  2517   2515       releaseLockInfo(f.pLock);
................................................................................
  2570   2568     const char *zFilename, /* Name of the file being opened */
  2571   2569     int delFlag            /* If true, delete the file on or before closing */
  2572   2570   ){
  2573   2571     unixFile *pNew;
  2574   2572     unixFile f;
  2575   2573     int rc;
  2576   2574   
         2575  +  memset(&f, 0, sizeof(f));
  2577   2576     sqlite3OsEnterMutex();
  2578   2577     rc = findLockInfo(h, &f.pLock, &f.pOpen);
  2579   2578     sqlite3OsLeaveMutex();
  2580   2579     if( delFlag ){
  2581   2580       unlink(zFilename);
  2582   2581     }
  2583   2582     if( rc ){
  2584   2583       close(h);
  2585   2584       return SQLITE_NOMEM;
  2586   2585     }
  2587   2586     OSTRACE3("OPEN    %-3d %s\n", h, zFilename);
  2588   2587     f.dirfd = -1;
  2589         -  f.fullSync = 0;
  2590         -  f.locktype = 0;
  2591         -  f.offset = 0;
  2592   2588     f.h = h;
  2593   2589     SET_THREADID(&f);
  2594   2590     pNew = sqlite3ThreadSafeMalloc( sizeof(unixFile) );
  2595   2591     if( pNew==0 ){
  2596   2592       close(h);
  2597   2593       sqlite3OsEnterMutex();
  2598   2594       releaseLockInfo(f.pLock);

Changes to src/os_win.c.

  1045   1045     LONG upperBits = offset>>32;
  1046   1046     LONG lowerBits = offset & 0xffffffff;
  1047   1047     DWORD rc;
  1048   1048     assert( id!=0 );
  1049   1049   #ifdef SQLITE_TEST
  1050   1050     if( offset ) SimulateDiskfullError(return SQLITE_FULL);
  1051   1051   #endif
  1052         -  SEEK(offset/1024 + 1);
  1053   1052     rc = SetFilePointer(((winFile*)id)->h, lowerBits, &upperBits, FILE_BEGIN);
  1054   1053     OSTRACE3("SEEK %d %lld\n", ((winFile*)id)->h, offset);
  1055   1054     if( rc==INVALID_SET_FILE_POINTER && GetLastError()!=NO_ERROR ){
  1056   1055       return SQLITE_FULL;
  1057   1056     }
  1058   1057     return SQLITE_OK;
  1059   1058   }

Changes to src/pager.c.

    14     14   ** The pager is used to access a database disk file.  It implements
    15     15   ** atomic commit and rollback through the use of a journal file that
    16     16   ** is separate from the database file.  The pager also implements file
    17     17   ** locking to prevent two processes from writing the same database
    18     18   ** file simultaneously, or one process from reading the database while
    19     19   ** another is writing.
    20     20   **
    21         -** @(#) $Id: pager.c,v 1.312 2007/03/31 10:00:48 danielk1977 Exp $
           21  +** @(#) $Id: pager.c,v 1.313 2007/04/01 23:49:52 drh Exp $
    22     22   */
    23     23   #ifndef SQLITE_OMIT_DISKIO
    24     24   #include "sqliteInt.h"
    25     25   #include "os.h"
    26     26   #include "pager.h"
    27     27   #include <assert.h>
    28     28   #include <string.h>
................................................................................
   602    602   ** 0                         0
   603    603   ** 512                       512
   604    604   ** 100                       512
   605    605   ** 2000                      2048
   606    606   ** 
   607    607   */
   608    608   static int seekJournalHdr(Pager *pPager){
   609         -  int rc;
   610    609     i64 offset = 0;
   611    610     i64 c = pPager->journalOff;
   612    611     if( c ){
   613    612       offset = ((c-1)/JOURNAL_HDR_SZ(pPager) + 1) * JOURNAL_HDR_SZ(pPager);
   614    613     }
   615    614     assert( offset%JOURNAL_HDR_SZ(pPager)==0 );
   616    615     assert( offset>=c );

Changes to src/select.c.

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains C code routines that are called by the parser
    13     13   ** to handle SELECT statements in SQLite.
    14     14   **
    15         -** $Id: select.c,v 1.331 2007/03/29 05:51:49 drh Exp $
           15  +** $Id: select.c,v 1.332 2007/04/01 23:49:52 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   
    20     20   /*
    21     21   ** Delete all the content of a Select structure but do not deallocate
    22     22   ** the select structure itself.
................................................................................
   690    690     int eDest,       /* Write the sorted results here */
   691    691     int iParm        /* Optional parameter associated with eDest */
   692    692   ){
   693    693     int brk = sqlite3VdbeMakeLabel(v);
   694    694     int cont = sqlite3VdbeMakeLabel(v);
   695    695     int addr;
   696    696     int iTab;
   697         -  int pseudoTab;
          697  +  int pseudoTab = 0;
   698    698     ExprList *pOrderBy = p->pOrderBy;
   699    699   
   700    700     iTab = pOrderBy->iECursor;
   701    701     if( eDest==SRT_Callback || eDest==SRT_Subroutine ){
   702    702       pseudoTab = pParse->nTab++;
   703    703       sqlite3VdbeAddOp(v, OP_OpenPseudo, pseudoTab, 0);
   704    704       sqlite3VdbeAddOp(v, OP_SetNumColumns, pseudoTab, nColumn);

Changes to src/vdbeaux.c.

  2022   2022   
  2023   2023   /*
  2024   2024   ** pCur points at an index entry created using the OP_MakeRecord opcode.
  2025   2025   ** Read the rowid (the last field in the record) and store it in *rowid.
  2026   2026   ** Return SQLITE_OK if everything works, or an error code otherwise.
  2027   2027   */
  2028   2028   int sqlite3VdbeIdxRowid(BtCursor *pCur, i64 *rowid){
  2029         -  i64 nCellKey;
         2029  +  i64 nCellKey = 0;
  2030   2030     int rc;
  2031   2031     u32 szHdr;        /* Size of the header */
  2032   2032     u32 typeRowid;    /* Serial type of the rowid */
  2033   2033     u32 lenRowid;     /* Size of the rowid */
  2034   2034     Mem m, v;
  2035   2035   
  2036   2036     sqlite3BtreeKeySize(pCur, &nCellKey);
................................................................................
  2061   2061   ** is ignored as well.
  2062   2062   */
  2063   2063   int sqlite3VdbeIdxKeyCompare(
  2064   2064     Cursor *pC,                 /* The cursor to compare against */
  2065   2065     int nKey, const u8 *pKey,   /* The key to compare */
  2066   2066     int *res                    /* Write the comparison result here */
  2067   2067   ){
  2068         -  i64 nCellKey;
         2068  +  i64 nCellKey = 0;
  2069   2069     int rc;
  2070   2070     BtCursor *pCur = pC->pCursor;
  2071   2071     int lenRowid;
  2072   2072     Mem m;
  2073   2073   
  2074   2074     sqlite3BtreeKeySize(pCur, &nCellKey);
  2075   2075     if( nCellKey<=0 ){

Changes to src/vdbemem.c.

   633    633   int sqlite3VdbeMemFromBtree(
   634    634     BtCursor *pCur,   /* Cursor pointing at record to retrieve. */
   635    635     int offset,       /* Offset from the start of data to return bytes from. */
   636    636     int amt,          /* Number of bytes to return. */
   637    637     int key,          /* If true, retrieve from the btree key, not data. */
   638    638     Mem *pMem         /* OUT: Return data in this Mem structure. */
   639    639   ){
   640         -  char *zData;      /* Data from the btree layer */
   641         -  int available;    /* Number of bytes available on the local btree page */
          640  +  char *zData;       /* Data from the btree layer */
          641  +  int available = 0; /* Number of bytes available on the local btree page */
   642    642   
   643    643     if( key ){
   644    644       zData = (char *)sqlite3BtreeKeyFetch(pCur, &available);
   645    645     }else{
   646    646       zData = (char *)sqlite3BtreeDataFetch(pCur, &available);
   647    647     }
          648  +  assert( zData!=0 );
   648    649   
   649    650     pMem->n = amt;
   650    651     if( offset+amt<=available ){
   651    652       pMem->z = &zData[offset];
   652    653       pMem->flags = MEM_Blob|MEM_Ephem;
   653    654     }else{
   654    655       int rc;