dmitry Mon, 14 Mar 2011 16:00:59 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=309227
Log: Fixed multibyte related issues Changed paths: U php/php-src/trunk/Zend/tests/multibyte/multibyte_encoding_002.phpt U php/php-src/trunk/Zend/zend_language_scanner.l U php/php-src/trunk/ext/exif/exif.c U php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_ascii.c U php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_cp5022x.c U php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_cp850.c U php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_cp866.c U php/php-src/trunk/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c U php/php-src/trunk/ext/mbstring/mb_gpc.c U php/php-src/trunk/ext/mbstring/mbstring.c U php/php-src/trunk/ext/mbstring/tests/mb_encoding_aliases.phpt
Modified: php/php-src/trunk/Zend/tests/multibyte/multibyte_encoding_002.phpt =================================================================== --- php/php-src/trunk/Zend/tests/multibyte/multibyte_encoding_002.phpt 2011-03-14 14:43:16 UTC (rev 309226) +++ php/php-src/trunk/Zend/tests/multibyte/multibyte_encoding_002.phpt 2011-03-14 16:00:59 UTC (rev 309227) @@ -11,7 +11,7 @@ ?> --INI-- zend.multibyte=1 -zend.internal_encoding=iso-8859-1 +mbstring.internal_encoding=iso-8859-1 --FILE-- <?php print "Hello World\n"; Modified: php/php-src/trunk/Zend/zend_language_scanner.l =================================================================== --- php/php-src/trunk/Zend/zend_language_scanner.l 2011-03-14 14:43:16 UTC (rev 309226) +++ php/php-src/trunk/Zend/zend_language_scanner.l 2011-03-14 16:00:59 UTC (rev 309227) @@ -346,9 +346,7 @@ if (script_encoding) { /* remove BOM */ - script = (unsigned char*)emalloc(LANG_SCNG(script_org_size)+1-bom_size); - memcpy(script, LANG_SCNG(script_org)+bom_size, LANG_SCNG(script_org_size)+1-bom_size); - LANG_SCNG(script_org) = script; + LANG_SCNG(script_org) += bom_size; LANG_SCNG(script_org_size) -= bom_size; return script_encoding; Modified: php/php-src/trunk/ext/exif/exif.c =================================================================== --- php/php-src/trunk/ext/exif/exif.c 2011-03-14 14:43:16 UTC (rev 309226) +++ php/php-src/trunk/ext/exif/exif.c 2011-03-14 16:00:59 UTC (rev 309227) @@ -2664,13 +2664,13 @@ decode = ImageInfo->decode_unicode_le; } if (zend_multibyte_encoding_converter( - pszInfoPtr, + (unsigned char**)pszInfoPtr, &len, - szValuePtr, + (unsigned char*)szValuePtr, ByteCount, - ImageInfo->encode_unicode, - decode - TSRMLS_CC) != 0) { + zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC), + zend_multibyte_fetch_encoding(decode TSRMLS_CC) + TSRMLS_CC) < 0) { len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount); } return len; @@ -2684,13 +2684,13 @@ szValuePtr = szValuePtr+8; ByteCount -= 8; if (zend_multibyte_encoding_converter( - pszInfoPtr, + (unsigned char**)pszInfoPtr, &len, - szValuePtr, + (unsigned char*)szValuePtr, ByteCount, - ImageInfo->encode_jis, - ImageInfo->motorola_intel ? ImageInfo->decode_jis_be : ImageInfo->decode_jis_le - TSRMLS_CC) != 0) { + zend_multibyte_fetch_encoding(ImageInfo->encode_jis TSRMLS_CC), + zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_jis_be : ImageInfo->decode_jis_le TSRMLS_CC) + TSRMLS_CC) < 0) { len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount); } return len; @@ -2723,13 +2723,13 @@ /* Copy the comment */ if (zend_multibyte_encoding_converter( - &xp_field->value, + (unsigned char**)&xp_field->value, &xp_field->size, - szValuePtr, + (unsigned char*)szValuePtr, ByteCount, - ImageInfo->encode_unicode, - ImageInfo->motorola_intel ? ImageInfo->decode_unicode_be : ImageInfo->decode_unicode_le - TSRMLS_CC) != 0) { + zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC), + zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_unicode_be : ImageInfo->decode_unicode_le TSRMLS_CC) + TSRMLS_CC) < 0) { xp_field->size = exif_process_string_raw(&xp_field->value, szValuePtr, ByteCount); } return xp_field->size; Modified: php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_ascii.c =================================================================== --- php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_ascii.c 2011-03-14 14:43:16 UTC (rev 309226) +++ php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_ascii.c 2011-03-14 16:00:59 UTC (rev 309227) @@ -37,7 +37,7 @@ static int mbfl_filt_ident_ascii(int c, mbfl_identify_filter *filter); -static const char *mbfl_encoding_ascii_aliases[] = {"ANSI_X3.4-1968", "iso-ir-6", "ANSI_X3.4-1986", "ISO_646.irv:1991", "US-ASCII", "ISO646-US", "us", "IBM367", "cp367", "csASCII", NULL}; +static const char *mbfl_encoding_ascii_aliases[] = {"ANSI_X3.4-1968", "iso-ir-6", "ANSI_X3.4-1986", "ISO_646.irv:1991", "US-ASCII", "ISO646-US", "us", "IBM367", "IBM-367", "cp367", "csASCII", NULL}; const mbfl_encoding mbfl_encoding_ascii = { mbfl_no_encoding_ascii, Modified: php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_cp5022x.c =================================================================== --- php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_cp5022x.c 2011-03-14 14:43:16 UTC (rev 309226) +++ php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_cp5022x.c 2011-03-14 16:00:59 UTC (rev 309227) @@ -462,7 +462,7 @@ s = 0x224c; } } - if (s <= 0 || s >= 0x8080 && s < 0x10000) { + if (s <= 0 || (s >= 0x8080 && s < 0x10000)) { int i; s = -1; @@ -693,7 +693,7 @@ s = 0x224c; } } - if (s <= 0 || s >= 0x8080 && s < 0x10000) { + if (s <= 0 || (s >= 0x8080 && s < 0x10000)) { int i; s = -1; @@ -841,7 +841,7 @@ s = 0x224c; } } - if (s <= 0 || s >= 0x8080 && s < 0x10000) { + if (s <= 0 || (s >= 0x8080 && s < 0x10000)) { int i; s = -1; Modified: php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_cp850.c =================================================================== --- php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_cp850.c 2011-03-14 14:43:16 UTC (rev 309226) +++ php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_cp850.c 2011-03-14 16:00:59 UTC (rev 309227) @@ -33,7 +33,7 @@ static int mbfl_filt_ident_cp850(int c, mbfl_identify_filter *filter); -static const char *mbfl_encoding_cp850_aliases[] = {"CP850", "CP-850", "IBM-850", NULL}; +static const char *mbfl_encoding_cp850_aliases[] = {"CP850", "CP-850", "IBM850", "IBM-850", NULL}; const mbfl_encoding mbfl_encoding_cp850 = { mbfl_no_encoding_cp850, Modified: php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_cp866.c =================================================================== --- php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_cp866.c 2011-03-14 14:43:16 UTC (rev 309226) +++ php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_cp866.c 2011-03-14 16:00:59 UTC (rev 309227) @@ -37,7 +37,7 @@ static int mbfl_filt_ident_cp866(int c, mbfl_identify_filter *filter); -static const char *mbfl_encoding_cp866_aliases[] = {"CP866", "CP-866", "IBM-866", NULL}; +static const char *mbfl_encoding_cp866_aliases[] = {"CP866", "CP-866", "IBM866", "IBM-866", NULL}; const mbfl_encoding mbfl_encoding_cp866 = { mbfl_no_encoding_cp866, Modified: php/php-src/trunk/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c =================================================================== --- php/php-src/trunk/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c 2011-03-14 14:43:16 UTC (rev 309226) +++ php/php-src/trunk/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c 2011-03-14 16:00:59 UTC (rev 309227) @@ -218,7 +218,7 @@ const unsigned char *p; len = 0; - p = psrc; + p = (const unsigned char*)psrc; while (*p) { p++; len++; @@ -235,7 +235,7 @@ device->buffer = tmp; } - p = psrc; + p = (const unsigned char*)psrc; w = &device->buffer[device->pos]; device->pos += len; while (len > 0) { Modified: php/php-src/trunk/ext/mbstring/mb_gpc.c =================================================================== --- php/php-src/trunk/ext/mbstring/mb_gpc.c 2011-03-14 14:43:16 UTC (rev 309226) +++ php/php-src/trunk/ext/mbstring/mb_gpc.c 2011-03-14 16:00:59 UTC (rev 309227) @@ -282,7 +282,7 @@ if (info->report_errors) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to detect encoding"); } - from_encoding = mbfl_no_encoding_pass; + from_encoding = &mbfl_encoding_pass; } } Modified: php/php-src/trunk/ext/mbstring/mbstring.c =================================================================== --- php/php-src/trunk/ext/mbstring/mbstring.c 2011-03-14 14:43:16 UTC (rev 309226) +++ php/php-src/trunk/ext/mbstring/mbstring.c 2011-03-14 16:00:59 UTC (rev 309227) @@ -2958,7 +2958,7 @@ string.no_encoding = from_encoding->no_encoding; } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to detect character encoding"); - from_encoding = mbfl_no_encoding_pass; + from_encoding = &mbfl_encoding_pass; to_encoding = from_encoding; string.no_encoding = from_encoding->no_encoding; } @@ -3496,7 +3496,7 @@ break; } if (elistsz <= 0) { - from_encoding = mbfl_no_encoding_pass; + from_encoding = &mbfl_encoding_pass; } else if (elistsz == 1) { from_encoding = *elist; } else { @@ -3565,7 +3565,7 @@ if (!from_encoding) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to detect encoding"); - from_encoding = mbfl_no_encoding_pass; + from_encoding = &mbfl_encoding_pass; } } if (elist != NULL) { @@ -3573,7 +3573,7 @@ } /* create converter */ convd = NULL; - if (from_encoding != mbfl_no_encoding_pass) { + if (from_encoding != &mbfl_encoding_pass) { convd = mbfl_buffer_converter_new2(from_encoding, to_encoding, 0); if (convd == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create converter"); @@ -4418,6 +4418,7 @@ array_init(return_value); for (i = 0; i < n; i++) { add_next_index_string(return_value, (*entry)->name, 1); + entry++; } } } else if (!strcasecmp("substitute_character", typ)) { @@ -4693,7 +4694,7 @@ static void php_mb_gpc_set_input_encoding(const zend_encoding *encoding TSRMLS_DC) /* {{{ */ { - MBSTRG(http_input_identify) = encoding; + MBSTRG(http_input_identify) = (const mbfl_encoding*)encoding; } /* }}} */ Modified: php/php-src/trunk/ext/mbstring/tests/mb_encoding_aliases.phpt =================================================================== --- php/php-src/trunk/ext/mbstring/tests/mb_encoding_aliases.phpt 2011-03-14 14:43:16 UTC (rev 309226) +++ php/php-src/trunk/ext/mbstring/tests/mb_encoding_aliases.phpt 2011-03-14 16:00:59 UTC (rev 309227) @@ -13,26 +13,28 @@ ?> --EXPECTF-- Warning: mb_encoding_aliases() expects exactly 1 parameter, 0 given in %s on line 2 -array(10) { +array(11) { [0]=> string(14) "ANSI_X3.4-1968" [1]=> string(14) "ANSI_X3.4-1986" [2]=> + string(7) "IBM-367" + [3]=> string(6) "IBM367" - [3]=> + [4]=> string(9) "ISO646-US" - [4]=> + [5]=> string(16) "ISO_646.irv:1991" - [5]=> + [6]=> string(8) "US-ASCII" - [6]=> + [7]=> string(5) "cp367" - [7]=> + [8]=> string(7) "csASCII" - [8]=> + [9]=> string(8) "iso-ir-6" - [9]=> + [10]=> string(2) "us" } array(0) {
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php