mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-03 16:18:51 -04:00
ams: globally prefer R_RETURN to return for ams::Result
This commit is contained in:
parent
dd78ede99f
commit
bbf22b4c60
325 changed files with 1955 additions and 1993 deletions
|
@ -227,11 +227,11 @@ namespace ams::kvdb {
|
|||
}
|
||||
|
||||
static Result DirectoryExists(bool *out, const char *path) {
|
||||
return Exists(out, path, fs::DirectoryEntryType_Directory);
|
||||
R_RETURN(Exists(out, path, fs::DirectoryEntryType_Directory));
|
||||
}
|
||||
|
||||
static Result FileExists(bool *out, const char *path) {
|
||||
return Exists(out, path, fs::DirectoryEntryType_File);
|
||||
R_RETURN(Exists(out, path, fs::DirectoryEntryType_File));
|
||||
}
|
||||
public:
|
||||
static Result CreateNewCache(const char *dir) {
|
||||
|
@ -298,18 +298,18 @@ namespace ams::kvdb {
|
|||
Result Get(size_t *out_size, void *out_value, size_t max_out_size, const Key &key) {
|
||||
/* Note that we accessed the key. */
|
||||
m_lru_list.Update(key);
|
||||
return m_kvs.Get(out_size, out_value, max_out_size, key);
|
||||
R_RETURN(m_kvs.Get(out_size, out_value, max_out_size, key));
|
||||
}
|
||||
|
||||
template<typename Value>
|
||||
Result Get(Value *out_value, const Key &key) {
|
||||
/* Note that we accessed the key. */
|
||||
m_lru_list.Update(key);
|
||||
return m_kvs.Get(out_value, key);
|
||||
R_RETURN(m_kvs.Get(out_value, key));
|
||||
}
|
||||
|
||||
Result GetSize(size_t *out_size, const Key &key) {
|
||||
return m_kvs.GetSize(out_size, key);
|
||||
R_RETURN(m_kvs.GetSize(out_size, key));
|
||||
}
|
||||
|
||||
Result Set(const Key &key, const void *value, size_t value_size) {
|
||||
|
@ -356,7 +356,7 @@ namespace ams::kvdb {
|
|||
|
||||
template<typename Value>
|
||||
Result Set(const Key &key, const Value &value) {
|
||||
return this->Set(key, &value, sizeof(Value));
|
||||
R_RETURN(this->Set(key, &value, sizeof(Value)));
|
||||
}
|
||||
|
||||
Result Remove(const Key &key) {
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace ams::kvdb {
|
|||
template<typename Key>
|
||||
Result Get(size_t *out_size, void *out_value, size_t max_out_size, const Key &key) {
|
||||
static_assert(util::is_pod<Key>::value && sizeof(Key) <= MaxKeySize, "Invalid FileKeyValueStore Key!");
|
||||
return this->Get(out_size, out_value, max_out_size, std::addressof(key), sizeof(Key));
|
||||
R_RETURN(this->Get(out_size, out_value, max_out_size, std::addressof(key), sizeof(Key)));
|
||||
}
|
||||
|
||||
template<typename Key, typename Value>
|
||||
|
@ -98,24 +98,24 @@ namespace ams::kvdb {
|
|||
|
||||
template<typename Key>
|
||||
Result GetSize(size_t *out_size, const Key &key) {
|
||||
return this->GetSize(out_size, std::addressof(key), sizeof(Key));
|
||||
R_RETURN(this->GetSize(out_size, std::addressof(key), sizeof(Key)));
|
||||
}
|
||||
|
||||
template<typename Key>
|
||||
Result Set(const Key &key, const void *value, size_t value_size) {
|
||||
static_assert(util::is_pod<Key>::value && sizeof(Key) <= MaxKeySize, "Invalid FileKeyValueStore Key!");
|
||||
return this->Set(std::addressof(key), sizeof(Key), value, value_size);
|
||||
R_RETURN(this->Set(std::addressof(key), sizeof(Key), value, value_size));
|
||||
}
|
||||
|
||||
template<typename Key, typename Value>
|
||||
Result Set(const Key &key, const Value &value) {
|
||||
static_assert(util::is_pod<Value>::value && !std::is_pointer<Value>::value, "Invalid FileKeyValueStore Value!");
|
||||
return this->Set(key, std::addressof(value), sizeof(Value));
|
||||
R_RETURN(this->Set(key, std::addressof(value), sizeof(Value)));
|
||||
}
|
||||
|
||||
template<typename Key>
|
||||
Result Remove(const Key &key) {
|
||||
return this->Remove(std::addressof(key), sizeof(Key));
|
||||
R_RETURN(this->Remove(std::addressof(key), sizeof(Key)));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -355,25 +355,25 @@ namespace ams::kvdb {
|
|||
}
|
||||
|
||||
/* Save the buffer to disk. */
|
||||
return this->Commit(buffer, destructive);
|
||||
R_RETURN(this->Commit(buffer, destructive));
|
||||
}
|
||||
|
||||
Result Set(const Key &key, const void *value, size_t value_size) {
|
||||
return m_index.Set(key, value, value_size);
|
||||
R_RETURN(m_index.Set(key, value, value_size));
|
||||
}
|
||||
|
||||
template<typename Value>
|
||||
Result Set(const Key &key, const Value &value) {
|
||||
/* Only allow setting pod. */
|
||||
static_assert(util::is_pod<Value>::value, "KeyValueStore Values must be pod");
|
||||
return this->Set(key, std::addressof(value), sizeof(Value));
|
||||
R_RETURN(this->Set(key, std::addressof(value), sizeof(Value)));
|
||||
}
|
||||
|
||||
template<typename Value>
|
||||
Result Set(const Key &key, const Value *value) {
|
||||
/* Only allow setting pod. */
|
||||
static_assert(util::is_pod<Value>::value, "KeyValueStore Values must be pod");
|
||||
return this->Set(key, value, sizeof(Value));
|
||||
R_RETURN(this->Set(key, value, sizeof(Value)));
|
||||
}
|
||||
|
||||
Result Get(size_t *out_size, void *out_value, size_t max_out_size, const Key &key) {
|
||||
|
@ -427,7 +427,7 @@ namespace ams::kvdb {
|
|||
}
|
||||
|
||||
Result Remove(const Key &key) {
|
||||
return m_index.Remove(key);
|
||||
R_RETURN(m_index.Remove(key));
|
||||
}
|
||||
|
||||
Entry *begin() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue