8000 fix issues found by cppcheck (#10434) · whitewum/arangodb@50be0ca · GitHub
[go: up one dir, main page]

Skip to content

Commit 50be0ca

Browse files
authored
fix issues found by cppcheck (arangodb#10434)
1 parent d423359 commit 50be0ca

File tree

5 files changed

+18
-17
lines changed

5 files changed

+18
-17
lines changed

arangod/Aql/Query.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ QueryResultV8 Query::executeV8(v8::Isolate* isolate, QueryRegistry* registry) {
841841
TRI_VPackToV8(isolate, cacheEntry->_queryResult->slice(),
842842
queryResult.context->getVPackOptions());
843843
TRI_ASSERT(values->IsArray());
844-
queryResult.data = v8::Handle<v8::Array>::Cast(values);
844+
queryResult.v8Data = v8::Handle<v8::Array>::Cast(values);
845845
queryResult.extra = cacheEntry->_stats;
846846
queryResult.cached = true;
847847
return queryResult;
@@ -933,7 +933,7 @@ QueryResultV8 Query::executeV8(v8::Isolate* isolate, QueryRegistry* registry) {
933933
throw;
934934
}
935935

936-
queryResult.data = resArray;
936+
queryResult.v8Data = resArray;
937937
queryResult.context = _trx->transactionContext();
938938

939939
if (useQueryCache && _warnings.empty()) {

arangod/Aql/QueryResultV8.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ struct QueryResultV8 : public QueryResult {
5050

5151
void reset(Result const& result) {
5252
QueryResult::reset(result);
53-
data.Clear();
53+
v8Data.Clear();
5454
}
5555

5656
void reset(Result&& result) {
5757
QueryResult::reset(std::move(result));
58-
data.Clear();
58+
v8Data.Clear();
5959
}
6060

61-
v8::Local<v8::Array> data;
61+
v8::Local<v8::Array> v8Data;
6262
};
6363
} // namespace aql
6464
} // namespace arangodb

arangod/Statistics/figures.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ struct StatisticsDistribution {
9999
MUTEX_LOCKER(lock, _mutex);
100100
MUTEX_LOCKER(lock2, other._mutex);
101101
TRI_ASSERT(_counts.size() == other._counts.size() &&
102-
_cuts.size() == _cuts.size());
102+
_cuts.size() == other._cuts.size());
103103
_count += other._count;
104104
_total += other._total;
105105
for (size_t i = 0; i < _counts.size(); ++i) {

arangod/V8Server/v8-query.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ static void EdgesQuery(TRI_edge_direction_e direction,
179179
"FOR doc IN @@collection " + filter + " RETURN doc";
180180
auto queryResult = AqlQuery(isolate, collection, queryString, bindVars);
181181

182-
if (!queryResult.data.IsEmpty()) {
183-
TRI_V8_RETURN(queryResult.data);
182+
if (!queryResult.v8Data.IsEmpty()) {
183+
TRI_V8_RETURN(queryResult.v8Data);
184184
}
185185

186186
TRI_V8_RETURN_NULL();
@@ -426,8 +426,8 @@ static void JS_LookupByKeys(v8::FunctionCallbackInfo<v8::Value> const& args) {
426426
auto queryResult = AqlQuery(isolate, collection, queryString, bindVars);
427427

428428
v8::Handle<v8::Object> result = v8::Object::New(isolate);
429-
if (!queryResult.data.IsEmpty()) {
430-
result->Set(TRI_V8_ASCII_STRING(isolate, "documents"), queryResult.data);
429+
if (!queryResult.v8Data.IsEmpty()) {
430+
result->Set(TRI_V8_ASCII_STRING(isolate, "documents"), queryResult.v8Data);
431431
}
432432

433433
TRI_V8_RETURN(result);

arangod/V8Server/v8-vocbase.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "Aql/QueryExecutionState.h"
4444
#include "Aql/QueryList.h"
4545
#include "Aql/QueryRegistry.h"
46+
#include "Aql/QueryResultV8.h"
4647
#include "Aql/QueryString.h"
4748
#include "Basics/HybridLogicalClock.h"
4849
#include "Basics/MutexLocker.h"
@@ -770,7 +771,6 @@ static void JS_ExecuteAql(v8::FunctionCallbackInfo<v8::Value> const& args) {
770771

771772
arangodb::aql::QueryResultV8 queryResult = query.executeV8(isolate, queryRegistry);
772773

773-
774774
if (queryResult.result.fail()) {
775775
if (queryResult.result.is(TRI_ERROR_REQUEST_CANCELED)) {
776776
TRI_GET_GLOBALS();
@@ -790,26 +790,27 @@ static void JS_ExecuteAql(v8::FunctionCallbackInfo<v8::Value> const& args) {
790790
// return the array value as it is. this is a performance optimization
791791
v8::Handle<v8::Object> result = v8::Object::New(isolate);
792792

793-
if (!queryResult.data.IsEmpty()) {
794-
result->Set(TRI_V8_ASCII_STRING(isolate, "json"), queryResult.data);
793+
if (!queryResult.v8Data.IsEmpty()) {
794+
result->Set(TRI_V8_ASCII_STRING(isolate, "json"), queryResult.v8Data);
795795
}
796796

797797
if (queryResult.extra != nullptr) {
798-
VPackSlice stats = queryResult.extra->slice().get("stats");
798+
VPackSlice extra = queryResult.extra->slice();
799+
VPackSlice stats = extra.get("stats");
799800
if (!stats.isNone()) {
800801
result->Set(TRI_V8_ASCII_STRING(isolate, "stats"), TRI_VPackToV8(isolate, stats));
801802
}
802-
VPackSlice warnings = queryResult.extra->slice().get("warnings");
803+
VPackSlice warnings = extra.get("warnings");
803804
if (warnings.isNone()) {
804805
result->Set(TRI_V8_ASCII_STRING(isolate, "warnings"), v8::Array::New(isolate));
805806
} else {
806807
result->Set(TRI_V8_ASCII_STRING(isolate, "warnings"), TRI_VPackToV8(isolate, warnings));
807808
}
808-
VPackSlice profile = queryResult.extra->slice().get("profile");
809+
VPackSlice profile = extra.get("profile");
809810
if (!profile.isNone()) {
810811
result->Set(TRI_V8_ASCII_STRING(isolate, "profile"), TRI_VPackToV8(isolate, profile));
811812
}
812-
VPackSlice plan = queryResult.extra->slice().get("plan");
813+
VPackSlice plan = extra.get("plan");
813814
if (!plan.isNone()) {
814815
result->Set(TRI_V8_ASCII_STRING(isolate, "plan"), TRI_VPackToV8(isolate, plan));
815816
}

0 commit comments

Comments
 (0)
0