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 "../../include/javascript/JavaScript.h" | 7 #include "../../include/javascript/JavaScript.h" |
8 #include "../../include/javascript/IJavaScript.h" | 8 #include "../../include/javascript/IJavaScript.h" |
9 #include "../../include/javascript/JS_Define.h" | 9 #include "../../include/javascript/JS_Define.h" |
10 #include "../../include/javascript/JS_Object.h" | 10 #include "../../include/javascript/JS_Object.h" |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 436 |
437 | 437 |
438 int ch = ',' ; | 438 int ch = ',' ; |
439 int nIndex = 0; | 439 int nIndex = 0; |
440 | 440 |
441 while (*p) | 441 while (*p) |
442 { | 442 { |
443 const char * pTemp = strchr(p, ch); | 443 const char * pTemp = strchr(p, ch); |
444 if (pTemp == NULL) | 444 if (pTemp == NULL) |
445 { | 445 { |
446 » » » StrArray.SetElement(nIndex, CJS_Value(isolate,(FX_LPCSTR
)StrTrim(p))); | 446 » » » StrArray.SetElement(nIndex, CJS_Value(isolate, StrTrim(p
).c_str())); |
447 break; | 447 break; |
448 } | 448 } |
449 else | 449 else |
450 { | 450 { |
451 char * pSub = new char[pTemp - p + 1]; | 451 char * pSub = new char[pTemp - p + 1]; |
452 strncpy(pSub, p, pTemp - p); | 452 strncpy(pSub, p, pTemp - p); |
453 *(pSub + (pTemp - p)) = '\0'; | 453 *(pSub + (pTemp - p)) = '\0'; |
454 | 454 |
455 » » » StrArray.SetElement(nIndex, CJS_Value(isolate,(FX_LPCSTR
)StrTrim(pSub))); | 455 » » » StrArray.SetElement(nIndex, CJS_Value(isolate, StrTrim(p
Sub).c_str())); |
456 delete []pSub; | 456 delete []pSub; |
457 | 457 |
458 nIndex ++; | 458 nIndex ++; |
459 p = ++pTemp; | 459 p = ++pTemp; |
460 } | 460 } |
461 | 461 |
462 } | 462 } |
463 return StrArray; | 463 return StrArray; |
464 } | 464 } |
465 | 465 |
(...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1800 | 1800 |
1801 std::string cFormat; | 1801 std::string cFormat; |
1802 int iIndex = params[0]; | 1802 int iIndex = params[0]; |
1803 | 1803 |
1804 CJS_EventHandler* pEvent = pContext->GetEventHandler(); | 1804 CJS_EventHandler* pEvent = pContext->GetEventHandler(); |
1805 ASSERT(pEvent != NULL); | 1805 ASSERT(pEvent != NULL); |
1806 | 1806 |
1807 if(!pEvent->m_pValue) | 1807 if(!pEvent->m_pValue) |
1808 return FALSE; | 1808 return FALSE; |
1809 CFX_WideString& Value = pEvent->Value(); | 1809 CFX_WideString& Value = pEvent->Value(); |
1810 » std::string strSrc = (FX_LPCSTR)CFX_ByteString::FromUnicode(Value); | 1810 » std::string strSrc = CFX_ByteString::FromUnicode(Value).c_str(); |
1811 | 1811 |
1812 switch (iIndex) | 1812 switch (iIndex) |
1813 { | 1813 { |
1814 case 0: | 1814 case 0: |
1815 cFormat = "99999"; | 1815 cFormat = "99999"; |
1816 break; | 1816 break; |
1817 case 1: | 1817 case 1: |
1818 cFormat = "99999-9999"; | 1818 cFormat = "99999-9999"; |
1819 break; | 1819 break; |
1820 case 2: | 1820 case 2: |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1955 return FALSE; | 1955 return FALSE; |
1956 } | 1956 } |
1957 | 1957 |
1958 std::string cFormat; | 1958 std::string cFormat; |
1959 int iIndex = (int)params[0]; | 1959 int iIndex = (int)params[0]; |
1960 | 1960 |
1961 if(!pEvent->m_pValue) | 1961 if(!pEvent->m_pValue) |
1962 return FALSE; | 1962 return FALSE; |
1963 //CJS_Value val = pEvent->Value(); | 1963 //CJS_Value val = pEvent->Value(); |
1964 CFX_WideString& val = pEvent->Value(); | 1964 CFX_WideString& val = pEvent->Value(); |
1965 » std::string strSrc = (FX_LPCSTR)CFX_ByteString::FromUnicode(val); | 1965 » std::string strSrc = CFX_ByteString::FromUnicode(val).c_str(); |
1966 std::wstring wstrChange(pEvent->Change()); | 1966 std::wstring wstrChange(pEvent->Change()); |
1967 | 1967 |
1968 switch (iIndex) | 1968 switch (iIndex) |
1969 { | 1969 { |
1970 case 0: | 1970 case 0: |
1971 cFormat = "99999"; | 1971 cFormat = "99999"; |
1972 break; | 1972 break; |
1973 case 1: | 1973 case 1: |
1974 //cFormat = "99999-9999"; | 1974 //cFormat = "99999-9999"; |
1975 cFormat = "999999999"; | 1975 cFormat = "999999999"; |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2316 nums.SetElement(nIndex,CJS_Value(isolate,sPart.c_str())); | 2316 nums.SetElement(nIndex,CJS_Value(isolate,sPart.c_str())); |
2317 } | 2317 } |
2318 | 2318 |
2319 if (nums.GetLength() > 0) | 2319 if (nums.GetLength() > 0) |
2320 vRet = nums; | 2320 vRet = nums; |
2321 else | 2321 else |
2322 vRet.SetNull(); | 2322 vRet.SetNull(); |
2323 | 2323 |
2324 return TRUE; | 2324 return TRUE; |
2325 } | 2325 } |
OLD | NEW |