Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions siteupdate/cplusplus/classes/Route/read_wpt.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,8 +76,7 @@ void Route::read_wpt
w->label_slashes(datacheckerrors, slash);
w->underscore_datachecks(datacheckerrors, slash);
w->label_parens(datacheckerrors);
w->label_invalid_char(datacheckerrors, w->label);
for (std::string &a : w->alt_labels) w->label_invalid_char(datacheckerrors, a);
w->label_invalid_char(datacheckerrors);
w->label_invalid_ends(datacheckerrors);
w->bus_with_i(datacheckerrors);
w->label_looks_hidden(datacheckerrors);
Expand Down
22 changes: 12 additions & 10 deletions siteupdate/cplusplus/classes/Waypoint/Waypoint.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -398,17 +398,19 @@ inline void Waypoint::label_looks_hidden(DatacheckEntryList *datacheckerrors)
datacheckerrors->add(route, label, "", "", "LABEL_LOOKS_HIDDEN", "");
}

inline void Waypoint::label_invalid_char(DatacheckEntryList *datacheckerrors, std::string &lbl)
inline void Waypoint::label_invalid_char(DatacheckEntryList *datacheckerrors)
{ // look for labels with invalid characters
for (const char *c = lbl.data(); *c; c++)
{ if (*c < 40) { datacheckerrors->add(route, lbl, "", "", "LABEL_INVALID_CHAR", ""); return; }
if (*c == 44) { datacheckerrors->add(route, lbl, "", "", "LABEL_INVALID_CHAR", ""); return; }
if (*c > 57 && *c < 65) { datacheckerrors->add(route, lbl, "", "", "LABEL_INVALID_CHAR", ""); return; }
if (*c > 90 && *c < 95) { datacheckerrors->add(route, lbl, "", "", "LABEL_INVALID_CHAR", ""); return; }
if (*c == 96) { datacheckerrors->add(route, lbl, "", "", "LABEL_INVALID_CHAR", ""); return; }
if (*c > 122) { datacheckerrors->add(route, lbl, "", "", "LABEL_INVALID_CHAR", ""); return; }
}
if (strpbrk(lbl.data()+1, "+*")) datacheckerrors->add(route, lbl, "", "", "LABEL_INVALID_CHAR", "");
for (const char *c = label.data(); *c; c++)
if ((*c == 42 || *c == 43) && c > label.data()
|| (*c < 40) || (*c == 44) || (*c > 57 && *c < 65)
|| (*c == 96) || (*c > 122) || (*c > 90 && *c < 95))
datacheckerrors->add(route, label, "", "", "LABEL_INVALID_CHAR", "");
for (std::string& lbl : alt_labels)
for (const char *c = lbl.data(); *c; c++)
if (*c == '+' && c > lbl.data() || *c == '*' && (c > lbl.data()+1 || lbl[0] != '+')
|| (*c < 40) || (*c == 44) || (*c > 57 && *c < 65)
|| (*c == 96) || (*c > 122) || (*c > 90 && *c < 95))
datacheckerrors->add(route, lbl, "", "", "LABEL_INVALID_CHAR", "");
}

inline void Waypoint::label_invalid_ends(DatacheckEntryList *datacheckerrors)
Expand Down
2 changes: 1 addition & 1 deletion siteupdate/cplusplus/classes/Waypoint/Waypoint.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -46,7 +46,7 @@ class Waypoint
inline void visible_distance(DatacheckEntryList *, char *, double &, Waypoint *&);
inline void bus_with_i(DatacheckEntryList *);
inline void label_looks_hidden(DatacheckEntryList *);
inline void label_invalid_char(DatacheckEntryList *, std::string &);
inline void label_invalid_char(DatacheckEntryList *);
inline void label_invalid_ends(DatacheckEntryList *);
inline void label_parens(DatacheckEntryList *);
inline void label_slashes(DatacheckEntryList *, const char *);
Expand Down