From: Michael Tremer Date: Fri, 19 Mar 2021 18:07:49 +0000 (+0000) Subject: compress: Add auto-detection for ZSTD X-Git-Tag: 0.9.28~1285^2~506 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=60732b6e49dad8932f48f6218569f9c94c6017c4;p=pakfire.git compress: Add auto-detection for ZSTD Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/compress.c b/src/libpakfire/compress.c index 0991146db..89275e2ae 100644 --- a/src/libpakfire/compress.c +++ b/src/libpakfire/compress.c @@ -47,6 +47,9 @@ const struct compressor { } compressors[] = { // XZ { { 0xFD, '7', 'z', 'X', 'Z', 0x00 }, 6, pakfire_xzfopen, }, + // ZSTD + { { 0x28, 0xb5, 0x2f, 0xfd }, 4, pakfire_zstdfopen, }, + // End { "", 0, NULL, }, }; diff --git a/tests/libpakfire/compress.c b/tests/libpakfire/compress.c index a07bbf852..a318bd583 100644 --- a/tests/libpakfire/compress.c +++ b/tests/libpakfire/compress.c @@ -92,7 +92,10 @@ static int test_zstdfopen_write(const struct test* t) { } static int test_xfopen(const struct test* t) { - return read_test(t, pakfire_xfopen, "data/compress/data.xz"); + ASSERT(read_test(t, pakfire_xfopen, "data/compress/data.xz") == EXIT_SUCCESS); + ASSERT(read_test(t, pakfire_xfopen, "data/compress/data.zst") == EXIT_SUCCESS); + + return EXIT_SUCCESS; } int main(int argc, char** argv) {