Browse Source

filesystem: zip: remove XASH_ZLIB macro

pull/2/head
Mr0maks 6 years ago
parent
commit
b04a48f126
  1. 33
      engine/common/filesystem.c

33
engine/common/filesystem.c

@ -16,6 +16,7 @@ GNU General Public License for more details. @@ -16,6 +16,7 @@ GNU General Public License for more details.
#include <fcntl.h>
#include <sys/stat.h>
#include <time.h>
#include <zlib.h>
#ifdef _WIN32
#include <direct.h>
#include <io.h>
@ -33,10 +34,6 @@ GNU General Public License for more details. @@ -33,10 +34,6 @@ GNU General Public License for more details.
#define FILE_COPY_SIZE (1024 * 1024)
#define FILE_BUFF_SIZE (2048)
#ifdef XASH_ZLIB
#include <zlib.h>
#endif
// PAK errors
#define PAK_LOAD_OK 0
#define PAK_LOAD_COULDNT_OPEN 1
@ -63,8 +60,6 @@ GNU General Public License for more details. @@ -63,8 +60,6 @@ GNU General Public License for more details.
#define ZIP_LOAD_NO_FILES 5
#define ZIP_LOAD_CORRUPTED 6
typedef struct stringlist_s
{
// maxstrings changes as needed, causing reallocation of strings[] array
@ -693,7 +688,9 @@ static zip_t *FS_LoadZip( const char *zipfile, int *error ) @@ -693,7 +688,9 @@ static zip_t *FS_LoadZip( const char *zipfile, int *error )
Zip_Close( zip );
return NULL;
}
if( signature != ZIP_HEADER_LF ) {
if( signature != ZIP_HEADER_LF )
{
Con_Reportf( "%s is not a zip file. Ignored.\n", zipfile );
if( error )
*error = ZIP_LOAD_BAD_HEADER;
@ -858,8 +855,9 @@ static byte *Zip_LoadFile( const char *path, fs_offset_t *sizeptr, qboolean game @@ -858,8 +855,9 @@ static byte *Zip_LoadFile( const char *path, fs_offset_t *sizeptr, qboolean game
return buffer;
}
#ifdef XASH_ZLIB
if( header.compression_flags == ZIP_COMPRESSION_DEFLATED ) {
if( header.compression_flags == ZIP_COMPRESSION_DEFLATED )
{
if( header.filename_len )
FS_Seek( search->zip->handle, header.filename_len, SEEK_CUR );
@ -901,26 +899,25 @@ static byte *Zip_LoadFile( const char *path, fs_offset_t *sizeptr, qboolean game @@ -901,26 +899,25 @@ static byte *Zip_LoadFile( const char *path, fs_offset_t *sizeptr, qboolean game
return NULL;
}
if( sizeptr ) *sizeptr = file->size;
return decompresed_buffer;
} else if( zlib_result == Z_DATA_ERROR ){
Con_Reportf( S_ERROR "Zip_LoadFile: %s : compressed files data corrupted.\n", file->name );
} else if( zlib_result == Z_DATA_ERROR )
{
Con_Reportf( S_ERROR "Zip_LoadFile: %s : compressed file data corrupted.\n", file->name );
Mem_Free( compresed_buffer );
Mem_Free( decompresed_buffer );
return NULL;
}
} else {
} else
{
Con_Reportf( S_ERROR "Zip_LoadFile: %s : file compressed with unknown algorithm.\n", file->name );
return NULL;
}
#else
else {
Con_Reportf( S_ERROR "Zip_LoadFile: %s : compressed files not supported.\n", file->name );
return NULL;
}
#endif
}
return NULL;

Loading…
Cancel
Save