]> granicus.if.org Git - php/commitdiff
Fix datatypes and compiler warnings
authorAnatol Belski <ab@php.net>
Sun, 22 Oct 2017 17:58:42 +0000 (19:58 +0200)
committerAnatol Belski <ab@php.net>
Mon, 23 Oct 2017 06:56:57 +0000 (08:56 +0200)
Switch to size_t

Not critical as an unsigned is already used, but fixes a couple of
warnings in other areas.

Normalize signature

It's a function with the usual compare semantics, returning a platform
specific at least produces unnecessary warnings elsewhere and is otherwise
inappropriate.

Fix return value

Drop unused var

Fix compiler warnings

Fix compiler warning

Fix var name in arginfo

Fix cast

Zend/zend_ini.c
Zend/zend_ini.h
Zend/zend_operators.c
Zend/zend_operators.h
ext/intl/spoofchecker/spoofchecker_class.c
ext/standard/array.c

index b9212d6d8b750ad4fe3cebc9bbb6962e8fb284b2..f585bba2d2a66ce7f0e0edbc55b6398c93b11a8c 100644 (file)
@@ -418,7 +418,7 @@ ZEND_API int zend_ini_register_displayer(char *name, uint32_t name_length, void
  * Data retrieval
  */
 
-ZEND_API zend_long zend_ini_long(char *name, uint32_t name_length, int orig) /* {{{ */
+ZEND_API zend_long zend_ini_long(char *name, size_t name_length, int orig) /* {{{ */
 {
        zend_ini_entry *ini_entry;
 
@@ -435,7 +435,7 @@ ZEND_API zend_long zend_ini_long(char *name, uint32_t name_length, int orig) /*
 }
 /* }}} */
 
-ZEND_API double zend_ini_double(char *name, uint32_t name_length, int orig) /* {{{ */
+ZEND_API double zend_ini_double(char *name, size_t name_length, int orig) /* {{{ */
 {
        zend_ini_entry *ini_entry;
 
@@ -452,7 +452,7 @@ ZEND_API double zend_ini_double(char *name, uint32_t name_length, int orig) /* {
 }
 /* }}} */
 
-ZEND_API char *zend_ini_string_ex(char *name, uint32_t name_length, int orig, zend_bool *exists) /* {{{ */
+ZEND_API char *zend_ini_string_ex(char *name, size_t name_length, int orig, zend_bool *exists) /* {{{ */
 {
        zend_ini_entry *ini_entry;
 
@@ -476,7 +476,7 @@ ZEND_API char *zend_ini_string_ex(char *name, uint32_t name_length, int orig, ze
 }
 /* }}} */
 
-ZEND_API char *zend_ini_string(char *name, uint32_t name_length, int orig) /* {{{ */
+ZEND_API char *zend_ini_string(char *name, size_t name_length, int orig) /* {{{ */
 {
        zend_bool exists = 1;
        char *return_value;
index 7c4fa39025b6be06d77741d15035e92ba34ae6bb..620b3013c41865ee462a375245f356e1ac65f060 100644 (file)
@@ -83,10 +83,10 @@ ZEND_API int zend_alter_ini_entry_chars_ex(zend_string *name, const char *value,
 ZEND_API int zend_restore_ini_entry(zend_string *name, int stage);
 ZEND_API void display_ini_entries(zend_module_entry *module);
 
-ZEND_API zend_long zend_ini_long(char *name, uint32_t name_length, int orig);
-ZEND_API double zend_ini_double(char *name, uint32_t name_length, int orig);
-ZEND_API char *zend_ini_string(char *name, uint32_t name_length, int orig);
-ZEND_API char *zend_ini_string_ex(char *name, uint32_t name_length, int orig, zend_bool *exists);
+ZEND_API zend_long zend_ini_long(char *name, size_t name_length, int orig);
+ZEND_API double zend_ini_double(char *name, size_t name_length, int orig);
+ZEND_API char *zend_ini_string(char *name, size_t name_length, int orig);
+ZEND_API char *zend_ini_string_ex(char *name, size_t name_length, int orig, zend_bool *exists);
 
 ZEND_API int zend_ini_register_displayer(char *name, uint32_t name_length, void (*displayer)(zend_ini_entry *ini_entry, int type));
 
index 8a20d1ca28c69dc3ee18839e487c74493c93487b..fe6f97b12c324fc9c85a251614956acb817be8be 100644 (file)
@@ -2757,7 +2757,7 @@ ZEND_API int ZEND_FASTCALL zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval
 }
 /* }}} */
 
-ZEND_API zend_long ZEND_FASTCALL zendi_smart_strcmp(zend_string *s1, zend_string *s2) /* {{{ */
+ZEND_API int ZEND_FASTCALL zendi_smart_strcmp(zend_string *s1, zend_string *s2) /* {{{ */
 {
        int ret1, ret2;
        int oflow1, oflow2;
index b6e16c343079aed178a463c8dd01170d9f3b6cef..e11d2551f52ff425d3645ef5479dc7bc1972e51c 100644 (file)
@@ -361,7 +361,7 @@ ZEND_API int ZEND_FASTCALL zend_binary_strncasecmp(const char *s1, size_t len1,
 ZEND_API int ZEND_FASTCALL zend_binary_strcasecmp_l(const char *s1, size_t len1, const char *s2, size_t len2);
 ZEND_API int ZEND_FASTCALL zend_binary_strncasecmp_l(const char *s1, size_t len1, const char *s2, size_t len2, size_t length);
 
-ZEND_API zend_long ZEND_FASTCALL zendi_smart_strcmp(zend_string *s1, zend_string *s2);
+ZEND_API int ZEND_FASTCALL zendi_smart_strcmp(zend_string *s1, zend_string *s2);
 ZEND_API int ZEND_FASTCALL zend_compare_symbol_tables(HashTable *ht1, HashTable *ht2);
 ZEND_API int ZEND_FASTCALL zend_compare_arrays(zval *a1, zval *a2);
 ZEND_API int ZEND_FASTCALL zend_compare_objects(zval *o1, zval *o2);
index 2b6929029502032e75c63e076080280fd2056a9c..70ac89db7beb38016cf762be85f9e6385fc4f1ea 100644 (file)
@@ -85,7 +85,7 @@ ZEND_BEGIN_ARG_INFO_EX(spoofchecker_are_confusable, 0, 0, 2)
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO_EX(spoofchecker_set_restriction_level, 0, 0, 1)
-       ZEND_ARG_INFO(0, checks)
+       ZEND_ARG_INFO(0, level)
 ZEND_END_ARG_INFO()
 
 /* }}} */
index 50ca1d2c40bba4083c7a5810236243da8ec8899a..3d4c153f12712a664687935038a6d9204d5934d8 100644 (file)
@@ -394,7 +394,7 @@ static int php_array_data_compare(const void *a, const void *b) /* {{{ */
        }
 
        ZEND_ASSERT(Z_TYPE(result) == IS_LONG);
-       return Z_LVAL(result);
+       return ZEND_NORMALIZE_BOOL(Z_LVAL(result));
 }
 /* }}} */
 
@@ -779,7 +779,6 @@ PHP_FUNCTION(count)
        zval *array;
        zend_long mode = COUNT_NORMAL;
        zend_long cnt;
-       zval *element;
 
        ZEND_PARSE_PARAMETERS_START(1, 2)
                Z_PARAM_ZVAL(array)
@@ -2654,13 +2653,13 @@ PHP_FUNCTION(array_fill)
 
                        array_init_size(return_value, (uint32_t)(start_key + num));
                        zend_hash_real_init(Z_ARRVAL_P(return_value), 1);
-                       Z_ARRVAL_P(return_value)->nNumUsed = start_key + num;
-                       Z_ARRVAL_P(return_value)->nNumOfElements = num;
-                       Z_ARRVAL_P(return_value)->nInternalPointer = start_key;
-                       Z_ARRVAL_P(return_value)->nNextFreeElement = start_key + num;
+                       Z_ARRVAL_P(return_value)->nNumUsed = (uint32_t)(start_key + num);
+                       Z_ARRVAL_P(return_value)->nNumOfElements = (uint32_t)num;
+                       Z_ARRVAL_P(return_value)->nInternalPointer = (uint32_t)start_key;
+                       Z_ARRVAL_P(return_value)->nNextFreeElement = (zend_long)(start_key + num);
 
                        if (Z_REFCOUNTED_P(val)) {
-                               GC_REFCOUNT(Z_COUNTED_P(val)) += num;
+                               GC_REFCOUNT(Z_COUNTED_P(val)) += (uint32_t)num;
                        }
 
                        p = Z_ARRVAL_P(return_value)->arData;
@@ -2681,7 +2680,7 @@ PHP_FUNCTION(array_fill)
                        array_init_size(return_value, (uint32_t)num);
                        zend_hash_real_init(Z_ARRVAL_P(return_value), 0);
                        if (Z_REFCOUNTED_P(val)) {
-                               GC_REFCOUNT(Z_COUNTED_P(val)) += num;
+                               GC_REFCOUNT(Z_COUNTED_P(val)) += (uint32_t)num;
                        }
                        zend_hash_index_add_new(Z_ARRVAL_P(return_value), start_key, val);
                        while (--num) {
@@ -2949,7 +2948,7 @@ static void php_array_data_shuffle(zval *array) /* {{{ */
        Bucket *p, temp;
        HashTable *hash;
        zend_long rnd_idx;
-       zend_long n_left;
+       uint32_t n_left;
 
        n_elems = zend_hash_num_elements(Z_ARRVAL_P(array));