andrei          Wed Jul 12 17:23:53 2006 UTC

  Modified files:              
    /php-src/ext/standard       var.c 
  Log:
  Use zend_convert_from_unicode() in var_dump().
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/var.c?r1=1.235&r2=1.236&diff_format=u
Index: php-src/ext/standard/var.c
diff -u php-src/ext/standard/var.c:1.235 php-src/ext/standard/var.c:1.236
--- php-src/ext/standard/var.c:1.235    Mon Jul 10 14:02:54 2006
+++ php-src/ext/standard/var.c  Wed Jul 12 17:23:53 2006
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: var.c,v 1.235 2006/07/10 14:02:54 dmitry Exp $ */
+/* $Id: var.c,v 1.236 2006/07/12 17:23:53 andrei Exp $ */
 
 
 
@@ -45,9 +45,9 @@
 static void php_var_dump_unicode(UChar *ustr, int length, int verbose, char 
*quote, int escape TSRMLS_DC)
 {
        UChar32 c;
-       int32_t i;
+       int i;
        UErrorCode status = U_ZERO_ERROR;
-       int32_t clen;
+       int clen;
        char *out = NULL;
 
        if (length == 0) {
@@ -56,16 +56,8 @@
                return;
        }
 
-       clen = length * 
ucnv_getMaxCharSize(ZEND_U_CONVERTER(UG(output_encoding_conv))) + 1;
-       while (1) {
-               status = U_ZERO_ERROR;
-               out = erealloc(out, clen+1);
-               clen = 
ucnv_fromUChars(ZEND_U_CONVERTER(UG(output_encoding_conv)), out, clen+1, ustr, 
length, &status);
-               if (status != U_BUFFER_OVERFLOW_ERROR) {
-                       break;
-               }
-       }
-       if(U_FAILURE(status) || status==U_STRING_NOT_TERMINATED_WARNING) {
+       zend_convert_from_unicode(ZEND_U_CONVERTER(UG(output_encoding_conv)), 
&out, &clen, ustr, length, &status);
+       if(U_FAILURE(status)) {
                php_printf("problem converting string from Unicode: %s\n", 
u_errorName(status));
                efree(out);
                return;

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

Reply via email to