From f4e4f56a631a82ce65815a461461883fd0e04911 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 28 Sep 2015 11:02:53 +0200 Subject: [PATCH] tinydtls: fix and activate android debug.c build This patch activates the build of debug.c on android and also fixes one build issue with this code in android. in_port_t is not defined in in the android NDK, use "unsigned short int" instead because this is also used by sin_port in the Android NDK. There is already a bug for Android open to fix this problem in Android here: https://code.google.com/p/android/issues/detail?id=80713 With this change the tinydtls debug.c file compiles for me for Android. Change-Id: Id03a319768357ea1bef3f86ac2342e61e2b26b79 Signed-off-by: Hauke Mehrtens Reviewed-on: https://gerrit.iotivity.org/gerrit/3195 Tested-by: jenkins-iotivity Reviewed-by: Sachin Agrawal --- extlibs/tinydtls/SConscript | 2 +- extlibs/tinydtls/debug.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/extlibs/tinydtls/SConscript b/extlibs/tinydtls/SConscript index 7ca5ae2..1f3c2a7 100644 --- a/extlibs/tinydtls/SConscript +++ b/extlibs/tinydtls/SConscript @@ -61,7 +61,7 @@ tinydtls_src = [ env.AppendUnique(TINYDTLS_SRC = tinydtls_src) if not env.get('RELEASE'): - if(target_os) not in ['android', 'arduino']: + if(target_os) not in ['arduino']: env.AppendUnique(TINYDTLS_SRC = ['debug.c']) else: env.AppendUnique(CPPDEFINES = ['NDEBUG']) diff --git a/extlibs/tinydtls/debug.c b/extlibs/tinydtls/debug.c index 2726833..589c091 100644 --- a/extlibs/tinydtls/debug.c +++ b/extlibs/tinydtls/debug.c @@ -134,7 +134,11 @@ static size_t dsrv_print_addr(const session_t *addr, char *buf, size_t len) { #ifdef HAVE_ARPA_INET_H const void *addrptr = NULL; +#ifdef __ANDROID__ + unsigned short int port; +#else in_port_t port; +#endif char *p = buf; switch (addr->addr.sa.sa_family) { -- 2.7.4