From 80e019069cc88cfe2d1b563944430a0ae51feced Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 17 Jan 2024 05:18:23 +0200 Subject: [PATCH] Use snprintf in error_category_impl.hpp --- .../system/detail/error_category_impl.hpp | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/include/boost/system/detail/error_category_impl.hpp b/include/boost/system/detail/error_category_impl.hpp index 2005397a4..5674729e2 100644 --- a/include/boost/system/detail/error_category_impl.hpp +++ b/include/boost/system/detail/error_category_impl.hpp @@ -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)