Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r48918 - in trunk/boost: . exception
From: emil_at_[hidden]
Date: 2008-09-22 14:27:59


Author: emildotchevski
Date: 2008-09-22 14:27:58 EDT (Mon, 22 Sep 2008)
New Revision: 48918
URL: http://svn.boost.org/trac/boost/changeset/48918

Log:
Improving CodeGear C++Builder 2009 compatibility
Text files modified:
   trunk/boost/exception/exception.hpp | 3 ++-
   trunk/boost/exception/get_error_info.hpp | 31 ++++++++-----------------------
   trunk/boost/exception_ptr.hpp | 2 +-
   3 files changed, 11 insertions(+), 25 deletions(-)

Modified: trunk/boost/exception/exception.hpp
==============================================================================
--- trunk/boost/exception/exception.hpp (original)
+++ trunk/boost/exception/exception.hpp 2008-09-22 14:27:58 EDT (Mon, 22 Sep 2008)
@@ -313,7 +313,8 @@
     exception_detail::enable_error_info_return_type<T>::type
     enable_error_info( T const & x )
         {
- return typename exception_detail::enable_error_info_return_type<T>::type(x);
+ typedef typename exception_detail::enable_error_info_return_type<T>::type rt;
+ return rt(x);
         }
 
     ////////////////////////////////////////////////////////////////////////

Modified: trunk/boost/exception/get_error_info.hpp
==============================================================================
--- trunk/boost/exception/get_error_info.hpp (original)
+++ trunk/boost/exception/get_error_info.hpp 2008-09-22 14:27:58 EDT (Mon, 22 Sep 2008)
@@ -10,7 +10,6 @@
 #include <boost/exception/detail/error_info_impl.hpp>
 #include <boost/exception/detail/type_info.hpp>
 #include <boost/shared_ptr.hpp>
-#include <string.h>
 
 namespace
 boost
@@ -21,30 +20,16 @@
         struct
         strwrap
             {
- char const * str;
+ std::string str;
+ char const * ptr;
             strwrap( char const * s ):
- str(init(s))
+ str(s),
+ ptr(&str[0])
                 {
                 }
- ~strwrap()
- {
- delete[] str;
- }
-
             private:
-
             strwrap( strwrap const & );
             strwrap & operator=( strwrap const & );
-
- static
- char const *
- init( char const * s )
- {
- size_t n=1+strlen(s);
- char * str = new char[n];
- (void) memcpy(str,s,n);
- return str;
- }
             };
 
         template <>
@@ -55,10 +40,10 @@
             shared_ptr<char const * const>
             get( exception const & x )
                 {
- if( x.throw_function_ )
+ if( x.throw_function_ && *x.throw_function_ )
                     {
                     shared_ptr<strwrap> s(new strwrap(x.throw_function_));
- return shared_ptr<char const *>(s,&s->str);
+ return shared_ptr<char const *>(s,&s->ptr);
                     }
                 else
                     return shared_ptr<char const * const>();
@@ -73,10 +58,10 @@
             shared_ptr<char const * const>
             get( exception const & x )
                 {
- if( x.throw_file_ )
+ if( x.throw_file_ && *x.throw_file_ )
                     {
                     shared_ptr<strwrap> s(new strwrap(x.throw_file_));
- return shared_ptr<char const *>(s,&s->str);
+ return shared_ptr<char const *>(s,&s->ptr);
                     }
                 else
                     return shared_ptr<char const * const>();

Modified: trunk/boost/exception_ptr.hpp
==============================================================================
--- trunk/boost/exception_ptr.hpp (original)
+++ trunk/boost/exception_ptr.hpp 2008-09-22 14:27:58 EDT (Mon, 22 Sep 2008)
@@ -99,7 +99,7 @@
 
         private:
 
- clone_base const *
+ exception_detail::clone_base const *
         clone() const
             {
             return new unknown_exception(*this);


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