[mythtv-commits] [MythTV/mythtv] 70bd5d: cppcheck: Fix "use initialization list" warnings.

David Hampton noreply at github.com
Tue Jul 12 12:12:55 UTC 2022


  Branch: refs/heads/master
  Home:   https://github.com/MythTV/mythtv
  Commit: 70bd5d3f7d9270e8de84976f21aeb22d77a9d7f8
      https://github.com/MythTV/mythtv/commit/70bd5d3f7d9270e8de84976f21aeb22d77a9d7f8
  Author: David Hampton <mythtv at love2code.net>
  Date:   2022-07-10 (Sun, 10 Jul 2022)

  Changed paths:
    M mythtv/libs/libmyth/dbsettings.cpp
    M mythtv/libs/libmyth/dbsettings.h
    M mythtv/libs/libmyth/mythmediamonitor.cpp
    M mythtv/libs/libmyth/mythmediamonitor.h
    M mythtv/libs/libmythtv/mythvideoout.cpp
    M mythtv/libs/libmythtv/playercontext.cpp
    M mythtv/libs/libmythupnp/servicehost.cpp
    M mythtv/libs/libmythupnp/servicehost.h
    M mythtv/libs/libmythupnp/upnpcds.h
    M mythtv/libs/libmythupnp/upnptaskevent.cpp
    M mythtv/libs/libmythupnp/upnptaskevent.h

  Log Message:
  -----------
  cppcheck: Fix "use initialization list" warnings.

Move member variable assignment from the constructor body into the
function initialization list.  In the cases where the function body is
now empty, move the initializer list into the header file.

In one case, a redundant initializer was removed. In another, and
argument was converted to const&. In another, std::move was used with
the argument. These changes were based upon subsequent runs of
clang-tidy.


  Commit: 76f7222a06335246ba6f9b73c0dfd62dfa269794
      https://github.com/MythTV/mythtv/commit/76f7222a06335246ba6f9b73c0dfd62dfa269794
  Author: David Hampton <mythtv at love2code.net>
  Date:   2022-07-10 (Sun, 10 Jul 2022)

  Changed paths:
    M mythplugins/mythmusic/mythmusic/playlisteditorview.cpp

  Log Message:
  -----------
  cppcheck: Fix "use initialization list" warnings (2).

Move member variable assignment from the constructor body into the
function initialization list.

For some reason this change causes the clang-tidy NewDeleteLeaks check
to now determine that some (but not all) of the MusicGenericTree nodes
allocated in PlaylistEditorView::createRootNode are potential memory
leaks.  A pointer to the first node is saved in m_rootNode, and all of
the other nodes are attached as children of that first node (inside
the constructor) so there is no memory leak.  Disable the
NewDeleteLeaks check for that specific function.


  Commit: 167520038c037585d03678243d21f3a2dcf535c2
      https://github.com/MythTV/mythtv/commit/167520038c037585d03678243d21f3a2dcf535c2
  Author: David Hampton <mythtv at love2code.net>
  Date:   2022-07-10 (Sun, 10 Jul 2022)

  Changed paths:
    M mythtv/programs/mythfrontend/gallerytransitions.cpp

  Log Message:
  -----------
  cppcheck: Fix "possible null pointer dereference" in gallerytransitions.cpp.

The m_animation variable must point to an object, based on the object
constructor unconditionally connecting to a signal on that object.


  Commit: f7ba32c1cbeb2de189a17d3ffb84512e5ff5e0eb
      https://github.com/MythTV/mythtv/commit/f7ba32c1cbeb2de189a17d3ffb84512e5ff5e0eb
  Author: David Hampton <mythtv at love2code.net>
  Date:   2022-07-10 (Sun, 10 Jul 2022)

  Changed paths:
    M mythplugins/mythmusic/mythmusic/musicplayer.cpp

  Log Message:
  -----------
  cppcheck: Fix "possible null pointer dereference" in musicplayer.cpp.

Fix the bounds check to ensure no out of bounds access.


  Commit: c0181eafcd04530fe25a2752bd9c926f0f2492fb
      https://github.com/MythTV/mythtv/commit/c0181eafcd04530fe25a2752bd9c926f0f2492fb
  Author: David Hampton <mythtv at love2code.net>
  Date:   2022-07-10 (Sun, 10 Jul 2022)

  Changed paths:
    M mythtv/libs/libmythmetadata/metadatacommon.cpp

  Log Message:
  -----------
  cppcheck: Fix "possible null pointer dereference" in metadatacommon.cpp.

Protect the call to DecrRef behind the validity test.


  Commit: 6aa51ae0406f3ed76087209885cba31d35f8f245
      https://github.com/MythTV/mythtv/commit/6aa51ae0406f3ed76087209885cba31d35f8f245
  Author: David Hampton <mythtv at love2code.net>
  Date:   2022-07-10 (Sun, 10 Jul 2022)

  Changed paths:
    M mythtv/libs/libmyth/audio/audioconvert.cpp

  Log Message:
  -----------
  cppcheck: Fix "implementation-defined behaviour" warning in audioconvert.

The two clip_xxx functions are only ever called with the result of
lrintf() which returns a long. Change these functions to take a long
argument to match their input.


  Commit: 3e40bb2671c72c0f4e48bb527be9465997b1419e
      https://github.com/MythTV/mythtv/commit/3e40bb2671c72c0f4e48bb527be9465997b1419e
  Author: David Hampton <mythtv at love2code.net>
  Date:   2022-07-10 (Sun, 10 Jul 2022)

  Changed paths:
    M mythtv/libs/libmythtv/mpeg/mpegtables.h

  Log Message:
  -----------
  cppcheck: Fix "class MTV_PUBLIC PID" not handled warning.

This class doesn't need to be marked as PUBLIC since it contains no
functions.


  Commit: ca252252c9a8fdcd4dd940c306689f97edd06d01
      https://github.com/MythTV/mythtv/commit/ca252252c9a8fdcd4dd940c306689f97edd06d01
  Author: David Hampton <mythtv at love2code.net>
  Date:   2022-07-10 (Sun, 10 Jul 2022)

  Changed paths:
    M mythplugins/mythmusic/mythmusic/bumpscope.cpp
    M mythtv/libs/libmyth/mediamonitor-darwin.cpp
    M mythtv/libs/libmythtv/DVD/mythdvdbuffer.cpp
    M mythtv/programs/mythcommflag/ClassicCommDetector.cpp

  Log Message:
  -----------
  cppcheck: Fix "assigned but never used" warnings.

Reduce the scope of these variables so the analyzer doesn't complain.


  Commit: c2e02c8fd989b7a528d97f9fcf89d73a84f74930
      https://github.com/MythTV/mythtv/commit/c2e02c8fd989b7a528d97f9fcf89d73a84f74930
  Author: David Hampton <mythtv at love2code.net>
  Date:   2022-07-10 (Sun, 10 Jul 2022)

  Changed paths:
    M mythtv/libs/libmyth/mediamonitor-windows.h

  Log Message:
  -----------
  cppcheck: Mark function as an override.


  Commit: 2e0a6d886bcea19c51a88c32b1209b14cbb8993d
      https://github.com/MythTV/mythtv/commit/2e0a6d886bcea19c51a88c32b1209b14cbb8993d
  Author: David Hampton <mythtv at love2code.net>
  Date:   2022-07-10 (Sun, 10 Jul 2022)

  Changed paths:
    M mythtv/libs/libmythmetadata/metadatacommon.cpp

  Log Message:
  -----------
  cppcheck: Fix "duplicate condition" warning.


  Commit: 39a2a70e79e79bc68bf39817ad8f2c285e0aa9ae
      https://github.com/MythTV/mythtv/commit/39a2a70e79e79bc68bf39817ad8f2c285e0aa9ae
  Author: David Hampton <mythtv at love2code.net>
  Date:   2022-07-10 (Sun, 10 Jul 2022)

  Changed paths:
    M mythtv/libs/libmythtv/mythplayereditorui.cpp
    M mythtv/libs/libmythtv/mythplayereditorui.h
    M mythtv/libs/libmythupnp/wsdl.cpp
    M mythtv/libs/libmythupnp/wsdl.h

  Log Message:
  -----------
  cppcheck: Mark function arguments as const.


  Commit: 0a134eb904bfc433f1366b0d84fa87f016eb1c38
      https://github.com/MythTV/mythtv/commit/0a134eb904bfc433f1366b0d84fa87f016eb1c38
  Author: David Hampton <mythtv at love2code.net>
  Date:   2022-07-10 (Sun, 10 Jul 2022)

  Changed paths:
    M mythtv/programs/mythbackend/recordingextender.cpp

  Log Message:
  -----------
  Change some constant names to begine with 'k'.


  Commit: 48ab254f40f4661115b9c24ac417e0cc18c72899
      https://github.com/MythTV/mythtv/commit/48ab254f40f4661115b9c24ac417e0cc18c72899
  Author: David Hampton <mythtv at love2code.net>
  Date:   2022-07-10 (Sun, 10 Jul 2022)

  Changed paths:
    M mythtv/libs/libmyth/mediamonitor-darwin.cpp
    M mythtv/programs/mythbackend/recordingextender.cpp

  Log Message:
  -----------
  cppcheck: Fix a couple of false positive "usleep called" warnings.

Cppcheck is misidentifying these calls. They are calls to the
MThread::usleep function, not calls to the glibc usleep function.


  Commit: 11bf7d039580a8ad00787fe2868875d634cd7737
      https://github.com/MythTV/mythtv/commit/11bf7d039580a8ad00787fe2868875d634cd7737
  Author: David Hampton <mythtv at love2code.net>
  Date:   2022-07-10 (Sun, 10 Jul 2022)

  Changed paths:
    M mythtv/programs/mythcommflag/ClassicCommDetector.cpp

  Log Message:
  -----------
  cppcheck: Fix "condition is always true" warning.

The chain of if clauses has already tested and handled the cases where
"thisScore" is negative and zero, therefore there is no need to test
for a positive value.


  Commit: d7b0339eebc7394bcf863327477df607f130fbee
      https://github.com/MythTV/mythtv/commit/d7b0339eebc7394bcf863327477df607f130fbee
  Author: David Hampton <mythtv at love2code.net>
  Date:   2022-07-10 (Sun, 10 Jul 2022)

  Changed paths:
    M mythtv/libs/libmythtv/DVD/mythdvdbuffer.cpp
    M mythtv/libs/libmythtv/HLS/httplivestreambuffer.cpp
    M mythtv/libs/libmythtv/channelutil.cpp
    M mythtv/programs/mythfrontend/galleryslideview.cpp
    M mythtv/programs/mythfrontend/networkcontrol.cpp
    M mythtv/programs/mythtranscode/videodecodebuffer.cpp

  Log Message:
  -----------
  cppcheck: Quiet a couple of "condition is always true" warnings.

These warning are related to variables that look like they could be
changed by another thread.


  Commit: 3e57db92c5abc8fb2a0bad147af9e4096d9f8206
      https://github.com/MythTV/mythtv/commit/3e57db92c5abc8fb2a0bad147af9e4096d9f8206
  Author: David Hampton <mythtv at love2code.net>
  Date:   2022-07-10 (Sun, 10 Jul 2022)

  Changed paths:
    M mythtv/libs/libmythtv/captions/textsubtitleparser.cpp

  Log Message:
  -----------
  cppcheck: Remove uninitialized variable.


  Commit: 202280e5a95965b43e4e1ce96820fbb1d9fb4e93
      https://github.com/MythTV/mythtv/commit/202280e5a95965b43e4e1ce96820fbb1d9fb4e93
  Author: David Hampton <mythtv at love2code.net>
  Date:   2022-07-12 (Tue, 12 Jul 2022)

  Changed paths:
    M mythtv/libs/libmythtv/mpeg/atsctables.h
    M mythtv/libs/libmythtv/mpeg/dvbtables.h
    M mythtv/libs/libmythtv/mpeg/mpegtables.h
    M mythtv/libs/libmythtv/mpeg/tspacket.h

  Log Message:
  -----------
  cppcheck: Fix "non-boolean returned from bool function" warnings.

I compared the before/after versions of one of these functions. Both
versions compile to exactly the same set if assembly instructions.
This is true when compiling with the optimizer, and when compiling
without the optimizer.


  Commit: 391d215cbcb9115ce5af9a366d1df7793d1503ae
      https://github.com/MythTV/mythtv/commit/391d215cbcb9115ce5af9a366d1df7793d1503ae
  Author: David Hampton <mythtv at love2code.net>
  Date:   2022-07-12 (Tue, 12 Jul 2022)

  Changed paths:
    M mythtv/libs/libmythtv/audioplayer.cpp

  Log Message:
  -----------
  cppcheck: Fix "condition always true" warning in audioplayer.

If m_noAudioOut is true, the function exits immediately. Therefore in
the very next line of code m_noAudioOut must be false and
!m_noAudioOut must be true.

The first if clause in AudioPlayer::AddAudioData test if m_noAudioOut it true, and if so returns.


  Commit: d05356018aeab753b610c186706ea752eabc6f47
      https://github.com/MythTV/mythtv/commit/d05356018aeab753b610c186706ea752eabc6f47
  Author: David Hampton <mythtv at love2code.net>
  Date:   2022-07-12 (Tue, 12 Jul 2022)

  Changed paths:
    M mythtv/libs/libmythtv/mpeg/dvbdescriptors.h

  Log Message:
  -----------
  cppcheck: Fix "int returned as long" warning.

    warning: int result is returned as long value. If the return value
    is long to avoid loss of information, then you have loss of
    information. [truncLongCastReturn]

This function returns "unsigned long long" which cppcheck appears to
be misinterpreting.  Change the return type to uint64_t to eliminate
the warning.


Compare: https://github.com/MythTV/mythtv/compare/14e077974113...d05356018aea


More information about the mythtv-commits mailing list