Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(700)

Side by Side Diff: pdf/pdfium/pdfium_mem_buffer_file_read.cc

Issue 294793003: Add the pdf plugin's source in src\pdf. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: review comments Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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.
4
5 #include "pdf/pdfium/pdfium_mem_buffer_file_read.h"
6
7 #include <string.h>
8
9 namespace chrome_pdf {
10
11 PDFiumMemBufferFileRead::PDFiumMemBufferFileRead(const void* data,
12 size_t size) {
13 m_FileLen = size;
14 m_Param = this;
15 m_GetBlock = &GetBlock;
16 data_ = reinterpret_cast<const unsigned char*>(data);
17 }
18
19 PDFiumMemBufferFileRead::~PDFiumMemBufferFileRead() {
20 }
21
22 int PDFiumMemBufferFileRead::GetBlock(void* param,
23 unsigned long position,
24 unsigned char* buf,
25 unsigned long size) {
26 const PDFiumMemBufferFileRead* data =
27 reinterpret_cast<const PDFiumMemBufferFileRead*>(param);
28 if (!data || position + size > data->m_FileLen)
29 return 0;
30 memcpy(buf, data->data_ + position, size);
31 return 1;
32 }
33
34 } // namespace chrome_pdf
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698