|
|
@ -1392,3 +1392,32 @@ public:
|
|
|
|
#endif /* defined(WITH_COCOA) && !defined(STRGEN) && !defined(SETTINGSGEN) */
|
|
|
|
#endif /* defined(WITH_COCOA) && !defined(STRGEN) && !defined(SETTINGSGEN) */
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const char *StrErrorDumper::Get(int errornum)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
#if defined(_WIN32)
|
|
|
|
|
|
|
|
if (strerror_s(this->buf, lengthof(this->buf), errornum) == 0) {
|
|
|
|
|
|
|
|
return this->buf;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
auto result = strerror_r(errornum, this->buf, lengthof(this->buf));
|
|
|
|
|
|
|
|
static_assert(std::is_same_v<decltype(result), char *> || std::is_same_v<decltype(result), int>);
|
|
|
|
|
|
|
|
if constexpr (std::is_same_v<decltype(result), char *>) {
|
|
|
|
|
|
|
|
/* GNU-specific */
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
/* XSI-compliant */
|
|
|
|
|
|
|
|
if (result == 0) {
|
|
|
|
|
|
|
|
return this->buf;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
seprintf(this->buf, lastof(this->buf), "Unknown error %d", errornum);
|
|
|
|
|
|
|
|
return this->buf;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const char *StrErrorDumper::GetLast()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return this->Get(errno);
|
|
|
|
|
|
|
|
}
|
|
|
|