[Libreoffice-commits] libmspub.git: 11 commits - configure.ac inc/libmspub m4/ax_gcc_func_attribute.m4 m4/dlp_fallthrough.m4 src/lib

David Tardon dtardon at redhat.com
Wed Dec 27 18:10:07 UTC 2017


 configure.ac                       |    3 
 inc/libmspub/MSPUBDocument.h       |    6 
 inc/libmspub/libmspub.h            |    4 
 m4/ax_gcc_func_attribute.m4        |  226 +++++++++++++++++++++++++++++++++++++
 m4/dlp_fallthrough.m4              |   65 ++++++++++
 src/lib/Arrow.h                    |    6 
 src/lib/BorderArtInfo.h            |    6 
 src/lib/ColorReference.h           |    6 
 src/lib/Coordinate.h               |    6 
 src/lib/Dash.cpp                   |    1 
 src/lib/Dash.h                     |    9 -
 src/lib/EmbeddedFontInfo.h         |    6 
 src/lib/EscherContainerType.h      |    6 
 src/lib/EscherFieldIds.h           |    6 
 src/lib/Fill.cpp                   |    3 
 src/lib/Fill.h                     |    7 -
 src/lib/FillType.h                 |    6 
 src/lib/Line.h                     |    8 -
 src/lib/ListInfo.h                 |    8 -
 src/lib/MSPUBBlockID.h             |    6 
 src/lib/MSPUBBlockType.h           |    6 
 src/lib/MSPUBCollector.cpp         |   19 +--
 src/lib/MSPUBCollector.h           |   33 ++---
 src/lib/MSPUBConstants.h           |    6 
 src/lib/MSPUBContentChunkType.h    |    6 
 src/lib/MSPUBDocument.cpp          |    2 
 src/lib/MSPUBMetaData.cpp          |    3 
 src/lib/MSPUBMetaData.h            |   15 +-
 src/lib/MSPUBParser.cpp            |   30 ++--
 src/lib/MSPUBParser.h              |   13 --
 src/lib/MSPUBParser2k.cpp          |    5 
 src/lib/MSPUBParser2k.h            |    6 
 src/lib/MSPUBParser97.cpp          |    2 
 src/lib/MSPUBParser97.h            |    6 
 src/lib/MSPUBTypes.h               |   16 +-
 src/lib/Margins.h                  |    4 
 src/lib/NumberingDelimiter.h       |    6 
 src/lib/NumberingType.h            |    6 
 src/lib/PolygonUtils.cpp           |   12 -
 src/lib/PolygonUtils.h             |   10 -
 src/lib/Shadow.h                   |    6 
 src/lib/ShapeFlags.h               |    6 
 src/lib/ShapeGroupElement.cpp      |   25 +---
 src/lib/ShapeGroupElement.h        |   25 ++--
 src/lib/ShapeInfo.h                |   23 ++-
 src/lib/ShapeType.h                |    6 
 src/lib/Shapes.h                   |    8 -
 src/lib/TableInfo.h                |    6 
 src/lib/VectorTransformation2D.cpp |    1 
 src/lib/VectorTransformation2D.h   |    6 
 src/lib/VerticalAlign.h            |    6 
 src/lib/libmspub_utils.cpp         |   27 ++--
 src/lib/libmspub_utils.h           |   70 ++++-------
 53 files changed, 556 insertions(+), 259 deletions(-)

New commits:
commit bbad69894708f6718ee454443e1189d276cdd73d
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Dec 27 16:44:54 2017 +0100

    one def. of M_PI is enough
    
    Change-Id: I8d6a4bfcca970dc0bd906f5e349ffaca25b96f96

diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index 8493cec..1ccd15e 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -364,10 +364,6 @@ void MSPUBCollector::setNextPage(unsigned pageSeqNum)
   m_pageSeqNumsOrdered.push_back(pageSeqNum);
 }
 
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
 MSPUBCollector::MSPUBCollector(librevenge::RVNGDrawingInterface *painter) :
   m_painter(painter), m_contentChunkReferences(), m_width(0), m_height(0),
   m_widthSet(false), m_heightSet(false),
diff --git a/src/lib/PolygonUtils.cpp b/src/lib/PolygonUtils.cpp
index 7452c36..bb7ffce 100644
--- a/src/lib/PolygonUtils.cpp
+++ b/src/lib/PolygonUtils.cpp
@@ -19,10 +19,6 @@
 
 #define CALCULATED_VALUE(val) (int(unsigned(val) | 0x80000000))
 
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
 namespace libmspub
 {
 
diff --git a/src/lib/libmspub_utils.cpp b/src/lib/libmspub_utils.cpp
index 066ee2f..ba34cc5 100644
--- a/src/lib/libmspub_utils.cpp
+++ b/src/lib/libmspub_utils.cpp
@@ -11,7 +11,6 @@
 
 #include <cstdarg>
 #include <cstring>
-#include <math.h>
 #include <string.h> // for memcpy
 
 #include <unicode/ucnv.h>
@@ -19,10 +18,6 @@
 
 #include <zlib.h>
 
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
 #define ZLIB_CHUNK 16384
 
 namespace libmspub
diff --git a/src/lib/libmspub_utils.h b/src/lib/libmspub_utils.h
index deae5a6..dba757e 100644
--- a/src/lib/libmspub_utils.h
+++ b/src/lib/libmspub_utils.h
@@ -14,6 +14,7 @@
 #include "config.h"
 #endif
 
+#include <cmath>
 #include <map>
 #include <vector>
 
@@ -25,6 +26,10 @@
 
 #include "MSPUBTypes.h"
 
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
 #if defined(HAVE_FUNC_ATTRIBUTE_FORMAT)
 #  define MSPUB_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((__format__(__printf__, fmt, arg)))
 #else
commit 7b3b5a1c3c2b2dd95092fdac51e1a4a5cab8fbc9
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Dec 27 16:40:21 2017 +0100

    sort includes
    
    Change-Id: I3059e2d765e49744322f3774aa31821189745e37

diff --git a/src/lib/BorderArtInfo.h b/src/lib/BorderArtInfo.h
index f09a163..e015401 100644
--- a/src/lib/BorderArtInfo.h
+++ b/src/lib/BorderArtInfo.h
@@ -11,7 +11,9 @@
 #define INCLUDED_BORDERARTINFO_H
 
 #include <vector>
+
 #include <librevenge/librevenge.h>
+
 #include "MSPUBTypes.h"
 
 namespace libmspub
diff --git a/src/lib/Coordinate.h b/src/lib/Coordinate.h
index ac790ec..bec3fe2 100644
--- a/src/lib/Coordinate.h
+++ b/src/lib/Coordinate.h
@@ -9,7 +9,9 @@
 
 #ifndef INCLUDED_COORDINATE_H
 #define INCLUDED_COORDINATE_H
+
 #include "MSPUBConstants.h"
+
 namespace libmspub
 {
 struct Coordinate
diff --git a/src/lib/Dash.h b/src/lib/Dash.h
index d48e68a..6079c59 100644
--- a/src/lib/Dash.h
+++ b/src/lib/Dash.h
@@ -10,9 +10,10 @@
 #ifndef INCLUDED_DASH_H
 #define INCLUDED_DASH_H
 
-#include <boost/optional.hpp>
 #include <vector>
 
+#include <boost/optional.hpp>
+
 namespace libmspub
 {
 enum DotStyle
diff --git a/src/lib/Fill.cpp b/src/lib/Fill.cpp
index 9cf379f..eca9633 100644
--- a/src/lib/Fill.cpp
+++ b/src/lib/Fill.cpp
@@ -8,9 +8,10 @@
  */
 
 #include "Fill.h"
+
 #include "FillType.h"
-#include "libmspub_utils.h"
 #include "MSPUBCollector.h"
+#include "libmspub_utils.h"
 
 namespace libmspub
 {
diff --git a/src/lib/Fill.h b/src/lib/Fill.h
index c9c8b78..d8250bf 100644
--- a/src/lib/Fill.h
+++ b/src/lib/Fill.h
@@ -11,7 +11,6 @@
 #define INCLUDED_FILL_H
 
 #include <cstddef>
-
 #include <vector>
 
 #include <librevenge/librevenge.h>
diff --git a/src/lib/Line.h b/src/lib/Line.h
index d528d38..030ffe7 100644
--- a/src/lib/Line.h
+++ b/src/lib/Line.h
@@ -9,9 +9,11 @@
 
 #ifndef INCLUDED_LINE_H
 #define INCLUDED_LINE_H
-#include "Dash.h"
+
 #include <boost/optional.hpp>
+
 #include "ColorReference.h"
+#include "Dash.h"
 
 namespace libmspub
 {
diff --git a/src/lib/ListInfo.h b/src/lib/ListInfo.h
index b6f839f..02d1732 100644
--- a/src/lib/ListInfo.h
+++ b/src/lib/ListInfo.h
@@ -12,8 +12,8 @@
 
 #include <boost/optional.hpp>
 
-#include "NumberingType.h"
 #include "NumberingDelimiter.h"
+#include "NumberingType.h"
 
 namespace libmspub
 {
diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index c66fc0e..8493cec 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -7,18 +7,19 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include "MSPUBCollector.h"
+
 #include <math.h>
 
 #include <boost/multi_array.hpp>
 
 #include <unicode/ucsdet.h>
 
-#include "MSPUBCollector.h"
-#include "libmspub_utils.h"
+#include "Coordinate.h"
 #include "MSPUBConstants.h"
 #include "MSPUBTypes.h"
 #include "PolygonUtils.h"
-#include "Coordinate.h"
+#include "libmspub_utils.h"
 
 namespace libmspub
 {
diff --git a/src/lib/MSPUBCollector.h b/src/lib/MSPUBCollector.h
index 61bfbdb..62a40fb 100644
--- a/src/lib/MSPUBCollector.h
+++ b/src/lib/MSPUBCollector.h
@@ -10,34 +10,33 @@
 #ifndef INCLUDED_MSPUBCOLLECTOR_H
 #define INCLUDED_MSPUBCOLLECTOR_H
 
+#include <algorithm>
 #include <functional>
 #include <list>
-#include <vector>
 #include <map>
 #include <memory>
 #include <set>
 #include <string>
-#include <algorithm>
+#include <vector>
 
 #include <librevenge/librevenge.h>
-#include <librevenge/librevenge.h>
 
-#include "MSPUBTypes.h"
-#include "libmspub_utils.h"
-#include "MSPUBContentChunkType.h"
-#include "ShapeType.h"
+#include "Arrow.h"
+#include "BorderArtInfo.h"
+#include "ColorReference.h"
 #include "Coordinate.h"
-#include "ShapeGroupElement.h"
+#include "Dash.h"
+#include "EmbeddedFontInfo.h"
 #include "Fill.h"
-#include "ColorReference.h"
+#include "MSPUBContentChunkType.h"
+#include "MSPUBTypes.h"
 #include "PolygonUtils.h"
+#include "Shadow.h"
+#include "ShapeGroupElement.h"
 #include "ShapeInfo.h"
-#include "BorderArtInfo.h"
-#include "Dash.h"
-#include "Arrow.h"
+#include "ShapeType.h"
 #include "VerticalAlign.h"
-#include "EmbeddedFontInfo.h"
-#include "Shadow.h"
+#include "libmspub_utils.h"
 
 namespace libmspub
 {
diff --git a/src/lib/MSPUBDocument.cpp b/src/lib/MSPUBDocument.cpp
index c67639b..0f178fe 100644
--- a/src/lib/MSPUBDocument.cpp
+++ b/src/lib/MSPUBDocument.cpp
@@ -9,8 +9,8 @@
 
 #include <memory>
 #include <sstream>
-#include <string>
 #include <string.h>
+#include <string>
 
 #include <libmspub/libmspub.h>
 
diff --git a/src/lib/MSPUBMetaData.cpp b/src/lib/MSPUBMetaData.cpp
index 779233a..ad12b7e 100644
--- a/src/lib/MSPUBMetaData.cpp
+++ b/src/lib/MSPUBMetaData.cpp
@@ -7,13 +7,14 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include "MSPUBMetaData.h"
+
 #include <cmath>
 #include <cstdio>
 #include <cstring>
 #include <ctime>
 
 #include "libmspub_utils.h"
-#include "MSPUBMetaData.h"
 
 libmspub::MSPUBMetaData::MSPUBMetaData()
   : m_idsAndOffsets(), m_typedPropertyValues(), m_metaData()
diff --git a/src/lib/MSPUBMetaData.h b/src/lib/MSPUBMetaData.h
index f8136a1..cb70e1c 100644
--- a/src/lib/MSPUBMetaData.h
+++ b/src/lib/MSPUBMetaData.h
@@ -10,11 +10,14 @@
 #ifndef INCLUDED_MSPUBMETADATA_H
 #define INCLUDED_MSPUBMETADATA_H
 
-#include <vector>
-#include <utility>
 #include <map>
-#include <librevenge-stream/librevenge-stream.h>
+#include <utility>
+#include <vector>
+
 #include <librevenge/librevenge.h>
+
+#include <librevenge-stream/librevenge-stream.h>
+
 #include "libmspub_utils.h"
 
 namespace libmspub
diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp
index 1e94115..1a66f4e 100644
--- a/src/lib/MSPUBParser.cpp
+++ b/src/lib/MSPUBParser.cpp
@@ -7,38 +7,40 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include "MSPUBParser.h"
+
+#include <algorithm>
 #include <cassert>
 #include <memory>
 #include <set>
 #include <sstream>
+#include <string.h>
 #include <string>
 #include <utility>
-#include <algorithm>
-#include <string.h>
 
 #include <boost/numeric/conversion/cast.hpp>
 
 #include <librevenge-stream/librevenge-stream.h>
+
 #include <zlib.h>
 
-#include "MSPUBMetaData.h"
-#include "MSPUBParser.h"
-#include "MSPUBCollector.h"
-#include "MSPUBBlockID.h"
-#include "MSPUBBlockType.h"
-#include "MSPUBContentChunkType.h"
-#include "MSPUBConstants.h"
+#include "Dash.h"
 #include "EscherContainerType.h"
 #include "EscherFieldIds.h"
-#include "libmspub_utils.h"
-#include "ShapeType.h"
-#include "ShapeFlags.h"
 #include "Fill.h"
 #include "FillType.h"
 #include "ListInfo.h"
-#include "Dash.h"
+#include "MSPUBBlockID.h"
+#include "MSPUBBlockType.h"
+#include "MSPUBCollector.h"
+#include "MSPUBConstants.h"
+#include "MSPUBContentChunkType.h"
+#include "MSPUBMetaData.h"
+#include "ShapeFlags.h"
+#include "ShapeType.h"
 #include "TableInfo.h"
 #include "VerticalAlign.h"
+#include "libmspub_utils.h"
 
 namespace libmspub
 {
diff --git a/src/lib/MSPUBParser.h b/src/lib/MSPUBParser.h
index 9426536..0dfe017 100644
--- a/src/lib/MSPUBParser.h
+++ b/src/lib/MSPUBParser.h
@@ -12,18 +12,17 @@
 
 #include <map>
 #include <memory>
+#include <memory>
 #include <set>
 #include <vector>
-#include <memory>
 
 #include <boost/optional.hpp>
 
 #include <librevenge/librevenge.h>
-#include <librevenge/librevenge.h>
 
-#include "MSPUBTypes.h"
-#include "Fill.h"
 #include "Coordinate.h"
+#include "Fill.h"
+#include "MSPUBTypes.h"
 #include "PolygonUtils.h"
 
 namespace libmspub
diff --git a/src/lib/MSPUBParser2k.cpp b/src/lib/MSPUBParser2k.cpp
index 95f8c8b..9b3a7c4 100644
--- a/src/lib/MSPUBParser2k.cpp
+++ b/src/lib/MSPUBParser2k.cpp
@@ -7,16 +7,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include "MSPUBParser2k.h"
+
 #include <algorithm>
 #include <memory>
 
 #include <librevenge-stream/librevenge-stream.h>
 
-#include "MSPUBParser2k.h"
 #include "ColorReference.h"
+#include "MSPUBCollector.h"
 #include "ShapeType.h"
 #include "libmspub_utils.h"
-#include "MSPUBCollector.h"
 
 namespace libmspub
 {
diff --git a/src/lib/MSPUBParser97.cpp b/src/lib/MSPUBParser97.cpp
index 50ef91f..17ea81a 100644
--- a/src/lib/MSPUBParser97.cpp
+++ b/src/lib/MSPUBParser97.cpp
@@ -14,8 +14,8 @@
 #include <utility>
 
 #include "MSPUBCollector.h"
-#include "libmspub_utils.h"
 #include "MSPUBTypes.h"
+#include "libmspub_utils.h"
 
 namespace libmspub
 {
diff --git a/src/lib/MSPUBTypes.h b/src/lib/MSPUBTypes.h
index 7fae7e9..2cf98d1 100644
--- a/src/lib/MSPUBTypes.h
+++ b/src/lib/MSPUBTypes.h
@@ -10,14 +10,16 @@
 #ifndef INCLUDED_MSPUBTYPES_H
 #define INCLUDED_MSPUBTYPES_H
 
-#include <vector>
 #include <string>
+#include <vector>
+
 #include <boost/optional.hpp>
-#include "MSPUBBlockType.h"
+
+#include "ListInfo.h"
 #include "MSPUBBlockID.h"
-#include "MSPUBContentChunkType.h"
+#include "MSPUBBlockType.h"
 #include "MSPUBConstants.h"
-#include "ListInfo.h"
+#include "MSPUBContentChunkType.h"
 
 namespace libmspub
 {
diff --git a/src/lib/PolygonUtils.cpp b/src/lib/PolygonUtils.cpp
index 109b3e4..7452c36 100644
--- a/src/lib/PolygonUtils.cpp
+++ b/src/lib/PolygonUtils.cpp
@@ -7,15 +7,15 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include <stddef.h> // for NULL
+#include "PolygonUtils.h"
+
 #include <math.h>
 
 #include <librevenge/librevenge.h>
 
+#include "MSPUBCollector.h"
 #include "ShapeType.h"
-#include "PolygonUtils.h"
 #include "libmspub_utils.h"
-#include "MSPUBCollector.h"
 
 #define CALCULATED_VALUE(val) (int(unsigned(val) | 0x80000000))
 
diff --git a/src/lib/PolygonUtils.h b/src/lib/PolygonUtils.h
index 37d9b7b..be3eadc 100644
--- a/src/lib/PolygonUtils.h
+++ b/src/lib/PolygonUtils.h
@@ -16,10 +16,10 @@
 
 #include <librevenge/librevenge.h>
 
-#include "ShapeType.h"
-#include "VectorTransformation2D.h"
 #include "Coordinate.h"
 #include "Line.h"
+#include "ShapeType.h"
+#include "VectorTransformation2D.h"
 
 namespace libmspub
 {
diff --git a/src/lib/ShapeGroupElement.h b/src/lib/ShapeGroupElement.h
index c95b6cc..34f5dd7 100644
--- a/src/lib/ShapeGroupElement.h
+++ b/src/lib/ShapeGroupElement.h
@@ -9,11 +9,13 @@
 
 #ifndef INCLUDED_SHAPEGROUPELEMENT_H
 #define INCLUDED_SHAPEGROUPELEMENT_H
-#include <boost/optional.hpp>
+
 #include <functional>
 #include <memory>
 #include <vector>
 
+#include <boost/optional.hpp>
+
 #include "ShapeInfo.h"
 #include "VectorTransformation2D.h"
 
diff --git a/src/lib/ShapeInfo.h b/src/lib/ShapeInfo.h
index ec8050f..ff50787 100644
--- a/src/lib/ShapeInfo.h
+++ b/src/lib/ShapeInfo.h
@@ -9,24 +9,27 @@
 
 #ifndef INCLUDED_SHAPEINFO_H
 #define INCLUDED_SHAPEINFO_H
-#include <boost/optional.hpp>
+
 #include <functional>
 #include <map>
 #include <memory>
 #include <vector>
-#include "ShapeType.h"
+
+#include <boost/optional.hpp>
+
+#include "Arrow.h"
+#include "ColorReference.h"
 #include "Coordinate.h"
+#include "Dash.h"
+#include "Fill.h"
 #include "Line.h"
-#include "Margins.h"
 #include "MSPUBTypes.h"
-#include "Fill.h"
+#include "Margins.h"
 #include "PolygonUtils.h"
-#include "Dash.h"
+#include "Shadow.h"
+#include "ShapeType.h"
 #include "TableInfo.h"
-#include "Arrow.h"
 #include "VerticalAlign.h"
-#include "ColorReference.h"
-#include "Shadow.h"
 
 namespace libmspub
 {
diff --git a/src/lib/Shapes.h b/src/lib/Shapes.h
index 1fed488..3a258ec 100644
--- a/src/lib/Shapes.h
+++ b/src/lib/Shapes.h
@@ -10,8 +10,8 @@
 #ifndef INCLUDED_SHAPES_H
 #define INCLUDED_SHAPES_H
 
-#include <vector>
 #include <map>
+#include <vector>
 
 #include "Coordinate.h"
 #include "MSPUBConstants.h"
diff --git a/src/lib/VectorTransformation2D.cpp b/src/lib/VectorTransformation2D.cpp
index 1b80e3a..c66c60e 100644
--- a/src/lib/VectorTransformation2D.cpp
+++ b/src/lib/VectorTransformation2D.cpp
@@ -10,6 +10,7 @@
 //TODO : Adjust handles, glue points
 
 #include "VectorTransformation2D.h"
+
 #include <math.h>
 
 namespace libmspub
diff --git a/src/lib/libmspub_utils.cpp b/src/lib/libmspub_utils.cpp
index 9706060..066ee2f 100644
--- a/src/lib/libmspub_utils.cpp
+++ b/src/lib/libmspub_utils.cpp
@@ -7,16 +7,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include <unicode/ucnv.h>
-#include <unicode/utypes.h>
+#include "libmspub_utils.h"
 
 #include <cstdarg>
-#include <string.h> // for memcpy
-#include <math.h>
-#include <zlib.h>
 #include <cstring>
+#include <math.h>
+#include <string.h> // for memcpy
 
-#include "libmspub_utils.h"
+#include <unicode/ucnv.h>
+#include <unicode/utypes.h>
+
+#include <zlib.h>
 
 #ifndef M_PI
 #define M_PI 3.14159265358979323846
diff --git a/src/lib/libmspub_utils.h b/src/lib/libmspub_utils.h
index dc58265..deae5a6 100644
--- a/src/lib/libmspub_utils.h
+++ b/src/lib/libmspub_utils.h
@@ -14,12 +14,13 @@
 #include "config.h"
 #endif
 
-#include <vector>
 #include <map>
+#include <vector>
 
 #include <boost/cstdint.hpp>
 
 #include <librevenge/librevenge.h>
+
 #include <librevenge-stream/librevenge-stream.h>
 
 #include "MSPUBTypes.h"
commit 3ddacc3bcf83ac73d3288d1caa3f6f25579e1df1
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Dec 27 16:27:24 2017 +0100

    suppress another GCC 7 fallthrough warning
    
    Change-Id: Id8da48108116113bba3714b7c2864e200e0ec21a

diff --git a/src/lib/Dash.cpp b/src/lib/Dash.cpp
index 0f40b81..bae6ee1 100644
--- a/src/lib/Dash.cpp
+++ b/src/lib/Dash.cpp
@@ -49,6 +49,7 @@ Dash getDash(MSPUBDashStyle style, unsigned shapeLineWidthEmu,
   {
   default:
     MSPUB_DEBUG_MSG(("Couldn't match dash style, using solid line.\n"));
+    MSPUB_FALLTHROUGH;
   case MSPUB_DS_SOLID:
     return Dash(0, RECT_DOT);
   case DASH_SYS:
diff --git a/src/lib/libmspub_utils.h b/src/lib/libmspub_utils.h
index fc70e28..dc58265 100644
--- a/src/lib/libmspub_utils.h
+++ b/src/lib/libmspub_utils.h
@@ -14,7 +14,6 @@
 #include "config.h"
 #endif
 
-#include <stdio.h>
 #include <vector>
 #include <map>
 
commit 3e543ad2ecdd91f8259330b2a47a5f3d242dabe0
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Dec 27 16:25:54 2017 +0100

    print debug messages to stderr
    
    Change-Id: I61870aba499887eb69de3f932a60537ba15c53bf

diff --git a/configure.ac b/configure.ac
index a7a5efb..6c5a2be 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,6 +34,7 @@ LT_INIT([win32-dll disable-static pic-only])
 AC_CANONICAL_HOST
 
 AX_CXX_COMPILE_STDCXX_11
+AX_GCC_FUNC_ATTRIBUTE([format])
 DLP_FALLTHROUGH
 
 PKG_PROG_PKG_CONFIG([0.20])
diff --git a/m4/ax_gcc_func_attribute.m4 b/m4/ax_gcc_func_attribute.m4
new file mode 100644
index 0000000..008bee9
--- /dev/null
+++ b/m4/ax_gcc_func_attribute.m4
@@ -0,0 +1,226 @@
+# ===========================================================================
+#  https://www.gnu.org/software/autoconf-archive/ax_gcc_func_attribute.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_GCC_FUNC_ATTRIBUTE(ATTRIBUTE)
+#
+# DESCRIPTION
+#
+#   This macro checks if the compiler supports one of GCC's function
+#   attributes; many other compilers also provide function attributes with
+#   the same syntax. Compiler warnings are used to detect supported
+#   attributes as unsupported ones are ignored by default so quieting
+#   warnings when using this macro will yield false positives.
+#
+#   The ATTRIBUTE parameter holds the name of the attribute to be checked.
+#
+#   If ATTRIBUTE is supported define HAVE_FUNC_ATTRIBUTE_<ATTRIBUTE>.
+#
+#   The macro caches its result in the ax_cv_have_func_attribute_<attribute>
+#   variable.
+#
+#   The macro currently supports the following function attributes:
+#
+#    alias
+#    aligned
+#    alloc_size
+#    always_inline
+#    artificial
+#    cold
+#    const
+#    constructor
+#    constructor_priority for constructor attribute with priority
+#    deprecated
+#    destructor
+#    dllexport
+#    dllimport
+#    error
+#    externally_visible
+#    flatten
+#    format
+#    format_arg
+#    gnu_inline
+#    hot
+#    ifunc
+#    leaf
+#    malloc
+#    noclone
+#    noinline
+#    nonnull
+#    noreturn
+#    nothrow
+#    optimize
+#    pure
+#    unused
+#    used
+#    visibility
+#    warning
+#    warn_unused_result
+#    weak
+#    weakref
+#
+#   Unsuppored function attributes will be tested with a prototype returning
+#   an int and not accepting any arguments and the result of the check might
+#   be wrong or meaningless so use with care.
+#
+# LICENSE
+#
+#   Copyright (c) 2013 Gabriele Svelto <gabriele.svelto at gmail.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.  This file is offered as-is, without any
+#   warranty.
+
+#serial 5
+
+AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [
+    AS_VAR_PUSHDEF([ac_var], [ax_cv_have_func_attribute_$1])
+
+    AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [
+        AC_LINK_IFELSE([AC_LANG_PROGRAM([
+            m4_case([$1],
+                [alias], [
+                    int foo( void ) { return 0; }
+                    int bar( void ) __attribute__(($1("foo")));
+                ],
+                [aligned], [
+                    int foo( void ) __attribute__(($1(32)));
+                ],
+                [alloc_size], [
+                    void *foo(int a) __attribute__(($1(1)));
+                ],
+                [always_inline], [
+                    inline __attribute__(($1)) int foo( void ) { return 0; }
+                ],
+                [artificial], [
+                    inline __attribute__(($1)) int foo( void ) { return 0; }
+                ],
+                [cold], [
+                    int foo( void ) __attribute__(($1));
+                ],
+                [const], [
+                    int foo( void ) __attribute__(($1));
+                ],
+                [constructor_priority], [
+                    int foo( void ) __attribute__((__constructor__(65535/2)));
+                ],
+                [constructor], [
+                    int foo( void ) __attribute__(($1));
+                ],
+                [deprecated], [
+                    int foo( void ) __attribute__(($1("")));
+                ],
+                [destructor], [
+                    int foo( void ) __attribute__(($1));
+                ],
+                [dllexport], [
+                    __attribute__(($1)) int foo( void ) { return 0; }
+                ],
+                [dllimport], [
+                    int foo( void ) __attribute__(($1));
+                ],
+                [error], [
+                    int foo( void ) __attribute__(($1("")));
+                ],
+                [externally_visible], [
+                    int foo( void ) __attribute__(($1));
+                ],
+                [flatten], [
+                    int foo( void ) __attribute__(($1));
+                ],
+                [format], [
+                    int foo(const char *p, ...) __attribute__(($1(printf, 1, 2)));
+                ],
+                [format_arg], [
+                    char *foo(const char *p) __attribute__(($1(1)));
+                ],
+                [gnu_inline], [
+                    inline __attribute__(($1)) int foo( void ) { return 0; }
+                ],
+                [hot], [
+                    int foo( void ) __attribute__(($1));
+                ],
+                [ifunc], [
+                    int my_foo( void ) { return 0; }
+                    static int (*resolve_foo(void))(void) { return my_foo; }
+                    int foo( void ) __attribute__(($1("resolve_foo")));
+                ],
+                [leaf], [
+                    __attribute__(($1)) int foo( void ) { return 0; }
+                ],
+                [malloc], [
+                    void *foo( void ) __attribute__(($1));
+                ],
+                [noclone], [
+                    int foo( void ) __attribute__(($1));
+                ],
+                [noinline], [
+                    __attribute__(($1)) int foo( void ) { return 0; }
+                ],
+                [nonnull], [
+                    int foo(char *p) __attribute__(($1(1)));
+                ],
+                [noreturn], [
+                    void foo( void ) __attribute__(($1));
+                ],
+                [nothrow], [
+                    int foo( void ) __attribute__(($1));
+                ],
+                [optimize], [
+                    __attribute__(($1(3))) int foo( void ) { return 0; }
+                ],
+                [pure], [
+                    int foo( void ) __attribute__(($1));
+                ],
+                [returns_nonnull], [
+                    void *foo( void ) __attribute__(($1));
+                ],
+                [unused], [
+                    int foo( void ) __attribute__(($1));
+                ],
+                [used], [
+                    int foo( void ) __attribute__(($1));
+                ],
+                [visibility], [
+                    int foo_def( void ) __attribute__(($1("default")));
+                    int foo_hid( void ) __attribute__(($1("hidden")));
+                    int foo_int( void ) __attribute__(($1("internal")));
+                    int foo_pro( void ) __attribute__(($1("protected")));
+                ],
+                [warning], [
+                    int foo( void ) __attribute__(($1("")));
+                ],
+                [warn_unused_result], [
+                    int foo( void ) __attribute__(($1));
+                ],
+                [weak], [
+                    int foo( void ) __attribute__(($1));
+                ],
+                [weakref], [
+                    static int foo( void ) { return 0; }
+                    static int bar( void ) __attribute__(($1("foo")));
+                ],
+                [
+                 m4_warn([syntax], [Unsupported attribute $1, the test may fail])
+                 int foo( void ) __attribute__(($1));
+                ]
+            )], [])
+            ],
+            dnl GCC doesn't exit with an error if an unknown attribute is
+            dnl provided but only outputs a warning, so accept the attribute
+            dnl only if no warning were issued.
+            [AS_IF([test -s conftest.err],
+                [AS_VAR_SET([ac_var], [no])],
+                [AS_VAR_SET([ac_var], [yes])])],
+            [AS_VAR_SET([ac_var], [no])])
+    ])
+
+    AS_IF([test yes = AS_VAR_GET([ac_var])],
+        [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FUNC_ATTRIBUTE_$1), 1,
+            [Define to 1 if the system has the `$1' function attribute])], [])
+
+    AS_VAR_POPDEF([ac_var])
+])
diff --git a/src/lib/libmspub_utils.cpp b/src/lib/libmspub_utils.cpp
index dc97423..9706060 100644
--- a/src/lib/libmspub_utils.cpp
+++ b/src/lib/libmspub_utils.cpp
@@ -10,6 +10,7 @@
 #include <unicode/ucnv.h>
 #include <unicode/utypes.h>
 
+#include <cstdarg>
 #include <string.h> // for memcpy
 #include <math.h>
 #include <zlib.h>
@@ -26,6 +27,18 @@
 namespace libmspub
 {
 
+#ifdef DEBUG
+
+void debugPrint(const char *const format, ...)
+{
+  va_list args;
+  va_start(args, format);
+  std::vfprintf(stderr, format, args);
+  va_end(args);
+}
+
+#endif
+
 using std::strcmp;
 const char *windowsCharsetNameByOriginalCharset(const char *name)
 {
diff --git a/src/lib/libmspub_utils.h b/src/lib/libmspub_utils.h
index 7d6b836..fc70e28 100644
--- a/src/lib/libmspub_utils.h
+++ b/src/lib/libmspub_utils.h
@@ -25,6 +25,12 @@
 
 #include "MSPUBTypes.h"
 
+#if defined(HAVE_FUNC_ATTRIBUTE_FORMAT)
+#  define MSPUB_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((__format__(__printf__, fmt, arg)))
+#else
+#  define MSPUB_ATTRIBUTE_PRINTF(fmt, arg)
+#endif
+
 #if defined(HAVE_CLANG_ATTRIBUTE_FALLTHROUGH)
 #  define MSPUB_FALLTHROUGH [[clang::fallthrough]]
 #elif defined(HAVE_GCC_ATTRIBUTE_FALLTHROUGH)
@@ -35,7 +41,11 @@
 
 // do nothing with debug messages in a release compile
 #ifdef DEBUG
-#define MSPUB_DEBUG_MSG(M) printf M
+namespace libmspub
+{
+void debugPrint(const char *format, ...) MSPUB_ATTRIBUTE_PRINTF(1, 2);
+}
+#define MSPUB_DEBUG_MSG(M) libmspub::debugPrint M
 #define MSPUB_DEBUG(M) M
 #else
 #define MSPUB_DEBUG_MSG(M)
commit a5f8b6a26736874de1f8c88c0bba76d862e05b0c
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Dec 27 16:17:38 2017 +0100

    suppress GCC 7 fallthrough warnings
    
    Change-Id: I2bf8d7c5d1b795fec06a5eb397c7be5bd6c8e580

diff --git a/configure.ac b/configure.ac
index 453ea73..a7a5efb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,6 +34,7 @@ LT_INIT([win32-dll disable-static pic-only])
 AC_CANONICAL_HOST
 
 AX_CXX_COMPILE_STDCXX_11
+DLP_FALLTHROUGH
 
 PKG_PROG_PKG_CONFIG([0.20])
 
diff --git a/m4/dlp_fallthrough.m4 b/m4/dlp_fallthrough.m4
new file mode 100644
index 0000000..99e6be5
--- /dev/null
+++ b/m4/dlp_fallthrough.m4
@@ -0,0 +1,65 @@
+#
+# SYNOPSIS
+#
+#   DLP_FALLTHROUGH
+#
+# DESCRIPTION
+#
+#   This macro checks if the compiler supports a fallthrough warning
+#   suppression attribute in GCC or CLANG style.
+#
+#   If a fallthrough warning suppression attribute is supported define
+#   HAVE_<STYLE>_ATTRIBUTE_FALLTHROUGH.
+#
+#   The macro caches its result in ax_cv_have_<style>_attribute_fallthrough
+#   variables.
+#
+# LICENSE
+#
+#   Copyright (c) 2017 David Tardon <dtardon at redhat.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.  This file is offered as-is, without any
+#   warranty.
+
+#serial 1
+
+m4_defun([_DLP_FALLTHROUGH], [
+    AS_VAR_PUSHDEF([ac_var], [ax_cv_have_$2_attribute_falltrough])
+
+    AC_CACHE_CHECK([for $1], [ac_var], [
+        AC_LINK_IFELSE([AC_LANG_PROGRAM([
+                void foo(int &i)
+                {
+                    switch (i)
+                    {
+                        case 0:
+                            i += 1;
+                            $1;
+                        default:
+                            i += 1;
+                    }
+                }
+            ], [])
+            ],
+            dnl GCC doesn't exit with an error if an unknown attribute is
+            dnl provided but only outputs a warning, so accept the attribute
+            dnl only if no warning were issued.
+            [AS_IF([test -s conftest.err],
+                [AS_VAR_SET([ac_var], [no])],
+                [AS_VAR_SET([ac_var], [yes])])],
+            [AS_VAR_SET([ac_var], [no])])
+    ])
+
+    AS_IF([test yes = AS_VAR_GET([ac_var])],
+        [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$3_ATTRIBUTE_FALLTHROUGH), 1,
+            [Define to 1 if the system has the $4-style `fallthrough' attribute])], [])
+
+    AS_VAR_POPDEF([ac_var])
+])
+
+AC_DEFUN([DLP_FALLTHROUGH], [
+    _DLP_FALLTHROUGH([[__attribute__((fallthrough))]], [gcc], [GCC], [GNU])
+    _DLP_FALLTHROUGH([[[[clang:fallthrough]]]], [clang], [CLANG], [clang])
+])
diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp
index 179f8ae..1e94115 100644
--- a/src/lib/MSPUBParser.cpp
+++ b/src/lib/MSPUBParser.cpp
@@ -2448,7 +2448,7 @@ MSPUBBlockInfo MSPUBParser::parseBlock(librevenge::RVNGInputStream *input, bool
     case 24:
       //FIXME: Not doing anything with this data for now.
       skipBlock(input, info);
-    // fall-through intended
+      MSPUB_FALLTHROUGH;
     default:
       info.data = 0;
     }
diff --git a/src/lib/PolygonUtils.cpp b/src/lib/PolygonUtils.cpp
index 7c0ff80..109b3e4 100644
--- a/src/lib/PolygonUtils.cpp
+++ b/src/lib/PolygonUtils.cpp
@@ -6335,7 +6335,7 @@ void writeCustomShape(ShapeType shapeType, librevenge::RVNGPropertyList &graphic
         }
         hasUnclosedElements = false;
       }
-      //intentionally no break
+      MSPUB_FALLTHROUGH;
       case ENDSUBPATH:
         MSPUB_DEBUG_MSG(("ENDSUBPATH\n"));
         if (closeEverything && bool(pathBegin))
diff --git a/src/lib/libmspub_utils.h b/src/lib/libmspub_utils.h
index b1df43b..7d6b836 100644
--- a/src/lib/libmspub_utils.h
+++ b/src/lib/libmspub_utils.h
@@ -25,6 +25,14 @@
 
 #include "MSPUBTypes.h"
 
+#if defined(HAVE_CLANG_ATTRIBUTE_FALLTHROUGH)
+#  define MSPUB_FALLTHROUGH [[clang::fallthrough]]
+#elif defined(HAVE_GCC_ATTRIBUTE_FALLTHROUGH)
+#  define MSPUB_FALLTHROUGH __attribute__((fallthrough))
+#else
+#  define MSPUB_FALLTHROUGH ((void) 0)
+#endif
+
 // do nothing with debug messages in a release compile
 #ifdef DEBUG
 #define MSPUB_DEBUG_MSG(M) printf M
commit 19b150475fcb45678cbc8ce1620efa53d9bf85d7
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Dec 27 16:07:14 2017 +0100

    drop verbose debug
    
    Change-Id: I4fdc7375e12427884467c4bdeb983ed5feaac1a3

diff --git a/src/lib/libmspub_utils.h b/src/lib/libmspub_utils.h
index 460e247..b1df43b 100644
--- a/src/lib/libmspub_utils.h
+++ b/src/lib/libmspub_utils.h
@@ -25,18 +25,10 @@
 
 #include "MSPUBTypes.h"
 
-// debug message includes source file and line number
-//#define VERBOSE_DEBUG 1
-
 // do nothing with debug messages in a release compile
 #ifdef DEBUG
-#ifdef VERBOSE_DEBUG
-#define MSPUB_DEBUG_MSG(M) printf("%15s:%5d: ", __FILE__, __LINE__); printf M
-#define MSPUB_DEBUG(M) M
-#else
 #define MSPUB_DEBUG_MSG(M) printf M
 #define MSPUB_DEBUG(M) M
-#endif
 #else
 #define MSPUB_DEBUG_MSG(M)
 #define MSPUB_DEBUG(M)
commit 79857494758cd3a56cb592002cfb61be98518b38
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Dec 27 16:06:23 2017 +0100

    replace manual def. of int types by boost
    
    Change-Id: I3d47ea0c9061f47ffc2a87444fb2d09e94e44aef

diff --git a/configure.ac b/configure.ac
index 2da6ffa..453ea73 100644
--- a/configure.ac
+++ b/configure.ac
@@ -90,6 +90,7 @@ AC_SUBST(ZLIB_LIBS)
 # Find required boost headers
 # ===========================
 AC_CHECK_HEADERS(
+	boost/cstdint.hpp \
 	boost/numeric/conversion/cast.hpp \
 	boost/optional.hpp \
 	,
diff --git a/src/lib/libmspub_utils.h b/src/lib/libmspub_utils.h
index c06d285..460e247 100644
--- a/src/lib/libmspub_utils.h
+++ b/src/lib/libmspub_utils.h
@@ -10,48 +10,21 @@
 #ifndef INCLUDED_LIBMSPUB_UTILS_H
 #define INCLUDED_LIBMSPUB_UTILS_H
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdio.h>
 #include <vector>
 #include <map>
+
+#include <boost/cstdint.hpp>
+
 #include <librevenge/librevenge.h>
 #include <librevenge-stream/librevenge-stream.h>
 
 #include "MSPUBTypes.h"
 
-#ifdef _MSC_VER
-
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned uint32_t;
-typedef signed char int8_t;
-typedef short int16_t;
-typedef int int32_t;
-typedef unsigned __int64 uint64_t;
-
-#else
-
-#ifdef HAVE_CONFIG_H
-
-#include <config.h>
-
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#endif
-
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#endif
-
-#else
-
-// assume that the headers are there inside LibreOffice build when no HAVE_CONFIG_H is defined
-#include <stdint.h>
-#include <inttypes.h>
-
-#endif
-
-#endif
-
 // debug message includes source file and line number
 //#define VERBOSE_DEBUG 1
 
commit 037cd557de5dad40a2ab90de68661f516e29a6c0
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Dec 27 15:52:29 2017 +0100

    rename include guards to avoid use of __
    
    Change-Id: I91bc5c8405165085e7c69ab8cf372bf7c785bf5b

diff --git a/inc/libmspub/MSPUBDocument.h b/inc/libmspub/MSPUBDocument.h
index be0cfbc..dad6e82 100644
--- a/inc/libmspub/MSPUBDocument.h
+++ b/inc/libmspub/MSPUBDocument.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __MSPUBDOCUMENT_H__
-#define __MSPUBDOCUMENT_H__
+#ifndef INCLUDED_INC_LIBMSPUB_MSPUBDOCUMENT_H
+#define INCLUDED_INC_LIBMSPUB_MSPUBDOCUMENT_H
 
 #include <librevenge/librevenge.h>
 
@@ -39,5 +39,5 @@ public:
 
 } // namespace libmspub
 
-#endif //  __MSPUBDOCUMENT_H__
+#endif //  INCLUDED_INC_LIBMSPUB_MSPUBDOCUMENT_H
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/inc/libmspub/libmspub.h b/inc/libmspub/libmspub.h
index c637abf..70764f5 100644
--- a/inc/libmspub/libmspub.h
+++ b/inc/libmspub/libmspub.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __LIBMSPUB_H__
-#define __LIBMSPUB_H__
+#ifndef INCLUDED_INC_LIBMSPUB_LIBMSPUB_H
+#define INCLUDED_INC_LIBMSPUB_LIBMSPUB_H
 
 #include "MSPUBDocument.h"
 
diff --git a/src/lib/Arrow.h b/src/lib/Arrow.h
index 74dc9df..2403057 100644
--- a/src/lib/Arrow.h
+++ b/src/lib/Arrow.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __ARROW_H__
-#define __ARROW_H__
+#ifndef INCLUDED_ARROW_H
+#define INCLUDED_ARROW_H
 
 namespace libmspub
 {
@@ -39,5 +39,5 @@ struct Arrow
 };
 } // namespace libmspub
 
-#endif /* __ARROW_H__ */
+#endif /* INCLUDED_ARROW_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/BorderArtInfo.h b/src/lib/BorderArtInfo.h
index 71e91c0..f09a163 100644
--- a/src/lib/BorderArtInfo.h
+++ b/src/lib/BorderArtInfo.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __BORDERARTINFO_H__
-#define __BORDERARTINFO_H__
+#ifndef INCLUDED_BORDERARTINFO_H
+#define INCLUDED_BORDERARTINFO_H
 
 #include <vector>
 #include <librevenge/librevenge.h>
diff --git a/src/lib/ColorReference.h b/src/lib/ColorReference.h
index 842a0c4..2549366 100644
--- a/src/lib/ColorReference.h
+++ b/src/lib/ColorReference.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __COLORREFERENCE_H__
-#define __COLORREFERENCE_H__
+#ifndef INCLUDED_COLORREFERENCE_H
+#define INCLUDED_COLORREFERENCE_H
 
 #include "MSPUBTypes.h"
 
@@ -32,5 +32,5 @@ public:
 };
 }
 
-#endif /* __COLORREFERENCE_H__ */
+#endif /* INCLUDED_COLORREFERENCE_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/Coordinate.h b/src/lib/Coordinate.h
index 336eb09..ac790ec 100644
--- a/src/lib/Coordinate.h
+++ b/src/lib/Coordinate.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __COORDINATE_H__
-#define __COORDINATE_H__
+#ifndef INCLUDED_COORDINATE_H
+#define INCLUDED_COORDINATE_H
 #include "MSPUBConstants.h"
 namespace libmspub
 {
diff --git a/src/lib/Dash.h b/src/lib/Dash.h
index e9c85a6..d48e68a 100644
--- a/src/lib/Dash.h
+++ b/src/lib/Dash.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __DASH_H__
-#define __DASH_H__
+#ifndef INCLUDED_DASH_H
+#define INCLUDED_DASH_H
 
 #include <boost/optional.hpp>
 #include <vector>
@@ -62,5 +62,5 @@ Dash getDash(MSPUBDashStyle style, unsigned shapeLineWidthInEmu,
              DotStyle dotStyle);
 } // namespace libmspub
 
-#endif /* __DASH_H__ */
+#endif /* INCLUDED_DASH_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/EmbeddedFontInfo.h b/src/lib/EmbeddedFontInfo.h
index 1200e81..5006b64 100644
--- a/src/lib/EmbeddedFontInfo.h
+++ b/src/lib/EmbeddedFontInfo.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __EMBEDDEDFONTINFO_H__
-#define __EMBEDDEDFONTINFO_H__
+#ifndef INCLUDED_EMBEDDEDFONTINFO_H
+#define INCLUDED_EMBEDDEDFONTINFO_H
 
 #include <librevenge/librevenge.h>
 
@@ -25,5 +25,5 @@ struct EmbeddedFontInfo
 };
 } // namespace libmspub
 
-#endif /* __EMBEDDEDFONTINFO_H__ */
+#endif /* INCLUDED_EMBEDDEDFONTINFO_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/EscherContainerType.h b/src/lib/EscherContainerType.h
index 2ba0ad3..d019f17 100644
--- a/src/lib/EscherContainerType.h
+++ b/src/lib/EscherContainerType.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __ESCHERCONTAINERTYPE_H__
-#define __ESCHERCONTAINERTYPE_H__
+#ifndef INCLUDED_ESCHERCONTAINERTYPE_H
+#define INCLUDED_ESCHERCONTAINERTYPE_H
 
 #define OFFICE_ART_DGG_CONTAINER      0xF000
 #define OFFICE_ART_B_STORE_CONTAINER  0xF001
@@ -31,5 +31,5 @@
 #define OFFICE_ART_FSPGR              0xF009
 #define OFFICE_ART_CHILD_ANCHOR       0xF00F
 
-#endif /* __ESCHERCONTAINERTYPE_H__ */
+#endif /* INCLUDED_ESCHERCONTAINERTYPE_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/EscherFieldIds.h b/src/lib/EscherFieldIds.h
index 1065d48..6245ea4 100644
--- a/src/lib/EscherFieldIds.h
+++ b/src/lib/EscherFieldIds.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __ESCHERFIELDIDS_H__
-#define __ESCHERFIELDIDS_H__
+#ifndef INCLUDED_ESCHERFIELDIDS_H
+#define INCLUDED_ESCHERFIELDIDS_H
 
 #define FIELDID_XS                     0x2001
 #define FIELDID_YS                     0x2002
@@ -100,5 +100,5 @@
 #define FLAG_USE_FSHADOW   (1 << 17)
 #define FLAG_USE_SHADOW   (1 << 1)
 
-#endif /* __ESCHERFIELDIDS_H__ */
+#endif /* INCLUDED_ESCHERFIELDIDS_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/Fill.h b/src/lib/Fill.h
index 1d08467..c9c8b78 100644
--- a/src/lib/Fill.h
+++ b/src/lib/Fill.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __FILL_H__
-#define __FILL_H__
+#ifndef INCLUDED_FILL_H
+#define INCLUDED_FILL_H
 
 #include <cstddef>
 
@@ -103,5 +103,5 @@ private:
 };
 }
 
-#endif /* __FILL_H__ */
+#endif /* INCLUDED_FILL_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/FillType.h b/src/lib/FillType.h
index 4d77217..11e9039 100644
--- a/src/lib/FillType.h
+++ b/src/lib/FillType.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __FILLTYPE_H__
-#define __FILLTYPE_H__
+#ifndef INCLUDED_FILLTYPE_H
+#define INCLUDED_FILLTYPE_H
 
 namespace libmspub
 {
@@ -29,5 +29,5 @@ enum FillType
   BACKGROUND = 0x09
 };
 } // libmspub
-#endif /* __FILLTYPE_H__ */
+#endif /* INCLUDED_FILLTYPE_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/Line.h b/src/lib/Line.h
index 7df675a..d528d38 100644
--- a/src/lib/Line.h
+++ b/src/lib/Line.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __LINE_H__
-#define __LINE_H__
+#ifndef INCLUDED_LINE_H
+#define INCLUDED_LINE_H
 #include "Dash.h"
 #include <boost/optional.hpp>
 #include "ColorReference.h"
diff --git a/src/lib/ListInfo.h b/src/lib/ListInfo.h
index 1efa8a3..b6f839f 100644
--- a/src/lib/ListInfo.h
+++ b/src/lib/ListInfo.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __LISTINFO_H__
-#define __LISTINFO_H__
+#ifndef INCLUDED_LISTINFO_H
+#define INCLUDED_LISTINFO_H
 
 #include <boost/optional.hpp>
 
@@ -48,5 +48,5 @@ struct ListInfo
 };
 } // namespace libmspub
 
-#endif /* __LISTINFO_H__ */
+#endif /* INCLUDED_LISTINFO_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/MSPUBBlockID.h b/src/lib/MSPUBBlockID.h
index a4cafa4..4420e05 100644
--- a/src/lib/MSPUBBlockID.h
+++ b/src/lib/MSPUBBlockID.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __MSPUBBLOCKID_H__
-#define __MSPUBBLOCKID_H__
+#ifndef INCLUDED_MSPUBBLOCKID_H
+#define INCLUDED_MSPUBBLOCKID_H
 
 namespace libmspub
 {
@@ -84,5 +84,5 @@ enum MSPUBBlockID // Don't be alarmed by multiple elements with the same value;
 };
 } // namespace libmspub
 
-#endif /* __MSPUBBLOCKID_H__ */
+#endif /* INCLUDED_MSPUBBLOCKID_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/MSPUBBlockType.h b/src/lib/MSPUBBlockType.h
index 7f43327..bc230d7 100644
--- a/src/lib/MSPUBBlockType.h
+++ b/src/lib/MSPUBBlockType.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __MSPUBBLOCKTYPE_H__
-#define __MSPUBBLOCKTYPE_H__
+#ifndef INCLUDED_MSPUBBLOCKTYPE_H
+#define INCLUDED_MSPUBBLOCKTYPE_H
 
 namespace libmspub
 {
@@ -22,5 +22,5 @@ enum MSPUBBlockType //Please fill this in and replace magic constants in MSPUBPa
 };
 } // namespace libmspub
 
-#endif /* __MSPUBBLOCKTYPE_H__ */
+#endif /* INCLUDED_MSPUBBLOCKTYPE_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/MSPUBCollector.h b/src/lib/MSPUBCollector.h
index 728d1df..61bfbdb 100644
--- a/src/lib/MSPUBCollector.h
+++ b/src/lib/MSPUBCollector.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __MSPUBCOLLECTOR_H__
-#define __MSPUBCOLLECTOR_H__
+#ifndef INCLUDED_MSPUBCOLLECTOR_H
+#define INCLUDED_MSPUBCOLLECTOR_H
 
 #include <functional>
 #include <list>
@@ -203,5 +203,5 @@ public:
 };
 } // namespace libmspub
 
-#endif /* __MSPUBCOLLECTOR_H__ */
+#endif /* INCLUDED_MSPUBCOLLECTOR_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/MSPUBConstants.h b/src/lib/MSPUBConstants.h
index 2acc5cb..c4712b2 100644
--- a/src/lib/MSPUBConstants.h
+++ b/src/lib/MSPUBConstants.h
@@ -7,12 +7,12 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __MSPUBCONSTANTS_H__
-#define __MSPUBCONSTANTS_H__
+#ifndef INCLUDED_MSPUBCONSTANTS_H
+#define INCLUDED_MSPUBCONSTANTS_H
 
 #define EMUS_IN_INCH 914400
 #define POINTS_IN_INCH 72
 #define DEFAULT_MARGIN 36576
 
-#endif /* __MSPUBCONSTANTS_H__ */
+#endif /* INCLUDED_MSPUBCONSTANTS_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/MSPUBContentChunkType.h b/src/lib/MSPUBContentChunkType.h
index 404c1c0..ab86e1c 100644
--- a/src/lib/MSPUBContentChunkType.h
+++ b/src/lib/MSPUBContentChunkType.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __MSPUBCHUNKTYPE_H__
-#define __MSPUBCHUNKTYPE_H__
+#ifndef INCLUDED_MSPUBCHUNKTYPE_H
+#define INCLUDED_MSPUBCHUNKTYPE_H
 
 namespace libmspub
 {
@@ -31,5 +31,5 @@ enum MSPUBContentChunkType //Please fill this in and replace magic constants in
 };
 } // namespace libmspub
 
-#endif /* __MSPUBCHUNKTYPE_H__ */
+#endif /* INCLUDED_MSPUBCHUNKTYPE_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/MSPUBMetaData.h b/src/lib/MSPUBMetaData.h
index f0f994c..f8136a1 100644
--- a/src/lib/MSPUBMetaData.h
+++ b/src/lib/MSPUBMetaData.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __MSPUBMETADATA_H__
-#define __MSPUBMETADATA_H__
+#ifndef INCLUDED_MSPUBMETADATA_H
+#define INCLUDED_MSPUBMETADATA_H
 
 #include <vector>
 #include <utility>
@@ -48,6 +48,6 @@ private:
 
 } // namespace libmspub
 
-#endif // __MSPUBMETADATA_H__
+#endif // INCLUDED_MSPUBMETADATA_H
 
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/MSPUBParser.h b/src/lib/MSPUBParser.h
index af30928..9426536 100644
--- a/src/lib/MSPUBParser.h
+++ b/src/lib/MSPUBParser.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __MSPUBPARSER_H__
-#define __MSPUBPARSER_H__
+#ifndef INCLUDED_MSPUBPARSER_H
+#define INCLUDED_MSPUBPARSER_H
 
 #include <map>
 #include <memory>
@@ -174,5 +174,5 @@ protected:
 
 } // namespace libmspub
 
-#endif //  __MSPUBRAPHICS_H__
+#endif //  INCLUDED_MSPUBRAPHICS_H
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/MSPUBParser2k.h b/src/lib/MSPUBParser2k.h
index 89ce22f..28e9686 100644
--- a/src/lib/MSPUBParser2k.h
+++ b/src/lib/MSPUBParser2k.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __MSPUBPARSER2K_H__
-#define __MSPUBPARSER2K_H__
+#ifndef INCLUDED_MSPUBPARSER2K_H
+#define INCLUDED_MSPUBPARSER2K_H
 
 #include <deque>
 #include <vector>
@@ -69,6 +69,6 @@ public:
 
 } // namespace libmspub
 
-#endif //  __MSPUBPARSER2K_H__
+#endif //  INCLUDED_MSPUBPARSER2K_H
 
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/MSPUBParser97.h b/src/lib/MSPUBParser97.h
index ec3d014..018e3fa 100644
--- a/src/lib/MSPUBParser97.h
+++ b/src/lib/MSPUBParser97.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __MSPUBPARSER97_H__
-#define __MSPUBPARSER97_H__
+#ifndef INCLUDED_MSPUBPARSER97_H
+#define INCLUDED_MSPUBPARSER97_H
 
 #include "MSPUBParser2k.h"
 
@@ -63,6 +63,6 @@ public:
 };
 }
 
-#endif //  __MSPUBPARSER97_H__
+#endif //  INCLUDED_MSPUBPARSER97_H
 
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/MSPUBTypes.h b/src/lib/MSPUBTypes.h
index f3257e1..7fae7e9 100644
--- a/src/lib/MSPUBTypes.h
+++ b/src/lib/MSPUBTypes.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __MSPUBTYPES_H__
-#define __MSPUBTYPES_H__
+#ifndef INCLUDED_MSPUBTYPES_H
+#define INCLUDED_MSPUBTYPES_H
 
 #include <vector>
 #include <string>
@@ -191,5 +191,5 @@ enum ImgType
 
 } // namespace libmspub
 
-#endif /* __MSPUBTYPES_H__ */
+#endif /* INCLUDED_MSPUBTYPES_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/Margins.h b/src/lib/Margins.h
index 02bf92a..4056c0d 100644
--- a/src/lib/Margins.h
+++ b/src/lib/Margins.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __MARGINS_H__
-#define __MARGINS_H__
+#ifndef INCLUDED_MARGINS_H
+#define INCLUDED_MARGINS_H
 namespace libmspub
 {
 struct Margins
diff --git a/src/lib/NumberingDelimiter.h b/src/lib/NumberingDelimiter.h
index fcec6fb..e5663ac 100644
--- a/src/lib/NumberingDelimiter.h
+++ b/src/lib/NumberingDelimiter.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __NUMBERINGDELIMITER_H__
-#define __NUMBERINGDELIMITER_H__
+#ifndef INCLUDED_NUMBERINGDELIMITER_H
+#define INCLUDED_NUMBERINGDELIMITER_H
 
 namespace libmspub
 {
@@ -26,5 +26,5 @@ enum NumberingDelimiter
 };
 } // namespace libmspub
 
-#endif /* __NUMBERINGDELIMITER_H__ */
+#endif /* INCLUDED_NUMBERINGDELIMITER_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/NumberingType.h b/src/lib/NumberingType.h
index 2f45ed4..0f65e0a 100644
--- a/src/lib/NumberingType.h
+++ b/src/lib/NumberingType.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __NUMBERINGTYPE_H__
-#define __NUMBERINGTYPE_H__
+#ifndef INCLUDED_NUMBERINGTYPE_H
+#define INCLUDED_NUMBERINGTYPE_H
 
 namespace libmspub
 {
@@ -26,5 +26,5 @@ enum NumberingType
 };
 } // namespace libmspub
 
-#endif /* __NUMBERINGTYPE_H__ */
+#endif /* INCLUDED_NUMBERINGTYPE_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/PolygonUtils.h b/src/lib/PolygonUtils.h
index 9750668..37d9b7b 100644
--- a/src/lib/PolygonUtils.h
+++ b/src/lib/PolygonUtils.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __POLYGONUTILS_H__
-#define __POLYGONUTILS_H__
+#ifndef INCLUDED_POLYGONUTILS_H
+#define INCLUDED_POLYGONUTILS_H
 
 #include <functional>
 #include <memory>
@@ -118,5 +118,5 @@ librevenge::RVNGPropertyList calcClipPath(const std::vector<libmspub::Vertex> &v
 void writeCustomShape(ShapeType shapeType, librevenge::RVNGPropertyList &graphicsProps, librevenge::RVNGDrawingInterface *painter, double x, double y, double height, double width, bool closeEverything, VectorTransformation2D transform, std::vector<Line> lines, std::function<double(unsigned index)> calculator, const std::vector<Color> &palette, std::shared_ptr<const CustomShape> shape);
 
 } // libmspub
-#endif /* __POLYGONUTILS_H__ */
+#endif /* INCLUDED_POLYGONUTILS_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/Shadow.h b/src/lib/Shadow.h
index 4e06c46..8cd9764 100644
--- a/src/lib/Shadow.h
+++ b/src/lib/Shadow.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __SHADOW_H__
-#define __SHADOW_H__
+#ifndef INCLUDED_SHADOW_H
+#define INCLUDED_SHADOW_H
 
 #include "ColorReference.h"
 
@@ -48,5 +48,5 @@ struct Shadow
 bool needsEmulation(const Shadow &shadow);
 } // namespace libmspub
 
-#endif /* __SHADOW_H__ */
+#endif /* INCLUDED_SHADOW_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/ShapeFlags.h b/src/lib/ShapeFlags.h
index 66ad36f..05fd3b2 100644
--- a/src/lib/ShapeFlags.h
+++ b/src/lib/ShapeFlags.h
@@ -26,8 +26,8 @@
  * instead of those above.
  */
 
-#ifndef __SHAPEFLAGS_H__
-#define __SHAPEFLAGS_H__
+#ifndef INCLUDED_SHAPEFLAGS_H
+#define INCLUDED_SHAPEFLAGS_H
 
 #define SF_GROUP       (1 << 0)
 #define SF_CHILD       (1 << 1)
@@ -42,5 +42,5 @@
 #define SF_BACKGROUND  (1 << 10)
 #define SF_HAVE_SPT    (1 << 11)
 
-#endif /* __SHAPEFLAGS_H__ */
+#endif /* INCLUDED_SHAPEFLAGS_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/ShapeGroupElement.h b/src/lib/ShapeGroupElement.h
index 1be6ed5..c95b6cc 100644
--- a/src/lib/ShapeGroupElement.h
+++ b/src/lib/ShapeGroupElement.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __SHAPEGROUPELEMENT_H__
-#define __SHAPEGROUPELEMENT_H__
+#ifndef INCLUDED_SHAPEGROUPELEMENT_H
+#define INCLUDED_SHAPEGROUPELEMENT_H
 #include <boost/optional.hpp>
 #include <functional>
 #include <memory>
diff --git a/src/lib/ShapeInfo.h b/src/lib/ShapeInfo.h
index eee7974..ec8050f 100644
--- a/src/lib/ShapeInfo.h
+++ b/src/lib/ShapeInfo.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __SHAPEINFO_H__
-#define __SHAPEINFO_H__
+#ifndef INCLUDED_SHAPEINFO_H
+#define INCLUDED_SHAPEINFO_H
 #include <boost/optional.hpp>
 #include <functional>
 #include <map>
diff --git a/src/lib/ShapeType.h b/src/lib/ShapeType.h
index 2506f97..dc78c08 100644
--- a/src/lib/ShapeType.h
+++ b/src/lib/ShapeType.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __SHAPETYPE_H__
-#define __SHAPETYPE_H__
+#ifndef INCLUDED_SHAPETYPE_H
+#define INCLUDED_SHAPETYPE_H
 
 namespace libmspub
 {
@@ -182,5 +182,5 @@ enum ShapeType
   TEXT_BOX            = 202
 };
 } // libmspub
-#endif /* __SHAPETYPE_H__ */
+#endif /* INCLUDED_SHAPETYPE_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/Shapes.h b/src/lib/Shapes.h
index 0ed08ab..1fed488 100644
--- a/src/lib/Shapes.h
+++ b/src/lib/Shapes.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __SHAPES_H__
-#define __SHAPES_H__
+#ifndef INCLUDED_SHAPES_H
+#define INCLUDED_SHAPES_H
 
 #include <vector>
 #include <map>
@@ -114,5 +114,5 @@ public:
   VectorTransformation2D m_foldedTransform;
 };
 } // namespace libmspub
-#endif // __SHAPES_H__
+#endif // INCLUDED_SHAPES_H
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/TableInfo.h b/src/lib/TableInfo.h
index d661d16..7ff4240 100644
--- a/src/lib/TableInfo.h
+++ b/src/lib/TableInfo.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __TABLEINFO_H__
-#define __TABLEINFO_H__
+#ifndef INCLUDED_TABLEINFO_H
+#define INCLUDED_TABLEINFO_H
 
 #include <vector>
 
@@ -46,5 +46,5 @@ struct TableInfo
 };
 } // namespace libmspub
 
-#endif /* __TABLEINFO_H__ */
+#endif /* INCLUDED_TABLEINFO_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/VectorTransformation2D.h b/src/lib/VectorTransformation2D.h
index 34db4b8..eba2770 100644
--- a/src/lib/VectorTransformation2D.h
+++ b/src/lib/VectorTransformation2D.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __VECTORTRANSFORMATION2D_H__
-#define __VECTORTRANSFORMATION2D_H__
+#ifndef INCLUDED_VECTORTRANSFORMATION2D_H
+#define INCLUDED_VECTORTRANSFORMATION2D_H
 
 namespace libmspub
 {
@@ -42,5 +42,5 @@ public:
 VectorTransformation2D operator*(const VectorTransformation2D &l, const VectorTransformation2D &r);
 } // namespace libmspub
 
-#endif /* __VECTORTRANSFORMATION2D_H__ */
+#endif /* INCLUDED_VECTORTRANSFORMATION2D_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/VerticalAlign.h b/src/lib/VerticalAlign.h
index d25f816..b4c7496 100644
--- a/src/lib/VerticalAlign.h
+++ b/src/lib/VerticalAlign.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __VERTICALALIGN_H__
-#define __VERTICALALIGN_H__
+#ifndef INCLUDED_VERTICALALIGN_H
+#define INCLUDED_VERTICALALIGN_H
 
 namespace libmspub
 {
@@ -20,5 +20,5 @@ enum VerticalAlign
 };
 } // namespace libmspub
 
-#endif /* __VERTICALALIGN_H__ */
+#endif /* INCLUDED_VERTICALALIGN_H */
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/libmspub_utils.h b/src/lib/libmspub_utils.h
index 8b30c9f..c06d285 100644
--- a/src/lib/libmspub_utils.h
+++ b/src/lib/libmspub_utils.h
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef __LIBMSPUB_UTILS_H__
-#define __LIBMSPUB_UTILS_H__
+#ifndef INCLUDED_LIBMSPUB_UTILS_H
+#define INCLUDED_LIBMSPUB_UTILS_H
 
 #include <stdio.h>
 #include <vector>
@@ -127,5 +127,5 @@ librevenge::RVNGBinaryData inflateData(librevenge::RVNGBinaryData);
 
 } // namespace libmspub
 
-#endif // __LIBMSPUB_UTILS_H__
+#endif // INCLUDED_LIBMSPUB_UTILS_H
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
commit af8c02038bddfa1a20b1d67093d6a4a919da8388
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Dec 27 15:50:02 2017 +0100

    use C++11 syntax to disable copying
    
    Change-Id: Ie6433cff226b72706c915b2070767d72e94d40ff

diff --git a/src/lib/ShapeGroupElement.h b/src/lib/ShapeGroupElement.h
index a51fedc..1be6ed5 100644
--- a/src/lib/ShapeGroupElement.h
+++ b/src/lib/ShapeGroupElement.h
@@ -25,8 +25,8 @@ class ShapeGroupElement
   std::weak_ptr<ShapeGroupElement> m_parent;
   std::vector<std::shared_ptr<ShapeGroupElement>> m_children;
   unsigned m_seqNum;
-  ShapeGroupElement &operator=(const ShapeGroupElement &); //not implemented
-  ShapeGroupElement(const ShapeGroupElement &); //not implemented
+  ShapeGroupElement &operator=(const ShapeGroupElement &) = delete;
+  ShapeGroupElement(const ShapeGroupElement &) = delete;
   VectorTransformation2D m_transform;
   ShapeGroupElement(const std::shared_ptr<ShapeGroupElement> &parent, unsigned seqNum);
 
commit 68e26d64d12f5239e8c71f723f4058c64afe9234
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Dec 27 15:47:48 2017 +0100

    remove pointless initializator
    
    Change-Id: Id48a8db1103cbfd69f806976621cdc8cc79c3747

diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index 718feba..c66fc0e 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -377,7 +377,7 @@ MSPUBCollector::MSPUBCollector(librevenge::RVNGDrawingInterface *painter) :
   m_paletteColors(), m_shapeSeqNumsOrdered(),
   m_pageSeqNumsByShapeSeqNum(), m_bgShapeSeqNumsByPageSeqNum(),
   m_skipIfNotBgSeqNums(),
-  m_currentShapeGroup(nullptr), m_topLevelShapes(),
+  m_currentShapeGroup(), m_topLevelShapes(),
   m_groupsBySeqNum(), m_embeddedFonts(),
   m_shapeInfosBySeqNum(), m_masterPages(),
   m_shapesWithCoordinatesRotated90(),
commit 1004d5a21a121bde7ca89d0e18968512fc12137e
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Dec 27 15:32:56 2017 +0100

    never call shared_from_this on not fully init-ed object
    
    Fixes regression since commit bbe7f806b95ef427153ba18bff80e674b1704ae5
    "replace dumb pointers by smart ones".
    
    Change-Id: Ie0dd277bc55347bb1ae5a59ccbeaffaa5ce6772a

diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index 65e432c..718feba 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -439,7 +439,7 @@ void MSPUBCollector::setShapeClipPath(unsigned seqNum, const std::vector<Vertex>
 
 void MSPUBCollector::beginGroup()
 {
-  auto tmp = std::make_shared<ShapeGroupElement>(m_currentShapeGroup.get());
+  auto tmp = ShapeGroupElement::create(m_currentShapeGroup);
   if (!m_currentShapeGroup)
   {
     m_topLevelShapes.push_back(tmp);
@@ -455,7 +455,7 @@ bool MSPUBCollector::endGroup()
   }
   auto parent = m_currentShapeGroup->getParent();
   if (parent)
-    m_currentShapeGroup = parent->shared_from_this();
+    m_currentShapeGroup = parent;
   return true;
 }
 
@@ -497,7 +497,7 @@ bool MSPUBCollector::setCurrentGroupSeqNum(unsigned seqNum)
 
 void MSPUBCollector::setShapeOrder(unsigned seqNum)
 {
-  auto tmp = std::make_shared<ShapeGroupElement>(m_currentShapeGroup.get(), seqNum);
+  auto tmp = ShapeGroupElement::create(m_currentShapeGroup, seqNum);
   if (!m_currentShapeGroup)
   {
     m_topLevelShapes.push_back(tmp);
diff --git a/src/lib/ShapeGroupElement.cpp b/src/lib/ShapeGroupElement.cpp
index c61d412..6dcead8 100644
--- a/src/lib/ShapeGroupElement.cpp
+++ b/src/lib/ShapeGroupElement.cpp
@@ -12,24 +12,20 @@
 namespace libmspub
 {
 
-ShapeGroupElement::ShapeGroupElement(ShapeGroupElement *parent) : m_shapeInfo(), m_parent(parent), m_children(), m_seqNum(0), m_transform()
+ShapeGroupElement::ShapeGroupElement(const std::shared_ptr<ShapeGroupElement> &parent, unsigned seqNum) : m_shapeInfo(), m_parent(parent), m_children(), m_seqNum(seqNum), m_transform()
 {
-  if (m_parent)
-  {
-    m_parent->m_children.push_back(shared_from_this());
-  }
 }
 
 ShapeGroupElement::~ShapeGroupElement()
 {
 }
 
-ShapeGroupElement::ShapeGroupElement(ShapeGroupElement *parent, unsigned seqNum) : m_shapeInfo(), m_parent(parent), m_children(), m_seqNum(seqNum), m_transform()
+std::shared_ptr<ShapeGroupElement> ShapeGroupElement::create(const std::shared_ptr<ShapeGroupElement> &parent, unsigned seqNum)
 {
-  if (m_parent)
-  {
-    m_parent->m_children.push_back(shared_from_this());
-  }
+  auto that = std::shared_ptr<ShapeGroupElement>(new ShapeGroupElement(parent, seqNum));
+  if (parent)
+    parent->m_children.push_back(that);
+  return that;
 }
 
 void ShapeGroupElement::setShapeInfo(const ShapeInfo &shapeInfo)
@@ -89,14 +85,9 @@ bool ShapeGroupElement::isGroup() const
   return !m_children.empty();
 }
 
-ShapeGroupElement *ShapeGroupElement::getParent()
-{
-  return m_parent;
-}
-
-const ShapeGroupElement *ShapeGroupElement::getParent() const
+std::shared_ptr<ShapeGroupElement> ShapeGroupElement::getParent() const
 {
-  return m_parent;
+  return m_parent.lock();
 }
 
 void ShapeGroupElement::setSeqNum(unsigned seqNum)
diff --git a/src/lib/ShapeGroupElement.h b/src/lib/ShapeGroupElement.h
index ef7d175..a51fedc 100644
--- a/src/lib/ShapeGroupElement.h
+++ b/src/lib/ShapeGroupElement.h
@@ -19,19 +19,21 @@
 
 namespace libmspub
 {
-class ShapeGroupElement : public std::enable_shared_from_this<ShapeGroupElement>
+class ShapeGroupElement
 {
   boost::optional<ShapeInfo> m_shapeInfo;
-  ShapeGroupElement *m_parent;
+  std::weak_ptr<ShapeGroupElement> m_parent;
   std::vector<std::shared_ptr<ShapeGroupElement>> m_children;
   unsigned m_seqNum;
   ShapeGroupElement &operator=(const ShapeGroupElement &); //not implemented
   ShapeGroupElement(const ShapeGroupElement &); //not implemented
   VectorTransformation2D m_transform;
+  ShapeGroupElement(const std::shared_ptr<ShapeGroupElement> &parent, unsigned seqNum);
+
 public:
-  ShapeGroupElement(ShapeGroupElement *parent);
-  ShapeGroupElement(ShapeGroupElement *parent, unsigned seqNum);
   ~ShapeGroupElement();
+  static std::shared_ptr<ShapeGroupElement> create(const std::shared_ptr<ShapeGroupElement> &parent, unsigned seqNum = 0);
+
   void setShapeInfo(const ShapeInfo &shapeInfo);
   void setup(std::function<void(ShapeGroupElement &self)> visitor);
   void visit(std::function<
@@ -42,8 +44,7 @@ public:
              std::function<void(void)>
              (const ShapeInfo &info, const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform, bool isGroup, const VectorTransformation2D &thisTransform)> visitor) const;
   bool isGroup() const;
-  ShapeGroupElement *getParent();
-  const ShapeGroupElement *getParent() const;
+  std::shared_ptr<ShapeGroupElement> getParent() const;
   void setSeqNum(unsigned seqNum);
   void setTransform(const VectorTransformation2D &transform);
   unsigned getSeqNum() const;


More information about the Libreoffice-commits mailing list