summaryrefslogtreecommitdiff
path: root/libavformat/tcp.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2008-08-23 18:52:26 +0000
committerRonald S. Bultje <rsbultje@gmail.com>2008-08-23 18:52:26 +0000
commita3303add3c21f5993606cd7e9c0817f332cf97ab (patch)
tree4dd9e394a640bc0ee97da7fcf5fc67bc46fe06ee /libavformat/tcp.c
parent8b9af28da487aa01edb78b62a30fde0ac2540709 (diff)
Cosmetics after previous patches.
Originally committed as revision 14926 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/tcp.c')
-rw-r--r--libavformat/tcp.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 21a66a22b5..7672d25ca3 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -32,27 +32,23 @@ typedef struct TCPContext {
static int tcp_open(URLContext *h, const char *uri, int flags)
{
struct sockaddr_in dest_addr;
- char hostname[1024], *q;
int port, fd = -1;
TCPContext *s = NULL;
fd_set wfds;
int fd_max, ret;
struct timeval tv;
socklen_t optlen;
- char proto[1024],path[1024],tmp[1024];
+ char hostname[1024],proto[1024],path[1024],tmp[1024],*q;
if(!ff_network_init())
return AVERROR(EIO);
url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname),
- &port, path, sizeof(path), uri);
- if (strcmp(proto,"tcp"))
+ &port, path, sizeof(path), uri);
+ if (strcmp(proto,"tcp") || port <= 0 || port >= 65536)
return AVERROR(EINVAL);
if ((q = strchr(hostname,'@'))) { strcpy(tmp,q+1); strcpy(hostname,tmp); }
- if (port <= 0 || port >= 65536)
- return AVERROR(EINVAL);
-
dest_addr.sin_family = AF_INET;
dest_addr.sin_port = htons(port);
if (resolve_host(&dest_addr.sin_addr, hostname) < 0)