mirror of
https://github.com/PCSX2/xz.git
synced 2026-02-04 19:31:17 +01:00
Compare commits
376 Commits
v5.1.1alph
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f76f7516d6 | ||
|
|
3cbcaeb07e | ||
|
|
76762ae609 | ||
|
|
2267f5b0d2 | ||
|
|
cee3021d30 | ||
|
|
c5c7ceb08a | ||
|
|
114cab97af | ||
|
|
b8139e11c5 | ||
|
|
47b59d47cf | ||
|
|
bc19799169 | ||
|
|
fb6d4f83cb | ||
|
|
bc577d35c2 | ||
|
|
713bbc1a80 | ||
|
|
a0ee1afbd9 | ||
|
|
a1e2c568de | ||
|
|
cea5cf8d26 | ||
|
|
95d563db3e | ||
|
|
ab72416d62 | ||
|
|
8238898018 | ||
|
|
94e3f986aa | ||
|
|
0b0e1e6803 | ||
|
|
a015cd1f90 | ||
|
|
c2e29f06a7 | ||
|
|
1520f6ec80 | ||
|
|
8269782283 | ||
|
|
e353d0b1cc | ||
|
|
144ef9e19e | ||
|
|
8c9842c265 | ||
|
|
662b27c417 | ||
|
|
c28f0b3d00 | ||
|
|
bba477257d | ||
|
|
310d19816d | ||
|
|
a27920002d | ||
|
|
a0b1dda409 | ||
|
|
84462afaad | ||
|
|
cbc7401793 | ||
|
|
78ae13bced | ||
|
|
0297863fdb | ||
|
|
d4a0462abe | ||
|
|
a01794c52a | ||
|
|
df8f446e3a | ||
|
|
446e4318fa | ||
|
|
1b0ac0c53c | ||
|
|
c83b7a0334 | ||
|
|
ade31a2bfb | ||
|
|
ac398c3baf | ||
|
|
6fd5ecb589 | ||
|
|
473ef0dc69 | ||
|
|
faf302137e | ||
|
|
e52e9151cf | ||
|
|
14115f84a3 | ||
|
|
f4c95ba94b | ||
|
|
c7bc20a6f3 | ||
|
|
5cbca1205d | ||
|
|
af13781886 | ||
|
|
9fa5949330 | ||
|
|
cb3111e3ed | ||
|
|
4cc584985c | ||
|
|
23ed1d4148 | ||
|
|
b0bc3e0385 | ||
|
|
c6bf438ab3 | ||
|
|
e18adc56f2 | ||
|
|
282e768a14 | ||
|
|
372e402713 | ||
|
|
21515d79d7 | ||
|
|
09f395b6b3 | ||
|
|
3bf857edfe | ||
|
|
7f05803979 | ||
|
|
397fcc0946 | ||
|
|
cbc9e39bae | ||
|
|
bcacd8ce7a | ||
|
|
0275a5398c | ||
|
|
a74525cf9b | ||
|
|
fbbb295a91 | ||
|
|
713dbe5c23 | ||
|
|
3a5d755d05 | ||
|
|
b0798c6aa6 | ||
|
|
9b02a4ffda | ||
|
|
c7f4041f6b | ||
|
|
17b29d4f0a | ||
|
|
49c26920d6 | ||
|
|
5b2458cb24 | ||
|
|
6bd0349c58 | ||
|
|
fc0df0f8db | ||
|
|
57393615b3 | ||
|
|
1238381143 | ||
|
|
29a087fb5a | ||
|
|
6e845c6a3e | ||
|
|
3717885f9e | ||
|
|
eccd8155e1 | ||
|
|
25263fd9e7 | ||
|
|
4c544d2410 | ||
|
|
e0ea6737b0 | ||
|
|
8bcca29a65 | ||
|
|
f243f5f44c | ||
|
|
7f0a4c50f4 | ||
|
|
f6ec468015 | ||
|
|
a24518971c | ||
|
|
dec11497a7 | ||
|
|
29e39c7997 | ||
|
|
7a11c4a8e5 | ||
|
|
117d962685 | ||
|
|
ae984e31c1 | ||
|
|
2205bb5853 | ||
|
|
d935b0cdf3 | ||
|
|
eb61bc58c2 | ||
|
|
b9a5b6b7a2 | ||
|
|
c45757135f | ||
|
|
3c500174ed | ||
|
|
fec88d41e6 | ||
|
|
a9b45badfe | ||
|
|
541aee6dd4 | ||
|
|
4170edc914 | ||
|
|
04bbc0c284 | ||
|
|
f0f1f6c723 | ||
|
|
d2d484647d | ||
|
|
aae6a6aeda | ||
|
|
7815112153 | ||
|
|
a0cd05ee71 | ||
|
|
b85ee0905e | ||
|
|
cbafa71091 | ||
|
|
8dbb57238d | ||
|
|
6060f7dc76 | ||
|
|
3e8bd1d15e | ||
|
|
72f7307cfd | ||
|
|
2cb82ff21c | ||
|
|
9b9e3536e4 | ||
|
|
a8b6b569e7 | ||
|
|
f168a6fd1a | ||
|
|
cec2ee863b | ||
|
|
42e97a3264 | ||
|
|
29b95d5d66 | ||
|
|
3af91040bb | ||
|
|
0152f72bf6 | ||
|
|
4a1f6133ee | ||
|
|
7f7d093de7 | ||
|
|
009823448b | ||
|
|
7dddfbeb49 | ||
|
|
6eca5be40e | ||
|
|
d1003673e9 | ||
|
|
4c5aa911a0 | ||
|
|
3e3099e36d | ||
|
|
e7d96a5933 | ||
|
|
46cbb9033a | ||
|
|
7ce49d444f | ||
|
|
214c553ebc | ||
|
|
1190c641af | ||
|
|
e4fc1d2f95 | ||
|
|
34f9e40a0a | ||
|
|
6d9c0ce9f2 | ||
|
|
2301f3f05d | ||
|
|
107a263d5b | ||
|
|
b13a781833 | ||
|
|
542cac122e | ||
|
|
7b03a15cea | ||
|
|
f8c13e5e36 | ||
|
|
7716dcf9df | ||
|
|
230fa4a605 | ||
|
|
4e4ae08bc7 | ||
|
|
c923b140b2 | ||
|
|
08c2aa16be | ||
|
|
2f9f61aa83 | ||
|
|
4f9d233f67 | ||
|
|
00502b2bed | ||
|
|
706b049675 | ||
|
|
7c32e6a935 | ||
|
|
076258cc45 | ||
|
|
efa7b0a210 | ||
|
|
9c5f76098c | ||
|
|
c4911f2db3 | ||
|
|
76e75522ed | ||
|
|
d62028b4c1 | ||
|
|
c35de31d42 | ||
|
|
e9e097e22c | ||
|
|
642f856bb8 | ||
|
|
6b5e3b9eff | ||
|
|
9adbc2ff37 | ||
|
|
0e0f34b8e4 | ||
|
|
71e1437ab5 | ||
|
|
41dc9ea06e | ||
|
|
5dcffdbcc2 | ||
|
|
a9477d1e0c | ||
|
|
5a76c7c8ee | ||
|
|
9a096f8e57 | ||
|
|
bc7650d87b | ||
|
|
544aaa3d13 | ||
|
|
f48fce093b | ||
|
|
6bf5308e34 | ||
|
|
353212137e | ||
|
|
5db75054e9 | ||
|
|
e1c8f1d01f | ||
|
|
765735cf52 | ||
|
|
59da01785e | ||
|
|
17215f751c | ||
|
|
96864a6ddf | ||
|
|
a115cc3748 | ||
|
|
3ce3e79769 | ||
|
|
381ac14ed7 | ||
|
|
4244b65b06 | ||
|
|
1e60f2c0a0 | ||
|
|
ceca379017 | ||
|
|
8c19216bac | ||
|
|
87f1a24810 | ||
|
|
da1718f266 | ||
|
|
28af24e9cf | ||
|
|
ed9ac85822 | ||
|
|
d716acdae3 | ||
|
|
4d5b7b3fda | ||
|
|
1555a9c566 | ||
|
|
56056571df | ||
|
|
6de61d8721 | ||
|
|
54df428799 | ||
|
|
5876ca27da | ||
|
|
9494fb6d0f | ||
|
|
673a4cb53d | ||
|
|
ad96a871a1 | ||
|
|
3d5c090872 | ||
|
|
69fd4e1c93 | ||
|
|
a19d9e8575 | ||
|
|
e28528f1c8 | ||
|
|
5ad1effc45 | ||
|
|
3e62c68d75 | ||
|
|
e90ea601fb | ||
|
|
b22e94d8d1 | ||
|
|
d1cd8b1cb8 | ||
|
|
76be7c612e | ||
|
|
dd750acbe2 | ||
|
|
ae222fe980 | ||
|
|
2193837a6a | ||
|
|
ed48e75e27 | ||
|
|
841da0352d | ||
|
|
56feb8665b | ||
|
|
ba413da1d5 | ||
|
|
0cd45fc2bc | ||
|
|
97bb38712f | ||
|
|
fef0c6b410 | ||
|
|
8083e03291 | ||
|
|
6b44b4a775 | ||
|
|
ae0ab74a88 | ||
|
|
72975df6c8 | ||
|
|
1c2b6e7e83 | ||
|
|
124eb69c78 | ||
|
|
eada8a875c | ||
|
|
be0100d01c | ||
|
|
416729e2d7 | ||
|
|
16581080e5 | ||
|
|
3e2b198ba3 | ||
|
|
dee6ad3d59 | ||
|
|
fa381acaf9 | ||
|
|
ea00545bea | ||
|
|
736903c64b | ||
|
|
24edf8d807 | ||
|
|
c0627b3fce | ||
|
|
1936718bb3 | ||
|
|
a37ae8b5eb | ||
|
|
cdba9ddd87 | ||
|
|
e61a5c95da | ||
|
|
9dc319eabb | ||
|
|
3541bc79d0 | ||
|
|
78673a08be | ||
|
|
a616fdad34 | ||
|
|
4a08a6e4c6 | ||
|
|
b790b435da | ||
|
|
84d2da6c9d | ||
|
|
9376f5f8f7 | ||
|
|
b7e200d7bd | ||
|
|
46540e4c10 | ||
|
|
ebb501ec73 | ||
|
|
c09e91dd23 | ||
|
|
eb6ca9854b | ||
|
|
0c0a1947e6 | ||
|
|
2fcda89939 | ||
|
|
97379c5ea7 | ||
|
|
8957c58609 | ||
|
|
ed886e1a92 | ||
|
|
5019413a05 | ||
|
|
5ea900cb5a | ||
|
|
bb117fffa8 | ||
|
|
e572e123b5 | ||
|
|
b465da5988 | ||
|
|
9e6dabcf22 | ||
|
|
e7b424d267 | ||
|
|
2ebbb994e3 | ||
|
|
4c7e28705f | ||
|
|
db5c1817fa | ||
|
|
65536214a3 | ||
|
|
3d93b63549 | ||
|
|
ab22562066 | ||
|
|
f3c1ec69d9 | ||
|
|
d8eaf9d827 | ||
|
|
96e08902b0 | ||
|
|
3778db1be5 | ||
|
|
d625c7cf82 | ||
|
|
0b09d266cc | ||
|
|
d6e0b23d46 | ||
|
|
19de545d86 | ||
|
|
672eccf57c | ||
|
|
cafb523ada | ||
|
|
c7ff218528 | ||
|
|
8f3c1d886f | ||
|
|
0d5fa05466 | ||
|
|
df11317985 | ||
|
|
bd9cc179e8 | ||
|
|
4a238dd9b2 | ||
|
|
88ccf47205 | ||
|
|
972179cdcd | ||
|
|
1403707fc6 | ||
|
|
eccd8017ff | ||
|
|
2e6754eac2 | ||
|
|
b3235a0b1a | ||
|
|
f1675f765f | ||
|
|
3a0c5378ab | ||
|
|
1bd2c2c553 | ||
|
|
905f0ab5b5 | ||
|
|
4bd1a3bd5f | ||
|
|
d2e836f2f3 | ||
|
|
c9a1615157 | ||
|
|
1530a74fd4 | ||
|
|
d8db706acb | ||
|
|
3f94b6d87f | ||
|
|
7769ea051d | ||
|
|
ec92110572 | ||
|
|
27d24eb0a9 | ||
|
|
ab25b82a91 | ||
|
|
d05d6d65c4 | ||
|
|
e077391982 | ||
|
|
fc39849c35 | ||
|
|
29fa0566d5 | ||
|
|
aac1b31ea4 | ||
|
|
df14a46013 | ||
|
|
03ed742a3a | ||
|
|
8c5b13ad59 | ||
|
|
c7376fc415 | ||
|
|
cff070aba6 | ||
|
|
41cafb2bf9 | ||
|
|
2dcea03712 | ||
|
|
7db6bdf4ab | ||
|
|
694952d545 | ||
|
|
418fe668b3 | ||
|
|
7081d82c37 | ||
|
|
232fe7cd70 | ||
|
|
74d2bae4d3 | ||
|
|
4ac4923f47 | ||
|
|
ab50ae3ef4 | ||
|
|
6b620a0f08 | ||
|
|
bd52cf150e | ||
|
|
5c5b225696 | ||
|
|
5b1e1f1074 | ||
|
|
e9ed88126e | ||
|
|
1c673e5681 | ||
|
|
324cde7a86 | ||
|
|
492c863455 | ||
|
|
fc4d443696 | ||
|
|
bd35d903a0 | ||
|
|
afbb244362 | ||
|
|
79bef85e05 | ||
|
|
c029744506 | ||
|
|
8bd91918ac | ||
|
|
fe00f95828 | ||
|
|
21b45b9bab | ||
|
|
48053e8a45 | ||
|
|
bba37df2c9 | ||
|
|
4161d76349 | ||
|
|
b94aa0c838 | ||
|
|
f004128678 | ||
|
|
f779516f42 | ||
|
|
830ba58777 | ||
|
|
ec7106309c | ||
|
|
4c6e146df9 | ||
|
|
7a480e4859 | ||
|
|
c29e6630c1 | ||
|
|
0b77c4a751 | ||
|
|
e4622df9ab | ||
|
|
9c1b05828a | ||
|
|
3de00cc75d | ||
|
|
bd5002f582 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,6 +1,7 @@
|
||||
*~
|
||||
*.bak
|
||||
*.bak[0-9]
|
||||
.gdb_history
|
||||
|
||||
.deps
|
||||
.libs
|
||||
@@ -29,6 +30,7 @@ build-aux/depcomp
|
||||
build-aux/install-sh
|
||||
build-aux/ltmain.sh
|
||||
build-aux/missing
|
||||
build-aux/test-driver
|
||||
|
||||
/src/liblzma/liblzma.pc
|
||||
/src/lzmainfo/lzmainfo
|
||||
|
||||
6
AUTHORS
6
AUTHORS
@@ -16,11 +16,11 @@ Authors of XZ Utils
|
||||
|
||||
Some scripts have been adapted from gzip. The original versions
|
||||
were written by Jean-loup Gailly, Charles Levert, and Paul Eggert.
|
||||
Andrew Dudman helped adapting the script and their man pages for
|
||||
Andrew Dudman helped adapting the scripts and their man pages for
|
||||
XZ Utils.
|
||||
|
||||
The GNU Autotools based build system contains files from many authors,
|
||||
which I'm not trying list here.
|
||||
The GNU Autotools-based build system contains files from many authors,
|
||||
which I'm not trying to list here.
|
||||
|
||||
Several people have contributed fixes or reported bugs. Most of them
|
||||
are mentioned in the file THANKS.
|
||||
|
||||
2
COPYING
2
COPYING
@@ -47,7 +47,7 @@ XZ Utils Licensing
|
||||
naturally it is not legally required. Here is an example of a good
|
||||
notice to put into "about box" or into documentation:
|
||||
|
||||
This software includes code from XZ Utils <http://tukaani.org/xz/>.
|
||||
This software includes code from XZ Utils <https://tukaani.org/xz/>.
|
||||
|
||||
The following license texts are included in the following files:
|
||||
- COPYING.LGPLv2.1: GNU Lesser General Public License version 2.1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
See the commit log in the git repository:
|
||||
|
||||
git clone http://git.tukaani.org/xz.git
|
||||
git clone https://git.tukaani.org/xz.git
|
||||
|
||||
Note that "make dist" doesn't put this tiny file into the package.
|
||||
Instead, the git commit log is used as ChangeLog. See dist-hook in
|
||||
|
||||
251
INSTALL
251
INSTALL
@@ -6,12 +6,14 @@ XZ Utils Installation
|
||||
1. Supported platforms
|
||||
1.1. Compilers
|
||||
1.2. Platform-specific notes
|
||||
1.2.1. IRIX
|
||||
1.2.2. MINIX 3
|
||||
1.2.3. OpenVMS
|
||||
1.2.4. Tru64
|
||||
1.2.5. Windows
|
||||
1.2.6. DOS
|
||||
1.2.1. AIX
|
||||
1.2.2. IRIX
|
||||
1.2.3. MINIX 3
|
||||
1.2.4. OpenVMS
|
||||
1.2.5. Solaris, OpenSolaris, and derivatives
|
||||
1.2.6. Tru64
|
||||
1.2.7. Windows
|
||||
1.2.8. DOS
|
||||
1.3. Adding support for new platforms
|
||||
2. configure options
|
||||
2.1. Static vs. dynamic linking of liblzma
|
||||
@@ -24,6 +26,8 @@ XZ Utils Installation
|
||||
4.2. "No POSIX conforming shell (sh) was found."
|
||||
4.3. configure works but build fails at crc32_x86.S
|
||||
4.4. Lots of warnings about symbol visibility
|
||||
4.5. "make check" fails
|
||||
4.6. liblzma.so (or similar) not found when running xz
|
||||
|
||||
|
||||
0. Preface
|
||||
@@ -62,7 +66,14 @@ XZ Utils Installation
|
||||
|
||||
1.2. Platform-specific notes
|
||||
|
||||
1.2.1. IRIX
|
||||
1.2.1. AIX
|
||||
|
||||
If you use IBM XL C compiler, pass CC=xlc_r to configure. If
|
||||
you use CC=xlc instead, you must disable threading support
|
||||
with --disable-threads (usually not recommended).
|
||||
|
||||
|
||||
1.2.2. IRIX
|
||||
|
||||
MIPSpro 7.4.4m has been reported to produce broken code if using
|
||||
the -O2 optimization flag ("make check" fails). Using -O1 should
|
||||
@@ -73,16 +84,18 @@ XZ Utils Installation
|
||||
putting "-64" to CFLAGS to build a 64-bit version might help too.
|
||||
|
||||
|
||||
1.2.2. MINIX 3
|
||||
1.2.3. MINIX 3
|
||||
|
||||
The default install of MINIX 3 includes Amsterdam Compiler Kit (ACK),
|
||||
which doesn't support C99. Install GCC to compile XZ Utils.
|
||||
|
||||
MINIX 3.1.8 (and possibly some other versions too) has bugs in
|
||||
/usr/include/stdint.h, which has to be patched before XZ Utils
|
||||
can be compiled correctly. See
|
||||
MINIX 3.1.8 and older have bugs in /usr/include/stdint.h, which has
|
||||
to be patched before XZ Utils can be compiled correctly. See
|
||||
<http://gforge.cs.vu.nl/gf/project/minix/tracker/?action=TrackerItemEdit&tracker_item_id=537>.
|
||||
|
||||
MINIX 3.2.0 and later use a different libc and aren't affected by
|
||||
the above bug.
|
||||
|
||||
XZ Utils doesn't have code to detect the amount of physical RAM and
|
||||
number of CPU cores on MINIX 3.
|
||||
|
||||
@@ -90,7 +103,7 @@ XZ Utils Installation
|
||||
may want to pass gl_cv_cc_visibility=no to configure).
|
||||
|
||||
|
||||
1.2.3. OpenVMS
|
||||
1.2.4. OpenVMS
|
||||
|
||||
XZ Utils can be built for OpenVMS, but the build system files
|
||||
are not included in the XZ Utils source package. The required
|
||||
@@ -100,34 +113,60 @@ XZ Utils Installation
|
||||
http://nchrem.tnw.tudelft.nl/openvms/software2.html#xzutils
|
||||
|
||||
|
||||
1.2.4. Tru64
|
||||
1.2.5. Solaris, OpenSolaris, and derivatives
|
||||
|
||||
The following linker error has been reported on some x86 systems:
|
||||
|
||||
ld: fatal: relocation error: R_386_GOTOFF: ...
|
||||
|
||||
This can be worked around by passing gl_cv_cc_visibility=no
|
||||
as an argument to the configure script.
|
||||
|
||||
test_scripts.sh in "make check" may fail if good enough tools are
|
||||
missing from PATH (/usr/xpg4/bin or /usr/xpg6/bin). See sections
|
||||
4.5 and 3.2 for more information.
|
||||
|
||||
|
||||
1.2.6. Tru64
|
||||
|
||||
If you try to use the native C compiler on Tru64 (passing CC=cc to
|
||||
configure), you may need the workaround mention in section 4.1 in
|
||||
this file (pass also ac_cv_prog_cc_c99= to configure).
|
||||
|
||||
|
||||
1.2.5. Windows
|
||||
1.2.7. Windows
|
||||
|
||||
Building XZ Utils on Windows is supported under MinGW + MSYS,
|
||||
MinGW-w64 + MSYS, and Cygwin. There is windows/build.bash to
|
||||
ease packaging XZ Utils with MinGW(-w64) + MSYS into a
|
||||
redistributable .zip or .7z file. See windows/INSTALL-Windows.txt
|
||||
for more information.
|
||||
Building XZ Utils on Windows is supported under the following
|
||||
environments:
|
||||
|
||||
It might be possible to build liblzma with a non-GNU toolchain too,
|
||||
but that will probably require writing a separate makefile. Building
|
||||
- MinGW-w64 + MSYS (32-bit and 64-bit x86): This is used
|
||||
for building the official binary packages for Windows.
|
||||
There is windows/build.bash to ease packaging XZ Utils with
|
||||
MinGW(-w64) + MSYS into a redistributable .zip or .7z file.
|
||||
See windows/INSTALL-MinGW.txt for more information.
|
||||
|
||||
- MinGW + MSYS (32-bit x86): I haven't recently tested this.
|
||||
|
||||
- Cygwin 1.7.35 and later: NOTE that using XZ Utils >= 5.2.0
|
||||
under Cygwin older than 1.7.35 can lead to DATA LOSS! If
|
||||
you must use an old Cygwin version, stick to XZ Utils 5.0.x
|
||||
which is safe under older Cygwin versions. You can check
|
||||
the Cygwin version with the command "cygcheck -V".
|
||||
|
||||
- Microsoft Visual Studio 2013 update 2 or later (MSVC for short):
|
||||
See windows/INSTALL-MSVC.txt for more information.
|
||||
|
||||
It may be possible to build liblzma with other toolchains too, but
|
||||
that will probably require writing a separate makefile. Building
|
||||
the command line tools with non-GNU toolchains will be harder than
|
||||
building only liblzma.
|
||||
|
||||
Even if liblzma is built with MinGW, the resulting DLL or static
|
||||
library can be used by other compilers and linkers, including MSVC.
|
||||
Thus, it shouldn't be a problem to use MinGW to build liblzma even
|
||||
if you cannot use MinGW to build the rest of your project. See
|
||||
Even if liblzma is built with MinGW(-w64), the resulting DLL can
|
||||
be used by other compilers and linkers, including MSVC. See
|
||||
windows/README-Windows.txt for details.
|
||||
|
||||
|
||||
1.2.6. DOS
|
||||
1.2.8. DOS
|
||||
|
||||
There is an experimental Makefile in the "dos" directory to build
|
||||
XZ Utils on DOS using DJGPP. Support for long file names (LFN) is
|
||||
@@ -207,6 +246,42 @@ XZ Utils Installation
|
||||
the liblzma ABI, so this option should be used only when
|
||||
it is known to not cause problems.
|
||||
|
||||
--enable-external-sha256
|
||||
Try to use SHA-256 code from the operating system libc
|
||||
or similar base system libraries. This doesn't try to
|
||||
use OpenSSL or libgcrypt or such libraries.
|
||||
|
||||
The reasons to use this option:
|
||||
|
||||
- It makes liblzma slightly smaller.
|
||||
|
||||
- It might improve SHA-256 speed if the implementation
|
||||
in the operating is very good (but see below).
|
||||
|
||||
External SHA-256 is disabled by default for two reasons:
|
||||
|
||||
- On some operating systems the symbol names of the
|
||||
SHA-256 functions conflict with OpenSSL's libcrypto.
|
||||
This causes weird problems such as decompression
|
||||
errors if an application is linked against both
|
||||
liblzma and libcrypto. This problem affects at least
|
||||
FreeBSD 10 and older and MINIX 3.3.0 and older, but
|
||||
other OSes that provide a function "SHA256_Init" might
|
||||
also be affected. FreeBSD 11 has the problem fixed.
|
||||
NetBSD had the problem but it was fixed it in 2009
|
||||
already. OpenBSD uses "SHA256Init" and thus never had
|
||||
a conflict with libcrypto.
|
||||
|
||||
- The SHA-256 code in liblzma is faster than the SHA-256
|
||||
code provided by some operating systems. If you are
|
||||
curious, build two copies of xz (internal and external
|
||||
SHA-256) and compare the decompression (xz --test)
|
||||
times:
|
||||
|
||||
dd if=/dev/zero bs=1024k count=1024 \
|
||||
| xz -v -0 -Csha256 > foo.xz
|
||||
time xz --test foo.xz
|
||||
|
||||
--disable-xz
|
||||
--disable-xzdec
|
||||
--disable-lzmadec
|
||||
@@ -230,6 +305,12 @@ XZ Utils Installation
|
||||
Don't install the scripts xzdiff, xzgrep, xzmore, xzless,
|
||||
and their symlinks.
|
||||
|
||||
--disable-doc
|
||||
Don't install the documentation files to $docdir
|
||||
(often /usr/doc/xz or /usr/local/doc/xz). Man pages
|
||||
will still be installed. The $docdir can be changed
|
||||
with --docdir=DIR.
|
||||
|
||||
--disable-assembler
|
||||
liblzma includes some assembler optimizations. Currently
|
||||
there is only assembler code for CRC32 and CRC64 for
|
||||
@@ -286,16 +367,65 @@ XZ Utils Installation
|
||||
the amount of RAM on the operating system you use. See
|
||||
src/common/tuklib_physmem.c for details.
|
||||
|
||||
--disable-threads
|
||||
Disable threading support. This makes some things
|
||||
thread-unsafe, meaning that if multithreaded application
|
||||
calls liblzma functions from more than one thread,
|
||||
something bad may happen.
|
||||
--enable-threads=METHOD
|
||||
Threading support is enabled by default so normally there
|
||||
is no need to specify this option.
|
||||
|
||||
Use this option if threading support causes you trouble,
|
||||
or if you know that you will use liblzma only from
|
||||
single-threaded applications and want to avoid dependency
|
||||
on libpthread.
|
||||
Supported values for METHOD:
|
||||
|
||||
yes Autodetect the threading method. If none
|
||||
is found, configure will give an error.
|
||||
|
||||
posix Use POSIX pthreads. This is the default
|
||||
except on Windows outside Cygwin.
|
||||
|
||||
win95 Use Windows 95 compatible threads. This
|
||||
is compatible with Windows XP and later
|
||||
too. This is the default for 32-bit x86
|
||||
Windows builds. The `win95' threading is
|
||||
incompatible with --enable-small.
|
||||
|
||||
vista Use Windows Vista compatible threads. The
|
||||
resulting binaries won't run on Windows XP
|
||||
or older. This is the default for Windows
|
||||
excluding 32-bit x86 builds (that is, on
|
||||
x86-64 the default is `vista').
|
||||
|
||||
no Disable threading support. This is the
|
||||
same as using --disable-threads.
|
||||
NOTE: If combined with --enable-small, the
|
||||
resulting liblzma won't be thread safe,
|
||||
that is, if a multi-threaded application
|
||||
calls any liblzma functions from more than
|
||||
one thread, something bad may happen.
|
||||
|
||||
--enable-sandbox=METHOD
|
||||
There is limited sandboxing support in the xz tool. If
|
||||
built with sandbox support, it's used automatically when
|
||||
(de)compressing exactly one file to standard output and
|
||||
the options --files or --files0 weren't used. This is a
|
||||
common use case, for example, (de)compressing .tar.xz
|
||||
files via GNU tar. The sandbox is also used for
|
||||
single-file `xz --test' or `xz --list'.
|
||||
|
||||
Supported METHODs:
|
||||
|
||||
auto Look for a supported sandboxing method
|
||||
and use it if found. If no method is
|
||||
found, then sandboxing isn't used.
|
||||
This is the default.
|
||||
|
||||
no Disable sandboxing support.
|
||||
|
||||
capsicum
|
||||
Use Capsicum (FreeBSD >= 10) for
|
||||
sandboxing. If no Capsicum support
|
||||
is found, configure will give an error.
|
||||
|
||||
--enable-symbol-versions
|
||||
Use symbol versioning for liblzma. This is enabled by
|
||||
default on GNU/Linux, other GNU-based systems, and
|
||||
FreeBSD.
|
||||
|
||||
--enable-debug
|
||||
This enables the assert() macro and possibly some other
|
||||
@@ -366,11 +496,16 @@ XZ Utils Installation
|
||||
gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
|
||||
script.
|
||||
|
||||
Some of the scripts require also mktemp. The original mktemp can be
|
||||
found from <http://www.mktemp.org/>. On GNU, most will use the mktemp
|
||||
program from GNU coreutils instead of the original implementation.
|
||||
Both mktemp versions are fine for XZ Utils (and practically for
|
||||
everything else too).
|
||||
xzdiff (xzcmp/lzdiff/lzcmp) may use mktemp if it is available. As
|
||||
a fallback xzdiff will use mkdir to securely create a temporary
|
||||
directory. Having mktemp available is still recommended since the
|
||||
mkdir fallback method isn't as robust as mktemp is. The original
|
||||
mktemp can be found from <http://www.mktemp.org/>. On GNU, most will
|
||||
use the mktemp program from GNU coreutils instead of the original
|
||||
implementation. Both mktemp versions are fine.
|
||||
|
||||
In addition to using xz to decompress .xz files, xzgrep and xzdiff
|
||||
use gzip, bzip2, and lzop to support .gz, bz2, and .lzo files.
|
||||
|
||||
|
||||
3.2. PATH
|
||||
@@ -411,7 +546,8 @@ XZ Utils Installation
|
||||
to POSIX. The configure script tries to find such a shell. If
|
||||
it fails, you can force the shell to be used by passing
|
||||
gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
|
||||
script.
|
||||
script. Alternatively you can omit the installation of scripts and
|
||||
this error by passing --disable-scripts to configure.
|
||||
|
||||
|
||||
4.3. configure works but build fails at crc32_x86.S
|
||||
@@ -442,3 +578,36 @@ XZ Utils Installation
|
||||
resulting binaries, but fewer warnings looks nicer and may allow
|
||||
using --enable-werror.
|
||||
|
||||
|
||||
4.5. "make check" fails
|
||||
|
||||
If the other tests pass but test_scripts.sh fails, then the problem
|
||||
is in the scripts in src/scripts. Comparing the contents of
|
||||
tests/xzgrep_test_output to tests/xzgrep_expected_output might
|
||||
give a good idea about problems in xzgrep. One possibility is that
|
||||
some tools are missing from the current PATH or the tools lack
|
||||
support for some POSIX features. This can happen at least on
|
||||
Solaris where the tools in /bin may be ancient but good enough
|
||||
tools are available in /usr/xpg4/bin or /usr/xpg6/bin. One fix
|
||||
for this problem is described in section 3.2 of this file.
|
||||
|
||||
If tests other than test_scripts.sh fail, a likely reason is that
|
||||
libtool links the test programs against an installed version of
|
||||
liblzma instead of the version that was just built. This is
|
||||
obviously a bug which seems to happen on some platforms.
|
||||
A workaround is to uninstall the old liblzma versions first.
|
||||
|
||||
If the problem isn't any of those described above, then it's likely
|
||||
a bug in XZ Utils or in the compiler. See the platform-specific
|
||||
notes in this file for possible known problems. Please report
|
||||
a bug if you cannot solve the problem. See README for contact
|
||||
information.
|
||||
|
||||
|
||||
4.6. liblzma.so (or similar) not found when running xz
|
||||
|
||||
If you installed the package with "make install" and get an error
|
||||
about liblzma.so (or a similarly named file) being missing, try
|
||||
running "ldconfig" to update the run-time linker cache (if your
|
||||
operating system has such a command).
|
||||
|
||||
|
||||
23
Makefile.am
23
Makefile.am
@@ -5,6 +5,9 @@
|
||||
## You can do whatever you want with this file.
|
||||
##
|
||||
|
||||
# Use -n to prevent gzip from adding a timestamp to the .gz headers.
|
||||
GZIP_ENV = -9n
|
||||
|
||||
DIST_SUBDIRS = lib src po tests debug
|
||||
SUBDIRS =
|
||||
|
||||
@@ -14,6 +17,7 @@ endif
|
||||
|
||||
SUBDIRS += src po tests
|
||||
|
||||
if COND_DOC
|
||||
dist_doc_DATA = \
|
||||
AUTHORS \
|
||||
COPYING \
|
||||
@@ -29,13 +33,24 @@ dist_doc_DATA = \
|
||||
|
||||
examplesdir = $(docdir)/examples
|
||||
dist_examples_DATA = \
|
||||
doc/examples/xz_pipe_comp.c \
|
||||
doc/examples/xz_pipe_decomp.c
|
||||
doc/examples/00_README.txt \
|
||||
doc/examples/01_compress_easy.c \
|
||||
doc/examples/02_decompress.c \
|
||||
doc/examples/03_compress_custom.c \
|
||||
doc/examples/04_compress_easy_mt.c \
|
||||
doc/examples/Makefile
|
||||
|
||||
examplesolddir = $(docdir)/examples_old
|
||||
dist_examplesold_DATA = \
|
||||
doc/examples_old/xz_pipe_comp.c \
|
||||
doc/examples_old/xz_pipe_decomp.c
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
extra \
|
||||
dos \
|
||||
windows \
|
||||
macosx \
|
||||
autogen.sh \
|
||||
Doxyfile.in \
|
||||
COPYING.GPLv2 \
|
||||
@@ -62,7 +77,8 @@ manfiles = \
|
||||
# Convert the man pages to PDF and plain text (ASCII only) formats.
|
||||
dist-hook:
|
||||
if test -d "$(srcdir)/.git" && type git > /dev/null 2>&1; then \
|
||||
( cd "$(srcdir)" && git log --date=iso --stat ) \
|
||||
( cd "$(srcdir)" && git log --date=iso --stat \
|
||||
b667a3ef6338a2c1db7b7706b1f6c99ea392221c^..HEAD ) \
|
||||
> "$(distdir)/ChangeLog"; \
|
||||
fi
|
||||
if type groff > /dev/null 2>&1 && type ps2pdf > /dev/null 2>&1; then \
|
||||
@@ -84,6 +100,7 @@ dist-hook:
|
||||
|
||||
# This works with GNU tar and gives cleaner package than normal 'make dist'.
|
||||
mydist:
|
||||
sh "$(srcdir)/src/liblzma/validate_map.sh"
|
||||
VERSION=$(VERSION); \
|
||||
if test -d "$(srcdir)/.git" && type git > /dev/null 2>&1; then \
|
||||
SNAPSHOT=`cd "$(srcdir)" && git describe --abbrev=4 | cut -b2-`; \
|
||||
|
||||
445
NEWS
445
NEWS
@@ -2,6 +2,300 @@
|
||||
XZ Utils Release Notes
|
||||
======================
|
||||
|
||||
5.3.1alpha (2018-04-29)
|
||||
|
||||
* All fixes from 5.2.4.
|
||||
|
||||
* Add lzma_file_info_decoder() into liblzma and use it in xz to
|
||||
implement the --list feature.
|
||||
|
||||
* Capsicum sandbox support is enabled by default where available
|
||||
(FreeBSD >= 10).
|
||||
|
||||
|
||||
5.2.4 (2018-04-29)
|
||||
|
||||
* liblzma:
|
||||
|
||||
- Allow 0 as memory usage limit instead of returning
|
||||
LZMA_PROG_ERROR. Now 0 is treated as if 1 byte was specified,
|
||||
which effectively is the same as 0.
|
||||
|
||||
- Use "noexcept" keyword instead of "throw()" in the public
|
||||
headers when a C++11 (or newer standard) compiler is used.
|
||||
|
||||
- Added a portability fix for recent Intel C Compilers.
|
||||
|
||||
- Microsoft Visual Studio build files have been moved under
|
||||
windows/vs2013 and windows/vs2017.
|
||||
|
||||
* xz:
|
||||
|
||||
- Fix "xz --list --robot missing_or_bad_file.xz" which would
|
||||
try to print an unitialized string and thus produce garbage
|
||||
output. Since the exit status is non-zero, most uses of such
|
||||
a command won't try to interpret the garbage output.
|
||||
|
||||
- "xz --list foo.xz" could print "Internal error (bug)" in a
|
||||
corner case where a specific memory usage limit had been set.
|
||||
|
||||
|
||||
5.2.3 (2016-12-30)
|
||||
|
||||
* xz:
|
||||
|
||||
- Always close a file before trying to delete it to avoid
|
||||
problems on some operating system and file system combinations.
|
||||
|
||||
- Fixed copying of file timestamps on Windows.
|
||||
|
||||
- Added experimental (disabled by default) sandbox support using
|
||||
Capsicum (FreeBSD >= 10). See --enable-sandbox in INSTALL.
|
||||
|
||||
* C99/C11 conformance fixes to liblzma. The issues affected at least
|
||||
some builds using link-time optimizations.
|
||||
|
||||
* Fixed bugs in the rarely-used function lzma_index_dup().
|
||||
|
||||
* Use of external SHA-256 code is now disabled by default.
|
||||
It can still be enabled by passing --enable-external-sha256
|
||||
to configure. The reasons to disable it by default (see INSTALL
|
||||
for more details):
|
||||
|
||||
- Some OS-specific SHA-256 implementations conflict with
|
||||
OpenSSL and cause problems in programs that link against both
|
||||
liblzma and libcrypto. At least FreeBSD 10 and MINIX 3.3.0
|
||||
are affected.
|
||||
|
||||
- The internal SHA-256 is faster than the SHA-256 code in
|
||||
some operating systems.
|
||||
|
||||
* Changed CPU core count detection to use sched_getaffinity() on
|
||||
GNU/Linux and GNU/kFreeBSD.
|
||||
|
||||
* Fixes to the build-system and xz to make xz buildable even when
|
||||
encoders, decoders, or threading have been disabled from libilzma
|
||||
using configure options. These fixes added two new #defines to
|
||||
config.h: HAVE_ENCODERS and HAVE_DECODERS.
|
||||
|
||||
|
||||
5.2.2 (2015-09-29)
|
||||
|
||||
* Fixed bugs in QNX-specific code.
|
||||
|
||||
* Omitted the use of pipe2() even if it is available to avoid
|
||||
portability issues with some old Linux and glibc combinations.
|
||||
|
||||
* Updated German translation.
|
||||
|
||||
* Added project files to build static and shared liblzma (not the
|
||||
whole XZ Utils) with Visual Studio 2013 update 2 or later.
|
||||
|
||||
* Documented that threaded decompression hasn't been implemented
|
||||
yet. A 5.2.0 NEWS entry describing multi-threading support had
|
||||
incorrectly said "decompression" when it should have said
|
||||
"compression".
|
||||
|
||||
|
||||
5.2.1 (2015-02-26)
|
||||
|
||||
* Fixed a compression-ratio regression in fast mode of LZMA1 and
|
||||
LZMA2. The bug is present in 5.1.4beta and 5.2.0 releases.
|
||||
|
||||
* Fixed a portability problem in xz that affected at least OpenBSD.
|
||||
|
||||
* Fixed xzdiff to be compatible with FreeBSD's mktemp which differs
|
||||
from most other mktemp implementations.
|
||||
|
||||
* Changed CPU core count detection to use cpuset_getaffinity() on
|
||||
FreeBSD.
|
||||
|
||||
|
||||
5.2.0 (2014-12-21)
|
||||
|
||||
Since 5.1.4beta:
|
||||
|
||||
* All fixes from 5.0.8
|
||||
|
||||
* liblzma: Fixed lzma_stream_encoder_mt_memusage() when a preset
|
||||
was used.
|
||||
|
||||
* xzdiff: If mktemp isn't installed, mkdir will be used as
|
||||
a fallback to create a temporary directory. Installing mktemp
|
||||
is still recommended.
|
||||
|
||||
* Updated French, German, Italian, Polish, and Vietnamese
|
||||
translations.
|
||||
|
||||
Summary of fixes and new features added in the 5.1.x development
|
||||
releases:
|
||||
|
||||
* liblzma:
|
||||
|
||||
- Added support for multi-threaded compression. See the
|
||||
lzma_mt structure, lzma_stream_encoder_mt(), and
|
||||
lzma_stream_encoder_mt_memusage() in <lzma/container.h>,
|
||||
lzma_get_progress() in <lzma/base.h>, and lzma_cputhreads()
|
||||
in <lzma/hardware.h> for details.
|
||||
|
||||
- Made the uses of lzma_allocator const correct.
|
||||
|
||||
- Added lzma_block_uncomp_encode() to create uncompressed
|
||||
.xz Blocks using LZMA2 uncompressed chunks.
|
||||
|
||||
- Added support for LZMA_IGNORE_CHECK.
|
||||
|
||||
- A few speed optimizations were made.
|
||||
|
||||
- Added support for symbol versioning. It is enabled by default
|
||||
on GNU/Linux, other GNU-based systems, and FreeBSD.
|
||||
|
||||
- liblzma (not the whole XZ Utils) should now be buildable
|
||||
with MSVC 2013 update 2 or later using windows/config.h.
|
||||
|
||||
* xz:
|
||||
|
||||
- Fixed a race condition in the signal handling. It was
|
||||
possible that e.g. the first SIGINT didn't make xz exit
|
||||
if reading or writing blocked and one had bad luck. The fix
|
||||
is non-trivial, so as of writing it is unknown if it will be
|
||||
backported to the v5.0 branch.
|
||||
|
||||
- Multi-threaded compression can be enabled with the
|
||||
--threads (-T) option.
|
||||
[Fixed: This originally said "decompression".]
|
||||
|
||||
- New command line options in xz: --single-stream,
|
||||
--block-size=SIZE, --block-list=SIZES,
|
||||
--flush-timeout=TIMEOUT, and --ignore-check.
|
||||
|
||||
- xz -lvv now shows the minimum xz version that is required to
|
||||
decompress the file. Currently it is 5.0.0 for all supported
|
||||
.xz files except files with empty LZMA2 streams require 5.0.2.
|
||||
|
||||
* xzdiff and xzgrep now support .lzo files if lzop is installed.
|
||||
The .tzo suffix is also recognized as a shorthand for .tar.lzo.
|
||||
|
||||
|
||||
5.1.4beta (2014-09-14)
|
||||
|
||||
* All fixes from 5.0.6
|
||||
|
||||
* liblzma: Fixed the use of presets in threaded encoder
|
||||
initialization.
|
||||
|
||||
* xz --block-list and --block-size can now be used together
|
||||
in single-threaded mode. Previously the combination only
|
||||
worked in multi-threaded mode.
|
||||
|
||||
* Added support for LZMA_IGNORE_CHECK to liblzma and made it
|
||||
available in xz as --ignore-check.
|
||||
|
||||
* liblzma speed optimizations:
|
||||
|
||||
- Initialization of a new LZMA1 or LZMA2 encoder has been
|
||||
optimized. (The speed of reinitializing an already-allocated
|
||||
encoder isn't affected.) This helps when compressing many
|
||||
small buffers with lzma_stream_buffer_encode() and other
|
||||
similar situations where an already-allocated encoder state
|
||||
isn't reused. This speed-up is visible in xz too if one
|
||||
compresses many small files one at a time instead running xz
|
||||
once and giving all files as command-line arguments.
|
||||
|
||||
- Buffer comparisons are now much faster when unaligned access
|
||||
is allowed (configured with --enable-unaligned-access). This
|
||||
speeds up encoding significantly. There is arch-specific code
|
||||
for 32-bit and 64-bit x86 (32-bit needs SSE2 for the best
|
||||
results and there's no run-time CPU detection for now).
|
||||
For other archs there is only generic code which probably
|
||||
isn't as optimal as arch-specific solutions could be.
|
||||
|
||||
- A few speed optimizations were made to the SHA-256 code.
|
||||
(Note that the builtin SHA-256 code isn't used on all
|
||||
operating systems.)
|
||||
|
||||
* liblzma can now be built with MSVC 2013 update 2 or later
|
||||
using windows/config.h.
|
||||
|
||||
* Vietnamese translation was added.
|
||||
|
||||
|
||||
5.1.3alpha (2013-10-26)
|
||||
|
||||
* All fixes from 5.0.5
|
||||
|
||||
* liblzma:
|
||||
|
||||
- Fixed a deadlock in the threaded encoder.
|
||||
|
||||
- Made the uses of lzma_allocator const correct.
|
||||
|
||||
- Added lzma_block_uncomp_encode() to create uncompressed
|
||||
.xz Blocks using LZMA2 uncompressed chunks.
|
||||
|
||||
- Added support for native threads on Windows and the ability
|
||||
to detect the number of CPU cores.
|
||||
|
||||
* xz:
|
||||
|
||||
- Fixed a race condition in the signal handling. It was
|
||||
possible that e.g. the first SIGINT didn't make xz exit
|
||||
if reading or writing blocked and one had bad luck. The fix
|
||||
is non-trivial, so as of writing it is unknown if it will be
|
||||
backported to the v5.0 branch.
|
||||
|
||||
- Made the progress indicator work correctly in threaded mode.
|
||||
|
||||
- Threaded encoder now works together with --block-list=SIZES.
|
||||
|
||||
- Added preliminary support for --flush-timeout=TIMEOUT.
|
||||
It can be useful for (somewhat) real-time streaming. For
|
||||
now the decompression side has to be done with something
|
||||
else than the xz tool due to how xz does buffering, but this
|
||||
should be fixed.
|
||||
|
||||
|
||||
5.1.2alpha (2012-07-04)
|
||||
|
||||
* All fixes from 5.0.3 and 5.0.4
|
||||
|
||||
* liblzma:
|
||||
|
||||
- Fixed a deadlock and an invalid free() in the threaded encoder.
|
||||
|
||||
- Added support for symbol versioning. It is enabled by default
|
||||
on GNU/Linux, other GNU-based systems, and FreeBSD.
|
||||
|
||||
- Use SHA-256 implementation from the operating system if one is
|
||||
available in libc, libmd, or libutil. liblzma won't use e.g.
|
||||
OpenSSL or libgcrypt to avoid introducing new dependencies.
|
||||
|
||||
- Fixed liblzma.pc for static linking.
|
||||
|
||||
- Fixed a few portability bugs.
|
||||
|
||||
* xz --decompress --single-stream now fixes the input position after
|
||||
successful decompression. Now the following works:
|
||||
|
||||
echo foo | xz > foo.xz
|
||||
echo bar | xz >> foo.xz
|
||||
( xz -dc --single-stream ; xz -dc --single-stream ) < foo.xz
|
||||
|
||||
Note that it doesn't work if the input is not seekable
|
||||
or if there is Stream Padding between the concatenated
|
||||
.xz Streams.
|
||||
|
||||
* xz -lvv now shows the minimum xz version that is required to
|
||||
decompress the file. Currently it is 5.0.0 for all supported .xz
|
||||
files except files with empty LZMA2 streams require 5.0.2.
|
||||
|
||||
* Added an *incomplete* implementation of --block-list=SIZES to xz.
|
||||
It only works correctly in single-threaded mode and when
|
||||
--block-size isn't used at the same time. --block-list allows
|
||||
specifying the sizes of Blocks which can be useful e.g. when
|
||||
creating files for random-access reading.
|
||||
|
||||
|
||||
5.1.1alpha (2011-04-12)
|
||||
|
||||
* All fixes from 5.0.2
|
||||
@@ -45,6 +339,157 @@ XZ Utils Release Notes
|
||||
experimental and may change before it gets into a stable release.
|
||||
|
||||
|
||||
5.0.8 (2014-12-21)
|
||||
|
||||
* Fixed an old bug in xzgrep that affected OpenBSD and probably
|
||||
a few other operating systems too.
|
||||
|
||||
* Updated French and German translations.
|
||||
|
||||
* Added support for detecting the amount of RAM on AmigaOS/AROS.
|
||||
|
||||
* Minor build system updates.
|
||||
|
||||
|
||||
5.0.7 (2014-09-20)
|
||||
|
||||
* Fix regressions introduced in 5.0.6:
|
||||
|
||||
- Fix building with non-GNU make.
|
||||
|
||||
- Fix invalid Libs.private value in liblzma.pc which broke
|
||||
static linking against liblzma if the linker flags were
|
||||
taken from pkg-config.
|
||||
|
||||
|
||||
5.0.6 (2014-09-14)
|
||||
|
||||
* xzgrep now exits with status 0 if at least one file matched.
|
||||
|
||||
* A few minor portability and build system fixes
|
||||
|
||||
|
||||
5.0.5 (2013-06-30)
|
||||
|
||||
* lzmadec and liblzma's lzma_alone_decoder(): Support decompressing
|
||||
.lzma files that have less common settings in the headers
|
||||
(dictionary size other than 2^n or 2^n + 2^(n-1), or uncompressed
|
||||
size greater than 256 GiB). The limitations existed to avoid false
|
||||
positives when detecting .lzma files. The lc + lp <= 4 limitation
|
||||
still remains since liblzma's LZMA decoder has that limitation.
|
||||
|
||||
NOTE: xz's .lzma support or liblzma's lzma_auto_decoder() are NOT
|
||||
affected by this change. They still consider uncommon .lzma headers
|
||||
as not being in the .lzma format. Changing this would give way too
|
||||
many false positives.
|
||||
|
||||
* xz:
|
||||
|
||||
- Interaction of preset and custom filter chain options was
|
||||
made less illogical. This affects only certain less typical
|
||||
uses cases so few people are expected to notice this change.
|
||||
|
||||
Now when a custom filter chain option (e.g. --lzma2) is
|
||||
specified, all preset options (-0 ... -9, -e) earlier are on
|
||||
the command line are completely forgotten. Similarly, when
|
||||
a preset option is specified, all custom filter chain options
|
||||
earlier on the command line are completely forgotten.
|
||||
|
||||
Example 1: "xz -9 --lzma2=preset=5 -e" is equivalent to "xz -e"
|
||||
which is equivalent to "xz -6e". Earlier -e didn't put xz back
|
||||
into preset mode and thus the example command was equivalent
|
||||
to "xz --lzma2=preset=5".
|
||||
|
||||
Example 2: "xz -9e --lzma2=preset=5 -7" is equivalent to
|
||||
"xz -7". Earlier a custom filter chain option didn't make
|
||||
xz forget the -e option so the example was equivalent to
|
||||
"xz -7e".
|
||||
|
||||
- Fixes and improvements to error handling.
|
||||
|
||||
- Various fixes to the man page.
|
||||
|
||||
* xzless: Fixed to work with "less" versions 448 and later.
|
||||
|
||||
* xzgrep: Made -h an alias for --no-filename.
|
||||
|
||||
* Include the previously missing debug/translation.bash which can
|
||||
be useful for translators.
|
||||
|
||||
* Include a build script for Mac OS X. This has been in the Git
|
||||
repository since 2010 but due to a mistake in Makefile.am the
|
||||
script hasn't been included in a release tarball before.
|
||||
|
||||
|
||||
5.0.4 (2012-06-22)
|
||||
|
||||
* liblzma:
|
||||
|
||||
- Fix lzma_index_init(). It could crash if memory allocation
|
||||
failed.
|
||||
|
||||
- Fix the possibility of an incorrect LZMA_BUF_ERROR when a BCJ
|
||||
filter is used and the application only provides exactly as
|
||||
much output space as is the uncompressed size of the file.
|
||||
|
||||
- Fix a bug in doc/examples_old/xz_pipe_decompress.c. It didn't
|
||||
check if the last call to lzma_code() really returned
|
||||
LZMA_STREAM_END, which made the program think that truncated
|
||||
files are valid.
|
||||
|
||||
- New example programs in doc/examples (old programs are now in
|
||||
doc/examples_old). These have more comments and more detailed
|
||||
error handling.
|
||||
|
||||
* Fix "xz -lvv foo.xz". It could crash on some corrupted files.
|
||||
|
||||
* Fix output of "xz --robot -lv" and "xz --robot -lvv" which
|
||||
incorrectly printed the filename also in the "foo (x/x)" format.
|
||||
|
||||
* Fix exit status of "xzdiff foo.xz bar.xz".
|
||||
|
||||
* Fix exit status of "xzgrep foo binary_file".
|
||||
|
||||
* Fix portability to EBCDIC systems.
|
||||
|
||||
* Fix a configure issue on AIX with the XL C compiler. See INSTALL
|
||||
for details.
|
||||
|
||||
* Update French, German, Italian, and Polish translations.
|
||||
|
||||
|
||||
5.0.3 (2011-05-21)
|
||||
|
||||
* liblzma fixes:
|
||||
|
||||
- A memory leak was fixed.
|
||||
|
||||
- lzma_stream_buffer_encode() no longer creates an empty .xz
|
||||
Block if encoding an empty buffer. Such an empty Block with
|
||||
LZMA2 data would trigger a bug in 5.0.1 and older (see the
|
||||
first bullet point in 5.0.2 notes). When releasing 5.0.2,
|
||||
I thought that no encoder creates this kind of files but
|
||||
I was wrong.
|
||||
|
||||
- Validate function arguments better in a few functions. Most
|
||||
importantly, specifying an unsupported integrity check to
|
||||
lzma_stream_buffer_encode() no longer creates a corrupt .xz
|
||||
file. Probably no application tries to do that, so this
|
||||
shouldn't be a big problem in practice.
|
||||
|
||||
- Document that lzma_block_buffer_encode(),
|
||||
lzma_easy_buffer_encode(), lzma_stream_encoder(), and
|
||||
lzma_stream_buffer_encode() may return LZMA_UNSUPPORTED_CHECK.
|
||||
|
||||
- The return values of the _memusage() functions are now
|
||||
documented better.
|
||||
|
||||
* Fix command name detection in xzgrep. xzegrep and xzfgrep now
|
||||
correctly use egrep and fgrep instead of grep.
|
||||
|
||||
* French translation was added.
|
||||
|
||||
|
||||
5.0.2 (2011-04-01)
|
||||
|
||||
* LZMA2 decompressor now correctly accepts LZMA2 streams with no
|
||||
|
||||
60
README
60
README
@@ -5,7 +5,7 @@ XZ Utils
|
||||
0. Overview
|
||||
1. Documentation
|
||||
1.1. Overall documentation
|
||||
1.2. Documentation for command line tools
|
||||
1.2. Documentation for command-line tools
|
||||
1.3. Documentation for liblzma
|
||||
2. Version numbering
|
||||
3. Reporting bugs
|
||||
@@ -17,21 +17,21 @@ XZ Utils
|
||||
0. Overview
|
||||
-----------
|
||||
|
||||
XZ Utils provide a general-purpose data compression library and
|
||||
command line tools. The native file format is the .xz format, but
|
||||
XZ Utils provide a general-purpose data-compression library plus
|
||||
command-line tools. The native file format is the .xz format, but
|
||||
also the legacy .lzma format is supported. The .xz format supports
|
||||
multiple compression algorithms, which are called "filters" in
|
||||
multiple compression algorithms, which are called "filters" in the
|
||||
context of XZ Utils. The primary filter is currently LZMA2. With
|
||||
typical files, XZ Utils create about 30 % smaller files than gzip.
|
||||
|
||||
To ease adapting support for the .xz format into existing applications
|
||||
and scripts, the API of liblzma is somewhat similar to the API of the
|
||||
popular zlib library. For the same reason, the command line tool xz
|
||||
has similar command line syntax than that of gzip.
|
||||
popular zlib library. For the same reason, the command-line tool xz
|
||||
has a command-line syntax similar to that of gzip.
|
||||
|
||||
When aiming for the highest compression ratio, LZMA2 encoder uses
|
||||
When aiming for the highest compression ratio, the LZMA2 encoder uses
|
||||
a lot of CPU time and may use, depending on the settings, even
|
||||
hundreds of megabytes of RAM. However, in fast modes, LZMA2 encoder
|
||||
hundreds of megabytes of RAM. However, in fast modes, the LZMA2 encoder
|
||||
competes with bzip2 in compression speed, RAM usage, and compression
|
||||
ratio.
|
||||
|
||||
@@ -44,8 +44,8 @@ XZ Utils
|
||||
since that needs to be done only once to benefit many people.
|
||||
|
||||
With some file types, combining (or "chaining") LZMA2 with an
|
||||
additional filter can improve compression ratio. A filter chain may
|
||||
contain up to four filters, although usually only one two is used.
|
||||
additional filter can improve the compression ratio. A filter chain may
|
||||
contain up to four filters, although usually only one or two are used.
|
||||
For example, putting a BCJ (Branch/Call/Jump) filter before LZMA2
|
||||
in the filter chain can improve compression ratio of executable files.
|
||||
|
||||
@@ -88,9 +88,9 @@ XZ Utils
|
||||
packages.
|
||||
|
||||
|
||||
1.2. Documentation for command line tools
|
||||
1.2. Documentation for command-line tools
|
||||
|
||||
The command line tools are documented as man pages. In source code
|
||||
The command-line tools are documented as man pages. In source code
|
||||
releases (and possibly also in some binary packages), the man pages
|
||||
are also provided in plain text (ASCII only) and PDF formats in the
|
||||
directory "doc/man" to make the man pages more accessible to those
|
||||
@@ -109,8 +109,8 @@ XZ Utils
|
||||
written yet.
|
||||
|
||||
For now, if you have never used liblzma, libbzip2, or zlib, I
|
||||
recommend learning *basics* of zlib API. Once you know that, it
|
||||
should be easier to learn liblzma.
|
||||
recommend learning the *basics* of the zlib API. Once you know that,
|
||||
it should be easier to learn liblzma.
|
||||
|
||||
http://zlib.net/manual.html
|
||||
http://zlib.net/zlib_how.html
|
||||
@@ -124,23 +124,27 @@ XZ Utils
|
||||
- X is the major version. When this is incremented, the library
|
||||
API and ABI break.
|
||||
|
||||
- Y is the minor version. It is incremented when new features are
|
||||
added without breaking existing API or ABI. Even Y indicates
|
||||
stable release and odd Y indicates unstable (alpha or beta
|
||||
version).
|
||||
- Y is the minor version. It is incremented when new features
|
||||
are added without breaking the existing API or ABI. An even Y
|
||||
indicates a stable release and an odd Y indicates unstable
|
||||
(alpha or beta version).
|
||||
|
||||
- Z is the revision. This has different meaning for stable and
|
||||
- Z is the revision. This has a different meaning for stable and
|
||||
unstable releases:
|
||||
|
||||
* Stable: Z is incremented when bugs get fixed without adding
|
||||
any new features.
|
||||
any new features. This is intended to be convenient for
|
||||
downstream distributors that want bug fixes but don't want
|
||||
any new features to minimize the risk of introducing new bugs.
|
||||
|
||||
* Unstable: Z is just a counter. API or ABI of features added
|
||||
in earlier unstable releases having the same X.Y may break.
|
||||
|
||||
- S indicates stability of the release. It is missing from the
|
||||
stable releases where Y is an even number. When Y is odd, S
|
||||
stable releases, where Y is an even number. When Y is odd, S
|
||||
is either "alpha" or "beta" to make it very clear that such
|
||||
versions are not stable releases. The same X.Y.Z combination is
|
||||
not used for more than one stability level i.e. after X.Y.Zalpha,
|
||||
not used for more than one stability level, i.e. after X.Y.Zalpha,
|
||||
the next version can be X.Y.(Z+1)beta but not X.Y.Zbeta.
|
||||
|
||||
|
||||
@@ -176,7 +180,7 @@ XZ Utils
|
||||
Don't send core dump files or any executables. If you have a small
|
||||
example file(s) (total size less than 256 KiB), please include
|
||||
it/them as an attachment. If you have bigger test files, put them
|
||||
online somewhere and include an URL to the file(s) in the bug report.
|
||||
online somewhere and include a URL to the file(s) in the bug report.
|
||||
|
||||
Always include the exact version number of XZ Utils in the bug report.
|
||||
If you are using a snapshot from the git repository, use "git describe"
|
||||
@@ -193,7 +197,7 @@ XZ Utils
|
||||
|
||||
The messages from the xz tool have been translated into a few
|
||||
languages. Before starting to translate into a new language, ask
|
||||
the author that someone else hasn't already started working on it.
|
||||
the author whether someone else hasn't already started working on it.
|
||||
|
||||
Test your translation. Testing includes comparing the translated
|
||||
output to the original English version by running the same commands
|
||||
@@ -206,15 +210,15 @@ XZ Utils
|
||||
# <Edit the .po file in the po directory.>
|
||||
make -C po update-po
|
||||
make install
|
||||
bash debug/translations.bash | less
|
||||
bash debug/translations.bash | less -S # For --list outputs
|
||||
bash debug/translation.bash | less
|
||||
bash debug/translation.bash | less -S # For --list outputs
|
||||
|
||||
Repeat the above as needed (no need to re-run configure though).
|
||||
|
||||
Note especially the following:
|
||||
|
||||
- The output of --help and --long-help must look nice on
|
||||
a 80-column terminal. It's OK to add extra lines if needed.
|
||||
an 80-column terminal. It's OK to add extra lines if needed.
|
||||
|
||||
- In contrast, don't add extra lines to error messages and such.
|
||||
They are often preceded with e.g. a filename on the same line,
|
||||
@@ -287,7 +291,7 @@ XZ Utils
|
||||
XZ Embedded is a limited implementation written for use in the Linux
|
||||
kernel, but it is also suitable for other embedded use.
|
||||
|
||||
http://tukaani.org/xz/embedded.html
|
||||
https://tukaani.org/xz/embedded.html
|
||||
|
||||
|
||||
6. Contact information
|
||||
|
||||
46
THANKS
46
THANKS
@@ -6,65 +6,111 @@ Some people have helped more, some less, but nevertheless everyone's help
|
||||
has been important. :-) In alphabetical order:
|
||||
- Mark Adler
|
||||
- H. Peter Anvin
|
||||
- Jeff Bastian
|
||||
- Nelson H. F. Beebe
|
||||
- Karl Berry
|
||||
- Anders F. Björklund
|
||||
- Emmanuel Blot
|
||||
- Melanie Blower
|
||||
- Martin Blumenstingl
|
||||
- Ben Boeckel
|
||||
- Jakub Bogusz
|
||||
- Maarten Bosmans
|
||||
- Trent W. Buck
|
||||
- James Buren
|
||||
- David Burklund
|
||||
- Daniel Mealha Cabrita
|
||||
- Milo Casagrande
|
||||
- Marek Černocký
|
||||
- Tomer Chachamu
|
||||
- Gabi Davar
|
||||
- Chris Donawa
|
||||
- Andrew Dudman
|
||||
- Markus Duft
|
||||
- İsmail Dönmez
|
||||
- Robert Elz
|
||||
- Gilles Espinasse
|
||||
- Denis Excoffier
|
||||
- Michael Felt
|
||||
- Michael Fox
|
||||
- Mike Frysinger
|
||||
- Daniel Richard G.
|
||||
- Bill Glessner
|
||||
- Jason Gorski
|
||||
- Juan Manuel Guerrero
|
||||
- Diederik de Haas
|
||||
- Joachim Henke
|
||||
- Christian Hesse
|
||||
- Vincenzo Innocente
|
||||
- Peter Ivanov
|
||||
- Jouk Jansen
|
||||
- Jun I Jin
|
||||
- Per Øyvind Karlsen
|
||||
- Thomas Klausner
|
||||
- Richard Koch
|
||||
- Ville Koskinen
|
||||
- Jan Kratochvil
|
||||
- Christian Kujau
|
||||
- Stephan Kulow
|
||||
- Peter Lawler
|
||||
- James M Leddy
|
||||
- Hin-Tak Leung
|
||||
- Andraž 'ruskie' Levstik
|
||||
- Cary Lewis
|
||||
- Wim Lewis
|
||||
- Eric Lindblad
|
||||
- Lorenzo De Liso
|
||||
- Bela Lubkin
|
||||
- Gregory Margo
|
||||
- Jim Meyering
|
||||
- Arkadiusz Miskiewicz
|
||||
- Conley Moorhous
|
||||
- Rafał Mużyło
|
||||
- Adrien Nader
|
||||
- Evan Nemerson
|
||||
- Hongbo Ni
|
||||
- Jonathan Nieder
|
||||
- Andre Noll
|
||||
- Peter O'Gorman
|
||||
- Peter Pallinger
|
||||
- Rui Paulo
|
||||
- Igor Pavlov
|
||||
- Diego Elio Pettenò
|
||||
- Elbert Pol
|
||||
- Mikko Pouru
|
||||
- Rich Prohaska
|
||||
- Trần Ngọc Quân
|
||||
- Pavel Raiskup
|
||||
- Ole André Vadla Ravnås
|
||||
- Robert Readman
|
||||
- Bernhard Reutner-Fischer
|
||||
- Eric S. Raymond
|
||||
- Cristian Rodríguez
|
||||
- Christian von Roques
|
||||
- Torsten Rupp
|
||||
- Jukka Salmi
|
||||
- Alexandre Sauvé
|
||||
- Benno Schulenberg
|
||||
- Andreas Schwab
|
||||
- Dan Shechter
|
||||
- Stuart Shelton
|
||||
- Sebastian Andrzej Siewior
|
||||
- Brad Smith
|
||||
- Pippijn van Steenhoven
|
||||
- Jonathan Stott
|
||||
- Dan Stromberg
|
||||
- Vincent Torri
|
||||
- Paul Townsend
|
||||
- Mohammed Adnène Trojette
|
||||
- Alexey Tourbin
|
||||
- Loganaden Velvindron
|
||||
- Patrick J. Volkerding
|
||||
- Martin Väth
|
||||
- Adam Walling
|
||||
- Christian Weisgerber
|
||||
- Bert Wesarg
|
||||
- Fredrik Wikstrom
|
||||
- Jim Wilcoxson
|
||||
- Ralf Wildenhues
|
||||
- Charles Wilson
|
||||
- Lars Wirzenius
|
||||
|
||||
54
TODO
54
TODO
@@ -12,10 +12,6 @@ Known bugs
|
||||
it would be possible by switching from BT2/BT3/BT4 match finder to
|
||||
HC3/HC4.
|
||||
|
||||
The code to detect number of CPU cores doesn't count hyperthreading
|
||||
as multiple cores. In context of xz, it probably should.
|
||||
Hyperthreading is good at least with p7zip.
|
||||
|
||||
XZ Utils compress some files significantly worse than LZMA Utils.
|
||||
This is due to faster compression presets used by XZ Utils, and
|
||||
can often be worked around by using "xz --extreme". With some files
|
||||
@@ -32,10 +28,29 @@ Known bugs
|
||||
time and calculated (de)compression speed won't make sense in the
|
||||
progress indicator (xz --verbose).
|
||||
|
||||
If liblzma has created threads and fork() gets called, liblzma
|
||||
code will break in the child process unless it calls exec() and
|
||||
doesn't touch liblzma.
|
||||
|
||||
|
||||
Missing features
|
||||
----------------
|
||||
|
||||
Add support for storing metadata in .xz files. A preliminary
|
||||
idea is to create a new Stream type for metadata. When both
|
||||
metadata and data are wanted in the same .xz file, two or more
|
||||
Streams would be concatenated.
|
||||
|
||||
The state stored in lzma_stream should be cloneable, which would
|
||||
be mostly useful when using a preset dictionary in LZMA2, but
|
||||
it may have other uses too. Compare to deflateCopy() in zlib.
|
||||
|
||||
Support LZMA_FINISH in raw decoder to indicate end of LZMA1 and
|
||||
other streams that don't have an end of payload marker.
|
||||
|
||||
Adjust dictionary size when the input file size is known.
|
||||
Maybe do this only if an option is given.
|
||||
|
||||
xz doesn't support copying extended attributes, access control
|
||||
lists etc. from source to target file.
|
||||
|
||||
@@ -53,8 +68,6 @@ Missing features
|
||||
It will be a separate library that supports uncompressed, .gz,
|
||||
.bz2, .lzma, and .xz files.
|
||||
|
||||
Check the first 0x00 byte of LZMA data.
|
||||
|
||||
Support changing lzma_options_lzma.mode with lzma_filters_update().
|
||||
|
||||
Support LZMA_FULL_FLUSH for lzma_stream_decoder() to stop at
|
||||
@@ -64,14 +77,35 @@ Missing features
|
||||
This is tricky, because the same error codes are used with
|
||||
slightly different meanings, and this cannot be fixed anymore.
|
||||
|
||||
Make it possible to adjust LZMA2 options in the middle of a Block
|
||||
so that the encoding speed vs. compression ratio can be optimized
|
||||
when the compressed data is streamed over network.
|
||||
|
||||
Improved BCJ filters. The current filters are small but they aren't
|
||||
so great when compressing binary packages that contain various file
|
||||
types. Specifically, they make things worse if there are static
|
||||
libraries or Linux kernel modules. The filtering could also be
|
||||
more effective (without getting overly complex), for example,
|
||||
streamable variant BCJ2 from 7-Zip could be implemented.
|
||||
|
||||
Filter that autodetects specific data types in the input stream
|
||||
and applies appropriate filters for the corrects parts of the input.
|
||||
Perhaps combine this with the BCJ filter improvement point above.
|
||||
|
||||
Long-range LZ77 method as a separate filter or as a new LZMA2
|
||||
match finder.
|
||||
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
Some tutorial is needed for liblzma. I have planned to write some
|
||||
extremely well commented example programs, which would work as
|
||||
a tutorial. I suppose the Doxygen tags are quite OK as a quick
|
||||
reference once one is familiar with the liblzma API.
|
||||
More tutorial programs are needed for liblzma.
|
||||
|
||||
Document the LZMA1 and LZMA2 algorithms.
|
||||
|
||||
|
||||
Miscellaneous
|
||||
------------
|
||||
|
||||
Try to get the media type for .xz registered at IANA.
|
||||
|
||||
|
||||
@@ -21,4 +21,4 @@ sed -n 's/LZMA_VERSION_STABILITY_ALPHA/alpha/
|
||||
src/liblzma/api/lzma/version.h \
|
||||
| tr '\n' '|' \
|
||||
| sed 's/|/./; s/|/./; s/|//g' \
|
||||
| tr -d '\n'
|
||||
| tr -d '\r\n'
|
||||
|
||||
375
configure.ac
375
configure.ac
@@ -18,7 +18,7 @@
|
||||
AC_PREREQ([2.64])
|
||||
|
||||
AC_INIT([XZ Utils], m4_esyscmd([/bin/sh build-aux/version.sh]),
|
||||
[lasse.collin@tukaani.org], [xz], [http://tukaani.org/xz/])
|
||||
[lasse.collin@tukaani.org], [xz], [https://tukaani.org/xz/])
|
||||
AC_CONFIG_SRCDIR([src/liblzma/common/common.h])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
@@ -34,8 +34,8 @@ AC_CANONICAL_HOST
|
||||
|
||||
# We do some special things on Windows (32-bit or 64-bit) builds.
|
||||
case $host_os in
|
||||
mingw* | cygwin*) is_w32=yes ;;
|
||||
*) is_w32=no ;;
|
||||
mingw* | cygwin | msys) is_w32=yes ;;
|
||||
*) is_w32=no ;;
|
||||
esac
|
||||
AM_CONDITIONAL([COND_W32], [test "$is_w32" = yes])
|
||||
|
||||
@@ -43,9 +43,15 @@ AM_CONDITIONAL([COND_W32], [test "$is_w32" = yes])
|
||||
# executables. Cygwin is an exception to this, since it is recommended
|
||||
# that symlinks don't have the .exe suffix. To make this work, we
|
||||
# define LN_EXEEXT.
|
||||
#
|
||||
# MSYS2 is treated the same way as Cygwin. It uses plain "msys" like
|
||||
# the original MSYS when building MSYS/MSYS2-binaries. Hopefully this
|
||||
# doesn't break things for the original MSYS developers. Note that this
|
||||
# doesn't affect normal MSYS/MSYS2 users building non-MSYS/MSYS2 binaries
|
||||
# since in that case the $host_os is usually mingw32.
|
||||
case $host_os in
|
||||
cygwin) LN_EXEEXT= ;;
|
||||
*) LN_EXEEXT='$(EXEEXT)' ;;
|
||||
cygwin | msys) LN_EXEEXT= ;;
|
||||
*) LN_EXEEXT='$(EXEEXT)' ;;
|
||||
esac
|
||||
AC_SUBST([LN_EXEEXT])
|
||||
|
||||
@@ -59,7 +65,7 @@ AM_CFLAGS=
|
||||
#############
|
||||
|
||||
AC_MSG_CHECKING([if debugging code should be compiled])
|
||||
AC_ARG_ENABLE([debug], AC_HELP_STRING([--enable-debug], [Enable debugging code.]),
|
||||
AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [Enable debugging code.]),
|
||||
[], enable_debug=no)
|
||||
if test "x$enable_debug" = xyes; then
|
||||
AC_MSG_RESULT([yes])
|
||||
@@ -84,13 +90,14 @@ enable_decoder_[]NAME=no
|
||||
])dnl
|
||||
|
||||
AC_MSG_CHECKING([which encoders to build])
|
||||
AC_ARG_ENABLE([encoders], AC_HELP_STRING([--enable-encoders=LIST],
|
||||
AC_ARG_ENABLE([encoders], AS_HELP_STRING([--enable-encoders=LIST],
|
||||
[Comma-separated list of encoders to build. Default=all.
|
||||
Available encoders:]
|
||||
m4_translit(m4_defn([SUPPORTED_FILTERS]), [,], [ ])),
|
||||
[], [enable_encoders=SUPPORTED_FILTERS])
|
||||
enable_encoders=`echo "$enable_encoders" | sed 's/,/ /g'`
|
||||
if test "x$enable_encoders" = xno || test "x$enable_encoders" = x; then
|
||||
enable_encoders=no
|
||||
AC_MSG_RESULT([(none)])
|
||||
else
|
||||
for arg in $enable_encoders
|
||||
@@ -108,16 +115,19 @@ else
|
||||
;;
|
||||
esac
|
||||
done
|
||||
AC_DEFINE([HAVE_ENCODERS], [1],
|
||||
[Define to 1 if any of HAVE_ENCODER_foo have been defined.])
|
||||
AC_MSG_RESULT([$enable_encoders])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([which decoders to build])
|
||||
AC_ARG_ENABLE([decoders], AC_HELP_STRING([--enable-decoders=LIST],
|
||||
AC_ARG_ENABLE([decoders], AS_HELP_STRING([--enable-decoders=LIST],
|
||||
[Comma-separated list of decoders to build. Default=all.
|
||||
Available decoders are the same as available encoders.]),
|
||||
[], [enable_decoders=SUPPORTED_FILTERS])
|
||||
enable_decoders=`echo "$enable_decoders" | sed 's/,/ /g'`
|
||||
if test "x$enable_decoders" = xno || test "x$enable_decoders" = x; then
|
||||
enable_decoders=no
|
||||
AC_MSG_RESULT([(none)])
|
||||
else
|
||||
for arg in $enable_decoders
|
||||
@@ -135,11 +145,8 @@ else
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# LZMA2 requires that LZMA1 is enabled.
|
||||
test "x$enable_encoder_lzma2" = xyes && enable_encoder_lzma1=yes
|
||||
test "x$enable_decoder_lzma2" = xyes && enable_decoder_lzma1=yes
|
||||
|
||||
AC_DEFINE([HAVE_DECODERS], [1],
|
||||
[Define to 1 if any of HAVE_DECODER_foo have been defined.])
|
||||
AC_MSG_RESULT([$enable_decoders])
|
||||
fi
|
||||
|
||||
@@ -148,8 +155,8 @@ if test "x$enable_encoder_lzma2$enable_encoder_lzma1" = xyesno \
|
||||
AC_MSG_ERROR([LZMA2 requires that LZMA1 is also enabled.])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(COND_MAIN_ENCODER, test "x$enable_encoders" != xno && test "x$enable_encoders" != x)
|
||||
AM_CONDITIONAL(COND_MAIN_DECODER, test "x$enable_decoders" != xno && test "x$enable_decoders" != x)
|
||||
AM_CONDITIONAL(COND_MAIN_ENCODER, test "x$enable_encoders" != xno)
|
||||
AM_CONDITIONAL(COND_MAIN_DECODER, test "x$enable_decoders" != xno)
|
||||
|
||||
m4_foreach([NAME], [SUPPORTED_FILTERS],
|
||||
[AM_CONDITIONAL(COND_FILTER_[]m4_toupper(NAME), test "x$enable_filter_[]NAME" = xyes)
|
||||
@@ -195,7 +202,7 @@ m4_foreach([NAME], [SUPPORTED_MATCH_FINDERS],
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([which match finders to build])
|
||||
AC_ARG_ENABLE([match-finders], AC_HELP_STRING([--enable-match-finders=LIST],
|
||||
AC_ARG_ENABLE([match-finders], AS_HELP_STRING([--enable-match-finders=LIST],
|
||||
[Comma-separated list of match finders to build. Default=all.
|
||||
At least one match finder is required for encoding with
|
||||
the LZMA1 and LZMA2 filters. Available match finders:]
|
||||
@@ -229,12 +236,12 @@ fi
|
||||
|
||||
m4_define([SUPPORTED_CHECKS], [crc32,crc64,sha256])
|
||||
|
||||
m4_foreach([NAME], [SUPPORTED_FILTERS],
|
||||
m4_foreach([NAME], [SUPPORTED_CHECKS],
|
||||
[enable_check_[]NAME=no
|
||||
])dnl
|
||||
|
||||
AC_MSG_CHECKING([which integrity checks to build])
|
||||
AC_ARG_ENABLE([checks], AC_HELP_STRING([--enable-checks=LIST],
|
||||
AC_ARG_ENABLE([checks], AS_HELP_STRING([--enable-checks=LIST],
|
||||
[Comma-separated list of integrity checks to build.
|
||||
Default=all. Available integrity checks:]
|
||||
m4_translit(m4_defn([SUPPORTED_CHECKS]), [,], [ ])),
|
||||
@@ -260,7 +267,7 @@ else
|
||||
done
|
||||
AC_MSG_RESULT([$enable_checks])
|
||||
fi
|
||||
if test "x$enable_checks_crc32" = xno ; then
|
||||
if test "x$enable_check_crc32" = xno ; then
|
||||
AC_MSG_ERROR([For now, the CRC32 check must always be enabled.])
|
||||
fi
|
||||
|
||||
@@ -268,13 +275,27 @@ m4_foreach([NAME], [SUPPORTED_CHECKS],
|
||||
[AM_CONDITIONAL(COND_CHECK_[]m4_toupper(NAME), test "x$enable_check_[]NAME" = xyes)
|
||||
])dnl
|
||||
|
||||
AC_MSG_CHECKING([if external SHA-256 should be used])
|
||||
AC_ARG_ENABLE([external-sha256], AS_HELP_STRING([--enable-external-sha256],
|
||||
[Use SHA-256 code from the operating system.
|
||||
See INSTALL for possible subtle problems.]),
|
||||
[], [enable_external_sha256=no])
|
||||
if test "x$enable_check_sha256" != "xyes"; then
|
||||
enable_external_sha256=no
|
||||
fi
|
||||
if test "x$enable_external_sha256" = xyes; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
|
||||
###########################
|
||||
# Assembler optimizations #
|
||||
###########################
|
||||
|
||||
AC_MSG_CHECKING([if assembler optimizations should be used])
|
||||
AC_ARG_ENABLE([assembler], AC_HELP_STRING([--disable-assembler],
|
||||
AC_ARG_ENABLE([assembler], AS_HELP_STRING([--disable-assembler],
|
||||
[Do not use assembler optimizations even if such exist
|
||||
for the architecture.]),
|
||||
[], [enable_assembler=yes])
|
||||
@@ -283,7 +304,7 @@ if test "x$enable_assembler" = xyes; then
|
||||
case $host_os in
|
||||
# Darwin should work too but only if not creating universal
|
||||
# binaries. Solaris x86 could work too but I cannot test.
|
||||
linux* | *bsd* | mingw* | cygwin* | *djgpp*)
|
||||
linux* | *bsd* | mingw* | cygwin | msys | *djgpp*)
|
||||
case $host_cpu in
|
||||
i?86) enable_assembler=x86 ;;
|
||||
x86_64) enable_assembler=x86_64 ;;
|
||||
@@ -297,7 +318,7 @@ case $enable_assembler in
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT([])
|
||||
AC_MSG_ERROR([--enable-assembler accepts only \`yes', \`no', \`x86', or \`x86_64'.])
|
||||
AC_MSG_ERROR([--enable-assembler accepts only `yes', `no', `x86', or `x86_64'.])
|
||||
;;
|
||||
esac
|
||||
AM_CONDITIONAL(COND_ASM_X86, test "x$enable_assembler" = xx86)
|
||||
@@ -309,7 +330,7 @@ AM_CONDITIONAL(COND_ASM_X86_64, test "x$enable_assembler" = xx86_64)
|
||||
#####################
|
||||
|
||||
AC_MSG_CHECKING([if small size is preferred over speed])
|
||||
AC_ARG_ENABLE([small], AC_HELP_STRING([--enable-small],
|
||||
AC_ARG_ENABLE([small], AS_HELP_STRING([--enable-small],
|
||||
[Make liblzma smaller and a little slower.
|
||||
This is disabled by default to optimize for speed.]),
|
||||
[], [enable_small=no])
|
||||
@@ -317,7 +338,7 @@ if test "x$enable_small" = xyes; then
|
||||
AC_DEFINE([HAVE_SMALL], [1], [Define to 1 if optimizing for size.])
|
||||
elif test "x$enable_small" != xno; then
|
||||
AC_MSG_RESULT([])
|
||||
AC_MSG_ERROR([--enable-small accepts only \`yes' or \`no'])
|
||||
AC_MSG_ERROR([--enable-small accepts only `yes' or `no'])
|
||||
fi
|
||||
AC_MSG_RESULT([$enable_small])
|
||||
AM_CONDITIONAL(COND_SMALL, test "x$enable_small" = xyes)
|
||||
@@ -328,15 +349,47 @@ AM_CONDITIONAL(COND_SMALL, test "x$enable_small" = xyes)
|
||||
#############
|
||||
|
||||
AC_MSG_CHECKING([if threading support is wanted])
|
||||
AC_ARG_ENABLE([threads], AC_HELP_STRING([--disable-threads],
|
||||
[Disable threading support.
|
||||
This makes some things thread-unsafe.]),
|
||||
AC_ARG_ENABLE([threads], AS_HELP_STRING([--enable-threads=METHOD],
|
||||
[Supported METHODS are `yes', `no', `posix', `win95', and
|
||||
`vista'. The default is `yes'. Using `no' together with
|
||||
--enable-small makes liblzma thread unsafe.]),
|
||||
[], [enable_threads=yes])
|
||||
if test "x$enable_threads" != xyes && test "x$enable_threads" != xno; then
|
||||
AC_MSG_RESULT([])
|
||||
AC_MSG_ERROR([--enable-threads accepts only \`yes' or \`no'])
|
||||
|
||||
if test "x$enable_threads" = xyes; then
|
||||
case $host_os in
|
||||
mingw*)
|
||||
case $host_cpu in
|
||||
i?86) enable_threads=win95 ;;
|
||||
*) enable_threads=vista ;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
enable_threads=posix
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
AC_MSG_RESULT([$enable_threads])
|
||||
|
||||
case $enable_threads in
|
||||
posix | win95 | vista)
|
||||
AC_MSG_RESULT([yes, $enable_threads])
|
||||
;;
|
||||
no)
|
||||
AC_MSG_RESULT([no])
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT([])
|
||||
AC_MSG_ERROR([--enable-threads only accepts `yes', `no', `posix', `win95', or `vista'])
|
||||
;;
|
||||
esac
|
||||
|
||||
# The Win95 threading lacks thread-safe one-time initialization function.
|
||||
# It's better to disallow it instead of allowing threaded but thread-unsafe
|
||||
# build.
|
||||
if test "x$enable_small$enable_threads" = xyeswin95; then
|
||||
AC_MSG_ERROR([--enable-threads=win95 and --enable-small cannot be
|
||||
used at the same time])
|
||||
fi
|
||||
|
||||
# We use the actual result a little later.
|
||||
|
||||
|
||||
@@ -349,7 +402,7 @@ AC_MSG_RESULT([$enable_threads])
|
||||
# but most systems, on which we don't have any way to determine the amount
|
||||
# of RAM, will probably have at least 128 MiB of RAM.
|
||||
AC_MSG_CHECKING([how much RAM to assume if the real amount is unknown])
|
||||
AC_ARG_ENABLE([assume-ram], AC_HELP_STRING([--enable-assume-ram=SIZE],
|
||||
AC_ARG_ENABLE([assume-ram], AS_HELP_STRING([--enable-assume-ram=SIZE],
|
||||
[If and only if the real amount of RAM cannot be determined,
|
||||
assume SIZE MiB. The default is 128 MiB. This affects the
|
||||
default memory usage limit.]),
|
||||
@@ -369,39 +422,99 @@ AC_DEFINE_UNQUOTED([ASSUME_RAM], [$enable_assume_ram],
|
||||
# Components to install #
|
||||
#########################
|
||||
|
||||
AC_ARG_ENABLE([xz], [AC_HELP_STRING([--disable-xz],
|
||||
AC_ARG_ENABLE([xz], [AS_HELP_STRING([--disable-xz],
|
||||
[do not build the xz tool])],
|
||||
[], [enable_xz=yes])
|
||||
AM_CONDITIONAL([COND_XZ], [test x$enable_xz != xno])
|
||||
|
||||
AC_ARG_ENABLE([xzdec], [AC_HELP_STRING([--disable-xzdec],
|
||||
AC_ARG_ENABLE([xzdec], [AS_HELP_STRING([--disable-xzdec],
|
||||
[do not build xzdec])],
|
||||
[], [enable_xzdec=yes])
|
||||
test "x$enable_decoders" = xno && enable_xzdec=no
|
||||
AM_CONDITIONAL([COND_XZDEC], [test x$enable_xzdec != xno])
|
||||
|
||||
AC_ARG_ENABLE([lzmadec], [AC_HELP_STRING([--disable-lzmadec],
|
||||
AC_ARG_ENABLE([lzmadec], [AS_HELP_STRING([--disable-lzmadec],
|
||||
[do not build lzmadec
|
||||
(it exists primarily for LZMA Utils compatibility)])],
|
||||
[], [enable_lzmadec=yes])
|
||||
test "x$enable_decoder_lzma1" = xno && enable_lzmadec=no
|
||||
AM_CONDITIONAL([COND_LZMADEC], [test x$enable_lzmadec != xno])
|
||||
|
||||
AC_ARG_ENABLE([lzmainfo], [AC_HELP_STRING([--disable-lzmainfo],
|
||||
AC_ARG_ENABLE([lzmainfo], [AS_HELP_STRING([--disable-lzmainfo],
|
||||
[do not build lzmainfo
|
||||
(it exists primarily for LZMA Utils compatibility)])],
|
||||
[], [enable_lzmainfo=yes])
|
||||
test "x$enable_decoder_lzma1" = xno && enable_lzmainfo=no
|
||||
AM_CONDITIONAL([COND_LZMAINFO], [test x$enable_lzmainfo != xno])
|
||||
|
||||
AC_ARG_ENABLE([lzma-links], [AC_HELP_STRING([--disable-lzma-links],
|
||||
AC_ARG_ENABLE([lzma-links], [AS_HELP_STRING([--disable-lzma-links],
|
||||
[do not create symlinks for LZMA Utils compatibility])],
|
||||
[], [enable_lzma_links=yes])
|
||||
AM_CONDITIONAL([COND_LZMALINKS], [test x$enable_lzma_links != xno])
|
||||
|
||||
AC_ARG_ENABLE([scripts], [AC_HELP_STRING([--disable-scripts],
|
||||
AC_ARG_ENABLE([scripts], [AS_HELP_STRING([--disable-scripts],
|
||||
[do not install the scripts xzdiff, xzgrep, xzless, xzmore,
|
||||
and their symlinks])],
|
||||
[], [enable_scripts=yes])
|
||||
AM_CONDITIONAL([COND_SCRIPTS], [test x$enable_scripts != xno])
|
||||
|
||||
AC_ARG_ENABLE([doc], [AS_HELP_STRING([--disable-doc],
|
||||
[do not install documentation files to docdir
|
||||
(man pages will still be installed)])],
|
||||
[], [enable_doc=yes])
|
||||
AM_CONDITIONAL([COND_DOC], [test x$enable_doc != xno])
|
||||
|
||||
|
||||
#####################
|
||||
# Symbol versioning #
|
||||
#####################
|
||||
|
||||
AC_MSG_CHECKING([if library symbol versioning should be used])
|
||||
AC_ARG_ENABLE([symbol-versions], [AS_HELP_STRING([--enable-symbol-versions],
|
||||
[Use symbol versioning for liblzma. Enabled by default on
|
||||
GNU/Linux, other GNU-based systems, and FreeBSD.])],
|
||||
[], [enable_symbol_versions=auto])
|
||||
if test "x$enable_symbol_versions" = xauto; then
|
||||
case $host_os in
|
||||
# NOTE: Even if one omits -gnu on GNU/Linux (e.g.
|
||||
# i486-slackware-linux), configure will (via config.sub)
|
||||
# append -gnu (e.g. i486-slackware-linux-gnu), and this
|
||||
# test will work correctly.
|
||||
gnu* | *-gnu* | freebsd*)
|
||||
enable_symbol_versions=yes
|
||||
;;
|
||||
*)
|
||||
enable_symbol_versions=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
AC_MSG_RESULT([$enable_symbol_versions])
|
||||
AM_CONDITIONAL([COND_SYMVERS], [test "x$enable_symbol_versions" = xyes])
|
||||
|
||||
|
||||
##############
|
||||
# Sandboxing #
|
||||
##############
|
||||
|
||||
AC_MSG_CHECKING([if sandboxing should be used])
|
||||
AC_ARG_ENABLE([sandbox], [AS_HELP_STRING([--enable-sandbox=METHOD],
|
||||
[Sandboxing METHOD can be `auto', `no', or `capsicum'.
|
||||
The default is `auto' which enables sandboxing if
|
||||
a supported sandboxing method is found.])],
|
||||
[], [enable_sandbox=auto])
|
||||
case $enable_sandbox in
|
||||
auto)
|
||||
AC_MSG_RESULT([maybe (autodetect)])
|
||||
;;
|
||||
no | capsicum)
|
||||
AC_MSG_RESULT([$enable_sandbox])
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT([])
|
||||
AC_MSG_ERROR([--enable-sandbox only accepts `auto', `no', or `capsicum'.])
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Checks for programs.
|
||||
@@ -409,14 +522,19 @@ AM_CONDITIONAL([COND_SCRIPTS], [test x$enable_scripts != xno])
|
||||
|
||||
echo
|
||||
gl_POSIX_SHELL
|
||||
if test -z "$POSIX_SHELL" ; then
|
||||
if test -z "$POSIX_SHELL" && test "x$enable_scripts" = xyes ; then
|
||||
AC_MSG_ERROR([No POSIX conforming shell (sh) was found.])
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Initializing Automake:"
|
||||
|
||||
AM_INIT_AUTOMAKE([1.10 foreign tar-v7 filename-length-max=99])
|
||||
# We don't use "subdir-objects" yet because it breaks "make distclean" when
|
||||
# dependencies are enabled (as of Automake 1.14.1) due to this bug:
|
||||
# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17354
|
||||
# The -Wno-unsupported is used to silence warnings about missing
|
||||
# "subdir-objects".
|
||||
AM_INIT_AUTOMAKE([1.12 foreign tar-v7 filename-length-max=99 serial-tests -Wno-unsupported])
|
||||
AC_PROG_LN_S
|
||||
|
||||
AC_PROG_CC_C99
|
||||
@@ -428,16 +546,49 @@ AM_PROG_CC_C_O
|
||||
AM_PROG_AS
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
|
||||
if test "x$enable_threads" = xyes; then
|
||||
echo
|
||||
echo "Threading support:"
|
||||
AX_PTHREAD
|
||||
LIBS="$LIBS $PTHREAD_LIBS"
|
||||
AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
|
||||
CC="$PTHREAD_CC"
|
||||
AC_SEARCH_LIBS([clock_gettime], [rt])
|
||||
fi
|
||||
AM_CONDITIONAL([COND_THREADS], [test "x$ax_pthread_ok" = xyes])
|
||||
case $enable_threads in
|
||||
posix)
|
||||
echo
|
||||
echo "POSIX threading support:"
|
||||
AX_PTHREAD([:]) dnl We don't need the HAVE_PTHREAD macro.
|
||||
LIBS="$LIBS $PTHREAD_LIBS"
|
||||
AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
|
||||
|
||||
dnl NOTE: PTHREAD_CC is ignored. It would be useful on AIX,
|
||||
dnl but it's tricky to get it right together with
|
||||
dnl AC_PROG_CC_C99. Thus, this is handled by telling the
|
||||
dnl user in INSTALL to set the correct CC manually.
|
||||
|
||||
AC_DEFINE([MYTHREAD_POSIX], [1],
|
||||
[Define to 1 when using POSIX threads (pthreads).])
|
||||
|
||||
# These are nice to have but not mandatory.
|
||||
#
|
||||
# FIXME: xz uses clock_gettime if it is available and can do
|
||||
# it even when threading is disabled. Moving this outside
|
||||
# of pthread detection may be undesirable because then
|
||||
# liblzma may get linked against librt even when librt isn't
|
||||
# needed by liblzma.
|
||||
OLD_CFLAGS=$CFLAGS
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
AC_SEARCH_LIBS([clock_gettime], [rt])
|
||||
AC_CHECK_FUNCS([clock_gettime pthread_condattr_setclock])
|
||||
AC_CHECK_DECLS([CLOCK_MONOTONIC], [], [], [[#include <time.h>]])
|
||||
CFLAGS=$OLD_CFLAGS
|
||||
;;
|
||||
win95)
|
||||
AC_DEFINE([MYTHREAD_WIN95], [1], [Define to 1 when using
|
||||
Windows 95 (and thus XP) compatible threads.
|
||||
This avoids use of features that were added in
|
||||
Windows Vista.])
|
||||
;;
|
||||
vista)
|
||||
AC_DEFINE([MYTHREAD_VISTA], [1], [Define to 1 when using
|
||||
Windows Vista compatible threads. This uses
|
||||
features that are not available on Windows XP.])
|
||||
;;
|
||||
esac
|
||||
AM_CONDITIONAL([COND_THREADS], [test "x$enable_threads" != xno])
|
||||
|
||||
echo
|
||||
echo "Initializing Libtool:"
|
||||
@@ -458,9 +609,10 @@ AM_CONDITIONAL([COND_SHARED], [test "x$enable_shared" != xno])
|
||||
|
||||
echo
|
||||
echo "Initializing gettext:"
|
||||
AM_GNU_GETTEXT_VERSION([0.16.1])
|
||||
AM_GNU_GETTEXT_VERSION([0.19])
|
||||
AM_GNU_GETTEXT([external])
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Checks for header files.
|
||||
###############################################################################
|
||||
@@ -474,6 +626,9 @@ AC_CHECK_HEADERS([fcntl.h limits.h sys/time.h],
|
||||
[],
|
||||
[AC_MSG_ERROR([Required header file(s) are missing.])])
|
||||
|
||||
# This allows the use of the intrinsic functions if they are available.
|
||||
AC_CHECK_HEADERS([immintrin.h])
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
@@ -496,7 +651,7 @@ AC_TYPE_UINTPTR_T
|
||||
AC_CHECK_SIZEOF([size_t])
|
||||
|
||||
# The command line tool can copy high resolution timestamps if such
|
||||
# information is availabe in struct stat. Otherwise one second accuracy
|
||||
# information is available in struct stat. Otherwise one second accuracy
|
||||
# is used.
|
||||
AC_CHECK_MEMBERS([
|
||||
struct stat.st_atim.tv_nsec,
|
||||
@@ -517,7 +672,7 @@ AC_C_BIGENDIAN
|
||||
gl_GETOPT
|
||||
|
||||
# Find the best function to set timestamps.
|
||||
AC_CHECK_FUNCS([futimens futimes futimesat utimes utime], [break])
|
||||
AC_CHECK_FUNCS([futimens futimes futimesat utimes _futime utime], [break])
|
||||
|
||||
# This is nice to have but not mandatory.
|
||||
AC_CHECK_FUNCS([posix_fadvise])
|
||||
@@ -528,6 +683,85 @@ TUKLIB_PHYSMEM
|
||||
TUKLIB_CPUCORES
|
||||
TUKLIB_MBSTR
|
||||
|
||||
# If requsted, check for system-provided SHA-256. At least the following
|
||||
# implementations are supported:
|
||||
#
|
||||
# OS Headers Library Type Function
|
||||
# FreeBSD sys/types.h + sha256.h libmd SHA256_CTX SHA256_Init
|
||||
# NetBSD sys/types.h + sha2.h SHA256_CTX SHA256_Init
|
||||
# OpenBSD sys/types.h + sha2.h SHA2_CTX SHA256Init
|
||||
# Solaris sys/types.h + sha2.h libmd SHA256_CTX SHA256Init
|
||||
# MINIX 3 sys/types.h + sha2.h SHA256_CTX SHA256_Init
|
||||
# Darwin CommonCrypto/CommonDigest.h CC_SHA256_CTX CC_SHA256_Init
|
||||
#
|
||||
# Note that Darwin's CC_SHA256_Update takes buffer size as uint32_t instead
|
||||
# of size_t.
|
||||
#
|
||||
sha256_header_found=no
|
||||
sha256_type_found=no
|
||||
sha256_func_found=no
|
||||
if test "x$enable_external_sha256" = "xyes"; then
|
||||
# Test for Common Crypto before others, because Darwin has sha256.h
|
||||
# too and we don't want to use that, because on older versions it
|
||||
# uses OpenSSL functions, whose SHA256_Init is not guaranteed to
|
||||
# succeed.
|
||||
AC_CHECK_HEADERS(
|
||||
[CommonCrypto/CommonDigest.h sha256.h sha2.h],
|
||||
[sha256_header_found=yes ; break])
|
||||
if test "x$sha256_header_found" = xyes; then
|
||||
AC_CHECK_TYPES([CC_SHA256_CTX, SHA256_CTX, SHA2_CTX],
|
||||
[sha256_type_found=yes], [],
|
||||
[[#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_COMMONCRYPTO_COMMONDIGEST_H
|
||||
# include <CommonCrypto/CommonDigest.h>
|
||||
#endif
|
||||
#ifdef HAVE_SHA256_H
|
||||
# include <sha256.h>
|
||||
#endif
|
||||
#ifdef HAVE_SHA2_H
|
||||
# include <sha2.h>
|
||||
#endif]])
|
||||
if test "x$sha256_type_found" = xyes ; then
|
||||
AC_SEARCH_LIBS([SHA256Init], [md])
|
||||
AC_SEARCH_LIBS([SHA256_Init], [md])
|
||||
AC_CHECK_FUNCS([CC_SHA256_Init SHA256Init SHA256_Init],
|
||||
[sha256_func_found=yes ; break])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL([COND_INTERNAL_SHA256], [test "x$sha256_func_found" = xno])
|
||||
if test "x$enable_external_sha256$sha256_func_found" = xyesno; then
|
||||
AC_MSG_ERROR([--enable-external-sha256 was specified but no supported external SHA-256 implementation was found])
|
||||
fi
|
||||
|
||||
# Check for SSE2 intrinsics.
|
||||
AC_CHECK_DECL([_mm_movemask_epi8],
|
||||
[AC_DEFINE([HAVE__MM_MOVEMASK_EPI8], [1],
|
||||
[Define to 1 if _mm_movemask_epi8 is available.])],
|
||||
[],
|
||||
[#ifdef HAVE_IMMINTRIN_H
|
||||
#include <immintrin.h>
|
||||
#endif])
|
||||
|
||||
# Check for sandbox support. If one is found, set enable_sandbox=found.
|
||||
case $enable_sandbox in
|
||||
auto | capsicum)
|
||||
AX_CHECK_CAPSICUM([enable_sandbox=found], [:])
|
||||
;;
|
||||
esac
|
||||
|
||||
# If a specific sandboxing method was explicitly requested and it wasn't
|
||||
# found, give an error.
|
||||
case $enable_sandbox in
|
||||
auto | no | found)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([$enable_sandbox support not found])
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
###############################################################################
|
||||
# If using GCC, set some additional AM_CFLAGS:
|
||||
@@ -561,6 +795,7 @@ if test "$GCC" = yes ; then
|
||||
for NEW_FLAG in \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-Wvla \
|
||||
-Wformat=2 \
|
||||
-Winit-self \
|
||||
-Wmissing-include-dirs \
|
||||
@@ -582,8 +817,9 @@ if test "$GCC" = yes ; then
|
||||
do
|
||||
AC_MSG_CHECKING([if $CC accepts $NEW_FLAG])
|
||||
OLD_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $NEW_FLAG"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([void foo(void) { }])], [
|
||||
CFLAGS="$CFLAGS $NEW_FLAG -Werror"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
|
||||
[void foo(void); void foo(void) { }])], [
|
||||
AM_CFLAGS="$AM_CFLAGS $NEW_FLAG"
|
||||
AC_MSG_RESULT([yes])
|
||||
], [
|
||||
@@ -593,7 +829,7 @@ if test "$GCC" = yes ; then
|
||||
done
|
||||
|
||||
AC_ARG_ENABLE([werror],
|
||||
AC_HELP_STRING([--enable-werror], [Enable -Werror to abort
|
||||
AS_HELP_STRING([--enable-werror], [Enable -Werror to abort
|
||||
compilation on all compiler warnings.]),
|
||||
[], [enable_werror=no])
|
||||
if test "x$enable_werror" = "xyes"; then
|
||||
@@ -625,20 +861,19 @@ AC_CONFIG_FILES([
|
||||
po/Makefile.in
|
||||
lib/Makefile
|
||||
src/Makefile
|
||||
src/liblzma/liblzma.pc
|
||||
src/liblzma/Makefile
|
||||
src/liblzma/api/Makefile
|
||||
src/xz/Makefile
|
||||
src/xzdec/Makefile
|
||||
src/lzmainfo/Makefile
|
||||
src/scripts/Makefile
|
||||
src/scripts/xzdiff
|
||||
src/scripts/xzgrep
|
||||
src/scripts/xzmore
|
||||
src/scripts/xzless
|
||||
tests/Makefile
|
||||
debug/Makefile
|
||||
])
|
||||
AC_CONFIG_FILES([src/scripts/xzdiff], [chmod +x src/scripts/xzdiff])
|
||||
AC_CONFIG_FILES([src/scripts/xzgrep], [chmod +x src/scripts/xzgrep])
|
||||
AC_CONFIG_FILES([src/scripts/xzmore], [chmod +x src/scripts/xzmore])
|
||||
AC_CONFIG_FILES([src/scripts/xzless], [chmod +x src/scripts/xzless])
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
@@ -651,9 +886,15 @@ if test x$tuklib_cv_physmem_method = xunknown; then
|
||||
echo "or make a patch to add support for this operating system."
|
||||
fi
|
||||
|
||||
# Not threading yet so don't warn.
|
||||
#if test x$tuklib_cv_cpucores_method = xunknown; then
|
||||
# echo
|
||||
# echo "WARNING:"
|
||||
# echo "No supported method to detect the number of CPU cores."
|
||||
#fi
|
||||
if test x$tuklib_cv_cpucores_method = xunknown; then
|
||||
echo
|
||||
echo "WARNING:"
|
||||
echo "No supported method to detect the number of CPU cores."
|
||||
fi
|
||||
|
||||
if test "x$enable_threads$enable_small" = xnoyes; then
|
||||
echo
|
||||
echo "NOTE:"
|
||||
echo "liblzma will be thread unsafe due the combination"
|
||||
echo "of --disable-threads --enable-small."
|
||||
fi
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
## You can do whatever you want with this file.
|
||||
##
|
||||
|
||||
EXTRA_DIST = \
|
||||
translation.bash
|
||||
|
||||
noinst_PROGRAMS = \
|
||||
repeat \
|
||||
sync_flush \
|
||||
|
||||
@@ -3,7 +3,7 @@ Debug tools
|
||||
-----------
|
||||
|
||||
This directory contains a few tiny programs that may be helpful when
|
||||
debugging LZMA Utils.
|
||||
debugging XZ Utils.
|
||||
|
||||
These tools are not meant to be installed. Often one needs to edit
|
||||
the source code a little to make the programs do the wanted things.
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "lzma.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#define CHUNK 64
|
||||
|
||||
|
||||
static lzma_stream strm = LZMA_STREAM_INIT;
|
||||
static FILE *file_in;
|
||||
@@ -22,7 +24,6 @@ static FILE *file_in;
|
||||
static void
|
||||
encode(size_t size, lzma_action action)
|
||||
{
|
||||
static const size_t CHUNK = 64;
|
||||
uint8_t in[CHUNK];
|
||||
uint8_t out[CHUNK];
|
||||
lzma_ret ret;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "lzma.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#define CHUNK 64
|
||||
|
||||
|
||||
static lzma_stream strm = LZMA_STREAM_INIT;
|
||||
static FILE *file_in;
|
||||
@@ -22,7 +24,6 @@ static FILE *file_in;
|
||||
static void
|
||||
encode(size_t size, lzma_action action)
|
||||
{
|
||||
static const size_t CHUNK = 64;
|
||||
uint8_t in[CHUNK];
|
||||
uint8_t out[CHUNK];
|
||||
lzma_ret ret;
|
||||
|
||||
31
doc/examples/00_README.txt
Normal file
31
doc/examples/00_README.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
liblzma example programs
|
||||
========================
|
||||
|
||||
Introduction
|
||||
|
||||
The examples are written so that the same comments aren't
|
||||
repeated (much) in later files.
|
||||
|
||||
On POSIX systems, the examples should build by just typing "make".
|
||||
|
||||
The examples that use stdin or stdout don't set stdin and stdout
|
||||
to binary mode. On systems where it matters (e.g. Windows) it is
|
||||
possible that the examples won't work without modification.
|
||||
|
||||
|
||||
List of examples
|
||||
|
||||
01_compress_easy.c Multi-call compression using
|
||||
a compression preset
|
||||
|
||||
02_decompress.c Multi-call decompression
|
||||
|
||||
03_compress_custom.c Like 01_compress_easy.c but using
|
||||
a custom filter chain
|
||||
(x86 BCJ + LZMA2)
|
||||
|
||||
04_compress_easy_mt.c Multi-threaded multi-call
|
||||
compression using a compression
|
||||
preset
|
||||
|
||||
297
doc/examples/01_compress_easy.c
Normal file
297
doc/examples/01_compress_easy.c
Normal file
@@ -0,0 +1,297 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/// \file 01_compress_easy.c
|
||||
/// \brief Compress from stdin to stdout in multi-call mode
|
||||
///
|
||||
/// Usage: ./01_compress_easy PRESET < INFILE > OUTFILE
|
||||
///
|
||||
/// Example: ./01_compress_easy 6 < foo > foo.xz
|
||||
//
|
||||
// Author: Lasse Collin
|
||||
//
|
||||
// This file has been put into the public domain.
|
||||
// You can do whatever you want with this file.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <lzma.h>
|
||||
|
||||
|
||||
static void
|
||||
show_usage_and_exit(const char *argv0)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s PRESET < INFILE > OUTFILE\n"
|
||||
"PRESET is a number 0-9 and can optionally be "
|
||||
"followed by `e' to indicate extreme preset\n",
|
||||
argv0);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
static uint32_t
|
||||
get_preset(int argc, char **argv)
|
||||
{
|
||||
// One argument whose first char must be 0-9.
|
||||
if (argc != 2 || argv[1][0] < '0' || argv[1][0] > '9')
|
||||
show_usage_and_exit(argv[0]);
|
||||
|
||||
// Calculate the preste level 0-9.
|
||||
uint32_t preset = argv[1][0] - '0';
|
||||
|
||||
// If there is a second char, it must be 'e'. It will set
|
||||
// the LZMA_PRESET_EXTREME flag.
|
||||
if (argv[1][1] != '\0') {
|
||||
if (argv[1][1] != 'e' || argv[1][2] != '\0')
|
||||
show_usage_and_exit(argv[0]);
|
||||
|
||||
preset |= LZMA_PRESET_EXTREME;
|
||||
}
|
||||
|
||||
return preset;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
init_encoder(lzma_stream *strm, uint32_t preset)
|
||||
{
|
||||
// Initialize the encoder using a preset. Set the integrity to check
|
||||
// to CRC64, which is the default in the xz command line tool. If
|
||||
// the .xz file needs to be decompressed with XZ Embedded, use
|
||||
// LZMA_CHECK_CRC32 instead.
|
||||
lzma_ret ret = lzma_easy_encoder(strm, preset, LZMA_CHECK_CRC64);
|
||||
|
||||
// Return successfully if the initialization went fine.
|
||||
if (ret == LZMA_OK)
|
||||
return true;
|
||||
|
||||
// Something went wrong. The possible errors are documented in
|
||||
// lzma/container.h (src/liblzma/api/lzma/container.h in the source
|
||||
// package or e.g. /usr/include/lzma/container.h depending on the
|
||||
// install prefix).
|
||||
const char *msg;
|
||||
switch (ret) {
|
||||
case LZMA_MEM_ERROR:
|
||||
msg = "Memory allocation failed";
|
||||
break;
|
||||
|
||||
case LZMA_OPTIONS_ERROR:
|
||||
msg = "Specified preset is not supported";
|
||||
break;
|
||||
|
||||
case LZMA_UNSUPPORTED_CHECK:
|
||||
msg = "Specified integrity check is not supported";
|
||||
break;
|
||||
|
||||
default:
|
||||
// This is most likely LZMA_PROG_ERROR indicating a bug in
|
||||
// this program or in liblzma. It is inconvenient to have a
|
||||
// separate error message for errors that should be impossible
|
||||
// to occur, but knowing the error code is important for
|
||||
// debugging. That's why it is good to print the error code
|
||||
// at least when there is no good error message to show.
|
||||
msg = "Unknown error, possibly a bug";
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Error initializing the encoder: %s (error code %u)\n",
|
||||
msg, ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
compress(lzma_stream *strm, FILE *infile, FILE *outfile)
|
||||
{
|
||||
// This will be LZMA_RUN until the end of the input file is reached.
|
||||
// This tells lzma_code() when there will be no more input.
|
||||
lzma_action action = LZMA_RUN;
|
||||
|
||||
// Buffers to temporarily hold uncompressed input
|
||||
// and compressed output.
|
||||
uint8_t inbuf[BUFSIZ];
|
||||
uint8_t outbuf[BUFSIZ];
|
||||
|
||||
// Initialize the input and output pointers. Initializing next_in
|
||||
// and avail_in isn't really necessary when we are going to encode
|
||||
// just one file since LZMA_STREAM_INIT takes care of initializing
|
||||
// those already. But it doesn't hurt much and it will be needed
|
||||
// if encoding more than one file like we will in 02_decompress.c.
|
||||
//
|
||||
// While we don't care about strm->total_in or strm->total_out in this
|
||||
// example, it is worth noting that initializing the encoder will
|
||||
// always reset total_in and total_out to zero. But the encoder
|
||||
// initialization doesn't touch next_in, avail_in, next_out, or
|
||||
// avail_out.
|
||||
strm->next_in = NULL;
|
||||
strm->avail_in = 0;
|
||||
strm->next_out = outbuf;
|
||||
strm->avail_out = sizeof(outbuf);
|
||||
|
||||
// Loop until the file has been successfully compressed or until
|
||||
// an error occurs.
|
||||
while (true) {
|
||||
// Fill the input buffer if it is empty.
|
||||
if (strm->avail_in == 0 && !feof(infile)) {
|
||||
strm->next_in = inbuf;
|
||||
strm->avail_in = fread(inbuf, 1, sizeof(inbuf),
|
||||
infile);
|
||||
|
||||
if (ferror(infile)) {
|
||||
fprintf(stderr, "Read error: %s\n",
|
||||
strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Once the end of the input file has been reached,
|
||||
// we need to tell lzma_code() that no more input
|
||||
// will be coming and that it should finish the
|
||||
// encoding.
|
||||
if (feof(infile))
|
||||
action = LZMA_FINISH;
|
||||
}
|
||||
|
||||
// Tell liblzma do the actual encoding.
|
||||
//
|
||||
// This reads up to strm->avail_in bytes of input starting
|
||||
// from strm->next_in. avail_in will be decremented and
|
||||
// next_in incremented by an equal amount to match the
|
||||
// number of input bytes consumed.
|
||||
//
|
||||
// Up to strm->avail_out bytes of compressed output will be
|
||||
// written starting from strm->next_out. avail_out and next_out
|
||||
// will be incremented by an equal amount to match the number
|
||||
// of output bytes written.
|
||||
//
|
||||
// The encoder has to do internal buffering, which means that
|
||||
// it may take quite a bit of input before the same data is
|
||||
// available in compressed form in the output buffer.
|
||||
lzma_ret ret = lzma_code(strm, action);
|
||||
|
||||
// If the output buffer is full or if the compression finished
|
||||
// successfully, write the data from the output bufffer to
|
||||
// the output file.
|
||||
if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
|
||||
// When lzma_code() has returned LZMA_STREAM_END,
|
||||
// the output buffer is likely to be only partially
|
||||
// full. Calculate how much new data there is to
|
||||
// be written to the output file.
|
||||
size_t write_size = sizeof(outbuf) - strm->avail_out;
|
||||
|
||||
if (fwrite(outbuf, 1, write_size, outfile)
|
||||
!= write_size) {
|
||||
fprintf(stderr, "Write error: %s\n",
|
||||
strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Reset next_out and avail_out.
|
||||
strm->next_out = outbuf;
|
||||
strm->avail_out = sizeof(outbuf);
|
||||
}
|
||||
|
||||
// Normally the return value of lzma_code() will be LZMA_OK
|
||||
// until everything has been encoded.
|
||||
if (ret != LZMA_OK) {
|
||||
// Once everything has been encoded successfully, the
|
||||
// return value of lzma_code() will be LZMA_STREAM_END.
|
||||
//
|
||||
// It is important to check for LZMA_STREAM_END. Do not
|
||||
// assume that getting ret != LZMA_OK would mean that
|
||||
// everything has gone well.
|
||||
if (ret == LZMA_STREAM_END)
|
||||
return true;
|
||||
|
||||
// It's not LZMA_OK nor LZMA_STREAM_END,
|
||||
// so it must be an error code. See lzma/base.h
|
||||
// (src/liblzma/api/lzma/base.h in the source package
|
||||
// or e.g. /usr/include/lzma/base.h depending on the
|
||||
// install prefix) for the list and documentation of
|
||||
// possible values. Most values listen in lzma_ret
|
||||
// enumeration aren't possible in this example.
|
||||
const char *msg;
|
||||
switch (ret) {
|
||||
case LZMA_MEM_ERROR:
|
||||
msg = "Memory allocation failed";
|
||||
break;
|
||||
|
||||
case LZMA_DATA_ERROR:
|
||||
// This error is returned if the compressed
|
||||
// or uncompressed size get near 8 EiB
|
||||
// (2^63 bytes) because that's where the .xz
|
||||
// file format size limits currently are.
|
||||
// That is, the possibility of this error
|
||||
// is mostly theoretical unless you are doing
|
||||
// something very unusual.
|
||||
//
|
||||
// Note that strm->total_in and strm->total_out
|
||||
// have nothing to do with this error. Changing
|
||||
// those variables won't increase or decrease
|
||||
// the chance of getting this error.
|
||||
msg = "File size limits exceeded";
|
||||
break;
|
||||
|
||||
default:
|
||||
// This is most likely LZMA_PROG_ERROR, but
|
||||
// if this program is buggy (or liblzma has
|
||||
// a bug), it may be e.g. LZMA_BUF_ERROR or
|
||||
// LZMA_OPTIONS_ERROR too.
|
||||
//
|
||||
// It is inconvenient to have a separate
|
||||
// error message for errors that should be
|
||||
// impossible to occur, but knowing the error
|
||||
// code is important for debugging. That's why
|
||||
// it is good to print the error code at least
|
||||
// when there is no good error message to show.
|
||||
msg = "Unknown error, possibly a bug";
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Encoder error: %s (error code %u)\n",
|
||||
msg, ret);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
// Get the preset number from the command line.
|
||||
uint32_t preset = get_preset(argc, argv);
|
||||
|
||||
// Initialize a lzma_stream structure. When it is allocated on stack,
|
||||
// it is simplest to use LZMA_STREAM_INIT macro like below. When it
|
||||
// is allocated on heap, using memset(strmptr, 0, sizeof(*strmptr))
|
||||
// works (as long as NULL pointers are represented with zero bits
|
||||
// as they are on practically all computers today).
|
||||
lzma_stream strm = LZMA_STREAM_INIT;
|
||||
|
||||
// Initialize the encoder. If it succeeds, compress from
|
||||
// stdin to stdout.
|
||||
bool success = init_encoder(&strm, preset);
|
||||
if (success)
|
||||
success = compress(&strm, stdin, stdout);
|
||||
|
||||
// Free the memory allocated for the encoder. If we were encoding
|
||||
// multiple files, this would only need to be done after the last
|
||||
// file. See 02_decompress.c for handling of multiple files.
|
||||
//
|
||||
// It is OK to call lzma_end() multiple times or when it hasn't been
|
||||
// actually used except initialized with LZMA_STREAM_INIT.
|
||||
lzma_end(&strm);
|
||||
|
||||
// Close stdout to catch possible write errors that can occur
|
||||
// when pending data is flushed from the stdio buffers.
|
||||
if (fclose(stdout)) {
|
||||
fprintf(stderr, "Write error: %s\n", strerror(errno));
|
||||
success = false;
|
||||
}
|
||||
|
||||
return success ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
287
doc/examples/02_decompress.c
Normal file
287
doc/examples/02_decompress.c
Normal file
@@ -0,0 +1,287 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/// \file 02_decompress.c
|
||||
/// \brief Decompress .xz files to stdout
|
||||
///
|
||||
/// Usage: ./02_decompress INPUT_FILES... > OUTFILE
|
||||
///
|
||||
/// Example: ./02_decompress foo.xz bar.xz > foobar
|
||||
//
|
||||
// Author: Lasse Collin
|
||||
//
|
||||
// This file has been put into the public domain.
|
||||
// You can do whatever you want with this file.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <lzma.h>
|
||||
|
||||
|
||||
static bool
|
||||
init_decoder(lzma_stream *strm)
|
||||
{
|
||||
// Initialize a .xz decoder. The decoder supports a memory usage limit
|
||||
// and a set of flags.
|
||||
//
|
||||
// The memory usage of the decompressor depends on the settings used
|
||||
// to compress a .xz file. It can vary from less than a megabyte to
|
||||
// a few gigabytes, but in practice (at least for now) it rarely
|
||||
// exceeds 65 MiB because that's how much memory is required to
|
||||
// decompress files created with "xz -9". Settings requiring more
|
||||
// memory take extra effort to use and don't (at least for now)
|
||||
// provide significantly better compression in most cases.
|
||||
//
|
||||
// Memory usage limit is useful if it is important that the
|
||||
// decompressor won't consume gigabytes of memory. The need
|
||||
// for limiting depends on the application. In this example,
|
||||
// no memory usage limiting is used. This is done by setting
|
||||
// the limit to UINT64_MAX.
|
||||
//
|
||||
// The .xz format allows concatenating compressed files as is:
|
||||
//
|
||||
// echo foo | xz > foobar.xz
|
||||
// echo bar | xz >> foobar.xz
|
||||
//
|
||||
// When decompressing normal standalone .xz files, LZMA_CONCATENATED
|
||||
// should always be used to support decompression of concatenated
|
||||
// .xz files. If LZMA_CONCATENATED isn't used, the decoder will stop
|
||||
// after the first .xz stream. This can be useful when .xz data has
|
||||
// been embedded inside another file format.
|
||||
//
|
||||
// Flags other than LZMA_CONCATENATED are supported too, and can
|
||||
// be combined with bitwise-or. See lzma/container.h
|
||||
// (src/liblzma/api/lzma/container.h in the source package or e.g.
|
||||
// /usr/include/lzma/container.h depending on the install prefix)
|
||||
// for details.
|
||||
lzma_ret ret = lzma_stream_decoder(
|
||||
strm, UINT64_MAX, LZMA_CONCATENATED);
|
||||
|
||||
// Return successfully if the initialization went fine.
|
||||
if (ret == LZMA_OK)
|
||||
return true;
|
||||
|
||||
// Something went wrong. The possible errors are documented in
|
||||
// lzma/container.h (src/liblzma/api/lzma/container.h in the source
|
||||
// package or e.g. /usr/include/lzma/container.h depending on the
|
||||
// install prefix).
|
||||
//
|
||||
// Note that LZMA_MEMLIMIT_ERROR is never possible here. If you
|
||||
// specify a very tiny limit, the error will be delayed until
|
||||
// the first headers have been parsed by a call to lzma_code().
|
||||
const char *msg;
|
||||
switch (ret) {
|
||||
case LZMA_MEM_ERROR:
|
||||
msg = "Memory allocation failed";
|
||||
break;
|
||||
|
||||
case LZMA_OPTIONS_ERROR:
|
||||
msg = "Unsupported decompressor flags";
|
||||
break;
|
||||
|
||||
default:
|
||||
// This is most likely LZMA_PROG_ERROR indicating a bug in
|
||||
// this program or in liblzma. It is inconvenient to have a
|
||||
// separate error message for errors that should be impossible
|
||||
// to occur, but knowing the error code is important for
|
||||
// debugging. That's why it is good to print the error code
|
||||
// at least when there is no good error message to show.
|
||||
msg = "Unknown error, possibly a bug";
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Error initializing the decoder: %s (error code %u)\n",
|
||||
msg, ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
decompress(lzma_stream *strm, const char *inname, FILE *infile, FILE *outfile)
|
||||
{
|
||||
// When LZMA_CONCATENATED flag was used when initializing the decoder,
|
||||
// we need to tell lzma_code() when there will be no more input.
|
||||
// This is done by setting action to LZMA_FINISH instead of LZMA_RUN
|
||||
// in the same way as it is done when encoding.
|
||||
//
|
||||
// When LZMA_CONCATENATED isn't used, there is no need to use
|
||||
// LZMA_FINISH to tell when all the input has been read, but it
|
||||
// is still OK to use it if you want. When LZMA_CONCATENATED isn't
|
||||
// used, the decoder will stop after the first .xz stream. In that
|
||||
// case some unused data may be left in strm->next_in.
|
||||
lzma_action action = LZMA_RUN;
|
||||
|
||||
uint8_t inbuf[BUFSIZ];
|
||||
uint8_t outbuf[BUFSIZ];
|
||||
|
||||
strm->next_in = NULL;
|
||||
strm->avail_in = 0;
|
||||
strm->next_out = outbuf;
|
||||
strm->avail_out = sizeof(outbuf);
|
||||
|
||||
while (true) {
|
||||
if (strm->avail_in == 0 && !feof(infile)) {
|
||||
strm->next_in = inbuf;
|
||||
strm->avail_in = fread(inbuf, 1, sizeof(inbuf),
|
||||
infile);
|
||||
|
||||
if (ferror(infile)) {
|
||||
fprintf(stderr, "%s: Read error: %s\n",
|
||||
inname, strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Once the end of the input file has been reached,
|
||||
// we need to tell lzma_code() that no more input
|
||||
// will be coming. As said before, this isn't required
|
||||
// if the LZMA_CONCATENATED flag isn't used when
|
||||
// initializing the decoder.
|
||||
if (feof(infile))
|
||||
action = LZMA_FINISH;
|
||||
}
|
||||
|
||||
lzma_ret ret = lzma_code(strm, action);
|
||||
|
||||
if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
|
||||
size_t write_size = sizeof(outbuf) - strm->avail_out;
|
||||
|
||||
if (fwrite(outbuf, 1, write_size, outfile)
|
||||
!= write_size) {
|
||||
fprintf(stderr, "Write error: %s\n",
|
||||
strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
strm->next_out = outbuf;
|
||||
strm->avail_out = sizeof(outbuf);
|
||||
}
|
||||
|
||||
if (ret != LZMA_OK) {
|
||||
// Once everything has been decoded successfully, the
|
||||
// return value of lzma_code() will be LZMA_STREAM_END.
|
||||
//
|
||||
// It is important to check for LZMA_STREAM_END. Do not
|
||||
// assume that getting ret != LZMA_OK would mean that
|
||||
// everything has gone well or that when you aren't
|
||||
// getting more output it must have successfully
|
||||
// decoded everything.
|
||||
if (ret == LZMA_STREAM_END)
|
||||
return true;
|
||||
|
||||
// It's not LZMA_OK nor LZMA_STREAM_END,
|
||||
// so it must be an error code. See lzma/base.h
|
||||
// (src/liblzma/api/lzma/base.h in the source package
|
||||
// or e.g. /usr/include/lzma/base.h depending on the
|
||||
// install prefix) for the list and documentation of
|
||||
// possible values. Many values listen in lzma_ret
|
||||
// enumeration aren't possible in this example, but
|
||||
// can be made possible by enabling memory usage limit
|
||||
// or adding flags to the decoder initialization.
|
||||
const char *msg;
|
||||
switch (ret) {
|
||||
case LZMA_MEM_ERROR:
|
||||
msg = "Memory allocation failed";
|
||||
break;
|
||||
|
||||
case LZMA_FORMAT_ERROR:
|
||||
// .xz magic bytes weren't found.
|
||||
msg = "The input is not in the .xz format";
|
||||
break;
|
||||
|
||||
case LZMA_OPTIONS_ERROR:
|
||||
// For example, the headers specify a filter
|
||||
// that isn't supported by this liblzma
|
||||
// version (or it hasn't been enabled when
|
||||
// building liblzma, but no-one sane does
|
||||
// that unless building liblzma for an
|
||||
// embedded system). Upgrading to a newer
|
||||
// liblzma might help.
|
||||
//
|
||||
// Note that it is unlikely that the file has
|
||||
// accidentally became corrupt if you get this
|
||||
// error. The integrity of the .xz headers is
|
||||
// always verified with a CRC32, so
|
||||
// unintentionally corrupt files can be
|
||||
// distinguished from unsupported files.
|
||||
msg = "Unsupported compression options";
|
||||
break;
|
||||
|
||||
case LZMA_DATA_ERROR:
|
||||
msg = "Compressed file is corrupt";
|
||||
break;
|
||||
|
||||
case LZMA_BUF_ERROR:
|
||||
// Typically this error means that a valid
|
||||
// file has got truncated, but it might also
|
||||
// be a damaged part in the file that makes
|
||||
// the decoder think the file is truncated.
|
||||
// If you prefer, you can use the same error
|
||||
// message for this as for LZMA_DATA_ERROR.
|
||||
msg = "Compressed file is truncated or "
|
||||
"otherwise corrupt";
|
||||
break;
|
||||
|
||||
default:
|
||||
// This is most likely LZMA_PROG_ERROR.
|
||||
msg = "Unknown error, possibly a bug";
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stderr, "%s: Decoder error: "
|
||||
"%s (error code %u)\n",
|
||||
inname, msg, ret);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
if (argc <= 1) {
|
||||
fprintf(stderr, "Usage: %s FILES...\n", argv[0]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
lzma_stream strm = LZMA_STREAM_INIT;
|
||||
|
||||
bool success = true;
|
||||
|
||||
// Try to decompress all files.
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
if (!init_decoder(&strm)) {
|
||||
// Decoder initialization failed. There's no point
|
||||
// to retry it so we need to exit.
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
|
||||
FILE *infile = fopen(argv[i], "rb");
|
||||
|
||||
if (infile == NULL) {
|
||||
fprintf(stderr, "%s: Error opening the "
|
||||
"input file: %s\n",
|
||||
argv[i], strerror(errno));
|
||||
success = false;
|
||||
} else {
|
||||
success &= decompress(&strm, argv[i], infile, stdout);
|
||||
fclose(infile);
|
||||
}
|
||||
}
|
||||
|
||||
// Free the memory allocated for the decoder. This only needs to be
|
||||
// done after the last file.
|
||||
lzma_end(&strm);
|
||||
|
||||
if (fclose(stdout)) {
|
||||
fprintf(stderr, "Write error: %s\n", strerror(errno));
|
||||
success = false;
|
||||
}
|
||||
|
||||
return success ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
193
doc/examples/03_compress_custom.c
Normal file
193
doc/examples/03_compress_custom.c
Normal file
@@ -0,0 +1,193 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/// \file 03_compress_custom.c
|
||||
/// \brief Compress in multi-call mode using x86 BCJ and LZMA2
|
||||
///
|
||||
/// Usage: ./03_compress_custom < INFILE > OUTFILE
|
||||
///
|
||||
/// Example: ./03_compress_custom < foo > foo.xz
|
||||
//
|
||||
// Author: Lasse Collin
|
||||
//
|
||||
// This file has been put into the public domain.
|
||||
// You can do whatever you want with this file.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <lzma.h>
|
||||
|
||||
|
||||
static bool
|
||||
init_encoder(lzma_stream *strm)
|
||||
{
|
||||
// Use the default preset (6) for LZMA2.
|
||||
//
|
||||
// The lzma_options_lzma structure and the lzma_lzma_preset() function
|
||||
// are declared in lzma/lzma12.h (src/liblzma/api/lzma/lzma12.h in the
|
||||
// source package or e.g. /usr/include/lzma/lzma12.h depending on
|
||||
// the install prefix).
|
||||
lzma_options_lzma opt_lzma2;
|
||||
if (lzma_lzma_preset(&opt_lzma2, LZMA_PRESET_DEFAULT)) {
|
||||
// It should never fail because the default preset
|
||||
// (and presets 0-9 optionally with LZMA_PRESET_EXTREME)
|
||||
// are supported by all stable liblzma versions.
|
||||
//
|
||||
// (The encoder initialization later in this function may
|
||||
// still fail due to unsupported preset *if* the features
|
||||
// required by the preset have been disabled at build time,
|
||||
// but no-one does such things except on embedded systems.)
|
||||
fprintf(stderr, "Unsupported preset, possibly a bug\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Now we could customize the LZMA2 options if we wanted. For example,
|
||||
// we could set the the dictionary size (opt_lzma2.dict_size) to
|
||||
// something else than the default (8 MiB) of the default preset.
|
||||
// See lzma/lzma12.h for details of all LZMA2 options.
|
||||
//
|
||||
// The x86 BCJ filter will try to modify the x86 instruction stream so
|
||||
// that LZMA2 can compress it better. The x86 BCJ filter doesn't need
|
||||
// any options so it will be set to NULL below.
|
||||
//
|
||||
// Construct the filter chain. The uncompressed data goes first to
|
||||
// the first filter in the array, in this case the x86 BCJ filter.
|
||||
// The array is always terminated by setting .id = LZMA_VLI_UNKNOWN.
|
||||
//
|
||||
// See lzma/filter.h for more information about the lzma_filter
|
||||
// structure.
|
||||
lzma_filter filters[] = {
|
||||
{ .id = LZMA_FILTER_X86, .options = NULL },
|
||||
{ .id = LZMA_FILTER_LZMA2, .options = &opt_lzma2 },
|
||||
{ .id = LZMA_VLI_UNKNOWN, .options = NULL },
|
||||
};
|
||||
|
||||
// Initialize the encoder using the custom filter chain.
|
||||
lzma_ret ret = lzma_stream_encoder(strm, filters, LZMA_CHECK_CRC64);
|
||||
|
||||
if (ret == LZMA_OK)
|
||||
return true;
|
||||
|
||||
const char *msg;
|
||||
switch (ret) {
|
||||
case LZMA_MEM_ERROR:
|
||||
msg = "Memory allocation failed";
|
||||
break;
|
||||
|
||||
case LZMA_OPTIONS_ERROR:
|
||||
// We are no longer using a plain preset so this error
|
||||
// message has been edited accordingly compared to
|
||||
// 01_compress_easy.c.
|
||||
msg = "Specified filter chain is not supported";
|
||||
break;
|
||||
|
||||
case LZMA_UNSUPPORTED_CHECK:
|
||||
msg = "Specified integrity check is not supported";
|
||||
break;
|
||||
|
||||
default:
|
||||
msg = "Unknown error, possibly a bug";
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Error initializing the encoder: %s (error code %u)\n",
|
||||
msg, ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// This function is identical to the one in 01_compress_easy.c.
|
||||
static bool
|
||||
compress(lzma_stream *strm, FILE *infile, FILE *outfile)
|
||||
{
|
||||
lzma_action action = LZMA_RUN;
|
||||
|
||||
uint8_t inbuf[BUFSIZ];
|
||||
uint8_t outbuf[BUFSIZ];
|
||||
|
||||
strm->next_in = NULL;
|
||||
strm->avail_in = 0;
|
||||
strm->next_out = outbuf;
|
||||
strm->avail_out = sizeof(outbuf);
|
||||
|
||||
while (true) {
|
||||
if (strm->avail_in == 0 && !feof(infile)) {
|
||||
strm->next_in = inbuf;
|
||||
strm->avail_in = fread(inbuf, 1, sizeof(inbuf),
|
||||
infile);
|
||||
|
||||
if (ferror(infile)) {
|
||||
fprintf(stderr, "Read error: %s\n",
|
||||
strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (feof(infile))
|
||||
action = LZMA_FINISH;
|
||||
}
|
||||
|
||||
lzma_ret ret = lzma_code(strm, action);
|
||||
|
||||
if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
|
||||
size_t write_size = sizeof(outbuf) - strm->avail_out;
|
||||
|
||||
if (fwrite(outbuf, 1, write_size, outfile)
|
||||
!= write_size) {
|
||||
fprintf(stderr, "Write error: %s\n",
|
||||
strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
strm->next_out = outbuf;
|
||||
strm->avail_out = sizeof(outbuf);
|
||||
}
|
||||
|
||||
if (ret != LZMA_OK) {
|
||||
if (ret == LZMA_STREAM_END)
|
||||
return true;
|
||||
|
||||
const char *msg;
|
||||
switch (ret) {
|
||||
case LZMA_MEM_ERROR:
|
||||
msg = "Memory allocation failed";
|
||||
break;
|
||||
|
||||
case LZMA_DATA_ERROR:
|
||||
msg = "File size limits exceeded";
|
||||
break;
|
||||
|
||||
default:
|
||||
msg = "Unknown error, possibly a bug";
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Encoder error: %s (error code %u)\n",
|
||||
msg, ret);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern int
|
||||
main(void)
|
||||
{
|
||||
lzma_stream strm = LZMA_STREAM_INIT;
|
||||
|
||||
bool success = init_encoder(&strm);
|
||||
if (success)
|
||||
success = compress(&strm, stdin, stdout);
|
||||
|
||||
lzma_end(&strm);
|
||||
|
||||
if (fclose(stdout)) {
|
||||
fprintf(stderr, "Write error: %s\n", strerror(errno));
|
||||
success = false;
|
||||
}
|
||||
|
||||
return success ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
206
doc/examples/04_compress_easy_mt.c
Normal file
206
doc/examples/04_compress_easy_mt.c
Normal file
@@ -0,0 +1,206 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/// \file 04_compress_easy_mt.c
|
||||
/// \brief Compress in multi-call mode using LZMA2 in multi-threaded mode
|
||||
///
|
||||
/// Usage: ./04_compress_easy_mt < INFILE > OUTFILE
|
||||
///
|
||||
/// Example: ./04_compress_easy_mt < foo > foo.xz
|
||||
//
|
||||
// Author: Lasse Collin
|
||||
//
|
||||
// This file has been put into the public domain.
|
||||
// You can do whatever you want with this file.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <lzma.h>
|
||||
|
||||
|
||||
static bool
|
||||
init_encoder(lzma_stream *strm)
|
||||
{
|
||||
// The threaded encoder takes the options as pointer to
|
||||
// a lzma_mt structure.
|
||||
lzma_mt mt = {
|
||||
// No flags are needed.
|
||||
.flags = 0,
|
||||
|
||||
// Let liblzma determine a sane block size.
|
||||
.block_size = 0,
|
||||
|
||||
// Use no timeout for lzma_code() calls by setting timeout
|
||||
// to zero. That is, sometimes lzma_code() might block for
|
||||
// a long time (from several seconds to even minutes).
|
||||
// If this is not OK, for example due to progress indicator
|
||||
// needing updates, specify a timeout in milliseconds here.
|
||||
// See the documentation of lzma_mt in lzma/container.h for
|
||||
// information how to choose a reasonable timeout.
|
||||
.timeout = 0,
|
||||
|
||||
// Use the default preset (6) for LZMA2.
|
||||
// To use a preset, filters must be set to NULL.
|
||||
.preset = LZMA_PRESET_DEFAULT,
|
||||
.filters = NULL,
|
||||
|
||||
// Use CRC64 for integrity checking. See also
|
||||
// 01_compress_easy.c about choosing the integrity check.
|
||||
.check = LZMA_CHECK_CRC64,
|
||||
};
|
||||
|
||||
// Detect how many threads the CPU supports.
|
||||
mt.threads = lzma_cputhreads();
|
||||
|
||||
// If the number of CPU cores/threads cannot be detected,
|
||||
// use one thread. Note that this isn't the same as the normal
|
||||
// single-threaded mode as this will still split the data into
|
||||
// blocks and use more RAM than the normal single-threaded mode.
|
||||
// You may want to consider using lzma_easy_encoder() or
|
||||
// lzma_stream_encoder() instead of lzma_stream_encoder_mt() if
|
||||
// lzma_cputhreads() returns 0 or 1.
|
||||
if (mt.threads == 0)
|
||||
mt.threads = 1;
|
||||
|
||||
// If the number of CPU cores/threads exceeds threads_max,
|
||||
// limit the number of threads to keep memory usage lower.
|
||||
// The number 8 is arbitrarily chosen and may be too low or
|
||||
// high depending on the compression preset and the computer
|
||||
// being used.
|
||||
//
|
||||
// FIXME: A better way could be to check the amount of RAM
|
||||
// (or available RAM) and use lzma_stream_encoder_mt_memusage()
|
||||
// to determine if the number of threads should be reduced.
|
||||
const uint32_t threads_max = 8;
|
||||
if (mt.threads > threads_max)
|
||||
mt.threads = threads_max;
|
||||
|
||||
// Initialize the threaded encoder.
|
||||
lzma_ret ret = lzma_stream_encoder_mt(strm, &mt);
|
||||
|
||||
if (ret == LZMA_OK)
|
||||
return true;
|
||||
|
||||
const char *msg;
|
||||
switch (ret) {
|
||||
case LZMA_MEM_ERROR:
|
||||
msg = "Memory allocation failed";
|
||||
break;
|
||||
|
||||
case LZMA_OPTIONS_ERROR:
|
||||
// We are no longer using a plain preset so this error
|
||||
// message has been edited accordingly compared to
|
||||
// 01_compress_easy.c.
|
||||
msg = "Specified filter chain is not supported";
|
||||
break;
|
||||
|
||||
case LZMA_UNSUPPORTED_CHECK:
|
||||
msg = "Specified integrity check is not supported";
|
||||
break;
|
||||
|
||||
default:
|
||||
msg = "Unknown error, possibly a bug";
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Error initializing the encoder: %s (error code %u)\n",
|
||||
msg, ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// This function is identical to the one in 01_compress_easy.c.
|
||||
static bool
|
||||
compress(lzma_stream *strm, FILE *infile, FILE *outfile)
|
||||
{
|
||||
lzma_action action = LZMA_RUN;
|
||||
|
||||
uint8_t inbuf[BUFSIZ];
|
||||
uint8_t outbuf[BUFSIZ];
|
||||
|
||||
strm->next_in = NULL;
|
||||
strm->avail_in = 0;
|
||||
strm->next_out = outbuf;
|
||||
strm->avail_out = sizeof(outbuf);
|
||||
|
||||
while (true) {
|
||||
if (strm->avail_in == 0 && !feof(infile)) {
|
||||
strm->next_in = inbuf;
|
||||
strm->avail_in = fread(inbuf, 1, sizeof(inbuf),
|
||||
infile);
|
||||
|
||||
if (ferror(infile)) {
|
||||
fprintf(stderr, "Read error: %s\n",
|
||||
strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (feof(infile))
|
||||
action = LZMA_FINISH;
|
||||
}
|
||||
|
||||
lzma_ret ret = lzma_code(strm, action);
|
||||
|
||||
if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
|
||||
size_t write_size = sizeof(outbuf) - strm->avail_out;
|
||||
|
||||
if (fwrite(outbuf, 1, write_size, outfile)
|
||||
!= write_size) {
|
||||
fprintf(stderr, "Write error: %s\n",
|
||||
strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
strm->next_out = outbuf;
|
||||
strm->avail_out = sizeof(outbuf);
|
||||
}
|
||||
|
||||
if (ret != LZMA_OK) {
|
||||
if (ret == LZMA_STREAM_END)
|
||||
return true;
|
||||
|
||||
const char *msg;
|
||||
switch (ret) {
|
||||
case LZMA_MEM_ERROR:
|
||||
msg = "Memory allocation failed";
|
||||
break;
|
||||
|
||||
case LZMA_DATA_ERROR:
|
||||
msg = "File size limits exceeded";
|
||||
break;
|
||||
|
||||
default:
|
||||
msg = "Unknown error, possibly a bug";
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Encoder error: %s (error code %u)\n",
|
||||
msg, ret);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern int
|
||||
main(void)
|
||||
{
|
||||
lzma_stream strm = LZMA_STREAM_INIT;
|
||||
|
||||
bool success = init_encoder(&strm);
|
||||
if (success)
|
||||
success = compress(&strm, stdin, stdout);
|
||||
|
||||
lzma_end(&strm);
|
||||
|
||||
if (fclose(stdout)) {
|
||||
fprintf(stderr, "Write error: %s\n", strerror(errno));
|
||||
success = false;
|
||||
}
|
||||
|
||||
return success ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
206
doc/examples/11_file_info.c
Normal file
206
doc/examples/11_file_info.c
Normal file
@@ -0,0 +1,206 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/// \file 11_file_info.c
|
||||
/// \brief Get uncmopressed size of .xz file(s)
|
||||
///
|
||||
/// Usage: ./11_file_info INFILE1.xz [INFILEn.xz]...
|
||||
///
|
||||
/// Example: ./11_file_info foo.xz
|
||||
//
|
||||
// Author: Lasse Collin
|
||||
//
|
||||
// This file has been put into the public domain.
|
||||
// You can do whatever you want with this file.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <lzma.h>
|
||||
|
||||
|
||||
static bool
|
||||
print_file_size(lzma_stream *strm, FILE *infile, const char *filename)
|
||||
{
|
||||
// Get the file size. In standard C it can be done by seeking to
|
||||
// the end of the file and then getting the file position.
|
||||
// In POSIX one can use fstat() and then st_size from struct stat.
|
||||
// Also note that fseek() and ftell() use long and thus don't support
|
||||
// large files on 32-bit systems (POSIX versions fseeko() and
|
||||
// ftello() can support large files).
|
||||
if (fseek(infile, 0, SEEK_END)) {
|
||||
fprintf(stderr, "Error seeking the file `%s': %s\n",
|
||||
filename, strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
const long file_size = ftell(infile);
|
||||
|
||||
// The decoder wants to start from the beginning of the .xz file.
|
||||
rewind(infile);
|
||||
|
||||
// Initialize the decoder.
|
||||
lzma_index *i;
|
||||
lzma_ret ret = lzma_file_info_decoder(strm, &i, UINT64_MAX,
|
||||
(uint64_t)file_size);
|
||||
switch (ret) {
|
||||
case LZMA_OK:
|
||||
// Initialization succeeded.
|
||||
break;
|
||||
|
||||
case LZMA_MEM_ERROR:
|
||||
fprintf(stderr, "Out of memory when initializing "
|
||||
"the .xz file info decoder\n");
|
||||
return false;
|
||||
|
||||
case LZMA_PROG_ERROR:
|
||||
default:
|
||||
fprintf(stderr, "Unknown error, possibly a bug\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// This example program reuses the same lzma_stream structure
|
||||
// for multiple files, so we need to reset this when starting
|
||||
// a new file.
|
||||
strm->avail_in = 0;
|
||||
|
||||
// Buffer for input data.
|
||||
uint8_t inbuf[BUFSIZ];
|
||||
|
||||
// Pass data to the decoder and seek when needed.
|
||||
while (true) {
|
||||
if (strm->avail_in == 0) {
|
||||
strm->next_in = inbuf;
|
||||
strm->avail_in = fread(inbuf, 1, sizeof(inbuf),
|
||||
infile);
|
||||
|
||||
if (ferror(infile)) {
|
||||
fprintf(stderr,
|
||||
"Error reading from `%s': %s\n",
|
||||
filename, strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
// We don't need to care about hitting the end of
|
||||
// the file so no need to check for feof().
|
||||
}
|
||||
|
||||
ret = lzma_code(strm, LZMA_RUN);
|
||||
|
||||
switch (ret) {
|
||||
case LZMA_OK:
|
||||
break;
|
||||
|
||||
case LZMA_SEEK_NEEDED:
|
||||
// The cast is safe because liblzma won't ask us to
|
||||
// seek past the known size of the input file which
|
||||
// did fit into a long.
|
||||
//
|
||||
// NOTE: Remember to change these to off_t if you
|
||||
// switch fseeko() or lseek().
|
||||
if (fseek(infile, (long)(strm->seek_pos), SEEK_SET)) {
|
||||
fprintf(stderr, "Error seeking the "
|
||||
"file `%s': %s\n",
|
||||
filename, strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
// The old data in the inbuf is useless now. Set
|
||||
// avail_in to zero so that we will read new input
|
||||
// from the new file position on the next iteration
|
||||
// of this loop.
|
||||
strm->avail_in = 0;
|
||||
break;
|
||||
|
||||
case LZMA_STREAM_END:
|
||||
// File information was successfully decoded.
|
||||
// See <lzma/index.h> for functions that can be
|
||||
// used on it. In this example we just print
|
||||
// the uncompressed size (in bytes) of
|
||||
// the .xz file followed by its file name.
|
||||
printf("%10" PRIu64 " %s\n",
|
||||
lzma_index_uncompressed_size(i),
|
||||
filename);
|
||||
|
||||
// Free the memory of the lzma_index structure.
|
||||
lzma_index_end(i, NULL);
|
||||
|
||||
return true;
|
||||
|
||||
case LZMA_FORMAT_ERROR:
|
||||
// .xz magic bytes weren't found.
|
||||
fprintf(stderr, "The file `%s' is not "
|
||||
"in the .xz format\n", filename);
|
||||
return false;
|
||||
|
||||
case LZMA_OPTIONS_ERROR:
|
||||
fprintf(stderr, "The file `%s' has .xz headers that "
|
||||
"are not supported by this liblzma "
|
||||
"version\n", filename);
|
||||
return false;
|
||||
|
||||
case LZMA_DATA_ERROR:
|
||||
fprintf(stderr, "The file `%s' is corrupt\n",
|
||||
filename);
|
||||
return false;
|
||||
|
||||
case LZMA_MEM_ERROR:
|
||||
fprintf(stderr, "Memory allocation failed when "
|
||||
"decoding the file `%s'\n", filename);
|
||||
return false;
|
||||
|
||||
// LZMA_MEMLIMIT_ERROR shouldn't happen because we used
|
||||
// UINT64_MAX as the limit.
|
||||
//
|
||||
// LZMA_BUF_ERROR shouldn't happen because we always provide
|
||||
// new input when the input buffer is empty. The decoder
|
||||
// knows the input file size and thus won't try to read past
|
||||
// the end of the file.
|
||||
case LZMA_MEMLIMIT_ERROR:
|
||||
case LZMA_BUF_ERROR:
|
||||
case LZMA_PROG_ERROR:
|
||||
default:
|
||||
fprintf(stderr, "Unknown error, possibly a bug\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// This line is never reached.
|
||||
}
|
||||
|
||||
|
||||
extern int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
bool success = true;
|
||||
lzma_stream strm = LZMA_STREAM_INIT;
|
||||
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
FILE *infile = fopen(argv[i], "rb");
|
||||
|
||||
if (infile == NULL) {
|
||||
fprintf(stderr, "Cannot open the file `%s': %s\n",
|
||||
argv[i], strerror(errno));
|
||||
success = false;
|
||||
}
|
||||
|
||||
success &= print_file_size(&strm, infile, argv[i]);
|
||||
|
||||
(void)fclose(infile);
|
||||
}
|
||||
|
||||
lzma_end(&strm);
|
||||
|
||||
// Close stdout to catch possible write errors that can occur
|
||||
// when pending data is flushed from the stdio buffers.
|
||||
if (fclose(stdout)) {
|
||||
fprintf(stderr, "Write error: %s\n", strerror(errno));
|
||||
success = false;
|
||||
}
|
||||
|
||||
return success ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
25
doc/examples/Makefile
Normal file
25
doc/examples/Makefile
Normal file
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# Author: Lasse Collin
|
||||
#
|
||||
# This file has been put into the public domain.
|
||||
# You can do whatever you want with this file.
|
||||
#
|
||||
|
||||
CC = c99
|
||||
CFLAGS = -g
|
||||
LDFLAGS = -llzma
|
||||
|
||||
PROGS = \
|
||||
01_compress_easy \
|
||||
02_decompress \
|
||||
03_compress_custom \
|
||||
04_compress_easy_mt \
|
||||
11_file_info
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
.c:
|
||||
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
-rm -f $(PROGS)
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* xz_pipe_decomp.c
|
||||
* A simple example of pipe-only xz decompressor implementation.
|
||||
* version: 2010-07-12 - by Daniel Mealha Cabrita
|
||||
* version: 2012-06-14 - by Daniel Mealha Cabrita
|
||||
* Not copyrighted -- provided to the public domain.
|
||||
*
|
||||
* Compiling:
|
||||
@@ -101,6 +101,14 @@ int xz_decompress (FILE *in_file, FILE *out_file)
|
||||
} while (strm.avail_out == 0);
|
||||
}
|
||||
|
||||
/* Bug fix (2012-06-14): If no errors were detected, check
|
||||
that the last lzma_code() call returned LZMA_STREAM_END.
|
||||
If not, the file is probably truncated. */
|
||||
if ((ret == RET_OK) && (ret_xz != LZMA_STREAM_END)) {
|
||||
fprintf (stderr, "Input truncated or corrupt\n");
|
||||
ret = RET_ERROR_DECOMPRESSION;
|
||||
}
|
||||
|
||||
lzma_end (&strm);
|
||||
return ret;
|
||||
}
|
||||
28
doc/faq.txt
28
doc/faq.txt
@@ -26,7 +26,7 @@ Q: There are many LZMA related projects. How does XZ Utils relate to them?
|
||||
A: 7-Zip and LZMA SDK are the original projects. LZMA SDK is roughly
|
||||
a subset of the 7-Zip source tree.
|
||||
|
||||
p7zip is 7-Zip's command line tools ported to POSIX-like systems.
|
||||
p7zip is 7-Zip's command-line tools ported to POSIX-like systems.
|
||||
|
||||
LZMA Utils provide a gzip-like lzma tool for POSIX-like systems.
|
||||
LZMA Utils are based on LZMA SDK. XZ Utils are the successor to
|
||||
@@ -42,7 +42,7 @@ Q: Why is liblzma named liblzma if its primary file format is .xz?
|
||||
A: When the designing of the .xz format began, the idea was to replace
|
||||
the .lzma format and use the same .lzma suffix. It would have been
|
||||
quite OK to reuse the suffix when there were very few .lzma files
|
||||
around. However, the old .lzma format become popular before the
|
||||
around. However, the old .lzma format became popular before the
|
||||
new format was finished. The new format was renamed to .xz but the
|
||||
name of liblzma wasn't changed.
|
||||
|
||||
@@ -73,7 +73,7 @@ A: For now, no. Since XZ Utils supports the .lzma format, it's usually
|
||||
|
||||
Technically, there is a way to make the conversion relatively fast
|
||||
(roughly twice the time that normal decompression takes). Writing
|
||||
such a tool would take quite a bit time though, and would probably
|
||||
such a tool would take quite a bit of time though, and would probably
|
||||
be useful to only a few people. If you really want such a conversion
|
||||
tool, contact Lasse Collin and offer some money.
|
||||
|
||||
@@ -84,7 +84,7 @@ Q: I have installed xz, but my tar doesn't recognize .tar.xz files.
|
||||
A: xz -dc foo.tar.xz | tar xf -
|
||||
|
||||
|
||||
Q: Can I recover parts of a broken .xz file (e.g. corrupted CD-R)?
|
||||
Q: Can I recover parts of a broken .xz file (e.g. a corrupted CD-R)?
|
||||
|
||||
A: It may be possible if the file consists of multiple blocks, which
|
||||
typically is not the case if the file was created in single-threaded
|
||||
@@ -94,7 +94,7 @@ A: It may be possible if the file consists of multiple blocks, which
|
||||
Q: Is (some part of) XZ Utils patented?
|
||||
|
||||
A: Lasse Collin is not aware of any patents that could affect XZ Utils.
|
||||
However, due to nature of software patents, it's not possible to
|
||||
However, due to the nature of software patents, it's not possible to
|
||||
guarantee that XZ Utils isn't affected by any third party patent(s).
|
||||
|
||||
|
||||
@@ -105,8 +105,8 @@ A: The .xz format is documented in xz-file-format.txt. It is a container
|
||||
filters.
|
||||
|
||||
Documenting LZMA and LZMA2 is planned, but for now, there is no other
|
||||
documentation that the source code. Before you begin, you should know
|
||||
the basics of LZ77 and range coding algorithms. LZMA is based on LZ77,
|
||||
documentation than the source code. Before you begin, you should know
|
||||
the basics of LZ77 and range-coding algorithms. LZMA is based on LZ77,
|
||||
but LZMA is a lot more complex. Range coding is used to compress
|
||||
the final bitstream like Huffman coding is used in Deflate.
|
||||
|
||||
@@ -148,7 +148,7 @@ A: See the documentation in XZ Embedded. In short, something like
|
||||
|
||||
xz --check=crc32 --powerpc --lzma2=preset=6e,dict=64KiB
|
||||
|
||||
Adjust dictionary size to get a good compromise between
|
||||
Adjust the dictionary size to get a good compromise between
|
||||
compression ratio and decompressor memory usage. Note that
|
||||
in single-call decompression mode of XZ Embedded, a big
|
||||
dictionary doesn't increase memory usage.
|
||||
@@ -184,10 +184,10 @@ A: It is planned and has been taken into account when designing
|
||||
The third method is pigz-style threading (I use that name, because
|
||||
pigz <http://www.zlib.net/pigz/> uses that method). It doesn't
|
||||
affect compression ratio significantly and scales to many cores.
|
||||
The memory usage scales linearly when threads are added. It isn't
|
||||
significant with pigz, because Deflate uses only 32 KiB dictionary,
|
||||
The memory usage scales linearly when threads are added. This isn't
|
||||
significant with pigz, because Deflate uses only a 32 KiB dictionary,
|
||||
but with LZMA2 the memory usage will increase dramatically just like
|
||||
with the independent blocks method. There is also a constant
|
||||
with the independent-blocks method. There is also a constant
|
||||
computational overhead, which may make pigz-method a bit dull on
|
||||
dual-core compared to the parallel match finder method, but with more
|
||||
cores the overhead is not a big deal anymore.
|
||||
@@ -197,7 +197,7 @@ A: It is planned and has been taken into account when designing
|
||||
can cut the memory usage by 50 %.
|
||||
|
||||
It is possible that the single-threaded method will be modified to
|
||||
create files indentical to the pigz-style method. We'll see once
|
||||
create files identical to the pigz-style method. We'll see once
|
||||
pigz-style threading has been implemented in liblzma.
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ Q: How do I build a program that needs liblzmadec (lzmadec.h)?
|
||||
A: liblzmadec is part of LZMA Utils. XZ Utils has liblzma, but no
|
||||
liblzmadec. The code using liblzmadec should be ported to use
|
||||
liblzma instead. If you cannot or don't want to do that, download
|
||||
LZMA Utils from <http://tukaani.org/lzma/>.
|
||||
LZMA Utils from <https://tukaani.org/lzma/>.
|
||||
|
||||
|
||||
Q: The default build of liblzma is too big. How can I make it smaller?
|
||||
@@ -220,5 +220,5 @@ A: Give --enable-small to the configure script. Use also appropriate
|
||||
If the result is still too big, take a look at XZ Embedded. It is
|
||||
a separate project, which provides a limited but significantly
|
||||
smaller XZ decoder implementation than XZ Utils. You can find it
|
||||
at <http://tukaani.org/xz/embedded.html>.
|
||||
at <https://tukaani.org/xz/embedded.html>.
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@ History of LZMA Utils and XZ Utils
|
||||
|
||||
Tukaani distribution
|
||||
|
||||
In 2005, there was a small group working on Tukaani distribution, which
|
||||
was a Slackware fork. One of the project goals was to fit the distro on
|
||||
a single 700 MiB ISO-9660 image. Using LZMA instead of gzip helped a
|
||||
lot. Roughly speaking, one could fit data that took 1000 MiB in gzipped
|
||||
form into 700 MiB with LZMA. Naturally compression ratio varied across
|
||||
packages, but this was what we got on average.
|
||||
In 2005, there was a small group working on the Tukaani distribution,
|
||||
which was a Slackware fork. One of the project's goals was to fit the
|
||||
distro on a single 700 MiB ISO-9660 image. Using LZMA instead of gzip
|
||||
helped a lot. Roughly speaking, one could fit data that took 1000 MiB
|
||||
in gzipped form into 700 MiB with LZMA. Naturally, the compression
|
||||
ratio varied across packages, but this was what we got on average.
|
||||
|
||||
Slackware packages have traditionally had .tgz as the filename suffix,
|
||||
which is an abbreviation of .tar.gz. A logical naming for LZMA
|
||||
@@ -30,13 +30,13 @@ Tukaani distribution
|
||||
First steps of LZMA Utils
|
||||
|
||||
The first version of LZMA Utils (4.22.0) included a shell script called
|
||||
lzmash. It was wrapper that had gzip-like command line interface. It
|
||||
lzmash. It was a wrapper that had a gzip-like command-line interface. It
|
||||
used the LZMA_Alone tool from LZMA SDK to do all the real work. zgrep,
|
||||
zdiff, and related scripts from gzip were adapted work with LZMA and
|
||||
zdiff, and related scripts from gzip were adapted to work with LZMA and
|
||||
were part of the first LZMA Utils release too.
|
||||
|
||||
LZMA Utils 4.22.0 included also lzmadec, which was a small (less than
|
||||
10 KiB) decoder-only command line tool. It was written on top of the
|
||||
10 KiB) decoder-only command-line tool. It was written on top of the
|
||||
decoder-only C code found from the LZMA SDK. lzmadec was convenient in
|
||||
situations where LZMA_Alone (a few hundred KiB) would be too big.
|
||||
|
||||
@@ -48,33 +48,34 @@ Second generation
|
||||
The lzmash script was an ugly and not very secure hack. The last
|
||||
version of LZMA Utils to use lzmash was 4.27.1.
|
||||
|
||||
LZMA Utils 4.32.0beta1 introduced a new lzma command line tool written
|
||||
LZMA Utils 4.32.0beta1 introduced a new lzma command-line tool written
|
||||
by Ville Koskinen. It was written in C++, and used the encoder and
|
||||
decoder from C++ LZMA SDK with little modifications. This tool replaced
|
||||
both the lzmash script and the LZMA_Alone command line tool in LZMA
|
||||
Utils.
|
||||
decoder from C++ LZMA SDK with some little modifications. This tool
|
||||
replaced both the lzmash script and the LZMA_Alone command-line tool
|
||||
in LZMA Utils.
|
||||
|
||||
Introducing this new tool caused some temporary incompatibilities,
|
||||
because LZMA_Alone executable was simply named lzma like the new
|
||||
command line tool, but they had completely different command line
|
||||
because the LZMA_Alone executable was simply named lzma like the new
|
||||
command-line tool, but they had a completely different command-line
|
||||
interface. The file format was still the same.
|
||||
|
||||
Lasse wrote liblzmadec, which was a small decoder-only library based
|
||||
on the C code found from LZMA SDK. liblzmadec had API similar to zlib,
|
||||
although there were some significant differences, which made it
|
||||
on the C code found from LZMA SDK. liblzmadec had an API similar to
|
||||
zlib, although there were some significant differences, which made it
|
||||
non-trivial to use it in some applications designed for zlib and
|
||||
libbzip2.
|
||||
|
||||
The lzmadec command line tool was converted to use liblzmadec.
|
||||
The lzmadec command-line tool was converted to use liblzmadec.
|
||||
|
||||
Alexandre Sauvé helped converting build system to use GNU Autotools.
|
||||
This made is easier to test for certain less portable features needed
|
||||
by the new command line tool.
|
||||
Alexandre Sauvé helped converting the build system to use GNU
|
||||
Autotools. This made it easier to test for certain less portable
|
||||
features needed by the new command-line tool.
|
||||
|
||||
Since the new command line tool never got completely finished (for
|
||||
example, it didn't support LZMA_OPT environment variable), the intent
|
||||
was to not call 4.32.x stable. Similarly, liblzmadec wasn't polished,
|
||||
but appeared to work well enough, so some people started using it too.
|
||||
Since the new command-line tool never got completely finished (for
|
||||
example, it didn't support the LZMA_OPT environment variable), the
|
||||
intent was to not call 4.32.x stable. Similarly, liblzmadec wasn't
|
||||
polished, but appeared to work well enough, so some people started
|
||||
using it too.
|
||||
|
||||
Because the development of the third generation of LZMA Utils was
|
||||
delayed considerably (3-4 years), the 4.32.x branch had to be kept
|
||||
@@ -85,16 +86,16 @@ Second generation
|
||||
|
||||
File format problems
|
||||
|
||||
The file format used by LZMA_Alone was primitive. It was designed for
|
||||
embedded systems in mind, and thus provided only minimal set of
|
||||
features. The two biggest problems for non-embedded use were lack of
|
||||
magic bytes and integrity check.
|
||||
The file format used by LZMA_Alone was primitive. It was designed with
|
||||
embedded systems in mind, and thus provided only a minimal set of
|
||||
features. The two biggest problems for non-embedded use were the lack
|
||||
of magic bytes and an integrity check.
|
||||
|
||||
Igor and Lasse started developing a new file format with some help
|
||||
from Ville Koskinen. Also Mark Adler, Mikko Pouru, H. Peter Anvin,
|
||||
and Lars Wirzenius helped with some minor things at some point of the
|
||||
development. Designing the new format took quite a long time (actually,
|
||||
too long time would be more appropriate expression). It was mostly
|
||||
too long a time would be a more appropriate expression). It was mostly
|
||||
because Lasse was quite slow at getting things done due to personal
|
||||
reasons.
|
||||
|
||||
@@ -102,7 +103,7 @@ File format problems
|
||||
that was already used by the old file format. Switching to the new
|
||||
format wouldn't have caused much trouble when the old format wasn't
|
||||
used by many people. But since the development of the new format took
|
||||
so long time, the old format got quite popular, and it was decided
|
||||
such a long time, the old format got quite popular, and it was decided
|
||||
that the new file format must use a different suffix.
|
||||
|
||||
It was decided to use .xz as the suffix of the new file format. The
|
||||
@@ -125,13 +126,13 @@ Transition to XZ Utils
|
||||
The early versions of XZ Utils were called LZMA Utils. The first
|
||||
releases were 4.42.0alphas. They dropped the rest of the C++ LZMA SDK.
|
||||
The code was still directly based on LZMA SDK but ported to C and
|
||||
converted from callback API to stateful API. Later, Igor Pavlov made
|
||||
C version of the LZMA encoder too; these ports from C++ to C were
|
||||
independent in LZMA SDK and LZMA Utils.
|
||||
converted from a callback API to a stateful API. Later, Igor Pavlov
|
||||
made a C version of the LZMA encoder too; these ports from C++ to C
|
||||
were independent in LZMA SDK and LZMA Utils.
|
||||
|
||||
The core of the new LZMA Utils was liblzma, a compression library with
|
||||
zlib-like API. liblzma supported both the old and new file format. The
|
||||
gzip-like lzma command line tool was rewritten to use liblzma.
|
||||
a zlib-like API. liblzma supported both the old and new file format.
|
||||
The gzip-like lzma command-line tool was rewritten to use liblzma.
|
||||
|
||||
The new LZMA Utils code base was renamed to XZ Utils when the name
|
||||
of the new file format had been decided. The liblzma compression
|
||||
@@ -139,7 +140,7 @@ Transition to XZ Utils
|
||||
caused unnecessary breakage in applications already using the early
|
||||
liblzma snapshots.
|
||||
|
||||
The xz command line tool can emulate the gzip-like lzma tool by
|
||||
The xz command-line tool can emulate the gzip-like lzma tool by
|
||||
creating appropriate symlinks (e.g. lzma -> xz). Thus, practically
|
||||
all scripts using the lzma tool from LZMA Utils will work as is with
|
||||
XZ Utils (and will keep using the old .lzma format). Still, the .lzma
|
||||
|
||||
@@ -16,7 +16,7 @@ CC = gcc
|
||||
STRIP = strip
|
||||
CPPFLAGS =
|
||||
CFLAGS = -g -Wall -Wextra -Wfatal-errors -march=i386 -mtune=i686 -O2
|
||||
LDFLAGS =
|
||||
LDFLAGS = -lemu
|
||||
|
||||
# NOTE: -fgnu89-inline is needed on DJGPP 2.04 beta and GCC >= 4.3.0
|
||||
# because time.h uses GNU-style "extern inline".
|
||||
@@ -64,6 +64,7 @@ SRCS_C = \
|
||||
../src/liblzma/common/block_header_encoder.c \
|
||||
../src/liblzma/common/block_util.c \
|
||||
../src/liblzma/common/common.c \
|
||||
../src/liblzma/common/file_info.c \
|
||||
../src/liblzma/common/filter_common.c \
|
||||
../src/liblzma/common/filter_decoder.c \
|
||||
../src/liblzma/common/filter_encoder.c \
|
||||
@@ -113,6 +114,7 @@ SRCS_C = \
|
||||
../src/xz/list.c \
|
||||
../src/xz/main.c \
|
||||
../src/xz/message.c \
|
||||
../src/xz/mytime.c \
|
||||
../src/xz/options.c \
|
||||
../src/xz/signals.c \
|
||||
../src/xz/suffix.c \
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
/* Define to 1 if sha256 integrity check is enabled. */
|
||||
#define HAVE_CHECK_SHA256 1
|
||||
|
||||
/* Define to 1 if any of HAVE_DECODER_foo have been defined. */
|
||||
#define HAVE_DECODERS 1
|
||||
|
||||
/* Define to 1 if arm decoder is enabled. */
|
||||
#define HAVE_DECODER_ARM 1
|
||||
|
||||
@@ -37,6 +40,9 @@
|
||||
/* Define to 1 if x86 decoder is enabled. */
|
||||
#define HAVE_DECODER_X86 1
|
||||
|
||||
/* Define to 1 if any of HAVE_ENCODER_foo have been defined. */
|
||||
#define HAVE_ENCODERS 1
|
||||
|
||||
/* Define to 1 if arm encoder is enabled. */
|
||||
#define HAVE_ENCODER_ARM 1
|
||||
|
||||
@@ -120,7 +126,7 @@
|
||||
#define PACKAGE_NAME "XZ Utils"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL "http://tukaani.org/xz/"
|
||||
#define PACKAGE_URL "https://tukaani.org/xz/"
|
||||
|
||||
/* The size of `size_t', as computed by sizeof. */
|
||||
#define SIZEOF_SIZE_T 4
|
||||
|
||||
@@ -37,6 +37,10 @@
|
||||
/* 5 8 Uncompressed size (little endian). -1 means unknown size */
|
||||
/* 13 Compressed data */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define BUFSIZE 4096
|
||||
|
||||
int find_lzma_header(unsigned char *buf) {
|
||||
@@ -48,7 +52,7 @@ int find_lzma_header(unsigned char *buf) {
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
char buf[BUFSIZE];
|
||||
unsigned char buf[BUFSIZE];
|
||||
int ret, i, numlzma, blocks=0;
|
||||
|
||||
if (argc != 2) {
|
||||
|
||||
3
m4/.gitignore
vendored
3
m4/.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
codeset.m4
|
||||
fcntl-o.m4
|
||||
gettext.m4
|
||||
glibc2.m4
|
||||
glibc21.m4
|
||||
@@ -6,6 +7,7 @@ iconv.m4
|
||||
intdiv0.m4
|
||||
intl.m4
|
||||
intldir.m4
|
||||
intlmacosx.m4
|
||||
intmax.m4
|
||||
inttypes-pri.m4
|
||||
inttypes_h.m4
|
||||
@@ -27,6 +29,7 @@ printf-posix.m4
|
||||
progtest.m4
|
||||
size_max.m4
|
||||
stdint_h.m4
|
||||
threadlib.m4
|
||||
uintmax_t.m4
|
||||
ulonglong.m4
|
||||
visibility.m4
|
||||
|
||||
85
m4/ax_check_capsicum.m4
Normal file
85
m4/ax_check_capsicum.m4
Normal file
@@ -0,0 +1,85 @@
|
||||
# -*- Autoconf -*-
|
||||
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_CAPSICUM([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro searches for an installed Capsicum header and library,
|
||||
# and if found:
|
||||
# - AC_DEFINE([HAVE_CAPSICUM]) is called.
|
||||
# - AC_DEFINE([HAVE_SYS_CAPSICUM_H]) is called if <sys/capsicum.h>
|
||||
# is present (otherwise <sys/capability.h> must be used).
|
||||
# - CAPSICUM_LIB is set to the -l option needed to link Capsicum support,
|
||||
# and AC_SUBST([CAPSICUM_LIB]) is called.
|
||||
# - The shell commands in ACTION-IF-FOUND are run. The default
|
||||
# ACTION-IF-FOUND prepends ${CAPSICUM_LIB} into LIBS. If you don't
|
||||
# want to modify LIBS and don't need to run any other commands either,
|
||||
# use a colon as ACTION-IF-FOUND.
|
||||
#
|
||||
# If Capsicum support isn't found:
|
||||
# - The shell commands in ACTION-IF-NOT-FOUND are run. The default
|
||||
# ACTION-IF-NOT-FOUND calls AC_MSG_WARN to print a warning that
|
||||
# Capsicum support wasn't found.
|
||||
#
|
||||
# You should use autoheader to include a definition for the symbols above
|
||||
# in a config.h file.
|
||||
#
|
||||
# Sample usage in a C/C++ source is as follows:
|
||||
#
|
||||
# #ifdef HAVE_CAPSICUM
|
||||
# # ifdef HAVE_SYS_CAPSICUM_H
|
||||
# # include <sys/capsicum.h>
|
||||
# # else
|
||||
# # include <sys/capability.h>
|
||||
# # endif
|
||||
# #endif /* HAVE_CAPSICUM */
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2014 Google Inc.
|
||||
# Copyright (c) 2015 Lasse Collin <lasse.collin@tukaani.org>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification,
|
||||
# are permitted in any medium without royalty provided the copyright
|
||||
# notice and this notice are preserved. This file is offered as-is,
|
||||
# without any warranty.
|
||||
|
||||
#serial 2
|
||||
|
||||
AC_DEFUN([AX_CHECK_CAPSICUM], [
|
||||
# On FreeBSD >= 11.x and Linux, Capsicum is uses <sys/capsicum.h>.
|
||||
# If this header is found, it is assumed to be the right one.
|
||||
capsicum_header_found=no
|
||||
AC_CHECK_HEADERS([sys/capsicum.h], [capsicum_header_found=yes])
|
||||
if test "$capsicum_header_found" = no ; then
|
||||
# On FreeBSD 10.x Capsicum uses <sys/capability.h>. Such a header exists
|
||||
# on Linux too but it describes POSIX.1e capabilities. Look for the
|
||||
# declaration of cap_rights_limit to check if <sys/capability.h> is
|
||||
# a Capsicum header.
|
||||
AC_CHECK_DECL([cap_rights_limit], [capsicum_header_found=yes], [],
|
||||
[#include <sys/capability.h>])
|
||||
fi
|
||||
|
||||
capsicum_lib_found=no
|
||||
CAPSICUM_LIB=
|
||||
if test "$capsicum_header_found" = yes ; then
|
||||
AC_LANG_PUSH([C])
|
||||
# FreeBSD >= 10.x has Capsicum functions in libc.
|
||||
AC_LINK_IFELSE([AC_LANG_CALL([], [cap_rights_limit])],
|
||||
[capsicum_lib_found=yes], [])
|
||||
# Linux has Capsicum functions in libcaprights.
|
||||
AC_CHECK_LIB([caprights], [cap_rights_limit],
|
||||
[CAPSICUM_LIB=-lcaprights
|
||||
capsicum_lib_found=yes], [])
|
||||
AC_LANG_POP([C])
|
||||
fi
|
||||
AC_SUBST([CAPSICUM_LIB])
|
||||
|
||||
if test "$capsicum_lib_found" = yes ; then
|
||||
AC_DEFINE([HAVE_CAPSICUM], [1], [Define to 1 if Capsicum is available.])
|
||||
m4_default([$1], [LIBS="${CAPSICUM_LIB} $LIBS"])
|
||||
else
|
||||
m4_default([$2], [AC_MSG_WARN([Capsicum support not found])])
|
||||
fi])
|
||||
155
m4/ax_pthread.m4
155
m4/ax_pthread.m4
@@ -33,6 +33,10 @@
|
||||
# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
|
||||
# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
|
||||
#
|
||||
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
|
||||
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
|
||||
# PTHREAD_CFLAGS.
|
||||
#
|
||||
# ACTION-IF-FOUND is a list of shell commands to run if a threads library
|
||||
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
|
||||
# is not found. If ACTION-IF-FOUND is not specified, the default action
|
||||
@@ -45,9 +49,12 @@
|
||||
# Alejandro Forero Cuervo to the autoconf macro repository. We are also
|
||||
# grateful for the helpful feedback of numerous users.
|
||||
#
|
||||
# Updated for Autoconf 2.68 by Daniel Richard G.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
|
||||
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
@@ -75,13 +82,12 @@
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 11
|
||||
#serial 21
|
||||
|
||||
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
|
||||
AC_DEFUN([AX_PTHREAD], [
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
AC_LANG_PUSH([C])
|
||||
ax_pthread_ok=no
|
||||
|
||||
# We used to check for pthread.h first, but this fails if pthread.h
|
||||
@@ -97,8 +103,8 @@ if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
|
||||
AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes)
|
||||
AC_MSG_RESULT($ax_pthread_ok)
|
||||
AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes])
|
||||
AC_MSG_RESULT([$ax_pthread_ok])
|
||||
if test x"$ax_pthread_ok" = xno; then
|
||||
PTHREAD_LIBS=""
|
||||
PTHREAD_CFLAGS=""
|
||||
@@ -139,8 +145,8 @@ ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mt
|
||||
# --thread-safe: KAI C++
|
||||
# pthread-config: use pthread-config program (for GNU Pth library)
|
||||
|
||||
case "${host_cpu}-${host_os}" in
|
||||
*solaris*)
|
||||
case ${host_os} in
|
||||
solaris*)
|
||||
|
||||
# On Solaris (at least, for some versions), libc contains stubbed
|
||||
# (non-functional) versions of the pthreads routines, so link-based
|
||||
@@ -153,11 +159,25 @@ case "${host_cpu}-${host_os}" in
|
||||
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
|
||||
;;
|
||||
|
||||
*-darwin*)
|
||||
ax_pthread_flags="-pthread $ax_pthread_flags"
|
||||
;;
|
||||
darwin*)
|
||||
ax_pthread_flags="-pthread $ax_pthread_flags"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Clang doesn't consider unrecognized options an error unless we specify
|
||||
# -Werror. We throw in some extra Clang-specific options to ensure that
|
||||
# this doesn't happen for GCC, which also accepts -Werror.
|
||||
|
||||
AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags])
|
||||
save_CFLAGS="$CFLAGS"
|
||||
ax_pthread_extra_flags="-Werror"
|
||||
CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[ax_pthread_extra_flags=
|
||||
AC_MSG_RESULT([no])])
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
if test x"$ax_pthread_ok" = xno; then
|
||||
for flag in $ax_pthread_flags; do
|
||||
|
||||
@@ -171,12 +191,12 @@ for flag in $ax_pthread_flags; do
|
||||
PTHREAD_CFLAGS="$flag"
|
||||
;;
|
||||
|
||||
pthread-config)
|
||||
AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no)
|
||||
if test x"$ax_pthread_config" = xno; then continue; fi
|
||||
PTHREAD_CFLAGS="`pthread-config --cflags`"
|
||||
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
|
||||
;;
|
||||
pthread-config)
|
||||
AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
|
||||
if test x"$ax_pthread_config" = xno; then continue; fi
|
||||
PTHREAD_CFLAGS="`pthread-config --cflags`"
|
||||
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_CHECKING([for the pthreads library -l$flag])
|
||||
@@ -187,7 +207,7 @@ for flag in $ax_pthread_flags; do
|
||||
save_LIBS="$LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags"
|
||||
|
||||
# Check for various functions. We must include pthread.h,
|
||||
# since some functions may be macros. (On the Sequent, we
|
||||
@@ -198,21 +218,22 @@ for flag in $ax_pthread_flags; do
|
||||
# pthread_cleanup_push because it is one of the few pthread
|
||||
# functions on Solaris that doesn't have a non-functional libc stub.
|
||||
# We try pthread_create on general principles.
|
||||
AC_TRY_LINK([#include <pthread.h>
|
||||
static void routine(void* a) {a=0;}
|
||||
static void* start_routine(void* a) {return a;}],
|
||||
[pthread_t th; pthread_attr_t attr;
|
||||
pthread_create(&th,0,start_routine,0);
|
||||
pthread_join(th, 0);
|
||||
pthread_attr_init(&attr);
|
||||
pthread_cleanup_push(routine, 0);
|
||||
pthread_cleanup_pop(0); ],
|
||||
[ax_pthread_ok=yes])
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
|
||||
static void routine(void *a) { a = 0; }
|
||||
static void *start_routine(void *a) { return a; }],
|
||||
[pthread_t th; pthread_attr_t attr;
|
||||
pthread_create(&th, 0, start_routine, 0);
|
||||
pthread_join(th, 0);
|
||||
pthread_attr_init(&attr);
|
||||
pthread_cleanup_push(routine, 0);
|
||||
pthread_cleanup_pop(0) /* ; */])],
|
||||
[ax_pthread_ok=yes],
|
||||
[])
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
AC_MSG_RESULT($ax_pthread_ok)
|
||||
AC_MSG_RESULT([$ax_pthread_ok])
|
||||
if test "x$ax_pthread_ok" = xyes; then
|
||||
break;
|
||||
fi
|
||||
@@ -230,54 +251,82 @@ if test "x$ax_pthread_ok" = xyes; then
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
|
||||
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
|
||||
AC_MSG_CHECKING([for joinable pthread attribute])
|
||||
attr_name=unknown
|
||||
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
|
||||
AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
|
||||
[attr_name=$attr; break])
|
||||
done
|
||||
AC_MSG_RESULT($attr_name)
|
||||
AC_MSG_CHECKING([for joinable pthread attribute])
|
||||
attr_name=unknown
|
||||
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
|
||||
[int attr = $attr; return attr /* ; */])],
|
||||
[attr_name=$attr; break],
|
||||
[])
|
||||
done
|
||||
AC_MSG_RESULT([$attr_name])
|
||||
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
|
||||
AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
|
||||
AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name],
|
||||
[Define to necessary symbol if this constant
|
||||
uses a non-standard name on your system.])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if more special flags are required for pthreads])
|
||||
flag=no
|
||||
case "${host_cpu}-${host_os}" in
|
||||
*-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
|
||||
*solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
|
||||
case ${host_os} in
|
||||
aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
|
||||
osf* | hpux*) flag="-D_REENTRANT";;
|
||||
solaris*)
|
||||
if test "$GCC" = "yes"; then
|
||||
flag="-D_REENTRANT"
|
||||
else
|
||||
# TODO: What about Clang on Solaris?
|
||||
flag="-mt -D_REENTRANT"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
AC_MSG_RESULT(${flag})
|
||||
AC_MSG_RESULT([$flag])
|
||||
if test "x$flag" != xno; then
|
||||
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
|
||||
[ax_cv_PTHREAD_PRIO_INHERIT], [
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
|
||||
[[int i = PTHREAD_PRIO_INHERIT;]])],
|
||||
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
|
||||
[ax_cv_PTHREAD_PRIO_INHERIT=no])
|
||||
])
|
||||
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
|
||||
[AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])])
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
# More AIX lossage: must compile with xlc_r or cc_r
|
||||
if test x"$GCC" != xyes; then
|
||||
AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
|
||||
else
|
||||
PTHREAD_CC=$CC
|
||||
fi
|
||||
else
|
||||
PTHREAD_CC="$CC"
|
||||
# More AIX lossage: compile with *_r variant
|
||||
if test "x$GCC" != xyes; then
|
||||
case $host_os in
|
||||
aix*)
|
||||
AS_CASE(["x/$CC"],
|
||||
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
|
||||
[#handle absolute path differently from PATH based program lookup
|
||||
AS_CASE(["x$CC"],
|
||||
[x/*],
|
||||
[AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
|
||||
[AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(PTHREAD_LIBS)
|
||||
AC_SUBST(PTHREAD_CFLAGS)
|
||||
AC_SUBST(PTHREAD_CC)
|
||||
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
|
||||
|
||||
AC_SUBST([PTHREAD_LIBS])
|
||||
AC_SUBST([PTHREAD_CFLAGS])
|
||||
AC_SUBST([PTHREAD_CC])
|
||||
|
||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
||||
if test x"$ax_pthread_ok" = xyes; then
|
||||
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
|
||||
ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
|
||||
:
|
||||
else
|
||||
ax_pthread_ok=no
|
||||
$2
|
||||
fi
|
||||
AC_LANG_RESTORE
|
||||
AC_LANG_POP
|
||||
])dnl AX_PTHREAD
|
||||
|
||||
@@ -9,8 +9,12 @@
|
||||
# This information is used by tuklib_cpucores.c.
|
||||
#
|
||||
# Supported methods:
|
||||
# - GetSystemInfo(): Windows (including Cygwin)
|
||||
# - sched_getaffinity(): glibc (GNU/Linux, GNU/kFreeBSD)
|
||||
# - cpuset_getaffinity(): FreeBSD
|
||||
# - sysctl(): BSDs, OS/2
|
||||
# - sysconf(): GNU/Linux, Solaris, Tru64, IRIX, AIX, Cygwin
|
||||
# - sysconf(): GNU/Linux, Solaris, Tru64, IRIX, AIX, QNX, Cygwin (but
|
||||
# GetSystemInfo() is used on Cygwin)
|
||||
# - pstat_getdynamic(): HP-UX
|
||||
#
|
||||
# COPYING
|
||||
@@ -30,10 +34,67 @@ AC_CHECK_HEADERS([sys/param.h])
|
||||
AC_CACHE_CHECK([how to detect the number of available CPU cores],
|
||||
[tuklib_cv_cpucores_method], [
|
||||
|
||||
# Look for sysctl() solution first, because on OS/2, both sysconf()
|
||||
# and sysctl() pass the tests in this file, but only sysctl()
|
||||
# actually works.
|
||||
# Maybe checking $host_os would be enough but this matches what
|
||||
# tuklib_cpucores.c does.
|
||||
#
|
||||
# NOTE: IRIX has a compiler that doesn't error out with #error, so use
|
||||
# a non-compilable text instead of #error to generate an error.
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
int main(void) { return 0; }
|
||||
#else
|
||||
compile error
|
||||
#endif
|
||||
]])], [tuklib_cv_cpucores_method=special], [
|
||||
|
||||
# glibc-based systems (GNU/Linux and GNU/kFreeBSD) have sched_getaffinity().
|
||||
# The CPU_COUNT() macro was added in glibc 2.9 so we try to link the
|
||||
# test program instead of merely compiling it. glibc 2.9 is old enough that
|
||||
# if someone uses the code on older glibc, the fallback to sysconf() should
|
||||
# be good enough.
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <sched.h>
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
cpu_set_t cpu_mask;
|
||||
sched_getaffinity(0, sizeof(cpu_mask), &cpu_mask);
|
||||
return CPU_COUNT(&cpu_mask);
|
||||
}
|
||||
]])], [tuklib_cv_cpucores_method=sched_getaffinity], [
|
||||
|
||||
# FreeBSD has both cpuset and sysctl. Look for cpuset first because
|
||||
# it's a better approach.
|
||||
#
|
||||
# This test would match on GNU/kFreeBSD too but it would require
|
||||
# -lfreebsd-glue when linking and thus in the current form this would
|
||||
# fail on GNU/kFreeBSD. The above test for sched_getaffinity() matches
|
||||
# on GNU/kFreeBSD so the test below should never run on that OS.
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <sys/param.h>
|
||||
#include <sys/cpuset.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
cpuset_t set;
|
||||
cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1,
|
||||
sizeof(set), &set);
|
||||
return 0;
|
||||
}
|
||||
]])], [tuklib_cv_cpucores_method=cpuset], [
|
||||
|
||||
# On OS/2, both sysconf() and sysctl() pass the tests in this file,
|
||||
# but only sysctl() works. On QNX it's the opposite: only sysconf() works
|
||||
# (although it assumes that _POSIX_SOURCE, _XOPEN_SOURCE, and _POSIX_C_SOURCE
|
||||
# are undefined or alternatively _QNX_SOURCE is defined).
|
||||
#
|
||||
# We test sysctl() first and intentionally break the sysctl() test on QNX
|
||||
# so that sysctl() is never used on QNX.
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||
#ifdef __QNX__
|
||||
compile error
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
@@ -82,9 +143,19 @@ main(void)
|
||||
]])], [tuklib_cv_cpucores_method=pstat_getdynamic], [
|
||||
|
||||
tuklib_cv_cpucores_method=unknown
|
||||
])])])])
|
||||
])])])])])])])
|
||||
|
||||
case $tuklib_cv_cpucores_method in
|
||||
sched_getaffinity)
|
||||
AC_DEFINE([TUKLIB_CPUCORES_SCHED_GETAFFINITY], [1],
|
||||
[Define to 1 if the number of available CPU cores
|
||||
can be detected with sched_getaffinity()])
|
||||
;;
|
||||
cpuset)
|
||||
AC_DEFINE([TUKLIB_CPUCORES_CPUSET], [1],
|
||||
[Define to 1 if the number of available CPU cores
|
||||
can be detected with cpuset(2).])
|
||||
;;
|
||||
sysctl)
|
||||
AC_DEFINE([TUKLIB_CPUCORES_SYSCTL], [1],
|
||||
[Define to 1 if the number of available CPU cores
|
||||
|
||||
@@ -46,7 +46,7 @@ main(void)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if unaligned memory access should be used])
|
||||
AC_ARG_ENABLE([unaligned-access], AC_HELP_STRING([--enable-unaligned-access],
|
||||
AC_ARG_ENABLE([unaligned-access], AS_HELP_STRING([--enable-unaligned-access],
|
||||
[Enable if the system supports *fast* unaligned memory access
|
||||
with 16-bit and 32-bit integers. By default, this is enabled
|
||||
only on x86, x86_64, and big endian PowerPC.]),
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#
|
||||
# Supported methods:
|
||||
#
|
||||
# - Windows (including Cygwin), OS/2, DJGPP (DOS), and OpenVMS have
|
||||
# operating-system specific functions.
|
||||
# - Windows (including Cygwin), OS/2, DJGPP (DOS), OpenVMS, AROS,
|
||||
# and QNX have operating-system specific functions.
|
||||
#
|
||||
# - AIX has _system_configuration.physmem.
|
||||
#
|
||||
@@ -53,7 +53,8 @@ AC_CACHE_CHECK([how to detect the amount of physical memory],
|
||||
# a non-compilable text instead of #error to generate an error.
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__OS2__) \
|
||||
|| defined(__DJGPP__) || defined(__VMS)
|
||||
|| defined(__DJGPP__) || defined(__VMS) \
|
||||
|| defined(AMIGA) || defined(__AROS__) || defined(__QNX__)
|
||||
int main(void) { return 0; }
|
||||
#else
|
||||
compile error
|
||||
|
||||
@@ -13,14 +13,26 @@ mkdir -p Resources
|
||||
# Abort immediately if something goes wrong.
|
||||
set -e
|
||||
|
||||
GCC="gcc-4.2"
|
||||
SDK="/Developer/SDKs/MacOSX10.5.sdk"
|
||||
MDT="10.5"
|
||||
GTT=i686-apple-darwin9
|
||||
|
||||
ARCHES1="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
|
||||
ARCHES2="-arch ppc -arch i386"
|
||||
PKGFORMAT="10.5" # xar
|
||||
|
||||
# avoid "unknown required load command: 0x80000022" from linking on Snow Leopard
|
||||
uname -r | grep ^1 >/dev/null && LDFLAGS="$LDFLAGS -Wl,-no_compact_linkedit"
|
||||
|
||||
# Clean up if it was already configured.
|
||||
[ -f Makefile ] && make distclean
|
||||
|
||||
# Build the regular fat program
|
||||
|
||||
CC="gcc-4.0" \
|
||||
CFLAGS="-O2 -g -arch ppc -arch ppc64 -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" \
|
||||
../configure --disable-dependency-tracking --disable-xzdec --disable-lzmadec i686-apple-darwin8
|
||||
CC="$GCC" \
|
||||
CFLAGS="-O2 -g $ARCHES1 -isysroot $SDK -mmacosx-version-min=$MDT" \
|
||||
../configure --disable-dependency-tracking --disable-xzdec --disable-lzmadec $GTT
|
||||
|
||||
make
|
||||
|
||||
@@ -32,9 +44,9 @@ make distclean
|
||||
|
||||
# Build the size-optimized program
|
||||
|
||||
CC="gcc-4.0" \
|
||||
CFLAGS="-Os -g -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" \
|
||||
../configure --disable-dependency-tracking --disable-shared --disable-nls --disable-encoders --enable-small --disable-threads i686-apple-darwin8
|
||||
CC="$GCC" \
|
||||
CFLAGS="-Os -g $ARCHES2 -isysroot $SDK -mmacosx-version-min=$MDT" \
|
||||
../configure --disable-dependency-tracking --disable-shared --disable-nls --disable-encoders --enable-small --disable-threads $GTT
|
||||
|
||||
make -C src/liblzma
|
||||
make -C src/xzdec
|
||||
@@ -44,6 +56,19 @@ cp -a ../extra Root/usr/local/share/doc/xz
|
||||
|
||||
make distclean
|
||||
|
||||
# Move development files to different package
|
||||
|
||||
test -d liblzma && rm -r liblzma
|
||||
mkdir -p liblzma/usr/local
|
||||
|
||||
mv Root/usr/local/include liblzma/usr/local
|
||||
mv Root/usr/local/lib liblzma/usr/local
|
||||
|
||||
mkdir -p Root/usr/local/lib
|
||||
cp -p liblzma/usr/local/lib/liblzma.5.dylib Root/usr/local/lib
|
||||
mkdir -p liblzma/usr/local/share/doc/xz
|
||||
mv Root/usr/local/share/doc/xz/examples* liblzma/usr/local/share/doc/xz
|
||||
|
||||
# Strip debugging symbols and make relocatable
|
||||
|
||||
for bin in xz lzmainfo xzdec lzmadec; do
|
||||
@@ -56,19 +81,12 @@ for lib in liblzma.5.dylib; do
|
||||
install_name_tool -id @executable_path/../lib/liblzma.5.dylib Root/usr/local/lib/$lib
|
||||
done
|
||||
|
||||
strip -S Root/usr/local/lib/liblzma.a
|
||||
rm -f Root/usr/local/lib/liblzma.la
|
||||
|
||||
# Include pkg-config while making relocatable
|
||||
|
||||
sed -e 's|prefix=/usr/local|prefix=${pcfiledir}/../..|' < Root/usr/local/lib/pkgconfig/liblzma.pc > Root/liblzma.pc
|
||||
mv Root/liblzma.pc Root/usr/local/lib/pkgconfig/liblzma.pc
|
||||
|
||||
# Create tarball, but without the HFS+ attrib
|
||||
|
||||
rmdir debug lib po src/liblzma/api src/liblzma src/lzmainfo src/scripts src/xz src/xzdec src tests
|
||||
|
||||
( cd Root/usr/local; COPY_EXTENDED_ATTRIBUTES_DISABLE=true COPYFILE_DISABLE=true tar cvjf ../../../XZ.tbz * )
|
||||
( cd liblzma; COPY_EXTENDED_ATTRIBUTES_DISABLE=true COPYFILE_DISABLE=true tar cvjf ../liblzma.tbz ./usr/local )
|
||||
|
||||
# Include documentation files for package
|
||||
|
||||
@@ -80,12 +98,15 @@ cp -p ../COPYING Resources/License.txt
|
||||
ID="org.tukaani.xz"
|
||||
VERSION=`cd ..; sh build-aux/version.sh`
|
||||
PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
|
||||
$PACKAGEMAKER -r Root/usr/local -l /usr/local -e Resources -i $ID -n $VERSION -t XZ -o XZ.pkg -g 10.4 --verbose
|
||||
$PACKAGEMAKER -r Root/usr/local -l /usr/local -e Resources -i $ID -n $VERSION -t XZ -o XZ.pkg -g $PKGFORMAT --verbose
|
||||
$PACKAGEMAKER -r liblzma -w -k -i $ID.liblzma -n $VERSION -o liblzma.pkg -g $PKGFORMAT --verbose
|
||||
|
||||
# Put the package in a disk image
|
||||
|
||||
if [ "$PKGFORMAT" != "10.5" ]; then
|
||||
hdiutil create -fs HFS+ -format UDZO -quiet -srcfolder XZ.pkg -ov XZ.dmg
|
||||
hdiutil internet-enable -yes -quiet XZ.dmg
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Build completed successfully."
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
cs
|
||||
de
|
||||
fr
|
||||
it
|
||||
pl
|
||||
vi
|
||||
|
||||
978
po/fr.po
Normal file
978
po/fr.po
Normal file
@@ -0,0 +1,978 @@
|
||||
# XZ Utils French Translation
|
||||
# This file is put in the public domain.
|
||||
# Adrien Nader <adrien@notk.org>, 2011-2014.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: xz-utils\n"
|
||||
"Report-Msgid-Bugs-To: lasse.collin@tukaani.org\n"
|
||||
"POT-Creation-Date: 2014-11-25 20:23+0100\n"
|
||||
"PO-Revision-Date: 2010-09-24 21;12+0200\n"
|
||||
"Last-Translator: Adrien Nader <adrien@notk.org>\n"
|
||||
"Language-Team: None\n"
|
||||
"Language: fr\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n==1) ? 0 : 1;\n"
|
||||
|
||||
#: src/xz/args.c:63
|
||||
#, c-format
|
||||
msgid "%s: Invalid argument to --block-list"
|
||||
msgstr ""
|
||||
|
||||
#: src/xz/args.c:73
|
||||
#, c-format
|
||||
msgid "%s: Too many arguments to --block-list"
|
||||
msgstr ""
|
||||
|
||||
#: src/xz/args.c:102
|
||||
msgid "0 can only be used as the last element in --block-list"
|
||||
msgstr ""
|
||||
|
||||
#: src/xz/args.c:406
|
||||
#, c-format
|
||||
msgid "%s: Unknown file format type"
|
||||
msgstr "%s : Format de fichier inconnu"
|
||||
|
||||
#: src/xz/args.c:429 src/xz/args.c:437
|
||||
#, c-format
|
||||
msgid "%s: Unsupported integrity check type"
|
||||
msgstr "%s : Type de vérification d'intégrité inconnu"
|
||||
|
||||
#: src/xz/args.c:473
|
||||
msgid "Only one file can be specified with `--files' or `--files0'."
|
||||
msgstr "Un seul fichier peut être spécifié avec `--files' ou `--files0'."
|
||||
|
||||
#: src/xz/args.c:541
|
||||
#, c-format
|
||||
msgid "The environment variable %s contains too many arguments"
|
||||
msgstr "La variable d'environnement %s contient trop d'arguments"
|
||||
|
||||
#: src/xz/coder.c:110
|
||||
msgid "Maximum number of filters is four"
|
||||
msgstr "Le nombre maximal de filtres est quatre"
|
||||
|
||||
#: src/xz/coder.c:129
|
||||
msgid "Memory usage limit is too low for the given filter setup."
|
||||
msgstr "La limite d'utilisation mémoire est trop basse pour la configuration de filtres donnée."
|
||||
|
||||
#: src/xz/coder.c:159
|
||||
msgid "Using a preset in raw mode is discouraged."
|
||||
msgstr "Utiliser un préréglage en mode `raw' est déconseillé."
|
||||
|
||||
#: src/xz/coder.c:161
|
||||
msgid "The exact options of the presets may vary between software versions."
|
||||
msgstr "Le détail des préréglages peut varier entre différentes versions du logiciel."
|
||||
|
||||
#: src/xz/coder.c:184
|
||||
msgid "The .lzma format supports only the LZMA1 filter"
|
||||
msgstr "Le format .lzma ne prend en charge que le filtre LZMA1"
|
||||
|
||||
#: src/xz/coder.c:192
|
||||
msgid "LZMA1 cannot be used with the .xz format"
|
||||
msgstr "Le filtre LZMA1 ne peut être utilisé avec le format .xz"
|
||||
|
||||
#: src/xz/coder.c:209
|
||||
msgid "The filter chain is incompatible with --flush-timeout"
|
||||
msgstr ""
|
||||
|
||||
#: src/xz/coder.c:215
|
||||
msgid "Switching to single-threaded mode due to --flush-timeout"
|
||||
msgstr ""
|
||||
|
||||
#: src/xz/coder.c:234
|
||||
#, c-format
|
||||
msgid "Using up to %<PRIu32> threads."
|
||||
msgstr "Jusqu'à %<PRIu32> threads seront utilisés."
|
||||
|
||||
#: src/xz/coder.c:247
|
||||
msgid "Unsupported filter chain or filter options"
|
||||
msgstr "Enchaînement ou options de filtres non pris en charge"
|
||||
|
||||
#: src/xz/coder.c:255
|
||||
#, c-format
|
||||
msgid "Decompression will need %s MiB of memory."
|
||||
msgstr "La décompression nécessitera %s MiB de mémoire."
|
||||
|
||||
#: src/xz/coder.c:290
|
||||
#, c-format
|
||||
msgid "Adjusted the number of threads from %s to %s to not exceed the memory usage limit of %s MiB"
|
||||
msgstr "Nombre de threads réduit de %s à %s pour ne pas dépasser la limite d'utilisation mémoire de %s MiB"
|
||||
|
||||
#: src/xz/coder.c:344
|
||||
#, c-format
|
||||
msgid "Adjusted LZMA%c dictionary size from %s MiB to %s MiB to not exceed the memory usage limit of %s MiB"
|
||||
msgstr "Taille du dictionnaire LZMA%c réduite de %s MiB à %s MiB pour ne pas dépasser la limite d'utilisation mémoire de %s MiB"
|
||||
|
||||
#: src/xz/file_io.c:90
|
||||
#, c-format
|
||||
msgid "Error creating a pipe: %s"
|
||||
msgstr "Impossible de créer un tube anonyme (pipe) : %s"
|
||||
|
||||
#: src/xz/file_io.c:166
|
||||
#, c-format
|
||||
msgid "%s: poll() failed: %s"
|
||||
msgstr "%s : L'appel à la fonction poll() a échoué : %s"
|
||||
|
||||
#. TRANSLATORS: When compression or decompression finishes,
|
||||
#. and xz is going to remove the source file, xz first checks
|
||||
#. if the source file still exists, and if it does, does its
|
||||
#. device and inode numbers match what xz saw when it opened
|
||||
#. the source file. If these checks fail, this message is
|
||||
#. shown, %s being the filename, and the file is not deleted.
|
||||
#. The check for device and inode numbers is there, because
|
||||
#. it is possible that the user has put a new file in place
|
||||
#. of the original file, and in that case it obviously
|
||||
#. shouldn't be removed.
|
||||
#: src/xz/file_io.c:236
|
||||
#, c-format
|
||||
msgid "%s: File seems to have been moved, not removing"
|
||||
msgstr "%s : Le fichier a apparemment été déplacé, suppression annulée"
|
||||
|
||||
#: src/xz/file_io.c:243 src/xz/file_io.c:761
|
||||
#, c-format
|
||||
msgid "%s: Cannot remove: %s"
|
||||
msgstr "%s : Impossible de supprimer : %s"
|
||||
|
||||
#: src/xz/file_io.c:268
|
||||
#, c-format
|
||||
msgid "%s: Cannot set the file owner: %s"
|
||||
msgstr "%s : Impossible de modifier le propriétaire du fichier : %s"
|
||||
|
||||
#: src/xz/file_io.c:274
|
||||
#, c-format
|
||||
msgid "%s: Cannot set the file group: %s"
|
||||
msgstr "%s : Impossible de modifier le groupe propriétaire du fichier : %s"
|
||||
|
||||
#: src/xz/file_io.c:293
|
||||
#, c-format
|
||||
msgid "%s: Cannot set the file permissions: %s"
|
||||
msgstr "%s : Impossible de modifier les permissions du fichier : %s"
|
||||
|
||||
# Note from translator on "file status flags".
|
||||
# The following entry is kept un-translated on purpose. It is difficult to
|
||||
# translate and should only happen in exceptional circumstances which means
|
||||
# that translating would:
|
||||
# - lose some of the meaning
|
||||
# - make it more difficult to look up in search engines; it might happen one in
|
||||
# a million times, if we dilute the error message in 20 languages, it will be
|
||||
# almost impossible to find an explanation and support for the error.
|
||||
#: src/xz/file_io.c:399
|
||||
#, c-format
|
||||
msgid "Error getting the file status flags from standard input: %s"
|
||||
msgstr ""
|
||||
|
||||
#: src/xz/file_io.c:408
|
||||
#, c-format
|
||||
msgid "Error setting O_NONBLOCK on standard input: %s"
|
||||
msgstr "Impossible d'établir le drapeau O_NONBLOCK sur la sortie standard : %s"
|
||||
|
||||
#: src/xz/file_io.c:460 src/xz/file_io.c:522
|
||||
#, c-format
|
||||
msgid "%s: Is a symbolic link, skipping"
|
||||
msgstr "%s est un lien symbolique : ignoré"
|
||||
|
||||
#: src/xz/file_io.c:551
|
||||
#, c-format
|
||||
msgid "%s: Is a directory, skipping"
|
||||
msgstr "%s est un répertoire : ignoré"
|
||||
|
||||
#: src/xz/file_io.c:557
|
||||
#, c-format
|
||||
msgid "%s: Not a regular file, skipping"
|
||||
msgstr "%s n'est pas un fichier régulier : ignoré"
|
||||
|
||||
#: src/xz/file_io.c:574
|
||||
#, c-format
|
||||
msgid "%s: File has setuid or setgid bit set, skipping"
|
||||
msgstr "%s : Le fichier possède les bits `setuid' ou `setgid' : ignoré"
|
||||
|
||||
#: src/xz/file_io.c:581
|
||||
#, c-format
|
||||
msgid "%s: File has sticky bit set, skipping"
|
||||
msgstr "%s : Le fichier possède le bit `sticky' : ignoré"
|
||||
|
||||
#: src/xz/file_io.c:588
|
||||
#, c-format
|
||||
msgid "%s: Input file has more than one hard link, skipping"
|
||||
msgstr "%s : Le fichier d'entrée a plus d'un lien matériel : ignoré"
|
||||
|
||||
# See note from translator above titled "file status flags".
|
||||
#: src/xz/file_io.c:668
|
||||
#, c-format
|
||||
msgid "Error restoring the status flags to standard input: %s"
|
||||
msgstr ""
|
||||
|
||||
# See note from translator above titled "file status flags".
|
||||
#: src/xz/file_io.c:714
|
||||
#, c-format
|
||||
msgid "Error getting the file status flags from standard output: %s"
|
||||
msgstr ""
|
||||
|
||||
#: src/xz/file_io.c:723
|
||||
#, c-format
|
||||
msgid "Error setting O_NONBLOCK on standard output: %s"
|
||||
msgstr "Impossible d'activer le drapeau O_NONBLOCK sur la sortie standard : %s"
|
||||
|
||||
#: src/xz/file_io.c:896
|
||||
#, c-format
|
||||
msgid "Error restoring the O_APPEND flag to standard output: %s"
|
||||
msgstr "Impossible de rétablir le drapeau O_APPEND sur la sortie standard : %s"
|
||||
|
||||
#: src/xz/file_io.c:908
|
||||
#, c-format
|
||||
msgid "%s: Closing the file failed: %s"
|
||||
msgstr "%s : Impossible de fermer le fichier : %s"
|
||||
|
||||
#: src/xz/file_io.c:944 src/xz/file_io.c:1170
|
||||
#, c-format
|
||||
msgid "%s: Seeking failed when trying to create a sparse file: %s"
|
||||
msgstr "%s : Impossible de se déplacer dans le fichier pour créer un 'sparse file' : %s"
|
||||
|
||||
#: src/xz/file_io.c:1039
|
||||
#, c-format
|
||||
msgid "%s: Read error: %s"
|
||||
msgstr "%s : Erreur d'écriture : %s"
|
||||
|
||||
#: src/xz/file_io.c:1059
|
||||
#, c-format
|
||||
msgid "%s: Error seeking the file: %s"
|
||||
msgstr "%s : Impossible de se déplacer dans le fichier : %s"
|
||||
|
||||
#: src/xz/file_io.c:1069
|
||||
#, c-format
|
||||
msgid "%s: Unexpected end of file"
|
||||
msgstr "%s : Fin de fichier inattendue"
|
||||
|
||||
#: src/xz/file_io.c:1128
|
||||
#, c-format
|
||||
msgid "%s: Write error: %s"
|
||||
msgstr "%s : Erreur d'écriture : %s"
|
||||
|
||||
#: src/xz/hardware.c:107
|
||||
msgid "Disabled"
|
||||
msgstr "Désactivé"
|
||||
|
||||
#. TRANSLATORS: Test with "xz --info-memory" to see if
|
||||
#. the alignment looks nice.
|
||||
#: src/xz/hardware.c:126
|
||||
msgid "Total amount of physical memory (RAM): "
|
||||
msgstr "Quantité totale de mémoire physique (RAM) : "
|
||||
|
||||
#: src/xz/hardware.c:128
|
||||
msgid "Memory usage limit for compression: "
|
||||
msgstr "Limite d'utilisation pour la compression : "
|
||||
|
||||
#: src/xz/hardware.c:130
|
||||
msgid "Memory usage limit for decompression: "
|
||||
msgstr "Limite d'utilisation pour la décompression : "
|
||||
|
||||
#. TRANSLATORS: Indicates that there is no integrity check.
|
||||
#. This string is used in tables, so the width must not
|
||||
#. exceed ten columns with a fixed-width font.
|
||||
#: src/xz/list.c:65
|
||||
msgid "None"
|
||||
msgstr "Aucune"
|
||||
|
||||
#. TRANSLATORS: Indicates that integrity check name is not known,
|
||||
#. but the Check ID is known (here 2). This and other "Unknown-N"
|
||||
#. strings are used in tables, so the width must not exceed ten
|
||||
#. columns with a fixed-width font. It's OK to omit the dash if
|
||||
#. you need space for one extra letter, but don't use spaces.
|
||||
#: src/xz/list.c:72
|
||||
msgid "Unknown-2"
|
||||
msgstr "Inconnue-2"
|
||||
|
||||
#: src/xz/list.c:73
|
||||
msgid "Unknown-3"
|
||||
msgstr "Inconnue-3"
|
||||
|
||||
#: src/xz/list.c:75
|
||||
msgid "Unknown-5"
|
||||
msgstr "Inconnue-5"
|
||||
|
||||
#: src/xz/list.c:76
|
||||
msgid "Unknown-6"
|
||||
msgstr "Inconnue-6"
|
||||
|
||||
#: src/xz/list.c:77
|
||||
msgid "Unknown-7"
|
||||
msgstr "Inconnue-7"
|
||||
|
||||
#: src/xz/list.c:78
|
||||
msgid "Unknown-8"
|
||||
msgstr "Inconnue-8"
|
||||
|
||||
#: src/xz/list.c:79
|
||||
msgid "Unknown-9"
|
||||
msgstr "Inconnue-9"
|
||||
|
||||
#: src/xz/list.c:81
|
||||
msgid "Unknown-11"
|
||||
msgstr "Inconnue-11"
|
||||
|
||||
#: src/xz/list.c:82
|
||||
msgid "Unknown-12"
|
||||
msgstr "Inconnue-12"
|
||||
|
||||
#: src/xz/list.c:83
|
||||
msgid "Unknown-13"
|
||||
msgstr "Inconnue-13"
|
||||
|
||||
#: src/xz/list.c:84
|
||||
msgid "Unknown-14"
|
||||
msgstr "Inconnue-14"
|
||||
|
||||
#: src/xz/list.c:85
|
||||
msgid "Unknown-15"
|
||||
msgstr "Inconnue-15"
|
||||
|
||||
#: src/xz/list.c:153
|
||||
#, c-format
|
||||
msgid "%s: File is empty"
|
||||
msgstr "%s : Le fichier est vide"
|
||||
|
||||
#: src/xz/list.c:158
|
||||
#, c-format
|
||||
msgid "%s: Too small to be a valid .xz file"
|
||||
msgstr "%s : Trop petit pour être un fichier xz valide."
|
||||
|
||||
#. TRANSLATORS: These are column headings. From Strms (Streams)
|
||||
#. to Ratio, the columns are right aligned. Check and Filename
|
||||
#. are left aligned. If you need longer words, it's OK to
|
||||
#. use two lines here. Test with "xz -l foo.xz".
|
||||
#: src/xz/list.c:671
|
||||
msgid "Strms Blocks Compressed Uncompressed Ratio Check Filename"
|
||||
msgstr "Flux Blocs Compressé Décompressé Ratio Vérif. Nom de fichier"
|
||||
|
||||
#: src/xz/list.c:711
|
||||
#, c-format
|
||||
msgid " Streams: %s\n"
|
||||
msgstr " Flux : %s\n"
|
||||
|
||||
#: src/xz/list.c:713
|
||||
#, c-format
|
||||
msgid " Blocks: %s\n"
|
||||
msgstr " Blocs : %s\n"
|
||||
|
||||
#: src/xz/list.c:715
|
||||
#, c-format
|
||||
msgid " Compressed size: %s\n"
|
||||
msgstr " Taille données avec compression : %s\n"
|
||||
|
||||
#: src/xz/list.c:718
|
||||
#, c-format
|
||||
msgid " Uncompressed size: %s\n"
|
||||
msgstr " Taille données sans compression : %s\n"
|
||||
|
||||
#: src/xz/list.c:721
|
||||
#, c-format
|
||||
msgid " Ratio: %s\n"
|
||||
msgstr " Ratio : %s\n"
|
||||
|
||||
#: src/xz/list.c:723
|
||||
#, c-format
|
||||
msgid " Check: %s\n"
|
||||
msgstr " Vérification : %s\n"
|
||||
|
||||
#: src/xz/list.c:724
|
||||
#, c-format
|
||||
msgid " Stream padding: %s\n"
|
||||
msgstr " Octets de rembourrage du flux : %s\n"
|
||||
|
||||
#. TRANSLATORS: The second line is column headings. All except
|
||||
#. Check are right aligned; Check is left aligned. Test with
|
||||
#. "xz -lv foo.xz".
|
||||
#: src/xz/list.c:752
|
||||
msgid ""
|
||||
" Streams:\n"
|
||||
" Stream Blocks CompOffset UncompOffset CompSize UncompSize Ratio Check Padding"
|
||||
msgstr ""
|
||||
" Flux :\n"
|
||||
" Flux Blocs PositionComp PositionDécomp TailleComp TailleDécomp Ratio Vérif. Bourrage"
|
||||
|
||||
#. TRANSLATORS: The second line is column headings. All
|
||||
#. except Check are right aligned; Check is left aligned.
|
||||
#: src/xz/list.c:807
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Blocks:\n"
|
||||
" Stream Block CompOffset UncompOffset TotalSize UncompSize Ratio Check"
|
||||
msgstr ""
|
||||
" Blocs :\n"
|
||||
" Flux Bloc PositionComp PositionDécomp TailleTot TailleDécomp Ratio Vérif."
|
||||
|
||||
#. TRANSLATORS: These are additional column headings
|
||||
#. for the most verbose listing mode. CheckVal
|
||||
#. (Check value), Flags, and Filters are left aligned.
|
||||
#. Header (Block Header Size), CompSize, and MemUsage
|
||||
#. are right aligned. %*s is replaced with 0-120
|
||||
#. spaces to make the CheckVal column wide enough.
|
||||
#. Test with "xz -lvv foo.xz".
|
||||
#: src/xz/list.c:819
|
||||
#, c-format
|
||||
msgid " CheckVal %*s Header Flags CompSize MemUsage Filters"
|
||||
msgstr " ValVérif %*sEn-tête Drapeaux TailleComp UtilMém Filtres"
|
||||
|
||||
#: src/xz/list.c:897 src/xz/list.c:1072
|
||||
#, c-format
|
||||
msgid " Memory needed: %s MiB\n"
|
||||
msgstr " Mémoire nécessaire : %s MiB\n"
|
||||
|
||||
#: src/xz/list.c:899 src/xz/list.c:1074
|
||||
#, c-format
|
||||
msgid " Sizes in headers: %s\n"
|
||||
msgstr " Tailles stockées dans l'en-tête : %s\n"
|
||||
|
||||
#: src/xz/list.c:900 src/xz/list.c:1075
|
||||
msgid "Yes"
|
||||
msgstr "Oui"
|
||||
|
||||
#: src/xz/list.c:900 src/xz/list.c:1075
|
||||
msgid "No"
|
||||
msgstr "Non"
|
||||
|
||||
#: src/xz/list.c:901 src/xz/list.c:1076
|
||||
#, c-format
|
||||
msgid " Minimum XZ Utils version: %s\n"
|
||||
msgstr " Version minimale de XZ Utils : %s\n"
|
||||
|
||||
#. TRANSLATORS: %s is an integer. Only the plural form of this
|
||||
#. message is used (e.g. "2 files"). Test with "xz -l foo.xz bar.xz".
|
||||
#: src/xz/list.c:1051
|
||||
#, c-format
|
||||
msgid "%s file\n"
|
||||
msgid_plural "%s files\n"
|
||||
msgstr[0] "%s fichier\n"
|
||||
msgstr[1] "%s fichiers\n"
|
||||
|
||||
#: src/xz/list.c:1064
|
||||
msgid "Totals:"
|
||||
msgstr "Totaux :"
|
||||
|
||||
#: src/xz/list.c:1065
|
||||
#, c-format
|
||||
msgid " Number of files: %s\n"
|
||||
msgstr " Nombre de fichiers : %s\n"
|
||||
|
||||
#: src/xz/list.c:1140
|
||||
msgid "--list works only on .xz files (--format=xz or --format=auto)"
|
||||
msgstr "--list ne marche que sur les fichiers .xz (--format=xz ou --format=auto)"
|
||||
|
||||
#: src/xz/list.c:1146
|
||||
msgid "--list does not support reading from standard input"
|
||||
msgstr "--list est incompatible avec la lecture sur l'entrée standard"
|
||||
|
||||
#: src/xz/main.c:89
|
||||
#, c-format
|
||||
msgid "%s: Error reading filenames: %s"
|
||||
msgstr "%s : Erreur lors de la lecture des noms de fichiers : %s"
|
||||
|
||||
#: src/xz/main.c:96
|
||||
#, c-format
|
||||
msgid "%s: Unexpected end of input when reading filenames"
|
||||
msgstr "%s : Fin des données inattendue lors de la lecture des noms de fichiers"
|
||||
|
||||
#: src/xz/main.c:120
|
||||
#, c-format
|
||||
msgid "%s: Null character found when reading filenames; maybe you meant to use `--files0' instead of `--files'?"
|
||||
msgstr "%s : Caractère NULL détecté lors de la lecture des noms de fichiers ; peut-être pensiez-vous à `--files0' plutot qu'a `--files' ?"
|
||||
|
||||
#: src/xz/main.c:174
|
||||
msgid "Compression and decompression with --robot are not supported yet."
|
||||
msgstr "La compression et la décompression ne marchent pas encore avec --robot."
|
||||
|
||||
#: src/xz/main.c:231
|
||||
msgid "Cannot read data from standard input when reading filenames from standard input"
|
||||
msgstr "Impossible de lire à la fois les données et les noms de fichiers depuis l'entrée standard"
|
||||
|
||||
#. TRANSLATORS: This is the program name in the beginning
|
||||
#. of the line in messages. Usually it becomes "xz: ".
|
||||
#. This is a translatable string because French needs
|
||||
#. a space before a colon.
|
||||
#: src/xz/message.c:713
|
||||
#, c-format
|
||||
msgid "%s: "
|
||||
msgstr "%s : "
|
||||
|
||||
#: src/xz/message.c:776 src/xz/message.c:826
|
||||
msgid "Internal error (bug)"
|
||||
msgstr "Erreur interne (bug)"
|
||||
|
||||
#: src/xz/message.c:783
|
||||
msgid "Cannot establish signal handlers"
|
||||
msgstr "Impossible d'installer le gestionnaire de signaux"
|
||||
|
||||
#: src/xz/message.c:792
|
||||
msgid "No integrity check; not verifying file integrity"
|
||||
msgstr "Pas de données de vérification d'intégrité ; vérification non effectuée"
|
||||
|
||||
#: src/xz/message.c:795
|
||||
msgid "Unsupported type of integrity check; not verifying file integrity"
|
||||
msgstr "Méthode de vérification d'intégrité non prise en charge ; vérification non effectuée"
|
||||
|
||||
#: src/xz/message.c:802
|
||||
msgid "Memory usage limit reached"
|
||||
msgstr "Limite d'utilisation mémoire atteinte"
|
||||
|
||||
#: src/xz/message.c:805
|
||||
msgid "File format not recognized"
|
||||
msgstr "Format de fichier inconnu"
|
||||
|
||||
#: src/xz/message.c:808
|
||||
msgid "Unsupported options"
|
||||
msgstr "Options non prises en charge"
|
||||
|
||||
#: src/xz/message.c:811
|
||||
msgid "Compressed data is corrupt"
|
||||
msgstr "Les données compressées sont corrompues"
|
||||
|
||||
#: src/xz/message.c:814
|
||||
msgid "Unexpected end of input"
|
||||
msgstr "Fin des données inattendue "
|
||||
|
||||
#: src/xz/message.c:847
|
||||
#, c-format
|
||||
msgid "%s MiB of memory is required. The limiter is disabled."
|
||||
msgstr "%s MiB de mémoire sont nécessaires. La limite est désactivée."
|
||||
|
||||
#: src/xz/message.c:875
|
||||
#, c-format
|
||||
msgid "%s MiB of memory is required. The limit is %s."
|
||||
msgstr "%s MiB de mémoire sont nécessaires, la limite étant %s."
|
||||
|
||||
#: src/xz/message.c:1042
|
||||
#, c-format
|
||||
msgid "%s: Filter chain: %s\n"
|
||||
msgstr "%s : Enchaînement de filtres : %s\n"
|
||||
|
||||
#: src/xz/message.c:1052
|
||||
#, c-format
|
||||
msgid "Try `%s --help' for more information."
|
||||
msgstr "Éxécutez `%s --help' pour obtenir davantage d'informations."
|
||||
|
||||
#: src/xz/message.c:1078
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Usage: %s [OPTION]... [FILE]...\n"
|
||||
"Compress or decompress FILEs in the .xz format.\n"
|
||||
"\n"
|
||||
msgstr ""
|
||||
"Utilisation : %s [OPTION]... [FICHIER]...\n"
|
||||
"Compresse ou decompresse FICHIER(s) au format .xz.\n"
|
||||
"\n"
|
||||
|
||||
#: src/xz/message.c:1085
|
||||
msgid "Mandatory arguments to long options are mandatory for short options too.\n"
|
||||
msgstr ""
|
||||
"Les arguments obligatoires pour les options longues le sont aussi pour les\n"
|
||||
"options courtes.\n"
|
||||
|
||||
#: src/xz/message.c:1089
|
||||
msgid " Operation mode:\n"
|
||||
msgstr " Mode d'opération :\n"
|
||||
|
||||
#: src/xz/message.c:1092
|
||||
msgid ""
|
||||
" -z, --compress force compression\n"
|
||||
" -d, --decompress force decompression\n"
|
||||
" -t, --test test compressed file integrity\n"
|
||||
" -l, --list list information about .xz files"
|
||||
msgstr ""
|
||||
" -z, --compress forcer le mode compression\n"
|
||||
" -d, --decompress forcer le mode décompression\n"
|
||||
" -t, --test tester l'intégrité du fichier compressé\n"
|
||||
" -l, --list lister les informations sur les fichiers .xz"
|
||||
|
||||
#: src/xz/message.c:1098
|
||||
msgid ""
|
||||
"\n"
|
||||
" Operation modifiers:\n"
|
||||
msgstr ""
|
||||
"\n"
|
||||
" Modificateurs :\n"
|
||||
|
||||
#: src/xz/message.c:1101
|
||||
msgid ""
|
||||
" -k, --keep keep (don't delete) input files\n"
|
||||
" -f, --force force overwrite of output file and (de)compress links\n"
|
||||
" -c, --stdout write to standard output and don't delete input files"
|
||||
msgstr ""
|
||||
" -k, --keep ne pas supprimer les fichiers d'entrée\n"
|
||||
" -f, --force forcer l'écrasement éventuel du fichier de sortie et\n"
|
||||
" (dé)compresser les liens symboliques\n"
|
||||
" -c, --stdout écrire sur la sortie standard et ne pas supprimer les\n"
|
||||
" fichiers d'entrée"
|
||||
|
||||
#: src/xz/message.c:1107
|
||||
msgid ""
|
||||
" --single-stream decompress only the first stream, and silently\n"
|
||||
" ignore possible remaining input data"
|
||||
msgstr ""
|
||||
" --single-stream décompresser uniquement le premier flux et ignorer\n"
|
||||
" silencieusement les données éventuellement restantes"
|
||||
|
||||
#: src/xz/message.c:1110
|
||||
msgid ""
|
||||
" --no-sparse do not create sparse files when decompressing\n"
|
||||
" -S, --suffix=.SUF use the suffix `.SUF' on compressed files\n"
|
||||
" --files[=FILE] read filenames to process from FILE; if FILE is\n"
|
||||
" omitted, filenames are read from the standard input;\n"
|
||||
" filenames must be terminated with the newline character\n"
|
||||
" --files0[=FILE] like --files but use the null character as terminator"
|
||||
msgstr ""
|
||||
" --no-sparse ne pas créer de 'sparse file' lors de la décompression\n"
|
||||
" -S, --suffix=.SUF utiliser le suffixe `.SUF' pour les fichiers compressés\n"
|
||||
" --files[=FILE] lire les fichiers sur lesquels opérer depuis FILE ; si\n"
|
||||
" FILE est omis, ceux-ci sont lus depuis l'entrée standard\n"
|
||||
" et doivent être suivis d'un caractère retour à la ligne\n"
|
||||
" --files0[=FILE] comme --files mais avec un caractère null comme séparateur"
|
||||
|
||||
#: src/xz/message.c:1119
|
||||
msgid ""
|
||||
"\n"
|
||||
" Basic file format and compression options:\n"
|
||||
msgstr ""
|
||||
"\n"
|
||||
" Options basiques de format de fichier et de compression :\n"
|
||||
|
||||
#: src/xz/message.c:1121
|
||||
msgid ""
|
||||
" -F, --format=FMT file format to encode or decode; possible values are\n"
|
||||
" `auto' (default), `xz', `lzma', and `raw'\n"
|
||||
" -C, --check=CHECK integrity check type: `none' (use with caution),\n"
|
||||
" `crc32', `crc64' (default), or `sha256'"
|
||||
msgstr ""
|
||||
" -F, --format=FMT format du fichier à encoder ou décoder ; sont acceptés :\n"
|
||||
" `auto' (par défaut), `xz', `lzma' et `raw'\n"
|
||||
" -C, --check=CHECK type de vérification d'intégrité : `none' (à utiliser avec\n"
|
||||
" précaution), `crc32', `crc64' (par défaut) ou `sha256'"
|
||||
|
||||
#: src/xz/message.c:1126
|
||||
msgid " --ignore-check don't verify the integrity check when decompressing"
|
||||
msgstr ""
|
||||
" --ignore-check ne pas vérifier l'intégrité des données lors de\n"
|
||||
" la décompression"
|
||||
|
||||
#: src/xz/message.c:1130
|
||||
msgid ""
|
||||
" -0 ... -9 compression preset; default is 6; take compressor *and*\n"
|
||||
" decompressor memory usage into account before using 7-9!"
|
||||
msgstr ""
|
||||
" -0 ... -9 préréglage de compression : 6 par défaut ; pensez à\n"
|
||||
" l'utilisation mémoire du compresseur *et* du décompresseur\n"
|
||||
" avant d'utiliser 7, 8 ou 9 !"
|
||||
|
||||
#: src/xz/message.c:1134
|
||||
msgid ""
|
||||
" -e, --extreme try to improve compression ratio by using more CPU time;\n"
|
||||
" does not affect decompressor memory requirements"
|
||||
msgstr ""
|
||||
" -e, --extreme essayer d'améliorer la compression en utilisant davantage\n"
|
||||
" de temps processeur ;\n"
|
||||
" n'affecte pas les besoins mémoire du décompresseur"
|
||||
|
||||
#: src/xz/message.c:1138
|
||||
msgid ""
|
||||
" -T, --threads=NUM use at most NUM threads; the default is 1; set to 0\n"
|
||||
" to use as many threads as there are processor cores"
|
||||
msgstr ""
|
||||
" -T, --threads=NB créer au plus NB fils de compression (1 par défault) ; la\n"
|
||||
" valeur 0 est spéciale et équivaut au nombre de processeurs\n"
|
||||
" de la machine"
|
||||
|
||||
#: src/xz/message.c:1143
|
||||
msgid ""
|
||||
" --block-size=SIZE\n"
|
||||
" start a new .xz block after every SIZE bytes of input;\n"
|
||||
" use this to set the block size for threaded compression"
|
||||
msgstr ""
|
||||
" --block-size=TAILLE\n"
|
||||
" débuter un bloc XZ après chaque TAILLE octets de données\n"
|
||||
" d'entrée ; ce réglage sert pour la compression paralléle"
|
||||
|
||||
#: src/xz/message.c:1147
|
||||
msgid ""
|
||||
" --block-list=SIZES\n"
|
||||
" start a new .xz block after the given comma-separated\n"
|
||||
" intervals of uncompressed data"
|
||||
msgstr ""
|
||||
" --block-list=TAILLES\n"
|
||||
" débuter des blocs XZ après les TAILLES octets de données\n"
|
||||
" spécifiées avec des virgules pour séparateur"
|
||||
|
||||
#: src/xz/message.c:1151
|
||||
msgid ""
|
||||
" --flush-timeout=TIMEOUT\n"
|
||||
" when compressing, if more than TIMEOUT milliseconds has\n"
|
||||
" passed since the previous flush and reading more input\n"
|
||||
" would block, all pending data is flushed out"
|
||||
msgstr ""
|
||||
|
||||
#: src/xz/message.c:1157
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
" --memlimit-compress=LIMIT\n"
|
||||
" --memlimit-decompress=LIMIT\n"
|
||||
" -M, --memlimit=LIMIT\n"
|
||||
" set memory usage limit for compression, decompression,\n"
|
||||
" or both; LIMIT is in bytes, % of RAM, or 0 for defaults"
|
||||
msgstr ""
|
||||
" --memlimit-compress=LIMIT\n"
|
||||
" --memlimit-decompress=LIMIT\n"
|
||||
" -M, --memlimit=LIMIT\n"
|
||||
" règle la limite d'utilisation mémoire pour la compression,\n"
|
||||
" décompression ou les deux ; LIMIT est en octets,\n"
|
||||
" pourcentage de RAM, ou 0 pour la valeur par défaut"
|
||||
|
||||
#: src/xz/message.c:1164
|
||||
msgid ""
|
||||
" --no-adjust if compression settings exceed the memory usage limit,\n"
|
||||
" give an error instead of adjusting the settings downwards"
|
||||
msgstr ""
|
||||
" --no-adjust si les réglages de compression dépassent la limite\n"
|
||||
" d'utilisation mémoire, renvoyer une erreur plutôt que de\n"
|
||||
" diminuer les réglages"
|
||||
|
||||
#: src/xz/message.c:1170
|
||||
msgid ""
|
||||
"\n"
|
||||
" Custom filter chain for compression (alternative for using presets):"
|
||||
msgstr ""
|
||||
"\n"
|
||||
" Chaîne de filtres de compression personnalisée (en lieu des préréglages) :"
|
||||
|
||||
#: src/xz/message.c:1179
|
||||
msgid ""
|
||||
"\n"
|
||||
" --lzma1[=OPTS] LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n"
|
||||
" --lzma2[=OPTS] more of the following options (valid values; default):\n"
|
||||
" preset=PRE reset options to a preset (0-9[e])\n"
|
||||
" dict=NUM dictionary size (4KiB - 1536MiB; 8MiB)\n"
|
||||
" lc=NUM number of literal context bits (0-4; 3)\n"
|
||||
" lp=NUM number of literal position bits (0-4; 0)\n"
|
||||
" pb=NUM number of position bits (0-4; 2)\n"
|
||||
" mode=MODE compression mode (fast, normal; normal)\n"
|
||||
" nice=NUM nice length of a match (2-273; 64)\n"
|
||||
" mf=NAME match finder (hc3, hc4, bt2, bt3, bt4; bt4)\n"
|
||||
" depth=NUM maximum search depth; 0=automatic (default)"
|
||||
msgstr ""
|
||||
"\n"
|
||||
" --lzma1[=OPTS] LZMA1/2 ; OPTS est une liste d'options parmi les suivantes\n"
|
||||
" --lzma2[=OPTS] (entre parenthèses : valeurs valides et par défaut) :\n"
|
||||
" preset=PRE remettre les options à un préréglage (0-9[e])\n"
|
||||
" dict=NUM taille dictionnaire (4KiB - 1536MiB ; 8MiB)\n"
|
||||
" lc=NUM nombre de 'literal context bits' (0-4 ; 3)\n"
|
||||
" lp=NUM nombre de 'literal position bits' (0-4 ; 0)\n"
|
||||
" pb=NUM nombre de 'position bits' (0-4 ; 2)\n"
|
||||
" mode=MODE mode de compression (fast, normal ; normal)\n"
|
||||
" nice=NUM nice length of a match (2-273; 64)\n"
|
||||
" mf=NAME 'match finder' (hc3, hc4, bt2, bt3, bt4; bt4)\n"
|
||||
" depth=NUM profondeur de recherche maximale ;\n"
|
||||
" 0=automatique (par défaut)"
|
||||
|
||||
#: src/xz/message.c:1194
|
||||
msgid ""
|
||||
"\n"
|
||||
" --x86[=OPTS] x86 BCJ filter (32-bit and 64-bit)\n"
|
||||
" --powerpc[=OPTS] PowerPC BCJ filter (big endian only)\n"
|
||||
" --ia64[=OPTS] IA-64 (Itanium) BCJ filter\n"
|
||||
" --arm[=OPTS] ARM BCJ filter (little endian only)\n"
|
||||
" --armthumb[=OPTS] ARM-Thumb BCJ filter (little endian only)\n"
|
||||
" --sparc[=OPTS] SPARC BCJ filter\n"
|
||||
" Valid OPTS for all BCJ filters:\n"
|
||||
" start=NUM start offset for conversions (default=0)"
|
||||
msgstr ""
|
||||
"\n"
|
||||
" --x86[=OPTS] filtre BCJ x86 (32-bit et 64-bit)\n"
|
||||
" --powerpc[=OPTS] filtre BCJ PowerPC ('big endian' uniquement)\n"
|
||||
" --ia64[=OPTS] filtre BCJ IA-64 (Itanium)\n"
|
||||
" --arm[=OPTS] filtre BCJ ARM ('little endian' uniquement)\n"
|
||||
" --armthumb[=OPTS] filtre BCJ ARM-Thumb ('little endian' uniquement)\n"
|
||||
" --sparc[=OPTS] filtre BCJ SPARC\n"
|
||||
" OPTS valides pour tous les filtres BCJ :\n"
|
||||
" start=NUM position de début de la conversion (défaut=0)"
|
||||
|
||||
#: src/xz/message.c:1206
|
||||
msgid ""
|
||||
"\n"
|
||||
" --delta[=OPTS] Delta filter; valid OPTS (valid values; default):\n"
|
||||
" dist=NUM distance between bytes being subtracted\n"
|
||||
" from each other (1-256; 1)"
|
||||
msgstr ""
|
||||
"\n"
|
||||
" --delta[=OPTS] Filtre delta ; OPTS valides (vals. valides ; par défaut) :\n"
|
||||
" dist=NUM distance entre les octets soustraits les\n"
|
||||
" uns aux autres (1-256 ; 1)"
|
||||
|
||||
#: src/xz/message.c:1214
|
||||
msgid ""
|
||||
"\n"
|
||||
" Other options:\n"
|
||||
msgstr ""
|
||||
"\n"
|
||||
" Autres options :\n"
|
||||
|
||||
#: src/xz/message.c:1217
|
||||
msgid ""
|
||||
" -q, --quiet suppress warnings; specify twice to suppress errors too\n"
|
||||
" -v, --verbose be verbose; specify twice for even more verbose"
|
||||
msgstr ""
|
||||
" -q, --quiet masquer les avertissements ; spécifier deux fois pour\n"
|
||||
" aussi masquer les erreurs\n"
|
||||
" -v, --verbose être bavard ; spécifier deux fois pour l'être davantage"
|
||||
|
||||
#: src/xz/message.c:1222
|
||||
msgid " -Q, --no-warn make warnings not affect the exit status"
|
||||
msgstr " -Q, --no-warn les avertissements ne modifient pas le code de sortie"
|
||||
|
||||
#: src/xz/message.c:1224
|
||||
msgid " --robot use machine-parsable messages (useful for scripts)"
|
||||
msgstr ""
|
||||
" --robot utiliser des messages lisibles par un programme\n"
|
||||
" (utile pour les scripts)"
|
||||
|
||||
#: src/xz/message.c:1227
|
||||
msgid ""
|
||||
" --info-memory display the total amount of RAM and the currently active\n"
|
||||
" memory usage limits, and exit"
|
||||
msgstr ""
|
||||
" --info-memory afficher la quantité totale de RAM ainsi que la limite\n"
|
||||
" actuelle d'utilisation mémoire puis quitter"
|
||||
|
||||
#: src/xz/message.c:1230
|
||||
msgid ""
|
||||
" -h, --help display the short help (lists only the basic options)\n"
|
||||
" -H, --long-help display this long help and exit"
|
||||
msgstr ""
|
||||
" -h, --help afficher l'aide courte (ne liste que les options de base)\n"
|
||||
" -H, --long-help afficher l'aide longue (ceci) puis quitter"
|
||||
|
||||
#: src/xz/message.c:1234
|
||||
msgid ""
|
||||
" -h, --help display this short help and exit\n"
|
||||
" -H, --long-help display the long help (lists also the advanced options)"
|
||||
msgstr ""
|
||||
" -h, --help afficher l'aide courte (ceci) puis quitter\n"
|
||||
" -H, --long-help afficher l'aide longue (liste aussi les options avancées)"
|
||||
|
||||
#: src/xz/message.c:1239
|
||||
msgid " -V, --version display the version number and exit"
|
||||
msgstr " -V, --version afficher le numéro de version puis quitter"
|
||||
|
||||
#: src/xz/message.c:1241
|
||||
msgid ""
|
||||
"\n"
|
||||
"With no FILE, or when FILE is -, read standard input.\n"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Sans FILE ou quand FILE est -, lire l'entrée standard.\n"
|
||||
|
||||
#. TRANSLATORS: This message indicates the bug reporting address
|
||||
#. for this package. Please add _another line_ saying
|
||||
#. "Report translation bugs to <...>\n" with the email or WWW
|
||||
#. address for translation bugs. Thanks.
|
||||
#: src/xz/message.c:1247
|
||||
#, c-format
|
||||
msgid "Report bugs to <%s> (in English or Finnish).\n"
|
||||
msgstr ""
|
||||
"Signaler les bogues à <%s> (en anglais ou en finlandais).\n"
|
||||
"Signaler les bogues de traduction à <adrien@notk.org>.\n"
|
||||
|
||||
#: src/xz/message.c:1249
|
||||
#, c-format
|
||||
msgid "%s home page: <%s>\n"
|
||||
msgstr "Page du projet %s : <%s>\n"
|
||||
|
||||
#: src/xz/message.c:1253
|
||||
msgid "THIS IS A DEVELOPMENT VERSION NOT INTENDED FOR PRODUCTION USE."
|
||||
msgstr ""
|
||||
|
||||
#: src/xz/options.c:86
|
||||
#, c-format
|
||||
msgid "%s: Options must be `name=value' pairs separated with commas"
|
||||
msgstr "%s: Les options doivent être des paires `nom=valeur' séparées par des virgules"
|
||||
|
||||
#: src/xz/options.c:93
|
||||
#, c-format
|
||||
msgid "%s: Invalid option name"
|
||||
msgstr "%s : Nom d'option invalide"
|
||||
|
||||
#: src/xz/options.c:113
|
||||
#, c-format
|
||||
msgid "%s: Invalid option value"
|
||||
msgstr "%s : Valeur d'option invalide"
|
||||
|
||||
#: src/xz/options.c:247
|
||||
#, c-format
|
||||
msgid "Unsupported LZMA1/LZMA2 preset: %s"
|
||||
msgstr "Préréglage LZMA1/LZMA2 non reconnu : %s"
|
||||
|
||||
#: src/xz/options.c:355
|
||||
msgid "The sum of lc and lp must not exceed 4"
|
||||
msgstr "La somme de lc et lp ne doit pas dépasser 4"
|
||||
|
||||
#: src/xz/options.c:359
|
||||
#, c-format
|
||||
msgid "The selected match finder requires at least nice=%<PRIu32>"
|
||||
msgstr "Le `match finder' choisi nécessite au moins nice=%<PRIu32>"
|
||||
|
||||
#: src/xz/suffix.c:133 src/xz/suffix.c:258
|
||||
#, c-format
|
||||
msgid "%s: With --format=raw, --suffix=.SUF is required unless writing to stdout"
|
||||
msgstr "%s : Avec --format=raw, --suffix=.SUF est nécessaire sauf lors de l'écriture vers stdout"
|
||||
|
||||
#: src/xz/suffix.c:164
|
||||
#, c-format
|
||||
msgid "%s: Filename has an unknown suffix, skipping"
|
||||
msgstr "%s : Le fichier a un suffixe inconnu, ignoré"
|
||||
|
||||
#: src/xz/suffix.c:185
|
||||
#, c-format
|
||||
msgid "%s: File already has `%s' suffix, skipping"
|
||||
msgstr "%s : Le fichier a déjà le suffixe '%s', ignoré"
|
||||
|
||||
#: src/xz/suffix.c:393
|
||||
#, c-format
|
||||
msgid "%s: Invalid filename suffix"
|
||||
msgstr "%s: Suffixe de nom de fichier invalide"
|
||||
|
||||
#: src/xz/util.c:71
|
||||
#, c-format
|
||||
msgid "%s: Value is not a non-negative decimal integer"
|
||||
msgstr "%s : La valeur n'est pas un entier décimal non négatif"
|
||||
|
||||
#: src/xz/util.c:113
|
||||
#, c-format
|
||||
msgid "%s: Invalid multiplier suffix"
|
||||
msgstr "%s : Suffixe multiplicateur invalide"
|
||||
|
||||
#: src/xz/util.c:115
|
||||
msgid "Valid suffixes are `KiB' (2^10), `MiB' (2^20), and `GiB' (2^30)."
|
||||
msgstr "Les suffixes valides sont 'KiB' (2^10), 'MiB' (2^20) et 'GiB' (2^30)."
|
||||
|
||||
#: src/xz/util.c:132
|
||||
#, c-format
|
||||
msgid "Value of the option `%s' must be in the range [%<PRIu64>, %<PRIu64>]"
|
||||
msgstr "La valeur de l'option '%s' doit être inclue entre %<PRIu64> et %<PRIu64>"
|
||||
|
||||
#: src/xz/util.c:257
|
||||
msgid "Empty filename, skipping"
|
||||
msgstr "Nom de fichier vide, ignoré"
|
||||
|
||||
#: src/xz/util.c:271
|
||||
msgid "Compressed data cannot be read from a terminal"
|
||||
msgstr "Les données compressées ne peuvent pas être lues depuis un terminal"
|
||||
|
||||
#: src/xz/util.c:284
|
||||
msgid "Compressed data cannot be written to a terminal"
|
||||
msgstr "Les données compressées ne peuvent pas être écrites dans un terminal"
|
||||
|
||||
#: src/common/tuklib_exit.c:39
|
||||
msgid "Writing to standard output failed"
|
||||
msgstr "Impossible d'écrire vers la sortie standard"
|
||||
|
||||
#: src/common/tuklib_exit.c:42
|
||||
msgid "Unknown error"
|
||||
msgstr "Erreur inconnue"
|
||||
439
po/it.po
439
po/it.po
@@ -2,78 +2,116 @@
|
||||
# This file is in the public domain
|
||||
# Gruppo traduzione italiano di Ubuntu-it <gruppo-traduzione@ubuntu-it.org>, 2009, 2010
|
||||
# Lorenzo De Liso <blackz@ubuntu.com>, 2010.
|
||||
# Milo Casagrande <milo@ubuntu.com>, 2009, 2010.
|
||||
# Milo Casagrande <milo@ubuntu.com>, 2009, 2010, 2011, 2014.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: xz-utils\n"
|
||||
"Report-Msgid-Bugs-To: lasse.collin@tukaani.org\n"
|
||||
"POT-Creation-Date: 2010-09-10 14:50+0300\n"
|
||||
"PO-Revision-Date: 2010-09-16 21:32+0200\n"
|
||||
"Last-Translator: Milo Casagrande <milo@ubuntu.com>\n"
|
||||
"POT-Creation-Date: 2014-09-14 21:56+0300\n"
|
||||
"PO-Revision-Date: 2014-10-20 13:16+0100\n"
|
||||
"Last-Translator: Milo Casagrande <milo@milo.name>\n"
|
||||
"Language-Team: Italian <tp@lists.linux.it>\n"
|
||||
"Language: it\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-08-16 19:16+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
"X-Generator: Poedit 1.6.10\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#: src/xz/args.c:333
|
||||
#: src/xz/args.c:63
|
||||
#, c-format
|
||||
msgid "%s: Invalid argument to --block-list"
|
||||
msgstr "%s: argomento non valido per --block-list"
|
||||
|
||||
#: src/xz/args.c:73
|
||||
#, c-format
|
||||
msgid "%s: Too many arguments to --block-list"
|
||||
msgstr "%s: troppi argomenti per --block-list"
|
||||
|
||||
#: src/xz/args.c:102
|
||||
msgid "0 can only be used as the last element in --block-list"
|
||||
msgstr "0 può essere usato solo come ultimo elemento in --block-list"
|
||||
|
||||
#: src/xz/args.c:406
|
||||
#, c-format
|
||||
msgid "%s: Unknown file format type"
|
||||
msgstr "%s: tipo di formato del file sconosciutoN"
|
||||
msgstr "%s: tipo di formato del file sconosciuto"
|
||||
|
||||
#: src/xz/args.c:356 src/xz/args.c:364
|
||||
#: src/xz/args.c:429 src/xz/args.c:437
|
||||
#, c-format
|
||||
msgid "%s: Unsupported integrity check type"
|
||||
msgstr "%s: tipo di controllo integrità non supportato"
|
||||
|
||||
#: src/xz/args.c:382
|
||||
#: src/xz/args.c:473
|
||||
msgid "Only one file can be specified with `--files' or `--files0'."
|
||||
msgstr "Solo un file può essere specificato con \"--files\" o \"--files0\"."
|
||||
|
||||
#: src/xz/args.c:445
|
||||
#: src/xz/args.c:541
|
||||
#, c-format
|
||||
msgid "The environment variable %s contains too many arguments"
|
||||
msgstr "La variabile d'ambiente %s contiene troppi argomenti"
|
||||
|
||||
#: src/xz/coder.c:95
|
||||
#: src/xz/coder.c:110
|
||||
msgid "Maximum number of filters is four"
|
||||
msgstr "Il numero massimo di filtri è quattro"
|
||||
|
||||
#: src/xz/coder.c:108
|
||||
#: src/xz/coder.c:129
|
||||
msgid "Memory usage limit is too low for the given filter setup."
|
||||
msgstr ""
|
||||
"Il limite dell'uso della memoria è troppo basso per l'impostazione del "
|
||||
"filtro dato."
|
||||
|
||||
#: src/xz/coder.c:129
|
||||
#: src/xz/coder.c:159
|
||||
msgid "Using a preset in raw mode is discouraged."
|
||||
msgstr "Non è consigliato usare un preset nella modalità raw."
|
||||
|
||||
#: src/xz/coder.c:131
|
||||
#: src/xz/coder.c:161
|
||||
msgid "The exact options of the presets may vary between software versions."
|
||||
msgstr ""
|
||||
"Le opzioni esatte per i preset possono variare tra le versioni del software."
|
||||
|
||||
#: src/xz/coder.c:157
|
||||
#: src/xz/coder.c:184
|
||||
msgid "The .lzma format supports only the LZMA1 filter"
|
||||
msgstr "Il formato .lzma supporta solo il filtro LZMA1"
|
||||
|
||||
#: src/xz/coder.c:165
|
||||
#: src/xz/coder.c:192
|
||||
msgid "LZMA1 cannot be used with the .xz format"
|
||||
msgstr "LZMA1 non può essere usato con il formato .xz"
|
||||
|
||||
#: src/xz/coder.c:182
|
||||
#: src/xz/coder.c:209
|
||||
msgid "The filter chain is incompatible with --flush-timeout"
|
||||
msgstr "La catena di filtri non è compatibile con --flush-timeout"
|
||||
|
||||
#: src/xz/coder.c:215
|
||||
msgid "Switching to single-threaded mode due to --flush-timeout"
|
||||
msgstr "Passaggio a modalità singolo thread poiché viene usato --flush-timeout"
|
||||
|
||||
#: src/xz/coder.c:234
|
||||
#, c-format
|
||||
msgid "Using up to %<PRIu32> threads."
|
||||
msgstr "Vengono usati circa %<PRIu32> thread."
|
||||
|
||||
#: src/xz/coder.c:247
|
||||
msgid "Unsupported filter chain or filter options"
|
||||
msgstr "Catena di filtri od opzioni del filtro non supportata"
|
||||
|
||||
#: src/xz/coder.c:190
|
||||
#: src/xz/coder.c:255
|
||||
#, c-format
|
||||
msgid "Decompression will need %s MiB of memory."
|
||||
msgstr "L'estrazione necessita di %s MiB di memoria."
|
||||
|
||||
#: src/xz/coder.c:247
|
||||
#: src/xz/coder.c:290
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Adjusted the number of threads from %s to %s to not exceed the memory usage "
|
||||
"limit of %s MiB"
|
||||
msgstr ""
|
||||
"Regolato il numero di thread da %s a %s per non eccedere il limite di "
|
||||
"utilizzo della memoria di %s MiB"
|
||||
|
||||
#: src/xz/coder.c:344
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Adjusted LZMA%c dictionary size from %s MiB to %s MiB to not exceed the "
|
||||
@@ -82,6 +120,16 @@ msgstr ""
|
||||
"Regolata la dimensione del dizionario LZMA%c da %s MiB a %s MiB per non "
|
||||
"superare il limite dell'uso della memoria di %s MiB"
|
||||
|
||||
#: src/xz/file_io.c:90
|
||||
#, c-format
|
||||
msgid "Error creating a pipe: %s"
|
||||
msgstr "Errore nel creare una pipe: %s"
|
||||
|
||||
#: src/xz/file_io.c:166
|
||||
#, c-format
|
||||
msgid "%s: poll() failed: %s"
|
||||
msgstr "%s: poll() non riuscita: %s"
|
||||
|
||||
#. TRANSLATORS: When compression or decompression finishes,
|
||||
#. and xz is going to remove the source file, xz first checks
|
||||
#. if the source file still exists, and if it does, does its
|
||||
@@ -92,119 +140,146 @@ msgstr ""
|
||||
#. it is possible that the user has put a new file in place
|
||||
#. of the original file, and in that case it obviously
|
||||
#. shouldn't be removed.
|
||||
#: src/xz/file_io.c:137
|
||||
#: src/xz/file_io.c:236
|
||||
#, c-format
|
||||
msgid "%s: File seems to have been moved, not removing"
|
||||
msgstr "%s: sembra che il file sia stato spostato, non viene rimosso"
|
||||
|
||||
#: src/xz/file_io.c:144 src/xz/file_io.c:590
|
||||
#: src/xz/file_io.c:243 src/xz/file_io.c:761
|
||||
#, c-format
|
||||
msgid "%s: Cannot remove: %s"
|
||||
msgstr "%s: impossibile rimuovere: %s"
|
||||
|
||||
#: src/xz/file_io.c:169
|
||||
#: src/xz/file_io.c:268
|
||||
#, c-format
|
||||
msgid "%s: Cannot set the file owner: %s"
|
||||
msgstr "%s: impossibile impostare il proprietario del file: %s"
|
||||
|
||||
#: src/xz/file_io.c:175
|
||||
#: src/xz/file_io.c:274
|
||||
#, c-format
|
||||
msgid "%s: Cannot set the file group: %s"
|
||||
msgstr "%s: impossibile impostare il gruppo del file: %s"
|
||||
|
||||
#: src/xz/file_io.c:194
|
||||
#: src/xz/file_io.c:293
|
||||
#, c-format
|
||||
msgid "%s: Cannot set the file permissions: %s"
|
||||
msgstr "%s: impossibile impostare i permessi del file: %s"
|
||||
|
||||
#: src/xz/file_io.c:337 src/xz/file_io.c:420
|
||||
#: src/xz/file_io.c:399
|
||||
#, c-format
|
||||
msgid "Error getting the file status flags from standard input: %s"
|
||||
msgstr ""
|
||||
"Errore nel recuperare le flag di stato del file dallo standard input: %s"
|
||||
|
||||
#: src/xz/file_io.c:408
|
||||
#, c-format
|
||||
msgid "Error setting O_NONBLOCK on standard input: %s"
|
||||
msgstr "Errore nell'impostare O_NONBLOCK sullo standard input: %s"
|
||||
|
||||
#: src/xz/file_io.c:460 src/xz/file_io.c:522
|
||||
#, c-format
|
||||
msgid "%s: Is a symbolic link, skipping"
|
||||
msgstr "%s: è un collegamento simbolico, viene saltato"
|
||||
|
||||
#: src/xz/file_io.c:455
|
||||
#: src/xz/file_io.c:551
|
||||
#, c-format
|
||||
msgid "%s: Is a directory, skipping"
|
||||
msgstr "%s: è una directory, viene saltata"
|
||||
|
||||
#: src/xz/file_io.c:462
|
||||
#: src/xz/file_io.c:557
|
||||
#, c-format
|
||||
msgid "%s: Not a regular file, skipping"
|
||||
msgstr "%s: non è un file regolare, viene saltato"
|
||||
|
||||
#: src/xz/file_io.c:479
|
||||
#: src/xz/file_io.c:574
|
||||
#, c-format
|
||||
msgid "%s: File has setuid or setgid bit set, skipping"
|
||||
msgstr "%s: il file ha il bit setuid o setgid impostato, viene saltato"
|
||||
|
||||
#: src/xz/file_io.c:486
|
||||
#: src/xz/file_io.c:581
|
||||
#, c-format
|
||||
msgid "%s: File has sticky bit set, skipping"
|
||||
msgstr "%s: il file ha lo sticky bit impostato, viene saltato"
|
||||
|
||||
#: src/xz/file_io.c:493
|
||||
#: src/xz/file_io.c:588
|
||||
#, c-format
|
||||
msgid "%s: Input file has more than one hard link, skipping"
|
||||
msgstr "%s: il file di input ha più di un collegamento fisico, viene saltato"
|
||||
|
||||
#: src/xz/file_io.c:668
|
||||
#, c-format
|
||||
msgid "Error restoring the status flags to standard input: %s"
|
||||
msgstr "Errore nel ripristinare le flag di stato sullo standard input: %s"
|
||||
|
||||
#: src/xz/file_io.c:714
|
||||
#, c-format
|
||||
msgid "Error getting the file status flags from standard output: %s"
|
||||
msgstr ""
|
||||
"Errore nel recuperare le flag di stato del file dallo standard output: %s"
|
||||
|
||||
#: src/xz/file_io.c:723
|
||||
#, c-format
|
||||
msgid "Error setting O_NONBLOCK on standard output: %s"
|
||||
msgstr "Errore nell'impostare O_NONBLOCK sullo standard output: %s"
|
||||
|
||||
#: src/xz/file_io.c:896
|
||||
#, c-format
|
||||
msgid "Error restoring the O_APPEND flag to standard output: %s"
|
||||
msgstr "Errore nel ripristinare la flag O_APPEND sullo standard output: %s"
|
||||
|
||||
#: src/xz/file_io.c:726
|
||||
#: src/xz/file_io.c:908
|
||||
#, c-format
|
||||
msgid "%s: Closing the file failed: %s"
|
||||
msgstr "%s: chiusura del file non riuscita: %s"
|
||||
|
||||
#: src/xz/file_io.c:762 src/xz/file_io.c:946
|
||||
#: src/xz/file_io.c:944 src/xz/file_io.c:1170
|
||||
#, c-format
|
||||
msgid "%s: Seeking failed when trying to create a sparse file: %s"
|
||||
msgstr ""
|
||||
"%s: posizionamento non riuscito nel tentativo di creare un file sparso: %s"
|
||||
|
||||
#: src/xz/file_io.c:821
|
||||
#: src/xz/file_io.c:1039
|
||||
#, c-format
|
||||
msgid "%s: Read error: %s"
|
||||
msgstr "%s: errore di lettura: %s"
|
||||
|
||||
#: src/xz/file_io.c:844
|
||||
#: src/xz/file_io.c:1059
|
||||
#, c-format
|
||||
msgid "%s: Error seeking the file: %s"
|
||||
msgstr "%s: errore nel cercare il file: %s"
|
||||
|
||||
#: src/xz/file_io.c:854
|
||||
#: src/xz/file_io.c:1069
|
||||
#, c-format
|
||||
msgid "%s: Unexpected end of file"
|
||||
msgstr "%s: fine del file inaspettata"
|
||||
|
||||
#: src/xz/file_io.c:904
|
||||
#: src/xz/file_io.c:1128
|
||||
#, c-format
|
||||
msgid "%s: Write error: %s"
|
||||
msgstr "%s: errore di scrittura: %s"
|
||||
|
||||
#: src/xz/hardware.c:100
|
||||
#: src/xz/hardware.c:107
|
||||
msgid "Disabled"
|
||||
msgstr "Disabilitato"
|
||||
|
||||
#. TRANSLATORS: Test with "xz --info-memory" to see if
|
||||
#. the alignment looks nice.
|
||||
#: src/xz/hardware.c:119
|
||||
#: src/xz/hardware.c:126
|
||||
msgid "Total amount of physical memory (RAM): "
|
||||
msgstr "Quantità totale di memoria fisica (RAM): "
|
||||
|
||||
#: src/xz/hardware.c:121
|
||||
#: src/xz/hardware.c:128
|
||||
msgid "Memory usage limit for compression: "
|
||||
msgstr "Limite utilizzo memoria per la compressione: "
|
||||
|
||||
#: src/xz/hardware.c:123
|
||||
#: src/xz/hardware.c:130
|
||||
msgid "Memory usage limit for decompression: "
|
||||
msgstr "Limite utilizzo memoria per l'estrazione: "
|
||||
|
||||
#. TRANSLATORS: Indicates that there is no integrity check.
|
||||
#. This string is used in tables, so the width must not
|
||||
#. exceed ten columns with a fixed-width font.
|
||||
#: src/xz/list.c:62
|
||||
#: src/xz/list.c:65
|
||||
msgid "None"
|
||||
msgstr "Nessuno"
|
||||
|
||||
@@ -212,61 +287,61 @@ msgstr "Nessuno"
|
||||
#. but the Check ID is known (here 2). This and other "Unknown-N"
|
||||
#. strings are used in tables, so the width must not exceed ten
|
||||
#. columns with a fixed-width font. It's OK to omit the dash if
|
||||
#. you need space for one extra letter.
|
||||
#: src/xz/list.c:69
|
||||
#. you need space for one extra letter, but don't use spaces.
|
||||
#: src/xz/list.c:72
|
||||
msgid "Unknown-2"
|
||||
msgstr "Sconosc2"
|
||||
|
||||
#: src/xz/list.c:70
|
||||
#: src/xz/list.c:73
|
||||
msgid "Unknown-3"
|
||||
msgstr "Sconosc3"
|
||||
|
||||
#: src/xz/list.c:72
|
||||
#: src/xz/list.c:75
|
||||
msgid "Unknown-5"
|
||||
msgstr "Sconosc5"
|
||||
|
||||
#: src/xz/list.c:73
|
||||
#: src/xz/list.c:76
|
||||
msgid "Unknown-6"
|
||||
msgstr "Sconosc6"
|
||||
|
||||
#: src/xz/list.c:74
|
||||
#: src/xz/list.c:77
|
||||
msgid "Unknown-7"
|
||||
msgstr "Sconosc7"
|
||||
|
||||
#: src/xz/list.c:75
|
||||
#: src/xz/list.c:78
|
||||
msgid "Unknown-8"
|
||||
msgstr "Sconosc8"
|
||||
|
||||
#: src/xz/list.c:76
|
||||
#: src/xz/list.c:79
|
||||
msgid "Unknown-9"
|
||||
msgstr "Sconosc9"
|
||||
|
||||
#: src/xz/list.c:78
|
||||
#: src/xz/list.c:81
|
||||
msgid "Unknown-11"
|
||||
msgstr "Sconosc11"
|
||||
|
||||
#: src/xz/list.c:79
|
||||
#: src/xz/list.c:82
|
||||
msgid "Unknown-12"
|
||||
msgstr "Sconosc12"
|
||||
|
||||
#: src/xz/list.c:80
|
||||
#: src/xz/list.c:83
|
||||
msgid "Unknown-13"
|
||||
msgstr "Sconosc13"
|
||||
|
||||
#: src/xz/list.c:81
|
||||
#: src/xz/list.c:84
|
||||
msgid "Unknown-14"
|
||||
msgstr "Sconosc14"
|
||||
|
||||
#: src/xz/list.c:82
|
||||
#: src/xz/list.c:85
|
||||
msgid "Unknown-15"
|
||||
msgstr "Sconosc15"
|
||||
|
||||
#: src/xz/list.c:126
|
||||
#: src/xz/list.c:153
|
||||
#, c-format
|
||||
msgid "%s: File is empty"
|
||||
msgstr "%s: il file è vuoto"
|
||||
|
||||
#: src/xz/list.c:131
|
||||
#: src/xz/list.c:158
|
||||
#, c-format
|
||||
msgid "%s: Too small to be a valid .xz file"
|
||||
msgstr "%s: troppo piccolo per essere un file .xz valido"
|
||||
@@ -275,41 +350,41 @@ msgstr "%s: troppo piccolo per essere un file .xz valido"
|
||||
#. to Ratio, the columns are right aligned. Check and Filename
|
||||
#. are left aligned. If you need longer words, it's OK to
|
||||
#. use two lines here. Test with "xz -l foo.xz".
|
||||
#: src/xz/list.c:612
|
||||
#: src/xz/list.c:671
|
||||
msgid "Strms Blocks Compressed Uncompressed Ratio Check Filename"
|
||||
msgstr " Strm Blocc. Compresso Estratto Rapp. Contr Nome file"
|
||||
|
||||
#: src/xz/list.c:652
|
||||
#: src/xz/list.c:711
|
||||
#, c-format
|
||||
msgid " Streams: %s\n"
|
||||
msgstr " Stream: %s\n"
|
||||
|
||||
#: src/xz/list.c:654
|
||||
#: src/xz/list.c:713
|
||||
#, c-format
|
||||
msgid " Blocks: %s\n"
|
||||
msgstr " Blocchi: %s\n"
|
||||
|
||||
#: src/xz/list.c:656
|
||||
#: src/xz/list.c:715
|
||||
#, c-format
|
||||
msgid " Compressed size: %s\n"
|
||||
msgstr " Dim. compresso: %s\n"
|
||||
|
||||
#: src/xz/list.c:659
|
||||
#: src/xz/list.c:718
|
||||
#, c-format
|
||||
msgid " Uncompressed size: %s\n"
|
||||
msgstr " Dim. estratto: %s\n"
|
||||
|
||||
#: src/xz/list.c:662
|
||||
#: src/xz/list.c:721
|
||||
#, c-format
|
||||
msgid " Ratio: %s\n"
|
||||
msgstr " Rapporto: %s\n"
|
||||
|
||||
#: src/xz/list.c:664
|
||||
#: src/xz/list.c:723
|
||||
#, c-format
|
||||
msgid " Check: %s\n"
|
||||
msgstr " Controllo: %s\n"
|
||||
|
||||
#: src/xz/list.c:665
|
||||
#: src/xz/list.c:724
|
||||
#, c-format
|
||||
msgid " Stream padding: %s\n"
|
||||
msgstr " Padding dello stream: %s\n"
|
||||
@@ -317,7 +392,7 @@ msgstr " Padding dello stream: %s\n"
|
||||
#. TRANSLATORS: The second line is column headings. All except
|
||||
#. Check are right aligned; Check is left aligned. Test with
|
||||
#. "xz -lv foo.xz".
|
||||
#: src/xz/list.c:693
|
||||
#: src/xz/list.c:752
|
||||
msgid ""
|
||||
" Streams:\n"
|
||||
" Stream Blocks CompOffset UncompOffset CompSize "
|
||||
@@ -329,7 +404,7 @@ msgstr ""
|
||||
|
||||
#. TRANSLATORS: The second line is column headings. All
|
||||
#. except Check are right aligned; Check is left aligned.
|
||||
#: src/xz/list.c:748
|
||||
#: src/xz/list.c:807
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Blocks:\n"
|
||||
@@ -347,52 +422,57 @@ msgstr ""
|
||||
#. are right aligned. %*s is replaced with 0-120
|
||||
#. spaces to make the CheckVal column wide enough.
|
||||
#. Test with "xz -lvv foo.xz".
|
||||
#: src/xz/list.c:760
|
||||
#: src/xz/list.c:819
|
||||
#, c-format
|
||||
msgid " CheckVal %*s Header Flags CompSize MemUsage Filters"
|
||||
msgstr " Val.cont %*s Header Flag Dim.compr. Uso mem. Filtri"
|
||||
|
||||
#: src/xz/list.c:838 src/xz/list.c:1007
|
||||
#: src/xz/list.c:897 src/xz/list.c:1072
|
||||
#, c-format
|
||||
msgid " Memory needed: %s MiB\n"
|
||||
msgstr " Memoria necessaria: %s MiB\n"
|
||||
|
||||
#: src/xz/list.c:840 src/xz/list.c:1009
|
||||
#: src/xz/list.c:899 src/xz/list.c:1074
|
||||
#, c-format
|
||||
msgid " Sizes in headers: %s\n"
|
||||
msgstr " Dim. negli header: %s\n"
|
||||
|
||||
#: src/xz/list.c:841 src/xz/list.c:1010
|
||||
#: src/xz/list.c:900 src/xz/list.c:1075
|
||||
msgid "Yes"
|
||||
msgstr "Sì"
|
||||
|
||||
#: src/xz/list.c:841 src/xz/list.c:1010
|
||||
#: src/xz/list.c:900 src/xz/list.c:1075
|
||||
msgid "No"
|
||||
msgstr "No"
|
||||
|
||||
#: src/xz/list.c:901 src/xz/list.c:1076
|
||||
#, c-format
|
||||
msgid " Minimum XZ Utils version: %s\n"
|
||||
msgstr " Versione \"XZ Utils\" minima: %s\n"
|
||||
|
||||
#. TRANSLATORS: %s is an integer. Only the plural form of this
|
||||
#. message is used (e.g. "2 files"). Test with "xz -l foo.xz bar.xz".
|
||||
#: src/xz/list.c:986
|
||||
#: src/xz/list.c:1051
|
||||
#, c-format
|
||||
msgid "%s file\n"
|
||||
msgid_plural "%s files\n"
|
||||
msgstr[0] "%s file\n"
|
||||
msgstr[1] "%s file\n"
|
||||
|
||||
#: src/xz/list.c:999
|
||||
#: src/xz/list.c:1064
|
||||
msgid "Totals:"
|
||||
msgstr "Totali:"
|
||||
|
||||
#: src/xz/list.c:1000
|
||||
#: src/xz/list.c:1065
|
||||
#, c-format
|
||||
msgid " Number of files: %s\n"
|
||||
msgstr " Numero di file: %s\n"
|
||||
|
||||
#: src/xz/list.c:1072
|
||||
#: src/xz/list.c:1140
|
||||
msgid "--list works only on .xz files (--format=xz or --format=auto)"
|
||||
msgstr "--list funziona solamente con file .xz (--format=xz o --format=auto)"
|
||||
|
||||
#: src/xz/list.c:1078
|
||||
#: src/xz/list.c:1146
|
||||
msgid "--list does not support reading from standard input"
|
||||
msgstr "--list non è in grado di leggere dallo standard input"
|
||||
|
||||
@@ -427,61 +507,75 @@ msgstr ""
|
||||
"Impossibile leggere i dati dallo standard input durante la lettura dei nomi "
|
||||
"dei file dallo standard input"
|
||||
|
||||
#: src/xz/message.c:800 src/xz/message.c:844
|
||||
#. TRANSLATORS: This is the program name in the beginning
|
||||
#. of the line in messages. Usually it becomes "xz: ".
|
||||
#. This is a translatable string because French needs
|
||||
#. a space before a colon.
|
||||
#: src/xz/message.c:713
|
||||
#, c-format
|
||||
msgid "%s: "
|
||||
msgstr "%s: "
|
||||
|
||||
#: src/xz/message.c:776 src/xz/message.c:826
|
||||
msgid "Internal error (bug)"
|
||||
msgstr "Errore interno (bug)"
|
||||
|
||||
#: src/xz/message.c:807
|
||||
#: src/xz/message.c:783
|
||||
msgid "Cannot establish signal handlers"
|
||||
msgstr "Impossibile stabilire i gestori dei segnali"
|
||||
|
||||
#: src/xz/message.c:816
|
||||
#: src/xz/message.c:792
|
||||
msgid "No integrity check; not verifying file integrity"
|
||||
msgstr ""
|
||||
"Nessun controllo d'integrità; l'integrità del file non viene verificata"
|
||||
|
||||
#: src/xz/message.c:819
|
||||
#: src/xz/message.c:795
|
||||
msgid "Unsupported type of integrity check; not verifying file integrity"
|
||||
msgstr ""
|
||||
"Tipo di controllo di integrità non supportato; l'integrità del file non "
|
||||
"viene verificata"
|
||||
|
||||
#: src/xz/message.c:826
|
||||
#: src/xz/message.c:802
|
||||
msgid "Memory usage limit reached"
|
||||
msgstr "Limite di utilizzo della memoria raggiunto"
|
||||
|
||||
#: src/xz/message.c:829
|
||||
#: src/xz/message.c:805
|
||||
msgid "File format not recognized"
|
||||
msgstr "Formato di file non riconosciuto"
|
||||
|
||||
#: src/xz/message.c:832
|
||||
#: src/xz/message.c:808
|
||||
msgid "Unsupported options"
|
||||
msgstr "Opzioni non supportate"
|
||||
|
||||
#: src/xz/message.c:835
|
||||
#: src/xz/message.c:811
|
||||
msgid "Compressed data is corrupt"
|
||||
msgstr "I dati compressi sono danneggiati"
|
||||
|
||||
#: src/xz/message.c:838
|
||||
#: src/xz/message.c:814
|
||||
msgid "Unexpected end of input"
|
||||
msgstr "Fine dell'input non attesa"
|
||||
|
||||
#: src/xz/message.c:886
|
||||
#: src/xz/message.c:847
|
||||
#, c-format
|
||||
msgid "%s MiB of memory is required. The limiter is disabled."
|
||||
msgstr "%s MiB di memoria sono richiesti. Il limite è disabilitato."
|
||||
|
||||
#: src/xz/message.c:875
|
||||
#, c-format
|
||||
msgid "%s MiB of memory is required. The limit is %s."
|
||||
msgstr "%s MiB di memoria sono richiesti. Il limite è %s."
|
||||
|
||||
#: src/xz/message.c:1053
|
||||
#: src/xz/message.c:1042
|
||||
#, c-format
|
||||
msgid "%s: Filter chain: %s\n"
|
||||
msgstr "%s: catena di filtri: %s\n"
|
||||
|
||||
#: src/xz/message.c:1063
|
||||
#: src/xz/message.c:1052
|
||||
#, c-format
|
||||
msgid "Try `%s --help' for more information."
|
||||
msgstr "Provare \"%s --help\" per maggiori informazioni."
|
||||
|
||||
#: src/xz/message.c:1089
|
||||
#: src/xz/message.c:1078
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Usage: %s [OPTION]... [FILE]...\n"
|
||||
@@ -492,18 +586,18 @@ msgstr ""
|
||||
"Comprime o estrae i FILE nel formato .xz.\n"
|
||||
"\n"
|
||||
|
||||
#: src/xz/message.c:1096
|
||||
#: src/xz/message.c:1085
|
||||
msgid ""
|
||||
"Mandatory arguments to long options are mandatory for short options too.\n"
|
||||
msgstr ""
|
||||
"Gli argomenti obbligatori per le opzioni lunghe lo sono anche per quelle "
|
||||
"brevi.\n"
|
||||
|
||||
#: src/xz/message.c:1100
|
||||
#: src/xz/message.c:1089
|
||||
msgid " Operation mode:\n"
|
||||
msgstr " Modalità di operazione:\n"
|
||||
|
||||
#: src/xz/message.c:1103
|
||||
#: src/xz/message.c:1092
|
||||
msgid ""
|
||||
" -z, --compress force compression\n"
|
||||
" -d, --decompress force decompression\n"
|
||||
@@ -515,7 +609,7 @@ msgstr ""
|
||||
" -t, --test Verifica l'integrità dei file compressi\n"
|
||||
" -l, --list Elenca informazioni sui file .xz"
|
||||
|
||||
#: src/xz/message.c:1109
|
||||
#: src/xz/message.c:1098
|
||||
msgid ""
|
||||
"\n"
|
||||
" Operation modifiers:\n"
|
||||
@@ -523,7 +617,7 @@ msgstr ""
|
||||
"\n"
|
||||
" Modificatori di operazioni:\n"
|
||||
|
||||
#: src/xz/message.c:1112
|
||||
#: src/xz/message.c:1101
|
||||
msgid ""
|
||||
" -k, --keep keep (don't delete) input files\n"
|
||||
" -f, --force force overwrite of output file and (de)compress links\n"
|
||||
@@ -536,7 +630,15 @@ msgstr ""
|
||||
" -c, --stdout Scrive sullo standard output e non elimina i file di "
|
||||
"input"
|
||||
|
||||
#: src/xz/message.c:1118
|
||||
#: src/xz/message.c:1107
|
||||
msgid ""
|
||||
" --single-stream decompress only the first stream, and silently\n"
|
||||
" ignore possible remaining input data"
|
||||
msgstr ""
|
||||
" --single-stream Decomprime solamente il primo stream e ignora\n"
|
||||
" silenziosamente i restanti dati di input"
|
||||
|
||||
#: src/xz/message.c:1110
|
||||
msgid ""
|
||||
" --no-sparse do not create sparse files when decompressing\n"
|
||||
" -S, --suffix=.SUF use the suffix `.SUF' on compressed files\n"
|
||||
@@ -556,7 +658,7 @@ msgstr ""
|
||||
" di newline\n"
|
||||
" --files0=[FILE] Come --files ma usa il carattere null come terminatore"
|
||||
|
||||
#: src/xz/message.c:1126
|
||||
#: src/xz/message.c:1119
|
||||
msgid ""
|
||||
"\n"
|
||||
" Basic file format and compression options:\n"
|
||||
@@ -564,7 +666,7 @@ msgstr ""
|
||||
"\n"
|
||||
" Formato file di base e opzioni di compressione:\n"
|
||||
|
||||
#: src/xz/message.c:1128
|
||||
#: src/xz/message.c:1121
|
||||
msgid ""
|
||||
" -F, --format=FMT file format to encode or decode; possible values are\n"
|
||||
" `auto' (default), `xz', `lzma', and `raw'\n"
|
||||
@@ -579,12 +681,18 @@ msgstr ""
|
||||
"attenzione),\n"
|
||||
" \"crc32\", \"crc64\" (predefinito) o \"sha256\""
|
||||
|
||||
#: src/xz/message.c:1135
|
||||
#: src/xz/message.c:1126
|
||||
msgid ""
|
||||
" --ignore-check don't verify the integrity check when decompressing"
|
||||
msgstr ""
|
||||
" --ignore-check Non verifica il codice di integrità quando decomprime"
|
||||
|
||||
#: src/xz/message.c:1130
|
||||
msgid ""
|
||||
" -0 ... -9 compression preset; default is 6; take compressor "
|
||||
"*and*\n"
|
||||
" decompressor memory usage into account before using 7-"
|
||||
"9!"
|
||||
" decompressor memory usage into account before using "
|
||||
"7-9!"
|
||||
msgstr ""
|
||||
" -0 ... -9 Preset di compressione; predefinito è 6; tenere a "
|
||||
"mente\n"
|
||||
@@ -592,7 +700,7 @@ msgstr ""
|
||||
"prima\n"
|
||||
" di usare 7-9"
|
||||
|
||||
#: src/xz/message.c:1139
|
||||
#: src/xz/message.c:1134
|
||||
msgid ""
|
||||
" -e, --extreme try to improve compression ratio by using more CPU "
|
||||
"time;\n"
|
||||
@@ -603,7 +711,59 @@ msgstr ""
|
||||
"di\n"
|
||||
" memoria in fase di estrazione"
|
||||
|
||||
#: src/xz/message.c:1144
|
||||
#: src/xz/message.c:1138
|
||||
msgid ""
|
||||
" -T, --threads=NUM use at most NUM threads; the default is 1; set to 0\n"
|
||||
" to use as many threads as there are processor cores"
|
||||
msgstr ""
|
||||
" -T, --threads=NUM Usa al massimo NUM thread: il valore predefinito è 1,\n"
|
||||
" impostare a 0 per usare tanti thread quanti core la "
|
||||
"CPU\n"
|
||||
" ha a disposizione"
|
||||
|
||||
#: src/xz/message.c:1143
|
||||
msgid ""
|
||||
" --block-size=SIZE\n"
|
||||
" start a new .xz block after every SIZE bytes of "
|
||||
"input;\n"
|
||||
" use this to set the block size for threaded compression"
|
||||
msgstr ""
|
||||
" --block-size=DIM\n"
|
||||
" Avvia un nuovo blocco .xz dopo ogni DIM byte di "
|
||||
"input:\n"
|
||||
" usare per impostare la dimensione del blocco durante "
|
||||
"la\n"
|
||||
" compressione con thread"
|
||||
|
||||
#: src/xz/message.c:1147
|
||||
msgid ""
|
||||
" --block-list=SIZES\n"
|
||||
" start a new .xz block after the given comma-separated\n"
|
||||
" intervals of uncompressed data"
|
||||
msgstr ""
|
||||
" --block-list=DIM\n"
|
||||
" Avvia un nuovo blocco .xz dopo gli intervalli, "
|
||||
"sperati\n"
|
||||
" da virgole, di dati non compressi"
|
||||
|
||||
#: src/xz/message.c:1151
|
||||
msgid ""
|
||||
" --flush-timeout=TIMEOUT\n"
|
||||
" when compressing, if more than TIMEOUT milliseconds "
|
||||
"has\n"
|
||||
" passed since the previous flush and reading more "
|
||||
"input\n"
|
||||
" would block, all pending data is flushed out"
|
||||
msgstr ""
|
||||
" --flush-timeout=TIMEOUT\n"
|
||||
" Durante la compressione, se sono passati più di "
|
||||
"TIMEOUT\n"
|
||||
" millisecondi dal flush precedente e la lettura di\n"
|
||||
" ulteriore input risulterebbe bloccata, viene eseguito "
|
||||
"il\n"
|
||||
" flush di tutti i dati pendenti"
|
||||
|
||||
#: src/xz/message.c:1157
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
" --memlimit-compress=LIMIT\n"
|
||||
@@ -621,7 +781,7 @@ msgstr ""
|
||||
"byte,\n"
|
||||
" % della memoria RAM oppure 0 per il valore predefinito"
|
||||
|
||||
#: src/xz/message.c:1151
|
||||
#: src/xz/message.c:1164
|
||||
msgid ""
|
||||
" --no-adjust if compression settings exceed the memory usage "
|
||||
"limit,\n"
|
||||
@@ -633,7 +793,7 @@ msgstr ""
|
||||
" utilizzo della memoria, lancia un errore invece di\n"
|
||||
" utilizzare valori più piccoli"
|
||||
|
||||
#: src/xz/message.c:1157
|
||||
#: src/xz/message.c:1170
|
||||
msgid ""
|
||||
"\n"
|
||||
" Custom filter chain for compression (alternative for using presets):"
|
||||
@@ -642,7 +802,7 @@ msgstr ""
|
||||
" Catena di filtri personalizzati per la compressione (alternative per\n"
|
||||
" l'utilizzo di preset):"
|
||||
|
||||
#: src/xz/message.c:1166
|
||||
#: src/xz/message.c:1179
|
||||
msgid ""
|
||||
"\n"
|
||||
" --lzma1[=OPTS] LZMA1 or LZMA2; OPTS is a comma-separated list of zero "
|
||||
@@ -666,14 +826,14 @@ msgstr ""
|
||||
"zero\n"
|
||||
" --lzma2[=OPZ] o più delle seguenti opzioni (valori validi; "
|
||||
"predefinito):\n"
|
||||
" preset=NUM Reimposta le opzioni al preset NUM (0-9"
|
||||
"[e])\n"
|
||||
" preset=NUM Reimposta le opzioni al preset NUM "
|
||||
"(0-9[e])\n"
|
||||
" dict=NUM Dimensione del dizionario\n"
|
||||
" (4KiB - 1536MiB; 8MiB)\n"
|
||||
" lc=NUM Numero di bit letterali di contesto (0-4; "
|
||||
"3)\n"
|
||||
" lp=NUM Numero di bit letterali di posizione (0-"
|
||||
"4; 0)\n"
|
||||
" lp=NUM Numero di bit letterali di posizione "
|
||||
"(0-4; 0)\n"
|
||||
" pb=NUM Numero di bit di posizione (0-4; 2)\n"
|
||||
" mode=MODE Modalità di compressione\n"
|
||||
" (fast, normal; normal)\n"
|
||||
@@ -685,7 +845,7 @@ msgstr ""
|
||||
"0=automatica\n"
|
||||
" (predefinito)"
|
||||
|
||||
#: src/xz/message.c:1181
|
||||
#: src/xz/message.c:1194
|
||||
msgid ""
|
||||
"\n"
|
||||
" --x86[=OPTS] x86 BCJ filter (32-bit and 64-bit)\n"
|
||||
@@ -708,7 +868,7 @@ msgstr ""
|
||||
" start=NUM Offset iniziale per le conversioni\n"
|
||||
" (predefinito=0)"
|
||||
|
||||
#: src/xz/message.c:1193
|
||||
#: src/xz/message.c:1206
|
||||
msgid ""
|
||||
"\n"
|
||||
" --delta[=OPTS] Delta filter; valid OPTS (valid values; default):\n"
|
||||
@@ -720,7 +880,7 @@ msgstr ""
|
||||
" dist=NUM Distanza tra byte sottratti\n"
|
||||
" gli uni dagli altri (1-256; 1)"
|
||||
|
||||
#: src/xz/message.c:1201
|
||||
#: src/xz/message.c:1214
|
||||
msgid ""
|
||||
"\n"
|
||||
" Other options:\n"
|
||||
@@ -728,7 +888,7 @@ msgstr ""
|
||||
"\n"
|
||||
" Altre opzioni:\n"
|
||||
|
||||
#: src/xz/message.c:1204
|
||||
#: src/xz/message.c:1217
|
||||
msgid ""
|
||||
" -q, --quiet suppress warnings; specify twice to suppress errors "
|
||||
"too\n"
|
||||
@@ -741,16 +901,16 @@ msgstr ""
|
||||
"ancora\n"
|
||||
" più prolisso"
|
||||
|
||||
#: src/xz/message.c:1209
|
||||
#: src/xz/message.c:1222
|
||||
msgid " -Q, --no-warn make warnings not affect the exit status"
|
||||
msgstr " -Q, --no-warn Gli avvisi non influenzano lo stato d'uscita"
|
||||
|
||||
#: src/xz/message.c:1211
|
||||
#: src/xz/message.c:1224
|
||||
msgid ""
|
||||
" --robot use machine-parsable messages (useful for scripts)"
|
||||
msgstr " --robot Usa messaggi analizzabili (utile per gli script)"
|
||||
|
||||
#: src/xz/message.c:1214
|
||||
#: src/xz/message.c:1227
|
||||
msgid ""
|
||||
" --info-memory display the total amount of RAM and the currently "
|
||||
"active\n"
|
||||
@@ -760,7 +920,7 @@ msgstr ""
|
||||
"attuale\n"
|
||||
" attivo di utilizzo della memore ed esce"
|
||||
|
||||
#: src/xz/message.c:1217
|
||||
#: src/xz/message.c:1230
|
||||
msgid ""
|
||||
" -h, --help display the short help (lists only the basic options)\n"
|
||||
" -H, --long-help display this long help and exit"
|
||||
@@ -768,7 +928,7 @@ msgstr ""
|
||||
" -h, --help Stampa l'aiuto breve (elenca solo le opzioni di base)\n"
|
||||
" -H, --long-help Stampa questo lungo aiuto ed esce"
|
||||
|
||||
#: src/xz/message.c:1221
|
||||
#: src/xz/message.c:1234
|
||||
msgid ""
|
||||
" -h, --help display this short help and exit\n"
|
||||
" -H, --long-help display the long help (lists also the advanced options)"
|
||||
@@ -776,11 +936,11 @@ msgstr ""
|
||||
" -h, --help Stampa questo breve aiuto ed esce\n"
|
||||
" -H, --long-help Stampa l'aiuto lungo (elenca anche le opzioni avanzate)"
|
||||
|
||||
#: src/xz/message.c:1226
|
||||
#: src/xz/message.c:1239
|
||||
msgid " -V, --version display the version number and exit"
|
||||
msgstr " -V, --version Stampa il numero della versione ed esce"
|
||||
|
||||
#: src/xz/message.c:1228
|
||||
#: src/xz/message.c:1241
|
||||
msgid ""
|
||||
"\n"
|
||||
"With no FILE, or when FILE is -, read standard input.\n"
|
||||
@@ -792,18 +952,23 @@ msgstr ""
|
||||
#. for this package. Please add _another line_ saying
|
||||
#. "Report translation bugs to <...>\n" with the email or WWW
|
||||
#. address for translation bugs. Thanks.
|
||||
#: src/xz/message.c:1234
|
||||
#: src/xz/message.c:1247
|
||||
#, c-format
|
||||
msgid "Report bugs to <%s> (in English or Finnish).\n"
|
||||
msgstr ""
|
||||
"Segnalare i bug a <%s> (in inglese o finlandese).\n"
|
||||
"Segnalare i bug di traduzione a <tp@lists.linux.it>.\n"
|
||||
|
||||
#: src/xz/message.c:1236
|
||||
#: src/xz/message.c:1249
|
||||
#, c-format
|
||||
msgid "%s home page: <%s>\n"
|
||||
msgstr "Sito web di %s: <%s>\n"
|
||||
|
||||
#: src/xz/message.c:1253
|
||||
msgid "THIS IS A DEVELOPMENT VERSION NOT INTENDED FOR PRODUCTION USE."
|
||||
msgstr ""
|
||||
"Questa è una versione di sviluppo non adatta per utilizzi in produzione."
|
||||
|
||||
#: src/xz/options.c:86
|
||||
#, c-format
|
||||
msgid "%s: Options must be `name=value' pairs separated with commas"
|
||||
@@ -833,10 +998,10 @@ msgstr "La somma di lc e lp non deve superare 4"
|
||||
#, c-format
|
||||
msgid "The selected match finder requires at least nice=%<PRIu32>"
|
||||
msgstr ""
|
||||
"Lo strumento per cercare corrispondenze selezionato richiede almeno nice=%"
|
||||
"<PRIu32>"
|
||||
"Lo strumento per cercare corrispondenze selezionato richiede almeno nice="
|
||||
"%<PRIu32>"
|
||||
|
||||
#: src/xz/suffix.c:79 src/xz/suffix.c:164
|
||||
#: src/xz/suffix.c:133 src/xz/suffix.c:258
|
||||
#, c-format
|
||||
msgid ""
|
||||
"%s: With --format=raw, --suffix=.SUF is required unless writing to stdout"
|
||||
@@ -844,52 +1009,52 @@ msgstr ""
|
||||
"%s: con --format=raw, --suffix=.SUF è richiesto a meno che non si scriva "
|
||||
"sullo stdout"
|
||||
|
||||
#: src/xz/suffix.c:99
|
||||
#: src/xz/suffix.c:164
|
||||
#, c-format
|
||||
msgid "%s: Filename has an unknown suffix, skipping"
|
||||
msgstr "%s: il nome del file ha un suffisso sconosciuto, viene saltato"
|
||||
|
||||
#: src/xz/suffix.c:154
|
||||
#: src/xz/suffix.c:185
|
||||
#, c-format
|
||||
msgid "%s: File already has `%s' suffix, skipping"
|
||||
msgstr "%s: il file ha già il suffisso \"%s\", viene saltato"
|
||||
|
||||
#: src/xz/suffix.c:205
|
||||
#: src/xz/suffix.c:393
|
||||
#, c-format
|
||||
msgid "%s: Invalid filename suffix"
|
||||
msgstr "%s: suffisso del nome del file non valido"
|
||||
|
||||
#: src/xz/util.c:61
|
||||
#: src/xz/util.c:71
|
||||
#, c-format
|
||||
msgid "%s: Value is not a non-negative decimal integer"
|
||||
msgstr "%s: il valore non è un numero intero decimale non-negativo"
|
||||
|
||||
#: src/xz/util.c:103
|
||||
#: src/xz/util.c:113
|
||||
#, c-format
|
||||
msgid "%s: Invalid multiplier suffix"
|
||||
msgstr "%s: suffisso del moltiplicatore non valido"
|
||||
|
||||
#: src/xz/util.c:105
|
||||
#: src/xz/util.c:115
|
||||
msgid "Valid suffixes are `KiB' (2^10), `MiB' (2^20), and `GiB' (2^30)."
|
||||
msgstr ""
|
||||
"I suffissi validi sono \"KiB\" (2^10), \"MiB\" (2^20), e \"GiB\" (2^30)."
|
||||
|
||||
#: src/xz/util.c:122
|
||||
#: src/xz/util.c:132
|
||||
#, c-format
|
||||
msgid "Value of the option `%s' must be in the range [%<PRIu64>, %<PRIu64>]"
|
||||
msgstr ""
|
||||
"Il valore dell'opzione \"%s\" deve essere nell'intervallo [%<PRIu64>, %"
|
||||
"<PRIu64>]"
|
||||
"Il valore dell'opzione \"%s\" deve essere nell'intervallo [%<PRIu64>, "
|
||||
"%<PRIu64>]"
|
||||
|
||||
#: src/xz/util.c:247
|
||||
#: src/xz/util.c:257
|
||||
msgid "Empty filename, skipping"
|
||||
msgstr "Nome file vuoto, viene saltato"
|
||||
|
||||
#: src/xz/util.c:261
|
||||
#: src/xz/util.c:271
|
||||
msgid "Compressed data cannot be read from a terminal"
|
||||
msgstr "I dati compressi non possono essere letti da un terminale"
|
||||
|
||||
#: src/xz/util.c:274
|
||||
#: src/xz/util.c:284
|
||||
msgid "Compressed data cannot be written to a terminal"
|
||||
msgstr "I dati compressi non possono essere scritti ad un terminale"
|
||||
|
||||
|
||||
389
po/pl.po
389
po/pl.po
@@ -1,13 +1,13 @@
|
||||
# Polish translation for xz.
|
||||
# This file is in the public domain.
|
||||
# Jakub Bogusz <qboosh@pld-linux.org>, 2011.
|
||||
# Jakub Bogusz <qboosh@pld-linux.org>, 2011-2014.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: xz 5.0.1\n"
|
||||
"Project-Id-Version: xz 5.1.4\n"
|
||||
"Report-Msgid-Bugs-To: lasse.collin@tukaani.org\n"
|
||||
"POT-Creation-Date: 2011-01-28 20:01+0200\n"
|
||||
"PO-Revision-Date: 2011-02-02 16:51+0100\n"
|
||||
"POT-Creation-Date: 2014-09-14 21:56+0300\n"
|
||||
"PO-Revision-Date: 2014-10-15 20:53+0200\n"
|
||||
"Last-Translator: Jakub Bogusz <qboosh@pld-linux.org>\n"
|
||||
"Language-Team: Polish <translation-team-pl@lists.sourceforge.net>\n"
|
||||
"Language: pl\n"
|
||||
@@ -16,63 +16,105 @@ msgstr ""
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
|
||||
|
||||
#: src/xz/args.c:333
|
||||
#: src/xz/args.c:63
|
||||
#, c-format
|
||||
msgid "%s: Invalid argument to --block-list"
|
||||
msgstr "%s: Błędny argument dla --block-list"
|
||||
|
||||
#: src/xz/args.c:73
|
||||
#, c-format
|
||||
msgid "%s: Too many arguments to --block-list"
|
||||
msgstr "%s: Zbyt dużo argumentów dla --block-list"
|
||||
|
||||
#: src/xz/args.c:102
|
||||
msgid "0 can only be used as the last element in --block-list"
|
||||
msgstr "0 w --block-list może być użyte wyłącznie jako ostatni element"
|
||||
|
||||
#: src/xz/args.c:406
|
||||
#, c-format
|
||||
msgid "%s: Unknown file format type"
|
||||
msgstr "%s: Nieznany typ formatu pliku"
|
||||
|
||||
#: src/xz/args.c:356 src/xz/args.c:364
|
||||
#: src/xz/args.c:429 src/xz/args.c:437
|
||||
#, c-format
|
||||
msgid "%s: Unsupported integrity check type"
|
||||
msgstr "%s: Nieobsługiwany typ kontroli spójności"
|
||||
|
||||
#: src/xz/args.c:382
|
||||
#: src/xz/args.c:473
|
||||
msgid "Only one file can be specified with `--files' or `--files0'."
|
||||
msgstr "Wraz z opcją `--files' lub `--files0' można podać tylko jeden plik."
|
||||
|
||||
#: src/xz/args.c:445
|
||||
#: src/xz/args.c:541
|
||||
#, c-format
|
||||
msgid "The environment variable %s contains too many arguments"
|
||||
msgstr "Zmienna środowiskowa %s zawiera zbyt dużo argumentów"
|
||||
|
||||
#: src/xz/coder.c:95
|
||||
#: src/xz/coder.c:110
|
||||
msgid "Maximum number of filters is four"
|
||||
msgstr "Maksymalna liczba filtrów to cztery"
|
||||
|
||||
#: src/xz/coder.c:108
|
||||
#: src/xz/coder.c:129
|
||||
msgid "Memory usage limit is too low for the given filter setup."
|
||||
msgstr "Limit użycia pamięci jest zbyt mały dla podanej konfiguracji filtra."
|
||||
|
||||
#: src/xz/coder.c:129
|
||||
#: src/xz/coder.c:159
|
||||
msgid "Using a preset in raw mode is discouraged."
|
||||
msgstr "Użycie ustawień predefiniowanych w trybie surowym jest odradzane."
|
||||
|
||||
#: src/xz/coder.c:131
|
||||
#: src/xz/coder.c:161
|
||||
msgid "The exact options of the presets may vary between software versions."
|
||||
msgstr "Dokładne opcje ustawień predefiniowanych mogą różnić się między wersjami oprogramowania."
|
||||
|
||||
#: src/xz/coder.c:157
|
||||
#: src/xz/coder.c:184
|
||||
msgid "The .lzma format supports only the LZMA1 filter"
|
||||
msgstr "Format .lzma obsługuje tylko filtr LZMA1"
|
||||
|
||||
#: src/xz/coder.c:165
|
||||
#: src/xz/coder.c:192
|
||||
msgid "LZMA1 cannot be used with the .xz format"
|
||||
msgstr "LZMA1 nie może być używany z formatem .xz"
|
||||
|
||||
#: src/xz/coder.c:182
|
||||
#: src/xz/coder.c:209
|
||||
msgid "The filter chain is incompatible with --flush-timeout"
|
||||
msgstr "Łańcuch filtrów jest niezgodny z --flush-timeout"
|
||||
|
||||
#: src/xz/coder.c:215
|
||||
msgid "Switching to single-threaded mode due to --flush-timeout"
|
||||
msgstr "Przełączanie w tryb jednowątkowy z powodu --flush-timeout"
|
||||
|
||||
#: src/xz/coder.c:234
|
||||
#, c-format
|
||||
msgid "Using up to %<PRIu32> threads."
|
||||
msgstr "Maksymalna liczba używanych wątków: %<PRIu32>."
|
||||
|
||||
#: src/xz/coder.c:247
|
||||
msgid "Unsupported filter chain or filter options"
|
||||
msgstr "Nieobsługiwany łańcuch filtrów lub opcje filtra"
|
||||
|
||||
#: src/xz/coder.c:190
|
||||
#: src/xz/coder.c:255
|
||||
#, c-format
|
||||
msgid "Decompression will need %s MiB of memory."
|
||||
msgstr "Dekompresja będzie wymagała %s MiB pamięci."
|
||||
|
||||
#: src/xz/coder.c:247
|
||||
#: src/xz/coder.c:290
|
||||
#, c-format
|
||||
msgid "Adjusted the number of threads from %s to %s to not exceed the memory usage limit of %s MiB"
|
||||
msgstr "Skorygowano liczbę wątków z %s do %s, aby nie przekroczyć limitu użycia pamięci %s MiB"
|
||||
|
||||
#: src/xz/coder.c:344
|
||||
#, c-format
|
||||
msgid "Adjusted LZMA%c dictionary size from %s MiB to %s MiB to not exceed the memory usage limit of %s MiB"
|
||||
msgstr "Skorygowano rozmiar słownika LZMA%c z %s MiB do %s MiB aby nie przekroczyć limitu użycia pamięci %s MiB"
|
||||
|
||||
#: src/xz/file_io.c:90
|
||||
#, c-format
|
||||
msgid "Error creating a pipe: %s"
|
||||
msgstr "Błąd tworzenia potoku: %s"
|
||||
|
||||
#: src/xz/file_io.c:166
|
||||
#, c-format
|
||||
msgid "%s: poll() failed: %s"
|
||||
msgstr "%s: poll() nie powiodło się: %s"
|
||||
|
||||
#. TRANSLATORS: When compression or decompression finishes,
|
||||
#. and xz is going to remove the source file, xz first checks
|
||||
#. if the source file still exists, and if it does, does its
|
||||
@@ -83,118 +125,143 @@ msgstr "Skorygowano rozmiar słownika LZMA%c z %s MiB do %s MiB aby nie przekroc
|
||||
#. it is possible that the user has put a new file in place
|
||||
#. of the original file, and in that case it obviously
|
||||
#. shouldn't be removed.
|
||||
#: src/xz/file_io.c:137
|
||||
#: src/xz/file_io.c:236
|
||||
#, c-format
|
||||
msgid "%s: File seems to have been moved, not removing"
|
||||
msgstr "%s: Plik wygląda na przeniesiony, nie zostanie usunięty"
|
||||
|
||||
#: src/xz/file_io.c:144 src/xz/file_io.c:589
|
||||
#: src/xz/file_io.c:243 src/xz/file_io.c:761
|
||||
#, c-format
|
||||
msgid "%s: Cannot remove: %s"
|
||||
msgstr "%s: Nie można usunąć: %s"
|
||||
|
||||
#: src/xz/file_io.c:169
|
||||
#: src/xz/file_io.c:268
|
||||
#, c-format
|
||||
msgid "%s: Cannot set the file owner: %s"
|
||||
msgstr "%s: Nie można ustawić właściciela pliku: %s"
|
||||
|
||||
#: src/xz/file_io.c:175
|
||||
#: src/xz/file_io.c:274
|
||||
#, c-format
|
||||
msgid "%s: Cannot set the file group: %s"
|
||||
msgstr "%s: Nie można ustawić grupy pliku: %s"
|
||||
|
||||
#: src/xz/file_io.c:194
|
||||
#: src/xz/file_io.c:293
|
||||
#, c-format
|
||||
msgid "%s: Cannot set the file permissions: %s"
|
||||
msgstr "%s: Nie można ustawić uprawnień pliku: %s"
|
||||
|
||||
#: src/xz/file_io.c:337 src/xz/file_io.c:420
|
||||
#: src/xz/file_io.c:399
|
||||
#, c-format
|
||||
msgid "Error getting the file status flags from standard input: %s"
|
||||
msgstr "Błąd podczas pobierania flag stanu pliku ze standardowego wejścia: %s"
|
||||
|
||||
#: src/xz/file_io.c:408
|
||||
#, c-format
|
||||
msgid "Error setting O_NONBLOCK on standard input: %s"
|
||||
msgstr "Błąd podczas ustawiania O_NONBLOCK dla standardowego wejścia: %s"
|
||||
|
||||
#: src/xz/file_io.c:460 src/xz/file_io.c:522
|
||||
#, c-format
|
||||
msgid "%s: Is a symbolic link, skipping"
|
||||
msgstr "%s: Jest dowiązaniem symbolicznym, pominięto"
|
||||
|
||||
#: src/xz/file_io.c:455
|
||||
#: src/xz/file_io.c:551
|
||||
#, c-format
|
||||
msgid "%s: Is a directory, skipping"
|
||||
msgstr "%s: Jest katalogiem, pominięto"
|
||||
|
||||
#: src/xz/file_io.c:461
|
||||
#: src/xz/file_io.c:557
|
||||
#, c-format
|
||||
msgid "%s: Not a regular file, skipping"
|
||||
msgstr "%s: Nie jest zwykłym plikiem, pominięto"
|
||||
|
||||
#: src/xz/file_io.c:478
|
||||
#: src/xz/file_io.c:574
|
||||
#, c-format
|
||||
msgid "%s: File has setuid or setgid bit set, skipping"
|
||||
msgstr "%s: Plik ma ustawiony bit setuid lub setgid, pominięto"
|
||||
|
||||
#: src/xz/file_io.c:485
|
||||
#: src/xz/file_io.c:581
|
||||
#, c-format
|
||||
msgid "%s: File has sticky bit set, skipping"
|
||||
msgstr "%s: Plik ma ustawiony bit sticky, pominięto"
|
||||
|
||||
#: src/xz/file_io.c:492
|
||||
#: src/xz/file_io.c:588
|
||||
#, c-format
|
||||
msgid "%s: Input file has more than one hard link, skipping"
|
||||
msgstr "%s: Plik wejściowy ma więcej niż jedno dowiązanie zwykłe, pominięto"
|
||||
|
||||
#: src/xz/file_io.c:713
|
||||
#: src/xz/file_io.c:668
|
||||
#, c-format
|
||||
msgid "Error restoring the status flags to standard input: %s"
|
||||
msgstr "Błąd podczas odtwarzania flag stanu dla standardowego wejścia: %s"
|
||||
|
||||
#: src/xz/file_io.c:714
|
||||
#, c-format
|
||||
msgid "Error getting the file status flags from standard output: %s"
|
||||
msgstr "Błąd podczas pobierania flag stanu pliku ze standardowego wyjścia: %s"
|
||||
|
||||
#: src/xz/file_io.c:723
|
||||
#, c-format
|
||||
msgid "Error setting O_NONBLOCK on standard output: %s"
|
||||
msgstr "Błąd podczas ustawiania O_NONBLOCK dla standardowego wyjścia: %s"
|
||||
|
||||
#: src/xz/file_io.c:896
|
||||
#, c-format
|
||||
msgid "Error restoring the O_APPEND flag to standard output: %s"
|
||||
msgstr "Błąd podczas odtwarzania flagi O_APPEND dla standardowego wyjścia: %s"
|
||||
|
||||
#: src/xz/file_io.c:725
|
||||
#: src/xz/file_io.c:908
|
||||
#, c-format
|
||||
msgid "%s: Closing the file failed: %s"
|
||||
msgstr "%s: Zamknięcie pliku nie powiodło się: %s"
|
||||
|
||||
#: src/xz/file_io.c:761 src/xz/file_io.c:945
|
||||
#: src/xz/file_io.c:944 src/xz/file_io.c:1170
|
||||
#, c-format
|
||||
msgid "%s: Seeking failed when trying to create a sparse file: %s"
|
||||
msgstr "%s: Zmiana pozycji nie powiodła się podczas próby utworzenia pliku rzadkiego: %s"
|
||||
|
||||
#: src/xz/file_io.c:820
|
||||
#: src/xz/file_io.c:1039
|
||||
#, c-format
|
||||
msgid "%s: Read error: %s"
|
||||
msgstr "%s: Błąd odczytu: %s"
|
||||
|
||||
#: src/xz/file_io.c:843
|
||||
#: src/xz/file_io.c:1059
|
||||
#, c-format
|
||||
msgid "%s: Error seeking the file: %s"
|
||||
msgstr "%s: Błąd podczas zmiany pozycji w pliku: %s"
|
||||
|
||||
#: src/xz/file_io.c:853
|
||||
#: src/xz/file_io.c:1069
|
||||
#, c-format
|
||||
msgid "%s: Unexpected end of file"
|
||||
msgstr "%s: Nieoczekiwany koniec pliku"
|
||||
|
||||
#: src/xz/file_io.c:903
|
||||
#: src/xz/file_io.c:1128
|
||||
#, c-format
|
||||
msgid "%s: Write error: %s"
|
||||
msgstr "%s: Błąd zapisu: %s"
|
||||
|
||||
#: src/xz/hardware.c:100
|
||||
#: src/xz/hardware.c:107
|
||||
msgid "Disabled"
|
||||
msgstr "Wyłączony"
|
||||
|
||||
#. TRANSLATORS: Test with "xz --info-memory" to see if
|
||||
#. the alignment looks nice.
|
||||
#: src/xz/hardware.c:119
|
||||
#: src/xz/hardware.c:126
|
||||
msgid "Total amount of physical memory (RAM): "
|
||||
msgstr "Całkowita ilość pamięci fizycznej (RAM): "
|
||||
|
||||
#: src/xz/hardware.c:121
|
||||
#: src/xz/hardware.c:128
|
||||
msgid "Memory usage limit for compression: "
|
||||
msgstr "Limit użycia pamięci dla kompresji: "
|
||||
|
||||
#: src/xz/hardware.c:123
|
||||
#: src/xz/hardware.c:130
|
||||
msgid "Memory usage limit for decompression: "
|
||||
msgstr "Limit użycia pamięci dla dekompresji: "
|
||||
|
||||
#. TRANSLATORS: Indicates that there is no integrity check.
|
||||
#. This string is used in tables, so the width must not
|
||||
#. exceed ten columns with a fixed-width font.
|
||||
#: src/xz/list.c:62
|
||||
#: src/xz/list.c:65
|
||||
msgid "None"
|
||||
msgstr "Brak"
|
||||
|
||||
@@ -203,60 +270,60 @@ msgstr "Brak"
|
||||
#. strings are used in tables, so the width must not exceed ten
|
||||
#. columns with a fixed-width font. It's OK to omit the dash if
|
||||
#. you need space for one extra letter, but don't use spaces.
|
||||
#: src/xz/list.c:69
|
||||
#: src/xz/list.c:72
|
||||
msgid "Unknown-2"
|
||||
msgstr "Nieznany-2"
|
||||
|
||||
#: src/xz/list.c:70
|
||||
#: src/xz/list.c:73
|
||||
msgid "Unknown-3"
|
||||
msgstr "Nieznany-3"
|
||||
|
||||
#: src/xz/list.c:72
|
||||
#: src/xz/list.c:75
|
||||
msgid "Unknown-5"
|
||||
msgstr "Nieznany-5"
|
||||
|
||||
#: src/xz/list.c:73
|
||||
#: src/xz/list.c:76
|
||||
msgid "Unknown-6"
|
||||
msgstr "Nieznany-6"
|
||||
|
||||
#: src/xz/list.c:74
|
||||
#: src/xz/list.c:77
|
||||
msgid "Unknown-7"
|
||||
msgstr "Nieznany-7"
|
||||
|
||||
#: src/xz/list.c:75
|
||||
#: src/xz/list.c:78
|
||||
msgid "Unknown-8"
|
||||
msgstr "Nieznany-8"
|
||||
|
||||
#: src/xz/list.c:76
|
||||
#: src/xz/list.c:79
|
||||
msgid "Unknown-9"
|
||||
msgstr "Nieznany-9"
|
||||
|
||||
#: src/xz/list.c:78
|
||||
#: src/xz/list.c:81
|
||||
msgid "Unknown-11"
|
||||
msgstr "Nieznany11"
|
||||
|
||||
#: src/xz/list.c:79
|
||||
#: src/xz/list.c:82
|
||||
msgid "Unknown-12"
|
||||
msgstr "Nieznany12"
|
||||
|
||||
#: src/xz/list.c:80
|
||||
#: src/xz/list.c:83
|
||||
msgid "Unknown-13"
|
||||
msgstr "Nieznany13"
|
||||
|
||||
#: src/xz/list.c:81
|
||||
#: src/xz/list.c:84
|
||||
msgid "Unknown-14"
|
||||
msgstr "Nieznany14"
|
||||
|
||||
#: src/xz/list.c:82
|
||||
#: src/xz/list.c:85
|
||||
msgid "Unknown-15"
|
||||
msgstr "Nieznany15"
|
||||
|
||||
#: src/xz/list.c:126
|
||||
#: src/xz/list.c:153
|
||||
#, c-format
|
||||
msgid "%s: File is empty"
|
||||
msgstr "%s: Plik jest pusty"
|
||||
|
||||
#: src/xz/list.c:131
|
||||
#: src/xz/list.c:158
|
||||
#, c-format
|
||||
msgid "%s: Too small to be a valid .xz file"
|
||||
msgstr "%s: Za mały na poprawny plik .xz"
|
||||
@@ -265,41 +332,41 @@ msgstr "%s: Za mały na poprawny plik .xz"
|
||||
#. to Ratio, the columns are right aligned. Check and Filename
|
||||
#. are left aligned. If you need longer words, it's OK to
|
||||
#. use two lines here. Test with "xz -l foo.xz".
|
||||
#: src/xz/list.c:612
|
||||
#: src/xz/list.c:671
|
||||
msgid "Strms Blocks Compressed Uncompressed Ratio Check Filename"
|
||||
msgstr "Strum. Bloki Spakowany Rozpakowany Wsp. Kontrola Nazwa pliku"
|
||||
|
||||
#: src/xz/list.c:652
|
||||
#: src/xz/list.c:711
|
||||
#, c-format
|
||||
msgid " Streams: %s\n"
|
||||
msgstr " Strumienie: %s\n"
|
||||
|
||||
#: src/xz/list.c:654
|
||||
#: src/xz/list.c:713
|
||||
#, c-format
|
||||
msgid " Blocks: %s\n"
|
||||
msgstr " Bloki: %s\n"
|
||||
|
||||
#: src/xz/list.c:656
|
||||
#: src/xz/list.c:715
|
||||
#, c-format
|
||||
msgid " Compressed size: %s\n"
|
||||
msgstr " Rozmiar spakowany: %s\n"
|
||||
|
||||
#: src/xz/list.c:659
|
||||
#: src/xz/list.c:718
|
||||
#, c-format
|
||||
msgid " Uncompressed size: %s\n"
|
||||
msgstr " Rozmiar rozpakowany: %s\n"
|
||||
|
||||
#: src/xz/list.c:662
|
||||
#: src/xz/list.c:721
|
||||
#, c-format
|
||||
msgid " Ratio: %s\n"
|
||||
msgstr " Współczynnik: %s\n"
|
||||
|
||||
#: src/xz/list.c:664
|
||||
#: src/xz/list.c:723
|
||||
#, c-format
|
||||
msgid " Check: %s\n"
|
||||
msgstr " Kontrola spójności: %s\n"
|
||||
|
||||
#: src/xz/list.c:665
|
||||
#: src/xz/list.c:724
|
||||
#, c-format
|
||||
msgid " Stream padding: %s\n"
|
||||
msgstr " Wyrównanie strumienia: %s\n"
|
||||
@@ -307,7 +374,7 @@ msgstr " Wyrównanie strumienia: %s\n"
|
||||
#. TRANSLATORS: The second line is column headings. All except
|
||||
#. Check are right aligned; Check is left aligned. Test with
|
||||
#. "xz -lv foo.xz".
|
||||
#: src/xz/list.c:693
|
||||
#: src/xz/list.c:752
|
||||
msgid ""
|
||||
" Streams:\n"
|
||||
" Stream Blocks CompOffset UncompOffset CompSize UncompSize Ratio Check Padding"
|
||||
@@ -317,7 +384,7 @@ msgstr ""
|
||||
|
||||
#. TRANSLATORS: The second line is column headings. All
|
||||
#. except Check are right aligned; Check is left aligned.
|
||||
#: src/xz/list.c:748
|
||||
#: src/xz/list.c:807
|
||||
#, c-format
|
||||
msgid ""
|
||||
" Blocks:\n"
|
||||
@@ -333,32 +400,37 @@ msgstr ""
|
||||
#. are right aligned. %*s is replaced with 0-120
|
||||
#. spaces to make the CheckVal column wide enough.
|
||||
#. Test with "xz -lvv foo.xz".
|
||||
#: src/xz/list.c:760
|
||||
#: src/xz/list.c:819
|
||||
#, c-format
|
||||
msgid " CheckVal %*s Header Flags CompSize MemUsage Filters"
|
||||
msgstr " S.kontr. %*sNagłówek Flagi Rozm. spak. Uż.pamięci Filtry"
|
||||
|
||||
#: src/xz/list.c:838 src/xz/list.c:1007
|
||||
#: src/xz/list.c:897 src/xz/list.c:1072
|
||||
#, c-format
|
||||
msgid " Memory needed: %s MiB\n"
|
||||
msgstr " Wymagana pamięć: %s MiB\n"
|
||||
|
||||
#: src/xz/list.c:840 src/xz/list.c:1009
|
||||
#: src/xz/list.c:899 src/xz/list.c:1074
|
||||
#, c-format
|
||||
msgid " Sizes in headers: %s\n"
|
||||
msgstr " Rozmiar w nagłówkach: %s\n"
|
||||
|
||||
#: src/xz/list.c:841 src/xz/list.c:1010
|
||||
#: src/xz/list.c:900 src/xz/list.c:1075
|
||||
msgid "Yes"
|
||||
msgstr "Tak"
|
||||
|
||||
#: src/xz/list.c:841 src/xz/list.c:1010
|
||||
#: src/xz/list.c:900 src/xz/list.c:1075
|
||||
msgid "No"
|
||||
msgstr "Nie"
|
||||
|
||||
#: src/xz/list.c:901 src/xz/list.c:1076
|
||||
#, c-format
|
||||
msgid " Minimum XZ Utils version: %s\n"
|
||||
msgstr " Minimalna wersja XZ Utils: %s\n"
|
||||
|
||||
#. TRANSLATORS: %s is an integer. Only the plural form of this
|
||||
#. message is used (e.g. "2 files"). Test with "xz -l foo.xz bar.xz".
|
||||
#: src/xz/list.c:986
|
||||
#: src/xz/list.c:1051
|
||||
#, c-format
|
||||
msgid "%s file\n"
|
||||
msgid_plural "%s files\n"
|
||||
@@ -366,20 +438,20 @@ msgstr[0] "%s plik\n"
|
||||
msgstr[1] "%s pliki\n"
|
||||
msgstr[2] "%s plików\n"
|
||||
|
||||
#: src/xz/list.c:999
|
||||
#: src/xz/list.c:1064
|
||||
msgid "Totals:"
|
||||
msgstr "Sumarycznie:"
|
||||
|
||||
#: src/xz/list.c:1000
|
||||
#: src/xz/list.c:1065
|
||||
#, c-format
|
||||
msgid " Number of files: %s\n"
|
||||
msgstr " Liczba plików: %s\n"
|
||||
|
||||
#: src/xz/list.c:1072
|
||||
#: src/xz/list.c:1140
|
||||
msgid "--list works only on .xz files (--format=xz or --format=auto)"
|
||||
msgstr "--list działa tylko z plikami .xz (--format=xz lub --format=auto)"
|
||||
|
||||
#: src/xz/list.c:1078
|
||||
#: src/xz/list.c:1146
|
||||
msgid "--list does not support reading from standard input"
|
||||
msgstr "--list nie obsługuje odczytu ze standardowego wejścia"
|
||||
|
||||
@@ -406,58 +478,72 @@ msgstr "Kompresja i dekompresja z opcją --robot nie jest jeszcze obsługiwana."
|
||||
msgid "Cannot read data from standard input when reading filenames from standard input"
|
||||
msgstr "Nie można odczytać danych ze standardowego wejścia przy czytaniu nazw plików ze standardowego wejścia"
|
||||
|
||||
#: src/xz/message.c:792 src/xz/message.c:842
|
||||
#. TRANSLATORS: This is the program name in the beginning
|
||||
#. of the line in messages. Usually it becomes "xz: ".
|
||||
#. This is a translatable string because French needs
|
||||
#. a space before a colon.
|
||||
#: src/xz/message.c:713
|
||||
#, c-format
|
||||
msgid "%s: "
|
||||
msgstr "%s: "
|
||||
|
||||
#: src/xz/message.c:776 src/xz/message.c:826
|
||||
msgid "Internal error (bug)"
|
||||
msgstr "Błąd wewnętrzny"
|
||||
|
||||
#: src/xz/message.c:799
|
||||
#: src/xz/message.c:783
|
||||
msgid "Cannot establish signal handlers"
|
||||
msgstr "Nie można ustawić obsługi sygnałów"
|
||||
|
||||
#: src/xz/message.c:808
|
||||
#: src/xz/message.c:792
|
||||
msgid "No integrity check; not verifying file integrity"
|
||||
msgstr "Brak kontroli spójności; poprawność plików nie będzie weryfikowana"
|
||||
|
||||
#: src/xz/message.c:811
|
||||
#: src/xz/message.c:795
|
||||
msgid "Unsupported type of integrity check; not verifying file integrity"
|
||||
msgstr "Nieobsługiwany typ kontroli spójności; poprawność plików nie będzie weryfikowana"
|
||||
|
||||
#: src/xz/message.c:818
|
||||
#: src/xz/message.c:802
|
||||
msgid "Memory usage limit reached"
|
||||
msgstr "Osiągnięto limit użycia pamięci"
|
||||
|
||||
#: src/xz/message.c:821
|
||||
#: src/xz/message.c:805
|
||||
msgid "File format not recognized"
|
||||
msgstr "Nie rozpoznany format pliku"
|
||||
|
||||
#: src/xz/message.c:824
|
||||
#: src/xz/message.c:808
|
||||
msgid "Unsupported options"
|
||||
msgstr "Nieobsługiwane opcje"
|
||||
|
||||
#: src/xz/message.c:827
|
||||
#: src/xz/message.c:811
|
||||
msgid "Compressed data is corrupt"
|
||||
msgstr "Dane skompresowane są uszkodzone"
|
||||
|
||||
#: src/xz/message.c:830
|
||||
#: src/xz/message.c:814
|
||||
msgid "Unexpected end of input"
|
||||
msgstr "Nieoczekiwany koniec wejścia"
|
||||
|
||||
#: src/xz/message.c:881
|
||||
#: src/xz/message.c:847
|
||||
#, c-format
|
||||
msgid "%s MiB of memory is required. The limiter is disabled."
|
||||
msgstr "Wymagane jest %s MiB pamięci. Limit jest wyłączony."
|
||||
|
||||
#: src/xz/message.c:875
|
||||
#, c-format
|
||||
msgid "%s MiB of memory is required. The limit is %s."
|
||||
msgstr "Wymagane jest %s MiB pamięci. Limit to %s."
|
||||
|
||||
#: src/xz/message.c:1048
|
||||
#: src/xz/message.c:1042
|
||||
#, c-format
|
||||
msgid "%s: Filter chain: %s\n"
|
||||
msgstr "%s: Łańcuch filtrów: %s\n"
|
||||
|
||||
#: src/xz/message.c:1058
|
||||
#: src/xz/message.c:1052
|
||||
#, c-format
|
||||
msgid "Try `%s --help' for more information."
|
||||
msgstr "Polecenie `%s --help' pokaże więcej informacji."
|
||||
|
||||
#: src/xz/message.c:1084
|
||||
#: src/xz/message.c:1078
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Usage: %s [OPTION]... [FILE]...\n"
|
||||
@@ -468,17 +554,17 @@ msgstr ""
|
||||
"Kompresja lub dekompresja PLIKÓW w formacie .xz.\n"
|
||||
"\n"
|
||||
|
||||
#: src/xz/message.c:1091
|
||||
#: src/xz/message.c:1085
|
||||
msgid "Mandatory arguments to long options are mandatory for short options too.\n"
|
||||
msgstr ""
|
||||
"Argumenty obowiązkowe dla opcji długich są obowiązkowe również dla opcji\n"
|
||||
"krótkich.\n"
|
||||
|
||||
#: src/xz/message.c:1095
|
||||
#: src/xz/message.c:1089
|
||||
msgid " Operation mode:\n"
|
||||
msgstr " Tryb pracy:\n"
|
||||
|
||||
#: src/xz/message.c:1098
|
||||
#: src/xz/message.c:1092
|
||||
msgid ""
|
||||
" -z, --compress force compression\n"
|
||||
" -d, --decompress force decompression\n"
|
||||
@@ -490,7 +576,7 @@ msgstr ""
|
||||
" -t, --test sprawdzenie spójności plików skompresowanych\n"
|
||||
" -l, --list wypisanie informacji o plikach .xz"
|
||||
|
||||
#: src/xz/message.c:1104
|
||||
#: src/xz/message.c:1098
|
||||
msgid ""
|
||||
"\n"
|
||||
" Operation modifiers:\n"
|
||||
@@ -498,7 +584,7 @@ msgstr ""
|
||||
"\n"
|
||||
" Modyfikatory operacji:\n"
|
||||
|
||||
#: src/xz/message.c:1107
|
||||
#: src/xz/message.c:1101
|
||||
msgid ""
|
||||
" -k, --keep keep (don't delete) input files\n"
|
||||
" -f, --force force overwrite of output file and (de)compress links\n"
|
||||
@@ -508,7 +594,15 @@ msgstr ""
|
||||
" -f, --force nadpisywanie plików wyjściowych i (de)kompresja dowiązań\n"
|
||||
" -c, --stdout zapis na standardowe wyjście, nieusuwanie plików wej."
|
||||
|
||||
#: src/xz/message.c:1113
|
||||
#: src/xz/message.c:1107
|
||||
msgid ""
|
||||
" --single-stream decompress only the first stream, and silently\n"
|
||||
" ignore possible remaining input data"
|
||||
msgstr ""
|
||||
" --single-stream dekompresja tylko pierwszego strumienia, ciche\n"
|
||||
" zignorowanie pozostałych danych wejściowych"
|
||||
|
||||
#: src/xz/message.c:1110
|
||||
msgid ""
|
||||
" --no-sparse do not create sparse files when decompressing\n"
|
||||
" -S, --suffix=.SUF use the suffix `.SUF' on compressed files\n"
|
||||
@@ -524,7 +618,7 @@ msgstr ""
|
||||
" wejścia; muszą być zakończone znakiem nowej linii\n"
|
||||
" --files0[=PLIK] podobnie do --files, ale znakiem kończącym musi być NUL"
|
||||
|
||||
#: src/xz/message.c:1121
|
||||
#: src/xz/message.c:1119
|
||||
msgid ""
|
||||
"\n"
|
||||
" Basic file format and compression options:\n"
|
||||
@@ -532,7 +626,7 @@ msgstr ""
|
||||
"\n"
|
||||
" Podstawowe opcje formatu pliku i kompresji:\n"
|
||||
|
||||
#: src/xz/message.c:1123
|
||||
#: src/xz/message.c:1121
|
||||
msgid ""
|
||||
" -F, --format=FMT file format to encode or decode; possible values are\n"
|
||||
" `auto' (default), `xz', `lzma', and `raw'\n"
|
||||
@@ -544,6 +638,10 @@ msgstr ""
|
||||
" -C, --check=TEST typ kontroli spójności: `none' (ostrożnie!),\n"
|
||||
" `crc32', `crc64' (domyślny) lub `sha256'"
|
||||
|
||||
#: src/xz/message.c:1126
|
||||
msgid " --ignore-check don't verify the integrity check when decompressing"
|
||||
msgstr " --ignore-check bez kontroli sprawdzania integralności przy dekompresji"
|
||||
|
||||
#: src/xz/message.c:1130
|
||||
msgid ""
|
||||
" -0 ... -9 compression preset; default is 6; take compressor *and*\n"
|
||||
@@ -562,7 +660,48 @@ msgstr ""
|
||||
" ilości czasu procesora; nie wpływa na wymagania\n"
|
||||
" pamięciowe dekompresora"
|
||||
|
||||
#: src/xz/message.c:1139
|
||||
#: src/xz/message.c:1138
|
||||
msgid ""
|
||||
" -T, --threads=NUM use at most NUM threads; the default is 1; set to 0\n"
|
||||
" to use as many threads as there are processor cores"
|
||||
msgstr ""
|
||||
" -T, --threads=ILE użycie maksymalnie ILU wątków; domyślnie 1; 0 oznacza\n"
|
||||
" tyle, ile jest rdzeni procesorów"
|
||||
|
||||
#: src/xz/message.c:1143
|
||||
msgid ""
|
||||
" --block-size=SIZE\n"
|
||||
" start a new .xz block after every SIZE bytes of input;\n"
|
||||
" use this to set the block size for threaded compression"
|
||||
msgstr ""
|
||||
" --block-size=ROZMIAR\n"
|
||||
" rozpoczęcie nowego bloku .xz co ROZMIAR bajtów wejścia;\n"
|
||||
" opcja służy do ustawienia rozmiaru bloku dla kompresji\n"
|
||||
" wielowątkowej"
|
||||
|
||||
#: src/xz/message.c:1147
|
||||
msgid ""
|
||||
" --block-list=SIZES\n"
|
||||
" start a new .xz block after the given comma-separated\n"
|
||||
" intervals of uncompressed data"
|
||||
msgstr ""
|
||||
" --block-list=ROZMIARY\n"
|
||||
" rozpoczęcie nowego bloku .xz po rozdzielonych przecinkiem\n"
|
||||
" przedziałach danych nieskompresowanych"
|
||||
|
||||
#: src/xz/message.c:1151
|
||||
msgid ""
|
||||
" --flush-timeout=TIMEOUT\n"
|
||||
" when compressing, if more than TIMEOUT milliseconds has\n"
|
||||
" passed since the previous flush and reading more input\n"
|
||||
" would block, all pending data is flushed out"
|
||||
msgstr ""
|
||||
" --flush-timeout=CZAS\n"
|
||||
" przy kompresji, jeśli minęło więcej niż CZAS milisekund\n"
|
||||
" ostatniegu zapisu bloku, a odczyt kolejnych danych byłby\n"
|
||||
" blokujący, wszystkie gotowe dane są zapisywane"
|
||||
|
||||
#: src/xz/message.c:1157
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
" --memlimit-compress=LIMIT\n"
|
||||
@@ -578,7 +717,7 @@ msgstr ""
|
||||
" dekompresji lub obu; LIMIT jest w bajtach, % RAM lub 0\n"
|
||||
" dla limitów domyślnych"
|
||||
|
||||
#: src/xz/message.c:1146
|
||||
#: src/xz/message.c:1164
|
||||
msgid ""
|
||||
" --no-adjust if compression settings exceed the memory usage limit,\n"
|
||||
" give an error instead of adjusting the settings downwards"
|
||||
@@ -587,7 +726,7 @@ msgstr ""
|
||||
" pamięci, zostanie zgłoszony błąd zamiast zmniejszania\n"
|
||||
" ustawień"
|
||||
|
||||
#: src/xz/message.c:1152
|
||||
#: src/xz/message.c:1170
|
||||
msgid ""
|
||||
"\n"
|
||||
" Custom filter chain for compression (alternative for using presets):"
|
||||
@@ -595,7 +734,7 @@ msgstr ""
|
||||
"\n"
|
||||
" Łańcuch własnych filtrów do kompresji (alternatywa do używania -0 .. -9):"
|
||||
|
||||
#: src/xz/message.c:1161
|
||||
#: src/xz/message.c:1179
|
||||
msgid ""
|
||||
"\n"
|
||||
" --lzma1[=OPTS] LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n"
|
||||
@@ -624,7 +763,7 @@ msgstr ""
|
||||
" mf=NAZWA dopasowywacz (hc3, hc4, bt2, bt3, bt4; bt4)\n"
|
||||
" depth=ILE maks. głębokość szukania; 0=auto (domyślne)"
|
||||
|
||||
#: src/xz/message.c:1176
|
||||
#: src/xz/message.c:1194
|
||||
msgid ""
|
||||
"\n"
|
||||
" --x86[=OPTS] x86 BCJ filter (32-bit and 64-bit)\n"
|
||||
@@ -646,7 +785,7 @@ msgstr ""
|
||||
" Poprawne OPCJE dla wszystkich filtrów BCJ:\n"
|
||||
" start=ILE offset początku konwersji (domyślnie=0)"
|
||||
|
||||
#: src/xz/message.c:1188
|
||||
#: src/xz/message.c:1206
|
||||
msgid ""
|
||||
"\n"
|
||||
" --delta[=OPTS] Delta filter; valid OPTS (valid values; default):\n"
|
||||
@@ -658,7 +797,7 @@ msgstr ""
|
||||
" dist=ILE odległość między bajtami odejmowanymi od\n"
|
||||
" siebie (1-256; 1)"
|
||||
|
||||
#: src/xz/message.c:1196
|
||||
#: src/xz/message.c:1214
|
||||
msgid ""
|
||||
"\n"
|
||||
" Other options:\n"
|
||||
@@ -666,7 +805,7 @@ msgstr ""
|
||||
"\n"
|
||||
" Inne opcje:\n"
|
||||
|
||||
#: src/xz/message.c:1199
|
||||
#: src/xz/message.c:1217
|
||||
msgid ""
|
||||
" -q, --quiet suppress warnings; specify twice to suppress errors too\n"
|
||||
" -v, --verbose be verbose; specify twice for even more verbose"
|
||||
@@ -674,15 +813,15 @@ msgstr ""
|
||||
" -q, --quiet pominięcie ostrzeżeń; dwukrotne podanie pomija też błędy\n"
|
||||
" -v, --verbose więcej informacji; dwukrotne podanie to jeszcze więcej"
|
||||
|
||||
#: src/xz/message.c:1204
|
||||
#: src/xz/message.c:1222
|
||||
msgid " -Q, --no-warn make warnings not affect the exit status"
|
||||
msgstr " -Q, --no-warn ostrzeżenia nie mają wpływu na status zakończenia"
|
||||
|
||||
#: src/xz/message.c:1206
|
||||
#: src/xz/message.c:1224
|
||||
msgid " --robot use machine-parsable messages (useful for scripts)"
|
||||
msgstr " --robot komunikaty w formacie dla maszyny (do skryptów)"
|
||||
|
||||
#: src/xz/message.c:1209
|
||||
#: src/xz/message.c:1227
|
||||
msgid ""
|
||||
" --info-memory display the total amount of RAM and the currently active\n"
|
||||
" memory usage limits, and exit"
|
||||
@@ -690,7 +829,7 @@ msgstr ""
|
||||
" --info-memory wyświetlenie całkowitej ilości pamięci RAM oraz aktualnie\n"
|
||||
" aktywnych limitów pamięci i zakończenie pracy"
|
||||
|
||||
#: src/xz/message.c:1212
|
||||
#: src/xz/message.c:1230
|
||||
msgid ""
|
||||
" -h, --help display the short help (lists only the basic options)\n"
|
||||
" -H, --long-help display this long help and exit"
|
||||
@@ -698,7 +837,7 @@ msgstr ""
|
||||
" -h, --help wyświetlenie krótkiego opisu (tylko podstawowe opcje)\n"
|
||||
" -H, --long-help wyświetlenie tego długiego opisu i zakończenie"
|
||||
|
||||
#: src/xz/message.c:1216
|
||||
#: src/xz/message.c:1234
|
||||
msgid ""
|
||||
" -h, --help display this short help and exit\n"
|
||||
" -H, --long-help display the long help (lists also the advanced options)"
|
||||
@@ -706,11 +845,11 @@ msgstr ""
|
||||
" -h, --help wyświetlenie tego krótkiego opisu i zakończenie\n"
|
||||
" -H, --long-help wyświetlenie długiego opisu (także opcje zaawansowane)"
|
||||
|
||||
#: src/xz/message.c:1221
|
||||
#: src/xz/message.c:1239
|
||||
msgid " -V, --version display the version number and exit"
|
||||
msgstr " -V, --version wyświetlenie informacji o wersji i zakończenie"
|
||||
|
||||
#: src/xz/message.c:1223
|
||||
#: src/xz/message.c:1241
|
||||
msgid ""
|
||||
"\n"
|
||||
"With no FILE, or when FILE is -, read standard input.\n"
|
||||
@@ -722,7 +861,7 @@ msgstr ""
|
||||
#. for this package. Please add _another line_ saying
|
||||
#. "Report translation bugs to <...>\n" with the email or WWW
|
||||
#. address for translation bugs. Thanks.
|
||||
#: src/xz/message.c:1229
|
||||
#: src/xz/message.c:1247
|
||||
#, c-format
|
||||
msgid "Report bugs to <%s> (in English or Finnish).\n"
|
||||
msgstr ""
|
||||
@@ -731,11 +870,15 @@ msgstr ""
|
||||
"Błędy w tłumaczeniu prosimy zgłaszać na adres\n"
|
||||
"<translation-team-pl@lists.sourceforge.net>.\n"
|
||||
|
||||
#: src/xz/message.c:1231
|
||||
#: src/xz/message.c:1249
|
||||
#, c-format
|
||||
msgid "%s home page: <%s>\n"
|
||||
msgstr "Strona domowa %s: <%s>\n"
|
||||
|
||||
#: src/xz/message.c:1253
|
||||
msgid "THIS IS A DEVELOPMENT VERSION NOT INTENDED FOR PRODUCTION USE."
|
||||
msgstr "TA WERSJA JEST ROZWOJOWA, NIE PRZEZNACZONA DO UŻYTKU PRODUKCYJNEGO."
|
||||
|
||||
#: src/xz/options.c:86
|
||||
#, c-format
|
||||
msgid "%s: Options must be `name=value' pairs separated with commas"
|
||||
@@ -765,54 +908,54 @@ msgstr "Suma lc i lp nie może przekroczyć 4"
|
||||
msgid "The selected match finder requires at least nice=%<PRIu32>"
|
||||
msgstr "Wybrany dopasowywacz wymaga przynajmniej nice=%<PRIu32>"
|
||||
|
||||
#: src/xz/suffix.c:104 src/xz/suffix.c:189
|
||||
#: src/xz/suffix.c:133 src/xz/suffix.c:258
|
||||
#, c-format
|
||||
msgid "%s: With --format=raw, --suffix=.SUF is required unless writing to stdout"
|
||||
msgstr "%s: Przy --format=raw i zapisie do pliku wymagana jest opcja --suffix=.ROZ"
|
||||
|
||||
#: src/xz/suffix.c:124
|
||||
#: src/xz/suffix.c:164
|
||||
#, c-format
|
||||
msgid "%s: Filename has an unknown suffix, skipping"
|
||||
msgstr "%s: Nazwa pliku ma nieznane rozszerzenie, pominięto"
|
||||
|
||||
#: src/xz/suffix.c:179
|
||||
#: src/xz/suffix.c:185
|
||||
#, c-format
|
||||
msgid "%s: File already has `%s' suffix, skipping"
|
||||
msgstr "%s: Plik już ma rozszerzenie `%s', pominięto"
|
||||
|
||||
#: src/xz/suffix.c:230
|
||||
#: src/xz/suffix.c:393
|
||||
#, c-format
|
||||
msgid "%s: Invalid filename suffix"
|
||||
msgstr "%s: Błędne rozszerzenie nazwy pliku"
|
||||
|
||||
#: src/xz/util.c:61
|
||||
#: src/xz/util.c:71
|
||||
#, c-format
|
||||
msgid "%s: Value is not a non-negative decimal integer"
|
||||
msgstr "%s: Wartość nie jest nieujemną liczbą całkowitą"
|
||||
|
||||
#: src/xz/util.c:103
|
||||
#: src/xz/util.c:113
|
||||
#, c-format
|
||||
msgid "%s: Invalid multiplier suffix"
|
||||
msgstr "%s: Błędny przyrostek mnożnika"
|
||||
|
||||
#: src/xz/util.c:105
|
||||
#: src/xz/util.c:115
|
||||
msgid "Valid suffixes are `KiB' (2^10), `MiB' (2^20), and `GiB' (2^30)."
|
||||
msgstr "Poprawne przyrostki to `KiB' (2^10), `MiB' (2^20) i `GiB' (2^30)."
|
||||
|
||||
#: src/xz/util.c:122
|
||||
#: src/xz/util.c:132
|
||||
#, c-format
|
||||
msgid "Value of the option `%s' must be in the range [%<PRIu64>, %<PRIu64>]"
|
||||
msgstr "Wartość opcji `%s' musi być w przedziale [%<PRIu64>, %<PRIu64>]"
|
||||
|
||||
#: src/xz/util.c:247
|
||||
#: src/xz/util.c:257
|
||||
msgid "Empty filename, skipping"
|
||||
msgstr "Pusta nazwa pliku, pominięto"
|
||||
|
||||
#: src/xz/util.c:261
|
||||
#: src/xz/util.c:271
|
||||
msgid "Compressed data cannot be read from a terminal"
|
||||
msgstr "Dane skompresowane nie mogą być czytane z terminala"
|
||||
|
||||
#: src/xz/util.c:274
|
||||
#: src/xz/util.c:284
|
||||
msgid "Compressed data cannot be written to a terminal"
|
||||
msgstr "Dane skompresowane nie mogą być zapisywane na terminal"
|
||||
|
||||
|
||||
@@ -19,4 +19,24 @@ if COND_SCRIPTS
|
||||
SUBDIRS += scripts
|
||||
endif
|
||||
|
||||
EXTRA_DIST = common
|
||||
EXTRA_DIST = \
|
||||
common/common_w32res.rc \
|
||||
common/mythread.h \
|
||||
common/sysdefs.h \
|
||||
common/tuklib_common.h \
|
||||
common/tuklib_config.h \
|
||||
common/tuklib_cpucores.c \
|
||||
common/tuklib_cpucores.h \
|
||||
common/tuklib_exit.c \
|
||||
common/tuklib_exit.h \
|
||||
common/tuklib_gettext.h \
|
||||
common/tuklib_integer.h \
|
||||
common/tuklib_mbstr_fw.c \
|
||||
common/tuklib_mbstr.h \
|
||||
common/tuklib_mbstr_width.c \
|
||||
common/tuklib_open_stdxxx.c \
|
||||
common/tuklib_open_stdxxx.h \
|
||||
common/tuklib_physmem.c \
|
||||
common/tuklib_physmem.h \
|
||||
common/tuklib_progname.c \
|
||||
common/tuklib_progname.h
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#define MY_VERSION LZMA_VERSION_MAJOR,LZMA_VERSION_MINOR,LZMA_VERSION_PATCH,MY_BUILD
|
||||
|
||||
#define MY_FILENAME MY_NAME MY_SUFFIX
|
||||
#define MY_COMPANY "The Tukaani Project <http://tukaani.org/>"
|
||||
#define MY_COMPANY "The Tukaani Project <https://tukaani.org/>"
|
||||
#define MY_PRODUCT PACKAGE_NAME " <" PACKAGE_URL ">"
|
||||
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
@@ -10,93 +10,217 @@
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MYTHREAD_H
|
||||
#define MYTHREAD_H
|
||||
|
||||
#include "sysdefs.h"
|
||||
|
||||
// If any type of threading is enabled, #define MYTHREAD_ENABLED.
|
||||
#if defined(MYTHREAD_POSIX) || defined(MYTHREAD_WIN95) \
|
||||
|| defined(MYTHREAD_VISTA)
|
||||
# define MYTHREAD_ENABLED 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PTHREAD
|
||||
|
||||
#ifdef MYTHREAD_ENABLED
|
||||
|
||||
////////////////////////////////////////
|
||||
// Shared between all threading types //
|
||||
////////////////////////////////////////
|
||||
|
||||
// Locks a mutex for a duration of a block.
|
||||
//
|
||||
// Perform mythread_mutex_lock(&mutex) in the beginning of a block
|
||||
// and mythread_mutex_unlock(&mutex) at the end of the block. "break"
|
||||
// may be used to unlock the mutex and jump out of the block.
|
||||
// mythread_sync blocks may be nested.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// mythread_sync(mutex) {
|
||||
// foo();
|
||||
// if (some_error)
|
||||
// break; // Skips bar()
|
||||
// bar();
|
||||
// }
|
||||
//
|
||||
// At least GCC optimizes the loops completely away so it doesn't slow
|
||||
// things down at all compared to plain mythread_mutex_lock(&mutex)
|
||||
// and mythread_mutex_unlock(&mutex) calls.
|
||||
//
|
||||
#define mythread_sync(mutex) mythread_sync_helper1(mutex, __LINE__)
|
||||
#define mythread_sync_helper1(mutex, line) mythread_sync_helper2(mutex, line)
|
||||
#define mythread_sync_helper2(mutex, line) \
|
||||
for (unsigned int mythread_i_ ## line = 0; \
|
||||
mythread_i_ ## line \
|
||||
? (mythread_mutex_unlock(&(mutex)), 0) \
|
||||
: (mythread_mutex_lock(&(mutex)), 1); \
|
||||
mythread_i_ ## line = 1) \
|
||||
for (unsigned int mythread_j_ ## line = 0; \
|
||||
!mythread_j_ ## line; \
|
||||
mythread_j_ ## line = 1)
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(MYTHREAD_ENABLED)
|
||||
|
||||
//////////////////
|
||||
// No threading //
|
||||
//////////////////
|
||||
|
||||
// Calls the given function once. This isn't thread safe.
|
||||
#define mythread_once(func) \
|
||||
do { \
|
||||
static bool once_ = false; \
|
||||
if (!once_) { \
|
||||
func(); \
|
||||
once_ = true; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
#if !(defined(_WIN32) && !defined(__CYGWIN__))
|
||||
// Use sigprocmask() to set the signal mask in single-threaded programs.
|
||||
#include <signal.h>
|
||||
|
||||
static inline void
|
||||
mythread_sigmask(int how, const sigset_t *restrict set,
|
||||
sigset_t *restrict oset)
|
||||
{
|
||||
int ret = sigprocmask(how, set, oset);
|
||||
assert(ret == 0);
|
||||
(void)ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#elif defined(MYTHREAD_POSIX)
|
||||
|
||||
////////////////////
|
||||
// Using pthreads //
|
||||
////////////////////
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define MYTHREAD_RET_TYPE void *
|
||||
#define MYTHREAD_RET_VALUE NULL
|
||||
|
||||
/// \brief Set the process signal mask
|
||||
///
|
||||
/// If threads are disabled, sigprocmask() is used instead
|
||||
/// of pthread_sigmask().
|
||||
#define mythread_sigmask(how, set, oset) \
|
||||
pthread_sigmask(how, set, oset)
|
||||
|
||||
|
||||
/// \brief Call the given function once
|
||||
///
|
||||
/// If threads are disabled, a thread-unsafe version is used.
|
||||
#define mythread_once(func) \
|
||||
do { \
|
||||
static pthread_once_t once_ = PTHREAD_ONCE_INIT; \
|
||||
pthread_once(&once_, &func); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/// \brief Lock a mutex for a duration of a block
|
||||
///
|
||||
/// Perform pthread_mutex_lock(&mutex) in the beginning of a block
|
||||
/// and pthread_mutex_unlock(&mutex) at the end of the block. "break"
|
||||
/// may be used to unlock the mutex and jump out of the block.
|
||||
/// mythread_sync blocks may be nested.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// mythread_sync(mutex) {
|
||||
/// foo();
|
||||
/// if (some_error)
|
||||
/// break; // Skips bar()
|
||||
/// bar();
|
||||
/// }
|
||||
///
|
||||
/// At least GCC optimizes the loops completely away so it doesn't slow
|
||||
/// things down at all compared to plain pthread_mutex_lock(&mutex)
|
||||
/// and pthread_mutex_unlock(&mutex) calls.
|
||||
///
|
||||
#define mythread_sync(mutex) mythread_sync_helper(mutex, __LINE__)
|
||||
#define mythread_sync_helper(mutex, line) \
|
||||
for (unsigned int mythread_i_ ## line = 0; \
|
||||
mythread_i_ ## line \
|
||||
? (pthread_mutex_unlock(&(mutex)), 0) \
|
||||
: (pthread_mutex_lock(&(mutex)), 1); \
|
||||
mythread_i_ ## line = 1) \
|
||||
for (unsigned int mythread_j_ ## line = 0; \
|
||||
!mythread_j_ ## line; \
|
||||
mythread_j_ ## line = 1)
|
||||
|
||||
typedef pthread_t mythread;
|
||||
typedef pthread_mutex_t mythread_mutex;
|
||||
|
||||
typedef struct {
|
||||
/// Condition variable
|
||||
pthread_cond_t cond;
|
||||
|
||||
/// Clock ID (CLOCK_REALTIME or CLOCK_MONOTONIC) associated with
|
||||
/// the condition variable
|
||||
#ifdef HAVE_CLOCK_GETTIME
|
||||
// Clock ID (CLOCK_REALTIME or CLOCK_MONOTONIC) associated with
|
||||
// the condition variable.
|
||||
clockid_t clk_id;
|
||||
|
||||
#endif
|
||||
} mythread_cond;
|
||||
|
||||
typedef struct timespec mythread_condtime;
|
||||
|
||||
/// \brief Initialize a condition variable to use CLOCK_MONOTONIC
|
||||
///
|
||||
/// Using CLOCK_MONOTONIC instead of the default CLOCK_REALTIME makes the
|
||||
/// timeout in pthread_cond_timedwait() work correctly also if system time
|
||||
/// is suddenly changed. Unfortunately CLOCK_MONOTONIC isn't available
|
||||
/// everywhere while the default CLOCK_REALTIME is, so the default is
|
||||
/// used if CLOCK_MONOTONIC isn't available.
|
||||
|
||||
// Calls the given function once in a thread-safe way.
|
||||
#define mythread_once(func) \
|
||||
do { \
|
||||
static pthread_once_t once_ = PTHREAD_ONCE_INIT; \
|
||||
pthread_once(&once_, &func); \
|
||||
} while (0)
|
||||
|
||||
|
||||
// Use pthread_sigmask() to set the signal mask in multi-threaded programs.
|
||||
// Do nothing on OpenVMS since it lacks pthread_sigmask().
|
||||
static inline void
|
||||
mythread_sigmask(int how, const sigset_t *restrict set,
|
||||
sigset_t *restrict oset)
|
||||
{
|
||||
#ifdef __VMS
|
||||
(void)how;
|
||||
(void)set;
|
||||
(void)oset;
|
||||
#else
|
||||
int ret = pthread_sigmask(how, set, oset);
|
||||
assert(ret == 0);
|
||||
(void)ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// Creates a new thread with all signals blocked. Returns zero on success
|
||||
// and non-zero on error.
|
||||
static inline int
|
||||
mythread_create(mythread *thread, void *(*func)(void *arg), void *arg)
|
||||
{
|
||||
sigset_t old;
|
||||
sigset_t all;
|
||||
sigfillset(&all);
|
||||
|
||||
mythread_sigmask(SIG_SETMASK, &all, &old);
|
||||
const int ret = pthread_create(thread, NULL, func, arg);
|
||||
mythread_sigmask(SIG_SETMASK, &old, NULL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Joins a thread. Returns zero on success and non-zero on error.
|
||||
static inline int
|
||||
mythread_join(mythread thread)
|
||||
{
|
||||
return pthread_join(thread, NULL);
|
||||
}
|
||||
|
||||
|
||||
// Initiatlizes a mutex. Returns zero on success and non-zero on error.
|
||||
static inline int
|
||||
mythread_mutex_init(mythread_mutex *mutex)
|
||||
{
|
||||
return pthread_mutex_init(mutex, NULL);
|
||||
}
|
||||
|
||||
static inline void
|
||||
mythread_mutex_destroy(mythread_mutex *mutex)
|
||||
{
|
||||
int ret = pthread_mutex_destroy(mutex);
|
||||
assert(ret == 0);
|
||||
(void)ret;
|
||||
}
|
||||
|
||||
static inline void
|
||||
mythread_mutex_lock(mythread_mutex *mutex)
|
||||
{
|
||||
int ret = pthread_mutex_lock(mutex);
|
||||
assert(ret == 0);
|
||||
(void)ret;
|
||||
}
|
||||
|
||||
static inline void
|
||||
mythread_mutex_unlock(mythread_mutex *mutex)
|
||||
{
|
||||
int ret = pthread_mutex_unlock(mutex);
|
||||
assert(ret == 0);
|
||||
(void)ret;
|
||||
}
|
||||
|
||||
|
||||
// Initializes a condition variable.
|
||||
//
|
||||
// Using CLOCK_MONOTONIC instead of the default CLOCK_REALTIME makes the
|
||||
// timeout in pthread_cond_timedwait() work correctly also if system time
|
||||
// is suddenly changed. Unfortunately CLOCK_MONOTONIC isn't available
|
||||
// everywhere while the default CLOCK_REALTIME is, so the default is
|
||||
// used if CLOCK_MONOTONIC isn't available.
|
||||
//
|
||||
// If clock_gettime() isn't available at all, gettimeofday() will be used.
|
||||
static inline int
|
||||
mythread_cond_init(mythread_cond *mycond)
|
||||
{
|
||||
#if defined(_POSIX_CLOCK_SELECTION) && defined(_POSIX_MONOTONIC_CLOCK)
|
||||
#ifdef HAVE_CLOCK_GETTIME
|
||||
// NOTE: HAVE_DECL_CLOCK_MONOTONIC is always defined to 0 or 1.
|
||||
# if defined(HAVE_PTHREAD_CONDATTR_SETCLOCK) && HAVE_DECL_CLOCK_MONOTONIC
|
||||
struct timespec ts;
|
||||
pthread_condattr_t condattr;
|
||||
|
||||
@@ -119,84 +243,279 @@ mythread_cond_init(mythread_cond *mycond)
|
||||
}
|
||||
|
||||
// If anything above fails, fall back to the default CLOCK_REALTIME.
|
||||
#endif
|
||||
// POSIX requires that all implementations of clock_gettime() must
|
||||
// support at least CLOCK_REALTIME.
|
||||
# endif
|
||||
|
||||
mycond->clk_id = CLOCK_REALTIME;
|
||||
#endif
|
||||
|
||||
return pthread_cond_init(&mycond->cond, NULL);
|
||||
}
|
||||
|
||||
|
||||
/// \brief Convert relative time to absolute time for use with timed wait
|
||||
///
|
||||
/// The current time of the clock associated with the condition variable
|
||||
/// is added to the relative time in *ts.
|
||||
static inline void
|
||||
mythread_cond_abstime(const mythread_cond *mycond, struct timespec *ts)
|
||||
mythread_cond_destroy(mythread_cond *cond)
|
||||
{
|
||||
struct timespec now;
|
||||
clock_gettime(mycond->clk_id, &now);
|
||||
int ret = pthread_cond_destroy(&cond->cond);
|
||||
assert(ret == 0);
|
||||
(void)ret;
|
||||
}
|
||||
|
||||
ts->tv_sec += now.tv_sec;
|
||||
ts->tv_nsec += now.tv_nsec;
|
||||
static inline void
|
||||
mythread_cond_signal(mythread_cond *cond)
|
||||
{
|
||||
int ret = pthread_cond_signal(&cond->cond);
|
||||
assert(ret == 0);
|
||||
(void)ret;
|
||||
}
|
||||
|
||||
static inline void
|
||||
mythread_cond_wait(mythread_cond *cond, mythread_mutex *mutex)
|
||||
{
|
||||
int ret = pthread_cond_wait(&cond->cond, mutex);
|
||||
assert(ret == 0);
|
||||
(void)ret;
|
||||
}
|
||||
|
||||
// Waits on a condition or until a timeout expires. If the timeout expires,
|
||||
// non-zero is returned, otherwise zero is returned.
|
||||
static inline int
|
||||
mythread_cond_timedwait(mythread_cond *cond, mythread_mutex *mutex,
|
||||
const mythread_condtime *condtime)
|
||||
{
|
||||
int ret = pthread_cond_timedwait(&cond->cond, mutex, condtime);
|
||||
assert(ret == 0 || ret == ETIMEDOUT);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Sets condtime to the absolute time that is timeout_ms milliseconds
|
||||
// in the future. The type of the clock to use is taken from cond.
|
||||
static inline void
|
||||
mythread_condtime_set(mythread_condtime *condtime, const mythread_cond *cond,
|
||||
uint32_t timeout_ms)
|
||||
{
|
||||
condtime->tv_sec = timeout_ms / 1000;
|
||||
condtime->tv_nsec = (timeout_ms % 1000) * 1000000;
|
||||
|
||||
#ifdef HAVE_CLOCK_GETTIME
|
||||
struct timespec now;
|
||||
int ret = clock_gettime(cond->clk_id, &now);
|
||||
assert(ret == 0);
|
||||
(void)ret;
|
||||
|
||||
condtime->tv_sec += now.tv_sec;
|
||||
condtime->tv_nsec += now.tv_nsec;
|
||||
#else
|
||||
(void)cond;
|
||||
|
||||
struct timeval now;
|
||||
gettimeofday(&now, NULL);
|
||||
|
||||
condtime->tv_sec += now.tv_sec;
|
||||
condtime->tv_nsec += now.tv_usec * 1000L;
|
||||
#endif
|
||||
|
||||
// tv_nsec must stay in the range [0, 999_999_999].
|
||||
if (ts->tv_nsec >= 1000000000L) {
|
||||
ts->tv_nsec -= 1000000000L;
|
||||
++ts->tv_sec;
|
||||
if (condtime->tv_nsec >= 1000000000L) {
|
||||
condtime->tv_nsec -= 1000000000L;
|
||||
++condtime->tv_sec;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#define mythread_cond_wait(mycondptr, mutexptr) \
|
||||
pthread_cond_wait(&(mycondptr)->cond, mutexptr)
|
||||
#elif defined(MYTHREAD_WIN95) || defined(MYTHREAD_VISTA)
|
||||
|
||||
#define mythread_cond_timedwait(mycondptr, mutexptr, abstimeptr) \
|
||||
pthread_cond_timedwait(&(mycondptr)->cond, mutexptr, abstimeptr)
|
||||
/////////////////////
|
||||
// Windows threads //
|
||||
/////////////////////
|
||||
|
||||
#define mythread_cond_signal(mycondptr) \
|
||||
pthread_cond_signal(&(mycondptr)->cond)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#ifdef MYTHREAD_VISTA
|
||||
# undef _WIN32_WINNT
|
||||
# define _WIN32_WINNT 0x0600
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
|
||||
#define mythread_cond_broadcast(mycondptr) \
|
||||
pthread_cond_broadcast(&(mycondptr)->cond)
|
||||
#define MYTHREAD_RET_TYPE unsigned int __stdcall
|
||||
#define MYTHREAD_RET_VALUE 0
|
||||
|
||||
#define mythread_cond_destroy(mycondptr) \
|
||||
pthread_cond_destroy(&(mycondptr)->cond)
|
||||
typedef HANDLE mythread;
|
||||
typedef CRITICAL_SECTION mythread_mutex;
|
||||
|
||||
#ifdef MYTHREAD_WIN95
|
||||
typedef HANDLE mythread_cond;
|
||||
#else
|
||||
typedef CONDITION_VARIABLE mythread_cond;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
// Tick count (milliseconds) in the beginning of the timeout.
|
||||
// NOTE: This is 32 bits so it wraps around after 49.7 days.
|
||||
// Multi-day timeouts may not work as expected.
|
||||
DWORD start;
|
||||
|
||||
// Length of the timeout in milliseconds. The timeout expires
|
||||
// when the current tick count minus "start" is equal or greater
|
||||
// than "timeout".
|
||||
DWORD timeout;
|
||||
} mythread_condtime;
|
||||
|
||||
|
||||
// mythread_once() is only available with Vista threads.
|
||||
#ifdef MYTHREAD_VISTA
|
||||
#define mythread_once(func) \
|
||||
do { \
|
||||
static INIT_ONCE once_ = INIT_ONCE_STATIC_INIT; \
|
||||
BOOL pending_; \
|
||||
if (!InitOnceBeginInitialize(&once_, 0, &pending_, NULL)) \
|
||||
abort(); \
|
||||
if (pending_) \
|
||||
func(); \
|
||||
if (!InitOnceComplete(&once, 0, NULL)) \
|
||||
abort(); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
|
||||
// mythread_sigmask() isn't available on Windows. Even a dummy version would
|
||||
// make no sense because the other POSIX signal functions are missing anyway.
|
||||
|
||||
|
||||
/// \brief Create a thread with all signals blocked
|
||||
static inline int
|
||||
mythread_create(pthread_t *thread, void *(*func)(void *arg), void *arg)
|
||||
mythread_create(mythread *thread,
|
||||
unsigned int (__stdcall *func)(void *arg), void *arg)
|
||||
{
|
||||
sigset_t old;
|
||||
sigset_t all;
|
||||
sigfillset(&all);
|
||||
uintptr_t ret = _beginthreadex(NULL, 0, func, arg, 0, NULL);
|
||||
if (ret == 0)
|
||||
return -1;
|
||||
|
||||
pthread_sigmask(SIG_SETMASK, &all, &old);
|
||||
const int ret = pthread_create(thread, NULL, func, arg);
|
||||
pthread_sigmask(SIG_SETMASK, &old, NULL);
|
||||
*thread = (HANDLE)ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
mythread_join(mythread thread)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (WaitForSingleObject(thread, INFINITE) != WAIT_OBJECT_0)
|
||||
ret = -1;
|
||||
|
||||
if (!CloseHandle(thread))
|
||||
ret = -1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static inline int
|
||||
mythread_mutex_init(mythread_mutex *mutex)
|
||||
{
|
||||
InitializeCriticalSection(mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
mythread_mutex_destroy(mythread_mutex *mutex)
|
||||
{
|
||||
DeleteCriticalSection(mutex);
|
||||
}
|
||||
|
||||
static inline void
|
||||
mythread_mutex_lock(mythread_mutex *mutex)
|
||||
{
|
||||
EnterCriticalSection(mutex);
|
||||
}
|
||||
|
||||
static inline void
|
||||
mythread_mutex_unlock(mythread_mutex *mutex)
|
||||
{
|
||||
LeaveCriticalSection(mutex);
|
||||
}
|
||||
|
||||
|
||||
static inline int
|
||||
mythread_cond_init(mythread_cond *cond)
|
||||
{
|
||||
#ifdef MYTHREAD_WIN95
|
||||
*cond = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
return *cond == NULL ? -1 : 0;
|
||||
#else
|
||||
InitializeConditionVariable(cond);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////
|
||||
// No threading //
|
||||
//////////////////
|
||||
static inline void
|
||||
mythread_cond_destroy(mythread_cond *cond)
|
||||
{
|
||||
#ifdef MYTHREAD_WIN95
|
||||
CloseHandle(*cond);
|
||||
#else
|
||||
(void)cond;
|
||||
#endif
|
||||
}
|
||||
|
||||
#define mythread_sigmask(how, set, oset) \
|
||||
sigprocmask(how, set, oset)
|
||||
static inline void
|
||||
mythread_cond_signal(mythread_cond *cond)
|
||||
{
|
||||
#ifdef MYTHREAD_WIN95
|
||||
SetEvent(*cond);
|
||||
#else
|
||||
WakeConditionVariable(cond);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
mythread_cond_wait(mythread_cond *cond, mythread_mutex *mutex)
|
||||
{
|
||||
#ifdef MYTHREAD_WIN95
|
||||
LeaveCriticalSection(mutex);
|
||||
WaitForSingleObject(*cond, INFINITE);
|
||||
EnterCriticalSection(mutex);
|
||||
#else
|
||||
BOOL ret = SleepConditionVariableCS(cond, mutex, INFINITE);
|
||||
assert(ret);
|
||||
(void)ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
#define mythread_once(func) \
|
||||
do { \
|
||||
static bool once_ = false; \
|
||||
if (!once_) { \
|
||||
func(); \
|
||||
once_ = true; \
|
||||
} \
|
||||
} while (0)
|
||||
static inline int
|
||||
mythread_cond_timedwait(mythread_cond *cond, mythread_mutex *mutex,
|
||||
const mythread_condtime *condtime)
|
||||
{
|
||||
#ifdef MYTHREAD_WIN95
|
||||
LeaveCriticalSection(mutex);
|
||||
#endif
|
||||
|
||||
DWORD elapsed = GetTickCount() - condtime->start;
|
||||
DWORD timeout = elapsed >= condtime->timeout
|
||||
? 0 : condtime->timeout - elapsed;
|
||||
|
||||
#ifdef MYTHREAD_WIN95
|
||||
DWORD ret = WaitForSingleObject(*cond, timeout);
|
||||
assert(ret == WAIT_OBJECT_0 || ret == WAIT_TIMEOUT);
|
||||
|
||||
EnterCriticalSection(mutex);
|
||||
|
||||
return ret == WAIT_TIMEOUT;
|
||||
#else
|
||||
BOOL ret = SleepConditionVariableCS(cond, mutex, timeout);
|
||||
assert(ret || GetLastError() == ERROR_TIMEOUT);
|
||||
return !ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
mythread_condtime_set(mythread_condtime *condtime, const mythread_cond *cond,
|
||||
uint32_t timeout)
|
||||
{
|
||||
(void)cond;
|
||||
condtime->start = GetTickCount();
|
||||
condtime->timeout = timeout;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -103,9 +103,12 @@
|
||||
# define UINT64_MAX UINT64_C(18446744073709551615)
|
||||
#endif
|
||||
|
||||
// Interix has broken header files, which typedef size_t to unsigned long,
|
||||
// but a few lines later define SIZE_MAX to INT32_MAX.
|
||||
#ifdef __INTERIX
|
||||
// Incorrect(?) SIZE_MAX:
|
||||
// - Interix headers typedef size_t to unsigned long,
|
||||
// but a few lines later define SIZE_MAX to INT32_MAX.
|
||||
// - SCO OpenServer (x86) headers typedef size_t to unsigned int
|
||||
// but define SIZE_MAX to INT32_MAX.
|
||||
#if defined(__INTERIX) || defined(_SCO_DS)
|
||||
# undef SIZE_MAX
|
||||
#endif
|
||||
|
||||
@@ -162,6 +165,16 @@ typedef unsigned char _Bool;
|
||||
# include <memory.h>
|
||||
#endif
|
||||
|
||||
// As of MSVC 2013, inline and restrict are supported with
|
||||
// non-standard keywords.
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
# ifndef inline
|
||||
# define inline __inline
|
||||
# endif
|
||||
# ifndef restrict
|
||||
# define restrict __restrict
|
||||
# endif
|
||||
#endif
|
||||
|
||||
////////////
|
||||
// Macros //
|
||||
|
||||
@@ -12,7 +12,22 @@
|
||||
|
||||
#include "tuklib_cpucores.h"
|
||||
|
||||
#if defined(TUKLIB_CPUCORES_SYSCTL)
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
# ifndef _WIN32_WINNT
|
||||
# define _WIN32_WINNT 0x0500
|
||||
# endif
|
||||
# include <windows.h>
|
||||
|
||||
// glibc >= 2.9
|
||||
#elif defined(TUKLIB_CPUCORES_SCHED_GETAFFINITY)
|
||||
# include <sched.h>
|
||||
|
||||
// FreeBSD
|
||||
#elif defined(TUKLIB_CPUCORES_CPUSET)
|
||||
# include <sys/param.h>
|
||||
# include <sys/cpuset.h>
|
||||
|
||||
#elif defined(TUKLIB_CPUCORES_SYSCTL)
|
||||
# ifdef HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
# endif
|
||||
@@ -33,7 +48,30 @@ tuklib_cpucores(void)
|
||||
{
|
||||
uint32_t ret = 0;
|
||||
|
||||
#if defined(TUKLIB_CPUCORES_SYSCTL)
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
SYSTEM_INFO sysinfo;
|
||||
GetSystemInfo(&sysinfo);
|
||||
ret = sysinfo.dwNumberOfProcessors;
|
||||
|
||||
#elif defined(TUKLIB_CPUCORES_SCHED_GETAFFINITY)
|
||||
cpu_set_t cpu_mask;
|
||||
if (sched_getaffinity(0, sizeof(cpu_mask), &cpu_mask) == 0)
|
||||
ret = CPU_COUNT(&cpu_mask);
|
||||
|
||||
#elif defined(TUKLIB_CPUCORES_CPUSET)
|
||||
cpuset_t set;
|
||||
if (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1,
|
||||
sizeof(set), &set) == 0) {
|
||||
# ifdef CPU_COUNT
|
||||
ret = CPU_COUNT(&set);
|
||||
# else
|
||||
for (unsigned i = 0; i < CPU_SETSIZE; ++i)
|
||||
if (CPU_ISSET(i, &set))
|
||||
++ret;
|
||||
# endif
|
||||
}
|
||||
|
||||
#elif defined(TUKLIB_CPUCORES_SYSCTL)
|
||||
int name[2] = { CTL_HW, HW_NCPU };
|
||||
int cpus;
|
||||
size_t cpus_size = sizeof(cpus);
|
||||
|
||||
@@ -98,6 +98,17 @@
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////
|
||||
// Compiler-specific features //
|
||||
////////////////////////////////
|
||||
|
||||
// Newer Intel C compilers require immintrin.h for _bit_scan_reverse()
|
||||
// and such functions.
|
||||
#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500)
|
||||
# include <immintrin.h>
|
||||
#endif
|
||||
|
||||
|
||||
///////////////////
|
||||
// Byte swapping //
|
||||
///////////////////
|
||||
@@ -321,8 +332,8 @@ unaligned_read32le(const uint8_t *buf)
|
||||
static inline void
|
||||
unaligned_write16be(uint8_t *buf, uint16_t num)
|
||||
{
|
||||
buf[0] = num >> 8;
|
||||
buf[1] = num;
|
||||
buf[0] = (uint8_t)(num >> 8);
|
||||
buf[1] = (uint8_t)num;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -330,8 +341,8 @@ unaligned_write16be(uint8_t *buf, uint16_t num)
|
||||
static inline void
|
||||
unaligned_write16le(uint8_t *buf, uint16_t num)
|
||||
{
|
||||
buf[0] = num;
|
||||
buf[1] = num >> 8;
|
||||
buf[0] = (uint8_t)num;
|
||||
buf[1] = (uint8_t)(num >> 8);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -339,10 +350,10 @@ unaligned_write16le(uint8_t *buf, uint16_t num)
|
||||
static inline void
|
||||
unaligned_write32be(uint8_t *buf, uint32_t num)
|
||||
{
|
||||
buf[0] = num >> 24;
|
||||
buf[1] = num >> 16;
|
||||
buf[2] = num >> 8;
|
||||
buf[3] = num;
|
||||
buf[0] = (uint8_t)(num >> 24);
|
||||
buf[1] = (uint8_t)(num >> 16);
|
||||
buf[2] = (uint8_t)(num >> 8);
|
||||
buf[3] = (uint8_t)num;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -350,10 +361,10 @@ unaligned_write32be(uint8_t *buf, uint32_t num)
|
||||
static inline void
|
||||
unaligned_write32le(uint8_t *buf, uint32_t num)
|
||||
{
|
||||
buf[0] = num;
|
||||
buf[1] = num >> 8;
|
||||
buf[2] = num >> 16;
|
||||
buf[3] = num >> 24;
|
||||
buf[0] = (uint8_t)num;
|
||||
buf[1] = (uint8_t)(num >> 8);
|
||||
buf[2] = (uint8_t)(num >> 16);
|
||||
buf[3] = (uint8_t)(num >> 24);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,12 +39,14 @@ tuklib_open_stdxxx(int err_status)
|
||||
| (i == 0 ? O_WRONLY : O_RDONLY));
|
||||
|
||||
if (fd != i) {
|
||||
if (fd != -1)
|
||||
(void)close(fd);
|
||||
|
||||
// Something went wrong. Exit with the
|
||||
// exit status we were given. Don't try
|
||||
// to print an error message, since stderr
|
||||
// may very well be non-existent. This
|
||||
// error should be extremely rare.
|
||||
(void)close(fd);
|
||||
exit(err_status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,14 @@
|
||||
# include <syidef.h>
|
||||
# include <ssdef.h>
|
||||
|
||||
// AIX
|
||||
#elif defined(AMIGA) || defined(__AROS__)
|
||||
# define __USE_INLINE__
|
||||
# include <proto/exec.h>
|
||||
|
||||
#elif defined(__QNX__)
|
||||
# include <sys/syspage.h>
|
||||
# include <string.h>
|
||||
|
||||
#elif defined(TUKLIB_PHYSMEM_AIX)
|
||||
# include <sys/systemcfg.h>
|
||||
|
||||
@@ -79,7 +86,8 @@ tuklib_physmem(void)
|
||||
// GlobalMemoryStatusEx() conditionally.
|
||||
HMODULE kernel32 = GetModuleHandle("kernel32.dll");
|
||||
if (kernel32 != NULL) {
|
||||
BOOL (WINAPI *gmse)(LPMEMORYSTATUSEX) = GetProcAddress(
|
||||
typedef BOOL (WINAPI *gmse_type)(LPMEMORYSTATUSEX);
|
||||
gmse_type gmse = (gmse_type)GetProcAddress(
|
||||
kernel32, "GlobalMemoryStatusEx");
|
||||
if (gmse != NULL) {
|
||||
MEMORYSTATUSEX meminfo;
|
||||
@@ -119,6 +127,18 @@ tuklib_physmem(void)
|
||||
if (LIB$GETSYI(&val, &vms_mem, 0, 0, 0, 0) == SS$_NORMAL)
|
||||
ret = (uint64_t)vms_mem * 8192;
|
||||
|
||||
#elif defined(AMIGA) || defined(__AROS__)
|
||||
ret = AvailMem(MEMF_TOTAL);
|
||||
|
||||
#elif defined(__QNX__)
|
||||
const struct asinfo_entry *entries = SYSPAGE_ENTRY(asinfo);
|
||||
size_t count = SYSPAGE_ENTRY_SIZE(asinfo) / sizeof(struct asinfo_entry);
|
||||
const char *strings = SYSPAGE_ENTRY(strings)->data;
|
||||
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
if (strcmp(strings + entries[i].name, "ram") == 0)
|
||||
ret += entries[i].end - entries[i].start + 1;
|
||||
|
||||
#elif defined(TUKLIB_PHYSMEM_AIX)
|
||||
ret = _system_configuration.physmem;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ CLEANFILES =
|
||||
doc_DATA =
|
||||
|
||||
lib_LTLIBRARIES = liblzma.la
|
||||
liblzma_la_SOURCES = $(top_srcdir)/src/common/tuklib_physmem.c
|
||||
liblzma_la_SOURCES =
|
||||
liblzma_la_CPPFLAGS = \
|
||||
-I$(top_srcdir)/src/liblzma/api \
|
||||
-I$(top_srcdir)/src/liblzma/common \
|
||||
@@ -24,7 +24,19 @@ liblzma_la_CPPFLAGS = \
|
||||
-I$(top_srcdir)/src/liblzma/simple \
|
||||
-I$(top_srcdir)/src/common \
|
||||
-DTUKLIB_SYMBOL_PREFIX=lzma_
|
||||
liblzma_la_LDFLAGS = -no-undefined -version-info 5:99:0
|
||||
liblzma_la_LDFLAGS = -no-undefined -version-info 8:99:3
|
||||
|
||||
EXTRA_DIST += liblzma.map validate_map.sh
|
||||
if COND_SYMVERS
|
||||
liblzma_la_LDFLAGS += \
|
||||
-Wl,--version-script=$(top_srcdir)/src/liblzma/liblzma.map
|
||||
endif
|
||||
|
||||
liblzma_la_SOURCES += ../common/tuklib_physmem.c
|
||||
|
||||
if COND_THREADS
|
||||
liblzma_la_SOURCES += ../common/tuklib_cpucores.c
|
||||
endif
|
||||
|
||||
include $(srcdir)/common/Makefile.inc
|
||||
include $(srcdir)/check/Makefile.inc
|
||||
@@ -88,3 +100,23 @@ endif
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = liblzma.pc
|
||||
EXTRA_DIST += liblzma.pc.in
|
||||
|
||||
pc_verbose = $(pc_verbose_@AM_V@)
|
||||
pc_verbose_ = $(pc_verbose_@AM_DEFAULT_V@)
|
||||
pc_verbose_0 = @echo " PC " $@;
|
||||
|
||||
liblzma.pc: $(srcdir)/liblzma.pc.in
|
||||
$(AM_V_at)rm -f $@
|
||||
$(pc_verbose)sed \
|
||||
-e 's,@prefix[@],$(prefix),g' \
|
||||
-e 's,@exec_prefix[@],$(exec_prefix),g' \
|
||||
-e 's,@libdir[@],$(libdir),g' \
|
||||
-e 's,@includedir[@],$(includedir),g' \
|
||||
-e 's,@PACKAGE_URL[@],$(PACKAGE_URL),g' \
|
||||
-e 's,@PACKAGE_VERSION[@],$(PACKAGE_VERSION),g' \
|
||||
-e 's,@PTHREAD_CFLAGS[@],$(PTHREAD_CFLAGS),g' \
|
||||
-e 's,@LIBS[@],$(LIBS),g' \
|
||||
< $(srcdir)/liblzma.pc.in > $@ || { rm -f $@; exit 1; }
|
||||
|
||||
clean-local:
|
||||
rm -f liblzma.pc
|
||||
|
||||
@@ -17,7 +17,7 @@ nobase_include_HEADERS = \
|
||||
lzma/hardware.h \
|
||||
lzma/index.h \
|
||||
lzma/index_hash.h \
|
||||
lzma/lzma.h \
|
||||
lzma/lzma12.h \
|
||||
lzma/stream_flags.h \
|
||||
lzma/version.h \
|
||||
lzma/vli.h
|
||||
|
||||
@@ -82,12 +82,20 @@
|
||||
# if !defined(UINT32_C) || !defined(UINT64_C) \
|
||||
|| !defined(UINT32_MAX) || !defined(UINT64_MAX)
|
||||
/*
|
||||
* MSVC has no C99 support, and thus it cannot be used to
|
||||
* compile liblzma. The liblzma API has to still be usable
|
||||
* from MSVC, so we need to define the required standard
|
||||
* integer types here.
|
||||
* MSVC versions older than 2013 have no C99 support, and
|
||||
* thus they cannot be used to compile liblzma. Using an
|
||||
* existing liblzma.dll with old MSVC can work though(*),
|
||||
* but we need to define the required standard integer
|
||||
* types here in a MSVC-specific way.
|
||||
*
|
||||
* (*) If you do this, the existing liblzma.dll probably uses
|
||||
* a different runtime library than your MSVC-built
|
||||
* application. Mixing runtimes is generally bad, but
|
||||
* in this case it should work as long as you avoid
|
||||
* the few rarely-needed liblzma functions that allocate
|
||||
* memory and expect the caller to free it using free().
|
||||
*/
|
||||
# if defined(_WIN32) && defined(_MSC_VER)
|
||||
# if defined(_WIN32) && defined(_MSC_VER) && _MSC_VER < 1800
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
@@ -211,7 +219,11 @@
|
||||
*/
|
||||
#ifndef lzma_nothrow
|
||||
# if defined(__cplusplus)
|
||||
# define lzma_nothrow throw()
|
||||
# if __cplusplus >= 201103L
|
||||
# define lzma_nothrow noexcept
|
||||
# else
|
||||
# define lzma_nothrow throw()
|
||||
# endif
|
||||
# elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
|
||||
# define lzma_nothrow __attribute__((__nothrow__))
|
||||
# else
|
||||
@@ -286,7 +298,7 @@ extern "C" {
|
||||
#include "lzma/filter.h"
|
||||
#include "lzma/bcj.h"
|
||||
#include "lzma/delta.h"
|
||||
#include "lzma/lzma.h"
|
||||
#include "lzma/lzma12.h"
|
||||
|
||||
/* Container formats */
|
||||
#include "lzma/container.h"
|
||||
|
||||
@@ -234,18 +234,35 @@ typedef enum {
|
||||
* can be a sign of a bug in liblzma. See the documentation
|
||||
* how to report bugs.
|
||||
*/
|
||||
|
||||
LZMA_SEEK_NEEDED = 12
|
||||
/**<
|
||||
* \brief Request to change the input file position
|
||||
*
|
||||
* Some coders can do random access in the input file. The
|
||||
* initialization functions of these coders take the file size
|
||||
* as an argument. No other coders can return LZMA_SEEK_NEEDED.
|
||||
*
|
||||
* When this value is returned, the application must seek to
|
||||
* the file position given in lzma_stream.seek_pos. This value
|
||||
* is guaranteed to never exceed the file size that was
|
||||
* specified at the coder initialization.
|
||||
*
|
||||
* After seeking the application should read new input and
|
||||
* pass it normally via lzma_stream.next_in and .avail_in.
|
||||
*/
|
||||
} lzma_ret;
|
||||
|
||||
|
||||
/**
|
||||
* \brief The `action' argument for lzma_code()
|
||||
*
|
||||
* After the first use of LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, or LZMA_FINISH,
|
||||
* the same `action' must is used until lzma_code() returns LZMA_STREAM_END.
|
||||
* Also, the amount of input (that is, strm->avail_in) must not be modified
|
||||
* by the application until lzma_code() returns LZMA_STREAM_END. Changing the
|
||||
* `action' or modifying the amount of input will make lzma_code() return
|
||||
* LZMA_PROG_ERROR.
|
||||
* After the first use of LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, LZMA_FULL_BARRIER,
|
||||
* or LZMA_FINISH, the same `action' must is used until lzma_code() returns
|
||||
* LZMA_STREAM_END. Also, the amount of input (that is, strm->avail_in) must
|
||||
* not be modified by the application until lzma_code() returns
|
||||
* LZMA_STREAM_END. Changing the `action' or modifying the amount of input
|
||||
* will make lzma_code() return LZMA_PROG_ERROR.
|
||||
*/
|
||||
typedef enum {
|
||||
LZMA_RUN = 0,
|
||||
@@ -293,7 +310,7 @@ typedef enum {
|
||||
*
|
||||
* All the input data going to the current Block must have
|
||||
* been given to the encoder (the last bytes can still be
|
||||
* pending in* next_in). Call lzma_code() with LZMA_FULL_FLUSH
|
||||
* pending in *next_in). Call lzma_code() with LZMA_FULL_FLUSH
|
||||
* until it returns LZMA_STREAM_END. Then continue normally
|
||||
* with LZMA_RUN or finish the Stream with LZMA_FINISH.
|
||||
*
|
||||
@@ -302,6 +319,29 @@ typedef enum {
|
||||
* no unfinished Block, no empty Block is created.
|
||||
*/
|
||||
|
||||
LZMA_FULL_BARRIER = 4,
|
||||
/**<
|
||||
* \brief Finish encoding of the current Block
|
||||
*
|
||||
* This is like LZMA_FULL_FLUSH except that this doesn't
|
||||
* necessarily wait until all the input has been made
|
||||
* available via the output buffer. That is, lzma_code()
|
||||
* might return LZMA_STREAM_END as soon as all the input
|
||||
* has been consumed (avail_in == 0).
|
||||
*
|
||||
* LZMA_FULL_BARRIER is useful with a threaded encoder if
|
||||
* one wants to split the .xz Stream into Blocks at specific
|
||||
* offsets but doesn't care if the output isn't flushed
|
||||
* immediately. Using LZMA_FULL_BARRIER allows keeping
|
||||
* the threads busy while LZMA_FULL_FLUSH would make
|
||||
* lzma_code() wait until all the threads have finished
|
||||
* until more data could be passed to the encoder.
|
||||
*
|
||||
* With a lzma_stream initialized with the single-threaded
|
||||
* lzma_stream_encoder() or lzma_easy_encoder(),
|
||||
* LZMA_FULL_BARRIER is an alias for LZMA_FULL_FLUSH.
|
||||
*/
|
||||
|
||||
LZMA_FINISH = 3
|
||||
/**<
|
||||
* \brief Finish the coding operation
|
||||
@@ -456,7 +496,8 @@ typedef struct lzma_internal_s lzma_internal;
|
||||
*
|
||||
* Application may modify the values of total_in and total_out as it wants.
|
||||
* They are updated by liblzma to match the amount of data read and
|
||||
* written, but aren't used for anything else.
|
||||
* written but aren't used for anything else except as a possible return
|
||||
* values from lzma_get_progress().
|
||||
*/
|
||||
typedef struct {
|
||||
const uint8_t *next_in; /**< Pointer to the next input byte. */
|
||||
@@ -472,8 +513,10 @@ typedef struct {
|
||||
*
|
||||
* In most cases this is NULL which makes liblzma use
|
||||
* the standard malloc() and free().
|
||||
*
|
||||
* \note In 5.0.x this is not a const pointer.
|
||||
*/
|
||||
lzma_allocator *allocator;
|
||||
const lzma_allocator *allocator;
|
||||
|
||||
/** Internal state is not visible to applications. */
|
||||
lzma_internal *internal;
|
||||
@@ -488,7 +531,19 @@ typedef struct {
|
||||
void *reserved_ptr2;
|
||||
void *reserved_ptr3;
|
||||
void *reserved_ptr4;
|
||||
uint64_t reserved_int1;
|
||||
|
||||
/**
|
||||
* \brief New seek input position for LZMA_SEEK_NEEDED
|
||||
*
|
||||
* When lzma_code() returns LZMA_SEEK_NEEDED, the new input position
|
||||
* needed by liblzma will be available seek_pos. The value is
|
||||
* guaranteed to not exceed the file size that was specified when
|
||||
* this lzma_stream was initialized.
|
||||
*
|
||||
* In all other situations the value of this variable is undefined.
|
||||
*/
|
||||
uint64_t seek_pos;
|
||||
|
||||
uint64_t reserved_int2;
|
||||
size_t reserved_int3;
|
||||
size_t reserved_int4;
|
||||
@@ -554,6 +609,25 @@ extern LZMA_API(lzma_ret) lzma_code(lzma_stream *strm, lzma_action action)
|
||||
extern LZMA_API(void) lzma_end(lzma_stream *strm) lzma_nothrow;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Get progress information
|
||||
*
|
||||
* In single-threaded mode, applications can get progress information from
|
||||
* strm->total_in and strm->total_out. In multi-threaded mode this is less
|
||||
* useful because a significant amount of both input and output data gets
|
||||
* buffered internally by liblzma. This makes total_in and total_out give
|
||||
* misleading information and also makes the progress indicator updates
|
||||
* non-smooth.
|
||||
*
|
||||
* This function gives realistic progress information also in multi-threaded
|
||||
* mode by taking into account the progress made by each thread. In
|
||||
* single-threaded mode *progress_in and *progress_out are set to
|
||||
* strm->total_in and strm->total_out, respectively.
|
||||
*/
|
||||
extern LZMA_API(void) lzma_get_progress(lzma_stream *strm,
|
||||
uint64_t *progress_in, uint64_t *progress_out) lzma_nothrow;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Get the memory usage of decoder filter chain
|
||||
*
|
||||
@@ -599,11 +673,16 @@ extern LZMA_API(uint64_t) lzma_memlimit_get(const lzma_stream *strm)
|
||||
* This function is supported only when *strm has been initialized with
|
||||
* a function that takes a memlimit argument.
|
||||
*
|
||||
* liblzma 5.2.3 and earlier has a bug where memlimit value of 0 causes
|
||||
* this function to do nothing (leaving the limit unchanged) and still
|
||||
* return LZMA_OK. Later versions treat 0 as if 1 had been specified (so
|
||||
* lzma_memlimit_get() will return 1 even if you specify 0 here).
|
||||
*
|
||||
* \return - LZMA_OK: New memory usage limit successfully set.
|
||||
* - LZMA_MEMLIMIT_ERROR: The new limit is too small.
|
||||
* The limit was not changed.
|
||||
* - LZMA_PROG_ERROR: Invalid arguments, e.g. *strm doesn't
|
||||
* support memory usage limit or memlimit was zero.
|
||||
* support memory usage limit.
|
||||
*/
|
||||
extern LZMA_API(lzma_ret) lzma_memlimit_set(
|
||||
lzma_stream *strm, uint64_t memlimit) lzma_nothrow;
|
||||
|
||||
@@ -31,11 +31,16 @@ typedef struct {
|
||||
/**
|
||||
* \brief Block format version
|
||||
*
|
||||
* To prevent API and ABI breakages if new features are needed in
|
||||
* the Block field, a version number is used to indicate which
|
||||
* fields in this structure are in use. For now, version must always
|
||||
* be zero. With non-zero version, most Block related functions will
|
||||
* return LZMA_OPTIONS_ERROR.
|
||||
* To prevent API and ABI breakages when new features are needed,
|
||||
* a version number is used to indicate which fields in this
|
||||
* structure are in use:
|
||||
* - liblzma >= 5.0.0: version = 0 is supported.
|
||||
* - liblzma >= 5.1.4beta: Support for version = 1 was added,
|
||||
* which adds the ignore_check field.
|
||||
*
|
||||
* If version is greater than one, most Block related functions
|
||||
* will return LZMA_OPTIONS_ERROR (lzma_block_header_decode() works
|
||||
* with any version value).
|
||||
*
|
||||
* Read by:
|
||||
* - All functions that take pointer to lzma_block as argument,
|
||||
@@ -233,7 +238,28 @@ typedef struct {
|
||||
lzma_reserved_enum reserved_enum2;
|
||||
lzma_reserved_enum reserved_enum3;
|
||||
lzma_reserved_enum reserved_enum4;
|
||||
lzma_bool reserved_bool1;
|
||||
|
||||
/**
|
||||
* \brief A flag to Block decoder to not verify the Check field
|
||||
*
|
||||
* This field is supported by liblzma >= 5.1.4beta if .version >= 1.
|
||||
*
|
||||
* If this is set to true, the integrity check won't be calculated
|
||||
* and verified. Unless you know what you are doing, you should
|
||||
* leave this to false. (A reason to set this to true is when the
|
||||
* file integrity is verified externally anyway and you want to
|
||||
* speed up the decompression, which matters mostly when using
|
||||
* SHA-256 as the integrity check.)
|
||||
*
|
||||
* If .version >= 1, read by:
|
||||
* - lzma_block_decoder()
|
||||
* - lzma_block_buffer_decode()
|
||||
*
|
||||
* Written by (.version is ignored):
|
||||
* - lzma_block_header_decode() always sets this to false
|
||||
*/
|
||||
lzma_bool ignore_check;
|
||||
|
||||
lzma_bool reserved_bool2;
|
||||
lzma_bool reserved_bool3;
|
||||
lzma_bool reserved_bool4;
|
||||
@@ -310,14 +336,21 @@ extern LZMA_API(lzma_ret) lzma_block_header_encode(
|
||||
/**
|
||||
* \brief Decode Block Header
|
||||
*
|
||||
* block->version should be set to the highest value supported by the
|
||||
* application; currently the only possible version is zero. This function
|
||||
* will set version to the lowest value that still supports all the features
|
||||
* required by the Block Header.
|
||||
* block->version should (usually) be set to the highest value supported
|
||||
* by the application. If the application sets block->version to a value
|
||||
* higher than supported by the current liblzma version, this function will
|
||||
* downgrade block->version to the highest value supported by it. Thus one
|
||||
* should check the value of block->version after calling this function if
|
||||
* block->version was set to a non-zero value and the application doesn't
|
||||
* otherwise know that the liblzma version being used is new enough to
|
||||
* support the specified block->version.
|
||||
*
|
||||
* The size of the Block Header must have already been decoded with
|
||||
* lzma_block_header_size_decode() macro and stored to block->header_size.
|
||||
*
|
||||
* The integrity check type from Stream Header must have been stored
|
||||
* to block->check.
|
||||
*
|
||||
* block->filters must have been allocated, but they don't need to be
|
||||
* initialized (possible existing filter options are not freed).
|
||||
*
|
||||
@@ -341,7 +374,7 @@ extern LZMA_API(lzma_ret) lzma_block_header_encode(
|
||||
* block->header_size is invalid or block->filters is NULL.
|
||||
*/
|
||||
extern LZMA_API(lzma_ret) lzma_block_header_decode(lzma_block *block,
|
||||
lzma_allocator *allocator, const uint8_t *in)
|
||||
const lzma_allocator *allocator, const uint8_t *in)
|
||||
lzma_nothrow lzma_attr_warn_unused_result;
|
||||
|
||||
|
||||
@@ -490,7 +523,25 @@ extern LZMA_API(size_t) lzma_block_buffer_bound(size_t uncompressed_size)
|
||||
* - LZMA_PROG_ERROR
|
||||
*/
|
||||
extern LZMA_API(lzma_ret) lzma_block_buffer_encode(
|
||||
lzma_block *block, lzma_allocator *allocator,
|
||||
lzma_block *block, const lzma_allocator *allocator,
|
||||
const uint8_t *in, size_t in_size,
|
||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||
lzma_nothrow lzma_attr_warn_unused_result;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Single-call uncompressed .xz Block encoder
|
||||
*
|
||||
* This is like lzma_block_buffer_encode() except this doesn't try to
|
||||
* compress the data and instead encodes the data using LZMA2 uncompressed
|
||||
* chunks. The required output buffer size can be determined with
|
||||
* lzma_block_buffer_bound().
|
||||
*
|
||||
* Since the data won't be compressed, this function ignores block->filters.
|
||||
* This function doesn't take lzma_allocator because this function doesn't
|
||||
* allocate any memory from the heap.
|
||||
*/
|
||||
extern LZMA_API(lzma_ret) lzma_block_uncomp_encode(lzma_block *block,
|
||||
const uint8_t *in, size_t in_size,
|
||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||
lzma_nothrow lzma_attr_warn_unused_result;
|
||||
@@ -524,7 +575,7 @@ extern LZMA_API(lzma_ret) lzma_block_buffer_encode(
|
||||
* - LZMA_PROG_ERROR
|
||||
*/
|
||||
extern LZMA_API(lzma_ret) lzma_block_buffer_decode(
|
||||
lzma_block *block, lzma_allocator *allocator,
|
||||
lzma_block *block, const lzma_allocator *allocator,
|
||||
const uint8_t *in, size_t *in_pos, size_t in_size,
|
||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||
lzma_nothrow;
|
||||
|
||||
@@ -60,7 +60,6 @@
|
||||
#define LZMA_PRESET_EXTREME (UINT32_C(1) << 31)
|
||||
|
||||
|
||||
#ifdef LZMA_UNSTABLE /* Unstable API that may change. Use only for testing. */
|
||||
/**
|
||||
* \brief Multithreading options
|
||||
*/
|
||||
@@ -97,6 +96,10 @@ typedef struct {
|
||||
* Set this to 0 to let liblzma choose the block size depending
|
||||
* on the compression options. For LZMA2 it will be 3*dict_size
|
||||
* or 1 MiB, whichever is more.
|
||||
*
|
||||
* For each thread, about 3 * block_size bytes of memory will be
|
||||
* allocated. This may change in later liblzma versions. If so,
|
||||
* the memory usage will probably be reduced, not increased.
|
||||
*/
|
||||
uint64_t block_size;
|
||||
|
||||
@@ -180,7 +183,6 @@ typedef struct {
|
||||
void *reserved_ptr4;
|
||||
|
||||
} lzma_mt;
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
@@ -288,7 +290,8 @@ extern LZMA_API(lzma_ret) lzma_easy_encoder(
|
||||
*/
|
||||
extern LZMA_API(lzma_ret) lzma_easy_buffer_encode(
|
||||
uint32_t preset, lzma_check check,
|
||||
lzma_allocator *allocator, const uint8_t *in, size_t in_size,
|
||||
const lzma_allocator *allocator,
|
||||
const uint8_t *in, size_t in_size,
|
||||
uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;
|
||||
|
||||
|
||||
@@ -313,7 +316,6 @@ extern LZMA_API(lzma_ret) lzma_stream_encoder(lzma_stream *strm,
|
||||
lzma_nothrow lzma_attr_warn_unused_result;
|
||||
|
||||
|
||||
#ifdef LZMA_UNSTABLE /* Unstable API that may change. Use only for testing. */
|
||||
/**
|
||||
* \brief Calculate approximate memory usage of multithreaded .xz encoder
|
||||
*
|
||||
@@ -339,8 +341,9 @@ extern LZMA_API(uint64_t) lzma_stream_encoder_mt_memusage(
|
||||
* This provides the functionality of lzma_easy_encoder() and
|
||||
* lzma_stream_encoder() as a single function for multithreaded use.
|
||||
*
|
||||
* TODO: For lzma_code(), only LZMA_RUN and LZMA_FINISH are currently
|
||||
* supported. Support for other actions has been planned.
|
||||
* The supported actions for lzma_code() are LZMA_RUN, LZMA_FULL_FLUSH,
|
||||
* LZMA_FULL_BARRIER, and LZMA_FINISH. Support for LZMA_SYNC_FLUSH might be
|
||||
* added in the future.
|
||||
*
|
||||
* \param strm Pointer to properly prepared lzma_stream
|
||||
* \param options Pointer to multithreaded compression options
|
||||
@@ -354,7 +357,6 @@ extern LZMA_API(uint64_t) lzma_stream_encoder_mt_memusage(
|
||||
extern LZMA_API(lzma_ret) lzma_stream_encoder_mt(
|
||||
lzma_stream *strm, const lzma_mt *options)
|
||||
lzma_nothrow lzma_attr_warn_unused_result;
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
@@ -436,7 +438,8 @@ extern LZMA_API(size_t) lzma_stream_buffer_bound(size_t uncompressed_size)
|
||||
*/
|
||||
extern LZMA_API(lzma_ret) lzma_stream_buffer_encode(
|
||||
lzma_filter *filters, lzma_check check,
|
||||
lzma_allocator *allocator, const uint8_t *in, size_t in_size,
|
||||
const lzma_allocator *allocator,
|
||||
const uint8_t *in, size_t in_size,
|
||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||
lzma_nothrow lzma_attr_warn_unused_result;
|
||||
|
||||
@@ -471,6 +474,30 @@ extern LZMA_API(lzma_ret) lzma_stream_buffer_encode(
|
||||
#define LZMA_TELL_ANY_CHECK UINT32_C(0x04)
|
||||
|
||||
|
||||
/**
|
||||
* This flag makes lzma_code() not calculate and verify the integrity check
|
||||
* of the compressed data in .xz files. This means that invalid integrity
|
||||
* check values won't be detected and LZMA_DATA_ERROR won't be returned in
|
||||
* such cases.
|
||||
*
|
||||
* This flag only affects the checks of the compressed data itself; the CRC32
|
||||
* values in the .xz headers will still be verified normally.
|
||||
*
|
||||
* Don't use this flag unless you know what you are doing. Possible reasons
|
||||
* to use this flag:
|
||||
*
|
||||
* - Trying to recover data from a corrupt .xz file.
|
||||
*
|
||||
* - Speeding up decompression, which matters mostly with SHA-256
|
||||
* or with files that have compressed extremely well. It's recommended
|
||||
* to not use this flag for this purpose unless the file integrity is
|
||||
* verified externally in some other way.
|
||||
*
|
||||
* Support for this flag was added in liblzma 5.1.4beta.
|
||||
*/
|
||||
#define LZMA_IGNORE_CHECK UINT32_C(0x10)
|
||||
|
||||
|
||||
/**
|
||||
* This flag enables decoding of concatenated files with file formats that
|
||||
* allow concatenating compressed files as is. From the formats currently
|
||||
@@ -493,7 +520,10 @@ extern LZMA_API(lzma_ret) lzma_stream_buffer_encode(
|
||||
*
|
||||
* \param strm Pointer to properly prepared lzma_stream
|
||||
* \param memlimit Memory usage limit as bytes. Use UINT64_MAX
|
||||
* to effectively disable the limiter.
|
||||
* to effectively disable the limiter. liblzma
|
||||
* 5.2.3 and earlier don't allow 0 here and return
|
||||
* LZMA_PROG_ERROR; later versions treat 0 as if 1
|
||||
* had been specified.
|
||||
* \param flags Bitwise-or of zero or more of the decoder flags:
|
||||
* LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK,
|
||||
* LZMA_TELL_ANY_CHECK, LZMA_CONCATENATED
|
||||
@@ -517,7 +547,10 @@ extern LZMA_API(lzma_ret) lzma_stream_decoder(
|
||||
*
|
||||
* \param strm Pointer to properly prepared lzma_stream
|
||||
* \param memlimit Memory usage limit as bytes. Use UINT64_MAX
|
||||
* to effectively disable the limiter.
|
||||
* to effectively disable the limiter. liblzma
|
||||
* 5.2.3 and earlier don't allow 0 here and return
|
||||
* LZMA_PROG_ERROR; later versions treat 0 as if 1
|
||||
* had been specified.
|
||||
* \param flags Bitwise-or of flags, or zero for no flags.
|
||||
*
|
||||
* \return - LZMA_OK: Initialization was successful.
|
||||
@@ -533,9 +566,16 @@ extern LZMA_API(lzma_ret) lzma_auto_decoder(
|
||||
/**
|
||||
* \brief Initialize .lzma decoder (legacy file format)
|
||||
*
|
||||
* \param strm Pointer to properly prepared lzma_stream
|
||||
* \param memlimit Memory usage limit as bytes. Use UINT64_MAX
|
||||
* to effectively disable the limiter. liblzma
|
||||
* 5.2.3 and earlier don't allow 0 here and return
|
||||
* LZMA_PROG_ERROR; later versions treat 0 as if 1
|
||||
* had been specified.
|
||||
*
|
||||
* Valid `action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH.
|
||||
* There is no need to use LZMA_FINISH, but allowing it may simplify
|
||||
* certain types of applications.
|
||||
* There is no need to use LZMA_FINISH, but it's allowed because it may
|
||||
* simplify certain types of applications.
|
||||
*
|
||||
* \return - LZMA_OK
|
||||
* - LZMA_MEM_ERROR
|
||||
@@ -585,7 +625,8 @@ extern LZMA_API(lzma_ret) lzma_alone_decoder(
|
||||
* - LZMA_PROG_ERROR
|
||||
*/
|
||||
extern LZMA_API(lzma_ret) lzma_stream_buffer_decode(
|
||||
uint64_t *memlimit, uint32_t flags, lzma_allocator *allocator,
|
||||
uint64_t *memlimit, uint32_t flags,
|
||||
const lzma_allocator *allocator,
|
||||
const uint8_t *in, size_t *in_pos, size_t in_size,
|
||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||
lzma_nothrow lzma_attr_warn_unused_result;
|
||||
|
||||
@@ -116,8 +116,9 @@ extern LZMA_API(lzma_bool) lzma_filter_decoder_is_supported(lzma_vli id)
|
||||
* is not NULL.
|
||||
* - LZMA_PROG_ERROR: src or dest is NULL.
|
||||
*/
|
||||
extern LZMA_API(lzma_ret) lzma_filters_copy(const lzma_filter *src,
|
||||
lzma_filter *dest, lzma_allocator *allocator) lzma_nothrow;
|
||||
extern LZMA_API(lzma_ret) lzma_filters_copy(
|
||||
const lzma_filter *src, lzma_filter *dest,
|
||||
const lzma_allocator *allocator) lzma_nothrow;
|
||||
|
||||
|
||||
/**
|
||||
@@ -256,7 +257,7 @@ extern LZMA_API(lzma_ret) lzma_filters_update(
|
||||
* won't necessarily meet that bound.)
|
||||
*/
|
||||
extern LZMA_API(lzma_ret) lzma_raw_buffer_encode(
|
||||
const lzma_filter *filters, lzma_allocator *allocator,
|
||||
const lzma_filter *filters, const lzma_allocator *allocator,
|
||||
const uint8_t *in, size_t in_size, uint8_t *out,
|
||||
size_t *out_pos, size_t out_size) lzma_nothrow;
|
||||
|
||||
@@ -280,7 +281,7 @@ extern LZMA_API(lzma_ret) lzma_raw_buffer_encode(
|
||||
* which no data is written to is out[out_size].
|
||||
*/
|
||||
extern LZMA_API(lzma_ret) lzma_raw_buffer_decode(
|
||||
const lzma_filter *filters, lzma_allocator *allocator,
|
||||
const lzma_filter *filters, const lzma_allocator *allocator,
|
||||
const uint8_t *in, size_t *in_pos, size_t in_size,
|
||||
uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;
|
||||
|
||||
@@ -340,9 +341,10 @@ extern LZMA_API(lzma_ret) lzma_properties_encode(
|
||||
* \param filter filter->id must have been set to the correct
|
||||
* Filter ID. filter->options doesn't need to be
|
||||
* initialized (it's not freed by this function). The
|
||||
* decoded options will be stored to filter->options.
|
||||
* filter->options is set to NULL if there are no
|
||||
* properties or if an error occurs.
|
||||
* decoded options will be stored in filter->options;
|
||||
* it's application's responsibility to free it when
|
||||
* appropriate. filter->options is set to NULL if
|
||||
* there are no properties or if an error occurs.
|
||||
* \param allocator Custom memory allocator used to allocate the
|
||||
* options. Set to NULL to use the default malloc(),
|
||||
* and in case of an error, also free().
|
||||
@@ -356,7 +358,7 @@ extern LZMA_API(lzma_ret) lzma_properties_encode(
|
||||
* - LZMA_MEM_ERROR
|
||||
*/
|
||||
extern LZMA_API(lzma_ret) lzma_properties_decode(
|
||||
lzma_filter *filter, lzma_allocator *allocator,
|
||||
lzma_filter *filter, const lzma_allocator *allocator,
|
||||
const uint8_t *props, size_t props_size) lzma_nothrow;
|
||||
|
||||
|
||||
@@ -419,6 +421,6 @@ extern LZMA_API(lzma_ret) lzma_filter_flags_encode(const lzma_filter *filter,
|
||||
* - LZMA_PROG_ERROR
|
||||
*/
|
||||
extern LZMA_API(lzma_ret) lzma_filter_flags_decode(
|
||||
lzma_filter *filter, lzma_allocator *allocator,
|
||||
lzma_filter *filter, const lzma_allocator *allocator,
|
||||
const uint8_t *in, size_t *in_pos, size_t in_size)
|
||||
lzma_nothrow lzma_attr_warn_unused_result;
|
||||
|
||||
@@ -48,3 +48,17 @@
|
||||
* of RAM on the specific operating system.
|
||||
*/
|
||||
extern LZMA_API(uint64_t) lzma_physmem(void) lzma_nothrow;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Get the number of processor cores or threads
|
||||
*
|
||||
* This function may be useful when determining how many threads to use.
|
||||
* If the hardware supports more than one thread per CPU core, the number
|
||||
* of hardware threads is returned if that information is available.
|
||||
*
|
||||
* \brief On success, the number of available CPU threads or cores is
|
||||
* returned. If this information isn't available or an error
|
||||
* occurs, zero is returned.
|
||||
*/
|
||||
extern LZMA_API(uint32_t) lzma_cputhreads(void) lzma_nothrow;
|
||||
|
||||
@@ -303,7 +303,7 @@ extern LZMA_API(uint64_t) lzma_index_memused(const lzma_index *i)
|
||||
* \return On success, a pointer to an empty initialized lzma_index is
|
||||
* returned. If allocation fails, NULL is returned.
|
||||
*/
|
||||
extern LZMA_API(lzma_index *) lzma_index_init(lzma_allocator *allocator)
|
||||
extern LZMA_API(lzma_index *) lzma_index_init(const lzma_allocator *allocator)
|
||||
lzma_nothrow;
|
||||
|
||||
|
||||
@@ -312,8 +312,8 @@ extern LZMA_API(lzma_index *) lzma_index_init(lzma_allocator *allocator)
|
||||
*
|
||||
* If i is NULL, this does nothing.
|
||||
*/
|
||||
extern LZMA_API(void) lzma_index_end(lzma_index *i, lzma_allocator *allocator)
|
||||
lzma_nothrow;
|
||||
extern LZMA_API(void) lzma_index_end(
|
||||
lzma_index *i, const lzma_allocator *allocator) lzma_nothrow;
|
||||
|
||||
|
||||
/**
|
||||
@@ -341,7 +341,7 @@ extern LZMA_API(void) lzma_index_end(lzma_index *i, lzma_allocator *allocator)
|
||||
* - LZMA_PROG_ERROR
|
||||
*/
|
||||
extern LZMA_API(lzma_ret) lzma_index_append(
|
||||
lzma_index *i, lzma_allocator *allocator,
|
||||
lzma_index *i, const lzma_allocator *allocator,
|
||||
lzma_vli unpadded_size, lzma_vli uncompressed_size)
|
||||
lzma_nothrow lzma_attr_warn_unused_result;
|
||||
|
||||
@@ -564,8 +564,8 @@ extern LZMA_API(lzma_bool) lzma_index_iter_locate(
|
||||
* - LZMA_MEM_ERROR
|
||||
* - LZMA_PROG_ERROR
|
||||
*/
|
||||
extern LZMA_API(lzma_ret) lzma_index_cat(
|
||||
lzma_index *dest, lzma_index *src, lzma_allocator *allocator)
|
||||
extern LZMA_API(lzma_ret) lzma_index_cat(lzma_index *dest, lzma_index *src,
|
||||
const lzma_allocator *allocator)
|
||||
lzma_nothrow lzma_attr_warn_unused_result;
|
||||
|
||||
|
||||
@@ -575,7 +575,7 @@ extern LZMA_API(lzma_ret) lzma_index_cat(
|
||||
* \return A copy of the lzma_index, or NULL if memory allocation failed.
|
||||
*/
|
||||
extern LZMA_API(lzma_index *) lzma_index_dup(
|
||||
const lzma_index *i, lzma_allocator *allocator)
|
||||
const lzma_index *i, const lzma_allocator *allocator)
|
||||
lzma_nothrow lzma_attr_warn_unused_result;
|
||||
|
||||
|
||||
@@ -586,8 +586,7 @@ extern LZMA_API(lzma_index *) lzma_index_dup(
|
||||
* \param i Pointer to lzma_index which should be encoded.
|
||||
*
|
||||
* The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH.
|
||||
* It is enough to use only one of them (you can choose freely; use LZMA_RUN
|
||||
* to support liblzma versions older than 5.0.0).
|
||||
* It is enough to use only one of them (you can choose freely).
|
||||
*
|
||||
* \return - LZMA_OK: Initialization succeeded, continue with lzma_code().
|
||||
* - LZMA_MEM_ERROR
|
||||
@@ -610,16 +609,21 @@ extern LZMA_API(lzma_ret) lzma_index_encoder(
|
||||
* to a new lzma_index, which the application
|
||||
* has to later free with lzma_index_end().
|
||||
* \param memlimit How much memory the resulting lzma_index is
|
||||
* allowed to require.
|
||||
* allowed to require. liblzma 5.2.3 and earlier
|
||||
* don't allow 0 here and return LZMA_PROG_ERROR;
|
||||
* later versions treat 0 as if 1 had been specified.
|
||||
*
|
||||
* The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH.
|
||||
* It is enough to use only one of them (you can choose freely; use LZMA_RUN
|
||||
* to support liblzma versions older than 5.0.0).
|
||||
* Valid `action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH.
|
||||
* There is no need to use LZMA_FINISH, but it's allowed because it may
|
||||
* simplify certain types of applications.
|
||||
*
|
||||
* \return - LZMA_OK: Initialization succeeded, continue with lzma_code().
|
||||
* - LZMA_MEM_ERROR
|
||||
* - LZMA_MEMLIMIT_ERROR
|
||||
* - LZMA_PROG_ERROR
|
||||
*
|
||||
* liblzma 5.2.3 and older list also LZMA_MEMLIMIT_ERROR here
|
||||
* but that error code has never been possible from this
|
||||
* initialization function.
|
||||
*/
|
||||
extern LZMA_API(lzma_ret) lzma_index_decoder(
|
||||
lzma_stream *strm, lzma_index **i, uint64_t memlimit)
|
||||
@@ -677,6 +681,72 @@ extern LZMA_API(lzma_ret) lzma_index_buffer_encode(const lzma_index *i,
|
||||
* - LZMA_PROG_ERROR
|
||||
*/
|
||||
extern LZMA_API(lzma_ret) lzma_index_buffer_decode(lzma_index **i,
|
||||
uint64_t *memlimit, lzma_allocator *allocator,
|
||||
uint64_t *memlimit, const lzma_allocator *allocator,
|
||||
const uint8_t *in, size_t *in_pos, size_t in_size)
|
||||
lzma_nothrow;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Initialize a .xz file information decoder
|
||||
*
|
||||
* \param strm Pointer to a properly prepared lzma_stream
|
||||
* \param dest_index Pointer to a pointer where the decoder will put
|
||||
* the decoded lzma_index. The old value
|
||||
* of *dest_index is ignored (not freed).
|
||||
* \param memlimit How much memory the resulting lzma_index is
|
||||
* allowed to require. Use UINT64_MAX to
|
||||
* effectively disable the limiter.
|
||||
* \param file_size Size of the input .xz file
|
||||
*
|
||||
* This decoder decodes the Stream Header, Stream Footer, Index, and
|
||||
* Stream Padding field(s) from the input .xz file and stores the resulting
|
||||
* combined index in *dest_index. This information can be used to get the
|
||||
* uncompressed file size with lzma_index_uncompressed_size(*dest_index) or,
|
||||
* for example, to implement random access reading by locating the Blocks
|
||||
* in the Streams.
|
||||
*
|
||||
* To get the required information from the .xz file, lzma_code() may ask
|
||||
* the application to seek in the input file by returning LZMA_SEEK_NEEDED
|
||||
* and having the target file position specified in lzma_stream.seek_pos.
|
||||
* The number of seeks required depends on the input file and how big buffers
|
||||
* the application provides. When possible, the decoder will seek backward
|
||||
* and forward in the given buffer to avoid useless seek requests. Thus, if
|
||||
* the application provides the whole file at once, no external seeking will
|
||||
* be required (that is, lzma_code() won't return LZMA_SEEK_NEEDED).
|
||||
*
|
||||
* The value in lzma_stream.total_in can be used to estimate how much data
|
||||
* liblzma had to read to get the file information. However, due to seeking
|
||||
* and the way total_in is updated, the value of total_in will be somewhat
|
||||
* inaccurate (a little too big). Thus, total_in is a good estimate but don't
|
||||
* expect to see the same exact value for the same file if you change the
|
||||
* input buffer size or switch to a different liblzma version.
|
||||
*
|
||||
* Valid `action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH.
|
||||
* You only need to use LZMA_RUN; LZMA_FINISH is only supported because it
|
||||
* might be convenient for some applications. If you use LZMA_FINISH and if
|
||||
* lzma_code() asks the application to seek, remember to reset `action' back
|
||||
* to LZMA_RUN unless you hit the end of the file again.
|
||||
*
|
||||
* Possible return values from lzma_code():
|
||||
* - LZMA_OK: All OK so far, more input needed
|
||||
* - LZMA_SEEK_NEEDED: Provide more input starting from the absolute
|
||||
* file position strm->seek_pos
|
||||
* - LZMA_STREAM_END: Decoding was successful, *dest_index has been set
|
||||
* - LZMA_FORMAT_ERROR: The input file is not in the .xz format (the
|
||||
* expected magic bytes were not found from the beginning of the file)
|
||||
* - LZMA_OPTIONS_ERROR: File looks valid but contains headers that aren't
|
||||
* supported by this version of liblzma
|
||||
* - LZMA_DATA_ERROR: File is corrupt
|
||||
* - LZMA_BUF_ERROR
|
||||
* - LZMA_MEM_ERROR
|
||||
* - LZMA_MEMLIMIT_ERROR
|
||||
* - LZMA_PROG_ERROR
|
||||
*
|
||||
* \return - LZMA_OK
|
||||
* - LZMA_MEM_ERROR
|
||||
* - LZMA_PROG_ERROR
|
||||
*/
|
||||
extern LZMA_API(lzma_ret) lzma_file_info_decoder(
|
||||
lzma_stream *strm, lzma_index **dest_index,
|
||||
uint64_t memlimit, uint64_t file_size)
|
||||
lzma_nothrow;
|
||||
|
||||
@@ -37,7 +37,7 @@ typedef struct lzma_index_hash_s lzma_index_hash;
|
||||
* pointer than the index_hash that was given as an argument.
|
||||
*/
|
||||
extern LZMA_API(lzma_index_hash *) lzma_index_hash_init(
|
||||
lzma_index_hash *index_hash, lzma_allocator *allocator)
|
||||
lzma_index_hash *index_hash, const lzma_allocator *allocator)
|
||||
lzma_nothrow lzma_attr_warn_unused_result;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ extern LZMA_API(lzma_index_hash *) lzma_index_hash_init(
|
||||
* \brief Deallocate lzma_index_hash structure
|
||||
*/
|
||||
extern LZMA_API(void) lzma_index_hash_end(
|
||||
lzma_index_hash *index_hash, lzma_allocator *allocator)
|
||||
lzma_index_hash *index_hash, const lzma_allocator *allocator)
|
||||
lzma_nothrow;
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* \file lzma/lzma.h
|
||||
* \file lzma/lzma12.h
|
||||
* \brief LZMA1 and LZMA2 filters
|
||||
*/
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* Version number split into components
|
||||
*/
|
||||
#define LZMA_VERSION_MAJOR 5
|
||||
#define LZMA_VERSION_MINOR 1
|
||||
#define LZMA_VERSION_MINOR 3
|
||||
#define LZMA_VERSION_PATCH 1
|
||||
#define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_ALPHA
|
||||
|
||||
|
||||
@@ -47,5 +47,7 @@ endif
|
||||
endif
|
||||
|
||||
if COND_CHECK_SHA256
|
||||
if COND_INTERNAL_SHA256
|
||||
liblzma_la_SOURCES += check/sha256.c
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -15,6 +15,53 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
// If the function for external SHA-256 is missing, use the internal SHA-256
|
||||
// code. Due to how configure works, these defines can only get defined when
|
||||
// both a usable header and a type have already been found.
|
||||
#if !(defined(HAVE_CC_SHA256_INIT) \
|
||||
|| defined(HAVE_SHA256_INIT) \
|
||||
|| defined(HAVE_SHA256INIT))
|
||||
# define HAVE_INTERNAL_SHA256 1
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INTERNAL_SHA256)
|
||||
// Nothing
|
||||
#elif defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H)
|
||||
# include <CommonCrypto/CommonDigest.h>
|
||||
#elif defined(HAVE_SHA256_H)
|
||||
# include <sys/types.h>
|
||||
# include <sha256.h>
|
||||
#elif defined(HAVE_SHA2_H)
|
||||
# include <sys/types.h>
|
||||
# include <sha2.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INTERNAL_SHA256)
|
||||
/// State for the internal SHA-256 implementation
|
||||
typedef struct {
|
||||
/// Internal state
|
||||
uint32_t state[8];
|
||||
|
||||
/// Size of the message excluding padding
|
||||
uint64_t size;
|
||||
} lzma_sha256_state;
|
||||
#elif defined(HAVE_CC_SHA256_CTX)
|
||||
typedef CC_SHA256_CTX lzma_sha256_state;
|
||||
#elif defined(HAVE_SHA256_CTX)
|
||||
typedef SHA256_CTX lzma_sha256_state;
|
||||
#elif defined(HAVE_SHA2_CTX)
|
||||
typedef SHA2_CTX lzma_sha256_state;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INTERNAL_SHA256)
|
||||
// Nothing
|
||||
#elif defined(HAVE_CC_SHA256_INIT)
|
||||
# define LZMA_SHA256FUNC(x) CC_SHA256_ ## x
|
||||
#elif defined(HAVE_SHA256_INIT)
|
||||
# define LZMA_SHA256FUNC(x) SHA256_ ## x
|
||||
#elif defined(HAVE_SHA256INIT)
|
||||
# define LZMA_SHA256FUNC(x) SHA256 ## x
|
||||
#endif
|
||||
|
||||
// Index hashing needs the best possible hash function (preferably
|
||||
// a cryptographic hash) for maximum reliability.
|
||||
@@ -43,14 +90,7 @@ typedef struct {
|
||||
union {
|
||||
uint32_t crc32;
|
||||
uint64_t crc64;
|
||||
|
||||
struct {
|
||||
/// Internal state
|
||||
uint32_t state[8];
|
||||
|
||||
/// Size of the message excluding padding
|
||||
uint64_t size;
|
||||
} sha256;
|
||||
lzma_sha256_state sha256;
|
||||
} state;
|
||||
|
||||
} lzma_check_state;
|
||||
@@ -82,6 +122,8 @@ extern void lzma_check_update(lzma_check_state *check, lzma_check type,
|
||||
extern void lzma_check_finish(lzma_check_state *check, lzma_check type);
|
||||
|
||||
|
||||
#ifndef LZMA_SHA256FUNC
|
||||
|
||||
/// Prepare SHA-256 state for new input.
|
||||
extern void lzma_sha256_init(lzma_check_state *check);
|
||||
|
||||
@@ -92,4 +134,39 @@ extern void lzma_sha256_update(
|
||||
/// Finish the SHA-256 calculation and store the result to check->buffer.u8.
|
||||
extern void lzma_sha256_finish(lzma_check_state *check);
|
||||
|
||||
|
||||
#else
|
||||
|
||||
static inline void
|
||||
lzma_sha256_init(lzma_check_state *check)
|
||||
{
|
||||
LZMA_SHA256FUNC(Init)(&check->state.sha256);
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
lzma_sha256_update(const uint8_t *buf, size_t size, lzma_check_state *check)
|
||||
{
|
||||
#if defined(HAVE_CC_SHA256_INIT) && SIZE_MAX > UINT32_MAX
|
||||
// Darwin's CC_SHA256_Update takes uint32_t as the buffer size,
|
||||
// so use a loop to support size_t.
|
||||
while (size > UINT32_MAX) {
|
||||
LZMA_SHA256FUNC(Update)(&check->state.sha256, buf, UINT32_MAX);
|
||||
buf += UINT32_MAX;
|
||||
size -= UINT32_MAX;
|
||||
}
|
||||
#endif
|
||||
|
||||
LZMA_SHA256FUNC(Update)(&check->state.sha256, buf, size);
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
lzma_sha256_finish(lzma_check_state *check)
|
||||
{
|
||||
LZMA_SHA256FUNC(Final)(check->buffer.u8, &check->state.sha256);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "crc_macros.h"
|
||||
|
||||
|
||||
// If you make any changes, do some bench marking! Seemingly unrelated
|
||||
// If you make any changes, do some benchmarking! Seemingly unrelated
|
||||
// changes can very easily ruin the performance (and very probably is
|
||||
// very compiler dependent).
|
||||
extern LZMA_API(uint32_t)
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
/// \todo Crypto++ has x86 ASM optimizations. They use SSE so if they
|
||||
/// are imported to liblzma, SSE instructions need to be used
|
||||
/// conditionally to keep the code working on older boxes.
|
||||
/// We could also support using some external libary for SHA-256.
|
||||
//
|
||||
// This code is based on the code found from 7-Zip, which has a modified
|
||||
// version of the SHA-256 found from Crypto++ <http://www.cryptopp.com/>.
|
||||
@@ -24,20 +23,20 @@
|
||||
|
||||
#include "check.h"
|
||||
|
||||
// Avoid bogus warnings in transform().
|
||||
#if TUKLIB_GNUC_REQ(4, 2)
|
||||
# pragma GCC diagnostic ignored "-Wuninitialized"
|
||||
#endif
|
||||
// Rotate a uint32_t. GCC can optimize this to a rotate instruction
|
||||
// at least on x86.
|
||||
static inline uint32_t
|
||||
rotr_32(uint32_t num, unsigned amount)
|
||||
{
|
||||
return (num >> amount) | (num << (32 - amount));
|
||||
}
|
||||
|
||||
// At least on x86, GCC is able to optimize this to a rotate instruction.
|
||||
#define rotr_32(num, amount) ((num) >> (amount) | (num) << (32 - (amount)))
|
||||
|
||||
#define blk0(i) (W[i] = data[i])
|
||||
#define blk0(i) (W[i] = conv32be(data[i]))
|
||||
#define blk2(i) (W[i & 15] += s1(W[(i - 2) & 15]) + W[(i - 7) & 15] \
|
||||
+ s0(W[(i - 15) & 15]))
|
||||
|
||||
#define Ch(x, y, z) (z ^ (x & (y ^ z)))
|
||||
#define Maj(x, y, z) ((x & y) | (z & (x | y)))
|
||||
#define Maj(x, y, z) ((x & (y ^ z)) + (y & z))
|
||||
|
||||
#define a(i) T[(0 - i) & 7]
|
||||
#define b(i) T[(1 - i) & 7]
|
||||
@@ -48,16 +47,17 @@
|
||||
#define g(i) T[(6 - i) & 7]
|
||||
#define h(i) T[(7 - i) & 7]
|
||||
|
||||
#define R(i) \
|
||||
h(i) += S1(e(i)) + Ch(e(i), f(i), g(i)) + SHA256_K[i + j] \
|
||||
+ (j ? blk2(i) : blk0(i)); \
|
||||
#define R(i, j, blk) \
|
||||
h(i) += S1(e(i)) + Ch(e(i), f(i), g(i)) + SHA256_K[i + j] + blk; \
|
||||
d(i) += h(i); \
|
||||
h(i) += S0(a(i)) + Maj(a(i), b(i), c(i))
|
||||
#define R0(i) R(i, 0, blk0(i))
|
||||
#define R2(i) R(i, j, blk2(i))
|
||||
|
||||
#define S0(x) (rotr_32(x, 2) ^ rotr_32(x, 13) ^ rotr_32(x, 22))
|
||||
#define S1(x) (rotr_32(x, 6) ^ rotr_32(x, 11) ^ rotr_32(x, 25))
|
||||
#define s0(x) (rotr_32(x, 7) ^ rotr_32(x, 18) ^ (x >> 3))
|
||||
#define s1(x) (rotr_32(x, 17) ^ rotr_32(x, 19) ^ (x >> 10))
|
||||
#define S0(x) rotr_32(x ^ rotr_32(x ^ rotr_32(x, 9), 11), 2)
|
||||
#define S1(x) rotr_32(x ^ rotr_32(x ^ rotr_32(x, 14), 5), 6)
|
||||
#define s0(x) (rotr_32(x ^ rotr_32(x, 11), 7) ^ (x >> 3))
|
||||
#define s1(x) (rotr_32(x ^ rotr_32(x, 2), 17) ^ (x >> 10))
|
||||
|
||||
|
||||
static const uint32_t SHA256_K[64] = {
|
||||
@@ -81,7 +81,7 @@ static const uint32_t SHA256_K[64] = {
|
||||
|
||||
|
||||
static void
|
||||
transform(uint32_t state[static 8], const uint32_t data[static 16])
|
||||
transform(uint32_t state[8], const uint32_t data[16])
|
||||
{
|
||||
uint32_t W[16];
|
||||
uint32_t T[8];
|
||||
@@ -89,12 +89,18 @@ transform(uint32_t state[static 8], const uint32_t data[static 16])
|
||||
// Copy state[] to working vars.
|
||||
memcpy(T, state, sizeof(T));
|
||||
|
||||
// 64 operations, partially loop unrolled
|
||||
for (unsigned int j = 0; j < 64; j += 16) {
|
||||
R( 0); R( 1); R( 2); R( 3);
|
||||
R( 4); R( 5); R( 6); R( 7);
|
||||
R( 8); R( 9); R(10); R(11);
|
||||
R(12); R(13); R(14); R(15);
|
||||
// The first 16 operations unrolled
|
||||
R0( 0); R0( 1); R0( 2); R0( 3);
|
||||
R0( 4); R0( 5); R0( 6); R0( 7);
|
||||
R0( 8); R0( 9); R0(10); R0(11);
|
||||
R0(12); R0(13); R0(14); R0(15);
|
||||
|
||||
// The remaining 48 operations partially unrolled
|
||||
for (unsigned int j = 16; j < 64; j += 16) {
|
||||
R2( 0); R2( 1); R2( 2); R2( 3);
|
||||
R2( 4); R2( 5); R2( 6); R2( 7);
|
||||
R2( 8); R2( 9); R2(10); R2(11);
|
||||
R2(12); R2(13); R2(14); R2(15);
|
||||
}
|
||||
|
||||
// Add the working vars back into state[].
|
||||
@@ -112,18 +118,7 @@ transform(uint32_t state[static 8], const uint32_t data[static 16])
|
||||
static void
|
||||
process(lzma_check_state *check)
|
||||
{
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
transform(check->state.sha256.state, check->buffer.u32);
|
||||
|
||||
#else
|
||||
uint32_t data[16];
|
||||
|
||||
for (size_t i = 0; i < 16; ++i)
|
||||
data[i] = bswap32(check->buffer.u32[i]);
|
||||
|
||||
transform(check->state.sha256.state, data);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
liblzma_la_SOURCES += \
|
||||
common/common.c \
|
||||
common/common.h \
|
||||
common/memcmplen.h \
|
||||
common/block_util.c \
|
||||
common/easy_preset.c \
|
||||
common/easy_preset.h \
|
||||
@@ -20,10 +21,15 @@ liblzma_la_SOURCES += \
|
||||
common/stream_flags_common.h \
|
||||
common/vli_size.c
|
||||
|
||||
if COND_THREADS
|
||||
liblzma_la_SOURCES += common/hardware_cputhreads.c
|
||||
endif
|
||||
|
||||
if COND_MAIN_ENCODER
|
||||
liblzma_la_SOURCES += \
|
||||
common/alone_encoder.c \
|
||||
common/block_buffer_encoder.c \
|
||||
common/block_buffer_encoder.h \
|
||||
common/block_encoder.c \
|
||||
common/block_encoder.h \
|
||||
common/block_header_encoder.c \
|
||||
@@ -59,11 +65,13 @@ liblzma_la_SOURCES += \
|
||||
common/block_decoder.h \
|
||||
common/block_header_decoder.c \
|
||||
common/easy_decoder_memusage.c \
|
||||
common/file_info.c \
|
||||
common/filter_buffer_decoder.c \
|
||||
common/filter_decoder.c \
|
||||
common/filter_decoder.h \
|
||||
common/filter_flags_decoder.c \
|
||||
common/index_decoder.c \
|
||||
common/index_decoder.h \
|
||||
common/index_hash.c \
|
||||
common/stream_buffer_decoder.c \
|
||||
common/stream_decoder.c \
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "lz_decoder.h"
|
||||
|
||||
|
||||
struct lzma_coder_s {
|
||||
typedef struct {
|
||||
lzma_next_coder next;
|
||||
|
||||
enum {
|
||||
@@ -26,6 +26,11 @@ struct lzma_coder_s {
|
||||
SEQ_CODE,
|
||||
} sequence;
|
||||
|
||||
/// If true, reject files that are unlikely to be .lzma files.
|
||||
/// If false, more non-.lzma files get accepted and will give
|
||||
/// LZMA_DATA_ERROR either immediately or after a few output bytes.
|
||||
bool picky;
|
||||
|
||||
/// Position in the header fields
|
||||
size_t pos;
|
||||
|
||||
@@ -41,17 +46,19 @@ struct lzma_coder_s {
|
||||
/// Options decoded from the header needed to initialize
|
||||
/// the LZMA decoder
|
||||
lzma_options_lzma options;
|
||||
};
|
||||
} lzma_alone_coder;
|
||||
|
||||
|
||||
static lzma_ret
|
||||
alone_decode(lzma_coder *coder,
|
||||
lzma_allocator *allocator lzma_attribute((unused)),
|
||||
alone_decode(void *coder_ptr,
|
||||
const lzma_allocator *allocator lzma_attribute((__unused__)),
|
||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||
size_t in_size, uint8_t *restrict out,
|
||||
size_t *restrict out_pos, size_t out_size,
|
||||
lzma_action action)
|
||||
{
|
||||
lzma_alone_coder *coder = coder_ptr;
|
||||
|
||||
while (*out_pos < out_size
|
||||
&& (coder->sequence == SEQ_CODE || *in_pos < in_size))
|
||||
switch (coder->sequence) {
|
||||
@@ -68,13 +75,13 @@ alone_decode(lzma_coder *coder,
|
||||
|= (size_t)(in[*in_pos]) << (coder->pos * 8);
|
||||
|
||||
if (++coder->pos == 4) {
|
||||
if (coder->options.dict_size != UINT32_MAX) {
|
||||
if (coder->picky && coder->options.dict_size
|
||||
!= UINT32_MAX) {
|
||||
// A hack to ditch tons of false positives:
|
||||
// We allow only dictionary sizes that are
|
||||
// 2^n or 2^n + 2^(n-1). LZMA_Alone created
|
||||
// only files with 2^n, but accepts any
|
||||
// dictionary size. If someone complains, this
|
||||
// will be reconsidered.
|
||||
// dictionary size.
|
||||
uint32_t d = coder->options.dict_size - 1;
|
||||
d |= d >> 2;
|
||||
d |= d >> 3;
|
||||
@@ -103,9 +110,9 @@ alone_decode(lzma_coder *coder,
|
||||
|
||||
// Another hack to ditch false positives: Assume that
|
||||
// if the uncompressed size is known, it must be less
|
||||
// than 256 GiB. Again, if someone complains, this
|
||||
// will be reconsidered.
|
||||
if (coder->uncompressed_size != LZMA_VLI_UNKNOWN
|
||||
// than 256 GiB.
|
||||
if (coder->picky
|
||||
&& coder->uncompressed_size != LZMA_VLI_UNKNOWN
|
||||
&& coder->uncompressed_size
|
||||
>= (LZMA_VLI_C(1) << 38))
|
||||
return LZMA_FORMAT_ERROR;
|
||||
@@ -161,8 +168,9 @@ alone_decode(lzma_coder *coder,
|
||||
|
||||
|
||||
static void
|
||||
alone_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||
alone_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
|
||||
{
|
||||
lzma_alone_coder *coder = coder_ptr;
|
||||
lzma_next_end(&coder->next, allocator);
|
||||
lzma_free(coder, allocator);
|
||||
return;
|
||||
@@ -170,9 +178,11 @@ alone_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||
|
||||
|
||||
static lzma_ret
|
||||
alone_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
|
||||
alone_decoder_memconfig(void *coder_ptr, uint64_t *memusage,
|
||||
uint64_t *old_memlimit, uint64_t new_memlimit)
|
||||
{
|
||||
lzma_alone_coder *coder = coder_ptr;
|
||||
|
||||
*memusage = coder->memusage;
|
||||
*old_memlimit = coder->memlimit;
|
||||
|
||||
@@ -188,33 +198,34 @@ alone_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
|
||||
|
||||
|
||||
extern lzma_ret
|
||||
lzma_alone_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
uint64_t memlimit)
|
||||
lzma_alone_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||
uint64_t memlimit, bool picky)
|
||||
{
|
||||
lzma_next_coder_init(&lzma_alone_decoder_init, next, allocator);
|
||||
|
||||
if (memlimit == 0)
|
||||
return LZMA_PROG_ERROR;
|
||||
lzma_alone_coder *coder = next->coder;
|
||||
|
||||
if (next->coder == NULL) {
|
||||
next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
|
||||
if (next->coder == NULL)
|
||||
if (coder == NULL) {
|
||||
coder = lzma_alloc(sizeof(lzma_alone_coder), allocator);
|
||||
if (coder == NULL)
|
||||
return LZMA_MEM_ERROR;
|
||||
|
||||
next->coder = coder;
|
||||
next->code = &alone_decode;
|
||||
next->end = &alone_decoder_end;
|
||||
next->memconfig = &alone_decoder_memconfig;
|
||||
next->coder->next = LZMA_NEXT_CODER_INIT;
|
||||
coder->next = LZMA_NEXT_CODER_INIT;
|
||||
}
|
||||
|
||||
next->coder->sequence = SEQ_PROPERTIES;
|
||||
next->coder->pos = 0;
|
||||
next->coder->options.dict_size = 0;
|
||||
next->coder->options.preset_dict = NULL;
|
||||
next->coder->options.preset_dict_size = 0;
|
||||
next->coder->uncompressed_size = 0;
|
||||
next->coder->memlimit = memlimit;
|
||||
next->coder->memusage = LZMA_MEMUSAGE_BASE;
|
||||
coder->sequence = SEQ_PROPERTIES;
|
||||
coder->picky = picky;
|
||||
coder->pos = 0;
|
||||
coder->options.dict_size = 0;
|
||||
coder->options.preset_dict = NULL;
|
||||
coder->options.preset_dict_size = 0;
|
||||
coder->uncompressed_size = 0;
|
||||
coder->memlimit = my_max(1, memlimit);
|
||||
coder->memusage = LZMA_MEMUSAGE_BASE;
|
||||
|
||||
return LZMA_OK;
|
||||
}
|
||||
@@ -223,7 +234,7 @@ lzma_alone_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
extern LZMA_API(lzma_ret)
|
||||
lzma_alone_decoder(lzma_stream *strm, uint64_t memlimit)
|
||||
{
|
||||
lzma_next_strm_init(lzma_alone_decoder_init, strm, memlimit);
|
||||
lzma_next_strm_init(lzma_alone_decoder_init, strm, memlimit, false);
|
||||
|
||||
strm->internal->supported_actions[LZMA_RUN] = true;
|
||||
strm->internal->supported_actions[LZMA_FINISH] = true;
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
#include "common.h"
|
||||
|
||||
|
||||
extern lzma_ret lzma_alone_decoder_init(lzma_next_coder *next,
|
||||
lzma_allocator *allocator, uint64_t memlimit);
|
||||
extern lzma_ret lzma_alone_decoder_init(
|
||||
lzma_next_coder *next, const lzma_allocator *allocator,
|
||||
uint64_t memlimit, bool picky);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#define ALONE_HEADER_SIZE (1 + 4 + 8)
|
||||
|
||||
|
||||
struct lzma_coder_s {
|
||||
typedef struct {
|
||||
lzma_next_coder next;
|
||||
|
||||
enum {
|
||||
@@ -27,17 +27,19 @@ struct lzma_coder_s {
|
||||
|
||||
size_t header_pos;
|
||||
uint8_t header[ALONE_HEADER_SIZE];
|
||||
};
|
||||
} lzma_alone_coder;
|
||||
|
||||
|
||||
static lzma_ret
|
||||
alone_encode(lzma_coder *coder,
|
||||
lzma_allocator *allocator lzma_attribute((unused)),
|
||||
alone_encode(void *coder_ptr,
|
||||
const lzma_allocator *allocator lzma_attribute((__unused__)),
|
||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||
size_t in_size, uint8_t *restrict out,
|
||||
size_t *restrict out_pos, size_t out_size,
|
||||
lzma_action action)
|
||||
{
|
||||
lzma_alone_coder *coder = coder_ptr;
|
||||
|
||||
while (*out_pos < out_size)
|
||||
switch (coder->sequence) {
|
||||
case SEQ_HEADER:
|
||||
@@ -65,8 +67,9 @@ alone_encode(lzma_coder *coder,
|
||||
|
||||
|
||||
static void
|
||||
alone_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||
alone_encoder_end(void *coder_ptr, const lzma_allocator *allocator)
|
||||
{
|
||||
lzma_alone_coder *coder = coder_ptr;
|
||||
lzma_next_end(&coder->next, allocator);
|
||||
lzma_free(coder, allocator);
|
||||
return;
|
||||
@@ -75,28 +78,31 @@ alone_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||
|
||||
// At least for now, this is not used by any internal function.
|
||||
static lzma_ret
|
||||
alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
alone_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||
const lzma_options_lzma *options)
|
||||
{
|
||||
lzma_next_coder_init(&alone_encoder_init, next, allocator);
|
||||
|
||||
if (next->coder == NULL) {
|
||||
next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
|
||||
if (next->coder == NULL)
|
||||
lzma_alone_coder *coder = next->coder;
|
||||
|
||||
if (coder == NULL) {
|
||||
coder = lzma_alloc(sizeof(lzma_alone_coder), allocator);
|
||||
if (coder == NULL)
|
||||
return LZMA_MEM_ERROR;
|
||||
|
||||
next->coder = coder;
|
||||
next->code = &alone_encode;
|
||||
next->end = &alone_encoder_end;
|
||||
next->coder->next = LZMA_NEXT_CODER_INIT;
|
||||
coder->next = LZMA_NEXT_CODER_INIT;
|
||||
}
|
||||
|
||||
// Basic initializations
|
||||
next->coder->sequence = SEQ_HEADER;
|
||||
next->coder->header_pos = 0;
|
||||
coder->sequence = SEQ_HEADER;
|
||||
coder->header_pos = 0;
|
||||
|
||||
// Encode the header:
|
||||
// - Properties (1 byte)
|
||||
if (lzma_lzma_lclppb_encode(options, next->coder->header))
|
||||
if (lzma_lzma_lclppb_encode(options, coder->header))
|
||||
return LZMA_OPTIONS_ERROR;
|
||||
|
||||
// - Dictionary size (4 bytes)
|
||||
@@ -116,10 +122,10 @@ alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
if (d != UINT32_MAX)
|
||||
++d;
|
||||
|
||||
unaligned_write32le(next->coder->header + 1, d);
|
||||
unaligned_write32le(coder->header + 1, d);
|
||||
|
||||
// - Uncompressed size (always unknown and using EOPM)
|
||||
memset(next->coder->header + 1 + 4, 0xFF, 8);
|
||||
memset(coder->header + 1 + 4, 0xFF, 8);
|
||||
|
||||
// Initialize the LZMA encoder.
|
||||
const lzma_filter_info filters[2] = {
|
||||
@@ -131,13 +137,13 @@ alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
}
|
||||
};
|
||||
|
||||
return lzma_next_filter_init(&next->coder->next, allocator, filters);
|
||||
return lzma_next_filter_init(&coder->next, allocator, filters);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
extern lzma_ret
|
||||
lzma_alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
lzma_alone_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||
const lzma_options_alone *options)
|
||||
{
|
||||
lzma_next_coder_init(&alone_encoder_init, next, allocator, options);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "alone_decoder.h"
|
||||
|
||||
|
||||
struct lzma_coder_s {
|
||||
typedef struct {
|
||||
/// Stream decoder or LZMA_Alone decoder
|
||||
lzma_next_coder next;
|
||||
|
||||
@@ -26,15 +26,17 @@ struct lzma_coder_s {
|
||||
SEQ_CODE,
|
||||
SEQ_FINISH,
|
||||
} sequence;
|
||||
};
|
||||
} lzma_auto_coder;
|
||||
|
||||
|
||||
static lzma_ret
|
||||
auto_decode(lzma_coder *coder, lzma_allocator *allocator,
|
||||
auto_decode(void *coder_ptr, const lzma_allocator *allocator,
|
||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||
size_t in_size, uint8_t *restrict out,
|
||||
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
||||
{
|
||||
lzma_auto_coder *coder = coder_ptr;
|
||||
|
||||
switch (coder->sequence) {
|
||||
case SEQ_INIT:
|
||||
if (*in_pos >= in_size)
|
||||
@@ -54,7 +56,7 @@ auto_decode(lzma_coder *coder, lzma_allocator *allocator,
|
||||
coder->memlimit, coder->flags));
|
||||
} else {
|
||||
return_if_error(lzma_alone_decoder_init(&coder->next,
|
||||
allocator, coder->memlimit));
|
||||
allocator, coder->memlimit, true));
|
||||
|
||||
// If the application wants to know about missing
|
||||
// integrity check or about the check in general, we
|
||||
@@ -100,8 +102,9 @@ auto_decode(lzma_coder *coder, lzma_allocator *allocator,
|
||||
|
||||
|
||||
static void
|
||||
auto_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||
auto_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
|
||||
{
|
||||
lzma_auto_coder *coder = coder_ptr;
|
||||
lzma_next_end(&coder->next, allocator);
|
||||
lzma_free(coder, allocator);
|
||||
return;
|
||||
@@ -109,8 +112,10 @@ auto_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||
|
||||
|
||||
static lzma_check
|
||||
auto_decoder_get_check(const lzma_coder *coder)
|
||||
auto_decoder_get_check(const void *coder_ptr)
|
||||
{
|
||||
const lzma_auto_coder *coder = coder_ptr;
|
||||
|
||||
// It is LZMA_Alone if get_check is NULL.
|
||||
return coder->next.get_check == NULL ? LZMA_CHECK_NONE
|
||||
: coder->next.get_check(coder->next.coder);
|
||||
@@ -118,9 +123,11 @@ auto_decoder_get_check(const lzma_coder *coder)
|
||||
|
||||
|
||||
static lzma_ret
|
||||
auto_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
|
||||
auto_decoder_memconfig(void *coder_ptr, uint64_t *memusage,
|
||||
uint64_t *old_memlimit, uint64_t new_memlimit)
|
||||
{
|
||||
lzma_auto_coder *coder = coder_ptr;
|
||||
|
||||
lzma_ret ret;
|
||||
|
||||
if (coder->next.memconfig != NULL) {
|
||||
@@ -132,7 +139,10 @@ auto_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
|
||||
// the current memory usage.
|
||||
*memusage = LZMA_MEMUSAGE_BASE;
|
||||
*old_memlimit = coder->memlimit;
|
||||
|
||||
ret = LZMA_OK;
|
||||
if (new_memlimit != 0 && new_memlimit < *memusage)
|
||||
ret = LZMA_MEMLIMIT_ERROR;
|
||||
}
|
||||
|
||||
if (ret == LZMA_OK && new_memlimit != 0)
|
||||
@@ -143,32 +153,31 @@ auto_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
|
||||
|
||||
|
||||
static lzma_ret
|
||||
auto_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
auto_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||
uint64_t memlimit, uint32_t flags)
|
||||
{
|
||||
lzma_next_coder_init(&auto_decoder_init, next, allocator);
|
||||
|
||||
if (memlimit == 0)
|
||||
return LZMA_PROG_ERROR;
|
||||
|
||||
if (flags & ~LZMA_SUPPORTED_FLAGS)
|
||||
return LZMA_OPTIONS_ERROR;
|
||||
|
||||
if (next->coder == NULL) {
|
||||
next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
|
||||
if (next->coder == NULL)
|
||||
lzma_auto_coder *coder = next->coder;
|
||||
if (coder == NULL) {
|
||||
coder = lzma_alloc(sizeof(lzma_auto_coder), allocator);
|
||||
if (coder == NULL)
|
||||
return LZMA_MEM_ERROR;
|
||||
|
||||
next->coder = coder;
|
||||
next->code = &auto_decode;
|
||||
next->end = &auto_decoder_end;
|
||||
next->get_check = &auto_decoder_get_check;
|
||||
next->memconfig = &auto_decoder_memconfig;
|
||||
next->coder->next = LZMA_NEXT_CODER_INIT;
|
||||
coder->next = LZMA_NEXT_CODER_INIT;
|
||||
}
|
||||
|
||||
next->coder->memlimit = memlimit;
|
||||
next->coder->flags = flags;
|
||||
next->coder->sequence = SEQ_INIT;
|
||||
coder->memlimit = my_max(1, memlimit);
|
||||
coder->flags = flags;
|
||||
coder->sequence = SEQ_INIT;
|
||||
|
||||
return LZMA_OK;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
extern LZMA_API(lzma_ret)
|
||||
lzma_block_buffer_decode(lzma_block *block, lzma_allocator *allocator,
|
||||
lzma_block_buffer_decode(lzma_block *block, const lzma_allocator *allocator,
|
||||
const uint8_t *in, size_t *in_pos, size_t in_size,
|
||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "block_buffer_encoder.h"
|
||||
#include "block_encoder.h"
|
||||
#include "filter_encoder.h"
|
||||
#include "lzma2_encoder.h"
|
||||
@@ -28,8 +29,8 @@
|
||||
+ LZMA_CHECK_SIZE_MAX + 3) & ~3)
|
||||
|
||||
|
||||
static lzma_vli
|
||||
lzma2_bound(lzma_vli uncompressed_size)
|
||||
static uint64_t
|
||||
lzma2_bound(uint64_t uncompressed_size)
|
||||
{
|
||||
// Prevent integer overflow in overhead calculation.
|
||||
if (uncompressed_size > COMPRESSED_SIZE_MAX)
|
||||
@@ -39,7 +40,7 @@ lzma2_bound(lzma_vli uncompressed_size)
|
||||
// uncompressed_size up to the next multiple of LZMA2_CHUNK_MAX,
|
||||
// multiply by the size of per-chunk header, and add one byte for
|
||||
// the end marker.
|
||||
const lzma_vli overhead = ((uncompressed_size + LZMA2_CHUNK_MAX - 1)
|
||||
const uint64_t overhead = ((uncompressed_size + LZMA2_CHUNK_MAX - 1)
|
||||
/ LZMA2_CHUNK_MAX)
|
||||
* LZMA2_HEADER_UNCOMPRESSED + 1;
|
||||
|
||||
@@ -51,30 +52,36 @@ lzma2_bound(lzma_vli uncompressed_size)
|
||||
}
|
||||
|
||||
|
||||
extern LZMA_API(size_t)
|
||||
lzma_block_buffer_bound(size_t uncompressed_size)
|
||||
extern uint64_t
|
||||
lzma_block_buffer_bound64(uint64_t uncompressed_size)
|
||||
{
|
||||
// For now, if the data doesn't compress, we always use uncompressed
|
||||
// chunks of LZMA2. In future we may use Subblock filter too, but
|
||||
// but for simplicity we probably will still use the same bound
|
||||
// calculation even though Subblock filter would have slightly less
|
||||
// overhead.
|
||||
lzma_vli lzma2_size = lzma2_bound(uncompressed_size);
|
||||
// If the data doesn't compress, we always use uncompressed
|
||||
// LZMA2 chunks.
|
||||
uint64_t lzma2_size = lzma2_bound(uncompressed_size);
|
||||
if (lzma2_size == 0)
|
||||
return 0;
|
||||
|
||||
// Take Block Padding into account.
|
||||
lzma2_size = (lzma2_size + 3) & ~LZMA_VLI_C(3);
|
||||
lzma2_size = (lzma2_size + 3) & ~UINT64_C(3);
|
||||
|
||||
#if SIZE_MAX < LZMA_VLI_MAX
|
||||
// Catch the possible integer overflow on 32-bit systems. There's no
|
||||
// overflow on 64-bit systems, because lzma2_bound() already takes
|
||||
// No risk of integer overflow because lzma2_bound() already takes
|
||||
// into account the size of the headers in the Block.
|
||||
if (SIZE_MAX - HEADERS_BOUND < lzma2_size)
|
||||
return HEADERS_BOUND + lzma2_size;
|
||||
}
|
||||
|
||||
|
||||
extern LZMA_API(size_t)
|
||||
lzma_block_buffer_bound(size_t uncompressed_size)
|
||||
{
|
||||
uint64_t ret = lzma_block_buffer_bound64(uncompressed_size);
|
||||
|
||||
#if SIZE_MAX < UINT64_MAX
|
||||
// Catch the possible integer overflow on 32-bit systems.
|
||||
if (ret > SIZE_MAX)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
return HEADERS_BOUND + lzma2_size;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,9 +89,6 @@ static lzma_ret
|
||||
block_encode_uncompressed(lzma_block *block, const uint8_t *in, size_t in_size,
|
||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||
{
|
||||
// TODO: Figure out if the last filter is LZMA2 or Subblock and use
|
||||
// that filter to encode the uncompressed chunks.
|
||||
|
||||
// Use LZMA2 uncompressed chunks. We wouldn't need a dictionary at
|
||||
// all, but LZMA2 always requires a dictionary, so use the minimum
|
||||
// value to minimize memory usage of the decoder.
|
||||
@@ -160,16 +164,11 @@ block_encode_uncompressed(lzma_block *block, const uint8_t *in, size_t in_size,
|
||||
|
||||
|
||||
static lzma_ret
|
||||
block_encode_normal(lzma_block *block, lzma_allocator *allocator,
|
||||
block_encode_normal(lzma_block *block, const lzma_allocator *allocator,
|
||||
const uint8_t *in, size_t in_size,
|
||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||
{
|
||||
// Find out the size of the Block Header.
|
||||
block->compressed_size = lzma2_bound(in_size);
|
||||
if (block->compressed_size == 0)
|
||||
return LZMA_DATA_ERROR;
|
||||
|
||||
block->uncompressed_size = in_size;
|
||||
return_if_error(lzma_block_header_size(block));
|
||||
|
||||
// Reserve space for the Block Header and skip it for now.
|
||||
@@ -221,10 +220,11 @@ block_encode_normal(lzma_block *block, lzma_allocator *allocator,
|
||||
}
|
||||
|
||||
|
||||
extern LZMA_API(lzma_ret)
|
||||
lzma_block_buffer_encode(lzma_block *block, lzma_allocator *allocator,
|
||||
static lzma_ret
|
||||
block_buffer_encode(lzma_block *block, const lzma_allocator *allocator,
|
||||
const uint8_t *in, size_t in_size,
|
||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||
uint8_t *out, size_t *out_pos, size_t out_size,
|
||||
bool try_to_compress)
|
||||
{
|
||||
// Validate the arguments.
|
||||
if (block == NULL || (in == NULL && in_size != 0) || out == NULL
|
||||
@@ -233,11 +233,11 @@ lzma_block_buffer_encode(lzma_block *block, lzma_allocator *allocator,
|
||||
|
||||
// The contents of the structure may depend on the version so
|
||||
// check the version before validating the contents of *block.
|
||||
if (block->version != 0)
|
||||
if (block->version > 1)
|
||||
return LZMA_OPTIONS_ERROR;
|
||||
|
||||
if ((unsigned int)(block->check) > LZMA_CHECK_ID_MAX
|
||||
|| block->filters == NULL)
|
||||
|| (try_to_compress && block->filters == NULL))
|
||||
return LZMA_PROG_ERROR;
|
||||
|
||||
if (!lzma_check_is_supported(block->check))
|
||||
@@ -258,9 +258,19 @@ lzma_block_buffer_encode(lzma_block *block, lzma_allocator *allocator,
|
||||
|
||||
out_size -= check_size;
|
||||
|
||||
// Initialize block->uncompressed_size and calculate the worst-case
|
||||
// value for block->compressed_size.
|
||||
block->uncompressed_size = in_size;
|
||||
block->compressed_size = lzma2_bound(in_size);
|
||||
if (block->compressed_size == 0)
|
||||
return LZMA_DATA_ERROR;
|
||||
|
||||
// Do the actual compression.
|
||||
const lzma_ret ret = block_encode_normal(block, allocator,
|
||||
in, in_size, out, out_pos, out_size);
|
||||
lzma_ret ret = LZMA_BUF_ERROR;
|
||||
if (try_to_compress)
|
||||
ret = block_encode_normal(block, allocator,
|
||||
in, in_size, out, out_pos, out_size);
|
||||
|
||||
if (ret != LZMA_OK) {
|
||||
// If the error was something else than output buffer
|
||||
// becoming full, return the error now.
|
||||
@@ -303,3 +313,25 @@ lzma_block_buffer_encode(lzma_block *block, lzma_allocator *allocator,
|
||||
|
||||
return LZMA_OK;
|
||||
}
|
||||
|
||||
|
||||
extern LZMA_API(lzma_ret)
|
||||
lzma_block_buffer_encode(lzma_block *block, const lzma_allocator *allocator,
|
||||
const uint8_t *in, size_t in_size,
|
||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||
{
|
||||
return block_buffer_encode(block, allocator,
|
||||
in, in_size, out, out_pos, out_size, true);
|
||||
}
|
||||
|
||||
|
||||
extern LZMA_API(lzma_ret)
|
||||
lzma_block_uncomp_encode(lzma_block *block,
|
||||
const uint8_t *in, size_t in_size,
|
||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||
{
|
||||
// It won't allocate any memory from heap so no need
|
||||
// for lzma_allocator.
|
||||
return block_buffer_encode(block, NULL,
|
||||
in, in_size, out, out_pos, out_size, false);
|
||||
}
|
||||
|
||||
24
src/liblzma/common/block_buffer_encoder.h
Normal file
24
src/liblzma/common/block_buffer_encoder.h
Normal file
@@ -0,0 +1,24 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/// \file block_buffer_encoder.h
|
||||
/// \brief Single-call .xz Block encoder
|
||||
//
|
||||
// Author: Lasse Collin
|
||||
//
|
||||
// This file has been put into the public domain.
|
||||
// You can do whatever you want with this file.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef LZMA_BLOCK_BUFFER_ENCODER_H
|
||||
#define LZMA_BLOCK_BUFFER_ENCODER_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
/// uint64_t version of lzma_block_buffer_bound(). It is used by
|
||||
/// stream_encoder_mt.c. Probably the original lzma_block_buffer_bound()
|
||||
/// should have been 64-bit, but fixing it would break the ABI.
|
||||
extern uint64_t lzma_block_buffer_bound64(uint64_t uncompressed_size);
|
||||
|
||||
#endif
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "check.h"
|
||||
|
||||
|
||||
struct lzma_coder_s {
|
||||
typedef struct {
|
||||
enum {
|
||||
SEQ_CODE,
|
||||
SEQ_PADDING,
|
||||
@@ -45,7 +45,10 @@ struct lzma_coder_s {
|
||||
|
||||
/// Check of the uncompressed data
|
||||
lzma_check_state check;
|
||||
};
|
||||
|
||||
/// True if the integrity check won't be calculated and verified.
|
||||
bool ignore_check;
|
||||
} lzma_block_coder;
|
||||
|
||||
|
||||
static inline bool
|
||||
@@ -71,11 +74,13 @@ is_size_valid(lzma_vli size, lzma_vli reference)
|
||||
|
||||
|
||||
static lzma_ret
|
||||
block_decode(lzma_coder *coder, lzma_allocator *allocator,
|
||||
block_decode(void *coder_ptr, const lzma_allocator *allocator,
|
||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||
size_t in_size, uint8_t *restrict out,
|
||||
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
||||
{
|
||||
lzma_block_coder *coder = coder_ptr;
|
||||
|
||||
switch (coder->sequence) {
|
||||
case SEQ_CODE: {
|
||||
const size_t in_start = *in_pos;
|
||||
@@ -97,8 +102,9 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator,
|
||||
coder->block->uncompressed_size))
|
||||
return LZMA_DATA_ERROR;
|
||||
|
||||
lzma_check_update(&coder->check, coder->block->check,
|
||||
out + out_start, out_used);
|
||||
if (!coder->ignore_check)
|
||||
lzma_check_update(&coder->check, coder->block->check,
|
||||
out + out_start, out_used);
|
||||
|
||||
if (ret != LZMA_STREAM_END)
|
||||
return ret;
|
||||
@@ -140,7 +146,9 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator,
|
||||
if (coder->block->check == LZMA_CHECK_NONE)
|
||||
return LZMA_STREAM_END;
|
||||
|
||||
lzma_check_finish(&coder->check, coder->block->check);
|
||||
if (!coder->ignore_check)
|
||||
lzma_check_finish(&coder->check, coder->block->check);
|
||||
|
||||
coder->sequence = SEQ_CHECK;
|
||||
|
||||
// Fall through
|
||||
@@ -155,7 +163,8 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator,
|
||||
// Validate the Check only if we support it.
|
||||
// coder->check.buffer may be uninitialized
|
||||
// when the Check ID is not supported.
|
||||
if (lzma_check_is_supported(coder->block->check)
|
||||
if (!coder->ignore_check
|
||||
&& lzma_check_is_supported(coder->block->check)
|
||||
&& memcmp(coder->block->raw_check,
|
||||
coder->check.buffer.u8,
|
||||
check_size) != 0)
|
||||
@@ -170,8 +179,9 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator,
|
||||
|
||||
|
||||
static void
|
||||
block_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||
block_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
|
||||
{
|
||||
lzma_block_coder *coder = coder_ptr;
|
||||
lzma_next_end(&coder->next, allocator);
|
||||
lzma_free(coder, allocator);
|
||||
return;
|
||||
@@ -179,7 +189,7 @@ block_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||
|
||||
|
||||
extern lzma_ret
|
||||
lzma_block_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
lzma_block_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||
lzma_block *block)
|
||||
{
|
||||
lzma_next_coder_init(&lzma_block_decoder_init, next, allocator);
|
||||
@@ -191,27 +201,29 @@ lzma_block_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
|| !lzma_vli_is_valid(block->uncompressed_size))
|
||||
return LZMA_PROG_ERROR;
|
||||
|
||||
// Allocate and initialize *next->coder if needed.
|
||||
if (next->coder == NULL) {
|
||||
next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
|
||||
if (next->coder == NULL)
|
||||
// Allocate *next->coder if needed.
|
||||
lzma_block_coder *coder = next->coder;
|
||||
if (coder == NULL) {
|
||||
coder = lzma_alloc(sizeof(lzma_block_coder), allocator);
|
||||
if (coder == NULL)
|
||||
return LZMA_MEM_ERROR;
|
||||
|
||||
next->coder = coder;
|
||||
next->code = &block_decode;
|
||||
next->end = &block_decoder_end;
|
||||
next->coder->next = LZMA_NEXT_CODER_INIT;
|
||||
coder->next = LZMA_NEXT_CODER_INIT;
|
||||
}
|
||||
|
||||
// Basic initializations
|
||||
next->coder->sequence = SEQ_CODE;
|
||||
next->coder->block = block;
|
||||
next->coder->compressed_size = 0;
|
||||
next->coder->uncompressed_size = 0;
|
||||
coder->sequence = SEQ_CODE;
|
||||
coder->block = block;
|
||||
coder->compressed_size = 0;
|
||||
coder->uncompressed_size = 0;
|
||||
|
||||
// If Compressed Size is not known, we calculate the maximum allowed
|
||||
// value so that encoded size of the Block (including Block Padding)
|
||||
// is still a valid VLI and a multiple of four.
|
||||
next->coder->compressed_limit
|
||||
coder->compressed_limit
|
||||
= block->compressed_size == LZMA_VLI_UNKNOWN
|
||||
? (LZMA_VLI_MAX & ~LZMA_VLI_C(3))
|
||||
- block->header_size
|
||||
@@ -221,11 +233,14 @@ lzma_block_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
// Initialize the check. It's caller's problem if the Check ID is not
|
||||
// supported, and the Block decoder cannot verify the Check field.
|
||||
// Caller can test lzma_check_is_supported(block->check).
|
||||
next->coder->check_pos = 0;
|
||||
lzma_check_init(&next->coder->check, block->check);
|
||||
coder->check_pos = 0;
|
||||
lzma_check_init(&coder->check, block->check);
|
||||
|
||||
coder->ignore_check = block->version >= 1
|
||||
? block->ignore_check : false;
|
||||
|
||||
// Initialize the filter chain.
|
||||
return lzma_raw_decoder_init(&next->coder->next, allocator,
|
||||
return lzma_raw_decoder_init(&coder->next, allocator,
|
||||
block->filters);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,6 @@
|
||||
|
||||
|
||||
extern lzma_ret lzma_block_decoder_init(lzma_next_coder *next,
|
||||
lzma_allocator *allocator, lzma_block *block);
|
||||
const lzma_allocator *allocator, lzma_block *block);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "check.h"
|
||||
|
||||
|
||||
struct lzma_coder_s {
|
||||
typedef struct {
|
||||
/// The filters in the chain; initialized with lzma_raw_decoder_init().
|
||||
lzma_next_coder next;
|
||||
|
||||
@@ -41,15 +41,17 @@ struct lzma_coder_s {
|
||||
|
||||
/// Check of the uncompressed data
|
||||
lzma_check_state check;
|
||||
};
|
||||
} lzma_block_coder;
|
||||
|
||||
|
||||
static lzma_ret
|
||||
block_encode(lzma_coder *coder, lzma_allocator *allocator,
|
||||
block_encode(void *coder_ptr, const lzma_allocator *allocator,
|
||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||
size_t in_size, uint8_t *restrict out,
|
||||
size_t *restrict out_pos, size_t out_size, lzma_action action)
|
||||
{
|
||||
lzma_block_coder *coder = coder_ptr;
|
||||
|
||||
// Check that our amount of input stays in proper limits.
|
||||
if (LZMA_VLI_MAX - coder->uncompressed_size < in_size - *in_pos)
|
||||
return LZMA_DATA_ERROR;
|
||||
@@ -134,8 +136,9 @@ block_encode(lzma_coder *coder, lzma_allocator *allocator,
|
||||
|
||||
|
||||
static void
|
||||
block_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||
block_encoder_end(void *coder_ptr, const lzma_allocator *allocator)
|
||||
{
|
||||
lzma_block_coder *coder = coder_ptr;
|
||||
lzma_next_end(&coder->next, allocator);
|
||||
lzma_free(coder, allocator);
|
||||
return;
|
||||
@@ -143,10 +146,12 @@ block_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||
|
||||
|
||||
static lzma_ret
|
||||
block_encoder_update(lzma_coder *coder, lzma_allocator *allocator,
|
||||
const lzma_filter *filters lzma_attribute((unused)),
|
||||
block_encoder_update(void *coder_ptr, const lzma_allocator *allocator,
|
||||
const lzma_filter *filters lzma_attribute((__unused__)),
|
||||
const lzma_filter *reversed_filters)
|
||||
{
|
||||
lzma_block_coder *coder = coder_ptr;
|
||||
|
||||
if (coder->sequence != SEQ_CODE)
|
||||
return LZMA_PROG_ERROR;
|
||||
|
||||
@@ -156,7 +161,7 @@ block_encoder_update(lzma_coder *coder, lzma_allocator *allocator,
|
||||
|
||||
|
||||
extern lzma_ret
|
||||
lzma_block_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
lzma_block_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||
lzma_block *block)
|
||||
{
|
||||
lzma_next_coder_init(&lzma_block_encoder_init, next, allocator);
|
||||
@@ -166,7 +171,7 @@ lzma_block_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
|
||||
// The contents of the structure may depend on the version so
|
||||
// check the version first.
|
||||
if (block->version != 0)
|
||||
if (block->version > 1)
|
||||
return LZMA_OPTIONS_ERROR;
|
||||
|
||||
// If the Check ID is not supported, we cannot calculate the check and
|
||||
@@ -178,30 +183,31 @@ lzma_block_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
return LZMA_UNSUPPORTED_CHECK;
|
||||
|
||||
// Allocate and initialize *next->coder if needed.
|
||||
if (next->coder == NULL) {
|
||||
next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
|
||||
if (next->coder == NULL)
|
||||
lzma_block_coder *coder = next->coder;
|
||||
if (coder == NULL) {
|
||||
coder = lzma_alloc(sizeof(lzma_block_coder), allocator);
|
||||
if (coder == NULL)
|
||||
return LZMA_MEM_ERROR;
|
||||
|
||||
next->coder = coder;
|
||||
next->code = &block_encode;
|
||||
next->end = &block_encoder_end;
|
||||
next->update = &block_encoder_update;
|
||||
next->coder->next = LZMA_NEXT_CODER_INIT;
|
||||
coder->next = LZMA_NEXT_CODER_INIT;
|
||||
}
|
||||
|
||||
// Basic initializations
|
||||
next->coder->sequence = SEQ_CODE;
|
||||
next->coder->block = block;
|
||||
next->coder->compressed_size = 0;
|
||||
next->coder->uncompressed_size = 0;
|
||||
next->coder->pos = 0;
|
||||
coder->sequence = SEQ_CODE;
|
||||
coder->block = block;
|
||||
coder->compressed_size = 0;
|
||||
coder->uncompressed_size = 0;
|
||||
coder->pos = 0;
|
||||
|
||||
// Initialize the check
|
||||
lzma_check_init(&next->coder->check, block->check);
|
||||
lzma_check_init(&coder->check, block->check);
|
||||
|
||||
// Initialize the requested filters.
|
||||
return lzma_raw_encoder_init(&next->coder->next, allocator,
|
||||
block->filters);
|
||||
return lzma_raw_encoder_init(&coder->next, allocator, block->filters);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -42,6 +42,6 @@
|
||||
|
||||
|
||||
extern lzma_ret lzma_block_encoder_init(lzma_next_coder *next,
|
||||
lzma_allocator *allocator, lzma_block *block);
|
||||
const lzma_allocator *allocator, lzma_block *block);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
|
||||
static void
|
||||
free_properties(lzma_block *block, lzma_allocator *allocator)
|
||||
free_properties(lzma_block *block, const lzma_allocator *allocator)
|
||||
{
|
||||
// Free allocated filter options. The last array member is not
|
||||
// touched after the initialization in the beginning of
|
||||
@@ -32,7 +32,7 @@ free_properties(lzma_block *block, lzma_allocator *allocator)
|
||||
|
||||
extern LZMA_API(lzma_ret)
|
||||
lzma_block_header_decode(lzma_block *block,
|
||||
lzma_allocator *allocator, const uint8_t *in)
|
||||
const lzma_allocator *allocator, const uint8_t *in)
|
||||
{
|
||||
// NOTE: We consider the header to be corrupt not only when the
|
||||
// CRC32 doesn't match, but also when variable-length integers
|
||||
@@ -46,8 +46,16 @@ lzma_block_header_decode(lzma_block *block,
|
||||
block->filters[i].options = NULL;
|
||||
}
|
||||
|
||||
// Always zero for now.
|
||||
block->version = 0;
|
||||
// Versions 0 and 1 are supported. If a newer version was specified,
|
||||
// we need to downgrade it.
|
||||
if (block->version > 1)
|
||||
block->version = 1;
|
||||
|
||||
// This isn't a Block Header option, but since the decompressor will
|
||||
// read it if version >= 1, it's better to initialize it here than
|
||||
// to expect the caller to do it since in almost all cases this
|
||||
// should be false.
|
||||
block->ignore_check = false;
|
||||
|
||||
// Validate Block Header Size and Check type. The caller must have
|
||||
// already set these, so it is a programming error if this test fails.
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
extern LZMA_API(lzma_ret)
|
||||
lzma_block_header_size(lzma_block *block)
|
||||
{
|
||||
if (block->version != 0)
|
||||
if (block->version > 1)
|
||||
return LZMA_OPTIONS_ERROR;
|
||||
|
||||
// Block Header Size + Block Flags + CRC32.
|
||||
|
||||
@@ -51,7 +51,7 @@ lzma_block_unpadded_size(const lzma_block *block)
|
||||
// NOTE: This function is used for validation too, so it is
|
||||
// essential that these checks are always done even if
|
||||
// Compressed Size is unknown.
|
||||
if (block == NULL || block->version != 0
|
||||
if (block == NULL || block->version > 1
|
||||
|| block->header_size < LZMA_BLOCK_HEADER_SIZE_MIN
|
||||
|| block->header_size > LZMA_BLOCK_HEADER_SIZE_MAX
|
||||
|| (block->header_size & 3)
|
||||
|
||||
@@ -35,8 +35,8 @@ lzma_version_string(void)
|
||||
// Memory allocation //
|
||||
///////////////////////
|
||||
|
||||
extern void * lzma_attribute((malloc))
|
||||
lzma_alloc(size_t size, lzma_allocator *allocator)
|
||||
extern void * lzma_attribute((__malloc__)) lzma_attr_alloc_size(1)
|
||||
lzma_alloc(size_t size, const lzma_allocator *allocator)
|
||||
{
|
||||
// Some malloc() variants return NULL if called with size == 0.
|
||||
if (size == 0)
|
||||
@@ -53,8 +53,29 @@ lzma_alloc(size_t size, lzma_allocator *allocator)
|
||||
}
|
||||
|
||||
|
||||
extern void * lzma_attribute((__malloc__)) lzma_attr_alloc_size(1)
|
||||
lzma_alloc_zero(size_t size, const lzma_allocator *allocator)
|
||||
{
|
||||
// Some calloc() variants return NULL if called with size == 0.
|
||||
if (size == 0)
|
||||
size = 1;
|
||||
|
||||
void *ptr;
|
||||
|
||||
if (allocator != NULL && allocator->alloc != NULL) {
|
||||
ptr = allocator->alloc(allocator->opaque, 1, size);
|
||||
if (ptr != NULL)
|
||||
memzero(ptr, size);
|
||||
} else {
|
||||
ptr = calloc(1, size);
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
extern void
|
||||
lzma_free(void *ptr, lzma_allocator *allocator)
|
||||
lzma_free(void *ptr, const lzma_allocator *allocator)
|
||||
{
|
||||
if (allocator != NULL && allocator->free != NULL)
|
||||
allocator->free(allocator->opaque, ptr);
|
||||
@@ -88,7 +109,7 @@ lzma_bufcpy(const uint8_t *restrict in, size_t *restrict in_pos,
|
||||
|
||||
|
||||
extern lzma_ret
|
||||
lzma_next_filter_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
lzma_next_filter_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||
const lzma_filter_info *filters)
|
||||
{
|
||||
lzma_next_coder_init(filters[0].init, next, allocator);
|
||||
@@ -99,7 +120,7 @@ lzma_next_filter_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
|
||||
|
||||
extern lzma_ret
|
||||
lzma_next_filter_update(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
lzma_next_filter_update(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||
const lzma_filter *reversed_filters)
|
||||
{
|
||||
// Check that the application isn't trying to change the Filter ID.
|
||||
@@ -117,7 +138,7 @@ lzma_next_filter_update(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
|
||||
|
||||
extern void
|
||||
lzma_next_end(lzma_next_coder *next, lzma_allocator *allocator)
|
||||
lzma_next_end(lzma_next_coder *next, const lzma_allocator *allocator)
|
||||
{
|
||||
if (next->init != (uintptr_t)(NULL)) {
|
||||
// To avoid tiny end functions that simply call
|
||||
@@ -176,7 +197,7 @@ lzma_code(lzma_stream *strm, lzma_action action)
|
||||
|| (strm->next_out == NULL && strm->avail_out != 0)
|
||||
|| strm->internal == NULL
|
||||
|| strm->internal->next.code == NULL
|
||||
|| (unsigned int)(action) > LZMA_FINISH
|
||||
|| (unsigned int)(action) > LZMA_ACTION_MAX
|
||||
|| !strm->internal->supported_actions[action])
|
||||
return LZMA_PROG_ERROR;
|
||||
|
||||
@@ -186,7 +207,6 @@ lzma_code(lzma_stream *strm, lzma_action action)
|
||||
|| strm->reserved_ptr2 != NULL
|
||||
|| strm->reserved_ptr3 != NULL
|
||||
|| strm->reserved_ptr4 != NULL
|
||||
|| strm->reserved_int1 != 0
|
||||
|| strm->reserved_int2 != 0
|
||||
|| strm->reserved_int3 != 0
|
||||
|| strm->reserved_int4 != 0
|
||||
@@ -211,6 +231,10 @@ lzma_code(lzma_stream *strm, lzma_action action)
|
||||
case LZMA_FINISH:
|
||||
strm->internal->sequence = ISEQ_FINISH;
|
||||
break;
|
||||
|
||||
case LZMA_FULL_BARRIER:
|
||||
strm->internal->sequence = ISEQ_FULL_BARRIER;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -238,6 +262,13 @@ lzma_code(lzma_stream *strm, lzma_action action)
|
||||
|
||||
break;
|
||||
|
||||
case ISEQ_FULL_BARRIER:
|
||||
if (action != LZMA_FULL_BARRIER
|
||||
|| strm->internal->avail_in != strm->avail_in)
|
||||
return LZMA_PROG_ERROR;
|
||||
|
||||
break;
|
||||
|
||||
case ISEQ_END:
|
||||
return LZMA_STREAM_END;
|
||||
|
||||
@@ -286,9 +317,22 @@ lzma_code(lzma_stream *strm, lzma_action action)
|
||||
ret = LZMA_OK;
|
||||
break;
|
||||
|
||||
case LZMA_SEEK_NEEDED:
|
||||
strm->internal->allow_buf_error = false;
|
||||
|
||||
// If LZMA_FINISH was used, reset it back to the
|
||||
// LZMA_RUN-based state so that new input can be supplied
|
||||
// by the application.
|
||||
if (strm->internal->sequence == ISEQ_FINISH)
|
||||
strm->internal->sequence = ISEQ_RUN;
|
||||
|
||||
break;
|
||||
|
||||
case LZMA_STREAM_END:
|
||||
if (strm->internal->sequence == ISEQ_SYNC_FLUSH
|
||||
|| strm->internal->sequence == ISEQ_FULL_FLUSH)
|
||||
|| strm->internal->sequence == ISEQ_FULL_FLUSH
|
||||
|| strm->internal->sequence
|
||||
== ISEQ_FULL_BARRIER)
|
||||
strm->internal->sequence = ISEQ_RUN;
|
||||
else
|
||||
strm->internal->sequence = ISEQ_END;
|
||||
@@ -328,6 +372,22 @@ lzma_end(lzma_stream *strm)
|
||||
}
|
||||
|
||||
|
||||
extern LZMA_API(void)
|
||||
lzma_get_progress(lzma_stream *strm,
|
||||
uint64_t *progress_in, uint64_t *progress_out)
|
||||
{
|
||||
if (strm->internal->next.get_progress != NULL) {
|
||||
strm->internal->next.get_progress(strm->internal->next.coder,
|
||||
progress_in, progress_out);
|
||||
} else {
|
||||
*progress_in = strm->total_in;
|
||||
*progress_out = strm->total_out;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
extern LZMA_API(lzma_check)
|
||||
lzma_get_check(const lzma_stream *strm)
|
||||
{
|
||||
@@ -385,8 +445,10 @@ lzma_memlimit_set(lzma_stream *strm, uint64_t new_memlimit)
|
||||
|| strm->internal->next.memconfig == NULL)
|
||||
return LZMA_PROG_ERROR;
|
||||
|
||||
if (new_memlimit != 0 && new_memlimit < LZMA_MEMUSAGE_BASE)
|
||||
return LZMA_MEMLIMIT_ERROR;
|
||||
// Zero is a special value that cannot be used as an actual limit.
|
||||
// If 0 was specified, use 1 instead.
|
||||
if (new_memlimit == 0)
|
||||
new_memlimit = 1;
|
||||
|
||||
return strm->internal->next.memconfig(strm->internal->next.coder,
|
||||
&memusage, &old_memlimit, new_memlimit);
|
||||
|
||||
@@ -32,8 +32,6 @@
|
||||
|
||||
#define LZMA_API(type) LZMA_API_EXPORT type LZMA_API_CALL
|
||||
|
||||
#define LZMA_UNSTABLE
|
||||
|
||||
#include "lzma.h"
|
||||
|
||||
// These allow helping the compiler in some often-executed branches, whose
|
||||
@@ -75,9 +73,14 @@
|
||||
( LZMA_TELL_NO_CHECK \
|
||||
| LZMA_TELL_UNSUPPORTED_CHECK \
|
||||
| LZMA_TELL_ANY_CHECK \
|
||||
| LZMA_IGNORE_CHECK \
|
||||
| LZMA_CONCATENATED )
|
||||
|
||||
|
||||
/// Largest valid lzma_action value as unsigned integer.
|
||||
#define LZMA_ACTION_MAX ((unsigned int)(LZMA_FULL_BARRIER))
|
||||
|
||||
|
||||
/// Special return value (lzma_ret) to indicate that a timeout was reached
|
||||
/// and lzma_code() must not return LZMA_BUF_ERROR. This is converted to
|
||||
/// LZMA_OK in lzma_code(). This is not in the lzma_ret enumeration because
|
||||
@@ -85,10 +88,6 @@
|
||||
#define LZMA_TIMED_OUT 32
|
||||
|
||||
|
||||
/// Type of encoder/decoder specific data; the actual structure is defined
|
||||
/// differently in different coders.
|
||||
typedef struct lzma_coder_s lzma_coder;
|
||||
|
||||
typedef struct lzma_next_coder_s lzma_next_coder;
|
||||
|
||||
typedef struct lzma_filter_info_s lzma_filter_info;
|
||||
@@ -96,7 +95,7 @@ typedef struct lzma_filter_info_s lzma_filter_info;
|
||||
|
||||
/// Type of a function used to initialize a filter encoder or decoder
|
||||
typedef lzma_ret (*lzma_init_function)(
|
||||
lzma_next_coder *next, lzma_allocator *allocator,
|
||||
lzma_next_coder *next, const lzma_allocator *allocator,
|
||||
const lzma_filter_info *filters);
|
||||
|
||||
/// Type of a function to do some kind of coding work (filters, Stream,
|
||||
@@ -104,7 +103,7 @@ typedef lzma_ret (*lzma_init_function)(
|
||||
/// input and output buffers, but for simplicity they still use this same
|
||||
/// function prototype.
|
||||
typedef lzma_ret (*lzma_code_function)(
|
||||
lzma_coder *coder, lzma_allocator *allocator,
|
||||
void *coder, const lzma_allocator *allocator,
|
||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||
size_t in_size, uint8_t *restrict out,
|
||||
size_t *restrict out_pos, size_t out_size,
|
||||
@@ -112,7 +111,7 @@ typedef lzma_ret (*lzma_code_function)(
|
||||
|
||||
/// Type of a function to free the memory allocated for the coder
|
||||
typedef void (*lzma_end_function)(
|
||||
lzma_coder *coder, lzma_allocator *allocator);
|
||||
void *coder, const lzma_allocator *allocator);
|
||||
|
||||
|
||||
/// Raw coder validates and converts an array of lzma_filter structures to
|
||||
@@ -135,7 +134,7 @@ struct lzma_filter_info_s {
|
||||
/// Hold data and function pointers of the next filter in the chain.
|
||||
struct lzma_next_coder_s {
|
||||
/// Pointer to coder-specific data
|
||||
lzma_coder *coder;
|
||||
void *coder;
|
||||
|
||||
/// Filter ID. This is LZMA_VLI_UNKNOWN when this structure doesn't
|
||||
/// point to a filter coder.
|
||||
@@ -155,18 +154,23 @@ struct lzma_next_coder_s {
|
||||
/// lzma_next_coder.coder.
|
||||
lzma_end_function end;
|
||||
|
||||
/// Pointer to a function to get progress information. If this is NULL,
|
||||
/// lzma_stream.total_in and .total_out are used instead.
|
||||
void (*get_progress)(void *coder,
|
||||
uint64_t *progress_in, uint64_t *progress_out);
|
||||
|
||||
/// Pointer to function to return the type of the integrity check.
|
||||
/// Most coders won't support this.
|
||||
lzma_check (*get_check)(const lzma_coder *coder);
|
||||
lzma_check (*get_check)(const void *coder);
|
||||
|
||||
/// Pointer to function to get and/or change the memory usage limit.
|
||||
/// If new_memlimit == 0, the limit is not changed.
|
||||
lzma_ret (*memconfig)(lzma_coder *coder, uint64_t *memusage,
|
||||
lzma_ret (*memconfig)(void *coder, uint64_t *memusage,
|
||||
uint64_t *old_memlimit, uint64_t new_memlimit);
|
||||
|
||||
/// Update the filter-specific options or the whole filter chain
|
||||
/// in the encoder.
|
||||
lzma_ret (*update)(lzma_coder *coder, lzma_allocator *allocator,
|
||||
lzma_ret (*update)(void *coder, const lzma_allocator *allocator,
|
||||
const lzma_filter *filters,
|
||||
const lzma_filter *reversed_filters);
|
||||
};
|
||||
@@ -180,6 +184,7 @@ struct lzma_next_coder_s {
|
||||
.id = LZMA_VLI_UNKNOWN, \
|
||||
.code = NULL, \
|
||||
.end = NULL, \
|
||||
.get_progress = NULL, \
|
||||
.get_check = NULL, \
|
||||
.memconfig = NULL, \
|
||||
.update = NULL, \
|
||||
@@ -201,6 +206,7 @@ struct lzma_internal_s {
|
||||
ISEQ_SYNC_FLUSH,
|
||||
ISEQ_FULL_FLUSH,
|
||||
ISEQ_FINISH,
|
||||
ISEQ_FULL_BARRIER,
|
||||
ISEQ_END,
|
||||
ISEQ_ERROR,
|
||||
} sequence;
|
||||
@@ -211,7 +217,7 @@ struct lzma_internal_s {
|
||||
size_t avail_in;
|
||||
|
||||
/// Indicates which lzma_action values are allowed by next.code.
|
||||
bool supported_actions[4];
|
||||
bool supported_actions[LZMA_ACTION_MAX + 1];
|
||||
|
||||
/// If true, lzma_code will return LZMA_BUF_ERROR if no progress was
|
||||
/// made (no input consumed and no output produced by next.code).
|
||||
@@ -220,11 +226,17 @@ struct lzma_internal_s {
|
||||
|
||||
|
||||
/// Allocates memory
|
||||
extern void *lzma_alloc(size_t size, lzma_allocator *allocator)
|
||||
lzma_attribute((malloc)) lzma_attr_alloc_size(1);
|
||||
extern void *lzma_alloc(size_t size, const lzma_allocator *allocator)
|
||||
lzma_attribute((__malloc__)) lzma_attr_alloc_size(1);
|
||||
|
||||
/// Allocates memory and zeroes it (like calloc()). This can be faster
|
||||
/// than lzma_alloc() + memzero() while being backward compatible with
|
||||
/// custom allocators.
|
||||
extern void * lzma_attribute((__malloc__)) lzma_attr_alloc_size(1)
|
||||
lzma_alloc_zero(size_t size, const lzma_allocator *allocator);
|
||||
|
||||
/// Frees memory
|
||||
extern void lzma_free(void *ptr, lzma_allocator *allocator);
|
||||
extern void lzma_free(void *ptr, const lzma_allocator *allocator);
|
||||
|
||||
|
||||
/// Allocates strm->internal if it is NULL, and initializes *strm and
|
||||
@@ -236,17 +248,19 @@ extern lzma_ret lzma_strm_init(lzma_stream *strm);
|
||||
/// than the filter being initialized now. This way the actual filter
|
||||
/// initialization functions don't need to use lzma_next_coder_init macro.
|
||||
extern lzma_ret lzma_next_filter_init(lzma_next_coder *next,
|
||||
lzma_allocator *allocator, const lzma_filter_info *filters);
|
||||
const lzma_allocator *allocator,
|
||||
const lzma_filter_info *filters);
|
||||
|
||||
/// Update the next filter in the chain, if any. This checks that
|
||||
/// the application is not trying to change the Filter IDs.
|
||||
extern lzma_ret lzma_next_filter_update(
|
||||
lzma_next_coder *next, lzma_allocator *allocator,
|
||||
lzma_next_coder *next, const lzma_allocator *allocator,
|
||||
const lzma_filter *reversed_filters);
|
||||
|
||||
/// Frees the memory allocated for next->coder either using next->end or,
|
||||
/// if next->end is NULL, using lzma_free.
|
||||
extern void lzma_next_end(lzma_next_coder *next, lzma_allocator *allocator);
|
||||
extern void lzma_next_end(lzma_next_coder *next,
|
||||
const lzma_allocator *allocator);
|
||||
|
||||
|
||||
/// Copy as much data as possible from in[] to out[] and update *in_pos
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
|
||||
extern LZMA_API(lzma_ret)
|
||||
lzma_easy_buffer_encode(uint32_t preset, lzma_check check,
|
||||
lzma_allocator *allocator, const uint8_t *in, size_t in_size,
|
||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||
const lzma_allocator *allocator, const uint8_t *in,
|
||||
size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size)
|
||||
{
|
||||
lzma_options_easy opt_easy;
|
||||
if (lzma_easy_preset(&opt_easy, preset))
|
||||
|
||||
855
src/liblzma/common/file_info.c
Normal file
855
src/liblzma/common/file_info.c
Normal file
@@ -0,0 +1,855 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/// \file file_info.c
|
||||
/// \brief Decode .xz file information into a lzma_index structure
|
||||
//
|
||||
// Author: Lasse Collin
|
||||
//
|
||||
// This file has been put into the public domain.
|
||||
// You can do whatever you want with this file.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "index_decoder.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
enum {
|
||||
SEQ_MAGIC_BYTES,
|
||||
SEQ_PADDING_SEEK,
|
||||
SEQ_PADDING_DECODE,
|
||||
SEQ_FOOTER,
|
||||
SEQ_INDEX_INIT,
|
||||
SEQ_INDEX_DECODE,
|
||||
SEQ_HEADER_DECODE,
|
||||
SEQ_HEADER_COMPARE,
|
||||
} sequence;
|
||||
|
||||
/// Absolute position of in[*in_pos] in the file. All code that
|
||||
/// modifies *in_pos also updates this. seek_to_pos() needs this
|
||||
/// to determine if we need to request the application to seek for
|
||||
/// us or if we can do the seeking internally by adjusting *in_pos.
|
||||
uint64_t file_cur_pos;
|
||||
|
||||
/// This refers to absolute positions of interesting parts of the
|
||||
/// input file. Sometimes it points to the *beginning* of a specific
|
||||
/// field and sometimes to the *end* of a field. The current target
|
||||
/// position at each moment is explained in the comments.
|
||||
uint64_t file_target_pos;
|
||||
|
||||
/// Size of the .xz file (from the application).
|
||||
uint64_t file_size;
|
||||
|
||||
/// Index decoder
|
||||
lzma_next_coder index_decoder;
|
||||
|
||||
/// Number of bytes remaining in the Index field that is currently
|
||||
/// being decoded.
|
||||
lzma_vli index_remaining;
|
||||
|
||||
/// The Index decoder will store the decoded Index in this pointer.
|
||||
lzma_index *this_index;
|
||||
|
||||
/// Amount of Stream Padding in the current Stream.
|
||||
lzma_vli stream_padding;
|
||||
|
||||
/// The final combined index is collected here.
|
||||
lzma_index *combined_index;
|
||||
|
||||
/// Pointer from the application where to store the index information
|
||||
/// after successful decoding.
|
||||
lzma_index **dest_index;
|
||||
|
||||
/// Pointer to lzma_stream.seek_pos to be used when returning
|
||||
/// LZMA_SEEK_NEEDED. This is set by seek_to_pos() when needed.
|
||||
uint64_t *external_seek_pos;
|
||||
|
||||
/// Memory usage limit
|
||||
uint64_t memlimit;
|
||||
|
||||
/// Stream Flags from the very beginning of the file.
|
||||
lzma_stream_flags first_header_flags;
|
||||
|
||||
/// Stream Flags from Stream Header of the current Stream.
|
||||
lzma_stream_flags header_flags;
|
||||
|
||||
/// Stream Flags from Stream Footer of the current Stream.
|
||||
lzma_stream_flags footer_flags;
|
||||
|
||||
size_t temp_pos;
|
||||
size_t temp_size;
|
||||
uint8_t temp[8192];
|
||||
|
||||
} lzma_file_info_coder;
|
||||
|
||||
|
||||
/// Copies data from in[*in_pos] into coder->temp until
|
||||
/// coder->temp_pos == coder->temp_size. This also keeps coder->file_cur_pos
|
||||
/// in sync with *in_pos. Returns true if more input is needed.
|
||||
static bool
|
||||
fill_temp(lzma_file_info_coder *coder, const uint8_t *restrict in,
|
||||
size_t *restrict in_pos, size_t in_size)
|
||||
{
|
||||
coder->file_cur_pos += lzma_bufcpy(in, in_pos, in_size,
|
||||
coder->temp, &coder->temp_pos, coder->temp_size);
|
||||
return coder->temp_pos < coder->temp_size;
|
||||
}
|
||||
|
||||
|
||||
/// Seeks to the absolute file position specified by target_pos.
|
||||
/// This tries to do the seeking by only modifying *in_pos, if possible.
|
||||
/// The main benefit of this is that if one passes the whole file at once
|
||||
/// to lzma_code(), the decoder will never need to return LZMA_SEEK_NEEDED
|
||||
/// as all the seeking can be done by adjusting *in_pos in this function.
|
||||
///
|
||||
/// Returns true if an external seek is needed and the caller must return
|
||||
/// LZMA_SEEK_NEEDED.
|
||||
static bool
|
||||
seek_to_pos(lzma_file_info_coder *coder, uint64_t target_pos,
|
||||
size_t in_start, size_t *in_pos, size_t in_size)
|
||||
{
|
||||
// The input buffer doesn't extend beyond the end of the file.
|
||||
// This has been checked by file_info_decode() already.
|
||||
assert(coder->file_size - coder->file_cur_pos >= in_size - *in_pos);
|
||||
|
||||
const uint64_t pos_min = coder->file_cur_pos - (*in_pos - in_start);
|
||||
const uint64_t pos_max = coder->file_cur_pos + (in_size - *in_pos);
|
||||
|
||||
bool external_seek_needed;
|
||||
|
||||
if (target_pos >= pos_min && target_pos <= pos_max) {
|
||||
// The requested position is available in the current input
|
||||
// buffer or right after it. That is, in a corner case we
|
||||
// end up setting *in_pos == in_size and thus will immediately
|
||||
// need new input bytes from the application.
|
||||
*in_pos += (size_t)(target_pos - coder->file_cur_pos);
|
||||
external_seek_needed = false;
|
||||
} else {
|
||||
// Ask the application to seek the input file.
|
||||
*coder->external_seek_pos = target_pos;
|
||||
external_seek_needed = true;
|
||||
|
||||
// Mark the whole input buffer as used. This way
|
||||
// lzma_stream.total_in will have a better estimate
|
||||
// of the amount of data read. It still won't be perfect
|
||||
// as the value will depend on the input buffer size that
|
||||
// the application uses, but it should be good enough for
|
||||
// those few who want an estimate.
|
||||
*in_pos = in_size;
|
||||
}
|
||||
|
||||
// After seeking (internal or external) the current position
|
||||
// will match the requested target position.
|
||||
coder->file_cur_pos = target_pos;
|
||||
|
||||
return external_seek_needed;
|
||||
}
|
||||
|
||||
|
||||
/// The caller sets coder->file_target_pos so that it points to the *end*
|
||||
/// of the desired file position. This function then determines how far
|
||||
/// backwards from that position we can seek. After seeking fill_temp()
|
||||
/// can be used to read data into coder->temp. When fill_temp() has finished,
|
||||
/// coder->temp[coder->temp_size] will match coder->file_target_pos.
|
||||
///
|
||||
/// This also validates that coder->target_file_pos is sane in sense that
|
||||
/// we aren't trying to seek too far backwards (too close or beyond the
|
||||
/// beginning of the file).
|
||||
static lzma_ret
|
||||
reverse_seek(lzma_file_info_coder *coder,
|
||||
size_t in_start, size_t *in_pos, size_t in_size)
|
||||
{
|
||||
// Check that there is enough data before the target position
|
||||
// to contain at least Stream Header and Stream Footer. If there
|
||||
// isn't, the file cannot be valid.
|
||||
if (coder->file_target_pos < 2 * LZMA_STREAM_HEADER_SIZE)
|
||||
return LZMA_DATA_ERROR;
|
||||
|
||||
coder->temp_pos = 0;
|
||||
|
||||
// The Stream Header at the very beginning of the file gets handled
|
||||
// specially in SEQ_MAGIC_BYTES and thus we will never need to seek
|
||||
// there. By not seeking to the first LZMA_STREAM_HEADER_SIZE bytes
|
||||
// we avoid a useless external seek after SEQ_MAGIC_BYTES if the
|
||||
// application uses an extremely small input buffer and the input
|
||||
// file is very small.
|
||||
if (coder->file_target_pos - LZMA_STREAM_HEADER_SIZE
|
||||
< sizeof(coder->temp))
|
||||
coder->temp_size = (size_t)(coder->file_target_pos
|
||||
- LZMA_STREAM_HEADER_SIZE);
|
||||
else
|
||||
coder->temp_size = sizeof(coder->temp);
|
||||
|
||||
// The above if-statements guarantee this. This is important because
|
||||
// the Stream Header/Footer decoders assume that there's at least
|
||||
// LZMA_STREAM_HEADER_SIZE bytes in coder->temp.
|
||||
assert(coder->temp_size >= LZMA_STREAM_HEADER_SIZE);
|
||||
|
||||
if (seek_to_pos(coder, coder->file_target_pos - coder->temp_size,
|
||||
in_start, in_pos, in_size))
|
||||
return LZMA_SEEK_NEEDED;
|
||||
|
||||
return LZMA_OK;
|
||||
}
|
||||
|
||||
|
||||
/// Gets the number of zero-bytes at the end of the buffer.
|
||||
static size_t
|
||||
get_padding_size(const uint8_t *buf, size_t buf_size)
|
||||
{
|
||||
size_t padding = 0;
|
||||
while (buf_size > 0 && buf[--buf_size] == 0x00)
|
||||
++padding;
|
||||
|
||||
return padding;
|
||||
}
|
||||
|
||||
|
||||
/// With the Stream Header at the very beginning of the file, LZMA_FORMAT_ERROR
|
||||
/// is used to tell the application that Magic Bytes didn't match. In other
|
||||
/// Stream Header/Footer fields (in the middle/end of the file) it could be
|
||||
/// a bit confusing to return LZMA_FORMAT_ERROR as we already know that there
|
||||
/// is a valid Stream Header at the beginning of the file. For those cases
|
||||
/// this function is used to convert LZMA_FORMAT_ERROR to LZMA_DATA_ERROR.
|
||||
static lzma_ret
|
||||
hide_format_error(lzma_ret ret)
|
||||
{
|
||||
if (ret == LZMA_FORMAT_ERROR)
|
||||
ret = LZMA_DATA_ERROR;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/// Calls the Index decoder and updates coder->index_remaining.
|
||||
/// This is a separate function because the input can be either directly
|
||||
/// from the application or from coder->temp.
|
||||
static lzma_ret
|
||||
decode_index(lzma_file_info_coder *coder, const lzma_allocator *allocator,
|
||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||
size_t in_size, bool update_file_cur_pos)
|
||||
{
|
||||
const size_t in_start = *in_pos;
|
||||
|
||||
const lzma_ret ret = coder->index_decoder.code(
|
||||
coder->index_decoder.coder,
|
||||
allocator, in, in_pos, in_size,
|
||||
NULL, NULL, 0, LZMA_RUN);
|
||||
|
||||
coder->index_remaining -= *in_pos - in_start;
|
||||
|
||||
if (update_file_cur_pos)
|
||||
coder->file_cur_pos += *in_pos - in_start;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static lzma_ret
|
||||
file_info_decode(void *coder_ptr, const lzma_allocator *allocator,
|
||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||
size_t in_size,
|
||||
uint8_t *restrict out lzma_attribute((__unused__)),
|
||||
size_t *restrict out_pos lzma_attribute((__unused__)),
|
||||
size_t out_size lzma_attribute((__unused__)),
|
||||
lzma_action action lzma_attribute((__unused__)))
|
||||
{
|
||||
lzma_file_info_coder *coder = coder_ptr;
|
||||
const size_t in_start = *in_pos;
|
||||
|
||||
// If the caller provides input past the end of the file, trim
|
||||
// the extra bytes from the buffer so that we won't read too far.
|
||||
assert(coder->file_size >= coder->file_cur_pos);
|
||||
if (coder->file_size - coder->file_cur_pos < in_size - in_start)
|
||||
in_size = in_start
|
||||
+ (size_t)(coder->file_size - coder->file_cur_pos);
|
||||
|
||||
while (true)
|
||||
switch (coder->sequence) {
|
||||
case SEQ_MAGIC_BYTES:
|
||||
// Decode the Stream Header at the beginning of the file
|
||||
// first to check if the Magic Bytes match. The flags
|
||||
// are stored in coder->first_header_flags so that we
|
||||
// don't need to seek to it again.
|
||||
//
|
||||
// Check that the file is big enough to contain at least
|
||||
// Stream Header.
|
||||
if (coder->file_size < LZMA_STREAM_HEADER_SIZE)
|
||||
return LZMA_FORMAT_ERROR;
|
||||
|
||||
// Read the Stream Header field into coder->temp.
|
||||
if (fill_temp(coder, in, in_pos, in_size))
|
||||
return LZMA_OK;
|
||||
|
||||
// This is the only Stream Header/Footer decoding where we
|
||||
// want to return LZMA_FORMAT_ERROR if the Magic Bytes don't
|
||||
// match. Elsewehere it will be converted to LZMA_DATA_ERROR.
|
||||
return_if_error(lzma_stream_header_decode(
|
||||
&coder->first_header_flags, coder->temp));
|
||||
|
||||
// Now that we know that the Magic Bytes match, check the
|
||||
// file size. It's better to do this here after checking the
|
||||
// Magic Bytes since this way we can give LZMA_FORMAT_ERROR
|
||||
// instead of LZMA_DATA_ERROR when the Magic Bytes don't
|
||||
// match in a file that is too big or isn't a multiple of
|
||||
// four bytes.
|
||||
if (coder->file_size > LZMA_VLI_MAX || (coder->file_size & 3))
|
||||
return LZMA_DATA_ERROR;
|
||||
|
||||
// Start looking for Stream Padding and Stream Footer
|
||||
// at the end of the file.
|
||||
coder->file_target_pos = coder->file_size;
|
||||
|
||||
// Fall through
|
||||
|
||||
case SEQ_PADDING_SEEK:
|
||||
coder->sequence = SEQ_PADDING_DECODE;
|
||||
return_if_error(reverse_seek(
|
||||
coder, in_start, in_pos, in_size));
|
||||
|
||||
// Fall through
|
||||
|
||||
case SEQ_PADDING_DECODE: {
|
||||
// Copy to coder->temp first. This keeps the code simpler if
|
||||
// the application only provides input a few bytes at a time.
|
||||
if (fill_temp(coder, in, in_pos, in_size))
|
||||
return LZMA_OK;
|
||||
|
||||
// Scan the buffer backwards to get the size of the
|
||||
// Stream Padding field (if any).
|
||||
const size_t new_padding = get_padding_size(
|
||||
coder->temp, coder->temp_size);
|
||||
coder->stream_padding += new_padding;
|
||||
|
||||
// Set the target position to the beginning of Stream Padding
|
||||
// that has been observed so far. If all Stream Padding has
|
||||
// been seen, then the target position will be at the end
|
||||
// of the Stream Footer field.
|
||||
coder->file_target_pos -= new_padding;
|
||||
|
||||
if (new_padding == coder->temp_size) {
|
||||
// The whole buffer was padding. Seek backwards in
|
||||
// the file to get more input.
|
||||
coder->sequence = SEQ_PADDING_SEEK;
|
||||
break;
|
||||
}
|
||||
|
||||
// Size of Stream Padding must be a multiple of 4 bytes.
|
||||
if (coder->stream_padding & 3)
|
||||
return LZMA_DATA_ERROR;
|
||||
|
||||
coder->sequence = SEQ_FOOTER;
|
||||
|
||||
// Calculate the amount of non-padding data in coder->temp.
|
||||
coder->temp_size -= new_padding;
|
||||
coder->temp_pos = coder->temp_size;
|
||||
|
||||
// We can avoid an external seek if the whole Stream Footer
|
||||
// is already in coder->temp. In that case SEQ_FOOTER won't
|
||||
// read more input and will find the Stream Footer from
|
||||
// coder->temp[coder->temp_size - LZMA_STREAM_HEADER_SIZE].
|
||||
//
|
||||
// Otherwise we will need to seek. The seeking is done so
|
||||
// that Stream Footer wil be at the end of coder->temp.
|
||||
// This way it's likely that we also get a complete Index
|
||||
// field into coder->temp without needing a separate seek
|
||||
// for that (unless the Index field is big).
|
||||
if (coder->temp_size < LZMA_STREAM_HEADER_SIZE)
|
||||
return_if_error(reverse_seek(
|
||||
coder, in_start, in_pos, in_size));
|
||||
}
|
||||
|
||||
// Fall through
|
||||
|
||||
case SEQ_FOOTER:
|
||||
// Copy the Stream Footer field into coder->temp.
|
||||
// If Stream Footer was already available in coder->temp
|
||||
// in SEQ_PADDING_DECODE, then this does nothing.
|
||||
if (fill_temp(coder, in, in_pos, in_size))
|
||||
return LZMA_OK;
|
||||
|
||||
// Make coder->file_target_pos and coder->temp_size point
|
||||
// to the beginning of Stream Footer and thus to the end
|
||||
// of the Index field. coder->temp_pos will be updated
|
||||
// a bit later.
|
||||
coder->file_target_pos -= LZMA_STREAM_HEADER_SIZE;
|
||||
coder->temp_size -= LZMA_STREAM_HEADER_SIZE;
|
||||
|
||||
// Decode Stream Footer.
|
||||
return_if_error(hide_format_error(lzma_stream_footer_decode(
|
||||
&coder->footer_flags,
|
||||
coder->temp + coder->temp_size)));
|
||||
|
||||
// Check that we won't seek past the beginning of the file.
|
||||
//
|
||||
// LZMA_STREAM_HEADER_SIZE is added because there must be
|
||||
// space for Stream Header too even though we won't seek
|
||||
// there before decoding the Index field.
|
||||
//
|
||||
// There's no risk of integer overflow here because
|
||||
// Backward Size cannot be greater than 2^34.
|
||||
if (coder->file_target_pos < coder->footer_flags.backward_size
|
||||
+ LZMA_STREAM_HEADER_SIZE)
|
||||
return LZMA_DATA_ERROR;
|
||||
|
||||
// Set the target position to the beginning of the Index field.
|
||||
coder->file_target_pos -= coder->footer_flags.backward_size;
|
||||
coder->sequence = SEQ_INDEX_INIT;
|
||||
|
||||
// We can avoid an external seek if the whole Index field is
|
||||
// already available in coder->temp.
|
||||
if (coder->temp_size >= coder->footer_flags.backward_size) {
|
||||
// Set coder->temp_pos to point to the beginning
|
||||
// of the Index.
|
||||
coder->temp_pos = coder->temp_size
|
||||
- coder->footer_flags.backward_size;
|
||||
} else {
|
||||
// These are set to zero to indicate that there's no
|
||||
// useful data (Index or anything else) in coder->temp.
|
||||
coder->temp_pos = 0;
|
||||
coder->temp_size = 0;
|
||||
|
||||
// Seek to the beginning of the Index field.
|
||||
if (seek_to_pos(coder, coder->file_target_pos,
|
||||
in_start, in_pos, in_size))
|
||||
return LZMA_SEEK_NEEDED;
|
||||
}
|
||||
|
||||
// Fall through
|
||||
|
||||
case SEQ_INDEX_INIT: {
|
||||
// Calculate the amount of memory already used by the earlier
|
||||
// Indexes so that we know how big memory limit to pass to
|
||||
// the Index decoder.
|
||||
//
|
||||
// NOTE: When there are multiple Streams, the separate
|
||||
// lzma_index structures can use more RAM (as measured by
|
||||
// lzma_index_memused()) than the final combined lzma_index.
|
||||
// Thus memlimit may need to be slightly higher than the final
|
||||
// calculated memory usage will be. This is perhaps a bit
|
||||
// confusing to the application, but I think it shouldn't
|
||||
// cause problems in practice.
|
||||
uint64_t memused = 0;
|
||||
if (coder->combined_index != NULL) {
|
||||
memused = lzma_index_memused(coder->combined_index);
|
||||
assert(memused <= coder->memlimit);
|
||||
if (memused > coder->memlimit) // Extra sanity check
|
||||
return LZMA_PROG_ERROR;
|
||||
}
|
||||
|
||||
// Initialize the Index decoder.
|
||||
return_if_error(lzma_index_decoder_init(
|
||||
&coder->index_decoder, allocator,
|
||||
&coder->this_index,
|
||||
coder->memlimit - memused));
|
||||
|
||||
coder->index_remaining = coder->footer_flags.backward_size;
|
||||
coder->sequence = SEQ_INDEX_DECODE;
|
||||
}
|
||||
|
||||
// Fall through
|
||||
|
||||
case SEQ_INDEX_DECODE: {
|
||||
// Decode (a part of) the Index. If the whole Index is already
|
||||
// in coder->temp, read it from there. Otherwise read from
|
||||
// in[*in_pos] onwards. Note that index_decode() updates
|
||||
// coder->index_remaining and optionally coder->file_cur_pos.
|
||||
lzma_ret ret;
|
||||
if (coder->temp_size != 0) {
|
||||
assert(coder->temp_size - coder->temp_pos
|
||||
== coder->index_remaining);
|
||||
ret = decode_index(coder, allocator, coder->temp,
|
||||
&coder->temp_pos, coder->temp_size,
|
||||
false);
|
||||
} else {
|
||||
// Don't give the decoder more input than the known
|
||||
// remaining size of the Index field.
|
||||
size_t in_stop = in_size;
|
||||
if (in_size - *in_pos > coder->index_remaining)
|
||||
in_stop = *in_pos
|
||||
+ (size_t)(coder->index_remaining);
|
||||
|
||||
ret = decode_index(coder, allocator,
|
||||
in, in_pos, in_stop, true);
|
||||
}
|
||||
|
||||
switch (ret) {
|
||||
case LZMA_OK:
|
||||
// If the Index docoder asks for more input when we
|
||||
// have already given it as much input as Backward Size
|
||||
// indicated, the file is invalid.
|
||||
if (coder->index_remaining == 0)
|
||||
return LZMA_DATA_ERROR;
|
||||
|
||||
// We cannot get here if we were reading Index from
|
||||
// coder->temp because when reading from coder->temp
|
||||
// we give the Index decoder exactly
|
||||
// coder->index_remaining bytes of input.
|
||||
assert(coder->temp_size == 0);
|
||||
|
||||
return LZMA_OK;
|
||||
|
||||
case LZMA_STREAM_END:
|
||||
// If the decoding seems to be successful, check also
|
||||
// that the Index decoder consumed as much input as
|
||||
// indicated by the Backward Size field.
|
||||
if (coder->index_remaining != 0)
|
||||
return LZMA_DATA_ERROR;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Calculate how much the Index tells us to seek backwards
|
||||
// (relative to the beginning of the Index): Total size of
|
||||
// all Blocks plus the size of the Stream Header field.
|
||||
// No integer overflow here because lzma_index_total_size()
|
||||
// cannot return a value greater than LZMA_VLI_MAX.
|
||||
const uint64_t seek_amount
|
||||
= lzma_index_total_size(coder->this_index)
|
||||
+ LZMA_STREAM_HEADER_SIZE;
|
||||
|
||||
// Check that Index is sane in sense that seek_amount won't
|
||||
// make us seek past the beginning of the file when locating
|
||||
// the Stream Header.
|
||||
//
|
||||
// coder->file_target_pos still points to the beginning of
|
||||
// the Index field.
|
||||
if (coder->file_target_pos < seek_amount)
|
||||
return LZMA_DATA_ERROR;
|
||||
|
||||
// Set the target to the beginning of Stream Header.
|
||||
coder->file_target_pos -= seek_amount;
|
||||
|
||||
if (coder->file_target_pos == 0) {
|
||||
// We would seek to the beginning of the file, but
|
||||
// since we already decoded that Stream Header in
|
||||
// SEQ_MAGIC_BYTES, we can use the cached value from
|
||||
// coder->first_header_flags to avoid the seek.
|
||||
coder->header_flags = coder->first_header_flags;
|
||||
coder->sequence = SEQ_HEADER_COMPARE;
|
||||
break;
|
||||
}
|
||||
|
||||
coder->sequence = SEQ_HEADER_DECODE;
|
||||
|
||||
// Make coder->file_target_pos point to the end of
|
||||
// the Stream Header field.
|
||||
coder->file_target_pos += LZMA_STREAM_HEADER_SIZE;
|
||||
|
||||
// If coder->temp_size is non-zero, it points to the end
|
||||
// of the Index field. Then the beginning of the Index
|
||||
// field is at coder->temp[coder->temp_size
|
||||
// - coder->footer_flags.backward_size].
|
||||
assert(coder->temp_size == 0 || coder->temp_size
|
||||
>= coder->footer_flags.backward_size);
|
||||
|
||||
// If coder->temp contained the whole Index, see if it has
|
||||
// enough data to contain also the Stream Header. If so,
|
||||
// we avoid an external seek.
|
||||
//
|
||||
// NOTE: This can happen only with small .xz files and only
|
||||
// for the non-first Stream as the Stream Flags of the first
|
||||
// Stream are cached and already handled a few lines above.
|
||||
// So this isn't as useful as the other seek-avoidance cases.
|
||||
if (coder->temp_size != 0 && coder->temp_size
|
||||
- coder->footer_flags.backward_size
|
||||
>= seek_amount) {
|
||||
// Make temp_pos and temp_size point to the *end* of
|
||||
// Stream Header so that SEQ_HEADER_DECODE will find
|
||||
// the start of Stream Header from coder->temp[
|
||||
// coder->temp_size - LZMA_STREAM_HEADER_SIZE].
|
||||
coder->temp_pos = coder->temp_size
|
||||
- coder->footer_flags.backward_size
|
||||
- seek_amount
|
||||
+ LZMA_STREAM_HEADER_SIZE;
|
||||
coder->temp_size = coder->temp_pos;
|
||||
} else {
|
||||
// Seek so that Stream Header will be at the end of
|
||||
// coder->temp. With typical multi-Stream files we
|
||||
// will usually also get the Stream Footer and Index
|
||||
// of the *previous* Stream in coder->temp and thus
|
||||
// won't need a separate seek for them.
|
||||
return_if_error(reverse_seek(coder,
|
||||
in_start, in_pos, in_size));
|
||||
}
|
||||
}
|
||||
|
||||
// Fall through
|
||||
|
||||
case SEQ_HEADER_DECODE:
|
||||
// Copy the Stream Header field into coder->temp.
|
||||
// If Stream Header was already available in coder->temp
|
||||
// in SEQ_INDEX_DECODE, then this does nothing.
|
||||
if (fill_temp(coder, in, in_pos, in_size))
|
||||
return LZMA_OK;
|
||||
|
||||
// Make all these point to the beginning of Stream Header.
|
||||
coder->file_target_pos -= LZMA_STREAM_HEADER_SIZE;
|
||||
coder->temp_size -= LZMA_STREAM_HEADER_SIZE;
|
||||
coder->temp_pos = coder->temp_size;
|
||||
|
||||
// Decode the Stream Header.
|
||||
return_if_error(hide_format_error(lzma_stream_header_decode(
|
||||
&coder->header_flags,
|
||||
coder->temp + coder->temp_size)));
|
||||
|
||||
coder->sequence = SEQ_HEADER_COMPARE;
|
||||
|
||||
// Fall through
|
||||
|
||||
case SEQ_HEADER_COMPARE:
|
||||
// Compare Stream Header against Stream Footer. They must
|
||||
// match.
|
||||
return_if_error(lzma_stream_flags_compare(
|
||||
&coder->header_flags, &coder->footer_flags));
|
||||
|
||||
// Store the decoded Stream Flags into the Index. Use the
|
||||
// Footer Flags because it contains Backward Size, although
|
||||
// it shouldn't matter in practice.
|
||||
if (lzma_index_stream_flags(coder->this_index,
|
||||
&coder->footer_flags) != LZMA_OK)
|
||||
return LZMA_PROG_ERROR;
|
||||
|
||||
// Store also the size of the Stream Padding field. It is
|
||||
// needed to calculate the offsets of the Streams correctly.
|
||||
if (lzma_index_stream_padding(coder->this_index,
|
||||
coder->stream_padding) != LZMA_OK)
|
||||
return LZMA_PROG_ERROR;
|
||||
|
||||
// Reset it so that it's ready for the next Stream.
|
||||
coder->stream_padding = 0;
|
||||
|
||||
// Append the earlier decoded Indexes after this_index.
|
||||
if (coder->combined_index != NULL)
|
||||
return_if_error(lzma_index_cat(coder->this_index,
|
||||
coder->combined_index, allocator));
|
||||
|
||||
coder->combined_index = coder->this_index;
|
||||
coder->this_index = NULL;
|
||||
|
||||
// If the whole file was decoded, tell the caller that we
|
||||
// are finished.
|
||||
if (coder->file_target_pos == 0) {
|
||||
// The combined index must indicate the same file
|
||||
// size as was told to us at initialization.
|
||||
assert(lzma_index_file_size(coder->combined_index)
|
||||
== coder->file_size);
|
||||
|
||||
// Make the combined index available to
|
||||
// the application.
|
||||
*coder->dest_index = coder->combined_index;
|
||||
coder->combined_index = NULL;
|
||||
|
||||
// Mark the input buffer as used since we may have
|
||||
// done internal seeking and thus don't know how
|
||||
// many input bytes were actually used. This way
|
||||
// lzma_stream.total_in gets a slightly better
|
||||
// estimate of the amount of input used.
|
||||
*in_pos = in_size;
|
||||
return LZMA_STREAM_END;
|
||||
}
|
||||
|
||||
// We didn't hit the beginning of the file yet, so continue
|
||||
// reading backwards in the file. If we have unprocessed
|
||||
// data in coder->temp, use it before requesting more data
|
||||
// from the application.
|
||||
//
|
||||
// coder->file_target_pos, coder->temp_size, and
|
||||
// coder->temp_pos all point to the beginning of Stream Header
|
||||
// and thus the end of the previous Stream in the file.
|
||||
coder->sequence = coder->temp_size > 0
|
||||
? SEQ_PADDING_DECODE : SEQ_PADDING_SEEK;
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
return LZMA_PROG_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static lzma_ret
|
||||
file_info_decoder_memconfig(void *coder_ptr, uint64_t *memusage,
|
||||
uint64_t *old_memlimit, uint64_t new_memlimit)
|
||||
{
|
||||
lzma_file_info_coder *coder = coder_ptr;
|
||||
|
||||
// The memory usage calculation comes from three things:
|
||||
//
|
||||
// (1) The Indexes that have already been decoded and processed into
|
||||
// coder->combined_index.
|
||||
//
|
||||
// (2) The latest Index in coder->this_index that has been decoded but
|
||||
// not yet put into coder->combined_index.
|
||||
//
|
||||
// (3) The latest Index that we have started decoding but haven't
|
||||
// finished and thus isn't available in coder->this_index yet.
|
||||
// Memory usage and limit information needs to be communicated
|
||||
// from/to coder->index_decoder.
|
||||
//
|
||||
// Care has to be taken to not do both (2) and (3) when calculating
|
||||
// the memory usage.
|
||||
uint64_t combined_index_memusage = 0;
|
||||
uint64_t this_index_memusage = 0;
|
||||
|
||||
// (1) If we have already successfully decoded one or more Indexes,
|
||||
// get their memory usage.
|
||||
if (coder->combined_index != NULL)
|
||||
combined_index_memusage = lzma_index_memused(
|
||||
coder->combined_index);
|
||||
|
||||
// Choose between (2), (3), or neither.
|
||||
if (coder->this_index != NULL) {
|
||||
// (2) The latest Index is available. Use its memory usage.
|
||||
this_index_memusage = lzma_index_memused(coder->this_index);
|
||||
|
||||
} else if (coder->sequence == SEQ_INDEX_DECODE) {
|
||||
// (3) The Index decoder is activate and hasn't yet stored
|
||||
// the new index in coder->this_index. Get the memory usage
|
||||
// information from the Index decoder.
|
||||
//
|
||||
// NOTE: If the Index decoder doesn't yet know how much memory
|
||||
// it will eventually need, it will return a tiny value here.
|
||||
uint64_t dummy;
|
||||
if (coder->index_decoder.memconfig(coder->index_decoder.coder,
|
||||
&this_index_memusage, &dummy, 0)
|
||||
!= LZMA_OK) {
|
||||
assert(0);
|
||||
return LZMA_PROG_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
// Now we know the total memory usage/requirement. If we had neither
|
||||
// old Indexes nor a new Index, this will be zero which isn't
|
||||
// acceptable as lzma_memusage() has to return non-zero on success
|
||||
// and even with an empty .xz file we will end up with a lzma_index
|
||||
// that takes some memory.
|
||||
*memusage = combined_index_memusage + this_index_memusage;
|
||||
if (*memusage == 0)
|
||||
*memusage = lzma_index_memusage(1, 0);
|
||||
|
||||
*old_memlimit = coder->memlimit;
|
||||
|
||||
// If requested, set a new memory usage limit.
|
||||
if (new_memlimit != 0) {
|
||||
if (new_memlimit < *memusage)
|
||||
return LZMA_MEMLIMIT_ERROR;
|
||||
|
||||
// In the condition (3) we need to tell the Index decoder
|
||||
// its new memory usage limit.
|
||||
if (coder->this_index == NULL
|
||||
&& coder->sequence == SEQ_INDEX_DECODE) {
|
||||
const uint64_t idec_new_memlimit = new_memlimit
|
||||
- combined_index_memusage;
|
||||
|
||||
assert(this_index_memusage > 0);
|
||||
assert(idec_new_memlimit > 0);
|
||||
|
||||
uint64_t dummy1;
|
||||
uint64_t dummy2;
|
||||
|
||||
if (coder->index_decoder.memconfig(
|
||||
coder->index_decoder.coder,
|
||||
&dummy1, &dummy2, idec_new_memlimit)
|
||||
!= LZMA_OK) {
|
||||
assert(0);
|
||||
return LZMA_PROG_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
coder->memlimit = new_memlimit;
|
||||
}
|
||||
|
||||
return LZMA_OK;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
file_info_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
|
||||
{
|
||||
lzma_file_info_coder *coder = coder_ptr;
|
||||
|
||||
lzma_next_end(&coder->index_decoder, allocator);
|
||||
lzma_index_end(coder->this_index, allocator);
|
||||
lzma_index_end(coder->combined_index, allocator);
|
||||
|
||||
lzma_free(coder, allocator);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static lzma_ret
|
||||
lzma_file_info_decoder_init(lzma_next_coder *next,
|
||||
const lzma_allocator *allocator, uint64_t *seek_pos,
|
||||
lzma_index **dest_index,
|
||||
uint64_t memlimit, uint64_t file_size)
|
||||
{
|
||||
lzma_next_coder_init(&lzma_file_info_decoder_init, next, allocator);
|
||||
|
||||
if (dest_index == NULL)
|
||||
return LZMA_PROG_ERROR;
|
||||
|
||||
lzma_file_info_coder *coder = next->coder;
|
||||
if (coder == NULL) {
|
||||
coder = lzma_alloc(sizeof(lzma_file_info_coder), allocator);
|
||||
if (coder == NULL)
|
||||
return LZMA_MEM_ERROR;
|
||||
|
||||
next->coder = coder;
|
||||
next->code = &file_info_decode;
|
||||
next->end = &file_info_decoder_end;
|
||||
next->memconfig = &file_info_decoder_memconfig;
|
||||
|
||||
coder->index_decoder = LZMA_NEXT_CODER_INIT;
|
||||
coder->this_index = NULL;
|
||||
coder->combined_index = NULL;
|
||||
}
|
||||
|
||||
coder->sequence = SEQ_MAGIC_BYTES;
|
||||
coder->file_cur_pos = 0;
|
||||
coder->file_target_pos = 0;
|
||||
coder->file_size = file_size;
|
||||
|
||||
lzma_index_end(coder->this_index, allocator);
|
||||
coder->this_index = NULL;
|
||||
|
||||
lzma_index_end(coder->combined_index, allocator);
|
||||
coder->combined_index = NULL;
|
||||
|
||||
coder->stream_padding = 0;
|
||||
|
||||
coder->dest_index = dest_index;
|
||||
coder->external_seek_pos = seek_pos;
|
||||
|
||||
// If memlimit is 0, make it 1 to ensure that lzma_memlimit_get()
|
||||
// won't return 0 (which would indicate an error).
|
||||
coder->memlimit = my_max(1, memlimit);
|
||||
|
||||
// Preprare thse for reading the first Stream Header into coder->temp.
|
||||
coder->temp_pos = 0;
|
||||
coder->temp_size = LZMA_STREAM_HEADER_SIZE;
|
||||
|
||||
return LZMA_OK;
|
||||
}
|
||||
|
||||
|
||||
extern LZMA_API(lzma_ret)
|
||||
lzma_file_info_decoder(lzma_stream *strm, lzma_index **dest_index,
|
||||
uint64_t memlimit, uint64_t file_size)
|
||||
{
|
||||
lzma_next_strm_init(lzma_file_info_decoder_init, strm, &strm->seek_pos,
|
||||
dest_index, memlimit, file_size);
|
||||
|
||||
// We allow LZMA_FINISH in addition to LZMA_RUN for convenience.
|
||||
// lzma_code() is able to handle the LZMA_FINISH + LZMA_SEEK_NEEDED
|
||||
// combination in a sane way. Applications still need to be careful
|
||||
// if they use LZMA_FINISH so that they remember to reset it back
|
||||
// to LZMA_RUN after seeking if needed.
|
||||
strm->internal->supported_actions[LZMA_RUN] = true;
|
||||
strm->internal->supported_actions[LZMA_FINISH] = true;
|
||||
|
||||
return LZMA_OK;
|
||||
}
|
||||
@@ -14,7 +14,8 @@
|
||||
|
||||
|
||||
extern LZMA_API(lzma_ret)
|
||||
lzma_raw_buffer_decode(const lzma_filter *filters, lzma_allocator *allocator,
|
||||
lzma_raw_buffer_decode(
|
||||
const lzma_filter *filters, const lzma_allocator *allocator,
|
||||
const uint8_t *in, size_t *in_pos, size_t in_size,
|
||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||
{
|
||||
|
||||
@@ -14,9 +14,10 @@
|
||||
|
||||
|
||||
extern LZMA_API(lzma_ret)
|
||||
lzma_raw_buffer_encode(const lzma_filter *filters, lzma_allocator *allocator,
|
||||
const uint8_t *in, size_t in_size, uint8_t *out,
|
||||
size_t *out_pos, size_t out_size)
|
||||
lzma_raw_buffer_encode(
|
||||
const lzma_filter *filters, const lzma_allocator *allocator,
|
||||
const uint8_t *in, size_t in_size,
|
||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||
{
|
||||
// Validate what isn't validated later in filter_common.c.
|
||||
if ((in == NULL && in_size != 0) || out == NULL
|
||||
|
||||
@@ -123,7 +123,7 @@ static const struct {
|
||||
|
||||
extern LZMA_API(lzma_ret)
|
||||
lzma_filters_copy(const lzma_filter *src, lzma_filter *dest,
|
||||
lzma_allocator *allocator)
|
||||
const lzma_allocator *allocator)
|
||||
{
|
||||
if (src == NULL || dest == NULL)
|
||||
return LZMA_PROG_ERROR;
|
||||
@@ -239,7 +239,7 @@ validate_chain(const lzma_filter *filters, size_t *count)
|
||||
|
||||
|
||||
extern lzma_ret
|
||||
lzma_raw_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
lzma_raw_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||
const lzma_filter *options,
|
||||
lzma_filter_find coder_find, bool is_encoder)
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ typedef const lzma_filter_coder *(*lzma_filter_find)(lzma_vli id);
|
||||
|
||||
|
||||
extern lzma_ret lzma_raw_coder_init(
|
||||
lzma_next_coder *next, lzma_allocator *allocator,
|
||||
lzma_next_coder *next, const lzma_allocator *allocator,
|
||||
const lzma_filter *filters,
|
||||
lzma_filter_find coder_find, bool is_encoder);
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ typedef struct {
|
||||
/// \return - LZMA_OK: Properties decoded successfully.
|
||||
/// - LZMA_OPTIONS_ERROR: Unsupported properties
|
||||
/// - LZMA_MEM_ERROR: Memory allocation failed.
|
||||
lzma_ret (*props_decode)(void **options, lzma_allocator *allocator,
|
||||
lzma_ret (*props_decode)(
|
||||
void **options, const lzma_allocator *allocator,
|
||||
const uint8_t *props, size_t props_size);
|
||||
|
||||
} lzma_filter_decoder;
|
||||
@@ -136,7 +137,7 @@ lzma_filter_decoder_is_supported(lzma_vli id)
|
||||
|
||||
|
||||
extern lzma_ret
|
||||
lzma_raw_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
lzma_raw_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||
const lzma_filter *options)
|
||||
{
|
||||
return lzma_raw_coder_init(next, allocator,
|
||||
@@ -165,7 +166,7 @@ lzma_raw_decoder_memusage(const lzma_filter *filters)
|
||||
|
||||
|
||||
extern LZMA_API(lzma_ret)
|
||||
lzma_properties_decode(lzma_filter *filter, lzma_allocator *allocator,
|
||||
lzma_properties_decode(lzma_filter *filter, const lzma_allocator *allocator,
|
||||
const uint8_t *props, size_t props_size)
|
||||
{
|
||||
// Make it always NULL so that the caller can always safely free() it.
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
extern lzma_ret lzma_raw_decoder_init(
|
||||
lzma_next_coder *next, lzma_allocator *allocator,
|
||||
lzma_next_coder *next, const lzma_allocator *allocator,
|
||||
const lzma_filter *options);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -196,7 +196,7 @@ lzma_filters_update(lzma_stream *strm, const lzma_filter *filters)
|
||||
|
||||
|
||||
extern lzma_ret
|
||||
lzma_raw_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
lzma_raw_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||
const lzma_filter *options)
|
||||
{
|
||||
return lzma_raw_coder_init(next, allocator,
|
||||
|
||||
@@ -21,7 +21,7 @@ extern uint64_t lzma_mt_block_size(const lzma_filter *filters);
|
||||
|
||||
|
||||
extern lzma_ret lzma_raw_encoder_init(
|
||||
lzma_next_coder *next, lzma_allocator *allocator,
|
||||
lzma_next_coder *next, const lzma_allocator *allocator,
|
||||
const lzma_filter *filters);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
extern LZMA_API(lzma_ret)
|
||||
lzma_filter_flags_decode(
|
||||
lzma_filter *filter, lzma_allocator *allocator,
|
||||
lzma_filter *filter, const lzma_allocator *allocator,
|
||||
const uint8_t *in, size_t *in_pos, size_t in_size)
|
||||
{
|
||||
// Set the pointer to NULL so the caller can always safely free it.
|
||||
|
||||
22
src/liblzma/common/hardware_cputhreads.c
Normal file
22
src/liblzma/common/hardware_cputhreads.c
Normal file
@@ -0,0 +1,22 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/// \file hardware_cputhreads.c
|
||||
/// \brief Get the number of CPU threads or cores
|
||||
//
|
||||
// Author: Lasse Collin
|
||||
//
|
||||
// This file has been put into the public domain.
|
||||
// You can do whatever you want with this file.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include "tuklib_cpucores.h"
|
||||
|
||||
|
||||
extern LZMA_API(uint32_t)
|
||||
lzma_cputhreads(void)
|
||||
{
|
||||
return tuklib_cpucores();
|
||||
}
|
||||
@@ -191,8 +191,8 @@ index_tree_init(index_tree *tree)
|
||||
|
||||
/// Helper for index_tree_end()
|
||||
static void
|
||||
index_tree_node_end(index_tree_node *node, lzma_allocator *allocator,
|
||||
void (*free_func)(void *node, lzma_allocator *allocator))
|
||||
index_tree_node_end(index_tree_node *node, const lzma_allocator *allocator,
|
||||
void (*free_func)(void *node, const lzma_allocator *allocator))
|
||||
{
|
||||
// The tree won't ever be very huge, so recursion should be fine.
|
||||
// 20 levels in the tree is likely quite a lot already in practice.
|
||||
@@ -202,22 +202,21 @@ index_tree_node_end(index_tree_node *node, lzma_allocator *allocator,
|
||||
if (node->right != NULL)
|
||||
index_tree_node_end(node->right, allocator, free_func);
|
||||
|
||||
if (free_func != NULL)
|
||||
free_func(node, allocator);
|
||||
|
||||
lzma_free(node, allocator);
|
||||
free_func(node, allocator);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/// Free the meory allocated for a tree. If free_func is not NULL,
|
||||
/// it is called on each node before freeing the node. This is used
|
||||
/// to free the Record groups from each index_stream before freeing
|
||||
/// the index_stream itself.
|
||||
/// Free the memory allocated for a tree. Each node is freed using the
|
||||
/// given free_func which is either &lzma_free or &index_stream_end.
|
||||
/// The latter is used to free the Record groups from each index_stream
|
||||
/// before freeing the index_stream itself.
|
||||
static void
|
||||
index_tree_end(index_tree *tree, lzma_allocator *allocator,
|
||||
void (*free_func)(void *node, lzma_allocator *allocator))
|
||||
index_tree_end(index_tree *tree, const lzma_allocator *allocator,
|
||||
void (*free_func)(void *node, const lzma_allocator *allocator))
|
||||
{
|
||||
assert(free_func != NULL);
|
||||
|
||||
if (tree->root != NULL)
|
||||
index_tree_node_end(tree->root, allocator, free_func);
|
||||
|
||||
@@ -339,8 +338,8 @@ index_tree_locate(const index_tree *tree, lzma_vli target)
|
||||
/// Allocate and initialize a new Stream using the given base offsets.
|
||||
static index_stream *
|
||||
index_stream_init(lzma_vli compressed_base, lzma_vli uncompressed_base,
|
||||
lzma_vli stream_number, lzma_vli block_number_base,
|
||||
lzma_allocator *allocator)
|
||||
uint32_t stream_number, lzma_vli block_number_base,
|
||||
const lzma_allocator *allocator)
|
||||
{
|
||||
index_stream *s = lzma_alloc(sizeof(index_stream), allocator);
|
||||
if (s == NULL)
|
||||
@@ -368,16 +367,17 @@ index_stream_init(lzma_vli compressed_base, lzma_vli uncompressed_base,
|
||||
|
||||
/// Free the memory allocated for a Stream and its Record groups.
|
||||
static void
|
||||
index_stream_end(void *node, lzma_allocator *allocator)
|
||||
index_stream_end(void *node, const lzma_allocator *allocator)
|
||||
{
|
||||
index_stream *s = node;
|
||||
index_tree_end(&s->groups, allocator, NULL);
|
||||
index_tree_end(&s->groups, allocator, &lzma_free);
|
||||
lzma_free(s, allocator);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static lzma_index *
|
||||
index_init_plain(lzma_allocator *allocator)
|
||||
index_init_plain(const lzma_allocator *allocator)
|
||||
{
|
||||
lzma_index *i = lzma_alloc(sizeof(lzma_index), allocator);
|
||||
if (i != NULL) {
|
||||
@@ -395,13 +395,16 @@ index_init_plain(lzma_allocator *allocator)
|
||||
|
||||
|
||||
extern LZMA_API(lzma_index *)
|
||||
lzma_index_init(lzma_allocator *allocator)
|
||||
lzma_index_init(const lzma_allocator *allocator)
|
||||
{
|
||||
lzma_index *i = index_init_plain(allocator);
|
||||
if (i == NULL)
|
||||
return NULL;
|
||||
|
||||
index_stream *s = index_stream_init(0, 0, 1, 0, allocator);
|
||||
if (i == NULL || s == NULL) {
|
||||
index_stream_end(s, allocator);
|
||||
if (s == NULL) {
|
||||
lzma_free(i, allocator);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
index_tree_append(&i->streams, &s->node);
|
||||
@@ -411,7 +414,7 @@ lzma_index_init(lzma_allocator *allocator)
|
||||
|
||||
|
||||
extern LZMA_API(void)
|
||||
lzma_index_end(lzma_index *i, lzma_allocator *allocator)
|
||||
lzma_index_end(lzma_index *i, const lzma_allocator *allocator)
|
||||
{
|
||||
// NOTE: If you modify this function, check also the bottom
|
||||
// of lzma_index_cat().
|
||||
@@ -634,7 +637,7 @@ lzma_index_stream_padding(lzma_index *i, lzma_vli stream_padding)
|
||||
|
||||
|
||||
extern LZMA_API(lzma_ret)
|
||||
lzma_index_append(lzma_index *i, lzma_allocator *allocator,
|
||||
lzma_index_append(lzma_index *i, const lzma_allocator *allocator,
|
||||
lzma_vli unpadded_size, lzma_vli uncompressed_size)
|
||||
{
|
||||
// Validate.
|
||||
@@ -762,7 +765,7 @@ index_cat_helper(const index_cat_info *info, index_stream *this)
|
||||
|
||||
extern LZMA_API(lzma_ret)
|
||||
lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src,
|
||||
lzma_allocator *allocator)
|
||||
const lzma_allocator *allocator)
|
||||
{
|
||||
const lzma_vli dest_file_size = lzma_index_file_size(dest);
|
||||
|
||||
@@ -822,10 +825,13 @@ lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src,
|
||||
s->groups.root = &newg->node;
|
||||
}
|
||||
|
||||
if (s->groups.rightmost == &g->node)
|
||||
s->groups.rightmost = &newg->node;
|
||||
assert(s->groups.rightmost == &g->node);
|
||||
s->groups.rightmost = &newg->node;
|
||||
|
||||
lzma_free(g, allocator);
|
||||
|
||||
// NOTE: newg isn't leaked here because
|
||||
// newg == (void *)&newg->node.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -856,7 +862,7 @@ lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src,
|
||||
|
||||
/// Duplicate an index_stream.
|
||||
static index_stream *
|
||||
index_dup_stream(const index_stream *src, lzma_allocator *allocator)
|
||||
index_dup_stream(const index_stream *src, const lzma_allocator *allocator)
|
||||
{
|
||||
// Catch a somewhat theoretical integer overflow.
|
||||
if (src->record_count > PREALLOC_MAX)
|
||||
@@ -866,11 +872,8 @@ index_dup_stream(const index_stream *src, lzma_allocator *allocator)
|
||||
index_stream *dest = index_stream_init(src->node.compressed_base,
|
||||
src->node.uncompressed_base, src->number,
|
||||
src->block_number_base, allocator);
|
||||
|
||||
// Return immediately if allocation failed or if there are
|
||||
// no groups to duplicate.
|
||||
if (dest == NULL || src->groups.leftmost == NULL)
|
||||
return dest;
|
||||
if (dest == NULL)
|
||||
return NULL;
|
||||
|
||||
// Copy the overall information.
|
||||
dest->record_count = src->record_count;
|
||||
@@ -878,6 +881,10 @@ index_dup_stream(const index_stream *src, lzma_allocator *allocator)
|
||||
dest->stream_flags = src->stream_flags;
|
||||
dest->stream_padding = src->stream_padding;
|
||||
|
||||
// Return if there are no groups to duplicate.
|
||||
if (src->groups.leftmost == NULL)
|
||||
return dest;
|
||||
|
||||
// Allocate memory for the Records. We put all the Records into
|
||||
// a single group. It's simplest and also tends to make
|
||||
// lzma_index_locate() a little bit faster with very big Indexes.
|
||||
@@ -916,7 +923,7 @@ index_dup_stream(const index_stream *src, lzma_allocator *allocator)
|
||||
|
||||
|
||||
extern LZMA_API(lzma_index *)
|
||||
lzma_index_dup(const lzma_index *src, lzma_allocator *allocator)
|
||||
lzma_index_dup(const lzma_index *src, const lzma_allocator *allocator)
|
||||
{
|
||||
// Allocate the base structure (no initial Stream).
|
||||
lzma_index *dest = index_init_plain(allocator);
|
||||
@@ -1005,6 +1012,8 @@ iter_set_info(lzma_index_iter *iter)
|
||||
iter->internal[ITER_GROUP].p = NULL;
|
||||
}
|
||||
|
||||
// NOTE: lzma_index_iter.stream.number is lzma_vli but we use uint32_t
|
||||
// internally.
|
||||
iter->stream.number = stream->number;
|
||||
iter->stream.block_count = stream->record_count;
|
||||
iter->stream.compressed_offset = stream->node.compressed_base;
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "index.h"
|
||||
#include "index_decoder.h"
|
||||
#include "check.h"
|
||||
|
||||
|
||||
struct lzma_coder_s {
|
||||
typedef struct {
|
||||
enum {
|
||||
SEQ_INDICATOR,
|
||||
SEQ_COUNT,
|
||||
@@ -50,17 +50,20 @@ struct lzma_coder_s {
|
||||
|
||||
/// CRC32 of the List of Records field
|
||||
uint32_t crc32;
|
||||
};
|
||||
} lzma_index_coder;
|
||||
|
||||
|
||||
static lzma_ret
|
||||
index_decode(lzma_coder *coder, lzma_allocator *allocator,
|
||||
index_decode(void *coder_ptr, const lzma_allocator *allocator,
|
||||
const uint8_t *restrict in, size_t *restrict in_pos,
|
||||
size_t in_size, uint8_t *restrict out lzma_attribute((unused)),
|
||||
size_t *restrict out_pos lzma_attribute((unused)),
|
||||
size_t out_size lzma_attribute((unused)),
|
||||
lzma_action action lzma_attribute((unused)))
|
||||
size_t in_size,
|
||||
uint8_t *restrict out lzma_attribute((__unused__)),
|
||||
size_t *restrict out_pos lzma_attribute((__unused__)),
|
||||
size_t out_size lzma_attribute((__unused__)),
|
||||
lzma_action action lzma_attribute((__unused__)))
|
||||
{
|
||||
lzma_index_coder *coder = coder_ptr;
|
||||
|
||||
// Similar optimization as in index_encoder.c
|
||||
const size_t in_start = *in_pos;
|
||||
lzma_ret ret = LZMA_OK;
|
||||
@@ -206,8 +209,9 @@ out:
|
||||
|
||||
|
||||
static void
|
||||
index_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||
index_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
|
||||
{
|
||||
lzma_index_coder *coder = coder_ptr;
|
||||
lzma_index_end(coder->index, allocator);
|
||||
lzma_free(coder, allocator);
|
||||
return;
|
||||
@@ -215,9 +219,11 @@ index_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||
|
||||
|
||||
static lzma_ret
|
||||
index_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
|
||||
index_decoder_memconfig(void *coder_ptr, uint64_t *memusage,
|
||||
uint64_t *old_memlimit, uint64_t new_memlimit)
|
||||
{
|
||||
lzma_index_coder *coder = coder_ptr;
|
||||
|
||||
*memusage = lzma_index_memusage(1, coder->count);
|
||||
*old_memlimit = coder->memlimit;
|
||||
|
||||
@@ -233,7 +239,7 @@ index_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
|
||||
|
||||
|
||||
static lzma_ret
|
||||
index_decoder_reset(lzma_coder *coder, lzma_allocator *allocator,
|
||||
index_decoder_reset(lzma_index_coder *coder, const lzma_allocator *allocator,
|
||||
lzma_index **i, uint64_t memlimit)
|
||||
{
|
||||
// Remember the pointer given by the application. We will set it
|
||||
@@ -250,7 +256,7 @@ index_decoder_reset(lzma_coder *coder, lzma_allocator *allocator,
|
||||
|
||||
// Initialize the rest.
|
||||
coder->sequence = SEQ_INDICATOR;
|
||||
coder->memlimit = memlimit;
|
||||
coder->memlimit = my_max(1, memlimit);
|
||||
coder->count = 0; // Needs to be initialized due to _memconfig().
|
||||
coder->pos = 0;
|
||||
coder->crc32 = 0;
|
||||
@@ -259,36 +265,38 @@ index_decoder_reset(lzma_coder *coder, lzma_allocator *allocator,
|
||||
}
|
||||
|
||||
|
||||
static lzma_ret
|
||||
index_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
extern lzma_ret
|
||||
lzma_index_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||
lzma_index **i, uint64_t memlimit)
|
||||
{
|
||||
lzma_next_coder_init(&index_decoder_init, next, allocator);
|
||||
lzma_next_coder_init(&lzma_index_decoder_init, next, allocator);
|
||||
|
||||
if (i == NULL || memlimit == 0)
|
||||
if (i == NULL)
|
||||
return LZMA_PROG_ERROR;
|
||||
|
||||
if (next->coder == NULL) {
|
||||
next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
|
||||
if (next->coder == NULL)
|
||||
lzma_index_coder *coder = next->coder;
|
||||
if (coder == NULL) {
|
||||
coder = lzma_alloc(sizeof(lzma_index_coder), allocator);
|
||||
if (coder == NULL)
|
||||
return LZMA_MEM_ERROR;
|
||||
|
||||
next->coder = coder;
|
||||
next->code = &index_decode;
|
||||
next->end = &index_decoder_end;
|
||||
next->memconfig = &index_decoder_memconfig;
|
||||
next->coder->index = NULL;
|
||||
coder->index = NULL;
|
||||
} else {
|
||||
lzma_index_end(next->coder->index, allocator);
|
||||
lzma_index_end(coder->index, allocator);
|
||||
}
|
||||
|
||||
return index_decoder_reset(next->coder, allocator, i, memlimit);
|
||||
return index_decoder_reset(coder, allocator, i, memlimit);
|
||||
}
|
||||
|
||||
|
||||
extern LZMA_API(lzma_ret)
|
||||
lzma_index_decoder(lzma_stream *strm, lzma_index **i, uint64_t memlimit)
|
||||
{
|
||||
lzma_next_strm_init(index_decoder_init, strm, i, memlimit);
|
||||
lzma_next_strm_init(lzma_index_decoder_init, strm, i, memlimit);
|
||||
|
||||
strm->internal->supported_actions[LZMA_RUN] = true;
|
||||
strm->internal->supported_actions[LZMA_FINISH] = true;
|
||||
@@ -298,8 +306,8 @@ lzma_index_decoder(lzma_stream *strm, lzma_index **i, uint64_t memlimit)
|
||||
|
||||
|
||||
extern LZMA_API(lzma_ret)
|
||||
lzma_index_buffer_decode(
|
||||
lzma_index **i, uint64_t *memlimit, lzma_allocator *allocator,
|
||||
lzma_index_buffer_decode(lzma_index **i, uint64_t *memlimit,
|
||||
const lzma_allocator *allocator,
|
||||
const uint8_t *in, size_t *in_pos, size_t in_size)
|
||||
{
|
||||
// Sanity checks
|
||||
@@ -308,7 +316,7 @@ lzma_index_buffer_decode(
|
||||
return LZMA_PROG_ERROR;
|
||||
|
||||
// Initialize the decoder.
|
||||
lzma_coder coder;
|
||||
lzma_index_coder coder;
|
||||
return_if_error(index_decoder_reset(&coder, allocator, i, *memlimit));
|
||||
|
||||
// Store the input start position so that we can restore it in case
|
||||
|
||||
24
src/liblzma/common/index_decoder.h
Normal file
24
src/liblzma/common/index_decoder.h
Normal file
@@ -0,0 +1,24 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/// \file index_decoder.h
|
||||
/// \brief Decodes the Index field
|
||||
//
|
||||
// Author: Lasse Collin
|
||||
//
|
||||
// This file has been put into the public domain.
|
||||
// You can do whatever you want with this file.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef LZMA_INDEX_DECODER_H
|
||||
#define LZMA_INDEX_DECODER_H
|
||||
|
||||
#include "index.h"
|
||||
|
||||
|
||||
extern lzma_ret lzma_index_decoder_init(lzma_next_coder *next,
|
||||
const lzma_allocator *allocator,
|
||||
lzma_index **i, uint64_t memlimit);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "check.h"
|
||||
|
||||
|
||||
struct lzma_coder_s {
|
||||
typedef struct {
|
||||
enum {
|
||||
SEQ_INDICATOR,
|
||||
SEQ_COUNT,
|
||||
@@ -37,18 +37,21 @@ struct lzma_coder_s {
|
||||
|
||||
/// CRC32 of the List of Records field
|
||||
uint32_t crc32;
|
||||
};
|
||||
} lzma_index_coder;
|
||||
|
||||
|
||||
static lzma_ret
|
||||
index_encode(lzma_coder *coder,
|
||||
lzma_allocator *allocator lzma_attribute((unused)),
|
||||
const uint8_t *restrict in lzma_attribute((unused)),
|
||||
size_t *restrict in_pos lzma_attribute((unused)),
|
||||
size_t in_size lzma_attribute((unused)),
|
||||
index_encode(void *coder_ptr,
|
||||
const lzma_allocator *allocator lzma_attribute((__unused__)),
|
||||
const uint8_t *restrict in lzma_attribute((__unused__)),
|
||||
size_t *restrict in_pos lzma_attribute((__unused__)),
|
||||
size_t in_size lzma_attribute((__unused__)),
|
||||
uint8_t *restrict out, size_t *restrict out_pos,
|
||||
size_t out_size, lzma_action action lzma_attribute((unused)))
|
||||
size_t out_size,
|
||||
lzma_action action lzma_attribute((__unused__)))
|
||||
{
|
||||
lzma_index_coder *coder = coder_ptr;
|
||||
|
||||
// Position where to start calculating CRC32. The idea is that we
|
||||
// need to call lzma_crc32() only once per call to index_encode().
|
||||
const size_t out_start = *out_pos;
|
||||
@@ -158,7 +161,7 @@ out:
|
||||
|
||||
|
||||
static void
|
||||
index_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||
index_encoder_end(void *coder, const lzma_allocator *allocator)
|
||||
{
|
||||
lzma_free(coder, allocator);
|
||||
return;
|
||||
@@ -166,7 +169,7 @@ index_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
|
||||
|
||||
|
||||
static void
|
||||
index_encoder_reset(lzma_coder *coder, const lzma_index *i)
|
||||
index_encoder_reset(lzma_index_coder *coder, const lzma_index *i)
|
||||
{
|
||||
lzma_index_iter_init(&coder->iter, i);
|
||||
|
||||
@@ -180,7 +183,7 @@ index_encoder_reset(lzma_coder *coder, const lzma_index *i)
|
||||
|
||||
|
||||
extern lzma_ret
|
||||
lzma_index_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
lzma_index_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||
const lzma_index *i)
|
||||
{
|
||||
lzma_next_coder_init(&lzma_index_encoder_init, next, allocator);
|
||||
@@ -189,7 +192,7 @@ lzma_index_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||
return LZMA_PROG_ERROR;
|
||||
|
||||
if (next->coder == NULL) {
|
||||
next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
|
||||
next->coder = lzma_alloc(sizeof(lzma_index_coder), allocator);
|
||||
if (next->coder == NULL)
|
||||
return LZMA_MEM_ERROR;
|
||||
|
||||
@@ -229,7 +232,7 @@ lzma_index_buffer_encode(const lzma_index *i,
|
||||
|
||||
// The Index encoder needs just one small data structure so we can
|
||||
// allocate it on stack.
|
||||
lzma_coder coder;
|
||||
lzma_index_coder coder;
|
||||
index_encoder_reset(&coder, i);
|
||||
|
||||
// Do the actual encoding. This should never fail, but store
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user