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

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

Issue 1846083002: Remove CFX_{Byte,Wide}String::Equal in favor of "==". (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Nits. 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/fpdfdoc/doc_formcontrol.cpp ('k') | core/fxcrt/fx_basic_wstring.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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cctype> 9 #include <cctype>
10 10
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 ConcatInPlace(str.m_pData->m_nDataLength, str.m_pData->m_String); 210 ConcatInPlace(str.m_pData->m_nDataLength, str.m_pData->m_String);
211 return *this; 211 return *this;
212 } 212 }
213 const CFX_ByteString& CFX_ByteString::operator+=(const CFX_ByteStringC& str) { 213 const CFX_ByteString& CFX_ByteString::operator+=(const CFX_ByteStringC& str) {
214 if (str.IsEmpty()) { 214 if (str.IsEmpty()) {
215 return *this; 215 return *this;
216 } 216 }
217 ConcatInPlace(str.GetLength(), str.GetCStr()); 217 ConcatInPlace(str.GetLength(), str.GetCStr());
218 return *this; 218 return *this;
219 } 219 }
220 bool CFX_ByteString::Equal(const char* ptr) const { 220 bool CFX_ByteString::operator==(const char* ptr) const {
221 if (!m_pData) { 221 if (!m_pData)
222 return !ptr || ptr[0] == '\0'; 222 return !ptr || !ptr[0];
223 } 223
224 if (!ptr) { 224 if (!ptr)
225 return m_pData->m_nDataLength == 0; 225 return m_pData->m_nDataLength == 0;
226 } 226
227 return FXSYS_strlen(ptr) == m_pData->m_nDataLength && 227 return FXSYS_strlen(ptr) == m_pData->m_nDataLength &&
228 FXSYS_memcmp(ptr, m_pData->m_String, m_pData->m_nDataLength) == 0; 228 FXSYS_memcmp(ptr, m_pData->m_String, m_pData->m_nDataLength) == 0;
229 } 229 }
230 bool CFX_ByteString::Equal(const CFX_ByteStringC& str) const { 230 bool CFX_ByteString::operator==(const CFX_ByteStringC& str) const {
231 if (!m_pData) { 231 if (!m_pData)
232 return str.IsEmpty(); 232 return str.IsEmpty();
233 } 233
234 return m_pData->m_nDataLength == str.GetLength() && 234 return m_pData->m_nDataLength == str.GetLength() &&
235 FXSYS_memcmp(m_pData->m_String, str.GetCStr(), str.GetLength()) == 0; 235 FXSYS_memcmp(m_pData->m_String, str.GetCStr(), str.GetLength()) == 0;
236 } 236 }
237 bool CFX_ByteString::Equal(const CFX_ByteString& other) const { 237 bool CFX_ByteString::operator==(const CFX_ByteString& other) const {
238 if (IsEmpty()) { 238 if (IsEmpty())
239 return other.IsEmpty(); 239 return other.IsEmpty();
240 } 240
241 if (other.IsEmpty()) { 241 if (other.IsEmpty())
242 return false; 242 return false;
243 } 243
244 return other.m_pData->m_nDataLength == m_pData->m_nDataLength && 244 return other.m_pData->m_nDataLength == m_pData->m_nDataLength &&
245 FXSYS_memcmp(other.m_pData->m_String, m_pData->m_String, 245 FXSYS_memcmp(other.m_pData->m_String, m_pData->m_String,
246 m_pData->m_nDataLength) == 0; 246 m_pData->m_nDataLength) == 0;
247 } 247 }
248 void CFX_ByteString::Empty() { 248 void CFX_ByteString::Empty() {
249 if (m_pData) { 249 if (m_pData) {
250 m_pData->Release(); 250 m_pData->Release();
251 m_pData = NULL; 251 m_pData = NULL;
252 } 252 }
253 } 253 }
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 fraction %= scale; 1072 fraction %= scale;
1073 scale /= 10; 1073 scale /= 10;
1074 } 1074 }
1075 return buf_size; 1075 return buf_size;
1076 } 1076 }
1077 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { 1077 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) {
1078 FX_CHAR buf[32]; 1078 FX_CHAR buf[32];
1079 FX_STRSIZE len = FX_ftoa(d, buf); 1079 FX_STRSIZE len = FX_ftoa(d, buf);
1080 return CFX_ByteString(buf, len); 1080 return CFX_ByteString(buf, len);
1081 } 1081 }
OLDNEW
« no previous file with comments | « core/fpdfdoc/doc_formcontrol.cpp ('k') | core/fxcrt/fx_basic_wstring.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698