diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c index 43a951decc..7102639c9e 100644 --- a/dlls/msvcp90/ios.c +++ b/dlls/msvcp90/ios.c @@ -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; } } diff --git a/dlls/msvcp90/locale.c b/dlls/msvcp90/locale.c index 4ad37e83c4..304c510919 100644 --- a/dlls/msvcp90/locale.c +++ b/dlls/msvcp90/locale.c @@ -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) { diff --git a/dlls/msvcp90/msvcp90.h b/dlls/msvcp90/msvcp90.h index c7260c2126..4523845a15 100644 --- a/dlls/msvcp90/msvcp90.h +++ b/dlls/msvcp90/msvcp90.h @@ -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 */ +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 {