rbutil: Fix various issues found by clazy.

Change-Id: I91ca2baed34f0f3b561602f95f66bbd4e17e74ab
This commit is contained in:
Dominik Riebeling 2021-12-25 19:59:57 +01:00
parent 0768705545
commit 01e245417e
9 changed files with 15 additions and 19 deletions

View file

@ -190,7 +190,7 @@ QString System::osVersionString(void)
if(ret != -1) { if(ret != -1) {
result = QString("CPU: %1, %2 processor(s)").arg(u.machine).arg(cores); result = QString("CPU: %1, %2 processor(s)").arg(u.machine).arg(cores);
result += QString("<br/>System: %2<br/>Release: %3<br/>Version: %4") result += QString("<br/>System: %2<br/>Release: %3<br/>Version: %4")
.arg(u.sysname).arg(u.release).arg(u.version); .arg(u.sysname, u.release, u.version);
} }
else { else {
result = QString("(Error when retrieving system information)"); result = QString("(Error when retrieving system information)");

View file

@ -252,9 +252,10 @@ bool TalkFileCreator::copyTalkFiles(QString* errString)
// copying // copying
LOG_INFO() << "copying" << m_talkList[i].talkfilename LOG_INFO() << "copying" << m_talkList[i].talkfilename
<< "to" << m_talkList[i].target; << "to" << m_talkList[i].target;
if(!QFile::copy(m_talkList[i].talkfilename,m_talkList[i].target)) if(!QFile::copy(m_talkList[i].talkfilename, m_talkList[i].target))
{ {
*errString = tr("Copying of %1 to %2 failed").arg(m_talkList[i].talkfilename).arg(m_talkList[i].target); *errString = tr("Copying of %1 to %2 failed")
.arg(m_talkList[i].talkfilename, m_talkList[i].target);
return false; return false;
} }

View file

@ -161,13 +161,13 @@ TalkGenerator::Status TalkGenerator::voiceList(QList<TalkEntry>* list,int wavtri
if(status == Warning) if(status == Warning)
{ {
warnings = true; warnings = true;
emit logItem(tr("Voicing of %1 failed: %2").arg(list->at(i).toSpeak).arg(error), emit logItem(tr("Voicing of %1 failed: %2")
LOGWARNING); .arg(list->at(i).toSpeak, error), LOGWARNING);
} }
else if (status == FatalError) else if (status == FatalError)
{ {
emit logItem(tr("Voicing of %1 failed: %2").arg(list->at(i).toSpeak).arg(error), emit logItem(tr("Voicing of %1 failed: %2")
LOGERROR); .arg(list->at(i).toSpeak, error), LOGERROR);
return eERROR; return eERROR;
} }
else else

View file

@ -193,7 +193,7 @@ TTSStatus TTSFestival::voice(QString text, QString wavfile, QString* errStr)
QString path = RbSettings::subValue("festival-client", QString path = RbSettings::subValue("festival-client",
RbSettings::TtsPath).toString(); RbSettings::TtsPath).toString();
QString cmd = QString("%1 --server localhost --otype riff --ttw --withlisp" QString cmd = QString("%1 --server localhost --otype riff --ttw --withlisp"
" --output \"%2\" --prolog \"%3\" - ").arg(path).arg(wavfile).arg(prologPath); " --output \"%2\" --prolog \"%3\" - ").arg(path, wavfile, prologPath);
LOG_INFO() << "Client cmd:" << cmd; LOG_INFO() << "Client cmd:" << cmd;
QProcess clientProcess; QProcess clientProcess;

View file

@ -197,7 +197,7 @@ QStringList TTSSapi::getVoiceList(QString language)
voicescript->closeWriteChannel(); voicescript->closeWriteChannel();
voicescript->waitForReadyRead(); voicescript->waitForReadyRead();
QString dataRaw = voicescript->readAllStandardError().data(); const QString dataRaw = voicescript->readAllStandardError().constData();
if(dataRaw.startsWith("Error")) { if(dataRaw.startsWith("Error")) {
LOG_INFO() << "Error:" << dataRaw; LOG_INFO() << "Error:" << dataRaw;
} }

View file

@ -1057,7 +1057,7 @@ qint64 Utils::recursiveFolderSize(QString path)
size += item.size(); size += item.size();
} }
QList<QString> folders = QDir(path).entryList(QDir::Dirs | QDir::NoDotAndDotDot); QList<QString> folders = QDir(path).entryList(QDir::Dirs | QDir::NoDotAndDotDot);
for (auto folder: folders) { for (auto const& folder: folders) {
size += recursiveFolderSize(path + "/" + folder); size += recursiveFolderSize(path + "/" + folder);
} }
return size; return size;

View file

@ -277,7 +277,6 @@ void SelectiveInstallWidget::installBootloader(void)
if(ui.bootloaderCheckbox->isChecked()) { if(ui.bootloaderCheckbox->isChecked()) {
LOG_INFO() << "installing bootloader"; LOG_INFO() << "installing bootloader";
QString platform = RbSettings::value(RbSettings::Platform).toString();
QString backupDestination = ""; QString backupDestination = "";
// create installer // create installer
@ -509,7 +508,6 @@ void SelectiveInstallWidget::installVoicefile(void)
RockboxInfo installInfo(m_mountpoint); RockboxInfo installInfo(m_mountpoint);
QString voiceurl; QString voiceurl;
QString logversion; QString logversion;
QString relversion = installInfo.release();
if(m_buildtype != PlayerBuildInfo::TypeRelease) { if(m_buildtype != PlayerBuildInfo::TypeRelease) {
// release is empty for non-release versions (i.e. daily / current) // release is empty for non-release versions (i.e. daily / current)
logversion = installInfo.release(); logversion = installInfo.release();
@ -549,7 +547,6 @@ void SelectiveInstallWidget::installManual(void)
RockboxInfo installInfo(m_mountpoint); RockboxInfo installInfo(m_mountpoint);
QString manualurl; QString manualurl;
QString logversion; QString logversion;
QString relversion = installInfo.release();
if(m_buildtype != PlayerBuildInfo::TypeRelease) { if(m_buildtype != PlayerBuildInfo::TypeRelease) {
// release is empty for non-release versions (i.e. daily / current) // release is empty for non-release versions (i.e. daily / current)
logversion = installInfo.release(); logversion = installInfo.release();
@ -638,7 +635,7 @@ void SelectiveInstallWidget::installPluginData(void)
for(size_t i = 0; i < sizeof(PluginDataFiles) / sizeof(PluginDataFiles[0]); i++) for(size_t i = 0; i < sizeof(PluginDataFiles) / sizeof(PluginDataFiles[0]); i++)
{ {
// check if installed Rockbox has this plugin. // check if installed Rockbox has this plugin.
if(QFileInfo(m_mountpoint + "/.rockbox/rocks/" + PluginDataFiles[i].rockfile).exists()) { if(QFileInfo::exists(m_mountpoint + "/.rockbox/rocks/" + PluginDataFiles[i].rockfile)) {
dataName.append(PluginDataFiles[i].name); dataName.append(PluginDataFiles[i].name);
// game URLs do not depend on the actual build type, but we need // game URLs do not depend on the actual build type, but we need
// to pass it (simplifies the API, and will allow to make them // to pass it (simplifies the API, and will allow to make them

View file

@ -281,8 +281,7 @@ void RbUtilQt::about()
licenses[":/docs/LICENSE.BZIP2"] = "<a id='bzip2'>bzip2 License</a>"; licenses[":/docs/LICENSE.BZIP2"] = "<a id='bzip2'>bzip2 License</a>";
licenses[":/docs/LICENSE.BSPATCH"] = "<a id='bspatch'>bspatch License</a>"; licenses[":/docs/LICENSE.BSPATCH"] = "<a id='bspatch'>bspatch License</a>";
for (int i = 0; i < licenses.size(); i++) { for (auto const& key : licenses.keys()) {
QString key = licenses.keys().at(i);
QFile license(key); QFile license(key);
license.open(QIODevice::ReadOnly); license.open(QIODevice::ReadOnly);
QTextStream s(&license); QTextStream s(&license);
@ -461,8 +460,6 @@ void RbUtilQt::uninstallBootloader(void)
ProgressLoggerGui* logger = new ProgressLoggerGui(this); ProgressLoggerGui* logger = new ProgressLoggerGui(this);
logger->show(); logger->show();
QString platform = RbSettings::value(RbSettings::Platform).toString();
// create installer // create installer
BootloaderInstallBase *bl BootloaderInstallBase *bl
= BootloaderInstallHelper::createBootloaderInstaller(this, = BootloaderInstallHelper::createBootloaderInstaller(this,

View file

@ -148,7 +148,8 @@ class TestHttpGet : public QObject
QString tempdir; QString tempdir;
for(int i = 0; i < 100000; i++) { for(int i = 0; i < 100000; i++) {
tempdir = QDir::tempPath() + QString("/qttest-temp-%1").arg(i); tempdir = QDir::tempPath() + QString("/qttest-temp-%1").arg(i);
if(!QFileInfo(tempdir).exists()) break; if(!QFileInfo::exists(tempdir))
break;
} }
QDir().mkpath(tempdir); QDir().mkpath(tempdir);
return QDir(tempdir); return QDir(tempdir);