From d82d8cefedb729b7193ab1687bc8960fb7310097 Mon Sep 17 00:00:00 2001 From: cold-brewed <47337035+cold-brewed@users.noreply.github.com> Date: Fri, 28 Jun 2024 10:16:12 -0400 Subject: [PATCH] qt: Fix strings in enumeration of host drives --- src/qt/qt_mediamenu.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qt/qt_mediamenu.cpp b/src/qt/qt_mediamenu.cpp index a1d8a528c..5f1289740 100644 --- a/src/qt/qt_mediamenu.cpp +++ b/src/qt/qt_mediamenu.cpp @@ -157,10 +157,10 @@ MediaMenu::refresh(QMenu *parentMenu) #ifdef Q_OS_WINDOWS /* Loop through each Windows drive letter and test to see if it's a CDROM */ - for (auto &letter : driveLetters) { - auto drive = QString::asprintf("%c:\\", letter).toUtf8().constData(); - if (GetDriveType(drive) == DRIVE_CDROM) - menu->addAction(QApplication::style()->standardIcon(QStyle::SP_DriveCDIcon), tr("Host CD/DVD Drive (%1:)").arg(letter), [this, i, letter]() { cdromMount(i, 2, QString::asprintf(R"(\\.\%c:)", letter).toUtf8().constData()); })->setCheckable(false); + for (const auto &letter : driveLetters) { + auto drive = QString("%1:\\").arg(letter); + if (GetDriveType(drive.toUtf8().constData()) == DRIVE_CDROM) + menu->addAction(QApplication::style()->standardIcon(QStyle::SP_DriveCDIcon), tr("Host CD/DVD Drive (%1:)").arg(letter), [this, i, letter] { cdromMount(i, 2, QString(R"(\\.\%1:)").arg(letter)); })->setCheckable(false); } menu->addSeparator(); #endif // Q_OS_WINDOWS