diff --git a/epan/to_str-int.h b/epan/to_str-int.h index 6294613abc..d42d941ca7 100644 --- a/epan/to_str-int.h +++ b/epan/to_str-int.h @@ -81,7 +81,7 @@ char *qword_to_hex_punct(char *out, guint64 qword, char punct); * String is not NUL terminated by this routine. * There needs to be at least len * 3 - 1 bytes in the buffer. */ -char *bytes_to_hexstr_punct(char *out, const guint8 *ad, guint32 len, char punct); +char *bytes_to_hexstr_punct(char *out, const guint8 *ad, size_t len, char punct); /** * oct_to_str_back() diff --git a/epan/to_str.c b/epan/to_str.c index f3420c055e..ba63669beb 100644 --- a/epan/to_str.c +++ b/epan/to_str.c @@ -134,9 +134,9 @@ qword_to_hex_punct(char *out, guint64 qword, char punct) * There needs to be at least len * 2 bytes left in the buffer. */ char * -bytes_to_hexstr(char *out, const guint8 *ad, guint32 len) +bytes_to_hexstr(char *out, const guint8 *ad, size_t len) { - guint32 i; + size_t i; if (!ad) REPORT_DISSECTOR_BUG("Null pointer passed to bytes_to_hexstr()"); @@ -155,9 +155,9 @@ bytes_to_hexstr(char *out, const guint8 *ad, guint32 len) * There needs to be at least len * 3 - 1 bytes left in the buffer. */ char * -bytes_to_hexstr_punct(char *out, const guint8 *ad, guint32 len, char punct) +bytes_to_hexstr_punct(char *out, const guint8 *ad, size_t len, char punct) { - guint32 i; + size_t i; if (!ad) REPORT_DISSECTOR_BUG("Null pointer passed to bytes_to_hexstr_punct()"); @@ -181,10 +181,10 @@ bytes_to_hexstr_punct(char *out, const guint8 *ad, guint32 len, char punct) * the resulting string is (len-1) bytes shorter) */ gchar * -bytestring_to_str(wmem_allocator_t *scope, const guint8 *ad, const guint32 len, const char punct) +bytestring_to_str(wmem_allocator_t *scope, const guint8 *ad, size_t len, const char punct) { gchar *buf; - guint32 buflen = len; + size_t buflen = len; gchar *buf_ptr; int truncated = 0; @@ -215,7 +215,7 @@ bytestring_to_str(wmem_allocator_t *scope, const guint8 *ad, const guint32 len, } char * -bytes_to_str(wmem_allocator_t *scope, const guint8 *bd, int bd_len) +bytes_to_str(wmem_allocator_t *scope, const guint8 *bd, size_t bd_len) { gchar *cur; gchar *cur_ptr; @@ -225,7 +225,7 @@ bytes_to_str(wmem_allocator_t *scope, const guint8 *bd, int bd_len) REPORT_DISSECTOR_BUG("Null pointer passed to bytes_to_str()"); cur=(gchar *)wmem_alloc(scope, MAX_BYTE_STR_LEN+3+1); - if (bd_len <= 0) { cur[0] = '\0'; return cur; } + if (bd_len == 0) { cur[0] = '\0'; return cur; } if (bd_len > MAX_BYTE_STR_LEN/2) { /* bd_len > 24 */ truncated = 1; diff --git a/epan/to_str.h b/epan/to_str.h index 08e0203661..4798bcc8cf 100644 --- a/epan/to_str.h +++ b/epan/to_str.h @@ -175,7 +175,7 @@ WS_DLL_PUBLIC char *dword_to_hex(char *out, guint32 dword); * @param bd_len The length of the byte array * @return A pointer to the formatted string */ -WS_DLL_PUBLIC char *bytes_to_str(wmem_allocator_t *scope, const guint8 *bd, int bd_len); +WS_DLL_PUBLIC char *bytes_to_str(wmem_allocator_t *scope, const guint8 *bd, size_t bd_len); /** Turn an array of bytes into a string showing the bytes in hex, * separated by a punctuation character. @@ -188,7 +188,7 @@ WS_DLL_PUBLIC char *bytes_to_str(wmem_allocator_t *scope, const guint8 *bd, int * * @see bytes_to_str() */ -WS_DLL_PUBLIC gchar *bytestring_to_str(wmem_allocator_t *scope, const guint8 *ad, const guint32 len, const char punct); +WS_DLL_PUBLIC gchar *bytestring_to_str(wmem_allocator_t *scope, const guint8 *ad, size_t len, const char punct); /** * bytes_to_hexstr() @@ -199,7 +199,7 @@ WS_DLL_PUBLIC gchar *bytestring_to_str(wmem_allocator_t *scope, const guint8 *ad * String is not NUL terminated by this routine. * There needs to be at least len * 2 bytes in the buffer. */ -WS_DLL_PUBLIC char *bytes_to_hexstr(char *out, const guint8 *ad, guint32 len); +WS_DLL_PUBLIC char *bytes_to_hexstr(char *out, const guint8 *ad, size_t len); /** * uint_to_str_back()