summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFridrich Štrba <fridrich.strba@bluewin.ch>2011-11-21 14:03:57 +0100
committerFridrich Štrba <fridrich.strba@bluewin.ch>2011-11-21 14:03:57 +0100
commit8b362a7d2c054625065aa9df5a35f5b5a82b283a (patch)
treee77f50b1ed3f982fd6f1dae22185616ece37dc1e /src
parent9079e1765032e696acdbf41914a7923ebb517b73 (diff)
Use Valek's revised knowledge of block parsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/VSD6Parser.cpp60
1 files changed, 48 insertions, 12 deletions
diff --git a/src/lib/VSD6Parser.cpp b/src/lib/VSD6Parser.cpp
index bce7b13..95aa487 100644
--- a/src/lib/VSD6Parser.cpp
+++ b/src/lib/VSD6Parser.cpp
@@ -216,7 +216,7 @@ void libvisio::VSD6Parser::readName(WPXInputStream *input)
void libvisio::VSD6Parser::readTextField(WPXInputStream *input)
{
-// unsigned long initialPosition = input->tell();
+ unsigned long initialPosition = input->tell();
input->seek(7, WPX_SEEK_CUR);
unsigned char tmpCode = readU8(input);
if (tmpCode == 0xe8)
@@ -234,19 +234,54 @@ void libvisio::VSD6Parser::readTextField(WPXInputStream *input)
double numericValue = readDouble(input);
input->seek(2, WPX_SEEK_CUR);
int formatStringId = (int)readU32(input);
- input->seek(20, WPX_SEEK_CUR);
- unsigned char tmpCode = readU8(input);
- unsigned short formatNumber = 0xffff;
-// ::WPXBinaryData formatString;
- if (0x62 == tmpCode)
- formatNumber = readU16(input);
- /* else if (0x60 == tmpCode)
+
+ unsigned blockIdx = 0;
+ unsigned length = 0;
+ unsigned short formatNumber = 0;
+ input->seek(initialPosition+0x24, WPX_SEEK_SET);
+ while (blockIdx != 2 && !input->atEOS() && (unsigned long) input->tell() < (unsigned long)(initialPosition+m_header.dataLength+m_header.trailer))
+ {
+ unsigned long inputPos = input->tell();
+ length = readU32(input);
+ if (!length)
+ break;
+ input->seek(1, WPX_SEEK_CUR);
+ blockIdx = readU8(input);
+ if (blockIdx != 2)
+ input->seek(inputPos + length, WPX_SEEK_SET);
+ else
+ {
+ input->seek(1, WPX_SEEK_CUR);
+ formatNumber = readU16(input);
+ if (0x80 != readU8(input))
+ {
+ input->seek(inputPos + length, WPX_SEEK_SET);
+ blockIdx = 0;
+ }
+ else
{
- unsigned char tmpLength = readU8(input);
- for (; tmpLength > 0; tmpLength--)
- formatString.append(readU8(input));
+ if (0xc2 != readU8(input))
+ {
+ input->seek(inputPos + length, WPX_SEEK_SET);
+ blockIdx = 0;
+ }
+ else
+ break;
}
- */
+ }
+ }
+
+ if (input->atEOS())
+ return;
+
+ if (blockIdx != 2)
+ {
+ if (tmpCode == 0x28)
+ formatNumber = 200;
+ else
+ formatNumber = 0xffff;
+ }
+
if (m_isStencilStarted)
m_stencilShape.m_fields.addNumericField(m_header.id, m_header.level, formatNumber, numericValue, formatStringId);
else
@@ -254,4 +289,5 @@ void libvisio::VSD6Parser::readTextField(WPXInputStream *input)
}
}
+
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */