Commit 6fc8eb0f authored by Rúben Soares Silva's avatar Rúben Soares Silva

Change parameter type of pack_dci_payload and unpack_dci_payload to avoid...

Change parameter type of pack_dci_payload and unpack_dci_payload to avoid -Wstringop-overflow warning.
Change declaration of unpack_buf in dci_inversion_test to not require calloc
parent d35dbe63
......@@ -77,8 +77,8 @@ uint8_t unpackarray(uint8_t **ppReadPackedMsg,
uint8_t *end,
unpack_array_elem_fn fn);
uint32_t pack_dci_payload(uint8_t payload[], uint16_t payloadSizeBits, uint8_t **out, uint8_t *end);
uint32_t unpack_dci_payload(uint8_t payload[], uint16_t payloadSizeBits, uint8_t **in, uint8_t *end);
uint32_t pack_dci_payload(uint8_t *payload, uint16_t payloadSizeBits, uint8_t **out, uint8_t *end);
uint32_t unpack_dci_payload(uint8_t *payload, uint16_t payloadSizeBits, uint8_t **in, uint8_t *end);
uint8_t pack_tl(nfapi_tl_t *tl, uint8_t **ppWritePackedMsg, uint8_t *end);
uint8_t unpack_tl(uint8_t **ppReadPackedMsg, nfapi_tl_t *tl, uint8_t *end);
......
......@@ -618,7 +618,7 @@ uint8_t unpackarray(uint8_t **ppReadPackedMsg,
return 1;
}
uint32_t pack_dci_payload(uint8_t payload[], uint16_t payloadSizeBits, uint8_t **out, uint8_t *end)
uint32_t pack_dci_payload(uint8_t *payload, uint16_t payloadSizeBits, uint8_t **out, uint8_t *end)
{
uint8_t dci_byte_len = (payloadSizeBits + 7) / 8;
#ifdef FAPI_BYTE_ORDERING_BIG_ENDIAN
......@@ -648,7 +648,7 @@ uint32_t pack_dci_payload(uint8_t payload[], uint16_t payloadSizeBits, uint8_t *
#endif
}
uint32_t unpack_dci_payload(uint8_t payload[], uint16_t payloadSizeBits, uint8_t **in, uint8_t *end)
uint32_t unpack_dci_payload(uint8_t *payload, uint16_t payloadSizeBits, uint8_t **in, uint8_t *end)
{
// Pull the inverted DCI and invert it back
// Helper vars for DCI Payload
......
......@@ -108,7 +108,7 @@ void test_pack_payload(uint8_t payloadSizeBits, uint8_t payload[])
pack_dci_payload(payload, payloadSizeBits, &pWritePackedMessage, pPackMessageEnd);
uint8_t *unpack_buf = calloc_or_fail(payloadSizeBytes, sizeof(uint8_t));
uint8_t unpack_buf[payloadSizeBytes];
pWritePackedMessage = msg_buf;
unpack_dci_payload(unpack_buf, payloadSizeBits, &pWritePackedMessage, pPackMessageEnd);
......@@ -128,7 +128,6 @@ void test_pack_payload(uint8_t payloadSizeBits, uint8_t payload[])
DevAssert(memcmp(payload, unpack_buf, payloadSizeBytes) == 0);
// All tests successful!
free(unpack_buf);
}
int main(int n, char *v[])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment