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 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 return cbRet; | 1201 return cbRet; |
1202 } | 1202 } |
1203 | 1203 |
1204 CFX_WideString Document::CutString(CFX_WideString cbFrom) { | 1204 CFX_WideString Document::CutString(CFX_WideString cbFrom) { |
1205 size_t iLength = cbFrom.GetLength(); | 1205 size_t iLength = cbFrom.GetLength(); |
1206 pdfium::base::CheckedNumeric<size_t> iSize = sizeof(wchar_t); | 1206 pdfium::base::CheckedNumeric<size_t> iSize = sizeof(wchar_t); |
1207 iSize *= (iLength + 1); | 1207 iSize *= (iLength + 1); |
1208 wchar_t* pResult = (wchar_t*)malloc(iSize.ValueOrDie()); | 1208 wchar_t* pResult = (wchar_t*)malloc(iSize.ValueOrDie()); |
1209 wchar_t* pFrom = (wchar_t*)cbFrom.GetBuffer(iLength); | 1209 wchar_t* pFrom = (wchar_t*)cbFrom.GetBuffer(iLength); |
1210 | 1210 |
1211 for (int i = 0; i < iLength; i++) { | 1211 for (size_t i = 0; i < iLength; i++) { |
1212 if (pFrom[i] == L'\\' || pFrom[i] == L'/') { | 1212 if (pFrom[i] == L'\\' || pFrom[i] == L'/') { |
1213 pResult[i] = L'\0'; | 1213 pResult[i] = L'\0'; |
1214 break; | 1214 break; |
1215 } | 1215 } |
1216 pResult[i] = pFrom[i]; | 1216 pResult[i] = pFrom[i]; |
1217 } | 1217 } |
1218 pResult[iLength] = L'\0'; | 1218 pResult[iLength] = L'\0'; |
1219 | 1219 |
1220 cbFrom.ReleaseBuffer(); | 1220 cbFrom.ReleaseBuffer(); |
1221 CFX_WideString cbRet = CFX_WideString(pResult); | 1221 CFX_WideString cbRet = CFX_WideString(pResult); |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1926 CFX_DWordArray DelArray; | 1926 CFX_DWordArray DelArray; |
1927 | 1927 |
1928 for (int j = DelArray.GetSize() - 1; j >= 0; j--) { | 1928 for (int j = DelArray.GetSize() - 1; j >= 0; j--) { |
1929 m_DelayData.RemoveAt(DelArray[j]); | 1929 m_DelayData.RemoveAt(DelArray[j]); |
1930 } | 1930 } |
1931 } | 1931 } |
1932 | 1932 |
1933 CJS_Document* Document::GetCJSDoc() const { | 1933 CJS_Document* Document::GetCJSDoc() const { |
1934 return static_cast<CJS_Document*>(m_pJSObject); | 1934 return static_cast<CJS_Document*>(m_pJSObject); |
1935 } | 1935 } |
OLD | NEW |