From: Frode Solheim Date: Tue, 29 Jul 2014 21:58:41 +0000 (+0200) Subject: zarchive: mostly compilation warning fixes X-Git-Tag: 3000~95^2 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=a1cea3ba45f4353013e317dd420da9e188f4551a;p=francis%2Fwinuae.git zarchive: mostly compilation warning fixes --- diff --git a/include/zarchive.h b/include/zarchive.h index c4458a8a..c79ecd0d 100644 --- a/include/zarchive.h +++ b/include/zarchive.h @@ -84,19 +84,21 @@ struct zarchive_info struct mytimeval tv; }; -#define ArchiveFormat7Zip '7z ' -#define ArchiveFormatRAR 'rar ' -#define ArchiveFormatZIP 'zip ' -#define ArchiveFormatLHA 'lha ' -#define ArchiveFormatLZX 'lzx ' -#define ArchiveFormatPLAIN '----' -#define ArchiveFormatDIR 'DIR ' -#define ArchiveFormatAA 'aa ' // method only -#define ArchiveFormatADF 'DOS ' -#define ArchiveFormatRDB 'RDSK' -#define ArchiveFormatMBR 'MBR ' -#define ArchiveFormatFAT 'FAT ' -#define ArchiveFormatTAR 'tar ' +#define MCC(a,b,c,d) (((a)<<24) | ((b)<<16) | ((c)<<8) | (d)) + +#define ArchiveFormat7Zip MCC('7', 'z', ' ', ' ') +#define ArchiveFormatRAR MCC('r', 'a', 'r', ' ') +#define ArchiveFormatZIP MCC('z', 'i', 'p', ' ') +#define ArchiveFormatLHA MCC('l', 'h', 'a', ' ') +#define ArchiveFormatLZX MCC('l', 'z', 'x', ' ') +#define ArchiveFormatPLAIN MCC('-', '-', '-', '-') +#define ArchiveFormatDIR MCC('D', 'I', 'R', ' ') +#define ArchiveFormatAA MCC('a', 'a', ' ', ' ') // method only +#define ArchiveFormatADF MCC('D', 'O', 'S', ' ') +#define ArchiveFormatRDB MCC('R', 'D', 'S', 'K') +#define ArchiveFormatMBR MCC('M', 'B', 'R', ' ') +#define ArchiveFormatFAT MCC('F', 'A', 'T', ' ') +#define ArchiveFormatTAR MCC('t', 'a', 'r', ' ') #define PEEK_BYTES 1024 #define FILE_PEEK 1 diff --git a/zfile_archive.cpp b/zfile_archive.cpp index 0b87b607..3f26ddbf 100644 --- a/zfile_archive.cpp +++ b/zfile_archive.cpp @@ -26,7 +26,7 @@ #define unpack_log write_log #undef unpack_log -#define unpack_log +#define unpack_log(fmt, ...) static time_t fromdostime (uae_u32 dd) @@ -1164,6 +1164,7 @@ static uae_u32 gwx (uae_u8 *p) static const int secs_per_day = 24 * 60 * 60; static const int diff = (8 * 365 + 2) * (24 * 60 * 60); static const int diff2 = (-8 * 365 - 2) * (24 * 60 * 60); + static time_t put_time (long days, long mins, long ticks) { time_t t; @@ -1259,7 +1260,6 @@ static void recursesfs (struct znode *zn, int root, TCHAR *name, int sfs2) struct zvolume *zv = zn->volume; struct adfhandle *adf = (struct adfhandle*)zv->handle; TCHAR name2[MAX_DPATH]; - int bs = adf->blocksize; int block; uae_u8 *p, *s; struct zarchive_info zai; @@ -1368,7 +1368,7 @@ struct zvolume *archive_directory_adf (struct znode *parent, struct zfile *z) goto fail; adf->dostype = gl (adf, 0); - if ((adf->dostype & 0xffffff00) == 'DOS\0') { + if ((adf->dostype & 0xffffff00) == MCC('D', 'O', 'S', '\0')) { int bs = adf->blocksize; int res; @@ -1420,7 +1420,7 @@ struct zvolume *archive_directory_adf (struct znode *parent, struct zfile *z) name[0] = 0; recurseadf (&zv->root, adf->rootblock, name); - } else if ((adf->dostype & 0xffffff00) == 'SFS\0') { + } else if ((adf->dostype & 0xffffff00) == MCC('S', 'F', 'S', '\0')) { uae_u16 version, sfs2; @@ -1433,14 +1433,14 @@ struct zvolume *archive_directory_adf (struct znode *parent, struct zfile *z) adf->rootblock = gl (adf, 104); if (!adf_read_block (adf, adf->rootblock)) break; - if (gl (adf, 0) != 'OBJC') + if (gl (adf, 0) != MCC('O', 'B', 'J', 'C')) break; if (sfs_checksum (adf->block, adf->blocksize, sfs2)) break; adf->rootblock = gl (adf, 40); if (!adf_read_block (adf, adf->rootblock)) break; - if (gl (adf, 0) != 'OBJC') + if (gl (adf, 0) != MCC('O', 'B', 'J', 'C')) break; if (sfs_checksum (adf->block, adf->blocksize, sfs2)) break; @@ -1551,7 +1551,7 @@ static struct zfile *archive_access_adf (struct znode *zn) if (!z) return NULL; - if ((adf->dostype & 0xffffff00) == 'DOS\0') { + if ((adf->dostype & 0xffffff00) == MCC('D', 'O', 'S', '\0')) { ffs = adf->dostype & 1; root = zn->offset; @@ -1577,7 +1577,7 @@ static struct zfile *archive_access_adf (struct znode *zn) break; root = gl (adf, bs - 2 * 4); } - } else if ((adf->dostype & 0xffffff00) == 'SFS\0') { + } else if ((adf->dostype & 0xffffff00) == MCC('S', 'F', 'S', '\0')) { struct sfsblock *sfsblocks; int sfsblockcnt, sfsmaxblockcnt, i; @@ -1738,7 +1738,7 @@ struct zvolume *archive_directory_rdb (struct zfile *z) zfile_fseek (z, 0, SEEK_SET); p = buf; zfile_fread (buf, 1, 512, z); - zai.name = _T("rdb_dump.dat"); + zai.name = my_strdup(_T("rdb_dump.dat")); bs = rl (p + 16); zai.size = rl (p + 140) * bs; zai.comment = NULL; @@ -1904,7 +1904,7 @@ static int getcluster (struct zfile *z, int cluster, int fatstart, int fatbits) return fat; } -static void fatdirectory (struct zfile *z, struct zvolume *zv, TCHAR *name, int startblock, int entries, int sectorspercluster, int fatstart, int dataregion, int fatbits) +static void fatdirectory (struct zfile *z, struct zvolume *zv, const TCHAR *name, int startblock, int entries, int sectorspercluster, int fatstart, int dataregion, int fatbits) { struct zarchive_info zai; struct znode *znnew;