| 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_fm2js.h" | 7 #include "xfa_fm2js.h" |
| 8 #include <time.h> | 8 #include <time.h> |
| 9 #define FINANCIAL_PRECISION 0.00000001 | 9 #define FINANCIAL_PRECISION 0.00000001 |
| 10 struct XFA_FMHtmlReserveCode { | 10 struct XFA_FMHtmlReserveCode { |
| (...skipping 3940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3951 CFX_WideString wsURLString = CFX_WideString::FromUTF8(szURLString.GetCStr(),
szURLString.GetLength()); | 3951 CFX_WideString wsURLString = CFX_WideString::FromUTF8(szURLString.GetCStr(),
szURLString.GetLength()); |
| 3952 CFX_WideTextBuf wsResultBuf; | 3952 CFX_WideTextBuf wsResultBuf; |
| 3953 FX_WCHAR ch = 0; | 3953 FX_WCHAR ch = 0; |
| 3954 FX_INT32 iLength = wsURLString.GetLength(); | 3954 FX_INT32 iLength = wsURLString.GetLength(); |
| 3955 FX_WCHAR strEncode[4]; | 3955 FX_WCHAR strEncode[4]; |
| 3956 strEncode[0] = '%'; | 3956 strEncode[0] = '%'; |
| 3957 strEncode[3] = 0; | 3957 strEncode[3] = 0; |
| 3958 FX_WCHAR strUnsafe[] = { ' ', '<', '>', '"', '#', '%', '{', '}', '|', '\\',
'^', '~', '[', ']', '`' }; | 3958 FX_WCHAR strUnsafe[] = { ' ', '<', '>', '"', '#', '%', '{', '}', '|', '\\',
'^', '~', '[', ']', '`' }; |
| 3959 FX_WCHAR strReserved[] = {';', '/', '?', ':', '@', '=', '&'}; | 3959 FX_WCHAR strReserved[] = {';', '/', '?', ':', '@', '=', '&'}; |
| 3960 FX_WCHAR strSpecial[] = {'$', '-', '+', '!', '*', '\'', '(', ')', ','}; | 3960 FX_WCHAR strSpecial[] = {'$', '-', '+', '!', '*', '\'', '(', ')', ','}; |
| 3961 FX_WCHAR* strCode = L"0123456789abcdef"; | 3961 const FX_LPCWSTR strCode = L"0123456789abcdef"; |
| 3962 for (FX_INT32 u = 0; u < iLength; ++u) { | 3962 for (FX_INT32 u = 0; u < iLength; ++u) { |
| 3963 ch = wsURLString.GetAt(u); | 3963 ch = wsURLString.GetAt(u); |
| 3964 FX_INT32 i = 0; | 3964 FX_INT32 i = 0; |
| 3965 FX_INT32 iCount = sizeof(strUnsafe) / sizeof(strUnsafe[0]); | 3965 FX_INT32 iCount = sizeof(strUnsafe) / sizeof(strUnsafe[0]); |
| 3966 while (i < iCount) { | 3966 while (i < iCount) { |
| 3967 if (ch == strUnsafe[i]) { | 3967 if (ch == strUnsafe[i]) { |
| 3968 FX_INT32 iIndex = ch / 16; | 3968 FX_INT32 iIndex = ch / 16; |
| 3969 strEncode[1] = strCode[iIndex]; | 3969 strEncode[1] = strCode[iIndex]; |
| 3970 strEncode[2] = strCode[ch - iIndex * 16]; | 3970 strEncode[2] = strCode[ch - iIndex * 16]; |
| 3971 wsResultBuf << FX_WSTRC(strEncode); | 3971 wsResultBuf << FX_WSTRC(strEncode); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4121 strEncode[6] = 0; | 4121 strEncode[6] = 0; |
| 4122 strEncode[7] = ';'; | 4122 strEncode[7] = ';'; |
| 4123 strEncode[8] = 0; | 4123 strEncode[8] = 0; |
| 4124 FX_LPCWSTR const strName[] = { | 4124 FX_LPCWSTR const strName[] = { |
| 4125 L"quot", | 4125 L"quot", |
| 4126 L"amp", | 4126 L"amp", |
| 4127 L"apos", | 4127 L"apos", |
| 4128 L"lt", | 4128 L"lt", |
| 4129 L"gt" | 4129 L"gt" |
| 4130 }; | 4130 }; |
| 4131 FX_WCHAR* strCode = L"0123456789abcdef"; | 4131 const FX_LPCWSTR strCode = L"0123456789abcdef"; |
| 4132 FX_WCHAR ch = 0; | 4132 FX_WCHAR ch = 0; |
| 4133 FX_INT32 iLength = wsXMLString.GetLength(); | 4133 FX_INT32 iLength = wsXMLString.GetLength(); |
| 4134 FX_INT32 iIndex = 0; | 4134 FX_INT32 iIndex = 0; |
| 4135 FX_INT32 u = 0; | 4135 FX_INT32 u = 0; |
| 4136 FX_LPCWSTR pData = wsXMLString; | 4136 FX_LPCWSTR pData = wsXMLString; |
| 4137 for (u = 0; u < iLength; ++u) { | 4137 for (u = 0; u < iLength; ++u) { |
| 4138 ch = *(pData + u); | 4138 ch = *(pData + u); |
| 4139 switch (ch) { | 4139 switch (ch) { |
| 4140 case '"': | 4140 case '"': |
| 4141 wsResultBuf.AppendChar('&'); | 4141 wsResultBuf.AppendChar('&'); |
| (...skipping 3034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7176 FXSYS_assert(pAppProvider); | 7176 FXSYS_assert(pAppProvider); |
| 7177 CFX_WideString wsFormat; | 7177 CFX_WideString wsFormat; |
| 7178 pAppProvider->LoadString(iStringID, wsFormat); | 7178 pAppProvider->LoadString(iStringID, wsFormat); |
| 7179 CFX_WideString wsMessage; | 7179 CFX_WideString wsMessage; |
| 7180 va_list arg_ptr; | 7180 va_list arg_ptr; |
| 7181 va_start(arg_ptr, iStringID); | 7181 va_start(arg_ptr, iStringID); |
| 7182 wsMessage.FormatV((FX_LPCWSTR)wsFormat, arg_ptr); | 7182 wsMessage.FormatV((FX_LPCWSTR)wsFormat, arg_ptr); |
| 7183 va_end(arg_ptr); | 7183 va_end(arg_ptr); |
| 7184 FXJSE_ThrowMessage(FX_BSTRC(""), FX_UTF8Encode(wsMessage, wsMessage.GetLengt
h())); | 7184 FXJSE_ThrowMessage(FX_BSTRC(""), FX_UTF8Encode(wsMessage, wsMessage.GetLengt
h())); |
| 7185 } | 7185 } |
| OLD | NEW |