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