From 2a552d4fc0b8c84964f1c817f3a298e0daf1c804 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 16 Jun 2014 18:42:53 -0400 Subject: [PATCH] Variant - Updated operator+= to handle trivial values. --- src/Variant.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Variant.cpp b/src/Variant.cpp index 50769b4d2..3bd4959a4 100644 --- a/src/Variant.cpp +++ b/src/Variant.cpp @@ -1316,15 +1316,26 @@ Variant& Variant::operator+= (const Variant& other) case type_real: switch (right._type) { - case type_unknown: throw std::string ("Cannot add unknown type"); - case type_boolean: right.cast (type_real); _real += right._real; break; - case type_integer: right.cast (type_real); _real += right._real; break; - case type_real: _real += right._real; break; - case type_string: cast (type_string); _string += right._string; break; + case type_unknown: + throw std::string ("Cannot add unknown type"); + + case type_boolean: + case type_integer: + case type_real: + right.cast (type_real); + _real += right._real; + break; + + case type_string: + cast (type_string); + _string += right._string; + break; + case type_date: _type = type_date; _date = (unsigned) (int) _real + right._date; break; + case type_duration: _type = type_duration; _duration = (unsigned) (int) _real + right._duration;