Skip to content

Commit b4b1bf5

Browse files
committed
Address review comments
1 parent 0e8d196 commit b4b1bf5

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

Zend/zend_compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1941,7 +1941,7 @@ ZEND_API size_t zend_dirname(char *path, size_t len)
19411941
/* Note that on Win32 CWD is per drive (heritage from CP/M).
19421942
* This means dirname("c:foo") maps to "c:." or "c:" - which means CWD on C: drive.
19431943
*/
1944-
if ((2 <= len) && zend_isalpha_ascii((int)((unsigned char *)path)[0]) && (':' == path[1])) {
1944+
if ((2 <= len) && zend_isalpha_ascii(((unsigned char *)path)[0]) && (':' == path[1])) {
19451945
/* Skip over the drive spec (if any) so as not to change */
19461946
path += 2;
19471947
len_adjust += 2;

Zend/zend_operators.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ static zend_always_inline bool zend_isalpha_ascii(unsigned char c) {
421421
/* Returns true for a-z and A-Z in a locale-independent way.
422422
* This is implemented in a way that can avoid branching. Note that ASCII 'a' == 'A' | 0x20. */
423423
c = (c | 0x20) - 'a';
424-
return c <= ('z' - 'a' + 1);
424+
return c <= ('z' - 'a');
425425
}
426426
#define zend_isalnum_ascii(c) (zend_isalnum_map[(unsigned char)(c)])
427427

ext/filter/logical_filters.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,21 +520,21 @@ static int _php_filter_validate_domain(char * domain, int len, zend_long flags)
520520
}
521521

522522
/* First char must be alphanumeric */
523-
if(*s == '.' || (hostname && !zend_isalnum_ascii((int)*(unsigned char *)s))) {
523+
if(*s == '.' || (hostname && !zend_isalnum_ascii(*(unsigned char *)s))) {
524524
return 0;
525525
}
526526

527527
while (s < e) {
528528
if (*s == '.') {
529529
/* The first and the last character of a label must be alphanumeric */
530-
if (*(s + 1) == '.' || (hostname && (!zend_isalnum_ascii((int)*(unsigned char *)(s - 1)) || !zend_isalnum_ascii((int)*(unsigned char *)(s + 1))))) {
530+
if (*(s + 1) == '.' || (hostname && (!zend_isalnum_ascii(*(unsigned char *)(s - 1)) || !zend_isalnum_ascii(*(unsigned char *)(s + 1))))) {
531531
return 0;
532532
}
533533

534534
/* Reset label length counter */
535535
i = 1;
536536
} else {
537-
if (i > 63 || (hostname && *s != '-' && !zend_isalnum_ascii((int)*(unsigned char *)s))) {
537+
if (i > 63 || (hostname && *s != '-' && !zend_isalnum_ascii(*(unsigned char *)s))) {
538538
return 0;
539539
}
540540

main/fopen_wrappers.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ PHPAPI zend_string *php_resolve_path(const char *filename, size_t filename_lengt
481481
}
482482

483483
/* Don't resolve paths which contain protocol (except of file://) */
484-
for (p = filename; zend_isalnum_ascii((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++);
484+
for (p = filename; zend_isalnum_ascii(*p) || *p == '+' || *p == '-' || *p == '.'; p++);
485485
if ((*p == ':') && (p - filename > 1) && (p[1] == '/') && (p[2] == '/')) {
486486
wrapper = php_stream_locate_url_wrapper(filename, &actual_path, STREAM_OPEN_FOR_INCLUDE);
487487
if (wrapper == &php_plain_files_wrapper) {
@@ -517,7 +517,7 @@ PHPAPI zend_string *php_resolve_path(const char *filename, size_t filename_lengt
517517
/* Check for stream wrapper */
518518
int is_stream_wrapper = 0;
519519

520-
for (p = ptr; zend_isalnum_ascii((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++);
520+
for (p = ptr; zend_isalnum_ascii(*p) || *p == '+' || *p == '-' || *p == '.'; p++);
521521
if ((*p == ':') && (p - ptr > 1) && (p[1] == '/') && (p[2] == '/')) {
522522
/* .:// or ..:// is not a stream wrapper */
523523
if (p[-1] != '.' || p[-2] != '.' || p - 2 != ptr) {
@@ -586,7 +586,7 @@ PHPAPI zend_string *php_resolve_path(const char *filename, size_t filename_lengt
586586
actual_path = trypath;
587587

588588
/* Check for stream wrapper */
589-
for (p = trypath; zend_isalnum_ascii((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++);
589+
for (p = trypath; zend_isalnum_ascii(*p) || *p == '+' || *p == '-' || *p == '.'; p++);
590590
if ((*p == ':') && (p - trypath > 1) && (p[1] == '/') && (p[2] == '/')) {
591591
wrapper = php_stream_locate_url_wrapper(trypath, &actual_path, STREAM_OPEN_FOR_INCLUDE);
592592
if (!wrapper) {

main/streams/streams.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,7 +1724,7 @@ static inline int php_stream_wrapper_scheme_validate(const char *protocol, unsig
17241724
unsigned int i;
17251725

17261726
for(i = 0; i < protocol_len; i++) {
1727-
if (!zend_isalnum_ascii((int)protocol[i]) &&
1727+
if (!zend_isalnum_ascii(protocol[i]) &&
17281728
protocol[i] != '+' &&
17291729
protocol[i] != '-' &&
17301730
protocol[i] != '.') {
@@ -1804,7 +1804,7 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const
18041804
return (php_stream_wrapper*)((options & STREAM_LOCATE_WRAPPERS_ONLY) ? NULL : &php_plain_files_wrapper);
18051805
}
18061806

1807-
for (p = path; zend_isalnum_ascii((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++) {
1807+
for (p = path; zend_isalnum_ascii(*p) || *p == '+' || *p == '-' || *p == '.'; p++) {
18081808
n++;
18091809
}
18101810

main/streams/transports.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in
9393
}
9494
}
9595

96-
for (p = name; zend_isalnum_ascii((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++) {
96+
for (p = name; zend_isalnum_ascii(*p) || *p == '+' || *p == '-' || *p == '.'; p++) {
9797
n++;
9898
}
9999

0 commit comments

Comments
 (0)