Index: src/plugin/PluginFilter.cpp |
=================================================================== |
--- a/src/plugin/PluginFilter.cpp |
+++ b/src/plugin/PluginFilter.cpp |
@@ -224,8 +224,6 @@ |
m_isFromStart = filter.m_isFromStart; |
m_isFromEnd = filter.m_isFromEnd; |
- m_stringElements = filter.m_stringElements; |
- |
m_filterText = filter.m_filterText; |
m_hitCount = filter.m_hitCount; |
@@ -719,155 +717,3 @@ |
} |
return false; |
} |
Eric
2014/06/20 21:30:41
The last function that called FindMatch() was repl
|
- |
-int CPluginFilter::FindMatch(const CString& src, CString filterPart, int srcStartPos) const |
-{ |
- int filterCurrentPos = filterPart.Find('^'); |
- if (filterCurrentPos >= 0) |
- { |
- int srcLength = src.GetLength(); |
- int srcFilterPos = -1; |
- int srcCurrentPos = srcStartPos; |
- int srcLastTestPos = -1; |
- |
- // Special char(s) as first char? |
- int nFirst = 0; |
- while (filterCurrentPos == 0) |
- { |
- filterPart = filterPart.Right(filterPart.GetLength() - 1); |
- ++nFirst; |
- filterCurrentPos = filterPart.Find('^'); |
- } |
- |
- // Find first part without special chars |
- CString test = filterCurrentPos >= 0 ? filterPart.Left(filterCurrentPos) : filterPart; |
- int testLength = test.GetLength(); |
- |
- while (filterCurrentPos >= 0 || testLength > 0) |
- { |
- int srcFindPos = testLength > 0 ? src.Find(test, srcCurrentPos) : srcCurrentPos; |
- if (srcFindPos < 0) |
- { |
- // Always fail - no need to iterate |
- return -1; |
- } |
- |
- if (testLength > 0) |
- { |
- srcLastTestPos = srcFindPos; |
- } |
- |
- // Already found earlier part; this part must follow |
- if (srcFilterPos >= 0) |
- { |
- // Found position must be position we are at in source |
- if (srcFindPos != srcCurrentPos) |
- { |
- // Try to next iteration maybe we will find it later |
- return srcLastTestPos >= 0 ? FindMatch(src, filterPart, srcLastTestPos + 1) : -1; |
- } |
- } |
- else |
- { |
- srcCurrentPos = srcFindPos; |
- srcFilterPos = srcFindPos; |
- |
- // If starting with special char, check for that |
- for (int n = 1; n <= nFirst; n++) |
- { |
- if (--srcFilterPos < 0 || srcFilterPos < srcStartPos || !IsSpecialChar(src.GetAt(srcFilterPos))) |
- { |
- // Try to next iteration maybe we will find it later |
- return srcLastTestPos >= 0 ? FindMatch(src, filterPart, srcLastTestPos + 1) : -1; |
- } |
- } |
- nFirst = 0; |
- } |
- |
- srcCurrentPos += testLength; |
- |
- // Next char must be special char |
- if (filterCurrentPos >= 0 && !IsSpecialChar(src.GetAt(srcCurrentPos++))) |
- { |
- // Try to next iteration maybe we will find it later |
- return srcLastTestPos >= 0 ? FindMatch(src, filterPart, srcLastTestPos + 1) : -1; |
- } |
- |
- // Upate test strin and position for next loop |
- if (filterCurrentPos >= 0) |
- { |
- int filterNewPos = filterPart.Find('^', filterCurrentPos + 1); |
- test = filterNewPos >= 0 ? filterPart.Mid(filterCurrentPos + 1, filterNewPos - filterCurrentPos - 1) : filterPart.Right(filterPart.GetLength() - filterCurrentPos - 1); |
- |
- filterCurrentPos = filterNewPos; |
- } |
- else |
- { |
- test.Empty(); |
- } |
- testLength = test.GetLength(); |
- } |
- |
- // If only special chars, check for that |
- if (nFirst > 0) |
- { |
- int nFound = 0; |
- |
- srcFilterPos = srcCurrentPos; |
- |
- while (nFound != nFirst && srcLength >= srcFilterPos + nFound) |
- { |
- if (IsSpecialChar(src.GetAt(srcFilterPos + nFound))) |
- { |
- nFound++; |
- } |
- else |
- { |
- if (nFound > 0) |
- { |
- nFound--; |
- } |
- |
- srcFilterPos++; |
- } |
- } |
- |
- if (nFound != nFirst) |
- { |
- // Always fail - no need to iterate |
- return -1; |
- } |
- } |
- |
- return srcFilterPos; |
- } |
- else |
- { |
- return src.Find(filterPart, srcStartPos); |
- } |
-} |
- |
-bool CPluginFilter::IsSpecialChar(TCHAR testChar) const |
-{ |
- if (isalnum(testChar) || testChar == '.' || testChar == '-' || testChar == '%') |
- { |
- return false; |
- } |
- |
- return true; |
-} |
- |
-bool CPluginFilter::IsSubdomain(const CString& subdomain, const CString& domain) const |
-{ |
- int pos = subdomain.Find(domain); |
- |
- if (pos > 0 && domain.GetLength() + pos == subdomain.GetLength()) |
- { |
- if (subdomain.GetAt(pos - 1) == '.') |
- { |
- return true; |
- } |
- } |
- |
- return false; |
-} |