From 746ee39329954d5bca8d62736844bc17b1d0516c Mon Sep 17 00:00:00 2001 From: Jakub Zawadzki Date: Sat, 21 Dec 2013 15:01:45 +0000 Subject: Drop isprint.h use g_ascii_isprint() when this include hack was enabled. svn path=/trunk/; revision=54327 --- Makefile.common | 1 - epan/dissectors/packet-aim.c | 6 ++---- epan/dissectors/packet-dcom.c | 3 +-- epan/dissectors/packet-giop.c | 4 +--- epan/dissectors/packet-ncp-sss.c | 3 +-- epan/dissectors/packet-tds.c | 4 +--- epan/dissectors/packet-usb.c | 7 +++---- epan/print.c | 3 +-- epan/strutil.c | 15 +++++++-------- isprint.h | 40 ---------------------------------------- ui/gtk/bytes_view.c | 4 +--- ui/gtk/export_sslkeys.c | 2 -- ui/gtk/follow_stream.c | 7 +++---- ui/gtk/packet_panes.c | 6 ++---- 14 files changed, 23 insertions(+), 82 deletions(-) delete mode 100644 isprint.h diff --git a/Makefile.common b/Makefile.common index 3aefc8a346..fe6e2f456d 100644 --- a/Makefile.common +++ b/Makefile.common @@ -65,7 +65,6 @@ SHARK_COMMON_INCLUDES = \ file.h \ fileset.h \ frame_tvbuff.h \ - isprint.h \ register.h \ version_info.h \ ws_symbol_export.h diff --git a/epan/dissectors/packet-aim.c b/epan/dissectors/packet-aim.c index 5eed6a3739..7fb091ae22 100644 --- a/epan/dissectors/packet-aim.c +++ b/epan/dissectors/packet-aim.c @@ -32,8 +32,6 @@ #include -#include "isprint.h" - #include #include @@ -576,9 +574,9 @@ aim_get_message( guchar *msg, tvbuff_t *tvb, int msg_offset, int msg_length) #ifdef STRIP_TAGS if( j == '<' ) bracket = TRUE; if( j == '>' ) bracket = FALSE; - if( (isprint(j) ) && (bracket == FALSE) && (j != '>')) + if( (g_ascii_isprint(j) ) && (bracket == FALSE) && (j != '>')) #else - if( isprint(j) ) + if( g_ascii_isprint(j) ) #endif { msg[i] = j; diff --git a/epan/dissectors/packet-dcom.c b/epan/dissectors/packet-dcom.c index e485ef85e1..4973ca81ab 100644 --- a/epan/dissectors/packet-dcom.c +++ b/epan/dissectors/packet-dcom.c @@ -94,7 +94,6 @@ #include #include #include -#include #include "packet-dcerpc.h" #include "packet-dcom.h" @@ -1602,7 +1601,7 @@ dcom_tvb_get_nwstringz0(tvbuff_t *tvb, gint offset, guint32 inLength, gchar *psz /* is this character printable? */ /* XXX - there are probably more printable chars than isprint() */ - if(!isprint(u8Tmp1) || u8Tmp2 != 0) { + if(!g_ascii_isprint(u8Tmp1) || u8Tmp2 != 0) { *isPrintable = FALSE; } } diff --git a/epan/dissectors/packet-giop.c b/epan/dissectors/packet-giop.c index f1d1afdc72..544b20a69d 100644 --- a/epan/dissectors/packet-giop.c +++ b/epan/dissectors/packet-giop.c @@ -287,8 +287,6 @@ #include #include -#include "isprint.h" - #include #include #include @@ -2082,7 +2080,7 @@ gchar *make_printable_string (const gchar *in, guint32 len) { memcpy(print_string, in, len); /* and make a copy of input data */ for (i=0; i < len; i++) { - if ( !isprint( (unsigned char)print_string[i] ) ) + if ( !g_ascii_isprint( (unsigned char)print_string[i] ) ) print_string[i] = '.'; } diff --git a/epan/dissectors/packet-ncp-sss.c b/epan/dissectors/packet-ncp-sss.c index 46afec012f..d6213ef699 100644 --- a/epan/dissectors/packet-ncp-sss.c +++ b/epan/dissectors/packet-ncp-sss.c @@ -31,7 +31,6 @@ #include #include "packet-ncp-int.h" #include "packet-ncp-sss.h" -#include "isprint.h" void proto_register_sss(void); @@ -456,7 +455,7 @@ sss_string(tvbuff_t* tvb, int hfinfo, proto_tree *sss_tree, int offset, gboolean } for ( i = 0; i < str_length; i++ ) { c_char = tvb_get_guint8(tvb, foffset); - if (isprint(c_char)) { + if (g_ascii_isprint(c_char)) { buffer[i] = c_char; } else { if (c_char) { diff --git a/epan/dissectors/packet-tds.c b/epan/dissectors/packet-tds.c index e53158213a..78f6902ff4 100644 --- a/epan/dissectors/packet-tds.c +++ b/epan/dissectors/packet-tds.c @@ -149,8 +149,6 @@ #include #include -#include "isprint.h" - #include #include @@ -1250,7 +1248,7 @@ static char *data_to_string(void *data, guint col_type, guint col_size) case SYBVARCHAR: /* strncpy(result, (char *)data, col_size); */ for (i=0;i -#include "isprint.h" #include #include @@ -2563,7 +2562,7 @@ dissect_linux_usb_pseudo_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t type = tvb_get_guint8(tvb, 8); proto_tree_add_uint_format_value(tree, hf_usb_urb_type, tvb, 8, 1, type, "%s ('%c')", val_to_str(type, usb_urb_type_vals, "Unknown %d"), - isprint(type) ? type : '.'); + g_ascii_isprint(type) ? type : '.'); proto_tree_add_item(tree, hf_usb_transfer_type, tvb, 9, 1, ENC_BIG_ENDIAN); transfer_type = tvb_get_guint8(tvb, 9); @@ -2590,7 +2589,7 @@ dissect_linux_usb_pseudo_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t proto_tree_add_string(tree, hf_usb_setup_flag, tvb, 14, 1, "relevant (0)"); } else { proto_tree_add_string_format_value(tree, hf_usb_setup_flag, tvb, - 14, 1, flag, "not relevant ('%c')", isprint(flag[0]) ? flag[0]: '.'); + 14, 1, flag, "not relevant ('%c')", g_ascii_isprint(flag[0]) ? flag[0]: '.'); } flag[0] = tvb_get_guint8(tvb, 15); @@ -2599,7 +2598,7 @@ dissect_linux_usb_pseudo_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t proto_tree_add_string(tree, hf_usb_data_flag, tvb, 15, 1, "present (0)"); } else { proto_tree_add_string_format_value(tree, hf_usb_data_flag, tvb, - 15, 1, flag, "not present ('%c')", isprint(flag[0]) ? flag[0] : '.'); + 15, 1, flag, "not present ('%c')", g_ascii_isprint(flag[0]) ? flag[0] : '.'); } tvb_memcpy(tvb, (guint8 *)&val64, 16, 8); diff --git a/epan/print.c b/epan/print.c index f1952e3a65..6f889c90d1 100644 --- a/epan/print.c +++ b/epan/print.c @@ -43,7 +43,6 @@ #include #include "print.h" -#include "isprint.h" #include "ps.h" #include "version_info.h" #include @@ -767,7 +766,7 @@ proto_tree_write_carrays(guint32 num, FILE *fh, epan_dissect_t *edt) for (i = 0; i < length; i++) { fprintf(fh, "0x%02x", *(cp + i)); - ascii[i % 8] = isprint(*(cp + i)) ? *(cp + i) : '.'; + ascii[i % 8] = g_ascii_isprint(*(cp + i)) ? *(cp + i) : '.'; if (i == (length - 1)) { guint rem; diff --git a/epan/strutil.c b/epan/strutil.c index a3e8710c0e..9d6ff84e32 100644 --- a/epan/strutil.c +++ b/epan/strutil.c @@ -30,7 +30,6 @@ #include #include "strutil.h" #include "emem.h" -#include <../isprint.h> #ifdef _WIN32 @@ -185,7 +184,7 @@ format_text(const guchar *string, size_t len) } c = *string++; - if (isprint(c)) { + if (g_ascii_isprint(c)) { fmtbuf[idx][column] = c; column++; } else { @@ -291,7 +290,7 @@ format_text_wsp(const guchar *string, size_t len) } c = *string++; - if (isprint(c)) { + if (g_ascii_isprint(c)) { fmtbuf[idx][column] = c; column++; } else if (isspace(c)) { @@ -400,7 +399,7 @@ format_text_chr(const guchar *string, const size_t len, const guchar chr) } c = *string++; - if (isprint(c)) + if (g_ascii_isprint(c)) { fmtbuf[idx][column] = c; column++; @@ -566,7 +565,7 @@ uri_str_to_bytes(const char *uri_str, GByteArray *bytes) { p = (const guchar *)uri_str; while (*p) { - if (! isascii(*p) || ! isprint(*p)) + if (! isascii(*p) || ! g_ascii_isprint(*p)) return FALSE; if (*p == '%') { p++; @@ -637,7 +636,7 @@ format_uri(const GByteArray *bytes, const gchar *reserved_chars) } c = bytes->data[column]; - if (!isascii(c) || !isprint(c) || c == '%') { + if (!isascii(c) || !g_ascii_isprint(c) || c == '%') { is_reserved = TRUE; } @@ -976,7 +975,7 @@ escape_string_len(const char *string) } /* Values that can't nicely be represented * in ASCII need to be escaped. */ - else if (!isprint((unsigned char)c)) { + else if (!g_ascii_isprint(c)) { /* c --> \xNN */ repr_len += 4; } @@ -1007,7 +1006,7 @@ escape_string(char *buf, const char *string) } /* Values that can't nicely be represented * in ASCII need to be escaped. */ - else if (!isprint((unsigned char)c)) { + else if (!g_ascii_isprint(c)) { /* c --> \xNN */ g_snprintf(hexbuf,sizeof(hexbuf), "%02x", (unsigned char) c); *bufp++ = '\\'; diff --git a/isprint.h b/isprint.h deleted file mode 100644 index 85f16f1697..0000000000 --- a/isprint.h +++ /dev/null @@ -1,40 +0,0 @@ -/* isprint.h - * Temporary redefinition of "isprint()" to cope with GTK+ 1.3 and - * later using UTF-8 strings - * - * $Id$ - * - * Wireshark - Network traffic analyzer - * By Gerald Combs - * Copyright 1998 Gerald Combs - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef __ISPRINT_H__ -#define __ISPRINT_H__ - -/* - * XXX - "isprint()" can return "true" for non-ASCII characters, but - * those don't work with GTK+ 1.3 or later, as they take UTF-8 strings - * as input. Until we fix up Wireshark 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)) - -#endif diff --git a/ui/gtk/bytes_view.c b/ui/gtk/bytes_view.c index dfbbcbc316..35dcab2dad 100644 --- a/ui/gtk/bytes_view.c +++ b/ui/gtk/bytes_view.c @@ -36,8 +36,6 @@ #include -#include "../isprint.h" - #include #include #include @@ -753,7 +751,7 @@ _bytes_view_line_common(BytesView *bv, void *data, const int org_off, int xx, in EBCDIC_to_ASCII1(pd[off]) : pd[off]; - str[cur++] = isprint(c) ? c : '.'; + str[cur++] = g_ascii_isprint(c) ? c : '.'; } else str[cur++] = ' '; diff --git a/ui/gtk/export_sslkeys.c b/ui/gtk/export_sslkeys.c index ab3c38005a..a6a2e2f4cd 100644 --- a/ui/gtk/export_sslkeys.c +++ b/ui/gtk/export_sslkeys.c @@ -51,8 +51,6 @@ #include #include -#include "../isprint.h" - #include "ui/alert_box.h" #include "ui/last_open_dir.h" #include "ui/progress_dlg.h" diff --git a/ui/gtk/follow_stream.c b/ui/gtk/follow_stream.c index 04333115da..bf8614ab7d 100644 --- a/ui/gtk/follow_stream.c +++ b/ui/gtk/follow_stream.c @@ -39,7 +39,6 @@ #include #include -#include <../isprint.h> #include #include @@ -109,8 +108,8 @@ follow_add_to_gtk_text(char *buffer, size_t nchars, gboolean is_from_server, GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)); GtkTextIter iter; - /* While our isprint() hack is in place, we - * have to convert some chars to '.' in order + /* + * have to convert non printable ASCII chars to '.' in order * to be able to see the data we *should* see * in the GtkText widget. */ @@ -119,7 +118,7 @@ follow_add_to_gtk_text(char *buffer, size_t nchars, gboolean is_from_server, for (i = 0; i < nchars; i++) { if (buffer[i] == '\n' || buffer[i] == '\r') continue; - if (! isprint((guchar)buffer[i])) { + if (! g_ascii_isprint(buffer[i])) { buffer[i] = '.'; } } diff --git a/ui/gtk/packet_panes.c b/ui/gtk/packet_panes.c index 60c7494c55..9815124c44 100644 --- a/ui/gtk/packet_panes.c +++ b/ui/gtk/packet_panes.c @@ -52,8 +52,6 @@ #include #include -#include "../isprint.h" - #include "ui/alert_box.h" #include "ui/last_open_dir.h" #include "ui/progress_dlg.h" @@ -582,7 +580,7 @@ copy_hex_all_info(GString* copy_buffer, const guint8* data_p, int data_len, gboo g_string_append_printf(hex_str," %02x",*data_p); if(append_text) { - g_string_append_printf(char_str,"%c",isprint(*data_p) ? *data_p : '.'); + g_string_append_printf(char_str,"%c",g_ascii_isprint(*data_p) ? *data_p : '.'); } ++data_p; @@ -628,7 +626,7 @@ copy_hex_bytes_text_only(GString* copy_buffer, const guint8* data_p, int data_le gchar to_append; /* Copy printable characters, newlines, and (horizontal) tabs. */ - if(isprint(*data_p)) { + if(g_ascii_isprint(*data_p)) { to_append = *data_p; } else if(*data_p==0x0a) { to_append = '\n'; -- cgit v1.2.3