moriyoshi               Tue Feb 18 10:15:22 2003 EDT

  Modified files:              
    /php4/ext/standard  file.c 
  Log:
  Fixed bug #21689 (fgetcsv suppresses some characters before a separator)
  The fix is suggested by Masahiro Nakayama <[EMAIL PROTECTED]>
  
  # is* functions expect their argument to be an integer in range of 0-255
  
  
  
Index: php4/ext/standard/file.c
diff -u php4/ext/standard/file.c:1.306 php4/ext/standard/file.c:1.307
--- php4/ext/standard/file.c:1.306      Mon Feb 17 21:53:24 2003
+++ php4/ext/standard/file.c    Tue Feb 18 10:15:22 2003
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: file.c,v 1.306 2003/02/18 02:53:24 pollita Exp $ */
+/* $Id: file.c,v 1.307 2003/02/18 15:15:22 moriyoshi Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -2529,7 +2529,7 @@
        lineEnd = emalloc(len + 1);
        bptr = buf;
        tptr = buf + strlen(buf) -1;
-       while ( isspace((int) *tptr) && (*tptr!=delimiter) && (tptr > bptr) ) tptr--;
+       while ( isspace((int)*(unsigned char *)tptr) && (*tptr!=delimiter) && (tptr > 
+bptr) ) tptr--;
        tptr++;
        strcpy(lineEnd, tptr);
 
@@ -2551,7 +2551,7 @@
 
        do {
                /* 1. Strip any leading space */
-               while(isspace((int) *bptr) && (*bptr!=delimiter)) bptr++;
+               while(isspace((int)*(unsigned char *)bptr) && (*bptr!=delimiter)) 
+bptr++;
                /* 2. Read field, leaving bptr pointing at start of next field */
                if (enclosure && *bptr == enclosure) {
                        bptr++; /* move on to first character in field */
@@ -2600,7 +2600,7 @@
                                                temp = erealloc(temp, temp_len+1);
                                                bptr = buf;
                                                tptr = buf + strlen(buf) -1;
-                                               while (isspace((int) *tptr) && 
(*tptr!=delimiter) && (tptr > bptr)) 
+                                               while (isspace((int)*(unsigned char 
+*)tptr) && (*tptr!=delimiter) && (tptr > bptr)) 
                                                        tptr--;
                                                tptr++; 
                                                strcpy(lineEnd, tptr);
@@ -2621,7 +2621,7 @@
 
                        if (strlen(temp)) {
                                tptr--;
-                               while (isspace((int)*tptr) && (*tptr!=delimiter)) 
+                               while (isspace((int)*(unsigned char *)tptr) && 
+(*tptr!=delimiter)) 
                                        *tptr-- = 0;    /* strip any trailing spaces */
                        }
                        



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to