yet trivial fixes

This commit is contained in:
Anatol Belski 2014-08-20 22:54:00 +02:00
parent 6d54e89916
commit 888ef26cc5
9 changed files with 16 additions and 16 deletions

View file

@ -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;