Skip to content
Snippets Groups Projects
Commit c2994719 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Attempt to resolve windows warnings

parent 45e793eb
No related branches found
No related tags found
No related merge requests found
Pipeline #11199 passed
......@@ -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);
......
// 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"
......
......@@ -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];
}
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment