#if defined(BOOST_WINDOWS)
#include <cstring>
#include <limits>
-#include <boost/detail/winapi/get_last_error.hpp>
-#include <boost/detail/winapi/character_code_conversion.hpp>
+#include <boost/winapi/get_last_error.hpp>
+#include <boost/winapi/character_code_conversion.hpp>
#endif
#include <boost/log/detail/header.hpp>
const SourceCharT* const original_begin = begin;
state_type state = state_type();
- std::size_t buf_size = std::min(max_size, sizeof(converted_buffer) / sizeof(*converted_buffer));
+ std::size_t buf_size = (std::min)(max_size, sizeof(converted_buffer) / sizeof(*converted_buffer));
while (begin != end && buf_size > 0u)
{
TargetCharT* dest = converted_buffer;
case std::codecvt_base::noconv:
{
// Not possible, unless both character types are actually equivalent
- const std::size_t size = std::min(max_size, static_cast< std::size_t >(end - begin));
+ const std::size_t size = (std::min)(max_size, static_cast< std::size_t >(end - begin));
converted.append(begin, begin + size);
begin += size;
max_size -= size;
BOOST_LOG_THROW_DESCR(conversion_error, "Could not convert character encoding");
}
- buf_size = std::min(max_size, sizeof(converted_buffer) / sizeof(*converted_buffer));
+ buf_size = (std::min)(max_size, sizeof(converted_buffer) / sizeof(*converted_buffer));
}
done:
else if (BOOST_UNLIKELY(utf8_len > static_cast< std::size_t >((std::numeric_limits< int >::max)())))
BOOST_LOG_THROW_DESCR(bad_alloc, "UTF-8 string too long");
- int len = boost::detail::winapi::MultiByteToWideChar(boost::detail::winapi::CP_UTF8_, boost::detail::winapi::MB_ERR_INVALID_CHARS_, str, static_cast< int >(utf8_len), NULL, 0);
+ int len = boost::winapi::MultiByteToWideChar(boost::winapi::CP_UTF8_, boost::winapi::MB_ERR_INVALID_CHARS_, str, static_cast< int >(utf8_len), NULL, 0);
if (BOOST_LIKELY(len > 0))
{
std::wstring wstr;
wstr.resize(len);
- len = boost::detail::winapi::MultiByteToWideChar(boost::detail::winapi::CP_UTF8_, boost::detail::winapi::MB_ERR_INVALID_CHARS_, str, static_cast< int >(utf8_len), &wstr[0], len);
+ len = boost::winapi::MultiByteToWideChar(boost::winapi::CP_UTF8_, boost::winapi::MB_ERR_INVALID_CHARS_, str, static_cast< int >(utf8_len), &wstr[0], len);
if (BOOST_LIKELY(len > 0))
{
return wstr;
}
}
- const boost::detail::winapi::DWORD_ err = boost::detail::winapi::GetLastError();
+ const boost::winapi::DWORD_ err = boost::winapi::GetLastError();
BOOST_LOG_THROW_DESCR_PARAMS(system_error, "Failed to convert UTF-8 to UTF-16", (err));
BOOST_LOG_UNREACHABLE_RETURN(std::wstring());
}
else if (BOOST_UNLIKELY(utf16_len > static_cast< std::size_t >((std::numeric_limits< int >::max)())))
BOOST_LOG_THROW_DESCR(bad_alloc, "UTF-16 string too long");
- const boost::detail::winapi::DWORD_ flags =
+ const boost::winapi::DWORD_ flags =
#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
- boost::detail::winapi::WC_ERR_INVALID_CHARS_;
+ boost::winapi::WC_ERR_INVALID_CHARS_;
#else
0u;
#endif
- int len = boost::detail::winapi::WideCharToMultiByte(boost::detail::winapi::CP_UTF8_, flags, wstr, static_cast< int >(utf16_len), NULL, 0, NULL, NULL);
+ int len = boost::winapi::WideCharToMultiByte(boost::winapi::CP_UTF8_, flags, wstr, static_cast< int >(utf16_len), NULL, 0, NULL, NULL);
if (BOOST_LIKELY(len > 0))
{
std::string str;
str.resize(len);
- len = boost::detail::winapi::WideCharToMultiByte(boost::detail::winapi::CP_UTF8_, flags, wstr, static_cast< int >(utf16_len), &str[0], len, NULL, NULL);
+ len = boost::winapi::WideCharToMultiByte(boost::winapi::CP_UTF8_, flags, wstr, static_cast< int >(utf16_len), &str[0], len, NULL, NULL);
if (BOOST_LIKELY(len > 0))
{
return str;
}
}
- const boost::detail::winapi::DWORD_ err = boost::detail::winapi::GetLastError();
+ const boost::winapi::DWORD_ err = boost::winapi::GetLastError();
BOOST_LOG_THROW_DESCR_PARAMS(system_error, "Failed to convert UTF-16 to UTF-8", (err));
BOOST_LOG_UNREACHABLE_RETURN(std::string());
}