Fix FTBFS with the new geos library (02-support_new_libgeos++.patch)
authorDavid Paleino <dapal@debian.org>
Mon, 12 Mar 2012 21:17:34 +0000 (22:17 +0100)
committerDavid Paleino <dapal@debian.org>
Mon, 12 Mar 2012 22:41:31 +0000 (23:41 +0100)
debian/changelog
debian/patches/02-support_new_libgeos++.patch [new file with mode: 0644]
debian/patches/series

index 1269e41..412d04a 100644 (file)
@@ -1,8 +1,9 @@
 osmium (0.0~20111213-g7f3500a-2) UNRELEASED; urgency=low
 
   * Switch dependency from libgeos-dev to libgeos++-dev
+  * Fix FTBFS with the new geos library (02-support_new_libgeos++.patch)
 
- -- David Paleino <dapal@debian.org>  Mon, 12 Mar 2012 21:47:02 +0100
+ -- David Paleino <dapal@debian.org>  Mon, 12 Mar 2012 23:41:12 +0100
 
 osmium (0.0~20111213-g7f3500a-1) unstable; urgency=low
 
diff --git a/debian/patches/02-support_new_libgeos++.patch b/debian/patches/02-support_new_libgeos++.patch
new file mode 100644 (file)
index 0000000..e5c9926
--- /dev/null
@@ -0,0 +1,47 @@
+From: David Paleino <dapal@debian.org>
+Subject: patch code to work with geos++ 3.3.1
+Origin: vendor
+Forwarded: no
+
+---
+ include/osmium/geometry/multipolygon.hpp |   10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+--- osmium.orig/include/osmium/geometry/multipolygon.hpp
++++ osmium/include/osmium/geometry/multipolygon.hpp
+@@ -54,14 +54,14 @@ namespace Osmium {
+                 switch (g->getGeometryTypeId()) {
+                     case geos::geom::GEOS_MULTIPOLYGON:
+                     case geos::geom::GEOS_MULTILINESTRING: {
+-                        for (geos::geom::GeometryCollection::const_iterator it = static_cast<const geos::geom::GeometryCollection*>(g)->begin();
+-                                it != static_cast<const geos::geom::GeometryCollection*>(g)->end(); ++it) {
++                        for (geos::geom::GeometryCollection::const_iterator it = dynamic_cast<const geos::geom::GeometryCollection*>(g)->begin();
++                                it != dynamic_cast<const geos::geom::GeometryCollection*>(g)->end(); ++it) {
+                             dump_geometry(*it, part_start_list, x_list, y_list);
+                         }
+                         break;
+                     }
+                     case geos::geom::GEOS_POLYGON: {
+-                        const geos::geom::Polygon* polygon = static_cast<const geos::geom::Polygon*>(g);
++                        const geos::geom::Polygon* polygon = dynamic_cast<const geos::geom::Polygon*>(g);
+                         dump_geometry(polygon->getExteriorRing(), part_start_list, x_list, y_list);
+                         for (size_t i=0; i < polygon->getNumInteriorRing(); ++i) {
+                             dump_geometry(polygon->getInteriorRingN(i), part_start_list, x_list, y_list);
+@@ -71,7 +71,7 @@ namespace Osmium {
+                     case geos::geom::GEOS_LINESTRING:
+                     case geos::geom::GEOS_LINEARRING: {
+                         part_start_list.push_back(x_list.size());
+-                        const geos::geom::CoordinateSequence* cs = static_cast<const geos::geom::LineString*>(g)->getCoordinatesRO();
++                        const geos::geom::CoordinateSequence* cs = dynamic_cast<const geos::geom::LineString*>(g)->getCoordinatesRO();
+                         for (size_t i = 0; i < cs->getSize(); ++i) {
+                             x_list.push_back(cs->getX(i));
+                             y_list.push_back(cs->getY(i));
+@@ -165,7 +165,7 @@ namespace Osmium {
+                     v8::Local<v8::Array> multipolygon_array = v8::Array::New(geometry->getNumGeometries());
+                     for (size_t i=0; i < geometry->getNumGeometries(); ++i) {
+-                        geos::geom::Polygon* polygon = (geos::geom::Polygon*) geometry->getGeometryN(i);
++                        const geos::geom::Polygon* polygon = dynamic_cast<const geos::geom::Polygon*>(geometry->getGeometryN(i));
+                         v8::Local<v8::Array> polygon_array = v8::Array::New(polygon->getNumInteriorRing());
+                         multipolygon_array->Set(i, polygon_array);
+                         polygon_array->Set(0, js_ring_as_array(polygon->getExteriorRing()));
index 5167465..a1f6622 100644 (file)
@@ -1,2 +1,3 @@
 00-fix_typos.patch
 01-fix_ld--as-needed.patch
+02-support_new_libgeos++.patch