Skip to content

Commit 8101b85

Browse files
committed
- Android compile fixes
1 parent 81b84ad commit 8101b85

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

Net/include/Poco/Net/ICMPv4PacketImpl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,12 @@ class Net_API ICMPv4PacketImpl : public ICMPPacketImpl
6969
};
7070

7171
// compile-time shield against misalignment
72+
#ifndef POCO_ANDROID
7273
poco_static_assert (offsetof(Header, code) == 0x01);
7374
poco_static_assert (offsetof(Header, checksum) == 0x02);
7475
poco_static_assert (offsetof(Header, id) == 0x04);
7576
poco_static_assert (offsetof(Header, seq) == 0x06);
77+
#endif
7678

7779
enum MessageType
7880
{

Net/include/Poco/Net/SocketDefs.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@
3939
#ifndef Net_SocketDefs_INCLUDED
4040
#define Net_SocketDefs_INCLUDED
4141

42+
#ifndef __THROW
43+
# ifndef __GNUC_PREREQ
44+
# define __GNUC_PREREQ(maj, min) (0)
45+
# endif
46+
# if defined __cplusplus && __GNUC_PREREQ (2,8)
47+
# define __THROW throw ()
48+
# else
49+
# define __THROW
50+
# endif
51+
#endif
4252

4353
#if defined(POCO_OS_FAMILY_WINDOWS)
4454
#include "Poco/UnWindows.h"

Net/src/NetworkInterface.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,9 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
12761276

12771277

12781278
#include <sys/types.h>
1279+
#ifndef POCO_ANDROID // Android doesn't have <ifaddrs.h>
12791280
#include <ifaddrs.h>
1281+
#endif
12801282
#include <linux/if.h>
12811283
#include <linux/if_packet.h>
12821284
#include <net/if_arp.h>
@@ -1306,6 +1308,8 @@ static NetworkInterface::Type fromNative(unsigned arphrd)
13061308
}
13071309
}
13081310

1311+
#ifndef POCO_ANDROID
1312+
13091313
void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl)
13101314
{
13111315
struct sockaddr_ll* sdl = (struct sockaddr_ll*) iface->ifa_addr;
@@ -1317,11 +1321,14 @@ void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl)
13171321
impl.setType(fromNative(sdl->sll_hatype));
13181322
}
13191323

1324+
#endif
1325+
13201326
}
13211327

13221328

13231329
NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
13241330
{
1331+
#ifndef POCO_ANDROID
13251332
FastMutex::ScopedLock lock(_mutex);
13261333
Map result;
13271334
unsigned ifIndex = 0;
@@ -1420,6 +1427,9 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
14201427
if (ifaces) freeifaddrs(ifaces);
14211428

14221429
return result;
1430+
#else
1431+
throw Poco::NotImplementedException("Not implemented in Android");
1432+
#endif
14231433
}
14241434

14251435

0 commit comments

Comments
 (0)