Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Side by Side Diff: net/ftp/ftp_util.cc

Issue 1200393002: Add more string_util functions to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string
Patch Set: Android Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/base/filename_util_internal.cc ('k') | net/test/url_request/url_request_mock_http_job.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/ftp/ftp_util.h" 5 #include "net/ftp/ftp_util.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/i18n/case_conversion.h" 10 #include "base/i18n/case_conversion.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // Return path as-is. 101 // Return path as-is.
102 return vms_path; 102 return vms_path;
103 } 103 }
104 104
105 if (vms_path == "[]") 105 if (vms_path == "[]")
106 return "/"; 106 return "/";
107 107
108 std::string result(vms_path); 108 std::string result(vms_path);
109 if (vms_path[0] == '[') { 109 if (vms_path[0] == '[') {
110 // It's a relative path. 110 // It's a relative path.
111 ReplaceFirstSubstringAfterOffset(&result, 0, "[.", std::string()); 111 base::ReplaceFirstSubstringAfterOffset(
112 &result, 0, "[.", base::StringPiece());
112 } else { 113 } else {
113 // It's an absolute path. 114 // It's an absolute path.
114 result.insert(0, "/"); 115 result.insert(0, "/");
115 ReplaceSubstringsAfterOffset(&result, 0, ":[000000]", "/"); 116 base::ReplaceSubstringsAfterOffset(&result, 0, ":[000000]", "/");
116 ReplaceSubstringsAfterOffset(&result, 0, ":[", "/"); 117 base::ReplaceSubstringsAfterOffset(&result, 0, ":[", "/");
117 } 118 }
118 std::replace(result.begin(), result.end(), '.', '/'); 119 std::replace(result.begin(), result.end(), '.', '/');
119 std::replace(result.begin(), result.end(), ']', '/'); 120 std::replace(result.begin(), result.end(), ']', '/');
120 121
121 // Make sure the result doesn't end with a slash. 122 // Make sure the result doesn't end with a slash.
122 if (result.length() && result[result.length() - 1] == '/') 123 if (result.length() && result[result.length() - 1] == '/')
123 result = result.substr(0, result.length() - 1); 124 result = result.substr(0, result.length() - 1);
124 125
125 return result; 126 return result;
126 } 127 }
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 while (!iter.end() && !u_isspace(iter.get())) 365 while (!iter.end() && !u_isspace(iter.get()))
365 iter.Advance(); 366 iter.Advance();
366 } 367 }
367 368
368 base::string16 result(text.substr(iter.array_pos())); 369 base::string16 result(text.substr(iter.array_pos()));
369 base::TrimWhitespace(result, base::TRIM_ALL, &result); 370 base::TrimWhitespace(result, base::TRIM_ALL, &result);
370 return result; 371 return result;
371 } 372 }
372 373
373 } // namespace 374 } // namespace
OLDNEW
« no previous file with comments | « net/base/filename_util_internal.cc ('k') | net/test/url_request/url_request_mock_http_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698