Skip to content

Commit

Permalink
fix compiler error with mapnik 2.1 or where mapnik::value_integer is …
Browse files Browse the repository at this point in the history
…int32
  • Loading branch information
stefanklug committed Dec 20, 2012
1 parent b9b9ce4 commit 04b65ed
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/mapnik_feature.cpp
Expand Up @@ -231,7 +231,7 @@ Handle<Value> Feature::addAttributes(const Arguments& args)
// todo - round // todo - round
if (num == value->IntegerValue()) { if (num == value->IntegerValue()) {
#if MAPNIK_VERSION >= 200100 #if MAPNIK_VERSION >= 200100
fp->get()->put_new(TOSTR(name),value->IntegerValue()); fp->get()->put_new(TOSTR(name),static_cast<node_mapnik::value_integer>(value->IntegerValue()));
#else #else
boost::put(*fp->get(),TOSTR(name),static_cast<int>(value->IntegerValue())); boost::put(*fp->get(),TOSTR(name),static_cast<int>(value->IntegerValue()));
#endif #endif
Expand Down
2 changes: 1 addition & 1 deletion src/mapnik_map.cpp
Expand Up @@ -430,7 +430,7 @@ void Map::set_prop(Local<String> property,
double num = value->NumberValue(); double num = value->NumberValue();
// todo - round // todo - round
if (num == value->IntegerValue()) { if (num == value->IntegerValue()) {
params[TOSTR(name)] = value->IntegerValue(); params[TOSTR(name)] = static_cast<node_mapnik::value_integer>(value->IntegerValue());
} else { } else {
double dub_val = value->NumberValue(); double dub_val = value->NumberValue();
params[TOSTR(name)] = dub_val; params[TOSTR(name)] = dub_val;
Expand Down
2 changes: 1 addition & 1 deletion src/mapnik_memory_datasource.cpp
Expand Up @@ -263,7 +263,7 @@ Handle<Value> MemoryDatasource::add(const Arguments& args)
// todo - round // todo - round
if (num == value->IntegerValue()) { if (num == value->IntegerValue()) {
#if MAPNIK_VERSION >= 200100 #if MAPNIK_VERSION >= 200100
feature->put_new(TOSTR(name),value->IntegerValue()); feature->put_new(TOSTR(name),static_cast<node_mapnik::value_integer>(value->IntegerValue()));
#else #else
boost::put(*feature,TOSTR(name),static_cast<int>(value->IntegerValue())); boost::put(*feature,TOSTR(name),static_cast<int>(value->IntegerValue()));
#endif #endif
Expand Down
18 changes: 8 additions & 10 deletions src/utils.hpp
Expand Up @@ -40,6 +40,12 @@ using namespace v8;
using namespace node; using namespace node;


namespace node_mapnik { 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 // adapted to work for both mapnik features and mapnik parameters
struct params_to_object : public boost::static_visitor<> struct params_to_object : public boost::static_visitor<>
Expand All @@ -49,11 +55,7 @@ struct params_to_object : public boost::static_visitor<>
ds_(ds), ds_(ds),
key_(key) {} key_(key) {}


#if MAPNIK_VERSION >= 200200 void operator () ( value_integer val )
void operator () ( mapnik::value_integer val )
#else
void operator () ( int val )
#endif
{ {
ds_->Set(String::NewSymbol(key_.c_str()), Integer::New(val) ); ds_->Set(String::NewSymbol(key_.c_str()), Integer::New(val) );
} }
Expand Down Expand Up @@ -93,11 +95,7 @@ struct params_to_object : public boost::static_visitor<>


struct value_converter: public boost::static_visitor<Handle<Value> > struct value_converter: public boost::static_visitor<Handle<Value> >
{ {
#if MAPNIK_VERSION >= 200200 Handle<Value> operator () ( value_integer val ) const
Handle<Value> operator () ( mapnik::value_integer val ) const
#else
Handle<Value> operator () ( int val ) const
#endif
{ {
return Integer::New(val); return Integer::New(val);
} }
Expand Down

0 comments on commit 04b65ed

Please sign in to comment.