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