Reverted changes to STLPort so compilation with NDK r4b should be supported again
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# If SDL_Mixer should link to libMAD
|
||||
# If SDL_Mixer should link to GPL-polluted libMAD (TODO: move this out of here)
|
||||
SDL_MIXER_USE_LIBMAD :=
|
||||
ifneq ($(strip $(filter mad, $(COMPILED_LIBRARIES))),)
|
||||
SDL_MIXER_USE_LIBMAD := 1
|
||||
@@ -12,19 +12,18 @@ endif
|
||||
ifneq ($(filter r5, $(NDK_VERSION)),)
|
||||
$(error Your NDK $(NDK_VERSION) generates invalid code, please use NDK r4b or r5b from http://developer.android.com)
|
||||
endif
|
||||
|
||||
|
||||
ifneq ($(findstring -crystax,$(NDK_VERSION)),)
|
||||
$(info Building with CrystaX toolchain - RTTI and exceptions enabled, STLPort disabled)
|
||||
CRYSTAX_TOOLCHAIN = 1
|
||||
endif
|
||||
ifneq ($(findstring r5b,$(NDK_VERSION)),)
|
||||
$(info Building with NDK r5b)
|
||||
NDK_R5_TOOLCHAIN = 1
|
||||
endif
|
||||
ifeq ($(NDK_VERSION)-,-)
|
||||
$(info Cannot determine NDK version, assuming NDK r5b - please do not rename NDK directory extracted from archive to avoid errors in the future)
|
||||
NDK_R5_TOOLCHAIN = 1
|
||||
NDK_VERSION := r5b
|
||||
endif
|
||||
|
||||
ifneq ($(findstring -crystax,$(NDK_VERSION)),)
|
||||
$(info Building with CrystaX toolchain - internal STLPort disabled)
|
||||
CRYSTAX_TOOLCHAIN := 1
|
||||
endif
|
||||
ifneq ($(findstring r5b,$(NDK_VERSION)),)
|
||||
$(info Building with NDK r5b - internal STLPort disabled)
|
||||
NDK_R5_TOOLCHAIN := 1
|
||||
endif
|
||||
|
||||
include $(call all-subdir-makefiles)
|
||||
|
||||
@@ -1 +1 @@
|
||||
openttd
|
||||
dosbox
|
||||
@@ -139,9 +139,7 @@ underflow_error::~underflow_error() _STLP_NOTHROW_INHERENTLY {}
|
||||
|
||||
#if !defined(_STLP_WCE_EVC3)
|
||||
# if defined (_STLP_NO_BAD_ALLOC)
|
||||
# ifndef ANDROID
|
||||
const nothrow_t nothrow /* = {} */;
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
#include "stlport_prefix.h"
|
||||
|
||||
#include <typeinfo>
|
||||
#include <hash_map>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -547,7 +547,7 @@ _OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
|
||||
_OutputIter __out_ite, const _Distance __n) {
|
||||
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
|
||||
_Distance __remaining = distance(__first, __last);
|
||||
_Distance __m = (_STLP_STD_NAME::min) (__n, __remaining);
|
||||
_Distance __m = (min) (__n, __remaining);
|
||||
|
||||
while (__m > 0) {
|
||||
if (_STLP_PRIV __random_number(__remaining) < __m) {
|
||||
@@ -570,7 +570,7 @@ _OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
|
||||
_RandomNumberGenerator& __rand) {
|
||||
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
|
||||
_Distance __remaining = distance(__first, __last);
|
||||
_Distance __m = (_STLP_STD_NAME::min) (__n, __remaining);
|
||||
_Distance __m = (min) (__n, __remaining);
|
||||
|
||||
while (__m > 0) {
|
||||
if (__rand(__remaining) < __m) {
|
||||
@@ -1035,7 +1035,7 @@ void __merge_sort_loop(_RandomAccessIter1 __first,
|
||||
__comp);
|
||||
__first += __two_step;
|
||||
}
|
||||
__step_size = (_STLP_STD_NAME::min) (_Distance(__last - __first), __step_size);
|
||||
__step_size = (min) (_Distance(__last - __first), __step_size);
|
||||
|
||||
merge(__first, __first + __step_size,
|
||||
__first + __step_size, __last,
|
||||
|
||||
@@ -539,7 +539,7 @@ lexicographical_compare(const unsigned char* __first1,
|
||||
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
|
||||
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
|
||||
|
||||
const int __result = memcmp(__first1, __first2, (_STLP_STD_NAME::min) (__len1, __len2));
|
||||
const int __result = memcmp(__first1, __first2, (min) (__len1, __len2));
|
||||
return __result != 0 ? (__result < 0) : (__len1 < __len2);
|
||||
}
|
||||
|
||||
@@ -570,7 +570,7 @@ __lexicographical_compare_3way(const unsigned char* __first1,
|
||||
const unsigned char* __last2) {
|
||||
const ptrdiff_t __len1 = __last1 - __first1;
|
||||
const ptrdiff_t __len2 = __last2 - __first2;
|
||||
const int __result = memcmp(__first1, __first2, (_STLP_STD_NAME::min) (__len1, __len2));
|
||||
const int __result = memcmp(__first1, __first2, (min) (__len1, __len2));
|
||||
return __result != 0 ? __result
|
||||
: (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1));
|
||||
}
|
||||
|
||||
@@ -638,7 +638,7 @@ public:
|
||||
#endif
|
||||
reset();
|
||||
size_t __tmp = _Nb;
|
||||
const size_t __Nbits = (_STLP_STD_NAME::min) (__tmp, (min) (__n, __s.size() - __pos));
|
||||
const size_t __Nbits = (min) (__tmp, (min) (__n, __s.size() - __pos));
|
||||
for ( size_t __i= 0; __i < __Nbits; ++__i) {
|
||||
typename _Traits::int_type __k = _Traits::to_int_type(__s[__pos + __Nbits - __i - 1]);
|
||||
// boris : widen() ?
|
||||
|
||||
@@ -456,7 +456,7 @@ protected:
|
||||
this->_M_finish += difference_type(__n);
|
||||
}
|
||||
else {
|
||||
size_type __len = size() + (_STLP_STD_NAME::max)(size(), __n);
|
||||
size_type __len = size() + (max)(size(), __n);
|
||||
unsigned int* __q = this->_M_bit_alloc(__len);
|
||||
iterator __i = copy(begin(), __position, iterator(__q, 0));
|
||||
__i = copy(__first, __last, __i);
|
||||
@@ -723,7 +723,7 @@ public:
|
||||
this->_M_finish += __n;
|
||||
}
|
||||
else {
|
||||
size_type __len = size() + (_STLP_STD_NAME::max)(size(), __n);
|
||||
size_type __len = size() + (max)(size(), __n);
|
||||
unsigned int* __q = this->_M_bit_alloc(__len);
|
||||
iterator __i = copy(begin(), __position, iterator(__q, 0));
|
||||
__i = copy(__first, __last, __i);
|
||||
@@ -744,7 +744,7 @@ public:
|
||||
this->_M_finish += __n;
|
||||
}
|
||||
else {
|
||||
size_type __len = size() + (_STLP_STD_NAME::max)(size(), __n);
|
||||
size_type __len = size() + (max)(size(), __n);
|
||||
unsigned int* __q = this->_M_bit_alloc(__len);
|
||||
iterator __i = copy(begin(), __position, iterator(__q, 0));
|
||||
__i = copy(__first, __last, __i);
|
||||
@@ -765,7 +765,7 @@ public:
|
||||
this->_M_finish += difference_type(__n);
|
||||
}
|
||||
else {
|
||||
size_type __len = size() + (_STLP_STD_NAME::max)(size(), __n);
|
||||
size_type __len = size() + (max)(size(), __n);
|
||||
unsigned int* __q = this->_M_bit_alloc(__len);
|
||||
iterator __i = copy(begin(), __position, iterator(__q, 0));
|
||||
fill_n(__i, __n, __x);
|
||||
|
||||
@@ -142,7 +142,7 @@ protected:
|
||||
const extern_type* __from,
|
||||
const extern_type* __end,
|
||||
size_t __max) const
|
||||
{ return (int)(_STLP_STD_NAME::min) ( __STATIC_CAST(size_t, (__end - __from)), __max); }
|
||||
{ return (int)(min) ( __STATIC_CAST(size_t, (__end - __from)), __max); }
|
||||
|
||||
virtual int do_max_length() const _STLP_NOTHROW
|
||||
{ return 1; }
|
||||
|
||||
@@ -49,8 +49,11 @@ namespace std {
|
||||
|
||||
#ifdef _STLP_IMPORT_VENDOR_CSTD
|
||||
_STLP_BEGIN_NAMESPACE
|
||||
# if !defined (ANDROID)
|
||||
// these types don't exist on Android
|
||||
using _STLP_VENDOR_CSTD::div_t;
|
||||
using _STLP_VENDOR_CSTD::ldiv_t;
|
||||
# endif
|
||||
using _STLP_VENDOR_CSTD::size_t;
|
||||
|
||||
# ifndef _STLP_NO_CSTD_FUNCTION_IMPORTS
|
||||
@@ -58,10 +61,13 @@ using _STLP_VENDOR_CSTD::size_t;
|
||||
// these functions just don't exist on Windows CE
|
||||
using _STLP_VENDOR_CSTD::abort;
|
||||
using _STLP_VENDOR_CSTD::getenv;
|
||||
# if !defined (ANDROID)
|
||||
// these functions don't exist on Android
|
||||
using _STLP_VENDOR_CSTD::mblen;
|
||||
using _STLP_VENDOR_CSTD::mbtowc;
|
||||
using _STLP_VENDOR_CSTD::system;
|
||||
using _STLP_VENDOR_CSTD::bsearch;
|
||||
# endif
|
||||
# endif
|
||||
using _STLP_VENDOR_CSTD::atexit;
|
||||
using _STLP_VENDOR_CSTD::exit;
|
||||
@@ -72,7 +78,10 @@ using _STLP_VENDOR_CSTD::realloc;
|
||||
using _STLP_VENDOR_CSTD::atof;
|
||||
using _STLP_VENDOR_CSTD::atoi;
|
||||
using _STLP_VENDOR_CSTD::atol;
|
||||
# if !defined (ANDROID)
|
||||
// this function doesn't exist on Android
|
||||
using _STLP_VENDOR_CSTD::mbstowcs;
|
||||
# endif
|
||||
using _STLP_VENDOR_CSTD::strtod;
|
||||
using _STLP_VENDOR_CSTD::strtol;
|
||||
using _STLP_VENDOR_CSTD::strtoul;
|
||||
|
||||
@@ -48,7 +48,7 @@ template <class _Tp, class _Alloc >
|
||||
void _Deque_base<_Tp,_Alloc>::_M_initialize_map(size_t __num_elements) {
|
||||
size_t __num_nodes = __num_elements / this->buffer_size() + 1 ;
|
||||
|
||||
_M_map_size._M_data = (_STLP_STD_NAME::max)((size_t) _S_initial_map_size, __num_nodes + 2);
|
||||
_M_map_size._M_data = (max)((size_t) _S_initial_map_size, __num_nodes + 2);
|
||||
_M_map._M_data = _M_map.allocate(_M_map_size._M_data);
|
||||
|
||||
_Tp** __nstart = _M_map._M_data + (_M_map_size._M_data - __num_nodes) / 2;
|
||||
@@ -778,7 +778,7 @@ void deque<_Tp,_Alloc>::_M_reallocate_map(size_type __nodes_to_add,
|
||||
}
|
||||
else {
|
||||
size_type __new_map_size =
|
||||
this->_M_map_size._M_data + (_STLP_STD_NAME::max)((size_t)this->_M_map_size._M_data, __nodes_to_add) + 2;
|
||||
this->_M_map_size._M_data + (max)((size_t)this->_M_map_size._M_data, __nodes_to_add) + 2;
|
||||
|
||||
_Map_pointer __new_map = this->_M_map.allocate(__new_map_size);
|
||||
__new_nstart = __new_map + (__new_map_size - __new_num_nodes) / 2
|
||||
|
||||
@@ -28,6 +28,10 @@
|
||||
#ifndef _STLP_INTERNAL_EXCEPTION
|
||||
#define _STLP_INTERNAL_EXCEPTION
|
||||
|
||||
#if defined(ANDROID) || defined(__ANDROID__)
|
||||
# define _STLP_NO_EXCEPTION_HEADER 1
|
||||
#endif
|
||||
|
||||
#if !defined (_STLP_NO_EXCEPTION_HEADER)
|
||||
|
||||
# if defined ( _UNCAUGHT_EXCEPTION )
|
||||
|
||||
@@ -623,7 +623,7 @@ bool basic_filebuf<_CharT, _Traits>::_M_allocate_buffers(_CharT* __buf, streamsi
|
||||
_M_int_buf_dynamic = false;
|
||||
}
|
||||
|
||||
streamsize __ebufsiz = (_STLP_STD_NAME::max)(__n * __STATIC_CAST(streamsize, _M_width),
|
||||
streamsize __ebufsiz = (max)(__n * __STATIC_CAST(streamsize, _M_width),
|
||||
__STATIC_CAST(streamsize, _M_codecvt->max_length()));
|
||||
_M_ext_buf = 0;
|
||||
if ((sizeof(streamsize) < sizeof(size_t)) ||
|
||||
@@ -708,7 +708,7 @@ void basic_filebuf<_CharT, _Traits>::_M_setup_codecvt(const locale& __loc, bool
|
||||
_M_codecvt = &use_facet<_Codecvt>(__loc) ;
|
||||
int __encoding = _M_codecvt->encoding();
|
||||
|
||||
_M_width = (_STLP_STD_NAME::max)(__encoding, 1);
|
||||
_M_width = (max)(__encoding, 1);
|
||||
_M_max_width = _M_codecvt->max_length();
|
||||
_M_constant_width = __encoding > 0;
|
||||
_M_always_noconv = _M_codecvt->always_noconv();
|
||||
|
||||
@@ -354,7 +354,7 @@ void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
|
||||
//Here if max_load_factor is lower than 1.0 the resulting value might not be representable
|
||||
//as a size_type. The result concerning the respect of the max_load_factor will then be
|
||||
//undefined.
|
||||
__num_buckets_hint = (_STLP_STD_NAME::max) (__num_buckets_hint, (size_type)((float)size() / max_load_factor()));
|
||||
__num_buckets_hint = (max) (__num_buckets_hint, (size_type)((float)size() / max_load_factor()));
|
||||
size_type __num_buckets = _STLP_PRIV _Stl_prime_type::_S_next_size(__num_buckets_hint);
|
||||
_M_rehash(__num_buckets);
|
||||
}
|
||||
@@ -368,7 +368,7 @@ void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
|
||||
return;
|
||||
}
|
||||
|
||||
size_type __num_buckets_hint = (size_type)((float)(_STLP_STD_NAME::max) (__num_elements_hint, size()) / max_load_factor());
|
||||
size_type __num_buckets_hint = (size_type)((float)(max) (__num_elements_hint, size()) / max_load_factor());
|
||||
size_type __num_buckets = _STLP_PRIV _Stl_prime_type::_S_next_size(__num_buckets_hint);
|
||||
#if defined (_STLP_DEBUG)
|
||||
_M_check();
|
||||
|
||||
@@ -649,10 +649,10 @@ __read_buffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT,
|
||||
//is larger than ptrdiff_t one.
|
||||
_STLP_STATIC_ASSERT(((sizeof(streamsize) > sizeof(ptrdiff_t)) ||
|
||||
(sizeof(streamsize) == sizeof(ptrdiff_t))) && numeric_limits<ptrdiff_t>::is_signed)
|
||||
ptrdiff_t __request = __STATIC_CAST(ptrdiff_t, (_STLP_STD_NAME::min) (__STATIC_CAST(streamsize, (numeric_limits<ptrdiff_t>::max)()), _Num - __n));
|
||||
ptrdiff_t __request = __STATIC_CAST(ptrdiff_t, (min) (__STATIC_CAST(streamsize, (numeric_limits<ptrdiff_t>::max)()), _Num - __n));
|
||||
|
||||
const _CharT* __p = __scan_delim(__first, __last);
|
||||
ptrdiff_t __chunk = (_STLP_STD_NAME::min) (ptrdiff_t(__p - __first), __request);
|
||||
ptrdiff_t __chunk = (min) (ptrdiff_t(__p - __first), __request);
|
||||
_Traits::copy(__s, __first, __chunk);
|
||||
__s += __chunk;
|
||||
__n += __chunk;
|
||||
@@ -829,13 +829,13 @@ basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __nmax) {
|
||||
|
||||
if (__buf->gptr() != __buf->egptr())
|
||||
_M_gcount
|
||||
= _STLP_PRIV __read_buffered(this, __buf, (_STLP_STD_NAME::min) (__avail, __nmax), __s,
|
||||
= _STLP_PRIV __read_buffered(this, __buf, (min) (__avail, __nmax), __s,
|
||||
_STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
|
||||
_STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
|
||||
false, false, false);
|
||||
else
|
||||
_M_gcount
|
||||
= _STLP_PRIV __read_unbuffered(this, __buf, (_STLP_STD_NAME::min) (__avail, __nmax), __s,
|
||||
= _STLP_PRIV __read_unbuffered(this, __buf, (min) (__avail, __nmax), __s,
|
||||
_STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
|
||||
false, false, false);
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ __copy_integer_and_fill(const _CharT* __buf, ptrdiff_t __len,
|
||||
//is larger than ptrdiff_t one.
|
||||
_STLP_STATIC_ASSERT(((sizeof(streamsize) > sizeof(ptrdiff_t)) ||
|
||||
(sizeof(streamsize) == sizeof(ptrdiff_t))) && numeric_limits<ptrdiff_t>::is_signed)
|
||||
ptrdiff_t __pad = __STATIC_CAST(ptrdiff_t, (_STLP_STD_NAME::min) (__STATIC_CAST(streamsize, (numeric_limits<ptrdiff_t>::max)()),
|
||||
ptrdiff_t __pad = __STATIC_CAST(ptrdiff_t, (min) (__STATIC_CAST(streamsize, (numeric_limits<ptrdiff_t>::max)()),
|
||||
__STATIC_CAST(streamsize, __wid - __len)));
|
||||
ios_base::fmtflags __dir = __flg & ios_base::adjustfield;
|
||||
|
||||
|
||||
@@ -803,13 +803,13 @@ bool _S_apply_to_pieces(_CharConsumer& __c,
|
||||
_RopeRep* __left = __conc->_M_left;
|
||||
size_t __left_len = __left->_M_size._M_data;
|
||||
if (__begin < __left_len) {
|
||||
size_t __left_end = (_STLP_STD_NAME::min) (__left_len, __end);
|
||||
size_t __left_end = (min) (__left_len, __end);
|
||||
if (!_S_apply_to_pieces(__c, __left, __begin, __left_end))
|
||||
return false;
|
||||
}
|
||||
if (__end > __left_len) {
|
||||
_RopeRep* __right = __conc->_M_right;
|
||||
size_t __right_start = (_STLP_STD_NAME::max)(__left_len, __begin);
|
||||
size_t __right_start = (max)(__left_len, __begin);
|
||||
if (!_S_apply_to_pieces(__c, __right,
|
||||
__right_start - __left_len,
|
||||
__end - __left_len)) {
|
||||
|
||||
@@ -493,7 +493,7 @@ public:
|
||||
typedef typename _RopeRep::allocator_type allocator_type;
|
||||
_Rope_RopeConcatenation(_RopeRep* __l, _RopeRep* __r, allocator_type __a)
|
||||
: _Rope_RopeRep<_CharT,_Alloc>(_RopeRep::_S_concat,
|
||||
(_STLP_STD_NAME::max)(__l->_M_depth, __r->_M_depth) + 1, false,
|
||||
(max)(__l->_M_depth, __r->_M_depth) + 1, false,
|
||||
__l->_M_size._M_data + __r->_M_size._M_data, __a), _M_left(__l), _M_right(__r)
|
||||
{}
|
||||
# ifdef _STLP_NO_ARROW_OPERATOR
|
||||
|
||||
@@ -258,7 +258,7 @@ basic_stringbuf<_CharT, _Traits, _Alloc>::_M_xsputnc(char_type __c,
|
||||
}
|
||||
|
||||
// At this point we know we're appending.
|
||||
size_t __app_size = sizeof(streamsize) > sizeof(size_t) ? __STATIC_CAST(size_t, (_STLP_STD_NAME::min)(__n, __STATIC_CAST(streamsize, _M_str.max_size())))
|
||||
size_t __app_size = sizeof(streamsize) > sizeof(size_t) ? __STATIC_CAST(size_t, (min)(__n, __STATIC_CAST(streamsize, _M_str.max_size())))
|
||||
: __STATIC_CAST(size_t, __n);
|
||||
if (this->_M_mode & ios_base::in) {
|
||||
ptrdiff_t __get_offset = this->gptr() - this->eback();
|
||||
@@ -308,7 +308,7 @@ basic_stringbuf<_CharT, _Traits, _Alloc>::setbuf(_CharT*, streamsize __n) {
|
||||
if ((_M_mode & ios_base::out) && !(_M_mode & ios_base::in))
|
||||
_M_append_buffer();
|
||||
|
||||
_M_str.reserve(sizeof(streamsize) > sizeof(size_t) ? __STATIC_CAST(size_t, (_STLP_STD_NAME::min)(__n, __STATIC_CAST(streamsize, _M_str.max_size())))
|
||||
_M_str.reserve(sizeof(streamsize) > sizeof(size_t) ? __STATIC_CAST(size_t, (min)(__n, __STATIC_CAST(streamsize, _M_str.max_size())))
|
||||
: __STATIC_CAST(size_t, __n));
|
||||
|
||||
_CharT* __data_ptr = __CONST_CAST(_CharT*, _M_str.data());
|
||||
|
||||
@@ -57,7 +57,7 @@ basic_streambuf<_CharT, _Traits>::xsgetn(_CharT* __s, streamsize __n) {
|
||||
|
||||
while (__result < __n) {
|
||||
if (_M_gnext < _M_gend) {
|
||||
size_t __chunk = (_STLP_STD_NAME::min) (__STATIC_CAST(size_t,_M_gend - _M_gnext),
|
||||
size_t __chunk = (min) (__STATIC_CAST(size_t,_M_gend - _M_gnext),
|
||||
__STATIC_CAST(size_t,__n - __result));
|
||||
_Traits::copy(__s, _M_gnext, __chunk);
|
||||
__result += __chunk;
|
||||
@@ -88,7 +88,7 @@ basic_streambuf<_CharT, _Traits>::xsputn(const _CharT* __s, streamsize __n)
|
||||
|
||||
while (__result < __n) {
|
||||
if (_M_pnext < _M_pend) {
|
||||
size_t __chunk = (_STLP_STD_NAME::min) (__STATIC_CAST(size_t,_M_pend - _M_pnext),
|
||||
size_t __chunk = (min) (__STATIC_CAST(size_t,_M_pend - _M_pnext),
|
||||
__STATIC_CAST(size_t,__n - __result));
|
||||
_Traits::copy(_M_pnext, __s, __chunk);
|
||||
__result += __chunk;
|
||||
@@ -116,7 +116,7 @@ basic_streambuf<_CharT, _Traits>::_M_xsputnc(_CharT __c, streamsize __n)
|
||||
|
||||
while (__result < __n) {
|
||||
if (_M_pnext < _M_pend) {
|
||||
size_t __chunk = (_STLP_STD_NAME::min) (__STATIC_CAST(size_t,_M_pend - _M_pnext),
|
||||
size_t __chunk = (min) (__STATIC_CAST(size_t,_M_pend - _M_pnext),
|
||||
__STATIC_CAST(size_t,__n - __result));
|
||||
_Traits::assign(_M_pnext, __chunk, __c);
|
||||
__result += __chunk;
|
||||
|
||||
@@ -84,7 +84,7 @@ void basic_string<_CharT,_Traits,_Alloc>::reserve(size_type __res_arg) {
|
||||
if (__res_arg > max_size())
|
||||
this->_M_throw_length_error();
|
||||
|
||||
size_type __n = (_STLP_STD_NAME::max)(__res_arg, size()) + 1;
|
||||
size_type __n = (max)(__res_arg, size()) + 1;
|
||||
if (__n <= capacity() + 1)
|
||||
return;
|
||||
|
||||
@@ -109,7 +109,7 @@ basic_string<_CharT,_Traits,_Alloc>::append(size_type __n, _CharT __c) {
|
||||
if (__n > max_size() || size() > max_size() - __n)
|
||||
this->_M_throw_length_error();
|
||||
if (size() + __n > capacity())
|
||||
reserve(size() + (_STLP_STD_NAME::max)(size(), __n));
|
||||
reserve(size() + (max)(size(), __n));
|
||||
if (__n > 0) {
|
||||
#if defined (_STLP_USE_SHORT_STRING_OPTIM)
|
||||
if (this->_M_using_static_buf())
|
||||
@@ -136,7 +136,7 @@ basic_string<_CharT, _Traits, _Alloc>::_M_append(const _CharT* __first, const _C
|
||||
if ((size_type)__n > max_size() || __old_size > max_size() - __n)
|
||||
this->_M_throw_length_error();
|
||||
if (__old_size + __n > capacity()) {
|
||||
size_type __len = __old_size + (_STLP_STD_NAME::max)(__old_size, (size_t) __n) + 1;
|
||||
size_type __len = __old_size + (max)(__old_size, (size_t) __n) + 1;
|
||||
pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
|
||||
pointer __new_finish = __new_start;
|
||||
_STLP_TRY {
|
||||
@@ -217,7 +217,7 @@ _CharT* basic_string<_CharT,_Traits,_Alloc> ::_M_insert_aux(_CharT* __p,
|
||||
}
|
||||
else {
|
||||
const size_type __old_len = size();
|
||||
size_type __len = __old_len + (_STLP_STD_NAME::max)(__old_len, __STATIC_CAST(size_type,1)) + 1;
|
||||
size_type __len = __old_len + (max)(__old_len, __STATIC_CAST(size_type,1)) + 1;
|
||||
pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
|
||||
pointer __new_finish = __new_start;
|
||||
_STLP_TRY {
|
||||
@@ -279,7 +279,7 @@ void basic_string<_CharT,_Traits,_Alloc>::insert(iterator __pos,
|
||||
}
|
||||
else {
|
||||
const size_type __old_size = size();
|
||||
size_type __len = __old_size + (_STLP_STD_NAME::max)(__old_size, __n) + 1;
|
||||
size_type __len = __old_size + (max)(__old_size, __n) + 1;
|
||||
pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
|
||||
pointer __new_finish = __new_start;
|
||||
_STLP_TRY {
|
||||
@@ -362,7 +362,7 @@ void basic_string<_CharT,_Traits,_Alloc>::_M_insert(iterator __pos,
|
||||
}
|
||||
else {
|
||||
const size_type __old_size = size();
|
||||
size_type __len = __old_size + (_STLP_STD_NAME::max)(__old_size, __STATIC_CAST(const size_type,__n)) + 1;
|
||||
size_type __len = __old_size + (max)(__old_size, __STATIC_CAST(const size_type,__n)) + 1;
|
||||
pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
|
||||
pointer __new_finish = __new_start;
|
||||
_STLP_TRY {
|
||||
@@ -472,7 +472,7 @@ basic_string<_CharT,_Traits,_Alloc>::rfind(const _CharT* __s, size_type __pos, s
|
||||
if ( __len < __n ) {
|
||||
return npos;
|
||||
}
|
||||
const_pointer __last = this->_M_Start() + (_STLP_STD_NAME::min)( __len - __n, __pos) + __n;
|
||||
const_pointer __last = this->_M_Start() + (min)( __len - __n, __pos) + __n;
|
||||
const_pointer __result = find_end(this->_M_Start(), __last,
|
||||
__s, __s + __n, _STLP_PRIV _Eq_traits<_Traits>());
|
||||
return __result != __last ? __result - this->_M_Start() : npos;
|
||||
@@ -486,7 +486,7 @@ basic_string<_CharT,_Traits,_Alloc>::rfind(_CharT __c, size_type __pos) const
|
||||
if ( __len < 1 ) {
|
||||
return npos;
|
||||
}
|
||||
const_iterator __last = begin() + (_STLP_STD_NAME::min)(__len - 1, __pos) + 1;
|
||||
const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
|
||||
const_reverse_iterator __rresult =
|
||||
_STLP_STD::find_if(const_reverse_iterator(__last), rend(),
|
||||
_STLP_PRIV _Eq_char_bound<_Traits>(__c));
|
||||
@@ -515,7 +515,7 @@ basic_string<_CharT,_Traits,_Alloc> ::find_last_of(const _CharT* __s, size_type
|
||||
if ( __len < 1 ) {
|
||||
return npos;
|
||||
}
|
||||
const const_iterator __last = begin() + (_STLP_STD_NAME::min)(__len - 1, __pos) + 1;
|
||||
const const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
|
||||
const const_reverse_iterator __rresult =
|
||||
_STLP_PRIV __find_first_of(const_reverse_iterator(__last), rend(),
|
||||
__s, __s + __n,
|
||||
@@ -558,7 +558,7 @@ basic_string<_CharT,_Traits,_Alloc>::find_last_not_of(const _CharT* __s, size_ty
|
||||
if ( __len < 1 ) {
|
||||
return npos;
|
||||
}
|
||||
const_iterator __last = begin() + (_STLP_STD_NAME::min)(__len - 1, __pos) + 1;
|
||||
const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
|
||||
const_reverse_iterator __rlast = const_reverse_iterator(__last);
|
||||
const_reverse_iterator __rresult =
|
||||
_STLP_STD::find_if(__rlast, rend(),
|
||||
@@ -575,7 +575,7 @@ basic_string<_CharT, _Traits, _Alloc>::find_last_not_of(_CharT __c, size_type __
|
||||
if ( __len < 1 ) {
|
||||
return npos;
|
||||
}
|
||||
const_iterator __last = begin() + (_STLP_STD_NAME::min)(__len - 1, __pos) + 1;
|
||||
const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
|
||||
const_reverse_iterator __rlast = const_reverse_iterator(__last);
|
||||
const_reverse_iterator __rresult =
|
||||
_STLP_STD::find_if(__rlast, rend(),
|
||||
@@ -591,7 +591,7 @@ template <class _CharT, class _Traits, class _Alloc>
|
||||
void _STLP_CALL _S_string_copy(const basic_string<_CharT,_Traits,_Alloc>& __s,
|
||||
_CharT* __buf, size_t __n) {
|
||||
if (__n > 0) {
|
||||
__n = (_STLP_STD_NAME::min) (__n - 1, __s.size());
|
||||
__n = (min) (__n - 1, __s.size());
|
||||
_STLP_STD::copy(__s.begin(), __s.begin() + __n, __buf);
|
||||
__buf[__n] = _CharT();
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ public: // Constructor, destructor, assignment.
|
||||
this->_M_throw_out_of_range();
|
||||
else
|
||||
_M_range_initialize(__s._M_Start() + __pos,
|
||||
__s._M_Start() + __pos + (_STLP_STD_NAME::min) (__n, __s.size() - __pos));
|
||||
__s._M_Start() + __pos + (min) (__n, __s.size() - __pos));
|
||||
}
|
||||
basic_string(const _Self& __s, size_type __pos, size_type __n,
|
||||
const allocator_type& __a)
|
||||
@@ -208,7 +208,7 @@ public: // Constructor, destructor, assignment.
|
||||
this->_M_throw_out_of_range();
|
||||
else
|
||||
_M_range_initialize(__s._M_Start() + __pos,
|
||||
__s._M_Start() + __pos + (_STLP_STD_NAME::min) (__n, __s.size() - __pos));
|
||||
__s._M_Start() + __pos + (min) (__n, __s.size() - __pos));
|
||||
}
|
||||
|
||||
#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
|
||||
@@ -549,7 +549,7 @@ private: // Helper functions for append.
|
||||
if (__STATIC_CAST(size_type,__n) > this->max_size() || __old_size > this->max_size() - __STATIC_CAST(size_type,__n))
|
||||
this->_M_throw_length_error();
|
||||
if (__old_size + __n > this->capacity()) {
|
||||
size_type __len = __old_size + (_STLP_STD_NAME::max)(__old_size, __STATIC_CAST(size_type,__n)) + 1;
|
||||
size_type __len = __old_size + (max)(__old_size, __STATIC_CAST(size_type,__n)) + 1;
|
||||
pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
|
||||
pointer __new_finish = __new_start;
|
||||
_STLP_TRY {
|
||||
@@ -624,7 +624,7 @@ public:
|
||||
if (__pos > __s.size())
|
||||
this->_M_throw_out_of_range();
|
||||
return _M_append(__s._M_Start() + __pos,
|
||||
__s._M_Start() + __pos + (_STLP_STD_NAME::min) (__n, __s.size() - __pos));
|
||||
__s._M_Start() + __pos + (min) (__n, __s.size() - __pos));
|
||||
}
|
||||
|
||||
_Self& append(const _CharT* __s, size_type __n)
|
||||
@@ -636,7 +636,7 @@ public:
|
||||
public:
|
||||
void push_back(_CharT __c) {
|
||||
if (this->_M_Finish() + 1 == this->_M_end_of_storage._M_data)
|
||||
reserve(size() + (_STLP_STD_NAME::max)(size(), __STATIC_CAST(size_type,1)));
|
||||
reserve(size() + (max)(size(), __STATIC_CAST(size_type,1)));
|
||||
_M_construct_null(this->_M_Finish() + 1);
|
||||
_Traits::assign(*(this->_M_Finish()), __c);
|
||||
++this->_M_finish;
|
||||
@@ -657,7 +657,7 @@ public: // Assign
|
||||
if (__pos > __s.size())
|
||||
this->_M_throw_out_of_range();
|
||||
return _M_assign(__s._M_Start() + __pos,
|
||||
__s._M_Start() + __pos + (_STLP_STD_NAME::min) (__n, __s.size() - __pos));
|
||||
__s._M_Start() + __pos + (min) (__n, __s.size() - __pos));
|
||||
}
|
||||
|
||||
_Self& assign(const _CharT* __s, size_type __n)
|
||||
@@ -731,7 +731,7 @@ public: // Insert
|
||||
size_type __beg, size_type __n) {
|
||||
if (__pos > size() || __beg > __s.size())
|
||||
this->_M_throw_out_of_range();
|
||||
size_type __len = (_STLP_STD_NAME::min) (__n, __s.size() - __beg);
|
||||
size_type __len = (min) (__n, __s.size() - __beg);
|
||||
if (size() > max_size() - __len)
|
||||
this->_M_throw_length_error();
|
||||
_M_insert(begin() + __pos,
|
||||
@@ -803,7 +803,7 @@ protected: // Helper functions for insert.
|
||||
void _M_insert_overflow(iterator __pos, _ForwardIter __first, _ForwardIter __last,
|
||||
difference_type __n) {
|
||||
const size_type __old_size = this->size();
|
||||
size_type __len = __old_size + (_STLP_STD_NAME::max)(__old_size, __STATIC_CAST(size_type,__n)) + 1;
|
||||
size_type __len = __old_size + (max)(__old_size, __STATIC_CAST(size_type,__n)) + 1;
|
||||
pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
|
||||
pointer __new_finish = __new_start;
|
||||
_STLP_TRY {
|
||||
@@ -954,7 +954,7 @@ public: // Erase.
|
||||
_Self& erase(size_type __pos = 0, size_type __n = npos) {
|
||||
if (__pos > size())
|
||||
this->_M_throw_out_of_range();
|
||||
erase(begin() + __pos, begin() + __pos + (_STLP_STD_NAME::min) (__n, size() - __pos));
|
||||
erase(begin() + __pos, begin() + __pos + (min) (__n, size() - __pos));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -982,7 +982,7 @@ public: // Replace. (Conceptually equivalent
|
||||
_Self& replace(size_type __pos, size_type __n, const _Self& __s) {
|
||||
if (__pos > size())
|
||||
this->_M_throw_out_of_range();
|
||||
const size_type __len = (_STLP_STD_NAME::min) (__n, size() - __pos);
|
||||
const size_type __len = (min) (__n, size() - __pos);
|
||||
if (size() - __len >= max_size() - __s.size())
|
||||
this->_M_throw_length_error();
|
||||
return _M_replace(begin() + __pos, begin() + __pos + __len,
|
||||
@@ -993,8 +993,8 @@ public: // Replace. (Conceptually equivalent
|
||||
size_type __pos2, size_type __n2) {
|
||||
if (__pos1 > size() || __pos2 > __s.size())
|
||||
this->_M_throw_out_of_range();
|
||||
const size_type __len1 = (_STLP_STD_NAME::min) (__n1, size() - __pos1);
|
||||
const size_type __len2 = (_STLP_STD_NAME::min) (__n2, __s.size() - __pos2);
|
||||
const size_type __len1 = (min) (__n1, size() - __pos1);
|
||||
const size_type __len2 = (min) (__n2, __s.size() - __pos2);
|
||||
if (size() - __len1 >= max_size() - __len2)
|
||||
this->_M_throw_length_error();
|
||||
return _M_replace(begin() + __pos1, begin() + __pos1 + __len1,
|
||||
@@ -1006,7 +1006,7 @@ public: // Replace. (Conceptually equivalent
|
||||
_STLP_FIX_LITERAL_BUG(__s)
|
||||
if (__pos > size())
|
||||
this->_M_throw_out_of_range();
|
||||
const size_type __len = (_STLP_STD_NAME::min) (__n1, size() - __pos);
|
||||
const size_type __len = (min) (__n1, size() - __pos);
|
||||
if (__n2 > max_size() || size() - __len >= max_size() - __n2)
|
||||
this->_M_throw_length_error();
|
||||
return _M_replace(begin() + __pos, begin() + __pos + __len,
|
||||
@@ -1017,7 +1017,7 @@ public: // Replace. (Conceptually equivalent
|
||||
_STLP_FIX_LITERAL_BUG(__s)
|
||||
if (__pos > size())
|
||||
this->_M_throw_out_of_range();
|
||||
const size_type __len = (_STLP_STD_NAME::min) (__n1, size() - __pos);
|
||||
const size_type __len = (min) (__n1, size() - __pos);
|
||||
const size_type __n2 = _Traits::length(__s);
|
||||
if (__n2 > max_size() || size() - __len >= max_size() - __n2)
|
||||
this->_M_throw_length_error();
|
||||
@@ -1029,7 +1029,7 @@ public: // Replace. (Conceptually equivalent
|
||||
size_type __n2, _CharT __c) {
|
||||
if (__pos > size())
|
||||
this->_M_throw_out_of_range();
|
||||
const size_type __len = (_STLP_STD_NAME::min) (__n1, size() - __pos);
|
||||
const size_type __len = (min) (__n1, size() - __pos);
|
||||
if (__n2 > max_size() || size() - __len >= max_size() - __n2)
|
||||
this->_M_throw_length_error();
|
||||
return replace(begin() + __pos, begin() + __pos + __len, __n2, __c);
|
||||
@@ -1158,7 +1158,7 @@ public: // Other modifier member functions.
|
||||
_STLP_FIX_LITERAL_BUG(__s)
|
||||
if (__pos > size())
|
||||
this->_M_throw_out_of_range();
|
||||
const size_type __len = (_STLP_STD_NAME::min) (__n, size() - __pos);
|
||||
const size_type __len = (min) (__n, size() - __pos);
|
||||
_Traits::copy(__s, this->_M_Start() + __pos, __len);
|
||||
return __len;
|
||||
}
|
||||
@@ -1268,7 +1268,7 @@ public: // Compare
|
||||
if (__pos1 > size())
|
||||
this->_M_throw_out_of_range();
|
||||
return _M_compare(this->_M_Start() + __pos1,
|
||||
this->_M_Start() + __pos1 + (_STLP_STD_NAME::min) (__n1, size() - __pos1),
|
||||
this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1),
|
||||
__s._M_Start(), __s._M_Finish());
|
||||
}
|
||||
|
||||
@@ -1278,9 +1278,9 @@ public: // Compare
|
||||
if (__pos1 > size() || __pos2 > __s.size())
|
||||
this->_M_throw_out_of_range();
|
||||
return _M_compare(this->_M_Start() + __pos1,
|
||||
this->_M_Start() + __pos1 + (_STLP_STD_NAME::min) (__n1, size() - __pos1),
|
||||
this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1),
|
||||
__s._M_Start() + __pos2,
|
||||
__s._M_Start() + __pos2 + (_STLP_STD_NAME::min) (__n2, __s.size() - __pos2));
|
||||
__s._M_Start() + __pos2 + (min) (__n2, __s.size() - __pos2));
|
||||
}
|
||||
|
||||
int compare(const _CharT* __s) const {
|
||||
@@ -1293,7 +1293,7 @@ public: // Compare
|
||||
if (__pos1 > size())
|
||||
this->_M_throw_out_of_range();
|
||||
return _M_compare(this->_M_Start() + __pos1,
|
||||
this->_M_Start() + __pos1 + (_STLP_STD_NAME::min) (__n1, size() - __pos1),
|
||||
this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1),
|
||||
__s, __s + _Traits::length(__s));
|
||||
}
|
||||
|
||||
@@ -1303,7 +1303,7 @@ public: // Compare
|
||||
if (__pos1 > size())
|
||||
this->_M_throw_out_of_range();
|
||||
return _M_compare(this->_M_Start() + __pos1,
|
||||
this->_M_Start() + __pos1 + (_STLP_STD_NAME::min) (__n1, size() - __pos1),
|
||||
this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1),
|
||||
__s, __s + __n2);
|
||||
}
|
||||
|
||||
@@ -1313,7 +1313,7 @@ public: // Helper functions for compare.
|
||||
const _CharT* __f2, const _CharT* __l2) {
|
||||
const ptrdiff_t __n1 = __l1 - __f1;
|
||||
const ptrdiff_t __n2 = __l2 - __f2;
|
||||
const int cmp = _Traits::compare(__f1, __f2, (_STLP_STD_NAME::min) (__n1, __n2));
|
||||
const int cmp = _Traits::compare(__f1, __f2, (min) (__n1, __n2));
|
||||
return cmp != 0 ? cmp : (__n1 < __n2 ? -1 : (__n1 > __n2 ? 1 : 0));
|
||||
}
|
||||
#if defined (_STLP_USE_TEMPLATE_EXPRESSION) && !defined (_STLP_DEBUG) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
|
||||
|
||||
@@ -99,7 +99,7 @@ protected:
|
||||
size_t max_size() const {
|
||||
const size_type __string_max_size = size_type(-1) / sizeof(_Tp);
|
||||
typename allocator_type::size_type __alloc_max_size = _M_end_of_storage.max_size();
|
||||
return (_STLP_STD_NAME::min)(__alloc_max_size, __string_max_size) - 1;
|
||||
return (min)(__alloc_max_size, __string_max_size) - 1;
|
||||
}
|
||||
|
||||
_String_base(const allocator_type& __a)
|
||||
|
||||
@@ -29,12 +29,12 @@ public:
|
||||
basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
|
||||
size_type __pos, size_type __n = npos,
|
||||
const allocator_type& __a = allocator_type())
|
||||
: _STLP_STRING_SUM_BASE(_Reserve_t(), (__pos <= __s.size()) ? ((_STLP_STD_NAME::min) (__n, __s.size() - __pos)) : 0, __a) {
|
||||
: _STLP_STRING_SUM_BASE(_Reserve_t(), (__pos <= __s.size()) ? ((min) (__n, __s.size() - __pos)) : 0, __a) {
|
||||
size_type __size = __s.size();
|
||||
if (__pos > __size)
|
||||
this->_M_throw_out_of_range();
|
||||
else
|
||||
_M_append_sum_pos(__s, __pos, (_STLP_STD_NAME::min) (__n, __size - __pos));
|
||||
_M_append_sum_pos(__s, __pos, (min) (__n, __size - __pos));
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -64,7 +64,7 @@ private:
|
||||
}
|
||||
_CharT* _M_append_fast_pos(_CharT const* __s, size_type __s_size, _CharT *__buf,
|
||||
size_type __pos, size_type __n)
|
||||
{ return uninitialized_copy(__s + __pos, __s + __pos + (_STLP_STD_NAME::min)(__n, __s_size - __pos), __buf); }
|
||||
{ return uninitialized_copy(__s + __pos, __s + __pos + (min)(__n, __s_size - __pos), __buf); }
|
||||
_CharT* _M_append_fast_pos(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _CharT *__buf,
|
||||
size_type __pos, size_type __n)
|
||||
{ return _M_append_fast_pos(__s.c_str(), __s.size(), __buf, __pos, __n); }
|
||||
@@ -124,7 +124,7 @@ private:
|
||||
this->_M_throw_length_error();
|
||||
size_type __offset_size = _M_get_additional_size(__old_size + __s_size, _Char_Is_POD());
|
||||
if (__old_size + __s_size + __offset_size > this->capacity()) {
|
||||
const size_type __len = __old_size + __offset_size + (_STLP_STD_NAME::max)(__old_size, __s_size) + 1;
|
||||
const size_type __len = __old_size + __offset_size + (max)(__old_size, __s_size) + 1;
|
||||
pointer __new_start = this->_M_end_of_storage.allocate(__len);
|
||||
pointer __new_finish = __new_start;
|
||||
_STLP_TRY {
|
||||
@@ -147,7 +147,7 @@ private:
|
||||
template <class _Left, class _Right, class _StorageDir>
|
||||
_Self& _M_append_sum_pos(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
|
||||
size_type __pos, size_type __n) {
|
||||
size_type __s_size = (_STLP_STD_NAME::min)(__s.size() - __pos, __n);
|
||||
size_type __s_size = (min)(__s.size() - __pos, __n);
|
||||
if (__s_size == 0)
|
||||
return *this;
|
||||
const size_type __old_size = this->size();
|
||||
@@ -155,7 +155,7 @@ private:
|
||||
this->_M_throw_length_error();
|
||||
size_type __offset_size = _M_get_additional_size(__old_size + __s_size, _Char_Is_POD());
|
||||
if (__old_size + __s_size + __offset_size > this->capacity()) {
|
||||
const size_type __len = __old_size + __offset_size + (_STLP_STD_NAME::max)(__old_size, __s_size) + 1;
|
||||
const size_type __len = __old_size + __offset_size + (max)(__old_size, __s_size) + 1;
|
||||
pointer __new_start = this->_M_end_of_storage.allocate(__len);
|
||||
pointer __new_finish = __new_start;
|
||||
_STLP_TRY {
|
||||
|
||||
@@ -239,7 +239,7 @@ private: // Helper functions for append.
|
||||
this->_M_throw_length_error();
|
||||
if (__old_size + __n > capacity()) {
|
||||
const size_type __len = __old_size +
|
||||
(_STLP_STD_NAME::max)(__old_size, __STATIC_CAST(size_type,__n)) + 1;
|
||||
(max)(__old_size, __STATIC_CAST(size_type,__n)) + 1;
|
||||
pointer __new_start = this->_M_end_of_storage.allocate(__len);
|
||||
pointer __new_finish = __new_start;
|
||||
_STLP_TRY {
|
||||
@@ -412,7 +412,7 @@ private: // Helper functions for insert.
|
||||
void _M_insert_overflow(iterator __position, _ForwardIter __first, _ForwardIter __last,
|
||||
difference_type __n) {
|
||||
const size_type __old_size = this->size();
|
||||
const size_type __len = __old_size + (_STLP_STD_NAME::max)(__old_size, __STATIC_CAST(size_type,__n)) + 1;
|
||||
const size_type __len = __old_size + (max)(__old_size, __STATIC_CAST(size_type,__n)) + 1;
|
||||
pointer __new_start = this->_M_end_of_storage.allocate(__len);
|
||||
pointer __new_finish = __new_start;
|
||||
_STLP_TRY {
|
||||
|
||||
@@ -83,7 +83,7 @@ template <class _Tp, class _Alloc>
|
||||
void vector<_Tp, _Alloc>::_M_insert_overflow_aux(pointer __pos, const _Tp& __x, const __false_type& /*DO NOT USE!!*/,
|
||||
size_type __fill_len, bool __atend ) {
|
||||
const size_type __old_size = size();
|
||||
size_type __len = __old_size + (_STLP_STD_NAME::max)(__old_size, __fill_len);
|
||||
size_type __len = __old_size + (max)(__old_size, __fill_len);
|
||||
|
||||
pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
|
||||
pointer __new_finish = __new_start;
|
||||
@@ -108,7 +108,7 @@ template <class _Tp, class _Alloc>
|
||||
void vector<_Tp, _Alloc>::_M_insert_overflow(pointer __pos, const _Tp& __x, const __true_type& /*_TrivialCopy*/,
|
||||
size_type __fill_len, bool __atend ) {
|
||||
const size_type __old_size = size();
|
||||
size_type __len = __old_size + (_STLP_STD_NAME::max)(__old_size, __fill_len);
|
||||
size_type __len = __old_size + (max)(__old_size, __fill_len);
|
||||
|
||||
pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
|
||||
pointer __new_finish = __STATIC_CAST(pointer, _STLP_PRIV __copy_trivial(this->_M_start, __pos, __new_start));
|
||||
|
||||
@@ -403,7 +403,7 @@ private:
|
||||
#endif /* _STLP_MEMBER_TEMPLATES */
|
||||
size_type __n) {
|
||||
const size_type __old_size = size();
|
||||
size_type __len = __old_size + (_STLP_STD_NAME::max)(__old_size, __n);
|
||||
size_type __len = __old_size + (max)(__old_size, __n);
|
||||
pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
|
||||
pointer __new_finish = __new_start;
|
||||
_STLP_TRY {
|
||||
|
||||
@@ -71,6 +71,8 @@ typedef off_t streamoff;
|
||||
# elif defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE) /* || defined(__USE_FILE_OFFSET64) */ \
|
||||
/* || (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) */ /* || defined (__sgi) && defined (_STLP_HAS_NO_NEW_C_HEADERS) */
|
||||
typedef off64_t streamoff;
|
||||
# elif defined(ANDROID)
|
||||
typedef long streamoff;
|
||||
# else
|
||||
typedef off_t streamoff;
|
||||
# endif
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
#define _STLP_PLATFORM "Android"
|
||||
|
||||
#include <features.h>
|
||||
|
||||
// The Android C library is mostly glibc-like
|
||||
#define _STLP_USE_GLIBC 1
|
||||
|
||||
@@ -12,24 +10,14 @@
|
||||
#define _STLP_UNIX 1
|
||||
|
||||
// No RTTI support.
|
||||
// #define _STLP_NO_TYPEINFO 1
|
||||
// #define _STLP_NO_RTTI 1
|
||||
#define _STLP_NO_TYPEINFO 1
|
||||
#define _STLP_NO_RTTI 1
|
||||
|
||||
// Have pthreads support.
|
||||
#define _PTHREADS
|
||||
#define _STLP_THREADS
|
||||
#define _STLP_PTHREADS
|
||||
|
||||
// Don't have native <cplusplus> headers
|
||||
// #define _STLP_HAS_NO_NEW_C_HEADERS 1
|
||||
// #define _STLP_USE_NEW_C_HEADERS 1
|
||||
// #define _STLP_NO_NEW_NEW_HEADER 1
|
||||
// #define _STLP_NO_NEW_HEADER 1
|
||||
// #define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
|
||||
// #define _STLP_NO_BAD_ALLOC 1
|
||||
// No <exception> headers
|
||||
// #define _STLP_NO_EXCEPTION_HEADER 1
|
||||
// #define _STLP_OWN_STDEXCEPT 1 // Already inside libsupc++, but we'll define it under different namespace
|
||||
#define _STLP_HAS_NO_NEW_C_HEADERS 1
|
||||
|
||||
// Don't use wchar.h etc
|
||||
#define _STLP_NO_WCHAR_T 1
|
||||
@@ -55,12 +43,15 @@
|
||||
// Little endian platform.
|
||||
#define _STLP_LITTLE_ENDIAN 1
|
||||
|
||||
// No <exception> headers
|
||||
#define _STLP_NO_EXCEPTION_HEADER 1
|
||||
|
||||
// No need to define our own namespace
|
||||
// #define _STLP_NO_OWN_NAMESPACE 1
|
||||
#define _STLP_NO_OWN_NAMESPACE 1
|
||||
|
||||
// Need this to define STLport's own bad_alloc class (which won't be
|
||||
// thrown in any case)
|
||||
// #define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
|
||||
#define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
|
||||
|
||||
#define _STLP_NO_LONG_DOUBLE 1
|
||||
|
||||
@@ -77,8 +68,8 @@
|
||||
|
||||
// Define how to include our native headers.
|
||||
#if defined(__ANDROID__) /* NDK r5 */
|
||||
# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../../../cxx-stl/gnu-libstdc++/include
|
||||
# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../../../cxx-stl/gnu-libstdc++/include
|
||||
# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../../../cxx-stl/system/include
|
||||
# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../../../cxx-stl/system/include
|
||||
//# warning ("Detected Android NDK r5 or newer")
|
||||
#else /* NDK r4b */
|
||||
# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../../usr/include
|
||||
|
||||
@@ -338,7 +338,7 @@ public:
|
||||
|
||||
_Self& assign(const _Self& __s, size_type __pos, size_type __n) {
|
||||
if (__pos < __s.size()) {
|
||||
_M_check_assign((_STLP_STD_NAME::min) (__n, __s.size() - __pos));
|
||||
_M_check_assign((min) (__n, __s.size() - __pos));
|
||||
}
|
||||
_M_non_dbg_impl.assign(__s._M_non_dbg_impl, __pos, __n);
|
||||
return *this;
|
||||
@@ -347,7 +347,7 @@ public:
|
||||
_Self& assign(const _CharT* __s, size_type __n) {
|
||||
_STLP_FIX_LITERAL_BUG(__s)
|
||||
_STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
|
||||
_M_check_assign((_STLP_STD_NAME::min) (_Traits::length(__s), __n));
|
||||
_M_check_assign((min) (_Traits::length(__s), __n));
|
||||
_M_non_dbg_impl.assign(__s, __s + __n);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -29,14 +29,14 @@
|
||||
basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
|
||||
size_type __pos, size_type __n = npos,
|
||||
const allocator_type& __a = allocator_type())
|
||||
: _M_non_dbg_impl(_Reserve_t(), (__pos <= __s.size()) ? ((_STLP_STD_NAME::min) (__n, __s.size() - __pos)) : 0, __a),
|
||||
: _M_non_dbg_impl(_Reserve_t(), (__pos <= __s.size()) ? ((min) (__n, __s.size() - __pos)) : 0, __a),
|
||||
_M_iter_list(&_M_non_dbg_impl) {
|
||||
size_type __size = __s.size();
|
||||
if (__pos > __size)
|
||||
//This call will generate the necessary out of range exception:
|
||||
_M_non_dbg_impl.at(0);
|
||||
else
|
||||
_M_append_sum_pos(__s, __pos, (_STLP_STD_NAME::min) (__n, __size - __pos), _M_non_dbg_impl);
|
||||
_M_append_sum_pos(__s, __pos, (min) (__n, __size - __pos), _M_non_dbg_impl);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -63,7 +63,7 @@ private:
|
||||
}
|
||||
_Base& _M_append_fast_pos(_CharT const* __s, size_type __s_size, _Base &__str,
|
||||
size_type __pos, size_type __n)
|
||||
{ return __str.append(__s + __pos, __s + __pos + (_STLP_STD_NAME::min)(__n, __s_size - __pos)); }
|
||||
{ return __str.append(__s + __pos, __s + __pos + (min)(__n, __s_size - __pos)); }
|
||||
_Base& _M_append_fast_pos(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _Base &__str,
|
||||
size_type __pos, size_type __n)
|
||||
{ return _M_append_fast_pos(__s.c_str(), __s.size(), __str, __pos, __n); }
|
||||
@@ -105,7 +105,7 @@ private:
|
||||
template <class _Left, class _Right, class _StorageDir>
|
||||
_Self& _M_append_sum_pos (_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
|
||||
size_type __pos, size_type __n, _Base &__impl) {
|
||||
_M_non_dbg_impl.reserve(_M_non_dbg_impl.size() + (_STLP_STD_NAME::min) (__s.size() - __pos, __n));
|
||||
_M_non_dbg_impl.reserve(_M_non_dbg_impl.size() + (min) (__s.size() - __pos, __n));
|
||||
_M_append_fast_pos(__s, __impl, __pos, __n);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -74,10 +74,7 @@ Then you can launch build.sh.
|
||||
|
||||
The NDK r4b has RTTI and exceptions disabled for C++ code, if you need them you may download modified NDK from
|
||||
http://www.crystax.net/android/ndk-r4.php - note however that you cannot throw exceptions across shared library boundary.
|
||||
The NDK r5b already has support for RTTI and exceptions.
|
||||
Unzip it, and put in your PATH instead of original NDK - do not rename the target dir, my makefiles will
|
||||
check if there's "crystax" string in path to gcc toolchain, and will disable STLPort because CrystaX NDK
|
||||
already contains STL library.
|
||||
The NDK r5b already has support for RTTI and exceptions, so you should use CrystaX NDK only if NDK r5b fails for you.
|
||||
STL imlpementations from NDK r5b and from CrystaX NDK will crash on x5a/x6d tablet, and possibly on Smartq V7,
|
||||
when you try to output anything to std::cout or std::cerr, the STLPort included in this port will not crash.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user