Commit a9dd5a46 by Paolo Carlini Committed by Paolo Carlini

PR libstdc++/21244 (cont)

2005-04-28  Paolo Carlini  <pcarlini@suse.de>
	    Gabriel Dos Reis  <gdr@integrable-solutions.net>

	PR libstdc++/21244 (cont)
	* include/bits/cpp_type_traits.h (struct __traitor): Convert
	to bool the values.
	* include/bits/stl_algo.h: Convert _S_threshold to int.
	* include/bits/stl_bvector.h: Revert previous change, convert
	_S_word_bit to int.
	* include/debug/formatter.h: Convert __max_parameters to
	size_t.
	* include/ext/mt_allocator.h: Likewise for _S_chunk_size.
	* include/ext/pool_allocator.h: Likewise for _S_max_bytes and
	_S_align.
	* include/ext/rope: Likewise for _S_alloc_granularity; convert
	_S_max_rope_depth to int.
	* include/ext/ropeimpl.h: Convert _S_path_cache_len to int;
	_S_max_rope_depth to int; _S_copy_max to size_t.

Co-Authored-By: Gabriel Dos Reis <gdr@integrable-solutions.net>

From-SVN: r98915
parent fe9565ed
2005-04-28 Paolo Carlini <pcarlini@suse.de>
Gabriel Dos Reis <gdr@integrable-solutions.net>
PR libstdc++/21244 (cont)
* include/bits/cpp_type_traits.h (struct __traitor): Convert
to bool the values.
* include/bits/stl_algo.h: Convert _S_threshold to int.
* include/bits/stl_bvector.h: Revert previous change, convert
_S_word_bit to int.
* include/debug/formatter.h: Convert __max_parameters to
size_t.
* include/ext/mt_allocator.h: Likewise for _S_chunk_size.
* include/ext/pool_allocator.h: Likewise for _S_max_bytes and
_S_align.
* include/ext/rope: Likewise for _S_alloc_granularity; convert
_S_max_rope_depth to int.
* include/ext/ropeimpl.h: Convert _S_path_cache_len to int;
_S_max_rope_depth to int; _S_copy_max to size_t.
2005-04-27 Benjamin Kosnik <bkoz@redhat.com> 2005-04-27 Benjamin Kosnik <bkoz@redhat.com>
* docs/doxygen/user.cfg.in: Update to doxygen-1.4.2. * docs/doxygen/user.cfg.in: Update to doxygen-1.4.2.
......
...@@ -103,10 +103,12 @@ namespace std ...@@ -103,10 +103,12 @@ namespace std
struct __truth_type<true> struct __truth_type<true>
{ typedef __true_type __type; }; { typedef __true_type __type; };
// N.B. The conversions to bool are needed due to the issue
// explained in c++/19404.
template<class _Sp, class _Tp> template<class _Sp, class _Tp>
struct __traitor struct __traitor
{ {
enum { __value = _Sp::__value || _Tp::__value }; enum { __value = bool(_Sp::__value) || bool(_Tp::__value) };
typedef typename __truth_type<__value>::__type __type; typedef typename __truth_type<__value>::__type __type;
}; };
......
...@@ -2212,10 +2212,10 @@ namespace std ...@@ -2212,10 +2212,10 @@ namespace std
__final_insertion_sort(_RandomAccessIterator __first, __final_insertion_sort(_RandomAccessIterator __first,
_RandomAccessIterator __last) _RandomAccessIterator __last)
{ {
if (__last - __first > _S_threshold) if (__last - __first > int(_S_threshold))
{ {
std::__insertion_sort(__first, __first + _S_threshold); std::__insertion_sort(__first, __first + int(_S_threshold));
std::__unguarded_insertion_sort(__first + _S_threshold, __last); std::__unguarded_insertion_sort(__first + int(_S_threshold), __last);
} }
else else
std::__insertion_sort(__first, __last); std::__insertion_sort(__first, __last);
...@@ -2231,10 +2231,10 @@ namespace std ...@@ -2231,10 +2231,10 @@ namespace std
__final_insertion_sort(_RandomAccessIterator __first, __final_insertion_sort(_RandomAccessIterator __first,
_RandomAccessIterator __last, _Compare __comp) _RandomAccessIterator __last, _Compare __comp)
{ {
if (__last - __first > _S_threshold) if (__last - __first > int(_S_threshold))
{ {
std::__insertion_sort(__first, __first + _S_threshold, __comp); std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
std::__unguarded_insertion_sort(__first + _S_threshold, __last, std::__unguarded_insertion_sort(__first + int(_S_threshold), __last,
__comp); __comp);
} }
else else
...@@ -2481,7 +2481,7 @@ namespace std ...@@ -2481,7 +2481,7 @@ namespace std
typedef typename iterator_traits<_RandomAccessIterator>::value_type typedef typename iterator_traits<_RandomAccessIterator>::value_type
_ValueType; _ValueType;
while (__last - __first > _S_threshold) while (__last - __first > int(_S_threshold))
{ {
if (__depth_limit == 0) if (__depth_limit == 0)
{ {
...@@ -2517,7 +2517,7 @@ namespace std ...@@ -2517,7 +2517,7 @@ namespace std
typedef typename iterator_traits<_RandomAccessIterator>::value_type typedef typename iterator_traits<_RandomAccessIterator>::value_type
_ValueType; _ValueType;
while (__last - __first > _S_threshold) while (__last - __first > int(_S_threshold))
{ {
if (__depth_limit == 0) if (__depth_limit == 0)
{ {
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
namespace _GLIBCXX_STD namespace _GLIBCXX_STD
{ {
typedef unsigned long _Bit_type; typedef unsigned long _Bit_type;
enum _S_word_bit_enum { _S_word_bit = int(CHAR_BIT * sizeof(_Bit_type)) }; enum { _S_word_bit = int(CHAR_BIT * sizeof(_Bit_type)) };
struct _Bit_reference struct _Bit_reference
{ {
...@@ -117,7 +117,7 @@ namespace _GLIBCXX_STD ...@@ -117,7 +117,7 @@ namespace _GLIBCXX_STD
void void
_M_bump_up() _M_bump_up()
{ {
if (_M_offset++ == _S_word_bit - 1) if (_M_offset++ == int(_S_word_bit) - 1)
{ {
_M_offset = 0; _M_offset = 0;
++_M_p; ++_M_p;
...@@ -129,7 +129,7 @@ namespace _GLIBCXX_STD ...@@ -129,7 +129,7 @@ namespace _GLIBCXX_STD
{ {
if (_M_offset-- == 0) if (_M_offset-- == 0)
{ {
_M_offset = _S_word_bit - 1; _M_offset = int(_S_word_bit) - 1;
--_M_p; --_M_p;
} }
} }
...@@ -138,11 +138,11 @@ namespace _GLIBCXX_STD ...@@ -138,11 +138,11 @@ namespace _GLIBCXX_STD
_M_incr(ptrdiff_t __i) _M_incr(ptrdiff_t __i)
{ {
difference_type __n = __i + _M_offset; difference_type __n = __i + _M_offset;
_M_p += __n / _S_word_bit; _M_p += __n / int(_S_word_bit);
__n = __n % _S_word_bit; __n = __n % int(_S_word_bit);
if (__n < 0) if (__n < 0)
{ {
_M_offset = static_cast<unsigned int>(__n + _S_word_bit); _M_offset = static_cast<unsigned int>(__n + int(_S_word_bit));
--_M_p; --_M_p;
} }
else else
...@@ -180,7 +180,8 @@ namespace _GLIBCXX_STD ...@@ -180,7 +180,8 @@ namespace _GLIBCXX_STD
inline ptrdiff_t inline ptrdiff_t
operator-(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) operator-(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y)
{ {
return _S_word_bit * (__x._M_p - __y._M_p) + __x._M_offset - __y._M_offset; return (int(_S_word_bit) * (__x._M_p - __y._M_p)
+ __x._M_offset - __y._M_offset);
} }
struct _Bit_iterator : public _Bit_iterator_base struct _Bit_iterator : public _Bit_iterator_base
...@@ -384,7 +385,8 @@ namespace _GLIBCXX_STD ...@@ -384,7 +385,8 @@ namespace _GLIBCXX_STD
_Bit_type* _Bit_type*
_M_allocate(size_t __n) _M_allocate(size_t __n)
{ return _M_impl.allocate((__n + _S_word_bit - 1) / _S_word_bit); } { return _M_impl.allocate((__n + int(_S_word_bit) - 1)
/ int(_S_word_bit)); }
void void
_M_deallocate() _M_deallocate()
...@@ -452,8 +454,8 @@ template<typename _Alloc> ...@@ -452,8 +454,8 @@ template<typename _Alloc>
{ {
_Bit_type* __q = this->_M_allocate(__n); _Bit_type* __q = this->_M_allocate(__n);
this->_M_impl._M_end_of_storage = (__q this->_M_impl._M_end_of_storage = (__q
+ ((__n + _S_word_bit - 1) + ((__n + int(_S_word_bit) - 1)
/ _S_word_bit)); / int(_S_word_bit)));
this->_M_impl._M_start = iterator(__q, 0); this->_M_impl._M_start = iterator(__q, 0);
this->_M_impl._M_finish = this->_M_impl._M_start + difference_type(__n); this->_M_impl._M_finish = this->_M_impl._M_start + difference_type(__n);
} }
...@@ -477,8 +479,9 @@ template<typename _Alloc> ...@@ -477,8 +479,9 @@ template<typename _Alloc>
*__i++ = __x; *__i++ = __x;
this->_M_impl._M_finish = std::copy(__position, end(), __i); this->_M_impl._M_finish = std::copy(__position, end(), __i);
this->_M_deallocate(); this->_M_deallocate();
this->_M_impl._M_end_of_storage = (__q + ((__len + _S_word_bit - 1) this->_M_impl._M_end_of_storage = (__q + ((__len
/ _S_word_bit)); + int(_S_word_bit) - 1)
/ int(_S_word_bit)));
this->_M_impl._M_start = iterator(__q, 0); this->_M_impl._M_start = iterator(__q, 0);
} }
} }
...@@ -543,8 +546,9 @@ template<typename _Alloc> ...@@ -543,8 +546,9 @@ template<typename _Alloc>
this->_M_impl._M_finish = std::copy(__position, end(), __i); this->_M_impl._M_finish = std::copy(__position, end(), __i);
this->_M_deallocate(); this->_M_deallocate();
this->_M_impl._M_end_of_storage = (__q this->_M_impl._M_end_of_storage = (__q
+ ((__len + _S_word_bit - 1) + ((__len
/ _S_word_bit)); + int(_S_word_bit) - 1)
/ int(_S_word_bit)));
this->_M_impl._M_start = iterator(__q, 0); this->_M_impl._M_start = iterator(__q, 0);
} }
} }
...@@ -782,8 +786,8 @@ template<typename _Alloc> ...@@ -782,8 +786,8 @@ template<typename _Alloc>
iterator(__q, 0)); iterator(__q, 0));
this->_M_deallocate(); this->_M_deallocate();
this->_M_impl._M_start = iterator(__q, 0); this->_M_impl._M_start = iterator(__q, 0);
this->_M_impl._M_end_of_storage = (__q + (__n + _S_word_bit - 1) this->_M_impl._M_end_of_storage = (__q + (__n + int(_S_word_bit) - 1)
/ _S_word_bit); / int(_S_word_bit));
} }
} }
...@@ -888,8 +892,9 @@ template<typename _Alloc> ...@@ -888,8 +892,9 @@ template<typename _Alloc>
this->_M_impl._M_finish = std::copy(__position, end(), this->_M_impl._M_finish = std::copy(__position, end(),
__i + difference_type(__n)); __i + difference_type(__n));
this->_M_deallocate(); this->_M_deallocate();
this->_M_impl._M_end_of_storage = (__q + ((__len + _S_word_bit - 1) this->_M_impl._M_end_of_storage = (__q + ((__len
/ _S_word_bit)); + int(_S_word_bit) - 1)
/ int(_S_word_bit)));
this->_M_impl._M_start = iterator(__q, 0); this->_M_impl._M_start = iterator(__q, 0);
} }
} }
......
// Debug-mode error formatting implementation -*- C++ -*- // Debug-mode error formatting implementation -*- C++ -*-
// Copyright (C) 2003, 2004 // Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
// Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -310,7 +309,7 @@ namespace __gnu_debug ...@@ -310,7 +309,7 @@ namespace __gnu_debug
const _Error_formatter& const _Error_formatter&
_M_iterator(const _Iterator& __it, const char* __name = 0) const _M_iterator(const _Iterator& __it, const char* __name = 0) const
{ {
if (_M_num_parameters < __max_parameters) if (_M_num_parameters < size_t(__max_parameters))
_M_parameters[_M_num_parameters++] = _Parameter(__it, __name, _M_parameters[_M_num_parameters++] = _Parameter(__it, __name,
_Is_iterator()); _Is_iterator());
return *this; return *this;
...@@ -319,7 +318,7 @@ namespace __gnu_debug ...@@ -319,7 +318,7 @@ namespace __gnu_debug
const _Error_formatter& const _Error_formatter&
_M_integer(long __value, const char* __name = 0) const _M_integer(long __value, const char* __name = 0) const
{ {
if (_M_num_parameters < __max_parameters) if (_M_num_parameters < size_t(__max_parameters))
_M_parameters[_M_num_parameters++] = _Parameter(__value, __name); _M_parameters[_M_num_parameters++] = _Parameter(__value, __name);
return *this; return *this;
} }
...@@ -327,7 +326,7 @@ namespace __gnu_debug ...@@ -327,7 +326,7 @@ namespace __gnu_debug
const _Error_formatter& const _Error_formatter&
_M_string(const char* __value, const char* __name = 0) const _M_string(const char* __value, const char* __name = 0) const
{ {
if (_M_num_parameters < __max_parameters) if (_M_num_parameters < size_t(__max_parameters))
_M_parameters[_M_num_parameters++] = _Parameter(__value, __name); _M_parameters[_M_num_parameters++] = _Parameter(__value, __name);
return *this; return *this;
} }
...@@ -336,7 +335,7 @@ namespace __gnu_debug ...@@ -336,7 +335,7 @@ namespace __gnu_debug
const _Error_formatter& const _Error_formatter&
_M_sequence(const _Sequence& __seq, const char* __name = 0) const _M_sequence(const _Sequence& __seq, const char* __name = 0) const
{ {
if (_M_num_parameters < __max_parameters) if (_M_num_parameters < size_t(__max_parameters))
_M_parameters[_M_num_parameters++] = _Parameter(__seq, __name, _M_parameters[_M_num_parameters++] = _Parameter(__seq, __name,
_Is_sequence()); _Is_sequence());
return *this; return *this;
......
...@@ -503,7 +503,7 @@ namespace __gnu_cxx ...@@ -503,7 +503,7 @@ namespace __gnu_cxx
static _Tune _S_tune(__align, sizeof(_Tp) * 64, static _Tune _S_tune(__align, sizeof(_Tp) * 64,
sizeof(_Tp) * 2 >= __align ? sizeof(_Tp) * 2 sizeof(_Tp) * 2 >= __align ? sizeof(_Tp) * 2
: __align, : __align,
sizeof(_Tp) * _Tune::_S_chunk_size, sizeof(_Tp) * size_t(_Tune::_S_chunk_size),
_Tune::_S_max_threads, _Tune::_S_max_threads,
_Tune::_S_freelist_headroom, _Tune::_S_freelist_headroom,
getenv("GLIBCXX_FORCE_NEW") ? true : false); getenv("GLIBCXX_FORCE_NEW") ? true : false);
...@@ -549,7 +549,7 @@ namespace __gnu_cxx ...@@ -549,7 +549,7 @@ namespace __gnu_cxx
static _Tune _S_tune(__align, sizeof(_Tp) * 64, static _Tune _S_tune(__align, sizeof(_Tp) * 64,
sizeof(_Tp) * 2 >= __align ? sizeof(_Tp) * 2 sizeof(_Tp) * 2 >= __align ? sizeof(_Tp) * 2
: __align, : __align,
sizeof(_Tp) * _Tune::_S_chunk_size, sizeof(_Tp) * size_t(_Tune::_S_chunk_size),
_Tune::_S_max_threads, _Tune::_S_max_threads,
_Tune::_S_freelist_headroom, _Tune::_S_freelist_headroom,
getenv("GLIBCXX_FORCE_NEW") ? true : false); getenv("GLIBCXX_FORCE_NEW") ? true : false);
......
...@@ -80,7 +80,7 @@ namespace __gnu_cxx ...@@ -80,7 +80,7 @@ namespace __gnu_cxx
enum { _S_align = 8 }; enum { _S_align = 8 };
enum { _S_max_bytes = 128 }; enum { _S_max_bytes = 128 };
enum { _S_free_list_size = _S_max_bytes / _S_align }; enum { _S_free_list_size = (size_t)_S_max_bytes / (size_t)_S_align };
union _Obj union _Obj
{ {
......
...@@ -676,8 +676,8 @@ protected: ...@@ -676,8 +676,8 @@ protected:
return __size_with_eos; return __size_with_eos;
#else #else
// Allow slop for in-place expansion. // Allow slop for in-place expansion.
return ((__size_with_eos + _S_alloc_granularity - 1) return ((__size_with_eos + size_t(_S_alloc_granularity) - 1)
&~ (_S_alloc_granularity - 1)); &~ (size_t(_S_alloc_granularity) - 1));
#endif #endif
} }
__GC_CONST _CharT* _M_data; /* Not necessarily 0 terminated. */ __GC_CONST _CharT* _M_data; /* Not necessarily 0 terminated. */
...@@ -1998,7 +1998,7 @@ protected: ...@@ -1998,7 +1998,7 @@ protected:
size_type size_type
max_size() const max_size() const
{ {
return _S_min_len[_Rope_constants::_S_max_rope_depth - 1] - 1; return _S_min_len[int(_Rope_constants::_S_max_rope_depth) - 1] - 1;
// Guarantees that the result can be sufficirntly // Guarantees that the result can be sufficirntly
// balanced. Longer ropes will probably still work, // balanced. Longer ropes will probably still work,
// but it's harder to make guarantees. // but it's harder to make guarantees.
......
...@@ -116,7 +116,7 @@ namespace __gnu_cxx ...@@ -116,7 +116,7 @@ namespace __gnu_cxx
_Rope_iterator_base<_CharT, _Alloc>:: _Rope_iterator_base<_CharT, _Alloc>::
_S_setcache(_Rope_iterator_base<_CharT, _Alloc>& __x) _S_setcache(_Rope_iterator_base<_CharT, _Alloc>& __x)
{ {
const _RopeRep* __path[_Rope_constants::_S_max_rope_depth + 1]; const _RopeRep* __path[int(_Rope_constants::_S_max_rope_depth) + 1];
const _RopeRep* __curr_rope; const _RopeRep* __curr_rope;
int __curr_depth = -1; /* index into path */ int __curr_depth = -1; /* index into path */
size_t __curr_start_pos = 0; size_t __curr_start_pos = 0;
...@@ -175,7 +175,7 @@ namespace __gnu_cxx ...@@ -175,7 +175,7 @@ namespace __gnu_cxx
// Copy last section of path into _M_path_end. // Copy last section of path into _M_path_end.
{ {
int __i = -1; int __i = -1;
int __j = __curr_depth + 1 - _S_path_cache_len; int __j = __curr_depth + 1 - int(_S_path_cache_len);
if (__j < 0) __j = 0; if (__j < 0) __j = 0;
while (__j <= __curr_depth) while (__j <= __curr_depth)
...@@ -236,10 +236,10 @@ namespace __gnu_cxx ...@@ -236,10 +236,10 @@ namespace __gnu_cxx
while (_Rope_constants::_S_concat == __current_node->_M_tag) while (_Rope_constants::_S_concat == __current_node->_M_tag)
{ {
++__current_index; ++__current_index;
if (_S_path_cache_len == __current_index) if (int(_S_path_cache_len) == __current_index)
{ {
int __i; int __i;
for (__i = 0; __i < _S_path_cache_len-1; __i++) for (__i = 0; __i < int(_S_path_cache_len) - 1; __i++)
__x._M_path_end[__i] = __x._M_path_end[__i+1]; __x._M_path_end[__i] = __x._M_path_end[__i+1];
--__current_index; --__current_index;
} }
...@@ -500,8 +500,9 @@ namespace __gnu_cxx ...@@ -500,8 +500,9 @@ namespace __gnu_cxx
get_allocator()); get_allocator());
size_t __depth = __result->_M_depth; size_t __depth = __result->_M_depth;
if (__depth > 20 && (__result->_M_size < 1000 if (__depth > 20
|| __depth > _Rope_constants::_S_max_rope_depth)) && (__result->_M_size < 1000
|| __depth > size_t(_Rope_constants::_S_max_rope_depth)))
{ {
_RopeRep* __balanced; _RopeRep* __balanced;
...@@ -540,7 +541,7 @@ namespace __gnu_cxx ...@@ -540,7 +541,7 @@ namespace __gnu_cxx
return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen,
__r->get_allocator()); __r->get_allocator());
if (_Rope_constants::_S_leaf == __r->_M_tag if (_Rope_constants::_S_leaf == __r->_M_tag
&& __r->_M_size + __slen <= _S_copy_max) && __r->_M_size + __slen <= size_t(_S_copy_max))
{ {
__result = _S_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen); __result = _S_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen);
return __result; return __result;
...@@ -551,7 +552,7 @@ namespace __gnu_cxx ...@@ -551,7 +552,7 @@ namespace __gnu_cxx
{ {
_RopeLeaf* __right = _RopeLeaf* __right =
(_RopeLeaf* )(((_RopeConcatenation* )__r)->_M_right); (_RopeLeaf* )(((_RopeConcatenation* )__r)->_M_right);
if (__right->_M_size + __slen <= _S_copy_max) if (__right->_M_size + __slen <= size_t(_S_copy_max))
{ {
_RopeRep* __left = ((_RopeConcatenation*)__r)->_M_left; _RopeRep* __left = ((_RopeConcatenation*)__r)->_M_left;
_RopeRep* __nright = _RopeRep* __nright =
...@@ -603,7 +604,7 @@ namespace __gnu_cxx ...@@ -603,7 +604,7 @@ namespace __gnu_cxx
__r->_M_ref_count = 2; // One more than before __r->_M_ref_count = 2; // One more than before
return __r; return __r;
} }
if (__orig_size + __slen <= _S_copy_max if (__orig_size + __slen <= size_t(_S_copy_max)
&& _Rope_constants::_S_leaf == __r->_M_tag) && _Rope_constants::_S_leaf == __r->_M_tag)
{ {
__result = _S_destr_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __result = _S_destr_leaf_concat_char_iter((_RopeLeaf*)__r, __s,
...@@ -615,7 +616,7 @@ namespace __gnu_cxx ...@@ -615,7 +616,7 @@ namespace __gnu_cxx
_RopeLeaf* __right = (_RopeLeaf*)(((_RopeConcatenation*) _RopeLeaf* __right = (_RopeLeaf*)(((_RopeConcatenation*)
__r)->_M_right); __r)->_M_right);
if (_Rope_constants::_S_leaf == __right->_M_tag if (_Rope_constants::_S_leaf == __right->_M_tag
&& __right->_M_size + __slen <= _S_copy_max) && __right->_M_size + __slen <= size_t(_S_copy_max))
{ {
_RopeRep* __new_right = _RopeRep* __new_right =
_S_destr_leaf_concat_char_iter(__right, __s, __slen); _S_destr_leaf_concat_char_iter(__right, __s, __slen);
...@@ -668,7 +669,7 @@ namespace __gnu_cxx ...@@ -668,7 +669,7 @@ namespace __gnu_cxx
{ {
if (_Rope_constants::_S_leaf == __left->_M_tag) if (_Rope_constants::_S_leaf == __left->_M_tag)
{ {
if (__right->_M_size + __left->_M_size <= _S_copy_max) if (__right->_M_size + __left->_M_size <= size_t(_S_copy_max))
return _S_leaf_concat_char_iter((_RopeLeaf*)__left, return _S_leaf_concat_char_iter((_RopeLeaf*)__left,
((_RopeLeaf*)__right)->_M_data, ((_RopeLeaf*)__right)->_M_data,
__right->_M_size); __right->_M_size);
...@@ -679,7 +680,8 @@ namespace __gnu_cxx ...@@ -679,7 +680,8 @@ namespace __gnu_cxx
{ {
_RopeLeaf* __leftright = _RopeLeaf* __leftright =
(_RopeLeaf*)(((_RopeConcatenation*)__left)->_M_right); (_RopeLeaf*)(((_RopeConcatenation*)__left)->_M_right);
if (__leftright->_M_size + __right->_M_size <= _S_copy_max) if (__leftright->_M_size
+ __right->_M_size <= size_t(_S_copy_max))
{ {
_RopeRep* __leftleft = ((_RopeConcatenation*)__left)->_M_left; _RopeRep* __leftleft = ((_RopeConcatenation*)__left)->_M_left;
_RopeRep* __rest = _S_leaf_concat_char_iter(__leftright, _RopeRep* __rest = _S_leaf_concat_char_iter(__leftright,
...@@ -1184,7 +1186,7 @@ namespace __gnu_cxx ...@@ -1184,7 +1186,7 @@ namespace __gnu_cxx
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
const unsigned long const unsigned long
rope<_CharT, _Alloc>:: rope<_CharT, _Alloc>::
_S_min_len[_Rope_constants::_S_max_rope_depth + 1] = { _S_min_len[int(_Rope_constants::_S_max_rope_depth) + 1] = {
/* 0 */1, /* 1 */2, /* 2 */3, /* 3 */5, /* 4 */8, /* 5 */13, /* 6 */21, /* 0 */1, /* 1 */2, /* 2 */3, /* 3 */5, /* 4 */8, /* 5 */13, /* 6 */21,
/* 7 */34, /* 8 */55, /* 9 */89, /* 10 */144, /* 11 */233, /* 12 */377, /* 7 */34, /* 8 */55, /* 9 */89, /* 10 */144, /* 11 */233, /* 12 */377,
/* 13 */610, /* 14 */987, /* 15 */1597, /* 16 */2584, /* 17 */4181, /* 13 */610, /* 14 */987, /* 15 */1597, /* 16 */2584, /* 17 */4181,
...@@ -1203,7 +1205,7 @@ namespace __gnu_cxx ...@@ -1203,7 +1205,7 @@ namespace __gnu_cxx
rope<_CharT, _Alloc>:: rope<_CharT, _Alloc>::
_S_balance(_RopeRep* __r) _S_balance(_RopeRep* __r)
{ {
_RopeRep* __forest[_Rope_constants::_S_max_rope_depth + 1]; _RopeRep* __forest[int(_Rope_constants::_S_max_rope_depth) + 1];
_RopeRep* __result = 0; _RopeRep* __result = 0;
int __i; int __i;
// Invariant: // Invariant:
...@@ -1212,12 +1214,12 @@ namespace __gnu_cxx ...@@ -1212,12 +1214,12 @@ namespace __gnu_cxx
// __forest[__i]._M_depth = __i // __forest[__i]._M_depth = __i
// References from forest are included in refcount. // References from forest are included in refcount.
for (__i = 0; __i <= _Rope_constants::_S_max_rope_depth; ++__i) for (__i = 0; __i <= int(_Rope_constants::_S_max_rope_depth); ++__i)
__forest[__i] = 0; __forest[__i] = 0;
try try
{ {
_S_add_to_forest(__r, __forest); _S_add_to_forest(__r, __forest);
for (__i = 0; __i <= _Rope_constants::_S_max_rope_depth; ++__i) for (__i = 0; __i <= int(_Rope_constants::_S_max_rope_depth); ++__i)
if (0 != __forest[__i]) if (0 != __forest[__i])
{ {
#ifndef __GC #ifndef __GC
...@@ -1232,12 +1234,12 @@ namespace __gnu_cxx ...@@ -1232,12 +1234,12 @@ namespace __gnu_cxx
} }
catch(...) catch(...)
{ {
for(__i = 0; __i <= _Rope_constants::_S_max_rope_depth; __i++) for(__i = 0; __i <= int(_Rope_constants::_S_max_rope_depth); __i++)
_S_unref(__forest[__i]); _S_unref(__forest[__i]);
__throw_exception_again; __throw_exception_again;
} }
if (__result->_M_depth > _Rope_constants::_S_max_rope_depth) if (__result->_M_depth > int(_Rope_constants::_S_max_rope_depth))
__throw_length_error(__N("rope::_S_balance")); __throw_length_error(__N("rope::_S_balance"));
return(__result); return(__result);
} }
...@@ -1305,7 +1307,7 @@ namespace __gnu_cxx ...@@ -1305,7 +1307,7 @@ namespace __gnu_cxx
__forest[__i]->_M_unref_nonnil(); __forest[__i]->_M_unref_nonnil();
__forest[__i] = 0; __forest[__i] = 0;
} }
if (__i == _Rope_constants::_S_max_rope_depth if (__i == int(_Rope_constants::_S_max_rope_depth)
|| __insertee->_M_size < _S_min_len[__i+1]) || __insertee->_M_size < _S_min_len[__i+1])
{ {
__forest[__i] = __insertee; __forest[__i] = __insertee;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment