[Libreoffice-commits] .: 3 commits - src/lib
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Mar 15 05:44:41 PDT 2013
src/lib/VSDContentCollector.cpp | 7 +++--
src/lib/VSDParser.cpp | 5 ++-
src/lib/VisioDocument.cpp | 51 +++++++++++++++++++++++++++++-----------
3 files changed, 44 insertions(+), 19 deletions(-)
New commits:
commit 89c2cd56fd2bd6c2c944c0dbd5e05058acc6e706
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date: Fri Mar 15 13:44:12 2013 +0100
Small cleanup
diff --git a/src/lib/VisioDocument.cpp b/src/lib/VisioDocument.cpp
index ad9ebd6..bbfe53f 100644
--- a/src/lib/VisioDocument.cpp
+++ b/src/lib/VisioDocument.cpp
@@ -372,13 +372,13 @@ bool libvisio::VisioDocument::parse(::WPXInputStream *input, libwpg::WPGPaintInt
return true;
return false;
}
- else if (isOpcVisioDocument(input))
+ if (isOpcVisioDocument(input))
{
if (parseOpcVisioDocument(input, painter, false))
return true;
return false;
}
- else if (isXmlVisioDocument(input))
+ if (isXmlVisioDocument(input))
{
if (parseXmlVisioDocument(input, painter, false))
return true;
@@ -403,13 +403,13 @@ bool libvisio::VisioDocument::parseStencils(::WPXInputStream *input, libwpg::WPG
return true;
return false;
}
- else if (isOpcVisioDocument(input))
+ if (isOpcVisioDocument(input))
{
if (parseOpcVisioDocument(input, painter, true))
return true;
return false;
}
- else if (isXmlVisioDocument(input))
+ if (isXmlVisioDocument(input))
{
if (parseXmlVisioDocument(input, painter, true))
return true;
commit 624c6b7e3603f9db5e649030e75d2943da97bc1b
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date: Fri Mar 15 12:33:27 2013 +0100
Clear the text if we were not able to read it
diff --git a/src/lib/VSDParser.cpp b/src/lib/VSDParser.cpp
index 605f102..cd7b307 100644
--- a/src/lib/VSDParser.cpp
+++ b/src/lib/VSDParser.cpp
@@ -1637,9 +1637,10 @@ void libvisio::VSDParser::readText(WPXInputStream *input)
}
textStream.append(tmpBuffer, numBytesRead);
m_shape.m_text = textStream;
- m_shape.m_textFormat = libvisio::VSD_TEXT_UTF16;
}
-
+ else
+ m_shape.m_text.clear();
+ m_shape.m_textFormat = libvisio::VSD_TEXT_UTF16;
}
void libvisio::VSDParser::readCharIX(WPXInputStream *input)
diff --git a/src/lib/VisioDocument.cpp b/src/lib/VisioDocument.cpp
index 03f0a8d..ad9ebd6 100644
--- a/src/lib/VisioDocument.cpp
+++ b/src/lib/VisioDocument.cpp
@@ -366,14 +366,25 @@ WPGPaintInterface class implementation when needed. This is often commonly calle
*/
bool libvisio::VisioDocument::parse(::WPXInputStream *input, libwpg::WPGPaintInterface *painter)
{
- if (isBinaryVisioDocument(input) && parseBinaryVisioDocument(input, painter, false))
- return true;
- else if (isOpcVisioDocument(input) && parseOpcVisioDocument(input, painter, false))
- return true;
- else if (isXmlVisioDocument(input) && parseXmlVisioDocument(input, painter, false))
- return true;
- else
+ if (isBinaryVisioDocument(input))
+ {
+ if (parseBinaryVisioDocument(input, painter, false))
+ return true;
return false;
+ }
+ else if (isOpcVisioDocument(input))
+ {
+ if (parseOpcVisioDocument(input, painter, false))
+ return true;
+ return false;
+ }
+ else if (isXmlVisioDocument(input))
+ {
+ if (parseXmlVisioDocument(input, painter, false))
+ return true;
+ return false;
+ }
+ return false;
}
/**
@@ -386,16 +397,28 @@ when needed.
*/
bool libvisio::VisioDocument::parseStencils(::WPXInputStream *input, libwpg::WPGPaintInterface *painter)
{
- if (isBinaryVisioDocument(input) && parseBinaryVisioDocument(input, painter, true))
- return true;
- else if (isOpcVisioDocument(input) && parseOpcVisioDocument(input, painter, true))
- return true;
- else if (isXmlVisioDocument(input) && parseXmlVisioDocument(input, painter, true))
- return true;
- else
+ if (isBinaryVisioDocument(input))
+ {
+ if (parseBinaryVisioDocument(input, painter, true))
+ return true;
+ return false;
+ }
+ else if (isOpcVisioDocument(input))
+ {
+ if (parseOpcVisioDocument(input, painter, true))
+ return true;
+ return false;
+ }
+ else if (isXmlVisioDocument(input))
+ {
+ if (parseXmlVisioDocument(input, painter, true))
+ return true;
return false;
+ }
+ return false;
}
+
/**
Parses the input stream content and generates a valid Scalable Vector Graphics
Provided as a convenience function for applications that support SVG internally.
commit fc18442c6f3a00fa4271dd61f71f5403278935ec
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date: Fri Mar 15 12:33:04 2013 +0100
Don't fail just because at the end of a string
diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index 6b67ae0..14bc55d 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -2920,10 +2920,8 @@ void libvisio::VSDContentCollector::appendCharacters(WPXString &text, const std:
while (true)
{
if (iter == characters.end())
- {
- fail = true;
break;
- }
+
uint16_t character = *iter++;
character |= (uint16_t)(*iter++) << 8;
if (character == 0xfffc)
@@ -2965,7 +2963,10 @@ void libvisio::VSDContentCollector::appendCharacters(WPXString &text, const std:
}
}
if (fail)
+ {
+ VSD_DEBUG_MSG(("Throwing GenericException\n"));
throw libvisio::GenericException();
+ }
if (ucs4Character == 0xa)
_appendUCS4(text, (uint32_t)'\n');
More information about the Libreoffice-commits
mailing list