forked from boostorg/regex
Fix for Chinese locales: LCMapString can't map all 256 characters. See https://sourceforge.net/tracker/?func=detail&atid=207586&aid=1358740&group_id=7586
[SVN r31766]
This commit is contained in:
@ -105,7 +105,14 @@ void w32_regex_traits_char_layer<char>::init()
|
|||||||
for(int ii = 0; ii < (1 << CHAR_BIT); ++ii)
|
for(int ii = 0; ii < (1 << CHAR_BIT); ++ii)
|
||||||
char_map[ii] = static_cast<char>(ii);
|
char_map[ii] = static_cast<char>(ii);
|
||||||
int r = ::LCMapStringA(this->m_locale, LCMAP_LOWERCASE, char_map, 1 << CHAR_BIT, this->m_lower_map, 1 << CHAR_BIT);
|
int r = ::LCMapStringA(this->m_locale, LCMAP_LOWERCASE, char_map, 1 << CHAR_BIT, this->m_lower_map, 1 << CHAR_BIT);
|
||||||
BOOST_ASSERT(r == 1 << CHAR_BIT);
|
BOOST_ASSERT(r != 0);
|
||||||
|
if(r < (1 << CHAR_BIT))
|
||||||
|
{
|
||||||
|
// if we have multibyte characters then not all may have been given
|
||||||
|
// a lower case mapping:
|
||||||
|
for(int jj = r; jj < (1 << CHAR_BIT); ++jj)
|
||||||
|
this->m_lower_map[jj] = static_cast<char>(jj);
|
||||||
|
}
|
||||||
r = ::GetStringTypeExA(this->m_locale, CT_CTYPE1, char_map, 1 << CHAR_BIT, this->m_type_map);
|
r = ::GetStringTypeExA(this->m_locale, CT_CTYPE1, char_map, 1 << CHAR_BIT, this->m_type_map);
|
||||||
BOOST_ASSERT(0 != r);
|
BOOST_ASSERT(0 != r);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user