stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r640582 - /stdcxx/trunk/include/rw/_array.h
Date Mon, 24 Mar 2008 21:17:00 GMT
Author: sebor
Date: Mon Mar 24 14:16:59 2008
New Revision: 640582

URL: http://svn.apache.org/viewvc?rev=640582&view=rev
Log:
2008-03-24  Martin Sebor  <sebor@roguewave.com>

	STDCXX-748
	* include/rw/_array.h (__rw_array::__rw_array): Initialized _C_size
	after initializing _C_data to silence a bogus HP aCC 6.16/cadvise
	warning #20200-D: Potential null pointer dereference is detected.

Modified:
    stdcxx/trunk/include/rw/_array.h

Modified: stdcxx/trunk/include/rw/_array.h
URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/rw/_array.h?rev=640582&r1=640581&r2=640582&view=diff
==============================================================================
--- stdcxx/trunk/include/rw/_array.h (original)
+++ stdcxx/trunk/include/rw/_array.h Mon Mar 24 14:16:59 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;
 }
 
 



Mime
View raw message