Index: chrome/browser/password_manager/native_backend_libsecret.cc |
diff --git a/chrome/browser/password_manager/native_backend_libsecret.cc b/chrome/browser/password_manager/native_backend_libsecret.cc |
index 17051f9ccbf82d1de69850dfb255c26b2c3ffcc0..95886e50c63bb90038c1ef43d973530fe113051f 100644 |
--- a/chrome/browser/password_manager/native_backend_libsecret.cc |
+++ b/chrome/browser/password_manager/native_backend_libsecret.cc |
@@ -119,14 +119,17 @@ const SecretSchema kLibsecretSchema = { |
{"application", SECRET_SCHEMA_ATTRIBUTE_STRING}, |
{nullptr, SECRET_SCHEMA_ATTRIBUTE_STRING}}}; |
-char* GetStringFromAttributes(GHashTable* attrs, const char* keyname) { |
- return static_cast<char*>(g_hash_table_lookup(attrs, keyname)); |
+std::string GetStringFromAttributes(GHashTable* attrs, const char* keyname) { |
vabr (Chromium)
2015/01/29 14:10:34
I would suggest still returning char* and carefull
dvadym
2015/01/29 14:21:40
Done.
|
+ gpointer value = g_hash_table_lookup(attrs, keyname); |
+ return value ? std::string(static_cast<char*>(value)) : std::string(); |
} |
uint32_t GetUintFromAttributes(GHashTable* attrs, const char* keyname) { |
- char* value = static_cast<char*>(g_hash_table_lookup(attrs, keyname)); |
+ gpointer value = g_hash_table_lookup(attrs, keyname); |
+ if (value == NULL) |
vabr (Chromium)
2015/01/29 14:10:34
nit: NULL -> nullptr
dvadym
2015/01/29 14:21:40
Done.
|
+ return uint32_t(); |
uint32_t result; |
- bool value_ok = base::StringToUint(value, &result); |
+ bool value_ok = base::StringToUint(static_cast<char*>(value), &result); |
DCHECK(value_ok); |
return result; |
} |
@@ -135,7 +138,8 @@ uint32_t GetUintFromAttributes(GHashTable* attrs, const char* keyname) { |
// Note: does *not* get the actual password, as that is not a key attribute! |
// Returns nullptr if the attributes are for the wrong application. |
scoped_ptr<PasswordForm> FormOutOfAttributes(GHashTable* attrs) { |
- base::StringPiece app_value = GetStringFromAttributes(attrs, "application"); |
+ std::string app_string = GetStringFromAttributes(attrs, "application"); |
vabr (Chromium)
2015/01/29 14:10:34
Please do not convert to std::string, that harms p
dvadym
2015/01/29 14:21:39
Done.
|
+ base::StringPiece app_value = app_string; |
if (!app_value.starts_with(kLibsecretAppString)) |
return scoped_ptr<PasswordForm>(); |