diff options
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/main.c | 6 | ||||
-rw-r--r-- | gtk/proto_draw.c | 22 | ||||
-rw-r--r-- | gtk/proto_draw.h | 4 |
3 files changed, 22 insertions, 10 deletions
diff --git a/gtk/main.c b/gtk/main.c index e44abb3052..8a66e81201 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1,6 +1,6 @@ /* main.c * - * $Id: main.c,v 1.41 1999/11/21 15:06:07 deniel Exp $ + * $Id: main.c,v 1.42 1999/11/22 06:24:54 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -729,8 +729,8 @@ tree_view_cb(GtkWidget *w, gpointer data) { gtk_text_forward_delete(GTK_TEXT(byte_view), gtk_text_get_length(GTK_TEXT(byte_view))); packet_hex_print(GTK_TEXT(byte_view), cf.pd, cf.current_frame->cap_len, - tree_selected_start, - tree_selected_len); + tree_selected_start, tree_selected_len, + cf.current_frame->encoding); gtk_text_thaw(GTK_TEXT(byte_view)); } diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c index 5b3aaeb2a9..072e959fd5 100644 --- a/gtk/proto_draw.c +++ b/gtk/proto_draw.c @@ -1,7 +1,7 @@ /* gtkpacket.c * Routines for GTK+ packet display * - * $Id: proto_draw.c,v 1.5 1999/11/16 11:44:20 guy Exp $ + * $Id: proto_draw.c,v 1.6 1999/11/22 06:24:55 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -43,6 +43,7 @@ #include <stdio.h> #include "main.h" #include "packet.h" +#include "util.h" #include "proto_draw.h" @@ -56,11 +57,12 @@ static void proto_tree_draw_node(GNode *node, gpointer data); void -packet_hex_print(GtkText *bv, guint8 *pd, gint len, gint bstart, gint blen) { +packet_hex_print(GtkText *bv, guint8 *pd, gint len, gint bstart, gint blen, + char_enc encoding) { gint i = 0, j, k, cur; - gchar line[128], hexchars[] = "0123456789abcdef"; + gchar line[128], hexchars[] = "0123456789abcdef", c = '\0'; GdkFont *cur_font, *new_font; - + while (i < len) { /* Print the line number */ sprintf(line, "%04x ", i); @@ -92,13 +94,23 @@ packet_hex_print(GtkText *bv, guint8 *pd, gint len, gint bstart, gint blen) { } line[cur++] = ' '; gtk_text_insert(bv, cur_font, NULL, NULL, line, cur); + cur = 0; i = j; /* Print the ASCII bit */ cur_font = (i >= bstart && i < (bstart + blen)) ? m_b_font : m_r_font; while (i < k) { if (i < len) { - line[cur++] = (isgraph(pd[i])) ? pd[i] : '.'; + if (encoding == CHAR_ASCII) { + c = pd[i]; + } + else if (encoding == CHAR_EBCDIC) { + c = EBCDIC_to_ASCII1(pd[i]); + } + else { + g_assert_not_reached(); + } + line[cur++] = (isgraph(c)) ? c : '.'; } else { line[cur++] = ' '; } diff --git a/gtk/proto_draw.h b/gtk/proto_draw.h index 3527f510d4..2ffeef7329 100644 --- a/gtk/proto_draw.h +++ b/gtk/proto_draw.h @@ -1,7 +1,7 @@ /* gtkpacket.h * Definitions for GTK+ packet display structures and routines * - * $Id: proto_draw.h,v 1.3 1999/11/15 22:52:03 gram Exp $ + * $Id: proto_draw.h,v 1.4 1999/11/22 06:24:56 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -27,7 +27,7 @@ #ifndef __GTKPACKET_H__ #define __GTKPACKET_H__ -void packet_hex_print(GtkText *, guint8 *, gint, gint, gint); +void packet_hex_print(GtkText *, guint8 *, gint, gint, gint, char_enc); #define E_TREEINFO_FIELD_INFO_KEY "tree_info_finfo" |