diff options
author | Gerald Combs <gerald@wireshark.org> | 2015-01-29 13:55:18 -0800 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2015-01-29 22:51:43 +0000 |
commit | 67b069e544da2078cf5c9ba0c95ca9af8ba00b03 (patch) | |
tree | dda3edf650e2a08f86825bbf3d537a7ab33051f2 /ui/qt/qt_ui_utils.h | |
parent | 2edf8bbd33e4820c19a52a435ddb2cc8e3e32fdb (diff) |
Qt: Add address conversion convenience routines
Add address_to_qstring and address_to_display_qstring, which wrap
address_to_string and address_to_display respectively and return
QStrings. Convert most of the instances in ui/qt to the new routines.
Fix a some memory leaks in the process.
Change-Id: Icda80bbfe0b2df723d54c8da84355255f819af89
Reviewed-on: https://code.wireshark.org/review/6848
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt/qt_ui_utils.h')
-rw-r--r-- | ui/qt/qt_ui_utils.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ui/qt/qt_ui_utils.h b/ui/qt/qt_ui_utils.h index 45bf73afa5..e114f7c2fd 100644 --- a/ui/qt/qt_ui_utils.h +++ b/ui/qt/qt_ui_utils.h @@ -25,6 +25,10 @@ // xxx - copied from ui/gtk/gui_utils.h +/** @file + * Utility functions for working with the Wireshark and GLib APIs. + */ + #include <stdio.h> #include "config.h" @@ -66,6 +70,8 @@ struct remote_host_t { gboolean nocap_local; }; +struct _address; + #ifdef __cplusplus } #endif /* __cplusplus */ @@ -87,6 +93,22 @@ gchar *qstring_strdup(QString q_string); */ QString gchar_free_to_qstring(gchar *glib_string); +/** Convert an address to a QString using address_to_str(). + * + * @param address A pointer to an address. + * + * @return A QString representation of the address. May be the null string (QString()) + */ +const QString address_to_qstring(const struct _address *address); + +/** Convert an address to a QString using address_to_display(). + * + * @param address A pointer to an address. + * + * @return A QString representation of the address. May be the null string (QString()) + */ +const QString address_to_display_qstring(const struct _address *address); + /** * Round the current size of a font up to its next "smooth" size. * If a smooth size can't be found the font is left unchanged. |