Fix defect detected by Coverity Scan

This commit is contained in:
Carles Fernandez 2023-11-05 10:16:26 +01:00
parent 2dfd79d45c
commit f6a1777a21
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 23 additions and 23 deletions

View File

@ -65,14 +65,6 @@ Rinex_Printer::Rinex_Printer(int32_t conf_version,
d_pre_2009_file(false)
{
// RINEX v3.02 codes
satelliteSystem["GPS"] = "G";
satelliteSystem["GLONASS"] = "R";
satelliteSystem["SBAS payload"] = "S";
satelliteSystem["Galileo"] = "E";
satelliteSystem["Beidou"] = "C";
satelliteSystem["Mixed"] = "M";
observationCode["GPS_L1_CA"] = "1C"; // "1C" GPS L1 C/A
observationCode["GPS_L1_P"] = "1P"; // "1P" GPS L1 P
observationCode["GPS_L1_Z_TRACKING"] = "1W"; // "1W" GPS L1 Z-tracking and similar (AS on)
@ -6364,7 +6356,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps
line += d_stringVersion;
line += std::string(11, ' ');
line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20);
line += satelliteSystem["Mixed"];
line += satelliteSystem.find("Mixed")->second;
line += std::string(19, ' ');
line += std::string("RINEX VERSION / TYPE");
Rinex_Printer::lengthCheck(line);
@ -6724,7 +6716,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris
line += d_stringVersion;
line += std::string(11, ' ');
line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20);
line += satelliteSystem["Mixed"];
line += satelliteSystem.find("Mixed")->second;
line += std::string(19, ' ');
line += std::string("RINEX VERSION / TYPE");
Rinex_Printer::lengthCheck(line);
@ -7049,7 +7041,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris&
line += "3.02";
line += std::string(11, ' ');
line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20);
line += satelliteSystem["Mixed"];
line += satelliteSystem.find("Mixed")->second;
line += std::string(19, ' ');
line += std::string("RINEX VERSION / TYPE");
Rinex_Printer::lengthCheck(line);
@ -8199,7 +8191,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps
line += "3.02";
line += std::string(11, ' ');
line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20);
line += satelliteSystem["Mixed"];
line += satelliteSystem.find("Mixed")->second;
line += std::string(19, ' ');
line += std::string("RINEX VERSION / TYPE");
Rinex_Printer::lengthCheck(line);
@ -8571,7 +8563,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris
line += "3.02";
line += std::string(11, ' ');
line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20);
line += satelliteSystem["Mixed"];
line += satelliteSystem.find("Mixed")->second;
line += std::string(19, ' ');
line += std::string("RINEX VERSION / TYPE");
Rinex_Printer::lengthCheck(line);
@ -9215,7 +9207,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps
line += "3.02";
line += std::string(11, ' ');
line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20);
line += satelliteSystem["Mixed"];
line += satelliteSystem.find("Mixed")->second;
line += std::string(19, ' ');
line += std::string("RINEX VERSION / TYPE");
Rinex_Printer::lengthCheck(line);

View File

@ -39,14 +39,15 @@
#define GNSS_SDR_RINEX_PRINTER_H
#include <boost/date_time/posix_time/posix_time.hpp>
#include <cstdint> // for int32_t
#include <cstdlib> // for strtol, strtod
#include <fstream> // for fstream
#include <iomanip> // for setprecision
#include <map> // for map
#include <sstream> // for stringstream
#include <string> // for string
#include <vector>
#include <cstdint> // for int32_t
#include <cstdlib> // for strtol, strtod
#include <fstream> // for fstream
#include <iomanip> // for setprecision
#include <map> // for map
#include <sstream> // for stringstream
#include <string> // for string
#include <unordered_map> // for unordered_map
#include <vector> // for vector
/** \addtogroup PVT
@ -232,6 +233,14 @@ public:
private:
const std::unordered_map<std::string, std::string> satelliteSystem = {
{"GPS", "G"},
{"GLONASS", "R"},
{"SBAS payload", "S"},
{"Galileo", "E"},
{"Beidou", "C"},
{"Mixed", "M"}}; // RINEX v3.02 codes
/*
* Generates the GPS Observation data header
*/
@ -984,7 +993,6 @@ private:
inline std::string asFixWidthString(int x, int width, char fill_digit) const;
std::map<std::string, std::string> satelliteSystem; // GPS, GLONASS, SBAS payload, Galileo or Beidou
std::map<std::string, std::string> observationType; // PSEUDORANGE, CARRIER_PHASE, DOPPLER, SIGNAL_STRENGTH
std::map<std::string, std::string> observationCode; // GNSS observation descriptors