]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Simplifications to btree.c to help facilitate coverage testing. (CVS 6884)
authordrh <drh@noemail.net>
Sun, 12 Jul 2009 02:32:21 +0000 (02:32 +0000)
committerdrh <drh@noemail.net>
Sun, 12 Jul 2009 02:32:21 +0000 (02:32 +0000)
FossilOrigin-Name: dfb146ef003bae8ff216baf68cc43d7eb7855c68

manifest
manifest.uuid
src/btree.c

index 58f9ea7dd4f39b60b1ea358f9d88d55f22234286..86ecdab90533bce082b944bae0ed0ef6bc5b28ec 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C When\san\sOOM\sfault\soccurs\swhile\smoving\sa\spage\sfor\sautovacuum\sin\san\sin-memory\ndatabase,\sbe\ssure\sto\sundo\sthe\spage\smove\sprior\sto\sreturning\sthe\serror,\sto\navoid\scorrupting\sthe\sin-memory\sdatabase\sfile.\s(CVS\s6883)
-D 2009-07-12T02:31:37
+C Simplifications\sto\sbtree.c\sto\shelp\sfacilitate\scoverage\stesting.\s(CVS\s6884)
+D 2009-07-12T02:32:22
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -106,7 +106,7 @@ F src/auth.c 802a9439dfa0b8c208b10055cba400e82ef18025
 F src/backup.c 6f1c2d9862c8a3feb7739dfcca02c1f5352e37f3
 F src/bitvec.c 0ef0651714728055d43de7a4cdd95e703fac0119
 F src/btmutex.c 9b899c0d8df3bd68f527b0afe03088321b696d3c
-F src/btree.c e1ad67c98aeaafdeba37aef45ce1fbbe9416dacf
+F src/btree.c 46f5eb09a9dc3af84d04c18f0feea3384fecca58
 F src/btree.h e53a10fd31d16c60a86f03c9467a6f470aa3683b
 F src/btreeInt.h a568bf057aa249eb06fd31358b4393a5ac88c118
 F src/build.c 867028ee9f63f7bc8eb8d4a720bb98cf9b9a12b4
@@ -740,7 +740,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
-P 7deb6568d89335926b77336756837c6dc3985529
-R 186b1819a0d45400cca179251342930e
+P d0964b93669123e228e7ce1890167447c56753b5
+R d0eba16ee5dd731fa989e1879da4fe61
 U drh
-Z 012114440579d3a3fa4fe565db859264
+Z 9f7075b3d43334c92c2eb775093c9546
index ebae947e27d4e26b890cc1084ec084ef9b85fb7e..acfd93b086340d247ac0b45a317b0de38205bf47 100644 (file)
@@ -1 +1 @@
-d0964b93669123e228e7ce1890167447c56753b5
\ No newline at end of file
+dfb146ef003bae8ff216baf68cc43d7eb7855c68
\ No newline at end of file
index aa9094e610f12d8a1fff707f874525dbfb843f52..413725c4962184558021ae351c7bb48d9a0f0b57 100644 (file)
@@ -9,7 +9,7 @@
 **    May you share freely, never taking more than you give.
 **
 *************************************************************************
-** $Id: btree.c,v 1.681 2009/07/11 18:26:29 drh Exp $
+** $Id: btree.c,v 1.682 2009/07/12 02:32:22 drh Exp $
 **
 ** This file implements a external (disk-based) database using BTrees.
 ** See the header comment on "btreeInt.h" for additional information.
@@ -3606,10 +3606,8 @@ static int copyPayload(
 ** A total of "amt" bytes are read or written beginning at "offset".
 ** Data is read to or from the buffer pBuf.
 **
-** This routine does not make a distinction between key and data.
-** It just reads or writes bytes from the payload area.  Data might 
-** appear on the main page or be scattered out on multiple overflow 
-** pages.
+** The content being read or written might appear on the main page
+** or be scattered out on multiple overflow pages.
 **
 ** If the BtCursor.isIncrblobHandle flag is set, and the current
 ** cursor entry uses one or more overflow pages, this function
@@ -3649,7 +3647,7 @@ static int accessPayload(
   aPayload = pCur->info.pCell + pCur->info.nHeader;
   nKey = (pPage->intKey ? 0 : (int)pCur->info.nKey);
 
-  if( offset+amt > nKey+pCur->info.nData 
+  if( NEVER(offset+amt > nKey+pCur->info.nData) 
    || &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize]
   ){
     /* Trying to read or write past the end of the data is an error */
@@ -3687,7 +3685,9 @@ static int accessPayload(
     if( pCur->isIncrblobHandle && !pCur->aOverflow ){
       int nOvfl = (pCur->info.nPayload-pCur->info.nLocal+ovflSize-1)/ovflSize;
       pCur->aOverflow = (Pgno *)sqlite3MallocZero(sizeof(Pgno)*nOvfl);
-      if( nOvfl && !pCur->aOverflow ){
+      /* nOvfl is always positive.  If it were zero, fetchPayload would have
+      ** been used instead of this routine. */
+      if( ALWAYS(nOvfl) && !pCur->aOverflow ){
         rc = SQLITE_NOMEM;
       }
     }