]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Allow sqlite3GetInt32 to recognize 10-digit decimal numbers as 32-bit. (CVS 4362)
authordanielk1977 <danielk1977@noemail.net>
Sat, 1 Sep 2007 10:01:12 +0000 (10:01 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Sat, 1 Sep 2007 10:01:12 +0000 (10:01 +0000)
FossilOrigin-Name: 7571345d2078fb52029f9b9924d833ec36d443e6

manifest
manifest.uuid
src/util.c
test/expr.test
test/incrvacuum.test
test/printf.test

index 5d2e98e01caf0a1155d851d5851be3f30f5d29cf..73abc0784802837198d35b634b80f69f4769b536 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sproblem\shandling\sa\smalloc()\sfailure\sin\sprintf.c.\sAlso\ssome\sother\sthings\sto\simprove\stest\scoverage.\s(CVS\s4361)
-D 2007-09-01T09:02:54
+C Allow\ssqlite3GetInt32\sto\srecognize\s10-digit\sdecimal\snumbers\sas\s32-bit.\s(CVS\s4362)
+D 2007-09-01T10:01:13
 F Makefile.in bfcc303429a5d9dcd552d807ee016c77427418c3
 F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -160,7 +160,7 @@ F src/tokenize.c 67e42600ab34f976f2b1288c499ad6c98d652f0e
 F src/trigger.c 724a77d54609a33bde90618934fbeddfcc729a10
 F src/update.c e89b980b443d44b68bfc0b1746cdb6308e049ac9
 F src/utf.c 4af6259d5906b5a1bf3035cc387c4d7907bdd56e
-F src/util.c 3f9c0387b54f977726790f52ab92cd3d9379b367
+F src/util.c 49263637e0f228411201501ddfd1138338d6322c
 F src/vacuum.c 38745037c63246d1b0669038257890cf89fc4578
 F src/vdbe.c d2f156bbb6b636e9b4a3648c38454bf472668a86
 F src/vdbe.h 03a0fa17f6753a24d6cb585d7a362944a2c115aa
@@ -251,7 +251,7 @@ F test/enc3.test 9331988b9d72decec96995c90637e87b00d747a5
 F test/exclusive.test 00d5328b243083ccda7729f275eedc6c4e02ae29
 F test/exclusive2.test d13bf66753dca46e61241d35d36ab7c868b0d313
 F test/exclusive3.test 0e49c35b7e7cb8e7280b4ce3f0359d30b207d2ff
-F test/expr.test b8d63779b043dff06580fe4f3d85e5bebd067957
+F test/expr.test ed41c753c41c4bf39061329b224bada2ff89c604
 F test/filefmt.test 053b622009fbbb74dd37921ffad374d852c13cd8
 F test/fkey1.test dcb4f28eb22d5141f15161d6bdca9a4f58c95729
 F test/format4.test 1f0cac8ff3895e9359ed87e41aaabee982a812eb
@@ -313,7 +313,7 @@ F test/in.test 369cb2aa1eab02296b4ec470732fe8c131260b1d
 F test/in2.test b1f447f4f0f67e9f83ff931e7e2e30873f9ea055
 F test/incrblob.test 7f95c929b719626443a996b105d2b0ff06f47818
 F test/incrblob_err.test 0adf87296ad14cef6a23cd9283f81cc836c5a332
-F test/incrvacuum.test 569347726ea5940c3359e3d8cabb3505595cb82f
+F test/incrvacuum.test 985bc94a7ff544db09aec3a0c93c779280da9415
 F test/incrvacuum2.test 82397ceb5941cbe852fd29bb33fcdf5665bc80c2
 F test/incrvacuum_ioerr.test cb331403b8dea3c5bae6163861ff25037b0df56a
 F test/index.test e65df12bed94b2903ee89987115e1578687e9266
@@ -381,7 +381,7 @@ F test/pageropt.test 51e3c091bc2992f5098f7576e3594e1908988939
 F test/pagesize.test e0a8b3fe80f8b8e808d94a00734c7a18c76c407e
 F test/pragma.test b0e73879206934a835856a8b8c4cc884cd8562f3
 F test/pragma2.test bb5aa7be00dae2c381fcc782358048a33c955793
-F test/printf.test 13e2887b21f8956cb6c352cf6e6c438cb2f2e55c
+F test/printf.test d3cacac565b074d3cfed0fd847085d4a9fddc934
 F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301 x
 F test/ptrchng.test 1c712dd6516e1377471744fa765e41c79a357da6
 F test/quick.test 88844a19f6d9dc5c990e01c7dd611d33d022a1c1
@@ -568,7 +568,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 5f48fb95c26a713b3259ee49fd444108030376dc
-R f5d2790ed3ef3229e31edc3fdbdb0ddc
+P 595bfe72f053bc6ecb58bb9044a4cdc53d30b404
+R be04c5213b6574236677be8610d7fbc8
 U danielk1977
-Z bbe8f7cb92a5a4389623700351cb30a0
+Z 7223bbde30f1abb7747d25cbae5b7337
index 1978c9cdccc9dfcd458a4a105a16587688ddcb47..62387c51d381d95d4d2f109073681142d3acf965 100644 (file)
@@ -1 +1 @@
-595bfe72f053bc6ecb58bb9044a4cdc53d30b404
\ No newline at end of file
+7571345d2078fb52029f9b9924d833ec36d443e6
\ No newline at end of file
index 75992b6787d1990cbeb8675fcef1329c95968ec6..722df63e961d3dcc494df82ccc942a8241d13aec 100644 (file)
@@ -14,7 +14,7 @@
 ** This file contains functions for allocating memory, comparing
 ** strings, and stuff like that.
 **
-** $Id: util.c,v 1.211 2007/08/21 19:33:57 drh Exp $
+** $Id: util.c,v 1.212 2007/09/01 10:01:13 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include <stdarg.h>
@@ -420,10 +420,16 @@ int sqlite3GetInt32(const char *zNum, int *pValue){
     zNum++;
   }
   while( zNum[0]=='0' ) zNum++;
-  for(i=0; i<10 && (c = zNum[i] - '0')>=0 && c<=9; i++){
+  for(i=0; i<11 && (c = zNum[i] - '0')>=0 && c<=9; i++){
     v = v*10 + c;
   }
-  if( i>9 ){
+
+  /* The longest decimal representation of a 32 bit integer is 10 digits:
+  **
+  **             1234567890
+  **     2^31 -> 2147483648
+  */
+  if( i>10 ){
     return 0;
   }
   if( v-neg>2147483647 ){
index b619f337f8194361827cefdc4282968518199f4f..3c46aad76ad709392d26f115eb9234bf6464991b 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this file is testing expressions.
 #
-# $Id: expr.test,v 1.57 2007/06/26 11:13:27 danielk1977 Exp $
+# $Id: expr.test,v 1.58 2007/09/01 10:01:13 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -688,4 +688,10 @@ do_test expr-12.2 {
   }
 } {1 {near ")": syntax error}}
 
+do_test expr-13.1 {
+  execsql {
+    SELECT 12345678901234567890;
+  }
+} {1.23456789012346e+19}
+
 finish_test
index e26284d6b9ec74afda6f638037561f60e079894d..e9c5db92fb3a497a147795ddaa729c25b728593b 100644 (file)
@@ -14,7 +14,7 @@
 # Note: There are also some tests for incremental vacuum and IO 
 # errors in incrvacuum_ioerr.test.
 #
-# $Id: incrvacuum.test,v 1.13 2007/08/10 16:41:09 drh Exp $
+# $Id: incrvacuum.test,v 1.14 2007/09/01 10:01:13 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -544,8 +544,9 @@ do_test incrvacuum-10.4 {
 } {22}
 
 do_test incrvacuum-10.5 {
+breakpoint
   execsql {
-    PRAGMA incremental_vacuum("3");
+    PRAGMA incremental_vacuum("+3");
   }
   expr [file size test.db] / 1024
 } {19}
@@ -558,8 +559,10 @@ do_test incrvacuum-10.6 {
 } {18}
 
 do_test incrvacuum-10.7 {
+  # Use a really big number as an argument to incremetal_vacuum. Should
+  # be interpreted as "free all possible space".
   execsql {
-    PRAGMA incremental_vacuum(0);
+    PRAGMA incremental_vacuum(2147483649);
   }
   expr [file size test.db] / 1024
 } {1}
index 9f37d30c1fcfd954c1a9266ab7c7bcd547714f27..7908642ac733649dad78d9d843ff1dee8353ed04 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this file is testing the sqlite_*_printf() interface.
 #
-# $Id: printf.test,v 1.25 2007/09/01 09:02:54 danielk1977 Exp $
+# $Id: printf.test,v 1.26 2007/09/01 10:01:13 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -181,6 +181,9 @@ do_test printf-8.5 {
 do_test printf-8.6 {
   sqlite3_mprintf_int64 {%llx %llo %lld} -1 -1 -1
 } {ffffffffffffffff 1777777777777777777777 -1}
+do_test printf-8.7 {
+  sqlite3_mprintf_int64 {%llx %llx %llx} +2147483647 +2147483648 +4294967296
+} {7fffffff 80000000 100000000}
 
 do_test printf-9.1 {
   sqlite3_mprintf_int {%*.*c} 4 4 65
@@ -298,7 +301,6 @@ do_test printf-15.3 {
 foreach var {a b c d} {
   set $var [string repeat $var 400]
 }
-
 set str1 "[string repeat A 360]%d%d%s"
 set str2 [string repeat B 5000]
 set zSuccess "[string repeat A 360]11[string repeat B 5000]"