From 16f94633b17d8e8c6210ed49285b139c18f9a3e1 Mon Sep 17 00:00:00 2001 From: Mohammad Nejati Date: Mon, 7 Jul 2025 10:24:40 +0000 Subject: [PATCH] Fix portability issues for building tests in MinGW --- test/beast/core/file_test.hpp | 7 +++---- test/beast/http/file_body.cpp | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/test/beast/core/file_test.hpp b/test/beast/core/file_test.hpp index 82854bec..9e07c8e5 100644 --- a/test/beast/core/file_test.hpp +++ b/test/beast/core/file_test.hpp @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -43,7 +42,7 @@ test_file() namespace fs = boost::filesystem; static constexpr -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__) boost::winapi::WCHAR_ unicode_suffix[] = { 0xd83e, 0xdd84, 0x0000 }; // UTF-16-LE unicorn #else char unicode_suffix[] = { '\xf0', '\x9f', '\xa6', '\x84', '\x00' }; // UTF-8 unicorn @@ -112,8 +111,8 @@ test_file() [](fs::path const& path) { // no exceptions - failure will result in an empty string - std::ifstream in; - in.open(path.native()); + fs::ifstream in; + in.open(path); noskipws(in); auto s = std::string( std::istream_iterator(in), diff --git a/test/beast/http/file_body.cpp b/test/beast/http/file_body.cpp index ced22145..3f049cd4 100644 --- a/test/beast/http/file_body.cpp +++ b/test/beast/http/file_body.cpp @@ -168,7 +168,7 @@ public: "0123456789"; // 40 // create the temporary file { - std::ofstream fstemp(temp.path().native()); + std::ofstream fstemp(temp.path().string()); std::size_t written = 0; std::size_t to_write = 4097; while (written < to_write) @@ -223,7 +223,7 @@ public: "0123456789"; // 40 // create the temporary file { - std::ofstream fstemp(temp.path().native()); + std::ofstream fstemp(temp.path().string()); std::size_t written = 0; std::size_t to_write = 2048; while (written < to_write)