Piotr Caban : msvcrt: Don't depend on how __lc_time_data was allocated in _W_Getdays.

Alexandre Julliard julliard at winehq.org
Wed Dec 4 16:13:04 CST 2019


Module: wine
Branch: master
Commit: 2d23512da1c4311b828eff9622a32d65102b2b63
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=2d23512da1c4311b828eff9622a32d65102b2b63

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Dec  4 15:30:03 2019 +0100

msvcrt: Don't depend on how __lc_time_data was allocated in _W_Getdays.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/locale.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c
index e0c6253044..617d1fffb3 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -494,11 +494,14 @@ MSVCRT_wchar_t* CDECL _W_Getdays(void)
 {
     MSVCRT___lc_time_data *cur = get_locinfo()->lc_time_curr;
     MSVCRT_wchar_t *out;
-    int i, len, size;
+    int i, len, size = 0;
 
     TRACE("\n");
 
-    size = cur->wstr.names.short_mon[0]-cur->wstr.names.short_wday[0];
+    for(i=0; i<7; i++) {
+        size += strlenW(cur->wstr.names.short_wday[i]) + 1;
+        size += strlenW(cur->wstr.names.wday[i]) + 1;
+    }
     out = MSVCRT_malloc((size+1)*sizeof(*out));
     if(!out)
         return NULL;




More information about the wine-cvs mailing list