aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2008-07-24 17:06:48 +0000
committerdrh <drh@noemail.net>2008-07-24 17:06:48 +0000
commit513c331df9b7d47e88cdde387f73543e0aab75cb (patch)
tree9722434bb15bd66104ee75e7bbd2233365b237fb /src
parent7ce72f6950f92345e888e2cd21ecc265a67d8c39 (diff)
downloadsqlite-513c331df9b7d47e88cdde387f73543e0aab75cb.tar.gz
sqlite-513c331df9b7d47e88cdde387f73543e0aab75cb.zip
Use a new algorithm for sqlite3Strlen that is slightly slower but is more
like to work on a mixture of 32- and 64-bit systems. Ticket #3237, #3248. (CVS 5471) FossilOrigin-Name: cb1876d8dc102be74be98dd57ac14ee67be8e8e2
Diffstat (limited to 'src')
-rw-r--r--src/util.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/util.c b/src/util.c
index eff872fd0..18340837b 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.239 2008/07/22 05:15:53 shane Exp $
+** $Id: util.c,v 1.240 2008/07/24 17:06:48 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
@@ -56,11 +56,15 @@ int sqlite3IsNaN(double x){
*/
int sqlite3Strlen(sqlite3 *db, const char *z){
const char *z2 = z;
+ int len;
+ size_t x;
while( *z2 ){ z2++; }
- if( z2 > &z[db->aLimit[SQLITE_LIMIT_LENGTH]] ){
+ x = z2 - z;
+ len = 0x7fffffff & x;
+ if( len!=x || len > db->aLimit[SQLITE_LIMIT_LENGTH] ){
return db->aLimit[SQLITE_LIMIT_LENGTH];
}else{
- return (int)(z2 - z);
+ return len;
}
}