Merge pull request #6881 from lealem47/mingw_pthreads

Fix for pthreads on MSYS2 & MINGW
This commit is contained in:
JacobBarthelmeh
2023-10-17 13:10:05 -06:00
committed by GitHub
2 changed files with 9 additions and 6 deletions

View File

@ -761,8 +761,8 @@ typedef struct w64wrapper {
/* snprintf is used in asn.c for GetTimeString, PKCS7 test, and when
debugging is turned on */
#ifndef XSNPRINTF
#ifndef USE_WINDOWS_API
#ifndef XSNPRINTF
#if defined(WOLFSSL_ESPIDF) && \
(!defined(NO_ASN_TIME) && defined(HAVE_PKCS7))
#include<stdarg.h>
@ -798,7 +798,6 @@ typedef struct w64wrapper {
#include <stdio.h>
#define XSNPRINTF snprintf
#endif
#endif
#else
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
#if defined(_MSC_VER) && (_MSC_VER >= 1900)
@ -834,6 +833,7 @@ typedef struct w64wrapper {
#define XSNPRINTF snprintf
#endif /* _MSC_VER */
#endif /* USE_WINDOWS_API */
#endif /* !XSNPRINTF */
#if defined(WOLFSSL_CERT_EXT) || defined(OPENSSL_EXTRA) || \
defined(HAVE_ALPN) || defined(WOLFSSL_SNIFFER)
@ -1377,8 +1377,7 @@ typedef struct w64wrapper {
typedef unsigned int THREAD_RETURN;
typedef size_t THREAD_TYPE;
#define WOLFSSL_THREAD
#elif (defined(_POSIX_THREADS) || defined(HAVE_PTHREAD)) && \
!defined(__MINGW32__)
#elif (defined(_POSIX_THREADS) || defined(HAVE_PTHREAD))
#ifndef __MACH__
#include <pthread.h>
typedef struct COND_TYPE {

View File

@ -60,6 +60,10 @@
/* THREADING/MUTEX SECTION */
#ifdef USE_WINDOWS_API
#if defined(__MINGW32__) && !defined(SINGLE_THREADED)
#define WOLFSSL_PTHREADS
#include <pthread.h>
#endif
#ifdef WOLFSSL_GAME_BUILD
#include "system/xtl.h"
#else
@ -739,10 +743,10 @@ WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void);
#endif
#ifndef MAX_FILENAME_SZ
#define MAX_FILENAME_SZ 256 /* max file name length */
#define MAX_FILENAME_SZ (260 + 1) /* max file name length */
#endif
#ifndef MAX_PATH
#define MAX_PATH 256
#define MAX_PATH (260 + 1)
#endif
WOLFSSL_LOCAL int wc_FileLoad(const char* fname, unsigned char** buf,