Fix portability issues for building tests in MinGW

This commit is contained in:
Mohammad Nejati
2025-07-07 10:24:40 +00:00
committed by Mohammad Nejati
parent 916dcf8eb3
commit 16f94633b1
2 changed files with 5 additions and 6 deletions

View File

@@ -16,7 +16,6 @@
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/fstream.hpp>
#include <fstream>
#include <iterator>
#include <string>
#include <type_traits>
@@ -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<char>(in),

View File

@@ -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)