diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-09-16 10:41:11 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-09-16 17:42:03 +0000 |
commit | 770a8737d7dd0772078d4711fce186c6b3915b20 (patch) | |
tree | 3a3c4f18c8ff3d8064eac877ea7a771b6d3d2365 /wsutil/strtoi.h | |
parent | 1ca260bbb4126423acc2c6c8199ab2831fad995d (diff) | |
download | wireshark-770a8737d7dd0772078d4711fce186c6b3915b20.tar.gz |
Add ws_hexstrtou{bits} and use ws_hexstrtou32 in androiddump.
Make the reply length unsigned - there's no reason for it to be signed.
Change-Id: I5f4d1f027eeddee939547c052220efb89800f4b1
Reviewed-on: https://code.wireshark.org/review/17740
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wsutil/strtoi.h')
-rw-r--r-- | wsutil/strtoi.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/wsutil/strtoi.h b/wsutil/strtoi.h index 3361da8fc3..eb65fec218 100644 --- a/wsutil/strtoi.h +++ b/wsutil/strtoi.h @@ -30,7 +30,7 @@ #include "ws_symbol_export.h" /* - * \brief Convert a string to a signed/unsigned int, with error checks. + * \brief Convert a decimal string to a signed/unsigned int, with error checks. * \param str The string to convert * \param endptr A pointer that will store a pointer to the first invalid * character in str, allowing a number to be parsed even if there is trailing @@ -51,6 +51,24 @@ WS_DLL_PUBLIC gboolean ws_strtou32(const gchar* str, const gchar** endptr, guint WS_DLL_PUBLIC gboolean ws_strtou16(const gchar* str, const gchar** endptr, guint16* cint); WS_DLL_PUBLIC gboolean ws_strtou8 (const gchar* str, const gchar** endptr, guint8* cint); +/* + * \brief Convert a hexadecimal string to an unsigned int, with error checks. + * \param str The string to convert + * \param endptr A pointer that will store a pointer to the first invalid + * character in str, allowing a number to be parsed even if there is trailing + * whitespace. If NULL, then the string is assumed to contain only valid + * characters (or it will error out). + * \param cint The converted integer + * \return TRUE if the conversion succeeds, FALSE otherwise. + * On error, errno is set to EINVAL for unrecognized input and ERANGE + * if the resulting number does not fit in the type. + */ + +WS_DLL_PUBLIC gboolean ws_hexstrtou64(const gchar* str, const gchar** endptr, guint64* cint); +WS_DLL_PUBLIC gboolean ws_hexstrtou32(const gchar* str, const gchar** endptr, guint32* cint); +WS_DLL_PUBLIC gboolean ws_hexstrtou16(const gchar* str, const gchar** endptr, guint16* cint); +WS_DLL_PUBLIC gboolean ws_hexstrtou8 (const gchar* str, const gchar** endptr, guint8* cint); + #endif /* |