From 0346889a48382fbfcd544d1731e99d52f53ed201 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 14 Feb 2022 04:50:52 +0300 Subject: [PATCH] Added a cast to suppress MSVC warning of a possible truncation. --- include/boost/filesystem/string_file.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/filesystem/string_file.hpp b/include/boost/filesystem/string_file.hpp index 3833fe4..35c8617 100644 --- a/include/boost/filesystem/string_file.hpp +++ b/include/boost/filesystem/string_file.hpp @@ -53,7 +53,7 @@ inline void load_string_file(path const& p, std::string& str) const boost::uintmax_t sz = filesystem::file_size(p); if (BOOST_UNLIKELY(sz > static_cast< boost::uintmax_t >((std::numeric_limits< std::streamsize >::max)()))) BOOST_FILESYSTEM_THROW(std::length_error("File size exceeds max read size")); - str.resize(sz, '\0'); + str.resize(static_cast< std::size_t >(sz), '\0'); if (sz > 0u) file.read(&str[0], static_cast< std::streamsize >(sz)); }