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

Unified Diff: base/values.cc

Issue 6893089: Modified Value::GetAsDouble so the function returns true when the object holds an Integer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fix Created 9 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/values_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/values.cc
diff --git a/base/values.cc b/base/values.cc
index 9f2816ae655954b51cb2ba9a285fd167f63bd799..0f30e379eb3301d915c0b06d1c78066fa993f10f 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -179,7 +179,9 @@ bool FundamentalValue::GetAsInteger(int* out_value) const {
bool FundamentalValue::GetAsDouble(double* out_value) const {
if (out_value && IsType(TYPE_DOUBLE))
*out_value = double_value_;
- return (IsType(TYPE_DOUBLE));
+ else if (out_value && IsType(TYPE_INTEGER))
+ *out_value = integer_value_;
+ return (IsType(TYPE_DOUBLE) || IsType(TYPE_INTEGER));
}
FundamentalValue* FundamentalValue::DeepCopy() const {
« no previous file with comments | « no previous file | base/values_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698