OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "pdf/pdfium/pdfium_mem_buffer_file_write.h" | 5 #include "pdf/pdfium/pdfium_mem_buffer_file_write.h" |
6 | 6 |
7 namespace chrome_pdf { | 7 namespace chrome_pdf { |
8 | 8 |
9 PDFiumMemBufferFileWrite::PDFiumMemBufferFileWrite() { | 9 PDFiumMemBufferFileWrite::PDFiumMemBufferFileWrite() { |
10 version = 1; | 10 version = 1; |
11 WriteBlock = &WriteBlockImpl; | 11 WriteBlock = &WriteBlockImpl; |
12 } | 12 } |
13 | 13 |
14 PDFiumMemBufferFileWrite::~PDFiumMemBufferFileWrite() { | 14 PDFiumMemBufferFileWrite::~PDFiumMemBufferFileWrite() {} |
15 } | |
16 | 15 |
17 int PDFiumMemBufferFileWrite::WriteBlockImpl(FPDF_FILEWRITE* this_file_write, | 16 int PDFiumMemBufferFileWrite::WriteBlockImpl(FPDF_FILEWRITE* this_file_write, |
18 const void* data, | 17 const void* data, |
19 unsigned long size) { | 18 unsigned long size) { |
20 PDFiumMemBufferFileWrite* mem_buffer_file_write = | 19 PDFiumMemBufferFileWrite* mem_buffer_file_write = |
21 static_cast<PDFiumMemBufferFileWrite*>(this_file_write); | 20 static_cast<PDFiumMemBufferFileWrite*>(this_file_write); |
22 return mem_buffer_file_write->DoWriteBlock(data, size); | 21 return mem_buffer_file_write->DoWriteBlock(data, size); |
23 } | 22 } |
24 | 23 |
25 int PDFiumMemBufferFileWrite::DoWriteBlock(const void* data, | 24 int PDFiumMemBufferFileWrite::DoWriteBlock(const void* data, |
26 unsigned long size) { | 25 unsigned long size) { |
27 buffer_.append(static_cast<const unsigned char*>(data), size); | 26 buffer_.append(static_cast<const unsigned char*>(data), size); |
28 return 1; | 27 return 1; |
29 } | 28 } |
30 | 29 |
31 | |
32 } // namespace chrome_pdf | 30 } // namespace chrome_pdf |
33 | |
OLD | NEW |