Merge pull request #1217 from facebook/dev

fix poolTest for v1.3.5
diff --git a/.travis.yml b/.travis.yml
index bece493..0967f60 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -31,9 +31,7 @@
     - env: Cmd='make ppcinstall && make ppc64fuzz'
     - env: Cmd='make -j uasanregressiontest && make clean && make -j msanregressiontest'
 
-    - env: Cmd='make lz4install && make -C tests test-lz4'
-
-    - env: Cmd='bash tests/libzstd_partial_builds.sh'
+    - env: Cmd='make lz4install && make -C tests test-lz4 test-pool && make clean && bash tests/libzstd_partial_builds.sh'
 
     # tag-specific test
     - if: tag =~ ^v[0-9]\.[0-9]
diff --git a/programs/zstd.1 b/programs/zstd.1
index 507933c..b136bb3 100644
--- a/programs/zstd.1
+++ b/programs/zstd.1
@@ -1,5 +1,5 @@
 .
-.TH "ZSTD" "1" "2018-05-12" "zstd 1.3.4" "User Commands"
+.TH "ZSTD" "1" "2018-06-27" "zstd 1.3.5" "User Commands"
 .
 .SH "NAME"
 \fBzstd\fR \- zstd, zstdmt, unzstd, zstdcat \- Compress or decompress \.zst files
@@ -160,7 +160,7 @@
 .
 .TP
 \fB\-\-format=FORMAT\fR
-compress and decompress in other formats\. If compiled with support, zstd can compress to or decompress from other compression algorithm formats\. Possibly available options are \fBgzip\fR, \fBxz\fR, \fBlzma\fR, and \fBlz4\fR\.
+compress and decompress in other formats\. If compiled with support, zstd can compress to or decompress from other compression algorithm formats\. Possibly available options are \fBzstd\fR, \fBgzip\fR, \fBxz\fR, \fBlzma\fR, and \fBlz4\fR\. If no such format is provided, \fBzstd\fR is the default\.
 .
 .TP
 \fB\-h\fR/\fB\-H\fR, \fB\-\-help\fR
@@ -349,13 +349,13 @@
 For ZSTD_btopt and ZSTD_btultra, it specifies the minimum match length that causes match finder to stop searching for better matches\. A larger \fBtargetLen\fR usually improves compression ratio but decreases compression speed\.
 .
 .IP
-For ZSTD_fast, it specifies the amount of data skipped between match sampling\. Impact is reversed : a larger \fBtargetLen\fR increases compression speed but decreases compression ratio\.
+For ZSTD_fast, it triggers ultra\-fast mode when > 0\. The value represents the amount of data skipped between match sampling\. Impact is reversed : a larger \fBtargetLen\fR increases compression speed but decreases compression ratio\.
 .
 .IP
 For all other strategies, this field has no impact\.
 .
 .IP
-The minimum \fItlen\fR is 1 and the maximum is 999\.
+The minimum \fItlen\fR is 0 and the maximum is 999\.
 .
 .TP
 \fBoverlapLog\fR=\fIovlog\fR, \fBovlog\fR=\fIovlog\fR
diff --git a/programs/zstd.1.md b/programs/zstd.1.md
index 4b38181..c8b8d8d 100644
--- a/programs/zstd.1.md
+++ b/programs/zstd.1.md
@@ -355,14 +355,14 @@
     A larger `targetLen` usually improves compression ratio
     but decreases compression speed.
 
-    For ZSTD\_fast, it specifies
-    the amount of data skipped between match sampling.
+    For ZSTD\_fast, it triggers ultra-fast mode when > 0.
+    The value represents the amount of data skipped between match sampling.
     Impact is reversed : a larger `targetLen` increases compression speed
     but decreases compression ratio.
 
     For all other strategies, this field has no impact.
 
-    The minimum _tlen_ is 1 and the maximum is 999.
+    The minimum _tlen_ is 0 and the maximum is 999.
 
 - `overlapLog`=_ovlog_,  `ovlog`=_ovlog_:
     Determine `overlapSize`, amount of data reloaded from previous job.
diff --git a/programs/zstdcli.c b/programs/zstdcli.c
index 1af5f26..be62046 100644
--- a/programs/zstdcli.c
+++ b/programs/zstdcli.c
@@ -561,13 +561,15 @@
                         continue;
                     }
                     if (longCommandWArg(&argument, "--fast")) {
-                        /* Parse optional window log */
+                        /* Parse optional acceleration factor */
                         if (*argument == '=') {
                             U32 fastLevel;
                             ++argument;
                             fastLevel = readU32FromChar(&argument);
                             if (fastLevel) {
                               dictCLevel = cLevel = -(int)fastLevel;
+                            } else {
+                              CLEAN_RETURN(badusage(programName));
                             }
                         } else if (*argument != 0) {
                             /* Invalid character following --fast */
diff --git a/tests/playTests.sh b/tests/playTests.sh
index 52d4dd0..09a7377 100755
--- a/tests/playTests.sh
+++ b/tests/playTests.sh
@@ -108,6 +108,7 @@
 $ZSTD --fast -f tmp  # == -1
 $ZSTD --fast=3 -f tmp  # == -3
 $ZSTD --fast=200000 -f tmp  # == no compression
+! $ZSTD -c --fast=0 tmp > $INTOVOID # should fail
 $ECHO "test : too large numeric argument"
 $ZSTD --fast=9999999999 -f tmp  && die "should have refused numeric value"
 $ECHO "test : compress to stdout"
@@ -532,7 +533,7 @@
 if [ $GZIPMODE -eq 1 ]; then
     ./datagen > tmp
     rm -f tmp.zst
-    $ZSTD --format=gzip --format=zstd -f tmp 
+    $ZSTD --format=gzip --format=zstd -f tmp
     test -f tmp.zst
 fi
 
@@ -637,11 +638,11 @@
 
 ! $ZSTD -d tmp.abc 2> tmplg
 
-if [ $GZIPMODE -ne 1 ]; then 
+if [ $GZIPMODE -ne 1 ]; then
     grep ".gz" tmplg > $INTOVOID && die "Unsupported suffix listed"
 fi
 
-if [ $LZMAMODE -ne 1 ]; then 
+if [ $LZMAMODE -ne 1 ]; then
     grep ".lzma" tmplg > $INTOVOID && die "Unsupported suffix listed"
     grep ".xz" tmplg > $INTOVOID && die "Unsupported suffix listed"
 fi
diff --git a/tests/poolTests.c b/tests/poolTests.c
index 6a058a5..9661b52 100644
--- a/tests/poolTests.c
+++ b/tests/poolTests.c
@@ -105,7 +105,8 @@
 static int testThreadReduction_internal(POOL_ctx* ctx, poolTest_t test)
 {
     int const nbWaits = 16;
-    UTIL_time_t startTime, time4threads, time2threads;
+    UTIL_time_t startTime;
+    U64 time4threads, time2threads;
 
     test.val = 0;
     test.max = nbWaits;