gallium/util: use util_snprintf() in u_socket_connect()
authorBrian Paul <brianp@vmware.com>
Mon, 23 Oct 2017 21:25:24 +0000 (15:25 -0600)
committerBrian Paul <brianp@vmware.com>
Tue, 24 Oct 2017 14:17:15 +0000 (08:17 -0600)
Instead of plain snprintf().  To fix the MSVC build.

snprintf() is used in various places in Mesa/gallium, but apparently,
not in code built with MSVC.

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
src/gallium/auxiliary/util/u_network.c

index a7a4d28abcd976cf6622e3b1d6e9fe7f0299fcfc..203205dc62150ebd216099c6c5d5f4761554dd32 100644 (file)
@@ -2,6 +2,7 @@
 #include "pipe/p_compiler.h"
 #include "util/u_network.h"
 #include "util/u_debug.h"
+#include "util/u_string.h"
 
 #include <stdio.h>
 #if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
@@ -120,7 +121,7 @@ u_socket_connect(const char *hostname, uint16_t port)
    hints.ai_family = AF_UNSPEC; // AF_INET or AF_INET6 to force version
    hints.ai_socktype = SOCK_STREAM;
 
-   snprintf(portString, sizeof(portString), "%d", port);
+   util_snprintf(portString, sizeof(portString), "%d", port);
 
    r = getaddrinfo(hostname, portString, NULL, &addr);
    if (r != 0) {