Skip to content

Commit

Permalink
fix TypeParser::Parse -> case Token::Number
Browse files Browse the repository at this point in the history
  • Loading branch information
1261385937 committed Apr 20, 2024
1 parent 7d9f8e6 commit bc9557c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions clickhouse/types/type_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<size_t>(cur_ - start)} };
}
}
return Token{Token::QuotedString, std::string_view(cur_++, 1)};
Expand All @@ -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<size_t>(cur_ - st)) };
}

if (isdigit(*cur_) || *cur_ == '-') {
Expand All @@ -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<size_t>(cur_ - st)) };
}

return Token{Token::Invalid, EMPTY};
Expand Down

0 comments on commit bc9557c

Please sign in to comment.