You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2006/03/17 22:47:42 UTC
svn commit: r386732 - /incubator/stdcxx/trunk/src/exception.cpp
Author: sebor
Date: Fri Mar 17 13:47:40 2006
New Revision: 386732
URL: http://svn.apache.org/viewcvs?rev=386732&view=rev
Log:
2006-03-17 Martin Sebor <se...@roguewave.com>
* exception.cpp (_C_assign): Replaced size_t (~0) with SIZE_MAX
to avoid HP aCC remark 4237.
(operator=): Avoided the use of a comma expression in the return
statement to prevent the bogus HP aCC remark 4284 (operator= does
not return reference to *this).
Modified:
incubator/stdcxx/trunk/src/exception.cpp
Modified: incubator/stdcxx/trunk/src/exception.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/src/exception.cpp?rev=386732&r1=386731&r2=386732&view=diff
==============================================================================
--- incubator/stdcxx/trunk/src/exception.cpp (original)
+++ incubator/stdcxx/trunk/src/exception.cpp Fri Mar 17 13:47:40 2006
@@ -1,21 +1,27 @@
/***************************************************************************
*
- * exception.cpp - sources of the C++ Standard Library exception classes
+ * stdexcept.cpp - Source for the Standard Library exception classes
*
* $Id$
*
***************************************************************************
*
- * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave
- * Software division. Licensed under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0. Unless required by
- * applicable law or agreed to in writing, software distributed under
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- * CONDITIONS OF ANY KIND, either express or implied. See the License
- * for the specific language governing permissions and limitations under
- * the License.
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Copyright 1994-2006 Rogue Wave Software.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
**************************************************************************/
@@ -891,7 +897,9 @@
__rw_exception& __rw_exception::
operator= (const __rw_exception &__rhs) _THROWS (())
{
- return _C_assign (__rhs.what ());
+ _C_assign (__rhs.what ());
+
+ return *this;
}
@@ -915,11 +923,14 @@
char *tmp = 0;
if (whatstr && *whatstr) {
+
+ if (_RWSTD_SIZE_MAX == len)
+ len = strlen (whatstr);
+
if (len) {
// allocate own buffer and copy string
- tmp = new char [(size_t (~0) == len ? strlen (whatstr)
- : len) + 1];
- strcpy (tmp, whatstr);
+ tmp = new char [len + 1];
+ memcpy (tmp, whatstr, len + 1);
}
else {
// special case: do not allocate, just use passed in pointer