OSX build fixes, again...

This commit is contained in:
tamasmeszaros 2018-05-22 15:13:07 +02:00
parent 73b861287c
commit 9c2d9b2ba3
3 changed files with 24 additions and 18 deletions

View File

@ -2,6 +2,10 @@
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Enable C11 language standard.
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
# Add our own cmake module path.
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/)

View File

@ -16,14 +16,12 @@
#include <agg/agg_path_storage.h>
// For png compression
#if !defined(__linux__) || \
(defined(__linux__) && ((_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
//#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>
namespace Slic3r {
@ -133,6 +131,10 @@ Raster::Raster(Raster &&m):
void Raster::reset(const Raster::Resolution &r, const Raster::PixelDim &pd)
{
// Free up the unneccessary memory and make sure it stays clear after
// an exception
impl_.reset();
impl_.reset(new Impl(r, pd));
}

View File

@ -96,18 +96,18 @@ namespace png
#define ERRBUF_SIZE 512
char buf[ERRBUF_SIZE] = { 0 };
#ifdef HAVE_STRERROR_S
//#ifdef HAVE_STRERROR_S
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
// 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
#undef ERRBUF_SIZE
}