(PS3) We shouldn't compile in zlib code in a core period -

compile out zlib parts with NO_ZLIB ifdef for PSP and PS3
This commit is contained in:
twinaphex 2014-03-04 06:32:04 +01:00
parent 0877c7ddb6
commit 7eaf128fac
3 changed files with 15 additions and 2 deletions

View File

@ -157,8 +157,8 @@ ifneq "$(DONT_COMPILE_IN_ZLIB)" "1"
OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \
zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o zlib/uncompr.o
# unzip
endif
OBJS += unzip/unzip.o unzip/unzip_stream.o
endif
include platform/common/common.mak

View File

@ -193,6 +193,10 @@ else
CFLAGS += -D__WIN32__ -D__WIN32_LIBRETRO__
endif
ifeq ($(DONT_COMPILE_IN_ZLIB),1)
CFLAGS += -DNO_ZLIB
endif
ifeq ($(NO_MMAP),1)
CFLAGS += -DNO_MMAP
endif

View File

@ -100,6 +100,7 @@ pm_file *pm_open(const char *path)
return NULL;
ext = get_ext(path);
#ifndef NO_ZLIB
if (strcasecmp(ext, "zip") == 0)
{
struct zipent *zipentry;
@ -149,7 +150,9 @@ zip_failed:
return NULL;
}
}
else if (strcasecmp(ext, "cso") == 0)
else
#endif
if (strcasecmp(ext, "cso") == 0)
{
cso_struct *cso = NULL, *tmp = NULL;
int size;
@ -244,6 +247,7 @@ size_t pm_read(void *ptr, size_t bytes, pm_file *stream)
{
ret = fread(ptr, 1, bytes, stream->file);
}
#ifndef NO_ZLIB
else if (stream->type == PMT_ZIP)
{
gzFile gf = stream->param;
@ -254,6 +258,7 @@ size_t pm_read(void *ptr, size_t bytes, pm_file *stream)
/* we must reset stream pointer or else next seek/read fails */
gzrewind(gf);
}
#endif
else if (stream->type == PMT_CSO)
{
cso_struct *cso = stream->param;
@ -329,6 +334,7 @@ int pm_seek(pm_file *stream, long offset, int whence)
fseek(stream->file, offset, whence);
return ftell(stream->file);
}
#ifndef NO_ZLIB
else if (stream->type == PMT_ZIP)
{
if (PicoMessage != NULL && offset > 6*1024*1024) {
@ -338,6 +344,7 @@ int pm_seek(pm_file *stream, long offset, int whence)
}
return gzseek((gzFile) stream->param, offset, whence);
}
#endif
else if (stream->type == PMT_CSO)
{
cso_struct *cso = stream->param;
@ -363,6 +370,7 @@ int pm_close(pm_file *fp)
{
fclose(fp->file);
}
#ifndef NO_ZLIB
else if (fp->type == PMT_ZIP)
{
ZIP *zipfile = fp->file;
@ -370,6 +378,7 @@ int pm_close(pm_file *fp)
zipfile->fp = NULL; // gzclose() closed it
closezip(zipfile);
}
#endif
else if (fp->type == PMT_CSO)
{
free(fp->param);