summaryrefslogtreecommitdiff
path: root/fpdfsdk/formfiller
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/formfiller')
-rw-r--r--fpdfsdk/formfiller/cffl_combobox.cpp24
-rw-r--r--fpdfsdk/formfiller/cffl_textfield.cpp24
2 files changed, 24 insertions, 24 deletions
diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp
index c8438a3a28..7a6d497ad2 100644
--- a/fpdfsdk/formfiller/cffl_combobox.cpp
+++ b/fpdfsdk/formfiller/cffl_combobox.cpp
@@ -263,18 +263,18 @@ bool CFFL_ComboBox::IsFieldFull(CPDFSDK_PageView* pPageView) {
void CFFL_ComboBox::OnSetFocus(CPWL_Wnd* pWnd) {
ASSERT(m_pFormFillEnv);
- if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) {
- CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;
- pEdit->SetCharSet(FXFONT_GB2312_CHARSET);
- pEdit->SetCodePage(936);
-
- pEdit->SetReadyToInput();
- CFX_WideString wsText = pEdit->GetText();
- int nCharacters = wsText.GetLength();
- CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
- unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str();
- m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, true);
- }
+ if (pWnd->GetClassName() != PWL_CLASSNAME_EDIT)
+ return;
+
+ CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;
+ pEdit->SetCharSet(FXFONT_GB2312_CHARSET);
+ pEdit->SetReadyToInput();
+
+ CFX_WideString wsText = pEdit->GetText();
+ int nCharacters = wsText.GetLength();
+ CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
+ auto* pBuffer = reinterpret_cast<const unsigned short*>(bsUTFText.c_str());
+ m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, true);
}
CFX_WideString CFFL_ComboBox::GetSelectExportText() {
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index 91db0959db..19a87d04ae 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -271,16 +271,16 @@ bool CFFL_TextField::IsFieldFull(CPDFSDK_PageView* pPageView) {
void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) {
ASSERT(m_pFormFillEnv);
- if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) {
- CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;
- pEdit->SetCharSet(FXFONT_GB2312_CHARSET);
- pEdit->SetCodePage(936);
-
- pEdit->SetReadyToInput();
- CFX_WideString wsText = pEdit->GetText();
- int nCharacters = wsText.GetLength();
- CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
- unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str();
- m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, true);
- }
+ if (pWnd->GetClassName() != PWL_CLASSNAME_EDIT)
+ return;
+
+ CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;
+ pEdit->SetCharSet(FXFONT_GB2312_CHARSET);
+ pEdit->SetReadyToInput();
+
+ CFX_WideString wsText = pEdit->GetText();
+ int nCharacters = wsText.GetLength();
+ CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
+ auto* pBuffer = reinterpret_cast<const unsigned short*>(bsUTFText.c_str());
+ m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, true);
}