ams: globally prefer R_RETURN to return for ams::Result

This commit is contained in:
Michael Scire
2022-03-26 14:48:33 -07:00
parent dd78ede99f
commit bbf22b4c60
325 changed files with 1955 additions and 1993 deletions

View File

@@ -81,23 +81,23 @@ namespace ams::fs {
using Base = KeyValueRomStorageTemplate<ImplKeyType, ValueType, MaxKeyLength>;
public:
Result Add(Position *out, const ClientKeyType &key, const Value &value) {
return Base::AddInternal(out, key.key, key.Hash(), key.name.path, key.name.length * sizeof(RomPathChar), value);
R_RETURN(Base::AddInternal(out, key.key, key.Hash(), key.name.path, key.name.length * sizeof(RomPathChar), value));
}
Result Get(Position *out_pos, Value *out_val, const ClientKeyType &key) {
return Base::GetInternal(out_pos, out_val, key.key, key.Hash(), key.name.path, key.name.length * sizeof(RomPathChar));
R_RETURN(Base::GetInternal(out_pos, out_val, key.key, key.Hash(), key.name.path, key.name.length * sizeof(RomPathChar)));
}
Result GetByPosition(ImplKey *out_key, Value *out_val, Position pos) {
return Base::GetByPosition(out_key, out_val, pos);
R_RETURN(Base::GetByPosition(out_key, out_val, pos));
}
Result GetByPosition(ImplKey *out_key, Value *out_val, void *out_aux, size_t *out_aux_size, Position pos) {
return Base::GetByPosition(out_key, out_val, out_aux, out_aux_size, pos);
R_RETURN(Base::GetByPosition(out_key, out_val, out_aux, out_aux_size, pos));
}
Result SetByPosition(Position pos, const Value &value) {
return Base::SetByPosition(pos, value);
R_RETURN(Base::SetByPosition(pos, value));
}
};

View File

@@ -175,7 +175,7 @@ namespace ams::fs {
Element elem;
R_TRY(this->ReadKeyValue(std::addressof(elem), pos));
elem.value = value;
return this->WriteKeyValue(std::addressof(elem), pos, nullptr, 0);
R_RETURN(this->WriteKeyValue(std::addressof(elem), pos, nullptr, 0));
}
private:
BucketIndex HashToBucket(u32 hash_key) const {
@@ -259,14 +259,14 @@ namespace ams::fs {
AMS_ASSERT(ind < m_bucket_count);
const s64 offset = ind * sizeof(Position);
return m_bucket_storage.Read(offset, out, sizeof(*out));
R_RETURN(m_bucket_storage.Read(offset, out, sizeof(*out)));
}
Result WriteBucket(Position pos, BucketIndex ind) {
AMS_ASSERT(ind < m_bucket_count);
const s64 offset = ind * sizeof(Position);
return m_bucket_storage.Write(offset, std::addressof(pos), sizeof(pos));
R_RETURN(m_bucket_storage.Write(offset, std::addressof(pos), sizeof(pos)));
}
Result ReadKeyValue(Element *out, Position pos) {
@@ -276,7 +276,7 @@ namespace ams::fs {
R_TRY(m_kv_storage.GetSize(std::addressof(kv_size)));
AMS_ASSERT(pos < kv_size);
return m_kv_storage.Read(pos, out, sizeof(*out));
R_RETURN(m_kv_storage.Read(pos, out, sizeof(*out)));
}
Result ReadKeyValue(Element *out, void *out_aux, size_t *out_aux_size, Position pos) {