diff options
author | drh <drh@noemail.net> | 2013-11-26 16:48:04 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2013-11-26 16:48:04 +0000 |
commit | 0425f18959aaafb4c1ce703d461acfb7a8ae65d3 (patch) | |
tree | 1183e03b4cf7ca58a3bc77d10bdd2cc1ee7dd3cc /src | |
parent | dbb3c98ad1eaf5e3ab00757f04a35c6d6e898e11 (diff) | |
download | sqlite-0425f18959aaafb4c1ce703d461acfb7a8ae65d3.tar.gz sqlite-0425f18959aaafb4c1ce703d461acfb7a8ae65d3.zip |
Change tclsqlite3.c so that it never invokes ctype macros with signed
character arguments.
FossilOrigin-Name: c07caabf2396c84b2ccb0e9f98ae6279ce41c59d
Diffstat (limited to 'src')
-rw-r--r-- | src/tclsqlite.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/tclsqlite.c b/src/tclsqlite.c index b8fdf23c4..0f57dda6c 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -424,13 +424,12 @@ static int safeToUseEvalObjv(Tcl_Interp *interp, Tcl_Obj *pCmd){ */ static SqlFunc *findSqlFunc(SqliteDb *pDb, const char *zName){ SqlFunc *p, *pNew; - int i; - pNew = (SqlFunc*)Tcl_Alloc( sizeof(*pNew) + strlen30(zName) + 1 ); + int nName = strlen30(zName); + pNew = (SqlFunc*)Tcl_Alloc( sizeof(*pNew) + nName + 1 ); pNew->zName = (char*)&pNew[1]; - for(i=0; zName[i]; i++){ pNew->zName[i] = tolower(zName[i]); } - pNew->zName[i] = 0; + memcpy(pNew->zName, zName, nName+1); for(p=pDb->pFunc; p; p=p->pNext){ - if( strcmp(p->zName, pNew->zName)==0 ){ + if( sqlite3_stricmp(p->zName, pNew->zName)==0 ){ Tcl_Free((char*)pNew); return p; } @@ -1083,13 +1082,14 @@ static int dbPrepareAndBind( int nSql; /* Length of zSql in bytes */ int nVar; /* Number of variables in statement */ int iParm = 0; /* Next free entry in apParm */ + char c; int i; Tcl_Interp *interp = pDb->interp; *ppPreStmt = 0; /* Trim spaces from the start of zSql and calculate the remaining length. */ - while( isspace(zSql[0]) ){ zSql++; } + while( (c = zSql[0])==' ' || c=='\t' || c=='\r' || c=='\n' ){ zSql++; } nSql = strlen30(zSql); for(pPreStmt = pDb->stmtList; pPreStmt; pPreStmt=pPreStmt->pNext){ |