mirror of
https://github.com/holub/mame
synced 2025-04-24 17:30:55 +03:00
[Imgtool] Bulk change: 'imgtool::directory *' ==> 'imgtool::directory &'
This commit is contained in:
parent
eab8fe41c3
commit
9546118988
@ -569,9 +569,9 @@ imgtool::partition::partition(imgtool::image &image, imgtool_class &imgclass, in
|
||||
m_supports_creation_time = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME) ? 1 : 0;
|
||||
m_supports_lastmodified_time = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME) ? 1 : 0;
|
||||
m_supports_bootblock = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_SUPPORTS_BOOTBLOCK) ? 1 : 0;
|
||||
m_begin_enum = (imgtoolerr_t(*)(imgtool::directory *, const char *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_BEGIN_ENUM);
|
||||
m_next_enum = (imgtoolerr_t(*)(imgtool::directory *, imgtool_dirent *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_NEXT_ENUM);
|
||||
m_close_enum = (void(*)(imgtool::directory *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_CLOSE_ENUM);
|
||||
m_begin_enum = (imgtoolerr_t(*)(imgtool::directory &, const char *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_BEGIN_ENUM);
|
||||
m_next_enum = (imgtoolerr_t(*)(imgtool::directory &, imgtool_dirent &)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_NEXT_ENUM);
|
||||
m_close_enum = (void(*)(imgtool::directory &)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_CLOSE_ENUM);
|
||||
m_free_space = (imgtoolerr_t(*)(imgtool::partition &, UINT64 *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_FREE_SPACE);
|
||||
m_read_file = (imgtoolerr_t(*)(imgtool::partition &, const char *, const char *, imgtool::stream &)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_READ_FILE);
|
||||
m_write_file = (imgtoolerr_t(*)(imgtool::partition &, const char *, const char *, imgtool::stream &, util::option_resolution *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_WRITE_FILE);
|
||||
@ -2461,7 +2461,7 @@ imgtoolerr_t imgtool::directory::open(imgtool::partition &partition, const char
|
||||
|
||||
if (partition.m_begin_enum)
|
||||
{
|
||||
err = partition.m_begin_enum(enumeration.get(), path);
|
||||
err = partition.m_begin_enum(*enumeration, path);
|
||||
if (err)
|
||||
{
|
||||
err = markerrorsource(err);
|
||||
@ -2488,7 +2488,7 @@ done:
|
||||
imgtool::directory::~directory()
|
||||
{
|
||||
if (m_okay_to_close && m_partition.m_close_enum)
|
||||
m_partition.m_close_enum(this);
|
||||
m_partition.m_close_enum(*this);
|
||||
}
|
||||
|
||||
|
||||
@ -2505,7 +2505,7 @@ imgtoolerr_t imgtool::directory::get_next(imgtool_dirent &ent)
|
||||
// the attributes if they don't apply
|
||||
memset(&ent, 0, sizeof(ent));
|
||||
|
||||
err = m_partition.m_next_enum(this, &ent);
|
||||
err = m_partition.m_next_enum(*this, ent);
|
||||
if (err)
|
||||
return markerrorsource(err);
|
||||
|
||||
|
@ -203,9 +203,9 @@ namespace imgtool
|
||||
unsigned int m_supports_lastmodified_time : 1;
|
||||
unsigned int m_supports_bootblock : 1; /* this module supports loading/storing the boot block */
|
||||
|
||||
std::function<imgtoolerr_t(imgtool::directory *enumeration, const char *path)> m_begin_enum;
|
||||
std::function<imgtoolerr_t(imgtool::directory *enumeration, imgtool_dirent *ent)> m_next_enum;
|
||||
std::function<void(imgtool::directory *enumeration)> m_close_enum;
|
||||
std::function<imgtoolerr_t(imgtool::directory &enumeration, const char *path)> m_begin_enum;
|
||||
std::function<imgtoolerr_t(imgtool::directory &enumeration, imgtool_dirent &ent)> m_next_enum;
|
||||
std::function<void(imgtool::directory &enumeration)> m_close_enum;
|
||||
std::function<imgtoolerr_t(imgtool::partition &partition, UINT64 *size)> m_free_space;
|
||||
std::function<imgtoolerr_t(imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream &destf)> m_read_file;
|
||||
std::function<imgtoolerr_t(imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream &sourcef, util::option_resolution *opts)> m_write_file;
|
||||
|
@ -259,9 +259,9 @@ union imgtoolinfo
|
||||
imgtoolerr_t (*create) (imgtool::image &image, imgtool::stream::ptr &&stream, util::option_resolution *opts);
|
||||
imgtoolerr_t (*create_partition) (imgtool::image &image, UINT64 first_block, UINT64 block_count);
|
||||
void (*info) (imgtool::image &image, char *string, size_t len);
|
||||
imgtoolerr_t (*begin_enum) (imgtool::directory *enumeration, const char *path);
|
||||
imgtoolerr_t (*next_enum) (imgtool::directory *enumeration, imgtool_dirent *ent);
|
||||
void (*close_enum) (imgtool::directory *enumeration);
|
||||
imgtoolerr_t (*begin_enum) (imgtool::directory &enumeration, const char *path);
|
||||
imgtoolerr_t (*next_enum) (imgtool::directory &enumeration, imgtool_dirent &ent);
|
||||
void (*close_enum) (imgtool::directory &enumeration);
|
||||
imgtoolerr_t (*open_partition) (imgtool::partition &partition, UINT64 first_block, UINT64 block_count);
|
||||
imgtoolerr_t (*free_space) (imgtool::partition &partition, UINT64 *size);
|
||||
imgtoolerr_t (*read_file) (imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream &destf);
|
||||
|
@ -1855,13 +1855,13 @@ static imgtoolerr_t amiga_image_write_sector(imgtool::image &img, UINT32 track,
|
||||
}
|
||||
|
||||
|
||||
static imgtoolerr_t amiga_image_beginenum(imgtool::directory *enumeration, const char *path)
|
||||
static imgtoolerr_t amiga_image_beginenum(imgtool::directory &enumeration, const char *path)
|
||||
{
|
||||
int blocks = get_total_blocks(enumeration->image());
|
||||
int blocks = get_total_blocks(enumeration.image());
|
||||
imgtoolerr_t ret;
|
||||
amiga_iterator *iter;
|
||||
|
||||
iter = (amiga_iterator *) enumeration->extra_bytes();
|
||||
iter = (amiga_iterator *) enumeration.extra_bytes();
|
||||
if (!iter) return IMGTOOLERR_OUTOFMEMORY;
|
||||
|
||||
iter->index = 1;
|
||||
@ -1871,7 +1871,7 @@ static imgtoolerr_t amiga_image_beginenum(imgtool::directory *enumeration, const
|
||||
if (path[0])
|
||||
{
|
||||
/* search for the directory block, start with the root block */
|
||||
ret = find_entry(enumeration->image(), path, blocks/2, &iter->block);
|
||||
ret = find_entry(enumeration.image(), path, blocks/2, &iter->block);
|
||||
if (ret) return ret;
|
||||
}
|
||||
else
|
||||
@ -1884,9 +1884,9 @@ static imgtoolerr_t amiga_image_beginenum(imgtool::directory *enumeration, const
|
||||
}
|
||||
|
||||
|
||||
static imgtoolerr_t amiga_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t amiga_image_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent)
|
||||
{
|
||||
amiga_iterator *iter = (amiga_iterator *) enumeration->extra_bytes();
|
||||
amiga_iterator *iter = (amiga_iterator *) enumeration.extra_bytes();
|
||||
imgtoolerr_t ret;
|
||||
UINT32 ht[TSIZE];
|
||||
int block;
|
||||
@ -1894,12 +1894,12 @@ static imgtoolerr_t amiga_image_nextenum(imgtool::directory *enumeration, imgtoo
|
||||
/* finished listing all entries? */
|
||||
if (iter->eof == 1 || iter->ht_index == TSIZE)
|
||||
{
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
/* get hash table */
|
||||
ret = get_hash_table(enumeration->image(), iter->block, ht);
|
||||
ret = get_hash_table(enumeration.image(), iter->block, ht);
|
||||
if (ret) return ret;
|
||||
|
||||
/* skip empty hash table entries */
|
||||
@ -1909,7 +1909,7 @@ static imgtoolerr_t amiga_image_nextenum(imgtool::directory *enumeration, imgtoo
|
||||
/* check if we are already at the end */
|
||||
if (iter->ht_index == TSIZE)
|
||||
{
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
}
|
||||
@ -1917,22 +1917,22 @@ static imgtoolerr_t amiga_image_nextenum(imgtool::directory *enumeration, imgtoo
|
||||
/* get block number */
|
||||
block = (iter->next_block == 0) ? ht[iter->ht_index] : iter->next_block;
|
||||
|
||||
switch (get_block_type(enumeration->image(), block))
|
||||
switch (get_block_type(enumeration.image(), block))
|
||||
{
|
||||
case ST_FILE:
|
||||
{
|
||||
file_block file;
|
||||
|
||||
/* get block */
|
||||
ret = read_file_block(enumeration->image(), block, &file);
|
||||
ret = read_file_block(enumeration.image(), block, &file);
|
||||
if (ret) return ret;
|
||||
|
||||
/* fill directory entry */
|
||||
strncpyz(ent->filename, (char *)file.filename, file.name_len + 1);
|
||||
ent->filesize = file.byte_size;
|
||||
ent->lastmodified_time = amiga_crack_time(&file.date);
|
||||
amiga_decode_flags(file.protect, ent->attr);
|
||||
strncpyz(ent->comment, (char *)file.comment, file.comm_len + 1);
|
||||
strncpyz(ent.filename, (char *)file.filename, file.name_len + 1);
|
||||
ent.filesize = file.byte_size;
|
||||
ent.lastmodified_time = amiga_crack_time(&file.date);
|
||||
amiga_decode_flags(file.protect, ent.attr);
|
||||
strncpyz(ent.comment, (char *)file.comment, file.comm_len + 1);
|
||||
|
||||
iter->next_block = file.hash_chain;
|
||||
|
||||
@ -1944,15 +1944,15 @@ static imgtoolerr_t amiga_image_nextenum(imgtool::directory *enumeration, imgtoo
|
||||
dir_block dir;
|
||||
|
||||
/* get block */
|
||||
ret = read_dir_block(enumeration->image(), block, &dir);
|
||||
ret = read_dir_block(enumeration.image(), block, &dir);
|
||||
if (ret) return ret;
|
||||
|
||||
/* fill directory entry */
|
||||
strncpyz(ent->filename, (char *)dir.dirname, dir.name_len + 1);
|
||||
ent->lastmodified_time = amiga_crack_time(&dir.date);
|
||||
amiga_decode_flags(dir.protect, ent->attr);
|
||||
strncpyz(ent->comment, (char *)dir.comment, dir.comm_len + 1);
|
||||
ent->directory = 1;
|
||||
strncpyz(ent.filename, (char *)dir.dirname, dir.name_len + 1);
|
||||
ent.lastmodified_time = amiga_crack_time(&dir.date);
|
||||
amiga_decode_flags(dir.protect, ent.attr);
|
||||
strncpyz(ent.comment, (char *)dir.comment, dir.comm_len + 1);
|
||||
ent.directory = 1;
|
||||
|
||||
iter->next_block = dir.hash_chain;
|
||||
|
||||
@ -1964,15 +1964,15 @@ static imgtoolerr_t amiga_image_nextenum(imgtool::directory *enumeration, imgtoo
|
||||
softlink_block sl;
|
||||
|
||||
/* get block */
|
||||
ret = read_softlink_block(enumeration->image(), block, &sl);
|
||||
ret = read_softlink_block(enumeration.image(), block, &sl);
|
||||
if (ret) return ret;
|
||||
|
||||
/* fill directory entry */
|
||||
strncpyz(ent->filename, (char *)sl.slname, sl.name_len + 1);
|
||||
ent->lastmodified_time = amiga_crack_time(&sl.date);
|
||||
amiga_decode_flags(sl.protect, ent->attr);
|
||||
strncpyz(ent->comment, (char *)sl.comment, sl.comm_len + 1);
|
||||
strcpy(ent->softlink, (char *)sl.symbolic_name);
|
||||
strncpyz(ent.filename, (char *)sl.slname, sl.name_len + 1);
|
||||
ent.lastmodified_time = amiga_crack_time(&sl.date);
|
||||
amiga_decode_flags(sl.protect, ent.attr);
|
||||
strncpyz(ent.comment, (char *)sl.comment, sl.comm_len + 1);
|
||||
strcpy(ent.softlink, (char *)sl.symbolic_name);
|
||||
|
||||
iter->next_block = sl.hash_chain;
|
||||
|
||||
@ -1981,31 +1981,31 @@ static imgtoolerr_t amiga_image_nextenum(imgtool::directory *enumeration, imgtoo
|
||||
|
||||
case ST_LINKDIR:
|
||||
|
||||
ent->directory = 1;
|
||||
ent.directory = 1;
|
||||
|
||||
case ST_LINKFILE:
|
||||
{
|
||||
hardlink_block hl;
|
||||
|
||||
/* get block */
|
||||
ret = read_hardlink_block(enumeration->image(), block, &hl);
|
||||
ret = read_hardlink_block(enumeration.image(), block, &hl);
|
||||
if (ret) return ret;
|
||||
|
||||
/* get filesize from linked file */
|
||||
if (!ent->directory)
|
||||
if (!ent.directory)
|
||||
{
|
||||
file_block file;
|
||||
ret = read_file_block(enumeration->image(), hl.real_entry, &file);
|
||||
ret = read_file_block(enumeration.image(), hl.real_entry, &file);
|
||||
if (ret) return ret;
|
||||
ent->filesize = file.byte_size;
|
||||
ent.filesize = file.byte_size;
|
||||
}
|
||||
|
||||
/* fill directory entry */
|
||||
strncpyz(ent->filename, (char *)hl.hlname, hl.name_len + 1);
|
||||
ent->lastmodified_time = amiga_crack_time(&hl.date);
|
||||
amiga_decode_flags(hl.protect, ent->attr);
|
||||
strncpyz(ent->comment, (char *)hl.comment, hl.comm_len + 1);
|
||||
ent->hardlink = 1;
|
||||
strncpyz(ent.filename, (char *)hl.hlname, hl.name_len + 1);
|
||||
ent.lastmodified_time = amiga_crack_time(&hl.date);
|
||||
amiga_decode_flags(hl.protect, ent.attr);
|
||||
strncpyz(ent.comment, (char *)hl.comment, hl.comm_len + 1);
|
||||
ent.hardlink = 1;
|
||||
|
||||
iter->next_block = hl.hash_chain;
|
||||
|
||||
@ -2029,12 +2029,6 @@ static imgtoolerr_t amiga_image_nextenum(imgtool::directory *enumeration, imgtoo
|
||||
}
|
||||
|
||||
|
||||
static void amiga_image_closeenum(imgtool::directory *enumeration)
|
||||
{
|
||||
free(enumeration);
|
||||
}
|
||||
|
||||
|
||||
static imgtoolerr_t amiga_image_freespace(imgtool::partition &partition, UINT64 *size)
|
||||
{
|
||||
imgtoolerr_t ret;
|
||||
@ -2411,7 +2405,6 @@ void amiga_floppy_get_info(const imgtool_class *imgclass, UINT32 state, union im
|
||||
case IMGTOOLINFO_PTR_INFO: info->info = amiga_image_info; break;
|
||||
case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = amiga_image_beginenum; break;
|
||||
case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = amiga_image_nextenum; break;
|
||||
case IMGTOOLINFO_PTR_CLOSE_ENUM: info->close_enum = amiga_image_closeenum; break;
|
||||
case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = amiga_image_freespace; break;
|
||||
case IMGTOOLINFO_PTR_READ_FILE: info->read_file = amiga_image_readfile; break;
|
||||
case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = amiga_image_writefile; break;
|
||||
|
@ -548,7 +548,7 @@ static imgtoolerr_t bml3_diskimage_open(imgtool::image &image, imgtool::stream::
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t bml3_diskimage_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t bml3_diskimage_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent)
|
||||
{
|
||||
floperr_t ferr;
|
||||
imgtoolerr_t err;
|
||||
@ -556,9 +556,9 @@ static imgtoolerr_t bml3_diskimage_nextenum(imgtool::directory *enumeration, img
|
||||
struct bml3_direnum *rsenum;
|
||||
struct bml3_dirent rsent;
|
||||
char fname[13];
|
||||
imgtool::image &image(enumeration->image());
|
||||
imgtool::image &image(enumeration.image());
|
||||
|
||||
rsenum = (struct bml3_direnum *) enumeration->extra_bytes();
|
||||
rsenum = (struct bml3_direnum *) enumeration.extra_bytes();
|
||||
|
||||
/* Did we hit the end of file before? */
|
||||
if (rsenum->eof)
|
||||
@ -580,7 +580,7 @@ static imgtoolerr_t bml3_diskimage_nextenum(imgtool::directory *enumeration, img
|
||||
{
|
||||
rsenum->eof = 1;
|
||||
eof:
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -592,20 +592,20 @@ eof:
|
||||
if (filesize == ((size_t) -1))
|
||||
{
|
||||
/* corrupt! */
|
||||
ent->filesize = 0;
|
||||
ent->corrupt = 1;
|
||||
ent.filesize = 0;
|
||||
ent.corrupt = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ent->filesize = filesize;
|
||||
ent->corrupt = 0;
|
||||
ent.filesize = filesize;
|
||||
ent.corrupt = 0;
|
||||
}
|
||||
ent->eof = 0;
|
||||
ent.eof = 0;
|
||||
|
||||
get_dirent_fname(fname, &rsent);
|
||||
|
||||
snprintf(ent->filename, ARRAY_LENGTH(ent->filename), "%s", fname);
|
||||
snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%d %c", (int) rsent.ftype, (char) (rsent.asciiflag + 'B'));
|
||||
snprintf(ent.filename, ARRAY_LENGTH(ent.filename), "%s", fname);
|
||||
snprintf(ent.attr, ARRAY_LENGTH(ent.attr), "%d %c", (int) rsent.ftype, (char) (rsent.asciiflag + 'B'));
|
||||
}
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
@ -129,9 +129,9 @@ struct concept_iterator
|
||||
static imgtoolerr_t concept_image_init(imgtool::image &img, imgtool::stream::ptr &&stream);
|
||||
static void concept_image_exit(imgtool::image &img);
|
||||
static void concept_image_info(imgtool::image &img, char *string, size_t len);
|
||||
static imgtoolerr_t concept_image_beginenum(imgtool::directory *enumeration, const char *path);
|
||||
static imgtoolerr_t concept_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent);
|
||||
static void concept_image_closeenum(imgtool::directory *enumeration);
|
||||
static imgtoolerr_t concept_image_beginenum(imgtool::directory &enumeration, const char *path);
|
||||
static imgtoolerr_t concept_image_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent);
|
||||
static void concept_image_closeenum(imgtool::directory &enumeration);
|
||||
static imgtoolerr_t concept_image_freespace(imgtool::partition &partition, UINT64 *size);
|
||||
static imgtoolerr_t concept_image_readfile(imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream &destf);
|
||||
#if 0
|
||||
@ -323,12 +323,12 @@ static void concept_image_info(imgtool::image &img, char *string, size_t len)
|
||||
/*
|
||||
Open the disk catalog for enumeration
|
||||
*/
|
||||
static imgtoolerr_t concept_image_beginenum(imgtool::directory *enumeration, const char *path)
|
||||
static imgtoolerr_t concept_image_beginenum(imgtool::directory &enumeration, const char *path)
|
||||
{
|
||||
concept_iterator *iter;
|
||||
|
||||
iter = (concept_iterator *) enumeration->extra_bytes();
|
||||
iter->image = (concept_image *) enumeration->image().extra_bytes();
|
||||
iter = (concept_iterator *) enumeration.extra_bytes();
|
||||
iter->image = (concept_image *) enumeration.image().extra_bytes();
|
||||
iter->index = 0;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
@ -336,31 +336,31 @@ static imgtoolerr_t concept_image_beginenum(imgtool::directory *enumeration, con
|
||||
/*
|
||||
Enumerate disk catalog next entry
|
||||
*/
|
||||
static imgtoolerr_t concept_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t concept_image_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent)
|
||||
{
|
||||
concept_iterator *iter = (concept_iterator *) enumeration->extra_bytes();
|
||||
concept_iterator *iter = (concept_iterator *) enumeration.extra_bytes();
|
||||
|
||||
|
||||
ent->corrupt = 0;
|
||||
ent->eof = 0;
|
||||
ent.corrupt = 0;
|
||||
ent.eof = 0;
|
||||
|
||||
if ((iter->image->dev_dir.file_dir[iter->index].filename[0] == 0) || (iter->index > 77))
|
||||
{
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
}
|
||||
else if (iter->image->dev_dir.file_dir[iter->index].filename[0] > 15)
|
||||
{
|
||||
ent->corrupt = 1;
|
||||
ent.corrupt = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int len = iter->image->dev_dir.file_dir[iter->index].filename[0];
|
||||
const char *type;
|
||||
|
||||
if (len > ARRAY_LENGTH(ent->filename))
|
||||
len = ARRAY_LENGTH(ent->filename);
|
||||
memcpy(ent->filename, iter->image->dev_dir.file_dir[iter->index].filename + 1, len);
|
||||
ent->filename[len] = 0;
|
||||
if (len > ARRAY_LENGTH(ent.filename))
|
||||
len = ARRAY_LENGTH(ent.filename);
|
||||
memcpy(ent.filename, iter->image->dev_dir.file_dir[iter->index].filename + 1, len);
|
||||
ent.filename[len] = 0;
|
||||
|
||||
/* parse flags */
|
||||
switch (get_UINT16xE(iter->image->dev_dir.vol_hdr.disk_flipped, iter->image->dev_dir.file_dir[iter->index].ftype) & 0xf)
|
||||
@ -382,10 +382,10 @@ static imgtoolerr_t concept_image_nextenum(imgtool::directory *enumeration, imgt
|
||||
type = "???";
|
||||
break;
|
||||
}
|
||||
snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%s", type);
|
||||
snprintf(ent.attr, ARRAY_LENGTH(ent.attr), "%s", type);
|
||||
|
||||
/* len in physrecs */
|
||||
ent->filesize = get_UINT16xE(iter->image->dev_dir.vol_hdr.disk_flipped, iter->image->dev_dir.file_dir[iter->index].next_block)
|
||||
ent.filesize = get_UINT16xE(iter->image->dev_dir.vol_hdr.disk_flipped, iter->image->dev_dir.file_dir[iter->index].next_block)
|
||||
- get_UINT16xE(iter->image->dev_dir.vol_hdr.disk_flipped, iter->image->dev_dir.file_dir[iter->index].first_block);
|
||||
|
||||
iter->index++;
|
||||
@ -397,7 +397,7 @@ static imgtoolerr_t concept_image_nextenum(imgtool::directory *enumeration, imgt
|
||||
/*
|
||||
Free enumerator
|
||||
*/
|
||||
static void concept_image_closeenum(imgtool::directory *enumeration)
|
||||
static void concept_image_closeenum(imgtool::directory &enumeration)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -382,18 +382,18 @@ static imgtoolerr_t cybiko_image_create(imgtool::image &image, imgtool::stream::
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t cybiko_image_begin_enum( imgtool::directory *enumeration, const char *path)
|
||||
static imgtoolerr_t cybiko_image_begin_enum(imgtool::directory &enumeration, const char *path)
|
||||
{
|
||||
cybiko_iter *iter = (cybiko_iter*)enumeration->extra_bytes();
|
||||
cybiko_iter *iter = (cybiko_iter*)enumeration.extra_bytes();
|
||||
iter->block = 0;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t cybiko_image_next_enum( imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t cybiko_image_next_enum(imgtool::directory &enumeration, imgtool_dirent &ent)
|
||||
{
|
||||
imgtool::image &image(enumeration->image());
|
||||
imgtool::image &image(enumeration.image());
|
||||
cybiko_file_system *cfs = get_cfs(image);
|
||||
cybiko_iter *iter = (cybiko_iter*)enumeration->extra_bytes();
|
||||
cybiko_iter *iter = (cybiko_iter*)enumeration.extra_bytes();
|
||||
UINT8 buffer[MAX_PAGE_SIZE];
|
||||
UINT16 file_id = INVALID_FILE_ID;
|
||||
cfs_file file;
|
||||
@ -410,24 +410,19 @@ static imgtoolerr_t cybiko_image_next_enum( imgtool::directory *enumeration, img
|
||||
// get file information
|
||||
if ((file_id != INVALID_FILE_ID) && cfs_file_info( cfs, file_id, &file))
|
||||
{
|
||||
strcpy( ent->filename, file.name);
|
||||
ent->filesize = file.size;
|
||||
ent->lastmodified_time = time_crack( file.date);
|
||||
ent->filesize = file.size;
|
||||
strcpy( ent.filename, file.name);
|
||||
ent.filesize = file.size;
|
||||
ent.lastmodified_time = time_crack( file.date);
|
||||
ent.filesize = file.size;
|
||||
}
|
||||
else
|
||||
{
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
}
|
||||
// ok
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static void cybiko_image_close_enum( imgtool::directory *enumeration)
|
||||
{
|
||||
// nothing
|
||||
}
|
||||
|
||||
static imgtoolerr_t cybiko_image_free_space(imgtool::partition &partition, UINT64 *size)
|
||||
{
|
||||
imgtool::image &image(partition.image());
|
||||
@ -564,7 +559,6 @@ void cybiko_get_info( const imgtool_class *imgclass, UINT32 state, union imgtool
|
||||
case IMGTOOLINFO_PTR_CLOSE : info->close = cybiko_image_close; break;
|
||||
case IMGTOOLINFO_PTR_BEGIN_ENUM : info->begin_enum = cybiko_image_begin_enum; break;
|
||||
case IMGTOOLINFO_PTR_NEXT_ENUM : info->next_enum = cybiko_image_next_enum; break;
|
||||
case IMGTOOLINFO_PTR_CLOSE_ENUM : info->close_enum = cybiko_image_close_enum; break;
|
||||
case IMGTOOLINFO_PTR_FREE_SPACE : info->free_space = cybiko_image_free_space; break;
|
||||
case IMGTOOLINFO_PTR_READ_FILE : info->read_file = cybiko_image_read_file; break;
|
||||
case IMGTOOLINFO_PTR_WRITE_FILE : info->write_file = cybiko_image_write_file; break;
|
||||
|
@ -352,18 +352,18 @@ static imgtoolerr_t cybiko_image_create(imgtool::image &image, imgtool::stream::
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t cybiko_image_begin_enum( imgtool::directory *enumeration, const char *path)
|
||||
static imgtoolerr_t cybiko_image_begin_enum(imgtool::directory &enumeration, const char *path)
|
||||
{
|
||||
cybiko_iter *iter = (cybiko_iter*)enumeration->extra_bytes();
|
||||
cybiko_iter *iter = (cybiko_iter*)enumeration.extra_bytes();
|
||||
iter->block = 0;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t cybiko_image_next_enum( imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t cybiko_image_next_enum(imgtool::directory &enumeration, imgtool_dirent &ent)
|
||||
{
|
||||
imgtool::image &image(enumeration->image());
|
||||
imgtool::image &image(enumeration.image());
|
||||
cybiko_file_system *cfs = get_cfs(image);
|
||||
cybiko_iter *iter = (cybiko_iter*)enumeration->extra_bytes();
|
||||
cybiko_iter *iter = (cybiko_iter*)enumeration.extra_bytes();
|
||||
UINT8 buffer[MAX_PAGE_SIZE];
|
||||
UINT16 file_id = INVALID_FILE_ID;
|
||||
cfs_file file;
|
||||
@ -380,24 +380,19 @@ static imgtoolerr_t cybiko_image_next_enum( imgtool::directory *enumeration, img
|
||||
// get file information
|
||||
if ((file_id != INVALID_FILE_ID) && cfs_file_info( cfs, file_id, &file))
|
||||
{
|
||||
strcpy( ent->filename, file.name);
|
||||
ent->filesize = file.size;
|
||||
ent->lastmodified_time = time_crack( file.date);
|
||||
ent->filesize = file.size;
|
||||
strcpy( ent.filename, file.name);
|
||||
ent.filesize = file.size;
|
||||
ent.lastmodified_time = time_crack( file.date);
|
||||
ent.filesize = file.size;
|
||||
}
|
||||
else
|
||||
{
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
}
|
||||
// ok
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static void cybiko_image_close_enum( imgtool::directory *enumeration)
|
||||
{
|
||||
// nothing
|
||||
}
|
||||
|
||||
static imgtoolerr_t cybiko_image_free_space(imgtool::partition &partition, UINT64 *size)
|
||||
{
|
||||
imgtool::image &image(partition.image());
|
||||
@ -529,7 +524,6 @@ void cybikoxt_get_info( const imgtool_class *imgclass, UINT32 state, union imgto
|
||||
case IMGTOOLINFO_PTR_CLOSE : info->close = cybiko_image_close; break;
|
||||
case IMGTOOLINFO_PTR_BEGIN_ENUM : info->begin_enum = cybiko_image_begin_enum; break;
|
||||
case IMGTOOLINFO_PTR_NEXT_ENUM : info->next_enum = cybiko_image_next_enum; break;
|
||||
case IMGTOOLINFO_PTR_CLOSE_ENUM : info->close_enum = cybiko_image_close_enum; break;
|
||||
case IMGTOOLINFO_PTR_FREE_SPACE : info->free_space = cybiko_image_free_space; break;
|
||||
case IMGTOOLINFO_PTR_READ_FILE : info->read_file = cybiko_image_read_file; break;
|
||||
case IMGTOOLINFO_PTR_WRITE_FILE : info->write_file = cybiko_image_write_file; break;
|
||||
|
@ -1278,7 +1278,7 @@ static UINT32 fat_setup_time(time_t ansi_time)
|
||||
|
||||
|
||||
static imgtoolerr_t fat_read_dirent(imgtool::partition &partition, fat_file *file,
|
||||
fat_dirent *ent, fat_freeentry_info *freeent)
|
||||
fat_dirent &ent, fat_freeentry_info *freeent)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
//const fat_partition_info *disk_info;
|
||||
@ -1294,7 +1294,7 @@ static imgtoolerr_t fat_read_dirent(imgtool::partition &partition, fat_file *fil
|
||||
|
||||
assert(file->directory);
|
||||
lfn_buf[0] = '\0';
|
||||
memset(ent, 0, sizeof(*ent));
|
||||
memset(&ent, 0, sizeof(ent));
|
||||
//disk_info = fat_get_partition_info(partition);
|
||||
|
||||
/* The first eight bytes of a FAT directory entry is a blank padded name
|
||||
@ -1360,12 +1360,12 @@ static imgtoolerr_t fat_read_dirent(imgtool::partition &partition, fat_file *fil
|
||||
/* no more directory entries? */
|
||||
if (entry[0] == '\0')
|
||||
{
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
/* pick apart short filename */
|
||||
fat_cannonicalize_sfn(ent->short_filename, entry);
|
||||
fat_cannonicalize_sfn(ent.short_filename, entry);
|
||||
|
||||
/* and the long filename */
|
||||
if (lfn_lastentry == 1)
|
||||
@ -1378,20 +1378,20 @@ static imgtoolerr_t fat_read_dirent(imgtool::partition &partition, fat_file *fil
|
||||
do
|
||||
{
|
||||
i += uchar_from_utf16(&ch, &lfn_buf[i], ARRAY_LENGTH(lfn_buf) - i);
|
||||
j += utf8_from_uchar(&ent->long_filename[j], ARRAY_LENGTH(ent->long_filename) - j, ch);
|
||||
j += utf8_from_uchar(&ent.long_filename[j], ARRAY_LENGTH(ent.long_filename) - j, ch);
|
||||
}
|
||||
while(ch != 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* other attributes */
|
||||
ent->filesize = pick_integer_le(entry, 28, 4);
|
||||
ent->directory = (entry[11] & 0x10) ? 1 : 0;
|
||||
ent->first_cluster = pick_integer_le(entry, 26, 2);
|
||||
ent->dirent_sector_index = entry_sector_index;
|
||||
ent->dirent_sector_offset = entry_sector_offset;
|
||||
ent->creation_time = fat_crack_time(pick_integer_le(entry, 14, 4));
|
||||
ent->lastmodified_time = fat_crack_time(pick_integer_le(entry, 22, 4));
|
||||
ent.filesize = pick_integer_le(entry, 28, 4);
|
||||
ent.directory = (entry[11] & 0x10) ? 1 : 0;
|
||||
ent.first_cluster = pick_integer_le(entry, 26, 2);
|
||||
ent.dirent_sector_index = entry_sector_index;
|
||||
ent.dirent_sector_offset = entry_sector_offset;
|
||||
ent.creation_time = fat_crack_time(pick_integer_le(entry, 14, 4));
|
||||
ent.lastmodified_time = fat_crack_time(pick_integer_le(entry, 22, 4));
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1706,7 +1706,7 @@ static imgtoolerr_t fat_lookup_path(imgtool::partition &partition, const char *p
|
||||
|
||||
do
|
||||
{
|
||||
err = fat_read_dirent(partition, file, &ent, created_entry ? &freeent : NULL);
|
||||
err = fat_read_dirent(partition, file, ent, created_entry ? &freeent : NULL);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
@ -1740,7 +1740,7 @@ static imgtoolerr_t fat_lookup_path(imgtool::partition &partition, const char *p
|
||||
|
||||
do
|
||||
{
|
||||
err = fat_read_dirent(partition, file, &ent, NULL);
|
||||
err = fat_read_dirent(partition, file, ent, NULL);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
@ -1809,14 +1809,14 @@ done:
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_partition_beginenum(imgtool::directory *enumeration, const char *path)
|
||||
static imgtoolerr_t fat_partition_beginenum(imgtool::directory &enumeration, const char *path)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
fat_file *file;
|
||||
|
||||
file = (fat_file *) enumeration->extra_bytes();
|
||||
file = (fat_file *) enumeration.extra_bytes();
|
||||
|
||||
err = fat_lookup_path(enumeration->partition(), path, CREATE_NONE, file);
|
||||
err = fat_lookup_path(enumeration.partition(), path, CREATE_NONE, file);
|
||||
if (err)
|
||||
return err;
|
||||
if (!file->directory)
|
||||
@ -1826,25 +1826,25 @@ static imgtoolerr_t fat_partition_beginenum(imgtool::directory *enumeration, con
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_partition_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t fat_partition_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
fat_file *file;
|
||||
fat_dirent fatent;
|
||||
|
||||
file = (fat_file *) enumeration->extra_bytes();
|
||||
err = fat_read_dirent(enumeration->partition(), file, &fatent, NULL);
|
||||
file = (fat_file *) enumeration.extra_bytes();
|
||||
err = fat_read_dirent(enumeration.partition(), file, fatent, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* copy stuff from the FAT dirent to the Imgtool dirent */
|
||||
snprintf(ent->filename, ARRAY_LENGTH(ent->filename), "%s", fatent.long_filename[0]
|
||||
snprintf(ent.filename, ARRAY_LENGTH(ent.filename), "%s", fatent.long_filename[0]
|
||||
? fatent.long_filename : fatent.short_filename);
|
||||
ent->filesize = fatent.filesize;
|
||||
ent->directory = fatent.directory;
|
||||
ent->eof = fatent.eof;
|
||||
ent->creation_time = fatent.creation_time;
|
||||
ent->lastmodified_time = fatent.lastmodified_time;
|
||||
ent.filesize = fatent.filesize;
|
||||
ent.directory = fatent.directory;
|
||||
ent.eof = fatent.eof;
|
||||
ent.creation_time = fatent.creation_time;
|
||||
ent.lastmodified_time = fatent.lastmodified_time;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1985,7 +1985,7 @@ static imgtoolerr_t fat_partition_delete(imgtool::partition &partition, const ch
|
||||
|
||||
if (dir)
|
||||
{
|
||||
err = fat_read_dirent(partition, &file, &ent, NULL);
|
||||
err = fat_read_dirent(partition, &file, ent, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
if (!ent.eof)
|
||||
|
@ -462,33 +462,31 @@ static imgtoolerr_t hp48_open_partition(imgtool::partition &part,
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t hp48_beginenum(imgtool::directory *enumeration,
|
||||
const char *path)
|
||||
static imgtoolerr_t hp48_beginenum(imgtool::directory &enumeration, const char *path)
|
||||
{
|
||||
hp48_directory* d = (hp48_directory*) enumeration->extra_bytes();
|
||||
hp48_directory* d = (hp48_directory*) enumeration.extra_bytes();
|
||||
|
||||
d->pos = 0;
|
||||
d->pos = 0;
|
||||
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t hp48_nextenum(imgtool::directory *enumeration,
|
||||
imgtool_dirent *ent)
|
||||
static imgtoolerr_t hp48_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent)
|
||||
{
|
||||
imgtool::partition &part(enumeration->partition());
|
||||
imgtool::partition &part(enumeration.partition());
|
||||
//imgtool::image &img(part.image());
|
||||
//hp48_card* c = get_hp48_card(img);
|
||||
hp48_partition* p = (hp48_partition*) part.extra_bytes();
|
||||
hp48_directory* d = (hp48_directory*) enumeration->extra_bytes();
|
||||
hp48_directory* d = (hp48_directory*) enumeration.extra_bytes();
|
||||
|
||||
UINT8* data = p->data;
|
||||
int pos = d->pos;
|
||||
|
||||
if ( pos < 0 || pos+12 > 2*p->size )
|
||||
{
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
@ -503,21 +501,21 @@ static imgtoolerr_t hp48_nextenum(imgtool::directory *enumeration,
|
||||
int namelen = read8( data+pos );
|
||||
pos += 2;
|
||||
if ( (pos + 2*namelen > 2*p->size) ||
|
||||
(namelen >= sizeof(ent->filename)) )
|
||||
(namelen >= sizeof(ent.filename)) )
|
||||
{
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
return IMGTOOLERR_CORRUPTFILE;
|
||||
}
|
||||
readstring( ent->filename, data+pos, namelen );
|
||||
readstring( ent.filename, data+pos, namelen );
|
||||
|
||||
/* compute size in bytes, removing name, length & CRC fields */
|
||||
ent->filesize = ((totalsize - 19 - 2*namelen) + 1) / 2;
|
||||
ent.filesize = ((totalsize - 19 - 2*namelen) + 1) / 2;
|
||||
|
||||
switch (prolog)
|
||||
{
|
||||
case PROLOG_LIBRARY: strncpy( ent->attr, "LIB", sizeof(ent->attr) ); break;
|
||||
case PROLOG_BACKUP: strncpy( ent->attr, "BAK", sizeof(ent->attr) ); break;
|
||||
default: strncpy( ent->attr, "?", sizeof(ent->attr) );
|
||||
case PROLOG_LIBRARY: strncpy( ent.attr, "LIB", sizeof(ent.attr) ); break;
|
||||
case PROLOG_BACKUP: strncpy( ent.attr, "BAK", sizeof(ent.attr) ); break;
|
||||
default: strncpy( ent.attr, "?", sizeof(ent.attr) );
|
||||
}
|
||||
|
||||
d->pos = d->pos + totalsize + 5;
|
||||
@ -525,7 +523,7 @@ static imgtoolerr_t hp48_nextenum(imgtool::directory *enumeration,
|
||||
else
|
||||
{
|
||||
/* 0 or unknown object => end */
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
}
|
||||
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
|
@ -1086,36 +1086,36 @@ static void hp9845_tape_close(imgtool::image &image)
|
||||
global_free(&tape_image);
|
||||
}
|
||||
|
||||
static imgtoolerr_t hp9845_tape_begin_enum (imgtool::directory *enumeration, const char *path)
|
||||
static imgtoolerr_t hp9845_tape_begin_enum (imgtool::directory &enumeration, const char *path)
|
||||
{
|
||||
dir_state_t *ds = (dir_state_t*)enumeration->extra_bytes();
|
||||
dir_state_t *ds = (dir_state_t*)enumeration.extra_bytes();
|
||||
|
||||
ds->dir_idx = 0;
|
||||
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t hp9845_tape_next_enum (imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t hp9845_tape_next_enum (imgtool::directory &enumeration, imgtool_dirent &ent)
|
||||
{
|
||||
tape_state_t& state = get_tape_state(enumeration->image());
|
||||
tape_state_t& state = get_tape_state(enumeration.image());
|
||||
tape_image_t& tape_image = get_tape_image(state);
|
||||
dir_state_t *ds = (dir_state_t*)enumeration->extra_bytes();
|
||||
dir_state_t *ds = (dir_state_t*)enumeration.extra_bytes();
|
||||
|
||||
const dir_entry_t *entry = nullptr;
|
||||
|
||||
if (!tape_image.get_dir_entry(ds->dir_idx, entry)) {
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
} else {
|
||||
ds->dir_idx++;
|
||||
|
||||
bool qmark;
|
||||
|
||||
tape_image_t::get_filename_and_ext(*entry, true, ent->filename, qmark);
|
||||
tape_image_t::get_filename_and_ext(*entry, true, ent.filename, qmark);
|
||||
|
||||
// "filename" and "attr" fields try to look like the output of the "CAT" command
|
||||
snprintf(ent->attr , sizeof(ent->attr) , "%c %02x%c %4u %4u %3u" , entry->protection ? '*' : ' ' , entry->filetype , qmark ? '?' : ' ' , entry->n_recs , entry->wpr * 2 , entry->filepos);
|
||||
snprintf(ent.attr , sizeof(ent.attr) , "%c %02x%c %4u %4u %3u" , entry->protection ? '*' : ' ' , entry->filetype , qmark ? '?' : ' ' , entry->n_recs , entry->wpr * 2 , entry->filepos);
|
||||
|
||||
ent->filesize = entry->n_sects * SECTOR_LEN;
|
||||
ent.filesize = entry->n_sects * SECTOR_LEN;
|
||||
}
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
@ -5274,8 +5274,8 @@ static imgtoolerr_t get_comment(struct mac_l2_imgref *l2_img, UINT16 id, mac_str
|
||||
static void mac_image_exit(imgtool::image *img);
|
||||
#endif
|
||||
static void mac_image_info(imgtool::image &img, char *string, size_t len);
|
||||
static imgtoolerr_t mac_image_beginenum(imgtool::directory *enumeration, const char *path);
|
||||
static imgtoolerr_t mac_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent);
|
||||
static imgtoolerr_t mac_image_beginenum(imgtool::directory &enumeration, const char *path);
|
||||
static imgtoolerr_t mac_image_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent);
|
||||
static imgtoolerr_t mac_image_freespace(imgtool::partition &partition, UINT64 *size);
|
||||
static imgtoolerr_t mac_image_readfile(imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream &destf);
|
||||
static imgtoolerr_t mac_image_writefile(imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream &sourcef, util::option_resolution *writeoptions);
|
||||
@ -5336,10 +5336,10 @@ struct mac_iterator
|
||||
/*
|
||||
Open the disk catalog for enumeration
|
||||
*/
|
||||
static imgtoolerr_t mac_image_beginenum(imgtool::directory *enumeration, const char *path)
|
||||
static imgtoolerr_t mac_image_beginenum(imgtool::directory &enumeration, const char *path)
|
||||
{
|
||||
struct mac_l2_imgref *image = get_imgref(enumeration->image());
|
||||
mac_iterator *iter = (mac_iterator *) enumeration->extra_bytes();
|
||||
struct mac_l2_imgref *image = get_imgref(enumeration.image());
|
||||
mac_iterator *iter = (mac_iterator *) enumeration.extra_bytes();
|
||||
imgtoolerr_t err = IMGTOOLERR_UNEXPECTED;
|
||||
|
||||
iter->format = image->format;
|
||||
@ -5365,7 +5365,7 @@ static imgtoolerr_t mac_image_beginenum(imgtool::directory *enumeration, const c
|
||||
/*
|
||||
Enumerate disk catalog next entry (MFS)
|
||||
*/
|
||||
static imgtoolerr_t mfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent)
|
||||
static imgtoolerr_t mfs_image_nextenum(mac_iterator *iter, imgtool_dirent &ent)
|
||||
{
|
||||
mfs_dir_entry *cur_dir_entry;
|
||||
imgtoolerr_t err;
|
||||
@ -5373,26 +5373,26 @@ static imgtoolerr_t mfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent)
|
||||
|
||||
assert(iter->format == L2I_MFS);
|
||||
|
||||
ent->corrupt = 0;
|
||||
ent->eof = 0;
|
||||
ent.corrupt = 0;
|
||||
ent.eof = 0;
|
||||
|
||||
err = mfs_dir_read(&iter->u.mfs.dirref, &cur_dir_entry);
|
||||
if (err)
|
||||
{
|
||||
/* error */
|
||||
ent->corrupt = 1;
|
||||
ent.corrupt = 1;
|
||||
return err;
|
||||
}
|
||||
else if (!cur_dir_entry)
|
||||
{
|
||||
/* EOF */
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
/* copy info */
|
||||
mac_to_c_strncpy(ent->filename, ARRAY_LENGTH(ent->filename), cur_dir_entry->name);
|
||||
ent->filesize = get_UINT32BE(cur_dir_entry->dataPhysicalSize)
|
||||
mac_to_c_strncpy(ent.filename, ARRAY_LENGTH(ent.filename), cur_dir_entry->name);
|
||||
ent.filesize = get_UINT32BE(cur_dir_entry->dataPhysicalSize)
|
||||
+ get_UINT32BE(cur_dir_entry->rsrcPhysicalSize);
|
||||
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
@ -5433,7 +5433,7 @@ static void concat_fname(char *dest, int *dest_cur_pos, int dest_max_len, const
|
||||
/*
|
||||
Enumerate disk catalog next entry (HFS)
|
||||
*/
|
||||
static imgtoolerr_t hfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent)
|
||||
static imgtoolerr_t hfs_image_nextenum(mac_iterator *iter, imgtool_dirent &ent)
|
||||
{
|
||||
hfs_catKey *catrec_key;
|
||||
hfs_catData *catrec_data;
|
||||
@ -5445,8 +5445,8 @@ static imgtoolerr_t hfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent)
|
||||
|
||||
assert(iter->format == L2I_HFS);
|
||||
|
||||
ent->corrupt = 0;
|
||||
ent->eof = 0;
|
||||
ent.corrupt = 0;
|
||||
ent.eof = 0;
|
||||
|
||||
do
|
||||
{
|
||||
@ -5454,13 +5454,13 @@ static imgtoolerr_t hfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent)
|
||||
if (err)
|
||||
{
|
||||
/* error */
|
||||
ent->corrupt = 1;
|
||||
ent.corrupt = 1;
|
||||
return err;
|
||||
}
|
||||
else if (!catrec_key)
|
||||
{
|
||||
/* EOF */
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
dataRecType = get_UINT16BE(catrec_data->dataType);
|
||||
@ -5471,28 +5471,28 @@ static imgtoolerr_t hfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent)
|
||||
switch (get_UINT16BE(catrec_data->dataType))
|
||||
{
|
||||
case hcrt_Folder:
|
||||
ent->directory = 1;
|
||||
ent->filesize = 0;
|
||||
ent.directory = 1;
|
||||
ent.filesize = 0;
|
||||
break;
|
||||
|
||||
case hcrt_File:
|
||||
ent->directory = 0;
|
||||
ent->filesize = get_UINT32BE(catrec_data->file.dataPhysicalSize)
|
||||
ent.directory = 0;
|
||||
ent.filesize = get_UINT32BE(catrec_data->file.dataPhysicalSize)
|
||||
+ get_UINT32BE(catrec_data->file.rsrcPhysicalSize);
|
||||
break;
|
||||
}
|
||||
|
||||
/* initialize file path buffer */
|
||||
cur_name_head = ARRAY_LENGTH(ent->filename);
|
||||
cur_name_head = ARRAY_LENGTH(ent.filename);
|
||||
if (cur_name_head > 0)
|
||||
{
|
||||
cur_name_head--;
|
||||
ent->filename[cur_name_head] = '\0';
|
||||
ent.filename[cur_name_head] = '\0';
|
||||
}
|
||||
|
||||
/* insert folder/file name in buffer */
|
||||
mac_to_c_strncpy(ent->filename, ARRAY_LENGTH(ent->filename), catrec_key->cName);
|
||||
// concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename) - 1, buf);
|
||||
mac_to_c_strncpy(ent.filename, ARRAY_LENGTH(ent.filename), catrec_key->cName);
|
||||
// concat_fname(ent.filename, &cur_name_head, ARRAY_LENGTH(ent.filename) - 1, buf);
|
||||
|
||||
#if 0
|
||||
/* extract parent directory ID */
|
||||
@ -5507,11 +5507,11 @@ static imgtoolerr_t hfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent)
|
||||
if (err)
|
||||
{
|
||||
/* error */
|
||||
concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename) - 1, ":");
|
||||
concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename) - 1, "???");
|
||||
concat_fname(ent.filename, &cur_name_head, ARRAY_LENGTH(ent.filename) - 1, ":");
|
||||
concat_fname(ent.filename, &cur_name_head, ARRAY_LENGTH(ent.filename) - 1, "???");
|
||||
|
||||
memmove(ent->filename, ent->filename+cur_name_head, ARRAY_LENGTH(ent->filename) - cur_name_head);
|
||||
ent->corrupt = 1;
|
||||
memmove(ent.filename, ent.filename+cur_name_head, ARRAY_LENGTH(ent.filename) - cur_name_head);
|
||||
ent.corrupt = 1;
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -5520,24 +5520,24 @@ static imgtoolerr_t hfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent)
|
||||
if (dataRecType != hcrt_FolderThread)
|
||||
{
|
||||
/* error */
|
||||
concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename)-1, ":");
|
||||
concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename)-1, "???");
|
||||
concat_fname(ent.filename, &cur_name_head, ARRAY_LENGTH(ent.filename)-1, ":");
|
||||
concat_fname(ent.filename, &cur_name_head, ARRAY_LENGTH(ent.filename)-1, "???");
|
||||
|
||||
memmove(ent->filename, ent->filename+cur_name_head, ARRAY_LENGTH(ent->filename)-cur_name_head);
|
||||
ent->corrupt = 1;
|
||||
memmove(ent.filename, ent.filename+cur_name_head, ARRAY_LENGTH(ent.filename)-cur_name_head);
|
||||
ent.corrupt = 1;
|
||||
return IMGTOOLERR_CORRUPTIMAGE;
|
||||
}
|
||||
|
||||
/* got folder thread record: insert the folder name at the start of
|
||||
file path, then iterate */
|
||||
mac_to_c_strncpy(buf, sizeof(buf), catrec_data->thread.nodeName);
|
||||
concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename) - 1, ":");
|
||||
concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename) - 1, buf);
|
||||
concat_fname(ent.filename, &cur_name_head, ARRAY_LENGTH(ent.filename) - 1, ":");
|
||||
concat_fname(ent.filename, &cur_name_head, ARRAY_LENGTH(ent.filename) - 1, buf);
|
||||
|
||||
/* extract parent directory ID */
|
||||
parID = get_UINT32BE(catrec_data->thread.parID);
|
||||
}
|
||||
memmove(ent->filename, ent->filename+cur_name_head, ARRAY_LENGTH(ent->filename) -cur_name_head);
|
||||
memmove(ent.filename, ent.filename+cur_name_head, ARRAY_LENGTH(ent.filename) -cur_name_head);
|
||||
#endif
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
@ -5545,10 +5545,10 @@ static imgtoolerr_t hfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent)
|
||||
/*
|
||||
Enumerate disk catalog next entry
|
||||
*/
|
||||
static imgtoolerr_t mac_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t mac_image_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
mac_iterator *iter = (mac_iterator *) enumeration->extra_bytes();
|
||||
mac_iterator *iter = (mac_iterator *) enumeration.extra_bytes();
|
||||
|
||||
switch (iter->format)
|
||||
{
|
||||
|
@ -125,9 +125,9 @@ static os9_diskinfo *os9_get_diskinfo(imgtool::image &image)
|
||||
|
||||
|
||||
|
||||
static struct os9_direnum *os9_get_dirinfo(imgtool::directory *directory)
|
||||
static struct os9_direnum *os9_get_dirinfo(imgtool::directory &directory)
|
||||
{
|
||||
return (struct os9_direnum *) directory->extra_bytes();
|
||||
return (struct os9_direnum *) directory.extra_bytes();
|
||||
}
|
||||
|
||||
|
||||
@ -847,11 +847,11 @@ done:
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t os9_diskimage_beginenum(imgtool::directory *enumeration, const char *path)
|
||||
static imgtoolerr_t os9_diskimage_beginenum(imgtool::directory &enumeration, const char *path)
|
||||
{
|
||||
imgtoolerr_t err = IMGTOOLERR_SUCCESS;
|
||||
struct os9_direnum *os9enum;
|
||||
imgtool::image &image(enumeration->image());
|
||||
imgtool::image &image(enumeration.image());
|
||||
|
||||
os9enum = os9_get_dirinfo(enumeration);
|
||||
|
||||
@ -872,7 +872,7 @@ done:
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t os9_diskimage_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t os9_diskimage_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent)
|
||||
{
|
||||
struct os9_direnum *os9enum;
|
||||
UINT32 lsn, index;
|
||||
@ -880,7 +880,7 @@ static imgtoolerr_t os9_diskimage_nextenum(imgtool::directory *enumeration, imgt
|
||||
UINT8 dir_entry[32];
|
||||
char filename[29];
|
||||
struct os9_fileinfo file_info;
|
||||
imgtool::image &image(enumeration->image());
|
||||
imgtool::image &image(enumeration.image());
|
||||
|
||||
os9enum = os9_get_dirinfo(enumeration);
|
||||
|
||||
@ -889,7 +889,7 @@ static imgtoolerr_t os9_diskimage_nextenum(imgtool::directory *enumeration, imgt
|
||||
/* check for EOF */
|
||||
if (os9enum->index >= os9enum->dir_info.file_size)
|
||||
{
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
@ -947,13 +947,13 @@ static imgtoolerr_t os9_diskimage_nextenum(imgtool::directory *enumeration, imgt
|
||||
|
||||
/* read file attributes */
|
||||
lsn = pick_integer_be(dir_entry, 29, 3);
|
||||
err = os9_decode_file_header(enumeration->image(), lsn, &file_info);
|
||||
err = os9_decode_file_header(enumeration.image(), lsn, &file_info);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* fill out imgtool_dirent structure */
|
||||
snprintf(ent->filename, ARRAY_LENGTH(ent->filename), "%s", filename);
|
||||
snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%c%c%c%c%c%c%c%c",
|
||||
snprintf(ent.filename, ARRAY_LENGTH(ent.filename), "%s", filename);
|
||||
snprintf(ent.attr, ARRAY_LENGTH(ent.attr), "%c%c%c%c%c%c%c%c",
|
||||
file_info.directory ? 'd' : '-',
|
||||
file_info.non_sharable ? 's' : '-',
|
||||
file_info.public_execute ? 'x' : '-',
|
||||
@ -963,9 +963,9 @@ static imgtoolerr_t os9_diskimage_nextenum(imgtool::directory *enumeration, imgt
|
||||
file_info.user_write ? 'w' : '-',
|
||||
file_info.user_read ? 'r' : '-');
|
||||
|
||||
ent->directory = file_info.directory;
|
||||
ent->corrupt = (dir_entry[28] != 0);
|
||||
ent->filesize = file_info.file_size;
|
||||
ent.directory = file_info.directory;
|
||||
ent.corrupt = (dir_entry[28] != 0);
|
||||
ent.filesize = file_info.file_size;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -799,7 +799,7 @@ static UINT8 *alloc_info_block(UINT8 *buffer, size_t block_size, UINT8 block_typ
|
||||
|
||||
|
||||
static imgtoolerr_t prodos_get_next_dirent(imgtool::image &image,
|
||||
prodos_direnum *appleenum, prodos_dirent *ent)
|
||||
prodos_direnum *appleenum, prodos_dirent &ent)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
prodos_diskinfo *di;
|
||||
@ -811,7 +811,7 @@ static imgtoolerr_t prodos_get_next_dirent(imgtool::image &image,
|
||||
int fork_num;
|
||||
|
||||
di = get_prodos_info(image);
|
||||
memset(ent, 0, sizeof(*ent));
|
||||
memset(&ent, 0, sizeof(ent));
|
||||
|
||||
/* have we hit the end of the file? */
|
||||
if (appleenum->block == 0)
|
||||
@ -819,38 +819,38 @@ static imgtoolerr_t prodos_get_next_dirent(imgtool::image &image,
|
||||
|
||||
/* populate the resulting dirent */
|
||||
offset = appleenum->index * di->dirent_size + 4;
|
||||
ent->storage_type = appleenum->block_data[offset + 0];
|
||||
memcpy(ent->filename, &appleenum->block_data[offset + 1], 15);
|
||||
ent->filename[15] = '\0';
|
||||
ent->creation_time = pick_integer_le(appleenum->block_data, offset + 24, 4);
|
||||
ent->lastmodified_time = pick_integer_le(appleenum->block_data, offset + 33, 4);
|
||||
ent->file_type = 0x3F3F3F3F;
|
||||
ent->file_creator = 0x3F3F3F3F;
|
||||
ent->finder_flags = 0;
|
||||
ent->coord_x = 0;
|
||||
ent->coord_y = 0;
|
||||
ent->finder_folder = 0;
|
||||
ent->icon_id = 0;
|
||||
ent->script_code = 0;
|
||||
ent->extended_flags = 0;
|
||||
ent->comment_id = 0;
|
||||
ent->putaway_directory = 0;
|
||||
ent.storage_type = appleenum->block_data[offset + 0];
|
||||
memcpy(ent.filename, &appleenum->block_data[offset + 1], 15);
|
||||
ent.filename[15] = '\0';
|
||||
ent.creation_time = pick_integer_le(appleenum->block_data, offset + 24, 4);
|
||||
ent.lastmodified_time = pick_integer_le(appleenum->block_data, offset + 33, 4);
|
||||
ent.file_type = 0x3F3F3F3F;
|
||||
ent.file_creator = 0x3F3F3F3F;
|
||||
ent.finder_flags = 0;
|
||||
ent.coord_x = 0;
|
||||
ent.coord_y = 0;
|
||||
ent.finder_folder = 0;
|
||||
ent.icon_id = 0;
|
||||
ent.script_code = 0;
|
||||
ent.extended_flags = 0;
|
||||
ent.comment_id = 0;
|
||||
ent.putaway_directory = 0;
|
||||
|
||||
if (is_extendedfile_storagetype(ent->storage_type))
|
||||
if (is_extendedfile_storagetype(ent.storage_type))
|
||||
{
|
||||
/* this is a ProDOS extended file; we need to get the extended info
|
||||
* block */
|
||||
ent->extkey_pointer = pick_integer_le(appleenum->block_data, offset + 17, 2);
|
||||
ent.extkey_pointer = pick_integer_le(appleenum->block_data, offset + 17, 2);
|
||||
|
||||
err = prodos_load_block(image, ent->extkey_pointer, buffer);
|
||||
err = prodos_load_block(image, ent.extkey_pointer, buffer);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
for (fork_num = 0; fork_num <= 1; fork_num++)
|
||||
{
|
||||
ent->key_pointer[fork_num] = pick_integer_le(buffer, 1 + (fork_num * 256), 2);
|
||||
ent->filesize[fork_num] = pick_integer_le(buffer, 5 + (fork_num * 256), 3);
|
||||
ent->depth[fork_num] = buffer[fork_num * 256] & 0x0F;
|
||||
ent.key_pointer[fork_num] = pick_integer_le(buffer, 1 + (fork_num * 256), 2);
|
||||
ent.filesize[fork_num] = pick_integer_le(buffer, 5 + (fork_num * 256), 3);
|
||||
ent.depth[fork_num] = buffer[fork_num * 256] & 0x0F;
|
||||
}
|
||||
|
||||
finfo_offset = 0;
|
||||
@ -861,20 +861,20 @@ static imgtoolerr_t prodos_get_next_dirent(imgtool::image &image,
|
||||
switch(*(info_ptr++))
|
||||
{
|
||||
case 1: /* FInfo */
|
||||
ent->file_type = pick_integer_be(info_ptr, 0, 4);
|
||||
ent->file_creator = pick_integer_be(info_ptr, 4, 4);
|
||||
ent->finder_flags = pick_integer_be(info_ptr, 8, 2);
|
||||
ent->coord_x = pick_integer_be(info_ptr, 10, 2);
|
||||
ent->coord_y = pick_integer_be(info_ptr, 12, 2);
|
||||
ent->finder_folder = pick_integer_be(info_ptr, 14, 4);
|
||||
ent.file_type = pick_integer_be(info_ptr, 0, 4);
|
||||
ent.file_creator = pick_integer_be(info_ptr, 4, 4);
|
||||
ent.finder_flags = pick_integer_be(info_ptr, 8, 2);
|
||||
ent.coord_x = pick_integer_be(info_ptr, 10, 2);
|
||||
ent.coord_y = pick_integer_be(info_ptr, 12, 2);
|
||||
ent.finder_folder = pick_integer_be(info_ptr, 14, 4);
|
||||
break;
|
||||
|
||||
case 2: /* xFInfo */
|
||||
ent->icon_id = pick_integer_be(info_ptr, 0, 2);
|
||||
ent->script_code = pick_integer_be(info_ptr, 8, 1);
|
||||
ent->extended_flags = pick_integer_be(info_ptr, 9, 1);
|
||||
ent->comment_id = pick_integer_be(info_ptr, 10, 2);
|
||||
ent->putaway_directory = pick_integer_be(info_ptr, 12, 4);
|
||||
ent.icon_id = pick_integer_be(info_ptr, 0, 2);
|
||||
ent.script_code = pick_integer_be(info_ptr, 8, 1);
|
||||
ent.extended_flags = pick_integer_be(info_ptr, 9, 1);
|
||||
ent.comment_id = pick_integer_be(info_ptr, 10, 2);
|
||||
ent.putaway_directory = pick_integer_be(info_ptr, 12, 4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -883,9 +883,9 @@ static imgtoolerr_t prodos_get_next_dirent(imgtool::image &image,
|
||||
else
|
||||
{
|
||||
/* normal ProDOS files have all of the info right here */
|
||||
ent->key_pointer[0] = pick_integer_le(appleenum->block_data, offset + 17, 2);
|
||||
ent->filesize[0] = pick_integer_le(appleenum->block_data, offset + 21, 3);
|
||||
ent->depth[0] = ent->storage_type >> 4;
|
||||
ent.key_pointer[0] = pick_integer_le(appleenum->block_data, offset + 17, 2);
|
||||
ent.filesize[0] = pick_integer_le(appleenum->block_data, offset + 21, 3);
|
||||
ent.depth[0] = ent.storage_type >> 4;
|
||||
}
|
||||
|
||||
/* identify next entry */
|
||||
@ -1095,7 +1095,7 @@ static imgtoolerr_t prodos_lookup_path(imgtool::image &image, const char *path,
|
||||
this_block = direnum->block;
|
||||
this_index = direnum->index;
|
||||
|
||||
err = prodos_get_next_dirent(image, direnum, ent);
|
||||
err = prodos_get_next_dirent(image, direnum, *ent);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
@ -1486,15 +1486,15 @@ static UINT32 prodos_get_storagetype_maxfilesize(UINT8 storage_type)
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t prodos_diskimage_beginenum(imgtool::directory *enumeration, const char *path)
|
||||
static imgtoolerr_t prodos_diskimage_beginenum(imgtool::directory &enumeration, const char *path)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image &image(enumeration->image());
|
||||
imgtool::image &image(enumeration.image());
|
||||
prodos_direnum *appleenum;
|
||||
prodos_dirent ent;
|
||||
UINT16 block = ROOTDIR_BLOCK;
|
||||
|
||||
appleenum = (prodos_direnum *) enumeration->extra_bytes();
|
||||
appleenum = (prodos_direnum *) enumeration.extra_bytes();
|
||||
|
||||
/* find subdirectory, if appropriate */
|
||||
if (*path)
|
||||
@ -1520,19 +1520,19 @@ static imgtoolerr_t prodos_diskimage_beginenum(imgtool::directory *enumeration,
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t prodos_diskimage_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t prodos_diskimage_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image &image(enumeration->image());
|
||||
imgtool::image &image(enumeration.image());
|
||||
prodos_direnum *appleenum;
|
||||
prodos_dirent pd_ent;
|
||||
UINT32 max_filesize;
|
||||
|
||||
appleenum = (prodos_direnum *) enumeration->extra_bytes();
|
||||
appleenum = (prodos_direnum *) enumeration.extra_bytes();
|
||||
|
||||
do
|
||||
{
|
||||
err = prodos_get_next_dirent(image, appleenum, &pd_ent);
|
||||
err = prodos_get_next_dirent(image, appleenum, pd_ent);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
@ -1543,24 +1543,24 @@ static imgtoolerr_t prodos_diskimage_nextenum(imgtool::directory *enumeration, i
|
||||
/* end of file? */
|
||||
if (pd_ent.storage_type == 0x00)
|
||||
{
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
strcpy(ent->filename, pd_ent.filename);
|
||||
ent->directory = is_dir_storagetype(pd_ent.storage_type);
|
||||
ent->creation_time = prodos_crack_time(pd_ent.creation_time);
|
||||
ent->lastmodified_time = prodos_crack_time(pd_ent.lastmodified_time);
|
||||
strcpy(ent.filename, pd_ent.filename);
|
||||
ent.directory = is_dir_storagetype(pd_ent.storage_type);
|
||||
ent.creation_time = prodos_crack_time(pd_ent.creation_time);
|
||||
ent.lastmodified_time = prodos_crack_time(pd_ent.lastmodified_time);
|
||||
|
||||
if (!ent->directory)
|
||||
if (!ent.directory)
|
||||
{
|
||||
ent->filesize = pd_ent.filesize[0];
|
||||
ent.filesize = pd_ent.filesize[0];
|
||||
|
||||
max_filesize = prodos_get_storagetype_maxfilesize(pd_ent.storage_type);
|
||||
if (ent->filesize > max_filesize)
|
||||
if (ent.filesize > max_filesize)
|
||||
{
|
||||
ent->corrupt = 1;
|
||||
ent->filesize = max_filesize;
|
||||
ent.corrupt = 1;
|
||||
ent.filesize = max_filesize;
|
||||
}
|
||||
}
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
|
@ -462,33 +462,33 @@ static void datapack_close(imgtool::image &image)
|
||||
delete pack->stream;
|
||||
}
|
||||
|
||||
static imgtoolerr_t datapack_begin_enum(imgtool::directory *enumeration, const char *path)
|
||||
static imgtoolerr_t datapack_begin_enum(imgtool::directory &enumeration, const char *path)
|
||||
{
|
||||
psion_iter *iter = (psion_iter*)enumeration->extra_bytes();
|
||||
psion_iter *iter = (psion_iter*)enumeration.extra_bytes();
|
||||
iter->index = 0;
|
||||
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t datapack_next_enum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t datapack_next_enum(imgtool::directory &enumeration, imgtool_dirent &ent)
|
||||
{
|
||||
imgtool::image &image(enumeration->image());
|
||||
imgtool::image &image(enumeration.image());
|
||||
psion_pack *pack = get_psion_pack(image);
|
||||
psion_iter *iter = (psion_iter*)enumeration->extra_bytes();
|
||||
psion_iter *iter = (psion_iter*)enumeration.extra_bytes();
|
||||
UINT8 data = 0;
|
||||
|
||||
if (!pack->pack_index[iter->index].name_rec)
|
||||
{
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
memcpy(ent->filename, pack->pack_index[iter->index].filename, 8);
|
||||
sprintf(ent->attr, "Type: %02x ID: %02x", pack->pack_index[iter->index].type, pack->pack_index[iter->index].id);
|
||||
memcpy(ent.filename, pack->pack_index[iter->index].filename, 8);
|
||||
sprintf(ent.attr, "Type: %02x ID: %02x", pack->pack_index[iter->index].type, pack->pack_index[iter->index].id);
|
||||
|
||||
if (pack->pack_index[iter->index].data_rec)
|
||||
{
|
||||
pack->stream->seek(pack->pack_index[iter->index].data_rec + 2, SEEK_SET);
|
||||
ent->filesize = get_long_rec_size(*pack->stream);
|
||||
ent.filesize = get_long_rec_size(*pack->stream);
|
||||
}
|
||||
|
||||
// seek all file's records
|
||||
@ -499,7 +499,7 @@ static imgtoolerr_t datapack_next_enum(imgtool::directory *enumeration, imgtool_
|
||||
{
|
||||
pack->stream->read(&data, 1);
|
||||
pack->stream->seek(data + 1, SEEK_CUR);
|
||||
ent->filesize +=data;
|
||||
ent.filesize +=data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -507,10 +507,6 @@ static imgtoolerr_t datapack_next_enum(imgtool::directory *enumeration, imgtool_
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static void datapack_close_enum( imgtool::directory *enumeration)
|
||||
{
|
||||
}
|
||||
|
||||
static imgtoolerr_t datapack_free_space(imgtool::partition &partition, UINT64 *size)
|
||||
{
|
||||
imgtool::image &image(partition.image());
|
||||
@ -679,7 +675,6 @@ void psion_get_info( const imgtool_class *imgclass, UINT32 state, union imgtooli
|
||||
case IMGTOOLINFO_PTR_CLOSE : info->close = datapack_close; break;
|
||||
case IMGTOOLINFO_PTR_BEGIN_ENUM : info->begin_enum = datapack_begin_enum; break;
|
||||
case IMGTOOLINFO_PTR_NEXT_ENUM : info->next_enum = datapack_next_enum; break;
|
||||
case IMGTOOLINFO_PTR_CLOSE_ENUM : info->close_enum = datapack_close_enum; break;
|
||||
case IMGTOOLINFO_PTR_FREE_SPACE : info->free_space = datapack_free_space; break;
|
||||
case IMGTOOLINFO_PTR_READ_FILE : info->read_file = datapack_read_file; break;
|
||||
case IMGTOOLINFO_PTR_WRITE_FILE : info->write_file = datapack_write_file; break;
|
||||
|
@ -262,7 +262,7 @@ static imgtoolerr_t prepare_dirent(struct rsdos_dirent *ent, const char *fname)
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t rsdos_diskimage_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t rsdos_diskimage_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent)
|
||||
{
|
||||
floperr_t ferr;
|
||||
imgtoolerr_t err;
|
||||
@ -271,8 +271,8 @@ static imgtoolerr_t rsdos_diskimage_nextenum(imgtool::directory *enumeration, im
|
||||
struct rsdos_dirent rsent;
|
||||
char fname[13];
|
||||
|
||||
imgtool::image &image(enumeration->image());
|
||||
rsenum = (struct rsdos_direnum *) enumeration->extra_bytes();
|
||||
imgtool::image &image(enumeration.image());
|
||||
rsenum = (struct rsdos_direnum *) enumeration.extra_bytes();
|
||||
|
||||
/* Did we hit the end of file before? */
|
||||
if (rsenum->eof)
|
||||
@ -294,7 +294,7 @@ static imgtoolerr_t rsdos_diskimage_nextenum(imgtool::directory *enumeration, im
|
||||
{
|
||||
rsenum->eof = 1;
|
||||
eof:
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -306,20 +306,20 @@ eof:
|
||||
if (filesize == ((size_t) -1))
|
||||
{
|
||||
/* corrupt! */
|
||||
ent->filesize = 0;
|
||||
ent->corrupt = 1;
|
||||
ent.filesize = 0;
|
||||
ent.corrupt = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ent->filesize = filesize;
|
||||
ent->corrupt = 0;
|
||||
ent.filesize = filesize;
|
||||
ent.corrupt = 0;
|
||||
}
|
||||
ent->eof = 0;
|
||||
ent.eof = 0;
|
||||
|
||||
get_dirent_fname(fname, &rsent);
|
||||
|
||||
snprintf(ent->filename, ARRAY_LENGTH(ent->filename), "%s", fname);
|
||||
snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%d %c", (int) rsent.ftype, (char) (rsent.asciiflag + 'B'));
|
||||
snprintf(ent.filename, ARRAY_LENGTH(ent.filename), "%s", fname);
|
||||
snprintf(ent.attr, ARRAY_LENGTH(ent.attr), "%d %c", (int) rsent.ftype, (char) (rsent.asciiflag + 'B'));
|
||||
}
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
@ -893,22 +893,21 @@ static imgtoolerr_t thom_open_partition(imgtool::partition &part,
|
||||
}
|
||||
|
||||
|
||||
static imgtoolerr_t thom_begin_enum(imgtool::directory *enumeration,
|
||||
static imgtoolerr_t thom_begin_enum(imgtool::directory &enumeration,
|
||||
const char *path)
|
||||
{
|
||||
int* n = (int*) enumeration->extra_bytes();
|
||||
int* n = (int*) enumeration.extra_bytes();
|
||||
*n = 0;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t thom_next_enum(imgtool::directory *enumeration,
|
||||
imgtool_dirent *ent)
|
||||
static imgtoolerr_t thom_next_enum(imgtool::directory &enumeration, imgtool_dirent &ent)
|
||||
{
|
||||
imgtool::partition &part(enumeration->partition());
|
||||
imgtool::partition &part(enumeration.partition());
|
||||
int head = *( (int*) part.extra_bytes() );
|
||||
imgtool::image &img(part.image());
|
||||
thom_floppy* f = get_thom_floppy(img);
|
||||
int* n = (int*) enumeration->extra_bytes();
|
||||
int* n = (int*) enumeration.extra_bytes();
|
||||
thom_dirent d;
|
||||
|
||||
do {
|
||||
@ -916,24 +915,24 @@ static imgtoolerr_t thom_next_enum(imgtool::directory *enumeration,
|
||||
(*n) ++;
|
||||
}
|
||||
while ( d.type == THOM_DIRENT_FREE );
|
||||
if ( d.type == THOM_DIRENT_END ) ent->eof = 1;
|
||||
if ( d.type == THOM_DIRENT_END ) ent.eof = 1;
|
||||
else if ( d.type == THOM_DIRENT_INVALID ) {
|
||||
ent->corrupt = 1;
|
||||
ent.corrupt = 1;
|
||||
}
|
||||
else {
|
||||
int size;
|
||||
snprintf( ent->filename, sizeof(ent->filename), "%s.%s", d.name, d.ext );
|
||||
snprintf( ent->attr, sizeof(ent->attr), "%c %c %s",
|
||||
snprintf( ent.filename, sizeof(ent.filename), "%s.%s", d.name, d.ext );
|
||||
snprintf( ent.attr, sizeof(ent.attr), "%c %c %s",
|
||||
(d.ftype == 0) ? 'B' : (d.ftype == 1) ? 'D' :
|
||||
(d.ftype == 2) ? 'M' : (d.ftype == 3) ? 'A' : '?',
|
||||
(d.format == 0) ? 'B' : (d.format == 0xff) ? 'A' : '?',
|
||||
d.comment );
|
||||
ent->creation_time = thom_crack_time( &d );
|
||||
ent.creation_time = thom_crack_time( &d );
|
||||
size = thom_get_file_size( f, head, &d );
|
||||
if ( size >= 0 ) ent->filesize = size;
|
||||
if ( size >= 0 ) ent.filesize = size;
|
||||
else {
|
||||
ent->filesize = 0;
|
||||
ent->corrupt = 1;
|
||||
ent.filesize = 0;
|
||||
ent.corrupt = 1;
|
||||
}
|
||||
}
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
|
@ -3860,10 +3860,10 @@ static imgtoolerr_t dsk_image_init_pc99_mfm(imgtool::image &image, imgtool::stre
|
||||
static imgtoolerr_t win_image_init(imgtool::image &image, imgtool::stream::ptr &&stream);
|
||||
static void ti99_image_exit(imgtool::image &img);
|
||||
static void ti99_image_info(imgtool::image &img, char *string, size_t len);
|
||||
static imgtoolerr_t dsk_image_beginenum(imgtool::directory *enumeration, const char *path);
|
||||
static imgtoolerr_t dsk_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent);
|
||||
static imgtoolerr_t win_image_beginenum(imgtool::directory *enumeration, const char *path);
|
||||
static imgtoolerr_t win_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent);
|
||||
static imgtoolerr_t dsk_image_beginenum(imgtool::directory &enumeration, const char *path);
|
||||
static imgtoolerr_t dsk_image_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent);
|
||||
static imgtoolerr_t win_image_beginenum(imgtool::directory &enumeration, const char *path);
|
||||
static imgtoolerr_t win_image_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent);
|
||||
static imgtoolerr_t ti99_image_freespace(imgtool::partition &partition, UINT64 *size);
|
||||
static imgtoolerr_t ti99_image_readfile(imgtool::partition &partition, const char *fpath, const char *fork, imgtool::stream &destf);
|
||||
static imgtoolerr_t ti99_image_writefile(imgtool::partition &partition, const char *fpath, const char *fork, imgtool::stream &sourcef, util::option_resolution *writeoptions);
|
||||
@ -4214,10 +4214,10 @@ static void ti99_image_info(imgtool::image &img, char *string, size_t len)
|
||||
/*
|
||||
Open the disk catalog for enumeration
|
||||
*/
|
||||
static imgtoolerr_t dsk_image_beginenum(imgtool::directory *enumeration, const char *path)
|
||||
static imgtoolerr_t dsk_image_beginenum(imgtool::directory &enumeration, const char *path)
|
||||
{
|
||||
struct ti99_lvl2_imgref *image = get_lvl2_imgref(enumeration->image());
|
||||
dsk_iterator *iter = (dsk_iterator *) enumeration->extra_bytes();
|
||||
struct ti99_lvl2_imgref *image = get_lvl2_imgref(enumeration.image());
|
||||
dsk_iterator *iter = (dsk_iterator *) enumeration.extra_bytes();
|
||||
|
||||
iter->image = image;
|
||||
iter->level = 0;
|
||||
@ -4231,16 +4231,16 @@ static imgtoolerr_t dsk_image_beginenum(imgtool::directory *enumeration, const c
|
||||
/*
|
||||
Enumerate disk catalog next entry
|
||||
*/
|
||||
static imgtoolerr_t dsk_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t dsk_image_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent)
|
||||
{
|
||||
dsk_iterator *iter = (dsk_iterator*) enumeration->extra_bytes();
|
||||
dsk_iterator *iter = (dsk_iterator*) enumeration.extra_bytes();
|
||||
dsk_fdr fdr;
|
||||
int reply;
|
||||
unsigned fdr_aphysrec;
|
||||
|
||||
|
||||
ent->corrupt = 0;
|
||||
ent->eof = 0;
|
||||
ent.corrupt = 0;
|
||||
ent.eof = 0;
|
||||
|
||||
/* iterate through catalogs to next file or dir entry */
|
||||
while ((iter->level >= 0)
|
||||
@ -4269,21 +4269,21 @@ static imgtoolerr_t dsk_image_nextenum(imgtool::directory *enumeration, imgtool_
|
||||
|
||||
if (iter->level < 0)
|
||||
{
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iter->listing_subdirs)
|
||||
{
|
||||
fname_to_str(ent->filename, iter->image->dsk.catalogs[0].subdirs[iter->index[iter->level]].name, ARRAY_LENGTH(ent->filename));
|
||||
fname_to_str(ent.filename, iter->image->dsk.catalogs[0].subdirs[iter->index[iter->level]].name, ARRAY_LENGTH(ent.filename));
|
||||
|
||||
/* set type of DIR */
|
||||
snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "DIR");
|
||||
snprintf(ent.attr, ARRAY_LENGTH(ent.attr), "DIR");
|
||||
|
||||
/* len in physrecs */
|
||||
/* @BN@ return length in bytes */
|
||||
/* ent->filesize = 1; */
|
||||
ent->filesize = 256;
|
||||
/* ent.filesize = 1; */
|
||||
ent.filesize = 256;
|
||||
|
||||
/* recurse subdirectory */
|
||||
iter->listing_subdirs = 0; /* no need to list subdirs as only the
|
||||
@ -4299,35 +4299,35 @@ static imgtoolerr_t dsk_image_nextenum(imgtool::directory *enumeration, imgtool_
|
||||
if (reply)
|
||||
return IMGTOOLERR_READERROR;
|
||||
#if 0
|
||||
fname_to_str(ent->filename, fdr.name, ARRAY_LENGTH(ent->filename));
|
||||
fname_to_str(ent.filename, fdr.name, ARRAY_LENGTH(ent.filename));
|
||||
#else
|
||||
{
|
||||
char buf[11];
|
||||
|
||||
ent->filename[0] = '\0';
|
||||
ent.filename[0] = '\0';
|
||||
if (iter->level)
|
||||
{
|
||||
fname_to_str(ent->filename, iter->image->dsk.catalogs[0].subdirs[iter->index[0]].name, ARRAY_LENGTH(ent->filename));
|
||||
strncat(ent->filename, ".", ARRAY_LENGTH(ent->filename) - 1);
|
||||
fname_to_str(ent.filename, iter->image->dsk.catalogs[0].subdirs[iter->index[0]].name, ARRAY_LENGTH(ent.filename));
|
||||
strncat(ent.filename, ".", ARRAY_LENGTH(ent.filename) - 1);
|
||||
}
|
||||
fname_to_str(buf, fdr.name, 11);
|
||||
strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1);
|
||||
strncat(ent.filename, buf, ARRAY_LENGTH(ent.filename) - 1);
|
||||
}
|
||||
#endif
|
||||
/* parse flags */
|
||||
if (fdr.flags & fdr99_f_program)
|
||||
snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "PGM%s",
|
||||
snprintf(ent.attr, ARRAY_LENGTH(ent.attr), "PGM%s",
|
||||
(fdr.flags & fdr99_f_wp) ? " R/O" : "");
|
||||
else
|
||||
snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%c/%c %d%s",
|
||||
snprintf(ent.attr, ARRAY_LENGTH(ent.attr), "%c/%c %d%s",
|
||||
(fdr.flags & fdr99_f_int) ? 'I' : 'D',
|
||||
(fdr.flags & fdr99_f_var) ? 'V' : 'F',
|
||||
fdr.reclen,
|
||||
(fdr.flags & fdr99_f_wp) ? " R/O" : "");
|
||||
/* len in physrecs */
|
||||
/* @BN@ return length in bytes */
|
||||
/* ent->filesize = get_UINT16BE(fdr.fphysrecs); */
|
||||
ent->filesize = (get_UINT16BE(fdr.fphysrecs)+1)*256;
|
||||
/* ent.filesize = get_UINT16BE(fdr.fphysrecs); */
|
||||
ent.filesize = (get_UINT16BE(fdr.fphysrecs)+1)*256;
|
||||
|
||||
iter->index[iter->level]++;
|
||||
}
|
||||
@ -4339,10 +4339,10 @@ static imgtoolerr_t dsk_image_nextenum(imgtool::directory *enumeration, imgtool_
|
||||
/*
|
||||
Open the disk catalog for enumeration
|
||||
*/
|
||||
static imgtoolerr_t win_image_beginenum(imgtool::directory *enumeration, const char *path)
|
||||
static imgtoolerr_t win_image_beginenum(imgtool::directory &enumeration, const char *path)
|
||||
{
|
||||
struct ti99_lvl2_imgref *image = get_lvl2_imgref(enumeration->image());
|
||||
win_iterator *iter = (win_iterator *) enumeration->extra_bytes();
|
||||
struct ti99_lvl2_imgref *image = get_lvl2_imgref(enumeration.image());
|
||||
win_iterator *iter = (win_iterator *) enumeration.extra_bytes();
|
||||
imgtoolerr_t errorcode;
|
||||
|
||||
iter->image = image;
|
||||
@ -4359,17 +4359,17 @@ static imgtoolerr_t win_image_beginenum(imgtool::directory *enumeration, const c
|
||||
/*
|
||||
Enumerate disk catalog next entry
|
||||
*/
|
||||
static imgtoolerr_t win_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t win_image_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent)
|
||||
{
|
||||
win_iterator *iter = (win_iterator *) enumeration->extra_bytes();
|
||||
win_iterator *iter = (win_iterator *) enumeration.extra_bytes();
|
||||
unsigned fdr_aphysrec;
|
||||
win_fdr fdr;
|
||||
int reply;
|
||||
int i;
|
||||
|
||||
|
||||
ent->corrupt = 0;
|
||||
ent->eof = 0;
|
||||
ent.corrupt = 0;
|
||||
ent.eof = 0;
|
||||
|
||||
/* iterate through catalogs to next file or dir entry */
|
||||
while ((iter->level >= 0)
|
||||
@ -4392,37 +4392,37 @@ static imgtoolerr_t win_image_nextenum(imgtool::directory *enumeration, imgtool_
|
||||
|
||||
if (iter->level < 0)
|
||||
{
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iter->listing_subdirs)
|
||||
{
|
||||
#if 0
|
||||
fname_to_str(ent->filename, iter->catalog[iter->level].subdirs[iter->index[iter->level]].name, ARRAY_LENGTH(ent->filename));
|
||||
fname_to_str(ent.filename, iter->catalog[iter->level].subdirs[iter->index[iter->level]].name, ARRAY_LENGTH(ent.filename));
|
||||
#else
|
||||
{
|
||||
char buf[11];
|
||||
|
||||
ent->filename[0] = '\0';
|
||||
ent.filename[0] = '\0';
|
||||
for (i=0; i<iter->level; i++)
|
||||
{
|
||||
fname_to_str(buf, iter->catalog[i].subdirs[iter->index[i]].name, 11);
|
||||
strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1);
|
||||
strncat(ent->filename, ".", ARRAY_LENGTH(ent->filename) - 1);
|
||||
strncat(ent.filename, buf, ARRAY_LENGTH(ent.filename) - 1);
|
||||
strncat(ent.filename, ".", ARRAY_LENGTH(ent.filename) - 1);
|
||||
}
|
||||
fname_to_str(buf, iter->catalog[iter->level].subdirs[iter->index[iter->level]].name, 11);
|
||||
strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1);
|
||||
strncat(ent.filename, buf, ARRAY_LENGTH(ent.filename) - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* set type of DIR */
|
||||
snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "DIR");
|
||||
snprintf(ent.attr, ARRAY_LENGTH(ent.attr), "DIR");
|
||||
|
||||
/* len in physrecs */
|
||||
/* @BN@ return length in bytes */
|
||||
/* ent->filesize = 2; */
|
||||
ent->filesize = 512;
|
||||
/* ent.filesize = 2; */
|
||||
ent.filesize = 512;
|
||||
|
||||
/* recurse subdirectory */
|
||||
/*iter->listing_subdirs = 1;*/
|
||||
@ -4431,7 +4431,7 @@ static imgtoolerr_t win_image_nextenum(imgtool::directory *enumeration, imgtool_
|
||||
reply = win_read_catalog(iter->image, iter->catalog[iter->level-1].subdirs[iter->index[iter->level-1]].dir_ptr, &iter->catalog[iter->level]);
|
||||
if (reply)
|
||||
{
|
||||
ent->corrupt = 1;
|
||||
ent.corrupt = 1;
|
||||
return (imgtoolerr_t)reply;
|
||||
}
|
||||
}
|
||||
@ -4442,36 +4442,36 @@ static imgtoolerr_t win_image_nextenum(imgtool::directory *enumeration, imgtool_
|
||||
if (reply)
|
||||
return IMGTOOLERR_READERROR;
|
||||
#if 0
|
||||
fname_to_str(ent->filename, iter->catalog[iter->level].files[iter->index[iter->level]].name, ARRAY_LENGTH(ent->filename));
|
||||
fname_to_str(ent.filename, iter->catalog[iter->level].files[iter->index[iter->level]].name, ARRAY_LENGTH(ent.filename));
|
||||
#else
|
||||
{
|
||||
char buf[11];
|
||||
|
||||
ent->filename[0] = '\0';
|
||||
ent.filename[0] = '\0';
|
||||
for (i=0; i<iter->level; i++)
|
||||
{
|
||||
fname_to_str(buf, iter->catalog[i].subdirs[iter->index[i]].name, 11);
|
||||
strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1);
|
||||
strncat(ent->filename, ".", ARRAY_LENGTH(ent->filename) - 1);
|
||||
strncat(ent.filename, buf, ARRAY_LENGTH(ent.filename) - 1);
|
||||
strncat(ent.filename, ".", ARRAY_LENGTH(ent.filename) - 1);
|
||||
}
|
||||
fname_to_str(buf, iter->catalog[iter->level].files[iter->index[iter->level]].name, 11);
|
||||
strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1);
|
||||
strncat(ent.filename, buf, ARRAY_LENGTH(ent.filename) - 1);
|
||||
}
|
||||
#endif
|
||||
/* parse flags */
|
||||
if (fdr.flags & fdr99_f_program)
|
||||
snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "PGM%s",
|
||||
snprintf(ent.attr, ARRAY_LENGTH(ent.attr), "PGM%s",
|
||||
(fdr.flags & fdr99_f_wp) ? " R/O" : "");
|
||||
else
|
||||
snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%c/%c %d%s",
|
||||
snprintf(ent.attr, ARRAY_LENGTH(ent.attr), "%c/%c %d%s",
|
||||
(fdr.flags & fdr99_f_int) ? 'I' : 'D',
|
||||
(fdr.flags & fdr99_f_var) ? 'V' : 'F',
|
||||
fdr.reclen,
|
||||
(fdr.flags & fdr99_f_wp) ? " R/O" : "");
|
||||
/* len in physrecs */
|
||||
/* @BN@ return length in bytes */
|
||||
/* ent->filesize = get_win_fdr_fphysrecs(&fdr); */
|
||||
ent->filesize = (get_win_fdr_fphysrecs(&fdr)+1)*256;
|
||||
/* ent.filesize = get_win_fdr_fphysrecs(&fdr); */
|
||||
ent.filesize = (get_win_fdr_fphysrecs(&fdr)+1)*256;
|
||||
|
||||
iter->index[iter->level]++;
|
||||
}
|
||||
|
@ -394,9 +394,9 @@ static ti990_image *get_ti990_image(imgtool::image &image)
|
||||
static imgtoolerr_t ti990_image_init(imgtool::image &img, imgtool::stream::ptr &&stream);
|
||||
static void ti990_image_exit(imgtool::image &img);
|
||||
static void ti990_image_info(imgtool::image &img, char *string, size_t len);
|
||||
static imgtoolerr_t ti990_image_beginenum(imgtool::directory *enumeration, const char *path);
|
||||
static imgtoolerr_t ti990_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent);
|
||||
static void ti990_image_closeenum(imgtool::directory *enumeration);
|
||||
static imgtoolerr_t ti990_image_beginenum(imgtool::directory &enumeration, const char *path);
|
||||
static imgtoolerr_t ti990_image_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent);
|
||||
static void ti990_image_closeenum(imgtool::directory &enumeration);
|
||||
static imgtoolerr_t ti990_image_freespace(imgtool::partition &partition, UINT64 *size);
|
||||
#ifdef UNUSED_FUNCTION
|
||||
static imgtoolerr_t ti990_image_readfile(imgtool::partition &partition, const char *fpath, imgtool::stream *destf);
|
||||
@ -1192,10 +1192,10 @@ static void ti990_image_info(imgtool::image &img, char *string, size_t len)
|
||||
/*
|
||||
Open the disk catalog for enumeration
|
||||
*/
|
||||
static imgtoolerr_t ti990_image_beginenum(imgtool::directory *enumeration, const char *path)
|
||||
static imgtoolerr_t ti990_image_beginenum(imgtool::directory &enumeration, const char *path)
|
||||
{
|
||||
ti990_image *image = (ti990_image *) enumeration->image().extra_bytes();
|
||||
ti990_iterator *iter = (ti990_iterator *) enumeration->extra_bytes();
|
||||
ti990_image *image = (ti990_image *) enumeration.image().extra_bytes();
|
||||
ti990_iterator *iter = (ti990_iterator *) enumeration.extra_bytes();
|
||||
ti990_dor dor;
|
||||
int reply;
|
||||
|
||||
@ -1218,15 +1218,15 @@ static imgtoolerr_t ti990_image_beginenum(imgtool::directory *enumeration, const
|
||||
/*
|
||||
Enumerate disk catalog next entry
|
||||
*/
|
||||
static imgtoolerr_t ti990_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t ti990_image_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent)
|
||||
{
|
||||
ti990_iterator *iter = (ti990_iterator *) enumeration->extra_bytes();
|
||||
ti990_iterator *iter = (ti990_iterator *) enumeration.extra_bytes();
|
||||
int flag;
|
||||
int reply = 0;
|
||||
|
||||
|
||||
ent->corrupt = 0;
|
||||
ent->eof = 0;
|
||||
ent.corrupt = 0;
|
||||
ent.eof = 0;
|
||||
|
||||
while ((iter->level >= 0)
|
||||
&& (! (reply = read_sector_logical_len(*iter->image->file_handle,
|
||||
@ -1244,28 +1244,28 @@ static imgtoolerr_t ti990_image_nextenum(imgtool::directory *enumeration, imgtoo
|
||||
|
||||
if (iter->level < 0)
|
||||
{
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
}
|
||||
else if (reply)
|
||||
return IMGTOOLERR_READERROR;
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
fname_to_str(ent->filename, iter->xdr[iter->level].fdr.fnm, ARRAY_LENGTH(ent->filename));
|
||||
fname_to_str(ent.filename, iter->xdr[iter->level].fdr.fnm, ARRAY_LENGTH(ent.filename));
|
||||
#else
|
||||
{
|
||||
int i;
|
||||
char buf[9];
|
||||
|
||||
ent->filename[0] = '\0';
|
||||
ent.filename[0] = '\0';
|
||||
for (i=0; i<iter->level; i++)
|
||||
{
|
||||
fname_to_str(buf, iter->xdr[i].fdr.fnm, 9);
|
||||
strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1);
|
||||
strncat(ent->filename, ".", ARRAY_LENGTH(ent->filename) - 1);
|
||||
strncat(ent.filename, buf, ARRAY_LENGTH(ent.filename) - 1);
|
||||
strncat(ent.filename, ".", ARRAY_LENGTH(ent.filename) - 1);
|
||||
}
|
||||
fname_to_str(buf, iter->xdr[iter->level].fdr.fnm, 9);
|
||||
strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1);
|
||||
strncat(ent.filename, buf, ARRAY_LENGTH(ent.filename) - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1273,9 +1273,9 @@ static imgtoolerr_t ti990_image_nextenum(imgtool::directory *enumeration, imgtoo
|
||||
flag = get_UINT16BE(iter->xdr[iter->level].fdr.flg);
|
||||
if (flag & fdr_flg_cdr)
|
||||
{
|
||||
snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "CHANNEL");
|
||||
snprintf(ent.attr, ARRAY_LENGTH(ent.attr), "CHANNEL");
|
||||
|
||||
ent->filesize = 0;
|
||||
ent.filesize = 0;
|
||||
}
|
||||
else if (flag & fdr_flg_ali)
|
||||
{
|
||||
@ -1291,9 +1291,9 @@ static imgtoolerr_t ti990_image_nextenum(imgtool::directory *enumeration, imgtoo
|
||||
|
||||
fname_to_str(buf, target_fdr.fnm, 9);
|
||||
|
||||
snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "ALIAS OF %s", buf);
|
||||
snprintf(ent.attr, ARRAY_LENGTH(ent.attr), "ALIAS OF %s", buf);
|
||||
|
||||
ent->filesize = 0;
|
||||
ent.filesize = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1341,7 +1341,7 @@ static imgtoolerr_t ti990_image_nextenum(imgtool::directory *enumeration, imgtoo
|
||||
}
|
||||
break;
|
||||
}
|
||||
snprintf(ent->attr, ARRAY_LENGTH(ent->attr),
|
||||
snprintf(ent.attr, ARRAY_LENGTH(ent.attr),
|
||||
"%s %c %s%s%s%s%s", fmt, (flag & fdr_flg_all) ? 'N' : 'C', type,
|
||||
(flag & fdr_flg_blb) ? "" : " BLK",
|
||||
(flag & fdr_flg_tmp) ? " TMP" : "",
|
||||
@ -1349,17 +1349,17 @@ static imgtoolerr_t ti990_image_nextenum(imgtool::directory *enumeration, imgtoo
|
||||
(flag & fdr_flg_dpb) ? " DPT" : "");
|
||||
|
||||
/* len in blocks */
|
||||
ent->filesize = get_UINT32BE(iter->xdr[iter->level].fdr.bkm);
|
||||
ent.filesize = get_UINT32BE(iter->xdr[iter->level].fdr.bkm);
|
||||
if ((((flag >> fdr_flg_ft_shift) & 3) == 3) || get_UINT16BE(iter->xdr[iter->level].fdr.ofm))
|
||||
ent->filesize++;
|
||||
ent.filesize++;
|
||||
|
||||
/* convert to ADUs */
|
||||
if (iter->xdr[iter->level].fdr.apb > 1)
|
||||
/* more than one ADU per block */
|
||||
ent->filesize *= iter->xdr[iter->level].fdr.apb;
|
||||
ent.filesize *= iter->xdr[iter->level].fdr.apb;
|
||||
else if (iter->xdr[iter->level].fdr.bpa > 1)
|
||||
/* more than one block per ADU */
|
||||
ent->filesize = (ent->filesize + iter->xdr[iter->level].fdr.bpa - 1) / iter->xdr[iter->level].fdr.bpa;
|
||||
ent.filesize = (ent.filesize + iter->xdr[iter->level].fdr.bpa - 1) / iter->xdr[iter->level].fdr.bpa;
|
||||
}
|
||||
iter->index[iter->level]++;
|
||||
|
||||
@ -1412,7 +1412,7 @@ static imgtoolerr_t ti990_image_nextenum(imgtool::directory *enumeration, imgtoo
|
||||
/*
|
||||
Free enumerator
|
||||
*/
|
||||
static void ti990_image_closeenum(imgtool::directory *enumeration)
|
||||
static void ti990_image_closeenum(imgtool::directory &enumeration)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -385,11 +385,11 @@ static imgtoolerr_t vzdos_write_formatted_sector(imgtool::image &img, int track,
|
||||
Imgtool module code
|
||||
*********************************************************************/
|
||||
|
||||
static imgtoolerr_t vzdos_diskimage_beginenum(imgtool::directory *enumeration, const char *path)
|
||||
static imgtoolerr_t vzdos_diskimage_beginenum(imgtool::directory &enumeration, const char *path)
|
||||
{
|
||||
vz_iterator *iter;
|
||||
|
||||
iter = (vz_iterator *) enumeration->extra_bytes();
|
||||
iter = (vz_iterator *) enumeration.extra_bytes();
|
||||
if (!iter) return IMGTOOLERR_OUTOFMEMORY;
|
||||
|
||||
iter->index = 1;
|
||||
@ -398,29 +398,29 @@ static imgtoolerr_t vzdos_diskimage_beginenum(imgtool::directory *enumeration, c
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t vzdos_diskimage_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t vzdos_diskimage_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent)
|
||||
{
|
||||
vz_iterator *iter = (vz_iterator *) enumeration->extra_bytes();
|
||||
vz_iterator *iter = (vz_iterator *) enumeration.extra_bytes();
|
||||
|
||||
if (iter->eof == 1 || iter->index > MAX_DIRENTS) {
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
|
||||
} else {
|
||||
const char *type;
|
||||
int ret, len;
|
||||
vzdos_dirent dirent;
|
||||
|
||||
ret = vzdos_get_dirent(enumeration->image(), iter->index - 1, &dirent);
|
||||
ret = vzdos_get_dirent(enumeration.image(), iter->index - 1, &dirent);
|
||||
|
||||
if (ret == IMGTOOLERR_FILENOTFOUND)
|
||||
{
|
||||
iter->eof = 1;
|
||||
ent->eof = 1;
|
||||
ent.eof = 1;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
if (ret == IMGTOOLERR_CORRUPTFILE)
|
||||
ent->corrupt = 1;
|
||||
ent.corrupt = 1;
|
||||
|
||||
/* kill trailing spaces */
|
||||
for (len = 7; len > 0; len--) {
|
||||
@ -429,8 +429,8 @@ static imgtoolerr_t vzdos_diskimage_nextenum(imgtool::directory *enumeration, im
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(ent->filename, &dirent.fname, len + 1);
|
||||
ent->filesize = dirent.end_address - dirent.start_address;
|
||||
memcpy(ent.filename, &dirent.fname, len + 1);
|
||||
ent.filesize = dirent.end_address - dirent.start_address;
|
||||
|
||||
switch (dirent.ftype)
|
||||
{
|
||||
@ -445,7 +445,7 @@ static imgtoolerr_t vzdos_diskimage_nextenum(imgtool::directory *enumeration, im
|
||||
default: type = "Unknown";
|
||||
}
|
||||
|
||||
snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%s", type);
|
||||
snprintf(ent.attr, ARRAY_LENGTH(ent.attr), "%s", type);
|
||||
|
||||
iter->index++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user