[Libreoffice-commits] libvisio.git: 2 commits - src/lib
David Tardon
dtardon at redhat.com
Tue Jul 14 09:47:04 PDT 2015
src/lib/VSDParser.cpp | 15 +++++++--------
src/lib/VSDParser.h | 2 +-
src/lib/VSDXParser.cpp | 16 +++++++---------
src/lib/VSDXParser.h | 2 +-
4 files changed, 16 insertions(+), 19 deletions(-)
New commits:
commit 072a9025d0267c4faff12f28c3b0c63c383516fe
Author: David Tardon <dtardon at redhat.com>
Date: Tue Jul 14 18:39:41 2015 +0200
ignore errors when parsing metadata
Change-Id: Ia2f5e1882764899cc1dade967acbf474c7b80a3f
diff --git a/src/lib/VSDXParser.cpp b/src/lib/VSDXParser.cpp
index e889fff..23fc541 100644
--- a/src/lib/VSDXParser.cpp
+++ b/src/lib/VSDXParser.cpp
@@ -256,15 +256,13 @@ bool libvisio::VSDXParser::parseTheme(librevenge::RVNGInputStream *input, const
return true;
}
-bool libvisio::VSDXParser::parseMetaData(librevenge::RVNGInputStream *input, libvisio::VSDXRelationships &rels)
+void libvisio::VSDXParser::parseMetaData(librevenge::RVNGInputStream *input, libvisio::VSDXRelationships &rels) try
{
if (!input)
- return false;
+ return;
input->seek(0, librevenge::RVNG_SEEK_SET);
if (!input->isStructured())
- return false;
-
- bool result = false;
+ return;
VSDXMetaData metaData;
const libvisio::VSDXRelationship *coreProp = rels.getRelationshipByType("http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties");
@@ -273,7 +271,6 @@ bool libvisio::VSDXParser::parseMetaData(librevenge::RVNGInputStream *input, lib
const RVNGInputStreamPtr_t stream(input->getSubStreamByName(coreProp->getTarget().c_str()));
if (stream)
{
- result = true;
metaData.parse(stream.get());
}
}
@@ -284,13 +281,14 @@ bool libvisio::VSDXParser::parseMetaData(librevenge::RVNGInputStream *input, lib
const RVNGInputStreamPtr_t stream(input->getSubStreamByName(extendedProp->getTarget().c_str()));
if (stream)
{
- result = true;
metaData.parse(stream.get());
}
}
m_collector->collectMetaData(metaData.getMetaData());
-
- return result;
+}
+catch (...)
+{
+ // Ignore any exceptions in metadata. They are not important enough to stop parsing.
}
void libvisio::VSDXParser::processXmlDocument(librevenge::RVNGInputStream *input, VSDXRelationships &rels)
diff --git a/src/lib/VSDXParser.h b/src/lib/VSDXParser.h
index 069204c..9eef41e 100644
--- a/src/lib/VSDXParser.h
+++ b/src/lib/VSDXParser.h
@@ -54,7 +54,7 @@ private:
bool parsePages(librevenge::RVNGInputStream *input, const char *name);
bool parsePage(librevenge::RVNGInputStream *input, const char *name);
bool parseTheme(librevenge::RVNGInputStream *input, const char *name);
- bool parseMetaData(librevenge::RVNGInputStream *input, VSDXRelationships &rels);
+ void parseMetaData(librevenge::RVNGInputStream *input, VSDXRelationships &rels);
void processXmlDocument(librevenge::RVNGInputStream *input, VSDXRelationships &rels);
void processXmlNode(xmlTextReaderPtr reader);
commit c2eb5794e865efa74fbf1c6be8ed9fadae137d85
Author: David Tardon <dtardon at redhat.com>
Date: Tue Jul 14 18:39:28 2015 +0200
ignore errors when parsing metadata
Change-Id: I5780e7c95655766eb821045de70ed426eaa35be0
diff --git a/src/lib/VSDParser.cpp b/src/lib/VSDParser.cpp
index 5da88c7..9e75485 100644
--- a/src/lib/VSDParser.cpp
+++ b/src/lib/VSDParser.cpp
@@ -147,20 +147,18 @@ bool libvisio::VSDParser::parseMain()
return true;
}
-bool libvisio::VSDParser::parseMetaData()
+void libvisio::VSDParser::parseMetaData() try
{
if (!m_container)
- return false;
+ return;
m_container->seek(0, librevenge::RVNG_SEEK_SET);
if (!m_container->isStructured())
- return false;
- bool result = false;
+ return;
VSDMetaData metaData;
librevenge::RVNGInputStream *sumaryInfo = m_container->getSubStreamByName("\x05SummaryInformation");
if (sumaryInfo)
{
- result = true;
metaData.parse(sumaryInfo);
delete sumaryInfo;
}
@@ -168,7 +166,6 @@ bool libvisio::VSDParser::parseMetaData()
librevenge::RVNGInputStream *docSumaryInfo = m_container->getSubStreamByName("\005DocumentSummaryInformation");
if (docSumaryInfo)
{
- result = true;
metaData.parse(docSumaryInfo);
delete docSumaryInfo;
}
@@ -176,8 +173,10 @@ bool libvisio::VSDParser::parseMetaData()
m_container->seek(0, librevenge::RVNG_SEEK_SET);
metaData.parseTimes(m_container);
m_collector->collectMetaData(metaData.getMetaData());
-
- return result;
+}
+catch (...)
+{
+ // Ignore any exceptions in metadata. They are not important enough to stop parsing.
}
bool libvisio::VSDParser::parseDocument(librevenge::RVNGInputStream *input, unsigned shift)
diff --git a/src/lib/VSDParser.h b/src/lib/VSDParser.h
index 2df8547..b42c57d 100644
--- a/src/lib/VSDParser.h
+++ b/src/lib/VSDParser.h
@@ -114,7 +114,7 @@ protected:
// parser of one pass
bool parseDocument(librevenge::RVNGInputStream *input, unsigned shift);
- bool parseMetaData();
+ void parseMetaData();
// Stream handlers
void handleStreams(librevenge::RVNGInputStream *input, unsigned ptrType, unsigned shift, unsigned level);
More information about the Libreoffice-commits
mailing list