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

Side by Side Diff: dbus/values_util.cc

Issue 9732029: Fix dbus::PopDataAsValue's behavior when a dictionary's keys including dots (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: _ Created 8 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | dbus/values_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "dbus/values_util.h" 5 #include "dbus/values_util.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 scoped_ptr<Value> key(PopDataAsValue(&entry_reader)); 50 scoped_ptr<Value> key(PopDataAsValue(&entry_reader));
51 if (!key.get()) 51 if (!key.get())
52 return false; 52 return false;
53 // Use JSONWriter to convert an arbitrary value to a string. 53 // Use JSONWriter to convert an arbitrary value to a string.
54 base::JSONWriter::Write(key.get(), &key_string); 54 base::JSONWriter::Write(key.get(), &key_string);
55 } 55 }
56 // Get the value and set the key-value pair. 56 // Get the value and set the key-value pair.
57 Value* value = PopDataAsValue(&entry_reader); 57 Value* value = PopDataAsValue(&entry_reader);
58 if (!value) 58 if (!value)
59 return false; 59 return false;
60 dictionary_value->Set(key_string, value); 60 dictionary_value->SetWithoutPathExpansion(key_string, value);
satorux1 2012/03/20 16:55:09 Wow, that's subtle...
61 } 61 }
62 return true; 62 return true;
63 } 63 }
64 64
65 } // namespace 65 } // namespace
66 66
67 Value* PopDataAsValue(MessageReader* reader) { 67 Value* PopDataAsValue(MessageReader* reader) {
68 Value* result = NULL; 68 Value* result = NULL;
69 switch (reader->GetDataType()) { 69 switch (reader->GetDataType()) {
70 case Message::INVALID_DATA: 70 case Message::INVALID_DATA:
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 MessageReader sub_reader(NULL); 176 MessageReader sub_reader(NULL);
177 if (reader->PopVariant(&sub_reader)) 177 if (reader->PopVariant(&sub_reader))
178 result = PopDataAsValue(&sub_reader); 178 result = PopDataAsValue(&sub_reader);
179 break; 179 break;
180 } 180 }
181 } 181 }
182 return result; 182 return result;
183 } 183 }
184 184
185 } // namespace dbus 185 } // namespace dbus
OLDNEW
« no previous file with comments | « no previous file | dbus/values_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698