mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-25 07:34:03 -06:00
Fixed build on Linux and macOS that was failing because of using std::to_chars and std::from_chars with floating-point values.
The old version of GCC and Clang support only integers to be passed to std::to_chars and std::from_chars. macOS older version of Clang doesn't support std::from_chars at all. So for Linux and macOS, it was replaced std::from_chars with strtod and temporarily was replace std::to_chars with snprintf.
This commit is contained in:
parent
428509ac00
commit
0bc77cef3e
2 changed files with 16 additions and 0 deletions
|
@ -309,7 +309,16 @@ public:
|
|||
|
||||
void emit_axis(const char axis, const double v, size_t digits) {
|
||||
*ptr_err.ptr ++ = ' '; *ptr_err.ptr ++ = axis;
|
||||
#ifdef WIN32
|
||||
this->ptr_err = std::to_chars(this->ptr_err.ptr, this->buf_end, v, std::chars_format::fixed, digits);
|
||||
#else
|
||||
int buf_capacity = int(this->buf_end - this->ptr_err.ptr);
|
||||
int ret = snprintf(this->ptr_err.ptr, buf_capacity, "%.*lf", int(digits), v);
|
||||
if (ret <= 0 || ret > buf_capacity)
|
||||
ptr_err.ec = std::errc::value_too_large;
|
||||
else
|
||||
this->ptr_err.ptr = this->ptr_err.ptr + ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
void emit_xy(const Vec2d &point) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue