diff --git a/examples/Demo/Source/Demos/VideoDemo.cpp b/examples/Demo/Source/Demos/VideoDemo.cpp index 589dc25aba..66b7a9da33 100644 --- a/examples/Demo/Source/Demos/VideoDemo.cpp +++ b/examples/Demo/Source/Demos/VideoDemo.cpp @@ -26,7 +26,7 @@ #include "../JuceDemoHeader.h" -#if JUCE_MAC || JUCE_WINDOWS +#if JUCE_MAC || (JUCE_WINDOWS && ! JUCE_MINGW) //============================================================================== // so that we can easily have two video windows each with a file browser, wrap this up as a class.. diff --git a/modules/juce_core/juce_core.cpp b/modules/juce_core/juce_core.cpp index df5d73287b..136dd284e7 100644 --- a/modules/juce_core/juce_core.cpp +++ b/modules/juce_core/juce_core.cpp @@ -61,6 +61,8 @@ #if JUCE_MINGW #include + #include + #include #endif #else diff --git a/modules/juce_core/native/juce_win32_Network.cpp b/modules/juce_core/native/juce_win32_Network.cpp index 21da41aba4..bdc7dc9c4d 100644 --- a/modules/juce_core/native/juce_win32_Network.cpp +++ b/modules/juce_core/native/juce_win32_Network.cpp @@ -503,6 +503,17 @@ namespace MACAddressHelpers } } } + + static void split (const sockaddr_in6* sa_in6, int off, uint8* split) + { + #if JUCE_MINGW + split[0] = sa_in6->sin6_addr._S6_un._S6_u8[off + 1]; + split[1] = sa_in6->sin6_addr._S6_un._S6_u8[off]; + #else + split[0] = sa_in6->sin6_addr.u.Byte[off + 1]; + split[1] = sa_in6->sin6_addr.u.Byte[off]; + #endif + } } void MACAddress::findAllAddresses (Array& result) @@ -541,9 +552,7 @@ void IPAddress::findAllAddresses (Array& result, bool includeIPv6) for (int i = 0; i < 8; ++i) { - temp.split[0] = sa_in6->sin6_addr.u.Byte[i * 2 + 1]; - temp.split[1] = sa_in6->sin6_addr.u.Byte[i * 2]; - + MACAddressHelpers::split (sa_in6, i * 2, temp.split); arr[i] = temp.combined; } @@ -570,9 +579,7 @@ void IPAddress::findAllAddresses (Array& result, bool includeIPv6) for (int i = 0; i < 8; ++i) { - temp.split[0] = sa_in6->sin6_addr.u.Byte[i * 2 + 1]; - temp.split[1] = sa_in6->sin6_addr.u.Byte[i * 2]; - + MACAddressHelpers::split (sa_in6, i * 2, temp.split); arr[i] = temp.combined; } @@ -599,9 +606,7 @@ void IPAddress::findAllAddresses (Array& result, bool includeIPv6) for (int i = 0; i < 8; ++i) { - temp.split[0] = sa_in6->sin6_addr.u.Byte[i * 2 + 1]; - temp.split[1] = sa_in6->sin6_addr.u.Byte[i * 2]; - + MACAddressHelpers::split (sa_in6, i * 2, temp.split); arr[i] = temp.combined; } diff --git a/modules/juce_core/native/juce_win32_SystemStats.cpp b/modules/juce_core/native/juce_win32_SystemStats.cpp index 3f28dded45..e2b4409350 100644 --- a/modules/juce_core/native/juce_win32_SystemStats.cpp +++ b/modules/juce_core/native/juce_win32_SystemStats.cpp @@ -107,6 +107,13 @@ String SystemStats::getCpuModel() static int findNumberOfPhysicalCores() noexcept { + #if JUCE_MINGW + // Not implemented in MinGW + jassertfalse; + + return 1; + #else + int numPhysicalCores = 0; DWORD bufferSize = 0; GetLogicalProcessorInformation (nullptr, &bufferSize); @@ -122,6 +129,7 @@ static int findNumberOfPhysicalCores() noexcept } return numPhysicalCores; + #endif // JUCE_MINGW } //============================================================================== diff --git a/modules/juce_core/system/juce_StandardHeader.h b/modules/juce_core/system/juce_StandardHeader.h index f194fe4477..896d5b4da1 100644 --- a/modules/juce_core/system/juce_StandardHeader.h +++ b/modules/juce_core/system/juce_StandardHeader.h @@ -114,6 +114,11 @@ #include "../misc/juce_StdFunctionCompat.h" #endif +// The live build fails to compile std::stringstream +#if ! JUCE_PROJUCER_LIVE_BUILD + #include +#endif + // Include std::atomic if it's supported by the compiler #if JUCE_ATOMIC_AVAILABLE #include diff --git a/modules/juce_core/text/juce_CharPointer_UTF8.h b/modules/juce_core/text/juce_CharPointer_UTF8.h index 0d3c5d6634..7b5a91df90 100644 --- a/modules/juce_core/text/juce_CharPointer_UTF8.h +++ b/modules/juce_core/text/juce_CharPointer_UTF8.h @@ -471,7 +471,7 @@ public: /** Parses this string as a 64-bit integer. */ int64 getIntValue64() const noexcept { - #if JUCE_WINDOWS + #if JUCE_WINDOWS && ! JUCE_MINGW return _atoi64 (data); #else return atoll (data); diff --git a/modules/juce_core/text/juce_CharacterFunctions.h b/modules/juce_core/text/juce_CharacterFunctions.h index 27894bd8f5..d9cec4bac6 100644 --- a/modules/juce_core/text/juce_CharacterFunctions.h +++ b/modules/juce_core/text/juce_CharacterFunctions.h @@ -231,17 +231,22 @@ public: *currentCharacter++ = '0'; } - #if JUCE_WINDOWS - static _locale_t locale = _create_locale (LC_ALL, "C"); - return _strtod_l (&buffer[0], nullptr, locale); - #else - static locale_t locale = newlocale (LC_ALL_MASK, "C", nullptr); - #if JUCE_ANDROID - return (double) strtold_l (&buffer[0], nullptr, locale); + #if JUCE_PROJUCER_LIVE_BUILD + // This will change with locale! + return strtod (&buffer[0], nullptr); #else - return strtod_l (&buffer[0], nullptr, locale); + double result = 0; + const size_t stringSize = (size_t) (currentCharacter - &buffer[0]) + 1; + + if (stringSize > 1) + { + std::istringstream is (std::string (&buffer[0], stringSize)); + is.imbue (std::locale ("C")); + is >> result; + } + + return result; #endif - #endif } /** Parses a character string, to read a floating-point value. */ diff --git a/modules/juce_graphics/juce_graphics.cpp b/modules/juce_graphics/juce_graphics.cpp index 373c9f4e4d..2dcbc5e8bb 100644 --- a/modules/juce_graphics/juce_graphics.cpp +++ b/modules/juce_graphics/juce_graphics.cpp @@ -68,6 +68,7 @@ #if JUCE_MINGW #include + #include #endif #ifdef JUCE_MSVC diff --git a/modules/juce_gui_extra/native/juce_win32_WebBrowserComponent.cpp b/modules/juce_gui_extra/native/juce_win32_WebBrowserComponent.cpp index 77ba594e24..7ca294913c 100644 --- a/modules/juce_gui_extra/native/juce_win32_WebBrowserComponent.cpp +++ b/modules/juce_gui_extra/native/juce_win32_WebBrowserComponent.cpp @@ -30,6 +30,12 @@ namespace juce JUCE_DECLARE_UUID_GETTER (DWebBrowserEvents2, "34A715A0-6587-11D0-924A-0020AFC7AC4D") JUCE_DECLARE_UUID_GETTER (IConnectionPointContainer, "B196B284-BAB4-101A-B69C-00AA00341D07") JUCE_DECLARE_UUID_GETTER (IWebBrowser2, "D30C1661-CDAF-11D0-8A3E-00C04FC9E26E") + +#if JUCE_MINGW + #define DISPID_NAVIGATEERROR 271 + class WebBrowser; +#endif + JUCE_DECLARE_UUID_GETTER (WebBrowser, "8856F961-340A-11D0-A96B-00C04FD705A2") class WebBrowserComponent::Pimpl : public ActiveXControlComponent @@ -392,12 +398,18 @@ void WebBrowserComponent::clearCookies() { HeapBlock<::INTERNET_CACHE_ENTRY_INFO> entry; ::DWORD entrySize = sizeof (::INTERNET_CACHE_ENTRY_INFO); - ::HANDLE urlCacheHandle = ::FindFirstUrlCacheEntry (TEXT ("cookie:"), entry.getData(), &entrySize); + + #if JUCE_MINGW + const auto searchPattern = "cookie:"; + #else + const auto searchPattern = TEXT ("cookie:"); + #endif + ::HANDLE urlCacheHandle = ::FindFirstUrlCacheEntry (searchPattern, entry.getData(), &entrySize); if (urlCacheHandle == nullptr && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { entry.realloc (1, entrySize); - urlCacheHandle = ::FindFirstUrlCacheEntry (TEXT ("cookie:"), entry.getData(), &entrySize); + urlCacheHandle = ::FindFirstUrlCacheEntry (searchPattern, entry.getData(), &entrySize); } if (urlCacheHandle != nullptr)