Commit 53bab55d authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcp90: Use correct locale in basic_ios::narrow and basic_ios::widen.

parent 51c8fa65
......@@ -5880,7 +5880,7 @@ DEFINE_THISCALL_WRAPPER(basic_ios_char_narrow, 12)
char __thiscall basic_ios_char_narrow(basic_ios_char *this, char ch, char def)
{
TRACE("(%p %c %c)\n", this, ch, def);
return ctype_char_narrow_ch(ctype_char_use_facet(IOS_LOCALE(this->strbuf)), ch, def);
return ctype_char_narrow_ch(ctype_char_use_facet(IOS_LOCALE(&this->base)), ch, def);
}
/* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PAV32@@Z */
......@@ -5953,7 +5953,7 @@ DEFINE_THISCALL_WRAPPER(basic_ios_char_widen, 8)
char __thiscall basic_ios_char_widen(basic_ios_char *this, char ch)
{
TRACE("(%p %c)\n", this, ch);
return ctype_char_widen_ch(ctype_char_use_facet(IOS_LOCALE(this->strbuf)), ch);
return ctype_char_widen_ch(ctype_char_use_facet(IOS_LOCALE(&this->base)), ch);
}
/* ?swap@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXAAV12@@Z */
......@@ -6161,7 +6161,7 @@ DEFINE_THISCALL_WRAPPER(basic_ios_wchar_narrow, 12)
char __thiscall basic_ios_wchar_narrow(basic_ios_wchar *this, wchar_t ch, char def)
{
TRACE("(%p %c %c)\n", this, ch, def);
return ctype_wchar_narrow_ch(ctype_wchar_use_facet(IOS_LOCALE(this->strbuf)), ch, def);
return ctype_wchar_narrow_ch(ctype_wchar_use_facet(IOS_LOCALE(&this->base)), ch, def);
}
/* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PAV32@@Z */
......@@ -6248,7 +6248,7 @@ DEFINE_THISCALL_WRAPPER(basic_ios_wchar_widen, 8)
wchar_t __thiscall basic_ios_wchar_widen(basic_ios_wchar *this, char ch)
{
TRACE("(%p %c)\n", this, ch);
return ctype_wchar_widen_ch(ctype_wchar_use_facet(IOS_LOCALE(this->strbuf)), ch);
return ctype_wchar_widen_ch(ctype_wchar_use_facet(IOS_LOCALE(&this->base)), ch);
}
/* ?swap@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXAAV12@@Z */
......
......@@ -496,10 +496,14 @@ static basic_ostream_wchar* (*__thiscall p_basic_ostream_short_print_ushort)(bas
/* basic_ios */
static locale* (*__thiscall p_basic_ios_char_imbue)(basic_ios_char*, locale*, const locale*);
static basic_ios_char* (*__thiscall p_basic_ios_char_ctor)(basic_ios_char*);
static char (*__thiscall p_basic_ios_char_widen)(basic_ios_char*, char);
static void (*__thiscall p_basic_ios_char_dtor)(basic_ios_char*);
static locale* (*__thiscall p_basic_ios_wchar_imbue)(basic_ios_wchar*, locale*, const locale*);
/* ios_base */
static void (*__thiscall p_ios_base__Init)(ios_base*);
static IOSB_iostate (*__thiscall p_ios_base_rdstate)(const ios_base*);
static IOSB_fmtflags (*__thiscall p_ios_base_setf_mask)(ios_base*, IOSB_fmtflags, IOSB_fmtflags);
static void (*__thiscall p_ios_base_unsetf)(ios_base*, IOSB_fmtflags);
......@@ -724,6 +728,8 @@ static BOOL init(void)
SET(p_basic_ostream_char_print_complex_ldouble,
"??$?6ODU?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@AEBV?$complex@O@0@@Z");
SET(p_ios_base__Init,
"?_Init@ios_base@std@@IEAAXXZ");
SET(p_ios_base_rdstate,
"?rdstate@ios_base@std@@QEBAHXZ");
SET(p_ios_base_setf_mask,
......@@ -735,6 +741,12 @@ static BOOL init(void)
SET(p_basic_ios_char_imbue,
"?imbue@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z");
SET(p_basic_ios_char_ctor,
"??0?$basic_ios@DU?$char_traits@D@std@@@std@@IEAA@XZ");
SET(p_basic_ios_char_widen,
"?widen@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBADD@Z");
SET(p_basic_ios_char_dtor,
"??1?$basic_ios@DU?$char_traits@D@std@@@std@@UEAA@XZ");
SET(p_basic_ios_wchar_imbue,
"?imbue@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z");
......@@ -856,6 +868,8 @@ static BOOL init(void)
SET(p_basic_ostream_char_print_complex_ldouble,
"??$?6ODU?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$complex@O@0@@Z");
SET(p_ios_base__Init,
"?_Init@ios_base@std@@IAAXXZ");
SET(p_ios_base_rdstate,
"?rdstate@ios_base@std@@QBAHXZ");
SET(p_ios_base_setf_mask,
......@@ -867,6 +881,12 @@ static BOOL init(void)
SET(p_basic_ios_char_imbue,
"?imbue@?$basic_ios@DU?$char_traits@D@std@@@std@@QAA?AVlocale@2@ABV32@@Z");
SET(p_basic_ios_char_ctor,
"??0?$basic_ios@DU?$char_traits@D@std@@@std@@IAA@XZ");
SET(p_basic_ios_char_widen,
"?widen@?$basic_ios@DU?$char_traits@D@std@@@std@@QBADD@Z");
SET(p_basic_ios_char_dtor,
"??1?$basic_ios@DU?$char_traits@D@std@@@std@@UAA@XZ");
SET(p_basic_ios_wchar_imbue,
"?imbue@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAA?AVlocale@2@ABV32@@Z");
......@@ -987,6 +1007,8 @@ static BOOL init(void)
SET(p_basic_ostream_char_print_complex_ldouble,
"??$?6ODU?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$complex@O@0@@Z");
SET(p_ios_base__Init,
"?_Init@ios_base@std@@IAEXXZ");
SET(p_ios_base_rdstate,
"?rdstate@ios_base@std@@QBEHXZ");
SET(p_ios_base_setf_mask,
......@@ -998,6 +1020,12 @@ static BOOL init(void)
SET(p_basic_ios_char_imbue,
"?imbue@?$basic_ios@DU?$char_traits@D@std@@@std@@QAE?AVlocale@2@ABV32@@Z");
SET(p_basic_ios_char_ctor,
"??0?$basic_ios@DU?$char_traits@D@std@@@std@@IAE@XZ");
SET(p_basic_ios_char_widen,
"?widen@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDD@Z");
SET(p_basic_ios_char_dtor,
"??1?$basic_ios@DU?$char_traits@D@std@@@std@@UAE@XZ");
SET(p_basic_ios_wchar_imbue,
"?imbue@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAE?AVlocale@2@ABV32@@Z");
......@@ -2331,6 +2359,20 @@ static void test_istream_read_complex_double(void)
}
}
static void test_basic_ios(void)
{
basic_ios_char bi;
char c;
call_func1(p_basic_ios_char_ctor, &bi);
call_func1(p_ios_base__Init, &bi.base);
c = (UINT_PTR)call_func2(p_basic_ios_char_widen, &bi, 'a');
ok(c == 'a', "basic_ios::widen('a') returned %x\n", c);
call_func1(p_basic_ios_char_dtor, &bi);
}
START_TEST(ios)
{
if(!init())
......@@ -2356,6 +2398,7 @@ START_TEST(ios)
test_ostream_print_complex_double();
test_ostream_print_complex_ldouble();
test_istream_read_complex_double();
test_basic_ios();
ok(!invalid_parameter, "invalid_parameter_handler was invoked too many times\n");
......
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