summaryrefslogtreecommitdiffstatshomepage
path: root/src/tools/floptool.cpp
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2023-10-08 09:00:33 -0400
committer AJR <ajrhacker@users.noreply.github.com>2023-10-08 09:02:47 -0400
commit07b3bdd04f9aeb9d1e56b6d03ef998d383153fc6 (patch)
treecca31406789a294b5123d1ed394cdf4579b6aa8a /src/tools/floptool.cpp
parentdb48a71d4fe2c0331b4a4475aa4ec602e6896091 (diff)
Floppy format API refinements
- Add noexcept to format information overrides and several simple floppy_image accessors. - Be more const-correct and use references instead of raw pointers wherever applicable. In particular, floppy_image_device::load and floppy_image_device::save now take a reference to floppy_image rather than a pointer, const-qualified in the latter case.
Diffstat (limited to 'src/tools/floptool.cpp')
-rw-r--r--src/tools/floptool.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/tools/floptool.cpp b/src/tools/floptool.cpp
index 146de2d22b7..ba573e0a0cd 100644
--- a/src/tools/floptool.cpp
+++ b/src/tools/floptool.cpp
@@ -214,14 +214,14 @@ static int flopconvert(int argc, char *argv[])
return 1;
}
- if(ih.floppy_load(source_format)) {
+ if(ih.floppy_load(*source_format)) {
fprintf(stderr, "Error: Loading as format '%s' failed\n", source_format->m_format->name());
return 1;
}
ih.set_on_disk_path(argv[5]);
- if(ih.floppy_save(dest_format)) {
+ if(ih.floppy_save(*dest_format)) {
fprintf(stderr, "Error: Saving as format '%s' failed\n", dest_format->m_format->name());
return 1;
}
@@ -291,8 +291,8 @@ static int flopcreate(int argc, char *argv[])
image_handler ih;
ih.set_on_disk_path(argv[4]);
- ih.floppy_create(create_fs, meta);
- return ih.floppy_save(dest_format);
+ ih.floppy_create(*create_fs, meta);
+ return ih.floppy_save(*dest_format);
}
static void dir_scan(fs::filesystem_t *fs, u32 depth, const std::vector<std::string> &path, std::vector<std::vector<std::string>> &entries, const std::unordered_map<fs::meta_name, size_t> &nmap, size_t nc, const std::vector<fs::meta_description> &dmetad, const std::vector<fs::meta_description> &fmetad)
@@ -420,12 +420,12 @@ static int flopdir(int argc, char *argv[])
return 1;
}
- if(ih.floppy_load(source_format)) {
+ if(ih.floppy_load(*source_format)) {
fprintf(stderr, "Error: Loading as format '%s' failed\n", source_format->m_format->name());
return 1;
}
- if(ih.floppy_mount_fs(fs)) {
+ if(ih.floppy_mount_fs(*fs)) {
fprintf(stderr, "Error: Parsing as filesystem '%s' failed\n", fs->m_manager->name());
return 1;
}
@@ -455,7 +455,7 @@ static int hddir(int argc, char *argv[])
return 1;
}
- if(ih.hd_mount_fs(fs)) {
+ if(ih.hd_mount_fs(*fs)) {
fprintf(stderr, "Error: Parsing as filesystem '%s' failed\n", fs->m_manager->name());
return 1;
}
@@ -515,12 +515,12 @@ static int flopread(int argc, char *argv[])
return 1;
}
- if(ih.floppy_load(source_format)) {
+ if(ih.floppy_load(*source_format)) {
fprintf(stderr, "Error: Loading as format '%s' failed\n", source_format->m_format->name());
return 1;
}
- if(ih.floppy_mount_fs(fs)) {
+ if(ih.floppy_mount_fs(*fs)) {
fprintf(stderr, "Error: Parsing as filesystem '%s' failed\n", fs->m_manager->name());
return 1;
}
@@ -550,7 +550,7 @@ static int hdread(int argc, char *argv[])
return 1;
}
- if(ih.hd_mount_fs(fs)) {
+ if(ih.hd_mount_fs(*fs)) {
fprintf(stderr, "Error: Parsing as filesystem '%s' failed\n", fs->m_manager->name());
return 1;
}
@@ -630,12 +630,12 @@ static int flopwrite(int argc, char *argv[])
return 1;
}
- if(ih.floppy_load(source_format)) {
+ if(ih.floppy_load(*source_format)) {
fprintf(stderr, "Error: Loading as format '%s' failed\n", source_format->m_format->name());
return 1;
}
- if(ih.floppy_mount_fs(fs)) {
+ if(ih.floppy_mount_fs(*fs)) {
fprintf(stderr, "Error: Parsing as filesystem '%s' failed\n", fs->m_manager->name());
return 1;
}
@@ -645,7 +645,7 @@ static int flopwrite(int argc, char *argv[])
return err;
ih.fs_to_floppy();
- if(ih.floppy_save(source_format))
+ if(ih.floppy_save(*source_format))
return 1;
return 0;
@@ -674,7 +674,7 @@ static int hdwrite(int argc, char *argv[])
return 1;
}
- if(ih.hd_mount_fs(fs)) {
+ if(ih.hd_mount_fs(*fs)) {
fprintf(stderr, "Error: Parsing as filesystem '%s' failed\n", fs->m_manager->name());
return 1;
}