From 48ce9f9e28747c184b14e50d25aff330eed391b3 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Wed, 24 Aug 2011 14:38:35 +0200 Subject: [PATCH] msvcp90: Added locale::id class implementation. --- dlls/msvcp90/locale.c | 29 +++++++++++++++++++++-------- dlls/msvcp90/misc.c | 5 ----- dlls/msvcp90/msvcp90.h | 8 ++++++++ 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/dlls/msvcp90/locale.c b/dlls/msvcp90/locale.c index af20c7e4b2..c0279dbc6c 100644 --- a/dlls/msvcp90/locale.c +++ b/dlls/msvcp90/locale.c @@ -91,8 +91,10 @@ static const vtable_ptr MSVCP_locale_facet_vtable[]; DEFINE_THISCALL_WRAPPER(locale_id_ctor_id, 8) locale_id* __thiscall locale_id_ctor_id(locale_id *this, MSVCP_size_t id) { - FIXME("(%p %lu) stub\n", this, id); - return NULL; + TRACE("(%p %lu)\n", this, id); + + this->id = id; + return this; } /* ??_Fid@locale@std@@QAEXXZ */ @@ -100,8 +102,10 @@ locale_id* __thiscall locale_id_ctor_id(locale_id *this, MSVCP_size_t id) DEFINE_THISCALL_WRAPPER(locale_id_ctor, 4) locale_id* __thiscall locale_id_ctor(locale_id *this) { - FIXME("(%p) stub\n", this); - return NULL; + TRACE("(%p)\n", this); + + this->id = 0; + return this; } /* ??Bid@locale@std@@QAEIXZ */ @@ -109,16 +113,25 @@ locale_id* __thiscall locale_id_ctor(locale_id *this) DEFINE_THISCALL_WRAPPER(locale_id_operator_size_t, 4) MSVCP_size_t __thiscall locale_id_operator_size_t(locale_id *this) { - FIXME("(%p) stub\n", this); - return 0; + _Lockit lock; + + TRACE("(%p)\n", this); + + if(!this->id) { + _Lockit_ctor_locktype(&lock, _LOCK_LOCALE); + this->id = ++locale_id__Id_cnt; + _Lockit_dtor(&lock); + } + + return this->id; } /* ?_Id_cnt_func@id@locale@std@@CAAAHXZ */ /* ?_Id_cnt_func@id@locale@std@@CAAEAHXZ */ int* __cdecl locale_id__Id_cnt_func(void) { - FIXME("stub\n"); - return NULL; + TRACE("\n"); + return &locale_id__Id_cnt; } /* ??_Ffacet@locale@std@@QAEXXZ */ diff --git a/dlls/msvcp90/misc.c b/dlls/msvcp90/misc.c index 19f76a09cb..3a3cb9f45f 100644 --- a/dlls/msvcp90/misc.c +++ b/dlls/msvcp90/misc.c @@ -87,11 +87,6 @@ void CDECL mutex_mutex_dtor(mutex *m) mutex_dtor(m); } -#define _LOCK_LOCALE 0 -#define _LOCK_MALLOC 1 -#define _LOCK_STREAM 2 -#define _LOCK_DEBUG 3 -#define _MAX_LOCK 4 static CRITICAL_SECTION lockit_cs[_MAX_LOCK]; /* ?_Lockit_ctor@_Lockit@std@@SAXH@Z */ diff --git a/dlls/msvcp90/msvcp90.h b/dlls/msvcp90/msvcp90.h index d848782161..6bc81bad01 100644 --- a/dlls/msvcp90/msvcp90.h +++ b/dlls/msvcp90/msvcp90.h @@ -200,8 +200,16 @@ typedef struct { int locktype; } _Lockit; +#define _LOCK_LOCALE 0 +#define _LOCK_MALLOC 1 +#define _LOCK_STREAM 2 +#define _LOCK_DEBUG 3 +#define _MAX_LOCK 4 + void init_lockit(void); void free_lockit(void); +_Lockit* __thiscall _Lockit_ctor_locktype(_Lockit*, int); +void __thiscall _Lockit_dtor(_Lockit*); /* class mutex */ typedef struct {