-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reader: fix Skip(n) where n >= buffer size
The (*Reader).Skip() code did not handle skip sizes above the buffer size correctly, because the inner reader loop only looped while 'r.buffered() < n', and that condition is obviously violated when the reader successfully buffers more bytes than are to be skipped. Refactor this method to be a little shorter and hopefully much clearer (and more correct) and add test coverage that exercises this code better.
- Loading branch information
Showing
2 changed files
with
67 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters