diff options
Diffstat (limited to 'xfa/fxfa/fm2js')
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 62 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_simpleexpression.cpp | 16 |
2 files changed, 37 insertions, 41 deletions
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 971c09d6f3..73eaed6f5b 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -3542,65 +3542,62 @@ void CXFA_FM2JSContext::UnitValue(FXJSE_HOBJECT hThis, strUnit = strFirstUnit; } FX_DOUBLE dResult = 0; - if (strFirstUnit.Equal("in") || strFirstUnit.Equal("inches")) { - if (strUnit.Equal("mm") || strUnit.Equal("millimeters")) { + if (strFirstUnit == "in" || strFirstUnit == "inches") { + if (strUnit == "mm" || strUnit == "millimeters") { dResult = dFirstNumber * 25.4; - } else if (strUnit.Equal("cm") || strUnit.Equal("centimeters")) { + } else if (strUnit == "cm" || strUnit == "centimeters") { dResult = dFirstNumber * 2.54; - } else if (strUnit.Equal("pt") || strUnit.Equal("points")) { + } else if (strUnit == "pt" || strUnit == "points") { dResult = dFirstNumber / 72; - } else if (strUnit.Equal("mp") || strUnit.Equal("millipoints")) { + } else if (strUnit == "mp" || strUnit == "millipoints") { dResult = dFirstNumber / 72000; } else { dResult = dFirstNumber; } - } else if (strFirstUnit.Equal("mm") || - strFirstUnit.Equal("millimeters")) { - if (strUnit.Equal("mm") || strUnit.Equal("millimeters")) { + } else if (strFirstUnit == "mm" || strFirstUnit == "millimeters") { + if (strUnit == "mm" || strUnit == "millimeters") { dResult = dFirstNumber; - } else if (strUnit.Equal("cm") || strUnit.Equal("centimeters")) { + } else if (strUnit == "cm" || strUnit == "centimeters") { dResult = dFirstNumber / 10; - } else if (strUnit.Equal("pt") || strUnit.Equal("points")) { + } else if (strUnit == "pt" || strUnit == "points") { dResult = dFirstNumber / 25.4 / 72; - } else if (strUnit.Equal("mp") || strUnit.Equal("millipoints")) { + } else if (strUnit == "mp" || strUnit == "millipoints") { dResult = dFirstNumber / 25.4 / 72000; } else { dResult = dFirstNumber / 25.4; } - } else if (strFirstUnit.Equal("cm") || - strFirstUnit.Equal("centimeters")) { - if (strUnit.Equal("mm") || strUnit.Equal("millimeters")) { + } else if (strFirstUnit == "cm" || strFirstUnit == "centimeters") { + if (strUnit == "mm" || strUnit == "millimeters") { dResult = dFirstNumber * 10; - } else if (strUnit.Equal("cm") || strUnit.Equal("centimeters")) { + } else if (strUnit == "cm" || strUnit == "centimeters") { dResult = dFirstNumber; - } else if (strUnit.Equal("pt") || strUnit.Equal("points")) { + } else if (strUnit == "pt" || strUnit == "points") { dResult = dFirstNumber / 2.54 / 72; - } else if (strUnit.Equal("mp") || strUnit.Equal("millipoints")) { + } else if (strUnit == "mp" || strUnit == "millipoints") { dResult = dFirstNumber / 2.54 / 72000; } else { dResult = dFirstNumber / 2.54; } - } else if (strFirstUnit.Equal("pt") || strFirstUnit.Equal("points")) { - if (strUnit.Equal("mm") || strUnit.Equal("millimeters")) { + } else if (strFirstUnit == "pt" || strFirstUnit == "points") { + if (strUnit == "mm" || strUnit == "millimeters") { dResult = dFirstNumber / 72 * 25.4; - } else if (strUnit.Equal("cm") || strUnit.Equal("centimeters")) { + } else if (strUnit == "cm" || strUnit == "centimeters") { dResult = dFirstNumber / 72 * 2.54; - } else if (strUnit.Equal("pt") || strUnit.Equal("points")) { + } else if (strUnit == "pt" || strUnit == "points") { dResult = dFirstNumber; - } else if (strUnit.Equal("mp") || strUnit.Equal("millipoints")) { + } else if (strUnit == "mp" || strUnit == "millipoints") { dResult = dFirstNumber * 1000; } else { dResult = dFirstNumber / 72; } - } else if (strFirstUnit.Equal("mp") || - strFirstUnit.Equal("millipoints")) { - if (strUnit.Equal("mm") || strUnit.Equal("millimeters")) { + } else if (strFirstUnit == "mp" || strFirstUnit == "millipoints") { + if (strUnit == "mm" || strUnit == "millimeters") { dResult = dFirstNumber / 72000 * 25.4; - } else if (strUnit.Equal("cm") || strUnit.Equal("centimeters")) { + } else if (strUnit == "cm" || strUnit == "centimeters") { dResult = dFirstNumber / 72000 * 2.54; - } else if (strUnit.Equal("pt") || strUnit.Equal("points")) { + } else if (strUnit == "pt" || strUnit == "points") { dResult = dFirstNumber / 1000; - } else if (strUnit.Equal("mp") || strUnit.Equal("millipoints")) { + } else if (strUnit == "mp" || strUnit == "millipoints") { dResult = dFirstNumber; } else { dResult = dFirstNumber / 72000; @@ -5710,7 +5707,7 @@ void CXFA_FM2JSContext::equality_operator(FXJSE_HOBJECT hThis, FXJSE_Value_ToUTF8String(argFirst, firstOutput); FXJSE_Value_ToUTF8String(argSecond, secondOutput); FXJSE_Value_SetInteger(args.GetReturnValue(), - firstOutput.Equal(secondOutput) ? 1 : 0); + firstOutput == secondOutput); } else { FX_DOUBLE first = HValueToDouble(hThis, argFirst); FX_DOUBLE second = HValueToDouble(hThis, argSecond); @@ -5748,12 +5745,11 @@ void CXFA_FM2JSContext::notequality_operator(FXJSE_HOBJECT hThis, FXJSE_Value_ToUTF8String(argFirst, firstOutput); FXJSE_Value_ToUTF8String(argSecond, secondOutput); FXJSE_Value_SetInteger(args.GetReturnValue(), - firstOutput.Equal(secondOutput) ? 0 : 1); + firstOutput != secondOutput); } else { FX_DOUBLE first = HValueToDouble(hThis, argFirst); FX_DOUBLE second = HValueToDouble(hThis, argSecond); - FXJSE_Value_SetInteger(args.GetReturnValue(), - (first == second) ? 0 : 1); + FXJSE_Value_SetInteger(args.GetReturnValue(), first != second); } FXJSE_Value_Release(argFirst); FXJSE_Value_Release(argSecond); @@ -6694,7 +6690,7 @@ FX_BOOL CXFA_FM2JSContext::simpleValueCompare(FXJSE_HOBJECT hThis, CFX_ByteString firstString, secondString; HValueToUTF8String(firstValue, firstString); HValueToUTF8String(secondValue, secondString); - bReturn = firstString.Equal(secondString); + bReturn = firstString == secondString; } else if (FXJSE_Value_IsNumber(firstValue)) { FX_FLOAT first = HValueToFloat(hThis, firstValue); FX_FLOAT second = HValueToFloat(hThis, secondValue); diff --git a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp index 113fbfb536..f1e1137459 100644 --- a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp +++ b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp @@ -178,21 +178,21 @@ CXFA_FMIdentifierExpressionn::CXFA_FMIdentifierExpressionn( void CXFA_FMIdentifierExpressionn::ToJavaScript(CFX_WideTextBuf& javascript) { CFX_WideString tempStr = m_wsIdentifier; - if (tempStr.Equal(FX_WSTRC(L"$"))) { + if (tempStr == FX_WSTRC(L"$")) { tempStr = FX_WSTRC(L"this"); - } else if (tempStr.Equal(FX_WSTRC(L"!"))) { + } else if (tempStr == FX_WSTRC(L"!")) { tempStr = FX_WSTRC(L"xfa.datasets"); - } else if (tempStr.Equal(FX_WSTRC(L"$data"))) { + } else if (tempStr == FX_WSTRC(L"$data")) { tempStr = FX_WSTRC(L"xfa.datasets.data"); - } else if (tempStr.Equal(FX_WSTRC(L"$event"))) { + } else if (tempStr == FX_WSTRC(L"$event")) { tempStr = FX_WSTRC(L"xfa.event"); - } else if (tempStr.Equal(FX_WSTRC(L"$form"))) { + } else if (tempStr == FX_WSTRC(L"$form")) { tempStr = FX_WSTRC(L"xfa.form"); - } else if (tempStr.Equal(FX_WSTRC(L"$host"))) { + } else if (tempStr == FX_WSTRC(L"$host")) { tempStr = FX_WSTRC(L"xfa.host"); - } else if (tempStr.Equal(FX_WSTRC(L"$layout"))) { + } else if (tempStr == FX_WSTRC(L"$layout")) { tempStr = FX_WSTRC(L"xfa.layout"); - } else if (tempStr.Equal(FX_WSTRC(L"$template"))) { + } else if (tempStr == FX_WSTRC(L"$template")) { tempStr = FX_WSTRC(L"xfa.template"); } else if (tempStr[0] == L'!') { tempStr = EXCLAMATION_IN_IDENTIFIER + tempStr.Mid(1); |