diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-12-14 06:52:09 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-12-14 06:52:09 +0000 |
commit | 423b152c0c288198826740e3cde29d43787d1ca8 (patch) | |
tree | c31f942a2a31d795f2d68c59096d1a67bad46ac3 /gtk/proto_draw.c | |
parent | 700c7569e0c1be3a6f13d97d933e7efb41c0c4e6 (diff) | |
download | wireshark-423b152c0c288198826740e3cde29d43787d1ca8.tar.gz wireshark-423b152c0c288198826740e3cde29d43787d1ca8.tar.bz2 wireshark-423b152c0c288198826740e3cde29d43787d1ca8.zip |
Do a better check of 'bend'. The code works w/o it, but only because
I got lucky when I introduced 'bend'. The behavior is the same, but
now it's due to planning, not luck.
svn path=/trunk/; revision=1324
Diffstat (limited to 'gtk/proto_draw.c')
-rw-r--r-- | gtk/proto_draw.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c index a2562f0851..1c88085c5d 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.8 1999/12/12 05:11:57 gram Exp $ + * $Id: proto_draw.c,v 1.9 1999/12/14 06:52:09 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -50,7 +50,6 @@ #define BYTE_VIEW_WIDTH 16 #define BYTE_VIEW_SEP 8 -extern GtkWidget *byte_view; extern GdkFont *m_r_font, *m_b_font; static void @@ -62,7 +61,7 @@ packet_hex_print(GtkText *bv, guint8 *pd, gint len, gint bstart, gint blen, gint i = 0, j, k, cur; gchar line[128], hexchars[] = "0123456789abcdef", c = '\0'; GdkFont *cur_font, *new_font; - gint bend = bstart + blen; + gint bend = -1; /* Freeze the text for faster display */ gtk_text_freeze(bv); @@ -71,6 +70,10 @@ packet_hex_print(GtkText *bv, guint8 *pd, gint len, gint bstart, gint blen, gtk_text_set_point(bv, 0); gtk_text_forward_delete(bv, gtk_text_get_length(bv)); + if (bstart >= 0 && blen >= 0) { + bend = bstart + blen; + } + while (i < len) { /* Print the line number */ sprintf(line, "%04x ", i); @@ -141,7 +144,8 @@ packet_hex_print(GtkText *bv, guint8 *pd, gint len, gint bstart, gint blen, /* scroll text into position */ gtk_text_thaw(bv); /* must thaw before adjusting scroll bars */ if ( bstart > 0 ) { - int lineheight,linenum,scrollval; + int lineheight, linenum; + float scrollval; linenum = bstart / BYTE_VIEW_WIDTH; /* need to change to some way of getting that offset instead of +4 */ |