1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-10 01:02:56 +03:00

Make sure the argument to ctype.h macros is always an unsigned character.

Ticket #839. (CVS 1881)

FossilOrigin-Name: b065973898c06a81c69b70b3fa91c79334bd9b9a
This commit is contained in:
drh
2004-08-08 20:22:17 +00:00
parent 8dcd7cab83
commit 4c755c0f53
13 changed files with 74 additions and 73 deletions

View File

@@ -1,5 +1,5 @@
C Attempting\sto\sopen\sa\slocked\stable\sfor\swriting\sshould\sfail\simmediately.\r\nTicket\s#842.\s(CVS\s1880) C Make\ssure\sthe\sargument\sto\sctype.h\smacros\sis\salways\san\sunsigned\scharacter.\nTicket\s#839.\s(CVS\s1881)
D 2004-08-08T19:43:30 D 2004-08-08T20:22:17
F Makefile.in 4a5e570a9e2d35b09c31b3cf01b78cea764ade4b F Makefile.in 4a5e570a9e2d35b09c31b3cf01b78cea764ade4b
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -29,16 +29,16 @@ F src/attach.c 0bd4f11da6999665da30625665a4096ba7898de6
F src/auth.c 60db23b98bb94c8b0178180faaf49dc116674217 F src/auth.c 60db23b98bb94c8b0178180faaf49dc116674217
F src/btree.c cfa5ed01838247be40c113cac528286675940801 F src/btree.c cfa5ed01838247be40c113cac528286675940801
F src/btree.h 94dfec0a1722d33359b23e7e310f2b64ffedf029 F src/btree.h 94dfec0a1722d33359b23e7e310f2b64ffedf029
F src/build.c d1a2d7a99bb07a1ea4a019fcef6786546cb09f73 F src/build.c b6689d0c3b01d8552fb6dcd3b071be0b4194ca69
F src/date.c e1bb384a7856c18dce9cadb0afbe6934ba5ddb00 F src/date.c a164e3a58f61306e82c5626e5fa16f861a9a7084
F src/delete.c e81545e546f6bc87d7508a93a09ca70695265af3 F src/delete.c e81545e546f6bc87d7508a93a09ca70695265af3
F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37 F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37
F src/expr.c 0b8c89324d979895e6b0f31a6d7bf60edfee13ac F src/expr.c f4a883c00ff3fea1aa2bae4694c3b3984dcf6757
F src/func.c b163fb49efec999eb7bf982f7de5b9be388301f3 F src/func.c 7e2eeebe219aa612ce7a04c74ae6d57379c6656b
F src/hash.c f0a2f22c2a7052d67053b5f4690ea3010bb3fb9f F src/hash.c f0a2f22c2a7052d67053b5f4690ea3010bb3fb9f
F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb
F src/insert.c bedcba371401395033a1a1c578d8fdc3fec87bec F src/insert.c bedcba371401395033a1a1c578d8fdc3fec87bec
F src/legacy.c ad23746f15f67e34577621b1875f639c94839e1f F src/legacy.c 09b45fd3104da3175684d445f9be4e3c3a50c763
F src/main.c 41da595846e299b757cc413d18de804f97f68748 F src/main.c 41da595846e299b757cc413d18de804f97f68748
F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070 F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
F src/os.h d1780e0db95cad01f213d48da22ab490eb4fd345 F src/os.h d1780e0db95cad01f213d48da22ab490eb4fd345
@@ -54,31 +54,31 @@ F src/os_win.h babd4e912967c6b09088cfe38a45e8005a07ba44
F src/pager.c 37b2159056b4c965eb055b544b301d0e7cd561dd F src/pager.c 37b2159056b4c965eb055b544b301d0e7cd561dd
F src/pager.h 67739fe649f33be55dba522ca8a9cc4e42d14f71 F src/pager.h 67739fe649f33be55dba522ca8a9cc4e42d14f71
F src/parse.y 589b1a39b23092888adfa9ec1f3ded8a35e8e006 F src/parse.y 589b1a39b23092888adfa9ec1f3ded8a35e8e006
F src/pragma.c c8be18093f0492f9983406647808781ca0073d8b F src/pragma.c 5cf335adfdac453a2d03ab0c82f93847c43bea81
F src/printf.c 17b28a1eedfe8129b05de981719306c18c3f1327 F src/printf.c 17b28a1eedfe8129b05de981719306c18c3f1327
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3 F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
F src/select.c cbed45f4af76ad7fdfc0a0df6878b2b3827ae1d4 F src/select.c cbed45f4af76ad7fdfc0a0df6878b2b3827ae1d4
F src/shell.c 4b40fac1a07512d6b8dbdf8abe0b4660d777c9ce F src/shell.c 69d8036a8871c53603016cc6d240a3efaa9584df
F src/sqlite.h.in c340a12b4d0521efb474dd000fba3bdfb18d76da F src/sqlite.h.in c340a12b4d0521efb474dd000fba3bdfb18d76da
F src/sqliteInt.h e408fb63f54c74e91ff8da1998e55b7040e57c2b F src/sqliteInt.h 251662c89dd35c4ed745681ff00758d19ffd0906
F src/table.c 4521c278892f60e4d630788c0ea5cf4db1e75c49 F src/table.c 4521c278892f60e4d630788c0ea5cf4db1e75c49
F src/tclsqlite.c cece44ee1d4427185e4ac85ddec79f31ac26965a F src/tclsqlite.c cece44ee1d4427185e4ac85ddec79f31ac26965a
F src/test1.c 9389fafc3c3a2a3b6bf4f7cffe1c7e8ccdd0be38 F src/test1.c 9389fafc3c3a2a3b6bf4f7cffe1c7e8ccdd0be38
F src/test2.c f4c2f3928f1998fd8cb75a81e33a60e025ea85d4 F src/test2.c f4c2f3928f1998fd8cb75a81e33a60e025ea85d4
F src/test3.c 94d0a2a90bccd85802488cb42c69ec8afd2e4646 F src/test3.c 94d0a2a90bccd85802488cb42c69ec8afd2e4646
F src/test4.c a921a69821fd30209589228e64f94e9f715b6fe2 F src/test4.c c38766914e924091516030b6a8b677d849c08bf0
F src/test5.c b001fa7f1b9e2dc5c2331de62fc641b5ab2bd7a1 F src/test5.c b001fa7f1b9e2dc5c2331de62fc641b5ab2bd7a1
F src/tokenize.c bc7a80e4cf54f42ea4b030c62261c4243133af84 F src/tokenize.c bc7a80e4cf54f42ea4b030c62261c4243133af84
F src/trigger.c 360cf8f12edd4eb3a8a2895b136aac238c3cf44e F src/trigger.c 360cf8f12edd4eb3a8a2895b136aac238c3cf44e
F src/update.c b66b1896c9da54678ba3eff2bf0b4d291a95986a F src/update.c b66b1896c9da54678ba3eff2bf0b4d291a95986a
F src/utf.c f03535db72bfa09e24202ccdd245f21d2fc65f0a F src/utf.c f03535db72bfa09e24202ccdd245f21d2fc65f0a
F src/util.c 2aacc79b7bf5df5859813dafd3bf3258f67a5234 F src/util.c c1d903777e6d2e647d1c898db37d15fe3a1cc172
F src/vacuum.c 9978a5760c2c430bc5b5e66505a02dad76f25813 F src/vacuum.c 9978a5760c2c430bc5b5e66505a02dad76f25813
F src/vdbe.c 6eb69df6de99f69efcb2b50a914ebbb5cad867de F src/vdbe.c 6eb69df6de99f69efcb2b50a914ebbb5cad867de
F src/vdbe.h 75b241c02431b9c0f16eaa9cdbb34146c6287f52 F src/vdbe.h 75b241c02431b9c0f16eaa9cdbb34146c6287f52
F src/vdbeInt.h 3d8e08c54dcb5ca2169db8bb3a37b81a12efaecd F src/vdbeInt.h 3d8e08c54dcb5ca2169db8bb3a37b81a12efaecd
F src/vdbeapi.c 3be4ccab4ba6c21d60feffc48e22cf8c1643c6d5 F src/vdbeapi.c 3be4ccab4ba6c21d60feffc48e22cf8c1643c6d5
F src/vdbeaux.c daf40a292ec458ed962845a8d95d5c96bc242e04 F src/vdbeaux.c 892a49f7bf8c46222108d6a9ba081ac578375744
F src/vdbemem.c d4fa40d0dc1906e6c246092c990077da373e2b26 F src/vdbemem.c d4fa40d0dc1906e6c246092c990077da373e2b26
F src/where.c cf8a54641eea01f1af5d09529ad69166db92f658 F src/where.c cf8a54641eea01f1af5d09529ad69166db92f658
F test/all.test 3b692eb43583b52c99c344b2fa8934512d179016 F test/all.test 3b692eb43583b52c99c344b2fa8934512d179016
@@ -242,7 +242,7 @@ F www/tclsqlite.tcl 06a86cba4d7fc88e2bcd633b57702d3d16abebb5
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9 F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
P d33771a303d9c20dd477b1a973024ff763203211 P fc879a9b1d05ddb8f8c552c1d334597e41b29b27
R d49220a972e86ed5f2222c14670b9ccc R ceec00facf1ec0be155668de66e15a7f
U drh U drh
Z 6bdb053e7f2204021eb022af1f2d8d7a Z 81e48ab08dabe4361601dbea6019899e

View File

@@ -1 +1 @@
fc879a9b1d05ddb8f8c552c1d334597e41b29b27 b065973898c06a81c69b70b3fa91c79334bd9b9a

View File

@@ -23,7 +23,7 @@
** ROLLBACK ** ROLLBACK
** PRAGMA ** PRAGMA
** **
** $Id: build.c,v 1.244 2004/07/26 00:31:09 drh Exp $ ** $Id: build.c,v 1.245 2004/08/08 20:22:17 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@@ -1209,7 +1209,8 @@ static int identLength(const char *z){
** Write an identifier onto the end of the given string. Add ** Write an identifier onto the end of the given string. Add
** quote characters as needed. ** quote characters as needed.
*/ */
static void identPut(char *z, int *pIdx, char *zIdent){ static void identPut(char *z, int *pIdx, char *zSignedIdent){
unsigned char *zIdent = (unsigned char*)zSignedIdent;
int i, j, needQuote; int i, j, needQuote;
i = *pIdx; i = *pIdx;
for(j=0; zIdent[j]; j++){ for(j=0; zIdent[j]; j++){
@@ -1439,7 +1440,7 @@ void sqlite3CreateView(
){ ){
Table *p; Table *p;
int n; int n;
const char *z; const unsigned char *z;
Token sEnd; Token sEnd;
DbFixer sFix; DbFixer sFix;
Token *pName; Token *pName;
@@ -1478,7 +1479,7 @@ void sqlite3CreateView(
} }
sEnd.n = 0; sEnd.n = 0;
n = sEnd.z - pBegin->z; n = sEnd.z - pBegin->z;
z = pBegin->z; z = (const unsigned char*)pBegin->z;
while( n>0 && (z[n-1]==';' || isspace(z[n-1])) ){ n--; } while( n>0 && (z[n-1]==';' || isspace(z[n-1])) ){ n--; }
sEnd.z = &z[n-1]; sEnd.z = &z[n-1];
sEnd.n = 1; sEnd.n = 1;

View File

@@ -16,7 +16,7 @@
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file. ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
** All other code has file scope. ** All other code has file scope.
** **
** $Id: date.c,v 1.32 2004/07/20 00:39:15 drh Exp $ ** $Id: date.c,v 1.33 2004/08/08 20:22:17 drh Exp $
** **
** NOTES: ** NOTES:
** **
@@ -104,7 +104,7 @@ static int getDigits(const char *zDate, ...){
pVal = va_arg(ap, int*); pVal = va_arg(ap, int*);
val = 0; val = 0;
while( N-- ){ while( N-- ){
if( !isdigit(*zDate) ){ if( !isdigit(*(u8*)zDate) ){
return cnt; return cnt;
} }
val = val*10 + *zDate - '0'; val = val*10 + *zDate - '0';
@@ -145,7 +145,7 @@ static int getValue(const char *z, double *pR){
static int parseTimezone(const char *zDate, DateTime *p){ static int parseTimezone(const char *zDate, DateTime *p){
int sgn = 0; int sgn = 0;
int nHr, nMn; int nHr, nMn;
while( isspace(*zDate) ){ zDate++; } while( isspace(*(u8*)zDate) ){ zDate++; }
p->tz = 0; p->tz = 0;
if( *zDate=='-' ){ if( *zDate=='-' ){
sgn = -1; sgn = -1;
@@ -160,7 +160,7 @@ static int parseTimezone(const char *zDate, DateTime *p){
} }
zDate += 5; zDate += 5;
p->tz = sgn*(nMn + nHr*60); p->tz = sgn*(nMn + nHr*60);
while( isspace(*zDate) ){ zDate++; } while( isspace(*(u8*)zDate) ){ zDate++; }
return *zDate!=0; return *zDate!=0;
} }
@@ -184,10 +184,10 @@ static int parseHhMmSs(const char *zDate, DateTime *p){
return 1; return 1;
} }
zDate += 2; zDate += 2;
if( *zDate=='.' && isdigit(zDate[1]) ){ if( *zDate=='.' && isdigit((u8)zDate[1]) ){
double rScale = 1.0; double rScale = 1.0;
zDate++; zDate++;
while( isdigit(*zDate) ){ while( isdigit(*(u8*)zDate) ){
ms = ms*10.0 + *zDate - '0'; ms = ms*10.0 + *zDate - '0';
rScale *= 10.0; rScale *= 10.0;
zDate++; zDate++;
@@ -272,7 +272,7 @@ static int parseYyyyMmDd(const char *zDate, DateTime *p){
return 1; return 1;
} }
zDate += 10; zDate += 10;
while( isspace(*zDate) ){ zDate++; } while( isspace(*(u8*)zDate) ){ zDate++; }
if( parseHhMmSs(zDate, p)==0 ){ if( parseHhMmSs(zDate, p)==0 ){
/* We got the time */ /* We got the time */
}else if( *zDate==0 ){ }else if( *zDate==0 ){
@@ -575,7 +575,7 @@ static int parseModifier(const char *zMod, DateTime *p){
const char *z2 = z; const char *z2 = z;
DateTime tx; DateTime tx;
int day; int day;
if( !isdigit(*z2) ) z2++; if( !isdigit(*(u8*)z2) ) z2++;
memset(&tx, 0, sizeof(tx)); memset(&tx, 0, sizeof(tx));
if( parseHhMmSs(z2, &tx) ) break; if( parseHhMmSs(z2, &tx) ) break;
computeJD(&tx); computeJD(&tx);
@@ -590,7 +590,7 @@ static int parseModifier(const char *zMod, DateTime *p){
break; break;
} }
z += n; z += n;
while( isspace(z[0]) ) z++; while( isspace(*(u8*)z) ) z++;
n = strlen(z); n = strlen(z);
if( n>10 || n<3 ) break; if( n>10 || n<3 ) break;
if( z[n-1]=='s' ){ z[n-1] = 0; n--; } if( z[n-1]=='s' ){ z[n-1] = 0; n--; }

View File

@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and ** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite. ** for generating VDBE code that evaluates expressions in SQLite.
** **
** $Id: expr.c,v 1.153 2004/07/26 00:31:09 drh Exp $ ** $Id: expr.c,v 1.154 2004/08/08 20:22:17 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@@ -513,7 +513,7 @@ int sqlite3ExprIsInteger(Expr *p, int *pValue){
break; break;
} }
case TK_STRING: { case TK_STRING: {
const char *z = p->token.z; const u8 *z = (u8*)p->token.z;
int n = p->token.n; int n = p->token.n;
if( n>0 && z[0]=='-' ){ z++; n--; } if( n>0 && z[0]=='-' ){ z++; n--; }
while( n>0 && *z && isdigit(*z) ){ z++; n--; } while( n>0 && *z && isdigit(*z) ){ z++; n--; }

View File

@@ -16,7 +16,7 @@
** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope. ** All other code has file scope.
** **
** $Id: func.c,v 1.79 2004/07/18 23:06:54 drh Exp $ ** $Id: func.c,v 1.80 2004/08/08 20:22:18 drh Exp $
*/ */
#include <ctype.h> #include <ctype.h>
#include <math.h> #include <math.h>
@@ -208,7 +208,7 @@ static void upperFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
if( z==0 ) return; if( z==0 ) return;
strcpy(z, sqlite3_value_text(argv[0])); strcpy(z, sqlite3_value_text(argv[0]));
for(i=0; z[i]; i++){ for(i=0; z[i]; i++){
if( islower(z[i]) ) z[i] = toupper(z[i]); z[i] = toupper(z[i]);
} }
sqlite3_result_text(context, z, -1, SQLITE_TRANSIENT); sqlite3_result_text(context, z, -1, SQLITE_TRANSIENT);
sqliteFree(z); sqliteFree(z);
@@ -221,7 +221,7 @@ static void lowerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
if( z==0 ) return; if( z==0 ) return;
strcpy(z, sqlite3_value_text(argv[0])); strcpy(z, sqlite3_value_text(argv[0]));
for(i=0; z[i]; i++){ for(i=0; z[i]; i++){
if( isupper(z[i]) ) z[i] = tolower(z[i]); z[i] = tolower(z[i]);
} }
sqlite3_result_text(context, z, -1, SQLITE_TRANSIENT); sqlite3_result_text(context, z, -1, SQLITE_TRANSIENT);
sqliteFree(z); sqliteFree(z);
@@ -691,7 +691,7 @@ static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
*/ */
static void soundexFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ static void soundexFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
char zResult[8]; char zResult[8];
const char *zIn; const u8 *zIn;
int i, j; int i, j;
static const unsigned char iCode[] = { static const unsigned char iCode[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -704,7 +704,7 @@ static void soundexFunc(sqlite3_context *context, int argc, sqlite3_value **argv
1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0, 1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0,
}; };
assert( argc==1 ); assert( argc==1 );
zIn = sqlite3_value_text(argv[0]); zIn = (u8*)sqlite3_value_text(argv[0]);
for(i=0; zIn[i] && !isalpha(zIn[i]); i++){} for(i=0; zIn[i] && !isalpha(zIn[i]); i++){}
if( zIn[i] ){ if( zIn[i] ){
zResult[0] = toupper(zIn[i]); zResult[0] = toupper(zIn[i]);

View File

@@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be ** other files are for internal use by SQLite and should not be
** accessed by users of the library. ** accessed by users of the library.
** **
** $Id: legacy.c,v 1.3 2004/05/26 23:25:31 drh Exp $ ** $Id: legacy.c,v 1.4 2004/08/08 20:22:18 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -108,7 +108,7 @@ int sqlite3_exec(
if( rc!=SQLITE_SCHEMA ){ if( rc!=SQLITE_SCHEMA ){
nRetry = 0; nRetry = 0;
zSql = zLeftover; zSql = zLeftover;
while( isspace(zSql[0]) ) zSql++; while( isspace((unsigned char)zSql[0]) ) zSql++;
} }
break; break;
} }

View File

@@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** This file contains code used to implement the PRAGMA command. ** This file contains code used to implement the PRAGMA command.
** **
** $Id: pragma.c,v 1.58 2004/07/22 01:19:35 drh Exp $ ** $Id: pragma.c,v 1.59 2004/08/08 20:22:18 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@@ -24,8 +24,8 @@
/* /*
** Interpret the given string as a boolean value. ** Interpret the given string as a boolean value.
*/ */
static int getBoolean(const char *z){ static int getBoolean(const u8 *z){
static char *azTrue[] = { "yes", "on", "true" }; static const u8 *azTrue[] = { "yes", "on", "true" };
int i; int i;
if( z[0]==0 ) return 0; if( z[0]==0 ) return 0;
if( isdigit(z[0]) || (z[0]=='-' && isdigit(z[1])) ){ if( isdigit(z[0]) || (z[0]=='-' && isdigit(z[1])) ){
@@ -47,9 +47,9 @@ static int getBoolean(const char *z){
** to support legacy SQL code. The safety level used to be boolean ** to support legacy SQL code. The safety level used to be boolean
** and older scripts may have used numbers 0 for OFF and 1 for ON. ** and older scripts may have used numbers 0 for OFF and 1 for ON.
*/ */
static int getSafetyLevel(char *z){ static int getSafetyLevel(u8 *z){
static const struct { static const struct {
const char *zWord; const u8 *zWord;
int val; int val;
} aKey[] = { } aKey[] = {
{ "no", 0 }, { "no", 0 },

View File

@@ -12,7 +12,7 @@
** This file contains code to implement the "sqlite" command line ** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases. ** utility for accessing SQLite databases.
** **
** $Id: shell.c,v 1.109 2004/08/04 15:16:55 drh Exp $ ** $Id: shell.c,v 1.110 2004/08/08 20:22:18 drh Exp $
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -488,9 +488,9 @@ static void set_table_name(struct callback_data *p, const char *zName){
p->zDestTable = 0; p->zDestTable = 0;
} }
if( zName==0 ) return; if( zName==0 ) return;
needQuote = !isalpha(*zName) && *zName!='_'; needQuote = !isalpha((unsigned char)*zName) && *zName!='_';
for(i=n=0; zName[i]; i++, n++){ for(i=n=0; zName[i]; i++, n++){
if( !isalnum(zName[i]) && zName[i]!='_' ){ if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ){
needQuote = 1; needQuote = 1;
if( zName[i]=='\'' ) n++; if( zName[i]=='\'' ) n++;
} }
@@ -754,7 +754,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
/* Parse the input line into tokens. /* Parse the input line into tokens.
*/ */
while( zLine[i] && nArg<ArraySize(azArg) ){ while( zLine[i] && nArg<ArraySize(azArg) ){
while( isspace(zLine[i]) ){ i++; } while( isspace((unsigned char)zLine[i]) ){ i++; }
if( zLine[i]==0 ) break; if( zLine[i]==0 ) break;
if( zLine[i]=='\'' || zLine[i]=='"' ){ if( zLine[i]=='\'' || zLine[i]=='"' ){
int delim = zLine[i++]; int delim = zLine[i++];
@@ -766,7 +766,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
if( delim=='"' ) resolve_backslashes(azArg[nArg-1]); if( delim=='"' ) resolve_backslashes(azArg[nArg-1]);
}else{ }else{
azArg[nArg++] = &zLine[i]; azArg[nArg++] = &zLine[i];
while( zLine[i] && !isspace(zLine[i]) ){ i++; } while( zLine[i] && !isspace((unsigned char)zLine[i]) ){ i++; }
if( zLine[i] ) zLine[i++] = 0; if( zLine[i] ) zLine[i++] = 0;
resolve_backslashes(azArg[nArg-1]); resolve_backslashes(azArg[nArg-1]);
} }
@@ -831,7 +831,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
char *z = azArg[1]; char *z = azArg[1];
int val = atoi(azArg[1]); int val = atoi(azArg[1]);
for(j=0; z[j]; j++){ for(j=0; z[j]; j++){
if( isupper(z[j]) ) z[j] = tolower(z[j]); z[j] = tolower((unsigned char)z[j]);
} }
if( strcmp(z,"on")==0 ){ if( strcmp(z,"on")==0 ){
val = 1; val = 1;
@@ -850,7 +850,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
char *z = nArg>=2 ? azArg[1] : "1"; char *z = nArg>=2 ? azArg[1] : "1";
int val = atoi(z); int val = atoi(z);
for(j=0; z[j]; j++){ for(j=0; z[j]; j++){
if( isupper(z[j]) ) z[j] = tolower(z[j]); z[j] = tolower((unsigned char)z[j]);
} }
if( strcmp(z,"on")==0 ){ if( strcmp(z,"on")==0 ){
val = 1; val = 1;
@@ -894,7 +894,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
char *z = azArg[1]; char *z = azArg[1];
int val = atoi(azArg[1]); int val = atoi(azArg[1]);
for(j=0; z[j]; j++){ for(j=0; z[j]; j++){
if( isupper(z[j]) ) z[j] = tolower(z[j]); z[j] = tolower((unsigned char)z[j]);
} }
if( strcmp(z,"on")==0 ){ if( strcmp(z,"on")==0 ){
val = 1; val = 1;
@@ -1295,7 +1295,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
** z[] is N characters long. ** z[] is N characters long.
*/ */
static int _ends_with_semicolon(const char *z, int N){ static int _ends_with_semicolon(const char *z, int N){
while( N>0 && isspace(z[N-1]) ){ N--; } while( N>0 && isspace((unsigned char)z[N-1]) ){ N--; }
return N>0 && z[N-1]==';'; return N>0 && z[N-1]==';';
} }
@@ -1304,7 +1304,7 @@ static int _ends_with_semicolon(const char *z, int N){
*/ */
static int _all_whitespace(const char *z){ static int _all_whitespace(const char *z){
for(; *z; z++){ for(; *z; z++){
if( isspace(*z) ) continue; if( isspace(*(unsigned char*)z) ) continue;
if( *z=='/' && z[1]=='*' ){ if( *z=='/' && z[1]=='*' ){
z += 2; z += 2;
while( *z && (*z!='*' || z[1]!='/') ){ z++; } while( *z && (*z!='*' || z[1]!='/') ){ z++; }
@@ -1330,7 +1330,7 @@ static int _all_whitespace(const char *z){
*/ */
static int _is_command_terminator(const char *zLine){ static int _is_command_terminator(const char *zLine){
extern int sqlite3StrNICmp(const char*,const char*,int); extern int sqlite3StrNICmp(const char*,const char*,int);
while( isspace(*zLine) ){ zLine++; }; while( isspace(*(unsigned char*)zLine) ){ zLine++; };
if( zLine[0]=='/' && _all_whitespace(&zLine[1]) ) return 1; /* Oracle */ if( zLine[0]=='/' && _all_whitespace(&zLine[1]) ) return 1; /* Oracle */
if( sqlite3StrNICmp(zLine,"go",2)==0 && _all_whitespace(&zLine[2]) ){ if( sqlite3StrNICmp(zLine,"go",2)==0 && _all_whitespace(&zLine[2]) ){
return 1; /* SQL Server */ return 1; /* SQL Server */
@@ -1369,7 +1369,7 @@ static void process_input(struct callback_data *p, FILE *in){
} }
if( zSql==0 ){ if( zSql==0 ){
int i; int i;
for(i=0; zLine[i] && isspace(zLine[i]); i++){} for(i=0; zLine[i] && isspace((unsigned char)zLine[i]); i++){}
if( zLine[i]!=0 ){ if( zLine[i]!=0 ){
nSql = strlen(zLine); nSql = strlen(zLine);
zSql = malloc( nSql+1 ); zSql = malloc( nSql+1 );

View File

@@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** Internal interface definitions for SQLite. ** Internal interface definitions for SQLite.
** **
** @(#) $Id: sqliteInt.h,v 1.314 2004/08/07 23:54:48 drh Exp $ ** @(#) $Id: sqliteInt.h,v 1.315 2004/08/08 20:22:18 drh Exp $
*/ */
#ifndef _SQLITEINT_H_ #ifndef _SQLITEINT_H_
#define _SQLITEINT_H_ #define _SQLITEINT_H_
@@ -700,9 +700,9 @@ struct Index {
** and Token.n when Token.z==0. ** and Token.n when Token.z==0.
*/ */
struct Token { struct Token {
const char *z; /* Text of the token. Not NULL-terminated! */ const unsigned char *z; /* Text of the token. Not NULL-terminated! */
unsigned dyn : 1; /* True for malloced memory, false for static */ unsigned dyn : 1; /* True for malloced memory, false for static */
unsigned n : 31; /* Number of characters in this token */ unsigned n : 31; /* Number of characters in this token */
}; };
/* /*

View File

@@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** Code for testing the the SQLite library in a multithreaded environment. ** Code for testing the the SQLite library in a multithreaded environment.
** **
** $Id: test4.c,v 1.10 2004/06/08 00:02:35 danielk1977 Exp $ ** $Id: test4.c,v 1.11 2004/08/08 20:22:18 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "tcl.h" #include "tcl.h"
@@ -106,7 +106,7 @@ static void *thread_main(void *pArg){
** the interpreter and return -1. ** the interpreter and return -1.
*/ */
static int parse_thread_id(Tcl_Interp *interp, const char *zArg){ static int parse_thread_id(Tcl_Interp *interp, const char *zArg){
if( zArg==0 || zArg[0]==0 || zArg[1]!=0 || !isupper(zArg[0]) ){ if( zArg==0 || zArg[0]==0 || zArg[1]!=0 || !isupper((unsigned char)zArg[0]) ){
Tcl_AppendResult(interp, "thread ID must be an upper case letter", 0); Tcl_AppendResult(interp, "thread ID must be an upper case letter", 0);
return -1; return -1;
} }

View File

@@ -14,7 +14,7 @@
** This file contains functions for allocating memory, comparing ** This file contains functions for allocating memory, comparing
** strings, and stuff like that. ** strings, and stuff like that.
** **
** $Id: util.c,v 1.111 2004/07/15 13:23:22 drh Exp $ ** $Id: util.c,v 1.112 2004/08/08 20:22:18 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <stdarg.h> #include <stdarg.h>
@@ -596,23 +596,23 @@ int sqlite3IsNumber(const char *z, int *realnum, u8 enc){
int incr = (enc==SQLITE_UTF8?1:2); int incr = (enc==SQLITE_UTF8?1:2);
if( enc==SQLITE_UTF16BE ) z++; if( enc==SQLITE_UTF16BE ) z++;
if( *z=='-' || *z=='+' ) z += incr; if( *z=='-' || *z=='+' ) z += incr;
if( !isdigit(*z) ){ if( !isdigit(*(u8*)z) ){
return 0; return 0;
} }
z += incr; z += incr;
if( realnum ) *realnum = 0; if( realnum ) *realnum = 0;
while( isdigit(*z) ){ z += incr; } while( isdigit(*(u8*)z) ){ z += incr; }
if( *z=='.' ){ if( *z=='.' ){
z += incr; z += incr;
if( !isdigit(*z) ) return 0; if( !isdigit(*(u8*)z) ) return 0;
while( isdigit(*z) ){ z += incr; } while( isdigit(*(u8*)z) ){ z += incr; }
if( realnum ) *realnum = 1; if( realnum ) *realnum = 1;
} }
if( *z=='e' || *z=='E' ){ if( *z=='e' || *z=='E' ){
z += incr; z += incr;
if( *z=='+' || *z=='-' ) z += incr; if( *z=='+' || *z=='-' ) z += incr;
if( !isdigit(*z) ) return 0; if( !isdigit(*(u8*)z) ) return 0;
while( isdigit(*z) ){ z += incr; } while( isdigit(*(u8*)z) ){ z += incr; }
if( realnum ) *realnum = 1; if( realnum ) *realnum = 1;
} }
return *z==0; return *z==0;
@@ -639,14 +639,14 @@ double sqlite3AtoF(const char *z, const char **pzEnd){
}else if( *z=='+' ){ }else if( *z=='+' ){
z++; z++;
} }
while( isdigit(*z) ){ while( isdigit(*(u8*)z) ){
v1 = v1*10.0 + (*z - '0'); v1 = v1*10.0 + (*z - '0');
z++; z++;
} }
if( *z=='.' ){ if( *z=='.' ){
LONGDOUBLE_TYPE divisor = 1.0; LONGDOUBLE_TYPE divisor = 1.0;
z++; z++;
while( isdigit(*z) ){ while( isdigit(*(u8*)z) ){
v1 = v1*10.0 + (*z - '0'); v1 = v1*10.0 + (*z - '0');
divisor *= 10.0; divisor *= 10.0;
z++; z++;
@@ -664,7 +664,7 @@ double sqlite3AtoF(const char *z, const char **pzEnd){
}else if( *z=='+' ){ }else if( *z=='+' ){
z++; z++;
} }
while( isdigit(*z) ){ while( isdigit(*(u8*)z) ){
eval = eval*10 + *z - '0'; eval = eval*10 + *z - '0';
z++; z++;
} }

View File

@@ -532,7 +532,7 @@ void sqlite3VdbePrintSql(Vdbe *p){
pOp = &p->aOp[nOp-2]; pOp = &p->aOp[nOp-2];
if( pOp->opcode==OP_Noop && pOp->p3!=0 ){ if( pOp->opcode==OP_Noop && pOp->p3!=0 ){
const char *z = pOp->p3; const char *z = pOp->p3;
while( isspace(*z) ) z++; while( isspace(*(u8*)z) ) z++;
printf("SQL: [%s]\n", z); printf("SQL: [%s]\n", z);
} }
#endif #endif