Skip to content

Commit 949ffc0

Browse files
committed
Merge branch 'intl_size_t'
* intl_size_t: cleanup intl types
2 parents 6b20895 + 82f3d36 commit 949ffc0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+292
-303
lines changed

ext/intl/breakiterator/breakiterator_iterators.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ static void _breakiterator_parts_move_forward(zend_object_iterator *iter)
168168
* No need to do anything, the engine increments ->index */
169169

170170
const char *s = Z_STRVAL(bio->text);
171-
int32_t slen = Z_STRLEN(bio->text);
171+
size_t slen = Z_STRLEN(bio->text);
172172
zend_string *res;
173173

174174
if (next == BreakIterator::DONE) {
175-
next = slen;
175+
next = (int32_t)slen;
176176
}
177177
assert(next <= slen && next >= cur);
178178
res = zend_string_alloc(next - cur, 0);

ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
3333
{
3434
zval *object = getThis();
3535
char *rules;
36-
size_t rules_len;
36+
size_t rules_len;
3737
zend_bool compiled = 0;
3838
UErrorCode status = U_ZERO_ERROR;
3939
intl_error_reset(NULL);
@@ -123,7 +123,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rules)
123123
BREAKITER_METHOD_FETCH_OBJECT;
124124

125125
char *str;
126-
int str_len;
126+
size_t str_len;
127127
const UnicodeString rules = fetch_rbbi(bio)->getRules();
128128

129129
if (intl_charFromString(rules, &str, &str_len, BREAKITER_ERROR_CODE_P(bio)) == FAILURE)

ext/intl/collator/collator_convert.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ static void collator_convert_hash_item_from_utf8_to_utf16(
4545
UErrorCode* status )
4646
{
4747
const char* old_val;
48-
int old_val_len;
48+
size_t old_val_len;
4949
UChar* new_val = NULL;
50-
int new_val_len = 0;
51-
zval znew_val;
50+
int32_t new_val_len = 0;
51+
zval znew_val;
5252

5353
/* Process string values only. */
5454
if( Z_TYPE_P( hashData ) != IS_STRING )
@@ -86,10 +86,10 @@ static void collator_convert_hash_item_from_utf16_to_utf8(
8686
UErrorCode* status )
8787
{
8888
const char* old_val;
89-
int old_val_len;
90-
char* new_val = NULL;
91-
int new_val_len = 0;
92-
zval znew_val;
89+
size_t old_val_len;
90+
char* new_val = NULL;
91+
size_t new_val_len = 0;
92+
zval znew_val;
9393

9494
/* Process string values only. */
9595
if( Z_TYPE_P( hashData ) != IS_STRING )
@@ -105,7 +105,7 @@ static void collator_convert_hash_item_from_utf16_to_utf8(
105105
return;
106106

107107
/* Update current hash item with the converted value. */
108-
ZVAL_STRINGL( &znew_val, (char*)new_val, new_val_len);
108+
ZVAL_STRINGL( &znew_val, new_val, new_val_len);
109109
//???
110110
efree(new_val);
111111

@@ -171,7 +171,7 @@ zval* collator_convert_zstr_utf16_to_utf8( zval* utf16_zval, zval *rv )
171171
{
172172
zval* utf8_zval = NULL;
173173
char* str = NULL;
174-
int str_len = 0;
174+
size_t str_len = 0;
175175
UErrorCode status = U_ZERO_ERROR;
176176

177177
/* Convert to utf8 then. */
@@ -201,7 +201,7 @@ zval* collator_convert_zstr_utf8_to_utf16( zval* utf8_zval, zval *rv )
201201
{
202202
zval* zstr = NULL;
203203
UChar* ustr = NULL;
204-
int ustr_len = 0;
204+
int32_t ustr_len = 0;
205205
UErrorCode status = U_ZERO_ERROR;
206206

207207
/* Convert the string to UTF-16. */
@@ -230,7 +230,7 @@ zval* collator_convert_object_to_string( zval* obj, zval *rv )
230230
zval* zstr = NULL;
231231
UErrorCode status = U_ZERO_ERROR;
232232
UChar* ustr = NULL;
233-
int ustr_len = 0;
233+
int32_t ustr_len = 0;
234234

235235
/* Bail out if it's not an object. */
236236
if( Z_TYPE_P( obj ) != IS_OBJECT )

ext/intl/collator/collator_create.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
static void collator_ctor(INTERNAL_FUNCTION_PARAMETERS)
2929
{
3030
const char* locale;
31-
size_t locale_len = 0;
31+
size_t locale_len = 0;
3232
zval* object;
3333
Collator_object* co;
3434

ext/intl/collator/collator_is_numeric.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ static zend_long collator_u_strtol(nptr, endptr, base)
222222
/* {{{ collator_is_numeric]
223223
* Taken from PHP6:is_numeric_unicode()
224224
*/
225-
zend_uchar collator_is_numeric( UChar *str, int length, zend_long *lval, double *dval, int allow_errors )
225+
zend_uchar collator_is_numeric( UChar *str, int32_t length, zend_long *lval, double *dval, int allow_errors )
226226
{
227227
zend_long local_lval;
228228
double local_dval;

ext/intl/collator/collator_is_numeric.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
#include <php.h>
2222
#include <unicode/uchar.h>
2323

24-
zend_uchar collator_is_numeric( UChar *str, int length, zend_long *lval, double *dval, int allow_errors );
24+
zend_uchar collator_is_numeric( UChar *str, int32_t length, zend_long *lval, double *dval, int allow_errors );
2525

2626
#endif // COLLATOR_IS_NUMERIC_H

ext/intl/collator/collator_sort.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,9 @@ PHP_FUNCTION( collator_asort )
536536
PHP_FUNCTION( collator_get_sort_key )
537537
{
538538
char* str = NULL;
539-
size_t str_len = 0;
539+
size_t str_len = 0;
540540
UChar* ustr = NULL;
541-
int ustr_len = 0;
541+
int32_t ustr_len = 0;
542542
uint8_t* key = NULL;
543543
int key_len = 0;
544544

ext/intl/common/common_date.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ U_CFUNC TimeZone *timezone_convert_datetimezone(int type,
4343
{
4444
char *id = NULL,
4545
offset_id[] = "GMT+00:00";
46-
int id_len = 0;
46+
int32_t id_len = 0;
4747
char *message;
4848
TimeZone *timeZone;
4949

ext/intl/converter/converter.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ static void php_converter_append_fromUnicode_target(zval *val, UConverterFromUni
270270
return;
271271
case IS_STRING:
272272
{
273-
int vallen = Z_STRLEN_P(val);
273+
size_t vallen = Z_STRLEN_P(val);
274274
if (TARGET_CHECK(args, vallen)) {
275275
memcpy(args->target, Z_STRVAL_P(val), vallen);
276276
args->target += vallen;
@@ -372,7 +372,7 @@ static inline zend_bool php_converter_set_callbacks(php_converter_object *objval
372372
/* {{{ php_converter_set_encoding */
373373
static zend_bool php_converter_set_encoding(php_converter_object *objval,
374374
UConverter **pcnv,
375-
const char *enc, int enc_len
375+
const char *enc, size_t enc_len
376376
) {
377377
UErrorCode error = U_ZERO_ERROR;
378378
UConverter *cnv = ucnv_open(enc, &error);

ext/intl/dateformat/dateformat_attr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ PHP_FUNCTION( datefmt_get_pattern )
128128
PHP_FUNCTION( datefmt_set_pattern )
129129
{
130130
char* value = NULL;
131-
size_t value_len = 0;
132-
int slength = 0;
131+
size_t value_len = 0;
132+
int32_t slength = 0;
133133
UChar* svalue = NULL;
134134
zend_bool is_pattern_localized =FALSE;
135135

ext/intl/dateformat/dateformat_attrcpp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static inline DateFormat *fetch_datefmt(IntlDateFormatter_object *dfo) {
4545
U_CFUNC PHP_FUNCTION(datefmt_get_timezone_id)
4646
{
4747
char *str;
48-
int str_len;
48+
size_t str_len;
4949
DATE_FORMAT_METHOD_INIT_VARS;
5050

5151
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",

ext/intl/dateformat/dateformat_create.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,21 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
4141
zval *object;
4242

4343
const char *locale_str;
44-
size_t locale_len = 0;
44+
size_t locale_len = 0;
4545
Locale locale;
46-
zend_long date_type = 0;
47-
zend_long time_type = 0;
46+
zend_long date_type = 0;
47+
zend_long time_type = 0;
4848
zval *calendar_zv = NULL;
4949
Calendar *calendar = NULL;
50-
zend_long calendar_type;
50+
zend_long calendar_type;
5151
bool calendar_owned;
5252
zval *timezone_zv = NULL;
5353
TimeZone *timezone = NULL;
5454
bool explicit_tz;
5555
char* pattern_str = NULL;
56-
size_t pattern_str_len = 0;
56+
size_t pattern_str_len = 0;
5757
UChar* svalue = NULL; /* UTF-16 pattern_str */
58-
int slength = 0;
58+
int32_t slength = 0;
5959
IntlDateFormatter_object* dfo;
6060

6161
intl_error_reset(NULL);

ext/intl/dateformat/dateformat_data.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "intl_error.h"
2424

2525
typedef struct {
26-
// error hangling
26+
// error handling
2727
intl_error error;
2828

2929
// formatter handling

ext/intl/dateformat/dateformat_format_object.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object)
6363
zval *object,
6464
*format = NULL;
6565
const char *locale_str = NULL;
66-
size_t locale_len;
66+
size_t locale_len;
6767
bool pattern = false;
6868
UDate date;
6969
TimeZone *timeZone = NULL;
@@ -209,7 +209,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object)
209209

210210
{
211211
char *ret_str;
212-
int ret_str_len;
212+
size_t ret_str_len;
213213
UnicodeString result = UnicodeString();
214214
df->format(date, result);
215215

ext/intl/dateformat/dateformat_parse.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* if set to 1 - store any error encountered in the parameter parse_error
3535
* if set to 0 - no need to store any error encountered in the parameter parse_error
3636
*/
37-
static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, char* text_to_parse, int32_t text_len, int32_t *parse_pos, zval *return_value)
37+
static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, char* text_to_parse, size_t text_len, int32_t *parse_pos, zval *return_value)
3838
{
3939
double result = 0;
4040
UDate timestamp =0;
@@ -81,7 +81,7 @@ static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_va
8181
/* {{{
8282
* Internal function which calls the udat_parseCalendar
8383
*/
84-
static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* text_to_parse, int32_t text_len, int32_t *parse_pos, zval *return_value)
84+
static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* text_to_parse, size_t text_len, int32_t *parse_pos, zval *return_value)
8585
{
8686
UCalendar *parsed_calendar = NULL;
8787
UChar* text_utf16 = NULL;

ext/intl/formatter/formatter_attr.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ PHP_FUNCTION( numfmt_get_attribute )
102102
PHP_FUNCTION( numfmt_get_text_attribute )
103103
{
104104
zend_long attribute;
105-
UChar value_buf[64];
106-
int value_buf_size = USIZE( value_buf );
107-
UChar* value = value_buf;
108-
int length = 0;
105+
UChar value_buf[64];
106+
int32_t value_buf_size = USIZE( value_buf );
107+
UChar* value = value_buf;
108+
int32_t length = 0;
109109
FORMATTER_METHOD_INIT_VARS;
110110

111111
/* Parse parameters. */
@@ -207,7 +207,7 @@ PHP_FUNCTION( numfmt_set_attribute )
207207
*/
208208
PHP_FUNCTION( numfmt_set_text_attribute )
209209
{
210-
int slength = 0;
210+
int32_t slength = 0;
211211
UChar *svalue = NULL;
212212
zend_long attribute;
213213
char *value;
@@ -252,7 +252,7 @@ PHP_FUNCTION( numfmt_get_symbol )
252252
zend_long symbol;
253253
UChar value_buf[4];
254254
UChar *value = value_buf;
255-
int length = USIZE(value_buf);
255+
int32_t length = USIZE(value_buf);
256256
FORMATTER_METHOD_INIT_VARS;
257257

258258
/* Parse parameters. */
@@ -297,11 +297,11 @@ PHP_FUNCTION( numfmt_get_symbol )
297297
*/
298298
PHP_FUNCTION( numfmt_set_symbol )
299299
{
300-
zend_long symbol;
300+
zend_long symbol;
301301
char* value = NULL;
302-
size_t value_len = 0;
302+
size_t value_len = 0;
303303
UChar* svalue = 0;
304-
int slength = 0;
304+
int32_t slength = 0;
305305
FORMATTER_METHOD_INIT_VARS;
306306

307307
/* Parse parameters. */
@@ -344,9 +344,9 @@ PHP_FUNCTION( numfmt_set_symbol )
344344
*/
345345
PHP_FUNCTION( numfmt_get_pattern )
346346
{
347-
UChar value_buf[64];
348-
int length = USIZE( value_buf );
349-
UChar* value = value_buf;
347+
UChar value_buf[64];
348+
int32_t length = USIZE( value_buf );
349+
UChar* value = value_buf;
350350
FORMATTER_METHOD_INIT_VARS;
351351

352352
/* Parse parameters. */
@@ -388,7 +388,7 @@ PHP_FUNCTION( numfmt_set_pattern )
388388
{
389389
char* value = NULL;
390390
size_t value_len = 0;
391-
int slength = 0;
391+
int32_t slength = 0;
392392
UChar* svalue = NULL;
393393
FORMATTER_METHOD_INIT_VARS;
394394

ext/intl/formatter/formatter_format.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ PHP_FUNCTION( numfmt_format )
3636
zend_long type = FORMAT_TYPE_DEFAULT;
3737
UChar format_buf[32];
3838
UChar* formatted = format_buf;
39-
int formatted_len = USIZE(format_buf);
39+
int32_t formatted_len = USIZE(format_buf);
4040
FORMATTER_METHOD_INIT_VARS;
4141

4242
/* Parse parameters. */
@@ -139,11 +139,11 @@ PHP_FUNCTION( numfmt_format_currency )
139139
double number;
140140
UChar format_buf[32];
141141
UChar* formatted = format_buf;
142-
int formatted_len = USIZE(format_buf);
142+
int32_t formatted_len = USIZE(format_buf);
143143
char* currency = NULL;
144-
size_t currency_len = 0;
144+
size_t currency_len = 0;
145145
UChar* scurrency = NULL;
146-
int scurrency_len = 0;
146+
int32_t scurrency_len = 0;
147147
FORMATTER_METHOD_INIT_VARS;
148148

149149
/* Parse parameters. */

ext/intl/formatter/formatter_main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
2929
{
3030
const char* locale;
3131
char* pattern = NULL;
32-
size_t locale_len = 0, pattern_len = 0;
33-
zend_long style;
32+
size_t locale_len = 0, pattern_len = 0;
33+
zend_long style;
3434
UChar* spattern = NULL;
35-
int spattern_len = 0;
35+
int32_t spattern_len = 0;
3636
FORMATTER_METHOD_INIT_VARS;
3737

3838
/* Parse parameters. */

ext/intl/formatter/formatter_parse.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PHP_FUNCTION( numfmt_parse )
3838
{
3939
zend_long type = FORMAT_TYPE_DOUBLE;
4040
UChar* sstr = NULL;
41-
int sstr_len = 0;
41+
int32_t sstr_len = 0;
4242
char* str = NULL;
4343
size_t str_len;
4444
int32_t val32, position = 0;
@@ -128,9 +128,9 @@ PHP_FUNCTION( numfmt_parse_currency )
128128
double number;
129129
UChar currency[5] = {0};
130130
UChar* sstr = NULL;
131-
int sstr_len = 0;
131+
int32_t sstr_len = 0;
132132
char *currency_str = NULL;
133-
int currency_len = 0;
133+
size_t currency_len = 0;
134134
char *str;
135135
size_t str_len;
136136
int32_t* position_p = NULL;

0 commit comments

Comments
 (0)