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

Side by Side Diff: compiled/String.cpp

Issue 29721753: Issue 6180 - use ABP_TEXT everywhere in order to let String be a UTF-8 string (Closed) Base URL: https://github.com/adblockplus/adblockpluscore.git@adb2678354813ce5b6de095072954c5a784a7bc4
Patch Set: rebase Created March 15, 2018, 1:53 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 | « compiled/String.h ('k') | compiled/StringScanner.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-present eyeo GmbH 3 * Copyright (C) 2006-present 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #include "String.h" 18 #include "String.h"
19 19
20 ABP_NS_BEGIN 20 ABP_NS_BEGIN
21 21
22 DependentString TrimSpaces(const String& value) 22 DependentString TrimSpaces(const String& value)
23 { 23 {
24 String::size_type start = 0; 24 String::size_type start = 0;
25 auto end = value.length(); 25 auto end = value.length();
26 for (; start < end; ++start) 26 for (; start < end; ++start)
27 { 27 {
28 if (value[start] > u' ') 28 if (value[start] > ABP_TEXT(' '))
29 break; 29 break;
30 } 30 }
31 for (; end > start; --end) 31 for (; end > start; --end)
32 { 32 {
33 if (value[end - 1] > u' ') 33 if (value[end - 1] > ABP_TEXT(' '))
34 break; 34 break;
35 } 35 }
36 return DependentString(value, start, end - start); 36 return DependentString(value, start, end - start);
37 } 37 }
38 38
39 std::pair<DependentString, DependentString> SplitString(const String& value, Str ing::size_type separatorPos) 39 std::pair<DependentString, DependentString> SplitString(const String& value, Str ing::size_type separatorPos)
40 { 40 {
41 const auto secondBeginPos = separatorPos < String::npos ? separatorPos + 1 : S tring::npos; 41 const auto secondBeginPos = separatorPos < String::npos ? separatorPos + 1 : S tring::npos;
42 return { 42 return {
43 DependentString{value, 0, separatorPos}, 43 DependentString{value, 0, separatorPos},
44 DependentString{value, secondBeginPos, value.length() - secondBeginPos} 44 DependentString{value, secondBeginPos, value.length() - secondBeginPos}
45 }; 45 };
46 } 46 }
47 47
48 ABP_NS_END 48 ABP_NS_END
OLDNEW
« no previous file with comments | « compiled/String.h ('k') | compiled/StringScanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld