1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 04:30:33 +00:00
This commit is contained in:
Carles Fernandez 2019-08-23 23:36:16 +02:00
commit 5fa2610b4b
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
60 changed files with 407 additions and 304 deletions

View File

@ -2352,14 +2352,14 @@ endif()
################################################################################ ################################################################################
# Set compiler flags # Set compiler flags
################################################################################ ################################################################################
set(CXX_WARNING_FLAGS -Wall -Wextra)
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
# Add warning flags # Add warning flags
# For "-Wall" see https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html # For "-Wall" see https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
set(cxx_warning_flags -Wall -Wextra)
if(NOT (CMAKE_VERSION VERSION_LESS "3.3")) if(NOT (CMAKE_VERSION VERSION_LESS "3.3"))
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:${cxx_warning_flags}>") add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:${CXX_WARNING_FLAGS}>")
else() else()
add_compile_options("$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:${cxx_warning_flags}>") add_compile_options("$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:${CXX_WARNING_FLAGS}>")
endif() endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0") if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0")
add_compile_options(-Wno-missing-field-initializers) add_compile_options(-Wno-missing-field-initializers)
@ -2368,6 +2368,13 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
add_compile_options(-Wno-psabi) add_compile_options(-Wno-psabi)
endif() endif()
endif() endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(NOT (CMAKE_VERSION VERSION_LESS "3.3"))
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:${CXX_WARNING_FLAGS}>")
else()
add_compile_options("$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:${CXX_WARNING_FLAGS}>")
endif()
endif()
# Processor-architecture related flags # Processor-architecture related flags
# See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html # See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html

View File

@ -11,19 +11,24 @@
### Improvements in Portability: ### Improvements in Portability:
- The CMake scripts now find dependencies in Debian's riscv64 architecture. - The CMake scripts now find dependencies in Debian's riscv64 architecture.
- Enable AVX2 kernels of the volk_gnsssdr library when using the Clang compiler.
- Added a CMake toolchain for building volk_gnsssdr in a Raspberry Pi.
### Improvements in Reliability: ### Improvements in Reliability:
- Decoding of navigation messages no longer rely on implementation defined behavior for shifting left a signed integer. - Decoding of navigation messages no longer rely on implementation defined behavior for shifting left a signed integer.
- Removed usage of functions with insecure API (e.g., strcpy). - Removed usage of functions with insecure API (e.g., strcpy, sprintf).
- Added clang-tidy checks clang-analyzer-security.*, clang-analyzer-optin.portability.UnixAPI clang-tidy checks. Fixed raised warnings. - Added clang-tidy checks clang-analyzer-security.*, clang-analyzer-optin.portability.UnixAPI clang-tidy checks. Fixed raised warnings.
- Fixed cpplint.py runtime/printf and runtime/explicit errors.
- All constructors callable with one argument are marked with the keyword explicit. See MISRA C++:2008, 12-1-3 - All constructors that are callable with a single argument of fundamental type shall be declared explicit.
### Improvements in Usability: ### Improvements in Usability:
- Improved DLL-PLL binary dump MATLAB/Octave plot script. Old versions removed. - Improved DLL-PLL binary dump MATLAB/Octave plot script. Old versions removed.
- Simplified RTKLIB error log. - Simplified RTKLIB error log.
- Added a Python 3 plotting script to show relative performance of generic volk_gnsssdr kernels wrt SIMD fastest versions.

View File

@ -48,7 +48,7 @@ class Pvt_Solution;
class GeoJSON_Printer class GeoJSON_Printer
{ {
public: public:
GeoJSON_Printer(const std::string& base_path = "."); explicit GeoJSON_Printer(const std::string& base_path = ".");
~GeoJSON_Printer(); ~GeoJSON_Printer();
bool set_headers(const std::string& filename, bool time_tag_name = true); bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const std::shared_ptr<Pvt_Solution>& position, bool print_average_values); bool print_position(const std::shared_ptr<Pvt_Solution>& position, bool print_average_values);

View File

@ -48,7 +48,7 @@ class Rtklib_Solver;
class Gpx_Printer class Gpx_Printer
{ {
public: public:
Gpx_Printer(const std::string& base_path = "."); explicit Gpx_Printer(const std::string& base_path = ".");
~Gpx_Printer(); ~Gpx_Printer();
bool set_headers(const std::string& filename, bool time_tag_name = true); bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const std::shared_ptr<Rtklib_Solver>& position, bool print_average_values); bool print_position(const std::shared_ptr<Rtklib_Solver>& position, bool print_average_values);

View File

@ -47,7 +47,7 @@ class Rtklib_Solver;
class Kml_Printer class Kml_Printer
{ {
public: public:
Kml_Printer(const std::string& base_path = std::string(".")); explicit Kml_Printer(const std::string& base_path = std::string("."));
~Kml_Printer(); ~Kml_Printer();
bool set_headers(const std::string& filename, bool time_tag_name = true); bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const std::shared_ptr<Rtklib_Solver>& position, bool print_average_values); bool print_position(const std::shared_ptr<Rtklib_Solver>& position, bool print_average_values);

View File

@ -89,7 +89,7 @@ public:
/*! /*!
* \brief Default constructor. Creates GNSS Navigation and Observables RINEX files and their headers * \brief Default constructor. Creates GNSS Navigation and Observables RINEX files and their headers
*/ */
Rinex_Printer(int version = 0, const std::string& base_path = "."); explicit Rinex_Printer(int version = 0, const std::string& base_path = ".");
/*! /*!
* \brief Default destructor. Closes GNSS Navigation and Observables RINEX files * \brief Default destructor. Closes GNSS Navigation and Observables RINEX files

View File

@ -97,7 +97,7 @@ using b_io_context = boost::asio::io_service;
class Rtcm class Rtcm
{ {
public: public:
Rtcm(uint16_t port = 2101); //!< Default constructor that sets TCP port of the RTCM message server and RTCM Station ID. 2101 is the standard RTCM port according to the Internet Assigned Numbers Authority (IANA). See https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml explicit Rtcm(uint16_t port = 2101); //!< Default constructor that sets TCP port of the RTCM message server and RTCM Station ID. 2101 is the standard RTCM port according to the Internet Assigned Numbers Authority (IANA). See https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml
~Rtcm(); ~Rtcm();
/*! /*!
@ -593,7 +593,7 @@ private:
inline void encode_header() inline void encode_header()
{ {
char header[header_length + 1] = ""; char header[header_length + 1] = "";
std::sprintf(header, "GS%4d", static_cast<int>(body_length_)); std::snprintf(header, header_length, "GS%4d", static_cast<int>(body_length_));
std::memcpy(data_, header, header_length); std::memcpy(data_, header, header_length);
} }

View File

@ -214,7 +214,7 @@ public:
private: private:
friend pcps_acquisition_sptr pcps_make_acquisition(const Acq_Conf& conf_); friend pcps_acquisition_sptr pcps_make_acquisition(const Acq_Conf& conf_);
pcps_acquisition(const Acq_Conf& conf_); explicit pcps_acquisition(const Acq_Conf& conf_);
bool d_active; bool d_active;
bool d_worker_active; bool d_worker_active;
bool d_cshort; bool d_cshort;

View File

@ -194,7 +194,7 @@ public:
private: private:
friend pcps_acquisition_fine_doppler_cc_sptr friend pcps_acquisition_fine_doppler_cc_sptr
pcps_make_acquisition_fine_doppler_cc(const Acq_Conf& conf_); pcps_make_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
pcps_acquisition_fine_doppler_cc(const Acq_Conf& conf_); explicit pcps_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
int compute_and_accumulate_grid(gr_vector_const_void_star& input_items); int compute_and_accumulate_grid(gr_vector_const_void_star& input_items);
int estimate_Doppler(); int estimate_Doppler();

View File

@ -203,7 +203,7 @@ public:
private: private:
friend pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_); friend pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_);
pcps_acquisition_fpga(pcpsconf_fpga_t conf_); explicit pcps_acquisition_fpga(pcpsconf_fpga_t conf_);
bool d_active; bool d_active;
bool d_make_2_steps; bool d_make_2_steps;
uint32_t d_doppler_index; uint32_t d_doppler_index;

View File

@ -50,7 +50,7 @@ class ChannelFsm
{ {
public: public:
ChannelFsm(); ChannelFsm();
ChannelFsm(std::shared_ptr<AcquisitionInterface> acquisition); explicit ChannelFsm(std::shared_ptr<AcquisitionInterface> acquisition);
void set_acquisition(std::shared_ptr<AcquisitionInterface> acquisition); void set_acquisition(std::shared_ptr<AcquisitionInterface> acquisition);
void set_tracking(std::shared_ptr<TrackingInterface> tracking); void set_tracking(std::shared_ptr<TrackingInterface> tracking);

View File

@ -66,7 +66,7 @@ static string
num2str(int num) num2str(int num)
{ {
char temp[200]; char temp[200];
sprintf(temp, "%d", num); snprintf(temp, sizeof(temp), "%d", num);
return string(temp); return string(temp);
} }
@ -814,7 +814,7 @@ createLocalMemfftKernelString(cl_fft_plan *plan)
(*kInfo)->in_place_possible = 1; (*kInfo)->in_place_possible = 1;
(*kInfo)->next = nullptr; (*kInfo)->next = nullptr;
(*kInfo)->kernel_name = (char *)malloc(sizeof(char) * (kernelName.size() + 1)); (*kInfo)->kernel_name = (char *)malloc(sizeof(char) * (kernelName.size() + 1));
strcpy((*kInfo)->kernel_name, kernelName.c_str()); snprintf((*kInfo)->kernel_name, sizeof((*kInfo)->kernel_name), kernelName.c_str());
unsigned int numWorkItemsPerXForm = n / radixArray[0]; unsigned int numWorkItemsPerXForm = n / radixArray[0];
unsigned int numWorkItemsPerWG = numWorkItemsPerXForm <= 64 ? 64 : numWorkItemsPerXForm; unsigned int numWorkItemsPerWG = numWorkItemsPerXForm <= 64 ? 64 : numWorkItemsPerXForm;
@ -1035,7 +1035,7 @@ createGlobalFFTKernelString(cl_fft_plan *plan, int n, int BS, cl_fft_kernel_dir
(*kInfo)->in_place_possible = 0; (*kInfo)->in_place_possible = 0;
(*kInfo)->next = nullptr; (*kInfo)->next = nullptr;
(*kInfo)->kernel_name = (char *)malloc(sizeof(char) * (kernelName.size() + 1)); (*kInfo)->kernel_name = (char *)malloc(sizeof(char) * (kernelName.size() + 1));
strcpy((*kInfo)->kernel_name, kernelName.c_str()); snprintf((*kInfo)->kernel_name, sizeof((*kInfo)->kernel_name), kernelName.c_str());
insertVariables(localString, R1); insertVariables(localString, R1);

View File

@ -595,7 +595,7 @@ int valsol(const double *azel, const int *vsat, int n,
vv = dot(v, v, nv); vv = dot(v, v, nv);
if (nv > nx && vv > CHISQR[nv - nx - 1]) if (nv > nx && vv > CHISQR[nv - nx - 1])
{ {
sprintf(msg, "chi-square error nv=%d vv=%.1f cs=%.1f", nv, vv, CHISQR[nv - nx - 1]); std::snprintf(msg, MAXSOLBUF, "chi-square error nv=%d vv=%.1f cs=%.1f", nv, vv, CHISQR[nv - nx - 1]);
return 0; return 0;
} }
/* large gdop check */ /* large gdop check */
@ -612,7 +612,7 @@ int valsol(const double *azel, const int *vsat, int n,
dops(ns, azels, opt->elmin, dop); dops(ns, azels, opt->elmin, dop);
if (dop[0] <= 0.0 || dop[0] > opt->maxgdop) if (dop[0] <= 0.0 || dop[0] > opt->maxgdop)
{ {
sprintf(msg, "gdop error nv=%d gdop=%.1f", nv, dop[0]); std::snprintf(msg, MAXSOLBUF, "gdop error nv=%d gdop=%.1f", nv, dop[0]);
return 0; return 0;
} }
return 1; return 1;
@ -639,6 +639,7 @@ int estpos(const obsd_t *obs, int n, const double *rs, const double *dts,
int stat; int stat;
int nv; int nv;
int ns; int ns;
char msg_aux[128];
trace(3, "estpos : n=%d\n", n); trace(3, "estpos : n=%d\n", n);
@ -658,7 +659,7 @@ int estpos(const obsd_t *obs, int n, const double *rs, const double *dts,
if (nv < NX) if (nv < NX)
{ {
sprintf(msg, "lack of valid sats ns=%d", nv); std::snprintf(msg_aux, sizeof(msg_aux), "lack of valid sats ns=%d", nv);
break; break;
} }
/* weight by variance */ /* weight by variance */
@ -674,7 +675,7 @@ int estpos(const obsd_t *obs, int n, const double *rs, const double *dts,
/* least square estimation */ /* least square estimation */
if ((info = lsq(H, v, NX, nv, dx, Q))) if ((info = lsq(H, v, NX, nv, dx, Q)))
{ {
sprintf(msg, "lsq error info=%d", info); std::snprintf(msg_aux, sizeof(msg_aux), "lsq error info=%d", info);
break; break;
} }
for (j = 0; j < NX; j++) for (j = 0; j < NX; j++)
@ -712,18 +713,19 @@ int estpos(const obsd_t *obs, int n, const double *rs, const double *dts,
free(v); free(v);
free(H); free(H);
free(var); free(var);
msg = msg_aux;
return stat; return stat;
} }
} }
if (i >= MAXITR) if (i >= MAXITR)
{ {
sprintf(msg, "iteration divergent i=%d", i); std::snprintf(msg_aux, sizeof(msg_aux), "iteration divergent i=%d", i);
} }
free(v); free(v);
free(H); free(H);
free(var); free(var);
msg = msg_aux;
return 0; return 0;
} }

View File

@ -644,7 +644,7 @@ int decode_rtcm2(rtcm_t *rtcm)
if (rtcm->outtype) if (rtcm->outtype)
{ {
sprintf(rtcm->msgtype, "RTCM %2d (%4d) zcnt=%7.1f staid=%3d seqno=%d", std::snprintf(rtcm->msgtype, sizeof(rtcm->msgtype), "RTCM %2d (%4d) zcnt=%7.1f staid=%3d seqno=%d",
type, rtcm->len, zcnt, staid, seqno); type, rtcm->len, zcnt, staid, seqno);
} }
if (type == 3 || type == 22 || type == 23 || type == 24) if (type == 3 || type == 22 || type == 23 || type == 24)

View File

@ -317,7 +317,7 @@ int decode_head1001(rtcm_t *rtcm, int *sync)
if (rtcm->outtype) if (rtcm->outtype)
{ {
msg = rtcm->msgtype + strlen(rtcm->msgtype); msg = rtcm->msgtype + strlen(rtcm->msgtype);
sprintf(msg, " staid=%4d %s nsat=%2d sync=%d", staid, std::snprintf(msg, sizeof(rtcm->msgtype), " staid=%4d %s nsat=%2d sync=%d", staid,
time_str(rtcm->time, 2), nsat, *sync); time_str(rtcm->time, 2), nsat, *sync);
} }
return nsat; return nsat;
@ -583,7 +583,7 @@ int decode_type1005(rtcm_t *rtcm)
re[j] = rr[j] * 0.0001; re[j] = rr[j] * 0.0001;
} }
ecef2pos(re, pos); ecef2pos(re, pos);
sprintf(msg, " staid=%4d pos=%.8f %.8f %.3f", staid, pos[0] * R2D, pos[1] * R2D, std::snprintf(msg, sizeof(rtcm->msgtype), " staid=%4d pos=%.8f %.8f %.3f", staid, pos[0] * R2D, pos[1] * R2D,
pos[2]); pos[2]);
} }
/* test station id */ /* test station id */
@ -644,7 +644,7 @@ int decode_type1006(rtcm_t *rtcm)
re[j] = rr[j] * 0.0001; re[j] = rr[j] * 0.0001;
} }
ecef2pos(re, pos); ecef2pos(re, pos);
sprintf(msg, " staid=%4d pos=%.8f %.8f %.3f anth=%.3f", staid, pos[0] * R2D, std::snprintf(msg, sizeof(rtcm->msgtype), " staid=%4d pos=%.8f %.8f %.3f anth=%.3f", staid, pos[0] * R2D,
pos[1] * R2D, pos[2], anth); pos[1] * R2D, pos[2], anth);
} }
/* test station id */ /* test station id */
@ -697,7 +697,7 @@ int decode_type1007(rtcm_t *rtcm)
if (rtcm->outtype) if (rtcm->outtype)
{ {
msg = rtcm->msgtype + strlen(rtcm->msgtype); msg = rtcm->msgtype + strlen(rtcm->msgtype);
sprintf(msg, " staid=%4d", staid); std::snprintf(msg, sizeof(rtcm->msgtype), " staid=%4d", staid);
} }
/* test station id */ /* test station id */
if (!test_staid(rtcm, staid)) if (!test_staid(rtcm, staid))
@ -754,7 +754,7 @@ int decode_type1008(rtcm_t *rtcm)
if (rtcm->outtype) if (rtcm->outtype)
{ {
msg = rtcm->msgtype + strlen(rtcm->msgtype); msg = rtcm->msgtype + strlen(rtcm->msgtype);
sprintf(msg, " staid=%4d", staid); std::snprintf(msg, sizeof(rtcm->msgtype), " staid=%4d", staid);
} }
/* test station id */ /* test station id */
if (!test_staid(rtcm, staid)) if (!test_staid(rtcm, staid))
@ -813,7 +813,7 @@ int decode_head1009(rtcm_t *rtcm, int *sync)
if (rtcm->outtype) if (rtcm->outtype)
{ {
msg = rtcm->msgtype + strlen(rtcm->msgtype); msg = rtcm->msgtype + strlen(rtcm->msgtype);
sprintf(msg, " staid=%4d %s nsat=%2d sync=%d", staid, std::snprintf(msg, sizeof(rtcm->msgtype), " staid=%4d %s nsat=%2d sync=%d", staid,
time_str(rtcm->time, 2), nsat, *sync); time_str(rtcm->time, 2), nsat, *sync);
} }
return nsat; return nsat;
@ -1127,7 +1127,7 @@ int decode_type1019(rtcm_t *rtcm)
if (rtcm->outtype) if (rtcm->outtype)
{ {
msg = rtcm->msgtype + strlen(rtcm->msgtype); msg = rtcm->msgtype + strlen(rtcm->msgtype);
sprintf(msg, " prn=%2d iode=%3d iodc=%3d week=%d toe=%6.0f toc=%6.0f svh=%02X", std::snprintf(msg, sizeof(rtcm->msgtype), " prn=%2d iode=%3d iodc=%3d week=%d toe=%6.0f toc=%6.0f svh=%02X",
prn, eph.iode, eph.iodc, week, eph.toes, toc, eph.svh); prn, eph.iode, eph.iodc, week, eph.toes, toc, eph.svh);
} }
if (!(sat = satno(sys, prn))) if (!(sat = satno(sys, prn)))
@ -1228,7 +1228,7 @@ int decode_type1020(rtcm_t *rtcm)
if (rtcm->outtype) if (rtcm->outtype)
{ {
msg = rtcm->msgtype + strlen(rtcm->msgtype); msg = rtcm->msgtype + strlen(rtcm->msgtype);
sprintf(msg, " prn=%2d tk=%02.0f:%02.0f:%02.0f frq=%2d bn=%d tb=%d", std::snprintf(msg, sizeof(rtcm->msgtype), " prn=%2d tk=%02.0f:%02.0f:%02.0f frq=%2d bn=%d tb=%d",
prn, tk_h, tk_m, tk_s, geph.frq, bn, tb); prn, tk_h, tk_m, tk_s, geph.frq, bn, tb);
} }
geph.sat = sat; geph.sat = sat;
@ -1371,7 +1371,7 @@ int decode_type1029(rtcm_t *rtcm)
if (rtcm->outtype) if (rtcm->outtype)
{ {
msg = rtcm->msgtype + strlen(rtcm->msgtype); msg = rtcm->msgtype + strlen(rtcm->msgtype);
sprintf(msg, " staid=%4d text=%s", staid, rtcm->msg); std::snprintf(msg, sizeof(rtcm->msgtype), " staid=%4d text=%s", staid, rtcm->msg);
} }
return 0; return 0;
} }
@ -1469,7 +1469,7 @@ int decode_type1033(rtcm_t *rtcm)
if (rtcm->outtype) if (rtcm->outtype)
{ {
msg = rtcm->msgtype + strlen(rtcm->msgtype); msg = rtcm->msgtype + strlen(rtcm->msgtype);
sprintf(msg, " staid=%4d", staid); std::snprintf(msg, sizeof(rtcm->msgtype), " staid=%4d", staid);
} }
/* test station id */ /* test station id */
if (!test_staid(rtcm, staid)) if (!test_staid(rtcm, staid))
@ -1619,7 +1619,7 @@ int decode_type1044(rtcm_t *rtcm)
if (rtcm->outtype) if (rtcm->outtype)
{ {
msg = rtcm->msgtype + strlen(rtcm->msgtype); msg = rtcm->msgtype + strlen(rtcm->msgtype);
sprintf(msg, " prn=%3d iode=%3d iodc=%3d week=%d toe=%6.0f toc=%6.0f svh=%02X", std::snprintf(msg, sizeof(rtcm->msgtype), " prn=%3d iode=%3d iodc=%3d week=%d toe=%6.0f toc=%6.0f svh=%02X",
prn, eph.iode, eph.iodc, week, eph.toes, toc, eph.svh); prn, eph.iode, eph.iodc, week, eph.toes, toc, eph.svh);
} }
if (!(sat = satno(sys, prn))) if (!(sat = satno(sys, prn)))
@ -1732,7 +1732,7 @@ int decode_type1045(rtcm_t *rtcm)
if (rtcm->outtype) if (rtcm->outtype)
{ {
msg = rtcm->msgtype + strlen(rtcm->msgtype); msg = rtcm->msgtype + strlen(rtcm->msgtype);
sprintf(msg, " prn=%2d iode=%3d week=%d toe=%6.0f toc=%6.0f hs=%d dvs=%d", std::snprintf(msg, sizeof(rtcm->msgtype), " prn=%2d iode=%3d week=%d toe=%6.0f toc=%6.0f hs=%d dvs=%d",
prn, eph.iode, week, eph.toes, toc, e5a_hs, e5a_dvs); prn, eph.iode, week, eph.toes, toc, e5a_hs, e5a_dvs);
} }
if (!(sat = satno(sys, prn))) if (!(sat = satno(sys, prn)))
@ -1846,7 +1846,7 @@ int decode_type1046(rtcm_t *rtcm)
if (rtcm->outtype) if (rtcm->outtype)
{ {
msg = rtcm->msgtype + strlen(rtcm->msgtype); msg = rtcm->msgtype + strlen(rtcm->msgtype);
sprintf(msg, " prn=%2d iode=%3d week=%d toe=%6.0f toc=%6.0f hs=%d dvs=%d", std::snprintf(msg, sizeof(rtcm->msgtype), " prn=%2d iode=%3d week=%d toe=%6.0f toc=%6.0f hs=%d dvs=%d",
prn, eph.iode, week, eph.toes, toc, e5a_hs, e5a_dvs); prn, eph.iode, week, eph.toes, toc, e5a_hs, e5a_dvs);
} }
if (!(sat = satno(sys, prn))) if (!(sat = satno(sys, prn)))
@ -1963,7 +1963,7 @@ int decode_type1047(rtcm_t *rtcm)
if (rtcm->outtype) if (rtcm->outtype)
{ {
msg = rtcm->msgtype + strlen(rtcm->msgtype); msg = rtcm->msgtype + strlen(rtcm->msgtype);
sprintf(msg, " prn=%2d iode=%3d iodc=%3d week=%d toe=%6.0f toc=%6.0f svh=%02X", std::snprintf(msg, sizeof(rtcm->msgtype), " prn=%2d iode=%3d iodc=%3d week=%d toe=%6.0f toc=%6.0f svh=%02X",
prn, eph.iode, eph.iodc, week, eph.toes, toc, eph.svh); prn, eph.iode, eph.iodc, week, eph.toes, toc, eph.svh);
} }
if (!(sat = satno(sys, prn))) if (!(sat = satno(sys, prn)))
@ -2077,7 +2077,7 @@ int decode_type63(rtcm_t *rtcm)
if (rtcm->outtype) if (rtcm->outtype)
{ {
msg = rtcm->msgtype + strlen(rtcm->msgtype); msg = rtcm->msgtype + strlen(rtcm->msgtype);
sprintf(msg, " prn=%2d iode=%3d iodc=%3d week=%d toe=%6.0f toc=%6.0f svh=%02X", std::snprintf(msg, sizeof(rtcm->msgtype), " prn=%2d iode=%3d iodc=%3d week=%d toe=%6.0f toc=%6.0f svh=%02X",
prn, eph.iode, eph.iodc, week, eph.toes, toc, eph.svh); prn, eph.iode, eph.iodc, week, eph.toes, toc, eph.svh);
} }
if (!(sat = satno(sys, prn))) if (!(sat = satno(sys, prn)))
@ -2162,7 +2162,7 @@ int decode_ssr1_head(rtcm_t *rtcm, int sys, int *sync, int *iod,
if (rtcm->outtype) if (rtcm->outtype)
{ {
msg = rtcm->msgtype + strlen(rtcm->msgtype); msg = rtcm->msgtype + strlen(rtcm->msgtype);
sprintf(msg, " %s nsat=%2d iod=%2d udi=%2d sync=%d", std::snprintf(msg, sizeof(rtcm->msgtype), " %s nsat=%2d iod=%2d udi=%2d sync=%d",
time_str(rtcm->time, 2), nsat, *iod, udi, *sync); time_str(rtcm->time, 2), nsat, *iod, udi, *sync);
} }
*hsize = i; *hsize = i;
@ -2224,7 +2224,7 @@ int decode_ssr2_head(rtcm_t *rtcm, int sys, int *sync, int *iod,
if (rtcm->outtype) if (rtcm->outtype)
{ {
msg = rtcm->msgtype + strlen(rtcm->msgtype); msg = rtcm->msgtype + strlen(rtcm->msgtype);
sprintf(msg, " %s nsat=%2d iod=%2d udi=%2d sync=%d", std::snprintf(msg, sizeof(rtcm->msgtype), " %s nsat=%2d iod=%2d udi=%2d sync=%d",
time_str(rtcm->time, 2), nsat, *iod, udi, *sync); time_str(rtcm->time, 2), nsat, *iod, udi, *sync);
} }
*hsize = i; *hsize = i;
@ -2290,7 +2290,7 @@ int decode_ssr7_head(rtcm_t *rtcm, int sys, int *sync, int *iod,
if (rtcm->outtype) if (rtcm->outtype)
{ {
msg = rtcm->msgtype + strlen(rtcm->msgtype); msg = rtcm->msgtype + strlen(rtcm->msgtype);
sprintf(msg, " %s nsat=%2d iod=%2d udi=%2d sync=%d", std::snprintf(msg, sizeof(rtcm->msgtype), " %s nsat=%2d iod=%2d udi=%2d sync=%d",
time_str(rtcm->time, 2), nsat, *iod, udi, *sync); time_str(rtcm->time, 2), nsat, *iod, udi, *sync);
} }
*hsize = i; *hsize = i;
@ -3167,14 +3167,14 @@ void save_msm_obs(rtcm_t *rtcm, int sys, msm_h_t *h, const double *r,
{ {
if (q) if (q)
{ {
q += sprintf(q, "L%s%s", sig[i], i < h->nsig - 1 ? ", " : ""); q += std::snprintf(q, sizeof(rtcm->msmtype[0]), "L%s%s", sig[i], i < h->nsig - 1 ? ", " : "");
} }
} }
else else
{ {
if (q) if (q)
{ {
q += sprintf(q, "(%d)%s", h->sigs[i], i < h->nsig - 1 ? ", " : ""); q += std::snprintf(q, sizeof(rtcm->msmtype[0]), "(%d)%s", h->sigs[i], i < h->nsig - 1 ? ", " : "");
} }
trace(2, "rtcm3 %d: unknown signal id=%2d\n", type, h->sigs[i]); trace(2, "rtcm3 %d: unknown signal id=%2d\n", type, h->sigs[i]);
@ -3372,7 +3372,7 @@ int decode_msm_head(rtcm_t *rtcm, int sys, int *sync, int *iod,
if (rtcm->outtype) if (rtcm->outtype)
{ {
msg = rtcm->msgtype + strlen(rtcm->msgtype); msg = rtcm->msgtype + strlen(rtcm->msgtype);
sprintf(msg, " staid=%4d %s nsat=%2d nsig=%2d iod=%2d ncell=%2d sync=%d", std::snprintf(msg, sizeof(rtcm->msgtype), " staid=%4d %s nsat=%2d nsig=%2d iod=%2d ncell=%2d sync=%d",
staid, time_str(rtcm->time, 2), h->nsat, h->nsig, *iod, ncell, *sync); staid, time_str(rtcm->time, 2), h->nsat, h->nsig, *iod, ncell, *sync);
} }
return ncell; return ncell;
@ -3893,7 +3893,7 @@ int decode_rtcm3(rtcm_t *rtcm)
if (rtcm->outtype) if (rtcm->outtype)
{ {
sprintf(rtcm->msgtype, "RTCM %4d (%4d):", type, rtcm->len); std::snprintf(rtcm->msgtype, sizeof(rtcm->msgtype), "RTCM %4d (%4d):", type, rtcm->len);
} }
/* real-time input option */ /* real-time input option */
if (strstr(rtcm->opt, "-RT_INP")) if (strstr(rtcm->opt, "-RT_INP"))

View File

@ -476,34 +476,34 @@ int satid2no(const char *id)
void satno2id(int sat, char *id) void satno2id(int sat, char *id)
{ {
int prn; int prn;
char id_aux[16];
switch (satsys(sat, &prn)) switch (satsys(sat, &prn))
{ {
case SYS_GPS: case SYS_GPS:
sprintf(id, "G%02d", prn - MINPRNGPS + 1); std::snprintf(id, sizeof(id_aux), "G%02d", prn - MINPRNGPS + 1);
return; return;
case SYS_GLO: case SYS_GLO:
sprintf(id, "R%02d", prn - MINPRNGLO + 1); snprintf(id, sizeof(id_aux), "R%02d", prn - MINPRNGLO + 1);
return; return;
case SYS_GAL: case SYS_GAL:
sprintf(id, "E%02d", prn - MINPRNGAL + 1); std::snprintf(id, sizeof(id_aux), "E%02d", prn - MINPRNGAL + 1);
return; return;
case SYS_QZS: case SYS_QZS:
sprintf(id, "J%02d", prn - MINPRNQZS + 1); std::snprintf(id, sizeof(id_aux), "J%02d", prn - MINPRNQZS + 1);
return; return;
case SYS_BDS: case SYS_BDS:
sprintf(id, "C%02d", prn - MINPRNBDS + 1); std::snprintf(id, sizeof(id_aux), "C%02d", prn - MINPRNBDS + 1);
return; return;
case SYS_IRN: case SYS_IRN:
sprintf(id, "I%02d", prn - MINPRNIRN + 1); std::snprintf(id, sizeof(id_aux), "I%02d", prn - MINPRNIRN + 1);
return; return;
case SYS_LEO: case SYS_LEO:
sprintf(id, "L%02d", prn - MINPRNLEO + 1); std::snprintf(id, sizeof(id_aux), "L%02d", prn - MINPRNLEO + 1);
return; return;
case SYS_SBS: case SYS_SBS:
sprintf(id, "%03d", prn); std::snprintf(id, sizeof(id_aux), "%03d", prn);
return; return;
} }
std::strncpy(id, "", 1);
} }
@ -1448,7 +1448,7 @@ void matsprint(const double A[], int n, int m, int p, int q, std::string &buffer
for (j = 0; j < m; j++) for (j = 0; j < m; j++)
{ {
char buf_[256]; char buf_[256];
sprintf(buf_, " %*.*f", p, q, A[i + j * n]); std::snprintf(buf_, sizeof(buf_), " %*.*f", p, q, A[i + j * n]);
std::string s(buf_); std::string s(buf_);
buffer += s; buffer += s;
} }
@ -2073,7 +2073,7 @@ void time2str(gtime_t t, char *s, int n)
t.sec = 0.0; t.sec = 0.0;
}; };
time2epoch(t, ep); time2epoch(t, ep);
sprintf(s, "%04.0f/%02.0f/%02.0f %02.0f:%02.0f:%0*.*f", ep[0], ep[1], ep[2], std::snprintf(s, MAXSTATMSG, "%04.0f/%02.0f/%02.0f %02.0f:%02.0f:%0*.*f", ep[0], ep[1], ep[2],
ep[3], ep[4], n <= 0 ? 2 : n + 3, n <= 0 ? 0 : n, ep[5]); ep[3], ep[4], n <= 0 ? 2 : n + 3, n <= 0 ? 0 : n, ep[5]);
} }
@ -4147,7 +4147,7 @@ int repstr(char *str, const char *pat, const char *rep)
} }
strncpy(r, p, q - p); strncpy(r, p, q - p);
r += q - p; r += q - p;
r += sprintf(r, "%s", rep); r += std::snprintf(r, sizeof(buff), "%s", rep);
} }
if (p <= str) if (p <= str)
{ {
@ -4227,35 +4227,35 @@ int reppath(const char *path, char *rpath, gtime_t time, const char *rov,
ep0[0] = ep[0]; ep0[0] = ep[0];
dow = static_cast<int>(floor(time2gpst(time, &week) / 86400.0)); dow = static_cast<int>(floor(time2gpst(time, &week) / 86400.0));
doy = static_cast<int>(floor(timediff(time, epoch2time(ep0)) / 86400.0)) + 1; doy = static_cast<int>(floor(timediff(time, epoch2time(ep0)) / 86400.0)) + 1;
sprintf(rep, "%02d", (static_cast<int>(ep[3]) / 3) * 3); std::snprintf(rep, sizeof(rep), "%02d", (static_cast<int>(ep[3]) / 3) * 3);
stat |= repstr(rpath, "%ha", rep); stat |= repstr(rpath, "%ha", rep);
sprintf(rep, "%02d", (static_cast<int>(ep[3]) / 6) * 6); std::snprintf(rep, sizeof(rep), "%02d", (static_cast<int>(ep[3]) / 6) * 6);
stat |= repstr(rpath, "%hb", rep); stat |= repstr(rpath, "%hb", rep);
sprintf(rep, "%02d", (static_cast<int>(ep[3]) / 12) * 12); std::snprintf(rep, sizeof(rep), "%02d", (static_cast<int>(ep[3]) / 12) * 12);
stat |= repstr(rpath, "%hc", rep); stat |= repstr(rpath, "%hc", rep);
sprintf(rep, "%04.0f", ep[0]); std::snprintf(rep, sizeof(rep), "%04.0f", ep[0]);
stat |= repstr(rpath, "%Y", rep); stat |= repstr(rpath, "%Y", rep);
sprintf(rep, "%02.0f", fmod(ep[0], 100.0)); std::snprintf(rep, sizeof(rep), "%02.0f", fmod(ep[0], 100.0));
stat |= repstr(rpath, "%y", rep); stat |= repstr(rpath, "%y", rep);
sprintf(rep, "%02.0f", ep[1]); std::snprintf(rep, sizeof(rep), "%02.0f", ep[1]);
stat |= repstr(rpath, "%m", rep); stat |= repstr(rpath, "%m", rep);
sprintf(rep, "%02.0f", ep[2]); std::snprintf(rep, sizeof(rep), "%02.0f", ep[2]);
stat |= repstr(rpath, "%d", rep); stat |= repstr(rpath, "%d", rep);
sprintf(rep, "%02.0f", ep[3]); std::snprintf(rep, sizeof(rep), "%02.0f", ep[3]);
stat |= repstr(rpath, "%h", rep); stat |= repstr(rpath, "%h", rep);
sprintf(rep, "%02.0f", ep[4]); std::snprintf(rep, sizeof(rep), "%02.0f", ep[4]);
stat |= repstr(rpath, "%M", rep); stat |= repstr(rpath, "%M", rep);
sprintf(rep, "%02.0f", floor(ep[5])); std::snprintf(rep, sizeof(rep), "%02.0f", floor(ep[5]));
stat |= repstr(rpath, "%S", rep); stat |= repstr(rpath, "%S", rep);
sprintf(rep, "%03d", doy); std::snprintf(rep, sizeof(rep), "%03d", doy);
stat |= repstr(rpath, "%n", rep); stat |= repstr(rpath, "%n", rep);
sprintf(rep, "%04d", week); std::snprintf(rep, sizeof(rep), "%04d", week);
stat |= repstr(rpath, "%W", rep); stat |= repstr(rpath, "%W", rep);
sprintf(rep, "%d", dow); std::snprintf(rep, sizeof(rep), "%d", dow);
stat |= repstr(rpath, "%D", rep); stat |= repstr(rpath, "%D", rep);
sprintf(rep, "%c", 'a' + static_cast<int>(ep[3])); std::snprintf(rep, sizeof(rep), "%c", 'a' + static_cast<int>(ep[3]));
stat |= repstr(rpath, "%H", rep); stat |= repstr(rpath, "%H", rep);
sprintf(rep, "%02d", (static_cast<int>(ep[4]) / 15) * 15); std::snprintf(rep, sizeof(rep), "%02d", (static_cast<int>(ep[4]) / 15) * 15);
stat |= repstr(rpath, "%t", rep); stat |= repstr(rpath, "%t", rep);
} }
else if (strstr(rpath, "%ha") || strstr(rpath, "%hb") || strstr(rpath, "%hc") || else if (strstr(rpath, "%ha") || strstr(rpath, "%hb") || strstr(rpath, "%hc") ||
@ -5114,7 +5114,7 @@ int rtk_uncompress(const char *file, char *uncfile)
{ {
std::strncpy(uncfile, tmpfile, 1024); std::strncpy(uncfile, tmpfile, 1024);
uncfile[p - tmpfile] = '\0'; uncfile[p - tmpfile] = '\0';
sprintf(cmd, R"(gzip -f -d -c "%s" > "%s")", tmpfile, uncfile); std::snprintf(cmd, sizeof(cmd), R"(gzip -f -d -c "%s" > "%s")", tmpfile, uncfile);
if (execcmd(cmd)) if (execcmd(cmd))
{ {
@ -5144,8 +5144,6 @@ int rtk_uncompress(const char *file, char *uncfile)
dir = fname; dir = fname;
fname = p + 1; fname = p + 1;
} }
// sprintf(cmd, "tar -C \"%s\" -xf \"%s\"", dir, tmpfile);
// NOTE: This sprintf triggers a format overflow warning. Replaced by:
std::ostringstream temp; std::ostringstream temp;
std::string s_aux1(dir); std::string s_aux1(dir);
std::string s_aux2(tmpfile); std::string s_aux2(tmpfile);
@ -5185,7 +5183,7 @@ int rtk_uncompress(const char *file, char *uncfile)
{ {
std::strncpy(uncfile, tmpfile, 1024); std::strncpy(uncfile, tmpfile, 1024);
uncfile[p - tmpfile + 3] = *(p + 3) == 'D' ? 'O' : 'o'; uncfile[p - tmpfile + 3] = *(p + 3) == 'D' ? 'O' : 'o';
sprintf(cmd, R"(crx2rnx < "%s" > "%s")", tmpfile, uncfile); std::snprintf(cmd, sizeof(cmd), R"(crx2rnx < "%s" > "%s")", tmpfile, uncfile);
if (execcmd(cmd)) if (execcmd(cmd))
{ {
@ -5256,8 +5254,8 @@ int expath(const char *path, char *paths[], int nmax)
{ {
continue; continue;
} }
sprintf(s1, "^%s$", d->d_name); std::snprintf(s1, sizeof(s1), "^%s$", d->d_name);
sprintf(s2, "^%s$", file); std::snprintf(s2, sizeof(s2), "^%s$", file);
for (p = s1; *p; p++) for (p = s1; *p; p++)
{ {
*p = static_cast<char>(tolower(static_cast<int>(*p))); *p = static_cast<char>(tolower(static_cast<int>(*p)));
@ -5280,7 +5278,7 @@ int expath(const char *path, char *paths[], int nmax)
} }
if (p && n < nmax) if (p && n < nmax)
{ {
sprintf(paths[n++], "%s%s", dir, d->d_name); std::snprintf(paths[n++], MAXSTRPATH, "%s%s", dir, d->d_name);
} }
} }
closedir(dp); closedir(dp);

View File

@ -524,7 +524,7 @@ void errmsg(rtk_t *rtk, const char *format, ...)
int n; int n;
va_list ap; va_list ap;
time2str(rtk->sol.time, tstr, 2); time2str(rtk->sol.time, tstr, 2);
n = sprintf(buff, "%s: ", tstr + 11); n = std::snprintf(buff, sizeof(buff), "%s: ", tstr + 11);
va_start(ap, format); va_start(ap, format);
n += vsprintf(buff + n, format, ap); n += vsprintf(buff + n, format, ap);
va_end(ap); va_end(ap);

View File

@ -64,7 +64,7 @@
/* write solution header to output stream ------------------------------------*/ /* write solution header to output stream ------------------------------------*/
void writesolhead(stream_t *stream, const solopt_t *solopt) void writesolhead(stream_t *stream, const solopt_t *solopt)
{ {
unsigned char buff[1024]; unsigned char buff[MAXSOLMSG];
int n; int n;
n = outsolheads(buff, solopt); n = outsolheads(buff, solopt);
strwrite(stream, buff, n); strwrite(stream, buff, n);
@ -88,7 +88,7 @@ void saveoutbuf(rtksvr_t *svr, unsigned char *buff, int n, int index)
void writesol(rtksvr_t *svr, int index) void writesol(rtksvr_t *svr, int index)
{ {
solopt_t solopt = SOLOPT_DEFAULT; solopt_t solopt = SOLOPT_DEFAULT;
unsigned char buff[1024]; unsigned char buff[MAXSOLMSG];
int i; int i;
int n; int n;
@ -1247,7 +1247,7 @@ void rtksvrsstat(rtksvr_t *svr, int *sstat, char *msg)
sstat[i] = strstat(svr->stream + i, s); sstat[i] = strstat(svr->stream + i, s);
if (*s) if (*s)
{ {
p += sprintf(p, "(%d) %s ", i + 1, s); p += std::snprintf(p, MAXSTRMSG, "(%d) %s ", i + 1, s);
} }
} }
rtksvrunlock(svr); rtksvrunlock(svr);

View File

@ -1411,7 +1411,7 @@ int readsolstatt(char *files[], int nfile, gtime_t ts, gtime_t te,
for (i = 0; i < nfile; i++) for (i = 0; i < nfile; i++)
{ {
sprintf(path, "%s.stat", files[i]); std::snprintf(path, sizeof(path), "%s.stat", files[i]);
if (!(fp = fopen(path, "re"))) if (!(fp = fopen(path, "re")))
{ {
trace(1, "readsolstatt: file open error %s\n", path); trace(1, "readsolstatt: file open error %s\n", path);
@ -1447,7 +1447,7 @@ int outecef(unsigned char *buff, const char *s, const sol_t *sol,
trace(3, "outecef:\n"); trace(3, "outecef:\n");
p += snprintf(p, 255, "%s%s%14.4f%s%14.4f%s%14.4f%s%3d%s%3d%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%6.2f%s%6.1f\n", p += std::snprintf(p, MAXSOLBUF, "%s%s%14.4f%s%14.4f%s%14.4f%s%3d%s%3d%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%6.2f%s%6.1f\n",
s, sep, sol->rr[0], sep, sol->rr[1], sep, sol->rr[2], sep, sol->stat, sep, s, sep, sol->rr[0], sep, sol->rr[1], sep, sol->rr[2], sep, sol->stat, sep,
sol->ns, sep, SQRT_SOL(sol->qr[0]), sep, SQRT_SOL(sol->qr[1]), sep, SQRT_SOL(sol->qr[2]), sol->ns, sep, SQRT_SOL(sol->qr[0]), sep, SQRT_SOL(sol->qr[1]), sep, SQRT_SOL(sol->qr[2]),
sep, sqvar(sol->qr[3]), sep, sqvar(sol->qr[4]), sep, sqvar(sol->qr[5]), sep, sqvar(sol->qr[3]), sep, sqvar(sol->qr[4]), sep, sqvar(sol->qr[5]),
@ -1481,15 +1481,15 @@ int outpos(unsigned char *buff, const char *s, const sol_t *sol,
{ {
deg2dms(pos[0] * R2D, dms1); deg2dms(pos[0] * R2D, dms1);
deg2dms(pos[1] * R2D, dms2); deg2dms(pos[1] * R2D, dms2);
p += sprintf(p, "%s%s%4.0f%s%02.0f%s%08.5f%s%4.0f%s%02.0f%s%08.5f", s, sep, p += std::snprintf(p, MAXSOLMSG, "%s%s%4.0f%s%02.0f%s%08.5f%s%4.0f%s%02.0f%s%08.5f", s, sep,
dms1[0], sep, dms1[1], sep, dms1[2], sep, dms2[0], sep, dms2[1], sep, dms1[0], sep, dms1[1], sep, dms1[2], sep, dms2[0], sep, dms2[1], sep,
dms2[2]); dms2[2]);
} }
else else
{ {
p += sprintf(p, "%s%s%14.9f%s%14.9f", s, sep, pos[0] * R2D, sep, pos[1] * R2D); p += std::snprintf(p, MAXSOLMSG, "%s%s%14.9f%s%14.9f", s, sep, pos[0] * R2D, sep, pos[1] * R2D);
} }
p += sprintf(p, "%s%10.4f%s%3d%s%3d%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%6.2f%s%6.1f\n", p += std::snprintf(p, MAXSOLMSG, "%s%10.4f%s%3d%s%3d%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%6.2f%s%6.1f\n",
sep, pos[2], sep, sol->stat, sep, sol->ns, sep, SQRT_SOL(Q[4]), sep, sep, pos[2], sep, sol->stat, sep, sol->ns, sep, SQRT_SOL(Q[4]), sep,
SQRT_SOL(Q[0]), sep, SQRT_SOL(Q[8]), sep, sqvar(Q[1]), sep, sqvar(Q[2]), SQRT_SOL(Q[0]), sep, SQRT_SOL(Q[8]), sep, sqvar(Q[1]), sep, sqvar(Q[2]),
sep, sqvar(Q[5]), sep, sol->age, sep, sol->ratio); sep, sqvar(Q[5]), sep, sol->age, sep, sol->ratio);
@ -1520,7 +1520,7 @@ int outenu(unsigned char *buff, const char *s, const sol_t *sol,
soltocov(sol, P); soltocov(sol, P);
covenu(pos, P, Q); covenu(pos, P, Q);
ecef2enu(pos, rr, enu); ecef2enu(pos, rr, enu);
p += sprintf(p, "%s%s%14.4f%s%14.4f%s%14.4f%s%3d%s%3d%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%6.2f%s%6.1f\n", p += std::snprintf(p, MAXSOLMSG, "%s%s%14.4f%s%14.4f%s%14.4f%s%3d%s%3d%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%6.2f%s%6.1f\n",
s, sep, enu[0], sep, enu[1], sep, enu[2], sep, sol->stat, sep, sol->ns, sep, s, sep, enu[0], sep, enu[1], sep, enu[2], sep, sol->stat, sep, sol->ns, sep,
SQRT_SOL(Q[0]), sep, SQRT_SOL(Q[4]), sep, SQRT_SOL(Q[8]), sep, sqvar(Q[1]), SQRT_SOL(Q[0]), sep, SQRT_SOL(Q[4]), sep, SQRT_SOL(Q[8]), sep, sqvar(Q[1]),
sep, sqvar(Q[5]), sep, sqvar(Q[2]), sep, sol->age, sep, sol->ratio); sep, sqvar(Q[5]), sep, sqvar(Q[2]), sep, sol->age, sep, sol->ratio);
@ -1550,12 +1550,12 @@ int outnmea_rmc(unsigned char *buff, const sol_t *sol)
if (sol->stat <= SOLQ_NONE) if (sol->stat <= SOLQ_NONE)
{ {
p += sprintf(p, "$GPRMC,,,,,,,,,,,,"); p += std::snprintf(p, MAXSOLBUF, "$GPRMC,,,,,,,,,,,,");
for (q = reinterpret_cast<char *>(buff) + 1, sum = 0; *q; q++) for (q = reinterpret_cast<char *>(buff) + 1, sum = 0; *q; q++)
{ {
sum ^= *q; sum ^= *q;
} }
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A); p += std::snprintf(p, MAXSOLBUF, "*%02X%c%c", sum, 0x0D, 0x0A);
return p - reinterpret_cast<char *>(buff); return p - reinterpret_cast<char *>(buff);
} }
time = gpst2utc(sol->time); time = gpst2utc(sol->time);
@ -1583,7 +1583,7 @@ int outnmea_rmc(unsigned char *buff, const sol_t *sol)
} }
deg2dms(fabs(pos[0]) * R2D, dms1); deg2dms(fabs(pos[0]) * R2D, dms1);
deg2dms(fabs(pos[1]) * R2D, dms2); deg2dms(fabs(pos[1]) * R2D, dms2);
p += sprintf(p, "$GPRMC,%02.0f%02.0f%05.2f,A,%02.0f%010.7f,%s,%03.0f%010.7f,%s,%4.2f,%4.2f,%02.0f%02.0f%02d,%.1f,%s,%s", p += std::snprintf(p, MAXSOLBUF, "$GPRMC,%02.0f%02.0f%05.2f,A,%02.0f%010.7f,%s,%03.0f%010.7f,%s,%4.2f,%4.2f,%02.0f%02.0f%02d,%.1f,%s,%s",
ep[3], ep[4], ep[5], dms1[0], dms1[1] + dms1[2] / 60.0, pos[0] >= 0 ? "N" : "S", ep[3], ep[4], ep[5], dms1[0], dms1[1] + dms1[2] / 60.0, pos[0] >= 0 ? "N" : "S",
dms2[0], dms2[1] + dms2[2] / 60.0, pos[1] >= 0 ? "E" : "W", vel / KNOT2M, dir, dms2[0], dms2[1] + dms2[2] / 60.0, pos[1] >= 0 ? "E" : "W", vel / KNOT2M, dir,
ep[2], ep[1], static_cast<int>(ep[0]) % 100, amag, emag, ep[2], ep[1], static_cast<int>(ep[0]) % 100, amag, emag,
@ -1592,7 +1592,7 @@ int outnmea_rmc(unsigned char *buff, const sol_t *sol)
{ {
sum ^= *q; /* check-sum */ sum ^= *q; /* check-sum */
} }
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A); p += std::snprintf(p, MAXSOLBUF, "*%02X%c%c", sum, 0x0D, 0x0A);
return p - reinterpret_cast<char *>(buff); return p - reinterpret_cast<char *>(buff);
} }
@ -1616,12 +1616,12 @@ int outnmea_gga(unsigned char *buff, const sol_t *sol)
if (sol->stat <= SOLQ_NONE) if (sol->stat <= SOLQ_NONE)
{ {
p += sprintf(p, "$GPGGA,,,,,,,,,,,,,,"); p += std::snprintf(p, MAXSOLBUF, "$GPGGA,,,,,,,,,,,,,,");
for (q = reinterpret_cast<char *>(buff) + 1, sum = 0; *q; q++) for (q = reinterpret_cast<char *>(buff) + 1, sum = 0; *q; q++)
{ {
sum ^= *q; sum ^= *q;
} }
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A); p += std::snprintf(p, MAXSOLBUF, "*%02X%c%c", sum, 0x0D, 0x0A);
return p - reinterpret_cast<char *>(buff); return p - reinterpret_cast<char *>(buff);
} }
for (solq = 0; solq < 8; solq++) for (solq = 0; solq < 8; solq++)
@ -1646,7 +1646,7 @@ int outnmea_gga(unsigned char *buff, const sol_t *sol)
h = 0; // geoidh(pos); h = 0; // geoidh(pos);
deg2dms(fabs(pos[0]) * R2D, dms1); deg2dms(fabs(pos[0]) * R2D, dms1);
deg2dms(fabs(pos[1]) * R2D, dms2); deg2dms(fabs(pos[1]) * R2D, dms2);
p += sprintf(p, "$GPGGA,%02.0f%02.0f%05.2f,%02.0f%010.7f,%s,%03.0f%010.7f,%s,%d,%02d,%.1f,%.3f,M,%.3f,M,%.1f,", p += std::snprintf(p, MAXSOLBUF, "$GPGGA,%02.0f%02.0f%05.2f,%02.0f%010.7f,%s,%03.0f%010.7f,%s,%d,%02d,%.1f,%.3f,M,%.3f,M,%.1f,",
ep[3], ep[4], ep[5], dms1[0], dms1[1] + dms1[2] / 60.0, pos[0] >= 0 ? "N" : "S", ep[3], ep[4], ep[5], dms1[0], dms1[1] + dms1[2] / 60.0, pos[0] >= 0 ? "N" : "S",
dms2[0], dms2[1] + dms2[2] / 60.0, pos[1] >= 0 ? "E" : "W", solq, dms2[0], dms2[1] + dms2[2] / 60.0, pos[1] >= 0 ? "E" : "W", solq,
sol->ns, dop, pos[2] - h, h, sol->age); sol->ns, dop, pos[2] - h, h, sol->age);
@ -1654,7 +1654,7 @@ int outnmea_gga(unsigned char *buff, const sol_t *sol)
{ {
sum ^= *q; /* check-sum */ sum ^= *q; /* check-sum */
} }
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A); p += std::snprintf(p, MAXSOLBUF, "*%02X%c%c", sum, 0x0D, 0x0A);
return p - reinterpret_cast<char *>(buff); return p - reinterpret_cast<char *>(buff);
} }
@ -1679,12 +1679,12 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol,
if (sol->stat <= SOLQ_NONE) if (sol->stat <= SOLQ_NONE)
{ {
p += sprintf(p, "$GPGSA,A,1,,,,,,,,,,,,,,,"); p += std::snprintf(p, MAXSOLBUF, "$GPGSA,A,1,,,,,,,,,,,,,,,");
for (q = reinterpret_cast<char *>(buff) + 1, sum = 0; *q; q++) for (q = reinterpret_cast<char *>(buff) + 1, sum = 0; *q; q++)
{ {
sum ^= *q; sum ^= *q;
} }
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A); p += std::snprintf(p, MAXSOLBUF, "*%02X%c%c", sum, 0x0D, 0x0A);
return p - reinterpret_cast<char *>(buff); return p - reinterpret_cast<char *>(buff);
} }
@ -1713,25 +1713,25 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol,
if (nsat > 0) if (nsat > 0)
{ {
s = p; s = p;
p += sprintf(p, "$GPGSA,A,%d", sol->stat <= 0 ? 1 : 3); p += std::snprintf(p, MAXSOLBUF, "$GPGSA,A,%d", sol->stat <= 0 ? 1 : 3);
for (i = 0; i < 12; i++) for (i = 0; i < 12; i++)
{ {
if (i < nsat) if (i < nsat)
{ {
p += sprintf(p, ",%02d", prn[i]); p += std::snprintf(p, MAXSOLBUF, ",%02d", prn[i]);
} }
else else
{ {
p += sprintf(p, ","); p += std::snprintf(p, MAXSOLBUF, ",");
} }
} }
dops(nsat, azel, 0.0, dop); dops(nsat, azel, 0.0, dop);
p += sprintf(p, ",%3.1f,%3.1f,%3.1f,1", dop[1], dop[2], dop[3]); p += std::snprintf(p, MAXSOLBUF, ",%3.1f,%3.1f,%3.1f,1", dop[1], dop[2], dop[3]);
for (q = s + 1, sum = 0; *q; q++) for (q = s + 1, sum = 0; *q; q++)
{ {
sum ^= *q; /* check-sum */ sum ^= *q; /* check-sum */
} }
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A); p += std::snprintf(p, MAXSOLBUF, "*%02X%c%c", sum, 0x0D, 0x0A);
} }
/* GLGSA: glonass */ /* GLGSA: glonass */
for (sat = 1, nsat = 0; sat <= MAXSAT && nsat < 12; sat++) for (sat = 1, nsat = 0; sat <= MAXSAT && nsat < 12; sat++)
@ -1753,25 +1753,25 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol,
if (nsat > 0) if (nsat > 0)
{ {
s = p; s = p;
p += sprintf(p, "$GLGSA,A,%d", sol->stat <= 0 ? 1 : 3); p += std::snprintf(p, MAXSOLBUF, "$GLGSA,A,%d", sol->stat <= 0 ? 1 : 3);
for (i = 0; i < 12; i++) for (i = 0; i < 12; i++)
{ {
if (i < nsat) if (i < nsat)
{ {
p += sprintf(p, ",%02d", prn[i] + 64); p += std::snprintf(p, MAXSOLBUF, ",%02d", prn[i] + 64);
} }
else else
{ {
p += sprintf(p, ","); p += std::snprintf(p, MAXSOLBUF, ",");
} }
} }
dops(nsat, azel, 0.0, dop); dops(nsat, azel, 0.0, dop);
p += sprintf(p, ",%3.1f,%3.1f,%3.1f,2", dop[1], dop[2], dop[3]); p += std::snprintf(p, MAXSOLBUF, ",%3.1f,%3.1f,%3.1f,2", dop[1], dop[2], dop[3]);
for (q = s + 1, sum = 0; *q; q++) for (q = s + 1, sum = 0; *q; q++)
{ {
sum ^= *q; /* check-sum */ sum ^= *q; /* check-sum */
} }
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A); p += std::snprintf(p, MAXSOLBUF, "*%02X%c%c", sum, 0x0D, 0x0A);
} }
/* GAGSA: galileo */ /* GAGSA: galileo */
for (sat = 1, nsat = 0; sat <= MAXSAT && nsat < 12; sat++) for (sat = 1, nsat = 0; sat <= MAXSAT && nsat < 12; sat++)
@ -1793,25 +1793,25 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol,
if (nsat > 0) if (nsat > 0)
{ {
s = p; s = p;
p += sprintf(p, "$GAGSA,A,%d", sol->stat <= 0 ? 1 : 3); p += std::snprintf(p, MAXSOLBUF, "$GAGSA,A,%d", sol->stat <= 0 ? 1 : 3);
for (i = 0; i < 12; i++) for (i = 0; i < 12; i++)
{ {
if (i < nsat) if (i < nsat)
{ {
p += sprintf(p, ",%02d", prn[i]); p += std::snprintf(p, MAXSOLBUF, ",%02d", prn[i]);
} }
else else
{ {
p += sprintf(p, ","); p += std::snprintf(p, MAXSOLBUF, ",");
} }
} }
dops(nsat, azel, 0.0, dop); dops(nsat, azel, 0.0, dop);
p += sprintf(p, ",%3.1f,%3.1f,%3.1f,3", dop[1], dop[2], dop[3]); p += std::snprintf(p, MAXSOLBUF, ",%3.1f,%3.1f,%3.1f,3", dop[1], dop[2], dop[3]);
for (q = s + 1, sum = 0; *q; q++) for (q = s + 1, sum = 0; *q; q++)
{ {
sum ^= *q; /* check-sum */ sum ^= *q; /* check-sum */
} }
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A); p += std::snprintf(p, MAXSOLBUF, "*%02X%c%c", sum, 0x0D, 0x0A);
} }
return p - reinterpret_cast<char *>(buff); return p - reinterpret_cast<char *>(buff);
} }
@ -1842,12 +1842,12 @@ int outnmea_gsv(unsigned char *buff, const sol_t *sol,
if (sol->stat <= SOLQ_NONE) if (sol->stat <= SOLQ_NONE)
{ {
p += sprintf(p, "$GPGSV,1,1,0,,,,,,,,,,,,,,,,"); p += std::snprintf(p, MAXSOLBUF, "$GPGSV,1,1,0,,,,,,,,,,,,,,,,");
for (q = reinterpret_cast<char *>(buff) + 1, sum = 0; *q; q++) for (q = reinterpret_cast<char *>(buff) + 1, sum = 0; *q; q++)
{ {
sum ^= *q; sum ^= *q;
} }
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A); p += std::snprintf(p, MAXSOLBUF, "*%02X%c%c", sum, 0x0D, 0x0A);
return p - reinterpret_cast<char *>(buff); return p - reinterpret_cast<char *>(buff);
} }
/* GPGSV: gps/sbas */ /* GPGSV: gps/sbas */
@ -1868,7 +1868,7 @@ int outnmea_gsv(unsigned char *buff, const sol_t *sol,
for (i = k = 0; i < nmsg; i++) for (i = k = 0; i < nmsg; i++)
{ {
s = p; s = p;
p += sprintf(p, "$GPGSV,%d,%d,%02d", nmsg, i + 1, n); p += std::snprintf(p, MAXSOLBUF, "$GPGSV,%d,%d,%02d", nmsg, i + 1, n);
for (j = 0; j < 4; j++, k++) for (j = 0; j < 4; j++, k++)
{ {
@ -1885,19 +1885,19 @@ int outnmea_gsv(unsigned char *buff, const sol_t *sol,
} }
el = ssat[sats[k] - 1].azel[1] * R2D; el = ssat[sats[k] - 1].azel[1] * R2D;
snr = ssat[sats[k] - 1].snr[0] * 0.25; snr = ssat[sats[k] - 1].snr[0] * 0.25;
p += sprintf(p, ",%02d,%02.0f,%03.0f,%02.0f", prn, el, az, snr); p += std::snprintf(p, MAXSOLBUF, ",%02d,%02.0f,%03.0f,%02.0f", prn, el, az, snr);
} }
else else
{ {
p += sprintf(p, ",,,,"); p += std::snprintf(p, MAXSOLBUF, ",,,,");
} }
} }
p += sprintf(p, ",1"); /* L1C/A */ p += std::snprintf(p, MAXSOLBUF, ",1"); /* L1C/A */
for (q = s + 1, sum = 0; *q; q++) for (q = s + 1, sum = 0; *q; q++)
{ {
sum ^= *q; /* check-sum */ sum ^= *q; /* check-sum */
} }
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A); p += std::snprintf(p, MAXSOLBUF, "*%02X%c%c", sum, 0x0D, 0x0A);
} }
/* GLGSV: glonass */ /* GLGSV: glonass */
for (sat = 1, n = 0; sat < MAXSAT && n < 12; sat++) for (sat = 1, n = 0; sat < MAXSAT && n < 12; sat++)
@ -1916,7 +1916,7 @@ int outnmea_gsv(unsigned char *buff, const sol_t *sol,
for (i = k = 0; i < nmsg; i++) for (i = k = 0; i < nmsg; i++)
{ {
s = p; s = p;
p += sprintf(p, "$GLGSV,%d,%d,%02d", nmsg, i + 1, n); p += std::snprintf(p, MAXSOLBUF, "$GLGSV,%d,%d,%02d", nmsg, i + 1, n);
for (j = 0; j < 4; j++, k++) for (j = 0; j < 4; j++, k++)
{ {
@ -1931,19 +1931,19 @@ int outnmea_gsv(unsigned char *buff, const sol_t *sol,
} }
el = ssat[sats[k] - 1].azel[1] * R2D; el = ssat[sats[k] - 1].azel[1] * R2D;
snr = ssat[sats[k] - 1].snr[0] * 0.25; snr = ssat[sats[k] - 1].snr[0] * 0.25;
p += sprintf(p, ",%02d,%02.0f,%03.0f,%02.0f", prn, el, az, snr); p += std::snprintf(p, MAXSOLBUF, ",%02d,%02.0f,%03.0f,%02.0f", prn, el, az, snr);
} }
else else
{ {
p += sprintf(p, ",,,,"); p += std::snprintf(p, MAXSOLBUF, ",,,,");
} }
} }
p += sprintf(p, ",1"); /* L1C/A */ p += std::snprintf(p, MAXSOLBUF, ",1"); /* L1C/A */
for (q = s + 1, sum = 0; *q; q++) for (q = s + 1, sum = 0; *q; q++)
{ {
sum ^= *q; /* check-sum */ sum ^= *q; /* check-sum */
} }
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A); p += std::snprintf(p, MAXSOLBUF, "*%02X%c%c", sum, 0x0D, 0x0A);
} }
/* GAGSV: galileo */ /* GAGSV: galileo */
for (sat = 1, n = 0; sat < MAXSAT && n < 12; sat++) for (sat = 1, n = 0; sat < MAXSAT && n < 12; sat++)
@ -1962,7 +1962,7 @@ int outnmea_gsv(unsigned char *buff, const sol_t *sol,
for (i = k = 0; i < nmsg; i++) for (i = k = 0; i < nmsg; i++)
{ {
s = p; s = p;
p += sprintf(p, "$GAGSV,%d,%d,%02d", nmsg, i + 1, n); p += std::snprintf(p, MAXSOLBUF, "$GAGSV,%d,%d,%02d", nmsg, i + 1, n);
for (j = 0; j < 4; j++, k++) for (j = 0; j < 4; j++, k++)
{ {
@ -1976,19 +1976,19 @@ int outnmea_gsv(unsigned char *buff, const sol_t *sol,
} }
el = ssat[sats[k] - 1].azel[1] * R2D; el = ssat[sats[k] - 1].azel[1] * R2D;
snr = ssat[sats[k] - 1].snr[0] * 0.25; snr = ssat[sats[k] - 1].snr[0] * 0.25;
p += sprintf(p, ",%02d,%02.0f,%03.0f,%02.0f", prn, el, az, snr); p += std::snprintf(p, MAXSOLBUF, ",%02d,%02.0f,%03.0f,%02.0f", prn, el, az, snr);
} }
else else
{ {
p += sprintf(p, ",,,,"); p += std::snprintf(p, MAXSOLBUF, ",,,,");
} }
} }
p += sprintf(p, ",7"); /* L1BC */ p += std::snprintf(p, MAXSOLBUF, ",7"); /* L1BC */
for (q = s + 1, sum = 0; *q; q++) for (q = s + 1, sum = 0; *q; q++)
{ {
sum ^= *q; /* check-sum */ sum ^= *q; /* check-sum */
} }
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A); p += std::snprintf(p, MAXSOLBUF, "*%02X%c%c", sum, 0x0D, 0x0A);
} }
return p - reinterpret_cast<char *>(buff); return p - reinterpret_cast<char *>(buff);
} }
@ -2021,55 +2021,55 @@ int outprcopts(unsigned char *buff, const prcopt_t *opt)
trace(3, "outprcopts:\n"); trace(3, "outprcopts:\n");
p += sprintf(p, "%s pos mode : %s\n", COMMENTH, s1[opt->mode]); p += std::snprintf(p, MAXSOLMSG, "%s pos mode : %s\n", COMMENTH, s1[opt->mode]);
if (PMODE_DGPS <= opt->mode && opt->mode <= PMODE_FIXED) if (PMODE_DGPS <= opt->mode && opt->mode <= PMODE_FIXED)
{ {
p += sprintf(p, "%s freqs : %s\n", COMMENTH, s2[opt->nf - 1]); p += std::snprintf(p, MAXSOLMSG, "%s freqs : %s\n", COMMENTH, s2[opt->nf - 1]);
} }
if (opt->mode > PMODE_SINGLE) if (opt->mode > PMODE_SINGLE)
{ {
p += sprintf(p, "%s solution : %s\n", COMMENTH, s3[opt->soltype]); p += std::snprintf(p, MAXSOLMSG, "%s solution : %s\n", COMMENTH, s3[opt->soltype]);
} }
p += sprintf(p, "%s elev mask : %.1f deg\n", COMMENTH, opt->elmin * R2D); p += std::snprintf(p, MAXSOLMSG, "%s elev mask : %.1f deg\n", COMMENTH, opt->elmin * R2D);
if (opt->mode > PMODE_SINGLE) if (opt->mode > PMODE_SINGLE)
{ {
p += sprintf(p, "%s dynamics : %s\n", COMMENTH, opt->dynamics ? "on" : "off"); p += std::snprintf(p, MAXSOLMSG, "%s dynamics : %s\n", COMMENTH, opt->dynamics ? "on" : "off");
p += sprintf(p, "%s tidecorr : %s\n", COMMENTH, opt->tidecorr ? "on" : "off"); p += std::snprintf(p, MAXSOLMSG, "%s tidecorr : %s\n", COMMENTH, opt->tidecorr ? "on" : "off");
} }
if (opt->mode <= PMODE_FIXED) if (opt->mode <= PMODE_FIXED)
{ {
p += sprintf(p, "%s ionos opt : %s\n", COMMENTH, s4[opt->ionoopt]); p += std::snprintf(p, MAXSOLMSG, "%s ionos opt : %s\n", COMMENTH, s4[opt->ionoopt]);
} }
p += sprintf(p, "%s tropo opt : %s\n", COMMENTH, s5[opt->tropopt]); p += std::snprintf(p, MAXSOLMSG, "%s tropo opt : %s\n", COMMENTH, s5[opt->tropopt]);
p += sprintf(p, "%s ephemeris : %s\n", COMMENTH, s6[opt->sateph]); p += std::snprintf(p, MAXSOLMSG, "%s ephemeris : %s\n", COMMENTH, s6[opt->sateph]);
if (opt->navsys != SYS_GPS) if (opt->navsys != SYS_GPS)
{ {
p += sprintf(p, "%s navi sys :", COMMENTH); p += std::snprintf(p, MAXSOLMSG, "%s navi sys :", COMMENTH);
for (i = 0; sys[i]; i++) for (i = 0; sys[i]; i++)
{ {
if (opt->navsys & sys[i]) if (opt->navsys & sys[i])
{ {
p += sprintf(p, " %s", s7[i]); p += std::snprintf(p, MAXSOLMSG, " %s", s7[i]);
} }
} }
p += sprintf(p, "\n"); p += std::snprintf(p, MAXSOLMSG, "\n");
} }
if (PMODE_KINEMA <= opt->mode && opt->mode <= PMODE_FIXED) if (PMODE_KINEMA <= opt->mode && opt->mode <= PMODE_FIXED)
{ {
p += sprintf(p, "%s amb res : %s\n", COMMENTH, s8[opt->modear]); p += std::snprintf(p, MAXSOLMSG, "%s amb res : %s\n", COMMENTH, s8[opt->modear]);
if (opt->navsys & SYS_GLO) if (opt->navsys & SYS_GLO)
{ {
p += sprintf(p, "%s amb glo : %s\n", COMMENTH, s9[opt->glomodear]); p += std::snprintf(p, MAXSOLMSG, "%s amb glo : %s\n", COMMENTH, s9[opt->glomodear]);
} }
if (opt->thresar[0] > 0.0) if (opt->thresar[0] > 0.0)
{ {
p += sprintf(p, "%s val thres : %.1f\n", COMMENTH, opt->thresar[0]); p += std::snprintf(p, MAXSOLMSG, "%s val thres : %.1f\n", COMMENTH, opt->thresar[0]);
} }
} }
if (opt->mode == PMODE_MOVEB && opt->baseline[0] > 0.0) if (opt->mode == PMODE_MOVEB && opt->baseline[0] > 0.0)
{ {
p += sprintf(p, "%s baseline : %.4f %.4f m\n", COMMENTH, p += std::snprintf(p, MAXSOLMSG, "%s baseline : %.4f %.4f m\n", COMMENTH,
opt->baseline[0], opt->baseline[1]); opt->baseline[0], opt->baseline[1]);
} }
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
@ -2078,7 +2078,7 @@ int outprcopts(unsigned char *buff, const prcopt_t *opt)
{ {
continue; continue;
} }
p += sprintf(p, "%s antenna%d : %-21s (%7.4f %7.4f %7.4f)\n", COMMENTH, p += std::snprintf(p, MAXSOLMSG, "%s antenna%d : %-21s (%7.4f %7.4f %7.4f)\n", COMMENTH,
i + 1, opt->anttype[i], opt->antdel[i][0], opt->antdel[i][1], i + 1, opt->anttype[i], opt->antdel[i][0], opt->antdel[i][1],
opt->antdel[i][2]); opt->antdel[i][2]);
} }
@ -2110,35 +2110,35 @@ int outsolheads(unsigned char *buff, const solopt_t *opt)
if (opt->outhead) if (opt->outhead)
{ {
p += sprintf(p, "%s (", COMMENTH); p += std::snprintf(p, MAXSOLMSG, "%s (", COMMENTH);
if (opt->posf == SOLF_XYZ) if (opt->posf == SOLF_XYZ)
{ {
p += sprintf(p, "x/y/z-ecef=WGS84"); p += std::snprintf(p, MAXSOLMSG, "x/y/z-ecef=WGS84");
} }
else if (opt->posf == SOLF_ENU) else if (opt->posf == SOLF_ENU)
{ {
p += sprintf(p, "e/n/u-baseline=WGS84"); p += std::snprintf(p, MAXSOLMSG, "e/n/u-baseline=WGS84");
} }
else else
{ {
p += sprintf(p, "lat/lon/height=%s/%s", s1[opt->datum], s2[opt->height]); p += std::snprintf(p, MAXSOLMSG, "lat/lon/height=%s/%s", s1[opt->datum], s2[opt->height]);
} }
p += sprintf(p, ",Q=1:fix,2:float,3:sbas,4:dgps,5:single,6:ppp,ns=# of satellites)\n"); p += std::snprintf(p, MAXSOLMSG, ",Q=1:fix,2:float,3:sbas,4:dgps,5:single,6:ppp,ns=# of satellites)\n");
} }
p += sprintf(p, "%s %-*s%s", COMMENTH, (opt->timef ? 16 : 8) + timeu + 1, s3[opt->times], sep); p += std::snprintf(p, MAXSOLMSG, "%s %-*s%s", COMMENTH, (opt->timef ? 16 : 8) + timeu + 1, s3[opt->times], sep);
if (opt->posf == SOLF_LLH) if (opt->posf == SOLF_LLH)
{ /* lat/lon/hgt */ { /* lat/lon/hgt */
if (opt->degf) if (opt->degf)
{ {
p += sprintf(p, "%16s%s%16s%s%10s%s%3s%s%3s%s%8s%s%8s%s%8s%s%8s%s%8s%s%8s%s%6s%s%6s\n", p += std::snprintf(p, MAXSOLMSG, "%16s%s%16s%s%10s%s%3s%s%3s%s%8s%s%8s%s%8s%s%8s%s%8s%s%8s%s%6s%s%6s\n",
"latitude(d'\")", sep, "longitude(d'\")", sep, "height(m)", sep, "latitude(d'\")", sep, "longitude(d'\")", sep, "height(m)", sep,
"Q", sep, "ns", sep, "sdn(m)", sep, "sde(m)", sep, "sdu(m)", sep, "Q", sep, "ns", sep, "sdn(m)", sep, "sde(m)", sep, "sdu(m)", sep,
"sdne(m)", sep, "sdeu(m)", sep, "sdue(m)", sep, "age(s)", sep, "ratio"); "sdne(m)", sep, "sdeu(m)", sep, "sdue(m)", sep, "age(s)", sep, "ratio");
} }
else else
{ {
p += sprintf(p, "%14s%s%14s%s%10s%s%3s%s%3s%s%8s%s%8s%s%8s%s%8s%s%8s%s%8s%s%6s%s%6s\n", p += std::snprintf(p, MAXSOLMSG, "%14s%s%14s%s%10s%s%3s%s%3s%s%8s%s%8s%s%8s%s%8s%s%8s%s%8s%s%6s%s%6s\n",
"latitude(deg)", sep, "longitude(deg)", sep, "height(m)", sep, "latitude(deg)", sep, "longitude(deg)", sep, "height(m)", sep,
"Q", sep, "ns", sep, "sdn(m)", sep, "sde(m)", sep, "sdu(m)", sep, "Q", sep, "ns", sep, "sdn(m)", sep, "sde(m)", sep, "sdu(m)", sep,
"sdne(m)", sep, "sdeu(m)", sep, "sdun(m)", sep, "age(s)", sep, "ratio"); "sdne(m)", sep, "sdeu(m)", sep, "sdun(m)", sep, "age(s)", sep, "ratio");
@ -2146,14 +2146,14 @@ int outsolheads(unsigned char *buff, const solopt_t *opt)
} }
else if (opt->posf == SOLF_XYZ) else if (opt->posf == SOLF_XYZ)
{ /* x/y/z-ecef */ { /* x/y/z-ecef */
p += sprintf(p, "%14s%s%14s%s%14s%s%3s%s%3s%s%8s%s%8s%s%8s%s%8s%s%8s%s%8s%s%6s%s%6s\n", p += std::snprintf(p, MAXSOLMSG, "%14s%s%14s%s%14s%s%3s%s%3s%s%8s%s%8s%s%8s%s%8s%s%8s%s%8s%s%6s%s%6s\n",
"x-ecef(m)", sep, "y-ecef(m)", sep, "z-ecef(m)", sep, "Q", sep, "ns", sep, "x-ecef(m)", sep, "y-ecef(m)", sep, "z-ecef(m)", sep, "Q", sep, "ns", sep,
"sdx(m)", sep, "sdy(m)", sep, "sdz(m)", sep, "sdxy(m)", sep, "sdx(m)", sep, "sdy(m)", sep, "sdz(m)", sep, "sdxy(m)", sep,
"sdyz(m)", sep, "sdzx(m)", sep, "age(s)", sep, "ratio"); "sdyz(m)", sep, "sdzx(m)", sep, "age(s)", sep, "ratio");
} }
else if (opt->posf == SOLF_ENU) else if (opt->posf == SOLF_ENU)
{ /* e/n/u-baseline */ { /* e/n/u-baseline */
p += sprintf(p, "%14s%s%14s%s%14s%s%3s%s%3s%s%8s%s%8s%s%8s%s%8s%s%8s%s%8s%s%6s%s%6s\n", p += std::snprintf(p, MAXSOLMSG, "%14s%s%14s%s%14s%s%3s%s%3s%s%8s%s%8s%s%8s%s%8s%s%8s%s%8s%s%6s%s%6s\n",
"e-baseline(m)", sep, "n-baseline(m)", sep, "u-baseline(m)", sep, "e-baseline(m)", sep, "n-baseline(m)", sep, "u-baseline(m)", sep,
"Q", sep, "ns", sep, "sde(m)", sep, "sdn(m)", sep, "sdu(m)", sep, "Q", sep, "ns", sep, "sde(m)", sep, "sdn(m)", sep, "sdu(m)", sep,
"sden(m)", sep, "sdnu(m)", sep, "sdue(m)", sep, "age(s)", sep, "ratio"); "sden(m)", sep, "sdnu(m)", sep, "sdue(m)", sep, "age(s)", sep, "ratio");
@ -2223,7 +2223,7 @@ int outsols(unsigned char *buff, const sol_t *sol, const double *rb,
week++; week++;
gpst = 0.0; gpst = 0.0;
} }
snprintf(s, 255, "%4d%s%*.*f", week, sep, 6 + (timeu <= 0 ? 0 : timeu + 1), timeu, gpst); std::snprintf(s, sizeof(s), "%4d%s%*.*f", week, sep, 6 + (timeu <= 0 ? 0 : timeu + 1), timeu, gpst);
} }
switch (opt->posf) switch (opt->posf)
{ {

View File

@ -131,14 +131,13 @@ serial_t *openserial(const char *path, int mode, char *msg)
} }
if (i >= 11) if (i >= 11)
{ {
sprintf(msg, "bitrate error (%d)", brate); std::snprintf(msg, MAXSTRMSG, "bitrate error (%d)", brate);
tracet(1, "openserial: %s path=%s\n", msg, path); tracet(1, "openserial: %s path=%s\n", msg, path);
free(serial); free(serial);
return nullptr; return nullptr;
} }
parity = static_cast<char>(toupper(static_cast<int>(parity))); parity = static_cast<char>(toupper(static_cast<int>(parity)));
// sprintf(dev, "/dev/%s", port); This line triggers a warning. Replaced by:
std::string s_aux = "/dev/" + std::string(port); std::string s_aux = "/dev/" + std::string(port);
s_aux.resize(128, '\0'); s_aux.resize(128, '\0');
int n = s_aux.length(); int n = s_aux.length();
@ -166,7 +165,7 @@ serial_t *openserial(const char *path, int mode, char *msg)
if ((serial->dev = open(dev, rw | O_NOCTTY | O_NONBLOCK)) < 0) if ((serial->dev = open(dev, rw | O_NOCTTY | O_NONBLOCK)) < 0)
{ {
sprintf(msg, "device open error (%d)", errno); std::snprintf(msg, MAXSTRMSG, "device open error (%d)", errno);
tracet(1, "openserial: %s dev=%s\n", msg, dev); tracet(1, "openserial: %s dev=%s\n", msg, dev);
free(serial); free(serial);
return nullptr; return nullptr;
@ -284,19 +283,19 @@ int openfile_(file_t *file, gtime_t time, char *msg)
if (!(file->fp = fopen(file->openpath, rw))) if (!(file->fp = fopen(file->openpath, rw)))
{ {
sprintf(msg, "file open error: %s", file->openpath); std::snprintf(msg, MAXSTRMSG, "file open error");
tracet(1, "openfile: %s\n", msg); tracet(1, "openfile: %s\n", msg);
return 0; return 0;
} }
tracet(4, "openfile_: open file %s (%s)\n", file->openpath, rw); tracet(4, "openfile_: open file %s (%s)\n", file->openpath, rw);
sprintf(tagpath, "%s.tag", file->openpath); std::snprintf(tagpath, MAXSTRPATH + 4, "%s.tag", file->openpath);
if (file->timetag) if (file->timetag)
{ /* output/sync time-tag */ { /* output/sync time-tag */
if (!(file->fp_tag = fopen(tagpath, rw))) if (!(file->fp_tag = fopen(tagpath, rw)))
{ {
sprintf(msg, "tag open error: %s", tagpath); std::snprintf(msg, MAXSTRMSG, "tag open error");
tracet(1, "openfile: %s\n", msg); tracet(1, "openfile: %s\n", msg);
fclose(file->fp); fclose(file->fp);
return 0; return 0;
@ -319,7 +318,7 @@ int openfile_(file_t *file, gtime_t time, char *msg)
} }
else else
{ {
sprintf(tagh, "TIMETAG RTKLIB %s", VER_RTKLIB); std::snprintf(tagh, TIMETAGH_LEN + 1, "TIMETAG RTKLIB %s", VER_RTKLIB);
memcpy(tagh + TIMETAGH_LEN - 4, &file->tick_f, sizeof(file->tick_f)); memcpy(tagh + TIMETAGH_LEN - 4, &file->tick_f, sizeof(file->tick_f));
fwrite(&tagh, 1, TIMETAGH_LEN, file->fp_tag); fwrite(&tagh, 1, TIMETAGH_LEN, file->fp_tag);
fwrite(&file->time, 1, sizeof(file->time), file->fp_tag); fwrite(&file->time, 1, sizeof(file->time), file->fp_tag);
@ -571,7 +570,7 @@ int readfile(file_t *file, unsigned char *buff, int nmax, char *msg)
{ {
trace(1, "fseek error"); trace(1, "fseek error");
} }
sprintf(msg, "end"); std::snprintf(msg, MAXSTRPATH, "end");
break; break;
} }
if (file->repmode || file->speed > 0.0) if (file->repmode || file->speed > 0.0)
@ -586,7 +585,7 @@ int readfile(file_t *file, unsigned char *buff, int nmax, char *msg)
tick_master = tick; tick_master = tick;
} }
sprintf(msg, "T%+.1fs", static_cast<int>(tick) < 0 ? 0.0 : static_cast<int>(tick) / 1000.0); std::snprintf(msg, MAXSTRPATH, "T%+.1fs", static_cast<int>(tick) < 0 ? 0.0 : static_cast<int>(tick) / 1000.0);
if (static_cast<int>(fpos - file->fpos) >= nmax) if (static_cast<int>(fpos - file->fpos) >= nmax)
{ {
@ -615,7 +614,7 @@ int readfile(file_t *file, unsigned char *buff, int nmax, char *msg)
file->fpos += nr; file->fpos += nr;
if (nr <= 0) if (nr <= 0)
{ {
sprintf(msg, "end"); std::snprintf(msg, MAXSTRPATH, "end");
} }
} }
tracet(5, "readfile: fp=%p \n nr=%d fpos=%u\n", file->fp, nr, file->fpos); tracet(5, "readfile: fp=%p \n nr=%d fpos=%u\n", file->fp, nr, file->fpos);
@ -829,7 +828,7 @@ int setsock(socket_t sock, char *msg)
if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, reinterpret_cast<const char *>(&tv), sizeof(tv)) == -1 || if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, reinterpret_cast<const char *>(&tv), sizeof(tv)) == -1 ||
setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, reinterpret_cast<const char *>(&tv), sizeof(tv)) == -1) setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, reinterpret_cast<const char *>(&tv), sizeof(tv)) == -1)
{ {
sprintf(msg, "sockopt error: notimeo"); std::snprintf(msg, MAXSTRMSG, "sockopt error: notimeo");
tracet(1, "setsock: setsockopt error 1 sock=%d err=%d\n", sock, errsock()); tracet(1, "setsock: setsockopt error 1 sock=%d err=%d\n", sock, errsock());
closesocket(sock); closesocket(sock);
return 0; return 0;
@ -838,12 +837,12 @@ int setsock(socket_t sock, char *msg)
setsockopt(sock, SOL_SOCKET, SO_SNDBUF, reinterpret_cast<const char *>(&bs), sizeof(bs)) == -1) setsockopt(sock, SOL_SOCKET, SO_SNDBUF, reinterpret_cast<const char *>(&bs), sizeof(bs)) == -1)
{ {
tracet(1, "setsock: setsockopt error 2 sock=%d err=%d bs=%d\n", sock, errsock(), bs); tracet(1, "setsock: setsockopt error 2 sock=%d err=%d bs=%d\n", sock, errsock(), bs);
sprintf(msg, "sockopt error: bufsiz"); std::snprintf(msg, MAXSTRMSG, "sockopt error: bufsiz");
} }
if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<const char *>(&mode), sizeof(mode)) == -1) if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<const char *>(&mode), sizeof(mode)) == -1)
{ {
tracet(1, "setsock: setsockopt error 3 sock=%d err=%d\n", sock, errsock()); tracet(1, "setsock: setsockopt error 3 sock=%d err=%d\n", sock, errsock());
sprintf(msg, "sockopt error: nodelay"); std::snprintf(msg, MAXSTRMSG, "sockopt error: nodelay");
} }
return 1; return 1;
} }
@ -940,7 +939,7 @@ int gentcp(tcp_t *tcp, int type, char *msg)
/* generate socket */ /* generate socket */
if ((tcp->sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) if ((tcp->sock = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{ {
sprintf(msg, "socket error (%d)", errsock()); std::snprintf(msg, MAXSTRMSG, "socket error (%d)", errsock());
tracet(1, "gentcp: socket error err=%d\n", errsock()); tracet(1, "gentcp: socket error err=%d\n", errsock());
tcp->state = -1; tcp->state = -1;
return 0; return 0;
@ -963,7 +962,7 @@ int gentcp(tcp_t *tcp, int type, char *msg)
#endif #endif
if (bind(tcp->sock, reinterpret_cast<struct sockaddr *>(&tcp->addr), sizeof(tcp->addr)) == -1) if (bind(tcp->sock, reinterpret_cast<struct sockaddr *>(&tcp->addr), sizeof(tcp->addr)) == -1)
{ {
sprintf(msg, "bind error (%d) : %d", errsock(), tcp->port); std::snprintf(msg, MAXSTRMSG, "bind error (%d) : %d", errsock(), tcp->port);
tracet(1, "gentcp: bind error port=%d err=%d\n", tcp->port, errsock()); tracet(1, "gentcp: bind error port=%d err=%d\n", tcp->port, errsock());
closesocket(tcp->sock); closesocket(tcp->sock);
tcp->state = -1; tcp->state = -1;
@ -975,7 +974,7 @@ int gentcp(tcp_t *tcp, int type, char *msg)
{ /* client socket */ { /* client socket */
if (!(hp = gethostbyname(tcp->saddr))) if (!(hp = gethostbyname(tcp->saddr)))
{ {
sprintf(msg, "address error (%s)", tcp->saddr); std::snprintf(msg, MAXSTRMSG, "address error (%s)", tcp->saddr);
tracet(1, "gentcp: gethostbyname error addr=%s err=%d\n", tcp->saddr, errsock()); tracet(1, "gentcp: gethostbyname error addr=%s err=%d\n", tcp->saddr, errsock());
closesocket(tcp->sock); closesocket(tcp->sock);
tcp->state = 0; tcp->state = 0;
@ -1019,7 +1018,7 @@ tcpsvr_t *opentcpsvr(const char *path, char *msg)
decodetcppath(path, tcpsvr->svr.saddr, port, nullptr, nullptr, nullptr, nullptr); decodetcppath(path, tcpsvr->svr.saddr, port, nullptr, nullptr, nullptr, nullptr);
if (sscanf(port, "%d", &tcpsvr->svr.port) < 1) if (sscanf(port, "%d", &tcpsvr->svr.port) < 1)
{ {
sprintf(msg, "port error: %s", port); std::snprintf(msg, MAXSTRMSG, "port error: %s", port);
tracet(1, "opentcpsvr: port error port=%s\n", port); tracet(1, "opentcpsvr: port error port=%s\n", port);
free(tcpsvr); free(tcpsvr);
return nullptr; return nullptr;
@ -1096,17 +1095,17 @@ void updatetcpsvr(tcpsvr_t *tcpsvr, char *msg)
if (n == 0) if (n == 0)
{ {
tcpsvr->svr.state = 1; tcpsvr->svr.state = 1;
sprintf(msg, "waiting..."); std::snprintf(msg, MAXSTRMSG, "waiting...");
return; return;
} }
tcpsvr->svr.state = 2; tcpsvr->svr.state = 2;
if (n == 1) if (n == 1)
{ {
sprintf(msg, "%s", saddr); std::snprintf(msg, MAXSTRMSG, "%s", saddr);
} }
else else
{ {
sprintf(msg, "%d clients", n); std::snprintf(msg, MAXSTRMSG, "%d clients", n);
} }
} }
@ -1139,7 +1138,7 @@ int accsock(tcpsvr_t *tcpsvr, char *msg)
if ((sock = accept_nb(tcpsvr->svr.sock, reinterpret_cast<struct sockaddr *>(&addr), &len)) == -1) if ((sock = accept_nb(tcpsvr->svr.sock, reinterpret_cast<struct sockaddr *>(&addr), &len)) == -1)
{ {
err = errsock(); err = errsock();
sprintf(msg, "accept error (%d)", err); std::snprintf(msg, MAXSTRMSG, "accept error (%d)", err);
tracet(1, "accsock: accept error sock=%d err=%d\n", tcpsvr->svr.sock, err); tracet(1, "accsock: accept error sock=%d err=%d\n", tcpsvr->svr.sock, err);
closesocket(tcpsvr->svr.sock); closesocket(tcpsvr->svr.sock);
tcpsvr->svr.state = 0; tcpsvr->svr.state = 0;
@ -1161,7 +1160,7 @@ int accsock(tcpsvr_t *tcpsvr, char *msg)
std::strncpy(tcpsvr->cli[i].saddr, inet_ntoa(addr.sin_addr), 256); std::strncpy(tcpsvr->cli[i].saddr, inet_ntoa(addr.sin_addr), 256);
tcpsvr->cli[i].saddr[255] = '\0'; tcpsvr->cli[i].saddr[255] = '\0';
} }
sprintf(msg, "%s", tcpsvr->cli[i].saddr); std::snprintf(msg, MAXSTRMSG, "%s", tcpsvr->cli[i].saddr);
tracet(2, "accsock: connected sock=%d addr=%s\n", tcpsvr->cli[i].sock, tcpsvr->cli[i].saddr); tracet(2, "accsock: connected sock=%d addr=%s\n", tcpsvr->cli[i].sock, tcpsvr->cli[i].saddr);
tcpsvr->cli[i].state = 2; tcpsvr->cli[i].state = 2;
tcpsvr->cli[i].tact = tickget(); tcpsvr->cli[i].tact = tickget();
@ -1203,7 +1202,7 @@ int readtcpsvr(tcpsvr_t *tcpsvr, unsigned char *buff, int n, char *msg)
{ {
err = errsock(); err = errsock();
tracet(1, "readtcpsvr: recv error sock=%d err=%d\n", tcpsvr->cli[0].sock, err); tracet(1, "readtcpsvr: recv error sock=%d err=%d\n", tcpsvr->cli[0].sock, err);
sprintf(msg, "recv error (%d)", err); std::snprintf(msg, MAXSTRMSG, "recv error (%d)", err);
discontcp(&tcpsvr->cli[0], ticonnect); discontcp(&tcpsvr->cli[0], ticonnect);
updatetcpsvr(tcpsvr, msg); updatetcpsvr(tcpsvr, msg);
return 0; return 0;
@ -1242,7 +1241,7 @@ int writetcpsvr(tcpsvr_t *tcpsvr, unsigned char *buff, int n, char *msg)
{ {
err = errsock(); err = errsock();
tracet(1, "writetcpsvr: send error i=%d sock=%d err=%d\n", i, tcpsvr->cli[i].sock, err); tracet(1, "writetcpsvr: send error i=%d sock=%d err=%d\n", i, tcpsvr->cli[i].sock, err);
sprintf(msg, "send error (%d)", err); std::snprintf(msg, MAXSTRMSG, "send error (%d)", err);
discontcp(&tcpsvr->cli[i], ticonnect); discontcp(&tcpsvr->cli[i], ticonnect);
updatetcpsvr(tcpsvr, msg); updatetcpsvr(tcpsvr, msg);
return 0; return 0;
@ -1283,7 +1282,7 @@ int consock(tcpcli_t *tcpcli, char *msg)
sizeof(tcpcli->svr.addr))) == -1) sizeof(tcpcli->svr.addr))) == -1)
{ {
err = errsock(); err = errsock();
sprintf(msg, "connect error (%d)", err); std::snprintf(msg, MAXSTRMSG, "connect error (%d)", err);
tracet(1, "consock: connect error sock=%d err=%d\n", tcpcli->svr.sock, err); tracet(1, "consock: connect error sock=%d err=%d\n", tcpcli->svr.sock, err);
closesocket(tcpcli->svr.sock); closesocket(tcpcli->svr.sock);
tcpcli->svr.state = 0; tcpcli->svr.state = 0;
@ -1291,10 +1290,10 @@ int consock(tcpcli_t *tcpcli, char *msg)
} }
if (!stat) if (!stat)
{ /* not connect */ { /* not connect */
sprintf(msg, "connecting..."); std::snprintf(msg, MAXSTRMSG, "connecting...");
return 0; return 0;
} }
sprintf(msg, "%s", tcpcli->svr.saddr); std::snprintf(msg, MAXSTRMSG, "%s", tcpcli->svr.saddr);
tracet(2, "consock: connected sock=%d addr=%s\n", tcpcli->svr.sock, tcpcli->svr.saddr); tracet(2, "consock: connected sock=%d addr=%s\n", tcpcli->svr.sock, tcpcli->svr.saddr);
tcpcli->svr.state = 2; tcpcli->svr.state = 2;
tcpcli->svr.tact = tickget(); tcpcli->svr.tact = tickget();
@ -1319,7 +1318,7 @@ tcpcli_t *opentcpcli(const char *path, char *msg)
decodetcppath(path, tcpcli->svr.saddr, port, nullptr, nullptr, nullptr, nullptr); decodetcppath(path, tcpcli->svr.saddr, port, nullptr, nullptr, nullptr, nullptr);
if (sscanf(port, "%d", &tcpcli->svr.port) < 1) if (sscanf(port, "%d", &tcpcli->svr.port) < 1)
{ {
sprintf(msg, "port error: %s", port); std::snprintf(msg, MAXSTRMSG, "port error: %s", port);
tracet(1, "opentcp: port error port=%s\n", port); tracet(1, "opentcp: port error port=%s\n", port);
free(tcpcli); free(tcpcli);
return nullptr; return nullptr;
@ -1369,7 +1368,7 @@ int waittcpcli(tcpcli_t *tcpcli, char *msg)
if (tcpcli->toinact > 0 && if (tcpcli->toinact > 0 &&
static_cast<int>(tickget() - tcpcli->svr.tact) > tcpcli->toinact) static_cast<int>(tickget() - tcpcli->svr.tact) > tcpcli->toinact)
{ {
sprintf(msg, "timeout"); std::snprintf(msg, MAXSTRMSG, "timeout");
tracet(2, "waittcpcli: inactive timeout sock=%d\n", tcpcli->svr.sock); tracet(2, "waittcpcli: inactive timeout sock=%d\n", tcpcli->svr.sock);
discontcp(&tcpcli->svr, tcpcli->tirecon); discontcp(&tcpcli->svr, tcpcli->tirecon);
return 0; return 0;
@ -1396,7 +1395,7 @@ int readtcpcli(tcpcli_t *tcpcli, unsigned char *buff, int n, char *msg)
{ {
err = errsock(); err = errsock();
tracet(1, "readtcpcli: recv error sock=%d err=%d\n", tcpcli->svr.sock, err); tracet(1, "readtcpcli: recv error sock=%d err=%d\n", tcpcli->svr.sock, err);
sprintf(msg, "recv error (%d)", err); std::snprintf(msg, MAXSTRMSG, "recv error (%d)", err);
discontcp(&tcpcli->svr, tcpcli->tirecon); discontcp(&tcpcli->svr, tcpcli->tirecon);
return 0; return 0;
} }
@ -1426,7 +1425,7 @@ int writetcpcli(tcpcli_t *tcpcli, unsigned char *buff, int n, char *msg)
{ {
err = errsock(); err = errsock();
tracet(1, "writetcp: send error sock=%d err=%d\n", tcpcli->svr.sock, err); tracet(1, "writetcp: send error sock=%d err=%d\n", tcpcli->svr.sock, err);
sprintf(msg, "send error (%d)", err); std::snprintf(msg, MAXSTRMSG, "send error (%d)", err);
discontcp(&tcpcli->svr, tcpcli->tirecon); discontcp(&tcpcli->svr, tcpcli->tirecon);
return 0; return 0;
} }
@ -1488,10 +1487,10 @@ int reqntrip_s(ntrip_t *ntrip, char *msg)
tracet(3, "reqntrip_s: state=%d\n", ntrip->state); tracet(3, "reqntrip_s: state=%d\n", ntrip->state);
p += snprintf(p, 256 + NTRIP_MAXSTR, "SOURCE %s %s\r\n", ntrip->passwd, ntrip->mntpnt); p += std::snprintf(p, 256 + NTRIP_MAXSTR, "SOURCE %s %s\r\n", ntrip->passwd, ntrip->mntpnt);
p += sprintf(p, "Source-Agent: NTRIP %s\r\n", NTRIP_AGENT); p += std::snprintf(p, NTRIP_MAXSTR, "Source-Agent: NTRIP %s\r\n", NTRIP_AGENT);
p += sprintf(p, "STR: %s\r\n", ntrip->str); p += std::snprintf(p, NTRIP_MAXSTR, "STR: %s\r\n", ntrip->str);
p += sprintf(p, "\r\n"); p += std::snprintf(p, NTRIP_MAXSTR, "\r\n");
if (writetcpcli(ntrip->tcp, reinterpret_cast<unsigned char *>(buff), p - buff, msg) != p - buff) if (writetcpcli(ntrip->tcp, reinterpret_cast<unsigned char *>(buff), p - buff, msg) != p - buff)
{ {
@ -1514,22 +1513,22 @@ int reqntrip_c(ntrip_t *ntrip, char *msg)
tracet(3, "reqntrip_c: state=%d\n", ntrip->state); tracet(3, "reqntrip_c: state=%d\n", ntrip->state);
p += sprintf(p, "GET %s/%s HTTP/1.0\r\n", ntrip->url, ntrip->mntpnt); p += std::snprintf(p, NTRIP_MAXSTR, "GET %s/%s HTTP/1.0\r\n", ntrip->url, ntrip->mntpnt);
p += sprintf(p, "User-Agent: NTRIP %s\r\n", NTRIP_AGENT); p += std::snprintf(p, NTRIP_MAXSTR, "User-Agent: NTRIP %s\r\n", NTRIP_AGENT);
if (!*ntrip->user) if (!*ntrip->user)
{ {
p += sprintf(p, "Accept: */*\r\n"); p += std::snprintf(p, NTRIP_MAXSTR, "Accept: */*\r\n");
p += sprintf(p, "Connection: close\r\n"); p += std::snprintf(p, NTRIP_MAXSTR, "Connection: close\r\n");
} }
else else
{ {
sprintf(user, "%s:%s", ntrip->user, ntrip->passwd); std::snprintf(user, sizeof(user), "%s:%s", ntrip->user, ntrip->passwd);
p += sprintf(p, "Authorization: Basic "); p += std::snprintf(p, NTRIP_MAXSTR, "Authorization: Basic ");
p += encbase64(p, reinterpret_cast<unsigned char *>(user), strlen(user)); p += encbase64(p, reinterpret_cast<unsigned char *>(user), strlen(user));
p += sprintf(p, "\r\n"); p += std::snprintf(p, NTRIP_MAXSTR, "\r\n");
} }
p += sprintf(p, "\r\n"); p += std::snprintf(p, NTRIP_MAXSTR, "\r\n");
if (writetcpcli(ntrip->tcp, reinterpret_cast<unsigned char *>(buff), p - buff, msg) != p - buff) if (writetcpcli(ntrip->tcp, reinterpret_cast<unsigned char *>(buff), p - buff, msg) != p - buff)
{ {
@ -1565,7 +1564,7 @@ int rspntrip_s(ntrip_t *ntrip, char *msg)
*q++ = *p++; *q++ = *p++;
} }
ntrip->state = 2; ntrip->state = 2;
sprintf(msg, "%s/%s", ntrip->tcp->svr.saddr, ntrip->mntpnt); std::snprintf(msg, MAXSTRMSG, "%s/%s", ntrip->tcp->svr.saddr, ntrip->mntpnt);
tracet(2, "rspntrip_s: response ok nb=%d\n", ntrip->nb); tracet(2, "rspntrip_s: response ok nb=%d\n", ntrip->nb);
return 1; return 1;
} }
@ -1589,7 +1588,7 @@ int rspntrip_s(ntrip_t *ntrip, char *msg)
} }
else if (ntrip->nb >= NTRIP_MAXRSP) else if (ntrip->nb >= NTRIP_MAXRSP)
{ /* buffer overflow */ { /* buffer overflow */
sprintf(msg, "response overflow"); std::snprintf(msg, MAXSTRMSG, "response overflow");
tracet(1, "rspntrip_s: response overflow nb=%d\n", ntrip->nb); tracet(1, "rspntrip_s: response overflow nb=%d\n", ntrip->nb);
ntrip->nb = 0; ntrip->nb = 0;
ntrip->buff[0] = '\0'; ntrip->buff[0] = '\0';
@ -1622,7 +1621,7 @@ int rspntrip_c(ntrip_t *ntrip, char *msg)
*q++ = *p++; *q++ = *p++;
} }
ntrip->state = 2; ntrip->state = 2;
sprintf(msg, "%s/%s", ntrip->tcp->svr.saddr, ntrip->mntpnt); std::snprintf(msg, MAXSTRMSG, "%s/%s", ntrip->tcp->svr.saddr, ntrip->mntpnt);
tracet(2, "rspntrip_c: response ok nb=%d\n", ntrip->nb); tracet(2, "rspntrip_c: response ok nb=%d\n", ntrip->nb);
return 1; return 1;
} }
@ -1631,11 +1630,11 @@ int rspntrip_c(ntrip_t *ntrip, char *msg)
if (!*ntrip->mntpnt) if (!*ntrip->mntpnt)
{ /* source table request */ { /* source table request */
ntrip->state = 2; ntrip->state = 2;
sprintf(msg, "source table received"); std::snprintf(msg, MAXSTRMSG, "source table received");
tracet(2, "rspntrip_c: receive source table nb=%d\n", ntrip->nb); tracet(2, "rspntrip_c: receive source table nb=%d\n", ntrip->nb);
return 1; return 1;
} }
sprintf(msg, "no mountp. reconnect..."); std::snprintf(msg, MAXSTRMSG, "no mountp. reconnect...");
tracet(2, "rspntrip_c: no mount point nb=%d\n", ntrip->nb); tracet(2, "rspntrip_c: no mount point nb=%d\n", ntrip->nb);
ntrip->nb = 0; ntrip->nb = 0;
ntrip->buff[0] = '\0'; ntrip->buff[0] = '\0';
@ -1661,7 +1660,7 @@ int rspntrip_c(ntrip_t *ntrip, char *msg)
} }
else if (ntrip->nb >= NTRIP_MAXRSP) else if (ntrip->nb >= NTRIP_MAXRSP)
{ /* buffer overflow */ { /* buffer overflow */
sprintf(msg, "response overflow"); std::snprintf(msg, MAXSTRMSG, "response overflow");
tracet(1, "rspntrip_s: response overflow nb=%d\n", ntrip->nb); tracet(1, "rspntrip_s: response overflow nb=%d\n", ntrip->nb);
ntrip->nb = 0; ntrip->nb = 0;
ntrip->buff[0] = '\0'; ntrip->buff[0] = '\0';
@ -1750,14 +1749,13 @@ ntrip_t *openntrip(const char *path, int type, char *msg)
/* use default port if no port specified */ /* use default port if no port specified */
if (!*port) if (!*port)
{ {
sprintf(port, "%d", type ? NTRIP_CLI_PORT : NTRIP_SVR_PORT); std::snprintf(port, sizeof(port), "%d", type ? NTRIP_CLI_PORT : NTRIP_SVR_PORT);
} }
sprintf(tpath, "%s:%s", addr, port); std::snprintf(tpath, MAXSTRPATH, "%s:%s", addr, port);
/* ntrip access via proxy server */ /* ntrip access via proxy server */
if (*proxyaddr) if (*proxyaddr)
{ {
// sprintf(ntrip->url, "http://%s", tpath); This line triggers a warning. Replaced by:
std::string s_aux = "http://" + std::string(tpath); std::string s_aux = "http://" + std::string(tpath);
int n = s_aux.length(); int n = s_aux.length();
if (n < 256) if (n < 256)
@ -1978,7 +1976,6 @@ void *ftpthread(void *arg)
{ {
p = remote; p = remote;
} }
// sprintf(local, "%s%c%s", localdir, FILEPATHSEP, p); This line triggers a warning. Replaced by:
std::string s_aux = std::string(localdir) + std::to_string(FILEPATHSEP) + std::string(p); std::string s_aux = std::string(localdir) + std::to_string(FILEPATHSEP) + std::string(p);
int n = s_aux.length(); int n = s_aux.length();
if (n < 1024) if (n < 1024)
@ -1989,7 +1986,6 @@ void *ftpthread(void *arg)
} }
} }
// sprintf(errfile, "%s.err", local); This line triggers a warning. Replaced by:
std::string s_aux2 = std::string(local) + ".err"; std::string s_aux2 = std::string(local) + ".err";
n = s_aux2.length(); n = s_aux2.length();
if (n < 1024) if (n < 1024)
@ -2022,14 +2018,12 @@ void *ftpthread(void *arg)
if (*proxyaddr) if (*proxyaddr)
{ {
proto = ftp->proto ? const_cast<char *>("http") : const_cast<char *>("ftp"); proto = ftp->proto ? const_cast<char *>("http") : const_cast<char *>("ftp");
sprintf(env, "set %s_proxy=http://%s & ", proto, proxyaddr); std::snprintf(env, sizeof(env), "set %s_proxy=http://%s & ", proto, proxyaddr);
proxyopt = const_cast<char *>("--proxy=on "); proxyopt = const_cast<char *>("--proxy=on ");
} }
/* download command (ref [2]) */ /* download command (ref [2]) */
if (ftp->proto == 0) if (ftp->proto == 0)
{ /* ftp */ { /* ftp */
// sprintf(opt, "--ftp-user=%s --ftp-password=%s --glob=off --passive-ftp %s-t 1 -T %d -O \"%s\"",
// ftp->user, ftp->passwd, proxyopt, FTP_TIMEOUT, local); This line triggers a warning. Replaced by:
std::string s_aux = "--ftp-user=" + std::string(ftp->user) + " --ftp-password=" + std::string(ftp->passwd) + std::string s_aux = "--ftp-user=" + std::string(ftp->user) + " --ftp-password=" + std::string(ftp->passwd) +
" --glob=off --passive-ftp " + std::string(proxyopt) + "s-t 1 -T " + std::to_string(FTP_TIMEOUT) + " --glob=off --passive-ftp " + std::string(proxyopt) + "s-t 1 -T " + std::to_string(FTP_TIMEOUT) +
" -O \"" + std::string(local) + "\""; " -O \"" + std::string(local) + "\"";
@ -2042,8 +2036,6 @@ void *ftpthread(void *arg)
} }
} }
// sprintf(cmd, "%s%s %s \"ftp://%s/%s\" 2> \"%s\"\n", env, FTP_CMD, opt, ftp->addr,
// remote, errfile); This line triggers a warning. Replaced by:
std::string s_aux2 = std::string(env) + std::string(FTP_CMD) + " " + std::string(opt) + " " + std::string s_aux2 = std::string(env) + std::string(FTP_CMD) + " " + std::string(opt) + " " +
"\"ftp://" + std::string(ftp->addr) + "/" + std::string(remote) + "\" 2> \"" + std::string(errfile) + "\"\n"; "\"ftp://" + std::string(ftp->addr) + "/" + std::string(remote) + "\" 2> \"" + std::string(errfile) + "\"\n";
k = s_aux2.length(); k = s_aux2.length();
@ -2054,7 +2046,6 @@ void *ftpthread(void *arg)
} }
else else
{ /* http */ { /* http */
// sprintf(opt, "%s-t 1 -T %d -O \"%s\"", proxyopt, FTP_TIMEOUT, local); This line triggers a warning. Replaced by:
std::string s_aux = std::string(proxyopt) + " -t 1 -T " + std::to_string(FTP_TIMEOUT) + " -O \"" + std::string(local) + "\""; std::string s_aux = std::string(proxyopt) + " -t 1 -T " + std::to_string(FTP_TIMEOUT) + " -O \"" + std::string(local) + "\"";
int l = s_aux.length(); int l = s_aux.length();
for (int i = 0; (i < l) && (i < 1024); i++) for (int i = 0; (i < l) && (i < 1024); i++)
@ -2062,8 +2053,6 @@ void *ftpthread(void *arg)
opt[i] = s_aux[i]; opt[i] = s_aux[i];
} }
// sprintf(cmd, "%s%s %s \"http://%s/%s\" 2> \"%s\"\n", env, FTP_CMD, opt, ftp->addr,
// remote, errfile); This line triggers a warning. Replaced by:
std::string s_aux2 = std::string(env) + std::string(FTP_CMD) + " " + std::string(opt) + " " + std::string s_aux2 = std::string(env) + std::string(FTP_CMD) + " " + std::string(opt) + " " +
"\"http://" + std::string(ftp->addr) + "/" + std::string(remote) + "\" 2> \"" + std::string(errfile) + "\"\n"; "\"http://" + std::string(ftp->addr) + "/" + std::string(remote) + "\" 2> \"" + std::string(errfile) + "\"\n";
l = s_aux2.length(); l = s_aux2.length();
@ -2186,7 +2175,10 @@ int readftp(ftp_t *ftp, unsigned char *buff, int n, char *msg)
if (ftp->state <= 0) if (ftp->state <= 0)
{ /* ftp/http not executed? */ { /* ftp/http not executed? */
ftp->state = 1; ftp->state = 1;
sprintf(msg, "%s://%s", ftp->proto ? "http" : "ftp", ftp->addr); if (std::snprintf(msg, sizeof(ftp->addr), "%s://%s", ftp->proto ? "http" : "ftp", ftp->addr) < 0)
{
tracet(1, "readftp: ftp address truncation\n");
}
if (pthread_create(&ftp->thread, nullptr, ftpthread, ftp)) if (pthread_create(&ftp->thread, nullptr, ftpthread, ftp))
{ {
@ -2203,7 +2195,10 @@ int readftp(ftp_t *ftp, unsigned char *buff, int n, char *msg)
if (ftp->state == 3) if (ftp->state == 3)
{ /* ftp error */ { /* ftp error */
sprintf(msg, "%s error (%d)", ftp->proto ? "http" : "ftp", ftp->error); if (std::snprintf(msg, sizeof(ftp->addr), "%s error (%d)", ftp->proto ? "http" : "ftp", ftp->error) < 0)
{
tracet(1, "readftp: ftp address truncation\n");
}
/* set next retry time */ /* set next retry time */
ftp->tnext = nextdltime(ftp->topts, 0); ftp->tnext = nextdltime(ftp->topts, 0);
@ -2217,7 +2212,7 @@ int readftp(ftp_t *ftp, unsigned char *buff, int n, char *msg)
{ {
*p++ = *q++; *p++ = *q++;
} }
p += sprintf(reinterpret_cast<char *>(p), "\r\n"); p += std::snprintf(reinterpret_cast<char *>(p), sizeof("\r\n") + 1, "\r\n");
/* set next download time */ /* set next download time */
ftp->tnext = nextdltime(ftp->topts, 1); ftp->tnext = nextdltime(ftp->topts, 1);

View File

@ -339,6 +339,7 @@ install(FILES
${PROJECT_BINARY_DIR}/include/volk_gnsssdr/volk_gnsssdr_typedefs.h ${PROJECT_BINARY_DIR}/include/volk_gnsssdr/volk_gnsssdr_typedefs.h
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_malloc.h ${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_malloc.h
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_sine_table.h ${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_sine_table.h
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/constants.h
DESTINATION include/volk_gnsssdr DESTINATION include/volk_gnsssdr
COMPONENT "volk_gnsssdr_devel" COMPONENT "volk_gnsssdr_devel"
) )

View File

@ -0,0 +1,52 @@
#!/usr/bin/env python
# Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
#
# This file is part of GNSS-SDR.
#
# GNSS-SDR is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GNSS-SDR is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
# This script is used to compare the generic kernels to the highest performing kernel, for each operation
# Run:
# ./volk_gnsssdr_profile -j volk_gnsssdr_results.json
# Then run this script under python3
import matplotlib.pyplot as plt
import numpy as np
import json
filename = 'volk_gnsssdr_results.json'
operations = []
metrics = []
with open(filename) as json_file:
data = json.load(json_file)
for test in data['volk_gnsssdr_tests']:
if ('generic' in test['results']) or ('u_generic' in test['results']): # some dont have a generic kernel
operations.append(test['name'][13:]) # remove volk_gnsssdr_ prefix that they all have
extension_performance = []
for key, val in test['results'].items():
if key not in ['generic', 'u_generic']: # exclude generic results, when trying to find fastest time
extension_performance.append(val['time'])
try:
generic_time = test['results']['generic']['time']
except:
generic_time = test['results']['u_generic']['time']
metrics.append(extension_performance[np.argmin(extension_performance)]/generic_time)
plt.bar(np.arange(len(metrics)), metrics)
plt.hlines(1.0, -1, len(metrics), colors='r', linestyles='dashed')
plt.axis([-1, len(metrics), 0, 2])
plt.xticks(np.arange(len(operations)), operations, rotation=90)
plt.ylabel('Time taken of fastest kernel relative to generic kernel')
plt.show()

View File

@ -57,7 +57,7 @@ public:
class option_list class option_list
{ {
public: public:
option_list(std::string program_name); explicit option_list(std::string program_name);
void add(const option_t &opt); void add(const option_t &opt);

View File

@ -193,7 +193,7 @@ int main(int argc, char *argv[])
void read_results(std::vector<volk_gnsssdr_test_results_t> *results) void read_results(std::vector<volk_gnsssdr_test_results_t> *results)
{ {
char path[1024]; char path[1024];
volk_gnsssdr_get_config_path(path); volk_gnsssdr_get_config_path(path, true);
read_results(results, std::string(path)); read_results(results, std::string(path));
} }
@ -255,7 +255,7 @@ void read_results(std::vector<volk_gnsssdr_test_results_t> *results, std::string
void write_results(const std::vector<volk_gnsssdr_test_results_t> *results, bool update_result) void write_results(const std::vector<volk_gnsssdr_test_results_t> *results, bool update_result)
{ {
char path[1024]; char path[1024];
volk_gnsssdr_get_config_path(path); volk_gnsssdr_get_config_path(path, false);
write_results(results, update_result, std::string(path)); write_results(results, update_result, std::string(path));
} }

View File

@ -0,0 +1,8 @@
########################################################################
# Toolchain file for building native on a ARM Cortex A72 w/ NEON
# Usage: cmake -DCMAKE_TOOLCHAIN_FILE=<this file> <source directory>
########################################################################
set(CMAKE_CXX_COMPILER g++)
set(CMAKE_C_COMPILER gcc)
set(CMAKE_CXX_FLAGS "-march=armv8-a -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE) #same flags for C sources

View File

@ -107,6 +107,7 @@
<param>12</param> <param>12</param>
</check> </check>
<flag compiler="gnu">-mfma</flag> <flag compiler="gnu">-mfma</flag>
<flag compiler="clang">-mfma</flag>
<flag compiler="msvc">/arch:AVX2</flag> <flag compiler="msvc">/arch:AVX2</flag>
<alignment>32</alignment> <alignment>32</alignment>
</arch> </arch>
@ -241,6 +242,7 @@
<!-- check to see that the OS has enabled AVX2 --> <!-- check to see that the OS has enabled AVX2 -->
<check name="get_avx2_enabled"></check> <check name="get_avx2_enabled"></check>
<flag compiler="gnu">-mavx2</flag> <flag compiler="gnu">-mavx2</flag>
<flag compiler="clang">-mavx2</flag>
<flag compiler="msvc">/arch:AVX2</flag> <flag compiler="msvc">/arch:AVX2</flag>
<alignment>32</alignment> <alignment>32</alignment>
</arch> </arch>

View File

@ -53,4 +53,47 @@ static inline float32x4_t vsqrtq_f32(float32x4_t q_x)
return vmulq_f32(q_x, q_step_2); return vmulq_f32(q_x, q_step_2);
} }
/* Magnitude squared for float32x4x2_t */
static inline float32x4_t _vmagnitudesquaredq_f32(float32x4x2_t cmplxValue)
{
float32x4_t iValue, qValue, result;
iValue = vmulq_f32(cmplxValue.val[0], cmplxValue.val[0]); // Square the values
qValue = vmulq_f32(cmplxValue.val[1], cmplxValue.val[1]); // Square the values
result = vaddq_f32(iValue, qValue); // Add the I2 and Q2 values
return result;
}
/* Inverse square root for float32x4_t */
static inline float32x4_t _vinvsqrtq_f32(float32x4_t x)
{
float32x4_t sqrt_reciprocal = vrsqrteq_f32(x);
sqrt_reciprocal = vmulq_f32(vrsqrtsq_f32(vmulq_f32(x, sqrt_reciprocal), sqrt_reciprocal), sqrt_reciprocal);
sqrt_reciprocal = vmulq_f32(vrsqrtsq_f32(vmulq_f32(x, sqrt_reciprocal), sqrt_reciprocal), sqrt_reciprocal);
return sqrt_reciprocal;
}
/* Complex multiplication for float32x4x2_t */
static inline float32x4x2_t _vmultiply_complexq_f32(float32x4x2_t a_val, float32x4x2_t b_val)
{
float32x4x2_t tmp_real;
float32x4x2_t tmp_imag;
float32x4x2_t c_val;
// multiply the real*real and imag*imag to get real result
// a0r*b0r|a1r*b1r|a2r*b2r|a3r*b3r
tmp_real.val[0] = vmulq_f32(a_val.val[0], b_val.val[0]);
// a0i*b0i|a1i*b1i|a2i*b2i|a3i*b3i
tmp_real.val[1] = vmulq_f32(a_val.val[1], b_val.val[1]);
// Multiply cross terms to get the imaginary result
// a0r*b0i|a1r*b1i|a2r*b2i|a3r*b3i
tmp_imag.val[0] = vmulq_f32(a_val.val[0], b_val.val[1]);
// a0i*b0r|a1i*b1r|a2i*b2r|a3i*b3r
tmp_imag.val[1] = vmulq_f32(a_val.val[1], b_val.val[0]);
// combine the products
c_val.val[0] = vsubq_f32(tmp_real.val[0], tmp_real.val[1]);
c_val.val[1] = vaddq_f32(tmp_imag.val[0], tmp_imag.val[1]);
return c_val;
}
#endif /* INCLUDED_VOLK_GNSSSDR_NEON_INTRINSICS_H_ */ #endif /* INCLUDED_VOLK_GNSSSDR_NEON_INTRINSICS_H_ */

View File

@ -26,6 +26,7 @@
#define INCLUDED_VOLK_GNSSSDR_PREFS_H #define INCLUDED_VOLK_GNSSSDR_PREFS_H
#include <volk_gnsssdr/volk_gnsssdr_common.h> #include <volk_gnsssdr/volk_gnsssdr_common.h>
#include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
__VOLK_DECL_BEGIN __VOLK_DECL_BEGIN
@ -38,10 +39,11 @@ typedef struct volk_gnsssdr_arch_pref
} volk_gnsssdr_arch_pref_t; } volk_gnsssdr_arch_pref_t;
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// get path to volk_gnsssdr_config profiling info; // get path to volk_gnsssdr_config profiling info; second arguments specifies
// if config file should be tested on existence for reading.
// returns \0 in the argument on failure. // returns \0 in the argument on failure.
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
VOLK_API void volk_gnsssdr_get_config_path(char *); VOLK_API void volk_gnsssdr_get_config_path(char *, bool);
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// load prefs into global prefs struct // load prefs into global prefs struct

View File

@ -16,6 +16,7 @@
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>. * along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -29,7 +30,7 @@
#include <volk_gnsssdr/volk_gnsssdr_prefs.h> #include <volk_gnsssdr/volk_gnsssdr_prefs.h>
void volk_gnsssdr_get_config_path(char *path) void volk_gnsssdr_get_config_path(char *path, bool read)
{ {
if (!path) return; if (!path) return;
const char *suffix = "/.volk_gnsssdr/volk_gnsssdr_config"; const char *suffix = "/.volk_gnsssdr/volk_gnsssdr_config";
@ -42,8 +43,11 @@ void volk_gnsssdr_get_config_path(char *path)
{ {
strncpy(path, home, 512); strncpy(path, home, 512);
strcat(path, suffix2); strcat(path, suffix2);
if (!read || (access(path, F_OK) != -1))
{
return; return;
} }
}
// check for user-local config file // check for user-local config file
home = getenv("HOME"); home = getenv("HOME");
@ -51,7 +55,7 @@ void volk_gnsssdr_get_config_path(char *path)
{ {
strncpy(path, home, 512); strncpy(path, home, 512);
strcat(path, suffix); strcat(path, suffix);
if (access(path, F_OK) != -1) if (!read || (access(path, F_OK) != -1))
{ {
return; return;
} }
@ -63,7 +67,7 @@ void volk_gnsssdr_get_config_path(char *path)
{ {
strncpy(path, home, 512); strncpy(path, home, 512);
strcat(path, suffix); strcat(path, suffix);
if (access(path, F_OK) != -1) if (!read || (access(path, F_OK) != -1))
{ {
return; return;
} }
@ -99,7 +103,7 @@ size_t volk_gnsssdr_load_preferences(volk_gnsssdr_arch_pref_t **prefs_res)
volk_gnsssdr_arch_pref_t *prefs = NULL; volk_gnsssdr_arch_pref_t *prefs = NULL;
// get the config path // get the config path
volk_gnsssdr_get_config_path(path); volk_gnsssdr_get_config_path(path, true);
if (!path[0]) return n_arch_prefs; //no prefs found if (!path[0]) return n_arch_prefs; //no prefs found
config_file = fopen(path, "r"); config_file = fopen(path, "r");
if (!config_file) return n_arch_prefs; //no prefs found if (!config_file) return n_arch_prefs; //no prefs found

View File

@ -23,6 +23,7 @@ from __future__ import print_function
import sys import sys
import os import os
import exceptions
import re import re
from six.moves import configparser, input from six.moves import configparser, input

View File

@ -48,7 +48,7 @@ public:
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
friend unpack_spir_gss6450_samples_sptr make_unpack_spir_gss6450_samples_sptr(unsigned int adc_nbit); friend unpack_spir_gss6450_samples_sptr make_unpack_spir_gss6450_samples_sptr(unsigned int adc_nbit);
void decode_4bits_word(uint32_t input_uint32, gr_complex *out, int adc_bits); void decode_4bits_word(uint32_t input_uint32, gr_complex *out, int adc_bits);
unpack_spir_gss6450_samples(unsigned int adc_nbit); explicit unpack_spir_gss6450_samples(unsigned int adc_nbit);
~unpack_spir_gss6450_samples() = default; ~unpack_spir_gss6450_samples() = default;
private: private:

View File

@ -49,7 +49,7 @@ public:
/*! /*!
* \brief Constructor * \brief Constructor
*/ */
Fpga_Switch(const std::string& device_name); explicit Fpga_Switch(const std::string& device_name);
/*! /*!
* \brief Destructor * \brief Destructor

View File

@ -31,7 +31,7 @@
#include "viterbi_decoder.h" #include "viterbi_decoder.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <cstring> // for memset #include <algorithm> // for fill_n
#include <ostream> // for operator<<, basic_ostream, char_traits, endl #include <ostream> // for operator<<, basic_ostream, char_traits, endl
// logging // logging
@ -434,7 +434,6 @@ int Viterbi_Decoder::nsc_enc_bit(int state_out_p[], int input, int state_in,
length: The highest bit position in the symbol length: The highest bit position in the symbol
This function is used by nsc_enc_bit(), rsc_enc_bit(), and rsc_tail() */ This function is used by nsc_enc_bit(), rsc_enc_bit(), and rsc_tail() */
int Viterbi_Decoder::parity_counter(int symbol, int length) int Viterbi_Decoder::parity_counter(int symbol, int length)
{ {
int counter; int counter;
@ -453,14 +452,13 @@ Viterbi_Decoder::Prev::Prev(int states, int t)
{ {
this->t = t; this->t = t;
num_states = states; num_states = states;
state = new int[states]; state.reserve(num_states);
bit = new int[states]; bit.reserve(num_states);
metric = new float[states]; metric.reserve(num_states);
refcount = new int; refcount = 1;
*refcount = 1; std::fill_n(state.begin(), num_states, 0);
memset(state, 0, sizeof(int) * num_states); std::fill_n(bit.begin(), num_states, 0);
memset(bit, 0, sizeof(int) * num_states); std::fill_n(metric.begin(), num_states, 0.0F);
memset(metric, 0, sizeof(float) * num_states);
} }
@ -468,7 +466,7 @@ Viterbi_Decoder::Prev::Prev(int states, int t)
Viterbi_Decoder::Prev::Prev(const Prev& prev) Viterbi_Decoder::Prev::Prev(const Prev& prev)
{ {
refcount = prev.refcount; refcount = prev.refcount;
(*refcount)++; refcount++;
t = prev.t; t = prev.t;
state = prev.state; state = prev.state;
num_states = prev.num_states; num_states = prev.num_states;
@ -477,7 +475,7 @@ Viterbi_Decoder::Prev::Prev(const Prev& prev)
VLOG(LMORE) << "Prev(" VLOG(LMORE) << "Prev("
<< "?" << "?"
<< ", " << t << ")" << ", " << t << ")"
<< " copy, new refcount = " << *refcount; << " copy, new refcount = " << refcount;
} }
@ -491,21 +489,14 @@ Viterbi_Decoder::Prev& Viterbi_Decoder::Prev::operator=(const Prev& other)
} }
// handle old resources // handle old resources
if (*refcount == 1) if (refcount != 1)
{ // if they are not used anymore -> unallocate them
delete[] state;
delete[] bit;
delete[] metric;
delete refcount;
}
else
{ // this object is not anymore using them { // this object is not anymore using them
(*refcount)--; refcount--;
} }
// increase ref counter for this resource set // increase ref counter for this resource set
refcount = other.refcount; refcount = other.refcount;
(*refcount)++; refcount++;
// take over resources // take over resources
t = other.t; t = other.t;
@ -516,28 +507,20 @@ Viterbi_Decoder::Prev& Viterbi_Decoder::Prev::operator=(const Prev& other)
VLOG(LMORE) << "Prev(" VLOG(LMORE) << "Prev("
<< "?" << "?"
<< ", " << t << ")" << ", " << t << ")"
<< " assignment, new refcount = " << *refcount; << " assignment, new refcount = " << refcount;
return *this; return *this;
} }
Viterbi_Decoder::Prev::~Prev() Viterbi_Decoder::Prev::~Prev()
{ {
if (*refcount == 1) if (refcount != 1)
{ {
delete[] state; refcount--;
delete[] bit;
delete[] metric;
delete refcount;
// std::cout << "~Prev(" << "?" << ", " << t << ")" << " destructor with delete" << std::endl;
}
else
{
(*refcount)--;
VLOG(LMORE) << "~Prev(" VLOG(LMORE) << "~Prev("
<< "?" << "?"
<< ", " << t << ")" << ", " << t << ")"
<< " destructor after copy, new refcount = " << *refcount; << " destructor after copy, new refcount = " << refcount;
} }
} }

View File

@ -79,10 +79,10 @@ private:
private: private:
int t; int t;
int* state; std::vector<int> state;
int* bit; std::vector<int> bit;
float* metric; std::vector<float> metric;
int* refcount; int refcount;
}; };
// code properties // code properties

View File

@ -77,7 +77,7 @@ public:
private: private:
friend dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(const Dll_Pll_Conf &conf_); friend dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(const Dll_Pll_Conf &conf_);
void msg_handler_telemetry_to_trk(const pmt::pmt_t &msg); void msg_handler_telemetry_to_trk(const pmt::pmt_t &msg);
dll_pll_veml_tracking(const Dll_Pll_Conf &conf_); explicit dll_pll_veml_tracking(const Dll_Pll_Conf &conf_);
bool cn0_and_tracking_lock_status(double coh_integration_time_s); bool cn0_and_tracking_lock_status(double coh_integration_time_s);
bool acquire_secondary(); bool acquire_secondary();

View File

@ -108,7 +108,7 @@ public:
private: private:
friend dll_pll_veml_tracking_fpga_sptr dll_pll_veml_make_tracking_fpga(const Dll_Pll_Conf_Fpga &conf_); friend dll_pll_veml_tracking_fpga_sptr dll_pll_veml_make_tracking_fpga(const Dll_Pll_Conf_Fpga &conf_);
void msg_handler_telemetry_to_trk(const pmt::pmt_t &msg); void msg_handler_telemetry_to_trk(const pmt::pmt_t &msg);
dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga &conf_); explicit dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga &conf_);
bool cn0_and_tracking_lock_status(double coh_integration_time_s); bool cn0_and_tracking_lock_status(double coh_integration_time_s);
bool acquire_secondary(); bool acquire_secondary();

View File

@ -69,7 +69,7 @@ class Bayesian_estimator
{ {
public: public:
Bayesian_estimator(); Bayesian_estimator();
Bayesian_estimator(int ny); explicit Bayesian_estimator(int ny);
Bayesian_estimator(const arma::vec& mu_prior_0, int kappa_prior_0, int nu_prior_0, const arma::mat& Psi_prior_0); Bayesian_estimator(const arma::vec& mu_prior_0, int kappa_prior_0, int nu_prior_0, const arma::mat& Psi_prior_0);
~Bayesian_estimator() = default; ~Bayesian_estimator() = default;

View File

@ -64,7 +64,7 @@ class CubatureFilter
public: public:
// Constructors and destructors // Constructors and destructors
CubatureFilter(); CubatureFilter();
CubatureFilter(int nx); explicit CubatureFilter(int nx);
CubatureFilter(const arma::vec& x_pred_0, const arma::mat& P_x_pred_0); CubatureFilter(const arma::vec& x_pred_0, const arma::mat& P_x_pred_0);
~CubatureFilter() = default; ~CubatureFilter() = default;
@ -93,7 +93,7 @@ class UnscentedFilter
public: public:
// Constructors and destructors // Constructors and destructors
UnscentedFilter(); UnscentedFilter();
UnscentedFilter(int nx); explicit UnscentedFilter(int nx);
UnscentedFilter(const arma::vec& x_pred_0, const arma::mat& P_x_pred_0); UnscentedFilter(const arma::vec& x_pred_0, const arma::mat& P_x_pred_0);
~UnscentedFilter() = default; ~UnscentedFilter() = default;

View File

@ -52,7 +52,7 @@ public:
void set_pdi(float pdi_code); //!< Set Summation interval for code [s] void set_pdi(float pdi_code); //!< Set Summation interval for code [s]
void initialize(); //!< Start tracking with acquisition information void initialize(); //!< Start tracking with acquisition information
float get_code_nco(float DLL_discriminator); //!< Numerically controlled oscillator float get_code_nco(float DLL_discriminator); //!< Numerically controlled oscillator
Tracking_2nd_DLL_filter(float pdi_code); explicit Tracking_2nd_DLL_filter(float pdi_code);
Tracking_2nd_DLL_filter(); Tracking_2nd_DLL_filter();
~Tracking_2nd_DLL_filter() = default; ~Tracking_2nd_DLL_filter() = default;

View File

@ -51,7 +51,7 @@ public:
void set_pdi(float pdi_carr); //!< Set Summation interval for code [s] void set_pdi(float pdi_carr); //!< Set Summation interval for code [s]
void initialize(); void initialize();
float get_carrier_nco(float PLL_discriminator); float get_carrier_nco(float PLL_discriminator);
Tracking_2nd_PLL_filter(float pdi_carr); explicit Tracking_2nd_PLL_filter(float pdi_carr);
Tracking_2nd_PLL_filter(); Tracking_2nd_PLL_filter();
~Tracking_2nd_PLL_filter() = default; ~Tracking_2nd_PLL_filter() = default;

View File

@ -60,7 +60,7 @@ class INIReader
{ {
public: public:
//! Construct INIReader and parse given filename. See ini.h for more info about the parsing. //! Construct INIReader and parse given filename. See ini.h for more info about the parsing.
INIReader(const std::string& filename); explicit INIReader(const std::string& filename);
//! Return the result of ini_parse(), i.e., 0 on success, line number of first error on parse error, or -1 on file open error. //! Return the result of ini_parse(), i.e., 0 on success, line number of first error on parse error, or -1 on file open error.
int ParseError(); int ParseError();

View File

@ -77,7 +77,7 @@ public:
* *
* \param[in] configuration Pointer to a ConfigurationInterface * \param[in] configuration Pointer to a ConfigurationInterface
*/ */
ControlThread(std::shared_ptr<ConfigurationInterface> configuration); explicit ControlThread(std::shared_ptr<ConfigurationInterface> configuration);
/*! /*!
* \brief Destructor * \brief Destructor

View File

@ -57,7 +57,7 @@ class InMemoryConfiguration;
class FileConfiguration : public ConfigurationInterface class FileConfiguration : public ConfigurationInterface
{ {
public: public:
FileConfiguration(std::string filename); explicit FileConfiguration(std::string filename);
FileConfiguration(); FileConfiguration();
//! Virtual destructor //! Virtual destructor
~FileConfiguration(); ~FileConfiguration();

View File

@ -45,7 +45,7 @@ class Gnss_Signal
{ {
public: public:
Gnss_Signal(); Gnss_Signal();
Gnss_Signal(const std::string& signal_); explicit Gnss_Signal(const std::string& signal_);
Gnss_Signal(const Gnss_Satellite& satellite_, const std::string& signal_); Gnss_Signal(const Gnss_Satellite& satellite_, const std::string& signal_);
~Gnss_Signal() = default; ~Gnss_Signal() = default;
std::string get_signal_str() const; //!< Get the satellite signal {"1C" for GPS L1 C/A, "2S" for GPS L2C (M), "L5" for GPS L5, "1G" for GLONASS L1 C/A, "1B" for Galileo E1B, "5X" for Galileo E5a. std::string get_signal_str() const; //!< Get the satellite signal {"1C" for GPS L1 C/A, "2S" for GPS L2C (M), "L5" for GPS L5, "1G" for GLONASS L1 C/A, "1B" for Galileo E1B, "5X" for Galileo E5a.

View File

@ -79,7 +79,7 @@ DEFINE_bool(show_plots, true, "Show plots on screen. Disable for non-interactive
class GnuplotException : public std::runtime_error class GnuplotException : public std::runtime_error
{ {
public: public:
GnuplotException(const std::string &msg) : std::runtime_error(msg) {} explicit GnuplotException(const std::string &msg) : std::runtime_error(msg) {}
}; };
@ -189,7 +189,7 @@ public:
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
//! set a style during construction //! set a style during construction
Gnuplot(const std::string &style = "points"); explicit Gnuplot(const std::string &style = "points");
// plot a single std::vector at one go // plot a single std::vector at one go
Gnuplot(const std::vector<double> &x, Gnuplot(const std::vector<double> &x,

View File

@ -120,7 +120,7 @@ class AcqPerfTest_msg_rx : public gr::block
private: private:
friend AcqPerfTest_msg_rx_sptr AcqPerfTest_msg_rx_make(Concurrent_Queue<int>& queue); friend AcqPerfTest_msg_rx_sptr AcqPerfTest_msg_rx_make(Concurrent_Queue<int>& queue);
void msg_handler_events(pmt::pmt_t msg); void msg_handler_events(pmt::pmt_t msg);
AcqPerfTest_msg_rx(Concurrent_Queue<int>& queue); explicit AcqPerfTest_msg_rx(Concurrent_Queue<int>& queue);
Concurrent_Queue<int>& channel_internal_queue; Concurrent_Queue<int>& channel_internal_queue;
public: public:

View File

@ -68,7 +68,7 @@ class GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx : public gr::block
private: private:
friend GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(Concurrent_Queue<int>& queue); friend GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(Concurrent_Queue<int>& queue);
void msg_handler_events(pmt::pmt_t msg); void msg_handler_events(pmt::pmt_t msg);
GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx(Concurrent_Queue<int>& queue); explicit GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx(Concurrent_Queue<int>& queue);
Concurrent_Queue<int>& channel_internal_queue; Concurrent_Queue<int>& channel_internal_queue;
public: public:

View File

@ -67,7 +67,7 @@ class GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx : public gr::block
private: private:
friend GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(Concurrent_Queue<int>& queue); friend GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(Concurrent_Queue<int>& queue);
void msg_handler_events(pmt::pmt_t msg); void msg_handler_events(pmt::pmt_t msg);
GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx(Concurrent_Queue<int>& queue); explicit GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx(Concurrent_Queue<int>& queue);
Concurrent_Queue<int>& channel_internal_queue; Concurrent_Queue<int>& channel_internal_queue;
public: public:

View File

@ -76,7 +76,7 @@ class GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx : public gr::block
private: private:
friend GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_sptr GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_make(Concurrent_Queue<int>& queue); friend GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_sptr GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_make(Concurrent_Queue<int>& queue);
void msg_handler_events(pmt::pmt_t msg); void msg_handler_events(pmt::pmt_t msg);
GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx(Concurrent_Queue<int>& queue); explicit GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx(Concurrent_Queue<int>& queue);
Concurrent_Queue<int>& channel_internal_queue; Concurrent_Queue<int>& channel_internal_queue;
public: public:

View File

@ -69,7 +69,7 @@ class GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx : public gr::block
private: private:
friend GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_sptr GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(Concurrent_Queue<int>& queue); friend GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_sptr GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(Concurrent_Queue<int>& queue);
void msg_handler_events(pmt::pmt_t msg); void msg_handler_events(pmt::pmt_t msg);
GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx(Concurrent_Queue<int>& queue); explicit GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx(Concurrent_Queue<int>& queue);
Concurrent_Queue<int>& channel_internal_queue; Concurrent_Queue<int>& channel_internal_queue;
public: public:

View File

@ -75,7 +75,7 @@ class GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx : public gr:
private: private:
friend GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_sptr GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(Concurrent_Queue<int>& queue); friend GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_sptr GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(Concurrent_Queue<int>& queue);
void msg_handler_events(pmt::pmt_t msg); void msg_handler_events(pmt::pmt_t msg);
GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx(Concurrent_Queue<int>& queue); explicit GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx(Concurrent_Queue<int>& queue);
Concurrent_Queue<int>& channel_internal_queue; Concurrent_Queue<int>& channel_internal_queue;
public: public:

View File

@ -70,7 +70,7 @@ class GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx : public gr::bloc
private: private:
friend GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(Concurrent_Queue<int>& queue); friend GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(Concurrent_Queue<int>& queue);
void msg_handler_events(pmt::pmt_t msg); void msg_handler_events(pmt::pmt_t msg);
GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx(Concurrent_Queue<int>& queue); explicit GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx(Concurrent_Queue<int>& queue);
Concurrent_Queue<int>& channel_internal_queue; Concurrent_Queue<int>& channel_internal_queue;
public: public:

View File

@ -66,7 +66,7 @@ class GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx : public gr::block
private: private:
friend GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_sptr GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_make(Concurrent_Queue<int>& queue); friend GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_sptr GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_make(Concurrent_Queue<int>& queue);
void msg_handler_events(pmt::pmt_t msg); void msg_handler_events(pmt::pmt_t msg);
GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx(Concurrent_Queue<int>& queue); explicit GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx(Concurrent_Queue<int>& queue);
Concurrent_Queue<int>& channel_internal_queue; Concurrent_Queue<int>& channel_internal_queue;
public: public:

View File

@ -72,7 +72,7 @@ class GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx : public gr::block
private: private:
friend GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_sptr GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_make(Concurrent_Queue<int>& queue); friend GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_sptr GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_make(Concurrent_Queue<int>& queue);
void msg_handler_events(pmt::pmt_t msg); void msg_handler_events(pmt::pmt_t msg);
GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx(Concurrent_Queue<int>& queue); explicit GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx(Concurrent_Queue<int>& queue);
Concurrent_Queue<int>& channel_internal_queue; Concurrent_Queue<int>& channel_internal_queue;
public: public:

View File

@ -70,7 +70,7 @@ class GlonassL2CaPcpsAcquisitionTest_msg_rx : public gr::block
private: private:
friend GlonassL2CaPcpsAcquisitionTest_msg_rx_sptr GlonassL2CaPcpsAcquisitionTest_msg_rx_make(concurrent_queue<int>& queue); friend GlonassL2CaPcpsAcquisitionTest_msg_rx_sptr GlonassL2CaPcpsAcquisitionTest_msg_rx_make(concurrent_queue<int>& queue);
void msg_handler_events(pmt::pmt_t msg); void msg_handler_events(pmt::pmt_t msg);
GlonassL2CaPcpsAcquisitionTest_msg_rx(concurrent_queue<int>& queue); explicit GlonassL2CaPcpsAcquisitionTest_msg_rx(concurrent_queue<int>& queue);
concurrent_queue<int>& channel_internal_queue; concurrent_queue<int>& channel_internal_queue;
public: public:

View File

@ -73,7 +73,7 @@ class GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx : public gr::block
private: private:
friend GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_sptr GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(Concurrent_Queue<int>& queue); friend GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_sptr GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(Concurrent_Queue<int>& queue);
void msg_handler_events(pmt::pmt_t msg); void msg_handler_events(pmt::pmt_t msg);
GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx(Concurrent_Queue<int>& queue); explicit GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx(Concurrent_Queue<int>& queue);
Concurrent_Queue<int>& channel_internal_queue; Concurrent_Queue<int>& channel_internal_queue;
public: public:

View File

@ -68,7 +68,7 @@ class GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx : public gr::block
private: private:
friend GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_sptr GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(Concurrent_Queue<int>& queue); friend GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_sptr GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(Concurrent_Queue<int>& queue);
void msg_handler_events(pmt::pmt_t msg); void msg_handler_events(pmt::pmt_t msg);
GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx(Concurrent_Queue<int>& queue); explicit GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx(Concurrent_Queue<int>& queue);
Concurrent_Queue<int>& channel_internal_queue; Concurrent_Queue<int>& channel_internal_queue;
public: public:

View File

@ -73,7 +73,7 @@ class GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx : public gr::block
private: private:
friend GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx_sptr GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx_make(Concurrent_Queue<int>& queue); friend GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx_sptr GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx_make(Concurrent_Queue<int>& queue);
void msg_handler_events(pmt::pmt_t msg); void msg_handler_events(pmt::pmt_t msg);
GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx(Concurrent_Queue<int>& queue); explicit GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx(Concurrent_Queue<int>& queue);
Concurrent_Queue<int>& channel_internal_queue; Concurrent_Queue<int>& channel_internal_queue;
public: public:

View File

@ -70,7 +70,7 @@ class GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx : public gr::block
private: private:
friend GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_sptr GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(Concurrent_Queue<int>& queue); friend GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_sptr GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(Concurrent_Queue<int>& queue);
void msg_handler_events(pmt::pmt_t msg); void msg_handler_events(pmt::pmt_t msg);
GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx(Concurrent_Queue<int>& queue); explicit GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx(Concurrent_Queue<int>& queue);
Concurrent_Queue<int>& channel_internal_queue; Concurrent_Queue<int>& channel_internal_queue;
public: public:

View File

@ -39,7 +39,7 @@
class Observables_Dump_Reader class Observables_Dump_Reader
{ {
public: public:
Observables_Dump_Reader(int n_channels); explicit Observables_Dump_Reader(int n_channels);
~Observables_Dump_Reader(); ~Observables_Dump_Reader();
bool read_binary_obs(); bool read_binary_obs();
bool restart(); bool restart();