mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-30 22:51:16 +01:00
Fixed label pointer parsing
This commit is contained in:
parent
b5893cf506
commit
d291e55bdb
@ -12,6 +12,22 @@ bool BitStream1::flush()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BitStream1::readUInt24(quint32 &val)
|
||||||
|
{
|
||||||
|
quint8 b;
|
||||||
|
|
||||||
|
val = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
if (!read(8, b))
|
||||||
|
return false;
|
||||||
|
val |= (b << (i * 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool BitStream4F::flush()
|
bool BitStream4F::flush()
|
||||||
{
|
{
|
||||||
if (_length && !_file.seek(_hdl, _file.pos(_hdl) + _length))
|
if (_length && !_file.seek(_hdl, _file.pos(_hdl) + _length))
|
||||||
|
@ -12,6 +12,8 @@ public:
|
|||||||
bool flush();
|
bool flush();
|
||||||
quint64 bitsAvailable() const {return (quint64)_length * 8 + _remaining;}
|
quint64 bitsAvailable() const {return (quint64)_length * 8 + _remaining;}
|
||||||
|
|
||||||
|
bool readUInt24(quint32 &val);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const SubFile &_file;
|
const SubFile &_file;
|
||||||
SubFile::Handle &_hdl;
|
SubFile::Handle &_hdl;
|
||||||
|
@ -352,21 +352,19 @@ bool NETFile::linkLabel(Handle &hdl, quint32 offset, quint32 size, LBLFile *lbl,
|
|||||||
return false;
|
return false;
|
||||||
BitStream1 bs(*this, hdl, size);
|
BitStream1 bs(*this, hdl, size);
|
||||||
|
|
||||||
quint32 flags, b, labelPtr = 0;
|
quint32 flags, labelPtr;
|
||||||
if (!bs.read(8, flags))
|
if (!bs.read(8, flags))
|
||||||
return false;
|
return false;
|
||||||
for (int i = 0; i < 3; i++) {
|
if (!(flags & 1))
|
||||||
if (!bs.read(8, b))
|
return true;
|
||||||
return false;
|
|
||||||
labelPtr |= (b << (i * 8));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lbl && (labelPtr & 0x3FFFFF)) {
|
if (!bs.readUInt24(labelPtr))
|
||||||
|
return false;
|
||||||
|
if (labelPtr & 0x3FFFFF) {
|
||||||
if (labelPtr & 0x400000) {
|
if (labelPtr & 0x400000) {
|
||||||
quint32 lblOff;
|
quint32 lblOff;
|
||||||
if (lblOffset(hdl, labelPtr & 0x3FFFFF, lblOff) && lblOff)
|
if (lblOffset(hdl, labelPtr & 0x3FFFFF, lblOff) && lblOff)
|
||||||
label = lbl->label(lblHdl, lblOff);
|
label = lbl->label(lblHdl, lblOff);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
label = lbl->label(lblHdl, labelPtr & 0x3FFFFF);
|
label = lbl->label(lblHdl, labelPtr & 0x3FFFFF);
|
||||||
}
|
}
|
||||||
@ -489,8 +487,9 @@ bool NETFile::link(const SubDiv *subdiv, quint32 shift, Handle &hdl,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
linkLabel(hdl, linkOffset, _linksSize - (linkOffset - _linksOffset), lbl,
|
if (lbl)
|
||||||
lblHdl, poly.label);
|
linkLabel(hdl, linkOffset, _linksSize - (linkOffset - _linksOffset),
|
||||||
|
lbl, lblHdl, poly.label);
|
||||||
|
|
||||||
lines->append(poly);
|
lines->append(poly);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user