diff --git a/examples/DemoRunner/Builds/Android/app/CMakeLists.txt b/examples/DemoRunner/Builds/Android/app/CMakeLists.txt index a94f79001c..4c9882660b 100644 --- a/examples/DemoRunner/Builds/Android/app/CMakeLists.txt +++ b/examples/DemoRunner/Builds/Android/app/CMakeLists.txt @@ -720,12 +720,12 @@ add_library( ${BINARY_NAME} "../../../../../modules/juce_core/native/juce_linux_Threads.cpp" "../../../../../modules/juce_core/native/juce_mac_ClangBugWorkaround.h" "../../../../../modules/juce_core/native/juce_mac_Files.mm" - "../../../../../modules/juce_core/native/juce_mac_linux_IPAddress.h" "../../../../../modules/juce_core/native/juce_mac_Network.mm" "../../../../../modules/juce_core/native/juce_mac_Strings.mm" "../../../../../modules/juce_core/native/juce_mac_SystemStats.mm" "../../../../../modules/juce_core/native/juce_mac_Threads.mm" "../../../../../modules/juce_core/native/juce_osx_ObjCHelpers.h" + "../../../../../modules/juce_core/native/juce_posix_IPAddress.h" "../../../../../modules/juce_core/native/juce_posix_NamedPipe.cpp" "../../../../../modules/juce_core/native/juce_posix_SharedCode.h" "../../../../../modules/juce_core/native/juce_win32_ComSmartPtr.h" @@ -2288,12 +2288,12 @@ set_source_files_properties("../../../../../modules/juce_core/native/juce_linux_ set_source_files_properties("../../../../../modules/juce_core/native/juce_linux_Threads.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/native/juce_mac_ClangBugWorkaround.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/native/juce_mac_Files.mm" PROPERTIES HEADER_FILE_ONLY TRUE) -set_source_files_properties("../../../../../modules/juce_core/native/juce_mac_linux_IPAddress.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/native/juce_mac_Network.mm" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/native/juce_mac_Strings.mm" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/native/juce_mac_SystemStats.mm" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/native/juce_mac_Threads.mm" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/native/juce_osx_ObjCHelpers.h" PROPERTIES HEADER_FILE_ONLY TRUE) +set_source_files_properties("../../../../../modules/juce_core/native/juce_posix_IPAddress.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/native/juce_posix_NamedPipe.cpp" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/native/juce_posix_SharedCode.h" PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties("../../../../../modules/juce_core/native/juce_win32_ComSmartPtr.h" PROPERTIES HEADER_FILE_ONLY TRUE) diff --git a/examples/DemoRunner/Builds/VisualStudio2013/DemoRunner_App.vcxproj b/examples/DemoRunner/Builds/VisualStudio2013/DemoRunner_App.vcxproj index bfb115a79a..a810289cd3 100644 --- a/examples/DemoRunner/Builds/VisualStudio2013/DemoRunner_App.vcxproj +++ b/examples/DemoRunner/Builds/VisualStudio2013/DemoRunner_App.vcxproj @@ -2579,8 +2579,8 @@ - + diff --git a/examples/DemoRunner/Builds/VisualStudio2013/DemoRunner_App.vcxproj.filters b/examples/DemoRunner/Builds/VisualStudio2013/DemoRunner_App.vcxproj.filters index cbd5b45697..eab60e84db 100644 --- a/examples/DemoRunner/Builds/VisualStudio2013/DemoRunner_App.vcxproj.filters +++ b/examples/DemoRunner/Builds/VisualStudio2013/DemoRunner_App.vcxproj.filters @@ -3918,10 +3918,10 @@ JUCE Modules\juce_core\native - + JUCE Modules\juce_core\native - + JUCE Modules\juce_core\native diff --git a/examples/DemoRunner/Builds/VisualStudio2015/DemoRunner_App.vcxproj b/examples/DemoRunner/Builds/VisualStudio2015/DemoRunner_App.vcxproj index e6802872a1..5958cf3d42 100644 --- a/examples/DemoRunner/Builds/VisualStudio2015/DemoRunner_App.vcxproj +++ b/examples/DemoRunner/Builds/VisualStudio2015/DemoRunner_App.vcxproj @@ -2579,8 +2579,8 @@ - + diff --git a/examples/DemoRunner/Builds/VisualStudio2015/DemoRunner_App.vcxproj.filters b/examples/DemoRunner/Builds/VisualStudio2015/DemoRunner_App.vcxproj.filters index b1b3da4d42..a9d95373ba 100644 --- a/examples/DemoRunner/Builds/VisualStudio2015/DemoRunner_App.vcxproj.filters +++ b/examples/DemoRunner/Builds/VisualStudio2015/DemoRunner_App.vcxproj.filters @@ -3918,10 +3918,10 @@ JUCE Modules\juce_core\native - + JUCE Modules\juce_core\native - + JUCE Modules\juce_core\native diff --git a/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj b/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj index c8b67c0b78..68e84ccba4 100644 --- a/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj +++ b/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj @@ -2581,8 +2581,8 @@ - + diff --git a/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj.filters b/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj.filters index 9aec1c8871..219a21892f 100644 --- a/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj.filters +++ b/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj.filters @@ -3918,10 +3918,10 @@ JUCE Modules\juce_core\native - + JUCE Modules\juce_core\native - + JUCE Modules\juce_core\native diff --git a/modules/juce_core/juce_core.cpp b/modules/juce_core/juce_core.cpp index 856a53aaca..111060cfd8 100644 --- a/modules/juce_core/juce_core.cpp +++ b/modules/juce_core/juce_core.cpp @@ -105,6 +105,7 @@ #endif #if JUCE_ANDROID + #include #include #endif @@ -186,12 +187,14 @@ #if ! JUCE_WINDOWS #include "native/juce_posix_SharedCode.h" #include "native/juce_posix_NamedPipe.cpp" +#if ! JUCE_ANDROID || __ANDROID_API__ >= 24 + #include "native/juce_posix_IPAddress.h" +#endif #endif //============================================================================== #if JUCE_MAC || JUCE_IOS #include "native/juce_mac_Files.mm" -#include "native/juce_mac_linux_IPAddress.h" #include "native/juce_mac_Network.mm" #include "native/juce_mac_Strings.mm" #include "native/juce_mac_SystemStats.mm" @@ -209,7 +212,6 @@ #elif JUCE_LINUX #include "native/juce_linux_CommonFile.cpp" #include "native/juce_linux_Files.cpp" -#include "native/juce_mac_linux_IPAddress.h" #include "native/juce_linux_Network.cpp" #if JUCE_USE_CURL #include "native/juce_curl_Network.cpp" diff --git a/modules/juce_core/native/juce_android_Network.cpp b/modules/juce_core/native/juce_android_Network.cpp index ba85fc54d6..6942cda4bc 100644 --- a/modules/juce_core/native/juce_android_Network.cpp +++ b/modules/juce_core/native/juce_android_Network.cpp @@ -342,6 +342,8 @@ URL::DownloadTask* URL::downloadToFile (const File& targetLocation, String extra } //============================================================================== +#if __ANDROID_API__ < 24 // Android support for getifadds was added in Android 7.0 (API 24) so the posix implementation does not apply + static IPAddress makeAddress (const sockaddr_in *addr_in) { if (addr_in->sin_addr.s_addr == INADDR_NONE) @@ -382,15 +384,15 @@ static Array findIPAddresses (int dummySocket) if (item.ifr_addr.sa_family == AF_INET) { - InterfaceInfo i; - i.interfaceAddress = makeAddress ((const sockaddr_in*) &item.ifr_addr); + InterfaceInfo info; + info.interfaceAddress = makeAddress ((const sockaddr_in*) &item.ifr_addr); - if (! i.interfaceAddress.isNull()) + if (! info.interfaceAddress.isNull()) { if (ioctl (dummySocket, SIOCGIFBRDADDR, &item) == 0) - i.broadcastAddress = makeAddress ((const sockaddr_in*) &item.ifr_broadaddr); + info.broadcastAddress = makeAddress ((const sockaddr_in*) &item.ifr_broadaddr); - result.add (i); + result.add (info); } } else if (item.ifr_addr.sa_family == AF_INET6) @@ -429,5 +431,6 @@ IPAddress IPAddress::getInterfaceBroadcastAddress (const IPAddress& address) return {}; } +#endif } // namespace juce diff --git a/modules/juce_core/native/juce_mac_linux_IPAddress.h b/modules/juce_core/native/juce_posix_IPAddress.h similarity index 100% rename from modules/juce_core/native/juce_mac_linux_IPAddress.h rename to modules/juce_core/native/juce_posix_IPAddress.h