diff options
author | 2024-05-31 13:36:38 +1000 | |
---|---|---|
committer | 2024-05-31 13:36:38 +1000 | |
commit | b2d602267fd401e909fbf6eb6607ede1e740b3d9 (patch) | |
tree | 0e5f2895804b3baf8184edd0ee41848974261374 /src/emu/image.cpp | |
parent | 1fc7c61a79c3f0299f32e4ceee352189bba44a78 (diff) |
Various cleanups:
* tools/aueffectutil.mm: Fixed more deprecation warnings.
* Got rid of some sprintf and strcat (generates warnings on macOS).
* cpu/mipsx: Got stuff out of headers that shouldn't be there.
Diffstat (limited to 'src/emu/image.cpp')
-rw-r--r-- | src/emu/image.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/emu/image.cpp b/src/emu/image.cpp index 3839a57549b..52e553953a7 100644 --- a/src/emu/image.cpp +++ b/src/emu/image.cpp @@ -181,24 +181,22 @@ void image_manager::config_save(config_type cfg_type, util::xml::data_node *pare int image_manager::write_config(emu_options &options, const char *filename, const game_driver *gamedrv) { - char buffer[128]; - int retval = 1; - - if (gamedrv != nullptr) + std::string buffer; + if (gamedrv) { - sprintf(buffer, "%s.ini", gamedrv->name); - filename = buffer; + buffer.reserve(strlen(gamedrv->name) + 4); + buffer = gamedrv->name; + buffer += ".ini"; + filename = buffer.c_str(); } emu_file file(options.ini_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE); std::error_condition const filerr = file.open(filename); - if (!filerr) - { - std::string inistring = options.output_ini(); - file.puts(inistring); - retval = 0; - } - return retval; + if (filerr) + return 1; + + file.puts(options.output_ini()); + return 0; } /*------------------------------------------------- |