libc/stream,lzf: add lzf decompress stream and fix lzf-stream header/seek/read issues#18281
Closed
W-M-R wants to merge 6 commits intoapache:masterfrom
Closed
libc/stream,lzf: add lzf decompress stream and fix lzf-stream header/seek/read issues#18281W-M-R wants to merge 6 commits intoapache:masterfrom
W-M-R wants to merge 6 commits intoapache:masterfrom
Conversation
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
Align sistream and sostream structures so they use the same lib_stream_seek macro Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
Fixed the issue that loop reading without buffer offset would cause data read errors Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
This lib_lzfinstream supports seeking uncompressed files. It can seek backward, but if it seeks forward, the internal implementation will search from the beginning. examples: struct lib_filesistream_s rawstream; struct lib_lzfsistream_s lzfstream; lib_rawoutstream(&rawstream, fd); lib_lzfoutstream(&lzfstream, &rawstream); Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
…ession issues with lzf-stream. LZF compression will have two types of headers: one indicating successful compression and one indicating failed compression. Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
Contributor
|
Hi @W-M-R Please provide more detailed testing information |
linguini1
requested changes
Jan 30, 2026
Contributor
linguini1
left a comment
There was a problem hiding this comment.
Requires more than just a CI test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: Please adhere to Contributing Guidelines.
Summary
Added lib_lzfinstream (LZF decompression input stream), supporting seek operations on "decompressed data": backward processing is possible, while forward scanning reconstructs the state from the beginning.
Aligned sistream/sostream structures to allow them to reuse the same lib_stream_seek macros/interfaces, avoiding type inconsistency issues.
Fixed errors in the loop read offset/buffer handling of file(s)istream, preventing read errors when there is no buffer offset.
Fixed the handling of lzf-stream in both "compression successful" and "compression failed" header scenarios: preventing decompression errors caused by parsing according to the compressed block format when compression fails, and reducing the risk of potential compression failure/decompression errors.
Impact
Provides stream-based LZF decompression capabilities, facilitating on-demand reading in file/storage scenarios and supporting location-based reading of uncompressed views.
Improves stream system consistency (sistream/sostream alignment) and stability (type errors, read offset errors, LZF header branch handling).
The changes primarily focus on libc/stream and LZF-related implementations and are not expected to affect modules that do not use these streams/algorithms.
Testing
ci test