Skip to content

Commit 3e509fb

Browse files
committed
bump simplecpp (fixed unicode problem)
1 parent 0ae163d commit 3e509fb

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

externals/simplecpp/simplecpp.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,17 +266,16 @@ static unsigned char peekChar(std::istream &istr, unsigned int bom) {
266266
// For UTF-16 encoded files the BOM is 0xfeff/0xfffe. If the
267267
// character is non-ASCII character then replace it with 0xff
268268
if (bom == 0xfeff || bom == 0xfffe) {
269+
(void)istr.get();
269270
const unsigned char ch2 = (unsigned char)istr.peek();
271+
istr.unget();
270272
const int ch16 = (bom == 0xfeff) ? (ch<<8 | ch2) : (ch2<<8 | ch);
271273
ch = (unsigned char)((ch16 >= 0x80) ? 0xff : ch16);
272274
}
273275

274276
// Handling of newlines..
275-
if (ch == '\r') {
277+
if (ch == '\r')
276278
ch = '\n';
277-
if (bom != 0)
278-
(void)istr.peek();
279-
}
280279

281280
return ch;
282281
}

0 commit comments

Comments
 (0)