aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-01-16xz: 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-01-13Translations: Update the Brazilian Portuguese translation.Jia Tan1-259/+344
2023-01-12CI: Disable shared and nls from various jobs in autotool runners.Jia Tan1-28/+28
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-12CI: Reorder the 32-bit job in the Ubuntu runner.Jia Tan1-5/+5
Run the 32 bit job sooner since this is a more interesting test than some of the later jobs.
2023-01-12CI: Allow disabling Native Language Support.Jia Tan1-1/+8
2023-01-12CI: Only run autogen.sh if it has not already run.Jia Tan1-3/+8
2023-01-12CI: Allow disabling shared library in autotools builds.Jia Tan1-1/+8
2023-01-12CI: Improve Usage readability and add -h option.Jia Tan1-2/+13
2023-01-12Build: 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-01-12xz: 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-01-12xz: Silence warnings from -Wsign-conversion in a 32-bit build.Lasse Collin2-3/+3
2023-01-12liblzma: 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-01-12liblzma: Silence a warning from -Wsign-conversion in a 32-bit build.Lasse Collin1-2/+2
2023-01-12Build: 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-01-12Tests: 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-01-12Tests: 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-01-12liblzma: 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-01-12Fix warnings from clang -Wdocumentation.Lasse Collin3-8/+4
2023-01-12Tests: test_lzip_decoder: Remove trailing white-space.Lasse Collin1-2/+2
2023-01-12Tests: test_lzip_decoder: Silence warnings from -Wsign-conversion.Lasse Collin1-6/+7
2023-01-11Add NEWS for 5.4.1.Jia Tan1-0/+70
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-10liblzma: 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-11CI/CD: Add 32-bit build and test steps to Ubuntu autotools runner.Jia Tan1-1/+6
If all goes well, Mac autotools and Linux and Mac CMake will be added later for 32-bit builds.
2023-01-11CI/CD: Enables warnings as errors in autotool build.Jia Tan1-1/+1
This will help us catch warnings and potential bugs in builds that are not often tested by us.
2023-01-11CI/CD: Add -f argument to set CFLAGS in ci_build.sh.Jia Tan1-2/+6
For now, the suggested option is for -m32 only, but this can be updated later if other flags are deemed useful.
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: 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-10xz: 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-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: Fix appending to CMAKE_RC_FLAGS.Lasse Collin1-1/+1
It's a string, not a list. It only worked when the variable was empty. Thanks to Iouri Kharon.
2023-01-10Windows: Update INSTALL-MSVC.txt to recommend CMake over project files.Lasse Collin1-7/+12
2023-01-09CMake: Fix windres issues again.Lasse Collin1-12/+23
At least on some systems, GNU windres needs --use-temp-file in addition to the \x20 hack to avoid spaces in the command line argument. Hovever, that \x20 syntax is broken with llvm-windres version 15.0.0 (results in "XZx20Utils") but luckily it works with a regular space. Thus it is best to limit the workarounds to GNU toolchain on Windows.
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-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-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-08Tests: 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-08Update THANKS.Lasse Collin1-0/+1
2023-01-08CMake: 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-08Update THANKS.Lasse Collin1-0/+1
2023-01-08CMake/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-08CMake/Windows: Add a workaround for windres from GNU binutils.Lasse Collin1-1/+20
Thanks to Iouri Kharon for the bug report and the original patch.
2023-01-08Build: 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-07CI/CD: Split CMake Linux and MacOS build phase to build and test.Jia Tan1-2/+6
The phase split was only done for Autotools before, so should also apply to CMake.
2023-01-07CI/CD: Reduce job runners to 4 instead of using matrix strategy.Jia Tan1-12/+83
The old version used too many runners that resulted in unnecessary dependency downloads. Now, the runners are reused for the different configurations for each OS and build system.
2023-01-07CI/CD: Add new -p (PHASE) argument to ci_build.shJia Tan1-64/+76
The new PHASE argument can be build, test, or all. all is the default. This way, the CI/CD script can differentiate between the build and test phases to make it easier to track down errors when they happen.
2023-01-07Merge pull request #7 from tukaani-project/tuktest_index_hashJia Tan13-8/+414
Tuktest index hash
2023-01-06Tests: test_index_hash: Add an assert_uint_eq().Lasse Collin1-0/+3
2023-01-06Tests: test_index_hash: Fix a memory leak.Lasse Collin1-0/+2
2023-01-06Tests: test_index_hash: Don't treat pointers as booleans.Lasse Collin1-3/+3
2023-01-06Tests: test_index_hash: Fix a typo in a comment.Lasse Collin1-1/+1
2023-01-06Tests: test_index_hash: Avoid the variable name "index".Lasse Collin1-8/+8
It can trigger warnings from -Wshadow on some systems.
2023-01-06Tests: test_index_hash: Use the word "Record" instead of "entry".Lasse Collin1-51/+51
2023-01-06Tests: test_index_hash: Tweak comments and style.Lasse Collin1-29/+33
The words defined in the .xz file format specification begin with capital letter to emphasize that they have a specific meaning.
2023-01-06Tests: test_index_hash: Use INDEX_INDICATOR constant instead of 0.Lasse Collin1-1/+1
2023-01-06Style: Change #if !defined() to #ifndef in mythread.h.Jia Tan1-1/+1
2023-01-06Build: 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-05liblzma: 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 common.h will redefine LZMA_API resulting in a warning.
2023-01-04Update THANKS.Lasse Collin1-0/+1
2023-01-04Tests: Adjust style in test_compress.sh.Lasse Collin1-5/+7
2023-01-04Tests: 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-03Translations: Add Korean translation of man pages.Jia Tan2-1/+5553
Thanks to Seong-ho Cho
2023-01-03Translations: Update the Esperanto translation.Jia Tan1-288/+332
2023-01-02Bump version and soname for 5.5.0alpha.larhzu/v5.5.0alphaLasse Collin2-3/+3
5.5.0alpha won't be released, it's just to mark that the branch is not for stable 5.4.x. Once again there is no API/ABI stability for new features in devel versions. The major soname won't be bumped even if API/ABI of new features breaks between devel releases.
2023-01-02Build: Fix config.h comments.Lasse Collin2-2/+2
2023-01-02Build: 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-02Adds test_index_hash to .gitignore.Jia Tan1-0/+1
2023-01-02Tests: Creates test_index_hash.cJia Tan3-0/+384
Tests all API functions exported from index_hash.h. Does not have a dedicated test for lzma_index_hash_end.
2023-01-02liblzma: Add NULL check to lzma_index_hash_append.Jia Tan1-1/+1
This is for consistency with lzma_index_append.
2023-01-02liblzma: Replaced hardcoded 0x0 index indicator byte with macroJia Tan6-5/+9
2022-12-30Tests: test_check: Test corner cases of CLMUL CRC64.Lasse Collin1-0/+27
2022-12-30Tests: Clarify a comment in test_lzip_decoder.c.Lasse Collin1-2/+6
2022-12-30xz: Includes <time.h> and <sys/time.h> conditionally in mytime.c.Jia Tan1-1/+3
Previously, mytime.c depended on mythread.h for <time.h> to be included.
2022-12-30liblzma: Includes sys/time.h conditionally in mythreadJia Tan1-1/+7
Previously, <sys/time.h> was always included, even if mythread only used clock_gettime. <time.h> is still needed even if clock_gettime is not used though because struct timespec is needed for mythread_condtime.
2022-12-30Build: No longer require HAVE_DECL_CLOCK_MONOTONIC to always be set.Jia Tan4-11/+11
Previously, if threading was enabled HAVE_DECL_CLOCK_MONOTONIC would always be set to 0 or 1. However, this macro was needed in xz so if xz was not built with threading and HAVE_DECL_CLOCK_MONOTONIC was not defined but HAVE_CLOCK_GETTIME was, it caused a warning during build. Now, HAVE_DECL_CLOCK_MONOTONIC has been renamed to HAVE_CLOCK_MONOTONIC and will only be set if it is 1.
2022-12-30Translations: Add Ukrainian translations of man pages.Jia Tan2-1/+3677
Thanks to Yuri Chornoivan
2022-12-30CI/CD: Create initial version of CI/CD workflow.Jia Tan2-0/+213
The CI/CD workflow will only execute on Ubuntu and MacOS latest version. The workflow will attempt to build with autotools and CMake and execute the tests. The workflow will run for all pull requests and pushes done to the master branch.
2022-12-30liblzma: Update documentation for lzma_filter_encoder.Jia Tan1-2/+5
2022-12-30Tests: Adds lzip decoder testsJia Tan3-0/+474
2022-12-30Doxygen: Update .gitignore for generating docs for in source build.Jia Cheong Tan1-0/+2
In source builds are not recommended, but we should still ignore the generated artifacts.
2022-12-30liblzma: Fix lzma_microlzma_encoder() return value.Jia Tan1-1/+2
Using return_if_error on lzma_lzma_lclppb_encode was improper because return_if_error is expecting an lzma_ret value, but lzma_lzma_lclppb_encode returns a boolean. This could result in lzma_microlzma_encoder, which would be misleading for applications.
2022-12-30CMake: Update .gitignore for CMake artifacts from in source build.Jia Tan1-0/+23
In source builds are not recommended, but we can make it easier by ignoring the generated artifacts from CMake.
2022-12-16liblzma: Update authors list in arm64.c.Lasse Collin1-0/+1
2022-12-13Bump version to 5.4.0 and soname to 5.4.0.larhzu/v5.4.0Lasse Collin4-6/+6
2022-12-13Update INSTALL: CMake on Windows isn't experimental anymore.Lasse Collin1-6/+4
Using CMake to build liblzma should work on a few other OSes but building the command line tools is still subtly broken. It is known that shared library versioning may differ between CMake and Libtool builds on some OSes, most notably Darwin.
2022-12-13Add NEWS for 5.4.0.Lasse Collin1-0/+202
2022-12-13Fix a typo in NEWS.Lasse Collin1-1/+1
2022-12-13Add NEWS for 5.2.10.Lasse Collin1-0/+12
2022-12-13Tests: Fix a typo in tests/files/README.Lasse Collin1-1/+1
2022-12-13Tests: Add two ARM64 test files.Lasse Collin4-0/+12
2022-12-12Translations: Update the Catalan translation.Lasse Collin1-351/+306
2022-12-12Update THANKS.Lasse Collin1-0/+1
2022-12-12Update AUTHORS.Lasse Collin1-0/+12
2022-12-12Docs: Omit multi-threaded decompress from TODO.Lasse Collin1-2/+0
The TODO file outdated still.
2022-12-11Docs: Update xz-file-format.txt to 1.1.0 for ARM64 filter.Lasse Collin1-7/+22
2022-12-11xz: Rename --experimental-arm64 to --arm64.Lasse Collin1-1/+1
2022-12-11liblzma: Change LZMA_FILTER_ARM64 to the official Filter ID 0x0A.Lasse Collin1-5/+1
2022-12-08xz: Make args_info.files_name a const pointer.Lasse Collin2-2/+2
2022-12-08xz: Don't modify argv[].Lasse Collin1-4/+19
The code that parses --memlimit options and --block-list modified the argv[] when parsing the option string from optarg. This was visible in "ps auxf" and such and could be confusing. I didn't understand it back in the day when I wrote that code. Now a copy is allocated when modifiable strings are needed.
2022-12-08Translations: Update the German man page translations.Lasse Collin1-3189/+1367
2022-12-08Translations: Update the German translation.Jia Tan1-271/+315
2022-12-08Translations: Update the Turkish translation.Jia Tan1-113/+108
2022-12-08Translations: Update the Croatian translation.Jia Tan1-115/+113
2022-12-08Translations: Add Romanian translation of man pages.Jia Tan2-1/+3693
Thanks to Remus-Gabriel Chelu.
2022-12-08Translations: Update the Romanian translation.Jia Tan1-147/+147
2022-12-08liblzma: Check for unexpected NULL pointers in block_header_decode().Lasse Collin1-0/+4
The API docs gave an impression that such checks are done but they actually weren't done. In practice it made little difference since the calling code has a bug if these are NULL. Thanks to Jia Tan for the original patch that checked for block->filters == NULL.
2022-12-01Bump version number for 5.3.5beta.larhzu/v5.3.5betaLasse Collin3-12/+12
This also sorts the symbol names alphabetically in liblzma_*.map.
2022-12-01Add NEWS for 5.3.5beta.Lasse Collin1-0/+43
2022-12-01Update THANKS.Lasse Collin1-0/+3
2022-12-01liblzma: Use __has_attribute(__symver__) to fix Clang detection.Lasse Collin1-1/+14
If someone sets up Clang to define __GNUC__ to 10 or greater then symvers broke. __has_attribute is supported by such GCC and Clang versions that don't support __symver__ so this should be much better and simpler way to detect if __symver__ is actually supported. Thanks to Tomasz Gajc for the bug report.
2022-12-01liblzma: Omit zero-skipping from ARM64 filter.Lasse Collin2-59/+24
It has some complicated downsides and its usefulness is more limited than I originally thought. So this change is bad for certain very specific situations but a generic solution that works for other filters (and is otherwise better too) is planned anyway. And this way 7-Zip can use the same compatible filter for the .7z format. This is still marked as experimental with a new temporary Filter ID.
2022-12-01xz: Omit the special notes about ARM64 filter on the man page.Lasse Collin1-3/+2
2022-12-01liblzma: Don't be over-specific in lzma_str_to_filters API doc.Lasse Collin1-2/+1
2022-12-01liblzma: Silence unused variable warning when BCJ filters are disabled.Lasse Collin1-0/+15
Thanks to Jia Tan for the original patch.
2022-12-01Translations: Update the Chinese (simplified) translation.Lasse Collin1-260/+348
2022-11-30Add NEWS for 5.2.9.Lasse Collin1-0/+34
2022-11-30xz: Remove message_filters_to_str function prototype from message.h.Jia Tan1-16/+0
This was forgotten from 7484744af6cbabe81e92af7d9e061dfd597fff7b.
2022-11-30Change the bug report address.Lasse Collin5-10/+9
It forwards to me and Jia Tan. Also update the IRC reference in README as #tukaani was moved to Libera Chat long ago.
2022-11-30Build: Add string_conversion.c to CMake, DOS, and VS files.Lasse Collin8-0/+8
2022-11-30Update to HTTPS URLs in AUTHORS.Lasse Collin1-3/+3
2022-11-29liblzma: Improve documentation for string to filter functions.Jia Tan1-8/+9
2022-11-29liblzma: Two fixes to lzma_str_list_filters() API docs.Lasse Collin1-3/+3
Thanks to Jia Tan.
2022-11-28xz: Use lzma_str_from_filters().Lasse Collin2-175/+28
Two uses: Displaying encoder filter chain when compressing with -vv, and displaying the decoder filter chain in --list -vv.
2022-11-28liblzma: Add lzma_str_to_filters, _from_filters, and _list_filters.Lasse Collin5-0/+1567
lzma_str_to_filters() uses static error messages which makes them not very precise. It tells the position in the string where an error occurred though which helps quite a bit if applications take advantage of it. Dynamic error messages can be added later with a new flag if it seems important enough.
2022-11-28liblzma: Make lzma_validate_chain() available outside filter_common.c.Lasse Collin2-4/+7
2022-11-28liblzma: Remove lzma_lz_decoder_uncompressed() as it's now unused.Lasse Collin2-17/+0
2022-11-28liblzma: Use LZMA1EXT feature in lzma_microlzma_decoder().Lasse Collin1-7/+8
Here too this avoids the slightly ugly method to set the uncompressed size. Also moved the setting of dict_size to the struct initializer.
2022-11-28liblzma: Use LZMA1EXT feature in lzma_alone_decoder().Lasse Collin1-5/+13
This avoids the need to use the slightly ugly method to set the uncompressed size.
2022-11-27liblzma: Add LZMA_FILTER_LZMA1EXT to support LZMA1 without end marker.Lasse Collin9-15/+204
Some file formats need support for LZMA1 streams that don't use the end of payload marker (EOPM) alias end of stream (EOS) marker. So far liblzma API has supported decompressing such streams via lzma_alone_decoder() when .lzma header specifies a known uncompressed size. Encoding support hasn't been available in the API. Instead of adding a new LZMA1-only API for this purpose, this commit adds a new filter ID for use with raw encoder and decoder. The main benefit of this approach is that then also filter chains are possible, for example, if someone wants to implement support for .7z files that use the x86 BCJ filter with LZMA1 (not BCJ2 as that isn't supported in liblzma).
2022-11-27liblzma: Avoid unneeded use of void pointer in LZMA decoder.Lasse Collin2-3/+2
2022-11-27liblzma: Pass the Filter ID to LZ encoder and decoder.Lasse Collin14-12/+26
This allows using two Filter IDs with the same initialization function and data structures.
2022-11-27liblzma: Remove two FIXME comments.Lasse Collin1-2/+2
2022-11-26xz: Use lzma_filters_free().Lasse Collin1-6/+2
2022-11-26liblzma: Use lzma_filters_free() in more places.Lasse Collin3-38/+8
2022-11-25liblzma: Omit simple coder init functions if they are disabled.Lasse Collin6-0/+24
2022-11-24xz: Allow nice_len 2 and 3 even if match finder requires 3 or 4.Lasse Collin1-5/+0
Now that liblzma accepts these, we avoid the extra check and there's one message less for translators too.
2022-11-24liblzma: Allow nice_len 2 and 3 even if match finder requires 3 or 4.Lasse Collin3-8/+26
That is, if the specified nice_len is smaller than the minimum of the match finder, silently use the match finder's minimum value instead of reporting an error. The old behavior is annoying to users and it complicates xz options handling too.
2022-11-24liblzma: Add lzma_filters_update() support to the multi-threaded encoder.Lasse Collin2-23/+109
A tiny downside of this is that now a 1-4 tiny allocations are made for every Block because each worker thread needs its own copy of the filter chain.
2022-11-24Update THANKS.Lasse Collin1-0/+1
2022-11-24Build: Don't put GNU/Linux-specific symbol versions into static liblzma.Lasse Collin3-49/+111
It not only makes no sense to put symbol versions into a static library but it can also cause breakage. By default Libtool #defines PIC if building a shared library and doesn't define it for static libraries. This is documented in the Libtool manual. It can be overriden using --with-pic or --without-pic. configure.ac detects if --with-pic or --without-pic is used and then gives an error if neither --disable-shared nor --disable-static was used at the same time. Thus, in normal situations it works to build both shared and static library at the same time on GNU/Linux, only --with-pic or --without-pic requires that only one type of library is built. Thanks to John Paul Adrian Glaubitz from Debian for reporting the problem that occurred on ia64: https://www.mail-archive.com/xz-devel@tukaani.org/msg00610.html
2022-11-24liblzma: Refactor to use lzma_filters_free().Lasse Collin2-21/+6
lzma_filters_free() sets the options to NULL and ids to LZMA_VLI_UNKNOWN so there is no need to do it by caller; the filter arrays will always be left in a safe state. Also use memcpy() instead of a loop to copy a filter chain when it is known to be safe to copy LZMA_FILTERS_MAX + 1 (even if the elements past the terminator might be uninitialized).
2022-11-24liblzma: Fix another invalid free() after memory allocation failure.Lasse Collin1-0/+4
This time it can happen when lzma_stream_encoder_mt() is used to reinitialize an existing multi-threaded Stream encoder and one of 1-4 tiny allocations in lzma_filters_copy() fail. It's very similar to the previous bug 10430fbf3820dafd4eafd38ec8be161a6978ed2b, happening with an array of lzma_filter structures whose old options are freed but the replacement never arrives due to a memory allocation failure in lzma_filters_copy().
2022-11-24liblzma: Add support for LZMA_SYNC_FLUSH in the Block encoder.Jia Tan1-0/+1
The documentation mentions that lzma_block_encoder() supports LZMA_SYNC_FLUSH but it was never added to supported_actions[] in the internal structure. Because of this, LZMA_SYNC_FLUSH could not be used with the Block encoder unless it was the next coder after something like stream_encoder() or stream_encoder_mt().
2022-11-24liblzma: Add new API function lzma_filters_free().Lasse Collin4-0/+49
This is small but convenient and should have been added a long time ago.
2022-11-24CMake: Don't use symbol versioning with static library.Lasse Collin1-3/+7
2022-11-23liblzma: Add lzma_attr_warn_unused_result to lzma_filters_copy().Lasse Collin1-1/+2
2022-11-23liblzma: Fix invalid free() after memory allocation failure.Lasse Collin1-8/+31
The bug was in the single-threaded .xz Stream encoder in the code that is used for both re-initialization and for lzma_filters_update(). To trigger it, an application had to either re-initialize an existing encoder instance with lzma_stream_encoder() or use lzma_filters_update(), and then one of the 1-4 tiny allocations in lzma_filters_copy() (called from stream_encoder_update()) must fail. An error was correctly reported but the encoder state was corrupted. This is related to the recent fix in f8ee61e74eb40600445fdb601c374d582e1e9c8a which is good but it wasn't enough to fix the main problem in stream_encoder.c.
2022-11-22liblzma: Fix language in a comment.Lasse Collin1-1/+1
2022-11-22liblzma: Fix infinite loop in LZMA encoder init with dict_size >= 2 GiB.Lasse Collin1-4/+15
The encoder doesn't support dictionary sizes larger than 1536 MiB. This is validated, for example, when calculating the memory usage via lzma_raw_encoder_memusage(). It is also enforced by the LZ part of the encoder initialization. However, LZMA encoder with LZMA_MODE_NORMAL did an unsafe calculation with dict_size before such validation and that results in an infinite loop if dict_size was 2 << 30 or greater.
2022-11-21liblzma: Fix two Doxygen commands in the API headers.Lasse Collin2-2/+2
These were caught by clang -Wdocumentation.
2022-11-19xz: Refactor duplicate code from hardware_memlimit_mtenc_get().Lasse Collin1-1/+1
2022-11-19xz: Add support --threads=+N so that -T+1 gives threaded mode.Lasse Collin4-6/+51
2022-11-19CMake: Adds test_memlimit to CMake testsJia Tan1-0/+1
2022-11-15Translations: Update the Korean translation.Lasse Collin1-281/+371
2022-11-15Translations: Update the Turkish translation.Lasse Collin1-258/+310
2022-11-15Bump version number for 5.3.4alpha.larhzu/v5.3.4alphaLasse Collin3-3/+3
2022-11-15Add NEWS for 5.3.4alpha.Lasse Collin1-0/+96
2022-11-15Add NEWS for 5.2.8.Lasse Collin1-0/+79
2022-11-14Revert "liblzma: Simple/BCJ filters: Allow disabling generic BCJ options."Lasse Collin9-11/+10
This reverts commit 177bdc922cb17bd0fd831ab8139dfae912a5c2b8 and also does equivalent change to arm64.c. Now that ARM64 filter will use lzma_options_bcj, this change is not needed anymore.
2022-11-14Replace the experimental ARM64 filter with a new experimental version.Lasse Collin11-287/+147
This is incompatible with the previous version. This has space/tab fixes in filter_*.c and bcj.h too.
2022-11-14liblzma: Add fast CRC64 for 32/64-bit x86 using SSSE3 + SSE4.1 + CLMUL.Lasse Collin5-13/+554
It also works on E2K as it supports these intrinsics. On x86-64 runtime detection is used so the code keeps working on older processors too. A CLMUL-only build can be done by using -msse4.1 -mpclmul in CFLAGS and this will reduce the library size since the generic implementation and its 8 KiB lookup table will be omitted. On 32-bit x86 this isn't used by default for now because by default on 32-bit x86 the separate assembly file crc64_x86.S is used. If --disable-assembler is used then this new CLMUL code is used the same way as on 64-bit x86. However, a CLMUL-only build (-msse4.1 -mpclmul) won't omit the 8 KiB lookup table on 32-bit x86 due to a currently-missing check for disabled assembler usage. The configure.ac check should be such that the code won't be built if something in the toolchain doesn't support it but --disable-clmul-crc option can be used to unconditionally disable this feature. CLMUL speeds up decompression of files that have compressed very well (assuming CRC64 is used as a check type). It is know that the CLMUL code is significantly slower than the generic code for tiny inputs (especially 1-8 bytes but up to 16 bytes). If that is a real-world problem then there is already a commented-out variant that uses the generic version for small inputs. Thanks to Ilya Kurdyukov for the original patch which was derived from a white paper from Intel [1] (published in 2009) and public domain code from [2] (released in 2016). [1] https://www.intel.com/content/dam/www/public/us/en/documents/white-papers/fast-crc-computation-generic-polynomials-pclmulqdq-paper.pdf [2] https://github.com/rawrunprotected/crc
2022-11-14Translations: Update the Swedish translation one more time.Lasse Collin1-3/+3
2022-11-14Translations: Update the Swedish translation again.Lasse Collin1-8/+8
2022-11-14Translations: Update the Swedish translation.Lasse Collin1-289/+382
2022-11-14Translations: Update the Ukrainian translation.Lasse Collin1-264/+354
2022-11-14Build: Omit x86_64 from --enable-assembler.Lasse Collin1-4/+2
It didn't do anything. There are only 32-bit x86 assembly files and it feels likely that new files won't be added as intrinsics in C are more portable across toolchains and OSes.
2022-11-14liblzma: Use __attribute__((__constructor__)) if available.Lasse Collin6-5/+59
This uses it for CRC table initializations when using --disable-small. It avoids mythread_once() overhead. It also means that then --disable-small --disable-threads is thread-safe if this attribute is supported.
2022-11-12Translations: Update the Romanian translation.Lasse Collin1-271/+380
2022-11-12Translations: Update the Hungarian translation.Lasse Collin1-268/+357
2022-11-11Translations: Update the Finnish translation.Lasse Collin1-262/+348
2022-11-11Translations: Update the Croatian translation.Lasse Collin1-299/+381
2022-11-11Translations: Update the Polish translation.Lasse Collin1-260/+309
2022-11-11Translations: Update the Spanish translation.Lasse Collin1-254/+344
2022-11-11Update THANKS.Lasse Collin1-0/+1
2022-11-11liblzma: Fix building with Intel ICC (the classic compiler).Lasse Collin1-1/+1
It claims __GNUC__ >= 10 but doesn't support __symver__ attribute. Thanks to Stephen Sachs.
2022-11-11liblzma: Fix incorrect #ifdef for x86 SSE2 support.Lasse Collin1-2/+1
__SSE2__ is the correct macro for SSE2 support with GCC, Clang, and ICC. __SSE2_MATH__ means doing floating point math with SSE2 instead of 387. Often the latter macro is defined if the first one is but it was still a bug.
2022-11-11Add NEWS for 5.2.7 (forgotten cherry-pick from v5.2).Lasse Collin1-0/+74
2022-11-11xzdiff: Add support for .lz files.Lasse Collin1-5/+5
The other scripts don't need changes for .lz support because in those scripts it is enough that xz supports .lz.
2022-11-11Scripts: Ignore warnings from xz.Lasse Collin4-7/+8
In practice this means making the scripts work when the input files have an unsupported check type which isn't a problem in practice unless support for some check types has been disabled at build time.
2022-11-10Translations: Rename poa4/fr_FR.po to po4a/fr.po.Lasse Collin2-1/+1
That's how it is preferred at the Translation Project. On my system /usr/share/man/fr_FR doesn't contain any other man pages than XZ Utils while /usr/share/man/fr has quite a few, so this will fix that too. Thanks to Benno Schulenberg from the Translation Project.
2022-11-09xz: Update the man page about BCJ filters, including upcoming --arm64.Lasse Collin1-37/+29
The --arm64 isn't actually implemented yet in the form described in this commit. Thanks to Jia Tan.
2022-11-09xz: Add --arm64 to --long-help and omit endianness from ARM(-Thumb).Lasse Collin1-2/+3
Modern 32-bit ARM in big endian mode use little endian for instruction encoding still, so the filters work on such executables too. It's likely less confusing for users this way. The --arm64 option hasn't been implemented yet (there is --experimental-arm64 but it's different). The --arm64 option is added now anyway because this is the likely result and the strings need to be ready for translators. Thanks to Jia Tan.
2022-11-09Windows: Update the VS project files for ARM64 and .lz support.Lasse Collin9-4/+49
2022-11-09DOS: Update Makefile and config.h to include ARM64 and .lz support.Lasse Collin2-0/+11
2022-11-09CMake: Add lzip decoder files and #define to the build.Lasse Collin1-0/+3
2022-11-09Docs: Update INSTALL and also add new prohibited options to PACKAGERS.Lasse Collin2-8/+43
2022-11-09Tests: Test the .lz files in test_files.sh.Lasse Collin1-0/+25
2022-11-09Tests: Add .lz (lzip) test files.Lasse Collin19-11/+98
2022-11-09xz: Remove the commented-out FORMAT_GZIP, gzip, .gz, and .tgz.Lasse Collin3-12/+0
2022-11-09xz: Add .lz (lzip) decompression support.Lasse Collin6-13/+141
If configured with --disable-lzip-decoder then --long-help will still list `lzip' in --format but I left it like that since due to translations it would be messy to have two help strings. Features are disabled only in special situations so wrong help in such a situation shouldn't matter much. Thanks to Michał Górny for the original patch.
2022-11-09liblzma: Add .lz support to lzma_auto_decoder().Lasse Collin4-11/+47
Thanks to Michał Górny for the original patch.
2022-11-09liblzma: Add .lz (lzip) decompression support (format versions 0 and 1).Lasse Collin6-2/+501
Support for format version 0 was removed from lzip 1.18 for some reason. .lz format version 0 files are rare (and old) but some source packages were released in this format, and some people might have personal files in this format too. It's very little extra code to support it along side format version 1 so this commits adds support for both. The Sync Flush marker extentension to the original .lz format version 1 isn't supported. It would require changes to the LZMA decoder itself. Such files are very rare anyway. See the API doc for lzma_lzip_decoder() for more details about the .lz format support. Thanks to Michał Górny for the original patch.
2022-11-09liblzma: Add the missing Makefile.inc change for --disable-microlzma.Lasse Collin1-2/+10
This was forgotten from commit 59c4d6e1390f6f4176f43ac1dad1f7ac03c449b8.
2022-11-09xz: Add comments about stdin and src_st.st_size.Lasse Collin2-0/+13
"xz -v < regular_file > out.xz" doesn't display the percentage and estimated remaining time because it doesn't even try to check the input file size when input is read from stdin. This could be improved but for now there's just a comment to remind about it.