Misc: C++20 fixes

This commit is contained in:
Stenzek 2023-09-05 20:56:05 +10:00
parent 1ea0854c71
commit 9b47561c89
3 changed files with 16 additions and 16 deletions

View file

@ -229,18 +229,18 @@ TEST(FileSystem, ChangeFileName)
TEST(FileSystem, SanitizeFileName)
{
ASSERT_EQ(Path::SanitizeFileName(u8"foo"), u8"foo");
ASSERT_EQ(Path::SanitizeFileName(u8"foo/bar"), u8"foo_bar");
ASSERT_EQ(Path::SanitizeFileName(u8"f🙃o"), u8"f🙃o");
ASSERT_EQ(Path::SanitizeFileName(u8"ŻąłóРстуぬねのはen🍪⟑η∏☉ⴤ∩₲ ₱⟑♰⫳🐱"), u8"ŻąłóРстуぬねのはen🍪⟑η∏☉ⴤ∩₲ ₱⟑♰⫳🐱");
ASSERT_EQ(Path::SanitizeFileName(u8"abcdefghijlkmnopqrstuvwxyz-0123456789+&=_[]{}"), u8"abcdefghijlkmnopqrstuvwxyz-0123456789+&=_[]{}");
ASSERT_EQ(Path::SanitizeFileName(u8"some*path**with*asterisks"), u8"some_path__with_asterisks");
ASSERT_EQ(Path::SanitizeFileName("foo"), "foo");
ASSERT_EQ(Path::SanitizeFileName("foo/bar"), "foo_bar");
ASSERT_EQ(Path::SanitizeFileName("f🙃o"), "f🙃o");
ASSERT_EQ(Path::SanitizeFileName("ŻąłóРстуぬねのはen🍪⟑η∏☉ⴤ∩₲ ₱⟑♰⫳🐱"), "ŻąłóРстуぬねのはen🍪⟑η∏☉ⴤ∩₲ ₱⟑♰⫳🐱");
ASSERT_EQ(Path::SanitizeFileName("abcdefghijlkmnopqrstuvwxyz-0123456789+&=_[]{}"), "abcdefghijlkmnopqrstuvwxyz-0123456789+&=_[]{}");
ASSERT_EQ(Path::SanitizeFileName("some*path**with*asterisks"), "some_path__with_asterisks");
#ifdef _WIN32
ASSERT_EQ(Path::SanitizeFileName(u8"foo:"), u8"foo_");
ASSERT_EQ(Path::SanitizeFileName(u8"foo:bar."), u8"foo_bar_");
ASSERT_EQ(Path::SanitizeFileName(u8"foo\\bar"), u8"foo_bar");
ASSERT_EQ(Path::SanitizeFileName(u8"foo>bar"), u8"foo_bar");
ASSERT_EQ(Path::SanitizeFileName(u8"foo\\bar", false), u8"foo\\bar");
ASSERT_EQ(Path::SanitizeFileName("foo:"), "foo_");
ASSERT_EQ(Path::SanitizeFileName("foo:bar."), "foo_bar_");
ASSERT_EQ(Path::SanitizeFileName("foo\\bar"), "foo_bar");
ASSERT_EQ(Path::SanitizeFileName("foo>bar"), "foo_bar");
ASSERT_EQ(Path::SanitizeFileName("foo\\bar", false), "foo\\bar");
#endif
ASSERT_EQ(Path::SanitizeFileName(u8"foo/bar", false), u8"foo/bar");
ASSERT_EQ(Path::SanitizeFileName("foo/bar", false), "foo/bar");
}

View file

@ -1720,7 +1720,7 @@ void Achievements::DeactivateAchievement(Achievement* achievement)
if (achievement->primed)
{
achievement->primed = false;
s_primed_achievement_count.fetch_sub(std::memory_order_acq_rel);
s_primed_achievement_count.fetch_sub(1, std::memory_order_acq_rel);
}
Log_DevPrintf("Deactivated achievement %s (%u)", achievement->title.c_str(), achievement->id);
@ -1888,7 +1888,7 @@ void Achievements::AchievementPrimed(u32 achievement_id)
return;
achievement->primed = true;
s_primed_achievement_count.fetch_add(std::memory_order_acq_rel);
s_primed_achievement_count.fetch_add(1, std::memory_order_acq_rel);
}
void Achievements::AchievementUnprimed(u32 achievement_id)
@ -1899,7 +1899,7 @@ void Achievements::AchievementUnprimed(u32 achievement_id)
return;
achievement->primed = false;
s_primed_achievement_count.fetch_sub(std::memory_order_acq_rel);
s_primed_achievement_count.fetch_sub(1, std::memory_order_acq_rel);
}
std::pair<u32, u32> Achievements::GetAchievementProgress(const Achievement& achievement)

View file

@ -1316,7 +1316,7 @@ bool System::BootSystem(SystemBootParameters parameters)
if (disc && parameters.media_playlist_index != 0 && !disc->SwitchSubImage(parameters.media_playlist_index, &error))
{
Host::ReportErrorAsync("Error",
fmt::format("Failed to switch to subimage {] in '{}': {}", parameters.media_playlist_index,
fmt::format("Failed to switch to subimage {} in '{}': {}", parameters.media_playlist_index,
parameters.filename, error.GetDescription()));
s_state = State::Shutdown;
Host::OnSystemDestroyed();