]> granicus.if.org Git - cracklib/commit
deal with newer zlib and build time warnings
authorMike Frysinger <vapier@gmail.com>
Thu, 20 Jun 2013 23:34:15 +0000 (23:34 +0000)
committerMike Frysinger <vapier@gmail.com>
Thu, 20 Jun 2013 23:34:15 +0000 (23:34 +0000)
commit5f2e8c5430ca4e171c89d740f45e1e1427e45c66
treeafd0f8f5bc36ff50679d37ceeb12bf880f93e66d
parent4e3184e56f6bc32c4229f3216a8d88784fd591ee
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
cracklib/lib/packer.h
cracklib/lib/packlib.c