We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f761852 commit daa4c4aCopy full SHA for daa4c4a
simplecpp.cpp
@@ -335,6 +335,7 @@ class simplecpp::TokenList::Stream {
335
}
336
337
unsigned short bom;
338
+protected:
339
bool isUtf16;
340
};
341
@@ -386,7 +387,14 @@ class FileStream : public simplecpp::TokenList::Stream {
386
387
return ch;
388
389
virtual void unget() {
- ungetc(lastCh, file);
390
+ if (isUtf16) {
391
+ // TODO: use ungetc() as well
392
+ // UTF-16 has subsequent unget() calls
393
+ fseek(file, -1, SEEK_CUR);
394
+ }
395
+ else
396
+ ungetc(lastCh, file);
397
+
398
399
virtual bool good() {
400
return lastCh != EOF;
0 commit comments