Commit d4450b91 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcr110: Fix __lc_time_data definition.

parent 9189eb22
...@@ -1528,6 +1528,9 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category, ...@@ -1528,6 +1528,9 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
size += ret*sizeof(MSVCRT_wchar_t); 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); locinfo->lc_time_curr = MSVCRT_malloc(size);
if(!locinfo->lc_time_curr) { if(!locinfo->lc_time_curr) {
...@@ -1568,7 +1571,13 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category, ...@@ -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); (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]; locinfo->lc_time_curr->lcid = lcid[MSVCRT_LC_TIME];
#endif
} }
return locinfo; return locinfo;
......
...@@ -132,7 +132,9 @@ typedef struct { ...@@ -132,7 +132,9 @@ typedef struct {
char *time; char *time;
} names; } names;
} str; } str;
#if _MSVCR_VER < 110
LCID lcid; LCID lcid;
#endif
int unk[2]; int unk[2];
union { union {
MSVCRT_wchar_t *wstr[43]; MSVCRT_wchar_t *wstr[43];
...@@ -148,6 +150,9 @@ typedef struct { ...@@ -148,6 +150,9 @@ typedef struct {
MSVCRT_wchar_t *time; MSVCRT_wchar_t *time;
} names; } names;
} wstr; } wstr;
#if _MSVCR_VER >= 110
MSVCRT_wchar_t *locname;
#endif
char data[1]; char data[1];
} MSVCRT___lc_time_data; } MSVCRT___lc_time_data;
......
...@@ -946,6 +946,7 @@ static inline BOOL strftime_date(char *str, MSVCRT_size_t *pos, MSVCRT_size_t ma ...@@ -946,6 +946,7 @@ static inline BOOL strftime_date(char *str, MSVCRT_size_t *pos, MSVCRT_size_t ma
char *format; char *format;
SYSTEMTIME st; SYSTEMTIME st;
MSVCRT_size_t ret; MSVCRT_size_t ret;
LCID lcid;
st.wYear = mstm->tm_year + 1900; st.wYear = mstm->tm_year + 1900;
st.wMonth = mstm->tm_mon + 1; 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 ...@@ -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.wSecond = mstm->tm_sec;
st.wMilliseconds = 0; 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; 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) 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) { if(!ret) {
*str = 0; *str = 0;
*MSVCRT__errno() = MSVCRT_EINVAL; *MSVCRT__errno() = MSVCRT_EINVAL;
...@@ -978,6 +985,7 @@ static inline BOOL strftime_time(char *str, MSVCRT_size_t *pos, MSVCRT_size_t ma ...@@ -978,6 +985,7 @@ static inline BOOL strftime_time(char *str, MSVCRT_size_t *pos, MSVCRT_size_t ma
{ {
SYSTEMTIME st; SYSTEMTIME st;
MSVCRT_size_t ret; MSVCRT_size_t ret;
LCID lcid;
st.wYear = mstm->tm_year + 1900; st.wYear = mstm->tm_year + 1900;
st.wMonth = mstm->tm_mon + 1; 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 ...@@ -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.wSecond = mstm->tm_sec;
st.wMilliseconds = 0; 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) 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); str+*pos, max-*pos);
if(!ret) { if(!ret) {
*str = 0; *str = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment