Message ID | SG2PR0201MB093384EB240E0258B708E6C5A5EA0@SG2PR0201MB0933.apcprd02.prod.outlook.com |
---|---|
State | Superseded |
Headers | show |
L'octidi 8 fructidor, an CCXXIV, liu jc a écrit : > Signed-off-by: liujingchao <jcliu@outlook.com> > --- > libavformat/tcp.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > mode change 100644 => 100755 libavformat/tcp.c > > diff --git a/libavformat/tcp.c b/libavformat/tcp.c > old mode 100644 > new mode 100755 > index c105479..61b68ca > --- a/libavformat/tcp.c > +++ b/libavformat/tcp.c > @@ -122,6 +122,16 @@ static int tcp_open(URLContext *h, const char *uri, int flags) > cur_ai = ai; > > restart: > + > + if (cur_ai->ai_family == AF_INET6) > + { > + struct sockaddr_in6 * sockaddr_v6 = (struct sockaddr_in6 *)cur_ai->ai_addr; > + if (sockaddr_v6->sin6_port == 0) > + { > + sockaddr_v6->sin6_port = htons(port); > + } > + } As already pointed out: Please respect the surrounding coding style. From my point of view, this is dead code that can be removed. A comment is needed to avoid that. Obvious breaks from the coding style: braces placement, braces on trivial statements, comparison to 0, pointer mark placement. > + > fd = ff_socket(cur_ai->ai_family, > cur_ai->ai_socktype, > cur_ai->ai_protocol);
diff --git a/libavformat/tcp.c b/libavformat/tcp.c old mode 100644 new mode 100755 index c105479..61b68ca --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -122,6 +122,16 @@ static int tcp_open(URLContext *h, const char *uri, int flags) cur_ai = ai; restart: + + if (cur_ai->ai_family == AF_INET6) + { + struct sockaddr_in6 * sockaddr_v6 = (struct sockaddr_in6 *)cur_ai->ai_addr; + if (sockaddr_v6->sin6_port == 0) + { + sockaddr_v6->sin6_port = htons(port); + } + } + fd = ff_socket(cur_ai->ai_family, cur_ai->ai_socktype, cur_ai->ai_protocol);
Signed-off-by: liujingchao <jcliu@outlook.com> --- libavformat/tcp.c | 10 ++++++++++ 1 file changed, 10 insertions(+) mode change 100644 => 100755 libavformat/tcp.c