Don't use Win32 API on Cygwin

Cygwin is a Posix platform to the extent possible.  It should use the
Posix API except in special circumstances.
This commit is contained in:
Ken Brown 2018-11-12 21:05:39 -05:00
parent 6c22f3fd95
commit eee5b5ed04
5 changed files with 9 additions and 9 deletions

View File

@ -100,7 +100,7 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
#define hb_atomic_ptr_impl_cmpexch(P,O,N) _hb_atomic_ptr_impl_cmplexch ((const void **) (P), (O), (N)) #define hb_atomic_ptr_impl_cmpexch(P,O,N) _hb_atomic_ptr_impl_cmplexch ((const void **) (P), (O), (N))
#elif !defined(HB_NO_MT) && (defined(_WIN32) || defined(__CYGWIN__)) #elif !defined(HB_NO_MT) && defined(_WIN32)
#include <windows.h> #include <windows.h>

View File

@ -481,7 +481,7 @@ hb_blob_t::try_make_writable (void)
# include <fcntl.h> # include <fcntl.h>
#endif #endif
#if defined(_WIN32) || defined(__CYGWIN__) #ifdef _WIN32
# include <windows.h> # include <windows.h>
#else #else
# ifndef O_BINARY # ifndef O_BINARY
@ -497,19 +497,19 @@ struct hb_mapped_file_t
{ {
char *contents; char *contents;
unsigned long length; unsigned long length;
#if defined(_WIN32) || defined(__CYGWIN__) #ifdef _WIN32
HANDLE mapping; HANDLE mapping;
#endif #endif
}; };
#if (defined(HAVE_MMAP) || defined(_WIN32) || defined(__CYGWIN__)) && !defined(HB_NO_MMAP) #if (defined(HAVE_MMAP) || defined(_WIN32)) && !defined(HB_NO_MMAP)
static void static void
_hb_mapped_file_destroy (void *file_) _hb_mapped_file_destroy (void *file_)
{ {
hb_mapped_file_t *file = (hb_mapped_file_t *) file_; hb_mapped_file_t *file = (hb_mapped_file_t *) file_;
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
munmap (file->contents, file->length); munmap (file->contents, file->length);
#elif defined(_WIN32) || defined(__CYGWIN__) #elif defined(_WIN32)
UnmapViewOfFile (file->contents); UnmapViewOfFile (file->contents);
CloseHandle (file->mapping); CloseHandle (file->mapping);
#else #else
@ -560,7 +560,7 @@ fail:
fail_without_close: fail_without_close:
free (file); free (file);
#elif (defined(_WIN32) || defined(__CYGWIN__)) && !defined(HB_NO_MMAP) #elif defined(_WIN32) && !defined(HB_NO_MMAP)
hb_mapped_file_t *file = (hb_mapped_file_t *) calloc (1, sizeof (hb_mapped_file_t)); hb_mapped_file_t *file = (hb_mapped_file_t *) calloc (1, sizeof (hb_mapped_file_t));
if (unlikely (!file)) return hb_blob_get_empty (); if (unlikely (!file)) return hb_blob_get_empty ();

View File

@ -48,7 +48,7 @@
/* Defined externally, i.e. in config.h; must have typedef'ed hb_mutex_impl_t as well. */ /* Defined externally, i.e. in config.h; must have typedef'ed hb_mutex_impl_t as well. */
#elif !defined(HB_NO_MT) && (defined(_WIN32) || defined(__CYGWIN__)) #elif !defined(HB_NO_MT) && defined(_WIN32)
#include <windows.h> #include <windows.h>
typedef CRITICAL_SECTION hb_mutex_impl_t; typedef CRITICAL_SECTION hb_mutex_impl_t;

View File

@ -202,7 +202,7 @@ struct arabic_fallback_plan_t
OT::hb_ot_layout_lookup_accelerator_t accel_array[ARABIC_FALLBACK_MAX_LOOKUPS]; OT::hb_ot_layout_lookup_accelerator_t accel_array[ARABIC_FALLBACK_MAX_LOOKUPS];
}; };
#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(HB_NO_WIN1256) #if defined(_WIN32) && !defined(HB_NO_WIN1256)
#define HB_WITH_WIN1256 #define HB_WITH_WIN1256
#endif #endif

View File

@ -246,7 +246,7 @@ struct _hb_alignof
#endif #endif
#if defined(_WIN32) || defined(__CYGWIN__) #ifdef _WIN32
/* We need Windows Vista for both Uniscribe backend and for /* We need Windows Vista for both Uniscribe backend and for
* MemoryBarrier. We don't support compiling on Windows XP, * MemoryBarrier. We don't support compiling on Windows XP,
* though we run on it fine. */ * though we run on it fine. */