aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2021-11-10 16:13:17 +0000
committerJoão Valverde <j@v6e.pt>2021-11-10 16:13:17 +0000
commit6f1b814e2561cdcdd21447aef4f0fc6eefae9767 (patch)
tree774765f15cb95b017a222afb8628b7c8d5c38045 /wsutil
parent6ad14ac4fae754df5734f47e9bdbba2771d0e46f (diff)
Fix some narrowing compiler warnings
C:\Development\wireshark\wireshark\epan\ftypes\ftype-integer.c(448,47): warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data [C:\Development\wsbuild-msvc\epan\ftypes\ftypes.vcxproj] C:\Development\wireshark\wireshark\epan\ftypes\ftype-integer.c(448,47): warning C4267: guint32_to_str_buf(fv->value.uinteger, buf, size); [C:\Development\wsbuild-msvc\epan\ftypes\ftypes.vcxproj] C:\Development\wireshark\wireshark\epan\ftypes\ftype-integer.c(448,47): warning C4267: ^ [C:\Development\wsbuild-msvc\epan\ftypes\ftypes.vcxproj] C:\Development\wireshark\wireshark\epan\ftypes\ftype-integer.c(793,31): warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data [C:\Development\wsbuild-msvc\epan\ftypes\ftypes.vcxproj] C:\Development\wireshark\wireshark\epan\ftypes\ftype-integer.c(793,31): warning C4267: guint64_to_str_buf(val, buf, size); [C:\Development\wsbuild-msvc\epan\ftypes\ftypes.vcxproj] C:\Development\wireshark\wireshark\epan\ftypes\ftype-integer.c(793,31): warning C4267: ^ [C:\Development\wsbuild-msvc\epan\ftypes\ftypes.vcxproj] C:\Development\wireshark\wireshark\rawshark.c(1140,24): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data [C:\Development\wsbuild-msvc\rawshark.vcxproj] C:\Development\wireshark\wireshark\rawshark.c(1140,24): warning C4267: fs_len = strlen(fs_buf); [C:\Development\wsbuild-msvc\rawshark.vcxproj] C:\Development\wireshark\wireshark\rawshark.c(1140,24): warning C4267: ^ [C:\Development\wsbuild-msvc\rawshark.vcxproj]
Diffstat (limited to 'wsutil')
-rw-r--r--wsutil/to_str.c12
-rw-r--r--wsutil/to_str.h4
2 files changed, 8 insertions, 8 deletions
diff --git a/wsutil/to_str.c b/wsutil/to_str.c
index 3ed9614a41..ec6b01aa82 100644
--- a/wsutil/to_str.c
+++ b/wsutil/to_str.c
@@ -483,7 +483,7 @@ int64_to_str_back(char *ptr, gint64 value)
return ptr;
}
-static int
+static size_t
guint32_to_str_buf_len(const guint32 u)
{
/* ((2^32)-1) == 2147483647 */
@@ -501,9 +501,9 @@ guint32_to_str_buf_len(const guint32 u)
}
void
-guint32_to_str_buf(guint32 u, gchar *buf, int buf_len)
+guint32_to_str_buf(guint32 u, gchar *buf, size_t buf_len)
{
- int str_len = guint32_to_str_buf_len(u)+1;
+ size_t str_len = guint32_to_str_buf_len(u)+1;
gchar *bp = &buf[str_len];
@@ -514,7 +514,7 @@ guint32_to_str_buf(guint32 u, gchar *buf, int buf_len)
uint_to_str_back(bp, u);
}
-static int
+static size_t
guint64_to_str_buf_len(const guint64 u)
{
/* ((2^64)-1) == 18446744073709551615 */
@@ -543,9 +543,9 @@ guint64_to_str_buf_len(const guint64 u)
}
void
-guint64_to_str_buf(guint64 u, gchar *buf, int buf_len)
+guint64_to_str_buf(guint64 u, gchar *buf, size_t buf_len)
{
- int str_len = guint64_to_str_buf_len(u)+1;
+ size_t str_len = guint64_to_str_buf_len(u)+1;
gchar *bp = &buf[str_len];
diff --git a/wsutil/to_str.h b/wsutil/to_str.h
index ae3308c2b3..14e3ace1f4 100644
--- a/wsutil/to_str.h
+++ b/wsutil/to_str.h
@@ -280,9 +280,9 @@ WS_DLL_PUBLIC char *int_to_str_back(char *ptr, gint32 value);
*/
WS_DLL_PUBLIC char *int64_to_str_back(char *ptr, gint64 value);
-WS_DLL_PUBLIC void guint32_to_str_buf(guint32 u, gchar *buf, int buf_len);
+WS_DLL_PUBLIC void guint32_to_str_buf(guint32 u, gchar *buf, size_t buf_len);
-WS_DLL_PUBLIC void guint64_to_str_buf(guint64 u, gchar *buf, int buf_len);
+WS_DLL_PUBLIC void guint64_to_str_buf(guint64 u, gchar *buf, size_t buf_len);
WS_DLL_PUBLIC void ip_to_str_buf(const guint8 *ad, gchar *buf, const int buf_len);