From 84e94f97b3ef845eac1ed360750e69e978f57342 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Tue, 25 Feb 2020 00:03:23 +1100 Subject: [PATCH] Adopt std::numeric_limits --- stratosphere/ncm/source/ncm_contentmetadatabase.cpp | 4 ++-- stratosphere/ncm/source/ncm_contentstorage.cpp | 8 ++++---- stratosphere/ncm/source/ncm_readonlycontentstorage.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/stratosphere/ncm/source/ncm_contentmetadatabase.cpp b/stratosphere/ncm/source/ncm_contentmetadatabase.cpp index ffd9e027a..9d1815450 100644 --- a/stratosphere/ncm/source/ncm_contentmetadatabase.cpp +++ b/stratosphere/ncm/source/ncm_contentmetadatabase.cpp @@ -184,7 +184,7 @@ namespace ams::ncm { } Result ContentMetaDatabaseInterface::ListContentInfo(sf::Out out_count, const sf::OutArray &out_info, ContentMetaKey key, u32 offset) { - R_UNLESS(offset >> 0x1f == 0, ncm::ResultInvalidOffset()); + R_UNLESS(offset <= std::numeric_limits::max(), ncm::ResultInvalidOffset()); R_TRY(this->EnsureEnabled()); const void *value = nullptr; @@ -470,7 +470,7 @@ namespace ams::ncm { } Result ContentMetaDatabaseInterface::ListContentMetaInfo(sf::Out out_entries_written, const sf::OutArray &out_meta_info, ContentMetaKey key, u32 start_index) { - R_UNLESS(start_index >> 0x1f == 0, ncm::ResultInvalidOffset()); + R_UNLESS(start_index <= std::numeric_limits::max(), ncm::ResultInvalidOffset()); R_TRY(this->EnsureEnabled()); const void* value = nullptr; diff --git a/stratosphere/ncm/source/ncm_contentstorage.cpp b/stratosphere/ncm/source/ncm_contentstorage.cpp index b05b9715d..b71d371ef 100644 --- a/stratosphere/ncm/source/ncm_contentstorage.cpp +++ b/stratosphere/ncm/source/ncm_contentstorage.cpp @@ -123,7 +123,7 @@ namespace ams::ncm { Result ContentStorageInterface::WritePlaceHolder(PlaceHolderId placeholder_id, u64 offset, sf::InBuffer data) { /* Offset is too large */ - R_UNLESS(offset >> 0x3f == 0, ncm::ResultInvalidOffset()); + R_UNLESS(offset<= std::numeric_limits::max(), ncm::ResultInvalidOffset()); R_TRY(this->EnsureEnabled()); R_TRY(this->placeholder_accessor.Write(placeholder_id, offset, data.GetPointer(), data.GetSize())); return ResultSuccess(); @@ -265,7 +265,7 @@ namespace ams::ncm { } Result ContentStorageInterface::ListContentId(sf::Out out_count, const sf::OutArray &out_buf, u32 start_offset) { - R_UNLESS(start_offset >> 0x1f == 0, ncm::ResultInvalidOffset()); + R_UNLESS(start_offset <= std::numeric_limits::max(), ncm::ResultInvalidOffset()); R_TRY(this->EnsureEnabled()); char content_root_path[FS_MAX_PATH] = {0}; @@ -365,7 +365,7 @@ namespace ams::ncm { Result ContentStorageInterface::ReadContentIdFile(sf::OutBuffer buf, ContentId content_id, u64 offset) { /* Offset is too large */ - R_UNLESS(offset >> 0x3f == 0, ncm::ResultInvalidOffset()); + R_UNLESS(offset<= std::numeric_limits::max(), ncm::ResultInvalidOffset()); R_TRY(this->EnsureEnabled()); char content_path[FS_MAX_PATH] = {0}; this->GetContentPath(content_path, content_id); @@ -452,7 +452,7 @@ namespace ams::ncm { Result ContentStorageInterface::WriteContentForDebug(ContentId content_id, u64 offset, sf::InBuffer data) { /* Offset is too large */ - R_UNLESS(offset >> 0x3f == 0, ncm::ResultInvalidOffset()); + R_UNLESS(offset<= std::numeric_limits::max(), ncm::ResultInvalidOffset()); R_TRY(this->EnsureEnabled()); bool is_development = false; diff --git a/stratosphere/ncm/source/ncm_readonlycontentstorage.cpp b/stratosphere/ncm/source/ncm_readonlycontentstorage.cpp index 47f2ebe48..9c358f5ed 100644 --- a/stratosphere/ncm/source/ncm_readonlycontentstorage.cpp +++ b/stratosphere/ncm/source/ncm_readonlycontentstorage.cpp @@ -154,7 +154,7 @@ namespace ams::ncm { Result ReadOnlyContentStorageInterface::ReadContentIdFile(sf::OutBuffer buf, ContentId content_id, u64 offset) { /* Offset is too large */ - R_UNLESS(offset >> 0x3f == 0, ncm::ResultInvalidOffset()); + R_UNLESS(offset<= std::numeric_limits::max(), ncm::ResultInvalidOffset()); R_TRY(this->EnsureEnabled()); char content_path[FS_MAX_PATH] = {0};