X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Funzip.c;h=9e6c4a319da084861358dded1b59c20423bb5324;hb=2c98ddddf1eeb20fe90c3e9759ac77ec96dcbc97;hp=364f7c088b221f1d52accb5ed6bcde78191d0f76;hpb=fa566a2c8ec532eb5325b4d5a663fb2a7d72adc6;p=virtualjaguar diff --git a/src/unzip.c b/src/unzip.c index 364f7c0..9e6c4a3 100644 --- a/src/unzip.c +++ b/src/unzip.c @@ -1,12 +1,15 @@ // -// ZIP file support (mostly ripped from MAME) +// ZIP file support (mostly ripped from MAME--thx MAME team!) // // Added by James L. Hammons +// (C) 2010 Underground Software +// +// JLH = James L. Hammons +// +// Who When What +// --- ---------- ------------------------------------------------------------- +// JLH 01/16/2010 Created this log ;-) // - -#include "unzip.h" -//#include "driver.h" -#include "log.h" #include #include @@ -14,6 +17,9 @@ #include #include +#include "unzip.h" +#include "log.h" + /* public globals */ int gUnzipQuiet = 0; /* flag controls error messages */ @@ -42,17 +48,17 @@ void errormsg(const char * extmsg, const char * usermsg, const char * zipname) ------------------------------------------------------------------------- */ /* Use these to avoid structure padding and byte-ordering problems */ -static UINT16 read_word (char *buf) { +static uint16_t read_word (char *buf) { unsigned char *ubuf = (unsigned char *) buf; - return ((UINT16)ubuf[1] << 8) | (UINT16)ubuf[0]; + return ((uint16_t)ubuf[1] << 8) | (uint16_t)ubuf[0]; } /* Use these to avoid structure padding and byte-ordering problems */ -static UINT32 read_dword (char *buf) { +static uint32_t read_dword (char *buf) { unsigned char *ubuf = (unsigned char *) buf; - return ((UINT32)ubuf[3] << 24) | ((UINT32)ubuf[2] << 16) | ((UINT32)ubuf[1] << 8) | (UINT32)ubuf[0]; + return ((uint32_t)ubuf[3] << 24) | ((uint32_t)ubuf[2] << 16) | ((uint32_t)ubuf[1] << 8) | (uint32_t)ubuf[0]; } /* Locate end-of-central-dir sig in buffer and return offset @@ -465,8 +471,8 @@ int seekcompresszip(ZIP * zip, struct zipent * ent) } { - UINT16 filename_length = read_word(buf+ZIPFNLN); - UINT16 extra_field_length = read_word(buf+ZIPXTRALN); + uint16_t filename_length = read_word(buf+ZIPFNLN); + uint16_t extra_field_length = read_word(buf+ZIPXTRALN); // calculate offset to data and fseek() there offset = ent->offset_lcl_hdr_frm_frst_disk + ZIPNAME + filename_length + extra_field_length; @@ -830,7 +836,7 @@ static int equal_filename(const char * zipfile, const char * file) // buf will be set to point to the uncompressed image of that zipped file. // length will be set to the length of the uncompressed data. // -int load_zipped_file(int pathtype, int pathindex, const char * zipfile, const char * filename, unsigned char ** buf, uint32 * length) +int load_zipped_file(int pathtype, int pathindex, const char * zipfile, const char * filename, unsigned char ** buf, uint32_t * length) { ZIP * zip; struct zipent * ent;