From f982dda0cedeae1f52dbcd5dce32ff0d478e0c8a Mon Sep 17 00:00:00 2001
From: "Thiago Marcos P. Santos" <tmpsantos@gmail.com>
Date: Mon, 10 Apr 2017 13:49:59 +0300
Subject: [PATCH] Rename libclipper namespace

So it won't clash with the libclipper used by the Mapbox GL plugin
when linking Qt with -static.

With -static, all the plugins are linked together instead of each
one having its own shared library, thus, hiding private symbols.

Change-Id: I33ee4afd4b83741c5f3fae32a88da7f4a7fee75f
Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
---
 src/3rdparty/clip2tri/clip2tri.cpp             | 18 +++++++++---------
 src/3rdparty/clip2tri/clip2tri.h               |  2 +-
 src/3rdparty/clipper/clipper.cpp               |  4 ++--
 src/3rdparty/clipper/clipper.h                 |  4 ++--
 .../qdeclarativecirclemapitem.cpp              |  4 ++--
 .../qdeclarativepolygonmapitem.cpp             |  2 +-
 6 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/3rdparty/clip2tri/clip2tri.cpp b/src/3rdparty/clip2tri/clip2tri.cpp
index 2f5026671..e715d1c70 100644
--- a/src/3rdparty/clip2tri/clip2tri.cpp
+++ b/src/3rdparty/clip2tri/clip2tri.cpp
@@ -90,7 +90,7 @@ void clip2tri::addClipPolygon(const Path &path)
     {
         clipper.AddPath(path, ptClip, true);
     }
-    catch(ClipperLib::clipperException &e)
+    catch(QtClipperLib::clipperException &e)
     {
         printf("addClipPolygon: %s\n", e.what());
     }
@@ -102,7 +102,7 @@ void clip2tri::addSubjectPath(const Path &path, bool closed)
     {
         clipper.AddPath(path, ptSubject, closed);
     }
-    catch(ClipperLib::clipperException &e)
+    catch(QtClipperLib::clipperException &e)
     {
         printf("addSubjectPath: %s\n", e.what());
         return;
@@ -118,17 +118,17 @@ void clip2tri::clearClipper()
     openSubject = false;
 }
 
-static ClipperLib::ClipType operation(const clip2tri::Operation &op)
+static QtClipperLib::ClipType operation(const clip2tri::Operation &op)
 {
     switch (op) {
     case clip2tri::Intersection:
-        return ClipperLib::ctIntersection;
+        return QtClipperLib::ctIntersection;
     case clip2tri::Union:
-        return ClipperLib::ctUnion;
+        return QtClipperLib::ctUnion;
     case clip2tri::Difference:
-        return ClipperLib::ctDifference;
+        return QtClipperLib::ctDifference;
     case clip2tri::Xor:
-        return ClipperLib::ctXor;
+        return QtClipperLib::ctXor;
     }
     return ctIntersection;
 }
@@ -166,7 +166,7 @@ Paths clip2tri::execute(const clip2tri::Operation op, const PolyFillType subjFil
             }
         }
     }
-    catch(ClipperLib::clipperException &e)
+    catch(QtClipperLib::clipperException &e)
     {
         printf("executing %s: %s\n", operationName(op).c_str(), e.what());
     }
@@ -237,7 +237,7 @@ bool clip2tri::mergePolysToPolyTree(const vector<vector<Point> > &inputPolygons,
    {
       clipper.AddPaths(input, ptSubject, true);
    }
-   catch(ClipperLib::clipperException &e)
+   catch(QtClipperLib::clipperException &e)
    {
        printf("mergePolysToPolyTree: %s\n", e.what());
    }
diff --git a/src/3rdparty/clip2tri/clip2tri.h b/src/3rdparty/clip2tri/clip2tri.h
index 37b563bbd..61c8a0f54 100644
--- a/src/3rdparty/clip2tri/clip2tri.h
+++ b/src/3rdparty/clip2tri/clip2tri.h
@@ -33,7 +33,7 @@
 #include <clipper.h>
 
 using namespace std;
-using namespace ClipperLib;
+using namespace QtClipperLib;
 
 namespace c2t
 {
diff --git a/src/3rdparty/clipper/clipper.cpp b/src/3rdparty/clipper/clipper.cpp
index d4c82344e..53ac4d826 100644
--- a/src/3rdparty/clipper/clipper.cpp
+++ b/src/3rdparty/clipper/clipper.cpp
@@ -48,7 +48,7 @@
 #include <ostream>
 #include <functional>
 
-namespace ClipperLib {
+namespace QtClipperLib {
 
 static double const pi = 3.141592653589793238;
 static double const two_pi = pi *2;
@@ -4619,4 +4619,4 @@ std::ostream& operator <<(std::ostream &s, const Paths &p)
 }
 //------------------------------------------------------------------------------
 
-} //ClipperLib namespace
+} //QtClipperLib namespace
diff --git a/src/3rdparty/clipper/clipper.h b/src/3rdparty/clipper/clipper.h
index 2472ac770..78013afc7 100644
--- a/src/3rdparty/clipper/clipper.h
+++ b/src/3rdparty/clipper/clipper.h
@@ -59,7 +59,7 @@
 #include <functional>
 #include <queue>
 
-namespace ClipperLib {
+namespace QtClipperLib {
 
 enum ClipType { ctIntersection, ctUnion, ctDifference, ctXor };
 enum PolyType { ptSubject, ptClip };
@@ -397,7 +397,7 @@ class clipperException : public std::exception
 };
 //------------------------------------------------------------------------------
 
-} //ClipperLib namespace
+} //QtClipperLib namespace
 
 #endif //clipper_hpp
 
diff --git a/src/location/declarativemaps/qdeclarativecirclemapitem.cpp b/src/location/declarativemaps/qdeclarativecirclemapitem.cpp
index 9aae03fa0..274225c03 100644
--- a/src/location/declarativemaps/qdeclarativecirclemapitem.cpp
+++ b/src/location/declarativemaps/qdeclarativecirclemapitem.cpp
@@ -181,7 +181,7 @@ void QGeoMapCircleGeometry::updateScreenPointsInvert(const QList<QDoubleVector2D
     c2t::clip2tri clipper;
     clipper.addSubjectPath(QClipperUtils::qListToPath(fill), true);
     clipper.addClipPolygon(QClipperUtils::qListToPath(hole));
-    Paths difference = clipper.execute(c2t::clip2tri::Difference, ClipperLib::pftEvenOdd, ClipperLib::pftEvenOdd);
+    Paths difference = clipper.execute(c2t::clip2tri::Difference, QtClipperLib::pftEvenOdd, QtClipperLib::pftEvenOdd);
 
     // 2)
     QDoubleVector2D lb = map.geoProjection().geoToWrappedMapProjection(srcOrigin_);
@@ -192,7 +192,7 @@ void QGeoMapCircleGeometry::updateScreenPointsInvert(const QList<QDoubleVector2D
         for (const Path &p: difference)
             clipper.addSubjectPath(p, true);
         clipper.addClipPolygon(QClipperUtils::qListToPath(visibleRegion));
-        Paths res = clipper.execute(c2t::clip2tri::Intersection, ClipperLib::pftEvenOdd, ClipperLib::pftEvenOdd);
+        Paths res = clipper.execute(c2t::clip2tri::Intersection, QtClipperLib::pftEvenOdd, QtClipperLib::pftEvenOdd);
         clippedPaths = QClipperUtils::pathsToQList(res);
 
         // 2.1) update srcOrigin_ with the point with minimum X/Y
diff --git a/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp b/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
index 5cd57dcb5..0b93a2944 100644
--- a/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
+++ b/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
@@ -190,7 +190,7 @@ void QGeoMapPolygonGeometry::updateSourcePoints(const QGeoMap &map,
         c2t::clip2tri clipper;
         clipper.addSubjectPath(QClipperUtils::qListToPath(wrappedPath), true);
         clipper.addClipPolygon(QClipperUtils::qListToPath(visibleRegion));
-        Paths res = clipper.execute(c2t::clip2tri::Intersection, ClipperLib::pftEvenOdd, ClipperLib::pftEvenOdd);
+        Paths res = clipper.execute(c2t::clip2tri::Intersection, QtClipperLib::pftEvenOdd, QtClipperLib::pftEvenOdd);
         clippedPaths = QClipperUtils::pathsToQList(res);
 
         // 2.1) update srcOrigin_ and leftBoundWrapped with the point with minimum X
-- 
GitLab