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

Side by Side Diff: third_party/libaddressinput/chromium/cpp/src/country_rules_aggregator.cc

Issue 172523004: rAc libaddressinput - fix bug due to argument evaluation order (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2014 Google Inc. 1 // Copyright (C) 2014 Google Inc.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 67
68 json_ = Json::Build().Pass(); 68 json_ = Json::Build().Pass();
69 if (!success || !json_->ParseObject(data)) { 69 if (!success || !json_->ParseObject(data)) {
70 (*rules_ready_)(false, country_code_, scoped_ptr<Ruleset>()); 70 (*rules_ready_)(false, country_code_, scoped_ptr<Ruleset>());
71 Reset(); 71 Reset();
72 return; 72 return;
73 } 73 }
74 74
75 scoped_ptr<Ruleset> ruleset = Build(key_, COUNTRY); 75 scoped_ptr<Ruleset> ruleset = Build(key_, COUNTRY);
76 (*rules_ready_)(ruleset != NULL, country_code_, ruleset.Pass()); 76 const bool parse_success = ruleset != NULL;
77 (*rules_ready_)(parse_success, country_code_, ruleset.Pass());
77 Reset(); 78 Reset();
78 } 79 }
79 80
80 scoped_ptr<Ruleset> CountryRulesAggregator::Build(const std::string& key, 81 scoped_ptr<Ruleset> CountryRulesAggregator::Build(const std::string& key,
81 AddressField field) { 82 AddressField field) {
82 scoped_ptr<Rule> rule = ParseRule(key, field); 83 scoped_ptr<Rule> rule = ParseRule(key, field);
83 if (rule == NULL) { 84 if (rule == NULL) {
84 return scoped_ptr<Ruleset>(); 85 return scoped_ptr<Ruleset>();
85 } 86 }
86 87
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 void CountryRulesAggregator::Reset() { 146 void CountryRulesAggregator::Reset() {
146 country_code_.clear(); 147 country_code_.clear();
147 key_.clear(); 148 key_.clear();
148 rules_ready_.reset(); 149 rules_ready_.reset();
149 json_.reset(); 150 json_.reset();
150 non_default_languages_.clear(); 151 non_default_languages_.clear();
151 } 152 }
152 153
153 } // namespace addressinput 154 } // namespace addressinput
154 } // namespace i18n 155 } // namespace i18n
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698