Loading lib/strtoofft.c +30 −26 Original line number Diff line number Diff line Loading @@ -55,9 +55,11 @@ Curl_strtoll(const char *nptr, char **endptr, int base) if (end[0] == '-') { is_negative = 1; end++; } else if (end[0] == '+') { } else if (end[0] == '+') { end++; } else if (end[0] == '\0') { } else if (end[0] == '\0') { /* We had nothing but perhaps some whitespace -- there was no number. */ if (endptr) { *endptr = end; Loading @@ -71,7 +73,8 @@ Curl_strtoll(const char *nptr, char **endptr, int base) end += 2; base = 16; } } else if (end[0] == '0') { } else if (end[0] == '0') { if (base == 8 || base == 0) { end++; base = 8; Loading @@ -90,16 +93,15 @@ Curl_strtoll(const char *nptr, char **endptr, int base) overflow = 0; for (i = get_char(end[0], base); i != -1; end++, i = get_char(end[0], base)) { end++, i = get_char(end[0], base)) { newval = base * value + i; if (newval < value) { /* We've overflowed. */ overflow = 1; break; } else { value = newval; } else value = newval; } if (!overflow) { Loading @@ -107,19 +109,18 @@ Curl_strtoll(const char *nptr, char **endptr, int base) /* Fix the sign. */ value *= -1; } } else { if (is_negative) { } else { if (is_negative) value = 0x8000000000000000L; } else { else value = 0x7FFFFFFFFFFFFFFFL; } errno = ERANGE; } if (endptr) { if (endptr) *endptr = end; } return value; } Loading @@ -134,13 +135,16 @@ Curl_strtoll(const char *nptr, char **endptr, int base) * * @return the value of c in base, or -1 if c isn't in range */ static int get_char(char c, int base) { static int get_char(char c, int base) { int value = -1; if (c <= '9' && c >= '0') { value = c - '0'; } else if (c <= 'Z' && c >= 'A') { } else if (c <= 'Z' && c >= 'A') { value = c - 'A' + 10; } else if (c <= 'z' && c >= 'a') { } else if (c <= 'z' && c >= 'a') { value = c - 'a' + 10; } Loading Loading
lib/strtoofft.c +30 −26 Original line number Diff line number Diff line Loading @@ -55,9 +55,11 @@ Curl_strtoll(const char *nptr, char **endptr, int base) if (end[0] == '-') { is_negative = 1; end++; } else if (end[0] == '+') { } else if (end[0] == '+') { end++; } else if (end[0] == '\0') { } else if (end[0] == '\0') { /* We had nothing but perhaps some whitespace -- there was no number. */ if (endptr) { *endptr = end; Loading @@ -71,7 +73,8 @@ Curl_strtoll(const char *nptr, char **endptr, int base) end += 2; base = 16; } } else if (end[0] == '0') { } else if (end[0] == '0') { if (base == 8 || base == 0) { end++; base = 8; Loading @@ -90,16 +93,15 @@ Curl_strtoll(const char *nptr, char **endptr, int base) overflow = 0; for (i = get_char(end[0], base); i != -1; end++, i = get_char(end[0], base)) { end++, i = get_char(end[0], base)) { newval = base * value + i; if (newval < value) { /* We've overflowed. */ overflow = 1; break; } else { value = newval; } else value = newval; } if (!overflow) { Loading @@ -107,19 +109,18 @@ Curl_strtoll(const char *nptr, char **endptr, int base) /* Fix the sign. */ value *= -1; } } else { if (is_negative) { } else { if (is_negative) value = 0x8000000000000000L; } else { else value = 0x7FFFFFFFFFFFFFFFL; } errno = ERANGE; } if (endptr) { if (endptr) *endptr = end; } return value; } Loading @@ -134,13 +135,16 @@ Curl_strtoll(const char *nptr, char **endptr, int base) * * @return the value of c in base, or -1 if c isn't in range */ static int get_char(char c, int base) { static int get_char(char c, int base) { int value = -1; if (c <= '9' && c >= '0') { value = c - '0'; } else if (c <= 'Z' && c >= 'A') { } else if (c <= 'Z' && c >= 'A') { value = c - 'A' + 10; } else if (c <= 'z' && c >= 'a') { } else if (c <= 'z' && c >= 'a') { value = c - 'a' + 10; } Loading