[Libreoffice-commits] libvisio.git: src/lib
David Tardon
dtardon at redhat.com
Sun Nov 26 16:47:26 UTC 2017
src/lib/VSDXTheme.cpp | 15 +++++++++------
src/lib/VSDXTheme.h | 4 ++--
2 files changed, 11 insertions(+), 8 deletions(-)
New commits:
commit afa9437bec26a156aebdd60bc05fa48d68067629
Author: David Tardon <dtardon at redhat.com>
Date: Sun Nov 26 17:44:56 2017 +0100
ofz: ignore invalid/incomplete font entries
Change-Id: Ic5e6cf0afe62e92fba1503a1a3540eb50800dc3c
diff --git a/src/lib/VSDXTheme.cpp b/src/lib/VSDXTheme.cpp
index da69059..8db16e9 100644
--- a/src/lib/VSDXTheme.cpp
+++ b/src/lib/VSDXTheme.cpp
@@ -219,8 +219,8 @@ void libvisio::VSDXTheme::readFont(xmlTextReaderPtr reader, int idToken, VSDXFon
{
int script;
librevenge::RVNGString typeFace;
- readTypeFace(reader, script, typeFace);
- font.m_typeFaces[script] = typeFace;
+ if (readTypeFace(reader, script, typeFace) && !typeFace.empty())
+ font.m_typeFaces[script] = typeFace;
break;
}
default:
@@ -230,7 +230,7 @@ void libvisio::VSDXTheme::readFont(xmlTextReaderPtr reader, int idToken, VSDXFon
while ((idToken != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret);
}
-void libvisio::VSDXTheme::readTypeFace(xmlTextReaderPtr reader, librevenge::RVNGString &typeFace)
+bool libvisio::VSDXTheme::readTypeFace(xmlTextReaderPtr reader, librevenge::RVNGString &typeFace)
{
const shared_ptr<xmlChar> sTypeFace(xmlTextReaderGetAttribute(reader, BAD_CAST("typeface")), xmlFree);
if (sTypeFace)
@@ -238,18 +238,21 @@ void libvisio::VSDXTheme::readTypeFace(xmlTextReaderPtr reader, librevenge::RVNG
typeFace.clear();
typeFace.sprintf("%s", (const char *)sTypeFace.get());
}
+ return bool(sTypeFace);
}
-void libvisio::VSDXTheme::readTypeFace(xmlTextReaderPtr reader, int &script, librevenge::RVNGString &typeFace)
+bool libvisio::VSDXTheme::readTypeFace(xmlTextReaderPtr reader, int &script, librevenge::RVNGString &typeFace)
{
const shared_ptr<xmlChar> sScript(xmlTextReaderGetAttribute(reader, BAD_CAST("script")), xmlFree);
+ bool knownScript = false;
if (sScript)
{
int token = libvisio::VSDXMLTokenMap::getTokenId(sScript.get());
- if (XML_TOKEN_INVALID != token)
+ knownScript = XML_TOKEN_INVALID != token;
+ if (knownScript)
script = token;
}
- readTypeFace(reader, typeFace);
+ return readTypeFace(reader, typeFace) && knownScript;
}
void libvisio::VSDXTheme::readClrScheme(xmlTextReaderPtr reader)
diff --git a/src/lib/VSDXTheme.h b/src/lib/VSDXTheme.h
index e0de7c3..f600c96 100644
--- a/src/lib/VSDXTheme.h
+++ b/src/lib/VSDXTheme.h
@@ -94,8 +94,8 @@ private:
void readVariationClrScheme(xmlTextReaderPtr reader, VSDXVariationClrScheme &varClrSch);
void readFontScheme(xmlTextReaderPtr reader);
void readFont(xmlTextReaderPtr reader, int idToken, VSDXFont &font);
- void readTypeFace(xmlTextReaderPtr reader, librevenge::RVNGString &typeFace);
- void readTypeFace(xmlTextReaderPtr reader, int &script, librevenge::RVNGString &typeFace);
+ bool readTypeFace(xmlTextReaderPtr reader, librevenge::RVNGString &typeFace);
+ bool readTypeFace(xmlTextReaderPtr reader, int &script, librevenge::RVNGString &typeFace);
int getElementToken(xmlTextReaderPtr reader);
More information about the Libreoffice-commits
mailing list