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