Skip to content

Commit

Permalink
tidy: Return braced initializer instead of creating object just for r…
Browse files Browse the repository at this point in the history
…eturn.

The clang-tidy "return braced initializer list" check pointed out two
places where explicitly creating an object and then immediately
returning it to the caller could be replaced by just returning a
braces initializer for the object.  This eliminates the duplication of
the type information in the function.  Changes made by the clang-tidy
program.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-return-braced-init-list.html
  • Loading branch information
linuxdude42 committed Dec 23, 2019
1 parent ede2aa8 commit 6f24067
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions mythtv/libs/libmythtv/dtvconfparserhelpers.h
Expand Up @@ -201,7 +201,7 @@ class DTVInversion : public DTVParamHelper
QString toString() const { return toString(m_value); }
QChar toChar() const
{ if (toString().length() > 0)
return toString()[0]; else return QChar(0); }
return toString()[0]; else return {0}; }

static QString toString(int _value)
{ return DTVParamHelper::toString(s_dbStr, _value, kDBStrCnt); }
Expand Down Expand Up @@ -254,7 +254,7 @@ class DTVBandwidth : public DTVParamHelper
QString toString() const { return toString(m_value); }
QChar toChar() const
{ if (toString().length() > 0)
return toString()[0]; else return QChar(0); }
return toString()[0]; else return {0}; }

static QString toString(int _value)
{ return DTVParamHelper::toString(s_dbStr, _value, kDBStrCnt); }
Expand Down Expand Up @@ -431,7 +431,7 @@ class DTVTransmitMode : public DTVParamHelper
QString toString() const { return toString(m_value); }
QChar toChar() const
{ if (toString().length() > 0)
return toString()[0]; else return QChar(0); }
return toString()[0]; else return {0}; }

static QString toString(int _value)
{ return DTVParamHelper::toString(s_dbStr, _value, kDBStrCnt); }
Expand Down Expand Up @@ -536,7 +536,7 @@ class DTVHierarchy : public DTVParamHelper
QString toString() const { return toString(m_value); }
QChar toChar() const
{ if (toString().length() > 0)
return toString()[0]; else return QChar(0); }
return toString()[0]; else return {0}; }

static QString toString(int _value)
{ return DTVParamHelper::toString(s_dbStr, _value, kDBStrCnt); }
Expand Down Expand Up @@ -573,7 +573,7 @@ class DTVPolarity : public DTVParamHelper
QString toString() const { return toString(m_value); }
QChar toChar() const
{ if (toString().length() > 0)
return toString()[0]; else return QChar(0); }
return toString()[0]; else return {0}; }

static QString toString(int _value)
{ return DTVParamHelper::toString(s_dbStr, _value, kDBStrCnt); }
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/frequencytables.h
Expand Up @@ -244,7 +244,7 @@ class transport_scan_items_it_t
transport_scan_items_it_t nextTransport() const
{
list<TransportScanItem>::iterator tmp = m_it;
return transport_scan_items_it_t(++tmp);
return {++tmp};
}

private:
Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmythtv/mpeg/sctetables.h
Expand Up @@ -229,10 +229,10 @@ class MTV_PUBLIC SCTENetworkInformationTable : public PSIPTable
// for (i = 0; i < number_of_records; i++) {
// if (kCarrierDefinitionSubtable == table_subtype) {
CarrierDefinitionSubtable CarrierDefinition(uint i) const
{ return CarrierDefinitionSubtable(m_ptrs[i], m_ptrs[i+1]); }
{ return {m_ptrs[i], m_ptrs[i+1]}; }
// if (kModulationModeSubtable == table_subtype) {
ModulationModeSubtable ModulationMode(uint i) const
{ return ModulationModeSubtable(m_ptrs[i], m_ptrs[i+1]); }
{ return {m_ptrs[i], m_ptrs[i+1]}; }

// }
// for (i=0; i<N; i++)
Expand Down Expand Up @@ -539,7 +539,7 @@ class MTV_PUBLIC ShortVirtualChannelTable : public PSIPTable
// }
// if (table_subtype==kVirtualChannelMap) {
VirtualChannelMapSubtable VirtualChannelMap(void) const
{ return VirtualChannelMapSubtable(pesdata(), m_ptrs); }
{ return { pesdata(), m_ptrs}; }
// }
// if (table_subtype==kInverseChannelMap) {
InverseChannelMapSubtable InverseChannelMap(void) const
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythui/mythdisplay.cpp
Expand Up @@ -714,12 +714,12 @@ double MythDisplay::EstimateVirtualAspectRatio(void)

QSize MythDisplay::GetResolution(void)
{
return QSize(m_last.Width(), m_last.Height());
return {m_last.Width(), m_last.Height()};
}

QSize MythDisplay::GetPhysicalSize(void)
{
return QSize(m_last.WidthMM(), m_last.HeightMM());
return {m_last.WidthMM(), m_last.HeightMM()};
}

void MythDisplay::WaitForScreenChange(void)
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythui/mythuianimation.h
Expand Up @@ -27,7 +27,7 @@ class UIEffects
x += rect.width();
if (Bottom == m_centre || BottomLeft == m_centre || BottomRight == m_centre)
y += rect.height();
return QPointF(x, y);
return {x, y};
}

QRect GetExtent(const QSize &size);
Expand Down

0 comments on commit 6f24067

Please sign in to comment.