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 "public/fpdfview.h" | 7 #include "public/fpdfview.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 FX_BOOL CPDF_CustomAccess::ReadBlock(void* buffer, | 188 FX_BOOL CPDF_CustomAccess::ReadBlock(void* buffer, |
189 FX_FILESIZE offset, | 189 FX_FILESIZE offset, |
190 size_t size) { | 190 size_t size) { |
191 if (offset < 0) { | 191 if (offset < 0) { |
192 return FALSE; | 192 return FALSE; |
193 } | 193 } |
194 FX_SAFE_FILESIZE newPos = | 194 FX_SAFE_FILESIZE newPos = |
195 pdfium::base::checked_cast<FX_FILESIZE, size_t>(size); | 195 pdfium::base::checked_cast<FX_FILESIZE, size_t>(size); |
196 newPos += offset; | 196 newPos += offset; |
197 if (!newPos.IsValid() || newPos.ValueOrDie() > m_FileAccess.m_FileLen) { | 197 if (!newPos.IsValid() || |
| 198 newPos.ValueOrDie() > static_cast<FX_FILESIZE>(m_FileAccess.m_FileLen)) { |
198 return FALSE; | 199 return FALSE; |
199 } | 200 } |
200 return m_FileAccess.m_GetBlock(m_FileAccess.m_Param, offset, (uint8_t*)buffer, | 201 return m_FileAccess.m_GetBlock(m_FileAccess.m_Param, offset, (uint8_t*)buffer, |
201 size); | 202 size); |
202 } | 203 } |
203 | 204 |
204 // 0 bit: FPDF_POLICY_MACHINETIME_ACCESS | 205 // 0 bit: FPDF_POLICY_MACHINETIME_ACCESS |
205 static uint32_t foxit_sandbox_policy = 0xFFFFFFFF; | 206 static uint32_t foxit_sandbox_policy = 0xFFFFFFFF; |
206 | 207 |
207 void FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable) { | 208 void FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable) { |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 if (!buffer) { | 1159 if (!buffer) { |
1159 *buflen = len; | 1160 *buflen = len; |
1160 } else if (*buflen >= len) { | 1161 } else if (*buflen >= len) { |
1161 memcpy(buffer, utf16Name.c_str(), len); | 1162 memcpy(buffer, utf16Name.c_str(), len); |
1162 *buflen = len; | 1163 *buflen = len; |
1163 } else { | 1164 } else { |
1164 *buflen = -1; | 1165 *buflen = -1; |
1165 } | 1166 } |
1166 return (FPDF_DEST)pDestObj; | 1167 return (FPDF_DEST)pDestObj; |
1167 } | 1168 } |
OLD | NEW |