Permalink
Browse files

support 64 bit mapnik::value_integer and avoid warnings with 2.0.x - c…

…loses #129
  • Loading branch information...
1 parent 5506642 commit 4b43e813d00e358fa6759525119a4998cc1c5792 Dane Springmeyer committed Dec 19, 2012
Showing with 20 additions and 14 deletions.
  1. +2 −3 src/mapnik_feature.cpp
  2. +3 −3 src/mapnik_grid.cpp
  3. +3 −3 src/mapnik_image.cpp
  4. +1 −2 src/mapnik_map.cpp
  5. +2 −3 src/mapnik_memory_datasource.cpp
  6. +9 −0 src/utils.hpp
View
@@ -230,11 +230,10 @@ Handle<Value> Feature::addAttributes(const Arguments& args)
double num = value->NumberValue();
// todo - round
if (num == value->IntegerValue()) {
- int integer = value->IntegerValue();
#if MAPNIK_VERSION >= 200100
- fp->get()->put_new(TOSTR(name),integer);
+ fp->get()->put_new(TOSTR(name),value->IntegerValue());
#else
- boost::put(*fp->get(),TOSTR(name),integer);
+ boost::put(*fp->get(),TOSTR(name),static_cast<int>(value->IntegerValue()));
#endif
} else {
View
@@ -130,8 +130,8 @@ Handle<Value> Grid::New(const Arguments& args)
Handle<Value> Grid::clearSync(const Arguments& args)
{
HandleScope scope;
- Grid* g = ObjectWrap::Unwrap<Grid>(args.This());
#if MAPNIK_VERSION >= 200200
+ Grid* g = ObjectWrap::Unwrap<Grid>(args.This());
g->get()->clear();
#endif
return Undefined();
@@ -171,18 +171,18 @@ Handle<Value> Grid::clear(const Arguments& args)
void Grid::EIO_Clear(uv_work_t* req)
{
+#if MAPNIK_VERSION >= 200200
clear_grid_baton_t *closure = static_cast<clear_grid_baton_t *>(req->data);
try
{
-#if MAPNIK_VERSION >= 200200
closure->g->get()->clear();
-#endif
}
catch(std::exception const& ex)
{
closure->error = true;
closure->error_name = ex.what();
}
+#endif
}
void Grid::EIO_AfterClear(uv_work_t* req)
View
@@ -153,8 +153,8 @@ void Image::set_prop(Local<String> property,
Handle<Value> Image::clearSync(const Arguments& args)
{
HandleScope scope;
- Image* im = ObjectWrap::Unwrap<Image>(args.This());
#if MAPNIK_VERSION >= 200200
+ Image* im = ObjectWrap::Unwrap<Image>(args.This());
im->get()->clear();
#endif
return Undefined();
@@ -194,18 +194,18 @@ Handle<Value> Image::clear(const Arguments& args)
void Image::EIO_Clear(uv_work_t* req)
{
+#if MAPNIK_VERSION >= 200200
clear_image_baton_t *closure = static_cast<clear_image_baton_t *>(req->data);
try
{
-#if MAPNIK_VERSION >= 200200
closure->im->get()->clear();
-#endif
}
catch(std::exception const& ex)
{
closure->error = true;
closure->error_name = ex.what();
}
+#endif
}
void Image::EIO_AfterClear(uv_work_t* req)
View
@@ -430,8 +430,7 @@ void Map::set_prop(Local<String> property,
double num = value->NumberValue();
// todo - round
if (num == value->IntegerValue()) {
- int integer = value->IntegerValue();
- params[TOSTR(name)] = integer;
+ params[TOSTR(name)] = value->IntegerValue();
} else {
double dub_val = value->NumberValue();
params[TOSTR(name)] = dub_val;
@@ -262,11 +262,10 @@ Handle<Value> MemoryDatasource::add(const Arguments& args)
double num = value->NumberValue();
// todo - round
if (num == value->IntegerValue()) {
- int integer = value->IntegerValue();
#if MAPNIK_VERSION >= 200100
- feature->put_new(TOSTR(name),integer);
+ feature->put_new(TOSTR(name),value->IntegerValue());
#else
- boost::put(*feature,TOSTR(name),integer);
+ boost::put(*feature,TOSTR(name),static_cast<int>(value->IntegerValue()));
#endif
} else {
double dub_val = value->NumberValue();
View
@@ -13,6 +13,7 @@
// core types
#include <mapnik/unicode.hpp>
#include <mapnik/value.hpp>
+#include <mapnik/version.hpp>
// boost
#include <boost/variant/static_visitor.hpp>
@@ -48,7 +49,11 @@ 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
{
ds_->Set(String::NewSymbol(key_.c_str()), Integer::New(val) );
}
@@ -88,7 +93,11 @@ struct params_to_object : public boost::static_visitor<>
struct value_converter: public boost::static_visitor<Handle<Value> >
{
+#if MAPNIK_VERSION >= 200200
+ Handle<Value> operator () ( mapnik::value_integer val ) const
+#else
Handle<Value> operator () ( int val ) const
+#endif
{
return Integer::New(val);
}

0 comments on commit 4b43e81

Please sign in to comment.