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

Unified Diff: core/fxcrt/fx_basic_wstring.cpp

Issue 1862953004: Make CFX_WideString::FromLocal() take a CFX_ByteStringC arg (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Propogate into CFX_CharMap methods, avoid silent alloc. 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 side-by-side diff with in-line comments
Download patch
Index: core/fxcrt/fx_basic_wstring.cpp
diff --git a/core/fxcrt/fx_basic_wstring.cpp b/core/fxcrt/fx_basic_wstring.cpp
index 627573fa7dd70292c8e9c4dcbecb5f556bc5a6b6..c2d85421bc5caffe32fc97e9def764a5f8f1174c 100644
--- a/core/fxcrt/fx_basic_wstring.cpp
+++ b/core/fxcrt/fx_basic_wstring.cpp
@@ -361,12 +361,12 @@ FX_WCHAR* CFX_WideString::GetBuffer(FX_STRSIZE nMinBufLength) {
}
// static
-CFX_WideString CFX_WideString::FromLocal(const CFX_ByteString& str) {
+CFX_WideString CFX_WideString::FromLocal(const CFX_ByteStringC& str) {
return FromCodePage(str, 0);
}
// static
-CFX_WideString CFX_WideString::FromCodePage(const CFX_ByteString& str,
+CFX_WideString CFX_WideString::FromCodePage(const CFX_ByteStringC& str,
uint16_t codepage) {
return CFX_CharMap::GetWideString(codepage, str);
}
@@ -1010,7 +1010,7 @@ FX_FLOAT CFX_WideString::GetFloat() const {
// static
CFX_ByteString CFX_CharMap::GetByteString(uint16_t codepage,
- const CFX_WideString& wstr) {
+ const CFX_WideStringC& wstr) {
FXSYS_assert(IsValidCodePage(codepage));
int src_len = wstr.GetLength();
int dest_len = FXSYS_WideCharToMultiByte(codepage, 0, wstr.c_str(), src_len,
@@ -1027,15 +1027,16 @@ CFX_ByteString CFX_CharMap::GetByteString(uint16_t codepage,
// static
CFX_WideString CFX_CharMap::GetWideString(uint16_t codepage,
- const CFX_ByteString& bstr) {
+ const CFX_ByteStringC& bstr) {
FXSYS_assert(IsValidCodePage(codepage));
int src_len = bstr.GetLength();
int dest_len =
- FXSYS_MultiByteToWideChar(codepage, 0, bstr, src_len, nullptr, 0);
+ FXSYS_MultiByteToWideChar(codepage, 0, bstr.c_str(), src_len, nullptr, 0);
CFX_WideString wstr;
if (dest_len) {
FX_WCHAR* dest_buf = wstr.GetBuffer(dest_len);
- FXSYS_MultiByteToWideChar(codepage, 0, bstr, src_len, dest_buf, dest_len);
+ FXSYS_MultiByteToWideChar(codepage, 0, bstr.c_str(), src_len, dest_buf,
+ dest_len);
wstr.ReleaseBuffer(dest_len);
}
return wstr;

Powered by Google App Engine
This is Rietveld 408576698