Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: core/fxcrt/fx_basic_buffer.cpp

Issue 1857713003: Rename GetCStr and GetPtr to match CFX_ByteString (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fxcrt/fx_basic_bstring_unittest.cpp ('k') | core/fxcrt/fx_basic_util.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::GetByteString() 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.GetPtr(), 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];
114 FXSYS_itoa(i, buf, 10); 114 FXSYS_itoa(i, buf, 10);
115 AppendBlock(buf, FXSYS_strlen(buf)); 115 AppendBlock(buf, FXSYS_strlen(buf));
116 return *this; 116 return *this;
117 } 117 }
118 118
(...skipping 16 matching lines...) Expand all
135 return *this; 135 return *this;
136 } 136 }
137 137
138 void CFX_WideTextBuf::AppendChar(FX_WCHAR ch) { 138 void CFX_WideTextBuf::AppendChar(FX_WCHAR ch) {
139 ExpandBuf(sizeof(FX_WCHAR)); 139 ExpandBuf(sizeof(FX_WCHAR));
140 *(FX_WCHAR*)(m_pBuffer.get() + m_DataSize) = ch; 140 *(FX_WCHAR*)(m_pBuffer.get() + m_DataSize) = ch;
141 m_DataSize += sizeof(FX_WCHAR); 141 m_DataSize += sizeof(FX_WCHAR);
142 } 142 }
143 143
144 CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const CFX_WideStringC& str) { 144 CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const CFX_WideStringC& str) {
145 AppendBlock(str.GetPtr(), str.GetLength() * sizeof(FX_WCHAR)); 145 AppendBlock(str.raw_str(), str.GetLength() * sizeof(FX_WCHAR));
146 return *this; 146 return *this;
147 } 147 }
148 148
149 CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const CFX_WideString& str) { 149 CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const CFX_WideString& str) {
150 AppendBlock(str.c_str(), str.GetLength() * sizeof(FX_WCHAR)); 150 AppendBlock(str.c_str(), str.GetLength() * sizeof(FX_WCHAR));
151 return *this; 151 return *this;
152 } 152 }
153 153
154 CFX_WideTextBuf& CFX_WideTextBuf::operator<<(int i) { 154 CFX_WideTextBuf& CFX_WideTextBuf::operator<<(int i) {
155 char buf[32]; 155 char buf[32];
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 m_pStream->WriteBlock(&f, sizeof(FX_FLOAT)); 221 m_pStream->WriteBlock(&f, sizeof(FX_FLOAT));
222 } else { 222 } else {
223 m_SavingBuf.AppendBlock(&f, sizeof(FX_FLOAT)); 223 m_SavingBuf.AppendBlock(&f, sizeof(FX_FLOAT));
224 } 224 }
225 return *this; 225 return *this;
226 } 226 }
227 CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(const CFX_ByteStringC& bstr) { 227 CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(const CFX_ByteStringC& bstr) {
228 int len = bstr.GetLength(); 228 int len = bstr.GetLength();
229 if (m_pStream) { 229 if (m_pStream) {
230 m_pStream->WriteBlock(&len, sizeof(int)); 230 m_pStream->WriteBlock(&len, sizeof(int));
231 m_pStream->WriteBlock(bstr.GetPtr(), len); 231 m_pStream->WriteBlock(bstr.raw_str(), len);
232 } else { 232 } else {
233 m_SavingBuf.AppendBlock(&len, sizeof(int)); 233 m_SavingBuf.AppendBlock(&len, sizeof(int));
234 m_SavingBuf.AppendBlock(bstr.GetPtr(), len); 234 m_SavingBuf.AppendBlock(bstr.raw_str(), len);
235 } 235 }
236 return *this; 236 return *this;
237 } 237 }
238 CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(const FX_WCHAR* wstr) { 238 CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(const FX_WCHAR* wstr) {
239 FX_STRSIZE len = FXSYS_wcslen(wstr); 239 FX_STRSIZE len = FXSYS_wcslen(wstr);
240 if (m_pStream) { 240 if (m_pStream) {
241 m_pStream->WriteBlock(&len, sizeof(int)); 241 m_pStream->WriteBlock(&len, sizeof(int));
242 m_pStream->WriteBlock(wstr, len); 242 m_pStream->WriteBlock(wstr, len);
243 } else { 243 } else {
244 m_SavingBuf.AppendBlock(&len, sizeof(int)); 244 m_SavingBuf.AppendBlock(&len, sizeof(int));
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 return AppendBlock(&byte, 1); 412 return AppendBlock(&byte, 1);
413 } 413 }
414 414
415 int32_t CFX_FileBufferArchive::AppendDWord(uint32_t i) { 415 int32_t CFX_FileBufferArchive::AppendDWord(uint32_t i) {
416 char buf[32]; 416 char buf[32];
417 FXSYS_itoa(i, buf, 10); 417 FXSYS_itoa(i, buf, 10);
418 return AppendBlock(buf, (size_t)FXSYS_strlen(buf)); 418 return AppendBlock(buf, (size_t)FXSYS_strlen(buf));
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.GetPtr(), 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 }
OLDNEW
« no previous file with comments | « core/fxcrt/fx_basic_bstring_unittest.cpp ('k') | core/fxcrt/fx_basic_util.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698