diff --git a/src/core/file_sys/archive_backend.cpp b/src/core/file_sys/archive_backend.cpp index 87a240d7a..b27422cba 100644 --- a/src/core/file_sys/archive_backend.cpp +++ b/src/core/file_sys/archive_backend.cpp @@ -14,19 +14,19 @@ namespace FileSys { Path::Path(LowPathType type, u32 size, u32 pointer) : type(type) { switch (type) { - case Binary: { + case LowPathType::Binary: { binary.resize(size); Memory::ReadBlock(pointer, binary.data(), binary.size()); break; } - case Char: { + case LowPathType::Char: { string.resize(size - 1); // Data is always null-terminated. Memory::ReadBlock(pointer, &string[0], string.size()); break; } - case Wchar: { + case LowPathType::Wchar: { u16str.resize(size / 2 - 1); // Data is always null-terminated. Memory::ReadBlock(pointer, &u16str[0], u16str.size() * sizeof(char16_t)); break; @@ -39,12 +39,12 @@ Path::Path(LowPathType type, u32 size, u32 pointer) : type(type) { std::string Path::DebugStr() const { switch (GetType()) { - case Invalid: + case LowPathType::Invalid: default: return "[Invalid]"; - case Empty: + case LowPathType::Empty: return "[Empty]"; - case Binary: { + case LowPathType::Binary: { std::stringstream res; res << "[Binary: "; for (unsigned byte : binary) @@ -52,23 +52,23 @@ std::string Path::DebugStr() const { res << ']'; return res.str(); } - case Char: + case LowPathType::Char: return "[Char: " + AsString() + ']'; - case Wchar: + case LowPathType::Wchar: return "[Wchar: " + AsString() + ']'; } } std::string Path::AsString() const { switch (GetType()) { - case Char: + case LowPathType::Char: return string; - case Wchar: + case LowPathType::Wchar: return Common::UTF16ToUTF8(u16str); - case Empty: + case LowPathType::Empty: return {}; - case Invalid: - case Binary: + case LowPathType::Invalid: + case LowPathType::Binary: default: // TODO(yuriks): Add assert LOG_ERROR(Service_FS, "LowPathType cannot be converted to string!"); @@ -78,14 +78,14 @@ std::string Path::AsString() const { std::u16string Path::AsU16Str() const { switch (GetType()) { - case Char: + case LowPathType::Char: return Common::UTF8ToUTF16(string); - case Wchar: + case LowPathType::Wchar: return u16str; - case Empty: + case LowPathType::Empty: return {}; - case Invalid: - case Binary: + case LowPathType::Invalid: + case LowPathType::Binary: // TODO(yuriks): Add assert LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!"); return {}; @@ -96,11 +96,11 @@ std::u16string Path::AsU16Str() const { std::vector Path::AsBinary() const { switch (GetType()) { - case Binary: + case LowPathType::Binary: return binary; - case Char: + case LowPathType::Char: return std::vector(string.begin(), string.end()); - case Wchar: { + case LowPathType::Wchar: { // use two u8 for each character of u16str std::vector to_return(u16str.size() * 2); for (size_t i = 0; i < u16str.size(); ++i) { @@ -110,9 +110,9 @@ std::vector Path::AsBinary() const { } return to_return; } - case Empty: + case LowPathType::Empty: return {}; - case Invalid: + case LowPathType::Invalid: default: // TODO(yuriks): Add assert LOG_ERROR(Service_FS, "LowPathType cannot be converted to binary!"); diff --git a/src/core/file_sys/archive_backend.h b/src/core/file_sys/archive_backend.h index 58f6c150c..d49ebbbac 100644 --- a/src/core/file_sys/archive_backend.h +++ b/src/core/file_sys/archive_backend.h @@ -19,7 +19,7 @@ class FileBackend; class DirectoryBackend; // Path string type -enum LowPathType : u32 { +enum class LowPathType : u32 { Invalid = 0, Empty = 1, Binary = 2, @@ -36,9 +36,9 @@ union Mode { class Path { public: - Path() : type(Invalid) {} - Path(const char* path) : type(Char), string(path) {} - Path(std::vector binary_data) : type(Binary), binary(std::move(binary_data)) {} + Path() : type(LowPathType::Invalid) {} + Path(const char* path) : type(LowPathType::Char), string(path) {} + Path(std::vector binary_data) : type(LowPathType::Binary), binary(std::move(binary_data)) {} Path(LowPathType type, u32 size, u32 pointer); LowPathType GetType() const { diff --git a/src/core/file_sys/archive_other_savedata.cpp b/src/core/file_sys/archive_other_savedata.cpp index 1977585b5..93104a9e0 100644 --- a/src/core/file_sys/archive_other_savedata.cpp +++ b/src/core/file_sys/archive_other_savedata.cpp @@ -22,7 +22,7 @@ namespace { template ResultVal> ParsePath(const Path& path, T program_id_reader) { - if (path.GetType() != Binary) { + if (path.GetType() != LowPathType::Binary) { LOG_ERROR(Service_FS, "Wrong path type %d", static_cast(path.GetType())); return ERROR_INVALID_PATH; }