Move safe_strerror to anonymous namespace.

This commit is contained in:
Victor Zverovich
2014-09-05 08:44:41 -07:00
parent b33d2aa825
commit f2c9df8e9f
6 changed files with 90 additions and 86 deletions
+13
View File
@@ -37,3 +37,16 @@ void increment(char *s) {
s[i] = '0';
}
}
std::string get_system_error(int error_code) {
#if defined(__MINGW32__) || !defined(_WIN32)
return strerror(error_code);
#else
enum { BUFFER_SIZE = 200 };
char buffer[BUFFER_SIZE];
EXPECT_EQ(0, strerror_s(buffer, BUFFER_SIZE, error_code));
std::size_t max_len = BUFFER_SIZE - 1;
EXPECT_LT(std::strlen(buffer), max_len);
return buffer;
#endif
}