aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-07-31Translations: Update the Korean man page translations.Jia Tan1-626/+629
2023-07-31Translations: Update the Korean translation.Jia Tan1-17/+28
2023-07-31Translations: Update the Polish translation.Jia Tan1-18/+29
2023-07-31Translations: Update the German man page translations.Jia Tan1-626/+629
2023-07-31Translations: Update the German translation.Jia Tan1-18/+29
2023-07-31Translations: Update the Chinese (simplified) translation.Jia Tan1-18/+29
2023-07-31Translations: Update the Swedish translation.Jia Tan1-18/+29
2023-07-31Translations: Update the Ukrainian man page translations.Jia Tan1-625/+628
2023-07-31Translations: Update the Ukrainian translation.Jia Tan1-17/+28
2023-07-31Translations: Update the Spanish translation.Jia Tan1-18/+29
2023-07-31Translations: Update the Romanian translation.Jia Tan1-18/+30
2023-07-31Translations: Update the Romanian man page translations.Jia Tan1-625/+629
2023-07-18xz: Update man page Authors and date.Jia Tan1-2/+3
2023-07-18xz: Slight reword in xz man page for consistency.Jia Tan1-1/+1
Changed will print => prints in xz --robot --version description to match --robot --info-memory description.
2023-07-18liblzma: Improve comment in string_conversion.c.Jia Tan1-2/+2
The comment used "flag" when referring to decoder options. Just referring to them as options is more clear and consistent.
2023-07-18liblzma: Reword lzma_str_list_filters() documentation.Jia Tan1-1/+1
Reword "options required" to "options read". The previous wording may have suggested that the options listed were all required when the filters are used for encoding or decoding. Now it should be more clear that the options listed are the ones relevant for encoding or decoding.
2023-07-18xz: Translate the second "%s: " in message.c since French needs "%s : ".Lasse Collin1-1/+1
This string is used to print a filename when using "xz -v" and stderr isn't a terminal.
2023-07-18xz: Make "%s: %s" translatable because French needs "%s : %s".Lasse Collin4-14/+18
2023-07-18liblzma: Tweak #if condition in memcmplen.h.Lasse Collin1-2/+2
Maybe ICC always #defines _MSC_VER on Windows but now it's very clear which code will get used.
2023-07-18liblzma: Omit unnecessary parenthesis in a preprocessor directive.Lasse Collin1-2/+2
2023-07-18liblzma: Prevent warning for MSYS2 Windows build.Jia Tan1-2/+4
In lzma_memcmplen(), the <intrin.h> header file is only included if _MSC_VER and _M_X64 are both defined but _BitScanForward64() was previously used if _M_X64 was defined. GCC for MSYS2 defines _M_X64 but not _MSC_VER so _BitScanForward64() was used without including <intrin.h>. Now, lzma_memcmplen() will use __builtin_ctzll() for MSYS2 GCC builds as expected.
2023-07-18Docs: Add a new section to INSTALL for Tests.Jia Tan1-17/+64
The new Tests section describes basic information about the tests, how to run them, and important details when cross compiling. We have had a few questions about how to compile the tests without running them, so hopefully this information will help others with the same question in the future. Fixes: https://github.com/tukaani-project/xz/issues/54
2023-07-18Docs: Update README.Jia Tan1-0/+4
This adds an entry to "Other implementations of the .xz format" for XZ for Java.
2023-07-18xz: Fix typo in man page.Jia Tan1-1/+1
The Memory limit information section described three output columns when it actually has six. This was reworded to "multiple" to make it more future proof.
2023-07-18Tests: Improve feature testing for skipping.Jia Tan2-3/+3
Fixed a bug where test_compress_* would all fail if arm64 or armthumb filters were enabled for compression but arm was disabled. Since the grep tests only checked for "define HAVE_ENCODER_ARM", this would match on HAVE_ENCODER_ARM64 or HAVE_ENCODER_ARMTHUMB. Now the config.h feature test requires " 1" at the end to prevent the prefix problem. have_feature() was also updated for this even though there were known current bugs affecting it. This is just in case future features have a similar prefix problem.
2023-07-18Translations: Update the Chinese (traditional) translation.Jia Tan1-282/+377
2023-07-18Translations: Update the Vietnamese translation.Jia Tan1-271/+349
2023-07-18Tests: Fix memory leaks in test_index.Jia Tan1-0/+11
Several tests were missing calls to lzma_index_end() to clean up the lzma_index structs. The memory leaks were discovered by using -fsanitize=address with GCC.
2023-07-18Tests: Fix memory leaks in test_block_header.Jia Tan1-16/+22
test_block_header was not properly freeing the filter options between calls to lzma_block_header_decode(). The memory leaks were discovered by using -fsanitize=address with GCC.
2023-07-18liblzma: Prevent uninitialzed warning in mt stream encoder.Jia Tan1-1/+1
This change only impacts the compiler warning since it was impossible for the wait_abs struct in stream_encode_mt() to be used before it was initialized since mythread_condtime_set() will always be called before mythread_cond_timedwait(). Since the mythread.h code is different between the POSIX and Windows versions, this warning was only present on Windows builds. Thanks to Arthur S for reporting the warning and providing an initial patch.
2023-07-18Update THANKS.Jia Tan1-0/+1
2023-07-18CMake: Protects against double find_packageBenjamin Buch1-7/+9
Boost iostream uses `find_package` in quiet mode and then again uses `find_package` with required. This second call triggers a `add_library cannot create imported target "LibLZMA::LibLZMA" because another target with the same name already exists.` This can simply be fixed by skipping the alias part on secondary `find_package` runs.
2023-07-18Translations: Update the Esperanto translation.Jia Tan1-93/+92
2023-07-18Translations: Update the Croatian translation.Jia Tan1-1/+1
2023-07-18Translations: Update the Chinese (simplified) translation.Jia Tan1-160/+157
2023-07-18Translations: Update German translation of man pages.Jia Tan1-40/+12
2023-07-18Translations: Update the German translation.Jia Tan1-95/+94
2023-07-18Translations: Update the Croatian translation.Jia Tan1-94/+93
2023-07-18Translations: Update Korean translation of man pages.Jia Tan1-2446/+567
2023-07-18Translations: Update the Korean translation.Jia Tan1-161/+158
2023-07-18Translations: Update the Spanish translation.Jia Tan1-161/+158
2023-07-18Translations: Update the Romanian translation.Jia Tan1-97/+98
2023-07-18Translations: Update Romanian translation of man pages.Jia Tan1-9/+10
2023-07-18Translations: Update Ukrainian translation of man pages.Jia Tan1-6/+6
2023-07-18Translations: Update the Ukrainian translation.Jia Tan1-162/+159
2023-07-18Translations: Update the Polish translation.Jia Tan1-161/+155
2023-07-18Translations: Update the Swedish translation.Jia Tan1-161/+158
2023-07-18Translations: Update the Esperanto translation.Jia Tan1-17/+17
2023-07-18liblzma: Adds lzma_nothrow to MicroLZMA API functions.Jia Tan1-2/+3
None of the liblzma functions may throw an exception, so this attribute should be applied to all liblzma API functions.
2023-05-04Translations: Update the Croatian translation.larhzu/v5.4.3Jia Tan1-3/+3
2023-05-04Bump version and soname for 5.4.3.Jia Tan2-2/+2
2023-05-04Add NEWS for 5.4.3.Jia Tan1-0/+10
2023-05-03tuklib_integer.h: Fix a recent copypaste error in Clang detection.Lasse Collin1-2/+2
Wrong line was changed in 7062348bf35c1e4cbfee00ad9fffb4a21aa6eff7. Also, this has >= instead of == since ints larger than 32 bits would work too even if not relevant in practice.
2023-04-25Update THANKS.Jia Tan1-0/+1
2023-04-25Windows: Include <intrin.h> when needed.Jia Tan2-0/+16
Legacy Windows did not need to #include <intrin.h> to use the MSVC intrinsics. Newer versions likely just issue a warning, but the MSVC documentation says to include the header file for the intrinsics we use. GCC and Clang can "pretend" to be MSVC on Windows, so extra checks are needed in tuklib_integer.h to only include <intrin.h> when it will is actually needed.
2023-04-25tuklib_integer: Use __builtin_clz() with Clang.Jia Tan1-3/+3
Clang has support for __builtin_clz(), but previously Clang would fallback to either the MSVC intrinsic or the regular C code. This was discovered due to a bug where a new version of Clang required the <intrin.h> header file in order to use the MSVC intrinsics. Thanks to Anton Kochkov for notifying us about the bug.
2023-04-25liblzma: Update project maintainers in lzma.h.Lasse Collin1-1/+1
AUTHORS was updated earlier, lzma.h was simply forgotten.
2023-04-25liblzma: Cleans up old commented out code.Jia Tan1-11/+0
2023-04-25CMake: Update liblzma-config.cmake generation.Jia Tan1-11/+22
Now that the threading is configurable, the liblzma CMake package only needs the threading library when using POSIX threads.
2023-04-25CMake: Allows setting thread method.Jia Tan1-40/+104
The thread method is now configurable for the CMake build. It matches the Autotools build by allowing ON (pick the best threading method), OFF (no threading), posix, win95, and vista. If both Windows and posix threading are both available, then ON will choose Windows threading. Windows threading will also not use: target_link_libraries(liblzma Threads::Threads) since on systems like MinGW-w64 it would link the posix threads without purpose.
2023-04-25CMake: Only build xzdec if decoders are enabled.Jia Tan1-1/+1
2023-04-25Build: Removes redundant check for LZMA1 filter support.Jia Tan1-4/+1
2023-04-25CMake: Bump maximum policy version to 3.26.Lasse Collin1-1/+1
It adds only one new policy related to FOLDERS which we don't use. This makes it clear that the code is compatible with the policies up to 3.26.
2023-04-25CMake: Conditionally build xz list.* files if decoders are enabled.Jia Tan1-2/+7
2023-04-25CMake: Allow configuring features as cache variables.Jia Tan1-137/+391
This allows users to change the features they build either in CMakeCache.txt or by using a CMake GUI. The sources built for liblzma are affected by this too, so only the necessary files will be compiled.
2023-03-21Build: Add a comment that AC_PROG_CC_C99 is needed for Autoconf 2.69.Lasse Collin1-0/+3
It's obsolete in Autoconf >= 2.70 and just an alias for AC_PROG_CC but Autoconf 2.69 requires AC_PROG_CC_C99 to get a C99 compiler.
2023-03-21Build: configure.ac: Use AS_IF and AS_CASE where required.Lasse Collin1-15/+15
This makes no functional difference in the generated configure (at least with the Autotools versions I have installed) but this change might prevent future bugs like the one that was just fixed in the commit 5a5bd7f871818029d5ccbe189f087f591258c294.
2023-03-21Update THANKS.Lasse Collin1-0/+1
2023-03-21Build: Fix --disable-threads breaking the building of shared libs.Lasse Collin1-8/+8
This is broken in the releases 5.2.6 to 5.4.2. A workaround for these releases is to pass EGREP='grep -E' as an argument to configure in addition to --disable-threads. The problem appeared when m4/ax_pthread.m4 was updated in the commit 6629ed929cc7d45a11e385f357ab58ec15e7e4ad which introduced the use of AC_EGREP_CPP. AC_EGREP_CPP calls AC_REQUIRE([AC_PROG_EGREP]) to set the shell variable EGREP but this was only executed if POSIX threads were enabled. Libtool code also has AC_REQUIRE([AC_PROG_EGREP]) but Autoconf omits it as AC_PROG_EGREP has already been required earlier. Thus, if not using POSIX threads, the shell variable EGREP would be undefined in the Libtool code in configure. ax_pthread.m4 is fine. The bug was in configure.ac which called AX_PTHREAD conditionally in an incorrect way. Using AS_CASE ensures that all AC_REQUIREs get always run. Thanks to Frank Busse for reporting the bug. Fixes: https://github.com/tukaani-project/xz/issues/45
2023-03-19liblzma: Silence -Wsign-conversion in SSE2 code in memcmplen.h.Lasse Collin1-1/+2
Thanks to Christian Hesse for reporting the issue. Fixes: https://github.com/tukaani-project/xz/issues/44
2023-03-18Bump version and soname for 5.4.2.larhzu/v5.4.2Jia Tan2-2/+2
2023-03-18Add NEWS for 5.4.2.Jia Tan1-0/+48
2023-03-18Update the copy of GNU GPLv3 from gnu.org to COPYING.GPLv3.Lasse Collin1-4/+4
2023-03-18Change a few HTTP URLs to HTTPS.Lasse Collin8-19/+19
The xz man page timestamp was intentionally left unchanged.
2023-03-18CMake: Fix typo in a comment.Jia Tan1-1/+1
2023-03-18Windows: build.bash: Copy liblzma API docs to the output package.Lasse Collin1-1/+2
2023-03-17Windows: Add microlzma_*.c to the VS project files.Lasse Collin6-0/+12
These should have been included in 5.3.2alpha already.
2023-03-17CMake: Add microlzma_*.c to the build.Lasse Collin1-0/+2
These should have been included in 5.3.2alpha already.
2023-03-17Build: Update comments about unaligned access to mention 64-bit.Lasse Collin2-6/+5
2023-03-17Tests: Update .gitignore.Lasse Collin1-1/+2
2023-03-17po4a/update-po: Display the script name consistently in error messages.Lasse Collin1-1/+1
2023-03-17Doc: Rename Doxygen HTML doc directory name liblzma => api.Jia Tan5-22/+22
When the docs are installed, calling the directory "liblzma" is confusing since multiple other files in the doc directory are for liblzma. This should also make it more natural for distros when they package the documentation.
2023-03-17liblzma: Remove note from lzma_options_bcj about the ARM64 exception.Jia Tan1-1/+1
This was left in by mistake since an early version of the ARM64 filter used a different struct for its options.
2023-03-17COPYING: Add a note about the included Doxygen-generated HTML.Lasse Collin1-0/+11
2023-03-17Doc: Update PACKAGERS with details about liblzma API docs install.Jia Tan1-6/+16
2023-03-17liblzma: Add set lzma.h as the main page for Doxygen documentation.Jia Tan15-29/+2
The \mainpage command is used in the first block of comments in lzma.h. This changes the previously nearly empty index.html to use the first comment block in lzma.h for its contents. lzma.h is no longer documented separately, but this is for the better since lzma.h only defined a few macros that users do not need to use. The individual API header files all have a disclaimer that they should not be #included directly, so there should be no confusion on the fact that lzma.h should be the only header used by applications. Additionally, the note "See ../lzma.h for information about liblzma as a whole." was removed since lzma.h is now the main page of the generated HTML and does not have its own page anymore. So it would be confusing in the HTML version and was only a "nice to have" when browsing the source files.
2023-03-17Build: Generate doxygen documentation in autogen.sh.Jia Tan1-6/+29
Another command line option (--no-doxygen) was added to disable creating the doxygen documenation in cases where it not wanted or if the doxygen tool is not installed.
2023-03-17Build: Create doxygen/update-doxygen script.Jia Tan2-0/+112
This is a helper script to generate the Doxygen documentation. It can be run in 'liblzma' or 'internal' mode by setting the first argument. It will default to 'liblzma' mode and only generate documentation for the liblzma API header files. The helper script will be run during the custom mydist hook when we create releases. This hook already alters the source directory, so its fine to do it here too. This way, we can include the Doxygen generated files in the distrubtion and when installing. In 'liblzma' mode, the JavaScript is stripped from the .html files and the .js files are removed. This avoids license hassle from jQuery and other libraries that Doxygen 1.9.6 puts into jquery.js in minified form.
2023-03-17Build: Install Doxygen docs and include in distribution if generated.Jia Tan1-0/+18
Added a install-data-local target to install the Doxygen documentation only when it has been generated. In order to correctly remove the docs, a corresponding uninstall-local target was added. If the doxygen docs exist in the source tree, they will also be included in the distribution now too.
2023-03-17Doxygen: Refactor Doxyfile.in to doxygen/Doxyfile.Jia Tan5-1237/+2686
Instead of having Doxyfile.in configured by Autoconf, the Doxyfile can have the tags that need to be configured piped into the doxygen command through stdin with the overrides after Doxyfile's contents. Going forward, the documentation should be generated in two different modes: liblzma or internal. liblzma is useful for most users. It is the documentation for just the liblzma API header files. This is the default. internal is for people who want to understand how xz and liblzma work. It might be useful for people who want to contribute to the project.
2023-03-13Tests: Remove unused macros and functions.Jia Tan1-75/+0
2023-03-13Tests: Refactors existing lzma_index tests.Jia Tan1-544/+1492
Converts the existing lzma_index tests into tuktests and covers every API function from index.h except for lzma_file_info_decoder, which can be tested in the future.
2023-03-11xz: Make Capsicum sandbox more strict with stdin and stdout.Lasse Collin1-0/+8
2023-03-11xz: Don't fail if Capsicum is enabled but kernel doesn't support it.Lasse Collin1-3/+12
(This commit combines related commits from the master branch.) If Capsicum support is missing from the kernel or xz is being run in an emulator that lacks Capsicum suport, the syscalls will fail and set errno to ENOSYS. Previously xz would display and error and exit, making xz unusable. Now it will check for ENOSYS and run without sandbox support. Other tools like ssh behave similarly. Displaying a warning for missing Capsicum support was considered but such extra output would quickly become annoying. It would also break test_scripts.sh in "make check". Also move cap_enter() to be the first step instead of the last one. This matches the example in the cap_rights_limit(2) man page. With the current code it shouldn't make any practical difference though. Thanks to Xin Li for the bug report, suggesting a fix, and testing: https://github.com/tukaani-project/xz/pull/43 Thanks to Jia Tan for most of the original commits.
2023-03-07Build: Adjust CMake version search regex.Jia Tan1-0/+2
Now, the LZMA_VERSION_MAJOR, LZMA_VERSION_MINOR, and LZMA_VERSION_PATCH macros do not need to be on consecutive lines in version.h. They can be separated by more whitespace, comments, or even other content, as long as they appear in the proper order (major, minor, patch).
2023-03-07liblzma: Improve documentation for version.h.Jia Tan1-7/+22
Specified parameter and return values for API functions and documented a few more of the macros.
2023-03-07liblzma: Clarify lzma_lzma_preset() documentation in lzma12.h.Jia Tan1-0/+5
lzma_lzma_preset() does not guarentee that the lzma_options_lzma are usable in an encoder even if it returns false (success). If liblzma is built with default configurations, then the options will always be usable. However if the match finders hc3, hc4, or bt4 are disabled, then the options may not be usable depending on the preset level requested. The documentation was updated to reflect this complexity, since this behavior was unclear before.
2023-03-07CMake: Require that the C compiler supports C99 or a newer standard.Lasse Collin1-0/+8
Thanks to autoantwort for reporting the issue and suggesting a different patch: https://github.com/tukaani-project/xz/pull/42
2023-03-07Tests: Small tweak to test-vli.c.Jia Tan1-0/+2
The static global variables can be disabled if encoders and decoders are not built. If they are not disabled and -Werror is used, it will cause an usused warning as an error.
2023-03-07liblzma: Replace '\n' -> newline in filter.h documentation.Jia Tan1-1/+1
The '\n' renders as a newline when the comments are converted to html by Doxygen.
2023-03-07liblzma: Shorten return description for two functions in filter.h.Jia Tan1-6/+2
Shorten the description for lzma_raw_encoder_memusage() and lzma_raw_decoder_memusage().
2023-03-07liblzma: Reword a few lines in filter.hJia Tan1-5/+5
2023-03-07liblzma: Improve documentation in filter.h.Jia Tan1-83/+143
All functions now explicitly specify parameter and return values. The notes and code annotations were moved before the parameter and return value descriptions for consistency. Also, the description above lzma_filter_encoder_is_supported() about not being able to list available filters was removed since lzma_str_list_filters() will do this.
2023-03-07Update THANKS.Lasse Collin1-0/+1
2023-03-07liblzma: Avoid null pointer + 0 (undefined behavior in C).Lasse Collin10-23/+77
In the C99 and C17 standards, section 6.5.6 paragraph 8 means that adding 0 to a null pointer is undefined behavior. As of writing, "clang -fsanitize=undefined" (Clang 15) diagnoses this. However, I'm not aware of any compiler that would take advantage of this when optimizing (Clang 15 included). It's good to avoid this anyway since compilers might some day infer that pointer arithmetic implies that the pointer is not NULL. That is, the following foo() would then unconditionally return 0, even for foo(NULL, 0): void bar(char *a, char *b); int foo(char *a, size_t n) { bar(a, a + n); return a == NULL; } In contrast to C, C++ explicitly allows null pointer + 0. So if the above is compiled as C++ then there is no undefined behavior in the foo(NULL, 0) call. To me it seems that changing the C standard would be the sane thing to do (just add one sentence) as it would ensure that a huge amount of old code won't break in the future. Based on web searches it seems that a large number of codebases (where null pointer + 0 occurs) are being fixed instead to be future-proof in case compilers will some day optimize based on it (like making the above foo(NULL, 0) return 0) which in the worst case will cause security bugs. Some projects don't plan to change it. For example, gnulib and thus many GNU tools currently require that null pointer + 0 is defined: https://lists.gnu.org/archive/html/bug-gnulib/2021-11/msg00000.html https://www.gnu.org/software/gnulib/manual/html_node/Other-portability-assumptions.html In XZ Utils null pointer + 0 issue should be fixed after this commit. This adds a few if-statements and thus branches to avoid null pointer + 0. These check for size > 0 instead of ptr != NULL because this way bugs where size > 0 && ptr == NULL will likely get caught quickly. None of them are in hot spots so it shouldn't matter for performance. A little less readable version would be replacing ptr + offset with offset != 0 ? ptr + offset : ptr or creating a macro for it: #define my_ptr_add(ptr, offset) \ ((offset) != 0 ? ((ptr) + (offset)) : (ptr)) Checking for offset != 0 instead of ptr != NULL allows GCC >= 8.1, Clang >= 7, and Clang-based ICX to optimize it to the very same code as ptr + offset. That is, it won't create a branch. So for hot code this could be a good solution to avoid null pointer + 0. Unfortunately other compilers like ICC 2021 or MSVC 19.33 (VS2022) will create a branch from my_ptr_add(). Thanks to Marcin Kowalczyk for reporting the problem: https://github.com/tukaani-project/xz/issues/36
2023-03-07liblzma: Adjust container.h for consistency with filter.h.Jia Tan1-11/+9
2023-03-07liblzma: Fix small typos and reword a few things in filter.h.Jia Tan1-7/+6
2023-03-07liblzma: Convert list of flags in lzma_mt to bulleted list.Jia Tan1-3/+6
2023-03-07liblzma: Fix typo in documentation in container.hJia Tan1-1/+1
lzma_microlzma_decoder -> lzma_microlzma_encoder
2023-03-07liblzma: Improve documentation for container.hJia Tan1-53/+93
Standardizing each function to always specify parameters and return values. Also moved the parameters and return values to the end of each function description.
2023-03-07CMake: Add LZIP decoder test to list of tests.Jia Tan1-0/+1
2023-03-07Update THANKS.Lasse Collin1-0/+1
2023-03-07Build: Use only the generic symbol versioning on MicroBlaze.Lasse Collin1-2/+10
On MicroBlaze, GCC 12 is broken in sense that __has_attribute(__symver__) returns true but it still doesn't support the __symver__ attribute even though the platform is ELF and symbol versioning is supported if using the traditional __asm__(".symver ...") method. Avoiding the traditional method is good because it breaks LTO (-flto) builds with GCC. See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766 For now the only extra symbols in liblzma_linux.map are the compatibility symbols with the patch that spread from RHEL/CentOS 7. These require the use of __symver__ attribute or __asm__(".symver ...") in the C code. Compatibility with the patch from CentOS 7 doesn't seem valuable on MicroBlaze so use liblzma_generic.map on MicroBlaze instead. It doesn't require anything special in the C code and thus no LTO issues either. An alternative would be to detect support for __symver__ attribute in configure.ac and CMakeLists.txt and fall back to __asm__(".symver ...") but then LTO would be silently broken on MicroBlaze. It sounds likely that MicroBlaze is a special case so let's treat it as a such because that is simpler. If a similar issue exists on some other platform too then hopefully someone will report it and this can be reconsidered. (This doesn't do the same fix in CMakeLists.txt. Perhaps it should but perhaps CMake build of liblzma doesn't matter much on MicroBlaze. The problem breaks the build so it's easy to notice and can be fixed later.) Thanks to Vincent Fazio for reporting the problem and proposing a patch (in the end that solution wasn't used): https://github.com/tukaani-project/xz/pull/32
2023-03-07liblzma: Very minor API doc tweaks.Lasse Collin4-14/+14
Use "member" to refer to struct members as that's the term used by the C standard. Use lzma_options_delta.dist and such in docs so that in Doxygen's HTML output they will link to the doc of the struct member. Clean up a few trailing white spaces too.
2023-03-07liblzma: Adjust spacing in doc headers in bcj.h.Jia Tan1-7/+7
2023-03-07liblzma: Adjust documentation in bcj.h for consistent style.Jia Tan1-21/+22
2023-03-07liblzma: Rename field => member in documentation.Jia Tan7-95/+95
Also adjusted preset value => preset level.
2023-03-07liblzma: Silence a warning from MSVC.Lasse Collin1-1/+1
It gives C4146 here since unary minus with unsigned integer is still unsigned (which is the intention here). Doing it with substraction makes it clearer and avoids the warning. Thanks to Nathan Moinvaziri for reporting this.
2023-03-07liblzma: Improve documentation for stream_flags.hJia Tan1-30/+46
Standardizing each function to always specify parameters and return values. Also moved the parameters and return values to the end of each function description. A few small things were reworded and long sentences broken up.
2023-02-15liblzma: Improve documentation in lzma12.h.Jia Tan1-9/+23
All functions now explicitly specify parameter and return values.
2023-02-15liblzma: Improve documentation in check.h.Jia Tan1-13/+28
All functions now explicitly specify parameter and return values. Also moved the note about SHA-256 functions not being exported to the top of the file.
2023-02-15liblzma: Improve documentation in index.hJia Tan1-51/+126
All functions now explicitly specify parameter and return values.
2023-02-15liblzma: Reword a comment in index.h.Jia Tan1-2/+2
2023-02-15liblzma: Omit lzma_index_iter's internal field from Doxygen docs.Jia Tan1-1/+8
Add \private above this field and its sub-fields since it is not meant to be modified by users.
2023-02-15liblzma: Fix documentation for LZMA_MEMLIMIT_ERROR.Jia Tan1-1/+1
LZMA_MEMLIMIT_ERROR was missing the "<" character needed to put documentation after a member.
2023-02-15liblzma: Improve documentation for base.h.Jia Tan1-5/+25
Standardizing each function to always specify params and return values. Also fixed a small grammar mistake.
2023-02-15liblzma: Minor improvements to vli.h.Jia Tan1-7/+8
Added [out] annotations to parameters that are pointers and can have their value changed. Also added a clarification to lzma_vli_is_valid.
2023-02-15liblzma: Add comments for macros in delta.h.Jia Tan1-0/+8
Document LZMA_DELTA_DIST_MIN and LZMA_DELTA_DIST_MAX for completeness and to avoid Doxygen warnings.
2023-02-15liblzma: Improve documentation in index_hash.h.Jia Tan1-9/+27
All functions now explicitly specify parameter and return values. Also reworded the description of lzma_index_hash_init() for readability.
2023-02-03liblzma: Fix bug in lzma_str_from_filters() not checking filters[] length.Jia Tan1-0/+7
The bug is only a problem in applications that do not properly terminate the filters[] array with LZMA_VLI_UNKNOWN or have more than LZMA_FILTERS_MAX filters. This bug does not affect xz.
2023-02-03Tests: Create test_filter_str.c.Jia Tan3-0/+596
Tests lzma_str_to_filters(), lzma_str_from_filters(), and lzma_str_list_filters() API functions.
2023-02-03liblzma: Fix typos in comments in string_conversion.c.Jia Tan1-2/+2
2023-02-03liblzma: Clarify block encoder and decoder documentation.Jia Tan1-4/+11
Added a few sentences to the description for lzma_block_encoder() and lzma_block_decoder() to highlight that the Block Header must be coded before calling these functions.
2023-02-03Update lzma_block documentation for lzma_block_uncomp_encode().Jia Tan1-0/+3
2023-02-03liblzma: Minor edits to lzma_block header_size documentation.Jia Tan1-1/+2
2023-02-03liblzma: Enumerate functions that read version in lzma_block.Jia Tan1-2/+11
2023-02-03liblzma: Clarify comment in block.h.Jia Tan1-1/+2
2023-02-03liblzma: Improve documentation for block.h.Jia Tan1-21/+75
Standardizing each function to always specify params and return values. Output pointer parameters are also marked with doxygen style [out] to make it clear. Any note sections were also moved above the parameter and return sections for consistency.
2023-02-03liblzma: Clarify a comment about LZMA_STR_NO_VALIDATION.Jia Tan1-2/+3
The flag description for LZMA_STR_NO_VALIDATION was previously confusing about the treatment for filters than cannot be used with .xz format (lzma1) without using LZMA_STR_ALL_FILTERS. Now, it is clear that LZMA_STR_NO_VALIDATION is not a super set of LZMA_STR_ALL_FILTERS.
2023-02-03Translations: Add Brazilian Portuguese translation of man pages.Jia Tan2-1/+3678
Thanks to Rafael Fontenelle.
2023-02-03liblzma: Fix documentation in filter.h for lzma_str_to_filters()Jia Tan1-1/+1
The previous documentation for lzma_str_to_filters() was technically correct, but misleading. lzma_str_to_filters() returns NULL on success, which is in practice always defined to 0. This is the same value as LZMA_OK, but lzma_str_to_filters() does not return lzma_ret so we should be more clear.
2023-02-03xz: Refactor duplicated check for custom suffix when using --format=rawJia Tan3-18/+24
2023-02-03liblzma: Set documentation on all reserved fields to private.Jia Tan7-0/+173
This prevents the reserved fields from being part of the generated Doxygen documentation.
2023-02-03liblzma: Highlight liblzma API headers should not be included directly.Jia Tan14-28/+42
This improves the generated Doxygen HTML files to better highlight how to properly use the liblzma API header files.
2023-02-03tuklib_physmem: Silence warning from -Wcast-function-type on MinGW-w64.Jia Tan1-0/+18
tuklib_physmem depends on GetProcAddress() for both MSVC and MinGW-w64 to retrieve a function address. The proper way to do this is to cast the return value to the type of function pointer retrieved. Unfortunately, this causes a cast-function-type warning, so the best solution is to simply ignore the warning.
2023-02-03xz: Add missing comment for coder_set_compression_settings()Jia Tan1-1/+2
2023-02-03xz: Do not set compression settings with raw format in list mode.Jia Tan1-1/+2
Calling coder_set_compression_settings() in list mode with verbose mode on caused the filter chain and memory requirements to print. This was unnecessary since the command results in an error and not consistent with other formats like lzma and alone.
2023-02-03Translations: Update the Brazilian Portuguese translation.Jia Tan1-259/+344
2023-02-03Build: Omit -Wmissing-noreturn from the default warnings.Lasse Collin1-1/+0
It's not that important. It can be annoying in builds that disable many features since in those cases the tests programs will correctly trigger this warning with Clang.
2023-02-03xz: Use ssize_t for the to-be-ignored return value from write(fd, ptr, 1).Lasse Collin1-1/+1
It makes no difference here as the return value fits into an int too and it then gets ignored but this looks better.
2023-02-03xz: Silence warnings from -Wsign-conversion in a 32-bit build.Lasse Collin2-3/+3
2023-02-03liblzma: Silence another warning from -Wsign-conversion in a 32-bit build.Lasse Collin1-3/+4
It doesn't warn on a 64-bit system because truncating a ptrdiff_t (signed long) to uint32_t is diagnosed under -Wconversion by GCC and -Wshorten-64-to-32 by Clang.
2023-02-03liblzma: Silence a warning from -Wsign-conversion in a 32-bit build.Lasse Collin1-2/+2
2023-02-03Build: Make configure add more warning flags for GCC and Clang.Lasse Collin1-5/+31
-Wstrict-aliasing was removed from the list since it is enabled by -Wall already. A normal build is clean with these on GNU/Linux x86-64 with GCC 12.2.0 and Clang 14.0.6.
2023-02-03Tests: Fix warnings from clang --Wassign-enum.Lasse Collin4-8/+17
Explicitly casting the integer to lzma_check silences the warning. Since such an invalid value is needed in multiple tests, a constant INVALID_LZMA_CHECK_ID was added to tests.h. The use of 0x1000 for lzma_block.check wasn't optimal as if the underlying type is a char then 0x1000 will be truncated to 0. However, in these test cases the value is ignored, thus even with such truncation the test would have passed.
2023-02-03Tests: Silence warnings from -Wsign-conversion.Lasse Collin2-8/+8
Note that assigning an unsigned int to lzma_check doesn't warn on GNU/Linux x86-64 since the enum type is unsigned on that platform. The enum can be signed on some other platform though so it's best to use enumeration type lzma_check in these situations.
2023-02-03liblzma: Silence warnings from clang -Wconditional-uninitialized.Lasse Collin2-4/+6
This is similar to 2ce4f36f179a81d0c6e182a409f363df759d1ad0. The actual initialization of the variables is done inside mythread_sync() macro. Clang doesn't seem to see that the initialization code inside the macro is always executed.
2023-02-03Fix warnings from clang -Wdocumentation.Lasse Collin3-8/+4
2023-02-03Tests: test_lzip_decoder: Remove trailing white-space.Lasse Collin1-2/+2
2023-02-03Tests: test_lzip_decoder: Silence warnings from -Wsign-conversion.Lasse Collin1-6/+7
2023-01-11Bump version and soname for 5.4.1.larhzu/v5.4.1Lasse Collin2-2/+2
2023-01-11Add NEWS for 5.4.1.Jia Tan1-0/+70
2023-01-11sysdefs.h: Don't include strings.h anymore.Lasse Collin1-6/+0
On some platforms src/xz/suffix.c may need <strings.h> for strcasecmp() but suffix.c includes the header when it needs it. Unless there is an old system that otherwise supports enough C99 to build XZ Utils but doesn't have C89/C90-compatible <string.h>, there should be no need to include <strings.h> in sysdefs.h.
2023-01-11xz: Include <strings.h> in suffix.c if needed for strcasecmp().Lasse Collin1-0/+3
SUSv2 and POSIX.1‐2017 declare only a few functions in <strings.h>. Of these, strcasecmp() is used on some platforms in suffix.c. Nothing else in the project needs <strings.h> (at least if building on a modern system). sysdefs.h currently includes <strings.h> if HAVE_STRINGS_H is defined and suffix.c relied on this. Note that dos/config.h doesn't #define HAVE_STRINGS_H even though DJGPP does have strings.h. It isn't needed with DJGPP as strcasecmp() is also in <string.h> in DJGPP.
2023-01-11xz: Fix warning -Wformat-nonliteral on clang in message.c.Jia Tan1-0/+9
clang and gcc differ in how they handle -Wformat-nonliteral. gcc will allow a non-literal format string as long as the function takes its format arguments as a va_list.
2023-01-11Tests: Fix test_filter_flags copy/paste error.Jia Tan1-2/+2
2023-01-11Tests: Fix type-limits warning in test_filter_flags.Jia Tan1-3/+10
This only occurs in test_filter_flags when the BCJ filters are not configured and built. In this case, ARRAY_SIZE() returns 0 and causes a type-limits warning with the loop variable since an unsigned number will always be >= 0.
2023-01-11liblzma: CLMUL CRC64: Work around a bug in MSVC, second attempt.Lasse Collin1-0/+18
This affects only 32-bit x86 builds. x86-64 is OK as is. I still cannot easily test this myself. The reporter has tested this and it passes the tests included in the CMake build and performance is good: raw CRC64 is 2-3 times faster than the C version of the slice-by-four method. (Note that liblzma doesn't include a MSVC-compatible version of the 32-bit x86 assembly code for the slice-by-four method.) Thanks to Iouri Kharon for figuring out a fix, testing, and benchmarking.
2023-01-11Tests: Fix unused function warning in test_block_header.Jia Tan1-0/+4
One of the global arrays of filters was only used in a test that required both encoders and decoders to be configured in the build.
2023-01-11Tests: Fix unused function warning in test_index_hash.Jia Tan1-3/+1
test_index_hash does not use fill_index_hash() unless both encoders and decoders are configured in the build.
2023-01-11Windows: Update INSTALL-MSVC.txt to recommend CMake over project files.Lasse Collin1-7/+12
2023-01-10Revert "liblzma: CLMUL CRC64: Workaround a bug in MSVC (VS2015-2022)."Lasse Collin1-6/+0
This reverts commit 36edc65ab4cf10a131f239acbd423b4510ba52d5. It was reported that it wasn't a good enough fix and MSVC still produced (different kind of) bad code when building for 32-bit x86 if optimizations are enabled. Thanks to Iouri Kharon.
2023-01-10sysdefs.h: Fix a comment.Lasse Collin1-1/+1
2023-01-10sysdefs.h: Don't include memory.h anymore even if it were available.Lasse Collin1-6/+2
It quite probably was never needed, that is, any system where memory.h was required likely couldn't compile XZ Utils for other reasons anyway. XZ Utils 5.2.6 and later source packages were generated using Autoconf 2.71 which no longer defines HAVE_MEMORY_H. So the code being removed is no longer used anyway.
2023-01-10CMake/Windows: Add a workaround for windres from GNU binutils.Lasse Collin1-1/+31
This is combined from the following commits in the master branch: 443dfebced041adc88f10d824188eeef5b5821a9 6b117d3b1fe91eb26d533ab16a2e552f84148d47 5e34774c31d1b7509b5cb77a3be9973adec59ea0 Thanks to Iouri Kharon for the bug report, the original patch, and testing.
2023-01-09Tests: test_filter_flags: Clean up minor issues.Lasse Collin1-75/+78
Here are the list of the most significant issues addressed: - Avoid using internal common.h header. It's not good to copy the constants like this but common.h cannot be included for use outside of liblzma. This is the quickest thing to do that could be fixed later. - Omit the INIT_FILTER macro. Initialization should be done with just regular designated initializers. - Use start_offset = 257 for BCJ tests. It demonstrates that Filter Flags encoder and decoder don't validate the options thoroughly. 257 is valid only for the x86 filter. This is a bit silly but not a significant problem in practice because the encoder and decoder initialization functions will catch bad alignment still. Perhaps this should be fixed but it's not urgent and doesn't need to be in 5.4.x. - Various tweaks to comments such as filter id -> Filter ID
2023-01-09Tests: Refactors existing filter flags tests.Jia Tan1-198/+457
Converts the existing filter flags tests into tuktests.
2023-01-09Tests: tuktest.h: Support tuktest_malloc(0).Lasse Collin1-2/+2
It's not needed in XZ Utils at least for now. It's good to support it still because if such use is needed later, it wouldn't be caught on GNU/Linux since malloc(0) from glibc returns non-NULL.
2023-01-09CMake: Update cmake_minimum_required from 3.13...3.16 to 3.13...3.25.Lasse Collin1-1/+1
The changes listed on cmake-policies(7) for versions 3.17 to 3.25 shouldn't affect this project.
2023-01-09Update THANKS.Lasse Collin1-0/+1
2023-01-09Update THANKS.Lasse Collin1-0/+1
2023-01-09CMake: Fix a copypaste error in xzdec Windows resource file handling.Lasse Collin1-2/+2
It was my mistake. Thanks to Iouri Kharon for the bug report.
2023-01-09CMake/Windows: Add resource files to xz.exe and xzdec.exe.Lasse Collin1-0/+16
The command line tools cannot be built with MSVC for now but they can be built with MinGW-w64. Thanks to Iouri Kharon for the bug report and the original patch.
2023-01-09liblzma: CLMUL CRC64: Workaround a bug in MSVC (VS2015-2022).Lasse Collin1-0/+6
I haven't tested with MSVC myself and there doesn't seem to be information about the problem online, so I'm relying on the bug report. Thanks to Iouri Kharon for the bug report and the patch.
2023-01-09Build: Require that _mm_set_epi64x() is usable to enable CLMUL support.Lasse Collin2-3/+8
VS2013 doesn't have _mm_set_epi64x() so this way CLMUL gets disabled with VS2013. Thanks to Iouri Kharon for the bug report.
2023-01-09Tests: Creates test_index_hash.cJia Tan4-0/+394
Tests all API functions exported from index_hash.h. Does not have a dedicated test for lzma_index_hash_end. [Minor edits were made by Lasse Collin.]
2023-01-09liblzma: Remove common.h include from common/index.h.Jia Tan4-2/+10
common/index.h is needed by liblzma internally and tests. common.h will include and define many things that are not needed by the tests. Also, this prevents include order problems because both common.h and lzma.h define LZMA_API. On most platforms it results only in a warning but on Windows it would break the build as the definition in common.h must be used only for building liblzma itself.
2023-01-09liblzma: Add NULL check to lzma_index_hash_append.Jia Tan1-1/+1
This is for consistency with lzma_index_append.
2023-01-09liblzma: Replaced hardcoded 0x0 index indicator byte with macroJia Tan6-5/+9
2023-01-09Style: Change #if !defined() to #ifndef in mythread.h.Jia Tan1-1/+1
2023-01-09Build: Add missing stream_decoder_mt.c to .vcxproj files.Jia Tan6-0/+6
The line in the .vcxproj files for building with was missing in 5.4.0. Thank to Hajin Jang for reporting the issue.
2023-01-04Update THANKS.Lasse Collin1-0/+1
2023-01-04Tests: Adjust style in test_compress.sh.Lasse Collin1-5/+7
2023-01-05Tests: Replace non portable shell parameter expansionJia Tan4-10/+16
The shell parameter expansion using # and ## is not supported in Solaris 10 Bourne shell (/bin/sh). Even though this is POSIX, it is not fully portable, so we should avoid it.
2023-01-05Translations: Add Korean translation of man pages.Jia Tan2-1/+5553
Thanks to Seong-ho Cho
2023-01-05Translations: Update the Esperanto translation.Jia Tan1-288/+332
2023-01-05Build: Fix config.h comments.Lasse Collin2-2/+2
2023-01-05Build: Only define HAVE_PROGRAM_INVOCATION_NAME if it is set to 1.Jia Tan4-6/+8
HAVE_DECL_PROGRAM_INVOCATION_NAME is renamed to HAVE_PROGRAM_INVOCATION_NAME. Previously, HAVE_DECL_PROGRAM_INVOCATION_NAME was always set when building with autotools. CMake would only set this when it was 1, and the dos/config.h did not define it. The new macro definition is consistent across build systems.
2023-01-05Tests: test_check: Test corner cases of CLMUL CRC64.Lasse Collin1-0/+27
2023-01-05Tests: Clarify a comment in test_lzip_decoder.c.Lasse Collin1-2/+6