1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Compare commits

..

No commits in common. "6564c61b00e3fb7429fb58c6eda4b92a1bb41c57" and "5d6970c7eea6eed1a900a45c79109b7444398ff3" have entirely different histories.

4 changed files with 28 additions and 29 deletions

View File

@ -180,7 +180,7 @@ Label LBLFile::str2label(const QVector<quint8> &str, bool capitalize,
Shield(shieldType, _codec.toString(shieldLabel)));
}
Label LBLFile::label6b(const SubFile *file, Handle &fileHdl, bool capitalize,
Label LBLFile::label6b(const SubFile *file, Handle &hdl, bool capitalize,
bool convert) const
{
Shield::Type shieldType = Shield::None;
@ -191,8 +191,8 @@ Label LBLFile::label6b(const SubFile *file, Handle &fileHdl, bool capitalize,
int split = -1;
while (true) {
if (!(file->readByte(fileHdl, &b1) && file->readByte(fileHdl, &b2)
&& file->readByte(fileHdl, &b3)))
if (!(file->readByte(hdl, &b1) && file->readByte(hdl, &b2)
&& file->readByte(hdl, &b3)))
return Label();
int c[]= {b1>>2, (b1&0x3)<<4|b2>>4, (b2&0xF)<<2|b3>>6, b3&0x3F};
@ -244,14 +244,14 @@ Label LBLFile::label6b(const SubFile *file, Handle &fileHdl, bool capitalize,
}
}
Label LBLFile::label8b(const SubFile *file, Handle &fileHdl, bool capitalize,
Label LBLFile::label8b(const SubFile *file, Handle &hdl, bool capitalize,
bool convert) const
{
QVector<quint8> str;
quint8 c;
do {
if (!file->readByte(fileHdl, &c))
if (!file->readByte(hdl, &c))
return Label();
str.append(c);
} while (c);
@ -259,12 +259,13 @@ Label LBLFile::label8b(const SubFile *file, Handle &fileHdl, bool capitalize,
return str2label(str, capitalize, convert);
}
Label LBLFile::labelHuffman(Handle &hdl, const SubFile *file, Handle &fileHdl,
bool capitalize, bool convert) const
Label LBLFile::labelHuffman(const SubFile *file, Handle &hdl, bool capitalize,
bool convert) const
{
QVector<quint8> str;
quint32 end = _offset + _size;
if (!_huffmanText->decode(file, fileHdl, 0xFFFFFFFF, str))
if (!_huffmanText->decode(file, hdl, end - pos(hdl), str))
return Label();
if (!_table)
return str2label(str, capitalize, convert);
@ -283,7 +284,7 @@ Label LBLFile::labelHuffman(Handle &hdl, const SubFile *file, Handle &fileHdl,
else if (str2.size())
str2.append(' ');
if (!_huffmanText->decode(this, hdl, _offset + _size - off, str2))
if (!_huffmanText->decode(file, hdl, end - off, str2))
return Label();
} else {
if (str.at(i) == 7) {
@ -319,20 +320,20 @@ Label LBLFile::label(Handle &hdl, quint32 offset, bool poi, bool capitalize,
if (!seek(hdl, labelOffset))
return Label();
return label(hdl, this, hdl, capitalize, convert);
return label(this, hdl, capitalize, convert);
}
Label LBLFile::label(Handle &hdl, const SubFile *file, Handle &fileHdl,
bool capitalize, bool convert) const
Label LBLFile::label(const SubFile *file, Handle &hdl, bool capitalize,
bool convert) const
{
switch (_encoding) {
case 6:
return label6b(file, fileHdl, capitalize, convert);
return label6b(file, hdl, capitalize, convert);
case 9:
case 10:
return label8b(file, fileHdl, capitalize, convert);
return label8b(file, hdl, capitalize, convert);
case 11:
return labelHuffman(hdl, file, fileHdl, capitalize, convert);
return labelHuffman(file, hdl, capitalize, convert);
default:
return Label();
}

View File

@ -33,8 +33,8 @@ public:
Label label(Handle &hdl, quint32 offset, bool poi = false,
bool capitalize = true, bool convert = false) const;
Label label(Handle &hdl, const SubFile *file, Handle &fileHdl,
bool capitalize = true, bool convert = false) const;
Label label(const SubFile *file, Handle &hdl, bool capitalize = true,
bool convert = false) const;
quint8 imageIdSize() const {return _imgOffsetIdSize;}
QPixmap image(Handle &hdl, quint32 id) const;
@ -47,12 +47,12 @@ private:
Label str2label(const QVector<quint8> &str, bool capitalize,
bool convert) const;
Label label6b(const SubFile *file, Handle &fileHdl, bool capitalize,
Label label6b(const SubFile *file, Handle &hdl, bool capitalize,
bool convert) const;
Label label8b(const SubFile *file, Handle &fileHdl, bool capitalize,
Label label8b(const SubFile *file, Handle &hdl, bool capitalize,
bool convert) const;
Label labelHuffman(const SubFile *file, Handle &hdl, bool capitalize,
bool convert) const;
Label labelHuffman(Handle &hdl, const SubFile *file, Handle &fileHdl,
bool capitalize, bool convert) const;
bool loadRasterTable(Handle &hdl, quint32 offset, quint32 size,
quint32 recordSize);

View File

@ -33,7 +33,7 @@ RGNFile::~RGNFile()
}
bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType,
void *object, const LBLFile *lbl, Handle &lblHdl) const
void *object, const LBLFile *lbl) const
{
quint8 flags;
quint32 rs;
@ -83,11 +83,10 @@ bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType,
if (point && (flags & 1) && lbl) {
quint32 p = pos(hdl);
point->label = lbl->label(lblHdl, this, hdl);
point->label = lbl->label(this, hdl);
point->classLabel = true;
Q_ASSERT(pos(hdl) - p <= rs + 4);
seek(hdl, p);
rs -= (pos(hdl) - p);
}
return seek(hdl, pos(hdl) + rs);
@ -357,8 +356,7 @@ bool RGNFile::extPolyObjects(Handle &hdl, const SubDiv *subdiv, quint32 shift,
if (subtype & 0x20 && !readUInt24(hdl, labelPtr))
return false;
if (subtype & 0x80 && !readClassFields(hdl, segmentType, &poly, lbl,
lblHdl))
if (subtype & 0x80 && !readClassFields(hdl, segmentType, &poly, lbl))
return false;
if (subtype & 0x40 && !skipLclFields(hdl, segmentType == Line
? _linesLclFlags : _polygonsLclFlags))
@ -448,7 +446,7 @@ bool RGNFile::extPointObjects(Handle &hdl, const SubDiv *subdiv,
if (subtype & 0x20 && !readUInt24(hdl, labelPtr))
return false;
if (subtype & 0x80 && !readClassFields(hdl, Point, &point, lbl, lblHdl))
if (subtype & 0x80 && !readClassFields(hdl, Point, &point, lbl))
return false;
if (subtype & 0x40 && !skipLclFields(hdl, _pointsLclFlags))
return false;

View File

@ -63,7 +63,7 @@ public:
private:
bool segments(Handle &hdl, SubDiv *subdiv, SubDiv::Segment seg[5]) const;
bool readClassFields(Handle &hdl, SegmentType segmentType, void *object,
const LBLFile *lbl, Handle &lblHdl) const;
const LBLFile *lbl) const;
bool skipLclFields(Handle &hdl, const quint32 flags[3]) const;
bool skipGblFields(Handle &hdl, quint32 flags) const;