| Index: base/string_split.cc
|
| diff --git a/base/string_split.cc b/base/string_split.cc
|
| index ea694d5ab1d423765fab32c146ff9634328706c5..cdf708ba5116dab6dfc0f6a29ad14de3c3513f5f 100644
|
| --- a/base/string_split.cc
|
| +++ b/base/string_split.cc
|
| @@ -1,4 +1,4 @@
|
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| @@ -17,16 +17,19 @@ static void SplitStringT(const STR& str,
|
| bool trim_whitespace,
|
| std::vector<STR>* r) {
|
| size_t last = 0;
|
| + size_t i;
|
| size_t c = str.size();
|
| - for (size_t i = 0; i <= c; ++i) {
|
| + for (i = 0; i <= c; ++i) {
|
| if (i == c || str[i] == s) {
|
| - STR tmp(str, last, i - last);
|
| - if (trim_whitespace)
|
| - TrimWhitespace(tmp, TRIM_ALL, &tmp);
|
| - // Avoid converting an empty or all-whitespace source string into a vector
|
| - // of one empty string.
|
| - if (i != c || !r->empty() || !tmp.empty())
|
| + size_t len = i - last;
|
| + STR tmp = str.substr(last, len);
|
| + if (trim_whitespace) {
|
| + STR t_tmp;
|
| + TrimWhitespace(tmp, TRIM_ALL, &t_tmp);
|
| + r->push_back(t_tmp);
|
| + } else {
|
| r->push_back(tmp);
|
| + }
|
| last = i + 1;
|
| }
|
| }
|
|
|