mirror of
https://github.com/Silicondust/libhdhomerun
synced 2025-07-05 20:42:17 -07:00
cleanup types
This commit is contained in:
parent
1d68aab367
commit
94edccd040
8 changed files with 20 additions and 17 deletions
|
@ -152,14 +152,14 @@ static int channelscan_detect_programs(struct hdhomerun_channelscan_t *scan, str
|
||||||
|
|
||||||
unsigned int transport_stream_id;
|
unsigned int transport_stream_id;
|
||||||
if (sscanf(line, "tsid=0x%x", &transport_stream_id) == 1) {
|
if (sscanf(line, "tsid=0x%x", &transport_stream_id) == 1) {
|
||||||
result->transport_stream_id = transport_stream_id;
|
result->transport_stream_id = (uint16_t)transport_stream_id;
|
||||||
result->transport_stream_id_detected = true;
|
result->transport_stream_id_detected = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int original_network_id;
|
unsigned int original_network_id;
|
||||||
if (sscanf(line, "onid=0x%x", &original_network_id) == 1) {
|
if (sscanf(line, "onid=0x%x", &original_network_id) == 1) {
|
||||||
result->original_network_id = original_network_id;
|
result->original_network_id = (uint16_t)original_network_id;
|
||||||
result->original_network_id_detected = true;
|
result->original_network_id_detected = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -182,9 +182,9 @@ static int channelscan_detect_programs(struct hdhomerun_channelscan_t *scan, str
|
||||||
virtual_minor = 0;
|
virtual_minor = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
program.program_number = program_number;
|
program.program_number = (uint16_t)program_number;
|
||||||
program.virtual_major = virtual_major;
|
program.virtual_major = (uint16_t)virtual_major;
|
||||||
program.virtual_minor = virtual_minor;
|
program.virtual_minor = (uint16_t)virtual_minor;
|
||||||
|
|
||||||
channelscan_extract_name(&program, line);
|
channelscan_extract_name(&program, line);
|
||||||
|
|
||||||
|
@ -343,5 +343,5 @@ uint8_t channelscan_get_progress(struct hdhomerun_channelscan_t *scan)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return scan->scanned_channels * 100 / (scan->scanned_channels + channels_remaining);
|
return (uint8_t) (scan->scanned_channels * 100 / (scan->scanned_channels + channels_remaining));
|
||||||
}
|
}
|
||||||
|
|
|
@ -259,7 +259,7 @@ static int hdhomerun_control_get_set(struct hdhomerun_control_sock_t *cs, const
|
||||||
/* Request. */
|
/* Request. */
|
||||||
hdhomerun_pkt_reset(tx_pkt);
|
hdhomerun_pkt_reset(tx_pkt);
|
||||||
|
|
||||||
int name_len = (int)strlen(name) + 1;
|
size_t name_len = strlen(name) + 1;
|
||||||
if (tx_pkt->end + 3 + name_len > tx_pkt->limit) {
|
if (tx_pkt->end + 3 + name_len > tx_pkt->limit) {
|
||||||
hdhomerun_debug_printf(cs->dbg, "hdhomerun_control_get_set: request too long\n");
|
hdhomerun_debug_printf(cs->dbg, "hdhomerun_control_get_set: request too long\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -269,7 +269,7 @@ static int hdhomerun_control_get_set(struct hdhomerun_control_sock_t *cs, const
|
||||||
hdhomerun_pkt_write_mem(tx_pkt, (const void *)name, name_len);
|
hdhomerun_pkt_write_mem(tx_pkt, (const void *)name, name_len);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
int value_len = (int)strlen(value) + 1;
|
size_t value_len = strlen(value) + 1;
|
||||||
if (tx_pkt->end + 3 + value_len > tx_pkt->limit) {
|
if (tx_pkt->end + 3 + value_len > tx_pkt->limit) {
|
||||||
hdhomerun_debug_printf(cs->dbg, "hdhomerun_control_get_set: request too long\n");
|
hdhomerun_debug_printf(cs->dbg, "hdhomerun_control_get_set: request too long\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -327,6 +327,9 @@ static int hdhomerun_control_get_set(struct hdhomerun_control_sock_t *cs, const
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rx_pkt->pos = next;
|
rx_pkt->pos = next;
|
||||||
|
|
|
@ -215,7 +215,7 @@ struct hdhomerun_device_t *hdhomerun_device_create_from_str(const char *device_s
|
||||||
*/
|
*/
|
||||||
unsigned int port;
|
unsigned int port;
|
||||||
if (sscanf(device_str, "%u.%u.%u.%u:%u", &a[0], &a[1], &a[2], &a[3], &port) == 5) {
|
if (sscanf(device_str, "%u.%u.%u.%u:%u", &a[0], &a[1], &a[2], &a[3], &port) == 5) {
|
||||||
return hdhomerun_device_create_multicast(ip_addr, port, dbg);
|
return hdhomerun_device_create_multicast(ip_addr, (uint16_t)port, dbg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -160,7 +160,7 @@ int hdhomerun_device_selector_load_from_str(struct hdhomerun_device_selector_t *
|
||||||
*/
|
*/
|
||||||
unsigned int port;
|
unsigned int port;
|
||||||
if (sscanf(device_str, "%u.%u.%u.%u:%u", &a[0], &a[1], &a[2], &a[3], &port) == 5) {
|
if (sscanf(device_str, "%u.%u.%u.%u:%u", &a[0], &a[1], &a[2], &a[3], &port) == 5) {
|
||||||
struct hdhomerun_device_t *hd = hdhomerun_device_create_multicast(ip_addr, port, hds->dbg);
|
struct hdhomerun_device_t *hd = hdhomerun_device_create_multicast(ip_addr, (uint16_t)port, hds->dbg);
|
||||||
if (!hd) {
|
if (!hd) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ static void hdhomerun_discover_sock_detect(struct hdhomerun_discover_t *ds)
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ds->sock_count = count;
|
ds->sock_count = (unsigned int)count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool hdhomerun_discover_send_internal(struct hdhomerun_discover_t *ds, struct hdhomerun_discover_sock_t *dss, uint32_t target_ip, uint32_t device_type, uint32_t device_id)
|
static bool hdhomerun_discover_send_internal(struct hdhomerun_discover_t *ds, struct hdhomerun_discover_sock_t *dss, uint32_t target_ip, uint32_t device_type, uint32_t device_id)
|
||||||
|
|
|
@ -465,7 +465,7 @@ bool hdhomerun_sock_recv(struct hdhomerun_sock_t *sock, void *data, size_t *leng
|
||||||
{
|
{
|
||||||
ssize_t ret = recv(sock->sock, data, *length, 0);
|
ssize_t ret = recv(sock->sock, data, *length, 0);
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
*length = ret;
|
*length = (size_t)ret;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,7 +491,7 @@ bool hdhomerun_sock_recv(struct hdhomerun_sock_t *sock, void *data, size_t *leng
|
||||||
|
|
||||||
ret = recv(sock->sock, data, *length, 0);
|
ret = recv(sock->sock, data, *length, 0);
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
*length = ret;
|
*length = (size_t)ret;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,7 +508,7 @@ bool hdhomerun_sock_recvfrom(struct hdhomerun_sock_t *sock, uint32_t *remote_add
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
*remote_addr = ntohl(sock_addr.sin_addr.s_addr);
|
*remote_addr = ntohl(sock_addr.sin_addr.s_addr);
|
||||||
*remote_port = ntohs(sock_addr.sin_port);
|
*remote_port = ntohs(sock_addr.sin_port);
|
||||||
*length = ret;
|
*length = (size_t)ret;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,7 +536,7 @@ bool hdhomerun_sock_recvfrom(struct hdhomerun_sock_t *sock, uint32_t *remote_add
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
*remote_addr = ntohl(sock_addr.sin_addr.s_addr);
|
*remote_addr = ntohl(sock_addr.sin_addr.s_addr);
|
||||||
*remote_port = ntohs(sock_addr.sin_port);
|
*remote_port = ntohs(sock_addr.sin_port);
|
||||||
*length = ret;
|
*length = (size_t)ret;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ void hdhomerun_video_destroy(struct hdhomerun_video_sock_t *vs)
|
||||||
free(vs);
|
free(vs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hdhomerun_video_set_keepalive(struct hdhomerun_video_sock_t *vs, uint32_t remote_addr, uint32_t remote_port, uint32_t lockkey)
|
void hdhomerun_video_set_keepalive(struct hdhomerun_video_sock_t *vs, uint32_t remote_addr, uint16_t remote_port, uint32_t lockkey)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&vs->lock);
|
pthread_mutex_lock(&vs->lock);
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ extern LIBHDHOMERUN_API void hdhomerun_video_destroy(struct hdhomerun_video_sock
|
||||||
/*
|
/*
|
||||||
* Configure to send a keepalive packet every second.
|
* Configure to send a keepalive packet every second.
|
||||||
*/
|
*/
|
||||||
extern LIBHDHOMERUN_API void hdhomerun_video_set_keepalive(struct hdhomerun_video_sock_t *vs, uint32_t remote_addr, uint32_t remote_port, uint32_t lockkey);
|
extern LIBHDHOMERUN_API void hdhomerun_video_set_keepalive(struct hdhomerun_video_sock_t *vs, uint32_t remote_addr, uint16_t remote_port, uint32_t lockkey);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the port the socket is listening on.
|
* Get the port the socket is listening on.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue