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_bstring.cpp

Issue 1870043003: Remove CFX_ByteString::Load() and operator= for CFX_ByteTextBuf (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 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/fxcodec/codec/fx_codec_png.cpp ('k') | core/fxcrt/include/fx_string.h » ('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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cctype> 10 #include <cctype>
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 134 }
135 135
136 const CFX_ByteString& CFX_ByteString::operator=( 136 const CFX_ByteString& CFX_ByteString::operator=(
137 const CFX_ByteString& stringSrc) { 137 const CFX_ByteString& stringSrc) {
138 if (m_pData != stringSrc.m_pData) 138 if (m_pData != stringSrc.m_pData)
139 m_pData = stringSrc.m_pData; 139 m_pData = stringSrc.m_pData;
140 140
141 return *this; 141 return *this;
142 } 142 }
143 143
144 const CFX_ByteString& CFX_ByteString::operator=(const CFX_BinaryBuf& buf) {
145 Load(buf.GetBuffer(), buf.GetSize());
146 return *this;
147 }
148
149 void CFX_ByteString::Load(const uint8_t* buf, FX_STRSIZE len) {
150 if (!len) {
151 clear();
152 return;
153 }
154
155 m_pData.Reset(StringData::Create(reinterpret_cast<const FX_CHAR*>(buf), len));
156 }
157
158 const CFX_ByteString& CFX_ByteString::operator+=(const FX_CHAR* pStr) { 144 const CFX_ByteString& CFX_ByteString::operator+=(const FX_CHAR* pStr) {
159 if (pStr) 145 if (pStr)
160 Concat(pStr, FXSYS_strlen(pStr)); 146 Concat(pStr, FXSYS_strlen(pStr));
161 147
162 return *this; 148 return *this;
163 } 149 }
164 150
165 const CFX_ByteString& CFX_ByteString::operator+=(char ch) { 151 const CFX_ByteString& CFX_ByteString::operator+=(char ch) {
166 Concat(&ch, 1); 152 Concat(&ch, 1);
167 return *this; 153 return *this;
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 fraction %= scale; 974 fraction %= scale;
989 scale /= 10; 975 scale /= 10;
990 } 976 }
991 return buf_size; 977 return buf_size;
992 } 978 }
993 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { 979 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) {
994 FX_CHAR buf[32]; 980 FX_CHAR buf[32];
995 FX_STRSIZE len = FX_ftoa(d, buf); 981 FX_STRSIZE len = FX_ftoa(d, buf);
996 return CFX_ByteString(buf, len); 982 return CFX_ByteString(buf, len);
997 } 983 }
OLDNEW
« no previous file with comments | « core/fxcodec/codec/fx_codec_png.cpp ('k') | core/fxcrt/include/fx_string.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698