locale.cpp (241900) | locale.cpp (246468) |
---|---|
1//===------------------------- locale.cpp ---------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is dual licensed under the MIT and the University of Illinois Open 6// Source Licenses. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 67 unchanged lines hidden (view full) --- 76T& 77make(A0 a0, A1 a1, A2 a2) 78{ 79 static typename aligned_storage<sizeof(T)>::type buf; 80 ::new (&buf) T(a0, a1, a2); 81 return *(T*)&buf; 82} 83 | 1//===------------------------- locale.cpp ---------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is dual licensed under the MIT and the University of Illinois Open 6// Source Licenses. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 67 unchanged lines hidden (view full) --- 76T& 77make(A0 a0, A1 a1, A2 a2) 78{ 79 static typename aligned_storage<sizeof(T)>::type buf; 80 ::new (&buf) T(a0, a1, a2); 81 return *(T*)&buf; 82} 83 |
84template <typename T, size_t N> 85inline 86_LIBCPP_CONSTEXPR 87size_t 88countof(const T (&)[N]) 89{ 90 return N; |
|
84} 85 | 91} 92 |
93template <typename T> 94inline 95_LIBCPP_CONSTEXPR 96size_t 97countof(const T * const begin, const T * const end) 98{ 99 return static_cast<size_t>(end - begin); 100} 101 102} 103 104const locale::category locale::none; 105const locale::category locale::collate; 106const locale::category locale::ctype; 107const locale::category locale::monetary; 108const locale::category locale::numeric; 109const locale::category locale::time; 110const locale::category locale::messages; 111const locale::category locale::all; 112 |
|
86#pragma clang diagnostic push 87#pragma clang diagnostic ignored "-Wpadded" 88 89class _LIBCPP_HIDDEN locale::__imp 90 : public facet 91{ 92 enum {N = 28}; 93 vector<facet*, __sso_allocator<facet*, N> > facets_; --- 98 unchanged lines hidden (view full) --- 192 for (unsigned i = 0; i < facets_.size(); ++i) 193 if (facets_[i]) 194 facets_[i]->__release_shared(); 195 throw; 196 } 197#endif // _LIBCPP_NO_EXCEPTIONS 198} 199 | 113#pragma clang diagnostic push 114#pragma clang diagnostic ignored "-Wpadded" 115 116class _LIBCPP_HIDDEN locale::__imp 117 : public facet 118{ 119 enum {N = 28}; 120 vector<facet*, __sso_allocator<facet*, N> > facets_; --- 98 unchanged lines hidden (view full) --- 219 for (unsigned i = 0; i < facets_.size(); ++i) 220 if (facets_[i]) 221 facets_[i]->__release_shared(); 222 throw; 223 } 224#endif // _LIBCPP_NO_EXCEPTIONS 225} 226 |
227// NOTE avoid the `base class should be explicitly initialized in the 228// copy constructor` warning emitted by GCC 229#pragma GCC diagnostic push 230#pragma GCC diagnostic ignored "-Wextra" 231 |
|
200locale::__imp::__imp(const __imp& other) 201 : facets_(max<size_t>(N, other.facets_.size())), 202 name_(other.name_) 203{ 204 facets_ = other.facets_; 205 for (unsigned i = 0; i < facets_.size(); ++i) 206 if (facets_[i]) 207 facets_[i]->__add_shared(); 208} 209 | 232locale::__imp::__imp(const __imp& other) 233 : facets_(max<size_t>(N, other.facets_.size())), 234 name_(other.name_) 235{ 236 facets_ = other.facets_; 237 for (unsigned i = 0; i < facets_.size(); ++i) 238 if (facets_[i]) 239 facets_[i]->__add_shared(); 240} 241 |
242#pragma GCC diagnostic pop 243 |
|
210locale::__imp::__imp(const __imp& other, const string& name, locale::category c) 211 : facets_(N), 212 name_("*") 213{ 214 facets_ = other.facets_; 215 for (unsigned i = 0; i < facets_.size(); ++i) 216 if (facets_[i]) 217 facets_[i]->__add_shared(); --- 468 unchanged lines hidden (view full) --- 686 const string_type in(lo, hi); 687 string_type out(wcsxfrm_l(0, in.c_str(), 0, __l), wchar_t()); 688 wcsxfrm_l(const_cast<wchar_t*>(out.c_str()), in.c_str(), out.size()+1, __l); 689 return out; 690} 691 692// template <> class ctype<wchar_t>; 693 | 244locale::__imp::__imp(const __imp& other, const string& name, locale::category c) 245 : facets_(N), 246 name_("*") 247{ 248 facets_ = other.facets_; 249 for (unsigned i = 0; i < facets_.size(); ++i) 250 if (facets_[i]) 251 facets_[i]->__add_shared(); --- 468 unchanged lines hidden (view full) --- 720 const string_type in(lo, hi); 721 string_type out(wcsxfrm_l(0, in.c_str(), 0, __l), wchar_t()); 722 wcsxfrm_l(const_cast<wchar_t*>(out.c_str()), in.c_str(), out.size()+1, __l); 723 return out; 724} 725 726// template <> class ctype<wchar_t>; 727 |
728const ctype_base::mask ctype_base::space; 729const ctype_base::mask ctype_base::print; 730const ctype_base::mask ctype_base::cntrl; 731const ctype_base::mask ctype_base::upper; 732const ctype_base::mask ctype_base::lower; 733const ctype_base::mask ctype_base::alpha; 734const ctype_base::mask ctype_base::digit; 735const ctype_base::mask ctype_base::punct; 736const ctype_base::mask ctype_base::xdigit; 737const ctype_base::mask ctype_base::blank; 738const ctype_base::mask ctype_base::alnum; 739const ctype_base::mask ctype_base::graph; 740 |
|
694locale::id ctype<wchar_t>::id; 695 696ctype<wchar_t>::~ctype() 697{ 698} 699 700bool 701ctype<wchar_t>::do_is(mask m, char_type c) const --- 136 unchanged lines hidden (view full) --- 838 839char 840ctype<char>::do_toupper(char_type c) const 841{ 842#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE 843 return isascii(c) ? 844 static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(c)]) : c; 845#elif defined(__GLIBC__) | 741locale::id ctype<wchar_t>::id; 742 743ctype<wchar_t>::~ctype() 744{ 745} 746 747bool 748ctype<wchar_t>::do_is(mask m, char_type c) const --- 136 unchanged lines hidden (view full) --- 885 886char 887ctype<char>::do_toupper(char_type c) const 888{ 889#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE 890 return isascii(c) ? 891 static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(c)]) : c; 892#elif defined(__GLIBC__) |
846 return isascii(c) ? __classic_upper_table()[c] : c; | 893 return isascii(c) ? __classic_upper_table()[static_cast<size_t>(c)] : c; |
847#else 848 return (isascii(c) && islower_l(c, __cloc())) ? c-'a'+'A' : c; 849#endif 850} 851 852const char* 853ctype<char>::do_toupper(char_type* low, const char_type* high) const 854{ 855 for (; low != high; ++low) 856#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE 857 *low = isascii(*low) ? 858 static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(*low)]) : *low; 859#elif defined(__GLIBC__) | 894#else 895 return (isascii(c) && islower_l(c, __cloc())) ? c-'a'+'A' : c; 896#endif 897} 898 899const char* 900ctype<char>::do_toupper(char_type* low, const char_type* high) const 901{ 902 for (; low != high; ++low) 903#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE 904 *low = isascii(*low) ? 905 static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(*low)]) : *low; 906#elif defined(__GLIBC__) |
860 *low = isascii(*low) ? __classic_upper_table()[*low] : *low; | 907 *low = isascii(*low) ? __classic_upper_table()[static_cast<size_t>(*low)] : *low; |
861#else 862 *low = (isascii(*low) && islower_l(*low, __cloc())) ? *low-'a'+'A' : *low; 863#endif 864 return low; 865} 866 867char 868ctype<char>::do_tolower(char_type c) const 869{ 870#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE 871 return isascii(c) ? 872 static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(c)]) : c; 873#elif defined(__GLIBC__) | 908#else 909 *low = (isascii(*low) && islower_l(*low, __cloc())) ? *low-'a'+'A' : *low; 910#endif 911 return low; 912} 913 914char 915ctype<char>::do_tolower(char_type c) const 916{ 917#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE 918 return isascii(c) ? 919 static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(c)]) : c; 920#elif defined(__GLIBC__) |
874 return isascii(c) ? __classic_lower_table()[c] : c; | 921 return isascii(c) ? __classic_lower_table()[static_cast<size_t>(c)] : c; |
875#else 876 return (isascii(c) && isupper_l(c, __cloc())) ? c-'A'+'a' : c; 877#endif 878} 879 880const char* 881ctype<char>::do_tolower(char_type* low, const char_type* high) const 882{ 883 for (; low != high; ++low) 884#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE 885 *low = isascii(*low) ? static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(*low)]) : *low; 886#elif defined(__GLIBC__) | 922#else 923 return (isascii(c) && isupper_l(c, __cloc())) ? c-'A'+'a' : c; 924#endif 925} 926 927const char* 928ctype<char>::do_tolower(char_type* low, const char_type* high) const 929{ 930 for (; low != high; ++low) 931#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE 932 *low = isascii(*low) ? static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(*low)]) : *low; 933#elif defined(__GLIBC__) |
887 *low = isascii(*low) ? __classic_lower_table()[*low] : *low; | 934 *low = isascii(*low) ? __classic_lower_table()[static_cast<size_t>(*low)] : *low; |
888#else 889 *low = (isascii(*low) && isupper_l(*low, __cloc())) ? *low-'A'+'a' : *low; 890#endif 891 return low; 892} 893 894char 895ctype<char>::do_widen(char c) const --- 306 unchanged lines hidden (view full) --- 1202char 1203ctype_byname<wchar_t>::do_narrow(char_type c, char dfault) const 1204{ 1205#ifdef _LIBCPP_LOCALE__L_EXTENSIONS 1206 int r = wctob_l(c, __l); 1207#else 1208 int r = __wctob_l(c, __l); 1209#endif | 935#else 936 *low = (isascii(*low) && isupper_l(*low, __cloc())) ? *low-'A'+'a' : *low; 937#endif 938 return low; 939} 940 941char 942ctype<char>::do_widen(char c) const --- 306 unchanged lines hidden (view full) --- 1249char 1250ctype_byname<wchar_t>::do_narrow(char_type c, char dfault) const 1251{ 1252#ifdef _LIBCPP_LOCALE__L_EXTENSIONS 1253 int r = wctob_l(c, __l); 1254#else 1255 int r = __wctob_l(c, __l); 1256#endif |
1210 return r != WEOF ? static_cast<char>(r) : dfault; | 1257 return r != static_cast<int>(WEOF) ? static_cast<char>(r) : dfault; |
1211} 1212 1213const wchar_t* 1214ctype_byname<wchar_t>::do_narrow(const char_type* low, const char_type* high, char dfault, char* dest) const 1215{ 1216 for (; low != high; ++low, ++dest) 1217 { 1218#ifdef _LIBCPP_LOCALE__L_EXTENSIONS 1219 int r = wctob_l(*low, __l); 1220#else 1221 int r = __wctob_l(*low, __l); 1222#endif | 1258} 1259 1260const wchar_t* 1261ctype_byname<wchar_t>::do_narrow(const char_type* low, const char_type* high, char dfault, char* dest) const 1262{ 1263 for (; low != high; ++low, ++dest) 1264 { 1265#ifdef _LIBCPP_LOCALE__L_EXTENSIONS 1266 int r = wctob_l(*low, __l); 1267#else 1268 int r = __wctob_l(*low, __l); 1269#endif |
1223 *dest = r != WEOF ? static_cast<char>(r) : dfault; | 1270 *dest = r != static_cast<int>(WEOF) ? static_cast<char>(r) : dfault; |
1224 } 1225 return low; 1226} 1227 1228// template <> class codecvt<char, char, mbstate_t> 1229 1230locale::id codecvt<char, char, mbstate_t>::id; 1231 --- 1382 unchanged lines hidden (view full) --- 2614 2615static 2616int 2617utf16be_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end, 2618 size_t mx, unsigned long Maxcode = 0x10FFFF, 2619 codecvt_mode mode = codecvt_mode(0)) 2620{ 2621 const uint8_t* frm_nxt = frm; | 1271 } 1272 return low; 1273} 1274 1275// template <> class codecvt<char, char, mbstate_t> 1276 1277locale::id codecvt<char, char, mbstate_t>::id; 1278 --- 1382 unchanged lines hidden (view full) --- 2661 2662static 2663int 2664utf16be_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end, 2665 size_t mx, unsigned long Maxcode = 0x10FFFF, 2666 codecvt_mode mode = codecvt_mode(0)) 2667{ 2668 const uint8_t* frm_nxt = frm; |
2622 frm_nxt = frm; | |
2623 if (mode & consume_header) 2624 { 2625 if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFE && frm_nxt[1] == 0xFF) 2626 frm_nxt += 2; 2627 } 2628 for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t) 2629 { 2630 uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]); --- 116 unchanged lines hidden (view full) --- 2747 2748static 2749int 2750utf16le_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end, 2751 size_t mx, unsigned long Maxcode = 0x10FFFF, 2752 codecvt_mode mode = codecvt_mode(0)) 2753{ 2754 const uint8_t* frm_nxt = frm; | 2669 if (mode & consume_header) 2670 { 2671 if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFE && frm_nxt[1] == 0xFF) 2672 frm_nxt += 2; 2673 } 2674 for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t) 2675 { 2676 uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]); --- 116 unchanged lines hidden (view full) --- 2793 2794static 2795int 2796utf16le_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end, 2797 size_t mx, unsigned long Maxcode = 0x10FFFF, 2798 codecvt_mode mode = codecvt_mode(0)) 2799{ 2800 const uint8_t* frm_nxt = frm; |
2755 frm_nxt = frm; | |
2756 if (mode & consume_header) 2757 { 2758 if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFF && frm_nxt[1] == 0xFE) 2759 frm_nxt += 2; 2760 } 2761 for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t) 2762 { 2763 uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]); --- 78 unchanged lines hidden (view full) --- 2842 2843static 2844int 2845utf16be_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end, 2846 size_t mx, unsigned long Maxcode = 0x10FFFF, 2847 codecvt_mode mode = codecvt_mode(0)) 2848{ 2849 const uint8_t* frm_nxt = frm; | 2801 if (mode & consume_header) 2802 { 2803 if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFF && frm_nxt[1] == 0xFE) 2804 frm_nxt += 2; 2805 } 2806 for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t) 2807 { 2808 uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]); --- 78 unchanged lines hidden (view full) --- 2887 2888static 2889int 2890utf16be_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end, 2891 size_t mx, unsigned long Maxcode = 0x10FFFF, 2892 codecvt_mode mode = codecvt_mode(0)) 2893{ 2894 const uint8_t* frm_nxt = frm; |
2850 frm_nxt = frm; | |
2851 if (mode & consume_header) 2852 { 2853 if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFE && frm_nxt[1] == 0xFF) 2854 frm_nxt += 2; 2855 } 2856 for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t) 2857 { 2858 uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]); --- 1695 unchanged lines hidden (view full) --- 4554} 4555 4556__time_get::~__time_get() 4557{ 4558 freelocale(__loc_); 4559} 4560 4561#pragma clang diagnostic ignored "-Wmissing-field-initializers" | 2895 if (mode & consume_header) 2896 { 2897 if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFE && frm_nxt[1] == 0xFF) 2898 frm_nxt += 2; 2899 } 2900 for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t) 2901 { 2902 uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]); --- 1695 unchanged lines hidden (view full) --- 4598} 4599 4600__time_get::~__time_get() 4601{ 4602 freelocale(__loc_); 4603} 4604 4605#pragma clang diagnostic ignored "-Wmissing-field-initializers" |
4606#pragma GCC diagnostic ignored "-Wmissing-field-initializers" |
|
4562 4563template <> 4564string 4565__time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct) 4566{ 4567 tm t = {0}; 4568 t.tm_sec = 59; 4569 t.tm_min = 55; 4570 t.tm_hour = 23; 4571 t.tm_mday = 31; 4572 t.tm_mon = 11; 4573 t.tm_year = 161; 4574 t.tm_wday = 6; 4575 t.tm_yday = 364; 4576 t.tm_isdst = -1; 4577 char buf[100]; 4578 char f[3] = {0}; 4579 f[0] = '%'; 4580 f[1] = fmt; | 4607 4608template <> 4609string 4610__time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct) 4611{ 4612 tm t = {0}; 4613 t.tm_sec = 59; 4614 t.tm_min = 55; 4615 t.tm_hour = 23; 4616 t.tm_mday = 31; 4617 t.tm_mon = 11; 4618 t.tm_year = 161; 4619 t.tm_wday = 6; 4620 t.tm_yday = 364; 4621 t.tm_isdst = -1; 4622 char buf[100]; 4623 char f[3] = {0}; 4624 f[0] = '%'; 4625 f[1] = fmt; |
4581 size_t n = strftime_l(buf, 100, f, &t, __loc_); | 4626 size_t n = strftime_l(buf, countof(buf), f, &t, __loc_); |
4582 char* bb = buf; 4583 char* be = buf + n; 4584 string result; 4585 while (bb != be) 4586 { 4587 if (ct.is(ctype_base::space, *bb)) 4588 { 4589 result.push_back(' '); --- 129 unchanged lines hidden (view full) --- 4719 t.tm_year = 161; 4720 t.tm_wday = 6; 4721 t.tm_yday = 364; 4722 t.tm_isdst = -1; 4723 char buf[100]; 4724 char f[3] = {0}; 4725 f[0] = '%'; 4726 f[1] = fmt; | 4627 char* bb = buf; 4628 char* be = buf + n; 4629 string result; 4630 while (bb != be) 4631 { 4632 if (ct.is(ctype_base::space, *bb)) 4633 { 4634 result.push_back(' '); --- 129 unchanged lines hidden (view full) --- 4764 t.tm_year = 161; 4765 t.tm_wday = 6; 4766 t.tm_yday = 364; 4767 t.tm_isdst = -1; 4768 char buf[100]; 4769 char f[3] = {0}; 4770 f[0] = '%'; 4771 f[1] = fmt; |
4727 strftime_l(buf, 100, f, &t, __loc_); | 4772 strftime_l(buf, countof(buf), f, &t, __loc_); |
4728 wchar_t wbuf[100]; 4729 wchar_t* wbb = wbuf; 4730 mbstate_t mb = {0}; 4731 const char* bb = buf; 4732#ifdef _LIBCPP_LOCALE__L_EXTENSIONS | 4773 wchar_t wbuf[100]; 4774 wchar_t* wbb = wbuf; 4775 mbstate_t mb = {0}; 4776 const char* bb = buf; 4777#ifdef _LIBCPP_LOCALE__L_EXTENSIONS |
4733 size_t j = mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); | 4778 size_t j = mbsrtowcs_l( wbb, &bb, countof(wbuf), &mb, __loc_); |
4734#else | 4779#else |
4735 size_t j = __mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); | 4780 size_t j = __mbsrtowcs_l( wbb, &bb, countof(wbuf), &mb, __loc_); |
4736#endif 4737 if (j == size_t(-1)) 4738 __throw_runtime_error("locale not supported"); 4739 wchar_t* wbe = wbb + j; 4740 wstring result; 4741 while (wbb != wbe) 4742 { 4743 if (ct.is(ctype_base::space, *wbb)) --- 121 unchanged lines hidden (view full) --- 4865__time_get_storage<char>::init(const ctype<char>& ct) 4866{ 4867 tm t = {0}; 4868 char buf[100]; 4869 // __weeks_ 4870 for (int i = 0; i < 7; ++i) 4871 { 4872 t.tm_wday = i; | 4781#endif 4782 if (j == size_t(-1)) 4783 __throw_runtime_error("locale not supported"); 4784 wchar_t* wbe = wbb + j; 4785 wstring result; 4786 while (wbb != wbe) 4787 { 4788 if (ct.is(ctype_base::space, *wbb)) --- 121 unchanged lines hidden (view full) --- 4910__time_get_storage<char>::init(const ctype<char>& ct) 4911{ 4912 tm t = {0}; 4913 char buf[100]; 4914 // __weeks_ 4915 for (int i = 0; i < 7; ++i) 4916 { 4917 t.tm_wday = i; |
4873 strftime_l(buf, 100, "%A", &t, __loc_); | 4918 strftime_l(buf, countof(buf), "%A", &t, __loc_); |
4874 __weeks_[i] = buf; | 4919 __weeks_[i] = buf; |
4875 strftime_l(buf, 100, "%a", &t, __loc_); | 4920 strftime_l(buf, countof(buf), "%a", &t, __loc_); |
4876 __weeks_[i+7] = buf; 4877 } 4878 // __months_ 4879 for (int i = 0; i < 12; ++i) 4880 { 4881 t.tm_mon = i; | 4921 __weeks_[i+7] = buf; 4922 } 4923 // __months_ 4924 for (int i = 0; i < 12; ++i) 4925 { 4926 t.tm_mon = i; |
4882 strftime_l(buf, 100, "%B", &t, __loc_); | 4927 strftime_l(buf, countof(buf), "%B", &t, __loc_); |
4883 __months_[i] = buf; | 4928 __months_[i] = buf; |
4884 strftime_l(buf, 100, "%b", &t, __loc_); | 4929 strftime_l(buf, countof(buf), "%b", &t, __loc_); |
4885 __months_[i+12] = buf; 4886 } 4887 // __am_pm_ 4888 t.tm_hour = 1; | 4930 __months_[i+12] = buf; 4931 } 4932 // __am_pm_ 4933 t.tm_hour = 1; |
4889 strftime_l(buf, 100, "%p", &t, __loc_); | 4934 strftime_l(buf, countof(buf), "%p", &t, __loc_); |
4890 __am_pm_[0] = buf; 4891 t.tm_hour = 13; | 4935 __am_pm_[0] = buf; 4936 t.tm_hour = 13; |
4892 strftime_l(buf, 100, "%p", &t, __loc_); | 4937 strftime_l(buf, countof(buf), "%p", &t, __loc_); |
4893 __am_pm_[1] = buf; 4894 __c_ = __analyze('c', ct); 4895 __r_ = __analyze('r', ct); 4896 __x_ = __analyze('x', ct); 4897 __X_ = __analyze('X', ct); 4898} 4899 4900template <> 4901void 4902__time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) 4903{ 4904 tm t = {0}; 4905 char buf[100]; | 4938 __am_pm_[1] = buf; 4939 __c_ = __analyze('c', ct); 4940 __r_ = __analyze('r', ct); 4941 __x_ = __analyze('x', ct); 4942 __X_ = __analyze('X', ct); 4943} 4944 4945template <> 4946void 4947__time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) 4948{ 4949 tm t = {0}; 4950 char buf[100]; |
4906 size_t be; | |
4907 wchar_t wbuf[100]; 4908 wchar_t* wbe; 4909 mbstate_t mb = {0}; 4910 // __weeks_ 4911 for (int i = 0; i < 7; ++i) 4912 { 4913 t.tm_wday = i; | 4951 wchar_t wbuf[100]; 4952 wchar_t* wbe; 4953 mbstate_t mb = {0}; 4954 // __weeks_ 4955 for (int i = 0; i < 7; ++i) 4956 { 4957 t.tm_wday = i; |
4914 be = strftime_l(buf, 100, "%A", &t, __loc_); | 4958 strftime_l(buf, countof(buf), "%A", &t, __loc_); |
4915 mb = mbstate_t(); 4916 const char* bb = buf; 4917#ifdef _LIBCPP_LOCALE__L_EXTENSIONS | 4959 mb = mbstate_t(); 4960 const char* bb = buf; 4961#ifdef _LIBCPP_LOCALE__L_EXTENSIONS |
4918 size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); | 4962 size_t j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); |
4919#else | 4963#else |
4920 size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); | 4964 size_t j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); |
4921#endif 4922 if (j == size_t(-1)) 4923 __throw_runtime_error("locale not supported"); 4924 wbe = wbuf + j; 4925 __weeks_[i].assign(wbuf, wbe); | 4965#endif 4966 if (j == size_t(-1)) 4967 __throw_runtime_error("locale not supported"); 4968 wbe = wbuf + j; 4969 __weeks_[i].assign(wbuf, wbe); |
4926 be = strftime_l(buf, 100, "%a", &t, __loc_); | 4970 strftime_l(buf, countof(buf), "%a", &t, __loc_); |
4927 mb = mbstate_t(); 4928 bb = buf; 4929#ifdef _LIBCPP_LOCALE__L_EXTENSIONS | 4971 mb = mbstate_t(); 4972 bb = buf; 4973#ifdef _LIBCPP_LOCALE__L_EXTENSIONS |
4930 j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); | 4974 j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); |
4931#else | 4975#else |
4932 j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); | 4976 j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); |
4933#endif 4934 if (j == size_t(-1)) 4935 __throw_runtime_error("locale not supported"); 4936 wbe = wbuf + j; 4937 __weeks_[i+7].assign(wbuf, wbe); 4938 } 4939 // __months_ 4940 for (int i = 0; i < 12; ++i) 4941 { 4942 t.tm_mon = i; | 4977#endif 4978 if (j == size_t(-1)) 4979 __throw_runtime_error("locale not supported"); 4980 wbe = wbuf + j; 4981 __weeks_[i+7].assign(wbuf, wbe); 4982 } 4983 // __months_ 4984 for (int i = 0; i < 12; ++i) 4985 { 4986 t.tm_mon = i; |
4943 be = strftime_l(buf, 100, "%B", &t, __loc_); | 4987 strftime_l(buf, countof(buf), "%B", &t, __loc_); |
4944 mb = mbstate_t(); 4945 const char* bb = buf; 4946#ifdef _LIBCPP_LOCALE__L_EXTENSIONS | 4988 mb = mbstate_t(); 4989 const char* bb = buf; 4990#ifdef _LIBCPP_LOCALE__L_EXTENSIONS |
4947 size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); | 4991 size_t j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); |
4948#else | 4992#else |
4949 size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); | 4993 size_t j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); |
4950#endif 4951 if (j == size_t(-1)) 4952 __throw_runtime_error("locale not supported"); 4953 wbe = wbuf + j; 4954 __months_[i].assign(wbuf, wbe); | 4994#endif 4995 if (j == size_t(-1)) 4996 __throw_runtime_error("locale not supported"); 4997 wbe = wbuf + j; 4998 __months_[i].assign(wbuf, wbe); |
4955 be = strftime_l(buf, 100, "%b", &t, __loc_); | 4999 strftime_l(buf, countof(buf), "%b", &t, __loc_); |
4956 mb = mbstate_t(); 4957 bb = buf; 4958#ifdef _LIBCPP_LOCALE__L_EXTENSIONS | 5000 mb = mbstate_t(); 5001 bb = buf; 5002#ifdef _LIBCPP_LOCALE__L_EXTENSIONS |
4959 j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); | 5003 j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); |
4960#else | 5004#else |
4961 j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); | 5005 j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); |
4962#endif 4963 if (j == size_t(-1)) 4964 __throw_runtime_error("locale not supported"); 4965 wbe = wbuf + j; 4966 __months_[i+12].assign(wbuf, wbe); 4967 } 4968 // __am_pm_ 4969 t.tm_hour = 1; | 5006#endif 5007 if (j == size_t(-1)) 5008 __throw_runtime_error("locale not supported"); 5009 wbe = wbuf + j; 5010 __months_[i+12].assign(wbuf, wbe); 5011 } 5012 // __am_pm_ 5013 t.tm_hour = 1; |
4970 be = strftime_l(buf, 100, "%p", &t, __loc_); | 5014 strftime_l(buf, countof(buf), "%p", &t, __loc_); |
4971 mb = mbstate_t(); 4972 const char* bb = buf; 4973#ifdef _LIBCPP_LOCALE__L_EXTENSIONS | 5015 mb = mbstate_t(); 5016 const char* bb = buf; 5017#ifdef _LIBCPP_LOCALE__L_EXTENSIONS |
4974 size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); | 5018 size_t j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); |
4975#else | 5019#else |
4976 size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); | 5020 size_t j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); |
4977#endif 4978 if (j == size_t(-1)) 4979 __throw_runtime_error("locale not supported"); 4980 wbe = wbuf + j; 4981 __am_pm_[0].assign(wbuf, wbe); 4982 t.tm_hour = 13; | 5021#endif 5022 if (j == size_t(-1)) 5023 __throw_runtime_error("locale not supported"); 5024 wbe = wbuf + j; 5025 __am_pm_[0].assign(wbuf, wbe); 5026 t.tm_hour = 13; |
4983 be = strftime_l(buf, 100, "%p", &t, __loc_); | 5027 strftime_l(buf, countof(buf), "%p", &t, __loc_); |
4984 mb = mbstate_t(); 4985 bb = buf; 4986#ifdef _LIBCPP_LOCALE__L_EXTENSIONS | 5028 mb = mbstate_t(); 5029 bb = buf; 5030#ifdef _LIBCPP_LOCALE__L_EXTENSIONS |
4987 j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); | 5031 j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); |
4988#else | 5032#else |
4989 j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); | 5033 j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); |
4990#endif 4991 if (j == size_t(-1)) 4992 __throw_runtime_error("locale not supported"); 4993 wbe = wbuf + j; 4994 __am_pm_[1].assign(wbuf, wbe); 4995 __c_ = __analyze('c', ct); 4996 __r_ = __analyze('r', ct); 4997 __x_ = __analyze('x', ct); --- 246 unchanged lines hidden (view full) --- 5244 5245void 5246__time_put::__do_put(char* __nb, char*& __ne, const tm* __tm, 5247 char __fmt, char __mod) const 5248{ 5249 char fmt[] = {'%', __fmt, __mod, 0}; 5250 if (__mod != 0) 5251 swap(fmt[1], fmt[2]); | 5034#endif 5035 if (j == size_t(-1)) 5036 __throw_runtime_error("locale not supported"); 5037 wbe = wbuf + j; 5038 __am_pm_[1].assign(wbuf, wbe); 5039 __c_ = __analyze('c', ct); 5040 __r_ = __analyze('r', ct); 5041 __x_ = __analyze('x', ct); --- 246 unchanged lines hidden (view full) --- 5288 5289void 5290__time_put::__do_put(char* __nb, char*& __ne, const tm* __tm, 5291 char __fmt, char __mod) const 5292{ 5293 char fmt[] = {'%', __fmt, __mod, 0}; 5294 if (__mod != 0) 5295 swap(fmt[1], fmt[2]); |
5252 size_t n = strftime_l(__nb, static_cast<size_t>(__ne-__nb), fmt, __tm, __loc_); | 5296 size_t n = strftime_l(__nb, countof(__nb, __ne), fmt, __tm, __loc_); |
5253 __ne = __nb + n; 5254} 5255 5256void 5257__time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm, 5258 char __fmt, char __mod) const 5259{ 5260 char __nar[100]; 5261 char* __ne = __nar + 100; 5262 __do_put(__nar, __ne, __tm, __fmt, __mod); 5263 mbstate_t mb = {0}; 5264 const char* __nb = __nar; 5265#ifdef _LIBCPP_LOCALE__L_EXTENSIONS | 5297 __ne = __nb + n; 5298} 5299 5300void 5301__time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm, 5302 char __fmt, char __mod) const 5303{ 5304 char __nar[100]; 5305 char* __ne = __nar + 100; 5306 __do_put(__nar, __ne, __tm, __fmt, __mod); 5307 mbstate_t mb = {0}; 5308 const char* __nb = __nar; 5309#ifdef _LIBCPP_LOCALE__L_EXTENSIONS |
5266 size_t j = mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_); | 5310 size_t j = mbsrtowcs_l(__wb, &__nb, countof(__wb, __we), &mb, __loc_); |
5267#else | 5311#else |
5268 size_t j = __mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_); | 5312 size_t j = __mbsrtowcs_l(__wb, &__nb, countof(__wb, __we), &mb, __loc_); |
5269#endif 5270 if (j == size_t(-1)) 5271 __throw_runtime_error("locale not supported"); 5272 __we = __wb + j; 5273} 5274 5275// moneypunct_byname 5276 --- 506 unchanged lines hidden (view full) --- 5783 __thousands_sep_ = static_cast<wchar_t>(*lc->mon_thousands_sep); 5784 else 5785 __thousands_sep_ = base::do_thousands_sep(); 5786 __grouping_ = lc->mon_grouping; 5787 wchar_t wbuf[100]; 5788 mbstate_t mb = {0}; 5789 const char* bb = lc->currency_symbol; 5790#ifdef _LIBCPP_LOCALE__L_EXTENSIONS | 5313#endif 5314 if (j == size_t(-1)) 5315 __throw_runtime_error("locale not supported"); 5316 __we = __wb + j; 5317} 5318 5319// moneypunct_byname 5320 --- 506 unchanged lines hidden (view full) --- 5827 __thousands_sep_ = static_cast<wchar_t>(*lc->mon_thousands_sep); 5828 else 5829 __thousands_sep_ = base::do_thousands_sep(); 5830 __grouping_ = lc->mon_grouping; 5831 wchar_t wbuf[100]; 5832 mbstate_t mb = {0}; 5833 const char* bb = lc->currency_symbol; 5834#ifdef _LIBCPP_LOCALE__L_EXTENSIONS |
5791 size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); | 5835 size_t j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); |
5792#else | 5836#else |
5793 size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); | 5837 size_t j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); |
5794#endif 5795 if (j == size_t(-1)) 5796 __throw_runtime_error("locale not supported"); 5797 wchar_t* wbe = wbuf + j; 5798 __curr_symbol_.assign(wbuf, wbe); 5799 if (lc->frac_digits != CHAR_MAX) 5800 __frac_digits_ = lc->frac_digits; 5801 else 5802 __frac_digits_ = base::do_frac_digits(); 5803 if (lc->p_sign_posn == 0) 5804 __positive_sign_ = L"()"; 5805 else 5806 { 5807 mb = mbstate_t(); 5808 bb = lc->positive_sign; 5809#ifdef _LIBCPP_LOCALE__L_EXTENSIONS | 5838#endif 5839 if (j == size_t(-1)) 5840 __throw_runtime_error("locale not supported"); 5841 wchar_t* wbe = wbuf + j; 5842 __curr_symbol_.assign(wbuf, wbe); 5843 if (lc->frac_digits != CHAR_MAX) 5844 __frac_digits_ = lc->frac_digits; 5845 else 5846 __frac_digits_ = base::do_frac_digits(); 5847 if (lc->p_sign_posn == 0) 5848 __positive_sign_ = L"()"; 5849 else 5850 { 5851 mb = mbstate_t(); 5852 bb = lc->positive_sign; 5853#ifdef _LIBCPP_LOCALE__L_EXTENSIONS |
5810 j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); | 5854 j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); |
5811#else | 5855#else |
5812 j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); | 5856 j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); |
5813#endif 5814 if (j == size_t(-1)) 5815 __throw_runtime_error("locale not supported"); 5816 wbe = wbuf + j; 5817 __positive_sign_.assign(wbuf, wbe); 5818 } 5819 if (lc->n_sign_posn == 0) 5820 __negative_sign_ = L"()"; 5821 else 5822 { 5823 mb = mbstate_t(); 5824 bb = lc->negative_sign; 5825#ifdef _LIBCPP_LOCALE__L_EXTENSIONS | 5857#endif 5858 if (j == size_t(-1)) 5859 __throw_runtime_error("locale not supported"); 5860 wbe = wbuf + j; 5861 __positive_sign_.assign(wbuf, wbe); 5862 } 5863 if (lc->n_sign_posn == 0) 5864 __negative_sign_ = L"()"; 5865 else 5866 { 5867 mb = mbstate_t(); 5868 bb = lc->negative_sign; 5869#ifdef _LIBCPP_LOCALE__L_EXTENSIONS |
5826 j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); | 5870 j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); |
5827#else | 5871#else |
5828 j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); | 5872 j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); |
5829#endif 5830 if (j == size_t(-1)) 5831 __throw_runtime_error("locale not supported"); 5832 wbe = wbuf + j; 5833 __negative_sign_.assign(wbuf, wbe); 5834 } 5835 // Assume the positive and negative formats will want spaces in 5836 // the same places in curr_symbol since there's no way to --- 29 unchanged lines hidden (view full) --- 5866 __thousands_sep_ = static_cast<wchar_t>(*lc->mon_thousands_sep); 5867 else 5868 __thousands_sep_ = base::do_thousands_sep(); 5869 __grouping_ = lc->mon_grouping; 5870 wchar_t wbuf[100]; 5871 mbstate_t mb = {0}; 5872 const char* bb = lc->int_curr_symbol; 5873#ifdef _LIBCPP_LOCALE__L_EXTENSIONS | 5873#endif 5874 if (j == size_t(-1)) 5875 __throw_runtime_error("locale not supported"); 5876 wbe = wbuf + j; 5877 __negative_sign_.assign(wbuf, wbe); 5878 } 5879 // Assume the positive and negative formats will want spaces in 5880 // the same places in curr_symbol since there's no way to --- 29 unchanged lines hidden (view full) --- 5910 __thousands_sep_ = static_cast<wchar_t>(*lc->mon_thousands_sep); 5911 else 5912 __thousands_sep_ = base::do_thousands_sep(); 5913 __grouping_ = lc->mon_grouping; 5914 wchar_t wbuf[100]; 5915 mbstate_t mb = {0}; 5916 const char* bb = lc->int_curr_symbol; 5917#ifdef _LIBCPP_LOCALE__L_EXTENSIONS |
5874 size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); | 5918 size_t j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); |
5875#else | 5919#else |
5876 size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); | 5920 size_t j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); |
5877#endif 5878 if (j == size_t(-1)) 5879 __throw_runtime_error("locale not supported"); 5880 wchar_t* wbe = wbuf + j; 5881 __curr_symbol_.assign(wbuf, wbe); 5882 if (lc->int_frac_digits != CHAR_MAX) 5883 __frac_digits_ = lc->int_frac_digits; 5884 else --- 4 unchanged lines hidden (view full) --- 5889 if (lc->int_p_sign_posn == 0) 5890#endif // _WIN32 5891 __positive_sign_ = L"()"; 5892 else 5893 { 5894 mb = mbstate_t(); 5895 bb = lc->positive_sign; 5896#ifdef _LIBCPP_LOCALE__L_EXTENSIONS | 5921#endif 5922 if (j == size_t(-1)) 5923 __throw_runtime_error("locale not supported"); 5924 wchar_t* wbe = wbuf + j; 5925 __curr_symbol_.assign(wbuf, wbe); 5926 if (lc->int_frac_digits != CHAR_MAX) 5927 __frac_digits_ = lc->int_frac_digits; 5928 else --- 4 unchanged lines hidden (view full) --- 5933 if (lc->int_p_sign_posn == 0) 5934#endif // _WIN32 5935 __positive_sign_ = L"()"; 5936 else 5937 { 5938 mb = mbstate_t(); 5939 bb = lc->positive_sign; 5940#ifdef _LIBCPP_LOCALE__L_EXTENSIONS |
5897 j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); | 5941 j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); |
5898#else | 5942#else |
5899 j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); | 5943 j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); |
5900#endif 5901 if (j == size_t(-1)) 5902 __throw_runtime_error("locale not supported"); 5903 wbe = wbuf + j; 5904 __positive_sign_.assign(wbuf, wbe); 5905 } 5906#if _WIN32 5907 if (lc->n_sign_posn == 0) 5908#else // _WIN32 5909 if (lc->int_n_sign_posn == 0) 5910#endif // _WIN32 5911 __negative_sign_ = L"()"; 5912 else 5913 { 5914 mb = mbstate_t(); 5915 bb = lc->negative_sign; 5916#ifdef _LIBCPP_LOCALE__L_EXTENSIONS | 5944#endif 5945 if (j == size_t(-1)) 5946 __throw_runtime_error("locale not supported"); 5947 wbe = wbuf + j; 5948 __positive_sign_.assign(wbuf, wbe); 5949 } 5950#if _WIN32 5951 if (lc->n_sign_posn == 0) 5952#else // _WIN32 5953 if (lc->int_n_sign_posn == 0) 5954#endif // _WIN32 5955 __negative_sign_ = L"()"; 5956 else 5957 { 5958 mb = mbstate_t(); 5959 bb = lc->negative_sign; 5960#ifdef _LIBCPP_LOCALE__L_EXTENSIONS |
5917 j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); | 5961 j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); |
5918#else | 5962#else |
5919 j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); | 5963 j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); |
5920#endif 5921 if (j == size_t(-1)) 5922 __throw_runtime_error("locale not supported"); 5923 wbe = wbuf + j; 5924 __negative_sign_.assign(wbuf, wbe); 5925 } 5926 // Assume the positive and negative formats will want spaces in 5927 // the same places in curr_symbol since there's no way to --- 89 unchanged lines hidden --- | 5964#endif 5965 if (j == size_t(-1)) 5966 __throw_runtime_error("locale not supported"); 5967 wbe = wbuf + j; 5968 __negative_sign_.assign(wbuf, wbe); 5969 } 5970 // Assume the positive and negative formats will want spaces in 5971 // the same places in curr_symbol since there's no way to --- 89 unchanged lines hidden --- |