Commit Graph

1727 Commits

Author SHA1 Message Date
Jia Tan 850adec171 Docs: Omit SIGTSTP not handled from TODO. 2023-02-03 22:52:55 +08:00
Jia Tan 2c78a83c6f liblzma: Fix bug in lzma_str_from_filters() not checking filters[] length.
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-03 00:42:27 +08:00
Jia Tan e01f01b9af Tests: Create test_filter_str.c.
Tests lzma_str_to_filters(), lzma_str_from_filters(), and
lzma_str_list_filters() API functions.
2023-02-03 00:42:27 +08:00
Jia Tan 8dfc029e7a liblzma: Fix typos in comments in string_conversion.c. 2023-02-03 00:42:27 +08:00
Jia Tan 54ad83c1ae liblzma: Clarify block encoder and decoder documentation.
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-03 00:22:53 +08:00
Jia Tan f680e771b3 Update lzma_block documentation for lzma_block_uncomp_encode(). 2023-02-03 00:22:53 +08:00
Jia Tan 504cf4af89 liblzma: Minor edits to lzma_block header_size documentation. 2023-02-03 00:22:53 +08:00
Jia Tan 115b720fb5 liblzma: Enumerate functions that read version in lzma_block. 2023-02-03 00:22:53 +08:00
Jia Tan 85ea0979ad liblzma: Clarify comment in block.h. 2023-02-03 00:22:53 +08:00
Jia Tan 1f7ab90d9c liblzma: Improve documentation for block.h.
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-03 00:22:53 +08:00
Jia Tan c563a4bc55 liblzma: Clarify a comment about LZMA_STR_NO_VALIDATION.
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-01 23:39:45 +08:00
Jia Tan 315c64c7e1 CI: Update .gitignore for artifacts directory in build-aux.
The workflow action for our CI pipeline can only reference artifacts in
the source directory, so we should ignore these files if the ci_build.sh
is run locally.
2023-02-01 21:47:35 +08:00
Jia Tan 2c1341f4fa CI: Add quotes around variables in a few places. 2023-02-01 21:47:35 +08:00
Jia Tan 3a401b0e0c CI: Upload test logs as artifacts if a test fails. 2023-02-01 21:47:35 +08:00
Lasse Collin 610dde15a8 xz: Use clock_gettime() even if CLOCK_MONOTONIC isn't available.
mythread.h and thus liblzma already does it.
2023-01-27 20:02:49 +02:00
Lasse Collin 2e02877288 po4a/po4a.conf: Sort the language identifiers in alphabetical order. 2023-01-27 19:41:19 +02:00
Lasse Collin ff592c616e xz: Add SIGTSTP handler for progress indicator time keeping.
This way, if xz is stopped the elapsed time and estimated time
remaining won't get confused by the amount of time spent in
the stopped state.

This raises SIGSTOP. It's not clear to me if this is the correct way.
POSIX and glibc docs say that SIGTSTP shouldn't stop the process if
it is orphaned but this commit doesn't attempt to handle that.

Search for SIGTSTP in section 2.4.3:

https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html
2023-01-27 19:37:47 +02:00
Jia Tan 3b1c8ac8d1 Translations: Add Brazilian Portuguese translation of man pages.
Thanks to Rafael Fontenelle.
2023-01-27 20:16:54 +08:00
Lasse Collin a15a7552f9 Build: Avoid different quoting style in --enable-doxygen doc. 2023-01-26 17:51:06 +02:00
Lasse Collin af5a4bd5af tuklib_physmem: Check for __has_warning before GCC version.
Clang can be configured to fake a too high GCC version so
this way it's more robust.
2023-01-26 17:39:46 +02:00
Jia Tan f35d98e206 liblzma: Fix documentation in filter.h for lzma_str_to_filters()
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-01-24 20:48:50 +08:00
Lasse Collin 2f78ecc593 Revert "tuklib_common: Define __has_warning if it is not defined."
This reverts commit 82e3c968bf.

Macros in the reserved namespace (_foo or __foo) shouldn't be #defined
without a very good reason. Here the alternative would have been
to #define tuklib_has_warning(str) to an approriate value.

Also the tuklib_* files should stay namespace clean if possible.
2023-01-24 20:20:51 +08:00
Lasse Collin 8366cf8738 tuklib_physmem: Clean up the way -Wcast-function-type is silenced on Windows.
__has_warning and other __has_foo macros are meant to become
compiler-agnostic so it's not good to check for __clang__ with it.

This also relied on tuklib_common.h for #defining __has_warning
which was confusing as #defining reserved macros is generally
not a good idea.
2023-01-24 20:20:40 +08:00
Lasse Collin 683a3c7e2f xz: Flip the return value of suffix_is_set to match the documentation.
Also edit style to match the existing coding style in the project.
2023-01-24 20:20:04 +08:00
Jia Tan cc5aa9ab13 xz: Refactor duplicated check for custom suffix when using --format=raw 2023-01-21 22:10:51 +08:00
Jia Tan 9663141274 liblzma: Set documentation on all reserved fields to private.
This prevents the reserved fields from being part of the generated
Doxygen documentation.
2023-01-21 21:37:48 +08:00
Jia Tan 6327a045f3 Doxygen: Update Doxyfile.in from 1.4.7 to 1.8.17.
A few Doxygen tags were obsolete from 1.4.7. Version 1.8.17 released
in 2019, so this should be compatible with resonable modern distros.
The purpose of Doxygen these days is for docs on the website, so it
doesn't necessarily have to work for everyone. Just when the maintainers
want to update the docs.
2023-01-20 00:51:12 +08:00
Jia Tan bbf71b69eb Doxygen: Make Doxygen only produce liblzma API documentation by default.
Doxygen is now configurable in autotools only with
--enable-doxygen=[api|all]. The default is "api", which will only
generate HTML output for liblzma API functions. The LaTex documentation
output was also disabled.
2023-01-20 00:51:12 +08:00
Jia Tan 6fcf4671b6 liblzma: Highlight liblzma API headers should not be included directly.
This improves the generated Doxygen HTML files to better highlight
how to properly use the liblzma API header files.
2023-01-20 00:51:12 +08:00
Jia Tan b43ff180fb tuklib_physmem: Silence warning from -Wcast-function-type on MinGW-w64.
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-01-19 20:35:09 +08:00
Jia Tan 82e3c968bf tuklib_common: Define __has_warning if it is not defined.
clang supports the __has_warning macro to determine if the version of
clang compiling the code supports a given warning. If we do not define
it for other compilers, it may cause a preprocessor error.
2023-01-19 20:32:40 +08:00
Jia Tan b2ba1a489d CI: Reorder 32-bit build first for Linux autotool builds.
The 32-bit build needs to be first so the configure cache only needs to
be reset one time. The 32-bit build sets the CFLAGS env variable, so any
build using that flag after will fail unless the cache is reset.
2023-01-18 22:11:05 +08:00
Jia Tan dd1c113574 CI: Enable --config-cache in autotool builds.
If CFLAGS are set in a build, the cache must be cleared with
"make distclean", or by deleting the cache file.
2023-01-18 21:51:43 +08:00
Jia Tan d3e1147705 xz: Add missing comment for coder_set_compression_settings() 2023-01-16 21:35:45 +08:00
Jia Tan 123255b6ed xz: Do not set compression settings with raw format in list mode.
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-01-16 20:55:10 +08:00
Jia Tan 571919c47b Translations: Update the Brazilian Portuguese translation. 2023-01-13 22:21:49 +08:00
Jia Tan 81cb02e2c2 CI: Disable shared and nls from various jobs in autotool runners.
Disabling shared library generation and linking should help speed up the
runners. The shared library is still being tested in the 32 bit build
and the full feature.

Disabling nls is to check for any unexpected warnings or errors.
2023-01-12 23:43:06 +08:00
Jia Tan 58a052198a CI: Reorder the 32-bit job in the Ubuntu runner.
Run the 32 bit job sooner since this is a more interesting test than
some of the later jobs.
2023-01-12 23:39:19 +08:00
Jia Tan 4110a998b8 CI: Allow disabling Native Language Support. 2023-01-12 23:09:03 +08:00
Jia Tan 0dec634e70 CI: Only run autogen.sh if it has not already run. 2023-01-12 23:02:20 +08:00
Jia Tan 32287dc8de CI: Allow disabling shared library in autotools builds. 2023-01-12 22:58:36 +08:00
Jia Tan 77d1ebcc99 CI: Improve Usage readability and add -h option. 2023-01-12 22:44:18 +08:00
Lasse Collin a8bb8358d1 Build: Omit -Wmissing-noreturn from the default warnings.
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-01-12 13:04:05 +02:00
Lasse Collin 52dc033d0b xz: Use ssize_t for the to-be-ignored return value from write(fd, ptr, 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-01-12 06:05:58 +02:00
Lasse Collin b1a6d180a3 xz: Silence warnings from -Wsign-conversion in a 32-bit build. 2023-01-12 06:01:12 +02:00
Lasse Collin 31c21c734b liblzma: Silence another warning from -Wsign-conversion in a 32-bit build.
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-01-12 05:38:48 +02:00
Lasse Collin 37fbdfb726 liblzma: Silence a warning from -Wsign-conversion in a 32-bit build. 2023-01-12 04:46:45 +02:00
Lasse Collin 5ce6ddc221 Build: Make configure add more warning flags for GCC and Clang.
-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-01-12 04:17:24 +02:00
Lasse Collin bfc3a0a8ac Tests: Fix warnings from clang --Wassign-enum.
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-01-12 04:14:18 +02:00
Lasse Collin 49245bb31e Tests: Silence warnings from -Wsign-conversion.
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-01-12 03:56:24 +02:00