Skip to content

Commit 5bcbcae

Browse files
committed
Enforce std::time_base::mdy for "C" locale
1 parent 8b081e2 commit 5bcbcae

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: stl/src/xdateord.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@
1010
_EXTERN_C_UNLESS_PURE
1111

1212
_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Getdateorder() noexcept { // return date order for current locale
13-
wchar_t buf[2] = {0};
14-
GetLocaleInfoEx(___lc_locale_name_func()[LC_TIME], LOCALE_ILDATE, buf, static_cast<int>(std::size(buf)));
13+
wchar_t buf[2] = {0};
14+
const wchar_t* locale_name = ___lc_locale_name_func()[LC_TIME];
15+
if (locale_name == nullptr) {
16+
// Enforce std::time_base::mdy for "C" locale
17+
buf[0] = L'0';
18+
} else {
19+
GetLocaleInfoEx(locale_name, LOCALE_ILDATE, buf, static_cast<int>(std::size(buf)));
20+
}
1521

1622
switch (buf[0]) {
1723
case L'0':

0 commit comments

Comments
 (0)