OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 | 8 |
9 ///////////////////// Value //////////////////// | 9 ///////////////////// Value //////////////////// |
10 | 10 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 bool StringValue::Equals(const Value* other) const { | 178 bool StringValue::Equals(const Value* other) const { |
179 if (other->GetType() != GetType()) | 179 if (other->GetType() != GetType()) |
180 return false; | 180 return false; |
181 std::string lhs, rhs; | 181 std::string lhs, rhs; |
182 return GetAsString(&lhs) && other->GetAsString(&rhs) && lhs == rhs; | 182 return GetAsString(&lhs) && other->GetAsString(&rhs) && lhs == rhs; |
183 } | 183 } |
184 | 184 |
185 ///////////////////// BinaryValue //////////////////// | 185 ///////////////////// BinaryValue //////////////////// |
186 | 186 |
187 //static | 187 // static |
188 BinaryValue* BinaryValue::Create(char* buffer, size_t size) { | 188 BinaryValue* BinaryValue::Create(char* buffer, size_t size) { |
189 if (!buffer) | 189 if (!buffer) |
190 return NULL; | 190 return NULL; |
191 | 191 |
192 return new BinaryValue(buffer, size); | 192 return new BinaryValue(buffer, size); |
193 } | 193 } |
194 | 194 |
195 //static | 195 // static |
196 BinaryValue* BinaryValue::CreateWithCopiedBuffer(char* buffer, size_t size) { | 196 BinaryValue* BinaryValue::CreateWithCopiedBuffer(char* buffer, size_t size) { |
197 if (!buffer) | 197 if (!buffer) |
198 return NULL; | 198 return NULL; |
199 | 199 |
200 char* buffer_copy = new char[size]; | 200 char* buffer_copy = new char[size]; |
201 memcpy(buffer_copy, buffer, size); | 201 memcpy(buffer_copy, buffer, size); |
202 return new BinaryValue(buffer_copy, size); | 202 return new BinaryValue(buffer_copy, size); |
203 } | 203 } |
204 | 204 |
205 | 205 |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 lhs_it != end() && rhs_it != other_list->end(); | 655 lhs_it != end() && rhs_it != other_list->end(); |
656 ++lhs_it, ++rhs_it) { | 656 ++lhs_it, ++rhs_it) { |
657 if (!(*lhs_it)->Equals(*rhs_it)) | 657 if (!(*lhs_it)->Equals(*rhs_it)) |
658 return false; | 658 return false; |
659 } | 659 } |
660 if (lhs_it != end() || rhs_it != other_list->end()) | 660 if (lhs_it != end() || rhs_it != other_list->end()) |
661 return false; | 661 return false; |
662 | 662 |
663 return true; | 663 return true; |
664 } | 664 } |
OLD | NEW |