From ff5950690a699dbf69daf3c218d9e94d31773b18 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sat, 14 Sep 2024 12:34:35 -0600 Subject: [PATCH 01/21] rewrite strip_html with QString. --- util.cc | 97 +++++++++++++++++++++++---------------------------------- 1 file changed, 39 insertions(+), 58 deletions(-) diff --git a/util.cc b/util.cc index 7840d5268..aa153106a 100644 --- a/util.cc +++ b/util.cc @@ -838,82 +838,63 @@ QString strip_html(const QString& utfstring) doc.setHtml(utfstring); return doc.toPlainText().simplified(); #else - char* out; - char* instr; - char tag[8]; - unsigned short int taglen = 0; - - char* incopy = instr = xstrdup(utfstring); - /* - * We only shorten, so just dupe the input buf for space. - */ - char* outstring = out = xstrdup(utfstring); - - tag[0] = 0; - while (*instr) { + QString tag; + bool processing_tag = false; + QString out; + + for (auto instr = utfstring.cbegin(), end = utfstring.cend(); instr != end;) { if ((*instr == '<') || (*instr == '&')) { - tag[0] = *instr; - taglen = 0; + processing_tag = true; } - if (! tag[0]) { + if (!processing_tag) { if (*instr == '\n') { - *out++ = ' '; + out.append(' '); do { instr++; - } while (isspace(*instr)); + } while ((instr != end) && instr->isSpace()); continue; } else { - *out++ = *instr; + out.append(*instr); } } else { - if (taglen < (sizeof(tag)-1)) { - tag[taglen++] = tolower(*instr); - tag[taglen] = 0; + if (tag.size() < 7) { + tag.append(instr->toLower()); } } - if (((tag[0] == '<') && (*instr == '>')) || - ((tag[0] == '&') && (*instr == ';'))) { - if (! strcmp(tag, "&")) { - *out++ = '&'; - } else if (! strcmp(tag, "<")) { - *out++ = '<'; - } else if (! strcmp(tag, ">")) { - *out++ = '>'; - } else if (! strcmp(tag, """)) { - *out++ = '"'; - } else if (! strcmp(tag, " ")) { - *out++ = ' '; - } else if (! strcmp(tag, "°")) { - *out++ = 'd'; - *out++ = 'e'; - *out++ = 'g'; - } else if ((tag[0]=='<') && (tag[1]=='p')) { - *out++ = '\n'; - } else if ((tag[0]=='<') && (tag[1]=='b') && (tag[2]=='r')) { - *out++ = '\n'; - } else if ((tag[0]=='<') && (tag[1]=='/') && (tag[2]=='t') && (tag[3]=='r')) { - *out++ = '\n'; - } else if ((tag[0]=='<') && (tag[1]=='/') && (tag[2]=='t') && (tag[3]=='d')) { - *out++ = ' '; - } else if ((tag[0]=='<') && (tag[1]=='i') && (tag[2]=='m') && (tag[3]=='g')) { - *out++ = '['; - *out++ = 'I'; - *out++ = 'M'; - *out++ = 'G'; - *out++ = ']'; + if ((tag.startsWith('<') && (*instr == '>')) || + (tag.startsWith('&') && (*instr == ';'))) { + if (tag == "&") { + out.append('&'); + } else if (tag == "<") { + out.append('<'); + } else if (tag == ">") { + out.append('>'); + } else if (tag == """) { + out.append('"'); + } else if (tag == " ") { + out.append(' '); + } else if (tag == "°") { + out.append("deg"); + } else if (tag.startsWith(" Date: Sat, 14 Sep 2024 15:55:56 -0600 Subject: [PATCH 02/21] rewrite strip_nasty_html in Qt. and actually produce valid html: 1. the replacement for "", "", is invalid. 2. leaving an html tag in causes the html format output to be invalid. --- reference/gc/GCGCA8_nasty.gpx | 80 +++++++++++++++++++++++++++ reference/gc/GCGCA8_nasty.html | 55 +++++++++++++++++++ testo.d/text.test | 4 ++ util.cc | 99 +++++++--------------------------- 4 files changed, 158 insertions(+), 80 deletions(-) create mode 100644 reference/gc/GCGCA8_nasty.gpx create mode 100644 reference/gc/GCGCA8_nasty.html diff --git a/reference/gc/GCGCA8_nasty.gpx b/reference/gc/GCGCA8_nasty.gpx new file mode 100644 index 000000000..ebcac6636 --- /dev/null +++ b/reference/gc/GCGCA8_nasty.gpx @@ -0,0 +1,80 @@ + + + Cache Listing Generated from Geocaching.com + This is an individual cache generated from Geocaching.com + Account "robertlipe" From Geocaching.com + contact@geocaching.com + https://www.geocaching.com + Geocaching - High Tech Treasure Hunting + + cache, geocache + + + + GCGCA8 + Oozy rat in a sanitary zoo by robertlipe, Unknown Cache (3/2) + https://www.geocaching.com/geocache/GCGCA8 + Oozy rat in a sanitary zoo + Geocache + Geocache|Unknown Cache + + Oozy rat in a sanitary zoo + robertlipe + robertlipe + Unknown Cache + Not chosen + + Wheelchair accessible + Ticks + Dangerous animals + Poisonous plants + Thorns + Picnic tables nearby + Public restrooms nearby + Dogs + + 3 + 2 + United States + Tennessee + <body>The cache is <style> +not</style> at the coordinates above. These coords will get +you to the correct park and within 1/2 mile of the cache. The cache +is within 35 feet of the trail. It is not handicapped accessible. +It is a nice walk in the woods that is practical for all ages. +There is no space in the container for trading items. You should +bring a writing stick and bug spray is recommended.</body> + + <html><body text="color">So if the cache isn't at the above coordinates, where is it? +<ul> +<li>Too bad I hid a boot</li> +<li>Too hot to hoot</li> +<li>Never odd or even</li> +<li>Do geese see God?</li> +<li>"Do nine men interpret?" "Nine men," I nod</li> +<li>Rats live on no evil star</li> +<li>Go hang a salami, I'm a lasagna hog</li></ul> +Now that it's intuitively obvious to even the most casual observer +where the cache is, turn on your geo-mojo and go find it. <br> +<image src="http://www.mtgc.org/mtgc_member-banner.gif" width="500" +height="40" alt= +"Member of Middle Tennessee GeoCachers Club [www.mtgc.org]" + border="0"><br> +<br></body></html> + + + + + + 2017-11-11T01:44:14Z + Archive + robertlipe + Removed the container from the final location. Enough construction has occurred since this was placed to make it much less of an adventure than is used to be, so I'm archiving. + +Thanx to all that hunted it. + + + + + + diff --git a/reference/gc/GCGCA8_nasty.html b/reference/gc/GCGCA8_nasty.html new file mode 100644 index 000000000..d6c592ce1 --- /dev/null +++ b/reference/gc/GCGCA8_nasty.html @@ -0,0 +1,55 @@ + + + + + GPSBabel HTML Output + + + +

+ GCGCA8 - Oozy rat in a sanitary zoo
+

+

+ + + + + + + + +
+

GCGCA8 - N35°55.300 W86°51.700 (16S 512480 3975269)
+Oozy rat in a sanitary zoo by robertlipe

+
+

3 / 2
+Unknown Cache / Unknown

+
+

The cache is at the coordinates above. These coords will get +you to the correct park and within 1/2 mile of the cache. The cache +is within 35 feet of the trail. It is not handicapped accessible. +It is a nice walk in the woods that is practical for all ages. +There is no space in the container for trading items. You should +bring a writing stick and bug spray is recommended.

+

So if the cache isn't at the above coordinates, where is it? +

    +
  • Too bad I hid a boot
  • +
  • Too hot to hoot
  • +
  • Never odd or even
  • +
  • Do geese see God?
  • +
  • "Do nine men interpret?" "Nine men," I nod
  • +
  • Rats live on no evil star
  • +
  • Go hang a salami, I'm a lasagna hog
+Now that it's intuitively obvious to even the most casual observer +where the cache is, turn on your geo-mojo and go find it.
++"Member
+
+
+
+ + diff --git a/testo.d/text.test b/testo.d/text.test index e89b52226..4307260bb 100644 --- a/testo.d/text.test +++ b/testo.d/text.test @@ -16,3 +16,7 @@ gpsbabel -i gpx -f ${REFERENCE}/gc/GC7FA4.gpx \ -o text,logs -F ${TMPDIR}/GC7FA4.text compare ${REFERENCE}/gc/GC7FA4.html ${TMPDIR}/GC7FA4.html compare ${REFERENCE}/gc/GC7FA4.text ${TMPDIR}/GC7FA4.text + +# GCGC8_nasty.gpx is hand modifed to test strip_nasty_html +gpsbabel -i gpx -f ${REFERENCE}/gc/GCGCA8_nasty.gpx -o html -F ${TMPDIR}/GCGCA8_nasty.html +compare ${REFERENCE}/gc/GCGCA8_nasty.html ${TMPDIR}/GCGCA8_nasty.html diff --git a/util.cc b/util.cc index aa153106a..7aee18cf1 100644 --- a/util.cc +++ b/util.cc @@ -20,6 +20,7 @@ */ #include // for sort +#include // for assert #include // for isspace, tolower #include // for errno #include // for INT_MAX, INT_MIN @@ -35,6 +36,7 @@ #include // for QDateTime #include // for QFileInfo #include // for QList +#include // for QRegularExpressio #include // for QString #include // for QTextBoundaryFinder, QTextBoundaryFinder::Grapheme #include // for QTextCodec @@ -734,92 +736,29 @@ pretty_deg_format(double lat, double lon, char fmt, const char* sep, bool html) /* * Get rid of potentially nasty HTML that would influence another record * that includes; - * - to stop backgrounds/background colours from being loaded + * - to stop backgrounds/background colors from being loaded * and - stop processing altogether * - stop overriding styles for everything */ QString strip_nastyhtml(const QString& in) { - char* returnstr = xstrdup(in); - char* lcstr = xstrdup(in.toLower()); - - while (char* lcp = strstr(lcstr, "")) { - char* sp = returnstr + (lcp - lcstr) ; /* becomes */ - sp++; - *sp++ = '!'; - *sp++ = ' '; - *sp++ = ' '; - *sp++ = ' '; - *lcp = '*'; /* so we wont find it again */ - } - while (char* lcp = strstr(lcstr, " */ - char* sp = returnstr + (lcp - lcstr) ; - sp++; - *sp++ = '!'; - *sp++ = '-'; - *sp++ = '-'; - while ((*sp) && (*sp != '>')) { - sp++; - } - *--sp = '-'; - *--sp = '-'; - *lcp = '*'; /* so we wont find it again */ - } - while (char* lcp = strstr(lcstr, "")) { - char* sp = returnstr + (lcp - lcstr) ; /* becomes */ - *sp++ = ' '; - *sp++ = ' '; - *sp++ = ' '; - *sp++ = ' '; - *sp++ = ' '; - *sp++ = '-'; - *sp++ = '-'; - *lcp = '*'; /* so we wont find it again */ - } - while (char* lcp = strstr(lcstr, "", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); + assert(htmlre.isValid()); + static const QRegularExpression bodyre("", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); + assert(bodyre.isValid()); + static const QRegularExpression stylere(".*?", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); + assert(stylere.isValid()); + QString out(in); + + out.replace(bodyre, ""); + out.replace("", "", Qt::CaseInsensitive); + out.replace(htmlre, ""); + out.replace("", "", Qt::CaseInsensitive); + out.replace(stylere, ""); + out.replace(" Date: Sat, 14 Sep 2024 18:26:52 -0600 Subject: [PATCH 03/21] cleanup comment xstrdup --- exif.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exif.cc b/exif.cc index cece53d16..8cf300fda 100644 --- a/exif.cc +++ b/exif.cc @@ -63,7 +63,7 @@ #include // for memcmp, strlen #include // for as_const -#include "defs.h" // for Waypoint, fatal, warning, global_options, global_opts, unknown_alt, xfree, route_disp_all, track_disp_all, waypt_disp_all, wp_flags, KNOTS_TO_MPS, KPH_TO_MPS, MPH_TO_MPS, MPS_TO_KPH, WAYPT_HAS, case_ignore_strcmp, waypt_add, xstrdup, fix_2d +#include "defs.h" // for Waypoint, fatal, warning, global_options, global_opts, unknown_alt, xfree, route_disp_all, track_disp_all, waypt_disp_all, wp_flags, KNOTS_TO_MPS, KPH_TO_MPS, MPH_TO_MPS, MPS_TO_KPH, WAYPT_HAS, case_ignore_strcmp, waypt_add, fix_2d #include "garmin_tables.h" // for gt_lookup_datum_index #include "gbfile.h" // for gbfputuint32, gbfputuint16, gbfgetuint16, gbfgetuint32, gbfseek, gbftell, gbfile, gbfclose, gbfcopyfrom, gbfwrite, gbfopen_be, gbfread, gbfrewind, gbfgetflt, gbfgetint16, gbfopen, gbfputc, gbfputflt, gbsize_t, gbfeof, gbfgetdbl, gbfputdbl, gbfile::(anonymous) #include "jeeps/gpsmath.h" // for GPS_Math_WGS84_To_Known_Datum_M From 677da95a77b335bfa686a35fc33e862f8b50f053 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sun, 15 Sep 2024 06:48:48 -0600 Subject: [PATCH 04/21] use regex for strip_html --- util.cc | 80 ++++++++++++++++++--------------------------------------- 1 file changed, 25 insertions(+), 55 deletions(-) diff --git a/util.cc b/util.cc index 7aee18cf1..35cde0c13 100644 --- a/util.cc +++ b/util.cc @@ -777,62 +777,32 @@ QString strip_html(const QString& utfstring) doc.setHtml(utfstring); return doc.toPlainText().simplified(); #else - QString tag; - bool processing_tag = false; - QString out; + static const QRegularExpression pre("", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); + assert(pre.isValid()); + static const QRegularExpression brre("", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); + assert(brre.isValid()); + static const QRegularExpression trre("", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); + assert(trre.isValid()); + static const QRegularExpression tdre("", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); + assert(tdre.isValid()); + + QString out(utfstring); + + // Tag replacement first + out.replace(pre, "\n"); + out.replace(brre, "\n"); + out.replace(trre, "\n"); + out.replace(tdre, " "); + out.replace(""); + out.replace(""", "\""); + out.replace(" ", " "); + out.replace("°", "deg"); - for (auto instr = utfstring.cbegin(), end = utfstring.cend(); instr != end;) { - if ((*instr == '<') || (*instr == '&')) { - processing_tag = true; - } - - if (!processing_tag) { - if (*instr == '\n') { - out.append(' '); - do { - instr++; - } while ((instr != end) && instr->isSpace()); - continue; - } else { - out.append(*instr); - } - } else { - if (tag.size() < 7) { - tag.append(instr->toLower()); - } - } - - if ((tag.startsWith('<') && (*instr == '>')) || - (tag.startsWith('&') && (*instr == ';'))) { - if (tag == "&") { - out.append('&'); - } else if (tag == "<") { - out.append('<'); - } else if (tag == ">") { - out.append('>'); - } else if (tag == """) { - out.append('"'); - } else if (tag == " ") { - out.append(' '); - } else if (tag == "°") { - out.append("deg"); - } else if (tag.startsWith(" Date: Sun, 15 Sep 2024 07:53:05 -0600 Subject: [PATCH 05/21] strip_html deletes other tags --- util.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util.cc b/util.cc index 35cde0c13..a812ec576 100644 --- a/util.cc +++ b/util.cc @@ -785,6 +785,9 @@ QString strip_html(const QString& utfstring) assert(trre.isValid()); static const QRegularExpression tdre("", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); assert(tdre.isValid()); + static const QRegularExpression otherre("<.*?>", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); + assert(otherre.isValid()); + QString out(utfstring); @@ -794,6 +797,7 @@ QString strip_html(const QString& utfstring) out.replace(trre, "\n"); out.replace(tdre, " "); out.replace(" Date: Sun, 15 Sep 2024 08:00:22 -0600 Subject: [PATCH 06/21] fix strip_html img tag handling --- util.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util.cc b/util.cc index a812ec576..832a86205 100644 --- a/util.cc +++ b/util.cc @@ -785,6 +785,8 @@ QString strip_html(const QString& utfstring) assert(trre.isValid()); static const QRegularExpression tdre("", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); assert(tdre.isValid()); + static const QRegularExpression imgre("", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); + assert(imgre.isValid()); static const QRegularExpression otherre("<.*?>", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); assert(otherre.isValid()); @@ -796,7 +798,7 @@ QString strip_html(const QString& utfstring) out.replace(brre, "\n"); out.replace(trre, "\n"); out.replace(tdre, " "); - out.replace(" Date: Sun, 15 Sep 2024 08:19:33 -0600 Subject: [PATCH 07/21] Revert "fix strip_html img tag handling" This reverts commit b0440f7e3729909fd51ecbbacdd7a7e4aa5d9198. --- util.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/util.cc b/util.cc index 832a86205..a812ec576 100644 --- a/util.cc +++ b/util.cc @@ -785,8 +785,6 @@ QString strip_html(const QString& utfstring) assert(trre.isValid()); static const QRegularExpression tdre("", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); assert(tdre.isValid()); - static const QRegularExpression imgre("", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); - assert(imgre.isValid()); static const QRegularExpression otherre("<.*?>", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); assert(otherre.isValid()); @@ -798,7 +796,7 @@ QString strip_html(const QString& utfstring) out.replace(brre, "\n"); out.replace(trre, "\n"); out.replace(tdre, " "); - out.replace(imgre, "[IMG]"); + out.replace(" Date: Sun, 15 Sep 2024 08:19:46 -0600 Subject: [PATCH 08/21] Revert "strip_html deletes other tags" This reverts commit 40fe2ef0153d8c2e6d53432b9184f8acffbab2ef. --- util.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/util.cc b/util.cc index a812ec576..35cde0c13 100644 --- a/util.cc +++ b/util.cc @@ -785,9 +785,6 @@ QString strip_html(const QString& utfstring) assert(trre.isValid()); static const QRegularExpression tdre("", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); assert(tdre.isValid()); - static const QRegularExpression otherre("<.*?>", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); - assert(otherre.isValid()); - QString out(utfstring); @@ -797,7 +794,6 @@ QString strip_html(const QString& utfstring) out.replace(trre, "\n"); out.replace(tdre, " "); out.replace(" Date: Sun, 15 Sep 2024 08:19:50 -0600 Subject: [PATCH 09/21] Revert "use regex for strip_html" This reverts commit 677da95a77b335bfa686a35fc33e862f8b50f053. --- util.cc | 80 +++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 55 insertions(+), 25 deletions(-) diff --git a/util.cc b/util.cc index 35cde0c13..7aee18cf1 100644 --- a/util.cc +++ b/util.cc @@ -777,32 +777,62 @@ QString strip_html(const QString& utfstring) doc.setHtml(utfstring); return doc.toPlainText().simplified(); #else - static const QRegularExpression pre("", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); - assert(pre.isValid()); - static const QRegularExpression brre("", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); - assert(brre.isValid()); - static const QRegularExpression trre("", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); - assert(trre.isValid()); - static const QRegularExpression tdre("", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); - assert(tdre.isValid()); - - QString out(utfstring); - - // Tag replacement first - out.replace(pre, "\n"); - out.replace(brre, "\n"); - out.replace(trre, "\n"); - out.replace(tdre, " "); - out.replace(""); - out.replace(""", "\""); - out.replace(" ", " "); - out.replace("°", "deg"); + QString tag; + bool processing_tag = false; + QString out; + for (auto instr = utfstring.cbegin(), end = utfstring.cend(); instr != end;) { + if ((*instr == '<') || (*instr == '&')) { + processing_tag = true; + } + + if (!processing_tag) { + if (*instr == '\n') { + out.append(' '); + do { + instr++; + } while ((instr != end) && instr->isSpace()); + continue; + } else { + out.append(*instr); + } + } else { + if (tag.size() < 7) { + tag.append(instr->toLower()); + } + } + + if ((tag.startsWith('<') && (*instr == '>')) || + (tag.startsWith('&') && (*instr == ';'))) { + if (tag == "&") { + out.append('&'); + } else if (tag == "<") { + out.append('<'); + } else if (tag == ">") { + out.append('>'); + } else if (tag == """) { + out.append('"'); + } else if (tag == " ") { + out.append(' '); + } else if (tag == "°") { + out.append("deg"); + } else if (tag.startsWith(" Date: Sun, 15 Sep 2024 14:44:16 -0600 Subject: [PATCH 10/21] implement strip_html using QRegularExpressionMatchIterator. --- testo | 1 + util.cc | 88 +++++++++++++++++++++++++++------------------------------ 2 files changed, 43 insertions(+), 46 deletions(-) diff --git a/testo b/testo index fc5550162..5083eead1 100755 --- a/testo +++ b/testo @@ -189,4 +189,5 @@ if [ -z "${VALGRIND}" ]; then fi fi +echo "Total Errors: $errorcount" exit $errorcount diff --git a/util.cc b/util.cc index 7aee18cf1..1a24e9249 100644 --- a/util.cc +++ b/util.cc @@ -36,7 +36,9 @@ #include // for QDateTime #include // for QFileInfo #include // for QList -#include // for QRegularExpressio +#include // for QRegularExpression +#include // for QRegularExpressionMatch +#include // for QRegularExpressionMatchIterator #include // for QString #include // for QTextBoundaryFinder, QTextBoundaryFinder::Grapheme #include // for QTextCodec @@ -777,62 +779,56 @@ QString strip_html(const QString& utfstring) doc.setHtml(utfstring); return doc.toPlainText().simplified(); #else - QString tag; - bool processing_tag = false; + static const QRegularExpression re("(?:<(?.*?)>)|(?:&(?.*?);)|(?[^<&]+)|(?.+)", + QRegularExpression::DotMatchesEverythingOption); + assert(re.isValid()); + static const QRegularExpression newlinespace_re("\\n\\s*"); + assert(newlinespace_re.isValid()); QString out; - for (auto instr = utfstring.cbegin(), end = utfstring.cend(); instr != end;) { - if ((*instr == '<') || (*instr == '&')) { - processing_tag = true; - } - - if (!processing_tag) { - if (*instr == '\n') { + QRegularExpressionMatchIterator it = re.globalMatch(utfstring); + while (it.hasNext()) { + auto match = it.next(); + //qDebug() << match.capturedTexts(); + // TODO: Qt >= 6.3 use match.hasCaptured(...) instead of !match.captured(...).isNull() + if (!match.captured(u"tag").isNull()) { + QString tag = match.captured(u"tag"); + //qDebug() << "tag match:" << tag; + if (tag.startsWith("p", Qt::CaseInsensitive)) { + out.append('\n'); + } else if (tag.startsWith("br", Qt::CaseInsensitive)) { + out.append('\n'); + } else if (tag.startsWith("/tr", Qt::CaseInsensitive)) { + out.append('\n'); + } else if (tag.startsWith("/td", Qt::CaseInsensitive)) { out.append(' '); - do { - instr++; - } while ((instr != end) && instr->isSpace()); - continue; - } else { - out.append(*instr); - } - } else { - if (tag.size() < 7) { - tag.append(instr->toLower()); - } - } - - if ((tag.startsWith('<') && (*instr == '>')) || - (tag.startsWith('&') && (*instr == ';'))) { - if (tag == "&") { + } else if (tag.startsWith("img", Qt::CaseInsensitive)) { + out.append("[IMG]"); + } // else eat the tag + } else if (!match.captured(u"entity").isNull()) { + QString entity = match.captured(u"entity"); + //qDebug() << "entity match:" << entity; + if (match.captured() == "amp") { out.append('&'); - } else if (tag == "<") { + } else if (match.captured() == "lt") { out.append('<'); - } else if (tag == ">") { + } else if (match.captured() == "gt") { out.append('>'); - } else if (tag == """) { + } else if (match.captured() == "quot") { out.append('"'); - } else if (tag == " ") { + } else if (match.captured() == "nbsp") { out.append(' '); - } else if (tag == "°") { + } else if (match.captured() == "deg") { out.append("deg"); - } else if (tag.startsWith(" Date: Sun, 15 Sep 2024 14:56:30 -0600 Subject: [PATCH 11/21] a little cleanup --- util.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util.cc b/util.cc index 1a24e9249..bb9e4f5e3 100644 --- a/util.cc +++ b/util.cc @@ -752,7 +752,7 @@ strip_nastyhtml(const QString& in) static const QRegularExpression stylere(".*?", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption); assert(stylere.isValid()); QString out(in); - + out.replace(bodyre, ""); out.replace("", "", Qt::CaseInsensitive); out.replace(htmlre, ""); @@ -824,8 +824,8 @@ QString strip_html(const QString& utfstring) } else if (!match.captured(u"other").isNull()) { //qDebug() << "other match:" << match.capturedTexts(); out.append(match.captured(u"other").replace(newlinespace_re, " ")); - } else { - //qDebug() << "unexpected fragment:" << match.capturedTexts(); + //} else { + // qDebug() << "unexpected fragment:" << match.capturedTexts(); } } From 08bb0827c2e5fcc6b5eb27b4638fe06e292789aa Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sun, 15 Sep 2024 15:13:16 -0600 Subject: [PATCH 12/21] remove obsolete include --- util.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/util.cc b/util.cc index bb9e4f5e3..74a851229 100644 --- a/util.cc +++ b/util.cc @@ -21,7 +21,6 @@ #include // for sort #include // for assert -#include // for isspace, tolower #include // for errno #include // for INT_MAX, INT_MIN #include // for fabs, floor From 06b8027d33dc6b58fcc71e384c909fe90dbcd068 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sun, 15 Sep 2024 17:51:16 -0600 Subject: [PATCH 13/21] take care to distinguish tags with common roots like p, param, pre. --- util.cc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/util.cc b/util.cc index 74a851229..c3a6db059 100644 --- a/util.cc +++ b/util.cc @@ -778,7 +778,7 @@ QString strip_html(const QString& utfstring) doc.setHtml(utfstring); return doc.toPlainText().simplified(); #else - static const QRegularExpression re("(?:<(?.*?)>)|(?:&(?.*?);)|(?[^<&]+)|(?.+)", + static const QRegularExpression re("(?:<(?[^ >]*).*?>)|(?:&(?.*?);)|(?[^<&]+)|(?.+)", QRegularExpression::DotMatchesEverythingOption); assert(re.isValid()); static const QRegularExpression newlinespace_re("\\n\\s*"); @@ -793,13 +793,13 @@ QString strip_html(const QString& utfstring) if (!match.captured(u"tag").isNull()) { QString tag = match.captured(u"tag"); //qDebug() << "tag match:" << tag; - if (tag.startsWith("p", Qt::CaseInsensitive)) { + if (tag.compare("p", Qt::CaseInsensitive) == 0) { out.append('\n'); - } else if (tag.startsWith("br", Qt::CaseInsensitive)) { + } else if (tag.compare("br", Qt::CaseInsensitive) == 0) { out.append('\n'); - } else if (tag.startsWith("/tr", Qt::CaseInsensitive)) { + } else if (tag.compare("/tr", Qt::CaseInsensitive) == 0) { out.append('\n'); - } else if (tag.startsWith("/td", Qt::CaseInsensitive)) { + } else if (tag.compare("/td", Qt::CaseInsensitive) == 0) { out.append(' '); } else if (tag.startsWith("img", Qt::CaseInsensitive)) { out.append("[IMG]"); @@ -807,17 +807,17 @@ QString strip_html(const QString& utfstring) } else if (!match.captured(u"entity").isNull()) { QString entity = match.captured(u"entity"); //qDebug() << "entity match:" << entity; - if (match.captured() == "amp") { + if (entity == "amp") { out.append('&'); - } else if (match.captured() == "lt") { + } else if (entity == "lt") { out.append('<'); - } else if (match.captured() == "gt") { + } else if (entity == "gt") { out.append('>'); - } else if (match.captured() == "quot") { + } else if (entity == "quot") { out.append('"'); - } else if (match.captured() == "nbsp") { + } else if (entity == "nbsp") { out.append(' '); - } else if (match.captured() == "deg") { + } else if (entity == "deg") { out.append("deg"); } // else eat the entity } else if (!match.captured(u"other").isNull()) { From e75a1c9fa11153caf7ed3e84493d6635d0e87d55 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sun, 22 Sep 2024 11:39:52 -0600 Subject: [PATCH 14/21] suppress InvalidReads in qhash. These are known to occur per comment in qhash.cpp. --- gpsbabel.supp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gpsbabel.supp b/gpsbabel.supp index e91a05fac..a2d7405d7 100644 --- a/gpsbabel.supp +++ b/gpsbabel.supp @@ -1,3 +1,18 @@ +{ + + Memcheck:Addr16 + fun:_mm_loadu_si128 + fun:_ZL7aeshashPKhmm + fun:calculateHash +} +{ + + Memcheck:Addr16 + fun:_mm_loadu_si128 + fun:aeshash128_lt16 + fun:_ZL10aeshash128PKhmmm + fun:calculateHash +} { Memcheck:Leak From 34496f97dbc2f568345d71e065dcebdade5d34b4 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sun, 22 Sep 2024 13:24:02 -0600 Subject: [PATCH 15/21] supress qhash false positive with libqt6core6/jammy-updates,now 6.2.4+dfsg-2ubuntu1.1 amd64 --- gpsbabel.supp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gpsbabel.supp b/gpsbabel.supp index a2d7405d7..7c1e9525a 100644 --- a/gpsbabel.supp +++ b/gpsbabel.supp @@ -1,12 +1,19 @@ { - + + Memcheck:Addr16 + fun:UnknownInlinedFun + fun:_ZL7aeshashPKhmm + fun:calculateHash +} +{ + Memcheck:Addr16 fun:_mm_loadu_si128 fun:_ZL7aeshashPKhmm fun:calculateHash } { - + Memcheck:Addr16 fun:_mm_loadu_si128 fun:aeshash128_lt16 From cb2799bfd26d3c648f648ef833e584f9788c4f1a Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sun, 22 Sep 2024 14:33:54 -0600 Subject: [PATCH 16/21] suppress vg warnings on noble (intermittant). --- gpsbabel.supp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gpsbabel.supp b/gpsbabel.supp index 7c1e9525a..30aacaff8 100644 --- a/gpsbabel.supp +++ b/gpsbabel.supp @@ -5,6 +5,12 @@ fun:_ZL7aeshashPKhmm fun:calculateHash } +{ + + Memcheck:Addr16 + fun:UnknownInlinedFun + fun:_ZL15aeshash128_lt16Dv2_xPKhm +} { Memcheck:Addr16 From 06d7a71ba3d909e60a04c50610934c9a0f989f1e Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sun, 22 Sep 2024 14:48:32 -0600 Subject: [PATCH 17/21] install qt core dbgsyms for valgrind suppression. --- tools/Dockerfile_jammy | 6 ++++++ tools/Dockerfile_noble | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/tools/Dockerfile_jammy b/tools/Dockerfile_jammy index bd6b75b9b..59671c317 100644 --- a/tools/Dockerfile_jammy +++ b/tools/Dockerfile_jammy @@ -89,6 +89,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ qt6-wayland \ && rm -rf /var/lib/apt/lists/* +# dbgsyms for "libqt6core6/jammy-updates,now 6.2.4+dfsg-2ubuntu1.1 amd64" needed for gpsbabel.supp +# these aren't on the debuginfod server, or on http://ddebs.ubuntu.com +RUN curl -L http://launchpadlibrarian.net/638061995/libqt6core6-dbgsym_6.2.4+dfsg-2ubuntu1.1_amd64.ddeb -o libqt6core6-dbgsym_6.2.4+dfsg-2ubuntu1.1_amd64.ddeb \ + && apt-get install ./libqt6core6-dbgsym_6.2.4+dfsg-2ubuntu1.1_amd64.ddeb \ + && rm -f ./libqt6core6-dbgsym_6.2.4+dfsg-2ubuntu1.1_amd64 + # pkgs needed to generate coverage report: RUN apt-get update && apt-get install -y --no-install-recommends \ gcovr \ diff --git a/tools/Dockerfile_noble b/tools/Dockerfile_noble index a96fa1683..ac01c7e92 100644 --- a/tools/Dockerfile_noble +++ b/tools/Dockerfile_noble @@ -71,6 +71,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ qt6-wayland \ && rm -rf /var/lib/apt/lists/* +# dbgsyms for "libqt6core6t64/noble,now 6.4.2+dfsg-21.1build5 amd64" needed for gpsbabel.supp +RUN apt-get update && apt-get install -y --no-install-recommends ubuntu-dbgsym-keyring \ + && echo "deb http://ddebs.ubuntu.com noble main restricted universe multiverse" >> /etc/apt/sources.list.d/ddebs.list \ + && echo "deb http://ddebs.ubuntu.com noble-updates main restricted universe multiverse" >> /etc/apt/sources.list.d/ddebs.list \ + && echo "deb http://ddebs.ubuntu.com noble-proposed main restricted universe multiverse" >> /etc/apt/sources.list.d/ddebs.list \ + && apt-get update && apt-get install -y --no-install-recommends libqt6core6t64-dbgsym \ + && rm -rf /var/lib/apt/lists/* + # pkgs needed to generate coverage report: RUN apt-get update && apt-get install -y --no-install-recommends \ gcovr \ From c64a70a3b08eb32e20d3cfb7d8d456aeb224ff91 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sun, 22 Sep 2024 15:02:05 -0600 Subject: [PATCH 18/21] kill space preceding newline when stripping html. --- reference/gc/GC7FA4.text | 12 ++++++------ reference/gc/GCGCA8-encoded.txt | 2 +- reference/gc/GCGCA8.txt | 2 +- reference/gc/GCGCA8~vcard.vcf | 2 +- util.cc | 10 ++++------ 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/reference/gc/GC7FA4.text b/reference/gc/GC7FA4.text index 51dfba954..90b1d9c6a 100644 --- a/reference/gc/GC7FA4.text +++ b/reference/gc/GC7FA4.text @@ -4,18 +4,18 @@ Points géodésiques du Québec by Sverdrup2 - Locationless (Reverse) Cache / Vi LES COORDONÉES PUBLIÉES NE REPRÉSENTENT PAS LA LOCALISATION D'UNE CACHE PUBLISHED COORDINATES DO NOT REPRESENT THE LOCALIZATION OF A CACHE -Le but de cette cache virtuelle est de trouver les points géodésiques du territoire québécois. Les points géodésiques sont faciles à identifier (capuchons de laiton au niveau du sol). Généralement, il y a un panneau de couleur orange sur un poteau à proximité du point. Sur ce panneau, le numéro du point est identifié. Aussi, la distance relative du panneau au point est indiquée. +Le but de cette cache virtuelle est de trouver les points géodésiques du territoire québécois. Les points géodésiques sont faciles à identifier (capuchons de laiton au niveau du sol). Généralement, il y a un panneau de couleur orange sur un poteau à proximité du point. Sur ce panneau, le numéro du point est identifié. Aussi, la distance relative du panneau au point est indiquée. Pour inscrire votre découverte, vous devez prendre en note le NUMÉRO DU POINT(inscrit sur le point même ou au centre du panneau)LA COORDONNÉE(en format HDDD MM.MM WGS84 datum ET UTM NAD83 indiquer la zone SVP)et L'ALTITUDE RELATIVE. Si le points n'est pas visible (il se peut qu'il soit sous quelques centimètres de terre) vous pouvez prendre la coordonnée à l'emplacement du panneau SI LA PRÉCISION DE VOTRE GPS EST SUPÉRIEUR À LA DISTANCE INSCRITE SUR LE PANNEAU (ex : Précison du GPS de 5m et distance au point inscrite sur le panneau de 3m). Une photo du point ou du panneau et une description générale des lieux serait aussi des informations importantes. Enfin, il faudrait aussi prendre en note l'organisme propriétaire du point géodésique. Au Québec il en existe plusieurs: Le Service de la géodésie du Québec, Ministère des Ressources naturelles, Québec - La Division des levés géodésiques, Géomatique Canada, Secteur des sciences de la terre Ressources naturelles Canada - Le Service hydrographique du Canada, Direction des sciences, Pêches et Océans Canada et la Garde côtière canadienne, Pêches et Océans Canada + La Division des levés géodésiques, Géomatique Canada, Secteur des sciences de la terre Ressources naturelles Canada + Le Service hydrographique du Canada, Direction des sciences, Pêches et Océans Canada et la Garde côtière canadienne, Pêches et Océans Canada Et tout les anciens noms de ministères et/ou organisme Des photos de points de même que des panneaux suivront bientôt. VOUS NE POUVEZ INSCRIRE QU'UN SEUL POINT GÉODÉSIQUE (UN POINT PAR GÉOCACHEUR) Bonne chance! - The goal of this virtual cache is to find the geodetic points of Québec’s territory. The geodetic points are easy to identify (Brass cap at ground level) Generally, there is an orange panel of on a post near the point. On this panel, the number of the point is identified. Also, the distance relating from the panel to the point is also indicated. In order to log your find, you must take in note THE NUMBER OF THE POINT(registered on the point or in the center of the panel) and THE COORDINATES(in format HDDD MM.MM WGS84 datum AND UTM NAD83 indicate the zone please)and THE ALTITUDE. If the point is not visible (it may be buried under few centimetres) you can take the coordinate at the panel IF THE ACCURACY OF YOUR GPS IS HIGHER Than the DISTANCE REGISTERED ON the PANEL. (Ex: accuracy of the GPS is 5m and the distance to the point registered on the panel is 3m). - A picture of the point or panel and a general description of the places would be also significant information. Finally, it would also be important to take in note the organization owner of the geodetic point. In Quebec there are several: - The "Service de la géodésie du Québec, Ministère des Ressources naturelles Québec" The Geodetic Survey Division, Geomatics Canada, Earth Sciences Sector, Natural Resources Canada The Canadian Hydrographic Service, Sciences Directorate, Fisheries and Oceans Canada and the Canadian Coast Guard, Fisheries and Oceans Canada And all old names of ministries and/or organization + The goal of this virtual cache is to find the geodetic points of Québec’s territory. The geodetic points are easy to identify (Brass cap at ground level) Generally, there is an orange panel of on a post near the point. On this panel, the number of the point is identified. Also, the distance relating from the panel to the point is also indicated. In order to log your find, you must take in note THE NUMBER OF THE POINT(registered on the point or in the center of the panel) and THE COORDINATES(in format HDDD MM.MM WGS84 datum AND UTM NAD83 indicate the zone please)and THE ALTITUDE. If the point is not visible (it may be buried under few centimetres) you can take the coordinate at the panel IF THE ACCURACY OF YOUR GPS IS HIGHER Than the DISTANCE REGISTERED ON the PANEL. (Ex: accuracy of the GPS is 5m and the distance to the point registered on the panel is 3m). + A picture of the point or panel and a general description of the places would be also significant information. Finally, it would also be important to take in note the organization owner of the geodetic point. In Quebec there are several: + The "Service de la géodésie du Québec, Ministère des Ressources naturelles Québec" The Geodetic Survey Division, Geomatics Canada, Earth Sciences Sector, Natural Resources Canada The Canadian Hydrographic Service, Sciences Directorate, Fisheries and Oceans Canada and the Canadian Coast Guard, Fisheries and Oceans Canada And all old names of ministries and/or organization PICTURES of points and of the panels will follow soon. YOU CAN ONLY LOG ONE POINT (ONE POINT PER GEOCACHER) Good luck! Found it by Christopher R & Pooh B on 2005-07-12 diff --git a/reference/gc/GCGCA8-encoded.txt b/reference/gc/GCGCA8-encoded.txt index ac6b2e750..96a309dd4 100644 --- a/reference/gc/GCGCA8-encoded.txt +++ b/reference/gc/GCGCA8-encoded.txt @@ -4,7 +4,7 @@ Oozy rat in a sanitary zoo by robertlipe - Unknown Cache / Unknown - (3 / 2) The cache is not at the coordinates above. These coords will get you to the correct park and within 1/2 mile of the cache. The cache is within 35 feet of the trail. It is not handicapped accessible. It is a nice walk in the woods that is practical for all ages. There is no space in the container for trading items. You should bring a writing stick and bug spray is recommended. -So if the cache isn't at the above coordinates, where is it? Too bad I hid a boot Too hot to hoot Never odd or even Do geese see God? "Do nine men interpret?" "Nine men," I nod Rats live on no evil star Go hang a salami, I'm a lasagna hog Now that it's intuitively obvious to even the most casual observer where the cache is, turn on your geo-mojo and go find it. +So if the cache isn't at the above coordinates, where is it? Too bad I hid a boot Too hot to hoot Never odd or even Do geese see God? "Do nine men interpret?" "Nine men," I nod Rats live on no evil star Go hang a salami, I'm a lasagna hog Now that it's intuitively obvious to even the most casual observer where the cache is, turn on your geo-mojo and go find it. [IMG] diff --git a/reference/gc/GCGCA8.txt b/reference/gc/GCGCA8.txt index ac6b2e750..96a309dd4 100644 --- a/reference/gc/GCGCA8.txt +++ b/reference/gc/GCGCA8.txt @@ -4,7 +4,7 @@ Oozy rat in a sanitary zoo by robertlipe - Unknown Cache / Unknown - (3 / 2) The cache is not at the coordinates above. These coords will get you to the correct park and within 1/2 mile of the cache. The cache is within 35 feet of the trail. It is not handicapped accessible. It is a nice walk in the woods that is practical for all ages. There is no space in the container for trading items. You should bring a writing stick and bug spray is recommended. -So if the cache isn't at the above coordinates, where is it? Too bad I hid a boot Too hot to hoot Never odd or even Do geese see God? "Do nine men interpret?" "Nine men," I nod Rats live on no evil star Go hang a salami, I'm a lasagna hog Now that it's intuitively obvious to even the most casual observer where the cache is, turn on your geo-mojo and go find it. +So if the cache isn't at the above coordinates, where is it? Too bad I hid a boot Too hot to hoot Never odd or even Do geese see God? "Do nine men interpret?" "Nine men," I nod Rats live on no evil star Go hang a salami, I'm a lasagna hog Now that it's intuitively obvious to even the most casual observer where the cache is, turn on your geo-mojo and go find it. [IMG] diff --git a/reference/gc/GCGCA8~vcard.vcf b/reference/gc/GCGCA8~vcard.vcf index 1d94b1408..3ea25b265 100644 --- a/reference/gc/GCGCA8~vcard.vcf +++ b/reference/gc/GCGCA8~vcard.vcf @@ -3,5 +3,5 @@ VERSION:3.0 N:Oozy rat in a sanitary zoo;GCGCA8;;; ADR:N35 55.300 W86 51.700 URL:https://www.geocaching.com/geocache/GCGCA8 -NOTE:The cache is not at the coordinates above. These coords will get you to the correct park and within 1/2 mile of the cache. The cache is within 35 feet of the trail. It is not handicapped accessible. It is a nice walk in the woods that is practical for all ages. There is no space in the container for trading items. You should bring a writing stick and bug spray is recommended.\nSo if the cache isn't at the above coordinates\, where is it? Too bad I hid a boot Too hot to hoot Never odd or even Do geese see God? "Do nine men interpret?" "Nine men\," I nod Rats live on no evil star Go hang a salami\, I'm a lasagna hog Now that it's intuitively obvious to even the most casual observer where the cache is\, turn on your geo-mojo and go find it. \n [IMG]\n \n\n\nHINT:\n +NOTE:The cache is not at the coordinates above. These coords will get you to the correct park and within 1/2 mile of the cache. The cache is within 35 feet of the trail. It is not handicapped accessible. It is a nice walk in the woods that is practical for all ages. There is no space in the container for trading items. You should bring a writing stick and bug spray is recommended.\nSo if the cache isn't at the above coordinates\, where is it? Too bad I hid a boot Too hot to hoot Never odd or even Do geese see God? "Do nine men interpret?" "Nine men\," I nod Rats live on no evil star Go hang a salami\, I'm a lasagna hog Now that it's intuitively obvious to even the most casual observer where the cache is\, turn on your geo-mojo and go find it. \n [IMG]\n \n\n\nHINT:\n END:VCARD diff --git a/util.cc b/util.cc index c3a6db059..1a2956f40 100644 --- a/util.cc +++ b/util.cc @@ -781,7 +781,7 @@ QString strip_html(const QString& utfstring) static const QRegularExpression re("(?:<(?[^ >]*).*?>)|(?:&(?.*?);)|(?[^<&]+)|(?.+)", QRegularExpression::DotMatchesEverythingOption); assert(re.isValid()); - static const QRegularExpression newlinespace_re("\\n\\s*"); + static const QRegularExpression newlinespace_re("\\s*\\n\\s*"); assert(newlinespace_re.isValid()); QString out; @@ -793,11 +793,9 @@ QString strip_html(const QString& utfstring) if (!match.captured(u"tag").isNull()) { QString tag = match.captured(u"tag"); //qDebug() << "tag match:" << tag; - if (tag.compare("p", Qt::CaseInsensitive) == 0) { - out.append('\n'); - } else if (tag.compare("br", Qt::CaseInsensitive) == 0) { - out.append('\n'); - } else if (tag.compare("/tr", Qt::CaseInsensitive) == 0) { + if ((tag.compare("p", Qt::CaseInsensitive) == 0) || + (tag.compare("br", Qt::CaseInsensitive) == 0) || + (tag.compare("/tr", Qt::CaseInsensitive) == 0)) { out.append('\n'); } else if (tag.compare("/td", Qt::CaseInsensitive) == 0) { out.append(' '); From 44888b8d747477dda9f218532f9a27520312cf1e Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sun, 22 Sep 2024 15:54:35 -0600 Subject: [PATCH 19/21] use modernize-raw-string-literal --- util.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util.cc b/util.cc index 1a2956f40..4259d345f 100644 --- a/util.cc +++ b/util.cc @@ -781,7 +781,7 @@ QString strip_html(const QString& utfstring) static const QRegularExpression re("(?:<(?[^ >]*).*?>)|(?:&(?.*?);)|(?[^<&]+)|(?.+)", QRegularExpression::DotMatchesEverythingOption); assert(re.isValid()); - static const QRegularExpression newlinespace_re("\\s*\\n\\s*"); + static const QRegularExpression newlinespace_re(R"(\s*\n\s*)"); assert(newlinespace_re.isValid()); QString out; From e9d8453f87ebd7521cbc56d1947ee60578c2f961 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Mon, 23 Sep 2024 07:45:24 -0600 Subject: [PATCH 20/21] valgrind suppressions for f40 --- gpsbabel.supp | 8 ++++++++ tools/Dockerfile_f40 | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gpsbabel.supp b/gpsbabel.supp index 30aacaff8..3cbfa1e70 100644 --- a/gpsbabel.supp +++ b/gpsbabel.supp @@ -1,3 +1,11 @@ +{ + + Memcheck:Addr16 + fun:UnknownInlinedFun + fun:aeshash128_lt16 + fun:_ZL10aeshash128PKhmmm + fun:calculateHash +} { Memcheck:Addr16 diff --git a/tools/Dockerfile_f40 b/tools/Dockerfile_f40 index fe9e83448..7bf2c3ef3 100644 --- a/tools/Dockerfile_f40 +++ b/tools/Dockerfile_f40 @@ -13,10 +13,12 @@ RUN dnf install --assumeyes git make valgrind diffutils findutils langpacks-en n RUN dnf install --assumeyes libusb1-devel zlib-devel shapelib-devel && \ dnf clean all # Qt used by gpsbabel, gpsbabelfe -RUN dnf install --assumeyes qt5-qtbase-devel qt5-qtserialport-devel qt5-qtwebengine-devel qt5-linguist qt5-qttranslations && \ - dnf clean all RUN dnf install --assumeyes qt6-qtbase-devel qt6-qtserialport-devel qt6-qtwebengine-devel qt6-linguist qt6-qttranslations qt6-qt5compat-devel qt6-qttools-devel libxkbcommon-devel && \ dnf clean all # tools to build the docs RUN dnf install --assumeyes expat desktop-file-utils libxslt docbook-style-xsl fop docbook5-style-xsl docbook5-schemas && \ dnf clean all +# debuginfo for valgrind suppressions (or use DEBUGINFOD server) +#RUN dnf install --assumeyes 'dnf-command(debuginfo-install)' && \ +# dnf debuginfo-install --assumeyes qt6-qtbase && \ +# dnf clean all From 3b4ad89bb289ca09a417fe23b949a5f93d7ffb55 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Mon, 23 Sep 2024 13:51:59 -0600 Subject: [PATCH 21/21] add symbols for fedora valgrind suppression. --- tools/Dockerfile_f37 | 4 ++++ tools/Dockerfile_f38 | 4 ++++ tools/Dockerfile_f39 | 6 ++++-- tools/Dockerfile_f40 | 6 +++--- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tools/Dockerfile_f37 b/tools/Dockerfile_f37 index 426f2e5a2..bd03210df 100644 --- a/tools/Dockerfile_f37 +++ b/tools/Dockerfile_f37 @@ -20,3 +20,7 @@ RUN dnf install --assumeyes qt6-qtbase-devel qt6-qtserialport-devel qt6-qtwebeng # tools to build the docs RUN dnf install --assumeyes expat desktop-file-utils libxslt docbook-style-xsl fop docbook5-style-xsl docbook5-schemas && \ dnf clean all +# debuginfo for valgrind suppressions (or use DEBUGINFOD server) +RUN dnf install --assumeyes 'dnf-command(debuginfo-install)' && \ + dnf debuginfo-install --assumeyes qt6-qtbase && \ + dnf clean all diff --git a/tools/Dockerfile_f38 b/tools/Dockerfile_f38 index d1aa6cbd0..bd26dbde5 100644 --- a/tools/Dockerfile_f38 +++ b/tools/Dockerfile_f38 @@ -20,3 +20,7 @@ RUN dnf install --assumeyes qt6-qtbase-devel qt6-qtserialport-devel qt6-qtwebeng # tools to build the docs RUN dnf install --assumeyes expat desktop-file-utils libxslt docbook-style-xsl fop docbook5-style-xsl docbook5-schemas && \ dnf clean all +# debuginfo for valgrind suppressions (or use DEBUGINFOD server) +RUN dnf install --assumeyes 'dnf-command(debuginfo-install)' && \ + dnf debuginfo-install --assumeyes qt6-qtbase && \ + dnf clean all diff --git a/tools/Dockerfile_f39 b/tools/Dockerfile_f39 index 5d89d175f..c172680ac 100644 --- a/tools/Dockerfile_f39 +++ b/tools/Dockerfile_f39 @@ -13,10 +13,12 @@ RUN dnf install --assumeyes git make valgrind diffutils findutils langpacks-en n RUN dnf install --assumeyes libusb1-devel zlib-devel shapelib-devel && \ dnf clean all # Qt used by gpsbabel, gpsbabelfe -RUN dnf install --assumeyes qt5-qtbase-devel qt5-qtserialport-devel qt5-qtwebengine-devel qt5-linguist qt5-qttranslations && \ - dnf clean all RUN dnf install --assumeyes qt6-qtbase-devel qt6-qtserialport-devel qt6-qtwebengine-devel qt6-linguist qt6-qttranslations qt6-qt5compat-devel qt6-qttools-devel libxkbcommon-devel && \ dnf clean all # tools to build the docs RUN dnf install --assumeyes expat desktop-file-utils libxslt docbook-style-xsl fop docbook5-style-xsl docbook5-schemas && \ dnf clean all +# debuginfo for valgrind suppressions (or use DEBUGINFOD server) +RUN dnf install --assumeyes 'dnf-command(debuginfo-install)' && \ + dnf debuginfo-install --assumeyes qt6-qtbase && \ + dnf clean all diff --git a/tools/Dockerfile_f40 b/tools/Dockerfile_f40 index 7bf2c3ef3..0f037c2c4 100644 --- a/tools/Dockerfile_f40 +++ b/tools/Dockerfile_f40 @@ -19,6 +19,6 @@ RUN dnf install --assumeyes qt6-qtbase-devel qt6-qtserialport-devel qt6-qtwebeng RUN dnf install --assumeyes expat desktop-file-utils libxslt docbook-style-xsl fop docbook5-style-xsl docbook5-schemas && \ dnf clean all # debuginfo for valgrind suppressions (or use DEBUGINFOD server) -#RUN dnf install --assumeyes 'dnf-command(debuginfo-install)' && \ -# dnf debuginfo-install --assumeyes qt6-qtbase && \ -# dnf clean all +RUN dnf install --assumeyes 'dnf-command(debuginfo-install)' && \ + dnf debuginfo-install --assumeyes qt6-qtbase && \ + dnf clean all