From 282852e5dad3647fae85990e9c84e2e2af76eb48 Mon Sep 17 00:00:00 2001 From: "D. Richard Hipp" Date: Thu, 29 Oct 2015 13:48:15 +0000 Subject: [PATCH] Fix uses of ctype functions (ex: isspace()) on signed characters in test programs and in some obscure extensions. No changes to the core. --- autoconf/tea/win/nmakehlp.c | 6 +-- ext/fts1/fts1.c | 6 +-- ext/fts1/simple_tokenizer.c | 2 +- ext/misc/amatch.c | 4 +- ext/misc/closure.c | 4 +- ext/misc/spellfix.c | 2 +- mptest/mptest.c | 41 ++++++++++--------- test/fuzzcheck.c | 9 ++-- test/speedtest1.c | 6 ++- test/wordcount.c | 5 ++- tool/fuzzershell.c | 3 +- tool/lemon.c | 82 ++++++++++++++++++++----------------- tool/showdb.c | 12 +++--- tool/showstat4.c | 4 +- tool/showwal.c | 7 +++- tool/speedtest16.c | 4 +- tool/speedtest8inst1.c | 4 +- 17 files changed, 115 insertions(+), 86 deletions(-) diff --git a/autoconf/tea/win/nmakehlp.c b/autoconf/tea/win/nmakehlp.c index 2868857efd..e00f1b4996 100644 --- a/autoconf/tea/win/nmakehlp.c +++ b/autoconf/tea/win/nmakehlp.c @@ -603,8 +603,8 @@ SubstituteFile( sp = fopen(substitutions, "rt"); if (sp != NULL) { while (fgets(szBuffer, cbBuffer, sp) != NULL) { - char *ks, *ke, *vs, *ve; - ks = szBuffer; + unsigned char *ks, *ke, *vs, *ve; + ks = (unsigned char*)szBuffer; while (ks && *ks && isspace(*ks)) ++ks; ke = ks; while (ke && *ke && !isspace(*ke)) ++ke; @@ -613,7 +613,7 @@ SubstituteFile( ve = vs; while (ve && *ve && !(*ve == '\r' || *ve == '\n')) ++ve; *ke = 0, *ve = 0; - list_insert(&substPtr, ks, vs); + list_insert(&substPtr, (char*)ks, (char*)vs); } fclose(sp); } diff --git a/ext/fts1/fts1.c b/ext/fts1/fts1.c index 482cf759ba..77fa9e23f5 100644 --- a/ext/fts1/fts1.c +++ b/ext/fts1/fts1.c @@ -205,13 +205,13 @@ static int getVarint32(const char *p, int *pi){ */ /* TODO(shess) Is __isascii() a portable version of (c&0x80)==0? */ static int safe_isspace(char c){ - return (c&0x80)==0 ? isspace(c) : 0; + return (c&0x80)==0 ? isspace((unsigned char)c) : 0; } static int safe_tolower(char c){ - return (c&0x80)==0 ? tolower(c) : c; + return (c&0x80)==0 ? tolower((unsigned char)c) : c; } static int safe_isalnum(char c){ - return (c&0x80)==0 ? isalnum(c) : 0; + return (c&0x80)==0 ? isalnum((unsigned char)c) : 0; } typedef enum DocListType { diff --git a/ext/fts1/simple_tokenizer.c b/ext/fts1/simple_tokenizer.c index d00a77089d..0ddc7055af 100644 --- a/ext/fts1/simple_tokenizer.c +++ b/ext/fts1/simple_tokenizer.c @@ -138,7 +138,7 @@ static int simpleNext( ** case-insensitivity. */ char ch = c->pCurrent[ii]; - c->zToken[ii] = (unsigned char)ch<0x80 ? tolower(ch) : ch; + c->zToken[ii] = (unsigned char)ch<0x80 ? tolower((unsigned char)ch):ch; } c->zToken[n] = '\0'; *ppToken = c->zToken; diff --git a/ext/misc/amatch.c b/ext/misc/amatch.c index d08ef57aad..852491988a 100644 --- a/ext/misc/amatch.c +++ b/ext/misc/amatch.c @@ -816,10 +816,10 @@ static const char *amatchValueOfKey(const char *zKey, const char *zStr){ int i; if( nStr #include +#define ISSPACE(X) isspace((unsigned char)(X)) +#define ISDIGIT(X) isdigit((unsigned char)(X)) + /* The suffix to append to the child command lines, if any */ #if defined(_WIN32) # define GETPID (int)GetCurrentProcessId @@ -187,10 +190,10 @@ int strglob(const char *zGlob, const char *z){ } if( c2==0 || (seen ^ invert)==0 ) return 0; }else if( c=='#' ){ - if( (z[0]=='-' || z[0]=='+') && isdigit(z[1]) ) z++; - if( !isdigit(z[0]) ) return 0; + if( (z[0]=='-' || z[0]=='+') && ISDIGIT(z[1]) ) z++; + if( !ISDIGIT(z[0]) ) return 0; z++; - while( isdigit(z[0]) ){ z++; } + while( ISDIGIT(z[0]) ){ z++; } }else{ if( c!=(*(z++)) ) return 0; } @@ -289,7 +292,7 @@ static void logMessage(const char *zFormat, ...){ */ static int clipLength(const char *z){ int n = (int)strlen(z); - while( n>0 && isspace(z[n-1]) ){ n--; } + while( n>0 && ISSPACE(z[n-1]) ){ n--; } return n; } @@ -444,7 +447,7 @@ static void stringAppendTerm(String *p, const char *z){ stringAppend(p, "nil", 3); return; } - for(i=0; z[i] && !isspace(z[i]); i++){} + for(i=0; z[i] && !ISSPACE(z[i]); i++){} if( i>0 && z[i]==0 ){ stringAppend(p, z, i); return; @@ -699,7 +702,7 @@ static char *readFile(const char *zFilename){ */ static int tokenLength(const char *z, int *pnLine){ int n = 0; - if( isspace(z[0]) || (z[0]=='/' && z[1]=='*') ){ + if( ISSPACE(z[0]) || (z[0]=='/' && z[1]=='*') ){ int inC = 0; int c; if( z[0]=='/' ){ @@ -708,7 +711,7 @@ static int tokenLength(const char *z, int *pnLine){ } while( (c = z[n++])!=0 ){ if( c=='\n' ) (*pnLine)++; - if( isspace(c) ) continue; + if( ISSPACE(c) ) continue; if( inC && c=='*' && z[n]=='/' ){ n++; inC = 0; @@ -734,7 +737,7 @@ static int tokenLength(const char *z, int *pnLine){ } }else{ int c; - for(n=1; (c = z[n])!=0 && !isspace(c) && c!='"' && c!='\'' && c!=';'; n++){} + for(n=1; (c = z[n])!=0 && !ISSPACE(c) && c!='"' && c!='\'' && c!=';'; n++){} } return n; } @@ -748,7 +751,7 @@ static int extractToken(const char *zIn, int nIn, char *zOut, int nOut){ zOut[0] = 0; return 0; } - for(i=0; i=2 ) logMessage("%.*s", len, zScript+ii); n = extractToken(zScript+ii+2, len-2, zCmd, sizeof(zCmd)); for(nArg=0; n=len-2 ) break; n += extractToken(zScript+ii+2+n, len-2-n, azArg[nArg], sizeof(azArg[nArg])); @@ -976,7 +979,7 @@ static void runScript( if( strcmp(zCmd, "match")==0 ){ int jj; char *zAns = zScript+ii; - for(jj=7; jj #include #include "sqlite3.h" +#define ISSPACE(X) isspace((unsigned char)(X)) +#define ISDIGIT(X) isdigit((unsigned char)(X)) + #ifdef __unix__ # include @@ -633,9 +636,9 @@ static void runSql(sqlite3 *db, const char *zSql, unsigned runFlags){ if( runFlags & SQL_TRACE ){ const char *z = zSql; int n; - while( z0 && isspace(z[n-1]) ) n--; + while( n>0 && ISSPACE(z[n-1]) ) n--; if( n==0 ) break; if( pStmt==0 ){ printf("TRACE: %.*s (error: %s)\n", n, z, sqlite3_errmsg(db)); @@ -757,7 +760,7 @@ static int integerValue(const char *zArg){ zArg++; } }else{ - while( isdigit(zArg[0]) ){ + while( ISDIGIT(zArg[0]) ){ v = v*10 + zArg[0] - '0'; zArg++; } diff --git a/test/speedtest1.c b/test/speedtest1.c index b34dae65ae..b41c732053 100644 --- a/test/speedtest1.c +++ b/test/speedtest1.c @@ -47,6 +47,8 @@ static const char zHelp[] = #include #include #include +#define ISSPACE(X) isspace((unsigned char)(X)) +#define ISDIGIT(X) isdigit((unsigned char)(X)) #if SQLITE_VERSION_NUMBER<3005000 # define sqlite3_int64 sqlite_int64 @@ -315,7 +317,7 @@ void speedtest1_final(void){ /* Print an SQL statement to standard output */ static void printSql(const char *zSql){ int n = (int)strlen(zSql); - while( n>0 && (zSql[n-1]==';' || isspace(zSql[n-1])) ){ n--; } + while( n>0 && (zSql[n-1]==';' || ISSPACE(zSql[n-1])) ){ n--; } if( g.bExplain ) printf("EXPLAIN "); printf("%.*s;\n", n, zSql); if( g.bExplain @@ -414,7 +416,7 @@ void speedtest1_run(void){ /* The sqlite3_trace() callback function */ static void traceCallback(void *NotUsed, const char *zSql){ int n = (int)strlen(zSql); - while( n>0 && (zSql[n-1]==';' || isspace(zSql[n-1])) ) n--; + while( n>0 && (zSql[n-1]==';' || ISSPACE(zSql[n-1])) ) n--; fprintf(stderr,"%.*s;\n", n, zSql); } diff --git a/test/wordcount.c b/test/wordcount.c index cf63e983c2..72aa6b2f0b 100644 --- a/test/wordcount.c +++ b/test/wordcount.c @@ -80,6 +80,7 @@ #include #include #include "sqlite3.h" +#define ISALPHA(X) isalpha((unsigned char)(X)) /* Return the current wall-clock time */ static sqlite3_int64 realTime(void){ @@ -392,8 +393,8 @@ int main(int argc, char **argv){ /* Process the input file */ while( fgets(zInput, sizeof(zInput), in) ){ for(i=0; zInput[i]; i++){ - if( !isalpha(zInput[i]) ) continue; - for(j=i+1; isalpha(zInput[j]); j++){} + if( !ISALPHA(zInput[i]) ) continue; + for(j=i+1; ISALPHA(zInput[j]); j++){} /* Found a new word at zInput[i] that is j-i bytes long. ** Process it into the wordcount table. */ diff --git a/tool/fuzzershell.c b/tool/fuzzershell.c index 6754a071e3..2c778bce6e 100644 --- a/tool/fuzzershell.c +++ b/tool/fuzzershell.c @@ -67,6 +67,7 @@ #include #include #include "sqlite3.h" +#define ISDIGIT(X) isdigit((unsigned char)(X)) /* ** All global variables are gathered into the "g" singleton. @@ -383,7 +384,7 @@ static int integerValue(const char *zArg){ zArg++; } }else{ - while( isdigit(zArg[0]) ){ + while( ISDIGIT(zArg[0]) ){ v = v*10 + zArg[0] - '0'; zArg++; } diff --git a/tool/lemon.c b/tool/lemon.c index 2e8054b5cc..d704deb624 100644 --- a/tool/lemon.c +++ b/tool/lemon.c @@ -13,6 +13,14 @@ #include #include +#define ISSPACE(X) isspace((unsigned char)(X)) +#define ISDIGIT(X) isdigit((unsigned char)(X)) +#define ISALNUM(X) isalnum((unsigned char)(X)) +#define ISALPHA(X) isalpha((unsigned char)(X)) +#define ISUPPER(X) isupper((unsigned char)(X)) +#define ISLOWER(X) islower((unsigned char)(X)) + + #ifndef __WIN32__ # if defined(_WIN32) || defined(WIN32) # define __WIN32__ @@ -93,9 +101,9 @@ static int lemon_vsprintf(char *str, const char *zFormat, va_list ap){ int iWidth = 0; lemon_addtext(str, &nUsed, &zFormat[j], i-j, 0); c = zFormat[++i]; - if( isdigit(c) || (c=='-' && isdigit(zFormat[i+1])) ){ + if( ISDIGIT(c) || (c=='-' && ISDIGIT(zFormat[i+1])) ){ if( c=='-' ) i++; - while( isdigit(zFormat[i]) ) iWidth = iWidth*10 + zFormat[i++] - '0'; + while( ISDIGIT(zFormat[i]) ) iWidth = iWidth*10 + zFormat[i++] - '0'; if( c=='-' ) iWidth = -iWidth; c = zFormat[i]; } @@ -1578,7 +1586,7 @@ int main(int argc, char **argv) while( lem.symbols[i-1]->type==MULTITERMINAL ){ i--; } assert( strcmp(lem.symbols[i-1]->name,"{default}")==0 ); lem.nsymbol = i - 1; - for(i=1; isupper(lem.symbols[i]->name[0]); i++); + for(i=1; ISUPPER(lem.symbols[i]->name[0]); i++); lem.nterminal = i; /* Generate a reprint of the grammar, if requested on the command line */ @@ -2121,7 +2129,7 @@ static void parseonetoken(struct pstate *psp) case WAITING_FOR_DECL_OR_RULE: if( x[0]=='%' ){ psp->state = WAITING_FOR_DECL_KEYWORD; - }else if( islower(x[0]) ){ + }else if( ISLOWER(x[0]) ){ psp->lhs = Symbol_new(x); psp->nrhs = 0; psp->lhsalias = 0; @@ -2151,7 +2159,7 @@ to follow the previous rule."); } break; case PRECEDENCE_MARK_1: - if( !isupper(x[0]) ){ + if( !ISUPPER(x[0]) ){ ErrorMsg(psp->filename,psp->tokenlineno, "The precedence symbol must be a terminal."); psp->errorcnt++; @@ -2191,7 +2199,7 @@ to follow the previous rule."); } break; case LHS_ALIAS_1: - if( isalpha(x[0]) ){ + if( ISALPHA(x[0]) ){ psp->lhsalias = x; psp->state = LHS_ALIAS_2; }else{ @@ -2260,7 +2268,7 @@ to follow the previous rule."); psp->prevrule = rp; } psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isalpha(x[0]) ){ + }else if( ISALPHA(x[0]) ){ if( psp->nrhs>=MAXRHS ){ ErrorMsg(psp->filename,psp->tokenlineno, "Too many symbols on RHS of rule beginning at \"%s\".", @@ -2289,7 +2297,7 @@ to follow the previous rule."); msp->subsym = (struct symbol **) realloc(msp->subsym, sizeof(struct symbol*)*msp->nsubsym); msp->subsym[msp->nsubsym-1] = Symbol_new(&x[1]); - if( islower(x[1]) || islower(msp->subsym[0]->name[0]) ){ + if( ISLOWER(x[1]) || ISLOWER(msp->subsym[0]->name[0]) ){ ErrorMsg(psp->filename,psp->tokenlineno, "Cannot form a compound containing a non-terminal"); psp->errorcnt++; @@ -2304,7 +2312,7 @@ to follow the previous rule."); } break; case RHS_ALIAS_1: - if( isalpha(x[0]) ){ + if( ISALPHA(x[0]) ){ psp->alias[psp->nrhs-1] = x; psp->state = RHS_ALIAS_2; }else{ @@ -2326,7 +2334,7 @@ to follow the previous rule."); } break; case WAITING_FOR_DECL_KEYWORD: - if( isalpha(x[0]) ){ + if( ISALPHA(x[0]) ){ psp->declkeyword = x; psp->declargslot = 0; psp->decllinenoslot = 0; @@ -2406,7 +2414,7 @@ to follow the previous rule."); } break; case WAITING_FOR_DESTRUCTOR_SYMBOL: - if( !isalpha(x[0]) ){ + if( !ISALPHA(x[0]) ){ ErrorMsg(psp->filename,psp->tokenlineno, "Symbol name missing after %%destructor keyword"); psp->errorcnt++; @@ -2420,7 +2428,7 @@ to follow the previous rule."); } break; case WAITING_FOR_DATATYPE_SYMBOL: - if( !isalpha(x[0]) ){ + if( !ISALPHA(x[0]) ){ ErrorMsg(psp->filename,psp->tokenlineno, "Symbol name missing after %%type keyword"); psp->errorcnt++; @@ -2445,7 +2453,7 @@ to follow the previous rule."); case WAITING_FOR_PRECEDENCE_SYMBOL: if( x[0]=='.' ){ psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isupper(x[0]) ){ + }else if( ISUPPER(x[0]) ){ struct symbol *sp; sp = Symbol_new(x); if( sp->prec>=0 ){ @@ -2463,7 +2471,7 @@ to follow the previous rule."); } break; case WAITING_FOR_DECL_ARG: - if( x[0]=='{' || x[0]=='\"' || isalnum(x[0]) ){ + if( x[0]=='{' || x[0]=='\"' || ISALNUM(x[0]) ){ const char *zOld, *zNew; char *zBuf, *z; int nOld, n, nLine = 0, nNew, nBack; @@ -2524,7 +2532,7 @@ to follow the previous rule."); case WAITING_FOR_FALLBACK_ID: if( x[0]=='.' ){ psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( !isupper(x[0]) ){ + }else if( !ISUPPER(x[0]) ){ ErrorMsg(psp->filename, psp->tokenlineno, "%%fallback argument \"%s\" should be a token", x); psp->errorcnt++; @@ -2545,7 +2553,7 @@ to follow the previous rule."); case WAITING_FOR_WILDCARD_ID: if( x[0]=='.' ){ psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( !isupper(x[0]) ){ + }else if( !ISUPPER(x[0]) ){ ErrorMsg(psp->filename, psp->tokenlineno, "%%wildcard argument \"%s\" should be a token", x); psp->errorcnt++; @@ -2561,7 +2569,7 @@ to follow the previous rule."); } break; case WAITING_FOR_CLASS_ID: - if( !islower(x[0]) ){ + if( !ISLOWER(x[0]) ){ ErrorMsg(psp->filename, psp->tokenlineno, "%%token_class must be followed by an identifier: ", x); psp->errorcnt++; @@ -2580,12 +2588,12 @@ to follow the previous rule."); case WAITING_FOR_CLASS_TOKEN: if( x[0]=='.' ){ psp->state = WAITING_FOR_DECL_OR_RULE; - }else if( isupper(x[0]) || ((x[0]=='|' || x[0]=='/') && isupper(x[1])) ){ + }else if( ISUPPER(x[0]) || ((x[0]=='|' || x[0]=='/') && ISUPPER(x[1])) ){ struct symbol *msp = psp->tkclass; msp->nsubsym++; msp->subsym = (struct symbol **) realloc(msp->subsym, sizeof(struct symbol*)*msp->nsubsym); - if( !isupper(x[0]) ) x++; + if( !ISUPPER(x[0]) ) x++; msp->subsym[msp->nsubsym-1] = Symbol_new(x); }else{ ErrorMsg(psp->filename, psp->tokenlineno, @@ -2618,7 +2626,7 @@ static void preprocess_input(char *z){ for(i=0; z[i]; i++){ if( z[i]=='\n' ) lineno++; if( z[i]!='%' || (i>0 && z[i-1]!='\n') ) continue; - if( strncmp(&z[i],"%endif",6)==0 && isspace(z[i+6]) ){ + if( strncmp(&z[i],"%endif",6)==0 && ISSPACE(z[i+6]) ){ if( exclude ){ exclude--; if( exclude==0 ){ @@ -2626,13 +2634,13 @@ static void preprocess_input(char *z){ } } for(j=i; z[j] && z[j]!='\n'; j++) z[j] = ' '; - }else if( (strncmp(&z[i],"%ifdef",6)==0 && isspace(z[i+6])) - || (strncmp(&z[i],"%ifndef",7)==0 && isspace(z[i+7])) ){ + }else if( (strncmp(&z[i],"%ifdef",6)==0 && ISSPACE(z[i+6])) + || (strncmp(&z[i],"%ifndef",7)==0 && ISSPACE(z[i+7])) ){ if( exclude ){ exclude++; }else{ - for(j=i+7; isspace(z[j]); j++){} - for(n=0; z[j+n] && !isspace(z[j+n]); n++){} + for(j=i+7; ISSPACE(z[j]); j++){} + for(n=0; z[j+n] && !ISSPACE(z[j+n]); n++){} exclude = 1; for(k=0; kiStart ) fprintf(out,"%.*s",i-iStart,&line[iStart]); fprintf(out,"%s",name); @@ -3478,9 +3486,9 @@ PRIVATE void translate_code(struct lemon *lemp, struct rule *rp){ /* This const cast is wrong but harmless, if we're careful. */ for(cp=(char *)rp->code; *cp; cp++){ - if( isalpha(*cp) && (cp==rp->code || (!isalnum(cp[-1]) && cp[-1]!='_')) ){ + if( ISALPHA(*cp) && (cp==rp->code || (!ISALNUM(cp[-1]) && cp[-1]!='_')) ){ char saved; - for(xp= &cp[1]; isalnum(*xp) || *xp=='_'; xp++); + for(xp= &cp[1]; ISALNUM(*xp) || *xp=='_'; xp++); saved = *xp; *xp = 0; if( rp->lhsalias && strcmp(cp,rp->lhsalias)==0 ){ @@ -3645,9 +3653,9 @@ void print_stack_union( cp = sp->datatype; if( cp==0 ) cp = lemp->vartype; j = 0; - while( isspace(*cp) ) cp++; + while( ISSPACE(*cp) ) cp++; while( *cp ) stddt[j++] = *cp++; - while( j>0 && isspace(stddt[j-1]) ) j--; + while( j>0 && ISSPACE(stddt[j-1]) ) j--; stddt[j] = 0; if( lemp->tokentype && strcmp(stddt, lemp->tokentype)==0 ){ sp->dtnum = 0; @@ -3857,8 +3865,8 @@ void ReportTable( name = lemp->name ? lemp->name : "Parse"; if( lemp->arg && lemp->arg[0] ){ i = lemonStrlen(lemp->arg); - while( i>=1 && isspace(lemp->arg[i-1]) ) i--; - while( i>=1 && (isalnum(lemp->arg[i-1]) || lemp->arg[i-1]=='_') ) i--; + while( i>=1 && ISSPACE(lemp->arg[i-1]) ) i--; + while( i>=1 && (ISALNUM(lemp->arg[i-1]) || lemp->arg[i-1]=='_') ) i--; fprintf(out,"#define %sARG_SDECL %s;\n",name,lemp->arg); lineno++; fprintf(out,"#define %sARG_PDECL ,%s\n",name,lemp->arg); lineno++; fprintf(out,"#define %sARG_FETCH %s = yypParser->%s\n", @@ -4666,7 +4674,7 @@ struct symbol *Symbol_new(const char *x) sp = (struct symbol *)calloc(1, sizeof(struct symbol) ); MemoryCheck(sp); sp->name = Strsafe(x); - sp->type = isupper(*x) ? TERMINAL : NONTERMINAL; + sp->type = ISUPPER(*x) ? TERMINAL : NONTERMINAL; sp->rule = 0; sp->fallback = 0; sp->prec = -1; diff --git a/tool/showdb.c b/tool/showdb.c index 892cacd552..38b92f1f7d 100644 --- a/tool/showdb.c +++ b/tool/showdb.c @@ -3,6 +3,8 @@ */ #include #include +#define ISDIGIT(X) isdigit((unsigned char)(X)) +#define ISPRINT(X) isprint((unsigned char)(X)) #include #include #include @@ -217,7 +219,7 @@ static unsigned char *print_byte_range( if( i+j>nByte ){ fprintf(stdout, " "); }else{ - fprintf(stdout,"%c", isprint(aData[i+j]) ? aData[i+j] : '.'); + fprintf(stdout,"%c", ISPRINT(aData[i+j]) ? aData[i+j] : '.'); } } fprintf(stdout,"\n"); @@ -600,7 +602,7 @@ static void decodeCell( }else{ zConst[0] = '\''; for(ii=1, jj=0; jj #include "sqlite3.h" +#define ISPRINT(X) isprint((unsigned char)(X)) + typedef sqlite3_int64 i64; /* 64-bit signed integer type */ @@ -131,7 +133,7 @@ int main(int argc, char **argv){ printf("%s\"", zSep); for(j=0; j #include +#define ISDIGIT(X) isdigit((unsigned char)(X)) +#define ISPRINT(X) isprint((unsigned char)(X)) + #if !defined(_MSC_VER) #include #else @@ -159,7 +162,7 @@ static void print_byte_range( if( i+j>nByte ){ fprintf(stdout, " "); }else{ - fprintf(stdout,"%c", isprint(aData[i+j]) ? aData[i+j] : '.'); + fprintf(stdout,"%c", ISPRINT(aData[i+j]) ? aData[i+j] : '.'); } } fprintf(stdout,"\n"); @@ -550,7 +553,7 @@ int main(int argc, char **argv){ print_wal_header(0); continue; } - if( !isdigit(argv[i][0]) ){ + if( !ISDIGIT(argv[i][0]) ){ fprintf(stderr, "%s: unknown option: [%s]\n", argv[0], argv[i]); continue; } diff --git a/tool/speedtest16.c b/tool/speedtest16.c index e81f1a6dba..993cc19268 100644 --- a/tool/speedtest16.c +++ b/tool/speedtest16.c @@ -29,6 +29,8 @@ #include #include "sqlite3.h" +#define ISSPACE(X) isspace((unsigned char)(X)) + /* ** hwtime.h contains inline assembler code for implementing ** high-performance timing routines. @@ -140,7 +142,7 @@ int main(int argc, char **argv){ zSql[j+1] = c; if( isComplete ){ zSql[j] = 0; - while( i #include "sqlite3.h" +#define ISSPACE(X) isspace((unsigned char)(X)) + #include "test_osinst.c" /* @@ -197,7 +199,7 @@ int main(int argc, char **argv){ zSql[j+1] = c; if( isComplete ){ zSql[j] = 0; - while( i