mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2026-11-24 16:17:22 +00:00
Fix defects detected by Coverity Scan
This commit is contained in:
7 files changed
+14
-8
No files matched your search
@@ -188,7 +188,7 @@ int64_t Beidou_Dnav_Navigation_Message::read_navigation_signed(
|
||||
{
|
||||
for (int32_t j = 0; j < param.second; j++)
|
||||
{
|
||||
value = (value << 1) | static_cast<int64_t>(bits[BEIDOU_DNAV_SUBFRAME_DATA_BITS - param.first - j]);
|
||||
value = value * 2 + static_cast<int64_t>(bits[BEIDOU_DNAV_SUBFRAME_DATA_BITS - param.first - j]);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
|
||||
@@ -308,7 +308,7 @@ int64_t Galileo_Fnav_Message::read_navigation_signed(const std::bitset<GALILEO_F
|
||||
{
|
||||
for (int32_t j = 0; j < p.second; j++)
|
||||
{
|
||||
value = (value << 1) | static_cast<int64_t>(bits[GALILEO_FNAV_DATA_FRAME_BITS - p.first - j]);
|
||||
value = value * 2 + static_cast<int64_t>(bits[GALILEO_FNAV_DATA_FRAME_BITS - p.first - j]);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
|
||||
@@ -127,7 +127,7 @@ int64_t Galileo_Inav_Message::read_navigation_signed(const std::bitset<GALILEO_D
|
||||
{
|
||||
for (int32_t j = 0; j < p.second; j++)
|
||||
{
|
||||
value = (value << 1) | static_cast<int64_t>(bits[GALILEO_DATA_JK_BITS - p.first - j]);
|
||||
value = value * 2 + static_cast<int64_t>(bits[GALILEO_DATA_JK_BITS - p.first - j]);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -1049,7 +1050,7 @@ std::vector<uint8_t> Gps_Cnav2_Ldpc::encode(const std::vector<uint8_t>& message)
|
||||
}
|
||||
}
|
||||
// p2 = T^-1 (A s^t + B p1^t)
|
||||
std::vector<uint8_t> rhs = as;
|
||||
std::vector<uint8_t> rhs = std::move(as);
|
||||
for (int32_t r = 0; r < m - 1; r++)
|
||||
{
|
||||
if (std::binary_search(d_rows[r].cbegin(), d_rows[r].cend(), d_k))
|
||||
@@ -1057,7 +1058,7 @@ std::vector<uint8_t> Gps_Cnav2_Ldpc::encode(const std::vector<uint8_t>& message)
|
||||
rhs[r] ^= p1;
|
||||
}
|
||||
}
|
||||
const std::vector<uint8_t> p2 = solve_t(rhs);
|
||||
const std::vector<uint8_t> p2 = solve_t(std::move(rhs));
|
||||
|
||||
for (int32_t i = 0; i < d_k; i++)
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ int64_t read_signed(const std::vector<uint8_t>& bits, const Field& field)
|
||||
{
|
||||
for (int32_t j = 0; j < f.second; j++)
|
||||
{
|
||||
value = static_cast<int64_t>(static_cast<uint64_t>(value) << 1U) | static_cast<int64_t>(bits[f.first - 1 + j] & 1U);
|
||||
value = value * 2 + static_cast<int64_t>(bits[f.first - 1 + j] & 1U);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
@@ -142,6 +142,11 @@ std::vector<float> symbols_to_llr(const float* symbols, size_t n)
|
||||
noise_var = 1e-3 * m2;
|
||||
amplitude2 = m2 - noise_var;
|
||||
}
|
||||
if (!(noise_var > 0.0))
|
||||
{
|
||||
// all-zero or non-finite symbols carry no reliability information
|
||||
return std::vector<float>(n, 0.0F);
|
||||
}
|
||||
const double scale = 2.0 * std::sqrt(std::max(amplitude2, 0.0)) / noise_var;
|
||||
std::vector<float> llr(n);
|
||||
for (size_t i = 0; i < n; i++)
|
||||
|
||||
@@ -69,7 +69,7 @@ int64_t Gps_CNAV_Navigation_Message::read_navigation_signed(const std::bitset<GP
|
||||
{
|
||||
for (int32_t j = 0; j < p.second; j++)
|
||||
{
|
||||
value = (value << 1) | static_cast<int64_t>(bits[GPS_CNAV_DATA_PAGE_BITS - p.first - j]);
|
||||
value = value * 2 + static_cast<int64_t>(bits[GPS_CNAV_DATA_PAGE_BITS - p.first - j]);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
|
||||
@@ -312,7 +312,7 @@ int64_t Gps_Navigation_Message::read_navigation_signed(const std::bitset<GPS_SUB
|
||||
{
|
||||
for (int32_t j = 0; j < p.second; j++)
|
||||
{
|
||||
value = (value << 1) | static_cast<int64_t>(bits[GPS_SUBFRAME_BITS - p.first - j]);
|
||||
value = value * 2 + static_cast<int64_t>(bits[GPS_SUBFRAME_BITS - p.first - j]);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
|
||||
Reference in new issue
Block a user