OSDN Git Service

Cast port to 16-bit integer
authorGabriel Majeri <gabriel.majeri6@gmail.com>
Sun, 24 Sep 2017 11:59:27 +0000 (14:59 +0300)
committerPeter Jones <pjones@redhat.com>
Mon, 25 Sep 2017 15:46:39 +0000 (11:46 -0400)
src/dp-message.c

index 6fe20b4..235bc7f 100644 (file)
@@ -35,7 +35,7 @@ format_ipv4_addr_helper(char *buf, size_t size, const char *dp_type,
        format(buf, size, off, dp_type, "%hhu.%hhu.%hhu.%hhu",
               ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3]);
        if (port > 0)
-               format(buf, size, off, dp_type, ":%hu", port);
+               format(buf, size, off, dp_type, ":%hu", (uint16_t)port);
        return off;
 }
 
@@ -102,7 +102,7 @@ format_ipv6_addr_helper(char *buf, size_t size, const char *dp_type,
 
        format(buf, size, off, "dp_type", "]");
        if (port >= 0)
-               format(buf, size, off, "Ipv6", ":%hu", port);
+               format(buf, size, off, "Ipv6", ":%hu", (uint16_t)port);
 
        return off;
 }