diff --git a/opennurbs_font.cpp b/opennurbs_font.cpp index 4619dcb4..fddd717a 100644 --- a/opennurbs_font.cpp +++ b/opennurbs_font.cpp @@ -8898,7 +8898,7 @@ const ON_wString ON_Font::FamilyNameFromDirtyName( const wchar_t* prev_clean_family_name = nullptr; for (size_t i = 0; i < installed_count; i++) { -#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__) const ON_Font* font = installed_fonts[(int)i]; #else const ON_Font* font = installed_fonts[i]; @@ -8961,7 +8961,7 @@ const ON_wString ON_Font::FamilyNameFromDirtyName( InternalHashToName candidate; for (size_t i = 0; i < count0; i++) { -#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__) InternalHashToName e = a[(int)i]; #else InternalHashToName e = a[i]; diff --git a/opennurbs_locale.cpp b/opennurbs_locale.cpp index 45c46a5b..0868c9ae 100644 --- a/opennurbs_locale.cpp +++ b/opennurbs_locale.cpp @@ -35,7 +35,7 @@ static ON_CRT_locale_t ON_CRT_C_locale() ON_C_locale = _create_locale(LC_ALL, "C"); #elif defined(ON_RUNTIME_APPLE) ON_C_locale = _c_locale; -#elif defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) +#elif defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__) ON_C_locale = 0; #else ON_C_locale = _create_locale(category, locale); @@ -104,7 +104,7 @@ static ON_CRT_locale_t ON_CRT_create_locale_ALL( const char * locale ) } } return newlocale(LC_ALL_MASK, apple_name, ON_CRT_C_locale() ); -#elif defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) +#elif defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__) return 0; #else return _create_locale(category, locale); @@ -1344,7 +1344,7 @@ class ON_CRT_LOCALE static bool Validate_sprintf_l() { #if defined(ON_COMPILER_CLANG) || defined(ON_COMPILER_GNU) -#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__) // Test formatted printing char buffer[64] = { 0 }; // Testing C-runtime - do not using ON_String::FormatIntoBuffer @@ -1369,7 +1369,7 @@ class ON_CRT_LOCALE static bool Validate_sprintf_s_l() { #if defined(ON_COMPILER_CLANG) || defined(ON_COMPILER_GNU) -#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__) // Test formatted printing char buffer[64] = { 0 }; size_t buffer_capacity = (sizeof(buffer) / sizeof(buffer[0])) - 1; @@ -1423,7 +1423,7 @@ class ON_CRT_LOCALE static bool Validate_sscanf_l() { #if defined(ON_COMPILER_CLANG) || defined(ON_COMPILER_GNU) -#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__) // Test formatted scanning double a = ON_UNSET_VALUE; // Testing C-runtime - do not using ON_String::Scan @@ -1448,7 +1448,7 @@ class ON_CRT_LOCALE static bool Validate_sscanf_s_l() { #if defined(ON_COMPILER_CLANG) || defined(ON_COMPILER_GNU) -#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__) // Test formatted scanning double a = ON_UNSET_VALUE; // Testing C-runtime - do not using ON_String::Scan diff --git a/opennurbs_polyline.cpp b/opennurbs_polyline.cpp index 87e9eff4..1d37c9ec 100644 --- a/opennurbs_polyline.cpp +++ b/opennurbs_polyline.cpp @@ -453,7 +453,7 @@ bool ON_IsConvexPolyline( maxN = maxN.UnitVector(); for (size_t i = 0; i < point_count; ++i) { -#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__) double d = maxN * C[(unsigned int)i]; #else double d = maxN * C[i]; diff --git a/opennurbs_string_format.cpp b/opennurbs_string_format.cpp index 304b351e..5fa190c5 100644 --- a/opennurbs_string_format.cpp +++ b/opennurbs_string_format.cpp @@ -807,7 +807,7 @@ int ON_String::FormatVargsIntoBuffer( // CLang modifies args so a copy is required va_list args_copy; va_copy (args_copy, args); -#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__) int len = vsnprintf(buffer, buffer_capacity, format, args_copy); #else int len = vsnprintf_l(buffer, buffer_capacity, ON_Locale::Ordinal.NumericLocalePtr(), format, args_copy); @@ -859,7 +859,7 @@ int ON_String::FormatVargsOutputCount( va_list args_copy; va_copy (args_copy, args); -#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__) int len = vsnprintf(nullptr, 0, format, args_copy); #else int len = vsnprintf_l(nullptr, 0, ON_Locale::Ordinal.NumericLocalePtr(), format, args_copy); diff --git a/opennurbs_string_scan.cpp b/opennurbs_string_scan.cpp index 34df9069..c19ebe66 100644 --- a/opennurbs_string_scan.cpp +++ b/opennurbs_string_scan.cpp @@ -86,7 +86,7 @@ int ON_String::ScanBufferVargs( ) { #if defined(ON_COMPILER_CLANG) || defined(ON_RUNTIME_LINUX) -#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__) if (nullptr == buffer || nullptr == format) return -1; return vsscanf(buffer, format, args); @@ -399,7 +399,7 @@ const char* ON_String::ToNumber( double x = value_on_failure; #if defined(ON_COMPILER_CLANG) || defined(ON_RUNTIME_LINUX) -#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__) if (1 == sscanf(local_buffer, "%lg", &x)) { *value = x; @@ -661,7 +661,7 @@ const wchar_t* ON_wString::ToNumber( double x = value_on_failure; #if defined(ON_COMPILER_CLANG) || defined(ON_RUNTIME_LINUX) -#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__) if (1 == sscanf(local_buffer, "%lg", &x)) { *value = x; diff --git a/opennurbs_system.h b/opennurbs_system.h index 504fea2f..23688479 100644 --- a/opennurbs_system.h +++ b/opennurbs_system.h @@ -25,8 +25,7 @@ #if !defined(OPENNURBS_SYSTEM_INC_) #define OPENNURBS_SYSTEM_INC_ - - +#define ON_SIZEOF_WCHAR_T 4 #define OPENNURBS_PP2STR_HELPER(s) #s @@ -434,7 +433,7 @@ typedef ON__UINT32 wchar_t; #if defined(ON_COMPILER_CLANG) && defined(ON_RUNTIME_APPLE) #include #else -#include +#include #endif #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE diff --git a/opennurbs_uuid.cpp b/opennurbs_uuid.cpp index 6f83a8a7..16df0c82 100644 --- a/opennurbs_uuid.cpp +++ b/opennurbs_uuid.cpp @@ -177,7 +177,7 @@ bool ON_CreateUuid( ON_UUID& new_uuid ) // identifies the user and some // customers may object. return true; -#elif defined(ON_COMPILER_CLANG) +#elif defined(ON_COMPILER_CLANG) && !defined(__FreeBSD__) // Header: #include if ( ON::endian::little_endian == ON::Endian() ) { @@ -224,7 +224,7 @@ bool ON_CreateUuid( ON_UUID& new_uuid ) return true; #else -#if defined(ON_RUNTIME_LINUX) +#if defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__) uuid_generate((unsigned char*)&new_uuid); return true; #else