ipdbg-la: Fix two compiler warnings on Windows.
This is happening because the send() and recv() functions have different prototypes on POSIX and Windows. Using the casts is required on Windows and doesn't hurt on POSIX systems. [...]/protocol.c: In function 'tcp_send': [...]/protocol.c:161:26: warning: pointer targets in passing argument 2 of 'send' differ in signedness [-Wpointer-sign] out = send(tcp->socket, buf, len, 0); ^ In file included from [...]/protocol.c:24:0: [...]/include/winsock2.h:997:34: note: expected 'const char *' but argument is of type 'const uint8_t * {aka const unsigned char *}' WINSOCK_API_LINKAGE int WSAAPI send(SOCKET s,const char *buf,int len,int flags); ^ [...]/protocol.c: In function 'ipdbg_la_tcp_receive': [...]/protocol.c:201:32: warning: pointer targets in passing argument 2 of 'recv' differ in signedness [-Wpointer-sign] int len = recv(tcp->socket, buf, 1, 0); ^ In file included from [...]/protocol.c:24:0: [...]/include/winsock2.h:992:34: note: expected 'char *' but argument is of type 'uint8_t * {aka unsigned char *}' WINSOCK_API_LINKAGE int WSAAPI recv(SOCKET s,char *buf,int len,int flags); ^
This commit is contained in:
parent
3bfdadf6df
commit
9be587a148
|
@ -160,7 +160,7 @@ SR_PRIV int ipdbg_la_tcp_close(struct ipdbg_la_tcp *tcp)
|
|||
static int tcp_send(struct ipdbg_la_tcp *tcp, const uint8_t *buf, size_t len)
|
||||
{
|
||||
int out;
|
||||
out = send(tcp->socket, buf, len, 0);
|
||||
out = send(tcp->socket, (const char *)buf, len, 0);
|
||||
|
||||
if (out < 0) {
|
||||
sr_err("Send error: %s", g_strerror(errno));
|
||||
|
@ -200,7 +200,7 @@ SR_PRIV int ipdbg_la_tcp_receive(struct ipdbg_la_tcp *tcp,
|
|||
|
||||
if (data_available(tcp)) {
|
||||
while (received < 1) {
|
||||
int len = recv(tcp->socket, buf, 1, 0);
|
||||
int len = recv(tcp->socket, (char *)buf, 1, 0);
|
||||
|
||||
if (len < 0) {
|
||||
sr_err("Receive error: %s", g_strerror(errno));
|
||||
|
|
Loading…
Reference in New Issue