epan: Change bytes_to_str() length argument to a size_t

This commit is contained in:
João Valverde 2021-06-20 18:34:38 +01:00 committed by Wireshark GitLab Utility
parent ab37610f08
commit 72ea33ae20
3 changed files with 12 additions and 12 deletions

View File

@ -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()

View File

@ -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;

View File

@ -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()