| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "../../include/fxcrt/fx_basic.h" | 7 #include "../../include/fxcrt/fx_basic.h" |
| 8 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); | 8 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); |
| 9 CFX_BinaryBuf::CFX_BinaryBuf() | 9 CFX_BinaryBuf::CFX_BinaryBuf() |
| 10 : m_AllocStep(0), m_pBuffer(NULL), m_DataSize(0), m_AllocSize(0) {} | 10 : m_AllocStep(0), m_pBuffer(NULL), m_DataSize(0), m_AllocSize(0) {} |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 if (!pFile) { | 320 if (!pFile) { |
| 321 return FALSE; | 321 return FALSE; |
| 322 } | 322 } |
| 323 if (m_pFile && m_bTakeover) { | 323 if (m_pFile && m_bTakeover) { |
| 324 m_pFile->Release(); | 324 m_pFile->Release(); |
| 325 } | 325 } |
| 326 m_pFile = pFile; | 326 m_pFile = pFile; |
| 327 m_bTakeover = bTakeover; | 327 m_bTakeover = bTakeover; |
| 328 return TRUE; | 328 return TRUE; |
| 329 } | 329 } |
| 330 FX_BOOL CFX_FileBufferArchive::AttachFile(const FX_WCHAR* filename) { | |
| 331 if (!filename) { | |
| 332 return FALSE; | |
| 333 } | |
| 334 if (m_pFile && m_bTakeover) { | |
| 335 m_pFile->Release(); | |
| 336 } | |
| 337 m_pFile = FX_CreateFileWrite(filename); | |
| 338 if (!m_pFile) { | |
| 339 return FALSE; | |
| 340 } | |
| 341 m_bTakeover = TRUE; | |
| 342 return TRUE; | |
| 343 } | |
| 344 FX_BOOL CFX_FileBufferArchive::AttachFile(const FX_CHAR* filename) { | |
| 345 if (!filename) { | |
| 346 return FALSE; | |
| 347 } | |
| 348 if (m_pFile && m_bTakeover) { | |
| 349 m_pFile->Release(); | |
| 350 } | |
| 351 m_pFile = FX_CreateFileWrite(filename); | |
| 352 if (!m_pFile) { | |
| 353 return FALSE; | |
| 354 } | |
| 355 m_bTakeover = TRUE; | |
| 356 return TRUE; | |
| 357 } | |
| 358 FX_BOOL CFX_FileBufferArchive::DoWork(const void* pBuf, size_t size) { | 330 FX_BOOL CFX_FileBufferArchive::DoWork(const void* pBuf, size_t size) { |
| 359 if (!m_pFile) { | 331 if (!m_pFile) { |
| 360 return FALSE; | 332 return FALSE; |
| 361 } | 333 } |
| 362 if (!pBuf || size < 1) { | 334 if (!pBuf || size < 1) { |
| 363 return TRUE; | 335 return TRUE; |
| 364 } | 336 } |
| 365 return m_pFile->WriteBlock(pBuf, size); | 337 return m_pFile->WriteBlock(pBuf, size); |
| 366 } | 338 } |
| OLD | NEW |