Fix cast truncates constant value warning (#8932)

This commit is contained in:
Sil3ntStorm 2021-08-30 19:26:39 +02:00 committed by GitHub
parent fe54248aba
commit ef6a9b2854
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -816,8 +816,8 @@ bool Tokenizer::NextWithComments(std::string* prev_trailing_comments,
if (current_.type == TYPE_START) {
// Ignore unicode byte order mark(BOM) if it appears at the file
// beginning. Only UTF-8 BOM (0xEF 0xBB 0xBF) is accepted.
if (TryConsume((char)0xEF)) {
if (!TryConsume((char)0xBB) || !TryConsume((char)0xBF)) {
if (TryConsume(static_cast<char>(0xEF))) {
if (!TryConsume(static_cast<char>(0xBB)) || !TryConsume(static_cast<char>(0xBF))) {
AddError(
"Proto file starts with 0xEF but not UTF-8 BOM. "
"Only UTF-8 is accepted for proto file.");