Skip to content

Commit

Permalink
cppcheck: Fix "one definition rule" is violation for Source.
Browse files Browse the repository at this point in the history
This class is defined in two different locations:

    libs/libmythtv/channelsettings.cpp
    programs/mythfilldatabase/filldata.h

Eliminate the error by changing the class name in mythfilldatabase to
DataSource. Also change SourceList->DataSourceList to keep the
symmetry of naming.

https://en.cppreference.com/w/cpp/language/definition#One_Definition_Rule
  • Loading branch information
linuxdude42 committed Jan 3, 2023
1 parent e523a59 commit b91959b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions mythtv/programs/mythfilldatabase/filldata.cpp
Expand Up @@ -115,7 +115,7 @@ bool FillData::GrabDataFromFile(int id, const QString &filename)
return true;
}

bool FillData::GrabData(const Source& source, int offset)
bool FillData::GrabData(const DataSource& source, int offset)
{
QString xmltv_grabber = source.xmltvgrabber;

Expand Down Expand Up @@ -237,14 +237,14 @@ bool FillData::GrabData(const Source& source, int offset)
return succeeded;
}

/** \fn FillData::Run(SourceList &sourcelist)
/** \fn FillData::Run(DataSourceList &sourcelist)
* \brief Goes through the sourcelist and updates its channels with
* program info grabbed with the associated grabber.
* \return true if there were no failures
*/
bool FillData::Run(SourceList &sourcelist)
bool FillData::Run(DataSourceList &sourcelist)
{
SourceList::iterator it;
DataSourceList::iterator it;

QString status;
QString querystr;
Expand Down
8 changes: 4 additions & 4 deletions mythtv/programs/mythfilldatabase/filldata.h
Expand Up @@ -22,7 +22,7 @@ bool updateLastRunStart();
bool updateLastRunStatus(QString &status);
bool updateNextScheduledRun();

struct Source
struct DataSource
{
int id {0};
QString name;
Expand All @@ -37,7 +37,7 @@ struct Source
bool xmltvgrabber_lineups {false};
QString xmltvgrabber_prefmethod;
};
using SourceList = std::vector<Source>;
using DataSourceList = std::vector<DataSource>;

class FillData
{
Expand All @@ -50,8 +50,8 @@ class FillData
void SetRefresh(int day, bool set);

bool GrabDataFromFile(int id, const QString &filename);
bool GrabData(const Source& source, int offset);
bool Run(SourceList &sourcelist);
bool GrabData(const DataSource& source, int offset);
bool Run(DataSourceList &sourcelist);

enum
{
Expand Down
4 changes: 2 additions & 2 deletions mythtv/programs/mythfilldatabase/mythfilldatabase.cpp
Expand Up @@ -338,7 +338,7 @@ int main(int argc, char *argv[])
}
else
{
SourceList sourcelist;
DataSourceList sourcelist;

MSqlQuery sourcequery(MSqlQuery::InitCon());
QString where;
Expand All @@ -362,7 +362,7 @@ int main(int argc, char *argv[])
{
while (sourcequery.next())
{
Source newsource;
DataSource newsource;

newsource.id = sourcequery.value(0).toInt();
newsource.name = sourcequery.value(1).toString();
Expand Down

0 comments on commit b91959b

Please sign in to comment.