
See the bugs and cxx post for justification and details: https://groups.google.com/a/chromium.org/forum/#!topic/cxx/RkOHzIK6Tq8 This change was done using clang-tidy as described here: https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md In some cases the the tool leaves behind a string of commas where it replaced a member initializer list (https://bugs.llvm.org/show_bug.cgi?id=35051). They were cleaned up with: git diff --name-only | \ xargs sed -E -i 's/(^\s*|\)\s*):[ ,]*= default/\1 = default/' BUG=778959,778957 Change-Id: I0d5e3f40888d55b57aede103dad6345c1df99f7a Reviewed-on: https://chromium-review.googlesource.com/790011 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Chris Watkins <watk@chromium.org> Cr-Commit-Position: refs/heads/master@{#520422}
35 lines
1.1 KiB
C++
35 lines
1.1 KiB
C++
// Copyright (c) 2012 The Chromium 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 "pdf/pdfium/pdfium_mem_buffer_file_read.h"
|
|
|
|
#include <stddef.h>
|
|
#include <string.h>
|
|
|
|
namespace chrome_pdf {
|
|
|
|
PDFiumMemBufferFileRead::PDFiumMemBufferFileRead(const void* data,
|
|
size_t size) {
|
|
m_FileLen = size;
|
|
m_Param = this;
|
|
m_GetBlock = &GetBlock;
|
|
data_ = reinterpret_cast<const unsigned char*>(data);
|
|
}
|
|
|
|
PDFiumMemBufferFileRead::~PDFiumMemBufferFileRead() = default;
|
|
|
|
int PDFiumMemBufferFileRead::GetBlock(void* param,
|
|
unsigned long position,
|
|
unsigned char* buf,
|
|
unsigned long size) {
|
|
const PDFiumMemBufferFileRead* data =
|
|
reinterpret_cast<const PDFiumMemBufferFileRead*>(param);
|
|
if (!data || position + size > data->m_FileLen)
|
|
return 0;
|
|
memcpy(buf, data->data_ + position, size);
|
|
return 1;
|
|
}
|
|
|
|
} // namespace chrome_pdf
|