From 6b94f01d1c8ad386d497428c7397b1a99614aeba Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 14 Mar 2017 10:28:45 -0400 Subject: Replace FX_DOUBLE with underlying double type. Change-Id: Ife4a46157ec1044b24965f7d282858f8261031b1 Reviewed-on: https://pdfium-review.googlesource.com/3030 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- core/fxcrt/fx_system.h | 1 - xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 127 ++++++++++++++++++------------------ xfa/fxfa/fm2js/xfa_fm2jscontext.h | 2 +- xfa/fxfa/fm2js/xfa_lexer.cpp | 6 +- xfa/fxfa/parser/xfa_localevalue.cpp | 42 ++++++------ xfa/fxfa/parser/xfa_localevalue.h | 2 +- xfa/fxfa/parser/xfa_utils.cpp | 46 ++++++------- xfa/fxfa/parser/xfa_utils.h | 2 +- 8 files changed, 113 insertions(+), 115 deletions(-) diff --git a/core/fxcrt/fx_system.h b/core/fxcrt/fx_system.h index a0878981d8..4c938d9b27 100644 --- a/core/fxcrt/fx_system.h +++ b/core/fxcrt/fx_system.h @@ -69,7 +69,6 @@ extern "C" { typedef void* FX_POSITION; // Keep until fxcrt containers gone typedef float FX_FLOAT; // Keep, allow upgrade to doubles. -typedef double FX_DOUBLE; // Keep, allow downgrade to floats. #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 356180834f..3ecea1643c 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -522,7 +522,7 @@ void CXFA_FM2JSContext::Abs(CFXJSE_Value* pThis, return; } - FX_DOUBLE dValue = ValueToDouble(pThis, argOne.get()); + double dValue = ValueToDouble(pThis, argOne.get()); if (dValue < 0) dValue = -dValue; @@ -541,7 +541,7 @@ void CXFA_FM2JSContext::Avg(CFXJSE_Value* pThis, v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); uint32_t uCount = 0; - FX_DOUBLE dSum = 0.0; + double dSum = 0.0; for (int32_t i = 0; i < argc; i++) { std::unique_ptr argValue = args.GetValue(i); if (argValue->IsNull()) @@ -695,7 +695,7 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); uint32_t uCount = 0; - FX_DOUBLE dMaxValue = 0.0; + double dMaxValue = 0.0; for (int32_t i = 0; i < args.GetLength(); i++) { std::unique_ptr argValue = args.GetValue(i); if (argValue->IsNull()) @@ -723,7 +723,7 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, continue; uCount++; - FX_DOUBLE dValue = ValueToDouble(pThis, newPropertyValue.get()); + double dValue = ValueToDouble(pThis, newPropertyValue.get()); dMaxValue = (uCount == 1) ? dValue : std::max(dMaxValue, dValue); } } else { @@ -735,7 +735,7 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, continue; uCount++; - FX_DOUBLE dValue = ValueToDouble(pThis, newPropertyValue.get()); + double dValue = ValueToDouble(pThis, newPropertyValue.get()); dMaxValue = (uCount == 1) ? dValue : std::max(dMaxValue, dValue); } } @@ -746,11 +746,11 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, continue; uCount++; - FX_DOUBLE dValue = ValueToDouble(pThis, newPropertyValue.get()); + double dValue = ValueToDouble(pThis, newPropertyValue.get()); dMaxValue = (uCount == 1) ? dValue : std::max(dMaxValue, dValue); } else { uCount++; - FX_DOUBLE dValue = ValueToDouble(pThis, argValue.get()); + double dValue = ValueToDouble(pThis, argValue.get()); dMaxValue = (uCount == 1) ? dValue : std::max(dMaxValue, dValue); } } @@ -769,7 +769,7 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); uint32_t uCount = 0; - FX_DOUBLE dMinValue = 0.0; + double dMinValue = 0.0; for (int32_t i = 0; i < args.GetLength(); i++) { std::unique_ptr argValue = args.GetValue(i); if (argValue->IsNull()) @@ -797,7 +797,7 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, continue; uCount++; - FX_DOUBLE dValue = ValueToDouble(pThis, newPropertyValue.get()); + double dValue = ValueToDouble(pThis, newPropertyValue.get()); dMinValue = uCount == 1 ? dValue : std::min(dMinValue, dValue); } } else { @@ -809,7 +809,7 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, continue; uCount++; - FX_DOUBLE dValue = ValueToDouble(pThis, newPropertyValue.get()); + double dValue = ValueToDouble(pThis, newPropertyValue.get()); dMinValue = uCount == 1 ? dValue : std::min(dMinValue, dValue); } } @@ -820,11 +820,11 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, continue; uCount++; - FX_DOUBLE dValue = ValueToDouble(pThis, newPropertyValue.get()); + double dValue = ValueToDouble(pThis, newPropertyValue.get()); dMinValue = uCount == 1 ? dValue : std::min(dMinValue, dValue); } else { uCount++; - FX_DOUBLE dValue = ValueToDouble(pThis, argValue.get()); + double dValue = ValueToDouble(pThis, argValue.get()); dMinValue = uCount == 1 ? dValue : std::min(dMinValue, dValue); } } @@ -854,9 +854,9 @@ void CXFA_FM2JSContext::Mod(CFXJSE_Value* pThis, } bool argOneResult; - FX_DOUBLE dDividend = ExtractDouble(pThis, argOne.get(), &argOneResult); + double dDividend = ExtractDouble(pThis, argOne.get(), &argOneResult); bool argTwoResult; - FX_DOUBLE dDivisor = ExtractDouble(pThis, argTwo.get(), &argTwoResult); + double dDivisor = ExtractDouble(pThis, argTwo.get(), &argTwoResult); if (!argOneResult || !argTwoResult) { pContext->ThrowArgumentMismatchException(); return; @@ -889,7 +889,7 @@ void CXFA_FM2JSContext::Round(CFXJSE_Value* pThis, } bool dValueRet; - FX_DOUBLE dValue = ExtractDouble(pThis, argOne.get(), &dValueRet); + double dValue = ExtractDouble(pThis, argOne.get(), &dValueRet); if (!dValueRet) { pContext->ThrowArgumentMismatchException(); return; @@ -904,7 +904,7 @@ void CXFA_FM2JSContext::Round(CFXJSE_Value* pThis, } bool dPrecisionRet; - FX_DOUBLE dPrecision = ExtractDouble(pThis, argTwo.get(), &dPrecisionRet); + double dPrecision = ExtractDouble(pThis, argTwo.get(), &dPrecisionRet); if (!dPrecisionRet) { pContext->ThrowArgumentMismatchException(); return; @@ -932,7 +932,7 @@ void CXFA_FM2JSContext::Sum(CFXJSE_Value* pThis, CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); uint32_t uCount = 0; - FX_DOUBLE dSum = 0.0; + double dSum = 0.0; for (int32_t i = 0; i < argc; i++) { std::unique_ptr argValue = args.GetValue(i); if (argValue->IsNull()) @@ -2354,23 +2354,22 @@ void CXFA_FM2JSContext::Apr(CFXJSE_Value* pThis, return; } - FX_DOUBLE nPrincipal = ValueToDouble(pThis, argOne.get()); - FX_DOUBLE nPayment = ValueToDouble(pThis, argTwo.get()); - FX_DOUBLE nPeriods = ValueToDouble(pThis, argThree.get()); + double nPrincipal = ValueToDouble(pThis, argOne.get()); + double nPayment = ValueToDouble(pThis, argTwo.get()); + double nPeriods = ValueToDouble(pThis, argThree.get()); if (nPrincipal <= 0 || nPayment <= 0 || nPeriods <= 0) { pContext->ThrowArgumentMismatchException(); return; } - FX_DOUBLE r = - 2 * (nPeriods * nPayment - nPrincipal) / (nPeriods * nPrincipal); - FX_DOUBLE nTemp = 1; + double r = 2 * (nPeriods * nPayment - nPrincipal) / (nPeriods * nPrincipal); + double nTemp = 1; for (int32_t i = 0; i < nPeriods; ++i) nTemp *= (1 + r); - FX_DOUBLE nRet = r * nTemp / (nTemp - 1) - nPayment / nPrincipal; + double nRet = r * nTemp / (nTemp - 1) - nPayment / nPrincipal; while (fabs(nRet) > kFinancialPrecision) { - FX_DOUBLE nDerivative = + double nDerivative = ((nTemp + r * nPeriods * (nTemp / (1 + r))) * (nTemp - 1) - (r * nTemp * nPeriods * (nTemp / (1 + r)))) / ((nTemp - 1) * (nTemp - 1)); @@ -2440,17 +2439,17 @@ void CXFA_FM2JSContext::FV(CFXJSE_Value* pThis, return; } - FX_DOUBLE nAmount = ValueToDouble(pThis, argOne.get()); - FX_DOUBLE nRate = ValueToDouble(pThis, argTwo.get()); - FX_DOUBLE nPeriod = ValueToDouble(pThis, argThree.get()); + double nAmount = ValueToDouble(pThis, argOne.get()); + double nRate = ValueToDouble(pThis, argTwo.get()); + double nPeriod = ValueToDouble(pThis, argThree.get()); if ((nRate < 0) || (nPeriod <= 0) || (nAmount <= 0)) { pContext->ThrowArgumentMismatchException(); return; } - FX_DOUBLE dResult = 0; + double dResult = 0; if (nRate) { - FX_DOUBLE nTemp = 1; + double nTemp = 1; for (int i = 0; i < nPeriod; ++i) { nTemp *= 1 + nRate; } @@ -2539,24 +2538,24 @@ void CXFA_FM2JSContext::NPV(CFXJSE_Value* pThis, } } - FX_DOUBLE nRate = ValueToDouble(pThis, argValues[0].get()); + double nRate = ValueToDouble(pThis, argValues[0].get()); if (nRate <= 0) { pContext->ThrowArgumentMismatchException(); return; } - std::vector data(argc - 1); + std::vector data(argc - 1); for (int32_t i = 1; i < argc; i++) data.push_back(ValueToDouble(pThis, argValues[i].get())); - FX_DOUBLE nSum = 0; + double nSum = 0; int32_t iIndex = 0; for (int32_t i = 0; i < argc - 1; i++) { - FX_DOUBLE nTemp = 1; + double nTemp = 1; for (int32_t j = 0; j <= i; j++) nTemp *= 1 + nRate; - FX_DOUBLE nNum = data[iIndex++]; + double nNum = data[iIndex++]; nSum += nNum / nTemp; } args.GetReturnValue()->SetDouble(nSum); @@ -2674,15 +2673,15 @@ void CXFA_FM2JSContext::PV(CFXJSE_Value* pThis, return; } - FX_DOUBLE nAmount = ValueToDouble(pThis, argOne.get()); - FX_DOUBLE nRate = ValueToDouble(pThis, argTwo.get()); - FX_DOUBLE nPeriod = ValueToDouble(pThis, argThree.get()); + double nAmount = ValueToDouble(pThis, argOne.get()); + double nRate = ValueToDouble(pThis, argTwo.get()); + double nPeriod = ValueToDouble(pThis, argThree.get()); if ((nAmount <= 0) || (nRate < 0) || (nPeriod <= 0)) { pContext->ThrowArgumentMismatchException(); return; } - FX_DOUBLE nTemp = 1; + double nTemp = 1; for (int32_t i = 0; i < nPeriod; ++i) nTemp *= 1 + nRate; @@ -3172,7 +3171,7 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, } char* pTemp = nullptr; - FX_DOUBLE dFirstNumber = strtod(pData, &pTemp); + double dFirstNumber = strtod(pData, &pTemp); while (IsWhitespace(pData[u])) ++u; @@ -3219,7 +3218,7 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, strUnit = strFirstUnit; } - FX_DOUBLE dResult = 0; + double dResult = 0; if (strFirstUnit == "in" || strFirstUnit == "inches") { if (strUnit == "mm" || strUnit == "millimeters") dResult = dFirstNumber * 25.4; @@ -5074,8 +5073,8 @@ void CXFA_FM2JSContext::equality_operator(CFXJSE_Value* pThis, return; } - FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); - FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); + double first = ValueToDouble(pThis, argFirst.get()); + double second = ValueToDouble(pThis, argSecond.get()); args.GetReturnValue()->SetInteger((first == second) ? 1 : 0); } @@ -5107,8 +5106,8 @@ void CXFA_FM2JSContext::notequality_operator(CFXJSE_Value* pThis, return; } - FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); - FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); + double first = ValueToDouble(pThis, argFirst.get()); + double second = ValueToDouble(pThis, argSecond.get()); args.GetReturnValue()->SetInteger(first != second); } @@ -5161,8 +5160,8 @@ void CXFA_FM2JSContext::less_operator(CFXJSE_Value* pThis, return; } - FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); - FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); + double first = ValueToDouble(pThis, argFirst.get()); + double second = ValueToDouble(pThis, argSecond.get()); args.GetReturnValue()->SetInteger((first < second) ? 1 : 0); } @@ -5189,8 +5188,8 @@ void CXFA_FM2JSContext::lessequal_operator(CFXJSE_Value* pThis, return; } - FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); - FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); + double first = ValueToDouble(pThis, argFirst.get()); + double second = ValueToDouble(pThis, argSecond.get()); args.GetReturnValue()->SetInteger((first <= second) ? 1 : 0); } @@ -5216,8 +5215,8 @@ void CXFA_FM2JSContext::greater_operator(CFXJSE_Value* pThis, return; } - FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); - FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); + double first = ValueToDouble(pThis, argFirst.get()); + double second = ValueToDouble(pThis, argSecond.get()); args.GetReturnValue()->SetInteger((first > second) ? 1 : 0); } @@ -5244,8 +5243,8 @@ void CXFA_FM2JSContext::greaterequal_operator(CFXJSE_Value* pThis, return; } - FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); - FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); + double first = ValueToDouble(pThis, argFirst.get()); + double second = ValueToDouble(pThis, argSecond.get()); args.GetReturnValue()->SetInteger((first >= second) ? 1 : 0); } @@ -5266,8 +5265,8 @@ void CXFA_FM2JSContext::plus_operator(CFXJSE_Value* pThis, return; } - FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); - FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); + double first = ValueToDouble(pThis, argFirst.get()); + double second = ValueToDouble(pThis, argSecond.get()); args.GetReturnValue()->SetDouble(first + second); } @@ -5287,8 +5286,8 @@ void CXFA_FM2JSContext::minus_operator(CFXJSE_Value* pThis, return; } - FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); - FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); + double first = ValueToDouble(pThis, argFirst.get()); + double second = ValueToDouble(pThis, argSecond.get()); args.GetReturnValue()->SetDouble(first - second); } @@ -5308,8 +5307,8 @@ void CXFA_FM2JSContext::multiple_operator(CFXJSE_Value* pThis, return; } - FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); - FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); + double first = ValueToDouble(pThis, argFirst.get()); + double second = ValueToDouble(pThis, argSecond.get()); args.GetReturnValue()->SetDouble(first * second); } @@ -5330,13 +5329,13 @@ void CXFA_FM2JSContext::divide_operator(CFXJSE_Value* pThis, return; } - FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); + double second = ValueToDouble(pThis, argSecond.get()); if (second == 0.0) { pContext->ThrowDivideByZeroException(); return; } - FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); + double first = ValueToDouble(pThis, argFirst.get()); args.GetReturnValue()->SetDouble(first / second); } @@ -5389,7 +5388,7 @@ void CXFA_FM2JSContext::logical_not_operator(CFXJSE_Value* pThis, return; } - FX_DOUBLE first = ValueToDouble(pThis, argOne.get()); + double first = ValueToDouble(pThis, argOne.get()); args.GetReturnValue()->SetInteger((first == 0.0) ? 1 : 0); } @@ -6257,8 +6256,8 @@ FX_FLOAT CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis, } // static -FX_DOUBLE CXFA_FM2JSContext::ValueToDouble(CFXJSE_Value* pThis, - CFXJSE_Value* arg) { +double CXFA_FM2JSContext::ValueToDouble(CFXJSE_Value* pThis, + CFXJSE_Value* arg) { if (!arg) return 0; diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.h b/xfa/fxfa/fm2js/xfa_fm2jscontext.h index b56a0212d8..5008ceda6e 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.h +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.h @@ -437,7 +437,7 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { static bool ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* pValue); static int32_t ValueToInteger(CFXJSE_Value* pThis, CFXJSE_Value* pValue); static FX_FLOAT ValueToFloat(CFXJSE_Value* pThis, CFXJSE_Value* pValue); - static FX_DOUBLE ValueToDouble(CFXJSE_Value* pThis, CFXJSE_Value* pValue); + static double ValueToDouble(CFXJSE_Value* pThis, CFXJSE_Value* pValue); static void ValueToUTF8String(CFXJSE_Value* pValue, CFX_ByteString& outputValue); static double ExtractDouble(CFXJSE_Value* pThis, diff --git a/xfa/fxfa/fm2js/xfa_lexer.cpp b/xfa/fxfa/fm2js/xfa_lexer.cpp index e83877eb13..5d3f6f5890 100644 --- a/xfa/fxfa/fm2js/xfa_lexer.cpp +++ b/xfa/fxfa/fm2js/xfa_lexer.cpp @@ -38,7 +38,7 @@ struct XFA_FMDChar { } static bool isAvalid(const wchar_t* p, bool flag = 0); static bool string2number(const wchar_t* s, - FX_DOUBLE* pValue, + double* pValue, const wchar_t*& pEnd); static bool isUnicodeAlpha(uint16_t ch); }; @@ -60,7 +60,7 @@ inline bool XFA_FMDChar::isAvalid(const wchar_t* p, bool flag) { } inline bool XFA_FMDChar::string2number(const wchar_t* s, - FX_DOUBLE* pValue, + double* pValue, const wchar_t*& pEnd) { if (s) { *pValue = wcstod((wchar_t*)s, (wchar_t**)&pEnd); @@ -403,7 +403,7 @@ CXFA_FMToken* CXFA_FMLexer::Scan() { uint32_t CXFA_FMLexer::Number(CXFA_FMToken* t, const wchar_t* p, const wchar_t*& pEnd) { - FX_DOUBLE number = 0; + double number = 0; if (XFA_FMDChar::string2number(p, &number, pEnd)) { return 1; } diff --git a/xfa/fxfa/parser/xfa_localevalue.cpp b/xfa/fxfa/parser/xfa_localevalue.cpp index 6dd02e6a85..b011f0fdad 100644 --- a/xfa/fxfa/parser/xfa_localevalue.cpp +++ b/xfa/fxfa/parser/xfa_localevalue.cpp @@ -17,22 +17,22 @@ #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" -static const FX_DOUBLE fraction_scales[] = {0.1, - 0.01, - 0.001, - 0.0001, - 0.00001, - 0.000001, - 0.0000001, - 0.00000001, - 0.000000001, - 0.0000000001, - 0.00000000001, - 0.000000000001, - 0.0000000000001, - 0.00000000000001, - 0.000000000000001, - 0.0000000000000001}; +static const double fraction_scales[] = {0.1, + 0.01, + 0.001, + 0.0001, + 0.00001, + 0.000001, + 0.0000001, + 0.00000001, + 0.000000001, + 0.0000000001, + 0.00000000001, + 0.000000000001, + 0.0000000000001, + 0.00000000000001, + 0.000000000000001, + 0.0000000000000001}; CXFA_LocaleValue::CXFA_LocaleValue() { m_dwType = XFA_VT_NULL; m_bValid = true; @@ -286,7 +286,7 @@ FX_FLOAT CXFA_LocaleValue::GetNum() const { } return 0; } -FX_DOUBLE CXFA_LocaleValue::GetDoubleNum() const { +double CXFA_LocaleValue::GetDoubleNum() const { if (m_bValid && (m_dwType == XFA_VT_BOOLEAN || m_dwType == XFA_VT_INTEGER || m_dwType == XFA_VT_DECIMAL || m_dwType == XFA_VT_FLOAT)) { int64_t nIntegral = 0; @@ -320,14 +320,14 @@ FX_DOUBLE CXFA_LocaleValue::GetDoubleNum() const { } nIntegral = bNegative ? -nIntegral : nIntegral; int32_t scale = 0; - FX_DOUBLE fraction = 0.0; + double fraction = 0.0; if (cc < len && str[cc] == '.') { cc++; while (cc < len) { fraction += fraction_scales[scale] * (str[cc] - '0'); scale++; cc++; - if (scale == sizeof fraction_scales / sizeof(FX_DOUBLE) || + if (scale == sizeof fraction_scales / sizeof(double) || !FXSYS_isDecimalDigit(str[cc])) { break; } @@ -353,7 +353,7 @@ FX_DOUBLE CXFA_LocaleValue::GetDoubleNum() const { } nExponent = bExpSign ? -nExponent : nExponent; } - FX_DOUBLE dValue = (dwFractional / 4294967296.0); + double dValue = (dwFractional / 4294967296.0); dValue = nIntegral + (nIntegral >= 0 ? dValue : -dValue); if (nExponent != 0) { dValue *= FXSYS_pow(10, (FX_FLOAT)nExponent); @@ -406,7 +406,7 @@ bool CXFA_LocaleValue::SetText(const CFX_WideString& wsText, } bool CXFA_LocaleValue::SetNum(FX_FLOAT fNum) { m_dwType = XFA_VT_FLOAT; - m_wsValue.Format(L"%.8g", (FX_DOUBLE)fNum); + m_wsValue.Format(L"%.8g", (double)fNum); return true; } bool CXFA_LocaleValue::SetNum(const CFX_WideString& wsNum, diff --git a/xfa/fxfa/parser/xfa_localevalue.h b/xfa/fxfa/parser/xfa_localevalue.h index dbc3513a3f..084f63cb6e 100644 --- a/xfa/fxfa/parser/xfa_localevalue.h +++ b/xfa/fxfa/parser/xfa_localevalue.h @@ -71,7 +71,7 @@ class CXFA_LocaleValue { void SetValue(const CFX_WideString& wsValue, uint32_t dwType); CFX_WideString GetText() const; FX_FLOAT GetNum() const; - FX_DOUBLE GetDoubleNum() const; + double GetDoubleNum() const; CFX_Unitime GetDate() const; CFX_Unitime GetTime() const; CFX_Unitime GetDateTime() const; diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp index ef7e939a85..c41902676d 100644 --- a/xfa/fxfa/parser/xfa_utils.cpp +++ b/xfa/fxfa/parser/xfa_utils.cpp @@ -17,24 +17,24 @@ namespace { -const FX_DOUBLE fraction_scales[] = {0.1, - 0.01, - 0.001, - 0.0001, - 0.00001, - 0.000001, - 0.0000001, - 0.00000001, - 0.000000001, - 0.0000000001, - 0.00000000001, - 0.000000000001, - 0.0000000000001, - 0.00000000000001, - 0.000000000000001, - 0.0000000000000001}; - -FX_DOUBLE WideStringToDouble(const CFX_WideString& wsStringVal) { +const double fraction_scales[] = {0.1, + 0.01, + 0.001, + 0.0001, + 0.00001, + 0.000001, + 0.0000001, + 0.00000001, + 0.000000001, + 0.0000000001, + 0.00000000001, + 0.000000000001, + 0.0000000000001, + 0.00000000000001, + 0.000000000000001, + 0.0000000000000001}; + +double WideStringToDouble(const CFX_WideString& wsStringVal) { CFX_WideString wsValue = wsStringVal; wsValue.TrimLeft(); wsValue.TrimRight(); @@ -67,7 +67,7 @@ FX_DOUBLE WideStringToDouble(const CFX_WideString& wsStringVal) { } nIntegral = bNegative ? -nIntegral : nIntegral; int32_t scale = 0; - FX_DOUBLE fraction = 0.0; + double fraction = 0.0; if (cc < len && str[cc] == '.') { cc++; while (cc < len) { @@ -77,8 +77,8 @@ FX_DOUBLE WideStringToDouble(const CFX_WideString& wsStringVal) { if (cc == len) { break; } - if (scale == sizeof(fraction_scales) / sizeof(FX_DOUBLE) || - str[cc] == 'E' || str[cc] == 'e') { + if (scale == sizeof(fraction_scales) / sizeof(double) || str[cc] == 'E' || + str[cc] == 'e') { break; } if (!FXSYS_isDecimalDigit(str[cc])) { @@ -106,7 +106,7 @@ FX_DOUBLE WideStringToDouble(const CFX_WideString& wsStringVal) { } nExponent = bExpSign ? -nExponent : nExponent; } - FX_DOUBLE dValue = (dwFractional / 4294967296.0); + double dValue = (dwFractional / 4294967296.0); dValue = nIntegral + (nIntegral >= 0 ? dValue : -dValue); if (nExponent != 0) { dValue *= FXSYS_pow(10, (FX_FLOAT)nExponent); @@ -221,7 +221,7 @@ bool XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode) { return bRet; } -FX_DOUBLE XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal) { +double XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal) { CFX_WideString wsValue = CFX_WideString::FromUTF8(szStringVal); return WideStringToDouble(wsValue); } diff --git a/xfa/fxfa/parser/xfa_utils.h b/xfa/fxfa/parser/xfa_utils.h index a5bdeea192..73f6101f3e 100644 --- a/xfa/fxfa/parser/xfa_utils.h +++ b/xfa/fxfa/parser/xfa_utils.h @@ -142,7 +142,7 @@ class CXFA_NodeIteratorTemplate { }; CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData); -FX_DOUBLE XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal); +double XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal); int32_t XFA_MapRotation(int32_t nRotation); bool XFA_RecognizeRichText(CFDE_XMLElement* pRichTextXMLNode); -- cgit v1.2.3