From 067990ccf96ae962392a2dbacbfd8348dc4c7676 Mon Sep 17 00:00:00 2001 From: tsepez Date: Tue, 13 Sep 2016 06:46:40 -0700 Subject: Stop converting widestring -> c_str -> widestring in several places. Avoids a needless alloc and copy. Review-Url: https://codereview.chromium.org/2338553002 --- fpdfsdk/fxedit/fxet_list.cpp | 6 +++--- fpdfsdk/fxedit/include/fxet_list.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'fpdfsdk/fxedit') diff --git a/fpdfsdk/fxedit/fxet_list.cpp b/fpdfsdk/fxedit/fxet_list.cpp index 96fb60dcaa..7bf1bd8a27 100644 --- a/fpdfsdk/fxedit/fxet_list.cpp +++ b/fpdfsdk/fxedit/fxet_list.cpp @@ -49,7 +49,7 @@ void CFX_ListItem::SetSelect(FX_BOOL bSelected) { m_bSelected = bSelected; } -void CFX_ListItem::SetText(const FX_WCHAR* text) { +void CFX_ListItem::SetText(const CFX_WideString& text) { m_pEdit->SetText(text); } @@ -396,7 +396,7 @@ int32_t CFX_ListCtrl::GetSelect() const { return m_nSelItem; } -void CFX_ListCtrl::AddString(const FX_WCHAR* str) { +void CFX_ListCtrl::AddString(const CFX_WideString& str) { AddItem(str); ReArrange(GetCount() - 1); } @@ -677,7 +677,7 @@ void CFX_ListCtrl::SetFontSize(FX_FLOAT fFontSize) { m_fFontSize = fFontSize; } -void CFX_ListCtrl::AddItem(const FX_WCHAR* str) { +void CFX_ListCtrl::AddItem(const CFX_WideString& str) { CFX_ListItem* pListItem = new CFX_ListItem(); pListItem->SetFontMap(m_pFontMap); pListItem->SetFontSize(m_fFontSize); diff --git a/fpdfsdk/fxedit/include/fxet_list.h b/fpdfsdk/fxedit/include/fxet_list.h index 2377e1d080..b5cd392eda 100644 --- a/fpdfsdk/fxedit/include/fxet_list.h +++ b/fpdfsdk/fxedit/include/fxet_list.h @@ -105,7 +105,7 @@ class CFX_ListItem final { void SetRect(const CLST_Rect& rect); void SetSelect(FX_BOOL bSelected); - void SetText(const FX_WCHAR* text); + void SetText(const CFX_WideString& text); void SetFontSize(FX_FLOAT fFontSize); CFX_WideString GetText() const; @@ -243,7 +243,7 @@ class CFX_ListCtrl : protected CFX_ListContainer { int32_t GetTopItem() const; CFX_FloatRect GetContentRect() const; int32_t GetItemIndex(const CFX_FloatPoint& point) const; - void AddString(const FX_WCHAR* str); + void AddString(const CFX_WideString& str); void SetTopItem(int32_t nIndex); void Select(int32_t nItemIndex); void SetCaret(int32_t nItemIndex); @@ -281,7 +281,7 @@ class CFX_ListCtrl : protected CFX_ListContainer { FX_BOOL IsItemVisible(int32_t nItemIndex) const; void SetScrollInfo(); void SetScrollPosY(FX_FLOAT fy); - void AddItem(const FX_WCHAR* str); + void AddItem(const CFX_WideString& str); CFX_WideString GetItemText(int32_t nIndex) const; void SetItemSelect(int32_t nItemIndex, FX_BOOL bSelected); int32_t GetLastSelected() const; -- cgit v1.2.3