diff --git a/opennurbs_apple_nsfont.cpp b/opennurbs_apple_nsfont.cpp index adb81ce7..8601c112 100644 --- a/opennurbs_apple_nsfont.cpp +++ b/opennurbs_apple_nsfont.cpp @@ -59,6 +59,7 @@ void ON_ManagedFonts::Internal_GetAppleInstalledCTFonts( if (nullptr == availableFontArray) return; const CFIndex count = CFArrayGetCount(availableFontArray); + platform_font_list.Reserve((int)count); for ( CFIndex idx = 0; idx < count; idx++) { CTFontDescriptorRef descriptor = (CTFontDescriptorRef)CFArrayGetValueAtIndex(availableFontArray, idx); @@ -89,6 +90,8 @@ void ON_ManagedFonts::Internal_GetAppleInstalledCTFonts( delete platform_font; continue; } + + CFRelease(font); platform_font->SetPointSize(0); platform_font_list.Append(platform_font); } @@ -712,6 +715,8 @@ void ON_AppleFontGetFontMetrics( const double underscore_position = pointSizeToUPM*((double)CTFontGetUnderlinePosition(appleFont)); const double underscore_thickness = pointSizeToUPM*((double)CTFontGetUnderlineThickness(appleFont)); + CFRelease(appleFont); + font_metrics = ON_FontMetrics::Unset; font_metrics.SetHeights( ascent, @@ -1029,9 +1034,13 @@ unsigned int ON_AppleFontGetGlyphMetrics( const unsigned int glyph_index = ON_AppleFontGlyphIndex(appleFont, glyph->CodePoint()); if (0 == glyph_index) + { + CFRelease(appleFont); return 0; + } ON_AppleFontGetGlyphMetrics(appleFont, glyph_index, glyph_metrics); + CFRelease(appleFont); return glyph_index; } @@ -1104,6 +1113,8 @@ bool ON_AppleFontGetGlyphOutline( figure_type, outline ); + + CFRelease(appleFont); return rc; } diff --git a/opennurbs_archive.cpp b/opennurbs_archive.cpp index 2599c80a..48e64023 100644 --- a/opennurbs_archive.cpp +++ b/opennurbs_archive.cpp @@ -40,6 +40,7 @@ const ON_String Internal_RuntimeEnvironmentToString( ON_ENUM_TO_STRING_CASE(ON::RuntimeEnvironment::Apple); ON_ENUM_TO_STRING_CASE(ON::RuntimeEnvironment::Android); ON_ENUM_TO_STRING_CASE(ON::RuntimeEnvironment::Linux); + ON_ENUM_TO_STRING_CASE(ON::RuntimeEnvironment::WebAssembly); } ON_ERROR("Invalid runtime_environment parameter value."); @@ -7828,6 +7829,8 @@ static ON::RuntimeEnvironment Internal_RuntimeEnvironmentFromString( const ON_String runtime_windows(Internal_RuntimeEnvironmentToString(ON::RuntimeEnvironment::Windows)); const ON_String runtime_android(Internal_RuntimeEnvironmentToString(ON::RuntimeEnvironment::Android)); const ON_String runtime_apple(Internal_RuntimeEnvironmentToString(ON::RuntimeEnvironment::Apple)); + const ON_String runtime_linux(Internal_RuntimeEnvironmentToString(ON::RuntimeEnvironment::Linux)); + const ON_String runtime_wasm(Internal_RuntimeEnvironmentToString(ON::RuntimeEnvironment::WebAssembly)); const char* sRuntimeWindows[] = { static_cast(runtime_windows), @@ -7845,13 +7848,23 @@ static ON::RuntimeEnvironment Internal_RuntimeEnvironmentFromString( "mac rhinoceros", nullptr }; + const char* sRuntimeLinux[] = { + static_cast(runtime_linux), + "linux", + nullptr + }; + const char* sRuntimeWebAssembly[] = { + static_cast(runtime_wasm), + "wasm", + nullptr + }; const char capA = (char)'A'; const char capZ = (char)'Z'; const char toLowerAZ = (char)('a' - 'A'); for ( int i0 = 0; i0 < 2; i0++) { - for (int pass = 0; pass < 3; pass++) + for (int pass = 0; pass < 5; pass++) { const char** tokens = nullptr; ON::RuntimeEnvironment r = ON::RuntimeEnvironment::Unset; @@ -7869,6 +7882,14 @@ static ON::RuntimeEnvironment Internal_RuntimeEnvironmentFromString( tokens = sRuntimeApple; r = ON::RuntimeEnvironment::Apple; break; + case 3: + tokens = sRuntimeLinux; + r = ON::RuntimeEnvironment::Linux; + break; + case 4: + tokens = sRuntimeWebAssembly; + r = ON::RuntimeEnvironment::WebAssembly; + break; } for (int i = i0; nullptr != tokens[i]; i++) { diff --git a/opennurbs_array.h b/opennurbs_array.h index 37725090..f62a3637 100644 --- a/opennurbs_array.h +++ b/opennurbs_array.h @@ -380,6 +380,14 @@ public: */ void SetArray(T*, int, int); + /* Support range based for loops */ + T* begin(); + T* end(); + T const* cbegin(); + T* cend(); + T const* begin() const; + T const* end() const; + protected: // implementation ////////////////////////////////////////////////////// void Move( int /* dest index*/, int /* src index */, int /* element count*/ ); @@ -733,6 +741,14 @@ public: */ void SetArray(T*, int, int); + /* Support range based for loops */ + T* begin(); + T* end(); + T const* cbegin(); + T* cend(); + T const* begin() const; + T const* end() const; + protected: // implementation ////////////////////////////////////////////////////// void Move( int /* dest index*/, int /* src index */, int /* element count*/ ); diff --git a/opennurbs_array_defs.h b/opennurbs_array_defs.h index 96d8de92..347985f0 100644 --- a/opennurbs_array_defs.h +++ b/opennurbs_array_defs.h @@ -442,6 +442,44 @@ const T* ON_SimpleArray::Last() const return (m_count > 0) ? m_a+(m_count-1) : 0; } +// range-based iteration support + +template +T* ON_SimpleArray::begin() +{ + return m_a ? &m_a[0] : nullptr; +} + +template +T* ON_SimpleArray::end() +{ + return m_a ? m_a + m_count : nullptr; +} + +template +T const* ON_SimpleArray::cbegin() +{ + return m_a ? &m_a[0] : nullptr; +} + +template +T* ON_SimpleArray::cend() +{ + return m_a ? m_a + m_count : nullptr; +} + +template +T const* ON_SimpleArray::begin() const +{ + return m_a ? &m_a[0] : nullptr; +} + +template +T const* ON_SimpleArray::end() const +{ + return m_a ? m_a + m_count : nullptr; +} + // array operations //////////////////////////////////////////////////// template @@ -1643,6 +1681,45 @@ const T* ON_ClassArray::Last() const return (m_count > 0) ? m_a+(m_count-1) : 0; } +// range-based iteration support + +template +T* ON_ClassArray::begin() +{ + return m_a ? &m_a[0] : nullptr; +} + +template +T* ON_ClassArray::end() +{ + return m_a ? m_a + m_count : nullptr; +} + +template +T const* ON_ClassArray::cbegin() +{ + return m_a ? &m_a[0] : nullptr; +} + +template +T* ON_ClassArray::cend() +{ + return m_a ? m_a + m_count : nullptr; +} + +template +T const* ON_ClassArray::begin() const +{ + return m_a ? &m_a[0] : nullptr; +} + +template +T const* ON_ClassArray::end() const +{ + return m_a ? m_a + m_count : nullptr; +} + + // array operations //////////////////////////////////////////////////// template diff --git a/opennurbs_curve.cpp b/opennurbs_curve.cpp index 6559a8bd..e8f3a136 100644 --- a/opennurbs_curve.cpp +++ b/opennurbs_curve.cpp @@ -2561,6 +2561,20 @@ public: double dot_tol; bool bUseTan; }; +static bool CJEDIsMatch(const CurveJoinEndData* a, const CurveJoinEndData* b) + +//Do these represent a pair of possible joins in the same location? + +{ + for (int i=0; i<2; i++){ + for (int j=0; j<2; j++){ + if (a->id[i] == b->id[j] && a->end[i] == b->end[j]) + return true; + } + } + return false; +} + static int CompareJoinEnds(void* ctext, const void* aA, const void* bB) @@ -2570,6 +2584,15 @@ static int CompareJoinEnds(void* ctext, const void* aA, const void* bB) JoinEndCompareContext* context = (JoinEndCompareContext*)ctext; const CurveJoinEndData* a = (CurveJoinEndData*)aA; const CurveJoinEndData* b = (CurveJoinEndData*)bB; + + //If not comparing two matches at the same end of a curve, sort by id. + if (!CJEDIsMatch(a, b)){ + if (a->id[0] < b->id[0]) return -1; + if (a->id[0] > b->id[0]) return 1; + if (a->id[1] < b->id[1]) return -1; + if (a->id[1] > b->id[1]) return 1; + return 0; + } if (context->bUseTan){ //If one is real close and the other isn't,take the close one. if (a->dist < context->dist_tol && b->dist >= context->dist_tol) return -1; @@ -3204,6 +3227,7 @@ public: }; JoinCurveEndArray::JoinCurveEndArray() + :m_CurveCount(0) { m_Ends[0] = m_Ends[1] = 0; @@ -3311,15 +3335,15 @@ static bool GetCurveEndData(const ON_SimpleArray& IC, return true; } - - static bool GetCurveEndData(int count, const ON_3dPoint* StartPoints, const ON_3dPoint* EndPoints,//size count const ON_3dVector* StartTans, const ON_3dVector* EndTans,//nullptr or size count double join_tol, double dot_tol, bool bUseTanAngle, bool bPreserveDirection, - ON_SimpleArray& EData) + ON_SimpleArray& EData + +) { join_tol = join_tol * join_tol; @@ -3561,7 +3585,6 @@ static bool SortEnds(int count, ON_ClassArray >& SegsArray, ON_SimpleArray& Singles ) - { if (!StartPoints || !EndPoints) return false; diff --git a/opennurbs_defines.cpp b/opennurbs_defines.cpp index 8d5f8830..71e636de 100644 --- a/opennurbs_defines.cpp +++ b/opennurbs_defines.cpp @@ -495,7 +495,7 @@ int ON::CloseAllFiles() // returns number of files closed or EOF for error #if defined(ON_COMPILER_MSC) return _fcloseall(); // ANSI C name -#elif defined(ON_RUNTIME_APPLE) || defined(ON_RUNTIME_ANDROID) +#elif defined(ON_RUNTIME_APPLE) || defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_WASM) //fcloseall is not supported on mac/ios or android return EOF; #else @@ -550,6 +550,7 @@ ON::RuntimeEnvironment ON::RuntimeEnvironmentFromUnsigned( ON_ENUM_FROM_UNSIGNED_CASE(ON::RuntimeEnvironment::Apple); ON_ENUM_FROM_UNSIGNED_CASE(ON::RuntimeEnvironment::Android); ON_ENUM_FROM_UNSIGNED_CASE(ON::RuntimeEnvironment::Linux); + ON_ENUM_FROM_UNSIGNED_CASE(ON::RuntimeEnvironment::WebAssembly); } ON_ERROR("Invalid runtime_environment_as_unsigned parameter value."); return (ON::RuntimeEnvironment::Unset); @@ -565,6 +566,8 @@ ON::RuntimeEnvironment ON::CurrentRuntimeEnvironment() return ON::RuntimeEnvironment::Android; #elif defined (ON_RUNTIME_LINUX) return ON::RuntimeEnvironment::Linux; +#elif defined (ON_RUNTIME_WASM) + return ON::RuntimeEnvironment::WebAssembly; #else ON_ERROR("ON_RUNTIME_... not defined."); return ON::RuntimeEnvironment::Unset; diff --git a/opennurbs_defines.h b/opennurbs_defines.h index 847c28c3..e8029e09 100644 --- a/opennurbs_defines.h +++ b/opennurbs_defines.h @@ -67,7 +67,7 @@ #if defined(OPENNURBS_EXPORTS) /* compiling opennurbs as some type of dynamic linking library */ -#if defined(ON_RUNTIME_LINUX) +#if defined(ON_RUNTIME_LINUX) || defined(ON_RUNTIME_WASM) /* Linux defaults to exporting all functions*/ #define ON_CLASS #define ON_DECL @@ -108,7 +108,7 @@ #define ON_DECL __attribute__ ((visibility ("default"))) #define ON_EXTERN_DECL __attribute__ ((visibility ("default"))) -#elif defined(ON_RUNTIME_LINUX) +#elif defined(ON_RUNTIME_LINUX) || defined(ON_RUNTIME_WASM) /* Linux defaults to exporting all functions*/ #define ON_CLASS #define ON_DECL @@ -1244,7 +1244,11 @@ public: /// /// ON::RuntimeEnvironment::Linux indicates some version of Linux. /// - Linux = 5 + Linux = 5, + /// + /// ON::RuntimeEnvironment::WebAssembly indicates some version of WASM / WebAssembly. + /// + WebAssembly = 6 }; #pragma endregion diff --git a/opennurbs_font.cpp b/opennurbs_font.cpp index caf7e4a6..08b1df2c 100644 --- a/opennurbs_font.cpp +++ b/opennurbs_font.cpp @@ -8936,7 +8936,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(ON_RUNTIME_WASM) const ON_Font* font = installed_fonts[(int)i]; #else const ON_Font* font = installed_fonts[i]; @@ -8999,7 +8999,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(ON_RUNTIME_WASM) InternalHashToName e = a[(int)i]; #else InternalHashToName e = a[i]; diff --git a/opennurbs_locale.cpp b/opennurbs_locale.cpp index cb2235fa..fab00cc1 100644 --- a/opennurbs_locale.cpp +++ b/opennurbs_locale.cpp @@ -32,7 +32,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(ON_RUNTIME_WASM) ON_C_locale = 0; #else ON_C_locale = _create_locale(category, locale); @@ -101,7 +101,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(ON_RUNTIME_WASM) return 0; #else return _create_locale(category, locale); @@ -1345,7 +1345,7 @@ public: 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(ON_RUNTIME_WASM) // Test formatted printing char buffer[64] = { 0 }; // Testing C-runtime - do not using ON_String::FormatIntoBuffer @@ -1370,7 +1370,7 @@ public: 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(ON_RUNTIME_WASM) // Test formatted printing char buffer[64] = { 0 }; size_t buffer_capacity = (sizeof(buffer) / sizeof(buffer[0])) - 1; @@ -1424,7 +1424,7 @@ public: 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(ON_RUNTIME_WASM) // Test formatted scanning double a = ON_UNSET_VALUE; // Testing C-runtime - do not using ON_String::Scan @@ -1449,7 +1449,7 @@ public: 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(ON_RUNTIME_WASM) // Test formatted scanning double a = ON_UNSET_VALUE; // Testing C-runtime - do not using ON_String::Scan diff --git a/opennurbs_lock.h b/opennurbs_lock.h index 616c8463..5f7e640e 100644 --- a/opennurbs_lock.h +++ b/opennurbs_lock.h @@ -112,7 +112,7 @@ private: // needs to have dll-interface to be used by clients of class 'ON_Lock' // m_lock_value is private and all code that manages m_lock_value is explicitly implemented in the DLL. private: -#if defined(ON_COMPILER_CLANG) || defined(ON_RUNTIME_LINUX) +#if defined(ON_COMPILER_CLANG) || defined(ON_RUNTIME_LINUX) || defined(ON_RUNTIME_WASM) std::atomic m_lock_value; #else std::atomic m_lock_value = ON_Lock::UnlockedValue; diff --git a/opennurbs_material.cpp b/opennurbs_material.cpp index 75cf2482..3ae47c5a 100644 --- a/opennurbs_material.cpp +++ b/opennurbs_material.cpp @@ -3956,7 +3956,11 @@ public: for (size_t i = 0; i < m_info.m_faceSourceIds.Count(); i++) { +#if defined(ON_RUNTIME_WASM) + if (!binary_archive.WriteInt(m_info.m_faceSourceIds[(int)i])) +#else if (!binary_archive.WriteInt(m_info.m_faceSourceIds[i])) +#endif return false; } diff --git a/opennurbs_polyline.cpp b/opennurbs_polyline.cpp index 6f9c3f2e..2de771c2 100644 --- a/opennurbs_polyline.cpp +++ b/opennurbs_polyline.cpp @@ -455,7 +455,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(ON_RUNTIME_WASM) double d = maxN * C[(unsigned int)i]; #else double d = maxN * C[i]; diff --git a/opennurbs_public.vcxproj b/opennurbs_public.vcxproj index 55147b08..9b9ce9f1 100644 --- a/opennurbs_public.vcxproj +++ b/opennurbs_public.vcxproj @@ -112,6 +112,7 @@ true ProgramDatabase true + /bigobj %(AdditionalOptions) Windows diff --git a/opennurbs_public_version.h b/opennurbs_public_version.h index 55d4ad6e..f790afb7 100644 --- a/opennurbs_public_version.h +++ b/opennurbs_public_version.h @@ -6,7 +6,7 @@ // To update version numbers, edit ..\build\build_dates.msbuild #define RMA_VERSION_MAJOR 8 -#define RMA_VERSION_MINOR 8 +#define RMA_VERSION_MINOR 9 //////////////////////////////////////////////////////////////// // @@ -14,10 +14,10 @@ // first step in each build. // #define RMA_VERSION_YEAR 2024 -#define RMA_VERSION_MONTH 6 -#define RMA_VERSION_DATE 14 -#define RMA_VERSION_HOUR 15 -#define RMA_VERSION_MINUTE 0 +#define RMA_VERSION_MONTH 7 +#define RMA_VERSION_DATE 12 +#define RMA_VERSION_HOUR 18 +#define RMA_VERSION_MINUTE 12 //////////////////////////////////////////////////////////////// // @@ -35,8 +35,8 @@ // 3 = build system release build #define RMA_VERSION_BRANCH 0 -#define VERSION_WITH_COMMAS 8,8,24166,15000 -#define VERSION_WITH_PERIODS 8.8.24166.15000 +#define VERSION_WITH_COMMAS 8,9,24194,18120 +#define VERSION_WITH_PERIODS 8.9.24194.18120 #define COPYRIGHT "Copyright (C) 1993-2024, Robert McNeel & Associates. All Rights Reserved." #define SPECIAL_BUILD_DESCRIPTION "Public OpenNURBS C++ 3dm file IO library." @@ -44,11 +44,11 @@ #define RMA_VERSION_NUMBER_MAJOR_WSTRING L"8" #define RMA_PREVIOUS_VERSION_NUMBER_MAJOR_WSTRING L"7" -#define RMA_VERSION_NUMBER_SR_STRING "SR8" -#define RMA_VERSION_NUMBER_SR_WSTRING L"SR8" +#define RMA_VERSION_NUMBER_SR_STRING "SR9" +#define RMA_VERSION_NUMBER_SR_WSTRING L"SR9" -#define RMA_VERSION_WITH_PERIODS_STRING "8.8.24166.15000" -#define RMA_VERSION_WITH_PERIODS_WSTRING L"8.8.24166.15000" +#define RMA_VERSION_WITH_PERIODS_STRING "8.9.24194.18120" +#define RMA_VERSION_WITH_PERIODS_WSTRING L"8.9.24194.18120" diff --git a/opennurbs_rtree.h b/opennurbs_rtree.h index 851acfe8..84357934 100644 --- a/opennurbs_rtree.h +++ b/opennurbs_rtree.h @@ -522,6 +522,10 @@ public: Remarks: If you are using a Search() that uses a resultCallback() function, then return true to keep searching and false to terminate the search. + Do not modify the tree while a Search() is in progress. Doing so can + have unintended consequences, including corruption and crashes. If you + need to modify the tree, collect the results during the search and modify + the tree once the search is completed. */ bool Search( ON_RTreeSphere* a_sphere, diff --git a/opennurbs_sort.cpp b/opennurbs_sort.cpp index 9431fd85..d4054973 100644 --- a/opennurbs_sort.cpp +++ b/opennurbs_sort.cpp @@ -63,7 +63,7 @@ ON_qsort( void *base, size_t nel, size_t width, int (*compar)(void*,const void * // find pivots, that calculation must be thread safe. #if defined(ON_COMPILER_MSC) qsort_s(base,nel,width,compar,context); -#elif defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) +#elif defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(ON_RUNTIME_WASM) ON_hsort(base, nel, width, compar, context); #elif defined(ON_COMPILER_CLANG) qsort_r(base,nel,width,context,compar); diff --git a/opennurbs_string_format.cpp b/opennurbs_string_format.cpp index d6f7b33c..549ac0df 100644 --- a/opennurbs_string_format.cpp +++ b/opennurbs_string_format.cpp @@ -802,7 +802,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(ON_RUNTIME_WASM) int len = vsnprintf(buffer, buffer_capacity, format, args_copy); #else int len = vsnprintf_l(buffer, buffer_capacity, ON_Locale::Ordinal.NumericLocalePtr(), format, args_copy); @@ -855,7 +855,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(ON_RUNTIME_WASM) 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 c28238a9..98538ca6 100644 --- a/opennurbs_string_scan.cpp +++ b/opennurbs_string_scan.cpp @@ -82,8 +82,8 @@ int ON_String::ScanBufferVargs( va_list args ) { -#if defined(ON_COMPILER_CLANG) || defined(ON_RUNTIME_LINUX) -#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) +#if defined(ON_COMPILER_CLANG) || defined(ON_RUNTIME_LINUX) || defined(ON_RUNTIME_WASM) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(ON_RUNTIME_WASM) if (nullptr == buffer || nullptr == format) return -1; return vsscanf(buffer, format, args); @@ -156,7 +156,7 @@ int ON_wString::ScanBufferVargs( if (nullptr == args) return -1; return swscanf_l(buffer, _c_locale, format, args); -#elif defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) +#elif defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(ON_RUNTIME_WASM) return swscanf(buffer, format, args); #else return swscanf(buffer, format, args); @@ -395,8 +395,8 @@ const char* ON_String::ToNumber( local_buffer[local_buffer_count++] = 0; 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_COMPILER_CLANG) || defined(ON_RUNTIME_LINUX) || defined(ON_RUNTIME_WASM) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(ON_RUNTIME_WASM) if (1 == sscanf(local_buffer, "%lg", &x)) { *value = x; @@ -657,8 +657,8 @@ const wchar_t* ON_wString::ToNumber( local_buffer[local_buffer_count++] = 0; 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_COMPILER_CLANG) || defined(ON_RUNTIME_LINUX) || defined(ON_RUNTIME_WASM) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(ON_RUNTIME_WASM) if (1 == sscanf(local_buffer, "%lg", &x)) { *value = x; diff --git a/opennurbs_subd.cpp b/opennurbs_subd.cpp index 7eb685e6..45db3ebc 100644 --- a/opennurbs_subd.cpp +++ b/opennurbs_subd.cpp @@ -1795,7 +1795,6 @@ const ON_wString ON_SubDComponentId::ToString(bool bUnsetIsEmptyString, bool bDi const char prefix = bDirectionPrefix ? (1 == this->ComponentDirection() ? '-' : '+') : 0; switch (this->ComponentType()) { - case ON_SubDComponentPtr::Type::Vertex: str = (0 == prefix) ? ON_wString::FormatToString(L"v%u", id) : ON_wString::FormatToString(L"%cv%u", prefix, id); break; @@ -1814,6 +1813,8 @@ const ON_wString ON_SubDComponentId::ToString(bool bUnsetIsEmptyString, bool bDi } break; + case ON_SubDComponentPtr::Type::Unset: + break; } } return (str.IsNotEmpty() || bUnsetIsEmptyString) ? str : ON_wString("unset"); @@ -11701,6 +11702,9 @@ bool ON_ObjRefEvaluationParameter::SetFromSubDComponentParameter( this->m_s[1] = ON_Interval(0.0, 0.5); } break; + + case ON_SubDComponentPtr::Type::Unset: + break; } this->Default(); @@ -11785,6 +11789,8 @@ bool ON_ObjRefEvaluationParameter::GetSubDComponentParameter( cp = ON_SubDComponentParameter(face_id, fp); } break; + default: + break; } } return cp.IsSet(); diff --git a/opennurbs_subd_data.cpp b/opennurbs_subd_data.cpp index 6b12d171..011a8353 100644 --- a/opennurbs_subd_data.cpp +++ b/opennurbs_subd_data.cpp @@ -1359,7 +1359,7 @@ bool ON_SubDMeshImpl::Transform( const ON_Xform& xformColors ) { - const bool bIsometry = (1 == xform.IsRigid()); + //const bool bIsometry = (1 == xform.IsRigid()); // silence unused variable warning m_bbox = ON_BoundingBox::EmptyBoundingBox; ON_BoundingBox bbox = ON_BoundingBox::EmptyBoundingBox; for ( const ON_SubDMeshFragment* fragment = m_first_fragment; nullptr != fragment; fragment = fragment->m_next_fragment) diff --git a/opennurbs_subd_eval.cpp b/opennurbs_subd_eval.cpp index 39d8d9c0..1b2ec6ea 100644 --- a/opennurbs_subd_eval.cpp +++ b/opennurbs_subd_eval.cpp @@ -2011,11 +2011,13 @@ const ON_wString ON_SubDComponentParameter::ToString(bool bUnsetIsEmptyString) c const ON_SubDFaceParameter fp = this->FaceParameter(); const unsigned corner_index = fp.FaceCornerDex().CornerIndex(); const ON_2dPoint p = fp.FaceCornerParameters(); - const unsigned fid = this->EdgeFace().ComponentId(); + //const unsigned fid = this->EdgeFace().ComponentId(); // silence unused variable warning str = ON_wString::FormatToString(L"f%u.%u(%g, %g)", id, corner_index, p.x, p.y); } break; + case ON_SubDComponentPtr::Type::Unset: + break; } } diff --git a/opennurbs_subd_ring.cpp b/opennurbs_subd_ring.cpp index 0e00be23..1395cbf8 100644 --- a/opennurbs_subd_ring.cpp +++ b/opennurbs_subd_ring.cpp @@ -591,6 +591,7 @@ unsigned int ON_SubD::GetSectorPointRing( size_t point_ring_stride ) { + subdivision_count = 0; const ON_SubDVertex* center_vertex = sit.CenterVertex(); if (nullptr == center_vertex) return ON_SUBD_RETURN_ERROR(0); @@ -611,14 +612,13 @@ unsigned int ON_SubD::GetSectorPointRing( unsigned int component_ring_count = ON_SubD::GetSectorComponentRing(sit, component_ring, component_ring_capacity); if (component_ring_count > 0) { - const bool bObsoleteAndIgnoredParameter = false; point_ring_count = ON_SubD::GetQuadSectorPointRing( false, // false means subdivisions are permitted - bObsoleteAndIgnoredParameter, - nullptr, component_ring, component_ring_count, - point_ring, point_ring_stride + subdivision_count, + point_ring, + point_ring_stride ); } diff --git a/opennurbs_symmetry.cpp b/opennurbs_symmetry.cpp index 84cf5b39..c4f0f11b 100644 --- a/opennurbs_symmetry.cpp +++ b/opennurbs_symmetry.cpp @@ -222,6 +222,8 @@ ON_Symmetry::Region ON_Symmetry::PointRegion(ON_3dPoint point, bool bUseCleanupT default: break; } + + break; } // When the point is not valid, the symmetry is not set, or an evaluaton produces nans, then return ON_Symmetry::Region::Unset. diff --git a/opennurbs_system.h b/opennurbs_system.h index e2c3766d..31cbfd19 100644 --- a/opennurbs_system.h +++ b/opennurbs_system.h @@ -494,7 +494,7 @@ typedef ON__UINT32 wchar_t; #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE -#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) +#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(ON_RUNTIME_WASM) #include "android_uuid/uuid.h" #else #include diff --git a/opennurbs_system_runtime.h b/opennurbs_system_runtime.h index 1853707d..2745e110 100644 --- a/opennurbs_system_runtime.h +++ b/opennurbs_system_runtime.h @@ -43,7 +43,7 @@ #define ON_RUNTIME_WIN #endif -#elif defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(ANDROID) +#elif defined(__ANDROID__) || defined(ANDROID) // __EMSCRIPTEN__ is for a web assembly compile which currently compiles with the // same settings as an android build. We will need to add an ON_RUNTIME_WASM once // the __EMSCRIPTEN__ compile stabilizes @@ -56,10 +56,15 @@ #define ON_RUNTIME_LINUX #endif +#elif defined(__EMSCRIPTEN__) +#if !defined(ON_RUNTIME_WASM) +#define ON_RUNTIME_WASM +#endif + #endif /* // -// END - ON_RUNTIME_APPLE / ON_RUNTIME_WIN / ON_RUNTIME_ANDROID defines +// END - ON_RUNTIME_APPLE / ON_RUNTIME_WIN / ON_RUNTIME_ANDROID / ON_RUNTIME_WASM defines // //////////////////////////////////////////////////////////// */ @@ -146,7 +151,7 @@ #define ON_RUNTIME_LINUX #endif -#if defined(ON_RUNTIME_LINUX) +#if defined(ON_RUNTIME_LINUX) || defined(ON_RUNTIME_WASM) #if !defined(ON_SIZEOF_WCHAR_T) #define ON_SIZEOF_WCHAR_T 4 diff --git a/opennurbs_uuid.cpp b/opennurbs_uuid.cpp index c7f94fd2..97b9aece 100644 --- a/opennurbs_uuid.cpp +++ b/opennurbs_uuid.cpp @@ -12,7 +12,7 @@ //////////////////////////////////////////////////////////////// #include "opennurbs.h" -#if defined(ON_RUNTIME_LINUX) +#if defined(ON_RUNTIME_LINUX) || defined(ON_RUNTIME_WASM) #include "android_uuid/uuid.h" #endif #if !defined(ON_COMPILING_OPENNURBS) @@ -221,7 +221,7 @@ bool ON_CreateUuid( ON_UUID& new_uuid ) return true; #else -#if defined(ON_RUNTIME_LINUX) +#if defined(ON_RUNTIME_LINUX) || defined(ON_RUNTIME_WASM) uuid_generate((unsigned char*)&new_uuid); return true; #else diff --git a/zlib/opennurbs_public_zlib.xcodeproj/project.pbxproj b/zlib/opennurbs_public_zlib.xcodeproj/project.pbxproj index ae15eb73..7aeed10e 100644 --- a/zlib/opennurbs_public_zlib.xcodeproj/project.pbxproj +++ b/zlib/opennurbs_public_zlib.xcodeproj/project.pbxproj @@ -243,7 +243,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_STRICT_PROTOTYPES = NO; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -302,7 +302,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_STRICT_PROTOTYPES = NO; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -376,7 +376,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_STRICT_PROTOTYPES = NO; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;