Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
[pdfium.git] / xfa_test / pdf / pdfium / pdfium_mem_buffer_file_write.cc
1 // Copyright (c) 2010 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_write.h"
6
7 namespace chrome_pdf {
8
9 PDFiumMemBufferFileWrite::PDFiumMemBufferFileWrite() {
10   version = 1;
11   WriteBlock = &WriteBlockImpl;
12 }
13
14 PDFiumMemBufferFileWrite::~PDFiumMemBufferFileWrite() {
15 }
16
17 int PDFiumMemBufferFileWrite::WriteBlockImpl(FPDF_FILEWRITE* this_file_write,
18                                              const void* data,
19                                              unsigned long size) {
20   PDFiumMemBufferFileWrite* mem_buffer_file_write =
21       static_cast<PDFiumMemBufferFileWrite*>(this_file_write);
22   return mem_buffer_file_write->DoWriteBlock(data, size);
23 }
24
25 int PDFiumMemBufferFileWrite::DoWriteBlock(const void* data,
26                                            unsigned long size) {
27   buffer_.append(static_cast<const unsigned char*>(data), size);
28   return 1;
29 }
30
31
32 }  // namespace chrome_pdf
33