@@ -56,19 +56,19 @@ namespace details
56
56
{
57
57
58
58
std::once_flag g_c_localeFlag;
59
- std::unique_ptr<scoped_c_thread_locale::locale_t , void (*)(scoped_c_thread_locale::locale_t *)> g_c_locale (nullptr , [](scoped_c_thread_locale::locale_t *){});
60
- scoped_c_thread_locale::locale_t scoped_c_thread_locale::c_locale ()
59
+ std::unique_ptr<scoped_c_thread_locale::xplat_locale , void (*)(scoped_c_thread_locale::xplat_locale *)> g_c_locale (nullptr , [](scoped_c_thread_locale::xplat_locale *){});
60
+ scoped_c_thread_locale::xplat_locale scoped_c_thread_locale::c_locale ()
61
61
{
62
62
std::call_once (g_c_localeFlag, [&]()
63
63
{
64
- scoped_c_thread_locale::locale_t *clocale = new scoped_c_thread_locale::locale_t ();
64
+ scoped_c_thread_locale::xplat_locale *clocale = new scoped_c_thread_locale::xplat_locale ();
65
65
#ifdef _MS_WINDOWS
66
66
*clocale = _create_locale (LC_ALL, " C" );
67
67
if (clocale == nullptr )
68
68
{
69
69
throw std::runtime_error (" Unable to create 'C' locale." );
70
70
}
71
- auto deleter = [](scoped_c_thread_locale::locale_t *clocale)
71
+ auto deleter = [](scoped_c_thread_locale::xplat_locale *clocale)
72
72
{
73
73
_free_locale (*clocale);
74
74
};
@@ -78,12 +78,12 @@ scoped_c_thread_locale::locale_t scoped_c_thread_locale::c_locale()
78
78
{
79
79
throw std::runtime_error (" Unable to create 'C' locale." );
80
80
}
81
- auto deleter = [](scoped_c_thread_locale::locale_t *clocale)
81
+ auto deleter = [](scoped_c_thread_locale::xplat_locale *clocale)
82
82
{
83
- freelocale (clocale);
83
+ freelocale (* clocale);
84
84
};
85
85
#endif
86
- g_c_locale = std::unique_ptr<scoped_c_thread_locale::locale_t , void (*)(scoped_c_thread_locale::locale_t *)>(clocale, deleter);
86
+ g_c_locale = std::unique_ptr<scoped_c_thread_locale::xplat_locale , void (*)(scoped_c_thread_locale::xplat_locale *)>(clocale, deleter);
87
87
});
88
88
return *g_c_locale;
89
89
}
@@ -98,7 +98,7 @@ scoped_c_thread_locale::scoped_c_thread_locale()
98
98
throw std::runtime_error (" Unable to retrieve current locale." );
99
99
}
100
100
101
- if (std::strcmp (prevLocale, " C" ) != 0 )
101
+ if (std::strcmp (prevLocale, " C" ) != 0 )
102
102
{
103
103
m_prevLocale = prevLocale;
104
104
m_prevThreadSetting = _configthreadlocale (_ENABLE_PER_THREAD_LOCALE);
@@ -116,26 +116,26 @@ scoped_c_thread_locale::scoped_c_thread_locale()
116
116
117
117
scoped_c_thread_locale::~scoped_c_thread_locale ()
118
118
{
119
- if (m_prevThreadSetting != -1 )
119
+ if (m_prevThreadSetting != -1 )
120
120
{
121
121
setlocale (LC_ALL, m_prevLocale.c_str ());
122
122
_configthreadlocale (m_prevThreadSetting);
123
123
}
124
124
}
125
125
#else
126
126
scoped_c_thread_locale::scoped_c_thread_locale ()
127
- : m_prevLocale(nullptr ), m_newLocale( nullptr )
127
+ : m_prevLocale(nullptr )
128
128
{
129
- char * prevLocale = setlocale (LC_ALL, nullptr );
130
- if (prevLocale == nullptr )
129
+ char *prevLocale = setlocale (LC_ALL, nullptr );
130
+ if (prevLocale == nullptr )
131
131
{
132
132
throw std::runtime_error (" Unable to retrieve current locale." );
133
133
}
134
134
135
- if (std::strcmp (prevLocale, " C" ) != 0 )
135
+ if (std::strcmp (prevLocale, " C" ) != 0 )
136
136
{
137
137
m_prevLocale = uselocale (c_locale ());
138
- if (m_prevLocale == nullptr )
138
+ if (m_prevLocale == nullptr )
139
139
{
140
140
throw std::runtime_error (" Unable to set locale" );
141
141
}
@@ -144,7 +144,7 @@ scoped_c_thread_locale::scoped_c_thread_locale()
144
144
145
145
scoped_c_thread_locale::~scoped_c_thread_locale ()
146
146
{
147
- if (m_prevLocale != nullptr )
147
+ if (m_prevLocale != nullptr )
148
148
{
149
149
uselocale (m_prevLocale);
150
150
}
0 commit comments