From 8ea0eaa0d0c4a3be05f67ef7fa1d22c2579cf7d1 Mon Sep 17 00:00:00 2001 From: Toni Date: Mon, 12 Jun 2023 17:52:52 +0200 Subject: Fix missing u_char, u_short and u_int typedefs for some platforms e.g.: (#2009) In file included from ../include/ndpi_main.h:34, from ../include/ndpi_api.h:28, from protocols/activision.c:26: ../include/ndpi_typedefs.h:294:3: error: unknown type name 'u_char' 294 | u_char h_dest[6]; /* destination eth addr */ | ^~~~~~ Signed-off-by: Toni Uhlig --- src/include/ndpi_typedefs.h | 14 ++++++++++++++ src/lib/ndpi_main.c | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h index 87c2cb2ef..b04b8b644 100644 --- a/src/include/ndpi_typedefs.h +++ b/src/include/ndpi_typedefs.h @@ -31,6 +31,20 @@ /* Used by both nDPI core and patricia code under third-party */ #include "ndpi_patricia_typedefs.h" +#ifndef NDPI_CFFI_PREPROCESSING +#ifndef u_char +typedef unsigned char u_char; +#endif + +#ifndef u_short +typedef unsigned short u_short; +#endif + +#ifndef u_int +typedef unsigned int u_int; +#endif +#endif + /* NDPI_LOG_LEVEL */ typedef enum { NDPI_LOG_ERROR, diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index da863652c..9253d0f2a 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -8489,7 +8489,8 @@ char *ndpi_strnstr(const char *s, const char *find, size_t slen) { /* ****************************************************** */ /* - * Same as ndpi_strnstr but case-insensitive + * Same as ndpi_strnstr but case-insensitive. + * Please note that this function is *NOT* equivalent to strncasecmp(). */ const char * ndpi_strncasestr(const char *str1, const char *str2, size_t len) { size_t str1_len = strnlen(str1, len); -- cgit v1.2.3