Testing if the zzip_read is the old (with char *) or new

(with void *) version. When the old one is detected we
cast the second parameter to char *
This commit is contained in:
yabause 2009-04-30 19:31:35 +00:00
parent be5cc2152c
commit 243f7cd58c
2 changed files with 15 additions and 1 deletions

View File

@ -34,7 +34,17 @@ dnl - Check for zlib
AC_CHECK_LIB(z, gzopen, [], [AC_MSG_ERROR([zlib was not found, we can't go further. Please install it or specify the location where it's installed.])])
dnl - Check for zziplib
AC_CHECK_LIB(zzip, zzip_open)
AC_CHECK_LIB(zzip, zzip_open, [
LIBS="-lzzip $LIBS"
AC_DEFINE([HAVE_LIBZZIP])
AC_MSG_CHECKING([[whether zzip use void * as second parameter]])
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <zzip/lib.h>]], [[
void * v;
zzip_read(NULL, v, 0);]]),
AC_MSG_RESULT(yes),
AC_DEFINE([ZZIP_OLD_READ])
AC_MSG_RESULT(no))
])
dnl - Check for SDL
AC_PATH_PROGS(SDLCONFIG, [sdl-config sdl11-config])

View File

@ -227,6 +227,10 @@ int ZIPROMReaderSeek(void * file, int offset, int whence)
int ZIPROMReaderRead(void * file, void * buffer, u32 size)
{
#ifdef ZZIP_OLD_READ
return zzip_read((ZZIP_FILE*)file, (char *) buffer, size);
#else
return zzip_read((ZZIP_FILE*)file, buffer, size);
#endif
}
#endif