| 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 "fpdfsdk/javascript/PublicMethods.h" | 7 #include "fpdfsdk/javascript/PublicMethods.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1495 pEvent->Rc() = FALSE; | 1495 pEvent->Rc() = FALSE; |
| 1496 } | 1496 } |
| 1497 return TRUE; | 1497 return TRUE; |
| 1498 } | 1498 } |
| 1499 | 1499 |
| 1500 CFX_WideString& wideChange = pEvent->Change(); | 1500 CFX_WideString& wideChange = pEvent->Change(); |
| 1501 std::wstring wChange = wideChange.c_str(); | 1501 std::wstring wChange = wideChange.c_str(); |
| 1502 if (wChange.empty()) | 1502 if (wChange.empty()) |
| 1503 return TRUE; | 1503 return TRUE; |
| 1504 | 1504 |
| 1505 int iIndexMask = pEvent->SelStart(); | 1505 size_t iIndexMask = pEvent->SelStart(); |
| 1506 | 1506 |
| 1507 size_t combined_len = wstrValue.length() + wChange.length() - | 1507 size_t combined_len = wstrValue.length() + wChange.length() - |
| 1508 (pEvent->SelEnd() - pEvent->SelStart()); | 1508 (pEvent->SelEnd() - pEvent->SelStart()); |
| 1509 if (combined_len > wstrMaskLen) { | 1509 if (combined_len > wstrMaskLen) { |
| 1510 Alert(pContext, | 1510 Alert(pContext, |
| 1511 JSGetStringFromID(pContext, IDS_STRING_JSPARAM_TOOLONG).c_str()); | 1511 JSGetStringFromID(pContext, IDS_STRING_JSPARAM_TOOLONG).c_str()); |
| 1512 pEvent->Rc() = FALSE; | 1512 pEvent->Rc() = FALSE; |
| 1513 return TRUE; | 1513 return TRUE; |
| 1514 } | 1514 } |
| 1515 | 1515 |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1875 nums.SetElement(nIndex, CJS_Value(pRuntime, sPart.c_str())); | 1875 nums.SetElement(nIndex, CJS_Value(pRuntime, sPart.c_str())); |
| 1876 } | 1876 } |
| 1877 | 1877 |
| 1878 if (nums.GetLength() > 0) | 1878 if (nums.GetLength() > 0) |
| 1879 vRet = nums; | 1879 vRet = nums; |
| 1880 else | 1880 else |
| 1881 vRet.SetNull(); | 1881 vRet.SetNull(); |
| 1882 | 1882 |
| 1883 return TRUE; | 1883 return TRUE; |
| 1884 } | 1884 } |
| OLD | NEW |