From a31da74cffa8c3ff919051cc49bc006aeb55d345 Mon Sep 17 00:00:00 2001 From: tsepez Date: Thu, 8 Sep 2016 11:28:14 -0700 Subject: Pass CFX_WideString further down widget callers Avoid a couple of places where we copy the raw string back into a brand-new widestring. There are a few places where the difference between a null ptr and an empty string control the logic, and I left these as-is. Other places can just take the string by const ref. Review-Url: https://codereview.chromium.org/2323493002 --- fpdfsdk/javascript/Field.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'fpdfsdk/javascript') diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp index a788fb203b..9ecdec6936 100644 --- a/fpdfsdk/javascript/Field.cpp +++ b/fpdfsdk/javascript/Field.cpp @@ -275,7 +275,7 @@ void Field::UpdateFormField(CPDFSDK_Document* pDocument, static_cast(pAnnot)->OnFormat(bFormatted); if (pAnnot) { static_cast(pAnnot)->ResetAppearance( - bFormatted ? sValue.c_str() : nullptr, FALSE); + bFormatted ? &sValue : nullptr, FALSE); } } } else { @@ -319,10 +319,7 @@ void Field::UpdateFormControl(CPDFSDK_Document* pDocument, nFieldType == FIELDTYPE_TEXTFIELD) { FX_BOOL bFormatted = FALSE; CFX_WideString sValue = pWidget->OnFormat(bFormatted); - if (bFormatted) - pWidget->ResetAppearance(sValue.c_str(), FALSE); - else - pWidget->ResetAppearance(nullptr, FALSE); + pWidget->ResetAppearance(bFormatted ? &sValue : nullptr, FALSE); } else { pWidget->ResetAppearance(nullptr, FALSE); } -- cgit v1.2.3