Merge branch 'develop' into feature/asciidoc

This commit is contained in:
Peter Dimov
2018-10-02 23:02:24 +03:00
3 changed files with 30 additions and 8 deletions

View File

@ -55,6 +55,19 @@ inline char const * unknown_message_win32( int ev, char * buffer, std::size_t le
#endif #endif
inline boost::winapi::UINT_ message_cp_win32()
{
#if defined(BOOST_SYSTEM_USE_UTF8)
return boost::winapi::CP_UTF8_;
#else
return boost::winapi::CP_ACP_;
#endif
}
inline char const * system_category_message_win32( int ev, char * buffer, std::size_t len ) BOOST_NOEXCEPT inline char const * system_category_message_win32( int ev, char * buffer, std::size_t len ) BOOST_NOEXCEPT
{ {
if( len == 0 ) if( len == 0 )
@ -95,7 +108,9 @@ inline char const * system_category_message_win32( int ev, char * buffer, std::s
return unknown_message_win32( ev, buffer, len ); return unknown_message_win32( ev, buffer, len );
} }
int r = boost::winapi::WideCharToMultiByte( CP_ACP_, 0, wbuffer, -1, buffer, static_cast<int>( len ), NULL, NULL ); UINT_ const code_page = message_cp_win32();
int r = boost::winapi::WideCharToMultiByte( code_page, 0, wbuffer, -1, buffer, static_cast<int>( len ), NULL, NULL );
if( r == 0 ) if( r == 0 )
{ {
@ -155,8 +170,11 @@ inline std::string system_category_message_win32( int ev )
} }
local_free lf_ = { lpMsgBuf }; local_free lf_ = { lpMsgBuf };
(void)lf_;
int r = boost::winapi::WideCharToMultiByte( CP_ACP_, 0, lpMsgBuf, -1, 0, 0, NULL, NULL ); UINT_ const code_page = message_cp_win32();
int r = boost::winapi::WideCharToMultiByte( code_page, 0, lpMsgBuf, -1, 0, 0, NULL, NULL );
if( r == 0 ) if( r == 0 )
{ {
@ -165,7 +183,7 @@ inline std::string system_category_message_win32( int ev )
std::string buffer( r, char() ); std::string buffer( r, char() );
r = boost::winapi::WideCharToMultiByte( CP_ACP_, 0, lpMsgBuf, -1, &buffer[0], r, NULL, NULL ); r = boost::winapi::WideCharToMultiByte( code_page, 0, lpMsgBuf, -1, &buffer[0], r, NULL, NULL );
if( r == 0 ) if( r == 0 )
{ {

View File

@ -278,7 +278,8 @@ public:
// clang++ 3.8 and below: initialization of const object // clang++ 3.8 and below: initialization of const object
// requires a user-provided default constructor // requires a user-provided default constructor
BOOST_SYSTEM_CONSTEXPR generic_error_category() BOOST_NOEXCEPT: error_category( 0xB2AB117A257EDF0Dull ) BOOST_SYSTEM_CONSTEXPR generic_error_category() BOOST_NOEXCEPT:
error_category( ( boost::ulong_long_type( 0xB2AB117A ) << 32 ) + 0x257EDF0D )
{ {
} }
@ -295,7 +296,8 @@ class BOOST_SYMBOL_VISIBLE system_error_category: public error_category
{ {
public: public:
BOOST_SYSTEM_CONSTEXPR system_error_category() BOOST_NOEXCEPT: error_category( 0x8FAFD21E25C5E09Bull ) BOOST_SYSTEM_CONSTEXPR system_error_category() BOOST_NOEXCEPT:
error_category( ( boost::ulong_long_type( 0x8FAFD21E ) << 32 ) + 0x25C5E09B )
{ {
} }
@ -651,7 +653,7 @@ public:
return failed_? unspecified_bool_true: 0; return failed_? unspecified_bool_true: 0;
} }
BOOST_SYSTEM_CONSTEXPR bool operator!() const BOOST_NOEXCEPT // true if no error BOOST_SYSTEM_CONSTEXPR bool operator!() const BOOST_NOEXCEPT // true if no error
{ {
return !failed_; return !failed_;
} }
@ -773,8 +775,8 @@ inline std::size_t hash_value( error_code const & ec )
id = reinterpret_cast<boost::ulong_long_type>( &cat ); id = reinterpret_cast<boost::ulong_long_type>( &cat );
} }
boost::ulong_long_type hv = 0xCBF29CE484222325ull; boost::ulong_long_type hv = ( boost::ulong_long_type( 0xCBF29CE4 ) << 32 ) + 0x84222325;
boost::ulong_long_type const prime = 0x00000100000001B3ull; boost::ulong_long_type const prime = ( boost::ulong_long_type( 0x00000100 ) << 32 ) + 0x000001B3;
// id // id

View File

@ -132,3 +132,5 @@ system-run- failed_constexpr_test.cpp ;
# Quick (CI) test # Quick (CI) test
run quick.cpp ; run quick.cpp ;
run quick.cpp : : : <warnings>all <warnings-as-errors>on : warnings_test ;