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 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 return cbRet; | 1194 return cbRet; |
1195 } | 1195 } |
1196 | 1196 |
1197 CFX_WideString Document::CutString(CFX_WideString cbFrom) { | 1197 CFX_WideString Document::CutString(CFX_WideString cbFrom) { |
1198 size_t iLength = cbFrom.GetLength(); | 1198 size_t iLength = cbFrom.GetLength(); |
1199 pdfium::base::CheckedNumeric<size_t> iSize = sizeof(wchar_t); | 1199 pdfium::base::CheckedNumeric<size_t> iSize = sizeof(wchar_t); |
1200 iSize *= (iLength + 1); | 1200 iSize *= (iLength + 1); |
1201 wchar_t* pResult = (wchar_t*)malloc(iSize.ValueOrDie()); | 1201 wchar_t* pResult = (wchar_t*)malloc(iSize.ValueOrDie()); |
1202 wchar_t* pFrom = (wchar_t*)cbFrom.GetBuffer(iLength); | 1202 wchar_t* pFrom = (wchar_t*)cbFrom.GetBuffer(iLength); |
1203 | 1203 |
1204 for (int i = 0; i < iLength; i++) { | 1204 for (size_t i = 0; i < iLength; i++) { |
1205 if (pFrom[i] == L'\\' || pFrom[i] == L'/') { | 1205 if (pFrom[i] == L'\\' || pFrom[i] == L'/') { |
1206 pResult[i] = L'\0'; | 1206 pResult[i] = L'\0'; |
1207 break; | 1207 break; |
1208 } | 1208 } |
1209 pResult[i] = pFrom[i]; | 1209 pResult[i] = pFrom[i]; |
1210 } | 1210 } |
1211 pResult[iLength] = L'\0'; | 1211 pResult[iLength] = L'\0'; |
1212 | 1212 |
1213 cbFrom.ReleaseBuffer(); | 1213 cbFrom.ReleaseBuffer(); |
1214 CFX_WideString cbRet = CFX_WideString(pResult); | 1214 CFX_WideString cbRet = CFX_WideString(pResult); |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1844 CFX_DWordArray DelArray; | 1844 CFX_DWordArray DelArray; |
1845 | 1845 |
1846 for (int j = DelArray.GetSize() - 1; j >= 0; j--) { | 1846 for (int j = DelArray.GetSize() - 1; j >= 0; j--) { |
1847 m_DelayData.RemoveAt(DelArray[j]); | 1847 m_DelayData.RemoveAt(DelArray[j]); |
1848 } | 1848 } |
1849 } | 1849 } |
1850 | 1850 |
1851 CJS_Document* Document::GetCJSDoc() const { | 1851 CJS_Document* Document::GetCJSDoc() const { |
1852 return static_cast<CJS_Document*>(m_pJSObject); | 1852 return static_cast<CJS_Document*>(m_pJSObject); |
1853 } | 1853 } |
OLD | NEW |