1
0
mirror of https://git.tukaani.org/xz.git synced 2025-02-17 14:08:12 +00:00

2430 Commits

Author SHA1 Message Date
Lasse Collin
ec5458e1c9 CMake: Support building liblzma API docs using Doxygen
This is disabled by default to match the default in Autotools.
Use -DUSE_DOXYGEN=ON to enable Doxygen usage.

This uses the update-doxygen script, thus this is under if(UNIX)
although Doxygen itself can run on Windows too.

(cherry picked from commit 64503cc2b76a388ced4ec5f68234a07f0dcddcd5)
2024-05-23 00:13:43 +03:00
Lasse Collin
8c93ced56b CMake: List API headers in LIBLZMA_API_HEADERS variable
This way the same list will be usable in more than one location.

(cherry picked from commit 0a7f5a80d8532a1d8cfa0a902c9d1ad7651eca37)
2024-05-23 00:13:43 +03:00
Lasse Collin
f7c9bab037 PACKAGERS: Document the optional Doxygen usage
Also add a note that packagers should check the licensing
of the Doxygen output.

(cherry picked from commit 541406bee3f09e9813103c6406b10fc6ab2e0d30)
2024-05-23 00:13:43 +03:00
Lasse Collin
28e7d130cb Build: Add --enable-doxygen to generate and install API docs
It requires Doxygen. This option is disabled by default.

(cherry picked from commit e21efdf96f39378fe417479f89e97046680406f5)
2024-05-23 00:13:43 +03:00
Lasse Collin
cca7e6c05b Doxygen: update-doxygen: Support out-of-tree builds
Also, now $0 is used to refer to the script itself.

(cherry picked from commit 0ece09a575d7e542bda8825808ddd6cf7de8cc4b)
2024-05-23 00:13:43 +03:00
Lasse Collin
8090d3dc7f Doxygen: Simplify Doxyfile and add SPDX license identifier
This omits all comments and a few non-default options that weren't
needed. Now it contains no copyrighted content from Doxygen itself.

(cherry picked from commit 2c519f641f266fd897edf680827d9c905f411440)
2024-05-22 23:34:43 +03:00
Lasse Collin
0721b8bfe5 Doxygen: Don't strip JavaScript anymore
The stripping method worked well with Doxygen 1.8 and 1.9 but
it doesn't work with Doxygen 1.10 anymore. Since we won't ship
pre-generated liblzma API docs anymore, the extra bloat and
extra license info of the JavaScript files won't affect the
upstream source package anymore.

(cherry picked from commit bdba39a57530d11b88440df8024002be3d09e4a1)
2024-05-22 23:34:43 +03:00
Lasse Collin
1ddb40f6fd Build: Remove old Doxygen rules from top-level Makefile.am
(cherry picked from commit d3a77ebc04bf1db8d52de2d9b0f07877bc4fd139)
2024-05-22 23:34:43 +03:00
Lasse Collin
092af76234 Update COPYING to match the autogen.sh and mydist changes
(cherry picked from commit fd7faa4c338a42a6a40e854b837d285ae2e8c609)
2024-05-22 23:34:43 +03:00
Lasse Collin
77bce9a0a2 Build: Don't run update-doxygen as part of "make mydist"
(cherry picked from commit b2bc55d8a0a9f2f59bfd4302067300e650f6baa3)
2024-05-22 23:34:43 +03:00
Lasse Collin
3a2fc62f59 autogen.sh: Don't generated Doxygen docs anymore
(cherry picked from commit e9be74f5b129fe8a5388d588e68b1b7f5168a310)
2024-05-22 23:34:42 +03:00
Lasse Collin
b04c16f9a5 windows/build.bash: Omit Doxygen docs from the package
They will be omitted from the source tarball and I don't want
to make Doxygen a dependency of build.bash.

(cherry picked from commit 252aa1d67bc015eeba462803ab72edeb7744d864)
2024-05-22 23:34:42 +03:00
Lasse Collin
d4dd3c8f61 README: Don't mention PDF man pages anymore
(cherry picked from commit 634095364d87444d62d8ec54c134c0cd4705f5d7)
2024-05-22 23:34:42 +03:00
Lasse Collin
be90720d6c Build: Omit PDF man pages from the package
pdf-local rule was added to create the PDFs still with "make pdf".
The install rules are missing but that likely doesn't matter at all.

(cherry picked from commit dc684bf76ea23574ee9d88382057381e04e6089a)
2024-05-22 23:34:42 +03:00
Lasse Collin
f724552d0c windows/build.bash: Don't copy PDF man pages to the package
(cherry picked from commit e3531ab4125cbd5c01ebd3200791350960547189)
2024-05-22 23:34:42 +03:00
Lasse Collin
00e774819c Tests: test_index: Fix failures when features are disabled
Fixes: cd88423e76d54eb72aea037364f3ebb21f122503
(cherry picked from commit 710a4573ef2cbd19c66318c3b2d1388e418e26c7)
2024-05-22 23:34:42 +03:00
Lasse Collin
51133ad71e CMake: Keep the build working if the "tests" directory is missing
This moves the tests section as is from CMakeLists.txt into
tests/tests.cmake. CMakeLists.txt now includes tests/tests.cmake
if the latter file exists.

Now it's possible to delete the whole "tests" directory and
building with CMake will still work normally, just without
the tests. This way the tests are readily available for those
who want them, and those who won't run the tests anyway have
a straightforward way to ensure that nothing from the "tests"
directory can affect the build process.

(cherry picked from commit aaff75c3486c4489ce88b0efb36b41cf138af7c3)
2024-05-22 23:34:42 +03:00
Lasse Collin
85b5595b67 Tests: Remove x86 and SPARC BCJ tests
These are very old but the exact test file isn't easy to reproduce
as it was compiled from a short C program (bcj_test.c) long ago.
These tests weren't very good anyway, just a little better than nothing.

(cherry picked from commit a5f2aa5618fe9183706c9c514c3067985f6c338b)
2024-05-22 23:34:42 +03:00
Lasse Collin
d8228d1ea0 Tests: test_index: Edit a misleading test
(cherry picked from commit d879686469c9c4bf2a7c0bb6420ebe4530fc8f07)
2024-05-22 14:32:36 +03:00
Lasse Collin
2358ef8238 Tests: test_index: Use minimal values to test integer overflow
(cherry picked from commit 612005bbdb0dea9dc09e9e2e9cc16a15c1480acd)
2024-05-22 14:32:36 +03:00
Lasse Collin
54f4a4162a Tests: test_index: Test lzma_index_buffer_decode() more
(cherry picked from commit 4ad88b2544c2aaf8de8f38af54587098cbe66c1d)
2024-05-22 14:32:36 +03:00
Lasse Collin
85ab59a6b7 Tests: test_index: Test that *i = NULL is done on LZMA_PROG_ERROR
On LZMA_DATA_ERROR from lzma_index_buffer_decode(), *i = NULL was
already done but this adds a test for that case too.

(cherry picked from commit 575b11b0d291e66c5fce31ce7a72f11436d57c83)
2024-05-22 14:32:36 +03:00
Lasse Collin
fb42599e44 Tests: test_index: Test lzma_index_buffer_encode() with empty output buf
(cherry picked from commit 2c970debdb285823f01f75e875561d893345ac2b)
2024-05-22 14:32:36 +03:00
Lasse Collin
20cac20f63 Tests: test_index: Replace if-statements with tuktest assertions
(cherry picked from commit cd88423e76d54eb72aea037364f3ebb21f122503)
2024-05-22 14:32:36 +03:00
Lasse Collin
91e3ea8735 Tests: test_index: Make it clear that my_alloc() has no integer overflows
liblzma guarantees that the product of the allocation size arguments
will fit in size_t.

Putting the pre-increment in the if-statement was clearly wrong
although in practice it didn't matter here as the function is
called only a couple of times.

(cherry picked from commit 7f865577a6224fbbb5f5ca52574b62ea8ac9bf51)
2024-05-22 14:32:36 +03:00
Lasse Collin
df1659a6c8 Tests: test_index: Verify also iter.block.number_in_stream
(cherry picked from commit 12313a3b6596cdcf012e180597f84d231f8730d3)
2024-05-22 14:32:36 +03:00
Lasse Collin
e083e95dbf Tests: test_index: Check cases that aren't a multiple of 4 bytes
(cherry picked from commit ad2654010d9d641ce1601beeff00630027e6bcd4)
2024-05-22 14:32:36 +03:00
Lasse Collin
b0d3b86ecf Tests: test_index: Edit comments and white space
(cherry picked from commit 2524fcf2b68b662035437cee8edbe80067c0c240)
2024-05-22 14:32:36 +03:00
Lasse Collin
bae288ea6f liblzma: index_decoder: Fix missing initializations on LZMA_PROG_ERROR
If the arguments to lzma_index_decoder() or lzma_index_buffer_decode()
were such that LZMA_PROG_ERROR was returned, the lzma_index **i
argument wasn't touched even though the API docs say that *i = NULL
is done if an error occurs. This obviously won't be done even now
if i == NULL but otherwise it is best to do it due to the wording
in the API docs.

In practice this matters very little: The problem can occur only
if the functions are called with invalid arguments, that is,
the calling application must already have a bug.

(cherry picked from commit 71eed2520e2eecae89bade9dceea16e56cfa2ea0)
2024-05-22 14:32:36 +03:00
Lasse Collin
f10cb93f33 CMake: Bump maximum policy version to 3.29
(cherry picked from commit 0478473953f50716a2bc37b619b1c7dc2682b1ad)
2024-05-22 14:32:36 +03:00
Sam James
59055d70cd ci: add NetBSD
(cherry picked from commit a607e2b40d23f7d998dbaba76692aa30b4c3d9d3)
2024-05-22 14:32:36 +03:00
Sam James
812c1f95f3 ci: add FreeBSD
(cherry picked from commit 72c210336de26fb87a928160d025fa10a638d23b)
2024-05-22 14:32:36 +03:00
Sam James
d2a4f963c2 ci: add OpenBSD
(cherry picked from commit b526ec2dbfb5889845ea60548c4f5b1f97d84ab2)
2024-05-22 14:32:36 +03:00
Sam James
493bc57c33 liblzma: outqueue: add header guard
Reported by github's codeql.

(cherry picked from commit c7ef767c49351743d8d011574abb9e200bf6b24f)
2024-05-22 14:32:36 +03:00
Sam James
cede418d4f liblzma: easy_preset: add header guard
Reported by github's codeql.

(cherry picked from commit 55dcae3056d95cb2ddb8b560c12ba7596bc79f2c)
2024-05-22 14:32:36 +03:00
Lasse Collin
6e76a25df2 tuklib_integer: Rename bswapXX to byteswapXX
The __builtin_bswapXX from GCC and Clang are preferred when
they are available. This can allow compilers to emit the x86 MOVBE
instruction instead of doing a load + byteswap as two instructions
(which would happen if the byteswapping is done in inline asm).

bswap16, bswap32, and bswap64 exist in system headers on *BSDs
and Darwin. #defining bswap16 on NetBSD results in a warning about
macro redefinition. It's safest to avoid this namespace conflict
completely.

No OS supported by tuklib_integer.h uses byteswapXX names and
a web search doesn't immediately find any obvious danger of
namespace conflicts. So let's try these still-pretty-short names
for the macros.

Thanks to Sam James for pointing out the compiler warning on
NetBSD 10.0.

(cherry picked from commit 4ffc60f32397371769b7d6b5e3ed8626292d58df)
2024-05-22 14:32:36 +03:00
Lasse Collin
0ca14871f3 liblzma: API doc cleanups
(cherry picked from commit 08ab0966a75b501aa7c717622223f0c13a113c75)
2024-05-22 14:32:36 +03:00
Lasse Collin
94a462850b Tests: test_filter_str: Add a few assertions
(cherry picked from commit 3ac8a9bb4cccbee88350696dc9c645c48d77c989)
2024-05-22 14:32:36 +03:00
Lasse Collin
72058ca22a Tests: test_filter_str: Move one assertion and add a comment
(cherry picked from commit 26c69be80523b05c84dea86c47c4ddd9a10945d7)
2024-05-22 14:32:36 +03:00
Lasse Collin
c59ebbe1c6 Tests: test_filter_str: Tweak comments and white space
(cherry picked from commit 4f6af853bc99904efb8b6c28a0af7b81a8476c1b)
2024-05-22 14:32:36 +03:00
Lasse Collin
ceda860934 Tests: test_filter_str: Add missing RISC-V case
Fixes: 89ea1a22f4ed3685b053b7260bc5acf6c75d1664
(cherry picked from commit c92663aa1bd576e0615498a4189acf0df12e84b9)
2024-05-22 14:32:36 +03:00
Lasse Collin
2234b7cc47 Tests: test_filter_str: Test *error_pos more thoroughly
(cherry picked from commit b0366df1d7ed26268101f9303a001c91c0806dfc)
2024-05-22 14:32:36 +03:00
Lasse Collin
3ba3ef57f9 liblzma: lzma_str_to_filters: Set *error_pos on all errors
The API docs clearly say that if error_pos isn't NULL then *error
is always set on any error. However, it wasn't touched if str == NULL
or filters == NULL or unsupported flags were specified.

Fixes: cedeeca2ea6ada5b0411b2ae10d7a859e837f203
(cherry picked from commit 70d12dd069bb9bb0d6bb1c8fafc4e6f77780263d)
2024-05-22 14:32:36 +03:00
Lasse Collin
57ad820e15 liblzma: Clean up white space
(cherry picked from commit ed8e552395701fbf046027cebc8be4a6755b263f)
2024-05-22 14:32:36 +03:00
Lasse Collin
ba0b5bfe7c Tests: test_filter_flags: Edit comments and style
(cherry picked from commit 2f06920f20b1ad63b7953dc09569e1d424998849)
2024-05-22 14:32:36 +03:00
Lasse Collin
d2ed675959 Tests: Fix C99/C11 compatibility when features are disabled
The array could become empty and then the initializer would be
simply {} which is allowed only in GNU-C and C23.

(cherry picked from commit b101e1d1dbc81577c0c9aa0cb89cf2e46a15eb82)
2024-05-22 14:32:36 +03:00
Lasse Collin
9a70e93fef DOS: Omit useless defines from config.h
(cherry picked from commit f8f3a220ac8afcb8cb2812917d3b77e00c2eab0d)
2024-05-22 14:32:36 +03:00
Lasse Collin
dc4740f720 Build: Omit useless checks for fcntl.h, limits.h, and sys/time.h
(cherry picked from commit fc1921b04b8840caaa777c2bd5340d41b259da20)
2024-05-22 14:32:36 +03:00
Lasse Collin
6e210d5766 liblzma: Silence a warning from Coverity static analysis
It is logical why it cannot know for sure that the value has
to be at most 4 if it is less than 16.

The x86 filter is based on a very old LZMA SDK version. Newer
ones have quite a different implementation for the same filter.

Thanks to Sam James.

(cherry picked from commit 6aa2a6deeba04808a0fe4461396e7fb70277f3d4)
2024-05-22 14:32:36 +03:00
Lasse Collin
4019b012f2 Update .gitignore
(cherry picked from commit e89d3e83b4496d0b5410870634970c0aa9721d59)
2024-05-22 14:32:36 +03:00