diff options
| author | 2020-09-14 19:19:56 -0400 | |
|---|---|---|
| committer | 2020-09-14 19:19:59 -0400 | |
| commit | 33e4a0b6c180a5e866e3a45b42e9749506485558 (patch) | |
| tree | 94cb81437733d78d17dab14902a0e5db7fe62e2c /src/core/file_sys | |
| parent | patch_manager: Make use of type aliases (diff) | |
| download | yuzu-33e4a0b6c180a5e866e3a45b42e9749506485558.tar.gz yuzu-33e4a0b6c180a5e866e3a45b42e9749506485558.tar.xz yuzu-33e4a0b6c180a5e866e3a45b42e9749506485558.zip | |
patch_manager: Resolve implicit truncations in FormatTitleVersion()
We make it explicit that we're truncating arithmetic here to resolve
compiler warnings (even if the sizes weren't u32/u64 arithmetic
generally promotes to int :<)
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/patch_manager.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index 2b7bd2832..87c354a43 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp | |||
| @@ -45,14 +45,15 @@ enum class TitleVersionFormat : u8 { | |||
| 45 | std::string FormatTitleVersion(u32 version, | 45 | std::string FormatTitleVersion(u32 version, |
| 46 | TitleVersionFormat format = TitleVersionFormat::ThreeElements) { | 46 | TitleVersionFormat format = TitleVersionFormat::ThreeElements) { |
| 47 | std::array<u8, sizeof(u32)> bytes{}; | 47 | std::array<u8, sizeof(u32)> bytes{}; |
| 48 | bytes[0] = version % SINGLE_BYTE_MODULUS; | 48 | bytes[0] = static_cast<u8>(version % SINGLE_BYTE_MODULUS); |
| 49 | for (std::size_t i = 1; i < bytes.size(); ++i) { | 49 | for (std::size_t i = 1; i < bytes.size(); ++i) { |
| 50 | version /= SINGLE_BYTE_MODULUS; | 50 | version /= SINGLE_BYTE_MODULUS; |
| 51 | bytes[i] = version % SINGLE_BYTE_MODULUS; | 51 | bytes[i] = static_cast<u8>(version % SINGLE_BYTE_MODULUS); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | if (format == TitleVersionFormat::FourElements) | 54 | if (format == TitleVersionFormat::FourElements) { |
| 55 | return fmt::format("v{}.{}.{}.{}", bytes[3], bytes[2], bytes[1], bytes[0]); | 55 | return fmt::format("v{}.{}.{}.{}", bytes[3], bytes[2], bytes[1], bytes[0]); |
| 56 | } | ||
| 56 | return fmt::format("v{}.{}.{}", bytes[3], bytes[2], bytes[1]); | 57 | return fmt::format("v{}.{}.{}", bytes[3], bytes[2], bytes[1]); |
| 57 | } | 58 | } |
| 58 | 59 | ||