Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cfx_read_only_span_stream.cpp
Go to the documentation of this file.
1
// Copyright 2022 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
"core/fxcrt/cfx_read_only_span_stream.h"
8
9
#
include
"core/fxcrt/fx_safe_types.h"
10
#
include
"core/fxcrt/span_util.h"
11
#
include
"third_party/base/numerics/safe_conversions.h"
12
13
CFX_ReadOnlySpanStream::CFX_ReadOnlySpanStream(pdfium::span<
const
uint8_t> span)
14
: span_(span) {}
15
16
CFX_ReadOnlySpanStream::~
CFX_ReadOnlySpanStream
() =
default
;
17
18
FX_FILESIZE
CFX_ReadOnlySpanStream::
GetSize
() {
19
return
pdfium::base::checked_cast<
FX_FILESIZE
>(span_.size());
20
}
21
22
bool
CFX_ReadOnlySpanStream::
ReadBlockAtOffset
(pdfium::span<uint8_t> buffer,
23
FX_FILESIZE
offset) {
24
if
(buffer.empty() || offset < 0)
25
return
false
;
26
27
FX_SAFE_SIZE_T pos = buffer.size();
28
pos += offset;
29
if
(!pos.IsValid() || pos.ValueOrDie() > span_.size())
30
return
false
;
31
32
fxcrt::spancpy(
33
buffer,
34
span_.subspan(pdfium::base::checked_cast<size_t>(offset), buffer.size()));
35
return
true
;
36
}
CFX_ReadOnlySpanStream::ReadBlockAtOffset
bool ReadBlockAtOffset(pdfium::span< uint8_t > buffer, FX_FILESIZE offset) override
Definition
cfx_read_only_span_stream.cpp:22
CFX_ReadOnlySpanStream::GetSize
FX_FILESIZE GetSize() override
Definition
cfx_read_only_span_stream.cpp:18
CFX_ReadOnlySpanStream::~CFX_ReadOnlySpanStream
~CFX_ReadOnlySpanStream() override
FX_FILESIZE
#define FX_FILESIZE
Definition
fx_types.h:19
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fxcrt
cfx_read_only_span_stream.cpp
Generated on Thu Nov 14 2024 00:58:18 for Qt by
1.12.0