From 04b65ed94efaa83ed1d44698b5e830680e8f1229 Mon Sep 17 00:00:00 2001 From: Stefan Klug Date: Thu, 20 Dec 2012 22:00:05 +0100 Subject: [PATCH] fix compiler error with mapnik 2.1 or where mapnik::value_integer is int32 --- src/mapnik_feature.cpp | 2 +- src/mapnik_map.cpp | 2 +- src/mapnik_memory_datasource.cpp | 2 +- src/utils.hpp | 18 ++++++++---------- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/mapnik_feature.cpp b/src/mapnik_feature.cpp index df1813e7ec..0614a133d0 100644 --- a/src/mapnik_feature.cpp +++ b/src/mapnik_feature.cpp @@ -231,7 +231,7 @@ Handle Feature::addAttributes(const Arguments& args) // todo - round if (num == value->IntegerValue()) { #if MAPNIK_VERSION >= 200100 - fp->get()->put_new(TOSTR(name),value->IntegerValue()); + fp->get()->put_new(TOSTR(name),static_cast(value->IntegerValue())); #else boost::put(*fp->get(),TOSTR(name),static_cast(value->IntegerValue())); #endif diff --git a/src/mapnik_map.cpp b/src/mapnik_map.cpp index 3666caae9a..18782696bd 100644 --- a/src/mapnik_map.cpp +++ b/src/mapnik_map.cpp @@ -430,7 +430,7 @@ void Map::set_prop(Local property, double num = value->NumberValue(); // todo - round if (num == value->IntegerValue()) { - params[TOSTR(name)] = value->IntegerValue(); + params[TOSTR(name)] = static_cast(value->IntegerValue()); } else { double dub_val = value->NumberValue(); params[TOSTR(name)] = dub_val; diff --git a/src/mapnik_memory_datasource.cpp b/src/mapnik_memory_datasource.cpp index 088700963c..639dd85d85 100644 --- a/src/mapnik_memory_datasource.cpp +++ b/src/mapnik_memory_datasource.cpp @@ -263,7 +263,7 @@ Handle MemoryDatasource::add(const Arguments& args) // todo - round if (num == value->IntegerValue()) { #if MAPNIK_VERSION >= 200100 - feature->put_new(TOSTR(name),value->IntegerValue()); + feature->put_new(TOSTR(name),static_cast(value->IntegerValue())); #else boost::put(*feature,TOSTR(name),static_cast(value->IntegerValue())); #endif diff --git a/src/utils.hpp b/src/utils.hpp index 60d1e0f195..25bc2b7613 100644 --- a/src/utils.hpp +++ b/src/utils.hpp @@ -40,6 +40,12 @@ using namespace v8; using namespace node; namespace node_mapnik { + +#if MAPNIK_VERSION >= 200200 + typedef mapnik::value_integer value_integer; +#else + typedef int value_integer; +#endif // adapted to work for both mapnik features and mapnik parameters struct params_to_object : public boost::static_visitor<> @@ -49,11 +55,7 @@ struct params_to_object : public boost::static_visitor<> ds_(ds), key_(key) {} -#if MAPNIK_VERSION >= 200200 - void operator () ( mapnik::value_integer val ) -#else - void operator () ( int val ) -#endif + void operator () ( value_integer val ) { ds_->Set(String::NewSymbol(key_.c_str()), Integer::New(val) ); } @@ -93,11 +95,7 @@ struct params_to_object : public boost::static_visitor<> struct value_converter: public boost::static_visitor > { -#if MAPNIK_VERSION >= 200200 - Handle operator () ( mapnik::value_integer val ) const -#else - Handle operator () ( int val ) const -#endif + Handle operator () ( value_integer val ) const { return Integer::New(val); }