[mythtv-commits] Ticket #13528: DVBChannel::ReturnMasterLock violates constness of variable
MythTV
noreply at mythtv.org
Wed Dec 4 11:32:54 UTC 2019
#13528: DVBChannel::ReturnMasterLock violates constness of variable
----------------------------------+-------------------------------
Reporter: David Hampton | Owner: Klaas de Waal
Type: Bug Report - General | Status: assigned
Priority: minor | Milestone: 31.0
Component: MythTV - DVB | Version: Master Head
Severity: low | Resolution:
Keywords: | Ticket locked: 0
----------------------------------+-------------------------------
Comment (by Klaas de Waal):
The implementations of GetMasterLock and ReturnMasterLock in
dvbchannel.cpp calls the functions with the same name in dtvchannel.cpp.
Both versions of ReturnMasterLock use the DVBChannel pointer returned by
DTVChannel::GetMasterLock.
This function returns a normal, i.e. not const, value.
So the constness is not a property of the object as declared but is added
later. In that case it is allowed to use the const_cast to remove the
constness.
Therefore the code is correct.
However, it is not elegant to have two implementations of GetMasterLock
and ReturnMasterLock which are identical except for cast.
The patch 20191204-masterlock.patch does remove a few const's and has only
a single implementation of GetMasterLock and ReturnMasterLock.
--
Ticket URL: <https://code.mythtv.org/trac/ticket/13528#comment:3>
MythTV <http://www.mythtv.org>
MythTV Media Center
More information about the mythtv-commits
mailing list