Skip to content

Commit

Permalink
tidy: Perform explicit zero/non-zero test when converting bit flags t…
Browse files Browse the repository at this point in the history
…o boolean. (2)

The clang-tidy "implicit boolean conversion" check pointed out a
number of places where integers have a bitmask applied, and are then
implicitly converted to boolean values.  Make the conversion explicit
by adding a test for zero/non-zero.  Changes made by the clang-tidy
program, then tweaked by hand because clang-tidy doesn't handle the
"not not" idiom.

https://clang.llvm.org/extra/clang-tidy/checks/readability-implicit-bool-conversion.html
  • Loading branch information
linuxdude42 committed Apr 3, 2019
1 parent 764c008 commit 27e3972
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/jobqueue.cpp
Expand Up @@ -1942,7 +1942,7 @@ void JobQueue::DoTranscodeThread(int jobID)
program_info->Reload();

bool useCutlist = program_info->HasCutlist() &&
!!(GetJobFlags(jobID) & JOB_USE_CUTLIST);
((GetJobFlags(jobID) & JOB_USE_CUTLIST) != 0);

uint transcoder = program_info->QueryTranscoderID();
QString profilearg =
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/previewgenerator.cpp
Expand Up @@ -210,8 +210,8 @@ bool PreviewGenerator::Run(void)
QTime tm = QTime::currentTime();
bool ok = false;
QString command = GetAppBinDir() + "mythpreviewgen";
bool local_ok = ((IsLocal() || !!(m_mode & kForceLocal)) &&
(!!(m_mode & kLocal)) &&
bool local_ok = ((IsLocal() || ((m_mode & kForceLocal) != 0)) &&
((m_mode & kLocal) != 0) &&
QFileInfo(command).isExecutable());
if (!local_ok)
{
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/recorders/analogsignalmonitor.cpp
Expand Up @@ -30,7 +30,7 @@ AnalogSignalMonitor::AnalogSignalMonitor(int db_cardnum,
if (!CardUtil::GetV4LInfo(videofd, m_card, m_driver, m_version, caps))
return;

m_usingv4l2 = !!(caps & V4L2_CAP_VIDEO_CAPTURE);
m_usingv4l2 = ((caps & V4L2_CAP_VIDEO_CAPTURE) != 0U);
LOG(VB_RECORD, LOG_INFO, QString("card '%1' driver '%2' version '%3'")
.arg(m_card).arg(m_driver).arg(m_version));
}
Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmythtv/recorders/mpegrecorder.cpp
Expand Up @@ -376,9 +376,9 @@ bool MpegRecorder::OpenV4L2DeviceAsInput(void)
uint32_t capabilities = 0;
if (CardUtil::GetV4LInfo(m_chanfd, m_card, m_driver, m_version, capabilities))
{
m_supports_sliced_vbi = !!(capabilities & V4L2_CAP_SLICED_VBI_CAPTURE);
supports_tuner = !!(capabilities & V4L2_CAP_TUNER);
supports_audio = !!(capabilities & V4L2_CAP_AUDIO);
m_supports_sliced_vbi = ((capabilities & V4L2_CAP_SLICED_VBI_CAPTURE) != 0U);
supports_tuner = ((capabilities & V4L2_CAP_TUNER) != 0U);
supports_audio = ((capabilities & V4L2_CAP_AUDIO) != 0U);
/// Determine hacks needed for specific drivers & driver versions
if (m_driver == "hdpvr")
{
Expand Down
10 changes: 5 additions & 5 deletions mythtv/libs/libmythtv/recorders/v4lchannel.cpp
Expand Up @@ -74,11 +74,11 @@ bool V4LChannel::Open(void)
return false;
}

m_has_stream_io = !!(capabilities & V4L2_CAP_STREAMING);
m_has_std_io = !!(capabilities & V4L2_CAP_READWRITE);
m_has_async_io = !!(capabilities & V4L2_CAP_ASYNCIO);
m_has_tuner = !!(capabilities & V4L2_CAP_TUNER);
m_has_sliced_vbi = !!(capabilities & V4L2_CAP_SLICED_VBI_CAPTURE);
m_has_stream_io = ((capabilities & V4L2_CAP_STREAMING) != 0U);
m_has_std_io = ((capabilities & V4L2_CAP_READWRITE) != 0U);
m_has_async_io = ((capabilities & V4L2_CAP_ASYNCIO) != 0U);
m_has_tuner = ((capabilities & V4L2_CAP_TUNER) != 0U);
m_has_sliced_vbi = ((capabilities & V4L2_CAP_SLICED_VBI_CAPTURE) != 0U);

if (m_driver_name == "bttv" || m_driver_name == "cx8800" || m_driver_name == "cx88_blackbird"
|| m_driver_name == "saa7164")
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythtranscode/mpeg2fix.cpp
Expand Up @@ -1317,7 +1317,7 @@ bool MPEG2fixup::BuildFrame(AVPacket *pkt, QString fname)
// End HACK

SetRepeat(pkt->data, pkt->size, info->display_picture->nb_fields,
!!(info->display_picture->flags & PIC_FLAG_TOP_FIELD_FIRST));
((info->display_picture->flags & PIC_FLAG_TOP_FIELD_FIRST) != 0U));

avcodec_free_context(&c);

Expand Down

0 comments on commit 27e3972

Please sign in to comment.