Piotr Caban : msvcp90: Added locale copy based constructors implementation.

Alexandre Julliard julliard at winehq.org
Fri Nov 25 10:27:32 CST 2011


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Fri Nov 25 10:45:41 2011 +0100

msvcp90: Added locale copy based constructors implementation.

---

 dlls/msvcp90/locale.c |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/dlls/msvcp90/locale.c b/dlls/msvcp90/locale.c
index f05cc79..61a3353 100644
--- a/dlls/msvcp90/locale.c
+++ b/dlls/msvcp90/locale.c
@@ -274,15 +274,18 @@ locale__Locimp* __thiscall locale__Locimp_ctor(locale__Locimp *this)
 DEFINE_THISCALL_WRAPPER(locale__Locimp_copy_ctor, 8)
 locale__Locimp* __thiscall locale__Locimp_copy_ctor(locale__Locimp *this, const locale__Locimp *copy)
 {
+    _Lockit lock;
     MSVCP_size_t i;
 
     TRACE("(%p %p)\n", this, copy);
 
+    _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
     memcpy(this, copy, sizeof(locale__Locimp));
     locale_facet_ctor_refs(&this->facet, 1);
     if(copy->facetvec) {
         this->facetvec = MSVCRT_operator_new(copy->facet_cnt*sizeof(locale_facet*));
         if(!this->facetvec) {
+            _Lockit_dtor(&lock);
             ERR("Out of memory\n");
             throw_exception(EXCEPTION_BAD_ALLOC, NULL);
             return NULL;
@@ -292,6 +295,7 @@ locale__Locimp* __thiscall locale__Locimp_copy_ctor(locale__Locimp *this, const
                 locale_facet__Incref(this->facetvec[i]);
     }
     MSVCP_basic_string_char_copy_ctor(&this->name, &copy->name);
+    _Lockit_dtor(&lock);
     return this;
 }
 
@@ -351,8 +355,11 @@ locale__Locimp* __thiscall MSVCP_locale__Locimp_vector_dtor(locale__Locimp *this
 /* ?_Locimp_Addfac at _Locimp@locale at std@@CAXPEAV123 at PEAVfacet@23 at _K@Z */
 void __cdecl locale__Locimp__Locimp_Addfac(locale__Locimp *locimp, locale_facet *facet, MSVCP_size_t id)
 {
+    _Lockit lock;
+
     TRACE("(%p %p %lu)\n", locimp, facet, id);
 
+    _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
     if(id >= locimp->facet_cnt) {
         MSVCP_size_t new_size = id+1;
         locale_facet **new_facetvec;
@@ -362,6 +369,7 @@ void __cdecl locale__Locimp__Locimp_Addfac(locale__Locimp *locimp, locale_facet
 
         new_facetvec = MSVCRT_operator_new(sizeof(locale_facet*)*new_size);
         if(!new_facetvec) {
+            _Lockit_dtor(&lock);
             ERR("Out of memory\n");
             throw_exception(EXCEPTION_BAD_ALLOC, NULL);
             return;
@@ -380,6 +388,7 @@ void __cdecl locale__Locimp__Locimp_Addfac(locale__Locimp *locimp, locale_facet
     locimp->facetvec[id] = facet;
     if(facet)
         locale_facet__Incref(facet);
+    _Lockit_dtor(&lock);
 }
 
 /* ?_Addfac at _Locimp@locale at std@@AAEXPAVfacet at 23@I at Z */
@@ -437,8 +446,10 @@ const vtable_ptr MSVCP_locale__Locimp_vtable[] = {
 DEFINE_THISCALL_WRAPPER(locale_ctor_locimp, 8)
 locale* __thiscall locale_ctor_locimp(locale *this, locale__Locimp *locimp)
 {
-    FIXME("(%p %p) stub\n", this, locimp);
-    return NULL;
+    TRACE("(%p %p)\n", this, locimp);
+    /* Don't change locimp reference counter */
+    this->ptr = locimp;
+    return this;
 }
 
 /* ??0locale at std@@QAE at ABV01@0H at Z */
@@ -455,8 +466,10 @@ locale* __thiscall locale_ctor_locale_locale(locale *this, const locale *loc, co
 DEFINE_THISCALL_WRAPPER(locale_copy_ctor, 8)
 locale* __thiscall locale_copy_ctor(locale *this, const locale *copy)
 {
-    FIXME("(%p %p) stub\n", this, copy);
-    return NULL;
+    TRACE("(%p %p)\n", this, copy);
+    this->ptr = copy->ptr;
+    locale_facet__Incref(&this->ptr->facet);
+    return this;
 }
 
 /* ??0locale at std@@QAE at ABV01@PBDH at Z */
@@ -482,8 +495,9 @@ locale* __thiscall locale_ctor_cstr(locale *this, const char *locname, category
 DEFINE_THISCALL_WRAPPER(locale_ctor_uninitialized, 8)
 locale* __thiscall locale_ctor_uninitialized(locale *this, int uninitialized)
 {
-    FIXME("(%p %d) stub\n", this, uninitialized);
-    return NULL;
+    TRACE("(%p)\n", this);
+    this->ptr = NULL;
+    return this;
 }
 
 /* ??0locale at std@@QAE at XZ */
@@ -509,7 +523,8 @@ DEFINE_THISCALL_WRAPPER(locale_dtor, 4)
 void __thiscall locale_dtor(locale *this)
 {
     TRACE("(%p)\n", this);
-    locale__Locimp_dtor(this->ptr);
+    if(this->ptr)
+        locale__Locimp_dtor(this->ptr);
 }
 
 DEFINE_THISCALL_WRAPPER(MSVCP_locale_vector_dtor, 8)




More information about the wine-cvs mailing list