mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-10-24 00:49:18 +00:00
CommonFuncs: Add StrerrorString version of LastStrerrorString that accepts an error number.
This commit is contained in:
parent
eec7f65e33
commit
504ea99cfa
2 changed files with 11 additions and 5 deletions
|
|
@ -43,13 +43,18 @@ const char* StrErrorWrapper(int error, char* buffer, std::size_t length)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string StrerrorString(int error)
|
||||||
|
{
|
||||||
|
char error_message[BUFFER_SIZE];
|
||||||
|
|
||||||
|
return StrErrorWrapper(error, error_message, BUFFER_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
// Wrapper function to get last strerror(errno) string.
|
// Wrapper function to get last strerror(errno) string.
|
||||||
// This function might change the error code.
|
// This function might change the error code.
|
||||||
std::string LastStrerrorString()
|
std::string LastStrerrorString()
|
||||||
{
|
{
|
||||||
char error_message[BUFFER_SIZE];
|
return StrerrorString(errno);
|
||||||
|
|
||||||
return StrErrorWrapper(errno, error_message, BUFFER_SIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,9 @@ namespace Common
|
||||||
// strerror_r wrapper to handle XSI and GNU versions.
|
// strerror_r wrapper to handle XSI and GNU versions.
|
||||||
const char* StrErrorWrapper(int error, char* buffer, std::size_t length);
|
const char* StrErrorWrapper(int error, char* buffer, std::size_t length);
|
||||||
|
|
||||||
// Wrapper function to get last strerror(errno) string.
|
// Wrapper functions to get strerror(errno) string, which itself is not threadsafe.
|
||||||
// This function might change the error code.
|
// These functions might change the error code.
|
||||||
|
std::string StrerrorString(int error);
|
||||||
std::string LastStrerrorString();
|
std::string LastStrerrorString();
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue