Fix compile errors with ambiguous signedness in NanNew param

This fixes two instances of a compile error I'd been getting with
OpenCV 2.4.9 (via Homebrew) on Mac OS:

../node_modules/nan/nan_new.h:184:10: error: call to 'New' is ambiguous
  return NanIntern::Factory<T>::New(arg0);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~
../src/Matrix.cc:453:51: note: in instantiation of function template specialization 'NanNew<v8::Integer, unsigned long>' requested here
        v8::Handle<v8::Value> constructorArgs[3] = {buf, NanNew<v8::Integer>(vec.size()), NanNew<v8::Integer>(0)};
                                                         ^
../node_modules/nan/nan_new.h:86:26: note: candidate function
  static inline return_t New(int32_t value);
                         ^
../node_modules/nan/nan_new.h:87:26: note: candidate function
  static inline return_t New(uint32_t value);
This commit is contained in:
Micah Elizabeth Scott 2015-01-16 12:13:45 -08:00
parent 73cddc81de
commit 85c3a90db7

View File

@ -452,7 +452,7 @@ NAN_METHOD(Matrix::ToBuffer){
v8::Local<v8::Object> globalObj = NanGetCurrentContext()->Global();
v8::Local<v8::Function> bufferConstructor = v8::Local<v8::Function>::Cast(globalObj->Get(NanNew<String>("Buffer")));
v8::Handle<v8::Value> constructorArgs[3] = {buf, NanNew<v8::Integer>(vec.size()), NanNew<v8::Integer>(0)};
v8::Handle<v8::Value> constructorArgs[3] = {buf, NanNew<v8::Integer>((unsigned)vec.size()), NanNew<v8::Integer>(0)};
v8::Local<v8::Object> actualBuffer = bufferConstructor->NewInstance(3, constructorArgs);
NanReturnValue(actualBuffer);
@ -485,7 +485,7 @@ class AsyncToBufferWorker : public NanAsyncWorker {
v8::Local<v8::Object> globalObj = NanGetCurrentContext()->Global();
v8::Local<v8::Function> bufferConstructor = v8::Local<v8::Function>::Cast(globalObj->Get(NanNew<String>("Buffer")));
v8::Handle<v8::Value> constructorArgs[3] = {buf, NanNew<v8::Integer>(res.size()), NanNew<v8::Integer>(0)};
v8::Handle<v8::Value> constructorArgs[3] = {buf, NanNew<v8::Integer>((unsigned)res.size()), NanNew<v8::Integer>(0)};
v8::Local<v8::Object> actualBuffer = bufferConstructor->NewInstance(3, constructorArgs);