Port upstream LibArchive commit "compute string pointers after
concatenation" (2014-09-25) and commit "Move variables to top of
function for non-C99 compilers" (2014-11-15) to our CMake copy.
Otherwise we may compute a pointer to memory that is about to be freed
and then compute a bad size to give to CryptGenRandom.
Inspired-by: Tim Kientzle <kientzle@gmail.com>
When testing CMAKE_<LANG>_COMPILER_ID values, do not explicitly
dereference or quote the variable. We want if() to auto-dereference the
variable and not its value. Also replace MATCHES with STREQUAL where
equivalent.
Newer HP-UX versions (e.g. 11.31) also offers F_SETTIMES, but with a different
struct for the timing information.
Suggested-by: Eric Berge <ericmberge@gmail.com>
67f5f0a9 libarchive: Use _snprintf on Windows, not snprintf
fcfbb0a9 libarchive: Drop LIBARCHIVE_ADDITIONAL_LIBS, CMake does not need it
61a649d9 libarchive: Update README-CMake.txt for new snapshot
4533560c Merge branch 'libarchive-upstream' into update-libarchive
44d6b82f libarchive: Disable all whitespace checks in third-party code
37f225b7 libarchive 3.1.2-246-ga5a5d28b (reduced)
6ab7c326 libarchive: Avoid left-shift overflow of signed integer
In libarchive/archive_write_set_format_zip.c there are two calls to
archive_le32enc whose second argument is of the form
archive_entry_mode(zip->entry) << 16
However, the return type from archive_entry_mode may be a signed integer
so the shift may overflow. Since the second argument of archive_le32enc
expects uint32_t anyway, simply cast to that prior to shifting.
In archive_entry.h refer to "BY_HANDLE_FILE_INFORMATION *" using
"struct _BY_HANDLE_FILE_INFORMATION *" to avoid requiring the
includer to already have <windows.h>.
Drop ENABLE_TAR and ENABLE_CPIO related options because we do not build
these command-line tools. Drop ENABLE_TEST and ENABLE_COVERAGE options
because we do not build the tests.
Resolve conflicts in favor of the upstream side where possible.
Resolve a logical conflict in archive_windows.h where the upstream
port to Watcom was done slightly differently from ours.
Port upstream commit 6cf33c93 (Issue 320: Rewrite (again) to avoid
the left shift that CLang dislikes so much, 2013-12-07) into CMake.
Inspired-by: Tim Kientzle <kientzle@freebsd.org>
Port upstream commit 533e8fda (Rework the sign-extension to avoid
left-shift of an explicit negative number, 2013-06-29) into CMake.
Inspired-by: Tim Kientzle <kientzle@freebsd.org>
Since commit 7d47c693 (Drop compatibility with CMake < 2.4, 2013-10-08)
we no longer need to use the configure_file IMMEDIATE option to support
compatibility modes less than 2.0.
Apple distributes their own Clang build with their own version numbers
that differ from upstream Clang. Use the __apple_build_version__ symbol
to identify the Apple Clang compiler and report the Apple Build Version
as the fourth version component in CMAKE_<LANG>_COMPILER_VERSION. Add
Compiler/AppleClang-<lang> and Platform/Darwin-AppleClang-<lang> modules
that simply include the upstream equivalents.
Fix comparisons of CMAKE_<LANG>_COMPILER_ID to Clang in CMake's own
source and tests to account for AppleClang.
Ensure CMAKE_DATA_DIR, CMAKE_DOC_DIR, and CMAKE_MAN_DIR are always
relative paths in CMake code, and set defaults accordingly. Use the
install() command instead of install_files() and install_targets().
This is more modern and also avoids stripping of the first character
from user-specified destinations.
While at it, fix the default destinations reported in the bootstrap
help.
Avoid requiring CMake 2.8.6 for CMakePushCheckState or CMake 2.8.8 for
CMakeExpandImportedTargets. Drop the custom versions of CMake modules
CheckCSource(Compiles|Runs) because we do not use the SAFESEH option
anyway.
Follow up change from commit ffa6faa4 (libarchive: Include cm_zlib.h to
get zlib used by CMake, 2011-12-20) for new includes of zlib.h in
updated libarchive.
The archive_string_conv type sc variable already freed via free(sc) on
the other hand in second line we are tyring to free its subset via
free(sc->from_charset) this will cause a problem because we couldn't
reach sc after first release.
Reviewed-by: Igor Murzov <e-mail@date.by>
caught by clang's -fsanitize=shift. A small unsigned int was
promoted, according to C's regular promotion rules, to a signed
int, it was then left shifted. This sometimes pushed a 1 into
the sign bit, which is undefined behaviour. Fixed by using
unsigned temporaries.