Commit Graph

38 Commits

Author SHA1 Message Date
David Korth
5d3ec38bce [minizip-ng] Don't install CMake or pkgconfig files, or header files.
[extlib] CMakeLists.txt: Set SKIP_INSTALL_HDR for MiniZip-ng, which for
some reason checks this variable instead of SKIP_INSTALL_HEADERS.
2025-04-20 02:09:19 -04:00
David Korth
d1ff987d64 [minizip-ng] Fix some warnings that broke -Werror builds.
Initialize some variables, and use memcpy() instead of strncpy().

Remove the -Wno-error options. This broke on Debian 8 ppc (gcc-4.9.2),
which doesn't support -Wstringop-overflow or -Wstringop-truncation.

extlib/minizip-ng/compat/unzip.c: In function ‘unzGetFilePos’:
extlib/minizip-ng/compat/unzip.c:563:38: error: ‘file_pos64.pos_in_zip_directory’ may be used uninitialized [-Werror=maybe-uninitialized]
  563 |     file_pos->pos_in_zip_directory = (uint32_t)file_pos64.pos_in_zip_directory;
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
extlib/minizip-ng/compat/unzip.c:556:20: note: ‘file_pos64.pos_in_zip_directory’ was declared here
  556 |     unz64_file_pos file_pos64;
      |                    ^~~~~~~~~~
extlib/minizip-ng/compat/unzip.c:564:29: error: ‘file_pos64.num_of_file’ may be used uninitialized [-Werror=maybe-uninitialized]
  564 |     file_pos->num_of_file = (uint32_t)file_pos64.num_of_file;
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
extlib/minizip-ng/compat/unzip.c:556:20: note: ‘file_pos64.num_of_file’ was declared here
  556 |     unz64_file_pos file_pos64;
      |                    ^~~~~~~~~~
cc1: all warnings being treated as errors

extlib/minizip-ng/mz_zip.c: In function ‘mz_zip_set_comment’:
extlib/minizip-ng/mz_zip.c:1569:5: error: ‘__builtin___strncpy_chk’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
 1569 |     strncpy(zip->comment, comment, comment_size);
      |     ^
extlib/minizip-ng/mz_zip.c:1563:29: note: length computed here
 1563 |     comment_size = (int32_t)strlen(comment);
      |                             ^~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
2025-04-07 20:55:55 -04:00
David Korth
87196e25c6 [minizip-ng] unzip.h, zip.h: MSVC 2015 doesn't support __has_include().
Unconditionally use zlib.h instead of checking for zlib-ng.h.
2025-04-07 20:12:02 -04:00
David Korth
05055964a0 [minizip] Update: v4.0.7 -> v4.0.9
[libromdata] J2ME, GcnFstTest: MiniZip's compat headers were moved
in v4.0.8.
2025-04-07 19:14:26 -04:00
David Korth
a680b67b99 [minizip-ng] CMakeLists.txt: FIXME: Fix stringop-overflow and stringop-truncation warnings.
This broke the Ubuntu 22.04 AppVeyor build:

extlib/minizip-ng/mz_compat.c: In function ‘unzGetFilePos’:
extlib/minizip-ng/mz_compat.c:1201:38: error: ‘file_pos64.pos_in_zip_directory’ may be used uninitialized [-Werror=maybe-uninitialized]
 1201 |     file_pos->pos_in_zip_directory = (uint32_t)file_pos64.pos_in_zip_directory;
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
extlib/minizip-ng/mz_compat.c:1194:20: note: ‘file_pos64.pos_in_zip_directory’ was declared here
 1194 |     unz64_file_pos file_pos64;
      |                    ^~~~~~~~~~
extlib/minizip-ng/mz_compat.c:1202:29: error: ‘file_pos64.num_of_file’ may be used uninitialized [-Werror=maybe-uninitialized]
 1202 |     file_pos->num_of_file = (uint32_t)file_pos64.num_of_file;
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
extlib/minizip-ng/mz_compat.c:1194:20: note: ‘file_pos64.num_of_file’ was declared here
 1194 |     unz64_file_pos file_pos64;
      |                    ^~~~~~~~~~
cc1: all warnings being treated as errors
2025-04-06 18:10:02 -04:00
David Korth
3a7f06e0fa [minizip-ng] CMakeLists.txt: FIXME: Fix stringop-overflow and stringop-truncation warnings.
This broke the Ubuntu 22.04 AppVeyor build:

extlib/minizip-ng/mz_zip_rw.c: In function ‘mz_zip_reader_entry_save_file’:
extlib/minizip-ng/mz_zip_rw.c:668:5: error: ‘__builtin_strncat’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
  668 |     strncat(pathwfs, path, path_length);
      |     ^
extlib/minizip-ng/mz_zip_rw.c:662:19: note: length computed here
  662 |     path_length = strlen(path);
      |                   ^~~~~~~~~~~~
cc1: all warnings being treated as errors

extlib/minizip-ng/mz_zip.c: In function ‘mz_zip_set_comment’:
extlib/minizip-ng/mz_zip.c:1574:5: error: ‘__builtin_strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
 1574 |     strncpy(zip->comment, comment, comment_size);
      |     ^
extlib/minizip-ng/mz_zip.c:1568:29: note: length computed here
 1568 |     comment_size = (int32_t)strlen(comment);
      |                             ^~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
2025-04-06 14:44:21 -04:00
David Korth
d5e2b8266f [minizip-ng] Cherry-pick a slight memory optimization for 64-bit systems.
Slightly reduces struct size by getting rid of padding.

Not including the mz_crypt_openssl.c change because it doesn't apply here.
2025-03-29 12:21:23 -04:00
David Korth
f0647da5eb Remove CheckHiddenVisibility.cmake.
The root CMakeLists.txt has a minimum CMake version of 3.5, and
CheckHiddenVisibility.cmake's workarounds are only needed for
CMake 3.2 and earlier.

Set CMP0063 unconditionally (added in CMake 3.3) and set the
CMAKE_<LANG>_VISIBILITY_PRESET and CMAKE_VISIBILITY_INLINES_HIDDEN
variables where CHECK_HIDDEN_VISIBILITY() was called before.

There should effectively be no code changes with this commit.
2025-01-18 22:34:24 -05:00
David Korth
6e1b2cf3cd [minizip-ng] Don't export symbols if building as a static library.
Otherwise, the MiniZip-NG symbols end up getting exported from
libromdata.so, and we don't want to do that.
2025-01-18 22:27:02 -05:00
David Korth
1f8bd87910 [minizip-ng] Fix MiniZip DLL packaging on Windows.
- Don't install binaries. minigzip and minizip aren't compiled by
  default, so attempting to install them will fail.

- Set SKIP_INSTALL_LIBRARIES to OFF when building DLLs.

- Disable installation of headers, import libraries, and .cmake files.

- Install PDB files.
2024-11-23 14:10:54 -05:00
David Korth
c99b4c0837 [minizip-ng] Build as a .dll on Windows.
Since we're now using MiniZip in the J2ME parser, it should be compiled
as a DLL instead of statically linked.

Disable zstd support. It's causing issues with DelayLoad, since we're not
loading zstd in the J2ME parser. I originally enabled this to potentially
improve compression for test cases, but I ended up using .tar.zst instead
of zstd-compressed .zip files.

[libwin32common] Add MiniZip DLL information.

[libromdata] J2ME: Add MiniZip delay-load handling.

[libromdata] GczReader: Improve delay-load handling a bit.
2024-11-23 13:51:23 -05:00
David Korth
3c90ea3d26 [minizip-ng] Update: v4.0.6 -> v4.0.7 2024-07-02 00:23:19 -04:00
David Korth
58c54da1fb [minizip-ng] Update: v4.0.5 -> v4.0.6 2024-06-08 11:32:12 -04:00
David Korth
a0e5dde6a3 [minizip-ng] Update: v4.0.4 -> v4.0.5 2024-03-17 18:45:35 -04:00
David Korth
efd4fd587a [extlib] minizip-ng: Disable some stuff that doesn't work on CMake 3.5. 2024-01-08 20:28:38 -05:00
David Korth
b4f2ad34e7 [minizip-ng] Update: v4.0.2 -> v4.0.4
[extlib] CMakeLists.txt: Set -DMZ_COMPAT_VERSION=120 so we get
the newer version of unzLocateFile().
2024-01-07 23:51:40 -05:00
David Korth
30847e895f [minizip-ng] Update: v4.0.1 -> v4.0.2 2023-11-01 00:12:15 -04:00
David Korth
2fb86861b4 [minizip-ng] Forgot to add cmake/detect-sanitizer.cmake to the repository. 2023-09-09 10:32:06 -04:00
David Korth
e241fed6e6 [minizip-ng] Fix two compile warnings.
- Define _DEFAULT_SOURCE in addition to _BSD_SOURCE.

In file included from /usr/include/bits/libc-header-start.h:33,
                 from /usr/include/stdlib.h:26,
                 from /home/david/programming/rom-properties/extlib/minizip-ng/mz.h:158,
                 from /home/david/programming/rom-properties/extlib/minizip-ng/mz_strm_mem.c:19:
/usr/include/features.h:196:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  196 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~

- mz_os_posix.c, mz_os_utf8_string_create(): `encoding` is unused.
2023-09-04 13:21:48 -04:00
David Korth
d7a7f5ca7d [minizip-ng] Update: v4.0.0 -> v4.0.1 2023-09-04 13:21:31 -04:00
David Korth
9416444bb0 [minizip-ng] CMakeLists.txt: Disable project()'s DESCRIPTION and HOMEPAGE_URL.
Ubuntu 16.04 has CMake 3.5.1:
- DESCRIPTION was added in CMake 3.9.
- HOMEPAGE_URL was added in CMake 3.12.

CMake 3.5.1 incorrectly interprets these as programming languages and
gets very confused when it can't find .cmake files that describe how
to handle those "languages".

This was added in minizip-ng 4.0.0, so no rom-properties releases are
affected by this.
2023-06-11 12:24:39 -04:00
David Korth
06661cff3f [minizip-ng] CMakeLists.txt: Disable CheckSourceCompiles.
It doesn't seem like it's needed, and AppVeyor on Windows uses
cmake-3.16.2, which doesn't have it. (added in 3.19)
2023-05-21 14:01:33 -04:00
David Korth
690d214b80 [minizip-ng] Update: v3.0.10 -> v4.0.0
Major version bump due to removal of ZIP signature creation and
verification.
2023-05-21 13:10:24 -04:00
David Korth
fdf8095300 [minizip-ng] Update: v3.0.8 -> v3.0.10 2023-05-14 11:42:24 -04:00
David Korth
72ebce25ff [extlib] Fixed some gcc warnings.
minizip-ng:
extlib/minizip-ng/mz_os_posix.c: In function ‘mz_os_utf8_string_create’:
extlib/minizip-ng/mz_os_posix.c:94:63: warning: unused parameter ‘encoding’ [-Wunused-parameter]
   94 | uint8_t *mz_os_utf8_string_create(const char *string, int32_t encoding) {
      |                                                       ~~~~~~~~^~~~~~~~

rapidjson:
src/librpbase/TextOut_json.cpp:31:
extlib/rapidjson/include/rapidjson/document.h:102:19: warning:
‘template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
struct std::iterator’ is deprecated [-Wdeprecated-declarations]
  102 |     : public std::iterator<std::random_access_iterator_tag
      |                   ^~~~~~~~
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/stl_algobase.h:65,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/algorithm:60,
                 from src/librpbase/stdafx.h:28,
                 from src/librpbase/TextOut_json.cpp:10:
/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/stl_iterator_base_types.h:127:34: note: declared here
  127 |     struct _GLIBCXX17_DEPRECATED iterator
      |                                  ^~~~~~~~
2023-02-11 10:04:56 -05:00
David Korth
208e6d3b5d [minizip-ng] Update: v3.0.7 -> v3.0.8 2023-01-14 00:00:03 -05:00
David Korth
91cb8f32e2 [minizip-ng] Update: v3.0.6 -> v3.0.7 2022-10-16 14:27:41 -04:00
David Korth
c365d41a48 [minizip-ng] Don't manually check for ZSTD using pkg_check_modules().
This causes issues on Xubuntu 16.04 if a system-wide zstd is installed
because extlib uses the internal version while minizip-ng tries using
the system version, and the system version isn't recent enough for
minizip-ng. (Requires 1.4.0; Xubuntu 16.04 has 1.3.1.)
2022-06-21 17:14:24 -04:00
David Korth
3b3d5d8b69 [minizip-ng] Update: v3.0.4 -> v3.0.6
Among other things, zip.h and unzip.h are now generated in the binary
directory, not the source directory.
2022-05-21 14:20:39 -04:00
David Korth
a03801ae45 [minizip-ng] Restore some rom-properties changes, including a definition for FSCTL_GET_REPARSE_POINT. 2021-12-22 23:35:21 -05:00
David Korth
c11ffb0350 [minizip-ng] Update: v3.0.2 -> v3.0.4 2021-12-22 22:52:45 -05:00
David Korth
86dbf36f3e [cmake] gcc.cmake: Enable -Werror for several different format warnings.
Reference: https://fedoraproject.org/wiki/Format-Security-FAQ

-Werror=format-nonliteral is *not* enabled because there are some
legitimate uses of non-literal format strings.

Separated the warning flags into multiple variables.

Updated everything to build with this change.
2021-09-06 01:41:59 -04:00
David Korth
3048dff5e0 [minizip-ng] Update: v3.0.1 -> v3.0.2 2021-05-15 00:38:18 -04:00
David Korth
eadcdf9327 Remove "/Gz" for stdcall on i386 when building with MSVC.
I tested a release build and it saved a total of 10,752 bytes.

On the other hand, it had a rather huge maintenance overhead, since I had
to ensure that all extlibs had __cdecl set up in the headers properly,
and this had to be redone on every update.

The i386 build of LZ4 on AppVeyor was failing in tests because of missing
stdcall symbols. I decided not to bother adding stdcall support to LZ4
and simply revert stdcall entirely.
2021-03-31 22:24:17 -04:00
David Korth
6b50b93485 [minizip-ng] CMakeLists.txt: Use ${ZSTD_LIBRARY} for zstd instead of the specified targets.
These targets don't exist in our zstd CMakeLists.txt...
2021-03-22 00:43:28 -04:00
David Korth
43976a6e3d [minizip-ng] Update: v3.0.0 -> v3.0.1 2021-03-21 23:49:03 -04:00
David Korth
549d87fd79 [minizip-ng] CMakeLists.txt: Disable target_link_directories().
This was added in CMake-3.13, and travis-ci has CMake-3.9.2.
2021-03-21 23:40:00 -04:00
David Korth
7d302b51c9 [minizip] Updated from v2.10.5 to minizip-ng 3.0.0.
As of 3.0.0, the minizip fork is now called minizip-ng.

https://github.com/zlib-ng/minizip-ng
2021-02-17 18:38:19 -05:00