From 48906fde395dc05c18606ddf3abce5947ab6a1c6 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Wed, 19 Feb 2014 02:24:50 +0100 Subject: [PATCH 4/9] Eliminate some compiler warnings and errors --- address.h | 4 ++++ net.c | 4 ++++ net.h | 8 +++++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/address.h b/address.h index 403240e..0e715f1 100644 --- a/address.h +++ b/address.h @@ -106,6 +106,10 @@ _coap_address_equals_impl(const coap_address_t *a, return 0; } +#ifndef IN_MULTICAST +#define IN_MULTICAST(a) (1) +#endif + static inline int _coap_is_mcast_impl(const coap_address_t *a) { if (!a) diff --git a/net.c b/net.c index e90d49a..83097d1 100644 --- a/net.c +++ b/net.c @@ -45,6 +45,10 @@ #include "block.h" #include "net.h" +#ifndef UINT_MAX +#define UINT_MAX ((unsigned) -1ul) +#endif + #if defined(WITH_POSIX) time_t clock_offset; diff --git a/net.h b/net.h index f9afd48..59c7d59 100644 --- a/net.h +++ b/net.h @@ -132,7 +132,7 @@ typedef struct coap_context_t { * random value. A new message id can be created with * coap_new_message_id(). */ - unsigned short message_id; + uint16_t message_id; /** * The next value to be used for Observe. This field is global for @@ -196,9 +196,11 @@ coap_context_t *coap_new_context(const coap_address_t *listen_addr); static inline unsigned short coap_new_message_id(coap_context_t *context) { #ifndef WITH_CONTIKI - return htons(++(context->message_id)); + context->message_id += 1; + return htons(context->message_id); #else /* WITH_CONTIKI */ - return uip_htons(++context->message_id); + context->message_id += 1; + return uip_htons(context->message_id); #endif } -- 1.8.3.2