[threading] Fix ERROR macro after including windows.h

This commit is contained in:
Nick Terrell 2017-08-25 17:44:32 -07:00
parent db3f5372df
commit 7c365eb02c
2 changed files with 10 additions and 1 deletions

View File

@ -51,7 +51,8 @@ typedef ZSTD_ErrorCode ERR_enum;
#ifdef ERROR #ifdef ERROR
# undef ERROR /* reported already defined on VS 2015 (Rich Geldreich) */ # undef ERROR /* reported already defined on VS 2015 (Rich Geldreich) */
#endif #endif
#define ERROR(name) ((size_t)-PREFIX(name)) #define ERROR(name) ZSTD_ERROR(name)
#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); } ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }

View File

@ -37,7 +37,15 @@ extern "C" {
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
#endif #endif
#ifdef ERROR
# undef ERROR /* reported already defined on VS 2015 (Rich Geldreich) */
#endif
#include <windows.h> #include <windows.h>
#ifdef ERROR
# undef ERROR /* reported already defined on VS 2015 (Rich Geldreich) */
#endif
#define ERROR(name) ZSTD_ERROR(name)
/* mutex */ /* mutex */
#define pthread_mutex_t CRITICAL_SECTION #define pthread_mutex_t CRITICAL_SECTION