Switch to using C++ style casts.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@198505 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/src/locale.cpp b/src/locale.cpp
index 8e7fdb4..4877f2b 100644
--- a/src/locale.cpp
+++ b/src/locale.cpp
@@ -68,7 +68,7 @@
 {
     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 +78,7 @@
 {
     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 +88,7 @@
 {
     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 +177,7 @@
     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 +461,7 @@
 {
     // 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 +479,7 @@
     // 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&
@@ -1615,9 +1615,9 @@
 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
             }
             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;