mirror of https://gitee.com/bigwinds/arangodb
fixed cppcheck warnings
This commit is contained in:
parent
8b6f0e1f51
commit
eed90fc588
|
@ -583,6 +583,7 @@ struct AqlValueMaterializer {
|
|||
: trx(other.trx), materialized(other.materialized), hasCopied(other.hasCopied) {
|
||||
// reset other
|
||||
other.hasCopied = false;
|
||||
// cppcheck-suppress *
|
||||
other.materialized = AqlValue();
|
||||
}
|
||||
|
||||
|
|
|
@ -62,6 +62,8 @@ int SingletonBlock::initializeCursor(AqlItemBlock* items, size_t pos) {
|
|||
|
||||
_done = false;
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -190,6 +192,8 @@ bool FilterBlock::getBlock(size_t atLeast, size_t atMost) {
|
|||
}
|
||||
|
||||
return true;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -299,6 +303,8 @@ int FilterBlock::getOrSkipSome(size_t atLeast, size_t atMost, bool skipping,
|
|||
}
|
||||
}
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -326,6 +332,8 @@ bool FilterBlock::hasMore() {
|
|||
// in it.
|
||||
|
||||
return true;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -338,6 +346,8 @@ int LimitBlock::initializeCursor(AqlItemBlock* items, size_t pos) {
|
|||
_state = 0;
|
||||
_count = 0;
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -424,6 +434,8 @@ int LimitBlock::getOrSkipSome(size_t atLeast, size_t atMost, bool skipping,
|
|||
}
|
||||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -480,6 +492,8 @@ AqlItemBlock* ReturnBlock::getSome(size_t atLeast, size_t atMost) {
|
|||
res.release();
|
||||
|
||||
return stripped.release();
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -495,6 +509,8 @@ RegisterId ReturnBlock::returnInheritedResults() {
|
|||
TRI_ASSERT(it != ep->getRegisterPlan()->varInfo.end());
|
||||
|
||||
return it->second.registerId;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -503,6 +519,8 @@ int NoResultsBlock::initializeCursor(AqlItemBlock*, size_t) {
|
|||
DEBUG_BEGIN_BLOCK();
|
||||
_done = true;
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
|
|
@ -201,5 +201,7 @@ AqlItemBlock* CalculationBlock::getSome(size_t atLeast, size_t atMost) {
|
|||
// Clear out registers no longer needed later:
|
||||
clearRegisters(res.get());
|
||||
return res.release();
|
||||
|
||||
// cppcheck-suppress *
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
|
|
@ -82,6 +82,8 @@ int GatherBlock::initialize() {
|
|||
DEBUG_BEGIN_BLOCK();
|
||||
_atDep = 0;
|
||||
return ExecutionBlock::initialize();
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -110,6 +112,8 @@ int GatherBlock::shutdown(int errorCode) {
|
|||
}
|
||||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -144,6 +148,8 @@ int GatherBlock::initializeCursor(AqlItemBlock* items, size_t pos) {
|
|||
|
||||
_done = false;
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -159,6 +165,8 @@ int64_t GatherBlock::count() const {
|
|||
sum += x->count();
|
||||
}
|
||||
return sum;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -174,6 +182,8 @@ int64_t GatherBlock::remaining() {
|
|||
sum += x->remaining();
|
||||
}
|
||||
return sum;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -203,6 +213,8 @@ bool GatherBlock::hasMore() {
|
|||
}
|
||||
_done = true;
|
||||
return false;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -308,6 +320,8 @@ AqlItemBlock* GatherBlock::getSome(size_t atLeast, size_t atMost) {
|
|||
}
|
||||
|
||||
return res.release();
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -379,6 +393,8 @@ size_t GatherBlock::skipSome(size_t atLeast, size_t atMost) {
|
|||
}
|
||||
|
||||
return skipped;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -400,6 +416,8 @@ bool GatherBlock::getBlock(size_t i, size_t atLeast, size_t atMost) {
|
|||
}
|
||||
|
||||
return false;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -461,6 +479,7 @@ int BlockWithClients::initializeCursor(AqlItemBlock* items, size_t pos) {
|
|||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -471,6 +490,8 @@ int BlockWithClients::shutdown(int errorCode) {
|
|||
_doneForClient.clear();
|
||||
|
||||
return ExecutionBlock::shutdown(errorCode);
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -510,6 +531,8 @@ size_t BlockWithClients::skipSomeForShard(size_t atLeast, size_t atMost,
|
|||
THROW_ARANGO_EXCEPTION(out);
|
||||
}
|
||||
return skipped;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -526,6 +549,8 @@ bool BlockWithClients::skipForShard(size_t number, std::string const& shardId) {
|
|||
return true;
|
||||
}
|
||||
return !hasMoreForShard(shardId);
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -544,6 +569,8 @@ size_t BlockWithClients::getClientId(std::string const& shardId) {
|
|||
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, message);
|
||||
}
|
||||
return ((*it).second);
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -563,6 +590,8 @@ int ScatterBlock::initializeCursor(AqlItemBlock* items, size_t pos) {
|
|||
_posForClient.emplace_back(std::make_pair(0, 0));
|
||||
}
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -578,6 +607,8 @@ int ScatterBlock::shutdown(int errorCode) {
|
|||
_posForClient.clear();
|
||||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -601,6 +632,8 @@ bool ScatterBlock::hasMoreForShard(std::string const& shardId) {
|
|||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -628,6 +661,8 @@ int64_t ScatterBlock::remainingForShard(std::string const& shardId) {
|
|||
}
|
||||
|
||||
return sum;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -693,6 +728,8 @@ int ScatterBlock::getOrSkipSomeForShard(size_t atLeast, size_t atMost,
|
|||
}
|
||||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -746,6 +783,8 @@ int DistributeBlock::initializeCursor(AqlItemBlock* items, size_t pos) {
|
|||
}
|
||||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -761,6 +800,8 @@ int DistributeBlock::shutdown(int errorCode) {
|
|||
_distBuffer.clear();
|
||||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -782,6 +823,8 @@ bool DistributeBlock::hasMoreForShard(std::string const& shardId) {
|
|||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -873,6 +916,8 @@ int DistributeBlock::getOrSkipSomeForShard(size_t atLeast, size_t atMost,
|
|||
// _buffer is left intact, deleted and cleared at shutdown
|
||||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -921,6 +966,8 @@ bool DistributeBlock::getBlockForClient(size_t atLeast, size_t atMost,
|
|||
}
|
||||
|
||||
return true;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -1038,6 +1085,8 @@ size_t DistributeBlock::sendToClient(AqlItemBlock* cur) {
|
|||
TRI_ASSERT(!shardId.empty());
|
||||
|
||||
return getClientId(shardId);
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -1113,6 +1162,8 @@ static bool throwExceptionAfterBadSyncRequest(ClusterCommResult* res,
|
|||
}
|
||||
|
||||
return false;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -1170,6 +1221,8 @@ std::unique_ptr<ClusterCommResult> RemoteBlock::sendRequest(
|
|||
}
|
||||
|
||||
return result;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -1199,6 +1252,8 @@ int RemoteBlock::initialize() {
|
|||
return slice.get("code").getNumericValue<int>();
|
||||
}
|
||||
return TRI_ERROR_INTERNAL;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -1251,6 +1306,8 @@ int RemoteBlock::initializeCursor(AqlItemBlock* items, size_t pos) {
|
|||
}
|
||||
return TRI_ERROR_INTERNAL;
|
||||
}
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -1298,6 +1355,8 @@ int RemoteBlock::shutdown(int errorCode) {
|
|||
return slice.get("code").getNumericValue<int>();
|
||||
}
|
||||
return TRI_ERROR_INTERNAL;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -1333,6 +1392,8 @@ AqlItemBlock* RemoteBlock::getSome(size_t atLeast, size_t atMost) {
|
|||
}
|
||||
|
||||
return new arangodb::aql::AqlItemBlock(responseBody);
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -1369,6 +1430,8 @@ size_t RemoteBlock::skipSome(size_t atLeast, size_t atMost) {
|
|||
}
|
||||
return skipped;
|
||||
}
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -1394,6 +1457,8 @@ bool RemoteBlock::hasMore() {
|
|||
hasMore = slice.get("hasMore").getBoolean();
|
||||
}
|
||||
return hasMore;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -1420,6 +1485,8 @@ int64_t RemoteBlock::count() const {
|
|||
count = slice.get("count").getNumericValue<int64_t>();
|
||||
}
|
||||
return count;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -1447,5 +1514,7 @@ int64_t RemoteBlock::remaining() {
|
|||
remaining = slice.get("remaining").getNumericValue<int64_t>();
|
||||
}
|
||||
return remaining;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
|
|
@ -71,6 +71,8 @@ bool EnumerateCollectionBlock::skipDocuments(size_t toSkip, size_t& skipped) {
|
|||
}
|
||||
// _scanner might have more elements
|
||||
return true;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -103,6 +105,8 @@ bool EnumerateCollectionBlock::moreDocuments(size_t hint) {
|
|||
_engine->_stats.scannedFull += static_cast<int64_t>(count);
|
||||
|
||||
return true;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -112,6 +116,8 @@ int EnumerateCollectionBlock::initialize() {
|
|||
_mustStoreResult = ep->isVarUsedLater(ep->_outVariable);
|
||||
|
||||
return ExecutionBlock::initialize();
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -129,6 +135,8 @@ int EnumerateCollectionBlock::initializeCursor(AqlItemBlock* items,
|
|||
DEBUG_END_BLOCK();
|
||||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -218,6 +226,8 @@ AqlItemBlock* EnumerateCollectionBlock::getSome(size_t, // atLeast,
|
|||
clearRegisters(res.get());
|
||||
|
||||
return res.release();
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -278,5 +288,7 @@ size_t EnumerateCollectionBlock::skipSome(size_t atLeast, size_t atMost) {
|
|||
}
|
||||
// We skipped atLeast documents
|
||||
return skipped;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
|
|
@ -201,6 +201,8 @@ int IndexBlock::initialize() {
|
|||
}
|
||||
|
||||
return res;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -304,6 +306,8 @@ bool IndexBlock::initIndexes() {
|
|||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -409,6 +413,8 @@ bool IndexBlock::readIndex(size_t atMost) {
|
|||
}
|
||||
_posInDocs = 0;
|
||||
return (!_documents.empty());
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -425,6 +431,8 @@ int IndexBlock::initializeCursor(AqlItemBlock* items, size_t pos) {
|
|||
_posInDocs = 0;
|
||||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -523,6 +531,8 @@ AqlItemBlock* IndexBlock::getSome(size_t atLeast, size_t atMost) {
|
|||
// Clear out registers no longer needed later:
|
||||
clearRegisters(res.get());
|
||||
return res.release();
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -583,6 +593,8 @@ size_t IndexBlock::skipSome(size_t atLeast, size_t atMost) {
|
|||
}
|
||||
|
||||
return skipped;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
|
|
@ -442,6 +442,8 @@ int ShortestPathBlock::initialize() {
|
|||
}
|
||||
|
||||
return res;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -629,6 +631,8 @@ AqlItemBlock* ShortestPathBlock::getSome(size_t, size_t atMost) {
|
|||
// Clear out registers no longer needed later:
|
||||
clearRegisters(res.get());
|
||||
return res.release();
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
|
|
@ -62,6 +62,8 @@ int SortBlock::initializeCursor(AqlItemBlock* items, size_t pos) {
|
|||
_pos = 0;
|
||||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
|
|
@ -113,6 +113,8 @@ AqlItemBlock* SubqueryBlock::getSome(size_t atLeast, size_t atMost) {
|
|||
// Clear out registers no longer needed later:
|
||||
clearRegisters(res.get());
|
||||
return res.release();
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
|
|
@ -149,6 +149,8 @@ int TraversalBlock::initialize() {
|
|||
}
|
||||
|
||||
return res;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -188,6 +190,8 @@ int TraversalBlock::shutdown(int errorCode) {
|
|||
}
|
||||
|
||||
return ExecutionBlock::shutdown(errorCode);
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -236,6 +240,8 @@ bool TraversalBlock::morePaths(size_t hint) {
|
|||
_engine->_stats.scannedIndex += _traverser->getAndResetReadDocuments();
|
||||
_engine->_stats.filtered += _traverser->getAndResetFilteredPaths();
|
||||
return !_vertices.empty();
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -248,6 +254,8 @@ size_t TraversalBlock::skipPaths(size_t hint) {
|
|||
return 0;
|
||||
}
|
||||
return _traverser->skip(hint);
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -303,6 +311,8 @@ void TraversalBlock::initializePaths(AqlItemBlock const* items, size_t pos) {
|
|||
}
|
||||
}
|
||||
initializeExpressions(items, pos);
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -398,6 +408,8 @@ AqlItemBlock* TraversalBlock::getSome(size_t, // atLeast,
|
|||
// Clear out registers no longer needed later:
|
||||
clearRegisters(res.get());
|
||||
return res.release();
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
||||
|
@ -442,5 +454,7 @@ size_t TraversalBlock::skipSome(size_t atLeast, size_t atMost) {
|
|||
_posInPaths += atMost;
|
||||
// Skip the next atMost many paths.
|
||||
return atMost;
|
||||
|
||||
// cppcheck-suppress style
|
||||
DEBUG_END_BLOCK();
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ class RestHandlerFactory {
|
|||
typedef bool (*context_fptr)(GeneralRequest*, void*);
|
||||
|
||||
public:
|
||||
// cppcheck-suppress *
|
||||
RestHandlerFactory(context_fptr, void*);
|
||||
|
||||
public:
|
||||
|
|
|
@ -303,19 +303,18 @@ void GeoIndexFreePot(GeoIx* gix, int pot) {
|
|||
/* needed) before it gets too far into things. */
|
||||
/* =================================================== */
|
||||
int GeoIndexNewPot(GeoIx* gix) {
|
||||
int newpotct, j;
|
||||
long long x, y;
|
||||
int j;
|
||||
GeoPot* gp;
|
||||
if (gix->pots[0].LorLeaf == 0) {
|
||||
/* do the growth calculation in long long to make sure it doesn't */
|
||||
/* overflow when the size gets to be near 2^31 */
|
||||
x = gix->potct;
|
||||
y = 100 + GeoIndexGROW;
|
||||
long long x = gix->potct;
|
||||
long long y = 100 + GeoIndexGROW;
|
||||
x = x * y + 99;
|
||||
y = 100;
|
||||
x = x / y;
|
||||
if (x > 1000000000L) return -2;
|
||||
newpotct = (int)x;
|
||||
int newpotct = (int)x;
|
||||
gp = static_cast<GeoPot*>(TRI_Reallocate(TRI_UNKNOWN_MEM_ZONE, gix->pots,
|
||||
newpotct * sizeof(GeoPot)));
|
||||
|
||||
|
@ -360,7 +359,6 @@ int GeoIndexNewPot(GeoIx* gix) {
|
|||
GeoIdx* GeoIndex_new(void) {
|
||||
GeoIx* gix;
|
||||
int i, j;
|
||||
double lat, lon, x, y, z;
|
||||
|
||||
gix = static_cast<GeoIx*>(
|
||||
TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(GeoIx), false));
|
||||
|
@ -417,8 +415,8 @@ GeoIdx* GeoIndex_new(void) {
|
|||
/* set up the fixed points structure */
|
||||
|
||||
for (i = 0; i < GeoIndexFIXEDPOINTS; i++) {
|
||||
lat = 90.0;
|
||||
lon = 0.0;
|
||||
double lat = 90.0;
|
||||
double lon = 0.0;
|
||||
#if GeoIndexFIXEDSET == 2
|
||||
if (i == 1) {
|
||||
lat = -90.0;
|
||||
|
@ -520,9 +518,9 @@ GeoIdx* GeoIndex_new(void) {
|
|||
}
|
||||
#endif
|
||||
|
||||
z = sin(lat * M_PI / 180.0);
|
||||
x = cos(lat * M_PI / 180.0) * cos(lon * M_PI / 180.0);
|
||||
y = cos(lat * M_PI / 180.0) * sin(lon * M_PI / 180.0);
|
||||
double z = sin(lat * M_PI / 180.0);
|
||||
double x = cos(lat * M_PI / 180.0) * cos(lon * M_PI / 180.0);
|
||||
double y = cos(lat * M_PI / 180.0) * sin(lon * M_PI / 180.0);
|
||||
(gix->fixed.x)[i] = x;
|
||||
(gix->fixed.y)[i] = y;
|
||||
(gix->fixed.z)[i] = z;
|
||||
|
@ -589,7 +587,7 @@ GeoString GeoMkHilbert(GeoCoordinate* c) {
|
|||
double xx1, yy1;
|
||||
GeoString z;
|
||||
int x, y;
|
||||
int i, nz, temp;
|
||||
int i, temp;
|
||||
yy1 = c->latitude + 90.0;
|
||||
z = 0;
|
||||
xx1 = c->longitude;
|
||||
|
@ -601,7 +599,7 @@ GeoString GeoMkHilbert(GeoCoordinate* c) {
|
|||
y = (int)(yy1 * STRINGPERDEGREE);
|
||||
for (i = 0; i < 26; i++) {
|
||||
z <<= 2;
|
||||
nz = ((y >> 24) & 2) + (x >> 25);
|
||||
int nz = ((y >> 24) & 2) + (x >> 25);
|
||||
x = (x << 1) & (HILBERTMAX);
|
||||
y = (y << 1) & (HILBERTMAX);
|
||||
if (nz == 0) {
|
||||
|
@ -652,8 +650,6 @@ GeoString GeoMkHilbert(GeoCoordinate* c) {
|
|||
void GeoMkDetail(GeoIx* gix, GeoDetailedPoint* gd, GeoCoordinate* c) {
|
||||
/* entire routine takes about 0.94 microseconds */
|
||||
/* math.h under MacOS defines y1 and j1 as global variable */
|
||||
double xx1, yy1, z1, snmd;
|
||||
int i;
|
||||
gd->gix = gix;
|
||||
gd->gc = c;
|
||||
/* The GeoString computation takes about 0.17 microseconds */
|
||||
|
@ -663,11 +659,11 @@ void GeoMkDetail(GeoIx* gix, GeoDetailedPoint* gd, GeoCoordinate* c) {
|
|||
gd->x = cos(c->latitude * M_PI / 180.0) * cos(c->longitude * M_PI / 180.0);
|
||||
gd->y = cos(c->latitude * M_PI / 180.0) * sin(c->longitude * M_PI / 180.0);
|
||||
/* And this bit takes about 0.45 microseconds */
|
||||
for (i = 0; i < GeoIndexFIXEDPOINTS; i++) {
|
||||
xx1 = (gix->fixed.x)[i];
|
||||
yy1 = (gix->fixed.y)[i];
|
||||
z1 = (gix->fixed.z)[i];
|
||||
snmd = (xx1 - gd->x) * (xx1 - gd->x) + (yy1 - gd->y) * (yy1 - gd->y) +
|
||||
for (int i = 0; i < GeoIndexFIXEDPOINTS; i++) {
|
||||
double xx1 = (gix->fixed.x)[i];
|
||||
double yy1 = (gix->fixed.y)[i];
|
||||
double z1 = (gix->fixed.z)[i];
|
||||
double snmd = (xx1 - gd->x) * (xx1 - gd->x) + (yy1 - gd->y) * (yy1 - gd->y) +
|
||||
(z1 - gd->z) * (z1 - gd->z);
|
||||
(gd->fixdist)[i] = (GeoFix)(asin(sqrt(snmd) / 2.0) * ARCSINFIX);
|
||||
}
|
||||
|
@ -842,13 +838,13 @@ void GeoResultsStartCount(GeoResults* gr) {
|
|||
/* =================================================== */
|
||||
void GeoResultsInsertPoint(GeoResults* gr, int slot, double snmd) {
|
||||
/* math.h under MacOS defines y1 and j1 as global variable */
|
||||
int i, jj1, jj2, temp;
|
||||
int i, temp;
|
||||
if (snmd >= gr->snmd[0]) return;
|
||||
if (gr->slot[0] == 0) gr->pointsct++;
|
||||
i = 0; /* i is now considered empty */
|
||||
while (1) {
|
||||
jj1 = 2 * i + 1;
|
||||
jj2 = 2 * i + 2;
|
||||
int jj1 = 2 * i + 1;
|
||||
int jj2 = 2 * i + 2;
|
||||
if (jj1 < gr->allocpoints) {
|
||||
if (jj2 < gr->allocpoints) {
|
||||
if (gr->snmd[jj1] > gr->snmd[jj2]) {
|
||||
|
@ -934,7 +930,7 @@ int GeoResultsGrow(GeoResults* gr) {
|
|||
GeoCoordinates* GeoAnswers(GeoIx* gix, GeoResults* gr) {
|
||||
GeoCoordinates* ans;
|
||||
GeoCoordinate* gc;
|
||||
int i, j, slot;
|
||||
int i, j;
|
||||
double mole;
|
||||
|
||||
if (gr->pointsct == 0) {
|
||||
|
@ -966,7 +962,7 @@ GeoCoordinates* GeoAnswers(GeoIx* gix, GeoResults* gr) {
|
|||
j = 0;
|
||||
for (i = 0; i < gr->allocpoints; i++) {
|
||||
if (j >= gr->pointsct) break;
|
||||
slot = gr->slot[i];
|
||||
int slot = gr->slot[i];
|
||||
if (slot == 0) continue;
|
||||
ans->coordinates[j].latitude = (gix->gc)[slot].latitude;
|
||||
ans->coordinates[j].longitude = (gix->gc)[slot].longitude;
|
||||
|
@ -1054,7 +1050,7 @@ GeoCoordinates* GeoIndex_PointsWithinRadius(GeoIdx* gi, GeoCoordinate* c,
|
|||
GeoDetailedPoint gd;
|
||||
GeoStack gk;
|
||||
GeoPot* gp;
|
||||
int r, pot, slot, i;
|
||||
int r, slot, i;
|
||||
double snmd, maxsnmd;
|
||||
GeoIx* gix;
|
||||
if (c->longitude < -180.0) return NULL;
|
||||
|
@ -1071,7 +1067,7 @@ GeoCoordinates* GeoIndex_PointsWithinRadius(GeoIdx* gi, GeoCoordinate* c,
|
|||
gk.stacksize++;
|
||||
while (gk.stacksize >= 1) {
|
||||
gk.stacksize--;
|
||||
pot = gk.potid[gk.stacksize];
|
||||
int pot = gk.potid[gk.stacksize];
|
||||
if (GeoPotJunk(&gd, pot)) continue;
|
||||
gp = gix->pots + pot;
|
||||
if (gp->LorLeaf == 0) {
|
||||
|
@ -1119,7 +1115,7 @@ GeoCoordinates* GeoIndex_NearestCountPoints(GeoIdx* gi, GeoCoordinate* c,
|
|||
GeoCoordinates* answer;
|
||||
GeoStack gk;
|
||||
GeoPot* gp;
|
||||
int pot, slot, i, left;
|
||||
int slot, i, left;
|
||||
double snmd;
|
||||
GeoIx* gix;
|
||||
if (c->longitude < -180.0) return NULL;
|
||||
|
@ -1136,7 +1132,7 @@ GeoCoordinates* GeoIndex_NearestCountPoints(GeoIdx* gi, GeoCoordinate* c,
|
|||
left = count;
|
||||
|
||||
while (gk.stacksize >= 0) {
|
||||
pot = gk.potid[gk.stacksize--];
|
||||
int pot = gk.potid[gk.stacksize--];
|
||||
gp = gix->pots + pot;
|
||||
if (left <= 0) {
|
||||
GeoSetDistance(&gd, gr->snmd[0]);
|
||||
|
@ -1187,19 +1183,18 @@ void GeoIndexFreeSlot(GeoIx* gix, int slot) {
|
|||
/* added to the index. */
|
||||
/* =================================================== */
|
||||
int GeoIndexNewSlot(GeoIx* gix) {
|
||||
int newslotct, j;
|
||||
long long x, y;
|
||||
int j;
|
||||
GeoCoordinate* gc;
|
||||
if (gix->gc[0].latitude == 0.0) {
|
||||
/* do the growth calculation in long long to make sure it doesn't */
|
||||
/* overflow when the size gets to be near 2^31 */
|
||||
x = gix->slotct;
|
||||
y = 100 + GeoIndexGROW;
|
||||
long long x = gix->slotct;
|
||||
long long y = 100 + GeoIndexGROW;
|
||||
x = x * y + 99;
|
||||
y = 100;
|
||||
x = x / y;
|
||||
if (x > 2000000000L) return -2;
|
||||
newslotct = (int)x;
|
||||
int newslotct = (int)x;
|
||||
gc = static_cast<GeoCoordinate*>(TRI_Reallocate(
|
||||
TRI_UNKNOWN_MEM_ZONE, gix->gc, newslotct * sizeof(GeoCoordinate)));
|
||||
|
||||
|
@ -1438,9 +1433,9 @@ void RotateRight(GeoIx* gix, int pote) {
|
|||
/* two new pots. . . continued below */
|
||||
/* =================================================== */
|
||||
int GeoIndex_insert(GeoIdx* gi, GeoCoordinate* c) {
|
||||
int i, j, js, slot, pot, pot1, pot2;
|
||||
int potx, pota, poty, potz;
|
||||
int lvx, lv1, lva, lvy, lvz;
|
||||
int i, j, slot, pot, pot1;
|
||||
int pota, poty, potz;
|
||||
int lva, lvy, lvz;
|
||||
int height, rebalance;
|
||||
GeoDetailedPoint gd;
|
||||
GeoPath gt;
|
||||
|
@ -1452,7 +1447,6 @@ int GeoIndex_insert(GeoIdx* gi, GeoCoordinate* c) {
|
|||
GeoPot* gpz;
|
||||
GeoPot* gpa;
|
||||
GeoString gsa[2];
|
||||
GeoString mings, gs;
|
||||
GeoIx* gix;
|
||||
gix = (GeoIx*)gi;
|
||||
rebalance = 0;
|
||||
|
@ -1476,7 +1470,7 @@ int GeoIndex_insert(GeoIdx* gi, GeoCoordinate* c) {
|
|||
if (gp->RorPoints == GeoIndexPOTSIZE) {
|
||||
rebalance = 1;
|
||||
pot1 = GeoIndexNewPot(gix);
|
||||
pot2 = GeoIndexNewPot(gix);
|
||||
int pot2 = GeoIndexNewPot(gix);
|
||||
gp = gix->pots + pot; /* may have re-alloced! */
|
||||
if ((pot1 == -2) || (pot2 == -2)) {
|
||||
GeoIndexFreeSlot(gix, slot);
|
||||
|
@ -1510,11 +1504,12 @@ int GeoIndex_insert(GeoIdx* gi, GeoCoordinate* c) {
|
|||
gp2->RorPoints = gp->RorPoints;
|
||||
for (i = 0; i < gp->RorPoints; i++) gp2->points[i] = gp->points[i];
|
||||
/* move the first half of the points from pot2 to pot1 */
|
||||
GeoString mings;
|
||||
for (i = 0; i < (GeoIndexPOTSIZE / 2); i++) {
|
||||
mings = 0x1FFFFFFFFFFFFFll;
|
||||
js = 0;
|
||||
int js = 0;
|
||||
for (j = 0; j < gp2->RorPoints; j++) {
|
||||
gs = GeoMkHilbert(gix->gc + gp2->points[j]);
|
||||
GeoString gs = GeoMkHilbert(gix->gc + gp2->points[j]);
|
||||
if (gs < mings) {
|
||||
mings = gs;
|
||||
js = j;
|
||||
|
@ -1578,15 +1573,15 @@ int GeoIndex_insert(GeoIdx* gi, GeoCoordinate* c) {
|
|||
/* just need to balance the tree */
|
||||
if (rebalance == 0) return 0;
|
||||
height = 2;
|
||||
while (1) {
|
||||
potx = GeoGetPot(>, height);
|
||||
while (true) {
|
||||
int potx = GeoGetPot(>, height);
|
||||
gpx = gix->pots + potx;
|
||||
lvx = gpx->level;
|
||||
int lvx = gpx->level;
|
||||
if (potx == 1) break;
|
||||
/* root pot ? */
|
||||
pot1 = GeoGetPot(>, height + 1); /* pot1=parent(x) */
|
||||
gp1 = gix->pots + pot1;
|
||||
lv1 = gp1->level;
|
||||
int lv1 = gp1->level;
|
||||
if (lv1 > lvx) break;
|
||||
if (gp1->LorLeaf == potx) /* gpx is the left child? */
|
||||
{
|
||||
|
@ -1664,7 +1659,7 @@ int GeoIndex_insert(GeoIdx* gi, GeoCoordinate* c) {
|
|||
int GeoIndex_remove(GeoIdx* gi, GeoCoordinate* c) {
|
||||
GeoDetailedPoint gd;
|
||||
int rebalance;
|
||||
int lev, levp, levb, levn, levc;
|
||||
int levn, levc;
|
||||
GeoPot* gp;
|
||||
int potp;
|
||||
GeoPot* gpp;
|
||||
|
@ -1676,8 +1671,7 @@ int GeoIndex_remove(GeoIdx* gi, GeoCoordinate* c) {
|
|||
GeoPot* gpc;
|
||||
GeoPath gt;
|
||||
GeoString gsa[2];
|
||||
int i, j, js, pot, potix, slot, pathix;
|
||||
GeoString mings, gs;
|
||||
int i, pot, potix, slot, pathix;
|
||||
GeoIx* gix;
|
||||
if (c->longitude < -180.0) return -3;
|
||||
if (c->longitude > 180.0) return -3;
|
||||
|
@ -1698,6 +1692,8 @@ int GeoIndex_remove(GeoIdx* gi, GeoCoordinate* c) {
|
|||
if (pot == 1) return 0; /* just allow root pot to have fewer points */
|
||||
rebalance = 0;
|
||||
if ((2 * gp->RorPoints) < GeoIndexPOTSIZE) {
|
||||
int j, js;
|
||||
GeoString mings, gs;
|
||||
potp = gt.path[gt.pathlength - 2];
|
||||
gpp = gix->pots + potp;
|
||||
if (gpp->LorLeaf == pot) {
|
||||
|
@ -1901,13 +1897,13 @@ int GeoIndex_remove(GeoIdx* gi, GeoCoordinate* c) {
|
|||
pathix--;
|
||||
potp = gt.path[pathix];
|
||||
gpp = gix->pots + potp;
|
||||
levp = gpp->level;
|
||||
int levp = gpp->level;
|
||||
pot = gpp->LorLeaf;
|
||||
potb = gpp->RorPoints;
|
||||
gp = gix->pots + pot;
|
||||
gpb = gix->pots + potb;
|
||||
lev = gp->level;
|
||||
levb = gpb->level;
|
||||
int lev = gp->level;
|
||||
int levb = gpb->level;
|
||||
i = (levp - lev) * (levp - levb);
|
||||
if (i == 4) {
|
||||
gpp->level--;
|
||||
|
@ -1995,9 +1991,7 @@ typedef struct {
|
|||
GeoFix dist;
|
||||
} hpot; // pot for putting on the heap
|
||||
|
||||
bool hpotcompare(hpot a, hpot b) {
|
||||
return (a.dist > b.dist);
|
||||
}
|
||||
bool hpotcompare(hpot a, hpot b) { return (a.dist > b.dist); }
|
||||
|
||||
typedef struct {
|
||||
int slot;
|
||||
|
@ -2043,11 +2037,11 @@ GeoCursor* GeoIndex_NewCursor(GeoIdx* gi, GeoCoordinate* c) {
|
|||
if (c->latitude > 90.0) return nullptr;
|
||||
gix = (GeoIx*)gi;
|
||||
GeoCr* gcr = nullptr;
|
||||
|
||||
|
||||
try {
|
||||
gcr = new GeoCr;
|
||||
} catch (...) {
|
||||
}
|
||||
catch (...) { }
|
||||
|
||||
if (gcr == nullptr) {
|
||||
return (GeoCursor*)gcr;
|
||||
|
@ -2167,7 +2161,6 @@ void GeoIndex_CursorFree(GeoCursor* gc) {
|
|||
void RecursivePotDump(GeoIx* gix, FILE* f, int pot) {
|
||||
int i;
|
||||
GeoPot* gp;
|
||||
GeoCoordinate* gc;
|
||||
gp = gix->pots + pot;
|
||||
fprintf(f, "GP. pot %d level %d Kids %d %d\n", pot, gp->level, gp->LorLeaf,
|
||||
gp->RorPoints);
|
||||
|
@ -2179,7 +2172,7 @@ void RecursivePotDump(GeoIx* gix, FILE* f, int pot) {
|
|||
fprintf(f, "Leaf pot containing %d points . . .\n", gp->RorPoints);
|
||||
for (i = 0; i < gp->RorPoints; i++) {
|
||||
fprintf(f, "Child %d Point %d ", i, gp->points[i]);
|
||||
gc = gix->gc + gp->points[i];
|
||||
GeoCoordinate* gc = gix->gc + gp->points[i];
|
||||
fprintf(f, "Lat. %9.4f, Long. %9.4f", gc->latitude, gc->longitude);
|
||||
#if TRI_GEO_DEBUG == 2
|
||||
fprintf(f, " %s", (char*)gc->data);
|
||||
|
@ -2206,10 +2199,8 @@ int RecursivePotValidate(GeoIx* gix, int pot, int* usage) {
|
|||
int i, j;
|
||||
GeoPot* gp;
|
||||
GeoDetailedPoint gd;
|
||||
int pota, potb;
|
||||
int lev, leva;
|
||||
GeoFix maxdist[GeoIndexFIXEDPOINTS];
|
||||
GeoPot* gpa, *gpb;
|
||||
GeoPot *gpa, *gpb;
|
||||
gp = gix->pots + pot;
|
||||
usage[0]++;
|
||||
if (gp->LorLeaf == 0) {
|
||||
|
@ -2228,15 +2219,13 @@ int RecursivePotValidate(GeoIx* gix, int pot, int* usage) {
|
|||
usage[1] += gp->RorPoints;
|
||||
return 0;
|
||||
} else {
|
||||
int levb;
|
||||
|
||||
pota = gp->LorLeaf;
|
||||
potb = gp->RorPoints;
|
||||
int pota = gp->LorLeaf;
|
||||
int potb = gp->RorPoints;
|
||||
gpa = gix->pots + pota;
|
||||
gpb = gix->pots + potb;
|
||||
lev = gp->level;
|
||||
leva = gpa->level;
|
||||
levb = gpb->level;
|
||||
int lev = gp->level;
|
||||
int leva = gpa->level;
|
||||
int levb = gpb->level;
|
||||
if (leva >= lev) return 2;
|
||||
if (levb >= lev) return 3;
|
||||
i = (lev - leva) * (lev - levb);
|
||||
|
|
|
@ -1433,6 +1433,7 @@ int ContinuousSyncer::followMasterLog(std::string& errorMsg,
|
|||
res = applyLog(response.get(), firstRegularTick, errorMsg, processedMarkers,
|
||||
ignoreCount);
|
||||
|
||||
// cppcheck-suppress *
|
||||
if (processedMarkers > 0) {
|
||||
worked = true;
|
||||
|
||||
|
|
|
@ -209,6 +209,7 @@ bool ListenTask::handleEvent(EventToken token, EventType revents) {
|
|||
inet_ntop(AF_INET, &addr->sin_addr, buf, sizeof(buf) - 1);
|
||||
|
||||
if (p != nullptr) {
|
||||
// cppcheck-suppress *
|
||||
buf[INET_ADDRSTRLEN] = '\0';
|
||||
info.clientAddress = p;
|
||||
}
|
||||
|
@ -220,6 +221,7 @@ bool ListenTask::handleEvent(EventToken token, EventType revents) {
|
|||
inet_ntop(AF_INET6, &addrmem.sin6_addr, buf, sizeof(buf) - 1);
|
||||
|
||||
if (p != nullptr) {
|
||||
// cppcheck-suppress *
|
||||
buf[INET6_ADDRSTRLEN] = '\0';
|
||||
info.clientAddress = p;
|
||||
}
|
||||
|
@ -235,6 +237,7 @@ bool ListenTask::handleEvent(EventToken token, EventType revents) {
|
|||
inet_ntop(AF_INET, &addr_out->sin_addr, buf, sizeof(buf) - 1);
|
||||
|
||||
if (p != nullptr) {
|
||||
// cppcheck-suppress *
|
||||
buf[INET_ADDRSTRLEN] = '\0';
|
||||
info.serverAddress = p;
|
||||
}
|
||||
|
@ -246,6 +249,7 @@ bool ListenTask::handleEvent(EventToken token, EventType revents) {
|
|||
inet_ntop(AF_INET6, &addr_out_mem.sin6_addr, buf, sizeof(buf) - 1);
|
||||
|
||||
if (p != nullptr) {
|
||||
// cppcheck-suppress *
|
||||
buf[INET6_ADDRSTRLEN] = '\0';
|
||||
info.serverAddress = p;
|
||||
}
|
||||
|
|
|
@ -799,6 +799,7 @@ static void JS_DocumentVocbaseCol(
|
|||
static void DropVocbaseColCoordinator(
|
||||
v8::FunctionCallbackInfo<v8::Value> const& args,
|
||||
arangodb::LogicalCollection* collection) {
|
||||
// cppcheck-suppress *
|
||||
v8::Isolate* isolate = args.GetIsolate();
|
||||
|
||||
if (collection->isSystem()) {
|
||||
|
@ -878,6 +879,8 @@ static void JS_ExistsVocbaseVPack(
|
|||
v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
||||
return ExistsVocbaseVPack(true, args);
|
||||
|
||||
// cppcheck-suppress style
|
||||
TRI_V8_TRY_CATCH_END
|
||||
}
|
||||
|
||||
|
@ -1299,6 +1302,8 @@ static void JS_RemoveVocbaseCol(
|
|||
v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
||||
return RemoveVocbaseCol(args);
|
||||
|
||||
// cppcheck-suppress style
|
||||
TRI_V8_TRY_CATCH_END
|
||||
}
|
||||
|
||||
|
@ -2670,6 +2675,8 @@ static void JS_CompletionsVocbase(
|
|||
static void JS_RemoveVocbase(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
||||
return RemoveVocbase(args);
|
||||
|
||||
// cppcheck-suppress style
|
||||
TRI_V8_TRY_CATCH_END
|
||||
}
|
||||
|
||||
|
@ -2691,6 +2698,8 @@ static void JS_DocumentVocbase(
|
|||
static void JS_ExistsVocbase(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
||||
return ExistsVocbaseVPack(false, args);
|
||||
|
||||
// cppcheck-suppress style
|
||||
TRI_V8_TRY_CATCH_END
|
||||
}
|
||||
|
||||
|
|
|
@ -434,6 +434,8 @@ static void JS_ChecksumCollection(
|
|||
static void JS_EdgesQuery(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
||||
return EdgesQuery(TRI_EDGE_ANY, args);
|
||||
|
||||
// cppcheck-suppress *
|
||||
TRI_V8_TRY_CATCH_END
|
||||
}
|
||||
|
||||
|
@ -444,6 +446,8 @@ static void JS_EdgesQuery(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
static void JS_InEdgesQuery(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
||||
return EdgesQuery(TRI_EDGE_IN, args);
|
||||
|
||||
// cppcheck-suppress *
|
||||
TRI_V8_TRY_CATCH_END
|
||||
}
|
||||
|
||||
|
@ -454,6 +458,8 @@ static void JS_InEdgesQuery(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
static void JS_OutEdgesQuery(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
||||
return EdgesQuery(TRI_EDGE_OUT, args);
|
||||
|
||||
// cppcheck-suppress *
|
||||
TRI_V8_TRY_CATCH_END
|
||||
}
|
||||
|
||||
|
|
|
@ -1394,10 +1394,12 @@ class KeySpace {
|
|||
|
||||
TRI_ASSERT(dest != nullptr);
|
||||
|
||||
// cppcheck-suppress *
|
||||
if (!TRI_IsArrayJson(dest->json)) {
|
||||
TRI_V8_THROW_EXCEPTION(TRI_ERROR_INTERNAL);
|
||||
}
|
||||
|
||||
// cppcheck-suppress *
|
||||
TRI_PushBack2ArrayJson(dest->json, sourceItem);
|
||||
|
||||
// hack: decrease the vector size
|
||||
|
|
|
@ -208,6 +208,7 @@ void VPackFeature::start() {
|
|||
}
|
||||
|
||||
// reset stream
|
||||
// cppcheck-suppress *
|
||||
if (!toStdOut) {
|
||||
ofs.seekp(0);
|
||||
}
|
||||
|
@ -217,6 +218,7 @@ void VPackFeature::start() {
|
|||
ofs.write(start, buffer.size());
|
||||
ofs.close();
|
||||
|
||||
// cppcheck-suppress *
|
||||
if (!toStdOut) {
|
||||
std::cout << "Successfully converted JSON infile '" << _inputFile << "'"
|
||||
<< std::endl;
|
||||
|
|
|
@ -2000,7 +2000,7 @@ int TRI_Crc32File(char const* path, uint32_t* crc) {
|
|||
|
||||
if (sizeRead > 0) {
|
||||
*crc = TRI_BlockCrc32(*crc, static_cast<char const*>(buffer), sizeRead);
|
||||
} else if (sizeRead <= 0) {
|
||||
} else /* if (sizeRead <= 0) */ {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,31 +101,50 @@ typedef struct process_state_s {
|
|||
/* ld */
|
||||
long rss;
|
||||
/* lu */
|
||||
// cppcheck-suppress *
|
||||
unsigned long rsslim;
|
||||
// cppcheck-suppress *
|
||||
unsigned long startcode;
|
||||
// cppcheck-suppress *
|
||||
unsigned long endcode;
|
||||
// cppcheck-suppress *
|
||||
unsigned long startstack;
|
||||
// cppcheck-suppress *
|
||||
unsigned long kstkesp;
|
||||
// cppcheck-suppress *
|
||||
unsigned long signal;
|
||||
/* obsolete lu*/
|
||||
// cppcheck-suppress *
|
||||
unsigned long blocked;
|
||||
// cppcheck-suppress *
|
||||
unsigned long sigignore;
|
||||
// cppcheck-suppress *
|
||||
unsigned int sigcatch;
|
||||
// cppcheck-suppress *
|
||||
unsigned long wchan;
|
||||
/* no maintained lu */
|
||||
// cppcheck-suppress *
|
||||
unsigned long nswap;
|
||||
// cppcheck-suppress *
|
||||
unsigned long cnswap;
|
||||
/* d */
|
||||
// cppcheck-suppress *
|
||||
int exit_signal;
|
||||
// cppcheck-suppress *
|
||||
int processor;
|
||||
/* u */
|
||||
// cppcheck-suppress *
|
||||
unsigned rt_priority;
|
||||
// cppcheck-suppress *
|
||||
unsigned policy;
|
||||
/* llu */
|
||||
// cppcheck-suppress *
|
||||
long long unsigned int delayacct_blkio_ticks;
|
||||
/* lu */
|
||||
// cppcheck-suppress *
|
||||
unsigned long guest_time;
|
||||
/* ld */
|
||||
// cppcheck-suppress *
|
||||
long cguest_time;
|
||||
} process_state_t;
|
||||
|
||||
|
@ -699,6 +718,7 @@ TRI_process_info_t TRI_ProcessInfo(TRI_pid_t pid) {
|
|||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress *
|
||||
sscanf(str,
|
||||
"%d %s %c %d %d %d %d %d %u %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld "
|
||||
"%ld %ld %llu %lu %ld",
|
||||
|
|
|
@ -46,11 +46,13 @@ static int ExtractCurrentFile(unzFile uf, void* buffer, size_t const bufferSize,
|
|||
char* filenameWithoutPath;
|
||||
char* fullPath;
|
||||
char* p;
|
||||
FILE* fout;
|
||||
unz_file_info64 fileInfo;
|
||||
long systemError;
|
||||
int err;
|
||||
|
||||
// cppcheck-suppress *
|
||||
FILE* fout;
|
||||
|
||||
filenameInZip[0] = '\0';
|
||||
err = unzGetCurrentFileInfo64(uf, &fileInfo, filenameInZip,
|
||||
sizeof(filenameInZip), NULL, 0, NULL, 0);
|
||||
|
@ -348,7 +350,7 @@ int TRI_ZipFile(char const* filename, char const* dir,
|
|||
if (res != 0) {
|
||||
break;
|
||||
}
|
||||
} else if (sizeRead <= 0) {
|
||||
} else /* if (sizeRead <= 0) */ {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ namespace rest {
|
|||
struct VppInputMessage {
|
||||
VppInputMessage() : _buffer(), _id(0), _payloadAmount(0), _payload() {}
|
||||
|
||||
// cppcheck-suppress *
|
||||
VppInputMessage(uint64_t id, VPackBuffer<uint8_t>&& buff,
|
||||
std::size_t amount = 1)
|
||||
: _buffer(std::move(buff)), _id(id), _payloadAmount(amount) {
|
||||
|
@ -47,6 +48,7 @@ struct VppInputMessage {
|
|||
|
||||
// no copy
|
||||
VppInputMessage(VppInputMessage const& other) = delete;
|
||||
|
||||
// just move
|
||||
VppInputMessage(VppInputMessage&& other) {
|
||||
if (this == &other) {
|
||||
|
@ -94,6 +96,7 @@ struct VppInputMessage {
|
|||
};
|
||||
|
||||
struct VPackMessageNoOwnBuffer {
|
||||
// cppcheck-suppress *
|
||||
VPackMessageNoOwnBuffer(VPackSlice head, std::vector<VPackSlice>&& payloads,
|
||||
uint64_t id, bool generateBody = true)
|
||||
: _header(head),
|
||||
|
|
|
@ -182,7 +182,9 @@ static size_t ByteLengthString(v8::Isolate* isolate,
|
|||
|
||||
static void Encode(v8::FunctionCallbackInfo<v8::Value> const& args,
|
||||
const void* buf, size_t len, TRI_V8_encoding_t enc) {
|
||||
// cppcheck-suppress *
|
||||
v8::Isolate* isolate = args.GetIsolate();
|
||||
|
||||
if (enc == BUFFER) {
|
||||
TRI_V8_RETURN(TRI_V8_PAIR_STRING(static_cast<char const*>(buf), len));
|
||||
}
|
||||
|
@ -472,10 +474,8 @@ static bool IsBigEndian() {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void Swizzle(char* buf, size_t len) {
|
||||
char t;
|
||||
|
||||
for (size_t i = 0; i < len / 2; ++i) {
|
||||
t = buf[i];
|
||||
char t = buf[i];
|
||||
buf[i] = buf[len - i - 1];
|
||||
buf[len - i - 1] = t;
|
||||
}
|
||||
|
@ -764,7 +764,7 @@ bool V8Buffer::hasInstance(v8::Isolate* isolate, v8::Handle<v8::Value> val) {
|
|||
if (obj->Has(TRI_V8_ASCII_STRING("__buffer__"))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return strcmp(*v8::String::Utf8Value(obj->GetConstructorName()), "Buffer") ==
|
||||
0;
|
||||
}
|
||||
|
@ -962,7 +962,6 @@ static void JS_Base64Slice(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
|
||||
unsigned a;
|
||||
unsigned b;
|
||||
unsigned c;
|
||||
unsigned i;
|
||||
unsigned k;
|
||||
unsigned n;
|
||||
|
@ -979,7 +978,7 @@ static void JS_Base64Slice(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
while (i < n) {
|
||||
a = src[i + 0] & 0xff;
|
||||
b = src[i + 1] & 0xff;
|
||||
c = src[i + 2] & 0xff;
|
||||
unsigned c = src[i + 2] & 0xff;
|
||||
|
||||
dst[k + 0] = table[a >> 2];
|
||||
dst[k + 1] = table[((a & 3) << 4) | (b >> 4)];
|
||||
|
@ -1052,12 +1051,17 @@ static void JS_Copy(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
|
||||
V8Buffer* source = V8Buffer::unwrap(args.This());
|
||||
|
||||
if (!V8Buffer::hasInstance(isolate, args[0])) {
|
||||
TRI_V8_THROW_EXCEPTION_USAGE("copy(<buffer>, [<start>], [<end>])");
|
||||
if (source == nullptr) {
|
||||
TRI_V8_THROW_EXCEPTION_USAGE("expecting a buffer as this");
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> target = args[0];
|
||||
char* target_data = V8Buffer::data(target);
|
||||
|
||||
if (target_data == nullptr || source == nullptr || source->_data == nullptr) {
|
||||
TRI_V8_THROW_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "invalid pointer value");
|
||||
}
|
||||
|
||||
size_t target_length = V8Buffer::length(target);
|
||||
size_t target_start = args[1]->IsUndefined() ? 0 : args[1]->Uint32Value();
|
||||
size_t source_start = args[2]->IsUndefined() ? 0 : args[2]->Uint32Value();
|
||||
|
@ -1085,10 +1089,6 @@ static void JS_Copy(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
TRI_V8_THROW_RANGE_ERROR("sourceEnd out of bounds");
|
||||
}
|
||||
|
||||
if (target_data == nullptr || source == nullptr || source->_data == nullptr) {
|
||||
TRI_V8_THROW_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "invalid pointer value");
|
||||
}
|
||||
|
||||
size_t to_copy =
|
||||
MIN(MIN(source_end - source_start, target_length - target_start),
|
||||
source->_length - source_start);
|
||||
|
@ -1303,7 +1303,6 @@ static void JS_Base64Write(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
TRI_V8_THROW_TYPE_ERROR("<offset> is out of bounds");
|
||||
}
|
||||
|
||||
char a, b, c, d;
|
||||
char* start = buffer->_data + offset;
|
||||
char* dst = start;
|
||||
char* const dstEnd = dst + max_length;
|
||||
|
@ -1317,13 +1316,13 @@ static void JS_Base64Write(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
src++, remaining--;
|
||||
}
|
||||
if (remaining == 0 || *src == '=') break;
|
||||
a = unbase64(*src++);
|
||||
char a = unbase64(*src++);
|
||||
|
||||
while (unbase64(*src) < 0 && src < srcEnd) {
|
||||
src++, remaining--;
|
||||
}
|
||||
if (remaining <= 1 || *src == '=') break;
|
||||
b = unbase64(*src++);
|
||||
char b = unbase64(*src++);
|
||||
|
||||
*dst++ = (a << 2) | ((b & 0x30) >> 4);
|
||||
if (dst == dstEnd) break;
|
||||
|
@ -1332,7 +1331,7 @@ static void JS_Base64Write(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
src++, remaining--;
|
||||
}
|
||||
if (remaining <= 2 || *src == '=') break;
|
||||
c = unbase64(*src++);
|
||||
char c = unbase64(*src++);
|
||||
|
||||
*dst++ = ((b & 0x0F) << 4) | ((c & 0x3C) >> 2);
|
||||
if (dst == dstEnd) break;
|
||||
|
@ -1341,7 +1340,7 @@ static void JS_Base64Write(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
src++, remaining--;
|
||||
}
|
||||
if (remaining <= 3 || *src == '=') break;
|
||||
d = unbase64(*src++);
|
||||
char d = unbase64(*src++);
|
||||
|
||||
*dst++ = ((c & 0x03) << 6) | (d & 0x3F);
|
||||
}
|
||||
|
@ -1705,7 +1704,7 @@ void TRI_InitV8Buffer(v8::Isolate* isolate, v8::Handle<v8::Context> context) {
|
|||
|
||||
TRI_V8_AddMethod(isolate, ft, TRI_V8_ASCII_STRING("byteLength"),
|
||||
JS_ByteLength);
|
||||
|
||||
|
||||
// create the exports
|
||||
v8::Handle<v8::Object> exports = v8::Object::New(isolate);
|
||||
|
||||
|
|
|
@ -52,7 +52,9 @@ static void ProcessCsvBegin(TRI_csv_parser_t* parser, size_t row) {
|
|||
|
||||
static void ProcessCsvAdd(TRI_csv_parser_t* parser, char const* field, size_t,
|
||||
size_t row, size_t column, bool escaped) {
|
||||
// cppcheck-suppress *
|
||||
v8::Isolate* isolate = (v8::Isolate*)parser->_data;
|
||||
|
||||
v8::Handle<v8::Array>* array =
|
||||
reinterpret_cast<v8::Handle<v8::Array>*>(parser->_dataBegin);
|
||||
|
||||
|
|
|
@ -11,7 +11,12 @@ cppcheck -j4 \
|
|||
--inline-suppr \
|
||||
--suppress="*:lib/JsonParser/json-parser.cpp" \
|
||||
--suppress="*:lib/V8/v8-json.cpp" \
|
||||
--suppress="*:lib/Zip/crypt.h" \
|
||||
--suppress="*:lib/Zip/iowin32.cpp" \
|
||||
--suppress="*:lib/Zip/unzip.cpp" \
|
||||
--suppress="*:lib/Zip/zip.cpp" \
|
||||
--suppress="*:Aql/grammar.cpp" \
|
||||
--suppress="*:Aql/tokens.cpp" \
|
||||
--suppress="*:Aql/tokens.ll" \
|
||||
arangod/ arangosh/ lib/ 2>> cppcheck.tmp
|
||||
|
||||
|
|
Loading…
Reference in New Issue