mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -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
|
@ -1342,7 +1342,7 @@ public:
|
||||||
inline unsigned layers() const { return layers_rst_.size(); }
|
inline unsigned layers() const { return layers_rst_.size(); }
|
||||||
|
|
||||||
inline void drawPolygon(const ExPolygon& p, unsigned lyr) {
|
inline void drawPolygon(const ExPolygon& p, unsigned lyr) {
|
||||||
assert(lyr_id < layers_rst_.size());
|
assert(lyr < layers_rst_.size());
|
||||||
layers_rst_[lyr].first.draw(p);
|
layers_rst_[lyr].first.draw(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,6 @@
|
||||||
#include <agg/agg_path_storage.h>
|
#include <agg/agg_path_storage.h>
|
||||||
|
|
||||||
// For png compression
|
// For png compression
|
||||||
//#if !((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE)
|
|
||||||
//inline char *strerror_r(int errnum, char *buf, size_t buflen) {
|
|
||||||
// strerror_s(buf, buflen, errnum);
|
|
||||||
// return buf;
|
|
||||||
//}
|
|
||||||
//#endif
|
|
||||||
#include <png/writer.hpp>
|
#include <png/writer.hpp>
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
|
@ -94,20 +94,27 @@ namespace png
|
||||||
static std::string thread_safe_strerror(int errnum)
|
static std::string thread_safe_strerror(int errnum)
|
||||||
{
|
{
|
||||||
#define ERRBUF_SIZE 512
|
#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);
|
strerror_s(buf, ERRBUF_SIZE, errnum);
|
||||||
return std::string(buf);
|
return std::string(buf);
|
||||||
//#else
|
#else
|
||||||
//#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE
|
#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE
|
||||||
// strerror_r(errnum, buf, ERRBUF_SIZE);
|
char buf[ERRBUF_SIZE] = { 0 };
|
||||||
// return std::string(buf);
|
strerror_r(errnum, buf, ERRBUF_SIZE);
|
||||||
//#else
|
return std::string(buf);
|
||||||
// /* GNU variant can return a pointer to static buffer instead of buf */
|
#elif _GNU_SOURCE
|
||||||
// return std::string(strerror_r(errnum, buf, ERRBUF_SIZE));
|
/* GNU variant can return a pointer to static buffer instead of buf */
|
||||||
//#endif
|
char buf[ERRBUF_SIZE] = { 0 };
|
||||||
//#endif
|
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
|
#undef ERRBUF_SIZE
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue