From 1562ba695a9bd7332928923cc5f5a30847894ac5 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Mon, 17 May 2021 11:54:46 +0200 Subject: [PATCH] Ensure compatibility with Cygwin G_PLATFORM_WIN32 is no longer defined for Cygwin. --- libvips/iofuncs/source.c | 4 ++-- libvips/iofuncs/target.c | 4 ++-- libvips/iofuncs/util.c | 16 ++++++++-------- libvips/iofuncs/vips.c | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/libvips/iofuncs/source.c b/libvips/iofuncs/source.c index 25ea18fe..844135eb 100644 --- a/libvips/iofuncs/source.c +++ b/libvips/iofuncs/source.c @@ -76,13 +76,13 @@ /* Try to make an O_BINARY ... sometimes need the leading '_'. */ -#ifdef G_PLATFORM_WIN32 +#if defined(G_PLATFORM_WIN32) || defined(G_WITH_CYGWIN) #ifndef O_BINARY #ifdef _O_BINARY #define O_BINARY _O_BINARY #endif /*_O_BINARY*/ #endif /*!O_BINARY*/ -#endif /*G_PLATFORM_WIN32*/ +#endif /*defined(G_PLATFORM_WIN32) || defined(G_WITH_CYGWIN)*/ /* If we have O_BINARY, add it to a mode flags set. */ diff --git a/libvips/iofuncs/target.c b/libvips/iofuncs/target.c index 667edff1..29270261 100644 --- a/libvips/iofuncs/target.c +++ b/libvips/iofuncs/target.c @@ -66,13 +66,13 @@ /* Try to make an O_BINARY ... sometimes need the leading '_'. */ -#ifdef G_PLATFORM_WIN32 +#if defined(G_PLATFORM_WIN32) || defined(G_WITH_CYGWIN) #ifndef O_BINARY #ifdef _O_BINARY #define O_BINARY _O_BINARY #endif /*_O_BINARY*/ #endif /*!O_BINARY*/ -#endif /*G_PLATFORM_WIN32*/ +#endif /*defined(G_PLATFORM_WIN32) || defined(G_WITH_CYGWIN)*/ /* If we have O_BINARY, add it to a mode flags set. */ diff --git a/libvips/iofuncs/util.c b/libvips/iofuncs/util.c index cab00298..5a420fb0 100644 --- a/libvips/iofuncs/util.c +++ b/libvips/iofuncs/util.c @@ -67,13 +67,13 @@ /* Try to make an O_BINARY ... sometimes need the leading '_'. */ -#ifdef G_PLATFORM_WIN32 +#if defined(G_PLATFORM_WIN32) || defined(G_WITH_CYGWIN) #ifndef O_BINARY #ifdef _O_BINARY #define O_BINARY _O_BINARY #endif /*_O_BINARY*/ #endif /*!O_BINARY*/ -#endif /*G_PLATFORM_WIN32*/ +#endif /*defined(G_PLATFORM_WIN32) || defined(G_WITH_CYGWIN)*/ /* If we have O_BINARY, add it to a mode flags set. */ @@ -698,14 +698,14 @@ vips__file_open_read( const char *filename, const char *fallback_dir, char *mode; FILE *fp; -#ifdef G_PLATFORM_WIN32 +#if defined(G_PLATFORM_WIN32) || defined(G_WITH_CYGWIN) if( text_mode ) mode = "r"; else mode = "rb"; -#else /*!G_PLATFORM_WIN32*/ +#else /*!defined(G_PLATFORM_WIN32) && !defined(G_WITH_CYGWIN)*/ mode = "r"; -#endif /*G_PLATFORM_WIN32*/ +#endif /*defined(G_PLATFORM_WIN32) || defined(G_WITH_CYGWIN)*/ if( (fp = vips__fopen( filename, mode )) ) return( fp ); @@ -734,14 +734,14 @@ vips__file_open_write( const char *filename, gboolean text_mode ) char *mode; FILE *fp; -#ifdef G_PLATFORM_WIN32 +#if defined(G_PLATFORM_WIN32) || defined(G_WITH_CYGWIN) if( text_mode ) mode = "w"; else mode = "wb"; -#else /*!G_PLATFORM_WIN32*/ +#else /*!defined(G_PLATFORM_WIN32) && !defined(G_WITH_CYGWIN)*/ mode = "w"; -#endif /*G_PLATFORM_WIN32*/ +#endif /*defined(G_PLATFORM_WIN32) || defined(G_WITH_CYGWIN)*/ if( !(fp = vips__fopen( filename, mode )) ) { vips_error_system( errno, "vips__file_open_write", diff --git a/libvips/iofuncs/vips.c b/libvips/iofuncs/vips.c index 74362084..8d25c2bb 100644 --- a/libvips/iofuncs/vips.c +++ b/libvips/iofuncs/vips.c @@ -115,13 +115,13 @@ /* Try to make an O_BINARY ... sometimes need the leading '_'. */ -#ifdef G_PLATFORM_WIN32 +#if defined(G_PLATFORM_WIN32) || defined(G_WITH_CYGWIN) #ifndef O_BINARY #ifdef _O_BINARY #define O_BINARY _O_BINARY #endif /*_O_BINARY*/ #endif /*!O_BINARY*/ -#endif /*G_PLATFORM_WIN32*/ +#endif /*defined(G_PLATFORM_WIN32) || defined(G_WITH_CYGWIN)*/ /* If we have O_BINARY, add it to a mode flags set. */