summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-01-02 17:17:02 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-01-03 19:54:37 +0000
commitc8fd3318a8deca3e1eabd6f7a9449ae4a0fa964d (patch)
treea5aedd888a3981f53722b7d65ea969d246f267c8 /xfa/fxfa/parser
parentdb194cf018069b930d0e3d5fc0242e14f70e8620 (diff)
downloadpdfium-c8fd3318a8deca3e1eabd6f7a9449ae4a0fa964d.tar.xz
Cleaning out params in CPDFXFA_Context
This CL cleans up some of the out params in CPDFXFA_Context. In the process several of the strings returned by ::LoadString() are inlined in their call sites and the defines removed. BUG=pdfium:549 Change-Id: I41a7ceeba3962299eecd0cb714ddb03d28dbb0ea Reviewed-on: https://pdfium-review.googlesource.com/2134 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cscript_hostpseudomodel.cpp20
-rw-r--r--xfa/fxfa/parser/cxfa_document.cpp7
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp5
-rw-r--r--xfa/fxfa/parser/cxfa_object.cpp5
4 files changed, 14 insertions, 23 deletions
diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
index 7493570bc2..b4559669b7 100644
--- a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
+++ b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
@@ -37,9 +37,8 @@ CScript_HostPseudoModel::~CScript_HostPseudoModel() {}
void CScript_HostPseudoModel::LoadString(CFXJSE_Value* pValue,
CXFA_FFNotify* pNotify,
uint32_t dwFlag) {
- CFX_WideString wsValue;
- pNotify->GetAppProvider()->LoadString(dwFlag, wsValue);
- pValue->SetString(FX_UTF8Encode(wsValue).AsStringC());
+ pValue->SetString(
+ FX_UTF8Encode(pNotify->GetAppProvider()->LoadString(dwFlag)).AsStringC());
}
void CScript_HostPseudoModel::AppType(CFXJSE_Value* pValue,
@@ -97,9 +96,8 @@ void CScript_HostPseudoModel::Language(CFXJSE_Value* pValue,
ThrowException(XFA_IDS_UNABLE_SET_LANGUAGE);
return;
}
- CFX_WideString wsLanguage;
- pNotify->GetAppProvider()->GetLanguage(wsLanguage);
- pValue->SetString(FX_UTF8Encode(wsLanguage).AsStringC());
+ pValue->SetString(
+ FX_UTF8Encode(pNotify->GetAppProvider()->GetLanguage()).AsStringC());
}
void CScript_HostPseudoModel::NumPages(CFXJSE_Value* pValue,
@@ -128,9 +126,8 @@ void CScript_HostPseudoModel::Platform(CFXJSE_Value* pValue,
ThrowException(XFA_IDS_UNABLE_SET_PLATFORM);
return;
}
- CFX_WideString wsPlatform;
- pNotify->GetAppProvider()->GetPlatform(wsPlatform);
- pValue->SetString(FX_UTF8Encode(wsPlatform).AsStringC());
+ pValue->SetString(
+ FX_UTF8Encode(pNotify->GetAppProvider()->GetPlatform()).AsStringC());
}
void CScript_HostPseudoModel::Title(CFXJSE_Value* pValue,
bool bSetting,
@@ -210,9 +207,8 @@ void CScript_HostPseudoModel::Name(CFXJSE_Value* pValue,
ThrowException(XFA_IDS_INVAlID_PROP_SET);
return;
}
- CFX_WideString wsAppName;
- pNotify->GetAppProvider()->GetAppName(wsAppName);
- pValue->SetString(FX_UTF8Encode(wsAppName).AsStringC());
+ pValue->SetString(
+ FX_UTF8Encode(pNotify->GetAppProvider()->GetAppName()).AsStringC());
}
void CScript_HostPseudoModel::GotoURL(CFXJSE_Arguments* pArguments) {
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index cc5f74ae23..b5c7ea1f62 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -283,10 +283,9 @@ bool CXFA_Document::IsInteractive() {
CXFA_LocaleMgr* CXFA_Document::GetLocalMgr() {
if (!m_pLocalMgr) {
- CFX_WideString wsLanguage;
- GetNotify()->GetAppProvider()->GetLanguage(wsLanguage);
- m_pLocalMgr = new CXFA_LocaleMgr(
- ToNode(GetXFAObject(XFA_HASHCODE_LocaleSet)), wsLanguage);
+ m_pLocalMgr =
+ new CXFA_LocaleMgr(ToNode(GetXFAObject(XFA_HASHCODE_LocaleSet)),
+ GetNotify()->GetAppProvider()->GetLanguage());
}
return m_pLocalMgr;
}
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index f385b11b69..cabf87fa7f 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -1107,10 +1107,7 @@ void CXFA_Node::Script_TreeClass_Nodes(CFXJSE_Value* pValue,
if (!pScriptContext)
return;
if (bSetting) {
- IXFA_AppProvider* pAppProvider = m_pDocument->GetNotify()->GetAppProvider();
- ASSERT(pAppProvider);
- CFX_WideString wsMessage;
- pAppProvider->LoadString(XFA_IDS_Unable_TO_SET, wsMessage);
+ CFX_WideString wsMessage = L"Unable to set ";
FXJSE_ThrowMessage(
FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC());
} else {
diff --git a/xfa/fxfa/parser/cxfa_object.cpp b/xfa/fxfa/parser/cxfa_object.cpp
index a31060241a..c8ed7138a8 100644
--- a/xfa/fxfa/parser/cxfa_object.cpp
+++ b/xfa/fxfa/parser/cxfa_object.cpp
@@ -50,12 +50,11 @@ void CXFA_Object::Script_ObjectClass_ClassName(CFXJSE_Value* pValue,
void CXFA_Object::ThrowException(int32_t iStringID, ...) {
IXFA_AppProvider* pAppProvider = m_pDocument->GetNotify()->GetAppProvider();
ASSERT(pAppProvider);
- CFX_WideString wsFormat;
- pAppProvider->LoadString(iStringID, wsFormat);
+
CFX_WideString wsMessage;
va_list arg_ptr;
va_start(arg_ptr, iStringID);
- wsMessage.FormatV(wsFormat.c_str(), arg_ptr);
+ wsMessage.FormatV(pAppProvider->LoadString(iStringID).c_str(), arg_ptr);
va_end(arg_ptr);
FXJSE_ThrowMessage(
FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC());