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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 FXSYS_memmove(m_pBuffer.get() + pos + size, m_pBuffer.get() + pos, | 93 FXSYS_memmove(m_pBuffer.get() + pos + size, m_pBuffer.get() + pos, |
94 m_DataSize - pos); | 94 m_DataSize - pos); |
95 if (pBuf) { | 95 if (pBuf) { |
96 FXSYS_memcpy(m_pBuffer.get() + pos, pBuf, size); | 96 FXSYS_memcpy(m_pBuffer.get() + pos, pBuf, size); |
97 } else { | 97 } else { |
98 FXSYS_memset(m_pBuffer.get() + pos, 0, size); | 98 FXSYS_memset(m_pBuffer.get() + pos, 0, size); |
99 } | 99 } |
100 m_DataSize += size; | 100 m_DataSize += size; |
101 } | 101 } |
102 | 102 |
103 CFX_ByteStringC CFX_ByteTextBuf::AsStringC() const { | |
104 return CFX_ByteStringC(m_pBuffer.get(), m_DataSize); | |
105 } | |
106 | |
107 CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(const CFX_ByteStringC& lpsz) { | 103 CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(const CFX_ByteStringC& lpsz) { |
108 AppendBlock(lpsz.raw_str(), lpsz.GetLength()); | 104 AppendBlock(lpsz.raw_str(), lpsz.GetLength()); |
109 return *this; | 105 return *this; |
110 } | 106 } |
111 | 107 |
112 CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(int i) { | 108 CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(int i) { |
113 char buf[32]; | 109 char buf[32]; |
114 FXSYS_itoa(i, buf, 10); | 110 FXSYS_itoa(i, buf, 10); |
115 AppendBlock(buf, FXSYS_strlen(buf)); | 111 AppendBlock(buf, FXSYS_strlen(buf)); |
116 return *this; | 112 return *this; |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 } | 410 } |
415 | 411 |
416 int32_t CFX_FileBufferArchive::AppendString(const CFX_ByteStringC& lpsz) { | 412 int32_t CFX_FileBufferArchive::AppendString(const CFX_ByteStringC& lpsz) { |
417 return AppendBlock(lpsz.raw_str(), lpsz.GetLength()); | 413 return AppendBlock(lpsz.raw_str(), lpsz.GetLength()); |
418 } | 414 } |
419 | 415 |
420 void CFX_FileBufferArchive::AttachFile(IFX_StreamWrite* pFile) { | 416 void CFX_FileBufferArchive::AttachFile(IFX_StreamWrite* pFile) { |
421 ASSERT(pFile); | 417 ASSERT(pFile); |
422 m_pFile = pFile; | 418 m_pFile = pFile; |
423 } | 419 } |
OLD | NEW |