From 8019b524d8a17d313dec97f56845c3a40d4df291 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 30 Jul 2003 17:23:39 +0000 Subject: Fixed a bug in String::CompareNoCase. git-svn-id: http://svn.leocad.org/trunk@342 c7d43263-9d01-0410-8a33-9dba5d9f93d6 --- common/str.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'common/str.cpp') diff --git a/common/str.cpp b/common/str.cpp index 304cd88..ee1b35c 100644 --- a/common/str.cpp +++ b/common/str.cpp @@ -198,7 +198,7 @@ int String::CompareNoCase(const char *string, int count) const { char c1, c2, *ch = m_pData; - while (*ch && *string && count) + while (*ch && *string) { c1 = tolower (*ch); c2 = tolower (*string); @@ -209,6 +209,9 @@ int String::CompareNoCase(const char *string, int count) const ch++; string++; count--; + + if (!count) + return 0; } return (((int)*ch) - ((int)*string)); -- cgit v1.2.3