-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix wrapping
Reader
s and Writer
s when the underlying Reader
or …
…`Writer` fails. * Ensure that buffer pointers of the wrapper stay related to the underlying object even in the case of failure. This avoids `SyncBuffer()` modifying `cursor()` which would be no longer related to `start()` and `limit()`. * Let `Fail()` set the failure right away and then annotate it, instead of setting an annotated failure. This avoids an infinite recursion if `AnnotateStatusImpl()` calls `Fail()`. * Fix `PositionShifting{Reader,Writer}::MakeBuffer()` near the end of the `Position` range: - Ensure that buffer pointers stay related to the underlying object even if the position overflows. - Shrink the buffer to account for the remaining `Position` space if that is sufficient to avoid position overflow. - Fail if shrinking the buffer would make `available() < min_length`. - Propagate failure from `MakeBuffer()` to its callers. Cosmetics: * Let `PositionShiftingReader` expose the underlying buffer from its `start()` rather than `cursor()`. This makes seeking within the buffer more efficient. * Let `LimitingReader` ensure that its buffer pointers always stay related to the underlying `Reader`. This avoids a conditional in `SyncBuffer()`. PiperOrigin-RevId: 715284599
- Loading branch information
Showing
8 changed files
with
83 additions
and
70 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
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
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
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