summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/formats/fs_coco_rsdos.cpp
diff options
context:
space:
mode:
author npwoods <npwoods@mess.org>2022-04-12 08:52:44 -0400
committer GitHub <noreply@github.com>2022-04-12 14:52:44 +0200
commit97dcbb964ef62ba4b6f86dc162b1c34cbbfbbbd6 (patch)
treedae64fed1cc4a92ecb9b00282580bf4082f584e4 /src/lib/formats/fs_coco_rsdos.cpp
parentce68a1d711a952a815833856b00bd7a00e28bb1f (diff)
Fixed some issues involving fs::meta_description construction (#9546)
* Fixed some issues involving fs::meta_description constructing With the recent change to use std::variant more closely, I noticed a problem where meta_descriptions of type meta_type::String got defaults of type 't'. This was because the templated ctor for meta_description would convert 'const char *' to 'bool'. This change adds another overload to catch 'const char *', along with asserts to catch problems. In the process I corrected a few meta_description ctors It is possible that this change does not go far enough. Perhaps the meta_type argument should be removed, and we should instead create distinct ctor types (rather than relying on templates) and specify the precise meta_type in the overload. Or even go further and remove m_type from meta_description, and instead create an overload that calculates meta_type based on calling std::visit on the variant * Taking this change a bit further, and removing m_type from fs::meta_description; it was superfluous. Also doing some minor C++-ifications
Diffstat (limited to 'src/lib/formats/fs_coco_rsdos.cpp')
-rw-r--r--src/lib/formats/fs_coco_rsdos.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/formats/fs_coco_rsdos.cpp b/src/lib/formats/fs_coco_rsdos.cpp
index ae444acdb60..f22e3714455 100644
--- a/src/lib/formats/fs_coco_rsdos.cpp
+++ b/src/lib/formats/fs_coco_rsdos.cpp
@@ -62,11 +62,11 @@ bool coco_rsdos_image::has_rsrc() const
std::vector<meta_description> coco_rsdos_image::file_meta_description() const
{
std::vector<meta_description> results;
- results.emplace_back(meta_description(meta_name::name, meta_type::string, "", false, [](const meta_value &m) { return validate_filename(m.as_string()); }, "File name, 8.3"));
- results.emplace_back(meta_description(meta_name::file_type, meta_type::number, 0, true, nullptr, "Type of the file"));
- results.emplace_back(meta_description(meta_name::ascii_flag, meta_type::string, 0, true, nullptr, "Ascii or binary flag"));
- results.emplace_back(meta_description(meta_name::size_in_blocks, meta_type::number, 0, true, nullptr, "Number of granules used by the file"));
- results.emplace_back(meta_description(meta_name::length, meta_type::number, 0, true, nullptr, "Size of the file in bytes"));
+ results.emplace_back(meta_description(meta_name::name, "", false, [](const meta_value &m) { return validate_filename(m.as_string()); }, "File name, 8.3"));
+ results.emplace_back(meta_description(meta_name::file_type, 0, true, nullptr, "Type of the file"));
+ results.emplace_back(meta_description(meta_name::ascii_flag, "B", true, nullptr, "Ascii or binary flag"));
+ results.emplace_back(meta_description(meta_name::size_in_blocks, 0, true, nullptr, "Number of granules used by the file"));
+ results.emplace_back(meta_description(meta_name::length, 0, true, nullptr, "Size of the file in bytes"));
return results;
}