| 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/fsdk_define.h" | 7 #include "../include/fsdk_define.h" |
| 8 #include "../include/fsdk_mgr.h" | 8 #include "../include/fsdk_mgr.h" |
| 9 #include "../include/fpdfview.h" | 9 #include "../include/fpdfview.h" |
| 10 #include "../include/fsdk_rendercontext.h" | 10 #include "../include/fsdk_rendercontext.h" |
| 11 #include "../include/fpdf_progressive.h" | 11 #include "../include/fpdf_progressive.h" |
| 12 #include "../include/fpdf_ext.h" | 12 #include "../include/fpdf_ext.h" |
| 13 #include "../../../core/src/fxcrt/fx_safe_types.h" | 13 #include "../../../core/src/fxcrt/fx_safe_types.h" |
| 14 #include "../../third_party/numerics/safe_conversions_impl.h" | 14 #include "../../third_party/base/numerics/safe_conversions_impl.h" |
| 15 #include "../include/fpdfformfill.h" | 15 #include "../include/fpdfformfill.h" |
| 16 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 16 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
| 17 #include "../include/fpdfxfa/fpdfxfa_app.h" | 17 #include "../include/fpdfxfa/fpdfxfa_app.h" |
| 18 #include "../include/fpdfxfa/fpdfxfa_page.h" | 18 #include "../include/fpdfxfa/fpdfxfa_page.h" |
| 19 #include "../include/fpdfxfa/fpdfxfa_util.h" | 19 #include "../include/fpdfxfa/fpdfxfa_util.h" |
| 20 | 20 |
| 21 CFPDF_FileStream::CFPDF_FileStream(FPDF_FILEHANDLER* pFS) | 21 CFPDF_FileStream::CFPDF_FileStream(FPDF_FILEHANDLER* pFS) |
| 22 { | 22 { |
| 23 m_pFS = pFS; | 23 m_pFS = pFS; |
| 24 m_nCurPos = 0; | 24 m_nCurPos = 0; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 { | 122 { |
| 123 if (pos + size > m_FileAccess.m_FileLen) return FALSE; | 123 if (pos + size > m_FileAccess.m_FileLen) return FALSE; |
| 124 return m_FileAccess.m_GetBlock(m_FileAccess.m_Param, pos, pBuf, size); | 124 return m_FileAccess.m_GetBlock(m_FileAccess.m_Param, pos, pBuf, size); |
| 125 } | 125 } |
| 126 | 126 |
| 127 FX_BOOL CPDF_CustomAccess::ReadBlock(void* buffer, FX_FILESIZE offset, size_t si
ze) | 127 FX_BOOL CPDF_CustomAccess::ReadBlock(void* buffer, FX_FILESIZE offset, size_t si
ze) |
| 128 { | 128 { |
| 129 if (offset < 0) { | 129 if (offset < 0) { |
| 130 return FALSE; | 130 return FALSE; |
| 131 } | 131 } |
| 132 FX_SAFE_FILESIZE newPos = base::checked_cast<FX_FILESIZE, size_t>(size); | 132 FX_SAFE_FILESIZE newPos = pdfium::base::checked_cast<FX_FILESIZE, size_t>(si
ze); |
| 133 newPos += offset; | 133 newPos += offset; |
| 134 if (!newPos.IsValid() || newPos.ValueOrDie() > m_FileAccess.m_FileLen) { | 134 if (!newPos.IsValid() || newPos.ValueOrDie() > m_FileAccess.m_FileLen) { |
| 135 return FALSE; | 135 return FALSE; |
| 136 } | 136 } |
| 137 return m_FileAccess.m_GetBlock(m_FileAccess.m_Param, offset,(FX_LPBYTE) buff
er, size); | 137 return m_FileAccess.m_GetBlock(m_FileAccess.m_Param, offset,(FX_LPBYTE) buff
er, size); |
| 138 } | 138 } |
| 139 | 139 |
| 140 //0 bit: FPDF_POLICY_MACHINETIME_ACCESS | 140 //0 bit: FPDF_POLICY_MACHINETIME_ACCESS |
| 141 static FX_DWORD foxit_sandbox_policy = 0xFFFFFFFF; | 141 static FX_DWORD foxit_sandbox_policy = 0xFFFFFFFF; |
| 142 | 142 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 public: | 322 public: |
| 323 CMemFile(FX_BYTE* pBuf, FX_FILESIZE size):m_pBuf(pBuf),m_size(size) {} | 323 CMemFile(FX_BYTE* pBuf, FX_FILESIZE size):m_pBuf(pBuf),m_size(size) {} |
| 324 | 324 |
| 325 virtual void Release() {delete this;} | 325 virtual void Release() {delete this;} |
| 326 virtual FX_FILESIZE GetSize() {return m_size;} | 326 virtual FX_FILESIZE GetSize() {return m_size;} |
| 327 virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offs
et, size_t size) | 327 virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offs
et, size_t size) |
| 328 { | 328 { |
| 329 if (offset < 0) { | 329 if (offset < 0) { |
| 330 return FALSE; | 330 return FALSE; |
| 331 } | 331 } |
| 332 FX_SAFE_FILESIZE newPos = base::checked_cast<FX_FILESIZE, size_t>(si
ze); | 332 FX_SAFE_FILESIZE newPos = pdfium::base::checked_cast<FX_FILESIZE, si
ze_t>(size); |
| 333 newPos += offset; | 333 newPos += offset; |
| 334 if (!newPos.IsValid() || newPos.ValueOrDie() > (FX_DWORD)m_size) { | 334 if (!newPos.IsValid() || newPos.ValueOrDie() > (FX_DWORD)m_size) { |
| 335 return FALSE; | 335 return FALSE; |
| 336 } | 336 } |
| 337 FXSYS_memcpy(buffer, m_pBuf+offset, size); | 337 FXSYS_memcpy(buffer, m_pBuf+offset, size); |
| 338 return TRUE; | 338 return TRUE; |
| 339 } | 339 } |
| 340 private: | 340 private: |
| 341 FX_BYTE* m_pBuf; | 341 FX_BYTE* m_pBuf; |
| 342 FX_FILESIZE m_size; | 342 FX_FILESIZE m_size; |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 if (!buffer) { | 1060 if (!buffer) { |
| 1061 buflen = len; | 1061 buflen = len; |
| 1062 } else if (buflen >= len) { | 1062 } else if (buflen >= len) { |
| 1063 memcpy(buffer, utf16Name.c_str(), len); | 1063 memcpy(buffer, utf16Name.c_str(), len); |
| 1064 buflen = len; | 1064 buflen = len; |
| 1065 } else { | 1065 } else { |
| 1066 buflen = -1; | 1066 buflen = -1; |
| 1067 } | 1067 } |
| 1068 return (FPDF_DEST)pDestObj; | 1068 return (FPDF_DEST)pDestObj; |
| 1069 } | 1069 } |
| OLD | NEW |