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

Issue 3081018: Add UTF-8 DCHECK()s in values.cc (since keys/paths are expected to be UTF-8). (Closed)

Created:
10 years, 4 months ago by viettrungluu
Modified:
9 years, 6 months ago
CC:
chromium-reviews, brettw-cc_chromium.org
Visibility:
Public.

Description

Add UTF-8 DCHECK()s in values.cc (since keys/paths are expected to be UTF-8). BUG=23581 TEST=unit tests pass Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=55190

Patch Set 1 #

Patch Set 2 : oops #

Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -0 lines) Patch
M base/values.cc View 1 6 chunks +6 lines, -0 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
viettrungluu
I think I've covered all the places where paths/keys are passed in....
10 years, 4 months ago (2010-08-06 00:59:51 UTC) #1
brettw
10 years, 4 months ago (2010-08-06 05:58:10 UTC) #2
LGTM

On Thu, Aug 5, 2010 at 5:59 PM,  <viettrungluu@chromium.org> wrote:
> Reviewers: Jungshik Shin, brettw,
>
> Message:
> I think I've covered all the places where paths/keys are passed in....
>
> Description:
> Add UTF-8 DCHECK()s in values.cc (since keys/paths are expected to be
> UTF-8).
>
> BUG=23581
> TEST=unit tests pass
>
> Please review this at http://codereview.chromium.org/3081018/show
>
> Affected files:
>  M base/values.cc
>
>
> Index: base/values.cc
> diff --git a/base/values.cc b/base/values.cc
> index
>
78547a44991db0aef059a16eaed3e8bd1e24effb..31f08f38242dfdbf88507218d107769636e2de3e
> 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(key));
>   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;
>
>
>

Powered by Google App Engine
This is Rietveld 408576698