Skip to content

Commit

Permalink
Fix compiler errors on mingw (#1044)
Browse files Browse the repository at this point in the history
* Fix dynamic constructor errors on mingw

* Fix Socket.cpp when compiling with mingw on linux
  • Loading branch information
tobil4sk committed Nov 29, 2023
1 parent b8ee179 commit 18f87b9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions include/Dynamic.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic : public hx::ObjectPtr<hx::Object>
Dynamic(const cpp::Variant &inRHS) : super(inRHS.asDynamic()) { }
template<typename T>
Dynamic(const hx::Native<T *> &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
Expand Down Expand Up @@ -408,7 +408,7 @@ HXCPP_EXTERN_CLASS_ATTRIBUTES hx::Class &GetInt64Class();
template<>
inline bool Dynamic::IsClass<int>() { return mPtr && mPtr->__GetClass()==hx::GetIntClass(); }
template<>
inline bool Dynamic::IsClass<double>() { return mPtr &&
inline bool Dynamic::IsClass<double>() { return mPtr &&
( mPtr->__GetClass()==hx::GetIntClass() || mPtr->__GetClass()==hx::GetFloatClass()) ; }
template<>
inline bool Dynamic::IsClass<float>() { return mPtr && mPtr->__GetClass()==hx::GetFloatClass(); }
Expand Down Expand Up @@ -458,7 +458,7 @@ bool operator==(Platform::Box<T> ^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( <= )
Expand Down
6 changes: 2 additions & 4 deletions src/Dynamic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -642,5 +642,3 @@ void Dynamic::__boot()
Static(__ObjcClass) = hx::_hx_RegisterClass(HX_CSTRING("objc::BoxedType"),IsPointer,sNone,sNone, 0,0,&__ObjcClass );
#endif
}


4 changes: 2 additions & 2 deletions src/hx/libs/std/Socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// Mingw / gcc on windows
#define _WIN32_WINNT 0x0501
#include <winsock2.h>
# include <Ws2tcpip.h>
#include <ws2tcpip.h>
#else
// Windows...
#include <winsock2.h>
Expand Down Expand Up @@ -412,7 +412,7 @@ Array<unsigned char> _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;
Expand Down

0 comments on commit 18f87b9

Please sign in to comment.