Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
426e58be
Commit
426e58be
authored
Apr 11, 2012
by
Piotr Caban
Committed by
Alexandre Julliard
Apr 11, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Set correct date and time format for C locale.
parent
2ca9a73a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
locale.c
dlls/msvcrt/locale.c
+36
-0
No files found.
dlls/msvcrt/locale.c
View file @
426e58be
...
...
@@ -761,6 +761,12 @@ MSVCRT__locale_t CDECL MSVCRT__create_locale(int category, const char *locale)
static
const
char
monetary
[]
=
"MONETARY="
;
static
const
char
numeric
[]
=
"NUMERIC="
;
static
const
char
time
[]
=
"TIME="
;
static
const
char
cloc_short_date
[]
=
"MM/dd/yy"
;
static
const
MSVCRT_wchar_t
cloc_short_dateW
[]
=
{
'M'
,
'M'
,
'/'
,
'd'
,
'd'
,
'/'
,
'y'
,
'y'
,
0
};
static
const
char
cloc_long_date
[]
=
"dddd, MMMM dd, yyyy"
;
static
const
MSVCRT_wchar_t
cloc_long_dateW
[]
=
{
'd'
,
'd'
,
'd'
,
'd'
,
','
,
' '
,
'M'
,
'M'
,
'M'
,
'M'
,
' '
,
'd'
,
'd'
,
','
,
' '
,
'y'
,
'y'
,
'y'
,
'y'
,
0
};
static
const
char
cloc_time
[]
=
"HH:mm:ss"
;
static
const
MSVCRT_wchar_t
cloc_timeW
[]
=
{
'H'
,
'H'
,
':'
,
'm'
,
'm'
,
':'
,
's'
,
's'
,
0
};
MSVCRT__locale_t
loc
;
LCID
lcid
[
6
]
=
{
0
};
...
...
@@ -1205,6 +1211,13 @@ MSVCRT__locale_t CDECL MSVCRT__create_locale(int category, const char *locale)
size
=
sizeof
(
MSVCRT___lc_time_data
);
for
(
i
=
0
;
i
<
sizeof
(
time_data
)
/
sizeof
(
time_data
[
0
]);
i
++
)
{
if
(
time_data
[
i
]
==
LOCALE_SSHORTDATE
&&
!
lcid
[
MSVCRT_LC_TIME
])
{
size
+=
sizeof
(
cloc_short_date
)
+
sizeof
(
cloc_short_dateW
);
}
else
if
(
time_data
[
i
]
==
LOCALE_SSHORTDATE
&&
!
lcid
[
MSVCRT_LC_TIME
])
{
size
+=
sizeof
(
cloc_long_date
)
+
sizeof
(
cloc_long_dateW
);
}
else
if
(
time_data
[
i
]
==
LOCALE_STIMEFORMAT
&&
!
lcid
[
MSVCRT_LC_TIME
])
{
size
+=
sizeof
(
cloc_time
)
+
sizeof
(
cloc_timeW
);
}
else
{
ret
=
GetLocaleInfoA
(
lcid
[
MSVCRT_LC_TIME
],
time_data
[
i
]
|
LOCALE_NOUSEROVERRIDE
,
NULL
,
0
);
if
(
!
ret
)
{
...
...
@@ -1221,6 +1234,7 @@ MSVCRT__locale_t CDECL MSVCRT__create_locale(int category, const char *locale)
}
size
+=
ret
*
sizeof
(
MSVCRT_wchar_t
);
}
}
loc
->
locinfo
->
lc_time_curr
=
MSVCRT_malloc
(
size
);
if
(
!
loc
->
locinfo
->
lc_time_curr
)
{
...
...
@@ -1231,14 +1245,36 @@ MSVCRT__locale_t CDECL MSVCRT__create_locale(int category, const char *locale)
ret
=
0
;
for
(
i
=
0
;
i
<
sizeof
(
time_data
)
/
sizeof
(
time_data
[
0
]);
i
++
)
{
loc
->
locinfo
->
lc_time_curr
->
str
[
i
]
=
&
loc
->
locinfo
->
lc_time_curr
->
data
[
ret
];
if
(
time_data
[
i
]
==
LOCALE_SSHORTDATE
&&
!
lcid
[
MSVCRT_LC_TIME
])
{
memcpy
(
&
loc
->
locinfo
->
lc_time_curr
->
data
[
ret
],
cloc_short_date
,
sizeof
(
cloc_short_date
));
ret
+=
sizeof
(
cloc_short_date
);
}
else
if
(
time_data
[
i
]
==
LOCALE_SSHORTDATE
&&
!
lcid
[
MSVCRT_LC_TIME
])
{
memcpy
(
&
loc
->
locinfo
->
lc_time_curr
->
data
[
ret
],
cloc_long_date
,
sizeof
(
cloc_long_date
));
ret
+=
sizeof
(
cloc_long_date
);
}
else
if
(
time_data
[
i
]
==
LOCALE_STIMEFORMAT
&&
!
lcid
[
MSVCRT_LC_TIME
])
{
memcpy
(
&
loc
->
locinfo
->
lc_time_curr
->
data
[
ret
],
cloc_time
,
sizeof
(
cloc_time
));
ret
+=
sizeof
(
cloc_time
);
}
else
{
ret
+=
GetLocaleInfoA
(
lcid
[
MSVCRT_LC_TIME
],
time_data
[
i
]
|
LOCALE_NOUSEROVERRIDE
,
&
loc
->
locinfo
->
lc_time_curr
->
data
[
ret
],
size
-
ret
);
}
}
for
(
i
=
0
;
i
<
sizeof
(
time_data
)
/
sizeof
(
time_data
[
0
]);
i
++
)
{
loc
->
locinfo
->
lc_time_curr
->
wstr
[
i
]
=
(
MSVCRT_wchar_t
*
)
&
loc
->
locinfo
->
lc_time_curr
->
data
[
ret
];
if
(
time_data
[
i
]
==
LOCALE_SSHORTDATE
&&
!
lcid
[
MSVCRT_LC_TIME
])
{
memcpy
(
&
loc
->
locinfo
->
lc_time_curr
->
data
[
ret
],
cloc_short_dateW
,
sizeof
(
cloc_short_dateW
));
ret
+=
sizeof
(
cloc_short_dateW
);
}
else
if
(
time_data
[
i
]
==
LOCALE_SSHORTDATE
&&
!
lcid
[
MSVCRT_LC_TIME
])
{
memcpy
(
&
loc
->
locinfo
->
lc_time_curr
->
data
[
ret
],
cloc_long_dateW
,
sizeof
(
cloc_long_dateW
));
ret
+=
sizeof
(
cloc_long_dateW
);
}
else
if
(
time_data
[
i
]
==
LOCALE_STIMEFORMAT
&&
!
lcid
[
MSVCRT_LC_TIME
])
{
memcpy
(
&
loc
->
locinfo
->
lc_time_curr
->
data
[
ret
],
cloc_timeW
,
sizeof
(
cloc_timeW
));
ret
+=
sizeof
(
cloc_timeW
);
}
else
{
ret
+=
GetLocaleInfoW
(
lcid
[
MSVCRT_LC_TIME
],
time_data
[
i
]
|
LOCALE_NOUSEROVERRIDE
,
(
MSVCRT_wchar_t
*
)
&
loc
->
locinfo
->
lc_time_curr
->
data
[
ret
],
size
-
ret
)
*
sizeof
(
MSVCRT_wchar_t
);
}
}
loc
->
locinfo
->
lc_time_curr
->
lcid
=
lcid
[
MSVCRT_LC_TIME
];
return
loc
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment