From c3af6aae8a8dc5a8d82dcb207ff75f6ab3565cc7 Mon Sep 17 00:00:00 2001 From: sfisher Date: Mon, 7 Apr 2008 05:22:54 +0000 Subject: [PATCH] - Remove GLIB1 code - Change ugly GLIB version checking statements to GLIB_CHECK_VERSION - Remove ws_strsplit files because we no longer need to borrow GLIB2's g_strsplit code for the no longer supported GLIB1 builds git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24829 f5534014-38df-0310-8fa8-9805f1628bb7 --- asn1/gsmmap/packet-gsmmap-template.c | 4 -- asn1/h245/packet-h245-template.c | 4 -- capture.c | 1 - doc/README.developer | 7 --- epan/Makefile.common | 2 - epan/crypt/airpdcap.c | 1 - epan/dfilter/dfilter-int.h | 2 +- epan/dissectors/packet-gsm_map.c | 18 +++--- epan/dissectors/packet-gsm_map.h | 2 +- epan/dissectors/packet-h245.c | 16 ++--- epan/dissectors/packet-http.c | 1 - epan/dissectors/packet-jxta.c | 5 -- epan/dissectors/packet-k12.c | 1 - epan/dissectors/packet-msrp.c | 5 -- epan/dissectors/packet-multipart.c | 13 +--- epan/dissectors/packet-rtsp.c | 6 +- epan/dissectors/packet-sdp.c | 5 -- epan/dissectors/packet-sip.c | 7 +-- epan/dissectors/packet-syslog.c | 1 - epan/dissectors/packet-xml.c | 13 ---- epan/dtd_parse.h | 2 +- epan/emem.c | 25 -------- epan/ex-opt.c | 1 - epan/filesystem.c | 2 +- epan/plugins.c | 42 ------------- epan/prefs.c | 20 +----- epan/proto.c | 40 +----------- epan/stats_tree.c | 1 - epan/strutil.c | 94 ---------------------------- epan/ws_strsplit.c | 82 ------------------------ epan/ws_strsplit.h | 41 ------------ epan/wslua/wslua.h | 14 ----- gtk/font_utils.c | 1 - gtk/uat_gui.c | 7 +-- gtk/voip_calls.c | 1 - gtk/webbrowser.c | 1 - isprint.h | 6 -- plugins/mate/mate_grammar.lemon | 1 - plugins/mate/mate_setup.c | 1 - plugins/mate/mate_util.c | 1 - tap-funnel.c | 1 - tools/lemon/lempar.c | 2 +- util.c | 1 - wiretap/file_util.h | 16 +---- 44 files changed, 32 insertions(+), 485 deletions(-) delete mode 100644 epan/ws_strsplit.c delete mode 100644 epan/ws_strsplit.h diff --git a/asn1/gsmmap/packet-gsmmap-template.c b/asn1/gsmmap/packet-gsmmap-template.c index 6245d41b99..72663f2de8 100644 --- a/asn1/gsmmap/packet-gsmmap-template.c +++ b/asn1/gsmmap/packet-gsmmap-template.c @@ -241,7 +241,6 @@ const value_string gsm_map_etsi_defined_pdp_vals[] = { static void gsmmap_add_ucs2_ussd_string(tvbuff_t *tvb, proto_tree *tree, int length) { -#if GLIB_MAJOR_VERSION > 2 gchar *utf8_text = NULL; GIConv cd; GError *l_conv_error = NULL; @@ -261,9 +260,6 @@ gsmmap_add_ucs2_ussd_string(tvbuff_t *tvb, proto_tree *tree, int length) } else proto_tree_add_text(tree, tvb, 0, length, "USSD String: g_iconv_open FAILED contact wireshark"); -#else - proto_tree_add_text(tree, tvb, 0, length, "UCS2 conversion not supported with Glib < 2"); -#endif } char * unpack_digits(tvbuff_t *tvb, int offset){ diff --git a/asn1/h245/packet-h245-template.c b/asn1/h245/packet-h245-template.c index bbfe34138f..6dac48ad54 100644 --- a/asn1/h245/packet-h245-template.c +++ b/asn1/h245/packet-h245-template.c @@ -344,11 +344,7 @@ static void h245_setup_channels(packet_info *pinfo, channel_info_t *upcoming_cha /* (S)RTP, (S)RTCP */ if (upcoming_channel->rfc2198 > 0) { -#if GLIB_MAJOR_VERSION < 2 - rtp_dyn_payload = g_hash_table_new(g_int_hash, g_int_equal); -#else rtp_dyn_payload = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, g_free); -#endif key = g_malloc(sizeof(gint)); *key = upcoming_channel->rfc2198; g_hash_table_insert(rtp_dyn_payload, key, g_strdup("red")); diff --git a/capture.c b/capture.c index 3e72a9f16a..b93fcc1a22 100644 --- a/capture.c +++ b/capture.c @@ -75,7 +75,6 @@ #include #include -#include #include "file.h" #include "capture.h" #include "capture_sync.h" diff --git a/doc/README.developer b/doc/README.developer index 70870b05c1..c4fca682d9 100644 --- a/doc/README.developer +++ b/doc/README.developer @@ -456,13 +456,6 @@ automatically free()d when the dissection of the current packet ends so you don't have to worry about free()ing them explicitly in order to not leak memory. Please read README.malloc. -When using g_strsplit() from glib, place an #include at -the top of your file. This file will leave in place g_strsplit() when using -GTK/GLib v2 and replace it with GLib v2 code when compiling for GTK/GLib 1. -This is necessary because the GLib v1 version of g_strsplit is known to be -buggy. In either case, you will still use the g_strsplit() function name -as usual in your code. - 1.1.3 Robustness. Wireshark is not guaranteed to read only network traces that contain correctly- diff --git a/epan/Makefile.common b/epan/Makefile.common index 88dbed64bb..067af5dc96 100644 --- a/epan/Makefile.common +++ b/epan/Makefile.common @@ -95,7 +95,6 @@ LIBWIRESHARK_SRC = \ uat.c \ unicode-utils.c \ value_string.c \ - ws_strsplit.c \ xdlc.c \ xmlstub.c @@ -235,7 +234,6 @@ LIBWIRESHARK_INCLUDES = \ uat-int.h \ unicode-utils.h \ value_string.h \ - ws_strsplit.h \ x264_prt_id.h \ xdlc.h \ xmlstub.h diff --git a/epan/crypt/airpdcap.c b/epan/crypt/airpdcap.c index 22ccfb067e..be52088590 100644 --- a/epan/crypt/airpdcap.c +++ b/epan/crypt/airpdcap.c @@ -43,7 +43,6 @@ #include #include #include -#include #include #include diff --git a/epan/dfilter/dfilter-int.h b/epan/dfilter/dfilter-int.h index e316ab816a..8415dc5830 100644 --- a/epan/dfilter/dfilter-int.h +++ b/epan/dfilter/dfilter-int.h @@ -57,7 +57,7 @@ typedef struct { } dfwork_t; /* Constructor/Destructor prototypes for Lemon Parser */ -#if (GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 16)) +#if GLIB_CHECK_VERSION(2,16,0) void *DfilterAlloc(void* (*)(gsize)); #else void *DfilterAlloc(void* (*)(gulong)); diff --git a/epan/dissectors/packet-gsm_map.c b/epan/dissectors/packet-gsm_map.c index 9922ac1cae..c659b68921 100644 --- a/epan/dissectors/packet-gsm_map.c +++ b/epan/dissectors/packet-gsm_map.c @@ -1,7 +1,7 @@ /* Do not modify this file. */ /* It is created automatically by the ASN.1 to Wireshark dissector compiler */ /* packet-gsm_map.c */ -/* ../../tools/asn2wrs.py -b -e -c gsmmap.cnf -s packet-gsmmap-template ../ros/Remote-Operations-Information-Objects.asn MobileDomainDefinitions.asn MAP-ApplicationContexts.asn MAP-SS-Code.asn MAP-BS-Code.asn MAP-TS-Code.asn MAP-ExtensionDataTypes.asn MAP-CommonDataTypes.asn MAP-SS-DataTypes.asn MAP-ER-DataTypes.asn MAP-SM-DataTypes.asn MAP-OM-DataTypes.asn MAP-MS-DataTypes.asn MAP-CH-DataTypes.asn MAP-LCS-DataTypes.asn MAP-GR-DataTypes.asn MAP-DialogueInformation.asn MAP-LocationServiceOperations.asn MAP-Group-Call-Operations.asn MAP-ShortMessageServiceOperations.asn MAP-SupplementaryServiceOperations.asn MAP-CallHandlingOperations.asn MAP-OperationAndMaintenanceOperations.asn MAP-MobileServiceOperations.asn MAP-Errors.asn MAP-Protocol.asn GSMMAP.asn SS-DataTypes.asn SS-Operations.asn */ +/* ../../tools/asn2wrs.py -b -e -c ./gsmmap.cnf -s ./packet-gsmmap-template -D . ../ros/Remote-Operations-Information-Objects.asn MobileDomainDefinitions.asn MAP-ApplicationContexts.asn MAP-SS-Code.asn MAP-BS-Code.asn MAP-TS-Code.asn MAP-ExtensionDataTypes.asn MAP-CommonDataTypes.asn MAP-SS-DataTypes.asn MAP-ER-DataTypes.asn MAP-SM-DataTypes.asn MAP-OM-DataTypes.asn MAP-MS-DataTypes.asn MAP-CH-DataTypes.asn MAP-LCS-DataTypes.asn MAP-GR-DataTypes.asn MAP-DialogueInformation.asn MAP-LocationServiceOperations.asn MAP-Group-Call-Operations.asn MAP-ShortMessageServiceOperations.asn MAP-SupplementaryServiceOperations.asn MAP-CallHandlingOperations.asn MAP-OperationAndMaintenanceOperations.asn MAP-MobileServiceOperations.asn MAP-Errors.asn MAP-Protocol.asn GSMMAP.asn SS-DataTypes.asn SS-Operations.asn */ /* Input file: packet-gsmmap-template.c */ @@ -2036,7 +2036,6 @@ const value_string gsm_map_etsi_defined_pdp_vals[] = { static void gsmmap_add_ucs2_ussd_string(tvbuff_t *tvb, proto_tree *tree, int length) { -#if GLIB_MAJOR_VERSION > 2 gchar *utf8_text = NULL; GIConv cd; GError *l_conv_error = NULL; @@ -2056,9 +2055,6 @@ gsmmap_add_ucs2_ussd_string(tvbuff_t *tvb, proto_tree *tree, int length) } else proto_tree_add_text(tree, tvb, 0, length, "USSD String: g_iconv_open FAILED contact wireshark"); -#else - proto_tree_add_text(tree, tvb, 0, length, "UCS2 conversion not supported with Glib < 2"); -#endif } char * unpack_digits(tvbuff_t *tvb, int offset){ @@ -15616,7 +15612,7 @@ dissect_gsm_ss_LCS_PeriodicLocationCancellationArg(gboolean implicit_tag _U_, tv /*--- End of included file: packet-gsm_map-fn.c ---*/ -#line 898 "packet-gsmmap-template.c" +#line 894 "packet-gsmmap-template.c" /* Specific translation for MAP V3 */ const value_string gsm_map_V1V2_opr_code_strings[] = { @@ -15828,7 +15824,7 @@ const value_string gsm_map_opr_code_strings[] = { { 109, "lcs_PeriodicLocationCancellation" }, /*--- End of included file: packet-gsm_map-table.c ---*/ -#line 909 "packet-gsmmap-template.c" +#line 905 "packet-gsmmap-template.c" { 0, NULL } }; static const value_string gsm_map_err_code_string_vals[] = { @@ -16033,7 +16029,7 @@ static const value_string gsm_map_err_code_string_vals[] = { { 109, "lcs_PeriodicLocationCancellation" }, /*--- End of included file: packet-gsm_map-table.c ---*/ -#line 913 "packet-gsmmap-template.c" +#line 909 "packet-gsmmap-template.c" { 0, NULL } }; static const true_false_string gsm_map_extension_value = { @@ -22513,7 +22509,7 @@ void proto_register_gsm_map(void) { "gsm_map_lcs.LCS_QoS", HFILL }}, /*--- End of included file: packet-gsm_map-hfarr.c ---*/ -#line 2650 "packet-gsmmap-template.c" +#line 2646 "packet-gsmmap-template.c" }; /* List of subtrees */ @@ -23101,7 +23097,7 @@ void proto_register_gsm_map(void) { /*--- End of included file: packet-gsm_map-ettarr.c ---*/ -#line 2678 "packet-gsmmap-template.c" +#line 2674 "packet-gsmmap-template.c" }; /* Register protocol */ @@ -23177,7 +23173,7 @@ void proto_register_gsm_map(void) { /*--- End of included file: packet-gsm_map-dis-tab.c ---*/ -#line 2696 "packet-gsmmap-template.c" +#line 2692 "packet-gsmmap-template.c" oid_add_from_string("ericsson-gsm-Map-Ext","1.2.826.0.1249.58.1.0" ); oid_add_from_string("accessTypeNotAllowed-id","1.3.12.2.1107.3.66.1.2"); /*oid_add_from_string("map-ac networkLocUp(1) version3(3)","0.4.0.0.1.0.1.3" ); diff --git a/epan/dissectors/packet-gsm_map.h b/epan/dissectors/packet-gsm_map.h index 082759ace7..eb3515ce3a 100644 --- a/epan/dissectors/packet-gsm_map.h +++ b/epan/dissectors/packet-gsm_map.h @@ -1,7 +1,7 @@ /* Do not modify this file. */ /* It is created automatically by the ASN.1 to Wireshark dissector compiler */ /* packet-gsm_map.h */ -/* ../../tools/asn2wrs.py -b -e -c gsmmap.cnf -s packet-gsmmap-template ../ros/Remote-Operations-Information-Objects.asn MobileDomainDefinitions.asn MAP-ApplicationContexts.asn MAP-SS-Code.asn MAP-BS-Code.asn MAP-TS-Code.asn MAP-ExtensionDataTypes.asn MAP-CommonDataTypes.asn MAP-SS-DataTypes.asn MAP-ER-DataTypes.asn MAP-SM-DataTypes.asn MAP-OM-DataTypes.asn MAP-MS-DataTypes.asn MAP-CH-DataTypes.asn MAP-LCS-DataTypes.asn MAP-GR-DataTypes.asn MAP-DialogueInformation.asn MAP-LocationServiceOperations.asn MAP-Group-Call-Operations.asn MAP-ShortMessageServiceOperations.asn MAP-SupplementaryServiceOperations.asn MAP-CallHandlingOperations.asn MAP-OperationAndMaintenanceOperations.asn MAP-MobileServiceOperations.asn MAP-Errors.asn MAP-Protocol.asn GSMMAP.asn SS-DataTypes.asn SS-Operations.asn */ +/* ../../tools/asn2wrs.py -b -e -c ./gsmmap.cnf -s ./packet-gsmmap-template -D . ../ros/Remote-Operations-Information-Objects.asn MobileDomainDefinitions.asn MAP-ApplicationContexts.asn MAP-SS-Code.asn MAP-BS-Code.asn MAP-TS-Code.asn MAP-ExtensionDataTypes.asn MAP-CommonDataTypes.asn MAP-SS-DataTypes.asn MAP-ER-DataTypes.asn MAP-SM-DataTypes.asn MAP-OM-DataTypes.asn MAP-MS-DataTypes.asn MAP-CH-DataTypes.asn MAP-LCS-DataTypes.asn MAP-GR-DataTypes.asn MAP-DialogueInformation.asn MAP-LocationServiceOperations.asn MAP-Group-Call-Operations.asn MAP-ShortMessageServiceOperations.asn MAP-SupplementaryServiceOperations.asn MAP-CallHandlingOperations.asn MAP-OperationAndMaintenanceOperations.asn MAP-MobileServiceOperations.asn MAP-Errors.asn MAP-Protocol.asn GSMMAP.asn SS-DataTypes.asn SS-Operations.asn */ /* Input file: packet-gsmmap-template.h */ diff --git a/epan/dissectors/packet-h245.c b/epan/dissectors/packet-h245.c index acd0994edd..778e7ee27b 100644 --- a/epan/dissectors/packet-h245.c +++ b/epan/dissectors/packet-h245.c @@ -1,7 +1,7 @@ /* Do not modify this file. */ /* It is created automatically by the ASN.1 to Wireshark dissector compiler */ /* packet-h245.c */ -/* ../../tools/asn2wrs.py -e -p h245 -c h245.cnf -s packet-h245-template MULTIMEDIA-SYSTEM-CONTROL.asn */ +/* ../../tools/asn2wrs.py -e -p h245 -c ./h245.cnf -s ./packet-h245-template -D . MULTIMEDIA-SYSTEM-CONTROL.asn */ /* Input file: packet-h245-template.c */ @@ -475,11 +475,7 @@ static void h245_setup_channels(packet_info *pinfo, channel_info_t *upcoming_cha /* (S)RTP, (S)RTCP */ if (upcoming_channel->rfc2198 > 0) { -#if GLIB_MAJOR_VERSION < 2 - rtp_dyn_payload = g_hash_table_new(g_int_hash, g_int_equal); -#else rtp_dyn_payload = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, g_free); -#endif key = g_malloc(sizeof(gint)); *key = upcoming_channel->rfc2198; g_hash_table_insert(rtp_dyn_payload, key, g_strdup("red")); @@ -1902,7 +1898,7 @@ static int hf_h245_encrypted = -1; /* OCTET_STRING */ static int hf_h245_encryptedAlphanumeric = -1; /* EncryptedAlphanumeric */ /*--- End of included file: packet-h245-hf.c ---*/ -#line 375 "packet-h245-template.c" +#line 371 "packet-h245-template.c" /* Initialize the subtree pointers */ static int ett_h245 = -1; @@ -2403,7 +2399,7 @@ static gint ett_h245_FlowControlIndication = -1; static gint ett_h245_MobileMultilinkReconfigurationIndication = -1; /*--- End of included file: packet-h245-ett.c ---*/ -#line 380 "packet-h245-template.c" +#line 376 "packet-h245-template.c" /* Forward declarations */ static int dissect_h245_MultimediaSystemControlMessage(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_); @@ -14357,7 +14353,7 @@ static void dissect_OpenLogicalChannel_PDU(tvbuff_t *tvb _U_, packet_info *pinfo /*--- End of included file: packet-h245-fn.c ---*/ -#line 389 "packet-h245-template.c" +#line 385 "packet-h245-template.c" static void dissect_h245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) @@ -20020,7 +20016,7 @@ void proto_register_h245(void) { "h245.EncryptedAlphanumeric", HFILL }}, /*--- End of included file: packet-h245-hfarr.c ---*/ -#line 467 "packet-h245-template.c" +#line 463 "packet-h245-template.c" }; /* List of subtrees */ @@ -20523,7 +20519,7 @@ void proto_register_h245(void) { &ett_h245_MobileMultilinkReconfigurationIndication, /*--- End of included file: packet-h245-ettarr.c ---*/ -#line 474 "packet-h245-template.c" +#line 470 "packet-h245-template.c" }; module_t *h245_module; diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c index 775d76fbb9..cd06cede68 100644 --- a/epan/dissectors/packet-http.c +++ b/epan/dissectors/packet-http.c @@ -44,7 +44,6 @@ #include #include #include -#include #include #include "packet-http.h" diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c index b25fd3dcfe..a3bc5d4257 100644 --- a/epan/dissectors/packet-jxta.c +++ b/epan/dissectors/packet-jxta.c @@ -49,7 +49,6 @@ #include #include #include -#include #include "packet-jxta.h" @@ -2263,15 +2262,11 @@ static int dissect_media( const gchar* fullmediatype, tvbuff_t * tvb, packet_inf pinfo->match_string = ep_strdup(mediatype); /* force to lower case */ -#if GLIB_MAJOR_VERSION < 2 - g_strdown(mediatype); -#else { gchar *mediatype_lowercase = g_ascii_strdown(mediatype, -1); mediatype = ep_strdup(mediatype_lowercase); g_free(mediatype_lowercase); } -#endif if (0 == strcmp("application/x-jxta-tls-block", mediatype)) { /* If we recognize it as a TLS packet then we shuffle it off to ssl dissector. */ diff --git a/epan/dissectors/packet-k12.c b/epan/dissectors/packet-k12.c index c0c0a0f583..59a0909ca0 100644 --- a/epan/dissectors/packet-k12.c +++ b/epan/dissectors/packet-k12.c @@ -41,7 +41,6 @@ #include #include "packet-sscop.h" #include "packet-umts_fp.h" -#include typedef struct _k12_hdls_t { char* match; diff --git a/epan/dissectors/packet-msrp.c b/epan/dissectors/packet-msrp.c index 0cc7561733..c79c685034 100644 --- a/epan/dissectors/packet-msrp.c +++ b/epan/dissectors/packet-msrp.c @@ -687,12 +687,7 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) parameter_offset, content_type_parameter_str_len); } media_type_str = tvb_get_ephemeral_string(tvb, value_offset, content_type_len); -#if GLIB_MAJOR_VERSION < 2 - media_type_str_lower_case = g_strdup(media_type_str); - g_strdown(media_type_str_lower_case); -#else media_type_str_lower_case = g_ascii_strdown(media_type_str, -1); -#endif break; default: diff --git a/epan/dissectors/packet-multipart.c b/epan/dissectors/packet-multipart.c index bbfcccd55f..2d164f6099 100644 --- a/epan/dissectors/packet-multipart.c +++ b/epan/dissectors/packet-multipart.c @@ -682,12 +682,9 @@ process_body_part(proto_tree *tree, tvbuff_t *tvb, const guint8 *boundary, } else { parameters = NULL; } -#if GLIB_MAJOR_VERSION < 2 - content_type_str = g_strdup(value_str); - g_strdown(content_type_str); -#else + content_type_str = g_ascii_strdown(value_str, -1); -#endif + /* Show content-type in root 'part' label */ proto_item_append_text(ti, " (%s)", content_type_str); @@ -707,12 +704,8 @@ process_body_part(proto_tree *tree, tvbuff_t *tvb, const guint8 *boundary, if (cr_offset > 0) { value_str[cr_offset] = '\0'; } -#if GLIB_MAJOR_VERSION < 2 - content_encoding_str = g_strdup(value_str); - g_strdown(content_encoding_str); -#else + content_encoding_str = g_ascii_strdown(value_str, -1); -#endif } break; case POS_CONTENT_DISPOSITION: diff --git a/epan/dissectors/packet-rtsp.c b/epan/dissectors/packet-rtsp.c index 2eb2532025..0dae2c300f 100644 --- a/epan/dissectors/packet-rtsp.c +++ b/epan/dissectors/packet-rtsp.c @@ -900,12 +900,8 @@ dissect_rtspmessage(tvbuff_t *tvb, int offset, packet_info *pinfo, media_type_str = tvb_get_ephemeral_string(tvb, offset, value_len); -#if GLIB_MAJOR_VERSION < 2 - media_type_str_lower_case = ep_strdup(media_type_str); - g_strdown(media_type_str_lower_case); -#else + media_type_str_lower_case = g_ascii_strdown(media_type_str, -1); -#endif } else if (HDR_MATCHES(rtsp_content_length)) { diff --git a/epan/dissectors/packet-sdp.c b/epan/dissectors/packet-sdp.c index 665fa33c6d..abf5f7ef41 100644 --- a/epan/dissectors/packet-sdp.c +++ b/epan/dissectors/packet-sdp.c @@ -290,13 +290,8 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) transport_info.media_port[n]=NULL; transport_info.media_proto[n]=NULL; transport_info.media[n].pt_count = 0; -#if GLIB_MAJOR_VERSION < 2 - transport_info.media[n].rtp_dyn_payload = g_hash_table_new( g_int_hash, - g_int_equal); -#else transport_info.media[n].rtp_dyn_payload = g_hash_table_new_full( g_int_hash, g_int_equal, g_free, g_free); -#endif } transport_info.media_count = 0; diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c index 7e67599506..c746a41bd7 100644 --- a/epan/dissectors/packet-sip.c +++ b/epan/dissectors/packet-sip.c @@ -2178,12 +2178,9 @@ separator_found2: content_type_parameter_str_len); } media_type_str = tvb_get_ephemeral_string(tvb, value_offset, content_type_len); -#if GLIB_MAJOR_VERSION < 2 - media_type_str_lower_case = ep_strdup(media_type_str); - g_strdown(media_type_str_lower_case); -#else + media_type_str_lower_case = g_ascii_strdown(media_type_str, -1); -#endif + /* Debug code proto_tree_add_text(hdr_tree, tvb, value_offset,content_type_len,"media_type_str=%s",media_type_str); */ diff --git a/epan/dissectors/packet-syslog.c b/epan/dissectors/packet-syslog.c index 5edfa95058..1bb8273014 100644 --- a/epan/dissectors/packet-syslog.c +++ b/epan/dissectors/packet-syslog.c @@ -40,7 +40,6 @@ #include #include #include -#include #define UDP_PORT_SYSLOG 514 diff --git a/epan/dissectors/packet-xml.c b/epan/dissectors/packet-xml.c index 706cf7c493..2b0dcf394e 100644 --- a/epan/dissectors/packet-xml.c +++ b/epan/dissectors/packet-xml.c @@ -1100,21 +1100,12 @@ next_attribute: g_free(root_name); } -#if GLIB_MAJOR_VERSION < 2 -# define DIRECTORY_T DIR -# define FILE_T struct dirent -# define OPENDIR_OP(name) opendir(name) -# define DIRGETNEXT_OP(dir) readdir(dir) -# define GETFNAME_OP(file) (gchar *)file->d_name -# define CLOSEDIR_OP(dir) closedir(dir) -#else /* GLIB 2 */ # define DIRECTORY_T GDir # define FILE_T gchar # define OPENDIR_OP(name) g_dir_open(name, 0, dummy) # define DIRGETNEXT_OP(dir) g_dir_read_name(dir) # define GETFNAME_OP(file) (file); # define CLOSEDIR_OP(dir) g_dir_close(dir) -#endif static void init_xml_names(void) { xml_ns_t* xmlpi_xml_ns; @@ -1124,10 +1115,8 @@ static void init_xml_names(void) { const gchar* filename; gchar* dirname; -#if GLIB_MAJOR_VERSION >= 2 GError** dummy = g_malloc(sizeof(GError *)); *dummy = NULL; -#endif xmpli_names = g_hash_table_new(g_str_hash,g_str_equal); media_types = g_hash_table_new(g_str_hash,g_str_equal); @@ -1201,9 +1190,7 @@ static void init_xml_names(void) { g_hash_table_foreach(xmpli_names,add_xmlpi_namespace,"xml.xmlpi"); -#if GLIB_MAJOR_VERSION >= 2 g_free(dummy); -#endif } static void range_delete_xml_tcp_callback(guint32 port) { diff --git a/epan/dtd_parse.h b/epan/dtd_parse.h index cd84aeaed9..1d8140ef62 100644 --- a/epan/dtd_parse.h +++ b/epan/dtd_parse.h @@ -27,7 +27,7 @@ */ extern void DtdParse(void*,int,dtd_token_data_t*,dtd_build_data_t*); -#if (GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 16)) +#if GLIB_CHECK_VERSION(2,16,0) extern void *DtdParseAlloc(void *(*)(gsize)); #else extern void *DtdParseAlloc(void *(*)(gulong)); diff --git a/epan/emem.c b/epan/emem.c index 593f814ac2..7e2c43ebd6 100644 --- a/epan/emem.c +++ b/epan/emem.c @@ -145,13 +145,8 @@ static intptr_t pagesize; void emem_canary(guint8 *canary) { int i; -#if GLIB_MAJOR_VERSION >= 2 static GRand *rand_state = NULL; -#endif - - /* First, use GLib's random function if we have it */ -#if GLIB_MAJOR_VERSION >= 2 if (rand_state == NULL) { rand_state = g_rand_new(); } @@ -159,26 +154,6 @@ emem_canary(guint8 *canary) { canary[i] = (guint8) g_rand_int(rand_state); } return; -#else - FILE *fp; - size_t sz; - /* Try /dev/urandom */ - if ((fp = eth_fopen("/dev/urandom", "r")) != NULL) { - setbuf(fp, NULL); - sz = fread(canary, 1, EMEM_CANARY_DATA_SIZE, fp); - fclose(fp); - if (sz == EMEM_CANARY_DATA_SIZE) { - return; - } - } - - /* Our last resort */ - srandom(time(NULL) | getpid()); - for (i = 0; i < EMEM_CANARY_DATA_SIZE; i ++) { - canary[i] = (guint8) random(); - } - return; -#endif /* GLIB_MAJOR_VERSION >= 2 */ } #if !defined(SE_DEBUG_FREE) diff --git a/epan/ex-opt.c b/epan/ex-opt.c index 3731572d52..f584324c8e 100644 --- a/epan/ex-opt.c +++ b/epan/ex-opt.c @@ -32,7 +32,6 @@ #include #include "ex-opt.h" -#include static GHashTable* ex_opts = NULL; diff --git a/epan/filesystem.c b/epan/filesystem.c index 6a88da0cdd..be779561b3 100644 --- a/epan/filesystem.c +++ b/epan/filesystem.c @@ -777,7 +777,7 @@ char *getenv_utf8(const char *varname) envvar = getenv(varname); /* since GLib 2.6 we need an utf8 version of the filename */ -#if (GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 6)) +#if GLIB_CHECK_VERSION(2,6,0) /* using the wide char version of getenv should work under all circumstances */ /* convert given varname to utf16, needed by _wgetenv */ diff --git a/epan/plugins.c b/epan/plugins.c index 9e7cc17edc..3c20fb6c68 100644 --- a/epan/plugins.c +++ b/epan/plugins.c @@ -135,10 +135,6 @@ plugins_scan_dir(const char *dirname) ETH_DIR *dir; /* scanned directory */ ETH_DIRENT *file; /* current file */ const char *name; -#if GLIB_MAJOR_VERSION < 2 - gchar *hack_path; /* pathname used to construct lt_lib_ext */ - gchar *lt_lib_ext; /* extension for loadable modules */ -#endif gchar filename[FILENAME_LEN]; /* current file name */ GModule *handle; /* handle returned by dlopen */ gchar *version; @@ -152,28 +148,6 @@ plugins_scan_dir(const char *dirname) gchar *dot; int cr; -#if GLIB_MAJOR_VERSION < 2 - /* - * We find the extension used on this platform for loadable modules - * by the sneaky hack of calling "g_module_build_path" to build - * the pathname for a module with an empty directory name and - * empty module name, and then search for the last "." and use - * everything from the last "." on. - */ - hack_path = g_module_build_path("", ""); - lt_lib_ext = strrchr(hack_path, '.'); - if (lt_lib_ext == NULL) - { - /* - * Does this mean there *is* no extension? Assume so. - * - * XXX - the code below assumes that all loadable modules have - * an extension.... - */ - lt_lib_ext = ""; - } -#endif - if ((dir = eth_dir_open(dirname, 0, NULL)) != NULL) { @@ -181,18 +155,6 @@ plugins_scan_dir(const char *dirname) { name = eth_dir_get_name(file); -#if GLIB_MAJOR_VERSION < 2 - /* don't try to open "." and ".." */ - if (!(strcmp(name, "..") && - strcmp(name, "."))) - continue; - - /* skip anything but files with lt_lib_ext */ - dot = strrchr(name, '.'); - if (dot == NULL || strcmp(dot, lt_lib_ext) != 0) - continue; - -#else /* GLIB 2 */ /* * GLib 2.x defines G_MODULE_SUFFIX as the extension used on * this platform for loadable modules. @@ -202,7 +164,6 @@ plugins_scan_dir(const char *dirname) if (dot == NULL || strcmp(dot+1, G_MODULE_SUFFIX) != 0) continue; -#endif g_snprintf(filename, FILENAME_LEN, "%s" G_DIR_SEPARATOR_S "%s", dirname, name); if ((handle = g_module_open(filename, 0)) == NULL) @@ -362,9 +323,6 @@ plugins_scan_dir(const char *dirname) } eth_dir_close(dir); } -#if GLIB_MAJOR_VERSION < 2 - g_free(hack_path); -#endif } /* get the personal plugin dir */ diff --git a/epan/prefs.c b/epan/prefs.c index 6751007f93..0bb320355f 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -363,20 +363,6 @@ prefs_register_protocol_obsolete(int id) return module; } -#if GLIB_MAJOR_VERSION < 2 -static void *discard_const(const void *const_ptr) -{ - union { - const void *const_ptr; - void *ptr; - } stupid_const; - - stupid_const.const_ptr = const_ptr; - - return stupid_const.ptr; -} -#endif - module_t * prefs_find_module(const char *name) { @@ -606,13 +592,9 @@ find_preference(module_t *module, const char *name) { GList *list_entry; -#if GLIB_MAJOR_VERSION < 2 - list_entry = g_list_find_custom(module->prefs, discard_const(name), - preference_match); -#else list_entry = g_list_find_custom(module->prefs, name, preference_match); -#endif + if (list_entry == NULL) return NULL; /* no such preference */ return (struct preference *) list_entry->data; diff --git a/epan/proto.c b/epan/proto.c index 02fefbeb56..60f5fe7e42 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -83,20 +83,6 @@ wrs_count_bitshift(guint32 bitmask) -#if GLIB_MAJOR_VERSION < 2 -static void *discard_const(const void *const_ptr) -{ - union { - const void *const_ptr; - void *ptr; - } stupid_const; - - stupid_const.const_ptr = const_ptr; - - return stupid_const.ptr; -} -#endif - #define cVALS(x) (const value_string*)(x) #if 1 @@ -303,12 +289,10 @@ gpa_hfinfo_t gpa_hfinfo; static GTree *gpa_name_tree = NULL; static header_field_info *same_name_hfinfo; -#if GLIB_MAJOR_VERSION >= 2 static void save_same_name_hfinfo(gpointer data) { same_name_hfinfo = (header_field_info*)data; } -#endif /* Points to the first element of an array of Booleans, indexed by a subtree item type; that array element is TRUE if subtrees of @@ -361,11 +345,7 @@ proto_init(void (register_all_protocols)(register_cb cb, gpointer client_data), gpa_hfinfo.len=0; gpa_hfinfo.allocated_len=0; gpa_hfinfo.hfi=NULL; -#if GLIB_MAJOR_VERSION < 2 - gpa_name_tree = g_tree_new(wrs_strcmp); -#else gpa_name_tree = g_tree_new_full(wrs_strcmp_with_data, NULL, NULL, save_same_name_hfinfo); -#endif /* Initialize the ftype subsystem */ ftypes_initialize(); @@ -727,11 +707,7 @@ proto_registrar_get_byname(const char *field_name) DISSECTOR_ASSERT(field_name != NULL); -#if GLIB_MAJOR_VERSION < 2 - hfinfo = g_tree_lookup(gpa_name_tree, discard_const(field_name)); -#else hfinfo = g_tree_lookup(gpa_name_tree, field_name); -#endif if (hfinfo) return hfinfo; @@ -744,11 +720,7 @@ proto_registrar_get_byname(const char *field_name) return NULL; } -#if GLIB_MAJOR_VERSION < 2 - return g_tree_lookup(gpa_name_tree, discard_const(field_name)); -#else return g_tree_lookup(gpa_name_tree, field_name); -#endif } @@ -3848,13 +3820,9 @@ int proto_get_id_by_filter_name(const gchar* filter_name) GList *list_entry; protocol_t *protocol; -#if GLIB_MAJOR_VERSION < 2 - list_entry = g_list_find_custom(protocols, discard_const(filter_name), - compare_filter_name); -#else list_entry = g_list_find_custom(protocols, filter_name, compare_filter_name); -#endif + if (list_entry == NULL) return -1; protocol = list_entry->data; @@ -4116,11 +4084,9 @@ proto_register_field_init(header_field_info *hfinfo, int parent) * a byte, and we want to be able to refer to that field * with one name regardless of whether the packets * are modulo-8 or modulo-128 packets. */ -#if GLIB_MAJOR_VERSION < 2 - same_name_hfinfo = g_tree_lookup(gpa_name_tree, discard_const(hfinfo->abbrev)); -#else + same_name_hfinfo = NULL; -#endif + g_tree_insert(gpa_name_tree, (gpointer) (hfinfo->abbrev), hfinfo); /* GLIB 2.x - if it is already present * the previous hfinfo with the same name is saved diff --git a/epan/stats_tree.c b/epan/stats_tree.c index ec533ca7f0..44bfa5f08e 100644 --- a/epan/stats_tree.c +++ b/epan/stats_tree.c @@ -29,7 +29,6 @@ #include #include -#include #include #include "stats_tree.h" diff --git a/epan/strutil.c b/epan/strutil.c index baef77cfd8..a9083a8975 100644 --- a/epan/strutil.c +++ b/epan/strutil.c @@ -146,7 +146,6 @@ get_token_len(const guchar *linep, const guchar *lineend, #define INITIAL_FMTBUF_SIZE 128 -#if GLIB_MAJOR_VERSION >= 2 /* * 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 @@ -161,7 +160,6 @@ get_token_len(const guchar *linep, const guchar *lineend, */ #undef isprint #define isprint(c) (c >= 0x20 && c < 0x7f) -#endif /* * Given a string, generate a string from it that shows non-printable @@ -774,9 +772,6 @@ xml_escape(const gchar *unescaped) GString *buffer = g_string_sized_new(128); const gchar *p; gchar c; -#if GLIB_MAJOR_VERSION < 2 - gchar *ret; -#endif p = unescaped; while ( (c = *p++) ) { @@ -801,19 +796,10 @@ xml_escape(const gchar *unescaped) break; } } -#if GLIB_MAJOR_VERSION >= 2 /* Return the string value contained within the GString * after getting rid of the GString structure. * This is the way to do this, see the GLib reference. */ return g_string_free(buffer, FALSE); -#else - /* But it's not the way to do it in GLib 1.2[.x], as - * 1.2[.x]'s "g_string_free()" doesn't return anything. - * This is the way to do this in GLib 1.2[.x]. */ - ret = buffer->str; - g_string_free(buffer, FALSE); - return ret; -#endif } @@ -956,86 +942,6 @@ convert_string_case(const char *string, gboolean case_insensitive) return out_string; } -/* g_strlcat(), g_strlcpy don't exist in GLib 1.2[.x] */ -#if GLIB_MAJOR_VERSION < 2 -gsize -g_strlcat(gchar *dest, const gchar *src, gsize dest_size) -{ - gchar *d = dest; - const gchar *s = src; - gsize bytes_left = dest_size; - gsize dlength; /* Logically, MIN (strlen (d), dest_size) */ - - /* Find the end of dst and adjust bytes left but don't go past end */ - while (*d != 0 && bytes_left-- != 0) - d++; - dlength = d - dest; - bytes_left = dest_size - dlength; - - if (bytes_left == 0) - return dlength + strlen (s); - - while (*s != 0) - { - if (bytes_left != 1) - { - *d++ = *s; - bytes_left--; - } - s++; - } - *d = 0; - - return dlength + (s - src); /* count does not include NUL */ -} - -/* --------------------------------- */ -gsize -g_strlcpy(gchar *dest, const gchar *src, gsize dest_size) -{ - gchar *d = dest; - const gchar *s = src; - gsize n = dest_size; - - /* Copy as many bytes as will fit */ - if (n != 0 && --n != 0) - do - { - gchar c = *s++; - - *d++ = c; - if (c == 0) - break; - } - while (--n != 0); - - /* If not enough room in dest, add NUL and traverse rest of src */ - if (n == 0) - { - if (dest_size != 0) - *d = 0; - while (*s++) - ; - } - - return s - src - 1; /* count does not include NUL */ -} -#endif - -/* g_byte_array_sized_new() doesnt exist in glib-1.2 */ -#if GLIB_MAJOR_VERSION < 2 -GByteArray * -g_byte_array_sized_new(guint reserved_size) -{ - GByteArray *gba; - - gba = g_byte_array_new(); - g_byte_array_set_size(gba, reserved_size); - - return gba; -} -#endif - char * epan_strcasestr(const char *haystack, const char *needle) { diff --git a/epan/ws_strsplit.c b/epan/ws_strsplit.c deleted file mode 100644 index b0f02e7122..0000000000 --- a/epan/ws_strsplit.c +++ /dev/null @@ -1,82 +0,0 @@ -/* ws_strsplit.c - * String Split utility function - * Code borrowed from GTK2 to override the GTK1 version of g_strsplit, which is - * known to be buggy. - * - * $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#if GLIB_MAJOR_VERSION < 2 -#include -#include - -gchar** ws_strsplit ( const gchar *string, - const gchar *delimiter, - gint max_tokens) -{ - GSList *string_list = NULL, *slist; - gchar **str_array, *s; - guint n = 0; - const gchar *remainder; - - g_return_val_if_fail (string != NULL, NULL); - g_return_val_if_fail (delimiter != NULL, NULL); - g_return_val_if_fail (delimiter[0] != '\0', NULL); - - if (max_tokens < 1) - max_tokens = G_MAXINT; - - remainder = string; - s = strstr (remainder, delimiter); - if (s) { - gsize delimiter_len = strlen (delimiter); - - while (--max_tokens && s) { - gsize len; - gchar *new_string; - - len = s - remainder; - new_string = g_new (gchar, len + 1); - strncpy (new_string, remainder, len); - new_string[len] = 0; - string_list = g_slist_prepend (string_list, new_string); - n++; - remainder = s + delimiter_len; - s = strstr (remainder, delimiter); - } - } - if (*string) { - n++; - string_list = g_slist_prepend (string_list, g_strdup (remainder)); - } - - str_array = g_new (gchar*, n + 1); - - str_array[n--] = NULL; - for (slist = string_list; slist; slist = slist->next) - str_array[n--] = slist->data; - - g_slist_free (string_list); - - return str_array; -} - -#endif /* GLIB_MAJOR_VERSION */ diff --git a/epan/ws_strsplit.h b/epan/ws_strsplit.h deleted file mode 100644 index 3f5280a0b1..0000000000 --- a/epan/ws_strsplit.h +++ /dev/null @@ -1,41 +0,0 @@ -/* ws_strsplit.h - * String Split utility function - * Code borrowed from GTK2 to override the GTK1 version of g_strsplit, which is - * known to be buggy. - * - * $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __WS_STRSPLIT_H__ -#define __WS_STRSPLIT_H__ - -#if GLIB_MAJOR_VERSION < 2 - -#define g_strsplit(s, d, t) ws_strsplit(s, d, t) - -gchar ** ws_strsplit (const gchar *string, - const gchar *delimiter, - gint max_tokens); - -#endif /* GLIB_MAJOR_VERSION */ - -#endif /* __WS_STRSPLIT_H__ */ - diff --git a/epan/wslua/wslua.h b/epan/wslua/wslua.h index 2fdd138249..a036b30b2c 100644 --- a/epan/wslua/wslua.h +++ b/epan/wslua/wslua.h @@ -53,9 +53,6 @@ #include #include #include -#if GLIB_MAJOR_VERSION < 2 -#include -#endif #include "declare_wslua.h" @@ -161,28 +158,17 @@ struct _wslua_tap { int init_ref; }; -#if GLIB_MAJOR_VERSION < 2 -# define DIRECTORY_T DIR -# define FILE_T struct dirent -# define OPENDIR_OP(name) opendir(name) -# define DIRGETNEXT_OP(dir) readdir(dir) -# define GETFNAME_OP(file) (gchar *)file->d_name -# define CLOSEDIR_OP(dir) closedir(dir) -#else /* GLIB 2 */ # define DIRECTORY_T GDir # define FILE_T gchar # define OPENDIR_OP(name) g_dir_open(name, 0, dir->dummy) # define DIRGETNEXT_OP(dir) g_dir_read_name(dir) # define GETFNAME_OP(file) (file); # define CLOSEDIR_OP(dir) g_dir_close(dir) -#endif struct _wslua_dir { DIRECTORY_T* dir; char* ext; -#if GLIB_MAJOR_VERSION >= 2 GError** dummy; -#endif }; diff --git a/gtk/font_utils.c b/gtk/font_utils.c index 0c430b71bd..42537fbe21 100644 --- a/gtk/font_utils.c +++ b/gtk/font_utils.c @@ -32,7 +32,6 @@ #include #include -#include #ifdef _WIN32 #include diff --git a/gtk/uat_gui.c b/gtk/uat_gui.c index 7f798ddac0..2f3d9e938f 100644 --- a/gtk/uat_gui.c +++ b/gtk/uat_gui.c @@ -843,11 +843,9 @@ static gboolean unsaved_dialog(GtkWindow *w _U_, GdkEvent* e _U_, gpointer u) { return TRUE; } -#if (GLIB_MAJOR_VERSION >= 2) static void uat_help_cb(GtkWidget* w _U_, gpointer u) { help_topic_html(ep_strdup_printf("%s.html",((uat_t*)u)->help)); } -#endif static GtkWidget* uat_window(void* u) { uat_t* uat = u; @@ -927,18 +925,15 @@ static GtkWidget* uat_window(void* u) { gtk_tree_selection_set_mode(rep->selection, GTK_SELECTION_SINGLE); #endif -#if (GLIB_MAJOR_VERSION >= 2) if(uat->help) { GtkWidget* help_btn; rep->bbox = dlg_button_row_new(GTK_STOCK_HELP, GTK_STOCK_OK, GTK_STOCK_APPLY, GTK_STOCK_CANCEL, NULL); help_btn = OBJECT_GET_DATA(rep->bbox,GTK_STOCK_HELP); SIGNAL_CONNECT(help_btn, "clicked", uat_help_cb, uat); } else { -#endif + rep->bbox = dlg_button_row_new(GTK_STOCK_OK, GTK_STOCK_APPLY, GTK_STOCK_CANCEL, NULL); -#if (GLIB_MAJOR_VERSION >= 2) } -#endif move_hbox = gtk_vbutton_box_new(); gtk_box_pack_start(GTK_BOX(vbox), move_hbox, TRUE, FALSE, 0); diff --git a/gtk/voip_calls.c b/gtk/voip_calls.c index c049d6f633..6c63e95755 100644 --- a/gtk/voip_calls.c +++ b/gtk/voip_calls.c @@ -66,7 +66,6 @@ #include #include #include -#include #include "alert_box.h" #include "simple_dialog.h" diff --git a/gtk/webbrowser.c b/gtk/webbrowser.c index bbcfd4f4df..0aa6e0c974 100644 --- a/gtk/webbrowser.c +++ b/gtk/webbrowser.c @@ -35,7 +35,6 @@ #include #include -#include #include #include "webbrowser.h" diff --git a/isprint.h b/isprint.h index 1277a6c25f..e4f4d38db9 100644 --- a/isprint.h +++ b/isprint.h @@ -26,7 +26,6 @@ #ifndef __ISPRINT_H__ #define __ISPRINT_H__ -#if GLIB_MAJOR_VERSION >= 2 /* * 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 @@ -34,13 +33,8 @@ * 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. - * - * We don't know what version of GTK+ we're using, as dissectors don't - * use any GTK+ stuff; we use GLib as a proxy for that, with GLib 2.x - * implying GTK+ 1.3 or later (we don't support GLib 1.3[.x]). */ #undef isprint #define isprint(c) (c >= 0x20 && c < 0x7f) -#endif #endif diff --git a/plugins/mate/mate_grammar.lemon b/plugins/mate/mate_grammar.lemon index 5411d7d8e6..6426bcd518 100644 --- a/plugins/mate/mate_grammar.lemon +++ b/plugins/mate/mate_grammar.lemon @@ -28,7 +28,6 @@ #include "mate.h" #include "mate_grammar.h" -#include #include #define DUMMY void* diff --git a/plugins/mate/mate_setup.c b/plugins/mate/mate_setup.c index 8073e9b602..c496aea40d 100644 --- a/plugins/mate/mate_setup.c +++ b/plugins/mate/mate_setup.c @@ -25,7 +25,6 @@ */ #include "mate.h" -#include /* the current mate_config */ static mate_config* matecfg = NULL; diff --git a/plugins/mate/mate_util.c b/plugins/mate/mate_util.c index b6c9984083..d0b9ae7d22 100644 --- a/plugins/mate/mate_util.c +++ b/plugins/mate/mate_util.c @@ -28,7 +28,6 @@ #include "mate.h" #include "mate_util.h" #include -#include /*************************************************************************** * dbg_print diff --git a/tap-funnel.c b/tap-funnel.c index f15b4d77b5..7fed0d2f9d 100644 --- a/tap-funnel.c +++ b/tap-funnel.c @@ -30,7 +30,6 @@ #include #include #include -#include struct _funnel_text_window_t { diff --git a/tools/lemon/lempar.c b/tools/lemon/lempar.c index 97074b5635..58b6b84b11 100644 --- a/tools/lemon/lempar.c +++ b/tools/lemon/lempar.c @@ -252,7 +252,7 @@ const char *ParseTokenName(int tokenType){ ** A pointer to a parser. This pointer is used in subsequent calls ** to Parse and ParseFree. */ -#if (GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 16)) +#if GLIB_CHECK_VERSION(2,16,0) void *ParseAlloc(void *(*mallocProc)(gsize)){ yyParser *pParser; pParser = (yyParser*)(*mallocProc)( (gsize)sizeof(yyParser) ); diff --git a/util.c b/util.c index a9d7f5be5a..098010cfc7 100644 --- a/util.c +++ b/util.c @@ -39,7 +39,6 @@ #include #include -#include #include #include "util.h" diff --git a/wiretap/file_util.h b/wiretap/file_util.h index 57f5a5e30c..61cc64f546 100644 --- a/wiretap/file_util.h +++ b/wiretap/file_util.h @@ -44,7 +44,7 @@ extern "C" { * must tweak a given filename from UTF8 to UTF16 as we use NT Unicode (Win9x * - now unsupported - used locale based encoding here). */ -#if defined _WIN32 && (GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 6)) +#if defined _WIN32 && GLIB_CHECK_VERSION(2,6,0) #include extern int eth_stdio_open (const gchar *filename, int flags, int mode); @@ -65,7 +65,7 @@ extern FILE * eth_stdio_freopen (const gchar *filename, const gchar *mode, FILE #define eth_fopen eth_stdio_fopen #define eth_freopen eth_stdio_freopen -#else /* _WIN32 && GLIB_MAJOR_VERSION */ +#else /* _WIN32 && GLIB_CHECK_VERSION */ /* GLib 2.4 or below, using "old school" functions */ #ifdef _WIN32 @@ -85,7 +85,7 @@ extern FILE * eth_stdio_freopen (const gchar *filename, const gchar *mode, FILE #define eth_fopen fopen #define eth_freopen freopen -#endif /* _WIN32 && GLIB_MAJOR_VERSION */ +#endif /* _WIN32 && GLIB_CHECK_VERSION */ /* some common file function differences between UNIX and WIN32 */ @@ -106,7 +106,6 @@ extern FILE * eth_stdio_freopen (const gchar *filename, const gchar *mode, FILE #endif /* _WIN32 */ /* directory handling */ -#if GLIB_MAJOR_VERSION >= 2 #define ETH_DIR GDir #define ETH_DIRENT const char #define eth_dir_open g_dir_open @@ -114,15 +113,6 @@ extern FILE * eth_stdio_freopen (const gchar *filename, const gchar *mode, FILE #define eth_dir_get_name(dirent) dirent #define eth_dir_rewind g_dir_rewind #define eth_dir_close g_dir_close -#else -#define ETH_DIR DIR -#define ETH_DIRENT struct dirent -#define eth_dir_open(name,flags,error) opendir(name) -#define eth_dir_read_name readdir -#define eth_dir_get_name(dirent) (gchar *)(dirent)->d_name -#define eth_dir_rewind rewinddir -#define eth_dir_close closedir -#endif /* GLIB_MAJOR_VERSION */ /* XXX - remove include "dirent.h" */ /* XXX - remove include "direct.h" */ -- 2.34.1