stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From far...@apache.org
Subject svn commit: r648752 [2/5] - in /stdcxx/branches/4.2.x: doc/stdlibref/ etc/config/ etc/config/src/ etc/config/windows/ etc/nls/ examples/manual/ examples/tutorial/ include/ include/ansi/ include/loc/ include/rw/ src/ src/ia64/ tests/algorithms/ tests/co...
Date Wed, 16 Apr 2008 17:02:30 GMT
Modified: stdcxx/branches/4.2.x/examples/manual/lex_compare.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/examples/manual/lex_compare.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/examples/manual/lex_compare.cpp (original)
+++ stdcxx/branches/4.2.x/examples/manual/lex_compare.cpp Wed Apr 16 10:01:56 2008
@@ -39,7 +39,7 @@
 {
     typedef std::vector<int, std::allocator<int> > Vector;
 
-    const Vector::value_type d1[] = { 1, 3, 5, 32, 64 }; 		
+    const Vector::value_type d1[] = { 1, 3, 5, 32, 64 };
     const Vector::value_type d2[] = { 1, 3, 2, 43, 56 };
 
     // Create vectors.

Modified: stdcxx/branches/4.2.x/examples/manual/max_elem.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/examples/manual/max_elem.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/examples/manual/max_elem.cpp (original)
+++ stdcxx/branches/4.2.x/examples/manual/max_elem.cpp Wed Apr 16 10:01:56 2008
@@ -37,9 +37,9 @@
     typedef std::vector<int, std::allocator<int> > Vector;
     typedef Vector::iterator                       Iterator;
 
-    const Vector::value_type d1[] = { 1, 3, 5, 32, 64 }; 			 				
+    const Vector::value_type d1[] = { 1, 3, 5, 32, 64 };
     // Set up vector.
-    Vector v1(d1 + 0, d1 + sizeof d1 / sizeof *d1);	
+    Vector v1(d1 + 0, d1 + sizeof d1 / sizeof *d1);
 
     // Find the largest element in the vector.
     Iterator it1 = std::max_element (v1.begin (), v1.end ());

Modified: stdcxx/branches/4.2.x/examples/manual/memfunref.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/examples/manual/memfunref.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/examples/manual/memfunref.cpp (original)
+++ stdcxx/branches/4.2.x/examples/manual/memfunref.cpp Wed Apr 16 10:01:56 2008
@@ -34,7 +34,7 @@
 #include <examples.h>
 #include <memfunref.h>
 
-typedef sublist<int>	   list_type;
+typedef sublist<int>    list_type;
 
 int main ()
 {

Modified: stdcxx/branches/4.2.x/examples/manual/merge.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/examples/manual/merge.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/examples/manual/merge.cpp (original)
+++ stdcxx/branches/4.2.x/examples/manual/merge.cpp Wed Apr 16 10:01:56 2008
@@ -71,7 +71,7 @@
     // Now use a comparator on v6.
     mid = v6.begin ();
     std::advance (mid, 4);   // equivalent to mid += 4 but more generic
-    std::inplace_merge (v6.begin (), mid, v6.end (), std::less<int>());	  
+    std::inplace_merge (v6.begin (), mid, v6.end (), std::less<int>());
 
     // Merge v1 and v2 to empty vector using insert iterator.
     std::merge (v1.begin (), v1.end (),

Modified: stdcxx/branches/4.2.x/examples/manual/mismatch.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/examples/manual/mismatch.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/examples/manual/mismatch.cpp (original)
+++ stdcxx/branches/4.2.x/examples/manual/mismatch.cpp Wed Apr 16 10:01:56 2008
@@ -52,7 +52,7 @@
     // p1 will contain two iterators that point to the first pair of
     // elements that are different between the two vectors.
     std::pair<Iter, Iter> p1 =
-        std::mismatch (vi1.begin (), vi1.end (), vi2.begin ());	
+        std::mismatch (vi1.begin (), vi1.end (), vi2.begin ());
 
     // Find the first two elements such that an element in the
     // first vector is greater than the element in the second vector.

Modified: stdcxx/branches/4.2.x/examples/manual/partition.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/examples/manual/partition.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/examples/manual/partition.cpp (original)
+++ stdcxx/branches/4.2.x/examples/manual/partition.cpp Wed Apr 16 10:01:56 2008
@@ -34,8 +34,8 @@
 
 #include <examples.h>
 
-typedef std::modulus<int>		int_modulus;
-typedef std::binder2nd<int_modulus>	bnd_modulus;
+typedef std::modulus<int>               int_modulus;
+typedef std::binder2nd<int_modulus>     bnd_modulus;
 typedef std::unary_negate<bnd_modulus>  is_even;
 
 int main ()

Modified: stdcxx/branches/4.2.x/examples/manual/random_shuffle.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/examples/manual/random_shuffle.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/examples/manual/random_shuffle.cpp (original)
+++ stdcxx/branches/4.2.x/examples/manual/random_shuffle.cpp Wed Apr 16 10:01:56 2008
@@ -22,23 +22,24 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
 #include <algorithm>   // for random_shuffle
-#include <iostream>    // for cout, endl
+#include <iostream>    // for cout
 #include <iterator>    // for ostream_iterator
 #include <string>      // for string
 
-#include <examples.h>
+// #include <examples.h>
 
 
 int main ()
 {
     // Create a string of doubles (unusual? maybe, but why not...)
-    typedef std::basic_string<double, std::char_traits<double>,
-                              std::allocator<double> > Bizarre;
+    typedef std::char_traits<double>                     Traits;
+    typedef std::allocator<double>                       Allocator;
+    typedef std::basic_string<double, Traits, Allocator> Bizarre;
 
     // Initialize a Bizarre with an array of values.
     const Bizarre::value_type a[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
@@ -50,6 +51,7 @@
 
     // Suppress decimal point in output.
     std::cout.precision (0);
+    std::cout.setf (std::cout.fixed, std::cout.floatfield);
 
     // Print out elements in original (sorted) order.
     std::cout << "Elements before random_shuffle: \n     ";
@@ -61,7 +63,7 @@
     // Print out the mixed up elements.
     std::cout << "\n\nElements after random_shuffle: \n     ";
     std::copy (b.begin (), b.end (), Iter (std::cout, " "));
-    std::cout << std::endl;
+    std::cout << '\n';
 
     return 0;
 }

Modified: stdcxx/branches/4.2.x/examples/manual/remove.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/examples/manual/remove.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/examples/manual/remove.cpp (original)
+++ stdcxx/branches/4.2.x/examples/manual/remove.cpp Wed Apr 16 10:01:56 2008
@@ -51,8 +51,8 @@
 //  };
 
 
-typedef std::greater<int>		int_greater;
-typedef std::binder2nd<int_greater>	bnd_greater;
+typedef std::greater<int>              int_greater;
+typedef std::binder2nd<int_greater>    bnd_greater;
 
 int main ()
 {

Modified: stdcxx/branches/4.2.x/examples/tutorial/spell.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/examples/tutorial/spell.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/examples/tutorial/spell.cpp (original)
+++ stdcxx/branches/4.2.x/examples/tutorial/spell.cpp Wed Apr 16 10:01:56 2008
@@ -44,7 +44,7 @@
 typedef
     std::istream_iterator<std::string,
                           char, std::char_traits<char>, 
-			  std::ptrdiff_t>  istrm_iter;
+                          std::ptrdiff_t>  istrm_iter;
 
 
 void spellCheck (std::istream & dictionary, std::istream & text) {

Modified: stdcxx/branches/4.2.x/include/ansi/climits
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/ansi/climits?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/ansi/climits (original)
+++ stdcxx/branches/4.2.x/include/ansi/climits Wed Apr 16 10:01:56 2008
@@ -23,14 +23,13 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
 #ifndef _RWSTD_CLIMITS_INCLUDED
 #define _RWSTD_CLIMITS_INCLUDED
 
-
 #include <rw/_defs.h>
 
 
@@ -103,7 +102,17 @@
 
 #else   // if defined (_RWSTD_NO_PURE_C_HEADERS)
 
-#include _RWSTD_ANSI_C_LIMITS_H
+#  ifdef __GNUC__
+#    if __GNUC__ >= 3
+       // silence gcc warnings about #include_next below
+#      pragma GCC system_header
+#    endif   // gcc >= 3
+
+     // use the gcc extension to #include the compiler's limits.h
+#    include_next <limits.h>
+#  else
+#    include _RWSTD_ANSI_C_LIMITS_H
+#  endif   // gcc
 
 #endif  // _RWSTD_NO_PURE_C_HEADERS
 

Modified: stdcxx/branches/4.2.x/include/ansi/limits.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/ansi/limits.h?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/ansi/limits.h (original)
+++ stdcxx/branches/4.2.x/include/ansi/limits.h Wed Apr 16 10:01:56 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -106,7 +106,13 @@
 #    pragma GCC system_header
 #  endif
 
-#  include _RWSTD_ANSI_C_LIMITS_H
+#  ifdef __GNUC__
+     // use the gcc extension to #include the compiler's limits.h
+#    include_next <limits.h>
+#  else
+#    include _RWSTD_ANSI_C_LIMITS_H
+#  endif   // gcc
+
 #endif   // _RWSTD_NO_DEPRECATED_C_HEADERS
 
 #if defined (__hpux__) || defined (__hpux) || defined (hpux)

Modified: stdcxx/branches/4.2.x/include/deque
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/deque?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/deque (original)
+++ stdcxx/branches/4.2.x/include/deque Wed Apr 16 10:01:56 2008
@@ -277,6 +277,13 @@
 operator- (const _RWSTD_DEQUE_ITER(1) &__x, const _RWSTD_DEQUE_ITER(2) &__y)
 {
     // _RWSTD_ASSERT_RANGE (__x, __y);
+    typedef _TYPENAME _RWSTD_DEQUE_ITER(1)::pointer _Pointer1;
+    typedef _TYPENAME _RWSTD_DEQUE_ITER(2)::pointer _Pointer2;
+
+    if (_Pointer1 () == __x._C_cur && _Pointer2 () == __y._C_cur) {
+        // __x and __y are end-iterator's of the empty deque's
+        return _DiffT (__x._C_cur - __y._C_cur);
+    }
 
     const _DiffT __bufsize = _DiffT (__x._C_bufsize ());
 

Modified: stdcxx/branches/4.2.x/include/iomanip
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/iomanip?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/iomanip (original)
+++ stdcxx/branches/4.2.x/include/iomanip Wed Apr 16 10:01:56 2008
@@ -23,7 +23,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2005 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -87,7 +87,8 @@
 
         const unsigned __ifl =
               __strm.flags () & ~_STD::ios_base::basefield
-            & ~(_RWSTD_IOS_BASEMASK << _RWSTD_IOS_BASEOFF)
+            & ~(   _RWSTD_STATIC_CAST (unsigned, _RWSTD_IOS_BASEMASK)
+                << _RWSTD_IOS_BASEOFF)
             | __base << _RWSTD_IOS_BASEOFF;
 
         __strm.flags (_STD::ios_base::fmtflags (__ifl));

Modified: stdcxx/branches/4.2.x/include/loc/_ctype.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/loc/_ctype.h?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/loc/_ctype.h (original)
+++ stdcxx/branches/4.2.x/include/loc/_ctype.h Wed Apr 16 10:01:56 2008
@@ -541,20 +541,21 @@
 inline char
 ctype<wchar_t>::narrow (char_type __c, char __dfault) const
 {
-    const _RWSTD_SIZE_T __inx = _RWSTD_STATIC_CAST (unsigned char, __c);
-
     // optimize away all but the first call to the virtual do_widen()
-    if (   __inx < sizeof _C_narrow_tab / sizeof *_C_narrow_tab
-        && _C_narrow_tab [__inx])
-        return _C_narrow_tab [__inx];
+    if (   0 <= __c
+        && __c < sizeof _C_narrow_tab / sizeof *_C_narrow_tab
+        && _C_narrow_tab [__c])
+        return _C_narrow_tab [__c];
 
     // template argument provided to work around an HP aCC bug (PR #27087)
     ctype<wchar_t>* const __self = _RWSTD_CONST_CAST (ctype<wchar_t>*, this);
 
     const char __ch = do_narrow (__c, __dfault);
 
-    if (__inx < sizeof _C_narrow_tab / sizeof *_C_narrow_tab && __ch != __dfault)
-        __self->_C_narrow_tab [__inx] = __ch;
+    if (   0 <= __c
+        && __c < sizeof _C_narrow_tab / sizeof *_C_narrow_tab
+        && __ch != __dfault)
+        __self->_C_narrow_tab [__c] = __ch;
 
     return __ch;
 }

Modified: stdcxx/branches/4.2.x/include/loc/_localedef.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/loc/_localedef.h?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/loc/_localedef.h (original)
+++ stdcxx/branches/4.2.x/include/loc/_localedef.h Wed Apr 16 10:01:56 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2001-2007 Rogue Wave Software, Inc.
+ * Copyright 2001-2008 Rogue Wave Software, Inc.
  *
  **************************************************************************/
 
@@ -33,6 +33,14 @@
 #include <rw/_defs.h>
 
 
+#if 6 <= _RWSTD_HP_aCC_MAJOR
+   // suppress HP aCC 6 remarks
+   // 4298: addition result truncated before cast to bigger sized type
+   // 4299: multiply result truncated before cast to bigger sized type
+#  pragma diag_suppress 4298, 4299
+#endif   // aCC >= 6.0
+
+
 _RWSTD_NAMESPACE (__rw) { 
 
 // LC_CTYPE structures
@@ -678,6 +686,12 @@
         return _RWSTD_CHAR_ARRAY (time_ext_off);
     }
 };
+
+
+#if 6 <= _RWSTD_aCC_MAJOR
+   // restore HP aCC 6 remarks suppressed above to their default state
+#  pragma diag_default 4298, 4299
+#endif   // aCC >= 6
 
 
 static inline _RWSTD_SIZE_T

Modified: stdcxx/branches/4.2.x/include/loc/_money_put.cc
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/loc/_money_put.cc?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/loc/_money_put.cc (original)
+++ stdcxx/branches/4.2.x/include/loc/_money_put.cc Wed Apr 16 10:01:56 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -67,25 +67,25 @@
     typedef moneypunct<_CharT, false> _Punct0;
     typedef moneypunct<_CharT, true>  _Punct1;
 
-    const _Punct0* __pun0;
-    const _Punct1* __pun1;
+    const _Punct0* __pun0 = 0;
+    const _Punct1* __pun1 = 0;
 
     if (__intl) {
-        __pun0 = 0;
         __pun1 = &_RWSTD_USE_FACET (_Punct1, __flags.getloc ());
     }
     else {
         __pun0 = &_RWSTD_USE_FACET (_Punct0, __flags.getloc ());
-        __pun1 = 0;
     }
 
     const ctype<_CharT> &__ctp =
         _RWSTD_USE_FACET (ctype<_CharT>,__flags.getloc ());
 
+    const char __signchar = __ctp.narrow (*__s, '\0');
+
     money_base::pattern __fmat;   // negative or positive format
     string_type         __sign;   // negative or positive sign
 
-    if ('-' == __ctp.narrow (*__s, '\0')) {
+    if ('-' == __signchar) {
         if (__intl) {
             __fmat = __pun1->neg_format ();
             __sign = __pun1->negative_sign ();
@@ -106,7 +106,7 @@
             __fmat = __pun0->pos_format ();
             __sign = __pun0->positive_sign ();
         }
-        if ('+' == __ctp.narrow (*__s, '\0')) {
+        if ('+' == __signchar) {
             ++__s;
             --__n;
         }

Modified: stdcxx/branches/4.2.x/include/loc/_moneypunct.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/loc/_moneypunct.h?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/loc/_moneypunct.h (original)
+++ stdcxx/branches/4.2.x/include/loc/_moneypunct.h Wed Apr 16 10:01:56 2008
@@ -144,7 +144,7 @@
     // 22.2.6.3.1, p6
     virtual int do_frac_digits () const {
         return _RWSTD_STATIC_CAST(int, _RWSTD_REINTERPRET_CAST (_RWSTD_SIZE_T, 
-					    _C_get (this, _RW::__rw_fd)));
+                                           _C_get (this, _RW::__rw_fd)));
     }
 
     // 22.2.6.3.1, p7

Modified: stdcxx/branches/4.2.x/include/loc/_num_get.cc
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/loc/_num_get.cc?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/loc/_num_get.cc (original)
+++ stdcxx/branches/4.2.x/include/loc/_num_get.cc Wed Apr 16 10:01:56 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2001-2006 Rogue Wave Software.
+ * Copyright 2001-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -490,7 +490,8 @@
     // set the base determined above
     const unsigned __fl2 =
           __fl & ~_RWSTD_IOS_BASEFIELD
-        & ~(_RWSTD_IOS_BASEMASK << _RWSTD_IOS_BASEOFF)
+        & ~(   _RWSTD_STATIC_CAST (unsigned, _RWSTD_IOS_BASEMASK)
+            << _RWSTD_IOS_BASEOFF)
         | __base << _RWSTD_IOS_BASEOFF;
 
     // 22.2.2.1.2, p11: Stage 3

Modified: stdcxx/branches/4.2.x/include/loc/_num_get.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/loc/_num_get.h?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/loc/_num_get.h (original)
+++ stdcxx/branches/4.2.x/include/loc/_num_get.h Wed Apr 16 10:01:56 2008
@@ -25,7 +25,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2001-2006 Rogue Wave Software.
+ * Copyright 2001-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -239,7 +239,7 @@
 
     iter_type
     _C_get (iter_type, iter_type, ios_base&,
-	    _RWSTD_IOSTATE&, int, void*) const;
+            _RWSTD_IOSTATE&, int, void*) const;
 };
 
 
@@ -292,11 +292,15 @@
         __err |= _RW::__rw_failbit;
         return short (_RWSTD_SHRT_MAX);
     }
-    else
+
+#else   // if LONG_MAX <= SHRT_MAX
+
+    _RWSTD_UNUSED (__flags);
+    _RWSTD_UNUSED (__err);
 
 #endif   // _RWSTD_SHRT_MAX < _RWSTD_LONG_MAX
 
-        return _RWSTD_STATIC_CAST (short, __lval);
+    return _RWSTD_STATIC_CAST (short, __lval);
 }
 
 inline int
@@ -330,11 +334,15 @@
         __err |= _RW::__rw_failbit;
         return int (_RWSTD_INT_MAX);
     }
-    else
+
+#else   // if LONG_MAX <= INT_MAX
+
+    _RWSTD_UNUSED (__flags);
+    _RWSTD_UNUSED (__err);
 
 #endif   // _RWSTD_INT_MAX < _RWSTD_LONG_MAX
 
-        return _RWSTD_STATIC_CAST (int, __lval);
+    return _RWSTD_STATIC_CAST (int, __lval);
 }
 
 }   // namespace __rw

Modified: stdcxx/branches/4.2.x/include/ostream
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/ostream?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/ostream (original)
+++ stdcxx/branches/4.2.x/include/ostream Wed Apr 16 10:01:56 2008
@@ -23,7 +23,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -294,12 +294,27 @@
 inline basic_ostream<_CharT, _Traits>&
 basic_ostream<_CharT, _Traits>::_C_opfx ()
 {
-    basic_ostream* const __tie = this->tie ();
+    basic_ostream* __tie = this->tie ();
 
-    // flush tied stream only if its buffer is distinct from that
-    // of *this for greater efficiency and to to prevent a deadlock 
-    if (__tie && this->good () && __tie->rdbuf () != this->rdbuf ())
-        __tie->flush ();
+    if (__tie && this->good ()) {
+
+        // detect and avoid flushing streams that are tied together
+        // or that share the same buffer to prevent deadlock or
+        // infinite recursion
+        const basic_ostream *__p0, *__p1;
+
+        // traverse the list of tied streams looking for a cycle
+        for (__p0 = this, __p1 = this->tie (); __p0 && __p1;
+             __p0 = __p0->tie (),
+                 __p1 = __p1->tie () ? __p1->tie ()->tie () : 0)
+            if (__p0 == __p1 || __p0->rdbuf () == __p1->rdbuf ()) {
+                __tie = 0;
+                break;
+            }
+
+        if (__tie)
+            __tie->flush ();
+    }
 
     if (_C_is_sync ())
         _RW::__rw_fflush (_RWSTD_STATIC_CAST (ios_base*, this), 0);

Modified: stdcxx/branches/4.2.x/include/rw/_array.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_array.h?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/rw/_array.h (original)
+++ stdcxx/branches/4.2.x/include/rw/_array.h Wed Apr 16 10:01:56 2008
@@ -113,42 +113,44 @@
 
 template <class _TypeT>
 inline __rw_array<_TypeT>::__rw_array (size_type __n)
-    : _C_size (__n)
 {
-    if (__n) {
+    if (__n)
         _C_data = _RWSTD_STATIC_CAST (pointer,
                                       ::operator new (__n * sizeof *_C_data));
-    }
     else
         _C_data = 0;
+
+    _C_size = __n;
 }
 
 
 template <class _TypeT>
 inline __rw_array<_TypeT>::__rw_array (const_reference __val, size_type __n)
-    : _C_size (__n)
 {
     if (__n) {
         _C_data = _RWSTD_STATIC_CAST (pointer,
                                       ::operator new (__n * sizeof *_C_data));
-        _STD::uninitialized_fill_n (begin (), size (), __val);
+        _STD::uninitialized_fill_n (_C_data, __n, __val);
     }
     else
         _C_data = 0;
+
+    _C_size = __n;
 }
 
 
 template <class _TypeT>
 inline __rw_array<_TypeT>::__rw_array (const_pointer __data, size_type __n)
-    : _C_size (__n)
 { 
     if (__n) {
         _C_data = _RWSTD_STATIC_CAST (pointer,
                                       ::operator new (__n * sizeof *_C_data));
-        _STD::uninitialized_copy (__data, __data + __n, begin ());
+        _STD::uninitialized_copy (__data, __data + __n, _C_data);
     }
     else
         _C_data = 0;
+
+    _C_size = __n;
 }
 
 

Modified: stdcxx/branches/4.2.x/include/rw/_config-gcc.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_config-gcc.h?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/rw/_config-gcc.h (original)
+++ stdcxx/branches/4.2.x/include/rw/_config-gcc.h Wed Apr 16 10:01:56 2008
@@ -133,6 +133,11 @@
      // disabe exporting timeplate instantations in shared builds
      // see STDCXX-507
 #    define _RWSTD_NO_EXTERN_TEMPLATE
+
+     // operator new and delete is not reliably replaceable across
+     // shared library boundaries, which includes the shared library
+     // version of the language support library
+#    define _RWSTD_NO_REPLACEABLE_NEW_DELETE
 #  endif
 #endif   // __CYGWIN__
 

Modified: stdcxx/branches/4.2.x/include/rw/_exception.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_exception.h?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/rw/_exception.h (original)
+++ stdcxx/branches/4.2.x/include/rw/_exception.h Wed Apr 16 10:01:56 2008
@@ -59,7 +59,7 @@
 }  // namespace std
 
 _RWSTD_NAMESPACE (__rw) { 
-	
+
 // base exception class inherited by all other exceptions
 class _RWSTD_EXPORT __rw_exception: public _STD::exception
 {

Modified: stdcxx/branches/4.2.x/include/rw/_mbstate.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_mbstate.h?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/rw/_mbstate.h (original)
+++ stdcxx/branches/4.2.x/include/rw/_mbstate.h Wed Apr 16 10:01:56 2008
@@ -25,7 +25,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2005-2006 Rogue Wave Software.
+ * Copyright 2005-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -162,11 +162,14 @@
 // avoid namespace pollution on Solaris
 typedef struct __mbstate_t {
 
-#      ifdef _LP64
+       // Sun uses _LP64 in their header but the macro may not
+       // yetbe #defined at this point, depending on what other
+       // headers have been #included
+#      if 8 == _RWSTD_LONG_SIZE   // LP64
     long __filler [4];
 #      else
     int __filler [6];
-#      endif   // _LP64
+#      endif   // 8 == sizeof(long)
 } __mbstate_t;
 
 }   // extern "C"

Modified: stdcxx/branches/4.2.x/include/rw/_mutex.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_mutex.h?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/rw/_mutex.h (original)
+++ stdcxx/branches/4.2.x/include/rw/_mutex.h Wed Apr 16 10:01:56 2008
@@ -26,7 +26,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -79,6 +79,14 @@
 
 #elif defined (_RWSTD_POSIX_THREADS)
 
+#  if    defined (_RWSTD_EDG_ECCP) && defined (_RWSTD_OS_LINUX) \
+      && defined (_RWSTD_NO_LONG_LONG)
+     // disable error #450-D: the type "long long" is nonstandard
+     // when using the vanilla EDG eccp in strict mode (i.e., w/o
+     // long long support)
+#    pragma diag_suppress 450
+#  endif   // EDG eccp on Linux
+
 // LinuxThreads man page:
 //   "Variables of type pthread_mutex_t can also be initialized
 //    statically, using the constants  PTHREAD_MUTEX_INITIALIZER
@@ -1893,6 +1901,36 @@
 #elif !defined (_RWSTD_NO_ATOMIC_OPS)
 #  define _RWSTD_NO_ATOMIC_OPS
 #endif   // _RWSTD_NO_ATOMIC_OPS
+
+
+/********************** generic bool functions ************************/
+
+#ifndef _RWSTD_NO_BOOL
+
+#  if _RWSTD_BOOL_SIZE == _RWSTD_CHAR_SIZE
+#    define _RWSTD_BOOL_TYPE char
+#  elif _RWSTD_BOOL_SIZE == _RWSTD_SHORT_SIZE
+#    define _RWSTD_BOOL_TYPE short
+#  elif _RWSTD_BOOL_SIZE == _RWSTD_INT_SIZE
+#    define _RWSTD_BOOL_TYPE int
+#  endif
+
+#  ifdef _RWSTD_BOOL_TYPE
+
+inline bool
+__rw_atomic_exchange (bool &__x, bool __y, bool)
+{
+    return 0 != __rw_atomic_exchange (
+                    _RWSTD_REINTERPRET_CAST (_RWSTD_BOOL_TYPE&, __x),
+                    _RWSTD_STATIC_CAST (_RWSTD_BOOL_TYPE, __y),
+                    false);
+}
+
+#    undef _RWSTD_BOOL_TYPE
+#  endif   // _RWSTD_BOOL_TYPE
+
+#endif   // _RWSTD_NO_BOOL
+
 
 /********************** generic long functions ************************/
 

Modified: stdcxx/branches/4.2.x/include/rw/_streamiter.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_streamiter.h?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/rw/_streamiter.h (original)
+++ stdcxx/branches/4.2.x/include/rw/_streamiter.h Wed Apr 16 10:01:56 2008
@@ -25,7 +25,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -99,9 +99,7 @@
     _RWSTD_OPERATOR_ARROW (const value_type* operator->() const);
 
     // 24.5.1.2, p3
-    istream_iterator& operator++ () {
-        return _C_strm && !!*_C_strm && (*_C_strm >> _C_val), *this;
-    }
+    istream_iterator& operator++ ();
 
     // 24.5.1.2, p5
     istream_iterator operator++ (int) {
@@ -116,13 +114,28 @@
 };
 
 
+template <class _TypeT, class _CharT, class _Traits, class _Distance>
+inline istream_iterator<_TypeT, _CharT, _Traits, _Distance>&
+istream_iterator<_TypeT, _CharT, _Traits, _Distance>::
+operator++ ()
+{
+    // incrementing an end-of-stream iterator has undefined behavior
+
+    // see also LWG issue 788
+    if (_C_strm && (*_C_strm >> _C_val).fail ())
+        _C_strm = 0;
+
+    return *this;
+}
+
+
 // 24.5.1.2, p6
 template <class _TypeT, class _CharT, class _Traits, class _Distance>
 inline bool
 operator== (const istream_iterator<_TypeT, _CharT, _Traits, _Distance>& __x,
             const istream_iterator<_TypeT, _CharT, _Traits, _Distance>& __y)
 {
-    return (__x._C_strm && !!*__x._C_strm) == (__y._C_strm && !!*__y._C_strm);
+    return __x._C_strm == __y._C_strm;
 }
 
 

Modified: stdcxx/branches/4.2.x/include/rw/_traits.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_traits.h?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/rw/_traits.h (original)
+++ stdcxx/branches/4.2.x/include/rw/_traits.h Wed Apr 16 10:01:56 2008
@@ -25,7 +25,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -84,15 +84,34 @@
 #  define _RWSTD_WMEMSET   _RW::__rw_wmemset
 #  define _RWSTD_WCSLEN    _RW::__rw_wcslen
 #else   // if !defined (_RWSTDDEBUG) && !defined (_RWSTD_EDG_ECCP)
-#  include _RWSTD_CSTRING   // for memcmp(), ...
-#  include _RWSTD_CWCHAR    // wmemcmp(), ...
 
-#  define _RWSTD_MEMCPY    _RWSTD_C::memcpy
-#  define _RWSTD_MEMCMP    _RWSTD_C::memcmp
-#  define _RWSTD_MEMMOVE   _RWSTD_C::memmove
-#  define _RWSTD_MEMSET    _RWSTD_C::memset
-#  define _RWSTD_STRLEN    _RWSTD_C::strlen
-#  define _RWSTD_MEMCHR    _RWSTD_C::memchr
+#  if 4 <= __GNUG__ && !defined (__INTEL_COMPILER)
+     // use gcc 4.x intrinsic functions
+#    define _RWSTD_MEMCPY    __builtin_memcpy
+#    define _RWSTD_MEMCMP    __builtin_memcmp
+#    define _RWSTD_MEMMOVE   __builtin_memmove
+#    define _RWSTD_MEMSET    __builtin_memset
+#    define _RWSTD_STRLEN    __builtin_strlen
+
+#    if 4 < __GNUG__ || 3 <= __GNUC_MINOR__
+       // __builtin_memchr() is only available in gcc 4.3 and beyond
+#      define _RWSTD_MEMCHR    __builtin_memchr
+#    else   // gcc < 4.3
+#      include _RWSTD_CSTRING   // for memchr()
+#      define _RWSTD_MEMCHR    _RWSTD_C::memchr
+#    endif   // gcc 4.3
+#  else   // gcc < 4.0
+#    include _RWSTD_CSTRING   // for memcmp(), ...
+
+#    define _RWSTD_MEMCPY    _RWSTD_C::memcpy
+#    define _RWSTD_MEMCMP    _RWSTD_C::memcmp
+#    define _RWSTD_MEMMOVE   _RWSTD_C::memmove
+#    define _RWSTD_MEMSET    _RWSTD_C::memset
+#    define _RWSTD_STRLEN    _RWSTD_C::strlen
+#    define _RWSTD_MEMCHR    _RWSTD_C::memchr
+#  endif   // gcc 4.0
+
+#  include _RWSTD_CWCHAR    // wmemcmp(), ...
 
 #  ifndef _RWSTD_NO_WMEMCPY
 #    define _RWSTD_WMEMCPY   _RWSTD_C::wmemcpy

Modified: stdcxx/branches/4.2.x/include/rw/_tree.cc
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_tree.cc?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/rw/_tree.cc (original)
+++ stdcxx/branches/4.2.x/include/rw/_tree.cc Wed Apr 16 10:01:56 2008
@@ -307,7 +307,7 @@
 
     if (__dup) {
         // allow insertion of duplicate keys
-	__ret = _IterPair (_C_insert (__x, __y, __v), true);
+        __ret = _IterPair (_C_insert (__x, __y, __v), true);
         return;
     }
 
@@ -315,15 +315,15 @@
     if (__right) {
         if (__j == begin ()) {
             __ret = _IterPair (_C_insert (__x, __y, __v), true);
-	    return;
-	}
+            return;
+        }
         --__j;
     }
 
     if (_C_cmp (_ITER_NODE (__j)->_C_key (), _KeyOf ()(__v)))
         __ret = _IterPair (_C_insert (__x, __y, __v), true);
     else
-	__ret = _IterPair (__j, false);
+        __ret = _IterPair (__j, false);
 }
 
 

Modified: stdcxx/branches/4.2.x/include/rw/_tree.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_tree.h?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/rw/_tree.h (original)
+++ stdcxx/branches/4.2.x/include/rw/_tree.h Wed Apr 16 10:01:56 2008
@@ -566,8 +566,8 @@
 
     _STD::pair<iterator, bool>
     insert (const value_type &__val, bool __dup) {
-	_STD::pair<iterator, bool> __ret;
-	return _C_insert (__val, __ret, __dup), __ret;
+        _STD::pair<iterator, bool> __ret;
+        return _C_insert (__val, __ret, __dup), __ret;
     }
 
     iterator insert (iterator, const value_type&, bool);

Modified: stdcxx/branches/4.2.x/include/set
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/set?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/set (original)
+++ stdcxx/branches/4.2.x/include/set Wed Apr 16 10:01:56 2008
@@ -169,7 +169,7 @@
 #if !defined (_MSC_VER) || _MSC_VER > 1300
 
     iterator insert (iterator __it, const value_type& __x) {
-	    return _C_rep.insert (__it, __x, false);
+        return _C_rep.insert (__it, __x, false);
     }
 
     void erase (iterator __it) {
@@ -184,20 +184,20 @@
 
     // working around MSVC bugs
     iterator insert (iterator __it, const value_type& __x) {
-	    typedef _TYPENAME __rep_type::iterator _Iterator;
+        typedef _TYPENAME __rep_type::iterator _Iterator;
         return _RWSTD_REINTERPRET_CAST (iterator&, _C_rep.insert (
-	        _RWSTD_REINTERPRET_CAST (_Iterator&, __it), __x, false));
+                   _RWSTD_REINTERPRET_CAST (_Iterator&, __it), __x, false));
     }
 
     void erase (iterator __it) {
-	    typedef _TYPENAME __rep_type::iterator _Iterator;
+        typedef _TYPENAME __rep_type::iterator _Iterator;
         _C_rep.erase (_RWSTD_REINTERPRET_CAST (_Iterator&, __it));
     }
 
     void erase (iterator __first, iterator __last) {
-	    typedef _TYPENAME __rep_type::iterator _Iterator;
+        typedef _TYPENAME __rep_type::iterator _Iterator;
         _C_rep.erase (_RWSTD_REINTERPRET_CAST (_Iterator&, __first),
-		    _RWSTD_REINTERPRET_CAST (_Iterator&, __last));
+                      _RWSTD_REINTERPRET_CAST (_Iterator&, __last));
     }
 
 #endif

Modified: stdcxx/branches/4.2.x/include/sstream.cc
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/sstream.cc?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/sstream.cc (original)
+++ stdcxx/branches/4.2.x/include/sstream.cc Wed Apr 16 10:01:56 2008
@@ -82,8 +82,10 @@
     _ValueAlloc __alloc;
 
     // new buffer and size
-    char_type     *__buf;
-    _RWSTD_SIZE_T  __bufsize = __slen;
+    char_type        *__buf;
+    _RWSTD_SIZE_T     __bufsize = __slen;
+    // saved offset of pptr 
+    _RWSTD_STREAMSIZE __off = -1;
 
     if (__s == this->_C_buffer) {
         // special case: str(_C_buffer, _C_bufsize + N) called
@@ -94,6 +96,8 @@
         // set `slen' to the number of initialized characters
         // in the buffer
         __slen = this->egptr () - this->pbase ();
+        // save the offset of pptr
+        __off = this->pptr () - this->pbase ();
     }
 
     if (this->_C_bufsize < __bufsize) {
@@ -156,8 +160,12 @@
     if (this->_C_is_out ()) {
         this->setp (this->_C_buffer, this->_C_buffer + this->_C_bufsize);
 
-        if (   __s != __buf && this->_C_state & ios_base::in
-            || this->_C_state & (ios_base::app | ios_base::ate)) {
+        if (0 <= __off) {
+            // restore the pptr
+            this->pbump (__off);
+        }
+        else if (   this->_C_state & ios_base::in
+                 || this->_C_state & (ios_base::app | ios_base::ate)) {
             // in input or append/ate modes seek to end
             // (see also lwg issue 562 for clarification)
             this->pbump (__slen);
@@ -194,15 +202,9 @@
             __off = this->pbase () - __s;
         }
 
-        // preserve current pptr() since str() would seek to end
-        const streamsize __cur = this->pptr () - this->pbase ();
-
         // grow the buffer if necessary to accommodate the whole
         // string plus the contents of the buffer up to pptr()
         str (this->_C_buffer, __bufsize);
-
-        // restore pptr()
-        this->pbump (__cur - (this->pptr () - this->pbase ()));
 
         _RWSTD_ASSERT (__n <= this->epptr () - this->pptr ());
 

Modified: stdcxx/branches/4.2.x/include/string
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/string?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/string (original)
+++ stdcxx/branches/4.2.x/include/string Wed Apr 16 10:01:56 2008
@@ -23,7 +23,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2007 Rogue Wave Software, Inc.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  *
  **************************************************************************/
 
@@ -838,8 +838,11 @@
 
     void _C_clone (size_type);
 
-    _C_string_ref_type* _C_pref () const { 
-        return _RWSTD_REINTERPRET_CAST (_C_string_ref_type*, _C_data) - 1; 
+    _C_string_ref_type* _C_pref () const {
+        // use two static_casts in favor of reinterpret_cast
+        // to prevent "increased alignment" warnings
+        return _RWSTD_STATIC_CAST (_C_string_ref_type*,
+                   _RWSTD_STATIC_CAST (void*, _C_data)) - 1; 
     }
 
     void _C_unlink (pointer);   

Modified: stdcxx/branches/4.2.x/src/exception.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/exception.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/exception.cpp (original)
+++ stdcxx/branches/4.2.x/src/exception.cpp Wed Apr 16 10:01:56 2008
@@ -498,7 +498,7 @@
         // HP-UX and Windows are known to return a negative value for
         // buffer overflow.
 
-	// On IRIX and Tru64 UNIX on overflow the function returns
+        // On IRIX and Tru64 UNIX on overflow the function returns
         // the number of bytes actually written to the buffer which
         // makes it indistinguishable from a successful return value
         // for a completely full buffer.

Modified: stdcxx/branches/4.2.x/src/file.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/file.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/file.cpp (original)
+++ stdcxx/branches/4.2.x/src/file.cpp Wed Apr 16 10:01:56 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2002-2005, 2007 Rogue Wave Software, Inc.
+ * Copyright 2002-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -112,11 +112,6 @@
 #endif
 
 
-FILE* __rw_stderr = stderr;
-FILE* __rw_stdin  = stdin;
-FILE* __rw_stdout = stdout;
-
-
 static const int __rw_io_modes [] = {
     /*  0 */ -1,
     /*  1 */ _RWSTD_O_CREAT | _RWSTD_O_APPEND | _RWSTD_O_WRONLY,
@@ -572,5 +567,63 @@
     return 0;
 }
 
+
+#ifdef _RWSTD_EDG_ECCP
+
+   // undefine macros that expand to __rw_stderr et al
+   // before initializing the globals to their values
+#  undef stderr
+#  undef stdin
+#  undef stdout
+
+extern "C" {
+
+#  ifdef _RWSTD_OS_LINUX
+
+// Linux glibc defines stdin, stdout, and stderr as global objects
+// of type _IO_FILE but we fake the type using FILEs (it doesn't
+// matter since the type isn't mangled into object names)
+extern FILE *stdin;
+extern FILE *stdout;
+extern FILE *stderr;
+
+#  elif defined (_RWSTD_OS_SUNOS)
+
+// define a type that's as big as SunOS __FILE
+typedef struct  _RW_Sun_FILE {
+
+#    if 8 == _RWSTD_LONG_SIZE
+
+    int fill [4];   // 16 bytes
+
+#    else   // if (ILP32)
+
+    long fill [16];   // 128 bytes
+
+#    endif   // LP64/ILP32
+
+} __FILE;
+
+
+// Solaris file array
+extern struct __FILE __iob [FOPEN_MAX];
+
+#    define stderr   (FILE*)(__iob + 0)
+#    define stdin    (FILE*)(__iob + 1)
+#    define stdout   (FILE*)(__iob + 2)
+
+#  elif defined (_RWSTD_OS_WINDOWS)
+#    error "need stderr, stdin, and stdout"
+#  else
+#    error "need stderr, stdin, and stdout"
+#  endif
+
+}   // extern "C"
+
+#endif   // vanilla EDG eccp
+
+FILE* __rw_stderr = stderr;
+FILE* __rw_stdin  = stdin;
+FILE* __rw_stdout = stdout;
 
 }   // namespace __rw

Modified: stdcxx/branches/4.2.x/src/ia64/atomic.s
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/ia64/atomic.s?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/ia64/atomic.s (original)
+++ stdcxx/branches/4.2.x/src/ia64/atomic.s Wed Apr 16 10:01:56 2008
@@ -28,7 +28,7 @@
 
         .text
         //.pred.safe_across_calls p1-p5,p16-p63
-	.psr abi32 
+        .psr abi32 
         .psr msb
 
 ////////////////////////////////////////////////////////////////////////////
@@ -46,8 +46,8 @@
         .prologue
         .body
         // .mfb
-	addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit pointer
-	;;
+        addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit pointer
+        ;;
         xchg1 r8 = [r9], r33
         nop 0
         br.ret.sptk.many b0
@@ -70,8 +70,8 @@
         .body
          // .mmb
         mf
-	addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit pointer
-	;;
+        addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit pointer
+        ;;
         ld1.acq r15 = [r9]
         nop 0
         ;;
@@ -108,8 +108,8 @@
         .prologue
         .body
         // .mfb
-	addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit pointer
-	;;
+        addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit pointer
+        ;;
         xchg2 r8 = [r9], r33
         nop 0
         br.ret.sptk.many b0
@@ -132,8 +132,8 @@
         .body
          // .mmb
         mf
-	addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit pointer
-	;;
+        addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit pointer
+        ;;
         ld2.acq r15 = [r9]
         nop 0
         ;;
@@ -171,8 +171,8 @@
         .body
         // .mfb
 
-	addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit pointer
-	;;
+        addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit pointer
+        ;;
         xchg4 r8 = [r9], r33
         nop 0
         br.ret.sptk.many b0
@@ -195,8 +195,8 @@
         .body
          // .mmb
         mf
-	addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit pointer
-	;;
+        addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit pointer
+        ;;
         ld4.acq r15 = [r9]
         nop 0
         ;;
@@ -234,7 +234,7 @@
         .body
         // .mfb
 
-	addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit pointer
+        addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit pointer
         ;;
         xchg8 r8 = [r9], r33
         nop 0
@@ -258,7 +258,7 @@
         .body
          // .mmb
         mf
-	addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit pointer
+        addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit pointer
         ;;
         ld8.acq r15 = [r9]
         nop 0

Modified: stdcxx/branches/4.2.x/src/ios.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/ios.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/ios.cpp (original)
+++ stdcxx/branches/4.2.x/src/ios.cpp Wed Apr 16 10:01:56 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -95,29 +95,28 @@
 
 ios_base::fmtflags ios_base::flags (fmtflags fl)
 {
+    const unsigned mask =
+        ~(unsigned (_RWSTD_IOS_BASEMASK) << _RWSTD_IOS_BASEOFF);
+
     unsigned ifl = unsigned (fl);
 
     switch (fl & basefield) {
         // if basefield is set, clear the base mask and set
         // the numeric base bits according to the basefield
     case oct:
-        ifl = ifl & ~(_RWSTD_IOS_BASEMASK << _RWSTD_IOS_BASEOFF)
-                  | 8U << _RWSTD_IOS_BASEOFF;
+        ifl = ifl &  mask | 8U << _RWSTD_IOS_BASEOFF;
         break;
 
     case dec:
-        ifl = ifl & ~(_RWSTD_IOS_BASEMASK << _RWSTD_IOS_BASEOFF)
-                  | 10U << _RWSTD_IOS_BASEOFF;
+        ifl = ifl & mask | 10U << _RWSTD_IOS_BASEOFF;
         break;
 
     case hex:
-        ifl = ifl & ~(_RWSTD_IOS_BASEMASK << _RWSTD_IOS_BASEOFF)
-                  | 16U << _RWSTD_IOS_BASEOFF;
+        ifl = ifl & mask | 16U << _RWSTD_IOS_BASEOFF;
         break;
 
     case _RWSTD_IOS_BIN:
-        ifl = ifl & ~(_RWSTD_IOS_BASEMASK << _RWSTD_IOS_BASEOFF)
-                  | 2U << _RWSTD_IOS_BASEOFF;
+        ifl = ifl & mask | 2U << _RWSTD_IOS_BASEOFF;
         break;
 
     case 0:

Modified: stdcxx/branches/4.2.x/src/iostore.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/iostore.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/iostore.cpp (original)
+++ stdcxx/branches/4.2.x/src/iostore.cpp Wed Apr 16 10:01:56 2008
@@ -23,7 +23,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -192,6 +192,8 @@
     streamsize prec;     // new precision
     streamsize wide;     // new width
     unsigned   except;   // new exceptions
+    void*      ptie;     // tied ostream
+    locale     loc;      // new locale
 
     char srcbuf [16];    // buffer to copy `src' to
 
@@ -205,6 +207,9 @@
 
         if (rhs._C_usr) {
 
+            // copy pointer to the tied ostream, if any
+            ptie = rhs._C_usr->_C_tie;
+
             // for convenience
             const _C_usr_data* const rusr = rhs._C_usr;
 
@@ -235,6 +240,8 @@
             // zero out array to prevent (bogus) gcc warnings
             // about the variable being used uninitialized
             memset (a_size, 0, sizeof a_size);
+
+            ptie = 0;
         }
 
         // copy the rest of rhs state (save for exceptions)
@@ -243,6 +250,7 @@
         prec   = rhs._C_prec;
         wide   = rhs._C_wide;
         except = rhs._C_except;
+        loc    = rhs._C_loc;
 
         // copy additional data (rhs's fill char) to the small
         // temporary buffer only if it fits
@@ -273,7 +281,7 @@
             operator delete (_C_usr->_C_parray);
             operator delete (_C_usr->_C_cbarray);
         }
-        else if (ia || pa || cba) {
+        else if (ia || pa || cba || ptie) {
             // allocation may throw
             _C_usr = new _C_usr_data ();
 
@@ -302,7 +310,7 @@
         _RETHROW;
     }
 
-    if (ia || pa || cba) {
+    if (ia || pa || cba || ptie) {
 
         // assing allocated and copied arrays and their sizes
         _C_usr->_C_iarray  = ia;
@@ -313,6 +321,8 @@
         _C_usr->_C_psize   = a_size [1];
         _C_usr->_C_cbsize  = a_size [2];
 
+        _C_usr->_C_tie     = ptie;
+
         _C_usr->_C_fire    = &ios_base::_C_fire_event;
     }
     else {
@@ -325,6 +335,7 @@
     _C_fmtfl = fmtfl & flagmask | _C_fmtfl & ~flagmask;
     _C_prec  = prec;
     _C_wide  = wide;
+    _C_loc   = loc;
 
     // copy additional data (fill character) -- will be atomic
     // only if size is sufficiently small; since this is used

Modified: stdcxx/branches/4.2.x/src/iostream.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/iostream.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/iostream.cpp (original)
+++ stdcxx/branches/4.2.x/src/iostream.cpp Wed Apr 16 10:01:56 2008
@@ -226,7 +226,7 @@
 
 
 _RWSTD_NAMESPACE (std) {
-	
+
 ios_base::Init::Init ()
 {
     // only the first thread initializes

Modified: stdcxx/branches/4.2.x/src/iso2022.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/iso2022.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/iso2022.cpp (original)
+++ stdcxx/branches/4.2.x/src/iso2022.cpp Wed Apr 16 10:01:56 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -738,8 +738,12 @@
             if (_RWSTD_STATIC_CAST (_RWSTD_SIZE_T, to_end - to) < len)
                 return CODECVT_PARTIAL;
 
-            memcpy (to, esc, len);
-            to += len;
+            if (len) {
+                _RWSTD_ASSERT (to && esc);
+                
+                memcpy (to, esc, len);
+                to += len;
+            }
 
             // adjust the state
             state.g_map [2] = reg;
@@ -750,8 +754,12 @@
         if (_RWSTD_STATIC_CAST (_RWSTD_SIZE_T, to_end - to) < len)
             return CODECVT_PARTIAL;
 
-        memcpy (to, ss, sslen);
-        to += sslen;
+        if (sslen) {
+            _RWSTD_ASSERT (to && ss);
+
+            memcpy (to, ss, sslen);
+            to += sslen;
+        }
 
         // adjust the single shift indicator
         state.sshift2 = 1;
@@ -761,8 +769,12 @@
         if (_RWSTD_STATIC_CAST (_RWSTD_SIZE_T, to_end - to) < len)
             return CODECVT_PARTIAL;
 
-        memcpy (to, esc, len);
-        to += len;
+        if (len) {
+            _RWSTD_ASSERT (to && esc);
+
+            memcpy (to, esc, len);
+            to += len;
+        }
 
         // adjust the state
         state.g_map [0]   = reg;
@@ -1534,7 +1546,7 @@
     // utf8 temporary buffer
     char tmp [_UTF8_MB_CUR_MAX];
 
-    for (int i = 0; i < int(sizeof (db_array)/sizeof (unsigned char)); i++) {
+    for (size_t i = 0; i < sizeof db_array / sizeof *db_array; ++i) {
         char* ptmp = tmp;
 
         // obtain the database mapping

Modified: stdcxx/branches/4.2.x/src/iso2022.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/iso2022.h?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/iso2022.h (original)
+++ stdcxx/branches/4.2.x/src/iso2022.h Wed Apr 16 10:01:56 2008
@@ -42,10 +42,10 @@
 enum encoding_type
 {
     stateless,
-    iso2022_jp, 	 /* stateful ISO-2022-JP encoding  */
+    iso2022_jp,          /* stateful ISO-2022-JP encoding  */
     iso2022_jp2,         /* stateful ISO-2022-JP2 encoding */
-    iso2022_kr, 	 /* stateful ISO-2022-KR encoding  */
-    iso2022_cn  	 /* stateful ISO-2022-CN encoding  */
+    iso2022_kr,          /* stateful ISO-2022-KR encoding  */
+    iso2022_cn           /* stateful ISO-2022-CN encoding  */
 };
 typedef enum encoding_type encoding_type_t;
 

Modified: stdcxx/branches/4.2.x/src/locale_body.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/locale_body.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/locale_body.cpp (original)
+++ stdcxx/branches/4.2.x/src/locale_body.cpp Wed Apr 16 10:01:56 2008
@@ -805,13 +805,20 @@
 
         if (!global) {
 
-            static volatile long ginit /* = 0 */;
+            // volatile to prevent optimizers from turning
+            // the while statement below into an infinite loop
+            static volatile int ginit /* = 0 */;
 
-            if (!ginit && 1 == _RWSTD_ATOMIC_PREINCREMENT (ginit, false)) {
+            // cast ginit to int& (STDCXX-792)
+            // casting should be removed after fixing STDCXX-794
+            if (!ginit && 1 == _RWSTD_ATOMIC_PREINCREMENT (
+                    _RWSTD_CONST_CAST (int&, ginit), false)) {
                 global  = _C_manage (0, "C");
                 ginit  += 1000;
             }
             else {
+                // ginit must be volatile to prevent optimizers
+                // from turning this into an infinite loop
                 while (ginit < 1000);
             }
         }

Modified: stdcxx/branches/4.2.x/src/locale_global.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/locale_global.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/locale_global.cpp (original)
+++ stdcxx/branches/4.2.x/src/locale_global.cpp Wed Apr 16 10:01:56 2008
@@ -29,6 +29,7 @@
 #define _RWSTD_LIB_SRC
 
 #include <rw/_defs.h>
+#include <rw/_mutex.h>
 
 #include <locale.h>
 #include <string.h>
@@ -39,6 +40,11 @@
 #include "locale_body.h"
 
 
+_RWSTD_NAMESPACE (__rw) {
+
+extern __rw_mutex __rw_setlocale_mutex;
+
+}   // namespace __rw
 
 _RWSTD_NAMESPACE (std) { 
 
@@ -50,6 +56,8 @@
     if (!strchr (rhs.name ().c_str (), '*')) {
 
         // if the global locale has a name, call setlocale()
+
+        _RWSTD_MT_GUARD (_RW::__rw_setlocale_mutex);
 
         // assumes all locale names (i.e., including those of combined
         // locales) are in a format understandable by setlocale()

Modified: stdcxx/branches/4.2.x/src/messages.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/messages.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/messages.cpp (original)
+++ stdcxx/branches/4.2.x/src/messages.cpp Wed Apr 16 10:01:56 2008
@@ -102,9 +102,9 @@
  
     if (0 == init) {
         for (size_t i = 0; i < catalog_bufsize; ++i) {
-	    catalogs [i].catd = _RWSTD_BAD_CATD;
-	}
-	init = 1;
+            catalogs [i].catd = _RWSTD_BAD_CATD;
+        }
+        init = 1;
     }
 
     if (-1 == cat) {
@@ -116,57 +116,57 @@
              if (n_catalogs == catalog_bufsize) {
 
                 // reallocate buffer of facet pointers
-	         __rw_open_cat_data* const tmp =
-		     new __rw_open_cat_data[n_catalogs * 2];
-		 
-		 memcpy (tmp, catalogs, n_catalogs * sizeof *tmp);
-		 
-		 if (catalogs != catalog_buf)
-		     delete[] catalogs;
-		 
-		 catalogs         = tmp;
-		 catalog_bufsize *= 2;
-
-		 for (size_t i = n_catalogs; i < catalog_bufsize; ++i) {
-		      catalogs [i].catd = _RWSTD_BAD_CATD;
-		 }
-
-		 cat = int (n_catalogs);
-                 memcpy (&catalogs [cat].loc, &pcat_data->loc,
-                         sizeof (_STD::locale));
-
-		 catalogs [cat].catd = pcat_data->catd;
-
-		 if (size_t (cat) > largest_cat)
-		     largest_cat = size_t (cat);
-
-		 ++n_catalogs;
-	     }
-	     else {
-                 // find the first open slot and use it.
-                 cat = 0;
-                 while (catalogs [cat].catd != _RWSTD_BAD_CATD) {
-                     ++cat;
-                 }
-
-		 if (size_t (cat) > largest_cat)
-		     largest_cat = size_t (cat);
-
-                 memcpy (&catalogs [cat].loc, &pcat_data->loc,
-                         sizeof (_STD::locale));
-
-                 catalogs [cat].catd = pcat_data->catd;
-                 ++n_catalogs;
-	     }
-	}
+                __rw_open_cat_data* const tmp =
+                    new __rw_open_cat_data[n_catalogs * 2];
+
+                memcpy (tmp, catalogs, n_catalogs * sizeof *tmp);
+                 
+                if (catalogs != catalog_buf)
+                    delete[] catalogs;
+
+                catalogs         = tmp;
+                catalog_bufsize *= 2;
+
+                for (size_t i = n_catalogs; i < catalog_bufsize; ++i) {
+                    catalogs [i].catd = _RWSTD_BAD_CATD;
+                }
+
+                cat = int (n_catalogs);
+                memcpy (&catalogs [cat].loc, &pcat_data->loc,
+                        sizeof (_STD::locale));
+
+                catalogs [cat].catd = pcat_data->catd;
+
+                if (size_t (cat) > largest_cat)
+                    largest_cat = size_t (cat);
+
+                ++n_catalogs;
+            }
+            else {
+                // find the first open slot and use it.
+                cat = 0;
+                while (catalogs [cat].catd != _RWSTD_BAD_CATD) {
+                    ++cat;
+                }
+
+                if (size_t (cat) > largest_cat)
+                    largest_cat = size_t (cat);
+
+                memcpy (&catalogs [cat].loc, &pcat_data->loc,
+                        sizeof (_STD::locale));
+
+                catalogs [cat].catd = pcat_data->catd;
+                ++n_catalogs;
+            }
+        }
     }
     else {
         if (0 == pcat_data) {
-	    // find struct and return it
-	    if (size_t (cat) < catalog_bufsize)
+            // find struct and return it
+            if (size_t (cat) < catalog_bufsize)
                 return catalogs + cat;
 
-	    return 0;
+            return 0;
         }
 
         // initialize the struct to an invalid state
@@ -191,7 +191,7 @@
                 // second half of the statically allocated repository, copy
                 // the open catalogs back into the statically allocated
                 // repository.
-		    
+
                 catalog_bufsize = bufsize;
 
                 memcpy (catalog_buf, catalogs,
@@ -246,7 +246,7 @@
 
         const char dflt[] = "";
 
-	const nl_catd catd = pcat_data->catd;
+        const nl_catd catd = pcat_data->catd;
 
         const char* const text = catgets (catd, set_num, msg_num, dflt);
 

Modified: stdcxx/branches/4.2.x/src/num_get.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/num_get.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/num_get.cpp (original)
+++ stdcxx/branches/4.2.x/src/num_get.cpp Wed Apr 16 10:01:56 2008
@@ -364,6 +364,15 @@
         else if (type & __rw_facet::_C_signed || __rw_facet::_C_bool == type) {
             val.l = _RW::__rw_strtol (buf, &err, base);
         }
+        else if (__rw_facet::_C_pvoid == type) {
+
+#if defined (_RWSTD_LONG_LONG) && _RWSTD_PTR_SIZE > _RWSTD_LONG_SIZE
+            // assume pointers fit into long long
+            val.ull = _RW::__rw_strtoull (buf, &err, base);
+#else
+            val.ul = _RW::__rw_strtoul (buf, &err, base);
+#endif
+        }
         else {
             val.ul = _RW::__rw_strtoul (buf, &err, base);
         }
@@ -489,7 +498,11 @@
 
         case __rw_facet::_C_pvoid:
             *_RWSTD_STATIC_CAST (void**, pval) =
+#if defined (_RWSTD_LONG_LONG) && _RWSTD_PTR_SIZE > _RWSTD_LONG_SIZE
+                _RWSTD_REINTERPRET_CAST (void*, val.ull);
+#else
                 _RWSTD_REINTERPRET_CAST (void*, val.ul);
+#endif
 
             // disable grouping
             grouping = "";

Modified: stdcxx/branches/4.2.x/src/num_put.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/num_put.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/num_put.cpp (original)
+++ stdcxx/branches/4.2.x/src/num_put.cpp Wed Apr 16 10:01:56 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2001-2006 Rogue Wave Software.
+ * Copyright 2001-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -34,6 +34,13 @@
 #include <stdio.h>    // for snprintf()
 #include <string.h>   // for memmove(), memset()
 
+#include <float.h>   // for _finite(), _fpclass(), _isnan(), _copysign()
+#include <math.h>    // for isfinite(), isnan(), isinf(), signbit()
+
+#ifndef _RWSTD_NO_IEEEFP_H
+#  include <ieeefp.h>   // for fpclass(), isnan()
+#endif   // _RWSTD_NO_IEEEFP_H
+
 #include <loc/_num_put.h>
 
 #include "strtol.h"   // for __rw_digit_map
@@ -65,6 +72,7 @@
 #  endif   // _RWSTD_NO_SNPRINTF_IN_LIBC
 #endif   // _RWSTD_NO_SNPRINTF
 
+
 _RWSTD_NAMESPACE (__rw) { 
 
 static const char __rw_digits[] =
@@ -72,6 +80,159 @@
     "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 
 
+#if defined (_MSC_VER)
+
+inline bool __rw_isfinite (double val) { return !!_finite (val); }
+
+inline bool __rw_signbit (double val) { return 0 > _copysign (1., val); }
+
+inline bool __rw_isinf (double val) {
+    const int fpc = _fpclass (val);
+
+    if (_FPCLASS_NINF == fpc) {
+        // verify that __rw_signbit() correctly determines
+        // the sign of negative infinity
+        _RWSTD_ASSERT (__rw_signbit (val));
+        return true;
+    }
+    else if (_FPCLASS_PINF == fpc) {
+        // verify that __rw_signbit() correctly determines
+        // the sign of positive infinity
+        _RWSTD_ASSERT (!__rw_signbit (val));
+        return true;
+    }
+
+    return false;
+}
+
+inline bool __rw_isnan (double val) { return !!_isnan (val); }
+
+inline bool __rw_isqnan (double val) {
+    return _FPCLASS_QNAN == _fpclass (val);
+}
+
+inline bool __rw_issnan (double val) {
+    return _FPCLASS_SNAN == _fpclass (val);
+}
+
+#elif defined (_RWSTD_OS_SUNOS)
+
+inline bool __rw_isfinite (double val) { return !!finite (val); }
+
+inline bool __rw_signbit (double val)
+{
+    // implement own signbit() to avoid dragging in libm or libsunmath
+    return _RWSTD_REINTERPRET_CAST (const _RWSTD_UINT64_T&, val) >> 63;
+}
+
+inline bool __rw_isinf (double val) {
+    const int fpc = fpclass (val);
+
+    if (FP_NINF == fpc) {
+        // verify that __rw_signbit() correctly determines
+        // the sign of negative infinity
+        _RWSTD_ASSERT (__rw_signbit (val));
+        return true;
+    }
+    else if (FP_PINF == fpc) {
+        // verify that __rw_signbit() correctly determines
+        // the sign of positive infinity
+        _RWSTD_ASSERT (!__rw_signbit (val));
+        return true;
+    }
+
+    return false;
+}
+
+inline bool __rw_isnan (double val) { return 0 != isnan (val); }
+
+inline bool __rw_isqnan (double val) { return FP_QNAN == fpclass (val); }
+
+inline bool __rw_issnan (double val) { return FP_SNAN == fpclass (val); }
+
+#elif defined (fpclassify)
+
+inline bool __rw_isfinite (double val) { return !!isfinite (val); }
+
+inline bool __rw_signbit (double val) { return !!signbit (val); }
+
+inline bool __rw_isinf (double val) { return !!isinf (val); }
+
+inline bool __rw_isnan (double val) { return !!isnan (val); }
+
+inline bool __rw_isqnan (double val) { return false; }
+
+inline bool __rw_issnan (double val) { return false; }
+
+#else
+
+inline bool __rw_isfinite (double) { return true; }
+
+inline bool __rw_signbit (double) { return false; }
+
+inline bool __rw_isinf (double) { return false; }
+
+inline bool __rw_isnan (double) { return false; }
+
+inline bool __rw_isqnan (double) { return false; }
+
+inline bool __rw_issnan (double) { return false; }
+
+#endif
+
+
+static int
+__rw_fmat_infinite (char *buf, size_t bufsize, double val, unsigned flags)
+{
+    _RWSTD_ASSERT (!__rw_isfinite (val));
+    _RWSTD_ASSERT (5 <= bufsize);
+
+    char* end = buf;
+    const bool cap = !!(flags & _RWSTD_IOS_UPPERCASE);
+
+    if (__rw_isinf (val)) {
+        if (__rw_signbit (val)) {
+            *end++ = '-';
+        }
+        else if (flags & _RWSTD_IOS_SHOWPOS) {
+            *end++ = '+';
+        }
+
+        const char str [] = "iInNfF";
+        *end++ = str [cap + 0];
+        *end++ = str [cap + 2];
+        *end++ = str [cap + 4];
+    }
+    else {
+        _RWSTD_ASSERT (__rw_isnan (val));
+#if 0
+        // disabled since not all platforms correctly handling sign of NaN's
+        if (__rw_signbit (val)) {
+            *end++ = '-';
+        }
+        else if (flags & _RWSTD_IOS_SHOWPOS) {
+            *end++ = '+';
+        }
+#endif
+
+        const char str [] = "nNaAqQsS";
+        *end++ = str [cap + 0];
+        *end++ = str [cap + 2];
+        *end++ = str [cap + 0];
+#if 0
+        // disabled since not all platforms supporting 
+        // the quiet and signaling NaN's
+        if (__rw_isqnan (val))
+            *end++ = str [cap + 4];
+        else if (__rw_issnan (val))
+            *end++ = str [cap + 6];
+#endif
+    }
+
+    return int (end - buf);
+}
+
+
 #ifdef _RWSTD_LONG_LONG
 
 
@@ -778,88 +939,112 @@
 
 #endif   // _RWSTD_LONG_LONG
 
-    case __rw_facet::_C_float | __rw_facet::_C_ptr:
-        fpr = prec < 0 && flags & _RWSTD_IOS_FIXED ? 0 : prec;
-        fmt = __rw_get_stdio_fmat (fmtbuf, type & ~__rw_facet::_C_ptr,
-                                   flags, fpr);
-        for (; ;) {
-            len = SizeT (_SNPRINTF (*pbuf, bufsize, fmt,
-                                    *(const float*)pval));
-
-            if (len >= bufsize) {
-                if (*pbuf != buf)
-                    delete[] *pbuf;
-
-                *pbuf = new char [bufsize = len + 1 ? len + 1 : bufsize * 2];
+    case __rw_facet::_C_float | __rw_facet::_C_ptr: {
+            const float fval = *(const float*)pval;
+            if (!__rw_isfinite (fval)) {
+                len = __rw_fmat_infinite (*pbuf, bufsize, fval, flags);
+                end = *pbuf + len;
             }
             else {
-                _RWSTD_ASSERT (len > 0);
+                fpr = prec < 0 && flags & _RWSTD_IOS_FIXED ? 0 : prec;
+                fmt = __rw_get_stdio_fmat (fmtbuf, type & ~__rw_facet::_C_ptr,
+                                           flags, fpr);
+                for (; ;) {
+                    len = SizeT (_SNPRINTF (*pbuf, bufsize, fmt, fval));
 
-                break;
-            }
-        }
+                    if (len >= bufsize) {
+                        if (*pbuf != buf)
+                            delete[] *pbuf;
 
-        end = *pbuf + len;
-
-        // fix up output to conform to C99
-        __rw_fix_flt (end, len, flags, fpr);
-        break;
+                        bufsize = len + 1 ? len + 1 : bufsize * 2;
+                        *pbuf = new char [bufsize];
+                    }
+                    else {
+                        _RWSTD_ASSERT (len > 0);
 
-    case __rw_facet::_C_double | __rw_facet::_C_ptr:
-        fpr = prec < 0 && flags & _RWSTD_IOS_FIXED ? 0 : prec;
-        fmt = __rw_get_stdio_fmat (fmtbuf, type & ~__rw_facet::_C_ptr,
-                                   flags, fpr);
+                        break;
+                    }
+                }
 
-        for ( ; ; ) {
-            len = SizeT (_SNPRINTF (*pbuf, bufsize, fmt,
-                                    *(const double*)pval));
+                end = *pbuf + len;
 
-            if (len >= bufsize) {
-                if (*pbuf != buf)
-                    delete[] *pbuf;
+                // fix up output to conform to C99
+                __rw_fix_flt (end, len, flags, fpr);
+            }
+        }
+        break;
 
-                *pbuf = new char [bufsize = len + 1 ? len + 1 : bufsize * 2];
+    case __rw_facet::_C_double | __rw_facet::_C_ptr: {
+            const double dval = *(const double*)pval;
+            if (!__rw_isfinite (dval)) {
+                len = __rw_fmat_infinite (*pbuf, bufsize, dval, flags);
+                end = *pbuf + len;
             }
             else {
-                _RWSTD_ASSERT (len > 0);
+                fpr = prec < 0 && flags & _RWSTD_IOS_FIXED ? 0 : prec;
+                fmt = __rw_get_stdio_fmat (fmtbuf, type & ~__rw_facet::_C_ptr,
+                                           flags, fpr);
+
+                for ( ; ; ) {
+                    len = SizeT (_SNPRINTF (*pbuf, bufsize, fmt, dval));
+
+                    if (len >= bufsize) {
+                        if (*pbuf != buf)
+                            delete[] *pbuf;
+
+                        bufsize = len + 1 ? len + 1 : bufsize * 2;
+                        *pbuf = new char [bufsize];
+                    }
+                    else {
+                        _RWSTD_ASSERT (len > 0);
+
+                        break;
+                    }
+                }
 
-                break;
+                end = *pbuf + len;
+
+                // fix up output to conform to C99
+                __rw_fix_flt (end, len, flags, fpr);
             }
         }
-
-        end = *pbuf + len;
-
-        // fix up output to conform to C99
-        __rw_fix_flt (end, len, flags, fpr);
         break;
 
 #ifndef _RWSTD_NO_LONG_DOUBLE
 
-    case __rw_facet::_C_ldouble | __rw_facet::_C_ptr:
-        fpr = prec < 0 && flags & _RWSTD_IOS_FIXED ? 0 : prec;
-        fmt = __rw_get_stdio_fmat (fmtbuf, type & ~__rw_facet::_C_ptr,
-                                   flags, fpr);
-
-        for ( ; ; ) {
-            len = SizeT (_SNPRINTF (*pbuf, bufsize, fmt,
-                                    *(const long double*)pval));
-            if (len >= bufsize) {
-                if (*pbuf != buf)
-                    delete[] *pbuf;
-
-                *pbuf = new char [bufsize = len + 1 ? len + 1 : bufsize * 2];
+    case __rw_facet::_C_ldouble | __rw_facet::_C_ptr: {
+            const long double ldval = *(const long double*)pval;
+            if (!__rw_isfinite (ldval)) {
+                len = __rw_fmat_infinite (*pbuf, bufsize, ldval, flags);
+                end = *pbuf + len;
             }
             else {
-                _RWSTD_ASSERT (len > 0);
+                fpr = prec < 0 && flags & _RWSTD_IOS_FIXED ? 0 : prec;
+                fmt = __rw_get_stdio_fmat (fmtbuf, type & ~__rw_facet::_C_ptr,
+                                           flags, fpr);
+
+                for ( ; ; ) {
+                    len = SizeT (_SNPRINTF (*pbuf, bufsize, fmt, ldval));
+                    if (len >= bufsize) {
+                        if (*pbuf != buf)
+                            delete[] *pbuf;
+
+                        bufsize = len + 1 ? len + 1 : bufsize * 2;
+                        *pbuf = new char [bufsize];
+                    }
+                    else {
+                        _RWSTD_ASSERT (len > 0);
+
+                        break;
+                    }
+                }
 
-                break;
+                end = *pbuf + len;
+
+                // fix up output to conform to C99
+                __rw_fix_flt (end, len, flags, fpr);
             }
         }
-
-        end = *pbuf + len;
-
-        // fix up output to conform to C99
-        __rw_fix_flt (end, len, flags, fpr);
         break;
 
 #endif   // _RWSTD_NO_LONG_DOUBLE

Modified: stdcxx/branches/4.2.x/src/once.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/once.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/once.cpp (original)
+++ stdcxx/branches/4.2.x/src/once.cpp Wed Apr 16 10:01:56 2008
@@ -120,7 +120,10 @@
 
 restart:
 
-    if (init == 0 && 1 == _RWSTD_ATOMIC_PREINCREMENT (init, false)) {
+    // cast init to int& (see STDCXX-792)
+    // casting should be removed after fixing STDCXX-794
+    if (init == 0 && 1 == _RWSTD_ATOMIC_PREINCREMENT (
+            _RWSTD_CONST_CAST (int&, init), false)) {
 
         // entered by the first thread and only the first time around,
         // unless the initialization function throws
@@ -129,7 +132,8 @@
             func ();
         }
         _CATCH (...) {
-            _RWSTD_ATOMIC_PREDECREMENT (init, false);
+            _RWSTD_ATOMIC_PREDECREMENT (
+                _RWSTD_CONST_CAST (int&, init), false);
             _RETHROW;
         }
 

Modified: stdcxx/branches/4.2.x/src/punct.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/punct.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/punct.cpp (original)
+++ stdcxx/branches/4.2.x/src/punct.cpp Wed Apr 16 10:01:56 2008
@@ -616,12 +616,8 @@
         if (fmtflags & _RWSTD_IOS_SHOWPOINT)
             *pbuf++ = '#';
 
-        const int fltfld = fmtflags & _RWSTD_IOS_FLOATFIELD;
-
         // follows resolution of lwg issue 231
-        if (   (   _RWSTD_IOS_FIXED      == fltfld
-                || _RWSTD_IOS_SCIENTIFIC == fltfld)
-            && prec >= 0 || prec > 0) {
+        if (0 <= prec) {
 
             // 7.19.6.1, p5 of C99 specifies that, when given using the
             // asterisk, negative precision is treated the same as if

Modified: stdcxx/branches/4.2.x/src/setlocale.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/setlocale.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/setlocale.cpp (original)
+++ stdcxx/branches/4.2.x/src/setlocale.cpp Wed Apr 16 10:01:56 2008
@@ -72,8 +72,8 @@
 
 _RWSTD_NAMESPACE (__rw) { 
 
-// "setlocale" synchronization
-static __rw_mutex __rw_setlocale_mutex;
+// "setlocale" synchronization (internal, not exported)
+__rw_mutex __rw_setlocale_mutex;
 
 // ctor changes the C library locale, saving the old locale to be 
 // restored by the dtor

Modified: stdcxx/branches/4.2.x/src/valarray.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/valarray.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/valarray.cpp (original)
+++ stdcxx/branches/4.2.x/src/valarray.cpp Wed Apr 16 10:01:56 2008
@@ -40,9 +40,9 @@
 _RWSTD_SIZE_T gslice::next_ind ()
 {
     _RWSTD_SIZE_T __n = _C_length.size ();
-	 
+
     while (__n && _C_r_length [__n - 1] == _C_length [__n - 1] - 1)
-	--__n;
+        --__n;
 
     if (0 == __n) {
         _C_reset    = true;

Modified: stdcxx/branches/4.2.x/src/version.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/version.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/version.cpp (original)
+++ stdcxx/branches/4.2.x/src/version.cpp Wed Apr 16 10:01:56 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -35,7 +35,7 @@
 #ifdef _RWSTD_VER_STR
 
 extern const char __rw_ident[] = {
-    "@(#) Rogue Wave C++ Standard Library version " _RWSTD_VER_STR
+    "@(#) Apache C++ Standard Library version " _RWSTD_VER_STR
 };
 
 #endif   // _RWSTD_VER_STR
@@ -44,9 +44,28 @@
 
 
 #ifdef __HP_aCC
-#  pragma COPYRIGHT      "Rogue Wave Software"
-#  pragma COPYRIGHT_DATE "1994-2007"
-#  pragma VERSIONID      _RWSTD_VER_STR
+#  pragma COPYRIGHT      "Rogue Wave Software, Inc."
+#  pragma COPYRIGHT_DATE "1994-2008"
+#  if 37300 <= __HP_aCC
+#    pragma VERSIONID      _RWSTD_VER_STR
+#  elif 0x04020000 == _RWSTD_VER
+     // work around an HP aCC 3.63 and prior ICE (see STCXXX-98)
+#    pragma VERSIONID      "4.2.0"
+#  elif 0x04020100 == _RWSTD_VER
+#    pragma VERSIONID      "4.2.1"
+#  elif 0x04020200 == _RWSTD_VER
+#    pragma VERSIONID      "4.2.2"
+#  elif 0x04020300 == _RWSTD_VER
+#    pragma VERSIONID      "4.2.3"
+#  elif 0x04030000 == _RWSTD_VER
+#    pragma VERSIONID      "4.3.0"
+#  elif 0x04030100 == _RWSTD_VER
+#    pragma VERSIONID      "4.3.1"
+#  elif 0x04030200 == _RWSTD_VER
+#    pragma VERSIONID      "4.3.2"
+#  elif 0x05000000 == _RWSTD_VER
+#    pragma VERSIONID      "5.0.0"
+#  endif   // HP aCC < 3.73
 #elif defined (__IBMCPP__)
-#  pragma comment (copyright, "(C) 1994-2007, Rogue Wave Software")
+#  pragma comment (copyright, "(C) 1994-2008, Rogue Wave Software, Inc.")
 #endif   // __HP_aCC

Modified: stdcxx/branches/4.2.x/src/wcodecvt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/wcodecvt.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/wcodecvt.cpp (original)
+++ stdcxx/branches/4.2.x/src/wcodecvt.cpp Wed Apr 16 10:01:56 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2001-2007 Rogue Wave Software, Inc.
+ * Copyright 2001-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -342,9 +342,6 @@
 }
 
 
-//  This returns two result codes:  error and ok. The partial error result
-//  is not  returned because there  is no way  to know whether or  not the
-//  input sequence contains any more valid characters.
 static _STD::codecvt_base::result
 __rw_libc_do_in (_RWSTD_MBSTATE_T &state,
                  const char       *from, 
@@ -359,95 +356,59 @@
 
     _STD::codecvt_base::result res = _STD::codecvt_base::ok;
 
-    _RWSTD_MBSTATE_T save_state = state;   // saved state before conversion
+    // compute the length of the source sequence in bytes and
+    // the size of the destination buffer in wide characters
+    _RWSTD_SIZE_T src_len  = from_end - from;
+    _RWSTD_SIZE_T dst_size = to_limit - to;
+
+    // set the initial values to the source and destination pointers
+    const char* psrc = from;
+    wchar_t*    pdst = to;
 
-    _RWSTD_SIZE_T src_len = from_end - from;   // source length
-    _RWSTD_SIZE_T dst_len = to_limit - to;       // destination length
+    while (dst_size && src_len) {
 
-    const char*   psrc = from_next ? from_next : "";   // source
-    wchar_t*      pdst = to_next;                      // destination
-
-#ifndef _RWSTD_NO_MBSRTOWCS
-    // mbsrtowcs() requires the input to be a NULL-terminated string
-    const _RWSTD_SIZE_T ret = mbsrtowcs (pdst, &psrc, dst_len, &state);
-#else   // if defined (_RWSTD_NO_MBSRTOWCS)
-    const _RWSTD_SIZE_T ret = _RWSTD_SIZE_MAX;
-#endif    // _RWSTD_NO_MBSRTOWCS
-
-    // if an error occurred during the restartable function
-    // or if that function is not available
-    if (_RWSTD_SIZE_MAX == ret) {
-        // the conversion here (besides the previous failure) is done 
-        // one character at a time because the non-reentrant/restartable 
-        // counterpart of mbsrtowcs() does not provide any information
-        // about the size of the input that has been processed.
-        _RWSTD_UNUSED (state);
-
-        // restore `psrc' value
-        psrc = from_next ? from_next : "";
-
-        while (dst_len && src_len) {
-
-            _RWSTD_SIZE_T tmp;
+        // the number of bytes that form the next multibyte character
+        _RWSTD_SIZE_T nbytes;
 
 #ifndef _RWSTD_NO_MBRTOWC
-            tmp = mbrtowc (pdst, psrc, src_len, &state);
+        nbytes = mbrtowc (pdst, psrc, src_len, &state);
 #elif !defined (_RWSTD_NO_MBTOWC)
-            tmp = mbtowc (pdst, psrc, src_len);
+        nbytes = mbtowc (pdst, psrc, src_len);
 #else
-            tmp = _RWSTD_SIZE_MAX;
+        nbytes = _RWSTD_SIZE_MAX;
 #endif
 
-            // error; -1 result comes only from an illegal sequence
-            if (_RWSTD_SIZE_MAX == tmp) {
-                res = _STD::codecvt_base::error;
-                break;
-            }
- 
-            // not enough bytes in input to form a valid 
-            // character - translates to an ok result
-            if (tmp == (_RWSTD_SIZE_T)(-2))
-                break;
-
-            // the multibyte sequence is the NULL character
-            if (tmp == 0) 
-                tmp++;
-
-            // adjust the pointers
-            psrc    += tmp;
-            src_len -= tmp;
-            ++pdst;
-            --dst_len;
+        // -1 indicates an invalid sequence (i.e., error)
+        if (nbytes == (_RWSTD_SIZE_T)(-1)) {
+        res = _STD::codecvt_base::error;
+            break;
         }
-
-        // adjust "next" pointers
-        from_next = psrc;
-        to_next   = pdst;
-
+ 
+        // -2 indicates an ambiguous but valid subsequence
+        // (i.e., ok)
+        if (nbytes == (_RWSTD_SIZE_T)(-2))
+            break;
+
+        // 0 indicates the NUL character (skip over it)
+        if (nbytes == 0) 
+            ++nbytes;
+
+        // > 0 indicates the number of bytes in the successfully
+        // converted multibyte character
+        psrc    += nbytes;
+        src_len -= nbytes;
+        ++pdst;
+        --dst_size;
     }
-    else {
-        // the conversion succeeded on the first attempt
-
-        if (psrc)
-            from_next = psrc;
-        else {
-
-            // mbsrtowcs() sets `psrc' to 0 if the conversions
-            // stops due to the terminating NUL character
 
-            const _RWSTD_SIZE_T tmp =
-                __rw_libc_mbrlen (save_state, from_next, ret);
-            
-            from_next += tmp;
-        }
-
-        to_next += ret;
-    }
+    // adjust "next" pointers
+    from_next = psrc;
+    to_next   = pdst;
 
     // if the conversion has exhausted all space in the destination
     // range AND there are more COMPLETE characters in the source
     // range then we have a "partial" conversion
-    if (res == _STD::codecvt_base::ok && src_len && !dst_len) {
+    if (res == _STD::codecvt_base::ok && src_len && !dst_size) {
         _RWSTD_MBSTATE_T tmp_state = state;
         _RWSTD_SIZE_T tmp = __rw_libc_mbrlen (tmp_state, psrc, src_len);
         if (tmp < (_RWSTD_SIZE_T)(-2))

Modified: stdcxx/branches/4.2.x/src/wctype.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/wctype.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/wctype.cpp (original)
+++ stdcxx/branches/4.2.x/src/wctype.cpp Wed Apr 16 10:01:56 2008
@@ -51,6 +51,9 @@
 #include "setlocale.h"
 #include "use_facet.h"
 
+#ifdef _RWSTD_NO_EQUAL_CTYPE_MASK
+#  include "once.h"   // for __rw_once()
+#endif   // _RWSTD_NO_EQUAL_CTYPE_MASK
 
 // utf8 encoding maximum size
 #undef  _UTF8_MB_CUR_MAX
@@ -368,6 +371,47 @@
 
 #endif   // 0/1
 
+#ifdef _RWSTD_NO_EQUAL_CTYPE_MASK
+
+// table of wide character classes
+static _STD::ctype_base::mask
+__rw_classic_wide_tab [_STD::ctype<char>::table_size];
+
+// init-once flag for the classic wide tab
+static __rw_once_t
+__rw_classic_wide_tab_once_init = _RWSTD_ONCE_INIT;
+
+extern "C" {
+
+// one-time initializer for the classic wide_tab
+static void
+__rw_init_classic_wide_tab ()
+{
+#  ifdef _RWSTDDEBUG
+
+    static int init;
+
+    // paranoid check: verify that one-time initialization works
+    _RWSTD_ASSERT (0 == init);
+
+    ++init;
+
+#  endif   // _RWSTDDEBUG
+
+    // init the classic wide tab
+    wchar_t wc_array [_STD::ctype<char>::table_size];
+
+    for (wchar_t wc = 0; wc < _STD::ctype<char>::table_size; ++wc)
+        wc_array [wc] = wc;
+
+    __rw_get_mask (0, wc_array, wc_array + _STD::ctype<char>::table_size,
+                   __rw_all, __rw_classic_wide_tab, false, false, "C");
+}
+
+}   // extern "C"
+
+#endif   // _RWSTD_NO_EQUAL_CTYPE_MASK
+
 }   // namespace __rw
 
 
@@ -380,7 +424,15 @@
 ctype<wchar_t>::ctype (_RWSTD_SIZE_T ref)
     : _RW::__rw_facet (ref)
 {
+#ifndef _RWSTD_NO_EQUAL_CTYPE_MASK
     _C_mask_tab  = _RW::__rw_classic_tab;
+#else
+    // initialize classic wide tab exactly once
+    _RW::__rw_once (&_RW::__rw_classic_wide_tab_once_init,
+                    _RW::__rw_init_classic_wide_tab);
+
+    _C_mask_tab  = _RW::__rw_classic_wide_tab;
+#endif
     _C_upper_tab = _RWSTD_CONST_CAST (_UChar*, _RW::__rw_upper_tab);
     _C_lower_tab = _RWSTD_CONST_CAST (_UChar*, _RW::__rw_lower_tab);
     _C_delete_it = false;
@@ -554,7 +606,7 @@
 
 ctype_byname<wchar_t>::
 ctype_byname (const char *name, _RWSTD_SIZE_T refs)
-    : ctype<wchar_t>(refs), _C_cvtimpl (0), _C_cvtsize (0)
+    : ctype<wchar_t> (refs), _C_cvtimpl (0), _C_cvtsize (0)
 {
     this->_C_set_name (name, _C_namebuf, sizeof _C_namebuf);
 

Modified: stdcxx/branches/4.2.x/tests/algorithms/25.random.shuffle.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/algorithms/25.random.shuffle.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/algorithms/25.random.shuffle.cpp (original)
+++ stdcxx/branches/4.2.x/tests/algorithms/25.random.shuffle.cpp Wed Apr 16 10:01:56 2008
@@ -306,19 +306,16 @@
         0xfa, 0xbb, 0xdd, 0xa5, 0xa3, 0x73, 0x18, 0xd9
     };
 
-    bool success = true;
-    std::size_t i = 0;
-    for (; i != sizeof array / sizeof *array; ++i) {
-        success = array [i] == result [i];
-        if (!success)
-            break;
+    for (std::size_t i = 0; i != sizeof array / sizeof *array; ++i) {
+        const bool success = array [i] == result [i];
+        if (!success) {
+            rw_assert (0, 0, line, 
+                       "randomly shuffled sequence failed to match "
+                       "the expected result (data portability failure) "
+                       "%d != %d at %zu",
+                       array [i], result [i], i + 1);
+        }
     }
-
-    rw_assert (success, 0, line, 
-               "randomly shuffled sequence failed to match "
-               "the expected result (data portability failure) "
-               "%d != %d at %zu",
-               array [i], result [i], i + 1);
 
 #else
     rw_note (0, 0, 0,

Modified: stdcxx/branches/4.2.x/tests/containers/23.bitset.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/containers/23.bitset.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/containers/23.bitset.cpp (original)
+++ stdcxx/branches/4.2.x/tests/containers/23.bitset.cpp Wed Apr 16 10:01:56 2008
@@ -384,7 +384,8 @@
 template <std::size_t N>
 void test_ctors (const std::bitset<N>*)
 {
-    const std::size_t bmask = ::bitmax (N);
+    typedef unsigned long ULong;
+    const ULong bmask = ULong (::bitmax (N));
 
     {   // bitset::bitset()
         rw_info (0, 0, __LINE__, "std::bitset<%d>::bitset()", N);



Mime
View raw message