com php-src: Fix unsigned comparisons and remove dead code: Zend/zend_inheritance.c Zend/zend_ini.c Zend/zend _llist.c Zend/zend_virtual_cwd.c
ext/hash/hash. c ext/standard/string.c ext/standard/uuencode.c ext/s tandard/var.c

From: Date: Fri, 17 Nov 2017 21:38:44 +0000
Subject: com php-src: Fix unsigned comparisons and remove dead code: Zend/zend_inheritance.c Zend/zend_ini.c Zend/zend _llist.c Zend/zend_virtual_cwd.c
ext/hash/hash. c ext/standard/string.c ext/standard/uuencode.c ext/s tandard/var.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-100296@lists.php.net to get a copy of this message
Commit: 80d6eb6806a6317c99a2608e28f42869c834d0e7 Author: Anatol Belski <ab@php.net> Fri, 17 Nov 2017 21:35:22 +0100 Parents: 3ce1a977d42d3e74912be381c326faf0b6126206 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=80d6eb6806a6317c99a2608e28f42869c834d0e7 Log: 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 Changed paths: M Zend/zend_inheritance.c M Zend/zend_ini.c M Zend/zend_llist.c M Zend/zend_virtual_cwd.c M ext/hash/hash.c M ext/standard/string.c M ext/standard/uuencode.c M ext/standard/var.c Diff: diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 288f9d1..c7391f9 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 bf36c1f..129c782 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 7d9b501..4dd14775 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 5f578fb..132b68f 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 9819a6e..d8e95ea 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 9211c4b..0bbff62 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 583c6c3..dbd3e84 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 60961fa..70f9ab6 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, ' '); }

« previous php.cvs (#100296) next »