| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "core/fxcrt/include/fx_basic.h" | 10 #include "core/fxcrt/include/fx_basic.h" |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(FX_FLOAT& i) { | 283 CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(FX_FLOAT& i) { |
| 284 Read(&i, sizeof(FX_FLOAT)); | 284 Read(&i, sizeof(FX_FLOAT)); |
| 285 return *this; | 285 return *this; |
| 286 } | 286 } |
| 287 CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(CFX_ByteString& str) { | 287 CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(CFX_ByteString& str) { |
| 288 if (m_LoadingPos + 4 > m_LoadingSize) { | 288 if (m_LoadingPos + 4 > m_LoadingSize) { |
| 289 return *this; | 289 return *this; |
| 290 } | 290 } |
| 291 int len; | 291 int len; |
| 292 operator>>(len); | 292 operator>>(len); |
| 293 str.Empty(); | 293 str.clear(); |
| 294 if (len <= 0 || m_LoadingPos + len > m_LoadingSize) { | 294 if (len <= 0 || m_LoadingPos + len > m_LoadingSize) { |
| 295 return *this; | 295 return *this; |
| 296 } | 296 } |
| 297 FX_CHAR* buffer = str.GetBuffer(len); | 297 FX_CHAR* buffer = str.GetBuffer(len); |
| 298 FXSYS_memcpy(buffer, m_pLoadingBuf + m_LoadingPos, len); | 298 FXSYS_memcpy(buffer, m_pLoadingBuf + m_LoadingPos, len); |
| 299 str.ReleaseBuffer(len); | 299 str.ReleaseBuffer(len); |
| 300 m_LoadingPos += len; | 300 m_LoadingPos += len; |
| 301 return *this; | 301 return *this; |
| 302 } | 302 } |
| 303 CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(CFX_WideString& str) { | 303 CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(CFX_WideString& str) { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 } | 419 } |
| 420 | 420 |
| 421 int32_t CFX_FileBufferArchive::AppendString(const CFX_ByteStringC& lpsz) { | 421 int32_t CFX_FileBufferArchive::AppendString(const CFX_ByteStringC& lpsz) { |
| 422 return AppendBlock(lpsz.raw_str(), lpsz.GetLength()); | 422 return AppendBlock(lpsz.raw_str(), lpsz.GetLength()); |
| 423 } | 423 } |
| 424 | 424 |
| 425 void CFX_FileBufferArchive::AttachFile(IFX_StreamWrite* pFile) { | 425 void CFX_FileBufferArchive::AttachFile(IFX_StreamWrite* pFile) { |
| 426 FXSYS_assert(pFile); | 426 FXSYS_assert(pFile); |
| 427 m_pFile = pFile; | 427 m_pFile = pFile; |
| 428 } | 428 } |
| OLD | NEW |