| OLD | NEW |
| 1 #include "PluginStdAfx.h" | 1 #include "PluginStdAfx.h" |
| 2 | 2 |
| 3 #include "PluginFilter.h" | 3 #include "PluginFilter.h" |
| 4 | 4 |
| 5 #include "COM_Value.h" | 5 #include "COM_Value.h" |
| 6 #if (defined PRODUCT_ADBLOCKPLUS) | 6 #if (defined PRODUCT_ADBLOCKPLUS) |
| 7 #include "PluginSettings.h" | 7 #include "PluginSettings.h" |
| 8 #include "PluginClient.h" | 8 #include "PluginClient.h" |
| 9 #include "PluginClientFactory.h" | 9 #include "PluginClientFactory.h" |
| 10 #endif | 10 #endif |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 // ============================================================================ | 46 // ============================================================================ |
| 47 // CFilterElementHide | 47 // CFilterElementHide |
| 48 // ============================================================================ | 48 // ============================================================================ |
| 49 | 49 |
| 50 CFilterElementHide::CFilterElementHide(const CString& filterText) : m_filterText
(filterText), m_type(ETraverserComplexType::TRAVERSER_TYPE_ERROR) | 50 CFilterElementHide::CFilterElementHide(const CString& filterText) : m_filterText
(filterText), m_type(ETraverserComplexType::TRAVERSER_TYPE_ERROR) |
| 51 { | 51 { |
| 52 // Find tag name, class or any (*) | 52 // Find tag name, class or any (*) |
| 53 CString filterString = filterText; | 53 CString filterString = filterText; |
| 54 | 54 |
| 55 TCHAR firstTag = filterString.GetAt(0); | 55 wchar_t firstTag = filterString.GetAt(0); |
| 56 // Any tag | 56 // Any tag |
| 57 if (firstTag == '*') | 57 if (firstTag == '*') |
| 58 { | 58 { |
| 59 filterString = filterString.Mid(1); | 59 filterString = filterString.Mid(1); |
| 60 } | 60 } |
| 61 // Any tag (implicitely) | 61 // Any tag (implicitely) |
| 62 else if (firstTag == '[' || firstTag == '.' || firstTag == '#') | 62 else if (firstTag == '[' || firstTag == '.' || firstTag == '#') |
| 63 { | 63 { |
| 64 } | 64 } |
| 65 // Real tag | 65 // Real tag |
| (...skipping 12 matching lines...) Expand all Loading... |
| 78 else | 78 else |
| 79 { | 79 { |
| 80 DEBUG_FILTER("Filter::Error parsing selector:" + filterText + " (invalid tag
)"); | 80 DEBUG_FILTER("Filter::Error parsing selector:" + filterText + " (invalid tag
)"); |
| 81 throw std::runtime_error(CStringA("Filter::Error parsing selector:" + filter
Text + " (invalid tag)").GetString()); | 81 throw std::runtime_error(CStringA("Filter::Error parsing selector:" + filter
Text + " (invalid tag)").GetString()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 // Find Id and class name | 84 // Find Id and class name |
| 85 | 85 |
| 86 if (!filterString.IsEmpty()) | 86 if (!filterString.IsEmpty()) |
| 87 { | 87 { |
| 88 TCHAR firstId = filterString.GetAt(0); | 88 wchar_t firstId = filterString.GetAt(0); |
| 89 | 89 |
| 90 // Id | 90 // Id |
| 91 if (firstId == '#') | 91 if (firstId == '#') |
| 92 { | 92 { |
| 93 int pos = filterString.Find('['); | 93 int pos = filterString.Find('['); |
| 94 if (pos < 0) | 94 if (pos < 0) |
| 95 { | 95 { |
| 96 pos = filterString.GetLength(); | 96 pos = filterString.GetLength(); |
| 97 } | 97 } |
| 98 m_tagId = filterString.Mid(1, pos - 1); | 98 m_tagId = filterString.Mid(1, pos - 1); |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 DEBUG_FILTER("Input: " + filterText + " filterFile" + filterFile); | 453 DEBUG_FILTER("Input: " + filterText + " filterFile" + filterFile); |
| 454 | 454 |
| 455 CriticalSection::Lock filterEngineLock(s_criticalSectionFilterMap); | 455 CriticalSection::Lock filterEngineLock(s_criticalSectionFilterMap); |
| 456 { | 456 { |
| 457 | 457 |
| 458 CString filterString = filterText; | 458 CString filterString = filterText; |
| 459 // Create filter descriptor | 459 // Create filter descriptor |
| 460 std::auto_ptr<CFilterElementHide> filter; | 460 std::auto_ptr<CFilterElementHide> filter; |
| 461 | 461 |
| 462 CString wholeFilterString = filterString; | 462 CString wholeFilterString = filterString; |
| 463 TCHAR separatorChar; | 463 wchar_t separatorChar; |
| 464 do | 464 do |
| 465 { | 465 { |
| 466 int chunkEnd = filterText.FindOneOf(L"+>"); | 466 int chunkEnd = filterText.FindOneOf(L"+>"); |
| 467 if (chunkEnd > 0) | 467 if (chunkEnd > 0) |
| 468 { | 468 { |
| 469 separatorChar = filterText.GetAt(chunkEnd); | 469 separatorChar = filterText.GetAt(chunkEnd); |
| 470 } | 470 } |
| 471 else | 471 else |
| 472 { | 472 { |
| 473 chunkEnd = filterText.GetLength(); | 473 chunkEnd = filterText.GetLength(); |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 DEBUG_FILTER("Filter::ShouldBlock " + type + " YES") | 720 DEBUG_FILTER("Filter::ShouldBlock " + type + " YES") |
| 721 | 721 |
| 722 #ifdef ENABLE_DEBUG_RESULT | 722 #ifdef ENABLE_DEBUG_RESULT |
| 723 CPluginDebug::DebugResultBlocking(type, src, domain); | 723 CPluginDebug::DebugResultBlocking(type, src, domain); |
| 724 #endif | 724 #endif |
| 725 } | 725 } |
| 726 return true; | 726 return true; |
| 727 } | 727 } |
| 728 return false; | 728 return false; |
| 729 } | 729 } |
| OLD | NEW |