diff options
author | Jeff Morriss <jeff.morriss.ws@gmail.com> | 2014-09-03 21:57:02 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-09-04 12:46:06 +0000 |
commit | 2497482e34a108275f75cd8106e1841b35aab98e (patch) | |
tree | 6b8eead0f93e00b79809c09f467d0a3f554eeb6e /wsutil | |
parent | 1192606e885fbd3e580872c56143fcb12ae65815 (diff) | |
download | wireshark-2497482e34a108275f75cd8106e1841b35aab98e.tar.gz wireshark-2497482e34a108275f75cd8106e1841b35aab98e.tar.bz2 wireshark-2497482e34a108275f75cd8106e1841b35aab98e.zip |
Don't print non-printable characters in AX.25 addresses.
Add a new routine to wsutil to make this easy: printable_char_or_period().
Bug: 10439
Change-Id: I0eb2bb6bc0676a1035c3d845b5e20276fa04de60
Reviewed-on: https://code.wireshark.org/review/3981
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/str_util.c | 10 | ||||
-rw-r--r-- | wsutil/str_util.h | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/wsutil/str_util.c b/wsutil/str_util.c index c171edfa6e..83558c156d 100644 --- a/wsutil/str_util.c +++ b/wsutil/str_util.c @@ -123,7 +123,9 @@ isdigit_string(guchar *str) #endif /* Given a size, return its value in a human-readable format */ -gchar *format_size(gint64 size, format_size_flags_e flags) { +gchar * +format_size(gint64 size, format_size_flags_e flags) +{ GString *human_str = g_string_new(""); int power = 1000; int pfx_off = 0; @@ -178,3 +180,9 @@ gchar *format_size(gint64 size, format_size_flags_e flags) { g_string_free(human_str, FALSE); return g_strchomp(ret_val); } + +gchar +printable_char_or_period(gchar c) +{ + return g_ascii_isprint(c) ? c : '.'; +} diff --git a/wsutil/str_util.h b/wsutil/str_util.h index 971fa3542d..43a60dca9d 100644 --- a/wsutil/str_util.h +++ b/wsutil/str_util.h @@ -110,6 +110,8 @@ typedef enum { WS_DLL_PUBLIC gchar *format_size(gint64 size, format_size_flags_e flags); +WS_DLL_PUBLIC +gchar printable_char_or_period(gchar c); #ifdef __cplusplus } |