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 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1576 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 1576 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
1577 IFX_Locale* pLocale = NULL; | 1577 IFX_Locale* pLocale = NULL; |
1578 if (localString.IsEmpty()) { | 1578 if (localString.IsEmpty()) { |
1579 CXFA_Node* pThisNode = | 1579 CXFA_Node* pThisNode = |
1580 ToNode(pDoc->GetScriptContext()->GetThisObject()); | 1580 ToNode(pDoc->GetScriptContext()->GetThisObject()); |
1581 ASSERT(pThisNode); | 1581 ASSERT(pThisNode); |
1582 CXFA_WidgetData widgetData(pThisNode); | 1582 CXFA_WidgetData widgetData(pThisNode); |
1583 pLocale = widgetData.GetLocal(); | 1583 pLocale = widgetData.GetLocal(); |
1584 } else { | 1584 } else { |
1585 pLocale = pMgr->GetLocaleByName( | 1585 pLocale = pMgr->GetLocaleByName( |
1586 CFX_WideString::FromUTF8(localString.AsStringC()).AsStringC()); | 1586 CFX_WideString::FromUTF8(localString.AsStringC())); |
1587 } | 1587 } |
1588 CFX_WideString wsFormat; | 1588 CFX_WideString wsFormat; |
1589 if (formatString.IsEmpty()) { | 1589 if (formatString.IsEmpty()) { |
1590 pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); | 1590 pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); |
1591 } else { | 1591 } else { |
1592 wsFormat = CFX_WideString::FromUTF8(formatString.AsStringC()); | 1592 wsFormat = CFX_WideString::FromUTF8(formatString.AsStringC()); |
1593 } | 1593 } |
1594 wsFormat = FX_WSTRC(L"time{") + wsFormat; | 1594 wsFormat = FX_WSTRC(L"time{") + wsFormat; |
1595 wsFormat += FX_WSTRC(L"}"); | 1595 wsFormat += FX_WSTRC(L"}"); |
1596 CXFA_LocaleValue timeValue( | 1596 CXFA_LocaleValue timeValue( |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2022 return FALSE; | 2022 return FALSE; |
2023 } | 2023 } |
2024 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2024 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
2025 IFX_Locale* pLocale = NULL; | 2025 IFX_Locale* pLocale = NULL; |
2026 if (szLocale.IsEmpty()) { | 2026 if (szLocale.IsEmpty()) { |
2027 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2027 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
2028 ASSERT(pThisNode); | 2028 ASSERT(pThisNode); |
2029 CXFA_WidgetData widgetData(pThisNode); | 2029 CXFA_WidgetData widgetData(pThisNode); |
2030 pLocale = widgetData.GetLocal(); | 2030 pLocale = widgetData.GetLocal(); |
2031 } else { | 2031 } else { |
2032 pLocale = | 2032 pLocale = pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale)); |
2033 pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale).AsStringC()); | |
2034 } | 2033 } |
2035 if (!pLocale) { | 2034 if (!pLocale) { |
2036 return FALSE; | 2035 return FALSE; |
2037 } | 2036 } |
2038 CFX_WideString wsFormat; | 2037 CFX_WideString wsFormat; |
2039 if (szFormat.IsEmpty()) { | 2038 if (szFormat.IsEmpty()) { |
2040 pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); | 2039 pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); |
2041 } else { | 2040 } else { |
2042 wsFormat = CFX_WideString::FromUTF8(szFormat); | 2041 wsFormat = CFX_WideString::FromUTF8(szFormat); |
2043 } | 2042 } |
(...skipping 15 matching lines...) Expand all Loading... |
2059 return FALSE; | 2058 return FALSE; |
2060 } | 2059 } |
2061 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2060 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
2062 IFX_Locale* pLocale = NULL; | 2061 IFX_Locale* pLocale = NULL; |
2063 if (szLocale.IsEmpty()) { | 2062 if (szLocale.IsEmpty()) { |
2064 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2063 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
2065 ASSERT(pThisNode); | 2064 ASSERT(pThisNode); |
2066 CXFA_WidgetData widgetData(pThisNode); | 2065 CXFA_WidgetData widgetData(pThisNode); |
2067 pLocale = widgetData.GetLocal(); | 2066 pLocale = widgetData.GetLocal(); |
2068 } else { | 2067 } else { |
2069 pLocale = | 2068 pLocale = pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale)); |
2070 pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale).AsStringC()); | |
2071 } | 2069 } |
2072 if (!pLocale) { | 2070 if (!pLocale) { |
2073 return FALSE; | 2071 return FALSE; |
2074 } | 2072 } |
2075 CFX_WideString wsFormat; | 2073 CFX_WideString wsFormat; |
2076 if (szFormat.IsEmpty()) { | 2074 if (szFormat.IsEmpty()) { |
2077 pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); | 2075 pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); |
2078 } else { | 2076 } else { |
2079 wsFormat = CFX_WideString::FromUTF8(szFormat); | 2077 wsFormat = CFX_WideString::FromUTF8(szFormat); |
2080 } | 2078 } |
(...skipping 18 matching lines...) Expand all Loading... |
2099 return FALSE; | 2097 return FALSE; |
2100 } | 2098 } |
2101 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2099 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
2102 IFX_Locale* pLocale = NULL; | 2100 IFX_Locale* pLocale = NULL; |
2103 if (szLocale.IsEmpty()) { | 2101 if (szLocale.IsEmpty()) { |
2104 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2102 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
2105 ASSERT(pThisNode); | 2103 ASSERT(pThisNode); |
2106 CXFA_WidgetData widgetData(pThisNode); | 2104 CXFA_WidgetData widgetData(pThisNode); |
2107 pLocale = widgetData.GetLocal(); | 2105 pLocale = widgetData.GetLocal(); |
2108 } else { | 2106 } else { |
2109 pLocale = | 2107 pLocale = pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale)); |
2110 pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale).AsStringC()); | |
2111 } | 2108 } |
2112 if (!pLocale) { | 2109 if (!pLocale) { |
2113 return FALSE; | 2110 return FALSE; |
2114 } | 2111 } |
2115 CFX_WideString wsFormat; | 2112 CFX_WideString wsFormat; |
2116 if (szFormat.IsEmpty()) { | 2113 if (szFormat.IsEmpty()) { |
2117 pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); | 2114 pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); |
2118 } else { | 2115 } else { |
2119 wsFormat = CFX_WideString::FromUTF8(szFormat); | 2116 wsFormat = CFX_WideString::FromUTF8(szFormat); |
2120 } | 2117 } |
(...skipping 17 matching lines...) Expand all Loading... |
2138 return FALSE; | 2135 return FALSE; |
2139 } | 2136 } |
2140 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2137 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
2141 IFX_Locale* pLocale = NULL; | 2138 IFX_Locale* pLocale = NULL; |
2142 if (szLocale.IsEmpty()) { | 2139 if (szLocale.IsEmpty()) { |
2143 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2140 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
2144 ASSERT(pThisNode); | 2141 ASSERT(pThisNode); |
2145 CXFA_WidgetData widgetData(pThisNode); | 2142 CXFA_WidgetData widgetData(pThisNode); |
2146 pLocale = widgetData.GetLocal(); | 2143 pLocale = widgetData.GetLocal(); |
2147 } else { | 2144 } else { |
2148 pLocale = | 2145 pLocale = pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale)); |
2149 pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale).AsStringC()); | |
2150 } | 2146 } |
2151 if (!pLocale) { | 2147 if (!pLocale) { |
2152 return FALSE; | 2148 return FALSE; |
2153 } | 2149 } |
2154 CFX_WideString wsFormat; | 2150 CFX_WideString wsFormat; |
2155 if (szFormat.IsEmpty()) { | 2151 if (szFormat.IsEmpty()) { |
2156 pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); | 2152 pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); |
2157 } else { | 2153 } else { |
2158 wsFormat = CFX_WideString::FromUTF8(szFormat); | 2154 wsFormat = CFX_WideString::FromUTF8(szFormat); |
2159 } | 2155 } |
(...skipping 19 matching lines...) Expand all Loading... |
2179 return FALSE; | 2175 return FALSE; |
2180 } | 2176 } |
2181 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2177 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
2182 IFX_Locale* pLocale = NULL; | 2178 IFX_Locale* pLocale = NULL; |
2183 if (szLocale.IsEmpty()) { | 2179 if (szLocale.IsEmpty()) { |
2184 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2180 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
2185 ASSERT(pThisNode); | 2181 ASSERT(pThisNode); |
2186 CXFA_WidgetData widgetData(pThisNode); | 2182 CXFA_WidgetData widgetData(pThisNode); |
2187 pLocale = widgetData.GetLocal(); | 2183 pLocale = widgetData.GetLocal(); |
2188 } else { | 2184 } else { |
2189 pLocale = | 2185 pLocale = pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale)); |
2190 pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale).AsStringC()); | |
2191 } | 2186 } |
2192 if (!pLocale) { | 2187 if (!pLocale) { |
2193 return FALSE; | 2188 return FALSE; |
2194 } | 2189 } |
2195 CFX_WideString wsFormat; | 2190 CFX_WideString wsFormat; |
2196 if (szFormat.IsEmpty()) { | 2191 if (szFormat.IsEmpty()) { |
2197 pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); | 2192 pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); |
2198 } else { | 2193 } else { |
2199 wsFormat = CFX_WideString::FromUTF8(szFormat); | 2194 wsFormat = CFX_WideString::FromUTF8(szFormat); |
2200 } | 2195 } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2361 return; | 2356 return; |
2362 } | 2357 } |
2363 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2358 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
2364 IFX_Locale* pLocale = NULL; | 2359 IFX_Locale* pLocale = NULL; |
2365 if (szLocalStr.IsEmpty()) { | 2360 if (szLocalStr.IsEmpty()) { |
2366 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2361 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
2367 ASSERT(pThisNode); | 2362 ASSERT(pThisNode); |
2368 CXFA_WidgetData widgetData(pThisNode); | 2363 CXFA_WidgetData widgetData(pThisNode); |
2369 pLocale = widgetData.GetLocal(); | 2364 pLocale = widgetData.GetLocal(); |
2370 } else { | 2365 } else { |
2371 pLocale = | 2366 pLocale = pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocalStr)); |
2372 pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocalStr).AsStringC()); | |
2373 } | 2367 } |
2374 if (!pLocale) { | 2368 if (!pLocale) { |
2375 return; | 2369 return; |
2376 } | 2370 } |
2377 CFX_WideString strRet; | 2371 CFX_WideString strRet; |
2378 pLocale->GetDatePattern(strStyle, strRet); | 2372 pLocale->GetDatePattern(strStyle, strRet); |
2379 if (!bStandard) { | 2373 if (!bStandard) { |
2380 CFX_WideString wsSymbols; | 2374 CFX_WideString wsSymbols; |
2381 pLocale->GetDateTimeSymbols(wsSymbols); | 2375 pLocale->GetDateTimeSymbols(wsSymbols); |
2382 XFA_FM_AlternateDateTimeSymbols(strRet, wsSymbols, g_sAltTable_Date); | 2376 XFA_FM_AlternateDateTimeSymbols(strRet, wsSymbols, g_sAltTable_Date); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2416 return; | 2410 return; |
2417 } | 2411 } |
2418 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2412 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
2419 IFX_Locale* pLocale = NULL; | 2413 IFX_Locale* pLocale = NULL; |
2420 if (szLocalStr.IsEmpty()) { | 2414 if (szLocalStr.IsEmpty()) { |
2421 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2415 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
2422 ASSERT(pThisNode); | 2416 ASSERT(pThisNode); |
2423 CXFA_WidgetData widgetData(pThisNode); | 2417 CXFA_WidgetData widgetData(pThisNode); |
2424 pLocale = widgetData.GetLocal(); | 2418 pLocale = widgetData.GetLocal(); |
2425 } else { | 2419 } else { |
2426 pLocale = | 2420 pLocale = pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocalStr)); |
2427 pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocalStr).AsStringC()); | |
2428 } | 2421 } |
2429 if (!pLocale) { | 2422 if (!pLocale) { |
2430 return; | 2423 return; |
2431 } | 2424 } |
2432 CFX_WideString strRet; | 2425 CFX_WideString strRet; |
2433 pLocale->GetTimePattern(strStyle, strRet); | 2426 pLocale->GetTimePattern(strStyle, strRet); |
2434 if (!bStandard) { | 2427 if (!bStandard) { |
2435 CFX_WideString wsSymbols; | 2428 CFX_WideString wsSymbols; |
2436 pLocale->GetDateTimeSymbols(wsSymbols); | 2429 pLocale->GetDateTimeSymbols(wsSymbols); |
2437 XFA_FM_AlternateDateTimeSymbols(strRet, wsSymbols, g_sAltTable_Time); | 2430 XFA_FM_AlternateDateTimeSymbols(strRet, wsSymbols, g_sAltTable_Time); |
(...skipping 1943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4381 IFX_Locale* pLocale = widgetData.GetLocal(); | 4374 IFX_Locale* pLocale = widgetData.GetLocal(); |
4382 uint32_t patternType; | 4375 uint32_t patternType; |
4383 FX_BOOL bCompelte = | 4376 FX_BOOL bCompelte = |
4384 XFA_PATTERN_STRING_Type(szPattern.AsStringC(), patternType); | 4377 XFA_PATTERN_STRING_Type(szPattern.AsStringC(), patternType); |
4385 CFX_WideString wsPattern = CFX_WideString::FromUTF8(szPattern.AsStringC()); | 4378 CFX_WideString wsPattern = CFX_WideString::FromUTF8(szPattern.AsStringC()); |
4386 CFX_WideString wsValue = CFX_WideString::FromUTF8(szValue.AsStringC()); | 4379 CFX_WideString wsValue = CFX_WideString::FromUTF8(szValue.AsStringC()); |
4387 if (!bCompelte) { | 4380 if (!bCompelte) { |
4388 switch (patternType) { | 4381 switch (patternType) { |
4389 case XFA_VT_DATETIME: { | 4382 case XFA_VT_DATETIME: { |
4390 FX_STRSIZE iTChar = wsPattern.Find(L'T'); | 4383 FX_STRSIZE iTChar = wsPattern.Find(L'T'); |
4391 CFX_WideString wsDatePattern = FX_WSTRC(L"date{"); | 4384 CFX_WideString wsDatePattern(L"date{"); |
4392 wsDatePattern += wsPattern.Left(iTChar); | 4385 wsDatePattern += wsPattern.Left(iTChar); |
4393 wsDatePattern += FX_WSTRC(L"} "); | 4386 wsDatePattern += FX_WSTRC(L"} "); |
4394 CFX_WideString wsTimePattern = FX_WSTRC(L"time{"); | 4387 CFX_WideString wsTimePattern(L"time{"); |
4395 wsTimePattern += wsPattern.Mid(iTChar + 1); | 4388 wsTimePattern += wsPattern.Mid(iTChar + 1); |
4396 wsTimePattern += FX_WSTRC(L"}"); | 4389 wsTimePattern += FX_WSTRC(L"}"); |
4397 wsPattern = wsDatePattern + wsTimePattern; | 4390 wsPattern = wsDatePattern + wsTimePattern; |
4398 } break; | 4391 } break; |
4399 case XFA_VT_DATE: { | 4392 case XFA_VT_DATE: { |
4400 wsPattern = FX_WSTRC(L"date{") + wsPattern; | 4393 wsPattern = FX_WSTRC(L"date{") + wsPattern; |
4401 wsPattern += FX_WSTRC(L"}"); | 4394 wsPattern += FX_WSTRC(L"}"); |
4402 } break; | 4395 } break; |
4403 case XFA_VT_TIME: { | 4396 case XFA_VT_TIME: { |
4404 wsPattern = FX_WSTRC(L"time{") + wsPattern; | 4397 wsPattern = FX_WSTRC(L"time{") + wsPattern; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4607 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); | 4600 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); |
4608 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4601 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
4609 szParsedValue.AsStringC()); | 4602 szParsedValue.AsStringC()); |
4610 } else { | 4603 } else { |
4611 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 4604 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
4612 } | 4605 } |
4613 } else { | 4606 } else { |
4614 switch (patternType) { | 4607 switch (patternType) { |
4615 case XFA_VT_DATETIME: { | 4608 case XFA_VT_DATETIME: { |
4616 FX_STRSIZE iTChar = wsPattern.Find(L'T'); | 4609 FX_STRSIZE iTChar = wsPattern.Find(L'T'); |
4617 CFX_WideString wsDatePattern = FX_WSTRC(L"date{"); | 4610 CFX_WideString wsDatePattern(L"date{"); |
4618 wsDatePattern += wsPattern.Left(iTChar); | 4611 wsDatePattern += wsPattern.Left(iTChar); |
4619 wsDatePattern += FX_WSTRC(L"} "); | 4612 wsDatePattern += FX_WSTRC(L"} "); |
4620 CFX_WideString wsTimePattern = FX_WSTRC(L"time{"); | 4613 CFX_WideString wsTimePattern(L"time{"); |
4621 wsTimePattern += wsPattern.Mid(iTChar + 1); | 4614 wsTimePattern += wsPattern.Mid(iTChar + 1); |
4622 wsTimePattern += FX_WSTRC(L"}"); | 4615 wsTimePattern += FX_WSTRC(L"}"); |
4623 wsPattern = wsDatePattern + wsTimePattern; | 4616 wsPattern = wsDatePattern + wsTimePattern; |
4624 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, | 4617 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, |
4625 pLocale, (CXFA_LocaleMgr*)pMgr); | 4618 pLocale, (CXFA_LocaleMgr*)pMgr); |
4626 if (localeValue.IsValid()) { | 4619 if (localeValue.IsValid()) { |
4627 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); | 4620 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); |
4628 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4621 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
4629 szParsedValue.AsStringC()); | 4622 szParsedValue.AsStringC()); |
4630 } else { | 4623 } else { |
(...skipping 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6370 HValueToUTF8String(argOne, argString); | 6363 HValueToUTF8String(argOne, argString); |
6371 if (argString.IsEmpty()) { | 6364 if (argString.IsEmpty()) { |
6372 pContext->ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); | 6365 pContext->ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); |
6373 } else { | 6366 } else { |
6374 CFX_WideString scriptString = | 6367 CFX_WideString scriptString = |
6375 CFX_WideString::FromUTF8(argString.AsStringC()); | 6368 CFX_WideString::FromUTF8(argString.AsStringC()); |
6376 CFX_WideTextBuf wsJavaScriptBuf; | 6369 CFX_WideTextBuf wsJavaScriptBuf; |
6377 CFX_WideString wsError; | 6370 CFX_WideString wsError; |
6378 XFA_FM2JS_Translate(scriptString.AsStringC(), wsJavaScriptBuf, wsError); | 6371 XFA_FM2JS_Translate(scriptString.AsStringC(), wsJavaScriptBuf, wsError); |
6379 if (wsError.IsEmpty()) { | 6372 if (wsError.IsEmpty()) { |
6380 CFX_WideString javaScript = wsJavaScriptBuf.AsStringC(); | 6373 CFX_WideString javaScript = wsJavaScriptBuf.MakeString(); |
6381 FXJSE_Value_SetUTF8String( | 6374 FXJSE_Value_SetUTF8String( |
6382 args.GetReturnValue(), | 6375 args.GetReturnValue(), |
6383 FX_UTF8Encode(javaScript.c_str(), javaScript.GetLength()) | 6376 FX_UTF8Encode(javaScript.c_str(), javaScript.GetLength()) |
6384 .AsStringC()); | 6377 .AsStringC()); |
6385 } else { | 6378 } else { |
6386 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 6379 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
6387 } | 6380 } |
6388 } | 6381 } |
6389 FXJSE_Value_Release(argOne); | 6382 FXJSE_Value_Release(argOne); |
6390 } else { | 6383 } else { |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7219 CFX_WideString wsFormat; | 7212 CFX_WideString wsFormat; |
7220 pAppProvider->LoadString(iStringID, wsFormat); | 7213 pAppProvider->LoadString(iStringID, wsFormat); |
7221 CFX_WideString wsMessage; | 7214 CFX_WideString wsMessage; |
7222 va_list arg_ptr; | 7215 va_list arg_ptr; |
7223 va_start(arg_ptr, iStringID); | 7216 va_start(arg_ptr, iStringID); |
7224 wsMessage.FormatV(wsFormat.c_str(), arg_ptr); | 7217 wsMessage.FormatV(wsFormat.c_str(), arg_ptr); |
7225 va_end(arg_ptr); | 7218 va_end(arg_ptr); |
7226 FXJSE_ThrowMessage( | 7219 FXJSE_ThrowMessage( |
7227 "", FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); | 7220 "", FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); |
7228 } | 7221 } |
OLD | NEW |