diff options
author | Anatol Belski <ab@php.net> | 2017-11-17 21:35:22 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2017-11-17 22:38:44 +0100 |
commit | 80d6eb6806a6317c99a2608e28f42869c834d0e7 (patch) | |
tree | 2b50e7efc4de4ad81d777b4d5bcc54ef4ff196e7 | |
parent | 3ce1a977d42d3e74912be381c326faf0b6126206 (diff) | |
download | php-git-80d6eb6806a6317c99a2608e28f42869c834d0e7.tar.gz |
Fix unsigned comparisons and remove dead code
Fix unsigned comparison
Cleanup never executed block
Fix unsigned comparison
Fix unsigned comparison, diff can't be < 0
Fix unsigned comparison
Fix unsigned comparison
Remove dead code
-rw-r--r-- | Zend/zend_inheritance.c | 2 | ||||
-rw-r--r-- | Zend/zend_ini.c | 7 | ||||
-rw-r--r-- | Zend/zend_llist.c | 2 | ||||
-rw-r--r-- | Zend/zend_virtual_cwd.c | 5 | ||||
-rw-r--r-- | ext/hash/hash.c | 2 | ||||
-rw-r--r-- | ext/standard/string.c | 8 | ||||
-rw-r--r-- | ext/standard/uuencode.c | 2 | ||||
-rw-r--r-- | ext/standard/var.c | 5 |
8 files changed, 14 insertions, 19 deletions
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 288f9d1670..c7391f96f7 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -1698,7 +1698,7 @@ static void zend_do_check_for_inconsistent_traits_aliasing(zend_class_entry *ce) ZEND_API void zend_do_bind_traits(zend_class_entry *ce) /* {{{ */ { - if (ce->num_traits <= 0) { + if (ce->num_traits == 0) { return; } diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index bf36c1f7b5..129c782499 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -189,7 +189,12 @@ static int ini_key_compare(const void *a, const void *b) /* {{{ */ s = (const Bucket *) b; if (!f->key && !s->key) { /* both numeric */ - return ZEND_NORMALIZE_BOOL(f->h - s->h); + if (f->h > s->h) { + return -1; + } else if (f->h < s->h) { + return 1; + } + return 0; } else if (!f->key) { /* f is numeric, s is not */ return -1; } else if (!s->key) { /* s is numeric, f is not */ diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c index 7d9b501da1..4dd14775b3 100644 --- a/Zend/zend_llist.c +++ b/Zend/zend_llist.c @@ -200,7 +200,7 @@ ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func) zend_llist_element **elements; zend_llist_element *element, **ptr; - if (l->count <= 0) { + if (l->count == 0) { return; } diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c index 5f578fb4a2..132b68f39c 100644 --- a/Zend/zend_virtual_cwd.c +++ b/Zend/zend_virtual_cwd.c @@ -155,7 +155,6 @@ typedef struct { static inline time_t FileTimeToUnixTime(const FILETIME *FileTime) { __int64 UnixTime; - long *nsec = NULL; SYSTEMTIME SystemTime; FileTimeToSystemTime(FileTime, &SystemTime); @@ -164,10 +163,6 @@ static inline time_t FileTimeToUnixTime(const FILETIME *FileTime) UnixTime -= (SECS_BETWEEN_EPOCHS * SECS_TO_100NS); - if (nsec) { - *nsec = (UnixTime % SECS_TO_100NS) * (__int64)100; - } - UnixTime /= SECS_TO_100NS; /* now convert to seconds */ if ((time_t)UnixTime != UnixTime) { diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 9819a6e7ed..d8e95ea1a0 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -357,7 +357,7 @@ static void php_hashcontext_ctor(INTERNAL_FUNCTION_PARAMETERS, zval *objval) { zval_dtor(return_value); RETURN_FALSE; } - if (!key || (ZSTR_LEN(key) <= 0)) { + if (!key || (ZSTR_LEN(key) == 0)) { /* Note: a zero length key is no key at all */ php_error_docref(NULL, E_WARNING, "HMAC requested without a key"); zval_dtor(return_value); diff --git a/ext/standard/string.c b/ext/standard/string.c index 9211c4b506..0bbff62700 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1011,7 +1011,7 @@ PHP_FUNCTION(wordwrap) laststart = lastspace = 0; for (current = 0; current < (zend_long)ZSTR_LEN(text); current++) { - if (chk <= 0) { + if (chk == 0) { alloced += (size_t) (((ZSTR_LEN(text) - current + 1)/linelength + 1) * breakchar_len) + 1; newtext = zend_string_extend(newtext, alloced, 0); chk = (size_t) ((ZSTR_LEN(text) - current)/linelength) + 1; @@ -4292,7 +4292,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) while ((!max_chars || (max_chars > 0 && char_count < max_chars)) && begin > 0) { char_count++; begin--; - if (begin <= 0 || _isnewline(heb_str[begin])) { + if (_isnewline(heb_str[begin])) { while (begin > 0 && _isnewline(heb_str[begin-1])) { begin--; char_count++; @@ -4332,7 +4332,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) } begin=orig_begin; - if (begin <= 0) { + if (begin == 0) { *target = 0; break; } @@ -4627,7 +4627,7 @@ int php_tag_find(char *tag, size_t len, const char *set) { int state=0, done=0; char *norm; - if (len <= 0) { + if (len == 0) { return 0; } diff --git a/ext/standard/uuencode.c b/ext/standard/uuencode.c index 583c6c3453..dbd3e842ad 100644 --- a/ext/standard/uuencode.c +++ b/ext/standard/uuencode.c @@ -141,7 +141,7 @@ PHPAPI zend_string *php_uudecode(char *src, size_t src_len) /* {{{ */ e = src + src_len; while (s < e) { - if ((len = PHP_UU_DEC(*s++)) <= 0) { + if ((len = PHP_UU_DEC(*s++)) == 0) { break; } /* sanity check */ diff --git a/ext/standard/var.c b/ext/standard/var.c index 60961faa39..70f9ab65f2 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -128,7 +128,6 @@ again: } count = zend_array_count(myht); php_printf("%sarray(%d) {\n", COMMON, count); - is_temp = 0; ZEND_HASH_FOREACH_KEY_VAL_IND(myht, num, key, val) { php_array_element_dump(val, num, key, level); @@ -136,10 +135,6 @@ again: if (level > 1 && !(GC_FLAGS(myht) & GC_IMMUTABLE)) { GC_UNPROTECT_RECURSION(myht); } - if (is_temp) { - zend_hash_destroy(myht); - efree(myht); - } if (level > 1) { php_printf("%*c", level-1, ' '); } |