1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-26 23:11:19 +01:00

nanocoap: use uint8_t for szx value

The value is an exponent, 8 bits totally suffice here
This commit is contained in:
Benjamin Valentin 2022-04-20 00:15:34 +02:00
parent 08e430bee7
commit 00221818b6
2 changed files with 5 additions and 5 deletions

View File

@ -305,8 +305,8 @@ typedef const struct {
typedef struct {
size_t offset; /**< offset of received data */
uint32_t blknum; /**< block number */
unsigned szx; /**< szx value */
int more; /**< -1 for no option, 0 for last block,
uint8_t szx; /**< szx value */
int8_t more; /**< -1 for no option, 0 for last block,
1 for more blocks coming */
} coap_block1_t;
@ -949,7 +949,7 @@ static inline int coap_get_block2(coap_pkt_t *pkt, coap_block1_t *block)
* @returns 0 if more flag is not set
* @returns 1 if more flag is set
*/
int coap_get_blockopt(coap_pkt_t *pkt, uint16_t option, uint32_t *blknum, unsigned *szx);
int coap_get_blockopt(coap_pkt_t *pkt, uint16_t option, uint32_t *blknum, uint8_t *szx);
/**
* @brief Check whether any of the packet's options that are critical

View File

@ -367,7 +367,7 @@ ssize_t coap_opt_get_string(coap_pkt_t *pkt, uint16_t optnum,
return (int)(max_len - left);
}
int coap_get_blockopt(coap_pkt_t *pkt, uint16_t option, uint32_t *blknum, unsigned *szx)
int coap_get_blockopt(coap_pkt_t *pkt, uint16_t option, uint32_t *blknum, uint8_t *szx)
{
uint8_t *optpos = coap_find_option(pkt, option);
if (!optpos) {
@ -1110,7 +1110,7 @@ void coap_block_slicer_init(coap_block_slicer_t *slicer, size_t blknum,
void coap_block2_init(coap_pkt_t *pkt, coap_block_slicer_t *slicer)
{
uint32_t blknum = 0;
unsigned szx = 0;
uint8_t szx = 0;
/* Retrieve the block2 option from the client request */
if (coap_get_blockopt(pkt, COAP_OPT_BLOCK2, &blknum, &szx) >= 0) {