From 755b7cd6e512d890df11f88d712d7a12b850ff75 Mon Sep 17 00:00:00 2001 From: David Hampton Date: Sun, 29 Dec 2024 17:10:51 -0500 Subject: [PATCH] tidy: Fix warnings from recent commits. https://clang.llvm.org/extra/clang-tidy/checks/bugprone/use-after-move.html https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/init-variables.html https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-auto.html https://clang.llvm.org/extra/clang-tidy/checks/performance/move-const-arg.html https://clang.llvm.org/extra/clang-tidy/checks/performance/unnecessary-value-param.html https://clang.llvm.org/extra/clang-tidy/checks/readability/braces-around-statements.html https://clang.llvm.org/extra/clang-tidy/checks/readability/convert-member-functions-to-static.html https://clang.llvm.org/extra/clang-tidy/checks/readability/else-after-return.html --- mythtv/libs/libmythtv/mpeg/AVCParser.cpp | 2 +- mythtv/libs/libmythtv/tv_play.cpp | 17 ++++++++++------- mythtv/libs/libmythtv/tv_play.h | 4 ++-- mythtv/programs/mythfrontend/proglist.cpp | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/mythtv/libs/libmythtv/mpeg/AVCParser.cpp b/mythtv/libs/libmythtv/mpeg/AVCParser.cpp index 9c56f394a18..0986da41036 100644 --- a/mythtv/libs/libmythtv/mpeg/AVCParser.cpp +++ b/mythtv/libs/libmythtv/mpeg/AVCParser.cpp @@ -1078,7 +1078,7 @@ MythAVRational AVCParser::getFrameRate() const { if (m_unitsInTick == 0) return MythAVRational(0); - else if (m_timeScale & 0x1) + if (m_timeScale & 0x1) return MythAVRational(m_timeScale, m_unitsInTick * 2); return MythAVRational(m_timeScale / 2, m_unitsInTick); } diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp index 2cfe6d37789..987a7c368d4 100644 --- a/mythtv/libs/libmythtv/tv_play.cpp +++ b/mythtv/libs/libmythtv/tv_play.cpp @@ -7026,7 +7026,7 @@ void TV::DoEditSchedule(int EditType, const QString & EditArg) } } -void TV::EditSchedule(int EditType, const QString arg) +void TV::EditSchedule(int EditType, const QString& arg) { // post the request so the guide will be created in the UI thread QString message = QString("START_EPG %1 %2").arg(EditType).arg(arg); @@ -9616,11 +9616,9 @@ void TV::RetrieveCast(const ProgramInfo& ProgInfo) if (query.exec() && query.size() > 0) { QStringList plist; - QString rstr; QString role; QString pname; QString character; - int pid; while(query.next()) { @@ -9640,7 +9638,7 @@ void TV::RetrieveCast(const ProgramInfo& ProgInfo) * majority of other columns, or we'll have the same problem in * reverse. */ - pid = query.value(3).toInt(); + int pid = query.value(3).toInt(); pname = QString::fromUtf8(query.value(1) .toByteArray().constData()) + "|" + QString::number(pid); @@ -9664,12 +9662,16 @@ void TV::FillOSDMenuCastButton(MythOSDDialogData & dialog, for (const auto & [actor, role] : std::as_const(people)) { if (role.isEmpty()) + { dialog.m_buttons.push_back( {actor.split('|')[0], QString("JUMPCAST|%1").arg(actor), true} ); + } else + { dialog.m_buttons.push_back( {QString("%1 as %2") .arg(actor.split('|')[0], role), QString("JUMPCAST|%1").arg(actor), true} ); + } } } @@ -9719,15 +9721,14 @@ void TV::FillOSDMenuActorShows(const QString & actor, int person_id, " ORDER BY starttime;").arg(table)); query.bindValue(":PERSON", person_id); - int chanid; QDateTime starttime; if (query.exec() && query.size() > 0) { while(query.next()) { - chanid = query.value(0).toInt(); + int chanid = query.value(0).toInt(); starttime = MythDate::fromString(query.value(1).toString()); - ProgramInfo *pi = new ProgramInfo(chanid, starttime.toUTC()); + auto *pi = new ProgramInfo(chanid, starttime.toUTC()); if (!pi->GetTitle().isEmpty() && pi->GetRecordingGroup() != "LiveTV" && pi->GetRecordingGroup() != "Deleted") @@ -9747,9 +9748,11 @@ void TV::FillOSDMenuActorShows(const QString & actor, int person_id, if (show.isEmpty()) continue; if (!pi->GetSubtitle().isEmpty()) + { show += QString(" %1x%2 %3").arg(pi->GetSeason()) .arg(pi->GetEpisode()) .arg(pi->GetSubtitle()); + } dialog.m_buttons.push_back( {show, QString("JUMPPROG %1 %2").arg(actor).arg(++idx) }); diff --git a/mythtv/libs/libmythtv/tv_play.h b/mythtv/libs/libmythtv/tv_play.h index 6c4f0ca9e7b..1d05927e0df 100644 --- a/mythtv/libs/libmythtv/tv_play.h +++ b/mythtv/libs/libmythtv/tv_play.h @@ -256,7 +256,7 @@ class MTV_PUBLIC TV : public TVPlaybackState, public MythTVMenuItemDisplayer, pu // Commands used by frontend UI screens (PlaybackBox, GuideGrid etc) void EditSchedule(int EditType = kScheduleProgramGuide, - const QString arg = ""); + const QString& arg = ""); bool IsTunablePriv(uint ChanId); static QVector IsTunableOn(PlayerContext* Context, uint ChanId); void ChangeChannel(const ChannelInfoList& Options); @@ -491,7 +491,7 @@ class MTV_PUBLIC TV : public TVPlaybackState, public MythTVMenuItemDisplayer, pu // Menu dialog void ShowOSDMenu(bool isCompact = false); void FillOSDMenuJumpRec(const QString &Category = "", int Level = 0, const QString &Selected = ""); - void FillOSDMenuCastButton(MythOSDDialogData & dialog, + static void FillOSDMenuCastButton(MythOSDDialogData & dialog, const QVector & people); void FillOSDMenuCast(void); void FillOSDMenuActorShows(const QString & actor, int person_id, diff --git a/mythtv/programs/mythfrontend/proglist.cpp b/mythtv/programs/mythfrontend/proglist.cpp index a085864f094..8cb29bf2241 100644 --- a/mythtv/programs/mythfrontend/proglist.cpp +++ b/mythtv/programs/mythfrontend/proglist.cpp @@ -92,7 +92,7 @@ ProgLister::ProgLister(MythScreenStack *parent, TV* player, ProgListType pltype, const QString & extraArg) : ScheduleCommon(parent, "ProgLister"), m_type(pltype), - m_extraArg(std::move(extraArg)), + m_extraArg(extraArg), m_startTime(MythDate::current()), m_searchTime(m_startTime), m_channelOrdering(gCoreContext->GetSetting("ChannelOrdering", "channum")),