You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ab...@apache.org on 2020/05/04 08:39:54 UTC

[nifi-minifi-cpp] branch master updated: MINIFICPP-1151 fix easy 1stparty warnings

This is an automated email from the ASF dual-hosted git repository.

aboda pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git


The following commit(s) were added to refs/heads/master by this push:
     new 7143121  MINIFICPP-1151 fix easy 1stparty warnings
7143121 is described below

commit 7143121ff87dfb67f9234daab330b1df996bce11
Author: Marton Szasz <sz...@gmail.com>
AuthorDate: Fri Apr 24 16:06:36 2020 +0200

    MINIFICPP-1151 fix easy 1stparty warnings
    
    This closes #754
    
    Remaining:
     - MSVC: multiple warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
     - MSVC/expression language: multiple warning C4566: character represented by universal-character-name '\u????' cannot be represented in the current code page (1252)
     - clang/expression language yacc: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
    
    Squashed commit of the following:
    
    commit 9c555035ef7a3a3e8e9d12c00ea39b26f8f2d669
    Author: Marton Szasz <sz...@gmail.com>
    Date:   Wed Apr 15 18:30:10 2020 +0200
    
        MINIFICPP-1151 revert ListSFTP as its issue is already fixed on master
    
    commit bacdadbafe4aca3fe320569c984d358c5712d014
    Author: Marton Szasz <sz...@gmail.com>
    Date:   Wed Apr 15 15:46:29 2020 +0200
    
        MINIFICPP-1151 fix invalid fread usage
    
    commit 1b5ef640bbfb5421ee5e67e8c1a9eebb1aa2300e
    Author: Marton Szasz <sz...@gmail.com>
    Date:   Tue Apr 14 15:00:54 2020 +0200
    
        MINIFICPP-1151 windows (except expression language)
    
    commit 96bfa5f2d8d8d419a0d677cf72b2662c0fb98160
    Author: Marton Szasz <sz...@gmail.com>
    Date:   Tue Apr 7 10:18:26 2020 +0200
    
        MINIFICPP-1151 linux, clang 10
    
        note: rocksdb compilation correctly fails with clang 10. We will need to
        upgrade or patch it.
    
    commit aff657171ac197b85df6f5beea62d83a880622a1
    Author: Marton Szasz <sz...@gmail.com>
    Date:   Mon Feb 10 21:35:29 2020 +0100
    
        verified on clang6/linux
    
        There are some warnings due to overriding a ROCKSDB_ASSERT macro to
        throw and it's expanded inside `noexcept` functions. No idea how to fix
        that.
    
    commit 265e3a796ba7384d2ed7a463ca18bbfa704ef654
    Author: Marton Szasz <sz...@gmail.com>
    Date:   Mon Feb 10 18:05:55 2020 +0100
    
        fix compilation errors
    
    commit 5dcf968a07bf4d1d2d36cc90fbee39f16e02dea1
    Author: Marton Szasz <sz...@gmail.com>
    Date:   Mon Feb 10 15:58:05 2020 +0100
    
        MINIFICPP-1151 round #1: GCC 7 on ubuntu, default config
    
    MINIFICPP-1151 fix ProcessGroup lifetime by making it temporary
    
    Signed-off-by: Arpad Boda <ab...@apache.org>
---
 extensions/http-curl/tests/HTTPHandlers.h          | 83 +++++++++++-----------
 extensions/http-curl/tests/HTTPIntegrationBase.h   | 25 ++++---
 .../http-curl/tests/HttpGetIntegrationTest.cpp     | 20 +++---
 extensions/script/python/PyProcessSession.h        |  4 ++
 extensions/script/python/PythonScriptEngine.h      |  4 ++
 .../processors/AppendHostInfo.cpp                  |  4 ++
 .../CollectorInitiatedSubscription.cpp             |  2 +-
 libminifi/include/core/PropertyValue.h             |  4 +-
 libminifi/include/core/logging/Logger.h            | 20 +++---
 libminifi/include/core/state/Value.h               |  4 +-
 libminifi/include/utils/ThreadPool.h               |  5 --
 libminifi/src/CronDrivenSchedulingAgent.cpp        |  1 -
 .../controllers/LinuxPowerManagementService.cpp    |  4 +-
 libminifi/src/core/ProcessSession.cpp              | 34 ++++-----
 libminifi/src/core/Processor.cpp                   | 13 ++--
 libminifi/src/io/DataStream.cpp                    |  1 +
 libminifi/src/utils/ThreadPool.cpp                 |  2 +-
 libminifi/test/sensors-tests/SensorTests.cpp       |  2 +-
 main/MiNiFiWindowsService.cpp                      | 11 ++-
 nanofi/include/core/cstructs.h                     |  7 +-
 nanofi/src/api/nanofi.cpp                          |  7 +-
 nanofi/src/core/cstream.c                          | 10 +--
 nanofi/src/core/flowfiles.c                        |  8 +--
 nanofi/src/core/string_utils.c                     |  2 +-
 nanofi/src/sitetosite/CRawSocketProtocol.c         | 25 ++++---
 25 files changed, 163 insertions(+), 139 deletions(-)

diff --git a/extensions/http-curl/tests/HTTPHandlers.h b/extensions/http-curl/tests/HTTPHandlers.h
index 4d3a549..8da7b34 100644
--- a/extensions/http-curl/tests/HTTPHandlers.h
+++ b/extensions/http-curl/tests/HTTPHandlers.h
@@ -15,34 +15,33 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#ifndef LIBMINIFI_TEST_CURL_TESTS_SITETOSITEHTTP_HTTPHANDLERS_H_
+#define LIBMINIFI_TEST_CURL_TESTS_SITETOSITEHTTP_HTTPHANDLERS_H_
+
 #include "civetweb.h"
 #include "CivetServer.h"
 #include "concurrentqueue.h"
 #include "CivetStream.h"
 #include "io/CRCStream.h"
 #include "rapidjson/document.h"
+#include <cinttypes>
+#include <utility>
 
-#ifndef LIBMINIFI_TEST_CURL_TESTS_SITETOSITEHTTP_HTTPHANDLERS_H_
-#define LIBMINIFI_TEST_CURL_TESTS_SITETOSITEHTTP_HTTPHANDLERS_H_
 static std::atomic<int> transaction_id;
 static std::atomic<int> transaction_id_output;
 
-class FlowObj {
- public:
-  FlowObj()
-      : total_size(0) {
+struct FlowObj {
+  FlowObj() = default;
 
-  }
-  explicit FlowObj(const FlowObj &&other)
-      : total_size(std::move(other.total_size)),
+  FlowObj(FlowObj &&other) noexcept
+      : total_size(other.total_size),
         attributes(std::move(other.attributes)),
-        data(std::move(other.data)) {
+        data(std::move(other.data))
+  { }
 
-  }
-  uint64_t total_size;
+  uint64_t total_size{0};
   std::map<std::string, std::string> attributes;
   std::vector<uint8_t> data;
-
 };
 
 class SiteToSiteLocationResponder : public CivetHandler {
@@ -75,8 +74,8 @@ class SiteToSiteLocationResponder : public CivetHandler {
 class PeerResponder : public CivetHandler {
  public:
 
-  explicit PeerResponder(const std::string base_url)
-      : base_url(base_url) {
+  explicit PeerResponder(std::string base_url)
+      : base_url(std::move(base_url)) {
   }
 
   bool handleGet(CivetServer *server, struct mg_connection *conn) {
@@ -101,8 +100,8 @@ class PeerResponder : public CivetHandler {
 class SiteToSiteBaseResponder : public CivetHandler {
  public:
 
-  explicit SiteToSiteBaseResponder(const std::string base_url)
-      : base_url(base_url) {
+  explicit SiteToSiteBaseResponder(std::string base_url)
+      : base_url(std::move(base_url)) {
   }
 
   bool handleGet(CivetServer *server, struct mg_connection *conn) {
@@ -122,12 +121,12 @@ class SiteToSiteBaseResponder : public CivetHandler {
 class TransactionResponder : public CivetHandler {
  public:
 
-  explicit TransactionResponder(const std::string base_url, std::string port_id, bool input_port, bool wrong_uri, bool empty_transaction_uri)
-      : base_url(base_url),
+  explicit TransactionResponder(std::string base_url, std::string port_id, bool input_port, bool wrong_uri, bool empty_transaction_uri)
+      : base_url(std::move(base_url)),
         wrong_uri(wrong_uri),
         empty_transaction_uri(empty_transaction_uri),
         input_port(input_port),
-        port_id(port_id),
+        port_id(std::move(port_id)),
         flow_files_feed_(nullptr) {
 
     if (input_port) {
@@ -142,7 +141,7 @@ class TransactionResponder : public CivetHandler {
   }
 
   bool handlePost(CivetServer *server, struct mg_connection *conn) {
-    std::string site2site_rest_resp = "";
+    std::string site2site_rest_resp;
     std::stringstream headers;
     headers << "HTTP/1.1 201 OK\r\nContent-Type: application/json\r\nContent-Length: " << site2site_rest_resp.length() << "\r\nX-Location-Uri-Intent: ";
     if (wrong_uri)
@@ -200,7 +199,7 @@ class FlowFileResponder : public CivetHandler {
   }
 
   bool handlePost(CivetServer *server, struct mg_connection *conn) {
-    std::string site2site_rest_resp = "";
+    std::string site2site_rest_resp;
     std::stringstream headers;
 
     if (!wrong_uri) {
@@ -251,26 +250,27 @@ class FlowFileResponder : public CivetHandler {
   bool handleGet(CivetServer *server, struct mg_connection *conn) {
 
     if (flow_files_feed_->size_approx() > 0) {
-      std::shared_ptr<FlowObj> flow;
+      std::shared_ptr<FlowObj> flowobj;
       uint8_t buf[1];
       std::vector<std::shared_ptr<FlowObj>> flows;
       uint64_t total = 0;
 
-      while (flow_files_feed_->try_dequeue(flow)) {
-        flows.push_back(flow);
-        total += flow->total_size;
+      while (flow_files_feed_->try_dequeue(flowobj)) {
+        flows.push_back(flowobj);
+        total += flowobj->total_size;
       }
-      mg_printf(conn, "HTTP/1.1 200 OK\r\n"
-                "Content-Length: %llu\r\n"
-                "Content-Type: application/octet-stream\r\n"
-                "Connection: close\r\n\r\n",
-                total);
+      mg_printf(conn,
+          "HTTP/1.1 200 OK\r\n"
+          "Content-Length: %" PRIu64 "\r\n"
+          "Content-Type: application/octet-stream\r\n"
+          "Connection: close\r\n\r\n",
+          total);
       minifi::io::BaseStream serializer;
       minifi::io::CRCStream < minifi::io::BaseStream > stream(&serializer);
-      for (auto flow : flows) {
+      for (const auto& flow : flows) {
         uint32_t num_attributes = flow->attributes.size();
         stream.write(num_attributes);
-        for (auto entry : flow->attributes) {
+        for (const auto& entry : flow->attributes) {
           stream.writeUTF(entry.first);
           stream.writeUTF(entry.second);
         }
@@ -289,7 +289,7 @@ class FlowFileResponder : public CivetHandler {
   }
 
   void setFlowUrl(std::string flowUrl) {
-    base_url = flowUrl;
+    base_url = std::move(flowUrl);
   }
 
  protected:
@@ -308,22 +308,21 @@ class FlowFileResponder : public CivetHandler {
 class DeleteTransactionResponder : public CivetHandler {
  public:
 
-  explicit DeleteTransactionResponder(const std::string base_url, std::string response_code, int expected_resp_code)
+  explicit DeleteTransactionResponder(std::string base_url, std::string response_code, int expected_resp_code)
       : flow_files_feed_(nullptr),
-        base_url(base_url),
-        response_code(response_code) {
+        base_url(std::move(base_url)),
+        response_code(std::move(response_code)) {
     expected_resp_code_str = std::to_string(expected_resp_code);
   }
 
-  explicit DeleteTransactionResponder(const std::string base_url, std::string response_code, moodycamel::ConcurrentQueue<std::shared_ptr<FlowObj>> *feed)
+  explicit DeleteTransactionResponder(std::string base_url, std::string response_code, moodycamel::ConcurrentQueue<std::shared_ptr<FlowObj>> *feed)
       : flow_files_feed_(feed),
-        base_url(base_url),
-        response_code(response_code) {
+        base_url(std::move(base_url)),
+        response_code(std::move(response_code)) {
   }
 
   bool handleDelete(CivetServer *server, struct mg_connection *conn) {
-
-    std::string site2site_rest_resp = "";
+    std::string site2site_rest_resp;
     std::stringstream headers;
     std::string resp;
     CivetServer::getParam(conn, "responseCode", resp);
diff --git a/extensions/http-curl/tests/HTTPIntegrationBase.h b/extensions/http-curl/tests/HTTPIntegrationBase.h
index 02e4104..7c9960e 100644
--- a/extensions/http-curl/tests/HTTPIntegrationBase.h
+++ b/extensions/http-curl/tests/HTTPIntegrationBase.h
@@ -29,21 +29,20 @@ int log_message(const struct mg_connection *conn, const char *message) {
   return 1;
 }
 
-int ssl_enable(void *ssl_context, void *user_data) {
-  struct ssl_ctx_st *ctx = (struct ssl_ctx_st *) ssl_context;
+int ssl_enable(void* /*ssl_context*/, void* /*user_data*/) {
   return 0;
 }
 
 class CoapIntegrationBase : public IntegrationBase {
  public:
-  CoapIntegrationBase(uint64_t waitTime = DEFAULT_WAITTIME_MSECS)
+  explicit CoapIntegrationBase(uint64_t waitTime = DEFAULT_WAITTIME_MSECS)
       : IntegrationBase(waitTime),
         server(nullptr) {
   }
 
-  void setUrl(std::string url, CivetHandler *handler);
+  void setUrl(const std::string& url, CivetHandler *handler);
 
-  void shutdownBeforeFlowController() {
+  void shutdownBeforeFlowController() override {
     stop_webserver(server);
   }
 
@@ -59,10 +58,10 @@ class CoapIntegrationBase : public IntegrationBase {
   CivetServer *server;
 };
 
-void CoapIntegrationBase::setUrl(std::string url, CivetHandler *handler) {
+void CoapIntegrationBase::setUrl(const std::string& url, CivetHandler *handler) {
 
   parse_http_components(url, port, scheme, path);
-  struct mg_callbacks callback;
+  struct mg_callbacks callback{};
   if (server != nullptr) {
     server->addHandler(path, handler);
     return;
@@ -93,12 +92,12 @@ class VerifyC2Base : public CoapIntegrationBase {
       : isSecure(isSecure) {
   }
 
-  virtual void testSetup() {
+  void testSetup() override {
     LogTestController::getInstance().setDebug<utils::HTTPClient>();
     LogTestController::getInstance().setDebug<LogTestController>();
   }
 
-  virtual void queryRootProcessGroup(std::shared_ptr<core::ProcessGroup>) override {
+  void queryRootProcessGroup(std::shared_ptr<core::ProcessGroup>) override {
     std::string c2_url = std::string("http") + (isSecure ? "s" : "") + "://localhost:" + getWebPort() + "/api/heartbeat";
 
     configuration->set("nifi.c2.agent.protocol.class", "RESTSender");
@@ -110,7 +109,7 @@ class VerifyC2Base : public CoapIntegrationBase {
     configuration->set("nifi.c2.root.classes", "DeviceInfoNode,AgentInformation,FlowInformation");
   }
 
-  void cleanup() {
+  void cleanup() override {
     LogTestController::getInstance().reset();
   }
 
@@ -124,18 +123,18 @@ class VerifyC2Describe : public VerifyC2Base {
       : VerifyC2Base(isSecure) {
   }
 
-  void testSetup() {
+  void testSetup() override {
     LogTestController::getInstance().setTrace<minifi::c2::C2Agent>();
     LogTestController::getInstance().setDebug<minifi::c2::RESTSender>();
     LogTestController::getInstance().setInfo<minifi::FlowController>();
     VerifyC2Base::testSetup();
   }
 
-  void configureFullHeartbeat() {
+  void configureFullHeartbeat() override {
     configuration->set("nifi.c2.full.heartbeat", "false");
   }
 
-  void runAssertions() {
+  void runAssertions() override {
   }
 };
 #endif /* LIBMINIFI_TEST_INTEGRATION_HTTPINTEGRATIONBASE_H_ */
diff --git a/extensions/http-curl/tests/HttpGetIntegrationTest.cpp b/extensions/http-curl/tests/HttpGetIntegrationTest.cpp
index f117a1e..e02f22a 100644
--- a/extensions/http-curl/tests/HttpGetIntegrationTest.cpp
+++ b/extensions/http-curl/tests/HttpGetIntegrationTest.cpp
@@ -54,16 +54,15 @@ int log_message(const struct mg_connection *conn, const char *message) {
   return 1;
 }
 
-int ssl_enable(void *ssl_context, void *user_data) {
+int ssl_enable(void* /*ssl_context*/, void* /*user_data*/) {
   puts("Enable ssl");
-  struct ssl_ctx_st *ctx = (struct ssl_ctx_st *) ssl_context;
   return 0;
 }
 
 class HttpResponder : public CivetHandler {
  private:
  public:
-  bool handleGet(CivetServer *server, struct mg_connection *conn) {
+  bool handleGet(CivetServer *server, struct mg_connection *conn) override {
     puts("handle get");
     static const std::string site2site_rest_resp = "hi this is a get test";
     mg_printf(conn, "HTTP/1.1 200 OK\r\nContent-Type: "
@@ -112,24 +111,21 @@ int main(int argc, char **argv) {
 
   core::YamlConfiguration yaml_config(test_repo, test_repo, content_repo, stream_factory, configuration, test_file_location);
 
-  std::unique_ptr<core::ProcessGroup> ptr = yaml_config.getRoot(test_file_location);
-  std::shared_ptr<core::ProcessGroup> pg = std::shared_ptr<core::ProcessGroup>(ptr.get());
-  std::shared_ptr<core::Processor> proc = ptr->findProcessor("invoke");
+  std::shared_ptr<core::Processor> proc = yaml_config.getRoot(test_file_location)->findProcessor("invoke");
   assert(proc != nullptr);
 
-  std::shared_ptr<minifi::processors::InvokeHTTP> inv = std::dynamic_pointer_cast<minifi::processors::InvokeHTTP>(proc);
-
+  const auto inv = std::dynamic_pointer_cast<minifi::processors::InvokeHTTP>(proc);
   assert(inv != nullptr);
-  std::string url = "";
+
+  std::string url;
   inv->getProperty(minifi::processors::InvokeHTTP::URL.getName(), url);
-  ptr.release();
   HttpResponder h_ex;
   std::string port, scheme, path;
   CivetServer *server = nullptr;
   parse_http_components(url, port, scheme, path);
-  struct mg_callbacks callback;
+  struct mg_callbacks callback{};
     if (scheme == "https") {
-      std::string cert = "";
+      std::string cert;
       cert = key_dir + "nifi-cert.pem";
       memset(&callback, 0, sizeof(callback));
       callback.init_ssl = ssl_enable;
diff --git a/extensions/script/python/PyProcessSession.h b/extensions/script/python/PyProcessSession.h
index 9cd0faa..d418a66 100644
--- a/extensions/script/python/PyProcessSession.h
+++ b/extensions/script/python/PyProcessSession.h
@@ -27,6 +27,8 @@
 
 #include "PyBaseStream.h"
 
+#pragma GCC visibility push(hidden)
+
 namespace org {
 namespace apache {
 namespace nifi {
@@ -97,4 +99,6 @@ class PyProcessSession {
 } /* namespace apache */
 } /* namespace org */
 
+#pragma GCC visibility pop
+
 #endif //NIFI_MINIFI_CPP_PYPROCESSESSION_H
diff --git a/extensions/script/python/PythonScriptEngine.h b/extensions/script/python/PythonScriptEngine.h
index 5a6bc14..4c4d968 100644
--- a/extensions/script/python/PythonScriptEngine.h
+++ b/extensions/script/python/PythonScriptEngine.h
@@ -29,6 +29,8 @@
 #include "PyProcessSession.h"
 #include "../ScriptException.h"
 
+#pragma GCC visibility push(hidden)
+
 namespace org {
 namespace apache {
 namespace nifi {
@@ -236,4 +238,6 @@ class PythonScriptEngine : public script::ScriptEngine {
 } /* namespace apache */
 } /* namespace org */
 
+#pragma GCC visibility pop
+
 #endif //NIFI_MINIFI_CPP_PYTHONSCRIPTENGINE_H
diff --git a/extensions/standard-processors/processors/AppendHostInfo.cpp b/extensions/standard-processors/processors/AppendHostInfo.cpp
index 0966f09..e9fdb69 100644
--- a/extensions/standard-processors/processors/AppendHostInfo.cpp
+++ b/extensions/standard-processors/processors/AppendHostInfo.cpp
@@ -18,7 +18,11 @@
  * limitations under the License.
  */
 #include "AppendHostInfo.h"
+
+#ifndef __USE_POSIX
 #define __USE_POSIX
+#endif /* __USE_POSIX */
+
 #include <limits.h>
 #include <string.h>
 #include <memory>
diff --git a/extensions/windows-event-log/CollectorInitiatedSubscription.cpp b/extensions/windows-event-log/CollectorInitiatedSubscription.cpp
index d0a179d..7c68f38 100644
--- a/extensions/windows-event-log/CollectorInitiatedSubscription.cpp
+++ b/extensions/windows-event-log/CollectorInitiatedSubscription.cpp
@@ -577,7 +577,7 @@ bool CollectorInitiatedSubscription::subscribe(const std::shared_ptr<core::Proce
         auto& logger = pCollectorInitiatedSubscription->logger_;
 
         if (action == EvtSubscribeActionError) {
-          if (ERROR_EVT_QUERY_RESULT_STALE == reinterpret_cast<DWORD>(hEvent)) {
+          if (ERROR_EVT_QUERY_RESULT_STALE == reinterpret_cast<intptr_t>(hEvent)) {
             logger->log_error("Received missing event notification. Consider triggering processor more frequently or increasing queue size.");
           } else {
             logger->log_error("Received the following Win32 error: %x", hEvent);
diff --git a/libminifi/include/core/PropertyValue.h b/libminifi/include/core/PropertyValue.h
index bbdaf98..782c941 100644
--- a/libminifi/include/core/PropertyValue.h
+++ b/libminifi/include/core/PropertyValue.h
@@ -210,8 +210,8 @@ class PropertyValue : public state::response::ValueNode {
   std::shared_ptr<PropertyValidator> validator_;
 };
 
-inline char const* conditional_conversion(const PropertyValue &v) {
-  return v.getValue()->getStringValue().c_str();
+inline std::string conditional_conversion(const PropertyValue &v) {
+  return v.getValue()->getStringValue();
 }
 
 } /* namespace core */
diff --git a/libminifi/include/core/logging/Logger.h b/libminifi/include/core/logging/Logger.h
index f8321f9..fa1c254 100644
--- a/libminifi/include/core/logging/Logger.h
+++ b/libminifi/include/core/logging/Logger.h
@@ -47,10 +47,19 @@ class LoggerControl {
   std::atomic<bool> is_enabled_;
 };
 
+inline char const* conditional_conversion(std::string const& str) {
+  return str.c_str();
+}
+
+template<typename T>
+inline T conditional_conversion(T const& t) {
+  return t;
+}
+
 template<typename ... Args>
 inline std::string format_string(char const* format_str, Args&&... args) {
   char buf[LOG_BUFFER_SIZE];
-  std::snprintf(buf, LOG_BUFFER_SIZE, format_str, args...);
+  std::snprintf(buf, LOG_BUFFER_SIZE, format_str, conditional_conversion(std::forward<Args>(args))...);
   return std::string(buf);
 }
 
@@ -58,15 +67,6 @@ inline std::string format_string(char const* format_str) {
   return format_str;
 }
 
-inline char const* conditional_conversion(std::string const& str) {
-  return str.c_str();
-}
-
-template<typename T>
-inline T conditional_conversion(T const& t) {
-  return t;
-}
-
 typedef enum {
   trace = 0,
   debug = 1,
diff --git a/libminifi/include/core/state/Value.h b/libminifi/include/core/state/Value.h
index 6e3a644..8db05a1 100644
--- a/libminifi/include/core/state/Value.h
+++ b/libminifi/include/core/state/Value.h
@@ -159,7 +159,7 @@ class UInt32Value : public Value {
   }
 
   virtual bool getValue(int &ref) {
-    if (value <= (std::numeric_limits<int>::max)()) {
+    if (value <= static_cast<uint32_t>((std::numeric_limits<int>::max)())) {
       ref = value;
       return true;
     }
@@ -323,7 +323,7 @@ class UInt64Value : public Value {
   }
 
   virtual bool getValue(int64_t &ref) {
-    if (value <= (std::numeric_limits<int64_t>::max)()) {
+    if (value <= static_cast<uint32_t>((std::numeric_limits<int64_t>::max)())) {
       ref = value;
       return true;
     }
diff --git a/libminifi/include/utils/ThreadPool.h b/libminifi/include/utils/ThreadPool.h
index 56a550e..36cbbae 100644
--- a/libminifi/include/utils/ThreadPool.h
+++ b/libminifi/include/utils/ThreadPool.h
@@ -355,11 +355,6 @@ class ThreadPool {
   void manageWorkers();
 
   /**
-   * Function to adjust the workers up and down.
-   */
-  void adjustWorkers(int count);
-
-  /**
    * Runs worker tasks
    */
   void run_tasks(std::shared_ptr<WorkerThread> thread);
diff --git a/libminifi/src/CronDrivenSchedulingAgent.cpp b/libminifi/src/CronDrivenSchedulingAgent.cpp
index 53c2522..cb0f81c 100644
--- a/libminifi/src/CronDrivenSchedulingAgent.cpp
+++ b/libminifi/src/CronDrivenSchedulingAgent.cpp
@@ -35,7 +35,6 @@ namespace minifi {
 utils::TaskRescheduleInfo CronDrivenSchedulingAgent::run(const std::shared_ptr<core::Processor> &processor, const std::shared_ptr<core::ProcessContext> &processContext,
                                         const std::shared_ptr<core::ProcessSessionFactory> &sessionFactory) {
   if (this->running_ && processor->isRunning()) {
-    std::chrono::system_clock::time_point leap_nanos;
     auto uuidStr = processor->getUUIDStr();
     std::chrono::system_clock::time_point result;
     std::chrono::system_clock::time_point from = std::chrono::system_clock::now();
diff --git a/libminifi/src/controllers/LinuxPowerManagementService.cpp b/libminifi/src/controllers/LinuxPowerManagementService.cpp
index f1c31a7..a42ad41 100644
--- a/libminifi/src/controllers/LinuxPowerManagementService.cpp
+++ b/libminifi/src/controllers/LinuxPowerManagementService.cpp
@@ -64,7 +64,7 @@ uint16_t LinuxPowerManagerService::getMaxThreads() {
 }
 
 bool LinuxPowerManagerService::canIncrease() {
-  for (const auto path_pair : paths_) {
+  for (const auto& path_pair : paths_) {
     try {
       auto capacity = path_pair.first;
       auto status = path_pair.second;
@@ -107,7 +107,7 @@ bool LinuxPowerManagerService::shouldReduce() {
   bool all_discharging = !paths_.empty();
 
   int battery_sum = 0;
-  for (const auto path_pair : paths_) {
+  for (const auto& path_pair : paths_) {
     try {
       auto capacity = path_pair.first;
       auto status = path_pair.second;
diff --git a/libminifi/src/core/ProcessSession.cpp b/libminifi/src/core/ProcessSession.cpp
index 9d5a13d..ca55ce1 100644
--- a/libminifi/src/core/ProcessSession.cpp
+++ b/libminifi/src/core/ProcessSession.cpp
@@ -186,7 +186,7 @@ std::shared_ptr<core::FlowFile> ProcessSession::clone(const std::shared_ptr<core
         // Set offset and size
         logger_->log_error("clone offset %" PRId64 " and size %" PRId64 " exceed parent size %" PRIu64, offset, size, parent->getSize());
         // Remove the Add FlowFile for the session
-        std::map<std::string, std::shared_ptr<core::FlowFile> >::iterator it = this->_addedFlowFiles.find(record->getUUIDStr());
+        auto it = this->_addedFlowFiles.find(record->getUUIDStr());
         if (it != this->_addedFlowFiles.end())
           this->_addedFlowFiles.erase(record->getUUIDStr());
         return nullptr;
@@ -321,7 +321,6 @@ void ProcessSession::append(const std::shared_ptr<core::FlowFile> &flow, OutputS
       rollback();
       return;
     }
-    uint64_t appendSize = stream->getSize() - oldPos;
     flow->setSize(stream->getSize());
 
     std::stringstream details;
@@ -544,7 +543,7 @@ void ProcessSession::import(const std::string& source, std::vector<std::shared_p
         throw Exception(FILE_OPERATION_EXCEPTION, "File Import Error");
       }
       if (offset != 0U) {
-        input.seekg(offset, input.beg);
+        input.seekg(offset, std::ifstream::beg);
         if (!input.good()) {
           logger_->log_error("Seeking to %lu failed for file %s (does file/filesystem support seeking?)", offset, source);
           throw Exception(FILE_OPERATION_EXCEPTION, "File Import Error");
@@ -568,7 +567,11 @@ void ProcessSession::import(const std::string& source, std::vector<std::shared_p
         while (true) {
           startTime = getTimeMillis();
           uint8_t* delimiterPos = std::find(begin, end, static_cast<uint8_t>(inputDelimiter));
-          int len = delimiterPos - begin;
+          const ptrdiff_t zlen{ delimiterPos - begin };
+          if (zlen < std::numeric_limits<int>::min() || zlen > std::numeric_limits<int>::max()) {
+            logger_->log_error("narrowing conversion failed");
+          }
+          const int len = zlen;
 
           logging::LOG_TRACE(logger_) << "Read input of " << read << " length is " << len << " is at end?" << (delimiterPos == end);
           /*
@@ -729,7 +732,7 @@ void ProcessSession::commit() {
       std::shared_ptr<core::FlowFile> record = it.second;
       if (record->isDeleted())
         continue;
-      std::map<std::string, Relationship>::iterator itRelationship = this->_transferRelationship.find(record->getUUIDStr());
+      auto itRelationship = this->_transferRelationship.find(record->getUUIDStr());
       if (itRelationship != _transferRelationship.end()) {
         Relationship relationship = itRelationship->second;
         // Find the relationship, we need to find the connections for that relationship
@@ -746,7 +749,7 @@ void ProcessSession::commit() {
           }
         } else {
           // We connections, clone the flow and assign the connection accordingly
-          for (std::set<std::shared_ptr<Connectable>>::iterator itConnection = connections.begin(); itConnection != connections.end(); ++itConnection) {
+          for (auto itConnection = connections.begin(); itConnection != connections.end(); ++itConnection) {
             std::shared_ptr<Connectable> connection = *itConnection;
             if (itConnection == connections.begin()) {
               // First connection which the flow need be routed to
@@ -769,11 +772,11 @@ void ProcessSession::commit() {
     }
 
     // Do the same thing for added flow file
-    for (const auto it : _addedFlowFiles) {
+    for (const auto& it : _addedFlowFiles) {
       std::shared_ptr<core::FlowFile> record = it.second;
       if (record->isDeleted())
         continue;
-      std::map<std::string, Relationship>::iterator itRelationship = this->_transferRelationship.find(record->getUUIDStr());
+      auto itRelationship = this->_transferRelationship.find(record->getUUIDStr());
       if (itRelationship != _transferRelationship.end()) {
         Relationship relationship = itRelationship->second;
         // Find the relationship, we need to find the connections for that relationship
@@ -791,7 +794,7 @@ void ProcessSession::commit() {
           }
         } else {
           // We connections, clone the flow and assign the connection accordingly
-          for (std::set<std::shared_ptr<Connectable>>::iterator itConnection = connections.begin(); itConnection != connections.end(); ++itConnection) {
+          for (auto itConnection = connections.begin(); itConnection != connections.end(); ++itConnection) {
             std::shared_ptr<Connectable> connection(*itConnection);
             if (itConnection == connections.begin()) {
               // First connection which the flow need be routed to
@@ -917,9 +920,9 @@ void ProcessSession::rollback() {
 std::shared_ptr<core::FlowFile> ProcessSession::get() {
   std::shared_ptr<Connectable> first = process_context_->getProcessorNode()->getNextIncomingConnection();
 
-  if (first == NULL) {
+  if (first == nullptr) {
     logger_->log_trace("Get is null for %s", process_context_->getProcessorNode()->getName());
-    return NULL;
+    return nullptr;
   }
 
   std::shared_ptr<Connection> current = std::static_pointer_cast<Connection>(first);
@@ -927,10 +930,9 @@ std::shared_ptr<core::FlowFile> ProcessSession::get() {
   do {
     std::set<std::shared_ptr<core::FlowFile> > expired;
     std::shared_ptr<core::FlowFile> ret = current->poll(expired);
-    if (expired.size() > 0) {
+    if (!expired.empty()) {
       // Remove expired flow record
-      for (std::set<std::shared_ptr<core::FlowFile> >::iterator it = expired.begin(); it != expired.end(); ++it) {
-        std::shared_ptr<core::FlowFile> record = *it;
+      for (const auto& record : expired) {
         std::stringstream details;
         details << process_context_->getProcessorNode()->getName() << " expire flow record " << record->getUUIDStr();
         provenance_report_->expire(record, details.str());
@@ -955,9 +957,9 @@ std::shared_ptr<core::FlowFile> ProcessSession::get() {
       return ret;
     }
     current = std::static_pointer_cast<Connection>(process_context_->getProcessorNode()->getNextIncomingConnection());
-  } while (current != NULL && current != first);
+  } while (current != nullptr && current != first);
 
-  return NULL;
+  return nullptr;
 }
 
 bool ProcessSession::outgoingConnectionsFull(const std::string& relationship) {
diff --git a/libminifi/src/core/Processor.cpp b/libminifi/src/core/Processor.cpp
index 46d0794..357ca97 100644
--- a/libminifi/src/core/Processor.cpp
+++ b/libminifi/src/core/Processor.cpp
@@ -217,14 +217,13 @@ bool Processor::flowFilesQueued() {
 bool Processor::flowFilesOutGoingFull() {
   std::lock_guard<std::mutex> lock(mutex_);
 
-  for (auto &&connection : out_going_connections_) {
+  for (const auto& connection_pair : out_going_connections_) {
     // We already has connection for this relationship
-    std::set<std::shared_ptr<Connectable>> existedConnection = connection.second;
-    for (const auto conn : existedConnection) {
-      std::shared_ptr<Connection> connection = std::static_pointer_cast<Connection>(conn);
-      if (connection->isFull())
-        return true;
-    }
+    std::set<std::shared_ptr<Connectable>> existedConnection = connection_pair.second;
+    const bool has_full_connection = std::any_of(begin(existedConnection), end(existedConnection), [](const std::shared_ptr<Connectable>& conn) {
+      return std::static_pointer_cast<Connection>(conn)->isFull();
+    });
+    if (has_full_connection) { return true; }
   }
 
   return false;
diff --git a/libminifi/src/io/DataStream.cpp b/libminifi/src/io/DataStream.cpp
index 3a53489..e3bdf08 100644
--- a/libminifi/src/io/DataStream.cpp
+++ b/libminifi/src/io/DataStream.cpp
@@ -122,6 +122,7 @@ int DataStream::doReadData(uint8_t *buf, int buflen) noexcept {
   const auto write_end = std::copy(read_start, read_end, buf);
 
   assert(std::distance(buf, write_end) == buflen && "read buflen bytes");
+  (void)write_end;
 
   // increase offset for the next read
   readBuffer += buflen;
diff --git a/libminifi/src/utils/ThreadPool.cpp b/libminifi/src/utils/ThreadPool.cpp
index 7bafd60..99f2912 100644
--- a/libminifi/src/utils/ThreadPool.cpp
+++ b/libminifi/src/utils/ThreadPool.cpp
@@ -186,7 +186,7 @@ void ThreadPool<T>::start() {
   if (!running_) {
     running_ = true;
     worker_queue_.start();
-    manager_thread_ = std::move(std::thread(&ThreadPool::manageWorkers, this));
+    manager_thread_ = std::thread(&ThreadPool::manageWorkers, this);
 
     std::lock_guard<std::mutex> quee_lock(worker_queue_mutex_);
     delayed_scheduler_thread_ = std::thread(&ThreadPool<T>::manage_delayed_queue, this);
diff --git a/libminifi/test/sensors-tests/SensorTests.cpp b/libminifi/test/sensors-tests/SensorTests.cpp
index 6c995d5..40047f5 100644
--- a/libminifi/test/sensors-tests/SensorTests.cpp
+++ b/libminifi/test/sensors-tests/SensorTests.cpp
@@ -78,7 +78,7 @@ class PcapTestHarness : public IntegrationBase {
   }
 
  protected:
-  char *dir;
+  std::string dir;
   TestController testController;
 };
 
diff --git a/main/MiNiFiWindowsService.cpp b/main/MiNiFiWindowsService.cpp
index 4e243a0..139eeb4 100644
--- a/main/MiNiFiWindowsService.cpp
+++ b/main/MiNiFiWindowsService.cpp
@@ -28,6 +28,15 @@
 #include "core/FlowConfiguration.h"
 
 //#define DEBUG_SERVICE
+#ifdef LOG_INFO
+  #undef LOG_INFO
+#endif
+#ifdef LOG_ERROR
+  #undef LOG_ERROR
+#endif
+#ifdef LOG_LASTERROR
+  #undef LOG_LASTERROR
+#endif
 
 #ifdef DEBUG_SERVICE
   #define LOG_INFO(...)       OutputDebug(__VA_ARGS__)
@@ -44,7 +53,7 @@
 // Implemented in MiNiFiMain.cpp
 void SignalExitProcess();
 
-static char* SERVICE_TERMINATION_EVENT_NAME = "Global\\MiNiFiServiceTermination";
+static const char* const SERVICE_TERMINATION_EVENT_NAME = "Global\\MiNiFiServiceTermination";
 
 static void OutputDebug(const char* format, ...) {
   va_list args;
diff --git a/nanofi/include/core/cstructs.h b/nanofi/include/core/cstructs.h
index 846be5b..034977c 100644
--- a/nanofi/include/core/cstructs.h
+++ b/nanofi/include/core/cstructs.h
@@ -142,7 +142,12 @@ typedef struct file_buffer {
   uint64_t file_len;
 } file_buffer;
 
-#ifndef _WIN32
+#if defined(_WIN32) && defined(_WIN64)
+#define PRI_SOCKET "llu"
+#elif defined(_WIN32)
+#define PRI_SOCKET "u"
+#else
+#define PRI_SOCKET "d"
 typedef int SOCKET;
 #endif
 
diff --git a/nanofi/src/api/nanofi.cpp b/nanofi/src/api/nanofi.cpp
index e8ea25a..29944bb 100644
--- a/nanofi/src/api/nanofi.cpp
+++ b/nanofi/src/api/nanofi.cpp
@@ -60,9 +60,14 @@ file_buffer file_to_buffer(const char *path) {
   rewind(fileptr);
 
   buffer = (uint8_t *)malloc((filelen+1)*sizeof(uint8_t)); // Enough memory for file + \0
-  fread(buffer, filelen, 1, fileptr);
+  const size_t read_result = fread(buffer, filelen, 1, fileptr);
   fclose(fileptr);
 
+  if (read_result != 1) {
+    free(buffer);
+    return fb;
+  }
+
   fb.buffer = buffer;
   fb.file_len = filelen;
   return fb;
diff --git a/nanofi/src/core/cstream.c b/nanofi/src/core/cstream.c
index 3919728..2c220ed 100644
--- a/nanofi/src/core/cstream.c
+++ b/nanofi/src/core/cstream.c
@@ -54,7 +54,7 @@ int write_buffer(const uint8_t *value, int len, cstream * stream) {
       if (ret < 0 && errno == EINTR) {
         continue;
       }
-      logc(err, "Could not send to %d, error: %s", stream->socket_, strerror(errno));
+      logc(err, "Could not send to %" PRI_SOCKET ", error: %s", stream->socket_, strerror(errno));
       close_stream(stream);
       return ret;
     }
@@ -62,7 +62,7 @@ int write_buffer(const uint8_t *value, int len, cstream * stream) {
   }
 
   if (bytes)
-    logc(trace, "Sent data size %d over socket %d", bytes, stream->socket_);
+    logc(trace, "Sent data size %d over socket %" PRI_SOCKET, bytes, stream->socket_);
   return bytes;
 }
 
@@ -72,12 +72,12 @@ int read_buffer(uint8_t *buf, int len, cstream * stream) {
     int bytes_read = recv(stream->socket_, buf, len, 0);
     if (bytes_read <= 0) {
       if (bytes_read == 0) {
-        logc(debug, "Other side hung up on %d",stream->socket_);
+        logc(debug, "Other side hung up on %" PRI_SOCKET, stream->socket_);
       } else {
         if (errno == EINTR) {
           continue;
         }
-        logc(err, "Could not recv on %d, error: %s", stream->socket_, strerror(errno));
+        logc(err, "Could not recv on %" PRI_SOCKET ", error: %s", stream->socket_, strerror(errno));
       }
       return -1;
     }
@@ -86,7 +86,7 @@ int read_buffer(uint8_t *buf, int len, cstream * stream) {
     total_read += bytes_read;
   }
   if(total_read)
-    logc(trace, "Received data size %d over socket %d", total_read, stream->socket_);
+    logc(trace, "Received data size %d over socket %" PRI_SOCKET, total_read, stream->socket_);
   return total_read;
 }
 
diff --git a/nanofi/src/core/flowfiles.c b/nanofi/src/core/flowfiles.c
index 6c86e98..1ccba47 100644
--- a/nanofi/src/core/flowfiles.c
+++ b/nanofi/src/core/flowfiles.c
@@ -17,7 +17,6 @@
  */
 
 #include "api/nanofi.h"
-#include "api/ecu.h"
 #include "core/flowfiles.h"
 
 #include "utlist.h"
@@ -25,6 +24,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/stat.h>
+#include <inttypes.h>
 
 flow_file_list * add_flow_file_record(flow_file_list ** ff_list, flow_file_record * record) {
     if (!record) {
@@ -52,7 +52,7 @@ void free_flow_file_list(flow_file_list ** ff_list) {
 
 void add_attributes(flow_file_record * ffr, const char * file_path, uint64_t curr_offset) {
     char offset_str[21];
-    snprintf(offset_str, sizeof(offset_str), "%llu", curr_offset);
+    snprintf(offset_str, sizeof(offset_str), "%"PRIu64, curr_offset);
     add_attribute(ffr, "current offset", offset_str, strlen(offset_str));
     char content_location[strlen(ffr->contentLocation) + 1];
     snprintf(content_location, sizeof(content_location), "%s", ffr->contentLocation);
@@ -62,7 +62,7 @@ void add_attributes(flow_file_record * ffr, const char * file_path, uint64_t cur
 
 void update_attributes(flow_file_record * ffr, const char * file_path, uint64_t curr_offset) {
     char offset_str[21];
-    snprintf(offset_str, sizeof(offset_str), "%llu", curr_offset);
+    snprintf(offset_str, sizeof(offset_str), "%"PRIu64, curr_offset);
     update_attribute(ffr, "current offset", offset_str, strlen(offset_str));
     char content_location[strlen(ffr->contentLocation) + 1];
     snprintf(content_location, sizeof(content_location), "%s", ffr->contentLocation);
@@ -119,7 +119,7 @@ void read_payload_and_transmit(struct flow_file_list * ffl, struct CRawSiteToSit
         buff[count] = '\0';
         begin_offset += count;
         char offset_str[21];
-        snprintf(offset_str, sizeof(offset_str), "%llu", begin_offset);
+        snprintf(offset_str, sizeof(offset_str), "%"PRIu64, begin_offset);
         update_attribute(ffl->ff_record, "current offset", offset_str, strlen(offset_str));
 
         attribute_set as;
diff --git a/nanofi/src/core/string_utils.c b/nanofi/src/core/string_utils.c
index 6c6b8ea..b513b30 100644
--- a/nanofi/src/core/string_utils.c
+++ b/nanofi/src/core/string_utils.c
@@ -69,7 +69,7 @@ void print_token_list(token_list * tokens) {
         token_node * head = tokens->head;
         int i = 0;
         while (head) {
-            printf("Token %d : %s Length = %lu\n", i, head->data, strlen(head->data));
+            printf("Token %d : %s Length = %zu\n", i, head->data, strlen(head->data));
             head = head->next;
             ++i;
         }
diff --git a/nanofi/src/sitetosite/CRawSocketProtocol.c b/nanofi/src/sitetosite/CRawSocketProtocol.c
index 73741f2..7c50086 100644
--- a/nanofi/src/sitetosite/CRawSocketProtocol.c
+++ b/nanofi/src/sitetosite/CRawSocketProtocol.c
@@ -17,6 +17,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <inttypes.h>
 
 #include "uthash.h"
 #include "sitetosite/CRawSocketProtocol.h"
@@ -93,21 +94,23 @@ int handShake(struct CRawSiteToSiteClient * client) {
   current = (PropertyValue *)malloc(sizeof(PropertyValue));
 
   current->name = HandShakePropertyStr[GZIP];
-  strncpy(current->value, "false", strlen("false") +1);
+  strncpy(current->value, "false", sizeof(current->value));
+  current->value[sizeof(current->value) - 1] = '\0';
 
   HASH_ADD_KEYPTR(hh, properties, current->name, strlen(current->name), current);
 
   current = (PropertyValue *)malloc(sizeof(PropertyValue));
 
   current->name = HandShakePropertyStr[PORT_IDENTIFIER];
-  strncpy(current->value, client->_port_id_str, strlen(client->_port_id_str) +1);
+  strncpy(current->value, client->_port_id_str, sizeof(current->value));
+  current->value[sizeof(current->value) - 1] = '\0';
 
   HASH_ADD_KEYPTR(hh, properties, current->name, strlen(current->name), current);
 
   current = (PropertyValue *)malloc(sizeof(PropertyValue));
 
   current->name = HandShakePropertyStr[REQUEST_EXPIRATION_MILLIS];
-  sprintf(current->value, "%llu", client->_timeout);
+  sprintf(current->value, "%"PRIu64, client->_timeout);
 
   HASH_ADD_KEYPTR(hh, properties, current->name, strlen(current->name), current);
 
@@ -118,7 +121,7 @@ int handShake(struct CRawSiteToSiteClient * client) {
       current = (PropertyValue *)malloc(sizeof(PropertyValue));
 
       current->name = HandShakePropertyStr[BATCH_COUNT];
-      sprintf(current->value, "%llu", client->_batch_count);
+      sprintf(current->value, "%"PRIu64, client->_batch_count);
 
       HASH_ADD_KEYPTR(hh, properties, current->name, strlen(current->name), current);
 
@@ -128,7 +131,7 @@ int handShake(struct CRawSiteToSiteClient * client) {
       current = (PropertyValue *)malloc(sizeof(PropertyValue));
 
       current->name = HandShakePropertyStr[BATCH_SIZE];
-      sprintf(current->value, "%llu", client->_batch_size);
+      sprintf(current->value, "%"PRIu64, client->_batch_size);
 
       HASH_ADD_KEYPTR(hh, properties, current->name, strlen(current->name), current);
 
@@ -138,7 +141,7 @@ int handShake(struct CRawSiteToSiteClient * client) {
       current = (PropertyValue *)malloc(sizeof(PropertyValue));
 
       current->name = HandShakePropertyStr[BATCH_DURATION];
-      sprintf(current->value, "%llu", client->_batch_duration);
+      sprintf(current->value, "%"PRIu64, client->_batch_duration);
 
       HASH_ADD_KEYPTR(hh, properties, current->name, strlen(current->name), current);
 
@@ -426,7 +429,7 @@ int transmitPayload(struct CRawSiteToSiteClient * client, const char * payload,
     tearDown(client);
     return resp;
   }
-  logc(info, "Site2Site transaction %s sent bytes length %lu", transactionID, strlen(payload));
+  logc(info, "Site2Site transaction %s sent bytes length %zu", transactionID, strlen(payload));
 
 
   int ret = confirm(client, transactionID);
@@ -549,9 +552,9 @@ int confirm(struct CRawSiteToSiteClient * client, const char * transactionID) {
     // time window involved in the entire transaction, it is reduced to a simple round-trip conversation.
     int64_t crcValue = getCRC(transaction);
     char crc[40];
-    sprintf(crc, "%lld", crcValue);
+    sprintf(crc, "%"PRId64, crcValue);
 
-    logc(debug, "Site2Site Send confirm with CRC %lld to transaction %s", crcValue, transactionID);
+    logc(debug, "Site2Site Send confirm with CRC %"PRId64" to transaction %s", crcValue, transactionID);
     if (writeResponse(client, CONFIRM_TRANSACTION, crc) <= 0) {
       return -1;
     }
@@ -627,7 +630,7 @@ int confirm(struct CRawSiteToSiteClient * client, const char * transactionID) {
         int64_t crcValue = getCRC(transaction);
         char crc[40];
         memset(crc, 0, 40);
-        sprintf(crc, "%lld", crcValue);
+        sprintf(crc, "%"PRId64, crcValue);
 
         if (strcmp(client->_description_buffer, crc) == 0) {
           logc(debug, "Site2Site transaction %s CRC matched", transactionID);
@@ -755,7 +758,7 @@ int confirm(struct CRawSiteToSiteClient * client, const char * transactionID) {
     transaction->_state = DATA_EXCHANGED;
     transaction->_bytes += len;
 
-    logc(info, "Site to Site transaction %s sent flow %d flow records, with total size %llu", transactionID,
+    logc(info, "Site to Site transaction %s sent flow %d flow records, with total size %"PRIu64, transactionID,
         transaction->total_transfers_, transaction->_bytes);
 
     return 0;