From 1e1f4e6b5f9a309cef55d4459c8bba40d6acc104 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 16 Mar 2021 02:36:10 -0700 Subject: [PATCH] Move more headers outside 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". --- epan/color_filters.h | 4 ++-- epan/conversation.h | 4 ++-- epan/epan.h | 8 ++++---- epan/epan_dissect.h | 8 ++++---- epan/etypes.h | 4 ++-- epan/follow.h | 8 ++++---- epan/frame_data.h | 8 ++++---- epan/guid-utils.h | 7 +++++++ epan/maxmind_db.h | 8 ++++---- epan/oids.h | 8 ++++---- epan/prefs-int.h | 6 +++--- epan/prefs.h | 7 ++++--- epan/proto_data.h | 4 ++-- epan/rtp_pt.h | 6 +++--- epan/stat_tap_ui.h | 12 ++++++------ epan/value_string.h | 6 +++--- 16 files changed, 58 insertions(+), 50 deletions(-) diff --git a/epan/color_filters.h b/epan/color_filters.h index 4410864..d5c8014 100644 --- a/epan/color_filters.h +++ b/epan/color_filters.h @@ -12,12 +12,12 @@ #include "ws_symbol_export.h" +#include + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include - struct epan_dissect; #define CONVERSATION_COLOR_PREFIX "___conversation_color_filter___" diff --git a/epan/conversation.h b/epan/conversation.h index 0059703..d77a413 100644 --- a/epan/conversation.h +++ b/epan/conversation.h @@ -13,6 +13,8 @@ #include "ws_symbol_export.h" +#include "packet.h" /* for conversation dissector type */ + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -46,8 +48,6 @@ extern "C" { /* Flags to handle endpoints */ #define USE_LAST_ENDPOINT 0x08 /* Use last endpoint created, regardless of type */ -#include "packet.h" /* for conversation dissector type */ - /* Types of port numbers Wireshark knows about. */ typedef enum { ENDPOINT_NONE, /* no endpoint */ diff --git a/epan/epan.h b/epan/epan.h index 95f47f8..76958fa 100644 --- a/epan/epan.h +++ b/epan/epan.h @@ -12,10 +12,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include #include #include @@ -23,6 +19,10 @@ extern "C" { #include "register.h" #include "ws_symbol_export.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + typedef struct epan_dissect epan_dissect_t; struct epan_dfilter; diff --git a/epan/epan_dissect.h b/epan/epan_dissect.h index 956a147..005120b 100644 --- a/epan/epan_dissect.h +++ b/epan/epan_dissect.h @@ -10,15 +10,15 @@ #ifndef EPAN_DISSECT_H #define EPAN_DISSECT_H -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include "epan.h" #include "tvbuff.h" #include "proto.h" #include "packet_info.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* Dissection of a single byte array. Holds tvbuff info as * well as proto_tree info. As long as the epan_dissect_t for a byte * array is in existence, you must not free or move that byte array, diff --git a/epan/etypes.h b/epan/etypes.h index e5928fb..5353ddd 100644 --- a/epan/etypes.h +++ b/epan/etypes.h @@ -13,12 +13,12 @@ #include "ws_symbol_export.h" +#include + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include - /* * Maximum length of an IEEE 802.3 frame; Ethernet type/length values * less than or equal to it are lengths. diff --git a/epan/follow.h b/epan/follow.h index 99b2050..45cfaff 100644 --- a/epan/follow.h +++ b/epan/follow.h @@ -13,16 +13,16 @@ #ifndef __FOLLOW_H__ #define __FOLLOW_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include #include #include #include #include "ws_symbol_export.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + typedef enum { TCP_STREAM = 0, UDP_STREAM, diff --git a/epan/frame_data.h b/epan/frame_data.h index b6fe4e7..19f0b56 100644 --- a/epan/frame_data.h +++ b/epan/frame_data.h @@ -11,16 +11,16 @@ #ifndef __FRAME_DATA_H__ #define __FRAME_DATA_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include #include #include #include +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + struct _packet_info; struct epan_session; diff --git a/epan/guid-utils.h b/epan/guid-utils.h index d937878..b33f50f 100644 --- a/epan/guid-utils.h +++ b/epan/guid-utils.h @@ -25,6 +25,9 @@ typedef struct _e_guid_t { guint8 data4[8]; } e_guid_t; +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ WS_DLL_PUBLIC void guids_init(void); @@ -50,4 +53,8 @@ WS_DLL_PUBLIC const gchar* guids_resolve_guid_to_str(const e_guid_t *guid); WS_DLL_PUBLIC int guid_cmp(const e_guid_t *g1, const e_guid_t *g2); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* __GUID_UTILS_H__ */ diff --git a/epan/maxmind_db.h b/epan/maxmind_db.h index 0bbf668..15e6ecb 100644 --- a/epan/maxmind_db.h +++ b/epan/maxmind_db.h @@ -13,14 +13,14 @@ #ifndef __MAXMIND_DB_H__ #define __MAXMIND_DB_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include #include #include "ws_symbol_export.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + typedef struct _mmdb_lookup_t { gboolean found; const char *country; diff --git a/epan/oids.h b/epan/oids.h index 97075a1..a102c46 100644 --- a/epan/oids.h +++ b/epan/oids.h @@ -13,15 +13,15 @@ #ifndef __OIDS_H__ #define __OIDS_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include #include #include #include "ws_symbol_export.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /** *@file */ diff --git a/epan/prefs-int.h b/epan/prefs-int.h index 8921c00..369a54a 100644 --- a/epan/prefs-int.h +++ b/epan/prefs-int.h @@ -12,14 +12,14 @@ #ifndef __PREFS_INT_H__ #define __PREFS_INT_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ #include #include "ws_symbol_export.h" #include +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ /** *@file */ diff --git a/epan/prefs.h b/epan/prefs.h index 29e4eaf..4229efc 100644 --- a/epan/prefs.h +++ b/epan/prefs.h @@ -13,9 +13,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ #include #include @@ -24,6 +21,10 @@ extern "C" { #include "ws_symbol_export.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #define PR_DEST_CMD 0 #define PR_DEST_FILE 1 diff --git a/epan/proto_data.h b/epan/proto_data.h index 74c61a9..88f3e04 100644 --- a/epan/proto_data.h +++ b/epan/proto_data.h @@ -11,12 +11,12 @@ #ifndef __PROTO_DATA_H__ #define __PROTO_DATA_H__ +#include "ws_symbol_export.h" + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include "ws_symbol_export.h" - /* Allocator should be either pinfo->pool or wmem_file_scope() */ WS_DLL_PUBLIC void p_add_proto_data(wmem_allocator_t *scope, struct _packet_info* pinfo, int proto, guint32 key, void *proto_data); WS_DLL_PUBLIC void *p_get_proto_data(wmem_allocator_t *scope, struct _packet_info* pinfo, int proto, guint32 key); diff --git a/epan/rtp_pt.h b/epan/rtp_pt.h index 74df568..5890a30 100644 --- a/epan/rtp_pt.h +++ b/epan/rtp_pt.h @@ -11,13 +11,13 @@ #ifndef __RTP_PT_H__ #define __RTP_PT_H__ +#include +#include "ws_symbol_export.h" + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include -#include "ws_symbol_export.h" - /* * RTP Payload types * Table B.2 / H.225.0 diff --git a/epan/stat_tap_ui.h b/epan/stat_tap_ui.h index 20eb590..d6fca31 100644 --- a/epan/stat_tap_ui.h +++ b/epan/stat_tap_ui.h @@ -13,6 +13,12 @@ #include "ws_symbol_export.h" +#include +#include +#include +#include +#include + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -21,12 +27,6 @@ extern "C" { * Parameters for taps. */ -#include -#include -#include -#include -#include - typedef enum { PARAM_UINT, /* Unused? */ PARAM_STRING, /* Unused? */ diff --git a/epan/value_string.h b/epan/value_string.h index e6ddd1a..c609695 100644 --- a/epan/value_string.h +++ b/epan/value_string.h @@ -13,13 +13,13 @@ #include +#include "ws_symbol_export.h" +#include "wmem/wmem.h" + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include "ws_symbol_export.h" -#include "wmem/wmem.h" - /* VALUE TO STRING MATCHING */ typedef struct _value_string { -- GitLab