summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2020-03-27 18:30:35 +0200
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2020-03-30 23:37:44 +0300
commit879a906efaeeb4ee1db5a799cc35f9843485e3f7 (patch)
tree60f10f91066917bdce4207a190f825da85cf2005
parentea19e817c07f4a5eeda939b5ec4dca9e9bb9b90e (diff)
downloadqtlocation-mapboxgl-879a906efaeeb4ee1db5a799cc35f9843485e3f7.tar.gz
[core] Fix bugprone-virtual-near-miss errors
As reported by clang-tidy-8.
-rw-r--r--platform/node/src/node_request.cpp18
-rw-r--r--platform/node/src/node_request.hpp2
2 files changed, 10 insertions, 10 deletions
diff --git a/platform/node/src/node_request.cpp b/platform/node/src/node_request.cpp
index 78f50ea9ce..17e3053529 100644
--- a/platform/node/src/node_request.cpp
+++ b/platform/node/src/node_request.cpp
@@ -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) {}
diff --git a/platform/node/src/node_request.hpp b/platform/node/src/node_request.hpp
index 0621940bb1..a7c2545fc2 100644
--- a/platform/node/src/node_request.hpp
+++ b/platform/node/src/node_request.hpp
@@ -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;