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

Unified Diff: core/src/fxcrt/fx_basic_bstring.cpp

Issue 1711893003: Remove CFX_{Byte,Wide}String::ConvertFrom(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: address comments Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fpdfdoc/doc_form.cpp ('k') | core/src/fxcrt/fx_basic_wstring.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcrt/fx_basic_bstring.cpp
diff --git a/core/src/fxcrt/fx_basic_bstring.cpp b/core/src/fxcrt/fx_basic_bstring.cpp
index e0d1146068f703909814fcf5cc2fd7eb66c3e0b7..85e504109574ad6c511af8d85c0b8511c48e68c4 100644
--- a/core/src/fxcrt/fx_basic_bstring.cpp
+++ b/core/src/fxcrt/fx_basic_bstring.cpp
@@ -910,25 +910,20 @@ CFX_WideString CFX_ByteString::UTF8Decode() const {
}
return decoder.GetResult();
}
+
+// static
CFX_ByteString CFX_ByteString::FromUnicode(const FX_WCHAR* str,
FX_STRSIZE len) {
- if (len < 0) {
- len = FXSYS_wcslen(str);
- }
- CFX_ByteString bstr;
- bstr.ConvertFrom(CFX_WideString(str, len));
- return bstr;
+ FX_STRSIZE str_len = len >= 0 ? len : FXSYS_wcslen(str);
+ return FromUnicode(CFX_WideString(str, str_len));
}
+
+// static
CFX_ByteString CFX_ByteString::FromUnicode(const CFX_WideString& str) {
- return FromUnicode(str.c_str(), str.GetLength());
-}
-void CFX_ByteString::ConvertFrom(const CFX_WideString& str,
- CFX_CharMap* pCharMap) {
- if (!pCharMap) {
- pCharMap = CFX_CharMap::GetDefaultMapper();
- }
- *this = (*pCharMap->m_GetByteString)(pCharMap, str);
+ CFX_CharMap* pCharMap = CFX_CharMap::GetDefaultMapper();
+ return (*pCharMap->m_GetByteString)(pCharMap, str);
}
+
int CFX_ByteString::Compare(const CFX_ByteStringC& str) const {
if (!m_pData) {
return str.IsEmpty() ? 0 : -1;
« no previous file with comments | « core/src/fpdfdoc/doc_form.cpp ('k') | core/src/fxcrt/fx_basic_wstring.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698