From f0b65545313f065790de7f91c02e5dd160753abd Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 13 Feb 2017 10:26:01 -0800 Subject: Simplify FX_UTF8Encode variants. Doing so reveals places where there are needless copies and conversions. Change-Id: I24a868d40aa63836f4167eaf4541964049df7916 Reviewed-on: https://pdfium-review.googlesource.com/2555 Commit-Queue: Tom Sepez Reviewed-by: dsinclair --- xfa/fxfa/parser/cscript_hostpseudomodel.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'xfa/fxfa/parser/cscript_hostpseudomodel.cpp') diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp index eb8177ebf6..a06e02f56d 100644 --- a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp @@ -89,7 +89,7 @@ void CScript_HostPseudoModel::Language(CFXJSE_Value* pValue, return; } pValue->SetString( - FX_UTF8Encode(pNotify->GetAppProvider()->GetLanguage()).AsStringC()); + pNotify->GetAppProvider()->GetLanguage().UTF8Encode().AsStringC()); } void CScript_HostPseudoModel::NumPages(CFXJSE_Value* pValue, @@ -118,8 +118,9 @@ void CScript_HostPseudoModel::Platform(CFXJSE_Value* pValue, return; } pValue->SetString( - FX_UTF8Encode(pNotify->GetAppProvider()->GetPlatform()).AsStringC()); + pNotify->GetAppProvider()->GetPlatform().UTF8Encode().AsStringC()); } + void CScript_HostPseudoModel::Title(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { @@ -137,7 +138,7 @@ void CScript_HostPseudoModel::Title(CFXJSE_Value* pValue, } CFX_WideString wsTitle; pNotify->GetDocEnvironment()->GetTitle(hDoc, wsTitle); - pValue->SetString(FX_UTF8Encode(wsTitle).AsStringC()); + pValue->SetString(wsTitle.UTF8Encode().AsStringC()); } void CScript_HostPseudoModel::ValidationsEnabled(CFXJSE_Value* pValue, @@ -199,7 +200,7 @@ void CScript_HostPseudoModel::Name(CFXJSE_Value* pValue, return; } pValue->SetString( - FX_UTF8Encode(pNotify->GetAppProvider()->GetAppName()).AsStringC()); + pNotify->GetAppProvider()->GetAppName().UTF8Encode().AsStringC()); } void CScript_HostPseudoModel::GotoURL(CFXJSE_Arguments* pArguments) { @@ -306,7 +307,7 @@ void CScript_HostPseudoModel::Response(CFXJSE_Arguments* pArguments) { wsQuestion, wsTitle, wsDefaultAnswer, bMark); CFXJSE_Value* pValue = pArguments->GetReturnValue(); if (pValue) - pValue->SetString(FX_UTF8Encode(wsAnswer).AsStringC()); + pValue->SetString(wsAnswer.UTF8Encode().AsStringC()); } void CScript_HostPseudoModel::DocumentInBatch(CFXJSE_Arguments* pArguments) { @@ -674,7 +675,7 @@ void CScript_HostPseudoModel::CurrentDateTime(CFXJSE_Arguments* pArguments) { CFX_WideString wsDataTime = pNotify->GetCurrentDateTime(); CFXJSE_Value* pValue = pArguments->GetReturnValue(); if (pValue) - pValue->SetString(FX_UTF8Encode(wsDataTime).AsStringC()); + pValue->SetString(wsDataTime.UTF8Encode().AsStringC()); } void CScript_HostPseudoModel::ThrowSetLanguageException() const { -- cgit v1.2.3