Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent compilation error on Node 12 (ref #1742) #1843

Merged
merged 1 commit into from Apr 25, 2019

Commits on Apr 24, 2019

  1. fix: use Nan::Utf8String instead of v8::String::Utf8Value for path

    Without this, attempting to build against Node v12.0.0 on Linux leads to the below error:
    ```
    ../src/serialport.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE Open(Nan::NAN_METHOD_ARGS_TYPE)’:
    ../src/serialport.cpp:41:75: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::String>)’
       v8::String::Utf8Value path(Nan::To<v8::String>(info[0]).ToLocalChecked());
                                                                               ^
    In file included from /home/user/.node-gyp/12.0.0/include/node/node.h:63:0,
                     from ../node_modules/nan/nan.h:53,
                     from ../src/./serialport.h:6,
                     from ../src/serialport.cpp:1:
    /home/user/.node-gyp/12.0.0/include/node/v8.h:2995:5: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
         Utf8Value(Isolate* isolate, Local<v8::Value> obj);
         ^~~~~~~~~
    /home/user/.node-gyp/12.0.0/include/node/v8.h:2995:5: note:   candidate expects 2 arguments, 1 provided
    ```
    
    And attempting to build again Node v10.15.3 on Linux leads to the below warning:
    ```
    ../src/serialport.cpp:41:75: warning: ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’ is deprecated: Use Isolate version [-Wdeprecated-declarations]
    @serialport/bindings:    v8::String::Utf8Value path(Nan::To<v8::String>(info[0]).ToLocalChecked());
    @serialport/bindings:                                                                            ^
    @serialport/bindings: In file included from /home/user/.node-gyp/10.15.3/include/node/v8.h:26:0,
    @serialport/bindings:                  from /home/user/.node-gyp/10.15.3/include/node/node.h:63,
    @serialport/bindings:                  from ../node_modules/nan/nan.h:53,
    @serialport/bindings:                  from ../src/./serialport.h:6,
    @serialport/bindings:                  from ../src/serialport.cpp:1:
    @serialport/bindings: /home/user/.node-gyp/10.15.3/include/node/v8.h:2892:28: note: declared here
    @serialport/bindings:                    explicit Utf8Value(Local<v8::Value> obj));
    ```
    jacobq committed Apr 24, 2019
    Configuration menu
    Copy the full SHA
    79a8dfb View commit details
    Browse the repository at this point in the history