[vlc-commits] network: print ports as unsigned

Steve Lhomme git at videolan.org
Wed Jul 11 15:35:23 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jul 11 15:24:42 2018 +0200| [164b529e0150c65efca60bc7934152cfd6ae2990] | committer: Steve Lhomme

network: print ports as unsigned

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=164b529e0150c65efca60bc7934152cfd6ae2990
---

 src/input/item.c              |  4 ++--
 src/misc/renderer_discovery.c |  2 +-
 src/network/io.c              |  4 ++--
 src/network/udp.c             | 20 ++++++++++----------
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/input/item.c b/src/input/item.c
index a54b581c05..f288d23c7d 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -371,7 +371,7 @@ void input_item_SetURI( input_item_t *p_i, const char *psz_uri )
         if( url.psz_protocol )
         {
             if( url.i_port > 0 )
-                r=asprintf( &p_i->psz_name, "%s://%s:%d%s", url.psz_protocol,
+                r=asprintf( &p_i->psz_name, "%s://%s:%u%s", url.psz_protocol,
                           url.psz_host, url.i_port,
                           url.psz_path ? url.psz_path : "" );
             else
@@ -382,7 +382,7 @@ void input_item_SetURI( input_item_t *p_i, const char *psz_uri )
         else
         {
             if( url.i_port > 0 )
-                r=asprintf( &p_i->psz_name, "%s:%d%s", url.psz_host, url.i_port,
+                r=asprintf( &p_i->psz_name, "%s:%u%s", url.psz_host, url.i_port,
                           url.psz_path ? url.psz_path : "" );
             else
                 r=asprintf( &p_i->psz_name, "%s%s", url.psz_host,
diff --git a/src/misc/renderer_discovery.c b/src/misc/renderer_discovery.c
index fef3d0dcbd..cc5d619d15 100644
--- a/src/misc/renderer_discovery.c
+++ b/src/misc/renderer_discovery.c
@@ -82,7 +82,7 @@ vlc_renderer_item_new(const char *psz_type, const char *psz_name,
     if (p_item->psz_name == NULL)
         goto error;
 
-    if (asprintf(&p_item->psz_sout, "%s{ip=%s,port=%d%s%s}",
+    if (asprintf(&p_item->psz_sout, "%s{ip=%s,port=%u%s%s}",
                  url.psz_protocol, url.psz_host, url.i_port,
                  psz_extra_sout != NULL ? "," : "",
                  psz_extra_sout != NULL ? psz_extra_sout : "") == -1)
diff --git a/src/network/io.c b/src/network/io.c
index 33fa12ba66..0e36efb6b1 100644
--- a/src/network/io.c
+++ b/src/network/io.c
@@ -112,13 +112,13 @@ int *net_Listen (vlc_object_t *p_this, const char *psz_host,
         .ai_flags = AI_PASSIVE | AI_NUMERICSERV | AI_IDN,
     }, *res;
 
-    msg_Dbg (p_this, "net: listening to %s port %d",
+    msg_Dbg (p_this, "net: listening to %s port %u",
              (psz_host != NULL) ? psz_host : "*", i_port);
 
     int i_val = vlc_getaddrinfo (psz_host, i_port, &hints, &res);
     if (i_val)
     {
-        msg_Err (p_this, "Cannot resolve %s port %d : %s",
+        msg_Err (p_this, "Cannot resolve %s port %u : %s",
                  (psz_host != NULL) ? psz_host : "", i_port,
                  gai_strerror (i_val));
         return NULL;
diff --git a/src/network/udp.c b/src/network/udp.c
index cd8c434037..5dce1f9e9b 100644
--- a/src/network/udp.c
+++ b/src/network/udp.c
@@ -151,13 +151,13 @@ static int net_ListenSingle (vlc_object_t *obj, const char *host, unsigned port,
     if (host && !*host)
         host = NULL;
 
-    msg_Dbg (obj, "net: opening %s datagram port %d",
+    msg_Dbg (obj, "net: opening %s datagram port %u",
              host ? host : "any", port);
 
     int val = vlc_getaddrinfo (host, port, &hints, &res);
     if (val)
     {
-        msg_Err (obj, "Cannot resolve %s port %d : %s", host, port,
+        msg_Err (obj, "Cannot resolve %s port %u : %s", host, port,
                  gai_strerror (val));
         return -1;
     }
@@ -527,12 +527,12 @@ int net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, unsigned i_por
     if( i_hlim < 0 )
         i_hlim = var_InheritInteger( p_this, "ttl" );
 
-    msg_Dbg( p_this, "net: connecting to [%s]:%d", psz_host, i_port );
+    msg_Dbg( p_this, "net: connecting to [%s]:%u", psz_host, i_port );
 
     int val = vlc_getaddrinfo (psz_host, i_port, &hints, &res);
     if (val)
     {
-        msg_Err (p_this, "cannot resolve [%s]:%d : %s", psz_host, i_port,
+        msg_Err (p_this, "cannot resolve [%s]:%u : %s", psz_host, i_port,
                  gai_strerror (val));
         return -1;
     }
@@ -574,7 +574,7 @@ int net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, unsigned i_por
 #endif
             b_unreach = true;
         else
-            msg_Warn( p_this, "%s port %d : %s", psz_host, i_port,
+            msg_Warn( p_this, "%s port %u : %s", psz_host, i_port,
                       vlc_strerror_c(errno) );
         net_Close( fd );
     }
@@ -584,7 +584,7 @@ int net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, unsigned i_por
     if( i_handle == -1 )
     {
         if( b_unreach )
-            msg_Err( p_this, "Host %s port %d is unreachable", psz_host,
+            msg_Err( p_this, "Host %s port %u is unreachable", psz_host,
                      i_port );
         return -1;
     }
@@ -604,7 +604,7 @@ int net_OpenDgram( vlc_object_t *obj, const char *psz_bind, unsigned i_bind,
     if ((psz_server == NULL) || (psz_server[0] == '\0'))
         return net_ListenSingle (obj, psz_bind, i_bind, protocol);
 
-    msg_Dbg (obj, "net: connecting to [%s]:%d from [%s]:%d",
+    msg_Dbg (obj, "net: connecting to [%s]:%u from [%s]:%u",
              psz_server, i_server, psz_bind, i_bind);
 
     struct addrinfo hints = {
@@ -616,7 +616,7 @@ int net_OpenDgram( vlc_object_t *obj, const char *psz_bind, unsigned i_bind,
     int val = vlc_getaddrinfo (psz_server, i_server, &hints, &rem);
     if (val)
     {
-        msg_Err (obj, "cannot resolve %s port %d : %s", psz_server, i_server,
+        msg_Err (obj, "cannot resolve %s port %u : %s", psz_server, i_server,
                  gai_strerror (val));
         return -1;
     }
@@ -625,7 +625,7 @@ int net_OpenDgram( vlc_object_t *obj, const char *psz_bind, unsigned i_bind,
     val = vlc_getaddrinfo (psz_bind, i_bind, &hints, &loc);
     if (val)
     {
-        msg_Err (obj, "cannot resolve %s port %d : %s", psz_bind, i_bind,
+        msg_Err (obj, "cannot resolve %s port %u : %s", psz_bind, i_bind,
                  gai_strerror (val));
         freeaddrinfo (rem);
         return -1;
@@ -656,7 +656,7 @@ int net_OpenDgram( vlc_object_t *obj, const char *psz_bind, unsigned i_bind,
                                      ptr->ai_addr, ptr->ai_addrlen)
               : connect (fd, ptr2->ai_addr, ptr2->ai_addrlen))
             {
-                msg_Err (obj, "cannot connect to %s port %d: %s",
+                msg_Err (obj, "cannot connect to %s port %u: %s",
                          psz_server, i_server, vlc_strerror_c(net_errno));
                 continue;
             }



More information about the vlc-commits mailing list