From 343458d9a693473dc04821d7482edbbabc25d61f Mon Sep 17 00:00:00 2001 From: pelya Date: Fri, 28 Jan 2011 14:38:24 +0000 Subject: [PATCH] Integrating with NDK r5: STLPort still does not compile --- build.sh | 2 +- project/jni/Android.mk | 6 +- .../openttd/AndroidAppSettings.cfg | 2 +- .../jni/application/openttd/AndroidBuild.sh | 4 +- project/jni/application/setEnvironment.sh | 71 ++++++++++--------- project/jni/application/src | 2 +- project/jni/stlport/Android.mk | 3 +- project/jni/stlport/src/dll_main.cpp | 2 + project/jni/stlport/src/facets_byname.cpp | 1 + project/jni/stlport/stlport/stl/_algo.c | 6 +- project/jni/stlport/stlport/stl/_algobase.h | 4 +- project/jni/stlport/stlport/stl/_bitset.h | 2 +- project/jni/stlport/stlport/stl/_bvector.h | 8 +-- project/jni/stlport/stlport/stl/_codecvt.h | 2 +- project/jni/stlport/stlport/stl/_cstdlib.h | 9 --- project/jni/stlport/stlport/stl/_deque.c | 4 +- project/jni/stlport/stlport/stl/_exception.h | 4 -- project/jni/stlport/stlport/stl/_fstream.c | 4 +- project/jni/stlport/stlport/stl/_hashtable.c | 4 +- project/jni/stlport/stlport/stl/_istream.c | 8 +-- project/jni/stlport/stlport/stl/_new.h | 7 ++ project/jni/stlport/stlport/stl/_num_put.c | 2 +- project/jni/stlport/stlport/stl/_rope.c | 4 +- project/jni/stlport/stlport/stl/_rope.h | 2 +- project/jni/stlport/stlport/stl/_sstream.c | 4 +- project/jni/stlport/stlport/stl/_streambuf.c | 6 +- project/jni/stlport/stlport/stl/_string.c | 24 +++---- project/jni/stlport/stlport/stl/_string.h | 44 ++++++------ .../jni/stlport/stlport/stl/_string_base.h | 2 +- .../stlport/stlport/stl/_string_sum_methods.h | 12 ++-- .../stlport/stlport/stl/_string_workaround.h | 4 +- project/jni/stlport/stlport/stl/_vector.c | 4 +- project/jni/stlport/stlport/stl/_vector.h | 2 +- project/jni/stlport/stlport/stl/char_traits.h | 2 - .../jni/stlport/stlport/stl/config/_android.h | 19 +++-- .../jni/stlport/stlport/stl/debug/_string.h | 4 +- .../stlport/stl/debug/_string_sum_methods.h | 8 +-- 37 files changed, 153 insertions(+), 145 deletions(-) diff --git a/build.sh b/build.sh index ec06509de..f3d3c17b2 100755 --- a/build.sh +++ b/build.sh @@ -15,5 +15,5 @@ if ( grep "package $AppFullName;" project/src/Globals.java > /dev/null && [ "`re touch project/src/Globals.java fi -cd project && env PATH=$NDKBUILDPATH nice -n19 ndk-build -j4 V=1 && ant `test -n "$1" && echo release || echo debug` && test -z "$1" && cd bin && adb install -r DemoActivity-debug.apk +cd project && env PATH=$NDKBUILDPATH nice -n19 ndk-build -j4 V=1 -k && ant `test -n "$1" && echo release || echo debug` && test -z "$1" && cd bin && adb install -r DemoActivity-debug.apk diff --git a/project/jni/Android.mk b/project/jni/Android.mk index fc473c203..7c2880956 100644 --- a/project/jni/Android.mk +++ b/project/jni/Android.mk @@ -7,10 +7,10 @@ endif NDK_VERSION := $(strip $(patsubst android-ndk-%,%,$(filter android-ndk-%, $(subst /, ,$(dir $(TARGET_CC)))))) $(info NDK version $(NDK_VERSION)) ifneq ($(filter r1 r2 r3 r4, $(NDK_VERSION)),) -$(error Your NDK $(NDK_VERSION) is too old, please download NDK r4b from http://developer.android.com ) +$(error Your NDK $(NDK_VERSION) is too old, please download NDK r4b or r5b from http://developer.android.com ) endif ifneq ($(filter r5, $(NDK_VERSION)),) -$(error Your NDK $(NDK_VERSION) generates invalid code, please download NDK r4b from http://developer.android.com or wait for NDK r5b release. Details: http://groups.google.com/group/android-ndk/browse_thread/thread/6b35728eec7ef52f/b57f52776842041d ) +$(error Your NDK $(NDK_VERSION) generates invalid code, please use NDK r4b or r5b from http://developer.android.com) endif @@ -18,7 +18,7 @@ ifneq ($(findstring -crystax,$(NDK_VERSION)),) $(info Building with CrystaX toolchain - RTTI and exceptions enabled, STLPort disabled) CRYSTAX_TOOLCHAIN = 1 endif -ifneq ($(findstring r5,$(NDK_VERSION)),) +ifneq ($(findstring r5b,$(NDK_VERSION)),) $(info Building with NDK r5) NDK_R5_TOOLCHAIN = 1 endif diff --git a/project/jni/application/openttd/AndroidAppSettings.cfg b/project/jni/application/openttd/AndroidAppSettings.cfg index 990fd79f8..b6478d7ba 100644 --- a/project/jni/application/openttd/AndroidAppSettings.cfg +++ b/project/jni/application/openttd/AndroidAppSettings.cfg @@ -29,6 +29,6 @@ CustomBuildScript=y AppCflags='' AppLdflags='' AppSubdirsBuild='' -AppUseCrystaXToolchain=y +AppUseCrystaXToolchain=n AppCmdline='openttd -d 3' ReadmeText='^You may press "Home" now - the data will be downloaded in background' diff --git a/project/jni/application/openttd/AndroidBuild.sh b/project/jni/application/openttd/AndroidBuild.sh index efdc0d0d1..10da91de7 100755 --- a/project/jni/application/openttd/AndroidBuild.sh +++ b/project/jni/application/openttd/AndroidBuild.sh @@ -16,6 +16,6 @@ if [ \! -f openttd/objs/lang/english.lng ] ; then fi if [ \! -f openttd/Makefile ] ; then - ../setEnvironment.sh sh -c "cd openttd && ./configure --host=arm-eabi --with-sdl --with-freetype=sdl-config --with-png --with-zlib --with-libtimidity=$LOCAL_PATH/../../../obj/local/armeabi/libtimidity.so --with-lzo2=$LOCAL_PATH/../../../obj/local/armeabi/liblzo2.so --prefix-dir='.' --data-dir='' --without-allegro --without-fontconfig --endian=LE" + ../setEnvironment.sh sh -c "cd openttd && ./configure --host=arm-linux-androideabi --with-sdl --with-freetype=sdl-config --with-png --with-zlib --with-libtimidity=$LOCAL_PATH/../../../obj/local/armeabi/libtimidity.so --with-lzo2=$LOCAL_PATH/../../../obj/local/armeabi/liblzo2.so --prefix-dir='.' --data-dir='' --without-allegro --without-fontconfig --endian=LE" fi -../setEnvironment.sh sh -c "cd openttd && make -j1 VERBOSE=1 STRIP='' LIBS='-lsdl-1.2 -llzo2 -lpng -ltimidity -lfreetype -lgcc -lz -lc -lstdc++'" && cp -f openttd/objs/release/openttd libapplication.so +../setEnvironment.sh sh -c "cd openttd && make -j1 VERBOSE=1 STRIP='' LIBS='-lsdl-1.2 -llzo2 -lpng -ltimidity -lfreetype -lstlport -lz -lc -lstdc++ -lsupc++'" && cp -f openttd/objs/release/openttd libapplication.so diff --git a/project/jni/application/setEnvironment.sh b/project/jni/application/setEnvironment.sh index a2800f3b0..c3f78a352 100755 --- a/project/jni/application/setEnvironment.sh +++ b/project/jni/application/setEnvironment.sh @@ -19,15 +19,18 @@ fi NDK=`which ndk-build` NDK=`dirname $NDK` -GCCVER=4.4.0 + +echo NDK $NDK +GCCPREFIX=arm-linux-androideabi +GCCVER=4.4.3 PLATFORMVER=android-8 LOCAL_PATH=`dirname $0` LOCAL_PATH=`cd $LOCAL_PATH && pwd` -STL_INCLUDE="-I$LOCAL_PATH/../stlport/stlport -fno-exceptions -fno-rtti" -STL_LIB="$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib/libstdc++.so $LOCAL_PATH/../../obj/local/armeabi/libstlport.a" -if [ -n "`echo $NDK | grep '[-]crystax'`" ] ; then - STL_INCLUDE="-fexceptions -frtti" - STL_LIB="-lstdc++" +echo LOCAL_PATH $LOCAL_PATH + +if [ -z "`echo $NDK | grep 'android-ndk-r5b'`" ] ; then + echo "The only supported NDK version is android-ndk-r5b, please download it from http://developer.android.com/" + exit 1 fi APP_MODULES=`grep 'APP_MODULES [:][=]' $LOCAL_PATH/../Settings.mk | sed 's@.*[=]\(.*\)@\1@'` @@ -45,38 +48,42 @@ echo $APP_MODULES | xargs -n 1 echo | while read LIB ; do done ) -CFLAGS="-I$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/include \ --fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums \ --D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID \ --Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -O2 \ --fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 \ --Wa,--noexecstack -DNDEBUG -g -D__sF=__SDL_fake_stdout \ --I$LOCAL_PATH/../sdl-1.2/include $STL_INCLUDE \ +CFLAGS="\ +-fexceptions -frtti \ +-fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi \ +-march=armv5te -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 \ +-I$NDK/platforms/$PLATFORMVER/arch-arm/usr/include -Wa,--noexecstack \ +-DANDROID -D__sF=__SDL_fake_stdout -DNDEBUG -O2 -g \ +-I$NDK/sources/cxx-stl/system/include \ +-I$NDK/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include \ +-I$LOCAL_PATH/../stlport/stlport \ +-I$LOCAL_PATH/../sdl-1.2/include \ `echo $APP_MODULES | sed \"s@\([-a-zA-Z0-9_.]\+\)@-I$LOCAL_PATH/../\1/include@g\"`" -LDFLAGS="-nostdlib -Wl,-soname,libapplication.so -Wl,-shared,-Bsymbolic \ --Wl,--whole-archive -Wl,--no-whole-archive \ -$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/lib/gcc/arm-eabi/4.4.0/libgcc.a \ +LDFLAGS="\ +-fexceptions -frtti \ +-Wl,-soname,libapplication.so -shared --sysroot=$NDK/platforms/$PLATFORMVER/arch-arm \ `echo $APP_SHARED_LIBS | sed \"s@\([-a-zA-Z0-9_.]\+\)@$LOCAL_PATH/../../obj/local/armeabi/lib\1.so@g\"` \ -$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib/libc.so \ -$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib/libm.so \ --Wl,--no-undefined -Wl,-z,noexecstack \ --L$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib \ +$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib/libc.so \ +$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib/libstdc++.so \ +$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib/libm.so \ +-L$LOCAL_PATH/../../obj/local/armeabi -Wl,--no-undefined -Wl,-z,noexecstack \ +-L$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib \ -lGLESv1_CM -ldl -llog -lz \ --Wl,-rpath-link=$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib \ --L$LOCAL_PATH/../../obj/local/armeabi $STL_LIB" +-Wl,-rpath-link=$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib -lsupc++ \ +-L$LOCAL_PATH/../../obj/local/armeabi $LOCAL_PATH/../../obj/local/armeabi/libstlport.a" -env PATH=$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin:$LOCAL_PATH:$PATH \ +env PATH=$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin:$LOCAL_PATH:$PATH \ CFLAGS="$CFLAGS" \ CXXFLAGS="$CFLAGS" \ LDFLAGS="$LDFLAGS" \ -CC="$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin/arm-eabi-gcc" \ -CXX="$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin/arm-eabi-g++" \ -RANLIB="$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin/arm-eabi-ranlib" \ -LD="$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin/arm-eabi-gcc" \ -AR="$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin/arm-eabi-ar" \ -CPP="$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin/arm-eabi-cpp $CFLAGS" \ -NM="$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin/arm-eabi-nm" \ -AS="$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin/arm-eabi-as" \ -STRIP="$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin/arm-eabi-strip" \ +CC="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-gcc" \ +CXX="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-g++" \ +RANLIB="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-ranlib" \ +LD="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-g++" \ +AR="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-ar" \ +CPP="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-cpp $CFLAGS" \ +NM="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-nm" \ +AS="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-as" \ +STRIP="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-strip" \ $@ diff --git a/project/jni/application/src b/project/jni/application/src index 92362c4db..550b7b622 120000 --- a/project/jni/application/src +++ b/project/jni/application/src @@ -1 +1 @@ -ufoai \ No newline at end of file +openttd \ No newline at end of file diff --git a/project/jni/stlport/Android.mk b/project/jni/stlport/Android.mk index 915f1db37..c9269dad2 100644 --- a/project/jni/stlport/Android.mk +++ b/project/jni/stlport/Android.mk @@ -8,7 +8,8 @@ ifneq ($(CRYSTAX_TOOLCHAIN),) LOCAL_CPP_EXTENSION := .cpp LOCAL_SRC_FILES := dummy.c else -LOCAL_CFLAGS := -O3 -I$(LOCAL_PATH)/stlport -I$(LOCAL_PATH)/src -DANDROID_NO_COUT=1 +LOCAL_CFLAGS := -O3 -I$(LOCAL_PATH)/stlport -I$(LOCAL_PATH)/src -DANDROID_NO_COUT=1 -frtti -fexceptions + LOCAL_CPP_EXTENSION := .cpp LOCAL_SRC_FILES := $(addprefix src/,$(notdir $(wildcard $(LOCAL_PATH)/src/*.cpp $(LOCAL_PATH)/src/*.c))) endif diff --git a/project/jni/stlport/src/dll_main.cpp b/project/jni/stlport/src/dll_main.cpp index ba5823954..56ae0f88a 100644 --- a/project/jni/stlport/src/dll_main.cpp +++ b/project/jni/stlport/src/dll_main.cpp @@ -139,7 +139,9 @@ 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 diff --git a/project/jni/stlport/src/facets_byname.cpp b/project/jni/stlport/src/facets_byname.cpp index 87255d0e6..ea888d1ff 100644 --- a/project/jni/stlport/src/facets_byname.cpp +++ b/project/jni/stlport/src/facets_byname.cpp @@ -17,6 +17,7 @@ */ #include "stlport_prefix.h" +#include #include #include diff --git a/project/jni/stlport/stlport/stl/_algo.c b/project/jni/stlport/stlport/stl/_algo.c index 79745ba0e..7568fbc23 100644 --- a/project/jni/stlport/stlport/stl/_algo.c +++ b/project/jni/stlport/stlport/stl/_algo.c @@ -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 = (min) (__n, __remaining); + _Distance __m = (_STLP_STD_NAME::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 = (min) (__n, __remaining); + _Distance __m = (_STLP_STD_NAME::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 = (min) (_Distance(__last - __first), __step_size); + __step_size = (_STLP_STD_NAME::min) (_Distance(__last - __first), __step_size); merge(__first, __first + __step_size, __first + __step_size, __last, diff --git a/project/jni/stlport/stlport/stl/_algobase.h b/project/jni/stlport/stlport/stl/_algobase.h index 6864223a7..2708bd429 100644 --- a/project/jni/stlport/stlport/stl/_algobase.h +++ b/project/jni/stlport/stlport/stl/_algobase.h @@ -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, (min) (__len1, __len2)); + const int __result = memcmp(__first1, __first2, (_STLP_STD_NAME::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, (min) (__len1, __len2)); + const int __result = memcmp(__first1, __first2, (_STLP_STD_NAME::min) (__len1, __len2)); return __result != 0 ? __result : (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1)); } diff --git a/project/jni/stlport/stlport/stl/_bitset.h b/project/jni/stlport/stlport/stl/_bitset.h index f894346a4..2be180534 100644 --- a/project/jni/stlport/stlport/stl/_bitset.h +++ b/project/jni/stlport/stlport/stl/_bitset.h @@ -638,7 +638,7 @@ public: #endif reset(); size_t __tmp = _Nb; - const size_t __Nbits = (min) (__tmp, (min) (__n, __s.size() - __pos)); + const size_t __Nbits = (_STLP_STD_NAME::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() ? diff --git a/project/jni/stlport/stlport/stl/_bvector.h b/project/jni/stlport/stlport/stl/_bvector.h index 1943eda5a..e1971f3f8 100644 --- a/project/jni/stlport/stlport/stl/_bvector.h +++ b/project/jni/stlport/stlport/stl/_bvector.h @@ -456,7 +456,7 @@ protected: this->_M_finish += difference_type(__n); } else { - size_type __len = size() + (max)(size(), __n); + size_type __len = size() + (_STLP_STD_NAME::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() + (max)(size(), __n); + size_type __len = size() + (_STLP_STD_NAME::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() + (max)(size(), __n); + size_type __len = size() + (_STLP_STD_NAME::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() + (max)(size(), __n); + size_type __len = size() + (_STLP_STD_NAME::max)(size(), __n); unsigned int* __q = this->_M_bit_alloc(__len); iterator __i = copy(begin(), __position, iterator(__q, 0)); fill_n(__i, __n, __x); diff --git a/project/jni/stlport/stlport/stl/_codecvt.h b/project/jni/stlport/stlport/stl/_codecvt.h index caee7f365..af7402cff 100644 --- a/project/jni/stlport/stlport/stl/_codecvt.h +++ b/project/jni/stlport/stlport/stl/_codecvt.h @@ -142,7 +142,7 @@ protected: const extern_type* __from, const extern_type* __end, size_t __max) const - { return (int)(min) ( __STATIC_CAST(size_t, (__end - __from)), __max); } + { return (int)(_STLP_STD_NAME::min) ( __STATIC_CAST(size_t, (__end - __from)), __max); } virtual int do_max_length() const _STLP_NOTHROW { return 1; } diff --git a/project/jni/stlport/stlport/stl/_cstdlib.h b/project/jni/stlport/stlport/stl/_cstdlib.h index 9633b408b..612383063 100644 --- a/project/jni/stlport/stlport/stl/_cstdlib.h +++ b/project/jni/stlport/stlport/stl/_cstdlib.h @@ -49,11 +49,8 @@ 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 @@ -61,13 +58,10 @@ 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; @@ -78,10 +72,7 @@ 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; diff --git a/project/jni/stlport/stlport/stl/_deque.c b/project/jni/stlport/stlport/stl/_deque.c index 52d6fc91d..6bb7c07ba 100644 --- a/project/jni/stlport/stlport/stl/_deque.c +++ b/project/jni/stlport/stlport/stl/_deque.c @@ -48,7 +48,7 @@ template 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 = (max)((size_t) _S_initial_map_size, __num_nodes + 2); + _M_map_size._M_data = (_STLP_STD_NAME::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 + (max)((size_t)this->_M_map_size._M_data, __nodes_to_add) + 2; + this->_M_map_size._M_data + (_STLP_STD_NAME::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 diff --git a/project/jni/stlport/stlport/stl/_exception.h b/project/jni/stlport/stlport/stl/_exception.h index f487c4c48..f1fdc4c77 100644 --- a/project/jni/stlport/stlport/stl/_exception.h +++ b/project/jni/stlport/stlport/stl/_exception.h @@ -28,10 +28,6 @@ #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 ) diff --git a/project/jni/stlport/stlport/stl/_fstream.c b/project/jni/stlport/stlport/stl/_fstream.c index d41685d4e..61cbbb3ab 100644 --- a/project/jni/stlport/stlport/stl/_fstream.c +++ b/project/jni/stlport/stlport/stl/_fstream.c @@ -623,7 +623,7 @@ bool basic_filebuf<_CharT, _Traits>::_M_allocate_buffers(_CharT* __buf, streamsi _M_int_buf_dynamic = false; } - streamsize __ebufsiz = (max)(__n * __STATIC_CAST(streamsize, _M_width), + streamsize __ebufsiz = (_STLP_STD_NAME::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 = (max)(__encoding, 1); + _M_width = (_STLP_STD_NAME::max)(__encoding, 1); _M_max_width = _M_codecvt->max_length(); _M_constant_width = __encoding > 0; _M_always_noconv = _M_codecvt->always_noconv(); diff --git a/project/jni/stlport/stlport/stl/_hashtable.c b/project/jni/stlport/stlport/stl/_hashtable.c index c9dafa225..4a2628ccf 100644 --- a/project/jni/stlport/stlport/stl/_hashtable.c +++ b/project/jni/stlport/stlport/stl/_hashtable.c @@ -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 = (max) (__num_buckets_hint, (size_type)((float)size() / max_load_factor())); + __num_buckets_hint = (_STLP_STD_NAME::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)(max) (__num_elements_hint, size()) / max_load_factor()); + size_type __num_buckets_hint = (size_type)((float)(_STLP_STD_NAME::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(); diff --git a/project/jni/stlport/stlport/stl/_istream.c b/project/jni/stlport/stlport/stl/_istream.c index 292cab16c..af1275abf 100644 --- a/project/jni/stlport/stlport/stl/_istream.c +++ b/project/jni/stlport/stlport/stl/_istream.c @@ -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::is_signed) - ptrdiff_t __request = __STATIC_CAST(ptrdiff_t, (min) (__STATIC_CAST(streamsize, (numeric_limits::max)()), _Num - __n)); + ptrdiff_t __request = __STATIC_CAST(ptrdiff_t, (_STLP_STD_NAME::min) (__STATIC_CAST(streamsize, (numeric_limits::max)()), _Num - __n)); const _CharT* __p = __scan_delim(__first, __last); - ptrdiff_t __chunk = (min) (ptrdiff_t(__p - __first), __request); + ptrdiff_t __chunk = (_STLP_STD_NAME::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, (min) (__avail, __nmax), __s, + = _STLP_PRIV __read_buffered(this, __buf, (_STLP_STD_NAME::min) (__avail, __nmax), __s, _STLP_PRIV _Constant_unary_fun(false), _STLP_PRIV _Project2nd(), false, false, false); else _M_gcount - = _STLP_PRIV __read_unbuffered(this, __buf, (min) (__avail, __nmax), __s, + = _STLP_PRIV __read_unbuffered(this, __buf, (_STLP_STD_NAME::min) (__avail, __nmax), __s, _STLP_PRIV _Constant_unary_fun(false), false, false, false); } diff --git a/project/jni/stlport/stlport/stl/_new.h b/project/jni/stlport/stlport/stl/_new.h index dabc5faf5..81d1c011f 100644 --- a/project/jni/stlport/stlport/stl/_new.h +++ b/project/jni/stlport/stlport/stl/_new.h @@ -47,6 +47,13 @@ using _STLP_VENDOR_CSTD::malloc; # error Cannot include native new header as new is a macro. # endif +# ifdef ANDROID +# include _STLP_NATIVE_CPP_RUNTIME_HEADER(cstddef) +namespace std { +using ::ptrdiff_t; +using ::size_t; +} +# endif # include _STLP_NATIVE_CPP_RUNTIME_HEADER(new) # if defined (_STLP_BROKEN_BAD_ALLOC_CLASS) diff --git a/project/jni/stlport/stlport/stl/_num_put.c b/project/jni/stlport/stlport/stl/_num_put.c index 5bc7c3be9..c03171675 100644 --- a/project/jni/stlport/stlport/stl/_num_put.c +++ b/project/jni/stlport/stlport/stl/_num_put.c @@ -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::is_signed) - ptrdiff_t __pad = __STATIC_CAST(ptrdiff_t, (min) (__STATIC_CAST(streamsize, (numeric_limits::max)()), + ptrdiff_t __pad = __STATIC_CAST(ptrdiff_t, (_STLP_STD_NAME::min) (__STATIC_CAST(streamsize, (numeric_limits::max)()), __STATIC_CAST(streamsize, __wid - __len))); ios_base::fmtflags __dir = __flg & ios_base::adjustfield; diff --git a/project/jni/stlport/stlport/stl/_rope.c b/project/jni/stlport/stlport/stl/_rope.c index 61a8fda1b..2e532d77d 100644 --- a/project/jni/stlport/stlport/stl/_rope.c +++ b/project/jni/stlport/stlport/stl/_rope.c @@ -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 = (min) (__left_len, __end); + size_t __left_end = (_STLP_STD_NAME::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 = (max)(__left_len, __begin); + size_t __right_start = (_STLP_STD_NAME::max)(__left_len, __begin); if (!_S_apply_to_pieces(__c, __right, __right_start - __left_len, __end - __left_len)) { diff --git a/project/jni/stlport/stlport/stl/_rope.h b/project/jni/stlport/stlport/stl/_rope.h index 82fc84e6a..a2203d6eb 100644 --- a/project/jni/stlport/stlport/stl/_rope.h +++ b/project/jni/stlport/stlport/stl/_rope.h @@ -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, - (max)(__l->_M_depth, __r->_M_depth) + 1, false, + (_STLP_STD_NAME::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 diff --git a/project/jni/stlport/stlport/stl/_sstream.c b/project/jni/stlport/stlport/stl/_sstream.c index cbf439ff3..bb61da7a1 100644 --- a/project/jni/stlport/stlport/stl/_sstream.c +++ b/project/jni/stlport/stlport/stl/_sstream.c @@ -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, (min)(__n, __STATIC_CAST(streamsize, _M_str.max_size()))) + 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()))) : __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, (min)(__n, __STATIC_CAST(streamsize, _M_str.max_size()))) + _M_str.reserve(sizeof(streamsize) > sizeof(size_t) ? __STATIC_CAST(size_t, (_STLP_STD_NAME::min)(__n, __STATIC_CAST(streamsize, _M_str.max_size()))) : __STATIC_CAST(size_t, __n)); _CharT* __data_ptr = __CONST_CAST(_CharT*, _M_str.data()); diff --git a/project/jni/stlport/stlport/stl/_streambuf.c b/project/jni/stlport/stlport/stl/_streambuf.c index bd61a204f..49414c0aa 100644 --- a/project/jni/stlport/stlport/stl/_streambuf.c +++ b/project/jni/stlport/stlport/stl/_streambuf.c @@ -57,7 +57,7 @@ basic_streambuf<_CharT, _Traits>::xsgetn(_CharT* __s, streamsize __n) { while (__result < __n) { if (_M_gnext < _M_gend) { - size_t __chunk = (min) (__STATIC_CAST(size_t,_M_gend - _M_gnext), + size_t __chunk = (_STLP_STD_NAME::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 = (min) (__STATIC_CAST(size_t,_M_pend - _M_pnext), + size_t __chunk = (_STLP_STD_NAME::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 = (min) (__STATIC_CAST(size_t,_M_pend - _M_pnext), + size_t __chunk = (_STLP_STD_NAME::min) (__STATIC_CAST(size_t,_M_pend - _M_pnext), __STATIC_CAST(size_t,__n - __result)); _Traits::assign(_M_pnext, __chunk, __c); __result += __chunk; diff --git a/project/jni/stlport/stlport/stl/_string.c b/project/jni/stlport/stlport/stl/_string.c index 5dbc62847..ad42ec412 100644 --- a/project/jni/stlport/stlport/stl/_string.c +++ b/project/jni/stlport/stlport/stl/_string.c @@ -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 = (max)(__res_arg, size()) + 1; + size_type __n = (_STLP_STD_NAME::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() + (max)(size(), __n)); + reserve(size() + (_STLP_STD_NAME::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 + (max)(__old_size, (size_t) __n) + 1; + size_type __len = __old_size + (_STLP_STD_NAME::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 + (max)(__old_len, __STATIC_CAST(size_type,1)) + 1; + size_type __len = __old_len + (_STLP_STD_NAME::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 + (max)(__old_size, __n) + 1; + size_type __len = __old_size + (_STLP_STD_NAME::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 + (max)(__old_size, __STATIC_CAST(const size_type,__n)) + 1; + size_type __len = __old_size + (_STLP_STD_NAME::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() + (min)( __len - __n, __pos) + __n; + const_pointer __last = this->_M_Start() + (_STLP_STD_NAME::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() + (min)(__len - 1, __pos) + 1; + const_iterator __last = begin() + (_STLP_STD_NAME::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() + (min)(__len - 1, __pos) + 1; + const const_iterator __last = begin() + (_STLP_STD_NAME::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() + (min)(__len - 1, __pos) + 1; + const_iterator __last = begin() + (_STLP_STD_NAME::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() + (min)(__len - 1, __pos) + 1; + const_iterator __last = begin() + (_STLP_STD_NAME::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 void _STLP_CALL _S_string_copy(const basic_string<_CharT,_Traits,_Alloc>& __s, _CharT* __buf, size_t __n) { if (__n > 0) { - __n = (min) (__n - 1, __s.size()); + __n = (_STLP_STD_NAME::min) (__n - 1, __s.size()); _STLP_STD::copy(__s.begin(), __s.begin() + __n, __buf); __buf[__n] = _CharT(); } diff --git a/project/jni/stlport/stlport/stl/_string.h b/project/jni/stlport/stlport/stl/_string.h index 928deddce..edff727c5 100644 --- a/project/jni/stlport/stlport/stl/_string.h +++ b/project/jni/stlport/stlport/stl/_string.h @@ -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 + (min) (__n, __s.size() - __pos)); + __s._M_Start() + __pos + (_STLP_STD_NAME::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 + (min) (__n, __s.size() - __pos)); + __s._M_Start() + __pos + (_STLP_STD_NAME::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 + (max)(__old_size, __STATIC_CAST(size_type,__n)) + 1; + size_type __len = __old_size + (_STLP_STD_NAME::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 + (min) (__n, __s.size() - __pos)); + __s._M_Start() + __pos + (_STLP_STD_NAME::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() + (max)(size(), __STATIC_CAST(size_type,1))); + reserve(size() + (_STLP_STD_NAME::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 + (min) (__n, __s.size() - __pos)); + __s._M_Start() + __pos + (_STLP_STD_NAME::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 = (min) (__n, __s.size() - __beg); + size_type __len = (_STLP_STD_NAME::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 + (max)(__old_size, __STATIC_CAST(size_type,__n)) + 1; + size_type __len = __old_size + (_STLP_STD_NAME::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 + (min) (__n, size() - __pos)); + erase(begin() + __pos, begin() + __pos + (_STLP_STD_NAME::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 = (min) (__n, size() - __pos); + const size_type __len = (_STLP_STD_NAME::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 = (min) (__n1, size() - __pos1); - const size_type __len2 = (min) (__n2, __s.size() - __pos2); + const size_type __len1 = (_STLP_STD_NAME::min) (__n1, size() - __pos1); + const size_type __len2 = (_STLP_STD_NAME::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 = (min) (__n1, size() - __pos); + const size_type __len = (_STLP_STD_NAME::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 = (min) (__n1, size() - __pos); + const size_type __len = (_STLP_STD_NAME::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 = (min) (__n1, size() - __pos); + const size_type __len = (_STLP_STD_NAME::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 = (min) (__n, size() - __pos); + const size_type __len = (_STLP_STD_NAME::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 + (min) (__n1, size() - __pos1), + this->_M_Start() + __pos1 + (_STLP_STD_NAME::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 + (min) (__n1, size() - __pos1), + this->_M_Start() + __pos1 + (_STLP_STD_NAME::min) (__n1, size() - __pos1), __s._M_Start() + __pos2, - __s._M_Start() + __pos2 + (min) (__n2, __s.size() - __pos2)); + __s._M_Start() + __pos2 + (_STLP_STD_NAME::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 + (min) (__n1, size() - __pos1), + this->_M_Start() + __pos1 + (_STLP_STD_NAME::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 + (min) (__n1, size() - __pos1), + this->_M_Start() + __pos1 + (_STLP_STD_NAME::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, (min) (__n1, __n2)); + const int cmp = _Traits::compare(__f1, __f2, (_STLP_STD_NAME::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) diff --git a/project/jni/stlport/stlport/stl/_string_base.h b/project/jni/stlport/stlport/stl/_string_base.h index 923049dcc..f48278c05 100644 --- a/project/jni/stlport/stlport/stl/_string_base.h +++ b/project/jni/stlport/stlport/stl/_string_base.h @@ -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 (min)(__alloc_max_size, __string_max_size) - 1; + return (_STLP_STD_NAME::min)(__alloc_max_size, __string_max_size) - 1; } _String_base(const allocator_type& __a) diff --git a/project/jni/stlport/stlport/stl/_string_sum_methods.h b/project/jni/stlport/stlport/stl/_string_sum_methods.h index 952ce1875..ebb33f2b9 100644 --- a/project/jni/stlport/stlport/stl/_string_sum_methods.h +++ b/project/jni/stlport/stlport/stl/_string_sum_methods.h @@ -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()) ? ((min) (__n, __s.size() - __pos)) : 0, __a) { + : _STLP_STRING_SUM_BASE(_Reserve_t(), (__pos <= __s.size()) ? ((_STLP_STD_NAME::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, (min) (__n, __size - __pos)); + _M_append_sum_pos(__s, __pos, (_STLP_STD_NAME::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 + (min)(__n, __s_size - __pos), __buf); } + { return uninitialized_copy(__s + __pos, __s + __pos + (_STLP_STD_NAME::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 + (max)(__old_size, __s_size) + 1; + const size_type __len = __old_size + __offset_size + (_STLP_STD_NAME::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 _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 = (min)(__s.size() - __pos, __n); + size_type __s_size = (_STLP_STD_NAME::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 + (max)(__old_size, __s_size) + 1; + const size_type __len = __old_size + __offset_size + (_STLP_STD_NAME::max)(__old_size, __s_size) + 1; pointer __new_start = this->_M_end_of_storage.allocate(__len); pointer __new_finish = __new_start; _STLP_TRY { diff --git a/project/jni/stlport/stlport/stl/_string_workaround.h b/project/jni/stlport/stlport/stl/_string_workaround.h index acd5d3d37..232194f0c 100644 --- a/project/jni/stlport/stlport/stl/_string_workaround.h +++ b/project/jni/stlport/stlport/stl/_string_workaround.h @@ -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 + - (max)(__old_size, __STATIC_CAST(size_type,__n)) + 1; + (_STLP_STD_NAME::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 + (max)(__old_size, __STATIC_CAST(size_type,__n)) + 1; + const size_type __len = __old_size + (_STLP_STD_NAME::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 { diff --git a/project/jni/stlport/stlport/stl/_vector.c b/project/jni/stlport/stlport/stl/_vector.c index c46a23ebb..4af5f81af 100644 --- a/project/jni/stlport/stlport/stl/_vector.c +++ b/project/jni/stlport/stlport/stl/_vector.c @@ -83,7 +83,7 @@ template 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 + (max)(__old_size, __fill_len); + size_type __len = __old_size + (_STLP_STD_NAME::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 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 + (max)(__old_size, __fill_len); + size_type __len = __old_size + (_STLP_STD_NAME::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)); diff --git a/project/jni/stlport/stlport/stl/_vector.h b/project/jni/stlport/stlport/stl/_vector.h index a24e347d7..0aee03a88 100644 --- a/project/jni/stlport/stlport/stl/_vector.h +++ b/project/jni/stlport/stlport/stl/_vector.h @@ -403,7 +403,7 @@ private: #endif /* _STLP_MEMBER_TEMPLATES */ size_type __n) { const size_type __old_size = size(); - size_type __len = __old_size + (max)(__old_size, __n); + size_type __len = __old_size + (_STLP_STD_NAME::max)(__old_size, __n); pointer __new_start = this->_M_end_of_storage.allocate(__len, __len); pointer __new_finish = __new_start; _STLP_TRY { diff --git a/project/jni/stlport/stlport/stl/char_traits.h b/project/jni/stlport/stlport/stl/char_traits.h index 12e8d0803..ad41271d0 100644 --- a/project/jni/stlport/stlport/stl/char_traits.h +++ b/project/jni/stlport/stlport/stl/char_traits.h @@ -71,8 +71,6 @@ 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 diff --git a/project/jni/stlport/stlport/stl/config/_android.h b/project/jni/stlport/stlport/stl/config/_android.h index b95ec317a..7e637fea8 100644 --- a/project/jni/stlport/stlport/stl/config/_android.h +++ b/project/jni/stlport/stlport/stl/config/_android.h @@ -10,14 +10,22 @@ #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 // Don't have native 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 headers +#define _STLP_NO_EXCEPTION_HEADER 1 +#define _STLP_OWN_STDEXCEPT 1 // Already inside libsupc++, but we'll define it under different namespace // Don't use wchar.h etc #define _STLP_NO_WCHAR_T 1 @@ -43,15 +51,12 @@ // Little endian platform. #define _STLP_LITTLE_ENDIAN 1 -// No 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 diff --git a/project/jni/stlport/stlport/stl/debug/_string.h b/project/jni/stlport/stlport/stl/debug/_string.h index 62adc63b9..39db5abfa 100644 --- a/project/jni/stlport/stlport/stl/debug/_string.h +++ b/project/jni/stlport/stlport/stl/debug/_string.h @@ -338,7 +338,7 @@ public: _Self& assign(const _Self& __s, size_type __pos, size_type __n) { if (__pos < __s.size()) { - _M_check_assign((min) (__n, __s.size() - __pos)); + _M_check_assign((_STLP_STD_NAME::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((min) (_Traits::length(__s), __n)); + _M_check_assign((_STLP_STD_NAME::min) (_Traits::length(__s), __n)); _M_non_dbg_impl.assign(__s, __s + __n); return *this; } diff --git a/project/jni/stlport/stlport/stl/debug/_string_sum_methods.h b/project/jni/stlport/stlport/stl/debug/_string_sum_methods.h index 3fca19484..27a4148b3 100644 --- a/project/jni/stlport/stlport/stl/debug/_string_sum_methods.h +++ b/project/jni/stlport/stlport/stl/debug/_string_sum_methods.h @@ -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()) ? ((min) (__n, __s.size() - __pos)) : 0, __a), + : _M_non_dbg_impl(_Reserve_t(), (__pos <= __s.size()) ? ((_STLP_STD_NAME::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, (min) (__n, __size - __pos), _M_non_dbg_impl); + _M_append_sum_pos(__s, __pos, (_STLP_STD_NAME::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 + (min)(__n, __s_size - __pos)); } + { return __str.append(__s + __pos, __s + __pos + (_STLP_STD_NAME::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 _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() + (min) (__s.size() - __pos, __n)); + _M_non_dbg_impl.reserve(_M_non_dbg_impl.size() + (_STLP_STD_NAME::min) (__s.size() - __pos, __n)); _M_append_fast_pos(__s, __impl, __pos, __n); return *this; }