cpp: Now supports BOM #1208

git-svn-id: svn://ultimatepp.org/upp/trunk@8772 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2015-07-30 13:47:03 +00:00
parent 0e212aa3a5
commit ff94f771db
2 changed files with 9 additions and 3 deletions

View file

@ -234,6 +234,13 @@ void Cpp::Do(const String& sourcefile, Stream& in, const String& currentfile, bo
if(get_macros)
return;
if(in.Peek() == 0xef) { // Skip UTF-8 BOM
int64 pos = in.GetPos();
in.Get();
if(in.Get() != 0xbb || in.Get() != 0xbf)
in.Seek(pos); // Was not UTF-8 BOM after all
}
LTIMING("Expand");
incomment = false;
prefix_macro.Clear();