1
0

In net module fixed types for net_send/recv funcs.

This commit is contained in:
Alexander Andreev 2024-11-20 23:01:35 +04:00
parent f9a660a634
commit 297d3c95c3
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34
2 changed files with 4 additions and 4 deletions

View File

@ -113,14 +113,14 @@ bool net_set_timeout(net_t *const n, int usec) {
return true;
}
ssize_t net_send(net_t *const n, const char *const buf, int buf_len) {
ssize_t net_send(const net_t *const n, const char *const buf, const size_t buf_len) {
if (n->fd == -1 || n->raddr.sa_family == AF_UNSPEC)
return -1;
return sendto(n->fd, buf, buf_len, 0, &n->raddr, sizeof(n->raddr));
}
ssize_t net_recv(net_t *const n, void *const buf, size_t buf_len) {
ssize_t net_recv(net_t *const n, void *const buf, const size_t buf_len) {
if (n->fd == -1)
return -1;

View File

@ -16,7 +16,7 @@ void net_destroy(net_t *n);
bool net_set_timeout(net_t *const n, int usec);
ssize_t net_send(net_t *const n, const char *const buf, int buf_len);
ssize_t net_recv(net_t *const n, void *const buf, size_t buf_len);
ssize_t net_send(const net_t *const n, const char *const buf, const size_t buf_len);
ssize_t net_recv(net_t *const n, void *const buf, const size_t buf_len);
#endif /* _NET_H_ */