1
0
mirror of https://github.com/facebook/zstd.git synced 2025-07-30 22:23:13 +03:00

Merge pull request #1214 from jennifermliu/dev

Make --fast=0 fail
This commit is contained in:
Yann Collet
2018-06-27 18:53:39 -07:00
committed by GitHub
2 changed files with 7 additions and 4 deletions

View File

@ -561,13 +561,15 @@ int main(int argCount, const char* argv[])
continue; continue;
} }
if (longCommandWArg(&argument, "--fast")) { if (longCommandWArg(&argument, "--fast")) {
/* Parse optional window log */ /* Parse optional acceleration factor */
if (*argument == '=') { if (*argument == '=') {
U32 fastLevel; U32 fastLevel;
++argument; ++argument;
fastLevel = readU32FromChar(&argument); fastLevel = readU32FromChar(&argument);
if (fastLevel) { if (fastLevel) {
dictCLevel = cLevel = -(int)fastLevel; dictCLevel = cLevel = -(int)fastLevel;
} else {
CLEAN_RETURN(badusage(programName));
} }
} else if (*argument != 0) { } else if (*argument != 0) {
/* Invalid character following --fast */ /* Invalid character following --fast */

View File

@ -108,6 +108,7 @@ $ECHO "test : --fast aka negative compression levels"
$ZSTD --fast -f tmp # == -1 $ZSTD --fast -f tmp # == -1
$ZSTD --fast=3 -f tmp # == -3 $ZSTD --fast=3 -f tmp # == -3
$ZSTD --fast=200000 -f tmp # == no compression $ZSTD --fast=200000 -f tmp # == no compression
! $ZSTD -c --fast=0 tmp > $INTOVOID # should fail
$ECHO "test : too large numeric argument" $ECHO "test : too large numeric argument"
$ZSTD --fast=9999999999 -f tmp && die "should have refused numeric value" $ZSTD --fast=9999999999 -f tmp && die "should have refused numeric value"
$ECHO "test : compress to stdout" $ECHO "test : compress to stdout"
@ -532,7 +533,7 @@ fi
if [ $GZIPMODE -eq 1 ]; then if [ $GZIPMODE -eq 1 ]; then
./datagen > tmp ./datagen > tmp
rm -f tmp.zst rm -f tmp.zst
$ZSTD --format=gzip --format=zstd -f tmp $ZSTD --format=gzip --format=zstd -f tmp
test -f tmp.zst test -f tmp.zst
fi fi
@ -637,11 +638,11 @@ $ECHO "\n===> suffix list test"
! $ZSTD -d tmp.abc 2> tmplg ! $ZSTD -d tmp.abc 2> tmplg
if [ $GZIPMODE -ne 1 ]; then if [ $GZIPMODE -ne 1 ]; then
grep ".gz" tmplg > $INTOVOID && die "Unsupported suffix listed" grep ".gz" tmplg > $INTOVOID && die "Unsupported suffix listed"
fi fi
if [ $LZMAMODE -ne 1 ]; then if [ $LZMAMODE -ne 1 ]; then
grep ".lzma" tmplg > $INTOVOID && die "Unsupported suffix listed" grep ".lzma" tmplg > $INTOVOID && die "Unsupported suffix listed"
grep ".xz" tmplg > $INTOVOID && die "Unsupported suffix listed" grep ".xz" tmplg > $INTOVOID && die "Unsupported suffix listed"
fi fi