Index: chrome/installer/util/google_update_settings.cc |
diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc |
index 7b2fbc3a66116aaed2e5d4da2759593284afca18..b3467bc2efc40ea6db3e98acd6c7a9e70c3efa5e 100644 |
--- a/chrome/installer/util/google_update_settings.cc |
+++ b/chrome/installer/util/google_update_settings.cc |
@@ -5,6 +5,7 @@ |
#include "chrome/installer/util/google_update_settings.h" |
#include <algorithm> |
+#include <limits> |
#include "base/command_line.h" |
#include "base/files/file_path.h" |
@@ -70,7 +71,7 @@ bool ReadGoogleUpdateStrKey(const wchar_t* const name, base::string16* value) { |
bool WriteGoogleUpdateAggregateNumKeyInternal( |
const AppRegistrationData& app_reg_data, |
const wchar_t* const name, |
- int value, |
+ size_t value, |
const wchar_t* const aggregate) { |
DCHECK(aggregate); |
DCHECK(GoogleUpdateSettings::IsSystemInstall()); |
@@ -90,7 +91,11 @@ bool WriteGoogleUpdateAggregateNumKeyInternal( |
reg_path.append(name); |
RegKey key(HKEY_LOCAL_MACHINE, reg_path.c_str(), kAccess); |
key.WriteValue(google_update::kRegAggregateMethod, aggregate); |
- return (key.WriteValue(uniquename.c_str(), value) == ERROR_SUCCESS); |
+ |
+ DWORD dword_value = (value > std::numeric_limits<DWORD>::max() ? |
+ std::numeric_limits<DWORD>::max() : |
+ static_cast<DWORD>(value)); |
+ return (key.WriteValue(uniquename.c_str(), dword_value) == ERROR_SUCCESS); |
} |
// Updates a registry key |name| to be |value| for the given |app_reg_data|. |
@@ -546,8 +551,8 @@ bool GoogleUpdateSettings::UpdateGoogleUpdateApKey( |
return modified; |
} |
-void GoogleUpdateSettings::UpdateProfileCounts(int profiles_active, |
- int profiles_signedin) { |
+void GoogleUpdateSettings::UpdateProfileCounts(size_t profiles_active, |
+ size_t profiles_signedin) { |
BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
// System-level installs must write into the ClientStateMedium key shared by |
// all users. Special treatment is used to aggregate across those users. |
@@ -569,10 +574,10 @@ void GoogleUpdateSettings::UpdateProfileCounts(int profiles_active, |
// user-level installs. |
WriteGoogleUpdateStrKeyInternal(dist->GetAppRegistrationData(), |
google_update::kRegProfilesActive, |
- base::IntToString16(profiles_active)); |
+ base::SizeTToString16(profiles_active)); |
WriteGoogleUpdateStrKeyInternal(dist->GetAppRegistrationData(), |
google_update::kRegProfilesSignedIn, |
- base::IntToString16(profiles_signedin)); |
+ base::SizeTToString16(profiles_signedin)); |
} |
} |