]> git.lyx.org Git - lyx.git/commitdiff
* src/support/lstrings.C
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Fri, 2 Mar 2007 16:52:49 +0000 (16:52 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Fri, 2 Mar 2007 16:52:49 +0000 (16:52 +0000)
(lowercase): assert that input is pure ASCII
(uppercase): ditto

* src/support/lstrings.h
(lowercase): document that only ASCII input is allowed
(uppercase): ditto

* src/lyxfind.C
(stringSelected): Use compare_no_case (more efficient)

* src/MenuBackend.C: remove unused using directive

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17393 a592a061-630c-0410-9148-cb99ea01b6c8

src/MenuBackend.C
src/lyxfind.C
src/support/lstrings.C
src/support/lstrings.h

index 747091260562f7e89395e02db0106ff392b2b6e1..50384a0f94ca83c7af888fc1f077cb4e0f595a78 100644 (file)
@@ -54,7 +54,6 @@ using support::compare_ascii_no_case;
 using support::contains;
 using support::makeDisplayPath;
 using support::token;
-using support::uppercase;
 
 using boost::bind;
 
index 932cbec30e0a31df48b9cd37ab980a076802070f..6de16909773e118d97bbaec8b46ef4e595286122 100644 (file)
@@ -35,7 +35,7 @@
 
 namespace lyx {
 
-using support::lowercase;
+using support::compare_no_case;
 using support::uppercase;
 using support::split;
 
@@ -206,7 +206,7 @@ bool stringSelected(BufferView * bv, docstring const & searchstr,
        // string search and select next occurance and return
        docstring const & str1 = searchstr;
        docstring const str2 = bv->cursor().selectionAsString(false);
-       if ((cs && str1 != str2) || lowercase(str1) != lowercase(str2)) {
+       if ((cs && str1 != str2) || compare_no_case(str1, str2) != 0) {
                find(bv, searchstr, cs, mw, fw);
                return false;
        }
index 42b76a5a16dca9f076ecaf720c3d94a9c67eb1c1..fe161be9913257702d9375a4be697dae9de562db 100644 (file)
@@ -256,12 +256,14 @@ bool isAscii(docstring const & str)
 
 char lowercase(char c)
 {
+       BOOST_ASSERT(static_cast<unsigned char>(c) < 0x80);
        return char(tolower(c));
 }
 
 
 char uppercase(char c)
 {
+       BOOST_ASSERT(static_cast<unsigned char>(c) < 0x80);
        return char(toupper(c));
 }
 
index 9c9dbf4d7396881fe7eb71c289aaf805256ae246..7a0cbd5b5f16df85954765b7bde4250cc0f6619b 100644 (file)
@@ -72,12 +72,22 @@ int hexToInt(lyx::docstring const & str);
 /// is \p str pure ascii?
 bool isAscii(docstring const & str);
 
-/// Changes the case of \p c to lowercase.
-/// Caution: Depends on the locale
+/**
+ * Changes the case of \p c to lowercase.
+ * Don't use this for non-ASCII characters, since it depends on the locale.
+ * This overloaded function is only implemented because the char_type variant
+ * would be used otherwise, and we assert in this function that \p c is in
+ * the ASCII range.
+ */
 char lowercase(char c);
 
-/// Changes the case of \p c to uppercase.
-/// Caution: Depends on the locale
+/**
+ * Changes the case of \p c to uppercase.
+ * Don't use this for non-ASCII characters, since it depends on the locale.
+ * This overloaded function is only implemented because the char_type variant
+ * would be used otherwise, and we assert in this function that \p c is in
+ * the ASCII range.
+ */
 char uppercase(char c);
 
 /// Changes the case of \p c to lowercase.