You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The implementations of ReaderInterface have inconsistent behaviour.
Some (e.g., FileReader) will rely on the lower implementation to return an error if the seek fails.
Some (e.g. BufferReader) will return an error if the seek is past the end, but they won't modify m_pos.
Some (e.g., NetworkReader) will return an error if the seek is past the end, and they will modify m_pos.
Each of the above returns different error codes.
These implementations should be updated to give consistent behaviour when seeking past the end of an input stream (as discussed in this PR).
Possible implementation
What we probably want for try_seek_from_begin implementations is to:
try to seek until pos
if that's past the end of the medium (file/buffer/etc.), m_pos should be updated to just past the last byte.
the method should return ErrorCode_EndOfFile.
The reason to update m_pos even though we get to pos is because for some implementations like FileReader, we can't easily check what the last byte is until we seek, and if we seek up to the end of the file, we may not be able to seek backwards to the original m_pos.
The text was updated successfully, but these errors were encountered:
Request
The implementations of ReaderInterface have inconsistent behaviour.
These implementations should be updated to give consistent behaviour when seeking past the end of an input stream (as discussed in this PR).
Possible implementation
What we probably want for try_seek_from_begin implementations is to:
The reason to update m_pos even though we get to pos is because for some implementations like FileReader, we can't easily check what the last byte is until we seek, and if we seek up to the end of the file, we may not be able to seek backwards to the original m_pos.
The text was updated successfully, but these errors were encountered: