From a48e6f072b0418c0e415c6f920ecdad3d4b519b1 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Thu, 7 Nov 2024 09:48:36 -0700 Subject: [PATCH] review catches, mostly in comments or dead code. --- main.cc | 3 ++- skytraq.cc | 2 +- tpo.cc | 24 ++++++++++++------------ validate.cc | 9 +++------ 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/main.cc b/main.cc index c0b5f66cd..4edced7b8 100644 --- a/main.cc +++ b/main.cc @@ -767,6 +767,8 @@ main(int argc, char* argv[]) #error Visual Studio 2017 and earlier are not supported. Please use Visual Studio 2019 or 2022. #endif + setMessagePattern(); + if constexpr (DEBUG_LOCALE) { gbDebug("Initial locale: %s\n",setlocale(LC_ALL, nullptr)); } @@ -810,7 +812,6 @@ main(int argc, char* argv[]) gbDebug("LC_ALL: %s\n",setlocale(LC_ALL, nullptr)); } } - setMessagePattern(); (void) new gpsbabel::UsAsciiCodec(); /* make sure a US-ASCII codec is available */ diff --git a/skytraq.cc b/skytraq.cc index 5c2c907e7..e3098384c 100644 --- a/skytraq.cc +++ b/skytraq.cc @@ -163,7 +163,7 @@ SkytraqBase::rd_word() } buffer[1] = c; /* if (rd_buf(buffer, 2) != res_OK) { - db(1, "rd_word(): Read error\n"); + dbg(1, "rd_word(): Read error\n"); return res_ERROR; }*/ diff --git a/tpo.cc b/tpo.cc index cbbed88bb..93b4f7810 100644 --- a/tpo.cc +++ b/tpo.cc @@ -725,7 +725,7 @@ void TpoFormatBase::tpo_process_tracks() Waypoint* waypoint_temp; #ifdef Tracks2012 if constexpr(debug > 3) { - gbLog("%02x %02x %02x %02x - byte %u, track %u, llvallid=%d\n", + gbDebug("%02x %02x %02x %02x - byte %u, track %u, llvallid=%d\n", buf[jj], buf[jj+1], buf[jj+2], buf[jj+3], jj, ii+1, llvalid); } // Time to read a new latlong? @@ -733,13 +733,13 @@ void TpoFormatBase::tpo_process_tracks() lon = le_read32(&buf[jj]); if constexpr(debug > 3) { - gbLog("%02x %02x %02x %02x - raw lon = %d (byte %u)\n", buf[jj], buf[jj+1], buf[jj+2], buf[jj+3], lon,jj); + gbDebug("%02x %02x %02x %02x - raw lon = %d (byte %u)\n", buf[jj], buf[jj+1], buf[jj+2], buf[jj+3], lon,jj); } jj+=4; lat = le_read32(&buf[jj]); if constexpr(debug > 3) { - gbLog("%02x %02x %02x %02x - raw lat = %d (byte %u)\n", buf[jj], buf[jj+1], buf[jj+2], buf[jj+3], lat,jj); + gbDebug("%02x %02x %02x %02x - raw lat = %d (byte %u)\n", buf[jj], buf[jj+1], buf[jj+2], buf[jj+3], lat,jj); } jj+=4; @@ -755,7 +755,7 @@ void TpoFormatBase::tpo_process_tracks() lonscale = le_read32(&buf[jj]); if constexpr(debug > 3) { - gbLog("%02x %02x %02x %02x - raw lon scale = %d (byte %u)\n", buf[jj], buf[jj+1], buf[jj+2], buf[jj+3], lonscale, jj); + gbDebug("%02x %02x %02x %02x - raw lon scale = %d (byte %u)\n", buf[jj], buf[jj+1], buf[jj+2], buf[jj+3], lonscale, jj); } //printf(" LONSCALE:"); //printf("%02x%02x%02x%02x", buf[jj], buf[jj+1], buf[jj+2], buf[jj+3]); @@ -771,7 +771,7 @@ void TpoFormatBase::tpo_process_tracks() latscale = le_read32(&buf[jj]); if constexpr(debug > 3) { - gbLog("%02x %02x %02x %02x - raw lat scale = %d (byte %u)\n", buf[jj], buf[jj+1], buf[jj+2], buf[jj+3], latscale, jj); + gbDebug("%02x %02x %02x %02x - raw lat scale = %d (byte %u)\n", buf[jj], buf[jj+1], buf[jj+2], buf[jj+3], latscale, jj); } //printf(" LATSCALE:"); //printf("%02x%02x%02x%02x ", buf[jj], buf[jj+1], buf[jj+2], buf[jj+3]); @@ -783,7 +783,7 @@ void TpoFormatBase::tpo_process_tracks() track_add_wpt(track_temp, waypoint_temp); cnttp++; if constexpr(debug > 3) { - gbLog("Adding BASIC trackpoint #%i: lat=%.5f, lon=%.5f\n", cnttp, waypoint_temp->latitude, waypoint_temp->longitude); + gbDebug("Adding BASIC trackpoint #%i: lat=%.5f, lon=%.5f\n", cnttp, waypoint_temp->latitude, waypoint_temp->longitude); } } #else @@ -870,7 +870,7 @@ void TpoFormatBase::tpo_process_tracks() // offsets. else if (buf[jj] == 0x88) { if constexpr(debug > 3) { - gbLog("%02x should mean full lat/lon comes next (byte %u)\n",buf[jj],jj); + gbDebug("%02x should mean full lat/lon comes next (byte %u)\n",buf[jj],jj); } jj++; llvalid = 0; @@ -897,7 +897,7 @@ void TpoFormatBase::tpo_process_tracks() // combo embedded in this track next. else if (buf[jj] == 0x00) { if constexpr(debug > 3) { - gbLog("%02x should mean full lat/lon or lonscale/latscale comes next (at byte %u)\n",buf[jj],jj); + gbDebug("%02x should mean full lat/lon or lonscale/latscale comes next (at byte %u)\n",buf[jj],jj); } //printf(" ZERO "); jj++; @@ -908,7 +908,7 @@ void TpoFormatBase::tpo_process_tracks() else { static const int scarray[] = {0,1,2,3,4,5,6,7,-8,-7,-6,-5,-4,-3,-2,-1}; if constexpr(debug) { - gbLog("%02x - lat mult = %d, lon mult=%d, byte %u\n", buf[jj], scarray[buf[jj] & 0xf], scarray[buf[jj] >> 4], jj); + gbDebug("%02x - lat mult = %d, lon mult=%d, byte %u\n", buf[jj], scarray[buf[jj] & 0xf], scarray[buf[jj] >> 4], jj); } @@ -922,12 +922,12 @@ void TpoFormatBase::tpo_process_tracks() if constexpr(debug > 3) { - gbLog("%02x - adjusting prev lat/lon from %i/%i", buf[jj], lat, lon); + gbDebug("%02x - adjusting prev lat/lon from %i/%i", buf[jj], lat, lon); } lon += lonscale * scarray[buf[jj] >> 4]; lat += latscale * scarray[(buf[jj] & 0xf)]; if constexpr(debug > 3) { - gbLog(" to %i/%i, byte %u\n", lat, lon, jj); + gbDebug(" to %i/%i, byte %u\n", lat, lon, jj); } //printf("."); jj++; @@ -936,7 +936,7 @@ void TpoFormatBase::tpo_process_tracks() track_add_wpt(track_temp, waypoint_temp); cnttp++; if constexpr(debug > 3) { - gbLog("Adding ADJUSTED trackpoint #%i: lat=%.5f, lon=%.5f\n", cnttp, waypoint_temp->latitude, waypoint_temp->longitude); + gbDebug("Adding ADJUSTED trackpoint #%i: lat=%.5f, lon=%.5f\n", cnttp, waypoint_temp->latitude, waypoint_temp->longitude); } } #else diff --git a/validate.cc b/validate.cc index e50d64e9e..fd177d282 100644 --- a/validate.cc +++ b/validate.cc @@ -60,8 +60,7 @@ void ValidateFilter::process() point_ct = 0; if (opt_debug) { - gbDebug("\n"); - gbDebug("Processing waypts\n"); + gbDebug("\nProcessing waypts\n"); } waypt_disp_all(validate_point_f); if (opt_debug) { @@ -76,8 +75,7 @@ void ValidateFilter::process() total_segment_ct = 0; segment_type = "route"; if (opt_debug) { - gbDebug("\n"); - gbDebug("Processing routes\n"); + gbDebug("\nProcessing routes\n"); } route_disp_all(validate_head_f, validate_head_trl_f, validate_point_f); if (opt_debug) { @@ -96,8 +94,7 @@ void ValidateFilter::process() total_segment_ct = 0; segment_type = "track"; if (opt_debug) { - gbDebug("\n"); - gbDebug("Processing tracks\n"); + gbDebug("\nProcessing tracks\n"); } track_disp_all(validate_head_f, validate_head_trl_f, validate_point_f); if (opt_debug) {