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

Side by Side Diff: core/fxcrt/include/fx_string.h

Issue 1977093002: Make CFX_ByteString(const CFX_ByteStringC&) explicit. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: First mac-only fix Created 4 years, 7 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
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 #ifndef CORE_FXCRT_INCLUDE_FX_STRING_H_ 7 #ifndef CORE_FXCRT_INCLUDE_FX_STRING_H_
8 #define CORE_FXCRT_INCLUDE_FX_STRING_H_ 8 #define CORE_FXCRT_INCLUDE_FX_STRING_H_
9 9
10 #include <stdint.h> // For intptr_t. 10 #include <stdint.h> // For intptr_t.
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 CFX_ByteString(CFX_ByteString&& other) { m_pData.Swap(other.m_pData); } 152 CFX_ByteString(CFX_ByteString&& other) { m_pData.Swap(other.m_pData); }
153 153
154 // Deliberately implicit to avoid calling on every string literal. 154 // Deliberately implicit to avoid calling on every string literal.
155 CFX_ByteString(char ch); 155 CFX_ByteString(char ch);
156 CFX_ByteString(const FX_CHAR* ptr) 156 CFX_ByteString(const FX_CHAR* ptr)
157 : CFX_ByteString(ptr, ptr ? FXSYS_strlen(ptr) : 0) {} 157 : CFX_ByteString(ptr, ptr ? FXSYS_strlen(ptr) : 0) {}
158 158
159 CFX_ByteString(const FX_CHAR* ptr, FX_STRSIZE len); 159 CFX_ByteString(const FX_CHAR* ptr, FX_STRSIZE len);
160 CFX_ByteString(const uint8_t* ptr, FX_STRSIZE len); 160 CFX_ByteString(const uint8_t* ptr, FX_STRSIZE len);
161 161
162 // TODO(tsepez): mark constructor as explicit. 162 explicit CFX_ByteString(const CFX_ByteStringC& bstrc);
163 CFX_ByteString(const CFX_ByteStringC& bstrc);
164 CFX_ByteString(const CFX_ByteStringC& bstrc1, const CFX_ByteStringC& bstrc2); 163 CFX_ByteString(const CFX_ByteStringC& bstrc1, const CFX_ByteStringC& bstrc2);
165 164
166 ~CFX_ByteString(); 165 ~CFX_ByteString();
167 166
168 void clear() { m_pData.Reset(); } 167 void clear() { m_pData.Reset(); }
169 168
170 static CFX_ByteString FromUnicode(const FX_WCHAR* ptr, FX_STRSIZE len = -1); 169 static CFX_ByteString FromUnicode(const FX_WCHAR* ptr, FX_STRSIZE len = -1);
171 static CFX_ByteString FromUnicode(const CFX_WideString& str); 170 static CFX_ByteString FromUnicode(const CFX_WideString& str);
172 171
173 // Explicit conversion to C-style string. 172 // Explicit conversion to C-style string.
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 } 672 }
674 673
675 FX_FLOAT FX_atof(const CFX_ByteStringC& str); 674 FX_FLOAT FX_atof(const CFX_ByteStringC& str);
676 inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) { 675 inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) {
677 return FX_atof(FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()).c_str()); 676 return FX_atof(FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()).c_str());
678 } 677 }
679 void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData); 678 void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData);
680 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); 679 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf);
681 680
682 #endif // CORE_FXCRT_INCLUDE_FX_STRING_H_ 681 #endif // CORE_FXCRT_INCLUDE_FX_STRING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698