-
Notifications
You must be signed in to change notification settings - Fork 385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(storage): fix tellg() values #12844
fix(storage): fix tellg() values #12844
Conversation
The initial values for `tellg()` were incorrect `ReadRange()` and `ReadLast()` options.
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #12844 +/- ##
=======================================
Coverage 93.55% 93.55%
=======================================
Files 2074 2074
Lines 180452 180548 +96
=======================================
+ Hits 168815 168911 +96
Misses 11637 11637
☔ View full report in Codecov by Sentry. |
: source_(std::move(source)), | ||
source_pos_(pos_in_stream), | ||
source_pos_(static_cast<std::streamoff>(InitialOffset(request))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to static cast to std::streamoff
when it looks like InitialOffset()
already returns a std::streamoff
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
D'oh! That is what happens when you refactor to a function and forget to clean up the call site.
if (source_pos_ >= 0) { | ||
source_pos_ += static_cast<std::streamoff>(read->bytes_received); | ||
} else if (size_) { | ||
source_pos_ = *size_ + source_pos_ + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use source_pos_ += ...
too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
The initial values for
tellg()
were incorrectReadRange()
andReadLast()
options.This change is