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 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1547 dDate = MakeInterDate(strValue); | 1547 dDate = MakeInterDate(strValue); |
1548 } | 1548 } |
1549 else | 1549 else |
1550 { | 1550 { |
1551 dDate = MakeRegularDate(strValue,sFormat,bWrongFormat); | 1551 dDate = MakeRegularDate(strValue,sFormat,bWrongFormat); |
1552 } | 1552 } |
1553 | 1553 |
1554 if (JS_PortIsNan(dDate)) | 1554 if (JS_PortIsNan(dDate)) |
1555 { | 1555 { |
1556 CFX_WideString swMsg; | 1556 CFX_WideString swMsg; |
1557 » » swMsg.Format(JSGetStringFromID(pContext, IDS_STRING_JSPARSEDATE)
, (FX_LPCWSTR)sFormat); | 1557 » » swMsg.Format(JSGetStringFromID(pContext, IDS_STRING_JSPARSEDATE)
, sFormat.c_str()); |
1558 Alert(pContext, swMsg); | 1558 Alert(pContext, swMsg); |
1559 return FALSE; | 1559 return FALSE; |
1560 } | 1560 } |
1561 | 1561 |
1562 val = MakeFormatDate(dDate,sFormat); | 1562 val = MakeFormatDate(dDate,sFormat); |
1563 | 1563 |
1564 return TRUE; | 1564 return TRUE; |
1565 } | 1565 } |
1566 | 1566 |
1567 double CJS_PublicMethods::MakeInterDate(CFX_WideString strValue) | 1567 double CJS_PublicMethods::MakeInterDate(CFX_WideString strValue) |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1645 CFX_WideString strValue = pEvent->Value(); | 1645 CFX_WideString strValue = pEvent->Value(); |
1646 if (strValue.IsEmpty()) return TRUE; | 1646 if (strValue.IsEmpty()) return TRUE; |
1647 | 1647 |
1648 CFX_WideString sFormat = params[0].operator CFX_WideString(); | 1648 CFX_WideString sFormat = params[0].operator CFX_WideString(); |
1649 | 1649 |
1650 FX_BOOL bWrongFormat = FALSE; | 1650 FX_BOOL bWrongFormat = FALSE; |
1651 double dRet = MakeRegularDate(strValue,sFormat,bWrongFormat); | 1651 double dRet = MakeRegularDate(strValue,sFormat,bWrongFormat); |
1652 if (bWrongFormat || JS_PortIsNan(dRet)) | 1652 if (bWrongFormat || JS_PortIsNan(dRet)) |
1653 { | 1653 { |
1654 CFX_WideString swMsg; | 1654 CFX_WideString swMsg; |
1655 » » » swMsg.Format(JSGetStringFromID(pContext, IDS_STRING_JSPA
RSEDATE), (FX_LPCWSTR)sFormat); | 1655 » » » swMsg.Format(JSGetStringFromID(pContext, IDS_STRING_JSPA
RSEDATE), sFormat.c_str()); |
1656 Alert(pContext, swMsg); | 1656 Alert(pContext, swMsg); |
1657 pEvent->Rc() = FALSE; | 1657 pEvent->Rc() = FALSE; |
1658 return TRUE; | 1658 return TRUE; |
1659 } | 1659 } |
1660 } | 1660 } |
1661 return TRUE; | 1661 return TRUE; |
1662 } | 1662 } |
1663 | 1663 |
1664 FX_BOOL CJS_PublicMethods::AFDate_Format(OBJ_METHOD_PARAMS) | 1664 FX_BOOL CJS_PublicMethods::AFDate_Format(OBJ_METHOD_PARAMS) |
1665 { | 1665 { |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2052 | 2052 |
2053 CFX_WideString sValue = params[0].operator CFX_WideString(); | 2053 CFX_WideString sValue = params[0].operator CFX_WideString(); |
2054 CFX_WideString sFormat = params[1].operator CFX_WideString(); | 2054 CFX_WideString sFormat = params[1].operator CFX_WideString(); |
2055 | 2055 |
2056 FX_BOOL bWrongFormat = FALSE; | 2056 FX_BOOL bWrongFormat = FALSE; |
2057 double dDate = MakeRegularDate(sValue,sFormat,bWrongFormat); | 2057 double dDate = MakeRegularDate(sValue,sFormat,bWrongFormat); |
2058 | 2058 |
2059 if (JS_PortIsNan(dDate)) | 2059 if (JS_PortIsNan(dDate)) |
2060 { | 2060 { |
2061 CFX_WideString swMsg; | 2061 CFX_WideString swMsg; |
2062 » » swMsg.Format(JSGetStringFromID(pContext, IDS_STRING_JSPARSEDATE)
, (FX_LPCWSTR)sFormat); | 2062 » » swMsg.Format(JSGetStringFromID(pContext, IDS_STRING_JSPARSEDATE)
, sFormat.c_str()); |
2063 Alert((CJS_Context *)cc, swMsg); | 2063 Alert((CJS_Context *)cc, swMsg); |
2064 return FALSE; | 2064 return FALSE; |
2065 } | 2065 } |
2066 | 2066 |
2067 vRet = dDate; | 2067 vRet = dDate; |
2068 | 2068 |
2069 return TRUE; | 2069 return TRUE; |
2070 } | 2070 } |
2071 | 2071 |
2072 FX_BOOL CJS_PublicMethods::AFSimple(OBJ_METHOD_PARAMS) | 2072 FX_BOOL CJS_PublicMethods::AFSimple(OBJ_METHOD_PARAMS) |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2297 { | 2297 { |
2298 FX_WCHAR wc = str.GetAt(i); | 2298 FX_WCHAR wc = str.GetAt(i); |
2299 if (IsDigit((wchar_t)wc)) | 2299 if (IsDigit((wchar_t)wc)) |
2300 { | 2300 { |
2301 sPart += wc; | 2301 sPart += wc; |
2302 } | 2302 } |
2303 else | 2303 else |
2304 { | 2304 { |
2305 if (sPart.GetLength() > 0) | 2305 if (sPart.GetLength() > 0) |
2306 { | 2306 { |
2307 » » » » nums.SetElement(nIndex,CJS_Value(isolate,(FX_LPC
WSTR)sPart)); | 2307 » » » » nums.SetElement(nIndex,CJS_Value(isolate,sPart.c
_str())); |
2308 sPart = L""; | 2308 sPart = L""; |
2309 nIndex ++; | 2309 nIndex ++; |
2310 } | 2310 } |
2311 } | 2311 } |
2312 } | 2312 } |
2313 | 2313 |
2314 if (sPart.GetLength() > 0) | 2314 if (sPart.GetLength() > 0) |
2315 { | 2315 { |
2316 » » nums.SetElement(nIndex,CJS_Value(isolate,(FX_LPCWSTR)sPart));» | 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 |