configure.in:

make zlib enabled by default
common/nozip.h:
	swap the size and count params to f{read,write} to prevent demo code
	breaking
common/quakefs.c:
	if zlib is unavailable, there is no point in supporting the .gz
	extension
This commit is contained in:
Bill Currie 2000-02-03 21:44:46 +00:00
parent 218d2fcb9b
commit 0a46c1d979
3 changed files with 12 additions and 5 deletions

View File

@ -27,8 +27,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HAS_ZLIB
#define gzFile FILE
#define gzdopen fdopen
#define gzread(F, BUF, LEN) fread(BUF, LEN, 1, F)
#define gzwrite(F, BUF, LEN) fwrite(BUF, LEN, 1, F)
#define gzread(F, BUF, LEN) fread(BUF, 1, LEN, F)
#define gzwrite(F, BUF, LEN) fwrite(BUF, 1, LEN, F)
/* #define gzwrite(F, BUF, SIZE,LEN) fwrite( */
#define gzflush(FILE, VAL) fflush(FILE)
#define gzprintf fprintf

View File

@ -310,10 +310,12 @@ int COM_FOpenFile (char *filename, gzFile **gzfile)
pack_t *pak;
int i;
int findtime;
#ifdef HAS_ZLIB
char gzfilename[MAX_OSPATH];
strncpy(gzfilename,filename,sizeof(gzfilename));
strncat(gzfilename,".gz",sizeof(gzfilename));
#endif
file_from_pak = 0;
@ -331,8 +333,10 @@ int COM_FOpenFile (char *filename, gzFile **gzfile)
char *fn=0;
if (!strcmp (pak->files[i].name, filename))
fn=filename;
#ifdef HAS_ZLIB
else if (!strcmp (pak->files[i].name, gzfilename))
fn=gzfilename;
#endif
if (fn)
{ // found it!
if(developer.value)
@ -358,10 +362,12 @@ int COM_FOpenFile (char *filename, gzFile **gzfile)
findtime = Sys_FileTime (netpath);
if (findtime == -1) {
#ifdef HAS_ZLIB
snprintf(netpath, sizeof(netpath), "%s/%s",search->filename,
gzfilename);
findtime = Sys_FileTime (netpath);
if (findtime == -1)
#endif
continue;
}

View File

@ -97,7 +97,7 @@ AC_ARG_ENABLE(alsa,
)
AC_ARG_ENABLE(zlib,
[ --enable-zlib enable zlib support],
[ --disable-zlib disable zlib support],
)
dnl Checks for stricmp/strcasecmp
@ -122,8 +122,9 @@ fi
dnl Checks for working -lm
AC_CHECK_LIB(m, pow,, AC_MSG_ERROR([math library (-lm) appears broken]))
if test "x$enable_zlib" = "xyes"; then
echo $enable_zlib
if test "x$enable_zlib" != "xno"; then
dnl Check for working -lz
dnl Note - must have gztell *and* gzgets in -lz *and* zlib.h
AC_CHECK_LIB(z, gztell, HAS_ZLIB=yes, HAS_ZLIB=no, [$LIBS])