From: Seongjun Yim Date: Thu, 18 Apr 2013 10:27:33 +0000 (+0900) Subject: apply json spec for parsing double X-Git-Tag: 2.1b_release~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0c76a39354969585842b5549dd829e6dce441553;p=framework%2Fosp%2Fjson.git apply json spec for parsing double Change-Id: I83479453f2d5e3e4b4c75e218ab12582c344b115 Signed-off-by: Seongjun Yim --- diff --git a/src/FWebJson_JsonParserImpl.cpp b/src/FWebJson_JsonParserImpl.cpp index e28ccea..d4aa059 100755 --- a/src/FWebJson_JsonParserImpl.cpp +++ b/src/FWebJson_JsonParserImpl.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include "FWebJson_JsonParserImpl.h" #include "FWebJson_JsonUtils.h" @@ -458,13 +459,11 @@ _JsonParserImpl::ParseNumberN(void) SysTryReturn(NID_WEB_JSON, created, null, E_INVALID_DATA, "[E_INVALID_DATA] Input data malformed [%c] at [%d]", __pJsonData[__parserPosition], __parserPosition); - double number = 0.0; - JsonNumber* pJsonNumber = null; + std::unique_ptr pNumber(Tizen::Base::_StringConverter::CopyToCharArrayN(numString)); + SysTryReturn(NID_WEB_JSON, pNumber.get(), null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); + double number = atof(pNumber.get()); - result r = Double::Parse(numString, number); - SysTryReturn(NID_WEB_JSON, r == E_SUCCESS, null, r, "[%s] parse double from string failed", GetErrorMessage(r)); - - pJsonNumber = new (std::nothrow) JsonNumber(number); + JsonNumber* pJsonNumber = new (std::nothrow) JsonNumber(number); SysTryReturn(NID_WEB_JSON, pJsonNumber, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); return pJsonNumber;