]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Support .zstd suffix only for decompression
authorsenhuang42 <senhuang96@fb.com>
Fri, 18 Sep 2020 16:49:51 +0000 (12:49 -0400)
committersenhuang42 <senhuang96@fb.com>
Fri, 18 Sep 2020 16:49:51 +0000 (12:49 -0400)
.gitignore
programs/fileio.c
programs/fileio.h
tests/playTests.sh

index 6188ab911c26150c157d2bd271b3826c6d8d1aa8..ae277e932bd4847326d56d6bd98c66772316faa7 100644 (file)
@@ -23,6 +23,7 @@ zstdmt
 # Test artefacts
 tmp*
 *.zst
+*.zstd
 dictionary.
 dictionary
 NUL
index b27f314ad0674a1ffbc4608a8736d40c2783c2c3..1f2dabf4481770351b5aeb889bbb03425cec0108 100644 (file)
@@ -2555,6 +2555,9 @@ int FIO_decompressFilename(FIO_ctx_t* const fCtx, FIO_prefs_t* const prefs,
 static const char *suffixList[] = {
     ZSTD_EXTENSION,
     TZSTD_EXTENSION,
+#ifndef ZSTD_NODECOMPRESS
+    ZSTD_ALT_EXTENSION,
+#endif
 #ifdef ZSTD_GZDECOMPRESS
     GZ_EXTENSION,
     TGZ_EXTENSION,
index bec651a153a8a5b45c3f50477ad26316024363d9..1a0a35ded7fb03f39f87f06be6612745b18dd74b 100644 (file)
@@ -44,6 +44,7 @@ extern "C" {
 
 #define ZSTD_EXTENSION  ".zst"
 #define TZSTD_EXTENSION ".tzst"
+#define ZSTD_ALT_EXTENSION  ".zstd" /* allow decompression of .zstd files */
 
 #define LZ4_EXTENSION   ".lz4"
 #define TLZ4_EXTENSION  ".tlz4"
index d9407db89834fedd3fa16ea7fc5f5b9f911db747..72a02918001588cf844d149acab2bd206e58abe9 100755 (executable)
@@ -1128,10 +1128,13 @@ if [ $LZ4MODE -ne 1 ]; then
     grep ".lz4" tmplg > $INTOVOID && die "Unsupported suffix listed"
 fi
 
+touch tmp1
+zstd tmp1 -o tmp1.zstd
+zstd -d tmp1.zstd   # support .zstd suffix even though it's not the default suffix
 
 println "\n===>  tar extension tests "
 
-rm -f tmp tmp.tar tmp.tzst tmp.tgz tmp.txz tmp.tlz4
+rm -f tmp tmp.tar tmp.tzst tmp.tgz tmp.txz tmp.tlz4 tmp1.zstd
 
 datagen > tmp
 tar cf tmp.tar tmp