aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2008-10-27 14:17:04 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2008-10-27 14:17:04 +0000
commit164b61e7b034bfafa012b86d1276050e49b5c1fc (patch)
tree9b9f882577d8c00470a794aca5805c07cb787ef1 /gtk
parentf6fa7e23a913e76cc38e5a4bbc76626f05e07f47 (diff)
Sort hostlist columns correct.
Temporary fix for adding GeoIPCity names with norwegian characters, so we do not crash in gtk_clist_insert(). svn path=/trunk/; revision=26576
Diffstat (limited to 'gtk')
-rw-r--r--gtk/hostlist_table.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gtk/hostlist_table.c b/gtk/hostlist_table.c
index 45034f7e16..7ea836e248 100644
--- a/gtk/hostlist_table.c
+++ b/gtk/hostlist_table.c
@@ -38,6 +38,7 @@
#include <epan/to_str.h>
#include <epan/addr_resolv.h>
#include <epan/tap.h>
+#include <epan/strutil.h>
#ifdef HAVE_GEOIP
#include <epan/geoip.h>
#endif
@@ -252,7 +253,7 @@ hostlist_sort_column(GtkCList *clist, gconstpointer ptr1, gconstpointer ptr2)
text1 = GTK_CELL_TEXT (row1->cell[clist->sort_column])->text;
text2 = GTK_CELL_TEXT (row2->cell[clist->sort_column])->text;
- if (clist->sort_column < 2 || clist->sort_column > 7) { /* Integers */
+ if (clist->sort_column >= 2 || clist->sort_column <= 7) { /* Integers */
sscanf(text1, "%" G_GINT64_MODIFIER "u", &i1);
sscanf(text2, "%" G_GINT64_MODIFIER "u", &i2);
if (i1 > i2) {
@@ -1105,7 +1106,8 @@ add_hostlist_table_data(hostlist_table *hl, const address *addr, guint32 port, g
/* Filled in from the GeoIP config, if any */
for (i = 0; i < NUM_GEOIP_COLS; i++) {
if (i < geoip_num_dbs() && talker->address.type == AT_IPv4) {
- g_snprintf(geoip[i], 16, "%s", geoip_db_lookup_ipv4(i, *(guint32*)talker->address.data));
+ const guchar *name = geoip_db_lookup_ipv4(i, *(guint32*)talker->address.data);
+ g_snprintf(geoip[i], 16, "%s", format_text (name, strlen(name)));
entries[NUM_BUILTIN_COLS + i] = geoip[i];
gtk_clist_set_column_visibility(hl->table, NUM_BUILTIN_COLS + i, TRUE);
} else {