Skip to content

Commit

Permalink
tidy: Move assignments to constructor member initialization list. (ex…
Browse files Browse the repository at this point in the history
…tra)

Promote member initialization by assignment in the body of the
constructor to be part of the constructor initialization list.  If
possible, further promote these values to default member initializers.

Changes pointed out by clang-tidy and made by hand.

https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/prefer-member-initializer.html
https://clang.llvm.org/extra/clang-tidy/checks/modernize/pass-by-value.html
https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-default-member-init.html
  • Loading branch information
linuxdude42 committed Aug 13, 2024
1 parent 46376f7 commit 274ea4b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
2 changes: 0 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ Checks: '-*,
# access unions. https://www.boost.org/ ,
-cppcoreguidelines-pro-type-union-access,
-cppcoreguidelines-prefer-member-initializer,
# As of 2024-08-01, there are 110 unique warnings. ,
-cppcoreguidelines-avoid-const-or-ref-data-members,
Expand Down
8 changes: 4 additions & 4 deletions mythtv/libs/libmythtv/channelscan/paneatsc.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ class PaneATSC : public GroupSetting
public:
PaneATSC(const QString &target, StandardSetting *setting) :
m_atscTable(new ScanFrequencyTable()),
m_atscModulation(new ScanATSCModulation())
m_atscModulation(new ScanATSCModulation()),
m_transportStart(new TransMythUIComboBoxSetting()),
m_transportEnd(new TransMythUIComboBoxSetting()),
m_transportCount(new GroupSetting())
{
setVisible(false);

Expand All @@ -30,15 +33,12 @@ class PaneATSC : public GroupSetting
connect(m_atscModulation, qOverload<const QString&>(&StandardSetting::valueChanged),
this, &PaneATSC::ModulationChanged);

m_transportStart = new TransMythUIComboBoxSetting();
m_transportStart->setLabel(tr("First Channel"));
m_transportStart->setHelpText(tr("Start scanning at this channel."));

m_transportEnd = new TransMythUIComboBoxSetting();
m_transportEnd->setLabel(tr("Last Channel"));
m_transportEnd->setHelpText(tr("Stop scanning after this channel."));

m_transportCount = new GroupSetting();
m_transportCount->setLabel(tr("Channel Count"));
m_transportCount->setHelpText(tr("Total number of channels to scan."));
m_transportCount->setReadOnly(true);
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythupnp/mbroadcastsocketdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class MBroadcastSocketDevice : public MSocketDevice
m_address(sAddress), m_port(nPort)
{
m_address.setAddress( sAddress );
m_port = nPort;

setProtocol(IPv4);
setSocket(createNewSocket(), MSocketDevice::Datagram);
Expand Down
9 changes: 6 additions & 3 deletions mythtv/libs/libmythupnp/serializers/soapSerializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#ifndef SOAPSERIALIZER_H
#define SOAPSERIALIZER_H

#include <utility>

#include "upnpexp.h"
#include "xmlSerializer.h"

Expand All @@ -29,10 +31,11 @@ class UPNP_PUBLIC SoapSerializer : public XmlSerializer
public:

SoapSerializer( QIODevice *pDevice,
const QString &sNamespace,
const QString &sRequestName ) : XmlSerializer( pDevice, sRequestName )
QString sNamespace,
const QString &sRequestName )
: XmlSerializer( pDevice, sRequestName ),
m_sNamespace(std::move(sNamespace))
{
m_sNamespace = sNamespace;
}

~SoapSerializer() override = default;
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythupnp/upnptaskcache.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class SSDPCacheTask : public Task

SSDPCacheTask() : Task("SSDPCacheTask")
{
m_nExecuteCount = 0;
m_nInterval = 30s;
// TODO: Rework when separating upnp/ssdp stack
// XmlConfiguration().GetDuration<std::chrono::seconds>("UPnP/SSDP/CacheInterval", 30s);
Expand Down

0 comments on commit 274ea4b

Please sign in to comment.