4.28 beta

This commit is contained in:
Igor Pavlov
2005-09-26 00:00:00 +00:00
committed by Kornel Lesiński
parent d66cf2fcf3
commit 32c73adef4
35 changed files with 108 additions and 101 deletions
+28 -11
View File
@@ -71,6 +71,7 @@ wchar_t * MyStringLower(wchar_t *s)
#endif
/*
inline int ConvertCompareResult(int r) { return r - 2; }
int MyStringCollate(const wchar_t *s1, const wchar_t *s2)
@@ -114,25 +115,16 @@ int MyStringCollateNoCase(const wchar_t *s1, const wchar_t *s2)
UnicodeStringToMultiByte(s2));
#endif
}
*/
#else
inline int NormalizeCompareResult(int res)
{
if (res < 0) return -1;
if (res > 0) return 1;
return 0;
}
/*
inline wchar_t MyCharUpper(wchar_t c)
{ return towupper(c); }
*/
wchar_t MyCharUpper(wchar_t c)
{
return toupper(c);
}
/*
int MyStringCollateNoCase(const wchar_t *s1, const wchar_t *s2)
{
while (true)
@@ -147,6 +139,7 @@ int MyStringCollateNoCase(const wchar_t *s1, const wchar_t *s2)
if (u1 == 0) return 0;
}
}
*/
#endif
@@ -173,3 +166,27 @@ int MyStringCompare(const wchar_t *s1, const wchar_t *s2)
if (c1 == 0) return 0;
}
}
int MyStringCompareNoCase(const wchar_t *s1, const wchar_t *s2)
{
while (true)
{
wchar_t c1 = *s1++;
wchar_t c2 = *s2++;
if (c1 != c2)
{
wchar_t u1 = MyCharUpper(c1);
wchar_t u2 = MyCharUpper(c2);
if (u1 < u2) return -1;
if (u1 > u2) return 1;
}
if (c1 == 0) return 0;
}
}
#ifdef _WIN32
int MyStringCompareNoCase(const char *s1, const char *s2)
{
return MyStringCompareNoCase(MultiByteToUnicodeString(s1), MultiByteToUnicodeString(s2));
}
#endif
+9 -3
View File
@@ -90,19 +90,23 @@ wchar_t MyCharUpper(wchar_t c);
//////////////////////////////////////
// Compare
/*
#ifndef _WIN32_WCE
int MyStringCollate(const char *s1, const char *s2);
int MyStringCollateNoCase(const char *s1, const char *s2);
#endif
int MyStringCollate(const wchar_t *s1, const wchar_t *s2);
int MyStringCollateNoCase(const wchar_t *s1, const wchar_t *s2);
*/
int MyStringCompare(const char *s1, const char *s2);
int MyStringCompare(const wchar_t *s1, const wchar_t *s2);
template <class T>
inline int MyStringCompareNoCase(const T *s1, const T *s2)
{ return MyStringCollateNoCase(s1, s2); }
#ifdef _WIN32
int MyStringCompareNoCase(const char *s1, const char *s2);
#endif
int MyStringCompareNoCase(const wchar_t *s1, const wchar_t *s2);
template <class T>
class CStringBase
@@ -358,10 +362,12 @@ public:
int CompareNoCase(const CStringBase& s) const
{ return MyStringCompareNoCase(_chars, s._chars); }
/*
int Collate(const CStringBase& s) const
{ return MyStringCollate(_chars, s._chars); }
int CollateNoCase(const CStringBase& s) const
{ return MyStringCollateNoCase(_chars, s._chars); }
*/
int Find(T c) const { return Find(c, 0); }
int Find(T c, int startIndex) const
+2 -2
View File
@@ -202,7 +202,7 @@ bool CItem::CheckPath(const UStringVector &pathParts, bool isFile) const
int CCensorNode::FindSubNode(const UString &name) const
{
for (int i = 0; i < SubNodes.Size(); i++)
if (SubNodes[i].Name.CollateNoCase(name) == 0)
if (SubNodes[i].Name.CompareNoCase(name) == 0)
return i;
return -1;
}
@@ -349,7 +349,7 @@ void CCensorNode::AddItem2(bool include, const UString &path, bool recursive)
int CCensor::FindPrefix(const UString &prefix) const
{
for (int i = 0; i < Pairs.Size(); i++)
if (Pairs[i].Prefix.CollateNoCase(prefix) == 0)
if (Pairs[i].Prefix.CompareNoCase(prefix) == 0)
return i;
return -1;
}