Commit 65a364a2 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcp90: Added basic_ios::narrow implementation.

parent 609d7dbb
......@@ -3186,8 +3186,8 @@ locale *__thiscall basic_ios_char_imbue(basic_ios_char *this, locale *ret, const
DEFINE_THISCALL_WRAPPER(basic_ios_char_narrow, 12)
char __thiscall basic_ios_char_narrow(basic_ios_char *this, char ch, char def)
{
FIXME("(%p %c %c) stub\n", this, ch, def);
return def;
TRACE("(%p %c %c)\n", this, ch, def);
return ctype_char_narrow_ch(ctype_char_use_facet(this->strbuf->loc), ch, def);
}
/* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PAV32@@Z */
......@@ -3452,8 +3452,8 @@ locale *__thiscall basic_ios_wchar_imbue(basic_ios_wchar *this, locale *ret, con
DEFINE_THISCALL_WRAPPER(basic_ios_wchar_narrow, 12)
char __thiscall basic_ios_wchar_narrow(basic_ios_wchar *this, wchar_t ch, char def)
{
FIXME("(%p %c %c) stub\n", this, ch, def);
return def;
TRACE("(%p %c %c)\n", this, ch, def);
return ctype_wchar_narrow_ch(ctype_wchar_use_facet(this->strbuf->loc), ch, def);
}
/* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PAV32@@Z */
......
......@@ -74,22 +74,11 @@ typedef struct {
} _Collvec;
typedef struct {
LCID handle;
unsigned page;
} _Cvtvec;
typedef struct {
locale_facet facet;
_Collvec coll;
} collate;
typedef struct {
ctype_base base;
_Ctypevec ctype;
_Cvtvec cvt;
} ctype_wchar;
typedef struct {
locale_facet facet;
const char *grouping;
char dp;
......@@ -2235,6 +2224,32 @@ wchar_t __cdecl _Towlower(wchar_t ch, const _Ctypevec *ctype)
return tolowerW(ch);
}
ctype_wchar* ctype_wchar_use_facet(const locale *loc)
{
static ctype_wchar *obj = NULL;
_Lockit lock;
const locale_facet *fac;
_Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
fac = locale__Getfacet(loc, ctype_wchar_id.id);
if(fac) {
_Lockit_dtor(&lock);
return (ctype_wchar*)fac;
}
if(obj)
return obj;
ctype_wchar__Getcat(&fac, loc);
obj = (ctype_wchar*)fac;
locale_facet__Incref(&obj->base.facet);
locale_facet_register(&obj->base.facet);
_Lockit_dtor(&lock);
return obj;
}
/* ?do_tolower@?$ctype@_W@std@@MBE_W_W@Z */
/* ?do_tolower@?$ctype@_W@std@@MEBA_W_W@Z */
/* ?do_tolower@?$ctype@G@std@@MBEGG@Z */
......
......@@ -331,6 +331,21 @@ typedef struct {
} ctype_char;
MSVCP_bool __thiscall ctype_char_is_ch(const ctype_char*, short, char);
char __thiscall ctype_char_narrow_ch(const ctype_char*, char, char);
typedef struct {
LCID handle;
unsigned page;
} _Cvtvec;
/* class ctype<wchar> */
typedef struct {
ctype_base base;
_Ctypevec ctype;
_Cvtvec cvt;
} ctype_wchar;
char __thiscall ctype_wchar_narrow_ch(const ctype_wchar*, wchar_t, char);
/* class locale */
typedef struct
......@@ -345,6 +360,7 @@ void __thiscall locale_dtor(locale*);
void free_locale(void);
codecvt_char* codecvt_char_use_facet(const locale*);
ctype_char* ctype_char_use_facet(const locale*);
ctype_wchar* ctype_wchar_use_facet(const locale*);
/* class _Lockit */
typedef struct {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment