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 <stddef.h>
8
9#include "core/fxcrt/check_op.h"
10#include "core/fxcrt/fx_memcpy_wrappers.h"
11#include "core/fxcrt/numerics/checked_math.h"
12
13TestLoader::TestLoader(pdfium::span<const uint8_t> span) : m_Span(span) {}
14
15// static
16int TestLoader::GetBlock(void* param,
17 unsigned long pos,
18 unsigned char* pBuf,
19 unsigned long size) {
20 TestLoader* pLoader = static_cast<TestLoader*>(param);
21 pdfium::CheckedNumeric<size_t> end = pos;
22 end += size;
23 CHECK_LE(end.ValueOrDie(), pLoader->m_Span.size());
24
25 FXSYS_memcpy(pBuf, &pLoader->m_Span[pos], size);
26 return 1;
27}
#define CHECK_LE(x, y)
Definition check_op.h:14
TestLoader(pdfium::span< const uint8_t > span)
static int GetBlock(void *param, unsigned long pos, unsigned char *pBuf, unsigned long size)