]> granicus.if.org Git - php/commitdiff
Fix some sign-related issues in comparisons
authorjvoisin <julien.voisin@dustri.org>
Tue, 8 Jan 2019 21:08:40 +0000 (22:08 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 9 Jan 2019 09:01:12 +0000 (10:01 +0100)
Zend/zend_opcode.c
Zend/zend_string.c
ext/hash/hash.c
ext/opcache/zend_file_cache.c
ext/opcache/zend_persist.c
ext/phar/tar.c
ext/reflection/php_reflection.c

index dbe2b5c20b5209780ae7bc337aea716a2a9e01be..6ec0e2d1c88195d6dc05f68ad723295aaae9e532 100644 (file)
@@ -187,7 +187,7 @@ static void _destroy_zend_class_traits_info(zend_class_entry *ce)
        }
 
        if (ce->trait_precedences) {
-               int j;
+               uint32_t j;
 
                i = 0;
                while (ce->trait_precedences[i]) {
index c628b9a4c7dbf6dca4a5264cbb0cf42f96e6726e..b81d5f1a73db513b6e5e394c12eb786d5c38f5e7 100644 (file)
@@ -76,7 +76,7 @@ static void zend_init_interned_strings_ht(HashTable *interned_strings, int perma
 ZEND_API void zend_interned_strings_init(void)
 {
        char s[2];
-       int i;
+       unsigned int i;
        zend_string *str;
 
        interned_string_request_handler = zend_new_interned_string_request;
index 66b39a8a804aeb20244e48df0f207f2251a526b6..d89f12965bc401db361443cddb7d48a93f5263a0 100644 (file)
@@ -195,14 +195,14 @@ PHP_FUNCTION(hash_file)
 /* }}} */
 
 static inline void php_hash_string_xor_char(unsigned char *out, const unsigned char *in, const unsigned char xor_with, const size_t length) {
-       int i;
+       size_t i;
        for (i=0; i < length; i++) {
                out[i] = in[i] ^ xor_with;
        }
 }
 
 static inline void php_hash_string_xor(unsigned char *out, const unsigned char *in, const unsigned char *xor_with, const size_t length) {
-       int i;
+       size_t i;
        for (i=0; i < length; i++) {
                out[i] = in[i] ^ xor_with[i];
        }
@@ -614,7 +614,7 @@ PHP_FUNCTION(hash_hkdf)
        zend_string *returnval, *ikm, *algo, *info = NULL, *salt = NULL;
        zend_long length = 0;
        unsigned char *prk, *digest, *K;
-       int i;
+       size_t i;
        size_t rounds;
        const php_hash_ops *ops;
        void *context;
index fddcd5dcd4c71693e1a82256f90aacb557cf8ebb..86cb8a2e259d66f88e0afd26c51c1bdd6d0ed2f8 100644 (file)
@@ -717,7 +717,7 @@ static void zend_file_cache_serialize_class(zval                     *zv,
 
                if (ce->trait_precedences) {
                        zend_trait_precedence **p, *q;
-                       int j;
+                       uint32_t j;
 
                        SERIALIZE_PTR(ce->trait_precedences);
                        p = ce->trait_precedences;
@@ -1373,7 +1373,7 @@ static void zend_file_cache_unserialize_class(zval                    *zv,
 
                if (ce->trait_precedences) {
                        zend_trait_precedence **p, *q;
-                       int j;
+                       uint32_t j;
 
                        UNSERIALIZE_PTR(ce->trait_precedences);
                        p = ce->trait_precedences;
index 139c0312313d39dcdb738df6bc63954306744e6c..eba9dd23e4d6120a7dd25d9ed34a6759fdca55f1 100644 (file)
@@ -896,7 +896,7 @@ static void zend_persist_class_entry(zval *zv)
                        }
 
                        if (ce->trait_precedences) {
-                               int j;
+                               uint32_t j;
 
                                i = 0;
                                while (ce->trait_precedences[i]) {
index 5b5b796ffe6649c0cf430f7eddf7a89bbf9b5416..bce66f0c3b1ade16f83676f4661af21c55e5516f 100644 (file)
@@ -22,7 +22,7 @@
 static uint32_t phar_tar_number(char *buf, size_t len) /* {{{ */
 {
        uint32_t num = 0;
-       int i = 0;
+       size_t i = 0;
 
        while (i < len && buf[i] == ' ') {
                ++i;
index 9748594fa501c4dc64d9be9760541ce9f6692973..105a87da8b30fa7c254e49955995e4d12076c6cf 100644 (file)
@@ -2403,7 +2403,7 @@ ZEND_METHOD(reflection_parameter, __construct)
        ref = (parameter_reference*) emalloc(sizeof(parameter_reference));
        ref->arg_info = &arg_info[position];
        ref->offset = (uint32_t)position;
-       ref->required = position < fptr->common.required_num_args;
+       ref->required = (uint32_t)position < fptr->common.required_num_args;
        ref->fptr = fptr;
        /* TODO: copy fptr */
        intern->ptr = ref;