Overview
SHA1 Hash: | 054dd31b715829b7dd0c75f03e0f2c837f3db1c8 |
---|---|
Date: | 2008-11-03 21:56:09 |
User: | drh |
Comment: | Use our own isspace() function since the standard-library isspace() sometimes gives incorrect results for non-ASCII characters. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/blob.c from [2492695b87] to [1998856256].
@@ -75,10 +75,19 @@ #else #define blob_is_reset(x) #endif /* +** We find that the built-in isspace() function does not work for +** some international character sets. So here is a substitute. +*/ +static int blob_isspace(char c){ + return c==' ' || c=='\n' || c=='\t' || + c=='\r' || c=='\f' || c=='\v'; +} + +/* ** This routine is called if a blob operation fails because we ** have run out of memory. */ static void blob_panic(void){ static const char zErrMsg[] = "out of memory\n"; @@ -411,11 +420,11 @@ ** not insert a new zero terminator. */ int blob_trim(Blob *p){ char *z = p->aData; int n = p->nUsed; - while( n>0 && isspace(z[n-1]) ){ n--; } + while( n>0 && blob_isspace(z[n-1]) ){ n--; } p->nUsed = n; return n; } /* @@ -434,15 +443,15 @@ */ int blob_token(Blob *pFrom, Blob *pTo){ char *aData = pFrom->aData; int n = pFrom->nUsed; int i = pFrom->iCursor; - while( i<n && isspace(aData[i]) ){ i++; } + while( i<n && blob_isspace(aData[i]) ){ i++; } pFrom->iCursor = i; - while( i<n && !isspace(aData[i]) ){ i++; } + while( i<n && !blob_isspace(aData[i]) ){ i++; } blob_extract(pFrom, i-pFrom->iCursor, pTo); - while( i<n && isspace(aData[i]) ){ i++; } + while( i<n && blob_isspace(aData[i]) ){ i++; } pFrom->iCursor = i; return pTo->nUsed; } /*