Skip to content

Commit 3a62b8b

Browse files
committed
Merge bitcoin/bitcoin#22713: Fix build with Boost 1.77.0
acb7aad Fix build with Boost 1.77.0 (Rafael Sadowski) Pull request description: BOOST_FILESYSTEM_C_STR changed to accept the path as an argument. ACKs for top commit: hebasto: ACK acb7aad benthecarman: ACK acb7aad fanquake: ACK acb7aad - tested the fix with Boost 1.77.0 and 1.71.0. Tree-SHA512: c25fcb56971ee7a448cfb074f8a13696b32c16c63f81076f8a76911f93aa849c8f3637555b0b4215fa0d8b958641d7e4e60d10e103b833545cbc6b1f4009b526
2 parents 718d9f2 + acb7aad commit 3a62b8b

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/fs.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,11 @@ void ofstream::close()
242242
}
243243
#else // __GLIBCXX__
244244

245+
#if BOOST_VERSION >= 107700
246+
static_assert(sizeof(*BOOST_FILESYSTEM_C_STR(fs::path())) == sizeof(wchar_t),
247+
#else
245248
static_assert(sizeof(*fs::path().BOOST_FILESYSTEM_C_STR) == sizeof(wchar_t),
249+
#endif // BOOST_VERSION >= 107700
246250
"Warning: This build is using boost::filesystem ofstream and ifstream "
247251
"implementations which will fail to open paths containing multibyte "
248252
"characters. You should delete this static_assert to ignore this warning, "

src/wallet/test/db_tests.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ BOOST_AUTO_TEST_CASE(getwalletenv_file)
2525
std::string test_name = "test_name.dat";
2626
const fs::path datadir = gArgs.GetDataDirNet();
2727
fs::path file_path = datadir / test_name;
28+
#if BOOST_VERSION >= 107700
29+
std::ofstream f(BOOST_FILESYSTEM_C_STR(file_path));
30+
#else
2831
std::ofstream f(file_path.BOOST_FILESYSTEM_C_STR);
32+
#endif // BOOST_VERSION >= 107700
2933
f.close();
3034

3135
std::string filename;

src/wallet/test/init_test_fixture.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ InitWalletDirTestingSetup::InitWalletDirTestingSetup(const std::string& chainNam
3232
fs::create_directories(m_walletdir_path_cases["default"]);
3333
fs::create_directories(m_walletdir_path_cases["custom"]);
3434
fs::create_directories(m_walletdir_path_cases["relative"]);
35+
#if BOOST_VERSION >= 107700
36+
std::ofstream f(BOOST_FILESYSTEM_C_STR(m_walletdir_path_cases["file"]));
37+
#else
3538
std::ofstream f(m_walletdir_path_cases["file"].BOOST_FILESYSTEM_C_STR);
39+
#endif // BOOST_VERSION >= 107700
3640
f.close();
3741
}
3842

0 commit comments

Comments
 (0)