diff --git a/calma/CalmaWrite.c b/calma/CalmaWrite.c index 749d1bce..67c28cec 100644 --- a/calma/CalmaWrite.c +++ b/calma/CalmaWrite.c @@ -44,6 +44,7 @@ static const char rcsid[] __attribute__ ((unused)) ="$Header: /usr/cvsroot/magic #include "utils/geometry.h" #include "tiles/tile.h" #include "utils/utils.h" +#include "utils/magic_zlib.h" #include "utils/hash.h" #include "database/database.h" #include "database/databaseInt.h" diff --git a/calma/CalmaWriteZ.c b/calma/CalmaWriteZ.c index 886743db..bb58ec53 100644 --- a/calma/CalmaWriteZ.c +++ b/calma/CalmaWriteZ.c @@ -54,6 +54,7 @@ static const char rcsid[] __attribute__ ((unused)) ="$Header: /usr/cvsroot/magic #include "utils/geometry.h" #include "tiles/tile.h" #include "utils/utils.h" +#include "utils/magic_zlib.h" #include "utils/hash.h" #include "database/database.h" #include "database/databaseInt.h" diff --git a/commands/CmdCD.c b/commands/CmdCD.c index 7ba4458d..5882e2f4 100644 --- a/commands/CmdCD.c +++ b/commands/CmdCD.c @@ -37,6 +37,7 @@ static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magi #include "utils/main.h" #include "commands/commands.h" #include "utils/utils.h" +#include "utils/magic_zlib.h" #include "textio/textio.h" #include "drc/drc.h" #include "graphics/graphics.h" diff --git a/database/DBio.c b/database/DBio.c index bf5238c5..9f707de8 100644 --- a/database/DBio.c +++ b/database/DBio.c @@ -60,6 +60,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include "utils/geometry.h" #include "tiles/tile.h" #include "utils/utils.h" +#include "utils/magic_zlib.h" #include "utils/hash.h" #include "database/database.h" #include "database/databaseInt.h" diff --git a/utils/flock.c b/utils/flock.c index 56b44258..e5e98f66 100644 --- a/utils/flock.c +++ b/utils/flock.c @@ -23,6 +23,7 @@ #include "database/database.h" #include "windows/windows.h" #include "utils/malloc.h" +#include "utils/magic_zlib.h" /* C99 compat */ #include "textio/textio.h" diff --git a/utils/magic_zlib.h b/utils/magic_zlib.h new file mode 100644 index 00000000..a052b99b --- /dev/null +++ b/utils/magic_zlib.h @@ -0,0 +1,39 @@ +/* zlib.h -- + * + * Routines relating to the external dependency zlib + * + * ********************************************************************* + * * Copyright (C) 2022, 2024 Regents of the University of California. * + * * Permission to use, copy, modify, and distribute this * + * * software and its documentation for any purpose and without * + * * fee is hereby granted, provided that the above copyright * + * * notice appear in all copies. The University of California * + * * makes no representations about the suitability of this * + * * software for any purpose. It is provided "as is" without * + * * express or implied warranty. Export of this software outside * + * * of the United States of America may require an export license. * + * ********************************************************************* + * + * rcsid="$Header" + */ + +#ifndef _MAGIC__UTILS__MAGIC_ZLIB_H +#define _MAGIC__UTILS__MAGIC_ZLIB_H + +#ifdef HAVE_ZLIB + +#include + +extern gzFile PaZOpen(const char *file, const char *mode, const char *ext, const char *path, const char *library, + char **pRealName); +extern gzFile PaLockZOpen(const char *file, const char *mode, const char *ext, const char *path, const char *library, + char **pRealName, bool *is_locked, int *fdp); +extern char *PaCheckCompressed(const char *filename); + +#ifdef FILE_LOCKS +extern gzFile flock_zopen(); +#endif + +#endif + +#endif /* _MAGIC__UTILS__MAGIC_ZLIB_H */ diff --git a/utils/path.c b/utils/path.c index 3f1bfd62..decc84f3 100644 --- a/utils/path.c +++ b/utils/path.c @@ -40,6 +40,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include "utils/hash.h" #include "utils/malloc.h" #include "utils/utils.h" +#include "utils/magic_zlib.h" /* Library routines: */ diff --git a/utils/utils.h b/utils/utils.h index 846507f8..4067d0e0 100644 --- a/utils/utils.h +++ b/utils/utils.h @@ -21,12 +21,8 @@ #ifndef _UTILS_H #define _UTILS_H 1 -#ifdef HAVE_ZLIB -#include -#endif - -#include "utils/tech.h" #include "utils/magic.h" +#include "utils/tech.h" /* * Cast second argument to LookupStruct() to (LookupTable *) to @@ -76,21 +72,10 @@ extern void SetNoisyInt(int *parm, const char *valueS, FILE *file); extern void SetNoisyDI(dlong *parm, const char *valueS, FILE *file); extern bool ParsSplit(); -#ifdef HAVE_ZLIB -extern gzFile PaZOpen(const char *file, const char *mode, const char *ext, const char *path, const char *library, - char **pRealName); -extern gzFile PaLockZOpen(const char *file, const char *mode, const char *ext, const char *path, const char *library, - char **pRealName, bool *is_locked, int *fdp); -extern char *PaCheckCompressed(const char *filename); -#endif - extern int SetNoisyBool(bool *parm, const char *valueS, FILE *file); #ifdef FILE_LOCKS extern FILE *flock_open(); -#ifdef HAVE_ZLIB -extern gzFile flock_zopen(); -#endif #endif /* The following macro takes an integer and returns another integer that