Lines Matching refs:str

92 static int _php_filter_validate_ipv6(char *str, size_t str_len, int ip[8]);
94 static int php_filter_parse_int(const char *str, size_t str_len, zend_long *ret) { /* {{{ */ in php_filter_parse_int() argument
97 const char *end = str + str_len; in php_filter_parse_int()
99 switch (*str) { in php_filter_parse_int()
104 str++; in php_filter_parse_int()
109 if (*str == '0' && str + 1 == end) { in php_filter_parse_int()
115 if (str < end && *str >= '1' && *str <= '9') { in php_filter_parse_int()
116 ctx_value = ((sign)?-1:1) * ((*(str++)) - '0'); in php_filter_parse_int()
121 if ((end - str > MAX_LENGTH_OF_LONG - 1) /* number too long */ in php_filter_parse_int()
122 || (SIZEOF_LONG == 4 && (end - str == MAX_LENGTH_OF_LONG - 1) && *str > '2')) { in php_filter_parse_int()
127 while (str < end) { in php_filter_parse_int()
128 if (*str >= '0' && *str <= '9') { in php_filter_parse_int()
129 digit = (*(str++) - '0'); in php_filter_parse_int()
147 static int php_filter_parse_octal(const char *str, size_t str_len, zend_long *ret) { /* {{{ */ in php_filter_parse_octal() argument
149 const char *end = str + str_len; in php_filter_parse_octal()
151 while (str < end) { in php_filter_parse_octal()
152 if (*str >= '0' && *str <= '7') { in php_filter_parse_octal()
153 zend_ulong n = ((*(str++)) - '0'); in php_filter_parse_octal()
170 static int php_filter_parse_hex(const char *str, size_t str_len, zend_long *ret) { /* {{{ */ in php_filter_parse_hex() argument
172 const char *end = str + str_len; in php_filter_parse_hex()
175 while (str < end) { in php_filter_parse_hex()
176 if (*str >= '0' && *str <= '9') { in php_filter_parse_hex()
177 n = ((*(str++)) - '0'); in php_filter_parse_hex()
178 } else if (*str >= 'a' && *str <= 'f') { in php_filter_parse_hex()
179 n = ((*(str++)) - ('a' - 10)); in php_filter_parse_hex()
180 } else if (*str >= 'A' && *str <= 'F') { in php_filter_parse_hex()
181 n = ((*(str++)) - ('A' - 10)); in php_filter_parse_hex()
275 char *str = Z_STRVAL_P(value); in php_filter_boolean() local
279 PHP_FILTER_TRIM_DEFAULT_EX(str, len, 0); in php_filter_boolean()
289 if (*str == '1') { in php_filter_boolean()
291 } else if (*str == '0') { in php_filter_boolean()
298 if (strncasecmp(str, "on", 2) == 0) { in php_filter_boolean()
300 } else if (strncasecmp(str, "no", 2) == 0) { in php_filter_boolean()
307 if (strncasecmp(str, "yes", 3) == 0) { in php_filter_boolean()
309 } else if (strncasecmp(str, "off", 3) == 0) { in php_filter_boolean()
316 if (strncasecmp(str, "true", 4) == 0) { in php_filter_boolean()
323 if (strncasecmp(str, "false", 5) == 0) { in php_filter_boolean()
345 char *str, *end; in php_filter_float() local
365 str = Z_STRVAL_P(value); in php_filter_float()
367 PHP_FILTER_TRIM_DEFAULT(str, len); in php_filter_float()
368 end = str + len; in php_filter_float()
398 if (str < end && (*str == '+' || *str == '-')) { in php_filter_float()
399 *p++ = *str++; in php_filter_float()
404 while (str < end && *str >= '0' && *str <= '9') { in php_filter_float()
406 *p++ = *str++; in php_filter_float()
408 if (str == end || *str == dec_sep || *str == 'e' || *str == 'E') { in php_filter_float()
412 if (*str == dec_sep) { in php_filter_float()
414 str++; in php_filter_float()
415 while (str < end && *str >= '0' && *str <= '9') { in php_filter_float()
416 *p++ = *str++; in php_filter_float()
419 if (*str == 'e' || *str == 'E') { in php_filter_float()
420 *p++ = *str++; in php_filter_float()
421 if (str < end && (*str == '+' || *str == '-')) { in php_filter_float()
422 *p++ = *str++; in php_filter_float()
424 while (str < end && *str >= '0' && *str <= '9') { in php_filter_float()
425 *p++ = *str++; in php_filter_float()
430 if ((flags & FILTER_FLAG_ALLOW_THOUSAND) && strchr(tsd_sep, *str)) { in php_filter_float()
435 str++; in php_filter_float()
440 if (str != end) { in php_filter_float()
567 static int is_userinfo_valid(zend_string *str) in is_userinfo_valid() argument
570 const char *p = ZSTR_VAL(str); in is_userinfo_valid()
571 while (p - ZSTR_VAL(str) < ZSTR_LEN(str)) { in is_userinfo_valid()
574 …} else if (*p == '%' && p - ZSTR_VAL(str) <= ZSTR_LEN(str) - 3 && isdigit(*(p+1)) && isxdigit(*(p+… in is_userinfo_valid()
721 static int _php_filter_validate_ipv4(char *str, size_t str_len, int *ip) /* {{{ */ in _php_filter_validate_ipv4() argument
723 const char *end = str + str_len; in _php_filter_validate_ipv4()
727 while (str < end) { in _php_filter_validate_ipv4()
729 if (*str < '0' || *str > '9') { in _php_filter_validate_ipv4()
732 leading_zero = (*str == '0'); in _php_filter_validate_ipv4()
734 num = ((*(str++)) - '0'); in _php_filter_validate_ipv4()
735 while (str < end && (*str >= '0' && *str <= '9')) { in _php_filter_validate_ipv4()
736 num = num * 10 + ((*(str++)) - '0'); in _php_filter_validate_ipv4()
747 return str == end; in _php_filter_validate_ipv4()
748 } else if (str >= end || *(str++) != '.') { in _php_filter_validate_ipv4()
756 static int _php_filter_validate_ipv6(char *str, size_t str_len, int ip[8]) /* {{{ */ in _php_filter_validate_ipv6() argument
764 char *s = str; in _php_filter_validate_ipv6()
766 if (!memchr(str, ':', str_len)) { in _php_filter_validate_ipv6()
771 ipv4 = memchr(str, '.', str_len); in _php_filter_validate_ipv6()
773 while (ipv4 > str && *(ipv4-1) != ':') { in _php_filter_validate_ipv6()
777 if (!_php_filter_validate_ipv4(ipv4, (str_len - (ipv4 - str)), ip4elm)) { in _php_filter_validate_ipv6()
781 str_len = ipv4 - str; /* length excluding ipv4 */ in _php_filter_validate_ipv6()
794 end = str + str_len; in _php_filter_validate_ipv6()
796 while (str < end) { in _php_filter_validate_ipv6()
797 if (*str == ':') { in _php_filter_validate_ipv6()
798 if (++str >= end) { in _php_filter_validate_ipv6()
802 if (*str == ':') { in _php_filter_validate_ipv6()
810 if (++str == end) { in _php_filter_validate_ipv6()
816 } else if ((str - 1) == s) { in _php_filter_validate_ipv6()
822 while (str < end) { in _php_filter_validate_ipv6()
823 if (*str >= '0' && *str <= '9') { in _php_filter_validate_ipv6()
824 num = 16 * num + (*str - '0'); in _php_filter_validate_ipv6()
825 } else if (*str >= 'a' && *str <= 'f') { in _php_filter_validate_ipv6()
826 num = 16 * num + (*str - 'a') + 10; in _php_filter_validate_ipv6()
827 } else if (*str >= 'A' && *str <= 'F') { in _php_filter_validate_ipv6()
828 num = 16 * num + (*str - 'A') + 10; in _php_filter_validate_ipv6()
833 str++; in _php_filter_validate_ipv6()