diff --git a/gpxsee.pro b/gpxsee.pro index 550da734..4da425fd 100644 --- a/gpxsee.pro +++ b/gpxsee.pro @@ -104,7 +104,6 @@ HEADERS += src/common/config.h \ src/map/IMG/raster.h \ src/map/IMG/rastertile.h \ src/map/IMG/shield.h \ - src/map/mapsforge/cmp.h \ src/map/mapsforge/style.h \ src/map/textpathitem.h \ src/map/textpointitem.h \ diff --git a/src/map/mapsforge/cmp.h b/src/map/mapsforge/cmp.h deleted file mode 100644 index ce7ed5cb..00000000 --- a/src/map/mapsforge/cmp.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef MAPSFORGE_CMP_H -#define MAPSFORGE_CMP_H - -#include -#include - -namespace Mapsforge { - -inline bool cmp(const QByteArray &b1, const QByteArray &b2) -{ - int len = b1.length(); - - if (!len) - return true; - if (len != b2.length()) - return false; - return !memcmp(b1.constData(), b2.constData(), len); -} - -} - -#endif // MAPSFORGE_CMP_H diff --git a/src/map/mapsforge/mapdata.h b/src/map/mapsforge/mapdata.h index 3e89faab..9a49beaf 100644 --- a/src/map/mapsforge/mapdata.h +++ b/src/map/mapsforge/mapdata.h @@ -9,7 +9,6 @@ #include "common/rtree.h" #include "common/range.h" #include "common/polygon.h" -#include "cmp.h" namespace Mapsforge { @@ -34,7 +33,7 @@ public: } bool operator==(const Tag &other) const - {return cmp(key, other.key) && cmp(value, other.value);} + {return (key == other.key && value == other.value);} QByteArray key; QByteArray value; diff --git a/src/map/mapsforge/rastertile.h b/src/map/mapsforge/rastertile.h index 444dcd52..bf7c3129 100644 --- a/src/map/mapsforge/rastertile.h +++ b/src/map/mapsforge/rastertile.h @@ -6,7 +6,6 @@ #include "map/transform.h" #include "style.h" #include "mapdata.h" -#include "cmp.h" class MapsforgeMap; class TextItem; diff --git a/src/map/mapsforge/style.cpp b/src/map/mapsforge/style.cpp index 564740e7..581dcfe3 100644 --- a/src/map/mapsforge/style.cpp +++ b/src/map/mapsforge/style.cpp @@ -205,9 +205,9 @@ void Style::rule(QXmlStreamReader &reader, const QString &dir, return; } - if (attr.value("e") == "way") + if (attr.value("e").toString() == "way") r.setType(Rule::WayType); - else if (attr.value("e") == "node") + else if (attr.value("e").toString() == "node") r.setType(Rule::NodeType); if (attr.hasAttribute("zoom-min")) @@ -224,7 +224,7 @@ void Style::rule(QXmlStreamReader &reader, const QString &dir, QList keys(attr.value("k").toLatin1().split('|')); QList vals(attr.value("v").toLatin1().split('|')); - r.addFilter(Rule::Filter(keys, vals)); + r.addFilter(Rule::Filter(keys, vals)); while (reader.readNextStartElement()) { if (reader.name() == QLatin1String("rule")) diff --git a/src/map/mapsforge/style.h b/src/map/mapsforge/style.h index 7bb97f45..29f136f1 100644 --- a/src/map/mapsforge/style.h +++ b/src/map/mapsforge/style.h @@ -11,6 +11,17 @@ class QXmlStreamReader; namespace Mapsforge { +inline bool wcmp(const QByteArray &b1, const QByteArray &b2) +{ + int len = b1.length(); + + if (!len) + return true; + if (len != b2.length()) + return false; + return !memcmp(b1.constData(), b2.constData(), len); +} + class Style { public: @@ -85,7 +96,7 @@ public: { for (int i = 0; i < _keys.size(); i++) for (int j = 0; j < tags.size(); j++) - if (cmp(_keys.at(i), tags.at(j).key)) + if (wcmp(_keys.at(i), tags.at(j).key)) return true; return false; @@ -95,7 +106,7 @@ public: { for (int i = 0; i < _vals.size(); i++) for (int j = 0; j < tags.size(); j++) - if (cmp(_vals.at(i), tags.at(j).value)) + if (wcmp(_vals.at(i), tags.at(j).value)) return true; return false;