Piotr Caban : msvcr110: Fix __lc_time_data definition.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Apr 12 06:45:27 CDT 2016


Module: wine
Branch: stable
Commit: eccfab534130c95668d1d0f8d97934088d445f31
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=eccfab534130c95668d1d0f8d97934088d445f31

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Jan 20 11:42:08 2016 +0100

msvcr110: Fix __lc_time_data definition.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit d4450b9195bd2209f5a874b31e2e82420cf5dd38)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/msvcrt/locale.c |  9 +++++++++
 dlls/msvcrt/msvcrt.h |  5 +++++
 dlls/msvcrt/time.c   | 22 ++++++++++++++++++----
 3 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c
index b00bc78..e1a0fbe 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -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;
diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h
index e30e675..aff1741 100644
--- a/dlls/msvcrt/msvcrt.h
+++ b/dlls/msvcrt/msvcrt.h
@@ -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;
 
diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c
index 7fed3b3..50a27ec 100644
--- a/dlls/msvcrt/time.c
+++ b/dlls/msvcrt/time.c
@@ -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;




More information about the wine-cvs mailing list