OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 for (; end > 0; end--) | 66 for (; end > 0; end--) |
67 if (text[end - 1] != ' ') | 67 if (text[end - 1] != ' ') |
68 break; | 68 break; |
69 | 69 |
70 // Set new string boundaries | 70 // Set new string boundaries |
71 text.reset(text, start, end - start); | 71 text.reset(text, start, end - start); |
72 } | 72 } |
73 } | 73 } |
74 | 74 |
75 Filter::Filter(Type type, const String& text) | 75 Filter::Filter(Type type, const String& text) |
76 : mType(type), mText(text) | 76 : mText(text), mType(type) |
77 { | 77 { |
78 annotate_address(this, "Filter"); | 78 annotate_address(this, "Filter"); |
79 } | 79 } |
80 | 80 |
81 Filter::~Filter() | 81 Filter::~Filter() |
82 { | 82 { |
83 knownFilters.erase(mText); | 83 knownFilters.erase(mText); |
84 } | 84 } |
85 | 85 |
86 OwnedString Filter::Serialize() const | 86 OwnedString Filter::Serialize() const |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 // This is a hack: we looked up the entry using text but create it using | 153 // This is a hack: we looked up the entry using text but create it using |
154 // filter->mText. This works because both are equal at this point. However, | 154 // filter->mText. This works because both are equal at this point. However, |
155 // text refers to a temporary buffer which will go away. | 155 // text refers to a temporary buffer which will go away. |
156 enter_context("Adding to known filters"); | 156 enter_context("Adding to known filters"); |
157 knownFilter.assign(filter->mText, filter.get()); | 157 knownFilter.assign(filter->mText, filter.get()); |
158 exit_context(); | 158 exit_context(); |
159 | 159 |
160 return filter.release(); | 160 return filter.release(); |
161 } | 161 } |
OLD | NEW |