mirror of
https://pdfium.googlesource.com/pdfium
synced 2026-08-02 20:37:52 +08:00
Split part of logging.h into check.h and notreached.h, just like in Chromium. Change many files that directly call CHECK()/DCHECK()/NOTREACHED(), but not other logging.h macros, to include check.h and/or notreached.h instead. Bug: pdfium:1594 Change-Id: Ide80bd66257f5f267863c36ad0268bbb63225742 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/74275 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
27 lines
733 B
C++
27 lines
733 B
C++
// Copyright 2019 PDFium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "testing/test_loader.h"
|
|
|
|
#include <string.h>
|
|
|
|
#include "third_party/base/notreached.h"
|
|
|
|
TestLoader::TestLoader(pdfium::span<const char> span) : m_Span(span) {}
|
|
|
|
// static
|
|
int TestLoader::GetBlock(void* param,
|
|
unsigned long pos,
|
|
unsigned char* pBuf,
|
|
unsigned long size) {
|
|
TestLoader* pLoader = static_cast<TestLoader*>(param);
|
|
if (pos + size < pos || pos + size > pLoader->m_Span.size()) {
|
|
NOTREACHED();
|
|
return 0;
|
|
}
|
|
|
|
memcpy(pBuf, &pLoader->m_Span[pos], size);
|
|
return 1;
|
|
}
|