/ Check-in [8009220c]
Login

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

Overview
Comment:Modifications to avoid unsigned/signed comparisons in various files. (CVS 5914)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8009220c36635dd9b6efea7dc13281ca9625c40a
User & Date: danielk1977 2008-11-17 19:18:55
Context
2008-11-18
07:27
Reduce the number of "missing initializer" warnings. (CVS 5915) check-in: d68e2795 user: danielk1977 tags: trunk
2008-11-17
19:18
Modifications to avoid unsigned/signed comparisons in various files. (CVS 5914) check-in: 8009220c user: danielk1977 tags: trunk
16:42
Modifications to avoid unsigned/signed comparisons in where.c. (CVS 5913) check-in: f35606d1 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btmutex.c.

     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     12   **
    13         -** $Id: btmutex.c,v 1.11 2008/10/07 15:25:48 drh Exp $
           13  +** $Id: btmutex.c,v 1.12 2008/11/17 19:18:55 danielk1977 Exp $
    14     14   **
    15     15   ** This file contains code used to implement mutexes on Btree objects.
    16     16   ** This code really belongs in btree.c.  But btree.c is getting too
    17     17   ** big and we want to break it down some.  This packaged seemed like
    18     18   ** a good breakout.
    19     19   */
    20     20   #include "btreeInt.h"
................................................................................
   244    244     {
   245    245       for(i=0; i<pArray->nMutex; i++){
   246    246         assert( pArray->aBtree[i]!=pBtree );
   247    247       }
   248    248     }
   249    249   #endif
   250    250     assert( pArray->nMutex>=0 );
   251         -  assert( pArray->nMutex<sizeof(pArray->aBtree)/sizeof(pArray->aBtree[0])-1 );
          251  +  assert( pArray->nMutex<ArraySize(pArray->aBtree)-1 );
   252    252     pBt = pBtree->pBt;
   253    253     for(i=0; i<pArray->nMutex; i++){
   254    254       assert( pArray->aBtree[i]!=pBtree );
   255    255       if( pArray->aBtree[i]->pBt>pBt ){
   256    256         for(j=pArray->nMutex; j>i; j--){
   257    257           pArray->aBtree[j] = pArray->aBtree[j-1];
   258    258         }

Changes to src/build.c.

    18     18   **     CREATE INDEX
    19     19   **     DROP INDEX
    20     20   **     creating ID lists
    21     21   **     BEGIN TRANSACTION
    22     22   **     COMMIT
    23     23   **     ROLLBACK
    24     24   **
    25         -** $Id: build.c,v 1.502 2008/11/13 18:29:51 shane Exp $
           25  +** $Id: build.c,v 1.503 2008/11/17 19:18:55 danielk1977 Exp $
    26     26   */
    27     27   #include "sqliteInt.h"
    28     28   #include <ctype.h>
    29     29   
    30     30   /*
    31     31   ** This routine is called when a new SQL statement is beginning to
    32     32   ** be parsed.  Initialize the pParse structure as needed.
................................................................................
   622    622   ** The token *pName contains the name of a database (either "main" or
   623    623   ** "temp" or the name of an attached db). This routine returns the
   624    624   ** index of the named database in db->aDb[], or -1 if the named db 
   625    625   ** does not exist.
   626    626   */
   627    627   int sqlite3FindDb(sqlite3 *db, Token *pName){
   628    628     int i = -1;    /* Database number */
   629         -  int n;         /* Number of characters in the name */
          629  +  size_t n;      /* Number of characters in the name */
   630    630     Db *pDb;       /* A database whose name space is being searched */
   631    631     char *zName;   /* Name we are searching for */
   632    632   
   633    633     zName = sqlite3NameFromToken(db, pName);
   634    634     if( zName ){
   635    635       n = strlen(zName);
   636    636       for(i=(db->nDb-1), pDb=&db->aDb[i]; i>=0; i--, pDb--){
................................................................................
  1392   1392     for(pCol=p->aCol, i=0; i<p->nCol; i++, pCol++){
  1393   1393       sqlite3_snprintf(n-k, &zStmt[k], zSep);
  1394   1394       k += strlen(&zStmt[k]);
  1395   1395       zSep = zSep2;
  1396   1396       identPut(zStmt, &k, pCol->zName);
  1397   1397       if( (z = pCol->zType)!=0 ){
  1398   1398         zStmt[k++] = ' ';
  1399         -      assert( strlen(z)+k+1<=n );
         1399  +      assert( (int)(strlen(z)+k+1)<=n );
  1400   1400         sqlite3_snprintf(n-k, &zStmt[k], "%s", z);
  1401   1401         k += strlen(z);
  1402   1402       }
  1403   1403     }
  1404   1404     sqlite3_snprintf(n-k, &zStmt[k], "%s", zEnd);
  1405   1405     return zStmt;
  1406   1406   }

Changes to src/date.c.

    12     12   ** This file contains the C functions that implement date and time
    13     13   ** functions for SQLite.  
    14     14   **
    15     15   ** There is only one exported symbol in this file - the function
    16     16   ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
    17     17   ** All other code has file scope.
    18     18   **
    19         -** $Id: date.c,v 1.92 2008/10/13 15:35:09 drh Exp $
           19  +** $Id: date.c,v 1.93 2008/11/17 19:18:55 danielk1977 Exp $
    20     20   **
    21     21   ** SQLite processes all times and dates as Julian Day numbers.  The
    22     22   ** dates and times are stored as the number of days since noon
    23     23   ** in Greenwich on November 24, 4714 B.C. according to the Gregorian
    24     24   ** calendar system. 
    25     25   **
    26     26   ** 1970-01-01 00:00:00 is JD 2440587.5
................................................................................
   517    517   */
   518    518   static int parseModifier(const char *zMod, DateTime *p){
   519    519     int rc = 1;
   520    520     int n;
   521    521     double r;
   522    522     char *z, zBuf[30];
   523    523     z = zBuf;
   524         -  for(n=0; n<sizeof(zBuf)-1 && zMod[n]; n++){
          524  +  for(n=0; n<ArraySize(zBuf)-1 && zMod[n]; n++){
   525    525       z[n] = tolower(zMod[n]);
   526    526     }
   527    527     z[n] = 0;
   528    528     switch( z[0] ){
   529    529   #ifndef SQLITE_OMIT_LOCALTIME
   530    530       case 'l': {
   531    531         /*    localtime
................................................................................
   885    885             return;  /* ERROR.  return a NULL */
   886    886         }
   887    887         i++;
   888    888       }
   889    889     }
   890    890     if( n<sizeof(zBuf) ){
   891    891       z = zBuf;
   892         -  }else if( n>db->aLimit[SQLITE_LIMIT_LENGTH] ){
          892  +  }else if( n>(u64)db->aLimit[SQLITE_LIMIT_LENGTH] ){
   893    893       sqlite3_result_error_toobig(context);
   894    894       return;
   895    895     }else{
   896    896       z = sqlite3DbMallocRaw(db, n);
   897    897       if( z==0 ){
   898    898         sqlite3_result_error_nomem(context);
   899    899         return;

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.251 2008/11/03 20:55:07 drh Exp $
           15  +** $Id: insert.c,v 1.252 2008/11/17 19:18:55 danielk1977 Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   /*
    20     20   ** Set P4 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:
................................................................................
  1268   1268           || onError==OE_Ignore || onError==OE_Replace );
  1269   1269       switch( onError ){
  1270   1270         case OE_Rollback:
  1271   1271         case OE_Abort:
  1272   1272         case OE_Fail: {
  1273   1273           int j, n1, n2;
  1274   1274           char zErrMsg[200];
  1275         -        sqlite3_snprintf(sizeof(zErrMsg), zErrMsg,
         1275  +        sqlite3_snprintf(ArraySize(zErrMsg), zErrMsg,
  1276   1276                            pIdx->nColumn>1 ? "columns " : "column ");
  1277   1277           n1 = strlen(zErrMsg);
  1278         -        for(j=0; j<pIdx->nColumn && n1<sizeof(zErrMsg)-30; j++){
         1278  +        for(j=0; j<pIdx->nColumn && n1<ArraySize(zErrMsg)-30; j++){
  1279   1279             char *zCol = pTab->aCol[pIdx->aiColumn[j]].zName;
  1280   1280             n2 = strlen(zCol);
  1281   1281             if( j>0 ){
  1282         -            sqlite3_snprintf(sizeof(zErrMsg)-n1, &zErrMsg[n1], ", ");
         1282  +            sqlite3_snprintf(ArraySize(zErrMsg)-n1, &zErrMsg[n1], ", ");
  1283   1283               n1 += 2;
  1284   1284             }
  1285         -          if( n1+n2>sizeof(zErrMsg)-30 ){
  1286         -            sqlite3_snprintf(sizeof(zErrMsg)-n1, &zErrMsg[n1], "...");
         1285  +          if( n1+n2>ArraySize(zErrMsg)-30 ){
         1286  +            sqlite3_snprintf(ArraySize(zErrMsg)-n1, &zErrMsg[n1], "...");
  1287   1287               n1 += 3;
  1288   1288               break;
  1289   1289             }else{
  1290         -            sqlite3_snprintf(sizeof(zErrMsg)-n1, &zErrMsg[n1], "%s", zCol);
         1290  +            sqlite3_snprintf(ArraySize(zErrMsg)-n1, &zErrMsg[n1], "%s", zCol);
  1291   1291               n1 += n2;
  1292   1292             }
  1293   1293           }
  1294         -        sqlite3_snprintf(sizeof(zErrMsg)-n1, &zErrMsg[n1], 
         1294  +        sqlite3_snprintf(ArraySize(zErrMsg)-n1, &zErrMsg[n1], 
  1295   1295               pIdx->nColumn>1 ? " are not unique" : " is not unique");
  1296   1296           sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CONSTRAINT, onError, 0, zErrMsg,0);
  1297   1297           break;
  1298   1298         }
  1299   1299         case OE_Ignore: {
  1300   1300           assert( seenReplace==0 );
  1301   1301           sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest);

Changes to src/malloc.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   **
    13     13   ** Memory allocation functions used throughout sqlite.
    14     14   **
    15         -** $Id: malloc.c,v 1.45 2008/10/12 00:27:53 shane Exp $
           15  +** $Id: malloc.c,v 1.46 2008/11/17 19:18:55 danielk1977 Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   #include <stdarg.h>
    19     19   #include <ctype.h>
    20     20   
    21     21   /*
    22     22   ** This routine runs when the memory allocator sees that the
................................................................................
   383    383         }
   384    384       }else{
   385    385         int i;
   386    386         i = (u8 *)p - (u8 *)sqlite3GlobalConfig.pScratch;
   387    387         i /= sqlite3GlobalConfig.szScratch;
   388    388         assert( i>=0 && i<sqlite3GlobalConfig.nScratch );
   389    389         sqlite3_mutex_enter(mem0.mutex);
   390         -      assert( mem0.nScratchFree<sqlite3GlobalConfig.nScratch );
          390  +      assert( mem0.nScratchFree<(u32)sqlite3GlobalConfig.nScratch );
   391    391         mem0.aScratchFree[mem0.nScratchFree++] = i;
   392    392         sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_USED, -1);
   393    393         sqlite3_mutex_leave(mem0.mutex);
   394    394       }
   395    395     }
   396    396   }
   397    397   

Changes to src/mem5.c.

    19     19   ** implementations. Once sqlite3_initialize() has been called,
    20     20   ** the amount of memory available to SQLite is fixed and cannot
    21     21   ** be changed.
    22     22   **
    23     23   ** This version of the memory allocation subsystem is included
    24     24   ** in the build only if SQLITE_ENABLE_MEMSYS5 is defined.
    25     25   **
    26         -** $Id: mem5.c,v 1.16 2008/11/13 16:21:50 danielk1977 Exp $
           26  +** $Id: mem5.c,v 1.17 2008/11/17 19:18:55 danielk1977 Exp $
    27     27   */
    28     28   #include "sqliteInt.h"
    29     29   
    30     30   /*
    31     31   ** This version of the memory allocator is used only when 
    32     32   ** SQLITE_ENABLE_MEMSYS5 is defined.
    33     33   */
................................................................................
   204    204     int i;           /* Index of a mem5.aPool[] slot */
   205    205     int iBin;        /* Index into mem5.aiFreelist[] */
   206    206     int iFullSz;     /* Size of allocation rounded up to power of 2 */
   207    207     int iLogsize;    /* Log2 of iFullSz/POW2_MIN */
   208    208   
   209    209     /* Keep track of the maximum allocation request.  Even unfulfilled
   210    210     ** requests are counted */
   211         -  if( nByte>mem5.maxRequest ){
          211  +  if( (u32)nByte>mem5.maxRequest ){
   212    212       mem5.maxRequest = nByte;
   213    213     }
   214    214   
   215    215     /* Round nByte up to the next valid power of two */
   216    216     for(iFullSz=mem5.nAtom, iLogsize=0; iFullSz<nByte; iFullSz *= 2, iLogsize++){}
   217    217   
   218    218     /* Make sure mem5.aiFreelist[iLogsize] contains at least one free
................................................................................
   260    260     /* Check that the pointer pOld points to a valid, non-free block. */
   261    261     assert( iBlock>=0 && iBlock<mem5.nBlock );
   262    262     assert( ((u8 *)pOld-mem5.zPool)%mem5.nAtom==0 );
   263    263     assert( (mem5.aCtrl[iBlock] & CTRL_FREE)==0 );
   264    264   
   265    265     iLogsize = mem5.aCtrl[iBlock] & CTRL_LOGSIZE;
   266    266     size = 1<<iLogsize;
   267         -  assert( iBlock+size-1<mem5.nBlock );
          267  +  assert( iBlock+size-1<(u32)mem5.nBlock );
   268    268   
   269    269     mem5.aCtrl[iBlock] |= CTRL_FREE;
   270    270     mem5.aCtrl[iBlock+size-1] |= CTRL_FREE;
   271    271     assert( mem5.currentCount>0 );
   272         -  assert( mem5.currentOut>=0 );
          272  +  assert( mem5.currentOut>=(size*mem5.nAtom) );
   273    273     mem5.currentCount--;
   274    274     mem5.currentOut -= size*mem5.nAtom;
   275    275     assert( mem5.currentOut>0 || mem5.currentCount==0 );
   276    276     assert( mem5.currentCount>0 || mem5.currentOut==0 );
   277    277   
   278    278     mem5.aCtrl[iBlock] = CTRL_FREE | iLogsize;
   279    279     while( iLogsize<LOGMAX ){
................................................................................
   381    381   
   382    382     if( !zByte ){
   383    383       return SQLITE_ERROR;
   384    384     }
   385    385   
   386    386     nMinLog = memsys5Log(sqlite3GlobalConfig.mnReq);
   387    387     mem5.nAtom = (1<<nMinLog);
   388         -  while( sizeof(Mem5Link)>mem5.nAtom ){
          388  +  while( (int)sizeof(Mem5Link)>mem5.nAtom ){
   389    389       mem5.nAtom = mem5.nAtom << 1;
   390    390     }
   391    391   
   392    392     mem5.nBlock = (nByte / (mem5.nAtom+sizeof(u8)));
   393    393     mem5.zPool = zByte;
   394    394     mem5.aCtrl = (u8 *)&mem5.zPool[mem5.nBlock*mem5.nAtom];
   395    395   

Changes to src/mutex_unix.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 the C functions that implement mutexes for pthreads
    13     13   **
    14         -** $Id: mutex_unix.c,v 1.14 2008/11/17 08:05:32 chw Exp $
           14  +** $Id: mutex_unix.c,v 1.15 2008/11/17 19:18:55 danielk1977 Exp $
    15     15   */
    16     16   #include "sqliteInt.h"
    17     17   
    18     18   /*
    19     19   ** The code in this file is only used if we are compiling threadsafe
    20     20   ** under unix with pthreads.
    21     21   **
................................................................................
   153    153           p->id = iType;
   154    154           pthread_mutex_init(&p->mutex, 0);
   155    155         }
   156    156         break;
   157    157       }
   158    158       default: {
   159    159         assert( iType-2 >= 0 );
   160         -      assert( iType-2 < sizeof(staticMutexes)/sizeof(staticMutexes[0]) );
          160  +      assert( iType-2 < ArraySize(staticMutexes) );
   161    161         p = &staticMutexes[iType-2];
   162    162         p->id = iType;
   163    163         break;
   164    164       }
   165    165     }
   166    166     return p;
   167    167   }

Changes to src/os_unix.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   **
    13     13   ** This file contains code that is specific to Unix systems.
    14     14   **
    15         -** $Id: os_unix.c,v 1.210 2008/11/17 08:05:32 chw Exp $
           15  +** $Id: os_unix.c,v 1.211 2008/11/17 19:18:55 danielk1977 Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   #if SQLITE_OS_UNIX              /* This file is used on unix only */
    19     19   
    20     20   /*
    21     21   ** If SQLITE_ENABLE_LOCKING_STYLE is defined and is non-zero, then several
    22     22   ** alternative locking implementations are provided:
................................................................................
  2952   2952     /* It's odd to simulate an io-error here, but really this is just
  2953   2953     ** using the io-error infrastructure to test that SQLite handles this
  2954   2954     ** function failing. 
  2955   2955     */
  2956   2956     SimulateIOError( return SQLITE_IOERR );
  2957   2957   
  2958   2958     azDirs[0] = sqlite3_temp_directory;
  2959         -  for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){
         2959  +  for(i=0; i<ArraySize(azDirs); i++){
  2960   2960       if( azDirs[i]==0 ) continue;
  2961   2961       if( stat(azDirs[i], &buf) ) continue;
  2962   2962       if( !S_ISDIR(buf.st_mode) ) continue;
  2963   2963       if( access(azDirs[i], 07) ) continue;
  2964   2964       zDir = azDirs[i];
  2965   2965       break;
  2966   2966     }
  2967   2967   
  2968   2968     /* Check that the output buffer is large enough for the temporary file 
  2969   2969     ** name. If it is not, return SQLITE_ERROR.
  2970   2970     */
  2971         -  if( (strlen(zDir) + strlen(SQLITE_TEMP_FILE_PREFIX) + 17) >= nBuf ){
         2971  +  if( (strlen(zDir) + strlen(SQLITE_TEMP_FILE_PREFIX) + 17) >= (size_t)nBuf ){
  2972   2972       return SQLITE_ERROR;
  2973   2973     }
  2974   2974   
  2975   2975     do{
  2976   2976       sqlite3_snprintf(nBuf-17, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX, zDir);
  2977   2977       j = strlen(zBuf);
  2978   2978       sqlite3_randomness(15, &zBuf[j]);
................................................................................
  3307   3307   #endif
  3308   3308   
  3309   3309   /*
  3310   3310   ** Write nBuf bytes of random data to the supplied buffer zBuf.
  3311   3311   */
  3312   3312   static int unixRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
  3313   3313   
  3314         -  assert(nBuf>=(sizeof(time_t)+sizeof(int)));
         3314  +  assert((size_t)nBuf>=(sizeof(time_t)+sizeof(int)));
  3315   3315   
  3316   3316     /* We have to initialize zBuf to prevent valgrind from reporting
  3317   3317     ** errors.  The reports issued by valgrind are incorrect - we would
  3318   3318     ** prefer that the randomness be increased by making use of the
  3319   3319     ** uninitialized space in zBuf - but valgrind errors tend to worry
  3320   3320     ** some users.  Rather than argue, it seems easier just to initialize
  3321   3321     ** the whole array and silence valgrind, even if that means less randomness
................................................................................
  3332   3332       fd = open("/dev/urandom", O_RDONLY);
  3333   3333       if( fd<0 ){
  3334   3334         time_t t;
  3335   3335         time(&t);
  3336   3336         memcpy(zBuf, &t, sizeof(t));
  3337   3337         pid = getpid();
  3338   3338         memcpy(&zBuf[sizeof(t)], &pid, sizeof(pid));
  3339         -      assert( sizeof(t)+sizeof(pid)<=nBuf );
         3339  +      assert( sizeof(t)+sizeof(pid)<=(size_t)nBuf );
  3340   3340         nBuf = sizeof(t) + sizeof(pid);
  3341   3341       }else{
  3342   3342         nBuf = read(fd, zBuf, nBuf);
  3343   3343         close(fd);
  3344   3344       }
  3345   3345     }
  3346   3346   #endif

Changes to src/pragma.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 implement the PRAGMA command.
    13     13   **
    14         -** $Id: pragma.c,v 1.193 2008/11/10 19:24:38 shane Exp $
           14  +** $Id: pragma.c,v 1.194 2008/11/17 19:18:55 danielk1977 Exp $
    15     15   */
    16     16   #include "sqliteInt.h"
    17     17   #include <ctype.h>
    18     18   
    19     19   /* Ignore this whole file if pragmas are disabled
    20     20   */
    21     21   #if !defined(SQLITE_OMIT_PRAGMA) && !defined(SQLITE_OMIT_PARSER)
................................................................................
    37     37     static const u8 iLength[] = {2, 2, 3, 5, 3, 4, 4};
    38     38     static const u8 iValue[] =  {1, 0, 0, 0, 1, 1, 2};
    39     39     int i, n;
    40     40     if( isdigit(*z) ){
    41     41       return atoi(z);
    42     42     }
    43     43     n = strlen(z);
    44         -  for(i=0; i<sizeof(iLength); i++){
           44  +  for(i=0; i<ArraySize(iLength); i++){
    45     45       if( iLength[i]==n && sqlite3StrNICmp(&zText[iOffset[i]],z,n)==0 ){
    46     46         return iValue[i];
    47     47       }
    48     48     }
    49     49     return 1;
    50     50   }
    51     51   
................................................................................
   187    187   
   188    188       /* TODO: Maybe it shouldn't be possible to change the ReadUncommitted
   189    189       ** flag if there are any active statements. */
   190    190       { "read_uncommitted",         SQLITE_ReadUncommitted },
   191    191     };
   192    192     int i;
   193    193     const struct sPragmaType *p;
   194         -  for(i=0, p=aPragma; i<sizeof(aPragma)/sizeof(aPragma[0]); i++, p++){
          194  +  for(i=0, p=aPragma; i<ArraySize(aPragma); i++, p++){
   195    195       if( sqlite3StrICmp(zLeft, p->zName)==0 ){
   196    196         sqlite3 *db = pParse->db;
   197    197         Vdbe *v;
   198    198         v = sqlite3GetVdbe(pParse);
   199    199         if( v ){
   200    200           if( zRight==0 ){
   201    201             returnSingleInt(pParse, p->zName, (db->flags & p->mask)!=0 );

Changes to src/prepare.c.

     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains the implementation of the sqlite3_prepare()
    13     13   ** interface, and routines that contribute to loading the database schema
    14     14   ** from disk.
    15     15   **
    16         -** $Id: prepare.c,v 1.98 2008/10/31 10:53:23 danielk1977 Exp $
           16  +** $Id: prepare.c,v 1.99 2008/11/17 19:18:55 danielk1977 Exp $
    17     17   */
    18     18   #include "sqliteInt.h"
    19     19   #include <ctype.h>
    20     20   
    21     21   /*
    22     22   ** Fill the InitData structure with an error message that indicates
    23     23   ** that the database is corrupt.
................................................................................
   240    240     **    meta[9]
   241    241     **
   242    242     ** Note: The #defined SQLITE_UTF* symbols in sqliteInt.h correspond to
   243    243     ** the possible values of meta[4].
   244    244     */
   245    245     if( rc==SQLITE_OK ){
   246    246       int i;
   247         -    for(i=0; i<sizeof(meta)/sizeof(meta[0]); i++){
          247  +    for(i=0; i<ArraySize(meta); i++){
   248    248         rc = sqlite3BtreeGetMeta(pDb->pBt, i+1, (u32 *)&meta[i]);
   249    249         if( rc ){
   250    250           sqlite3SetString(pzErrMsg, db, "%s", sqlite3ErrStr(rc));
   251    251           goto initone_error_out;
   252    252         }
   253    253       }
   254    254     }else{

Changes to src/printf.c.

     1      1   /*
     2      2   ** The "printf" code that follows dates from the 1980's.  It is in
     3      3   ** the public domain.  The original comments are included here for
     4      4   ** completeness.  They are very out-of-date but might be useful as
     5      5   ** an historical reference.  Most of the "enhancements" have been backed
     6      6   ** out so that the functionality is now the same as standard printf().
     7      7   **
     8         -** $Id: printf.c,v 1.94 2008/08/22 14:08:36 drh Exp $
            8  +** $Id: printf.c,v 1.95 2008/11/17 19:18:55 danielk1977 Exp $
     9      9   **
    10     10   **************************************************************************
    11     11   **
    12     12   ** The following modules is an enhanced replacement for the "printf" subroutines
    13     13   ** found in the standard C library.  The following enhancements are
    14     14   ** supported:
    15     15   **
................................................................................
   133    133     {  'n',  0, 0, etSIZE,       0,  0 },
   134    134     {  '%',  0, 0, etPERCENT,    0,  0 },
   135    135     {  'p', 16, 0, etPOINTER,    0,  1 },
   136    136     {  'T',  0, 2, etTOKEN,      0,  0 },
   137    137     {  'S',  0, 2, etSRCLIST,    0,  0 },
   138    138     {  'r', 10, 3, etORDINAL,    0,  0 },
   139    139   };
   140         -#define etNINFO  (sizeof(fmtinfo)/sizeof(fmtinfo[0]))
   141    140   
   142    141   /*
   143    142   ** If SQLITE_OMIT_FLOATING_POINT is defined, then none of the floating point
   144    143   ** conversions will work.
   145    144   */
   146    145   #ifndef SQLITE_OMIT_FLOATING_POINT
   147    146   /*
................................................................................
   170    169   #endif /* SQLITE_OMIT_FLOATING_POINT */
   171    170   
   172    171   /*
   173    172   ** Append N space characters to the given string buffer.
   174    173   */
   175    174   static void appendSpace(StrAccum *pAccum, int N){
   176    175     static const char zSpaces[] = "                             ";
   177         -  while( N>=sizeof(zSpaces)-1 ){
          176  +  while( N>=(int)sizeof(zSpaces)-1 ){
   178    177       sqlite3StrAccumAppend(pAccum, zSpaces, sizeof(zSpaces)-1);
   179    178       N -= sizeof(zSpaces)-1;
   180    179     }
   181    180     if( N>0 ){
   182    181       sqlite3StrAccumAppend(pAccum, zSpaces, N);
   183    182     }
   184    183   }
................................................................................
   333    332           flag_longlong = 0;
   334    333         }
   335    334       }else{
   336    335         flag_long = flag_longlong = 0;
   337    336       }
   338    337       /* Fetch the info entry for the field */
   339    338       infop = 0;
   340         -    for(idx=0; idx<etNINFO; idx++){
          339  +    for(idx=0; idx<ArraySize(fmtinfo); idx++){
   341    340         if( c==fmtinfo[idx].fmttype ){
   342    341           infop = &fmtinfo[idx];
   343    342           if( useExtended || (infop->flags & FLAG_INTERN)==0 ){
   344    343             xtype = infop->type;
   345    344           }else{
   346    345             return;
   347    346           }

Changes to src/resolve.c.

    10     10   **
    11     11   *************************************************************************
    12     12   **
    13     13   ** This file contains routines used for walking the parser tree and
    14     14   ** resolve all identifiers by associating them with a particular
    15     15   ** table and column.
    16     16   **
    17         -** $Id: resolve.c,v 1.10 2008/10/19 21:03:27 drh Exp $
           17  +** $Id: resolve.c,v 1.11 2008/11/17 19:18:55 danielk1977 Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include <stdlib.h>
    21     21   #include <string.h>
    22     22   
    23     23   /*
    24     24   ** Turn the pExpr expression into an alias for the iCol-th column of the
................................................................................
   345    345     ** this fact in the pSrcList.a[].colUsed bitmask.  Column 0 causes
   346    346     ** bit 0 to be set.  Column 1 sets bit 1.  And so forth.  If the
   347    347     ** column number is greater than the number of bits in the bitmask
   348    348     ** then set the high-order bit of the bitmask.
   349    349     */
   350    350     if( pExpr->iColumn>=0 && pMatch!=0 ){
   351    351       int n = pExpr->iColumn;
   352         -    testcase( n==sizeof(Bitmask)*8-1 );
   353         -    if( n>=sizeof(Bitmask)*8 ){
   354         -      n = sizeof(Bitmask)*8-1;
          352  +    testcase( n==BMS-1 );
          353  +    if( n>=BMS ){
          354  +      n = BMS-1;
   355    355       }
   356    356       assert( pMatch->iCursor==pExpr->iTable );
   357    357       pMatch->colUsed |= ((Bitmask)1)<<n;
   358    358     }
   359    359   
   360    360   lookupname_end:
   361    361     /* Clean up and return

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.484 2008/11/12 12:27:31 drh Exp $
           15  +** $Id: select.c,v 1.485 2008/11/17 19:18:55 danielk1977 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.
................................................................................
   140    140     };
   141    141     int i, j;
   142    142     apAll[0] = pA;
   143    143     apAll[1] = pB;
   144    144     apAll[2] = pC;
   145    145     for(i=0; i<3 && apAll[i]; i++){
   146    146       p = apAll[i];
   147         -    for(j=0; j<sizeof(keywords)/sizeof(keywords[0]); j++){
          147  +    for(j=0; j<ArraySize(keywords); j++){
   148    148         if( p->n==keywords[j].nChar 
   149    149             && sqlite3StrNICmp((char*)p->z, keywords[j].zKeyword, p->n)==0 ){
   150    150           jointype |= keywords[j].code;
   151    151           break;
   152    152         }
   153    153       }
   154         -    if( j>=sizeof(keywords)/sizeof(keywords[0]) ){
          154  +    if( j>=ArraySize(keywords) ){
   155    155         jointype |= JT_ERROR;
   156    156         break;
   157    157       }
   158    158     }
   159    159     if(
   160    160        (jointype & (JT_INNER|JT_OUTER))==(JT_INNER|JT_OUTER) ||
   161    161        (jointype & JT_ERROR)!=0

Changes to src/sqliteInt.h.

     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   ** Internal interface definitions for SQLite.
    13     13   **
    14         -** @(#) $Id: sqliteInt.h,v 1.794 2008/11/17 16:42:01 danielk1977 Exp $
           14  +** @(#) $Id: sqliteInt.h,v 1.795 2008/11/17 19:18:55 danielk1977 Exp $
    15     15   */
    16     16   #ifndef _SQLITEINT_H_
    17     17   #define _SQLITEINT_H_
    18     18   
    19     19   /*
    20     20   ** Include the configuration header output by 'configure' if we're using the
    21     21   ** autoconf-based build
................................................................................
  1419   1419   **
  1420   1420   ** Changing this from a 64-bit to a 32-bit type limits the number of
  1421   1421   ** tables in a join to 32 instead of 64.  But it also reduces the size
  1422   1422   ** of the library by 738 bytes on ix86.
  1423   1423   */
  1424   1424   typedef u64 Bitmask;
  1425   1425   
         1426  +/*
         1427  +** The number of bits in a Bitmask.  "BMS" means "BitMask Size".
         1428  +*/
         1429  +#define BMS  ((int)(sizeof(Bitmask)*8))
         1430  +
  1426   1431   /*
  1427   1432   ** The following structure describes the FROM clause of a SELECT statement.
  1428   1433   ** Each table or subquery in the FROM clause is a separate element of
  1429   1434   ** the SrcList.a[] array.
  1430   1435   **
  1431   1436   ** With the addition of multiple database support, the following structure
  1432   1437   ** can also be used to describe a particular table such as the table that

Changes to src/util.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** Utility functions used throughout sqlite.
    13     13   **
    14     14   ** This file contains functions for allocating memory, comparing
    15     15   ** strings, and stuff like that.
    16     16   **
    17         -** $Id: util.c,v 1.241 2008/07/28 19:34:54 drh Exp $
           17  +** $Id: util.c,v 1.242 2008/11/17 19:18:55 danielk1977 Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include <stdarg.h>
    21     21   #include <ctype.h>
    22     22   
    23     23   
    24     24   /*
................................................................................
    53     53   /*
    54     54   ** Return the length of a string, except do not allow the string length
    55     55   ** to exceed the SQLITE_LIMIT_LENGTH setting.
    56     56   */
    57     57   int sqlite3Strlen(sqlite3 *db, const char *z){
    58     58     const char *z2 = z;
    59     59     int len;
    60         -  size_t x;
           60  +  int x;
    61     61     while( *z2 ){ z2++; }
    62     62     x = z2 - z;
    63     63     len = 0x7fffffff & x;
    64     64     if( len!=x || len > db->aLimit[SQLITE_LIMIT_LENGTH] ){
    65     65       return db->aLimit[SQLITE_LIMIT_LENGTH];
    66     66     }else{
    67     67       return len;
................................................................................
   930    930   **
   931    931   ** sqlite3SafetyCheckOk() requires that the db pointer be valid for
   932    932   ** use.  sqlite3SafetyCheckSickOrOk() allows a db pointer that failed to
   933    933   ** open properly and is not fit for general use but which can be
   934    934   ** used as an argument to sqlite3_errmsg() or sqlite3_close().
   935    935   */
   936    936   int sqlite3SafetyCheckOk(sqlite3 *db){
   937         -  int magic;
          937  +  u32 magic;
   938    938     if( db==0 ) return 0;
   939    939     magic = db->magic;
   940    940     if( magic!=SQLITE_MAGIC_OPEN &&
   941    941         magic!=SQLITE_MAGIC_BUSY ) return 0;
   942    942     return 1;
   943    943   }
   944    944   int sqlite3SafetyCheckSickOrOk(sqlite3 *db){
   945         -  int magic;
          945  +  u32 magic;
   946    946     if( db==0 ) return 0;
   947    947     magic = db->magic;
   948    948     if( magic!=SQLITE_MAGIC_SICK &&
   949    949         magic!=SQLITE_MAGIC_OPEN &&
   950    950         magic!=SQLITE_MAGIC_BUSY ) return 0;
   951    951     return 1;
   952    952   }

Changes to src/vacuum.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains code used to implement the VACUUM command.
    13     13   **
    14     14   ** Most of the code in this file may be omitted by defining the
    15     15   ** SQLITE_OMIT_VACUUM macro.
    16     16   **
    17         -** $Id: vacuum.c,v 1.83 2008/08/26 21:07:27 drh Exp $
           17  +** $Id: vacuum.c,v 1.84 2008/11/17 19:18:55 danielk1977 Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include "vdbeInt.h"
    21     21   
    22     22   #if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH)
    23     23   /*
    24     24   ** Execute zSql on database db. Return an error code.
................................................................................
   247    247          6, 0,    /* Preserve the user version */
   248    248       };
   249    249   
   250    250       assert( 1==sqlite3BtreeIsInTrans(pTemp) );
   251    251       assert( 1==sqlite3BtreeIsInTrans(pMain) );
   252    252   
   253    253       /* Copy Btree meta values */
   254         -    for(i=0; i<sizeof(aCopy)/sizeof(aCopy[0]); i+=2){
          254  +    for(i=0; i<ArraySize(aCopy); i+=2){
   255    255         rc = sqlite3BtreeGetMeta(pMain, aCopy[i], &meta);
   256    256         if( rc!=SQLITE_OK ) goto end_of_vacuum;
   257    257         rc = sqlite3BtreeUpdateMeta(pTemp, aCopy[i], meta+aCopy[i+1]);
   258    258         if( rc!=SQLITE_OK ) goto end_of_vacuum;
   259    259       }
   260    260   
   261    261       rc = sqlite3BtreeCopyFile(pMain, pTemp);

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.419 2008/11/13 18:00:15 danielk1977 Exp $
           17  +** $Id: vdbeaux.c,v 1.420 2008/11/17 19:18:55 danielk1977 Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include <ctype.h>
    21     21   #include "vdbeInt.h"
    22     22   
    23     23   
    24     24   
................................................................................
    96     96   */
    97     97   void sqlite3VdbeTrace(Vdbe *p, FILE *trace){
    98     98     p->trace = trace;
    99     99   }
   100    100   #endif
   101    101   
   102    102   /*
   103         -** Resize the Vdbe.aOp array so that it contains at least N
   104         -** elements.
          103  +** Resize the Vdbe.aOp array so that it is at least one op larger than 
          104  +** it was.
   105    105   **
   106         -** If an out-of-memory error occurs while resizing the array,
   107         -** Vdbe.aOp and Vdbe.nOpAlloc remain unchanged (this is so that
   108         -** any opcodes already allocated can be correctly deallocated
   109         -** along with the rest of the Vdbe).
          106  +** If an out-of-memory error occurs while resizing the array, return
          107  +** SQLITE_NOMEM. In this case Vdbe.aOp and Vdbe.nOpAlloc remain 
          108  +** unchanged (this is so that any opcodes already allocated can be 
          109  +** correctly deallocated along with the rest of the Vdbe).
   110    110   */
   111         -static void resizeOpArray(Vdbe *p, int N){
          111  +static int growOpArray(Vdbe *p){
   112    112     VdbeOp *pNew;
   113         -  pNew = sqlite3DbRealloc(p->db, p->aOp, N*sizeof(Op));
          113  +  int nNew = (p->nOpAlloc ? p->nOpAlloc*2 : (int)(1024/sizeof(Op)));
          114  +  pNew = sqlite3DbRealloc(p->db, p->aOp, nNew*sizeof(Op));
   114    115     if( pNew ){
   115         -    p->nOpAlloc = N;
          116  +    p->nOpAlloc = nNew;
   116    117       p->aOp = pNew;
   117    118     }
          119  +  return (pNew ? SQLITE_OK : SQLITE_NOMEM);
   118    120   }
   119    121   
   120    122   /*
   121    123   ** Add a new instruction to the list of instructions current in the
   122    124   ** VDBE.  Return the address of the new instruction.
   123    125   **
   124    126   ** Parameters:
................................................................................
   136    138   int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){
   137    139     int i;
   138    140     VdbeOp *pOp;
   139    141   
   140    142     i = p->nOp;
   141    143     assert( p->magic==VDBE_MAGIC_INIT );
   142    144     if( p->nOpAlloc<=i ){
   143         -    resizeOpArray(p, p->nOpAlloc ? p->nOpAlloc*2 : 1024/sizeof(Op));
   144         -    if( p->db->mallocFailed ){
          145  +    if( growOpArray(p) ){
   145    146         return 0;
   146    147       }
   147    148     }
   148    149     p->nOp++;
   149    150     pOp = &p->aOp[i];
   150    151     pOp->opcode = op;
   151    152     pOp->p5 = 0;
................................................................................
   338    339   /*
   339    340   ** Add a whole list of operations to the operation stack.  Return the
   340    341   ** address of the first operation added.
   341    342   */
   342    343   int sqlite3VdbeAddOpList(Vdbe *p, int nOp, VdbeOpList const *aOp){
   343    344     int addr;
   344    345     assert( p->magic==VDBE_MAGIC_INIT );
   345         -  if( p->nOp + nOp > p->nOpAlloc ){
   346         -    resizeOpArray(p, p->nOpAlloc ? p->nOpAlloc*2 : 1024/sizeof(Op));
   347         -    assert( p->nOp+nOp<=p->nOpAlloc || p->db->mallocFailed );
   348         -  }
   349         -  if( p->db->mallocFailed ){
          346  +  if( p->nOp + nOp > p->nOpAlloc && growOpArray(p) ){
   350    347       return 0;
   351    348     }
   352    349     addr = p->nOp;
   353    350     if( nOp>0 ){
   354    351       int i;
   355    352       VdbeOpList const *pIn = aOp;
   356    353       for(i=0; i<nOp; i++, pIn++){
................................................................................
   727    724   /*
   728    725   ** Declare to the Vdbe that the BTree object at db->aDb[i] is used.
   729    726   **
   730    727   */
   731    728   void sqlite3VdbeUsesBtree(Vdbe *p, int i){
   732    729     int mask;
   733    730     assert( i>=0 && i<p->db->nDb );
   734         -  assert( i<sizeof(p->btreeMask)*8 );
          731  +  assert( i<(int)sizeof(p->btreeMask)*8 );
   735    732     mask = 1<<i;
   736    733     if( (p->btreeMask & mask)==0 ){
   737    734       p->btreeMask |= mask;
   738    735       sqlite3BtreeMutexArrayInsert(&p->aMutex, p->db->aDb[i].pBt);
   739    736     }
   740    737   }
   741    738   
................................................................................
  1013   1010     assert( p!=0 );
  1014   1011     assert( p->magic==VDBE_MAGIC_INIT );
  1015   1012   
  1016   1013     /* There should be at least one opcode.
  1017   1014     */
  1018   1015     assert( p->nOp>0 );
  1019   1016   
  1020         -  /* Set the magic to VDBE_MAGIC_RUN sooner rather than later. This
  1021         -   * is because the call to resizeOpArray() below may shrink the
  1022         -   * p->aOp[] array to save memory if called when in VDBE_MAGIC_RUN 
  1023         -   * state.
  1024         -   */
         1017  +  /* Set the magic to VDBE_MAGIC_RUN sooner rather than later. */
  1025   1018     p->magic = VDBE_MAGIC_RUN;
  1026   1019   
  1027   1020     /* For each cursor required, also allocate a memory cell. Memory
  1028   1021     ** cells (nMem+1-nCursor)..nMem, inclusive, will never be used by
  1029   1022     ** the vdbe program. Instead they are used to allocate space for
  1030   1023     ** VdbeCursor/BtCursor structures. The blob of memory associated with 
  1031   1024     ** cursor 0 is stored in memory cell nMem. Memory cell (nMem-1)
................................................................................
  1037   1030   
  1038   1031     /*
  1039   1032     ** Allocation space for registers.
  1040   1033     */
  1041   1034     if( p->aMem==0 ){
  1042   1035       int nArg;       /* Maximum number of args passed to a user function. */
  1043   1036       resolveP2Values(p, &nArg);
  1044         -    /*resizeOpArray(p, p->nOp);*/
  1045   1037       assert( nVar>=0 );
  1046   1038       if( isExplain && nMem<10 ){
  1047   1039         nMem = 10;
  1048   1040       }
  1049   1041       p->aMem = sqlite3DbMallocZero(db,
  1050   1042           nMem*sizeof(Mem)               /* aMem */
  1051   1043         + nVar*sizeof(Mem)               /* aVar */
................................................................................
  2211   2203     int nKey,              /* Size of the binary record */
  2212   2204     const void *pKey,      /* The binary record */
  2213   2205     UnpackedRecord *pSpace,/* Space available to hold resulting object */
  2214   2206     int szSpace            /* Size of pSpace[] in bytes */
  2215   2207   ){
  2216   2208     const unsigned char *aKey = (const unsigned char *)pKey;
  2217   2209     UnpackedRecord *p;
  2218         -  int nByte;
  2219         -  int idx, d;
         2210  +  int nByte, d;
         2211  +  u32 idx;
  2220   2212     u16 u;                 /* Unsigned loop counter */
  2221   2213     u32 szHdr;
  2222   2214     Mem *pMem;
  2223   2215     
  2224   2216     assert( sizeof(Mem)>sizeof(*p) );
  2225   2217     nByte = sizeof(Mem)*(pKeyInfo->nField+2);
  2226   2218     if( nByte>szSpace ){
................................................................................
  2236   2228     p->aMem = pMem = &((Mem*)p)[1];
  2237   2229     idx = getVarint32(aKey, szHdr);
  2238   2230     d = szHdr;
  2239   2231     u = 0;
  2240   2232     while( idx<szHdr && u<p->nField ){
  2241   2233       u32 serial_type;
  2242   2234   
  2243         -    idx += getVarint32( aKey+idx, serial_type);
         2235  +    idx += getVarint32(&aKey[idx], serial_type);
  2244   2236       if( d>=nKey && sqlite3VdbeSerialTypeLen(serial_type)>0 ) break;
  2245   2237       pMem->enc = pKeyInfo->enc;
  2246   2238       pMem->db = pKeyInfo->db;
  2247   2239       pMem->flags = 0;
  2248   2240       pMem->zMalloc = 0;
  2249   2241       d += sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem);
  2250   2242       pMem++;
................................................................................
  2301   2293   ** By ignoring this last byte of the header, we force the comparison
  2302   2294   ** to ignore the rowid at the end of key1.
  2303   2295   */
  2304   2296   int sqlite3VdbeRecordCompare(
  2305   2297     int nKey1, const void *pKey1, /* Left key */
  2306   2298     UnpackedRecord *pPKey2        /* Right key */
  2307   2299   ){
  2308         -  u32 d1;            /* Offset into aKey[] of next data element */
         2300  +  int d1;            /* Offset into aKey[] of next data element */
  2309   2301     u32 idx1;          /* Offset into aKey[] of next header element */
  2310   2302     u32 szHdr1;        /* Number of bytes in header */
  2311   2303     int i = 0;
  2312   2304     int nField;
  2313   2305     int rc = 0;
  2314   2306     const unsigned char *aKey1 = (const unsigned char *)pKey1;
  2315   2307     KeyInfo *pKeyInfo;

Changes to src/vdbefifo.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 implements a FIFO queue of rowids used for processing
    13     13   ** UPDATE and DELETE statements.
    14     14   **
    15         -** $Id: vdbefifo.c,v 1.8 2008/07/28 19:34:54 drh Exp $
           15  +** $Id: vdbefifo.c,v 1.9 2008/11/17 19:18:55 danielk1977 Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   #include "vdbeInt.h"
    19     19   
    20     20   /*
    21     21   ** Constants FIFOSIZE_FIRST and FIFOSIZE_MAX are the initial
    22     22   ** number of entries in a fifo page and the maximum number of
    23     23   ** entries in a fifo page.
    24     24   */
    25     25   #define FIFOSIZE_FIRST (((128-sizeof(FifoPage))/8)+1)
    26     26   #ifdef SQLITE_MALLOC_SOFT_LIMIT
    27         -# define FIFOSIZE_MAX   (((SQLITE_MALLOC_SOFT_LIMIT-sizeof(FifoPage))/8)+1)
           27  +# define FIFOSIZE_MAX   (int)(((SQLITE_MALLOC_SOFT_LIMIT-sizeof(FifoPage))/8)+1)
    28     28   #else
    29         -# define FIFOSIZE_MAX   (((262144-sizeof(FifoPage))/8)+1)
           29  +# define FIFOSIZE_MAX   (int)(((262144-sizeof(FifoPage))/8)+1)
    30     30   #endif
    31     31   
    32     32   /*
    33     33   ** Allocate a new FifoPage and return a pointer to it.  Return NULL if
    34     34   ** we run out of memory.  Leave space on the page for nEntry entries.
    35     35   */
    36     36   static FifoPage *allocateFifoPage(sqlite3 *db, int nEntry){

Changes to src/where.c.

    12     12   ** This module contains C code that generates VDBE code used to process
    13     13   ** the WHERE clause of SQL statements.  This module is responsible for
    14     14   ** generating the code that loops through a table looking for applicable
    15     15   ** rows.  Indices are selected and used to speed the search when doing
    16     16   ** so is applicable.  Because this module is responsible for selecting
    17     17   ** indices, you might also think of this module as the "query optimizer".
    18     18   **
    19         -** $Id: where.c,v 1.329 2008/11/17 16:42:01 danielk1977 Exp $
           19  +** $Id: where.c,v 1.330 2008/11/17 19:18:55 danielk1977 Exp $
    20     20   */
    21     21   #include "sqliteInt.h"
    22     22   
    23         -/*
    24         -** The number of bits in a Bitmask.  "BMS" means "BitMask Size".
    25         -*/
    26         -#define BMS  ((int)(sizeof(Bitmask)*8))
    27         -
    28     23   /*
    29     24   ** Trace output macros
    30     25   */
    31     26   #if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
    32     27   int sqlite3WhereTrace = 0;
    33     28   #endif
    34     29   #if 0