Skip to content

Commit

Permalink
Fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
binhdvo committed Dec 4, 2021
1 parent 8f6f26b commit c9a37fd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
6 changes: 3 additions & 3 deletions programs/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ FIO_openDstFile(FIO_ctx_t* fCtx, FIO_prefs_t* const prefs,
}
#endif
if (!prefs->overwrite) {
if (g_display_prefs.displayLevel <= 1) {
if (g_display_prefs.displayLevel == 0) {
/* No interaction possible */
DISPLAY("zstd: %s already exists; not overwritten \n",
dstFileName);
Expand Down Expand Up @@ -1870,7 +1870,7 @@ int FIO_compressMultipleFilenames(FIO_ctx_t* const fCtx,
/* init */
assert(outFileName != NULL || suffix != NULL);
if (outFileName != NULL) { /* output into a single destination (stdout typically) */
if (FIO_removeMultiFilesWarning(fCtx, prefs, outFileName, 1 /* displayLevelCutoff */)) {
if (FIO_removeMultiFilesWarning(fCtx, prefs, outFileName, 0 /* displayLevelCutoff */)) {
FIO_freeCResources(&ress);
return 1;
}
Expand Down Expand Up @@ -2810,7 +2810,7 @@ FIO_decompressMultipleFilenames(FIO_ctx_t* const fCtx,
dRess_t ress = FIO_createDResources(prefs, dictFileName);

if (outFileName) {
if (FIO_removeMultiFilesWarning(fCtx, prefs, outFileName, 1 /* displayLevelCutoff */)) {
if (FIO_removeMultiFilesWarning(fCtx, prefs, outFileName, 0 /* displayLevelCutoff */)) {
FIO_freeDResources(ress);
return 1;
}
Expand Down
7 changes: 1 addition & 6 deletions programs/zstdcli.c
Original file line number Diff line number Diff line change
Expand Up @@ -1365,12 +1365,7 @@ int main(int argCount, const char* argv[])
/* No status message in pipe mode (stdin - stdout) */
hasStdout = outFileName && !strcmp(outFileName,stdoutmark);

if (hasStdout && (g_displayLevel==2)) g_displayLevel=1;

/* If stderr is not a TTY, imply -q */
if (!IS_CONSOLE(stderr) && g_displayLevel == DISPLAY_LEVEL_DEFAULT) {
g_displayLevel--;
}
if ((hasStdout || !IS_CONSOLE(stderr)) && (g_displayLevel==2)) g_displayLevel=1;

/* IO Stream/File */
FIO_setHasStdoutOutput(fCtx, hasStdout);
Expand Down
6 changes: 3 additions & 3 deletions tests/playTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ zstd -d -f tmp.zst --memlimit=2K -c > $INTOVOID && die "decompression needs more
zstd -d -f tmp.zst --memory=2K -c > $INTOVOID && die "decompression needs more memory than allowed" # long command
zstd -d -f tmp.zst --memlimit-decompress=2K -c > $INTOVOID && die "decompression needs more memory than allowed" # long command
println "test : overwrite protection"
zstd -q tmp && die "overwrite check failed!"
echo "no" | zstd -q tmp && die "overwrite check failed!"
println "test : force overwrite"
zstd -q -f tmp
zstd -q --force tmp
Expand All @@ -266,7 +266,7 @@ rm -f tmpro tmpro.zst
println foo > tmpro.zst
println foo > tmpro
chmod 400 tmpro.zst
zstd -q tmpro && die "should have refused to overwrite read-only file"
echo "no" | zstd -q tmpro && die "should have refused to overwrite read-only file"
zstd -q -f tmpro
println "test: --no-progress flag"
zstd tmpro -c --no-progress | zstd -d -f -o "$INTOVOID" --no-progress
Expand Down Expand Up @@ -416,7 +416,7 @@ zstd tmp1.zst tmp2.zst -o "$INTOVOID" -f
zstd -d tmp1.zst tmp2.zst -o tmp
touch tmpexists
zstd tmp1 tmp2 -f -o tmpexists
zstd tmp1 tmp2 -q -o tmpexists && die "should have refused to overwrite"
echo "no" | zstd tmp1 tmp2 -q -o tmpexists && die "should have refused to overwrite"
println gooder > tmp_rm1
println boi > tmp_rm2
println worldly > tmp_rm3
Expand Down

0 comments on commit c9a37fd

Please sign in to comment.