]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed compression with -c with multiple files on Windows
authorinikep <inikep@gmail.com>
Thu, 19 May 2016 08:29:49 +0000 (10:29 +0200)
committerinikep <inikep@gmail.com>
Thu, 19 May 2016 08:29:49 +0000 (10:29 +0200)
appveyor.yml
programs/fileio.c
programs/tests/playTestsMSYS.sh
programs/zstdcli.c

index b79ef2a59d2eda7dd61231abde03036b99b4519b..e002d89ef56cc2cd9a4ed9a22dcbb2cca7b03e34 100644 (file)
@@ -95,5 +95,5 @@ test_script:
       projects\fuzzer_VS2012_%PLATFORM%_Release.exe %FUZZERTEST% &&
       projects\fuzzer_VS2013_%PLATFORM%_Release.exe %FUZZERTEST% &&
       projects\fuzzer_VS2015_%PLATFORM%_Release.exe %FUZZERTEST% &&
-      zstd_VS2015_%PLATFORM%_Release.exe
+      REM zstd_VS2015_%PLATFORM%_Release.exe
     )
index b3f324ac6925046cdb5fef375e3af74cacf64823..638e63b578771dbbd2548a4047064954cca15edd 100644 (file)
@@ -71,7 +71,7 @@
 #if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
 #  include <fcntl.h>    /* _O_BINARY */
 #  include <io.h>       /* _setmode, _isatty */
-#  define SET_BINARY_MODE(file) { int unused = _setmode(_fileno(file), _O_BINARY); (void)unused; }
+#  define SET_BINARY_MODE(file) { if (_setmode(_fileno(file), _O_BINARY) == -1) perror("Cannot set _O_BINARY"); }
 #else
 #  include <unistd.h>   /* isatty */
 #  define SET_BINARY_MODE(file)
@@ -439,6 +439,7 @@ int FIO_compressMultipleFilenames(const char** inFileNamesTable, unsigned nbFile
     if (!strcmp(suffix, stdoutmark)) {
         unsigned u;
         ress.dstFile = stdout;
+        SET_BINARY_MODE(stdout);
         for (u=0; u<nbFiles; u++)
             missed_files += FIO_compressFilename_srcFile(ress, stdoutmark,
                                                          inFileNamesTable[u], compressionLevel);
index 82f2357bdc2fa51b34acf4cb207e46798c631060..4289977a0d146b2a79b1b36ac8f5c013416f3b81 100755 (executable)
@@ -23,7 +23,7 @@ roundTripTest() {
 [ -n "$ZSTD" ] || die "ZSTD variable must be defined!"
 
 
-echo "\n**** simple tests **** "
+echo -e "\n**** simple tests **** "
 ./datagen > tmp
 $ZSTD -f tmp                             # trivial compression case, creates tmp.zst
 $ZSTD -df tmp.zst                        # trivial decompression case (overwrites tmp)
@@ -51,7 +51,7 @@ cp tmp tmp2.zst
 $ZSTD -df tmp2.zst && die "should have failed : wrong format"
 rm tmp2.zst
 
-echo "\n**** frame concatenation **** "
+echo -e "\n**** frame concatenation **** "
 
 echo "hello " > hello.tmp
 echo "world!" > world.tmp
@@ -67,7 +67,7 @@ rm ./*.tmp ./*.zstd
 echo frame concatenation test completed
 
 
-echo "\n**** dictionary tests **** "
+echo -e "\n**** dictionary tests **** "
 
 ./datagen > tmpDict
 ./datagen -g1M | md5sum > tmp1
@@ -79,7 +79,7 @@ $ZSTD -d tmp -D tmpDict -of result
 fc xxhash.c result
 
 
-echo "\n**** multiple files tests **** "
+echo -e "\n**** multiple files tests **** "
 
 ./datagen -s1        > tmp1 2> /dev/null
 ./datagen -s2 -g100K > tmp2 2> /dev/null
@@ -96,12 +96,12 @@ $ZSTD -c tmp1 tmp2 tmp3 > tmpall
 ls -ls tmp*
 echo "decompress tmpall* into stdout > tmpdec : "
 cp tmpall tmpall2
-$ZSTD -dc tmpall* > tmpdec
+$ZSTD -dc tmpall* > tmpdec
 ls -ls tmp*
 echo "compress multiple files including a missing one (notHere) : "
 $ZSTD -f tmp1 notHere tmp2 && die "missing file not detected!"
 
-echo "\n**** integrity tests **** "
+echo -e "\n**** integrity tests **** "
 echo "test one file (tmp1.zst) "
 $ZSTD -t tmp1.zst
 $ZSTD --test tmp1.zst
@@ -110,7 +110,7 @@ $ZSTD -t *.zst
 echo "test good and bad files (*) "
 $ZSTD -t * && die "bad files not detected !"
 
-echo "\n**** zstd round-trip tests **** "
+echo -e "\n**** zstd round-trip tests **** "
 
 roundTripTest
 roundTripTest -g15K       # TableID==3
index 310db7f8804ccb09ce2fcff230ffb749b02f34ef..8a8af3a2c1485024d0b978a2309e5c58c40ca929 100644 (file)
 *  OS-specific Includes
 **************************************/
 #if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
-#  include <fcntl.h>    /* _O_BINARY */
-#  include <io.h>       /* _setmode, _isatty */
-#  define SET_BINARY_MODE(file) _setmode(_fileno(file), _O_BINARY)
+#  include <io.h>       /* _isatty */
 #  define IS_CONSOLE(stdStream) _isatty(_fileno(stdStream))
 #else
    extern int fileno(FILE *stream);  /* triggers fileno() within <stdio.h> on POSIX */
 #  include <unistd.h>   /* isatty */
-#  define SET_BINARY_MODE(file)
 #  define IS_CONSOLE(stdStream) isatty(fileno(stdStream))
 #endif