Skip to content

Commit 8273964

Browse files
committed
fixed windows compile warnings
1 parent 90bb821 commit 8273964

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

src/http/http.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include <system_error>
55
#include <utility>
66
#include <vector>
7+
#include <algorithm>
8+
79
namespace netlib::http {
810

911
using http_header_entry = std::pair<std::string, std::string>;

src/socket.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ using ssize_t = signed long long int;
2525
#define MSG_NOSIGNAL 0
2626
//poll implementation
2727
#define poll_syscall ::WSAPoll
28+
//we ignore unused parameter warning on windows, missing impls
29+
#pragma warning(disable: 4100)
30+
//use unsafe functions under windows
31+
#define _CRT_SECURE_NO_WARNINGS
32+
#pragma warning(disable:4996)
33+
#pragma warning(disable:4267)
34+
#pragma warning(disable:4244)
35+
2836
#else
2937
// headers
3038
#include <arpa/inet.h>

src/socket_operations.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class operations {
2929

3030
std::size_t remaining_bytes = data.size() - total_sent_size;
3131
std::size_t actual_chunk_size = (remaining_bytes > chunk_size) ? chunk_size : remaining_bytes;
32-
ssize_t send_res = ::send(sock.get_raw().value(), data_pointer, actual_chunk_size, MSG_NOSIGNAL);
32+
ssize_t send_res = ::send(sock.get_raw().value(), data_pointer, static_cast<int32_t>(actual_chunk_size), MSG_NOSIGNAL);
3333
if (send_res > 0) {
3434
total_sent_size += static_cast<std::size_t>(send_res);
3535
data_pointer += send_res;

tests/test_http_parser.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "../doctest/doctest/doctest.h"
22
#include "../src/http/http.hpp"
33
#include "../src/netlib.hpp"
4-
#include <atomic>
54

65
using namespace std::chrono_literals;
76
extern uint16_t test_port;

0 commit comments

Comments
 (0)