[Imgtool] Fix to MT#6576 (#2275)

* [Imgtool] Fixed issue with 'listfilters' command

* [Imgtool] Extremely basic fix to the Imgtool <==> CHD HD bridge

This really needs _much_ more work
This commit is contained in:
npwoods 2017-05-03 21:22:14 -04:00 committed by Vas Crabb
parent bf0df09e41
commit 19821fa25a
5 changed files with 8 additions and 9 deletions

View File

@ -131,16 +131,15 @@ imgtoolerr_t imghd_open(imgtool::stream &stream, struct mess_hard_disk_file *har
imgtoolerr_t err = IMGTOOLERR_SUCCESS;
hard_disk->hard_disk = nullptr;
hard_disk->chd = nullptr;
chderr = hard_disk->chd->open(*stream.core_file(), stream.is_read_only());
chderr = hard_disk->chd.open(*stream.core_file(), !stream.is_read_only());
if (chderr)
{
err = map_chd_error(chderr);
goto done;
}
hard_disk->hard_disk = hard_disk_open(hard_disk->chd);
hard_disk->hard_disk = hard_disk_open(&hard_disk->chd);
if (!hard_disk->hard_disk)
{
err = IMGTOOLERR_UNEXPECTED;

View File

@ -17,7 +17,7 @@ struct mess_hard_disk_file
{
imgtool::stream *stream;
hard_disk_file *hard_disk;
chd_file *chd;
chd_file chd;
};
@ -25,7 +25,7 @@ struct mess_hard_disk_file
imgtoolerr_t imghd_create(imgtool::stream &stream, uint32_t blocksize, uint32_t cylinders, uint32_t heads, uint32_t sectors, uint32_t seclen);
/* opens a hard disk given an Imgtool stream */
imgtoolerr_t imghd_open(imgtool::stream &stream, struct mess_hard_disk_file *hard_disk);
imgtoolerr_t imghd_open(imgtool::stream &stream, mess_hard_disk_file *hard_disk);
/* close a hard disk */
void imghd_close(struct mess_hard_disk_file *disk);

View File

@ -708,8 +708,8 @@ static int cmd_listfilters(const struct command *c, int argc, char *argv[])
for (i = 0; filters[i]; i++)
{
util::stream_format(std::wcout, L" %-11s%s\n",
filter_get_info_string(filters[i], FILTINFO_STR_NAME),
filter_get_info_string(filters[i], FILTINFO_STR_HUMANNAME));
wstring_from_utf8(filter_get_info_string(filters[i], FILTINFO_STR_NAME)),
wstring_from_utf8(filter_get_info_string(filters[i], FILTINFO_STR_HUMANNAME)));
}
return 0;

View File

@ -492,7 +492,7 @@ uint64_t imgtool::stream::fill(unsigned char b, uint64_t sz)
// is_read_only
//-------------------------------------------------
int imgtool::stream::is_read_only()
bool imgtool::stream::is_read_only()
{
return write_protect;
}

View File

@ -50,7 +50,7 @@ namespace imgtool
static int file_crc(const char *fname, unsigned long *result);
// returns whether a stream is read only or not
int is_read_only();
bool is_read_only();
private:
enum imgtype_t