Lines Matching refs:str

69 static int php_filter_parse_int(const char *str, unsigned int str_len, long *ret TSRMLS_DC) { /* {{…  in php_filter_parse_int()  argument
72 const char *end = str + str_len; in php_filter_parse_int()
74 switch (*str) { in php_filter_parse_int()
78 str++; in php_filter_parse_int()
83 if (*str == '0' && str + 1 == end) { in php_filter_parse_int()
89 if (str < end && *str >= '1' && *str <= '9') { in php_filter_parse_int()
90 ctx_value = ((sign)?-1:1) * ((*(str++)) - '0'); in php_filter_parse_int()
95 if ((end - str > MAX_LENGTH_OF_LONG - 1) /* number too long */ in php_filter_parse_int()
96 || (SIZEOF_LONG == 4 && (end - str == MAX_LENGTH_OF_LONG - 1) && *str > '2')) { in php_filter_parse_int()
101 while (str < end) { in php_filter_parse_int()
102 if (*str >= '0' && *str <= '9') { in php_filter_parse_int()
103 digit = (*(str++) - '0'); in php_filter_parse_int()
121 static int php_filter_parse_octal(const char *str, unsigned int str_len, long *ret TSRMLS_DC) { /* … in php_filter_parse_octal() argument
123 const char *end = str + str_len; in php_filter_parse_octal()
125 while (str < end) { in php_filter_parse_octal()
126 if (*str >= '0' && *str <= '7') { in php_filter_parse_octal()
127 unsigned long n = ((*(str++)) - '0'); in php_filter_parse_octal()
144 static int php_filter_parse_hex(const char *str, unsigned int str_len, long *ret TSRMLS_DC) { /* {{… in php_filter_parse_hex() argument
146 const char *end = str + str_len; in php_filter_parse_hex()
149 while (str < end) { in php_filter_parse_hex()
150 if (*str >= '0' && *str <= '9') { in php_filter_parse_hex()
151 n = ((*(str++)) - '0'); in php_filter_parse_hex()
152 } else if (*str >= 'a' && *str <= 'f') { in php_filter_parse_hex()
153 n = ((*(str++)) - ('a' - 10)); in php_filter_parse_hex()
154 } else if (*str >= 'A' && *str <= 'F') { in php_filter_parse_hex()
155 n = ((*(str++)) - ('A' - 10)); in php_filter_parse_hex()
239 char *str = Z_STRVAL_P(value); in php_filter_boolean() local
243 PHP_FILTER_TRIM_DEFAULT_EX(str, len, 0); in php_filter_boolean()
253 if (*str == '1') { in php_filter_boolean()
255 } else if (*str == '0') { in php_filter_boolean()
262 if (strncasecmp(str, "on", 2) == 0) { in php_filter_boolean()
264 } else if (strncasecmp(str, "no", 2) == 0) { in php_filter_boolean()
271 if (strncasecmp(str, "yes", 3) == 0) { in php_filter_boolean()
273 } else if (strncasecmp(str, "off", 3) == 0) { in php_filter_boolean()
280 if (strncasecmp(str, "true", 4) == 0) { in php_filter_boolean()
287 if (strncasecmp(str, "false", 5) == 0) { in php_filter_boolean()
309 char *str, *end; in php_filter_float() local
324 str = Z_STRVAL_P(value); in php_filter_float()
326 PHP_FILTER_TRIM_DEFAULT(str, len); in php_filter_float()
327 end = str + len; in php_filter_float()
341 if (str < end && (*str == '+' || *str == '-')) { in php_filter_float()
342 *p++ = *str++; in php_filter_float()
347 while (str < end && *str >= '0' && *str <= '9') { in php_filter_float()
349 *p++ = *str++; in php_filter_float()
351 if (str == end || *str == dec_sep || *str == 'e' || *str == 'E') { in php_filter_float()
355 if (*str == dec_sep) { in php_filter_float()
357 str++; in php_filter_float()
358 while (str < end && *str >= '0' && *str <= '9') { in php_filter_float()
359 *p++ = *str++; in php_filter_float()
362 if (*str == 'e' || *str == 'E') { in php_filter_float()
363 *p++ = *str++; in php_filter_float()
364 if (str < end && (*str == '+' || *str == '-')) { in php_filter_float()
365 *p++ = *str++; in php_filter_float()
367 while (str < end && *str >= '0' && *str <= '9') { in php_filter_float()
368 *p++ = *str++; in php_filter_float()
373 …if ((flags & FILTER_FLAG_ALLOW_THOUSAND) && (*str == tsd_sep[0] || *str == tsd_sep[1] || *str == t… in php_filter_float()
378 str++; in php_filter_float()
383 if (str != end) { in php_filter_float()
557 static int _php_filter_validate_ipv4(char *str, int str_len, int *ip) /* {{{ */ in _php_filter_validate_ipv4() argument
559 const char *end = str + str_len; in _php_filter_validate_ipv4()
563 while (str < end) { in _php_filter_validate_ipv4()
565 if (*str < '0' || *str > '9') { in _php_filter_validate_ipv4()
568 leading_zero = (*str == '0'); in _php_filter_validate_ipv4()
570 num = ((*(str++)) - '0'); in _php_filter_validate_ipv4()
571 while (str < end && (*str >= '0' && *str <= '9')) { in _php_filter_validate_ipv4()
572 num = num * 10 + ((*(str++)) - '0'); in _php_filter_validate_ipv4()
583 return str == end; in _php_filter_validate_ipv4()
584 } else if (str >= end || *(str++) != '.') { in _php_filter_validate_ipv4()
592 static int _php_filter_validate_ipv6(char *str, int str_len TSRMLS_DC) /* {{{ */ in _php_filter_validate_ipv6() argument
600 char *s = str; in _php_filter_validate_ipv6()
602 if (!memchr(str, ':', str_len)) { in _php_filter_validate_ipv6()
607 ipv4 = memchr(str, '.', str_len); in _php_filter_validate_ipv6()
609 while (ipv4 > str && *(ipv4-1) != ':') { in _php_filter_validate_ipv6()
613 if (!_php_filter_validate_ipv4(ipv4, (str_len - (ipv4 - str)), ip4elm)) { in _php_filter_validate_ipv6()
617 str_len = ipv4 - str; /* length excluding ipv4 */ in _php_filter_validate_ipv6()
630 end = str + str_len; in _php_filter_validate_ipv6()
632 while (str < end) { in _php_filter_validate_ipv6()
633 if (*str == ':') { in _php_filter_validate_ipv6()
634 if (++str >= end) { in _php_filter_validate_ipv6()
638 if (*str == ':') { in _php_filter_validate_ipv6()
645 if (++str == end) { in _php_filter_validate_ipv6()
648 } else if ((str - 1) == s) { in _php_filter_validate_ipv6()
654 while ((str < end) && in _php_filter_validate_ipv6()
655 ((*str >= '0' && *str <= '9') || in _php_filter_validate_ipv6()
656 (*str >= 'a' && *str <= 'f') || in _php_filter_validate_ipv6()
657 (*str >= 'A' && *str <= 'F'))) { in _php_filter_validate_ipv6()
659 str++; in _php_filter_validate_ipv6()