/ Check-in [0d04ccd9]
Login

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

Overview
Comment:Consolidated varint macro usage from btreeInt.h, vdbe.c, and vdbeaux.c into sqliteInt.h and made their use consistent. Slight improvements to varint32 macros. (CVS 5045)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0d04ccd97841bbbda564cc6ae5da057ee3888fa3
User & Date: shane 2008-04-24 19:15:10
Context
2008-04-24
22:57
Remove two more unused files. (CVS 5046) check-in: a400faf5 user: drh tags: trunk
19:15
Consolidated varint macro usage from btreeInt.h, vdbe.c, and vdbeaux.c into sqliteInt.h and made their use consistent. Slight improvements to varint32 macros. (CVS 5045) check-in: 0d04ccd9 user: shane tags: trunk
12:38
Fix a problem with the test scripts caused by not cleaning up the global tcl namespace. (CVS 5044) check-in: 44049239 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.451 2008/04/03 21:46:57 drh Exp $
           12  +** $Id: btree.c,v 1.452 2008/04/24 19:15:10 shane 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   
................................................................................
   548    548     assert( sqlite3_mutex_held(pPage->pBt->mutex) );
   549    549   
   550    550     pInfo->pCell = pCell;
   551    551     assert( pPage->leaf==0 || pPage->leaf==1 );
   552    552     n = pPage->childPtrSize;
   553    553     assert( n==4-4*pPage->leaf );
   554    554     if( pPage->hasData ){
   555         -    n += getVarint32(&pCell[n], &nPayload);
          555  +    n += getVarint32(&pCell[n], nPayload);
   556    556     }else{
   557    557       nPayload = 0;
   558    558     }
   559    559     pInfo->nData = nPayload;
   560    560     if( pPage->intKey ){
   561    561       n += getVarint(&pCell[n], (u64 *)&pInfo->nKey);
   562    562     }else{
   563    563       u32 x;
   564         -    n += getVarint32(&pCell[n], &x);
          564  +    n += getVarint32(&pCell[n], x);
   565    565       pInfo->nKey = x;
   566    566       nPayload += x;
   567    567     }
   568    568     pInfo->nPayload = nPayload;
   569    569     pInfo->nHeader = n;
   570    570     if( nPayload<=pPage->maxLocal ){
   571    571       /* This is the (easy) common case where the entire payload fits
................................................................................
  3664   3664         pCur->info.nSize = 0;
  3665   3665         pCur->validNKey = 1;
  3666   3666         if( pPage->intKey ){
  3667   3667           u8 *pCell;
  3668   3668           pCell = findCell(pPage, pCur->idx) + pPage->childPtrSize;
  3669   3669           if( pPage->hasData ){
  3670   3670             u32 dummy;
  3671         -          pCell += getVarint32(pCell, &dummy);
         3671  +          pCell += getVarint32(pCell, dummy);
  3672   3672           }
  3673   3673           getVarint(pCell, (u64*)&nCellKey);
  3674   3674           if( nCellKey==nKey ){
  3675   3675             c = 0;
  3676   3676           }else if( nCellKey<nKey ){
  3677   3677             c = -1;
  3678   3678           }else{

Changes to src/btreeInt.h.

     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: btreeInt.h,v 1.20 2008/03/29 16:01:04 drh Exp $
           12  +** $Id: btreeInt.h,v 1.21 2008/04/24 19:15:10 shane Exp $
    13     13   **
    14     14   ** This file implements a external (disk-based) database using BTrees.
    15     15   ** For a detailed discussion of BTrees, refer to
    16     16   **
    17     17   **     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
    18     18   **     "Sorting And Searching", pages 473-480. Addison-Wesley
    19     19   **     Publishing Company, Reading, Massachusetts.
................................................................................
   491    491   */
   492    492   #if SQLITE_TEST
   493    493   # define TRACE(X)   if( sqlite3BtreeTrace ){ printf X; fflush(stdout); }
   494    494   #else
   495    495   # define TRACE(X)
   496    496   #endif
   497    497   
   498         -/*
   499         -** Routines to read and write variable-length integers.  These used to
   500         -** be defined locally, but now we use the varint routines in the util.c
   501         -** file.
   502         -*/
   503         -#define getVarint    sqlite3GetVarint
   504         -#define getVarint32(A,B)  ((*B=*(A))<=0x7f?1:sqlite3GetVarint32(A,B))
   505         -#define putVarint    sqlite3PutVarint
   506         -
   507    498   /* The database page the PENDING_BYTE occupies. This page is never used.
   508    499   ** TODO: This macro is very similary to PAGER_MJ_PGNO() in pager.c. They
   509    500   ** should possibly be consolidated (presumably in pager.h).
   510    501   **
   511    502   ** If disk I/O is omitted (meaning that the database is stored purely
   512    503   ** in memory) then there is no pending byte.
   513    504   */

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.694 2008/04/17 17:02:02 drh Exp $
           14  +** @(#) $Id: sqliteInt.h,v 1.695 2008/04/24 19:15:10 shane 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 it was run
    21     21   ** (otherwise we get an empty default).
................................................................................
  1991   1991   int sqlite3AtoF(const char *z, double*);
  1992   1992   char *sqlite3_snprintf(int,char*,const char*,...);
  1993   1993   int sqlite3GetInt32(const char *, int*);
  1994   1994   int sqlite3FitsIn64Bits(const char *, int);
  1995   1995   int sqlite3Utf16ByteLen(const void *pData, int nChar);
  1996   1996   int sqlite3Utf8CharLen(const char *pData, int nByte);
  1997   1997   int sqlite3Utf8Read(const u8*, const u8*, const u8**);
         1998  +
         1999  +/*
         2000  +** Routines to read and write variable-length integers.  These used to
         2001  +** be defined locally, but now we use the varint routines in the util.c
         2002  +** file.
         2003  +*/
  1998   2004   int sqlite3PutVarint(unsigned char*, u64);
  1999   2005   int sqlite3PutVarint32(unsigned char*, u32);
  2000   2006   int sqlite3GetVarint(const unsigned char *, u64 *);
  2001   2007   int sqlite3GetVarint32(const unsigned char *, u32 *);
  2002   2008   int sqlite3VarintLen(u64 v);
         2009  +
         2010  +/*
         2011  +** The header of a record consists of a sequence variable-length integers.
         2012  +** These integers are almost always small and are encoded as a single byte.
         2013  +** The following macros take advantage this fact to provide a fast encode
         2014  +** and decode of the integers in a record header.  It is faster for the common
         2015  +** case where the integer is a single byte.  It is a little slower when the
         2016  +** integer is two or more bytes.  But overall it is faster.
         2017  +**
         2018  +** The following expressions are equivalent:
         2019  +**
         2020  +**     x = sqlite3GetVarint32( A, &B );
         2021  +**     x = sqlite3PutVarint32( A, B );
         2022  +**
         2023  +**     x = getVarint32( A, B );
         2024  +**     x = putVarint32( A, B );
         2025  +**
         2026  +*/
         2027  +#define getVarint32(A,B)  ((*(A)<(unsigned char)0x80) ? ((B) = (u32)*(A)),1 : sqlite3GetVarint32((A), &(B)))
         2028  +#define putVarint32(A,B)  (((B)<(u32)0x80) ? (*(A) = (unsigned char)(B)),1 : sqlite3PutVarint32((A), (B)))
         2029  +#define getVarint    sqlite3GetVarint
         2030  +#define putVarint    sqlite3PutVarint
         2031  +
         2032  +
  2003   2033   void sqlite3IndexAffinityStr(Vdbe *, Index *);
  2004   2034   void sqlite3TableAffinityStr(Vdbe *, Table *);
  2005   2035   char sqlite3CompareAffinity(Expr *pExpr, char aff2);
  2006   2036   int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity);
  2007   2037   char sqlite3ExprAffinity(Expr *pExpr);
  2008   2038   int sqlite3Atoi64(const char*, i64*);
  2009   2039   void sqlite3Error(sqlite3*, int, const char*,...);

Changes to src/test3.c.

     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** Code for testing the btree.c module in SQLite.  This code
    13     13   ** is not included in the SQLite library.  It is used for automated
    14     14   ** testing of the SQLite library.
    15     15   **
    16         -** $Id: test3.c,v 1.94 2008/03/25 17:23:33 drh Exp $
           16  +** $Id: test3.c,v 1.95 2008/04/24 19:15:10 shane Exp $
    17     17   */
    18     18   #include "sqliteInt.h"
    19     19   #include "btreeInt.h"
    20     20   #include "tcl.h"
    21     21   #include <stdlib.h>
    22     22   #include <string.h>
    23     23   
................................................................................
  1443   1443   ){
  1444   1444     return TCL_OK;
  1445   1445   }
  1446   1446   
  1447   1447   /*
  1448   1448   ** usage:   varint_test  START  MULTIPLIER  COUNT  INCREMENT
  1449   1449   **
  1450         -** This command tests the sqlite3PutVarint() and sqlite3GetVarint()
         1450  +** This command tests the putVarint() and getVarint()
  1451   1451   ** routines, both for accuracy and for speed.
  1452   1452   **
  1453         -** An integer is written using PutVarint() and read back with
  1454         -** GetVarint() and varified to be unchanged.  This repeats COUNT
         1453  +** An integer is written using putVarint() and read back with
         1454  +** getVarint() and varified to be unchanged.  This repeats COUNT
  1455   1455   ** times.  The first integer is START*MULTIPLIER.  Each iteration
  1456   1456   ** increases the integer by INCREMENT.
  1457   1457   **
  1458   1458   ** This command returns nothing if it works.  It returns an error message
  1459   1459   ** if something goes wrong.
  1460   1460   */
  1461   1461   static int btree_varint_test(
................................................................................
  1477   1477     if( Tcl_GetInt(interp, argv[2], (int*)&mult) ) return TCL_ERROR;
  1478   1478     if( Tcl_GetInt(interp, argv[3], (int*)&count) ) return TCL_ERROR;
  1479   1479     if( Tcl_GetInt(interp, argv[4], (int*)&incr) ) return TCL_ERROR;
  1480   1480     in = start;
  1481   1481     in *= mult;
  1482   1482     for(i=0; i<count; i++){
  1483   1483       char zErr[200];
  1484         -    n1 = sqlite3PutVarint(zBuf, in);
         1484  +    n1 = putVarint(zBuf, in);
  1485   1485       if( n1>9 || n1<1 ){
  1486         -      sprintf(zErr, "PutVarint returned %d - should be between 1 and 9", n1);
         1486  +      sprintf(zErr, "putVarint returned %d - should be between 1 and 9", n1);
  1487   1487         Tcl_AppendResult(interp, zErr, 0);
  1488   1488         return TCL_ERROR;
  1489   1489       }
  1490         -    n2 = sqlite3GetVarint(zBuf, &out);
         1490  +    n2 = getVarint(zBuf, &out);
  1491   1491       if( n1!=n2 ){
  1492         -      sprintf(zErr, "PutVarint returned %d and GetVarint returned %d", n1, n2);
         1492  +      sprintf(zErr, "putVarint returned %d and getVarint returned %d", n1, n2);
  1493   1493         Tcl_AppendResult(interp, zErr, 0);
  1494   1494         return TCL_ERROR;
  1495   1495       }
  1496   1496       if( in!=out ){
  1497   1497         sprintf(zErr, "Wrote 0x%016llx and got back 0x%016llx", in, out);
  1498   1498         Tcl_AppendResult(interp, zErr, 0);
  1499   1499         return TCL_ERROR;
  1500   1500       }
  1501   1501       if( (in & 0xffffffff)==in ){
  1502   1502         u32 out32;
  1503         -      n2 = sqlite3GetVarint32(zBuf, &out32);
         1503  +      n2 = getVarint32(zBuf, out32);
  1504   1504         out = out32;
  1505   1505         if( n1!=n2 ){
  1506         -        sprintf(zErr, "PutVarint returned %d and GetVarint32 returned %d", 
         1506  +        sprintf(zErr, "putVarint returned %d and GetVarint32 returned %d", 
  1507   1507                     n1, n2);
  1508   1508           Tcl_AppendResult(interp, zErr, 0);
  1509   1509           return TCL_ERROR;
  1510   1510         }
  1511   1511         if( in!=out ){
  1512   1512           sprintf(zErr, "Wrote 0x%016llx and got back 0x%016llx from GetVarint32",
  1513   1513               in, out);
................................................................................
  1517   1517       }
  1518   1518   
  1519   1519       /* In order to get realistic timings, run getVarint 19 more times.
  1520   1520       ** This is because getVarint is called about 20 times more often
  1521   1521       ** than putVarint.
  1522   1522       */
  1523   1523       for(j=0; j<19; j++){
  1524         -      sqlite3GetVarint(zBuf, &out);
         1524  +      getVarint(zBuf, &out);
  1525   1525       }
  1526   1526       in += incr;
  1527   1527     }
  1528   1528     return TCL_OK;
  1529   1529   }
  1530   1530   
  1531   1531   /*

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.733 2008/04/18 11:31:13 danielk1977 Exp $
           46  +** $Id: vdbe.c,v 1.734 2008/04/24 19:15:11 shane 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
................................................................................
   119    119   ** Convert the given register into a string if it isn't one
   120    120   ** already. Return non-zero if a malloc() fails.
   121    121   */
   122    122   #define Stringify(P, enc) \
   123    123      if(((P)->flags&(MEM_Str|MEM_Blob))==0 && sqlite3VdbeMemStringify(P,enc)) \
   124    124        { goto no_mem; }
   125    125   
   126         -/*
   127         -** The header of a record consists of a sequence variable-length integers.
   128         -** These integers are almost always small and are encoded as a single byte.
   129         -** The following macro takes advantage this fact to provide a fast decode
   130         -** of the integers in a record header.  It is faster for the common case
   131         -** where the integer is a single byte.  It is a little slower when the
   132         -** integer is two or more bytes.  But overall it is faster.
   133         -**
   134         -** The following expressions are equivalent:
   135         -**
   136         -**     x = sqlite3GetVarint32( A, &B );
   137         -**
   138         -**     x = GetVarint( A, B );
   139         -**
   140         -*/
   141         -#define GetVarint(A,B)  ((B = *(A))<=0x7f ? 1 : sqlite3GetVarint32(A, &B))
   142         -
   143    126   /*
   144    127   ** An ephemeral string value (signified by the MEM_Ephem flag) contains
   145    128   ** a pointer to a dynamically allocated string where some other entity
   146    129   ** is responsible for deallocating that string.  Because the register
   147    130   ** does not control the string, it might be deleted without the register
   148    131   ** knowing it.
   149    132   **
................................................................................
  2014   1997         }else{
  2015   1998           pC->aRow = 0;
  2016   1999         }
  2017   2000       }
  2018   2001       /* The following assert is true in all cases accept when
  2019   2002       ** the database file has been corrupted externally.
  2020   2003       **    assert( zRec!=0 || avail>=payloadSize || avail>=9 ); */
  2021         -    szHdrSz = GetVarint((u8*)zData, offset);
         2004  +    szHdrSz = getVarint32((u8*)zData, offset);
  2022   2005   
  2023   2006       /* The KeyFetch() or DataFetch() above are fast and will get the entire
  2024   2007       ** record header in most cases.  But they will fail to get the complete
  2025   2008       ** record header if the record header does not fit on a single page
  2026   2009       ** in the B-Tree.  When that happens, use sqlite3VdbeMemFromBtree() to
  2027   2010       ** acquire the complete header text.
  2028   2011       */
................................................................................
  2042   2025       ** arrays.  aType[i] will contain the type integer for the i-th
  2043   2026       ** column and aOffset[i] will contain the offset from the beginning
  2044   2027       ** of the record to the start of the data for the i-th column
  2045   2028       */
  2046   2029       for(i=0; i<nField; i++){
  2047   2030         if( zIdx<zEndHdr ){
  2048   2031           aOffset[i] = offset;
  2049         -        zIdx += GetVarint(zIdx, aType[i]);
         2032  +        zIdx += getVarint32(zIdx, aType[i]);
  2050   2033           offset += sqlite3VdbeSerialTypeLen(aType[i]);
  2051   2034         }else{
  2052   2035           /* If i is less that nField, then there are less fields in this
  2053   2036           ** record than SetNumColumns indicated there are columns in the
  2054   2037           ** table. Set the offset for any extra columns not present in
  2055   2038           ** the record to 0. This tells code below to store a NULL
  2056   2039           ** instead of deserializing a value from the record.
................................................................................
  2254   2237     pOut = &p->aMem[pOp->p3];
  2255   2238     if( sqlite3VdbeMemGrow(pOut, nByte, 0) ){
  2256   2239       goto no_mem;
  2257   2240     }
  2258   2241     zNewRecord = (u8 *)pOut->z;
  2259   2242   
  2260   2243     /* Write the record */
  2261         -  i = sqlite3PutVarint32(zNewRecord, nHdr);
         2244  +  i = putVarint32(zNewRecord, nHdr);
  2262   2245     for(pRec=pData0; pRec<=pLast; pRec++){
  2263   2246       serial_type = sqlite3VdbeSerialType(pRec, file_format);
  2264         -    i += sqlite3PutVarint32(&zNewRecord[i], serial_type);      /* serial type */
         2247  +    i += putVarint32(&zNewRecord[i], serial_type);      /* serial type */
  2265   2248     }
  2266   2249     for(pRec=pData0; pRec<=pLast; pRec++){  /* serial data */
  2267   2250       i += sqlite3VdbeSerialPut(&zNewRecord[i], nByte-i, pRec, file_format);
  2268   2251     }
  2269   2252     assert( i==nByte );
  2270   2253   
  2271   2254     assert( pOp->p3>0 && pOp->p3<=p->nMem );

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.378 2008/04/24 08:36:51 danielk1977 Exp $
           17  +** $Id: vdbeaux.c,v 1.379 2008/04/24 19:15:11 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   
................................................................................
  2155   2155         }
  2156   2156         return len;
  2157   2157       }
  2158   2158     }
  2159   2159     return 0;
  2160   2160   }
  2161   2161   
  2162         -/*
  2163         -** The header of a record consists of a sequence variable-length integers.
  2164         -** These integers are almost always small and are encoded as a single byte.
  2165         -** The following macro takes advantage this fact to provide a fast decode
  2166         -** of the integers in a record header.  It is faster for the common case
  2167         -** where the integer is a single byte.  It is a little slower when the
  2168         -** integer is two or more bytes.  But overall it is faster.
  2169         -**
  2170         -** The following expressions are equivalent:
  2171         -**
  2172         -**     x = sqlite3GetVarint32( A, &B );
  2173         -**
  2174         -**     x = GetVarint( A, B );
  2175         -**
  2176         -*/
  2177         -#define GetVarint(A,B)  ((B = *(A))<=0x7f ? 1 : sqlite3GetVarint32(A, &B))
  2178   2162   
  2179   2163   /*
  2180   2164   ** Given the nKey-byte encoding of a record in pKey[], parse the
  2181   2165   ** record into a UnpackedRecord structure.  Return a pointer to
  2182   2166   ** that structure.
  2183   2167   **
  2184   2168   ** The calling function might provide szSpace bytes of memory
................................................................................
  2213   2197       p = pSpace;
  2214   2198       p->needFree = 0;
  2215   2199     }
  2216   2200     p->pKeyInfo = pKeyInfo;
  2217   2201     p->nField = pKeyInfo->nField + 1;
  2218   2202     p->needDestroy = 1;
  2219   2203     p->aMem = pMem = &((Mem*)p)[1];
  2220         -  idx = GetVarint(aKey, szHdr);
         2204  +  idx = getVarint32(aKey, szHdr);
  2221   2205     d = szHdr;
  2222   2206     i = 0;
  2223   2207     while( idx<szHdr && i<p->nField ){
  2224   2208       u32 serial_type;
  2225   2209   
  2226         -    idx += GetVarint( aKey+idx, serial_type);
         2210  +    idx += getVarint32( aKey+idx, serial_type);
  2227   2211       if( d>=nKey && sqlite3VdbeSerialTypeLen(serial_type)>0 ) break;
  2228   2212       pMem->enc = pKeyInfo->enc;
  2229   2213       pMem->db = pKeyInfo->db;
  2230   2214       pMem->flags = 0;
  2231   2215       pMem->zMalloc = 0;
  2232   2216       d += sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem);
  2233   2217       pMem++;
................................................................................
  2292   2276   
  2293   2277     pKeyInfo = pPKey2->pKeyInfo;
  2294   2278     mem1.enc = pKeyInfo->enc;
  2295   2279     mem1.db = pKeyInfo->db;
  2296   2280     mem1.flags = 0;
  2297   2281     mem1.zMalloc = 0;
  2298   2282     
  2299         -  idx1 = GetVarint(aKey1, szHdr1);
         2283  +  idx1 = getVarint32(aKey1, szHdr1);
  2300   2284     d1 = szHdr1;
  2301   2285     nField = pKeyInfo->nField;
  2302   2286     while( idx1<szHdr1 && i<pPKey2->nField ){
  2303   2287       u32 serial_type1;
  2304   2288   
  2305   2289       /* Read the serial types for the next element in each key. */
  2306         -    idx1 += GetVarint( aKey1+idx1, serial_type1 );
         2290  +    idx1 += getVarint32( aKey1+idx1, serial_type1 );
  2307   2291       if( d1>=nKey1 && sqlite3VdbeSerialTypeLen(serial_type1)>0 ) break;
  2308   2292   
  2309   2293       /* Extract the values to be compared.
  2310   2294       */
  2311   2295       d1 += sqlite3VdbeSerialGet(&aKey1[d1], serial_type1, &mem1);
  2312   2296   
  2313   2297       /* Do the comparison
................................................................................
  2347   2331   ** an integer rowid).  This routine returns the number of bytes in
  2348   2332   ** that integer.
  2349   2333   */
  2350   2334   int sqlite3VdbeIdxRowidLen(const u8 *aKey){
  2351   2335     u32 szHdr;        /* Size of the header */
  2352   2336     u32 typeRowid;    /* Serial type of the rowid */
  2353   2337   
  2354         -  sqlite3GetVarint32(aKey, &szHdr);
  2355         -  sqlite3GetVarint32(&aKey[szHdr-1], &typeRowid);
         2338  +  (void)getVarint32(aKey, szHdr);
         2339  +  (void)getVarint32(&aKey[szHdr-1], typeRowid);
  2356   2340     return sqlite3VdbeSerialTypeLen(typeRowid);
  2357   2341   }
  2358   2342     
  2359   2343   
  2360   2344   /*
  2361   2345   ** pCur points at an index entry created using the OP_MakeRecord opcode.
  2362   2346   ** Read the rowid (the last field in the record) and store it in *rowid.
................................................................................
  2377   2361     m.flags = 0;
  2378   2362     m.db = 0;
  2379   2363     m.zMalloc = 0;
  2380   2364     rc = sqlite3VdbeMemFromBtree(pCur, 0, nCellKey, 1, &m);
  2381   2365     if( rc ){
  2382   2366       return rc;
  2383   2367     }
  2384         -  sqlite3GetVarint32((u8*)m.z, &szHdr);
  2385         -  sqlite3GetVarint32((u8*)&m.z[szHdr-1], &typeRowid);
         2368  +  (void)getVarint32((u8*)m.z, szHdr);
         2369  +  (void)getVarint32((u8*)&m.z[szHdr-1], typeRowid);
  2386   2370     lenRowid = sqlite3VdbeSerialTypeLen(typeRowid);
  2387   2371     sqlite3VdbeSerialGet((u8*)&m.z[m.n-lenRowid], typeRowid, &v);
  2388   2372     *rowid = v.u.i;
  2389   2373     sqlite3VdbeMemRelease(&m);
  2390   2374     return SQLITE_OK;
  2391   2375   }
  2392   2376