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 } else if (pOther->m_Type == PDFOBJ_REFERENCE) { | 204 } else if (pOther->m_Type == PDFOBJ_REFERENCE) { |
205 return IsIdentical(pOther->GetDirect()); | 205 return IsIdentical(pOther->GetDirect()); |
206 } | 206 } |
207 return FALSE; | 207 return false; |
208 } | 208 } |
209 switch (m_Type) { | 209 switch (m_Type) { |
210 case PDFOBJ_BOOLEAN: | 210 case PDFOBJ_BOOLEAN: |
211 return (((CPDF_Boolean*)this)->Identical((CPDF_Boolean*)pOther)); | 211 return (((CPDF_Boolean*)this)->Identical((CPDF_Boolean*)pOther)); |
212 case PDFOBJ_NUMBER: | 212 case PDFOBJ_NUMBER: |
213 return (((CPDF_Number*)this)->Identical((CPDF_Number*)pOther)); | 213 return (((CPDF_Number*)this)->Identical((CPDF_Number*)pOther)); |
214 case PDFOBJ_STRING: | 214 case PDFOBJ_STRING: |
215 return (((CPDF_String*)this)->Identical((CPDF_String*)pOther)); | 215 return (((CPDF_String*)this)->Identical((CPDF_String*)pOther)); |
216 case PDFOBJ_NAME: | 216 case PDFOBJ_NAME: |
217 return (((CPDF_Name*)this)->Identical((CPDF_Name*)pOther)); | 217 return (((CPDF_Name*)this)->Identical((CPDF_Name*)pOther)); |
218 case PDFOBJ_ARRAY: | 218 case PDFOBJ_ARRAY: |
219 return (((CPDF_Array*)this)->Identical((CPDF_Array*)pOther)); | 219 return (((CPDF_Array*)this)->Identical((CPDF_Array*)pOther)); |
220 case PDFOBJ_DICTIONARY: | 220 case PDFOBJ_DICTIONARY: |
221 return (((CPDF_Dictionary*)this)->Identical((CPDF_Dictionary*)pOther
)); | 221 return (((CPDF_Dictionary*)this)->Identical((CPDF_Dictionary*)pOther
)); |
222 case PDFOBJ_NULL: | 222 case PDFOBJ_NULL: |
223 return TRUE; | 223 return true; |
224 case PDFOBJ_STREAM: | 224 case PDFOBJ_STREAM: |
225 return (((CPDF_Stream*)this)->Identical((CPDF_Stream*)pOther)); | 225 return (((CPDF_Stream*)this)->Identical((CPDF_Stream*)pOther)); |
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*)(void*)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(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 } |
247 CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visite
d) const | 247 CPDF_Object* CPDF_Object::CloneInternal(bool bDirect, CFX_MapPtrToPtr* visited)
const |
248 { | 248 { |
249 switch (m_Type) { | 249 switch (m_Type) { |
250 case PDFOBJ_BOOLEAN: | 250 case PDFOBJ_BOOLEAN: |
251 return new CPDF_Boolean(((CPDF_Boolean*)this)->m_bValue); | 251 return new CPDF_Boolean(((CPDF_Boolean*)this)->m_bValue); |
252 case PDFOBJ_NUMBER: | 252 case PDFOBJ_NUMBER: |
253 return new CPDF_Number(((CPDF_Number*)this)->m_bInteger, &((CPDF_Num
ber*)this)->m_Integer); | 253 return new CPDF_Number(((CPDF_Number*)this)->m_bInteger, &((CPDF_Num
ber*)this)->m_Integer); |
254 case PDFOBJ_STRING: | 254 case PDFOBJ_STRING: |
255 return new CPDF_String(((CPDF_String*)this)->m_String, ((CPDF_String
*)this)->IsHex()); | 255 return new CPDF_String(((CPDF_String*)this)->m_String, ((CPDF_String
*)this)->IsHex()); |
256 case PDFOBJ_NAME: | 256 case PDFOBJ_NAME: |
257 return new CPDF_Name(((CPDF_Name*)this)->m_Name); | 257 return new CPDF_Name(((CPDF_Name*)this)->m_Name); |
(...skipping 18 matching lines...) Expand all Loading... |
276 pCopy->m_Map.SetAt(key, value->CloneInternal(bDirect, visite
d)); | 276 pCopy->m_Map.SetAt(key, value->CloneInternal(bDirect, visite
d)); |
277 } | 277 } |
278 return pCopy; | 278 return pCopy; |
279 } | 279 } |
280 case PDFOBJ_NULL: { | 280 case PDFOBJ_NULL: { |
281 return new CPDF_Null; | 281 return new CPDF_Null; |
282 } | 282 } |
283 case PDFOBJ_STREAM: { | 283 case PDFOBJ_STREAM: { |
284 CPDF_Stream* pThis = (CPDF_Stream*)this; | 284 CPDF_Stream* pThis = (CPDF_Stream*)this; |
285 CPDF_StreamAcc acc; | 285 CPDF_StreamAcc acc; |
286 acc.LoadAllData(pThis, TRUE); | 286 acc.LoadAllData(pThis, true); |
287 FX_DWORD streamSize = acc.GetSize(); | 287 FX_DWORD streamSize = acc.GetSize(); |
288 CPDF_Stream* pObj; | 288 CPDF_Stream* pObj; |
289 if (pThis->GetDict()) | 289 if (pThis->GetDict()) |
290 pObj = new CPDF_Stream(acc.DetachData(), streamSize, (CPDF_D
ictionary*)((CPDF_Object*)pThis->GetDict())->CloneInternal(bDirect, visited)); | 290 pObj = new CPDF_Stream(acc.DetachData(), streamSize, (CPDF_D
ictionary*)((CPDF_Object*)pThis->GetDict())->CloneInternal(bDirect, visited)); |
291 else | 291 else |
292 pObj = new CPDF_Stream(acc.DetachData(), streamSize, NULL); | 292 pObj = new CPDF_Stream(acc.DetachData(), streamSize, NULL); |
293 return pObj; | 293 return pObj; |
294 } | 294 } |
295 case PDFOBJ_REFERENCE: { | 295 case PDFOBJ_REFERENCE: { |
296 CPDF_Reference* pRef = (CPDF_Reference*)this; | 296 CPDF_Reference* pRef = (CPDF_Reference*)this; |
297 FX_DWORD obj_num = pRef->m_RefObjNum; | 297 FX_DWORD obj_num = pRef->m_RefObjNum; |
298 if (bDirect && !visited->GetValueAt((void*)(uintptr_t)obj_num))
{ | 298 if (bDirect && !visited->GetValueAt((void*)(uintptr_t)obj_num))
{ |
299 visited->SetAt((void*)(uintptr_t)obj_num, (void*)1); | 299 visited->SetAt((void*)(uintptr_t)obj_num, (void*)1); |
300 CPDF_Object* ret; | 300 CPDF_Object* ret; |
301 if (pRef->GetDirect()) | 301 if (pRef->GetDirect()) |
302 ret = pRef->GetDirect()->CloneInternal(TRUE, visited); | 302 ret = pRef->GetDirect()->CloneInternal(true, visited); |
303 else | 303 else |
304 ret = NULL; | 304 ret = NULL; |
305 return ret; | 305 return ret; |
306 } else { | 306 } else { |
307 return new CPDF_Reference(pRef->m_pObjList, obj_num); | 307 return new CPDF_Reference(pRef->m_pObjList, obj_num); |
308 } | 308 } |
309 } | 309 } |
310 } | 310 } |
311 return NULL; | 311 return NULL; |
312 } | 312 } |
313 CPDF_Object* CPDF_Object::CloneRef(CPDF_IndirectObjects* pDoc) const | 313 CPDF_Object* CPDF_Object::CloneRef(CPDF_IndirectObjects* pDoc) const |
314 { | 314 { |
315 if (m_ObjNum) { | 315 if (m_ObjNum) { |
316 return new CPDF_Reference(pDoc, m_ObjNum); | 316 return new CPDF_Reference(pDoc, m_ObjNum); |
317 } | 317 } |
318 return Clone(); | 318 return Clone(); |
319 } | 319 } |
320 CFX_WideString CPDF_Object::GetUnicodeText(CFX_CharMap* pCharMap) const | 320 CFX_WideString CPDF_Object::GetUnicodeText(CFX_CharMap* pCharMap) const |
321 { | 321 { |
322 if (m_Type == PDFOBJ_STRING) { | 322 if (m_Type == PDFOBJ_STRING) { |
323 return PDF_DecodeText(((CPDF_String*)this)->m_String, pCharMap); | 323 return PDF_DecodeText(((CPDF_String*)this)->m_String, pCharMap); |
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(const FX_WCHAR* 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((uint8_t*)result.c_str(), result.GetLength
(), 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 } |
351 | 351 |
352 CPDF_Number::CPDF_Number(FX_BOOL bInteger, void* pData) | 352 CPDF_Number::CPDF_Number(bool bInteger, void* pData) |
353 : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(bInteger), m_Integer(*(int*)pData)
{ | 353 : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(bInteger), m_Integer(*(int*)pData)
{ |
354 } | 354 } |
355 | 355 |
356 CPDF_Number::CPDF_Number(const CFX_ByteStringC& str) : CPDF_Object(PDFOBJ_NUMBER
) { | 356 CPDF_Number::CPDF_Number(const CFX_ByteStringC& str) : CPDF_Object(PDFOBJ_NUMBER
) { |
357 FX_atonum(str, m_bInteger, &m_Integer); | 357 FX_atonum(str, m_bInteger, &m_Integer); |
358 } | 358 } |
359 | 359 |
360 void CPDF_Number::SetString(const CFX_ByteStringC& str) | 360 void CPDF_Number::SetString(const CFX_ByteStringC& str) |
361 { | 361 { |
362 FX_atonum(str, m_bInteger, &m_Integer); | 362 FX_atonum(str, m_bInteger, &m_Integer); |
363 } | 363 } |
364 FX_BOOL CPDF_Number::Identical(CPDF_Number* pOther) const | 364 bool CPDF_Number::Identical(CPDF_Number* pOther) const |
365 { | 365 { |
366 return m_bInteger == pOther->m_bInteger && m_Integer == pOther->m_Integer; | 366 return m_bInteger == pOther->m_bInteger && m_Integer == pOther->m_Integer; |
367 } | 367 } |
368 CFX_ByteString CPDF_Number::GetString() const | 368 CFX_ByteString CPDF_Number::GetString() const |
369 { | 369 { |
370 return m_bInteger ? CFX_ByteString::FormatInteger(m_Integer, FXFORMAT_SIGNED
) : CFX_ByteString::FormatFloat(m_Float); | 370 return m_bInteger ? CFX_ByteString::FormatInteger(m_Integer, FXFORMAT_SIGNED
) : CFX_ByteString::FormatFloat(m_Float); |
371 } | 371 } |
372 void CPDF_Number::SetNumber(FX_FLOAT value) | 372 void CPDF_Number::SetNumber(FX_FLOAT value) |
373 { | 373 { |
374 m_bInteger = FALSE; | 374 m_bInteger = false; |
375 m_Float = value; | 375 m_Float = value; |
376 } | 376 } |
377 CPDF_String::CPDF_String(const CFX_WideString& str) : CPDF_Object(PDFOBJ_STRING)
, m_bHex(FALSE) { | 377 CPDF_String::CPDF_String(const CFX_WideString& str) : CPDF_Object(PDFOBJ_STRING)
, m_bHex(false) { |
378 m_String = PDF_EncodeText(str); | 378 m_String = PDF_EncodeText(str); |
379 } | 379 } |
380 CPDF_Array::~CPDF_Array() | 380 CPDF_Array::~CPDF_Array() |
381 { | 381 { |
382 int size = m_Objects.GetSize(); | 382 int size = m_Objects.GetSize(); |
383 CPDF_Object** pList = (CPDF_Object**)m_Objects.GetData(); | 383 CPDF_Object** pList = (CPDF_Object**)m_Objects.GetData(); |
384 for (int i = 0; i < size; i ++) { | 384 for (int i = 0; i < size; i ++) { |
385 if (pList[i]) | 385 if (pList[i]) |
386 pList[i]->Release(); | 386 pList[i]->Release(); |
387 } | 387 } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 ASSERT(m_Type == PDFOBJ_ARRAY); | 548 ASSERT(m_Type == PDFOBJ_ARRAY); |
549 CPDF_Number* pNumber = new CPDF_Number; | 549 CPDF_Number* pNumber = new CPDF_Number; |
550 pNumber->SetNumber(f); | 550 pNumber->SetNumber(f); |
551 Add(pNumber); | 551 Add(pNumber); |
552 } | 552 } |
553 void CPDF_Array::AddReference(CPDF_IndirectObjects* pDoc, FX_DWORD objnum) | 553 void CPDF_Array::AddReference(CPDF_IndirectObjects* pDoc, FX_DWORD objnum) |
554 { | 554 { |
555 ASSERT(m_Type == PDFOBJ_ARRAY); | 555 ASSERT(m_Type == PDFOBJ_ARRAY); |
556 Add(new CPDF_Reference(pDoc, objnum)); | 556 Add(new CPDF_Reference(pDoc, objnum)); |
557 } | 557 } |
558 FX_BOOL CPDF_Array::Identical(CPDF_Array* pOther) const | 558 bool CPDF_Array::Identical(CPDF_Array* pOther) const |
559 { | 559 { |
560 if (m_Objects.GetSize() != pOther->m_Objects.GetSize()) { | 560 if (m_Objects.GetSize() != pOther->m_Objects.GetSize()) { |
561 return FALSE; | 561 return false; |
562 } | 562 } |
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 void* 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 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 } | 672 } |
673 FX_FLOAT CPDF_Dictionary::GetNumber(const CFX_ByteStringC& key) const | 673 FX_FLOAT CPDF_Dictionary::GetNumber(const CFX_ByteStringC& key) const |
674 { | 674 { |
675 CPDF_Object* p = NULL; | 675 CPDF_Object* p = NULL; |
676 m_Map.Lookup(key, (void*&)p); | 676 m_Map.Lookup(key, (void*&)p); |
677 if (p) { | 677 if (p) { |
678 return p->GetNumber(); | 678 return p->GetNumber(); |
679 } | 679 } |
680 return 0; | 680 return 0; |
681 } | 681 } |
682 FX_BOOL CPDF_Dictionary::GetBoolean(const CFX_ByteStringC& key, FX_BOOL bDefault
) const | 682 bool CPDF_Dictionary::GetBoolean(const CFX_ByteStringC& key, bool bDefault) cons
t |
683 { | 683 { |
684 CPDF_Object* p = NULL; | 684 CPDF_Object* p = NULL; |
685 m_Map.Lookup(key, (void*&)p); | 685 m_Map.Lookup(key, (void*&)p); |
686 if (p && p->GetType() == PDFOBJ_BOOLEAN) { | 686 if (p && p->GetType() == PDFOBJ_BOOLEAN) { |
687 return p->GetInteger(); | 687 return p->GetInteger(); |
688 } | 688 } |
689 return bDefault; | 689 return bDefault; |
690 } | 690 } |
691 CPDF_Dictionary* CPDF_Dictionary::GetDict(const CFX_ByteStringC& key) const | 691 CPDF_Dictionary* CPDF_Dictionary::GetDict(const CFX_ByteStringC& key) const |
692 { | 692 { |
(...skipping 34 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 pObj->m_ObjNum = objnum; | 1280 pObj->m_ObjNum = objnum; |
1281 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); | 1281 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); |
1282 if (m_LastObjNum < objnum) { | 1282 if (m_LastObjNum < objnum) { |
1283 m_LastObjNum = objnum; | 1283 m_LastObjNum = objnum; |
1284 } | 1284 } |
1285 } | 1285 } |
1286 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const | 1286 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const |
1287 { | 1287 { |
1288 return m_LastObjNum; | 1288 return m_LastObjNum; |
1289 } | 1289 } |
OLD | NEW |