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

Only compress metadata if resulting in smaller size #216

Closed
wcampbell0x2a opened this issue Apr 14, 2023 · 1 comment
Closed

Only compress metadata if resulting in smaller size #216

wcampbell0x2a opened this issue Apr 14, 2023 · 1 comment
Labels
C-enhancement New feature or request good first issue Good for newcomers

Comments

@wcampbell0x2a
Copy link
Owner

The size of the compressed bytes should be compared to the size of the uncompressed bytes. The following TODO shows the position of one of the checks.

diff --git a/src/metadata.rs b/src/metadata.rs
 index da6af38..cbd9969 100644
 --- a/src/metadata.rs
 +++ b/src/metadata.rs
 @@ -77,6 +77,8 @@ impl Write for MetadataWriter {
                  self.block_size,
              )?;

 +            // TODO: check if compressed bytes is < uncompressed bytes
 +
              // Metadata len + bytes + last metadata_start
              self.metadata_start += 2 + b.len() as u32;
              trace!("new metadata start: {:#02x?}", self.metadata_start);

The length would need to be updated when written to the block, as right now it assumes it will always be compressed.

@wcampbell0x2a wcampbell0x2a added C-enhancement New feature or request good first issue Good for newcomers labels Apr 14, 2023
@rbran
Copy link
Contributor

rbran commented Jun 3, 2023

#250 should solve this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants