From 6a8eaf507c67c2af7000235c5c0ed2d0e4f36730 Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 24 Jun 2025 05:13:05 +0200 Subject: [PATCH] Fixed all the warnings and reverted a change to 86box.c that was not supposed to be committed. --- src/86box.c | 10 ++++++---- src/qt/qt_platform.cpp | 4 ++-- src/qt/qt_vmmanager_main.cpp | 1 - src/qt/qt_vmmanager_system.cpp | 14 ++++++++------ 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/86box.c b/src/86box.c index e5b0f46cc..8c07daa15 100644 --- a/src/86box.c +++ b/src/86box.c @@ -639,7 +639,7 @@ pc_show_usage(char *s) ui_msgbox(MBX_ANSI | ((s == NULL) ? MBX_INFO : MBX_WARNING), p); #else if (s == NULL) - pclog(p); + pclog("%s", p); else ui_msgbox(MBX_ANSI | MBX_WARNING, p); #endif @@ -742,7 +742,11 @@ usage: /* Using this variable for vm manager path Temporary solution!*/ if ((c+1) == argc) goto usage; - strcpy(vmm_path, argv[++c]); + char *vp = argv[++c]; + if ((strlen(vp) + 1) >= sizeof(vmm_path)) + memcpy(vmm_path, vp, sizeof(vmm_path)); + else + memcpy(vmm_path, vp, strlen(vp) + 1); //#endif } else if (!strcasecmp(argv[c], "--fullscreen") || !strcasecmp(argv[c], "-F")) { start_in_fullscreen = 1; @@ -1613,8 +1617,6 @@ pc_close(UNUSED(thread_t *ptr)) plat_mouse_capture(0); - warning("CS:EIP = %04X:%08X\n", CS, cpu_state.pc); - /* Close all the memory mappings. */ mem_close(); diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index a8c25bc2d..8c2586482 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -776,8 +776,8 @@ plat_set_thread_name(void *thread, const char *name) if (pSetThreadDescription) { size_t len = strlen(name) + 1; - wchar_t wname[len + 1]; - mbstowcs(wname, name, len); + wchar_t wname[2048]; + mbstowcs(wname, name, (len >= 1024) ? 1024 : len); pSetThreadDescription(thread ? (HANDLE) thread : GetCurrentThread(), wname); } #else diff --git a/src/qt/qt_vmmanager_main.cpp b/src/qt/qt_vmmanager_main.cpp index c49340647..8c83b549f 100644 --- a/src/qt/qt_vmmanager_main.cpp +++ b/src/qt/qt_vmmanager_main.cpp @@ -236,7 +236,6 @@ VMManagerMain::shutdownForceButtonPressed() const void VMManagerMain::refresh() { - bool running = selected_sysconfig->process->state() == QProcess::ProcessState::Running; const auto current_index = ui->listView->currentIndex(); emit selectionChanged(current_index, selected_sysconfig->process->state()); diff --git a/src/qt/qt_vmmanager_system.cpp b/src/qt/qt_vmmanager_system.cpp index 68b83c3a8..08853feab 100644 --- a/src/qt/qt_vmmanager_system.cpp +++ b/src/qt/qt_vmmanager_system.cpp @@ -747,18 +747,20 @@ VMManagerSystem::setupVars() { QStringList serialFinal; QStringList lptFinal; int portIndex = 0; - for(const auto &serialNum: serial_enabled) { - if (serial_enabled[portIndex]) { + while (true) { + if (serial_enabled[portIndex]) serialFinal.append(QString("COM%1").arg(portIndex + 1)); - } ++portIndex; + if (portIndex == SERIAL_MAX) + break; } portIndex = 0; - for (const auto &lptNum: lpt_enabled) { - if (lpt_enabled[portIndex]) { + while (true) { + if (lpt_enabled[portIndex]) lptFinal.append(QString("LPT%1").arg(portIndex + 1)); - } ++portIndex; + if (portIndex == PARALLEL_MAX) + break; } display_table[Display::Name::Serial] = serialFinal.empty() ? tr("None") : serialFinal.join(", "); display_table[Display::Name::Parallel] = lptFinal.empty() ? tr("None") : lptFinal.join(", ");