Dan Sinclair | ae4656e | 2017-05-09 12:36:41 -0400 | [diff] [blame] | 1 | // Copyright 2017 PDFium 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 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
| 7 | #include "fpdfsdk/fsdk_filewriteadapter.h" |
| 8 | |
| 9 | FSDK_FileWriteAdapter::FSDK_FileWriteAdapter(FPDF_FILEWRITE* fileWriteStruct) |
| 10 | : fileWriteStruct_(fileWriteStruct) { |
| 11 | ASSERT(fileWriteStruct_); |
| 12 | } |
| 13 | |
| 14 | FSDK_FileWriteAdapter::~FSDK_FileWriteAdapter() {} |
| 15 | |
| 16 | bool FSDK_FileWriteAdapter::WriteBlock(const void* data, size_t size) { |
| 17 | return fileWriteStruct_->WriteBlock(fileWriteStruct_, data, size) != 0; |
| 18 | } |
dan sinclair | 017ebba | 2017-05-12 09:18:06 -0400 | [diff] [blame] | 19 | |
| 20 | bool FSDK_FileWriteAdapter::WriteString(const CFX_ByteStringC& str) { |
Tom Sepez | 33b42e4 | 2017-07-19 13:19:12 -0700 | [diff] [blame^] | 21 | return WriteBlock(str.unterminated_c_str(), str.GetLength()); |
dan sinclair | 017ebba | 2017-05-12 09:18:06 -0400 | [diff] [blame] | 22 | } |