From: Gustavo Lopes Date: Wed, 26 Dec 2012 00:51:45 +0000 (+0000) Subject: Make converter work on VS X-Git-Tag: php-5.5.0alpha5~58^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9d1bdaa569e0de0c36ee483784606246e106013f;p=php Make converter work on VS --- diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c index 8b578c43af..09ea609e8c 100644 --- a/ext/intl/converter/converter.c +++ b/ext/intl/converter/converter.c @@ -673,9 +673,11 @@ static zend_bool php_converter_do_convert(UConverter *dest_cnv, char **pdest, in UConverter *src_cnv, const char *src, int32_t src_len, php_converter_object *objval TSRMLS_DC) { - UErrorCode error = U_ZERO_ERROR; - int32_t dest_len; - char *dest; + UErrorCode error = U_ZERO_ERROR; + int32_t dest_len, + temp_len; + char *dest; + UChar *temp; if (!src_cnv || !dest_cnv) { php_converter_throw_failure(objval, U_INVALID_STATE_ERROR TSRMLS_CC, @@ -684,12 +686,12 @@ static zend_bool php_converter_do_convert(UConverter *dest_cnv, char **pdest, in } /* Get necessary buffer size first */ - int32_t temp_len = 1 + ucnv_toUChars(src_cnv, NULL, 0, src, src_len, &error); + temp_len = 1 + ucnv_toUChars(src_cnv, NULL, 0, src, src_len, &error); if (U_FAILURE(error) && error != U_BUFFER_OVERFLOW_ERROR) { THROW_UFAILURE(objval, "ucnv_toUChars", error); return 0; } - UChar *temp = safe_emalloc(sizeof(UChar), temp_len, sizeof(UChar)); + temp = safe_emalloc(sizeof(UChar), temp_len, sizeof(UChar)); /* Convert to intermediate UChar* array */ error = U_ZERO_ERROR; @@ -941,8 +943,10 @@ static PHP_METHOD(UConverter, getAliases) { array_init(return_value); for(i = 0; i < count; i++) { + const char *alias; + error = U_ZERO_ERROR; - const char *alias = ucnv_getAlias(name, i, &error); + alias = ucnv_getAlias(name, i, &error); if (U_FAILURE(error)) { THROW_UFAILURE(NULL, "ucnv_getAlias", error); zval_dtor(return_value);