Merge "Remove wchar_t-related compiler warnings when building the STLport sources"
diff --git a/src/complex.cpp b/src/complex.cpp
index 50f310c..6da5bc1 100644
--- a/src/complex.cpp
+++ b/src/complex.cpp
@@ -226,18 +226,24 @@
return r;
}
-static const float LN10_INVF = 1.f / ::log(10.f);
_STLP_DECLSPEC complex<float> _STLP_CALL log10(const complex<float>& z)
-{ return log10T(z, LN10_INVF); }
+{
+ const float LN10_INVF = 1.f / ::log(10.f);
+ return log10T(z, LN10_INVF);
+}
-static const double LN10_INV = 1. / ::log10(10.);
_STLP_DECLSPEC complex<double> _STLP_CALL log10(const complex<double>& z)
-{ return log10T(z, LN10_INV); }
+{
+ const double LN10_INV = 1. / ::log10(10.);
+ return log10T(z, LN10_INV);
+}
#if !defined (_STLP_NO_LONG_DOUBLE)
-static const long double LN10_INVL = 1.l / ::log(10.l);
_STLP_DECLSPEC complex<long double> _STLP_CALL log10(const complex<long double>& z)
-{ return log10T(z, LN10_INVL); }
+{
+ const long double LN10_INVL = 1.l / ::log(10.l);
+ return log10T(z, LN10_INVL);
+}
#endif
//----------------------------------------------------------------------
diff --git a/src/complex_trig.cpp b/src/complex_trig.cpp
index f566fe9..62d6be7 100644
--- a/src/complex_trig.cpp
+++ b/src/complex_trig.cpp
@@ -42,7 +42,7 @@
long double ld;
} ldouble_ulimit = {0x408633ce, 0x8fb9f87e, 0xbd23b659, 0x4e9bd8b1};
# if !defined (_STLP_NO_LONG_DOUBLE)
- static const long double ldouble_limit = ldouble_ulimit.ld;
+# define ldouble_limit ldouble_ulimit.ld
# endif
#else
# if defined (M_LN2) && defined (FLT_MAX_EXP)
@@ -54,9 +54,9 @@
# endif
# if !defined (_STLP_NO_LONG_DOUBLE)
# if defined (M_LN2l)
- static const long double ldouble_limit = M_LN2l * LDBL_MAX_EXP;
+# define ldouble_limit (M_LN2l * LDBL_MAX_EXP)
# else
- static const long double ldouble_limit = ::log(LDBL_MAX);
+# define ldouble_limit ::log(LDBL_MAX)
# endif
# endif
#endif
diff --git a/src/locale.cpp b/src/locale.cpp
index 8df976b..5564a6e 100644
--- a/src/locale.cpp
+++ b/src/locale.cpp
@@ -26,7 +26,8 @@
_STLP_BEGIN_NAMESPACE
-static const string _Nameless("*");
+#define _NAMELESS "*"
+static const char _Nameless[] = _NAMELESS;
static inline bool is_C_locale_name (const char* name)
{ return ((name[0] == 'C') && (name[1] == 0)); }
@@ -248,8 +249,8 @@
if (!name)
_M_throw_on_null_name();
- if (_Nameless == name)
- _STLP_THROW(runtime_error((string("Invalid locale name '") + _Nameless + "'").c_str()));
+ if (!::strcmp(_Nameless, name))
+ _STLP_THROW(runtime_error("Invalid locale name '" _NAMELESS "'"));
_Locale_impl* impl = 0;
diff --git a/src/locale_impl.cpp b/src/locale_impl.cpp
index 103b603..71e0864 100644
--- a/src/locale_impl.cpp
+++ b/src/locale_impl.cpp
@@ -28,7 +28,7 @@
_STLP_BEGIN_NAMESPACE
-static const string _Nameless("*");
+static const char _Nameless[] = "*";
static inline bool is_C_locale_name (const char* name)
{ return ((name[0] == 'C') && (name[1] == 0)); }
diff --git a/src/monetary.cpp b/src/monetary.cpp
index d9b213a..d4a6767 100644
--- a/src/monetary.cpp
+++ b/src/monetary.cpp
@@ -36,9 +36,9 @@
}
// This is being used throughout the library
-static const string _S_empty_string;
+static const char _S_empty_string[] = "";
#ifndef _STLP_NO_WCHAR_T
-static const wstring _S_empty_wstring;
+static const wchar_t _S_empty_wstring[] = L"";
#endif
//
diff --git a/src/num_get_float.cpp b/src/num_get_float.cpp
index 63e9fed..0407604 100644
--- a/src/num_get_float.cpp
+++ b/src/num_get_float.cpp
@@ -50,7 +50,7 @@
} i32;
};
-# if defined (__linux__) && !defined (ANDROID)
+# if defined (__linux__) && !defined (__ANDROID__)
# include <ieee754.h>
# else
union ieee854_long_double {
@@ -105,7 +105,7 @@
# define ULL(x) x##Ui64
#elif defined (__unix) || defined (__MINGW32__) || \
(defined (__DMC__) && (__LONGLONG)) || defined (__WATCOMC__) || \
- defined (ANDROID)
+ defined (__ANDROID__)
typedef uint32_t uint32;
typedef uint64_t uint64;
# define ULL(x) x##ULL
@@ -136,7 +136,7 @@
high = u1 * v1 + w2 + (x >> 32);
}
-#if !defined (__linux__) || defined (ANDROID)
+#if !defined (__linux__) || defined (__ANDROID__)
# define bit11 ULL(0x7ff)
# define exponent_mask (bit11 << 52)
@@ -324,7 +324,7 @@
// Third argument is base-10 exponent.
/* IEEE representation */
-#if !defined (__linux__) || defined (ANDROID)
+#if !defined (__linux__) || defined (__ANDROID__)
union _Double_rep {
uint64 ival;
@@ -641,7 +641,7 @@
}
#endif // __linux__
-#if !defined (__linux__) || defined (ANDROID)
+#if !defined (__linux__) || defined (__ANDROID__)
static double _Stl_string_to_double(const char *s) {
typedef numeric_limits<double> limits;
const int max_digits = limits::digits10 + 2;
@@ -845,7 +845,7 @@
void _STLP_CALL
__string_to_float(const __iostring& v, float& val)
{
-#if !defined (__linux__) || defined (ANDROID)
+#if !defined (__linux__) || defined (__ANDROID__)
val = (float)_Stl_string_to_double(v.c_str());
#else
val = (float)_Stl_string_to_doubleT<double,ieee754_double,12,IEEE754_DOUBLE_BIAS>(v.c_str());
@@ -855,7 +855,7 @@
void _STLP_CALL
__string_to_float(const __iostring& v, double& val)
{
-#if !defined (__linux__) || defined (ANDROID)
+#if !defined (__linux__) || defined (__ANDROID__)
val = _Stl_string_to_double(v.c_str());
#else
val = _Stl_string_to_doubleT<double,ieee754_double,12,IEEE754_DOUBLE_BIAS>(v.c_str());
diff --git a/stlport/stl/_cmath.h b/stlport/stl/_cmath.h
index 2867c23..5cb0cd5 100644
--- a/stlport/stl/_cmath.h
+++ b/stlport/stl/_cmath.h
@@ -531,7 +531,7 @@
#endif
#if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
-#if defined (ANDROID)
+#if defined (__ANDROID__)
namespace __captured {
template<typename _Tp> inline int __capture_isfinite(_Tp __f) { return isfinite(__f); }
template<typename _Tp> inline int __capture_isinf(_Tp __f) { return isinf(__f); }
@@ -573,7 +573,7 @@
#if !(defined(__HP_aCC) && defined(_STLP_DEBUG))
using ::hypot;
#endif
-#if defined (ANDROID)
+#if defined (__ANDROID__)
using __captured::isfinite;
using __captured::isinf;
using __captured::isnan;
@@ -583,7 +583,7 @@
using ::log10;
using ::modf;
using ::pow;
-#if defined (ANDROID)
+#if defined (__ANDROID__)
using __captured::signbit;
#endif
using ::sin;
diff --git a/stlport/stl/_mbstate_t.h b/stlport/stl/_mbstate_t.h
index 53566a7..83f085e 100644
--- a/stlport/stl/_mbstate_t.h
+++ b/stlport/stl/_mbstate_t.h
@@ -27,7 +27,7 @@
#if defined (_STLP_USE_OWN_MBSTATE_T)
# if !defined (_STLP_CPP_MBSTATE_T) || !defined (__cplusplus) || !defined (_STLP_USE_NEW_C_HEADERS)
-# if !defined (ANDROID) /* mbstate_t conflicts with Android's definition */
+# if !defined (__ANDROID__) /* mbstate_t conflicts with Android's definition */
typedef int mbstate_t;
# endif
# endif
diff --git a/stlport/stl/_pair.h b/stlport/stl/_pair.h
index de0b08e..7da76a9 100644
--- a/stlport/stl/_pair.h
+++ b/stlport/stl/_pair.h
@@ -43,7 +43,7 @@
_STLP_BEGIN_NAMESPACE
-#if defined (ANDROID)
+#if defined (__ANDROID__)
/* Android has stl_pair.h, prevent using it by defining the header guard. */
# define __SGI_STL_INTERNAL_PAIR_H
#endif
diff --git a/stlport/stl/config/_system.h b/stlport/stl/config/_system.h
index c0b4add..1e82095 100644
--- a/stlport/stl/config/_system.h
+++ b/stlport/stl/config/_system.h
@@ -59,7 +59,7 @@
# elif defined (__HP_aCC)
# include <stl/config/_hpacc.h>
# endif
-#elif defined (ANDROID)
+#elif defined (__ANDROID__)
/* Android mobile phone platform. Somewhat but not entirely GNU/Linux-like */
# include <stl/config/_android.h>
#elif defined (linux) || defined (__linux__)