cvs: php4 /ext/iconv iconv.c
| From: | Yasuo Ohgaki | Date: | Thu, 28 Feb 2002 03:09:02 +0000 |
| Subject: | cvs: php4 /ext/iconv iconv.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-9488@lists.php.net to get a copy of this message | ||
yohgaki Wed Feb 27 22:09:02 2002 EDT
Modified files:
/php4/ext/iconv iconv.c
Log:
Fix iconv. Patch by (itai@siftology.com)
Index: php4/ext/iconv/iconv.c
diff -u php4/ext/iconv/iconv.c:1.28 php4/ext/iconv/iconv.c:1.29
--- php4/ext/iconv/iconv.c:1.28 Wed Feb 20 10:53:25 2002
+++ php4/ext/iconv/iconv.c Wed Feb 27 22:09:01 2002
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: iconv.c,v 1.28 2002/02/20 15:53:25 derick Exp $ */
+/* $Id: iconv.c,v 1.29 2002/02/28 03:09:01 yohgaki Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -138,12 +138,12 @@
/*
FIXME: This is not the right way to get output size...
This is not space efficient for large text.
- This is also problem encoding like UTF-7/UTF-8/ISO-2022 which
+ This is also problem for encoding like UTF-7/UTF-8/ISO-2022 which
a single char can be more than 4 bytes.
I added 15 extra bytes for safety. <yohgaki@php.net>
*/
out_size = in_len * sizeof(ucs4_t) + 16;
- out_buffer = (char *) ecalloc(1, out_size);
+ out_buffer = (char *) emalloc(out_size);
*out = out_buffer;
out_p = out_buffer;
@@ -167,7 +167,7 @@
}
*out_len = out_size - out_left;
- out[*out_len] = '\0';
+ out_buffer[*out_len] = '\0';
icv_close(cd);
return SUCCESS;
@@ -193,7 +193,7 @@
if (php_iconv_string(Z_STRVAL_PP(in_buffer), Z_STRLEN_PP(in_buffer),
&out_buffer, &out_len,
Z_STRVAL_PP(in_charset), Z_STRVAL_PP(out_charset)) == SUCCESS) {
- RETVAL_STRINGL(out_buffer, out_len + 1, 0);
+ RETVAL_STRINGL(out_buffer, out_len, 0);
} else {
RETURN_FALSE;
}