summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tools/image_handler.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/tools/image_handler.cpp b/src/tools/image_handler.cpp
index 44d7fce7df3..a2083bcbd59 100644
--- a/src/tools/image_handler.cpp
+++ b/src/tools/image_handler.cpp
@@ -139,11 +139,9 @@ const floppy_create_info *formats_table::find_floppy_create_info_by_key(const st
std::vector<u8> image_handler::fload(std::string path)
{
- char msg[4096];
- sprintf(msg, "Error opening %s for reading", path.c_str());
auto fi = fopen(path.c_str(), "rb");
if(!fi) {
- perror(msg);
+ perror(util::string_format("Error opening %s for reading", path).c_str());
exit(1);
}
fseek(fi, 0, SEEK_END);
@@ -182,11 +180,9 @@ std::vector<u8> image_handler::fload_rsrc(std::string path)
void image_handler::fsave(std::string path, const std::vector<u8> &data)
{
- char msg[4096];
- sprintf(msg, "Error opening %s for writing", path.c_str());
auto fo = fopen(path.c_str(), "wb");
if(!fo) {
- perror(msg);
+ perror(util::string_format("Error opening %s for writing", path).c_str());
exit(1);
}
@@ -207,11 +203,9 @@ void image_handler::fsave_rsrc(std::string path, const std::vector<u8> &data)
filesystem_t::w32b(head+0x22, 0x2a); // Offset in the file
filesystem_t::w32b(head+0x26, data.size()); // Length
- char msg[4096];
- sprintf(msg, "Error opening %s for writing", path.c_str());
auto fo = fopen(path.c_str(), "wb");
if(!fo) {
- perror(msg);
+ perror(util::string_format("Error opening %s for writing", path).c_str());
exit(1);
}