Piotr Caban : msvcrt: Added _Getmonths implementation.

Alexandre Julliard julliard at winehq.org
Wed Dec 7 13:57:14 CST 2011


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Dec  7 13:49:47 2011 +0100

msvcrt: Added _Getmonths implementation.

---

 dlls/msvcrt/locale.c |   35 ++++++++++++++++++++++++++++-------
 1 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c
index 00cb0a9..c3a1c4b 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -451,14 +451,35 @@ char* CDECL _Getdays(void)
 /*********************************************************************
  *		_Getmonths (MSVCRT.@)
  */
-const char* CDECL _Getmonths(void)
+char* CDECL _Getmonths(void)
 {
-  static const char MSVCRT_months[] = ":Jan:January:Feb:February:Mar:March:Apr:"
-                "April:May:May:Jun:June:Jul:July:Aug:August:Sep:September:Oct:"
-                "October:Nov:November:Dec:December";
-  /* FIXME: Use locale */
-  TRACE("(void) semi-stub\n");
-  return MSVCRT_months;
+    static const int months_offset = 14;
+
+    MSVCRT___lc_time_data *cur = get_locinfo()->lc_time_curr;
+    int i, len, size;
+    char *out;
+
+    TRACE("\n");
+
+    size = cur->str[months_offset+2*12]-cur->str[months_offset];
+    out = MSVCRT_malloc(size+1);
+    if(!out)
+        return NULL;
+
+    size = 0;
+    for(i=0; i<12; i++) {
+        out[size++] = ':';
+        len = strlen(cur->str[months_offset+i]);
+        memcpy(&out[size], cur->str[months_offset+i], len);
+        size += len;
+
+        out[size++] = ':';
+        len = strlen(cur->str[months_offset+12+i]);
+        memcpy(&out[size], cur->str[months_offset+12+i], len);
+        size += len;
+    }
+
+    return out;
 }
 
 /*********************************************************************




More information about the wine-cvs mailing list