From 4e9738b8fa067500579691bfc614e6393226f4d8 Mon Sep 17 00:00:00 2001 From: tobil4sk Date: Tue, 11 Apr 2023 18:07:02 +0100 Subject: [PATCH 1/2] Fix dynamic constructor errors on mingw --- include/Dynamic.h | 6 +++--- src/Dynamic.cpp | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/Dynamic.h b/include/Dynamic.h index bf5f5b6a7..b0029b7b3 100644 --- a/include/Dynamic.h +++ b/include/Dynamic.h @@ -38,7 +38,7 @@ class HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic : public hx::ObjectPtr Dynamic(const cpp::Variant &inRHS) : super(inRHS.asDynamic()) { } template Dynamic(const hx::Native &inInterface):super(inInterface.ptr ? inInterface->__GetRealObject() : (hx::Object *)0 ) { } - #if !defined(__GNUC__) || (defined(__WORDSIZE) && (__WORDSIZE != 64)) + #if !defined(__GNUC__) || defined(__MINGW32__) || (defined(__WORDSIZE) && (__WORDSIZE != 64)) Dynamic(long inVal); Dynamic(unsigned long inVal); #endif @@ -408,7 +408,7 @@ HXCPP_EXTERN_CLASS_ATTRIBUTES hx::Class &GetInt64Class(); template<> inline bool Dynamic::IsClass() { return mPtr && mPtr->__GetClass()==hx::GetIntClass(); } template<> -inline bool Dynamic::IsClass() { return mPtr && +inline bool Dynamic::IsClass() { return mPtr && ( mPtr->__GetClass()==hx::GetIntClass() || mPtr->__GetClass()==hx::GetFloatClass()) ; } template<> inline bool Dynamic::IsClass() { return mPtr && mPtr->__GetClass()==hx::GetFloatClass(); } @@ -458,7 +458,7 @@ bool operator==(Platform::Box ^inPtr, nullptr_t) inline bool operator op (float inLHS,const ::Dynamic &inRHS) \ { return inRHS.IsNumeric() && ((double)inLHS op (double)inRHS); } \ inline bool operator op (int inLHS,const ::Dynamic &inRHS) \ - { return inRHS.IsNumeric() && (inLHS op (double)inRHS); } + { return inRHS.IsNumeric() && (inLHS op (double)inRHS); } COMPARE_DYNAMIC_OP( < ) COMPARE_DYNAMIC_OP( <= ) diff --git a/src/Dynamic.cpp b/src/Dynamic.cpp index 415078061..90274e910 100644 --- a/src/Dynamic.cpp +++ b/src/Dynamic.cpp @@ -302,7 +302,7 @@ class StructData : public hx::Object diff = __GetType() - inRHS->__GetType(); if (diff==0) diff = memcmp( mValue, inRHS->__GetHandle(), mLength ); - + if (diff<0) return -1; if (diff>0) return 1; return 0; @@ -386,7 +386,7 @@ Dynamic::Dynamic(short inVal) mPtr = fromInt(inVal); } -#if !defined(__GNUC__) || (defined(__WORDSIZE) && (__WORDSIZE != 64)) +#if !defined(__GNUC__) || defined(__MINGW32__) || (defined(__WORDSIZE) && (__WORDSIZE != 64)) Dynamic::Dynamic(unsigned long inVal) { mPtr = fromInt(inVal); @@ -642,5 +642,3 @@ void Dynamic::__boot() Static(__ObjcClass) = hx::_hx_RegisterClass(HX_CSTRING("objc::BoxedType"),IsPointer,sNone,sNone, 0,0,&__ObjcClass ); #endif } - - From 8a1e30101045c1fe0172df1f805378f94b9f71e1 Mon Sep 17 00:00:00 2001 From: tobil4sk Date: Tue, 11 Apr 2023 23:13:49 +0100 Subject: [PATCH 2/2] Fix Socket.cpp when compiling with mingw on linux --- src/hx/libs/std/Socket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hx/libs/std/Socket.cpp b/src/hx/libs/std/Socket.cpp index 771bc213d..1417e7b5e 100644 --- a/src/hx/libs/std/Socket.cpp +++ b/src/hx/libs/std/Socket.cpp @@ -11,7 +11,7 @@ // Mingw / gcc on windows #define _WIN32_WINNT 0x0501 #include - # include + #include #else // Windows... #include @@ -412,7 +412,7 @@ Array _hx_std_host_resolve_ipv6( String host, bool ) memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_INET6; // IPv6 hints.ai_socktype = 0; // any - SOCK_STREAM or SOCK_DGRAM - hints.ai_flags = AI_PASSIVE; // For wildcard IP address + hints.ai_flags = AI_PASSIVE; // For wildcard IP address hints.ai_protocol = 0; // Any protocol hints.ai_canonname = 0; hints.ai_addr = 0;