[vlc-devel] [PATCH v2] mms: fix conversion from uint8_t* on Windows

Alexandre Janniaux ajanni at videolabs.io
Fri Mar 27 16:12:25 CET 2020


It fixes warning on uint8_t* being used as char* in Windows API, as
Windows's `recv` takes a char* instead of a void*.

Like discussed on the mailing list, casting to char* would be incorrect
to pass blob of data in all platforms and most API other than Windows
require a void*, so casting here is a no-op on most platform and remove
the warning on Windows.
---
 modules/access/mms/mmstu.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/modules/access/mms/mmstu.c b/modules/access/mms/mmstu.c
index 4c0c5a62e6..1e2b6b5c0d 100644
--- a/modules/access/mms/mmstu.c
+++ b/modules/access/mms/mmstu.c
@@ -1123,17 +1123,18 @@ static int NetFillBuffer( stream_t *p_access )
 
     if( ( i_tcp > 0 ) && ufd[0].revents )
     {
-        i_tcp_read =
-            recv( p_sys->i_handle_tcp,
-                  p_sys->buffer_tcp + p_sys->i_buffer_tcp,
-                  i_tcp + MMS_BUFFER_SIZE/2, 0 );
+        i_tcp_read = recv(
+                p_sys->i_handle_tcp,
+                (void*)(p_sys->buffer_tcp + p_sys->i_buffer_tcp),
+                i_tcp + MMS_BUFFER_SIZE/2, 0 );
     }
 
     if( i_udp > 0 && ufd[i_tcp > 0].revents )
     {
-        i_udp_read = recv( p_sys->i_handle_udp,
-                           p_sys->buffer_udp + p_sys->i_buffer_udp,
-                           i_udp + MMS_BUFFER_SIZE/2, 0 );
+        i_udp_read = recv(
+                p_sys->i_handle_udp,
+                (void*)(p_sys->buffer_udp + p_sys->i_buffer_udp),
+                i_udp + MMS_BUFFER_SIZE/2, 0 );
     }
 
 #ifdef MMS_DEBUG
-- 
2.26.0



More information about the vlc-devel mailing list