1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-10-25 04:27:39 +00:00

Fix error handling issues detected by Coverity Scan 2020.09

This commit is contained in:
Carles Fernandez
2021-01-25 13:35:47 +01:00
parent 419eff9424
commit 2f627581ef
7 changed files with 57 additions and 21 deletions

View File

@@ -92,6 +92,8 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(
item_size_ = sizeof(char);
}
reverse_interleaving_ = false;
is_complex_ = true;
if (sample_type_ == "real")
{
is_complex_ = false;
@@ -99,7 +101,6 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(
else if (sample_type_ == "iq")
{
is_complex_ = true;
reverse_interleaving_ = false;
}
else if (sample_type_ == "qi")
{

View File

@@ -32,6 +32,9 @@ boost::system::error_code rtl_tcp_command(RTL_TCP_COMMAND id, unsigned param, bo
std::memcpy(&data[1], &nparam, sizeof(nparam));
boost::system::error_code ec;
socket.send(boost::asio::buffer(data), 0, ec);
if (socket.send(boost::asio::buffer(data), 0, ec) == 0)
{
// 0 bytes sent
}
return ec;
}

View File

@@ -35,8 +35,8 @@ boost::system::error_code Rtl_Tcp_Dongle_Info::read(boost::asio::ip::tcp::socket
boost::system::error_code ec;
unsigned char data[sizeof(char) * 4 + sizeof(uint32_t) * 2];
socket.receive(boost::asio::buffer(data), 0, ec);
if (!ec)
size_t received_bits = socket.receive(boost::asio::buffer(data), 0, ec);
if (!ec && (received_bits > 0))
{
std::memcpy(magic_, data, 4);
@@ -46,7 +46,7 @@ boost::system::error_code Rtl_Tcp_Dongle_Info::read(boost::asio::ip::tcp::socket
tuner_type_ = boost::asio::detail::socket_ops::network_to_host_long(type);
uint32_t count;
std ::memcpy(&count, &data[8], 4);
std::memcpy(&count, &data[8], 4);
tuner_gain_count_ = boost::asio::detail::socket_ops::network_to_host_long(count);
}