1
0

In net_send() remove a const modifier from buf_len. In net_recv() a const modifier was added to a pointer to buf.

This commit is contained in:
Alexander Andreev 2024-03-24 16:50:49 +04:00
parent ba3a87ab4f
commit 6990664f2f
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34
2 changed files with 4 additions and 4 deletions

View File

@ -51,7 +51,7 @@ void net_destroy(net_t *n) {
memset(&n->laddr, 0, sizeof(n->laddr)); memset(&n->laddr, 0, sizeof(n->laddr));
} }
int net_send(net_t *const n, const char *const buf, const int buf_len) { int net_send(net_t *const n, const char *const buf, int buf_len) {
if (n->fd == -1 || n->raddr.sin_addr.s_addr == 0) if (n->fd == -1 || n->raddr.sin_addr.s_addr == 0)
return -1; return -1;
@ -61,7 +61,7 @@ int net_send(net_t *const n, const char *const buf, const int buf_len) {
return 0; return 0;
} }
int net_recv(net_t *const n, void *buf, size_t buf_len) { int net_recv(net_t *const n, void *const buf, size_t buf_len) {
if (n->fd == -1 || n->raddr.sin_addr.s_addr == 0) if (n->fd == -1 || n->raddr.sin_addr.s_addr == 0)
return -1; return -1;

View File

@ -13,7 +13,7 @@ int net_client_init(net_t *const n, const int af_family, const char *const raddr
int net_server_init(net_t *const n, const int af_family, const char *const laddr, const int lport); int net_server_init(net_t *const n, const int af_family, const char *const laddr, const int lport);
void net_destroy(net_t *n); void net_destroy(net_t *n);
int net_send(net_t *const n, const char *const buf, const int buf_len); int net_send(net_t *const n, const char *const buf, int buf_len);
int net_recv(net_t *const n, void *buf, size_t buf_len); int net_recv(net_t *const n, void *const buf, size_t buf_len);
#endif /* _NET_H_ */ #endif /* _NET_H_ */