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

@@ -82,6 +82,7 @@ namespace ams::fs::impl {
const char *IdString::ToValueString(int id) {
const int len = util::SNPrintf(this->buffer, sizeof(this->buffer), "%d", id);
AMS_ASSERT(static_cast<size_t>(len) < sizeof(this->buffer));
AMS_UNUSED(len);
return this->buffer;
}

View File

@@ -33,8 +33,9 @@ namespace ams::fs {
AMS_ABORT_UNLESS(dst_size >= needed_size);
/* Generate the name. */
auto size = util::SNPrintf(dst, dst_size, "%s:", bis_mount_name);
const auto size = util::SNPrintf(dst, dst_size, "%s:", bis_mount_name);
AMS_ASSERT(static_cast<size_t>(size) == needed_size - 1);
AMS_UNUSED(size);
return ResultSuccess();
}

View File

@@ -32,8 +32,9 @@ namespace ams::fs {
AMS_ABORT_UNLESS(dst_size >= needed_size);
/* Generate the name. */
auto size = util::SNPrintf(dst, dst_size, "%s:", GetContentStorageMountName(id));
const auto size = util::SNPrintf(dst, dst_size, "%s:", GetContentStorageMountName(id));
AMS_ASSERT(static_cast<size_t>(size) == needed_size - 1);
AMS_UNUSED(size);
return ResultSuccess();
}

View File

@@ -42,8 +42,9 @@ namespace ams::fs {
AMS_ABORT_UNLESS(dst_size >= needed_size);
/* Generate the name. */
auto size = util::SNPrintf(dst, dst_size, "%s%s%08x:", impl::GameCardFileSystemMountName, GetGameCardMountNameSuffix(this->partition), this->handle);
const auto size = util::SNPrintf(dst, dst_size, "%s%s%08x:", impl::GameCardFileSystemMountName, GetGameCardMountNameSuffix(this->partition), this->handle);
AMS_ASSERT(static_cast<size_t>(size) == needed_size - 1);
AMS_UNUSED(size);
return ResultSuccess();
}

View File

@@ -426,8 +426,9 @@ namespace ams::fs {
{
bool normalized = false;
const auto is_norm_result = IsNormalized(std::addressof(normalized), out, unc_preserved, has_mount_name);
AMS_ASSERT(R_SUCCEEDED(is_norm_result));
R_ASSERT(is_norm_result);
AMS_ASSERT(normalized);
AMS_UNUSED(is_norm_result, normalized);
}
return ResultSuccess();

View File

@@ -29,8 +29,11 @@ namespace ams::fs {
u32 *dst_invalid = this->invalid_chars;
for (const char *cur = ":*?<>|"; *cur != '\x00'; ++cur) {
AMS_ASSERT(dst_invalid < std::end(this->invalid_chars));
const auto result = util::ConvertCharacterUtf8ToUtf32(dst_invalid, cur);
AMS_ASSERT(result == util::CharacterEncodingResult_Success);
AMS_UNUSED(result);
++dst_invalid;
}
AMS_ASSERT(dst_invalid == std::end(this->invalid_chars));
@@ -39,8 +42,11 @@ namespace ams::fs {
u32 *dst_sep = this->separators;
for (const char *cur = "/\\"; *cur != '\x00'; ++cur) {
AMS_ASSERT(dst_sep < std::end(this->separators));
const auto result = util::ConvertCharacterUtf8ToUtf32(dst_sep, cur);
AMS_ASSERT(result == util::CharacterEncodingResult_Success);
AMS_UNUSED(result);
++dst_sep;
}
AMS_ASSERT(dst_sep == std::end(this->separators));

View File

@@ -35,8 +35,9 @@ namespace ams::fs {
AMS_ABORT_UNLESS(dst_size >= needed_size);
/* Generate the name. */
auto size = util::SNPrintf(dst, dst_size, "%s:", impl::SdCardFileSystemMountName);
const auto size = util::SNPrintf(dst, dst_size, "%s:", impl::SdCardFileSystemMountName);
AMS_ASSERT(static_cast<size_t>(size) == needed_size - 1);
AMS_UNUSED(size);
return ResultSuccess();
}