Boost logo

Boost-Commit :

From: chris_at_[hidden]
Date: 2007-11-15 01:19:07


Author: chris_kohlhoff
Date: 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
New Revision: 41100
URL: http://svn.boost.org/trac/boost/changeset/41100

Log:
Try to fix an order-of-initialisation problem with error_category references.
The symptom, which only occurs in some applications, is a crash due to a
dereference of a null pointer. The exact conditions under which the problem
occurs are not fully understood, so this fix is probably more paranoid than
necessary.

Text files modified:
   trunk/boost/asio/detail/dev_poll_reactor.hpp | 6 ++--
   trunk/boost/asio/detail/epoll_reactor.hpp | 12 ++++----
   trunk/boost/asio/detail/kqueue_reactor.hpp | 20 +++++++-------
   trunk/boost/asio/detail/pipe_select_interrupter.hpp | 3 +
   trunk/boost/asio/detail/posix_event.hpp | 3 +
   trunk/boost/asio/detail/posix_mutex.hpp | 9 ++++--
   trunk/boost/asio/detail/posix_thread.hpp | 3 +
   trunk/boost/asio/detail/posix_tss_ptr.hpp | 3 +
   trunk/boost/asio/detail/reactive_socket_service.hpp | 8 +++--
   trunk/boost/asio/detail/socket_ops.hpp | 9 +++--
   trunk/boost/asio/detail/win_event.hpp | 2
   trunk/boost/asio/detail/win_iocp_io_service.hpp | 10 +++---
   trunk/boost/asio/detail/win_iocp_socket_service.hpp | 34 ++++++++++++------------
   trunk/boost/asio/detail/win_mutex.hpp | 6 ++-
   trunk/boost/asio/detail/win_thread.hpp | 2
   trunk/boost/asio/detail/win_tss_ptr.hpp | 2
   trunk/boost/asio/detail/wince_thread.hpp | 2
   trunk/boost/asio/detail/winsock_init.hpp | 2
   trunk/boost/asio/error.hpp | 55 ++++++++++++++++++++++++++-------------
   trunk/boost/asio/ssl/detail/openssl_operation.hpp | 2
   trunk/boost/system/cygwin_error.hpp | 2
   trunk/boost/system/error_code.hpp | 12 ++++----
   trunk/boost/system/linux_error.hpp | 2
   trunk/boost/system/windows_error.hpp | 2
   24 files changed, 120 insertions(+), 91 deletions(-)

Modified: trunk/boost/asio/detail/dev_poll_reactor.hpp
==============================================================================
--- trunk/boost/asio/detail/dev_poll_reactor.hpp (original)
+++ trunk/boost/asio/detail/dev_poll_reactor.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -347,7 +347,7 @@
       {
         int descriptor = pending_event_changes_[i].fd;
         boost::system::error_code ec = boost::system::error_code(
- errno, boost::asio::error::system_category);
+ errno, boost::asio::error::get_system_category());
         read_op_queue_.dispatch_all_operations(descriptor, ec);
         write_op_queue_.dispatch_all_operations(descriptor, ec);
         except_op_queue_.dispatch_all_operations(descriptor, ec);
@@ -436,7 +436,7 @@
           if (result != sizeof(ev))
           {
             ec = boost::system::error_code(errno,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
             read_op_queue_.dispatch_all_operations(descriptor, ec);
             write_op_queue_.dispatch_all_operations(descriptor, ec);
             except_op_queue_.dispatch_all_operations(descriptor, ec);
@@ -495,7 +495,7 @@
       boost::throw_exception(
           boost::system::system_error(
             boost::system::error_code(errno,
- boost::asio::error::system_category),
+ boost::asio::error::get_system_category()),
             "/dev/poll"));
     }
     return fd;

Modified: trunk/boost/asio/detail/epoll_reactor.hpp
==============================================================================
--- trunk/boost/asio/detail/epoll_reactor.hpp (original)
+++ trunk/boost/asio/detail/epoll_reactor.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -161,7 +161,7 @@
       if (result != 0)
       {
         boost::system::error_code ec(errno,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
         read_op_queue_.dispatch_all_operations(descriptor, ec);
       }
     }
@@ -197,7 +197,7 @@
       if (result != 0)
       {
         boost::system::error_code ec(errno,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
         write_op_queue_.dispatch_all_operations(descriptor, ec);
       }
     }
@@ -229,7 +229,7 @@
       if (result != 0)
       {
         boost::system::error_code ec(errno,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
         except_op_queue_.dispatch_all_operations(descriptor, ec);
       }
     }
@@ -263,7 +263,7 @@
       if (result != 0)
       {
         boost::system::error_code ec(errno,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
         write_op_queue_.dispatch_all_operations(descriptor, ec);
         except_op_queue_.dispatch_all_operations(descriptor, ec);
       }
@@ -457,7 +457,7 @@
           if (result != 0)
           {
             ec = boost::system::error_code(errno,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
             read_op_queue_.dispatch_all_operations(descriptor, ec);
             write_op_queue_.dispatch_all_operations(descriptor, ec);
             except_op_queue_.dispatch_all_operations(descriptor, ec);
@@ -519,7 +519,7 @@
       boost::throw_exception(
           boost::system::system_error(
             boost::system::error_code(errno,
- boost::asio::error::system_category),
+ boost::asio::error::get_system_category()),
             "epoll"));
     }
     return fd;

Modified: trunk/boost/asio/detail/kqueue_reactor.hpp
==============================================================================
--- trunk/boost/asio/detail/kqueue_reactor.hpp (original)
+++ trunk/boost/asio/detail/kqueue_reactor.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -152,7 +152,7 @@
       if (::kevent(kqueue_fd_, &event, 1, 0, 0, 0) == -1)
       {
         boost::system::error_code ec(errno,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
         read_op_queue_.dispatch_all_operations(descriptor, ec);
       }
     }
@@ -179,7 +179,7 @@
       if (::kevent(kqueue_fd_, &event, 1, 0, 0, 0) == -1)
       {
         boost::system::error_code ec(errno,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
         write_op_queue_.dispatch_all_operations(descriptor, ec);
       }
     }
@@ -205,7 +205,7 @@
       if (::kevent(kqueue_fd_, &event, 1, 0, 0, 0) == -1)
       {
         boost::system::error_code ec(errno,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
         except_op_queue_.dispatch_all_operations(descriptor, ec);
       }
     }
@@ -229,7 +229,7 @@
       if (::kevent(kqueue_fd_, &event, 1, 0, 0, 0) == -1)
       {
         boost::system::error_code ec(errno,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
         write_op_queue_.dispatch_all_operations(descriptor, ec);
       }
     }
@@ -244,7 +244,7 @@
       if (::kevent(kqueue_fd_, &event, 1, 0, 0, 0) == -1)
       {
         boost::system::error_code ec(errno,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
         except_op_queue_.dispatch_all_operations(descriptor, ec);
         write_op_queue_.dispatch_all_operations(descriptor, ec);
       }
@@ -398,7 +398,7 @@
         if (events[i].flags & EV_ERROR)
         {
           boost::system::error_code error(
- events[i].data, boost::asio::error::system_category);
+ events[i].data, boost::asio::error::get_system_category());
           except_op_queue_.dispatch_all_operations(descriptor, error);
           read_op_queue_.dispatch_all_operations(descriptor, error);
         }
@@ -429,7 +429,7 @@
         if (::kevent(kqueue_fd_, &event, 1, 0, 0, 0) == -1)
         {
           boost::system::error_code error(errno,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
           except_op_queue_.dispatch_all_operations(descriptor, error);
           read_op_queue_.dispatch_all_operations(descriptor, error);
         }
@@ -441,7 +441,7 @@
         if (events[i].flags & EV_ERROR)
         {
           boost::system::error_code error(
- events[i].data, boost::asio::error::system_category);
+ events[i].data, boost::asio::error::get_system_category());
           write_op_queue_.dispatch_all_operations(descriptor, error);
         }
         else
@@ -459,7 +459,7 @@
         if (::kevent(kqueue_fd_, &event, 1, 0, 0, 0) == -1)
         {
           boost::system::error_code error(errno,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
           write_op_queue_.dispatch_all_operations(descriptor, error);
         }
       }
@@ -516,7 +516,7 @@
       boost::throw_exception(
           boost::system::system_error(
             boost::system::error_code(errno,
- boost::asio::error::system_category),
+ boost::asio::error::get_system_category()),
             "kqueue"));
     }
     return fd;

Modified: trunk/boost/asio/detail/pipe_select_interrupter.hpp
==============================================================================
--- trunk/boost/asio/detail/pipe_select_interrupter.hpp (original)
+++ trunk/boost/asio/detail/pipe_select_interrupter.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -52,7 +52,8 @@
     }
     else
     {
- boost::system::error_code ec(errno, boost::asio::error::system_category);
+ boost::system::error_code ec(errno,
+ boost::asio::error::get_system_category());
       boost::system::system_error e(ec, "pipe_select_interrupter");
       boost::throw_exception(e);
     }

Modified: trunk/boost/asio/detail/posix_event.hpp
==============================================================================
--- trunk/boost/asio/detail/posix_event.hpp (original)
+++ trunk/boost/asio/detail/posix_event.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -49,7 +49,8 @@
     if (error != 0)
     {
       boost::system::system_error e(
- boost::system::error_code(error, boost::asio::error::system_category),
+ boost::system::error_code(error,
+ boost::asio::error::get_system_category()),
           "event");
       boost::throw_exception(e);
     }

Modified: trunk/boost/asio/detail/posix_mutex.hpp
==============================================================================
--- trunk/boost/asio/detail/posix_mutex.hpp (original)
+++ trunk/boost/asio/detail/posix_mutex.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -52,7 +52,8 @@
     if (error != 0)
     {
       boost::system::system_error e(
- boost::system::error_code(error, boost::asio::error::system_category),
+ boost::system::error_code(error,
+ boost::asio::error::get_system_category()),
           "mutex");
       boost::throw_exception(e);
     }
@@ -71,7 +72,8 @@
     if (error != 0)
     {
       boost::system::system_error e(
- boost::system::error_code(error, boost::asio::error::system_category),
+ boost::system::error_code(error,
+ boost::asio::error::get_system_category()),
           "mutex");
       boost::throw_exception(e);
     }
@@ -84,7 +86,8 @@
     if (error != 0)
     {
       boost::system::system_error e(
- boost::system::error_code(error, boost::asio::error::system_category),
+ boost::system::error_code(error,
+ boost::asio::error::get_system_category()),
           "mutex");
       boost::throw_exception(e);
     }

Modified: trunk/boost/asio/detail/posix_thread.hpp
==============================================================================
--- trunk/boost/asio/detail/posix_thread.hpp (original)
+++ trunk/boost/asio/detail/posix_thread.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -54,7 +54,8 @@
     if (error != 0)
     {
       boost::system::system_error e(
- boost::system::error_code(error, boost::asio::error::system_category),
+ boost::system::error_code(error,
+ boost::asio::error::get_system_category()),
           "thread");
       boost::throw_exception(e);
     }

Modified: trunk/boost/asio/detail/posix_tss_ptr.hpp
==============================================================================
--- trunk/boost/asio/detail/posix_tss_ptr.hpp (original)
+++ trunk/boost/asio/detail/posix_tss_ptr.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -48,7 +48,8 @@
     if (error != 0)
     {
       boost::system::system_error e(
- boost::system::error_code(error, boost::asio::error::system_category),
+ boost::system::error_code(error,
+ boost::asio::error::get_system_category()),
           "tss");
       boost::throw_exception(e);
     }

Modified: trunk/boost/asio/detail/reactive_socket_service.hpp
==============================================================================
--- trunk/boost/asio/detail/reactive_socket_service.hpp (original)
+++ trunk/boost/asio/detail/reactive_socket_service.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -158,7 +158,8 @@
 
     if (int err = reactor_.register_descriptor(sock.get()))
     {
- ec = boost::system::error_code(err, boost::asio::error::system_category);
+ ec = boost::system::error_code(err,
+ boost::asio::error::get_system_category());
       return ec;
     }
 
@@ -182,7 +183,8 @@
 
     if (int err = reactor_.register_descriptor(native_socket))
     {
- ec = boost::system::error_code(err, boost::asio::error::system_category);
+ ec = boost::system::error_code(err,
+ boost::asio::error::get_system_category());
       return ec;
     }
 
@@ -1490,7 +1492,7 @@
       if (connect_error)
       {
         ec = boost::system::error_code(connect_error,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
         io_service_.post(bind_handler(handler_, ec));
         return true;
       }

Modified: trunk/boost/asio/detail/socket_ops.hpp
==============================================================================
--- trunk/boost/asio/detail/socket_ops.hpp (original)
+++ trunk/boost/asio/detail/socket_ops.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -63,9 +63,10 @@
 {
 #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
   ec = boost::system::error_code(WSAGetLastError(),
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
 #else
- ec = boost::system::error_code(errno, boost::asio::error::system_category);
+ ec = boost::system::error_code(errno,
+ boost::asio::error::get_system_category());
 #endif
   return return_value;
 }
@@ -1723,10 +1724,10 @@
   default: // Possibly the non-portable EAI_SYSTEM.
 #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
     return boost::system::error_code(
- WSAGetLastError(), boost::asio::error::system_category);
+ WSAGetLastError(), boost::asio::error::get_system_category());
 #else
     return boost::system::error_code(
- errno, boost::asio::error::system_category);
+ errno, boost::asio::error::get_system_category());
 #endif
   }
 }

Modified: trunk/boost/asio/detail/win_event.hpp
==============================================================================
--- trunk/boost/asio/detail/win_event.hpp (original)
+++ trunk/boost/asio/detail/win_event.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -50,7 +50,7 @@
       DWORD last_error = ::GetLastError();
       boost::system::system_error e(
           boost::system::error_code(last_error,
- boost::asio::error::system_category),
+ boost::asio::error::get_system_category()),
           "event");
       boost::throw_exception(e);
     }

Modified: trunk/boost/asio/detail/win_iocp_io_service.hpp
==============================================================================
--- trunk/boost/asio/detail/win_iocp_io_service.hpp (original)
+++ trunk/boost/asio/detail/win_iocp_io_service.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -69,7 +69,7 @@
       DWORD last_error = ::GetLastError();
       boost::system::system_error e(
           boost::system::error_code(last_error,
- boost::asio::error::system_category),
+ boost::asio::error::get_system_category()),
           "iocp");
       boost::throw_exception(e);
     }
@@ -184,7 +184,7 @@
         DWORD last_error = ::GetLastError();
         boost::system::system_error e(
             boost::system::error_code(last_error,
- boost::asio::error::system_category),
+ boost::asio::error::get_system_category()),
             "pqcs");
         boost::throw_exception(e);
       }
@@ -240,7 +240,7 @@
       DWORD last_error = ::GetLastError();
       boost::system::system_error e(
           boost::system::error_code(last_error,
- boost::asio::error::system_category),
+ boost::asio::error::get_system_category()),
           "pqcs");
       boost::throw_exception(e);
     }
@@ -260,7 +260,7 @@
       DWORD last_error = ::GetLastError();
       boost::system::system_error e(
           boost::system::error_code(last_error,
- boost::asio::error::system_category),
+ boost::asio::error::get_system_category()),
           "pqcs");
       boost::throw_exception(e);
     }
@@ -460,7 +460,7 @@
           {
             DWORD last_error = ::GetLastError();
             ec = boost::system::error_code(last_error,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
             return 0;
           }
 

Modified: trunk/boost/asio/detail/win_iocp_socket_service.hpp
==============================================================================
--- trunk/boost/asio/detail/win_iocp_socket_service.hpp (original)
+++ trunk/boost/asio/detail/win_iocp_socket_service.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -339,7 +339,7 @@
       {
         DWORD last_error = ::GetLastError();
         ec = boost::system::error_code(last_error,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
       }
       else
       {
@@ -361,7 +361,7 @@
       {
         DWORD last_error = ::GetLastError();
         ec = boost::system::error_code(last_error,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
       }
       else
       {
@@ -668,7 +668,7 @@
       else if (last_error == ERROR_PORT_UNREACHABLE)
         last_error = WSAECONNREFUSED;
       ec = boost::system::error_code(last_error,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
       return 0;
     }
 
@@ -720,7 +720,7 @@
 
       // Map non-portable errors to their portable counterparts.
       boost::system::error_code ec(last_error,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
       if (ec.value() == ERROR_NETNAME_DELETED)
       {
         if (handler_op->cancel_token_.expired())
@@ -823,7 +823,7 @@
       boost::asio::io_service::work work(this->get_io_service());
       ptr.reset();
       boost::system::error_code ec(last_error,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
       iocp_service_.post(bind_handler(handler, ec, bytes_transferred));
     }
     else
@@ -868,7 +868,7 @@
       if (last_error == ERROR_PORT_UNREACHABLE)
         last_error = WSAECONNREFUSED;
       ec = boost::system::error_code(last_error,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
       return 0;
     }
 
@@ -918,7 +918,7 @@
 
       // Map non-portable errors to their portable counterparts.
       boost::system::error_code ec(last_error,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
       if (ec.value() == ERROR_PORT_UNREACHABLE)
       {
         ec = boost::asio::error::connection_refused;
@@ -1002,7 +1002,7 @@
       boost::asio::io_service::work work(this->get_io_service());
       ptr.reset();
       boost::system::error_code ec(last_error,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
       iocp_service_.post(bind_handler(handler, ec, bytes_transferred));
     }
     else
@@ -1057,7 +1057,7 @@
       else if (last_error == ERROR_PORT_UNREACHABLE)
         last_error = WSAECONNREFUSED;
       ec = boost::system::error_code(last_error,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
       return 0;
     }
     if (bytes_transferred == 0)
@@ -1116,7 +1116,7 @@
 
       // Map non-portable errors to their portable counterparts.
       boost::system::error_code ec(last_error,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
       if (ec.value() == ERROR_NETNAME_DELETED)
       {
         if (handler_op->cancel_token_.expired())
@@ -1224,7 +1224,7 @@
       boost::asio::io_service::work work(this->get_io_service());
       ptr.reset();
       boost::system::error_code ec(last_error,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
       iocp_service_.post(bind_handler(handler, ec, bytes_transferred));
     }
     else
@@ -1271,7 +1271,7 @@
       if (last_error == ERROR_PORT_UNREACHABLE)
         last_error = WSAECONNREFUSED;
       ec = boost::system::error_code(last_error,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
       return 0;
     }
     if (bytes_transferred == 0)
@@ -1338,7 +1338,7 @@
 
       // Map non-portable errors to their portable counterparts.
       boost::system::error_code ec(last_error,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
       if (ec.value() == ERROR_PORT_UNREACHABLE)
       {
         ec = boost::asio::error::connection_refused;
@@ -1433,7 +1433,7 @@
       boost::asio::io_service::work work(this->get_io_service());
       ptr.reset();
       boost::system::error_code ec(last_error,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
       iocp_service_.post(bind_handler(handler, ec, bytes_transferred));
     }
     else
@@ -1672,7 +1672,7 @@
 
       // Call the handler.
       boost::system::error_code ec(last_error,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
       asio_handler_invoke_helpers::invoke(
           detail::bind_handler(handler, ec), &handler);
     }
@@ -1773,7 +1773,7 @@
         boost::asio::io_service::work work(this->get_io_service());
         ptr.reset();
         boost::system::error_code ec(last_error,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
         iocp_service_.post(bind_handler(handler, ec));
       }
     }
@@ -1850,7 +1850,7 @@
       if (connect_error)
       {
         ec = boost::system::error_code(connect_error,
- boost::asio::error::system_category);
+ boost::asio::error::get_system_category());
         io_service_.post(bind_handler(handler_, ec));
         return true;
       }

Modified: trunk/boost/asio/detail/win_mutex.hpp
==============================================================================
--- trunk/boost/asio/detail/win_mutex.hpp (original)
+++ trunk/boost/asio/detail/win_mutex.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -50,7 +50,8 @@
     if (error != 0)
     {
       boost::system::system_error e(
- boost::system::error_code(error, boost::asio::error::system_category),
+ boost::system::error_code(error,
+ boost::asio::error::get_system_category()),
           "mutex");
       boost::throw_exception(e);
     }
@@ -69,7 +70,8 @@
     if (error != 0)
     {
       boost::system::system_error e(
- boost::system::error_code(error, boost::asio::error::system_category),
+ boost::system::error_code(error,
+ boost::asio::error::get_system_category()),
           "mutex");
       boost::throw_exception(e);
     }

Modified: trunk/boost/asio/detail/win_thread.hpp
==============================================================================
--- trunk/boost/asio/detail/win_thread.hpp (original)
+++ trunk/boost/asio/detail/win_thread.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -57,7 +57,7 @@
       DWORD last_error = ::GetLastError();
       boost::system::system_error e(
           boost::system::error_code(last_error,
- boost::asio::error::system_category),
+ boost::asio::error::get_system_category()),
           "thread");
       boost::throw_exception(e);
     }

Modified: trunk/boost/asio/detail/win_tss_ptr.hpp
==============================================================================
--- trunk/boost/asio/detail/win_tss_ptr.hpp (original)
+++ trunk/boost/asio/detail/win_tss_ptr.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -56,7 +56,7 @@
       DWORD last_error = ::GetLastError();
       boost::system::system_error e(
           boost::system::error_code(last_error,
- boost::asio::error::system_category),
+ boost::asio::error::get_system_category()),
           "tss");
       boost::throw_exception(e);
     }

Modified: trunk/boost/asio/detail/wince_thread.hpp
==============================================================================
--- trunk/boost/asio/detail/wince_thread.hpp (original)
+++ trunk/boost/asio/detail/wince_thread.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -56,7 +56,7 @@
       DWORD last_error = ::GetLastError();
       boost::system::system_error e(
           boost::system::error_code(last_error,
- boost::asio::error::system_category),
+ boost::asio::error::get_system_category()),
           "thread");
       boost::throw_exception(e);
     }

Modified: trunk/boost/asio/detail/winsock_init.hpp
==============================================================================
--- trunk/boost/asio/detail/winsock_init.hpp (original)
+++ trunk/boost/asio/detail/winsock_init.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -88,7 +88,7 @@
     {
       boost::system::system_error e(
           boost::system::error_code(ref_->result(),
- boost::asio::error::system_category),
+ boost::asio::error::get_system_category()),
           "winsock");
       boost::throw_exception(e);
     }

Modified: trunk/boost/asio/error.hpp
==============================================================================
--- trunk/boost/asio/error.hpp (original)
+++ trunk/boost/asio/error.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -202,15 +202,15 @@
 {
 };
 
-namespace detail {
-
 inline const boost::system::error_category& get_system_category()
 {
- return boost::system::system_category;
+ return boost::system::get_system_category();
 }
 
 #if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
 
+namespace detail {
+
 class netdb_category : public boost::system::error_category
 {
 public:
@@ -233,12 +233,16 @@
   }
 };
 
+} // namespace detail
+
 inline const boost::system::error_category& get_netdb_category()
 {
- static netdb_category instance;
+ static detail::netdb_category instance;
   return instance;
 }
 
+namespace detail {
+
 class addrinfo_category : public boost::system::error_category
 {
 public:
@@ -257,9 +261,11 @@
   }
 };
 
+} // namespace detail
+
 inline const boost::system::error_category& get_addrinfo_category()
 {
- static addrinfo_category instance;
+ static detail::addrinfo_category instance;
   return instance;
 }
 
@@ -277,6 +283,8 @@
 
 #endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
 
+namespace detail {
+
 class misc_category : public boost::system::error_category
 {
 public:
@@ -297,12 +305,16 @@
   }
 };
 
+} // namespace detail
+
 inline const boost::system::error_category& get_misc_category()
 {
- static misc_category instance;
+ static detail::misc_category instance;
   return instance;
 }
 
+namespace detail {
+
 class ssl_category : public boost::system::error_category
 {
 public:
@@ -317,24 +329,24 @@
   }
 };
 
+} // namespace detail
+
 inline const boost::system::error_category& get_ssl_category()
 {
- static ssl_category instance;
+ static detail::ssl_category instance;
   return instance;
 }
 
-} // namespace detail
-
 static const boost::system::error_category& system_category
- = boost::asio::error::detail::get_system_category();
+ = boost::asio::error::get_system_category();
 static const boost::system::error_category& netdb_category
- = boost::asio::error::detail::get_netdb_category();
+ = boost::asio::error::get_netdb_category();
 static const boost::system::error_category& addrinfo_category
- = boost::asio::error::detail::get_addrinfo_category();
+ = boost::asio::error::get_addrinfo_category();
 static const boost::system::error_category& misc_category
- = boost::asio::error::detail::get_misc_category();
+ = boost::asio::error::get_misc_category();
 static const boost::system::error_category& ssl_category
- = boost::asio::error::detail::get_ssl_category();
+ = boost::asio::error::get_ssl_category();
 
 } // namespace error
 } // namespace asio
@@ -373,27 +385,32 @@
 
 inline boost::system::error_code make_error_code(basic_errors e)
 {
- return boost::system::error_code(static_cast<int>(e), system_category);
+ return boost::system::error_code(
+ static_cast<int>(e), get_system_category());
 }
 
 inline boost::system::error_code make_error_code(netdb_errors e)
 {
- return boost::system::error_code(static_cast<int>(e), netdb_category);
+ return boost::system::error_code(
+ static_cast<int>(e), get_netdb_category());
 }
 
 inline boost::system::error_code make_error_code(addrinfo_errors e)
 {
- return boost::system::error_code(static_cast<int>(e), addrinfo_category);
+ return boost::system::error_code(
+ static_cast<int>(e), get_addrinfo_category());
 }
 
 inline boost::system::error_code make_error_code(misc_errors e)
 {
- return boost::system::error_code(static_cast<int>(e), misc_category);
+ return boost::system::error_code(
+ static_cast<int>(e), get_misc_category());
 }
 
 inline boost::system::error_code make_error_code(ssl_errors e)
 {
- return boost::system::error_code(static_cast<int>(e), ssl_category);
+ return boost::system::error_code(
+ static_cast<int>(e), get_ssl_category());
 }
 
 } // namespace error

Modified: trunk/boost/asio/ssl/detail/openssl_operation.hpp
==============================================================================
--- trunk/boost/asio/ssl/detail/openssl_operation.hpp (original)
+++ trunk/boost/asio/ssl/detail/openssl_operation.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -180,7 +180,7 @@
       else
       {
         return handler_(boost::system::error_code(
- error_code, boost::asio::error::ssl_category), rc);
+ error_code, boost::asio::error::get_ssl_category()), rc);
       }
     }
 

Modified: trunk/boost/system/cygwin_error.hpp
==============================================================================
--- trunk/boost/system/cygwin_error.hpp (original)
+++ trunk/boost/system/cygwin_error.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -46,7 +46,7 @@
     namespace cygwin_error
     {
       inline error_code make_error_code( cygwin_errno e )
- { return error_code( e, system_category ); }
+ { return error_code( e, get_system_category() ); }
     }
   }
 }

Modified: trunk/boost/system/error_code.hpp
==============================================================================
--- trunk/boost/system/error_code.hpp (original)
+++ trunk/boost/system/error_code.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -219,7 +219,7 @@
     public:
 
       // constructors:
- error_condition() : m_val(0), m_cat(&posix_category) {}
+ error_condition() : m_val(0), m_cat(&get_posix_category()) {}
       error_condition( int val, const error_category & cat ) : m_val(val), m_cat(&cat) {}
 
       template <class ConditionEnum>
@@ -248,7 +248,7 @@
       void clear()
       {
         m_val = 0;
- m_cat = &posix_category;
+ m_cat = &get_posix_category();
       }
 
       // observers:
@@ -306,7 +306,7 @@
     public:
 
       // constructors:
- error_code() : m_val(0), m_cat(&system_category) {}
+ error_code() : m_val(0), m_cat(&get_system_category()) {}
       error_code( int val, const error_category & cat ) : m_val(val), m_cat(&cat) {}
 
       template <class CodeEnum>
@@ -334,7 +334,7 @@
       void clear()
       {
         m_val = 0;
- m_cat = &system_category;
+ m_cat = &get_system_category();
       }
 
       // observers:
@@ -442,11 +442,11 @@
     {
       // explicit conversion:
       inline error_code make_error_code( posix_errno e )
- { return error_code( e, posix_category ); }
+ { return error_code( e, get_posix_category() ); }
 
       // implicit conversion:
       inline error_condition make_error_condition( posix_errno e )
- { return error_condition( e, posix_category ); }
+ { return error_condition( e, get_posix_category() ); }
     }
 
     // error_category default implementation -------------------------------//

Modified: trunk/boost/system/linux_error.hpp
==============================================================================
--- trunk/boost/system/linux_error.hpp (original)
+++ trunk/boost/system/linux_error.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -99,7 +99,7 @@
     namespace linux_error
     {
       inline error_code make_error_code( linux_errno e )
- { return error_code( e, system_category ); }
+ { return error_code( e, get_system_category() ); }
     }
 
   } // namespace system

Modified: trunk/boost/system/windows_error.hpp
==============================================================================
--- trunk/boost/system/windows_error.hpp (original)
+++ trunk/boost/system/windows_error.hpp 2007-11-15 01:19:04 EST (Thu, 15 Nov 2007)
@@ -107,7 +107,7 @@
     namespace windows_error
     {
       inline error_code make_error_code( windows_error_code e )
- { return error_code( e, system_category ); }
+ { return error_code( e, get_system_category() ); }
     }
 
   } // namespace system


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