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 |
210 #ifdef PDF_ENABLE_XFA | 211 #ifdef PDF_ENABLE_XFA |
211 CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(uint8_t i) { | 212 CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(uint8_t i) { |
212 if (m_pStream) { | 213 if (m_pStream) { |
213 m_pStream->WriteBlock(&i, 1); | 214 m_pStream->WriteBlock(&i, 1); |
214 } else { | 215 } else { |
215 m_SavingBuf.AppendByte(i); | 216 m_SavingBuf.AppendByte(i); |
216 } | 217 } |
217 return *this; | 218 return *this; |
218 } | 219 } |
219 CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(int i) { | 220 CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(int i) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 return *this; | 326 return *this; |
326 } | 327 } |
327 FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize) { | 328 FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize) { |
328 if (m_LoadingPos + dwSize > m_LoadingSize) { | 329 if (m_LoadingPos + dwSize > m_LoadingSize) { |
329 return FALSE; | 330 return FALSE; |
330 } | 331 } |
331 FXSYS_memcpy(pBuf, m_pLoadingBuf + m_LoadingPos, dwSize); | 332 FXSYS_memcpy(pBuf, m_pLoadingBuf + m_LoadingPos, dwSize); |
332 m_LoadingPos += dwSize; | 333 m_LoadingPos += dwSize; |
333 return TRUE; | 334 return TRUE; |
334 } | 335 } |
335 #endif | 336 #endif // PDF_ENABLE_XFA |
| 337 |
336 void CFX_BitStream::Init(const uint8_t* pData, FX_DWORD dwSize) { | 338 void CFX_BitStream::Init(const uint8_t* pData, FX_DWORD dwSize) { |
337 m_pData = pData; | 339 m_pData = pData; |
338 m_BitSize = dwSize * 8; | 340 m_BitSize = dwSize * 8; |
339 m_BitPos = 0; | 341 m_BitPos = 0; |
340 } | 342 } |
341 void CFX_BitStream::ByteAlign() { | 343 void CFX_BitStream::ByteAlign() { |
342 int mod = m_BitPos % 8; | 344 int mod = m_BitPos % 8; |
343 if (mod == 0) { | 345 if (mod == 0) { |
344 return; | 346 return; |
345 } | 347 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 } | 452 } |
451 FX_BOOL CFX_FileBufferArchive::DoWork(const void* pBuf, size_t size) { | 453 FX_BOOL CFX_FileBufferArchive::DoWork(const void* pBuf, size_t size) { |
452 if (!m_pFile) { | 454 if (!m_pFile) { |
453 return FALSE; | 455 return FALSE; |
454 } | 456 } |
455 if (!pBuf || size < 1) { | 457 if (!pBuf || size < 1) { |
456 return TRUE; | 458 return TRUE; |
457 } | 459 } |
458 return m_pFile->WriteBlock(pBuf, size); | 460 return m_pFile->WriteBlock(pBuf, size); |
459 } | 461 } |
OLD | NEW |