regex: Prefer C99/POSIX types

Replace 'gssize' with 'ssize_t'.

Add a CMake configure check for ssize_t.

Fix missing "config.h" includes.
This commit is contained in:
João Valverde 2021-11-12 17:23:04 +00:00 committed by Wireshark GitLab Utility
parent e5088eea4a
commit b30a2112e8
22 changed files with 47 additions and 6 deletions

View File

@ -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.

View File

@ -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

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -10,6 +10,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "config.h"
#include <epan/packet.h>
#include "packet-knxip.h"

View File

@ -18,6 +18,8 @@
* for the specifications.
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>

View File

@ -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>

View File

@ -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>

View File

@ -8,6 +8,8 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "config.h"
#include <glib.h>
#include <stdbool.h>

View File

@ -11,6 +11,7 @@
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "config.h"
#include <epan/packet.h>
#include <epan/exceptions.h>

View File

@ -7,6 +7,7 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "config.h"
#include <glib.h>

View File

@ -19,6 +19,7 @@
#ifndef NDEBUG
#define NDEBUG
#endif
#include "config.h"
#include "mate.h"
#include "mate_grammar.h"

View File

@ -7,6 +7,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "config.h"
#include "file.h"
#include <wiretap/wtap.h>

View File

@ -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"

View File

@ -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"

View File

@ -7,6 +7,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "config.h"
#include "wireshark_file_dialog.h"
#ifdef Q_OS_WIN

View File

@ -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);

View File

@ -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);