From: Abdelrazak Younes Date: Fri, 6 Jul 2007 14:43:18 +0000 (+0000) Subject: * lstring.cpp: X-Git-Tag: 1.6.10~9197 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=46214d708cabe73ea2cb2f3c13f8ff5b12cc2fbe;p=features.git * 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 --- diff --git a/src/support/lstrings.cpp b/src/support/lstrings.cpp index cb0d82b7b0..6c48a90ee4 100644 --- a/src/support/lstrings.cpp +++ b/src/support/lstrings.cpp @@ -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(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(str[i]) >= 0x80) return false; return true; } diff --git a/src/support/lstrings.h b/src/support/lstrings.h index 7a0cbd5b5f..85e3cbc49a 100644 --- a/src/support/lstrings.h +++ b/src/support/lstrings.h @@ -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.