From 4f7bc04ed64edbf72f49b2189f85bb88f0b547c7 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 27 Apr 2015 12:06:58 -0700 Subject: Merge to XFA: Reduce usage of operator LPCWSTR from CFX_WideString(). Original Review URL: https://codereview.chromium.org/1101933003 TBR=brucedawson@chromium.org Review URL: https://codereview.chromium.org/1108903002 --- core/src/fpdfdoc/doc_ap.cpp | 6 +++--- core/src/fpdfdoc/doc_basic.cpp | 2 +- core/src/fpdfdoc/doc_form.cpp | 5 +++-- core/src/fpdfdoc/doc_formfield.cpp | 8 ++++---- 4 files changed, 11 insertions(+), 10 deletions(-) (limited to 'core/src/fpdfdoc') diff --git a/core/src/fpdfdoc/doc_ap.cpp b/core/src/fpdfdoc/doc_ap.cpp index ccc800aa1a..8a195a747d 100644 --- a/core/src/fpdfdoc/doc_ap.cpp +++ b/core/src/fpdfdoc/doc_ap.cpp @@ -464,7 +464,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict vt.SetLimitChar(dwMaxLen); } vt.Initialize(); - vt.SetText(swValue); + vt.SetText(swValue.c_str()); vt.RearrangeAll(); CPDF_Rect rcContent = vt.GetContentRect(); CPDF_Point ptOffset(0.0f, 0.0f); @@ -502,7 +502,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict vt.SetFontSize(fFontSize); } vt.Initialize(); - vt.SetText(swValue); + vt.SetText(swValue.c_str()); vt.RearrangeAll(); CPDF_Rect rcContent = vt.GetContentRect(); CPDF_Point ptOffset = CPDF_Point(0.0f, (rcContent.Height() - rcEdit.Height()) / 2.0f); @@ -573,7 +573,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict vt.SetFontSize(fFontSize); } vt.Initialize(); - vt.SetText(swItem); + vt.SetText(swItem.c_str()); vt.RearrangeAll(); FX_FLOAT fItemHeight = vt.GetContentRect().Height(); if (bSelected) { diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp index 496ed86122..48f3ccae98 100644 --- a/core/src/fpdfdoc/doc_basic.cpp +++ b/core/src/fpdfdoc/doc_basic.cpp @@ -567,6 +567,6 @@ FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_BSTR bsLabel) const } FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_WSTR wsLabel) const { - CFX_ByteString bsLabel = PDF_EncodeText((CFX_WideString)wsLabel); + CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr()); return GetPageByLabel(bsLabel); } diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp index d8ca525f0a..bb2c3a1301 100644 --- a/core/src/fpdfdoc/doc_form.cpp +++ b/core/src/fpdfdoc/doc_form.cpp @@ -34,7 +34,7 @@ class _CFieldNameExtractor public: _CFieldNameExtractor(const CFX_WideString& full_name) { - m_pStart = full_name; + m_pStart = full_name.c_str(); m_pEnd = m_pStart + full_name.GetLength(); m_pCur = m_pStart; } @@ -736,7 +736,8 @@ int CPDF_InterForm::CompareFieldName(const CFX_ByteString& name1, const CFX_Byte } int CPDF_InterForm::CompareFieldName(const CFX_WideString& name1, const CFX_WideString& name2) { - FX_LPCWSTR ptr1 = name1, ptr2 = name2; + FX_LPCWSTR ptr1 = name1.c_str(); + FX_LPCWSTR ptr2 = name2.c_str(); if (name1.GetLength() != name2.GetLength()) { int i = 0; while (ptr1[i] == ptr2[i]) { diff --git a/core/src/fpdfdoc/doc_formfield.cpp b/core/src/fpdfdoc/doc_formfield.cpp index 64e9c287cc..9964c71cde 100644 --- a/core/src/fpdfdoc/doc_formfield.cpp +++ b/core/src/fpdfdoc/doc_formfield.cpp @@ -646,7 +646,7 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index, FX_BOOL bSelected, FX_BOOL b if (m_Type == ListBox) { SelectOption(index, TRUE); if (!(m_Flags & FORMLIST_MULTISELECT)) { - m_pDict->SetAtString("V", PDF_EncodeText(opt_value, opt_value.GetLength())); + m_pDict->SetAtString("V", PDF_EncodeText(opt_value)); } else { CPDF_Array* pArray = CPDF_Array::Create(); if (pArray == NULL) { @@ -668,7 +668,7 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index, FX_BOOL bSelected, FX_BOOL b m_pDict->SetAt("V", pArray); } } else if (m_Type == ComboBox) { - m_pDict->SetAtString("V", PDF_EncodeText(opt_value, opt_value.GetLength())); + m_pDict->SetAtString("V", PDF_EncodeText(opt_value)); CPDF_Array* pI = CPDF_Array::Create(); if (pI == NULL) { return FALSE; @@ -783,7 +783,7 @@ int CPDF_FormField::FindOption(CFX_WideString csOptLabel) } return -1; } -int CPDF_FormField::FindOptionValue(FX_LPCWSTR csOptValue, int iStartIndex) +int CPDF_FormField::FindOptionValue(const CFX_WideString& csOptValue, int iStartIndex) { if (iStartIndex < 0) { iStartIndex = 0; @@ -882,7 +882,7 @@ FX_BOOL CPDF_FormField::CheckControl(int iControlIndex, FX_BOOL bChecked, FX_BOO if (bNotify && m_pForm->m_pFormNotify != NULL) { SaveCheckedFieldStatus(this, statusArray); } - CFX_WideString csWExport = pControl->GetExportValue(); + CFX_WideString csWExport = pControl->GetExportValue(); CFX_ByteString csBExport = PDF_EncodeText(csWExport); int iCount = CountControls(); FX_BOOL bUnison = PDF_FormField_IsUnison(this); -- cgit v1.2.3