You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by vi...@apache.org on 2008/05/02 01:38:57 UTC

svn commit: r652711 - in /stdcxx/branches/4.3.x/include: sstream sstream.cc

Author: vitek
Date: Thu May  1 16:38:56 2008
New Revision: 652711

URL: http://svn.apache.org/viewvc?rev=652711&view=rev
Log:
2008-05-01  Travis Vitek  <vi...@roguewave.com>

	STDCXX-602
	* include/sstream (_C_grow): Revert r629207 to avoid any
	backward binary compatibility problems.
	* include/sstream.cc (str): Ditto.


Modified:
    stdcxx/branches/4.3.x/include/sstream
    stdcxx/branches/4.3.x/include/sstream.cc

Modified: stdcxx/branches/4.3.x/include/sstream
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/sstream?rev=652711&r1=652710&r2=652711&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/sstream (original)
+++ stdcxx/branches/4.3.x/include/sstream Thu May  1 16:38:56 2008
@@ -170,6 +170,8 @@
 
 private:
 
+    _RWSTD_STREAMSIZE _C_grow (_RWSTD_STREAMSIZE) const;
+
     // called from overflow, underflow, et al to get egptr()
     // caught up with pptr()
     void _C_catchup (char_type*);
@@ -201,6 +203,25 @@
 
 
 template <class _CharT, class _Traits, class _Allocator>
+inline _RWSTD_STREAMSIZE
+basic_stringbuf<_CharT, _Traits, _Allocator>::
+_C_grow (_RWSTD_STREAMSIZE __to) const
+{
+    const _RWSTD_STREAMSIZE __ratio =
+        _RWSTD_STREAMSIZE (  (_RWSTD_NEW_CAPACITY_RATIO << 10)
+                           / _RWSTD_RATIO_DIVIDER);
+
+    const _RWSTD_STREAMSIZE __cap =
+        this->_C_bufsize ?
+          (this->_C_bufsize >> 10) * __ratio
+        + (((this->_C_bufsize & 0x3ff) * __ratio) >> 10)
+        : _RWSTD_MINIMUM_STRINGBUF_CAPACITY;
+
+    return __cap < __to ? __to : __cap;
+}
+
+
+template <class _CharT, class _Traits, class _Allocator>
 inline void
 basic_stringbuf<_CharT, _Traits, _Allocator>::
 _C_catchup (char_type *__gbeg)

Modified: stdcxx/branches/4.3.x/include/sstream.cc
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/sstream.cc?rev=652711&r1=652710&r2=652711&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/sstream.cc (original)
+++ stdcxx/branches/4.3.x/include/sstream.cc Thu May  1 16:38:56 2008
@@ -103,17 +103,7 @@
     if (this->_C_bufsize < __bufsize) {
         // requested capacity is greater than the current capacity
         // allocate a new buffer of sufficient size
-        const _RWSTD_STREAMSIZE __ratio =
-            _RWSTD_STREAMSIZE (  (_RWSTD_NEW_CAPACITY_RATIO << 10)
-                               / _RWSTD_RATIO_DIVIDER);
-
-        const _RWSTD_SIZE_T __cap =
-            this->_C_bufsize ?
-              (this->_C_bufsize >> 10) * __ratio
-            + (((this->_C_bufsize & 0x3ff) * __ratio) >> 10)
-            : _RWSTD_MINIMUM_STRINGBUF_CAPACITY;
-
-        __bufsize = __cap < __bufsize ? __bufsize : __cap;
+        __bufsize = _C_grow (__bufsize);
 
         if (__s != this->_C_buffer && this->_C_own_buf ()) {
             // deallocate the existing buffer here only if the string