| 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 "core/include/fxcrt/fx_basic.h" | 7 #include "core/include/fxcrt/fx_basic.h" |
| 8 | 8 |
| 9 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); | 9 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); |
| 10 CFX_BinaryBuf::CFX_BinaryBuf() | 10 CFX_BinaryBuf::CFX_BinaryBuf() |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 AppendBlock(buf.m_pBuffer, buf.m_DataSize); | 200 AppendBlock(buf.m_pBuffer, buf.m_DataSize); |
| 201 return *this; | 201 return *this; |
| 202 } | 202 } |
| 203 void CFX_WideTextBuf::operator=(const CFX_WideStringC& str) { | 203 void CFX_WideTextBuf::operator=(const CFX_WideStringC& str) { |
| 204 CopyData(str.GetPtr(), str.GetLength() * sizeof(FX_WCHAR)); | 204 CopyData(str.GetPtr(), str.GetLength() * sizeof(FX_WCHAR)); |
| 205 } | 205 } |
| 206 CFX_WideStringC CFX_WideTextBuf::GetWideString() const { | 206 CFX_WideStringC CFX_WideTextBuf::GetWideString() const { |
| 207 return CFX_WideStringC((const FX_WCHAR*)m_pBuffer, | 207 return CFX_WideStringC((const FX_WCHAR*)m_pBuffer, |
| 208 m_DataSize / sizeof(FX_WCHAR)); | 208 m_DataSize / sizeof(FX_WCHAR)); |
| 209 } | 209 } |
| 210 #ifdef PDF_ENABLE_XFA |
| 210 CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(uint8_t i) { | 211 CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(uint8_t i) { |
| 211 if (m_pStream) { | 212 if (m_pStream) { |
| 212 m_pStream->WriteBlock(&i, 1); | 213 m_pStream->WriteBlock(&i, 1); |
| 213 } else { | 214 } else { |
| 214 m_SavingBuf.AppendByte(i); | 215 m_SavingBuf.AppendByte(i); |
| 215 } | 216 } |
| 216 return *this; | 217 return *this; |
| 217 } | 218 } |
| 218 CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(int i) { | 219 CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(int i) { |
| 219 if (m_pStream) { | 220 if (m_pStream) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 return *this; | 324 return *this; |
| 324 } | 325 } |
| 325 FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize) { | 326 FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize) { |
| 326 if (m_LoadingPos + dwSize > m_LoadingSize) { | 327 if (m_LoadingPos + dwSize > m_LoadingSize) { |
| 327 return FALSE; | 328 return FALSE; |
| 328 } | 329 } |
| 329 FXSYS_memcpy(pBuf, m_pLoadingBuf + m_LoadingPos, dwSize); | 330 FXSYS_memcpy(pBuf, m_pLoadingBuf + m_LoadingPos, dwSize); |
| 330 m_LoadingPos += dwSize; | 331 m_LoadingPos += dwSize; |
| 331 return TRUE; | 332 return TRUE; |
| 332 } | 333 } |
| 334 #endif |
| 333 void CFX_BitStream::Init(const uint8_t* pData, FX_DWORD dwSize) { | 335 void CFX_BitStream::Init(const uint8_t* pData, FX_DWORD dwSize) { |
| 334 m_pData = pData; | 336 m_pData = pData; |
| 335 m_BitSize = dwSize * 8; | 337 m_BitSize = dwSize * 8; |
| 336 m_BitPos = 0; | 338 m_BitPos = 0; |
| 337 } | 339 } |
| 338 void CFX_BitStream::ByteAlign() { | 340 void CFX_BitStream::ByteAlign() { |
| 339 int mod = m_BitPos % 8; | 341 int mod = m_BitPos % 8; |
| 340 if (mod == 0) { | 342 if (mod == 0) { |
| 341 return; | 343 return; |
| 342 } | 344 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 } | 449 } |
| 448 FX_BOOL CFX_FileBufferArchive::DoWork(const void* pBuf, size_t size) { | 450 FX_BOOL CFX_FileBufferArchive::DoWork(const void* pBuf, size_t size) { |
| 449 if (!m_pFile) { | 451 if (!m_pFile) { |
| 450 return FALSE; | 452 return FALSE; |
| 451 } | 453 } |
| 452 if (!pBuf || size < 1) { | 454 if (!pBuf || size < 1) { |
| 453 return TRUE; | 455 return TRUE; |
| 454 } | 456 } |
| 455 return m_pFile->WriteBlock(pBuf, size); | 457 return m_pFile->WriteBlock(pBuf, size); |
| 456 } | 458 } |
| OLD | NEW |