1
0
mirror of synced 2024-12-22 12:35:52 +01:00
Commit Graph

21 Commits

Author SHA1 Message Date
rockisch
2f60f61c15
impr: Add streaming decompression to zstd_decompress (#1898)
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Problem description

https://github.com/WerWolv/ImHex/issues/1895

### Implementation description

Added code that handles streamed zstd data. It is based around the
[official
documentation](http://facebook.github.io/zstd/zstd_manual.html) and the
[example](https://github.com/facebook/zstd/blob/dev/examples/simple_decompression.c)
provided at the main zstd repo.

The loop around the non-streamed version was also removed because I
don't think it was doing anything (no `continue`s, `sourceSize` was
always being set to 0).

### Additional things

To test, I generated streamed zstd data with this python script:

```py
import io; import pyzstd;
with open("data.zstd", "wb") as f:
    pyzstd.compress_stream(io.BytesIO(b'ab' * 100), f)
```

And then I ran this pattern script:
```
import std.mem;
import hex.dec;

u8 data[while(!std::mem::eof())] @ 0x00;
std::mem::Section data_sec = std::mem::create_section("data_sec");
hex::dec::zstd_decompress(data, data_sec);
```

Inspecting the section shows the correct data:

![image](https://github.com/user-attachments/assets/83fc9d4c-e6fa-49ee-9923-29dc0c280739)

Co-authored-by: Nik <werwolv98@gmail.com>
2024-09-15 15:16:57 +02:00
xndcn
965113c2b4
fix: Fix lzma stream end constant name (#1818)
Corrected BZ_STREAM_END to LZMA_STREAM_END.
Also removed redundant condition of LZMA_STREAM_END for error checking.
2024-07-21 20:33:46 +02:00
WerWolv
03d344c0a2 build: Streamline definition on plugin features 2024-07-08 18:12:46 +02:00
WerWolv
59d120537d feat: Added non-frame lz4 compression support to the pattern language 2024-07-07 15:23:18 +02:00
WerWolv
1f5e4ceb0c feat: Added basic support for lz4 decompression to the pattern language 2024-07-07 10:26:24 +02:00
WerWolv
8a3739ee1c impr: Display background scripts in about page 2024-05-08 22:30:53 +02:00
WerWolv
9b9f7e2a1d fix: Decompress functions not extracting full data
Thanks a lot to tocklime
2024-03-22 17:34:49 +01:00
reggie
56b2e09b01
build: Fix zstd not being linked in correctly (#1544)
Prior to this, at least on Linux/MacOS/etc, I guess it was not possible
to compile with Zstd included for `hex::dec::zstd_decompress()`:


![image](https://github.com/WerWolv/ImHex/assets/56618074/008dbb3d-eeaf-4f49-a918-4751ec69f00c)

Every other target lib for the decompression plugin would compile,
**except for** Zstd. Additionally, the target name `zstd` caused CMake
to not be able to find `Find(ZSTD).cmake` due to case-sensitivity
differences between Windows and Unix-based file paths, of course.
With that said, I'm not too sure if this will break building w/ Zstd on
Windows... Hopefully not 😄
2024-02-13 20:22:28 +01:00
WerWolv
76e304c34e build: Fix various issues with linking, clang and unity builds 2024-01-29 22:57:39 +01:00
Nik
339541a56f
impr: Restructure various components much better (#1520) 2024-01-28 22:14:59 +01:00
WerWolv
25b4745997 impr: Make zlib decompress function take in a windowSize parameter 2024-01-27 16:12:02 +01:00
WerWolv
d511080814 impr: Make plugin features and subcommands work in statically linked builds 2024-01-13 00:34:13 +01:00
Nik
950eaea8af
impr: Make decompression support actually useful (#1481) 2023-12-31 11:39:24 +01:00
WerWolv
a0fddd2953 build: Try detecting macOS better when updating libarchive include path 2023-12-27 00:38:32 +01:00
WerWolv
d2d244ebc7 build: Make libarchive not required 2023-12-24 14:43:49 +01:00
WerWolv
9952854b53 build: Try different libarchive include path detection method 2023-12-24 14:37:59 +01:00
WerWolv
7eb92c68de build: Only fix libarchive include dirs when necessary 2023-12-24 14:30:10 +01:00
WerWolv
24f8ce9d7f build: Fix macOS M1 build 2023-12-24 13:57:21 +01:00
WerWolv
343e98c99a build: Fix missing libarchive include directories on macOS 2023-12-24 13:41:10 +01:00
WerWolv
bc76eee847 build: Remove minimum required libarchive version 2023-12-24 13:33:18 +01:00
WerWolv
e2489151f3 feat: Added decompressing support 2023-12-24 13:14:51 +01:00