aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorFearlessTobi <[email protected]>2024-02-19 16:00:46 +0100
committerFearlessTobi <[email protected]>2024-02-19 16:00:46 +0100
commit310c1f50beb77fc5c6f9075029973161d4e51a4a (patch)
tree43a5699123e4930560fc5016faac7efb15b63f4e /src/core/file_sys
parent665fce871fc7190f92f9912ec3ae31c891bb3227 (diff)
downloadyuzu-mainline-310c1f50beb77fc5c6f9075029973161d4e51a4a.tar.gz
yuzu-mainline-310c1f50beb77fc5c6f9075029973161d4e51a4a.zip
scope_exit: Make constexpr
Allows the use of the macro in constexpr-contexts. Also avoids some potential problems when nesting braces inside it.
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/fs_directory.h4
-rw-r--r--src/core/file_sys/fs_path_utility.h12
-rw-r--r--src/core/file_sys/fssystem/fssystem_hierarchical_sha256_storage.cpp4
-rw-r--r--src/core/file_sys/program_metadata.cpp4
4 files changed, 16 insertions, 8 deletions
diff --git a/src/core/file_sys/fs_directory.h b/src/core/file_sys/fs_directory.h
index 25c9cb18a..3f90abb8f 100644
--- a/src/core/file_sys/fs_directory.h
+++ b/src/core/file_sys/fs_directory.h
@@ -3,6 +3,10 @@
#pragma once
+#include <string_view>
+#include "common/common_funcs.h"
+#include "common/common_types.h"
+
namespace FileSys {
constexpr inline size_t EntryNameLengthMax = 0x300;
diff --git a/src/core/file_sys/fs_path_utility.h b/src/core/file_sys/fs_path_utility.h
index e9011d065..5643141f9 100644
--- a/src/core/file_sys/fs_path_utility.h
+++ b/src/core/file_sys/fs_path_utility.h
@@ -447,7 +447,7 @@ public:
char* replacement_path = nullptr;
size_t replacement_path_size = 0;
- SCOPE_EXIT({
+ SCOPE_EXIT {
if (replacement_path != nullptr) {
if (std::is_constant_evaluated()) {
delete[] replacement_path;
@@ -455,7 +455,7 @@ public:
Deallocate(replacement_path, replacement_path_size);
}
}
- });
+ };
// Perform path replacement, if necessary
if (IsParentDirectoryPathReplacementNeeded(cur_path)) {
@@ -1102,8 +1102,8 @@ public:
R_SUCCEED();
}
- static Result Normalize(char* dst, size_t dst_size, const char* path, size_t path_len,
- const PathFlags& flags) {
+ static constexpr Result Normalize(char* dst, size_t dst_size, const char* path, size_t path_len,
+ const PathFlags& flags) {
// Use StringTraits names for remainder of scope
using namespace StringTraits;
@@ -1199,7 +1199,7 @@ public:
const size_t replaced_src_len = path_len - (src - path);
char* replaced_src = nullptr;
- SCOPE_EXIT({
+ SCOPE_EXIT {
if (replaced_src != nullptr) {
if (std::is_constant_evaluated()) {
delete[] replaced_src;
@@ -1207,7 +1207,7 @@ public:
Deallocate(replaced_src, replaced_src_len);
}
}
- });
+ };
if (std::is_constant_evaluated()) {
replaced_src = new char[replaced_src_len];
diff --git a/src/core/file_sys/fssystem/fssystem_hierarchical_sha256_storage.cpp b/src/core/file_sys/fssystem/fssystem_hierarchical_sha256_storage.cpp
index caea0b8f8..a68fd973c 100644
--- a/src/core/file_sys/fssystem/fssystem_hierarchical_sha256_storage.cpp
+++ b/src/core/file_sys/fssystem/fssystem_hierarchical_sha256_storage.cpp
@@ -36,7 +36,9 @@ Result HierarchicalSha256Storage::Initialize(VirtualFile* base_storages, s32 lay
// Get the base storage size.
m_base_storage_size = base_storages[2]->GetSize();
{
- auto size_guard = SCOPE_GUARD({ m_base_storage_size = 0; });
+ auto size_guard = SCOPE_GUARD {
+ m_base_storage_size = 0;
+ };
R_UNLESS(m_base_storage_size <= static_cast<s64>(HashSize)
<< m_log_size_ratio << m_log_size_ratio,
ResultHierarchicalSha256BaseStorageTooLarge);
diff --git a/src/core/file_sys/program_metadata.cpp b/src/core/file_sys/program_metadata.cpp
index ae4e441c9..289969cc4 100644
--- a/src/core/file_sys/program_metadata.cpp
+++ b/src/core/file_sys/program_metadata.cpp
@@ -98,7 +98,9 @@ Loader::ResultStatus ProgramMetadata::Load(VirtualFile file) {
Loader::ResultStatus ProgramMetadata::Reload(VirtualFile file) {
const u64 original_program_id = aci_header.title_id;
- SCOPE_EXIT({ aci_header.title_id = original_program_id; });
+ SCOPE_EXIT {
+ aci_header.title_id = original_program_id;
+ };
return this->Load(file);
}