OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fxfa/fm2js/xfa_fm2jscontext.h" | 7 #include "xfa/fxfa/fm2js/xfa_fm2jscontext.h" |
8 | 8 |
9 #include <time.h> | 9 #include <time.h> |
10 | 10 |
(...skipping 2105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2116 if (szFormat.IsEmpty()) { | 2116 if (szFormat.IsEmpty()) { |
2117 pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); | 2117 pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); |
2118 } else { | 2118 } else { |
2119 wsFormat = CFX_WideString::FromUTF8(szFormat); | 2119 wsFormat = CFX_WideString::FromUTF8(szFormat); |
2120 } | 2120 } |
2121 CXFA_LocaleValue widgetValue(XFA_VT_DATE, CFX_WideString::FromUTF8(szDate), | 2121 CXFA_LocaleValue widgetValue(XFA_VT_DATE, CFX_WideString::FromUTF8(szDate), |
2122 (CXFA_LocaleMgr*)pMgr); | 2122 (CXFA_LocaleMgr*)pMgr); |
2123 CFX_WideString wsRet; | 2123 CFX_WideString wsRet; |
2124 widgetValue.FormatPatterns(wsRet, wsFormat, pLocale, | 2124 widgetValue.FormatPatterns(wsRet, wsFormat, pLocale, |
2125 XFA_VALUEPICTURE_Display); | 2125 XFA_VALUEPICTURE_Display); |
2126 strLocalDate = FX_UTF8Encode(wsRet, wsRet.GetLength()); | 2126 strLocalDate = FX_UTF8Encode(wsRet.c_str(), wsRet.GetLength()); |
2127 return TRUE; | 2127 return TRUE; |
2128 } | 2128 } |
2129 FX_BOOL CXFA_FM2JSContext::IsoTime2Local(FXJSE_HOBJECT hThis, | 2129 FX_BOOL CXFA_FM2JSContext::IsoTime2Local(FXJSE_HOBJECT hThis, |
2130 const CFX_ByteStringC& szTime, | 2130 const CFX_ByteStringC& szTime, |
2131 const CFX_ByteStringC& szFormat, | 2131 const CFX_ByteStringC& szFormat, |
2132 const CFX_ByteStringC& szLocale, | 2132 const CFX_ByteStringC& szLocale, |
2133 CFX_ByteString& strLocalTime) { | 2133 CFX_ByteString& strLocalTime) { |
2134 CXFA_FM2JSContext* pContext = | 2134 CXFA_FM2JSContext* pContext = |
2135 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 2135 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
2136 CXFA_Document* pDoc = pContext->GetDocument(); | 2136 CXFA_Document* pDoc = pContext->GetDocument(); |
(...skipping 20 matching lines...) Expand all Loading... |
2157 } else { | 2157 } else { |
2158 wsFormat = CFX_WideString::FromUTF8(szFormat); | 2158 wsFormat = CFX_WideString::FromUTF8(szFormat); |
2159 } | 2159 } |
2160 wsFormat = FX_WSTRC(L"time{") + wsFormat; | 2160 wsFormat = FX_WSTRC(L"time{") + wsFormat; |
2161 wsFormat += FX_WSTRC(L"}"); | 2161 wsFormat += FX_WSTRC(L"}"); |
2162 CXFA_LocaleValue widgetValue(XFA_VT_TIME, CFX_WideString::FromUTF8(szTime), | 2162 CXFA_LocaleValue widgetValue(XFA_VT_TIME, CFX_WideString::FromUTF8(szTime), |
2163 (CXFA_LocaleMgr*)pMgr); | 2163 (CXFA_LocaleMgr*)pMgr); |
2164 CFX_WideString wsRet; | 2164 CFX_WideString wsRet; |
2165 widgetValue.FormatPatterns(wsRet, wsFormat, pLocale, | 2165 widgetValue.FormatPatterns(wsRet, wsFormat, pLocale, |
2166 XFA_VALUEPICTURE_Display); | 2166 XFA_VALUEPICTURE_Display); |
2167 strLocalTime = FX_UTF8Encode(wsRet, wsRet.GetLength()); | 2167 strLocalTime = FX_UTF8Encode(wsRet.c_str(), wsRet.GetLength()); |
2168 return TRUE; | 2168 return TRUE; |
2169 } | 2169 } |
2170 FX_BOOL CXFA_FM2JSContext::GetGMTTime(FXJSE_HOBJECT hThis, | 2170 FX_BOOL CXFA_FM2JSContext::GetGMTTime(FXJSE_HOBJECT hThis, |
2171 const CFX_ByteStringC& szTime, | 2171 const CFX_ByteStringC& szTime, |
2172 const CFX_ByteStringC& szFormat, | 2172 const CFX_ByteStringC& szFormat, |
2173 const CFX_ByteStringC& szLocale, | 2173 const CFX_ByteStringC& szLocale, |
2174 CFX_ByteString& strGMTTime) { | 2174 CFX_ByteString& strGMTTime) { |
2175 CXFA_FM2JSContext* pContext = | 2175 CXFA_FM2JSContext* pContext = |
2176 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 2176 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
2177 CXFA_Document* pDoc = pContext->GetDocument(); | 2177 CXFA_Document* pDoc = pContext->GetDocument(); |
(...skipping 20 matching lines...) Expand all Loading... |
2198 } else { | 2198 } else { |
2199 wsFormat = CFX_WideString::FromUTF8(szFormat); | 2199 wsFormat = CFX_WideString::FromUTF8(szFormat); |
2200 } | 2200 } |
2201 wsFormat = FX_WSTRC(L"time{") + wsFormat; | 2201 wsFormat = FX_WSTRC(L"time{") + wsFormat; |
2202 wsFormat += FX_WSTRC(L"}"); | 2202 wsFormat += FX_WSTRC(L"}"); |
2203 CXFA_LocaleValue widgetValue(XFA_VT_TIME, CFX_WideString::FromUTF8(szTime), | 2203 CXFA_LocaleValue widgetValue(XFA_VT_TIME, CFX_WideString::FromUTF8(szTime), |
2204 (CXFA_LocaleMgr*)pMgr); | 2204 (CXFA_LocaleMgr*)pMgr); |
2205 CFX_WideString wsRet; | 2205 CFX_WideString wsRet; |
2206 widgetValue.FormatPatterns(wsRet, wsFormat, pLocale, | 2206 widgetValue.FormatPatterns(wsRet, wsFormat, pLocale, |
2207 XFA_VALUEPICTURE_Display); | 2207 XFA_VALUEPICTURE_Display); |
2208 strGMTTime = FX_UTF8Encode(wsRet, wsRet.GetLength()); | 2208 strGMTTime = FX_UTF8Encode(wsRet.c_str(), wsRet.GetLength()); |
2209 return TRUE; | 2209 return TRUE; |
2210 } | 2210 } |
2211 int32_t CXFA_FM2JSContext::DateString2Num(const CFX_ByteStringC& szDateString) { | 2211 int32_t CXFA_FM2JSContext::DateString2Num(const CFX_ByteStringC& szDateString) { |
2212 FX_BOOL bFlags = FALSE; | 2212 FX_BOOL bFlags = FALSE; |
2213 int32_t iLength = szDateString.GetLength(); | 2213 int32_t iLength = szDateString.GetLength(); |
2214 FX_BOOL iRet = FALSE; | 2214 FX_BOOL iRet = FALSE; |
2215 int32_t iStyle = -1; | 2215 int32_t iStyle = -1; |
2216 int32_t iYear = 0; | 2216 int32_t iYear = 0; |
2217 int32_t iMonth = 0; | 2217 int32_t iMonth = 0; |
2218 int32_t iDay = 0; | 2218 int32_t iDay = 0; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2374 if (!pLocale) { | 2374 if (!pLocale) { |
2375 return; | 2375 return; |
2376 } | 2376 } |
2377 CFX_WideString strRet; | 2377 CFX_WideString strRet; |
2378 pLocale->GetDatePattern(strStyle, strRet); | 2378 pLocale->GetDatePattern(strStyle, strRet); |
2379 if (!bStandard) { | 2379 if (!bStandard) { |
2380 CFX_WideString wsSymbols; | 2380 CFX_WideString wsSymbols; |
2381 pLocale->GetDateTimeSymbols(wsSymbols); | 2381 pLocale->GetDateTimeSymbols(wsSymbols); |
2382 XFA_FM_AlternateDateTimeSymbols(strRet, wsSymbols, g_sAltTable_Date); | 2382 XFA_FM_AlternateDateTimeSymbols(strRet, wsSymbols, g_sAltTable_Date); |
2383 } | 2383 } |
2384 strFormat = FX_UTF8Encode(strRet, strRet.GetLength()); | 2384 strFormat = FX_UTF8Encode(strRet.c_str(), strRet.GetLength()); |
2385 } | 2385 } |
2386 void CXFA_FM2JSContext::GetLocalTimeFormat(FXJSE_HOBJECT hThis, | 2386 void CXFA_FM2JSContext::GetLocalTimeFormat(FXJSE_HOBJECT hThis, |
2387 int32_t iStyle, | 2387 int32_t iStyle, |
2388 const CFX_ByteStringC& szLocalStr, | 2388 const CFX_ByteStringC& szLocalStr, |
2389 CFX_ByteString& strFormat, | 2389 CFX_ByteString& strFormat, |
2390 FX_BOOL bStandard) { | 2390 FX_BOOL bStandard) { |
2391 FX_LOCALEDATETIMESUBCATEGORY strStyle; | 2391 FX_LOCALEDATETIMESUBCATEGORY strStyle; |
2392 switch (iStyle) { | 2392 switch (iStyle) { |
2393 case 0: | 2393 case 0: |
2394 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Medium; | 2394 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Medium; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2429 if (!pLocale) { | 2429 if (!pLocale) { |
2430 return; | 2430 return; |
2431 } | 2431 } |
2432 CFX_WideString strRet; | 2432 CFX_WideString strRet; |
2433 pLocale->GetTimePattern(strStyle, strRet); | 2433 pLocale->GetTimePattern(strStyle, strRet); |
2434 if (!bStandard) { | 2434 if (!bStandard) { |
2435 CFX_WideString wsSymbols; | 2435 CFX_WideString wsSymbols; |
2436 pLocale->GetDateTimeSymbols(wsSymbols); | 2436 pLocale->GetDateTimeSymbols(wsSymbols); |
2437 XFA_FM_AlternateDateTimeSymbols(strRet, wsSymbols, g_sAltTable_Time); | 2437 XFA_FM_AlternateDateTimeSymbols(strRet, wsSymbols, g_sAltTable_Time); |
2438 } | 2438 } |
2439 strFormat = FX_UTF8Encode(strRet, strRet.GetLength()); | 2439 strFormat = FX_UTF8Encode(strRet.c_str(), strRet.GetLength()); |
2440 } | 2440 } |
2441 void CXFA_FM2JSContext::GetStandardDateFormat(FXJSE_HOBJECT hThis, | 2441 void CXFA_FM2JSContext::GetStandardDateFormat(FXJSE_HOBJECT hThis, |
2442 int32_t iStyle, | 2442 int32_t iStyle, |
2443 const CFX_ByteStringC& szLocalStr, | 2443 const CFX_ByteStringC& szLocalStr, |
2444 CFX_ByteString& strFormat) { | 2444 CFX_ByteString& strFormat) { |
2445 GetLocalDateFormat(hThis, iStyle, szLocalStr, strFormat, TRUE); | 2445 GetLocalDateFormat(hThis, iStyle, szLocalStr, strFormat, TRUE); |
2446 } | 2446 } |
2447 void CXFA_FM2JSContext::GetStandardTimeFormat(FXJSE_HOBJECT hThis, | 2447 void CXFA_FM2JSContext::GetStandardTimeFormat(FXJSE_HOBJECT hThis, |
2448 int32_t iStyle, | 2448 int32_t iStyle, |
2449 const CFX_ByteStringC& szLocalStr, | 2449 const CFX_ByteStringC& szLocalStr, |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3243 CFX_WideTextBuf wsJavaScriptBuf; | 3243 CFX_WideTextBuf wsJavaScriptBuf; |
3244 CFX_WideString javaScript; | 3244 CFX_WideString javaScript; |
3245 CFX_WideString wsError; | 3245 CFX_WideString wsError; |
3246 XFA_FM2JS_Translate( | 3246 XFA_FM2JS_Translate( |
3247 CFX_WideString::FromUTF8(utf8ScriptString.AsStringC()).AsStringC(), | 3247 CFX_WideString::FromUTF8(utf8ScriptString.AsStringC()).AsStringC(), |
3248 wsJavaScriptBuf, wsError); | 3248 wsJavaScriptBuf, wsError); |
3249 FXJSE_HCONTEXT hContext = FXJSE_Context_Create(hruntime); | 3249 FXJSE_HCONTEXT hContext = FXJSE_Context_Create(hruntime); |
3250 FXJSE_HVALUE returnValue = FXJSE_Value_Create(hruntime); | 3250 FXJSE_HVALUE returnValue = FXJSE_Value_Create(hruntime); |
3251 javaScript = wsJavaScriptBuf.GetWideString(); | 3251 javaScript = wsJavaScriptBuf.GetWideString(); |
3252 FXJSE_ExecuteScript( | 3252 FXJSE_ExecuteScript( |
3253 hContext, FX_UTF8Encode(javaScript, javaScript.GetLength()).c_str(), | 3253 hContext, |
| 3254 FX_UTF8Encode(javaScript.c_str(), javaScript.GetLength()).c_str(), |
3254 returnValue); | 3255 returnValue); |
3255 FXJSE_Value_Set(args.GetReturnValue(), returnValue); | 3256 FXJSE_Value_Set(args.GetReturnValue(), returnValue); |
3256 FXJSE_Value_Release(returnValue); | 3257 FXJSE_Value_Release(returnValue); |
3257 FXJSE_Context_Release(hContext); | 3258 FXJSE_Context_Release(hContext); |
3258 } | 3259 } |
3259 FXJSE_Value_Release(scriptValue); | 3260 FXJSE_Value_Release(scriptValue); |
3260 } else { | 3261 } else { |
3261 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3262 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3262 L"Eval"); | 3263 L"Eval"); |
3263 } | 3264 } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3360 VALUETYPE_HAVEDIGITWHITE, | 3361 VALUETYPE_HAVEDIGITWHITE, |
3361 VALUETYPE_ISCM, | 3362 VALUETYPE_ISCM, |
3362 VALUETYPE_ISMM, | 3363 VALUETYPE_ISMM, |
3363 VALUETYPE_ISPT, | 3364 VALUETYPE_ISPT, |
3364 VALUETYPE_ISMP, | 3365 VALUETYPE_ISMP, |
3365 VALUETYPE_ISIN, | 3366 VALUETYPE_ISIN, |
3366 }; | 3367 }; |
3367 unitspanString.MakeLower(); | 3368 unitspanString.MakeLower(); |
3368 CFX_WideString wsTypeString = | 3369 CFX_WideString wsTypeString = |
3369 CFX_WideString::FromUTF8(unitspanString.AsStringC()); | 3370 CFX_WideString::FromUTF8(unitspanString.AsStringC()); |
3370 const FX_WCHAR* pData = wsTypeString; | 3371 const FX_WCHAR* pData = wsTypeString.c_str(); |
3371 int32_t u = 0; | 3372 int32_t u = 0; |
3372 int32_t uLen = wsTypeString.GetLength(); | 3373 int32_t uLen = wsTypeString.GetLength(); |
3373 while (*(pData + u) == 0x20 || *(pData + u) == 0x09 || | 3374 while (*(pData + u) == 0x20 || *(pData + u) == 0x09 || |
3374 *(pData + u) == 0x0B || *(pData + u) == 0x0C || | 3375 *(pData + u) == 0x0B || *(pData + u) == 0x0C || |
3375 *(pData + u) == 0x0A || *(pData + u) == 0x0D) { | 3376 *(pData + u) == 0x0A || *(pData + u) == 0x0D) { |
3376 u++; | 3377 u++; |
3377 } | 3378 } |
3378 XFA_FM2JS_VALUETYPE_ParserStatus eParserStatus = VALUETYPE_START; | 3379 XFA_FM2JS_VALUETYPE_ParserStatus eParserStatus = VALUETYPE_START; |
3379 FX_WCHAR typeChar; | 3380 FX_WCHAR typeChar; |
3380 while (u < uLen) { | 3381 while (u < uLen) { |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3720 FXJSE_Value_Release(argOne); | 3721 FXJSE_Value_Release(argOne); |
3721 FXJSE_Value_Release(argTwo); | 3722 FXJSE_Value_Release(argTwo); |
3722 } else { | 3723 } else { |
3723 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3724 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3724 L"Decode"); | 3725 L"Decode"); |
3725 } | 3726 } |
3726 } | 3727 } |
3727 void CXFA_FM2JSContext::DecodeURL(const CFX_ByteStringC& szURLString, | 3728 void CXFA_FM2JSContext::DecodeURL(const CFX_ByteStringC& szURLString, |
3728 CFX_ByteTextBuf& szResultString) { | 3729 CFX_ByteTextBuf& szResultString) { |
3729 CFX_WideString wsURLString = CFX_WideString::FromUTF8(szURLString); | 3730 CFX_WideString wsURLString = CFX_WideString::FromUTF8(szURLString); |
3730 const FX_WCHAR* pData = wsURLString; | 3731 const FX_WCHAR* pData = wsURLString.c_str(); |
3731 int32_t iLen = wsURLString.GetLength(); | 3732 int32_t iLen = wsURLString.GetLength(); |
3732 int32_t i = 0; | 3733 int32_t i = 0; |
3733 FX_WCHAR ch = 0; | 3734 FX_WCHAR ch = 0; |
3734 FX_WCHAR chTemp = 0; | 3735 FX_WCHAR chTemp = 0; |
3735 CFX_WideTextBuf wsResultBuf; | 3736 CFX_WideTextBuf wsResultBuf; |
3736 while (i < iLen) { | 3737 while (i < iLen) { |
3737 ch = *(pData + i); | 3738 ch = *(pData + i); |
3738 if ('%' == ch) { | 3739 if ('%' == ch) { |
3739 chTemp = 0; | 3740 chTemp = 0; |
3740 int32_t iCount = 0; | 3741 int32_t iCount = 0; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3781 } | 3782 } |
3782 void CXFA_FM2JSContext::DecodeHTML(const CFX_ByteStringC& szHTMLString, | 3783 void CXFA_FM2JSContext::DecodeHTML(const CFX_ByteStringC& szHTMLString, |
3783 CFX_ByteTextBuf& szResultString) { | 3784 CFX_ByteTextBuf& szResultString) { |
3784 CFX_WideString wsHTMLString = CFX_WideString::FromUTF8(szHTMLString); | 3785 CFX_WideString wsHTMLString = CFX_WideString::FromUTF8(szHTMLString); |
3785 FX_WCHAR strString[9]; | 3786 FX_WCHAR strString[9]; |
3786 int32_t iStrIndex = 0; | 3787 int32_t iStrIndex = 0; |
3787 int32_t iLen = wsHTMLString.GetLength(); | 3788 int32_t iLen = wsHTMLString.GetLength(); |
3788 int32_t i = 0; | 3789 int32_t i = 0; |
3789 int32_t iCode = 0; | 3790 int32_t iCode = 0; |
3790 FX_WCHAR ch = 0; | 3791 FX_WCHAR ch = 0; |
3791 const FX_WCHAR* pData = wsHTMLString; | 3792 const FX_WCHAR* pData = wsHTMLString.c_str(); |
3792 CFX_WideTextBuf wsResultBuf; | 3793 CFX_WideTextBuf wsResultBuf; |
3793 while (i < iLen) { | 3794 while (i < iLen) { |
3794 ch = *(pData + i); | 3795 ch = *(pData + i); |
3795 if (ch == '&') { | 3796 if (ch == '&') { |
3796 ++i; | 3797 ++i; |
3797 ch = *(pData + i); | 3798 ch = *(pData + i); |
3798 if (ch == '#') { | 3799 if (ch == '#') { |
3799 ++i; | 3800 ++i; |
3800 ch = *(pData + i); | 3801 ch = *(pData + i); |
3801 if (ch == 'x' || ch == 'X') { | 3802 if (ch == 'x' || ch == 'X') { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3855 } | 3856 } |
3856 void CXFA_FM2JSContext::DecodeXML(const CFX_ByteStringC& szXMLString, | 3857 void CXFA_FM2JSContext::DecodeXML(const CFX_ByteStringC& szXMLString, |
3857 CFX_ByteTextBuf& szResultString) { | 3858 CFX_ByteTextBuf& szResultString) { |
3858 CFX_WideString wsXMLString = CFX_WideString::FromUTF8(szXMLString); | 3859 CFX_WideString wsXMLString = CFX_WideString::FromUTF8(szXMLString); |
3859 FX_WCHAR strString[9]; | 3860 FX_WCHAR strString[9]; |
3860 int32_t iStrIndex = 0; | 3861 int32_t iStrIndex = 0; |
3861 int32_t iLen = wsXMLString.GetLength(); | 3862 int32_t iLen = wsXMLString.GetLength(); |
3862 int32_t i = 0; | 3863 int32_t i = 0; |
3863 int32_t iCode = 0; | 3864 int32_t iCode = 0; |
3864 FX_WCHAR ch = 0; | 3865 FX_WCHAR ch = 0; |
3865 const FX_WCHAR* pData = wsXMLString; | 3866 const FX_WCHAR* pData = wsXMLString.c_str(); |
3866 CFX_WideTextBuf wsXMLBuf; | 3867 CFX_WideTextBuf wsXMLBuf; |
3867 while (i < iLen) { | 3868 while (i < iLen) { |
3868 ch = *(pData + i); | 3869 ch = *(pData + i); |
3869 if (ch == '&') { | 3870 if (ch == '&') { |
3870 ++i; | 3871 ++i; |
3871 ch = *(pData + i); | 3872 ch = *(pData + i); |
3872 if (ch == '#') { | 3873 if (ch == '#') { |
3873 ++i; | 3874 ++i; |
3874 ch = *(pData + i); | 3875 ch = *(pData + i); |
3875 if (ch == 'x' || ch == 'X') { | 3876 if (ch == 'x' || ch == 'X') { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4114 strEncode[1] = '#'; | 4115 strEncode[1] = '#'; |
4115 strEncode[2] = 'x'; | 4116 strEncode[2] = 'x'; |
4116 strEncode[5] = ';'; | 4117 strEncode[5] = ';'; |
4117 strEncode[6] = 0; | 4118 strEncode[6] = 0; |
4118 strEncode[7] = ';'; | 4119 strEncode[7] = ';'; |
4119 strEncode[8] = 0; | 4120 strEncode[8] = 0; |
4120 CFX_WideTextBuf wsResultBuf; | 4121 CFX_WideTextBuf wsResultBuf; |
4121 uint32_t ch = 0; | 4122 uint32_t ch = 0; |
4122 int32_t iLen = wsHTMLString.GetLength(); | 4123 int32_t iLen = wsHTMLString.GetLength(); |
4123 int32_t i = 0; | 4124 int32_t i = 0; |
4124 const FX_WCHAR* pData = wsHTMLString; | 4125 const FX_WCHAR* pData = wsHTMLString.c_str(); |
4125 int32_t iIndex = 0; | 4126 int32_t iIndex = 0; |
4126 CFX_WideString htmlReserve; | 4127 CFX_WideString htmlReserve; |
4127 while (i < iLen) { | 4128 while (i < iLen) { |
4128 ch = *(pData + i); | 4129 ch = *(pData + i); |
4129 htmlReserve.Empty(); | 4130 htmlReserve.Empty(); |
4130 if (HTMLCode2STR(ch, htmlReserve)) { | 4131 if (HTMLCode2STR(ch, htmlReserve)) { |
4131 wsResultBuf.AppendChar(L'&'); | 4132 wsResultBuf.AppendChar(L'&'); |
4132 wsResultBuf << htmlReserve; | 4133 wsResultBuf << htmlReserve; |
4133 wsResultBuf.AppendChar(L';'); | 4134 wsResultBuf.AppendChar(L';'); |
4134 } else { | 4135 } else { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4176 strEncode[5] = ';'; | 4177 strEncode[5] = ';'; |
4177 strEncode[6] = 0; | 4178 strEncode[6] = 0; |
4178 strEncode[7] = ';'; | 4179 strEncode[7] = ';'; |
4179 strEncode[8] = 0; | 4180 strEncode[8] = 0; |
4180 const FX_WCHAR* const strName[] = {L"quot", L"amp", L"apos", L"lt", L"gt"}; | 4181 const FX_WCHAR* const strName[] = {L"quot", L"amp", L"apos", L"lt", L"gt"}; |
4181 const FX_WCHAR* strCode = L"0123456789abcdef"; | 4182 const FX_WCHAR* strCode = L"0123456789abcdef"; |
4182 FX_WCHAR ch = 0; | 4183 FX_WCHAR ch = 0; |
4183 int32_t iLength = wsXMLString.GetLength(); | 4184 int32_t iLength = wsXMLString.GetLength(); |
4184 int32_t iIndex = 0; | 4185 int32_t iIndex = 0; |
4185 int32_t u = 0; | 4186 int32_t u = 0; |
4186 const FX_WCHAR* pData = wsXMLString; | 4187 const FX_WCHAR* pData = wsXMLString.c_str(); |
4187 for (u = 0; u < iLength; ++u) { | 4188 for (u = 0; u < iLength; ++u) { |
4188 ch = *(pData + u); | 4189 ch = *(pData + u); |
4189 switch (ch) { | 4190 switch (ch) { |
4190 case '"': | 4191 case '"': |
4191 wsResultBuf.AppendChar('&'); | 4192 wsResultBuf.AppendChar('&'); |
4192 wsResultBuf << CFX_WideStringC(strName[QUOT]); | 4193 wsResultBuf << CFX_WideStringC(strName[QUOT]); |
4193 wsResultBuf.AppendChar(';'); | 4194 wsResultBuf.AppendChar(';'); |
4194 break; | 4195 break; |
4195 case '&': | 4196 case '&': |
4196 wsResultBuf.AppendChar('&'); | 4197 wsResultBuf.AppendChar('&'); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4305 patternType = XFA_VT_FLOAT; | 4306 patternType = XFA_VT_FLOAT; |
4306 } else if (FX_WSTRC(L"percent") == wsPattern.Mid(4, 7)) { | 4307 } else if (FX_WSTRC(L"percent") == wsPattern.Mid(4, 7)) { |
4307 patternType = XFA_VT_FLOAT; | 4308 patternType = XFA_VT_FLOAT; |
4308 } else { | 4309 } else { |
4309 patternType = XFA_VT_FLOAT; | 4310 patternType = XFA_VT_FLOAT; |
4310 } | 4311 } |
4311 return TRUE; | 4312 return TRUE; |
4312 } | 4313 } |
4313 patternType = XFA_VT_NULL; | 4314 patternType = XFA_VT_NULL; |
4314 wsPattern.MakeLower(); | 4315 wsPattern.MakeLower(); |
4315 const FX_WCHAR* pData = wsPattern; | 4316 const FX_WCHAR* pData = wsPattern.c_str(); |
4316 int32_t iLength = wsPattern.GetLength(); | 4317 int32_t iLength = wsPattern.GetLength(); |
4317 int32_t iIndex = 0; | 4318 int32_t iIndex = 0; |
4318 FX_BOOL bSingleQuotation = FALSE; | 4319 FX_BOOL bSingleQuotation = FALSE; |
4319 FX_WCHAR patternChar; | 4320 FX_WCHAR patternChar; |
4320 while (iIndex < iLength) { | 4321 while (iIndex < iLength) { |
4321 patternChar = *(pData + iIndex); | 4322 patternChar = *(pData + iIndex); |
4322 if (patternChar == 0x27) { | 4323 if (patternChar == 0x27) { |
4323 bSingleQuotation = !bSingleQuotation; | 4324 bSingleQuotation = !bSingleQuotation; |
4324 } else if (!bSingleQuotation && | 4325 } else if (!bSingleQuotation && |
4325 (patternChar == 'y' || patternChar == 'j')) { | 4326 (patternChar == 'y' || patternChar == 'j')) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4435 } break; | 4436 } break; |
4436 } | 4437 } |
4437 } | 4438 } |
4438 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, pLocale, | 4439 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, pLocale, |
4439 (CXFA_LocaleMgr*)pMgr); | 4440 (CXFA_LocaleMgr*)pMgr); |
4440 CFX_WideString wsRet; | 4441 CFX_WideString wsRet; |
4441 if (localeValue.FormatPatterns(wsRet, wsPattern, pLocale, | 4442 if (localeValue.FormatPatterns(wsRet, wsPattern, pLocale, |
4442 XFA_VALUEPICTURE_Display)) { | 4443 XFA_VALUEPICTURE_Display)) { |
4443 FXJSE_Value_SetUTF8String( | 4444 FXJSE_Value_SetUTF8String( |
4444 args.GetReturnValue(), | 4445 args.GetReturnValue(), |
4445 FX_UTF8Encode(wsRet, wsRet.GetLength()).AsStringC()); | 4446 FX_UTF8Encode(wsRet.c_str(), wsRet.GetLength()).AsStringC()); |
4446 } else { | 4447 } else { |
4447 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 4448 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
4448 } | 4449 } |
4449 FXJSE_Value_Release(argOne); | 4450 FXJSE_Value_Release(argOne); |
4450 FXJSE_Value_Release(argTwo); | 4451 FXJSE_Value_Release(argTwo); |
4451 } else { | 4452 } else { |
4452 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4453 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
4453 L"Format"); | 4454 L"Format"); |
4454 } | 4455 } |
4455 } | 4456 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4515 if (HValueIsNull(hThis, argOne)) { | 4516 if (HValueIsNull(hThis, argOne)) { |
4516 FXJSE_Value_SetNull(args.GetReturnValue()); | 4517 FXJSE_Value_SetNull(args.GetReturnValue()); |
4517 } else { | 4518 } else { |
4518 if (argc == 2) { | 4519 if (argc == 2) { |
4519 localeValue = GetSimpleHValue(hThis, args, 1); | 4520 localeValue = GetSimpleHValue(hThis, args, 1); |
4520 } | 4521 } |
4521 HValueToUTF8String(argOne, argString); | 4522 HValueToUTF8String(argOne, argString); |
4522 CFX_WideTextBuf lowStringBuf; | 4523 CFX_WideTextBuf lowStringBuf; |
4523 CFX_WideString wsArgString = | 4524 CFX_WideString wsArgString = |
4524 CFX_WideString::FromUTF8(argString.AsStringC()); | 4525 CFX_WideString::FromUTF8(argString.AsStringC()); |
4525 const FX_WCHAR* pData = wsArgString; | 4526 const FX_WCHAR* pData = wsArgString.c_str(); |
4526 int32_t iLen = argString.GetLength(); | 4527 int32_t iLen = argString.GetLength(); |
4527 int32_t i = 0; | 4528 int32_t i = 0; |
4528 int32_t ch = 0; | 4529 int32_t ch = 0; |
4529 while (i < iLen) { | 4530 while (i < iLen) { |
4530 ch = *(pData + i); | 4531 ch = *(pData + i); |
4531 if (ch >= 0x41 && ch <= 0x5A) { | 4532 if (ch >= 0x41 && ch <= 0x5A) { |
4532 ch += 32; | 4533 ch += 32; |
4533 } else if (ch >= 0xC0 && ch <= 0xDE) { | 4534 } else if (ch >= 0xC0 && ch <= 0xDE) { |
4534 ch += 32; | 4535 ch += 32; |
4535 } else if (ch == 0x100 || ch == 0x102 || ch == 0x104) { | 4536 } else if (ch == 0x100 || ch == 0x102 || ch == 0x104) { |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5141 if (HValueIsNull(hThis, argOne)) { | 5142 if (HValueIsNull(hThis, argOne)) { |
5142 FXJSE_Value_SetNull(args.GetReturnValue()); | 5143 FXJSE_Value_SetNull(args.GetReturnValue()); |
5143 } else { | 5144 } else { |
5144 if (argc == 2) { | 5145 if (argc == 2) { |
5145 localeValue = GetSimpleHValue(hThis, args, 1); | 5146 localeValue = GetSimpleHValue(hThis, args, 1); |
5146 } | 5147 } |
5147 HValueToUTF8String(argOne, argString); | 5148 HValueToUTF8String(argOne, argString); |
5148 CFX_WideTextBuf upperStringBuf; | 5149 CFX_WideTextBuf upperStringBuf; |
5149 CFX_WideString wsArgString = | 5150 CFX_WideString wsArgString = |
5150 CFX_WideString::FromUTF8(argString.AsStringC()); | 5151 CFX_WideString::FromUTF8(argString.AsStringC()); |
5151 const FX_WCHAR* pData = wsArgString; | 5152 const FX_WCHAR* pData = wsArgString.c_str(); |
5152 int32_t iLen = wsArgString.GetLength(); | 5153 int32_t iLen = wsArgString.GetLength(); |
5153 int32_t i = 0; | 5154 int32_t i = 0; |
5154 int32_t ch = 0; | 5155 int32_t ch = 0; |
5155 while (i < iLen) { | 5156 while (i < iLen) { |
5156 ch = *(pData + i); | 5157 ch = *(pData + i); |
5157 if (ch >= 0x61 && ch <= 0x7A) { | 5158 if (ch >= 0x61 && ch <= 0x7A) { |
5158 ch -= 32; | 5159 ch -= 32; |
5159 } else if (ch >= 0xE0 && ch <= 0xFE) { | 5160 } else if (ch >= 0xE0 && ch <= 0xFE) { |
5160 ch -= 32; | 5161 ch -= 32; |
5161 } else if (ch == 0x101 || ch == 0x103 || ch == 0x105) { | 5162 } else if (ch == 0x101 || ch == 0x103 || ch == 0x105) { |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5530 } | 5531 } |
5531 if (argc > 3) { | 5532 if (argc > 3) { |
5532 FXJSE_Value_Release(argFour); | 5533 FXJSE_Value_Release(argFour); |
5533 } | 5534 } |
5534 if (argc > 4) { | 5535 if (argc > 4) { |
5535 FXJSE_Value_Release(argFive); | 5536 FXJSE_Value_Release(argFive); |
5536 } | 5537 } |
5537 if (bFlags) { | 5538 if (bFlags) { |
5538 FXJSE_Value_SetUTF8String( | 5539 FXJSE_Value_SetUTF8String( |
5539 args.GetReturnValue(), | 5540 args.GetReturnValue(), |
5540 FX_UTF8Encode(decodedResponse, decodedResponse.GetLength()) | 5541 FX_UTF8Encode(decodedResponse.c_str(), decodedResponse.GetLength()) |
5541 .AsStringC()); | 5542 .AsStringC()); |
5542 } else { | 5543 } else { |
5543 pContext->ThrowScriptErrorMessage(XFA_IDS_SERVER_DENY); | 5544 pContext->ThrowScriptErrorMessage(XFA_IDS_SERVER_DENY); |
5544 } | 5545 } |
5545 } else { | 5546 } else { |
5546 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 5547 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
5547 L"Post"); | 5548 L"Post"); |
5548 } | 5549 } |
5549 } | 5550 } |
5550 void CXFA_FM2JSContext::Put(FXJSE_HOBJECT hThis, | 5551 void CXFA_FM2JSContext::Put(FXJSE_HOBJECT hThis, |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6139 for (int32_t i = 0; i < (iCounter + 2); i++) { | 6140 for (int32_t i = 0; i < (iCounter + 2); i++) { |
6140 FXJSE_Value_Release(rgValues[i]); | 6141 FXJSE_Value_Release(rgValues[i]); |
6141 } | 6142 } |
6142 FX_Free(rgValues); | 6143 FX_Free(rgValues); |
6143 } else { | 6144 } else { |
6144 CFX_WideString wsPropertyName = | 6145 CFX_WideString wsPropertyName = |
6145 CFX_WideString::FromUTF8(szName.AsStringC()); | 6146 CFX_WideString::FromUTF8(szName.AsStringC()); |
6146 CFX_WideString wsSomExpression = | 6147 CFX_WideString wsSomExpression = |
6147 CFX_WideString::FromUTF8(szSomExp.AsStringC()); | 6148 CFX_WideString::FromUTF8(szSomExp.AsStringC()); |
6148 pContext->ThrowScriptErrorMessage(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT, | 6149 pContext->ThrowScriptErrorMessage(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT, |
6149 (const FX_WCHAR*)wsPropertyName, | 6150 wsPropertyName.c_str(), |
6150 (const FX_WCHAR*)wsSomExpression); | 6151 wsSomExpression.c_str()); |
6151 } | 6152 } |
6152 for (int32_t i = 0; i < iLength - 2; i++) { | 6153 for (int32_t i = 0; i < iLength - 2; i++) { |
6153 for (int32_t j = 0; j < iSizes[i]; j++) { | 6154 for (int32_t j = 0; j < iSizes[i]; j++) { |
6154 FXJSE_Value_Release(hResolveValues[i][j]); | 6155 FXJSE_Value_Release(hResolveValues[i][j]); |
6155 } | 6156 } |
6156 if (iSizes[i] > 0) { | 6157 if (iSizes[i] > 0) { |
6157 FX_Free(hResolveValues[i]); | 6158 FX_Free(hResolveValues[i]); |
6158 } | 6159 } |
6159 } | 6160 } |
6160 FX_Free(hResolveValues); | 6161 FX_Free(hResolveValues); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6202 for (int32_t i = 0; i < iSize; i++) { | 6203 for (int32_t i = 0; i < iSize; i++) { |
6203 FXJSE_Value_Release(hResolveValues[i]); | 6204 FXJSE_Value_Release(hResolveValues[i]); |
6204 } | 6205 } |
6205 FX_Free(hResolveValues); | 6206 FX_Free(hResolveValues); |
6206 } else { | 6207 } else { |
6207 CFX_WideString wsPropertyName = | 6208 CFX_WideString wsPropertyName = |
6208 CFX_WideString::FromUTF8(szName.AsStringC()); | 6209 CFX_WideString::FromUTF8(szName.AsStringC()); |
6209 CFX_WideString wsSomExpression = | 6210 CFX_WideString wsSomExpression = |
6210 CFX_WideString::FromUTF8(szSomExp.AsStringC()); | 6211 CFX_WideString::FromUTF8(szSomExp.AsStringC()); |
6211 pContext->ThrowScriptErrorMessage(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT, | 6212 pContext->ThrowScriptErrorMessage(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT, |
6212 (const FX_WCHAR*)wsPropertyName, | 6213 wsPropertyName.c_str(), |
6213 (const FX_WCHAR*)wsSomExpression); | 6214 wsSomExpression.c_str()); |
6214 } | 6215 } |
6215 } | 6216 } |
6216 if (argc == 5) { | 6217 if (argc == 5) { |
6217 FXJSE_Value_Release(argIndex); | 6218 FXJSE_Value_Release(argIndex); |
6218 } | 6219 } |
6219 FXJSE_Value_Release(argAccessor); | 6220 FXJSE_Value_Release(argAccessor); |
6220 } else { | 6221 } else { |
6221 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 6222 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
6222 } | 6223 } |
6223 } | 6224 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6287 for (int32_t i = 0; i < (iCounter + 2); i++) { | 6288 for (int32_t i = 0; i < (iCounter + 2); i++) { |
6288 FXJSE_Value_Release(rgValues[i]); | 6289 FXJSE_Value_Release(rgValues[i]); |
6289 } | 6290 } |
6290 FX_Free(rgValues); | 6291 FX_Free(rgValues); |
6291 } else { | 6292 } else { |
6292 CFX_WideString wsPropertyName = | 6293 CFX_WideString wsPropertyName = |
6293 CFX_WideString::FromUTF8(szName.AsStringC()); | 6294 CFX_WideString::FromUTF8(szName.AsStringC()); |
6294 CFX_WideString wsSomExpression = | 6295 CFX_WideString wsSomExpression = |
6295 CFX_WideString::FromUTF8(szSomExp.AsStringC()); | 6296 CFX_WideString::FromUTF8(szSomExp.AsStringC()); |
6296 pContext->ThrowScriptErrorMessage(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT, | 6297 pContext->ThrowScriptErrorMessage(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT, |
6297 (const FX_WCHAR*)wsPropertyName, | 6298 wsPropertyName.c_str(), |
6298 (const FX_WCHAR*)wsSomExpression); | 6299 wsSomExpression.c_str()); |
6299 } | 6300 } |
6300 for (int32_t i = 0; i < iLength - 2; i++) { | 6301 for (int32_t i = 0; i < iLength - 2; i++) { |
6301 for (int32_t j = 0; j < iSizes[i]; j++) { | 6302 for (int32_t j = 0; j < iSizes[i]; j++) { |
6302 FXJSE_Value_Release(hResolveValues[i][j]); | 6303 FXJSE_Value_Release(hResolveValues[i][j]); |
6303 } | 6304 } |
6304 FX_Free(hResolveValues[i]); | 6305 FX_Free(hResolveValues[i]); |
6305 } | 6306 } |
6306 FX_Free(hResolveValues); | 6307 FX_Free(hResolveValues); |
6307 FX_Free(iSizes); | 6308 FX_Free(iSizes); |
6308 FXJSE_Value_Release(hLengthValue); | 6309 FXJSE_Value_Release(hLengthValue); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6349 for (int32_t i = 0; i < iSize; i++) { | 6350 for (int32_t i = 0; i < iSize; i++) { |
6350 FXJSE_Value_Release(hResolveValues[i]); | 6351 FXJSE_Value_Release(hResolveValues[i]); |
6351 } | 6352 } |
6352 FX_Free(hResolveValues); | 6353 FX_Free(hResolveValues); |
6353 } else { | 6354 } else { |
6354 CFX_WideString wsPropertyName = | 6355 CFX_WideString wsPropertyName = |
6355 CFX_WideString::FromUTF8(szName.AsStringC()); | 6356 CFX_WideString::FromUTF8(szName.AsStringC()); |
6356 CFX_WideString wsSomExpression = | 6357 CFX_WideString wsSomExpression = |
6357 CFX_WideString::FromUTF8(szSomExp.AsStringC()); | 6358 CFX_WideString::FromUTF8(szSomExp.AsStringC()); |
6358 pContext->ThrowScriptErrorMessage(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT, | 6359 pContext->ThrowScriptErrorMessage(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT, |
6359 (const FX_WCHAR*)wsPropertyName, | 6360 wsPropertyName.c_str(), |
6360 (const FX_WCHAR*)wsSomExpression); | 6361 wsSomExpression.c_str()); |
6361 } | 6362 } |
6362 } | 6363 } |
6363 if (argc == 5) { | 6364 if (argc == 5) { |
6364 FXJSE_Value_Release(argIndex); | 6365 FXJSE_Value_Release(argIndex); |
6365 } | 6366 } |
6366 FXJSE_Value_Release(argAccessor); | 6367 FXJSE_Value_Release(argAccessor); |
6367 } else { | 6368 } else { |
6368 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 6369 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
6369 } | 6370 } |
6370 } | 6371 } |
(...skipping 12 matching lines...) Expand all Loading... |
6383 } else { | 6384 } else { |
6384 CFX_WideString scriptString = | 6385 CFX_WideString scriptString = |
6385 CFX_WideString::FromUTF8(argString.AsStringC()); | 6386 CFX_WideString::FromUTF8(argString.AsStringC()); |
6386 CFX_WideTextBuf wsJavaScriptBuf; | 6387 CFX_WideTextBuf wsJavaScriptBuf; |
6387 CFX_WideString wsError; | 6388 CFX_WideString wsError; |
6388 XFA_FM2JS_Translate(scriptString.AsStringC(), wsJavaScriptBuf, wsError); | 6389 XFA_FM2JS_Translate(scriptString.AsStringC(), wsJavaScriptBuf, wsError); |
6389 if (wsError.IsEmpty()) { | 6390 if (wsError.IsEmpty()) { |
6390 CFX_WideString javaScript = wsJavaScriptBuf.GetWideString(); | 6391 CFX_WideString javaScript = wsJavaScriptBuf.GetWideString(); |
6391 FXJSE_Value_SetUTF8String( | 6392 FXJSE_Value_SetUTF8String( |
6392 args.GetReturnValue(), | 6393 args.GetReturnValue(), |
6393 FX_UTF8Encode(javaScript, javaScript.GetLength()).AsStringC()); | 6394 FX_UTF8Encode(javaScript.c_str(), javaScript.GetLength()) |
| 6395 .AsStringC()); |
6394 } else { | 6396 } else { |
6395 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 6397 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
6396 } | 6398 } |
6397 } | 6399 } |
6398 FXJSE_Value_Release(argOne); | 6400 FXJSE_Value_Release(argOne); |
6399 } else { | 6401 } else { |
6400 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 6402 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
6401 L"Eval"); | 6403 L"Eval"); |
6402 } | 6404 } |
6403 } | 6405 } |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7223 delete this; | 7225 delete this; |
7224 } | 7226 } |
7225 void CXFA_FM2JSContext::ThrowScriptErrorMessage(int32_t iStringID, ...) { | 7227 void CXFA_FM2JSContext::ThrowScriptErrorMessage(int32_t iStringID, ...) { |
7226 IXFA_AppProvider* pAppProvider = m_pDocument->GetNotify()->GetAppProvider(); | 7228 IXFA_AppProvider* pAppProvider = m_pDocument->GetNotify()->GetAppProvider(); |
7227 FXSYS_assert(pAppProvider); | 7229 FXSYS_assert(pAppProvider); |
7228 CFX_WideString wsFormat; | 7230 CFX_WideString wsFormat; |
7229 pAppProvider->LoadString(iStringID, wsFormat); | 7231 pAppProvider->LoadString(iStringID, wsFormat); |
7230 CFX_WideString wsMessage; | 7232 CFX_WideString wsMessage; |
7231 va_list arg_ptr; | 7233 va_list arg_ptr; |
7232 va_start(arg_ptr, iStringID); | 7234 va_start(arg_ptr, iStringID); |
7233 wsMessage.FormatV((const FX_WCHAR*)wsFormat, arg_ptr); | 7235 wsMessage.FormatV(wsFormat.c_str(), arg_ptr); |
7234 va_end(arg_ptr); | 7236 va_end(arg_ptr); |
7235 FXJSE_ThrowMessage( | 7237 FXJSE_ThrowMessage( |
7236 "", FX_UTF8Encode(wsMessage, wsMessage.GetLength()).AsStringC()); | 7238 "", FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); |
7237 } | 7239 } |
OLD | NEW |