aboutsummaryrefslogtreecommitdiff
path: root/contrib/libc++/src/locale.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libc++/src/locale.cpp')
-rw-r--r--contrib/libc++/src/locale.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/contrib/libc++/src/locale.cpp b/contrib/libc++/src/locale.cpp
index a326323ac1ed..f21e35dd540a 100644
--- a/contrib/libc++/src/locale.cpp
+++ b/contrib/libc++/src/locale.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
-
// On Solaris, we need to define something to make the C99 parts of localeconv
// visible.
#ifdef __sun__
@@ -30,9 +28,9 @@
#include "__sso_allocator"
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
#include <support/win32/locale_win32.h>
-#else // _LIBCPP_MSVCRT
+#elif !defined(__ANDROID__)
#include <langinfo.h>
-#endif // !_LIBCPP_MSVCRT
+#endif
#include <stdlib.h>
#include <stdio.h>
@@ -68,7 +66,7 @@ make(A0 a0)
{
static typename aligned_storage<sizeof(T)>::type buf;
::new (&buf) T(a0);
- return *(T*)&buf;
+ return *reinterpret_cast<T*>(&buf);
}
template <class T, class A0, class A1>
@@ -78,7 +76,7 @@ make(A0 a0, A1 a1)
{
static typename aligned_storage<sizeof(T)>::type buf;
::new (&buf) T(a0, a1);
- return *(T*)&buf;
+ return *reinterpret_cast<T*>(&buf);
}
template <class T, class A0, class A1, class A2>
@@ -88,7 +86,7 @@ make(A0 a0, A1 a1, A2 a2)
{
static typename aligned_storage<sizeof(T)>::type buf;
::new (&buf) T(a0, a1, a2);
- return *(T*)&buf;
+ return *reinterpret_cast<T*>(&buf);
}
template <typename T, size_t N>
@@ -177,7 +175,7 @@ locale::__imp::__imp(size_t refs)
facets_.clear();
install(&make<_VSTD::collate<char> >(1u));
install(&make<_VSTD::collate<wchar_t> >(1u));
- install(&make<_VSTD::ctype<char> >((ctype_base::mask*)0, false, 1u));
+ install(&make<_VSTD::ctype<char> >(nullptr, false, 1u));
install(&make<_VSTD::ctype<wchar_t> >(1u));
install(&make<codecvt<char, char, mbstate_t> >(1u));
install(&make<codecvt<wchar_t, char, mbstate_t> >(1u));
@@ -461,7 +459,7 @@ locale::__imp::make_classic()
{
// only one thread can get in here and it only gets in once
static aligned_storage<sizeof(locale)>::type buf;
- locale* c = (locale*)&buf;
+ locale* c = reinterpret_cast<locale*>(&buf);
c->__locale_ = &make<__imp>(1u);
return *c;
}
@@ -479,7 +477,7 @@ locale::__imp::make_global()
// only one thread can get in here and it only gets in once
static aligned_storage<sizeof(locale)>::type buf;
::new (&buf) locale(locale::classic());
- return *(locale*)&buf;
+ return *reinterpret_cast<locale*>(&buf);
}
locale&
@@ -1036,7 +1034,9 @@ ctype<char>::classic_table() _NOEXCEPT
#elif defined(__EMSCRIPTEN__)
return *__ctype_b_loc();
#elif defined(_AIX)
- return (const unsigned long *)__lc_ctype_ptr->obj->mask;
+ return (const unsigned int *)__lc_ctype_ptr->obj->mask;
+#elif defined(__ANDROID__)
+ return reinterpret_cast<const unsigned char*>(_ctype_) + 1;
#else
// Platform not supported: abort so the person doing the port knows what to
// fix
@@ -1615,9 +1615,9 @@ int
codecvt<wchar_t, char, mbstate_t>::do_encoding() const _NOEXCEPT
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- if (mbtowc_l((wchar_t*) 0, (const char*) 0, MB_LEN_MAX, __l) == 0)
+ if (mbtowc_l(nullptr, nullptr, MB_LEN_MAX, __l) == 0)
#else
- if (__mbtowc_l((wchar_t*) 0, (const char*) 0, MB_LEN_MAX, __l) == 0)
+ if (__mbtowc_l(nullptr, nullptr, MB_LEN_MAX, __l) == 0)
#endif
{
// stateless encoding
@@ -1743,8 +1743,8 @@ utf16_to_utf8(const uint16_t* frm, const uint16_t* frm_end, const uint16_t*& frm
return codecvt_base::error;
if (to_end-to_nxt < 4)
return codecvt_base::partial;
- if ((((((unsigned long)wc1 & 0x03C0) >> 6) + 1) << 16) +
- (((unsigned long)wc1 & 0x003F) << 10) + (wc2 & 0x03FF) > Maxcode)
+ if (((((wc1 & 0x03C0UL) >> 6) + 1) << 16) +
+ ((wc1 & 0x003FUL) << 10) + (wc2 & 0x03FF) > Maxcode)
return codecvt_base::error;
++frm_nxt;
uint8_t z = ((wc1 & 0x03C0) >> 6) + 1;
@@ -1820,8 +1820,8 @@ utf16_to_utf8(const uint32_t* frm, const uint32_t* frm_end, const uint32_t*& frm
return codecvt_base::error;
if (to_end-to_nxt < 4)
return codecvt_base::partial;
- if ((((((unsigned long)wc1 & 0x03C0) >> 6) + 1) << 16) +
- (((unsigned long)wc1 & 0x003F) << 10) + (wc2 & 0x03FF) > Maxcode)
+ if (((((wc1 & 0x03C0UL) >> 6) + 1) << 16) +
+ ((wc1 & 0x003FUL) << 10) + (wc2 & 0x03FF) > Maxcode)
return codecvt_base::error;
++frm_nxt;
uint8_t z = ((wc1 & 0x03C0) >> 6) + 1;
@@ -1944,9 +1944,9 @@ utf8_to_utf16(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_nx
return codecvt_base::error;
if (to_end-to_nxt < 2)
return codecvt_base::partial;
- if (((((unsigned long)c1 & 7) << 18) +
- (((unsigned long)c2 & 0x3F) << 12) +
- (((unsigned long)c3 & 0x3F) << 6) + (c4 & 0x3F)) > Maxcode)
+ if ((((c1 & 7UL) << 18) +
+ ((c2 & 0x3FUL) << 12) +
+ ((c3 & 0x3FUL) << 6) + (c4 & 0x3F)) > Maxcode)
return codecvt_base::error;
*to_nxt = static_cast<uint16_t>(
0xD800
@@ -2065,9 +2065,9 @@ utf8_to_utf16(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_nx
return codecvt_base::error;
if (to_end-to_nxt < 2)
return codecvt_base::partial;
- if (((((unsigned long)c1 & 7) << 18) +
- (((unsigned long)c2 & 0x3F) << 12) +
- (((unsigned long)c3 & 0x3F) << 6) + (c4 & 0x3F)) > Maxcode)
+ if ((((c1 & 7UL) << 18) +
+ ((c2 & 0x3FUL) << 12) +
+ ((c3 & 0x3FUL) << 6) + (c4 & 0x3F)) > Maxcode)
return codecvt_base::error;
*to_nxt = static_cast<uint32_t>(
0xD800
@@ -2174,9 +2174,9 @@ utf8_to_utf16_length(const uint8_t* frm, const uint8_t* frm_end,
}
if ((c3 & 0xC0) != 0x80 || (c4 & 0xC0) != 0x80)
break;
- if (((((unsigned long)c1 & 7) << 18) +
- (((unsigned long)c2 & 0x3F) << 12) +
- (((unsigned long)c3 & 0x3F) << 6) + (c4 & 0x3F)) > Maxcode)
+ if ((((c1 & 7UL) << 18) +
+ ((c2 & 0x3FUL) << 12) +
+ ((c3 & 0x3FUL) << 6) + (c4 & 0x3F)) > Maxcode)
break;
++nchar16_t;
frm_nxt += 4;