0004-Eliminate-some-compiler-warnings-and-errors.patch
1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From 48906fde395dc05c18606ddf3abce5947ab6a1c6 Mon Sep 17 00:00:00 2001
From: Martine Lenders <mlenders@inf.fu-berlin.de>
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