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::GetByteString() const { | 103 CFX_ByteStringC CFX_ByteTextBuf::AsStringC() const { |
104 return CFX_ByteStringC(m_pBuffer.get(), m_DataSize); | 104 return CFX_ByteStringC(m_pBuffer.get(), m_DataSize); |
105 } | 105 } |
106 | 106 |
107 CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(const CFX_ByteStringC& lpsz) { | 107 CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(const CFX_ByteStringC& lpsz) { |
108 AppendBlock(lpsz.raw_str(), lpsz.GetLength()); | 108 AppendBlock(lpsz.raw_str(), lpsz.GetLength()); |
109 return *this; | 109 return *this; |
110 } | 110 } |
111 | 111 |
112 CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(int i) { | 112 CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(int i) { |
113 char buf[32]; | 113 char buf[32]; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const FX_WCHAR* lpsz) { | 179 CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const FX_WCHAR* lpsz) { |
180 AppendBlock(lpsz, FXSYS_wcslen(lpsz) * sizeof(FX_WCHAR)); | 180 AppendBlock(lpsz, FXSYS_wcslen(lpsz) * sizeof(FX_WCHAR)); |
181 return *this; | 181 return *this; |
182 } | 182 } |
183 | 183 |
184 CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const CFX_WideTextBuf& buf) { | 184 CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const CFX_WideTextBuf& buf) { |
185 AppendBlock(buf.m_pBuffer.get(), buf.m_DataSize); | 185 AppendBlock(buf.m_pBuffer.get(), buf.m_DataSize); |
186 return *this; | 186 return *this; |
187 } | 187 } |
188 | 188 |
189 CFX_WideStringC CFX_WideTextBuf::GetWideString() const { | 189 CFX_WideStringC CFX_WideTextBuf::AsStringC() const { |
190 return CFX_WideStringC((const FX_WCHAR*)m_pBuffer.get(), | 190 return CFX_WideStringC(reinterpret_cast<const FX_WCHAR*>(m_pBuffer.get()), |
191 m_DataSize / sizeof(FX_WCHAR)); | 191 m_DataSize / sizeof(FX_WCHAR)); |
192 } | 192 } |
193 | 193 |
194 #ifdef PDF_ENABLE_XFA | 194 #ifdef PDF_ENABLE_XFA |
195 CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(uint8_t i) { | 195 CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(uint8_t i) { |
196 if (m_pStream) { | 196 if (m_pStream) { |
197 m_pStream->WriteBlock(&i, 1); | 197 m_pStream->WriteBlock(&i, 1); |
198 } else { | 198 } else { |
199 m_SavingBuf.AppendByte(i); | 199 m_SavingBuf.AppendByte(i); |
200 } | 200 } |
(...skipping 218 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 |