[libcxx] r188395 - Fix signed/unsigned warnings when building libc++ in C++14 mode

Marshall Clow mclow.lists at gmail.com
Wed Aug 14 10:53:31 PDT 2013


Author: marshall
Date: Wed Aug 14 12:53:31 2013
New Revision: 188395

URL: http://llvm.org/viewvc/llvm-project?rev=188395&view=rev
Log:
Fix signed/unsigned warnings when building libc++ in C++14 mode

Modified:
    libcxx/trunk/src/strstream.cpp

Modified: libcxx/trunk/src/strstream.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/strstream.cpp?rev=188395&r1=188394&r2=188395&view=diff
==============================================================================
--- libcxx/trunk/src/strstream.cpp (original)
+++ libcxx/trunk/src/strstream.cpp Wed Aug 14 12:53:31 2013
@@ -156,13 +156,13 @@ strstreambuf::overflow(int_type __c)
     {
         if ((__strmode_ & __dynamic) == 0 || (__strmode_ & __frozen) != 0)
             return int_type(EOF);
-        streamsize old_size = (epptr() ? epptr() : egptr()) - eback();
-        streamsize new_size = max<streamsize>(__alsize_, 2*old_size);
+        size_t old_size = static_cast<size_t> ((epptr() ? epptr() : egptr()) - eback());
+        size_t new_size = max<size_t>(static_cast<size_t>(__alsize_), 2*old_size);
         if (new_size == 0)
             new_size = __default_alsize;
         char* buf = nullptr;
         if (__palloc_)
-            buf = static_cast<char*>(__palloc_(static_cast<size_t>(new_size)));
+            buf = static_cast<char*>(__palloc_(new_size));
         else
             buf = new char[new_size];
         if (buf == nullptr)





More information about the cfe-commits mailing list