diff --git a/src/common/garmin.h b/src/common/garmin.h index ddfa3f9c..9b2d15d9 100644 --- a/src/common/garmin.h +++ b/src/common/garmin.h @@ -5,37 +5,40 @@ #define LS(val, bits) ((qint32)(((quint32)(val))<<(bits))) -inline double toWGS32(qint32 v) +namespace Garmin { - return ((double)v / (double)(1U<<31)) * 180.0; -} + inline double toWGS32(qint32 v) + { + return ((double)v / (double)(1U<<31)) * 180.0; + } -inline double toWGS24(qint32 v) -{ - return toWGS32(LS(v, 8)); -} + inline double toWGS24(qint32 v) + { + return toWGS32(LS(v, 8)); + } -inline quint8 vs(const quint8 b0) -{ - static const quint8 sizes[] = {4, 1, 2, 1, 3, 1, 2, 1}; - return sizes[b0 & 0x07]; -} + inline quint8 vs(const quint8 b0) + { + static const quint8 sizes[] = {4, 1, 2, 1, 3, 1, 2, 1}; + return sizes[b0 & 0x07]; + } -inline quint8 bs(const quint8 val) -{ - return (val + 7) >> 3; -} + inline quint8 bs(const quint8 val) + { + return (val + 7) >> 3; + } -inline quint8 byteSize(quint32 val) -{ - quint8 ret = 0; + inline quint8 byteSize(quint32 val) + { + quint8 ret = 0; - do { - ret++; - val = val >> 8; - } while (val != 0); + do { + ret++; + val = val >> 8; + } while (val != 0); - return ret; + return ret; + } } #endif // GARMIN_H diff --git a/src/data/gpiparser.cpp b/src/data/gpiparser.cpp index 7442ab88..4b69e3f2 100644 --- a/src/data/gpiparser.cpp +++ b/src/data/gpiparser.cpp @@ -13,6 +13,7 @@ #include "address.h" #include "gpiparser.h" +using namespace Garmin; struct RecordHeader { quint16 type; diff --git a/src/map/IMG/huffmantable.cpp b/src/map/IMG/huffmantable.cpp index 938eb9cd..524269b3 100644 --- a/src/map/IMG/huffmantable.cpp +++ b/src/map/IMG/huffmantable.cpp @@ -1,7 +1,7 @@ #include "common/garmin.h" #include "huffmantable.h" - +using namespace Garmin; using namespace IMG; static inline quint32 readVUint32(const quint8 *buffer, quint32 bytes) diff --git a/src/map/IMG/huffmantext.cpp b/src/map/IMG/huffmantext.cpp index 97388734..c550e88e 100644 --- a/src/map/IMG/huffmantext.cpp +++ b/src/map/IMG/huffmantext.cpp @@ -2,6 +2,7 @@ #include "subfile.h" #include "huffmantext.h" +using namespace Garmin; using namespace IMG; static inline quint32 readVUint32(const quint8 *buffer, quint32 bytes) diff --git a/src/map/IMG/lblfile.cpp b/src/map/IMG/lblfile.cpp index f52ecf8c..09d48457 100644 --- a/src/map/IMG/lblfile.cpp +++ b/src/map/IMG/lblfile.cpp @@ -2,6 +2,7 @@ #include "rgnfile.h" #include "lblfile.h" +using namespace Garmin; using namespace IMG; enum Charset {Normal, Symbol, Special}; diff --git a/src/map/IMG/netfile.cpp b/src/map/IMG/netfile.cpp index 68c57c1e..19328375 100644 --- a/src/map/IMG/netfile.cpp +++ b/src/map/IMG/netfile.cpp @@ -6,6 +6,7 @@ #include "rgnfile.h" #include "netfile.h" +using namespace Garmin; using namespace IMG; static bool readAdjCounts(BitStream4R &bs, QVector &cnts, quint16 &mask) diff --git a/src/map/IMG/nodfile.cpp b/src/map/IMG/nodfile.cpp index 88dcb078..343e3e92 100644 --- a/src/map/IMG/nodfile.cpp +++ b/src/map/IMG/nodfile.cpp @@ -1,6 +1,7 @@ #include "bitstream.h" #include "nodfile.h" +using namespace Garmin; using namespace IMG; #define ARRAY_SIZE(array) \ diff --git a/src/map/IMG/raster.h b/src/map/IMG/raster.h index a5f9b586..c6c07b89 100644 --- a/src/map/IMG/raster.h +++ b/src/map/IMG/raster.h @@ -20,8 +20,9 @@ public: quint32 id() const {return _id;} const RectC rect() const { - return RectC(Coordinates(toWGS32(_rect.left()), toWGS32(_rect.top())), - Coordinates(toWGS32(_rect.right()), toWGS32(_rect.bottom()))); + return RectC(Coordinates(Garmin::toWGS32(_rect.left()), + Garmin::toWGS32(_rect.top())), Coordinates( + Garmin::toWGS32(_rect.right()), Garmin::toWGS32(_rect.bottom()))); } bool isValid() const {return (_lbl != 0);} diff --git a/src/map/IMG/rgnfile.cpp b/src/map/IMG/rgnfile.cpp index ac781f85..ecb12355 100644 --- a/src/map/IMG/rgnfile.cpp +++ b/src/map/IMG/rgnfile.cpp @@ -8,6 +8,7 @@ #include "nodfile.h" #include "rgnfile.h" +using namespace Garmin; using namespace IMG; #define MASK(bits) ((1U << (bits)) - 1U) diff --git a/src/map/IMG/trefile.cpp b/src/map/IMG/trefile.cpp index 4e187b8c..31aec96d 100644 --- a/src/map/IMG/trefile.cpp +++ b/src/map/IMG/trefile.cpp @@ -2,6 +2,7 @@ #include "subdiv.h" #include "trefile.h" +using namespace Garmin; using namespace IMG; static inline double RB(qint32 val)