ams: globally prefer R_RETURN to return for ams::Result
This commit is contained in:
@@ -46,7 +46,7 @@ namespace ams::ncm {
|
||||
public:
|
||||
Result Set(const ContentMetaKey &key, const void *buf, size_t size) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->Set(key, sf::InBuffer(buf, size));
|
||||
R_RETURN(m_interface->Set(key, sf::InBuffer(buf, size)));
|
||||
}
|
||||
|
||||
Result Get(size_t *out_size, void *dst, size_t dst_size, const ContentMetaKey &key) {
|
||||
@@ -58,15 +58,15 @@ namespace ams::ncm {
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
#define AMS_NCM_DEFINE_GETTERS(Kind, IdType) \
|
||||
Result Get##Kind(ContentId *out, IdType##Id id, u32 version) { \
|
||||
return m_interface->GetContentIdByType(out, ContentMetaKey::MakeUnknownType(id.value, version), ContentType::Kind); \
|
||||
} \
|
||||
\
|
||||
Result GetLatest##Kind(ContentId *out, IdType##Id id) { \
|
||||
ContentMetaKey latest_key; \
|
||||
R_TRY(m_interface->GetLatestContentMetaKey(std::addressof(latest_key), id.value)); \
|
||||
return m_interface->GetContentIdByType(out, latest_key, ContentType::Kind); \
|
||||
#define AMS_NCM_DEFINE_GETTERS(Kind, IdType) \
|
||||
Result Get##Kind(ContentId *out, IdType##Id id, u32 version) { \
|
||||
R_RETURN(m_interface->GetContentIdByType(out, ContentMetaKey::MakeUnknownType(id.value, version), ContentType::Kind)); \
|
||||
} \
|
||||
\
|
||||
Result GetLatest##Kind(ContentId *out, IdType##Id id) { \
|
||||
ContentMetaKey latest_key; \
|
||||
R_TRY(m_interface->GetLatestContentMetaKey(std::addressof(latest_key), id.value)); \
|
||||
R_RETURN(m_interface->GetContentIdByType(out, latest_key, ContentType::Kind)); \
|
||||
}
|
||||
|
||||
AMS_NCM_DEFINE_GETTERS(Program, Program)
|
||||
@@ -79,29 +79,29 @@ namespace ams::ncm {
|
||||
|
||||
Result Remove(const ContentMetaKey &key) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->Remove(key);
|
||||
R_RETURN(m_interface->Remove(key));
|
||||
}
|
||||
|
||||
Result Remove(SystemProgramId id, u32 version) {
|
||||
return this->Remove(ContentMetaKey::Make(id, version));
|
||||
R_RETURN(this->Remove(ContentMetaKey::Make(id, version)));
|
||||
}
|
||||
|
||||
Result Remove(SystemDataId id, u32 version) {
|
||||
return this->Remove(ContentMetaKey::Make(id, version));
|
||||
R_RETURN(this->Remove(ContentMetaKey::Make(id, version)));
|
||||
}
|
||||
|
||||
Result Remove(ApplicationId id, u32 version) {
|
||||
return this->Remove(ContentMetaKey::Make(id, version));
|
||||
R_RETURN(this->Remove(ContentMetaKey::Make(id, version)));
|
||||
}
|
||||
|
||||
Result GetContentIdByType(ContentId *out_content_id, const ContentMetaKey &key, ContentType type) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetContentIdByType(out_content_id, key, type);
|
||||
R_RETURN(m_interface->GetContentIdByType(out_content_id, key, type));
|
||||
}
|
||||
|
||||
Result GetContentIdByTypeAndIdOffset(ContentId *out_content_id, const ContentMetaKey &key, ContentType type, u8 id_offset) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetContentIdByTypeAndIdOffset(out_content_id, key, type, id_offset);
|
||||
R_RETURN(m_interface->GetContentIdByTypeAndIdOffset(out_content_id, key, type, id_offset));
|
||||
}
|
||||
|
||||
ListCount ListApplication(ApplicationContentMetaKey *dst, size_t dst_size) {
|
||||
@@ -118,32 +118,32 @@ namespace ams::ncm {
|
||||
|
||||
Result GetLatest(ContentMetaKey *out_key, u64 id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetLatestContentMetaKey(out_key, id);
|
||||
R_RETURN(m_interface->GetLatestContentMetaKey(out_key, id));
|
||||
}
|
||||
|
||||
Result ListContentInfo(s32 *out_count, ContentInfo *dst, size_t dst_size, const ContentMetaKey &key, s32 offset) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->ListContentInfo(out_count, sf::OutArray<ContentInfo>(dst, dst_size), key, offset);
|
||||
R_RETURN(m_interface->ListContentInfo(out_count, sf::OutArray<ContentInfo>(dst, dst_size), key, offset));
|
||||
}
|
||||
|
||||
Result ListContentMetaInfo(s32 *out_count, ContentMetaInfo *dst, size_t dst_size, const ContentMetaKey &key, s32 offset) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->ListContentMetaInfo(out_count, sf::OutArray<ContentMetaInfo>(dst, dst_size), key, offset);
|
||||
R_RETURN(m_interface->ListContentMetaInfo(out_count, sf::OutArray<ContentMetaInfo>(dst, dst_size), key, offset));
|
||||
}
|
||||
|
||||
Result Has(bool *out, const ContentMetaKey &key) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->Has(out, key);
|
||||
R_RETURN(m_interface->Has(out, key));
|
||||
}
|
||||
|
||||
Result HasAll(bool *out, const ContentMetaKey *keys, size_t num_keys) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->HasAll(out, sf::InArray<ContentMetaKey>(keys, num_keys));
|
||||
R_RETURN(m_interface->HasAll(out, sf::InArray<ContentMetaKey>(keys, num_keys)));
|
||||
}
|
||||
|
||||
Result HasContent(bool *out, const ContentMetaKey &key, const ContentId &content_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->HasContent(out, key, content_id);
|
||||
R_RETURN(m_interface->HasContent(out, key, content_id));
|
||||
}
|
||||
|
||||
Result GetSize(size_t *out_size, const ContentMetaKey &key) {
|
||||
@@ -157,37 +157,37 @@ namespace ams::ncm {
|
||||
|
||||
Result GetRequiredSystemVersion(u32 *out_version, const ContentMetaKey &key) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetRequiredSystemVersion(out_version, key);
|
||||
R_RETURN(m_interface->GetRequiredSystemVersion(out_version, key));
|
||||
}
|
||||
|
||||
Result GetPatchId(PatchId *out_patch_id, const ContentMetaKey &key) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetPatchId(out_patch_id, key);
|
||||
R_RETURN(m_interface->GetPatchId(out_patch_id, key));
|
||||
}
|
||||
|
||||
Result DisableForcibly() {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->DisableForcibly();
|
||||
R_RETURN(m_interface->DisableForcibly());
|
||||
}
|
||||
|
||||
Result LookupOrphanContent(bool *out_orphaned, ContentId *content_list, size_t count) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->LookupOrphanContent(sf::OutArray<bool>(out_orphaned, count), sf::InArray<ContentId>(content_list, count));
|
||||
R_RETURN(m_interface->LookupOrphanContent(sf::OutArray<bool>(out_orphaned, count), sf::InArray<ContentId>(content_list, count)));
|
||||
}
|
||||
|
||||
Result Commit() {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->Commit();
|
||||
R_RETURN(m_interface->Commit());
|
||||
}
|
||||
|
||||
Result GetAttributes(u8 *out_attributes, const ContentMetaKey &key) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetAttributes(out_attributes, key);
|
||||
R_RETURN(m_interface->GetAttributes(out_attributes, key));
|
||||
}
|
||||
|
||||
Result GetRequiredApplicationVersion(u32 *out_version, const ContentMetaKey &key) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetRequiredApplicationVersion(out_version, key);
|
||||
R_RETURN(m_interface->GetRequiredApplicationVersion(out_version, key));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -520,8 +520,8 @@ namespace ams::ncm {
|
||||
public:
|
||||
using AccessorBase::AccessorBase;
|
||||
public:
|
||||
Result GetHeader(ReadableStructPin<PatchMetaExtendedDataHeader> *out) { return this->AcquireReadableStructPin(out, 0); }
|
||||
Result GetHeader(PatchMetaExtendedDataHeader *out) { return this->template ReadStruct<PatchMetaExtendedDataHeader>(out, 0); }
|
||||
Result GetHeader(ReadableStructPin<PatchMetaExtendedDataHeader> *out) { R_RETURN(this->AcquireReadableStructPin(out, 0)); }
|
||||
Result GetHeader(PatchMetaExtendedDataHeader *out) { R_RETURN(this->template ReadStruct<PatchMetaExtendedDataHeader>(out, 0)); }
|
||||
|
||||
Result GetHistoryHeader(ReadableStructPin<PatchHistoryHeader> *out, s32 index) {
|
||||
/* Ensure we have our header. */
|
||||
|
||||
@@ -49,37 +49,37 @@ namespace ams::ncm {
|
||||
|
||||
Result CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, s64 size) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->CreatePlaceHolder(placeholder_id, content_id, size);
|
||||
R_RETURN(m_interface->CreatePlaceHolder(placeholder_id, content_id, size));
|
||||
}
|
||||
|
||||
Result DeletePlaceHolder(PlaceHolderId placeholder_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->DeletePlaceHolder(placeholder_id);
|
||||
R_RETURN(m_interface->DeletePlaceHolder(placeholder_id));
|
||||
}
|
||||
|
||||
Result HasPlaceHolder(bool *out, PlaceHolderId placeholder_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->HasPlaceHolder(out, placeholder_id);
|
||||
R_RETURN(m_interface->HasPlaceHolder(out, placeholder_id));
|
||||
}
|
||||
|
||||
Result WritePlaceHolder(PlaceHolderId placeholder_id, s64 offset, const void *buf, size_t size) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->WritePlaceHolder(placeholder_id, offset, sf::InBuffer(buf, size));
|
||||
R_RETURN(m_interface->WritePlaceHolder(placeholder_id, offset, sf::InBuffer(buf, size)));
|
||||
}
|
||||
|
||||
Result Register(PlaceHolderId placeholder_id, ContentId content_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->Register(placeholder_id, content_id);
|
||||
R_RETURN(m_interface->Register(placeholder_id, content_id));
|
||||
}
|
||||
|
||||
Result Delete(ContentId content_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->Delete(content_id);
|
||||
R_RETURN(m_interface->Delete(content_id));
|
||||
}
|
||||
|
||||
Result Has(bool *out, ContentId content_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->Has(out, content_id);
|
||||
R_RETURN(m_interface->Has(out, content_id));
|
||||
}
|
||||
|
||||
void GetPath(Path *out, ContentId content_id) {
|
||||
@@ -94,52 +94,52 @@ namespace ams::ncm {
|
||||
|
||||
Result CleanupAllPlaceHolder() {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->CleanupAllPlaceHolder();
|
||||
R_RETURN(m_interface->CleanupAllPlaceHolder());
|
||||
}
|
||||
|
||||
Result ListPlaceHolder(s32 *out_count, PlaceHolderId *out_list, size_t out_list_size) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->ListPlaceHolder(out_count, sf::OutArray<PlaceHolderId>(out_list, out_list_size));
|
||||
R_RETURN(m_interface->ListPlaceHolder(out_count, sf::OutArray<PlaceHolderId>(out_list, out_list_size)));
|
||||
}
|
||||
|
||||
Result GetContentCount(s32 *out_count) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetContentCount(out_count);
|
||||
R_RETURN(m_interface->GetContentCount(out_count));
|
||||
}
|
||||
|
||||
Result ListContentId(s32 *out_count, ContentId *out_list, size_t out_list_size, s32 offset) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->ListContentId(out_count, sf::OutArray<ContentId>(out_list, out_list_size), offset);
|
||||
R_RETURN(m_interface->ListContentId(out_count, sf::OutArray<ContentId>(out_list, out_list_size), offset));
|
||||
}
|
||||
|
||||
Result GetSize(s64 *out_size, ContentId content_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetSizeFromContentId(out_size, content_id);
|
||||
R_RETURN(m_interface->GetSizeFromContentId(out_size, content_id));
|
||||
}
|
||||
|
||||
Result GetSize(s64 *out_size, PlaceHolderId placeholder_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetSizeFromPlaceHolderId(out_size, placeholder_id);
|
||||
R_RETURN(m_interface->GetSizeFromPlaceHolderId(out_size, placeholder_id));
|
||||
}
|
||||
|
||||
Result DisableForcibly() {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->DisableForcibly();
|
||||
R_RETURN(m_interface->DisableForcibly());
|
||||
}
|
||||
|
||||
Result RevertToPlaceHolder(PlaceHolderId placeholder_id, ContentId old_content_id, ContentId new_content_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->RevertToPlaceHolder(placeholder_id, old_content_id, new_content_id);
|
||||
R_RETURN(m_interface->RevertToPlaceHolder(placeholder_id, old_content_id, new_content_id));
|
||||
}
|
||||
|
||||
Result SetPlaceHolderSize(PlaceHolderId placeholder_id, s64 size) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->SetPlaceHolderSize(placeholder_id, size);
|
||||
R_RETURN(m_interface->SetPlaceHolderSize(placeholder_id, size));
|
||||
}
|
||||
|
||||
Result ReadContentIdFile(void *dst, size_t size, ContentId content_id, s64 offset) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->ReadContentIdFile(sf::OutBuffer(dst, size), content_id, offset);
|
||||
R_RETURN(m_interface->ReadContentIdFile(sf::OutBuffer(dst, size), content_id, offset));
|
||||
}
|
||||
|
||||
Result GetRightsId(ncm::RightsId *out_rights_id, PlaceHolderId placeholder_id) {
|
||||
@@ -147,11 +147,11 @@ namespace ams::ncm {
|
||||
|
||||
const auto vers = hos::GetVersion();
|
||||
if (vers >= hos::Version_3_0_0) {
|
||||
return m_interface->GetRightsIdFromPlaceHolderId(out_rights_id, placeholder_id);
|
||||
R_RETURN(m_interface->GetRightsIdFromPlaceHolderId(out_rights_id, placeholder_id));
|
||||
} else {
|
||||
AMS_ABORT_UNLESS(vers >= hos::Version_2_0_0);
|
||||
*out_rights_id = {};
|
||||
return m_interface->GetRightsIdFromPlaceHolderIdDeprecated(std::addressof(out_rights_id->id), placeholder_id);
|
||||
R_RETURN(m_interface->GetRightsIdFromPlaceHolderIdDeprecated(std::addressof(out_rights_id->id), placeholder_id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,42 +160,42 @@ namespace ams::ncm {
|
||||
|
||||
const auto vers = hos::GetVersion();
|
||||
if (vers >= hos::Version_3_0_0) {
|
||||
return m_interface->GetRightsIdFromContentId(out_rights_id, content_id);
|
||||
R_RETURN(m_interface->GetRightsIdFromContentId(out_rights_id, content_id));
|
||||
} else {
|
||||
AMS_ABORT_UNLESS(vers >= hos::Version_2_0_0);
|
||||
*out_rights_id = {};
|
||||
return m_interface->GetRightsIdFromContentIdDeprecated(std::addressof(out_rights_id->id), content_id);
|
||||
R_RETURN(m_interface->GetRightsIdFromContentIdDeprecated(std::addressof(out_rights_id->id), content_id));
|
||||
}
|
||||
}
|
||||
|
||||
Result WriteContentForDebug(ContentId content_id, s64 offset, const void *buf, size_t size) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->WriteContentForDebug(content_id, offset, sf::InBuffer(buf, size));
|
||||
R_RETURN(m_interface->WriteContentForDebug(content_id, offset, sf::InBuffer(buf, size)));
|
||||
}
|
||||
|
||||
Result GetFreeSpaceSize(s64 *out_size) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetFreeSpaceSize(out_size);
|
||||
R_RETURN(m_interface->GetFreeSpaceSize(out_size));
|
||||
}
|
||||
|
||||
Result GetTotalSpaceSize(s64 *out_size) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetTotalSpaceSize(out_size);
|
||||
R_RETURN(m_interface->GetTotalSpaceSize(out_size));
|
||||
}
|
||||
|
||||
Result FlushPlaceHolder() {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->FlushPlaceHolder();
|
||||
R_RETURN(m_interface->FlushPlaceHolder());
|
||||
}
|
||||
|
||||
Result RepairInvalidFileAttribute() {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->RepairInvalidFileAttribute();
|
||||
R_RETURN(m_interface->RepairInvalidFileAttribute());
|
||||
}
|
||||
|
||||
Result GetRightsIdFromPlaceHolderIdWithCache(ncm::RightsId *out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetRightsIdFromPlaceHolderIdWithCache(out_rights_id, placeholder_id, cache_content_id);
|
||||
R_RETURN(m_interface->GetRightsIdFromPlaceHolderIdWithCache(out_rights_id, placeholder_id, cache_content_id));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace ams::ncm {
|
||||
if (R_FAILED(result)) {
|
||||
this->SetLastResult(result);
|
||||
}
|
||||
return result;
|
||||
R_RETURN(result);
|
||||
}
|
||||
public:
|
||||
InstallTaskBase() : m_data(), m_progress(), m_progress_mutex(), m_cancel_mutex(), m_cancel_requested(), m_throughput_mutex() { /* ... */ }
|
||||
@@ -113,12 +113,12 @@ namespace ams::ncm {
|
||||
Result CalculateRequiredSize(s64 *out_size);
|
||||
Result Cleanup();
|
||||
Result ListContentMetaKey(s32 *out_keys_written, StorageContentMetaKey *out_keys, s32 out_keys_count, s32 offset, ListContentMetaKeyFilter filter);
|
||||
Result ListContentMetaKey(s32 *out_keys_written, StorageContentMetaKey *out_keys, s32 out_keys_count, s32 offset) { return this->ListContentMetaKey(out_keys_written, out_keys, out_keys_count, offset, ListContentMetaKeyFilter::All); }
|
||||
Result ListContentMetaKey(s32 *out_keys_written, StorageContentMetaKey *out_keys, s32 out_keys_count, s32 offset) { R_RETURN(this->ListContentMetaKey(out_keys_written, out_keys, out_keys_count, offset, ListContentMetaKeyFilter::All)); }
|
||||
Result ListApplicationContentMetaKey(s32 *out_keys_written, ApplicationContentMetaKey *out_keys, s32 out_keys_count, s32 offset);
|
||||
Result Execute();
|
||||
Result PrepareAndExecute();
|
||||
Result Commit(const StorageContentMetaKey *keys, s32 num_keys);
|
||||
Result Commit() { return this->Commit(nullptr, 0); }
|
||||
Result Commit() { R_RETURN(this->Commit(nullptr, 0)); }
|
||||
virtual InstallProgress GetProgress();
|
||||
void ResetLastResult();
|
||||
Result IncludesExFatDriver(bool *out);
|
||||
|
||||
Reference in New Issue
Block a user