CPDFDoc_Environment::GetAnnotHandlerMgr() never returns nullptr.
[pdfium.git] / fpdfsdk / src / fpdfppo.cpp
index ab25b76..6bdd7c5 100644 (file)
@@ -178,7 +178,7 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag(
     return nullptr;
 
   CPDF_Object* pType = pDict->GetElement("Type")->GetDirect();
-  if (!pType || pType->GetType() != PDFOBJ_NAME)
+  if (!ToName(pType))
     return nullptr;
   if (pType->GetString().Compare("Page"))
     return nullptr;
@@ -207,7 +207,7 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
                                             ObjectNumberMap* pObjNumberMap) {
   switch (pObj->GetType()) {
     case PDFOBJ_REFERENCE: {
-      CPDF_Reference* pReference = (CPDF_Reference*)pObj;
+      CPDF_Reference* pReference = pObj->AsReference();
       FX_DWORD newobjnum = GetNewObjId(pDoc, pObjNumberMap, pReference);
       if (newobjnum == 0)
         return FALSE;
@@ -235,7 +235,7 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
       break;
     }
     case PDFOBJ_ARRAY: {
-      CPDF_Array* pArray = (CPDF_Array*)pObj;
+      CPDF_Array* pArray = pObj->AsArray();
       FX_DWORD count = pArray->GetCount();
       for (FX_DWORD i = 0; i < count; ++i) {
         CPDF_Object* pNextObj = pArray->GetElement(i);
@@ -247,7 +247,7 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
       break;
     }
     case PDFOBJ_STREAM: {
-      CPDF_Stream* pStream = (CPDF_Stream*)pObj;
+      CPDF_Stream* pStream = pObj->AsStream();
       CPDF_Dictionary* pDict = pStream->GetDict();
       if (pDict) {
         if (!UpdateReference(pDict, pDoc, pObjNumberMap))