]> gcc.gnu.org Git - gcc.git/commitdiff
libstdc++: Fix -Wsign-compare warnings
authorJonathan Wakely <jwakely@redhat.com>
Thu, 10 Sep 2020 17:57:39 +0000 (18:57 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 10 Sep 2020 17:57:39 +0000 (18:57 +0100)
libstdc++-v3/ChangeLog:

* include/bits/locale_conv.h (__do_str_codecvt, __str_codecvt_in_all):
Add casts to compare types of the same signedness.

libstdc++-v3/include/bits/locale_conv.h

index 4a11e237623daf0fa2d2014f48b4d86072992838..f1d7032e8bcba7d8209e48fd3ef9d5a7388581cc 100644 (file)
@@ -78,7 +78,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
          __outchars = __outnext - &__outstr.front();
        }
       while (__result == codecvt_base::partial && __next != __last
-            && (__outstr.size() - __outchars) < __maxlen);
+            && ptrdiff_t(__outstr.size() - __outchars) < __maxlen);
 
       if (__result == codecvt_base::error)
        {
@@ -142,7 +142,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       _State __state = {};
       size_t __n;
       return __str_codecvt_in(__first, __last, __outstr, __cvt, __state, __n)
-       && (__n == (__last - __first));
+       && (__n == size_t(__last - __first));
     }
 
   // Convert wide character string to narrow.
This page took 0.062421 seconds and 5 git commands to generate.