/ Check-in [9939dd83]
Login

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

Overview
Comment:Modifications to avoid signed/unsigned warnings in vdbe.c. (CVS 5912)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9939dd839ac13708f9b5b877c48729b1781eedf3
User & Date: danielk1977 2008-11-17 15:31:48
Context
2008-11-17
16:42
Modifications to avoid unsigned/signed comparisons in where.c. (CVS 5913) check-in: f35606d1 user: danielk1977 tags: trunk
15:31
Modifications to avoid signed/unsigned warnings in vdbe.c. (CVS 5912) check-in: 9939dd83 user: danielk1977 tags: trunk
14:20
Changes to btree.c to avoid the unsigned/signed comparison warnings. (CVS 5911) check-in: 24469dba user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

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.792 2008/11/13 18:00:15 danielk1977 Exp $
           14  +** @(#) $Id: sqliteInt.h,v 1.793 2008/11/17 15:31:48 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
................................................................................
   681    681     u8 dfltJournalMode;           /* Default journal mode for attached dbs */
   682    682     signed char nextAutovac;      /* Autovac setting after VACUUM if >=0 */
   683    683     int nextPagesize;             /* Pagesize after VACUUM if >0 */
   684    684     int nTable;                   /* Number of tables in the database */
   685    685     CollSeq *pDfltColl;           /* The default collating sequence (BINARY) */
   686    686     i64 lastRowid;                /* ROWID of most recent insert (see above) */
   687    687     i64 priorNewRowid;            /* Last randomly generated ROWID */
   688         -  int magic;                    /* Magic number for detect library misuse */
          688  +  u32 magic;                    /* Magic number for detect library misuse */
   689    689     int nChange;                  /* Value returned by sqlite3_changes() */
   690    690     int nTotalChange;             /* Value returned by sqlite3_total_changes() */
   691    691     sqlite3_mutex *mutex;         /* Connection mutex */
   692    692     int aLimit[SQLITE_N_LIMIT];   /* Limits */
   693    693     struct sqlite3InitInfo {      /* Information used during initialization */
   694    694       int iDb;                    /* When back is being initialized */
   695    695       int newTnum;                /* Rootpage of table being initialized */
................................................................................
  2331   2331   **     x = sqlite3GetVarint32( A, &B );
  2332   2332   **     x = sqlite3PutVarint32( A, B );
  2333   2333   **
  2334   2334   **     x = getVarint32( A, B );
  2335   2335   **     x = putVarint32( A, B );
  2336   2336   **
  2337   2337   */
  2338         -#define getVarint32(A,B)  ((*(A)<(unsigned char)0x80) ? ((B) = (u32)*(A)),1 : sqlite3GetVarint32((A), &(B)))
  2339         -#define putVarint32(A,B)  (((B)<(u32)0x80) ? (*(A) = (unsigned char)(B)),1 : sqlite3PutVarint32((A), (B)))
         2338  +#define getVarint32(A,B)  ((*(A)<(unsigned char)0x80) ? ((B) = (u32)*(A)),1 : sqlite3GetVarint32((A), (u32 *)&(B)))
         2339  +#define putVarint32(A,B)  (((u32)(B)<(u32)0x80) ? (*(A) = (unsigned char)(B)),1 : sqlite3PutVarint32((A), (B)))
  2340   2340   #define getVarint    sqlite3GetVarint
  2341   2341   #define putVarint    sqlite3PutVarint
  2342   2342   
  2343   2343   
  2344   2344   void sqlite3IndexAffinityStr(Vdbe *, Index *);
  2345   2345   void sqlite3TableAffinityStr(Vdbe *, Table *);
  2346   2346   char sqlite3CompareAffinity(Expr *pExpr, char aff2);

Changes to src/vdbe.c.

    39     39   **
    40     40   ** Various scripts scan this source file in order to generate HTML
    41     41   ** documentation, headers files, or other derived files.  The formatting
    42     42   ** of the code in this file is, therefore, important.  See other comments
    43     43   ** in this file for details.  If in doubt, do not deviate from existing
    44     44   ** commenting and indentation practices when changing or adding code.
    45     45   **
    46         -** $Id: vdbe.c,v 1.787 2008/11/13 18:29:51 shane Exp $
           46  +** $Id: vdbe.c,v 1.788 2008/11/17 15:31:48 danielk1977 Exp $
    47     47   */
    48     48   #include "sqliteInt.h"
    49     49   #include <ctype.h>
    50     50   #include "vdbeInt.h"
    51     51   
    52     52   /*
    53     53   ** The following global variable is incremented every time a cursor
................................................................................
   173    173   static const unsigned char opcodeProperty[] = OPFLG_INITIALIZER;
   174    174   
   175    175   /*
   176    176   ** Return true if an opcode has any of the OPFLG_xxx properties
   177    177   ** specified by mask.
   178    178   */
   179    179   int sqlite3VdbeOpcodeHasProperty(int opcode, int mask){
   180         -  assert( opcode>0 && opcode<sizeof(opcodeProperty) );
          180  +  assert( opcode>0 && opcode<(int)sizeof(opcodeProperty) );
   181    181     return (opcodeProperty[opcode]&mask)!=0;
   182    182   }
   183    183   
   184    184   /*
   185    185   ** Allocate VdbeCursor number iCur.  Return a pointer to it.  Return NULL
   186    186   ** if we run out of memory.
   187    187   */
................................................................................
   547    547     u64 start;                 /* CPU clock count at start of opcode */
   548    548     int origPc;                /* Program counter at start of opcode */
   549    549   #endif
   550    550   #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
   551    551     int nProgressOps = 0;      /* Opcodes executed since progress callback. */
   552    552   #endif
   553    553     UnpackedRecord aTempRec[16]; /* Space to hold a transient UnpackedRecord */
   554         -
   555    554   
   556    555     assert( p->magic==VDBE_MAGIC_RUN );  /* sqlite3_step() verifies this */
   557    556     assert( db->magic==SQLITE_MAGIC_BUSY );
   558    557     sqlite3BtreeMutexArrayEnter(&p->aMutex);
   559    558     if( p->rc==SQLITE_NOMEM ){
   560    559       /* This happens if a malloc() inside a call to sqlite3_column_text() or
   561    560       ** sqlite3_column_text16() failed.  */
................................................................................
  1960   1959   ** The value extracted is stored in register P3.
  1961   1960   **
  1962   1961   ** If the column contains fewer than P2 fields, then extract a NULL.  Or,
  1963   1962   ** if the P4 argument is a P4_MEM use the value of the P4 argument as
  1964   1963   ** the result.
  1965   1964   */
  1966   1965   case OP_Column: {
  1967         -  u32 payloadSize;   /* Number of bytes in the record */
         1966  +  int payloadSize;   /* Number of bytes in the record */
  1968   1967     int p1 = pOp->p1;  /* P1 value of the opcode */
  1969   1968     int p2 = pOp->p2;  /* column number to retrieve */
  1970   1969     VdbeCursor *pC = 0;/* The VDBE cursor */
  1971   1970     char *zRec;        /* Pointer to complete record-data */
  1972   1971     BtCursor *pCrsr;   /* The BTree cursor */
  1973   1972     u32 *aType;        /* aType[i] holds the numeric type of the i-th column */
  1974   1973     u32 *aOffset;      /* aOffset[i] is offset to start of data for i-th column */
  1975         -  u32 nField;        /* number of fields in the record */
         1974  +  int nField;        /* number of fields in the record */
  1976   1975     int len;           /* The length of the serialized data for the column */
  1977   1976     int i;             /* Loop counter */
  1978   1977     char *zData;       /* Part of the record being decoded */
  1979   1978     Mem *pDest;        /* Where to write the extracted value */
  1980   1979     Mem sMem;          /* For storing the record being decoded */
  1981   1980   
  1982   1981     sMem.flags = 0;
................................................................................
  2016   2015         payloadSize = pC->payloadSize;
  2017   2016         zRec = (char*)pC->aRow;
  2018   2017       }else if( pC->isIndex ){
  2019   2018         i64 payloadSize64;
  2020   2019         sqlite3BtreeKeySize(pCrsr, &payloadSize64);
  2021   2020         payloadSize = payloadSize64;
  2022   2021       }else{
  2023         -      sqlite3BtreeDataSize(pCrsr, &payloadSize);
         2022  +      sqlite3BtreeDataSize(pCrsr, (u32 *)&payloadSize);
  2024   2023       }
  2025   2024       nField = pC->nField;
  2026   2025     }else{
  2027   2026       assert( pC->pseudoTable );
  2028   2027       /* The record is the sole entry of a pseudo-table */
  2029   2028       payloadSize = pC->nData;
  2030   2029       zRec = pC->pData;
................................................................................
  2050   2049     */
  2051   2050     aType = pC->aType;
  2052   2051     if( pC->cacheStatus==p->cacheCtr ){
  2053   2052       aOffset = pC->aOffset;
  2054   2053     }else{
  2055   2054       u8 *zIdx;        /* Index into header */
  2056   2055       u8 *zEndHdr;     /* Pointer to first byte after the header */
  2057         -    u32 offset;      /* Offset into the data */
         2056  +    int offset;      /* Offset into the data */
  2058   2057       int szHdrSz;     /* Size of the header size field at start of record */
  2059   2058       int avail;       /* Number of bytes of available data */
  2060   2059   
  2061   2060       assert(aType);
  2062   2061       pC->aOffset = aOffset = &aType[nField];
  2063   2062       pC->payloadSize = payloadSize;
  2064   2063       pC->cacheStatus = p->cacheCtr;
................................................................................
  2251   2250     ** hdr-size field is also a varint which is the offset from the beginning
  2252   2251     ** of the record to data0.
  2253   2252     */
  2254   2253     u8 *zNewRecord;        /* A buffer to hold the data for the new record */
  2255   2254     Mem *pRec;             /* The new record */
  2256   2255     u64 nData = 0;         /* Number of bytes of data space */
  2257   2256     int nHdr = 0;          /* Number of bytes of header space */
  2258         -  u64 nByte = 0;         /* Data space required for this record */
         2257  +  i64 nByte = 0;         /* Data space required for this record */
  2259   2258     int nZero = 0;         /* Number of zero bytes at the end of the record */
  2260   2259     int nVarint;           /* Number of bytes in a varint */
  2261   2260     u32 serial_type;       /* Type field */
  2262   2261     Mem *pData0;           /* First field to be combined into the record */
  2263   2262     Mem *pLast;            /* Last field of the record */
  2264   2263     int nField;            /* Number of fields in the record */
  2265   2264     char *zAffinity;       /* The affinity string for the record */
................................................................................
  3324   3323   #ifdef SQLITE_32BIT_ROWID
  3325   3324   #   define MAX_ROWID 0x7fffffff
  3326   3325   #else
  3327   3326       /* Some compilers complain about constants of the form 0x7fffffffffffffff.
  3328   3327       ** Others complain about 0x7ffffffffffffffffLL.  The following macro seems
  3329   3328       ** to provide the constant while making all compilers happy.
  3330   3329       */
  3331         -#   define MAX_ROWID  ( (((u64)0x7fffffff)<<32) | (u64)0xffffffff )
         3330  +#   define MAX_ROWID  (i64)( (((u64)0x7fffffff)<<32) | (u64)0xffffffff )
  3332   3331   #endif
  3333   3332   
  3334   3333       if( !pC->useRandomRowid ){
  3335   3334         if( pC->nextRowidValid ){
  3336   3335           v = pC->nextRowid;
  3337   3336         }else{
  3338   3337           rc = sqlite3BtreeLast(pC->pCursor, &res);
................................................................................
  3630   3629       sqlite3BtreeKeySize(pCrsr, &n64);
  3631   3630       if( n64>db->aLimit[SQLITE_LIMIT_LENGTH] ){
  3632   3631         goto too_big;
  3633   3632       }
  3634   3633       n = n64;
  3635   3634     }else{
  3636   3635       sqlite3BtreeDataSize(pCrsr, &n);
  3637         -    if( n>db->aLimit[SQLITE_LIMIT_LENGTH] ){
         3636  +    if( (int)n>db->aLimit[SQLITE_LIMIT_LENGTH] ){
  3638   3637         goto too_big;
  3639   3638       }
  3640   3639     }
  3641   3640     if( sqlite3VdbeMemGrow(pOut, n, 0) ){
  3642   3641       goto no_mem;
  3643   3642     }
  3644   3643     pOut->n = n;

Changes to src/vdbeInt.h.

    11     11   *************************************************************************
    12     12   ** This is the header file for information that is private to the
    13     13   ** VDBE.  This information used to all be at the top of the single
    14     14   ** source code file "vdbe.c".  When that file became too big (over
    15     15   ** 6000 lines long) it was split up into several smaller files and
    16     16   ** this header information was factored out.
    17     17   **
    18         -** $Id: vdbeInt.h,v 1.157 2008/11/05 16:37:35 drh Exp $
           18  +** $Id: vdbeInt.h,v 1.158 2008/11/17 15:31:48 danielk1977 Exp $
    19     19   */
    20     20   #ifndef _VDBEINT_H_
    21     21   #define _VDBEINT_H_
    22     22   
    23     23   /*
    24     24   ** intToKey() and keyToInt() used to transform the rowid.  But with
    25     25   ** the latest versions of the design they are no-ops.
................................................................................
   292    292     Mem *aColName;      /* Column names to return */
   293    293     int nCursor;        /* Number of slots in apCsr[] */
   294    294     VdbeCursor **apCsr; /* One element of this array for each open cursor */
   295    295     int nVar;           /* Number of entries in aVar[] */
   296    296     Mem *aVar;          /* Values for the OP_Variable opcode. */
   297    297     char **azVar;       /* Name of variables */
   298    298     int okVar;          /* True if azVar[] has been initialized */
   299         -  int magic;              /* Magic number for sanity checking */
          299  +  u32 magic;              /* Magic number for sanity checking */
   300    300     int nMem;               /* Number of memory locations currently allocated */
   301    301     Mem *aMem;              /* The memory locations */
   302    302     int nCallback;          /* Number of callbacks invoked so far */
   303    303     int cacheCtr;           /* VdbeCursor row cache generation counter */
   304    304     Fifo sFifo;             /* A list of ROWIDs */
   305    305     int contextStackTop;    /* Index of top element in the context stack */
   306    306     int contextStackDepth;  /* The size of the "context" stack */