/ Check-in [257e9b57]
Login

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

Overview
Comment:Suppress various compiler warnings. (CVS 6963)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 257e9b575029f63277ed602d1402f87cfa15d22e
User & Date: drh 2009-08-08 18:01:08
Context
2009-08-10
03:23
Fixed "Interlocked" logic error that prevented the "static" mutexes from being released when sqlite3_shutdown() is called. Ticket #4011. (CVS 6964) check-in: 04cafb7e user: shane tags: trunk
2009-08-08
18:01
Suppress various compiler warnings. (CVS 6963) check-in: 257e9b57 user: drh tags: trunk
2009-08-07
16:56
Enhancement to (6844). If sqlite3_exec() is to return SQLITE_NOMEM because it fails to allocate space for an error message, set the database error-code to SQLITE_NOMEM too. (CVS 6962) check-in: 8293fa19 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btree.c.

     5      5   ** a legal notice, here is a blessing:
     6      6   **
     7      7   **    May you do good and not evil.
     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         -** $Id: btree.c,v 1.703 2009/07/24 19:01:19 drh Exp $
           12  +** $Id: btree.c,v 1.704 2009/08/08 18:01:08 drh Exp $
    13     13   **
    14     14   ** This file implements a external (disk-based) database using BTrees.
    15     15   ** See the header comment on "btreeInt.h" for additional information.
    16     16   ** Including a description of file format and an overview of operation.
    17     17   */
    18     18   #include "btreeInt.h"
    19     19   
................................................................................
   425    425       invalidateOverflowCache(p);
   426    426     }
   427    427   }
   428    428   
   429    429   /*
   430    430   ** This function is called before modifying the contents of a table
   431    431   ** b-tree to invalidate any incrblob cursors that are open on the
   432         -** row or one of the rows being modified. Argument pgnoRoot is the 
   433         -** root-page of the table b-tree. 
          432  +** row or one of the rows being modified.
   434    433   **
   435    434   ** If argument isClearTable is true, then the entire contents of the
   436    435   ** table is about to be deleted. In this case invalidate all incrblob
   437    436   ** cursors open on any row within the table with root-page pgnoRoot.
   438    437   **
   439    438   ** Otherwise, if argument isClearTable is false, then the row with
   440    439   ** rowid iRow is being replaced or deleted. In this case invalidate
   441    440   ** only those incrblob cursors open on this specific row.
   442    441   */
   443    442   static void invalidateIncrblobCursors(
   444    443     Btree *pBtree,          /* The database file to check */
   445         -  Pgno pgnoRoot,          /* Look for read cursors on this btree */
   446    444     i64 iRow,               /* The rowid that might be changing */
   447    445     int isClearTable        /* True if all rows are being deleted */
   448    446   ){
   449    447     BtCursor *p;
   450    448     BtShared *pBt = pBtree->pBt;
   451    449     assert( sqlite3BtreeHoldsMutex(pBtree) );
   452    450     for(p=pBt->pCursor; p; p=p->pNext){
................................................................................
   455    453       }
   456    454     }
   457    455   }
   458    456   
   459    457   #else
   460    458     #define invalidateOverflowCache(x)
   461    459     #define invalidateAllOverflowCache(x)
   462         -  #define invalidateIncrblobCursors(w,x,y,z)
          460  +  #define invalidateIncrblobCursors(x,y,z)
   463    461   #endif
   464    462   
   465    463   /*
   466    464   ** Set bit pgno of the BtShared.pHasContent bitvec. This is called 
   467    465   ** when a page that previously contained data becomes a free-list leaf 
   468    466   ** page.
   469    467   **
................................................................................
  4901   4899       iTrunk = get4byte(&pPage1->aData[32]);
  4902   4900       rc = btreeGetPage(pBt, iTrunk, &pTrunk, 0);
  4903   4901       if( rc!=SQLITE_OK ){
  4904   4902         goto freepage_out;
  4905   4903       }
  4906   4904   
  4907   4905       nLeaf = get4byte(&pTrunk->aData[4]);
  4908         -    if( nLeaf > pBt->usableSize/4 - 2 ){
         4906  +    assert( pBt->usableSize>32 );
         4907  +    if( nLeaf > (u32)pBt->usableSize/4 - 2 ){
  4909   4908         rc = SQLITE_CORRUPT_BKPT;
  4910   4909         goto freepage_out;
  4911   4910       }
  4912         -    if( nLeaf<pBt->usableSize/4 - 8 ){
         4911  +    if( nLeaf < (u32)pBt->usableSize/4 - 8 ){
  4913   4912         /* In this case there is room on the trunk page to insert the page
  4914   4913         ** being freed as a new leaf.
  4915   4914         **
  4916   4915         ** Note that the trunk page is not really full until it contains
  4917   4916         ** usableSize/4 - 2 entries, not usableSize/4 - 8 entries as we have
  4918   4917         ** coded.  But due to a coding error in versions of SQLite prior to
  4919   4918         ** 3.6.0, databases with freelist trunk pages holding more than
................................................................................
  6455   6454     ** blob of associated data.  */
  6456   6455     assert( (pKey==0)==(pCur->pKeyInfo==0) );
  6457   6456   
  6458   6457     /* If this is an insert into a table b-tree, invalidate any incrblob 
  6459   6458     ** cursors open on the row being replaced (assuming this is a replace
  6460   6459     ** operation - if it is not, the following is a no-op).  */
  6461   6460     if( pCur->pKeyInfo==0 ){
  6462         -    invalidateIncrblobCursors(p, pCur->pgnoRoot, nKey, 0);
         6461  +    invalidateIncrblobCursors(p, nKey, 0);
  6463   6462     }
  6464   6463   
  6465   6464     /* Save the positions of any other cursors open on this table.
  6466   6465     **
  6467   6466     ** In some cases, the call to btreeMoveto() below is a no-op. For
  6468   6467     ** example, when inserting data into a table with auto-generated integer
  6469   6468     ** keys, the VDBE layer invokes sqlite3BtreeLast() to figure out the 
................................................................................
  6584   6583     ){
  6585   6584       return SQLITE_ERROR;  /* Something has gone awry. */
  6586   6585     }
  6587   6586   
  6588   6587     /* If this is a delete operation to remove a row from a table b-tree,
  6589   6588     ** invalidate any incrblob cursors open on the row being deleted.  */
  6590   6589     if( pCur->pKeyInfo==0 ){
  6591         -    invalidateIncrblobCursors(p, pCur->pgnoRoot, pCur->info.nKey, 0);
         6590  +    invalidateIncrblobCursors(p, pCur->info.nKey, 0);
  6592   6591     }
  6593   6592   
  6594   6593     iCellDepth = pCur->iPage;
  6595   6594     iCellIdx = pCur->aiIdx[iCellDepth];
  6596   6595     pPage = pCur->apPage[iCellDepth];
  6597   6596     pCell = findCell(pPage, iCellIdx);
  6598   6597   
................................................................................
  6741   6740       if( pgnoMove!=pgnoRoot ){
  6742   6741         /* pgnoRoot is the page that will be used for the root-page of
  6743   6742         ** the new table (assuming an error did not occur). But we were
  6744   6743         ** allocated pgnoMove. If required (i.e. if it was not allocated
  6745   6744         ** by extending the file), the current page at position pgnoMove
  6746   6745         ** is already journaled.
  6747   6746         */
  6748         -      u8 eType;
  6749         -      Pgno iPtrPage;
         6747  +      u8 eType = 0;
         6748  +      Pgno iPtrPage = 0;
  6750   6749   
  6751   6750         releasePage(pPageMove);
  6752   6751   
  6753   6752         /* Move the page currently at pgnoRoot to pgnoMove. */
  6754   6753         rc = btreeGetPage(pBt, pgnoRoot, &pRoot, 0);
  6755   6754         if( rc!=SQLITE_OK ){
  6756   6755           return rc;
................................................................................
  6883   6882     BtShared *pBt = p->pBt;
  6884   6883     sqlite3BtreeEnter(p);
  6885   6884     assert( p->inTrans==TRANS_WRITE );
  6886   6885   
  6887   6886     /* Invalidate all incrblob cursors open on table iTable (assuming iTable
  6888   6887     ** is the root of a table b-tree - if it is not, the following call is
  6889   6888     ** a no-op).  */
  6890         -  invalidateIncrblobCursors(p, iTable, 0, 1);
         6889  +  invalidateIncrblobCursors(p, 0, 1);
  6891   6890   
  6892   6891     rc = saveAllCursors(pBt, (Pgno)iTable, 0);
  6893   6892     if( SQLITE_OK==rc ){
  6894   6893       rc = clearDatabasePage(pBt, (Pgno)iTable, 0, pnChange);
  6895   6894     }
  6896   6895     sqlite3BtreeLeave(p);
  6897   6896     return rc;

Changes to src/delete.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   ** in order to generate code for DELETE FROM statements.
    14     14   **
    15         -** $Id: delete.c,v 1.206 2009/07/27 10:05:05 danielk1977 Exp $
           15  +** $Id: delete.c,v 1.207 2009/08/08 18:01:08 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   /*
    20     20   ** Look up every table that is named in pSrc.  If any table is not found,
    21     21   ** add an error message to pParse->zErrMsg and return NULL.  If all tables
    22     22   ** are found, return a pointer to the last table.
................................................................................
   240    240   #endif
   241    241     int iBeginAfterTrigger = 0;  /* Address of after trigger program */
   242    242     int iEndAfterTrigger = 0;    /* Exit of after trigger program */
   243    243     int iBeginBeforeTrigger = 0; /* Address of before trigger program */
   244    244     int iEndBeforeTrigger = 0;   /* Exit of before trigger program */
   245    245     u32 old_col_mask = 0;        /* Mask of OLD.* columns in use */
   246    246   
   247         -  sContext.pParse = 0;
          247  +  memset(&sContext, 0, sizeof(sContext));
   248    248     db = pParse->db;
   249    249     if( pParse->nErr || db->mallocFailed ){
   250    250       goto delete_from_cleanup;
   251    251     }
   252    252     assert( pTabList->nSrc==1 );
   253    253   
   254    254     /* Locate the table which we want to delete.  This table has to be

Changes to src/update.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 UPDATE statements.
    14     14   **
    15         -** $Id: update.c,v 1.206 2009/07/27 10:05:06 danielk1977 Exp $
           15  +** $Id: update.c,v 1.207 2009/08/08 18:01:08 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   #ifndef SQLITE_OMIT_VIRTUALTABLE
    20     20   /* Forward declaration */
    21     21   static void updateVirtualTable(
    22     22     Parse *pParse,       /* The parsing context */
................................................................................
   133    133     /* Register Allocations */
   134    134     int regRowCount = 0;   /* A count of rows changed */
   135    135     int regOldRowid;       /* The old rowid */
   136    136     int regNewRowid;       /* The new rowid */
   137    137     int regData;           /* New data for the row */
   138    138     int regRowSet = 0;     /* Rowset of rows to be updated */
   139    139   
   140         -  sContext.pParse = 0;
          140  +  memset(&sContext, 0, sizeof(sContext));
   141    141     db = pParse->db;
   142    142     if( pParse->nErr || db->mallocFailed ){
   143    143       goto update_cleanup;
   144    144     }
   145    145     assert( pTabList->nSrc==1 );
   146    146   
   147    147     /* Locate the table which we want to update. 

Changes to src/vdbeaux.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains code used for creating, destroying, and populating
    13     13   ** a VDBE (or an "sqlite3_stmt" as it is known to the outside world.)  Prior
    14     14   ** to version 2.8.7, all this code was combined into the vdbe.c source file.
    15     15   ** But that file was getting too big so this subroutines were split out.
    16     16   **
    17         -** $Id: vdbeaux.c,v 1.479 2009/07/25 17:42:22 drh Exp $
           17  +** $Id: vdbeaux.c,v 1.480 2009/08/08 18:01:08 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include "vdbeInt.h"
    21     21   
    22     22   
    23     23   
    24     24   /*
................................................................................
  2640   2640     testcase( typeRowid==6 );
  2641   2641     testcase( typeRowid==8 );
  2642   2642     testcase( typeRowid==9 );
  2643   2643     if( unlikely(typeRowid<1 || typeRowid>9 || typeRowid==7) ){
  2644   2644       goto idx_rowid_corruption;
  2645   2645     }
  2646   2646     lenRowid = sqlite3VdbeSerialTypeLen(typeRowid);
  2647         -  testcase( m.n==szHdr+lenRowid );
  2648         -  if( unlikely(m.n<szHdr+lenRowid) ){
         2647  +  testcase( (u32)m.n==szHdr+lenRowid );
         2648  +  if( unlikely((u32)m.n<szHdr+lenRowid) ){
  2649   2649       goto idx_rowid_corruption;
  2650   2650     }
  2651   2651   
  2652   2652     /* Fetch the integer off the end of the index record */
  2653   2653     sqlite3VdbeSerialGet((u8*)&m.z[m.n-lenRowid], typeRowid, &v);
  2654   2654     *rowid = v.u.i;
  2655   2655     sqlite3VdbeMemRelease(&m);

Changes to src/vtab.c.

     7      7   **    May you do good and not evil.
     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 code used to help implement virtual tables.
    13     13   **
    14         -** $Id: vtab.c,v 1.93 2009/07/24 17:58:53 danielk1977 Exp $
           14  +** $Id: vtab.c,v 1.94 2009/08/08 18:01:08 drh Exp $
    15     15   */
    16     16   #ifndef SQLITE_OMIT_VIRTUALTABLE
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   /*
    20     20   ** The actual function that does the work of creating a new module.
    21     21   ** This function implements the sqlite3_create_module() and
................................................................................
   564    564   
   565    565     if( !pMod ){
   566    566       const char *zModule = pTab->azModuleArg[0];
   567    567       sqlite3ErrorMsg(pParse, "no such module: %s", zModule);
   568    568       rc = SQLITE_ERROR;
   569    569     }else{
   570    570       char *zErr = 0;
   571         -    sqlite3 *db = pParse->db;
   572    571       rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xConnect, &zErr);
   573    572       if( rc!=SQLITE_OK ){
   574    573         sqlite3ErrorMsg(pParse, "%s", zErr);
   575    574       }
   576    575       sqlite3DbFree(db, zErr);
   577    576     }
   578    577