diff --git a/arangod/Aql/AllRowsFetcher.cpp b/arangod/Aql/AllRowsFetcher.cpp index 4a14eb1cdb..1a48f56cc5 100644 --- a/arangod/Aql/AllRowsFetcher.cpp +++ b/arangod/Aql/AllRowsFetcher.cpp @@ -83,7 +83,7 @@ std::pair AllRowsFetcher::fetchRow(size_t atMos _nextReturn = 0; _dataFetchedState = DATA_FETCH_ONGOING; } - // intentionally falls through + [[fallthrough]]; case DATA_FETCH_ONGOING: { TRI_ASSERT(_nextReturn < _rowIndexes.size()); TRI_ASSERT(_aqlItemMatrix != nullptr); @@ -258,4 +258,4 @@ std::pair AllRowsFetcher::fetchShadowRow(size_ } return {state, row}; -} \ No newline at end of file +} diff --git a/arangod/Aql/AqlValue.cpp b/arangod/Aql/AqlValue.cpp index 57e27f941b..c923a0a82e 100644 --- a/arangod/Aql/AqlValue.cpp +++ b/arangod/Aql/AqlValue.cpp @@ -241,11 +241,11 @@ AqlValue AqlValue::at(int64_t position, bool& mustDestroy, bool doCopy) const { switch (type()) { case VPACK_SLICE_POINTER: doCopy = false; - // intentionally falls through + [[fallthrough]]; case VPACK_INLINE: - // intentionally falls through + [[fallthrough]]; case VPACK_MANAGED_SLICE: - // intentionally falls through + [[fallthrough]]; case VPACK_MANAGED_BUFFER: { VPackSlice s(slice()); if (s.isArray()) { @@ -318,11 +318,11 @@ AqlValue AqlValue::at(int64_t position, size_t n, bool& mustDestroy, bool doCopy switch (type()) { case VPACK_SLICE_POINTER: doCopy = false; - // intentionally falls through + [[fallthrough]]; case VPACK_INLINE: - // intentionally falls through + [[fallthrough]]; case VPACK_MANAGED_SLICE: - // intentionally falls through + [[fallthrough]]; case VPACK_MANAGED_BUFFER: { VPackSlice s(slice()); if (s.isArray()) { @@ -392,11 +392,11 @@ AqlValue AqlValue::getKeyAttribute(bool& mustDestroy, bool doCopy) const { switch (type()) { case VPACK_SLICE_POINTER: doCopy = false; - // intentionally falls through + [[fallthrough]]; case VPACK_INLINE: - // intentionally falls through + [[fallthrough]]; case VPACK_MANAGED_SLICE: - // intentionally falls through + [[fallthrough]]; case VPACK_MANAGED_BUFFER: { VPackSlice s(slice()); if (s.isObject()) { @@ -431,11 +431,11 @@ AqlValue AqlValue::getIdAttribute(CollectionNameResolver const& resolver, switch (type()) { case VPACK_SLICE_POINTER: doCopy = false; - // intentionally falls through + [[fallthrough]]; case VPACK_INLINE: - // intentionally falls through + [[fallthrough]]; case VPACK_MANAGED_SLICE: - // intentionally falls through + [[fallthrough]]; case VPACK_MANAGED_BUFFER: { VPackSlice s(slice()); if (s.isObject()) { @@ -474,11 +474,11 @@ AqlValue AqlValue::getFromAttribute(bool& mustDestroy, bool doCopy) const { switch (type()) { case VPACK_SLICE_POINTER: doCopy = false; - // intentionally falls through + [[fallthrough]]; case VPACK_INLINE: - // intentionally falls through + [[fallthrough]]; case VPACK_MANAGED_SLICE: - // intentionally falls through + [[fallthrough]]; case VPACK_MANAGED_BUFFER: { VPackSlice s(slice()); if (s.isObject()) { @@ -512,11 +512,11 @@ AqlValue AqlValue::getToAttribute(bool& mustDestroy, bool doCopy) const { switch (type()) { case VPACK_SLICE_POINTER: doCopy = false; - // intentionally falls through + [[fallthrough]]; case VPACK_INLINE: - // intentionally falls through + [[fallthrough]]; case VPACK_MANAGED_SLICE: - // intentionally falls through + [[fallthrough]]; case VPACK_MANAGED_BUFFER: { VPackSlice s(slice()); if (s.isObject()) { @@ -551,11 +551,11 @@ AqlValue AqlValue::get(CollectionNameResolver const& resolver, switch (type()) { case VPACK_SLICE_POINTER: doCopy = false; - // intentionally falls through + [[fallthrough]]; case VPACK_INLINE: - // intentionally falls through + [[fallthrough]]; case VPACK_MANAGED_SLICE: - // intentionally falls through + [[fallthrough]]; case VPACK_MANAGED_BUFFER: { VPackSlice s(slice()); if (s.isObject()) { @@ -596,11 +596,11 @@ AqlValue AqlValue::get(CollectionNameResolver const& resolver, switch (type()) { case VPACK_SLICE_POINTER: doCopy = false; - // intentionally falls through + [[fallthrough]]; case VPACK_INLINE: - // intentionally falls through + [[fallthrough]]; case VPACK_MANAGED_SLICE: - // intentionally falls through + [[fallthrough]]; case VPACK_MANAGED_BUFFER: { VPackSlice s(slice()); if (s.isObject()) { @@ -645,11 +645,11 @@ AqlValue AqlValue::get(CollectionNameResolver const& resolver, switch (type()) { case VPACK_SLICE_POINTER: doCopy = false; - // intentionally falls through + [[fallthrough]]; case VPACK_INLINE: - // intentionally falls through + [[fallthrough]]; case VPACK_MANAGED_SLICE: - // intentionally falls through + [[fallthrough]]; case VPACK_MANAGED_BUFFER: { VPackSlice s(slice()); if (s.isObject()) { @@ -939,7 +939,7 @@ void AqlValue::toVelocyPack(transaction::Methods* trx, arangodb::velocypack::Bui if (!resolveExternals && isManagedDocument()) { builder.addExternal(_data.pointer); break; - } // intentionally falls through + } [[fallthrough]]; case VPACK_INLINE: case VPACK_MANAGED_SLICE: case VPACK_MANAGED_BUFFER: { diff --git a/arangod/Aql/Functions.cpp b/arangod/Aql/Functions.cpp index c48ed16372..452cfc31f2 100644 --- a/arangod/Aql/Functions.cpp +++ b/arangod/Aql/Functions.cpp @@ -295,7 +295,7 @@ AqlValue timeAqlValue(ExpressionContext* expressionContext, year_month_day ymd{floor(tp)}; auto day_time = make_time(tp - sys_days(ymd)); - + auto y = static_cast(ymd.year()); // quick sanity check here for dates outside the allowed range if (y < 0 || y > 9999) { @@ -439,7 +439,7 @@ AqlValue addOrSubtractUnitFromTimestamp(ExpressionContext* expressionContext, break; // We are done } durationUnits *= 12; - // intentionally falls through + [[fallthrough]]; case MONTH: durationUnits = std::modf(durationUnits, &intPart); if (isSubtract) { @@ -451,7 +451,7 @@ AqlValue addOrSubtractUnitFromTimestamp(ExpressionContext* expressionContext, break; // We are done } durationUnits *= 30; // 1 Month ~= 30 Days - // intentionally falls through + [[fallthrough]]; // After this fall through the date may actually a bit off case DAY: // From here on we do not need leap-day handling @@ -499,19 +499,19 @@ AqlValue addOrSubtractUnitFromTimestamp(ExpressionContext* expressionContext, AqlValue addOrSubtractIsoDurationFromTimestamp(ExpressionContext* expressionContext, tp_sys_clock_ms const& tp, - arangodb::velocypack::StringRef duration, + arangodb::velocypack::StringRef duration, char const* AFN, bool isSubtract) { year_month_day ymd{floor(tp)}; auto day_time = make_time(tp - sys_days(ymd)); - + std::match_results durationParts; if (!basics::regexIsoDuration(duration, durationParts)) { ::registerWarning(expressionContext, AFN, TRI_ERROR_QUERY_INVALID_DATE_VALUE); return AqlValue(AqlValueHintNull()); } - char const* begin; - + char const* begin; + begin = duration.data() + durationParts.position(2); int number = NumberUtils::atoi_unchecked(begin, begin + durationParts.length(2)); if (isSubtract) { @@ -2498,8 +2498,8 @@ void rtrimInternal(int32_t& startOffset, int32_t& endOffset, icu::UnicodeString& if (unicodeStr.length() == 0) { return; } - for (int32_t codePos = unicodeStr.moveIndex32(endOffset, -1); - startOffset <= codePos; + for (int32_t codePos = unicodeStr.moveIndex32(endOffset, -1); + startOffset <= codePos; codePos = unicodeStr.moveIndex32(codePos, -1)) { bool found = false; @@ -3648,7 +3648,7 @@ AqlValue Functions::DateCompare(ExpressionContext* expressionContext, if (ymd1.year() != ymd2.year()) { return AqlValue(AqlValueHintBool(false)); } - // intentionally falls through + [[fallthrough]]; case MONTH: if (rangeEnd > MONTH) { break; @@ -3656,7 +3656,7 @@ AqlValue Functions::DateCompare(ExpressionContext* expressionContext, if (ymd1.month() != ymd2.month()) { return AqlValue(AqlValueHintBool(false)); } - // intentionally falls through + [[fallthrough]]; case DAY: if (rangeEnd > DAY) { break; @@ -3664,7 +3664,7 @@ AqlValue Functions::DateCompare(ExpressionContext* expressionContext, if (ymd1.day() != ymd2.day()) { return AqlValue(AqlValueHintBool(false)); } - // intentionally falls through + [[fallthrough]]; case HOUR: if (rangeEnd > HOUR) { break; @@ -3672,7 +3672,7 @@ AqlValue Functions::DateCompare(ExpressionContext* expressionContext, if (time1.hours() != time2.hours()) { return AqlValue(AqlValueHintBool(false)); } - // intentionally falls through + [[fallthrough]]; case MINUTE: if (rangeEnd > MINUTE) { break; @@ -3680,7 +3680,7 @@ AqlValue Functions::DateCompare(ExpressionContext* expressionContext, if (time1.minutes() != time2.minutes()) { return AqlValue(AqlValueHintBool(false)); } - // intentionally falls through + [[fallthrough]]; case SECOND: if (rangeEnd > SECOND) { break; @@ -3688,7 +3688,7 @@ AqlValue Functions::DateCompare(ExpressionContext* expressionContext, if (time1.seconds() != time2.seconds()) { return AqlValue(AqlValueHintBool(false)); } - // intentionally falls through + [[fallthrough]]; case MILLI: if (rangeEnd > MILLI) { break; @@ -3730,15 +3730,15 @@ AqlValue Functions::DateRound(ExpressionContext* expressionContext, ::registerInvalidArgumentWarning(expressionContext, AFN); return AqlValue(AqlValueHintNull()); } - - int64_t const m = durationUnit.toInt64(); + + int64_t const m = durationUnit.toInt64(); if (m <= 0) { ::registerInvalidArgumentWarning(expressionContext, AFN); return AqlValue(AqlValueHintNull()); } - + velocypack::StringRef s = durationType.slice().stringRef(); - + int64_t factor = 1; if (s == "milliseconds" || s == "millisecond" || s == "f") { factor = 1; @@ -3755,8 +3755,8 @@ AqlValue Functions::DateRound(ExpressionContext* expressionContext, return AqlValue(AqlValueHintNull()); } - int64_t const multiplier = factor * m; - + int64_t const multiplier = factor * m; + duration time = tp.time_since_epoch(); int64_t t = time.count(); // integer division! @@ -4186,7 +4186,7 @@ AqlValue Functions::Sleep(ExpressionContext* expressionContext, } auto& server = application_features::ApplicationServer::server(); - + double const sleepValue = value.toDouble(); auto now = std::chrono::steady_clock::now(); auto const endTime = now + std::chrono::milliseconds(static_cast(sleepValue * 1000.0)); @@ -4443,7 +4443,7 @@ AqlValue Functions::Unique(ExpressionContext* expressionContext, transaction::Me std::unordered_set values(512, arangodb::basics::VelocyPackHelper::VPackHash(), arangodb::basics::VelocyPackHelper::VPackEqual(options)); - + transaction::BuilderLeaser builder(trx); builder->openArray(); @@ -4458,7 +4458,7 @@ AqlValue Functions::Unique(ExpressionContext* expressionContext, transaction::Me builder->add(s); } } - + builder->close(); return AqlValue(builder.get()); } @@ -4845,7 +4845,7 @@ AqlValue Functions::GeoDistance(ExpressionContext* expressionContext, ::registerWarning(expressionContext, "GEO_DISTANCE", res); return AqlValue(AqlValueHintNull()); } - + if (parameters.size() > 2 && parameters[2].isString()) { VPackValueLength len; const char* ptr = parameters[2].slice().getStringUnchecked(len); @@ -4911,17 +4911,17 @@ AqlValue Functions::GeoArea(ExpressionContext* expressionContext, VPackFunctionParameters const& parameters) { AqlValue p1 = extractFunctionParameterValue(parameters, 0); AqlValue p2 = extractFunctionParameterValue(parameters, 1); - + AqlValueMaterializer mat(trx); - + geo::ShapeContainer shape; Result res = geo::geojson::parseRegion(mat.slice(p1, true), shape); - + if (res.fail()) { ::registerWarning(expressionContext, "GEO_AREA", res); return AqlValue(AqlValueHintNull()); } - + auto detEllipsoid = [](AqlValue const& p) { if (p.isString()) { VPackValueLength len; @@ -7038,7 +7038,7 @@ AqlValue Functions::DecodeRev(ExpressionContext* expressionContext, VPackValueLength l; char const* p = rev.slice().getString(l); uint64_t revInt = arangodb::basics::HybridLogicalClock::decodeTimeStamp(p, l); - + if (revInt == 0 || revInt == UINT64_MAX) { ::registerInvalidArgumentWarning(expressionContext, "DECODE_REV"); return AqlValue(AqlValueHintNull()); @@ -7050,7 +7050,7 @@ AqlValue Functions::DecodeRev(ExpressionContext* expressionContext, uint64_t millis = timeMilli % 1000; struct tm date; TRI_gmtime(timeSeconds, &date); - + char buffer[32]; strftime(buffer, 32, "%Y-%m-%dT%H:%M:%S.000Z", &date); // fill millisecond part not covered by strftime diff --git a/arangod/Aql/OptimizerRules.cpp b/arangod/Aql/OptimizerRules.cpp index 0fd8f0277d..eff2aeebb9 100644 --- a/arangod/Aql/OptimizerRules.cpp +++ b/arangod/Aql/OptimizerRules.cpp @@ -980,7 +980,7 @@ void arangodb::aql::sortInValuesRule(Optimizer* opt, std::unique_ptrvariables()->createTemporaryVariable(); auto expression = std::make_unique(plan.get(), ast, sorted); - ExecutionNode* calculationNode = + ExecutionNode* calculationNode = new CalculationNode(plan.get(), plan->nextId(), std::move(expression), outVar); plan->registerNode(calculationNode); @@ -1752,7 +1752,7 @@ void arangodb::aql::moveCalculationsDownRule(Optimizer* opt, } lastNode = current; - + } else if (currentType == EN::INDEX || currentType == EN::ENUMERATE_COLLECTION || currentType == EN::ENUMERATE_IRESEARCH_VIEW || currentType == EN::ENUMERATE_LIST || currentType == EN::TRAVERSAL || @@ -4564,9 +4564,9 @@ void arangodb::aql::distributeSortToClusterRule(Optimizer* opt, break; } // late-materialization should be set only after sort nodes are distributed - // in cluster as it accounts this disctribution. So we should not encounter this + // in cluster as it accounts this disctribution. So we should not encounter this // kind of nodes for now - case EN::MATERIALIZE: + case EN::MATERIALIZE: case EN::SUBQUERY_START: case EN::SUBQUERY_END: case EN::DISTRIBUTE_CONSUMER: @@ -5538,7 +5538,7 @@ struct RemoveRedundantOr { } // if hasRedundantConditionWalker(lhs) and // hasRedundantConditionWalker(rhs), then one of the conditions in the OR - // statement is of the form x == x intentionally falls through + // statement is of the form x == x intentionally falls through if } else if (type == NODE_TYPE_REFERENCE || type == NODE_TYPE_ATTRIBUTE_ACCESS || type == NODE_TYPE_INDEXED_ACCESS) { // get a string representation of the node for comparisons @@ -7183,7 +7183,7 @@ void arangodb::aql::moveFiltersIntoEnumerateRule(Optimizer* opt, std::unique_ptr } Variable const* outVariable = en->outVariable(); - + if (!n->isVarUsedLater(outVariable)) { // e.g. FOR doc IN collection RETURN 1 continue; @@ -7197,14 +7197,14 @@ void arangodb::aql::moveFiltersIntoEnumerateRule(Optimizer* opt, std::unique_ptr if (current->getType() != EN::FILTER && current->getType() != EN::CALCULATION) { break; } - + if (current->getType() == EN::FILTER) { if (calculations.empty()) { break; } auto filterNode = ExecutionNode::castTo(current); Variable const* inVariable = filterNode->inVariable(); - + auto it = calculations.find(inVariable); if (it == calculations.end()) { break; @@ -7217,7 +7217,7 @@ void arangodb::aql::moveFiltersIntoEnumerateRule(Optimizer* opt, std::unique_ptr // node already has a filter, now AND-merge it with what we found! AstNode* merged = plan->getAst()->createNodeBinaryOperator( NODE_TYPE_OPERATOR_BINARY_AND, existingFilter->node(), expr->node()); - + en->setFilter(std::make_unique(plan.get(), plan->getAst(), merged)); } else { // node did not yet have a filter @@ -7248,11 +7248,11 @@ void arangodb::aql::moveFiltersIntoEnumerateRule(Optimizer* opt, std::unique_ptr found.clear(); Ast::getReferencedVariables(expr->node(), found); - if (found.size() == 1 && + if (found.size() == 1 && found.find(outVariable) != found.end()) { calculations.emplace(calculationNode->outVariable(), calculationNode); } - } + } current = current->getFirstParent(); } diff --git a/arangod/Aql/Query.cpp b/arangod/Aql/Query.cpp index 15945f57f5..7247ccb068 100644 --- a/arangod/Aql/Query.cpp +++ b/arangod/Aql/Query.cpp @@ -634,7 +634,7 @@ ExecutionState Query::execute(QueryRegistry* registry, QueryResult& queryResult) _resultBuilder->openArray(); _executionPhase = ExecutionPhase::EXECUTE; } - // intentionally falls through + [[fallthrough]]; case ExecutionPhase::EXECUTE: { TRI_ASSERT(_resultBuilder != nullptr); TRI_ASSERT(_resultBuilder->isOpenArray()); @@ -713,7 +713,7 @@ ExecutionState Query::execute(QueryRegistry* registry, QueryResult& queryResult) _executionPhase = ExecutionPhase::FINALIZE; } - // intentionally falls through + [[fallthrough]]; case ExecutionPhase::FINALIZE: { // will set warnings, stats, profile and cleanup plan and engine return finalize(queryResult); diff --git a/arangod/GeneralServer/CommTask.cpp b/arangod/GeneralServer/CommTask.cpp index eb76098d7f..60ea0783de 100644 --- a/arangod/GeneralServer/CommTask.cpp +++ b/arangod/GeneralServer/CommTask.cpp @@ -201,7 +201,7 @@ CommTask::Flow CommTask::prepareExecution(GeneralRequest& req) { break; // continue with auth check } } - // intentionally falls through + [[fallthrough]]; case ServerState::Mode::TRYAGAIN: { if (!::startsWith(path, "/_admin/shutdown") && !::startsWith(path, "/_admin/cluster/health") && @@ -305,7 +305,7 @@ void CommTask::executeRequest(std::unique_ptr request, bool found; // check for an async request (before the handler steals the request) std::string const& asyncExec = request->header(StaticStrings::Async, found); - + // store the message id for error handling uint64_t messageId = 0UL; if (request) { @@ -476,7 +476,7 @@ void CommTask::addErrorResponse(rest::ResponseCode code, rest::ContentType respT bool CommTask::handleRequestSync(std::shared_ptr handler) { RequestStatistics::SET_QUEUE_START(handler->statistics(), SchedulerFeature::SCHEDULER->queueStatistics()._queued); - + RequestLane lane = handler->getRequestLane(); ContentType respType = handler->request()->contentTypeResponse(); uint64_t mid = handler->messageId(); diff --git a/arangod/GeneralServer/HttpCommTask.cpp b/arangod/GeneralServer/HttpCommTask.cpp index 3d1d5ef571..17e16efb09 100644 --- a/arangod/GeneralServer/HttpCommTask.cpp +++ b/arangod/GeneralServer/HttpCommTask.cpp @@ -85,11 +85,11 @@ int HttpCommTask::on_message_began(llhttp_t* p) { self->_lastHeaderWasValue = false; self->_shouldKeepAlive = false; self->_messageDone = false; - + // acquire a new statistics entry for the request RequestStatistics* stat = self->acquireStatistics(1UL); RequestStatistics::SET_READ_START(stat, TRI_microtime()); - + return HPE_OK; } @@ -103,10 +103,10 @@ int HttpCommTask::on_url(llhttp_t* p, const char* at, size_t len) { rest::ContentType::UNSET, 1, VPackBuffer()); return HPE_USER; } - + RequestStatistics* stat = self->statistics(1UL); RequestStatistics::SET_REQUEST_TYPE(stat, self->_request->requestType()); - + return HPE_OK; } @@ -201,12 +201,12 @@ int HttpCommTask::on_body(llhttp_t* p, const char* at, size_t len) { template int HttpCommTask::on_message_complete(llhttp_t* p) { HttpCommTask* self = static_cast*>(p->data); - + RequestStatistics* stat = self->statistics(1UL); RequestStatistics::SET_READ_END(stat); RequestStatistics::ADD_RECEIVED_BYTES(stat, self->_request->body().size()); self->_messageDone = true; - + return HPE_PAUSED; } @@ -279,11 +279,11 @@ bool HttpCommTask::readCallback(asio_ns::error_code ec) { err = HPE_INVALID_EOF_STATE; } } else { // Inspect the received data - + size_t parsedBytes = 0; for (auto const& buffer : this->_protocol->buffer.data()) { const char* data = reinterpret_cast(buffer.data()); - + err = llhttp_execute(&_parser, data, buffer.size()); if (err != HPE_OK) { parsedBytes += llhttp_get_error_pos(&_parser) - data; @@ -291,18 +291,18 @@ bool HttpCommTask::readCallback(asio_ns::error_code ec) { } parsedBytes += buffer.size(); } - + TRI_ASSERT(parsedBytes < std::numeric_limits::max()); // Remove consumed data from receive buffer. this->_protocol->buffer.consume(parsedBytes); - + if (err == HPE_PAUSED_UPGRADE) { this->addSimpleResponse(rest::ResponseCode::NOT_IMPLEMENTED, rest::ContentType::UNSET, 1, VPackBuffer()); return false; // stop read loop } } - + if (_messageDone) { TRI_ASSERT(err == HPE_PAUSED); _messageDone = false; @@ -339,10 +339,10 @@ void HttpCommTask::checkVSTPrefix() { return; } thisPtr->_protocol->buffer.commit(nread); - + auto bg = asio_ns::buffers_begin(thisPtr->_protocol->buffer.data()); if (std::equal(::vst10, ::vst10 + 11, bg, bg + 11)) { - + thisPtr->_protocol->buffer.consume(11); // remove VST/1.0 prefix auto commTask = std::make_unique>(thisPtr->_server, thisPtr->_connectionInfo, @@ -350,9 +350,9 @@ void HttpCommTask::checkVSTPrefix() { fuerte::vst::VST1_0); thisPtr->_server.registerTask(std::move(commTask)); return; // vst 1.0 - + } else if (std::equal(::vst11, ::vst11 + 11, bg, bg + 11)) { - + thisPtr->_protocol->buffer.consume(11); // remove VST/1.1 prefix auto commTask = std::make_unique>(thisPtr->_server, thisPtr->_connectionInfo, @@ -361,7 +361,7 @@ void HttpCommTask::checkVSTPrefix() { thisPtr->_server.registerTask(std::move(commTask)); return; // vst 1.1 } - + thisPtr->asyncReadSome(); // continue reading }; auto buffs = this->_protocol->buffer.prepare(GeneralCommTask::ReadBlockSize); @@ -378,13 +378,13 @@ bool HttpCommTask::checkHttpUpgrade() { template void HttpCommTask::processRequest() { TRI_ASSERT(_request); - + // ensure there is a null byte termination. RestHandlers use // C functions like strchr that except a C string as input _request->body().push_back('\0'); _request->body().resetTo(_request->body().size() - 1); this->_protocol->timer.cancel(); - + { LOG_TOPIC("6e770", DEBUG, Logger::REQUESTS) << "\"http-request-begin\",\"" << (void*)this << "\",\"" @@ -452,12 +452,12 @@ bool allowCredentials(std::string const& origin) { if (origin.empty()) { return allowCredentials; } // else handle origin headers - + // if the request asks to allow credentials, we'll check against the // configured whitelist of origins std::vector const& accessControlAllowOrigins = GeneralServerFeature::accessControlAllowOrigins(); - + if (!accessControlAllowOrigins.empty()) { if (accessControlAllowOrigins[0] == "*") { // special case: allow everything @@ -642,20 +642,20 @@ void HttpCommTask::sendResponse(std::unique_ptr baseRes, // access-control-allow-origin header now LOG_TOPIC("ae603", DEBUG, arangodb::Logger::REQUESTS) << "handling CORS response"; - + // send back original value of "Origin" header response.setHeaderNCIfNotSet(StaticStrings::AccessControlAllowOrigin, _origin); - + // send back "Access-Control-Allow-Credentials" header response.setHeaderNCIfNotSet(StaticStrings::AccessControlAllowCredentials, (::allowCredentials(_origin) ? "true" : "false")); - + // use "IfNotSet" here because we should not override HTTP headers set // by Foxx applications response.setHeaderNCIfNotSet(StaticStrings::AccessControlExposeHeaders, StaticStrings::ExposedCorsHeaders); } - + if (!ServerState::instance()->isDBServer()) { // DB server is not user-facing, and does not need to set this header // use "IfNotSet" to not overwrite an existing response header @@ -721,7 +721,7 @@ void HttpCommTask::sendResponse(std::unique_ptr baseRes, if (!seenServerHeader && !HttpResponse::HIDE_PRODUCT_HEADER) { header->append(TRI_CHAR_LENGTH_PAIR("Server: ArangoDB\r\n")); } - + // turn on the keepAlive timer double secs = GeneralServerFeature::keepAliveTimeout(); if (_shouldKeepAlive && secs > 0) { @@ -737,7 +737,7 @@ void HttpCommTask::sendResponse(std::unique_ptr baseRes, << "keep alive timeout, closing stream!"; s->close(); }); - + header->append(TRI_CHAR_LENGTH_PAIR("Connection: Keep-Alive\r\n")); header->append(TRI_CHAR_LENGTH_PAIR("Keep-Alive: timeout=")); header->append(std::to_string(static_cast(secs))); @@ -745,7 +745,7 @@ void HttpCommTask::sendResponse(std::unique_ptr baseRes, } else { header->append(TRI_CHAR_LENGTH_PAIR("Connection: Close\r\n")); } - + // add "Content-Type" header switch (response.contentType()) { case ContentType::UNSET: @@ -778,12 +778,12 @@ void HttpCommTask::sendResponse(std::unique_ptr baseRes, header->append(it); header->append("\r\n", 2); } - + size_t len = response.bodySize(); header->append(TRI_CHAR_LENGTH_PAIR("Content-Length: ")); header->append(std::to_string(len)); header->append("\r\n\r\n", 4); - + std::unique_ptr body = response.stealBody(); // append write buffer and statistics double const totalTime = RequestStatistics::ELAPSED_SINCE_READ_START(stat); @@ -793,21 +793,21 @@ void HttpCommTask::sendResponse(std::unique_ptr baseRes, << "\"http-request-end\",\"" << (void*)this << "\",\"" << this->_connectionInfo.clientAddress << "\",\"" << GeneralRequest::translateMethod(::llhttpToRequestType(&_parser)) << "\",\"" << static_cast(response.responseCode()) << "\"," << Logger::FIXED(totalTime, 6); - + std::array buffers; buffers[0] = asio_ns::buffer(header->data(), header->size()); if (HTTP_HEAD != _parser.method) { buffers[1] = asio_ns::buffer(body->data(), body->size()); TRI_ASSERT(len == body->size()); } - + // FIXME measure performance w/o sync write auto cb = [self = CommTask::shared_from_this(), h = std::move(header), b = std::move(body)](asio_ns::error_code ec, size_t nwrite) { auto* thisPtr = static_cast*>(self.get()); - + llhttp_errno_t err = llhttp_get_errno(&thisPtr->_parser); if (ec || !thisPtr->_shouldKeepAlive || err != HPE_PAUSED) { if (ec) { diff --git a/arangod/IResearch/IResearchDocument.cpp b/arangod/IResearch/IResearchDocument.cpp index 0b103a6546..8cc27e226e 100644 --- a/arangod/IResearch/IResearchDocument.cpp +++ b/arangod/IResearch/IResearchDocument.cpp @@ -181,7 +181,7 @@ inline bool canHandleValue(std::string const& key, VPackSlice const& value, return true; case VPackValueType::Custom: TRI_ASSERT(key == arangodb::StaticStrings::IdString); - // intentionally falls through + [[fallthrough]]; case VPackValueType::String: return !context._analyzers.empty(); default: @@ -556,7 +556,7 @@ bool FieldIterator::setAttributeValue(IResearchLinkMeta const& context) { return true; case VPackValueType::Custom: TRI_ASSERT(nameBuffer() == arangodb::StaticStrings::IdString); - // intentionally falls through + [[fallthrough]]; case VPackValueType::String: resetAnalyzers(context); // reset string analyzers return setStringValue(value, *_begin); @@ -651,4 +651,4 @@ void FieldIterator::next() { // ----------------------------------------------------------------------------- // --SECTION-- END-OF-FILE -// ----------------------------------------------------------------------------- \ No newline at end of file +// ----------------------------------------------------------------------------- diff --git a/arangod/MMFiles/MMFilesCollection.cpp b/arangod/MMFiles/MMFilesCollection.cpp index b39836f45e..65df3128df 100644 --- a/arangod/MMFiles/MMFilesCollection.cpp +++ b/arangod/MMFiles/MMFilesCollection.cpp @@ -2837,7 +2837,7 @@ LocalDocumentId MMFilesCollection::reuseOrCreateLocalDocumentId(OperationOptions if (marker->hasLocalDocumentId()) { return marker->getLocalDocumentId(); } - // falls through intentionally + // intentionally falls through } // new operation, no recovery -> generate a new LocalDocumentId diff --git a/arangod/MMFiles/MMFilesSkiplistIndex.cpp b/arangod/MMFiles/MMFilesSkiplistIndex.cpp index 613363d8f3..17f89bf33e 100644 --- a/arangod/MMFiles/MMFilesSkiplistIndex.cpp +++ b/arangod/MMFiles/MMFilesSkiplistIndex.cpp @@ -172,7 +172,7 @@ MMFilesSkiplistLookupBuilder::MMFilesSkiplistLookupBuilder( } else { _includeUpper = false; } - // intentionally falls through + [[fallthrough]]; case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_LE: if (isReverseOrder) { value->toVelocyPackValue(*(_lowerBuilder.get())); @@ -186,7 +186,7 @@ MMFilesSkiplistLookupBuilder::MMFilesSkiplistLookupBuilder( } else { _includeLower = false; } - // intentionally falls through + [[fallthrough]]; case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_GE: if (isReverseOrder) { value->toVelocyPackValue(*(_upperBuilder.get())); @@ -317,7 +317,7 @@ MMFilesSkiplistInLookupBuilder::MMFilesSkiplistInLookupBuilder( } else { _includeUpper = false; } - // intentionally falls through + [[fallthrough]]; case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_LE: if (isReverseOrder) { TRI_ASSERT(lower == nullptr); @@ -333,7 +333,7 @@ MMFilesSkiplistInLookupBuilder::MMFilesSkiplistInLookupBuilder( } else { _includeLower = false; } - // intentionally falls through + [[fallthrough]]; case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_GE: if (isReverseOrder) { TRI_ASSERT(upper == nullptr); @@ -1115,7 +1115,7 @@ bool MMFilesSkiplistIndex::findMatchingConditions( if (first->getMember(1)->isArray()) { usesIn = true; } - // intentionally falls through + [[fallthrough]]; case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_EQ: TRI_ASSERT(conditions.size() == 1); break; diff --git a/arangod/RestHandler/RestReplicationHandler.cpp b/arangod/RestHandler/RestReplicationHandler.cpp index 9047412275..076101071b 100644 --- a/arangod/RestHandler/RestReplicationHandler.cpp +++ b/arangod/RestHandler/RestReplicationHandler.cpp @@ -1902,8 +1902,8 @@ void RestReplicationHandler::handleCommandRestoreView() { if (view) { if (!overwrite) { generateError(GeneralResponse::responseCode(TRI_ERROR_ARANGO_DUPLICATE_NAME), - TRI_ERROR_ARANGO_DUPLICATE_NAME, - std::string("unable to restore view '") + nameSlice.copyString() + ": " + + TRI_ERROR_ARANGO_DUPLICATE_NAME, + std::string("unable to restore view '") + nameSlice.copyString() + ": " + TRI_errno_string(TRI_ERROR_ARANGO_DUPLICATE_NAME)); return; } diff --git a/arangod/V8Server/v8-collection.cpp b/arangod/V8Server/v8-collection.cpp index a795869a58..c78ad87bb7 100644 --- a/arangod/V8Server/v8-collection.cpp +++ b/arangod/V8Server/v8-collection.cpp @@ -1005,7 +1005,7 @@ static void JS_GetResponsibleShardVocbaseCol(v8::FunctionCallbackInfo if (res != TRI_ERROR_NO_ERROR) { TRI_V8_THROW_EXCEPTION(res); } - } + } if (!builder.slice().isObject()) { TRI_V8_THROW_EXCEPTION_USAGE("getResponsibleShard()"); } diff --git a/arangod/VocBase/Methods/Transactions.cpp b/arangod/VocBase/Methods/Transactions.cpp index f3304e5b50..8ce03d2c21 100644 --- a/arangod/VocBase/Methods/Transactions.cpp +++ b/arangod/VocBase/Methods/Transactions.cpp @@ -179,7 +179,7 @@ Result executeTransactionJS(v8::Isolate* isolate, v8::Handle const& a std::vector exclusiveCollections; if (TRI_HasProperty(context, isolate, collections, "allowImplicit")) { - trxOptions.allowImplicitCollections = TRI_ObjectToBoolean(isolate, + trxOptions.allowImplicitCollections = TRI_ObjectToBoolean(isolate, collections->Get(TRI_V8_ASCII_STRING(isolate, "allowImplicit"))); } @@ -203,7 +203,7 @@ Result executeTransactionJS(v8::Isolate* isolate, v8::Handle const& a collections.emplace_back(TRI_ObjectToString(isolate, collection)); } } else if (obj->Get(TRI_V8_ASCII_STRING(isolate, attributeName))->IsString()) { - collections.emplace_back(TRI_ObjectToString(isolate, + collections.emplace_back(TRI_ObjectToString(isolate, obj->Get(TRI_V8_ASCII_STRING(isolate, attributeName)))); } else { collectionError += @@ -278,7 +278,7 @@ Result executeTransactionJS(v8::Isolate* isolate, v8::Handle const& a // Invoke Function constructor to create function with the given body and the // arguments - std::string body = TRI_ObjectToString(isolate, + std::string body = TRI_ObjectToString(isolate, TRI_GetProperty(context, isolate, object, "action")); body = "return (" + body + ")(params);"; v8::Handle args[2] = {TRI_V8_ASCII_STRING(isolate, "params"), @@ -322,9 +322,9 @@ Result executeTransactionJS(v8::Isolate* isolate, v8::Handle const& a auto trx = std::make_unique(ctx, readCollections, writeCollections, exclusiveCollections, trxOptions); trx->addHint(transaction::Hints::Hint::GLOBAL_MANAGED); - + rv = trx->begin(); - + if (rv.fail()) { return rv; } @@ -357,7 +357,7 @@ Result executeTransactionJS(v8::Isolate* isolate, v8::Handle const& a } catch (...) { rv.reset(TRI_ERROR_INTERNAL, "caught unknown exception during transaction"); } - + rv = trx->finish(rv); // if we do not remove unused V8Cursors, V8Context might not reset global diff --git a/lib/Basics/StringUtils.cpp b/lib/Basics/StringUtils.cpp index 5bc29b0985..210bb612ea 100644 --- a/lib/Basics/StringUtils.cpp +++ b/lib/Basics/StringUtils.cpp @@ -855,7 +855,7 @@ std::string urlEncode(char const* src, size_t const len) { '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; char const* end = src + len; - + // cppcheck-suppress unsignedPositive if (len >= (SIZE_MAX - 1) / 3) { THROW_ARANGO_EXCEPTION(TRI_ERROR_OUT_OF_MEMORY); @@ -1434,61 +1434,61 @@ uint64_t uint64_trusted(char const* value, size_t length) { switch (length) { case 20: result += (value[length - 20] - '0') * 10000000000000000000ULL; - // intentionally falls through + [[fallthrough]]; case 19: result += (value[length - 19] - '0') * 1000000000000000000ULL; - // intentionally falls through + [[fallthrough]]; case 18: result += (value[length - 18] - '0') * 100000000000000000ULL; - // intentionally falls through + [[fallthrough]]; case 17: result += (value[length - 17] - '0') * 10000000000000000ULL; - // intentionally falls through + [[fallthrough]]; case 16: result += (value[length - 16] - '0') * 1000000000000000ULL; - // intentionally falls through + [[fallthrough]]; case 15: result += (value[length - 15] - '0') * 100000000000000ULL; - // intentionally falls through + [[fallthrough]]; case 14: result += (value[length - 14] - '0') * 10000000000000ULL; - // intentionally falls through + [[fallthrough]]; case 13: result += (value[length - 13] - '0') * 1000000000000ULL; - // intentionally falls through + [[fallthrough]]; case 12: result += (value[length - 12] - '0') * 100000000000ULL; - // intentionally falls through + [[fallthrough]]; case 11: result += (value[length - 11] - '0') * 10000000000ULL; - // intentionally falls through + [[fallthrough]]; case 10: result += (value[length - 10] - '0') * 1000000000ULL; - // intentionally falls through + [[fallthrough]]; case 9: result += (value[length - 9] - '0') * 100000000ULL; - // intentionally falls through + [[fallthrough]]; case 8: result += (value[length - 8] - '0') * 10000000ULL; - // intentionally falls through + [[fallthrough]]; case 7: result += (value[length - 7] - '0') * 1000000ULL; - // intentionally falls through + [[fallthrough]]; case 6: result += (value[length - 6] - '0') * 100000ULL; - // intentionally falls through + [[fallthrough]]; case 5: result += (value[length - 5] - '0') * 10000ULL; - // intentionally falls through + [[fallthrough]]; case 4: result += (value[length - 4] - '0') * 1000ULL; - // intentionally falls through + [[fallthrough]]; case 3: result += (value[length - 3] - '0') * 100ULL; - // intentionally falls through + [[fallthrough]]; case 2: result += (value[length - 2] - '0') * 10ULL; - // intentionally falls through + [[fallthrough]]; case 1: result += (value[length - 1] - '0'); } diff --git a/lib/Basics/fasthash.cpp b/lib/Basics/fasthash.cpp index 84d9dbbbfd..89d0846887 100644 --- a/lib/Basics/fasthash.cpp +++ b/lib/Basics/fasthash.cpp @@ -44,25 +44,25 @@ uint64_t fasthash64(const void* buf, size_t len, uint64_t seed) { switch (len) { case 8: v ^= (uint64_t)pos[7] << 56; - // intentionally falls through + [[fallthrough]]; case 7: v ^= (uint64_t)pos[6] << 48; - // intentionally falls through + [[fallthrough]]; case 6: v ^= (uint64_t)pos[5] << 40; - // intentionally falls through + [[fallthrough]]; case 5: v ^= (uint64_t)pos[4] << 32; - // intentionally falls through + [[fallthrough]]; case 4: v ^= (uint64_t)pos[3] << 24; - // intentionally falls through + [[fallthrough]]; case 3: v ^= (uint64_t)pos[2] << 16; - // intentionally falls through + [[fallthrough]]; case 2: v ^= (uint64_t)pos[1] << 8; - // intentionally falls through + [[fallthrough]]; case 1: v ^= (uint64_t)pos[0]; h ^= fasthash_mix(v); @@ -95,22 +95,22 @@ uint64_t fasthash64(const void* buf, size_t len, uint64_t seed) { switch (len & 7) { case 7: v ^= (uint64_t)pos2[6] << 48; - // intentionally falls through + [[fallthrough]]; case 6: v ^= (uint64_t)pos2[5] << 40; - // intentionally falls through + [[fallthrough]]; case 5: v ^= (uint64_t)pos2[4] << 32; - // intentionally falls through + [[fallthrough]]; case 4: v ^= (uint64_t)pos2[3] << 24; - // intentionally falls through + [[fallthrough]]; case 3: v ^= (uint64_t)pos2[2] << 16; - // intentionally falls through + [[fallthrough]]; case 2: v ^= (uint64_t)pos2[1] << 8; - // intentionally falls through + [[fallthrough]]; case 1: v ^= (uint64_t)pos2[0]; h ^= fasthash_mix(v);