[Libreoffice-commits] libvisio.git: 7 commits - src/lib
src/lib/VDXParser.cpp | 39 --- src/lib/VSD5Parser.cpp |7 --- src/lib/VSD6Parser.cpp |5 +++-- src/lib/VSDCharacterList.cpp|3 ++- src/lib/VSDContentCollector.cpp |3 ++- src/lib/VSDFieldList.cpp|3 ++- src/lib/VSDGeometryList.cpp |3 ++- src/lib/VSDInternalStream.cpp |2 +- src/lib/VSDMetaData.cpp |1 + src/lib/VSDPages.cpp|1 + src/lib/VSDParagraphList.cpp| 33 ++--- src/lib/VSDParagraphList.h |3 ++- src/lib/VSDParser.cpp | 23 +++ src/lib/VSDShapeList.cpp|2 +- src/lib/VSDStencils.cpp | 25 +++-- src/lib/VSDStencils.h |7 --- src/lib/VSDStyles.cpp |3 ++- src/lib/VSDStylesCollector.cpp |3 ++- src/lib/VSDXMLHelper.cpp|5 + src/lib/VSDXMLParserBase.cpp|9 + src/lib/VSDXMLTokenMap.cpp |1 + src/lib/VSDXMetaData.cpp|1 + src/lib/VSDXParser.cpp | 39 --- src/lib/VisioDocument.cpp |3 ++- src/lib/libvisio_utils.cpp |6 ++ src/lib/libvisio_xml.cpp|3 +++ 26 files changed, 112 insertions(+), 121 deletions(-) New commits: commit c1bb49486e73e9e19944be6a995e3bbd96210f8f Author: David TardonDate: Sun Mar 25 16:49:53 2018 +0200 move define where it should be Change-Id: Ie8080354158b01bd29c14105dce3919eb19a01e6 diff --git a/src/lib/VSDXMLHelper.cpp b/src/lib/VSDXMLHelper.cpp index c0e1cf5..6f483b8 100644 --- a/src/lib/VSDXMLHelper.cpp +++ b/src/lib/VSDXMLHelper.cpp @@ -7,10 +7,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE -#define BOOST_LEXICAL_CAST_ASSUME_C_LOCALE 1 -#endif - #include "VSDXMLHelper.h" #include diff --git a/src/lib/libvisio_xml.cpp b/src/lib/libvisio_xml.cpp index fb18627..df0c5f9 100644 --- a/src/lib/libvisio_xml.cpp +++ b/src/lib/libvisio_xml.cpp @@ -9,6 +9,9 @@ #include "libvisio_xml.h" +#ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE +#define BOOST_LEXICAL_CAST_ASSUME_C_LOCALE 1 +#endif #include #include "VSDTypes.h" commit 5fa2b1a754a026f7c36f339b396574c1c43700c8 Author: David Tardon Date: Sun Mar 25 16:48:12 2018 +0200 make sure headers are self-contained Change-Id: I77beb4ce00ec070f2599362f6462d967613abd2b diff --git a/src/lib/VDXParser.cpp b/src/lib/VDXParser.cpp index 0e5cc1b..c305ab8 100644 --- a/src/lib/VDXParser.cpp +++ b/src/lib/VDXParser.cpp @@ -7,12 +7,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "VDXParser.h" + #include #include #include #include #include -#include "VDXParser.h" #include "libvisio_utils.h" #include "libvisio_xml.h" #include "VSDContentCollector.h" diff --git a/src/lib/VSD5Parser.cpp b/src/lib/VSD5Parser.cpp index fe841cc..cfc0d94 100644 --- a/src/lib/VSD5Parser.cpp +++ b/src/lib/VSD5Parser.cpp @@ -7,13 +7,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "VSD5Parser.h" + #include #include #include #include #include #include "libvisio_utils.h" -#include "VSD5Parser.h" #include "VSDInternalStream.h" #include "VSDDocumentStructure.h" #include "VSDContentCollector.h" diff --git a/src/lib/VSD6Parser.cpp b/src/lib/VSD6Parser.cpp index ea3be55..a41016b 100644 --- a/src/lib/VSD6Parser.cpp +++ b/src/lib/VSD6Parser.cpp @@ -7,12 +7,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "VSD6Parser.h" + #include #include #include #include #include "libvisio_utils.h" -#include "VSD6Parser.h" #include "VSDInternalStream.h" #include "VSDDocumentStructure.h" #include "VSDContentCollector.h" diff --git a/src/lib/VSDCharacterList.cpp b/src/lib/VSDCharacterList.cpp index 6f9fe8e..17935fc 100644 --- a/src/lib/VSDCharacterList.cpp +++ b/src/lib/VSDCharacterList.cpp @@ -7,9 +7,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "VSDCollector.h" #include "VSDCharacterList.h" +#include "VSDCollector.h" + namespace libvisio { diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp index cde0ad0..8b297da 100644 --- a/src/lib/VSDContentCollector.cpp +++ b/src/lib/VSDContentCollector.cpp @@ -7,6 +7,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "VSDContentCollector.h" + #include #include #include // for memcpy @@ -17,7 +19,6 @@ #include #include -#include "VSDContentCollector.h" #include "VSDParser.h" #include "VSDInternalStream.h" diff --git a/src/lib/VSDFieldList.cpp b/src/lib/VSDFieldList.cpp index 363d20e..c4c16ef 100644 --- a/src/lib/VSDFieldList.cpp +++ b/src/lib/VSDFieldList.cpp @@ -7,9 +7,10 @@ * file, You can obtain one at
[Libreoffice-commits] libvisio.git: 7 commits - src/lib
src/lib/VSDContentCollector.cpp | 29 - src/lib/VSDContentCollector.h|7 --- src/lib/VSDOutputElementList.cpp | 81 ++- src/lib/VSDOutputElementList.h |5 +- 4 files changed, 62 insertions(+), 60 deletions(-) New commits: commit a77d75a76538c0217613ec59bff8a2494b61601b Author: David TardonDate: Sat Apr 15 11:45:21 2017 +0200 avoid self-assignment Change-Id: I57eb9e74fbe3430fb99d13505865e7b5633d85bf diff --git a/src/lib/VSDOutputElementList.cpp b/src/lib/VSDOutputElementList.cpp index a25da51..1d1ecde 100644 --- a/src/lib/VSDOutputElementList.cpp +++ b/src/lib/VSDOutputElementList.cpp @@ -519,10 +519,13 @@ libvisio::VSDOutputElementList::VSDOutputElementList(const libvisio::VSDOutputEl libvisio::VSDOutputElementList ::VSDOutputElementList::operator=(const libvisio::VSDOutputElementList ) { - m_elements.clear(); + if ( != this) + { +m_elements.clear(); - for (const auto : elementList.m_elements) -m_elements.push_back(clone(elem)); +for (const auto : elementList.m_elements) + m_elements.push_back(clone(elem)); + } return *this; } commit 66854863c4ea412f2ce11c2ca4c4dc4fa373f9fa Author: David Tardon Date: Sat Apr 15 11:42:24 2017 +0200 simplify container traversal Change-Id: Id2e19536a679a62f0ff7da398e44aeeca0de8ce5 diff --git a/src/lib/VSDOutputElementList.cpp b/src/lib/VSDOutputElementList.cpp index 7556dad..a25da51 100644 --- a/src/lib/VSDOutputElementList.cpp +++ b/src/lib/VSDOutputElementList.cpp @@ -513,24 +513,24 @@ libvisio::VSDOutputElementList::VSDOutputElementList() libvisio::VSDOutputElementList::VSDOutputElementList(const libvisio::VSDOutputElementList ) : m_elements() { - for (auto iter = elementList.m_elements.begin(); iter != elementList.m_elements.end(); ++iter) -m_elements.push_back(clone(*iter)); + for (const auto : elementList.m_elements) +m_elements.push_back(clone(elem)); } libvisio::VSDOutputElementList ::VSDOutputElementList::operator=(const libvisio::VSDOutputElementList ) { m_elements.clear(); - for (auto cstiter = elementList.m_elements.begin(); cstiter != elementList.m_elements.end(); ++cstiter) -m_elements.push_back(clone(*cstiter)); + for (const auto : elementList.m_elements) +m_elements.push_back(clone(elem)); return *this; } void libvisio::VSDOutputElementList::append(const libvisio::VSDOutputElementList ) { - for (auto cstiter = elementList.m_elements.begin(); cstiter != elementList.m_elements.end(); ++cstiter) -m_elements.push_back(clone(*cstiter)); + for (const auto : elementList.m_elements) +m_elements.push_back(clone(elem)); } libvisio::VSDOutputElementList::~VSDOutputElementList() @@ -539,8 +539,8 @@ libvisio::VSDOutputElementList::~VSDOutputElementList() void libvisio::VSDOutputElementList::draw(librevenge::RVNGDrawingInterface *painter) const { - for (auto iter = m_elements.begin(); iter != m_elements.end(); ++iter) -(*iter)->draw(painter); + for (const auto : m_elements) +elem->draw(painter); } void libvisio::VSDOutputElementList::addStyle(const librevenge::RVNGPropertyList ) commit ac6dd7ff5f0156e3f5ed322a1d8c96b93bf04fbd Author: David Tardon Date: Sat Apr 15 11:43:29 2017 +0200 the dtor does not need to be virtual Change-Id: I57cdfd7469b979d29da7f82e2495c183e08ac299 diff --git a/src/lib/VSDOutputElementList.h b/src/lib/VSDOutputElementList.h index aef0bab..3222596 100644 --- a/src/lib/VSDOutputElementList.h +++ b/src/lib/VSDOutputElementList.h @@ -27,7 +27,7 @@ public: VSDOutputElementList(); VSDOutputElementList(const VSDOutputElementList ); VSDOutputElementList =(const VSDOutputElementList ); - virtual ~VSDOutputElementList(); + ~VSDOutputElementList(); void append(const VSDOutputElementList ); void draw(librevenge::RVNGDrawingInterface *painter) const; void addStyle(const librevenge::RVNGPropertyList ); commit 0a9bbb5cd3d9d9fec4b2e7cc81f89cfff6c27e44 Author: David Tardon Date: Sat Apr 15 11:39:56 2017 +0200 avoid manual memory management Change-Id: Idd0c24ea2008303b948040d3cca9faf97481426c diff --git a/src/lib/VSDOutputElementList.cpp b/src/lib/VSDOutputElementList.cpp index 59cf392..7556dad 100644 --- a/src/lib/VSDOutputElementList.cpp +++ b/src/lib/VSDOutputElementList.cpp @@ -320,6 +320,23 @@ public: } // namespace libvisio +namespace +{ + +template +std::unique_ptr make_unique(Args &&... args) +{ + return std::unique_ptr(new T(std::forward(args)...)); +} + +template +std::unique_ptr clone(const std::unique_ptr ) +{ + return std::unique_ptr(other->clone()); +} + +} + libvisio::VSDStyleOutputElement::VSDStyleOutputElement(const librevenge::RVNGPropertyList ) : m_propList(propList) {} @@ -496,131 +513,124 @@ libvisio::VSDOutputElementList::VSDOutputElementList()
[Libreoffice-commits] libvisio.git: 7 commits - src/lib
src/lib/VDXParser.cpp | 12 +++- src/lib/VSD5Parser.cpp|2 +- src/lib/VSD6Parser.cpp|2 +- src/lib/VSDParser.cpp |5 - src/lib/VSDXMLHelper.cpp | 18 ++ src/lib/VSDXMetaData.cpp | 15 --- src/lib/VSDXParser.cpp|6 +++--- src/lib/VSDXTheme.cpp | 14 +++--- src/lib/VisioDocument.cpp | 24 +--- 9 files changed, 50 insertions(+), 48 deletions(-) New commits: commit 17b71055939e80ea83506c633b908ca831bd0fad Author: David Tardon dtar...@redhat.com Date: Wed Jul 15 19:02:28 2015 +0200 don't leak in case of exception Change-Id: Ib9eb9e02b678bc892b4cefd9fb793a06b2302879 diff --git a/src/lib/VDXParser.cpp b/src/lib/VDXParser.cpp index 38b7a6c..1776de2 100644 --- a/src/lib/VDXParser.cpp +++ b/src/lib/VDXParser.cpp @@ -12,6 +12,7 @@ #include libxml/xmlstring.h #include librevenge-stream/librevenge-stream.h #include boost/algorithm/string.hpp +#include boost/shared_ptr.hpp #include VDXParser.h #include libvisio_utils.h #include VSDContentCollector.h @@ -73,17 +74,18 @@ bool libvisio::VDXParser::processXmlDocument(librevenge::RVNGInputStream *input) if (!input) return false; - xmlTextReaderPtr reader = xmlReaderForStream(input, 0, 0, XML_PARSE_NOBLANKS|XML_PARSE_NOENT|XML_PARSE_NONET|XML_PARSE_RECOVER); + const boost::shared_ptrxmlTextReader reader( +xmlReaderForStream(input, 0, 0, XML_PARSE_NOBLANKS|XML_PARSE_NOENT|XML_PARSE_NONET|XML_PARSE_RECOVER), +xmlFreeTextReader); if (!reader) return false; - int ret = xmlTextReaderRead(reader); + int ret = xmlTextReaderRead(reader.get()); while (1 == ret) { -processXmlNode(reader); +processXmlNode(reader.get()); -ret = xmlTextReaderRead(reader); +ret = xmlTextReaderRead(reader.get()); } - xmlFreeTextReader(reader); return true; } diff --git a/src/lib/VSDXMLHelper.cpp b/src/lib/VSDXMLHelper.cpp index 925e70b..b42b093 100644 --- a/src/lib/VSDXMLHelper.cpp +++ b/src/lib/VSDXMLHelper.cpp @@ -16,6 +16,7 @@ #include vector #include boost/algorithm/string.hpp #include boost/lexical_cast.hpp +#include boost/shared_ptr.hpp #include libxml/xmlIO.h #include libxml/xmlstring.h #include librevenge-stream/librevenge-stream.h @@ -264,7 +265,9 @@ libvisio::VSDXRelationships::VSDXRelationships(librevenge::RVNGInputStream *inpu { if (input) { -shared_ptrxmlTextReader reader(xmlReaderForStream(input, 0, 0, XML_PARSE_NOBLANKS|XML_PARSE_NOENT|XML_PARSE_NONET|XML_PARSE_RECOVER), xmlFreeTextReader); +const boost::shared_ptrxmlTextReader reader( + xmlReaderForStream(input, 0, 0, XML_PARSE_NOBLANKS|XML_PARSE_NOENT|XML_PARSE_NONET|XML_PARSE_RECOVER), + xmlFreeTextReader); if (reader) { bool inRelationships = false; diff --git a/src/lib/VSDXMetaData.cpp b/src/lib/VSDXMetaData.cpp index 94b1f99..ffcad6e 100644 --- a/src/lib/VSDXMetaData.cpp +++ b/src/lib/VSDXMetaData.cpp @@ -11,6 +11,7 @@ #include VSDXMLTokenMap.h #include libvisio_utils.h #include string +#include boost/shared_ptr.hpp libvisio::VSDXMetaData::VSDXMetaData() : m_metaData() @@ -115,35 +116,35 @@ bool libvisio::VSDXMetaData::parse(librevenge::RVNGInputStream *input) if (!input) return false; - xmlTextReaderPtr reader = xmlReaderForStream(input, 0, 0, XML_PARSE_NOBLANKS|XML_PARSE_NOENT|XML_PARSE_NONET); + const boost::shared_ptrxmlTextReader reader( +xmlReaderForStream(input, 0, 0, XML_PARSE_NOBLANKS|XML_PARSE_NOENT|XML_PARSE_NONET), +xmlFreeTextReader); if (!reader) return false; try { -int ret = xmlTextReaderRead(reader); +int ret = xmlTextReaderRead(reader.get()); while (1 == ret) { - int tokenId = getElementToken(reader); + int tokenId = getElementToken(reader.get()); switch (tokenId) { case XML_CP_COREPROPERTIES: case XML_PROPERTIES: -readCoreProperties(reader); +readCoreProperties(reader.get()); break; default: break; } - ret = xmlTextReaderRead(reader); + ret = xmlTextReaderRead(reader.get()); } } catch (...) { -xmlFreeTextReader(reader); return false; } - xmlFreeTextReader(reader); return true; } diff --git a/src/lib/VSDXTheme.cpp b/src/lib/VSDXTheme.cpp index f962105..142623f 100644 --- a/src/lib/VSDXTheme.cpp +++ b/src/lib/VSDXTheme.cpp @@ -65,34 +65,34 @@ bool libvisio::VSDXTheme::parse(librevenge::RVNGInputStream *input) if (!input) return false; - xmlTextReaderPtr reader = xmlReaderForStream(input, 0, 0, XML_PARSE_NOBLANKS|XML_PARSE_NOENT|XML_PARSE_NONET); + const shared_ptrxmlTextReader reader( +xmlReaderForStream(input, 0, 0, XML_PARSE_NOBLANKS|XML_PARSE_NOENT|XML_PARSE_NONET), +xmlFreeTextReader); if (!reader) return false; try { -int ret = xmlTextReaderRead(reader); +int ret = xmlTextReaderRead(reader.get()); while (1 ==