mirror of
https://github.com/php/php-src.git
synced 2024-11-25 10:54:15 +08:00
yet trivial fixes
This commit is contained in:
parent
6d54e89916
commit
888ef26cc5
@ -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<char*>(u_errorName(uec)));
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user