/ Check-in [d5db8be3]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Avoid passing a negative value to isspace() in a couple places. (CVS 4016)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d5db8be3680e16a74edb385dfa3730c66d5f4fd6
User & Date: danielk1977 2007-05-16 17:50:46
Context
2007-05-16
18:11
Fix handling of utf-16 encoding of code point 0xE000. (CVS 4017) check-in: bfc35ce8 user: danielk1977 tags: trunk
17:50
Avoid passing a negative value to isspace() in a couple places. (CVS 4016) check-in: d5db8be3 user: danielk1977 tags: trunk
17:28
Change a few selected functions to macros to speed things up. (CVS 4015) check-in: 93f811ec user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/util.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** Utility functions used throughout sqlite.
    13     13   **
    14     14   ** This file contains functions for allocating memory, comparing
    15     15   ** strings, and stuff like that.
    16     16   **
    17         -** $Id: util.c,v 1.204 2007/05/16 17:28:43 danielk1977 Exp $
           17  +** $Id: util.c,v 1.205 2007/05/16 17:50:46 danielk1977 Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include "os.h"
    21     21   #include <stdarg.h>
    22     22   #include <ctype.h>
    23     23   
    24     24   
................................................................................
   242    242   ** for SQL.  So this routine always uses "." regardless of locale.
   243    243   */
   244    244   int sqlite3AtoF(const char *z, double *pResult){
   245    245   #ifndef SQLITE_OMIT_FLOATING_POINT
   246    246     int sign = 1;
   247    247     const char *zBegin = z;
   248    248     LONGDOUBLE_TYPE v1 = 0.0;
   249         -  while( isspace(*z) ) z++;
          249  +  while( isspace(*(u8*)z) ) z++;
   250    250     if( *z=='-' ){
   251    251       sign = -1;
   252    252       z++;
   253    253     }else if( *z=='+' ){
   254    254       z++;
   255    255     }
   256    256     while( isdigit(*(u8*)z) ){
................................................................................
   310    310   ** 32-bit numbers.  At that time, it was much faster than the
   311    311   ** atoi() library routine in RedHat 7.2.
   312    312   */
   313    313   int sqlite3Atoi64(const char *zNum, i64 *pNum){
   314    314     i64 v = 0;
   315    315     int neg;
   316    316     int i, c;
   317         -  while( isspace(*zNum) ) zNum++;
          317  +  while( isspace(*(u8*)zNum) ) zNum++;
   318    318     if( *zNum=='-' ){
   319    319       neg = 1;
   320    320       zNum++;
   321    321     }else if( *zNum=='+' ){
   322    322       neg = 0;
   323    323       zNum++;
   324    324     }else{

Changes to src/vdbeaux.c.

   786    786     VdbeOp *pOp;
   787    787     if( sqlite3_io_trace==0 ) return;
   788    788     if( nOp<1 ) return;
   789    789     pOp = &p->aOp[nOp-1];
   790    790     if( pOp->opcode==OP_Noop && pOp->p3!=0 ){
   791    791       char *z = sqlite3StrDup(pOp->p3);
   792    792       int i, j;
   793         -    for(i=0; isspace(z[i]); i++){}
          793  +    for(i=0; isspace((unsigned char)z[i]); i++){}
   794    794       for(j=0; z[i]; i++){
   795         -      if( isspace(z[i]) ){
          795  +      if( isspace((unsigned char)z[i]) ){
   796    796           if( z[i-1]!=' ' ){
   797    797             z[j++] = ' ';
   798    798           }
   799    799         }else{
   800    800           z[j++] = z[i];
   801    801         }
   802    802       }