Skip to content

Commit

Permalink
Merge pull request #16526 from janosbrodbeck/pr/gcoap/return_req_send
Browse files Browse the repository at this point in the history
net/gcoap: change return type from gcoap_req_send() to ssize_t
  • Loading branch information
miri64 authored Jun 5, 2021
2 parents 263cdfe + 2e523bf commit 9a6afec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions sys/include/net/gcoap.h
Original file line number Diff line number Diff line change
Expand Up @@ -800,9 +800,9 @@ static inline ssize_t gcoap_request(coap_pkt_t *pdu, uint8_t *buf, size_t len,
* @return length of the packet
* @return 0 if cannot send
*/
size_t gcoap_req_send(const uint8_t *buf, size_t len,
const sock_udp_ep_t *remote,
gcoap_resp_handler_t resp_handler, void *context);
ssize_t gcoap_req_send(const uint8_t *buf, size_t len,
const sock_udp_ep_t *remote,
gcoap_resp_handler_t resp_handler, void *context);

/**
* @brief Initializes a CoAP response packet on a buffer
Expand Down
8 changes: 4 additions & 4 deletions sys/net/application_layer/gcoap/gcoap.c
Original file line number Diff line number Diff line change
Expand Up @@ -812,9 +812,9 @@ int gcoap_req_init(coap_pkt_t *pdu, uint8_t *buf, size_t len,
return (res > 0) ? 0 : res;
}

size_t gcoap_req_send(const uint8_t *buf, size_t len,
const sock_udp_ep_t *remote,
gcoap_resp_handler_t resp_handler, void *context)
ssize_t gcoap_req_send(const uint8_t *buf, size_t len,
const sock_udp_ep_t *remote,
gcoap_resp_handler_t resp_handler, void *context)
{
gcoap_request_memo_t *memo = NULL;
unsigned msg_type = (*buf & 0x30) >> 4;
Expand Down Expand Up @@ -913,7 +913,7 @@ size_t gcoap_req_send(const uint8_t *buf, size_t len,
}
DEBUG("gcoap: sock send failed: %d\n", (int)res);
}
return (size_t)((res > 0) ? res : 0);
return ((res > 0) ? res : 0);
}

int gcoap_resp_init(coap_pkt_t *pdu, uint8_t *buf, size_t len, unsigned code)
Expand Down

0 comments on commit 9a6afec

Please sign in to comment.