1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "pdf/pdfium/pdfium_mem_buffer_file_read.h"
11 PDFiumMemBufferFileRead::PDFiumMemBufferFileRead(const void* data
,
15 m_GetBlock
= &GetBlock
;
16 data_
= reinterpret_cast<const unsigned char*>(data
);
19 PDFiumMemBufferFileRead::~PDFiumMemBufferFileRead() {
22 int PDFiumMemBufferFileRead::GetBlock(void* param
,
23 unsigned long position
,
26 const PDFiumMemBufferFileRead
* data
=
27 reinterpret_cast<const PDFiumMemBufferFileRead
*>(param
);
28 if (!data
|| position
+ size
> data
->m_FileLen
)
30 memcpy(buf
, data
->data_
+ position
, size
);
34 } // namespace chrome_pdf