mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-20 22:39:05 +03:00
option.[ch]: Fix "warning: ISO C++ forbids flexible array member 'data' "
This commit is contained in:
1 parent
a2d263356e
commit
856236dc6c
2 files changed
+2
-1
No files matched your search
@@ -429,7 +429,7 @@ typedef struct coap_optlist_t {
|
||||
struct coap_optlist_t *next; /**< next entry in the optlist chain */
|
||||
uint16_t number; /**< the option number (no delta coding) */
|
||||
size_t length; /**< the option value length */
|
||||
uint8_t data[]; /**< the option data */
|
||||
uint8_t *data; /**< the option data */
|
||||
} coap_optlist_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -552,6 +552,7 @@ coap_new_optlist(uint16_t number,
|
||||
if (node) {
|
||||
node->number = number;
|
||||
node->length = length;
|
||||
node->data = (uint8_t *)&node[1];
|
||||
memcpy(node->data, data, length);
|
||||
} else {
|
||||
coap_log(LOG_WARNING, "coap_new_optlist: malloc failure\n");
|
||||
|
||||
Reference in new issue
Block a user