]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
added long commands --memory= and --memlimit-decompress=
authorYann Collet <cyan@fb.com>
Fri, 14 Oct 2016 21:22:32 +0000 (14:22 -0700)
committerYann Collet <cyan@fb.com>
Fri, 14 Oct 2016 21:22:32 +0000 (14:22 -0700)
programs/zstdcli.c
tests/playTests.sh

index 9a38ede7ade4a0b7135e217acb8de9338f70b561..da3786d608ff79f000586a564ac9d289c2e5228c 100644 (file)
@@ -281,6 +281,16 @@ int main(int argCount, const char* argv[])
                 memLimit = readU32FromChar(&argument);
                 continue;
             }
+            if (!strncmp(argument, "--memory=", strlen("--memory="))) {
+                argument += strlen("--memory=");
+                memLimit = readU32FromChar(&argument);
+                continue;
+            }
+            if (!strncmp(argument, "--memlimit-decompress=", strlen("--memlimit-decompress="))) {
+                argument += strlen("--memlimit-decompress=");
+                memLimit = readU32FromChar(&argument);
+                continue;
+            }
 
             /* '-' means stdin/stdout */
             if (!strcmp(argument, "-")){
index df9b167f513c4c67b6ba781c0e39d68cb9fd83b4..c5a58d628b8bd22f492b97d55633a411394ceb62 100755 (executable)
@@ -84,6 +84,8 @@ $ZSTD -d  - < tmp.zst > $INTOVOID
 $ECHO "test : impose memory limitation (must fail)"
 $ZSTD -d -f tmp.zst -M2K -c > $INTOVOID && die "decompression needs more memory than allowed"
 $ZSTD -d -f tmp.zst --memlimit=2K -c > $INTOVOID && die "decompression needs more memory than allowed"  # long command
+$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
 $ECHO "test : overwrite protection"
 $ZSTD -q tmp && die "overwrite check failed!"
 $ECHO "test : force overwrite"