diff --git a/components/common/cpp/src/configuration.cpp b/components/common/cpp/src/configuration.cpp index b2e8c23c723f5255aa4728ef9820c2123b15f03d..3f1bcd2133a497367b9dba9c0620e809308f0bcd 100644 --- a/components/common/cpp/src/configuration.cpp +++ b/components/common/cpp/src/configuration.cpp @@ -216,6 +216,7 @@ bool ftl::config::update(const std::string &puri, const json_t &value) { if (cfg) { DLOG(1) << "Updating CFG: " << head << "[" << tail << "] = " << value; cfg->set<json_t>(tail, value); + return true; } else { DLOG(1) << "Updating: " << head << "[" << tail << "] = " << value; auto &r = resolve(head, false); diff --git a/components/common/cpp/src/loguru.cpp b/components/common/cpp/src/loguru.cpp index ccbc864b47d8c92b2883348f77e6b5972e4fa0b8..7e2c748ed6505c448aef18e7388013144172f67f 100644 --- a/components/common/cpp/src/loguru.cpp +++ b/components/common/cpp/src/loguru.cpp @@ -1,4 +1,5 @@ // Disable all warnings from gcc/clang: +#ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpragmas" @@ -15,6 +16,7 @@ #pragma GCC diagnostic ignored "-Wunknown-pragmas" #pragma GCC diagnostic ignored "-Wunused-macros" #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" +#endif // __GNUC__ #define LOGURU_REPLACE_GLOG 1 #include "loguru.hpp" diff --git a/components/common/cpp/src/uri.cpp b/components/common/cpp/src/uri.cpp index 2fcbd86d1d3c824627641474720067015fb8debd..0ecedffc6742448fbd346395bf8830827cc240cd 100644 --- a/components/common/cpp/src/uri.cpp +++ b/components/common/cpp/src/uri.cpp @@ -106,7 +106,7 @@ string URI::to_string() const { } string URI::getPathSegment(int n) const { - int N = (n < 0) ? m_pathseg.size()+n : n; + size_t N = (n < 0) ? m_pathseg.size()+n : n; if (N < 0 || N >= m_pathseg.size()) return ""; else return m_pathseg[N]; } diff --git a/components/net/cpp/include/ftl/net/ws_internal.hpp b/components/net/cpp/include/ftl/net/ws_internal.hpp index 5390f10281c860f91d35e3adf71d1101c1a0b275..94354b990dd7c10469b595b231d59660f272a658 100644 --- a/components/net/cpp/include/ftl/net/ws_internal.hpp +++ b/components/net/cpp/include/ftl/net/ws_internal.hpp @@ -42,7 +42,7 @@ int ws_dispatch(const char *data, size_t len, std::function<void(const wsheader_ * Websocket header constructor. Fills a buffer with the correct websocket * header for a given opcode, mask setting and message length. */ -int ws_prepare(wsheader_type::opcode_type, bool useMask, size_t len, char *buffer, size_t maxlen); +size_t ws_prepare(wsheader_type::opcode_type, bool useMask, size_t len, char *buffer, size_t maxlen); bool ws_connect(int sockfd, const ftl::URI &uri); diff --git a/components/net/cpp/src/listener.cpp b/components/net/cpp/src/listener.cpp index 8e0f1267f29c09c87aaea16692e08d3f93692cf9..01ab5efa7b28673e9025bb6bdb8a9dc0bedb28be 100644 --- a/components/net/cpp/src/listener.cpp +++ b/components/net/cpp/src/listener.cpp @@ -16,6 +16,7 @@ #include <arpa/inet.h> #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 +#define SOCKET int #endif #ifdef WIN32 @@ -29,8 +30,8 @@ using std::shared_ptr; using ftl::net::Peer; using ftl::URI; -int tcpListen(URI &uri) { - int ssock; +SOCKET tcpListen(URI &uri) { + SOCKET ssock; //std::cerr << "TCP Listen: " << uri.getHost() << " : " << uri.getPort() << std::endl; #ifdef WIN32 WSAData wsaData; diff --git a/components/net/cpp/src/ws_internal.cpp b/components/net/cpp/src/ws_internal.cpp index 50e9f8b5e3d029956b170c380b45815335b7f931..5c0726de2de1dcc0a9902803cb559b6842d5bf9e 100644 --- a/components/net/cpp/src/ws_internal.cpp +++ b/components/net/cpp/src/ws_internal.cpp @@ -85,10 +85,10 @@ int ftl::net::ws_dispatch(const char *data, size_t len, std::function<void(const // Perform dispatch d(ws, &data[ws.header_size], ws.N); - return ws.header_size+ws.N; + return (int)(ws.header_size+ws.N); } -int ftl::net::ws_prepare(wsheader_type::opcode_type op, bool useMask, size_t len, char *data, size_t maxlen) { +size_t ftl::net::ws_prepare(wsheader_type::opcode_type op, bool useMask, size_t len, char *data, size_t maxlen) { // TODO: // Masking key should (must) be derived from a high quality random // number generator, to mitigate attacks on non-WebSocket friendly @@ -158,7 +158,7 @@ bool ftl::net::ws_connect(int sockfd, const URI &uri) { http += "Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==\r\n"; http += "Sec-WebSocket-Version: 13\r\n"; http += "\r\n"; - int rc = ::send(sockfd, http.c_str(), http.length(), 0); + int rc = (int)::send(sockfd, http.c_str(), http.length(), 0); if (rc != (int)http.length()) { LOG(ERROR) << "Could not send Websocket http request..."; std::cout << http;