diff options
author | Mike Frysinger <vapier@gmail.com> | 2013-06-20 23:34:15 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gmail.com> | 2013-06-20 23:34:15 +0000 |
commit | 5f2e8c5430ca4e171c89d740f45e1e1427e45c66 (patch) | |
tree | afd0f8f5bc36ff50679d37ceeb12bf880f93e66d | |
parent | 4e3184e56f6bc32c4229f3216a8d88784fd591ee (diff) | |
download | cracklib-5f2e8c5430ca4e171c89d740f45e1e1427e45c66.tar.gz |
deal with newer zlib and build time warnings
The cracklib packer does things like:
#ifdef HAVE_ZLIB_H
if (pdesc.flags & PFOR_USEZLIB)
gzclose(pdesc.dfp);
else
#endif
fclose(pdesc.dfp);
Where dfp and such are FILE* pointers. with newer zlib, we see warnings like:
packlib.c: In function 'PWOpen':
packlib.c:128:4: warning: passing argument 1 of 'gzclose' from incompatible
pointer type [enabled by default]
In file included from packlib.c:11:0:
/usr/include/zlib.h:1511:12: note: expected 'gzFile' but argument is of type
'struct FILE *'
packlib.c:165:4: warning: passing argument 1 of 'gzclose' from incompatible
pointer type [enabled by default]
This is because gzopen/gzclose use gzFile rather than FILE*.
Pne way to fix this would be to add (void*) casts to all zlib related funcs,
but that sucks. We could change these to unions like so:
typedef struct
{
union {
FILE *fp;
gzFile *gfp;
} dfp;
But that sucks because we'd have to update all the call points to use the
right union member. Another idea (which also sucks, but maybe less so) is to
change the pointer type to void*. This patch takes that route.
git-svn-id: file:///tmp/cracklib-svn/trunk@224 4175fe1e-86d5-4fdc-8e6a-506fab9d8533
-rw-r--r-- | cracklib/lib/packer.h | 7 | ||||
-rw-r--r-- | cracklib/lib/packlib.c | 12 |
2 files changed, 10 insertions, 9 deletions
diff --git a/cracklib/lib/packer.h b/cracklib/lib/packer.h index d1b9bb4..d7584b3 100644 --- a/cracklib/lib/packer.h +++ b/cracklib/lib/packer.h @@ -52,9 +52,10 @@ struct pi_header typedef struct { - FILE *ifp; - FILE *dfp; - FILE *wfp; + /* Might be FILE* or gzFile */ + void *ifp; + void *dfp; + void *wfp; uint32_t flags; #define PFOR_WRITE 0x0001 diff --git a/cracklib/lib/packlib.c b/cracklib/lib/packlib.c index 5ec5351..20b1388 100644 --- a/cracklib/lib/packlib.c +++ b/cracklib/lib/packlib.c @@ -34,9 +34,9 @@ struct pi_header64 typedef struct { - FILE *ifp; - FILE *dfp; - FILE *wfp; + void *ifp; + void *dfp; + void *wfp; uint64_t flags; uint64_t hwms[256]; struct pi_header64 header; @@ -72,9 +72,9 @@ PWOpen(prefix, mode) char iname[STRINGSIZE]; char dname[STRINGSIZE]; char wname[STRINGSIZE]; - FILE *dfp; - FILE *ifp; - FILE *wfp; + void *dfp; + void *ifp; + void *wfp; if (pdesc.header.pih_magic == PIH_MAGIC) { |