add workaround for zlib with cygwin build (v2)

pull/2075/head
Gabriele Gristina 5 years ago
parent 9673dedebf
commit e86cbf426a

@ -62,6 +62,10 @@ bool hc_string_is_digit (const char *s);
void hc_string_trim_trailing (char *s);
void hc_string_trim_leading (char *s);
#if defined (__CYGWIN__)
int _wopen(const char *path, int oflag, ...);
#endif
bool hc_fopen (HCFILE *fp, const char *path, char *mode);
int hc_fscanf (HCFILE *fp, const char *format, void *ptr);
int hc_fprintf (HCFILE *fp, const char *format, ...);

@ -178,12 +178,8 @@ endif
## because ZLIB
ifeq ($(USE_SYSTEM_ZLIB),0)
ifeq ($(UNAME),CYGWIN)
CFLAGS_ZLIB += -Wno-implicit-fallthrough -UWIDECHAR
else
CFLAGS_ZLIB += -Wno-implicit-fallthrough
endif
endif
ifeq ($(DEBUG),0)
CFLAGS += -O2

@ -602,6 +602,18 @@ void hc_string_trim_trailing (char *s)
s[new_len] = 0;
}
#if defined (__CYGWIN__)
// workaround for zlib with cygwin build
int _wopen(const char *path, int oflag, ...)
{
va_list ap;
va_start (ap, oflag);
int r = open (path, oflag, ap);
va_end (ap);
return r;
}
#endif
bool hc_fopen (HCFILE *fp, const char *path, char *mode)
{
unsigned char check[3] = { 0 };

Loading…
Cancel
Save