From 3cdcfeb04b5c496199d8c88ebd2402c3db4413ab Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 3 Jan 2017 15:45:10 -0500 Subject: Create individual exception methods. This CL removes the LoadString method from CPDFXFA_Context and, instead, creates individual exception methods for each of the loaded strings and calls as needed. BUG=pdfium:549 Change-Id: I1d975f01f13f45a885946a9952f24b13387dc3e4 Reviewed-on: https://pdfium-review.googlesource.com/2135 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- xfa/fxfa/parser/cscript_layoutpseudomodel.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'xfa/fxfa/parser/cscript_layoutpseudomodel.cpp') diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp index a9c63666b3..a1d1ca5785 100644 --- a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp @@ -39,7 +39,7 @@ void CScript_LayoutPseudoModel::Ready(CFXJSE_Value* pValue, return; } if (bSetting) { - ThrowException(XFA_IDS_UNABLE_SET_READY); + ThrowSetReadyException(); return; } int32_t iStatus = pNotify->GetLayoutStatus(); @@ -65,7 +65,7 @@ void CScript_LayoutPseudoModel::HWXY(CFXJSE_Arguments* pArguments, methodName = L"y"; break; } - ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, methodName); + ThrowParamCountMismatchException(methodName); return; } CXFA_Node* pNode = nullptr; @@ -177,7 +177,7 @@ void CScript_LayoutPseudoModel::PageCount(CFXJSE_Arguments* pArguments) { void CScript_LayoutPseudoModel::PageSpan(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength != 1) { - ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"pageSpan"); + ThrowParamCountMismatchException(L"pageSpan"); return; } CXFA_Node* pNode = nullptr; @@ -343,7 +343,7 @@ void CScript_LayoutPseudoModel::GetObjArray(CXFA_LayoutProcessor* pDocLayout, void CScript_LayoutPseudoModel::PageContent(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 1 || iLength > 3) { - ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"pageContent"); + ThrowParamCountMismatchException(L"pageContent"); return; } int32_t iIndex = 0; @@ -411,7 +411,7 @@ void CScript_LayoutPseudoModel::AbsPageSpan(CFXJSE_Arguments* pArguments) { void CScript_LayoutPseudoModel::AbsPageInBatch(CFXJSE_Arguments* pArguments) { if (pArguments->GetLength() != 1) { - ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"absPageInBatch"); + ThrowParamCountMismatchException(L"absPageInBatch"); return; } @@ -422,7 +422,7 @@ void CScript_LayoutPseudoModel::AbsPageInBatch(CFXJSE_Arguments* pArguments) { void CScript_LayoutPseudoModel::SheetInBatch(CFXJSE_Arguments* pArguments) { if (pArguments->GetLength() != 1) { - ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sheetInBatch"); + ThrowParamCountMismatchException(L"sheetInBatch"); return; } @@ -456,7 +456,7 @@ void CScript_LayoutPseudoModel::PageImp(CFXJSE_Arguments* pArguments, } else { methodName = L"page"; } - ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, methodName); + ThrowParamCountMismatchException(methodName); return; } CXFA_Node* pNode = nullptr; @@ -481,3 +481,7 @@ void CScript_LayoutPseudoModel::PageImp(CFXJSE_Arguments* pArguments, if (pValue) pValue->SetInteger(bAbsPage ? iPage : iPage + 1); } + +void CScript_LayoutPseudoModel::ThrowSetReadyException() const { + ThrowException(L"Unable to set ready value."); +} -- cgit v1.2.3