Index: libraries/source/fcollada/src/FCollada/FUtils/FUStringBuilder.hpp =================================================================== --- libraries/source/fcollada/src/FCollada/FUtils/FUStringBuilder.hpp +++ libraries/source/fcollada/src/FCollada/FUtils/FUStringBuilder.hpp @@ -2,8 +2,8 @@ Copyright (C) 2005-2007 Feeling Software Inc. Portions of the code are: Copyright (C) 2005-2007 Sony Computer Entertainment America - - MIT License: http://www.opensource.org/licenses/mit-license.php + + MIT License: https://www.opensource.org/licenses/mit-license.php */ /* Based on the FS Import classes: @@ -12,6 +12,13 @@ MIT License: http://www.opensource.org/licenses/mit-license.php */ +/* + musl + Copyright (C) 2005-2019 Rich Felker, et al. + https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT + MIT License: http://www.opensource.org/licenses/mit-license.php +*/ + #include #ifdef WIN32 @@ -20,10 +27,31 @@ #ifdef WIN32 #define ecvt _ecvt -#endif // WIN32 +#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) +char* ecvt(double x, int n, int *dp, int *sign) +{ + static char buf[16]; + char tmp[32]; + int i, j; + + if (n - 1 > 15) + n = 15; + + sprintf(tmp, "%.*e", n - 1, x); + i = *sign = (tmp[0] == '-'); + + for (j = 0; tmp[i] != 'e'; j += (tmp[i++] != '.')) + buf[j] = tmp[i]; + + buf[j] = 0; + *dp = atoi(tmp + i + 1) + 1; + + return buf; +} +#endif #ifndef SAFE_DELETE_ARRAY -#define SAFE_DELETE_ARRAY(ptr) if (ptr != NULL) { delete [] ptr; ptr = NULL; } +#define SAFE_DELETE_ARRAY(ptr) { delete [] ptr; ptr = NULL; } #endif template @@ -89,7 +117,7 @@ this->buffer = NULL; this->size = 0; this->reserved = 0; - + reserve(sz.size() + 32); append(sz.c_str()); } @@ -300,7 +328,7 @@ { append((Char)' '); } - append(v.x); append((Char)' '); append(v.y); append((Char)' '); append(v.z); + append(v.x); append((Char)' '); append(v.y); append((Char)' '); append(v.z); } template @@ -310,7 +338,7 @@ { append((Char)' '); } - append(v.x); append((Char)' '); append(v.y); append((Char)' '); append(v.z); append((Char)' '); append(v.w); + append(v.x); append((Char)' '); append(v.y); append((Char)' '); append(v.z); append((Char)' '); append(v.w); } template @@ -352,7 +380,7 @@ } } -template +template const Char* FUStringBuilderT::ToCharPtr() const { FUStringBuilderT* ncThis = const_cast< FUStringBuilderT* >(this);