Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(470)

Side by Side Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp

Issue 1518593002: Get rid of most uses of CFX_PtrArray. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix botch. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "parser_int.h" 7 #include "parser_int.h"
8 8
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 2675 matching lines...) Expand 10 before | Expand all | Expand 10 after
2686 CPDF_Dictionary* GetPage(int index); 2686 CPDF_Dictionary* GetPage(int index);
2687 2687
2688 friend class CPDF_HintTables; 2688 friend class CPDF_HintTables;
2689 2689
2690 protected: 2690 protected:
2691 static const int kMaxDataAvailRecursionDepth = 64; 2691 static const int kMaxDataAvailRecursionDepth = 64;
2692 static int s_CurrentDataAvailRecursionDepth; 2692 static int s_CurrentDataAvailRecursionDepth;
2693 static const int kMaxPageRecursionDepth = 1024; 2693 static const int kMaxPageRecursionDepth = 1024;
2694 2694
2695 FX_DWORD GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset); 2695 FX_DWORD GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset);
2696 FX_BOOL IsObjectsAvail(CFX_PtrArray& obj_array, 2696 FX_BOOL IsObjectsAvail(CFX_ArrayTemplate<CPDF_Object*>& obj_array,
2697 FX_BOOL bParsePage, 2697 FX_BOOL bParsePage,
2698 IFX_DownloadHints* pHints, 2698 IFX_DownloadHints* pHints,
2699 CFX_PtrArray& ret_array); 2699 CFX_ArrayTemplate<CPDF_Object*>& ret_array);
2700 FX_BOOL CheckDocStatus(IFX_DownloadHints* pHints); 2700 FX_BOOL CheckDocStatus(IFX_DownloadHints* pHints);
2701 FX_BOOL CheckHeader(IFX_DownloadHints* pHints); 2701 FX_BOOL CheckHeader(IFX_DownloadHints* pHints);
2702 FX_BOOL CheckFirstPage(IFX_DownloadHints* pHints); 2702 FX_BOOL CheckFirstPage(IFX_DownloadHints* pHints);
2703 FX_BOOL CheckHintTables(IFX_DownloadHints* pHints); 2703 FX_BOOL CheckHintTables(IFX_DownloadHints* pHints);
2704 FX_BOOL CheckEnd(IFX_DownloadHints* pHints); 2704 FX_BOOL CheckEnd(IFX_DownloadHints* pHints);
2705 FX_BOOL CheckCrossRef(IFX_DownloadHints* pHints); 2705 FX_BOOL CheckCrossRef(IFX_DownloadHints* pHints);
2706 FX_BOOL CheckCrossRefItem(IFX_DownloadHints* pHints); 2706 FX_BOOL CheckCrossRefItem(IFX_DownloadHints* pHints);
2707 FX_BOOL CheckTrailer(IFX_DownloadHints* pHints); 2707 FX_BOOL CheckTrailer(IFX_DownloadHints* pHints);
2708 FX_BOOL CheckRoot(IFX_DownloadHints* pHints); 2708 FX_BOOL CheckRoot(IFX_DownloadHints* pHints);
2709 FX_BOOL CheckInfo(IFX_DownloadHints* pHints); 2709 FX_BOOL CheckInfo(IFX_DownloadHints* pHints);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2788 FX_FILESIZE m_dwCurrentOffset; 2788 FX_FILESIZE m_dwCurrentOffset;
2789 2789
2790 PDF_DATAAVAIL_STATUS m_docStatus; 2790 PDF_DATAAVAIL_STATUS m_docStatus;
2791 2791
2792 FX_FILESIZE m_dwFileLen; 2792 FX_FILESIZE m_dwFileLen;
2793 2793
2794 CPDF_Document* m_pDocument; 2794 CPDF_Document* m_pDocument;
2795 2795
2796 CPDF_SortObjNumArray m_objnum_array; 2796 CPDF_SortObjNumArray m_objnum_array;
2797 2797
2798 CFX_PtrArray m_objs_array; 2798 CFX_ArrayTemplate<CPDF_Object*> m_objs_array;
2799 2799
2800 FX_FILESIZE m_Pos; 2800 FX_FILESIZE m_Pos;
2801 2801
2802 FX_FILESIZE m_bufferOffset; 2802 FX_FILESIZE m_bufferOffset;
2803 2803
2804 FX_DWORD m_bufferSize; 2804 FX_DWORD m_bufferSize;
2805 2805
2806 CFX_ByteString m_WordBuf; 2806 CFX_ByteString m_WordBuf;
2807 2807
2808 uint8_t m_WordBuffer[257]; 2808 uint8_t m_WordBuffer[257];
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2840 FX_BOOL m_bAnnotsLoad; 2840 FX_BOOL m_bAnnotsLoad;
2841 2841
2842 FX_BOOL m_bHaveAcroForm; 2842 FX_BOOL m_bHaveAcroForm;
2843 2843
2844 FX_DWORD m_dwAcroFormObjNum; 2844 FX_DWORD m_dwAcroFormObjNum;
2845 2845
2846 FX_BOOL m_bAcroFormLoad; 2846 FX_BOOL m_bAcroFormLoad;
2847 2847
2848 CPDF_Object* m_pAcroForm; 2848 CPDF_Object* m_pAcroForm;
2849 2849
2850 CFX_PtrArray m_arrayAcroforms; 2850 CFX_ArrayTemplate<CPDF_Object*> m_arrayAcroforms;
2851 2851
2852 CPDF_Dictionary* m_pPageDict; 2852 CPDF_Dictionary* m_pPageDict;
2853 2853
2854 CPDF_Object* m_pPageResource; 2854 CPDF_Object* m_pPageResource;
2855 2855
2856 FX_BOOL m_bNeedDownLoadResource; 2856 FX_BOOL m_bNeedDownLoadResource;
2857 2857
2858 FX_BOOL m_bPageLoadedOK; 2858 FX_BOOL m_bPageLoadedOK;
2859 2859
2860 FX_BOOL m_bLinearizedFormParamLoad; 2860 FX_BOOL m_bLinearizedFormParamLoad;
2861 2861
2862 CFX_PtrArray m_PagesArray; 2862 CFX_ArrayTemplate<CPDF_Object*> m_PagesArray;
2863 2863
2864 FX_DWORD m_dwEncryptObjNum; 2864 FX_DWORD m_dwEncryptObjNum;
2865 2865
2866 FX_FILESIZE m_dwPrevXRefOffset; 2866 FX_FILESIZE m_dwPrevXRefOffset;
2867 2867
2868 FX_BOOL m_bTotalLoadPageTree; 2868 FX_BOOL m_bTotalLoadPageTree;
2869 2869
2870 FX_BOOL m_bCurPageDictLoadOK; 2870 FX_BOOL m_bCurPageDictLoadOK;
2871 2871
2872 CPDF_PageNode m_pageNodes; 2872 CPDF_PageNode m_pageNodes;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
2947 } 2947 }
2948 if (m_pRoot) { 2948 if (m_pRoot) {
2949 m_pRoot->Release(); 2949 m_pRoot->Release();
2950 } 2950 }
2951 if (m_pTrailer) { 2951 if (m_pTrailer) {
2952 m_pTrailer->Release(); 2952 m_pTrailer->Release();
2953 } 2953 }
2954 2954
2955 int iSize = m_arrayAcroforms.GetSize(); 2955 int iSize = m_arrayAcroforms.GetSize();
2956 for (int i = 0; i < iSize; ++i) { 2956 for (int i = 0; i < iSize; ++i) {
2957 static_cast<CPDF_Object*>(m_arrayAcroforms.GetAt(i))->Release(); 2957 m_arrayAcroforms.GetAt(i)->Release();
2958 } 2958 }
2959 } 2959 }
2960 void CPDF_DataAvail::SetDocument(CPDF_Document* pDoc) { 2960 void CPDF_DataAvail::SetDocument(CPDF_Document* pDoc) {
2961 m_pDocument = pDoc; 2961 m_pDocument = pDoc;
2962 } 2962 }
2963 FX_DWORD CPDF_DataAvail::GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset) { 2963 FX_DWORD CPDF_DataAvail::GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset) {
2964 CPDF_Parser* pParser = (CPDF_Parser*)(m_pDocument->GetParser()); 2964 CPDF_Parser* pParser = (CPDF_Parser*)(m_pDocument->GetParser());
2965 if (pParser == NULL) { 2965 if (pParser == NULL) {
2966 return 0; 2966 return 0;
2967 } 2967 }
(...skipping 16 matching lines...) Expand all
2984 } 2984 }
2985 if ((FX_FILESIZE*)pResult - 2985 if ((FX_FILESIZE*)pResult -
2986 (FX_FILESIZE*)pParser->m_SortedOffset.GetData() == 2986 (FX_FILESIZE*)pParser->m_SortedOffset.GetData() ==
2987 pParser->m_SortedOffset.GetSize() - 1) { 2987 pParser->m_SortedOffset.GetSize() - 1) {
2988 return 0; 2988 return 0;
2989 } 2989 }
2990 return (FX_DWORD)(((FX_FILESIZE*)pResult)[1] - offset); 2990 return (FX_DWORD)(((FX_FILESIZE*)pResult)[1] - offset);
2991 } 2991 }
2992 return 0; 2992 return 0;
2993 } 2993 }
2994 FX_BOOL CPDF_DataAvail::IsObjectsAvail(CFX_PtrArray& obj_array, 2994 FX_BOOL CPDF_DataAvail::IsObjectsAvail(
2995 FX_BOOL bParsePage, 2995 CFX_ArrayTemplate<CPDF_Object*>& obj_array,
2996 IFX_DownloadHints* pHints, 2996 FX_BOOL bParsePage,
2997 CFX_PtrArray& ret_array) { 2997 IFX_DownloadHints* pHints,
2998 CFX_ArrayTemplate<CPDF_Object*>& ret_array) {
2998 if (!obj_array.GetSize()) { 2999 if (!obj_array.GetSize()) {
2999 return TRUE; 3000 return TRUE;
3000 } 3001 }
3001 FX_DWORD count = 0; 3002 FX_DWORD count = 0;
3002 CFX_PtrArray new_obj_array; 3003 CFX_ArrayTemplate<CPDF_Object*> new_obj_array;
3003 int32_t i = 0; 3004 int32_t i = 0;
3004 for (i = 0; i < obj_array.GetSize(); i++) { 3005 for (i = 0; i < obj_array.GetSize(); i++) {
3005 CPDF_Object* pObj = static_cast<CPDF_Object*>(obj_array[i]); 3006 CPDF_Object* pObj = obj_array[i];
3006 if (!pObj) 3007 if (!pObj)
3007 continue; 3008 continue;
3008 3009
3009 int32_t type = pObj->GetType(); 3010 int32_t type = pObj->GetType();
3010 switch (type) { 3011 switch (type) {
3011 case PDFOBJ_ARRAY: { 3012 case PDFOBJ_ARRAY: {
3012 CPDF_Array* pArray = pObj->GetArray(); 3013 CPDF_Array* pArray = pObj->GetArray();
3013 for (FX_DWORD k = 0; k < pArray->GetCount(); k++) { 3014 for (FX_DWORD k = 0; k < pArray->GetCount(); k++) {
3014 new_obj_array.Add(pArray->GetElement(k)); 3015 new_obj_array.Add(pArray->GetElement(k));
3015 } 3016 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3049 if (pReferred) { 3050 if (pReferred) {
3050 new_obj_array.Add(pReferred); 3051 new_obj_array.Add(pReferred);
3051 } 3052 }
3052 } 3053 }
3053 } break; 3054 } break;
3054 } 3055 }
3055 } 3056 }
3056 if (count > 0) { 3057 if (count > 0) {
3057 int32_t iSize = new_obj_array.GetSize(); 3058 int32_t iSize = new_obj_array.GetSize();
3058 for (i = 0; i < iSize; ++i) { 3059 for (i = 0; i < iSize; ++i) {
3059 CPDF_Object* pObj = static_cast<CPDF_Object*>(new_obj_array[i]); 3060 CPDF_Object* pObj = new_obj_array[i];
3060 if (CPDF_Reference* pRef = pObj->AsReference()) { 3061 if (CPDF_Reference* pRef = pObj->AsReference()) {
3061 FX_DWORD dwNum = pRef->GetRefObjNum(); 3062 FX_DWORD dwNum = pRef->GetRefObjNum();
3062 if (!m_objnum_array.Find(dwNum)) 3063 if (!m_objnum_array.Find(dwNum))
3063 ret_array.Add(pObj); 3064 ret_array.Add(pObj);
3064 } else { 3065 } else {
3065 ret_array.Add(pObj); 3066 ret_array.Add(pObj);
3066 } 3067 }
3067 } 3068 }
3068 return FALSE; 3069 return FALSE;
3069 } 3070 }
(...skipping 15 matching lines...) Expand all
3085 return DataNotAvailable; 3086 return DataNotAvailable;
3086 } 3087 }
3087 } 3088 }
3088 return DataAvailable; 3089 return DataAvailable;
3089 } 3090 }
3090 3091
3091 FX_BOOL CPDF_DataAvail::CheckAcroFormSubObject(IFX_DownloadHints* pHints) { 3092 FX_BOOL CPDF_DataAvail::CheckAcroFormSubObject(IFX_DownloadHints* pHints) {
3092 if (!m_objs_array.GetSize()) { 3093 if (!m_objs_array.GetSize()) {
3093 m_objs_array.RemoveAll(); 3094 m_objs_array.RemoveAll();
3094 m_objnum_array.RemoveAll(); 3095 m_objnum_array.RemoveAll();
3095 CFX_PtrArray obj_array; 3096 CFX_ArrayTemplate<CPDF_Object*> obj_array;
3096 obj_array.Append(m_arrayAcroforms); 3097 obj_array.Append(m_arrayAcroforms);
3097 FX_BOOL bRet = IsObjectsAvail(obj_array, FALSE, pHints, m_objs_array); 3098 FX_BOOL bRet = IsObjectsAvail(obj_array, FALSE, pHints, m_objs_array);
3098 if (bRet) { 3099 if (bRet) {
3099 m_objs_array.RemoveAll(); 3100 m_objs_array.RemoveAll();
3100 } 3101 }
3101 return bRet; 3102 return bRet;
3102 } 3103 }
3103 CFX_PtrArray new_objs_array; 3104 CFX_ArrayTemplate<CPDF_Object*> new_objs_array;
3104 FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array); 3105 FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array);
3105 if (bRet) { 3106 if (bRet) {
3106 int32_t iSize = m_arrayAcroforms.GetSize(); 3107 int32_t iSize = m_arrayAcroforms.GetSize();
3107 for (int32_t i = 0; i < iSize; ++i) { 3108 for (int32_t i = 0; i < iSize; ++i) {
3108 static_cast<CPDF_Object*>(m_arrayAcroforms.GetAt(i))->Release(); 3109 m_arrayAcroforms.GetAt(i)->Release();
3109 } 3110 }
3110 m_arrayAcroforms.RemoveAll(); 3111 m_arrayAcroforms.RemoveAll();
3111 } else { 3112 } else {
3112 m_objs_array.RemoveAll(); 3113 m_objs_array.RemoveAll();
3113 m_objs_array.Append(new_objs_array); 3114 m_objs_array.Append(new_objs_array);
3114 } 3115 }
3115 return bRet; 3116 return bRet;
3116 } 3117 }
3117 FX_BOOL CPDF_DataAvail::CheckAcroForm(IFX_DownloadHints* pHints) { 3118 FX_BOOL CPDF_DataAvail::CheckAcroForm(IFX_DownloadHints* pHints) {
3118 FX_BOOL bExist = FALSE; 3119 FX_BOOL bExist = FALSE;
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
3384 } 3385 }
3385 pObj->Release(); 3386 pObj->Release();
3386 } 3387 }
3387 m_PageObjList.RemoveAll(); 3388 m_PageObjList.RemoveAll();
3388 if (UnavailObjList.GetSize()) { 3389 if (UnavailObjList.GetSize()) {
3389 m_PageObjList.Append(UnavailObjList); 3390 m_PageObjList.Append(UnavailObjList);
3390 return FALSE; 3391 return FALSE;
3391 } 3392 }
3392 FX_DWORD iPages = m_PagesArray.GetSize(); 3393 FX_DWORD iPages = m_PagesArray.GetSize();
3393 for (FX_DWORD i = 0; i < iPages; i++) { 3394 for (FX_DWORD i = 0; i < iPages; i++) {
3394 CPDF_Object* pPages = static_cast<CPDF_Object*>(m_PagesArray.GetAt(i)); 3395 CPDF_Object* pPages = m_PagesArray.GetAt(i);
3395 if (!pPages) 3396 if (!pPages)
3396 continue; 3397 continue;
3397 3398
3398 if (!GetPageKids(m_pCurrentParser, pPages)) { 3399 if (!GetPageKids(m_pCurrentParser, pPages)) {
3399 pPages->Release(); 3400 pPages->Release();
3400 while (++i < iPages) { 3401 while (++i < iPages) {
3401 pPages = static_cast<CPDF_Object*>(m_PagesArray.GetAt(i)); 3402 pPages = m_PagesArray.GetAt(i);
3402 pPages->Release(); 3403 pPages->Release();
3403 } 3404 }
3404 m_PagesArray.RemoveAll(); 3405 m_PagesArray.RemoveAll();
3405 m_docStatus = PDF_DATAAVAIL_ERROR; 3406 m_docStatus = PDF_DATAAVAIL_ERROR;
3406 return FALSE; 3407 return FALSE;
3407 } 3408 }
3408 pPages->Release(); 3409 pPages->Release();
3409 } 3410 }
3410 m_PagesArray.RemoveAll(); 3411 m_PagesArray.RemoveAll();
3411 if (!m_PageObjList.GetSize()) { 3412 if (!m_PageObjList.GetSize()) {
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
4156 int level) { 4157 int level) {
4157 if (level >= kMaxPageRecursionDepth) { 4158 if (level >= kMaxPageRecursionDepth) {
4158 return FALSE; 4159 return FALSE;
4159 } 4160 }
4160 int32_t iSize = pageNodes.m_childNode.GetSize(); 4161 int32_t iSize = pageNodes.m_childNode.GetSize();
4161 if (iSize <= 0 || iPage >= iSize) { 4162 if (iSize <= 0 || iPage >= iSize) {
4162 m_docStatus = PDF_DATAAVAIL_ERROR; 4163 m_docStatus = PDF_DATAAVAIL_ERROR;
4163 return FALSE; 4164 return FALSE;
4164 } 4165 }
4165 for (int32_t i = 0; i < iSize; ++i) { 4166 for (int32_t i = 0; i < iSize; ++i) {
4166 CPDF_PageNode* pNode = (CPDF_PageNode*)pageNodes.m_childNode.GetAt(i); 4167 CPDF_PageNode* pNode = pageNodes.m_childNode.GetAt(i);
4167 if (!pNode) { 4168 if (!pNode) {
4168 continue; 4169 continue;
4169 } 4170 }
4170 switch (pNode->m_type) { 4171 switch (pNode->m_type) {
4171 case PDF_PAGENODE_UNKOWN: 4172 case PDF_PAGENODE_UNKOWN:
4172 if (!CheckUnkownPageNode(pNode->m_dwPageNo, pNode, pHints)) { 4173 if (!CheckUnkownPageNode(pNode->m_dwPageNo, pNode, pHints)) {
4173 return FALSE; 4174 return FALSE;
4174 } 4175 }
4175 --i; 4176 --i;
4176 break; 4177 break;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
4303 m_objs_array.RemoveAll(); 4304 m_objs_array.RemoveAll();
4304 m_objnum_array.RemoveAll(); 4305 m_objnum_array.RemoveAll();
4305 CPDF_Dictionary* pPageDict = m_pDocument->GetPage(iPage); 4306 CPDF_Dictionary* pPageDict = m_pDocument->GetPage(iPage);
4306 if (!pPageDict) { 4307 if (!pPageDict) {
4307 return TRUE; 4308 return TRUE;
4308 } 4309 }
4309 CPDF_Object* pAnnots = pPageDict->GetElement(FX_BSTRC("Annots")); 4310 CPDF_Object* pAnnots = pPageDict->GetElement(FX_BSTRC("Annots"));
4310 if (!pAnnots) { 4311 if (!pAnnots) {
4311 return TRUE; 4312 return TRUE;
4312 } 4313 }
4313 CFX_PtrArray obj_array; 4314 CFX_ArrayTemplate<CPDF_Object*> obj_array;
4314 obj_array.Add(pAnnots); 4315 obj_array.Add(pAnnots);
4315 FX_BOOL bRet = IsObjectsAvail(obj_array, FALSE, pHints, m_objs_array); 4316 FX_BOOL bRet = IsObjectsAvail(obj_array, FALSE, pHints, m_objs_array);
4316 if (bRet) { 4317 if (bRet) {
4317 m_objs_array.RemoveAll(); 4318 m_objs_array.RemoveAll();
4318 } 4319 }
4319 return bRet; 4320 return bRet;
4320 } 4321 }
4321 CFX_PtrArray new_objs_array; 4322 CFX_ArrayTemplate<CPDF_Object*> new_objs_array;
4322 FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array); 4323 FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array);
4323 m_objs_array.RemoveAll(); 4324 m_objs_array.RemoveAll();
4324 if (!bRet) { 4325 if (!bRet) {
4325 m_objs_array.Append(new_objs_array); 4326 m_objs_array.Append(new_objs_array);
4326 } 4327 }
4327 return bRet; 4328 return bRet;
4328 } 4329 }
4329 FX_BOOL CPDF_DataAvail::CheckLinearizedFirstPage(int32_t iPage, 4330 FX_BOOL CPDF_DataAvail::CheckLinearizedFirstPage(int32_t iPage,
4330 IFX_DownloadHints* pHints) { 4331 IFX_DownloadHints* pHints) {
4331 if (!m_bAnnotsLoad) { 4332 if (!m_bAnnotsLoad) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
4425 } 4426 }
4426 if (!m_bPageLoadedOK) { 4427 if (!m_bPageLoadedOK) {
4427 if (!m_objs_array.GetSize()) { 4428 if (!m_objs_array.GetSize()) {
4428 m_objs_array.RemoveAll(); 4429 m_objs_array.RemoveAll();
4429 m_objnum_array.RemoveAll(); 4430 m_objnum_array.RemoveAll();
4430 m_pPageDict = m_pDocument->GetPage(iPage); 4431 m_pPageDict = m_pDocument->GetPage(iPage);
4431 if (!m_pPageDict) { 4432 if (!m_pPageDict) {
4432 ResetFirstCheck(iPage); 4433 ResetFirstCheck(iPage);
4433 return DataAvailable; 4434 return DataAvailable;
4434 } 4435 }
4435 CFX_PtrArray obj_array; 4436 CFX_ArrayTemplate<CPDF_Object*> obj_array;
4436 obj_array.Add(m_pPageDict); 4437 obj_array.Add(m_pPageDict);
4437 FX_BOOL bRet = IsObjectsAvail(obj_array, TRUE, pHints, m_objs_array); 4438 FX_BOOL bRet = IsObjectsAvail(obj_array, TRUE, pHints, m_objs_array);
4438 if (bRet) { 4439 if (bRet) {
4439 m_objs_array.RemoveAll(); 4440 m_objs_array.RemoveAll();
4440 m_bPageLoadedOK = TRUE; 4441 m_bPageLoadedOK = TRUE;
4441 } else { 4442 } else {
4442 return bRet; 4443 return bRet;
4443 } 4444 }
4444 } else { 4445 } else {
4445 CFX_PtrArray new_objs_array; 4446 CFX_ArrayTemplate<CPDF_Object*> new_objs_array;
4446 FX_BOOL bRet = 4447 FX_BOOL bRet =
4447 IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array); 4448 IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array);
4448 m_objs_array.RemoveAll(); 4449 m_objs_array.RemoveAll();
4449 if (bRet) { 4450 if (bRet) {
4450 m_bPageLoadedOK = TRUE; 4451 m_bPageLoadedOK = TRUE;
4451 } else { 4452 } else {
4452 m_objs_array.Append(new_objs_array); 4453 m_objs_array.Append(new_objs_array);
4453 return DataNotAvailable; 4454 return DataNotAvailable;
4454 } 4455 }
4455 } 4456 }
(...skipping 24 matching lines...) Expand all
4480 m_bPageLoadedOK = FALSE; 4481 m_bPageLoadedOK = FALSE;
4481 m_bAnnotsLoad = FALSE; 4482 m_bAnnotsLoad = FALSE;
4482 m_bCurPageDictLoadOK = FALSE; 4483 m_bCurPageDictLoadOK = FALSE;
4483 ResetFirstCheck(iPage); 4484 ResetFirstCheck(iPage);
4484 m_pagesLoadState.insert(iPage); 4485 m_pagesLoadState.insert(iPage);
4485 return DataAvailable; 4486 return DataAvailable;
4486 } 4487 }
4487 FX_BOOL CPDF_DataAvail::CheckResources(IFX_DownloadHints* pHints) { 4488 FX_BOOL CPDF_DataAvail::CheckResources(IFX_DownloadHints* pHints) {
4488 if (!m_objs_array.GetSize()) { 4489 if (!m_objs_array.GetSize()) {
4489 m_objs_array.RemoveAll(); 4490 m_objs_array.RemoveAll();
4490 CFX_PtrArray obj_array; 4491 CFX_ArrayTemplate<CPDF_Object*> obj_array;
4491 obj_array.Add(m_pPageResource); 4492 obj_array.Add(m_pPageResource);
4492 FX_BOOL bRet = IsObjectsAvail(obj_array, TRUE, pHints, m_objs_array); 4493 FX_BOOL bRet = IsObjectsAvail(obj_array, TRUE, pHints, m_objs_array);
4493 if (bRet) { 4494 if (bRet) {
4494 m_objs_array.RemoveAll(); 4495 m_objs_array.RemoveAll();
4495 } 4496 }
4496 return bRet; 4497 return bRet;
4497 } 4498 }
4498 CFX_PtrArray new_objs_array; 4499 CFX_ArrayTemplate<CPDF_Object*> new_objs_array;
4499 FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array); 4500 FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array);
4500 m_objs_array.RemoveAll(); 4501 m_objs_array.RemoveAll();
4501 if (!bRet) { 4502 if (!bRet) {
4502 m_objs_array.Append(new_objs_array); 4503 m_objs_array.Append(new_objs_array);
4503 } 4504 }
4504 return bRet; 4505 return bRet;
4505 } 4506 }
4506 void CPDF_DataAvail::GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, 4507 void CPDF_DataAvail::GetLinearizedMainXRefInfo(FX_FILESIZE* pPos,
4507 FX_DWORD* pSize) { 4508 FX_DWORD* pSize) {
4508 if (pPos) { 4509 if (pPos) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
4563 return FormNotExist; 4564 return FormNotExist;
4564 } 4565 }
4565 if (!CheckLinearizedData(pHints)) { 4566 if (!CheckLinearizedData(pHints)) {
4566 return FormNotAvailable; 4567 return FormNotAvailable;
4567 } 4568 }
4568 if (!m_objs_array.GetSize()) { 4569 if (!m_objs_array.GetSize()) {
4569 m_objs_array.Add(pAcroForm->GetDict()); 4570 m_objs_array.Add(pAcroForm->GetDict());
4570 } 4571 }
4571 m_bLinearizedFormParamLoad = TRUE; 4572 m_bLinearizedFormParamLoad = TRUE;
4572 } 4573 }
4573 CFX_PtrArray new_objs_array; 4574 CFX_ArrayTemplate<CPDF_Object*> new_objs_array;
4574 FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array); 4575 FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array);
4575 m_objs_array.RemoveAll(); 4576 m_objs_array.RemoveAll();
4576 if (!bRet) { 4577 if (!bRet) {
4577 m_objs_array.Append(new_objs_array); 4578 m_objs_array.Append(new_objs_array);
4578 return FormNotAvailable; 4579 return FormNotAvailable;
4579 } 4580 }
4580 return FormAvailable; 4581 return FormAvailable;
4581 } 4582 }
4582 void CPDF_SortObjNumArray::AddObjNum(FX_DWORD dwObjNum) { 4583 void CPDF_SortObjNumArray::AddObjNum(FX_DWORD dwObjNum) {
4583 int32_t iNext = 0; 4584 int32_t iNext = 0;
(...skipping 18 matching lines...) Expand all
4602 if (m_number_array.GetAt(iMid) > value) { 4603 if (m_number_array.GetAt(iMid) > value) {
4603 iHigh = iMid - 1; 4604 iHigh = iMid - 1;
4604 } else if (m_number_array.GetAt(iMid) < value) { 4605 } else if (m_number_array.GetAt(iMid) < value) {
4605 iLow = iMid + 1; 4606 iLow = iMid + 1;
4606 } 4607 }
4607 } 4608 }
4608 iNext = iLow; 4609 iNext = iLow;
4609 return FALSE; 4610 return FALSE;
4610 } 4611 }
4611 CPDF_PageNode::~CPDF_PageNode() { 4612 CPDF_PageNode::~CPDF_PageNode() {
4612 int32_t iSize = m_childNode.GetSize(); 4613 for (int32_t i = 0; i < m_childNode.GetSize(); ++i) {
4613 for (int32_t i = 0; i < iSize; ++i) { 4614 delete m_childNode[i];
4614 CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i];
4615 delete pNode;
4616 } 4615 }
4617 m_childNode.RemoveAll(); 4616 m_childNode.RemoveAll();
4618 } 4617 }
4619 CPDF_HintTables::~CPDF_HintTables() { 4618 CPDF_HintTables::~CPDF_HintTables() {
4620 m_dwDeltaNObjsArray.RemoveAll(); 4619 m_dwDeltaNObjsArray.RemoveAll();
4621 m_dwNSharedObjsArray.RemoveAll(); 4620 m_dwNSharedObjsArray.RemoveAll();
4622 m_dwSharedObjNumArray.RemoveAll(); 4621 m_dwSharedObjNumArray.RemoveAll();
4623 m_dwIdentifierArray.RemoveAll(); 4622 m_dwIdentifierArray.RemoveAll();
4624 m_szPageOffsetArray.RemoveAll(); 4623 m_szPageOffsetArray.RemoveAll();
4625 m_szSharedObjOffsetArray.RemoveAll(); 4624 m_szSharedObjOffsetArray.RemoveAll();
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
4938 if (!m_pLinearizedDict) 4937 if (!m_pLinearizedDict)
4939 return -1; 4938 return -1;
4940 CPDF_Array* pRange = m_pLinearizedDict->GetArray(FX_BSTRC("H")); 4939 CPDF_Array* pRange = m_pLinearizedDict->GetArray(FX_BSTRC("H"));
4941 if (!pRange) 4940 if (!pRange)
4942 return -1; 4941 return -1;
4943 CPDF_Object* pStreamLen = pRange->GetElementValue(1); 4942 CPDF_Object* pStreamLen = pRange->GetElementValue(1);
4944 if (!pStreamLen) 4943 if (!pStreamLen)
4945 return -1; 4944 return -1;
4946 return pStreamLen->GetInteger(); 4945 return pStreamLen->GetInteger();
4947 } 4946 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp ('k') | core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698