Closed yakra closed 3 years ago
Break1ofEverything
have sufficient test cases? ~No!~ Yes! New commit.Adding
/* DEBUG */
if (root == "me.i295")
{ std::ofstream dump295(Args::logfilepath+"/me.i295.dump");
dump295.write(wptdata, wptdatasize);
dump295.close();
char lstr[2050];
std::ofstream lines295(Args::logfilepath+"/me.i295.lines");
for (char*l : lines)
{ sprintf(lstr, "%X\n", int(l-wptdata));
lines295 << lstr;
}
lines295.close();
}
to Route::read_wpt
right before the // per-route datachecks
reveals...
1FA
, the location of the single-field exit 7
.Adding
/* DEBUG */
if (route->root == "me.i295")
std::cout << "DEBUG: me.i295 @ " << line << std::endl;
to the Waypoint ctor between route = rte;
and // split line into fields
yields...
DEBUG:
lines in siteupdate.log// process lines
for (unsigned int l = lines[1] < wptdata+2; l < lines.size()-1; l++)
{ // strip whitespace from end... // l == 8 | lines[l] == 1FA | lines[l+1] == 1FC
char* endchar = lines[l+1]-2; // endchar == 1FA
while (*endchar == 0) endchar--; // *endchar == '7'; no change to endchar
if (endchar <= lines[l]) continue; // endchar == lines[l]; continue; here's the problem
Time to review the git blame and see when this was introduced and why, and what can be changed. Was it the "blank line at the beginning" bug? Yes.
Hopefully changing (endchar <= lines[l])
to (endchar < lines[l])
will work. I'll have to test this out on noreaster per #443.
Now we get:
[yakra@noreaster ~/ytm/DataProcessing/siteupdate/cplusplus]$ ~/diff _master/logs/datacheck.log _debug2/logs/datacheck.log
1c1
< Log file created at: Tue Oct 5 14:27:05 2021
---
> Log file created at: Tue Oct 5 14:36:17 2021
1221a1222
> ausvic.c156;;;;SINGLE_FIELD_LINE;
An extra line at the end of the file contains a single space.
The LABEL_TOO_LONG datacheck is performed in
Route::read_wpt
after the Waypoint ctor returns. Problem is, the Waypoint ctor performs the MALFORMED_URL, MALFORMED_LAT & MALFORMED_LON datachecks. If any of these 3 coexist with LABEL_TOO_LONG, they'll try to insert a label that's too long to fit into the DB.Waypoint::label_too_long
into the ctor will help code brevity. Will it run faster? Yes!