OLD | NEW |
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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 case PDFOBJ_NUMBER: | 173 case PDFOBJ_NUMBER: |
174 ((CPDF_Number*)this)->SetString(str); | 174 ((CPDF_Number*)this)->SetString(str); |
175 return; | 175 return; |
176 case PDFOBJ_STRING: | 176 case PDFOBJ_STRING: |
177 ((CPDF_String*)this)->m_String = str; | 177 ((CPDF_String*)this)->m_String = str; |
178 return; | 178 return; |
179 case PDFOBJ_NAME: | 179 case PDFOBJ_NAME: |
180 ((CPDF_Name*)this)->m_Name = str; | 180 ((CPDF_Name*)this)->m_Name = str; |
181 return; | 181 return; |
182 } | 182 } |
183 ASSERT(FALSE); | 183 ASSERT(false); |
184 } | 184 } |
185 int CPDF_Object::GetDirectType() const | 185 int CPDF_Object::GetDirectType() const |
186 { | 186 { |
187 if (m_Type != PDFOBJ_REFERENCE) { | 187 if (m_Type != PDFOBJ_REFERENCE) { |
188 return m_Type; | 188 return m_Type; |
189 } | 189 } |
190 CPDF_Reference* pRef = (CPDF_Reference*)this; | 190 CPDF_Reference* pRef = (CPDF_Reference*)this; |
191 return pRef->m_pObjList->GetIndirectType(pRef->m_RefObjNum); | 191 return pRef->m_pObjList->GetIndirectType(pRef->m_RefObjNum); |
192 } | 192 } |
193 FX_BOOL CPDF_Object::IsIdentical(CPDF_Object* pOther) const | 193 bool CPDF_Object::IsIdentical(CPDF_Object* pOther) const |
194 { | 194 { |
195 if (this == pOther) { | 195 if (this == pOther) { |
196 return TRUE; | 196 return true; |
197 } | 197 } |
198 if (pOther == NULL) { | 198 if (pOther == NULL) { |
199 return FALSE; | 199 return false; |
200 } | 200 } |
201 if (pOther->m_Type != m_Type) { | 201 if (pOther->m_Type != m_Type) { |
202 if (m_Type == PDFOBJ_REFERENCE && GetDirect()) { | 202 if (m_Type == PDFOBJ_REFERENCE && GetDirect()) { |
203 return GetDirect()->IsIdentical(pOther); | 203 return GetDirect()->IsIdentical(pOther); |
204 } | 204 } |
205 if (pOther->m_Type == PDFOBJ_REFERENCE) { | 205 if (pOther->m_Type == PDFOBJ_REFERENCE) { |
206 return IsIdentical(pOther->GetDirect()); | 206 return IsIdentical(pOther->GetDirect()); |
207 } | 207 } |
208 return FALSE; | 208 return false; |
209 } | 209 } |
210 switch (m_Type) { | 210 switch (m_Type) { |
211 case PDFOBJ_BOOLEAN: | 211 case PDFOBJ_BOOLEAN: |
212 return (((CPDF_Boolean*)this)->Identical((CPDF_Boolean*)pOther)); | 212 return (((CPDF_Boolean*)this)->Identical((CPDF_Boolean*)pOther)); |
213 case PDFOBJ_NUMBER: | 213 case PDFOBJ_NUMBER: |
214 return (((CPDF_Number*)this)->Identical((CPDF_Number*)pOther)); | 214 return (((CPDF_Number*)this)->Identical((CPDF_Number*)pOther)); |
215 case PDFOBJ_STRING: | 215 case PDFOBJ_STRING: |
216 return (((CPDF_String*)this)->Identical((CPDF_String*)pOther)); | 216 return (((CPDF_String*)this)->Identical((CPDF_String*)pOther)); |
217 case PDFOBJ_NAME: | 217 case PDFOBJ_NAME: |
218 return (((CPDF_Name*)this)->Identical((CPDF_Name*)pOther)); | 218 return (((CPDF_Name*)this)->Identical((CPDF_Name*)pOther)); |
219 case PDFOBJ_ARRAY: | 219 case PDFOBJ_ARRAY: |
220 return (((CPDF_Array*)this)->Identical((CPDF_Array*)pOther)); | 220 return (((CPDF_Array*)this)->Identical((CPDF_Array*)pOther)); |
221 case PDFOBJ_DICTIONARY: | 221 case PDFOBJ_DICTIONARY: |
222 return (((CPDF_Dictionary*)this)->Identical((CPDF_Dictionary*)pOther
)); | 222 return (((CPDF_Dictionary*)this)->Identical((CPDF_Dictionary*)pOther
)); |
223 case PDFOBJ_NULL: | 223 case PDFOBJ_NULL: |
224 return TRUE; | 224 return true; |
225 case PDFOBJ_STREAM: | 225 case PDFOBJ_STREAM: |
226 return (((CPDF_Stream*)this)->Identical((CPDF_Stream*)pOther)); | 226 return (((CPDF_Stream*)this)->Identical((CPDF_Stream*)pOther)); |
227 case PDFOBJ_REFERENCE: | 227 case PDFOBJ_REFERENCE: |
228 return (((CPDF_Reference*)this)->Identical((CPDF_Reference*)pOther))
; | 228 return (((CPDF_Reference*)this)->Identical((CPDF_Reference*)pOther))
; |
229 } | 229 } |
230 return FALSE; | 230 return false; |
231 } | 231 } |
232 CPDF_Object* CPDF_Object::GetDirect() const | 232 CPDF_Object* CPDF_Object::GetDirect() const |
233 { | 233 { |
234 if (m_Type != PDFOBJ_REFERENCE) { | 234 if (m_Type != PDFOBJ_REFERENCE) { |
235 return (CPDF_Object*)this; | 235 return (CPDF_Object*)this; |
236 } | 236 } |
237 CPDF_Reference* pRef = (CPDF_Reference*)(void*)this; | 237 CPDF_Reference* pRef = (CPDF_Reference*)(void*)this; |
238 if (pRef->m_pObjList == NULL) { | 238 if (pRef->m_pObjList == NULL) { |
239 return NULL; | 239 return NULL; |
240 } | 240 } |
241 return pRef->m_pObjList->GetIndirectObject(pRef->m_RefObjNum); | 241 return pRef->m_pObjList->GetIndirectObject(pRef->m_RefObjNum); |
242 } | 242 } |
243 CPDF_Object* CPDF_Object::Clone(FX_BOOL bDirect) const | 243 CPDF_Object* CPDF_Object::Clone(bool bDirect) const |
244 { | 244 { |
245 CFX_MapPtrToPtr visited; | 245 CFX_MapPtrToPtr visited; |
246 return CloneInternal(bDirect, &visited); | 246 return CloneInternal(bDirect, &visited); |
247 } | 247 } |
248 CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visite
d) const | 248 CPDF_Object* CPDF_Object::CloneInternal(bool bDirect, CFX_MapPtrToPtr* visited)
const |
249 { | 249 { |
250 switch (m_Type) { | 250 switch (m_Type) { |
251 case PDFOBJ_BOOLEAN: | 251 case PDFOBJ_BOOLEAN: |
252 return new CPDF_Boolean(((CPDF_Boolean*)this)->m_bValue); | 252 return new CPDF_Boolean(((CPDF_Boolean*)this)->m_bValue); |
253 case PDFOBJ_NUMBER: | 253 case PDFOBJ_NUMBER: |
254 return new CPDF_Number(((CPDF_Number*)this)->m_bInteger, &((CPDF_Num
ber*)this)->m_Integer); | 254 return new CPDF_Number(((CPDF_Number*)this)->m_bInteger, &((CPDF_Num
ber*)this)->m_Integer); |
255 case PDFOBJ_STRING: | 255 case PDFOBJ_STRING: |
256 return new CPDF_String(((CPDF_String*)this)->m_String, ((CPDF_String
*)this)->IsHex()); | 256 return new CPDF_String(((CPDF_String*)this)->m_String, ((CPDF_String
*)this)->IsHex()); |
257 case PDFOBJ_NAME: | 257 case PDFOBJ_NAME: |
258 return new CPDF_Name(((CPDF_Name*)this)->m_Name); | 258 return new CPDF_Name(((CPDF_Name*)this)->m_Name); |
(...skipping 18 matching lines...) Expand all Loading... |
277 pCopy->m_Map.SetAt(key, value->CloneInternal(bDirect, visite
d)); | 277 pCopy->m_Map.SetAt(key, value->CloneInternal(bDirect, visite
d)); |
278 } | 278 } |
279 return pCopy; | 279 return pCopy; |
280 } | 280 } |
281 case PDFOBJ_NULL: { | 281 case PDFOBJ_NULL: { |
282 return new CPDF_Null; | 282 return new CPDF_Null; |
283 } | 283 } |
284 case PDFOBJ_STREAM: { | 284 case PDFOBJ_STREAM: { |
285 CPDF_Stream* pThis = (CPDF_Stream*)this; | 285 CPDF_Stream* pThis = (CPDF_Stream*)this; |
286 CPDF_StreamAcc acc; | 286 CPDF_StreamAcc acc; |
287 acc.LoadAllData(pThis, TRUE); | 287 acc.LoadAllData(pThis, true); |
288 FX_DWORD streamSize = acc.GetSize(); | 288 FX_DWORD streamSize = acc.GetSize(); |
289 CPDF_Dictionary* pDict = pThis->GetDict(); | 289 CPDF_Dictionary* pDict = pThis->GetDict(); |
290 if (pDict) | 290 if (pDict) |
291 pDict = (CPDF_Dictionary*)((CPDF_Object*)pDict)->CloneIntern
al(bDirect, visited); | 291 pDict = (CPDF_Dictionary*)((CPDF_Object*)pDict)->CloneIntern
al(bDirect, visited); |
292 return new CPDF_Stream(acc.DetachData(), streamSize, pDict); | 292 return new CPDF_Stream(acc.DetachData(), streamSize, pDict); |
293 } | 293 } |
294 case PDFOBJ_REFERENCE: { | 294 case PDFOBJ_REFERENCE: { |
295 CPDF_Reference* pRef = (CPDF_Reference*)this; | 295 CPDF_Reference* pRef = (CPDF_Reference*)this; |
296 FX_DWORD obj_num = pRef->m_RefObjNum; | 296 FX_DWORD obj_num = pRef->m_RefObjNum; |
297 if (bDirect && !visited->GetValueAt((void*)(uintptr_t)obj_num))
{ | 297 if (bDirect && !visited->GetValueAt((void*)(uintptr_t)obj_num))
{ |
298 visited->SetAt((void*)(uintptr_t)obj_num, (void*)1); | 298 visited->SetAt((void*)(uintptr_t)obj_num, (void*)1); |
299 if (!pRef->GetDirect()) | 299 if (!pRef->GetDirect()) |
300 return nullptr; | 300 return nullptr; |
301 | 301 |
302 return pRef->GetDirect()->CloneInternal(TRUE, visited); | 302 return pRef->GetDirect()->CloneInternal(true, visited); |
303 } | 303 } |
304 return new CPDF_Reference(pRef->m_pObjList, obj_num); | 304 return new CPDF_Reference(pRef->m_pObjList, obj_num); |
305 } | 305 } |
306 } | 306 } |
307 return NULL; | 307 return NULL; |
308 } | 308 } |
309 CPDF_Object* CPDF_Object::CloneRef(CPDF_IndirectObjects* pDoc) const | 309 CPDF_Object* CPDF_Object::CloneRef(CPDF_IndirectObjects* pDoc) const |
310 { | 310 { |
311 if (m_ObjNum) { | 311 if (m_ObjNum) { |
312 return new CPDF_Reference(pDoc, m_ObjNum); | 312 return new CPDF_Reference(pDoc, m_ObjNum); |
313 } | 313 } |
314 return Clone(); | 314 return Clone(); |
315 } | 315 } |
316 CFX_WideString CPDF_Object::GetUnicodeText(CFX_CharMap* pCharMap) const | 316 CFX_WideString CPDF_Object::GetUnicodeText(CFX_CharMap* pCharMap) const |
317 { | 317 { |
318 if (m_Type == PDFOBJ_STRING) { | 318 if (m_Type == PDFOBJ_STRING) { |
319 return PDF_DecodeText(((CPDF_String*)this)->m_String, pCharMap); | 319 return PDF_DecodeText(((CPDF_String*)this)->m_String, pCharMap); |
320 } | 320 } |
321 if (m_Type == PDFOBJ_STREAM) { | 321 if (m_Type == PDFOBJ_STREAM) { |
322 CPDF_StreamAcc stream; | 322 CPDF_StreamAcc stream; |
323 stream.LoadAllData((CPDF_Stream*)this, FALSE); | 323 stream.LoadAllData((CPDF_Stream*)this, false); |
324 CFX_WideString result = PDF_DecodeText(stream.GetData(), stream.GetSize(
), pCharMap); | 324 CFX_WideString result = PDF_DecodeText(stream.GetData(), stream.GetSize(
), pCharMap); |
325 return result; | 325 return result; |
326 } | 326 } |
327 if (m_Type == PDFOBJ_NAME) { | 327 if (m_Type == PDFOBJ_NAME) { |
328 return PDF_DecodeText(((CPDF_Name*)this)->m_Name, pCharMap); | 328 return PDF_DecodeText(((CPDF_Name*)this)->m_Name, pCharMap); |
329 } | 329 } |
330 return CFX_WideString(); | 330 return CFX_WideString(); |
331 } | 331 } |
332 void CPDF_Object::SetUnicodeText(const FX_WCHAR* pUnicodes, int len) | 332 void CPDF_Object::SetUnicodeText(const FX_WCHAR* pUnicodes, int len) |
333 { | 333 { |
334 if (m_Type == PDFOBJ_STRING) { | 334 if (m_Type == PDFOBJ_STRING) { |
335 ((CPDF_String*)this)->m_String = PDF_EncodeText(pUnicodes, len); | 335 ((CPDF_String*)this)->m_String = PDF_EncodeText(pUnicodes, len); |
336 } else if (m_Type == PDFOBJ_STREAM) { | 336 } else if (m_Type == PDFOBJ_STREAM) { |
337 CFX_ByteString result = PDF_EncodeText(pUnicodes, len); | 337 CFX_ByteString result = PDF_EncodeText(pUnicodes, len); |
338 ((CPDF_Stream*)this)->SetData((uint8_t*)result.c_str(), result.GetLength
(), FALSE, FALSE); | 338 ((CPDF_Stream*)this)->SetData((uint8_t*)result.c_str(), result.GetLength
(), false, false); |
339 } | 339 } |
340 } | 340 } |
341 | 341 |
342 CPDF_Number::CPDF_Number(int value) | 342 CPDF_Number::CPDF_Number(int value) |
343 : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(TRUE), m_Integer(value) { | 343 : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(true), m_Integer(value) { |
344 } | 344 } |
345 | 345 |
346 CPDF_Number::CPDF_Number(FX_FLOAT value) | 346 CPDF_Number::CPDF_Number(FX_FLOAT value) |
347 : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(FALSE), m_Float(value) { | 347 : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(false), m_Float(value) { |
348 } | 348 } |
349 | 349 |
350 CPDF_Number::CPDF_Number(FX_BOOL bInteger, void* pData) | 350 CPDF_Number::CPDF_Number(bool bInteger, void* pData) |
351 : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(bInteger), m_Integer(*(int*)pData)
{ | 351 : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(bInteger), m_Integer(*(int*)pData)
{ |
352 } | 352 } |
353 | 353 |
354 CPDF_Number::CPDF_Number(const CFX_ByteStringC& str) : CPDF_Object(PDFOBJ_NUMBER
) { | 354 CPDF_Number::CPDF_Number(const CFX_ByteStringC& str) : CPDF_Object(PDFOBJ_NUMBER
) { |
355 FX_atonum(str, m_bInteger, &m_Integer); | 355 FX_atonum(str, m_bInteger, &m_Integer); |
356 } | 356 } |
357 | 357 |
358 void CPDF_Number::SetString(const CFX_ByteStringC& str) | 358 void CPDF_Number::SetString(const CFX_ByteStringC& str) |
359 { | 359 { |
360 FX_atonum(str, m_bInteger, &m_Integer); | 360 FX_atonum(str, m_bInteger, &m_Integer); |
361 } | 361 } |
362 FX_BOOL CPDF_Number::Identical(CPDF_Number* pOther) const | 362 bool CPDF_Number::Identical(CPDF_Number* pOther) const |
363 { | 363 { |
364 return m_bInteger == pOther->m_bInteger && m_Integer == pOther->m_Integer; | 364 return m_bInteger == pOther->m_bInteger && m_Integer == pOther->m_Integer; |
365 } | 365 } |
366 CFX_ByteString CPDF_Number::GetString() const | 366 CFX_ByteString CPDF_Number::GetString() const |
367 { | 367 { |
368 return m_bInteger ? CFX_ByteString::FormatInteger(m_Integer, FXFORMAT_SIGNED
) : CFX_ByteString::FormatFloat(m_Float); | 368 return m_bInteger ? CFX_ByteString::FormatInteger(m_Integer, FXFORMAT_SIGNED
) : CFX_ByteString::FormatFloat(m_Float); |
369 } | 369 } |
370 void CPDF_Number::SetNumber(FX_FLOAT value) | 370 void CPDF_Number::SetNumber(FX_FLOAT value) |
371 { | 371 { |
372 m_bInteger = FALSE; | 372 m_bInteger = false; |
373 m_Float = value; | 373 m_Float = value; |
374 } | 374 } |
375 CPDF_String::CPDF_String(const CFX_WideString& str) : CPDF_Object(PDFOBJ_STRING)
, m_bHex(FALSE) { | 375 CPDF_String::CPDF_String(const CFX_WideString& str) : CPDF_Object(PDFOBJ_STRING)
, m_bHex(false) { |
376 m_String = PDF_EncodeText(str); | 376 m_String = PDF_EncodeText(str); |
377 } | 377 } |
378 CPDF_Array::~CPDF_Array() | 378 CPDF_Array::~CPDF_Array() |
379 { | 379 { |
380 int size = m_Objects.GetSize(); | 380 int size = m_Objects.GetSize(); |
381 CPDF_Object** pList = (CPDF_Object**)m_Objects.GetData(); | 381 CPDF_Object** pList = (CPDF_Object**)m_Objects.GetData(); |
382 for (int i = 0; i < size; i ++) { | 382 for (int i = 0; i < size; i ++) { |
383 if (pList[i]) | 383 if (pList[i]) |
384 pList[i]->Release(); | 384 pList[i]->Release(); |
385 } | 385 } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 ASSERT(m_Type == PDFOBJ_ARRAY); | 546 ASSERT(m_Type == PDFOBJ_ARRAY); |
547 CPDF_Number* pNumber = new CPDF_Number; | 547 CPDF_Number* pNumber = new CPDF_Number; |
548 pNumber->SetNumber(f); | 548 pNumber->SetNumber(f); |
549 Add(pNumber); | 549 Add(pNumber); |
550 } | 550 } |
551 void CPDF_Array::AddReference(CPDF_IndirectObjects* pDoc, FX_DWORD objnum) | 551 void CPDF_Array::AddReference(CPDF_IndirectObjects* pDoc, FX_DWORD objnum) |
552 { | 552 { |
553 ASSERT(m_Type == PDFOBJ_ARRAY); | 553 ASSERT(m_Type == PDFOBJ_ARRAY); |
554 Add(new CPDF_Reference(pDoc, objnum)); | 554 Add(new CPDF_Reference(pDoc, objnum)); |
555 } | 555 } |
556 FX_BOOL CPDF_Array::Identical(CPDF_Array* pOther) const | 556 bool CPDF_Array::Identical(CPDF_Array* pOther) const |
557 { | 557 { |
558 if (m_Objects.GetSize() != pOther->m_Objects.GetSize()) { | 558 if (m_Objects.GetSize() != pOther->m_Objects.GetSize()) { |
559 return FALSE; | 559 return false; |
560 } | 560 } |
561 for (int i = 0; i < m_Objects.GetSize(); i ++) | 561 for (int i = 0; i < m_Objects.GetSize(); i ++) |
562 if (!((CPDF_Object*)m_Objects[i])->IsIdentical((CPDF_Object*)pOther->m_O
bjects[i])) { | 562 if (!((CPDF_Object*)m_Objects[i])->IsIdentical((CPDF_Object*)pOther->m_O
bjects[i])) { |
563 return FALSE; | 563 return false; |
564 } | 564 } |
565 return TRUE; | 565 return true; |
566 } | 566 } |
567 CPDF_Dictionary::~CPDF_Dictionary() | 567 CPDF_Dictionary::~CPDF_Dictionary() |
568 { | 568 { |
569 FX_POSITION pos = m_Map.GetStartPosition(); | 569 FX_POSITION pos = m_Map.GetStartPosition(); |
570 while (pos) { | 570 while (pos) { |
571 void* value = m_Map.GetNextValue(pos); | 571 void* value = m_Map.GetNextValue(pos); |
572 if (value) | 572 if (value) |
573 ((CPDF_Object*)value)->Release(); | 573 ((CPDF_Object*)value)->Release(); |
574 } | 574 } |
575 } | 575 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 } | 670 } |
671 FX_FLOAT CPDF_Dictionary::GetNumber(const CFX_ByteStringC& key) const | 671 FX_FLOAT CPDF_Dictionary::GetNumber(const CFX_ByteStringC& key) const |
672 { | 672 { |
673 CPDF_Object* p = NULL; | 673 CPDF_Object* p = NULL; |
674 m_Map.Lookup(key, (void*&)p); | 674 m_Map.Lookup(key, (void*&)p); |
675 if (p) { | 675 if (p) { |
676 return p->GetNumber(); | 676 return p->GetNumber(); |
677 } | 677 } |
678 return 0; | 678 return 0; |
679 } | 679 } |
680 FX_BOOL CPDF_Dictionary::GetBoolean(const CFX_ByteStringC& key, FX_BOOL bDefault
) const | 680 bool CPDF_Dictionary::GetBoolean(const CFX_ByteStringC& key, bool bDefault) cons
t |
681 { | 681 { |
682 CPDF_Object* p = NULL; | 682 CPDF_Object* p = NULL; |
683 m_Map.Lookup(key, (void*&)p); | 683 m_Map.Lookup(key, (void*&)p); |
684 if (p && p->GetType() == PDFOBJ_BOOLEAN) { | 684 if (p && p->GetType() == PDFOBJ_BOOLEAN) { |
685 return p->GetInteger(); | 685 return p->GetInteger(); |
686 } | 686 } |
687 return bDefault; | 687 return bDefault; |
688 } | 688 } |
689 CPDF_Dictionary* CPDF_Dictionary::GetDict(const CFX_ByteStringC& key) const | 689 CPDF_Dictionary* CPDF_Dictionary::GetDict(const CFX_ByteStringC& key) const |
690 { | 690 { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 } | 727 } |
728 CFX_AffineMatrix CPDF_Dictionary::GetMatrix(const CFX_ByteStringC& key) const | 728 CFX_AffineMatrix CPDF_Dictionary::GetMatrix(const CFX_ByteStringC& key) const |
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(const CFX_ByteStringC& key) const | 737 bool CPDF_Dictionary::KeyExist(const CFX_ByteStringC& key) const |
738 { | 738 { |
739 void* 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(const CFX_ByteStringC& key, CPDF_Object* pObj, CPDF_
IndirectObjects* pObjs) | 742 void CPDF_Dictionary::SetAt(const CFX_ByteStringC& 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) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 { | 779 { |
780 ASSERT(m_Type == PDFOBJ_DICTIONARY); | 780 ASSERT(m_Type == PDFOBJ_DICTIONARY); |
781 CPDF_Object* p = NULL; | 781 CPDF_Object* p = NULL; |
782 m_Map.Lookup(oldkey, (void*&)p); | 782 m_Map.Lookup(oldkey, (void*&)p); |
783 if (p == NULL) { | 783 if (p == NULL) { |
784 return; | 784 return; |
785 } | 785 } |
786 m_Map.RemoveKey(oldkey); | 786 m_Map.RemoveKey(oldkey); |
787 m_Map.SetAt(newkey, p); | 787 m_Map.SetAt(newkey, p); |
788 } | 788 } |
789 FX_BOOL CPDF_Dictionary::Identical(CPDF_Dictionary* pOther) const | 789 bool CPDF_Dictionary::Identical(CPDF_Dictionary* pOther) const |
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 void* 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(const CFX_ByteStringC& key, int i) | 810 void CPDF_Dictionary::SetAtInteger(const CFX_ByteStringC& key, int i) |
811 { | 811 { |
812 SetAt(key, new CPDF_Number(i)); | 812 SetAt(key, new CPDF_Number(i)); |
813 } | 813 } |
814 void CPDF_Dictionary::SetAtName(const CFX_ByteStringC& key, const CFX_ByteString
& name) | 814 void CPDF_Dictionary::SetAtName(const CFX_ByteStringC& key, const CFX_ByteString
& name) |
815 { | 815 { |
816 SetAt(key, new CPDF_Name(name)); | 816 SetAt(key, new CPDF_Name(name)); |
817 } | 817 } |
818 void CPDF_Dictionary::SetAtString(const CFX_ByteStringC& key, const CFX_ByteStri
ng& str) | 818 void CPDF_Dictionary::SetAtString(const CFX_ByteStringC& key, const CFX_ByteStri
ng& str) |
819 { | 819 { |
820 SetAt(key, new CPDF_String(str)); | 820 SetAt(key, new CPDF_String(str)); |
821 } | 821 } |
822 void CPDF_Dictionary::SetAtReference(const CFX_ByteStringC& key, CPDF_IndirectOb
jects* pDoc, FX_DWORD objnum) | 822 void CPDF_Dictionary::SetAtReference(const CFX_ByteStringC& key, CPDF_IndirectOb
jects* pDoc, FX_DWORD objnum) |
823 { | 823 { |
824 SetAt(key, new CPDF_Reference(pDoc, objnum)); | 824 SetAt(key, new CPDF_Reference(pDoc, objnum)); |
825 } | 825 } |
826 void CPDF_Dictionary::AddReference(const CFX_ByteStringC& key, CPDF_IndirectObje
cts* pDoc, FX_DWORD objnum) | 826 void CPDF_Dictionary::AddReference(const CFX_ByteStringC& key, CPDF_IndirectObje
cts* pDoc, FX_DWORD objnum) |
827 { | 827 { |
828 AddValue(key, new CPDF_Reference(pDoc, objnum)); | 828 AddValue(key, new CPDF_Reference(pDoc, objnum)); |
829 } | 829 } |
830 void CPDF_Dictionary::SetAtNumber(const CFX_ByteStringC& key, FX_FLOAT f) | 830 void CPDF_Dictionary::SetAtNumber(const CFX_ByteStringC& key, FX_FLOAT f) |
831 { | 831 { |
832 CPDF_Number* pNumber = new CPDF_Number; | 832 CPDF_Number* pNumber = new CPDF_Number; |
833 pNumber->SetNumber(f); | 833 pNumber->SetNumber(f); |
834 SetAt(key, pNumber); | 834 SetAt(key, pNumber); |
835 } | 835 } |
836 void CPDF_Dictionary::SetAtBoolean(const CFX_ByteStringC& key, FX_BOOL bValue) | 836 void CPDF_Dictionary::SetAtBoolean(const CFX_ByteStringC& key, bool bValue) |
837 { | 837 { |
838 SetAt(key, new CPDF_Boolean(bValue)); | 838 SetAt(key, new CPDF_Boolean(bValue)); |
839 } | 839 } |
840 void CPDF_Dictionary::SetAtRect(const CFX_ByteStringC& key, const CFX_FloatRect&
rect) | 840 void CPDF_Dictionary::SetAtRect(const CFX_ByteStringC& key, const CFX_FloatRect&
rect) |
841 { | 841 { |
842 CPDF_Array* pArray = new CPDF_Array; | 842 CPDF_Array* pArray = new CPDF_Array; |
843 pArray->AddNumber(rect.left); | 843 pArray->AddNumber(rect.left); |
844 pArray->AddNumber(rect.bottom); | 844 pArray->AddNumber(rect.bottom); |
845 pArray->AddNumber(rect.right); | 845 pArray->AddNumber(rect.right); |
846 pArray->AddNumber(rect.top); | 846 pArray->AddNumber(rect.top); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_memcpy(m_pDataBuf, pData, size); | 901 FXSYS_memcpy(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(const uint8_t* pData, FX_DWORD size, FX_BOOL bCompress
ed, FX_BOOL bKeepBuf) | 908 void CPDF_Stream::SetData(const uint8_t* pData, FX_DWORD size, bool bCompressed,
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 = (uint8_t*)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_memcpy(m_pDataBuf, pData, size); | 923 FXSYS_memcpy(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, uint8_t* buf, FX_DWORD size
) const | 936 bool CPDF_Stream::ReadRawData(FX_FILESIZE offset, uint8_t* buf, FX_DWORD size) c
onst |
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_memcpy(buf, m_pDataBuf + offset, size); | 942 FXSYS_memcpy(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) |
947 { | 947 { |
948 InitStream(pDict); | 948 InitStream(pDict); |
949 m_pFile = pFile; | 949 m_pFile = pFile; |
950 m_dwSize = (FX_DWORD)pFile->GetSize(); | 950 m_dwSize = (FX_DWORD)pFile->GetSize(); |
951 if (m_pDict) { | 951 if (m_pDict) { |
952 m_pDict->SetAtInteger(FX_BSTRC("Length"), m_dwSize); | 952 m_pDict->SetAtInteger(FX_BSTRC("Length"), m_dwSize); |
953 } | 953 } |
954 } | 954 } |
955 FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const | 955 bool CPDF_Stream::Identical(CPDF_Stream* pOther) const |
956 { | 956 { |
957 if (!m_pDict) | 957 if (!m_pDict) |
958 return pOther->m_pDict ? FALSE : TRUE; | 958 return pOther->m_pDict ? false : true; |
959 | 959 |
960 if (!m_pDict->Identical(pOther->m_pDict)) { | 960 if (!m_pDict->Identical(pOther->m_pDict)) { |
961 return FALSE; | 961 return false; |
962 } | 962 } |
963 if (m_dwSize != pOther->m_dwSize) { | 963 if (m_dwSize != pOther->m_dwSize) { |
964 return FALSE; | 964 return false; |
965 } | 965 } |
966 if (m_GenNum != (FX_DWORD) - 1 && pOther->m_GenNum != (FX_DWORD) - 1) { | 966 if (m_GenNum != (FX_DWORD) - 1 && pOther->m_GenNum != (FX_DWORD) - 1) { |
967 if (m_pFile == pOther->m_pFile && m_pFile == NULL) { | 967 if (m_pFile == pOther->m_pFile && m_pFile == NULL) { |
968 return TRUE; | 968 return true; |
969 } | 969 } |
970 if (!m_pFile || !pOther->m_pFile) { | 970 if (!m_pFile || !pOther->m_pFile) { |
971 return FALSE; | 971 return false; |
972 } | 972 } |
973 uint8_t srcBuf[1024]; | 973 uint8_t srcBuf[1024]; |
974 uint8_t destBuf[1024]; | 974 uint8_t destBuf[1024]; |
975 FX_DWORD size = m_dwSize; | 975 FX_DWORD size = m_dwSize; |
976 FX_DWORD srcOffset = m_FileOffset; | 976 FX_DWORD srcOffset = m_FileOffset; |
977 FX_DWORD destOffset = pOther->m_FileOffset; | 977 FX_DWORD destOffset = pOther->m_FileOffset; |
978 if (m_pFile == pOther->m_pFile && srcOffset == destOffset) { | 978 if (m_pFile == pOther->m_pFile && srcOffset == destOffset) { |
979 return TRUE; | 979 return true; |
980 } | 980 } |
981 while (size > 0) { | 981 while (size > 0) { |
982 FX_DWORD actualSize = size > 1024 ? 1024 : size; | 982 FX_DWORD actualSize = size > 1024 ? 1024 : size; |
983 m_pFile->ReadBlock(srcBuf, srcOffset, actualSize); | 983 m_pFile->ReadBlock(srcBuf, srcOffset, actualSize); |
984 pOther->m_pFile->ReadBlock(destBuf, destOffset, actualSize); | 984 pOther->m_pFile->ReadBlock(destBuf, destOffset, actualSize); |
985 if (FXSYS_memcmp(srcBuf, destBuf, actualSize) != 0) { | 985 if (FXSYS_memcmp(srcBuf, destBuf, actualSize) != 0) { |
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 uint8_t* 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_memcmp(srcBuf, pBuf, actualSize) != 0) { | 1015 if (FXSYS_memcmp(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_memcmp(m_pDataBuf, pOther->m_pDataBuf, m_dwSize) == 0; | 1024 return FXSYS_memcmp(m_pDataBuf, pOther->m_pDataBuf, m_dwSize) == 0; |
1025 } | 1025 } |
1026 CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpf
Callback, void* pUserData) const | 1026 CPDF_Stream* CPDF_Stream::Clone(bool bDirect, FPDF_LPFCloneStreamCallback lpfCal
lback, 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 uint8_t* 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(const uint8_t* src_buf, FX_DWORD src_size, const C
PDF_Dictionary* pDict, | 1057 extern bool PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF
_Dictionary* pDict, |
1058 uint8_t*& dest_buf, FX_DWORD& dest_size, CFX_ByteS
tring& 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, 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, bool bRawAccess, FX
_DWORD estimated_size, |
1070 FX_BOOL bImageAcc) | 1070 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 = (uint8_t*)pStream->m_pDataBuf; | 1079 m_pData = (uint8_t*)pStream->m_pDataBuf; |
1080 return; | 1080 return; |
(...skipping 23 matching lines...) Expand all Loading... |
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) { |
1111 m_pData = pDecryptedData; | 1111 m_pData = pDecryptedData; |
1112 m_dwSize = dwDecryptedSize; | 1112 m_dwSize = dwDecryptedSize; |
1113 } else { | 1113 } else { |
1114 FX_BOOL bRet = PDF_DataDecode(pDecryptedData, dwDecryptedSize, m_pStream
->GetDict(), | 1114 bool bRet = PDF_DataDecode(pDecryptedData, dwDecryptedSize, m_pStream->G
etDict(), |
1115 m_pData, m_dwSize, m_ImageDecoder, m_pImag
eParam, estimated_size, bImageAcc); | 1115 m_pData, m_dwSize, m_ImageDecoder, m_pImag
eParam, estimated_size, bImageAcc); |
1116 if (!bRet) { | 1116 if (!bRet) { |
1117 m_pData = pDecryptedData; | 1117 m_pData = pDecryptedData; |
1118 m_dwSize = dwDecryptedSize; | 1118 m_dwSize = dwDecryptedSize; |
1119 } | 1119 } |
1120 } | 1120 } |
1121 if (pSrcData != pStream->m_pDataBuf && pSrcData != m_pData) { | 1121 if (pSrcData != pStream->m_pDataBuf && pSrcData != m_pData) { |
1122 FX_Free(pSrcData); | 1122 FX_Free(pSrcData); |
1123 } | 1123 } |
1124 if (pDecryptedData != pSrcData && pDecryptedData != m_pData) { | 1124 if (pDecryptedData != pSrcData && pDecryptedData != m_pData) { |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 pObj->m_ObjNum = objnum; | 1279 pObj->m_ObjNum = objnum; |
1280 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); | 1280 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); |
1281 if (m_LastObjNum < objnum) { | 1281 if (m_LastObjNum < objnum) { |
1282 m_LastObjNum = objnum; | 1282 m_LastObjNum = objnum; |
1283 } | 1283 } |
1284 } | 1284 } |
1285 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const | 1285 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const |
1286 { | 1286 { |
1287 return m_LastObjNum; | 1287 return m_LastObjNum; |
1288 } | 1288 } |
OLD | NEW |