[vlc-devel] [PATCH] mms: rewrite recv with cast and vlc_recv_i11e
Rémi Denis-Courmont
remi at remlab.net
Fri Mar 27 14:39:57 CET 2020
Le perjantaina 27. maaliskuuta 2020, 15.24.07 EET Alexandre Janniaux a écrit :
> It fixes warning on uint8_t* being used as char*,
No. It's perfectly fine to use unsigned char here. Aliasing is explicitly
permitted so the conversion is safe regardless of socket implementation
choice, and the spec of course says the pointer is to void.
> while using interruptible IO function.
That won't work in this case. Read the surrounding code.
> ---
> 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..9f1bffb803 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 = vlc_recv_i11e(
> + p_sys->i_handle_tcp,
> + (char *)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 = vlc_recv_i11e(
> + p_sys->i_handle_udp,
> + (char*)p_sys->buffer_udp + p_sys->i_buffer_udp,
> + i_udp + MMS_BUFFER_SIZE/2, 0 );
> }
>
> #ifdef MMS_DEBUG
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list