fixed gcc-9.3.0 compiler warnings and missing symbol in rtlsdr_rpc

Signed-off-by: hayati ayguen <h_ayguen@web.de>
development
hayati ayguen 2020-08-19 15:40:34 -07:00
parent 284b415ec3
commit cfceb5ad69
5 changed files with 26 additions and 12 deletions

View File

@ -1507,6 +1507,8 @@ int rtlsdr_get_tuner_gains(rtlsdr_dev_t *dev, int *gains)
int rtlsdr_set_and_get_tuner_bandwidth(rtlsdr_dev_t *dev, uint32_t bw, uint32_t *applied_bw, int apply_bw )
{
int r = 0;
#ifdef _ENABLE_RPC
if (rtlsdr_rpc_is_enabled())
{
@ -1514,8 +1516,6 @@ int rtlsdr_set_and_get_tuner_bandwidth(rtlsdr_dev_t *dev, uint32_t bw, uint32_t
}
#endif
int r = 0;
*applied_bw = 0; /* unknown */
if (!dev || !dev->tuner)

View File

@ -402,11 +402,21 @@ int main(int argc, char **argv)
}
}
if (manuf_str)
strncpy((char*)&conf.manufacturer, manuf_str, MAX_STR_SIZE);
if (manuf_str) {
int len = strlen(manuf_str);
if (len > MAX_STR_SIZE)
len = MAX_STR_SIZE;
memset(&conf.manufacturer[0], 0, MAX_STR_SIZE * sizeof(char));
memcpy(&conf.manufacturer[0], manuf_str, len * sizeof(char));
}
if (product_str)
strncpy((char*)&conf.product, product_str, MAX_STR_SIZE);
if (product_str) {
int len = strlen(product_str);
if (len > MAX_STR_SIZE)
len = MAX_STR_SIZE;
memset(&conf.product[0], 0, MAX_STR_SIZE * sizeof(char));
memcpy(&conf.product[0], product_str, len * sizeof(char));
}
if (manuf_id > 0)
conf.vendor_id = manuf_id;
@ -415,8 +425,12 @@ int main(int argc, char **argv)
conf.product_id = product_id;
if (serial_str) {
int len = strlen(serial_str);
if (len > MAX_STR_SIZE)
len = MAX_STR_SIZE;
conf.have_serial = 1;
strncpy((char*)&conf.serial, serial_str, MAX_STR_SIZE);
memset(&conf.serial[0], 0, MAX_STR_SIZE * sizeof(char));
memcpy(&conf.serial[0], serial_str, len * sizeof(char));
}
if (ir_endpoint != 0)

View File

@ -795,15 +795,15 @@ static int handle_query
uint32_t did;
uint32_t bw;
uint32_t applied_bw;
int apply_bw;
int32_t apply_bw;
if (rtlsdr_rpc_msg_pop_uint32(q, &did)) goto on_error;
if (rtlsdr_rpc_msg_pop_uint32(q, &bw)) goto on_error;
if (rtlsdr_rpc_msg_pop_uint32(q, &apply_bw)) goto on_error;
if (rtlsdr_rpc_msg_pop_int32(q, &apply_bw)) goto on_error;
if ((rpcd->dev == NULL) || (rpcd->did != did)) goto on_error;
err = rtlsdr_set_and_get_tuner_bandwidth(rpcd->dev, bw, &applied_bw, apply_bw);
err = rtlsdr_set_and_get_tuner_bandwidth(rpcd->dev, bw, &applied_bw, (int)apply_bw);
if (err) goto on_error;
if (rtlsdr_rpc_msg_push_uint32(r, applied_bw)) goto on_error;

View File

@ -941,7 +941,7 @@ int rtlsdr_rpc_set_and_get_tuner_bandwidth(void* devp, uint32_t bw, uint32_t *ap
if (rtlsdr_rpc_msg_push_uint32(q, dev->index)) goto on_error_1;
if (rtlsdr_rpc_msg_push_uint32(q, (uint32_t)bw)) goto on_error_1;
if (rtlsdr_rpc_msg_push_uint32(q, (uint32_t)apply_bw)) goto on_error_1;
if (rtlsdr_rpc_msg_push_int32(q, (int32_t)apply_bw)) goto on_error_1;
if (send_recv_msg(cli, q, r)) goto on_error_1;

View File

@ -153,7 +153,7 @@ void rtlsdr_rpc_msg_skip_safe(rtlsdr_rpc_msg_t* msg, size_t size)
msg->off += size;
}
int rtlsdr_rpc_msg_pop_int(rtlsdr_rpc_msg_t* msg, int* x)
int rtlsdr_rpc_msg_pop_int32(rtlsdr_rpc_msg_t* msg, int32_t* x)
{
return pop_uint32(msg, (uint32_t*)x);
}