Skip to content

Commit

Permalink
Run NAN v1 to v2 upgrade script
Browse files Browse the repository at this point in the history
- The upgrade steps are almost undocumented, but simplified by running a series of `sed` commands on the source files.
- The script was [originally suggested](nodejs/nan#376) in a github issue for NAN.
- One version has been [released as a gist](https://gist.github.com/thlorenz/7e9d8ad15566c99fd116).
- [A modified version](https://gist.github.com/joelpurra/a1129ca1336c14bfd51b1a7ad0f79171) which works better with `getdns-node` was used.
- This commit contains only automated fixes; the next commit contains manual fixes to some regexp misses.
  • Loading branch information
joelpurra committed Jul 24, 2016
1 parent c3abebb commit be48e29
Show file tree
Hide file tree
Showing 6 changed files with 183 additions and 183 deletions.
10 changes: 5 additions & 5 deletions src/GNConstants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@

using namespace v8;

static inline void SetConstant(const char* name, int value, Handle<Object> exports) {
exports->ForceSet(NanNew<String>(name), NanNew<Integer>(value), ReadOnly);
static inline void SetConstant(const char* name, int value, Local<Object> exports) {
exports->ForceSet(Nan::New<String>(name).ToLocalChecked(), Nan::New<Integer>(value), ReadOnly);
}

void GNConstants::Init(Handle<Object> target) {
void GNConstants::Init(Local<Object> target) {

Local<Object> exports = NanNew<Object>();
target->ForceSet(NanNew<String>("constants"), exports, ReadOnly);
Local<Object> exports = Nan::New<Object>();
target->ForceSet(Nan::New<String>("constants").ToLocalChecked(), exports, ReadOnly);

SetConstant("RETURN_GOOD",GETDNS_RETURN_GOOD,exports);
SetConstant("RETURN_GENERIC_ERROR",GETDNS_RETURN_GENERIC_ERROR,exports);
Expand Down
2 changes: 1 addition & 1 deletion src/GNConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
class GNConstants {
public:
// Node module initializer
static void Init(v8::Handle<v8::Object> exports);
static void Init(v8::Local<v8::Object> exports);
private:
GNConstants() { }
~GNConstants() { }
Expand Down
Loading

0 comments on commit be48e29

Please sign in to comment.