/ Check-in [16f51f9b]
Login

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

Overview
Comment:Changed a few loop counters to unsigned ints to remove compiler warnings. (CVS 5449)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 16f51f9b39c46659b4be4afd7f0d8ec325469e7b
User & Date: shane 2008-07-22 05:18:01
Context
2008-07-22
05:32
winGetLastError support added. Consolidated getLastErrorMsg() support. Removed some more WINCE dead code similar to instance in ticket #3232. Added error return on SystemTimeToFileTime() failure. (CVS 5450) check-in: c0a5cf38 user: shane tags: trunk
05:18
Changed a few loop counters to unsigned ints to remove compiler warnings. (CVS 5449) check-in: 16f51f9b user: shane tags: trunk
05:15
Added comment on floating point precision compile option for MSVC. (CVS 5448) check-in: e20f2b8c user: shane tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

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.466 2008/07/16 18:17:56 danielk1977 Exp $
           21  +** @(#) $Id: pager.c,v 1.467 2008/07/22 05:18:01 shane Exp $
    22     22   */
    23     23   #ifndef SQLITE_OMIT_DISKIO
    24     24   #include "sqliteInt.h"
    25     25   #include <assert.h>
    26     26   #include <string.h>
    27     27   
    28     28   /*
................................................................................
   892    892   ** SQLITE_OK returned.
   893    893   */
   894    894   static int readMasterJournal(sqlite3_file *pJrnl, char *zMaster, int nMaster){
   895    895     int rc;
   896    896     u32 len;
   897    897     i64 szJ;
   898    898     u32 cksum;
   899         -  int i;
          899  +  u32 u;                   /* Unsigned loop counter */
   900    900     unsigned char aMagic[8]; /* A buffer to hold the magic header */
   901    901   
   902    902     zMaster[0] = '\0';
   903    903   
   904    904     rc = sqlite3OsFileSize(pJrnl, &szJ);
   905    905     if( rc!=SQLITE_OK || szJ<16 ) return rc;
   906    906   
................................................................................
   920    920     rc = sqlite3OsRead(pJrnl, zMaster, len, szJ-16-len);
   921    921     if( rc!=SQLITE_OK ){
   922    922       return rc;
   923    923     }
   924    924     zMaster[len] = '\0';
   925    925   
   926    926     /* See if the checksum matches the master journal name */
   927         -  for(i=0; i<len; i++){
   928         -    cksum -= zMaster[i];
          927  +  for(u=0; u<len; u++){
          928  +    cksum -= zMaster[u];
   929    929      }
   930    930     if( cksum ){
   931    931       /* If the checksum doesn't add up, then one or more of the disk sectors
   932    932       ** containing the master journal filename is corrupted. This means
   933    933       ** definitely roll back, so just return SQLITE_OK and report a (nul)
   934    934       ** master-journal filename.
   935    935       */
................................................................................
  1844   1844   ** If an I/O or malloc() error occurs, the journal-file is not deleted
  1845   1845   ** and an error code is returned.
  1846   1846   */
  1847   1847   static int pager_playback(Pager *pPager, int isHot){
  1848   1848     sqlite3_vfs *pVfs = pPager->pVfs;
  1849   1849     i64 szJ;                 /* Size of the journal file in bytes */
  1850   1850     u32 nRec;                /* Number of Records in the journal */
  1851         -  u32 i;                   /* Loop counter */
         1851  +  u32 u;                   /* Unsigned loop counter */
  1852   1852     Pgno mxPg = 0;           /* Size of the original file in pages */
  1853   1853     int rc;                  /* Result code of a subroutine */
  1854   1854     int res = 1;             /* Value returned by sqlite3OsAccess() */
  1855   1855     char *zMaster = 0;       /* Name of master journal file if any */
  1856   1856   
  1857   1857     /* Figure out how many records are in the journal.  Abort early if
  1858   1858     ** the journal is empty.
................................................................................
  1927   1927         if( rc!=SQLITE_OK ){
  1928   1928           goto end_playback;
  1929   1929         }
  1930   1930       }
  1931   1931   
  1932   1932       /* Copy original pages out of the journal and back into the database file.
  1933   1933       */
  1934         -    for(i=0; i<nRec; i++){
         1934  +    for(u=0; u<nRec; u++){
  1935   1935         rc = pager_playback_one_page(pPager, pPager->jfd, pPager->journalOff, 1);
  1936   1936         if( rc!=SQLITE_OK ){
  1937   1937           if( rc==SQLITE_DONE ){
  1938   1938             rc = SQLITE_OK;
  1939   1939             pPager->journalOff = szJ;
  1940   1940             break;
  1941   1941           }else{

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.398 2008/07/18 08:10:47 danielk1977 Exp $
           17  +** $Id: vdbeaux.c,v 1.399 2008/07/22 05:18:01 shane Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include <ctype.h>
    21     21   #include "vdbeInt.h"
    22     22   
    23     23   
    24     24   
................................................................................
  2201   2201     const void *pKey,      /* The binary record */
  2202   2202     void *pSpace,          /* Space available to hold resulting object */
  2203   2203     int szSpace            /* Size of pSpace[] in bytes */
  2204   2204   ){
  2205   2205     const unsigned char *aKey = (const unsigned char *)pKey;
  2206   2206     UnpackedRecord *p;
  2207   2207     int nByte;
  2208         -  int i, idx, d;
         2208  +  int idx, d;
         2209  +  u16 u;                 /* Unsigned loop counter */
  2209   2210     u32 szHdr;
  2210   2211     Mem *pMem;
  2211   2212     
  2212   2213     assert( sizeof(Mem)>sizeof(*p) );
  2213   2214     nByte = sizeof(Mem)*(pKeyInfo->nField+2);
  2214   2215     if( nByte>szSpace ){
  2215   2216       p = sqlite3DbMallocRaw(pKeyInfo->db, nByte);
................................................................................
  2221   2222     }
  2222   2223     p->pKeyInfo = pKeyInfo;
  2223   2224     p->nField = pKeyInfo->nField + 1;
  2224   2225     p->needDestroy = 1;
  2225   2226     p->aMem = pMem = &((Mem*)p)[1];
  2226   2227     idx = getVarint32(aKey, szHdr);
  2227   2228     d = szHdr;
  2228         -  i = 0;
  2229         -  while( idx<szHdr && i<p->nField ){
         2229  +  u = 0;
         2230  +  while( idx<szHdr && u<p->nField ){
  2230   2231       u32 serial_type;
  2231   2232   
  2232   2233       idx += getVarint32( aKey+idx, serial_type);
  2233   2234       if( d>=nKey && sqlite3VdbeSerialTypeLen(serial_type)>0 ) break;
  2234   2235       pMem->enc = pKeyInfo->enc;
  2235   2236       pMem->db = pKeyInfo->db;
  2236   2237       pMem->flags = 0;
  2237   2238       pMem->zMalloc = 0;
  2238   2239       d += sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem);
  2239   2240       pMem++;
  2240         -    i++;
         2241  +    u++;
  2241   2242     }
  2242         -  p->nField = i;
         2243  +  p->nField = u;
  2243   2244     return (void*)p;
  2244   2245   }
  2245   2246   
  2246   2247   /*
  2247   2248   ** This routine destroys a UnpackedRecord object
  2248   2249   */
  2249   2250   void sqlite3VdbeDeleteUnpackedRecord(UnpackedRecord *p){