mirror of https://gitee.com/bigwinds/arangodb
fixed warnings reported by cppcheck
This commit is contained in:
parent
7baf040368
commit
b3ed54f95b
|
@ -95,7 +95,7 @@ void ApplicationCluster::setupOptions (map<string, basics::ProgramOptionsDescrip
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool ApplicationCluster::prepare () {
|
bool ApplicationCluster::prepare () {
|
||||||
_enableCluster = (_agencyEndpoints.size() > 0 || ! _agencyPrefix.empty());
|
_enableCluster = (! _agencyEndpoints.empty() || ! _agencyPrefix.empty());
|
||||||
|
|
||||||
if (! enabled()) {
|
if (! enabled()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -113,7 +113,7 @@ bool ApplicationCluster::prepare () {
|
||||||
|
|
||||||
|
|
||||||
// validate --cluster.agency-endpoint
|
// validate --cluster.agency-endpoint
|
||||||
if (_agencyEndpoints.size() == 0) {
|
if (_agencyEndpoints.empty()) {
|
||||||
LOG_FATAL_AND_EXIT("must at least specify one endpoint in --cluster.agency-endpoint");
|
LOG_FATAL_AND_EXIT("must at least specify one endpoint in --cluster.agency-endpoint");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -277,7 +277,7 @@ void ClusterComm::closeUnusedConnections (double limit) {
|
||||||
for (i = sc->unused.begin(); i != sc->unused.end(); ) {
|
for (i = sc->unused.begin(); i != sc->unused.end(); ) {
|
||||||
if (t - (*i)->lastUsed > limit) {
|
if (t - (*i)->lastUsed > limit) {
|
||||||
vector<SingleServerConnection*>::iterator j;
|
vector<SingleServerConnection*>::iterator j;
|
||||||
for (j = sc->connections.begin(); j != sc->connections.end(); j++) {
|
for (j = sc->connections.begin(); j != sc->connections.end(); ++j) {
|
||||||
if (*j == *i) {
|
if (*j == *i) {
|
||||||
sc->connections.erase(j);
|
sc->connections.erase(j);
|
||||||
break;
|
break;
|
||||||
|
@ -296,7 +296,7 @@ void ClusterComm::closeUnusedConnections (double limit) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
prev = i;
|
prev = i;
|
||||||
i++;
|
++i;
|
||||||
haveprev = true;
|
haveprev = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -519,7 +519,6 @@ ClusterCommResult* ClusterComm::wait (
|
||||||
ClusterCommResult* res = 0;
|
ClusterCommResult* res = 0;
|
||||||
double endtime;
|
double endtime;
|
||||||
double timeleft;
|
double timeleft;
|
||||||
bool found;
|
|
||||||
|
|
||||||
if (0.0 == timeout) {
|
if (0.0 == timeout) {
|
||||||
endtime = 1.0e50; // this is the Sankt Nimmerleinstag
|
endtime = 1.0e50; // this is the Sankt Nimmerleinstag
|
||||||
|
@ -571,7 +570,7 @@ ClusterCommResult* ClusterComm::wait (
|
||||||
// we return it immediately, otherwise, we report an error or wait.
|
// we return it immediately, otherwise, we report an error or wait.
|
||||||
basics::ConditionLocker locker(&somethingReceived);
|
basics::ConditionLocker locker(&somethingReceived);
|
||||||
while (true) { // will be left by return or break on timeout
|
while (true) { // will be left by return or break on timeout
|
||||||
found = false;
|
bool found = false;
|
||||||
for (q = received.begin(); q != received.end(); q++) {
|
for (q = received.begin(); q != received.end(); q++) {
|
||||||
op = *q;
|
op = *q;
|
||||||
if (match(clientTransactionID, coordTransactionID, shardID, op)) {
|
if (match(clientTransactionID, coordTransactionID, shardID, op)) {
|
||||||
|
@ -760,13 +759,12 @@ string ClusterComm::processAnswer(string& coordinatorHeader,
|
||||||
operationID = basics::StringUtils::uint64(coordinatorHeader.substr(start));
|
operationID = basics::StringUtils::uint64(coordinatorHeader.substr(start));
|
||||||
|
|
||||||
// Finally find the ClusterCommOperation record for this operation:
|
// Finally find the ClusterCommOperation record for this operation:
|
||||||
ClusterCommOperation* op;
|
|
||||||
{
|
{
|
||||||
basics::ConditionLocker locker(&somethingReceived);
|
basics::ConditionLocker locker(&somethingReceived);
|
||||||
ClusterComm::IndexIterator i;
|
ClusterComm::IndexIterator i;
|
||||||
i = receivedByOpID.find(operationID);
|
i = receivedByOpID.find(operationID);
|
||||||
if (i != receivedByOpID.end()) {
|
if (i != receivedByOpID.end()) {
|
||||||
op = *(i->second);
|
ClusterCommOperation* op = *(i->second);
|
||||||
op->answer = answer;
|
op->answer = answer;
|
||||||
op->status = CL_COMM_RECEIVED;
|
op->status = CL_COMM_RECEIVED;
|
||||||
// Do we have to do a callback?
|
// Do we have to do a callback?
|
||||||
|
@ -787,7 +785,7 @@ string ClusterComm::processAnswer(string& coordinatorHeader,
|
||||||
basics::ConditionLocker sendlocker(&somethingToSend);
|
basics::ConditionLocker sendlocker(&somethingToSend);
|
||||||
i = toSendByOpID.find(operationID);
|
i = toSendByOpID.find(operationID);
|
||||||
if (i != toSendByOpID.end()) {
|
if (i != toSendByOpID.end()) {
|
||||||
op = *(i->second);
|
ClusterCommOperation* op = *(i->second);
|
||||||
op->answer = answer;
|
op->answer = answer;
|
||||||
op->status = CL_COMM_RECEIVED;
|
op->status = CL_COMM_RECEIVED;
|
||||||
if (0 != op->callback) {
|
if (0 != op->callback) {
|
||||||
|
|
|
@ -94,8 +94,8 @@ void CollectionInfo::invalidate () {
|
||||||
_id = 0;
|
_id = 0;
|
||||||
_name = "";
|
_name = "";
|
||||||
_type = TRI_COL_TYPE_UNKNOWN;
|
_type = TRI_COL_TYPE_UNKNOWN;
|
||||||
_shardKeys.empty();
|
_shardKeys.clear();
|
||||||
_shards.empty();
|
_shards.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -1083,8 +1083,10 @@ static v8::Handle<v8::Value> JS_ShardingTest (v8::Arguments const& argv) {
|
||||||
res = cc->syncRequest(clientTransactionId, TRI_NewTickServer(), shard,
|
res = cc->syncRequest(clientTransactionId, TRI_NewTickServer(), shard,
|
||||||
reqType, path, body.c_str(), body.size(),
|
reqType, path, body.c_str(), body.size(),
|
||||||
*headerFields, timeout);
|
*headerFields, timeout);
|
||||||
LOG_DEBUG("JS_ShardingTest: request has been sent synchronously, "
|
if (res != 0) {
|
||||||
"status: %d",res->status);
|
LOG_DEBUG("JS_ShardingTest: request has been sent synchronously, "
|
||||||
|
"status: %d",res->status);
|
||||||
|
}
|
||||||
|
|
||||||
if (0 == res) {
|
if (0 == res) {
|
||||||
r->Set(v8::String::New("errorMsg"),v8::String::New("out of memory"));
|
r->Set(v8::String::New("errorMsg"),v8::String::New("out of memory"));
|
||||||
|
|
Loading…
Reference in New Issue