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

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

Issue 1171733003: Remove typdefs for pointer types in fx_system.h (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual fixes. Created 5 years, 6 months 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 "../../../include/fpdfapi/fpdf_parser.h" 7 #include "../../../include/fpdfapi/fpdf_parser.h"
8 #include "../../../include/fxcrt/fx_string.h" 8 #include "../../../include/fxcrt/fx_string.h"
9 9
10 //static 10 //static
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 switch (m_Type) { 44 switch (m_Type) {
45 case PDFOBJ_BOOLEAN: 45 case PDFOBJ_BOOLEAN:
46 return ((CPDF_Boolean*)this)->m_bValue ? "true" : "false"; 46 return ((CPDF_Boolean*)this)->m_bValue ? "true" : "false";
47 case PDFOBJ_NUMBER: 47 case PDFOBJ_NUMBER:
48 return ((CPDF_Number*)this)->GetString(); 48 return ((CPDF_Number*)this)->GetString();
49 case PDFOBJ_STRING: 49 case PDFOBJ_STRING:
50 return ((CPDF_String*)this)->m_String; 50 return ((CPDF_String*)this)->m_String;
51 case PDFOBJ_NAME: 51 case PDFOBJ_NAME:
52 return ((CPDF_Name*)this)->m_Name; 52 return ((CPDF_Name*)this)->m_Name;
53 case PDFOBJ_REFERENCE: { 53 case PDFOBJ_REFERENCE: {
54 CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this; 54 CPDF_Reference* pRef = (CPDF_Reference*)(void*)this;
55 if (pRef->m_pObjList == NULL) { 55 if (pRef->m_pObjList == NULL) {
56 break; 56 break;
57 } 57 }
58 CPDF_Object* pObj = pRef->m_pObjList->GetIndirectObject(pRef->m_ RefObjNum); 58 CPDF_Object* pObj = pRef->m_pObjList->GetIndirectObject(pRef->m_ RefObjNum);
59 if (pObj == NULL) { 59 if (pObj == NULL) {
60 return CFX_ByteString(); 60 return CFX_ByteString();
61 } 61 }
62 return pObj->GetString(); 62 return pObj->GetString();
63 } 63 }
64 } 64 }
65 return CFX_ByteString(); 65 return CFX_ByteString();
66 } 66 }
67 CFX_ByteStringC CPDF_Object::GetConstString() const 67 CFX_ByteStringC CPDF_Object::GetConstString() const
68 { 68 {
69 switch (m_Type) { 69 switch (m_Type) {
70 case PDFOBJ_STRING: 70 case PDFOBJ_STRING:
71 return CFX_ByteStringC((FX_LPCBYTE)((CPDF_String*)this)->m_String, ( (CPDF_String*)this)->m_String.GetLength()); 71 return CFX_ByteStringC((const uint8_t*)((CPDF_String*)this)->m_Strin g, ((CPDF_String*)this)->m_String.GetLength());
72 case PDFOBJ_NAME: 72 case PDFOBJ_NAME:
73 return CFX_ByteStringC((FX_LPCBYTE)((CPDF_Name*)this)->m_Name, ((CPD F_Name*)this)->m_Name.GetLength()); 73 return CFX_ByteStringC((const uint8_t*)((CPDF_Name*)this)->m_Name, ( (CPDF_Name*)this)->m_Name.GetLength());
74 case PDFOBJ_REFERENCE: { 74 case PDFOBJ_REFERENCE: {
75 CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this; 75 CPDF_Reference* pRef = (CPDF_Reference*)(void*)this;
76 if (pRef->m_pObjList == NULL) { 76 if (pRef->m_pObjList == NULL) {
77 break; 77 break;
78 } 78 }
79 CPDF_Object* pObj = pRef->m_pObjList->GetIndirectObject(pRef->m_ RefObjNum); 79 CPDF_Object* pObj = pRef->m_pObjList->GetIndirectObject(pRef->m_ RefObjNum);
80 if (pObj == NULL) { 80 if (pObj == NULL) {
81 return CFX_ByteStringC(); 81 return CFX_ByteStringC();
82 } 82 }
83 return pObj->GetConstString(); 83 return pObj->GetConstString();
84 } 84 }
85 } 85 }
86 return CFX_ByteStringC(); 86 return CFX_ByteStringC();
87 } 87 }
88 FX_FLOAT CPDF_Object::GetNumber() const 88 FX_FLOAT CPDF_Object::GetNumber() const
89 { 89 {
90 switch (m_Type) { 90 switch (m_Type) {
91 case PDFOBJ_NUMBER: 91 case PDFOBJ_NUMBER:
92 return ((CPDF_Number*)this)->GetNumber(); 92 return ((CPDF_Number*)this)->GetNumber();
93 case PDFOBJ_REFERENCE: { 93 case PDFOBJ_REFERENCE: {
94 CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this; 94 CPDF_Reference* pRef = (CPDF_Reference*)(void*)this;
95 if (pRef->m_pObjList == NULL) { 95 if (pRef->m_pObjList == NULL) {
96 break; 96 break;
97 } 97 }
98 CPDF_Object* pObj = pRef->m_pObjList->GetIndirectObject(pRef->m_ RefObjNum); 98 CPDF_Object* pObj = pRef->m_pObjList->GetIndirectObject(pRef->m_ RefObjNum);
99 if (pObj == NULL) { 99 if (pObj == NULL) {
100 return 0; 100 return 0;
101 } 101 }
102 return pObj->GetNumber(); 102 return pObj->GetNumber();
103 } 103 }
104 } 104 }
105 return 0; 105 return 0;
106 } 106 }
107 FX_FLOAT CPDF_Object::GetNumber16() const 107 FX_FLOAT CPDF_Object::GetNumber16() const
108 { 108 {
109 return GetNumber(); 109 return GetNumber();
110 } 110 }
111 int CPDF_Object::GetInteger() const 111 int CPDF_Object::GetInteger() const
112 { 112 {
113 CFX_AutoRestorer<int> restorer(&s_nCurRefDepth); 113 CFX_AutoRestorer<int> restorer(&s_nCurRefDepth);
114 if (++s_nCurRefDepth > OBJECT_REF_MAX_DEPTH) { 114 if (++s_nCurRefDepth > OBJECT_REF_MAX_DEPTH) {
115 return 0; 115 return 0;
116 } 116 }
117 switch (m_Type) { 117 switch (m_Type) {
118 case PDFOBJ_BOOLEAN: 118 case PDFOBJ_BOOLEAN:
119 return ((CPDF_Boolean*)this)->m_bValue; 119 return ((CPDF_Boolean*)this)->m_bValue;
120 case PDFOBJ_NUMBER: 120 case PDFOBJ_NUMBER:
121 return ((CPDF_Number*)this)->GetInteger(); 121 return ((CPDF_Number*)this)->GetInteger();
122 case PDFOBJ_REFERENCE: { 122 case PDFOBJ_REFERENCE: {
123 CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this; 123 CPDF_Reference* pRef = (CPDF_Reference*)(void*)this;
124 PARSE_CONTEXT context; 124 PARSE_CONTEXT context;
125 FXSYS_memset32(&context, 0, sizeof(PARSE_CONTEXT)); 125 FXSYS_memset32(&context, 0, sizeof(PARSE_CONTEXT));
126 if (pRef->m_pObjList == NULL) { 126 if (pRef->m_pObjList == NULL) {
127 return 0; 127 return 0;
128 } 128 }
129 CPDF_Object* pObj = pRef->m_pObjList->GetIndirectObject(pRef->m_ RefObjNum, &context); 129 CPDF_Object* pObj = pRef->m_pObjList->GetIndirectObject(pRef->m_ RefObjNum, &context);
130 if (pObj == NULL) { 130 if (pObj == NULL) {
131 return 0; 131 return 0;
132 } 132 }
133 return pObj->GetInteger(); 133 return pObj->GetInteger();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 case PDFOBJ_REFERENCE: 226 case PDFOBJ_REFERENCE:
227 return (((CPDF_Reference*)this)->Identical((CPDF_Reference*)pOther)) ; 227 return (((CPDF_Reference*)this)->Identical((CPDF_Reference*)pOther)) ;
228 } 228 }
229 return FALSE; 229 return FALSE;
230 } 230 }
231 CPDF_Object* CPDF_Object::GetDirect() const 231 CPDF_Object* CPDF_Object::GetDirect() const
232 { 232 {
233 if (m_Type != PDFOBJ_REFERENCE) { 233 if (m_Type != PDFOBJ_REFERENCE) {
234 return (CPDF_Object*)this; 234 return (CPDF_Object*)this;
235 } 235 }
236 CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this; 236 CPDF_Reference* pRef = (CPDF_Reference*)(void*)this;
237 if (pRef->m_pObjList == NULL) { 237 if (pRef->m_pObjList == NULL) {
238 return NULL; 238 return NULL;
239 } 239 }
240 return pRef->m_pObjList->GetIndirectObject(pRef->m_RefObjNum); 240 return pRef->m_pObjList->GetIndirectObject(pRef->m_RefObjNum);
241 } 241 }
242 CPDF_Object* CPDF_Object::Clone(FX_BOOL bDirect) const 242 CPDF_Object* CPDF_Object::Clone(FX_BOOL bDirect) const
243 { 243 {
244 CFX_MapPtrToPtr visited; 244 CFX_MapPtrToPtr visited;
245 return CloneInternal(bDirect, &visited); 245 return CloneInternal(bDirect, &visited);
246 } 246 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 } else if (m_Type == PDFOBJ_STREAM) { 324 } else if (m_Type == PDFOBJ_STREAM) {
325 CPDF_StreamAcc stream; 325 CPDF_StreamAcc stream;
326 stream.LoadAllData((CPDF_Stream*)this, FALSE); 326 stream.LoadAllData((CPDF_Stream*)this, FALSE);
327 CFX_WideString result = PDF_DecodeText(stream.GetData(), stream.GetSize( ), pCharMap); 327 CFX_WideString result = PDF_DecodeText(stream.GetData(), stream.GetSize( ), pCharMap);
328 return result; 328 return result;
329 } else if (m_Type == PDFOBJ_NAME) { 329 } else if (m_Type == PDFOBJ_NAME) {
330 return PDF_DecodeText(((CPDF_Name*)this)->m_Name, pCharMap); 330 return PDF_DecodeText(((CPDF_Name*)this)->m_Name, pCharMap);
331 } 331 }
332 return CFX_WideString(); 332 return CFX_WideString();
333 } 333 }
334 void CPDF_Object::SetUnicodeText(FX_LPCWSTR pUnicodes, int len) 334 void CPDF_Object::SetUnicodeText(const FX_WCHAR* pUnicodes, int len)
335 { 335 {
336 if (m_Type == PDFOBJ_STRING) { 336 if (m_Type == PDFOBJ_STRING) {
337 ((CPDF_String*)this)->m_String = PDF_EncodeText(pUnicodes, len); 337 ((CPDF_String*)this)->m_String = PDF_EncodeText(pUnicodes, len);
338 } else if (m_Type == PDFOBJ_STREAM) { 338 } else if (m_Type == PDFOBJ_STREAM) {
339 CFX_ByteString result = PDF_EncodeText(pUnicodes, len); 339 CFX_ByteString result = PDF_EncodeText(pUnicodes, len);
340 ((CPDF_Stream*)this)->SetData((FX_LPBYTE)result.c_str(), result.GetLengt h(), FALSE, FALSE); 340 ((CPDF_Stream*)this)->SetData((uint8_t*)result.c_str(), result.GetLength (), FALSE, FALSE);
341 } 341 }
342 } 342 }
343 343
344 CPDF_Number::CPDF_Number(int value) 344 CPDF_Number::CPDF_Number(int value)
345 : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(TRUE), m_Integer(value) { 345 : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(TRUE), m_Integer(value) {
346 } 346 }
347 347
348 CPDF_Number::CPDF_Number(FX_FLOAT value) 348 CPDF_Number::CPDF_Number(FX_FLOAT value)
349 : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(FALSE), m_Float(value) { 349 : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(FALSE), m_Float(value) {
350 } 350 }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 for (int i = 0; i < m_Objects.GetSize(); i ++) 563 for (int i = 0; i < m_Objects.GetSize(); i ++)
564 if (!((CPDF_Object*)m_Objects[i])->IsIdentical((CPDF_Object*)pOther->m_O bjects[i])) { 564 if (!((CPDF_Object*)m_Objects[i])->IsIdentical((CPDF_Object*)pOther->m_O bjects[i])) {
565 return FALSE; 565 return FALSE;
566 } 566 }
567 return TRUE; 567 return TRUE;
568 } 568 }
569 CPDF_Dictionary::~CPDF_Dictionary() 569 CPDF_Dictionary::~CPDF_Dictionary()
570 { 570 {
571 FX_POSITION pos = m_Map.GetStartPosition(); 571 FX_POSITION pos = m_Map.GetStartPosition();
572 while (pos) { 572 while (pos) {
573 FX_LPVOID value = m_Map.GetNextValue(pos); 573 void* value = m_Map.GetNextValue(pos);
574 if (value) 574 if (value)
575 ((CPDF_Object*)value)->Release(); 575 ((CPDF_Object*)value)->Release();
576 } 576 }
577 } 577 }
578 FX_POSITION CPDF_Dictionary::GetStartPos() const 578 FX_POSITION CPDF_Dictionary::GetStartPos() const
579 { 579 {
580 return m_Map.GetStartPosition(); 580 return m_Map.GetStartPosition();
581 } 581 }
582 CPDF_Object* CPDF_Dictionary::GetNextElement(FX_POSITION& pos, CFX_ByteString& k ey) const 582 CPDF_Object* CPDF_Dictionary::GetNextElement(FX_POSITION& pos, CFX_ByteString& k ey) const
583 { 583 {
584 if (pos == NULL) { 584 if (pos == NULL) {
585 return NULL; 585 return NULL;
586 } 586 }
587 CPDF_Object* p; 587 CPDF_Object* p;
588 m_Map.GetNextAssoc(pos, key, (FX_LPVOID&)p); 588 m_Map.GetNextAssoc(pos, key, (void*&)p);
589 return p; 589 return p;
590 } 590 }
591 CPDF_Object* CPDF_Dictionary::GetElement(FX_BSTR key) const 591 CPDF_Object* CPDF_Dictionary::GetElement(FX_BSTR key) const
592 { 592 {
593 CPDF_Object* p = NULL; 593 CPDF_Object* p = NULL;
594 m_Map.Lookup(key, (void*&)p); 594 m_Map.Lookup(key, (void*&)p);
595 return p; 595 return p;
596 } 596 }
597 CPDF_Object* CPDF_Dictionary::GetElementValue(FX_BSTR key) const 597 CPDF_Object* CPDF_Dictionary::GetElementValue(FX_BSTR key) const
598 { 598 {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 { 729 {
730 CFX_AffineMatrix matrix; 730 CFX_AffineMatrix matrix;
731 CPDF_Array* pArray = GetArray(key); 731 CPDF_Array* pArray = GetArray(key);
732 if (pArray) { 732 if (pArray) {
733 matrix = pArray->GetMatrix(); 733 matrix = pArray->GetMatrix();
734 } 734 }
735 return matrix; 735 return matrix;
736 } 736 }
737 FX_BOOL CPDF_Dictionary::KeyExist(FX_BSTR key) const 737 FX_BOOL CPDF_Dictionary::KeyExist(FX_BSTR key) const
738 { 738 {
739 FX_LPVOID value; 739 void* value;
740 return m_Map.Lookup(key, value); 740 return m_Map.Lookup(key, value);
741 } 741 }
742 void CPDF_Dictionary::SetAt(FX_BSTR key, CPDF_Object* pObj, CPDF_IndirectObjects * pObjs) 742 void CPDF_Dictionary::SetAt(FX_BSTR key, CPDF_Object* pObj, CPDF_IndirectObjects * pObjs)
743 { 743 {
744 ASSERT(m_Type == PDFOBJ_DICTIONARY); 744 ASSERT(m_Type == PDFOBJ_DICTIONARY);
745 CPDF_Object* p = NULL; 745 CPDF_Object* p = NULL;
746 m_Map.Lookup(key, (void*&)p); 746 m_Map.Lookup(key, (void*&)p);
747 if (p == pObj) { 747 if (p == pObj) {
748 return; 748 return;
749 } 749 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 { 790 {
791 if (pOther == NULL) { 791 if (pOther == NULL) {
792 return FALSE; 792 return FALSE;
793 } 793 }
794 if (m_Map.GetCount() != pOther->m_Map.GetCount()) { 794 if (m_Map.GetCount() != pOther->m_Map.GetCount()) {
795 return FALSE; 795 return FALSE;
796 } 796 }
797 FX_POSITION pos = m_Map.GetStartPosition(); 797 FX_POSITION pos = m_Map.GetStartPosition();
798 while (pos) { 798 while (pos) {
799 CFX_ByteString key; 799 CFX_ByteString key;
800 FX_LPVOID value; 800 void* value;
801 m_Map.GetNextAssoc(pos, key, value); 801 m_Map.GetNextAssoc(pos, key, value);
802 if (!value) 802 if (!value)
803 return FALSE; 803 return FALSE;
804 if (!((CPDF_Object*)value)->IsIdentical(pOther->GetElement(key))) { 804 if (!((CPDF_Object*)value)->IsIdentical(pOther->GetElement(key))) {
805 return FALSE; 805 return FALSE;
806 } 806 }
807 } 807 }
808 return TRUE; 808 return TRUE;
809 } 809 }
810 void CPDF_Dictionary::SetAtInteger(FX_BSTR key, int i) 810 void CPDF_Dictionary::SetAtInteger(FX_BSTR key, int i)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 { 850 {
851 CPDF_Array* pArray = new CPDF_Array; 851 CPDF_Array* pArray = new CPDF_Array;
852 pArray->AddNumber16(matrix.a); 852 pArray->AddNumber16(matrix.a);
853 pArray->AddNumber16(matrix.b); 853 pArray->AddNumber16(matrix.b);
854 pArray->AddNumber16(matrix.c); 854 pArray->AddNumber16(matrix.c);
855 pArray->AddNumber16(matrix.d); 855 pArray->AddNumber16(matrix.d);
856 pArray->AddNumber(matrix.e); 856 pArray->AddNumber(matrix.e);
857 pArray->AddNumber(matrix.f); 857 pArray->AddNumber(matrix.f);
858 SetAt(key, pArray); 858 SetAt(key, pArray);
859 } 859 }
860 CPDF_Stream::CPDF_Stream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pDict) 860 CPDF_Stream::CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict)
861 : CPDF_Object(PDFOBJ_STREAM) { 861 : CPDF_Object(PDFOBJ_STREAM) {
862 m_pDict = pDict; 862 m_pDict = pDict;
863 m_dwSize = size; 863 m_dwSize = size;
864 m_GenNum = (FX_DWORD) - 1; 864 m_GenNum = (FX_DWORD) - 1;
865 m_pDataBuf = pData; 865 m_pDataBuf = pData;
866 m_pCryptoHandler = NULL; 866 m_pCryptoHandler = NULL;
867 } 867 }
868 CPDF_Stream::~CPDF_Stream() 868 CPDF_Stream::~CPDF_Stream()
869 { 869 {
870 if (m_GenNum == (FX_DWORD) - 1 && m_pDataBuf != NULL) { 870 if (m_GenNum == (FX_DWORD) - 1 && m_pDataBuf != NULL) {
(...skipping 14 matching lines...) Expand all
885 if (m_GenNum == (FX_DWORD) - 1) { 885 if (m_GenNum == (FX_DWORD) - 1) {
886 if (m_pDataBuf) { 886 if (m_pDataBuf) {
887 FX_Free(m_pDataBuf); 887 FX_Free(m_pDataBuf);
888 } 888 }
889 } 889 }
890 m_GenNum = 0; 890 m_GenNum = 0;
891 m_pFile = NULL; 891 m_pFile = NULL;
892 m_pCryptoHandler = NULL; 892 m_pCryptoHandler = NULL;
893 m_FileOffset = 0; 893 m_FileOffset = 0;
894 } 894 }
895 void CPDF_Stream::InitStream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pD ict) 895 void CPDF_Stream::InitStream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDi ct)
896 { 896 {
897 InitStream(pDict); 897 InitStream(pDict);
898 m_GenNum = (FX_DWORD) - 1; 898 m_GenNum = (FX_DWORD) - 1;
899 m_pDataBuf = FX_Alloc(uint8_t, size); 899 m_pDataBuf = FX_Alloc(uint8_t, size);
900 if (pData) { 900 if (pData) {
901 FXSYS_memcpy32(m_pDataBuf, pData, size); 901 FXSYS_memcpy32(m_pDataBuf, pData, size);
902 } 902 }
903 m_dwSize = size; 903 m_dwSize = size;
904 if (m_pDict) { 904 if (m_pDict) {
905 m_pDict->SetAtInteger(FX_BSTRC("Length"), size); 905 m_pDict->SetAtInteger(FX_BSTRC("Length"), size);
906 } 906 }
907 } 907 }
908 void CPDF_Stream::SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed, FX_BOOL bKeepBuf) 908 void CPDF_Stream::SetData(const uint8_t* pData, FX_DWORD size, FX_BOOL bCompress ed, FX_BOOL bKeepBuf)
909 { 909 {
910 if (m_GenNum == (FX_DWORD) - 1) { 910 if (m_GenNum == (FX_DWORD) - 1) {
911 if (m_pDataBuf) { 911 if (m_pDataBuf) {
912 FX_Free(m_pDataBuf); 912 FX_Free(m_pDataBuf);
913 } 913 }
914 } else { 914 } else {
915 m_GenNum = (FX_DWORD) - 1; 915 m_GenNum = (FX_DWORD) - 1;
916 m_pCryptoHandler = NULL; 916 m_pCryptoHandler = NULL;
917 } 917 }
918 if (bKeepBuf) { 918 if (bKeepBuf) {
919 m_pDataBuf = (FX_LPBYTE)pData; 919 m_pDataBuf = (uint8_t*)pData;
920 } else { 920 } else {
921 m_pDataBuf = FX_Alloc(uint8_t, size); 921 m_pDataBuf = FX_Alloc(uint8_t, size);
922 if (pData) { 922 if (pData) {
923 FXSYS_memcpy32(m_pDataBuf, pData, size); 923 FXSYS_memcpy32(m_pDataBuf, pData, size);
924 } 924 }
925 } 925 }
926 m_dwSize = size; 926 m_dwSize = size;
927 if (m_pDict == NULL) { 927 if (m_pDict == NULL) {
928 m_pDict = new CPDF_Dictionary; 928 m_pDict = new CPDF_Dictionary;
929 } 929 }
930 m_pDict->SetAtInteger(FX_BSTRC("Length"), size); 930 m_pDict->SetAtInteger(FX_BSTRC("Length"), size);
931 if (!bCompressed) { 931 if (!bCompressed) {
932 m_pDict->RemoveAt(FX_BSTRC("Filter")); 932 m_pDict->RemoveAt(FX_BSTRC("Filter"));
933 m_pDict->RemoveAt(FX_BSTRC("DecodeParms")); 933 m_pDict->RemoveAt(FX_BSTRC("DecodeParms"));
934 } 934 }
935 } 935 }
936 FX_BOOL CPDF_Stream::ReadRawData(FX_FILESIZE offset, FX_LPBYTE buf, FX_DWORD siz e) const 936 FX_BOOL CPDF_Stream::ReadRawData(FX_FILESIZE offset, uint8_t* buf, FX_DWORD size ) const
937 { 937 {
938 if ((m_GenNum != (FX_DWORD) - 1) && m_pFile) { 938 if ((m_GenNum != (FX_DWORD) - 1) && m_pFile) {
939 return m_pFile->ReadBlock(buf, m_FileOffset + offset, size); 939 return m_pFile->ReadBlock(buf, m_FileOffset + offset, size);
940 } 940 }
941 if (m_pDataBuf) { 941 if (m_pDataBuf) {
942 FXSYS_memcpy32(buf, m_pDataBuf + offset, size); 942 FXSYS_memcpy32(buf, m_pDataBuf + offset, size);
943 } 943 }
944 return TRUE; 944 return TRUE;
945 } 945 }
946 void CPDF_Stream::InitStream(IFX_FileRead *pFile, CPDF_Dictionary* pDict) 946 void CPDF_Stream::InitStream(IFX_FileRead *pFile, CPDF_Dictionary* pDict)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 return FALSE; 986 return FALSE;
987 } 987 }
988 size -= actualSize; 988 size -= actualSize;
989 srcOffset += actualSize; 989 srcOffset += actualSize;
990 destOffset += actualSize; 990 destOffset += actualSize;
991 } 991 }
992 return TRUE; 992 return TRUE;
993 } 993 }
994 if (m_GenNum != (FX_DWORD) - 1 || pOther->m_GenNum != (FX_DWORD) - 1) { 994 if (m_GenNum != (FX_DWORD) - 1 || pOther->m_GenNum != (FX_DWORD) - 1) {
995 IFX_FileRead* pFile = NULL; 995 IFX_FileRead* pFile = NULL;
996 FX_LPBYTE pBuf = NULL; 996 uint8_t* pBuf = NULL;
997 FX_DWORD offset = 0; 997 FX_DWORD offset = 0;
998 if (pOther->m_GenNum != (FX_DWORD) - 1) { 998 if (pOther->m_GenNum != (FX_DWORD) - 1) {
999 pFile = pOther->m_pFile; 999 pFile = pOther->m_pFile;
1000 pBuf = m_pDataBuf; 1000 pBuf = m_pDataBuf;
1001 offset = pOther->m_FileOffset; 1001 offset = pOther->m_FileOffset;
1002 } else if (m_GenNum != (FX_DWORD) - 1) { 1002 } else if (m_GenNum != (FX_DWORD) - 1) {
1003 pFile = m_pFile; 1003 pFile = m_pFile;
1004 pBuf = pOther->m_pDataBuf; 1004 pBuf = pOther->m_pDataBuf;
1005 offset = m_FileOffset; 1005 offset = m_FileOffset;
1006 } 1006 }
1007 if (NULL == pBuf) { 1007 if (NULL == pBuf) {
1008 return FALSE; 1008 return FALSE;
1009 } 1009 }
1010 uint8_t srcBuf[1024]; 1010 uint8_t srcBuf[1024];
1011 FX_DWORD size = m_dwSize; 1011 FX_DWORD size = m_dwSize;
1012 while (size > 0) { 1012 while (size > 0) {
1013 FX_DWORD actualSize = std::min(size, 1024U); 1013 FX_DWORD actualSize = std::min(size, 1024U);
1014 pFile->ReadBlock(srcBuf, offset, actualSize); 1014 pFile->ReadBlock(srcBuf, offset, actualSize);
1015 if (FXSYS_memcmp32(srcBuf, pBuf, actualSize) != 0) { 1015 if (FXSYS_memcmp32(srcBuf, pBuf, actualSize) != 0) {
1016 return FALSE; 1016 return FALSE;
1017 } 1017 }
1018 pBuf += actualSize; 1018 pBuf += actualSize;
1019 size -= actualSize; 1019 size -= actualSize;
1020 offset += actualSize; 1020 offset += actualSize;
1021 } 1021 }
1022 return TRUE; 1022 return TRUE;
1023 } 1023 }
1024 return FXSYS_memcmp32(m_pDataBuf, pOther->m_pDataBuf, m_dwSize) == 0; 1024 return FXSYS_memcmp32(m_pDataBuf, pOther->m_pDataBuf, m_dwSize) == 0;
1025 } 1025 }
1026 CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpf Callback, FX_LPVOID pUserData) const 1026 CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpf Callback, void* pUserData) const
1027 { 1027 {
1028 CPDF_Dictionary *pCloneDict = (CPDF_Dictionary*)m_pDict->Clone(bDirect); 1028 CPDF_Dictionary *pCloneDict = (CPDF_Dictionary*)m_pDict->Clone(bDirect);
1029 IFX_FileStream *pFS = NULL; 1029 IFX_FileStream *pFS = NULL;
1030 if (lpfCallback) { 1030 if (lpfCallback) {
1031 pFS = lpfCallback((CPDF_Stream*)this, pUserData); 1031 pFS = lpfCallback((CPDF_Stream*)this, pUserData);
1032 } 1032 }
1033 if (!pFS) { 1033 if (!pFS) {
1034 CPDF_StreamAcc acc; 1034 CPDF_StreamAcc acc;
1035 acc.LoadAllData(this, TRUE); 1035 acc.LoadAllData(this, TRUE);
1036 FX_DWORD streamSize = acc.GetSize(); 1036 FX_DWORD streamSize = acc.GetSize();
1037 return new CPDF_Stream(acc.DetachData(), streamSize, pCloneDict); 1037 return new CPDF_Stream(acc.DetachData(), streamSize, pCloneDict);
1038 } 1038 }
1039 CPDF_Stream* pObj = new CPDF_Stream(NULL, 0, NULL); 1039 CPDF_Stream* pObj = new CPDF_Stream(NULL, 0, NULL);
1040 CPDF_StreamFilter *pSF = GetStreamFilter(TRUE); 1040 CPDF_StreamFilter *pSF = GetStreamFilter(TRUE);
1041 if (pSF) { 1041 if (pSF) {
1042 FX_LPBYTE pBuf = FX_Alloc(uint8_t, 4096); 1042 uint8_t* pBuf = FX_Alloc(uint8_t, 4096);
1043 FX_DWORD dwRead; 1043 FX_DWORD dwRead;
1044 do { 1044 do {
1045 dwRead = pSF->ReadBlock(pBuf, 4096); 1045 dwRead = pSF->ReadBlock(pBuf, 4096);
1046 if (dwRead) { 1046 if (dwRead) {
1047 pFS->WriteBlock(pBuf, dwRead); 1047 pFS->WriteBlock(pBuf, dwRead);
1048 } 1048 }
1049 } while (dwRead == 4096); 1049 } while (dwRead == 4096);
1050 pFS->Flush(); 1050 pFS->Flush();
1051 FX_Free(pBuf); 1051 FX_Free(pBuf);
1052 delete pSF; 1052 delete pSF;
1053 } 1053 }
1054 pObj->InitStream((IFX_FileRead*)pFS, pCloneDict); 1054 pObj->InitStream((IFX_FileRead*)pFS, pCloneDict);
1055 return pObj; 1055 return pObj;
1056 } 1056 }
1057 extern FX_BOOL PDF_DataDecode(FX_LPCBYTE src_buf, FX_DWORD src_size, const CPDF_ Dictionary* pDict, 1057 extern FX_BOOL PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const C PDF_Dictionary* pDict,
1058 FX_LPBYTE& dest_buf, FX_DWORD& dest_size, CFX_Byte String& ImageEncoding, 1058 uint8_t*& dest_buf, FX_DWORD& dest_size, CFX_ByteS tring& ImageEncoding,
1059 CPDF_Dictionary*& pImageParms, FX_DWORD estimated_ size, FX_BOOL bImageAcc); 1059 CPDF_Dictionary*& pImageParms, FX_DWORD estimated_ size, FX_BOOL bImageAcc);
1060 CPDF_StreamAcc::CPDF_StreamAcc() 1060 CPDF_StreamAcc::CPDF_StreamAcc()
1061 { 1061 {
1062 m_bNewBuf = FALSE; 1062 m_bNewBuf = FALSE;
1063 m_pData = NULL; 1063 m_pData = NULL;
1064 m_dwSize = 0; 1064 m_dwSize = 0;
1065 m_pImageParam = NULL; 1065 m_pImageParam = NULL;
1066 m_pStream = NULL; 1066 m_pStream = NULL;
1067 m_pSrcData = NULL; 1067 m_pSrcData = NULL;
1068 } 1068 }
1069 void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, FX_BOOL bRawAccess, FX_DWORD estimated_size, 1069 void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, FX_BOOL bRawAccess, FX_DWORD estimated_size,
1070 FX_BOOL bImageAcc) 1070 FX_BOOL bImageAcc)
1071 { 1071 {
1072 if (pStream == NULL || pStream->GetType() != PDFOBJ_STREAM) { 1072 if (pStream == NULL || pStream->GetType() != PDFOBJ_STREAM) {
1073 return; 1073 return;
1074 } 1074 }
1075 m_pStream = pStream; 1075 m_pStream = pStream;
1076 if (pStream->IsMemoryBased() && 1076 if (pStream->IsMemoryBased() &&
1077 (!pStream->GetDict()->KeyExist(FX_BSTRC("Filter")) || bRawAccess)) { 1077 (!pStream->GetDict()->KeyExist(FX_BSTRC("Filter")) || bRawAccess)) {
1078 m_dwSize = pStream->m_dwSize; 1078 m_dwSize = pStream->m_dwSize;
1079 m_pData = (FX_LPBYTE)pStream->m_pDataBuf; 1079 m_pData = (uint8_t*)pStream->m_pDataBuf;
1080 return; 1080 return;
1081 } 1081 }
1082 FX_LPBYTE pSrcData; 1082 uint8_t* pSrcData;
1083 FX_DWORD dwSrcSize = pStream->m_dwSize; 1083 FX_DWORD dwSrcSize = pStream->m_dwSize;
1084 if (dwSrcSize == 0) { 1084 if (dwSrcSize == 0) {
1085 return; 1085 return;
1086 } 1086 }
1087 if (!pStream->IsMemoryBased()) { 1087 if (!pStream->IsMemoryBased()) {
1088 pSrcData = m_pSrcData = FX_Alloc(uint8_t, dwSrcSize); 1088 pSrcData = m_pSrcData = FX_Alloc(uint8_t, dwSrcSize);
1089 if (!pStream->ReadRawData(0, pSrcData, dwSrcSize)) { 1089 if (!pStream->ReadRawData(0, pSrcData, dwSrcSize)) {
1090 return; 1090 return;
1091 } 1091 }
1092 } else { 1092 } else {
1093 pSrcData = pStream->m_pDataBuf; 1093 pSrcData = pStream->m_pDataBuf;
1094 } 1094 }
1095 FX_LPBYTE pDecryptedData; 1095 uint8_t* pDecryptedData;
1096 FX_DWORD dwDecryptedSize; 1096 FX_DWORD dwDecryptedSize;
1097 if (pStream->m_pCryptoHandler) { 1097 if (pStream->m_pCryptoHandler) {
1098 CFX_BinaryBuf dest_buf; 1098 CFX_BinaryBuf dest_buf;
1099 dest_buf.EstimateSize(pStream->m_pCryptoHandler->DecryptGetSize(dwSrcSiz e)); 1099 dest_buf.EstimateSize(pStream->m_pCryptoHandler->DecryptGetSize(dwSrcSiz e));
1100 FX_LPVOID context = pStream->m_pCryptoHandler->DecryptStart(pStream->Get ObjNum(), pStream->m_GenNum); 1100 void* context = pStream->m_pCryptoHandler->DecryptStart(pStream->GetObjN um(), pStream->m_GenNum);
1101 pStream->m_pCryptoHandler->DecryptStream(context, pSrcData, dwSrcSize, d est_buf); 1101 pStream->m_pCryptoHandler->DecryptStream(context, pSrcData, dwSrcSize, d est_buf);
1102 pStream->m_pCryptoHandler->DecryptFinish(context, dest_buf); 1102 pStream->m_pCryptoHandler->DecryptFinish(context, dest_buf);
1103 pDecryptedData = dest_buf.GetBuffer(); 1103 pDecryptedData = dest_buf.GetBuffer();
1104 dwDecryptedSize = dest_buf.GetSize(); 1104 dwDecryptedSize = dest_buf.GetSize();
1105 dest_buf.DetachBuffer(); 1105 dest_buf.DetachBuffer();
1106 } else { 1106 } else {
1107 pDecryptedData = pSrcData; 1107 pDecryptedData = pSrcData;
1108 dwDecryptedSize = dwSrcSize; 1108 dwDecryptedSize = dwSrcSize;
1109 } 1109 }
1110 if (!pStream->GetDict()->KeyExist(FX_BSTRC("Filter")) || bRawAccess) { 1110 if (!pStream->GetDict()->KeyExist(FX_BSTRC("Filter")) || bRawAccess) {
(...skipping 18 matching lines...) Expand all
1129 } 1129 }
1130 CPDF_StreamAcc::~CPDF_StreamAcc() 1130 CPDF_StreamAcc::~CPDF_StreamAcc()
1131 { 1131 {
1132 if (m_bNewBuf && m_pData) { 1132 if (m_bNewBuf && m_pData) {
1133 FX_Free(m_pData); 1133 FX_Free(m_pData);
1134 } 1134 }
1135 if (m_pSrcData) { 1135 if (m_pSrcData) {
1136 FX_Free(m_pSrcData); 1136 FX_Free(m_pSrcData);
1137 } 1137 }
1138 } 1138 }
1139 FX_LPCBYTE CPDF_StreamAcc::GetData() const 1139 const uint8_t* CPDF_StreamAcc::GetData() const
1140 { 1140 {
1141 if (m_bNewBuf) { 1141 if (m_bNewBuf) {
1142 return m_pData; 1142 return m_pData;
1143 } 1143 }
1144 if (!m_pStream) { 1144 if (!m_pStream) {
1145 return NULL; 1145 return NULL;
1146 } 1146 }
1147 return m_pStream->m_pDataBuf; 1147 return m_pStream->m_pDataBuf;
1148 } 1148 }
1149 FX_DWORD CPDF_StreamAcc::GetSize() const 1149 FX_DWORD CPDF_StreamAcc::GetSize() const
1150 { 1150 {
1151 if (m_bNewBuf) { 1151 if (m_bNewBuf) {
1152 return m_dwSize; 1152 return m_dwSize;
1153 } 1153 }
1154 if (!m_pStream) { 1154 if (!m_pStream) {
1155 return 0; 1155 return 0;
1156 } 1156 }
1157 return m_pStream->m_dwSize; 1157 return m_pStream->m_dwSize;
1158 } 1158 }
1159 FX_LPBYTE CPDF_StreamAcc::DetachData() 1159 uint8_t* CPDF_StreamAcc::DetachData()
1160 { 1160 {
1161 if (m_bNewBuf) { 1161 if (m_bNewBuf) {
1162 FX_LPBYTE p = m_pData; 1162 uint8_t* p = m_pData;
1163 m_pData = NULL; 1163 m_pData = NULL;
1164 m_dwSize = 0; 1164 m_dwSize = 0;
1165 return p; 1165 return p;
1166 } 1166 }
1167 FX_LPBYTE p = FX_Alloc(uint8_t, m_dwSize); 1167 uint8_t* p = FX_Alloc(uint8_t, m_dwSize);
1168 FXSYS_memcpy32(p, m_pData, m_dwSize); 1168 FXSYS_memcpy32(p, m_pData, m_dwSize);
1169 return p; 1169 return p;
1170 } 1170 }
1171 void CPDF_Reference::SetRef(CPDF_IndirectObjects* pDoc, FX_DWORD objnum) 1171 void CPDF_Reference::SetRef(CPDF_IndirectObjects* pDoc, FX_DWORD objnum)
1172 { 1172 {
1173 m_pObjList = pDoc; 1173 m_pObjList = pDoc;
1174 m_RefObjNum = objnum; 1174 m_RefObjNum = objnum;
1175 } 1175 }
1176 CPDF_IndirectObjects::CPDF_IndirectObjects(CPDF_Parser* pParser) 1176 CPDF_IndirectObjects::CPDF_IndirectObjects(CPDF_Parser* pParser)
1177 { 1177 {
1178 m_pParser = pParser; 1178 m_pParser = pParser;
1179 m_IndirectObjs.InitHashTable(1013); 1179 m_IndirectObjs.InitHashTable(1013);
1180 if (pParser) { 1180 if (pParser) {
1181 m_LastObjNum = m_pParser->GetLastObjNum(); 1181 m_LastObjNum = m_pParser->GetLastObjNum();
1182 } else { 1182 } else {
1183 m_LastObjNum = 0; 1183 m_LastObjNum = 0;
1184 } 1184 }
1185 } 1185 }
1186 CPDF_IndirectObjects::~CPDF_IndirectObjects() 1186 CPDF_IndirectObjects::~CPDF_IndirectObjects()
1187 { 1187 {
1188 FX_POSITION pos = m_IndirectObjs.GetStartPosition(); 1188 FX_POSITION pos = m_IndirectObjs.GetStartPosition();
1189 while (pos) { 1189 while (pos) {
1190 FX_LPVOID key, value; 1190 void* key;
1191 void* value;
1191 m_IndirectObjs.GetNextAssoc(pos, key, value); 1192 m_IndirectObjs.GetNextAssoc(pos, key, value);
1192 ((CPDF_Object*)value)->Destroy(); 1193 ((CPDF_Object*)value)->Destroy();
1193 } 1194 }
1194 } 1195 }
1195 CPDF_Object* CPDF_IndirectObjects::GetIndirectObject(FX_DWORD objnum, struct PAR SE_CONTEXT* pContext) 1196 CPDF_Object* CPDF_IndirectObjects::GetIndirectObject(FX_DWORD objnum, struct PAR SE_CONTEXT* pContext)
1196 { 1197 {
1197 if (objnum == 0) { 1198 if (objnum == 0) {
1198 return NULL; 1199 return NULL;
1199 } 1200 }
1200 FX_LPVOID value; 1201 void* value;
1201 { 1202 {
1202 if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { 1203 if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) {
1203 if (((CPDF_Object*)value)->GetObjNum() == -1) { 1204 if (((CPDF_Object*)value)->GetObjNum() == -1) {
1204 return NULL; 1205 return NULL;
1205 } 1206 }
1206 return (CPDF_Object*)value; 1207 return (CPDF_Object*)value;
1207 } 1208 }
1208 } 1209 }
1209 CPDF_Object* pObj = NULL; 1210 CPDF_Object* pObj = NULL;
1210 if (m_pParser) { 1211 if (m_pParser) {
1211 pObj = m_pParser->ParseIndirectObject(this, objnum, pContext); 1212 pObj = m_pParser->ParseIndirectObject(this, objnum, pContext);
1212 } 1213 }
1213 if (pObj == NULL) { 1214 if (pObj == NULL) {
1214 return NULL; 1215 return NULL;
1215 } 1216 }
1216 pObj->m_ObjNum = objnum; 1217 pObj->m_ObjNum = objnum;
1217 if (m_LastObjNum < objnum) { 1218 if (m_LastObjNum < objnum) {
1218 m_LastObjNum = objnum; 1219 m_LastObjNum = objnum;
1219 } 1220 }
1220 if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { 1221 if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) {
1221 if (value) { 1222 if (value) {
1222 ((CPDF_Object *)value)->Destroy(); 1223 ((CPDF_Object *)value)->Destroy();
1223 } 1224 }
1224 } 1225 }
1225 m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)objnum, pObj); 1226 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj);
1226 return pObj; 1227 return pObj;
1227 } 1228 }
1228 int CPDF_IndirectObjects::GetIndirectType(FX_DWORD objnum) 1229 int CPDF_IndirectObjects::GetIndirectType(FX_DWORD objnum)
1229 { 1230 {
1230 FX_LPVOID value; 1231 void* value;
1231 if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { 1232 if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) {
1232 return ((CPDF_Object*)value)->GetType(); 1233 return ((CPDF_Object*)value)->GetType();
1233 } 1234 }
1234 if (m_pParser) { 1235 if (m_pParser) {
1235 PARSE_CONTEXT context; 1236 PARSE_CONTEXT context;
1236 FXSYS_memset32(&context, 0, sizeof(PARSE_CONTEXT)); 1237 FXSYS_memset32(&context, 0, sizeof(PARSE_CONTEXT));
1237 context.m_Flags = PDFPARSE_TYPEONLY; 1238 context.m_Flags = PDFPARSE_TYPEONLY;
1238 return (int)(uintptr_t)m_pParser->ParseIndirectObject(this, objnum, &con text); 1239 return (int)(uintptr_t)m_pParser->ParseIndirectObject(this, objnum, &con text);
1239 } 1240 }
1240 return 0; 1241 return 0;
1241 } 1242 }
1242 FX_DWORD CPDF_IndirectObjects::AddIndirectObject(CPDF_Object* pObj) 1243 FX_DWORD CPDF_IndirectObjects::AddIndirectObject(CPDF_Object* pObj)
1243 { 1244 {
1244 if (pObj->m_ObjNum) { 1245 if (pObj->m_ObjNum) {
1245 return pObj->m_ObjNum; 1246 return pObj->m_ObjNum;
1246 } 1247 }
1247 m_LastObjNum ++; 1248 m_LastObjNum ++;
1248 m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)m_LastObjNum, pObj); 1249 m_IndirectObjs.SetAt((void*)(uintptr_t)m_LastObjNum, pObj);
1249 pObj->m_ObjNum = m_LastObjNum; 1250 pObj->m_ObjNum = m_LastObjNum;
1250 return m_LastObjNum; 1251 return m_LastObjNum;
1251 } 1252 }
1252 void CPDF_IndirectObjects::ReleaseIndirectObject(FX_DWORD objnum) 1253 void CPDF_IndirectObjects::ReleaseIndirectObject(FX_DWORD objnum)
1253 { 1254 {
1254 FX_LPVOID value; 1255 void* value;
1255 if (!m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { 1256 if (!m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) {
1256 return; 1257 return;
1257 } 1258 }
1258 if (((CPDF_Object*)value)->GetObjNum() == -1) { 1259 if (((CPDF_Object*)value)->GetObjNum() == -1) {
1259 return; 1260 return;
1260 } 1261 }
1261 ((CPDF_Object*)value)->Destroy(); 1262 ((CPDF_Object*)value)->Destroy();
1262 m_IndirectObjs.RemoveKey((FX_LPVOID)(uintptr_t)objnum); 1263 m_IndirectObjs.RemoveKey((void*)(uintptr_t)objnum);
1263 } 1264 }
1264 void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pO bj) 1265 void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pO bj)
1265 { 1266 {
1266 if (objnum == 0 || pObj == NULL) { 1267 if (objnum == 0 || pObj == NULL) {
1267 return; 1268 return;
1268 } 1269 }
1269 FX_LPVOID value = NULL; 1270 void* value = NULL;
1270 if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { 1271 if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) {
1271 if (value) 1272 if (value)
1272 { 1273 {
1273 if (pObj->GetGenNum() <= ((CPDF_Object*)value)->GetGenNum()) 1274 if (pObj->GetGenNum() <= ((CPDF_Object*)value)->GetGenNum())
1274 return; 1275 return;
1275 else 1276 else
1276 ((CPDF_Object*)value)->Destroy(); 1277 ((CPDF_Object*)value)->Destroy();
1277 } 1278 }
1278 } 1279 }
1279 pObj->m_ObjNum = objnum; 1280 pObj->m_ObjNum = objnum;
1280 m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)objnum, pObj); 1281 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj);
1281 if (m_LastObjNum < objnum) { 1282 if (m_LastObjNum < objnum) {
1282 m_LastObjNum = objnum; 1283 m_LastObjNum = objnum;
1283 } 1284 }
1284 } 1285 }
1285 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const 1286 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const
1286 { 1287 {
1287 return m_LastObjNum; 1288 return m_LastObjNum;
1288 } 1289 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698