Fixed SkipByteOrderMark advancing cursor_ too early.

Change-Id: Ie60f01d935ca6b4aa6ce0eab7598602ac0758342
Tested: on Linux.
This commit is contained in:
Wouter van Oortmerssen 2016-04-22 11:26:47 -07:00
parent fd542c71e3
commit f6330ab8f1
1 changed files with 4 additions and 2 deletions

View File

@ -205,8 +205,10 @@ CheckedError Parser::ParseHexNum(int nibbles, int64_t *val) {
CheckedError Parser::SkipByteOrderMark() {
if (static_cast<unsigned char>(*cursor_) != 0xef) return NoError();
cursor_++;
if (static_cast<unsigned char>(*cursor_++) != 0xbb) return Error("invalid utf-8 byte order mark");
if (static_cast<unsigned char>(*cursor_++) != 0xbf) return Error("invalid utf-8 byte order mark");
if (static_cast<unsigned char>(*cursor_) != 0xbb) return Error("invalid utf-8 byte order mark");
cursor_++;
if (static_cast<unsigned char>(*cursor_) != 0xbf) return Error("invalid utf-8 byte order mark");
cursor_++;
return NoError();
}