mirror of
https://github.com/Genymobile/scrcpy
synced 2024-12-25 16:42:14 +00:00
Use const pointers when possible
Sending data only require to read the input buffer, so declare it const.
This commit is contained in:
parent
6323f3974f
commit
b2b5404883
@ -82,11 +82,11 @@ ssize_t net_recv_all(socket_t socket, void *buf, size_t len) {
|
||||
return recv(socket, buf, len, MSG_WAITALL);
|
||||
}
|
||||
|
||||
ssize_t net_send(socket_t socket, void *buf, size_t len) {
|
||||
ssize_t net_send(socket_t socket, const void *buf, size_t len) {
|
||||
return send(socket, buf, len, 0);
|
||||
}
|
||||
|
||||
ssize_t net_send_all(socket_t socket, void *buf, size_t len) {
|
||||
ssize_t net_send_all(socket_t socket, const void *buf, size_t len) {
|
||||
ssize_t w;
|
||||
while (len > 0) {
|
||||
w = send(socket, buf, len, 0);
|
||||
|
@ -26,8 +26,8 @@ socket_t net_accept(socket_t server_socket);
|
||||
// the _all versions wait/retry until len bytes have been written/read
|
||||
ssize_t net_recv(socket_t socket, void *buf, size_t len);
|
||||
ssize_t net_recv_all(socket_t socket, void *buf, size_t len);
|
||||
ssize_t net_send(socket_t socket, void *buf, size_t len);
|
||||
ssize_t net_send_all(socket_t socket, void *buf, size_t len);
|
||||
ssize_t net_send(socket_t socket, const void *buf, size_t len);
|
||||
ssize_t net_send_all(socket_t socket, const void *buf, size_t len);
|
||||
// how is SHUT_RD (read), SHUT_WR (write) or SHUT_RDWR (both)
|
||||
SDL_bool net_shutdown(socket_t socket, int how);
|
||||
SDL_bool net_close(socket_t socket);
|
||||
|
Loading…
Reference in New Issue
Block a user