summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* liblzma: Add set lzma.h as the main page for Doxygen documentation.Jia Tan2023-03-1715-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.
* Build: Generate doxygen documentation in autogen.sh.Jia Tan2023-03-171-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.
* Build: Create doxygen/update-doxygen script.Jia Tan2023-03-172-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.
* Build: Install Doxygen docs and include in distribution if generated.Jia Tan2023-03-171-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.
* Doxygen: Refactor Doxyfile.in to doxygen/Doxyfile.Lasse Collin2023-03-174-309/+456
| | | | | | | | | | | | | | | 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.
* Tests: Remove unused macros and functions.Jia Tan2023-03-131-75/+0
|
* liblzma: Defines masks for return values from lzma_index_checks().Jia Tan2023-03-132-11/+34
|
* Tests: Refactors existing lzma_index tests.Jia Tan2023-03-131-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.
* xz: Simplify the error-label in Capsicum sandbox code.Lasse Collin2023-03-111-15/+12
| | | | | | Also remove unneeded "sandbox_allowed = false;" as this code will never be run more than once (making it work with multiple input files isn't trivial).
* xz: Make Capsicum sandbox more strict with stdin and stdout.Lasse Collin2023-03-081-0/+8
|
* Revert: "Add warning if Capsicum sandbox system calls are unsupported."Jia Tan2023-03-081-6/+4
| | | | | | The warning causes the exit status to be 2, so this will cause problems for many scripted use cases for xz. The sandbox usage is already very limited already, so silently disabling this allows it to be more usable.
* xz: Fix -Wunused-label in io_sandbox_enter().Jia Tan2023-03-071-2/+2
| | | | Thanks to Xin Li for recommending the fix.
* xz: Add warning if Capsicum sandbox system calls are unsupported.Jia Tan2023-03-061-0/+2
| | | | | The warning is only used when errno == ENOSYS. Otherwise, xz still issues a fatal error.
* xz: Skip Capsicum sandbox system calls when they are unsupported.Jia Tan2023-03-061-5/+17
| | | | | | If a system has the Capsicum header files but does not actually implement the system calls, then this would render xz unusable. Instead, we can check if errno == ENOSYS and not issue a fatal error.
* xz: Reorder cap_enter() to beginning of capsicum sandbox code.Jia Tan2023-03-061-3/+3
| | | | | | cap_enter() puts the process into the sandbox. If later calls to cap_rights_limit() fail, then the process can still have some extra protections.
* liblzma: Clarify lzma_lzma_preset() documentation in lzma12.h.Jia Tan2023-03-011-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.
* CMake: Require that the C compiler supports C99 or a newer standard.Lasse Collin2023-02-271-0/+8
| | | | | | Thanks to autoantwort for reporting the issue and suggesting a different patch: https://github.com/tukaani-project/xz/pull/42
* Tests: Small tweak to test-vli.c.Jia Tan2023-02-241-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.
* liblzma: Replace '\n' -> newline in filter.h documentation.Jia Tan2023-02-241-1/+1
| | | | | The '\n' renders as a newline when the comments are converted to html by Doxygen.
* liblzma: Shorten return description for two functions in filter.h.Jia Tan2023-02-241-6/+2
| | | | | Shorten the description for lzma_raw_encoder_memusage() and lzma_raw_decoder_memusage().
* liblzma: Reword a few lines in filter.hJia Tan2023-02-241-5/+5
|
* liblzma: Improve documentation in filter.h.Jia Tan2023-02-241-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.
* Update THANKS.Lasse Collin2023-02-231-0/+1
|
* liblzma: Avoid null pointer + 0 (undefined behavior in C).Lasse Collin2023-02-2310-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
* liblzma: Adjust container.h for consistency with filter.h.Jia Tan2023-02-231-11/+9
|
* liblzma: Fix small typos and reword a few things in filter.h.Jia Tan2023-02-231-7/+6
|
* liblzma: Convert list of flags in lzma_mt to bulleted list.Jia Tan2023-02-231-3/+6
|
* liblzma: Fix typo in documentation in container.hJia Tan2023-02-231-1/+1
| | | | lzma_microlzma_decoder -> lzma_microlzma_encoder
* liblzma: Improve documentation for container.hJia Tan2023-02-231-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.
* CMake: Add LZIP decoder test to list of tests.Jia Tan2023-02-221-0/+1
|
* Update THANKS.Lasse Collin2023-02-171-0/+1
|
* Build: Use only the generic symbol versioning on MicroBlaze.Lasse Collin2023-02-171-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
* liblzma: Very minor API doc tweaks.Lasse Collin2023-02-164-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.
* liblzma: Adjust spacing in doc headers in bcj.h.Jia Tan2023-02-171-7/+7
|
* liblzma: Adjust documentation in bcj.h for consistent style.Jia Tan2023-02-171-21/+22
|
* liblzma: Rename field => member in documentation.Jia Tan2023-02-177-95/+95
| | | | Also adjusted preset value => preset level.
* liblzma: Silence a warning from MSVC.Lasse Collin2023-02-161-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.
* liblzma: Improve documentation for stream_flags.hJia Tan2023-02-161-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.
* liblzma: Improve documentation in lzma12.h.Jia Tan2023-02-151-9/+23
| | | | All functions now explicitly specify parameter and return values.
* liblzma: Improve documentation in check.h.Jia Tan2023-02-151-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.
* liblzma: Improve documentation in index.hJia Tan2023-02-151-51/+126
| | | | All functions now explicitly specify parameter and return values.
* liblzma: Reword a comment in index.h.Jia Tan2023-02-151-2/+2
|
* liblzma: Omit lzma_index_iter's internal field from Doxygen docs.Jia Tan2023-02-151-1/+8
| | | | | Add \private above this field and its sub-fields since it is not meant to be modified by users.
* liblzma: Fix documentation for LZMA_MEMLIMIT_ERROR.Jia Tan2023-02-141-1/+1
| | | | | LZMA_MEMLIMIT_ERROR was missing the "<" character needed to put documentation after a member.
* liblzma: Improve documentation for base.h.Jia Tan2023-02-141-5/+25
| | | | | Standardizing each function to always specify params and return values. Also fixed a small grammar mistake.
* liblzma: Add one more missing [out] annotation in vli.hJia Tan2023-02-141-1/+1
|
* liblzma: Minor improvements to vli.h.Jia Tan2023-02-141-6/+7
| | | | | Added [out] annotations to parameters that are pointers and can have their value changed. Also added a clarification to lzma_vli_is_valid.
* liblzma: Add comments for macros in delta.h.Jia Tan2023-02-101-0/+8
| | | | | Document LZMA_DELTA_DIST_MIN and LZMA_DELTA_DIST_MAX for completeness and to avoid Doxygen warnings.
* liblzma: Improve documentation in index_hash.h.Jia Tan2023-02-101-9/+27
| | | | | All functions now explicitly specify parameter and return values. Also reworded the description of lzma_index_hash_init() for readability.
* xz: Improve the comment about start_time in mytime.c.Lasse Collin2023-02-071-5/+10
| | | | | | start_time is relative to an arbitary point in time, it's not time of day, so using it for anything else than time differences wouldn't make sense.