From f50dd0d8d8e2e14ffed8048ac6a4ceb54889af7c Mon Sep 17 00:00:00 2001 From: Clifford Yapp <238416+starseeker@users.noreply.github.com> Date: Mon, 22 Nov 2021 15:29:39 -0500 Subject: [PATCH] Pull in a number of changes from https://github.com/mcneel/opennurbs/pull/28 --- src/other/openNURBS/opennurbs_defines.h | 4 ++-- src/other/openNURBS/opennurbs_file_utilities.cpp | 4 ++-- src/other/openNURBS/opennurbs_lock.h | 9 +++------ src/other/openNURBS/opennurbs_object_history.cpp | 2 +- src/other/openNURBS/opennurbs_statics.cpp | 4 ++-- src/other/openNURBS/opennurbs_system.h | 2 ++ src/other/openNURBS/opennurbs_version_number.cpp | 2 +- 7 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/other/openNURBS/opennurbs_defines.h b/src/other/openNURBS/opennurbs_defines.h index fa156baee6e..35e2e0cfba1 100644 --- a/src/other/openNURBS/opennurbs_defines.h +++ b/src/other/openNURBS/opennurbs_defines.h @@ -2133,7 +2133,7 @@ class ON_CLASS ON // the values. The reason for the gaps between the enum // values is to leave room for future snaps with prededence // falling between existing snaps - enum osnap_mode + enum osnap_mode: unsigned int { os_none = 0, os_near = 2, @@ -2409,7 +2409,7 @@ class ON_CLASS ON_COMPONENT_INDEX // Do not change these values; they are stored in 3dm archives // and provide a persistent way to indentify components of // complex objects. - enum TYPE + enum TYPE: unsigned int { invalid_type = 0, diff --git a/src/other/openNURBS/opennurbs_file_utilities.cpp b/src/other/openNURBS/opennurbs_file_utilities.cpp index 20e7e85d112..46cabb6926c 100644 --- a/src/other/openNURBS/opennurbs_file_utilities.cpp +++ b/src/other/openNURBS/opennurbs_file_utilities.cpp @@ -3302,13 +3302,13 @@ void ON_ContentHash::Dump( const ON_wString content_time = ( m_content_time <= 0 ) - ? L"unknown" + ? static_cast(L"unknown") : SecondsSinceJanOne1970UTCToString(m_content_time); text_log.Print(L"Content last modified time = %ls\n",static_cast(content_time)); const ON_wString hash_time = ( m_hash_time <= 0 ) - ? L"unknown" + ? static_cast(L"unknown") : SecondsSinceJanOne1970UTCToString(m_hash_time); text_log.Print(L"Content hash calculated time = %ls\n",static_cast(content_time)); diff --git a/src/other/openNURBS/opennurbs_lock.h b/src/other/openNURBS/opennurbs_lock.h index d7842354c17..4902d938943 100644 --- a/src/other/openNURBS/opennurbs_lock.h +++ b/src/other/openNURBS/opennurbs_lock.h @@ -112,13 +112,10 @@ class ON_CLASS ON_Lock // 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) - std::atomic m_lock_value; +#if defined(ON_CLANG_CONSTRUCTOR_BUG_INIT) + std::atomic m_lock_value; #else - //std::atomic m_lock_value = ON_Lock::UnlockedValue; - - // https://discourse.mcneel.com/t/on-compiler-gnu-support-for-opennurbs/77308 - std::atomic m_lock_value { ON_Lock::UnlockedValue }; + std::atomic m_lock_value = ON_Lock::UnlockedValue; #endif #pragma ON_PRAGMA_WARNING_POP }; diff --git a/src/other/openNURBS/opennurbs_object_history.cpp b/src/other/openNURBS/opennurbs_object_history.cpp index a3d06de48aa..fd77eaeedea 100644 --- a/src/other/openNURBS/opennurbs_object_history.cpp +++ b/src/other/openNURBS/opennurbs_object_history.cpp @@ -31,7 +31,7 @@ class ON_Value // The VALUE_TYPE enum values must never be changed // because the values are used to determine the parameter // type during file reading. Additions can be made. - enum VALUE_TYPE + enum VALUE_TYPE: unsigned int { no_value_type = 0, diff --git a/src/other/openNURBS/opennurbs_statics.cpp b/src/other/openNURBS/opennurbs_statics.cpp index bc23eb8fc67..075a3d9d90b 100644 --- a/src/other/openNURBS/opennurbs_statics.cpp +++ b/src/other/openNURBS/opennurbs_statics.cpp @@ -515,7 +515,7 @@ static ON_SHA1_Hash ON_SHA1_Hash_EmptyContentHash() const ON_SHA1_Hash ON_SHA1_Hash::EmptyContentHash = ON_SHA1_Hash_EmptyContentHash(); const ON_SHA1_Hash ON_SHA1_Hash::ZeroDigest ON_CLANG_CONSTRUCTOR_BUG_INIT(ON_SHA1_Hash); -const ONX_ModelTest ONX_ModelTest::Unset ON_CLANG_CONSTRUCTOR_BUG_INIT(ONX_ModelTest); +const ONX_ModelTest ONX_ModelTest::Unset = ONX_ModelTest(); // Works with Microsoft's CL, fails for Apple's CLang //// const struct ON_UnicodeErrorParameters ON_UnicodeErrorParameters::MaskErrors = { 0, 0xFFFFFFFF, ON_UnicodeCodePoint::ON_ReplacementCharacter }; @@ -744,7 +744,7 @@ const ON_AngleUnitName ON_AngleUnitName::None ON_CLANG_CONSTRUCTOR_BUG_INIT(ON_A const ON_LengthValue ON_LengthValue::Unset ON_CLANG_CONSTRUCTOR_BUG_INIT(ON_LengthValue); const ON_LengthValue ON_LengthValue::Zero = ON_LengthValue::Create(0.0, ON::LengthUnitSystem::None, 0, ON_LengthValue::StringFormat::CleanDecimal); -const ON_AngleValue ON_AngleValue::Unset ON_CLANG_CONSTRUCTOR_BUG_INIT(ON_AngleValue); +const ON_AngleValue ON_AngleValue::Unset = ON_AngleValue(); const ON_AngleValue ON_AngleValue::Zero = ON_AngleValue::Create(0.0, ON::AngleUnitSystem::None, 0, ON_AngleValue::StringFormat::CleanDecimal ); const ON_ScaleValue ON_ScaleValue::Unset ON_CLANG_CONSTRUCTOR_BUG_INIT(ON_ScaleValue); diff --git a/src/other/openNURBS/opennurbs_system.h b/src/other/openNURBS/opennurbs_system.h index 504fea2ff6a..a92eb9a8df9 100644 --- a/src/other/openNURBS/opennurbs_system.h +++ b/src/other/openNURBS/opennurbs_system.h @@ -542,6 +542,8 @@ typedef ON__UINT32 wchar_t; #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE #if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) #include "android_uuid/uuid.h" +#elif defined(ON_RUNTIME_WIN) +#include #else #include #endif diff --git a/src/other/openNURBS/opennurbs_version_number.cpp b/src/other/openNURBS/opennurbs_version_number.cpp index 7ca9e81c2ef..65379a76b67 100644 --- a/src/other/openNURBS/opennurbs_version_number.cpp +++ b/src/other/openNURBS/opennurbs_version_number.cpp @@ -375,7 +375,7 @@ const ON_String ON_VersionNumberToString( str_version = (0 != version_number) ? ON_String::FormatToString("0x%08X", version_number) - : "0"; + : static_cast("0"); } return str_version;