]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
changed to work with std out
authorPaul Cruz <paulcruz74@fb.com>
Thu, 6 Jul 2017 17:49:26 +0000 (10:49 -0700)
committerPaul Cruz <paulcruz74@fb.com>
Thu, 6 Jul 2017 17:49:26 +0000 (10:49 -0700)
contrib/adaptive-compression/multi.c

index 8371a0bcbb33688ecc4db883003adf4af0edde5f..6459e245ad8b313b1c38cf3d3e72ad8217bc976c 100644 (file)
@@ -274,20 +274,21 @@ static int compressFilename(const char* const srcFilename, const char* const dst
     BYTE* const src = malloc(FILE_CHUNK_SIZE);
     unsigned const stdinUsed = !strcmp(srcFilename, stdinmark);
     FILE* const srcFile = stdinUsed ? stdin : fopen(srcFilename, "rb");
+    const char* const outFilename = (stdinUsed && !dstFilename) ? stdoutmark : dstFilename;
     size_t const numJobs = MAX_NUM_JOBS;
     int ret = 0;
     adaptCCtx* ctx = NULL;
 
 
     /* checking for errors */
-    if (!srcFilename || !dstFilename || !src || !srcFile) {
+    if (!srcFilename || !outFilename || !src || !srcFile) {
         DISPLAY("Error: initial variables could not be allocated\n");
         ret = 1;
         goto cleanup;
     }
 
     /* creating context */
-    ctx = createCCtx(numJobs, dstFilename);
+    ctx = createCCtx(numJobs, outFilename);
     if (ctx == NULL) {
         ret = 1;
         goto cleanup;