summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-06 06:03:25 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-06 06:03:25 +0000
commitbc38b2cd46f75be44922cae11378b0624b6546f9 (patch)
treebea02403842ed6ea5e4a7cc222e934849fdcfe8a /base
parent4b91f58e0ffc7866b06ec4d542951c788942f125 (diff)
downloadchromium_src-bc38b2cd46f75be44922cae11378b0624b6546f9.zip
chromium_src-bc38b2cd46f75be44922cae11378b0624b6546f9.tar.gz
chromium_src-bc38b2cd46f75be44922cae11378b0624b6546f9.tar.bz2
Add UTF-8 DCHECK()s in values.cc (since keys/paths are expected to be UTF-8).
BUG=23581 TEST=unit tests pass Review URL: http://codereview.chromium.org/3081018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55190 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/values.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/base/values.cc b/base/values.cc
index 78547a4..2cb1a1d 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -378,6 +378,7 @@ bool DictionaryValue::Equals(const Value* other) const {
}
bool DictionaryValue::HasKey(const std::string& key) const {
+ DCHECK(IsStringUTF8(key));
ValueMap::const_iterator current_entry = dictionary_.find(key);
DCHECK((current_entry == dictionary_.end()) || current_entry->second);
return current_entry != dictionary_.end();
@@ -404,6 +405,7 @@ void DictionaryValue::Clear() {
}
void DictionaryValue::Set(const std::string& path, Value* in_value) {
+ DCHECK(IsStringUTF8(path));
DCHECK(in_value);
std::string current_path(path);
@@ -507,6 +509,7 @@ void DictionaryValue::SetWithoutPathExpansion(const std::wstring& key,
}
bool DictionaryValue::Get(const std::string& path, Value** out_value) const {
+ DCHECK(IsStringUTF8(path));
std::string current_path(path);
const DictionaryValue* current_dictionary = this;
for (size_t delimiter_position = current_path.find('.');
@@ -682,6 +685,7 @@ bool DictionaryValue::GetList(const std::wstring& path,
bool DictionaryValue::GetWithoutPathExpansion(const std::string& key,
Value** out_value) const {
+ DCHECK(IsStringUTF8(key));
ValueMap::const_iterator entry_iterator = dictionary_.find(key);
if (entry_iterator == dictionary_.end())
return false;
@@ -792,6 +796,7 @@ bool DictionaryValue::GetListWithoutPathExpansion(const std::wstring& key,
}
bool DictionaryValue::Remove(const std::string& path, Value** out_value) {
+ DCHECK(IsStringUTF8(path));
std::string current_path(path);
DictionaryValue* current_dictionary = this;
size_t delimiter_position = current_path.rfind('.');
@@ -813,6 +818,7 @@ bool DictionaryValue::Remove(const std::wstring& path, Value** out_value) {
bool DictionaryValue::RemoveWithoutPathExpansion(const std::string& key,
Value** out_value) {
+ DCHECK(IsStringUTF8(key));
ValueMap::iterator entry_iterator = dictionary_.find(key);
if (entry_iterator == dictionary_.end())
return false;