From bc9557cf994b881935cd1237151f93a1a632ebde Mon Sep 17 00:00:00 2001 From: wangwei <1261385937@qq.com> Date: Sat, 20 Apr 2024 14:56:46 +0800 Subject: [PATCH] fix TypeParser::Parse -> case Token::Number --- clickhouse/types/type_parser.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/clickhouse/types/type_parser.cpp b/clickhouse/types/type_parser.cpp index 4df06407..ceb9b530 100644 --- a/clickhouse/types/type_parser.cpp +++ b/clickhouse/types/type_parser.cpp @@ -173,7 +173,7 @@ bool TypeParser::Parse(TypeAst* type) { break; case Token::Number: type_->meta = TypeAst::Number; - type_->value = std::strtoul(token.value.data(), nullptr, 10); + type_->value = std::strtoll(token.value.data(), nullptr, 10); break; case Token::String: type_->meta = TypeAst::String; @@ -244,7 +244,8 @@ TypeParser::Token TypeParser::NextToken() { if (end_quote == std::string_view{cur_, end_quote_length}) { cur_ += end_quote_length; - return Token{Token::QuotedString, std::string_view{start, cur_}}; + return Token{ Token::QuotedString, + std::string_view{start, static_cast(cur_ - start)} }; } } return Token{Token::QuotedString, std::string_view(cur_++, 1)}; @@ -270,7 +271,7 @@ TypeParser::Token TypeParser::NextToken() { } } - return Token{Token::Name, std::string_view(st, cur_)}; + return Token{ Token::Name, std::string_view(st, static_cast(cur_ - st)) }; } if (isdigit(*cur_) || *cur_ == '-') { @@ -280,7 +281,7 @@ TypeParser::Token TypeParser::NextToken() { } } - return Token{Token::Number, std::string_view(st, cur_)}; + return Token{ Token::Number, std::string_view(st, static_cast(cur_ - st)) }; } return Token{Token::Invalid, EMPTY};