Fix some of the issues raised in #1615. (CVS 2959)

FossilOrigin-Name: 0d5d83bcbd65dd7ae968909acfee075185e49c38
This commit is contained in:
danielk1977 2006-01-16 15:14:27 +00:00
parent 80c43bcba1
commit bab45c647d
10 changed files with 58 additions and 52 deletions

View File

@ -1,5 +1,5 @@
C Correctly\shandle\smalloc()\sfailure\sin\sGenericMalloc()\sand\sGenericRealloc().\sFix\sfor\s#1617.\s(CVS\s2958)
D 2006-01-16T14:29:06
C Fix\ssome\sof\sthe\sissues\sraised\sin\s#1615.\s(CVS\s2959)
D 2006-01-16T15:14:27
F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967
F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -34,9 +34,9 @@ F src/alter.c 4139c8f1d0f12b1759e767b1d09dd594e2b5ac1d
F src/analyze.c 7d2b7ab9a9c2fd6e55700f69064dfdd3e36d7a8a
F src/attach.c d4b9d8bd71d72409720946355be41cafb6c09079
F src/auth.c 9ae84d2d94eb96195e04515715e08e85963e96c2
F src/btree.c a4c147937df5ab7d18cf8da67eb766a00c0be1b2
F src/btree.c fcf6aec3b6a6df8130213a45f7b543e0a025be9d
F src/btree.h 5663c4f43e8521546ccebc8fc95acb013b8f3184
F src/build.c 206c891028158668691f27bcbf7c3c4f15248a94
F src/build.c 539b5c6e21aa633e480ff97706f331baef1a859a
F src/callback.c ba3e6cc7a6beb562e7a66f92e26fabcb21aab1e2
F src/complete.c df1681cef40dec33a286006981845f87b194e7a4
F src/date.c 5f5850c6b5da68fdc47d124573715ba948c9d8e0
@ -59,7 +59,7 @@ F src/os_unix.c 7daa1720d46bbc31c6138462b35876650eb1885e
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
F src/os_win.c cd4ca2753aeaad11f5c9b9b6ef28752f45ed4529
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c 02a30687533da39851f7776ae49671684333b248
F src/pager.c a8ba14f898eaaa529d5463c1a6782e86abfe6cdd
F src/pager.h e0acb095b3ad0bca48f2ab00c87346665643f64f
F src/parse.y 83df51fea35f68f7e07384d75dce83d1ed30434c
F src/pragma.c 4496cc77dc35824e1c978c3d1413b8a5a4c777d3
@ -70,7 +70,7 @@ F src/select.c 28d449c7762dd580aaba49a9c6c16e93ca951e49
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
F src/shell.c 66b073375efbdee19045e7e0cd38b85f9aff71da
F src/sqlite.h.in 492580f7e3ff71eb43193eb7bb98e2d549889ce3
F src/sqliteInt.h 940bb605c7ac9240934f0b866f90be899f5261fc
F src/sqliteInt.h 730d071c5272726b5e507ef6d6dd14ccdb2744ae
F src/table.c 486dcfce532685b53b5a2b5da8bba0ded6fb2316
F src/tclsqlite.c d650bea0248fc0a310ddc2cb94273a3a5021fddf
F src/test1.c d21e94ea95e76d8e838792806937332c5693dbf0
@ -87,11 +87,11 @@ F src/update.c 261d75c702c2852d1a64274d7c414485e6f2d177
F src/utf.c 5ab8ca05d4e9ec81174b010f01ab12a232f0087d
F src/util.c 0d0dc8279d4d0f43eb5d02313b77ab0ffa70f96d
F src/vacuum.c 21a3c7f6f7be86bb1182fbc3df416ad702435b9e
F src/vdbe.c 4db1a9000e238e068de56108f5a9708cd4124d55
F src/vdbe.c 3db9bfc86e71dc0758524fb82cfcfd4c30e92716
F src/vdbe.h 8729a4ee16ff9aeab2af9667df3cf300ff978e13
F src/vdbeInt.h 5451cf71f229e366ac543607c0a17f36e5737ea9
F src/vdbeapi.c cac3f5bfb8ab9864ce5cea35eaae3d0d2efdc8ac
F src/vdbeaux.c bfad18ca5d0372a34147ed98ac268b75ccb6858d
F src/vdbeaux.c 723e0ec773aeec53e9448b2ac5b136677e64ece0
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
F src/vdbemem.c dd08a0eea4868ac4a2d91fdec32424308b1db772
F src/where.c 9fd58a8f5525d036a088c92bb14e2885c2243bc8
@ -107,7 +107,7 @@ F test/attach.test dae07fa1554b618b9cc4c7bc349b3bc1a532180e
F test/attach2.test 0e6a7c54343c85dd877a1e86073a05176043ed40
F test/attach3.test 63013383adc4380af69779f34f4af19bd49f7cbe
F test/attachmalloc.test cdb26c42850f04698377ccec05f5fa89d987837c
F test/auth.test 487fdd95cf1f765815455012e7338d9019bf8852
F test/auth.test 11f73157a2c19e3f376598aaac9c5572c33e12cb
F test/autoinc.test 60005a676e3e4e17dfa9dbd08aa0b76587ff97e3
F test/autovacuum.test 9471d58a08b14dc0d2c15b87583c46d1744343d6
F test/autovacuum_crash.test 05a63b8805b20cfba7ace82856ce4ccdda075a31
@ -225,7 +225,7 @@ F test/select5.test 07a90ab3c7e3f0a241a9cdea1d997b2c8a89ff0b
F test/select6.test f459a19bdac0501c4d3eb1a4df4b7a76f1bb8ad4
F test/select7.test 1bf795b948c133a15a2a5e99d3270e652ec58ce6
F test/server1.test e328b8e641ba8fe9273132cfef497383185dc1f5
F test/shared.test e392ddbf1d2cc95b4e48a7ab0a65c891ad7388c0
F test/shared.test 6b686dcc6a51fd0a1fb2779f4621469d243de8df
F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5
F test/subquery.test e6de53332c0301b3cfa34edc3f3cd5fa1e859efd
F test/subselect.test 2d13fb7f450db3595adcdd24079a0dd1d2d6abc2
@ -341,7 +341,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 9927522923558348a846e033b92100c0ed4ee556
R 57c562a59b5c5138ad538109f4517a6c
P 9dfc4a880b49869e945d6a19e63fcf6dc94412ad
R 400c66cf0832b4adf252fe60cc985964
U danielk1977
Z 5c54f7e1a11402994e13dc599beddfc4
Z 92d6dfb0922d80ce9fab88a62350686e

View File

@ -1 +1 @@
9dfc4a880b49869e945d6a19e63fcf6dc94412ad
0d5d83bcbd65dd7ae968909acfee075185e49c38

View File

@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.298 2006/01/15 11:39:18 danielk1977 Exp $
** $Id: btree.c,v 1.299 2006/01/16 15:14:27 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
@ -3347,10 +3347,10 @@ int sqlite3BtreeMoveto(BtCursor *pCur, const void *pKey, i64 nKey, int *pRes){
}
pCell = findCell(pPage, pCur->idx) + pPage->childPtrSize;
if( pPage->hasData ){
int dummy;
u32 dummy;
pCell += getVarint32(pCell, &dummy);
}
getVarint(pCell, &nCellKey);
getVarint(pCell, (u64 *)&nCellKey);
if( nCellKey<nKey ){
c = -1;
}else if( nCellKey>nKey ){

View File

@ -22,7 +22,7 @@
** COMMIT
** ROLLBACK
**
** $Id: build.c,v 1.380 2006/01/13 18:06:40 danielk1977 Exp $
** $Id: build.c,v 1.381 2006/01/16 15:14:28 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@ -1547,10 +1547,14 @@ void sqlite3EndTable(
#ifndef SQLITE_OMIT_ALTERTABLE
if( !p->pSelect ){
const unsigned char *zName = pParse->sNameToken.z;
const char *zName = (const char *)pParse->sNameToken.z;
int nName;
assert( !pSelect && pCons && pEnd );
if( pCons->z==0 ) pCons = pEnd;
p->addColOffset = 13 + sqlite3utf8CharLen(zName, pCons->z - zName);
if( pCons->z==0 ){
pCons = pEnd;
}
nName = (const char *)pCons->z - zName;
p->addColOffset = 13 + sqlite3utf8CharLen(zName, nName);
}
#endif
}
@ -2362,7 +2366,7 @@ void sqlite3CreateIndex(
);
if( sqlite3ThreadDataReadOnly()->mallocFailed ) goto exit_create_index;
pIndex->aiColumn = (int *)(&pIndex[1]);
pIndex->aiRowEst = (int *)(&pIndex->aiColumn[nCol]);
pIndex->aiRowEst = (unsigned *)(&pIndex->aiColumn[nCol]);
pIndex->azColl = (char **)(&pIndex->aiRowEst[nCol+1]);
pIndex->aSortOrder = (u8 *)(&pIndex->azColl[nCol]);
pIndex->zName = (char *)(&pIndex->aSortOrder[nCol]);
@ -3154,7 +3158,7 @@ void sqlite3Reindex(Parse *pParse, Token *pName1, Token *pName2){
assert( pName1->z );
pColl = sqlite3FindCollSeq(db, ENC(db), (char*)pName1->z, pName1->n, 0);
if( pColl ){
char *z = sqliteStrNDup(pName1->z, pName1->n);
char *z = sqliteStrNDup((const char *)pName1->z, pName1->n);
if( z ){
reindexDatabases(pParse, z);
sqliteFree(z);

View File

@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.239 2006/01/16 12:46:41 danielk1977 Exp $
** @(#) $Id: pager.c,v 1.240 2006/01/16 15:14:28 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@ -429,7 +429,7 @@ static void put32bits(char *ac, u32 val){
** on success or an error code is something goes wrong.
*/
static int write32bits(OsFile *fd, u32 val){
unsigned char ac[4];
char ac[4];
put32bits(ac, val);
return sqlite3OsWrite(fd, ac, 4);
}
@ -439,8 +439,8 @@ static int write32bits(OsFile *fd, u32 val){
** 'p' at offset 'offset'.
*/
static void store32bits(u32 val, PgHdr *p, int offset){
unsigned char *ac;
ac = &((unsigned char*)PGHDR_TO_DATA(p))[offset];
char *ac;
ac = &((char*)PGHDR_TO_DATA(p))[offset];
put32bits(ac, val);
}

View File

@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.468 2006/01/16 11:29:20 danielk1977 Exp $
** @(#) $Id: sqliteInt.h,v 1.469 2006/01/16 15:14:28 danielk1977 Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
@ -1754,7 +1754,7 @@ KeyInfo *sqlite3IndexKeyinfo(Parse *, Index *);
#endif
void sqlite3MallocClearFailed();
#ifndef SQLITE_MEMDEBUG
#ifdef NDEBUG
#define sqlite3MallocDisallow()
#define sqlite3MallocAllow()
#else

View File

@ -43,7 +43,7 @@
** 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.530 2006/01/15 14:11:49 danielk1977 Exp $
** $Id: vdbe.c,v 1.531 2006/01/16 15:14:28 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@ -2022,7 +2022,7 @@ case OP_Column: {
zData = sMem.z;
}
zEndHdr = (u8 *)zData + offset;
zIdx = zData + (int)zIdx;
zIdx = (u8 *)zData + (int)zIdx;
/* Scan the header and use it to fill in the aType[] and aOffset[]
** arrays. aType[i] will contain the type integer for the i-th

View File

@ -440,11 +440,11 @@ void sqlite3VdbeChangeP3(Vdbe *p, int addr, const char *zP3, int n){
pKeyInfo = sqliteMallocRaw( nByte );
pOp->p3 = (char*)pKeyInfo;
if( pKeyInfo ){
char *aSortOrder;
unsigned char *aSortOrder;
memcpy(pKeyInfo, zP3, nByte);
aSortOrder = pKeyInfo->aSortOrder;
if( aSortOrder ){
pKeyInfo->aSortOrder = (char*)&pKeyInfo->aColl[nField];
pKeyInfo->aSortOrder = (unsigned char*)&pKeyInfo->aColl[nField];
memcpy(pKeyInfo->aSortOrder, aSortOrder, nField);
}
pOp->p3type = P3_KEYINFO;

View File

@ -12,7 +12,7 @@
# focus of this script is testing the ATTACH and DETACH commands
# and related functionality.
#
# $Id: auth.test,v 1.30 2006/01/13 13:55:45 drh Exp $
# $Id: auth.test,v 1.31 2006/01/16 15:14:28 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@ -1768,11 +1768,12 @@ ifcapable tempdb {
do_test auth-1.270 {
execsql {SELECT name FROM sqlite_temp_master WHERE type='table'}
} {t1x}
do_test auth-1.271 {
set authargs
} {temp t1x {} {}}
} ;# ifcapable altertable
do_test auth-1.271 {
set authargs
} {temp t1x {} {}}
} else {
db authorizer {}
db eval {

View File

@ -9,7 +9,7 @@
#
#***********************************************************************
#
# $Id: shared.test,v 1.14 2006/01/16 12:46:41 danielk1977 Exp $
# $Id: shared.test,v 1.15 2006/01/16 15:14:29 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -24,17 +24,22 @@ set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
foreach av [list 0 1] {
ifcapable !autovacuum {
if {$av} break
# Open the database connection and execute the auto-vacuum pragma
file delete -force test.db
sqlite3 db test.db
ifcapable autovacuum {
do_test shared-[expr $av+1].1.0 {
execsql "pragma auto_vacuum=$::av"
execsql {pragma auto_vacuum}
} "$av"
} else {
if {$av} {
db close
break
}
}
# Open the database connection and execute the auto-vacuum pragma
do_test shared-$av.1.0 {
file delete -force test.db
sqlite3 db test.db
execsql "pragma auto_vacuum=$::av"
execsql {pragma auto_vacuum}
} "$av"
incr av
# Test organization:
@ -496,7 +501,6 @@ do_test shared-$av.7.1 {
sqlite3 db test.db
sqlite3 db2 test.db
execsql {
PRAGMA auto_vacuum = 1;
BEGIN;
CREATE TABLE t1(a PRIMARY KEY, b);
CREATE TABLE t2(a PRIMARY KEY, b);
@ -514,10 +518,7 @@ do_test shared-$av.7.1 {
INSERT INTO t2 SELECT * FROM t1;
COMMIT;
}
execsql {
PRAGMA auto_vacuum;
}
} {1}
} {}
do_test shared-$av.7.2 {
# This test case deletes the contents of table t1 (the one at the start of
# the file) while many cursors are open on table t2 and it's index. All of