#include <corecrt_internal.h>
#include <locale.h>
#include <stdlib.h>
Go to the source code of this file.
◆ call_wsetlocale()
Definition at line 15 of file setlocale.cpp.
16{
17 if (narrow_locale == nullptr)
19
22
23 __crt_unique_heap_ptr<wchar_t> wide_locale(_calloc_crt_t(
wchar_t,
size));
24 if (wide_locale.get() == nullptr)
25 return nullptr;
26
28 return nullptr;
29
31}
#define _ERRCHECK_EINVAL_ERANGE(e)
_ACRTIMP errno_t __cdecl mbstowcs_s(size_t *, wchar_t *, size_t, const char *, size_t)
_ACRTIMP wchar_t *__cdecl _wsetlocale(int, const wchar_t *)
Referenced by setlocale().
◆ setlocale()
Definition at line 33 of file setlocale.cpp.
34{
35
37
39 {
40
42 if (outwlocale == nullptr)
43 {
44 return nullptr;
45 }
46
48
52
53
54
55
56
57
60 {
61 return nullptr;
62 }
63
64 long*
const refcount =
static_cast<long*
>(
_malloc_crt(
size +
sizeof(
long)));
65 if (refcount == nullptr)
66 {
67 return nullptr;
68 }
69
70 char* outlocale = reinterpret_cast<char*>(&refcount[1]);
71
72
74 {
76 return nullptr;
77 }
78
80
83
86 {
89 }
90
91 if (__acrt_should_sync_with_global_locale(
ptd))
92 {
95 {
98 }
99 }
100
101
102
103
104
105
106
107
108
109
110
111
115
116 return outlocale;
117 });
118}
__acrt_ptd *__cdecl __acrt_getptd(void)
void __cdecl __acrt_eagerly_load_locale_apis(void)
_In_ size_t const _In_ int _In_ bool const _In_ unsigned const _In_ __acrt_rounding_mode const _Inout_ __crt_cached_ptd_host & ptd
long __cdecl _InterlockedDecrement(_Interlocked_operand_ long volatile *_Addend)
static wchar_t *__cdecl call_wsetlocale(int const category, char const *const narrow_locale)
__crt_locale_refcount lc_category[6]