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

This commit is contained in:
Piotr Caban 2012-06-14 15:37:13 +02:00 committed by Alexandre Julliard
parent bcdcef8713
commit ab999f6d3a
3 changed files with 49 additions and 18 deletions

View File

@ -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;
}
}

View File

@ -73,13 +73,6 @@ typedef struct {
unsigned page;
} _Collvec;
typedef struct {
LCID handle;
unsigned page;
const short *table;
int delfl;
} _Ctypevec;
typedef struct {
LCID handle;
unsigned page;
@ -90,15 +83,6 @@ typedef struct {
_Collvec coll;
} collate;
typedef struct {
locale_facet facet;
} ctype_base;
typedef struct {
ctype_base base;
_Ctypevec ctype;
} ctype_char;
typedef struct {
ctype_base base;
_Ctypevec ctype;
@ -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)
{

View File

@ -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 {