diff options
| author | 2019-06-10 23:18:17 -0400 | |
|---|---|---|
| committer | 2019-06-10 23:27:14 -0400 | |
| commit | 7bdef6106ee7b9dc30149f9c0d38c295d788bb0a (patch) | |
| tree | 0385aaef78b80a5738232f7e934a9c39bf555db7 /src | |
| parent | file_sys/card_image: Make bracing consistent (diff) | |
| download | yuzu-7bdef6106ee7b9dc30149f9c0d38c295d788bb0a.tar.gz yuzu-7bdef6106ee7b9dc30149f9c0d38c295d788bb0a.tar.xz yuzu-7bdef6106ee7b9dc30149f9c0d38c295d788bb0a.zip | |
file_sys/card_image: Deduplicate casts within AddNCAFromPartition()
Makes for nicer reading.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/file_sys/card_image.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/file_sys/card_image.cpp b/src/core/file_sys/card_image.cpp index 1a5faa43a..df9e0c434 100644 --- a/src/core/file_sys/card_image.cpp +++ b/src/core/file_sys/card_image.cpp | |||
| @@ -176,11 +176,14 @@ VirtualDir XCI::GetParentDirectory() const { | |||
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | Loader::ResultStatus XCI::AddNCAFromPartition(XCIPartition part) { | 178 | Loader::ResultStatus XCI::AddNCAFromPartition(XCIPartition part) { |
| 179 | if (partitions[static_cast<std::size_t>(part)] == nullptr) { | 179 | const auto partition_index = static_cast<std::size_t>(part); |
| 180 | const auto& partition = partitions[partition_index]; | ||
| 181 | |||
| 182 | if (partition == nullptr) { | ||
| 180 | return Loader::ResultStatus::ErrorXCIMissingPartition; | 183 | return Loader::ResultStatus::ErrorXCIMissingPartition; |
| 181 | } | 184 | } |
| 182 | 185 | ||
| 183 | for (const VirtualFile& file : partitions[static_cast<std::size_t>(part)]->GetFiles()) { | 186 | for (const VirtualFile& file : partition->GetFiles()) { |
| 184 | if (file->GetExtension() != "nca") { | 187 | if (file->GetExtension() != "nca") { |
| 185 | continue; | 188 | continue; |
| 186 | } | 189 | } |
| @@ -197,7 +200,7 @@ Loader::ResultStatus XCI::AddNCAFromPartition(XCIPartition part) { | |||
| 197 | } else { | 200 | } else { |
| 198 | const u16 error_id = static_cast<u16>(nca->GetStatus()); | 201 | const u16 error_id = static_cast<u16>(nca->GetStatus()); |
| 199 | LOG_CRITICAL(Loader, "Could not load NCA {}/{}, failed with error code {:04X} ({})", | 202 | LOG_CRITICAL(Loader, "Could not load NCA {}/{}, failed with error code {:04X} ({})", |
| 200 | partition_names[static_cast<std::size_t>(part)], nca->GetName(), error_id, | 203 | partition_names[partition_index], nca->GetName(), error_id, |
| 201 | nca->GetStatus()); | 204 | nca->GetStatus()); |
| 202 | } | 205 | } |
| 203 | } | 206 | } |