Skip to content

Commit

Permalink
libs/fst: Patch more _MSC_VER checks
Browse files Browse the repository at this point in the history
  • Loading branch information
KrystalDelusion committed Oct 16, 2024
1 parent 6c79d41 commit 139f81c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
39 changes: 39 additions & 0 deletions libs/fst/00_PATCH_win_io.patch
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,42 @@
#include <io.h>
#else
#include <sys/io.h>
--- fstapi.cc
+++ fstapi.cc
@@ -56,7 +56,7 @@
#include <pthread.h>
#endif

-#ifdef __MINGW32__
+#if defined __CYGWIN__ || defined __MINGW32__ || defined _MSC_VER
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
@@ -159,7 +159,7 @@ void **JenkinsIns(void *base_i, const unsigned char *mem, uint32_t length, uint3
/*** ***/
/***********************/

-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(_MSC_VER)
#include <io.h>
#ifndef HAVE_FSEEKO
#define ftello _ftelli64
@@ -341,7 +341,7 @@ return(NULL);
/*
* mmap compatibility
*/
-#if defined __MINGW32__
+#if defined __CYGWIN__ || defined __MINGW32__ || defined _MSC_VER
#include <limits.h>
#define fstMmap(__addr,__len,__prot,__flags,__fd,__off) fstMmap2((__len), (__fd), (__off))
#define fstMunmap(__addr,__len) UnmapViewOfFile((LPCVOID)__addr)
@@ -993,7 +993,7 @@ if(pnt == NULL
)
{
fprintf(stderr, "fstMmap() assigned to %s failed: errno: %d, file %s, line %d.\n", usage, errno, file, line);
-#if !defined(__MINGW32__)
+#if !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(_MSC_VER)
perror("Why");
#else
LPSTR mbuf = NULL;

8 changes: 4 additions & 4 deletions libs/fst/fstapi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
#include <pthread.h>
#endif

#ifdef __MINGW32__
#if defined __CYGWIN__ || defined __MINGW32__ || defined _MSC_VER
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
Expand Down Expand Up @@ -159,7 +159,7 @@ void **JenkinsIns(void *base_i, const unsigned char *mem, uint32_t length, uint3
/*** ***/
/***********************/

#ifdef __MINGW32__
#if defined(__MINGW32__) || defined(_MSC_VER)
#include <io.h>
#ifndef HAVE_FSEEKO
#define ftello _ftelli64
Expand Down Expand Up @@ -341,7 +341,7 @@ return(NULL);
/*
* mmap compatibility
*/
#if defined __MINGW32__
#if defined __CYGWIN__ || defined __MINGW32__ || defined _MSC_VER
#include <limits.h>
#define fstMmap(__addr,__len,__prot,__flags,__fd,__off) fstMmap2((__len), (__fd), (__off))
#define fstMunmap(__addr,__len) UnmapViewOfFile((LPCVOID)__addr)
Expand Down Expand Up @@ -993,7 +993,7 @@ if(pnt == NULL
)
{
fprintf(stderr, "fstMmap() assigned to %s failed: errno: %d, file %s, line %d.\n", usage, errno, file, line);
#if !defined(__MINGW32__)
#if !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(_MSC_VER)
perror("Why");
#else
LPSTR mbuf = NULL;
Expand Down

0 comments on commit 139f81c

Please sign in to comment.