-C Fix\sa\sproblem\swith\sthe\stest\sscripts\scaused\sby\snot\scleaning\sup\sthe\sglobal\stcl\snamespace.\s(CVS\s5044)
-D 2008-04-24T12:38:29
+C Consolidated\svarint\smacro\susage\sfrom\sbtreeInt.h,\svdbe.c,\sand\svdbeaux.c\sinto\ssqliteInt.h\sand\smade\stheir\suse\sconsistent.\s\s\sSlight\simprovements\sto\svarint32\smacros.\s(CVS\s5045)
+D 2008-04-24T19:15:10
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in 25b3282a4ac39388632c2fb0e044ff494d490952
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
F src/bitvec.c 8ec2212cfb702bc4f402c0b7ae7623d85320c714
F src/btmutex.c 483ced3c52205b04b97df69161fadbf87f4f1ea2
-F src/btree.c ee340ad90103fe70526f7b0c3728d185dd470f20
+F src/btree.c 8b2294c64baeee6ae0519e1438c577fd601c02fb
F src/btree.h c66cb17c6fffa84a88926dbef173bab4ae692fd4
-F src/btreeInt.h 8a2718652ed9413dc6acbb02a5c5a23a35a6e983
+F src/btreeInt.h dc04ee33d8eb84714b2acdf81336fbbf6e764530
F src/build.c f56940d7b785cd2f9bcb7e5b6e17157f6feb9c4c
F src/callback.c 77b302b0d41468dcda78c70e706e5b84577f0fa0
F src/complete.c 4cf68fd75d60257524cbe74f87351b9848399131
F src/shell.c be22ec05c8c4a43a95a6ad3b8068542200451e07
F src/sqlite.h.in 1064c85778f68f501ae91b46cd997084a31e0829
F src/sqlite3ext.h faacd0e6a81aabee0861c6d7883c9172e74ef5b3
-F src/sqliteInt.h f06ba8e00fb8232bfef14d203d131ad96f858e04
+F src/sqliteInt.h 8b2cd9c4d74deb17a6c2f76970aca7e39d5628b2
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
F src/table.c 2c48c575dd59b3a6c5c306bc55f51a9402cf429a
F src/tclsqlite.c 2877726bf32f7d72ff057b37ed6c93485b667ea1
F src/test1.c ab25cb2715a9e3f1d91cf99a7280ac7d8dd478e2
F src/test2.c f0808cc643528b9620e4059ca9bda8346f526121
-F src/test3.c c715b5a8a6415d7b2c67f97c394eef488b6f7e63
+F src/test3.c f5328839e29631ed9eef8674994ad7341b2de59b
F src/test4.c c2c0f5dc907f1346f5d4b65eb5799f11eb9e4071
F src/test5.c 3a6a5717a149d7ca2e6d14f5be72cf7555d54dc4
F src/test6.c 62281c0a9ac0265e579065942f7de4e080f8eb05
F src/utf.c 8c94fa10efc78c2568d08d436acc59df4df7191b
F src/util.c 943caa4071488b20ed90588f0704c6825f91836b
F src/vacuum.c 3524411bfb58aac0d87eadd3e5b7cd532772af30
-F src/vdbe.c e0cc1de84b470acd90e6d62a833d09aa531e11d7
+F src/vdbe.c 062c597e167a2284985c0b64e2514b130abde49e
F src/vdbe.h bfd84bda447f39cb599302c7ec85067dae20453c
F src/vdbeInt.h 05316345da487b0cf540482576f9ae3337d133cd
F src/vdbeapi.c 0e1b5a808bb0e556f2a975eb7d11fd3153e922bf
-F src/vdbeaux.c f18c0d2c47877d2ac7bdbf694ecd7b031d43b43a
+F src/vdbeaux.c e742b6547bd2cf57db4ccdee8e3e326f6276a5de
F src/vdbeblob.c 554736781ee273a8089c776e96bdb53e66f57ce6
F src/vdbefifo.c a30c237b2a3577e1415fb6e288cbb6b8ed1e5736
F src/vdbemem.c 237e61216381998ff71c6431e5e7bd03386f6225
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 709d17b19d343f45aa6c7684685ab58c67d83da0
-R 55a29aaf7ba2dc87e2cd1a96447e77ac
-U danielk1977
-Z f9598f73f38dcfab8f31d3b11ad90b4d
+P 440492395854a0886ef954ef2ed638bf587c6f03
+R c23d3964f1f507369116f88a9bc05d16
+U shane
+Z 55dd507043cac48f504ec24a9bd530b1
-440492395854a0886ef954ef2ed638bf587c6f03
\ No newline at end of file
+0d04ccd97841bbbda564cc6ae5da057ee3888fa3
\ No newline at end of file
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.451 2008/04/03 21:46:57 drh Exp $
+** $Id: btree.c,v 1.452 2008/04/24 19:15:10 shane Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
n = pPage->childPtrSize;
assert( n==4-4*pPage->leaf );
if( pPage->hasData ){
- n += getVarint32(&pCell[n], &nPayload);
+ n += getVarint32(&pCell[n], nPayload);
}else{
nPayload = 0;
}
n += getVarint(&pCell[n], (u64 *)&pInfo->nKey);
}else{
u32 x;
- n += getVarint32(&pCell[n], &x);
+ n += getVarint32(&pCell[n], x);
pInfo->nKey = x;
nPayload += x;
}
pCell = findCell(pPage, pCur->idx) + pPage->childPtrSize;
if( pPage->hasData ){
u32 dummy;
- pCell += getVarint32(pCell, &dummy);
+ pCell += getVarint32(pCell, dummy);
}
getVarint(pCell, (u64*)&nCellKey);
if( nCellKey==nKey ){
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btreeInt.h,v 1.20 2008/03/29 16:01:04 drh Exp $
+** $Id: btreeInt.h,v 1.21 2008/04/24 19:15:10 shane Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
# define TRACE(X)
#endif
-/*
-** Routines to read and write variable-length integers. These used to
-** be defined locally, but now we use the varint routines in the util.c
-** file.
-*/
-#define getVarint sqlite3GetVarint
-#define getVarint32(A,B) ((*B=*(A))<=0x7f?1:sqlite3GetVarint32(A,B))
-#define putVarint sqlite3PutVarint
-
/* The database page the PENDING_BYTE occupies. This page is never used.
** TODO: This macro is very similary to PAGER_MJ_PGNO() in pager.c. They
** should possibly be consolidated (presumably in pager.h).
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.694 2008/04/17 17:02:02 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.695 2008/04/24 19:15:10 shane Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
int sqlite3Utf16ByteLen(const void *pData, int nChar);
int sqlite3Utf8CharLen(const char *pData, int nByte);
int sqlite3Utf8Read(const u8*, const u8*, const u8**);
+
+/*
+** Routines to read and write variable-length integers. These used to
+** be defined locally, but now we use the varint routines in the util.c
+** file.
+*/
int sqlite3PutVarint(unsigned char*, u64);
int sqlite3PutVarint32(unsigned char*, u32);
int sqlite3GetVarint(const unsigned char *, u64 *);
int sqlite3GetVarint32(const unsigned char *, u32 *);
int sqlite3VarintLen(u64 v);
+
+/*
+** The header of a record consists of a sequence variable-length integers.
+** These integers are almost always small and are encoded as a single byte.
+** The following macros take advantage this fact to provide a fast encode
+** and decode of the integers in a record header. It is faster for the common
+** case where the integer is a single byte. It is a little slower when the
+** integer is two or more bytes. But overall it is faster.
+**
+** The following expressions are equivalent:
+**
+** x = sqlite3GetVarint32( A, &B );
+** x = sqlite3PutVarint32( A, B );
+**
+** x = getVarint32( A, B );
+** x = putVarint32( A, B );
+**
+*/
+#define getVarint32(A,B) ((*(A)<(unsigned char)0x80) ? ((B) = (u32)*(A)),1 : sqlite3GetVarint32((A), &(B)))
+#define putVarint32(A,B) (((B)<(u32)0x80) ? (*(A) = (unsigned char)(B)),1 : sqlite3PutVarint32((A), (B)))
+#define getVarint sqlite3GetVarint
+#define putVarint sqlite3PutVarint
+
+
void sqlite3IndexAffinityStr(Vdbe *, Index *);
void sqlite3TableAffinityStr(Vdbe *, Table *);
char sqlite3CompareAffinity(Expr *pExpr, char aff2);
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test3.c,v 1.94 2008/03/25 17:23:33 drh Exp $
+** $Id: test3.c,v 1.95 2008/04/24 19:15:10 shane Exp $
*/
#include "sqliteInt.h"
#include "btreeInt.h"
/*
** usage: varint_test START MULTIPLIER COUNT INCREMENT
**
-** This command tests the sqlite3PutVarint() and sqlite3GetVarint()
+** This command tests the putVarint() and getVarint()
** routines, both for accuracy and for speed.
**
-** An integer is written using PutVarint() and read back with
-** GetVarint() and varified to be unchanged. This repeats COUNT
+** An integer is written using putVarint() and read back with
+** getVarint() and varified to be unchanged. This repeats COUNT
** times. The first integer is START*MULTIPLIER. Each iteration
** increases the integer by INCREMENT.
**
in *= mult;
for(i=0; i<count; i++){
char zErr[200];
- n1 = sqlite3PutVarint(zBuf, in);
+ n1 = putVarint(zBuf, in);
if( n1>9 || n1<1 ){
- sprintf(zErr, "PutVarint returned %d - should be between 1 and 9", n1);
+ sprintf(zErr, "putVarint returned %d - should be between 1 and 9", n1);
Tcl_AppendResult(interp, zErr, 0);
return TCL_ERROR;
}
- n2 = sqlite3GetVarint(zBuf, &out);
+ n2 = getVarint(zBuf, &out);
if( n1!=n2 ){
- sprintf(zErr, "PutVarint returned %d and GetVarint returned %d", n1, n2);
+ sprintf(zErr, "putVarint returned %d and getVarint returned %d", n1, n2);
Tcl_AppendResult(interp, zErr, 0);
return TCL_ERROR;
}
}
if( (in & 0xffffffff)==in ){
u32 out32;
- n2 = sqlite3GetVarint32(zBuf, &out32);
+ n2 = getVarint32(zBuf, out32);
out = out32;
if( n1!=n2 ){
- sprintf(zErr, "PutVarint returned %d and GetVarint32 returned %d",
+ sprintf(zErr, "putVarint returned %d and GetVarint32 returned %d",
n1, n2);
Tcl_AppendResult(interp, zErr, 0);
return TCL_ERROR;
** than putVarint.
*/
for(j=0; j<19; j++){
- sqlite3GetVarint(zBuf, &out);
+ getVarint(zBuf, &out);
}
in += incr;
}
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
-** $Id: vdbe.c,v 1.733 2008/04/18 11:31:13 danielk1977 Exp $
+** $Id: vdbe.c,v 1.734 2008/04/24 19:15:11 shane Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
if(((P)->flags&(MEM_Str|MEM_Blob))==0 && sqlite3VdbeMemStringify(P,enc)) \
{ goto no_mem; }
-/*
-** The header of a record consists of a sequence variable-length integers.
-** These integers are almost always small and are encoded as a single byte.
-** The following macro takes advantage this fact to provide a fast decode
-** of the integers in a record header. It is faster for the common case
-** where the integer is a single byte. It is a little slower when the
-** integer is two or more bytes. But overall it is faster.
-**
-** The following expressions are equivalent:
-**
-** x = sqlite3GetVarint32( A, &B );
-**
-** x = GetVarint( A, B );
-**
-*/
-#define GetVarint(A,B) ((B = *(A))<=0x7f ? 1 : sqlite3GetVarint32(A, &B))
-
/*
** An ephemeral string value (signified by the MEM_Ephem flag) contains
** a pointer to a dynamically allocated string where some other entity
/* The following assert is true in all cases accept when
** the database file has been corrupted externally.
** assert( zRec!=0 || avail>=payloadSize || avail>=9 ); */
- szHdrSz = GetVarint((u8*)zData, offset);
+ szHdrSz = getVarint32((u8*)zData, offset);
/* The KeyFetch() or DataFetch() above are fast and will get the entire
** record header in most cases. But they will fail to get the complete
for(i=0; i<nField; i++){
if( zIdx<zEndHdr ){
aOffset[i] = offset;
- zIdx += GetVarint(zIdx, aType[i]);
+ zIdx += getVarint32(zIdx, aType[i]);
offset += sqlite3VdbeSerialTypeLen(aType[i]);
}else{
/* If i is less that nField, then there are less fields in this
zNewRecord = (u8 *)pOut->z;
/* Write the record */
- i = sqlite3PutVarint32(zNewRecord, nHdr);
+ i = putVarint32(zNewRecord, nHdr);
for(pRec=pData0; pRec<=pLast; pRec++){
serial_type = sqlite3VdbeSerialType(pRec, file_format);
- i += sqlite3PutVarint32(&zNewRecord[i], serial_type); /* serial type */
+ i += putVarint32(&zNewRecord[i], serial_type); /* serial type */
}
for(pRec=pData0; pRec<=pLast; pRec++){ /* serial data */
i += sqlite3VdbeSerialPut(&zNewRecord[i], nByte-i, pRec, file_format);
** to version 2.8.7, all this code was combined into the vdbe.c source file.
** But that file was getting too big so this subroutines were split out.
**
-** $Id: vdbeaux.c,v 1.378 2008/04/24 08:36:51 danielk1977 Exp $
+** $Id: vdbeaux.c,v 1.379 2008/04/24 19:15:11 shane Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
return 0;
}
-/*
-** The header of a record consists of a sequence variable-length integers.
-** These integers are almost always small and are encoded as a single byte.
-** The following macro takes advantage this fact to provide a fast decode
-** of the integers in a record header. It is faster for the common case
-** where the integer is a single byte. It is a little slower when the
-** integer is two or more bytes. But overall it is faster.
-**
-** The following expressions are equivalent:
-**
-** x = sqlite3GetVarint32( A, &B );
-**
-** x = GetVarint( A, B );
-**
-*/
-#define GetVarint(A,B) ((B = *(A))<=0x7f ? 1 : sqlite3GetVarint32(A, &B))
/*
** Given the nKey-byte encoding of a record in pKey[], parse the
p->nField = pKeyInfo->nField + 1;
p->needDestroy = 1;
p->aMem = pMem = &((Mem*)p)[1];
- idx = GetVarint(aKey, szHdr);
+ idx = getVarint32(aKey, szHdr);
d = szHdr;
i = 0;
while( idx<szHdr && i<p->nField ){
u32 serial_type;
- idx += GetVarint( aKey+idx, serial_type);
+ idx += getVarint32( aKey+idx, serial_type);
if( d>=nKey && sqlite3VdbeSerialTypeLen(serial_type)>0 ) break;
pMem->enc = pKeyInfo->enc;
pMem->db = pKeyInfo->db;
mem1.flags = 0;
mem1.zMalloc = 0;
- idx1 = GetVarint(aKey1, szHdr1);
+ idx1 = getVarint32(aKey1, szHdr1);
d1 = szHdr1;
nField = pKeyInfo->nField;
while( idx1<szHdr1 && i<pPKey2->nField ){
u32 serial_type1;
/* Read the serial types for the next element in each key. */
- idx1 += GetVarint( aKey1+idx1, serial_type1 );
+ idx1 += getVarint32( aKey1+idx1, serial_type1 );
if( d1>=nKey1 && sqlite3VdbeSerialTypeLen(serial_type1)>0 ) break;
/* Extract the values to be compared.
u32 szHdr; /* Size of the header */
u32 typeRowid; /* Serial type of the rowid */
- sqlite3GetVarint32(aKey, &szHdr);
- sqlite3GetVarint32(&aKey[szHdr-1], &typeRowid);
+ (void)getVarint32(aKey, szHdr);
+ (void)getVarint32(&aKey[szHdr-1], typeRowid);
return sqlite3VdbeSerialTypeLen(typeRowid);
}
if( rc ){
return rc;
}
- sqlite3GetVarint32((u8*)m.z, &szHdr);
- sqlite3GetVarint32((u8*)&m.z[szHdr-1], &typeRowid);
+ (void)getVarint32((u8*)m.z, szHdr);
+ (void)getVarint32((u8*)&m.z[szHdr-1], typeRowid);
lenRowid = sqlite3VdbeSerialTypeLen(typeRowid);
sqlite3VdbeSerialGet((u8*)&m.z[m.n-lenRowid], typeRowid, &v);
*rowid = v.u.i;