aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-12-24 01:21:32 +0000
committerGuy Harris <guy@alum.mit.edu>2003-12-24 01:21:32 +0000
commitf941ab7b7dbb3f00543670ace78ce64f3efac551 (patch)
treeb60488d45f21cf3277d071146ff092d07af0309f /gtk
parente6f433d88456da1d31eb192fb18b95c0f0097144 (diff)
Do the "isprint()" hack for GTK+ 2.x or 1.3[.x], whether on UNIX or
Windows - the problem is that GTK+ 1.3[.x] and later assume strings handed to them are UTF-8 strings, not, for example, ISO 8859/x strings. In packet-radius.c, re-define "isprint()" rather than #ifdeffing its use (the old code was also incorrectly treating 0x7f as a printable). svn path=/trunk/; revision=9436
Diffstat (limited to 'gtk')
-rw-r--r--gtk/follow_dlg.c17
-rw-r--r--gtk/gtkglobals.h14
2 files changed, 10 insertions, 21 deletions
diff --git a/gtk/follow_dlg.c b/gtk/follow_dlg.c
index cc41856193..5bb4d0ae86 100644
--- a/gtk/follow_dlg.c
+++ b/gtk/follow_dlg.c
@@ -1,6 +1,6 @@
/* follow_dlg.c
*
- * $Id: follow_dlg.c,v 1.32 2003/04/06 22:41:34 guy Exp $
+ * $Id: follow_dlg.c,v 1.33 2003/12/24 01:21:32 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -786,7 +786,7 @@ follow_add_to_gtk_text(char *buffer, int nchars, gboolean is_server,
gchar *convbuf;
#endif
-#ifdef _WIN32
+#if GTK_MAJOR_VERSION >= 2 || GTK_MINOR_VERSION >= 3
/* 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
@@ -795,18 +795,7 @@ follow_add_to_gtk_text(char *buffer, int nchars, gboolean is_server,
int i;
for (i = 0; i < nchars; i++) {
- if (buffer[i] == 0x0a || buffer[i] == 0x0d) {
- continue;
- }
- else if (! isprint(buffer[i])) {
- buffer[i] = '.';
- }
- }
-#elif GTK_MAJOR_VERSION >= 2
- int i;
-
- for (i = 0; i < nchars; i++) {
- if (buffer[i] == '\n')
+ if (buffer[i] == '\n' || buffer[i] == '\r')
continue;
if (! isprint(buffer[i])) {
buffer[i] = '.';
diff --git a/gtk/gtkglobals.h b/gtk/gtkglobals.h
index 8e083271b2..64d09ab105 100644
--- a/gtk/gtkglobals.h
+++ b/gtk/gtkglobals.h
@@ -1,7 +1,7 @@
/* gtkglobals.h
* GTK-related Global defines, etc.
*
- * $Id: gtkglobals.h,v 1.22 2003/08/01 01:39:01 guy Exp $
+ * $Id: gtkglobals.h,v 1.23 2003/12/24 01:21:32 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -40,14 +40,14 @@ void set_plist_font(PangoFontDescription *font);
#endif
void set_plist_sel_browse(gboolean);
-#ifdef _WIN32
+#if GTK_MAJOR_VERSION >= 2 || GTK_MINOR_VERSION >= 3
/*
* XXX - "isprint()" can return "true" for non-ASCII characters, but
- * those don't work with GTK+ on Windows, as GTK+ on Windows assumes
- * UTF-8 strings. Until we fix up Ethereal to properly handle
- * non-ASCII characters in all output (both GUI displays and text
- * printouts) on all platforms including Windows, we work around
- * the problem by escaping all characters that aren't printable ASCII.
+ * those don't work with GTK+ 1.3 or later, as they take UTF-8 strings
+ * as input. Until we fix up Ethereal to properly handle non-ASCII
+ * characters in all output (both GUI displays and text printouts)
+ * in those versions of GTK+, we work around the problem by escaping
+ * all characters that aren't printable ASCII.
*/
#undef isprint
#define isprint(c) (c >= 0x20 && c < 0x7f)