msvcr110: Fix __lc_time_data definition.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2016-01-20 11:42:08 +01:00 committed by Alexandre Julliard
parent 9189eb2208
commit d4450b9195
3 changed files with 32 additions and 4 deletions

View file

@ -1528,6 +1528,9 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
size += ret*sizeof(MSVCRT_wchar_t);
}
}
#if _MSVCR_VER >= 110
size += LCIDToLocaleName(lcid[MSVCRT_LC_TIME], NULL, 0, 0)*sizeof(MSVCRT_wchar_t);
#endif
locinfo->lc_time_curr = MSVCRT_malloc(size);
if(!locinfo->lc_time_curr) {
@ -1568,7 +1571,13 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
(MSVCRT_wchar_t*)&locinfo->lc_time_curr->data[ret], size-ret)*sizeof(MSVCRT_wchar_t);
}
}
#if _MSVCR_VER >= 110
locinfo->lc_time_curr->locname = (MSVCRT_wchar_t*)&locinfo->lc_time_curr->data[ret];
LCIDToLocaleName(lcid[MSVCRT_LC_TIME], locinfo->lc_time_curr->locname,
(size-ret)/sizeof(MSVCRT_wchar_t), 0);
#else
locinfo->lc_time_curr->lcid = lcid[MSVCRT_LC_TIME];
#endif
}
return locinfo;

View file

@ -132,7 +132,9 @@ typedef struct {
char *time;
} names;
} str;
#if _MSVCR_VER < 110
LCID lcid;
#endif
int unk[2];
union {
MSVCRT_wchar_t *wstr[43];
@ -148,6 +150,9 @@ typedef struct {
MSVCRT_wchar_t *time;
} names;
} wstr;
#if _MSVCR_VER >= 110
MSVCRT_wchar_t *locname;
#endif
char data[1];
} MSVCRT___lc_time_data;

View file

@ -946,6 +946,7 @@ static inline BOOL strftime_date(char *str, MSVCRT_size_t *pos, MSVCRT_size_t ma
char *format;
SYSTEMTIME st;
MSVCRT_size_t ret;
LCID lcid;
st.wYear = mstm->tm_year + 1900;
st.wMonth = mstm->tm_mon + 1;
@ -956,10 +957,16 @@ static inline BOOL strftime_date(char *str, MSVCRT_size_t *pos, MSVCRT_size_t ma
st.wSecond = mstm->tm_sec;
st.wMilliseconds = 0;
#if _MSVCR_VER < 110
lcid = time_data->lcid;
#else
lcid = LocaleNameToLCID(time_data->locname, 0);
#endif
format = alternate ? time_data->str.names.date : time_data->str.names.short_date;
ret = GetDateFormatA(time_data->lcid, 0, &st, format, NULL, 0);
ret = GetDateFormatA(lcid, 0, &st, format, NULL, 0);
if(ret && ret<max-*pos)
ret = GetDateFormatA(time_data->lcid, 0, &st, format, str+*pos, max-*pos);
ret = GetDateFormatA(lcid, 0, &st, format, str+*pos, max-*pos);
if(!ret) {
*str = 0;
*MSVCRT__errno() = MSVCRT_EINVAL;
@ -978,6 +985,7 @@ static inline BOOL strftime_time(char *str, MSVCRT_size_t *pos, MSVCRT_size_t ma
{
SYSTEMTIME st;
MSVCRT_size_t ret;
LCID lcid;
st.wYear = mstm->tm_year + 1900;
st.wMonth = mstm->tm_mon + 1;
@ -988,9 +996,15 @@ static inline BOOL strftime_time(char *str, MSVCRT_size_t *pos, MSVCRT_size_t ma
st.wSecond = mstm->tm_sec;
st.wMilliseconds = 0;
ret = GetTimeFormatA(time_data->lcid, 0, &st, time_data->str.names.time, NULL, 0);
#if _MSVCR_VER < 110
lcid = time_data->lcid;
#else
lcid = LocaleNameToLCID(time_data->locname, 0);
#endif
ret = GetTimeFormatA(lcid, 0, &st, time_data->str.names.time, NULL, 0);
if(ret && ret<max-*pos)
ret = GetTimeFormatA(time_data->lcid, 0, &st, time_data->str.names.time,
ret = GetTimeFormatA(lcid, 0, &st, time_data->str.names.time,
str+*pos, max-*pos);
if(!ret) {
*str = 0;