diff options
Diffstat (limited to 'xfa/fxfa/fm2js')
-rw-r--r-- | xfa/fxfa/fm2js/xfa_error.cpp | 14 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_error.h | 14 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_expression.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 106 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fm2jscontext.h | 8 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fmparse.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fmparse.h | 2 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_lexer.cpp | 68 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_lexer.h | 22 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_simpleexpression.cpp | 8 |
10 files changed, 123 insertions, 127 deletions
diff --git a/xfa/fxfa/fm2js/xfa_error.cpp b/xfa/fxfa/fm2js/xfa_error.cpp index 020d9bc509..9ca886954a 100644 --- a/xfa/fxfa/fm2js/xfa_error.cpp +++ b/xfa/fxfa/fm2js/xfa_error.cpp @@ -6,12 +6,12 @@ #include "xfa/fxfa/fm2js/xfa_error.h" -const FX_WCHAR kFMErrUnsupportedChar[] = L"unsupported char '%c'"; -const FX_WCHAR kFMErrBadSuffixNumber[] = L"bad suffix on number"; -const FX_WCHAR kFMErrExpectedIdentifier[] = +const wchar_t kFMErrUnsupportedChar[] = L"unsupported char '%c'"; +const wchar_t kFMErrBadSuffixNumber[] = L"bad suffix on number"; +const wchar_t kFMErrExpectedIdentifier[] = L"expected identifier instead of '%s'"; -const FX_WCHAR kFMErrExpectedToken[] = L"expected '%s' instead of '%s'"; -const FX_WCHAR kFMErrExpectedEndIf[] = L"expected 'endif' instead of '%s'"; -const FX_WCHAR kFMErrUnexpectedExpression[] = L"unexpected expression '%s'"; -const FX_WCHAR kFMErrExpectedNonEmptyExpression[] = +const wchar_t kFMErrExpectedToken[] = L"expected '%s' instead of '%s'"; +const wchar_t kFMErrExpectedEndIf[] = L"expected 'endif' instead of '%s'"; +const wchar_t kFMErrUnexpectedExpression[] = L"unexpected expression '%s'"; +const wchar_t kFMErrExpectedNonEmptyExpression[] = L"expected non-empty expression"; diff --git a/xfa/fxfa/fm2js/xfa_error.h b/xfa/fxfa/fm2js/xfa_error.h index 5e3fbbe1ba..d6bb72bb34 100644 --- a/xfa/fxfa/fm2js/xfa_error.h +++ b/xfa/fxfa/fm2js/xfa_error.h @@ -10,13 +10,13 @@ #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" -extern const FX_WCHAR kFMErrUnsupportedChar[]; -extern const FX_WCHAR kFMErrBadSuffixNumber[]; -extern const FX_WCHAR kFMErrExpectedIdentifier[]; -extern const FX_WCHAR kFMErrExpectedToken[]; -extern const FX_WCHAR kFMErrExpectedEndIf[]; -extern const FX_WCHAR kFMErrUnexpectedExpression[]; -extern const FX_WCHAR kFMErrExpectedNonEmptyExpression[]; +extern const wchar_t kFMErrUnsupportedChar[]; +extern const wchar_t kFMErrBadSuffixNumber[]; +extern const wchar_t kFMErrExpectedIdentifier[]; +extern const wchar_t kFMErrExpectedToken[]; +extern const wchar_t kFMErrExpectedEndIf[]; +extern const wchar_t kFMErrUnexpectedExpression[]; +extern const wchar_t kFMErrExpectedNonEmptyExpression[]; class CXFA_FMErrorInfo { public: diff --git a/xfa/fxfa/fm2js/xfa_expression.cpp b/xfa/fxfa/fm2js/xfa_expression.cpp index 32db6d24df..c1e451eade 100644 --- a/xfa/fxfa/fm2js/xfa_expression.cpp +++ b/xfa/fxfa/fm2js/xfa_expression.cpp @@ -12,10 +12,10 @@ namespace { -const FX_WCHAR RUNTIMEBLOCKTEMPARRAY[] = +const wchar_t RUNTIMEBLOCKTEMPARRAY[] = L"foxit_xfa_formcalc_runtime_block_temp_array"; -const FX_WCHAR RUNTIMEBLOCKTEMPARRAYINDEX[] = +const wchar_t RUNTIMEBLOCKTEMPARRAYINDEX[] = L"foxit_xfa_formcalc_runtime_block_temp_array_index"; } // namespace diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index e8cb2d0279..356180834f 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -28,7 +28,7 @@ const double kFinancialPrecision = 0.00000001; struct XFA_FMHtmlReserveCode { uint32_t m_uCode; - const FX_WCHAR* m_htmlReserve; + const wchar_t* m_htmlReserve; }; struct XFA_FMHtmlHashedReserveCode { @@ -384,7 +384,7 @@ void AlternateDateTimeSymbols(CFX_WideString& wsPattern, bool bEscape = false; int32_t i = 0; while (i < nLength) { - FX_WCHAR wc = wsPattern[i]; + wchar_t wc = wsPattern[i]; if (wc == L'\'') { bInConstRange = !bInConstRange; if (bEscape) { @@ -442,11 +442,11 @@ bool PatternStringType(const CFX_ByteStringC& szPattern, patternType = XFA_VT_NULL; wsPattern.MakeLower(); - const FX_WCHAR* pData = wsPattern.c_str(); + const wchar_t* pData = wsPattern.c_str(); int32_t iLength = wsPattern.GetLength(); int32_t iIndex = 0; bool bSingleQuotation = false; - FX_WCHAR patternChar; + wchar_t patternChar; while (iIndex < iLength) { patternChar = pData[iIndex]; if (patternChar == 0x27) { @@ -455,7 +455,7 @@ bool PatternStringType(const CFX_ByteStringC& szPattern, (patternChar == 'y' || patternChar == 'j')) { patternType = XFA_VT_DATE; iIndex++; - FX_WCHAR timePatternChar; + wchar_t timePatternChar; while (iIndex < iLength) { timePatternChar = pData[iIndex]; if (timePatternChar == 0x27) { @@ -1642,7 +1642,7 @@ void CXFA_FM2JSContext::TimeFmt(CFXJSE_Value* pThis, } // static -bool CXFA_FM2JSContext::IsIsoDateFormat(const FX_CHAR* pData, +bool CXFA_FM2JSContext::IsIsoDateFormat(const char* pData, int32_t iLength, int32_t& iStyle, int32_t& iYear, @@ -1655,7 +1655,7 @@ bool CXFA_FM2JSContext::IsIsoDateFormat(const FX_CHAR* pData, if (iLength < 4) return false; - FX_CHAR strYear[5]; + char strYear[5]; strYear[4] = '\0'; for (int32_t i = 0; i < 4; ++i) { if (pData[i] > '9' || pData[i] < '0') @@ -1670,7 +1670,7 @@ bool CXFA_FM2JSContext::IsIsoDateFormat(const FX_CHAR* pData, iStyle = pData[4] == '-' ? 1 : 0; - FX_CHAR strTemp[3]; + char strTemp[3]; strTemp[2] = '\0'; int32_t iPosOff = iStyle == 0 ? 4 : 5; if ((pData[iPosOff] > '9' || pData[iPosOff] < '0') || @@ -1721,7 +1721,7 @@ bool CXFA_FM2JSContext::IsIsoDateFormat(const FX_CHAR* pData, } // static -bool CXFA_FM2JSContext::IsIsoTimeFormat(const FX_CHAR* pData, +bool CXFA_FM2JSContext::IsIsoTimeFormat(const char* pData, int32_t iLength, int32_t& iHour, int32_t& iMinute, @@ -1738,7 +1738,7 @@ bool CXFA_FM2JSContext::IsIsoTimeFormat(const FX_CHAR* pData, if (!pData) return false; - FX_CHAR strTemp[3]; + char strTemp[3]; strTemp[2] = '\0'; int32_t iZone = 0; int32_t i = 0; @@ -1796,7 +1796,7 @@ bool CXFA_FM2JSContext::IsIsoTimeFormat(const FX_CHAR* pData, } if (pData[iIndex] == '.') { ++iIndex; - FX_CHAR strSec[4]; + char strSec[4]; strSec[3] = '\0'; if (pData[iIndex] > '9' || pData[iIndex] < '0') return false; @@ -1868,7 +1868,7 @@ bool CXFA_FM2JSContext::IsIsoTimeFormat(const FX_CHAR* pData, } // static -bool CXFA_FM2JSContext::IsIsoDateTimeFormat(const FX_CHAR* pData, +bool CXFA_FM2JSContext::IsIsoDateTimeFormat(const char* pData, int32_t iLength, int32_t& iYear, int32_t& iMonth, @@ -3059,14 +3059,14 @@ void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis, unitspanString.MakeLower(); CFX_WideString wsTypeString = CFX_WideString::FromUTF8(unitspanString.AsStringC()); - const FX_WCHAR* pData = wsTypeString.c_str(); + const wchar_t* pData = wsTypeString.c_str(); int32_t u = 0; int32_t uLen = wsTypeString.GetLength(); while (IsWhitespace(pData[u])) u++; XFA_FM2JS_VALUETYPE_ParserStatus eParserStatus = VALUETYPE_START; - FX_WCHAR typeChar; + wchar_t typeChar; // TODO(dsinclair): Cleanup this parser, figure out what the various checks // are for. while (u < uLen) { @@ -3086,7 +3086,7 @@ void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis, } eParserStatus = VALUETYPE_HAVEDIGIT; } else if ((typeChar == 'c' || typeChar == 'p') && (u + 1 < uLen)) { - FX_WCHAR nextChar = pData[u + 1]; + wchar_t nextChar = pData[u + 1]; if ((eParserStatus == VALUETYPE_START || eParserStatus == VALUETYPE_HAVEDIGIT || eParserStatus == VALUETYPE_HAVEDIGITWHITE) && @@ -3097,7 +3097,7 @@ void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis, } eParserStatus = VALUETYPE_HAVEINVALIDCHAR; } else if (typeChar == 'm' && (u + 1 < uLen)) { - FX_WCHAR nextChar = pData[u + 1]; + wchar_t nextChar = pData[u + 1]; if ((eParserStatus == VALUETYPE_START || eParserStatus == VALUETYPE_HAVEDIGIT || eParserStatus == VALUETYPE_HAVEDIGITWHITE) && @@ -3153,7 +3153,7 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, CFX_ByteString unitspanString; ValueToUTF8String(unitspanValue.get(), unitspanString); - const FX_CHAR* pData = unitspanString.c_str(); + const char* pData = unitspanString.c_str(); if (!pData) { args.GetReturnValue()->SetInteger(0); return; @@ -3171,7 +3171,7 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, ++u; } - FX_CHAR* pTemp = nullptr; + char* pTemp = nullptr; FX_DOUBLE dFirstNumber = strtod(pData, &pTemp); while (IsWhitespace(pData[u])) ++u; @@ -3192,7 +3192,7 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> unitValue = GetSimpleValue(pThis, args, 1); CFX_ByteString unitTempString; ValueToUTF8String(unitValue.get(), unitTempString); - const FX_CHAR* pChar = unitTempString.c_str(); + const char* pChar = unitTempString.c_str(); int32_t uVal = 0; while (IsWhitespace(pChar[uVal])) ++uVal; @@ -3393,18 +3393,18 @@ void CXFA_FM2JSContext::Decode(CFXJSE_Value* pThis, void CXFA_FM2JSContext::DecodeURL(const CFX_ByteStringC& szURLString, CFX_ByteTextBuf& szResultString) { CFX_WideString wsURLString = CFX_WideString::FromUTF8(szURLString); - const FX_WCHAR* pData = wsURLString.c_str(); + const wchar_t* pData = wsURLString.c_str(); int32_t i = 0; CFX_WideTextBuf wsResultBuf; while (i < wsURLString.GetLength()) { - FX_WCHAR ch = pData[i]; + wchar_t ch = pData[i]; if ('%' != ch) { wsResultBuf.AppendChar(ch); ++i; continue; } - FX_WCHAR chTemp = 0; + wchar_t chTemp = 0; int32_t iCount = 0; while (iCount < 2) { ++i; @@ -3434,15 +3434,15 @@ void CXFA_FM2JSContext::DecodeURL(const CFX_ByteStringC& szURLString, void CXFA_FM2JSContext::DecodeHTML(const CFX_ByteStringC& szHTMLString, CFX_ByteTextBuf& szResultString) { CFX_WideString wsHTMLString = CFX_WideString::FromUTF8(szHTMLString); - FX_WCHAR strString[9]; + wchar_t strString[9]; int32_t iStrIndex = 0; int32_t iLen = wsHTMLString.GetLength(); int32_t i = 0; int32_t iCode = 0; - const FX_WCHAR* pData = wsHTMLString.c_str(); + const wchar_t* pData = wsHTMLString.c_str(); CFX_WideTextBuf wsResultBuf; while (i < iLen) { - FX_WCHAR ch = pData[i]; + wchar_t ch = pData[i]; if (ch != '&') { wsResultBuf.AppendChar(ch); ++i; @@ -3492,7 +3492,7 @@ void CXFA_FM2JSContext::DecodeHTML(const CFX_ByteStringC& szHTMLString, } uint32_t iData = 0; if (HTMLSTR2Code(strString, iData)) { - wsResultBuf.AppendChar((FX_WCHAR)iData); + wsResultBuf.AppendChar((wchar_t)iData); } else { wsResultBuf.AppendChar(iCode); } @@ -3510,13 +3510,13 @@ void CXFA_FM2JSContext::DecodeHTML(const CFX_ByteStringC& szHTMLString, void CXFA_FM2JSContext::DecodeXML(const CFX_ByteStringC& szXMLString, CFX_ByteTextBuf& szResultString) { CFX_WideString wsXMLString = CFX_WideString::FromUTF8(szXMLString); - FX_WCHAR strString[9]; + wchar_t strString[9]; int32_t iStrIndex = 0; int32_t iLen = wsXMLString.GetLength(); int32_t i = 0; int32_t iCode = 0; - FX_WCHAR ch = 0; - const FX_WCHAR* pData = wsXMLString.c_str(); + wchar_t ch = 0; + const wchar_t* pData = wsXMLString.c_str(); CFX_WideTextBuf wsXMLBuf; while (i < iLen) { ch = pData[i]; @@ -3568,7 +3568,7 @@ void CXFA_FM2JSContext::DecodeXML(const CFX_ByteStringC& szXMLString, strString[iStrIndex] = 0; } - const FX_WCHAR* const strName[] = {L"quot", L"amp", L"apos", L"lt", L"gt"}; + const wchar_t* const strName[] = {L"quot", L"amp", L"apos", L"lt", L"gt"}; int32_t iIndex = 0; while (iIndex < 5) { if (FXSYS_memcmp(strString, strName[iIndex], @@ -3659,16 +3659,16 @@ void CXFA_FM2JSContext::EncodeURL(const CFX_ByteStringC& szURLString, CFX_ByteTextBuf& szResultBuf) { CFX_WideString wsURLString = CFX_WideString::FromUTF8(szURLString); CFX_WideTextBuf wsResultBuf; - FX_WCHAR strEncode[4]; + wchar_t strEncode[4]; strEncode[0] = '%'; strEncode[3] = 0; - FX_WCHAR strUnsafe[] = {' ', '<', '>', '"', '#', '%', '{', '}', - '|', '\\', '^', '~', '[', ']', '`'}; - FX_WCHAR strReserved[] = {';', '/', '?', ':', '@', '=', '&'}; - FX_WCHAR strSpecial[] = {'$', '-', '+', '!', '*', '\'', '(', ')', ','}; - const FX_WCHAR* strCode = L"0123456789abcdef"; + wchar_t strUnsafe[] = {' ', '<', '>', '"', '#', '%', '{', '}', + '|', '\\', '^', '~', '[', ']', '`'}; + wchar_t strReserved[] = {';', '/', '?', ':', '@', '=', '&'}; + wchar_t strSpecial[] = {'$', '-', '+', '!', '*', '\'', '(', ')', ','}; + const wchar_t* strCode = L"0123456789abcdef"; for (int32_t u = 0; u < wsURLString.GetLength(); ++u) { - FX_WCHAR ch = wsURLString.GetAt(u); + wchar_t ch = wsURLString.GetAt(u); int32_t i = 0; int32_t iCount = FX_ArraySize(strUnsafe); while (i < iCount) { @@ -3719,10 +3719,10 @@ void CXFA_FM2JSContext::EncodeURL(const CFX_ByteStringC& szURLString, } else if (ch >= 0x20 && ch <= 0x7e) { wsResultBuf.AppendChar(ch); } else { - const FX_WCHAR iRadix = 16; + const wchar_t iRadix = 16; CFX_WideString strTmp; while (ch >= iRadix) { - FX_WCHAR tmp = strCode[ch % iRadix]; + wchar_t tmp = strCode[ch % iRadix]; ch /= iRadix; strTmp += tmp; } @@ -3760,8 +3760,8 @@ void CXFA_FM2JSContext::EncodeHTML(const CFX_ByteStringC& szHTMLString, CFX_ByteTextBuf& szResultBuf) { CFX_ByteString str = szHTMLString.c_str(); CFX_WideString wsHTMLString = CFX_WideString::FromUTF8(str.AsStringC()); - const FX_WCHAR* strCode = L"0123456789abcdef"; - FX_WCHAR strEncode[9]; + const wchar_t* strCode = L"0123456789abcdef"; + wchar_t strEncode[9]; strEncode[0] = '&'; strEncode[1] = '#'; strEncode[2] = 'x'; @@ -3772,7 +3772,7 @@ void CXFA_FM2JSContext::EncodeHTML(const CFX_ByteStringC& szHTMLString, CFX_WideTextBuf wsResultBuf; int32_t iLen = wsHTMLString.GetLength(); int32_t i = 0; - const FX_WCHAR* pData = wsHTMLString.c_str(); + const wchar_t* pData = wsHTMLString.c_str(); while (i < iLen) { uint32_t ch = pData[i]; CFX_WideString htmlReserve; @@ -3781,7 +3781,7 @@ void CXFA_FM2JSContext::EncodeHTML(const CFX_ByteStringC& szHTMLString, wsResultBuf << htmlReserve; wsResultBuf.AppendChar(L';'); } else if (ch >= 32 && ch <= 126) { - wsResultBuf.AppendChar((FX_WCHAR)ch); + wsResultBuf.AppendChar((wchar_t)ch); } else if (ch < 256) { int32_t iIndex = ch / 16; strEncode[3] = strCode[iIndex]; @@ -3810,7 +3810,7 @@ void CXFA_FM2JSContext::EncodeXML(const CFX_ByteStringC& szXMLString, CFX_ByteTextBuf& szResultBuf) { CFX_WideString wsXMLString = CFX_WideString::FromUTF8(szXMLString); CFX_WideTextBuf wsResultBuf; - FX_WCHAR strEncode[9]; + wchar_t strEncode[9]; strEncode[0] = '&'; strEncode[1] = '#'; strEncode[2] = 'x'; @@ -3818,10 +3818,10 @@ void CXFA_FM2JSContext::EncodeXML(const CFX_ByteStringC& szXMLString, strEncode[6] = 0; strEncode[7] = ';'; strEncode[8] = 0; - const FX_WCHAR* strCode = L"0123456789abcdef"; - const FX_WCHAR* pData = wsXMLString.c_str(); + const wchar_t* strCode = L"0123456789abcdef"; + const wchar_t* pData = wsXMLString.c_str(); for (int32_t u = 0; u < wsXMLString.GetLength(); ++u) { - FX_WCHAR ch = pData[u]; + wchar_t ch = pData[u]; switch (ch) { case '"': wsResultBuf.AppendChar('&'); @@ -4060,7 +4060,7 @@ void CXFA_FM2JSContext::Lower(CFXJSE_Value* pThis, ValueToUTF8String(argOne.get(), argString); CFX_WideTextBuf lowStringBuf; CFX_WideString wsArgString = CFX_WideString::FromUTF8(argString.AsStringC()); - const FX_WCHAR* pData = wsArgString.c_str(); + const wchar_t* pData = wsArgString.c_str(); int32_t i = 0; while (i < argString.GetLength()) { int32_t ch = pData[i]; @@ -4399,7 +4399,7 @@ void CXFA_FM2JSContext::Str(CFXJSE_Value* pThis, formatStr += "f"; numberString.Format(formatStr.c_str(), fNumber); - const FX_CHAR* pData = numberString.c_str(); + const char* pData = numberString.c_str(); int32_t iLength = numberString.GetLength(); int32_t u = 0; while (u < iLength) { @@ -4608,7 +4608,7 @@ void CXFA_FM2JSContext::Upper(CFXJSE_Value* pThis, CFX_WideTextBuf upperStringBuf; CFX_WideString wsArgString = CFX_WideString::FromUTF8(argString.AsStringC()); - const FX_WCHAR* pData = wsArgString.c_str(); + const wchar_t* pData = wsArgString.c_str(); int32_t i = 0; while (i < wsArgString.GetLength()) { int32_t ch = pData[i]; @@ -4692,7 +4692,7 @@ void CXFA_FM2JSContext::TrillionUS(const CFX_ByteStringC& szData, "Sixty", "Seventy", "Eighty", "Ninety"}; CFX_ByteStringC pComm[] = {" Hundred ", " Thousand ", " Million ", " Billion ", "Trillion"}; - const FX_CHAR* pData = szData.c_str(); + const char* pData = szData.c_str(); int32_t iLength = szData.GetLength(); int32_t iComm = 0; if (iLength > 12) @@ -4781,7 +4781,7 @@ void CXFA_FM2JSContext::TrillionUS(const CFX_ByteStringC& szData, void CXFA_FM2JSContext::WordUS(const CFX_ByteStringC& szData, int32_t iStyle, CFX_ByteTextBuf& strBuf) { - const FX_CHAR* pData = szData.c_str(); + const char* pData = szData.c_str(); int32_t iLength = szData.GetLength(); if (iStyle < 0 || iStyle > 2) { return; @@ -6411,7 +6411,7 @@ void CXFA_FM2JSContext::ThrowArgumentMismatchException() const { ThrowException(L"Argument mismatch in property or function argument."); } -void CXFA_FM2JSContext::ThrowException(const FX_WCHAR* str, ...) const { +void CXFA_FM2JSContext::ThrowException(const wchar_t* str, ...) const { CFX_WideString wsMessage; va_list arg_ptr; va_start(arg_ptr, str); diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.h b/xfa/fxfa/fm2js/xfa_fm2jscontext.h index 0f802fe65e..b56a0212d8 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.h +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.h @@ -91,13 +91,13 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args); - static bool IsIsoDateFormat(const FX_CHAR* pData, + static bool IsIsoDateFormat(const char* pData, int32_t iLength, int32_t& iStyle, int32_t& iYear, int32_t& iMonth, int32_t& iDay); - static bool IsIsoTimeFormat(const FX_CHAR* pData, + static bool IsIsoTimeFormat(const char* pData, int32_t iLength, int32_t& iHour, int32_t& iMinute, @@ -105,7 +105,7 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { int32_t& iMilliSecond, int32_t& iZoneHour, int32_t& iZoneMinute); - static bool IsIsoDateTimeFormat(const FX_CHAR* pData, + static bool IsIsoDateTimeFormat(const char* pData, int32_t iLength, int32_t& iYear, int32_t& iMonth, @@ -462,7 +462,7 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { const CFX_WideString& exp) const; void ThrowArgumentMismatchException() const; void ThrowParamCountMismatchException(const CFX_WideString& method) const; - void ThrowException(const FX_WCHAR* str, ...) const; + void ThrowException(const wchar_t* str, ...) const; v8::Isolate* m_pIsolate; CFXJSE_Class* m_pFMClass; diff --git a/xfa/fxfa/fm2js/xfa_fmparse.cpp b/xfa/fxfa/fm2js/xfa_fmparse.cpp index 52161e8c0a..09e8f36298 100644 --- a/xfa/fxfa/fm2js/xfa_fmparse.cpp +++ b/xfa/fxfa/fm2js/xfa_fmparse.cpp @@ -39,7 +39,7 @@ void CXFA_FMParse::Check(XFA_FM_TOKEN op) { NextToken(); } -void CXFA_FMParse::Error(uint32_t lineNum, const FX_WCHAR* msg, ...) { +void CXFA_FMParse::Error(uint32_t lineNum, const wchar_t* msg, ...) { m_pErrorInfo->linenum = lineNum; va_list ap; va_start(ap, msg); @@ -832,7 +832,7 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseBlockExpression() { std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseIfExpression() { uint32_t line = m_pToken->m_uLinenum; - const FX_WCHAR* pStartPos = m_lexer->SavePos(); + const wchar_t* pStartPos = m_lexer->SavePos(); NextToken(); Check(TOKlparen); std::unique_ptr<CXFA_FMSimpleExpression> pExpression; diff --git a/xfa/fxfa/fm2js/xfa_fmparse.h b/xfa/fxfa/fm2js/xfa_fmparse.h index 8f2671d1b0..ccb793ae68 100644 --- a/xfa/fxfa/fm2js/xfa_fmparse.h +++ b/xfa/fxfa/fm2js/xfa_fmparse.h @@ -20,7 +20,7 @@ class CXFA_FMParse { void NextToken(); void Check(XFA_FM_TOKEN op); - void Error(uint32_t lineNum, const FX_WCHAR* msg, ...); + void Error(uint32_t lineNum, const wchar_t* msg, ...); std::vector<std::unique_ptr<CXFA_FMExpression>> ParseTopExpression(); std::unique_ptr<CXFA_FMExpression> ParseFunction(); std::unique_ptr<CXFA_FMExpression> ParseExpression(); diff --git a/xfa/fxfa/fm2js/xfa_lexer.cpp b/xfa/fxfa/fm2js/xfa_lexer.cpp index 6e844bcdf0..e83877eb13 100644 --- a/xfa/fxfa/fm2js/xfa_lexer.cpp +++ b/xfa/fxfa/fm2js/xfa_lexer.cpp @@ -11,41 +11,39 @@ namespace { struct XFA_FMDChar { - static const FX_WCHAR* inc(const FX_WCHAR*& p) { + static const wchar_t* inc(const wchar_t*& p) { ++p; return p; } - static const FX_WCHAR* dec(const FX_WCHAR*& p) { + static const wchar_t* dec(const wchar_t*& p) { --p; return p; } - static uint16_t get(const FX_WCHAR* p) { return *p; } - static bool isWhiteSpace(const FX_WCHAR* p) { + static uint16_t get(const wchar_t* p) { return *p; } + static bool isWhiteSpace(const wchar_t* p) { return (*p) == 0x09 || (*p) == 0x0b || (*p) == 0x0c || (*p) == 0x20; } - static bool isLineTerminator(const FX_WCHAR* p) { + static bool isLineTerminator(const wchar_t* p) { return *p == 0x0A || *p == 0x0D; } - static bool isBinary(const FX_WCHAR* p) { return (*p) >= '0' && (*p) <= '1'; } - static bool isOctal(const FX_WCHAR* p) { return (*p) >= '0' && (*p) <= '7'; } - static bool isDigital(const FX_WCHAR* p) { - return (*p) >= '0' && (*p) <= '9'; - } - static bool isHex(const FX_WCHAR* p) { + static bool isBinary(const wchar_t* p) { return (*p) >= '0' && (*p) <= '1'; } + static bool isOctal(const wchar_t* p) { return (*p) >= '0' && (*p) <= '7'; } + static bool isDigital(const wchar_t* p) { return (*p) >= '0' && (*p) <= '9'; } + static bool isHex(const wchar_t* p) { return isDigital(p) || ((*p) >= 'a' && (*p) <= 'f') || ((*p) >= 'A' && (*p) <= 'F'); } - static bool isAlpha(const FX_WCHAR* p) { + static bool isAlpha(const wchar_t* p) { return ((*p) <= 'z' && (*p) >= 'a') || ((*p) <= 'Z' && (*p) >= 'A'); } - static bool isAvalid(const FX_WCHAR* p, bool flag = 0); - static bool string2number(const FX_WCHAR* s, + static bool isAvalid(const wchar_t* p, bool flag = 0); + static bool string2number(const wchar_t* s, FX_DOUBLE* pValue, - const FX_WCHAR*& pEnd); + const wchar_t*& pEnd); static bool isUnicodeAlpha(uint16_t ch); }; -inline bool XFA_FMDChar::isAvalid(const FX_WCHAR* p, bool flag) { +inline bool XFA_FMDChar::isAvalid(const wchar_t* p, bool flag) { if (*p == 0) { return 1; } @@ -61,9 +59,9 @@ inline bool XFA_FMDChar::isAvalid(const FX_WCHAR* p, bool flag) { return 0; } -inline bool XFA_FMDChar::string2number(const FX_WCHAR* s, +inline bool XFA_FMDChar::string2number(const wchar_t* s, FX_DOUBLE* pValue, - const FX_WCHAR*& pEnd) { + const wchar_t*& pEnd) { if (s) { *pValue = wcstod((wchar_t*)s, (wchar_t**)&pEnd); } @@ -148,7 +146,7 @@ const XFA_FM_TOKEN KEYWORD_END = TOKendif; } // namespace -const FX_WCHAR* XFA_FM_KeywordToString(XFA_FM_TOKEN op) { +const wchar_t* XFA_FM_KeywordToString(XFA_FM_TOKEN op) { if (op < KEYWORD_START || op > KEYWORD_END) return L""; return keyWords[op].m_keyword; @@ -199,12 +197,12 @@ CXFA_FMToken* CXFA_FMLexer::Scan() { XFA_FMDChar::inc(m_ptr); break; case ';': { - const FX_WCHAR* pTemp = 0; + const wchar_t* pTemp = 0; Comment(m_ptr, pTemp); m_ptr = pTemp; } break; case '"': { - const FX_WCHAR* pTemp = 0; + const wchar_t* pTemp = 0; p->m_type = TOKstring; iRet = String(p, m_ptr, pTemp); m_ptr = pTemp; @@ -221,7 +219,7 @@ CXFA_FMToken* CXFA_FMLexer::Scan() { case '8': case '9': { p->m_type = TOKnumber; - const FX_WCHAR* pTemp = 0; + const wchar_t* pTemp = 0; iRet = Number(p, m_ptr, pTemp); m_ptr = pTemp; if (iRet) { @@ -333,7 +331,7 @@ CXFA_FMToken* CXFA_FMLexer::Scan() { if (XFA_FMDChar::isAvalid(m_ptr)) { ch = XFA_FMDChar::get(m_ptr); if (ch == '/') { - const FX_WCHAR* pTemp = 0; + const wchar_t* pTemp = 0; Comment(m_ptr, pTemp); m_ptr = pTemp; break; @@ -365,7 +363,7 @@ CXFA_FMToken* CXFA_FMLexer::Scan() { return p; } else if (ch <= '9' && ch >= '0') { p->m_type = TOKnumber; - const FX_WCHAR* pTemp = 0; + const wchar_t* pTemp = 0; XFA_FMDChar::dec(m_ptr); iRet = Number(p, m_ptr, pTemp); m_ptr = pTemp; @@ -389,7 +387,7 @@ CXFA_FMToken* CXFA_FMLexer::Scan() { XFA_FMDChar::inc(m_ptr); break; default: { - const FX_WCHAR* pTemp = 0; + const wchar_t* pTemp = 0; iRet = Identifiers(p, m_ptr, pTemp); m_ptr = pTemp; if (iRet) { @@ -403,8 +401,8 @@ CXFA_FMToken* CXFA_FMLexer::Scan() { } uint32_t CXFA_FMLexer::Number(CXFA_FMToken* t, - const FX_WCHAR* p, - const FX_WCHAR*& pEnd) { + const wchar_t* p, + const wchar_t*& pEnd) { FX_DOUBLE number = 0; if (XFA_FMDChar::string2number(p, &number, pEnd)) { return 1; @@ -417,9 +415,9 @@ uint32_t CXFA_FMLexer::Number(CXFA_FMToken* t, } uint32_t CXFA_FMLexer::String(CXFA_FMToken* t, - const FX_WCHAR* p, - const FX_WCHAR*& pEnd) { - const FX_WCHAR* pStart = p; + const wchar_t* p, + const wchar_t*& pEnd) { + const wchar_t* pStart = p; uint16_t ch = 0; XFA_FMDChar::inc(p); ch = XFA_FMDChar::get(p); @@ -457,9 +455,9 @@ uint32_t CXFA_FMLexer::String(CXFA_FMToken* t, } uint32_t CXFA_FMLexer::Identifiers(CXFA_FMToken* t, - const FX_WCHAR* p, - const FX_WCHAR*& pEnd) { - const FX_WCHAR* pStart = p; + const wchar_t* p, + const wchar_t*& pEnd) { + const wchar_t* pStart = p; uint16_t ch = 0; ch = XFA_FMDChar::get(p); XFA_FMDChar::inc(p); @@ -491,7 +489,7 @@ uint32_t CXFA_FMLexer::Identifiers(CXFA_FMToken* t, return 0; } -void CXFA_FMLexer::Comment(const FX_WCHAR* p, const FX_WCHAR*& pEnd) { +void CXFA_FMLexer::Comment(const wchar_t* p, const wchar_t*& pEnd) { unsigned ch = 0; XFA_FMDChar::inc(p); ch = XFA_FMDChar::get(p); @@ -530,7 +528,7 @@ XFA_FM_TOKEN CXFA_FMLexer::IsKeyword(const CFX_WideStringC& str) { return TOKidentifier; } -void CXFA_FMLexer::Error(const FX_WCHAR* msg, ...) { +void CXFA_FMLexer::Error(const wchar_t* msg, ...) { m_pErrorInfo->linenum = m_uCurrentLine; va_list ap; va_start(ap, msg); diff --git a/xfa/fxfa/fm2js/xfa_lexer.h b/xfa/fxfa/fm2js/xfa_lexer.h index 9395c06814..aa7904cfb3 100644 --- a/xfa/fxfa/fm2js/xfa_lexer.h +++ b/xfa/fxfa/fm2js/xfa_lexer.h @@ -86,10 +86,10 @@ enum XFA_FM_TOKEN { struct XFA_FMKeyword { XFA_FM_TOKEN m_type; uint32_t m_uHash; - const FX_WCHAR* m_keyword; + const wchar_t* m_keyword; }; -const FX_WCHAR* XFA_FM_KeywordToString(XFA_FM_TOKEN op); +const wchar_t* XFA_FM_KeywordToString(XFA_FM_TOKEN op); class CXFA_FMToken { public: @@ -107,27 +107,25 @@ class CXFA_FMLexer { ~CXFA_FMLexer(); CXFA_FMToken* NextToken(); - uint32_t Number(CXFA_FMToken* t, const FX_WCHAR* p, const FX_WCHAR*& pEnd); - uint32_t String(CXFA_FMToken* t, const FX_WCHAR* p, const FX_WCHAR*& pEnd); - uint32_t Identifiers(CXFA_FMToken* t, - const FX_WCHAR* p, - const FX_WCHAR*& pEnd); - void Comment(const FX_WCHAR* p, const FX_WCHAR*& pEnd); + uint32_t Number(CXFA_FMToken* t, const wchar_t* p, const wchar_t*& pEnd); + uint32_t String(CXFA_FMToken* t, const wchar_t* p, const wchar_t*& pEnd); + uint32_t Identifiers(CXFA_FMToken* t, const wchar_t* p, const wchar_t*& pEnd); + void Comment(const wchar_t* p, const wchar_t*& pEnd); XFA_FM_TOKEN IsKeyword(const CFX_WideStringC& p); void SetCurrentLine(uint32_t line) { m_uCurrentLine = line; } void SetToken(CXFA_FMToken* pToken) { if (m_pToken.get() != pToken) m_pToken.reset(pToken); } - const FX_WCHAR* SavePos() { return m_ptr; } - void RestorePos(const FX_WCHAR* pPos) { m_ptr = pPos; } - void Error(const FX_WCHAR* msg, ...); + const wchar_t* SavePos() { return m_ptr; } + void RestorePos(const wchar_t* pPos) { m_ptr = pPos; } + void Error(const wchar_t* msg, ...); bool HasError() const; protected: CXFA_FMToken* Scan(); - const FX_WCHAR* m_ptr; + const wchar_t* m_ptr; uint32_t m_uCurrentLine; std::unique_ptr<CXFA_FMToken> m_pToken; CXFA_FMErrorInfo* m_pErrorInfo; diff --git a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp index 686ddaa17d..7bc703b59b 100644 --- a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp +++ b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp @@ -12,7 +12,7 @@ namespace { -const FX_WCHAR* const gs_lpStrExpFuncName[] = { +const wchar_t* const gs_lpStrExpFuncName[] = { L"foxit_xfa_formcalc_runtime.assign_value_operator", L"foxit_xfa_formcalc_runtime.logical_or_operator", L"foxit_xfa_formcalc_runtime.logical_and_operator", @@ -42,7 +42,7 @@ const FX_WCHAR* const gs_lpStrExpFuncName[] = { struct XFA_FMBuildInFunc { uint32_t m_uHash; - const FX_WCHAR* m_buildinfunc; + const wchar_t* m_buildinfunc; }; const XFA_FMBuildInFunc g_BuildInFuncs[] = { @@ -83,7 +83,7 @@ const XFA_FMBuildInFunc g_BuildInFuncs[] = { struct XFA_FMSOMMethod { uint32_t m_uHash; - const FX_WCHAR* m_wsSomMethodName; + const wchar_t* m_wsSomMethodName; uint32_t m_dParameters; }; const XFA_FMSOMMethod gs_FMSomMethods[] = { @@ -155,7 +155,7 @@ void CXFA_FMStringExpression::ToJavaScript(CFX_WideTextBuf& javascript) { CFX_WideString tempStr(m_wsString); if (tempStr.GetLength() > 2) { javascript.AppendChar(L'\"'); - FX_WCHAR oneChar; + wchar_t oneChar; for (int16_t i = 1; i < tempStr.GetLength() - 1; i++) { oneChar = tempStr[i]; switch (oneChar) { |