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

Unified Diff: chrome/plugin/plugin_main_mac.mm

Issue 3030035: Use built-in size function from std::string instead of strlen function. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: rebased + review Created 10 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/plugin/plugin_main_mac.mm
diff --git a/chrome/plugin/plugin_main_mac.mm b/chrome/plugin/plugin_main_mac.mm
index cc5b67e9595b9236a5c09c8f7c3604712741d7a1..2536d9b88b0e23d18e6fd7e6cbf6a681a0eaf9ab 100644
--- a/chrome/plugin/plugin_main_mac.mm
+++ b/chrome/plugin/plugin_main_mac.mm
@@ -25,16 +25,15 @@ void TrimInterposeEnvironment() {
// need to handle are:
// 1) The whole string is "<kInterposeLibraryPath>", so just clear it, or
// 2) ":<kInterposeLibraryPath>" is the end of the string, so trim and re-set.
- int suffix_offset = strlen(interpose_list.c_str()) -
- strlen(plugin_interpose_strings::kInterposeLibraryPath);
-
+ std::string interpose_library_path(
+ plugin_interpose_strings::kInterposeLibraryPath);
+ DCHECK_GE(interpose_list.size(), interpose_library_path.size());
+ size_t suffix_offset = interpose_list.size() - interpose_library_path.size();
if (suffix_offset == 0 &&
- strcmp(interpose_list.c_str(),
- plugin_interpose_strings::kInterposeLibraryPath) == 0) {
+ interpose_list == interpose_library_path) {
env->UnSetVar(plugin_interpose_strings::kDYLDInsertLibrariesKey);
} else if (suffix_offset > 0 && interpose_list[suffix_offset - 1] == ':' &&
- strcmp(interpose_list.c_str() + suffix_offset,
- plugin_interpose_strings::kInterposeLibraryPath) == 0) {
+ interpose_list.substr(suffix_offset) == interpose_library_path) {
std::string trimmed_list = interpose_list.substr(0, suffix_offset - 1);
env->SetEnv(plugin_interpose_strings::kDYLDInsertLibrariesKey,
trimmed_list.c_str());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698