From: Alberto Leiva Popper Date: Wed, 27 Sep 2023 20:50:26 +0000 (-0600) Subject: Remove some of the asn1c and uthash glue code X-Git-Tag: 1.6.0~64 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cf3ff126a280f5ccca0ac6fc5a5823979a88172e;p=thirdparty%2FFORT-validator.git Remove some of the asn1c and uthash glue code The asn1c stuff was autogenerated, and the uthash stuff was copy-pasted from its source project. None of it serves any purpose. I'm not allergic to the possibility of supporting these other environments, but this is not the time for it. Also, it probably doesn't work anyway, since it has never been tested in the context of Fort. This doesn't delete all the glue code; only the necessary parts needed for the upcoming commit. --- diff --git a/src/asn1/asn1c/GeneralizedTime.c b/src/asn1/asn1c/GeneralizedTime.c index 11515c5c..a7fedc39 100644 --- a/src/asn1/asn1c/GeneralizedTime.c +++ b/src/asn1/asn1c/GeneralizedTime.c @@ -14,44 +14,10 @@ #include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/GeneralizedTime.h" -#ifdef __CYGWIN__ -#include "/usr/include/time.h" -#else #include -#endif /* __CYGWIN__ */ - #include #include -#if defined(_WIN32) -#pragma message( "PLEASE STOP AND READ!") -#pragma message( " localtime_r is implemented via localtime(), which may be not thread-safe.") -#pragma message( " gmtime_r is implemented via gmtime(), which may be not thread-safe.") -#pragma message( " ") -#pragma message( " You must fix the code by inserting appropriate locking") -#pragma message( " if you want to use asn_GT2time() or asn_UT2time().") -#pragma message( "PLEASE STOP AND READ!") - -static struct tm *localtime_r(const time_t *tloc, struct tm *result) { - struct tm *tm; - if((tm = localtime(tloc))) - return memcpy(result, tm, sizeof(struct tm)); - return 0; -} - -static struct tm *gmtime_r(const time_t *tloc, struct tm *result) { - struct tm *tm; - if((tm = gmtime(tloc))) - return memcpy(result, tm, sizeof(struct tm)); - return 0; -} - -#define tzset() _tzset() -#define putenv(c) _putenv(c) -#define _EMULATE_TIMEGM - -#endif /* _WIN32 */ - #if defined(sun) || defined(__sun) || defined(__solaris__) #define _EMULATE_TIMEGM #endif @@ -76,14 +42,6 @@ static struct tm *gmtime_r(const time_t *tloc, struct tm *result) { #define GMTOFF(tm) (-timezone) #endif /* HAVE_TM_GMTOFF */ -#if defined(_WIN32) -#pragma message( "PLEASE STOP AND READ!") -#pragma message( " timegm() is implemented via getenv(\"TZ\")/setenv(\"TZ\"), which may be not thread-safe.") -#pragma message( " ") -#pragma message( " You must fix the code by inserting appropriate locking") -#pragma message( " if you want to use asn_GT2time() or asn_UT2time().") -#pragma message( "PLEASE STOP AND READ!") -#else #if (defined(_EMULATE_TIMEGM) || !defined(HAVE_TM_GMTOFF)) #warning "PLEASE STOP AND READ!" #warning " timegm() is implemented via getenv(\"TZ\")/setenv(\"TZ\"), which may be not thread-safe." @@ -92,29 +50,6 @@ static struct tm *gmtime_r(const time_t *tloc, struct tm *result) { #warning " if you want to use asn_GT2time() or asn_UT2time()." #warning "PLEASE STOP AND READ!" #endif /* _EMULATE_TIMEGM */ -#endif - -/* - * Override our GMTOFF decision for other known platforms. - */ -#ifdef __CYGWIN__ -#undef GMTOFF -static long GMTOFF(struct tm a){ - struct tm *lt; - time_t local_time, gmt_time; - long zone; - - tzset(); - gmt_time = time (NULL); - - lt = gmtime(&gmt_time); - - local_time = mktime(lt); - return (gmt_time - local_time); -} -#define _EMULATE_TIMEGM - -#endif /* __CYGWIN__ */ #define ATZVARS do { \ char tzoldbuf[64]; \ diff --git a/src/asn1/asn1c/UTCTime.c b/src/asn1/asn1c/UTCTime.c index 37fa8dd0..77d17912 100644 --- a/src/asn1/asn1c/UTCTime.c +++ b/src/asn1/asn1c/UTCTime.c @@ -5,13 +5,9 @@ #include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/UTCTime.h" #include "asn1/asn1c/GeneralizedTime.h" -#include -#ifdef __CYGWIN__ -#include "/usr/include/time.h" -#else +#include #include -#endif /* __CYGWIN__ */ #ifndef ASN___INTERNAL_TEST_MODE diff --git a/src/asn1/asn1c/asn_system.h b/src/asn1/asn1c/asn_system.h index fa8cf116..a23ad8b6 100644 --- a/src/asn1/asn1c/asn_system.h +++ b/src/asn1/asn1c/asn_system.h @@ -28,48 +28,6 @@ #include /* For va_start */ #include /* for offsetof and ptrdiff_t */ -#ifdef _WIN32 - -#include -#define snprintf _snprintf -#define vsnprintf _vsnprintf - -/* To avoid linking with ws2_32.lib, here's the definition of ntohl() */ -#define sys_ntohl(l) ((((l) << 24) & 0xff000000) \ - | (((l) << 8) & 0xff0000) \ - | (((l) >> 8) & 0xff00) \ - | ((l >> 24) & 0xff)) - -#ifdef _MSC_VER /* MSVS.Net */ -#ifndef __cplusplus -#define inline __inline -#endif -#ifndef ASSUMESTDTYPES /* Standard types have been defined elsewhere */ -#define ssize_t SSIZE_T -#if _MSC_VER < 1600 -typedef char int8_t; -typedef short int16_t; -typedef int int32_t; -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; -#else /* _MSC_VER >= 1600 */ -#include -#endif /* _MSC_VER < 1600 */ -#endif /* ASSUMESTDTYPES */ -#define WIN32_LEAN_AND_MEAN -#include -#include -#define isnan _isnan -#define finite _finite -#define copysign _copysign -#define ilogb _logb -#else /* !_MSC_VER */ -#include -#endif /* _MSC_VER */ - -#else /* !_WIN32 */ - #if defined(__vxworks) #include #else /* !defined(__vxworks) */ @@ -79,8 +37,6 @@ typedef unsigned int uint32_t; #define sys_ntohl(foo) ntohl(foo) #endif /* defined(__vxworks) */ -#endif /* _WIN32 */ - #if __GNUC__ >= 3 || defined(__clang__) #define CC_ATTRIBUTE(attr) __attribute__((attr)) #else diff --git a/src/data_structure/uthash.h b/src/data_structure/uthash.h index a790ea59..d0ac4a7f 100644 --- a/src/data_structure/uthash.h +++ b/src/data_structure/uthash.h @@ -62,22 +62,7 @@ do { } while (0) #endif -/* a number of the hash function use uint32_t which isn't defined on Pre VS2010 */ -#if defined(_WIN32) -#if defined(_MSC_VER) && _MSC_VER >= 1600 #include -#elif defined(__WATCOMC__) || defined(__MINGW32__) || defined(__CYGWIN__) -#include -#else -typedef unsigned int uint32_t; -typedef unsigned char uint8_t; -#endif -#elif defined(__GNUC__) && !defined(__VXWORKS__) -#include -#else -typedef unsigned int uint32_t; -typedef unsigned char uint8_t; -#endif #ifndef uthash_malloc #define uthash_malloc(sz) malloc(sz) /* malloc fcn */