mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Used the shared posix networking code for Android where the target SDK supports it
This commit is contained in:
parent
a3566b8c1e
commit
2666842fa5
10 changed files with 23 additions and 18 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -2579,8 +2579,8 @@
|
|||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_android_JNIHelpers.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_BasicNativeHeaders.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_mac_ClangBugWorkaround.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_mac_linux_IPAddress.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_osx_ObjCHelpers.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_posix_IPAddress.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_posix_SharedCode.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_win32_ComSmartPtr.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\network\juce_IPAddress.h"/>
|
||||
|
|
|
|||
|
|
@ -3918,10 +3918,10 @@
|
|||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_mac_ClangBugWorkaround.h">
|
||||
<Filter>JUCE Modules\juce_core\native</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_mac_linux_IPAddress.h">
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_osx_ObjCHelpers.h">
|
||||
<Filter>JUCE Modules\juce_core\native</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_osx_ObjCHelpers.h">
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_posix_IPAddress.h">
|
||||
<Filter>JUCE Modules\juce_core\native</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_posix_SharedCode.h">
|
||||
|
|
|
|||
|
|
@ -2579,8 +2579,8 @@
|
|||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_android_JNIHelpers.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_BasicNativeHeaders.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_mac_ClangBugWorkaround.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_mac_linux_IPAddress.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_osx_ObjCHelpers.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_posix_IPAddress.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_posix_SharedCode.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_win32_ComSmartPtr.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\network\juce_IPAddress.h"/>
|
||||
|
|
|
|||
|
|
@ -3918,10 +3918,10 @@
|
|||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_mac_ClangBugWorkaround.h">
|
||||
<Filter>JUCE Modules\juce_core\native</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_mac_linux_IPAddress.h">
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_osx_ObjCHelpers.h">
|
||||
<Filter>JUCE Modules\juce_core\native</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_osx_ObjCHelpers.h">
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_posix_IPAddress.h">
|
||||
<Filter>JUCE Modules\juce_core\native</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_posix_SharedCode.h">
|
||||
|
|
|
|||
|
|
@ -2581,8 +2581,8 @@
|
|||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_android_JNIHelpers.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_BasicNativeHeaders.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_mac_ClangBugWorkaround.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_mac_linux_IPAddress.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_osx_ObjCHelpers.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_posix_IPAddress.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_posix_SharedCode.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_win32_ComSmartPtr.h"/>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\network\juce_IPAddress.h"/>
|
||||
|
|
|
|||
|
|
@ -3918,10 +3918,10 @@
|
|||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_mac_ClangBugWorkaround.h">
|
||||
<Filter>JUCE Modules\juce_core\native</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_mac_linux_IPAddress.h">
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_osx_ObjCHelpers.h">
|
||||
<Filter>JUCE Modules\juce_core\native</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_osx_ObjCHelpers.h">
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_posix_IPAddress.h">
|
||||
<Filter>JUCE Modules\juce_core\native</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\modules\juce_core\native\juce_posix_SharedCode.h">
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@
|
|||
#endif
|
||||
|
||||
#if JUCE_ANDROID
|
||||
#include <ifaddrs.h>
|
||||
#include <android/log.h>
|
||||
#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"
|
||||
|
|
|
|||
|
|
@ -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<InterfaceInfo> 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue