Boost logo

Boost-Commit :

From: chris_at_[hidden]
Date: 2007-12-04 16:28:43


Author: chris_kohlhoff
Date: 2007-12-04 16:28:42 EST (Tue, 04 Dec 2007)
New Revision: 41701
URL: http://svn.boost.org/trac/boost/changeset/41701

Log:
Prevent deprecated function warnings for MSVC >= 8.

Text files modified:
   trunk/boost/asio/detail/socket_ops.hpp | 12 ++++++++++++
   1 files changed, 12 insertions(+), 0 deletions(-)

Modified: trunk/boost/asio/detail/socket_ops.hpp
==============================================================================
--- trunk/boost/asio/detail/socket_ops.hpp (original)
+++ trunk/boost/asio/detail/socket_ops.hpp 2007-12-04 16:28:42 EST (Tue, 04 Dec 2007)
@@ -1125,8 +1125,12 @@
 inline void gai_strcpy(char* target, const char* source, std::size_t max_size)
 {
   using namespace std;
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+ strcpy_s(target, max_size, source);
+#else
   *target = 0;
   strncat(target, source, max_size);
+#endif
 }
 
 enum { gai_clone_flag = 1 << 30 };
@@ -1659,7 +1663,11 @@
       {
         return ec = boost::asio::error::no_buffer_space;
       }
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+ sprintf_s(serv, servlen, "%u", ntohs(port));
+#else
       sprintf(serv, "%u", ntohs(port));
+#endif
     }
     else
     {
@@ -1678,7 +1686,11 @@
         {
           return ec = boost::asio::error::no_buffer_space;
         }
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+ sprintf_s(serv, servlen, "%u", ntohs(port));
+#else
         sprintf(serv, "%u", ntohs(port));
+#endif
       }
 #if defined(BOOST_HAS_THREADS) && defined(BOOST_HAS_PTHREADS)
       ::pthread_mutex_unlock(&mutex);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk