Add more string_util functions to base namespace. Moves ReplaceFirstSubstringAfterOffset. It also changes the find/replace arguments to be string pieces (normally these are constants). TBR=gauravsh@chromium.org for chromeos/network Review URL: https://codereview.chromium.org/1200393002 Cr-Original-Commit-Position: refs/heads/master@{#335999} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: e6dae46fc681a8ad62f6937a6ac1cab3d51938a9
diff --git a/tools/gn/command_args.cc b/tools/gn/command_args.cc index 518a1b6..a8b0097 100644 --- a/tools/gn/command_args.cc +++ b/tools/gn/command_args.cc
@@ -211,7 +211,7 @@ // but quoting and escaping internal quotes should handle 99.999% of all // cases. std::string escaped_name = file_to_edit.value(); - ReplaceSubstringsAfterOffset(&escaped_name, 0, "\"", "\\\""); + base::ReplaceSubstringsAfterOffset(&escaped_name, 0, "\"", "\\\""); cmd.append(escaped_name); cmd.push_back('"'); @@ -250,7 +250,8 @@ #if defined(OS_WIN) // Use Windows lineendings for this file since it will often open in // Notepad which can't handle Unix ones. - ReplaceSubstringsAfterOffset(&argfile_default_contents, 0, "\n", "\r\n"); + base::ReplaceSubstringsAfterOffset( + &argfile_default_contents, 0, "\n", "\r\n"); #endif base::CreateDirectory(arg_file.DirName()); base::WriteFile(arg_file, argfile_default_contents.c_str(),
diff --git a/tools/gn/setup.cc b/tools/gn/setup.cc index aa8e8f0..033dab4 100644 --- a/tools/gn/setup.cc +++ b/tools/gn/setup.cc
@@ -370,7 +370,7 @@ #if defined(OS_WIN) // Use Windows lineendings for this file since it will often open in // Notepad which can't handle Unix ones. - ReplaceSubstringsAfterOffset(&contents, 0, "\n", "\r\n"); + base::ReplaceSubstringsAfterOffset(&contents, 0, "\n", "\r\n"); #endif if (base::WriteFile(build_arg_file, contents.c_str(), static_cast<int>(contents.size())) == -1) {