Browse Source

On failure, return directly because the fail: case does nothing. This also

allows easier control of the actual return value.

Originally committed as revision 14925 to svn://svn.ffmpeg.org/ffmpeg/trunk
tags/v0.5
Ronald S. Bultje 17 years ago
parent
commit
8b9af28da4
1 changed files with 5 additions and 4 deletions
  1. +5
    -4
      libavformat/tcp.c

+ 5
- 4
libavformat/tcp.c View File

@@ -46,20 +46,21 @@ static int tcp_open(URLContext *h, const char *uri, int flags)


url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname),
&port, path, sizeof(path), uri); &port, path, sizeof(path), uri);
if (strcmp(proto,"tcp")) goto fail;
if (strcmp(proto,"tcp"))
return AVERROR(EINVAL);
if ((q = strchr(hostname,'@'))) { strcpy(tmp,q+1); strcpy(hostname,tmp); } if ((q = strchr(hostname,'@'))) { strcpy(tmp,q+1); strcpy(hostname,tmp); }


if (port <= 0 || port >= 65536) if (port <= 0 || port >= 65536)
goto fail;
return AVERROR(EINVAL);


dest_addr.sin_family = AF_INET; dest_addr.sin_family = AF_INET;
dest_addr.sin_port = htons(port); dest_addr.sin_port = htons(port);
if (resolve_host(&dest_addr.sin_addr, hostname) < 0) if (resolve_host(&dest_addr.sin_addr, hostname) < 0)
goto fail;
return AVERROR(EIO);


fd = socket(AF_INET, SOCK_STREAM, 0); fd = socket(AF_INET, SOCK_STREAM, 0);
if (fd < 0) if (fd < 0)
goto fail;
return AVERROR(EIO);
ff_socket_nonblock(fd, 1); ff_socket_nonblock(fd, 1);


redo: redo:


Loading…
Cancel
Save