sts: add STS_UNREACHABLE_DEFAULT_CASE()

This commit is contained in:
Michael Scire
2019-09-28 15:13:20 -07:00
committed by SciresM
parent 609a302e16
commit add18d868f
23 changed files with 50 additions and 87 deletions

View File

@@ -109,7 +109,7 @@ Result DirectorySaveDataFileSystem::AllocateWorkBuffer(void **out_buf, size_t *o
size_t try_size = ideal_size;
/* Repeatedly try to allocate until success. */
while (try_size > 0x200) {
while (true) {
void *buf = malloc(try_size);
if (buf != nullptr) {
*out_buf = buf;
@@ -119,11 +119,11 @@ Result DirectorySaveDataFileSystem::AllocateWorkBuffer(void **out_buf, size_t *o
/* Divide size by two. */
try_size >>= 1;
STS_ASSERT(try_size > 0x200);
}
/* TODO: Return a result here? Nintendo does not, but they have other allocation failed results. */
/* Consider returning ResultFsAllocationFailureInDirectorySaveDataFileSystem? */
std::abort();
}
Result DirectorySaveDataFileSystem::GetFullPath(char *out, size_t out_size, const char *relative_path) {

View File

@@ -122,9 +122,7 @@ Result LayeredRomFS::Read(void *buffer, size_t size, u64 offset) {
R_ASSERT(this->file_romfs->Read((void *)((uintptr_t)buffer + read_so_far), cur_read_size, cur_source->base_source_info.offset + (offset - cur_source->virtual_offset)));
}
break;
default:
std::abort();
break;
STS_UNREACHABLE_DEFAULT_CASE();
}
read_so_far += cur_read_size;
offset += cur_read_size;