summaryrefslogtreecommitdiffstats
path: root/chrome/plugin
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-06 03:09:17 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-06 03:09:17 +0000
commita651e03c558e6d32105c1f957b4ea07df2feca63 (patch)
tree75cdda46b32e4a1ae1807ee0ee4061a3995bd1ef /chrome/plugin
parentecebcc98e796f701420d7f41f02d04e11bd284bf (diff)
downloadchromium_src-a651e03c558e6d32105c1f957b4ea07df2feca63.zip
chromium_src-a651e03c558e6d32105c1f957b4ea07df2feca63.tar.gz
chromium_src-a651e03c558e6d32105c1f957b4ea07df2feca63.tar.bz2
Use built-in size function from std::string instead of strlen function.
This was missed in another review at http://codereview.chromium.org/3043018/diff/22001/23009#newcode28, noticed by viettrungluu. BUG=None TEST=trybots Review URL: http://codereview.chromium.org/3030035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55181 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin')
-rw-r--r--chrome/plugin/plugin_main_mac.mm13
1 files changed, 6 insertions, 7 deletions
diff --git a/chrome/plugin/plugin_main_mac.mm b/chrome/plugin/plugin_main_mac.mm
index 46f9183..47957ba 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->SetVar(plugin_interpose_strings::kDYLDInsertLibrariesKey,
trimmed_list.c_str());