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.
This commit is contained in:
parent
9dda5a4e31
commit
496d458d22
@ -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");
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user