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/formfiller/cffl_combobox.cpp | 8 ++++---- fpdfsdk/formfiller/cffl_listbox.cpp | 2 +- fpdfsdk/formfiller/cffl_textfield.cpp | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'fpdfsdk/formfiller') diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp index f6aef20c02..fc590fd940 100644 --- a/fpdfsdk/formfiller/cffl_combobox.cpp +++ b/fpdfsdk/formfiller/cffl_combobox.cpp @@ -65,11 +65,11 @@ CPWL_Wnd* CFFL_ComboBox::NewPDFWindow(const PWL_CREATEPARAM& cp, swText = m_pWidget->GetOptionLabel(nCurSel); for (int32_t i = 0, sz = m_pWidget->CountOptions(); i < sz; i++) { - pWnd->AddString(m_pWidget->GetOptionLabel(i).c_str()); + pWnd->AddString(m_pWidget->GetOptionLabel(i)); } pWnd->SetSelect(nCurSel); - pWnd->SetText(swText.c_str()); + pWnd->SetText(swText); return pWnd; } @@ -172,7 +172,7 @@ void CFFL_ComboBox::SetActionData(CPDFSDK_PageView* pPageView, static_cast(GetPDFWindow(pPageView, FALSE))) { if (CPWL_Edit* pEdit = pComboBox->GetEdit()) { pEdit->SetSel(fa.nSelStart, fa.nSelEnd); - pEdit->ReplaceSel(fa.sChange.c_str()); + pEdit->ReplaceSel(fa.sChange); } } break; @@ -219,7 +219,7 @@ void CFFL_ComboBox::RestoreState(CPDFSDK_PageView* pPageView) { pComboBox->SetSelect(m_State.nIndex); } else { if (CPWL_Edit* pEdit = pComboBox->GetEdit()) { - pEdit->SetText(m_State.sValue.c_str()); + pEdit->SetText(m_State.sValue); pEdit->SetSel(m_State.nStart, m_State.nEnd); } } diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp index 36950bd2b2..860fd07a75 100644 --- a/fpdfsdk/formfiller/cffl_listbox.cpp +++ b/fpdfsdk/formfiller/cffl_listbox.cpp @@ -52,7 +52,7 @@ CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, pWnd->SetFillerNotify(pIFormFiller); for (int32_t i = 0, sz = m_pWidget->CountOptions(); i < sz; i++) - pWnd->AddString(m_pWidget->GetOptionLabel(i).c_str()); + pWnd->AddString(m_pWidget->GetOptionLabel(i)); if (pWnd->HasFlag(PLBS_MULTIPLESEL)) { m_OriginSelections.clear(); diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp index 1947940094..369bb4d209 100644 --- a/fpdfsdk/formfiller/cffl_textfield.cpp +++ b/fpdfsdk/formfiller/cffl_textfield.cpp @@ -99,7 +99,7 @@ CPWL_Wnd* CFFL_TextField::NewPDFWindow(const PWL_CREATEPARAM& cp, } } - pWnd->SetText(swValue.c_str()); + pWnd->SetText(swValue); return pWnd; } @@ -196,7 +196,7 @@ void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, if (CPWL_Edit* pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) { pEdit->SetFocus(); pEdit->SetSel(fa.nSelStart, fa.nSelEnd); - pEdit->ReplaceSel(fa.sChange.c_str()); + pEdit->ReplaceSel(fa.sChange); } break; default: @@ -232,7 +232,7 @@ void CFFL_TextField::RestoreState(CPDFSDK_PageView* pPageView) { ASSERT(pPageView); if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, TRUE)) { - pWnd->SetText(m_State.sValue.c_str()); + pWnd->SetText(m_State.sValue); pWnd->SetSel(m_State.nStart, m_State.nEnd); } } -- cgit v1.2.3