[core] Fix bugprone-virtual-near-miss errors
As reported by clang-tidy-8.
This commit is contained in:
@@ -60,7 +60,7 @@ void NodeRequest::HandleCallback(const Nan::FunctionCallbackInfo<v8::Value>& inf
|
||||
auto callback = std::move(request->callback);
|
||||
request->callback = {};
|
||||
if (!callback) {
|
||||
request->unref();
|
||||
request->unrefRequest();
|
||||
return info.GetReturnValue().SetUndefined();
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ void NodeRequest::HandleCallback(const Nan::FunctionCallbackInfo<v8::Value>& inf
|
||||
*Nan::Utf8String(info[0])
|
||||
);
|
||||
} else if (info.Length() < 2 || !info[1]->IsObject()) {
|
||||
request->unref();
|
||||
request->unrefRequest();
|
||||
return Nan::ThrowTypeError("Second argument must be a response object");
|
||||
} else {
|
||||
auto res = Nan::To<v8::Object>(info[1]).ToLocalChecked();
|
||||
@@ -118,7 +118,7 @@ void NodeRequest::HandleCallback(const Nan::FunctionCallbackInfo<v8::Value>& inf
|
||||
node::Buffer::Length(data)
|
||||
);
|
||||
} else {
|
||||
request->unref();
|
||||
request->unrefRequest();
|
||||
return Nan::ThrowTypeError("Response data must be a Buffer");
|
||||
}
|
||||
}
|
||||
@@ -126,15 +126,15 @@ void NodeRequest::HandleCallback(const Nan::FunctionCallbackInfo<v8::Value>& inf
|
||||
|
||||
// Send the response object to the NodeFileSource object
|
||||
callback(response);
|
||||
request->unref();
|
||||
request->unrefRequest();
|
||||
info.GetReturnValue().SetUndefined();
|
||||
}
|
||||
|
||||
void NodeRequest::unref() {
|
||||
Nan::HandleScope scope;
|
||||
delete asyncResource;
|
||||
asyncResource = nullptr;
|
||||
Unref();
|
||||
void NodeRequest::unrefRequest() {
|
||||
Nan::HandleScope scope;
|
||||
delete asyncResource;
|
||||
asyncResource = nullptr;
|
||||
Unref();
|
||||
}
|
||||
|
||||
NodeAsyncRequest::NodeAsyncRequest() : request(nullptr) {}
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
static void New(const Nan::FunctionCallbackInfo<v8::Value>&);
|
||||
static void HandleCallback(const Nan::FunctionCallbackInfo<v8::Value>&);
|
||||
|
||||
void unref();
|
||||
void unrefRequest();
|
||||
|
||||
mbgl::FileSource::Callback callback;
|
||||
NodeAsyncRequest* asyncRequest;
|
||||
|
||||
Reference in New Issue
Block a user