aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil/inet_addr.h
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2017-10-26 08:51:55 +0100
committerJoão Valverde <j@v6e.pt>2017-10-26 14:39:00 +0000
commitac804b59e242c57e225c390eb8d6bec359a7003f (patch)
tree914f047f0e08d253c284380b6a4960cabd2e2c69 /wsutil/inet_addr.h
parent296a36698b9ff2ab1beb3c21dc8409c3a276001c (diff)
Improve our inet_ntop() wrapper
Also fix buffer length define, as it is not guaranteed to be 46 on Windows (it never was guaranteed anyway for the libc implementation, but the likelyhood of being greater was small). Change-Id: I2db705d86f825765ed32ec70b8d22058b5d629e8 Reviewed-on: https://code.wireshark.org/review/24074 Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'wsutil/inet_addr.h')
-rw-r--r--wsutil/inet_addr.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/wsutil/inet_addr.h b/wsutil/inet_addr.h
index 3fced32126..078acc7afa 100644
--- a/wsutil/inet_addr.h
+++ b/wsutil/inet_addr.h
@@ -23,21 +23,23 @@
#define __WS_INET_ADDR_H__
#include "ws_symbol_export.h"
+#include "ws_attributes.h"
#include <glib.h>
-
#include "inet_ipv6.h"
-#define WS_INET6_ADDRSTRLEN 46
+/* Choose a buffer size big enough for all implementations */
+#define WS_INET_ADDRSTRLEN 30
+#define WS_INET6_ADDRSTRLEN 80
-WS_DLL_PUBLIC const gchar *
+WS_DLL_PUBLIC WS_RETNONNULL const gchar *
ws_inet_ntop4(gconstpointer src, gchar *dst, guint dst_size);
WS_DLL_PUBLIC gboolean
ws_inet_pton4(const gchar *src, guint32 *dst);
-WS_DLL_PUBLIC const gchar *
+WS_DLL_PUBLIC WS_RETNONNULL const gchar *
ws_inet_ntop6(gconstpointer src, gchar *dst, guint dst_size);
WS_DLL_PUBLIC gboolean