Skip to content

Commit

Permalink
Use snprintf in error_category_impl.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimov committed Jan 17, 2024
1 parent e368c28 commit 80e0190
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions include/boost/system/detail/error_category_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,7 @@ inline char const * error_category::message( int ev, char * buffer, std::size_t
try
#endif
{
std::string m = this->message( ev );

# if defined( BOOST_MSVC )
# pragma warning( push )
# pragma warning( disable: 4996 )
# elif defined(__clang__) && defined(__has_warning)
# pragma clang diagnostic push
# if __has_warning("-Wdeprecated-declarations")
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
# endif
# endif

std::strncpy( buffer, m.c_str(), len - 1 );
buffer[ len-1 ] = 0;

# if defined( BOOST_MSVC )
# pragma warning( pop )
# elif defined(__clang__) && defined(__has_warning)
# pragma clang diagnostic pop
# endif

detail::snprintf( buffer, len, "%s", this->message( ev ).c_str() );
return buffer;
}
#if !defined(BOOST_NO_EXCEPTIONS)
Expand Down

0 comments on commit 80e0190

Please sign in to comment.