From 3b2560feb355e708a59ecfb224932810687a75ad Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Mon, 16 Jan 2017 10:36:05 -0600 Subject: [PATCH] MSVSC fixes --- crypto/compat/posix_win.c | 2 +- include/compat/fcntl.h | 6 ------ include/compat/stdio.h | 4 ++++ include/compat/win32netcompat.h | 4 ++++ 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/crypto/compat/posix_win.c b/crypto/compat/posix_win.c index 331f88e..f8121d8 100644 --- a/crypto/compat/posix_win.c +++ b/crypto/compat/posix_win.c @@ -44,7 +44,7 @@ int posix_open(const char *path, ...) { va_list ap; - mode_t mode = 0; + int mode = 0; int flags; va_start(ap, path); diff --git a/include/compat/fcntl.h b/include/compat/fcntl.h index edc468a..99c2d58 100644 --- a/include/compat/fcntl.h +++ b/include/compat/fcntl.h @@ -29,10 +29,4 @@ #define FD_CLOEXEC 1 #endif -int posix_open(const char *path, ...); - -#ifndef NO_REDEF_POSIX_FUNCTIONS -#define open(path, ...) posix_open(path, __VA_ARGS__) -#endif - #endif diff --git a/include/compat/stdio.h b/include/compat/stdio.h index a0dda6f..d5725c9 100644 --- a/include/compat/stdio.h +++ b/include/compat/stdio.h @@ -26,6 +26,10 @@ int asprintf(char **str, const char *fmt, ...); #ifdef _WIN32 +#if defined(_MSC_VER) +#define __func__ __FUNCTION__ +#endif + void posix_perror(const char *s); FILE * posix_fopen(const char *path, const char *mode); char * posix_fgets(char *s, int size, FILE *stream); diff --git a/include/compat/win32netcompat.h b/include/compat/win32netcompat.h index 933f083..eabebe9 100644 --- a/include/compat/win32netcompat.h +++ b/include/compat/win32netcompat.h @@ -26,7 +26,10 @@ int posix_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen); +int posix_open(const char *path, ...); + int posix_close(int fd); + ssize_t posix_read(int fd, void *buf, size_t count); ssize_t posix_write(int fd, const void *buf, size_t count); @@ -39,6 +42,7 @@ int posix_setsockopt(int sockfd, int level, int optname, #ifndef NO_REDEF_POSIX_FUNCTIONS #define connect(sockfd, addr, addrlen) posix_connect(sockfd, addr, addrlen) +#define open(path, ...) posix_open(path, __VA_ARGS__) #define close(fd) posix_close(fd) #define read(fd, buf, count) posix_read(fd, buf, count) #define write(fd, buf, count) posix_write(fd, buf, count)