notaz.gp2x.de
/
picodrive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix a name clash with newer zlib
[picodrive.git]
/
pico
/
cart.c
diff --git
a/pico/cart.c
b/pico/cart.c
index
a5c563d
..
25a847d
100644
(file)
--- a/
pico/cart.c
+++ b/
pico/cart.c
@@
-50,7
+50,7
@@
typedef struct _cso_struct
}
\r
cso_struct;
\r
\r
}
\r
cso_struct;
\r
\r
-static int uncompress
2
(void *dest, int destLen, void *source, int sourceLen)
\r
+static int uncompress
_buf
(void *dest, int destLen, void *source, int sourceLen)
\r
{
\r
z_stream stream;
\r
int err;
\r
{
\r
z_stream stream;
\r
int err;
\r
@@
-100,6
+100,7
@@
pm_file *pm_open(const char *path)
return NULL;
\r
\r
ext = get_ext(path);
\r
return NULL;
\r
\r
ext = get_ext(path);
\r
+#ifndef NO_ZLIB
\r
if (strcasecmp(ext, "zip") == 0)
\r
{
\r
struct zipent *zipentry;
\r
if (strcasecmp(ext, "zip") == 0)
\r
{
\r
struct zipent *zipentry;
\r
@@
-149,7
+150,9
@@
zip_failed:
return NULL;
\r
}
\r
}
\r
return NULL;
\r
}
\r
}
\r
- else if (strcasecmp(ext, "cso") == 0)
\r
+ else
\r
+#endif
\r
+ if (strcasecmp(ext, "cso") == 0)
\r
{
\r
cso_struct *cso = NULL, *tmp = NULL;
\r
int size;
\r
{
\r
cso_struct *cso = NULL, *tmp = NULL;
\r
int size;
\r
@@
-244,6
+247,7
@@
size_t pm_read(void *ptr, size_t bytes, pm_file *stream)
{
\r
ret = fread(ptr, 1, bytes, stream->file);
\r
}
\r
{
\r
ret = fread(ptr, 1, bytes, stream->file);
\r
}
\r
+#ifndef NO_ZLIB
\r
else if (stream->type == PMT_ZIP)
\r
{
\r
gzFile gf = stream->param;
\r
else if (stream->type == PMT_ZIP)
\r
{
\r
gzFile gf = stream->param;
\r
@@
-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 */
\r
gzrewind(gf);
\r
}
\r
/* we must reset stream pointer or else next seek/read fails */
\r
gzrewind(gf);
\r
}
\r
+#endif
\r
else if (stream->type == PMT_CSO)
\r
{
\r
cso_struct *cso = stream->param;
\r
else if (stream->type == PMT_CSO)
\r
{
\r
cso_struct *cso = stream->param;
\r
@@
-293,7
+298,7
@@
size_t pm_read(void *ptr, size_t bytes, pm_file *stream)
}
\r
cso->block_in_buff = block;
\r
}
\r
}
\r
cso->block_in_buff = block;
\r
}
\r
- rret = uncompress
2
(tmp_dst, 2048, cso->in_buff, read_len);
\r
+ rret = uncompress
_buf
(tmp_dst, 2048, cso->in_buff, read_len);
\r
if (rret != 0) {
\r
elprintf(EL_STATUS, "cso: uncompress failed @ %08x with %i", read_pos, rret);
\r
break;
\r
if (rret != 0) {
\r
elprintf(EL_STATUS, "cso: uncompress failed @ %08x with %i", read_pos, rret);
\r
break;
\r
@@
-329,6
+334,7
@@
int pm_seek(pm_file *stream, long offset, int whence)
fseek(stream->file, offset, whence);
\r
return ftell(stream->file);
\r
}
\r
fseek(stream->file, offset, whence);
\r
return ftell(stream->file);
\r
}
\r
+#ifndef NO_ZLIB
\r
else if (stream->type == PMT_ZIP)
\r
{
\r
if (PicoMessage != NULL && offset > 6*1024*1024) {
\r
else if (stream->type == PMT_ZIP)
\r
{
\r
if (PicoMessage != NULL && offset > 6*1024*1024) {
\r
@@
-338,6
+344,7
@@
int pm_seek(pm_file *stream, long offset, int whence)
}
\r
return gzseek((gzFile) stream->param, offset, whence);
\r
}
\r
}
\r
return gzseek((gzFile) stream->param, offset, whence);
\r
}
\r
+#endif
\r
else if (stream->type == PMT_CSO)
\r
{
\r
cso_struct *cso = stream->param;
\r
else if (stream->type == PMT_CSO)
\r
{
\r
cso_struct *cso = stream->param;
\r
@@
-363,6
+370,7
@@
int pm_close(pm_file *fp)
{
\r
fclose(fp->file);
\r
}
\r
{
\r
fclose(fp->file);
\r
}
\r
+#ifndef NO_ZLIB
\r
else if (fp->type == PMT_ZIP)
\r
{
\r
ZIP *zipfile = fp->file;
\r
else if (fp->type == PMT_ZIP)
\r
{
\r
ZIP *zipfile = fp->file;
\r
@@
-370,6
+378,7
@@
int pm_close(pm_file *fp)
zipfile->fp = NULL; // gzclose() closed it
\r
closezip(zipfile);
\r
}
\r
zipfile->fp = NULL; // gzclose() closed it
\r
closezip(zipfile);
\r
}
\r
+#endif
\r
else if (fp->type == PMT_CSO)
\r
{
\r
free(fp->param);
\r
else if (fp->type == PMT_CSO)
\r
{
\r
free(fp->param);
\r