* lstring.cpp:

- isAscii(): char is signed with MSVC so the comparison was not correct. Add a static_cast to "unsigned char" as per the other methods.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19001 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-07-06 14:43:18 +00:00
parent 9051f93625
commit 46214d708c
2 changed files with 14 additions and 1 deletions

View File

@ -248,7 +248,17 @@ bool isAscii(docstring const & str)
{
int const len = str.length();
for (int i = 0; i < len; ++i)
if (str[i] >= 0x80)
if (static_cast<unsigned char>(str[i]) >= 0x80)
return false;
return true;
}
bool isAscii(string const & str)
{
int const len = str.length();
for (int i = 0; i < len; ++i)
if (static_cast<unsigned char>(str[i]) >= 0x80)
return false;
return true;
}

View File

@ -72,6 +72,9 @@ int hexToInt(lyx::docstring const & str);
/// is \p str pure ascii?
bool isAscii(docstring const & str);
/// is \p str pure ascii?
bool isAscii(std::string const & str);
/**
* Changes the case of \p c to lowercase.
* Don't use this for non-ASCII characters, since it depends on the locale.