From: Frode Solheim Date: Fri, 4 Sep 2015 22:24:49 +0000 (+0200) Subject: zfile.cpp: trivial changes X-Git-Tag: 3200~89^2~5 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=e96f44e306af4fea01bdaf37bb50d985a295774c;p=francis%2Fwinuae.git zfile.cpp: trivial changes --- diff --git a/zfile.cpp b/zfile.cpp index 2ca665d4..e530bfbc 100644 --- a/zfile.cpp +++ b/zfile.cpp @@ -244,7 +244,7 @@ void zfile_fclose (struct zfile *f) pl->next = nxt; } -static void removeext (TCHAR *s, TCHAR *ext) +static void removeext (TCHAR *s, const TCHAR *ext) { if (_tcslen (s) < _tcslen (ext)) return; @@ -264,7 +264,7 @@ static bool checkwrite (struct zfile *zf, int *retcode) static uae_u8 exeheader[]={ 0x00,0x00,0x03,0xf3,0x00,0x00,0x00,0x00 }; -static TCHAR *diskimages[] = { _T("adf"), _T("adz"), _T("ipf"), _T("scp"), _T("fdi"), _T("dms"), _T("wrp"), _T("dsq"), _T("pkd"), _T("ima"), 0 }; +static const TCHAR *diskimages[] = { _T("adf"), _T("adz"), _T("ipf"), _T("scp"), _T("fdi"), _T("dms"), _T("wrp"), _T("dsq"), _T("pkd"), _T("ima"), 0 }; int zfile_gettype (struct zfile *z) { @@ -1329,7 +1329,9 @@ static const TCHAR *archive_extensions[] = { NULL }; static const TCHAR *plugins_7z[] = { _T("7z"), _T("rar"), _T("zip"), _T("lha"), _T("lzh"), _T("lzx"), _T("adf"), _T("dsq"), _T("hdf"), _T("tar"), NULL }; +#if defined(ARCHIVEACCESS) static const uae_char *plugins_7z_x[] = { "7z", "Rar!", "MK", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; +#endif static const int plugins_7z_t[] = { ArchiveFormat7Zip, ArchiveFormatRAR, ArchiveFormatZIP, ArchiveFormatLHA, ArchiveFormatLHA, ArchiveFormatLZX, ArchiveFormatADF, ArchiveFormatADF, ArchiveFormatADF, ArchiveFormatTAR @@ -1339,12 +1341,11 @@ static const int plugins_7z_m[] = { ZFD_ADF, ZFD_ADF, ZFD_ADF, ZFD_ARCHIVE }; -int iszip (struct zfile *z, int mask) +static int iszip (struct zfile *z, int mask) { TCHAR *name = z->name; TCHAR *ext = _tcsrchr (name, '.'); uae_u8 header[32]; - int i; if (!ext) return 0; @@ -1409,7 +1410,7 @@ int iszip (struct zfile *z, int mask) } } #if defined(ARCHIVEACCESS) - for (i = 0; plugins_7z_x[i]; i++) { + for (int i = 0; plugins_7z_x[i]; i++) { if ((plugins_7z_m[i] & mask) && plugins_7z_x[i] && !strcasecmp (ext + 1, plugins_7z[i]) && !memcmp (header, plugins_7z_x[i], strlen (plugins_7z_x[i]))) return plugins_7z_t[i]; @@ -1427,7 +1428,6 @@ struct zfile *zuncompress (struct znode *parent, struct zfile *z, int dodefault, TCHAR *name = z->name; TCHAR *ext = NULL; uae_u8 header[32]; - int i; if (retcode) *retcode = 0; @@ -1490,7 +1490,7 @@ struct zfile *zuncompress (struct znode *parent, struct zfile *z, int dodefault, } #if defined(ARCHIVEACCESS) if (index == 0) { - for (i = 0; plugins_7z_x[i]; i++) { + for (int i = 0; plugins_7z_x[i]; i++) { if ((plugins_7z_t[i] & mask) && strcasecmp (ext, plugins_7z[i]) == 0) return archive_access_arcacc_select (z, plugins_7z_t[i], retcode); } @@ -2579,6 +2579,7 @@ static struct znode *znode_alloc_child (struct znode *parent, const TCHAR *name) zn->parent = parent; return zn; } + static struct znode *znode_alloc_sibling (struct znode *sibling, const TCHAR *name) { struct znode *zn = znode_alloc (sibling->parent, name); @@ -2652,14 +2653,17 @@ static struct zvolume *zvolume_alloc_2 (const TCHAR *name, struct zfile *z, unsi } return zv; } + struct zvolume *zvolume_alloc (struct zfile *z, unsigned int id, void *handle, const TCHAR *volumename) { return zvolume_alloc_2 (zfile_getname (z), z, id, handle, volumename); } -struct zvolume *zvolume_alloc_nofile (const TCHAR *name, unsigned int id, void *handle, const TCHAR *volumename) + +static struct zvolume *zvolume_alloc_nofile (const TCHAR *name, unsigned int id, void *handle, const TCHAR *volumename) { return zvolume_alloc_2 (name, NULL, id, handle, volumename); } + struct zvolume *zvolume_alloc_empty (struct zvolume *prev, const TCHAR *name) { struct zvolume *zv = zvolume_alloc_2(name, 0, 0, 0, NULL); @@ -3022,7 +3026,7 @@ struct znode *zvolume_adddir_abs (struct zvolume *zv, struct zarchive_info *zai) struct znode *zvolume_addfile_abs (struct zvolume *zv, struct zarchive_info *zai) { - struct znode *zn, *zn2; + struct znode *zn = NULL, *zn2; int i; TCHAR *path = my_strdup (zai->name); TCHAR *p, *p2; @@ -3052,7 +3056,7 @@ struct znode *zvolume_addfile_abs (struct zvolume *zv, struct zarchive_info *zai return zn; } -struct zvolume *zfile_fopen_directory (const TCHAR *dirname) +static struct zvolume *zfile_fopen_directory (const TCHAR *dirname) { struct zvolume *zv = NULL; struct my_opendir_s *dir; @@ -3291,7 +3295,7 @@ int zfile_readdir_archive (struct zdirectory *zd, TCHAR *out, bool fullpath) return 0; if (zd->filenames == NULL) { struct znode *n = zd->first; - int cnt = 0, len = 0; + int cnt = 0; while (n) { cnt++; n = n->sibling;