177 Commits

Author SHA1 Message Date
dweiller
7e2755646f std.compress.zstandard: split decompressor into multiple files 2023-02-20 09:09:06 +11:00
dweiller
6e3e72884b std.compress.zstandard: fix crashes 2023-02-20 09:09:06 +11:00
dweiller
a180fcc93d std.compress.zstandard: add ZstandardStream 2023-02-20 09:09:06 +11:00
dweiller
5723291444 std.compress.zstandard: add decodeBlockReader 2023-02-20 09:09:06 +11:00
dweiller
947ad3e268 std.compress.zstandard: add FrameContext and add literals into DecodeState 2023-02-20 09:09:06 +11:00
dweiller
2d35c16ee7 std.compress.zstandard: add init/deinit for ring buffer, fix len() 2023-02-20 09:09:06 +11:00
dweiller
e92575d3d4 std.compress.zstandard: verify checksum in decodeFrameAlloc() 2023-02-20 09:09:06 +11:00
dweiller
3bfba36548 std.compress.zstandard: clean up error sets and line lengths 2023-02-20 09:09:06 +11:00
dweiller
3c06e2e7d0 std.compress.zstandard: add doc comments for RingBuffer 2023-02-20 09:09:06 +11:00
dweiller
1e5b8be509 std.compress.zstandard: add window size limit param 2023-02-20 09:09:06 +11:00
dweiller
e2306ef0a0 std.compress.zstandard: add integer casts u64 -> usize 2023-02-20 09:09:06 +11:00
dweiller
7558bf6451 std.compress.zstandard: minor cleanup and add doc comments 2023-02-20 09:09:06 +11:00
dweiller
ab18adf5c3 std.compress.zstandard: remove debug logging 2023-02-20 09:09:06 +11:00
dweiller
d40b135e95 std.compress.zstandard: properly track consumed count in decodeFrameBlocks 2023-02-20 09:09:06 +11:00
dweiller
774e2f5a5c std.compress.zstandard: add input length safety checks 2023-02-20 09:09:06 +11:00
dweiller
31d1cae8c6 std.compress.zstandard: validate fse table value count 2023-02-20 09:09:06 +11:00
dweiller
95953e1ee6 std.compress.zstandard: fix dictionary field size 2023-02-20 09:09:06 +11:00
dweiller
6b85373875 std.compress.zstandard: validate sequence lengths 2023-02-20 09:09:06 +11:00
dweiller
082acd7f17 std.compress.zstandard: clean up integer casts 2023-02-20 09:09:06 +11:00
dweiller
fc64c279a4 std.compress.zstandard: clean up api 2023-02-20 09:09:06 +11:00
dweiller
cbfaa876d4 std.compress.zstandard: cleanup ReverseBitReader 2023-02-20 09:09:05 +11:00
dweiller
c819e58c20 std.compress.zstandard: add decodeZStandardFrameAlloc
This is a convenience wrapper - best to use `decodeZStandardFrame()` if
the content size is known, or directly use `decodeBlockRingBuffer()`.
2023-02-20 09:09:05 +11:00
dweiller
05e63f241e std.compress.zstandard: add functions decoding into ring buffer
This supports decoding frames that do not declare the content size or
decoding in a streaming fashion.
2023-02-20 09:09:05 +11:00
dweiller
18091723d5 std.compress.zstandard: cleanup decodeBlock 2023-02-20 09:09:05 +11:00
dweiller
61cb514387 std.compress: add zstandard decompressor 2023-02-20 09:09:05 +11:00
Andrew Kelley
aeaef8c0ff update std lib and compiler sources to new for loop syntax 2023-02-18 19:17:21 -07:00
fn ⌃ ⌥
43c76e0c8e
Update block.zig 2023-02-05 09:18:07 -08:00
fn ⌃ ⌥
622a364715 Implement std.io.Reader for LZMA1 2023-02-05 08:23:51 -08:00
fn ⌃ ⌥
e03d6c42ea Delete redundant lzma/lzma2 prefix in function/struct names 2023-02-05 06:52:28 -08:00
Ryan Liptak
d57813e3e9 std.compress.xz: Avoid possible integer overflow in a few places 2023-02-05 06:08:35 -08:00
fn ⌃ ⌥
8e2af21cd9 Add LZMA decoder 2023-02-02 11:59:56 -08:00
fn ⌃ ⌥
d0dedefde9 std.compress.xz: fix for big-endian targets 2023-01-25 08:49:59 -08:00
Andrew Kelley
92ea7bce5d std.compress.xz: fix compile error on 32-bit systems 2023-01-24 15:24:19 -07:00
Andrew Kelley
d94613c1d0 support xz compressed tarballs in the package manager
This includes a breaking change:

std.compress.gzip.GzipStream renamed to
std.compress.gzip.Decompress

This follows the same naming convention as std.compress.xz so that the
stream type can be passed as a comptime parameter.
2023-01-24 15:24:19 -07:00
Andrew Kelley
ea9ded8758 std.compress.xz public API cleanup
* add xz to std.compress
 * prefer importing std.zig by file name, to reduce reliance on the
   standard library being a special case.
 * extract some types from inside generic functions. These types are the
   same regardless of the generic parameters.
 * expose some more types in the std.compress.xz namespace.
 * rename xz.stream to xz.decompress
 * rename check.Kind to Check
 * use std.leb for LEB instead of a redundant implementation
2023-01-24 15:24:19 -07:00
fn ⌃ ⌥
06ce15e8f7 Add an xz decoder to the standard library 2023-01-24 15:24:04 -07:00
fn ⌃ ⌥
f85c01d4c7 Implement gzip header CRC check.
From RFC 1952:

> If FHCRC is set, a CRC16 for the gzip header is present,
> immediately before the compressed data. The CRC16 consists
> of the two least significant bytes of the CRC32 for all
> bytes of the gzip header up to and not including the CRC16.
2023-01-22 00:33:29 -05:00
Andrew Kelley
da6d79c47c water cooler complaint about gzip stream namespace 2023-01-11 15:39:48 -08:00
Veikka Tuominen
622311fb9a update uses of overflow arithmetic builtins 2022-12-27 15:13:14 +02:00
Andrew Kelley
8f98a2b90f std.compress.deflate: re-enable test on windows
closes #13892
2022-12-18 16:34:09 -07:00
Andrew Kelley
e6a4e87f69 update gitattributes and move test data into subdir 2022-12-18 16:28:30 -07:00
Ryan Liptak
077b003c50 std.compress: Improve tests, remove reliance on openDirAbsolute
- Previously, some of the compress tests used `@src()` in combination with `dirname` and `openDirAbsolute` to read test files at runtime, which both excludes platforms that `openDirAbsolute` is not implemented for (WASI) and platforms that `SourceLocation.file` is not absolute (this was true for me locally on Windows). Instead of converting the tests to use `fs.cwd().openDir`, they have been converted to use `@embedFile` to avoid any potential problems with the runtime cwd.
- In order to use `@embedFile`, some of the `[]u8` parameters needed to be changed to `[]const u8`; none of them needed to be non-const anyway
- The tests now use `expectEqual` and `expectEqualSlices` where appropriate for better diagnostics
2022-12-15 05:13:21 -05:00
Andrew Kelley
e3ef01c6c7 disable failing windows std lib tests
See tracking issues #13892 and #13893
2022-12-11 12:48:18 -07:00
Andrew Kelley
50eb7983cd remove most conditional compilation based on stage1
There are still a few occurrences of "stage1" in the standard library
and self-hosted compiler source, however, these instances need a bit
more careful inspection to ensure no breakage.
2022-12-06 20:38:54 -07:00
mllken
b25fc18aa6 gzip: add missing fields to header parsing 2022-11-18 15:13:22 +02:00
mllken
5db1a3cd33 gzip: add bounds for safer header parsing 2022-11-18 15:12:46 +02:00
Ali Chraghi
ca27055cda all: rename @maximum to @max and @minimum to @min 2022-10-18 14:15:16 +03:00
Gaëtan
62258555b6 Make CompressorOptions public 2022-10-12 04:04:43 -04:00
ominitay
295451dfe5
std: Replace use of stage1 function pointers 2022-09-29 21:45:30 +03:00
Veikka Tuominen
62ff8871ed stage2+stage1: remove type parameter from bit builtins
Closes #12529
Closes #12511
Closes #6835
2022-08-22 11:19:20 +03:00