heimdall-frontend: fix deprecated use of sprintf

Use QString::asprintf instead. Fixes compilation warning:

/home/grimler/Heimdall/heimdall-frontend/source/mainwindow.cpp: In member function ‘void HeimdallFrontend::MainWindow::StartFlash()’:
/home/grimler/Heimdall/heimdall-frontend/source/mainwindow.cpp:925:53: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
  925 |   flag.sprintf("--%u", fileInfos[i].GetPartitionId());
      |                                                     ^
In file included from /usr/include/qt/QtCore/qcoreapplication.h:44,
                 from /usr/include/qt/QtCore/QCoreApplication:1,
                 from /home/grimler/Heimdall/heimdall-frontend/source/mainwindow.cpp:22:
/usr/include/qt/QtCore/qstring.h:393:14: note: declared here
  393 |     QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
      |
This commit is contained in:
Henrik Grimler 2021-05-03 14:18:38 +02:00
parent 094f715c4d
commit 220f90a4fe
1 changed files with 2 additions and 3 deletions

View File

@ -909,7 +909,7 @@ void MainWindow::StartFlash(void)
const FirmwareInfo& firmwareInfo = workingPackageData.GetFirmwareInfo();
const QList<FileInfo>& fileInfos = firmwareInfo.GetFileInfos();
QStringList arguments;
arguments.append("flash");
@ -922,8 +922,7 @@ void MainWindow::StartFlash(void)
for (int i = 0; i < fileInfos.length(); i++)
{
QString flag;
flag.sprintf("--%u", fileInfos[i].GetPartitionId());
flag = QString::asprintf("--%u", fileInfos[i].GetPartitionId());
arguments.append(flag);
arguments.append(fileInfos[i].GetFilename());
}