[vlc-devel] [PATCH] mms: rewrite recv with cast and vlc_recv_i11e

Alexandre Janniaux ajanni at videolabs.io
Fri Mar 27 14:53:36 CET 2020


Hi,

On Fri, Mar 27, 2020 at 03:39:57PM +0200, Rémi Denis-Courmont wrote:
> 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.
>

Like the other patch, I didn't invent the warning but
stumble upon by compiling on Windows:

https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recv

> > while using interruptible IO function.
>
> That won't work in this case. Read the surrounding code.
>

Indeed, I'll remove it from the patch then. Thanks for
notifying this.

Regards,
--
Alexandre Janniaux
Videolabs

> > ---
> >  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/
>
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list