1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 12:40:35 +00:00

Use nullptr

This commit is contained in:
Carles Fernandez 2018-12-03 10:05:47 +01:00
parent d4e12648b0
commit 0a46cb1fe1
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
43 changed files with 271 additions and 271 deletions

View File

@ -547,7 +547,7 @@ private:
*/ */
inline double asDouble(const std::string& s) 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) 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) inline int64_t asInt(const std::string& s)
{ {
return strtol(s.c_str(), 0, 10); return strtol(s.c_str(), nullptr, 10);
} }

View File

@ -245,8 +245,8 @@ bool rtklib_solver::save_matfile()
std::string filename = dump_filename; std::string filename = dump_filename;
filename.erase(filename.length() - 4, 4); filename.erase(filename.length() - 4, 4);
filename.append(".mat"); filename.append(".mat");
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != NULL) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("TOW_at_current_symbol_ms", MAT_C_UINT32, MAT_T_UINT32, 2, dims, TOW_at_current_symbol_ms, 0); matvar = Mat_VarCreate("TOW_at_current_symbol_ms", MAT_C_UINT32, MAT_T_UINT32, 2, dims, TOW_at_current_symbol_ms, 0);

View File

@ -117,8 +117,8 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit
} }
else else
{ {
d_fft_code_Q_A = 0; d_fft_code_Q_A = nullptr;
d_magnitudeQA = 0; d_magnitudeQA = nullptr;
} }
// IF COHERENT INTEGRATION TIME > 1 // IF COHERENT INTEGRATION TIME > 1
if (d_sampled_ms > 1) if (d_sampled_ms > 1)
@ -132,16 +132,16 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit
} }
else else
{ {
d_fft_code_Q_B = 0; d_fft_code_Q_B = nullptr;
d_magnitudeQB = 0; d_magnitudeQB = nullptr;
} }
} }
else else
{ {
d_fft_code_I_B = 0; d_fft_code_I_B = nullptr;
d_magnitudeIB = 0; d_magnitudeIB = nullptr;
d_fft_code_Q_B = 0; d_fft_code_Q_B = nullptr;
d_magnitudeQB = 0; d_magnitudeQB = nullptr;
} }
// Direct FFT // Direct FFT
@ -157,14 +157,14 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit
d_doppler_resolution = 0; d_doppler_resolution = 0;
d_threshold = 0; d_threshold = 0;
d_doppler_step = 250; d_doppler_step = 250;
d_grid_doppler_wipeoffs = 0; d_grid_doppler_wipeoffs = nullptr;
d_gnss_synchro = 0; d_gnss_synchro = nullptr;
d_code_phase = 0; d_code_phase = 0;
d_doppler_freq = 0; d_doppler_freq = 0;
d_test_statistics = 0; d_test_statistics = 0;
d_CAF_vector = 0; d_CAF_vector = nullptr;
d_CAF_vector_I = 0; d_CAF_vector_I = nullptr;
d_CAF_vector_Q = 0; d_CAF_vector_Q = nullptr;
d_channel = 0; d_channel = 0;
d_gr_stream_buffer = 0; d_gr_stream_buffer = 0;
} }

View File

@ -92,8 +92,8 @@ galileo_pcps_8ms_acquisition_cc::galileo_pcps_8ms_acquisition_cc(
d_doppler_resolution = 0; d_doppler_resolution = 0;
d_threshold = 0; d_threshold = 0;
d_doppler_step = 0; d_doppler_step = 0;
d_grid_doppler_wipeoffs = 0; d_grid_doppler_wipeoffs = nullptr;
d_gnss_synchro = 0; d_gnss_synchro = nullptr;
d_code_phase = 0; d_code_phase = 0;
d_doppler_freq = 0; d_doppler_freq = 0;
d_test_statistics = 0; d_test_statistics = 0;

View File

@ -34,8 +34,8 @@
*/ */
#include "pcps_acquisition.h" #include "pcps_acquisition.h"
#include "GLONASS_L1_L2_CA.h" // for GLONASS_TWO_PI
#include "GPS_L1_CA.h" // for GPS_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 "gnss_sdr_create_directory.h"
#include <boost/filesystem/path.hpp> #include <boost/filesystem/path.hpp>
#include <glog/logging.h> #include <glog/logging.h>
@ -120,7 +120,7 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
// Inverse FFT // Inverse FFT
d_ifft = new gr::fft::fft_complex(d_fft_size, false); 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 = nullptr;
d_grid_doppler_wipeoffs_step_two = nullptr; d_grid_doppler_wipeoffs_step_two = nullptr;
d_magnitude_grid = 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(std::to_string(d_gnss_synchro->PRN));
filename.append(".mat"); filename.append(".mat");
mat_t* matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); mat_t* matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (matfp == NULL) if (matfp == nullptr)
{ {
std::cout << "Unable to create or open Acquisition dump file" << std::endl; std::cout << "Unable to create or open Acquisition dump file" << std::endl;
//acq_parameters.dump = false; //acq_parameters.dump = false;

View File

@ -123,9 +123,9 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con
d_threshold = 0; d_threshold = 0;
d_num_doppler_points = 0; d_num_doppler_points = 0;
d_doppler_step = 0; d_doppler_step = 0;
d_grid_data = 0; d_grid_data = nullptr;
d_grid_doppler_wipeoffs = 0; d_grid_doppler_wipeoffs = nullptr;
d_gnss_synchro = 0; d_gnss_synchro = nullptr;
d_code_phase = 0; d_code_phase = 0;
d_doppler_freq = 0; d_doppler_freq = 0;
d_test_statistics = 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(std::to_string(d_gnss_synchro->PRN));
filename.append(".mat"); filename.append(".mat");
mat_t *matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); mat_t *matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (matfp == NULL) if (matfp == nullptr)
{ {
std::cout << "Unable to create or open Acquisition dump file" << std::endl; std::cout << "Unable to create or open Acquisition dump file" << std::endl;
d_dump = false; d_dump = false;

View File

@ -97,9 +97,9 @@ pcps_assisted_acquisition_cc::pcps_assisted_acquisition_cc(
d_doppler_min = 0; d_doppler_min = 0;
d_num_doppler_points = 0; d_num_doppler_points = 0;
d_doppler_step = 0; d_doppler_step = 0;
d_grid_data = 0; d_grid_data = nullptr;
d_grid_doppler_wipeoffs = 0; d_grid_doppler_wipeoffs = nullptr;
d_gnss_synchro = 0; d_gnss_synchro = nullptr;
d_code_phase = 0; d_code_phase = 0;
d_doppler_freq = 0; d_doppler_freq = 0;
d_test_statistics = 0; d_test_statistics = 0;

View File

@ -103,8 +103,8 @@ pcps_cccwsr_acquisition_cc::pcps_cccwsr_acquisition_cc(
d_doppler_resolution = 0; d_doppler_resolution = 0;
d_threshold = 0; d_threshold = 0;
d_doppler_step = 0; d_doppler_step = 0;
d_grid_doppler_wipeoffs = 0; d_grid_doppler_wipeoffs = nullptr;
d_gnss_synchro = 0; d_gnss_synchro = nullptr;
d_code_phase = 0; d_code_phase = 0;
d_doppler_freq = 0; d_doppler_freq = 0;
d_test_statistics = 0; d_test_statistics = 0;

View File

@ -112,16 +112,16 @@ pcps_quicksync_acquisition_cc::pcps_quicksync_acquisition_cc(
d_dump = dump; d_dump = dump;
d_dump_filename = dump_filename; d_dump_filename = dump_filename;
d_corr_acumulator = 0; d_corr_acumulator = nullptr;
d_signal_folded = 0; d_signal_folded = nullptr;
d_code_folded = new gr_complex[d_fft_size](); d_code_folded = new gr_complex[d_fft_size]();
d_noise_floor_power = 0; d_noise_floor_power = 0;
d_doppler_resolution = 0; d_doppler_resolution = 0;
d_threshold = 0; d_threshold = 0;
d_doppler_step = 0; d_doppler_step = 0;
d_grid_doppler_wipeoffs = 0; d_grid_doppler_wipeoffs = nullptr;
d_fft_if2 = 0; d_fft_if2 = nullptr;
d_gnss_synchro = 0; d_gnss_synchro = nullptr;
d_code_phase = 0; d_code_phase = 0;
d_doppler_freq = 0; d_doppler_freq = 0;
d_test_statistics = 0; d_test_statistics = 0;

View File

@ -116,9 +116,9 @@ pcps_tong_acquisition_cc::pcps_tong_acquisition_cc(
d_doppler_resolution = 0; d_doppler_resolution = 0;
d_threshold = 0; d_threshold = 0;
d_doppler_step = 0; d_doppler_step = 0;
d_grid_data = 0; d_grid_data = nullptr;
d_grid_doppler_wipeoffs = 0; d_grid_doppler_wipeoffs = nullptr;
d_gnss_synchro = 0; d_gnss_synchro = nullptr;
d_code_phase = 0; d_code_phase = 0;
d_doppler_freq = 0; d_doppler_freq = 0;
d_test_statistics = 0; d_test_statistics = 0;

View File

@ -152,7 +152,7 @@ eph_t eph_to_rtklib(const Galileo_Ephemeris& gal_eph)
/* adjustment for week handover */ /* adjustment for week handover */
double tow, toc; double tow, toc;
tow = time2gpst(rtklib_sat.ttr, &rtklib_sat.week); 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) if (rtklib_sat.toes < tow - 302400.0)
{ {
rtklib_sat.week++; rtklib_sat.week++;
@ -209,7 +209,7 @@ eph_t eph_to_rtklib(const Gps_Ephemeris& gps_eph)
/* adjustment for week handover */ /* adjustment for week handover */
double tow, toc; double tow, toc;
tow = time2gpst(rtklib_sat.ttr, &rtklib_sat.week); 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) if (rtklib_sat.toes < tow - 302400.0)
{ {
rtklib_sat.week++; rtklib_sat.week++;
@ -274,7 +274,7 @@ eph_t eph_to_rtklib(const Gps_CNAV_Ephemeris& gps_cnav_eph)
/* adjustment for week handover */ /* adjustment for week handover */
double tow, toc; double tow, toc;
tow = time2gpst(rtklib_sat.ttr, &rtklib_sat.week); 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) if (rtklib_sat.toes < tow - 302400.0)
{ {
rtklib_sat.week++; rtklib_sat.week++;

View File

@ -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; rs[0] = rs[1] = rs[2] = *dts = 0.0;
return; 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; 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++) 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); 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: case SYS_QZS:
tmax = MAXDTOE_QZS + 1.0; 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), trace(3, "no broadcast ephemeris: %s sat=%2d iode=%3d\n", time_str(time, 0),
sat, iode); sat, iode);
return NULL; return nullptr;
} }
return nav->eph + j; 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), trace(3, "no glonass ephemeris : %s sat=%2d iode=%2d\n", time_str(time, 0),
sat, iode); sat, iode);
return NULL; return nullptr;
} }
return nav->geph + j; return nav->geph + j;
} }
@ -547,7 +547,7 @@ seph_t *selseph(gtime_t time, int sat, const nav_t *nav)
if (j < 0) if (j < 0)
{ {
trace(3, "no sbas ephemeris : %s sat=%2d\n", time_str(time, 0), sat); trace(3, "no sbas ephemeris : %s sat=%2d\n", time_str(time, 0), sat);
return NULL; return nullptr;
} }
return nav->seph + j; 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); 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) 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); 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; *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; if (!ephpos(time, teph, sat, nav, ssr->iode, rs, dts, var, svh)) return 0;
/* satellite clock for gps, galileo and qzss */ /* 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 (sys == SYS_GPS || sys == SYS_GAL || sys == SYS_QZS || sys == SYS_BDS)
{ {
if (!(eph = seleph(teph, sat, ssr->iode, nav))) return 0; if (!(eph = seleph(teph, sat, ssr->iode, nav))) return 0;

View File

@ -98,7 +98,7 @@ tec_t *addtec(const double *lats, const double *lons, const double *hgts,
ndata[0] = nitem(lats); ndata[0] = nitem(lats);
ndata[1] = nitem(lons); ndata[1] = nitem(lons);
ndata[2] = nitem(hgts); 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) 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); trace(1, "readionex malloc error ntmax=%d\n", nav->ntmax);
free(nav->tec); free(nav->tec);
nav->tec = NULL; nav->tec = nullptr;
nav->nt = nav->ntmax = 0; nav->nt = nav->ntmax = 0;
return NULL; return nullptr;
} }
nav->tec = nav_tec; 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)) || if (!(p->data = (double *)malloc(sizeof(double) * n)) ||
!(p->rms = (float *)malloc(sizeof(float) * n))) !(p->rms = (float *)malloc(sizeof(float) * n)))
{ {
return NULL; return nullptr;
} }
for (i = 0; i < n; i++) 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, int readionexb(FILE *fp, const double *lats, const double *lons,
const double *hgts, double rb, double nexp, nav_t *nav) const double *hgts, double rb, double nexp, nav_t *nav)
{ {
tec_t *p = NULL; tec_t *p = nullptr;
gtime_t time = {0, 0}; gtime_t time = {0, 0};
double lat, lon[3], hgt, x; double lat, lon[3], hgt, x;
int i, j, k, n, m, index, type = 0; 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) else if (strstr(label, "END OF TEC MAP") == label)
{ {
type = 0; type = 0;
p = NULL; p = nullptr;
} }
else if (strstr(label, "START OF RMS MAP") == label) else if (strstr(label, "START OF RMS MAP") == label)
{ {
type = 2; type = 2;
p = NULL; p = nullptr;
} }
else if (strstr(label, "END OF RMS MAP") == label) else if (strstr(label, "END OF RMS MAP") == label)
{ {
type = 0; type = 0;
p = NULL; p = nullptr;
} }
else if (strstr(label, "EPOCH OF CURRENT MAP") == label) 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) if (!opt)
{ {
free(nav->tec); free(nav->tec);
nav->tec = NULL; nav->tec = nullptr;
nav->nt = nav->ntmax = 0; nav->nt = nav->ntmax = 0;
} }
for (i = 0; i < MAXEXFILE; i++) for (i = 0; i < MAXEXFILE; i++)

View File

@ -138,7 +138,7 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel,
double gamma_ = 0.0; double gamma_ = 0.0;
int i = 0; int i = 0;
int j = 1; int j = 1;
int sys = satsys(obs->sat, NULL); int sys = satsys(obs->sat, nullptr);
*var = 0.0; *var = 0.0;
if (sys == SYS_NONE) if (sys == SYS_NONE)
@ -416,7 +416,7 @@ int rescode(int iter, const obsd_t *obs, int n, const double *rs,
vsat[i] = 0; vsat[i] = 0;
azel[i * 2] = azel[1 + i * 2] = resp[i] = 0.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 */ /* reject duplicated observation data */
if (i < n - 1 && i < MAXOBS - 1 && obs[i].sat == obs[i + 1].sat) if (i < n - 1 && i < MAXOBS - 1 && obs[i].sat == obs[i + 1].sat)

View File

@ -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 (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) */ /* triple-freq carrier and code LC (m) */
LC1 = L_LC(1, -1, 0, obs[i].L) - P_LC(1, 1, 0, obs[i].P); 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"); trace(3, "testeclipse:\n");
/* unit vector of sun direction (ecef) */ /* 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"); if (normv3(rsun, esun) == 0) trace(1, "Error computing the norm");
for (i = 0; i < n; i++) 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"); trace(4, "ifmeas :\n");
/* L1-L2 for GPS/GLO/QZS, L1-L5 for GAL/SBS */ /* 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; 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 */ if (opt->sateph == EPHOPT_SBAS) meas[1] -= P1_C1; /* sbas clock based C1 */
/* gps-glonass h/w bias correction for code */ /* 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]; 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 */ gamma = std::pow(lam[1] / lam[0], 2.0); /* f1^2/f2^2 */
P1_P2 = nav->cbias[obs->sat - 1][0]; P1_P2 = nav->cbias[obs->sat - 1][0];
P1_C1 = nav->cbias[obs->sat - 1][1]; 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); 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; sat = obs[i].sat;
j = IB_PPP(sat, &rtk->opt); 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; 0.0, meas, var, &brk)) continue;
if (brk) 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++) for (i = 0; i < n && i < MAXOBS; i++)
{ {
sat = obs[i].sat; 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 */ /* geometric distance/azimuth/elevation angle */
if ((r = geodist(rs + i * 6, rr, e)) <= 0.0 || if ((r = geodist(rs + i * 6, rr, e)) <= 0.0 ||

View File

@ -134,7 +134,7 @@ int addpeph(nav_t *nav, peph_t *peph)
{ {
trace(1, "readsp3b malloc error n=%d\n", nav->nemax); trace(1, "readsp3b malloc error n=%d\n", nav->nemax);
free(nav->peph); free(nav->peph);
nav->peph = NULL; nav->peph = nullptr;
nav->ne = nav->nemax = 0; nav->ne = nav->nemax = 0;
return 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) 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; pcv_t pcv0 = {0, {}, {}, {0, 0}, {0, 0}, {{}, {}}, {{}, {}}}, *pcv;
int i; 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); trace(4, "satantoff: time=%s sat=%2d\n", time_str(time, 3), sat);
/* sun position in ecef */ /* sun position in ecef */
sunmoonpos(gpst2utc(time), erpv, rsun, NULL, &gmst); sunmoonpos(gpst2utc(time), erpv, rsun, nullptr, &gmst);
/* unit vectors of satellite fixed coordinates */ /* unit vectors of satellite fixed coordinates */
for (i = 0; i < 3; i++) r[i] = -rs[i]; 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; if (!normv3(r, ey)) return;
cross3(ey, ez, ex); 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; 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; !pephclk(time, sat, nav, dtss, &varc)) return 0;
time = timeadd(time, tt); time = timeadd(time, tt);
if (!pephpos(time, sat, nav, rst, dtst, NULL, NULL) || if (!pephpos(time, sat, nav, rst, dtst, nullptr, nullptr) ||
!pephclk(time, sat, nav, dtst, NULL)) return 0; !pephclk(time, sat, nav, dtst, nullptr)) return 0;
/* satellite antenna offset correction */ /* satellite antenna offset correction */
if (opt) if (opt)

View File

@ -88,7 +88,7 @@ int init_rtcm(rtcm_t *rtcm)
rtcm->sta.pos[i] = rtcm->sta.del[i] = 0.0; rtcm->sta.pos[i] = rtcm->sta.del[i] = 0.0;
} }
rtcm->sta.hgt = 0.0; rtcm->sta.hgt = 0.0;
rtcm->dgps = NULL; rtcm->dgps = nullptr;
for (i = 0; i < MAXSAT; i++) for (i = 0; i < MAXSAT; i++)
{ {
rtcm->ssr[i] = ssr0; 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 < 100; i++) rtcm->nmsg2[i] = 0;
for (i = 0; i < 300; i++) rtcm->nmsg3[i] = 0; for (i = 0; i < 300; i++) rtcm->nmsg3[i] = 0;
rtcm->obs.data = NULL; rtcm->obs.data = nullptr;
rtcm->nav.eph = NULL; rtcm->nav.eph = nullptr;
rtcm->nav.geph = NULL; rtcm->nav.geph = nullptr;
/* reallocate memory for observation and ephemris buffer */ /* reallocate memory for observation and ephemris buffer */
if (!(rtcm->obs.data = (obsd_t *)malloc(sizeof(obsd_t) * MAXOBS)) || 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 memory for observation and ephemeris buffer */
free(rtcm->obs.data); free(rtcm->obs.data);
rtcm->obs.data = NULL; rtcm->obs.data = nullptr;
rtcm->obs.n = 0; rtcm->obs.n = 0;
free(rtcm->nav.eph); free(rtcm->nav.eph);
rtcm->nav.eph = NULL; rtcm->nav.eph = nullptr;
rtcm->nav.n = 0; rtcm->nav.n = 0;
free(rtcm->nav.geph); free(rtcm->nav.geph);
rtcm->nav.geph = NULL; rtcm->nav.geph = nullptr;
rtcm->nav.ng = 0; rtcm->nav.ng = 0;
} }

View File

@ -2643,7 +2643,7 @@ void save_msm_obs(rtcm_t *rtcm, int sys, msm_h_t *h, const double *r,
const char *sig[32]; const char *sig[32];
double tt, wl; double tt, wl;
unsigned char code[32]; 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]; int i, j, k, type, prn, sat, fn, index = 0, freq[32], ind[32];
type = getbitu(rtcm->buff, 24, 12); type = getbitu(rtcm->buff, 24, 12);
@ -2966,7 +2966,7 @@ int decode_msm4(rtcm_t *rtcm, int sys)
i += 6; i += 6;
} }
/* save obs data in msm message */ /* 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; rtcm->obsflag = !sync;
return sync ? 0 : 1; return sync ? 0 : 1;
@ -3128,7 +3128,7 @@ int decode_msm6(rtcm_t *rtcm, int sys)
i += 10; i += 10;
} }
/* save obs data in msm message */ /* 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; rtcm->obsflag = !sync;
return sync ? 0 : 1; return sync ? 0 : 1;

View File

@ -111,7 +111,7 @@ const char *formatstrs[32] = {/* stream format strings */
"RINEX CLK", /* 18 */ "RINEX CLK", /* 18 */
"SBAS", /* 19 */ "SBAS", /* 19 */
"NMEA 0183", /* 20 */ "NMEA 0183", /* 20 */
NULL}; nullptr};
char obscodes[][3] = { 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 ---------------------------------------*/ /* crc tables generated by util/gencrc ---------------------------------------*/
const unsigned short tbl_CRC16[] = { 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 satexclude(int sat, int svh, const prcopt_t *opt)
{ {
int sys = satsys(sat, NULL); int sys = satsys(sat, nullptr);
if (svh < 0) if (svh < 0)
{ {
@ -829,7 +829,7 @@ double *mat(int n, int m)
{ {
double *p; double *p;
if (n <= 0 || m <= 0) return NULL; if (n <= 0 || m <= 0) return nullptr;
if (!(p = (double *)malloc(sizeof(double) * n * m))) if (!(p = (double *)malloc(sizeof(double) * n * m)))
{ {
fatalerr("matrix memory allocation error: n=%d,m=%d\n", 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; int *p;
if (n <= 0 || m <= 0) return NULL; if (n <= 0 || m <= 0) return nullptr;
if (!(p = (int *)malloc(sizeof(int) * n * m))) if (!(p = (int *)malloc(sizeof(int) * n * m)))
{ {
fatalerr("integer matrix memory allocation error: n=%d,m=%d\n", 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))) if ((p = mat(n, m)))
for (n = n * m - 1; n >= 0; n--) p[n] = 0.0; for (n = n * m - 1; n >= 0; n--) p[n] = 0.0;
#else #else
if (n <= 0 || m <= 0) return NULL; if (n <= 0 || m <= 0) return nullptr;
if (!(p = (double *)calloc(sizeof(double), n * m))) if (!(p = (double *)calloc(sizeof(double), n * m)))
{ {
fatalerr("matrix memory allocation error: n=%d,m=%d\n", 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 timeval tv;
struct tm *tt; 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[0] = tt->tm_year + 1900;
ep[1] = tt->tm_mon + 1; ep[1] = tt->tm_mon + 1;
@ -1777,7 +1777,7 @@ unsigned int tickget(void)
} }
else else
{ {
gettimeofday(&tv, NULL); gettimeofday(&tv, nullptr);
return tv.tv_sec * 1000u + tv.tv_usec / 1000u; return tv.tv_sec * 1000u + tv.tv_usec / 1000u;
} }
#else #else
@ -1798,7 +1798,7 @@ void sleepms(int ms)
if (ms <= 0) return; if (ms <= 0) return;
ts.tv_sec = (time_t)(ms / 1000); ts.tv_sec = (time_t)(ms / 1000);
ts.tv_nsec = (long)(ms % 1000 * 1000000); 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; int i;
for (i = 0; i < n; i++) v[i] = 0.0; 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; 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"); trace(1, "addpcv: memory allocation error\n");
free(pcvs->pcv); free(pcvs->pcv);
pcvs->pcv = NULL; pcvs->pcv = nullptr;
pcvs->n = pcvs->nmax = 0; pcvs->n = pcvs->nmax = 0;
return; return;
} }
@ -2479,8 +2479,8 @@ pcv_t *searchpcv(int sat, const char *type, gtime_t time,
{ {
trace(1, "type array is too long"); trace(1, "type array is too long");
} }
for (p = strtok(buff, " "); p && n < 2; p = strtok(NULL, " ")) types[n++] = p; for (p = strtok(buff, " "); p && n < 2; p = strtok(nullptr, " ")) types[n++] = p;
if (n <= 0) return NULL; if (n <= 0) return nullptr;
/* search receiver antenna with radome at first */ /* search receiver antenna with radome at first */
for (i = 0; i < pcvs->n; i++) 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 pcv;
} }
} }
return NULL; return nullptr;
} }
@ -2648,7 +2648,7 @@ int readerp(const char *file, erp_t *erp)
if (!erp_data) if (!erp_data)
{ {
free(erp->data); free(erp->data);
erp->data = NULL; erp->data = nullptr;
erp->n = erp->nmax = 0; erp->n = erp->nmax = 0;
fclose(fp); fclose(fp);
return 0; return 0;
@ -2762,7 +2762,7 @@ void uniqeph(nav_t *nav)
{ {
trace(1, "uniqeph malloc error n=%d\n", nav->n); trace(1, "uniqeph malloc error n=%d\n", nav->n);
free(nav->eph); free(nav->eph);
nav->eph = NULL; nav->eph = nullptr;
nav->n = nav->nmax = 0; nav->n = nav->nmax = 0;
return; return;
} }
@ -2808,7 +2808,7 @@ void uniqgeph(nav_t *nav)
{ {
trace(1, "uniqgeph malloc error ng=%d\n", nav->ng); trace(1, "uniqgeph malloc error ng=%d\n", nav->ng);
free(nav->geph); free(nav->geph);
nav->geph = NULL; nav->geph = nullptr;
nav->ng = nav->ngmax = 0; nav->ng = nav->ngmax = 0;
return; return;
} }
@ -2853,7 +2853,7 @@ void uniqseph(nav_t *nav)
{ {
trace(1, "uniqseph malloc error ns=%d\n", nav->ns); trace(1, "uniqseph malloc error ns=%d\n", nav->ns);
free(nav->seph); free(nav->seph);
nav->seph = NULL; nav->seph = nullptr;
nav->ns = nav->nsmax = 0; nav->ns = nav->nsmax = 0;
return; return;
} }
@ -2948,7 +2948,7 @@ int sortobs(obs_t *obs)
*-----------------------------------------------------------------------------*/ *-----------------------------------------------------------------------------*/
int screent(gtime_t time, gtime_t ts, gtime_t te, double tint) 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) && (ts.time == 0 || timediff(time, ts) >= -DTTOL) &&
(te.time == 0 || timediff(time, te) < 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) void freeobs(obs_t *obs)
{ {
free(obs->data); free(obs->data);
obs->data = NULL; obs->data = nullptr;
obs->n = obs->nmax = 0; obs->n = obs->nmax = 0;
} }
@ -3124,49 +3124,49 @@ void freenav(nav_t *nav, int opt)
if (opt & 0x01) if (opt & 0x01)
{ {
free(nav->eph); free(nav->eph);
nav->eph = NULL; nav->eph = nullptr;
nav->n = nav->nmax = 0; nav->n = nav->nmax = 0;
} }
if (opt & 0x02) if (opt & 0x02)
{ {
free(nav->geph); free(nav->geph);
nav->geph = NULL; nav->geph = nullptr;
nav->ng = nav->ngmax = 0; nav->ng = nav->ngmax = 0;
} }
if (opt & 0x04) if (opt & 0x04)
{ {
free(nav->seph); free(nav->seph);
nav->seph = NULL; nav->seph = nullptr;
nav->ns = nav->nsmax = 0; nav->ns = nav->nsmax = 0;
} }
if (opt & 0x08) if (opt & 0x08)
{ {
free(nav->peph); free(nav->peph);
nav->peph = NULL; nav->peph = nullptr;
nav->ne = nav->nemax = 0; nav->ne = nav->nemax = 0;
} }
if (opt & 0x10) if (opt & 0x10)
{ {
free(nav->pclk); free(nav->pclk);
nav->pclk = NULL; nav->pclk = nullptr;
nav->nc = nav->ncmax = 0; nav->nc = nav->ncmax = 0;
} }
if (opt & 0x20) if (opt & 0x20)
{ {
free(nav->alm); free(nav->alm);
nav->alm = NULL; nav->alm = nullptr;
nav->na = nav->namax = 0; nav->na = nav->namax = 0;
} }
if (opt & 0x40) if (opt & 0x40)
{ {
free(nav->tec); free(nav->tec);
nav->tec = NULL; nav->tec = nullptr;
nav->nt = nav->ntmax = 0; nav->nt = nav->ntmax = 0;
} }
if (opt & 0x80) if (opt & 0x80)
{ {
free(nav->fcb); free(nav->fcb);
nav->fcb = NULL; nav->fcb = nullptr;
nav->nf = nav->nfmax = 0; nav->nf = nav->nfmax = 0;
} }
} }
@ -3175,7 +3175,7 @@ void freenav(nav_t *nav, int opt)
/* debug trace functions -----------------------------------------------------*/ /* debug trace functions -----------------------------------------------------*/
//#ifdef TRACE //#ifdef TRACE
// //
FILE *fp_trace = NULL; /* file pointer of trace */ FILE *fp_trace = nullptr; /* file pointer of trace */
char file_trace[1024]; /* trace file */ char file_trace[1024]; /* trace file */
static int level_trace = 0; /* level of trace */ static int level_trace = 0; /* level of trace */
unsigned int tick_trace = 0; /* tick time at traceopen (ms) */ unsigned int tick_trace = 0; /* tick time at traceopen (ms) */
@ -3189,8 +3189,8 @@ void traceswap(void)
rtk_lock(&lock_trace); rtk_lock(&lock_trace);
if ((int)(time2gpst(time, NULL) / INT_SWAP_TRAC) == if ((int)(time2gpst(time, nullptr) / INT_SWAP_TRAC) ==
(int)(time2gpst(time_trace, NULL) / INT_SWAP_TRAC)) (int)(time2gpst(time_trace, nullptr) / INT_SWAP_TRAC))
{ {
rtk_unlock(&lock_trace); rtk_unlock(&lock_trace);
return; return;
@ -3232,7 +3232,7 @@ void traceopen(const char *file)
void traceclose(void) void traceclose(void)
{ {
if (fp_trace && fp_trace != stderr) fclose(fp_trace); if (fp_trace && fp_trace != stderr) fclose(fp_trace);
fp_trace = NULL; fp_trace = nullptr;
file_trace[0] = '\0'; 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 freq_glo[] = {FREQ1_GLO, FREQ2_GLO};
const double dfrq_glo[] = {DFRQ1_GLO, DFRQ2_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) 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 */ tut = timeadd(tutc, erpv[2]); /* utc -> ut1 */
/* sun and moon position in eci */ /* 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 */ /* eci to ecef transformation matrix */
eci2ecef(tutc, erpv, U, &gmst_); 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 = s1; *p; p++) *p = (char)tolower((int)*p);
for (p = s2; *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))) if ((p = strstr(p, q)))
p += strlen(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)); trace(4, "windupcorr: time=%s\n", time_str(time, 0));
/* sun position in ecef */ /* sun position in ecef */
sunmoonpos(gpst2utc(time), erpv, rsun, NULL, NULL); sunmoonpos(gpst2utc(time), erpv, rsun, nullptr, nullptr);
/* unit vector satellite to receiver */ /* unit vector satellite to receiver */
for (i = 0; i < 3; i++) r[i] = rr[i] - rs[i]; for (i = 0; i < 3; i++) r[i] = rr[i] - rs[i];

View File

@ -67,7 +67,7 @@ static int resamb_TCAR(rtk_t *rtk __attribute((unused)), const obsd_t *obs __att
/* global variables ----------------------------------------------------------*/ /* global variables ----------------------------------------------------------*/
static int statlevel = 0; /* rtk status output level (0:off) */ 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 char file_stat[1024] = ""; /* rtk status file original path */
static gtime_t time_stat = {0, 0}; /* rtk status file time */ static gtime_t time_stat = {0, 0}; /* rtk status file time */
@ -176,7 +176,7 @@ void rtkclosestat(void)
trace(3, "rtkclosestat:\n"); trace(3, "rtkclosestat:\n");
if (fp_stat) fclose(fp_stat); if (fp_stat) fclose(fp_stat);
fp_stat = NULL; fp_stat = nullptr;
file_stat[0] = '\0'; file_stat[0] = '\0';
statlevel = 0; statlevel = 0;
} }
@ -301,8 +301,8 @@ void swapsolstat(void)
gtime_t time = utc2gpst(timeget()); gtime_t time = utc2gpst(timeget());
char path[1024]; char path[1024];
if ((int)(time2gpst(time, NULL) / INT_SWAP_STAT) == if ((int)(time2gpst(time, nullptr) / INT_SWAP_STAT) ==
(int)(time2gpst(time_stat, NULL) / INT_SWAP_STAT)) (int)(time2gpst(time_stat, nullptr) / INT_SWAP_STAT))
{ {
return; return;
} }
@ -1130,7 +1130,7 @@ int zdres(int base, const obsd_t *obs, int n, const double *rs,
/* troposphere delay model (hydrostatic) */ /* troposphere delay model (hydrostatic) */
zhd = tropmodel(obs[0].time, pos, zazel, 0.0); 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 */ /* receiver antenna phase center correction */
antmodel(opt->pcvr + index, opt->antdel[index], azel + i * 2, opt->posopt[1], 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; prcopt_t *opt = &rtk->opt;
double bl, dr[3], posu[3], posr[3], didxi = 0.0, didxj = 0.0, *im; 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); 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); 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++) 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; for (j = 0; j < NFREQ; j++) rtk->ssat[i].vsat[j] = rtk->ssat[i].snr[j] = 0;
} }
/* satellite positions/clocks */ /* 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)) if (stat != SOLQ_NONE && zdres(0, obs, nu, rs, dts, svh, nav, xp, opt, 0, y, e, azel))
{ {
/* post-fit residuals for float solution */ /* 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 */ /* validation of float solution */
if (valpos(rtk, v, R, vflg, nv, 4.0)) 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)) if (zdres(0, obs, nu, rs, dts, svh, nav, xa, opt, 0, y, e, azel))
{ {
/* post-fit reisiduals for fixed solution */ /* 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 */ /* validation of fixed solution */
if (valpos(rtk, v, R, vflg, nv, 4.0)) if (valpos(rtk, v, R, vflg, nv, 4.0))
@ -2181,13 +2181,13 @@ void rtkfree(rtk_t *rtk)
rtk->nx = rtk->na = 0; rtk->nx = rtk->na = 0;
free(rtk->x); free(rtk->x);
rtk->x = NULL; rtk->x = nullptr;
free(rtk->P); free(rtk->P);
rtk->P = NULL; rtk->P = nullptr;
free(rtk->xa); free(rtk->xa);
rtk->xa = NULL; rtk->xa = nullptr;
free(rtk->Pa); 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 */ time = rtk->sol.time; /* previous epoch */
/* rover position by single point positioning */ /* 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); errmsg(rtk, "point pos error (%s)\n", msg);
if (!rtk->opt.dynamics) 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 */ { /* moving baseline */
/* estimate position/velocity of base station */ /* 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); errmsg(rtk, "base station position error (%s)\n", msg);
return 0; return 0;

View File

@ -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++) for (i = 0; i < obs->n; i++)
{ {
if (svr->rtk.opt.exsats[obs->data[i].sat - 1] == 1 || 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] = obs->data[i];
svr->obs[index][iobs].data[n++].rcv = index + 1; svr->obs[index][iobs].data[n++].rcv = index + 1;
} }
@ -291,7 +291,7 @@ int decoderaw(rtksvr_t *svr, int index)
{ {
obs_t *obs; obs_t *obs;
nav_t *nav; nav_t *nav;
sbsmsg_t *sbsmsg = NULL; sbsmsg_t *sbsmsg = nullptr;
int i, ret = 0, sat, fobs = 0; int i, ret = 0, sat, fobs = 0;
tracet(4, "decoderaw: index=%d\n", index); 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}}}; 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}}; 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, 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 *){0}}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {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}, {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}, {*glo_fcn}, {*pcvt0}, sbssat0, {*sbsion0}, {*dgps0}, {*ssr0}, {*lexeph0},
{{0, 0.0}, 0.0, {0.0}, {{0.0}, {0.0}}}, pppcorr0}; {{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; svr->nb[i] = svr->npb[i] = 0;
free(svr->buff[i]); free(svr->buff[i]);
svr->buff[i] = NULL; svr->buff[i] = nullptr;
free(svr->pbuf[i]); free(svr->pbuf[i]);
svr->pbuf[i] = NULL; svr->pbuf[i] = nullptr;
//free_raw (svr->raw +i); //free_raw (svr->raw +i);
free_rtcm(svr->rtcm + i); free_rtcm(svr->rtcm + i);
} }
@ -574,9 +574,9 @@ void *rtksvrthread(void *arg)
{ {
svr->nsb[i] = 0; svr->nsb[i] = 0;
free(svr->sbuf[i]); 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 < 3; i++) svr->nb[i] = 0;
for (i = 0; i < 2; i++) svr->nsb[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->npb[i] = 0;
for (i = 0; i < 3; i++) svr->buff[i] = NULL; for (i = 0; i < 3; i++) svr->buff[i] = nullptr;
for (i = 0; i < 2; i++) svr->sbuf[i] = NULL; for (i = 0; i < 2; i++) svr->sbuf[i] = nullptr;
for (i = 0; i < 3; i++) svr->pbuf[i] = NULL; for (i = 0; i < 3; i++) svr->pbuf[i] = nullptr;
for (i = 0; i < MAXSOLBUF; i++) svr->solbuf[i] = sol0; for (i = 0; i < MAXSOLBUF; i++) svr->solbuf[i] = sol0;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
for (j = 0; j < 10; j++) svr->nmsg[i][j] = 0; 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->ftime[i] = time0;
for (i = 0; i < 3; i++) svr->files[i][0] = '\0'; for (i = 0; i < 3; i++) svr->files[i][0] = '\0';
svr->moni = NULL; svr->moni = nullptr;
svr->tick = 0; svr->tick = 0;
svr->thread = 0; svr->thread = nullptr;
svr->cputime = svr->prcout = 0; svr->cputime = svr->prcout = 0;
if (!(svr->nav.eph = (eph_t *)malloc(sizeof(eph_t) * MAXSAT * 2)) || 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); writesolhead(svr->stream + i, svr->solopt + i - 3);
} }
/* create rtk server thread */ /* 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); for (i = 0; i < MAXSTRRTK; i++) strclose(svr->stream + i);
return 0; return 0;
@ -876,7 +876,7 @@ void rtksvrstop(rtksvr_t *svr, char **cmds)
svr->state = 0; svr->state = 0;
/* free rtk server thread */ /* free rtk server thread */
pthread_join(svr->thread, NULL); pthread_join(svr->thread, nullptr);
} }

View File

@ -66,7 +66,7 @@
char *getfield(char *p, int pos) char *getfield(char *p, int pos)
{ {
for (pos--; pos > 0; pos--, p++) for (pos--; pos > 0; pos--, p++)
if (!(p = strchr(p, ','))) return NULL; if (!(p = strchr(p, ','))) return nullptr;
return p; 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); trace(1, "readsbsmsg malloc error: nmax=%d\n", sbs->nmax);
free(sbs->msgs); free(sbs->msgs);
sbs->msgs = NULL; sbs->msgs = nullptr;
sbs->n = sbs->nmax = 0; sbs->n = sbs->nmax = 0;
fclose(fp); fclose(fp);
return; return;
@ -942,7 +942,7 @@ int sbslongcorr(gtime_t time, int sat, const sbssat_t *sbssat,
return 1; return 1;
} }
/* if sbas satellite without correction, no correction applied */ /* 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); trace(2, "no sbas long-term correction: %s sat=%2d\n", time_str(time, 0), sat);
return 0; return 0;

View File

@ -322,7 +322,7 @@ int decode_nmeagga(char **val, int n, sol_t *sol)
/* decode nmea ---------------------------------------------------------------*/ /* decode nmea ---------------------------------------------------------------*/
int decode_nmea(char *buff, sol_t *sol) int decode_nmea(char *buff, sol_t *sol)
{ {
char *p, *q, *val[MAXFIELD] = {0}; char *p, *q, *val[MAXFIELD] = {nullptr};
int n = 0; int n = 0;
trace(4, "decode_nmea: buff=%s\n", buff); 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)); *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++; for (p++; isdigit((int)*p) || *p == '.';) p++;
return p + len; 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) 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); *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++; for (p++; isdigit((int)*p) || *p == '.';) p++;
return p + len; 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]); *time = gpst2time((int)v[0], v[1]);
return p; return p;
} }
return NULL; return nullptr;
} }
@ -834,7 +834,7 @@ int sort_solbuf(solbuf_t *solbuf)
{ {
trace(1, "sort_solbuf: memory allocation error\n"); trace(1, "sort_solbuf: memory allocation error\n");
free(solbuf->data); free(solbuf->data);
solbuf->data = NULL; solbuf->data = nullptr;
solbuf->n = solbuf->nmax = 0; solbuf->n = solbuf->nmax = 0;
return 0; return 0;
} }
@ -935,7 +935,7 @@ int addsol(solbuf_t *solbuf, const sol_t *sol)
{ {
trace(1, "addsol: memory allocation error\n"); trace(1, "addsol: memory allocation error\n");
free(solbuf->data); free(solbuf->data);
solbuf->data = NULL; solbuf->data = nullptr;
solbuf->n = solbuf->nmax = 0; solbuf->n = solbuf->nmax = 0;
return 0; return 0;
} }
@ -956,7 +956,7 @@ sol_t *getsol(solbuf_t *solbuf, int index)
{ {
trace(4, "getsol: index=%d\n", 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) if ((index = solbuf->start + index) >= solbuf->nmax)
{ {
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->n = solbuf->nmax = solbuf->start = solbuf->end = 0;
solbuf->cyclic = cyclic; solbuf->cyclic = cyclic;
solbuf->time = time0; solbuf->time = time0;
solbuf->data = NULL; solbuf->data = nullptr;
if (cyclic) if (cyclic)
{ {
if (nmax <= 2) nmax = 2; if (nmax <= 2) nmax = 2;
@ -1006,7 +1006,7 @@ void freesolbuf(solbuf_t *solbuf)
free(solbuf->data); free(solbuf->data);
solbuf->n = solbuf->nmax = solbuf->start = solbuf->end = 0; 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; solstatbuf->n = solstatbuf->nmax = 0;
free(solstatbuf->data); 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"); trace(1, "sort_solstat: memory allocation error\n");
free(statbuf->data); free(statbuf->data);
statbuf->data = NULL; statbuf->data = nullptr;
statbuf->n = statbuf->nmax = 0; statbuf->n = statbuf->nmax = 0;
return 0; return 0;
} }
@ -1115,7 +1115,7 @@ void addsolstat(solstatbuf_t *statbuf, const solstat_t *stat)
{ {
trace(1, "addsolstat: memory allocation error\n"); trace(1, "addsolstat: memory allocation error\n");
free(statbuf->data); free(statbuf->data);
statbuf->data = NULL; statbuf->data = nullptr;
statbuf->n = statbuf->nmax = 0; statbuf->n = statbuf->nmax = 0;
return; return;
} }
@ -1169,7 +1169,7 @@ int readsolstatt(char *files[], int nfile, gtime_t ts, gtime_t te,
trace(3, "readsolstatt: nfile=%d\n", nfile); trace(3, "readsolstatt: nfile=%d\n", nfile);
statbuf->n = statbuf->nmax = 0; statbuf->n = statbuf->nmax = 0;
statbuf->data = NULL; statbuf->data = nullptr;
for (i = 0; i < nfile; i++) for (i = 0; i < nfile; i++)
{ {

View File

@ -94,7 +94,7 @@ serial_t *openserial(const char *path, int mode, char *msg)
int rw = 0; int rw = 0;
tracet(3, "openserial: path=%s mode=%d\n", path, mode); 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, ':'))) 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); sprintf(msg, "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 NULL; return nullptr;
} }
parity = (char)toupper((int)parity); 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); sprintf(msg, "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 NULL; return nullptr;
} }
tcgetattr(serial->dev, &ios); tcgetattr(serial->dev, &ios);
ios.c_iflag = 0; ios.c_iflag = 0;
@ -295,7 +295,7 @@ void closefile_(file_t *file)
if (file->fp_tag) fclose(file->fp_tag); if (file->fp_tag) fclose(file->fp_tag);
if (file->fp_tmp) fclose(file->fp_tmp); if (file->fp_tmp) fclose(file->fp_tmp);
if (file->fp_tag_tmp) fclose(file->fp_tag_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); 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 */ /* file options */
for (p = (char *)path; (p = strstr(p, "::")); p += 2) 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 (start <= 0.0) start = 0.0;
if (swapintv <= 0.0) swapintv = 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 (strlen(path) < MAXSTRPATH) strcpy(file->path, path);
if ((p = strstr(file->path, "::"))) *p = '\0'; if ((p = strstr(file->path, "::"))) *p = '\0';
file->openpath[0] = '\0'; file->openpath[0] = '\0';
@ -350,7 +350,7 @@ file_t *openfile(const char *path, int mode, char *msg)
if (!openfile_(file, time, msg)) if (!openfile_(file, time, msg))
{ {
free(file); free(file);
return NULL; return nullptr;
} }
return file; return file;
} }
@ -399,7 +399,7 @@ void swapclose(file_t *file)
tracet(3, "swapclose: fp_tmp=%d\n", file->fp_tmp); tracet(3, "swapclose: fp_tmp=%d\n", file->fp_tmp);
if (file->fp_tmp) fclose(file->fp_tmp); if (file->fp_tmp) fclose(file->fp_tmp);
if (file->fp_tag_tmp) fclose(file->fp_tag_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 */ /* input from stdin */
FD_ZERO(&rs); FD_ZERO(&rs);
FD_SET(0, &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; if ((nr = read(0, buff, nmax)) < 0) return 0;
return nr; return nr;
} }
@ -652,7 +652,7 @@ socket_t accept_nb(socket_t sock, struct sockaddr *addr, socklen_t *len)
fd_set rs; fd_set rs;
FD_ZERO(&rs); FD_ZERO(&rs);
FD_SET(sock, &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); 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_ZERO(&rs);
FD_SET(sock, &rs); FD_SET(sock, &rs);
ws = 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; return 1;
} }
@ -686,7 +686,7 @@ int recv_nb(socket_t sock, unsigned char *buff, int n)
fd_set rs; fd_set rs;
FD_ZERO(&rs); FD_ZERO(&rs);
FD_SET(sock, &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); 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_set ws;
FD_ZERO(&ws); FD_ZERO(&ws);
FD_SET(sock, &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); 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}}}; 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); 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; *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) if (sscanf(port, "%d", &tcpsvr->svr.port) < 1)
{ {
sprintf(msg, "port error: %s", port); sprintf(msg, "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 NULL; return nullptr;
} }
if (!gentcp(&tcpsvr->svr, 0, msg)) if (!gentcp(&tcpsvr->svr, 0, msg))
{ {
free(tcpsvr); free(tcpsvr);
return NULL; return nullptr;
} }
tcpsvr->svr.tcon = 0; tcpsvr->svr.tcon = 0;
return tcpsvr; return tcpsvr;
@ -1018,15 +1018,15 @@ tcpcli_t *opentcpcli(const char *path, char *msg)
tracet(3, "opentcpcli: path=%s\n", path); 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; *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) if (sscanf(port, "%d", &tcpcli->svr.port) < 1)
{ {
sprintf(msg, "port error: %s", port); sprintf(msg, "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 NULL; return nullptr;
} }
tcpcli->svr.tcon = 0; tcpcli->svr.tcon = 0;
tcpcli->toinact = toinact; 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); 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->state = 0;
ntrip->type = type; /* 0:server, 1:client */ 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"); tracet(1, "openntrip: opentcp error\n");
free(ntrip); free(ntrip);
return NULL; return nullptr;
} }
return ntrip; return ntrip;
} }
@ -1548,7 +1548,7 @@ void *ftpthread(void *arg)
tracet(1, "no local directory\n"); tracet(1, "no local directory\n");
ftp->error = 11; ftp->error = 11;
ftp->state = 3; ftp->state = 3;
return 0; return nullptr;
} }
/* replace keyword in file path and local path */ /* replace keyword in file path and local path */
time = timeadd(utc2gpst(timeget()), ftp->topts[0]); time = timeadd(utc2gpst(timeget()), ftp->topts[0]);
@ -1584,7 +1584,7 @@ void *ftpthread(void *arg)
strcpy(ftp->local, tmpfile); strcpy(ftp->local, tmpfile);
tracet(3, "ftpthread: file exists %s\n", ftp->local); tracet(3, "ftpthread: file exists %s\n", ftp->local);
ftp->state = 2; ftp->state = 2;
return 0; return nullptr;
} }
/* proxy settings for wget (ref [2]) */ /* proxy settings for wget (ref [2]) */
if (*proxyaddr) if (*proxyaddr)
@ -1633,7 +1633,7 @@ void *ftpthread(void *arg)
tracet(1, "execcmd error: cmd=%s ret=%d\n", cmd, ret); tracet(1, "execcmd error: cmd=%s ret=%d\n", cmd, ret);
ftp->error = ret; ftp->error = ret;
ftp->state = 3; ftp->state = 3;
return 0; return nullptr;
} }
if (remove(errfile) != 0) trace(1, "Error removing file"); 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); tracet(1, "file uncompact error: %s\n", local);
ftp->error = 12; ftp->error = 12;
ftp->state = 3; ftp->state = 3;
return 0; return nullptr;
} }
} }
if (strlen(local) < 1024) strcpy(ftp->local, local); if (strlen(local) < 1024) strcpy(ftp->local, local);
ftp->state = 2; /* ftp completed */ ftp->state = 2; /* ftp completed */
tracet(3, "ftpthread: complete cmd=%s\n", cmd); 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'; 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->state = 0;
ftp->proto = type; ftp->proto = type;
ftp->error = 0; ftp->error = 0;
ftp->thread = 0; ftp->thread = nullptr;
ftp->local[0] = '\0'; ftp->local[0] = '\0';
/* decode ftp path */ /* decode ftp path */
@ -1718,7 +1718,7 @@ int readftp(ftp_t *ftp, unsigned char *buff, int n, char *msg)
ftp->state = 1; ftp->state = 1;
sprintf(msg, "%s://%s", ftp->proto ? "http" : "ftp", ftp->addr); 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"); tracet(1, "readftp: ftp thread create error\n");
ftp->state = 3; ftp->state = 3;
@ -1786,7 +1786,7 @@ void strinit(stream_t *stream)
stream->inb = stream->inr = stream->outb = stream->outr = 0; stream->inb = stream->inr = stream->outb = stream->outr = 0;
stream->tick = stream->tact = stream->inbt = stream->outbt = 0; stream->tick = stream->tact = stream->inbt = stream->outbt = 0;
initlock(&stream->lock); initlock(&stream->lock);
stream->port = NULL; stream->port = nullptr;
stream->path[0] = '\0'; stream->path[0] = '\0';
stream->msg[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->tick = tickget();
stream->inbt = stream->outbt = 0; stream->inbt = stream->outbt = 0;
stream->msg[0] = '\0'; stream->msg[0] = '\0';
stream->port = NULL; stream->port = nullptr;
switch (type) switch (type)
{ {
case STR_SERIAL: case STR_SERIAL:
@ -1870,7 +1870,7 @@ int stropen(stream_t *stream, int type, int mode, const char *path)
return 1; return 1;
} }
stream->state = !stream->port ? -1 : 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->inr = stream->outr = 0;
stream->path[0] = '\0'; stream->path[0] = '\0';
stream->msg[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); trace(4, "gen_hex: msg=%s\n", msg);
strncpy(mbuff, msg, 1023); 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; args[narg++] = p;
} }

View File

@ -270,8 +270,8 @@ int32_t hybrid_observables_cc::save_matfile()
filename.erase(filename.end() - 4, filename.end()); filename.erase(filename.end() - 4, filename.end());
} }
filename.append(".mat"); filename.append(".mat");
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != NULL) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {static_cast<size_t>(d_nchannels_out), static_cast<size_t>(num_epoch)}; size_t dims[2] = {static_cast<size_t>(d_nchannels_out), static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("RX_time", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, RX_time_aux, MAT_F_DONT_COPY_DATA); matvar = Mat_VarCreate("RX_time", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, RX_time_aux, MAT_F_DONT_COPY_DATA);

View File

@ -1171,8 +1171,8 @@ int32_t dll_pll_veml_tracking::save_matfile()
std::string filename = dump_filename_; std::string filename = dump_filename_;
filename.erase(filename.length() - 4, 4); filename.erase(filename.length() - 4, 4);
filename.append(".mat"); filename.append(".mat");
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != NULL) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("abs_VE", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_VE, 0); matvar = Mat_VarCreate("abs_VE", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_VE, 0);

View File

@ -172,7 +172,7 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc(
d_carrier_lock_threshold = FLAGS_carrier_lock_th; d_carrier_lock_threshold = FLAGS_carrier_lock_th;
systemName["E"] = std::string("Galileo"); systemName["E"] = std::string("Galileo");
d_acquisition_gnss_synchro = 0; d_acquisition_gnss_synchro = nullptr;
d_channel = 0; d_channel = 0;
d_next_rem_code_phase_samples = 0; d_next_rem_code_phase_samples = 0;
d_acq_code_phase_samples = 0.0; d_acq_code_phase_samples = 0.0;

View File

@ -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<double>(d_vector_length)); set_relative_rate(1.0 / static_cast<double>(d_vector_length));
d_acquisition_gnss_synchro = 0; d_acquisition_gnss_synchro = nullptr;
d_channel = 0; d_channel = 0;
d_acq_code_phase_samples = 0.0; d_acq_code_phase_samples = 0.0;
d_acq_carrier_doppler_hz = 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; std::string filename = d_dump_filename;
filename.erase(filename.length() - 4, 4); filename.erase(filename.length() - 4, 4);
filename.append(".mat"); filename.append(".mat");
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != NULL) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0);

View File

@ -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<double>(d_vector_length)); set_relative_rate(1.0 / static_cast<double>(d_vector_length));
d_acquisition_gnss_synchro = 0; d_acquisition_gnss_synchro = nullptr;
d_channel = 0; d_channel = 0;
d_acq_code_phase_samples = 0.0; d_acq_code_phase_samples = 0.0;
d_acq_carrier_doppler_hz = 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; std::string filename = d_dump_filename;
filename.erase(filename.length() - 4, 4); filename.erase(filename.length() - 4, 4);
filename.append(".mat"); filename.append(".mat");
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != NULL) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0);

View File

@ -154,7 +154,7 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc(
systemName["R"] = std::string("Glonass"); systemName["R"] = std::string("Glonass");
d_acquisition_gnss_synchro = 0; d_acquisition_gnss_synchro = nullptr;
d_channel = 0; d_channel = 0;
d_acq_code_phase_samples = 0.0; d_acq_code_phase_samples = 0.0;
d_acq_carrier_doppler_hz = 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; std::string filename = d_dump_filename;
filename.erase(filename.length() - 4, 4); filename.erase(filename.length() - 4, 4);
filename.append(".mat"); filename.append(".mat");
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != NULL) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0);

View File

@ -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<double>(d_vector_length)); set_relative_rate(1.0 / static_cast<double>(d_vector_length));
d_acquisition_gnss_synchro = 0; d_acquisition_gnss_synchro = nullptr;
d_channel = 0; d_channel = 0;
d_acq_code_phase_samples = 0.0; d_acq_code_phase_samples = 0.0;
d_acq_carrier_doppler_hz = 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; std::string filename = d_dump_filename;
filename.erase(filename.length() - 4, 4); filename.erase(filename.length() - 4, 4);
filename.append(".mat"); filename.append(".mat");
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != NULL) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0);

View File

@ -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<double>(d_vector_length)); set_relative_rate(1.0 / static_cast<double>(d_vector_length));
d_acquisition_gnss_synchro = 0; d_acquisition_gnss_synchro = nullptr;
d_channel = 0; d_channel = 0;
d_acq_code_phase_samples = 0.0; d_acq_code_phase_samples = 0.0;
d_acq_carrier_doppler_hz = 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; std::string filename = d_dump_filename;
filename.erase(filename.length() - 4, 4); filename.erase(filename.length() - 4, 4);
filename.append(".mat"); filename.append(".mat");
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != NULL) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0);

View File

@ -154,7 +154,7 @@ Glonass_L2_Ca_Dll_Pll_Tracking_cc::Glonass_L2_Ca_Dll_Pll_Tracking_cc(
systemName["R"] = std::string("Glonass"); systemName["R"] = std::string("Glonass");
d_acquisition_gnss_synchro = 0; d_acquisition_gnss_synchro = nullptr;
d_channel = 0; d_channel = 0;
d_acq_code_phase_samples = 0.0; d_acq_code_phase_samples = 0.0;
d_acq_carrier_doppler_hz = 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; std::string filename = d_dump_filename;
filename.erase(filename.length() - 4, 4); filename.erase(filename.length() - 4, 4);
filename.append(".mat"); filename.append(".mat");
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != NULL) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0);

View File

@ -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<double>(d_vector_length)); set_relative_rate(1.0 / static_cast<double>(d_vector_length));
d_acquisition_gnss_synchro = 0; d_acquisition_gnss_synchro = nullptr;
d_channel = 0; d_channel = 0;
d_acq_code_phase_samples = 0.0; d_acq_code_phase_samples = 0.0;
d_acq_carrier_doppler_hz = 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; std::string filename = d_dump_filename;
filename.erase(filename.length() - 4, 4); filename.erase(filename.length() - 4, 4);
filename.append(".mat"); filename.append(".mat");
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != NULL) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0);

View File

@ -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<double>(d_vector_length)); set_relative_rate(1.0 / static_cast<double>(d_vector_length));
d_acquisition_gnss_synchro = 0; d_acquisition_gnss_synchro = nullptr;
d_channel = 0; d_channel = 0;
d_acq_code_phase_samples = 0.0; d_acq_code_phase_samples = 0.0;
d_acq_carrier_doppler_hz = 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; std::string filename = d_dump_filename;
filename.erase(filename.length() - 4, 4); filename.erase(filename.length() - 4, 4);
filename.append(".mat"); filename.append(".mat");
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != NULL) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0);

View File

@ -172,7 +172,7 @@ Gps_L1_Ca_Kf_Tracking_cc::Gps_L1_Ca_Kf_Tracking_cc(
systemName["G"] = std::string("GPS"); systemName["G"] = std::string("GPS");
systemName["S"] = std::string("SBAS"); systemName["S"] = std::string("SBAS");
d_acquisition_gnss_synchro = 0; d_acquisition_gnss_synchro = nullptr;
d_channel = 0; d_channel = 0;
d_acq_code_phase_samples = 0.0; d_acq_code_phase_samples = 0.0;
d_acq_carrier_doppler_hz = 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; std::string filename = d_dump_filename;
filename.erase(filename.length() - 4, 4); filename.erase(filename.length() - 4, 4);
filename.append(".mat"); filename.append(".mat");
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<long *>(matfp) != NULL) if (reinterpret_cast<long *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("abs_VE", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_VE, 0); matvar = Mat_VarCreate("abs_VE", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_VE, 0);

View File

@ -163,7 +163,7 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc(
systemName["E"] = std::string("Galileo"); systemName["E"] = std::string("Galileo");
systemName["C"] = std::string("Compass"); systemName["C"] = std::string("Compass");
d_acquisition_gnss_synchro = 0; d_acquisition_gnss_synchro = nullptr;
d_channel = 0; d_channel = 0;
d_next_rem_code_phase_samples = 0; d_next_rem_code_phase_samples = 0;
d_acq_code_phase_samples = 0.0; d_acq_code_phase_samples = 0.0;

View File

@ -166,7 +166,7 @@ void ControlThread::init()
else else
{ {
// fill agnss_ref_time_ // 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) if (strptime(ref_time_str.c_str(), "%d/%m/%Y %H:%M:%S", &tm) != nullptr)
{ {
agnss_ref_time_.d_tv_sec = timegm(&tm); agnss_ref_time_.d_tv_sec = timegm(&tm);
@ -876,7 +876,7 @@ std::vector<std::pair<int, Gnss_Satellite>> ControlThread::get_visible_sats(time
std::vector<unsigned int> visible_gps; std::vector<unsigned int> visible_gps;
std::vector<unsigned int> visible_gal; std::vector<unsigned int> visible_gal;
std::shared_ptr<PvtInterface> pvt_ptr = flowgraph_->get_pvt(); std::shared_ptr<PvtInterface> 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]; char buf[80];
tstruct = *gmtime(&rx_utc_time); tstruct = *gmtime(&rx_utc_time);
strftime(buf, sizeof(buf), "%d/%m/%Y %H:%M:%S ", &tstruct); strftime(buf, sizeof(buf), "%d/%m/%Y %H:%M:%S ", &tstruct);

View File

@ -142,7 +142,7 @@ std::string TcpCmdInterface::status(const std::vector<std::string> &commandLine
&course_over_ground_deg, &course_over_ground_deg,
&UTC_time) == true) &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]; char buf1[80];
tstruct = *gmtime(&UTC_time); tstruct = *gmtime(&UTC_time);
strftime(buf1, sizeof(buf1), "%d/%m/%Y %H:%M:%S", &tstruct); strftime(buf1, sizeof(buf1), "%d/%m/%Y %H:%M:%S", &tstruct);
@ -173,7 +173,7 @@ std::string TcpCmdInterface::hotstart(const std::vector<std::string> &commandLin
if (commandLine.size() > 5) if (commandLine.size() > 5)
{ {
// Read commandline time parameter // 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) if (strptime(commandLine.at(1).c_str(), "%d/%m/%Y %H:%M:%S", &tm) == nullptr)
{ {
response = "ERROR: time parameter malformed\n"; response = "ERROR: time parameter malformed\n";
@ -219,7 +219,7 @@ std::string TcpCmdInterface::warmstart(const std::vector<std::string> &commandLi
{ {
std::string tmp_str; std::string tmp_str;
// Read commandline time parameter // 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); tmp_str = commandLine.at(1) + commandLine.at(2);
if (strptime(commandLine.at(1).c_str(), "%d/%m/%Y %H:%M:%S", &tm) == nullptr) if (strptime(commandLine.at(1).c_str(), "%d/%m/%Y %H:%M:%S", &tm) == nullptr)
{ {

View File

@ -288,7 +288,7 @@ uint32_t Rtcm::bin_to_uint(const std::string& s) const
LOG(WARNING) << "Cannot convert to a uint32_t"; LOG(WARNING) << "Cannot convert to a uint32_t";
return 0; return 0;
} }
uint32_t reading = strtoul(s.c_str(), NULL, 2); uint32_t reading = strtoul(s.c_str(), nullptr, 2);
return reading; return reading;
} }
@ -312,7 +312,7 @@ int32_t Rtcm::bin_to_int(const std::string& s) const
} }
else else
{ {
reading = strtol(s.c_str(), NULL, 2); reading = strtol(s.c_str(), nullptr, 2);
} }
return reading; return reading;
} }
@ -333,13 +333,13 @@ int32_t Rtcm::bin_to_sint(const std::string& s) const
{ {
sign = 1; sign = 1;
// Get the magnitude of the value // 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 else
{ {
sign = -1; sign = -1;
// Get the magnitude of the value // 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; return sign * reading;
} }
@ -372,11 +372,11 @@ double Rtcm::bin_to_double(const std::string& s) const
original_bitset.flip(); original_bitset.flip();
std::string aux; std::string aux;
to_string(original_bitset, 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 else
{ {
reading_int = strtoll(s.c_str(), NULL, 2); reading_int = strtoll(s.c_str(), nullptr, 2);
} }
reading = static_cast<double>(reading_int); reading = static_cast<double>(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"; LOG(WARNING) << "Cannot convert to a uint64_t";
return 0; return 0;
} }
uint64_t reading = strtoul(s.c_str(), NULL, 16); uint64_t reading = strtoul(s.c_str(), nullptr, 16);
return reading; 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"; LOG(WARNING) << "Cannot convert to a int64_t";
return 0; return 0;
} }
int64_t reading = strtol(s.c_str(), NULL, 16); int64_t reading = strtol(s.c_str(), nullptr, 16);
return reading; return reading;
} }

View File

@ -703,7 +703,7 @@ std::string Gnuplot::terminal_std = "aqua";
// constructor: set a style during construction // constructor: set a style during construction
// //
inline Gnuplot::Gnuplot(const std::string &style) 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(); init();
@ -720,7 +720,7 @@ inline Gnuplot::Gnuplot(const std::vector<double> &x,
const std::string &style, const std::string &style,
const std::string &labelx, const std::string &labelx,
const std::string &labely) const std::string &labely)
: gnucmd(NULL), valid(false), two_dim(false), nplots(0) : gnucmd(nullptr), valid(false), two_dim(false), nplots(0)
{ {
init(); init();
@ -742,7 +742,7 @@ inline Gnuplot::Gnuplot(const std::vector<double> &x,
const std::string &style, const std::string &style,
const std::string &labelx, const std::string &labelx,
const std::string &labely) const std::string &labely)
: gnucmd(NULL), valid(false), two_dim(false), nplots(0) : gnucmd(nullptr), valid(false), two_dim(false), nplots(0)
{ {
init(); init();
@ -766,7 +766,7 @@ inline Gnuplot::Gnuplot(const std::vector<double> &x,
const std::string &labelx, const std::string &labelx,
const std::string &labely, const std::string &labely,
const std::string &labelz) const std::string &labelz)
: gnucmd(NULL), valid(false), two_dim(false), nplots(0) : gnucmd(nullptr), valid(false), two_dim(false), nplots(0)
{ {
init(); init();
@ -1027,7 +1027,7 @@ bool Gnuplot::set_GNUPlotPath(const std::string &path)
void Gnuplot::set_terminal_std(const std::string &type) void Gnuplot::set_terminal_std(const std::string &type)
{ {
#if defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) #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"); throw GnuplotException("Can't find DISPLAY variable");
} }

View File

@ -41,13 +41,13 @@ TEST(MatioTest, WriteAndReadDoubles)
mat_t *matfp; mat_t *matfp;
matvar_t *matvar; matvar_t *matvar;
std::string filename = "./test.mat"; std::string filename = "./test.mat";
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
ASSERT_FALSE(reinterpret_cast<long *>(matfp) == NULL) << "Error creating .mat file"; ASSERT_FALSE(reinterpret_cast<long *>(matfp) == nullptr) << "Error creating .mat file";
double x[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; double x[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
size_t dims[2] = {10, 1}; size_t dims[2] = {10, 1};
matvar = Mat_VarCreate("x", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, x, 0); matvar = Mat_VarCreate("x", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, x, 0);
ASSERT_FALSE(reinterpret_cast<long *>(matvar) == NULL) << "Error creating variable for x"; ASSERT_FALSE(reinterpret_cast<long *>(matvar) == nullptr) << "Error creating variable for x";
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
@ -59,10 +59,10 @@ TEST(MatioTest, WriteAndReadDoubles)
matvar_t *matvar_read; matvar_t *matvar_read;
matfp_read = Mat_Open(filename.c_str(), MAT_ACC_RDONLY); matfp_read = Mat_Open(filename.c_str(), MAT_ACC_RDONLY);
ASSERT_FALSE(reinterpret_cast<long *>(matfp_read) == NULL) << "Error reading .mat file"; ASSERT_FALSE(reinterpret_cast<long *>(matfp_read) == nullptr) << "Error reading .mat file";
matvar_read = Mat_VarReadInfo(matfp_read, "x"); matvar_read = Mat_VarReadInfo(matfp_read, "x");
ASSERT_FALSE(reinterpret_cast<long *>(matvar_read) == NULL) << "Error reading variable in .mat file"; ASSERT_FALSE(reinterpret_cast<long *>(matvar_read) == nullptr) << "Error reading variable in .mat file";
matvar_read = Mat_VarRead(matfp_read, "x"); matvar_read = Mat_VarRead(matfp_read, "x");
double *x_read = reinterpret_cast<double *>(matvar_read->data); double *x_read = reinterpret_cast<double *>(matvar_read->data);
@ -83,8 +83,8 @@ TEST(MatioTest, WriteAndReadGrComplex)
mat_t *matfp; mat_t *matfp;
matvar_t *matvar1; matvar_t *matvar1;
std::string filename = "./test3.mat"; std::string filename = "./test3.mat";
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
ASSERT_FALSE(reinterpret_cast<long *>(matfp) == NULL) << "Error creating .mat file"; ASSERT_FALSE(reinterpret_cast<long *>(matfp) == nullptr) << "Error creating .mat file";
std::vector<gr_complex> x_v = {{1, 10}, {2, 9}, {3, 8}, {4, 7}, {5, 6}, {6, -5}, {7, -4}, {8, 3}, {9, 2}, {10, 1}}; std::vector<gr_complex> 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(); const unsigned int size = x_v.size();
@ -101,7 +101,7 @@ TEST(MatioTest, WriteAndReadGrComplex)
struct mat_complex_split_t x = {x_real, x_imag}; struct mat_complex_split_t x = {x_real, x_imag};
size_t dims[2] = {static_cast<size_t>(size), 1}; size_t dims[2] = {static_cast<size_t>(size), 1};
matvar1 = Mat_VarCreate("x", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, &x, MAT_F_COMPLEX); matvar1 = Mat_VarCreate("x", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, &x, MAT_F_COMPLEX);
ASSERT_FALSE(reinterpret_cast<long *>(matvar1) == NULL) << "Error creating variable for x"; ASSERT_FALSE(reinterpret_cast<long *>(matvar1) == nullptr) << "Error creating variable for x";
std::vector<gr_complex> x2 = {{1.1, -10}, {2, -9}, {3, -8}, {4, -7}, {5, 6}, {6, -5}, {7, -4}, {8, 3}, {9, 2}, {10, 1}}; std::vector<gr_complex> 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(); const unsigned int size_y = x2.size();
@ -119,7 +119,7 @@ TEST(MatioTest, WriteAndReadGrComplex)
size_t dims_y[2] = {static_cast<size_t>(size_y), 1}; size_t dims_y[2] = {static_cast<size_t>(size_y), 1};
matvar_t *matvar2; matvar_t *matvar2;
matvar2 = Mat_VarCreate("y", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims_y, &y, MAT_F_COMPLEX); matvar2 = Mat_VarCreate("y", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims_y, &y, MAT_F_COMPLEX);
ASSERT_FALSE(reinterpret_cast<long *>(matvar2) == NULL) << "Error creating variable for y"; ASSERT_FALSE(reinterpret_cast<long *>(matvar2) == nullptr) << "Error creating variable for y";
Mat_VarWrite(matfp, matvar1, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar1, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarWrite(matfp, matvar2, 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; matvar_t *matvar_read;
matfp_read = Mat_Open(filename.c_str(), MAT_ACC_RDONLY); matfp_read = Mat_Open(filename.c_str(), MAT_ACC_RDONLY);
ASSERT_FALSE(reinterpret_cast<long *>(matfp_read) == NULL) << "Error reading .mat file"; ASSERT_FALSE(reinterpret_cast<long *>(matfp_read) == nullptr) << "Error reading .mat file";
matvar_read = Mat_VarReadInfo(matfp_read, "x"); matvar_read = Mat_VarReadInfo(matfp_read, "x");
ASSERT_FALSE(reinterpret_cast<long *>(matvar_read) == NULL) << "Error reading variable in .mat file"; ASSERT_FALSE(reinterpret_cast<long *>(matvar_read) == nullptr) << "Error reading variable in .mat file";
matvar_read = Mat_VarRead(matfp_read, "x"); matvar_read = Mat_VarRead(matfp_read, "x");
mat_complex_split_t *x_read_st = reinterpret_cast<mat_complex_split_t *>(matvar_read->data); mat_complex_split_t *x_read_st = reinterpret_cast<mat_complex_split_t *>(matvar_read->data);

View File

@ -38,13 +38,13 @@
bool acquisition_dump_reader::read_binary_acq() bool acquisition_dump_reader::read_binary_acq()
{ {
mat_t* matfile = Mat_Open(d_dump_filename.c_str(), MAT_ACC_RDONLY); 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; std::cout << "¡¡¡Unreachable Acquisition dump file!!!" << std::endl;
return false; return false;
} }
matvar_t* var_ = Mat_VarRead(matfile, "acq_grid"); 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; std::cout << "¡¡¡Unreachable grid variable into Acquisition dump file!!!" << std::endl;
Mat_Close(matfile); Mat_Close(matfile);
@ -147,7 +147,7 @@ acquisition_dump_reader::acquisition_dump_reader(const std::string& basename,
unsigned int samples_per_code_ = 0; unsigned int samples_per_code_ = 0;
mat_t* matfile = Mat_Open(d_dump_filename.c_str(), MAT_ACC_RDONLY); 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"); matvar_t* var_ = Mat_VarRead(matfile, "doppler_max");
doppler_max_ = *static_cast<unsigned int*>(var_->data); doppler_max_ = *static_cast<unsigned int*>(var_->data);