Lines Matching refs:str

84 static int _php_filter_validate_ipv6(char *str, size_t str_len);
86 static int php_filter_parse_int(const char *str, size_t str_len, zend_long *ret) { /* {{{ */ in php_filter_parse_int() argument
89 const char *end = str + str_len; in php_filter_parse_int()
91 switch (*str) { in php_filter_parse_int()
95 str++; in php_filter_parse_int()
100 if (*str == '0' && str + 1 == end) { in php_filter_parse_int()
106 if (str < end && *str >= '1' && *str <= '9') { in php_filter_parse_int()
107 ctx_value = ((sign)?-1:1) * ((*(str++)) - '0'); in php_filter_parse_int()
112 if ((end - str > MAX_LENGTH_OF_LONG - 1) /* number too long */ in php_filter_parse_int()
113 || (SIZEOF_LONG == 4 && (end - str == MAX_LENGTH_OF_LONG - 1) && *str > '2')) { in php_filter_parse_int()
118 while (str < end) { in php_filter_parse_int()
119 if (*str >= '0' && *str <= '9') { in php_filter_parse_int()
120 digit = (*(str++) - '0'); in php_filter_parse_int()
138 static int php_filter_parse_octal(const char *str, size_t str_len, zend_long *ret) { /* {{{ */ in php_filter_parse_octal() argument
140 const char *end = str + str_len; in php_filter_parse_octal()
142 while (str < end) { in php_filter_parse_octal()
143 if (*str >= '0' && *str <= '7') { in php_filter_parse_octal()
144 zend_ulong n = ((*(str++)) - '0'); in php_filter_parse_octal()
161 static int php_filter_parse_hex(const char *str, size_t str_len, zend_long *ret) { /* {{{ */ in php_filter_parse_hex() argument
163 const char *end = str + str_len; in php_filter_parse_hex()
166 while (str < end) { in php_filter_parse_hex()
167 if (*str >= '0' && *str <= '9') { in php_filter_parse_hex()
168 n = ((*(str++)) - '0'); in php_filter_parse_hex()
169 } else if (*str >= 'a' && *str <= 'f') { in php_filter_parse_hex()
170 n = ((*(str++)) - ('a' - 10)); in php_filter_parse_hex()
171 } else if (*str >= 'A' && *str <= 'F') { in php_filter_parse_hex()
172 n = ((*(str++)) - ('A' - 10)); in php_filter_parse_hex()
256 char *str = Z_STRVAL_P(value); in php_filter_boolean() local
260 PHP_FILTER_TRIM_DEFAULT_EX(str, len, 0); in php_filter_boolean()
270 if (*str == '1') { in php_filter_boolean()
272 } else if (*str == '0') { in php_filter_boolean()
279 if (strncasecmp(str, "on", 2) == 0) { in php_filter_boolean()
281 } else if (strncasecmp(str, "no", 2) == 0) { in php_filter_boolean()
288 if (strncasecmp(str, "yes", 3) == 0) { in php_filter_boolean()
290 } else if (strncasecmp(str, "off", 3) == 0) { in php_filter_boolean()
297 if (strncasecmp(str, "true", 4) == 0) { in php_filter_boolean()
304 if (strncasecmp(str, "false", 5) == 0) { in php_filter_boolean()
326 char *str, *end; in php_filter_float() local
341 str = Z_STRVAL_P(value); in php_filter_float()
343 PHP_FILTER_TRIM_DEFAULT(str, len); in php_filter_float()
344 end = str + len; in php_filter_float()
358 if (str < end && (*str == '+' || *str == '-')) { in php_filter_float()
359 *p++ = *str++; in php_filter_float()
364 while (str < end && *str >= '0' && *str <= '9') { in php_filter_float()
366 *p++ = *str++; in php_filter_float()
368 if (str == end || *str == dec_sep || *str == 'e' || *str == 'E') { in php_filter_float()
372 if (*str == dec_sep) { in php_filter_float()
374 str++; in php_filter_float()
375 while (str < end && *str >= '0' && *str <= '9') { in php_filter_float()
376 *p++ = *str++; in php_filter_float()
379 if (*str == 'e' || *str == 'E') { in php_filter_float()
380 *p++ = *str++; in php_filter_float()
381 if (str < end && (*str == '+' || *str == '-')) { in php_filter_float()
382 *p++ = *str++; in php_filter_float()
384 while (str < end && *str >= '0' && *str <= '9') { in php_filter_float()
385 *p++ = *str++; in php_filter_float()
390 …if ((flags & FILTER_FLAG_ALLOW_THOUSAND) && (*str == tsd_sep[0] || *str == tsd_sep[1] || *str == t… in php_filter_float()
395 str++; in php_filter_float()
400 if (str != end) { in php_filter_float()
642 static int _php_filter_validate_ipv4(char *str, size_t str_len, int *ip) /* {{{ */ in _php_filter_validate_ipv4() argument
644 const char *end = str + str_len; in _php_filter_validate_ipv4()
648 while (str < end) { in _php_filter_validate_ipv4()
650 if (*str < '0' || *str > '9') { in _php_filter_validate_ipv4()
653 leading_zero = (*str == '0'); in _php_filter_validate_ipv4()
655 num = ((*(str++)) - '0'); in _php_filter_validate_ipv4()
656 while (str < end && (*str >= '0' && *str <= '9')) { in _php_filter_validate_ipv4()
657 num = num * 10 + ((*(str++)) - '0'); in _php_filter_validate_ipv4()
668 return str == end; in _php_filter_validate_ipv4()
669 } else if (str >= end || *(str++) != '.') { in _php_filter_validate_ipv4()
677 static int _php_filter_validate_ipv6(char *str, size_t str_len) /* {{{ */ in _php_filter_validate_ipv6() argument
685 char *s = str; in _php_filter_validate_ipv6()
687 if (!memchr(str, ':', str_len)) { in _php_filter_validate_ipv6()
692 ipv4 = memchr(str, '.', str_len); in _php_filter_validate_ipv6()
694 while (ipv4 > str && *(ipv4-1) != ':') { in _php_filter_validate_ipv6()
698 if (!_php_filter_validate_ipv4(ipv4, (str_len - (ipv4 - str)), ip4elm)) { in _php_filter_validate_ipv6()
702 str_len = ipv4 - str; /* length excluding ipv4 */ in _php_filter_validate_ipv6()
715 end = str + str_len; in _php_filter_validate_ipv6()
717 while (str < end) { in _php_filter_validate_ipv6()
718 if (*str == ':') { in _php_filter_validate_ipv6()
719 if (++str >= end) { in _php_filter_validate_ipv6()
723 if (*str == ':') { in _php_filter_validate_ipv6()
730 if (++str == end) { in _php_filter_validate_ipv6()
733 } else if ((str - 1) == s) { in _php_filter_validate_ipv6()
739 while ((str < end) && in _php_filter_validate_ipv6()
740 ((*str >= '0' && *str <= '9') || in _php_filter_validate_ipv6()
741 (*str >= 'a' && *str <= 'f') || in _php_filter_validate_ipv6()
742 (*str >= 'A' && *str <= 'F'))) { in _php_filter_validate_ipv6()
744 str++; in _php_filter_validate_ipv6()