From 31e446374a7cf3f3353e42a03b6d5297e5cd60ec Mon Sep 17 00:00:00 2001 From: tsepez Date: Fri, 15 Apr 2016 16:04:24 -0700 Subject: Avoid narrowing of strings in FWL SetEditText methods. Review URL: https://codereview.chromium.org/1892813004 --- xfa/fwl/lightwidget/cfwl_combobox.cpp | 2 +- xfa/fwl/lightwidget/cfwl_combobox.h | 2 +- xfa/fwl/lightwidget/cfwl_datetimepicker.cpp | 2 +- xfa/fwl/lightwidget/cfwl_datetimepicker.h | 2 +- xfa/fxfa/app/xfa_ffchoicelist.cpp | 4 ++-- xfa/fxfa/app/xfa_ffdocview.cpp | 2 +- xfa/fxfa/app/xfa_fftextedit.cpp | 6 +++--- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/xfa/fwl/lightwidget/cfwl_combobox.cpp b/xfa/fwl/lightwidget/cfwl_combobox.cpp index bdcc36fa30..f2cd1f5d6b 100644 --- a/xfa/fwl/lightwidget/cfwl_combobox.cpp +++ b/xfa/fwl/lightwidget/cfwl_combobox.cpp @@ -88,7 +88,7 @@ FWL_ERR CFWL_ComboBox::SetCurSel(int32_t iSel) { return static_cast(m_pIface)->SetCurSel(iSel); } -FWL_ERR CFWL_ComboBox::SetEditText(const CFX_WideStringC& wsText) { +FWL_ERR CFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { if (!m_pIface) return FWL_ERR_Indefinite; return static_cast(m_pIface)->SetEditText(wsText); diff --git a/xfa/fwl/lightwidget/cfwl_combobox.h b/xfa/fwl/lightwidget/cfwl_combobox.h index 59b542c453..c92a063cdf 100644 --- a/xfa/fwl/lightwidget/cfwl_combobox.h +++ b/xfa/fwl/lightwidget/cfwl_combobox.h @@ -30,7 +30,7 @@ class CFWL_ComboBox : public CFWL_Widget { FWL_ERR GetTextByIndex(int32_t iIndex, CFX_WideString& wsText); int32_t GetCurSel(); FWL_ERR SetCurSel(int32_t iSel); - FWL_ERR SetEditText(const CFX_WideStringC& wsText); + FWL_ERR SetEditText(const CFX_WideString& wsText); int32_t GetEditTextLength() const; FWL_ERR GetEditText(CFX_WideString& wsText, int32_t nStart = 0, diff --git a/xfa/fwl/lightwidget/cfwl_datetimepicker.cpp b/xfa/fwl/lightwidget/cfwl_datetimepicker.cpp index e470616ed8..ba99ad8551 100644 --- a/xfa/fwl/lightwidget/cfwl_datetimepicker.cpp +++ b/xfa/fwl/lightwidget/cfwl_datetimepicker.cpp @@ -58,7 +58,7 @@ FWL_ERR CFWL_DateTimePicker::GetEditText(CFX_WideString& wsText) { return static_cast(m_pIface)->GetEditText(wsText); } -FWL_ERR CFWL_DateTimePicker::SetEditText(const CFX_WideStringC& wsText) { +FWL_ERR CFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) { return static_cast(m_pIface)->SetEditText(wsText); } diff --git a/xfa/fwl/lightwidget/cfwl_datetimepicker.h b/xfa/fwl/lightwidget/cfwl_datetimepicker.h index a96ac532c1..befe57a079 100644 --- a/xfa/fwl/lightwidget/cfwl_datetimepicker.h +++ b/xfa/fwl/lightwidget/cfwl_datetimepicker.h @@ -16,7 +16,7 @@ class CFWL_DateTimePicker : public CFWL_Widget { FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL); FWL_ERR SetToday(int32_t iYear, int32_t iMonth, int32_t iDay); FWL_ERR GetEditText(CFX_WideString& wsText); - FWL_ERR SetEditText(const CFX_WideStringC& wsText); + FWL_ERR SetEditText(const CFX_WideString& wsText); int32_t CountSelRanges(); int32_t GetSelRange(int32_t nIndex, int32_t& nStart); FWL_ERR GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp index fe7943cfb1..a13c36d973 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.cpp +++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp @@ -250,7 +250,7 @@ FX_BOOL CXFA_FFComboBox::LoadWidget() { } else { CFX_WideString wsText; m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw); - pComboBox->SetEditText(wsText.AsStringC()); + pComboBox->SetEditText(wsText); } UpdateWidgetProperty(); m_pNormalWidget->UnlockUpdate(); @@ -382,7 +382,7 @@ FX_BOOL CXFA_FFComboBox::UpdateFWLData() { CFX_WideString wsText; ((CFWL_ComboBox*)m_pNormalWidget)->SetCurSel(-1); m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw); - ((CFWL_ComboBox*)m_pNormalWidget)->SetEditText(wsText.AsStringC()); + ((CFWL_ComboBox*)m_pNormalWidget)->SetEditText(wsText); } m_pNormalWidget->Update(); return TRUE; diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp index 9bc1be0a04..986e265a45 100644 --- a/xfa/fxfa/app/xfa_ffdocview.cpp +++ b/xfa/fxfa/app/xfa_ffdocview.cpp @@ -256,7 +256,7 @@ int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam, return XFA_EVENTERROR_Error; } if (pParam->m_eType == XFA_EVENT_Validate) { - CFX_WideString wsValidateStr = FX_WSTRC(L"preSubmit"); + CFX_WideString wsValidateStr(L"preSubmit"); CXFA_Node* pConfigItem = ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Config)); if (pConfigItem) { diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index 3232dbdac2..5b543db14d 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -593,7 +593,7 @@ FX_BOOL CXFA_FFDateTimeEdit::LoadWidget() { m_pNormalWidget->LockUpdate(); CFX_WideString wsText; m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); - pWidget->SetEditText(wsText.AsStringC()); + pWidget->SetEditText(wsText); if (CXFA_Value value = m_pDataAcc->GetFormValue()) { switch (value.GetChildValueClassID()) { case XFA_ELEMENT_Date: { @@ -693,7 +693,7 @@ FX_BOOL CXFA_FFDateTimeEdit::UpdateFWLData() { } CFX_WideString wsText; m_pDataAcc->GetValue(wsText, eType); - ((CFWL_DateTimePicker*)m_pNormalWidget)->SetEditText(wsText.AsStringC()); + ((CFWL_DateTimePicker*)m_pNormalWidget)->SetEditText(wsText); if (IsFocused() && !wsText.IsEmpty()) { CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc); CFX_Unitime date = lcValue.GetDate(); @@ -776,7 +776,7 @@ void CXFA_FFDateTimeEdit::OnSelectChanged(IFWL_Widget* pWidget, date.FormatPatterns(wsDate, wsPicture, m_pDataAcc->GetLocal(), XFA_VALUEPICTURE_Edit); CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)m_pNormalWidget; - pDateTime->SetEditText(wsDate.AsStringC()); + pDateTime->SetEditText(wsDate); pDateTime->Update(); GetDoc()->GetDocProvider()->SetFocusWidget(GetDoc(), NULL); CXFA_EventParam eParam; -- cgit v1.2.3