Skip to content

Commit 888ef26

Browse files
committed
yet trivial fixes
1 parent 6d54e89 commit 888ef26

File tree

9 files changed

+16
-16
lines changed

9 files changed

+16
-16
lines changed

ext/intl/calendar/calendar_class.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp TSRMLS_DC)
209209
const char *name = debug_info_fields[i].name;
210210
int32_t res = cal->get(debug_info_fields[i].field, uec);
211211
if (U_SUCCESS(uec)) {
212-
add_assoc_int(&zfields, name, (long)res);
212+
add_assoc_int(&zfields, name, (php_int_t)res);
213213
} else {
214214
add_assoc_string(&zfields, name, const_cast<char*>(u_errorName(uec)));
215215
}

ext/intl/calendar/calendar_methods.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_error_code)
13221322
if (co == NULL)
13231323
RETURN_FALSE;
13241324

1325-
RETURN_INT((long)CALENDAR_ERROR_CODE(co));
1325+
RETURN_INT((php_int_t)CALENDAR_ERROR_CODE(co));
13261326
}
13271327

13281328
U_CFUNC PHP_FUNCTION(intlcal_get_error_message)

ext/intl/collator/collator_sort.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "intl_convert.h"
2828

2929
#if !defined(HAVE_PTRDIFF_T) && !defined(_PTRDIFF_T_DEFINED)
30-
typedef long ptrdiff_t;
30+
typedef php_int_t ptrdiff_t;
3131
#endif
3232

3333
/**

ext/intl/grapheme/grapheme_util.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ int32_t grapheme_strrpos_ascii(unsigned char *haystack, int32_t haystack_len, un
4444
UBreakIterator* grapheme_get_break_iterator(void *stack_buffer, UErrorCode *status TSRMLS_DC );
4545

4646
/* OUTSIDE_STRING: check if (possibly negative) long offset is outside the string with int32_t length */
47-
#define OUTSIDE_STRING(offset, max_len) ( offset <= INT32_MIN || offset > INT32_MAX || (offset < 0 ? -offset > (long) max_len : offset >= (long) max_len) )
47+
#define OUTSIDE_STRING(offset, max_len) ( offset <= INT32_MIN || offset > INT32_MAX || (offset < 0 ? -offset > (php_int_t) max_len : offset >= (php_int_t) max_len) )
4848

4949
#endif // GRAPHEME_GRAPHEME_UTIL_H

ext/intl/msgformat/msgformat_data.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ typedef struct {
3030
// formatter handling
3131
UMessageFormat* umsgf;
3232
char* orig_format;
33-
ulong orig_format_len;
33+
php_uint_t orig_format_len;
3434
HashTable* arg_types;
3535
int tz_set; /* if we've already the time zone in sub-formats */
3636
} msgformat_data;

ext/intl/msgformat/msgformat_helpers.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static HashTable *umsg_get_numeric_types(MessageFormatter_object *mfo,
112112

113113
for (int i = 0; i < parts_count; i++) {
114114
const Formattable::Type t = types[i];
115-
if (zend_hash_index_update_mem(ret, (ulong)i, (void*)&t, sizeof(t)) == NULL) {
115+
if (zend_hash_index_update_mem(ret, (php_uint_t)i, (void*)&t, sizeof(t)) == NULL) {
116116
intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR,
117117
"Write to argument types hash table failed", 0 TSRMLS_CC);
118118
break;
@@ -200,10 +200,10 @@ static HashTable *umsg_parse_format(MessageFormatter_object *mfo,
200200
"Found part with negative number", 0 TSRMLS_CC);
201201
continue;
202202
}
203-
if ((storedType = (Formattable::Type*)zend_hash_index_find_ptr(ret, (ulong)argNumber)) == NULL) {
203+
if ((storedType = (Formattable::Type*)zend_hash_index_find_ptr(ret, (php_uint_t)argNumber)) == NULL) {
204204
/* not found already; create new entry in HT */
205205
Formattable::Type bogusType = Formattable::kObject;
206-
if ((storedType = (Formattable::Type*)zend_hash_index_update_mem(ret, (ulong)argNumber, (void*)&bogusType, sizeof(bogusType))) == NULL) {
206+
if ((storedType = (Formattable::Type*)zend_hash_index_update_mem(ret, (php_uint_t)argNumber, (void*)&bogusType, sizeof(bogusType))) == NULL) {
207207
intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR,
208208
"Write to argument types hash table failed", 0 TSRMLS_CC);
209209
continue;
@@ -401,7 +401,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
401401
/* Process key and retrieve type */
402402
if (str_index == NULL) {
403403
/* includes case where index < 0 because it's exposed as unsigned */
404-
if (num_index > (ulong)INT32_MAX) {
404+
if (num_index > (php_uint_t)INT32_MAX) {
405405
intl_errors_set(&err, U_ILLEGAL_ARGUMENT_ERROR,
406406
"Found negative or too large array key", 0 TSRMLS_CC);
407407
continue;
@@ -411,7 +411,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
411411
int32_t len = u_sprintf(temp, "%u", (uint32_t)num_index);
412412
key.append(temp, len);
413413

414-
storedArgType = (Formattable::Type*)zend_hash_index_find_ptr(types, (ulong)num_index);
414+
storedArgType = (Formattable::Type*)zend_hash_index_find_ptr(types, (php_uint_t)num_index);
415415
} else { //string; assumed to be in UTF-8
416416
intl_stringFromChar(key, str_index->val, str_index->len, &err.code);
417417

@@ -663,10 +663,10 @@ U_CFUNC void umsg_parse_helper(UMessageFormat *fmt, int *count, zval **args, UCh
663663

664664
case Formattable::kInt64:
665665
aInt64 = fargs[i].getInt64();
666-
if(aInt64 > LONG_MAX || aInt64 < -LONG_MAX) {
666+
if(aInt64 > PHP_INT_MAX || aInt64 < -PHP_INT_MAX) {
667667
ZVAL_DOUBLE(&(*args)[i], (double)aInt64);
668668
} else {
669-
ZVAL_INT(&(*args)[i], (long)aInt64);
669+
ZVAL_INT(&(*args)[i], (php_int_t)aInt64);
670670
}
671671
break;
672672

ext/intl/timezone/timezone_class.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,9 @@ static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp TSRMLS_DC)
331331
return debug_info;
332332
}
333333

334-
ZVAL_INT(&zv, (long)rawOffset);
334+
ZVAL_INT(&zv, (php_int_t)rawOffset);
335335
zend_hash_str_update(debug_info,"rawOffset", sizeof("rawOffset") - 1, &zv);
336-
ZVAL_INT(&zv, (long)(rawOffset + dstOffset));
336+
ZVAL_INT(&zv, (php_int_t)(rawOffset + dstOffset));
337337
zend_hash_str_update(debug_info,"currentOffset", sizeof("currentOffset") - 1, &zv);
338338

339339
return debug_info;

ext/intl/timezone/timezone_methods.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ U_CFUNC PHP_FUNCTION(intltz_count_equivalent_ids)
228228
}
229229

230230
int32_t result = TimeZone::countEquivalentIDs(id);
231-
RETURN_INT((long)result);
231+
RETURN_INT((php_int_t)result);
232232
}
233233

234234
#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48

ext/phar/phar_object.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -5267,7 +5267,7 @@ zend_function_entry phar_exception_methods[] = {
52675267
/* }}} */
52685268

52695269
#define REGISTER_PHAR_CLASS_CONST_INT(class_name, const_name, value) \
5270-
zend_declare_class_constant_int(class_name, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC);
5270+
zend_declare_class_constant_int(class_name, const_name, sizeof(const_name)-1, (php_int_t)value TSRMLS_CC);
52715271

52725272
#define phar_exception_get_default() zend_exception_get_default(TSRMLS_C)
52735273

0 commit comments

Comments
 (0)