mirror of https://gitee.com/bigwinds/arangodb
cppcheck
This commit is contained in:
parent
a7450eb65f
commit
279fb105e2
|
@ -61,7 +61,7 @@ class AqlItemBlock {
|
|||
|
||||
AqlItemBlock(size_t nrItems, RegisterId nrRegs);
|
||||
|
||||
AqlItemBlock(arangodb::velocypack::Slice const);
|
||||
explicit AqlItemBlock(arangodb::velocypack::Slice const);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief destroy the block
|
||||
|
|
|
@ -1208,10 +1208,10 @@ int AqlValue$::Compare(arangodb::AqlTransaction* trx, AqlValue$ const& left,
|
|||
if (left.range()->_low > right.range()->_low) {
|
||||
return 1;
|
||||
}
|
||||
if (left.range()->_high < left.range()->_high) {
|
||||
if (left.range()->_high < right.range()->_high) {
|
||||
return -1;
|
||||
}
|
||||
if (left.range()->_high > left.range()->_high) {
|
||||
if (left.range()->_high > right.range()->_high) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -197,7 +197,7 @@ class HashedCollectBlock : public ExecutionBlock {
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct GroupKeyEqual {
|
||||
GroupKeyEqual(arangodb::AqlTransaction* trx)
|
||||
explicit GroupKeyEqual(arangodb::AqlTransaction* trx)
|
||||
: _trx(trx) {}
|
||||
|
||||
bool operator()(std::vector<AqlValue$> const&,
|
||||
|
|
|
@ -42,7 +42,7 @@ class ExecutionEngine {
|
|||
/// @brief create the engine
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ExecutionEngine(Query* query);
|
||||
explicit ExecutionEngine(Query* query);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief destroy the engine, frees all assigned blocks
|
||||
|
|
|
@ -904,7 +904,7 @@ static AqlValue$ buildGeoResult(arangodb::aql::Query* query,
|
|||
std::shared_ptr<VPackBuilder> b = query->getSharedBuilder();
|
||||
try {
|
||||
VPackArrayBuilder guard(b.get());
|
||||
std::unordered_set<std::string> forbidden;
|
||||
std::unordered_set<std::string> forbidden; // TODO: this variable is unusued
|
||||
if (!attributeName.empty()) {
|
||||
// We have to copy the entire document
|
||||
for (auto& it : distances) {
|
||||
|
|
|
@ -53,7 +53,7 @@ char const* const Variable::NAME_CURRENT = "$CURRENT";
|
|||
Variable::Variable(std::string const& name, VariableId id)
|
||||
: name(name), value(nullptr), id(id) {}
|
||||
|
||||
Variable::Variable(arangodb::velocypack::Slice const slice)
|
||||
Variable::Variable(arangodb::velocypack::Slice const& slice)
|
||||
: Variable(arangodb::basics::VelocyPackHelper::checkAndGetStringValue(
|
||||
slice, "name"),
|
||||
arangodb::basics::VelocyPackHelper::checkAndGetNumericValue<
|
||||
|
|
|
@ -37,13 +37,14 @@ class Slice;
|
|||
namespace aql {
|
||||
|
||||
struct Variable {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief create the variable
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Variable(std::string const&, VariableId);
|
||||
|
||||
explicit Variable(arangodb::velocypack::Slice const);
|
||||
explicit Variable(arangodb::velocypack::Slice const&);
|
||||
|
||||
Variable* clone() const { return new Variable(name, id); }
|
||||
|
||||
|
|
|
@ -507,7 +507,7 @@ bool AgencyComm::tryConnect() {
|
|||
std::string endpointsStr { getUniqueEndpointsString() };
|
||||
|
||||
WRITE_LOCKER(writeLocker, AgencyComm::_globalLock);
|
||||
if (_globalEndpoints.size() == 0) {
|
||||
if (_globalEndpoints.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1258,7 +1258,7 @@ AgencyCommResult AgencyComm::removeValues(std::string const& key,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
AgencyCommResult AgencyComm::casValue(std::string const& key,
|
||||
arangodb::velocypack::Slice const json,
|
||||
arangodb::velocypack::Slice const& json,
|
||||
bool prevExist, double ttl,
|
||||
double timeout) {
|
||||
AgencyCommResult result;
|
||||
|
|
|
@ -257,7 +257,7 @@ class AgencyComm {
|
|||
/// @brief creates a communication channel
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
AgencyComm(bool = true);
|
||||
explicit AgencyComm(bool = true);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief destroys a communication channel
|
||||
|
@ -405,7 +405,7 @@ class AgencyComm {
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
AgencyCommResult casValue(std::string const&,
|
||||
arangodb::velocypack::Slice const, bool, double,
|
||||
arangodb::velocypack::Slice const&, bool, double,
|
||||
double);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1194,7 +1194,7 @@ int ClusterInfo::dropDatabaseCoordinator(std::string const& name,
|
|||
int ClusterInfo::createCollectionCoordinator(std::string const& databaseName,
|
||||
std::string const& collectionID,
|
||||
uint64_t numberOfShards,
|
||||
VPackSlice const json,
|
||||
VPackSlice const& json,
|
||||
std::string& errorMsg,
|
||||
double timeout) {
|
||||
using arangodb::velocypack::Slice;
|
||||
|
|
|
@ -500,10 +500,9 @@ class CollectionInfoCurrent {
|
|||
|
||||
std::unordered_map<ShardID, bool> getFlag(char const* name) const {
|
||||
std::unordered_map<ShardID, bool> m;
|
||||
bool b;
|
||||
for (auto it = _jsons.begin(); it != _jsons.end(); ++it) {
|
||||
TRI_json_t* json = it->second;
|
||||
b = arangodb::basics::JsonHelper::getBooleanValue(json, name, false);
|
||||
bool b = arangodb::basics::JsonHelper::getBooleanValue(json, name, false);
|
||||
m.insert(std::make_pair(it->first, b));
|
||||
}
|
||||
return m;
|
||||
|
@ -670,7 +669,7 @@ class ClusterInfo {
|
|||
int createCollectionCoordinator(std::string const& databaseName,
|
||||
std::string const& collectionID,
|
||||
uint64_t numberOfShards,
|
||||
arangodb::velocypack::Slice const json,
|
||||
arangodb::velocypack::Slice const& json,
|
||||
std::string& errorMsg, double timeout);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -977,7 +976,7 @@ class FollowerInfo {
|
|||
|
||||
public:
|
||||
|
||||
FollowerInfo(TRI_document_collection_t* d)
|
||||
explicit FollowerInfo(TRI_document_collection_t* d)
|
||||
: _followers(new std::vector<ServerID>()), _docColl(d) { }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -557,11 +557,10 @@ int SkiplistIndex::ElementElementComparator::operator()(
|
|||
}
|
||||
|
||||
// We break this tie in the key comparison by looking at the key:
|
||||
int compareResult = strcmp(
|
||||
TRI_EXTRACT_MARKER_KEY(
|
||||
leftElement->document()), // ONLY IN INDEX, PROTECTED by RUNTIME
|
||||
TRI_EXTRACT_MARKER_KEY(
|
||||
rightElement->document())); // ONLY IN INDEX, PROTECTED by RUNTIME
|
||||
VPackSlice leftKey = VPackSlice(leftElement->document()->vpack()).get(TRI_VOC_ATTRIBUTE_KEY);
|
||||
VPackSlice rightKey = VPackSlice(rightElement->document()->vpack()).get(TRI_VOC_ATTRIBUTE_KEY);
|
||||
|
||||
int compareResult = leftKey.compareString(rightKey.copyString());
|
||||
|
||||
if (compareResult < 0) {
|
||||
return -1;
|
||||
|
|
|
@ -252,7 +252,7 @@ struct TRI_df_marker_t {
|
|||
TRI_voc_size_t _size; // 4 bytes
|
||||
TRI_voc_crc_t _crc; // 4 bytes, generated
|
||||
uint64_t _typeAndTick; // 8 bytes
|
||||
|
||||
|
||||
public:
|
||||
inline off_t offsetOfSize() const {
|
||||
return offsetof(TRI_df_marker_t, _size);
|
||||
|
|
|
@ -4038,8 +4038,8 @@ int TRI_document_collection_t::deleteSecondaryIndexes(
|
|||
|
||||
VPackBuilder TRI_document_collection_t::newObjectForReplace(
|
||||
Transaction* trx,
|
||||
VPackSlice const oldValue,
|
||||
VPackSlice const newValue,
|
||||
VPackSlice const& oldValue,
|
||||
VPackSlice const& newValue,
|
||||
std::string const& rev) {
|
||||
// replace
|
||||
VPackBuilder builder;
|
||||
|
@ -4074,13 +4074,14 @@ VPackBuilder TRI_document_collection_t::newObjectForReplace(
|
|||
|
||||
VPackBuilder TRI_document_collection_t::mergeObjectsForUpdate(
|
||||
arangodb::Transaction* trx,
|
||||
VPackSlice const oldValue,
|
||||
VPackSlice const newValue,
|
||||
VPackSlice const& oldValue,
|
||||
VPackSlice const& newValue,
|
||||
std::string const& rev,
|
||||
bool mergeObjects, bool keepNull) {
|
||||
|
||||
VPackBuilder b;
|
||||
{ VPackObjectBuilder guard(&b);
|
||||
{
|
||||
VPackObjectBuilder guard(&b);
|
||||
|
||||
// Find the attributes in the newValue object:
|
||||
std::unordered_map<std::string, VPackSlice> newValues;
|
||||
|
|
|
@ -260,8 +260,8 @@ struct TRI_document_collection_t : public TRI_collection_t {
|
|||
|
||||
arangodb::velocypack::Builder newObjectForReplace(
|
||||
arangodb::Transaction* trx,
|
||||
arangodb::velocypack::Slice const oldValue,
|
||||
arangodb::velocypack::Slice const newValue,
|
||||
arangodb::velocypack::Slice const& oldValue,
|
||||
arangodb::velocypack::Slice const& newValue,
|
||||
std::string const& rev);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -270,8 +270,8 @@ struct TRI_document_collection_t : public TRI_collection_t {
|
|||
|
||||
arangodb::velocypack::Builder mergeObjectsForUpdate(
|
||||
arangodb::Transaction* trx,
|
||||
arangodb::velocypack::Slice const oldValue,
|
||||
arangodb::velocypack::Slice const newValue,
|
||||
arangodb::velocypack::Slice const& oldValue,
|
||||
arangodb::velocypack::Slice const& newValue,
|
||||
std::string const& rev,
|
||||
bool mergeObjects, bool keepNull);
|
||||
};
|
||||
|
|
|
@ -1983,11 +1983,10 @@ int TRI_Crc32File(char const* path, uint32_t* crc) {
|
|||
static std::string TRI_ApplicationName = "arangodb";
|
||||
|
||||
void TRI_SetApplicationName(char const* name) {
|
||||
TRI_ASSERT(name != nullptr);
|
||||
TRI_ASSERT(strlen(name) <= 13);
|
||||
|
||||
if (name != nullptr) {
|
||||
TRI_ApplicationName = name;
|
||||
}
|
||||
TRI_ApplicationName = name;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue