pollita         Fri Jul 14 20:50:45 2006 UTC

  Modified files:              
    /php-src/ext/standard       file.c 
  Log:
  #38105 (4/3) ustrlen != USTRLEN, update variable names used to keep this 
block's meaning clear
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.446&r2=1.447&diff_format=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.446 php-src/ext/standard/file.c:1.447
--- php-src/ext/standard/file.c:1.446   Fri Jul 14 20:45:37 2006
+++ php-src/ext/standard/file.c Fri Jul 14 20:50:45 2006
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: file.c,v 1.446 2006/07/14 20:45:37 tony2001 Exp $ */
+/* $Id: file.c,v 1.447 2006/07/14 20:50:45 pollita Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -697,12 +697,14 @@
                case IS_UNICODE:
                        if (Z_USTRLEN_P(data)) {
                                int ustrlen = u_countChar32(Z_USTRVAL_P(data), 
Z_USTRLEN_P(data));
-                               numchars = php_stream_write_unicode(stream, 
Z_USTRVAL_P(data), Z_USTRLEN_P(data));
-                               if (numchars < 0) {
+                               int wrote_u16 = 
php_stream_write_unicode(stream, Z_USTRVAL_P(data), Z_USTRLEN_P(data));
+
+                               numchars = ustrlen;
+                               if (wrote_u16 < 0) {
                                        php_error_docref(NULL TSRMLS_CC, 
E_WARNING, "Failed to write %d characters to %s", ustrlen, filename);
                                        numchars = -1;
-                               } else if (numchars != ustrlen) {
-                                       int written_numchars = 
u_countChar32(Z_USTRVAL_P(data), numchars);
+                               } else if (wrote_u16 != Z_USTRLEN_P(data)) {
+                                       int written_numchars = 
u_countChar32(Z_USTRVAL_P(data), wrote_u16);
 
                                        php_error_docref(NULL TSRMLS_CC, 
E_WARNING, "Only %d of %d characters written, possibly out of free disk space", 
written_numchars, ustrlen);
                                        numchars = -1;

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

Reply via email to