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

Side by Side Diff: compiled/String.cpp

Issue 29548581: Issue 4128, 5138 - Add Parser and Serializer implemented in C++ Base URL: https://github.com/adblockplus/adblockpluscore.git
Patch Set: Created Sept. 18, 2017, 5:23 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
OLDNEW
(Empty)
1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
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/>.
16 */
17
18 #include "String.h"
19
20 DependentString TrimSpaces(const String& value)
21 {
22 String::size_type start = 0;
23 auto end = value.length();
24 for (; start < end; start++)
25 if (value[start] > u' ')
Wladimir Palant 2017/12/21 10:30:36 That's an unusual definition of "whitespace," but
sergei 2018/03/01 15:05:24 It's not about whitespaces, it's only for spaces,
26 break;
27
28 for (; end > 0; end--)
Wladimir Palant 2017/12/21 10:30:35 You should check for `end > start` here. Otherwise
sergei 2018/03/01 15:05:24 Done, it's covered in tests.
29 if (value[end - 1] > u' ')
30 break;
31 return DependentString(value, start, end - start);
32 }
Wladimir Palant 2017/12/21 10:30:35 All string methods are inlined, why did you put th
sergei 2018/03/01 15:05:25 I moved SplitString into cpp too because when it's
OLDNEW

Powered by Google App Engine
This is Rietveld