Piotr Caban : msvcp90: Added locale_ctor_locale_cstr implementation.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Oct 6 15:19:10 CDT 2014


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Sat Oct  4 17:32:20 2014 +0200

msvcp90: Added locale_ctor_locale_cstr implementation.

---

 dlls/msvcp60/locale.c | 24 ++++++++++++++++++++++--
 dlls/msvcp90/locale.c | 24 ++++++++++++++++++++++--
 2 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/dlls/msvcp60/locale.c b/dlls/msvcp60/locale.c
index 326a51a..4828dd3 100644
--- a/dlls/msvcp60/locale.c
+++ b/dlls/msvcp60/locale.c
@@ -8218,8 +8218,28 @@ locale* __thiscall locale_copy_ctor(locale *this, const locale *copy)
 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_cstr, 16)
 locale* __thiscall locale_ctor_locale_cstr(locale *this, const locale *loc, const char *locname, category cat)
 {
-    FIXME("(%p %p %s %d) stub\n", this, loc, locname, cat);
-    return NULL;
+    _Locinfo locinfo;
+
+    TRACE("(%p %p %s %d)\n", this, loc, locname, cat);
+
+    _Locinfo_ctor_cat_cstr(&locinfo, cat, locname);
+    if(!memcmp(basic_string_char_c_str(&locinfo.newlocname), "*", 2)) {
+        _Locinfo_dtor(&locinfo);
+        MSVCRT_operator_delete(this->ptr);
+        throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
+    }
+
+    this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
+    if(!this->ptr) {
+        ERR("Out of memory\n");
+        _Locinfo_dtor(&locinfo);
+        throw_exception(EXCEPTION_BAD_ALLOC, NULL);
+    }
+    locale__Locimp_copy_ctor(this->ptr, loc->ptr);
+
+    locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL);
+    _Locinfo_dtor(&locinfo);
+    return this;
 }
 
 /* ??0locale at std@@QAE at PBDH@Z */
diff --git a/dlls/msvcp90/locale.c b/dlls/msvcp90/locale.c
index 587aca6..551a924d 100644
--- a/dlls/msvcp90/locale.c
+++ b/dlls/msvcp90/locale.c
@@ -9958,8 +9958,28 @@ locale* __thiscall locale_copy_ctor(locale *this, const locale *copy)
 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_cstr, 16)
 locale* __thiscall locale_ctor_locale_cstr(locale *this, const locale *loc, const char *locname, category cat)
 {
-    FIXME("(%p %p %s %d) stub\n", this, loc, locname, cat);
-    return NULL;
+    _Locinfo locinfo;
+
+    TRACE("(%p %p %s %d)\n", this, loc, locname, cat);
+
+    _Locinfo_ctor_cat_cstr(&locinfo, cat, locname);
+    if(!memcmp(locale_string_char_c_str(&locinfo.newlocname), "*", 2)) {
+        _Locinfo_dtor(&locinfo);
+        MSVCRT_operator_delete(this->ptr);
+        throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
+    }
+
+    this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
+    if(!this->ptr) {
+        ERR("Out of memory\n");
+        _Locinfo_dtor(&locinfo);
+        throw_exception(EXCEPTION_BAD_ALLOC, NULL);
+    }
+    locale__Locimp_copy_ctor(this->ptr, loc->ptr);
+
+    locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL);
+    _Locinfo_dtor(&locinfo);
+    return this;
 }
 
 /* ??0locale at std@@QAE at PBDH@Z */




More information about the wine-cvs mailing list