stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r649363 - in /stdcxx/trunk/src: collate.cpp facet.cpp locale_core.cpp locale_name.cpp num_put.cpp
Date Fri, 18 Apr 2008 04:37:05 GMT
Author: sebor
Date: Thu Apr 17 21:36:54 2008
New Revision: 649363

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

	STDCXX-879
	* src/facet.cpp (_C_get_data): Explicitly converted pointer difference
	to size_t to avoid HP aCC remark #4271-D: type conversion may lose
	sign.
	* src/collate.cpp (do_transform): Same.
	* src/locale_name.cpp (name): Same.
	* src/locale_core.cpp (_C_get_std_facet): Same.
	* src/num_put.cpp (__rw_itoa): Changed the type of a local to match
	the the type of the expression it's initialized with to silence the
	same remark.
	(__rw_itoa): Silenced gcc (but not aCC) warning: comparison between
	signed and unsigned integer expressions in an assertion.

Modified:
    stdcxx/trunk/src/collate.cpp
    stdcxx/trunk/src/facet.cpp
    stdcxx/trunk/src/locale_core.cpp
    stdcxx/trunk/src/locale_name.cpp
    stdcxx/trunk/src/num_put.cpp

Modified: stdcxx/trunk/src/collate.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/src/collate.cpp?rev=649363&r1=649362&r2=649363&view=diff
==============================================================================
--- stdcxx/trunk/src/collate.cpp (original)
+++ stdcxx/trunk/src/collate.cpp Thu Apr 17 21:36:54 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.
  * 
  **************************************************************************/
 
@@ -867,7 +867,7 @@
     _RWSTD_ASSERT (0 != __lo);
     _RWSTD_ASSERT (__lo <= __hi);
 
-    return string_type (__lo, __hi - __lo);
+    return string_type (__lo, size_t (__hi - __lo));
 }
 
 
@@ -1041,7 +1041,7 @@
     _RWSTD_ASSERT (0 != __lo);
     _RWSTD_ASSERT (__lo <= __hi);
 
-    return string_type (__lo, __hi - __lo);
+    return string_type (__lo, size_t (__hi - __lo));
 }
 
 

Modified: stdcxx/trunk/src/facet.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/src/facet.cpp?rev=649363&r1=649362&r2=649363&view=diff
==============================================================================
--- stdcxx/trunk/src/facet.cpp (original)
+++ stdcxx/trunk/src/facet.cpp Thu Apr 17 21:36:54 2008
@@ -208,13 +208,14 @@
         // for the stripping of the special suffix
         _RW::__rw_chararray strip_name;
 
-        const char* pstr = strstr (locname.data (), "@UCS");
+        const char*  pstr = strstr (locname.data (), "@UCS");
+        const size_t plen = size_t (pstr - locname.data ());
+
         if (pstr && !pstr [4]) {
 
             // @UCS suffix is recognized irrespective of the size of wchar_t,
-            strip_name.append (locname.data (), pstr - locname.data ());
+            strip_name.append (locname.data (), plen);
             pdata = __rw_get_facet_data (cat, sz, strip_name.data ());
-
         }
         else if (   pstr && pstr [4] == '-' && !pstr [6]
                  && (   '4' == pstr [5] && sizeof (wchar_t) == 4
@@ -223,9 +224,8 @@
             // @UCS-4 is only recognized where sizeof (wchar_t) == 4
             // @UCS-2 is only recognized where sizeof (wchar_t) == 2
             // no other modifier is recognized
-            strip_name.append (locname.data (), pstr - locname.data ());
+            strip_name.append (locname.data (), plen);
             pdata = __rw_get_facet_data (cat, sz, strip_name.data ());
-
         }
 
         // if the type of the facet is codecvt_byname<wchar_t,char,mbstate_t>
@@ -275,10 +275,11 @@
     __rw_chararray codeset_fname;
     const char* codeset = pctype->codeset_name ();
 
-    const char *slash = strrchr (locname.data (), _RWSTD_PATH_SEP);
+    const char* const slash = strrchr (locname.data (), _RWSTD_PATH_SEP);
     if (slash) {
+        const size_t dirlen = size_t (slash - locname.data ()) + 1;
 
-        codeset_fname.assign (locname.data (), slash - locname.data () + 1);
+        codeset_fname.assign (locname.data (), dirlen);
         codeset_fname.append (codeset);
         codeset = codeset_fname.data ();
     }

Modified: stdcxx/trunk/src/locale_core.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/src/locale_core.cpp?rev=649363&r1=649362&r2=649363&view=diff
==============================================================================
--- stdcxx/trunk/src/locale_core.cpp (original)
+++ stdcxx/trunk/src/locale_core.cpp Thu Apr 17 21:36:54 2008
@@ -144,7 +144,10 @@
         size_t i = 0;
         for (; i != sizeof _RW::__rw_cats / sizeof *_RW::__rw_cats; ++i) {
             if (_RW::__rw_cats [i].cat == facet_cat) {
-                locname.assign (nm, next - nm);
+
+                const size_t nmlen = size_t (next - nm);
+
+                locname.assign (nm, nmlen);
                 locname.append ("", 1);   // append a terminating NUL
                 break;
             }

Modified: stdcxx/trunk/src/locale_name.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/src/locale_name.cpp?rev=649363&r1=649362&r2=649363&view=diff
==============================================================================
--- stdcxx/trunk/src/locale_name.cpp (original)
+++ stdcxx/trunk/src/locale_name.cpp Thu Apr 17 21:36:54 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.
  * 
  **************************************************************************/
 
@@ -83,7 +83,8 @@
                 result += '=';
             }
 
-            result.append (catnm, next - catnm);
+            const size_t catlen = size_t (next - catnm);
+            result.append (catnm, catlen);
 
             catnm = next + !!*next;
         }

Modified: stdcxx/trunk/src/num_put.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/src/num_put.cpp?rev=649363&r1=649362&r2=649363&view=diff
==============================================================================
--- stdcxx/trunk/src/num_put.cpp (original)
+++ stdcxx/trunk/src/num_put.cpp Thu Apr 17 21:36:54 2008
@@ -522,14 +522,14 @@
     const char* const pdigs = flags & _RWSTD_IOS_UPPERCASE ?
         __rw_digits + 36 : __rw_digits;
 
-    const int basemask = (flags >> _RWSTD_IOS_BASEOFF) - 1;
+    const unsigned basemask = (flags >> _RWSTD_IOS_BASEOFF) - 1;
 
     int bits;
 
     char *end = buf;
 
     switch (basemask) {
-    case  -1: case 9:
+    case unsigned (-1): case 9:
         return __rw_dtoa (end, i, flags);
 
     case 0:
@@ -572,9 +572,9 @@
         j = 0;
 
     do {
-        const int dig = int ((i >> (j * bits)) & basemask);
+        const unsigned dig = (i >> (j * bits)) & basemask;
 
-        _RWSTD_ASSERT (dig >= 0 && dig <= basemask);
+        _RWSTD_ASSERT (dig <= basemask);
 
         *end++ = pdigs [dig];
     } while (j--);



Mime
View raw message