]> git.lyx.org Git - lyx.git/blobdiff - src/support/lstrings.C
small changes + patch from Dekel
[lyx.git] / src / support / lstrings.C
index 74fc4fee8cb72d5a5934d3c64b31a90c67a849c5..6be5d94b1265038b22649bc1b421b44f840f82c1 100644 (file)
@@ -34,7 +34,6 @@ using std::toupper;
 
 int compare_no_case(string const & s, string const & s2)
 {
-       // ANSI C
        string::const_iterator p = s.begin();
        string::const_iterator p2 = s2.begin();
 
@@ -46,7 +45,7 @@ int compare_no_case(string const & s, string const & s2)
                ++p;
                ++p2;
        }
-       
+
        if (s.size() == s2.size())
                return 0;
        if (s.size() < s2.size())
@@ -69,7 +68,8 @@ int compare_no_case(string const & s, string const & s2, unsigned int len)
                ++p;
                ++p2;
        }
-       if (s.size() == s2.size())
+
+       if (s.size() >= len && s2.size() >= len)
                return 0;
        if (s.size() < s2.size())
                return -1;
@@ -258,7 +258,7 @@ bool prefixIs(string const & a, string const & pre)
        string::size_type const prelen = pre.length();
        string::size_type const alen = a.length();
        
-       if (prelen < alen || a.empty())
+       if (prelen > alen || a.empty())
                return false;
        else {
 #if !defined(USE_INCLUDED_STRING) && !defined(STD_STRING_IS_GOOD)