From 7c365eb02c2eda99fde29a9e0894b667611556b2 Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Fri, 25 Aug 2017 17:44:32 -0700 Subject: [PATCH] [threading] Fix ERROR macro after including windows.h --- lib/common/error_private.h | 3 ++- lib/common/threading.h | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/common/error_private.h b/lib/common/error_private.h index 9dd9a87cf..f8e68016a 100644 --- a/lib/common/error_private.h +++ b/lib/common/error_private.h @@ -51,7 +51,8 @@ typedef ZSTD_ErrorCode ERR_enum; #ifdef ERROR # undef ERROR /* reported already defined on VS 2015 (Rich Geldreich) */ #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)); } diff --git a/lib/common/threading.h b/lib/common/threading.h index ab09977a8..0a9fcf857 100644 --- a/lib/common/threading.h +++ b/lib/common/threading.h @@ -37,7 +37,15 @@ extern "C" { # define WIN32_LEAN_AND_MEAN #endif +#ifdef ERROR +# undef ERROR /* reported already defined on VS 2015 (Rich Geldreich) */ +#endif #include +#ifdef ERROR +# undef ERROR /* reported already defined on VS 2015 (Rich Geldreich) */ +#endif +#define ERROR(name) ZSTD_ERROR(name) + /* mutex */ #define pthread_mutex_t CRITICAL_SECTION