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

DirectoryBlob: Improve ReadInternal #5864

Merged

Conversation

JosJuice
Copy link
Member

@JosJuice JosJuice commented Aug 1, 2017

This is a bit of a "various small fixes" PR. Many of the commits build up to fixing some problems with the ReadInternal function, though.

Only return the information that isn't already known to the caller.
Having DiscContents with size 0 would mean that some DiscContents
might not get added to the std::set because of them comparing
identically to another DiscContent.

This replaces an older piece of code in WriteDirectory that ensures
that no two files have the same starting offset. (We now care about
the ending offset, not the starting offset. The new solution both
ensures that no two files have the same ending offset and that no
two files have the same starting offset.)
DiscContent::Read contains an equivalent assertion.
There were two problems with this:

1. If the starting offset was beyond the end of the disc,
   we would dereference an invalid iterator.
2. The data beyond the end of the disc was non-deterministic.
This is done in order to reduce the risk of files not being added
due to them having the same end offset as another file.
@JosJuice JosJuice force-pushed the directoryblob-disccontentcontainer branch from da25967 to 2bcccd8 Compare August 1, 2017 20:01
@Tilka
Copy link
Member

Tilka commented Aug 4, 2017

lgtm

@JosJuice JosJuice merged commit fb20168 into dolphin-emu:master Aug 23, 2017
@JosJuice JosJuice deleted the directoryblob-disccontentcontainer branch August 23, 2017 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants