From 3d1aafa7ddcec727bd90327624773338bd672cf2 Mon Sep 17 00:00:00 2001 From: wheremyfoodat Date: Mon, 12 Dec 2022 03:50:38 +0200 Subject: [PATCH] [FS] Use std::string over C strings for archive names --- include/fs/archive_base.hpp | 5 +++-- include/fs/archive_ncch.hpp | 2 +- include/fs/archive_save_data.hpp | 2 +- include/fs/archive_sdmc.hpp | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/fs/archive_base.hpp b/include/fs/archive_base.hpp index 7f6ea484..4bd267fe 100644 --- a/include/fs/archive_base.hpp +++ b/include/fs/archive_base.hpp @@ -1,5 +1,6 @@ #pragma once #include +#include #include "helpers.hpp" #include "memory.hpp" @@ -24,7 +25,7 @@ namespace ArchiveID { SDMCWriteOnly = 0xA }; - static const char* toString(u32 id) { + static std::string toString(u32 id) { switch (id) { case SelfNCCH: return "SelfNCCH"; case SaveData: return "SaveData"; @@ -72,7 +73,7 @@ protected: Memory& mem; public: - virtual const char* name() = 0; + virtual std::string name() = 0; virtual u64 getFreeBytes() = 0; virtual bool openFile(const FSPath& path) = 0; diff --git a/include/fs/archive_ncch.hpp b/include/fs/archive_ncch.hpp index be9a5d83..7ece602c 100644 --- a/include/fs/archive_ncch.hpp +++ b/include/fs/archive_ncch.hpp @@ -7,7 +7,7 @@ public: SelfNCCHArchive(Memory& mem) : ArchiveBase(mem) {} u64 getFreeBytes() override { return 0; } - const char* name() override { return "SelfNCCH"; } + std::string name() override { return "SelfNCCH"; } bool openFile(const FSPath& path) override; ArchiveBase* openArchive(const FSPath& path) override; diff --git a/include/fs/archive_save_data.hpp b/include/fs/archive_save_data.hpp index 6c2b2df5..f1f38560 100644 --- a/include/fs/archive_save_data.hpp +++ b/include/fs/archive_save_data.hpp @@ -7,7 +7,7 @@ public: SaveDataArchive(Memory& mem) : ArchiveBase(mem) {} u64 getFreeBytes() override { return 0; } - const char* name() override { return "SaveData"; } + std::string name() override { return "SaveData"; } bool openFile(const FSPath& path) override; ArchiveBase* openArchive(const FSPath& path) override; diff --git a/include/fs/archive_sdmc.hpp b/include/fs/archive_sdmc.hpp index e8a26b58..d3cebe25 100644 --- a/include/fs/archive_sdmc.hpp +++ b/include/fs/archive_sdmc.hpp @@ -7,7 +7,7 @@ public: SDMCArchive(Memory& mem) : ArchiveBase(mem) {} u64 getFreeBytes() override { return 0; } - const char* name() override { return "SDMC"; } + std::string name() override { return "SDMC"; } bool openFile(const FSPath& path) override; ArchiveBase* openArchive(const FSPath& path) override;