Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
cpdfsdk_customaccess.cpp
Go to the documentation of this file.
1
// Copyright 2018 The PDFium Authors
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7
#
include
"fpdfsdk/cpdfsdk_customaccess.h"
8
9
#
include
"core/fxcrt/fx_safe_types.h"
10
#
include
"core/fxcrt/numerics/safe_conversions.h"
11
12
CPDFSDK_CustomAccess::CPDFSDK_CustomAccess(FPDF_FILEACCESS* pFileAccess)
13
: m_FileAccess(*pFileAccess) {}
14
15
CPDFSDK_CustomAccess::~
CPDFSDK_CustomAccess
() =
default
;
16
17
FX_FILESIZE
CPDFSDK_CustomAccess::
GetSize
() {
18
return
m_FileAccess.m_FileLen;
19
}
20
21
bool
CPDFSDK_CustomAccess::
ReadBlockAtOffset
(pdfium::span<uint8_t> buffer,
22
FX_FILESIZE
offset) {
23
if
(buffer.empty() || offset < 0)
24
return
false
;
25
26
if
(!
pdfium
::IsValueInRangeForNumericType<
FX_FILESIZE
>(buffer.size())) {
27
return
false
;
28
}
29
30
FX_SAFE_FILESIZE
new_pos = buffer.size();
31
new_pos += offset;
32
return
new_pos.IsValid() && new_pos.ValueOrDie() <=
GetSize
(
)
&&
33
m_FileAccess.m_GetBlock(
34
m_FileAccess.m_Param,
pdfium
::checked_cast<
unsigned
long
>(offset),
35
buffer.data(),
pdfium
::checked_cast<
unsigned
long
>(buffer.size()));
36
}
CPDFSDK_CustomAccess::ReadBlockAtOffset
bool ReadBlockAtOffset(pdfium::span< uint8_t > buffer, FX_FILESIZE offset) override
Definition
cpdfsdk_customaccess.cpp:21
CPDFSDK_CustomAccess::GetSize
FX_FILESIZE GetSize() override
Definition
cpdfsdk_customaccess.cpp:17
CPDFSDK_CustomAccess::~CPDFSDK_CustomAccess
~CPDFSDK_CustomAccess() override
pdfium::CFDETextOutLargeBitmapTest
Definition
cfde_textout_unittest.cpp:117
FX_SAFE_FILESIZE
pdfium::CheckedNumeric< FX_FILESIZE > FX_SAFE_FILESIZE
Definition
fx_safe_types.h:17
FX_FILESIZE
#define FX_FILESIZE
Definition
fx_types.h:19
qtwebengine
src
3rdparty
chromium
third_party
pdfium
fpdfsdk
cpdfsdk_customaccess.cpp
Generated on
for Qt by
1.18.0