Piotr Caban : msvcp90: Added _Locinfo constructor implementation.

Alexandre Julliard julliard at winehq.org
Tue Dec 6 15:46:18 CST 2011


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Tue Dec  6 12:48:46 2011 +0100

msvcp90: Added _Locinfo constructor implementation.

---

 dlls/msvcp90/locale.c  |   84 ++++++++++++++++++++++++++++++-----------------
 dlls/msvcp90/msvcp90.h |    2 +-
 dlls/msvcp90/string.c  |    4 +-
 3 files changed, 56 insertions(+), 34 deletions(-)

diff --git a/dlls/msvcp90/locale.c b/dlls/msvcp90/locale.c
index e928d3e..2614724 100644
--- a/dlls/msvcp90/locale.c
+++ b/dlls/msvcp90/locale.c
@@ -712,29 +712,35 @@ void* __thiscall _Timevec__Getptr(_Timevec *this)
     return this->timeptr;
 }
 
-/* ?_Locinfo_ctor at _Locinfo@std@@SAXPAV12 at ABV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@2@@Z */
-/* ?_Locinfo_ctor at _Locinfo@std@@SAXPEAV12 at AEBV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@2@@Z */
-_Locinfo* __cdecl _Locinfo__Locinfo_ctor_bstr(_Locinfo *locinfo, const basic_string_char *locstr)
-{
-    FIXME("(%p %p) stub\n", locinfo, locstr);
-    return NULL;
-}
-
-/* ??0_Locinfo at std@@QAE at ABV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@1@@Z */
-/* ??0_Locinfo at std@@QEAA at AEBV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@1@@Z */
-DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_bstr, 8)
-_Locinfo* __thiscall _Locinfo_ctor_bstr(_Locinfo *this, const basic_string_char *locstr)
-{
-    FIXME("(%p %p) stub\n", this, locstr);
-    return NULL;
-}
-
 /* ?_Locinfo_ctor at _Locinfo@std@@SAXPAV12 at HPBD@Z */
 /* ?_Locinfo_ctor at _Locinfo@std@@SAXPEAV12 at HPEBD@Z */
 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cat_cstr(_Locinfo *locinfo, int category, const char *locstr)
 {
-    FIXME("(%p %d %s) stub\n", locinfo, category, locstr);
-    return NULL;
+    const char *locale = NULL;
+
+    /* This function is probably modifying more global objects */
+    FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
+
+    if(!locstr)
+        throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
+
+    _Lockit_ctor_locktype(&locinfo->lock, _LOCK_LOCALE);
+    MSVCP_basic_string_char_ctor_cstr(&locinfo->days, "");
+    MSVCP_basic_string_char_ctor_cstr(&locinfo->months, "");
+    MSVCP_basic_string_char_ctor_cstr(&locinfo->oldlocname, setlocale(LC_ALL, NULL));
+
+    if(category)
+        locale = setlocale(LC_ALL, locstr);
+    else
+        locale = setlocale(LC_ALL, NULL);
+
+    if(locale)
+        MSVCP_basic_string_char_ctor_cstr(&locinfo->newlocname, locale);
+    else
+        MSVCP_basic_string_char_ctor_cstr(&locinfo->newlocname, "*");
+    _Lockit_dtor(&locinfo->lock);
+
+    return locinfo;
 }
 
 /* ??0_Locinfo at std@@QAE at HPBD@Z */
@@ -742,16 +748,29 @@ _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cat_cstr(_Locinfo *locinfo, int categor
 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cat_cstr, 12)
 _Locinfo* __thiscall _Locinfo_ctor_cat_cstr(_Locinfo *this, int category, const char *locstr)
 {
-    FIXME("(%p %d %s) stub\n", this, category, locstr);
-    return NULL;
+    return _Locinfo__Locinfo_ctor_cat_cstr(this, category, locstr);
+}
+
+/* ?_Locinfo_ctor at _Locinfo@std@@SAXPAV12 at ABV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@2@@Z */
+/* ?_Locinfo_ctor at _Locinfo@std@@SAXPEAV12 at AEBV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@2@@Z */
+_Locinfo* __cdecl _Locinfo__Locinfo_ctor_bstr(_Locinfo *locinfo, const basic_string_char *locstr)
+{
+    return _Locinfo__Locinfo_ctor_cat_cstr(locinfo, 1/*FIXME*/, MSVCP_basic_string_char_c_str(locstr));
+}
+
+/* ??0_Locinfo at std@@QAE at ABV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@1@@Z */
+/* ??0_Locinfo at std@@QEAA at AEBV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@1@@Z */
+DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_bstr, 8)
+_Locinfo* __thiscall _Locinfo_ctor_bstr(_Locinfo *this, const basic_string_char *locstr)
+{
+    return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, MSVCP_basic_string_char_c_str(locstr));
 }
 
 /* ?_Locinfo_ctor at _Locinfo@std@@SAXPAV12 at PBD@Z */
 /* ?_Locinfo_ctor at _Locinfo@std@@SAXPEAV12 at PEBD@Z */
 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cstr(_Locinfo *locinfo, const char *locstr)
 {
-    FIXME("(%p %s) stub\n", locinfo, locstr);
-    return NULL;
+    return _Locinfo__Locinfo_ctor_cat_cstr(locinfo, 1/*FIXME*/, locstr);
 }
 
 /* ??0_Locinfo at std@@QAE at PBD@Z */
@@ -759,16 +778,20 @@ _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cstr(_Locinfo *locinfo, const char *loc
 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cstr, 8)
 _Locinfo* __thiscall _Locinfo_ctor_cstr(_Locinfo *this, const char *locstr)
 {
-    FIXME("(%p %s) stub\n", this, locstr);
-    return NULL;
+    return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, locstr);
 }
 
 /* ?_Locinfo_dtor at _Locinfo@std@@SAXPAV12@@Z */
 /* ?_Locinfo_dtor at _Locinfo@std@@SAXPEAV12@@Z */
-_Locinfo* __cdecl _Locinfo__Locinfo_dtor(_Locinfo *locinfo)
+void __cdecl _Locinfo__Locinfo_dtor(_Locinfo *locinfo)
 {
-    FIXME("(%p) stub\n", locinfo);
-    return NULL;
+    TRACE("(%p)\n", locinfo);
+
+    setlocale(LC_ALL, MSVCP_basic_string_char_c_str(&locinfo->oldlocname));
+    MSVCP_basic_string_char_dtor(&locinfo->days);
+    MSVCP_basic_string_char_dtor(&locinfo->months);
+    MSVCP_basic_string_char_dtor(&locinfo->oldlocname);
+    MSVCP_basic_string_char_dtor(&locinfo->newlocname);
 }
 
 /* ??_F_Locinfo at std@@QAEXXZ */
@@ -776,8 +799,7 @@ _Locinfo* __cdecl _Locinfo__Locinfo_dtor(_Locinfo *locinfo)
 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor, 4)
 _Locinfo* __thiscall _Locinfo_ctor(_Locinfo *this)
 {
-    FIXME("(%p) stub\n", this);
-    return NULL;
+    return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, "C");
 }
 
 /* ??1_Locinfo at std@@QAE at XZ */
@@ -785,7 +807,7 @@ _Locinfo* __thiscall _Locinfo_ctor(_Locinfo *this)
 DEFINE_THISCALL_WRAPPER(_Locinfo_dtor, 4)
 void __thiscall _Locinfo_dtor(_Locinfo *this)
 {
-    FIXME("(%p) stub\n", this);
+    _Locinfo__Locinfo_dtor(this);
 }
 
 /* ?_Locinfo_Addcats at _Locinfo@std@@SAAAV12 at PAV12@HPBD at Z */
diff --git a/dlls/msvcp90/msvcp90.h b/dlls/msvcp90/msvcp90.h
index 72e5d11..ed66d23 100644
--- a/dlls/msvcp90/msvcp90.h
+++ b/dlls/msvcp90/msvcp90.h
@@ -172,7 +172,7 @@ typedef struct _basic_string_char
 basic_string_char* __stdcall MSVCP_basic_string_char_ctor_cstr(basic_string_char*, const char*);
 basic_string_char* __stdcall MSVCP_basic_string_char_copy_ctor(basic_string_char*, const basic_string_char*);
 void __stdcall MSVCP_basic_string_char_dtor(basic_string_char*);
-const char* __stdcall MSVCP_basic_string_char_c_str(basic_string_char*);
+const char* __stdcall MSVCP_basic_string_char_c_str(const basic_string_char*);
 
 #define BUF_SIZE_WCHAR 8
 typedef struct _basic_string_wchar
diff --git a/dlls/msvcp90/string.c b/dlls/msvcp90/string.c
index 19459c1..906a99c 100644
--- a/dlls/msvcp90/string.c
+++ b/dlls/msvcp90/string.c
@@ -882,7 +882,7 @@ MSVCP_size_t __thiscall basic_string_char_copy(const basic_string_char *this,
 /* ?data@?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QBEPBDXZ */
 /* ?data@?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QEBAPEBDXZ */
 DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_c_str, 4)
-const char* __thiscall MSVCP_basic_string_char_c_str(basic_string_char *this)
+const char* __thiscall MSVCP_basic_string_char_c_str(const basic_string_char *this)
 {
     TRACE("%p\n", this);
     return basic_string_char_const_ptr(this);
@@ -2724,7 +2724,7 @@ MSVCP_size_t __thiscall basic_string_wchar_copy(const basic_string_wchar *this,
 /* ?data@?$basic_string at GU?$char_traits at G@std@@V?$allocator at G@2@@std@@QBEPBGXZ */
 /* ?data@?$basic_string at GU?$char_traits at G@std@@V?$allocator at G@2@@std@@QEBAPEBGXZ */
 DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_c_str, 4)
-const wchar_t* __thiscall MSVCP_basic_string_wchar_c_str(basic_string_wchar *this)
+const wchar_t* __thiscall MSVCP_basic_string_wchar_c_str(const basic_string_wchar *this)
 {
     TRACE("%p\n", this);
     return basic_string_wchar_const_ptr(this);




More information about the wine-cvs mailing list