]> granicus.if.org Git - zziplib/commitdiff
zzip: fseeko: fix signedness mismatch with `file->avail`
authorPatrick Steinhardt <ps@pks.im>
Tue, 21 May 2019 11:19:39 +0000 (13:19 +0200)
committerPatrick Steinhardt <ps@pks.im>
Thu, 1 Aug 2019 06:33:34 +0000 (08:33 +0200)
While the `avail` field of `struct zzip_entry_file` is of unsigned type
`zzip_size_t`, we assign it to a local variable of `zzip_off_t` in
`zzip_entry_fopen`, which is of signed type. This causes the compiler to
emit a warning due to signedness when comparing it with
`sizeof(file->buffer)`.

Fix this by using the correct type for the local variable.

zzip/fseeko.c

index 337949276061cca2c85a3a3f3881062c08bc774e..50d4a957382b962c2712b438f314ac3e663bc9a5 100644 (file)
@@ -712,7 +712,7 @@ zzip_entry_fopen(ZZIP_ENTRY * entry, int takeover)
     file->zlib.zalloc = Z_NULL;
     file->zlib.zfree = Z_NULL;
 
-    ___ zzip_off_t size = file->avail;
+    ___ zzip_size_t size = file->avail;
     if (size > sizeof(file->buffer))
         size = sizeof(file->buffer);
     if (fseeko(file->entry->diskfile, file->data + file->dataoff, SEEK_SET) == -1)