[vlc-commits] net_Read: remove no longer used waitall parameter
Rémi Denis-Courmont
git at videolan.org
Wed Jul 1 18:22:12 CEST 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jun 30 23:52:51 2015 +0300| [a3a6a95aad0a60127350d3ab403fc635f731a966] | committer: Rémi Denis-Courmont
net_Read: remove no longer used waitall parameter
It was always either true or unused. Note that when the buffer length
is 1 byte, waitall had no effects.
net_Read() and net_Write() are now symmetric.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a3a6a95aad0a60127350d3ab403fc635f731a966
---
include/vlc_network.h | 4 ++--
modules/access/mms/mmsh.c | 6 +++---
modules/access/rtsp/access.c | 2 +-
modules/control/oldrc.c | 3 +--
modules/demux/adaptative/http/Sockets.cpp | 2 +-
modules/video_filter/remoteosd.c | 2 +-
src/network/io.c | 15 ++++++---------
src/network/tcp.c | 10 +++++-----
8 files changed, 20 insertions(+), 24 deletions(-)
diff --git a/include/vlc_network.h b/include/vlc_network.h
index c66e2d1..f430df3 100644
--- a/include/vlc_network.h
+++ b/include/vlc_network.h
@@ -147,8 +147,8 @@ struct virtual_socket_t
int (*pf_send) ( void *, const void *, size_t );
};
-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) net_Read(VLC_OBJECT(a),b,c,d,e)
+VLC_API ssize_t net_Read( vlc_object_t *p_this, int fd, void *p_data, size_t i_data );
+#define net_Read(a,b,c,d) net_Read(VLC_OBJECT(a),b,c,d)
VLC_API ssize_t net_Write( vlc_object_t *p_this, int fd, const void *p_data, size_t i_data );
#define net_Write(a,b,c,d) net_Write(VLC_OBJECT(a),b,c,d)
VLC_API char * net_Gets( vlc_object_t *p_this, int fd );
diff --git a/modules/access/mms/mmsh.c b/modules/access/mms/mmsh.c
index 8db5a2a..662bbfb 100644
--- a/modules/access/mms/mmsh.c
+++ b/modules/access/mms/mmsh.c
@@ -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
* entire header.
*/
- if( net_Read( p_access, p_sys->fd, p_sys->buffer, 4, true ) < 4 )
+ if( net_Read( p_access, p_sys->fd, p_sys->buffer, 4 ) < 4 )
{
msg_Err( p_access, "cannot read data 2" );
return VLC_EGENERIC;
@@ -945,7 +945,7 @@ static int GetPacket( access_t * p_access, chunk_t *p_ck )
if( restsize > 8 )
restsize = 8;
- if( net_Read( p_access, p_sys->fd, p_sys->buffer + 4, restsize, true ) < restsize )
+ if( net_Read( p_access, p_sys->fd, p_sys->buffer + 4, restsize ) < restsize )
{
msg_Err( p_access, "cannot read data 3" );
return VLC_EGENERIC;
@@ -997,7 +997,7 @@ static int GetPacket( access_t * p_access, chunk_t *p_ck )
if( (p_ck->i_data > 0) &&
(net_Read( p_access, p_sys->fd, &p_sys->buffer[12],
- p_ck->i_data, true ) < p_ck->i_data) )
+ p_ck->i_data ) < p_ck->i_data) )
{
msg_Err( p_access, "cannot read data 4" );
return VLC_EGENERIC;
diff --git a/modules/access/rtsp/access.c b/modules/access/rtsp/access.c
index 25d75e3..3d6631f 100644
--- a/modules/access/rtsp/access.c
+++ b/modules/access/rtsp/access.c
@@ -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_sys_t *p_sys = p_access->p_sys;
- return net_Read( p_access, p_sys->fd, p_buffer, i_buffer, true );
+ return net_Read( p_access, p_sys->fd, p_buffer, i_buffer );
}
static int RtspReadLine( void *p_userdata, uint8_t *p_buffer, int i_buffer )
diff --git a/modules/control/oldrc.c b/modules/control/oldrc.c
index a3ccb5b..b0f62d1 100644
--- a/modules/control/oldrc.c
+++ b/modules/control/oldrc.c
@@ -1864,7 +1864,6 @@ bool ReadCommand( intf_thread_t *p_intf, char *p_buffer, int *pi_size )
}
#endif
-
while( *pi_size < MAX_LINE_LENGTH )
{
if( p_intf->p_sys->i_socket == -1 )
@@ -1880,7 +1879,7 @@ bool ReadCommand( intf_thread_t *p_intf, char *p_buffer, int *pi_size )
else
{ /* Connection closed */
if( net_Read( p_intf, p_intf->p_sys->i_socket, p_buffer + *pi_size,
- 1, false ) <= 0 )
+ 1 ) <= 0 )
{
net_Close( p_intf->p_sys->i_socket );
p_intf->p_sys->i_socket = -1;
diff --git a/modules/demux/adaptative/http/Sockets.cpp b/modules/demux/adaptative/http/Sockets.cpp
index 84cd147..648bd32 100644
--- a/modules/demux/adaptative/http/Sockets.cpp
+++ b/modules/demux/adaptative/http/Sockets.cpp
@@ -63,7 +63,7 @@ ssize_t Socket::read(vlc_object_t *stream, void *p_buffer, size_t len)
ssize_t size;
do
{
- size = net_Read(stream, netfd, p_buffer, len, true);
+ size = net_Read(stream, netfd, p_buffer, len);
} while (size < 0 && (errno == EINTR || errno==EAGAIN) );
return size;
}
diff --git a/modules/video_filter/remoteosd.c b/modules/video_filter/remoteosd.c
index f53bba1..47e60d6 100644
--- a/modules/video_filter/remoteosd.c
+++ b/modules/video_filter/remoteosd.c
@@ -383,7 +383,7 @@ static bool read_exact( filter_t *p_filter,
char* p_readbuf,
int i_bytes )
{
- return i_bytes == net_Read( p_filter, i_socket, p_readbuf, i_bytes, true );
+ return i_bytes == net_Read( p_filter, i_socket, p_readbuf, i_bytes );
}
diff --git a/src/network/io.c b/src/network/io.c
index 61a97cc..1d287cc 100644
--- a/src/network/io.c
+++ b/src/network/io.c
@@ -248,18 +248,15 @@ int *net_Listen (vlc_object_t *p_this, const char *psz_host,
return sockv;
}
-#undef net_Read
/*****************************************************************************
* net_Read:
*****************************************************************************
* Reads from a network socket. Cancellation point.
- * If waitall is true, then we repeat until we have read the right amount of
- * data; in that case, a short count means EOF has been reached or the VLC
- * object has been signaled.
+ * We repeat until we have read the right amount of data;
+ * a short count means EOF has been reached or an error.
*****************************************************************************/
-ssize_t
-net_Read (vlc_object_t *restrict p_this, int fd,
- void *restrict p_buf, size_t i_buflen, bool waitall)
+ssize_t (net_Read)(vlc_object_t *restrict p_this, int fd,
+ void *restrict p_buf, size_t i_buflen)
{
struct pollfd ufd[2];
@@ -304,7 +301,7 @@ net_Read (vlc_object_t *restrict p_this, int fd,
p_buf = (char *)p_buf + n;
i_buflen -= n;
- if (!waitall || i_buflen == 0)
+ if (i_buflen == 0)
break;
}
else /* n == 0 */
@@ -449,7 +446,7 @@ char *net_Gets(vlc_object_t *obj, int fd)
bufsize += 1024;
}
- ssize_t val = net_Read(obj, fd, buf + buflen, 1, false);
+ ssize_t val = net_Read(obj, fd, buf + buflen, 1);
if (val < 1)
goto error;
diff --git a/src/network/tcp.c b/src/network/tcp.c
index 8e201cf..743350a 100644
--- a/src/network/tcp.c
+++ b/src/network/tcp.c
@@ -347,7 +347,7 @@ static int SocksNegotiate( vlc_object_t *p_obj,
if( net_Write( p_obj, fd, buffer, i_len ) != i_len )
return VLC_EGENERIC;
- if( net_Read( p_obj, fd, buffer, 2, true ) != 2 )
+ if( net_Read( p_obj, fd, buffer, 2) != 2 )
return VLC_EGENERIC;
msg_Dbg( p_obj, "socks: v=%d method=%x", buffer[0], buffer[1] );
@@ -374,7 +374,7 @@ static int SocksNegotiate( vlc_object_t *p_obj,
if( net_Write( p_obj, fd, buffer, i_len ) != i_len )
return VLC_EGENERIC;
- if( net_Read( p_obj, fd, buffer, 2, true ) != 2 )
+ if( net_Read( p_obj, fd, buffer, 2 ) != 2 )
return VLC_EGENERIC;
msg_Dbg( p_obj, "socks: v=%d status=%x", buffer[0], buffer[1] );
@@ -446,7 +446,7 @@ static int SocksHandshakeTCP( vlc_object_t *p_obj,
if( net_Write( p_obj, fd, buffer, 9 ) != 9 )
return VLC_EGENERIC;
- if( net_Read( p_obj, fd, buffer, 8, true ) != 8 )
+ if( net_Read( p_obj, fd, buffer, 8 ) != 8 )
return VLC_EGENERIC;
msg_Dbg( p_obj, "socks: v=%d cd=%d",
@@ -476,7 +476,7 @@ static int SocksHandshakeTCP( vlc_object_t *p_obj,
return VLC_EGENERIC;
/* Read the header */
- if( net_Read( p_obj, fd, buffer, 5, true ) != 5 )
+ if( net_Read( p_obj, fd, buffer, 5 ) != 5 )
return VLC_EGENERIC;
msg_Dbg( p_obj, "socks: v=%d rep=%d atyp=%d",
@@ -498,7 +498,7 @@ static int SocksHandshakeTCP( vlc_object_t *p_obj,
else
return VLC_EGENERIC;
- if( net_Read( p_obj, fd, buffer, i_len, true ) != i_len )
+ if( net_Read( p_obj, fd, buffer, i_len ) != i_len )
return VLC_EGENERIC;
}
More information about the vlc-commits
mailing list