From 0cb85de89b20f5163f15cc86ea9272d07cb004a1 Mon Sep 17 00:00:00 2001 From: molivier Date: Sat, 18 Dec 2004 08:12:38 +0000 Subject: [PATCH] - Fixed PK3 support for Mac OS X - DP no longer considers empty PK3s as invalid git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4854 d7cf8633-e32d-0410-b094-e92efae38249 --- fs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs.c b/fs.c index 82774b7a..218a85e4 100644 --- a/fs.c +++ b/fs.c @@ -354,6 +354,8 @@ qboolean PK3_OpenLibrary (void) #ifdef WIN32 dllname = "zlib.dll"; +#elif defined(MACOSX) + dllname = "libz.dylib"; #else dllname = "libz.so"; #endif @@ -543,7 +545,9 @@ int PK3_BuildFileList (pack_t *pack, const pk3_endOfCentralDir_t *eocd) remaining -= count; } - Mem_Free (central_dir); + // If the package is empty, central_dir is NULL here + if (central_dir != NULL) + Mem_Free (central_dir); return pack->numfiles; } @@ -602,7 +606,7 @@ pack_t *FS_LoadPackPK3 (const char *packfile) packlist = pack; real_nb_files = PK3_BuildFileList (pack, &eocd); - if (real_nb_files <= 0) + if (real_nb_files < 0) Sys_Error ("%s is not a valid PK3 file", packfile); Con_Printf("Added packfile %s (%i files)\n", packfile, real_nb_files); -- 2.39.2