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

Unified Diff: chrome/installer/util/install_util.cc

Issue 1220653002: Fix some case-insensitive cases for StartsWith (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac fix 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 side-by-side diff with in-line comments
Download patch
Index: chrome/installer/util/install_util.cc
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index 4fc383ab86bed3bb094798d144231fb5493a1051..e8fd6aa1f4921b467aa284a23438fa0031663e2f 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -393,7 +393,16 @@ bool InstallUtil::IsPerUserInstall(const base::FilePath& exe_path) {
env->SetVar(kEnvProgramFilesPath,
base::WideToUTF8(program_files_path.value()));
}
- return !base::StartsWith(exe_path.value(), program_files_path.value(), false);
+
+ // Return true if the program files path is not a case-insensitive prefix of
+ // the exe path.
+ if (exe_path.value().size() < program_files_path.value().size())
+ return true;
+ DWORD prefix_len = static_cast<DWORD>(program_files_path.value().size());
grt (UTC plus 2) 2015/07/01 17:55:42 base::saturated_cast<DWORD, size_t>()?
+ return ::CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE,
+ exe_path.value().data(), prefix_len,
+ program_files_path.value().data(), prefix_len) !=
+ CSTR_EQUAL;
}
bool InstallUtil::IsMultiInstall(BrowserDistribution* dist,

Powered by Google App Engine
This is Rietveld 408576698