78{
79 *static_cast<void**>(void_result) = nullptr;
80
82 {
83 char** const char_result = static_cast<char**>(void_result);
84
85 int const local_buffer_size = 128;
86 char local_buffer[local_buffer_size];
87
88 int const local_length = InternalGetLocaleInfoA(
90
91 if (local_length != 0)
92 {
93 *char_result = _calloc_crt_t(char, local_length).detach();
94 if (*char_result == nullptr)
95 return -1;
96
98 return 0;
99 }
100
102 return -1;
103
104
105
106 int const required_length = InternalGetLocaleInfoA(
108
109 if (required_length == 0)
110 return -1;
111
112 __crt_unique_heap_ptr<char> dynamic_buffer(_calloc_crt_t(char, required_length));
113 if (dynamic_buffer.get() == nullptr)
114 return -1;
115
116 int const actual_length = InternalGetLocaleInfoA(
118
119 if (actual_length == 0)
120 return -1;
121
122 *char_result = dynamic_buffer.detach();
123 return 0;
124 }
126 {
127 wchar_t** const wchar_result = static_cast<wchar_t**>(void_result);
128
130 if (required_length == 0)
131 return -1;
132
133 __crt_unique_heap_ptr<wchar_t> dynamic_buffer(_calloc_crt_t(wchar_t, required_length));
134 if (dynamic_buffer.get() == nullptr)
135 return -1;
136
139
140 if (actual_length == 0)
141 return -1;
142
143 *wchar_result = dynamic_buffer.detach();
144 return 0;
145 }
147 {
148 unsigned char* const uchar_result = static_cast<unsigned char*>(void_result);
149
154 reinterpret_cast<wchar_t*
>(&
value),
155 sizeof(
value) /
sizeof(
wchar_t));
156
157 if (actual_length == 0)
158 return -1;
159
160 *uchar_result =
static_cast<unsigned char>(
value);
161 return 0;
162 }
163
164 return -1;
165}
PCWSTR const LCTYPE const locale_type
int WINAPI __acrt_GetLocaleInfoEx(_In_opt_ LPCWSTR locale_name, _In_ LCTYPE lc_type, _Out_writes_opt_(data_count) LPWSTR data, _In_ int data_count)
#define ERROR_INSUFFICIENT_BUFFER
DWORD WINAPI GetLastError(void)