aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2021-11-12 17:23:04 +0000
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-11-15 02:41:59 +0000
commitb30a2112e8896a48c7b7bb921ae03485a2d82c36 (patch)
tree946c9b6a49516b87f719fa524cf1d2be2750c008
parente5088eea4aa265aa0bedb3e8cf531dfd07f1c73f (diff)
regex: Prefer C99/POSIX types
Replace 'gssize' with 'ssize_t'. Add a CMake configure check for ssize_t. Fix missing "config.h" includes.
-rw-r--r--ConfigureChecks.cmake4
-rw-r--r--cmakeconfig.h.in10
-rw-r--r--epan/dissectors/packet-bpsec.c2
-rw-r--r--epan/dissectors/packet-bpv7.c2
-rw-r--r--epan/dissectors/packet-btmesh-beacon.c2
-rw-r--r--epan/dissectors/packet-btmesh-pbadv.c2
-rw-r--r--epan/dissectors/packet-btmesh-provisioning.c2
-rw-r--r--epan/dissectors/packet-btmesh-proxy.c2
-rw-r--r--epan/dissectors/packet-cemi.c2
-rw-r--r--epan/dissectors/packet-knxip.c2
-rw-r--r--epan/dissectors/packet-knxip_decrypt.c2
-rw-r--r--epan/dissectors/packet-tpm20.c2
-rw-r--r--epan/tvbuff_rdp.c2
-rw-r--r--epan/wscbor.c1
-rw-r--r--file_packet_provider.c1
-rw-r--r--plugins/epan/mate/mate_grammar.lemon1
-rw-r--r--ui/qt/capture_file_dialog.cpp2
-rw-r--r--ui/qt/rtp_player_dialog.cpp2
-rw-r--r--ui/qt/utils/frame_information.cpp2
-rw-r--r--ui/qt/widgets/wireshark_file_dialog.cpp2
-rw-r--r--wsutil/regex.c4
-rw-r--r--wsutil/regex.h2
22 files changed, 47 insertions, 6 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 328292e699..786f35c0de 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -103,6 +103,10 @@ check_struct_has_member("struct tm" tm_zone time.h HAVE_STRUC
#Symbols but NOT enums or types
check_symbol_exists(tzname "time.h" HAVE_TZNAME)
+# Types
+include(CheckTypeSize)
+check_type_size("ssize_t" SSIZE_T)
+
#
# Check if the libc vsnprintf() conforms to C99. If this fails we may
# need to fall-back on GLib I/O.
diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in
index a9327993b0..d0deb679dc 100644
--- a/cmakeconfig.h.in
+++ b/cmakeconfig.h.in
@@ -294,10 +294,14 @@
/* Note: not use in the code */
#cmakedefine YYTEXT_POINTER
+/* Define to 1 if the 'ssize_t' type exists. */
+#cmakedefine HAVE_SSIZE_T 1
+
+#ifndef HAVE_SSIZE_T
+# define ssize_t long int
+#endif
+
#if defined(_MSC_VER)
-# if !defined(QT_VERSION) || !defined(_SSIZE_T_DEFINED)
- typedef int ssize_t;
-# endif
# define strncasecmp strnicmp
# define popen _popen
# define pclose _pclose
diff --git a/epan/dissectors/packet-bpsec.c b/epan/dissectors/packet-bpsec.c
index 87fc0e1622..69a5901214 100644
--- a/epan/dissectors/packet-bpsec.c
+++ b/epan/dissectors/packet-bpsec.c
@@ -11,6 +11,8 @@
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
+#include "config.h"
+
#include "packet-bpsec.h"
#include "packet-bpv7.h"
#include <epan/packet.h>
diff --git a/epan/dissectors/packet-bpv7.c b/epan/dissectors/packet-bpv7.c
index d06b01e8f9..1b2d58a64a 100644
--- a/epan/dissectors/packet-bpv7.c
+++ b/epan/dissectors/packet-bpv7.c
@@ -11,6 +11,8 @@
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
+#include "config.h"
+
#include "packet-bpv7.h"
#include "epan/wscbor.h"
#include <epan/packet.h>
diff --git a/epan/dissectors/packet-btmesh-beacon.c b/epan/dissectors/packet-btmesh-beacon.c
index 0e929b696d..4c33173598 100644
--- a/epan/dissectors/packet-btmesh-beacon.c
+++ b/epan/dissectors/packet-btmesh-beacon.c
@@ -13,6 +13,8 @@
* https://www.bluetooth.com/specifications/mesh-specifications
*/
+#include "config.h"
+
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/expert.h>
diff --git a/epan/dissectors/packet-btmesh-pbadv.c b/epan/dissectors/packet-btmesh-pbadv.c
index 6ef16f6e92..5bd55c494e 100644
--- a/epan/dissectors/packet-btmesh-pbadv.c
+++ b/epan/dissectors/packet-btmesh-pbadv.c
@@ -13,6 +13,8 @@
* https://www.bluetooth.com/specifications/mesh-specifications
*/
+#include "config.h"
+
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/reassemble.h>
diff --git a/epan/dissectors/packet-btmesh-provisioning.c b/epan/dissectors/packet-btmesh-provisioning.c
index 802cf9963b..ebce68acd9 100644
--- a/epan/dissectors/packet-btmesh-provisioning.c
+++ b/epan/dissectors/packet-btmesh-provisioning.c
@@ -13,6 +13,8 @@
* https://www.bluetooth.com/specifications/mesh-specifications
*/
+#include "config.h"
+
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/expert.h>
diff --git a/epan/dissectors/packet-btmesh-proxy.c b/epan/dissectors/packet-btmesh-proxy.c
index 6a690e3620..7d0787ed83 100644
--- a/epan/dissectors/packet-btmesh-proxy.c
+++ b/epan/dissectors/packet-btmesh-proxy.c
@@ -13,6 +13,8 @@
* https://www.bluetooth.com/specifications/mesh-specifications
*/
+#include "config.h"
+
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/reassemble.h>
diff --git a/epan/dissectors/packet-cemi.c b/epan/dissectors/packet-cemi.c
index 3ef9daf575..c3741b8fea 100644
--- a/epan/dissectors/packet-cemi.c
+++ b/epan/dissectors/packet-cemi.c
@@ -10,6 +10,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+#include "config.h"
+
#include <epan/packet.h>
#include "packet-knxip.h"
diff --git a/epan/dissectors/packet-knxip.c b/epan/dissectors/packet-knxip.c
index cd82fa2060..f4e715ceea 100644
--- a/epan/dissectors/packet-knxip.c
+++ b/epan/dissectors/packet-knxip.c
@@ -18,6 +18,8 @@
* for the specifications.
*/
+#include "config.h"
+
#include <stdlib.h>
#include <string.h>
diff --git a/epan/dissectors/packet-knxip_decrypt.c b/epan/dissectors/packet-knxip_decrypt.c
index ccf93b0be7..4eaba15a04 100644
--- a/epan/dissectors/packet-knxip_decrypt.c
+++ b/epan/dissectors/packet-knxip_decrypt.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+#include "config.h"
+
#define WS_LOG_DOMAIN "packet-knxip"
#include <wsutil/file_util.h>
diff --git a/epan/dissectors/packet-tpm20.c b/epan/dissectors/packet-tpm20.c
index f4e665f6eb..f3a9ec4f70 100644
--- a/epan/dissectors/packet-tpm20.c
+++ b/epan/dissectors/packet-tpm20.c
@@ -10,6 +10,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+#include "config.h"
+
#include <stdbool.h>
#include <epan/packet.h>
#include <epan/to_str.h>
diff --git a/epan/tvbuff_rdp.c b/epan/tvbuff_rdp.c
index ee7832360c..8487df384b 100644
--- a/epan/tvbuff_rdp.c
+++ b/epan/tvbuff_rdp.c
@@ -8,6 +8,8 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+#include "config.h"
+
#include <glib.h>
#include <stdbool.h>
diff --git a/epan/wscbor.c b/epan/wscbor.c
index ac250fa2fc..3e839ef741 100644
--- a/epan/wscbor.c
+++ b/epan/wscbor.c
@@ -11,6 +11,7 @@
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
+#include "config.h"
#include <epan/packet.h>
#include <epan/exceptions.h>
diff --git a/file_packet_provider.c b/file_packet_provider.c
index c9ca08e7e3..1b92eebca0 100644
--- a/file_packet_provider.c
+++ b/file_packet_provider.c
@@ -7,6 +7,7 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+#include "config.h"
#include <glib.h>
diff --git a/plugins/epan/mate/mate_grammar.lemon b/plugins/epan/mate/mate_grammar.lemon
index 0947afa2e5..73b320d8d6 100644
--- a/plugins/epan/mate/mate_grammar.lemon
+++ b/plugins/epan/mate/mate_grammar.lemon
@@ -19,6 +19,7 @@
#ifndef NDEBUG
#define NDEBUG
#endif
+#include "config.h"
#include "mate.h"
#include "mate_grammar.h"
diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp
index bb56b7b2be..e8715bebad 100644
--- a/ui/qt/capture_file_dialog.cpp
+++ b/ui/qt/capture_file_dialog.cpp
@@ -7,6 +7,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+#include "config.h"
+
#include "file.h"
#include <wiretap/wtap.h>
diff --git a/ui/qt/rtp_player_dialog.cpp b/ui/qt/rtp_player_dialog.cpp
index 6e5f5f9160..d4dec83638 100644
--- a/ui/qt/rtp_player_dialog.cpp
+++ b/ui/qt/rtp_player_dialog.cpp
@@ -7,6 +7,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+#include "config.h"
+
#include <ui/rtp_media.h>
#include <ui/tap-rtp-common.h>
#include "rtp_player_dialog.h"
diff --git a/ui/qt/utils/frame_information.cpp b/ui/qt/utils/frame_information.cpp
index ef0b849564..d344bc0403 100644
--- a/ui/qt/utils/frame_information.cpp
+++ b/ui/qt/utils/frame_information.cpp
@@ -7,6 +7,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+#include "config.h"
+
#include <epan/epan_dissect.h>
#include "epan/epan.h"
#include "epan/column.h"
diff --git a/ui/qt/widgets/wireshark_file_dialog.cpp b/ui/qt/widgets/wireshark_file_dialog.cpp
index 332d394e7c..acf9c7db50 100644
--- a/ui/qt/widgets/wireshark_file_dialog.cpp
+++ b/ui/qt/widgets/wireshark_file_dialog.cpp
@@ -7,6 +7,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+#include "config.h"
+
#include "wireshark_file_dialog.h"
#ifdef Q_OS_WIN
diff --git a/wsutil/regex.c b/wsutil/regex.c
index 86ce6625a3..83caa96291 100644
--- a/wsutil/regex.c
+++ b/wsutil/regex.c
@@ -83,7 +83,7 @@ ws_regex_compile(const char *patt, char **errmsg)
static bool
-match_pcre2(pcre2_code *code, const char *subj, gssize subj_size)
+match_pcre2(pcre2_code *code, const char *subj, ssize_t subj_size)
{
PCRE2_SIZE length;
pcre2_match_data *match_data;
@@ -123,7 +123,7 @@ match_pcre2(pcre2_code *code, const char *subj, gssize subj_size)
bool
-ws_regex_matches(const ws_regex_t *re, const char *subj, gssize subj_size)
+ws_regex_matches(const ws_regex_t *re, const char *subj, ssize_t subj_size)
{
ws_return_val_if_null(re, FALSE);
ws_return_val_if_null(subj, FALSE);
diff --git a/wsutil/regex.h b/wsutil/regex.h
index 9f5803a085..12c7cffe80 100644
--- a/wsutil/regex.h
+++ b/wsutil/regex.h
@@ -23,7 +23,7 @@ WS_DLL_PUBLIC ws_regex_t *
ws_regex_compile(const char *patt, char **errmsg);
WS_DLL_PUBLIC bool
-ws_regex_matches(const ws_regex_t *re, const char *subj, gssize subj_size);
+ws_regex_matches(const ws_regex_t *re, const char *subj, ssize_t subj_size);
WS_DLL_PUBLIC void
ws_regex_free(ws_regex_t *re);