| Index: core/src/fpdfdoc/doc_action.cpp
|
| diff --git a/core/src/fpdfdoc/doc_action.cpp b/core/src/fpdfdoc/doc_action.cpp
|
| index 801c69fbb78e7e8addd8422769c9f5eb59042047..324153563a19d4f6d22cd4610fa3e502b36a45de 100644
|
| --- a/core/src/fpdfdoc/doc_action.cpp
|
| +++ b/core/src/fpdfdoc/doc_action.cpp
|
| @@ -94,7 +94,7 @@ FX_DWORD CPDF_ActionFields::GetFieldsCount() const
|
| if (m_pAction == NULL) {
|
| return 0;
|
| }
|
| - CPDF_Dictionary* pDict = (CPDF_Dictionary*)(*m_pAction);
|
| + CPDF_Dictionary* pDict = m_pAction->GetDict();
|
| if (pDict == NULL) {
|
| return 0;
|
| }
|
| @@ -124,7 +124,7 @@ void CPDF_ActionFields::GetAllFields(CFX_PtrArray& fieldObjects) const
|
| if (m_pAction == NULL) {
|
| return;
|
| }
|
| - CPDF_Dictionary* pDict = (CPDF_Dictionary*)(*m_pAction);
|
| + CPDF_Dictionary* pDict = m_pAction->GetDict();
|
| if (pDict == NULL) {
|
| return;
|
| }
|
| @@ -157,7 +157,7 @@ CPDF_Object* CPDF_ActionFields::GetField(FX_DWORD iIndex) const
|
| if (m_pAction == NULL) {
|
| return NULL;
|
| }
|
| - CPDF_Dictionary* pDict = (CPDF_Dictionary*)(*m_pAction);
|
| + CPDF_Dictionary* pDict = m_pAction->GetDict();
|
| if (pDict == NULL) {
|
| return NULL;
|
| }
|
| @@ -260,19 +260,20 @@ FX_DWORD CPDF_Action::GetSubActionsCount() const
|
| CPDF_Action CPDF_Action::GetSubAction(FX_DWORD iIndex) const
|
| {
|
| if (m_pDict == NULL || !m_pDict->KeyExist("Next")) {
|
| - return NULL;
|
| + return CPDF_Action();
|
| }
|
| CPDF_Object* pNext = m_pDict->GetElementValue("Next");
|
| int iObjType = pNext->GetType();
|
| if (iObjType == PDFOBJ_DICTIONARY) {
|
| + CPDF_Dictionary *pDict = static_cast<CPDF_Dictionary*>(pNext);
|
| if (iIndex == 0) {
|
| - return (CPDF_Dictionary*)pNext;
|
| + return CPDF_Action(pDict);
|
| }
|
| + } else if (iObjType == PDFOBJ_ARRAY) {
|
| + CPDF_Array* pArray = static_cast<CPDF_Array*>(pNext);
|
| + return CPDF_Action(pArray->GetDict(iIndex));
|
| }
|
| - if (iObjType == PDFOBJ_ARRAY) {
|
| - return ((CPDF_Array*)pNext)->GetDict(iIndex);
|
| - }
|
| - return NULL;
|
| + return CPDF_Action();
|
| }
|
| const FX_CHAR* g_sAATypes[] = {"E", "X", "D", "U", "Fo", "Bl", "PO", "PC", "PV", "PI",
|
| "O", "C",
|
| @@ -289,10 +290,10 @@ FX_BOOL CPDF_AAction::ActionExist(AActionType eType) const
|
| }
|
| CPDF_Action CPDF_AAction::GetAction(AActionType eType) const
|
| {
|
| - if (m_pDict == NULL) {
|
| - return NULL;
|
| + if (!m_pDict) {
|
| + return CPDF_Action();
|
| }
|
| - return m_pDict->GetDict(g_sAATypes[(int)eType]);
|
| + return CPDF_Action(m_pDict->GetDict(g_sAATypes[(int)eType]));
|
| }
|
| FX_POSITION CPDF_AAction::GetStartPos() const
|
| {
|
| @@ -304,25 +305,26 @@ FX_POSITION CPDF_AAction::GetStartPos() const
|
| CPDF_Action CPDF_AAction::GetNextAction(FX_POSITION& pos, AActionType& eType) const
|
| {
|
| if (m_pDict == NULL) {
|
| - return NULL;
|
| + return CPDF_Action();
|
| }
|
| CFX_ByteString csKey;
|
| CPDF_Object* pObj = m_pDict->GetNextElement(pos, csKey);
|
| - if (pObj != NULL) {
|
| - CPDF_Object* pDirect = pObj->GetDirect();
|
| - if (pDirect != NULL && pDirect->GetType() == PDFOBJ_DICTIONARY) {
|
| - int i = 0;
|
| - while (g_sAATypes[i][0] != '\0') {
|
| - if (csKey == g_sAATypes[i]) {
|
| - break;
|
| - }
|
| - i ++;
|
| - }
|
| - eType = (AActionType)i;
|
| - return (CPDF_Dictionary*)pDirect;
|
| + if (!pObj) {
|
| + return CPDF_Action();
|
| + }
|
| + CPDF_Object* pDirect = pObj->GetDirect();
|
| + if (!pDirect || pDirect->GetType() != PDFOBJ_DICTIONARY) {
|
| + return CPDF_Action();
|
| + }
|
| + int i = 0;
|
| + while (g_sAATypes[i][0] != '\0') {
|
| + if (csKey == g_sAATypes[i]) {
|
| + break;
|
| }
|
| + i++;
|
| }
|
| - return NULL;
|
| + eType = (AActionType)i;
|
| + return CPDF_Action(static_cast<CPDF_Dictionary*>(pDirect));
|
| }
|
| CPDF_DocJSActions::CPDF_DocJSActions(CPDF_Document* pDoc)
|
| {
|
| @@ -340,9 +342,9 @@ CPDF_Action CPDF_DocJSActions::GetJSAction(int index, CFX_ByteString& csName) co
|
| CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript"));
|
| CPDF_Object *pAction = name_tree.LookupValue(index, csName);
|
| if (pAction == NULL || pAction->GetType() != PDFOBJ_DICTIONARY) {
|
| - return NULL;
|
| + return CPDF_Action();
|
| }
|
| - return pAction->GetDict();
|
| + return CPDF_Action(pAction->GetDict());
|
| }
|
| CPDF_Action CPDF_DocJSActions::GetJSAction(const CFX_ByteString& csName) const
|
| {
|
| @@ -350,9 +352,9 @@ CPDF_Action CPDF_DocJSActions::GetJSAction(const CFX_ByteString& csName) const
|
| CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript"));
|
| CPDF_Object *pAction = name_tree.LookupValue(csName);
|
| if (pAction == NULL || pAction->GetType() != PDFOBJ_DICTIONARY) {
|
| - return NULL;
|
| + return CPDF_Action();
|
| }
|
| - return pAction->GetDict();
|
| + return CPDF_Action(pAction->GetDict());
|
| }
|
| int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const
|
| {
|
|
|