diff --git a/src/map/IMG/huffmanstream.h b/src/map/IMG/huffmanstream.h index c64633e0..a0a77ebc 100644 --- a/src/map/IMG/huffmanstream.h +++ b/src/map/IMG/huffmanstream.h @@ -84,10 +84,7 @@ public: bool readNext(qint32 &lonDelta, qint32 &latDelta) { - if (!(readDelta(_lonSign, lonDelta) && readDelta(_latSign, latDelta))) - return false; - - return (lonDelta || latDelta); + return (readDelta(_lonSign, lonDelta) && readDelta(_latSign, latDelta)); } protected: diff --git a/src/map/IMG/netfile.cpp b/src/map/IMG/netfile.cpp index 16d47cda..46072d7f 100644 --- a/src/map/IMG/netfile.cpp +++ b/src/map/IMG/netfile.cpp @@ -152,6 +152,9 @@ bool NETFile::readLine(BitStream4R &bs, const SubDiv *subdiv, qint32 lonDelta, latDelta; while (stream.readNext(lonDelta, latDelta)) { + if (!(lonDelta | latDelta)) + break; + pos.rx() += LS(lonDelta, 32-subdiv->bits()); if (pos.rx() < 0 && subdiv->lon() >= 0) pos.rx() = 0x7fffffff; @@ -235,6 +238,8 @@ bool NETFile::readShape(const NODFile *nod, SubFile::Handle &nodHdl, if (!stream.readNext(lonDelta, latDelta)) break; + if (!(lonDelta | latDelta) && !startWithStream) + break; if (hasAdjustBit && !stream.read(1, adjustBit)) return false; diff --git a/src/map/IMG/rgnfile.cpp b/src/map/IMG/rgnfile.cpp index abe90654..f7087cff 100644 --- a/src/map/IMG/rgnfile.cpp +++ b/src/map/IMG/rgnfile.cpp @@ -387,6 +387,9 @@ bool RGNFile::extPolyObjects(Handle &hdl, const SubDiv *subdiv, quint32 shift, poly.points.append(QPointF(c.lon(), c.lat())); while (stream.readNext(lonDelta, latDelta)) { + if (!(lonDelta | latDelta)) + break; + pos.rx() += LS(lonDelta, 32-subdiv->bits()-shift); if (pos.rx() < 0 && subdiv->lon() >= 0) pos.rx() = 0x7fffffff;