summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/formats/fs_coco_os9.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_os9.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_os9.cpp')
-rw-r--r--src/lib/formats/fs_coco_os9.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/formats/fs_coco_os9.cpp b/src/lib/formats/fs_coco_os9.cpp
index 9bae816dfea..64888ed3228 100644
--- a/src/lib/formats/fs_coco_os9.cpp
+++ b/src/lib/formats/fs_coco_os9.cpp
@@ -117,8 +117,8 @@ char coco_os9_image::directory_separator() const
std::vector<meta_description> coco_os9_image::volume_meta_description() const
{
std::vector<meta_description> results;
- results.emplace_back(meta_description(meta_name::name, meta_type::string, "UNTITLED", false, [](const meta_value &m) { return m.as_string().size() <= 32; }, "Volume name, up to 32 characters"));
- results.emplace_back(meta_description(meta_name::creation_date, meta_type::date, util::arbitrary_datetime::now(), false, nullptr, "Creation time"));
+ results.emplace_back(meta_description(meta_name::name, "UNTITLED", false, [](const meta_value &m) { return m.as_string().size() <= 32; }, "Volume name, up to 32 characters"));
+ results.emplace_back(meta_description(meta_name::creation_date, util::arbitrary_datetime::now(), false, nullptr, "Creation time"));
return results;
}
@@ -150,11 +150,11 @@ std::vector<meta_description> coco_os9_image::directory_meta_description() const
std::vector<meta_description> coco_os9_image::entity_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"));
- results.emplace_back(meta_description(meta_name::creation_date, meta_type::date, util::arbitrary_datetime::now(), false, nullptr, "Creation time"));
- results.emplace_back(meta_description(meta_name::owner_id, meta_type::number, 0, true, nullptr, "Owner ID"));
- results.emplace_back(meta_description(meta_name::attributes, meta_type::string, 0, true, nullptr, "File attributes"));
- 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"));
+ results.emplace_back(meta_description(meta_name::creation_date, util::arbitrary_datetime::now(), false, nullptr, "Creation time"));
+ results.emplace_back(meta_description(meta_name::owner_id, 0, true, nullptr, "Owner ID"));
+ results.emplace_back(meta_description(meta_name::attributes, "", true, nullptr, "File attributes"));
+ results.emplace_back(meta_description(meta_name::length, 0, true, nullptr, "Size of the file in bytes"));
return results;
}