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:
9 files changed
+27
-13
No files matched your search
@@ -2850,7 +2850,6 @@ void rtklib_pvt_gs::report_fixed_base_status()
|
||||
<< " common satellites: "
|
||||
<< d_user_pvt_solver->get_fixed_base_common_satellites();
|
||||
break;
|
||||
case Rtklib_Fixed_Base_Status::NOT_REQUESTED:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3495,7 +3495,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
{
|
||||
info.healthy = healthy;
|
||||
}
|
||||
d_monitor_pvt.tracked_satellites.push_back(info);
|
||||
d_monitor_pvt.tracked_satellites.push_back(std::move(info));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <fcntl.h>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <netdb.h>
|
||||
#include <netinet/tcp.h>
|
||||
@@ -613,8 +614,19 @@ int readfile(file_t *file, unsigned char *buff, int nmax, char *msg)
|
||||
std::snprintf(msg, MAXSTRPATH, "T%+.1fs", seconds);
|
||||
}
|
||||
|
||||
/* Reject positions fseeko() cannot address (corrupted tag file).
|
||||
Past this check, the cast to int64_t below cannot wrap negative,
|
||||
so nmax can never exceed the caller's buffer size. */
|
||||
if (record.fpos > static_cast<size_t>(std::numeric_limits<off_t>::max()))
|
||||
{
|
||||
trace(1, "readfile: invalid file position in tag file\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
const int64_t fpos_delta = static_cast<int64_t>(record.fpos) - static_cast<int64_t>(file->fpos);
|
||||
|
||||
/* If jump in file position */
|
||||
if (static_cast<int64_t>(record.fpos) - static_cast<int64_t>(file->fpos) >= nmax)
|
||||
if (fpos_delta >= nmax)
|
||||
{
|
||||
if (fseeko(file->fp, static_cast<off_t>(record.fpos), SEEK_SET) != 0)
|
||||
{
|
||||
@@ -624,7 +636,8 @@ int readfile(file_t *file, unsigned char *buff, int nmax, char *msg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
nmax = static_cast<int>(record.fpos - file->fpos);
|
||||
/* 0 <= nmax < caller's nmax; a backward position reads nothing */
|
||||
nmax = fpos_delta > 0 ? static_cast<int>(fpos_delta) : 0;
|
||||
|
||||
if (file->repmode || file->speed > 0.0)
|
||||
{
|
||||
|
||||
+3
-2
@@ -87,7 +87,8 @@ option_t::option_t(std::string t_longform,
|
||||
: longform("--" + t_longform),
|
||||
shortform("-" + t_shortform),
|
||||
msg(std::move(t_msg)),
|
||||
printval(std::move(t_printval))
|
||||
printval(std::move(t_printval)),
|
||||
callback(nullptr)
|
||||
{
|
||||
option_type = STRING;
|
||||
}
|
||||
@@ -97,7 +98,7 @@ option_t::option_t(std::string t_longform,
|
||||
* Option List
|
||||
*/
|
||||
|
||||
option_list::option_list(std::string program_name) : d_program_name(program_name)
|
||||
option_list::option_list(std::string program_name) : d_program_name(std::move(program_name))
|
||||
{
|
||||
d_internal_list = std::vector<option_t>();
|
||||
}
|
||||
|
||||
@@ -53,9 +53,9 @@ void set_update(bool val) { update_mode = val; }
|
||||
bool dry_run = false;
|
||||
void set_dryrun(bool val) { dry_run = val; }
|
||||
std::string json_filename("");
|
||||
void set_json(std::string val) { json_filename = val; }
|
||||
void set_json(std::string val) { json_filename = std::move(val); }
|
||||
std::string volk_config_path("");
|
||||
void set_volk_config(std::string val) { volk_config_path = val; }
|
||||
void set_volk_config(std::string val) { volk_config_path = std::move(val); }
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
@@ -627,7 +627,7 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc,
|
||||
memcpy(arch_inbuff, inbuffs[j], vlen * inputsig[j].size * (inputsig[j].is_complex ? 2 : 1));
|
||||
arch_buffs.push_back(arch_inbuff);
|
||||
}
|
||||
test_data.push_back(arch_buffs);
|
||||
test_data.push_back(std::move(arch_buffs));
|
||||
}
|
||||
|
||||
std::vector<volk_gnsssdr_type_t> both_sigs;
|
||||
|
||||
@@ -61,7 +61,7 @@ CustomUDPSignalSource::CustomUDPSignalSource(const ConfigurationInterface* confi
|
||||
const std::string sample_type = configuration->property(role + ".sample_type", default_sample_type);
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
|
||||
udp_gnss_rx_source_ = Gr_Complex_Ip_Packet_Source::make(capture_device,
|
||||
udp_gnss_rx_source_ = Gr_Complex_Ip_Packet_Source::make(std::move(capture_device),
|
||||
address,
|
||||
port,
|
||||
payload_bytes,
|
||||
|
||||
@@ -2308,7 +2308,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector<uint8_t>& dsm_msg
|
||||
candidate_public_key.pkid = npktid;
|
||||
candidate_public_key.npkt_valid = true;
|
||||
candidate_public_key.npkt = d_osnma_data.d_dsm_pkr_message.npkt;
|
||||
candidate_public_key.key_type = PKT;
|
||||
candidate_public_key.key_type = std::move(PKT);
|
||||
candidate_public_key.source = "DSM-PKR";
|
||||
candidate_public_key.compressed_key = d_new_public_key;
|
||||
candidate_public_key.fingerprint_sha256 =
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
|
||||
class VisibilityTestPvt : public PvtInterface
|
||||
{
|
||||
@@ -116,7 +117,7 @@ protected:
|
||||
gps.WN = fix.week % 1024;
|
||||
gps.toe = gps.toc = gps.tow = tow;
|
||||
gps.sqrtA = 5153.795;
|
||||
pvt->gps_eph[1] = gps;
|
||||
pvt->gps_eph[1] = std::move(gps);
|
||||
SetGpsAlmanac(tow);
|
||||
Gps_Almanac gps_almanac = pvt->gps_alm.at(1);
|
||||
gps_almanac.PRN = 2;
|
||||
@@ -141,7 +142,7 @@ protected:
|
||||
beidou.WN = fix.week - 1356;
|
||||
beidou.toe = beidou.toc = beidou.tow = tow;
|
||||
beidou.sqrtA = 5282.0;
|
||||
pvt->bds_eph[10] = beidou;
|
||||
pvt->bds_eph[10] = std::move(beidou);
|
||||
Beidou_Dnav_Almanac beidou_almanac;
|
||||
beidou_almanac.PRN = 11;
|
||||
beidou_almanac.WNa = fix.week - 1356;
|
||||
|
||||
Reference in new issue
Block a user