Warning fix

This commit is contained in:
Henrik Rydgård 2024-09-07 15:58:03 +02:00
parent b0cee365f5
commit 204672800c

View File

@ -435,21 +435,23 @@ void DrawFPS(UIContext *ctx, const Bounds &bounds) {
float vps, fps, actual_fps; float vps, fps, actual_fps;
__DisplayGetFPS(&vps, &fps, &actual_fps); __DisplayGetFPS(&vps, &fps, &actual_fps);
char fpsbuf[256]{}; char fpsbuf[256];
if (g_Config.iShowStatusFlags == ((int)ShowStatusFlags::FPS_COUNTER | (int)ShowStatusFlags::SPEED_COUNTER)) { fpsbuf[0] = '\0';
if ((g_Config.iShowStatusFlags & ((int)ShowStatusFlags::FPS_COUNTER | (int)ShowStatusFlags::SPEED_COUNTER)) == ((int)ShowStatusFlags::FPS_COUNTER | (int)ShowStatusFlags::SPEED_COUNTER)) {
snprintf(fpsbuf, sizeof(fpsbuf), "%0.0f/%0.0f (%0.1f%%)", actual_fps, fps, vps / ((g_Config.iDisplayRefreshRate / 60.0f * 59.94f) / 100.0f)); snprintf(fpsbuf, sizeof(fpsbuf), "%0.0f/%0.0f (%0.1f%%)", actual_fps, fps, vps / ((g_Config.iDisplayRefreshRate / 60.0f * 59.94f) / 100.0f));
} else { } else {
if (g_Config.iShowStatusFlags & (int)ShowStatusFlags::FPS_COUNTER) { if (g_Config.iShowStatusFlags & (int)ShowStatusFlags::FPS_COUNTER) {
snprintf(fpsbuf, sizeof(fpsbuf), "FPS: %0.1f", actual_fps); snprintf(fpsbuf, sizeof(fpsbuf), "FPS: %0.1f", actual_fps);
} } else if (g_Config.iShowStatusFlags & (int)ShowStatusFlags::SPEED_COUNTER) {
if (g_Config.iShowStatusFlags & (int)ShowStatusFlags::SPEED_COUNTER) { snprintf(fpsbuf, sizeof(fpsbuf), "Speed: %0.1f%%", vps / (59.94f / 100.0f));
snprintf(fpsbuf, sizeof(fpsbuf), "%s Speed: %0.1f%%", fpsbuf, vps / (59.94f / 100.0f));
} }
} }
#ifdef CAN_DISPLAY_CURRENT_BATTERY_CAPACITY #ifdef CAN_DISPLAY_CURRENT_BATTERY_CAPACITY
if (g_Config.iShowStatusFlags & (int)ShowStatusFlags::BATTERY_PERCENT) { if (g_Config.iShowStatusFlags & (int)ShowStatusFlags::BATTERY_PERCENT) {
snprintf(fpsbuf, sizeof(fpsbuf), "%s Battery: %d%%", fpsbuf, getCurrentBatteryCapacity()); char temp[256];
snprintf(temp, sizeof(temp), "%s Battery: %d%%", fpsbuf, getCurrentBatteryCapacity());
snprintf(fpsbuf, sizeof(fpsbuf), "%s", temp);
} }
#endif #endif