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

Side by Side Diff: core/include/fpdfapi/fpdf_parser.h

Issue 1539573003: Convert CPDF_Parser::m_CrossRef to a std::map. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_
8 #define CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ 8 #define CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_
9 9
10 #include <map> 10 #include <map>
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 void CloseParser(FX_BOOL bReParse = FALSE); 387 void CloseParser(FX_BOOL bReParse = FALSE);
388 388
389 FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE); 389 FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE);
390 390
391 FX_BOOL IsOwner(); 391 FX_BOOL IsOwner();
392 392
393 void SetPassword(const FX_CHAR* password) { m_Password = password; } 393 void SetPassword(const FX_CHAR* password) { m_Password = password; }
394 394
395 CFX_ByteString GetPassword() { return m_Password; } 395 CFX_ByteString GetPassword() { return m_Password; }
396 396
397 CPDF_SecurityHandler* GetSecurityHandler() {
Lei Zhang 2015/12/18 01:36:04 Some dead code here.
398 return m_pSecurityHandler.get();
399 }
400
401 CPDF_CryptoHandler* GetCryptoHandler() { 397 CPDF_CryptoHandler* GetCryptoHandler() {
402 return m_Syntax.m_pCryptoHandler.get(); 398 return m_Syntax.m_pCryptoHandler.get();
403 } 399 }
404 400
405 void SetSecurityHandler(CPDF_SecurityHandler* pSecurityHandler, 401 void SetSecurityHandler(CPDF_SecurityHandler* pSecurityHandler,
406 FX_BOOL bForced = FALSE); 402 FX_BOOL bForced = FALSE);
407 403
408 CFX_ByteString GetRecipient() { return m_bsRecipient; }
409
410 CPDF_Dictionary* GetTrailer() { return m_pTrailer; } 404 CPDF_Dictionary* GetTrailer() { return m_pTrailer; }
411 405
412 FX_FILESIZE GetLastXRefOffset() { return m_LastXRefOffset; } 406 FX_FILESIZE GetLastXRefOffset() { return m_LastXRefOffset; }
413 407
414 CPDF_Document* GetDocument() { return m_pDocument; } 408 CPDF_Document* GetDocument() { return m_pDocument; }
415 409
416 CFX_ArrayTemplate<CPDF_Dictionary*>* GetOtherTrailers() {
417 return &m_Trailers;
418 }
419
420 FX_DWORD GetRootObjNum(); 410 FX_DWORD GetRootObjNum();
421 FX_DWORD GetInfoObjNum(); 411 FX_DWORD GetInfoObjNum();
422 CPDF_Array* GetIDArray(); 412 CPDF_Array* GetIDArray();
423 413
424 CPDF_Dictionary* GetEncryptDict() { return m_pEncryptDict; } 414 CPDF_Dictionary* GetEncryptDict() { return m_pEncryptDict; }
425 415
426 FX_BOOL IsEncrypted() { return GetEncryptDict() != NULL; }
427
428 CPDF_Object* ParseIndirectObject(CPDF_IndirectObjects* pObjList, 416 CPDF_Object* ParseIndirectObject(CPDF_IndirectObjects* pObjList,
429 FX_DWORD objnum, 417 FX_DWORD objnum,
430 PARSE_CONTEXT* pContext = NULL); 418 PARSE_CONTEXT* pContext = NULL);
431 FX_DWORD GetLastObjNum(); 419 void SetLastObjNum(FX_DWORD num);
Wei Li 2015/12/18 19:20:34 I think this may not be needed. The intent of call
Lei Zhang 2015/12/19 02:09:52 Done. I think that works because all the callers a
420 FX_DWORD GetLastObjNum() const;
Wei Li 2015/12/18 19:20:34 To get the largest obj number in pdf, it can direc
Lei Zhang 2015/12/19 02:09:52 But if the map is empty, there's no last key. Thus
421 FX_DWORD GetSize() const;
Wei Li 2015/12/18 19:20:34 Similarly, GetSize for a parser could be ambiguous
Lei Zhang 2015/12/19 02:09:52 I replaced it with IsValidObjectNumber().
432 FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm); 422 FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm);
433 423
434 FX_FILESIZE GetObjectOffset(FX_DWORD objnum); 424 FX_FILESIZE GetObjectOffset(FX_DWORD objnum);
435 425
436 FX_FILESIZE GetObjectSize(FX_DWORD objnum); 426 FX_FILESIZE GetObjectSize(FX_DWORD objnum);
437 427
438 int GetObjectVersion(FX_DWORD objnum) { return m_ObjVersion[objnum]; }
439
440 void GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD& size); 428 void GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD& size);
441 429
442 FX_BOOL GetFileStreamOption() { return m_Syntax.m_bFileStream; }
443
444 void SetFileStreamOption(FX_BOOL b) { m_Syntax.m_bFileStream = b; }
445
446 IFX_FileRead* GetFileAccess() const { return m_Syntax.m_pFileAccess; } 430 IFX_FileRead* GetFileAccess() const { return m_Syntax.m_pFileAccess; }
447 431
448 int GetFileVersion() const { return m_FileVersion; } 432 int GetFileVersion() const { return m_FileVersion; }
449 433
450 FX_BOOL IsXRefStream() const { return m_bXRefStream; } 434 FX_BOOL IsXRefStream() const { return m_bXRefStream; }
451 CPDF_Object* ParseIndirectObjectAt(CPDF_IndirectObjects* pObjList, 435 CPDF_Object* ParseIndirectObjectAt(CPDF_IndirectObjects* pObjList,
452 FX_FILESIZE pos, 436 FX_FILESIZE pos,
453 FX_DWORD objnum, 437 FX_DWORD objnum,
454 struct PARSE_CONTEXT* pContext); 438 struct PARSE_CONTEXT* pContext);
455 439
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 nonstd::unique_ptr<CPDF_SecurityHandler> m_pSecurityHandler; 500 nonstd::unique_ptr<CPDF_SecurityHandler> m_pSecurityHandler;
517 501
518 FX_BOOL m_bForceUseSecurityHandler; 502 FX_BOOL m_bForceUseSecurityHandler;
519 503
520 CFX_ByteString m_bsRecipient; 504 CFX_ByteString m_bsRecipient;
521 505
522 CFX_ByteString m_FilePath; 506 CFX_ByteString m_FilePath;
523 507
524 CFX_ByteString m_Password; 508 CFX_ByteString m_Password;
525 509
526 CFX_FileSizeArray m_CrossRef; 510 struct ObjectInfo {
511 ObjectInfo() : pos(0) {}
512
513 FX_FILESIZE pos;
514 // TODO(thestig): Use fields below in place of |m_V5Type| and |m_ObjVersion|
515 #if 0
516 uint8_t type;
517 uint16_t gennum;
518 #endif
519 };
520 std::map<FX_DWORD, ObjectInfo> m_ObjectInfo;
521 FX_DWORD m_dwLastObjnum;
527 522
528 CFX_ByteArray m_V5Type; 523 CFX_ByteArray m_V5Type;
524 CFX_WordArray m_ObjVersion;
529 525
530 CFX_FileSizeArray m_SortedOffset; 526 CFX_FileSizeArray m_SortedOffset;
531 527
532 CFX_WordArray m_ObjVersion;
533 CFX_ArrayTemplate<CPDF_Dictionary*> m_Trailers; 528 CFX_ArrayTemplate<CPDF_Dictionary*> m_Trailers;
534 529
535 FX_BOOL m_bVersionUpdated; 530 FX_BOOL m_bVersionUpdated;
536 531
537 CPDF_Object* m_pLinearized; 532 CPDF_Object* m_pLinearized;
538 533
539 FX_DWORD m_dwFirstPageNo; 534 FX_DWORD m_dwFirstPageNo;
540 535
541 FX_DWORD m_dwXrefStartObjNum; 536 FX_DWORD m_dwXrefStartObjNum;
542 537
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 FX_DWORD src_size, 998 FX_DWORD src_size,
1004 const CPDF_Dictionary* pDict, 999 const CPDF_Dictionary* pDict,
1005 uint8_t*& dest_buf, 1000 uint8_t*& dest_buf,
1006 FX_DWORD& dest_size, 1001 FX_DWORD& dest_size,
1007 CFX_ByteString& ImageEncoding, 1002 CFX_ByteString& ImageEncoding,
1008 CPDF_Dictionary*& pImageParms, 1003 CPDF_Dictionary*& pImageParms,
1009 FX_DWORD estimated_size, 1004 FX_DWORD estimated_size,
1010 FX_BOOL bImageAcc); 1005 FX_BOOL bImageAcc);
1011 1006
1012 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ 1007 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp » ('j') | core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698