diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp index 325ebc53682..af4f53907f3 100644 --- a/ext/intl/calendar/calendar_class.cpp +++ b/ext/intl/calendar/calendar_class.cpp @@ -209,7 +209,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp TSRMLS_DC) const char *name = debug_info_fields[i].name; int32_t res = cal->get(debug_info_fields[i].field, uec); if (U_SUCCESS(uec)) { - add_assoc_int(&zfields, name, (long)res); + add_assoc_int(&zfields, name, (php_int_t)res); } else { add_assoc_string(&zfields, name, const_cast(u_errorName(uec))); } diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index 6cd58540b8b..23fb3766047 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -1322,7 +1322,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_error_code) if (co == NULL) RETURN_FALSE; - RETURN_INT((long)CALENDAR_ERROR_CODE(co)); + RETURN_INT((php_int_t)CALENDAR_ERROR_CODE(co)); } U_CFUNC PHP_FUNCTION(intlcal_get_error_message) diff --git a/ext/intl/collator/collator_sort.c b/ext/intl/collator/collator_sort.c index 13187a41d8f..1d9c955fda8 100644 --- a/ext/intl/collator/collator_sort.c +++ b/ext/intl/collator/collator_sort.c @@ -27,7 +27,7 @@ #include "intl_convert.h" #if !defined(HAVE_PTRDIFF_T) && !defined(_PTRDIFF_T_DEFINED) -typedef long ptrdiff_t; +typedef php_int_t ptrdiff_t; #endif /** diff --git a/ext/intl/grapheme/grapheme_util.h b/ext/intl/grapheme/grapheme_util.h index 14f3f22c456..576e524b161 100644 --- a/ext/intl/grapheme/grapheme_util.h +++ b/ext/intl/grapheme/grapheme_util.h @@ -44,6 +44,6 @@ int32_t grapheme_strrpos_ascii(unsigned char *haystack, int32_t haystack_len, un UBreakIterator* grapheme_get_break_iterator(void *stack_buffer, UErrorCode *status TSRMLS_DC ); /* OUTSIDE_STRING: check if (possibly negative) long offset is outside the string with int32_t length */ -#define OUTSIDE_STRING(offset, max_len) ( offset <= INT32_MIN || offset > INT32_MAX || (offset < 0 ? -offset > (long) max_len : offset >= (long) max_len) ) +#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) ) #endif // GRAPHEME_GRAPHEME_UTIL_H diff --git a/ext/intl/msgformat/msgformat_data.h b/ext/intl/msgformat/msgformat_data.h index 51d7687a3a5..188e6580f78 100644 --- a/ext/intl/msgformat/msgformat_data.h +++ b/ext/intl/msgformat/msgformat_data.h @@ -30,7 +30,7 @@ typedef struct { // formatter handling UMessageFormat* umsgf; char* orig_format; - ulong orig_format_len; + php_uint_t orig_format_len; HashTable* arg_types; int tz_set; /* if we've already the time zone in sub-formats */ } msgformat_data; diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp index 571fab2a4d1..3be80791bad 100644 --- a/ext/intl/msgformat/msgformat_helpers.cpp +++ b/ext/intl/msgformat/msgformat_helpers.cpp @@ -112,7 +112,7 @@ static HashTable *umsg_get_numeric_types(MessageFormatter_object *mfo, for (int i = 0; i < parts_count; i++) { const Formattable::Type t = types[i]; - if (zend_hash_index_update_mem(ret, (ulong)i, (void*)&t, sizeof(t)) == NULL) { + if (zend_hash_index_update_mem(ret, (php_uint_t)i, (void*)&t, sizeof(t)) == NULL) { intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR, "Write to argument types hash table failed", 0 TSRMLS_CC); break; @@ -200,10 +200,10 @@ static HashTable *umsg_parse_format(MessageFormatter_object *mfo, "Found part with negative number", 0 TSRMLS_CC); continue; } - if ((storedType = (Formattable::Type*)zend_hash_index_find_ptr(ret, (ulong)argNumber)) == NULL) { + if ((storedType = (Formattable::Type*)zend_hash_index_find_ptr(ret, (php_uint_t)argNumber)) == NULL) { /* not found already; create new entry in HT */ Formattable::Type bogusType = Formattable::kObject; - if ((storedType = (Formattable::Type*)zend_hash_index_update_mem(ret, (ulong)argNumber, (void*)&bogusType, sizeof(bogusType))) == NULL) { + if ((storedType = (Formattable::Type*)zend_hash_index_update_mem(ret, (php_uint_t)argNumber, (void*)&bogusType, sizeof(bogusType))) == NULL) { intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR, "Write to argument types hash table failed", 0 TSRMLS_CC); continue; @@ -401,7 +401,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, /* Process key and retrieve type */ if (str_index == NULL) { /* includes case where index < 0 because it's exposed as unsigned */ - if (num_index > (ulong)INT32_MAX) { + if (num_index > (php_uint_t)INT32_MAX) { intl_errors_set(&err, U_ILLEGAL_ARGUMENT_ERROR, "Found negative or too large array key", 0 TSRMLS_CC); continue; @@ -411,7 +411,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, int32_t len = u_sprintf(temp, "%u", (uint32_t)num_index); key.append(temp, len); - storedArgType = (Formattable::Type*)zend_hash_index_find_ptr(types, (ulong)num_index); + storedArgType = (Formattable::Type*)zend_hash_index_find_ptr(types, (php_uint_t)num_index); } else { //string; assumed to be in UTF-8 intl_stringFromChar(key, str_index->val, str_index->len, &err.code); @@ -663,10 +663,10 @@ U_CFUNC void umsg_parse_helper(UMessageFormat *fmt, int *count, zval **args, UCh case Formattable::kInt64: aInt64 = fargs[i].getInt64(); - if(aInt64 > LONG_MAX || aInt64 < -LONG_MAX) { + if(aInt64 > PHP_INT_MAX || aInt64 < -PHP_INT_MAX) { ZVAL_DOUBLE(&(*args)[i], (double)aInt64); } else { - ZVAL_INT(&(*args)[i], (long)aInt64); + ZVAL_INT(&(*args)[i], (php_int_t)aInt64); } break; diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index 6c5b27aa4e2..a0651d53525 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -331,9 +331,9 @@ static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp TSRMLS_DC) return debug_info; } - ZVAL_INT(&zv, (long)rawOffset); + ZVAL_INT(&zv, (php_int_t)rawOffset); zend_hash_str_update(debug_info,"rawOffset", sizeof("rawOffset") - 1, &zv); - ZVAL_INT(&zv, (long)(rawOffset + dstOffset)); + ZVAL_INT(&zv, (php_int_t)(rawOffset + dstOffset)); zend_hash_str_update(debug_info,"currentOffset", sizeof("currentOffset") - 1, &zv); return debug_info; diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp index 9d75dc29756..4dbb6ddda30 100644 --- a/ext/intl/timezone/timezone_methods.cpp +++ b/ext/intl/timezone/timezone_methods.cpp @@ -228,7 +228,7 @@ U_CFUNC PHP_FUNCTION(intltz_count_equivalent_ids) } int32_t result = TimeZone::countEquivalentIDs(id); - RETURN_INT((long)result); + RETURN_INT((php_int_t)result); } #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48 diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 00b4969a2a8..9319645fac2 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -5267,7 +5267,7 @@ zend_function_entry phar_exception_methods[] = { /* }}} */ #define REGISTER_PHAR_CLASS_CONST_INT(class_name, const_name, value) \ - zend_declare_class_constant_int(class_name, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); + zend_declare_class_constant_int(class_name, const_name, sizeof(const_name)-1, (php_int_t)value TSRMLS_CC); #define phar_exception_get_default() zend_exception_get_default(TSRMLS_C)