aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2008-12-10 22:15:00 +0000
committerdrh <drh@noemail.net>2008-12-10 22:15:00 +0000
commit4f21c4af30e57d39c5d7873dcab80cb35ee8ab39 (patch)
treee5e1c7fc51ec575fb5f15af56391ddcc7a7742b0 /src/util.c
parent1bd10f8a0063bcbcb75b99f48e70ae312e145aae (diff)
downloadsqlite-4f21c4af30e57d39c5d7873dcab80cb35ee8ab39.tar.gz
sqlite-4f21c4af30e57d39c5d7873dcab80cb35ee8ab39.zip
Fix an issue with the new sqlite3Strlen30() introduced by
check-in (6007). Additional casts for compiler warnings. (CVS 6011) FossilOrigin-Name: 258722b6178f60eaccef1675aab3edc456d413a5
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c
index 59f1b805a..20be6d728 100644
--- a/src/util.c
+++ b/src/util.c
@@ -14,7 +14,7 @@
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
-** $Id: util.c,v 1.244 2008/12/10 21:19:57 drh Exp $
+** $Id: util.c,v 1.245 2008/12/10 22:15:00 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
@@ -51,6 +51,16 @@ int sqlite3IsNaN(double x){
}
/*
+** Compute a string length that is limited to what can be stored in
+** lower 30 bits of a 32-bit signed integer.
+*/
+int sqlite3Strlen30(const char *z){
+ const char *z2 = z;
+ while( *z2 ){ z2++; }
+ return 0x3fffffff & (int)(z2 - z);
+}
+
+/*
** Return the length of a string, except do not allow the string length
** to exceed the SQLITE_LIMIT_LENGTH setting.
*/