]> git.ipfire.org Git - thirdparty/zstd.git/commit
Fix zlibWrapper build 4021/head
authorPiotr Paweł Stefaniak <3462925+pstef@users.noreply.github.com>
Sun, 7 Apr 2024 11:04:26 +0000 (13:04 +0200)
committerPiotr Paweł Stefaniak <3462925+pstef@users.noreply.github.com>
Sun, 7 Apr 2024 11:04:26 +0000 (13:04 +0200)
commit71def598906637866f1b165bc9113defdd36983c
treee4799fc222403e318df93c44b2393c3fb95641d9
parent87af5fb2df7c68cc70c0901573767eea68399349
Fix zlibWrapper build

Just after a clone I'm getting this:

~/zstd/zlibWrapper$ cc -c zstd_zlibwrapper.o gz*.c -lz -lzstd -DSTDC
gzwrite.c: In function ‘gz_write’:
gzwrite.c:226:43: error: ‘z_uInt’ undeclared (first use in this
                         function); did you mean ‘uInt’?
  226 |             state.state->strm.avail_in = (z_uInt)n;
      |                                           ^~~~~~
      |                                           uInt
gzwrite.c:226:43: note: each undeclared identifier is reported only
                        once for each function it appears in
gzwrite.c:226:50: error: expected ‘;’ before ‘n’
  226 |             state.state->strm.avail_in = (z_uInt)n;
      |                                                  ^
      |                                                  ;

z_uInt is never used directly, zconf.h redefines uInt to z_uInt under
the condition that Z_PREFIX is set. All examples use uInt, and the type
of avail_in is also uInt.

In this commit I modify the cast to refer to the same type as the type
of lvalue.

Arguably, the real fix here is to handle possible overflows, but that's
beyond the scope of this commit.
zlibWrapper/gzwrite.c