Let lz4toasm accept LZ4 files that lack extracted-size field (#858)

lz4toasm should now more easily accept LZ4 files output by
compressor programs that do not support the extracted-size
field, such as Stephan Brumme's smallz4.

This patch also proposes to add a new lz4len() function to
the libc: it parses an LZ4 compressed block to compute the
unpacked content size, without really unpacking the block.

Co-authored-by: tkchia <tkchia-cosmo@gmx.com>
This commit is contained in:
tkchia 2023-07-24 02:12:22 +08:00 committed by GitHub
parent 3eec69f9c3
commit 0ffc0dd461
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 59 additions and 2 deletions

View file

@ -116,8 +116,7 @@ int main(int argc, char *argv[]) {
if (LZ4_FRAME_BLOCKCONTENTSIZEFLAG(frame)) {
extractedsize = LZ4_FRAME_BLOCKCONTENTSIZE(frame);
} else {
fprintf(stderr, "error: need extractedsize\n");
exit(1);
extractedsize = lz4len(data, size);
}
}