Skip to content

Commit

Permalink
tidy: Don't need to test a bool against 0/1 in an if statement.
Browse files Browse the repository at this point in the history
The clang-tidy "implicit boolean conversion" check pointed out a
couple of places where a boolean value was being explicitly compared
to the number 0/1.  This requires an implicit conversion to an integer
to perform the check, and then an implicit conversion back to boolean
to determine whether to take the if/else branch.  Using the
pre-existing boolean value eliminates both conversions.

https://clang.llvm.org/extra/clang-tidy/checks/readability-implicit-bool-conversion.html
  • Loading branch information
linuxdude42 committed Mar 26, 2019
1 parent c8adbdf commit f759974
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mythplugins/mythnetvision/mythnetvision/rsseditor.cpp
Expand Up @@ -105,7 +105,7 @@ bool RSSEditPopup::Create(void)
m_thumbImage->Load();
}

if (m_site->GetDownload() == 1)
if (m_site->GetDownload())
m_download->SetCheckState(MythUIStateType::Full);
}

Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythnews/mythnews/mythnews.cpp
Expand Up @@ -356,7 +356,7 @@ void MythNews::updateInfoView(MythUIButtonListItem *selected)
if (m_thumbnailImage && m_thumbnailImage->IsVisible())
m_thumbnailImage->Hide();

if (m_podcastImage && site->podcast() == 1)
if (m_podcastImage && site->podcast())
m_podcastImage->Show();

if (!site->imageURL().isEmpty())
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythnews/mythnews/mythnewseditor.cpp
Expand Up @@ -96,7 +96,7 @@ bool MythNewsEditor::Create(void)
m_nameEdit->SetText(m_site->name());
m_urlEdit->SetText(m_site->url());
m_iconEdit->SetText(m_site->imageURL());
if (m_site->podcast() == 1)
if (m_site->podcast())
m_podcastCheck->SetCheckState(MythUIStateType::Full);
}

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/DVD/mythdvdplayer.cpp
Expand Up @@ -670,7 +670,7 @@ void MythDVDPlayer::GoToDVDProgram(bool direction)
{
if (!player_ctx->m_buffer->IsDVD())
return;
if (direction == 0)
if (direction)
player_ctx->m_buffer->DVD()->GoToPreviousProgram();
else
player_ctx->m_buffer->DVD()->GoToNextProgram();
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythtranscode/mpeg2fix.cpp
Expand Up @@ -162,7 +162,7 @@ int64_t PTSOffsetQueue::Get(int idx, AVPacket *pkt)
{
it = ++m_offset[idx].begin();
if ((((*it).type == 0) && (pkt->pts >= (*it).pos_pts) /* PTS type */) ||
(((*it).type == 1) /* Pos type */ &&
(((*it).type) /* Pos type */ &&
((pkt->pos >= (*it).pos_pts) || (pkt->duration > (*it).framenum))))
{
m_offset[idx].pop_front();
Expand Down

0 comments on commit f759974

Please sign in to comment.