From 4e48f30a97bd3d58f72c47b2b478da45bf595082 Mon Sep 17 00:00:00 2001
From: aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue, 4 Mar 2003 21:21:44 +0000
Subject: [PATCH] * src/strstream.cc (strstreambuf::overflow): Make sure
 operands of min and max have the same type. * include/bits/basic_string.tcc
 (append, rfind, compare): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@63802 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libstdc++-v3/ChangeLog                     |  6 ++++++
 libstdc++-v3/include/bits/basic_string.tcc | 15 ++++++++-------
 libstdc++-v3/src/strstream.cc              |  4 ++--
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 0788fc2876ac..4ada08799e37 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+2003-03-04  Alexandre Oliva  <aoliva@redhat.com>
+
+	* src/strstream.cc (strstreambuf::overflow): Make sure operands of
+	min and max have the same type.
+	* include/bits/basic_string.tcc (append, rfind, compare): Likewise.
+
 2003-03-04  Benjamin Kosnik  <bkoz@redhat.com>
 
 	* include/Makefile.am (allstamps): Remove stamp-std-precompile.
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc
index f3cb93c31b68..78f889ce0e8c 100644
--- a/libstdc++-v3/include/bits/basic_string.tcc
+++ b/libstdc++-v3/include/bits/basic_string.tcc
@@ -578,7 +578,8 @@ namespace std
       // Iff appending itself, string needs to pre-reserve the
       // correct size so that _M_mutate does not clobber the
       // iterators formed here.
-      size_type __len = std::min(__str.size() - __pos, __n) + this->size();
+      size_type __len = std::min(size_type (__str.size() - __pos),
+				 __n) + this->size();
       if (__len > this->capacity())
 	this->reserve(__len);
       return _M_replace_safe(_M_iend(), _M_iend(), __str._M_check(__pos),
@@ -709,7 +710,7 @@ namespace std
       size_type __size = this->size();
       if (__n <= __size)
 	{
-	  __pos = std::min(__size - __n, __pos);
+	  __pos = std::min(size_type (__size - __n), __pos);
 	  const _CharT* __data = _M_data();
 	  do 
 	    {
@@ -848,7 +849,7 @@ namespace std
       if (__pos > __size)
 	__throw_out_of_range("basic_string::compare");
       
-      size_type __rsize= std::min(__size - __pos, __n);
+      size_type __rsize= std::min(size_type (__size - __pos), __n);
       size_type __len = std::min(__rsize, __osize);
       int __r = traits_type::compare(_M_data() + __pos, __str.data(), __len);
       if (!__r)
@@ -867,8 +868,8 @@ namespace std
       if (__pos1 > __size || __pos2 > __osize)
 	__throw_out_of_range("basic_string::compare");
       
-      size_type __rsize = std::min(__size - __pos1, __n1);
-      size_type __rosize = std::min(__osize - __pos2, __n2);
+      size_type __rsize = std::min(size_type (__size - __pos1), __n1);
+      size_type __rosize = std::min(size_type (__osize - __pos2), __n2);
       size_type __len = std::min(__rsize, __rosize);
       int __r = traits_type::compare(_M_data() + __pos1, 
 				     __str.data() + __pos2, __len);
@@ -903,7 +904,7 @@ namespace std
 	__throw_out_of_range("basic_string::compare");
       
       size_type __osize = traits_type::length(__s);
-      size_type __rsize = std::min(__size - __pos, __n1);
+      size_type __rsize = std::min(size_type (__size - __pos), __n1);
       size_type __len = std::min(__rsize, __osize);
       int __r = traits_type::compare(_M_data() + __pos, __s, __len);
       if (!__r)
@@ -922,7 +923,7 @@ namespace std
 	__throw_out_of_range("basic_string::compare");
       
       size_type __osize = std::min(traits_type::length(__s), __n2);
-      size_type __rsize = std::min(__size - __pos, __n1);
+      size_type __rsize = std::min(size_type (__size - __pos), __n1);
       size_type __len = std::min(__rsize, __osize);
       int __r = traits_type::compare(_M_data() + __pos, __s, __len);
       if (!__r)
diff --git a/libstdc++-v3/src/strstream.cc b/libstdc++-v3/src/strstream.cc
index f0c1000e6d4e..a030697f68d2 100644
--- a/libstdc++-v3/src/strstream.cc
+++ b/libstdc++-v3/src/strstream.cc
@@ -1,6 +1,6 @@
 // strstream definitions -*- C++ -*-
 
-// Copyright (C) 2001, 2002 Free Software Foundation
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -148,7 +148,7 @@ namespace std
     if (pptr() == epptr() && _M_dynamic && !_M_frozen && !_M_constant) 
       {
 	ptrdiff_t old_size = epptr() - pbase();
-	ptrdiff_t new_size = std::max(2 * old_size, ptrdiff_t(1));
+	ptrdiff_t new_size = std::max(ptrdiff_t (2 * old_size), ptrdiff_t (1));
 	
 	char* buf = _M_alloc(new_size);
 	if (buf) 
-- 
GitLab