From 55f2219ab98b039f256671c5e584a61ab52bfed0 Mon Sep 17 00:00:00 2001 From: Angelo Mantellini Date: Thu, 30 Jan 2020 10:44:19 +0100 Subject: [HICN-489] Add iOS support to hicn stack Signed-off-by: Angelo Mantellini Change-Id: I8fa8c4eaa3218eb4be46f713b15ab789c6930aa0 --- lib/includes/hicn/util/map.h | 2 +- lib/includes/hicn/util/set.h | 2 +- lib/src/CMakeLists.txt | 2 +- lib/src/name.c | 8 ++++---- lib/src/policy.c | 8 ++++---- lib/src/util/ip_address.c | 10 +++++----- 6 files changed, 16 insertions(+), 16 deletions(-) (limited to 'lib') diff --git a/lib/includes/hicn/util/map.h b/lib/includes/hicn/util/map.h index 1ac5812ef..01195865e 100644 --- a/lib/includes/hicn/util/map.h +++ b/lib/includes/hicn/util/map.h @@ -94,7 +94,7 @@ NAME ## _pair_snprintf(char * buf, size_t size, const NAME ## _pair_t * pair) { if (rc < 0) \ return rc; \ rc = VALUE_SNPRINTF(buf+rc, BUFSIZE/2, (VAL_T)pair->value); \ - return rc; \ + return (int)rc; \ } \ \ TYPEDEF_SET(NAME ## _pair_set, NAME ## _pair_t *, NAME ## _pair_cmp, NAME ## _pair_snprintf); \ diff --git a/lib/includes/hicn/util/set.h b/lib/includes/hicn/util/set.h index b4673a673..bc2e3caac 100644 --- a/lib/includes/hicn/util/set.h +++ b/lib/includes/hicn/util/set.h @@ -232,7 +232,7 @@ NAME ## _get_array(const NAME ## _t * set, T ** element) \ twalk(set->root, NAME ## _add_node_to_array); \ NAME ## _array_pos = NULL; \ END: \ - return set->size; \ + return (int)(set->size); \ } #endif /* UTIL_SET_H */ diff --git a/lib/src/CMakeLists.txt b/lib/src/CMakeLists.txt index f68e7a551..7eecaf775 100644 --- a/lib/src/CMakeLists.txt +++ b/lib/src/CMakeLists.txt @@ -35,7 +35,7 @@ set (COMPILER_DEFINITIONS "-DWITH_MAPME") include(BuildMacros) include(WindowsMacros) -if (${CMAKE_SYSTEM_NAME} STREQUAL "Android") +if (DISABLE_SHARED_LIBRARIES) build_library(${LIBHICN} STATIC SOURCES ${LIBHICN_SOURCE_FILES} ${LIBHICN_HEADER_FILES} ${LIBHICN_HEADER_FILES_PROTOCOL} ${LIBHICN_HEADER_FILES_UTIL} diff --git a/lib/src/name.c b/lib/src/name.c index 6c7945a18..7c1f7582a 100644 --- a/lib/src/name.c +++ b/lib/src/name.c @@ -460,19 +460,19 @@ hicn_name_ntop (const hicn_name_t * src, char *dst, size_t len) switch (src->type) { case HNT_CONTIGUOUS_V6: - rc = inet_ntop (AF_INET6, src->buffer, dst, len); + rc = inet_ntop (AF_INET6, src->buffer, dst, (socklen_t)len); seg_number = (u8 *) src->buffer + IPV6_ADDR_LEN; break; case HNT_CONTIGUOUS_V4: - rc = inet_ntop (AF_INET, src->buffer, dst, len); + rc = inet_ntop (AF_INET, src->buffer, dst, (socklen_t)len); seg_number = (u8 *) src->buffer + IPV4_ADDR_LEN; break; case HNT_IOV_V6: - rc = inet_ntop (AF_INET6, src->iov.buffers[0].iov_base, dst, len); + rc = inet_ntop (AF_INET6, src->iov.buffers[0].iov_base, dst, (socklen_t)len); seg_number = src->iov.buffers[1].iov_base; break; case HNT_IOV_V4: - rc = inet_ntop (AF_INET, src->iov.buffers[0].iov_base, dst, len); + rc = inet_ntop (AF_INET, src->iov.buffers[0].iov_base, dst, (socklen_t)len); seg_number = src->iov.buffers[1].iov_base; break; default: diff --git a/lib/src/policy.c b/lib/src/policy.c index edbb02bea..694f0ea5e 100644 --- a/lib/src/policy.c +++ b/lib/src/policy.c @@ -49,13 +49,13 @@ policy_tag_state_snprintf(char * s, size_t size, const policy_tag_state_t * tag_ return -1; rc = snprintf(cur, s + size - cur, "%s%s", (tag_state->disabled == 1) ? "!" : "", policy_state_str[tag_state->state]); - if (rc >= s + size - cur) - return s + size - cur; + if (rc >= (int)(s + size - cur)) + return (int)(s + size - cur); if (rc < 0) return rc; cur += rc; if (size != 0 && cur >= s + size) - return cur - s; + return (int)(cur - s); - return cur - s; + return (int)(cur - s); } diff --git a/lib/src/util/ip_address.c b/lib/src/util/ip_address.c index 49818de40..805b0b261 100644 --- a/lib/src/util/ip_address.c +++ b/lib/src/util/ip_address.c @@ -91,10 +91,10 @@ ip_address_ntop (const ip_address_t * ip_address, char *dst, const size_t len, const char * s; switch(family) { case AF_INET: - s = inet_ntop (AF_INET, ip_address->v4.buffer, dst, len); + s = inet_ntop (AF_INET, ip_address->v4.buffer, dst, (socklen_t)len); break; case AF_INET6: - s = inet_ntop (AF_INET6, ip_address->v6.buffer, dst, len); + s = inet_ntop (AF_INET6, ip_address->v6.buffer, dst, (socklen_t)len); break; default: return -1; @@ -156,7 +156,7 @@ ip_address_snprintf(char * s, size_t size, const ip_address_t * ip_address, int } if (!rc) return -1; - return strlen(s); + return (int)strlen(s); } int @@ -281,7 +281,7 @@ ip_prefix_ntop_short(const ip_prefix_t * ip_prefix, char *dst, size_t size) return -1; int rc = snprintf(dst, size, "%s", ip_s); if (rc >= size) - return size; + return (int)size; return rc; } @@ -304,7 +304,7 @@ ip_prefix_ntop(const ip_prefix_t * ip_prefix, char *dst, size_t size) return -1; int rc = snprintf(dst, size, "%s/%d", ip_s, ip_prefix->len); if (rc >= size) - return size; + return (int)size; return rc; } -- cgit 1.2.3-korg