Lecrapouille/zipper

error: assignment to ‘open64_file_func’ {aka ‘void * (*)(void *, const void *, int)’} from incompatible pointer type ‘void *

Closed this issue · 6 comments

Hi all.

Old minizip bundled in zipper cant be compiled with GCC-14.0.1:

[ 65%] Building C object CMakeFiles/Zipper.dir/minizip/unzip.c.o
/usr/bin/gcc -DHAVE_AES -DLINUX -DUSE_ZLIB -DZipper_EXPORTS -I/builddir/build/BUILD/zipper/minizip -I/builddir/build/BUILD/zipper/zipper -I/builddir/build/BUILD/zipper -I/builddir/build/BUILD/zipper/redhat-linux-build -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fno-strict-aliasing -fPIC -DNDEBUG -fPIC -MD -MT CMakeFiles/Zipper.dir/minizip/unzip.c.o -MF CMakeFiles/Zipper.dir/minizip/unzip.c.o.d -o CMakeFiles/Zipper.dir/minizip/unzip.c.o -c /builddir/build/BUILD/zipper/minizip/unzip.c
/builddir/build/BUILD/zipper/minizip/ioapi_buf.c: In function ‘fill_buffer_filefunc64’:
/builddir/build/BUILD/zipper/minizip/ioapi_buf.c:505:38: error: assignment to ‘open64_file_func’ {aka ‘void * (*)(void *, const void *, int)’} from incompatible pointer type ‘void * (*)(void *, const char *, int)’ [-Wincompatible-pointer-types]
  505 |     pzlib_filefunc_def->zopen64_file = fopen64_buf_func;
      |                                      ^
gmake[2]: *** [CMakeFiles/Zipper.dir/build.make:275: CMakeFiles/Zipper.dir/minizip/ioapi_buf.c.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
[ 67%] Building C object CMakeFiles/Zipper-static.dir/minizip/ioapi.c.o
/usr/bin/gcc -DHAVE_AES -DLINUX -DUSE_ZLIB -I/builddir/build/BUILD/zipper/minizip -I/builddir/build/BUILD/zipper/zipper -I/builddir/build/BUILD/zipper -I/builddir/build/BUILD/zipper/redhat-linux-build -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fno-strict-aliasing -fPIC -DNDEBUG -MD -MT CMakeFiles/Zipper-static.dir/minizip/ioapi.c.o -MF CMakeFiles/Zipper-static.dir/minizip/ioapi.c.o.d -o CMakeFiles/Zipper-static.dir/minizip/ioapi.c.o -c /builddir/build/BUILD/zipper/minizip/ioapi.c
/builddir/build/BUILD/zipper/minizip/unzip.c: In function ‘unz64local_GetCurrentFileInfoInternal’:
/builddir/build/BUILD/zipper/minizip/unzip.c:898:79: error: passing argument 3 of ‘unz64local_getByte’ from incompatible pointer type [-Wincompatible-pointer-types]
  898 |                 if (unz64local_getByte(&s->z_filefunc, s->filestream_with_CD, &uL) != UNZ_OK)
      |                                                                               ^~~
      |                                                                               |
      |                                                                               uLong * {aka long unsigned int *}
/builddir/build/BUILD/zipper/minizip/unzip.c:198:104: note: expected ‘int *’ but argument is of type ‘uLong *’ {aka ‘long unsigned int *’}
  198 | local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi)
      |                                                                                                   ~~~~~^~
/builddir/build/BUILD/zipper/minizip/unzip.c:902:79: error: passing argument 3 of ‘unz64local_getByte’ from incompatible pointer type [-Wincompatible-pointer-types]
  902 |                 if (unz64local_getByte(&s->z_filefunc, s->filestream_with_CD, &uL) != UNZ_OK)
      |                                                                               ^~~
      |                                                                               |
      |                                                                               uLong * {aka long unsigned int *}
/builddir/build/BUILD/zipper/minizip/unzip.c:198:104: note: expected ‘int *’ but argument is of type ‘uLong *’ {aka ‘long unsigned int *’}
  198 | local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi)
      |                                                                                                   ~~~~~^~
[ 68%] Building C object CMakeFiles/staticZipper.dir/minizip/aes/prng.c.o
/usr/bin/gcc -DHAVE_AES -DLINUX -DUSE_ZLIB -I/builddir/build/BUILD/zipper/minizip -I/builddir/build/BUILD/zipper/zipper -I/builddir/build/BUILD/zipper -I/builddir/build/BUILD/zipper/redhat-linux-build -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fno-strict-aliasing -fPIC -DNDEBUG -MD -MT CMakeFiles/staticZipper.dir/minizip/aes/prng.c.o -MF CMakeFiles/staticZipper.dir/minizip/aes/prng.c.o.d -o CMakeFiles/staticZipper.dir/minizip/aes/prng.c.o -c /builddir/build/BUILD/zipper/minizip/aes/prng.c
/builddir/build/BUILD/zipper/minizip/unzip.c:907:79: error: passing argument 3 of ‘unz64local_getByte’ from incompatible pointer type [-Wincompatible-pointer-types]
  907 |                 if (unz64local_getByte(&s->z_filefunc, s->filestream_with_CD, &uL) != UNZ_OK)
      |                                                                               ^~~
      |                                                                               |
      |                                                                               uLong * {aka long unsigned int *}
/builddir/build/BUILD/zipper/minizip/unzip.c:198:104: note: expected ‘int *’ but argument is of type ‘uLong *’ {aka ‘long unsigned int *’}
  198 | local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi)
      |                                                                                                   ~~~~~^~
/builddir/build/BUILD/zipper/minizip/unzip.c: In function ‘unzOpenCurrentFile3’:
/builddir/build/BUILD/zipper/minizip/unzip.c:1268:72: warning: pointer targets in passing argument 2 of ‘fcrypt_init’ differ in signedness [-Wpointer-sign]
 1268 |             fcrypt_init(s->cur_file_info_internal.aes_encryption_mode, password, strlen(password), saltvalue,
      |                                                                        ^~~~~~~~
      |                                                                        |
      |                                                                        const char *
In file included from /builddir/build/BUILD/zipper/minizip/unzip.c:55:
/builddir/build/BUILD/zipper/minizip/aes/fileenc.h:98:25: note: expected ‘const unsigned char *’ but argument is of type ‘const char *’
   98 |     const unsigned char pwd[],              /* the user specified password (input)  */
      |     ~~~~~~~~~~~~~~~~~~~~^~~~~
gmake[2]: *** [CMakeFiles/Zipper.dir/build.make:303: CMakeFiles/Zipper.dir/minizip/unzip.c.o] Error 1

@sagitter Thanks for the report, I'll check it when I'll time (currently I have few)

@noloader oooh I was not aware that this lib or the initial author's lib was used in Fedora! I'm using Debian I'm stucked with gcc-10

As said in #9 I cannot accept to use the minzip version referred by @nolaoder because mine is fresher (AES) the issue is in the ioapi_buf.c that was not present in the referred version. I'll try to get a newer gcc version.

I have updated my Debian to version 12. I have g++-12 and also the warnings. I'll try to fix them

@noloader @sagitter I upgraded minizip. Hope this will be good now