File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -276,16 +276,18 @@ class simplecpp::TokenList::Stream {
276276 }
277277
278278 unsigned char peekChar () {
279- auto ch = static_cast <unsigned char >(peek ());
279+ const int pk = peek ();
280+ auto ch = static_cast <unsigned char >(pk);
281+ if (pk == EOF)
282+ return ch;
280283
281284 // For UTF-16 encoded files the BOM is 0xfeff/0xfffe. If the
282285 // character is non-ASCII character then replace it with 0xff
283286 if (isUtf16) {
284287 (void )get ();
285- const int ch2 = peek ();
286- if (ch2 != EOF)
287- unget ();
288- const int ch16 = makeUtf16Char (ch, static_cast <unsigned char >(ch2));
288+ const int ch2 = static_cast <unsigned char >(peek ());
289+ unget ();
290+ const int ch16 = makeUtf16Char (ch, ch2);
289291 ch = static_cast <unsigned char >(((ch16 >= 0x80 ) ? 0xff : ch16));
290292 }
291293
You can’t perform that action at this time.
0 commit comments