summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/formfiller
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-04-27 11:22:20 -0700
committerTom Sepez <tsepez@chromium.org>2015-04-27 11:22:20 -0700
commit15a62973b9b89c3e229cc0ab501c45967f91b325 (patch)
treed95505963de5d8640fb85067639b6fdaf159d1b6 /fpdfsdk/src/formfiller
parentef25d9995e494bd596ffea8fb8c09c2e48daa9a0 (diff)
downloadpdfium-15a62973b9b89c3e229cc0ab501c45967f91b325.tar.xz
Kill operator LPCWSTR from CFX_WideString().
This involves adding some explicit c_str() calls. Doing so flagged PDF_EncodeText() and FindOptionValue() as having suboptimal signatures, in that we are often throwing away a perfectly fine length and recomputing it. R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/1101933003
Diffstat (limited to 'fpdfsdk/src/formfiller')
-rw-r--r--fpdfsdk/src/formfiller/FFL_ComboBox.cpp17
-rw-r--r--fpdfsdk/src/formfiller/FFL_IFormFiller.cpp2
-rw-r--r--fpdfsdk/src/formfiller/FFL_ListBox.cpp6
-rw-r--r--fpdfsdk/src/formfiller/FFL_TextField.cpp9
4 files changed, 13 insertions, 21 deletions
diff --git a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp
index 9e58c952aa..012ed4a730 100644
--- a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp
+++ b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp
@@ -77,28 +77,23 @@ CPWL_Wnd* CFFL_ComboBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageVie
pWnd->AttachFFLData(this);
pWnd->Create(cp);
- ASSERT(m_pApp != NULL);
CFFL_IFormFiller* pFormFiller = m_pApp->GetIFormFiller();
pWnd->SetFillerNotify(pFormFiller);
- ASSERT(m_pWidget != NULL);
FX_INT32 nCurSel = m_pWidget->GetSelectedIndex(0);
-
CFX_WideString swText;
-
if (nCurSel < 0)
swText = m_pWidget->GetValue();
else
swText = m_pWidget->GetOptionLabel(nCurSel);
-
+
for (FX_INT32 i=0,sz=m_pWidget->CountOptions(); i<sz; i++)
{
- pWnd->AddString(m_pWidget->GetOptionLabel(i));
+ pWnd->AddString(m_pWidget->GetOptionLabel(i).c_str());
}
-
+
pWnd->SetSelect(nCurSel);
- pWnd->SetText(swText);
-
+ pWnd->SetText(swText.c_str());
return pWnd;
}
@@ -245,7 +240,7 @@ void CFFL_ComboBox::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AAc
if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox)
{
pEdit->SetSel(fa.nSelStart, fa.nSelEnd);
- pEdit->ReplaceSel(fa.sChange);
+ pEdit->ReplaceSel(fa.sChange.c_str());
}
}
break;
@@ -297,7 +292,7 @@ void CFFL_ComboBox::RestoreState(CPDFSDK_PageView* pPageView)
{
if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox)
{
- pEdit->SetText(m_State.sValue);
+ pEdit->SetText(m_State.sValue.c_str());
pEdit->SetSel(m_State.nStart, m_State.nEnd);
}
}
diff --git a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
index 2b21e13cfc..1656ba5c5d 100644
--- a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
+++ b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
@@ -973,7 +973,7 @@ void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPage
if (bFormated)
{
- pInterForm->ResetFieldAppearance(pWidget->GetFormField(), sValue, TRUE);
+ pInterForm->ResetFieldAppearance(pWidget->GetFormField(), sValue.c_str(), TRUE);
pInterForm->UpdateField(pWidget->GetFormField());
}
diff --git a/fpdfsdk/src/formfiller/FFL_ListBox.cpp b/fpdfsdk/src/formfiller/FFL_ListBox.cpp
index 87ae552a66..dffd17538f 100644
--- a/fpdfsdk/src/formfiller/FFL_ListBox.cpp
+++ b/fpdfsdk/src/formfiller/FFL_ListBox.cpp
@@ -76,11 +76,9 @@ CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView
CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller();
pWnd->SetFillerNotify(pIFormFiller);
- ASSERT(m_pWidget != NULL);
-
for (FX_INT32 i=0,sz=m_pWidget->CountOptions(); i<sz; i++)
- pWnd->AddString(m_pWidget->GetOptionLabel(i));
-
+ pWnd->AddString(m_pWidget->GetOptionLabel(i).c_str());
+
if (pWnd->HasFlag(PLBS_MULTIPLESEL))
{
m_OriginSelections.RemoveAll();
diff --git a/fpdfsdk/src/formfiller/FFL_TextField.cpp b/fpdfsdk/src/formfiller/FFL_TextField.cpp
index f45d95364d..f488fac6ae 100644
--- a/fpdfsdk/src/formfiller/FFL_TextField.cpp
+++ b/fpdfsdk/src/formfiller/FFL_TextField.cpp
@@ -129,9 +129,8 @@ CPWL_Wnd* CFFL_TextField::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageVi
pWnd->SetLimitChar(nMaxLen);
}
}
-
- pWnd->SetText(swValue);
-
+
+ pWnd->SetText(swValue.c_str());
return pWnd;
}
@@ -251,7 +250,7 @@ void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AA
{
pEdit->SetFocus();
pEdit->SetSel(fa.nSelStart, fa.nSelEnd);
- pEdit->ReplaceSel(fa.sChange);
+ pEdit->ReplaceSel(fa.sChange.c_str());
}
break;
default:
@@ -292,7 +291,7 @@ void CFFL_TextField::RestoreState(CPDFSDK_PageView* pPageView)
if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, TRUE))
{
- pWnd->SetText(m_State.sValue);
+ pWnd->SetText(m_State.sValue.c_str());
pWnd->SetSel(m_State.nStart, m_State.nEnd);
}
}