Commit ab999f6d authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcp90: Use codecvt<char>::is in basic_istream_char__Ipfx function.

parent bcdcef87
......@@ -4061,6 +4061,7 @@ MSVCP_bool __thiscall basic_istream_char__Ipfx(basic_istream_char *this, MSVCP_b
if(!noskip && (ios_base_flags_get(&base->base) & FMTFLAG_skipws)) {
basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
const ctype_char *ctype = ctype_char_use_facet(base->strbuf->loc);
int ch;
for(ch = basic_streambuf_char_sgetc(strbuf); ;
......@@ -4070,8 +4071,7 @@ MSVCP_bool __thiscall basic_istream_char__Ipfx(basic_istream_char *this, MSVCP_b
return FALSE;
}
/* TODO: use locale class instead of isspace */
if(!isspace(ch))
if(!ctype_char_is_ch(ctype, _SPACE|_BLANK, ch))
break;
}
}
......
......@@ -76,13 +76,6 @@ typedef struct {
typedef struct {
LCID handle;
unsigned page;
const short *table;
int delfl;
} _Ctypevec;
typedef struct {
LCID handle;
unsigned page;
} _Cvtvec;
typedef struct {
......@@ -91,15 +84,6 @@ typedef struct {
} collate;
typedef struct {
locale_facet facet;
} ctype_base;
typedef struct {
ctype_base base;
_Ctypevec ctype;
} ctype_char;
typedef struct {
ctype_base base;
_Ctypevec ctype;
_Cvtvec cvt;
......@@ -1496,6 +1480,32 @@ MSVCP_size_t __cdecl ctype_char__Getcat(const locale_facet **facet, const locale
return LC_CTYPE;
}
ctype_char* ctype_char_use_facet(const locale *loc)
{
static ctype_char *obj = NULL;
_Lockit lock;
const locale_facet *fac;
_Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
fac = locale__Getfacet(loc, ctype_char_id.id);
if(fac) {
_Lockit_dtor(&lock);
return (ctype_char*)fac;
}
if(obj)
return obj;
ctype_char__Getcat(&fac, loc);
obj = (ctype_char*)fac;
locale_facet__Incref(&obj->base.facet);
locale_facet_register(&obj->base.facet);
_Lockit_dtor(&lock);
return obj;
}
/* _Tolower */
int __cdecl _Tolower(int ch, const _Ctypevec *ctype)
{
......
......@@ -311,6 +311,26 @@ int __thiscall codecvt_char_in(const codecvt_char*, int*, const char*,
const char*, const char**, char*, char*, char**);
int __thiscall codecvt_base_max_length(const codecvt_base*);
typedef struct {
LCID handle;
unsigned page;
const short *table;
int delfl;
} _Ctypevec;
/* class ctype_base */
typedef struct {
locale_facet facet;
} ctype_base;
/* class ctype<char> */
typedef struct {
ctype_base base;
_Ctypevec ctype;
} ctype_char;
MSVCP_bool __thiscall ctype_char_is_ch(const ctype_char*, short, char);
/* class locale */
typedef struct
{
......@@ -323,6 +343,7 @@ locale* __thiscall locale_operator_assign(locale*, const locale*);
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*);
/* 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