From 39c8d18feba8eafcd43fbb55e73ae150a1947aad Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 13 Oct 2020 08:10:50 -0400 Subject: core/CMakeLists: Make some warnings errors Makes our error coverage a little more consistent across the board by applying it to Linux side of things as well. This also makes it more consistent with the warning settings in other libraries in the project. This also updates httplib to 0.7.9, as there are several warning cleanups made that allow us to enable several warnings as errors. --- src/core/hle/service/mii/manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/hle/service/mii/manager.cpp') diff --git a/src/core/hle/service/mii/manager.cpp b/src/core/hle/service/mii/manager.cpp index 4730070cb..8e433eb41 100644 --- a/src/core/hle/service/mii/manager.cpp +++ b/src/core/hle/service/mii/manager.cpp @@ -428,7 +428,7 @@ bool MiiManager::IsFullDatabase() const { } u32 MiiManager::GetCount(SourceFlag source_flag) const { - u32 count{}; + std::size_t count{}; if ((source_flag & SourceFlag::Database) != SourceFlag::None) { // TODO(bunnei): We don't implement the Mii database, but when we do, update this count += 0; @@ -436,7 +436,7 @@ u32 MiiManager::GetCount(SourceFlag source_flag) const { if ((source_flag & SourceFlag::Default) != SourceFlag::None) { count += DefaultMiiCount; } - return count; + return static_cast(count); } ResultVal MiiManager::UpdateLatest([[maybe_unused]] const MiiInfo& info, -- cgit v1.2.3 From c1577f3448d3d9a691efc252edbf46c7b6756cb5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 17 Oct 2020 09:46:11 -0400 Subject: mii/manager: Make use of unused lower bound in GetRandomValue() Previously, the lower bound wasn't being used and zero was being used as the lower bound every time this function was called. This affects the outcome of some of the randomized entries a little bit, for example, the lower-bound for beard and mustache flags was supposed to be 1, not 0. Aside from these cases, the bug didn't affect anything else. --- src/core/hle/service/mii/manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/hle/service/mii/manager.cpp') diff --git a/src/core/hle/service/mii/manager.cpp b/src/core/hle/service/mii/manager.cpp index 8e433eb41..d73b90015 100644 --- a/src/core/hle/service/mii/manager.cpp +++ b/src/core/hle/service/mii/manager.cpp @@ -131,7 +131,7 @@ template T GetRandomValue(T min, T max) { std::random_device device; std::mt19937 gen(device()); - std::uniform_int_distribution distribution(0, static_cast(max)); + std::uniform_int_distribution distribution(static_cast(min), static_cast(max)); return static_cast(distribution(gen)); } -- cgit v1.2.3 From be1954e04cb5a0c3a526f78ed5490a5e65310280 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 15 Oct 2020 14:49:45 -0400 Subject: core: Fix clang build Recent changes to the build system that made more warnings be flagged as errors caused building via clang to break. Fixes #4795 --- src/core/hle/service/mii/manager.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/core/hle/service/mii/manager.cpp') diff --git a/src/core/hle/service/mii/manager.cpp b/src/core/hle/service/mii/manager.cpp index 8e433eb41..5930765bc 100644 --- a/src/core/hle/service/mii/manager.cpp +++ b/src/core/hle/service/mii/manager.cpp @@ -240,10 +240,10 @@ MiiStoreData BuildRandomStoreData(Age age, Gender gender, Race race, const Commo bf.eye_type.Assign( eye_type_info.values[GetRandomValue(eye_type_info.values_count)]); - const auto eye_rotate_1{gender != Gender::Male ? 4 : 2}; - const auto eye_rotate_2{gender != Gender::Male ? 3 : 4}; - const auto eye_rotate_offset{32 - EyeRotateLookup[eye_rotate_1] + eye_rotate_2}; - const auto eye_rotate{32 - EyeRotateLookup[bf.eye_type]}; + const auto eye_rotate_1{gender != Gender::Male ? 4U : 2U}; + const auto eye_rotate_2{gender != Gender::Male ? 3U : 4U}; + const auto eye_rotate_offset{32U - EyeRotateLookup[eye_rotate_1] + eye_rotate_2}; + const auto eye_rotate{32U - EyeRotateLookup[bf.eye_type]}; bf.eye_color.Assign( EyeColorLookup[eye_color_info @@ -257,11 +257,11 @@ MiiStoreData BuildRandomStoreData(Age age, Gender gender, Race race, const Commo bf.eyebrow_type.Assign( eyebrow_type_info.values[GetRandomValue(eyebrow_type_info.values_count)]); - const auto eyebrow_rotate_1{race == Race::Asian ? 6 : 0}; - const auto eyebrow_y{race == Race::Asian ? 9 : 10}; - const auto eyebrow_rotate_offset{32 - EyebrowRotateLookup[eyebrow_rotate_1] + 6}; + const auto eyebrow_rotate_1{race == Race::Asian ? 6U : 0U}; + const auto eyebrow_y{race == Race::Asian ? 9U : 10U}; + const auto eyebrow_rotate_offset{32U - EyebrowRotateLookup[eyebrow_rotate_1] + 6}; const auto eyebrow_rotate{ - 32 - EyebrowRotateLookup[static_cast(bf.eyebrow_type.Value())]}; + 32U - EyebrowRotateLookup[static_cast(bf.eyebrow_type.Value())]}; bf.eyebrow_color.Assign(bf.hair_color); bf.eyebrow_scale.Assign(4); @@ -270,14 +270,14 @@ MiiStoreData BuildRandomStoreData(Age age, Gender gender, Race race, const Commo bf.eyebrow_x.Assign(2); bf.eyebrow_y.Assign(axis_y + eyebrow_y); - const auto nose_scale{gender == Gender::Female ? 3 : 4}; + const auto nose_scale{gender == Gender::Female ? 3U : 4U}; bf.nose_type.Assign( nose_type_info.values[GetRandomValue(nose_type_info.values_count)]); bf.nose_scale.Assign(nose_scale); bf.nose_y.Assign(axis_y + 9); - const auto mouth_color{gender == Gender::Female ? GetRandomValue(4) : 0}; + const auto mouth_color{gender == Gender::Female ? GetRandomValue(4) : 0U}; bf.mouth_type.Assign( mouth_type_info.values[GetRandomValue(mouth_type_info.values_count)]); -- cgit v1.2.3 From 3d592972dc3fd61cc88771b889eff237e4e03e0f Mon Sep 17 00:00:00 2001 From: bunnei Date: Tue, 20 Oct 2020 19:07:39 -0700 Subject: Revert "core: Fix clang build" --- src/core/hle/service/mii/manager.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/core/hle/service/mii/manager.cpp') diff --git a/src/core/hle/service/mii/manager.cpp b/src/core/hle/service/mii/manager.cpp index 1b75c2ebe..d73b90015 100644 --- a/src/core/hle/service/mii/manager.cpp +++ b/src/core/hle/service/mii/manager.cpp @@ -240,10 +240,10 @@ MiiStoreData BuildRandomStoreData(Age age, Gender gender, Race race, const Commo bf.eye_type.Assign( eye_type_info.values[GetRandomValue(eye_type_info.values_count)]); - const auto eye_rotate_1{gender != Gender::Male ? 4U : 2U}; - const auto eye_rotate_2{gender != Gender::Male ? 3U : 4U}; - const auto eye_rotate_offset{32U - EyeRotateLookup[eye_rotate_1] + eye_rotate_2}; - const auto eye_rotate{32U - EyeRotateLookup[bf.eye_type]}; + const auto eye_rotate_1{gender != Gender::Male ? 4 : 2}; + const auto eye_rotate_2{gender != Gender::Male ? 3 : 4}; + const auto eye_rotate_offset{32 - EyeRotateLookup[eye_rotate_1] + eye_rotate_2}; + const auto eye_rotate{32 - EyeRotateLookup[bf.eye_type]}; bf.eye_color.Assign( EyeColorLookup[eye_color_info @@ -257,11 +257,11 @@ MiiStoreData BuildRandomStoreData(Age age, Gender gender, Race race, const Commo bf.eyebrow_type.Assign( eyebrow_type_info.values[GetRandomValue(eyebrow_type_info.values_count)]); - const auto eyebrow_rotate_1{race == Race::Asian ? 6U : 0U}; - const auto eyebrow_y{race == Race::Asian ? 9U : 10U}; - const auto eyebrow_rotate_offset{32U - EyebrowRotateLookup[eyebrow_rotate_1] + 6}; + const auto eyebrow_rotate_1{race == Race::Asian ? 6 : 0}; + const auto eyebrow_y{race == Race::Asian ? 9 : 10}; + const auto eyebrow_rotate_offset{32 - EyebrowRotateLookup[eyebrow_rotate_1] + 6}; const auto eyebrow_rotate{ - 32U - EyebrowRotateLookup[static_cast(bf.eyebrow_type.Value())]}; + 32 - EyebrowRotateLookup[static_cast(bf.eyebrow_type.Value())]}; bf.eyebrow_color.Assign(bf.hair_color); bf.eyebrow_scale.Assign(4); @@ -270,14 +270,14 @@ MiiStoreData BuildRandomStoreData(Age age, Gender gender, Race race, const Commo bf.eyebrow_x.Assign(2); bf.eyebrow_y.Assign(axis_y + eyebrow_y); - const auto nose_scale{gender == Gender::Female ? 3U : 4U}; + const auto nose_scale{gender == Gender::Female ? 3 : 4}; bf.nose_type.Assign( nose_type_info.values[GetRandomValue(nose_type_info.values_count)]); bf.nose_scale.Assign(nose_scale); bf.nose_y.Assign(axis_y + 9); - const auto mouth_color{gender == Gender::Female ? GetRandomValue(4) : 0U}; + const auto mouth_color{gender == Gender::Female ? GetRandomValue(4) : 0}; bf.mouth_type.Assign( mouth_type_info.values[GetRandomValue(mouth_type_info.values_count)]); -- cgit v1.2.3