mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-04 08:29:44 -04:00
strat: always use explicit result namespacing
This commit is contained in:
parent
303c6eb5f9
commit
b0e520112b
29 changed files with 237 additions and 237 deletions
|
@ -36,7 +36,7 @@ namespace ams::fssrv::impl {
|
|||
}
|
||||
|
||||
Result FileInterfaceAdapter::Read(ams::sf::Out<s64> out, s64 offset, const ams::sf::OutNonSecureBuffer &buffer, s64 size, fs::ReadOption option) {
|
||||
/* TODO: N retries on ResultDataCorrupted, we may want to eventually. */
|
||||
/* TODO: N retries on fs::ResultDataCorrupted, we may want to eventually. */
|
||||
/* TODO: Deep retry */
|
||||
R_UNLESS(offset >= 0, fs::ResultInvalidOffset());
|
||||
R_UNLESS(size >= 0, fs::ResultInvalidSize());
|
||||
|
@ -126,7 +126,7 @@ namespace ams::fssrv::impl {
|
|||
const s64 max_num_entries = out_entries.GetSize() / sizeof(fs::DirectoryEntry);
|
||||
R_UNLESS(max_num_entries >= 0, fs::ResultInvalidSize());
|
||||
|
||||
/* TODO: N retries on ResultDataCorrupted, we may want to eventually. */
|
||||
/* TODO: N retries on fs::ResultDataCorrupted, we may want to eventually. */
|
||||
return this->base_dir->Read(out.GetPointer(), reinterpret_cast<fs::DirectoryEntry *>(out_entries.GetPointer()), max_num_entries);
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ namespace ams::fssrv::impl {
|
|||
PathNormalizer normalizer(path.str);
|
||||
R_UNLESS(normalizer.GetPath() != nullptr, normalizer.GetResult());
|
||||
|
||||
/* TODO: N retries on ResultDataCorrupted, we may want to eventually. */
|
||||
/* TODO: N retries on fs::ResultDataCorrupted, we may want to eventually. */
|
||||
std::unique_ptr<fs::fsa::IFile> file;
|
||||
R_TRY(this->base_fs->OpenFile(&file, normalizer.GetPath(), static_cast<fs::OpenMode>(mode)));
|
||||
|
||||
|
@ -294,7 +294,7 @@ namespace ams::fssrv::impl {
|
|||
PathNormalizer normalizer(path.str);
|
||||
R_UNLESS(normalizer.GetPath() != nullptr, normalizer.GetResult());
|
||||
|
||||
/* TODO: N retries on ResultDataCorrupted, we may want to eventually. */
|
||||
/* TODO: N retries on fs::ResultDataCorrupted, we may want to eventually. */
|
||||
std::unique_ptr<fs::fsa::IDirectory> dir;
|
||||
R_TRY(this->base_fs->OpenDirectory(&dir, normalizer.GetPath(), static_cast<fs::OpenDirectoryMode>(mode)));
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace ams::fssrv::impl {
|
|||
}
|
||||
|
||||
Result StorageInterfaceAdapter::Read(s64 offset, const ams::sf::OutNonSecureBuffer &buffer, s64 size) {
|
||||
/* TODO: N retries on ResultDataCorrupted, we may want to eventually. */
|
||||
/* TODO: N retries on fs::ResultDataCorrupted, we may want to eventually. */
|
||||
/* TODO: Deep retry */
|
||||
R_UNLESS(offset >= 0, fs::ResultInvalidOffset());
|
||||
R_UNLESS(size >= 0, fs::ResultInvalidSize());
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace ams::fssystem {
|
|||
const size_t size = normalized_path_len + 1;
|
||||
char *new_dir = static_cast<char *>(fs::impl::Allocate(size));
|
||||
AMS_ABORT_UNLESS(new_dir != nullptr);
|
||||
/* TODO: custom ResultAllocationFailure? */
|
||||
/* TODO: custom fs::ResultAllocationFailure? */
|
||||
|
||||
/* Copy path in. */
|
||||
std::memcpy(new_dir, normalized_path, normalized_path_len);
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace ams::fssystem {
|
|||
}
|
||||
|
||||
/* TODO: Return a result here? Nintendo does not, but they have other allocation failed results. */
|
||||
/* Consider returning ResultFsAllocationFailureInDirectorySaveDataFileSystem? */
|
||||
/* Consider returning fs::ResultFsAllocationFailureInDirectorySaveDataFileSystem? */
|
||||
AMS_ABORT_UNLESS(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
namespace ams::i2c {
|
||||
|
||||
Result CommandListFormatter::IsEnqueueAble(size_t sz) const {
|
||||
R_UNLESS(this->command_list_length - this->current_index >= sz, ResultCommandListFull());
|
||||
R_UNLESS(this->command_list_length - this->current_index >= sz, i2c::ResultCommandListFull());
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace ams::kvdb {
|
|||
u32 entry_count;
|
||||
|
||||
Result Validate() const {
|
||||
R_UNLESS(std::memcmp(this->magic, ArchiveHeaderMagic, sizeof(ArchiveHeaderMagic)) == 0, ResultInvalidKeyValue());
|
||||
R_UNLESS(std::memcmp(this->magic, ArchiveHeaderMagic, sizeof(ArchiveHeaderMagic)) == 0, kvdb::ResultInvalidKeyValue());
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ namespace ams::kvdb {
|
|||
u32 value_size;
|
||||
|
||||
Result Validate() const {
|
||||
R_UNLESS(std::memcmp(this->magic, ArchiveEntryMagic, sizeof(ArchiveEntryMagic)) == 0, ResultInvalidKeyValue());
|
||||
R_UNLESS(std::memcmp(this->magic, ArchiveEntryMagic, sizeof(ArchiveEntryMagic)) == 0, kvdb::ResultInvalidKeyValue());
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
@ -68,8 +68,8 @@ namespace ams::kvdb {
|
|||
/* Reader functionality. */
|
||||
Result ArchiveReader::Peek(void *dst, size_t size) {
|
||||
/* Bounds check. */
|
||||
R_UNLESS(this->offset + size <= this->buffer.GetSize(), ResultInvalidKeyValue());
|
||||
R_UNLESS(this->offset < this->offset + size, ResultInvalidKeyValue());
|
||||
R_UNLESS(this->offset + size <= this->buffer.GetSize(), kvdb::ResultInvalidKeyValue());
|
||||
R_UNLESS(this->offset < this->offset + size, kvdb::ResultInvalidKeyValue());
|
||||
|
||||
std::memcpy(dst, this->buffer.Get() + this->offset, size);
|
||||
return ResultSuccess();
|
||||
|
@ -129,8 +129,8 @@ namespace ams::kvdb {
|
|||
/* Writer functionality. */
|
||||
Result ArchiveWriter::Write(const void *src, size_t size) {
|
||||
/* Bounds check. */
|
||||
R_UNLESS(this->offset + size <= this->buffer.GetSize(), ResultInvalidKeyValue());
|
||||
R_UNLESS(this->offset < this->offset + size, ResultInvalidKeyValue());
|
||||
R_UNLESS(this->offset + size <= this->buffer.GetSize(), kvdb::ResultInvalidKeyValue());
|
||||
R_UNLESS(this->offset < this->offset + size, kvdb::ResultInvalidKeyValue());
|
||||
|
||||
std::memcpy(this->buffer.Get() + this->offset, src, size);
|
||||
this->offset += size;
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace ams::kvdb {
|
|||
/* If we have memory to work with, ensure it's at least enough for the cache entries. */
|
||||
if (this->backing_buffer != nullptr) {
|
||||
this->entries = static_cast<decltype(this->entries)>(this->Allocate(sizeof(*this->entries) * this->capacity));
|
||||
R_UNLESS(this->entries != nullptr, ResultBufferInsufficient());
|
||||
R_UNLESS(this->entries != nullptr, kvdb::ResultBufferInsufficient());
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
|
@ -153,13 +153,13 @@ namespace ams::kvdb {
|
|||
/* TODO: Nintendo does not validate that the key is valid hex. Should we do this? */
|
||||
const size_t file_name_len = file_name.GetLength();
|
||||
const size_t key_name_len = file_name_len - FileExtensionLength;
|
||||
R_UNLESS(file_name_len >= FileExtensionLength + 2, ResultInvalidKeyValue());
|
||||
R_UNLESS(file_name.EndsWith(FileExtension), ResultInvalidKeyValue());
|
||||
R_UNLESS(util::IsAligned(key_name_len, 2), ResultInvalidKeyValue());
|
||||
R_UNLESS(file_name_len >= FileExtensionLength + 2, kvdb::ResultInvalidKeyValue());
|
||||
R_UNLESS(file_name.EndsWith(FileExtension), kvdb::ResultInvalidKeyValue());
|
||||
R_UNLESS(util::IsAligned(key_name_len, 2), kvdb::ResultInvalidKeyValue());
|
||||
|
||||
/* Validate that we have space for the converted key. */
|
||||
const size_t key_size = key_name_len / 2;
|
||||
R_UNLESS(key_size <= max_out_size, ResultBufferInsufficient());
|
||||
R_UNLESS(key_size <= max_out_size, kvdb::ResultBufferInsufficient());
|
||||
|
||||
/* Convert the hex key back. */
|
||||
u8 *out_key = static_cast<u8 *>(_out_key);
|
||||
|
@ -195,7 +195,7 @@ namespace ams::kvdb {
|
|||
std::scoped_lock lk(this->lock);
|
||||
|
||||
/* Ensure key size is small enough. */
|
||||
R_UNLESS(key_size <= MaxKeySize, ResultOutOfKeyResource());
|
||||
R_UNLESS(key_size <= MaxKeySize, kvdb::ResultOutOfKeyResource());
|
||||
|
||||
/* Try to get from cache. */
|
||||
{
|
||||
|
@ -209,7 +209,7 @@ namespace ams::kvdb {
|
|||
/* Open the value file. */
|
||||
fs::FileHandle file;
|
||||
R_TRY_CATCH(fs::OpenFile(std::addressof(file), this->GetPath(key, key_size), fs::OpenMode_Read)) {
|
||||
R_CONVERT(fs::ResultPathNotFound, ResultKeyNotFound());
|
||||
R_CONVERT(fs::ResultPathNotFound, kvdb::ResultKeyNotFound());
|
||||
} R_END_TRY_CATCH;
|
||||
ON_SCOPE_EXIT { fs::CloseFile(file); };
|
||||
|
||||
|
@ -218,7 +218,7 @@ namespace ams::kvdb {
|
|||
R_TRY(fs::GetFileSize(std::addressof(file_size), file));
|
||||
|
||||
/* Ensure there's enough space for the value. */
|
||||
R_UNLESS(file_size <= static_cast<s64>(max_out_size), ResultBufferInsufficient());
|
||||
R_UNLESS(file_size <= static_cast<s64>(max_out_size), kvdb::ResultBufferInsufficient());
|
||||
|
||||
/* Read the value. */
|
||||
const size_t value_size = static_cast<size_t>(file_size);
|
||||
|
@ -234,7 +234,7 @@ namespace ams::kvdb {
|
|||
std::scoped_lock lk(this->lock);
|
||||
|
||||
/* Ensure key size is small enough. */
|
||||
R_UNLESS(key_size <= MaxKeySize, ResultOutOfKeyResource());
|
||||
R_UNLESS(key_size <= MaxKeySize, kvdb::ResultOutOfKeyResource());
|
||||
|
||||
/* Try to get from cache. */
|
||||
{
|
||||
|
@ -248,7 +248,7 @@ namespace ams::kvdb {
|
|||
/* Open the value file. */
|
||||
fs::FileHandle file;
|
||||
R_TRY_CATCH(fs::OpenFile(std::addressof(file), this->GetPath(key, key_size), fs::OpenMode_Read)) {
|
||||
R_CONVERT(fs::ResultPathNotFound, ResultKeyNotFound());
|
||||
R_CONVERT(fs::ResultPathNotFound, kvdb::ResultKeyNotFound());
|
||||
} R_END_TRY_CATCH;
|
||||
ON_SCOPE_EXIT { fs::CloseFile(file); };
|
||||
|
||||
|
@ -264,7 +264,7 @@ namespace ams::kvdb {
|
|||
std::scoped_lock lk(this->lock);
|
||||
|
||||
/* Ensure key size is small enough. */
|
||||
R_UNLESS(key_size <= MaxKeySize, ResultOutOfKeyResource());
|
||||
R_UNLESS(key_size <= MaxKeySize, kvdb::ResultOutOfKeyResource());
|
||||
|
||||
/* When the cache contains the key being set, Nintendo invalidates the cache. */
|
||||
if (this->cache.Contains(key, key_size)) {
|
||||
|
@ -293,7 +293,7 @@ namespace ams::kvdb {
|
|||
std::scoped_lock lk(this->lock);
|
||||
|
||||
/* Ensure key size is small enough. */
|
||||
R_UNLESS(key_size <= MaxKeySize, ResultOutOfKeyResource());
|
||||
R_UNLESS(key_size <= MaxKeySize, kvdb::ResultOutOfKeyResource());
|
||||
|
||||
/* When the cache contains the key being set, Nintendo invalidates the cache. */
|
||||
if (this->cache.Contains(key, key_size)) {
|
||||
|
@ -302,7 +302,7 @@ namespace ams::kvdb {
|
|||
|
||||
/* Remove the file. */
|
||||
R_TRY_CATCH(fs::DeleteFile(this->GetPath(key, key_size))) {
|
||||
R_CONVERT(fs::ResultPathNotFound, ResultKeyNotFound())
|
||||
R_CONVERT(fs::ResultPathNotFound, kvdb::ResultKeyNotFound())
|
||||
} R_END_TRY_CATCH;
|
||||
|
||||
return ResultSuccess();
|
||||
|
|
|
@ -94,21 +94,21 @@ namespace ams::ncm {
|
|||
|
||||
ALWAYS_INLINE Result GetContentStorageNotActiveResult(StorageId storage_id) {
|
||||
switch (storage_id) {
|
||||
case StorageId::GameCard: return ResultGameCardContentStorageNotActive();
|
||||
case StorageId::BuiltInSystem: return ResultBuiltInSystemContentStorageNotActive();
|
||||
case StorageId::BuiltInUser: return ResultBuiltInUserContentStorageNotActive();
|
||||
case StorageId::SdCard: return ResultSdCardContentStorageNotActive();
|
||||
default: return ResultUnknownContentStorageNotActive();
|
||||
case StorageId::GameCard: return ncm::ResultGameCardContentStorageNotActive();
|
||||
case StorageId::BuiltInSystem: return ncm::ResultBuiltInSystemContentStorageNotActive();
|
||||
case StorageId::BuiltInUser: return ncm::ResultBuiltInUserContentStorageNotActive();
|
||||
case StorageId::SdCard: return ncm::ResultSdCardContentStorageNotActive();
|
||||
default: return ncm::ResultUnknownContentStorageNotActive();
|
||||
}
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result GetContentMetaDatabaseNotActiveResult(StorageId storage_id) {
|
||||
switch (storage_id) {
|
||||
case StorageId::GameCard: return ResultGameCardContentMetaDatabaseNotActive();
|
||||
case StorageId::BuiltInSystem: return ResultBuiltInSystemContentMetaDatabaseNotActive();
|
||||
case StorageId::BuiltInUser: return ResultBuiltInUserContentMetaDatabaseNotActive();
|
||||
case StorageId::SdCard: return ResultSdCardContentMetaDatabaseNotActive();
|
||||
default: return ResultUnknownContentMetaDatabaseNotActive();
|
||||
case StorageId::GameCard: return ncm::ResultGameCardContentMetaDatabaseNotActive();
|
||||
case StorageId::BuiltInSystem: return ncm::ResultBuiltInSystemContentMetaDatabaseNotActive();
|
||||
case StorageId::BuiltInUser: return ncm::ResultBuiltInUserContentMetaDatabaseNotActive();
|
||||
case StorageId::SdCard: return ncm::ResultSdCardContentMetaDatabaseNotActive();
|
||||
default: return ncm::ResultUnknownContentMetaDatabaseNotActive();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace ams::ncm {
|
|||
|
||||
Result OnMemoryContentMetaDatabaseImpl::LookupOrphanContent(const sf::OutArray<bool> &out_orphaned, const sf::InArray<ContentId> &content_ids) {
|
||||
AMS_UNUSED(out_orphaned, content_ids);
|
||||
return ResultInvalidContentMetaDatabase();
|
||||
return ncm::ResultInvalidContentMetaDatabase();
|
||||
}
|
||||
|
||||
Result OnMemoryContentMetaDatabaseImpl::Commit() {
|
||||
|
|
|
@ -135,14 +135,14 @@ namespace ams::settings::impl {
|
|||
MapKey &Assign(const char * const chars, s32 count) {
|
||||
AMS_ASSERT(chars != nullptr);
|
||||
AMS_ASSERT(count >= 0);
|
||||
|
||||
|
||||
/* Reset the key. */
|
||||
this->Reset();
|
||||
|
||||
/* Update the count and allocate the buffer. */
|
||||
m_count = count + 1;
|
||||
m_chars = static_cast<char *>(AllocateFromHeap(m_count));
|
||||
|
||||
|
||||
/* Copy the characters to the buffer. */
|
||||
std::memcpy(m_chars, chars, count);
|
||||
m_chars[count] = '\x00';
|
||||
|
@ -177,7 +177,7 @@ namespace ams::settings::impl {
|
|||
MapKey MakeMapKey(const SettingsName &name, const SettingsItemKey &item_key) {
|
||||
/* Create a map key. */
|
||||
MapKey key(name.value, util::Strnlen(name.value, util::size(name.value)));
|
||||
|
||||
|
||||
/* Append the settings name separator followed by the item key. */
|
||||
key.Append(SettingsNameSeparator);
|
||||
key.Append(item_key.value, util::Strnlen(item_key.value, util::size(item_key.value)));
|
||||
|
@ -205,10 +205,10 @@ namespace ams::settings::impl {
|
|||
public:
|
||||
Allocator() noexcept = default;
|
||||
~Allocator() noexcept = default;
|
||||
|
||||
|
||||
Allocator(const Allocator &) noexcept = default;
|
||||
Allocator(Allocator &&) noexcept = default;
|
||||
|
||||
|
||||
T *allocate(size_t n) noexcept {
|
||||
return static_cast<T *>(AllocateFromHeap(sizeof(T) * n));
|
||||
}
|
||||
|
@ -222,14 +222,14 @@ namespace ams::settings::impl {
|
|||
};
|
||||
|
||||
template<class T, class U>
|
||||
constexpr inline bool operator==(const Allocator<T> &, const Allocator<U> &) {
|
||||
constexpr inline bool operator==(const Allocator<T> &, const Allocator<U> &) {
|
||||
return true;
|
||||
}
|
||||
|
||||
constexpr inline size_t MapKeyBufferSize = MapKey::MaxKeySize * 2;
|
||||
constexpr inline size_t MapEntryBufferSize = 0x40 + sizeof(Map::value_type);
|
||||
|
||||
constexpr inline size_t HeapMemorySize = 512_KB;
|
||||
constexpr inline size_t HeapMemorySize = 512_KB;
|
||||
|
||||
constinit os::SdkMutex g_key_value_store_mutex;
|
||||
|
||||
|
@ -258,7 +258,7 @@ namespace ams::settings::impl {
|
|||
if (lhs_size == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Compare the two values if they are non-null. */
|
||||
return lhs != nullptr && rhs != nullptr && std::memcmp(lhs, rhs, lhs_size) == 0;
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ namespace ams::settings::impl {
|
|||
/* If the default value size is > 0, copy it to the map value. */
|
||||
if (map_value.default_value_size > 0) {
|
||||
/* Allocate the default value if there is sufficient memory available. */
|
||||
R_UNLESS(GetHeapAllocatableSize() >= map_value.default_value_size, ResultSettingsItemValueAllocationFailed());
|
||||
R_UNLESS(GetHeapAllocatableSize() >= map_value.default_value_size, settings::ResultSettingsItemValueAllocationFailed());
|
||||
map_value.default_value = AllocateFromHeap(map_value.default_value_size);
|
||||
AMS_ASSERT(map_value.default_value != nullptr);
|
||||
|
||||
|
@ -389,14 +389,14 @@ namespace ams::settings::impl {
|
|||
map_value.current_value = map_value.default_value;
|
||||
} else if (map_value.current_value_size > 0) {
|
||||
/* Allocate the current value if there is sufficient memory available. */
|
||||
R_UNLESS(GetHeapAllocatableSize() >= map_value.current_value_size, ResultSettingsItemValueAllocationFailed());
|
||||
R_UNLESS(GetHeapAllocatableSize() >= map_value.current_value_size, settings::ResultSettingsItemValueAllocationFailed());
|
||||
map_value.current_value = AllocateFromHeap(map_value.current_value_size);
|
||||
AMS_ASSERT(map_value.current_value != nullptr);
|
||||
|
||||
/* Copy the current value from the item. */
|
||||
std::memcpy(map_value.current_value, item.current_value, map_value.current_value_size);
|
||||
}
|
||||
|
||||
|
||||
/* Set the output map value. */
|
||||
*out = map_value;
|
||||
|
||||
|
@ -408,12 +408,12 @@ namespace ams::settings::impl {
|
|||
|
||||
template<typename T>
|
||||
const char *GetSystemDataMountName();
|
||||
|
||||
|
||||
template<>
|
||||
const char *GetSystemDataMountName<SystemDataTag::Fwdbg>() {
|
||||
return FwdbgSystemDataMountName;
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
const char *GetSystemDataMountName<SystemDataTag::PfCfg>() {
|
||||
return PfCfgSystemDataMountName;
|
||||
|
@ -423,7 +423,7 @@ namespace ams::settings::impl {
|
|||
Result GetSystemData(SystemData **out_data, ncm::SystemDataId id) {
|
||||
/* Check pre-conditions. */
|
||||
AMS_ASSERT(out_data != nullptr);
|
||||
|
||||
|
||||
/* Declare static instance variables. */
|
||||
static constinit util::TypedStorage<SystemData> s_storage = {};
|
||||
static constinit bool s_initialized = false;
|
||||
|
@ -512,7 +512,7 @@ namespace ams::settings::impl {
|
|||
SystemData *system_data = nullptr;
|
||||
R_TRY(GetSystemData<SystemDataTag::Fwdbg>(std::addressof(system_data), ncm::SystemDataId::FirmwareDebugSettings));
|
||||
AMS_ASSERT(system_data != nullptr);
|
||||
|
||||
|
||||
/* Load the default keys/values for the firmware debug system data. */
|
||||
R_TRY(LoadKeyValueStoreMapDefault(out, *system_data));
|
||||
|
||||
|
@ -548,10 +548,10 @@ namespace ams::settings::impl {
|
|||
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
||||
Result LoadKeyValueStoreMap(Map *out, SplHardwareType hardware_type) {
|
||||
SystemData *data = nullptr;
|
||||
|
||||
|
||||
/* Get the platform configuration system data for the hardware type. */
|
||||
switch (hardware_type) {
|
||||
case SplHardwareType_None:
|
||||
|
@ -604,8 +604,8 @@ namespace ams::settings::impl {
|
|||
|
||||
if (current_value_size > 0) {
|
||||
/* Ensure there is sufficient memory for the value. */
|
||||
R_UNLESS(GetHeapAllocatableSize() >= current_value_size, ResultSettingsItemValueAllocationFailed());
|
||||
|
||||
R_UNLESS(GetHeapAllocatableSize() >= current_value_size, settings::ResultSettingsItemValueAllocationFailed());
|
||||
|
||||
/* Allocate the value buffer. */
|
||||
current_value_buffer = AllocateFromHeap(current_value_size);
|
||||
AMS_ASSERT(current_value_buffer != nullptr);
|
||||
|
@ -642,22 +642,22 @@ namespace ams::settings::impl {
|
|||
/* Load the map entries. */
|
||||
R_TRY(LoadKeyValueStoreMapEntries(out, data, [](Map &map, const MapKey &key, u8 type, const void *value_buffer, u32 value_size) -> Result {
|
||||
/* Ensure there is sufficient memory for two keys. */
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapKeyBufferSize, ResultSettingsItemKeyAllocationFailed());
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapKeyBufferSize, settings::ResultSettingsItemKeyAllocationFailed());
|
||||
|
||||
/* Copy the map key. */
|
||||
MapKey default_key = key;
|
||||
void *default_value_buffer = nullptr;
|
||||
|
||||
ON_SCOPE_EXIT {
|
||||
ON_SCOPE_EXIT {
|
||||
/* Free the value buffer if allocated. */
|
||||
if (default_value_buffer != nullptr) {
|
||||
FreeToHeap(default_value_buffer, value_size);
|
||||
FreeToHeap(default_value_buffer, value_size);
|
||||
}
|
||||
};
|
||||
|
||||
if (value_size > 0) {
|
||||
/* Ensure there is sufficient memory for the value. */
|
||||
R_UNLESS(GetHeapAllocatableSize() >= value_size, ResultSettingsItemValueAllocationFailed());
|
||||
R_UNLESS(GetHeapAllocatableSize() >= value_size, settings::ResultSettingsItemValueAllocationFailed());
|
||||
|
||||
/* Allocate the value buffer. */
|
||||
default_value_buffer = AllocateFromHeap(value_size);
|
||||
|
@ -669,16 +669,16 @@ namespace ams::settings::impl {
|
|||
|
||||
/* Create the map value. */
|
||||
MapValue default_value {
|
||||
.type = type,
|
||||
.current_value_size = value_size,
|
||||
.default_value_size = value_size,
|
||||
.type = type,
|
||||
.current_value_size = value_size,
|
||||
.default_value_size = value_size,
|
||||
.current_value = default_value_buffer,
|
||||
.default_value = default_value_buffer,
|
||||
};
|
||||
|
||||
/* Ensure there is sufficient memory for the value. */
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapEntryBufferSize, ResultSettingsItemValueAllocationFailed());
|
||||
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapEntryBufferSize, settings::ResultSettingsItemValueAllocationFailed());
|
||||
|
||||
/* Insert the value into the map. */
|
||||
map[std::move(default_key)] = default_value;
|
||||
return ResultSuccess();
|
||||
|
@ -697,7 +697,7 @@ namespace ams::settings::impl {
|
|||
s64 offset = 0;
|
||||
u32 total_size = 0;
|
||||
R_TRY(ReadData(data, offset, std::addressof(total_size), sizeof(total_size)));
|
||||
|
||||
|
||||
/* Iterate through all entries. NOTE: The offset is updated within LoadKeyValueStoreMapEntry. */
|
||||
while (offset < total_size) {
|
||||
R_TRY(LoadKeyValueStoreMapEntry(out, data, offset, load));
|
||||
|
@ -718,8 +718,8 @@ namespace ams::settings::impl {
|
|||
AMS_ASSERT(key_size > 1);
|
||||
|
||||
/* Ensure there is sufficient memory for this key. */
|
||||
R_UNLESS(GetHeapAllocatableSize() >= key_size, ResultSettingsItemKeyAllocationFailed());
|
||||
|
||||
R_UNLESS(GetHeapAllocatableSize() >= key_size, settings::ResultSettingsItemKeyAllocationFailed());
|
||||
|
||||
/* Read the key. */
|
||||
void *key_buffer = nullptr;
|
||||
R_TRY(ReadDataToHeap(data, offset, std::addressof(key_buffer), key_size));
|
||||
|
@ -727,7 +727,7 @@ namespace ams::settings::impl {
|
|||
ON_SCOPE_EXIT { FreeToHeap(key_buffer, key_size); };
|
||||
|
||||
/* Ensure there is sufficient memory for two keys. */
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapKeyBufferSize, ResultSettingsItemKeyAllocationFailed());
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapKeyBufferSize, settings::ResultSettingsItemKeyAllocationFailed());
|
||||
|
||||
const MapKey key(static_cast<const char *>(key_buffer), key_size - 1);
|
||||
|
||||
|
@ -740,15 +740,15 @@ namespace ams::settings::impl {
|
|||
R_TRY(ReadData(data, offset, std::addressof(value_size), sizeof(value_size)));
|
||||
|
||||
void *value_buffer = nullptr;
|
||||
ON_SCOPE_EXIT {
|
||||
ON_SCOPE_EXIT {
|
||||
if (value_buffer != nullptr) {
|
||||
FreeToHeap(value_buffer, value_size);
|
||||
FreeToHeap(value_buffer, value_size);
|
||||
}
|
||||
};
|
||||
|
||||
if (value_size > 0) {
|
||||
/* Ensure there is sufficient memory for the value. */
|
||||
R_UNLESS(GetHeapAllocatableSize() >= value_size, ResultSettingsItemValueAllocationFailed());
|
||||
R_UNLESS(GetHeapAllocatableSize() >= value_size, settings::ResultSettingsItemValueAllocationFailed());
|
||||
|
||||
/* Read the value to the buffer. */
|
||||
R_TRY(ReadDataToHeap(data, offset, std::addressof(value_buffer), value_size));
|
||||
|
@ -778,14 +778,14 @@ namespace ams::settings::impl {
|
|||
R_TRY(LoadKeyValueStoreMapCurrent(out, *system_save_data));
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
Result ReadData(T &data, s64 &offset, void *buffer, size_t size) {
|
||||
AMS_ASSERT(buffer != nullptr);
|
||||
|
||||
|
||||
/* Read the data. */
|
||||
R_TRY(data.Read(offset, buffer, size));
|
||||
|
||||
|
||||
/* Increment the offset. */
|
||||
offset += static_cast<s64>(size);
|
||||
return ResultSuccess();
|
||||
|
@ -800,13 +800,13 @@ namespace ams::settings::impl {
|
|||
/* Allocate a buffer from the heap. */
|
||||
*buffer = AllocateFromHeap(size);
|
||||
AMS_ASSERT(*buffer != nullptr);
|
||||
|
||||
|
||||
/* Ensure we free the buffer if we fail. */
|
||||
auto alloc_guard = SCOPE_GUARD { FreeToHeap(*buffer, size); *buffer = nullptr; };
|
||||
|
||||
|
||||
/* Read data to the buffer. */
|
||||
R_TRY(ReadData(data, offset, *buffer, size));
|
||||
|
||||
|
||||
/* We succeeded. */
|
||||
alloc_guard.Cancel();
|
||||
return ResultSuccess();
|
||||
|
@ -909,7 +909,7 @@ namespace ams::settings::impl {
|
|||
/* Check preconditions. */
|
||||
AMS_ASSERT(out_count != nullptr);
|
||||
AMS_ASSERT(out_buffer);
|
||||
|
||||
|
||||
/* Attempt to get the system save data. */
|
||||
SystemSaveData *system_save_data = nullptr;
|
||||
if (R_SUCCEEDED(GetSystemSaveData(std::addressof(system_save_data), false))) {
|
||||
|
@ -951,7 +951,7 @@ namespace ams::settings::impl {
|
|||
ON_SCOPE_EXIT {
|
||||
/* Flush and close the save data. NOTE: Nintendo only does this if SetFileSize succeeds. */
|
||||
R_ABORT_UNLESS(data.Flush());
|
||||
data.Close();
|
||||
data.Close();
|
||||
};
|
||||
|
||||
/* Set the file size of the save data. */
|
||||
|
@ -970,7 +970,7 @@ namespace ams::settings::impl {
|
|||
u8 type = 0;
|
||||
const void *value_buffer = nullptr;
|
||||
u32 value_size = 0;
|
||||
|
||||
|
||||
/* Test if the map value varies from the default. */
|
||||
if (test(std::addressof(type), std::addressof(value_buffer), std::addressof(value_size), kv_pair.second)) {
|
||||
R_TRY(SaveKeyValueStoreMapEntry(data, current_offset, kv_pair.first, type, value_buffer, value_size));
|
||||
|
@ -1075,7 +1075,7 @@ namespace ams::settings::impl {
|
|||
AMS_ASSERT(map != nullptr);
|
||||
|
||||
/* Ensure there is sufficient memory for two keys. */
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapKeyBufferSize, ResultSettingsItemKeyAllocationFailed());
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapKeyBufferSize, settings::ResultSettingsItemKeyAllocationFailed());
|
||||
|
||||
/* Create a map key from the key value store's name. */
|
||||
MapKey map_key_header(m_name.value);
|
||||
|
@ -1089,7 +1089,7 @@ namespace ams::settings::impl {
|
|||
/* Find an item map key with the name as a prefix. */
|
||||
for (const auto &kv_pair : *map) {
|
||||
const MapKey &map_key = kv_pair.first;
|
||||
|
||||
|
||||
/* Check if the name map key is smaller than the current map key, and the current map key contains the name map key. */
|
||||
if (map_key_header < map_key && map_key.Find(map_key_header)) {
|
||||
item_map_key = std::addressof(map_key);
|
||||
|
@ -1098,12 +1098,12 @@ namespace ams::settings::impl {
|
|||
}
|
||||
|
||||
/* Ensure we have located an item map key. */
|
||||
R_UNLESS(item_map_key != nullptr, ResultSettingsItemNotFound());
|
||||
R_UNLESS(item_map_key != nullptr, settings::ResultSettingsItemNotFound());
|
||||
|
||||
/* Ensure there is sufficient memory for the item map key. */
|
||||
const size_t item_map_key_size = item_map_key->GetCount() + 1;
|
||||
R_UNLESS(GetHeapAllocatableSize() >= item_map_key_size, ResultSettingsItemKeyIteratorAllocationFailed());
|
||||
|
||||
R_UNLESS(GetHeapAllocatableSize() >= item_map_key_size, settings::ResultSettingsItemKeyIteratorAllocationFailed());
|
||||
|
||||
/* Allocate the key buffer. */
|
||||
char *buffer = static_cast<char *>(AllocateFromHeap(item_map_key_size));
|
||||
AMS_ASSERT(buffer != nullptr);
|
||||
|
@ -1134,11 +1134,11 @@ namespace ams::settings::impl {
|
|||
AMS_ASSERT(map != nullptr);
|
||||
|
||||
/* Ensure there is sufficient memory for two keys. */
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapKeyBufferSize, ResultSettingsItemKeyAllocationFailed());
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapKeyBufferSize, settings::ResultSettingsItemKeyAllocationFailed());
|
||||
|
||||
/* Find the key in the map. */
|
||||
const Map::const_iterator it = map->find(MakeMapKey(m_name, item_key));
|
||||
R_UNLESS(it != map->end(), ResultSettingsItemNotFound());
|
||||
R_UNLESS(it != map->end(), settings::ResultSettingsItemNotFound());
|
||||
|
||||
/* Get the map value from the iterator. */
|
||||
const MapValue &map_value = it->second;
|
||||
|
@ -1170,11 +1170,11 @@ namespace ams::settings::impl {
|
|||
AMS_ASSERT(map != nullptr);
|
||||
|
||||
/* Ensure there is sufficient memory for two keys. */
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapKeyBufferSize, ResultSettingsItemKeyAllocationFailed());
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapKeyBufferSize, settings::ResultSettingsItemKeyAllocationFailed());
|
||||
|
||||
/* Find the key in the map. */
|
||||
const Map::const_iterator it = map->find(MakeMapKey(m_name, item_key));
|
||||
R_UNLESS(it != map->end(), ResultSettingsItemNotFound());
|
||||
R_UNLESS(it != map->end(), settings::ResultSettingsItemNotFound());
|
||||
|
||||
/* Output the value size. */
|
||||
*out_value_size = it->second.current_value_size;
|
||||
|
@ -1191,11 +1191,11 @@ namespace ams::settings::impl {
|
|||
AMS_ASSERT(map != nullptr);
|
||||
|
||||
/* Ensure there is sufficient memory for two keys. */
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapKeyBufferSize, ResultSettingsItemKeyAllocationFailed());
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapKeyBufferSize, settings::ResultSettingsItemKeyAllocationFailed());
|
||||
|
||||
/* Find the key in the map. */
|
||||
const Map::iterator it = map->find(MakeMapKey(m_name, item_key));
|
||||
R_UNLESS(it != map->end(), ResultSettingsItemNotFound());
|
||||
R_UNLESS(it != map->end(), settings::ResultSettingsItemNotFound());
|
||||
|
||||
/* Get the map value from the iterator. */
|
||||
MapValue &map_value = it->second;
|
||||
|
@ -1233,7 +1233,7 @@ namespace ams::settings::impl {
|
|||
Result KeyValueStore::SetValue(const SettingsItemKey &item_key, const void *buffer, size_t buffer_size) {
|
||||
/* Check preconditions. */
|
||||
AMS_ASSERT(buffer != nullptr);
|
||||
|
||||
|
||||
/* Acquire exclusive access to global state. */
|
||||
std::scoped_lock lk(g_key_value_store_mutex);
|
||||
|
||||
|
@ -1243,18 +1243,18 @@ namespace ams::settings::impl {
|
|||
AMS_ASSERT(map != nullptr);
|
||||
|
||||
/* Ensure there is sufficient memory for two keys. */
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapKeyBufferSize, ResultSettingsItemKeyAllocationFailed());
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapKeyBufferSize, settings::ResultSettingsItemKeyAllocationFailed());
|
||||
|
||||
/* Find the key in the map. */
|
||||
const Map::iterator it = map->find(MakeMapKey(m_name, item_key));
|
||||
R_UNLESS(it != map->end(), ResultSettingsItemNotFound());
|
||||
R_UNLESS(it != map->end(), settings::ResultSettingsItemNotFound());
|
||||
|
||||
/* Get the map value from the iterator. */
|
||||
MapValue &map_value = it->second;
|
||||
|
||||
/* Succeed if the map value is already set to the new value. */
|
||||
R_SUCCEED_IF(CompareValue(map_value.current_value, map_value.current_value_size, buffer, buffer_size));
|
||||
|
||||
|
||||
/* Define the value buffer and size variables. */
|
||||
size_t value_size = buffer_size;
|
||||
void *value_buffer = nullptr;
|
||||
|
@ -1264,7 +1264,7 @@ namespace ams::settings::impl {
|
|||
value_buffer = map_value.default_value;
|
||||
} else if (buffer_size > 0) {
|
||||
/* Allocate the new value if there is sufficient memory available. */
|
||||
R_UNLESS(GetHeapAllocatableSize() >= value_size, ResultSettingsItemValueAllocationFailed());
|
||||
R_UNLESS(GetHeapAllocatableSize() >= value_size, settings::ResultSettingsItemValueAllocationFailed());
|
||||
value_buffer = AllocateFromHeap(value_size);
|
||||
AMS_ASSERT(value_buffer != nullptr);
|
||||
|
||||
|
@ -1302,7 +1302,7 @@ namespace ams::settings::impl {
|
|||
Result AddKeyValueStoreItemForDebug(const KeyValueStoreItemForDebug * const items, size_t items_count) {
|
||||
/* Check preconditions. */
|
||||
AMS_ASSERT(items != nullptr);
|
||||
|
||||
|
||||
/* Acquire exclusive access to global state. */
|
||||
std::scoped_lock lk(g_key_value_store_mutex);
|
||||
|
||||
|
@ -1323,7 +1323,7 @@ namespace ams::settings::impl {
|
|||
R_TRY(GetMapValueOfKeyValueStoreItemForDebug(std::addressof(map_value), item));
|
||||
|
||||
/* Ensure there is sufficient memory for two keys. */
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapKeyBufferSize, ResultSettingsItemKeyAllocationFailed());
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapKeyBufferSize, settings::ResultSettingsItemKeyAllocationFailed());
|
||||
|
||||
/* Create the map key. */
|
||||
MapKey map_key(item.key);
|
||||
|
@ -1337,8 +1337,8 @@ namespace ams::settings::impl {
|
|||
it->second = map_value;
|
||||
} else {
|
||||
/* Ensure there is sufficient memory for the value. */
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapEntryBufferSize, ResultSettingsItemValueAllocationFailed());
|
||||
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapEntryBufferSize, settings::ResultSettingsItemValueAllocationFailed());
|
||||
|
||||
/* Assign the map value to the map key in the map. */
|
||||
(*map)[std::move(map_key)] = map_value;
|
||||
}
|
||||
|
@ -1367,24 +1367,24 @@ namespace ams::settings::impl {
|
|||
AMS_ASSERT(map != nullptr);
|
||||
|
||||
/* Ensure there is sufficient memory for two keys. */
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapKeyBufferSize, ResultSettingsItemKeyAllocationFailed());
|
||||
R_UNLESS(GetHeapAllocatableSize() >= MapKeyBufferSize, settings::ResultSettingsItemKeyAllocationFailed());
|
||||
|
||||
/* Locate the iterator's current key. */
|
||||
Map::const_iterator it = map->find(MapKey(out->map_key, static_cast<s32>(out->entire_size) - 1));
|
||||
R_UNLESS(it != map->end(), ResultNotFoundSettingsItemKeyIterator());
|
||||
R_UNLESS(it != map->end(), settings::ResultNotFoundSettingsItemKeyIterator());
|
||||
|
||||
/* Increment the iterator, ensuring we aren't at the end of the map. */
|
||||
R_UNLESS((++it) != map->end(), ResultStopIteration());
|
||||
R_UNLESS((++it) != map->end(), settings::ResultStopIteration());
|
||||
|
||||
/* Get the map key. */
|
||||
const MapKey &map_key = it->first;
|
||||
|
||||
|
||||
/* Ensure the advanced iterator retains the required name. */
|
||||
R_UNLESS(std::strncmp(map_key.GetString(), out->map_key, out->header_size) == 0, ResultStopIteration());
|
||||
R_UNLESS(std::strncmp(map_key.GetString(), out->map_key, out->header_size) == 0, settings::ResultStopIteration());
|
||||
|
||||
/* Ensure there is sufficient memory for the map key. */
|
||||
const size_t map_key_size = map_key.GetCount() + 1;
|
||||
R_UNLESS(GetHeapAllocatableSize() >= map_key_size, ResultSettingsItemKeyIteratorAllocationFailed());
|
||||
R_UNLESS(GetHeapAllocatableSize() >= map_key_size, settings::ResultSettingsItemKeyIteratorAllocationFailed());
|
||||
|
||||
/* Free the iterator's old map key. */
|
||||
FreeToHeap(out->map_key, out->entire_size);
|
||||
|
@ -1402,7 +1402,7 @@ namespace ams::settings::impl {
|
|||
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
||||
Result DestroyKeyValueStoreKeyIterator(KeyValueStoreKeyIterator *out) {
|
||||
/* Check preconditions. */
|
||||
AMS_ASSERT(out != nullptr);
|
||||
|
@ -1439,7 +1439,7 @@ namespace ams::settings::impl {
|
|||
*out_count = map->size();
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
||||
Result GetKeyValueStoreItemForDebug(u64 *out_count, KeyValueStoreItemForDebug * const out_items, size_t out_items_count) {
|
||||
/* Check preconditions. */
|
||||
AMS_ASSERT(out_count != nullptr);
|
||||
|
@ -1466,7 +1466,7 @@ namespace ams::settings::impl {
|
|||
break;
|
||||
}
|
||||
|
||||
/* Get the current item. */
|
||||
/* Get the current item. */
|
||||
KeyValueStoreItemForDebug &item = out_items[count++];
|
||||
|
||||
/* Copy the map key and value to the item. */
|
||||
|
@ -1494,7 +1494,7 @@ namespace ams::settings::impl {
|
|||
/* Copy the key from the iterator to the output buffer. */
|
||||
const size_t key_size = std::min(out_buffer_size, std::min(iterator.entire_size - iterator.header_size, SettingsItemKeyLengthMax + 1));
|
||||
std::strncpy(out_buffer, iterator.map_key + iterator.header_size, key_size);
|
||||
|
||||
|
||||
/* Set the end of the key to null. */
|
||||
if (key_size > 0) {
|
||||
out_buffer[key_size - 1] = '\x00';
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace ams::settings::impl {
|
|||
const SettingsName &m_name;
|
||||
public:
|
||||
explicit KeyValueStore(const SettingsName &name) : m_name(name) { /* ... */ }
|
||||
|
||||
|
||||
Result CreateKeyIterator(KeyValueStoreKeyIterator *out);
|
||||
Result GetValue(u64 *out_count, char *out_buffer, size_t out_buffer_size, const SettingsItemKey &item_key);
|
||||
Result GetValueSize(u64 *out_value_size, const SettingsItemKey &item_key);
|
||||
|
|
|
@ -200,7 +200,7 @@ namespace ams::settings::impl {
|
|||
s64 file_size = 0;
|
||||
R_TRY(fs::GetFileSize(std::addressof(file_size), file));
|
||||
AMS_ASSERT(0 <= file_size && file_size <= static_cast<s64>(sizeof(m_buffer)));
|
||||
R_UNLESS(file_size <= static_cast<s64>(sizeof(m_buffer)), ResultTooLargeSystemSaveData());
|
||||
R_UNLESS(file_size <= static_cast<s64>(sizeof(m_buffer)), settings::ResultTooLargeSystemSaveData());
|
||||
|
||||
/* Read the save file. */
|
||||
R_TRY(fs::ReadFile(file, 0, m_buffer, static_cast<size_t>(file_size)));
|
||||
|
|
|
@ -51,9 +51,9 @@ namespace ams::updater {
|
|||
|
||||
/* Implementations. */
|
||||
Result ValidateWorkBuffer(const void *work_buffer, size_t work_buffer_size) {
|
||||
R_UNLESS(work_buffer_size >= BctSize + EksSize, ResultTooSmallWorkBuffer());
|
||||
R_UNLESS(util::IsAligned(work_buffer, os::MemoryPageSize), ResultNotAlignedWorkBuffer());
|
||||
R_UNLESS(util::IsAligned(work_buffer_size, 0x200), ResultNotAlignedWorkBuffer());
|
||||
R_UNLESS(work_buffer_size >= BctSize + EksSize, updater::ResultTooSmallWorkBuffer());
|
||||
R_UNLESS(util::IsAligned(work_buffer, os::MemoryPageSize), updater::ResultNotAlignedWorkBuffer());
|
||||
R_UNLESS(util::IsAligned(work_buffer_size, 0x200), updater::ResultNotAlignedWorkBuffer());
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ namespace ams::updater {
|
|||
/* Mount the boot image package. */
|
||||
const char *mount_name = GetMountName();
|
||||
R_TRY_CATCH(fs::MountSystemData(mount_name, data_id)) {
|
||||
R_CONVERT(fs::ResultTargetNotFound, ResultBootImagePackageNotFound())
|
||||
R_CONVERT(fs::ResultTargetNotFound, updater::ResultBootImagePackageNotFound())
|
||||
} R_END_TRY_CATCH;
|
||||
ON_SCOPE_EXIT { fs::Unmount(mount_name); };
|
||||
|
||||
|
@ -202,7 +202,7 @@ namespace ams::updater {
|
|||
/* Mount the boot image package. */
|
||||
const char *mount_name = GetMountName();
|
||||
R_TRY_CATCH(fs::MountSystemData(mount_name, data_id)) {
|
||||
R_CONVERT(fs::ResultTargetNotFound, ResultBootImagePackageNotFound())
|
||||
R_CONVERT(fs::ResultTargetNotFound, updater::ResultBootImagePackageNotFound())
|
||||
} R_END_TRY_CATCH;
|
||||
ON_SCOPE_EXIT { fs::Unmount(mount_name); };
|
||||
|
||||
|
@ -264,7 +264,7 @@ namespace ams::updater {
|
|||
/* Mount the boot image package. */
|
||||
const char *mount_name = GetMountName();
|
||||
R_TRY_CATCH(fs::MountSystemData(mount_name, data_id)) {
|
||||
R_CONVERT(fs::ResultTargetNotFound, ResultBootImagePackageNotFound())
|
||||
R_CONVERT(fs::ResultTargetNotFound, updater::ResultBootImagePackageNotFound())
|
||||
} R_END_TRY_CATCH;
|
||||
ON_SCOPE_EXIT { fs::Unmount(mount_name); };
|
||||
|
||||
|
@ -330,7 +330,7 @@ namespace ams::updater {
|
|||
/* Mount the boot image package. */
|
||||
const char *mount_name = GetMountName();
|
||||
R_TRY_CATCH(fs::MountSystemData(mount_name, data_id)) {
|
||||
R_CONVERT(fs::ResultTargetNotFound, ResultBootImagePackageNotFound())
|
||||
R_CONVERT(fs::ResultTargetNotFound, updater::ResultBootImagePackageNotFound())
|
||||
} R_END_TRY_CATCH;
|
||||
ON_SCOPE_EXIT { fs::Unmount(mount_name); };
|
||||
|
||||
|
@ -450,7 +450,7 @@ namespace ams::updater {
|
|||
}
|
||||
|
||||
Result CompareHash(const void *lhs, const void *rhs, size_t size) {
|
||||
R_UNLESS(crypto::IsSameBytes(lhs, rhs, size), ResultNeedsRepairBootImages());
|
||||
R_UNLESS(crypto::IsSameBytes(lhs, rhs, size), updater::ResultNeedsRepairBootImages());
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
@ -493,7 +493,7 @@ namespace ams::updater {
|
|||
const auto content_meta_type = GetContentMetaType(mode);
|
||||
|
||||
auto count = db.ListContentMeta(keys, MaxContentMetas, content_meta_type);
|
||||
R_UNLESS(count.total > 0, ResultBootImagePackageNotFound());
|
||||
R_UNLESS(count.total > 0, updater::ResultBootImagePackageNotFound());
|
||||
|
||||
/* Output is sorted, return the lowest valid exfat entry. */
|
||||
if (count.total > 1) {
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace ams::updater {
|
|||
|
||||
fs::FileHandle file;
|
||||
R_TRY_CATCH(fs::OpenFile(std::addressof(file), bip_path, fs::OpenMode_Read)) {
|
||||
R_CONVERT(fs::ResultPathNotFound, ResultInvalidBootImagePackage())
|
||||
R_CONVERT(fs::ResultPathNotFound, updater::ResultInvalidBootImagePackage())
|
||||
} R_END_TRY_CATCH;
|
||||
ON_SCOPE_EXIT { fs::CloseFile(file); };
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace ams::updater {
|
|||
/* Open the file. */
|
||||
fs::FileHandle file;
|
||||
R_TRY_CATCH(fs::OpenFile(std::addressof(file), path, fs::OpenMode_Read)) {
|
||||
R_CONVERT(fs::ResultPathNotFound, ResultInvalidBootImagePackage())
|
||||
R_CONVERT(fs::ResultPathNotFound, updater::ResultInvalidBootImagePackage())
|
||||
} R_END_TRY_CATCH;
|
||||
ON_SCOPE_EXIT { fs::CloseFile(file); };
|
||||
|
||||
|
@ -34,7 +34,7 @@ namespace ams::updater {
|
|||
/* Open the file. */
|
||||
fs::FileHandle file;
|
||||
R_TRY_CATCH(fs::OpenFile(std::addressof(file), path, fs::OpenMode_Read)) {
|
||||
R_CONVERT(fs::ResultPathNotFound, ResultInvalidBootImagePackage())
|
||||
R_CONVERT(fs::ResultPathNotFound, updater::ResultInvalidBootImagePackage())
|
||||
} R_END_TRY_CATCH;
|
||||
ON_SCOPE_EXIT { fs::CloseFile(file); };
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue