From d054028b841d3f29fbe7f9bd57163ce4d125794f Mon Sep 17 00:00:00 2001 From: rbuj Date: Sun, 15 Sep 2019 22:56:17 +0200 Subject: Zstandard: add test for checking compressed file integrity --- src/fr-command-cfile.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/fr-command-cfile.c b/src/fr-command-cfile.c index 612c4c8..fff8bfb 100644 --- a/src/fr-command-cfile.c +++ b/src/fr-command-cfile.c @@ -490,7 +490,7 @@ fr_command_cfile_test (FrCommand *comm) { const char *compress_cmd; if (is_mime_type (comm->mime_type, "application/x-gzip")) { - compress_cmd = "gzip"; + compress_cmd = "gzip"; } else if (is_mime_type (comm->mime_type, "application/x-brotli")) { compress_cmd = "brotli"; @@ -512,6 +512,15 @@ fr_command_cfile_test (FrCommand *comm) } else if (is_mime_type (comm->mime_type, "application/x-lzop")) { compress_cmd = "lzop"; + } + else if (is_mime_type (comm->mime_type, "application/x-zstd")) { + compress_cmd = "zstd"; + fr_process_begin_command (comm->process, compress_cmd); + fr_process_add_arg (comm->process, "-v"); + fr_process_add_arg (comm->process, "--test"); + fr_process_add_arg (comm->process, comm->filename); + fr_process_end_command (comm->process); + return; } else { // i.e. if (is_mime_type (comm->mime_type, "application/x-rzip")) g_warning ("Test integrity is unsupported for %s\n", comm->mime_type); return; -- cgit v1.2.1