mirror of
https://github.com/holub/mame
synced 2025-10-05 16:50:57 +03:00
Imgtool: Changed a pointer to a reference, and fixed a std::string(nullptr) bug
This commit is contained in:
parent
81079946a4
commit
474f7ffd04
@ -261,8 +261,7 @@ void imgtool_warn(const char *format, ...)
|
|||||||
// determine what module can best handle a file
|
// determine what module can best handle a file
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
static imgtoolerr_t evaluate_module(const char *fname,
|
static imgtoolerr_t evaluate_module(const char *fname, const imgtool_module *module, float &result)
|
||||||
const imgtool_module *module, float *result)
|
|
||||||
{
|
{
|
||||||
imgtoolerr_t err;
|
imgtoolerr_t err;
|
||||||
imgtool::image::ptr image;
|
imgtool::image::ptr image;
|
||||||
@ -271,7 +270,7 @@ static imgtoolerr_t evaluate_module(const char *fname,
|
|||||||
imgtool_dirent ent;
|
imgtool_dirent ent;
|
||||||
float current_result;
|
float current_result;
|
||||||
|
|
||||||
*result = 0.0;
|
result = 0.0;
|
||||||
|
|
||||||
err = imgtool::image::open(module, fname, OSD_FOPEN_READ, image);
|
err = imgtool::image::open(module, fname, OSD_FOPEN_READ, image);
|
||||||
if (err)
|
if (err)
|
||||||
@ -285,7 +284,7 @@ static imgtoolerr_t evaluate_module(const char *fname,
|
|||||||
if (err)
|
if (err)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
err = imgtool::directory::open(*partition, nullptr, imageenum);
|
err = imgtool::directory::open(*partition, "", imageenum);
|
||||||
if (err)
|
if (err)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
@ -303,7 +302,7 @@ static imgtoolerr_t evaluate_module(const char *fname,
|
|||||||
}
|
}
|
||||||
while(!ent.eof);
|
while(!ent.eof);
|
||||||
|
|
||||||
*result = current_result;
|
result = current_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
@ -352,7 +351,7 @@ imgtoolerr_t imgtool::image::identify_file(const char *fname, imgtool_module **m
|
|||||||
{
|
{
|
||||||
if (!extension || image_find_extension(module->extensions, extension))
|
if (!extension || image_find_extension(module->extensions, extension))
|
||||||
{
|
{
|
||||||
err = evaluate_module(fname, module.get(), &val);
|
err = evaluate_module(fname, module.get(), val);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user