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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_util.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/safe_browsing_util.cc
diff --git a/chrome/browser/safe_browsing/safe_browsing_util.cc b/chrome/browser/safe_browsing/safe_browsing_util.cc
index ef620a7e8ad930452fb225e29cb66298b2891672..7e6710ff23fe7165a3982b1d0c6903049898a799 100644
--- a/chrome/browser/safe_browsing/safe_browsing_util.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_util.cc
@@ -298,8 +298,10 @@ void CanonicalizeUrl(const GURL& url,
url_unescaped_str.length(), &parsed);
// 3. In hostname, remove all leading and trailing dots.
- const std::string host = (parsed.host.len > 0) ? url_unescaped_str.substr(
- parsed.host.begin, parsed.host.len) : "";
+ const std::string host =
+ (parsed.host.len > 0)
+ ? url_unescaped_str.substr(parsed.host.begin, parsed.host.len)
+ : std::string();
const char kCharsToTrim[] = ".";
std::string host_without_end_dots;
TrimString(host, kCharsToTrim, &host_without_end_dots);
@@ -309,10 +311,11 @@ void CanonicalizeUrl(const GURL& url,
host_without_end_dots, '.'));
// 5. In path, replace runs of consecutive slashes with a single slash.
- std::string path = (parsed.path.len > 0) ? url_unescaped_str.substr(
- parsed.path.begin, parsed.path.len): "";
- std::string path_without_consecutive_slash(RemoveConsecutiveChars(
- path, '/'));
+ std::string path =
+ (parsed.path.len > 0)
+ ? url_unescaped_str.substr(parsed.path.begin, parsed.path.len)
+ : std::string();
+ std::string path_without_consecutive_slash(RemoveConsecutiveChars(path, '/'));
url_canon::Replacements<char> hp_replacements;
hp_replacements.SetHost(host_without_consecutive_dots.data(),
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_blocking_page.cc ('k') | chrome/browser/safe_browsing/two_phase_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698