Skip to content

Commit 02373e3

Browse files
committed
feedback
1 parent 67a6521 commit 02373e3

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

ext/intl/dateformat/dateformat_attr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ U_CFUNC PHP_FUNCTION( datefmt_set_pattern )
140140
/* {{{ Get formatter locale. */
141141
U_CFUNC PHP_FUNCTION( datefmt_get_locale )
142142
{
143-
char *loc;
143+
const char *loc;
144144
zend_long loc_type =ULOC_ACTUAL_LOCALE;
145145

146146
DATE_FORMAT_METHOD_INIT_VARS;
@@ -156,7 +156,7 @@ U_CFUNC PHP_FUNCTION( datefmt_get_locale )
156156
/* Fetch the object. */
157157
DATE_FORMAT_METHOD_FETCH_OBJECT;
158158

159-
loc = const_cast<char *>(udat_getLocaleByType(DATE_FORMAT_OBJECT(dfo), static_cast<ULocDataLocaleType>(loc_type),&INTL_DATA_ERROR_CODE(dfo)));
159+
loc = udat_getLocaleByType(DATE_FORMAT_OBJECT(dfo), static_cast<ULocDataLocaleType>(loc_type),&INTL_DATA_ERROR_CODE(dfo));
160160
INTL_METHOD_CHECK_STATUS(dfo, "Error getting locale");
161161
RETURN_STRING(loc);
162162
}

ext/intl/formatter/formatter_attr.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ extern "C" {
2727
/* {{{ Get formatter attribute value. */
2828
U_CFUNC PHP_FUNCTION( numfmt_get_attribute )
2929
{
30-
zend_long zattribute, value;
30+
zend_long lattribute, value;
3131
FORMATTER_METHOD_INIT_VARS;
3232

3333
/* Parse parameters. */
3434
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol",
35-
&object, NumberFormatter_ce_ptr, &zattribute ) == FAILURE )
35+
&object, NumberFormatter_ce_ptr, &lattribute ) == FAILURE )
3636
{
3737
RETURN_THROWS();
3838
}
3939

40-
UNumberFormatAttribute attribute = static_cast<UNumberFormatAttribute>(zattribute);
40+
UNumberFormatAttribute attribute = static_cast<UNumberFormatAttribute>(lattribute);
4141

4242
/* Fetch the object. */
4343
FORMATTER_METHOD_FETCH_OBJECT;
@@ -91,7 +91,7 @@ U_CFUNC PHP_FUNCTION( numfmt_get_attribute )
9191
/* {{{ Get formatter attribute value. */
9292
U_CFUNC PHP_FUNCTION( numfmt_get_text_attribute )
9393
{
94-
zend_long zattribute;
94+
zend_long lattribute;
9595
UChar value_buf[64];
9696
int32_t value_buf_size = USIZE( value_buf );
9797
UChar* value = value_buf;
@@ -100,15 +100,15 @@ U_CFUNC PHP_FUNCTION( numfmt_get_text_attribute )
100100

101101
/* Parse parameters. */
102102
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol",
103-
&object, NumberFormatter_ce_ptr, &zattribute ) == FAILURE )
103+
&object, NumberFormatter_ce_ptr, &lattribute ) == FAILURE )
104104
{
105105
RETURN_THROWS();
106106
}
107107

108108
/* Fetch the object. */
109109
FORMATTER_METHOD_FETCH_OBJECT;
110110

111-
UNumberFormatTextAttribute attribute = static_cast<UNumberFormatTextAttribute>(zattribute);
111+
UNumberFormatTextAttribute attribute = static_cast<UNumberFormatTextAttribute>(lattribute);
112112

113113
length = unum_getTextAttribute( FORMATTER_OBJECT(nfo), attribute, value, value_buf_size, &INTL_DATA_ERROR_CODE(nfo) );
114114
if(INTL_DATA_ERROR_CODE(nfo) == U_BUFFER_OVERFLOW_ERROR && length >= value_buf_size) {
@@ -130,21 +130,21 @@ U_CFUNC PHP_FUNCTION( numfmt_get_text_attribute )
130130
/* {{{ Get formatter attribute value. */
131131
U_CFUNC PHP_FUNCTION( numfmt_set_attribute )
132132
{
133-
zend_long zattribute;
133+
zend_long lattribute;
134134
zval *value;
135135
FORMATTER_METHOD_INIT_VARS;
136136

137137
/* Parse parameters. */
138138
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Oln",
139-
&object, NumberFormatter_ce_ptr, &zattribute, &value ) == FAILURE)
139+
&object, NumberFormatter_ce_ptr, &lattribute, &value ) == FAILURE)
140140
{
141141
RETURN_THROWS();
142142
}
143143

144144
/* Fetch the object. */
145145
FORMATTER_METHOD_FETCH_OBJECT;
146146

147-
UNumberFormatAttribute attribute = static_cast<UNumberFormatAttribute>(zattribute);
147+
UNumberFormatAttribute attribute = static_cast<UNumberFormatAttribute>(lattribute);
148148

149149
switch(attribute) {
150150
case UNUM_PARSE_INT_ONLY:
@@ -220,20 +220,20 @@ U_CFUNC PHP_FUNCTION( numfmt_set_text_attribute )
220220
/* {{{ Get formatter symbol value. */
221221
U_CFUNC PHP_FUNCTION( numfmt_get_symbol )
222222
{
223-
zend_long zsymbol;
223+
zend_long lsymbol;
224224
UChar value_buf[4];
225225
UChar *value = value_buf;
226226
uint32_t length = USIZE(value_buf);
227227
FORMATTER_METHOD_INIT_VARS;
228228

229229
/* Parse parameters. */
230230
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol",
231-
&object, NumberFormatter_ce_ptr, &zsymbol ) == FAILURE )
231+
&object, NumberFormatter_ce_ptr, &lsymbol ) == FAILURE )
232232
{
233233
RETURN_THROWS();
234234
}
235235

236-
UNumberFormatSymbol symbol = static_cast<UNumberFormatSymbol>(zsymbol);
236+
UNumberFormatSymbol symbol = static_cast<UNumberFormatSymbol>(lsymbol);
237237

238238
if(symbol >= UNUM_FORMAT_SYMBOL_COUNT || symbol < 0) {
239239
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "invalid symbol value");
@@ -263,7 +263,7 @@ U_CFUNC PHP_FUNCTION( numfmt_get_symbol )
263263
/* {{{ Set formatter symbol value. */
264264
U_CFUNC PHP_FUNCTION( numfmt_set_symbol )
265265
{
266-
zend_long zsymbol;
266+
zend_long lsymbol;
267267
char* value = NULL;
268268
size_t value_len = 0;
269269
UChar* svalue = 0;
@@ -272,12 +272,12 @@ U_CFUNC PHP_FUNCTION( numfmt_set_symbol )
272272

273273
/* Parse parameters. */
274274
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ols",
275-
&object, NumberFormatter_ce_ptr, &zsymbol, &value, &value_len ) == FAILURE )
275+
&object, NumberFormatter_ce_ptr, &lsymbol, &value, &value_len ) == FAILURE )
276276
{
277277
RETURN_THROWS();
278278
}
279279

280-
UNumberFormatSymbol symbol = static_cast<UNumberFormatSymbol>(zsymbol);
280+
UNumberFormatSymbol symbol = static_cast<UNumberFormatSymbol>(lsymbol);
281281

282282
if (symbol >= UNUM_FORMAT_SYMBOL_COUNT || symbol < 0) {
283283
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "invalid symbol value");
@@ -380,7 +380,7 @@ U_CFUNC PHP_FUNCTION( numfmt_set_pattern )
380380
U_CFUNC PHP_FUNCTION( numfmt_get_locale )
381381
{
382382
zend_long type = ULOC_ACTUAL_LOCALE;
383-
char* loc;
383+
const char* loc;
384384
FORMATTER_METHOD_INIT_VARS;
385385

386386
/* Parse parameters. */
@@ -393,7 +393,7 @@ U_CFUNC PHP_FUNCTION( numfmt_get_locale )
393393
/* Fetch the object. */
394394
FORMATTER_METHOD_FETCH_OBJECT;
395395

396-
loc = const_cast<char *>(unum_getLocaleByType(FORMATTER_OBJECT(nfo), static_cast<ULocDataLocaleType>(type), &INTL_DATA_ERROR_CODE(nfo)));
396+
loc = unum_getLocaleByType(FORMATTER_OBJECT(nfo), static_cast<ULocDataLocaleType>(type), &INTL_DATA_ERROR_CODE(nfo));
397397
INTL_METHOD_CHECK_STATUS( nfo, "Error getting locale" );
398398
RETURN_STRING(loc);
399399
}

0 commit comments

Comments
 (0)