fix false-success bug in posix sock send code

This commit is contained in:
Nick Kelsey 2016-02-08 16:48:59 -08:00
commit 7e9d651b5f
3 changed files with 6 additions and 6 deletions

View file

@ -14,7 +14,7 @@ LIBSRCS += hdhomerun_video.c
CC := $(CROSS_COMPILE)gcc
STRIP := $(CROSS_COMPILE)strip
CFLAGS += -Wall -O2 -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
CFLAGS += -O2 -Wall -Wextra -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wno-unused-parameter
LDFLAGS += -lpthread
SHARED = -shared -Wl,-soname,libhdhomerun$(LIBEXT)

View file

@ -347,7 +347,7 @@ bool_t hdhomerun_sock_send(struct hdhomerun_sock_t *sock, const void *data, size
{
const uint8_t *ptr = (const uint8_t *)data;
ssize_t ret = send(sock->sock, ptr, length, MSG_NOSIGNAL);
if (ret >= length) {
if (ret >= (ssize_t)length) {
return TRUE;
}
@ -377,7 +377,7 @@ bool_t hdhomerun_sock_send(struct hdhomerun_sock_t *sock, const void *data, size
}
ret = send(sock->sock, ptr, length, MSG_NOSIGNAL);
if (ret >= length) {
if (ret >= (ssize_t)length) {
return TRUE;
}
@ -409,7 +409,7 @@ bool_t hdhomerun_sock_sendto(struct hdhomerun_sock_t *sock, uint32_t remote_addr
const uint8_t *ptr = (const uint8_t *)data;
ssize_t ret = sendto(sock->sock, ptr, length, 0, (struct sockaddr *)&sock_addr, sizeof(sock_addr));
if (ret >= length) {
if (ret >= (ssize_t)length) {
return TRUE;
}
@ -439,7 +439,7 @@ bool_t hdhomerun_sock_sendto(struct hdhomerun_sock_t *sock, uint32_t remote_addr
}
ret = sendto(sock->sock, ptr, length, 0, (struct sockaddr *)&sock_addr, sizeof(sock_addr));
if (ret >= length) {
if (ret >= (ssize_t)length) {
return TRUE;
}

View file

@ -236,7 +236,7 @@ static THREAD_FUNC_PREFIX hdhomerun_video_thread_execute(void *arg)
if (length == VIDEO_RTP_DATA_PACKET_SIZE) {
hdhomerun_video_parse_rtp(vs, pkt);
length = (int)(pkt->end - pkt->pos);
length = pkt->end - pkt->pos;
}
if (length != VIDEO_DATA_PACKET_SIZE) {