cvs: php4(PHP_4_2_0) /ext/com conversion.c
| From: | Derick Rethans | Date: | Thu, 25 Apr 2002 06:37:57 +0000 |
| Subject: | cvs: php4(PHP_4_2_0) /ext/com conversion.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-11418@lists.php.net to get a copy of this message | ||
derick Thu Apr 25 02:37:57 2002 EDT
Modified files: (Branch: PHP_4_2_0)
/php4/ext/com conversion.c
Log:
- MFH: fix for bug #14353
Index: php4/ext/com/conversion.c
diff -u php4/ext/com/conversion.c:1.42.2.1 php4/ext/com/conversion.c:1.42.2.2
--- php4/ext/com/conversion.c:1.42.2.1 Thu Apr 18 06:15:31 2002
+++ php4/ext/com/conversion.c Thu Apr 25 02:37:57 2002
@@ -769,7 +769,7 @@
if (strlen == -1) {
/* request needed buffersize */
- strlen = MultiByteToWideChar(codepage, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, C_str, -1, NULL,
0);
+ strlen = MultiByteToWideChar(codepage, (codepage == CP_UTF8 ? 0 : MB_PRECOMPOSED) |
MB_ERR_INVALID_CHARS, C_str, -1, NULL, 0);
} else {
/* \0 terminator */
strlen++;
@@ -779,7 +779,7 @@
unicode_str = (OLECHAR *) emalloc(sizeof(OLECHAR) * strlen);
/* convert string */
- error = !MultiByteToWideChar(codepage, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, C_str, strlen,
unicode_str, strlen);
+ error = !MultiByteToWideChar(codepage, (codepage == CP_UTF8 ? 0 : MB_PRECOMPOSED) |
MB_ERR_INVALID_CHARS, C_str, strlen, unicode_str, strlen);
} else {
/* return a zero-length string */
unicode_str = (OLECHAR *) emalloc(sizeof(OLECHAR));
@@ -811,13 +811,13 @@
uint length = 0;
/* request needed buffersize */
- uint reqSize = WideCharToMultiByte(codepage, WC_COMPOSITECHECK, unicode_str, -1, NULL, 0, NULL,
NULL);
+ uint reqSize = WideCharToMultiByte(codepage, codepage == CP_UTF8 ? 0 : WC_COMPOSITECHECK,
unicode_str, -1, NULL, 0, NULL, NULL);
if (reqSize) {
C_str = (char *) emalloc(sizeof(char) * reqSize);
/* convert string */
- length = WideCharToMultiByte(codepage, WC_COMPOSITECHECK, unicode_str, -1, C_str, reqSize, NULL,
NULL) - 1;
+ length = WideCharToMultiByte(codepage, codepage == CP_UTF8 ? 0 : WC_COMPOSITECHECK, unicode_str,
-1, C_str, reqSize, NULL, NULL) - 1;
} else {
C_str = (char *) emalloc(sizeof(char));
*C_str = 0;