]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
#754 move sufixlist upper and improve error message on missing suffix
authorSergey Ponomarev <stokito@gmail.com>
Sat, 14 Sep 2019 18:14:43 +0000 (21:14 +0300)
committerSergey Ponomarev <stokito@gmail.com>
Sat, 14 Sep 2019 18:14:43 +0000 (21:14 +0300)
programs/fileio.c

index 8a45563d437961d9e4a91d6c19d21b066a1e9a2d..e5fb1aad1200f77a7dbda8970f4e77d77fb6c2ba 100644 (file)
@@ -2169,12 +2169,24 @@ FIO_determineDstName(const char* srcFileName)
     static size_t dfnbCapacity = 0;
     static char* dstFileNameBuffer = NULL;   /* using static allocation : this function cannot be multi-threaded */
 
+    const char* suffixlist = ZSTD_EXTENSION
+    #ifdef ZSTD_GZDECOMPRESS
+        "/" GZ_EXTENSION
+    #endif
+    #ifdef ZSTD_LZMADECOMPRESS
+        "/" XZ_EXTENSION "/" LZMA_EXTENSION
+    #endif
+    #ifdef ZSTD_LZ4DECOMPRESS
+        "/" LZ4_EXTENSION
+    #endif
+    ;
+
     size_t const sfnSize = strlen(srcFileName);
     size_t suffixSize;
     const char* const suffixPtr = strrchr(srcFileName, '.');
     if (suffixPtr == NULL) {
-        DISPLAYLEVEL(1, "zstd: %s: unknown suffix -- ignored \n",
-                        srcFileName);
+        DISPLAYLEVEL(1, "zstd: %s: missing suffix (%s expected) -- ignored \n",
+                        srcFileName, suffixlist);
         return NULL;
     }
     suffixSize = strlen(suffixPtr);
@@ -2193,17 +2205,6 @@ FIO_determineDstName(const char* srcFileName)
             && strcmp(suffixPtr, LZ4_EXTENSION)
         #endif
             ) ) {
-        const char* suffixlist = ZSTD_EXTENSION
-        #ifdef ZSTD_GZDECOMPRESS
-            "/" GZ_EXTENSION
-        #endif
-        #ifdef ZSTD_LZMADECOMPRESS
-            "/" XZ_EXTENSION "/" LZMA_EXTENSION
-        #endif
-        #ifdef ZSTD_LZ4DECOMPRESS
-            "/" LZ4_EXTENSION
-        #endif
-        ;
         DISPLAYLEVEL(1, "zstd: %s: unknown suffix (%s expected) -- ignored \n",
                      srcFileName, suffixlist);
         return NULL;