Skip to content

Commit

Permalink
devel/zziplib: fix build with clang 15
Browse files Browse the repository at this point in the history
During an exp-run for llvm 15 (see bug 265425), it turned out that
devel/zziplib failed to build with clang (and lld) 15:

/wrkdirs/usr/ports/devel/zziplib/work/zziplib-0.13.72/zzip/mmapped.c:664:11: error: incompatible pointer to integer conversion initializing 'off_t' (aka 'long') with an expression of type 'zzip_byte_t *' (aka 'unsigned char *') [-Wint-conversion]
    off_t offset = zzip_file_header_to_data(header);
          ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/devel/zziplib/work/zziplib-0.13.72/zzip/mmapped.c:666:34: warning: incompatible pointer types initializing 'struct zzip_extra_zip64 *' with an expression of type 'char *' [-Wincompatible-pointer-types]
        struct zzip_extra_zip64* zip64 =
                                 ^
/wrkdirs/usr/ports/devel/zziplib/work/zziplib-0.13.72/zzip/mmapped.c:673:34: warning: incompatible pointer types initializing 'struct zzip_extra_zip64 *' with an expression of type 'char *' [-Wincompatible-pointer-types]
        struct zzip_extra_zip64* zip64 =
                                 ^
/wrkdirs/usr/ports/devel/zziplib/work/zziplib-0.13.72/zzip/mmapped.c:685:24: error: incompatible integer to pointer conversion assigning to 'Bytef *' (aka 'unsigned char *') from 'off_t' (aka 'long') [-Wint-conversion]
    file->zlib.next_in = offset;
                       ^ ~~~~~~
2 warnings and 2 errors generated.

Use the patch from gdraheim/zziplib#140 to fix
the errors.

PR:		268185
Approved by:	portmgr (tcberner)
MFH:		2022Q4
  • Loading branch information
DimitryAndric committed Dec 18, 2022
1 parent 7c3e4c5 commit 76a985c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions devel/zziplib/files/patch-zzip_mmapped.c
@@ -0,0 +1,20 @@
--- zzip/mmapped.c.orig 2021-01-04 23:05:08 UTC
+++ zzip/mmapped.c
@@ -661,7 +661,7 @@ zzip_disk_entry_fopen(ZZIP_DISK * disk, ZZIP_DISK_ENTR

___ /* a ZIP64 extended block may follow. */
size_t csize = zzip_file_header_csize(header);
- off_t offset = zzip_file_header_to_data(header);
+ size_t offset = zzip_file_header_sizeto_end(header);
if (csize == 0xFFFFu) {
struct zzip_extra_zip64* zip64 =
zzip_file_header_to_extras(header);
@@ -682,7 +682,7 @@ zzip_disk_entry_fopen(ZZIP_DISK * disk, ZZIP_DISK_ENTR
file->zlib.zalloc = Z_NULL;
file->zlib.zfree = Z_NULL;
file->zlib.avail_in = csize;
- file->zlib.next_in = offset;
+ file->zlib.next_in = (Bytef *)header + offset;
____;

DBG2("compressed size %i", (int) file->zlib.avail_in);

0 comments on commit 76a985c

Please sign in to comment.