From 2820156fbd4b0213ca015216d8cd97c31b503c8c Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 16 Mar 2021 13:50:13 -0700 Subject: [PATCH] Move still *more* headers outside of extern "C". If a header declares a function, or anything else requiring the extern "C" decoration, have it wrap the declaration itself; don't rely on the header itself being included inside extern "C". --- capchild/capture_session.h | 10 ++++++---- caputils/capture-pcap-util.h | 8 ++++---- caputils/ws80211_utils.h | 4 ++-- .../asn1/kerberos/packet-kerberos-template.h | 4 ++-- epan/dissectors/packet-a21.h | 4 ++-- epan/dissectors/packet-bluetooth.h | 8 ++++---- epan/dissectors/packet-scsi.h | 6 +++--- epan/dissectors/packet-tcp.h | 8 ++++---- epan/dissectors/packet-udp.h | 8 ++++---- epan/wmem/wmem_user_cb_int.h | 4 ++-- epan/wslua/init_wslua.h | 6 +++--- ui/export_object_ui.h | 4 ++-- ui/mcast_stream.h | 4 ++-- ui/packet_range.h | 8 ++++---- ui/proto_hier_stats.h | 6 +++--- ui/recent.h | 8 ++++---- ui/rtp_stream.h | 16 ++++++++-------- ui/tap-rlc-graph.h | 8 ++++---- ui/tap-sctp-analysis.h | 14 +++++++------- ui/voip_calls.h | 18 +++++++++--------- 20 files changed, 79 insertions(+), 77 deletions(-) diff --git a/capchild/capture_session.h b/capchild/capture_session.h index bdf1af3..0bf9565 100644 --- a/capchild/capture_session.h +++ b/capchild/capture_session.h @@ -10,10 +10,6 @@ #ifndef __CAPCHILD_CAPTURE_SESSION_H__ #define __CAPCHILD_CAPTURE_SESSION_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #ifndef _WIN32 #include #include @@ -23,6 +19,12 @@ extern "C" { #include +#include "cfile.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #ifdef HAVE_LIBPCAP /* Current state of capture engine. XXX - differentiate states */ typedef enum { diff --git a/caputils/capture-pcap-util.h b/caputils/capture-pcap-util.h index c9e1f55..486cee9 100644 --- a/caputils/capture-pcap-util.h +++ b/caputils/capture-pcap-util.h @@ -10,10 +10,6 @@ #ifndef __CAPTURE_PCAP_UTIL_H__ #define __CAPTURE_PCAP_UTIL_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #ifdef HAVE_LIBPCAP #include @@ -29,6 +25,10 @@ extern "C" { */ #define MIN_PACKET_SIZE 1 /* minimum amount of packet data we can read */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + GList *get_interface_list(int *err, char **err_str); #ifdef HAVE_PCAP_REMOTE GList *get_remote_interface_list(const char *hostname, const char *port, diff --git a/caputils/ws80211_utils.h b/caputils/ws80211_utils.h index a8b28cc..e90bc90 100644 --- a/caputils/ws80211_utils.h +++ b/caputils/ws80211_utils.h @@ -10,12 +10,12 @@ #ifndef __WS80211_UTILS_H__ #define __WS80211_UTILS_H__ +#include "ws_attributes.h" + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include "ws_attributes.h" - enum ws80211_channel_type { WS80211_CHAN_NO_HT, WS80211_CHAN_HT20, diff --git a/epan/dissectors/asn1/kerberos/packet-kerberos-template.h b/epan/dissectors/asn1/kerberos/packet-kerberos-template.h index f29fa68..3ca9f5e 100644 --- a/epan/dissectors/asn1/kerberos/packet-kerberos-template.h +++ b/epan/dissectors/asn1/kerberos/packet-kerberos-template.h @@ -12,12 +12,12 @@ #ifndef __PACKET_KERBEROS_H #define __PACKET_KERBEROS_H -#include "ws_symbol_export.h" - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ +#include "ws_symbol_export.h" + /* This is a list of callback functions a caller can use to specify that octet strings in kerberos to be passed back to application specific dissectors, outside of kerberos. diff --git a/epan/dissectors/packet-a21.h b/epan/dissectors/packet-a21.h index 1877aa3..802b650 100644 --- a/epan/dissectors/packet-a21.h +++ b/epan/dissectors/packet-a21.h @@ -10,12 +10,12 @@ #ifndef __PACKET_A21_H__ #define __PACKET_A21_H__ +#include "ws_symbol_export.h" + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include "ws_symbol_export.h" - WS_DLL_PUBLIC void dissect_a21_ie_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree, proto_tree *tree, gint offset, guint8 message_type); diff --git a/epan/dissectors/packet-bluetooth.h b/epan/dissectors/packet-bluetooth.h index d59411b..0bd23f8 100644 --- a/epan/dissectors/packet-bluetooth.h +++ b/epan/dissectors/packet-bluetooth.h @@ -10,15 +10,15 @@ #ifndef __PACKET_BLUETOOTH_H__ #define __PACKET_BLUETOOTH_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include #include "packet-usb.h" #include "packet-ubertooth.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #define PROTO_DATA_BLUETOOTH_SERVICE_UUID 0 #define BLUETOOTH_DATA_SRC 0 diff --git a/epan/dissectors/packet-scsi.h b/epan/dissectors/packet-scsi.h index 408414e..4dce427 100644 --- a/epan/dissectors/packet-scsi.h +++ b/epan/dissectors/packet-scsi.h @@ -11,13 +11,13 @@ #ifndef __PACKET_SCSI_H_ #define __PACKET_SCSI_H_ +#include +#include + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include -#include - /* Structure containing itl nexus data : * The itlq nexus is a structure containing data specific * for a initiator target lun combination. diff --git a/epan/dissectors/packet-tcp.h b/epan/dissectors/packet-tcp.h index 3d2530f..255e4ab 100644 --- a/epan/dissectors/packet-tcp.h +++ b/epan/dissectors/packet-tcp.h @@ -10,16 +10,16 @@ #ifndef __PACKET_TCP_H__ #define __PACKET_TCP_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include "ws_symbol_export.h" #include #include #include +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* TCP flags */ #define TH_FIN 0x0001 #define TH_SYN 0x0002 diff --git a/epan/dissectors/packet-udp.h b/epan/dissectors/packet-udp.h index 30857cb..6109ef4 100644 --- a/epan/dissectors/packet-udp.h +++ b/epan/dissectors/packet-udp.h @@ -11,14 +11,14 @@ #ifndef __PACKET_UDP_H__ #define __PACKET_UDP_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include "ws_symbol_export.h" #include +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* UDP structs and definitions */ typedef struct _e_udphdr { guint16 uh_sport; diff --git a/epan/wmem/wmem_user_cb_int.h b/epan/wmem/wmem_user_cb_int.h index ae51917..205f35f 100644 --- a/epan/wmem/wmem_user_cb_int.h +++ b/epan/wmem/wmem_user_cb_int.h @@ -14,12 +14,12 @@ #include +#include "wmem_user_cb.h" + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include "wmem_user_cb.h" - WS_DLL_LOCAL void wmem_call_callbacks(wmem_allocator_t *allocator, wmem_cb_event_t event); diff --git a/epan/wslua/init_wslua.h b/epan/wslua/init_wslua.h index 8edb777..1fd0e88 100644 --- a/epan/wslua/init_wslua.h +++ b/epan/wslua/init_wslua.h @@ -11,13 +11,13 @@ #ifndef __INIT_WSLUA_H__ #define __INIT_WSLUA_H__ +#include "epan/register.h" +#include "ws_symbol_export.h" + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include "epan/register.h" -#include "ws_symbol_export.h" - WS_DLL_PUBLIC int wslua_count_plugins(void); WS_DLL_PUBLIC void wslua_reload_plugins (register_cb cb, gpointer client_data); diff --git a/ui/export_object_ui.h b/ui/export_object_ui.h index d0a80a1..6821c94 100644 --- a/ui/export_object_ui.h +++ b/ui/export_object_ui.h @@ -12,12 +12,12 @@ #ifndef __EXPORT_OBJECT_UI_H__ #define __EXPORT_OBJECT_UI_H__ +#include + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include - /* Common between protocols */ gboolean eo_save_entry(const gchar *save_as_filename, export_object_entry_t *entry, gboolean show_err); diff --git a/ui/mcast_stream.h b/ui/mcast_stream.h index 89d4bab..02b5ee9 100644 --- a/ui/mcast_stream.h +++ b/ui/mcast_stream.h @@ -18,12 +18,12 @@ #ifndef __MCAST_STREAM_H__ #define __MCAST_STREAM_H__ +#include + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include - #define MAX_SPEED 200000 /* typedefs for sliding window and buffer size */ diff --git a/ui/packet_range.h b/ui/packet_range.h index e9b63c0..c1add38 100644 --- a/ui/packet_range.h +++ b/ui/packet_range.h @@ -15,15 +15,15 @@ #include -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include #include #include "cfile.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + extern guint32 curr_selected_frame; typedef enum { diff --git a/ui/proto_hier_stats.h b/ui/proto_hier_stats.h index e3b4259..601263a 100644 --- a/ui/proto_hier_stats.h +++ b/ui/proto_hier_stats.h @@ -10,6 +10,9 @@ #ifndef __UI_PROTO_HIER_STATS_H__ #define __UI_PROTO_HIER_STATS_H__ +#include +#include "cfile.h" + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -18,9 +21,6 @@ extern "C" { * Protocol Hierarchy Statistics */ -#include -#include "cfile.h" - typedef struct { header_field_info *hfinfo; guint num_pkts_total; diff --git a/ui/recent.h b/ui/recent.h index a29b681..a2b3b1c 100644 --- a/ui/recent.h +++ b/ui/recent.h @@ -14,14 +14,14 @@ #include -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include #include "epan/timestamp.h" #include "ui/ws_ui_util.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /** @file * Recent user interface settings. * @ingroup main_window_group diff --git a/ui/rtp_stream.h b/ui/rtp_stream.h index 65754a2..c6d0e35 100644 --- a/ui/rtp_stream.h +++ b/ui/rtp_stream.h @@ -16,6 +16,14 @@ #include +#include "tap-rtp-analysis.h" +#include + +#include "cfile.h" + +#include +#include + /** @file * "RTP Streams" dialog box common routines. * @ingroup main_ui_group @@ -25,14 +33,6 @@ extern "C" { #endif /* __cplusplus */ -#include "tap-rtp-analysis.h" -#include - -#include "cfile.h" - -#include -#include - /** Defines an rtp stream */ typedef struct _rtp_stream_info { address src_addr; diff --git a/ui/tap-rlc-graph.h b/ui/tap-rlc-graph.h index 8dfdc24..333bef3 100644 --- a/ui/tap-rlc-graph.h +++ b/ui/tap-rlc-graph.h @@ -10,15 +10,15 @@ #ifndef __TAP_RLC_GRAPH_H__ #define __TAP_RLC_GRAPH_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include #include #include #include +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + struct rlc_segment { struct rlc_segment *next; guint32 num; /* framenum */ diff --git a/ui/tap-sctp-analysis.h b/ui/tap-sctp-analysis.h index 16f7a23..2120e47 100644 --- a/ui/tap-sctp-analysis.h +++ b/ui/tap-sctp-analysis.h @@ -11,20 +11,20 @@ #ifndef __TAP_SCTP_ANALYSIS_H__ #define __TAP_SCTP_ANALYSIS_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include #include -#ifndef _WIN32 +#ifdef _WIN32 +#include +#else #include #include #include -#else -#include #endif +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #define CHUNK_TYPE_LENGTH 1 #define CHUNK_FLAGS_LENGTH 1 #define CHUNK_LENGTH_LENGTH 2 diff --git a/ui/voip_calls.h b/ui/voip_calls.h index 3f0b76a..7862f35 100644 --- a/ui/voip_calls.h +++ b/ui/voip_calls.h @@ -24,15 +24,6 @@ #include -/** @file - * "VoIP Calls" dialog box common routines. - * @ingroup main_ui_group - */ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include #include "epan/address.h" @@ -42,6 +33,15 @@ extern "C" { #include "epan/tap-voip.h" #include "epan/sequence_analysis.h" +/** @file + * "VoIP Calls" dialog box common routines. + * @ingroup main_ui_group + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /****************************************************************************/ extern const char *voip_call_state_name[8]; -- GitLab