Boost logo

Boost-Commit :

From: ramey_at_[hidden]
Date: 2007-12-23 15:00:04


Author: ramey
Date: 2007-12-23 15:00:03 EST (Sun, 23 Dec 2007)
New Revision: 42264
URL: http://svn.boost.org/trac/boost/changeset/42264

Log:
correction to input of zero length strings
Text files modified:
   trunk/boost/archive/basic_binary_iprimitive.hpp | 22 ----------------------
   trunk/boost/archive/basic_text_iarchive.hpp | 10 ----------
   trunk/boost/archive/impl/basic_binary_iprimitive.ipp | 3 ++-
   trunk/boost/archive/impl/text_iarchive_impl.ipp | 3 ++-
   4 files changed, 4 insertions(+), 34 deletions(-)

Modified: trunk/boost/archive/basic_binary_iprimitive.hpp
==============================================================================
--- trunk/boost/archive/basic_binary_iprimitive.hpp (original)
+++ trunk/boost/archive/basic_binary_iprimitive.hpp 2007-12-23 15:00:03 EST (Sun, 23 Dec 2007)
@@ -137,28 +137,6 @@
     void *address,
     std::size_t count
 ){
-#if 0
- assert(
- static_cast<std::size_t>((std::numeric_limits<std::streamsize>::max)()) >= count
- );
- //if(is.fail())
- // boost::throw_exception(archive_exception(archive_exception::stream_error));
- // note: an optimizer should eliminate the following for char files
- std::size_t s = count / sizeof(BOOST_DEDUCED_TYPENAME IStream::char_type);
- is.read(
- static_cast<BOOST_DEDUCED_TYPENAME IStream::char_type *>(address),
- s
- );
- // note: an optimizer should eliminate the following for char files
- s = count % sizeof(BOOST_DEDUCED_TYPENAME IStream::char_type);
- if(0 < s){
- if(is.fail())
- boost::throw_exception(archive_exception(archive_exception::stream_error));
- BOOST_DEDUCED_TYPENAME IStream::char_type t;
- is.read(& t, 1);
- std::memcpy(address, &t, s);
- }
-#endif
     // note: an optimizer should eliminate the following for char files
     std::streamsize s = count / sizeof(Elem);
     std::streamsize scount = m_sb.sgetn(

Modified: trunk/boost/archive/basic_text_iarchive.hpp
==============================================================================
--- trunk/boost/archive/basic_text_iarchive.hpp (original)
+++ trunk/boost/archive/basic_text_iarchive.hpp 2007-12-23 15:00:03 EST (Sun, 23 Dec 2007)
@@ -61,16 +61,6 @@
     {
         this->detail_common_iarchive::load_override(t, 0);
     }
-#if 0
- // Borland compilers has a problem with strong type. Try to fix this here
- #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
- void load_override(version_type & t, int){
- unsigned int x;
- * this->This() >> x;
- t.t = version_type(x);
- }
- #endif
-#endif
     // text file don't include the optional information
     void load_override(class_id_optional_type & /*t*/, int){}
 

Modified: trunk/boost/archive/impl/basic_binary_iprimitive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_binary_iprimitive.ipp (original)
+++ trunk/boost/archive/impl/basic_binary_iprimitive.ipp 2007-12-23 15:00:03 EST (Sun, 23 Dec 2007)
@@ -95,7 +95,8 @@
     #endif
         s.resize(l);
     // note breaking a rule here - could be a problem on some platform
- load_binary(&(*s.begin()), l);
+ if(0 < l)
+ load_binary(&(*s.begin()), l);
 }
 
 #ifndef BOOST_NO_CWCHAR

Modified: trunk/boost/archive/impl/text_iarchive_impl.ipp
==============================================================================
--- trunk/boost/archive/impl/text_iarchive_impl.ipp (original)
+++ trunk/boost/archive/impl/text_iarchive_impl.ipp 2007-12-23 15:00:03 EST (Sun, 23 Dec 2007)
@@ -53,7 +53,8 @@
     if(NULL != s.data())
     #endif
         s.resize(size);
- is.read(&(*s.begin()), size);
+ if(0 < size)
+ is.read(&(*s.begin()), size);
 }
 
 #ifndef BOOST_NO_CWCHAR


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