Merge pull request #13461 from JoshuaVandaele/warningsbegone

Fix shadowed variable warnings and missing declarations
This commit is contained in:
JosJuice 2025-03-28 18:43:09 +01:00 committed by GitHub
commit c7ede8a6b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 21 deletions

View File

@ -336,8 +336,8 @@ bool PPCSymbolDB::LoadMap(const Core::CPUThreadGuard& guard, const std::string&
char name[512]{};
static constexpr char ENTRY_OF_STRING[] = " (entry of ";
static constexpr std::string_view ENTRY_OF_VIEW(ENTRY_OF_STRING);
auto parse_entry_of = [](char* name) {
if (char* s1 = strstr(name, ENTRY_OF_STRING); s1 != nullptr)
auto parse_entry_of = [](char* name_buf) {
if (char* s1 = strstr(name_buf, ENTRY_OF_STRING); s1 != nullptr)
{
char container[512];
char* ptr = s1 + ENTRY_OF_VIEW.size();
@ -350,17 +350,17 @@ bool PPCSymbolDB::LoadMap(const Core::CPUThreadGuard& guard, const std::string&
strcpy(s1, ptr);
*s2 = '\0';
strcat(container, "::");
strcat(container, name);
strcpy(name, container);
strcat(container, name_buf);
strcpy(name_buf, container);
}
}
};
auto was_alignment = [](const char* name) {
return *name == ' ' || (*name >= '0' && *name <= '9');
auto was_alignment = [](const char* name_buf) {
return *name_buf == ' ' || (*name_buf >= '0' && *name_buf <= '9');
};
auto parse_alignment = [](char* name, u32* alignment) {
const std::string buffer(StripWhitespace(name));
return sscanf(buffer.c_str(), "%i %511[^\r\n]", alignment, name);
auto parse_alignment = [](char* name_buf, u32* alignment_buf) {
const std::string buffer(StripWhitespace(name_buf));
return sscanf(buffer.c_str(), "%i %511[^\r\n]", alignment_buf, name_buf);
};
switch (column_count)
{
@ -455,8 +455,8 @@ bool PPCSymbolDB::LoadMap(const Core::CPUThreadGuard& guard, const std::string&
// Save symbol map similar to CodeWarrior's map file
bool PPCSymbolDB::SaveSymbolMap(const std::string& filename) const
{
File::IOFile f(filename, "w");
if (!f)
File::IOFile file(filename, "w");
if (!file)
return false;
// Write .text section
@ -464,7 +464,7 @@ bool PPCSymbolDB::SaveSymbolMap(const std::string& filename) const
m_functions |
std::views::filter([](auto f) { return f.second.type == Common::Symbol::Type::Function; }) |
std::views::transform([](auto f) { return f.second; });
f.WriteString(".text section layout\n");
file.WriteString(".text section layout\n");
for (const auto& symbol : function_symbols)
{
// Write symbol address, size, virtual address, alignment, name
@ -474,7 +474,7 @@ bool PPCSymbolDB::SaveSymbolMap(const std::string& filename) const
if (!symbol.object_name.empty())
line += fmt::format(" \t{0}", symbol.object_name);
line += "\n";
f.WriteString(line);
file.WriteString(line);
}
// Write .data section
@ -482,7 +482,7 @@ bool PPCSymbolDB::SaveSymbolMap(const std::string& filename) const
m_functions |
std::views::filter([](auto f) { return f.second.type == Common::Symbol::Type::Data; }) |
std::views::transform([](auto f) { return f.second; });
f.WriteString("\n.data section layout\n");
file.WriteString("\n.data section layout\n");
for (const auto& symbol : data_symbols)
{
// Write symbol address, size, virtual address, alignment, name
@ -492,7 +492,7 @@ bool PPCSymbolDB::SaveSymbolMap(const std::string& filename) const
if (!symbol.object_name.empty())
line += fmt::format(" \t{0}", symbol.object_name);
line += "\n";
f.WriteString(line);
file.WriteString(line);
}
return true;

View File

@ -469,7 +469,7 @@ void SetDepth(u16 x, u16 y, u32 depth)
SetPixelDepth(GetDepthOffset(x, y), depth);
}
u32 GetColor(u16 x, u16 y)
static u32 GetColor(u16 x, u16 y)
{
u32 offset = GetColorOffset(x, y);
return GetPixelColor(offset);
@ -544,7 +544,7 @@ static yuv444 ConvertColorToYUV(u32 color)
return {y_round, u_round, v_round};
}
u32 GetDepth(u16 x, u16 y)
static u32 GetDepth(u16 x, u16 y)
{
u32 offset = GetDepthOffset(x, y);
return GetPixelDepth(offset);

View File

@ -138,12 +138,13 @@ void PerformanceMetrics::DrawImGuiStats(const float backbuffer_scale)
if (window_min_x > window_max_x || window_min_y > window_max_y)
return;
const float window_x = std::clamp(position.x, window_min_x, window_max_x);
const float window_y = std::clamp(position.y, window_min_y, window_max_y);
const bool window_needs_clamping = (window_x != position.x) || (window_y != position.y);
const float clamped_window_x = std::clamp(position.x, window_min_x, window_max_x);
const float clamped_window_y = std::clamp(position.y, window_min_y, window_max_y);
const bool window_needs_clamping =
(clamped_window_x != position.x) || (clamped_window_y != position.y);
if (window_needs_clamping)
ImGui::SetWindowPos(ImVec2(window_x, window_y), ImGuiCond_Always);
ImGui::SetWindowPos(ImVec2(clamped_window_x, clamped_window_y), ImGuiCond_Always);
};
const float graph_width = 50.f * backbuffer_scale + 3.f * window_width + 2.f * window_padding;