From 54e406118926c2a526455a60f67961520dfb65da Mon Sep 17 00:00:00 2001 From: fanquake Date: Tue, 24 Jan 2023 12:18:08 +0000 Subject: refactor: don't avoid sys/types.h on when building for Windows We've already used it unguarded in `httpserver.cpp` for years, with no build issues. --- src/compat/compat.h | 9 --------- src/randomenv.cpp | 3 ++- src/test/util_tests.cpp | 4 +++- src/wallet/bdb.cpp | 9 ++++++++- 4 files changed, 13 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/compat/compat.h b/src/compat/compat.h index 88f58120b8..8195bceaec 100644 --- a/src/compat/compat.h +++ b/src/compat/compat.h @@ -62,15 +62,6 @@ typedef unsigned int SOCKET; #endif #endif -// Windows doesn't define S_IRUSR or S_IWUSR. We define both -// here, with the same values as glibc (see stat.h). -#ifdef WIN32 -#ifndef S_IRUSR -#define S_IRUSR 0400 -#define S_IWUSR 0200 -#endif -#endif - // Windows defines MAX_PATH as it's maximum path length. // We define MAX_PATH for use on non-Windows systems. #ifndef WIN32 diff --git a/src/randomenv.cpp b/src/randomenv.cpp index 3e4d5a587d..581612bccf 100644 --- a/src/randomenv.cpp +++ b/src/randomenv.cpp @@ -24,11 +24,12 @@ #include #include +#include // must go before a number of other headers + #ifdef WIN32 #include #include #else -#include // must go before a number of other headers #include #include #include diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index 3a5126f8a8..812737429d 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -35,9 +35,11 @@ #include #include #include + +#include + #ifndef WIN32 #include -#include #include #endif diff --git a/src/wallet/bdb.cpp b/src/wallet/bdb.cpp index 5fafd478ee..dd425c1160 100644 --- a/src/wallet/bdb.cpp +++ b/src/wallet/bdb.cpp @@ -15,8 +15,15 @@ #include -#ifndef WIN32 #include + +// Windows may not define S_IRUSR or S_IWUSR. We define both +// here, with the same values as glibc (see stat.h). +#ifdef WIN32 +#ifndef S_IRUSR +#define S_IRUSR 0400 +#define S_IWUSR 0200 +#endif #endif namespace wallet { -- cgit v1.2.3