-
Notifications
You must be signed in to change notification settings - Fork 75
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 seeking #133
Fix seeking #133
Conversation
Based on #131
Start from beginning of file if current position is *ahead* of desired position.
The test first failed with attempt to subtract with overflow and after the fix it no longer fails. |
We weren't actually reading backwards because we always did "seek from start". Now we do some "seek from current" with a negative offset, and a "seek from end".
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.
Seems fine to me, thanks!
/// The last cluster we accessed, and how many bytes that short-cuts us. | ||
/// | ||
/// This saves us walking from the very start of the FAT chain when we move | ||
/// forward through a file. | ||
pub(crate) current_cluster: (u32, ClusterId), |
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.
Should this variable be rather called last_cluster_accessed
or similar?
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.
I thought about it, but it changes a bunch of stuff. Maybe in a later PR?
Can you smash that |
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.
Thank you for your work!
Hopefully closes #131. Now we start from the beginning of a file when the current offset is ahread of the desired offset.