td-720: remove oct number support

This commit is contained in:
Bomin Zhang 2020-06-23 11:14:54 +08:00
parent c2432e6b80
commit f84c727b69
1 changed files with 9 additions and 1 deletions

View File

@ -46,8 +46,16 @@ static int32_t tscToInteger(SSQLToken *pToken, int64_t *value, char **endPtr) {
return TK_ILLEGAL;
}
int32_t radix = 10;
if (pToken->type == TK_HEX) {
radix = 16;
} else if (pToken->type == TK_BIN) {
radix = 2;
}
errno = 0;
*value = strtoll(pToken->z, endPtr, 0);
*value = strtoll(pToken->z, endPtr, radix);
if (**endPtr == 'e' || **endPtr == 'E' || **endPtr == '.') {
errno = 0;
double v = round(strtod(pToken->z, endPtr));