Commit Graph

1765 Commits

Author SHA1 Message Date
Lasse Collin 3ccedb0972 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-02-03 21:10:42 +08:00
Lasse Collin 09fbd2f052 xz: Silence warnings from -Wsign-conversion in a 32-bit build. 2023-02-03 21:10:38 +08:00
Lasse Collin 683d3f178e 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-02-03 21:10:30 +08:00
Lasse Collin 2b8062ef94 liblzma: Silence a warning from -Wsign-conversion in a 32-bit build. 2023-02-03 21:10:25 +08:00
Lasse Collin b16b9c0d22 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-02-03 21:10:19 +08:00
Lasse Collin c47ecd6d39 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-02-03 21:10:06 +08:00
Lasse Collin 34e13ce015 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-02-03 21:10:01 +08:00
Lasse Collin 6671d0fe46 liblzma: Silence warnings from clang -Wconditional-uninitialized.
This is similar to 2ce4f36f17.
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-03 21:09:42 +08:00
Lasse Collin d3e833ca1d Fix warnings from clang -Wdocumentation. 2023-02-03 21:09:35 +08:00
Lasse Collin 977dd2e26b Tests: test_lzip_decoder: Remove trailing white-space. 2023-02-03 21:09:12 +08:00
Lasse Collin c55157ed74 Tests: test_lzip_decoder: Silence warnings from -Wsign-conversion. 2023-02-03 21:07:57 +08:00
Lasse Collin 18b845e697 Bump version and soname for 5.4.1. 2023-01-11 18:52:54 +02:00
Jia Tan 4080bbb844 Add NEWS for 5.4.1. 2023-01-11 18:52:23 +02:00
Lasse Collin 674c89fdb8 sysdefs.h: Don't include strings.h anymore.
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-11 17:49:59 +02:00
Lasse Collin 2a6b938084 xz: Include <strings.h> in suffix.c if needed for strcasecmp().
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-11 17:49:59 +02:00
Jia Tan aea639e81b xz: Fix warning -Wformat-nonliteral on clang in message.c.
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-11 17:31:54 +02:00
Jia Tan e3b42bfcb0 Tests: Fix test_filter_flags copy/paste error. 2023-01-11 17:31:54 +02:00
Jia Tan 21625b7e11 Tests: Fix type-limits warning in test_filter_flags.
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-11 17:31:54 +02:00
Lasse Collin c337983e92 liblzma: CLMUL CRC64: Work around a bug in MSVC, second attempt.
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-11 17:31:54 +02:00
Jia Tan b7fb438ea0 Tests: Fix unused function warning in test_block_header.
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-11 17:31:54 +02:00
Jia Tan 68e9ef036d Tests: Fix unused function warning in test_index_hash.
test_index_hash does not use fill_index_hash() unless both encoders
and decoders are configured in the build.
2023-01-11 17:31:54 +02:00
Lasse Collin a387707cd8 Windows: Update INSTALL-MSVC.txt to recommend CMake over project files. 2023-01-11 17:30:30 +02:00
Lasse Collin 52902ad695 Revert "liblzma: CLMUL CRC64: Workaround a bug in MSVC (VS2015-2022)."
This reverts commit 36edc65ab4.

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-10 12:51:19 +02:00
Lasse Collin e81b9fc48c sysdefs.h: Fix a comment. 2023-01-10 10:26:59 +02:00
Lasse Collin 6e89ab58b0 sysdefs.h: Don't include memory.h anymore even if it were available.
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-10 10:26:59 +02:00
Lasse Collin 65c59ad429 CMake/Windows: Add a workaround for windres from GNU binutils.
This is combined from the following commits in the master branch:
443dfebced
6b117d3b1f
5e34774c31

Thanks to Iouri Kharon for the bug report, the original patch,
and testing.
2023-01-10 08:50:26 +02:00
Lasse Collin 43521e77ac Tests: test_filter_flags: Clean up minor issues.
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-09 16:58:27 +02:00
Jia Tan 6b44cead95 Tests: Refactors existing filter flags tests.
Converts the existing filter flags tests into tuktests.
2023-01-09 16:58:27 +02:00
Lasse Collin 1bbefa9659 Tests: tuktest.h: Support tuktest_malloc(0).
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-09 16:58:27 +02:00
Lasse Collin ce3a3fbc7c CMake: Update cmake_minimum_required from 3.13...3.16 to 3.13...3.25.
The changes listed on cmake-policies(7) for versions 3.17 to 3.25
shouldn't affect this project.
2023-01-09 16:58:27 +02:00
Lasse Collin 99fcd57f2e Update THANKS. 2023-01-09 16:58:27 +02:00
Lasse Collin c0c13d9d82 Update THANKS. 2023-01-09 16:58:27 +02:00
Lasse Collin 3d45987451 CMake: Fix a copypaste error in xzdec Windows resource file handling.
It was my mistake. Thanks to Iouri Kharon for the bug report.
2023-01-09 16:58:27 +02:00
Lasse Collin 706bce5018 CMake/Windows: Add resource files to xz.exe and xzdec.exe.
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-09 16:58:27 +02:00
Lasse Collin e96dee55df liblzma: CLMUL CRC64: Workaround a bug in MSVC (VS2015-2022).
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-09 16:58:27 +02:00
Lasse Collin 52bc1ee34d Build: Require that _mm_set_epi64x() is usable to enable CLMUL support.
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-09 16:58:27 +02:00
Jia Tan bad44cfe19 Tests: Creates test_index_hash.c
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-09 16:56:07 +02:00
Jia Tan 692ccdf551 liblzma: Remove common.h include from common/index.h.
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-09 16:37:19 +02:00
Jia Tan 2ac7bafc8f liblzma: Add NULL check to lzma_index_hash_append.
This is for consistency with lzma_index_append.
2023-01-09 16:34:32 +02:00
Jia Tan db714d30e0 liblzma: Replaced hardcoded 0x0 index indicator byte with macro 2023-01-09 16:34:32 +02:00
Jia Tan 39d2585dcd Style: Change #if !defined() to #ifndef in mythread.h. 2023-01-09 16:33:53 +02:00
Jia Tan 3f0130aa28 Build: Add missing stream_decoder_mt.c to .vcxproj files.
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-09 16:33:53 +02:00
Lasse Collin f204d1050a Update THANKS. 2023-01-04 23:17:09 +02:00
Lasse Collin 34a9c2d650 Tests: Adjust style in test_compress.sh. 2023-01-04 23:17:09 +02:00
Jia Tan 761c208d58 Tests: Replace non portable shell parameter expansion
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-05 00:30:22 +08:00
Jia Tan 8a7cbc0745 Translations: Add Korean translation of man pages.
Thanks to Seong-ho Cho
2023-01-05 00:30:14 +08:00
Jia Tan ca2af49bb8 Translations: Update the Esperanto translation. 2023-01-05 00:30:05 +08:00
Lasse Collin bfba3394ae Build: Fix config.h comments. 2023-01-05 00:29:52 +08:00
Jia Tan 507648ad11 Build: Only define HAVE_PROGRAM_INVOCATION_NAME if it is set to 1.
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-05 00:29:39 +08:00
Lasse Collin ab5229d32a Tests: test_check: Test corner cases of CLMUL CRC64. 2023-01-05 00:28:09 +08:00