19static double collator_u_strtod(
const UChar *nptr, UChar **
endptr)
21 const UChar *
u = nptr, *nstart;
25 while (u_isspace(c)) {
30 if (c == 0x2D || c == 0x2B ) {
34 while (c >= 0x30 && c <= 0x39 ) {
41 while (c >= 0x30 && c <= 0x39 ) {
47 if ((c == 0x65 || c == 0x45 ) && any) {
52 if (c == 0x2D || c == 0x2B ) {
56 while (c >= 0x30 && c <= 0x39 ) {
67 char buf[64], *numbuf, *bufpos;
68 size_t length =
u - nstart;
72 if (length <
sizeof(
buf)) {
75 numbuf = (
char *)
do_alloca(length + 1, use_heap);
81 *bufpos++ = (char) *nstart++;
113static zend_long collator_u_strtol(
const UChar *nptr, UChar **
endptr,
int base)
115 const UChar *
s = nptr;
119 int neg = 0, any, cutlim;
136 }
while (u_isspace(c));
140 }
else if (c == 0x2B )
142 if ((base == 0 || base == 16) &&
144 && (*
s == 0x78 || *
s == 0x58 )) {
150 base = (c == 0x30 ) ? 8 : 10;
172 for (acc = 0, any = 0;; c = *
s++) {
173 if (c >= 0x30 && c <= 0x39 )
175 else if (c >= 0x41 && c <= 0x5A )
177 else if (c >= 0x61 && c <= 0x7A )
184 if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
198 *
endptr = (UChar *)(any ?
s - 1 : nptr);
211 UChar *end_ptr_long, *end_ptr_double;
218 local_lval = collator_u_strtol(str, &end_ptr_long, 10);
219 if (
errno != ERANGE) {
220 if (end_ptr_long == str+length) {
225 }
else if (end_ptr_long == str && *end_ptr_long !=
'\0' && *str !=
'.' && *str !=
'-') {
232 local_dval = collator_u_strtod(str, &end_ptr_double);
233 if (local_dval == 0 && end_ptr_double == str) {
234 end_ptr_double =
NULL;
236 if (end_ptr_double == str+length) {
254 if (end_ptr_double > end_ptr_long &&
dval) {
257 }
else if (end_ptr_long && lval) {
uint8_t collator_is_numeric(UChar *str, int32_t length, zend_long *lval, double *dval, bool allow_errors)
zend_ffi_ctype_name_buf buf
#define ALLOCA_FLAG(name)
#define do_alloca(p, use_heap)
#define free_alloca(p, use_heap)
ZEND_API double zend_strtod(const char *s00, const char **se)