Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Converts C style casts to C++ style casts and eliminates other unnece…

…ssary casts.

C++ style casts tell you more about why a cast is being done. The argument against them 5+ years ago was that we wanted to support gcc 2.xx.. These days all platforms likely to run MythTV have been running gcc 3.xx for ages.
  • Loading branch information...
commit 7409d3070f3a2113ac7a6207a78152c81ff7348c 1 parent 391c507
@daniel-kristjansson daniel-kristjansson authored
View
17 mythtv/libs/libmythtv/avformatdecoder.cpp
@@ -828,9 +828,11 @@ void AvFormatDecoder::InitByteContext(void)
ic->pb->is_streamed = streamed;
}
-extern "C" void HandleStreamChange(void* data)
+extern "C" void HandleStreamChange(void *data)
{
- AvFormatDecoder* decoder = (AvFormatDecoder*) data;
+ AvFormatDecoder *decoder =
+ reinterpret_cast<AvFormatDecoder*>(data);
+
int cnt = decoder->ic->nb_streams;
LOG(VB_PLAYBACK, LOG_INFO, LOC +
@@ -842,9 +844,11 @@ extern "C" void HandleStreamChange(void* data)
decoder->ScanStreams(false);
}
-extern "C" void HandleDVDStreamChange(void* data)
+extern "C" void HandleDVDStreamChange(void *data)
{
- AvFormatDecoder* decoder = (AvFormatDecoder*) data;
+ AvFormatDecoder *decoder =
+ reinterpret_cast<AvFormatDecoder*>(data);
+
int cnt = decoder->ic->nb_streams;
LOG(VB_PLAYBACK, LOG_INFO, LOC +
@@ -856,9 +860,10 @@ extern "C" void HandleDVDStreamChange(void* data)
decoder->ScanStreams(true);
}
-extern "C" void HandleBDStreamChange(void* data)
+extern "C" void HandleBDStreamChange(void *data)
{
- AvFormatDecoder* decoder = (AvFormatDecoder*) data;
+ AvFormatDecoder *decoder =
+ reinterpret_cast<AvFormatDecoder*>(data);
LOG(VB_PLAYBACK, LOG_INFO, LOC + "resetting");
View
3  mythtv/libs/libmythtv/darwinavcinfo.cpp
@@ -340,6 +340,7 @@ bool DarwinAVCInfo::GetDeviceNodes(int &local_node, int &remote_node)
static void dfd_device_change_msg(
void *dfd, io_service_t, natural_t messageType, void*)
{
- DarwinFirewireDevice *dev = (DarwinFirewireDevice*) dfd;
+ DarwinFirewireDevice *dev =
+ reinterpret_cast<DarwinFirewireDevice*>(dfd);
dev->HandleDeviceChange(messageType);
}
View
15 mythtv/libs/libmythtv/darwinfirewiredevice.cpp
@@ -890,10 +890,10 @@ void DarwinFirewireDevice::HandleDeviceChange(uint messageType)
// Various message callbacks.
-void *dfd_controller_thunk(void *param)
+void *dfd_controller_thunk(void *callback_data)
{
threadRegister("DarwinController");
- ((DarwinFirewireDevice*)param)->RunController();
+ reinterpret_cast<DarwinFirewireDevice*>(callback_data)->RunController();
threadDeregister();
return NULL;
}
@@ -906,7 +906,8 @@ void dfd_update_device_list_item(
int dfd_no_data_notification(void *callback_data)
{
- ((DarwinFirewireDevice*)callback_data)->ProcessNoDataMessage();
+ reinterpret_cast<DarwinFirewireDevice*>(callback_data)->
+ ProcessNoDataMessage();
return kIOReturnSuccess;
}
@@ -914,14 +915,16 @@ int dfd_no_data_notification(void *callback_data)
void dfd_stream_msg(long unsigned int msg, long unsigned int param1,
long unsigned int param2, void *callback_data)
{
- ((DarwinFirewireDevice*)callback_data)->
+ reinterpret_cast<DarwinFirewireDevice*>(callback_data)->
ProcessStreamingMessage(msg, param1, param2);
}
int dfd_tspacket_handler(uint tsPacketCount, uint32_t **ppBuf,
void *callback_data)
{
- DarwinFirewireDevice *fw = (DarwinFirewireDevice*) callback_data;
+ DarwinFirewireDevice *fw =
+ reinterpret_cast<DarwinFirewireDevice*>(callback_data);
+
if (!fw)
return kIOReturnBadArgument;
@@ -940,7 +943,7 @@ static IOReturn dfd_tspacket_handler_thunk(
static void dfd_update_device_list(void *dfd, io_iterator_t deviter)
{
- DarwinFirewireDevice *dev = (DarwinFirewireDevice*) dfd;
+ DarwinFirewireDevice *dev = reinterpret_cast<DarwinFirewireDevice*>(dfd);
io_object_t it = NULL;
while ((it = IOIteratorNext(deviter)))
View
4 mythtv/libs/libmythtv/linuxfirewiredevice.cpp
@@ -974,7 +974,9 @@ const LinuxAVCInfo *LinuxFirewireDevice::GetInfoPtr(void) const
int linux_firewire_device_tspacket_handler(
unsigned char *tspacket, int len, uint dropped, void *callback_data)
{
- LinuxFirewireDevice *fw = (LinuxFirewireDevice*) callback_data;
+ LinuxFirewireDevice *fw =
+ reinterpret_cast<LinuxFirewireDevice*>(callback_data);
+
if (!fw)
return 0;
View
2  mythtv/libs/libmythtv/mpeg/mpegstreamdata.cpp
@@ -1414,7 +1414,7 @@ void MPEGStreamData::ReturnCachedTable(const PSIPTable *psip) const
psip_refcnt_map_t::iterator it;
it = _cached_slated_for_deletion.find(psip);
if (it != _cached_slated_for_deletion.end())
- DeleteCachedTable((PSIPTable*)psip);
+ DeleteCachedTable(const_cast<PSIPTable*>(psip));
}
}
View
5 mythtv/libs/libmythtv/videoout_d3d.cpp
@@ -683,6 +683,11 @@ QStringList VideoOutputD3D::GetAllowedRenderers(
return list;
}
+MythPainter *VideoOutputD3D::GetOSDPainter(void)
+{
+ return m_osd_painter;
+}
+
bool VideoOutputD3D::ApproveDeintFilter(const QString& filtername) const
{
if (codec_is_std(video_codec_id))
View
2  mythtv/libs/libmythtv/videoout_d3d.h
@@ -53,7 +53,7 @@ class VideoOutputD3D : public VideoOutput
PIPLocation loc);
void RemovePIP(MythPlayer *pipplayer);
bool IsPIPSupported(void) const { return true; }
- virtual MythPainter *GetOSDPainter(void) { return (MythPainter*)m_osd_painter; }
+ virtual MythPainter *GetOSDPainter(void);
bool hasHWAcceleration(void) const { return !codec_is_std(video_codec_id); }
virtual bool ApproveDeintFilter(const QString& filtername) const;
virtual void* GetDecoderContext(unsigned char* buf, uint8_t*& id);
View
2  mythtv/libs/libmythtv/videoout_opengl.h
@@ -48,7 +48,7 @@ class VideoOutputOpenGL : public VideoOutput
virtual bool IsPIPSupported(void) const { return true; }
virtual bool hasFullScreenOSD(void) const { return true; }
virtual bool ApproveDeintFilter(const QString& filtername) const;
- virtual MythPainter *GetOSDPainter(void) { return (MythPainter*)gl_painter; }
+ virtual MythPainter *GetOSDPainter(void) { return gl_painter; }
virtual bool CanVisualise(AudioPlayer *audio, MythRender *render)
{ return VideoOutput::CanVisualise(audio, gl_context); }
View
2  mythtv/libs/libmythtv/videoout_quartz.cpp
@@ -935,7 +935,7 @@ OSStatus VoqvFloater_Callback(EventHandlerCallRef inHandlerCallRef,
void *inUserData)
{
(void)inHandlerCallRef;
- VoqvFloater *floater = (VoqvFloater *)inUserData;
+ VoqvFloater *floater = reinterpret_cast<VoqvFloater*>(inUserData);
WindowRef window;
Point mouseLoc;
Rect winLoc;
View
5 mythtv/libs/libmythtv/videoout_vdpau.cpp
@@ -1290,6 +1290,11 @@ void VideoOutputVDPAU::ParseOptions(void)
}
}
+MythPainter *VideoOutputVDPAU::GetOSDPainter(void)
+{
+ return m_osd_painter;
+}
+
bool VideoOutputVDPAU::GetScreenShot(int width, int height, QString filename)
{
if (m_render)
View
2  mythtv/libs/libmythtv/videoout_vdpau.h
@@ -60,7 +60,7 @@ class VideoOutputVDPAU : public VideoOutput
{ return codec_is_vdpau(video_codec_id); }
virtual bool hasHWAcceleration(void) const
{ return codec_is_vdpau(video_codec_id); }
- virtual MythPainter* GetOSDPainter(void) { return (MythPainter*)m_osd_painter; }
+ virtual MythPainter *GetOSDPainter(void);
virtual bool GetScreenShot(int width = 0, int height = 0,
QString filename = "");
Please sign in to comment.
Something went wrong with that request. Please try again.