pkg/libcoap: fix copmilation problems

Apparently all that whitespace was needed after all.
Next convert to new-style function declrations.
Also, don't prevent make from noticing a failing patch.
This commit is contained in:
Ludwig Ortmann 2014-07-15 17:08:03 +02:00
parent d4ff405e21
commit ccfe6d7bb7
3 changed files with 153 additions and 37 deletions

View File

@ -1,6 +1,6 @@
From 809b869b17623c8ec00c4ad421317037db30f3bf Mon Sep 17 00:00:00 2001 From e53472f0a5f15d2459bf9a9ef40d2b302bb80f8b Mon Sep 17 00:00:00 2001
From: Martin Lenders <mail@martin-lenders.de> From: Ludwig Ortmann <ludwig.ortmann@fu-berlin.de>
Date: Thu, 31 Oct 2013 15:15:07 +0100 Date: Tue, 15 Jul 2014 16:57:07 +0200
Subject: [PATCH 3/4] Remove two example programs in root Subject: [PATCH 3/4] Remove two example programs in root
--- ---
@ -73,7 +73,7 @@ index e4b2fe5..0000000
-void -void
-init_coap() { -init_coap() {
- coap_address_t listen_addr; - coap_address_t listen_addr;
- -
- coap_address_init(&listen_addr); - coap_address_init(&listen_addr);
- listen_addr.port = UIP_HTONS(COAP_DEFAULT_PORT); - listen_addr.port = UIP_HTONS(COAP_DEFAULT_PORT);
- -
@ -91,13 +91,13 @@ index e4b2fe5..0000000
- -
-#ifdef WITH_CONTIKI -#ifdef WITH_CONTIKI
- printf("tentative address: [%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]:%d\r\n", - printf("tentative address: [%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]:%d\r\n",
- listen_addr.addr.u8[0], listen_addr.addr.u8[1], - listen_addr.addr.u8[0], listen_addr.addr.u8[1],
- listen_addr.addr.u8[2], listen_addr.addr.u8[3], - listen_addr.addr.u8[2], listen_addr.addr.u8[3],
- listen_addr.addr.u8[4], listen_addr.addr.u8[5], - listen_addr.addr.u8[4], listen_addr.addr.u8[5],
- listen_addr.addr.u8[6], listen_addr.addr.u8[7], - listen_addr.addr.u8[6], listen_addr.addr.u8[7],
- listen_addr.addr.u8[8], listen_addr.addr.u8[9], - listen_addr.addr.u8[8], listen_addr.addr.u8[9],
- listen_addr.addr.u8[10], listen_addr.addr.u8[11], - listen_addr.addr.u8[10], listen_addr.addr.u8[11],
- listen_addr.addr.u8[12], listen_addr.addr.u8[13], - listen_addr.addr.u8[12], listen_addr.addr.u8[13],
- listen_addr.addr.u8[14], listen_addr.addr.u8[15] , - listen_addr.addr.u8[14], listen_addr.addr.u8[15] ,
- uip_ntohs(listen_addr.port)); - uip_ntohs(listen_addr.port));
-#endif -#endif
@ -111,8 +111,8 @@ index e4b2fe5..0000000
-} -}
- -
-void -void
-message_handler(struct coap_context_t *ctx, -message_handler(struct coap_context_t *ctx,
- const coap_address_t *remote, - const coap_address_t *remote,
- coap_pdu_t *sent, - coap_pdu_t *sent,
- coap_pdu_t *received, - coap_pdu_t *received,
- const coap_tid_t id) { - const coap_tid_t id) {
@ -149,10 +149,10 @@ index e4b2fe5..0000000
- uip_ip6addr(&dst.addr, 0xaaaa, 0, 0, 0, 0x206, 0x98ff, 0xfe00, 0x232); - uip_ip6addr(&dst.addr, 0xaaaa, 0, 0, 0, 0x206, 0x98ff, 0xfe00, 0x232);
- /* uip_ip6addr(&dst.addr, 0xfe80, 0, 0, 0, 0x206, 0x98ff, 0xfe00, 0x232); */ - /* uip_ip6addr(&dst.addr, 0xfe80, 0, 0, 0, 0x206, 0x98ff, 0xfe00, 0x232); */
- -
- request = coap_pdu_init(COAP_MESSAGE_CON, COAP_REQUEST_GET, - request = coap_pdu_init(COAP_MESSAGE_CON, COAP_REQUEST_GET,
- coap_new_message_id(coap_context), - coap_new_message_id(coap_context),
- COAP_MAX_PDU_SIZE); - COAP_MAX_PDU_SIZE);
- -
- coap_split_uri((unsigned char *)resource, strlen(resource), &uri); - coap_split_uri((unsigned char *)resource, strlen(resource), &uri);
- -
- if (uri.port != COAP_DEFAULT_PORT) { - if (uri.port != COAP_DEFAULT_PORT) {
@ -173,10 +173,10 @@ index e4b2fe5..0000000
- res = coap_split_path(uri.path.s, uri.path.length, buf, &buflen); - res = coap_split_path(uri.path.s, uri.path.length, buf, &buflen);
- -
- while (res--) { - while (res--) {
- coap_add_option(request, COAP_OPTION_URI_PATH, - coap_add_option(request, COAP_OPTION_URI_PATH,
- COAP_OPT_LENGTH(buf), COAP_OPT_VALUE(buf)); - COAP_OPT_LENGTH(buf), COAP_OPT_VALUE(buf));
- -
- buf += COAP_OPT_SIZE(buf); - buf += COAP_OPT_SIZE(buf);
- } - }
- } - }
- -
@ -259,7 +259,7 @@ index 5dcdfcd..0000000
-void -void
-init_coap() { -init_coap() {
- coap_address_t listen_addr; - coap_address_t listen_addr;
- -
- coap_address_init(&listen_addr); - coap_address_init(&listen_addr);
- listen_addr.port = UIP_HTONS(COAP_DEFAULT_PORT); - listen_addr.port = UIP_HTONS(COAP_DEFAULT_PORT);
- -
@ -277,13 +277,13 @@ index 5dcdfcd..0000000
- -
-#ifdef WITH_CONTIKI -#ifdef WITH_CONTIKI
- printf("tentative address: [%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]:%d\r\n", - printf("tentative address: [%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]:%d\r\n",
- listen_addr.addr.u8[0], listen_addr.addr.u8[1], - listen_addr.addr.u8[0], listen_addr.addr.u8[1],
- listen_addr.addr.u8[2], listen_addr.addr.u8[3], - listen_addr.addr.u8[2], listen_addr.addr.u8[3],
- listen_addr.addr.u8[4], listen_addr.addr.u8[5], - listen_addr.addr.u8[4], listen_addr.addr.u8[5],
- listen_addr.addr.u8[6], listen_addr.addr.u8[7], - listen_addr.addr.u8[6], listen_addr.addr.u8[7],
- listen_addr.addr.u8[8], listen_addr.addr.u8[9], - listen_addr.addr.u8[8], listen_addr.addr.u8[9],
- listen_addr.addr.u8[10], listen_addr.addr.u8[11], - listen_addr.addr.u8[10], listen_addr.addr.u8[11],
- listen_addr.addr.u8[12], listen_addr.addr.u8[13], - listen_addr.addr.u8[12], listen_addr.addr.u8[13],
- listen_addr.addr.u8[14], listen_addr.addr.u8[15] , - listen_addr.addr.u8[14], listen_addr.addr.u8[15] ,
- uip_ntohs(listen_addr.port)); - uip_ntohs(listen_addr.port));
-#endif -#endif
@ -301,9 +301,9 @@ index 5dcdfcd..0000000
-# define min(a,b) ((a) < (b) ? (a) : (b)) -# define min(a,b) ((a) < (b) ? (a) : (b))
-#endif -#endif
- -
-void -void
-hnd_get_time(coap_context_t *ctx, struct coap_resource_t *resource, -hnd_get_time(coap_context_t *ctx, struct coap_resource_t *resource,
- coap_address_t *peer, coap_pdu_t *request, str *token, - coap_address_t *peer, coap_pdu_t *request, str *token,
- coap_pdu_t *response) { - coap_pdu_t *response) {
- coap_opt_iterator_t opt_iter; - coap_opt_iterator_t opt_iter;
- unsigned char buf[2]; - unsigned char buf[2];
@ -318,10 +318,10 @@ index 5dcdfcd..0000000
- -
- coap_add_option(response, COAP_OPTION_MAXAGE, - coap_add_option(response, COAP_OPTION_MAXAGE,
- coap_encode_var_bytes(buf, 0x01), buf); - coap_encode_var_bytes(buf, 0x01), buf);
- -
- /* Check if subscription was requested. */ - /* Check if subscription was requested. */
- if (request && - if (request &&
- coap_check_option(request, COAP_OPTION_SUBSCRIPTION, &opt_iter) && - coap_check_option(request, COAP_OPTION_SUBSCRIPTION, &opt_iter) &&
- coap_add_observer(resource, peer, token)) { - coap_add_observer(resource, peer, token)) {
- -
- /* add a new observe value */ - /* add a new observe value */
@ -341,9 +341,9 @@ index 5dcdfcd..0000000
- /* calculate current time */ - /* calculate current time */
- coap_ticks(&t); - coap_ticks(&t);
- now = my_clock_base + (t / COAP_TICKS_PER_SECOND); - now = my_clock_base + (t / COAP_TICKS_PER_SECOND);
- -
- /* output ticks */ - /* output ticks */
- response->length += snprintf((char *)response->data, - response->length += snprintf((char *)response->data,
- response->max_size - response->length, - response->max_size - response->length,
- "%u", (unsigned int)now); - "%u", (unsigned int)now);
-} -}
@ -427,6 +427,6 @@ index 5dcdfcd..0000000
- PROCESS_END(); - PROCESS_END();
-} -}
-/*---------------------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/
-- --
1.8.3.2 2.0.1

View File

@ -0,0 +1,116 @@
From e6d36f466b2c1568cb4cfc3a3f1f9348e71db037 Mon Sep 17 00:00:00 2001
From: Ludwig Ortmann <ludwig.ortmann@fu-berlin.de>
Date: Tue, 15 Jul 2014 17:06:51 +0200
Subject: [PATCH] fix old-style function declarations
---
async.c | 2 +-
debug.c | 2 +-
debug.h | 2 +-
net.c | 4 ++--
net.h | 2 +-
pdu.c | 2 +-
pdu.h | 2 +-
7 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/async.c b/async.c
index 976bf63..21ab642 100644
--- a/async.c
+++ b/async.c
@@ -97,5 +97,5 @@ coap_free_async(coap_async_state_t *s) {
}
#else
-void does_not_exist(); /* make some compilers happy */
+void does_not_exist(void); /* make some compilers happy */
#endif /* WITHOUT_ASYNC */
diff --git a/debug.c b/debug.c
index bff3f11..241a803 100644
--- a/debug.c
+++ b/debug.c
@@ -38,7 +38,7 @@
static coap_log_t maxlog = LOG_WARNING; /* default maximum log level */
coap_log_t
-coap_get_log_level() {
+coap_get_log_level(void) {
return maxlog;
}
diff --git a/debug.h b/debug.h
index dde660d..b4dae5d 100644
--- a/debug.h
+++ b/debug.h
@@ -30,7 +30,7 @@ typedef enum { LOG_EMERG=0, LOG_ALERT, LOG_CRIT, LOG_WARNING,
#endif
/** Returns the current log level. */
-coap_log_t coap_get_log_level();
+coap_log_t coap_get_log_level(void);
/** Sets the log level to the specified value. */
void coap_set_log_level(coap_log_t level);
diff --git a/net.c b/net.c
index 83097d1..035619c 100644
--- a/net.c
+++ b/net.c
@@ -54,7 +54,7 @@
time_t clock_offset;
static inline coap_queue_t *
-coap_malloc_node() {
+coap_malloc_node(void) {
return (coap_queue_t *)coap_malloc(sizeof(coap_queue_t));
}
@@ -238,7 +238,7 @@ coap_delete_all(coap_queue_t *queue) {
}
coap_queue_t *
-coap_new_node() {
+coap_new_node(void) {
coap_queue_t *node;
node = coap_malloc_node();
diff --git a/net.h b/net.h
index 59c7d59..38bc09a 100644
--- a/net.h
+++ b/net.h
@@ -72,7 +72,7 @@ int coap_delete_node(coap_queue_t *node);
void coap_delete_all(coap_queue_t *queue);
/** Creates a new node suitable for adding to the CoAP sendqueue. */
-coap_queue_t *coap_new_node();
+coap_queue_t *coap_new_node(void);
struct coap_resource_t;
struct coap_context_t;
diff --git a/pdu.c b/pdu.c
index 04ef9c6..e3c9720 100644
--- a/pdu.c
+++ b/pdu.c
@@ -123,7 +123,7 @@ coap_pdu_init(unsigned char type, unsigned char code,
}
coap_pdu_t *
-coap_new_pdu() {
+coap_new_pdu(void) {
coap_pdu_t *pdu;
#ifndef WITH_CONTIKI
diff --git a/pdu.h b/pdu.h
index a891086..5bf2164 100644
--- a/pdu.h
+++ b/pdu.h
@@ -274,7 +274,7 @@ void coap_pdu_clear(coap_pdu_t *pdu, size_t size);
* @deprecated This function allocates the maximum storage for each
* PDU. Use coap_pdu_init() instead.
*/
-coap_pdu_t *coap_new_pdu();
+coap_pdu_t *coap_new_pdu(void);
void coap_delete_pdu(coap_pdu_t *);
--
2.0.1

View File

@ -20,7 +20,7 @@ all: patch
patch: $(PKG_DIR)/Makefile patch: $(PKG_DIR)/Makefile
$(PKG_DIR)/Makefile: $(PKG_DIR)/.git/config $(PKG_DIR)/Makefile: $(PKG_DIR)/.git/config
cd "$(PKG_DIR)" && git am --ignore-whitespace "$(CURDIR)"/*.patch || true cd "$(PKG_DIR)" && git am --ignore-whitespace "$(CURDIR)"/*.patch
$(PKG_DIR)/.git/config: $(PKG_DIR)/.git/config:
test -d "$(PKG_DIR)" || git clone "$(PKG_URL)" "$(PKG_DIR)"; \ test -d "$(PKG_DIR)" || git clone "$(PKG_URL)" "$(PKG_DIR)"; \