From ae1acdce92260aa9922462610b86899623be10a0 Mon Sep 17 00:00:00 2001 From: Florent Rougon Date: Fri, 13 May 2016 11:49:33 +0200 Subject: [PATCH] Use _WIN32 instead of SG_WINDOWS for tests in simgear::strutils::error_string() Since Cygwin has SG_WINDOWS defined but is likely to expose a POSIX or GNU-like interface, using _WIN32 to decide whether Windows-specific functions are available seems more appropriate than SG_WINDOWS to me. --- simgear/misc/strutils.cxx | 4 ++-- simgear/misc/strutils_test.cxx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/simgear/misc/strutils.cxx b/simgear/misc/strutils.cxx index 8e7562d1..fd3b148e 100644 --- a/simgear/misc/strutils.cxx +++ b/simgear/misc/strutils.cxx @@ -609,7 +609,7 @@ std::string error_string(int errnum) // errno_t strerror_s( char *buf, rsize_t bufsz, errno_t errnum ); // size_t strerrorlen_s( errno_t errnum ); -#if defined(SG_WINDOWS) +#if defined(_WIN32) errno_t retcode; // Always makes the string in 'buf' null-terminated retcode = strerror_s(buf, sizeof(buf), errnum); @@ -630,7 +630,7 @@ std::string error_string(int errnum) std::ostringstream ostr; ostr << errnum; -#if !defined(SG_WINDOWS) +#if !defined(_WIN32) if (retcode == ERANGE) { // more specific error message in this case msg = std::string("buffer too small to hold the error message for " "the specified error number"); diff --git a/simgear/misc/strutils_test.cxx b/simgear/misc/strutils_test.cxx index 6c654f5e..68ac7188 100644 --- a/simgear/misc/strutils_test.cxx +++ b/simgear/misc/strutils_test.cxx @@ -85,7 +85,7 @@ BOOST_AUTO_TEST_CASE( md5_hex ) BOOST_AUTO_TEST_CASE( error_string ) { -#if defined(SG_WINDOWS) +#if defined(_WIN32) _set_errno(0); #else errno = 0; @@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE( error_string ) std::ifstream f("/\\/non-existent/file/a8f7bz97-3ffe-4f5b-b8db-38ccurJL-"); -#if defined(SG_WINDOWS) +#if defined(_WIN32) errno_t saved_errno = errno; #else int saved_errno = errno; -- 2.39.5