From 0a46cb1fe1eff76d860f68ea78f46e3ba7ff6035 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 3 Dec 2018 10:05:47 +0100 Subject: [PATCH] Use nullptr --- src/algorithms/PVT/libs/rinex_printer.h | 6 +- src/algorithms/PVT/libs/rtklib_solver.cc | 4 +- ...o_e5a_noncoherent_iq_acquisition_caf_cc.cc | 26 +++---- .../galileo_pcps_8ms_acquisition_cc.cc | 4 +- .../gnuradio_blocks/pcps_acquisition.cc | 8 +-- .../pcps_acquisition_fine_doppler_cc.cc | 10 +-- .../pcps_assisted_acquisition_cc.cc | 6 +- .../pcps_cccwsr_acquisition_cc.cc | 4 +- .../pcps_quicksync_acquisition_cc.cc | 10 +-- .../pcps_tong_acquisition_cc.cc | 6 +- .../libs/rtklib/rtklib_conversions.cc | 6 +- .../libs/rtklib/rtklib_ephemeris.cc | 16 ++--- src/algorithms/libs/rtklib/rtklib_ionex.cc | 18 ++--- src/algorithms/libs/rtklib/rtklib_pntpos.cc | 4 +- src/algorithms/libs/rtklib/rtklib_ppp.cc | 14 ++-- src/algorithms/libs/rtklib/rtklib_preceph.cc | 12 ++-- src/algorithms/libs/rtklib/rtklib_rtcm.cc | 14 ++-- src/algorithms/libs/rtklib/rtklib_rtcm3.cc | 6 +- src/algorithms/libs/rtklib/rtklib_rtkcmn.cc | 72 +++++++++---------- src/algorithms/libs/rtklib/rtklib_rtkpos.cc | 30 ++++---- src/algorithms/libs/rtklib/rtklib_rtksvr.cc | 30 ++++---- src/algorithms/libs/rtklib/rtklib_sbas.cc | 6 +- src/algorithms/libs/rtklib/rtklib_solution.cc | 28 ++++---- src/algorithms/libs/rtklib/rtklib_stream.cc | 72 +++++++++---------- .../gnuradio_blocks/hybrid_observables_cc.cc | 4 +- .../gnuradio_blocks/dll_pll_veml_tracking.cc | 4 +- .../galileo_e1_tcp_connector_tracking_cc.cc | 2 +- ...glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc | 6 +- ...glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc | 6 +- .../glonass_l1_ca_dll_pll_tracking_cc.cc | 6 +- ...glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc | 6 +- ...glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc | 6 +- .../glonass_l2_ca_dll_pll_tracking_cc.cc | 6 +- .../gps_l1_ca_dll_pll_c_aid_tracking_cc.cc | 6 +- .../gps_l1_ca_dll_pll_c_aid_tracking_sc.cc | 6 +- .../gps_l1_ca_kf_tracking_cc.cc | 6 +- .../gps_l1_ca_tcp_connector_tracking_cc.cc | 2 +- src/core/receiver/control_thread.cc | 4 +- src/core/receiver/tcp_cmd_interface.cc | 6 +- src/core/system_parameters/rtcm.cc | 16 ++--- src/tests/common-files/gnuplot_i.h | 10 +-- src/tests/unit-tests/arithmetic/matio_test.cc | 22 +++--- .../libs/acquisition_dump_reader.cc | 6 +- 43 files changed, 271 insertions(+), 271 deletions(-) diff --git a/src/algorithms/PVT/libs/rinex_printer.h b/src/algorithms/PVT/libs/rinex_printer.h index dde6724a6..1f33176ff 100644 --- a/src/algorithms/PVT/libs/rinex_printer.h +++ b/src/algorithms/PVT/libs/rinex_printer.h @@ -547,7 +547,7 @@ private: */ inline double asDouble(const std::string& s) { - return strtod(s.c_str(), 0); + return strtod(s.c_str(), nullptr); } @@ -560,7 +560,7 @@ private: */ inline int64_t asInt(const std::string& s) { - return strtol(s.c_str(), 0, 10); + return strtol(s.c_str(), nullptr, 10); } @@ -796,7 +796,7 @@ inline std::string Rinex_Printer::asFixWidthString(const int x, const int width, inline int64_t asInt(const std::string& s) { - return strtol(s.c_str(), 0, 10); + return strtol(s.c_str(), nullptr, 10); } diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc index 76b8d7ada..d7eb452ac 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.cc +++ b/src/algorithms/PVT/libs/rtklib_solver.cc @@ -245,8 +245,8 @@ bool rtklib_solver::save_matfile() std::string filename = dump_filename; filename.erase(filename.length() - 4, 4); filename.append(".mat"); - matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); + if (reinterpret_cast(matfp) != nullptr) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("TOW_at_current_symbol_ms", MAT_C_UINT32, MAT_T_UINT32, 2, dims, TOW_at_current_symbol_ms, 0); diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc index fe7b70878..e87390899 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc @@ -117,8 +117,8 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit } else { - d_fft_code_Q_A = 0; - d_magnitudeQA = 0; + d_fft_code_Q_A = nullptr; + d_magnitudeQA = nullptr; } // IF COHERENT INTEGRATION TIME > 1 if (d_sampled_ms > 1) @@ -132,16 +132,16 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit } else { - d_fft_code_Q_B = 0; - d_magnitudeQB = 0; + d_fft_code_Q_B = nullptr; + d_magnitudeQB = nullptr; } } else { - d_fft_code_I_B = 0; - d_magnitudeIB = 0; - d_fft_code_Q_B = 0; - d_magnitudeQB = 0; + d_fft_code_I_B = nullptr; + d_magnitudeIB = nullptr; + d_fft_code_Q_B = nullptr; + d_magnitudeQB = nullptr; } // Direct FFT @@ -157,14 +157,14 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit d_doppler_resolution = 0; d_threshold = 0; d_doppler_step = 250; - d_grid_doppler_wipeoffs = 0; - d_gnss_synchro = 0; + d_grid_doppler_wipeoffs = nullptr; + d_gnss_synchro = nullptr; d_code_phase = 0; d_doppler_freq = 0; d_test_statistics = 0; - d_CAF_vector = 0; - d_CAF_vector_I = 0; - d_CAF_vector_Q = 0; + d_CAF_vector = nullptr; + d_CAF_vector_I = nullptr; + d_CAF_vector_Q = nullptr; d_channel = 0; d_gr_stream_buffer = 0; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc index 318f6ad46..d502c4cb2 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc @@ -92,8 +92,8 @@ galileo_pcps_8ms_acquisition_cc::galileo_pcps_8ms_acquisition_cc( d_doppler_resolution = 0; d_threshold = 0; d_doppler_step = 0; - d_grid_doppler_wipeoffs = 0; - d_gnss_synchro = 0; + d_grid_doppler_wipeoffs = nullptr; + d_gnss_synchro = nullptr; d_code_phase = 0; d_doppler_freq = 0; d_test_statistics = 0; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index 1bb4b39a7..a7df810a7 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -34,8 +34,8 @@ */ #include "pcps_acquisition.h" +#include "GLONASS_L1_L2_CA.h" // for GLONASS_TWO_PI #include "GPS_L1_CA.h" // for GPS_TWO_PI -#include "GLONASS_L1_L2_CA.h" // for GLONASS_TWO_PI" #include "gnss_sdr_create_directory.h" #include #include @@ -120,7 +120,7 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu // Inverse FFT d_ifft = new gr::fft::fft_complex(d_fft_size, false); - d_gnss_synchro = 0; + d_gnss_synchro = nullptr; d_grid_doppler_wipeoffs = nullptr; d_grid_doppler_wipeoffs_step_two = nullptr; d_magnitude_grid = nullptr; @@ -445,8 +445,8 @@ void pcps_acquisition::dump_results(int32_t effective_fft_size) filename.append(std::to_string(d_gnss_synchro->PRN)); filename.append(".mat"); - mat_t* matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (matfp == NULL) + mat_t* matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); + if (matfp == nullptr) { std::cout << "Unable to create or open Acquisition dump file" << std::endl; //acq_parameters.dump = false; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc index 894b6ef20..8b80cb3e3 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc @@ -123,9 +123,9 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con d_threshold = 0; d_num_doppler_points = 0; d_doppler_step = 0; - d_grid_data = 0; - d_grid_doppler_wipeoffs = 0; - d_gnss_synchro = 0; + d_grid_data = nullptr; + d_grid_doppler_wipeoffs = nullptr; + d_gnss_synchro = nullptr; d_code_phase = 0; d_doppler_freq = 0; d_test_statistics = 0; @@ -672,8 +672,8 @@ void pcps_acquisition_fine_doppler_cc::dump_results(int effective_fft_size) filename.append(std::to_string(d_gnss_synchro->PRN)); filename.append(".mat"); - mat_t *matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (matfp == NULL) + mat_t *matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); + if (matfp == nullptr) { std::cout << "Unable to create or open Acquisition dump file" << std::endl; d_dump = false; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc index 31c28c319..7bf74c2b0 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc @@ -97,9 +97,9 @@ pcps_assisted_acquisition_cc::pcps_assisted_acquisition_cc( d_doppler_min = 0; d_num_doppler_points = 0; d_doppler_step = 0; - d_grid_data = 0; - d_grid_doppler_wipeoffs = 0; - d_gnss_synchro = 0; + d_grid_data = nullptr; + d_grid_doppler_wipeoffs = nullptr; + d_gnss_synchro = nullptr; d_code_phase = 0; d_doppler_freq = 0; d_test_statistics = 0; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc index 34228b89b..11aaf81c1 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc @@ -103,8 +103,8 @@ pcps_cccwsr_acquisition_cc::pcps_cccwsr_acquisition_cc( d_doppler_resolution = 0; d_threshold = 0; d_doppler_step = 0; - d_grid_doppler_wipeoffs = 0; - d_gnss_synchro = 0; + d_grid_doppler_wipeoffs = nullptr; + d_gnss_synchro = nullptr; d_code_phase = 0; d_doppler_freq = 0; d_test_statistics = 0; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc index 06a91dccb..cc893cb77 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc @@ -112,16 +112,16 @@ pcps_quicksync_acquisition_cc::pcps_quicksync_acquisition_cc( d_dump = dump; d_dump_filename = dump_filename; - d_corr_acumulator = 0; - d_signal_folded = 0; + d_corr_acumulator = nullptr; + d_signal_folded = nullptr; d_code_folded = new gr_complex[d_fft_size](); d_noise_floor_power = 0; d_doppler_resolution = 0; d_threshold = 0; d_doppler_step = 0; - d_grid_doppler_wipeoffs = 0; - d_fft_if2 = 0; - d_gnss_synchro = 0; + d_grid_doppler_wipeoffs = nullptr; + d_fft_if2 = nullptr; + d_gnss_synchro = nullptr; d_code_phase = 0; d_doppler_freq = 0; d_test_statistics = 0; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc index 77a714de4..2d789b9a7 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc @@ -116,9 +116,9 @@ pcps_tong_acquisition_cc::pcps_tong_acquisition_cc( d_doppler_resolution = 0; d_threshold = 0; d_doppler_step = 0; - d_grid_data = 0; - d_grid_doppler_wipeoffs = 0; - d_gnss_synchro = 0; + d_grid_data = nullptr; + d_grid_doppler_wipeoffs = nullptr; + d_gnss_synchro = nullptr; d_code_phase = 0; d_doppler_freq = 0; d_test_statistics = 0; diff --git a/src/algorithms/libs/rtklib/rtklib_conversions.cc b/src/algorithms/libs/rtklib/rtklib_conversions.cc index 4eb8d218f..8fe890fd3 100644 --- a/src/algorithms/libs/rtklib/rtklib_conversions.cc +++ b/src/algorithms/libs/rtklib/rtklib_conversions.cc @@ -152,7 +152,7 @@ eph_t eph_to_rtklib(const Galileo_Ephemeris& gal_eph) /* adjustment for week handover */ double tow, toc; tow = time2gpst(rtklib_sat.ttr, &rtklib_sat.week); - toc = time2gpst(rtklib_sat.toc, NULL); + toc = time2gpst(rtklib_sat.toc, nullptr); if (rtklib_sat.toes < tow - 302400.0) { rtklib_sat.week++; @@ -209,7 +209,7 @@ eph_t eph_to_rtklib(const Gps_Ephemeris& gps_eph) /* adjustment for week handover */ double tow, toc; tow = time2gpst(rtklib_sat.ttr, &rtklib_sat.week); - toc = time2gpst(rtklib_sat.toc, NULL); + toc = time2gpst(rtklib_sat.toc, nullptr); if (rtklib_sat.toes < tow - 302400.0) { rtklib_sat.week++; @@ -274,7 +274,7 @@ eph_t eph_to_rtklib(const Gps_CNAV_Ephemeris& gps_cnav_eph) /* adjustment for week handover */ double tow, toc; tow = time2gpst(rtklib_sat.ttr, &rtklib_sat.week); - toc = time2gpst(rtklib_sat.toc, NULL); + toc = time2gpst(rtklib_sat.toc, nullptr); if (rtklib_sat.toes < tow - 302400.0) { rtklib_sat.week++; diff --git a/src/algorithms/libs/rtklib/rtklib_ephemeris.cc b/src/algorithms/libs/rtklib/rtklib_ephemeris.cc index eff182fbd..369448817 100644 --- a/src/algorithms/libs/rtklib/rtklib_ephemeris.cc +++ b/src/algorithms/libs/rtklib/rtklib_ephemeris.cc @@ -129,7 +129,7 @@ void alm2pos(gtime_t time, const alm_t *alm, double *rs, double *dts) rs[0] = rs[1] = rs[2] = *dts = 0.0; return; } - mu = satsys(alm->sat, NULL) == SYS_GAL ? MU_GAL : MU_GPS; + mu = satsys(alm->sat, nullptr) == SYS_GAL ? MU_GAL : MU_GPS; M = alm->M0 + sqrt(mu / (alm->A * alm->A * alm->A)) * tk; for (n = 0, E = M, Ek = 0.0; fabs(E - Ek) > RTOL_KEPLER && n < MAX_ITER_KEPLER; n++) @@ -457,7 +457,7 @@ eph_t *seleph(gtime_t time, int sat, int iode, const nav_t *nav) trace(4, "seleph : time=%s sat=%2d iode=%d\n", time_str(time, 3), sat, iode); - switch (satsys(sat, NULL)) + switch (satsys(sat, nullptr)) { case SYS_QZS: tmax = MAXDTOE_QZS + 1.0; @@ -490,7 +490,7 @@ eph_t *seleph(gtime_t time, int sat, int iode, const nav_t *nav) { trace(3, "no broadcast ephemeris: %s sat=%2d iode=%3d\n", time_str(time, 0), sat, iode); - return NULL; + return nullptr; } return nav->eph + j; } @@ -520,7 +520,7 @@ geph_t *selgeph(gtime_t time, int sat, int iode, const nav_t *nav) { trace(3, "no glonass ephemeris : %s sat=%2d iode=%2d\n", time_str(time, 0), sat, iode); - return NULL; + return nullptr; } return nav->geph + j; } @@ -547,7 +547,7 @@ seph_t *selseph(gtime_t time, int sat, const nav_t *nav) if (j < 0) { trace(3, "no sbas ephemeris : %s sat=%2d\n", time_str(time, 0), sat); - return NULL; + return nullptr; } return nav->seph + j; } @@ -564,7 +564,7 @@ int ephclk(gtime_t time, gtime_t teph, int sat, const nav_t *nav, trace(4, "ephclk : time=%s sat=%2d\n", time_str(time, 3), sat); - sys = satsys(sat, NULL); + sys = satsys(sat, nullptr); if (sys == SYS_GPS || sys == SYS_GAL || sys == SYS_QZS || sys == SYS_BDS) { @@ -600,7 +600,7 @@ int ephpos(gtime_t time, gtime_t teph, int sat, const nav_t *nav, trace(4, "ephpos : time=%s sat=%2d iode=%d\n", time_str(time, 3), sat, iode); - sys = satsys(sat, NULL); + sys = satsys(sat, nullptr); *svh = -1; @@ -738,7 +738,7 @@ int satpos_ssr(gtime_t time, gtime_t teph, int sat, const nav_t *nav, if (!ephpos(time, teph, sat, nav, ssr->iode, rs, dts, var, svh)) return 0; /* satellite clock for gps, galileo and qzss */ - sys = satsys(sat, NULL); + sys = satsys(sat, nullptr); if (sys == SYS_GPS || sys == SYS_GAL || sys == SYS_QZS || sys == SYS_BDS) { if (!(eph = seleph(teph, sat, ssr->iode, nav))) return 0; diff --git a/src/algorithms/libs/rtklib/rtklib_ionex.cc b/src/algorithms/libs/rtklib/rtklib_ionex.cc index 7790943fa..ab7747135 100644 --- a/src/algorithms/libs/rtklib/rtklib_ionex.cc +++ b/src/algorithms/libs/rtklib/rtklib_ionex.cc @@ -98,7 +98,7 @@ tec_t *addtec(const double *lats, const double *lons, const double *hgts, ndata[0] = nitem(lats); ndata[1] = nitem(lons); ndata[2] = nitem(hgts); - if (ndata[0] <= 1 || ndata[1] <= 1 || ndata[2] <= 0) return NULL; + if (ndata[0] <= 1 || ndata[1] <= 1 || ndata[2] <= 0) return nullptr; if (nav->nt >= nav->ntmax) { @@ -107,9 +107,9 @@ tec_t *addtec(const double *lats, const double *lons, const double *hgts, { trace(1, "readionex malloc error ntmax=%d\n", nav->ntmax); free(nav->tec); - nav->tec = NULL; + nav->tec = nullptr; nav->nt = nav->ntmax = 0; - return NULL; + return nullptr; } nav->tec = nav_tec; } @@ -128,7 +128,7 @@ tec_t *addtec(const double *lats, const double *lons, const double *hgts, if (!(p->data = (double *)malloc(sizeof(double) * n)) || !(p->rms = (float *)malloc(sizeof(float) * n))) { - return NULL; + return nullptr; } for (i = 0; i < n; i++) { @@ -236,7 +236,7 @@ double readionexh(FILE *fp, double *lats, double *lons, double *hgts, int readionexb(FILE *fp, const double *lats, const double *lons, const double *hgts, double rb, double nexp, nav_t *nav) { - tec_t *p = NULL; + tec_t *p = nullptr; gtime_t time = {0, 0}; double lat, lon[3], hgt, x; int i, j, k, n, m, index, type = 0; @@ -255,17 +255,17 @@ int readionexb(FILE *fp, const double *lats, const double *lons, else if (strstr(label, "END OF TEC MAP") == label) { type = 0; - p = NULL; + p = nullptr; } else if (strstr(label, "START OF RMS MAP") == label) { type = 2; - p = NULL; + p = nullptr; } else if (strstr(label, "END OF RMS MAP") == label) { type = 0; - p = NULL; + p = nullptr; } else if (strstr(label, "EPOCH OF CURRENT MAP") == label) { @@ -379,7 +379,7 @@ void readtec(const char *file, nav_t *nav, int opt) if (!opt) { free(nav->tec); - nav->tec = NULL; + nav->tec = nullptr; nav->nt = nav->ntmax = 0; } for (i = 0; i < MAXEXFILE; i++) diff --git a/src/algorithms/libs/rtklib/rtklib_pntpos.cc b/src/algorithms/libs/rtklib/rtklib_pntpos.cc index 6473b98a0..d2b4b43da 100644 --- a/src/algorithms/libs/rtklib/rtklib_pntpos.cc +++ b/src/algorithms/libs/rtklib/rtklib_pntpos.cc @@ -138,7 +138,7 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel, double gamma_ = 0.0; int i = 0; int j = 1; - int sys = satsys(obs->sat, NULL); + int sys = satsys(obs->sat, nullptr); *var = 0.0; if (sys == SYS_NONE) @@ -416,7 +416,7 @@ int rescode(int iter, const obsd_t *obs, int n, const double *rs, vsat[i] = 0; azel[i * 2] = azel[1 + i * 2] = resp[i] = 0.0; - if (!(sys = satsys(obs[i].sat, NULL))) continue; + if (!(sys = satsys(obs[i].sat, nullptr))) continue; /* reject duplicated observation data */ if (i < n - 1 && i < MAXOBS - 1 && obs[i].sat == obs[i + 1].sat) diff --git a/src/algorithms/libs/rtklib/rtklib_ppp.cc b/src/algorithms/libs/rtklib/rtklib_ppp.cc index 7ac193643..81265a9bc 100644 --- a/src/algorithms/libs/rtklib/rtklib_ppp.cc +++ b/src/algorithms/libs/rtklib/rtklib_ppp.cc @@ -187,7 +187,7 @@ void average_LC(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav __attribu if (azel[1 + 2 * i] < rtk->opt.elmin) continue; - if (satsys(sat, NULL) != SYS_GPS) continue; + if (satsys(sat, nullptr) != SYS_GPS) continue; /* triple-freq carrier and code LC (m) */ LC1 = L_LC(1, -1, 0, obs[i].L) - P_LC(1, 1, 0, obs[i].P); @@ -683,7 +683,7 @@ void testeclipse(const obsd_t *obs, int n, const nav_t *nav, double *rs) trace(3, "testeclipse:\n"); /* unit vector of sun direction (ecef) */ - sunmoonpos(gpst2utc(obs[0].time), erpv, rsun, NULL, NULL); + sunmoonpos(gpst2utc(obs[0].time), erpv, rsun, nullptr, nullptr); if (normv3(rsun, esun) == 0) trace(1, "Error computing the norm"); for (i = 0; i < n; i++) @@ -779,7 +779,7 @@ int ifmeas(const obsd_t *obs, const nav_t *nav, const double *azel, trace(4, "ifmeas :\n"); /* L1-L2 for GPS/GLO/QZS, L1-L5 for GAL/SBS */ - if (NFREQ >= 3 && (satsys(obs->sat, NULL) & (SYS_GAL | SYS_SBS))) j = 2; + if (NFREQ >= 3 && (satsys(obs->sat, nullptr) & (SYS_GAL | SYS_SBS))) j = 2; if (NFREQ < 2 || lam[i] == 0.0 || lam[j] == 0.0) return 0; @@ -817,7 +817,7 @@ int ifmeas(const obsd_t *obs, const nav_t *nav, const double *azel, if (opt->sateph == EPHOPT_SBAS) meas[1] -= P1_C1; /* sbas clock based C1 */ /* gps-glonass h/w bias correction for code */ - if (opt->exterr.ena[3] && satsys(obs->sat, NULL) == SYS_GLO) + if (opt->exterr.ena[3] && satsys(obs->sat, nullptr) == SYS_GLO) { meas[1] += c1 * opt->exterr.gpsglob[0] + c2 * opt->exterr.gpsglob[1]; } @@ -913,7 +913,7 @@ int corrmeas(const obsd_t *obs, const nav_t *nav, const double *pos, gamma = std::pow(lam[1] / lam[0], 2.0); /* f1^2/f2^2 */ P1_P2 = nav->cbias[obs->sat - 1][0]; P1_C1 = nav->cbias[obs->sat - 1][1]; - if (P1_P2 == 0.0 && (satsys(obs->sat, NULL) & (SYS_GPS | SYS_GAL | SYS_QZS))) + if (P1_P2 == 0.0 && (satsys(obs->sat, nullptr) & (SYS_GPS | SYS_GAL | SYS_QZS))) { P1_P2 = (1.0 - gamma) * gettgd_ppp(obs->sat, nav); } @@ -1124,7 +1124,7 @@ void udbias_ppp(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav) { sat = obs[i].sat; j = IB_PPP(sat, &rtk->opt); - if (!corrmeas(obs + i, nav, pos, rtk->ssat[sat - 1].azel, &rtk->opt, NULL, NULL, + if (!corrmeas(obs + i, nav, pos, rtk->ssat[sat - 1].azel, &rtk->opt, nullptr, nullptr, 0.0, meas, var, &brk)) continue; if (brk) @@ -1273,7 +1273,7 @@ int res_ppp(int iter __attribute__((unused)), const obsd_t *obs, int n, const do for (i = 0; i < n && i < MAXOBS; i++) { sat = obs[i].sat; - if (!(sys = satsys(sat, NULL)) || !rtk->ssat[sat - 1].vs) continue; + if (!(sys = satsys(sat, nullptr)) || !rtk->ssat[sat - 1].vs) continue; /* geometric distance/azimuth/elevation angle */ if ((r = geodist(rs + i * 6, rr, e)) <= 0.0 || diff --git a/src/algorithms/libs/rtklib/rtklib_preceph.cc b/src/algorithms/libs/rtklib/rtklib_preceph.cc index 293d86543..eff872781 100644 --- a/src/algorithms/libs/rtklib/rtklib_preceph.cc +++ b/src/algorithms/libs/rtklib/rtklib_preceph.cc @@ -134,7 +134,7 @@ int addpeph(nav_t *nav, peph_t *peph) { trace(1, "readsp3b malloc error n=%d\n", nav->nemax); free(nav->peph); - nav->peph = NULL; + nav->peph = nullptr; nav->ne = nav->nemax = 0; return 0; } @@ -361,7 +361,7 @@ void readsp3(const char *file, nav_t *nav, int opt) *-----------------------------------------------------------------------------*/ int readsap(const char *file, gtime_t time, nav_t *nav) { - pcvs_t pcvs = {0, 0, (pcv_t *){0}}; + pcvs_t pcvs = {0, 0, (pcv_t *){nullptr}}; pcv_t pcv0 = {0, {}, {}, {0, 0}, {0, 0}, {{}, {}}, {{}, {}}}, *pcv; int i; @@ -809,7 +809,7 @@ void satantoff(gtime_t time, const double *rs, int sat, const nav_t *nav, trace(4, "satantoff: time=%s sat=%2d\n", time_str(time, 3), sat); /* sun position in ecef */ - sunmoonpos(gpst2utc(time), erpv, rsun, NULL, &gmst); + sunmoonpos(gpst2utc(time), erpv, rsun, nullptr, &gmst); /* unit vectors of satellite fixed coordinates */ for (i = 0; i < 3; i++) r[i] = -rs[i]; @@ -820,7 +820,7 @@ void satantoff(gtime_t time, const double *rs, int sat, const nav_t *nav, if (!normv3(r, ey)) return; cross3(ey, ez, ex); - if (NFREQ >= 3 && (satsys(sat, NULL) & (SYS_GAL | SYS_SBS))) k = 2; + if (NFREQ >= 3 && (satsys(sat, nullptr) & (SYS_GAL | SYS_SBS))) k = 2; if (NFREQ < 2 || lam[j] == 0.0 || lam[k] == 0.0) return; @@ -871,8 +871,8 @@ int peph2pos(gtime_t time, int sat, const nav_t *nav, int opt, !pephclk(time, sat, nav, dtss, &varc)) return 0; time = timeadd(time, tt); - if (!pephpos(time, sat, nav, rst, dtst, NULL, NULL) || - !pephclk(time, sat, nav, dtst, NULL)) return 0; + if (!pephpos(time, sat, nav, rst, dtst, nullptr, nullptr) || + !pephclk(time, sat, nav, dtst, nullptr)) return 0; /* satellite antenna offset correction */ if (opt) diff --git a/src/algorithms/libs/rtklib/rtklib_rtcm.cc b/src/algorithms/libs/rtklib/rtklib_rtcm.cc index e122ebead..46163873e 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtcm.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtcm.cc @@ -88,7 +88,7 @@ int init_rtcm(rtcm_t *rtcm) rtcm->sta.pos[i] = rtcm->sta.del[i] = 0.0; } rtcm->sta.hgt = 0.0; - rtcm->dgps = NULL; + rtcm->dgps = nullptr; for (i = 0; i < MAXSAT; i++) { rtcm->ssr[i] = ssr0; @@ -108,9 +108,9 @@ int init_rtcm(rtcm_t *rtcm) for (i = 0; i < 100; i++) rtcm->nmsg2[i] = 0; for (i = 0; i < 300; i++) rtcm->nmsg3[i] = 0; - rtcm->obs.data = NULL; - rtcm->nav.eph = NULL; - rtcm->nav.geph = NULL; + rtcm->obs.data = nullptr; + rtcm->nav.eph = nullptr; + rtcm->nav.geph = nullptr; /* reallocate memory for observation and ephemris buffer */ if (!(rtcm->obs.data = (obsd_t *)malloc(sizeof(obsd_t) * MAXOBS)) || @@ -141,13 +141,13 @@ void free_rtcm(rtcm_t *rtcm) /* free memory for observation and ephemeris buffer */ free(rtcm->obs.data); - rtcm->obs.data = NULL; + rtcm->obs.data = nullptr; rtcm->obs.n = 0; free(rtcm->nav.eph); - rtcm->nav.eph = NULL; + rtcm->nav.eph = nullptr; rtcm->nav.n = 0; free(rtcm->nav.geph); - rtcm->nav.geph = NULL; + rtcm->nav.geph = nullptr; rtcm->nav.ng = 0; } diff --git a/src/algorithms/libs/rtklib/rtklib_rtcm3.cc b/src/algorithms/libs/rtklib/rtklib_rtcm3.cc index babc88f5f..7bbec4a14 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtcm3.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtcm3.cc @@ -2643,7 +2643,7 @@ void save_msm_obs(rtcm_t *rtcm, int sys, msm_h_t *h, const double *r, const char *sig[32]; double tt, wl; unsigned char code[32]; - char *msm_type = (char *)"", *q = NULL; + char *msm_type = (char *)"", *q = nullptr; int i, j, k, type, prn, sat, fn, index = 0, freq[32], ind[32]; type = getbitu(rtcm->buff, 24, 12); @@ -2966,7 +2966,7 @@ int decode_msm4(rtcm_t *rtcm, int sys) i += 6; } /* save obs data in msm message */ - save_msm_obs(rtcm, sys, &h, r, pr, cp, NULL, NULL, cnr, lock, NULL, half); + save_msm_obs(rtcm, sys, &h, r, pr, cp, nullptr, nullptr, cnr, lock, nullptr, half); rtcm->obsflag = !sync; return sync ? 0 : 1; @@ -3128,7 +3128,7 @@ int decode_msm6(rtcm_t *rtcm, int sys) i += 10; } /* save obs data in msm message */ - save_msm_obs(rtcm, sys, &h, r, pr, cp, NULL, NULL, cnr, lock, NULL, half); + save_msm_obs(rtcm, sys, &h, r, pr, cp, nullptr, nullptr, cnr, lock, nullptr, half); rtcm->obsflag = !sync; return sync ? 0 : 1; diff --git a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc index f7e4e76c5..a55d41b4b 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc @@ -111,7 +111,7 @@ const char *formatstrs[32] = {/* stream format strings */ "RINEX CLK", /* 18 */ "SBAS", /* 19 */ "NMEA 0183", /* 20 */ - NULL}; + nullptr}; char obscodes[][3] = { @@ -150,7 +150,7 @@ char codepris[7][MAXFREQ][16] = { }; -fatalfunc_t *fatalfunc = NULL; /* fatal callback function */ +fatalfunc_t *fatalfunc = nullptr; /* fatal callback function */ /* crc tables generated by util/gencrc ---------------------------------------*/ const unsigned short tbl_CRC16[] = { @@ -469,7 +469,7 @@ void satno2id(int sat, char *id) *-----------------------------------------------------------------------------*/ int satexclude(int sat, int svh, const prcopt_t *opt) { - int sys = satsys(sat, NULL); + int sys = satsys(sat, nullptr); if (svh < 0) { @@ -829,7 +829,7 @@ double *mat(int n, int m) { double *p; - if (n <= 0 || m <= 0) return NULL; + if (n <= 0 || m <= 0) return nullptr; if (!(p = (double *)malloc(sizeof(double) * n * m))) { fatalerr("matrix memory allocation error: n=%d,m=%d\n", n, m); @@ -847,7 +847,7 @@ int *imat(int n, int m) { int *p; - if (n <= 0 || m <= 0) return NULL; + if (n <= 0 || m <= 0) return nullptr; if (!(p = (int *)malloc(sizeof(int) * n * m))) { fatalerr("integer matrix memory allocation error: n=%d,m=%d\n", n, m); @@ -869,7 +869,7 @@ double *zeros(int n, int m) if ((p = mat(n, m))) for (n = n * m - 1; n >= 0; n--) p[n] = 0.0; #else - if (n <= 0 || m <= 0) return NULL; + if (n <= 0 || m <= 0) return nullptr; if (!(p = (double *)calloc(sizeof(double), n * m))) { fatalerr("matrix memory allocation error: n=%d,m=%d\n", n, m); @@ -1474,7 +1474,7 @@ gtime_t timeget(void) struct timeval tv; struct tm *tt; - if (!gettimeofday(&tv, NULL) && (tt = gmtime(&tv.tv_sec))) + if (!gettimeofday(&tv, nullptr) && (tt = gmtime(&tv.tv_sec))) { ep[0] = tt->tm_year + 1900; ep[1] = tt->tm_mon + 1; @@ -1777,7 +1777,7 @@ unsigned int tickget(void) } else { - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); return tv.tv_sec * 1000u + tv.tv_usec / 1000u; } #else @@ -1798,7 +1798,7 @@ void sleepms(int ms) if (ms <= 0) return; ts.tv_sec = (time_t)(ms / 1000); ts.tv_nsec = (long)(ms % 1000 * 1000000); - nanosleep(&ts, NULL); + nanosleep(&ts, nullptr); } @@ -2228,7 +2228,7 @@ int decodef(char *p, int n, double *v) int i; for (i = 0; i < n; i++) v[i] = 0.0; - for (i = 0, p = strtok(p, " "); p && i < n; p = strtok(NULL, " ")) + for (i = 0, p = strtok(p, " "); p && i < n; p = strtok(nullptr, " ")) { v[i++] = atof(p) * 1e-3; } @@ -2248,7 +2248,7 @@ void addpcv(const pcv_t *pcv, pcvs_t *pcvs) { trace(1, "addpcv: memory allocation error\n"); free(pcvs->pcv); - pcvs->pcv = NULL; + pcvs->pcv = nullptr; pcvs->n = pcvs->nmax = 0; return; } @@ -2479,8 +2479,8 @@ pcv_t *searchpcv(int sat, const char *type, gtime_t time, { trace(1, "type array is too long"); } - for (p = strtok(buff, " "); p && n < 2; p = strtok(NULL, " ")) types[n++] = p; - if (n <= 0) return NULL; + for (p = strtok(buff, " "); p && n < 2; p = strtok(nullptr, " ")) types[n++] = p; + if (n <= 0) return nullptr; /* search receiver antenna with radome at first */ for (i = 0; i < pcvs->n; i++) @@ -2500,7 +2500,7 @@ pcv_t *searchpcv(int sat, const char *type, gtime_t time, return pcv; } } - return NULL; + return nullptr; } @@ -2648,7 +2648,7 @@ int readerp(const char *file, erp_t *erp) if (!erp_data) { free(erp->data); - erp->data = NULL; + erp->data = nullptr; erp->n = erp->nmax = 0; fclose(fp); return 0; @@ -2762,7 +2762,7 @@ void uniqeph(nav_t *nav) { trace(1, "uniqeph malloc error n=%d\n", nav->n); free(nav->eph); - nav->eph = NULL; + nav->eph = nullptr; nav->n = nav->nmax = 0; return; } @@ -2808,7 +2808,7 @@ void uniqgeph(nav_t *nav) { trace(1, "uniqgeph malloc error ng=%d\n", nav->ng); free(nav->geph); - nav->geph = NULL; + nav->geph = nullptr; nav->ng = nav->ngmax = 0; return; } @@ -2853,7 +2853,7 @@ void uniqseph(nav_t *nav) { trace(1, "uniqseph malloc error ns=%d\n", nav->ns); free(nav->seph); - nav->seph = NULL; + nav->seph = nullptr; nav->ns = nav->nsmax = 0; return; } @@ -2948,7 +2948,7 @@ int sortobs(obs_t *obs) *-----------------------------------------------------------------------------*/ int screent(gtime_t time, gtime_t ts, gtime_t te, double tint) { - return (tint <= 0.0 || fmod(time2gpst(time, NULL) + DTTOL, tint) <= DTTOL * 2.0) && + return (tint <= 0.0 || fmod(time2gpst(time, nullptr) + DTTOL, tint) <= DTTOL * 2.0) && (ts.time == 0 || timediff(time, ts) >= -DTTOL) && (te.time == 0 || timediff(time, te) < DTTOL); } @@ -3104,7 +3104,7 @@ int savenav(const char *file, const nav_t *nav) void freeobs(obs_t *obs) { free(obs->data); - obs->data = NULL; + obs->data = nullptr; obs->n = obs->nmax = 0; } @@ -3124,49 +3124,49 @@ void freenav(nav_t *nav, int opt) if (opt & 0x01) { free(nav->eph); - nav->eph = NULL; + nav->eph = nullptr; nav->n = nav->nmax = 0; } if (opt & 0x02) { free(nav->geph); - nav->geph = NULL; + nav->geph = nullptr; nav->ng = nav->ngmax = 0; } if (opt & 0x04) { free(nav->seph); - nav->seph = NULL; + nav->seph = nullptr; nav->ns = nav->nsmax = 0; } if (opt & 0x08) { free(nav->peph); - nav->peph = NULL; + nav->peph = nullptr; nav->ne = nav->nemax = 0; } if (opt & 0x10) { free(nav->pclk); - nav->pclk = NULL; + nav->pclk = nullptr; nav->nc = nav->ncmax = 0; } if (opt & 0x20) { free(nav->alm); - nav->alm = NULL; + nav->alm = nullptr; nav->na = nav->namax = 0; } if (opt & 0x40) { free(nav->tec); - nav->tec = NULL; + nav->tec = nullptr; nav->nt = nav->ntmax = 0; } if (opt & 0x80) { free(nav->fcb); - nav->fcb = NULL; + nav->fcb = nullptr; nav->nf = nav->nfmax = 0; } } @@ -3175,7 +3175,7 @@ void freenav(nav_t *nav, int opt) /* debug trace functions -----------------------------------------------------*/ //#ifdef TRACE // -FILE *fp_trace = NULL; /* file pointer of trace */ +FILE *fp_trace = nullptr; /* file pointer of trace */ char file_trace[1024]; /* trace file */ static int level_trace = 0; /* level of trace */ unsigned int tick_trace = 0; /* tick time at traceopen (ms) */ @@ -3189,8 +3189,8 @@ void traceswap(void) rtk_lock(&lock_trace); - if ((int)(time2gpst(time, NULL) / INT_SWAP_TRAC) == - (int)(time2gpst(time_trace, NULL) / INT_SWAP_TRAC)) + if ((int)(time2gpst(time, nullptr) / INT_SWAP_TRAC) == + (int)(time2gpst(time_trace, nullptr) / INT_SWAP_TRAC)) { rtk_unlock(&lock_trace); return; @@ -3232,7 +3232,7 @@ void traceopen(const char *file) void traceclose(void) { if (fp_trace && fp_trace != stderr) fclose(fp_trace); - fp_trace = NULL; + fp_trace = nullptr; file_trace[0] = '\0'; } @@ -3614,7 +3614,7 @@ double satwavelen(int sat, int frq, const nav_t *nav) { const double freq_glo[] = {FREQ1_GLO, FREQ2_GLO}; const double dfrq_glo[] = {DFRQ1_GLO, DFRQ2_GLO}; - int i, sys = satsys(sat, NULL); + int i, sys = satsys(sat, nullptr); if (sys == SYS_GLO) { @@ -4132,7 +4132,7 @@ void sunmoonpos(gtime_t tutc, const double *erpv, double *rsun, tut = timeadd(tutc, erpv[2]); /* utc -> ut1 */ /* sun and moon position in eci */ - sunmoonpos_eci(tut, rsun ? rs : NULL, rmoon ? rm : NULL); + sunmoonpos_eci(tut, rsun ? rs : nullptr, rmoon ? rm : nullptr); /* eci to ecef transformation matrix */ eci2ecef(tutc, erpv, U, &gmst_); @@ -4312,7 +4312,7 @@ int expath(const char *path, char *paths[], int nmax) for (p = s1; *p; p++) *p = (char)tolower((int)*p); for (p = s2; *p; p++) *p = (char)tolower((int)*p); - for (p = s1, q = strtok_r(s2, "*", &r); q; q = strtok_r(NULL, "*", &r)) + for (p = s1, q = strtok_r(s2, "*", &r); q; q = strtok_r(nullptr, "*", &r)) { if ((p = strstr(p, q))) p += strlen(q); @@ -4355,7 +4355,7 @@ void windupcorr(gtime_t time, const double *rs, const double *rr, double *phw) trace(4, "windupcorr: time=%s\n", time_str(time, 0)); /* sun position in ecef */ - sunmoonpos(gpst2utc(time), erpv, rsun, NULL, NULL); + sunmoonpos(gpst2utc(time), erpv, rsun, nullptr, nullptr); /* unit vector satellite to receiver */ for (i = 0; i < 3; i++) r[i] = rr[i] - rs[i]; diff --git a/src/algorithms/libs/rtklib/rtklib_rtkpos.cc b/src/algorithms/libs/rtklib/rtklib_rtkpos.cc index 80c1e0f0c..ef971be0e 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkpos.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkpos.cc @@ -67,7 +67,7 @@ static int resamb_TCAR(rtk_t *rtk __attribute((unused)), const obsd_t *obs __att /* global variables ----------------------------------------------------------*/ static int statlevel = 0; /* rtk status output level (0:off) */ -static FILE *fp_stat = NULL; /* rtk status file pointer */ +static FILE *fp_stat = nullptr; /* rtk status file pointer */ static char file_stat[1024] = ""; /* rtk status file original path */ static gtime_t time_stat = {0, 0}; /* rtk status file time */ @@ -176,7 +176,7 @@ void rtkclosestat(void) trace(3, "rtkclosestat:\n"); if (fp_stat) fclose(fp_stat); - fp_stat = NULL; + fp_stat = nullptr; file_stat[0] = '\0'; statlevel = 0; } @@ -301,8 +301,8 @@ void swapsolstat(void) gtime_t time = utc2gpst(timeget()); char path[1024]; - if ((int)(time2gpst(time, NULL) / INT_SWAP_STAT) == - (int)(time2gpst(time_stat, NULL) / INT_SWAP_STAT)) + if ((int)(time2gpst(time, nullptr) / INT_SWAP_STAT) == + (int)(time2gpst(time_stat, nullptr) / INT_SWAP_STAT)) { return; } @@ -1130,7 +1130,7 @@ int zdres(int base, const obsd_t *obs, int n, const double *rs, /* troposphere delay model (hydrostatic) */ zhd = tropmodel(obs[0].time, pos, zazel, 0.0); - r += tropmapf(obs[i].time, pos, azel + i * 2, NULL) * zhd; + r += tropmapf(obs[i].time, pos, azel + i * 2, nullptr) * zhd; /* receiver antenna phase center correction */ antmodel(opt->pcvr + index, opt->antdel[index], azel + i * 2, opt->posopt[1], @@ -1308,7 +1308,7 @@ int ddres(rtk_t *rtk, const nav_t *nav, double dt, const double *x, { prcopt_t *opt = &rtk->opt; double bl, dr[3], posu[3], posr[3], didxi = 0.0, didxj = 0.0, *im; - double *tropr, *tropu, *dtdxr, *dtdxu, *Ri, *Rj, lami, lamj, fi, fj, df, *Hi = NULL; + double *tropr, *tropu, *dtdxr, *dtdxu, *Ri, *Rj, lami, lamj, fi, fj, df, *Hi = nullptr; int i, j, k, m, f, ff, nv = 0, nb[NFREQ * 4 * 2 + 2] = {0}, b = 0, sysi, sysj, nf = NF_RTK(opt); trace(3, "ddres : dt=%.1f nx=%d ns=%d\n", dt, rtk->nx, ns); @@ -1921,7 +1921,7 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr, for (i = 0; i < MAXSAT; i++) { - rtk->ssat[i].sys = satsys(i + 1, NULL); + rtk->ssat[i].sys = satsys(i + 1, nullptr); for (j = 0; j < NFREQ; j++) rtk->ssat[i].vsat[j] = rtk->ssat[i].snr[j] = 0; } /* satellite positions/clocks */ @@ -2009,7 +2009,7 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr, if (stat != SOLQ_NONE && zdres(0, obs, nu, rs, dts, svh, nav, xp, opt, 0, y, e, azel)) { /* post-fit residuals for float solution */ - nv = ddres(rtk, nav, dt, xp, Pp, sat, y, e, azel, iu, ir, ns, v, NULL, R, vflg); + nv = ddres(rtk, nav, dt, xp, Pp, sat, y, e, azel, iu, ir, ns, v, nullptr, R, vflg); /* validation of float solution */ if (valpos(rtk, v, R, vflg, nv, 4.0)) @@ -2056,7 +2056,7 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr, if (zdres(0, obs, nu, rs, dts, svh, nav, xa, opt, 0, y, e, azel)) { /* post-fit reisiduals for fixed solution */ - nv = ddres(rtk, nav, dt, xa, NULL, sat, y, e, azel, iu, ir, ns, v, NULL, R, vflg); + nv = ddres(rtk, nav, dt, xa, nullptr, sat, y, e, azel, iu, ir, ns, v, nullptr, R, vflg); /* validation of fixed solution */ if (valpos(rtk, v, R, vflg, nv, 4.0)) @@ -2181,13 +2181,13 @@ void rtkfree(rtk_t *rtk) rtk->nx = rtk->na = 0; free(rtk->x); - rtk->x = NULL; + rtk->x = nullptr; free(rtk->P); - rtk->P = NULL; + rtk->P = nullptr; free(rtk->xa); - rtk->xa = NULL; + rtk->xa = nullptr; free(rtk->Pa); - rtk->Pa = NULL; + rtk->Pa = nullptr; } @@ -2277,7 +2277,7 @@ int rtkpos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav) time = rtk->sol.time; /* previous epoch */ /* rover position by single point positioning */ - if (!pntpos(obs, nu, nav, &rtk->opt, &rtk->sol, NULL, rtk->ssat, msg)) + if (!pntpos(obs, nu, nav, &rtk->opt, &rtk->sol, nullptr, rtk->ssat, msg)) { errmsg(rtk, "point pos error (%s)\n", msg); if (!rtk->opt.dynamics) @@ -2317,7 +2317,7 @@ int rtkpos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav) { /* moving baseline */ /* estimate position/velocity of base station */ - if (!pntpos(obs + nu, nr, nav, &rtk->opt, &solb, NULL, NULL, msg)) + if (!pntpos(obs + nu, nr, nav, &rtk->opt, &solb, nullptr, nullptr, msg)) { errmsg(rtk, "base station position error (%s)\n", msg); return 0; diff --git a/src/algorithms/libs/rtklib/rtklib_rtksvr.cc b/src/algorithms/libs/rtklib/rtklib_rtksvr.cc index 052de403b..15b92416b 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtksvr.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtksvr.cc @@ -129,7 +129,7 @@ void updatesvr(rtksvr_t *svr, int ret, obs_t *obs, nav_t *nav, int sat, for (i = 0; i < obs->n; i++) { if (svr->rtk.opt.exsats[obs->data[i].sat - 1] == 1 || - !(satsys(obs->data[i].sat, NULL) & svr->rtk.opt.navsys)) continue; + !(satsys(obs->data[i].sat, nullptr) & svr->rtk.opt.navsys)) continue; svr->obs[index][iobs].data[n] = obs->data[i]; svr->obs[index][iobs].data[n++].rcv = index + 1; } @@ -291,7 +291,7 @@ int decoderaw(rtksvr_t *svr, int index) { obs_t *obs; nav_t *nav; - sbsmsg_t *sbsmsg = NULL; + sbsmsg_t *sbsmsg = nullptr; int i, ret = 0, sat, fobs = 0; tracet(4, "decoderaw: index=%d\n", index); @@ -373,8 +373,8 @@ void decodefile(rtksvr_t *svr, int index) trop_t trop0[MAXSTA] = {{{0, 0.0}, {0.0}, {0.0}}}; pppcorr_t pppcorr0 = {0, {{0}, {0}}, {{0.0}, {0.0}}, {0}, {0}, {0}, {0}, {stec0}, {trop0}}; - nav_t nav = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - {0, 0, (erpd_t *){0}}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, + nav_t nav = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + {0, 0, (erpd_t *){nullptr}}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, 0, {{0.0}, {0.0}}, {{0.0}, {0.0}}, {{{0.0}}, {{0.0}}, {{0.0}}}, {0.0}, {0.0}, {*glo_fcn}, {*pcvt0}, sbssat0, {*sbsion0}, {*dgps0}, {*ssr0}, {*lexeph0}, {{0, 0.0}, 0.0, {0.0}, {{0.0}, {0.0}}}, pppcorr0}; @@ -564,9 +564,9 @@ void *rtksvrthread(void *arg) { svr->nb[i] = svr->npb[i] = 0; free(svr->buff[i]); - svr->buff[i] = NULL; + svr->buff[i] = nullptr; free(svr->pbuf[i]); - svr->pbuf[i] = NULL; + svr->pbuf[i] = nullptr; //free_raw (svr->raw +i); free_rtcm(svr->rtcm + i); } @@ -574,9 +574,9 @@ void *rtksvrthread(void *arg) { svr->nsb[i] = 0; free(svr->sbuf[i]); - svr->sbuf[i] = NULL; + svr->sbuf[i] = nullptr; } - return 0; + return nullptr; } @@ -610,17 +610,17 @@ int rtksvrinit(rtksvr_t *svr) for (i = 0; i < 3; i++) svr->nb[i] = 0; for (i = 0; i < 2; i++) svr->nsb[i] = 0; for (i = 0; i < 3; i++) svr->npb[i] = 0; - for (i = 0; i < 3; i++) svr->buff[i] = NULL; - for (i = 0; i < 2; i++) svr->sbuf[i] = NULL; - for (i = 0; i < 3; i++) svr->pbuf[i] = NULL; + for (i = 0; i < 3; i++) svr->buff[i] = nullptr; + for (i = 0; i < 2; i++) svr->sbuf[i] = nullptr; + for (i = 0; i < 3; i++) svr->pbuf[i] = nullptr; for (i = 0; i < MAXSOLBUF; i++) svr->solbuf[i] = sol0; for (i = 0; i < 3; i++) for (j = 0; j < 10; j++) svr->nmsg[i][j] = 0; for (i = 0; i < 3; i++) svr->ftime[i] = time0; for (i = 0; i < 3; i++) svr->files[i][0] = '\0'; - svr->moni = NULL; + svr->moni = nullptr; svr->tick = 0; - svr->thread = 0; + svr->thread = nullptr; svr->cputime = svr->prcout = 0; if (!(svr->nav.eph = (eph_t *)malloc(sizeof(eph_t) * MAXSAT * 2)) || @@ -840,7 +840,7 @@ int rtksvrstart(rtksvr_t *svr, int cycle, int buffsize, int *strs, writesolhead(svr->stream + i, svr->solopt + i - 3); } /* create rtk server thread */ - if (pthread_create(&svr->thread, NULL, rtksvrthread, svr)) + if (pthread_create(&svr->thread, nullptr, rtksvrthread, svr)) { for (i = 0; i < MAXSTRRTK; i++) strclose(svr->stream + i); return 0; @@ -876,7 +876,7 @@ void rtksvrstop(rtksvr_t *svr, char **cmds) svr->state = 0; /* free rtk server thread */ - pthread_join(svr->thread, NULL); + pthread_join(svr->thread, nullptr); } diff --git a/src/algorithms/libs/rtklib/rtklib_sbas.cc b/src/algorithms/libs/rtklib/rtklib_sbas.cc index 3bd809d10..77b6a0f47 100644 --- a/src/algorithms/libs/rtklib/rtklib_sbas.cc +++ b/src/algorithms/libs/rtklib/rtklib_sbas.cc @@ -66,7 +66,7 @@ char *getfield(char *p, int pos) { for (pos--; pos > 0; pos--, p++) - if (!(p = strchr(p, ','))) return NULL; + if (!(p = strchr(p, ','))) return nullptr; return p; } @@ -579,7 +579,7 @@ void readmsgs(const char *file, int sel, gtime_t ts, gtime_t te, { trace(1, "readsbsmsg malloc error: nmax=%d\n", sbs->nmax); free(sbs->msgs); - sbs->msgs = NULL; + sbs->msgs = nullptr; sbs->n = sbs->nmax = 0; fclose(fp); return; @@ -942,7 +942,7 @@ int sbslongcorr(gtime_t time, int sat, const sbssat_t *sbssat, return 1; } /* if sbas satellite without correction, no correction applied */ - if (satsys(sat, NULL) == SYS_SBS) return 1; + if (satsys(sat, nullptr) == SYS_SBS) return 1; trace(2, "no sbas long-term correction: %s sat=%2d\n", time_str(time, 0), sat); return 0; diff --git a/src/algorithms/libs/rtklib/rtklib_solution.cc b/src/algorithms/libs/rtklib/rtklib_solution.cc index 71a25f105..be2fd368f 100644 --- a/src/algorithms/libs/rtklib/rtklib_solution.cc +++ b/src/algorithms/libs/rtklib/rtklib_solution.cc @@ -322,7 +322,7 @@ int decode_nmeagga(char **val, int n, sol_t *sol) /* decode nmea ---------------------------------------------------------------*/ int decode_nmea(char *buff, sol_t *sol) { - char *p, *q, *val[MAXFIELD] = {0}; + char *p, *q, *val[MAXFIELD] = {nullptr}; int n = 0; trace(4, "decode_nmea: buff=%s\n", buff); @@ -382,7 +382,7 @@ char *decode_soltime(char *buff, const solopt_t *opt, gtime_t *time) { *time = utc2gpst(timeadd(*time, -9 * 3600.0)); } - if (!(p = strchr(buff, ':')) || !(p = strchr(p + 1, ':'))) return NULL; + if (!(p = strchr(buff, ':')) || !(p = strchr(p + 1, ':'))) return nullptr; for (p++; isdigit((int)*p) || *p == '.';) p++; return p + len; } @@ -390,10 +390,10 @@ char *decode_soltime(char *buff, const solopt_t *opt, gtime_t *time) { if (sscanf(buff, "%lf %lf %lf %lf:%lf:%lf", v, v + 1, v + 2, v + 3, v + 4, v + 5) < 6) { - return NULL; + return nullptr; } *time = timeadd(epoch2time(v), -12.0 * 3600.0); - if (!(p = strchr(buff, ':')) || !(p = strchr(p + 1, ':'))) return NULL; + if (!(p = strchr(buff, ':')) || !(p = strchr(p + 1, ':'))) return nullptr; for (p++; isdigit((int)*p) || *p == '.';) p++; return p + len; } @@ -409,7 +409,7 @@ char *decode_soltime(char *buff, const solopt_t *opt, gtime_t *time) *time = gpst2time((int)v[0], v[1]); return p; } - return NULL; + return nullptr; } @@ -834,7 +834,7 @@ int sort_solbuf(solbuf_t *solbuf) { trace(1, "sort_solbuf: memory allocation error\n"); free(solbuf->data); - solbuf->data = NULL; + solbuf->data = nullptr; solbuf->n = solbuf->nmax = 0; return 0; } @@ -935,7 +935,7 @@ int addsol(solbuf_t *solbuf, const sol_t *sol) { trace(1, "addsol: memory allocation error\n"); free(solbuf->data); - solbuf->data = NULL; + solbuf->data = nullptr; solbuf->n = solbuf->nmax = 0; return 0; } @@ -956,7 +956,7 @@ sol_t *getsol(solbuf_t *solbuf, int index) { trace(4, "getsol: index=%d\n", index); - if (index < 0 || solbuf->n <= index) return NULL; + if (index < 0 || solbuf->n <= index) return nullptr; if ((index = solbuf->start + index) >= solbuf->nmax) { index -= solbuf->nmax; @@ -981,7 +981,7 @@ void initsolbuf(solbuf_t *solbuf, int cyclic, int nmax) solbuf->n = solbuf->nmax = solbuf->start = solbuf->end = 0; solbuf->cyclic = cyclic; solbuf->time = time0; - solbuf->data = NULL; + solbuf->data = nullptr; if (cyclic) { if (nmax <= 2) nmax = 2; @@ -1006,7 +1006,7 @@ void freesolbuf(solbuf_t *solbuf) free(solbuf->data); solbuf->n = solbuf->nmax = solbuf->start = solbuf->end = 0; - solbuf->data = NULL; + solbuf->data = nullptr; } @@ -1016,7 +1016,7 @@ void freesolstatbuf(solstatbuf_t *solstatbuf) solstatbuf->n = solstatbuf->nmax = 0; free(solstatbuf->data); - solstatbuf->data = NULL; + solstatbuf->data = nullptr; } @@ -1042,7 +1042,7 @@ int sort_solstat(solstatbuf_t *statbuf) { trace(1, "sort_solstat: memory allocation error\n"); free(statbuf->data); - statbuf->data = NULL; + statbuf->data = nullptr; statbuf->n = statbuf->nmax = 0; return 0; } @@ -1115,7 +1115,7 @@ void addsolstat(solstatbuf_t *statbuf, const solstat_t *stat) { trace(1, "addsolstat: memory allocation error\n"); free(statbuf->data); - statbuf->data = NULL; + statbuf->data = nullptr; statbuf->n = statbuf->nmax = 0; return; } @@ -1169,7 +1169,7 @@ int readsolstatt(char *files[], int nfile, gtime_t ts, gtime_t te, trace(3, "readsolstatt: nfile=%d\n", nfile); statbuf->n = statbuf->nmax = 0; - statbuf->data = NULL; + statbuf->data = nullptr; for (i = 0; i < nfile; i++) { diff --git a/src/algorithms/libs/rtklib/rtklib_stream.cc b/src/algorithms/libs/rtklib/rtklib_stream.cc index 04ae96e01..c0bf2e5bd 100644 --- a/src/algorithms/libs/rtklib/rtklib_stream.cc +++ b/src/algorithms/libs/rtklib/rtklib_stream.cc @@ -94,7 +94,7 @@ serial_t *openserial(const char *path, int mode, char *msg) int rw = 0; tracet(3, "openserial: path=%s mode=%d\n", path, mode); - if (!(serial = (serial_t *)malloc(sizeof(serial_t)))) return NULL; + if (!(serial = (serial_t *)malloc(sizeof(serial_t)))) return nullptr; if ((p = strchr((char *)path, ':'))) { @@ -112,7 +112,7 @@ serial_t *openserial(const char *path, int mode, char *msg) sprintf(msg, "bitrate error (%d)", brate); tracet(1, "openserial: %s path=%s\n", msg, path); free(serial); - return NULL; + return nullptr; } parity = (char)toupper((int)parity); @@ -135,7 +135,7 @@ serial_t *openserial(const char *path, int mode, char *msg) sprintf(msg, "device open error (%d)", errno); tracet(1, "openserial: %s dev=%s\n", msg, dev); free(serial); - return NULL; + return nullptr; } tcgetattr(serial->dev, &ios); ios.c_iflag = 0; @@ -295,7 +295,7 @@ void closefile_(file_t *file) if (file->fp_tag) fclose(file->fp_tag); if (file->fp_tmp) fclose(file->fp_tmp); if (file->fp_tag_tmp) fclose(file->fp_tag_tmp); - file->fp = file->fp_tag = file->fp_tmp = file->fp_tag_tmp = NULL; + file->fp = file->fp_tag = file->fp_tmp = file->fp_tag_tmp = nullptr; } @@ -310,7 +310,7 @@ file_t *openfile(const char *path, int mode, char *msg) tracet(3, "openfile: path=%s mode=%d\n", path, mode); - if (!(mode & (STR_MODE_R | STR_MODE_W))) return NULL; + if (!(mode & (STR_MODE_R | STR_MODE_W))) return nullptr; /* file options */ for (p = (char *)path; (p = strstr(p, "::")); p += 2) @@ -327,9 +327,9 @@ file_t *openfile(const char *path, int mode, char *msg) if (start <= 0.0) start = 0.0; if (swapintv <= 0.0) swapintv = 0.0; - if (!(file = (file_t *)malloc(sizeof(file_t)))) return NULL; + if (!(file = (file_t *)malloc(sizeof(file_t)))) return nullptr; - file->fp = file->fp_tag = file->fp_tmp = file->fp_tag_tmp = NULL; + file->fp = file->fp_tag = file->fp_tmp = file->fp_tag_tmp = nullptr; if (strlen(path) < MAXSTRPATH) strcpy(file->path, path); if ((p = strstr(file->path, "::"))) *p = '\0'; file->openpath[0] = '\0'; @@ -350,7 +350,7 @@ file_t *openfile(const char *path, int mode, char *msg) if (!openfile_(file, time, msg)) { free(file); - return NULL; + return nullptr; } return file; } @@ -399,7 +399,7 @@ void swapclose(file_t *file) tracet(3, "swapclose: fp_tmp=%d\n", file->fp_tmp); if (file->fp_tmp) fclose(file->fp_tmp); if (file->fp_tag_tmp) fclose(file->fp_tag_tmp); - file->fp_tmp = file->fp_tag_tmp = NULL; + file->fp_tmp = file->fp_tag_tmp = nullptr; } @@ -427,7 +427,7 @@ int readfile(file_t *file, unsigned char *buff, int nmax, char *msg) /* input from stdin */ FD_ZERO(&rs); FD_SET(0, &rs); - if (!select(1, &rs, NULL, NULL, &tv)) return 0; + if (!select(1, &rs, nullptr, nullptr, &tv)) return 0; if ((nr = read(0, buff, nmax)) < 0) return 0; return nr; } @@ -652,7 +652,7 @@ socket_t accept_nb(socket_t sock, struct sockaddr *addr, socklen_t *len) fd_set rs; FD_ZERO(&rs); FD_SET(sock, &rs); - if (!select(sock + 1, &rs, NULL, NULL, &tv)) return 0; + if (!select(sock + 1, &rs, nullptr, nullptr, &tv)) return 0; return accept(sock, addr, len); } @@ -673,7 +673,7 @@ int connect_nb(socket_t sock, struct sockaddr *addr, socklen_t len) FD_ZERO(&rs); FD_SET(sock, &rs); ws = rs; - if (select(sock + 1, &rs, &ws, NULL, &tv) == 0) return 0; + if (select(sock + 1, &rs, &ws, nullptr, &tv) == 0) return 0; } return 1; } @@ -686,7 +686,7 @@ int recv_nb(socket_t sock, unsigned char *buff, int n) fd_set rs; FD_ZERO(&rs); FD_SET(sock, &rs); - if (!select(sock + 1, &rs, NULL, NULL, &tv)) return 0; + if (!select(sock + 1, &rs, nullptr, nullptr, &tv)) return 0; return recv(sock, (char *)buff, n, 0); } @@ -698,7 +698,7 @@ int send_nb(socket_t sock, unsigned char *buff, int n) fd_set ws; FD_ZERO(&ws); FD_SET(sock, &ws); - if (!select(sock + 1, NULL, &ws, NULL, &tv)) return 0; + if (!select(sock + 1, nullptr, &ws, nullptr, &tv)) return 0; return send(sock, (char *)buff, n, 0); } @@ -788,20 +788,20 @@ tcpsvr_t *opentcpsvr(const char *path, char *msg) tcpsvr0 = {{0, {0}, 0, {0, 0, 0, {0}}, 0, 0, 0, 0}, {{0, {0}, 0, {0, 0, 0, {0}}, 0, 0, 0, 0}}}; tracet(3, "opentcpsvr: path=%s\n", path); - if (!(tcpsvr = (tcpsvr_t *)malloc(sizeof(tcpsvr_t)))) return NULL; + if (!(tcpsvr = (tcpsvr_t *)malloc(sizeof(tcpsvr_t)))) return nullptr; *tcpsvr = tcpsvr0; - decodetcppath(path, tcpsvr->svr.saddr, port, NULL, NULL, NULL, NULL); + decodetcppath(path, tcpsvr->svr.saddr, port, nullptr, nullptr, nullptr, nullptr); if (sscanf(port, "%d", &tcpsvr->svr.port) < 1) { sprintf(msg, "port error: %s", port); tracet(1, "opentcpsvr: port error port=%s\n", port); free(tcpsvr); - return NULL; + return nullptr; } if (!gentcp(&tcpsvr->svr, 0, msg)) { free(tcpsvr); - return NULL; + return nullptr; } tcpsvr->svr.tcon = 0; return tcpsvr; @@ -1018,15 +1018,15 @@ tcpcli_t *opentcpcli(const char *path, char *msg) tracet(3, "opentcpcli: path=%s\n", path); - if (!(tcpcli = (tcpcli_t *)malloc(sizeof(tcpcli_t)))) return NULL; + if (!(tcpcli = (tcpcli_t *)malloc(sizeof(tcpcli_t)))) return nullptr; *tcpcli = tcpcli0; - decodetcppath(path, tcpcli->svr.saddr, port, NULL, NULL, NULL, NULL); + decodetcppath(path, tcpcli->svr.saddr, port, nullptr, nullptr, nullptr, nullptr); if (sscanf(port, "%d", &tcpcli->svr.port) < 1) { sprintf(msg, "port error: %s", port); tracet(1, "opentcp: port error port=%s\n", port); free(tcpcli); - return NULL; + return nullptr; } tcpcli->svr.tcon = 0; tcpcli->toinact = toinact; @@ -1367,7 +1367,7 @@ ntrip_t *openntrip(const char *path, int type, char *msg) tracet(3, "openntrip: path=%s type=%d\n", path, type); - if (!(ntrip = (ntrip_t *)malloc(sizeof(ntrip_t)))) return NULL; + if (!(ntrip = (ntrip_t *)malloc(sizeof(ntrip_t)))) return nullptr; ntrip->state = 0; ntrip->type = type; /* 0:server, 1:client */ @@ -1402,7 +1402,7 @@ ntrip_t *openntrip(const char *path, int type, char *msg) { tracet(1, "openntrip: opentcp error\n"); free(ntrip); - return NULL; + return nullptr; } return ntrip; } @@ -1548,7 +1548,7 @@ void *ftpthread(void *arg) tracet(1, "no local directory\n"); ftp->error = 11; ftp->state = 3; - return 0; + return nullptr; } /* replace keyword in file path and local path */ time = timeadd(utc2gpst(timeget()), ftp->topts[0]); @@ -1584,7 +1584,7 @@ void *ftpthread(void *arg) strcpy(ftp->local, tmpfile); tracet(3, "ftpthread: file exists %s\n", ftp->local); ftp->state = 2; - return 0; + return nullptr; } /* proxy settings for wget (ref [2]) */ if (*proxyaddr) @@ -1633,7 +1633,7 @@ void *ftpthread(void *arg) tracet(1, "execcmd error: cmd=%s ret=%d\n", cmd, ret); ftp->error = ret; ftp->state = 3; - return 0; + return nullptr; } if (remove(errfile) != 0) trace(1, "Error removing file"); @@ -1652,14 +1652,14 @@ void *ftpthread(void *arg) tracet(1, "file uncompact error: %s\n", local); ftp->error = 12; ftp->state = 3; - return 0; + return nullptr; } } if (strlen(local) < 1024) strcpy(ftp->local, local); ftp->state = 2; /* ftp completed */ tracet(3, "ftpthread: complete cmd=%s\n", cmd); - return 0; + return nullptr; } @@ -1672,12 +1672,12 @@ ftp_t *openftp(const char *path, int type, char *msg) msg[0] = '\0'; - if (!(ftp = (ftp_t *)malloc(sizeof(ftp_t)))) return NULL; + if (!(ftp = (ftp_t *)malloc(sizeof(ftp_t)))) return nullptr; ftp->state = 0; ftp->proto = type; ftp->error = 0; - ftp->thread = 0; + ftp->thread = nullptr; ftp->local[0] = '\0'; /* decode ftp path */ @@ -1718,7 +1718,7 @@ int readftp(ftp_t *ftp, unsigned char *buff, int n, char *msg) ftp->state = 1; sprintf(msg, "%s://%s", ftp->proto ? "http" : "ftp", ftp->addr); - if (pthread_create(&ftp->thread, NULL, ftpthread, ftp)) + if (pthread_create(&ftp->thread, nullptr, ftpthread, ftp)) { tracet(1, "readftp: ftp thread create error\n"); ftp->state = 3; @@ -1786,7 +1786,7 @@ void strinit(stream_t *stream) stream->inb = stream->inr = stream->outb = stream->outr = 0; stream->tick = stream->tact = stream->inbt = stream->outbt = 0; initlock(&stream->lock); - stream->port = NULL; + stream->port = nullptr; stream->path[0] = '\0'; stream->msg[0] = '\0'; } @@ -1838,7 +1838,7 @@ int stropen(stream_t *stream, int type, int mode, const char *path) stream->tick = tickget(); stream->inbt = stream->outbt = 0; stream->msg[0] = '\0'; - stream->port = NULL; + stream->port = nullptr; switch (type) { case STR_SERIAL: @@ -1870,7 +1870,7 @@ int stropen(stream_t *stream, int type, int mode, const char *path) return 1; } stream->state = !stream->port ? -1 : 1; - return stream->port != NULL; + return stream->port != nullptr; } @@ -1923,7 +1923,7 @@ void strclose(stream_t *stream) stream->inr = stream->outr = 0; stream->path[0] = '\0'; stream->msg[0] = '\0'; - stream->port = NULL; + stream->port = nullptr; } @@ -2286,7 +2286,7 @@ int gen_hex(const char *msg, unsigned char *buff) trace(4, "gen_hex: msg=%s\n", msg); strncpy(mbuff, msg, 1023); - for (p = strtok(mbuff, " "); p && narg < 256; p = strtok(NULL, " ")) + for (p = strtok(mbuff, " "); p && narg < 256; p = strtok(nullptr, " ")) { args[narg++] = p; } diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc index ffd395462..99e495ffe 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc @@ -270,8 +270,8 @@ int32_t hybrid_observables_cc::save_matfile() filename.erase(filename.end() - 4, filename.end()); } filename.append(".mat"); - matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); + if (reinterpret_cast(matfp) != nullptr) { size_t dims[2] = {static_cast(d_nchannels_out), static_cast(num_epoch)}; matvar = Mat_VarCreate("RX_time", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, RX_time_aux, MAT_F_DONT_COPY_DATA); diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc index 0801d6862..5bfe54caf 100755 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc @@ -1171,8 +1171,8 @@ int32_t dll_pll_veml_tracking::save_matfile() std::string filename = dump_filename_; filename.erase(filename.length() - 4, 4); filename.append(".mat"); - matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); + if (reinterpret_cast(matfp) != nullptr) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_VE", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_VE, 0); diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc index ee049869d..1ae3d7fb7 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc @@ -172,7 +172,7 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc( d_carrier_lock_threshold = FLAGS_carrier_lock_th; systemName["E"] = std::string("Galileo"); - d_acquisition_gnss_synchro = 0; + d_acquisition_gnss_synchro = nullptr; d_channel = 0; d_next_rem_code_phase_samples = 0; d_acq_code_phase_samples = 0.0; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc index 2689e382f..362596385 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -185,7 +185,7 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc set_relative_rate(1.0 / static_cast(d_vector_length)); - d_acquisition_gnss_synchro = 0; + d_acquisition_gnss_synchro = nullptr; d_channel = 0; d_acq_code_phase_samples = 0.0; d_acq_carrier_doppler_hz = 0.0; @@ -456,8 +456,8 @@ int32_t glonass_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile() std::string filename = d_dump_filename; filename.erase(filename.length() - 4, 4); filename.append(".mat"); - matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); + if (reinterpret_cast(matfp) != nullptr) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc index 1c0b45b9c..5884e3704 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -183,7 +183,7 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc set_relative_rate(1.0 / static_cast(d_vector_length)); - d_acquisition_gnss_synchro = 0; + d_acquisition_gnss_synchro = nullptr; d_channel = 0; d_acq_code_phase_samples = 0.0; d_acq_carrier_doppler_hz = 0.0; @@ -410,8 +410,8 @@ int32_t glonass_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile() std::string filename = d_dump_filename; filename.erase(filename.length() - 4, 4); filename.append(".mat"); - matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); + if (reinterpret_cast(matfp) != nullptr) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc index 2050d0f1f..de72d6e77 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc @@ -154,7 +154,7 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc( systemName["R"] = std::string("Glonass"); - d_acquisition_gnss_synchro = 0; + d_acquisition_gnss_synchro = nullptr; d_channel = 0; d_acq_code_phase_samples = 0.0; d_acq_carrier_doppler_hz = 0.0; @@ -408,8 +408,8 @@ int32_t Glonass_L1_Ca_Dll_Pll_Tracking_cc::save_matfile() std::string filename = d_dump_filename; filename.erase(filename.length() - 4, 4); filename.append(".mat"); - matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); + if (reinterpret_cast(matfp) != nullptr) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc index 19c5cca3e..bd53ba4cd 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc @@ -182,7 +182,7 @@ glonass_l2_ca_dll_pll_c_aid_tracking_cc::glonass_l2_ca_dll_pll_c_aid_tracking_cc set_relative_rate(1.0 / static_cast(d_vector_length)); - d_acquisition_gnss_synchro = 0; + d_acquisition_gnss_synchro = nullptr; d_channel = 0; d_acq_code_phase_samples = 0.0; d_acq_carrier_doppler_hz = 0.0; @@ -453,8 +453,8 @@ int32_t glonass_l2_ca_dll_pll_c_aid_tracking_cc::save_matfile() std::string filename = d_dump_filename; filename.erase(filename.length() - 4, 4); filename.append(".mat"); - matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); + if (reinterpret_cast(matfp) != nullptr) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc index a02b9f358..6fcad3386 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc @@ -182,7 +182,7 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc set_relative_rate(1.0 / static_cast(d_vector_length)); - d_acquisition_gnss_synchro = 0; + d_acquisition_gnss_synchro = nullptr; d_channel = 0; d_acq_code_phase_samples = 0.0; d_acq_carrier_doppler_hz = 0.0; @@ -409,8 +409,8 @@ int32_t glonass_l2_ca_dll_pll_c_aid_tracking_sc::save_matfile() std::string filename = d_dump_filename; filename.erase(filename.length() - 4, 4); filename.append(".mat"); - matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); + if (reinterpret_cast(matfp) != nullptr) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc index e90341eac..21b0ec537 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc @@ -154,7 +154,7 @@ Glonass_L2_Ca_Dll_Pll_Tracking_cc::Glonass_L2_Ca_Dll_Pll_Tracking_cc( systemName["R"] = std::string("Glonass"); - d_acquisition_gnss_synchro = 0; + d_acquisition_gnss_synchro = nullptr; d_channel = 0; d_acq_code_phase_samples = 0.0; d_acq_carrier_doppler_hz = 0.0; @@ -408,8 +408,8 @@ int32_t Glonass_L2_Ca_Dll_Pll_Tracking_cc::save_matfile() std::string filename = d_dump_filename; filename.erase(filename.length() - 4, 4); filename.append(".mat"); - matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); + if (reinterpret_cast(matfp) != nullptr) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc index 33879066e..40269d5cb 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -175,7 +175,7 @@ gps_l1_ca_dll_pll_c_aid_tracking_cc::gps_l1_ca_dll_pll_c_aid_tracking_cc( set_relative_rate(1.0 / static_cast(d_vector_length)); - d_acquisition_gnss_synchro = 0; + d_acquisition_gnss_synchro = nullptr; d_channel = 0; d_acq_code_phase_samples = 0.0; d_acq_carrier_doppler_hz = 0.0; @@ -435,8 +435,8 @@ int32_t gps_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile() std::string filename = d_dump_filename; filename.erase(filename.length() - 4, 4); filename.append(".mat"); - matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); + if (reinterpret_cast(matfp) != nullptr) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc index b1defca22..cc510adcc 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -175,7 +175,7 @@ gps_l1_ca_dll_pll_c_aid_tracking_sc::gps_l1_ca_dll_pll_c_aid_tracking_sc( set_relative_rate(1.0 / static_cast(d_vector_length)); - d_acquisition_gnss_synchro = 0; + d_acquisition_gnss_synchro = nullptr; d_channel = 0; d_acq_code_phase_samples = 0.0; d_acq_carrier_doppler_hz = 0.0; @@ -437,8 +437,8 @@ int32_t gps_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile() std::string filename = d_dump_filename; filename.erase(filename.length() - 4, 4); filename.append(".mat"); - matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); + if (reinterpret_cast(matfp) != nullptr) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc index f277bf216..91f0eaf11 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc @@ -172,7 +172,7 @@ Gps_L1_Ca_Kf_Tracking_cc::Gps_L1_Ca_Kf_Tracking_cc( systemName["G"] = std::string("GPS"); systemName["S"] = std::string("SBAS"); - d_acquisition_gnss_synchro = 0; + d_acquisition_gnss_synchro = nullptr; d_channel = 0; d_acq_code_phase_samples = 0.0; d_acq_carrier_doppler_hz = 0.0; @@ -516,8 +516,8 @@ int32_t Gps_L1_Ca_Kf_Tracking_cc::save_matfile() std::string filename = d_dump_filename; filename.erase(filename.length() - 4, 4); filename.append(".mat"); - matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); + if (reinterpret_cast(matfp) != nullptr) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_VE", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_VE, 0); diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc index 232fc7aa8..7a936d622 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc @@ -163,7 +163,7 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc( systemName["E"] = std::string("Galileo"); systemName["C"] = std::string("Compass"); - d_acquisition_gnss_synchro = 0; + d_acquisition_gnss_synchro = nullptr; d_channel = 0; d_next_rem_code_phase_samples = 0; d_acq_code_phase_samples = 0.0; diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index 3ba722e28..a99a499dc 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -166,7 +166,7 @@ void ControlThread::init() else { // fill agnss_ref_time_ - struct tm tm = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + struct tm tm = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr}; if (strptime(ref_time_str.c_str(), "%d/%m/%Y %H:%M:%S", &tm) != nullptr) { agnss_ref_time_.d_tv_sec = timegm(&tm); @@ -876,7 +876,7 @@ std::vector> ControlThread::get_visible_sats(time std::vector visible_gps; std::vector visible_gal; std::shared_ptr pvt_ptr = flowgraph_->get_pvt(); - struct tm tstruct = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + struct tm tstruct = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr}; char buf[80]; tstruct = *gmtime(&rx_utc_time); strftime(buf, sizeof(buf), "%d/%m/%Y %H:%M:%S ", &tstruct); diff --git a/src/core/receiver/tcp_cmd_interface.cc b/src/core/receiver/tcp_cmd_interface.cc index 012d7abb7..15cba5a40 100644 --- a/src/core/receiver/tcp_cmd_interface.cc +++ b/src/core/receiver/tcp_cmd_interface.cc @@ -142,7 +142,7 @@ std::string TcpCmdInterface::status(const std::vector &commandLine &course_over_ground_deg, &UTC_time) == true) { - struct tm tstruct = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + struct tm tstruct = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr}; char buf1[80]; tstruct = *gmtime(&UTC_time); strftime(buf1, sizeof(buf1), "%d/%m/%Y %H:%M:%S", &tstruct); @@ -173,7 +173,7 @@ std::string TcpCmdInterface::hotstart(const std::vector &commandLin if (commandLine.size() > 5) { // Read commandline time parameter - struct tm tm = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + struct tm tm = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr}; if (strptime(commandLine.at(1).c_str(), "%d/%m/%Y %H:%M:%S", &tm) == nullptr) { response = "ERROR: time parameter malformed\n"; @@ -219,7 +219,7 @@ std::string TcpCmdInterface::warmstart(const std::vector &commandLi { std::string tmp_str; // Read commandline time parameter - struct tm tm = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + struct tm tm = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr}; tmp_str = commandLine.at(1) + commandLine.at(2); if (strptime(commandLine.at(1).c_str(), "%d/%m/%Y %H:%M:%S", &tm) == nullptr) { diff --git a/src/core/system_parameters/rtcm.cc b/src/core/system_parameters/rtcm.cc index 24d3417ce..33db275f8 100644 --- a/src/core/system_parameters/rtcm.cc +++ b/src/core/system_parameters/rtcm.cc @@ -288,7 +288,7 @@ uint32_t Rtcm::bin_to_uint(const std::string& s) const LOG(WARNING) << "Cannot convert to a uint32_t"; return 0; } - uint32_t reading = strtoul(s.c_str(), NULL, 2); + uint32_t reading = strtoul(s.c_str(), nullptr, 2); return reading; } @@ -312,7 +312,7 @@ int32_t Rtcm::bin_to_int(const std::string& s) const } else { - reading = strtol(s.c_str(), NULL, 2); + reading = strtol(s.c_str(), nullptr, 2); } return reading; } @@ -333,13 +333,13 @@ int32_t Rtcm::bin_to_sint(const std::string& s) const { sign = 1; // Get the magnitude of the value - reading = strtol((s.substr(1)).c_str(), NULL, 2); + reading = strtol((s.substr(1)).c_str(), nullptr, 2); } else { sign = -1; // Get the magnitude of the value - reading = strtol((s.substr(1)).c_str(), NULL, 2); + reading = strtol((s.substr(1)).c_str(), nullptr, 2); } return sign * reading; } @@ -372,11 +372,11 @@ double Rtcm::bin_to_double(const std::string& s) const original_bitset.flip(); std::string aux; to_string(original_bitset, aux); - reading_int = -(strtoll(aux.c_str(), NULL, 2) + 1); + reading_int = -(strtoll(aux.c_str(), nullptr, 2) + 1); } else { - reading_int = strtoll(s.c_str(), NULL, 2); + reading_int = strtoll(s.c_str(), nullptr, 2); } reading = static_cast(reading_int); @@ -391,7 +391,7 @@ uint64_t Rtcm::hex_to_uint(const std::string& s) const LOG(WARNING) << "Cannot convert to a uint64_t"; return 0; } - uint64_t reading = strtoul(s.c_str(), NULL, 16); + uint64_t reading = strtoul(s.c_str(), nullptr, 16); return reading; } @@ -403,7 +403,7 @@ int64_t Rtcm::hex_to_int(const std::string& s) const LOG(WARNING) << "Cannot convert to a int64_t"; return 0; } - int64_t reading = strtol(s.c_str(), NULL, 16); + int64_t reading = strtol(s.c_str(), nullptr, 16); return reading; } diff --git a/src/tests/common-files/gnuplot_i.h b/src/tests/common-files/gnuplot_i.h index 7d8b58106..28b8980c1 100644 --- a/src/tests/common-files/gnuplot_i.h +++ b/src/tests/common-files/gnuplot_i.h @@ -703,7 +703,7 @@ std::string Gnuplot::terminal_std = "aqua"; // constructor: set a style during construction // inline Gnuplot::Gnuplot(const std::string &style) - : gnucmd(NULL), valid(false), two_dim(false), nplots(0) + : gnucmd(nullptr), valid(false), two_dim(false), nplots(0) { init(); @@ -720,7 +720,7 @@ inline Gnuplot::Gnuplot(const std::vector &x, const std::string &style, const std::string &labelx, const std::string &labely) - : gnucmd(NULL), valid(false), two_dim(false), nplots(0) + : gnucmd(nullptr), valid(false), two_dim(false), nplots(0) { init(); @@ -742,7 +742,7 @@ inline Gnuplot::Gnuplot(const std::vector &x, const std::string &style, const std::string &labelx, const std::string &labely) - : gnucmd(NULL), valid(false), two_dim(false), nplots(0) + : gnucmd(nullptr), valid(false), two_dim(false), nplots(0) { init(); @@ -766,7 +766,7 @@ inline Gnuplot::Gnuplot(const std::vector &x, const std::string &labelx, const std::string &labely, const std::string &labelz) - : gnucmd(NULL), valid(false), two_dim(false), nplots(0) + : gnucmd(nullptr), valid(false), two_dim(false), nplots(0) { init(); @@ -1027,7 +1027,7 @@ bool Gnuplot::set_GNUPlotPath(const std::string &path) void Gnuplot::set_terminal_std(const std::string &type) { #if defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) - if (type.find("x11") != std::string::npos && std::getenv("DISPLAY") == NULL) + if (type.find("x11") != std::string::npos && std::getenv("DISPLAY") == nullptr) { throw GnuplotException("Can't find DISPLAY variable"); } diff --git a/src/tests/unit-tests/arithmetic/matio_test.cc b/src/tests/unit-tests/arithmetic/matio_test.cc index 0429dff75..da83cb7e3 100644 --- a/src/tests/unit-tests/arithmetic/matio_test.cc +++ b/src/tests/unit-tests/arithmetic/matio_test.cc @@ -41,13 +41,13 @@ TEST(MatioTest, WriteAndReadDoubles) mat_t *matfp; matvar_t *matvar; std::string filename = "./test.mat"; - matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - ASSERT_FALSE(reinterpret_cast(matfp) == NULL) << "Error creating .mat file"; + matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); + ASSERT_FALSE(reinterpret_cast(matfp) == nullptr) << "Error creating .mat file"; double x[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; size_t dims[2] = {10, 1}; matvar = Mat_VarCreate("x", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, x, 0); - ASSERT_FALSE(reinterpret_cast(matvar) == NULL) << "Error creating variable for ’x’"; + ASSERT_FALSE(reinterpret_cast(matvar) == nullptr) << "Error creating variable for ’x’"; Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarFree(matvar); @@ -59,10 +59,10 @@ TEST(MatioTest, WriteAndReadDoubles) matvar_t *matvar_read; matfp_read = Mat_Open(filename.c_str(), MAT_ACC_RDONLY); - ASSERT_FALSE(reinterpret_cast(matfp_read) == NULL) << "Error reading .mat file"; + ASSERT_FALSE(reinterpret_cast(matfp_read) == nullptr) << "Error reading .mat file"; matvar_read = Mat_VarReadInfo(matfp_read, "x"); - ASSERT_FALSE(reinterpret_cast(matvar_read) == NULL) << "Error reading variable in .mat file"; + ASSERT_FALSE(reinterpret_cast(matvar_read) == nullptr) << "Error reading variable in .mat file"; matvar_read = Mat_VarRead(matfp_read, "x"); double *x_read = reinterpret_cast(matvar_read->data); @@ -83,8 +83,8 @@ TEST(MatioTest, WriteAndReadGrComplex) mat_t *matfp; matvar_t *matvar1; std::string filename = "./test3.mat"; - matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - ASSERT_FALSE(reinterpret_cast(matfp) == NULL) << "Error creating .mat file"; + matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); + ASSERT_FALSE(reinterpret_cast(matfp) == nullptr) << "Error creating .mat file"; std::vector x_v = {{1, 10}, {2, 9}, {3, 8}, {4, 7}, {5, 6}, {6, -5}, {7, -4}, {8, 3}, {9, 2}, {10, 1}}; const unsigned int size = x_v.size(); @@ -101,7 +101,7 @@ TEST(MatioTest, WriteAndReadGrComplex) struct mat_complex_split_t x = {x_real, x_imag}; size_t dims[2] = {static_cast(size), 1}; matvar1 = Mat_VarCreate("x", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, &x, MAT_F_COMPLEX); - ASSERT_FALSE(reinterpret_cast(matvar1) == NULL) << "Error creating variable for ’x’"; + ASSERT_FALSE(reinterpret_cast(matvar1) == nullptr) << "Error creating variable for ’x’"; std::vector x2 = {{1.1, -10}, {2, -9}, {3, -8}, {4, -7}, {5, 6}, {6, -5}, {7, -4}, {8, 3}, {9, 2}, {10, 1}}; const unsigned int size_y = x2.size(); @@ -119,7 +119,7 @@ TEST(MatioTest, WriteAndReadGrComplex) size_t dims_y[2] = {static_cast(size_y), 1}; matvar_t *matvar2; matvar2 = Mat_VarCreate("y", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims_y, &y, MAT_F_COMPLEX); - ASSERT_FALSE(reinterpret_cast(matvar2) == NULL) << "Error creating variable for ’y’"; + ASSERT_FALSE(reinterpret_cast(matvar2) == nullptr) << "Error creating variable for ’y’"; Mat_VarWrite(matfp, matvar1, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar2, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE @@ -133,10 +133,10 @@ TEST(MatioTest, WriteAndReadGrComplex) matvar_t *matvar_read; matfp_read = Mat_Open(filename.c_str(), MAT_ACC_RDONLY); - ASSERT_FALSE(reinterpret_cast(matfp_read) == NULL) << "Error reading .mat file"; + ASSERT_FALSE(reinterpret_cast(matfp_read) == nullptr) << "Error reading .mat file"; matvar_read = Mat_VarReadInfo(matfp_read, "x"); - ASSERT_FALSE(reinterpret_cast(matvar_read) == NULL) << "Error reading variable in .mat file"; + ASSERT_FALSE(reinterpret_cast(matvar_read) == nullptr) << "Error reading variable in .mat file"; matvar_read = Mat_VarRead(matfp_read, "x"); mat_complex_split_t *x_read_st = reinterpret_cast(matvar_read->data); diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.cc b/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.cc index 4cb401ab2..43cfc8c5d 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.cc @@ -38,13 +38,13 @@ bool acquisition_dump_reader::read_binary_acq() { mat_t* matfile = Mat_Open(d_dump_filename.c_str(), MAT_ACC_RDONLY); - if (matfile == NULL) + if (matfile == nullptr) { std::cout << "¡¡¡Unreachable Acquisition dump file!!!" << std::endl; return false; } matvar_t* var_ = Mat_VarRead(matfile, "acq_grid"); - if (var_ == NULL) + if (var_ == nullptr) { std::cout << "¡¡¡Unreachable grid variable into Acquisition dump file!!!" << std::endl; Mat_Close(matfile); @@ -147,7 +147,7 @@ acquisition_dump_reader::acquisition_dump_reader(const std::string& basename, unsigned int samples_per_code_ = 0; mat_t* matfile = Mat_Open(d_dump_filename.c_str(), MAT_ACC_RDONLY); - if (matfile != NULL) + if (matfile != nullptr) { matvar_t* var_ = Mat_VarRead(matfile, "doppler_max"); doppler_max_ = *static_cast(var_->data);