Author: sebor
Date: Sun May 4 20:23:19 2008
New Revision: 653294
URL: http://svn.apache.org/viewvc?rev=653294&view=rev
Log:
2008-05-04 Martin Sebor <[EMAIL PROTECTED]>
Merged rev 653293 (fixing STDCXX-695 of which STDCXX-788 is a dupe)
from trunk.
2008-05-04 Martin Sebor <[EMAIL PROTECTED]>
STDCXX-788
* 22.locale.num.put.cpp (do_tesT): Cast narrow character to unsigned
char before converting it to the generic charT to avoid potential sign
extension and to silence HP aCC 6 remark #4271-D: type conversion may
lose sign.
(long_test): Cast macro argument to unsigned type before shifting it
left to avoid an arithmetic overflow and to silence HP aCC 6 remark
#4300-D: Overflow while computing constant in left shift operation.
Modified:
stdcxx/branches/4.2.x/tests/localization/22.locale.num.put.cpp
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.num.put.cpp
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.num.put.cpp?rev=653294&r1=653293&r2=653294&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.num.put.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.num.put.cpp Sun May 4
20:23:19 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.
*
**************************************************************************/
@@ -328,7 +328,12 @@
#endif // _RWSTD_LDBL_MAX_10_EXP
- const charT* const bufend = np.put (buf, ios, fill, val);
+ // cast the narrow fill character to unsigned char before
+ // converting it to charT to avoid potential sign extension
+ typedef unsigned char UChar;
+ const charT wfill = charT (UChar (fill));
+
+ const charT* const bufend = np.put (buf, ios, wfill, val);
// verify 22.2.2.2.2, p21
if (ios.width ()) {
@@ -1171,7 +1176,7 @@
// locale 3.0 extension
-#define BASE(n) ((n) << _RWSTD_IOS_BASEOFF)
+#define BASE(n) int (unsigned (n) << _RWSTD_IOS_BASEOFF)
// bases 0 and 10 are both base 10
// base 1 is roman (values 1 through 4999)