Skip to content
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

Merged
merged 7 commits into from
Jun 10, 2024
Merged

Fix seeking #133

merged 7 commits into from
Jun 10, 2024

Conversation

thejpster
Copy link
Member

Hopefully closes #131. Now we start from the beginning of a file when the current offset is ahread of the desired offset.

Start from beginning of file if current position is *ahead* of desired position.
@thejpster
Copy link
Member Author

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".
Copy link
Member

@eldruin eldruin left a 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),
Copy link
Member

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?

Copy link
Member Author

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?

@thejpster
Copy link
Member Author

Seems fine to me, thanks!

Can you smash that Bell Icon Approve button?

Copy link
Member

@eldruin eldruin left a 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!

@eldruin eldruin added this pull request to the merge queue Jun 10, 2024
Merged via the queue into develop with commit 860e072 Jun 10, 2024
8 checks passed
@thejpster thejpster deleted the fix-seeking branch July 12, 2024 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

find_data_on_disk() panics due to attempt to subtract with overflow
2 participants