You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by sz...@apache.org on 2021/05/21 10:06:13 UTC
[nifi-minifi-cpp] branch main updated: MINIFICPP-1203 Add linter
recommended missing whitespaces
This is an automated email from the ASF dual-hosted git repository.
szaszm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
The following commit(s) were added to refs/heads/main by this push:
new 9204c99 MINIFICPP-1203 Add linter recommended missing whitespaces
9204c99 is described below
commit 9204c992e5238aa001ab212f1c2a815424a11e39
Author: Adam Hunyadi <hu...@gmail.com>
AuthorDate: Thu May 20 19:02:58 2021 +0200
MINIFICPP-1203 Add linter recommended missing whitespaces
This closes #1060
Signed-off-by: Marton Szasz <sz...@gmail.com>
---
controller/Controller.h | 2 +-
extensions/bootstrap/bootstrap.cpp | 2 +-
extensions/civetweb/processors/ListenHTTP.cpp | 2 +-
extensions/civetweb/processors/ListenHTTP.h | 2 +-
extensions/civetweb/tests/ListenHTTPTests.cpp | 4 +-
extensions/coap/nanofi/coap_server.c | 2 +-
extensions/coap/protocols/CoapC2Protocol.h | 6 +--
extensions/coap/server/CoapServer.cpp | 2 +-
extensions/coap/tests/CoapC2VerifyHeartbeat.cpp | 6 +--
.../tests/ExpressionLanguageTests.cpp | 6 +--
extensions/http-curl/HTTPCurlLoader.h | 10 ++---
extensions/http-curl/client/HTTPClient.cpp | 14 +++----
extensions/http-curl/client/HTTPClient.h | 6 +--
extensions/http-curl/protocols/RESTReceiver.cpp | 6 +--
extensions/http-curl/protocols/RESTSender.h | 2 +-
extensions/http-curl/sitetosite/HTTPTransaction.h | 4 +-
extensions/http-curl/tests/HTTPHandlers.h | 10 ++---
extensions/http-curl/tests/HTTPIntegrationBase.h | 2 +-
extensions/http-curl/tests/HTTPSiteToSiteTests.cpp | 2 +-
extensions/http-curl/tests/ServerAwareHandler.h | 2 +-
.../http-curl/tests/TimeoutHTTPSiteToSiteTests.cpp | 2 +-
extensions/jni/JNIUtil.h | 4 +-
extensions/jni/JavaException.h | 4 +-
extensions/jni/jvm/JVMLoader.h | 2 +-
extensions/jni/jvm/JniMethod.h | 2 +-
extensions/libarchive/ArchiveLoader.h | 6 +--
extensions/libarchive/ArchiveTests.h | 4 +-
extensions/libarchive/ManipulateArchive.cpp | 10 ++---
extensions/libarchive/MergeContent.cpp | 4 +-
extensions/libarchive/UnfocusArchiveEntry.h | 2 +-
extensions/mqtt/processors/ConsumeMQTT.cpp | 2 +-
extensions/mqtt/processors/ConvertHeartBeat.cpp | 2 +-
extensions/mqtt/processors/ConvertJSONAck.cpp | 4 +-
extensions/opc/include/opc.h | 6 +--
extensions/opc/src/fetchopc.cpp | 28 ++++++-------
extensions/opc/src/opc.cpp | 48 +++++++++++-----------
extensions/opencv/OpenCVLoader.h | 8 ++--
extensions/pcap/CapturePacket.h | 2 +-
extensions/pcap/PcapLoader.h | 2 +-
extensions/rocksdb-repos/FlowFileRepository.cpp | 12 +++---
extensions/rocksdb-repos/FlowFileRepository.h | 2 +-
extensions/rocksdb-repos/ProvenanceRepository.cpp | 2 +-
extensions/rocksdb-repos/ProvenanceRepository.h | 6 +--
extensions/sftp/tests/PutSFTPTests.cpp | 2 +-
extensions/sql/SQLLoader.h | 4 +-
extensions/sql/data/SQLRowsetProcessor.h | 2 +-
extensions/windows-event-log/Bookmark.cpp | 2 +-
.../CollectorInitiatedSubscription.cpp | 4 +-
extensions/windows-event-log/TailEventLog.cpp | 4 +-
extensions/windows-event-log/TailEventLog.h | 4 +-
.../windows-event-log/wel/MetadataWalker.cpp | 14 +++----
extensions/windows-event-log/wel/WindowsEventLog.h | 42 +++++++++----------
libminifi/test/BufferReader.h | 2 +-
libminifi/test/aws-tests/MockS3RequestSender.h | 4 +-
libminifi/test/unit/ProvenanceTestHelper.h | 2 +-
main/AgentDocs.cpp | 20 ++++-----
main/MainHelper.cpp | 2 +-
main/MiNiFiMain.cpp | 8 ++--
nanofi/examples/hash_file.c | 10 ++---
nanofi/examples/transmit_flow.c | 10 ++---
nanofi/examples/transmit_payload.c | 2 +-
nanofi/include/api/nanofi.h | 6 +--
nanofi/include/core/cstructs.h | 6 +--
nanofi/include/core/log.h | 2 +-
nanofi/include/cxx/C2CallbackAgent.h | 2 +-
nanofi/include/cxx/Plan.h | 6 +--
nanofi/include/cxx/ReflexiveSession.h | 8 ++--
nanofi/include/sitetosite/CPeer.h | 16 ++++----
nanofi/include/sitetosite/CRawSocketProtocol.h | 6 +--
nanofi/include/sitetosite/CSiteToSite.h | 2 +-
nanofi/src/api/ecu.c | 2 +-
nanofi/src/api/nanofi.cpp | 22 +++++-----
nanofi/src/core/cstream.c | 16 ++++----
nanofi/src/cxx/CallbackProcessor.cpp | 4 +-
nanofi/src/cxx/Plan.cpp | 8 ++--
nanofi/src/sitetosite/CPeer.c | 6 +--
nanofi/src/sitetosite/CRawSocketProtocol.c | 38 ++++++++---------
nanofi/tests/CLogAggregatorTests.cpp | 2 +-
nanofi/tests/CSite2SiteTests.cpp | 18 ++++----
nanofi/tests/CUUIDTests.cpp | 10 ++---
python/library/python_lib.cpp | 2 +-
81 files changed, 288 insertions(+), 288 deletions(-)
diff --git a/controller/Controller.h b/controller/Controller.h
index 003a712..54ea834 100644
--- a/controller/Controller.h
+++ b/controller/Controller.h
@@ -314,7 +314,7 @@ void printManifest(const std::shared_ptr<minifi::Configure> &configuration) {
configuration->set("c2.agent.heartbeat.period", "25");
configuration->set("nifi.c2.root.classes", "AgentInformation");
configuration->set("nifi.c2.enable", "true");
- configuration->set("nifi.c2.agent.class","test");
+ configuration->set("nifi.c2.agent.class", "test");
configuration->set("c2.agent.listen", "true");
configuration->set("c2.agent.heartbeat.reporter.classes", "AgentPrinter");
diff --git a/extensions/bootstrap/bootstrap.cpp b/extensions/bootstrap/bootstrap.cpp
index d9db438..813c8f7 100644
--- a/extensions/bootstrap/bootstrap.cpp
+++ b/extensions/bootstrap/bootstrap.cpp
@@ -43,7 +43,7 @@ int main(int argc, char **argv) {
}
if (result.count("inputc2docs") && result.count("outputc2docs")) {
- generateC2Docs(result["inputc2docs"].as<std::string>(),result["outputc2docs"].as<std::string>());
+ generateC2Docs(result["inputc2docs"].as<std::string>(), result["outputc2docs"].as<std::string>());
std::cout << "Generated docs at " << result["outputc2docs"].as<std::string>() << std::endl;
}
}catch (const std::exception &exc) {
diff --git a/extensions/civetweb/processors/ListenHTTP.cpp b/extensions/civetweb/processors/ListenHTTP.cpp
index 7a2b072..eaf0626 100644
--- a/extensions/civetweb/processors/ListenHTTP.cpp
+++ b/extensions/civetweb/processors/ListenHTTP.cpp
@@ -514,7 +514,7 @@ bool ListenHTTP::isSecure() const {
}
std::string ListenHTTP::getPort() const {
- if(isSecure()) {
+ if (isSecure()) {
return listeningPort.substr(0, listeningPort.length() -1);
}
return listeningPort;
diff --git a/extensions/civetweb/processors/ListenHTTP.h b/extensions/civetweb/processors/ListenHTTP.h
index adf4a76..d34a175 100644
--- a/extensions/civetweb/processors/ListenHTTP.h
+++ b/extensions/civetweb/processors/ListenHTTP.h
@@ -42,7 +42,7 @@ namespace processors {
// ListenHTTP Class
class ListenHTTP : public core::Processor {
public:
- using FlowFileBufferPair=std::pair<std::shared_ptr<FlowFileRecord>, std::unique_ptr<io::BufferStream>>;
+ using FlowFileBufferPair = std::pair<std::shared_ptr<FlowFileRecord>, std::unique_ptr<io::BufferStream>>;
// Constructor
/*!
diff --git a/extensions/civetweb/tests/ListenHTTPTests.cpp b/extensions/civetweb/tests/ListenHTTPTests.cpp
index f180ef5..f2168e0 100644
--- a/extensions/civetweb/tests/ListenHTTPTests.cpp
+++ b/extensions/civetweb/tests/ListenHTTPTests.cpp
@@ -361,10 +361,10 @@ TEST_CASE_METHOD(ListenHTTPTestsFixture, "HTTP Batch tests", "[batch]") {
std::vector<HttpResponseExpectations> requests;
auto create_requests = [&](std::size_t successful, std::size_t failed) {
for (std::size_t i = 0; i < successful; ++i) {
- requests.push_back(HttpResponseExpectations{true,200});
+ requests.push_back(HttpResponseExpectations{true, 200});
}
for (std::size_t i = 0; i < failed; ++i) {
- requests.push_back(HttpResponseExpectations{true,503});
+ requests.push_back(HttpResponseExpectations{true, 503});
}
};
diff --git a/extensions/coap/nanofi/coap_server.c b/extensions/coap/nanofi/coap_server.c
index 833b73b..4f43a6d 100644
--- a/extensions/coap/nanofi/coap_server.c
+++ b/extensions/coap/nanofi/coap_server.c
@@ -41,7 +41,7 @@ CoapEndpoint* create_endpoint(CoapServerContext * const server, const char * con
}
endpoint->resource = coap_resource_init(path, flags);
coap_add_attr(endpoint->resource, coap_make_str_const("title"), coap_make_str_const("\"Created CoapEndpoint\""), 0);
- if ( add_endpoint(endpoint, method, handler) ){
+ if ( add_endpoint(endpoint, method, handler) ) {
return 0x00;
}
coap_add_resource(server->ctx, endpoint->resource);
diff --git a/extensions/coap/protocols/CoapC2Protocol.h b/extensions/coap/protocols/CoapC2Protocol.h
index 8ad9acb..7f362e7 100644
--- a/extensions/coap/protocols/CoapC2Protocol.h
+++ b/extensions/coap/protocols/CoapC2Protocol.h
@@ -49,12 +49,12 @@ namespace coap {
namespace c2 {
#define REQUIRE_VALID(x) \
- if (-1 == x){ \
+ if (-1 == x) { \
return minifi::c2::C2Payload(payload.getOperation(), state::UpdateState::READ_ERROR); \
}
-#define REQUIRE_SIZE_IF(y,x) \
- if (y != x){ \
+#define REQUIRE_SIZE_IF(y, x) \
+ if (y != x) { \
return minifi::c2::C2Payload(payload.getOperation(), state::UpdateState::READ_ERROR); \
}
diff --git a/extensions/coap/server/CoapServer.cpp b/extensions/coap/server/CoapServer.cpp
index 9f925de..df43b86 100644
--- a/extensions/coap/server/CoapServer.cpp
+++ b/extensions/coap/server/CoapServer.cpp
@@ -29,7 +29,7 @@ std::map<coap_resource_t*, std::function<CoapResponse(CoapQuery)>> CoapServer::f
CoapServer::~CoapServer() {
running_ = false;
future.get();
- if(server_){
+ if (server_) {
free_server(server_);
}
}
diff --git a/extensions/coap/tests/CoapC2VerifyHeartbeat.cpp b/extensions/coap/tests/CoapC2VerifyHeartbeat.cpp
index eeced40..25c86ce 100644
--- a/extensions/coap/tests/CoapC2VerifyHeartbeat.cpp
+++ b/extensions/coap/tests/CoapC2VerifyHeartbeat.cpp
@@ -112,7 +112,7 @@ class VerifyCoAPServer : public CoapIntegrationBase {
server->add_endpoint(minifi::coap::Method::Post, [](minifi::coap::CoapQuery)->minifi::coap::CoapResponse {
- minifi::coap::CoapResponse response(205,0x00,0);
+ minifi::coap::CoapResponse response(205, 0x00, 0);
return response;
});
@@ -149,12 +149,12 @@ class VerifyCoAPServer : public CoapIntegrationBase {
server->add_endpoint("heartbeat", minifi::coap::Method::Post, [&](minifi::coap::CoapQuery)-> minifi::coap::CoapResponse {
if (responses.size_approx() > 0) {
- minifi::coap::CoapResponse resp(500,0,0);;
+ minifi::coap::CoapResponse resp(500, 0, 0);;
responses.try_dequeue(resp);
return resp;
}
else {
- minifi::coap::CoapResponse response(500,0,0);
+ minifi::coap::CoapResponse response(500, 0, 0);
return response;
}
});
diff --git a/extensions/expression-language/tests/ExpressionLanguageTests.cpp b/extensions/expression-language/tests/ExpressionLanguageTests.cpp
index 75a2e75..91eefdb 100644
--- a/extensions/expression-language/tests/ExpressionLanguageTests.cpp
+++ b/extensions/expression-language/tests/ExpressionLanguageTests.cpp
@@ -1553,17 +1553,17 @@ TEST_CASE("resolve_user_id_test", "[resolve_user_id tests]") { // NOLINT
auto flow_file_a = std::make_shared<core::FlowFile>();
- SECTION("TEST 0"){
+ SECTION("TEST 0") {
flow_file_a->addAttribute("attribute_sid", "0");
REQUIRE("0" == expr({flow_file_a}).asString());
}
- SECTION("TEST abcd"){
+ SECTION("TEST abcd") {
flow_file_a->addAttribute("attribute_sid", "abcd");
REQUIRE("abcd" == expr({flow_file_a}).asString());
}
- SECTION("TEST empty"){
+ SECTION("TEST empty") {
flow_file_a->addAttribute("attribute_sid", "");
REQUIRE("" == expr({flow_file_a}).asString());
}
diff --git a/extensions/http-curl/HTTPCurlLoader.h b/extensions/http-curl/HTTPCurlLoader.h
index 3f10b88..768d34d 100644
--- a/extensions/http-curl/HTTPCurlLoader.h
+++ b/extensions/http-curl/HTTPCurlLoader.h
@@ -54,18 +54,18 @@ class HttpCurlObjectFactory : public core::ObjectFactory {
* Gets the name of the object.
* @return class name of processor
*/
- std::string getName() override{
+ std::string getName() override {
return "HttpCurlObjectFactory";
}
- std::string getClassName() override{
+ std::string getClassName() override {
return "HttpCurlObjectFactory";
}
/**
* Gets the class name for the object
* @return class name for the processor.
*/
- std::vector<std::string> getClassNames() override{
+ std::vector<std::string> getClassNames() override {
std::vector<std::string> class_names;
class_names.push_back("HttpProtocol");
class_names.push_back("RESTSender");
@@ -75,7 +75,7 @@ class HttpCurlObjectFactory : public core::ObjectFactory {
return class_names;
}
- std::unique_ptr<ObjectFactory> assign(const std::string &class_name) override{
+ std::unique_ptr<ObjectFactory> assign(const std::string &class_name) override {
if (utils::StringUtils::equalsIgnoreCase(class_name, "RESTSender")) {
return std::unique_ptr<ObjectFactory>(new core::DefautObjectFactory<minifi::c2::RESTSender>());
} else if (utils::StringUtils::equalsIgnoreCase(class_name, "InvokeHTTP")) {
@@ -89,7 +89,7 @@ class HttpCurlObjectFactory : public core::ObjectFactory {
}
}
- std::unique_ptr<core::ObjectFactoryInitializer> getInitializer() override{
+ std::unique_ptr<core::ObjectFactoryInitializer> getInitializer() override {
return std::unique_ptr<core::ObjectFactoryInitializer>(new HttpCurlObjectFactoryInitializer());
}
diff --git a/extensions/http-curl/client/HTTPClient.cpp b/extensions/http-curl/client/HTTPClient.cpp
index 1e3d954..043bae1 100644
--- a/extensions/http-curl/client/HTTPClient.cpp
+++ b/extensions/http-curl/client/HTTPClient.cpp
@@ -262,7 +262,7 @@ bool HTTPClient::submit() {
curl_easy_setopt(http_session_, CURLOPT_NOPROGRESS, 0);
curl_easy_setopt(http_session_, CURLOPT_XFERINFOFUNCTION, onProgress);
curl_easy_setopt(http_session_, CURLOPT_XFERINFODATA, (void*)this);
- }else{
+ } else {
// the user explicitly set it to 0
curl_easy_setopt(http_session_, CURLOPT_NOPROGRESS, 1);
}
@@ -288,7 +288,7 @@ bool HTTPClient::submit() {
curl_easy_setopt(http_session_, CURLOPT_TCP_KEEPINTVL, keepAlive.count());
curl_easy_setopt(http_session_, CURLOPT_TCP_KEEPIDLE, keepIdle.count());
}
- else{
+ else {
logger_->log_debug("Not using keep alive");
curl_easy_setopt(http_session_, CURLOPT_TCP_KEEPALIVE, 0L);
}
@@ -350,11 +350,11 @@ void HTTPClient::set_request_method(const std::string method) {
}
}
-int HTTPClient::onProgress(void *clientp, curl_off_t /*dltotal*/, curl_off_t dlnow, curl_off_t /*ultotal*/, curl_off_t ulnow){
+int HTTPClient::onProgress(void *clientp, curl_off_t /*dltotal*/, curl_off_t dlnow, curl_off_t /*ultotal*/, curl_off_t ulnow) {
HTTPClient& client = *(HTTPClient*)(clientp);
auto now = std::chrono::steady_clock::now();
auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(now - client.progress_.last_transferred_);
- if(dlnow != client.progress_.downloaded_data_ || ulnow != client.progress_.uploaded_data_){
+ if (dlnow != client.progress_.downloaded_data_ || ulnow != client.progress_.uploaded_data_) {
// did transfer data
client.progress_.last_transferred_ = now;
client.progress_.downloaded_data_ = dlnow;
@@ -362,7 +362,7 @@ int HTTPClient::onProgress(void *clientp, curl_off_t /*dltotal*/, curl_off_t dln
return 0;
}
// did not transfer data
- if(elapsed.count() > client.read_timeout_ms_.count()){
+ if (elapsed.count() > client.read_timeout_ms_.count()) {
// timeout
client.logger_->log_error("HTTP operation has been idle for %dms, limit (%dms) reached, terminating connection\n",
(int)elapsed.count(), (int)client.read_timeout_ms_.count());
@@ -388,7 +388,7 @@ void HTTPClient::configure_secure_connection(CURL *http_session) {
logger_->log_debug("Using CA certificate file \"%s\"", ssl_context_service_->getCACertificate());
#if 0 // Reenable this path once we change from the direct manipulation of the SSL context to using the cURL API
if (!ssl_context_service_->getCertificateFile().empty()) {
- if (utils::StringUtils::endsWithIgnoreCase(ssl_context_service_->getCertificateFile(),"p12")) {
+ if (utils::StringUtils::endsWithIgnoreCase(ssl_context_service_->getCertificateFile(), "p12")) {
curl_easy_setopt(http_session, CURLOPT_SSLCERTTYPE, "P12");
}
else {
@@ -397,7 +397,7 @@ void HTTPClient::configure_secure_connection(CURL *http_session) {
curl_easy_setopt(http_session, CURLOPT_SSLCERT, ssl_context_service_->getCertificateFile().c_str());
}
if (!ssl_context_service_->getPrivateKeyFile().empty()) {
- if (utils::StringUtils::endsWithIgnoreCase(ssl_context_service_->getPrivateKeyFile(),"p12")) {
+ if (utils::StringUtils::endsWithIgnoreCase(ssl_context_service_->getPrivateKeyFile(), "p12")) {
curl_easy_setopt(http_session, CURLOPT_SSLKEYTYPE, "P12");
}
else {
diff --git a/extensions/http-curl/client/HTTPClient.h b/extensions/http-curl/client/HTTPClient.h
index b8ebd15..0b424b0 100644
--- a/extensions/http-curl/client/HTTPClient.h
+++ b/extensions/http-curl/client/HTTPClient.h
@@ -154,12 +154,12 @@ class HTTPClient : public BaseHTTPClient, public core::Connectable {
keep_alive_idle_ = std::chrono::milliseconds(idle * 1000);
}
- void setKeepAliveProbe(std::chrono::milliseconds probe){
+ void setKeepAliveProbe(std::chrono::milliseconds probe) {
keep_alive_probe_ = probe;
}
- void setKeepAliveIdle(std::chrono::milliseconds idle){
- keep_alive_idle_= idle;
+ void setKeepAliveIdle(std::chrono::milliseconds idle) {
+ keep_alive_idle_ = idle;
}
diff --git a/extensions/http-curl/protocols/RESTReceiver.cpp b/extensions/http-curl/protocols/RESTReceiver.cpp
index 8da78eb..5f20e3b 100644
--- a/extensions/http-curl/protocols/RESTReceiver.cpp
+++ b/extensions/http-curl/protocols/RESTReceiver.cpp
@@ -48,9 +48,9 @@ void RESTReceiver::initialize(core::controller::ControllerServiceProvider* contr
HeartBeatReporter::initialize(controller, updateSink, configure);
logger_->log_trace("Initializing rest receiver");
if (nullptr != configuration_) {
- std::string listeningPort,rootUri="/", caCert;
- configuration_->get("nifi.c2.rest.listener.port","c2.rest.listener.port", listeningPort);
- configuration_->get("nifi.c2.rest.listener.cacert","c2.rest.listener.cacert", caCert);
+ std::string listeningPort, rootUri = "/", caCert;
+ configuration_->get("nifi.c2.rest.listener.port", "c2.rest.listener.port", listeningPort);
+ configuration_->get("nifi.c2.rest.listener.cacert", "c2.rest.listener.cacert", caCert);
if (!listeningPort.empty() && !rootUri.empty()) {
handler = std::unique_ptr<ListeningProtocol>(new ListeningProtocol());
if (!caCert.empty()) {
diff --git a/extensions/http-curl/protocols/RESTSender.h b/extensions/http-curl/protocols/RESTSender.h
index 53cf145..02ef9fb 100644
--- a/extensions/http-curl/protocols/RESTSender.h
+++ b/extensions/http-curl/protocols/RESTSender.h
@@ -68,7 +68,7 @@ class RESTSender : public RESTProtocol, public C2Protocol {
* @param type type of HTTP request
* @param url HTTP url
*/
- void setSecurityContext(utils::HTTPClient &client,const std::string &type, const std::string &url);
+ void setSecurityContext(utils::HTTPClient &client, const std::string &type, const std::string &url);
std::shared_ptr<minifi::controllers::SSLContextService> ssl_context_service_;
diff --git a/extensions/http-curl/sitetosite/HTTPTransaction.h b/extensions/http-curl/sitetosite/HTTPTransaction.h
index 0390d93..a88cdf8 100644
--- a/extensions/http-curl/sitetosite/HTTPTransaction.h
+++ b/extensions/http-curl/sitetosite/HTTPTransaction.h
@@ -41,7 +41,7 @@ class HttpTransaction : public sitetosite::Transaction {
client_ref_(nullptr) {
}
- ~HttpTransaction(){
+ ~HttpTransaction() {
auto stream = dynamic_cast< org::apache::nifi::minifi::io::HttpStream*>(dynamic_cast<SiteToSitePeer*>(crcStream.getstream())->getStream() );
if (stream)
stream->forceClose();
@@ -53,7 +53,7 @@ class HttpTransaction : public sitetosite::Transaction {
}
- const std::string &getTransactionUrl(){
+ const std::string &getTransactionUrl() {
return transaction_url_;
}
protected:
diff --git a/extensions/http-curl/tests/HTTPHandlers.h b/extensions/http-curl/tests/HTTPHandlers.h
index 3a745fb..e410f3b 100644
--- a/extensions/http-curl/tests/HTTPHandlers.h
+++ b/extensions/http-curl/tests/HTTPHandlers.h
@@ -215,7 +215,7 @@ class FlowFileResponder : public ServerAwareHandler {
int read;
uint64_t total_size = 0;
read = stream.read(num_attributes);
- if(!isServerRunning())return false;
+ if (!isServerRunning())return false;
assert(read > 0); total_size += read;
auto flow = std::make_shared<FlowObj>();
@@ -223,16 +223,16 @@ class FlowFileResponder : public ServerAwareHandler {
for (uint32_t i = 0; i < num_attributes; i++) {
std::string name, value;
read = stream.read(name, true);
- if(!isServerRunning())return false;
+ if (!isServerRunning())return false;
assert(read > 0); total_size += read;
read = stream.read(value, true);
- if(!isServerRunning())return false;
+ if (!isServerRunning())return false;
assert(read > 0); total_size += read;
flow->attributes[name] = value;
}
uint64_t length;
read = stream.read(length);
- if(!isServerRunning())return false;
+ if (!isServerRunning())return false;
assert(read > 0); total_size += read;
total_size += length;
@@ -240,7 +240,7 @@ class FlowFileResponder : public ServerAwareHandler {
flow->total_size = total_size;
read = stream.read(flow->data.data(), gsl::narrow<int>(length));
- if(!isServerRunning())return false;
+ if (!isServerRunning())return false;
assert(read == gsl::narrow<int>(length));
if (!invalid_checksum) {
diff --git a/extensions/http-curl/tests/HTTPIntegrationBase.h b/extensions/http-curl/tests/HTTPIntegrationBase.h
index 7a1392c..4e3080d 100644
--- a/extensions/http-curl/tests/HTTPIntegrationBase.h
+++ b/extensions/http-curl/tests/HTTPIntegrationBase.h
@@ -231,7 +231,7 @@ class VerifyC2UpdateAgent : public VerifyC2Update {
void configureC2() override {
VerifyC2Update::configureC2();
- configuration->set("nifi.c2.agent.update.allow","true");
+ configuration->set("nifi.c2.agent.update.allow", "true");
configuration->set("c2.agent.update.command", "echo \"verification command\"");
}
diff --git a/extensions/http-curl/tests/HTTPSiteToSiteTests.cpp b/extensions/http-curl/tests/HTTPSiteToSiteTests.cpp
index fba5f00..ad4ad11 100644
--- a/extensions/http-curl/tests/HTTPSiteToSiteTests.cpp
+++ b/extensions/http-curl/tests/HTTPSiteToSiteTests.cpp
@@ -120,7 +120,7 @@ void run_variance(std::string test_file_location, bool isSecure, std::string url
std::string basesitetosite = url + "/site-to-site";
SiteToSiteBaseResponder *base = new SiteToSiteBaseResponder(basesitetosite);
- harness.setUrl(basesitetosite,base);
+ harness.setUrl(basesitetosite, base);
harness.setUrl(controller_loc, responder);
diff --git a/extensions/http-curl/tests/ServerAwareHandler.h b/extensions/http-curl/tests/ServerAwareHandler.h
index 8aaaf75..910383d 100644
--- a/extensions/http-curl/tests/ServerAwareHandler.h
+++ b/extensions/http-curl/tests/ServerAwareHandler.h
@@ -31,7 +31,7 @@ protected:
}
public:
- void stop(){
+ void stop() {
terminate_ = true;
stop_signal_.notify_all();
}
diff --git a/extensions/http-curl/tests/TimeoutHTTPSiteToSiteTests.cpp b/extensions/http-curl/tests/TimeoutHTTPSiteToSiteTests.cpp
index ec2b349..b5e5ffe 100644
--- a/extensions/http-curl/tests/TimeoutHTTPSiteToSiteTests.cpp
+++ b/extensions/http-curl/tests/TimeoutHTTPSiteToSiteTests.cpp
@@ -79,7 +79,7 @@ protected:
struct defaulted_handler{
ServerAwareHandler* handler = nullptr;
ServerAwareHandler* get(ServerAwareHandler *def) const {
- if(handler)return handler;
+ if (handler)return handler;
return def;
}
void set(std::vector<std::chrono::milliseconds>&& timeout) {
diff --git a/extensions/jni/JNIUtil.h b/extensions/jni/JNIUtil.h
index a8240c6..f3277fc 100644
--- a/extensions/jni/JNIUtil.h
+++ b/extensions/jni/JNIUtil.h
@@ -23,11 +23,11 @@
#include <jni.h>
static inline std::string JniStringToUTF(JNIEnv *env, const jstring &jstr) {
- if(!jstr && !env) {
+ if (!jstr && !env) {
return "";
}
const char * c_str = env->GetStringUTFChars(jstr, NULL);
- if(c_str == NULL) {
+ if (c_str == NULL) {
return "";
}
std::string str = c_str;
diff --git a/extensions/jni/JavaException.h b/extensions/jni/JavaException.h
index 4ef36bb..271bfcf 100644
--- a/extensions/jni/JavaException.h
+++ b/extensions/jni/JavaException.h
@@ -110,8 +110,8 @@ static inline void ThrowJava(JNIEnv *env, const char *message) {
* MACROS can make code look worse and more difficult to develop -- but this is a simple
* if that has no contrary result path.
*/
-#define THROW_IF_NULL(expr, env, message) if (UNLIKELY(expr == nullptr)) minifi::jni::ThrowJava(env,message)
+#define THROW_IF_NULL(expr, env, message) if (UNLIKELY(expr == nullptr)) minifi::jni::ThrowJava(env, message)
-#define THROW_IF(expr, env, message) if (UNLIKELY(expr)) minifi::jni::ThrowJava(env,message)
+#define THROW_IF(expr, env, message) if (UNLIKELY(expr)) minifi::jni::ThrowJava(env, message)
#endif
diff --git a/extensions/jni/jvm/JVMLoader.h b/extensions/jni/jvm/JVMLoader.h
index 646ac43..11560f2 100644
--- a/extensions/jni/jvm/JVMLoader.h
+++ b/extensions/jni/jvm/JVMLoader.h
@@ -111,7 +111,7 @@ class JVMLoader {
return jenv;
}
- void detach(){
+ void detach() {
jvm_->DetachCurrentThread();
}
diff --git a/extensions/jni/jvm/JniMethod.h b/extensions/jni/jvm/JniMethod.h
index 045cba4..1042cc9 100644
--- a/extensions/jni/jvm/JniMethod.h
+++ b/extensions/jni/jvm/JniMethod.h
@@ -100,7 +100,7 @@ class JavaSignatures {
if (method_ptr_ == nullptr || size_ != methods_.size()) {
method_ptr_ = std::unique_ptr<JNINativeMethod[]>(new JNINativeMethod[methods_.size()]);
size_ = methods_.size();
- for(std::size_t i=0; i < methods_.size(); i++) {
+ for (std::size_t i = 0; i < methods_.size(); i++) {
method_ptr_[i].fnPtr = const_cast<void*>(methods_[i].getPointer());
method_ptr_[i].name = const_cast<char*>(methods_[i].getName());
method_ptr_[i].signature = const_cast<char*>(methods_[i].getParameters());
diff --git a/extensions/libarchive/ArchiveLoader.h b/extensions/libarchive/ArchiveLoader.h
index 005745a..79eed4e 100644
--- a/extensions/libarchive/ArchiveLoader.h
+++ b/extensions/libarchive/ArchiveLoader.h
@@ -59,11 +59,11 @@ class ArchiveFactory : public core::ObjectFactory {
return std::unique_ptr<ObjectFactory>(new core::DefautObjectFactory<minifi::processors::MergeContent>());
} else if (utils::StringUtils::equalsIgnoreCase(class_name, "CompressContent")) {
return std::unique_ptr<ObjectFactory>(new core::DefautObjectFactory<minifi::processors::CompressContent>());
- } else if (utils::StringUtils::equalsIgnoreCase(class_name,"FocusArchiveEntry")) {
+ } else if (utils::StringUtils::equalsIgnoreCase(class_name, "FocusArchiveEntry")) {
return std::unique_ptr<ObjectFactory>(new core::DefautObjectFactory<minifi::processors::FocusArchiveEntry>());
- } else if (utils::StringUtils::equalsIgnoreCase(class_name,"UnfocusArchiveEntry")) {
+ } else if (utils::StringUtils::equalsIgnoreCase(class_name, "UnfocusArchiveEntry")) {
return std::unique_ptr<ObjectFactory>(new core::DefautObjectFactory<minifi::processors::UnfocusArchiveEntry>());
- } else if (utils::StringUtils::equalsIgnoreCase(class_name,"ManipulateArchive")) {
+ } else if (utils::StringUtils::equalsIgnoreCase(class_name, "ManipulateArchive")) {
return std::unique_ptr<ObjectFactory>(new core::DefautObjectFactory<minifi::processors::ManipulateArchive>());
} else {
return nullptr;
diff --git a/extensions/libarchive/ArchiveTests.h b/extensions/libarchive/ArchiveTests.h
index 6d1698f..333abf4 100644
--- a/extensions/libarchive/ArchiveTests.h
+++ b/extensions/libarchive/ArchiveTests.h
@@ -60,7 +60,7 @@ OrderedTestArchive build_ordered_test_archive(int, const char**, const char**);
void build_test_archive(std::string, TAE_MAP_T entries, FN_VEC_T order = FN_VEC_T());
void build_test_archive(std::string, OrderedTestArchive);
-bool check_archive_contents(std::string, TAE_MAP_T entries, bool check_attributes=true, FN_VEC_T order = FN_VEC_T());
-bool check_archive_contents(std::string, OrderedTestArchive, bool check_attributes=true);
+bool check_archive_contents(std::string, TAE_MAP_T entries, bool check_attributes = true, FN_VEC_T order = FN_VEC_T());
+bool check_archive_contents(std::string, OrderedTestArchive, bool check_attributes = true);
#endif
diff --git a/extensions/libarchive/ManipulateArchive.cpp b/extensions/libarchive/ManipulateArchive.cpp
index abe2380..2a21577 100644
--- a/extensions/libarchive/ManipulateArchive.cpp
+++ b/extensions/libarchive/ManipulateArchive.cpp
@@ -81,7 +81,7 @@ void ManipulateArchive::onSchedule(core::ProcessContext *context, core::ProcessS
operation_ == OPERATION_TOUCH;
// Operation must be one of copy, move, touch or remove
- if(!op_create && (operation_ != OPERATION_REMOVE)) {
+ if (!op_create && (operation_ != OPERATION_REMOVE)) {
logger_->log_error("Invalid operation %s for ManipulateArchive.", operation_);
invalid = true;
}
@@ -92,24 +92,24 @@ void ManipulateArchive::onSchedule(core::ProcessContext *context, core::ProcessS
context->getProperty(After.getName(), after_);
// All operations which create new entries require a set destination
- if(op_create == destination_.empty()) {
+ if (op_create == destination_.empty()) {
logger_->log_error("ManipulateArchive requires a destination for %s.", operation_);
invalid = true;
}
// The only operation that doesn't require an existing target is touch
- if((operation_ == OPERATION_TOUCH) != targetEntry_.empty()) {
+ if ((operation_ == OPERATION_TOUCH) != targetEntry_.empty()) {
logger_->log_error("ManipulateArchive requires a target for %s.", operation_);
invalid = true;
}
// Users may specify one or none of before or after, but never both.
- if(before_.size() && after_.size()) {
+ if (before_.size() && after_.size()) {
logger_->log_error("ManipulateArchive: cannot specify both before and after.");
invalid = true;
}
- if(invalid) {
+ if (invalid) {
throw Exception(GENERAL_EXCEPTION, "Invalid ManipulateArchive configuration");
}
}
diff --git a/extensions/libarchive/MergeContent.cpp b/extensions/libarchive/MergeContent.cpp
index d41b61f..9923fe0 100644
--- a/extensions/libarchive/MergeContent.cpp
+++ b/extensions/libarchive/MergeContent.cpp
@@ -425,13 +425,13 @@ void KeepOnlyCommonAttributesMerger::processFlowFile(const std::shared_ptr<core:
void KeepAllUniqueAttributesMerger::processFlowFile(const std::shared_ptr<core::FlowFile> &flow_file, std::map<std::string, std::string> &merged_attributes) {
auto flow_attributes = flow_file->getAttributes();
for (auto&& attr : flow_attributes) {
- if(std::find(removed_attributes_.cbegin(), removed_attributes_.cend(), attr.first) != removed_attributes_.cend()) {
+ if (std::find(removed_attributes_.cbegin(), removed_attributes_.cend(), attr.first) != removed_attributes_.cend()) {
continue;
}
std::map<std::string, std::string>::iterator insertion_res;
bool insertion_happened;
std::tie(insertion_res, insertion_happened) = merged_attributes.insert(attr);
- if(!insertion_happened && insertion_res->second != attr.second) {
+ if (!insertion_happened && insertion_res->second != attr.second) {
merged_attributes.erase(insertion_res);
removed_attributes_.push_back(attr.first);
}
diff --git a/extensions/libarchive/UnfocusArchiveEntry.h b/extensions/libarchive/UnfocusArchiveEntry.h
index 0ced070..a4a38bb 100644
--- a/extensions/libarchive/UnfocusArchiveEntry.h
+++ b/extensions/libarchive/UnfocusArchiveEntry.h
@@ -51,7 +51,7 @@ class UnfocusArchiveEntry : public core::Processor {
*/
explicit UnfocusArchiveEntry(const std::string& name, const utils::Identifier& uuid = {})
: core::Processor(name, uuid),
- logger_(logging::LoggerFactory<UnfocusArchiveEntry>::getLogger()){
+ logger_(logging::LoggerFactory<UnfocusArchiveEntry>::getLogger()) {
}
//! Destructor
virtual ~UnfocusArchiveEntry() = default;
diff --git a/extensions/mqtt/processors/ConsumeMQTT.cpp b/extensions/mqtt/processors/ConsumeMQTT.cpp
index 9529afb..fdde744 100644
--- a/extensions/mqtt/processors/ConsumeMQTT.cpp
+++ b/extensions/mqtt/processors/ConsumeMQTT.cpp
@@ -84,7 +84,7 @@ void ConsumeMQTT::onSchedule(const std::shared_ptr<core::ProcessContext> &contex
void ConsumeMQTT::onTrigger(const std::shared_ptr<core::ProcessContext>& /*context*/, const std::shared_ptr<core::ProcessSession> &session) {
// reconnect if necessary
- if(!reconnect()) {
+ if (!reconnect()) {
yield();
}
diff --git a/extensions/mqtt/processors/ConvertHeartBeat.cpp b/extensions/mqtt/processors/ConvertHeartBeat.cpp
index 63e17ee..78c4e10 100644
--- a/extensions/mqtt/processors/ConvertHeartBeat.cpp
+++ b/extensions/mqtt/processors/ConvertHeartBeat.cpp
@@ -36,7 +36,7 @@ namespace processors {
void ConvertHeartBeat::onTrigger(const std::shared_ptr<core::ProcessContext> &context, const std::shared_ptr<core::ProcessSession> &session) {
auto ff = session.get();
- if (ff != nullptr){
+ if (ff != nullptr) {
logger_->log_error("ConvertHeartBeat does not receive flow files");
session->rollback();
}
diff --git a/extensions/mqtt/processors/ConvertJSONAck.cpp b/extensions/mqtt/processors/ConvertJSONAck.cpp
index e6d54f7..57f6c9e 100644
--- a/extensions/mqtt/processors/ConvertJSONAck.cpp
+++ b/extensions/mqtt/processors/ConvertJSONAck.cpp
@@ -93,10 +93,10 @@ void ConvertJSONAck::onTrigger(const std::shared_ptr<core::ProcessContext> &cont
c2::C2Payload response_payload(c2::Operation::HEARTBEAT, state::UpdateState::READ_COMPLETE, true);
- std::string str(callback.buffer_.data(),callback.buffer_.size());
+ std::string str(callback.buffer_.data(), callback.buffer_.size());
auto payload = parseJsonResponse(response_payload, callback.buffer_);
- auto stream = c2::PayloadSerializer::serialize(1,payload);
+ auto stream = c2::PayloadSerializer::serialize(1, payload);
mqtt_service_->send(topic, stream->getBuffer(), stream->size());
}
diff --git a/extensions/opc/include/opc.h b/extensions/opc/include/opc.h
index c4fe45a..2cffe5a 100644
--- a/extensions/opc/include/opc.h
+++ b/extensions/opc/include/opc.h
@@ -89,8 +89,8 @@ struct NodeData {
uint16_t dataTypeID;
std::map<std::string, std::string> attributes;
- virtual ~NodeData(){
- if(var_) {
+ virtual ~NodeData() {
+ if (var_) {
UA_Variant_delete(var_);
}
}
@@ -112,7 +112,7 @@ struct NodeData {
var_ = var;
}
void addVariant(UA_Variant * var) {
- if(var_) {
+ if (var_) {
UA_Variant_delete(var_);
}
var_ = var;
diff --git a/extensions/opc/src/fetchopc.cpp b/extensions/opc/src/fetchopc.cpp
index c9366a4..b8ce1fd 100644
--- a/extensions/opc/src/fetchopc.cpp
+++ b/extensions/opc/src/fetchopc.cpp
@@ -114,7 +114,7 @@ namespace processors {
throw Exception(PROCESS_SCHEDULE_EXCEPTION, error_msg);
}
- if(idType_ == opc::OPCNodeIDType::Int) {
+ if (idType_ == opc::OPCNodeIDType::Int) {
try {
std::stoi(nodeID_);
} catch(...) {
@@ -122,8 +122,8 @@ namespace processors {
throw Exception(PROCESS_SCHEDULE_EXCEPTION, error_msg);
}
}
- if(idType_ != opc::OPCNodeIDType::Path) {
- if(!context->getProperty(NameSpaceIndex.getName(), nameSpaceIdx_)) {
+ if (idType_ != opc::OPCNodeIDType::Path) {
+ if (!context->getProperty(NameSpaceIndex.getName(), nameSpaceIdx_)) {
auto error_msg = utils::StringUtils::join_pack(NameSpaceIndex.getName(), " is mandatory in case ", NodeIDType.getName(), " is not Path");
throw Exception(PROCESS_SCHEDULE_EXCEPTION, error_msg);
}
@@ -133,11 +133,11 @@ namespace processors {
lazy_mode_ = value == "On" ? true : false;
}
- void FetchOPCProcessor::onTrigger(const std::shared_ptr<core::ProcessContext> &context, const std::shared_ptr<core::ProcessSession> &session){
+ void FetchOPCProcessor::onTrigger(const std::shared_ptr<core::ProcessContext> &context, const std::shared_ptr<core::ProcessSession> &session) {
logger_->log_trace("FetchOPCProcessor::onTrigger");
std::unique_lock<std::mutex> lock(onTriggerMutex_, std::try_to_lock);
- if(!lock.owns_lock()){
+ if (!lock.owns_lock()) {
logger_->log_warn("processor was triggered before previous listing finished, configuration should be revised!");
return;
}
@@ -151,10 +151,10 @@ namespace processors {
variablesFound_ = 0;
std::function<opc::nodeFoundCallBackFunc> f = std::bind(&FetchOPCProcessor::nodeFoundCallBack, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, context, session);
- if(idType_ != opc::OPCNodeIDType::Path) {
+ if (idType_ != opc::OPCNodeIDType::Path) {
UA_NodeId myID;
myID.namespaceIndex = nameSpaceIdx_;
- if(idType_ == opc::OPCNodeIDType::Int) {
+ if (idType_ == opc::OPCNodeIDType::Int) {
myID.identifierType = UA_NODEIDTYPE_NUMERIC;
myID.identifier.numeric = std::stoi(nodeID_);
} else if (idType_ == opc::OPCNodeIDType::String) {
@@ -163,19 +163,19 @@ namespace processors {
}
connection_->traverse(myID, f, "", maxDepth_);
} else {
- if(translatedNodeIDs_.empty()) {
+ if (translatedNodeIDs_.empty()) {
auto sc = connection_->translateBrowsePathsToNodeIdsRequest(nodeID_, translatedNodeIDs_, logger_);
- if(sc != UA_STATUSCODE_GOOD) {
+ if (sc != UA_STATUSCODE_GOOD) {
logger_->log_error("Failed to translate %s to node id, no flow files will be generated (%s)", nodeID_.c_str(), UA_StatusCode_name(sc));
yield();
return;
}
}
- for(auto& nodeID: translatedNodeIDs_) {
+ for (auto& nodeID : translatedNodeIDs_) {
connection_->traverse(nodeID, f, nodeID_, maxDepth_);
}
}
- if(nodesFound_ == 0) {
+ if (nodesFound_ == 0) {
logger_->log_warn("Connected to OPC server, but no variable nodes were found. Configuration might be incorrect! Yielding...");
yield();
} else if (variablesFound_ == 0) {
@@ -187,7 +187,7 @@ namespace processors {
bool FetchOPCProcessor::nodeFoundCallBack(opc::Client& /*client*/, const UA_ReferenceDescription *ref, const std::string& path,
const std::shared_ptr<core::ProcessContext> &context, const std::shared_ptr<core::ProcessSession> &session) {
nodesFound_++;
- if(ref->nodeClass == UA_NODECLASS_VARIABLE) {
+ if (ref->nodeClass == UA_NODECLASS_VARIABLE) {
try {
opc::NodeData nodedata = connection_->getNodeData(ref, path);
bool write = true;
@@ -220,10 +220,10 @@ namespace processors {
logger_->log_error("Failed to create flowfile!");
return;
}
- for(const auto& attr: opcnode.attributes) {
+ for (const auto& attr : opcnode.attributes) {
flowFile->setAttribute(attr.first, attr.second);
}
- if(opcnode.data.size() > 0) {
+ if (opcnode.data.size() > 0) {
try {
FetchOPCProcessor::WriteCallback callback(opc::nodeValue2String(opcnode));
session->write(flowFile, &callback);
diff --git a/extensions/opc/src/opc.cpp b/extensions/opc/src/opc.cpp
index 80bf92f..da86e79 100644
--- a/extensions/opc/src/opc.cpp
+++ b/extensions/opc/src/opc.cpp
@@ -165,7 +165,7 @@ Client::Client(std::shared_ptr<core::logging::Logger> logger, const std::string&
UA_ClientConfig *configPtr = UA_Client_getConfig(client_);
configPtr->logger = MinifiUALogger;
- if(applicationURI.length() > 0) {
+ if (applicationURI.length() > 0) {
UA_String_clear(&configPtr->clientDescription.applicationUri);
configPtr->clientDescription.applicationUri = UA_STRING_ALLOC(applicationURI.c_str());
}
@@ -174,12 +174,12 @@ Client::Client(std::shared_ptr<core::logging::Logger> logger, const std::string&
}
Client::~Client() {
- if(client_ == nullptr) {
+ if (client_ == nullptr) {
return;
}
- if(UA_Client_getState(client_) != UA_CLIENTSTATE_DISCONNECTED) {
+ if (UA_Client_getState(client_) != UA_CLIENTSTATE_DISCONNECTED) {
auto sc = UA_Client_disconnect(client_);
- if(sc != UA_STATUSCODE_GOOD) {
+ if (sc != UA_STATUSCODE_GOOD) {
logger_->log_warn("Failed to disconnect OPC client: %s", UA_StatusCode_name(sc));
}
}
@@ -187,7 +187,7 @@ Client::~Client() {
}
bool Client::isConnected() {
- if(!client_) {
+ if (!client_) {
return false;
}
return UA_Client_getState(client_) != UA_CLIENTSTATE_DISCONNECTED;
@@ -202,16 +202,16 @@ UA_StatusCode Client::connect(const std::string& url, const std::string& usernam
}
NodeData Client::getNodeData(const UA_ReferenceDescription *ref, const std::string& basePath) {
- if(ref->nodeClass == UA_NODECLASS_VARIABLE) {
+ if (ref->nodeClass == UA_NODECLASS_VARIABLE) {
opc::NodeData nodedata;
std::string browsename(reinterpret_cast<const char*>(ref->browseName.name.data), ref->browseName.name.length);
- if(ref->nodeId.nodeId.identifierType == UA_NODEIDTYPE_STRING) {
+ if (ref->nodeId.nodeId.identifierType == UA_NODEIDTYPE_STRING) {
std::string nodeidstr(reinterpret_cast<const char*>(ref->nodeId.nodeId.identifier.string.data),
ref->nodeId.nodeId.identifier.string.length);
nodedata.attributes["NodeID"] = nodeidstr;
nodedata.attributes["NodeID type"] = "string";
- } else if(ref->nodeId.nodeId.identifierType == UA_NODEIDTYPE_BYTESTRING) {
+ } else if (ref->nodeId.nodeId.identifierType == UA_NODEIDTYPE_BYTESTRING) {
std::string nodeidstr(reinterpret_cast<const char*>(ref->nodeId.nodeId.identifier.byteString.data), ref->nodeId.nodeId.identifier.byteString.length);
nodedata.attributes["NodeID"] = nodeidstr;
nodedata.attributes["NodeID type"] = "bytestring";
@@ -223,7 +223,7 @@ NodeData Client::getNodeData(const UA_ReferenceDescription *ref, const std::stri
nodedata.attributes["Full path"] = basePath + "/" + browsename;
nodedata.dataTypeID = UA_TYPES_COUNT;
UA_Variant* var = UA_Variant_new();
- if(UA_Client_readValueAttribute(client_, ref->nodeId.nodeId, var) == UA_STATUSCODE_GOOD && var->type != NULL && var->data != NULL) {
+ if (UA_Client_readValueAttribute(client_, ref->nodeId.nodeId, var) == UA_STATUSCODE_GOOD && var->type != NULL && var->data != NULL) {
// Because the timestamps are eliminated in readValueAttribute for simplification
// We need to call the inner function UA_Client_Service_read.
UA_ReadValueId item;
@@ -245,10 +245,10 @@ NodeData Client::getNodeData(const UA_ReferenceDescription *ref, const std::stri
nodedata.dataTypeID = var->type->typeIndex;
nodedata.addVariant(var);
- if(var->type->typeName) {
+ if (var->type->typeName) {
nodedata.attributes["Typename"] = std::string(var->type->typeName);
}
- if(var->type->memSize) {
+ if (var->type->memSize) {
nodedata.attributes["Datasize"] = std::to_string(var->type->memSize);
nodedata.data = std::vector<uint8_t>(var->type->memSize);
memcpy(nodedata.data.data(), var->data, var->type->memSize);
@@ -285,9 +285,9 @@ void Client::traverse(UA_NodeId nodeId, std::function<nodeFoundCallBackFunc> cb,
UA_ReferenceDescription_delete(rootRef);
}
- if(maxDepth != 0) {
+ if (maxDepth != 0) {
maxDepth--;
- if(maxDepth == 0) {
+ if (maxDepth == 0) {
return;
}
}
@@ -308,8 +308,8 @@ void Client::traverse(UA_NodeId nodeId, std::function<nodeFoundCallBackFunc> cb,
UA_BrowseRequest_deleteMembers(&bReq);
- for(size_t i = 0; i < bResp.resultsSize; ++i) {
- for(size_t j = 0; j < bResp.results[i].referencesSize; ++j) {
+ for (size_t i = 0; i < bResp.resultsSize; ++i) {
+ for (size_t j = 0; j < bResp.results[i].referencesSize; ++j) {
UA_ReferenceDescription *ref = &(bResp.results[i].references[j]);
if (cb(*this, ref, basePath)) {
if (ref->nodeClass == UA_NODECLASS_VARIABLE || ref->nodeClass == UA_NODECLASS_OBJECT) {
@@ -338,7 +338,7 @@ UA_StatusCode Client::translateBrowsePathsToNodeIdsRequest(const std::string& pa
auto tokens = utils::StringUtils::split(path, "/");
std::vector<UA_UInt32> ids;
- for(size_t i = 0; i < tokens.size(); ++i) {
+ for (size_t i = 0; i < tokens.size(); ++i) {
UA_UInt32 val = (i ==0) ? UA_NS0ID_ORGANIZES : UA_NS0ID_HASCOMPONENT;
ids.push_back(val);
}
@@ -350,7 +350,7 @@ UA_StatusCode Client::translateBrowsePathsToNodeIdsRequest(const std::string& pa
browsePath.relativePath.elements = (UA_RelativePathElement*)UA_Array_new(tokens.size(), &UA_TYPES[UA_TYPES_RELATIVEPATHELEMENT]);
browsePath.relativePath.elementsSize = tokens.size();
- for(size_t i = 0; i < tokens.size(); ++i) {
+ for (size_t i = 0; i < tokens.size(); ++i) {
UA_RelativePathElement *elem = &browsePath.relativePath.elements[i];
elem->referenceTypeId = UA_NODEID_NUMERIC(0, ids[i]);
elem->targetName = UA_QUALIFIEDNAME_ALLOC(0, tokens[i].c_str());
@@ -367,16 +367,16 @@ UA_StatusCode Client::translateBrowsePathsToNodeIdsRequest(const std::string& pa
UA_BrowsePath_deleteMembers(&browsePath);
});
- if(response.resultsSize < 1) {
+ if (response.resultsSize < 1) {
logger->log_warn("No node id in response for %s", path.c_str());
return UA_STATUSCODE_BADNODATAAVAILABLE;
}
bool foundData = false;
- for(size_t i = 0; i < response.resultsSize; ++i) {
+ for (size_t i = 0; i < response.resultsSize; ++i) {
UA_BrowsePathResult res = response.results[i];
- for(size_t j = 0; j < res.targetsSize; ++j) {
+ for (size_t j = 0; j < res.targetsSize; ++j) {
foundData = true;
UA_NodeId resultId;
UA_NodeId_copy(&res.targets[j].targetId.nodeId, &resultId);
@@ -387,7 +387,7 @@ UA_StatusCode Client::translateBrowsePathsToNodeIdsRequest(const std::string& pa
UA_TranslateBrowsePathsToNodeIdsResponse_deleteMembers(&response);
- if(foundData) {
+ if (foundData) {
logger->log_debug("Found %lu nodes for path %s", foundNodeIDs.size(), path.c_str());
return UA_STATUSCODE_GOOD;
} else {
@@ -454,7 +454,7 @@ template UA_StatusCode Client::add_node<const char *>(const UA_NodeId parentNode
template UA_StatusCode Client::add_node<std::string>(const UA_NodeId parentNodeId, const UA_NodeId targetNodeId, std::string browseName, std::string value, OPCNodeDataType dt, UA_NodeId *receivedNodeId);
int32_t OPCNodeDataTypeToTypeID(OPCNodeDataType dt) {
- switch(dt) {
+ switch (dt) {
case OPCNodeDataType::Boolean:
return UA_NS0ID_BOOLEAN;
case OPCNodeDataType::Int32:
@@ -532,7 +532,7 @@ std::string nodeValue2String(const NodeData& nd) {
ret_val = std::to_string(ui64t);
break;
case UA_TYPES_FLOAT:
- if(sizeof(float) == 4 && std::numeric_limits<float>::is_iec559){
+ if (sizeof(float) == 4 && std::numeric_limits<float>::is_iec559) {
float f;
memcpy(&f, nd.data.data(), sizeof(float));
ret_val = std::to_string(f);
@@ -541,7 +541,7 @@ std::string nodeValue2String(const NodeData& nd) {
}
break;
case UA_TYPES_DOUBLE:
- if(sizeof(double) == 8 && std::numeric_limits<double>::is_iec559){
+ if (sizeof(double) == 8 && std::numeric_limits<double>::is_iec559) {
double d;
memcpy(&d, nd.data.data(), sizeof(double));
ret_val = std::to_string(d);
diff --git a/extensions/opencv/OpenCVLoader.h b/extensions/opencv/OpenCVLoader.h
index 616172b..516b87f 100644
--- a/extensions/opencv/OpenCVLoader.h
+++ b/extensions/opencv/OpenCVLoader.h
@@ -45,24 +45,24 @@ class OpenCVObjectFactory : public core::ObjectFactory {
* Gets the name of the object.
* @return class name of processor
*/
- std::string getName() override{
+ std::string getName() override {
return "OpenCVObjectFactory";
}
- std::string getClassName() override{
+ std::string getClassName() override {
return "OpenCVObjectFactory";
}
/**
* Gets the class name for the object
* @return class name for the processor.
*/
- std::vector<std::string> getClassNames() override{
+ std::vector<std::string> getClassNames() override {
std::vector<std::string> class_names;
class_names.push_back("CaptureRTSPFrame");
return class_names;
}
- std::unique_ptr<ObjectFactory> assign(const std::string &class_name) override{
+ std::unique_ptr<ObjectFactory> assign(const std::string &class_name) override {
if (utils::StringUtils::equalsIgnoreCase(class_name, "CaptureRTSPFrame")) {
return std::unique_ptr<ObjectFactory>(new core::DefautObjectFactory<minifi::processors::CaptureRTSPFrame>());
} else {
diff --git a/extensions/pcap/CapturePacket.h b/extensions/pcap/CapturePacket.h
index 8e74003..860c549 100644
--- a/extensions/pcap/CapturePacket.h
+++ b/extensions/pcap/CapturePacket.h
@@ -73,7 +73,7 @@ class CapturePacketMechanism {
return file_;
}
- long getSize() const{
+ long getSize() const {
return atomic_count_;
}
protected:
diff --git a/extensions/pcap/PcapLoader.h b/extensions/pcap/PcapLoader.h
index 8b692fd..d361799 100644
--- a/extensions/pcap/PcapLoader.h
+++ b/extensions/pcap/PcapLoader.h
@@ -48,7 +48,7 @@ class PcapFactory : public core::ObjectFactory {
}
virtual std::unique_ptr<ObjectFactory> assign(const std::string &class_name) {
- if (utils::StringUtils::equalsIgnoreCase(class_name,"CapturePacket")) {
+ if (utils::StringUtils::equalsIgnoreCase(class_name, "CapturePacket")) {
return std::unique_ptr<ObjectFactory>(new core::DefautObjectFactory<processors::CapturePacket>());
} else {
return nullptr;
diff --git a/extensions/rocksdb-repos/FlowFileRepository.cpp b/extensions/rocksdb-repos/FlowFileRepository.cpp
index 0360143..29d415e 100644
--- a/extensions/rocksdb-repos/FlowFileRepository.cpp
+++ b/extensions/rocksdb-repos/FlowFileRepository.cpp
@@ -61,8 +61,8 @@ void FlowFileRepository::flush() {
auto multistatus = opendb->MultiGet(options, keys, &values);
- for(size_t i=0; i<keys.size() && i<values.size() && i<multistatus.size(); ++i) {
- if(!multistatus[i].ok()) {
+ for (size_t i = 0; i < keys.size() && i < values.size() && i < multistatus.size(); ++i) {
+ if (!multistatus[i].ok()) {
logger_->log_error("Failed to read key from rocksdb: %s! DB is most probably in an inconsistent state!", keys[i].data());
keystrings.remove(keys[i].data());
continue;
@@ -80,7 +80,7 @@ void FlowFileRepository::flush() {
auto operation = [&batch, &opendb]() { return opendb->Write(rocksdb::WriteOptions(), &batch); };
if (!ExecuteWithRetry(operation)) {
- for (const auto& key: keystrings) {
+ for (const auto& key : keystrings) {
keys_to_delete.enqueue(key); // Push back the values that we could get but couldn't delete
}
return; // Stop here - don't delete from content repo while we have records in FF repo
@@ -186,7 +186,7 @@ void FlowFileRepository::prune_stored_flowfiles() {
bool FlowFileRepository::ExecuteWithRetry(std::function<rocksdb::Status()> operation) {
int waitTime = 0;
- for (int i=0; i<3; ++i) {
+ for (int i=0; i < 3; ++i) {
auto status = operation();
if (status.ok()) {
logger_->log_trace("Rocksdb operation executed successfully");
@@ -203,7 +203,7 @@ bool FlowFileRepository::ExecuteWithRetry(std::function<rocksdb::Status()> opera
* Returns True if there is data to interrogate.
* @return true if our db has data stored.
*/
-bool FlowFileRepository::need_checkpoint(minifi::internal::OpenRocksDB& opendb){
+bool FlowFileRepository::need_checkpoint(minifi::internal::OpenRocksDB& opendb) {
auto it = opendb.NewIterator(rocksdb::ReadOptions());
it->SeekToFirst();
return it->Valid();
@@ -215,7 +215,7 @@ void FlowFileRepository::initialize_repository() {
return;
}
// first we need to establish a checkpoint iff it is needed.
- if (!need_checkpoint(*opendb)){
+ if (!need_checkpoint(*opendb)) {
logger_->log_trace("Do not need checkpoint");
return;
}
diff --git a/extensions/rocksdb-repos/FlowFileRepository.h b/extensions/rocksdb-repos/FlowFileRepository.h
index e76b0d0..2c1d8a4 100644
--- a/extensions/rocksdb-repos/FlowFileRepository.h
+++ b/extensions/rocksdb-repos/FlowFileRepository.h
@@ -141,7 +141,7 @@ class FlowFileRepository : public core::Repository, public std::enable_shared_fr
return false;
}
rocksdb::WriteBatch batch;
- for (const auto &item: data) {
+ for (const auto &item : data) {
rocksdb::Slice value((const char *) item.second->getBuffer(), item.second->size());
if (!batch.Put(item.first, value).ok()) {
logger_->log_error("Failed to add item to batch operation");
diff --git a/extensions/rocksdb-repos/ProvenanceRepository.cpp b/extensions/rocksdb-repos/ProvenanceRepository.cpp
index f9235d1..6cdb0c5 100644
--- a/extensions/rocksdb-repos/ProvenanceRepository.cpp
+++ b/extensions/rocksdb-repos/ProvenanceRepository.cpp
@@ -45,7 +45,7 @@ void ProvenanceRepository::run() {
count++;
// Hack, to be removed in scope of https://issues.apache.org/jira/browse/MINIFICPP-1145
count = count % 30;
- if(count == 0) {
+ if (count == 0) {
printStats();
}
}
diff --git a/extensions/rocksdb-repos/ProvenanceRepository.h b/extensions/rocksdb-repos/ProvenanceRepository.h
index 04df6d0..ee47dcb 100644
--- a/extensions/rocksdb-repos/ProvenanceRepository.h
+++ b/extensions/rocksdb-repos/ProvenanceRepository.h
@@ -38,7 +38,7 @@ namespace provenance {
class ProvenanceRepository : public core::Repository, public std::enable_shared_from_this<ProvenanceRepository> {
public:
ProvenanceRepository(const std::string& name, const utils::Identifier& /*uuid*/)
- : ProvenanceRepository(name){
+ : ProvenanceRepository(name) {
}
// Constructor
/*!
@@ -97,7 +97,7 @@ class ProvenanceRepository : public core::Repository, public std::enable_shared_
options.compaction_style = rocksdb::CompactionStyle::kCompactionStyleFIFO;
options.compaction_options_fifo = rocksdb::CompactionOptionsFIFO(max_partition_bytes_, false);
- if(max_partition_millis_ > 0) {
+ if (max_partition_millis_ > 0) {
options.ttl = max_partition_millis_ / 1000;
}
@@ -126,7 +126,7 @@ class ProvenanceRepository : public core::Repository, public std::enable_shared_
virtual bool MultiPut(const std::vector<std::pair<std::string, std::unique_ptr<minifi::io::BufferStream>>>& data) {
rocksdb::WriteBatch batch;
- for (const auto &item: data) {
+ for (const auto &item : data) {
rocksdb::Slice value((const char *) item.second->getBuffer(), item.second->size());
if (!batch.Put(item.first, value).ok()) {
return false;
diff --git a/extensions/sftp/tests/PutSFTPTests.cpp b/extensions/sftp/tests/PutSFTPTests.cpp
index 3c8bb1f..fd1cba2 100644
--- a/extensions/sftp/tests/PutSFTPTests.cpp
+++ b/extensions/sftp/tests/PutSFTPTests.cpp
@@ -809,7 +809,7 @@ TEST_CASE_METHOD(PutSFTPTestsFixture, "PutSFTP batching does not fail even if on
}
TEST_CASE_METHOD(PutSFTPTestsFixture, "PutSFTP put large file", "[PutSFTP]") {
- std::mt19937 rng(std::random_device{}());
+ std::mt19937 rng(std::random_device{}()); // NOLINT
std::string content(4 * 1024 * 1024U, '\0');
std::generate_n(content.begin(), 4 * 1024 * 1024U, std::ref(rng));
diff --git a/extensions/sql/SQLLoader.h b/extensions/sql/SQLLoader.h
index 844db5d..ac9d4df 100644
--- a/extensions/sql/SQLLoader.h
+++ b/extensions/sql/SQLLoader.h
@@ -36,14 +36,14 @@ class SQLFactory : public core::ObjectFactory {
return "SQLFactory";
}
- std::string getClassName() override{
+ std::string getClassName() override {
return "SQLFactory";
}
/**
* Gets the class name for the object
* @return class name for the processor.
*/
- std::vector<std::string> getClassNames() override{
+ std::vector<std::string> getClassNames() override {
return {"ExecuteSQL", "PutSQL", "QueryDatabaseTable", "ODBCService"};
}
diff --git a/extensions/sql/data/SQLRowsetProcessor.h b/extensions/sql/data/SQLRowsetProcessor.h
index 11d245d..3c5abc3 100644
--- a/extensions/sql/data/SQLRowsetProcessor.h
+++ b/extensions/sql/data/SQLRowsetProcessor.h
@@ -41,7 +41,7 @@ class SQLRowsetProcessor {
template <typename T>
void processColumn(const std::string& name, const T& value) const {
- for (const auto& subscriber: row_subscribers_) {
+ for (const auto& subscriber : row_subscribers_) {
subscriber.get().processColumn(name, value);
}
}
diff --git a/extensions/windows-event-log/Bookmark.cpp b/extensions/windows-event-log/Bookmark.cpp
index 214f47d..8b72e65 100644
--- a/extensions/windows-event-log/Bookmark.cpp
+++ b/extensions/windows-event-log/Bookmark.cpp
@@ -83,7 +83,7 @@ Bookmark::Bookmark(const std::wstring& channel, const std::wstring& query, const
return;
}
- const unique_evt_handle hEvent = [this,&hEventResults] {
+ const unique_evt_handle hEvent = [this, &hEventResults] {
DWORD dwReturned{};
EVT_HANDLE hEvent{ nullptr };
if (!EvtNext(hEventResults.get(), 1, &hEvent, INFINITE, 0, &dwReturned)) {
diff --git a/extensions/windows-event-log/CollectorInitiatedSubscription.cpp b/extensions/windows-event-log/CollectorInitiatedSubscription.cpp
index 9215884..a57aa87 100644
--- a/extensions/windows-event-log/CollectorInitiatedSubscription.cpp
+++ b/extensions/windows-event-log/CollectorInitiatedSubscription.cpp
@@ -503,7 +503,7 @@ bool CollectorInitiatedSubscription::createSubscription(const std::shared_ptr<co
{EcSubscriptionCommonUserName, sourceUserName_.value()},
{EcSubscriptionCommonPassword, sourcePassword_.value()}
};
- for (auto& prop: listProperty) {
+ for (auto& prop : listProperty) {
if (!EcSetSubscriptionProperty(hSubscription, prop.propId_, 0, &prop.prop_)) {
LOG_SUBSCRIPTION_WINDOWS_ERROR("EcSetSubscriptionProperty id: " + std::to_string(prop.propId_));
return false;
@@ -542,7 +542,7 @@ bool CollectorInitiatedSubscription::createSubscription(const std::shared_ptr<co
return false;
}
- for (auto& prop: std::vector<SubscriptionProperty>{{EcSubscriptionEventSourceAddress, sourceAddress_.value()}, {EcSubscriptionEventSourceEnabled, true}}) {
+ for (auto& prop : std::vector<SubscriptionProperty>{{EcSubscriptionEventSourceAddress, sourceAddress_.value()}, {EcSubscriptionEventSourceEnabled, true}}) {
if (!EcSetObjectArrayProperty(hArray, prop.propId_, dwEventSourceCount, 0, &prop.prop_)) {
LOG_SUBSCRIPTION_WINDOWS_ERROR("EcSetObjectArrayProperty id: " + std::to_string(prop.propId_));
return false;
diff --git a/extensions/windows-event-log/TailEventLog.cpp b/extensions/windows-event-log/TailEventLog.cpp
index 843f4c9..3e05208 100644
--- a/extensions/windows-event-log/TailEventLog.cpp
+++ b/extensions/windows-event-log/TailEventLog.cpp
@@ -67,7 +67,7 @@ void TailEventLog::onSchedule(const std::shared_ptr<core::ProcessContext> &conte
log_handle_ = OpenEventLog(NULL, log_source_.c_str());
- logger_->log_trace("TailEventLog configured to tail %s",log_source_);
+ logger_->log_trace("TailEventLog configured to tail %s", log_source_);
}
void TailEventLog::onTrigger(const std::shared_ptr<core::ProcessContext> &context, const std::shared_ptr<core::ProcessSession> &session) {
@@ -87,7 +87,7 @@ void TailEventLog::onTrigger(const std::shared_ptr<core::ProcessContext> &contex
logger_->log_trace("%d and %d", current_record_, num_records_);
- if (ReadEventLog(log_handle_,EVENTLOG_FORWARDS_READ | EVENTLOG_SEEK_READ, current_record_, event_record,MAX_RECORD_BUFFER_SIZE, &bytes_to_read,&min_bytes)) {
+ if (ReadEventLog(log_handle_, EVENTLOG_FORWARDS_READ | EVENTLOG_SEEK_READ, current_record_, event_record, MAX_RECORD_BUFFER_SIZE, &bytes_to_read, &min_bytes)) {
if (bytes_to_read == 0) {
logger_->log_debug("Yielding");
context->yield();
diff --git a/extensions/windows-event-log/TailEventLog.h b/extensions/windows-event-log/TailEventLog.h
index 3716258..e1421e8 100644
--- a/extensions/windows-event-log/TailEventLog.h
+++ b/extensions/windows-event-log/TailEventLog.h
@@ -38,7 +38,7 @@ const char log_name[255] = "Application";
class TailEventLog : public core::Processor {
public:
TailEventLog(const std::string& name, const utils::Identifier& uuid = {})
- : core::Processor(name, uuid), logger_(logging::LoggerFactory<TailEventLog>::getLogger()),max_events_(1){
+ : core::Processor(name, uuid), logger_(logging::LoggerFactory<TailEventLog>::getLogger()), max_events_(1) {
}
virtual ~TailEventLog() = default;
static const std::string ProcessorName;
@@ -65,7 +65,7 @@ public:
protected:
- void notifyStop() override{
+ void notifyStop() override {
CloseEventLog(log_handle_);
}
diff --git a/extensions/windows-event-log/wel/MetadataWalker.cpp b/extensions/windows-event-log/wel/MetadataWalker.cpp
index 738de3e..4b85d6e 100644
--- a/extensions/windows-event-log/wel/MetadataWalker.cpp
+++ b/extensions/windows-event-log/wel/MetadataWalker.cpp
@@ -80,7 +80,7 @@ bool MetadataWalker::for_each(pugi::xml_node &node) {
else {
static std::map<std::string, EVT_FORMAT_MESSAGE_FLAGS> formatFlagMap = {
{"Channel", EvtFormatMessageChannel}, {"Keywords", EvtFormatMessageKeyword}, {"Level", EvtFormatMessageLevel},
- {"Opcode", EvtFormatMessageOpcode}, {"Task",EvtFormatMessageTask}
+ {"Opcode", EvtFormatMessageOpcode}, {"Task", EvtFormatMessageTask}
};
auto it = formatFlagMap.find(node_name);
if (it != formatFlagMap.end()) {
@@ -111,7 +111,7 @@ std::vector<std::string> MetadataWalker::getIdentifiers(const std::string &text)
if (next_pos != std::string::npos) {
auto potential_identifier = text.substr(pos + 2, next_pos - (pos + 2));
std::smatch match;
- if (potential_identifier.find("S-") != std::string::npos){
+ if (potential_identifier.find("S-") != std::string::npos) {
found_strings.push_back(potential_identifier);
}
}
@@ -125,21 +125,21 @@ std::string MetadataWalker::getMetadata(METADATA metadata) const {
case LOG_NAME:
return log_name_;
case SOURCE:
- return getString(metadata_,"Provider");
+ return getString(metadata_, "Provider");
case TIME_CREATED:
return windows_event_log_metadata_.getEventTimestamp();
case EVENTID:
- return getString(metadata_,"EventID");
+ return getString(metadata_, "EventID");
case EVENT_RECORDID:
return getString(metadata_, "EventRecordID");
case OPCODE:
return getString(metadata_, "Opcode");
case TASK_CATEGORY:
- return getString(metadata_,"Task");
+ return getString(metadata_, "Task");
case LEVEL:
- return getString(metadata_,"Level");
+ return getString(metadata_, "Level");
case KEYWORDS:
- return getString(metadata_,"Keywords");
+ return getString(metadata_, "Keywords");
case EVENT_TYPE:
return std::to_string(windows_event_log_metadata_.getEventTypeIndex());
case COMPUTER:
diff --git a/extensions/windows-event-log/wel/WindowsEventLog.h b/extensions/windows-event-log/wel/WindowsEventLog.h
index 3b57de1..a2247b1 100644
--- a/extensions/windows-event-log/wel/WindowsEventLog.h
+++ b/extensions/windows-event-log/wel/WindowsEventLog.h
@@ -87,17 +87,17 @@ class WindowsEventLogMetadata {
static std::string getMetadataString(METADATA val) {
static std::map< METADATA, std::string> map = {
{LOG_NAME, "LOG_NAME" },
- {SOURCE,"SOURCE"},
- {TIME_CREATED,"TIME_CREATED" },
- {EVENTID,"EVENTID"},
- {OPCODE,"OPCODE"},
- {EVENT_RECORDID,"EVENT_RECORDID"},
- {EVENT_TYPE,"EVENT_TYPE"},
+ {SOURCE, "SOURCE"},
+ {TIME_CREATED, "TIME_CREATED" },
+ {EVENTID, "EVENTID"},
+ {OPCODE, "OPCODE"},
+ {EVENT_RECORDID, "EVENT_RECORDID"},
+ {EVENT_TYPE, "EVENT_TYPE"},
{TASK_CATEGORY, "TASK_CATEGORY"},
- {LEVEL,"LEVEL"},
- {KEYWORDS,"KEYWORDS"},
- {USER,"USER"},
- {COMPUTER,"COMPUTER"}
+ {LEVEL, "LEVEL"},
+ {KEYWORDS, "KEYWORDS"},
+ {USER, "USER"},
+ {COMPUTER, "COMPUTER"}
};
return map[val];
@@ -105,18 +105,18 @@ class WindowsEventLogMetadata {
static METADATA getMetadataFromString(const std::string &val) {
static std::map< std::string, METADATA> map = {
- {"LOG_NAME",LOG_NAME},
- {"SOURCE",SOURCE},
- {"TIME_CREATED",TIME_CREATED },
- {"EVENTID",EVENTID},
- {"OPCODE",OPCODE},
- {"EVENT_RECORDID",EVENT_RECORDID},
+ {"LOG_NAME", LOG_NAME},
+ {"SOURCE", SOURCE},
+ {"TIME_CREATED", TIME_CREATED },
+ {"EVENTID", EVENTID},
+ {"OPCODE", OPCODE},
+ {"EVENT_RECORDID", EVENT_RECORDID},
{"TASK_CATEGORY", TASK_CATEGORY},
- {"EVENT_TYPE",EVENT_TYPE},
- {"LEVEL",LEVEL},
- {"KEYWORDS",KEYWORDS},
- {"USER",USER},
- {"COMPUTER",COMPUTER}
+ {"EVENT_TYPE", EVENT_TYPE},
+ {"LEVEL", LEVEL},
+ {"KEYWORDS", KEYWORDS},
+ {"USER", USER},
+ {"COMPUTER", COMPUTER}
};
auto enumVal = map.find(val);
diff --git a/libminifi/test/BufferReader.h b/libminifi/test/BufferReader.h
index 2b4bf73..32e98aa 100644
--- a/libminifi/test/BufferReader.h
+++ b/libminifi/test/BufferReader.h
@@ -24,7 +24,7 @@
class BufferReader : public org::apache::nifi::minifi::InputStreamCallback {
public:
- explicit BufferReader(std::vector<uint8_t>& buffer) : buffer_(buffer){}
+ explicit BufferReader(std::vector<uint8_t>& buffer) : buffer_(buffer) {}
int write(org::apache::nifi::minifi::io::BaseStream& input, std::size_t len) {
uint8_t tmpBuffer[4096]{};
diff --git a/libminifi/test/aws-tests/MockS3RequestSender.h b/libminifi/test/aws-tests/MockS3RequestSender.h
index 01c6db7..36e1f85 100644
--- a/libminifi/test/aws-tests/MockS3RequestSender.h
+++ b/libminifi/test/aws-tests/MockS3RequestSender.h
@@ -58,7 +58,7 @@ const std::string S3_CONTINUATION_TOKEN = "continue";
class MockS3RequestSender : public minifi::aws::s3::S3RequestSender {
public:
MockS3RequestSender() {
- for(std::size_t i = 0; i < S3_OBJECT_COUNT; ++i) {
+ for (std::size_t i = 0; i < S3_OBJECT_COUNT; ++i) {
Aws::S3::Model::ObjectVersion version;
version.SetKey(S3_KEY_PREFIX + std::to_string(i));
version.SetETag(S3_ETAG_PREFIX + std::to_string(i));
@@ -74,7 +74,7 @@ class MockS3RequestSender : public minifi::aws::s3::S3RequestSender {
listed_versions_.push_back(version);
}
- for(std::size_t i = 0; i < S3_OBJECT_COUNT; ++i) {
+ for (std::size_t i = 0; i < S3_OBJECT_COUNT; ++i) {
Aws::S3::Model::Object object;
object.SetKey(S3_KEY_PREFIX + std::to_string(i));
object.SetETag(S3_ETAG_PREFIX + std::to_string(i));
diff --git a/libminifi/test/unit/ProvenanceTestHelper.h b/libminifi/test/unit/ProvenanceTestHelper.h
index 1472613..4f5ac6d 100644
--- a/libminifi/test/unit/ProvenanceTestHelper.h
+++ b/libminifi/test/unit/ProvenanceTestHelper.h
@@ -81,7 +81,7 @@ class TestRepository : public core::Repository {
}
bool MultiPut(const std::vector<std::pair<std::string, std::unique_ptr<minifi::io::BufferStream>>>& data) override {
- for (const auto& item: data) {
+ for (const auto& item : data) {
if (!Put(item.first, item.second->getBuffer(), item.second->size())) {
return false;
}
diff --git a/main/AgentDocs.cpp b/main/AgentDocs.cpp
index 1c191bd..39fc6a4 100644
--- a/main/AgentDocs.cpp
+++ b/main/AgentDocs.cpp
@@ -95,18 +95,18 @@ void AgentDocs::generate(const std::string &docsdir, std::ostream &genStream) {
}
const auto allowableValues = prop.second.getAllowedValues();
std::stringstream s;
- std::copy(allowableValues.begin(),allowableValues.end(), std::ostream_iterator<std::string>(s,"<br>"));
+ std::copy(allowableValues.begin(), allowableValues.end(), std::ostream_iterator<std::string>(s, "<br>"));
outfile << "|";
const auto defaultValue = prop.second.getDefaultValue().to_string();
- if (defaultValue.size() == 1 && (int)defaultValue.c_str()[0] == 0x0a){
+ if (defaultValue.size() == 1 && (int)defaultValue.c_str()[0] == 0x0a) {
outfile << "\\n";
}
- else{
+ else {
outfile << defaultValue;
}
std::string description = prop.second.getDescription();
outfile << "|" << s.str() << "|" << utils::StringUtils::replaceAll(description, "\n", "<br/>");
- if (supportsEl){
+ if (supportsEl) {
outfile << "<br/>**Supports Expression Language: true**";
}
outfile << "|" << std::endl;
@@ -121,7 +121,7 @@ void AgentDocs::generate(const std::string &docsdir, std::ostream &genStream) {
outfile << std::endl;
}
- std::map<std::string,std::string> fileList;
+ std::map<std::string, std::string> fileList;
auto fileFind = [&fileList](const std::string& base_path, const std::string& file) -> bool {
if (file.find(".extra") == std::string::npos)
@@ -144,21 +144,21 @@ void AgentDocs::generate(const std::string &docsdir, std::ostream &genStream) {
"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied."
"See the License for the specific language governing permissions and"
"limitations under the License."
- "-->"<<std::endl;
+ "-->" << std::endl;
genStream << "# Processors" << std::endl << std::endl;
genStream << "## Table of Contents" << std::endl << std::endl;
- for(const auto &file : fileList){
- std::string lcfile=file.first;
+ for (const auto &file : fileList) {
+ std::string lcfile = file.first;
std::transform(lcfile.begin(), lcfile.end(), lcfile.begin(), ::tolower);
genStream << "- [" << file.first << "](#" << lcfile << ")" << std::endl;
}
- for(const auto &file : fileList){
+ for (const auto &file : fileList) {
std::ifstream filestream(file.second);
genStream << filestream.rdbuf() << std::endl;
std::ifstream filestreamExtra(file.second + ".extra");
- if (filestreamExtra.good()){
+ if (filestreamExtra.good()) {
genStream << filestreamExtra.rdbuf()<< std::endl;
}
}
diff --git a/main/MainHelper.cpp b/main/MainHelper.cpp
index 7f0a8a4..9825220 100644
--- a/main/MainHelper.cpp
+++ b/main/MainHelper.cpp
@@ -90,7 +90,7 @@ void setSyslogLogger() {
logging::LoggerConfiguration::getConfiguration().initialize(service_logger);
}
-std::string determineMinifiHome(const std::shared_ptr<logging::Logger>& logger){
+std::string determineMinifiHome(const std::shared_ptr<logging::Logger>& logger) {
/* Try to determine MINIFI_HOME */
std::string minifiHome = [&logger]() -> std::string {
/* If MINIFI_HOME is set as an environment variable, we will use that */
diff --git a/main/MiNiFiMain.cpp b/main/MiNiFiMain.cpp
index 0d7ee47..4204ab1 100644
--- a/main/MiNiFiMain.cpp
+++ b/main/MiNiFiMain.cpp
@@ -235,7 +235,7 @@ int main(int argc, char **argv) {
}
std::ofstream outref(argv[3]);
dumpDocs(configure, argv[2], outref);
- } else{
+ } else {
dumpDocs(configure, argv[2], std::cout);
}
exit(0);
@@ -384,13 +384,13 @@ int main(int argc, char **argv) {
*/
int ret_val;
while ((ret_val = sem_wait(running)) == -1 && errno == EINTR);
- if(ret_val == -1) perror("sem_wait");
+ if (ret_val == -1) perror("sem_wait");
while ((ret_val = sem_close(running)) == -1 && errno == EINTR);
- if(ret_val == -1) perror("sem_close");
+ if (ret_val == -1) perror("sem_close");
while ((ret_val = sem_unlink("/MiNiFiMain")) == -1 && errno == EINTR);
- if(ret_val == -1) perror("sem_unlink");
+ if (ret_val == -1) perror("sem_unlink");
disk_space_watchdog = nullptr;
diff --git a/nanofi/examples/hash_file.c b/nanofi/examples/hash_file.c
index f71659e..e155fed 100644
--- a/nanofi/examples/hash_file.c
+++ b/nanofi/examples/hash_file.c
@@ -27,7 +27,7 @@
void custom_processor_logic(processor_session * ps, processor_context * ctx) {
flow_file_record * ffr = get(ps, ctx);
- if(ffr == NULL) {
+ if (ffr == NULL) {
return;
}
uint8_t * buffer = (uint8_t*)malloc(ffr->size* sizeof(uint8_t));
@@ -45,13 +45,13 @@ void custom_processor_logic(processor_session * ps, processor_context * ctx) {
MD5_Final(digest, &context);
char md5string[33];
- for(int i = 0; i < 16; ++i) {
+ for (int i = 0; i < 16; ++i) {
sprintf(&md5string[i*2], "%02x", (unsigned int)digest[i]);
}
char prop_value[50];
- if(get_property(ctx, "checksum_attr_name", prop_value, 50) != 0) {
+ if (get_property(ctx, "checksum_attr_name", prop_value, 50) != 0) {
return; // Attr name not found
}
@@ -70,7 +70,7 @@ int main(int argc, char **argv) {
char *file = argv[1];
- if(access(file, F_OK) == -1) {
+ if (access(file, F_OK) == -1) {
printf("Error: %s doesn't exist!\n", file);
exit(1);
}
@@ -79,7 +79,7 @@ int main(int argc, char **argv) {
stat(file, &stats);
// Check for file existence
- if (S_ISDIR(stats.st_mode)){
+ if (S_ISDIR(stats.st_mode)) {
printf("Error: %s is a directory!\n", file);
exit(1);
}
diff --git a/nanofi/examples/transmit_flow.c b/nanofi/examples/transmit_flow.c
index 83298bd..76240a2 100644
--- a/nanofi/examples/transmit_flow.c
+++ b/nanofi/examples/transmit_flow.c
@@ -40,18 +40,18 @@ void transfer_file_or_directory(nifi_instance *instance, char *file_or_dir) {
d = opendir(file_or_dir);
if (d) {
while ((dir = readdir(d)) != NULL) {
- if (!memcmp(dir->d_name,".",1) )
+ if (!memcmp(dir->d_name, ".", 1) )
continue;
char *file_path = malloc(strlen(file_or_dir) + strlen(dir->d_name) + 2);
- sprintf(file_path,"%s/%s",file_or_dir,dir->d_name);
- transfer_file_or_directory(instance,file_path);
+ sprintf(file_path, "%s/%s", file_or_dir, dir->d_name);
+ transfer_file_or_directory(instance, file_path);
free(file_path);
}
closedir(d);
}
printf("%s is a directory", file_or_dir);
} else {
- printf("Transferring %s\n",file_or_dir);
+ printf("Transferring %s\n", file_or_dir);
flow_file_record *record = create_flowfile(file_or_dir, strlen(file_or_dir));
@@ -84,7 +84,7 @@ int main(int argc, char **argv) {
// initializing will make the transmission slightly more efficient.
// initialize_instance(instance);
- transfer_file_or_directory(instance,file);
+ transfer_file_or_directory(instance, file);
// Create flowfile without content (just a set of attributes)
flow_file_record * record = create_ff_object_nc();
diff --git a/nanofi/examples/transmit_payload.c b/nanofi/examples/transmit_payload.c
index 9b6a0bf..eca1a6d 100644
--- a/nanofi/examples/transmit_payload.c
+++ b/nanofi/examples/transmit_payload.c
@@ -54,7 +54,7 @@ int main(int argc, char **argv) {
as.size = 1;
as.attributes = &attribute1;
- if(transmitPayload(client, payload, &as) == 0){
+ if (transmitPayload(client, payload, &as) == 0) {
printf("Packet successfully sent\n");
} else {
printf("Failed to send packet\n");
diff --git a/nanofi/include/api/nanofi.h b/nanofi/include/api/nanofi.h
index 64fc9d7..e433125 100644
--- a/nanofi/include/api/nanofi.h
+++ b/nanofi/include/api/nanofi.h
@@ -49,7 +49,7 @@ extern "C" {
return ret_val; \
} \
} \
- } while(0)
+ } while (0)
/**
* Enables logging (disabled by default)
@@ -76,7 +76,7 @@ nifi_instance *create_instance_repo(const char *url, nifi_port *port, const char
* @param port remote port the instance connects to
* @return pointer to the new instance
**/
-static inline nifi_instance *create_instance(const char *url, nifi_port *port){
+static inline nifi_instance *create_instance(const char *url, nifi_port *port) {
return create_instance_repo(url, port, "filesystemrepository");
}
@@ -126,7 +126,7 @@ flow *create_new_flow(nifi_instance * instance);
* @attention in case first processor is empty or doesn't name any existing processor, an empty flow is returned.
* @return a pointer to the created flow
**/
-DEPRECATED(0.6.0,2.0) flow *create_flow(nifi_instance * instance, const char * first_processor);
+DEPRECATED(0.6.0, 2.0) flow *create_flow(nifi_instance * instance, const char * first_processor);
/**
* Add a getfile processor to "parent" flow.
diff --git a/nanofi/include/core/cstructs.h b/nanofi/include/core/cstructs.h
index d0c3e0c..f2ab92e 100644
--- a/nanofi/include/core/cstructs.h
+++ b/nanofi/include/core/cstructs.h
@@ -28,11 +28,11 @@
#endif
#ifndef DEPRECATED
#ifdef _MSC_VER
-#define DEPRECATED(v,ev) __declspec(deprecated)
+#define DEPRECATED(v, ev) __declspec(deprecated)
#elif defined(__GNUC__) | defined(__clang__)
-#define DEPRECATED(v,ev) __attribute__((__deprecated__))
+#define DEPRECATED(v, ev) __attribute__((__deprecated__))
#else
-#define DEPRECATED(v,ev)
+#define DEPRECATED(v, ev)
#endif
#endif
diff --git a/nanofi/include/core/log.h b/nanofi/include/core/log.h
index dda84f6..dc89a19 100644
--- a/nanofi/include/core/log.h
+++ b/nanofi/include/core/log.h
@@ -62,7 +62,7 @@ static const char *log_level_str[trace+1] = { "OFF", "CRITICAL", "ERROR", "WARN"
#endif // C99 compiler support
static inline void set_log_level(log_level lvl) {
- if(lvl >= off && lvl <= trace) {
+ if (lvl >= off && lvl <= trace) {
global_log_level = lvl;
logc(info, "Log level was set to %s", log_level_str[lvl]);
}
diff --git a/nanofi/include/cxx/C2CallbackAgent.h b/nanofi/include/cxx/C2CallbackAgent.h
index 7adbbf5..c26998b 100644
--- a/nanofi/include/cxx/C2CallbackAgent.h
+++ b/nanofi/include/cxx/C2CallbackAgent.h
@@ -54,7 +54,7 @@ class C2CallbackAgent : public c2::C2Agent {
virtual ~C2CallbackAgent() = default;
- void setStopCallback(c2_ag_stop_callback *st){
+ void setStopCallback(c2_ag_stop_callback *st) {
stop = st;
}
diff --git a/nanofi/include/cxx/Plan.h b/nanofi/include/cxx/Plan.h
index ecdede6..631d820 100644
--- a/nanofi/include/cxx/Plan.h
+++ b/nanofi/include/cxx/Plan.h
@@ -136,11 +136,11 @@ class ExecutionPlan {
return content_repo_;
}
- std::shared_ptr<core::FlowFile> getNextFlowFile(){
+ std::shared_ptr<core::FlowFile> getNextFlowFile() {
return next_ff_;
}
- void setNextFlowFile(std::shared_ptr<core::FlowFile> ptr){
+ void setNextFlowFile(std::shared_ptr<core::FlowFile> ptr) {
next_ff_ = std::move(ptr);
}
@@ -184,7 +184,7 @@ class ExecutionPlan {
content_repo_ = cr_ptr;
}
void setCallback(failure_callback_type onerror_callback) {
- callback_=onerror_callback;
+ callback_ = onerror_callback;
}
void setStrategy(FailureStrategy strat) {
strategy_ = strat;
diff --git a/nanofi/include/cxx/ReflexiveSession.h b/nanofi/include/cxx/ReflexiveSession.h
index 44818fc..4804d93 100644
--- a/nanofi/include/cxx/ReflexiveSession.h
+++ b/nanofi/include/cxx/ReflexiveSession.h
@@ -42,22 +42,22 @@ class ReflexiveSession : public ProcessSession{
* Create a new process session
*/
ReflexiveSession(std::shared_ptr<ProcessContext> processContext = nullptr)
- : ProcessSession(processContext){
+ : ProcessSession(processContext) {
}
// Destructor
virtual ~ReflexiveSession() = default;
- virtual std::shared_ptr<core::FlowFile> get(){
+ virtual std::shared_ptr<core::FlowFile> get() {
auto prevff = ff;
ff = nullptr;
return prevff;
}
- virtual void add(const std::shared_ptr<core::FlowFile> &flow){
+ virtual void add(const std::shared_ptr<core::FlowFile> &flow) {
ff = flow;
}
- virtual void transfer(const std::shared_ptr<core::FlowFile>& /*flow*/, Relationship /*relationship*/){
+ virtual void transfer(const std::shared_ptr<core::FlowFile>& /*flow*/, Relationship /*relationship*/) {
// no op
}
protected:
diff --git a/nanofi/include/sitetosite/CPeer.h b/nanofi/include/sitetosite/CPeer.h
index da30fa2..d7165ef 100644
--- a/nanofi/include/sitetosite/CPeer.h
+++ b/nanofi/include/sitetosite/CPeer.h
@@ -57,13 +57,13 @@ static inline const char * getURL(const struct SiteToSiteCPeer * peer) {
}
static inline void setHostName(struct SiteToSiteCPeer * peer, const char * hostname) {
- if(peer->_host) {
+ if (peer->_host) {
free(peer->_host);
}
- if(peer->_url) {
+ if (peer->_url) {
free(peer->_url);
}
- if(hostname == NULL || strlen(hostname) == 0) {
+ if (hostname == NULL || strlen(hostname) == 0) {
peer->_host = NULL;
peer->_url = NULL;
return;
@@ -74,7 +74,7 @@ static inline void setHostName(struct SiteToSiteCPeer * peer, const char * hostn
memset(peer->_url, 0, host_len + 14); // make sure to have zero padding no matter the length of the port
snprintf(peer->_host, host_len + 1, "%s", hostname);
snprintf(peer->_url, host_len + 14, "nifi://%s:", hostname);
- if(peer->_port != 0) {
+ if (peer->_port != 0) {
snprintf(peer->_url + host_len + 8, 6, "%d", peer->_port);
}
return;
@@ -82,10 +82,10 @@ static inline void setHostName(struct SiteToSiteCPeer * peer, const char * hostn
static inline void setPort(struct SiteToSiteCPeer * peer, uint16_t port) {
peer->_port = port;
- if(peer->_url != NULL) {
+ if (peer->_url != NULL) {
int i;
- for(i = (int)(strlen(peer->_url)) - 1; i >= 0; --i) { // look for the last ':' in the string
- if(peer->_url[i] == ':'){
+ for (i = (int)(strlen(peer->_url)) - 1; i >= 0; --i) { // look for the last ':' in the string
+ if (peer->_url[i] == ':') {
memset(peer->_url + i + 1, 0, 6); // zero the port area - the new port can be shorter
snprintf(peer->_url + i + 1, 6, "%d", peer->_port);
break;
@@ -107,7 +107,7 @@ static inline void freePeer(struct SiteToSiteCPeer * peer) {
closePeer(peer);
setHostName(peer, NULL);
- if(peer->_stream != NULL) {
+ if (peer->_stream != NULL) {
free_socket(peer->_stream);
peer->_stream = NULL;
}
diff --git a/nanofi/include/sitetosite/CRawSocketProtocol.h b/nanofi/include/sitetosite/CRawSocketProtocol.h
index b3941db..27d144b 100644
--- a/nanofi/include/sitetosite/CRawSocketProtocol.h
+++ b/nanofi/include/sitetosite/CRawSocketProtocol.h
@@ -139,7 +139,7 @@ static inline void setPortId(struct CRawSiteToSiteClient * client, const char *
strncpy(client->_port_id_str, id, 37);
client->_port_id_str[36] = '\0';
int i;
- for(i = 0; i < 37; i++){
+ for (i = 0; i < 37; i++) {
client->_port_id_str[i] = tolower(client->_port_id_str[i]);
}
}
@@ -193,9 +193,9 @@ static inline struct CRawSiteToSiteClient* createClient(const char * host, uint1
return client;
}
-static inline void destroyClient(struct CRawSiteToSiteClient * client){
+static inline void destroyClient(struct CRawSiteToSiteClient * client) {
tearDown(client);
- if(client->_owns_resource == True) {
+ if (client->_owns_resource == True) {
freePeer(client->_peer);
}
}
diff --git a/nanofi/include/sitetosite/CSiteToSite.h b/nanofi/include/sitetosite/CSiteToSite.h
index 7d6936a..393cade 100644
--- a/nanofi/include/sitetosite/CSiteToSite.h
+++ b/nanofi/include/sitetosite/CSiteToSite.h
@@ -341,7 +341,7 @@ static inline int write_UTF_len(CTransaction * transaction, const char * str, si
ret = write_uint32t(transaction, len);
}
- if(len == 0 || ret < 0) {
+ if (len == 0 || ret < 0) {
return ret;
}
diff --git a/nanofi/src/api/ecu.c b/nanofi/src/api/ecu.c
index 883066a..2f1c004 100644
--- a/nanofi/src/api/ecu.c
+++ b/nanofi/src/api/ecu.c
@@ -79,7 +79,7 @@ int validate_input_params(tailfile_input_params * params, uint64_t * intrvl, uin
return -1;
}
// Check for file existence
- if (S_ISDIR(stats.st_mode)){
+ if (S_ISDIR(stats.st_mode)) {
printf("Error: %s is a directory!\n", params->file);
return -1;
}
diff --git a/nanofi/src/api/nanofi.cpp b/nanofi/src/api/nanofi.cpp
index b339a28..bdb7e37 100644
--- a/nanofi/src/api/nanofi.cpp
+++ b/nanofi/src/api/nanofi.cpp
@@ -346,9 +346,9 @@ flow_file_record * write_to_flow(const char * buff, size_t count, processor_cont
*/
void free_flowfile(flow_file_record *ff) {
NULL_CHECK(, ff);
- if (ff->crp){
+ if (ff->crp) {
auto content_repo_ptr = static_cast<std::shared_ptr<minifi::core::ContentRepository>*>(ff->crp);
- if((*content_repo_ptr) && (ff->keepContent == 0)) {
+ if ((*content_repo_ptr) && (ff->keepContent == 0)) {
auto claim = std::make_shared<minifi::ResourceClaim>(ff->contentLocation, *content_repo_ptr);
(*content_repo_ptr)->remove(*claim);
}
@@ -455,7 +455,7 @@ int8_t remove_attribute(flow_file_record *ff, const char *key) {
int get_content(const flow_file_record* ff, uint8_t* target, int size) {
NULL_CHECK(0, ff, target);
auto content_repo = static_cast<std::shared_ptr<minifi::core::ContentRepository>*>(ff->crp);
- if(ff->crp && (*content_repo)) {
+ if (ff->crp && (*content_repo)) {
std::shared_ptr<minifi::ResourceClaim> claim = std::make_shared<minifi::ResourceClaim>(ff->contentLocation,
*content_repo);
auto stream = (*content_repo)->read(*claim);
@@ -489,7 +489,7 @@ int transmit_flowfile(flow_file_record *ff, nifi_instance *instance) {
}
AttributeMap& attribute_map = empty_attribute_map;
- if(ff->attributes) {
+ if (ff->attributes) {
attribute_map = *(static_cast<AttributeMap *>(ff->attributes));
}
@@ -500,7 +500,7 @@ int transmit_flowfile(flow_file_record *ff, nifi_instance *instance) {
std::shared_ptr<minifi::ResourceClaim> claim = nullptr;
std::shared_ptr<minifi::io::BufferStream> stream = nullptr; // Used when content is not in content repo
- if(ff->contentLocation) {
+ if (ff->contentLocation) {
auto ff_content_repo_ptr = (static_cast<std::shared_ptr<minifi::core::ContentRepository>*>(ff->crp));
if (ff->crp && (*ff_content_repo_ptr)) {
content_repo = *ff_content_repo_ptr;
@@ -547,7 +547,7 @@ flow *create_flow(nifi_instance *instance, const char *first_processor) {
NULL_CHECK(nullptr, instance);
auto new_flow = create_new_flow(instance);
- if(new_flow != nullptr && first_processor != nullptr && strlen(first_processor) > 0) {
+ if (new_flow != nullptr && first_processor != nullptr && strlen(first_processor) > 0) {
// automatically adds it with success
new_flow->addProcessor(first_processor, first_processor);
}
@@ -612,7 +612,7 @@ int set_standalone_property(standalone_processor *proc, const char *name, const
uint8_t get_property(const processor_context * context, const char * name, char * buffer, size_t size) {
std::string value;
- if(!context->getDynamicProperty(name, value)) {
+ if (!context->getDynamicProperty(name, value)) {
return -1;
}
size_t chars_to_copy = std::min(value.length(), size-1);
@@ -631,7 +631,7 @@ int free_flow(flow *flow) {
flow_file_record* flowfile_to_record(std::shared_ptr<core::FlowFile> ff, const std::shared_ptr<minifi::core::ContentRepository>& crp) {
auto claim = ff->getResourceClaim();
- if(claim == nullptr) {
+ if (claim == nullptr) {
return nullptr;
}
@@ -656,7 +656,7 @@ flow_file_record* flowfile_to_record(std::shared_ptr<core::FlowFile> ff, Executi
flow_file_record* get(processor_session *session, processor_context *context) {
auto ff = session->get();
- if(!ff) {
+ if (!ff) {
return nullptr;
}
@@ -711,7 +711,7 @@ flow_file_record *invoke_ff(standalone_processor* proc, const flow_file_record *
auto content_repo = static_cast<std::shared_ptr<minifi::core::ContentRepository> *>(input_ff->crp);
auto ff_data = std::make_shared<flowfile_input_params>();
- if(input_ff->crp && (*content_repo)) {
+ if (input_ff->crp && (*content_repo)) {
std::shared_ptr<minifi::ResourceClaim> claim = std::make_shared<minifi::ResourceClaim>(input_ff->contentLocation,
*content_repo);
ff_data->content_stream = (*content_repo)->read(*claim);
@@ -787,7 +787,7 @@ int delete_custom_processor(const char * name) {
}
int transfer_to_relationship(flow_file_record * ffr, processor_session * ps, const char * relationship) {
- if(ffr == nullptr || ffr->ffp == nullptr || ps == nullptr || relationship == nullptr || strlen(relationship) == 0) {
+ if (ffr == nullptr || ffr->ffp == nullptr || ps == nullptr || relationship == nullptr || strlen(relationship) == 0) {
return -1;
}
auto ff_sptr = reinterpret_cast<std::shared_ptr<core::FlowFile>*>(ffr->ffp);
diff --git a/nanofi/src/core/cstream.c b/nanofi/src/core/cstream.c
index 8bc37c7..fc165d9 100644
--- a/nanofi/src/core/cstream.c
+++ b/nanofi/src/core/cstream.c
@@ -86,7 +86,7 @@ int read_buffer(uint8_t *buf, int len, cstream * stream) {
buf += bytes_read;
total_read += bytes_read;
}
- if(total_read)
+ if (total_read)
logc(trace, "Received data size %d over socket %" PRI_SOCKET, total_read, stream->socket_);
return total_read;
}
@@ -105,7 +105,7 @@ int writeUTF(const char * cstr, size_t length, enum Bool widen, cstream * stream
ret = write_uint32_t(len, stream);
}
- if(len == 0 || ret < 0) {
+ if (len == 0 || ret < 0) {
return ret;
}
@@ -116,7 +116,7 @@ int writeUTF(const char * cstr, size_t length, enum Bool widen, cstream * stream
int read_uint8_t(uint8_t *value, cstream * stream) {
uint8_t val;
int ret = read_buffer(&val, sizeof(uint8_t), stream);
- if(ret == sizeof(uint8_t)) {
+ if (ret == sizeof(uint8_t)) {
*value = val;
}
return ret;
@@ -124,7 +124,7 @@ int read_uint8_t(uint8_t *value, cstream * stream) {
int read_uint16_t(uint16_t *value, cstream * stream) {
uint16_t val;
int ret = read_buffer((uint8_t*)&val, sizeof(uint16_t), stream);
- if(ret == sizeof(uint16_t)) {
+ if (ret == sizeof(uint16_t)) {
*value = ntohs(val);
}
return ret;
@@ -132,7 +132,7 @@ int read_uint16_t(uint16_t *value, cstream * stream) {
int read_uint32_t(uint32_t *value, cstream * stream) {
uint32_t val;
int ret = read_buffer((uint8_t*)&val, sizeof(uint32_t), stream);
- if(ret == sizeof(uint32_t)) {
+ if (ret == sizeof(uint32_t)) {
*value = ntohl(val);
}
return ret;
@@ -153,7 +153,7 @@ int readUTF(char * buf, uint32_t buflen, cstream * stream) {
}
void close_stream(cstream * stream) {
- if(stream != NULL && stream->socket_ != -1) {
+ if (stream != NULL && stream->socket_ != -1) {
#ifdef _WIN32
shutdown(stream->socket_, SD_BOTH);
closesocket(stream->socket_);
@@ -171,7 +171,7 @@ cstream * create_socket(const char * host, uint16_t portnum) {
#ifdef _WIN32
WSADATA wsa;
- if (WSAStartup(MAKEWORD(2,2),&wsa) != 0) {
+ if (WSAStartup(MAKEWORD(2, 2), &wsa) != 0) {
logc(err, "%s", "WSAStartup failed");
return NULL;
}
@@ -226,7 +226,7 @@ cstream * create_socket(const char * host, uint16_t portnum) {
}
void free_socket(cstream * stream) {
- if(stream != NULL) {
+ if (stream != NULL) {
close_stream(stream);
free(stream);
}
diff --git a/nanofi/src/cxx/CallbackProcessor.cpp b/nanofi/src/cxx/CallbackProcessor.cpp
index 50bb006..fe1fdde 100644
--- a/nanofi/src/cxx/CallbackProcessor.cpp
+++ b/nanofi/src/cxx/CallbackProcessor.cpp
@@ -33,8 +33,8 @@ void CallbackProcessor::initialize() {
setSupportedRelationships(relationships);
}
-void CallbackProcessor::onSchedule(core::ProcessContext *context, core::ProcessSessionFactory* /*sessionFactory*/){
- if(onschedule_callback_ != nullptr) {
+void CallbackProcessor::onSchedule(core::ProcessContext *context, core::ProcessSessionFactory* /*sessionFactory*/) {
+ if (onschedule_callback_ != nullptr) {
onschedule_callback_(context);
}
}
diff --git a/nanofi/src/cxx/Plan.cpp b/nanofi/src/cxx/Plan.cpp
index a1d28d7..31af928 100644
--- a/nanofi/src/cxx/Plan.cpp
+++ b/nanofi/src/cxx/Plan.cpp
@@ -163,7 +163,7 @@ bool ExecutionPlan::runNextProcessor(std::function<void(const std::shared_ptr<co
process_sessions_.push_back(current_session);
if (input_ff_params) {
auto flowFile = current_session->create();
- for(const auto& kv : input_ff_params->attributes) {
+ for (const auto& kv : input_ff_params->attributes) {
flowFile->setAttribute(kv.first, kv.second);
}
current_session->importFrom(*(input_ff_params->content_stream.get()), flowFile);
@@ -247,11 +247,11 @@ std::shared_ptr<core::Processor> ExecutionPlan::createProcessor(const std::strin
auto custom_proc = custom_processors.find(processor_name);
- if(custom_proc != custom_processors.end()) {
+ if (custom_proc != custom_processors.end()) {
auto ontrigger_c_func = custom_proc->second.ontr_cb;
auto onschedule_c_func = custom_proc->second.onsc_cb;
auto ontrigger_wrapper_func = [ontrigger_c_func](core::ProcessSession * session, core::ProcessContext * context) {
- if(ontrigger_c_func) {
+ if (ontrigger_c_func) {
ontrigger_c_func(reinterpret_cast<processor_session *>(session),
reinterpret_cast<processor_context *>(context));
}
@@ -332,7 +332,7 @@ bool ExecutionPlan::setFailureStrategy(FailureStrategy start) {
}
bool ExecutionPlan::addCustomProcessor(custom_processor_args in) {
- if(CallbackProcessorName == in.name) {
+ if (CallbackProcessorName == in.name) {
return false; // This name cannot be registered
}
diff --git a/nanofi/src/sitetosite/CPeer.c b/nanofi/src/sitetosite/CPeer.c
index f2ec76a..a97944c 100644
--- a/nanofi/src/sitetosite/CPeer.c
+++ b/nanofi/src/sitetosite/CPeer.c
@@ -28,9 +28,9 @@ int openPeer(struct SiteToSiteCPeer * peer) {
}
// In case there was no socket injected, let's create it
- if(peer->_stream == NULL) {
+ if (peer->_stream == NULL) {
peer->_stream = create_socket(peer->_host, peer->_port);
- if(peer->_stream == NULL) {
+ if (peer->_stream == NULL) {
logc(err, "%s", "failed to open socket");
return -1;
}
@@ -46,7 +46,7 @@ int openPeer(struct SiteToSiteCPeer * peer) {
uint16_t data_size = sizeof MAGIC_BYTES;
- if(write_buffer((uint8_t*)MAGIC_BYTES, data_size, peer->_stream) != data_size) {
+ if (write_buffer((uint8_t*)MAGIC_BYTES, data_size, peer->_stream) != data_size) {
logc(err, "%s", "failed to write buffer");
return -1;
}
diff --git a/nanofi/src/sitetosite/CRawSocketProtocol.c b/nanofi/src/sitetosite/CRawSocketProtocol.c
index a95a1c5..80d0e33 100644
--- a/nanofi/src/sitetosite/CRawSocketProtocol.c
+++ b/nanofi/src/sitetosite/CRawSocketProtocol.c
@@ -183,7 +183,7 @@ int handShake(struct CRawSiteToSiteClient * client) {
}
}
- if(ret_val == 0) {
+ if (ret_val == 0) {
ret = write_uint32_t(prop_size, client->_peer->_stream);
}
if (ret <= 0) {
@@ -191,10 +191,10 @@ int handShake(struct CRawSiteToSiteClient * client) {
}
HASH_ITER(hh, properties, current, tmp) {
- if(ret_val == 0 && writeUTF(current->name, strlen(current->name), False, client->_peer->_stream) <= 0) {
+ if (ret_val == 0 && writeUTF(current->name, strlen(current->name), False, client->_peer->_stream) <= 0) {
ret_val = -1;
}
- if(ret_val == 0 && writeUTF(current->value, strlen(current->value), False, client->_peer->_stream) <= 0) {
+ if (ret_val == 0 && writeUTF(current->value, strlen(current->value), False, client->_peer->_stream) <= 0) {
ret_val = -1;
}
logc(debug, "Site2Site Protocol Send handshake properties %s %s", current->name, current->value);
@@ -202,7 +202,7 @@ int handShake(struct CRawSiteToSiteClient * client) {
free(current);
}
- if(ret_val < 0) {
+ if (ret_val < 0) {
logc(err, "%s", "Failed to transfer handshake properties");
return -1;
}
@@ -218,7 +218,7 @@ int handShake(struct CRawSiteToSiteClient * client) {
RespondCodeContext *resCode = getRespondCodeContext(code);
- if(resCode == NULL) {
+ if (resCode == NULL) {
logc(err, "Received invalid respond code: %d", code);
return -1;
}
@@ -363,7 +363,7 @@ CTransaction* createTransaction(struct CRawSiteToSiteClient * client, TransferDi
RespondCodeContext *resCode = getRespondCodeContext(code);
- if(resCode == NULL) {
+ if (resCode == NULL) {
logc(err, "Received invalid respond code: %d", code);
return NULL;
}
@@ -466,7 +466,7 @@ int transmitPayload(struct CRawSiteToSiteClient * client, const char * payload,
int ret = confirm(client, transactionID);
- if(ret == 0) {
+ if (ret == 0) {
ret = complete(client, transactionID);
}
@@ -504,7 +504,7 @@ int complete(struct CRawSiteToSiteClient * client, const char * transactionID) {
return 0;
} else {
logc(debug, "Site2Site transaction %s send finished", transactionID);
- if(writeResponse(client, TRANSACTION_FINISHED, "Finished") <= 0) {
+ if (writeResponse(client, TRANSACTION_FINISHED, "Finished") <= 0) {
return -1;
} else {
transaction->_state = TRANSACTION_COMPLETED;
@@ -520,7 +520,7 @@ int complete(struct CRawSiteToSiteClient * client, const char * transactionID) {
RespondCodeContext *resCode = getRespondCodeContext(code);
- if(resCode == NULL) {
+ if (resCode == NULL) {
logc(err, "Received invalid respond code: %d", code);
return -1;
}
@@ -597,7 +597,7 @@ int confirm(struct CRawSiteToSiteClient * client, const char * transactionID) {
RespondCodeContext *resCode = getRespondCodeContext(code);
- if(resCode == NULL) {
+ if (resCode == NULL) {
logc(err, "Received invalid respond code: %d", code);
return -1;
}
@@ -631,13 +631,13 @@ int confirm(struct CRawSiteToSiteClient * client, const char * transactionID) {
}
RespondCode code;
- if(readResponse(client, &code) <= 0) {
+ if (readResponse(client, &code) <= 0) {
return -1;
}
RespondCodeContext *resCode = getRespondCodeContext(code);
- if(resCode == NULL) {
+ if (resCode == NULL) {
logc(err, "Received invalid respond code: %d", code);
return -1;
}
@@ -665,7 +665,7 @@ int confirm(struct CRawSiteToSiteClient * client, const char * transactionID) {
if (strcmp(client->_description_buffer, crc) == 0) {
logc(debug, "Site2Site transaction %s CRC matched", transactionID);
- if(writeResponse(client, CONFIRM_TRANSACTION, "CONFIRM_TRANSACTION") <= 0) {
+ if (writeResponse(client, CONFIRM_TRANSACTION, "CONFIRM_TRANSACTION") <= 0) {
return -1;
}
transaction->_state = TRANSACTION_CONFIRMED;
@@ -747,12 +747,12 @@ int confirm(struct CRawSiteToSiteClient * client, const char * transactionID) {
uint64_t len = 0;
- if(ff != NULL) {
+ if (ff != NULL) {
int content_size = (int) ff->size;
uint8_t * content_buf = NULL;
- if(content_size > 0 && ff->crp != NULL) {
+ if (content_size > 0 && ff->crp != NULL) {
content_buf = (uint8_t*)malloc(content_size*sizeof(uint8_t));
int len_as_int = get_content(ff, content_buf, content_size);
if (len_as_int <= 0) {
@@ -1047,12 +1047,12 @@ int establish(struct CRawSiteToSiteClient* client) {
return -1;
}
- if(openPeer(client->_peer) != 0) {
+ if (openPeer(client->_peer) != 0) {
return -1;
}
// Negotiate the version
- if(initiateResourceNegotiation(client) != 0) {
+ if (initiateResourceNegotiation(client) != 0) {
return -1;
}
@@ -1073,14 +1073,14 @@ CTransaction * findTransaction(const struct CRawSiteToSiteClient * client, const
void deleteTransaction(struct CRawSiteToSiteClient * client, const char * id) {
CTransaction * transaction = findTransaction(client, id);
- if(transaction) {
+ if (transaction) {
HASH_DEL(client->_known_transactions, transaction);
free(transaction);
}
}
void clearTransactions(struct CRawSiteToSiteClient * client) {
- if(client->_known_transactions == NULL) {
+ if (client->_known_transactions == NULL) {
return;
}
diff --git a/nanofi/tests/CLogAggregatorTests.cpp b/nanofi/tests/CLogAggregatorTests.cpp
index 8a8e0b2..db02897 100644
--- a/nanofi/tests/CLogAggregatorTests.cpp
+++ b/nanofi/tests/CLogAggregatorTests.cpp
@@ -53,7 +53,7 @@ std::string join_strings(const std::vector<std::string>& strings, const std::str
}
const auto& initialValue = strings.at(0);
return std::accumulate(strings.begin()+1, strings.end(), initialValue,
- [token,initialValue](const std::string& s1, const std::string& s2) {
+ [token, initialValue](const std::string& s1, const std::string& s2) {
return s1 + token + s2;
});
}
diff --git a/nanofi/tests/CSite2SiteTests.cpp b/nanofi/tests/CSite2SiteTests.cpp
index 27ba284..e5af7b7 100644
--- a/nanofi/tests/CSite2SiteTests.cpp
+++ b/nanofi/tests/CSite2SiteTests.cpp
@@ -64,7 +64,7 @@ struct TransferState {
};
void wait_until(std::atomic<bool>& b) {
- while(!b) {
+ while (!b) {
std::this_thread::sleep_for(std::chrono::milliseconds(0)); // Just yield
}
}
@@ -94,7 +94,7 @@ TEST_CASE("TestSetPortId", "[S2S1]") {
void send_response_code(minifi::io::BaseStream* stream, uint8_t resp) {
std::array<uint8_t, 3> resp_codes = {'R', 'C', resp};
- for(uint8_t r : resp_codes) {
+ for (uint8_t r : resp_codes) {
stream->write(&r, 1);
}
}
@@ -110,16 +110,16 @@ void accept_transfer(minifi::io::BaseStream* stream, const std::string& crcstr,
std::string requesttype;
stream->read(requesttype);
- if(requesttype == "SEND_FLOWFILES") {
+ if (requesttype == "SEND_FLOWFILES") {
s2s_data.request_type_ok = true;
stream->read(s2s_data.attr_num);
std::string key, value;
- for(uint32_t i = 0; i < s2s_data.attr_num; ++i) {
+ for (uint32_t i = 0; i < s2s_data.attr_num; ++i) {
stream->read(key, true);
stream->read(value, true);
s2s_data.attributes[key] = value;
}
- uint64_t content_size=0;
+ uint64_t content_size = 0;
stream->read(content_size);
s2s_data.payload.resize(content_size);
stream->read(s2s_data.payload, content_size);
@@ -142,16 +142,16 @@ void sunny_path_bootstrap(minifi::io::BaseStream* stream, TransferState& transfe
// just consume handshake data
bool found_codec = false;
size_t read_len = 0;
- while(!found_codec) {
+ while (!found_codec) {
uint8_t handshake_data[1000];
int actual_len = stream->read(handshake_data+read_len, 1000-read_len);
- if(actual_len <= 0) {
+ if (actual_len <= 0) {
continue;
}
read_len += actual_len;
std::string incoming_data(reinterpret_cast<const char *>(handshake_data), read_len);
auto it = std::search(incoming_data.begin(), incoming_data.end(), CODEC_NAME.begin(), CODEC_NAME.end());
- if(it != incoming_data.end()){
+ if (it != incoming_data.end()) {
size_t idx = std::distance(incoming_data.begin(), it);
// Actual version follows the string as an uint32_t // that should be the end of the buffer
found_codec = idx + CODEC_NAME.length() + sizeof(uint32_t) == read_len;
@@ -178,7 +178,7 @@ TEST_CASE("TestSiteToBootStrap", "[S2S3]") {
std::array<std::function<void(minifi::io::BaseStream*, TransferState&, S2SReceivedData&)>, 2> bootstrap_functions =
{sunny_path_bootstrap, different_version_bootstrap};
- for(const auto& bootstrap_func : bootstrap_functions) {
+ for (const auto& bootstrap_func : bootstrap_functions) {
TransferState transfer_state;
S2SReceivedData received_data;
std::unique_ptr<minifi::io::ServerSocket> sckt(new minifi::io::RandomServerSocket("localhost"));
diff --git a/nanofi/tests/CUUIDTests.cpp b/nanofi/tests/CUUIDTests.cpp
index 03b0c75..4f58efe 100644
--- a/nanofi/tests/CUUIDTests.cpp
+++ b/nanofi/tests/CUUIDTests.cpp
@@ -25,16 +25,16 @@
bool verify_uuid(const char * uuid) {
std::string uuid_str(uuid, 36);
fprintf(stderr, "Verifying UUID %s\n", uuid_str.c_str());
- if(strlen(uuid_str.c_str()) != 36) {
+ if (strlen(uuid_str.c_str()) != 36) {
return false;
}
- for(std::size_t i = 0; i < uuid_str.length(); ++i) {
- if(i % 5 == 3 && i > 5 && i < 25) {
+ for (std::size_t i = 0; i < uuid_str.length(); ++i) {
+ if (i % 5 == 3 && i > 5 && i < 25) {
if (uuid_str[i] != '-') {
return false;
}
} else {
- if(!isxdigit(uuid_str[i])) {
+ if (!isxdigit(uuid_str[i])) {
return false;
}
}
@@ -45,7 +45,7 @@ bool verify_uuid(const char * uuid) {
TEST_CASE("Test C UUID generation", "[testCUUID]") {
char uuid[37];
CIDGenerator gen;
- for(int i = 0; i < 3; ++i) {
+ for (int i = 0; i < 3; ++i) {
gen.implementation_ = i;
generate_uuid(&gen, uuid);
REQUIRE(verify_uuid(uuid));
diff --git a/python/library/python_lib.cpp b/python/library/python_lib.cpp
index 79241df..97ac3d0 100644
--- a/python/library/python_lib.cpp
+++ b/python/library/python_lib.cpp
@@ -36,7 +36,7 @@ extern "C" {
#endif
-int init_api(const char *resource){
+int init_api(const char *resource) {
core::ClassLoader::getDefaultClassLoader().registerResource(resource, "createHttpCurlFactory");
return 0;
}