summaryrefslogtreecommitdiffstats
path: root/chrome/installer/util/master_preferences.cc
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-29 19:59:08 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-29 19:59:08 +0000
commitb4cebf87816cde49f6d4991ffa254e5ead97703b (patch)
treefb12e4b464a43af846f30bbd0dbe9484150373b0 /chrome/installer/util/master_preferences.cc
parent45ce59f19161b517c04a4e3bcd0890b938382b06 (diff)
downloadchromium_src-b4cebf87816cde49f6d4991ffa254e5ead97703b.zip
chromium_src-b4cebf87816cde49f6d4991ffa254e5ead97703b.tar.gz
chromium_src-b4cebf87816cde49f6d4991ffa254e5ead97703b.tar.bz2
Change the signature of JSONReader::Read() and related
methods to be more friendly to use with scoped_ptr. Change all the callsites. Review URL: http://codereview.chromium.org/16270 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7486 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util/master_preferences.cc')
-rw-r--r--chrome/installer/util/master_preferences.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc
index 34d10a9..21c74dd 100644
--- a/chrome/installer/util/master_preferences.cc
+++ b/chrome/installer/util/master_preferences.cc
@@ -12,14 +12,13 @@ namespace {
DictionaryValue* ReadJSONPrefs(const std::string& data) {
JSONStringValueSerializer json(data);
- Value* root;
- if (!json.Deserialize(&root, NULL))
+ scoped_ptr<Value> root(json.Deserialize(NULL));
+ if (!root.get())
return NULL;
- if (!root->IsType(Value::TYPE_DICTIONARY)) {
- delete root;
+ if (!root->IsType(Value::TYPE_DICTIONARY))
return NULL;
- }
- return static_cast<DictionaryValue*>(root);
+
+ return static_cast<DictionaryValue*>(root.release());
}
bool GetBooleanPref(const DictionaryValue* prefs, const std::wstring& name) {