[vlc-devel] [PATCH 3/7] demux/adaptive: Downloader: prefer static_cast

Filip Roséen filip at atch.se
Thu May 18 12:02:15 CEST 2017


There is no need to use reinterpret_cast when the destination or
source type is pointer-to-void, static_cast is more accurate (and
safer).
---
 modules/demux/adaptive/http/Downloader.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/demux/adaptive/http/Downloader.cpp b/modules/demux/adaptive/http/Downloader.cpp
index 164ad743dc..8d0d20c765 100644
--- a/modules/demux/adaptive/http/Downloader.cpp
+++ b/modules/demux/adaptive/http/Downloader.cpp
@@ -40,7 +40,7 @@ bool Downloader::start()
 {
     if(!thread_handle_valid &&
        vlc_clone(&thread_handle, downloaderThread,
-                 reinterpret_cast<void *>(this), VLC_THREAD_PRIORITY_INPUT))
+                 static_cast<void *>(this), VLC_THREAD_PRIORITY_INPUT))
     {
         return false;
     }
@@ -74,7 +74,7 @@ void Downloader::cancel(HTTPChunkBufferedSource *source)
 
 void * Downloader::downloaderThread(void *opaque)
 {
-    Downloader *instance = reinterpret_cast<Downloader *>(opaque);
+    Downloader *instance = static_cast<Downloader *>(opaque);
     int canc = vlc_savecancel();
     instance->Run();
     vlc_restorecancel( canc );
-- 
2.12.2


More information about the vlc-devel mailing list