Check in isprint() hack for Win32 so that Ethereal is usably while

we figure out what the real bug is.

Fix set_last_open_dir() to use G_DIR_SEPARATOR and G_DIR_SEPARATOR_S
for cross-platform compatibility.

svn path=/trunk/; revision=3281
This commit is contained in:
Gilbert Ramirez 2001-04-10 12:07:40 +00:00
parent 61f7a8eb4b
commit 2a2b4bb6b4
4 changed files with 42 additions and 8 deletions

View File

@ -1,6 +1,6 @@
/* follow_dlg.c
*
* $Id: follow_dlg.c,v 1.12 2001/04/02 09:41:56 guy Exp $
* $Id: follow_dlg.c,v 1.13 2001/04/10 12:07:39 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -639,6 +639,24 @@ follow_add_to_gtk_text(char *buffer, int nchars, gboolean is_server,
GtkWidget *text = arg;
GdkColor fg, bg;
#ifdef _WIN32
/* While our isprint() hack is in place, we
* have to use convert some chars to '.' in order
* to be able to see the data we *should* see
* in the GtkText widget.
*/
int i;
for (i = 0; i < nchars; i++) {
if (buffer[i] == 0x0a || buffer[i] == 0x0d) {
continue;
}
else if (! isprint(buffer[i])) {
buffer[i] = '.';
}
}
#endif
if (is_server) {
color_t_to_gdkcolor(&fg, &prefs.st_server_fg);
color_t_to_gdkcolor(&bg, &prefs.st_server_bg);

View File

@ -1,7 +1,7 @@
/* gtkglobals.h
* GTK-related Global defines, etc.
*
* $Id: gtkglobals.h,v 1.13 2001/03/23 14:44:04 jfoster Exp $
* $Id: gtkglobals.h,v 1.14 2001/04/10 12:07:39 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -44,4 +44,18 @@ void remember_scrolled_window(GtkWidget *);
void set_plist_sel_browse(gboolean);
void set_plist_font(GdkFont *font);
#ifdef _WIN32
/* It appears that isprint() is not working well
* with gtk+'s text widget. By narrowing down what
* we print, the ascii portion of the hex display works.
* MSVCRT's isprint() returns true on values like 0xd2,
* which cause the GtkTextWidget to go wacko.
*
* This is a quick fix for the symptom, not the
* underlying problem.
*/
#define isprint(c) (c >= 0x20 && c <= 0x7f)
#endif
#endif

View File

@ -1,6 +1,6 @@
/* main.c
*
* $Id: main.c,v 1.190 2001/04/09 22:35:23 gram Exp $
* $Id: main.c,v 1.191 2001/04/10 12:07:39 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -1701,8 +1701,9 @@ set_last_open_dir(char *dirname)
if (dirname) {
len = strlen(dirname);
if (dirname[len-1] != '/') {
last_open_dir = g_strconcat(dirname, "/", NULL);
if (dirname[len-1] != G_DIR_SEPARATOR) {
last_open_dir = g_strconcat(dirname, G_DIR_SEPARATOR_S,
NULL);
}
}
else {

View File

@ -1,7 +1,7 @@
/* proto_draw.c
* Routines for GTK+ packet display
*
* $Id: proto_draw.c,v 1.32 2001/03/24 23:57:12 guy Exp $
* $Id: proto_draw.c,v 1.33 2001/04/10 12:07:40 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -55,6 +55,7 @@
#include "packet_win.h"
#include "gtkglobals.h"
#define BYTE_VIEW_WIDTH 16
#define BYTE_VIEW_SEP 8
@ -514,7 +515,7 @@ packet_hex_print_common(GtkText *bv, guint8 *pd, int len, int bstart, int bend,
else {
g_assert_not_reached();
}
line[cur++] = (isprint(c)) ? c : '.';
line[cur++] = isprint(c) ? c : '.';
} else {
line[cur++] = ' ';
}
@ -594,7 +595,7 @@ packet_hex_print_common(GtkText *bv, guint8 *pd, int len, int bstart, int bend,
else {
g_assert_not_reached();
}
line[cur++] = (isprint(c)) ? c : '.';
line[cur++] = isprint(c) ? c : '.';
} else {
line[cur++] = ' ';
}