186 Commits

Author SHA1 Message Date
adecbc7c7f Unify external API signatures across all buffer transforms
Every exported buffer transform now has the same shape:

    int32_t AARU_xxx(const uint8_t *src_buffer, size_t src_size,
                     uint8_t *dst_buffer, size_t *dst_size, ...extras);

On entry *dst_size is the capacity of dst_buffer; on success it holds the
number of bytes written. The return value is 0 (AARU_ERROR_NONE) on success
and non-zero on error, either an AARU_ERROR_* constant or the underlying
library's own error code when it is propagated.

Changes by category:

- Parameter reorder only: all AARU_zip_*, AARU_stuffit*, AARU_dd_*,
  AARU_cpt_*, AARU_lzo_*, AARU_xz_*, AARU_lzma2_*, AARU_kencode_*,
  AARU_apple_lzh_* and ace_decompress_*.
- Byte count return replaced by an out-parameter plus a status code:
  AARU_adc_*, AARU_apple_rle_*, AARU_lz4_*, AARU_lzip_*, AARU_lzfse_*,
  AARU_lzvn_*, AARU_zstd_* and AARU_flac_*. Their algorithm bodies are kept
  as static internals behind a thin exported wrapper.
- Type normalisation: bzip2 uint32_t* -> size_t*, zstd void* -> uint8_t*,
  ZIP PPMd size_t -> size_t*, and int/unsigned char -> int32_t/uint8_t
  throughout the header.
- AARU_lzma_decode_buffer no longer takes src_size as an in/out pointer; the
  consumed length is tracked internally.
- Already conforming decompressors (arc_*, pak_*, ha_*, lha_*, larc_*,
  pmarc_*, arj*, rar*, lh5_decompress) only had their declarations
  normalised.

The streaming LZD context API and AARU_get_acn_version are left alone, as
they are not buffer transforms.

Tests updated to the new call convention; all 78 pass.
2026-08-31 12:26:05 +01:00
bbae748612 Fix data race in StuffIt X English dictionary initialization
The shared English word dictionary was built behind a plain `if(dict_ptrs)`
guard, which provides neither mutual exclusion nor memory ordering. Worse,
dict_ptrs was published by malloc before the pointer table was populated, so a
concurrent caller of the exported AARU_stuffitx_english_decode_buffer could
pass the guard and read uninitialized pointers. Two racing threads would also
both run the full PPMd decode, leaking the dictionary buffer.

Build the dictionary in locals and publish the statics only once the table is
complete, driven by pthread_once (POSIX) or InitOnceExecuteOnce (Windows), and
record the outcome so a failed build is never retried.

Also fix three adjacent issues in the same path: the word-scan loop
dereferenced p before bounds-checking it, the base-52 index accumulator could
overflow into a value that passed the bounds check, and the word buffer clamp
left no room for the appended terminator character.

Same class of bug as MacPaw/XADMaster#194.
2026-08-31 12:06:34 +01:00
174fedd068 Bump version v6.0.0-beta.1 2026-07-14 17:48:45 +01:00
b1e8e2b4cb Add DCL Implode decompressor and buffer interface for ZIP support 2026-04-21 21:20:22 +01:00
3007f0c921 Bump version to 6.0.0-alpha.20 in nuspec file v6.0.0-alpha.20 2026-04-20 23:56:04 +01:00
594bda09b6 Add licensing information to kencode.c and kencode.h 2026-04-20 23:55:52 +01:00
42d37c66f7 Update README to include KenCode and NDIF ShrinkWrap SIT2 algorithms 2026-04-20 22:57:09 +01:00
5c39fda7be Add KenCode decompressor implementation and tests 2026-04-20 21:57:52 +01:00
16dd2ce90f Add ShrinkWrap 3 SIT2 decompression support and tests 2026-04-20 14:43:39 +01:00
5cfdbe485c Add Apple LZH codec to the list of implemented algorithms in README v6.0.0-alpha.19 2026-04-19 22:00:47 +01:00
a9bb26b509 Bump version to 6.0.0-alpha.19 in nuspec file 2026-04-19 21:10:06 +01:00
d9c3129e6a Add Apple LZH decompression support and corresponding tests
- Implemented Apple LZH decompression in `apple_lzh.c` and declared it in `apple_lzh.h`.
- Updated `CMakeLists.txt` to include new source files for the Apple LZH decompression.
- Added test cases for Apple LZH decompression in `tests/dart/dart.cpp` to verify functionality against known compressed files.
- Copied necessary test data files for both fast and best compression modes into the test data directory.
- Updated `library.h` to declare the new decompression function.
2026-04-19 21:02:42 +01:00
692322f86f Bump version to 6.0.0-alpha.18 in nuspec file 2026-04-17 17:31:29 +01:00
c5af197a63 Enhance StuffIt X decoding functions to track consumed input size, fixes Blend algorithm 2026-04-17 17:30:55 +01:00
cf060c8c60 Bump version to 6.0.0-alpha.17 in nuspec file 2026-04-17 11:33:49 +01:00
fc0f0e72b4 Add Compact Pro and DiskDoubler decompression support to README 2026-04-17 11:33:24 +01:00
0d2e05c419 Refactor PPMd Variant G Code for Consistency and Readability
- Adjusted indentation and spacing in SubAllocatorVariantG.h for improved readability.
- Reformatted function signatures in VariantG.c for consistent spacing.
- Enhanced clarity in variable declarations and assignments throughout VariantG.c.
- Updated comments and code structure in RestartModel and UpdateModel functions for better understanding.
- Ensured consistent formatting in VariantG.h, including spacing and alignment of struct members.
- Improved readability of the Decode functions by standardizing parameter spacing.
2026-04-17 01:27:45 +01:00
ca0da465e8 Remove obsolete StuffIt test binary file 2026-04-17 01:27:06 +01:00
ba39191e07 Add StuffIt decompression support
- Implemented range coder in `rangecoder.c` and `rangecoder.h` for efficient encoding/decoding.
- Added RLE90 decoding in `rle90.c` for handling StuffIt method 1.
- Introduced `stuffit.h` and `stuffit_internal.h` to define compression methods and internal structures.
- Implemented x86 address transformation in `x86.c` for StuffIt X preprocessing.
- Updated CMakeLists to include new test data files for various StuffIt methods.
- Created comprehensive tests in `stuffit.cpp` for validating decompression of multiple StuffIt formats.
- Added binary test data for StuffIt methods including compress, method 13, arsenic, and StuffIt X variants.
2026-04-17 01:19:44 +01:00
7a6c85b44f Add DiskDoubler decompression support
- Introduced dd.h header file with function declarations for various DiskDoubler decompression methods including ADn, DDn, Method 2, Stac LZS, Compact Pro, and LZW.
- Implemented wrapper functions in library.c to expose DiskDoubler decompression methods to the Aaru API.
- Updated library.h to declare the new DiskDoubler functions.
- Added test cases for DiskDoubler decompression methods in dd.cpp, covering ADn and DDn methods with corresponding binary test data.
- Included necessary test data files for ADn and DDn methods in the tests/data directory.
2026-04-16 23:19:47 +01:00
e3e6a874fd Add CompactPro compression algorithms. 2026-04-16 22:07:24 +01:00
eff7df7ce7 Bump version to 6.0.0-alpha.16 in nuspec file v6.0.0-alpha.16 2026-04-16 13:55:07 +01:00
bbeff6f3c6 Enhance RAR decompression logic to handle filter boundaries and improve output management 2026-04-16 13:53:58 +01:00
c3806e163b Update README.md to categorize implemented algorithms into general-purpose codecs and archive decompressors 2026-04-15 09:59:35 +01:00
02ed1091ef Bump version to 6.0.0-alpha.15 in nuspec file v6.0.0-alpha.15 2026-04-15 09:56:03 +01:00
954f527b87 Add AARU_EXPORT and AARU_CALL to decompression functions in RAR modules 2026-04-15 09:55:47 +01:00
1228eea822 Add RAR compression algorithms
- Introduced a new header file `vm.h` for the RAR 3.0 virtual machine, defining its architecture, instruction set, and API.
- Implemented the core functionality for executing RAR decompression filters.
- Added test cases for RAR formats 1.5, 2.0, 3.0, and 5.0, verifying decompression and CRC checks.
- Included necessary binary test data files for RAR formats in the test directory.
- Updated CMake configuration to include new test files and data.
2026-04-15 02:59:40 +01:00
12a4d684f5 Add support for various ZIP compression methods
- Implement Deflate64 decompression in zip/deflate64.h and zip/deflate64.c.
- Add ZIP Implode decompression functionality in zip/implode.h and zip/implode.c.
- Introduce ZIP Reduce decompression in zip/reduce.h and zip/reduce.c.
- Implement ZIP Shrink decompression in zip/shrink.h and zip/shrink.c.
- Create a unified ZIP interface in zip/zip.h and zip/zip.c to handle multiple compression methods including PPMd, WavPack, and WinZip JPEG.
- Ensure all new functions adhere to the Aaru Data Preservation Suite licensing and documentation standards.
2026-04-15 00:52:22 +01:00
61a8031402 Add ARJ and ARJZ decompression methods and corresponding tests
- Introduced arjz.h header file with function declaration for buffer decompression.
- Updated library.h to include ARJ and ARJZ decompression method declarations.
- Added test cases for ARJ decompression methods (Method 1 to Method 4) in arj.cpp.
- Implemented test cases for ARJZ decompression methods in arjz.cpp, including default and custom extended DEFLATE.
- Copied necessary binary test data files for ARJ and ARJZ methods into the tests/data directory.
2026-04-14 23:33:08 +01:00
d5c1cee932 Add ACE decompression support for v1 and v2 formats
- Implemented ace_decompress_v2 and ace_decompress_v20_block functions for handling ACE v2 (blocked) decompression.
- Added ace_decompress_lz77 function for ACE v1 (LZ77) decompression.
- Updated library.h to declare new decompression functions.
- Created unit tests for ACE v1 and v2 decompression, validating output against expected CRC32 checksums.
- Included necessary binary test data for ACE v1 and v2 formats.
- Refactored library.c to improve include order and reduce redundancy in function definitions.
2026-04-14 21:49:37 +01:00
882b775f71 Add LHA, LHARC, LARC and PMARC decompression support for various algorithms
- Implemented LZSS compression in lha/lzss.c and lha/lzss.h.
- Added PMarc decompression functionality in lha/pmarc1.c and lha/pmarc1.h.
- Updated library.h to include declarations for new decompression functions.
- Enhanced tests to cover LHA decompression for LH1, LH6, and PMarc formats.
- Added test helpers for loading LHA payloads and validating decompression results.
- Included sample data files for testing LHA and PMarc decompression.
2026-04-14 20:23:16 +01:00
6f5a9a4539 Update .gitignore to include build and docker directories with prefixes and cache files 2026-04-14 20:16:43 +01:00
920cf9f1b6 Bump version to 6.0.0-alpha.14 in nuspec file 2026-02-08 21:31:59 +00:00
884f2736ca Initialize CRC tables for XZ compression in library.c 2026-02-08 21:31:45 +00:00
99bea33209 Add xz compression and decompression tests with CMake integration 2026-02-08 21:31:24 +00:00
ba0f094a20 Call lzo_init before calling any other lzo function. 2026-02-08 20:10:29 +00:00
29d57b804e Enable position-independent code for static libraries in CMake 2026-02-08 17:01:40 +00:00
2fa677638a Optimize compiler flags for performance on non-AppleClang platforms 2026-02-08 17:01:32 +00:00
89cde985d5 Update CMake policy version to 3.5 in build scripts for cross-platform compatibility 2026-02-08 17:00:59 +00:00
83debae5f8 Disable SHA256 HW intrinsics for unsupported platforms 2026-02-08 17:00:20 +00:00
061c792fa6 Bump version to 6.0.0-alpha.13 2026-02-08 16:07:19 +00:00
fa74393e5e Disable in-source building. 2026-02-08 16:07:10 +00:00
7746c81cb9 Add XZ algorithm. 2026-02-08 16:06:41 +00:00
1bdbb1507a Add LZVN algorithm. 2026-02-08 15:54:28 +00:00
f7f5dd0dda Checkout LZ4. 2026-02-08 15:54:11 +00:00
ac087fd093 Add LZO compression algorithm. 2026-02-08 15:50:09 +00:00
48422ad607 Add AGENTS.md for AI agents guidance and project documentation 2025-12-29 18:49:43 +00:00
0487304503 Bump version to 6.0.0-alpha.12 in nuspec file v6.0.0-alpha.12 2025-12-26 16:20:15 +00:00
ed45dfce4d Merge pull request #1 from FakeShemp/fakeshemp/lz4
Add LZ4
2025-12-26 16:12:25 +00:00
a944bedd96 Merge pull request #2 from FakeShemp/fakeshemp/double-free
Wrong size allocated.
2025-12-26 16:06:44 +00:00