Ethereal-dev: Re: [ethereal-dev] Hex dump problem?

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Gilbert Ramirez <gram@xxxxxxxxxx>
Date: Thu, 27 Apr 2000 12:03:40 -0500
On Thu, Apr 27, 2000 at 11:42:46AM -0500, Dan Warburton wrote:
> 
> 
> I used ethereal to debug a smtp exchange we have here. It looks
> like the Hex dump in the bottom pane does not always display spaces
> correctly... here is the exchange from the follow tcp stream...

Good catch. We use the isgraph() function to test whether a
character has a printable representation, and isgraph() says that
blanks do not have a printable representation.

isspace() returns true on *all* whitespace, which besides the space
character, includes tabs and vertical tabs.

So, I decided just to check for the ' ' character as well as
the return value of isgraph().  Attached is a diff to gtk/proto_draw.c

I'll be checking the change in.

Thanks!

--gilbert
Index: proto_draw.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/gtk/proto_draw.c,v
retrieving revision 1.15
diff -u -r1.15 proto_draw.c
--- proto_draw.c	2000/03/02 07:05:57	1.15
+++ proto_draw.c	2000/04/27 17:01:41
@@ -155,7 +155,7 @@
 	      else {
 		      g_assert_not_reached();
 	      }
-              line[cur++] = (isgraph(c)) ? c : '.';
+              line[cur++] = (isgraph(c) || c == ' ') ? c : '.';
       } else {
         line[cur++] = ' ';
       }