* stdlib: implement `std::compression::zip` and `std::compression::deflate`
- C3 implementation of DEFLATE (RFC 1951) and ZIP archive handling.
- Support for reading and writing archives using STORE and DEFLATE
methods.
- Decompression supports both fixed and dynamic Huffman blocks.
- Compression using greedy LZ77 matching.
- Zero dependencies on libc.
- Stream-based entry reading and writing.
- Full unit test coverage.
NOTE: This is an initial implementation. Future improvements could be:
- Optimization of the LZ77 matching (lazy matching).
- Support for dynamic Huffman blocks in compression.
- ZIP64 support for large files/archives.
- Support for encryption and additional compression methods.
* optimizations+refactoring
deflate:
- replace linear search with hash-based match finding.
- implement support for dynamic Huffman blocks using the Package-Merge
algorithm.
- add streaming decompression.
- add buffered StreamBitReader.
zip:
- add ZIP64 support.
- add CP437 and UTF-8 filename encoding detection.
- add DOS date/time conversion and timestamp preservation.
- add ZipEntryReader for streaming entry reads.
- implement ZipArchive.extract and ZipArchive.recover helpers.
other:
- Add `set_modified_time` to std::io;
- Add benchmarks and a few more unit tests.
* zip: add archive comment support
add tests
* forgot to rename the benchmark :(
* detect utf8 names on weird zips
fix method not passed to open_writer
* another edge case where directory doesn't end with /
* testing utilities
- detect encrypted zip
- `ZipArchive.open_writer` default to DEFLATE
* fix zip64 creation, add tests
* fix ZIP header endianness for big-endian compatibility
Update ZipLFH, ZipCDH, ZipEOCD, Zip64EOCD, and Zip64Locator structs to
use little-endian bitstruct types from std::core::bitorder
* fix ZipEntryReader position tracking and seek logic ZIP_METHOD_STORE
added a test to track this
* add package-merge algorithm attribution
Thanks @konimarti
* standalone deflate_benchmark.c3 against `miniz`
* fix integer overflows, leaks and improve safety
* a few safety for 32-bit systems and tests
* deflate compress optimization
* improve match finding, hash updates, and buffer usage
* use ulong for zip offsets
* style changes (#18)
* style changes
* update tests
* style changes in `deflate.c3`
* fix typo
* Allocator first. Some changes to deflate to use `copy_to`
* Fix missing conversion on 32 bits.
* Fix deflate stream. Formatting. Prefer switch over if-elseif
* - Stream functions now use long/ulong rather than isz/usz for seek/available.
- `instream.seek` is replaced by `set_cursor` and `cursor`.
- `instream.available`, `cursor` etc are long/ulong rather than isz/usz to be correct on 32-bit.
* Update to constdef
* Fix test
---------
Co-authored-by: Book-reader <thevoid@outlook.co.nz>
Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
* fix typos in comments and strings
* fix typos in symbols (and some comments/strings)
* fix typos in releasenotes.md
---------
Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
* io: implement MultiReader struct
Implement a MultiReader (InStream) which sequentially read from the
provided readers (InStreams). Return IoError.EOF when all of the readers
are read.
* io: implement MultiWriter struct
Implement a MultiWriter (OutStream). The MultiWriter duplicates its
writes to all the provided writers (OutStream).
* io: implement TeeReader struct
Implement a TeeReader (InStream) which reads from a wrapped reader
(InStream) and writes data to the provided writer (OutStream).
Upgrade of mingw in CI. Fix problems using reflection on interface types #1203. Improved debug information on defer. $foreach doesn't create an implicit syntactic scope.
Error if `@if` depends on `@if`. Updated Linux stacktrace. Fix of default argument stacktrace. Allow linking libraries directly by file path. Improve inlining warning messages. Added `index_of_char_from`. Compiler crash using enum nameof from different module #1205. Removed unused fields in find_msvc. Use vswhere to find msvc. Update tests for LLVM 19
* lib/std/collections: add HashMap.@each_entry()
* lib/std/json: fix Object.free() when object is a map
* lib/std/collections: fix allocator use in Object.{set,set_at,append}
* lib/std: add char.from_hex
* lib/std/collections: print arrays and objects compactly
* lib/std/io: fix Formatter.vprintf result
* lib/std/io/stream: rename module for ByteBuffer
* lib/std/io/stream: make Scanner a Stream reader
* lib/std/io: make std{in,err,out} return File* if no libc
* std/lib/io: add Scanner
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
* lib/std/core: use existing methods in String.convert_ascii_to_{lower, upper}
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
---------
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
* lib/std/io/stream: add some inlines
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
* lib/std/io/stream add ByteBuffer
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
* lib/std/io/path: fix free of paths in walk
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
* lib/std/bits: remove unnecessary receiver type
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
---------
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
* lib/std/io/stream: add LimitReader
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
* lib/std: more method conversions to use new receiver notation
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
---------
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
* std/lib/collections: make List support the []= operator
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
* std/lib/io: rename receiver to self
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
---------
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
ReadBuffer and WriterBuffer buffer stream reads and writes to a stream.
Useful in situations where the underlying stream is sensitive to the number
of read or write calls.
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
* lib/std: fix ByteWriter.read_from method
When reading from a stream which does not have an available method,
ByteWriter would not make any progress if its buffer was empty.
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
* test/unit/stdlib/io: use separate module for TestReader
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
---------
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>