ams-libs: AMS_ASSERT no longer invokes expression

This commit is contained in:
Michael Scire
2021-09-29 21:32:40 -07:00
parent 5dc64bc1f7
commit 9b04ff0f54
38 changed files with 82 additions and 23 deletions

View File

@@ -786,6 +786,7 @@ namespace ams::fssystem::save {
/* Get the entry to invalidate. */
const CacheEntry *entry_to_invalidate = std::addressof(this->entries[this->invalidate_index]);
AMS_UNUSED(entry_to_invalidate);
/* Ensure that the entry can be invalidated. */
AMS_ASSERT(entry_to_invalidate->is_valid);

View File

@@ -192,6 +192,7 @@ namespace ams::fssystem::save {
const auto cache_buffer = reinterpret_cast<u8 *>(this->memory_range.first) + read_offset;
AMS_ASSERT(read_offset >= 0);
AMS_ASSERT(static_cast<size_t>(read_offset) <= readable_offset_max);
AMS_UNUSED(readable_offset_max);
std::memcpy(buffer, cache_buffer, size);
}
@@ -209,6 +210,7 @@ namespace ams::fssystem::save {
const auto cache_buffer = reinterpret_cast<u8 *>(this->memory_range.first) + write_offset;
AMS_ASSERT(write_offset >= 0);
AMS_ASSERT(static_cast<size_t>(write_offset) <= writable_offset_max);
AMS_UNUSED(writable_offset_max);
std::memcpy(cache_buffer, buffer, size);
this->is_dirty = true;

View File

@@ -44,9 +44,10 @@ namespace ams::fssystem::save {
{
s64 hash_size = 0;
s64 data_size = 0;
AMS_ASSERT(R_SUCCEEDED(hash_storage.GetSize(std::addressof(hash_size))));
AMS_ASSERT(R_SUCCEEDED(data_storage.GetSize(std::addressof(hash_size))));
R_ASSERT(hash_storage.GetSize(std::addressof(hash_size)));
R_ASSERT(data_storage.GetSize(std::addressof(hash_size)));
AMS_ASSERT(((hash_size / HashSize) * this->verification_block_size) >= data_size);
AMS_UNUSED(hash_size, data_size);
}
/* Set salt. */