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

Improve TAR loader #9908

Merged
merged 4 commits into from Mar 10, 2021
Merged

Improve TAR loader #9908

merged 4 commits into from Mar 10, 2021

Conversation

elad335
Copy link
Contributor

@elad335 elad335 commented Mar 6, 2021

  • Fix header magic test.
  • Rewrite code to not use so many filesystem calls.
  • Add many more error checks.
  • Add missing NUL filetype.
  • octalToDecimal(header.size) has been fixed to use fixed 12 characters range instead of endless string.
  • Add many optimizations.
  • Fix possible signed overflows with int, use the unisgned u64 type instead which allows for greater files as well.
  • Log errors.

@elad335 elad335 force-pushed the tar branch 2 times, most recently from 743764a to 627bf08 Compare March 6, 2021 19:34
@elad335
Copy link
Contributor Author

elad335 commented Mar 6, 2021

Removed #9907 dependency.

int decimalNumber = 0, i = 0, rem;
while (octalNumber != 0)
u64 i = -1;
const auto [ptr, err] = std::from_chars(sv.data(), sv.data() + sv.size(), i, 8);
Copy link
Contributor Author

@elad335 elad335 Mar 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from_chars allows much, much better error checking than atoi which is perfect for this. If theres any error i will remain UINT64_MAX which fails the later checks. Also supports unsigned types which the minus sign is not supported for it.

* Fix header magic test.
* Rewrite code to not use so many filesystem calls.
* Add many more error checks.
* Add missing NUL filetype.
* octalToDecimal(header.size) has been fixed to use fixed 12 characters range instead of endless string.
* Add many optimizations.
* Fix possible signed overflows with int, use the unisgned u64 type instead which allows for greater files as well.
* Log errors.
@Nekotekina Nekotekina merged commit 0958c10 into RPCS3:master Mar 10, 2021
@elad335 elad335 deleted the tar branch March 16, 2021 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix Optimization Optimizes existing code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants