diff options
Diffstat (limited to 'fpdfsdk/formfiller/cffl_textfield.cpp')
-rw-r--r-- | fpdfsdk/formfiller/cffl_textfield.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
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); } |