]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Change an unreachable condition in btree.c to a NEVER(). (CVS 6888)
authordanielk1977 <danielk1977@noemail.net>
Mon, 13 Jul 2009 13:18:07 +0000 (13:18 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Mon, 13 Jul 2009 13:18:07 +0000 (13:18 +0000)
FossilOrigin-Name: 9f800e11391a108d7aa57f5a96d9a58711129132

manifest
manifest.uuid
src/btree.c

index 00be53429f6e3e19f78d4523b7e8e82f7be605aa..a8f0900d05c106fc5a9a57ea9d333c635533ae54 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C In\ssqlite3PagerWrite(),\sdo\snot\sset\sthe\sPGHDR_NEED_SYNC\sflag\son\sa\spage\sif\san\sIO\serror\soccured\swhile\sattempting\sto\sjournal\sit.\s(CVS\s6887)
-D 2009-07-13T11:22:10
+C Change\san\sunreachable\scondition\sin\sbtree.c\sto\sa\sNEVER().\s(CVS\s6888)
+D 2009-07-13T13:18:07
 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 39559c172e4f970d53fd2dbb7cf25641613eec47
+F src/btree.c b88edecbed1c1c46b1cfcd924ac7b759c1085af4
 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 3151dab9c78106217ec80ebadc666dfd11b42029
-R bbef3bf03d7fab733bcd5fbb4e72b8d8
+P b9be365d85fddedbfa93eebf3ee62a140cbaa426
+R f4d839ed396486ac6b8a446143ddd531
 U danielk1977
-Z e3d416373420438c306f7dfa40b1190f
+Z 4c8b9a4f20989cfa0c1c1e32007e46e0
index cd2fcd9d6121b761dbc53ae3a4cef5c27fd25603..c77ffa0666758e04f14624e5573ec9e7642a2e65 100644 (file)
@@ -1 +1 @@
-b9be365d85fddedbfa93eebf3ee62a140cbaa426
\ No newline at end of file
+9f800e11391a108d7aa57f5a96d9a58711129132
\ No newline at end of file
index 7c836b8a5931774136a9ed213bccc470557f887d..fff9f90a9b757c3eb3fa9582c96b6af7ddcc43a6 100644 (file)
@@ -9,7 +9,7 @@
 **    May you share freely, never taking more than you give.
 **
 *************************************************************************
-** $Id: btree.c,v 1.685 2009/07/13 11:22:10 danielk1977 Exp $
+** $Id: btree.c,v 1.686 2009/07/13 13:18:07 danielk1977 Exp $
 **
 ** This file implements a external (disk-based) database using BTrees.
 ** See the header comment on "btreeInt.h" for additional information.
@@ -5064,8 +5064,8 @@ static int fillInCell(
     nSrc = nData;
     nData = 0;
   }else{ 
-    if( nKey>0x7fffffff || pKey==0 ){
-      return SQLITE_CORRUPT;
+    if( NEVER(nKey>0x7fffffff || pKey==0) ){
+      return SQLITE_CORRUPT_BKPT;
     }
     nPayload += (int)nKey;
     pSrc = pKey;
@@ -6410,11 +6410,16 @@ int sqlite3BtreeInsert(
   unsigned char *newCell = 0;
 
   assert( cursorHoldsMutex(pCur) );
-  assert( pBt->inTransaction==TRANS_WRITE );
-  assert( !pBt->readOnly );
-  assert( pCur->wrFlag );
+  assert( pCur->wrFlag && pBt->inTransaction==TRANS_WRITE && !pBt->readOnly );
   assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) );
 
+  /* Assert that the caller has been consistent. If this cursor was opened
+  ** expecting an index b-tree, then the caller should be inserting blob
+  ** keys with no associated data. If the cursor was opened expecting an
+  ** intkey table, the caller should be inserting integer keys with a
+  ** blob of associated data.  */
+  assert( (pKey==0)==(pCur->pKeyInfo==0) );
+
   /* If this is an insert into a table b-tree, invalidate any incrblob 
   ** cursors open on the row being replaced (assuming this is a replace
   ** operation - if it is not, the following is a no-op).  */
@@ -6423,6 +6428,7 @@ int sqlite3BtreeInsert(
   }
 
   if( pCur->eState==CURSOR_FAULT ){
+    assert( pCur->skip!=SQLITE_OK );
     return pCur->skip;
   }