mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-03-04 10:21:32 +00:00
Fix behavior of SpanStream/VecStream seek-from-end
This commit is contained in:
parent
4588943352
commit
98ba6c0590
1 changed files with 4 additions and 4 deletions
|
|
@ -431,10 +431,10 @@ public:
|
|||
head = offset;
|
||||
break;
|
||||
case SeekFrom::kEnd:
|
||||
if (-offset >= static_cast<StreamOffset>(span_.size())) {
|
||||
if (static_cast<StreamOffset>(span_.size()) + offset < 0) {
|
||||
throw std::logic_error("end offset is out of bounds");
|
||||
}
|
||||
head = span_.size() - offset;
|
||||
head = span_.size() + offset;
|
||||
break;
|
||||
case SeekFrom::kCurrent:
|
||||
if (head_ + offset < 0) {
|
||||
|
|
@ -526,10 +526,10 @@ public:
|
|||
head = offset;
|
||||
break;
|
||||
case SeekFrom::kEnd:
|
||||
if (-offset >= static_cast<StreamOffset>(vec_.size())) {
|
||||
if (static_cast<StreamOffset>(vec_.size()) + offset < 0) {
|
||||
throw std::logic_error("end offset is out of bounds");
|
||||
}
|
||||
head = vec_.size() - offset;
|
||||
head = vec_.size() + offset;
|
||||
break;
|
||||
case SeekFrom::kCurrent:
|
||||
if (head_ + offset < 0) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue