We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 81ccfa7 commit 572673dCopy full SHA for 572673d
1 file changed
simplecpp.cpp
@@ -316,7 +316,8 @@ class simplecpp::TokenList::Stream {
316
317
// The UTF-16 BOM is 0xfffe or 0xfeff.
318
if (ch1 >= 0xfe) {
319
- const unsigned short bom = (static_cast<unsigned char>(get()) << 8);
+ (void)get();
320
+ const unsigned short bom = (static_cast<unsigned char>(ch1) << 8);
321
if (peek() >= 0xfe)
322
return bom | static_cast<unsigned char>(get());
323
unget();
@@ -326,12 +327,15 @@ class simplecpp::TokenList::Stream {
326
327
// Skip UTF-8 BOM 0xefbbbf
328
if (ch1 == 0xef) {
329
(void)get();
- if (get() == 0xbb && peek() == 0xbf) {
330
+ if (peek() == 0xbb) {
331
- } else {
332
- unget();
+ if (peek() == 0xbf) {
333
334
+ return 0;
335
+ }
336
337
}
338
+ unget();
339
340
341
return 0;
0 commit comments