Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/PluginFilter.cpp

Issue 5516878722105344: Issue #276 - replace TCHAR etc. with wide-character versions (Closed)
Patch Set: Created Aug. 5, 2014, 3:17 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/plugin/PluginClass.cpp ('k') | src/plugin/PluginSystem.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginFilter.h" 3 #include "PluginFilter.h"
4 4
5 #if (defined PRODUCT_ADBLOCKPLUS) 5 #if (defined PRODUCT_ADBLOCKPLUS)
6 #include "PluginSettings.h" 6 #include "PluginSettings.h"
7 #include "PluginClient.h" 7 #include "PluginClient.h"
8 #include "PluginClientFactory.h" 8 #include "PluginClientFactory.h"
9 #endif 9 #endif
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 DEBUG_FILTER("Input: " + filterText + " filterFile" + filterFile); 443 DEBUG_FILTER("Input: " + filterText + " filterFile" + filterFile);
444 444
445 CriticalSection::Lock filterEngineLock(s_criticalSectionFilterMap); 445 CriticalSection::Lock filterEngineLock(s_criticalSectionFilterMap);
446 { 446 {
447 447
448 CString filterString = filterText; 448 CString filterString = filterText;
449 // Create filter descriptor 449 // Create filter descriptor
450 std::auto_ptr<CFilterElementHide> filter; 450 std::auto_ptr<CFilterElementHide> filter;
451 451
452 CString wholeFilterString = filterString; 452 CString wholeFilterString = filterString;
453 TCHAR separatorChar; 453 wchar_t separatorChar;
454 do 454 do
455 { 455 {
456 int chunkEnd = filterText.FindOneOf(L"+>"); 456 int chunkEnd = filterText.FindOneOf(L"+>");
457 if (chunkEnd > 0) 457 if (chunkEnd > 0)
458 { 458 {
459 separatorChar = filterText.GetAt(chunkEnd); 459 separatorChar = filterText.GetAt(chunkEnd);
460 } 460 }
461 else 461 else
462 { 462 {
463 chunkEnd = filterText.GetLength(); 463 chunkEnd = filterText.GetLength();
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 DEBUG_FILTER("Filter::ShouldBlock " + type + " YES") 710 DEBUG_FILTER("Filter::ShouldBlock " + type + " YES")
711 711
712 #ifdef ENABLE_DEBUG_RESULT 712 #ifdef ENABLE_DEBUG_RESULT
713 CPluginDebug::DebugResultBlocking(type, src, domain); 713 CPluginDebug::DebugResultBlocking(type, src, domain);
714 #endif 714 #endif
715 } 715 }
716 return true; 716 return true;
717 } 717 }
718 return false; 718 return false;
719 } 719 }
OLDNEW
« no previous file with comments | « src/plugin/PluginClass.cpp ('k') | src/plugin/PluginSystem.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld