Skip to content

Commit

Permalink
Merge pull request #810 from mapnik/fix-v0.10
Browse files Browse the repository at this point in the history
fix node v0.10.x
  • Loading branch information
springmeyer authored Sep 12, 2017
2 parents 3ab3a76 + ba89f99 commit 0158cf4
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/mapnik_color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ v8::Local<v8::Value> Color::NewInstance(mapnik::color const& color) {
Color* c = new Color();
c->this_ = std::make_shared<mapnik::color>(color);
v8::Local<v8::Value> ext = Nan::New<v8::External>(c);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Color instance");
return scope.Escape(maybe_local.ToLocalChecked());
}
Expand Down
2 changes: 1 addition & 1 deletion src/mapnik_datasource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ v8::Local<v8::Value> Datasource::NewInstance(mapnik::datasource_ptr ds_ptr) {
Datasource* d = new Datasource();
d->datasource_ = ds_ptr;
v8::Local<v8::Value> ext = Nan::New<v8::External>(d);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Datasource instance");
return scope.Escape(maybe_local.ToLocalChecked());
}
Expand Down
4 changes: 2 additions & 2 deletions src/mapnik_feature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ NAN_METHOD(Feature::fromJSON)
}
Feature* feat = new Feature(f);
v8::Local<v8::Value> ext = Nan::New<v8::External>(feat);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Feature instance");
else info.GetReturnValue().Set(maybe_local.ToLocalChecked());
}
Expand All @@ -134,7 +134,7 @@ v8::Local<v8::Value> Feature::NewInstance(mapnik::feature_ptr f_ptr)
Nan::EscapableHandleScope scope;
Feature* f = new Feature(f_ptr);
v8::Local<v8::Value> ext = Nan::New<v8::External>(f);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Feature instance");
return scope.Escape(maybe_local.ToLocalChecked());
}
Expand Down
2 changes: 1 addition & 1 deletion src/mapnik_featureset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ v8::Local<v8::Value> Featureset::NewInstance(mapnik::featureset_ptr fsp)
Featureset* fs = new Featureset();
fs->this_ = fsp;
v8::Local<v8::Value> ext = Nan::New<v8::External>(fs);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Featureset instance");
return scope.Escape(maybe_local.ToLocalChecked());
}
2 changes: 1 addition & 1 deletion src/mapnik_geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ v8::Local<v8::Value> Geometry::NewInstance(mapnik::feature_ptr f) {
Nan::EscapableHandleScope scope;
Geometry* g = new Geometry(f);
v8::Local<v8::Value> ext = Nan::New<v8::External>(g);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Geometry instance");
return scope.Escape(maybe_local.ToLocalChecked());
}
Expand Down
2 changes: 1 addition & 1 deletion src/mapnik_grid_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ v8::Local<v8::Value> GridView::NewInstance(Grid * JSGrid,
GridView* gv = new GridView(JSGrid);
gv->this_ = std::make_shared<mapnik::grid_view>(JSGrid->get()->get_view(x,y,w,h));
v8::Local<v8::Value> ext = Nan::New<v8::External>(gv);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new GridView instance");
return scope.Escape(maybe_local.ToLocalChecked());
}
Expand Down
22 changes: 11 additions & 11 deletions src/mapnik_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1615,7 +1615,7 @@ void Image::EIO_AfterCopy(uv_work_t* req)
{
Image* im = new Image(closure->im2);
v8::Local<v8::Value> ext = Nan::New<v8::External>(im);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Image instance");
v8::Local<v8::Value> argv[2] = { Nan::Null(), maybe_local.ToLocalChecked() };
Nan::MakeCallback(Nan::GetCurrentContext()->Global(), Nan::New(closure->cb), 2, argv);
Expand Down Expand Up @@ -1734,7 +1734,7 @@ v8::Local<v8::Value> Image::_copySync(Nan::NAN_METHOD_ARGS_TYPE info)
);
Image* new_im = new Image(imagep);
v8::Local<v8::Value> ext = Nan::New<v8::External>(new_im);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Image instance");
return scope.Escape(maybe_local.ToLocalChecked());
}
Expand Down Expand Up @@ -2080,7 +2080,7 @@ void Image::EIO_AfterResize(uv_work_t* req)
{
Image* im = new Image(closure->im2);
v8::Local<v8::Value> ext = Nan::New<v8::External>(im);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Image instance");
v8::Local<v8::Value> argv[2] = { Nan::Null(), maybe_local.ToLocalChecked() };
Nan::MakeCallback(Nan::GetCurrentContext()->Global(), Nan::New(closure->cb), 2, argv);
Expand Down Expand Up @@ -2267,7 +2267,7 @@ v8::Local<v8::Value> Image::_resizeSync(Nan::NAN_METHOD_ARGS_TYPE info)
mapnik::util::apply_visitor(visit, *imagep);
Image* new_im = new Image(imagep);
v8::Local<v8::Value> ext = Nan::New<v8::External>(new_im);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Image instance");
return scope.Escape(maybe_local.ToLocalChecked());
}
Expand Down Expand Up @@ -2378,7 +2378,7 @@ v8::Local<v8::Value> Image::_openSync(Nan::NAN_METHOD_ARGS_TYPE info)
}
Image* im = new Image(imagep);
v8::Local<v8::Value> ext = Nan::New<v8::External>(im);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Image instance");
return scope.Escape(maybe_local.ToLocalChecked());
}
Expand Down Expand Up @@ -2516,7 +2516,7 @@ void Image::EIO_AfterOpen(uv_work_t* req)
{
Image* im = new Image(closure->im);
v8::Local<v8::Value> ext = Nan::New<v8::External>(im);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Image instance");
v8::Local<v8::Value> argv[2] = { Nan::Null(), maybe_local.ToLocalChecked() };
Nan::MakeCallback(Nan::GetCurrentContext()->Global(), Nan::New(closure->cb), 2, argv);
Expand Down Expand Up @@ -2725,7 +2725,7 @@ v8::Local<v8::Value> Image::_fromSVGSync(bool fromFile, Nan::NAN_METHOD_ARGS_TYP
image_ptr imagep = std::make_shared<mapnik::image_any>(im);
Image *im2 = new Image(imagep);
v8::Local<v8::Value> ext = Nan::New<v8::External>(im2);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Image instance");
return scope.Escape(maybe_local.ToLocalChecked());
}
Expand Down Expand Up @@ -2963,7 +2963,7 @@ void Image::EIO_AfterFromSVG(uv_work_t* req)
{
Image* im = new Image(closure->im);
v8::Local<v8::Value> ext = Nan::New<v8::External>(im);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Image instance");
v8::Local<v8::Value> argv[2] = { Nan::Null(), maybe_local.ToLocalChecked() };
Nan::MakeCallback(Nan::GetCurrentContext()->Global(), Nan::New(closure->cb), 2, argv);
Expand Down Expand Up @@ -3296,7 +3296,7 @@ v8::Local<v8::Value> Image::_fromBufferSync(Nan::NAN_METHOD_ARGS_TYPE info)
image_ptr imagep = std::make_shared<mapnik::image_any>(im_wrapper);
Image* im = new Image(imagep);
v8::Local<v8::Value> ext = Nan::New<v8::External>(im);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Image instance");
v8::Local<v8::Object> image_obj = maybe_local.ToLocalChecked()->ToObject();
image_obj->Set(Nan::New("_buffer").ToLocalChecked(),obj);
Expand Down Expand Up @@ -3352,7 +3352,7 @@ v8::Local<v8::Value> Image::_fromBytesSync(Nan::NAN_METHOD_ARGS_TYPE info)
image_ptr imagep = std::make_shared<mapnik::image_any>(reader->read(0,0,reader->width(),reader->height()));
Image* im = new Image(imagep);
v8::Local<v8::Value> ext = Nan::New<v8::External>(im);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Image instance");
return scope.Escape(maybe_local.ToLocalChecked());
}
Expand Down Expand Up @@ -3523,7 +3523,7 @@ void Image::EIO_AfterFromBytes(uv_work_t* req)
{
Image* im = new Image(closure->im);
v8::Local<v8::Value> ext = Nan::New<v8::External>(im);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Image instance");
v8::Local<v8::Value> argv[2] = { Nan::Null(), maybe_local.ToLocalChecked() };
Nan::MakeCallback(Nan::GetCurrentContext()->Global(), Nan::New(closure->cb), 2, argv);
Expand Down
2 changes: 1 addition & 1 deletion src/mapnik_image_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ v8::Local<v8::Value> ImageView::NewInstance(Image * JSImage ,
ImageView* imv = new ImageView(JSImage);
imv->this_ = std::make_shared<mapnik::image_view_any>(mapnik::create_view(*(JSImage->get()),x,y,w,h));
v8::Local<v8::Value> ext = Nan::New<v8::External>(imv);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new ImageView instance");
return scope.Escape(maybe_local.ToLocalChecked());
}
Expand Down
2 changes: 1 addition & 1 deletion src/mapnik_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ v8::Local<v8::Value> Layer::NewInstance(mapnik::layer const& lay_ref) {
// copy new mapnik::layer into the shared_ptr
l->layer_ = std::make_shared<mapnik::layer>(lay_ref);
v8::Local<v8::Value> ext = Nan::New<v8::External>(l);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Layer instance");
return scope.Escape(maybe_local.ToLocalChecked());
}
Expand Down
2 changes: 1 addition & 1 deletion src/mapnik_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@ NAN_METHOD(Map::clone)
Map* m2 = new Map();
m2->map_ = std::make_shared<mapnik::Map>(*m->map_);
v8::Local<v8::Value> ext = Nan::New<v8::External>(m2);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Map instance");
else info.GetReturnValue().Set(maybe_local.ToLocalChecked());
}
Expand Down
2 changes: 1 addition & 1 deletion src/mapnik_memory_datasource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ v8::Local<v8::Value> MemoryDatasource::NewInstance(mapnik::datasource_ptr ds_ptr
MemoryDatasource* d = new MemoryDatasource();
d->datasource_ = ds_ptr;
v8::Local<v8::Value> ext = Nan::New<v8::External>(d);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new MemoryDatasource instance");
return scope.Escape(maybe_local.ToLocalChecked());
}
Expand Down
2 changes: 1 addition & 1 deletion src/mapnik_vector_tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,7 @@ NAN_METHOD(VectorTile::layer)
}
}
v8::Local<v8::Value> ext = Nan::New<v8::External>(v);
v8::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Layer instance");
else info.GetReturnValue().Set(maybe_local.ToLocalChecked());
return;
Expand Down

0 comments on commit 0158cf4

Please sign in to comment.