]> git.lyx.org Git - features.git/commitdiff
* lstring.cpp:
authorAbdelrazak Younes <younes@lyx.org>
Fri, 6 Jul 2007 14:43:18 +0000 (14:43 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Fri, 6 Jul 2007 14:43:18 +0000 (14:43 +0000)
  - 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

src/support/lstrings.cpp
src/support/lstrings.h

index cb0d82b7b03411d9465264606b0a2c305307459b..6c48a90ee453275fbef7d0615bb7585256044fb0 100644 (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;
 }
index 7a0cbd5b5f16df85954765b7bde4250cc0f6619b..85e3cbc49aa94581d596a1a795bc47658c5453d5 100644 (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.