mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-22 00:01:09 -06:00
getting rid of strerror problem
This commit is contained in:
parent
9c2d9b2ba3
commit
2eddacfb7e
3 changed files with 19 additions and 18 deletions
|
@ -94,20 +94,27 @@ namespace png
|
|||
static std::string thread_safe_strerror(int errnum)
|
||||
{
|
||||
#define ERRBUF_SIZE 512
|
||||
char buf[ERRBUF_SIZE] = { 0 };
|
||||
|
||||
//#ifdef HAVE_STRERROR_S
|
||||
#ifdef HAVE_STRERROR_S
|
||||
char buf[ERRBUF_SIZE] = { 0 };
|
||||
strerror_s(buf, ERRBUF_SIZE, errnum);
|
||||
return std::string(buf);
|
||||
//#else
|
||||
//#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE
|
||||
// strerror_r(errnum, buf, ERRBUF_SIZE);
|
||||
// return std::string(buf);
|
||||
//#else
|
||||
// /* GNU variant can return a pointer to static buffer instead of buf */
|
||||
// return std::string(strerror_r(errnum, buf, ERRBUF_SIZE));
|
||||
//#endif
|
||||
//#endif
|
||||
#else
|
||||
#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE
|
||||
char buf[ERRBUF_SIZE] = { 0 };
|
||||
strerror_r(errnum, buf, ERRBUF_SIZE);
|
||||
return std::string(buf);
|
||||
#elif _GNU_SOURCE
|
||||
/* GNU variant can return a pointer to static buffer instead of buf */
|
||||
char buf[ERRBUF_SIZE] = { 0 };
|
||||
return std::string(strerror_r(errnum, buf, ERRBUF_SIZE));
|
||||
#else
|
||||
return std::string("An error occured with errnum ") +
|
||||
std::to_string(errnum) +
|
||||
". Converting to the appropriate error message is disabled"
|
||||
"in this instance of the png++ library.";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#undef ERRBUF_SIZE
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue