changed to work with std out

dev
Paul Cruz 2017-07-06 10:49:26 -07:00
parent 94fe291b83
commit 592a0d9495
1 changed files with 3 additions and 2 deletions

View File

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