Skip to content

Commit

Permalink
review catches, mostly in comments or dead code.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsteven4 committed Nov 7, 2024
1 parent 783ce61 commit a48e6f0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
3 changes: 2 additions & 1 deletion main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down Expand Up @@ -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 */

Expand Down
2 changes: 1 addition & 1 deletion skytraq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}*/

Expand Down
24 changes: 12 additions & 12 deletions tpo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -725,21 +725,21 @@ 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?
if (!llvalid) {

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;

Expand All @@ -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]);
Expand All @@ -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]);
Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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++;
Expand All @@ -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);
}


Expand All @@ -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++;
Expand All @@ -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
Expand Down
9 changes: 3 additions & 6 deletions validate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit a48e6f0

Please sign in to comment.