Commit Graph

1804 Commits

Author SHA1 Message Date
senhuang42
a030560d62 Add new DCtx param: validateChecksum and update unit tests 2020-08-24 17:28:00 -04:00
senhuang42
44c54a3e31 Addressing comments: more comments, cleanup, remove extra function, checksum logic 2020-08-24 16:14:19 -04:00
senhuang42
ffaa0df76d Document change in CLI for --no-check during decompression in --help menu 2020-08-24 09:49:12 -04:00
senhuang42
e3f5f9658a Added CLI tests for --no-check, fixed ignore checksum logic 2020-08-22 16:05:40 -04:00
senhuang42
47685ac856 Move enum into zstd.h, and fix pesky switch() logic 2020-08-21 18:18:53 -04:00
senhuang42
1b34b15e6b Adding CLI capability to invoke decompression with no checksum 2020-08-21 17:49:30 -04:00
W. Felix Handte
953f0a072a Fix MS Build 2020-08-10 17:28:34 -04:00
W. Felix Handte
b02cdf63b0 Clean Up Redundant Checks, Rename FIO_remove() -> FIO_removeFile() 2020-08-10 15:43:17 -04:00
W. Felix Handte
51ac0207af Remove UTIL_statFile() and UTIL_statDir(); Decompose Former Call-Sites 2020-08-10 15:28:02 -04:00
W. Felix Handte
93dda988c8 Remove Unused Function UTIL_fileExist() 2020-08-10 15:22:53 -04:00
W. Felix Handte
76878697a4 Re-Organize and Document Prototypes in util.h 2020-08-10 15:16:14 -04:00
W. Felix Handte
c1449143c5 Share stat() Calls in Uses of UTIL_chmod() 2020-08-05 12:10:42 -04:00
W. Felix Handte
0a8aacb4db Use stat() to Check that File Should be chmod()-ed
Rather than special-casing a check for `/dev/null`, this uses `stat()` to
avoid `chmod()`-ing any non-regular file. I believe this is the desirable
behavior. `UTIL_chmod()` is never called on directories at the moment, only
output files.
2020-08-05 12:00:12 -04:00
W. Felix Handte
7238cca1a1 Deduplicate Some Low-Hanging Fruit of Redundant Stat Calls 2020-08-05 01:08:34 -04:00
W. Felix Handte
44fa052599 Introduce Variants of Various UTIL Functions that Take Pre-Populated stat_t Structs
Instead of calling `stat()`, these functions accept the result of a previous
`stat()` call on the file in question, which will allow us to make multiple
decisions around a file without redundant `stat()` calls.
2020-08-05 01:00:06 -04:00
W. Felix Handte
b6e24bc4dc Rename UTIL_getFileStat() -> UTIL_statFile() and UTIL_getDirectoryStat() -> UTIL_statDir()
I want to introduce versions of many of these functions that take pre-
populated `stat_t` objects and use those rather than doing their own redundant
`stat()` internally. These functions will have `...Stat()` suffixes. So this
commit renames these existing functions into the active voice, to avoid
confusion.
2020-08-05 00:40:16 -04:00
W. Felix Handte
1a1003f996 Mark stat_t Arg to UTIL_setFileStat() const 2020-08-05 00:35:21 -04:00
W. Felix Handte
5fbc6addb6 Additionally Convert UTIL_getFileStat() Calls to UTIL_stat() Where Appropriate 2020-08-05 00:31:48 -04:00
W. Felix Handte
69cb9e7798 Use New Stat Helper 2020-08-05 00:24:32 -04:00
W. Felix Handte
b11bea56a5 Introduce Dedicated Helper to Call stat() 2020-08-05 00:21:21 -04:00
Yann Collet
15c5e20023 updated documentation 2020-07-23 12:10:57 -07:00
Yann Collet
610c41f90f improved 2-args macro to support both syntaxes
both `--long-commmand=arg` and `--long-command arg`
are supported by macro `NEXT_FIELD()`
so that the long-command only needs to be listed once.

This extends the syntax to support new syntaxes like
`-o=FILE` or `-D=dict`,
though there is no need to advertise this capability for the time being.

Also : added `NEXT_UINT32()`,
which is wrapper around `NEXT_FIELD()`
to read integer parameters.
Use the wrapper to new field, such as `--memlimit`
which can now support both syntaxes too.
2020-07-20 17:41:32 -07:00
Yann Collet
23941eec04 added tests for newly enabled syntax
for --patch-from origin
and --filelist list

Also : removed some constrained syntax tests,
as the new argument parsing syntax is more permissive.

For example :
    zstd file -of dest
used to be disallowed.

It's now allowed, and understood as:
    zstd file -o dest -f
2020-07-17 13:31:15 -07:00
Yann Collet
7280c1dafa extended 2-fields macro usage to number arguments
leading to further simplications
2020-07-17 13:09:23 -07:00
Yann Collet
a7e5652672 CLI: simplified handling of separated-fields arguments
this patch reduces complexity associated with
commands requiring a separated arguments
such as :
-o filename
-D dictionary
--output-dir-flat dir
--output-dir-mirror dir

It used to be a multi-stage process with explicit context,
it's now simplified as a single macro.

Thanks to this simplification,
separated arguments logic has also been extended to
--patch-from XXX
--filelist XXX
which extends existing capability using =XXX
--patch-from=XXX
--filelist=XXX

Separated argument is useful for filenames and directories,
as it benefits from shell expansion
such as ~/dir/file
where the ~ is automatically translated by the shell.
In contrast --long-command=FILE does not interpret FILE,
so ~/ is transmitted as is to the main() function,
generally resulting in incorrect file name.
2020-07-17 12:46:36 -07:00
Yann Collet
62df5bca4c
Merge pull request #2243 from facebook/uclibc
fix uclibc's st_mtim
2020-07-17 09:14:20 -07:00
Fabrice Fontaine
26d01bdb26 programs/util.c: fix build without st_mtime
Since version 1.4.5 and commit
5af8cb7aea, if st_mtime is not defined,
programs/util.c uses utime without including utime.h which will raise
the following build failure on some of the buildroot autobuilders:

util.c: In function 'UTIL_setFileStat':
util.c:161:24: error: storage size of 'timebuf' isn't known
         struct utimbuf timebuf;
                        ^~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/be902c5d110f37bce622a2215191f155b7d3e7e0

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-07-15 21:24:13 +02:00
Yann Collet
1dcc478796 fix uclibc's st_mtim
reported and suggested by @ewildgoose (#1872)
2020-07-13 14:16:33 -07:00
Yann Collet
a3296dae38
Merge pull request #2219 from xxie24/output-dir-mirror
Add output-dir-mirror option
2020-07-10 01:21:47 -07:00
Martin Liska
5b9d6b992a
Update comment about PGO build. 2020-07-09 09:31:51 +02:00
Martin Liska
4307e870a2
Rename ZSTDMT_NBTHREADS_MAX to ZSTDMT_NBWORKERS_MAX.
Rename it in zstd man page.
2020-07-07 00:18:20 +02:00
Xin Xie
9a8ccd4ba3 Add output-dir-mirror option 2020-06-24 22:12:11 -07:00
Bimba Shrestha
b06710889f error when not using --stream-size on pipe 2020-06-18 09:31:06 -07:00
Bimba Shrestha
6653321ba3 passing streamSrcSize when set 2020-06-18 09:28:18 -07:00
Tobias Hieta
1c9b1ddac7 Update version documention with the support for -q 2020-06-11 10:56:47 +02:00
Tobias Hieta
b1cce9a6ad Short version string output
This adds support for just showing the version string
without the full welcome message if the log level is
less than the default. That means that you pass -q once
and you will just see "1.4.5".

This makes it easier to parse in scripts.
2020-06-09 08:40:41 +02:00
Bimba Shrestha
e2838d9eb9 Spelling mistakes 2020-06-05 05:11:26 -05:00
Bimba Shrestha
f847909cf2 Using ZSTD_MAX_WINDOWLOG instead of INT_MAX 2020-05-26 09:23:26 -07:00
Bimba Shrestha
01b38ef162 Change --patch-from limit from 4gb to 2gb 2020-05-26 06:52:30 -07:00
Yann Collet
f22b371e31 updated documentation for v1.4.5
API manual and man pages
2020-05-14 16:17:03 -07:00
Bimba Shrestha
12071467d3 reverting docs and test 2020-05-13 15:22:07 -05:00
Bimba Shrestha
9b13077cfb Revert to old zstdgrep 2020-05-13 15:12:14 -05:00
Yann Collet
f5f0bb2591
Merge pull request #2125 from Artoria2e5/patch-2
programs/Makefile: make it actually work with clang
2020-05-12 13:48:23 -07:00
Yann Collet
f13eb2ec01
Merge pull request #2123 from facebook/zstd_help
updated `zstd -h`
2020-05-11 18:54:07 -07:00
Bimba Shrestha
ef467fd428 documenting non-supported grep options for zstdgrep 2020-05-11 12:22:45 -05:00
Yann Collet
93ff2fb329
Merge pull request #2120 from facebook/clevel_doc
updated zstd CLI documentation
2020-05-11 09:42:33 -07:00
Mingye Wang
c3398d2dda
programs/Makefile: make it actually work with clang
Recent versions of clang seem to require a step of conversion from the profraw file to a "compiler-readable" profdata file to let PGO work.
2020-05-10 16:36:08 +08:00
Yann Collet
37b2dafbed minor clarification on -o file 2020-05-08 14:20:47 -07:00
Yann Collet
e5366bee16 updated zstd -h
to help readability.
Group arguments into categories,
try to give better visibility to more common arguments.
2020-05-08 14:14:46 -07:00
W. Felix Handte
376c26bf56 Use Unused Variable 2020-05-08 16:43:39 -04:00