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
test_loader.cpp
Go to the documentation of this file.
1// Copyright 2019 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#include "testing/test_loader.h"
6
7#include <string.h>
8
9#include "third_party/base/check_op.h"
10#include "third_party/base/numerics/checked_math.h"
11
12TestLoader::TestLoader(pdfium::span<const uint8_t> span) : m_Span(span) {}
13
14// static
15int TestLoader::GetBlock(void* param,
16 unsigned long pos,
17 unsigned char* pBuf,
18 unsigned long size) {
19 TestLoader* pLoader = static_cast<TestLoader*>(param);
20 pdfium::base::CheckedNumeric<size_t> end = pos;
21 end += size;
22 CHECK_LE(end.ValueOrDie(), pLoader->m_Span.size());
23
24 memcpy(pBuf, &pLoader->m_Span[pos], size);
25 return 1;
26}
TestLoader(pdfium::span< const uint8_t > span)
static int GetBlock(void *param, unsigned long pos, unsigned char *pBuf, unsigned long size)