8000 cppcheck · ezhangle/arangodb@3d3024a · GitHub
[go: up one dir, main page]

Skip to content

Commit 3d3024a

Browse files
committed
cppcheck
1 parent 9791e46 commit 3d3024a

File tree

7 files changed

+37
-15
lines changed

7 files changed

+37
-15
lines changed

arangod/Aql/Ast.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,7 @@ void Ast::injectBindParameters (BindParameters& parameters) {
11371137
bool isWriteCollection = false;
11381138
if (_writeCollection != nullptr &&
11391139
_writeCollection->type == NODE_TYPE_PARAMETER &&
1140-
strcmp(param, _writeCollection->getStringValue()) == 0) {
1140+
::strcmp(param, _writeCollection->getStringValue()) == 0) {
11411141
isWriteCollection = true;
11421142
}
11431143

arangod/Wal/LogfileManager.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,9 +1373,6 @@ Logfile* LogfileManager::getRemovableLogfile () {
13731373

13741374
Logfile::IdType minId = UINT64_MAX;
13751375

1376-
uint32_t numberOfLogfiles = 0;
1377-
Logfile* first = nullptr;
1378-
13791376
{
13801377
READ_LOCKER(_transactionsLock);
13811378

@@ -1390,6 +1387,9 @@ Logfile* LogfileManager::getRemovableLogfile () {
13901387
}
13911388

13921389
{
1390+
uint32_t numberOfLogfiles = 0;
1391+
Logfile* first = nullptr;
1392+
13931393
READ_LOCKER(_logfilesLock);
13941394

13951395
for (auto& it : _logfiles) {

lib/Basics/SkipList.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,16 @@ namespace triagens {
5757
void* _doc;
5858
int _height;
5959
public:
60-
void* document () {
60+
void* document () const {
6161
return _doc;
6262
}
63-
SkipListNode* nextNode () {
63+
SkipListNode* nextNode () const {
6464
return _next[0];
6565
}
6666
// Note that the prevNode of the first data node is the artificial
6767
// _start node not containing data. This is contrary to the prevNode
6868
// method of the SkipList class, which returns nullptr in that case.
69-
SkipListNode* prevNode () {
69+
SkipListNode* prevNode () const {
7070
return _prev;
7171
}
7272
};

lib/Basics/win-utils.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,16 +172,14 @@ static void InvalidParameterHandler (const wchar_t* expression, // expression se
172172

173173
int finaliseWindows (const TRI_win_finalise_e finaliseWhat,
174174
const char* data) {
175-
int result = 0;
176-
177175
// ............................................................................
178176
// The data is used to transport information from the calling function to here
179177
// it may be NULL (and will be in most cases)
180178
// ............................................................................
181179

182180
switch (finaliseWhat) {
183181
case TRI_WIN_FINAL_WSASTARTUP_FUNCTION_CALL: {
184-
result = WSACleanup(); // could this cause error on server termination?
182+
int result = WSACleanup(); // could this cause error on server termination?
185183

186184
if (result != 0) {
187185
// can not use LOG_ etc here since the logging may have terminated

lib/Statistics/statistics.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ static void ProcessRequestStatistics (TRI_request_statistics_t* statistics) {
120120
}
121121

122122
// clear statistics
123-
memset(statistics, 0, sizeof(TRI_request_statistics_t));
124-
statistics->_requestType = triagens::rest::HttpRequest::HTTP_REQUEST_ILLEGAL;
123+
statistics->reset();
125124

126125
// put statistics item back onto the freelist
127126
#ifdef TRI_ENABLE_MAINTAINER_MODE
@@ -269,7 +268,7 @@ void TRI_ReleaseConnectionStatistics (TRI_connection_statistics_t* statistics) {
269268
}
270269

271270
// clear statistics
272-
memset(statistics, 0, sizeof(TRI_connection_statistics_t));
271+
statistics->reset();
273272

274273
// put statistics item back onto the freelist
275274
#ifdef TRI_ENABLE_MAINTAINER_MODE

lib/Statistics/statistics.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,24 @@ struct TRI_request_statistics_t {
6161
_ignore(false) {
6262
}
6363

64+
void reset () {
65+
_readStart = 0.0;
66+
_readEnd = 0.0;
67+
_queueStart = 0.0;
68+
_queueEnd = 0.0;
69+
_requestStart = 0.0;
70+
_requestEnd = 0.0;
71+
_writeStart = 0.0;
72+
_writeEnd = 0.0;
73+
_receivedBytes = 0.0;
74+
_sentBytes = 0.0;
75+
_requestType = triagens::rest::HttpRequest::HTTP_REQUEST_ILLEGAL;
76+
_async = false;
77+
_tooLarge = false;
78+
_executeError = false;
79+
_ignore = false;
80+
}
81+
6482
double _readStart;
6583
double _readEnd;
6684
double _queueStart;
@@ -92,6 +110,13 @@ struct TRI_connection_statistics_t {
92110
_http(false),
93111
_error(false) {
94112
}
113+
114+
void reset () {
115+
_connStart = 0.0;
116+
_connEnd = 0.0;
117+
_http = false;
118+
_error = false;
119+
}
95120

96121
double _connStart;
97122
double _connEnd;

lib/V8/v8-environment.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,14 @@ static void EnvDeleter (v8::Local<v8::String> property,
129129
const v8::PropertyCallbackInfo<v8::Boolean>& args) {
130130
v8::Isolate* isolate = args.GetIsolate();
131131
v8::HandleScope scope(isolate);
132-
bool rc = true;
133132
#ifndef _WIN32
134133
v8::String::Utf8Value key(property);
135-
rc = getenv(*key) != nullptr;
134+
bool rc = getenv(*key) != nullptr;
136135
if (rc) {
137136
unsetenv(*key);
138137
}
139138
#else
139+
bool rc = true;
140140
v8::String::Value key(property);
141141
WCHAR* key_ptr = reinterpret_cast<WCHAR*>(*key);
142142
if (key_ptr[0] == L'=' || !SetEnvironmentVariableW(key_ptr, nullptr)) {

0 commit comments

Comments
 (0)
0