Commit c0cdab15 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove no longer used net_Read() argument

parent 9b629ed2
...@@ -143,8 +143,8 @@ struct virtual_socket_t ...@@ -143,8 +143,8 @@ struct virtual_socket_t
int (*pf_send) ( void *, const void *, size_t ); int (*pf_send) ( void *, const void *, size_t );
}; };
VLC_API ssize_t net_Read( vlc_object_t *p_this, int fd, const v_socket_t *, void *p_data, size_t i_data, bool b_retry ); VLC_API ssize_t net_Read( vlc_object_t *p_this, int fd, void *p_data, size_t i_data, bool b_retry );
#define net_Read(a,b,c,d,e,f) net_Read(VLC_OBJECT(a),b,c,d,e,f) #define net_Read(a,b,c,d,e) net_Read(VLC_OBJECT(a),b,c,d,e)
VLC_API ssize_t net_Write( vlc_object_t *p_this, int fd, const v_socket_t *, const void *p_data, size_t i_data ); VLC_API ssize_t net_Write( vlc_object_t *p_this, int fd, const v_socket_t *, const void *p_data, size_t i_data );
#define net_Write(a,b,c,d,e) net_Write(VLC_OBJECT(a),b,c,d,e) #define net_Write(a,b,c,d,e) net_Write(VLC_OBJECT(a),b,c,d,e)
VLC_API char * net_Gets( vlc_object_t *p_this, int fd ); VLC_API char * net_Gets( vlc_object_t *p_this, int fd );
......
...@@ -260,8 +260,7 @@ static block_t *BlockRead(access_t *p_access) ...@@ -260,8 +260,7 @@ static block_t *BlockRead(access_t *p_access)
/* Read data */ /* Read data */
p_block = block_Alloc(MTU); p_block = block_Alloc(MTU);
len = net_Read(p_access, p_sys->eyetvSock, NULL, len = net_Read(p_access, p_sys->eyetvSock, p_block->p_buffer, MTU, false);
p_block->p_buffer, MTU, false);
if (len < 0) { if (len < 0) {
block_Release(p_block); block_Release(p_block);
......
...@@ -342,7 +342,7 @@ static ssize_t StreamRead (access_t *p_access, uint8_t *p_buffer, size_t i_len) ...@@ -342,7 +342,7 @@ static ssize_t StreamRead (access_t *p_access, uint8_t *p_buffer, size_t i_len)
int fd = p_sys->fd; int fd = p_sys->fd;
#if !defined (_WIN32) && !defined (__OS2__) #if !defined (_WIN32) && !defined (__OS2__)
ssize_t val = net_Read (p_access, fd, NULL, p_buffer, i_len, false); ssize_t val = net_Read (p_access, fd, p_buffer, i_len, false);
#else #else
ssize_t val = read (fd, p_buffer, i_len); ssize_t val = read (fd, p_buffer, i_len);
#endif #endif
......
...@@ -827,7 +827,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) ...@@ -827,7 +827,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
if( p_sys->data.p_tls != NULL ) if( p_sys->data.p_tls != NULL )
i_read = vlc_tls_Read( p_sys->data.p_tls, p_buffer, i_len, false ); i_read = vlc_tls_Read( p_sys->data.p_tls, p_buffer, i_len, false );
else else
i_read = net_Read( p_access, p_sys->data.fd, NULL, p_buffer, i_len, false ); i_read = net_Read( p_access, p_sys->data.fd, p_buffer, i_len, false );
if( i_read == 0 ) if( i_read == 0 )
p_access->info.b_eof = true; p_access->info.b_eof = true;
else if( i_read > 0 ) else if( i_read > 0 )
......
...@@ -672,7 +672,7 @@ static int ReadData( access_t *p_access, int *pi_read, ...@@ -672,7 +672,7 @@ static int ReadData( access_t *p_access, int *pi_read,
if( p_sys->p_tls != NULL ) if( p_sys->p_tls != NULL )
*pi_read = vlc_tls_Read( p_sys->p_tls, p_buffer, i_len, false ); *pi_read = vlc_tls_Read( p_sys->p_tls, p_buffer, i_len, false );
else else
*pi_read = net_Read( p_access, p_sys->fd, NULL, p_buffer, i_len, false ); *pi_read = net_Read( p_access, p_sys->fd, p_buffer, i_len, false );
if( *pi_read <= 0 ) if( *pi_read <= 0 )
return VLC_SUCCESS; return VLC_SUCCESS;
......
...@@ -932,7 +932,7 @@ static int GetPacket( access_t * p_access, chunk_t *p_ck ) ...@@ -932,7 +932,7 @@ static int GetPacket( access_t * p_access, chunk_t *p_ck )
* (4 bytes), decode and then read up to 8 additional bytes to get the * (4 bytes), decode and then read up to 8 additional bytes to get the
* entire header. * entire header.
*/ */
if( net_Read( p_access, p_sys->fd, NULL, p_sys->buffer, 4, true ) < 4 ) if( net_Read( p_access, p_sys->fd, p_sys->buffer, 4, true ) < 4 )
{ {
msg_Err( p_access, "cannot read data 2" ); msg_Err( p_access, "cannot read data 2" );
return VLC_EGENERIC; return VLC_EGENERIC;
...@@ -945,7 +945,7 @@ static int GetPacket( access_t * p_access, chunk_t *p_ck ) ...@@ -945,7 +945,7 @@ static int GetPacket( access_t * p_access, chunk_t *p_ck )
if( restsize > 8 ) if( restsize > 8 )
restsize = 8; restsize = 8;
if( net_Read( p_access, p_sys->fd, NULL, p_sys->buffer + 4, restsize, true ) < restsize ) if( net_Read( p_access, p_sys->fd, p_sys->buffer + 4, restsize, true ) < restsize )
{ {
msg_Err( p_access, "cannot read data 3" ); msg_Err( p_access, "cannot read data 3" );
return VLC_EGENERIC; return VLC_EGENERIC;
...@@ -996,7 +996,7 @@ static int GetPacket( access_t * p_access, chunk_t *p_ck ) ...@@ -996,7 +996,7 @@ static int GetPacket( access_t * p_access, chunk_t *p_ck )
} }
if( (p_ck->i_data > 0) && if( (p_ck->i_data > 0) &&
(net_Read( p_access, p_sys->fd, NULL, &p_sys->buffer[12], (net_Read( p_access, p_sys->fd, &p_sys->buffer[12],
p_ck->i_data, true ) < p_ck->i_data) ) p_ck->i_data, true ) < p_ck->i_data) )
{ {
msg_Err( p_access, "cannot read data 4" ); msg_Err( p_access, "cannot read data 4" );
......
...@@ -106,7 +106,7 @@ static int RtspRead( void *p_userdata, uint8_t *p_buffer, int i_buffer ) ...@@ -106,7 +106,7 @@ static int RtspRead( void *p_userdata, uint8_t *p_buffer, int i_buffer )
access_t *p_access = (access_t *)p_userdata; access_t *p_access = (access_t *)p_userdata;
access_sys_t *p_sys = p_access->p_sys; access_sys_t *p_sys = p_access->p_sys;
return net_Read( p_access, p_sys->fd, 0, p_buffer, i_buffer, true ); return net_Read( p_access, p_sys->fd, p_buffer, i_buffer, true );
} }
static int RtspReadLine( void *p_userdata, uint8_t *p_buffer, int i_buffer ) static int RtspReadLine( void *p_userdata, uint8_t *p_buffer, int i_buffer )
......
...@@ -138,8 +138,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) ...@@ -138,8 +138,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
if( p_access->info.b_eof ) if( p_access->info.b_eof )
return 0; return 0;
i_read = net_Read( p_access, p_sys->fd, NULL, p_buffer, i_len, i_read = net_Read( p_access, p_sys->fd, p_buffer, i_len, false );
false );
if( i_read == 0 ) if( i_read == 0 )
p_access->info.b_eof = true; p_access->info.b_eof = true;
else if( i_read > 0 ) else if( i_read > 0 )
......
...@@ -268,7 +268,7 @@ static void* ThreadRead( void *data ) ...@@ -268,7 +268,7 @@ static void* ThreadRead( void *data )
block_cleanup_push(pkt); block_cleanup_push(pkt);
do do
len = net_Read(access, sys->fd, NULL, pkt->p_buffer, MTU, false); len = net_Read(access, sys->fd, pkt->p_buffer, MTU, false);
while (len == -1 && errno != EINTR); while (len == -1 && errno != EINTR);
vlc_cleanup_pop(); vlc_cleanup_pop();
......
...@@ -1877,7 +1877,7 @@ bool ReadCommand( intf_thread_t *p_intf, char *p_buffer, int *pi_size ) ...@@ -1877,7 +1877,7 @@ bool ReadCommand( intf_thread_t *p_intf, char *p_buffer, int *pi_size )
while( *pi_size < MAX_LINE_LENGTH && while( *pi_size < MAX_LINE_LENGTH &&
(i_read = net_Read( p_intf, p_intf->p_sys->i_socket == -1 ? (i_read = net_Read( p_intf, p_intf->p_sys->i_socket == -1 ?
0 /*STDIN_FILENO*/ : p_intf->p_sys->i_socket, NULL, 0 /*STDIN_FILENO*/ : p_intf->p_sys->i_socket,
(uint8_t *)p_buffer + *pi_size, 1, false ) ) > 0 ) (uint8_t *)p_buffer + *pi_size, 1, false ) ) > 0 )
{ {
if( p_buffer[ *pi_size ] == '\r' || p_buffer[ *pi_size ] == '\n' ) if( p_buffer[ *pi_size ] == '\r' || p_buffer[ *pi_size ] == '\n' )
......
...@@ -63,7 +63,7 @@ ssize_t Socket::read(vlc_object_t *stream, void *p_buffer, size_t len) ...@@ -63,7 +63,7 @@ ssize_t Socket::read(vlc_object_t *stream, void *p_buffer, size_t len)
ssize_t size; ssize_t size;
do do
{ {
size = net_Read(stream, netfd, NULL, p_buffer, len, true); size = net_Read(stream, netfd, p_buffer, len, true);
} while (size < 0 && (errno == EINTR || errno==EAGAIN) ); } while (size < 0 && (errno == EINTR || errno==EAGAIN) );
return size; return size;
} }
......
...@@ -216,7 +216,7 @@ static int Read (stream_t *stream, void *buf, unsigned int buflen) ...@@ -216,7 +216,7 @@ static int Read (stream_t *stream, void *buf, unsigned int buflen)
} }
assert ((buf != NULL) || (buflen == 0)); assert ((buf != NULL) || (buflen == 0));
ssize_t val = net_Read (stream, sys->read_fd, NULL, buf, buflen, false); ssize_t val = net_Read (stream, sys->read_fd, buf, buflen, false);
if (val > 0) if (val > 0)
{ {
sys->offset += val; sys->offset += val;
...@@ -254,7 +254,7 @@ static int Peek (stream_t *stream, const uint8_t **pbuf, unsigned int len) ...@@ -254,7 +254,7 @@ static int Peek (stream_t *stream, const uint8_t **pbuf, unsigned int len)
{ {
ssize_t val; ssize_t val;
val = net_Read (stream, sys->read_fd, NULL, val = net_Read (stream, sys->read_fd,
peeked->p_buffer + curlen, len - curlen, false); peeked->p_buffer + curlen, len - curlen, false);
if (val <= 0) if (val <= 0)
break; break;
......
...@@ -383,9 +383,7 @@ static bool read_exact( filter_t *p_filter, ...@@ -383,9 +383,7 @@ static bool read_exact( filter_t *p_filter,
char* p_readbuf, char* p_readbuf,
int i_bytes ) int i_bytes )
{ {
return i_bytes == net_Read( p_filter, i_socket, NULL, return i_bytes == net_Read( p_filter, i_socket, p_readbuf, i_bytes, true );
(unsigned char*)p_readbuf,
i_bytes, true );
} }
......
...@@ -258,7 +258,7 @@ int *net_Listen (vlc_object_t *p_this, const char *psz_host, ...@@ -258,7 +258,7 @@ int *net_Listen (vlc_object_t *p_this, const char *psz_host,
* object has been signaled. * object has been signaled.
*****************************************************************************/ *****************************************************************************/
ssize_t ssize_t
net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs, net_Read (vlc_object_t *restrict p_this, int fd,
void *restrict p_buf, size_t i_buflen, bool waitall) void *restrict p_buf, size_t i_buflen, bool waitall)
{ {
struct pollfd ufd[2]; struct pollfd ufd[2];
...@@ -274,30 +274,17 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs, ...@@ -274,30 +274,17 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
* before poll() starts an asynchronous transfer and returns 0. * before poll() starts an asynchronous transfer and returns 0.
* Always call poll() first. * Always call poll() first.
* *
* However if we have a virtual socket handler, try to read() first.
* See bug #8972 for details. * See bug #8972 for details.
*/ */
if (vs == NULL)
goto do_poll; goto do_poll;
#endif #endif
do do
{ {
ssize_t n;
if (vs != NULL)
{
int canc = vlc_savecancel ();
n = vs->pf_recv (vs->p_sys, p_buf, i_buflen);
vlc_restorecancel (canc);
}
else
{
#ifdef _WIN32 #ifdef _WIN32
n = recv (fd, p_buf, i_buflen, 0); ssize_t n = recv (fd, p_buf, i_buflen, 0);
#else #else
n = read (fd, p_buf, i_buflen); ssize_t n = read (fd, p_buf, i_buflen);
#endif #endif
}
if (n < 0) if (n < 0)
{ {
switch (net_errno) switch (net_errno)
...@@ -485,7 +472,7 @@ char *net_Gets(vlc_object_t *obj, int fd) ...@@ -485,7 +472,7 @@ char *net_Gets(vlc_object_t *obj, int fd)
bufsize += 1024; bufsize += 1024;
} }
ssize_t val = net_Read(obj, fd, NULL, buf + buflen, 1, false); ssize_t val = net_Read(obj, fd, buf + buflen, 1, false);
if (val < 1) if (val < 1)
goto error; goto error;
......
...@@ -363,7 +363,7 @@ static int SocksNegotiate( vlc_object_t *p_obj, ...@@ -363,7 +363,7 @@ static int SocksNegotiate( vlc_object_t *p_obj,
if( net_Write( p_obj, fd, NULL, buffer, i_len ) != i_len ) if( net_Write( p_obj, fd, NULL, buffer, i_len ) != i_len )
return VLC_EGENERIC; return VLC_EGENERIC;
if( net_Read( p_obj, fd, NULL, buffer, 2, true ) != 2 ) if( net_Read( p_obj, fd, buffer, 2, true ) != 2 )
return VLC_EGENERIC; return VLC_EGENERIC;
msg_Dbg( p_obj, "socks: v=%d method=%x", buffer[0], buffer[1] ); msg_Dbg( p_obj, "socks: v=%d method=%x", buffer[0], buffer[1] );
...@@ -390,7 +390,7 @@ static int SocksNegotiate( vlc_object_t *p_obj, ...@@ -390,7 +390,7 @@ static int SocksNegotiate( vlc_object_t *p_obj,
if( net_Write( p_obj, fd, NULL, buffer, i_len ) != i_len ) if( net_Write( p_obj, fd, NULL, buffer, i_len ) != i_len )
return VLC_EGENERIC; return VLC_EGENERIC;
if( net_Read( p_obj, fd, NULL, buffer, 2, true ) != 2 ) if( net_Read( p_obj, fd, buffer, 2, true ) != 2 )
return VLC_EGENERIC; return VLC_EGENERIC;
msg_Dbg( p_obj, "socks: v=%d status=%x", buffer[0], buffer[1] ); msg_Dbg( p_obj, "socks: v=%d status=%x", buffer[0], buffer[1] );
...@@ -462,7 +462,7 @@ static int SocksHandshakeTCP( vlc_object_t *p_obj, ...@@ -462,7 +462,7 @@ static int SocksHandshakeTCP( vlc_object_t *p_obj,
if( net_Write( p_obj, fd, NULL, buffer, 9 ) != 9 ) if( net_Write( p_obj, fd, NULL, buffer, 9 ) != 9 )
return VLC_EGENERIC; return VLC_EGENERIC;
if( net_Read( p_obj, fd, NULL, buffer, 8, true ) != 8 ) if( net_Read( p_obj, fd, buffer, 8, true ) != 8 )
return VLC_EGENERIC; return VLC_EGENERIC;
msg_Dbg( p_obj, "socks: v=%d cd=%d", msg_Dbg( p_obj, "socks: v=%d cd=%d",
...@@ -492,7 +492,7 @@ static int SocksHandshakeTCP( vlc_object_t *p_obj, ...@@ -492,7 +492,7 @@ static int SocksHandshakeTCP( vlc_object_t *p_obj,
return VLC_EGENERIC; return VLC_EGENERIC;
/* Read the header */ /* Read the header */
if( net_Read( p_obj, fd, NULL, buffer, 5, true ) != 5 ) if( net_Read( p_obj, fd, buffer, 5, true ) != 5 )
return VLC_EGENERIC; return VLC_EGENERIC;
msg_Dbg( p_obj, "socks: v=%d rep=%d atyp=%d", msg_Dbg( p_obj, "socks: v=%d rep=%d atyp=%d",
...@@ -514,7 +514,7 @@ static int SocksHandshakeTCP( vlc_object_t *p_obj, ...@@ -514,7 +514,7 @@ static int SocksHandshakeTCP( vlc_object_t *p_obj,
else else
return VLC_EGENERIC; return VLC_EGENERIC;
if( net_Read( p_obj, fd, NULL, buffer, i_len, true ) != i_len ) if( net_Read( p_obj, fd, buffer, i_len, true ) != i_len )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment