Review: Needs Fixing
Unfortunately, I don't think the proposed change is safe. istream::unget() is
not guaranteed to work, and in particular it probably won't work if the stream
is coming via HTTP.
However, there is a function StreamResource::isStreamSeekable(). Perhaps you
could check that flag, and only call the BOM-checking/unget block of code when
it returns true. We could at least claim that we are making a best-effort to
validate the incoming data.
I would be much happier with something like a three-byte "wrapper" stream
buffer that worked the same way BufferedInputStream does in Java, but it seems
like that is somehow really hard to accomplish in C++.
Your team Zorba Coders is subscribed to branch lp:zorba.
Mailing list: https://launchpad.net/~zorba-coders
Post to : firstname.lastname@example.org
Unsubscribe : https://launchpad.net/~zorba-coders
More help : https://help.launchpad.net/ListHelp