mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-05-18 15:24:09 +00:00
Fix more defects detected by Coverity Scan
This commit is contained in:
parent
3ad02f6dc1
commit
e836d8f471
@ -21,7 +21,7 @@ option_t::option_t(std::string t_longform,
|
|||||||
void (*t_callback)())
|
void (*t_callback)())
|
||||||
: longform("--" + t_longform),
|
: longform("--" + t_longform),
|
||||||
shortform("-" + t_shortform),
|
shortform("-" + t_shortform),
|
||||||
msg(t_msg),
|
msg(std::move(t_msg)),
|
||||||
callback(t_callback)
|
callback(t_callback)
|
||||||
{
|
{
|
||||||
option_type = VOID_CALLBACK;
|
option_type = VOID_CALLBACK;
|
||||||
@ -34,7 +34,7 @@ option_t::option_t(std::string t_longform,
|
|||||||
void (*t_callback)(int))
|
void (*t_callback)(int))
|
||||||
: longform("--" + t_longform),
|
: longform("--" + t_longform),
|
||||||
shortform("-" + t_shortform),
|
shortform("-" + t_shortform),
|
||||||
msg(t_msg),
|
msg(std::move(t_msg)),
|
||||||
callback((void (*)())t_callback)
|
callback((void (*)())t_callback)
|
||||||
{
|
{
|
||||||
option_type = INT_CALLBACK;
|
option_type = INT_CALLBACK;
|
||||||
@ -47,7 +47,7 @@ option_t::option_t(std::string t_longform,
|
|||||||
void (*t_callback)(float))
|
void (*t_callback)(float))
|
||||||
: longform("--" + t_longform),
|
: longform("--" + t_longform),
|
||||||
shortform("-" + t_shortform),
|
shortform("-" + t_shortform),
|
||||||
msg(t_msg),
|
msg(std::move(t_msg)),
|
||||||
callback((void (*)())t_callback)
|
callback((void (*)())t_callback)
|
||||||
{
|
{
|
||||||
option_type = FLOAT_CALLBACK;
|
option_type = FLOAT_CALLBACK;
|
||||||
@ -60,7 +60,7 @@ option_t::option_t(std::string t_longform,
|
|||||||
void (*t_callback)(bool))
|
void (*t_callback)(bool))
|
||||||
: longform("--" + t_longform),
|
: longform("--" + t_longform),
|
||||||
shortform("-" + t_shortform),
|
shortform("-" + t_shortform),
|
||||||
msg(t_msg),
|
msg(std::move(t_msg)),
|
||||||
callback((void (*)())t_callback)
|
callback((void (*)())t_callback)
|
||||||
{
|
{
|
||||||
option_type = BOOL_CALLBACK;
|
option_type = BOOL_CALLBACK;
|
||||||
@ -73,7 +73,7 @@ option_t::option_t(std::string t_longform,
|
|||||||
void (*t_callback)(std::string))
|
void (*t_callback)(std::string))
|
||||||
: longform("--" + t_longform),
|
: longform("--" + t_longform),
|
||||||
shortform("-" + t_shortform),
|
shortform("-" + t_shortform),
|
||||||
msg(t_msg),
|
msg(std::move(t_msg)),
|
||||||
callback((void (*)())t_callback)
|
callback((void (*)())t_callback)
|
||||||
{
|
{
|
||||||
option_type = STRING_CALLBACK;
|
option_type = STRING_CALLBACK;
|
||||||
@ -86,8 +86,8 @@ option_t::option_t(std::string t_longform,
|
|||||||
std::string t_printval)
|
std::string t_printval)
|
||||||
: longform("--" + t_longform),
|
: longform("--" + t_longform),
|
||||||
shortform("-" + t_shortform),
|
shortform("-" + t_shortform),
|
||||||
msg(t_msg),
|
msg(std::move(t_msg)),
|
||||||
printval(t_printval)
|
printval(std::move(t_printval))
|
||||||
{
|
{
|
||||||
option_type = STRING;
|
option_type = STRING;
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ int main(int argc, char *argv[])
|
|||||||
if (!dry_run)
|
if (!dry_run)
|
||||||
{
|
{
|
||||||
if (config_file != "")
|
if (config_file != "")
|
||||||
write_results(&results, false, config_file);
|
write_results(&results, false, std::move(config_file));
|
||||||
else
|
else
|
||||||
write_results(&results, false);
|
write_results(&results, false);
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,8 @@ int main(int argc, char* argv[])
|
|||||||
std::string def_kernel_regex = "";
|
std::string def_kernel_regex = "";
|
||||||
|
|
||||||
volk_gnsssdr_test_params_t test_params(def_tol, def_scalar, def_vlen, def_iter,
|
volk_gnsssdr_test_params_t test_params(def_tol, def_scalar, def_vlen, def_iter,
|
||||||
def_benchmark_mode, def_kernel_regex);
|
def_benchmark_mode, std::move(def_kernel_regex));
|
||||||
std::vector<volk_gnsssdr_test_case_t> test_cases = init_test_list(test_params);
|
std::vector<volk_gnsssdr_test_case_t> test_cases = init_test_list(std::move(test_params));
|
||||||
std::vector<volk_gnsssdr_test_results_t> results;
|
std::vector<volk_gnsssdr_test_results_t> results;
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
{
|
{
|
||||||
@ -94,7 +94,7 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate XML results
|
// Generate XML results
|
||||||
print_qa_xml(results, qa_failures.size());
|
print_qa_xml(std::move(results), qa_failures.size());
|
||||||
|
|
||||||
// Summarize QA results
|
// Summarize QA results
|
||||||
std::cerr << "Kernel QA finished: " << qa_failures.size() << " failures out of "
|
std::cerr << "Kernel QA finished: " << qa_failures.size() << " failures out of "
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "configuration_interface.h"
|
#include "configuration_interface.h"
|
||||||
#include "gnss_sdr_make_unique.h"
|
#include "gnss_sdr_make_unique.h"
|
||||||
#include "in_memory_configuration.h"
|
#include "in_memory_configuration.h"
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
TEST(InMemoryConfiguration, IsPresent)
|
TEST(InMemoryConfiguration, IsPresent)
|
||||||
{
|
{
|
||||||
@ -35,7 +36,7 @@ TEST(InMemoryConfiguration, StoreAndRetrieve)
|
|||||||
auto configuration = std::make_unique<InMemoryConfiguration>();
|
auto configuration = std::make_unique<InMemoryConfiguration>();
|
||||||
configuration->set_property("Foo.property1", "value");
|
configuration->set_property("Foo.property1", "value");
|
||||||
std::string default_value = "default_value";
|
std::string default_value = "default_value";
|
||||||
std::string value = configuration->property("Foo.property1", default_value);
|
std::string value = configuration->property("Foo.property1", std::move(default_value));
|
||||||
EXPECT_STREQ("value", value.c_str());
|
EXPECT_STREQ("value", value.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ TEST(InMemoryConfiguration, NoStoringAndRetrieve)
|
|||||||
// std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>();
|
// std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>();
|
||||||
auto configuration = std::make_unique<InMemoryConfiguration>();
|
auto configuration = std::make_unique<InMemoryConfiguration>();
|
||||||
std::string default_value = "default_value";
|
std::string default_value = "default_value";
|
||||||
std::string value = configuration->property("Foo.property1", default_value);
|
std::string value = configuration->property("Foo.property1", std::move(default_value));
|
||||||
EXPECT_STREQ("default_value", value.c_str());
|
EXPECT_STREQ("default_value", value.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_1()
|
|||||||
|
|
||||||
config = std::make_shared<InMemoryConfiguration>();
|
config = std::make_shared<InMemoryConfiguration>();
|
||||||
|
|
||||||
config->set_property("Channel.signal", signal);
|
config->set_property("Channel.signal", std::move(signal));
|
||||||
config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(fs_in));
|
config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(fs_in));
|
||||||
config->set_property("SignalSource.fs_hz", std::to_string(fs_in));
|
config->set_property("SignalSource.fs_hz", std::to_string(fs_in));
|
||||||
config->set_property("SignalSource.item_type", "gr_complex");
|
config->set_property("SignalSource.item_type", "gr_complex");
|
||||||
|
@ -267,7 +267,7 @@ TEST_F(FirFilterTest, ConnectAndRunCshorts)
|
|||||||
config2->set_property("Test_Source.sampling_frequency", "4000000");
|
config2->set_property("Test_Source.sampling_frequency", "4000000");
|
||||||
std::string path = std::string(TEST_PATH);
|
std::string path = std::string(TEST_PATH);
|
||||||
std::string filename = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
std::string filename = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
||||||
config2->set_property("Test_Source.filename", filename);
|
config2->set_property("Test_Source.filename", std::move(filename));
|
||||||
config2->set_property("Test_Source.item_type", "ishort");
|
config2->set_property("Test_Source.item_type", "ishort");
|
||||||
config2->set_property("Test_Source.repeat", "true");
|
config2->set_property("Test_Source.repeat", "true");
|
||||||
|
|
||||||
@ -357,7 +357,7 @@ TEST_F(FirFilterTest, ConnectAndRunCbyteGrcomplex)
|
|||||||
config2->set_property("Test_Source.sampling_frequency", "4000000");
|
config2->set_property("Test_Source.sampling_frequency", "4000000");
|
||||||
std::string path = std::string(TEST_PATH);
|
std::string path = std::string(TEST_PATH);
|
||||||
std::string filename = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
std::string filename = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
||||||
config2->set_property("Test_Source.filename", filename);
|
config2->set_property("Test_Source.filename", std::move(filename));
|
||||||
config2->set_property("Test_Source.item_type", "ibyte");
|
config2->set_property("Test_Source.item_type", "ibyte");
|
||||||
config2->set_property("Test_Source.repeat", "true");
|
config2->set_property("Test_Source.repeat", "true");
|
||||||
|
|
||||||
|
@ -796,8 +796,8 @@ TEST_F(RinexPrinterTest, MixedObsLog)
|
|||||||
Pvt_Conf conf;
|
Pvt_Conf conf;
|
||||||
conf.use_e6_for_pvt = false;
|
conf.use_e6_for_pvt = false;
|
||||||
auto pvt_solution = std::make_shared<Rtklib_Solver>(rtk, conf, "filename", 9, false, false);
|
auto pvt_solution = std::make_shared<Rtklib_Solver>(rtk, conf, "filename", 9, false, false);
|
||||||
pvt_solution->gps_ephemeris_map[1] = eph_gps;
|
pvt_solution->gps_ephemeris_map[1] = std::move(eph_gps);
|
||||||
pvt_solution->galileo_ephemeris_map[1] = eph_gal;
|
pvt_solution->galileo_ephemeris_map[1] = std::move(eph_gal);
|
||||||
std::map<int, Gnss_Synchro> gnss_observables_map;
|
std::map<int, Gnss_Synchro> gnss_observables_map;
|
||||||
|
|
||||||
Gnss_Synchro gs1 = Gnss_Synchro();
|
Gnss_Synchro gs1 = Gnss_Synchro();
|
||||||
@ -922,8 +922,8 @@ TEST_F(RinexPrinterTest, MixedObsLogGpsGlo)
|
|||||||
Pvt_Conf conf;
|
Pvt_Conf conf;
|
||||||
conf.use_e6_for_pvt = false;
|
conf.use_e6_for_pvt = false;
|
||||||
auto pvt_solution = std::make_shared<Rtklib_Solver>(rtk, conf, "filename", 26, false, false);
|
auto pvt_solution = std::make_shared<Rtklib_Solver>(rtk, conf, "filename", 26, false, false);
|
||||||
pvt_solution->gps_ephemeris_map[1] = eph_gps;
|
pvt_solution->gps_ephemeris_map[1] = std::move(eph_gps);
|
||||||
pvt_solution->glonass_gnav_ephemeris_map[1] = eph_glo;
|
pvt_solution->glonass_gnav_ephemeris_map[1] = std::move(eph_glo);
|
||||||
std::map<int, Gnss_Synchro> gnss_observables_map;
|
std::map<int, Gnss_Synchro> gnss_observables_map;
|
||||||
|
|
||||||
Gnss_Synchro gs1 = Gnss_Synchro();
|
Gnss_Synchro gs1 = Gnss_Synchro();
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <gnuradio/top_block.h>
|
#include <gnuradio/top_block.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
TEST(FileSignalSource, Instantiate)
|
TEST(FileSignalSource, Instantiate)
|
||||||
{
|
{
|
||||||
@ -32,7 +33,7 @@ TEST(FileSignalSource, Instantiate)
|
|||||||
config->set_property("Test.sampling_frequency", "0");
|
config->set_property("Test.sampling_frequency", "0");
|
||||||
std::string path = std::string(TEST_PATH);
|
std::string path = std::string(TEST_PATH);
|
||||||
std::string filename = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
std::string filename = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
||||||
config->set_property("Test.filename", filename);
|
config->set_property("Test.filename", std::move(filename));
|
||||||
config->set_property("Test.item_type", "gr_complex");
|
config->set_property("Test.item_type", "gr_complex");
|
||||||
config->set_property("Test.repeat", "false");
|
config->set_property("Test.repeat", "false");
|
||||||
|
|
||||||
@ -57,5 +58,5 @@ TEST(FileSignalSource, InstantiateFileNotExists)
|
|||||||
// connect doesn't matter, since the exception should be thrown sooner than any connections
|
// connect doesn't matter, since the exception should be thrown sooner than any connections
|
||||||
auto top = gr::make_top_block("GNSSUnitTest");
|
auto top = gr::make_top_block("GNSSUnitTest");
|
||||||
auto uptr = std::make_shared<FileSignalSource>(config.get(), "Test", 0, 1, queue.get());
|
auto uptr = std::make_shared<FileSignalSource>(config.get(), "Test", 0, 1, queue.get());
|
||||||
EXPECT_THROW({ uptr->connect(top); }, std::exception);
|
EXPECT_THROW({ uptr->connect(std::move(top)); }, std::exception);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user