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

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

Issue 2345063002: Use string pools in some dictionaries (Closed)
Patch Set: windows compilation Created 4 years, 3 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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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_FPDFAPI_FPDF_PARSER_CPDF_SYNTAX_PARSER_H_ 7 #ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_SYNTAX_PARSER_H_
8 #define CORE_FPDFAPI_FPDF_PARSER_CPDF_SYNTAX_PARSER_H_ 8 #define CORE_FPDFAPI_FPDF_PARSER_CPDF_SYNTAX_PARSER_H_
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "core/fxcrt/include/cfx_string_pool_template.h"
12 #include "core/fxcrt/include/fx_basic.h" 13 #include "core/fxcrt/include/fx_basic.h"
13 14
14 class CPDF_CryptoHandler; 15 class CPDF_CryptoHandler;
15 class CPDF_Dictionary; 16 class CPDF_Dictionary;
16 class CPDF_IndirectObjectHolder; 17 class CPDF_IndirectObjectHolder;
17 class CPDF_Object; 18 class CPDF_Object;
18 class CPDF_Stream; 19 class CPDF_Stream;
19 class IFX_FileRead; 20 class IFX_FileRead;
20 21
21 class CPDF_SyntaxParser { 22 class CPDF_SyntaxParser {
22 public: 23 public:
23 CPDF_SyntaxParser(); 24 CPDF_SyntaxParser();
25 CPDF_SyntaxParser(CFX_ByteStringPool* pPool);
Lei Zhang 2016/09/20 23:48:23 explicit
24 ~CPDF_SyntaxParser(); 26 ~CPDF_SyntaxParser();
25 27
26 void InitParser(IFX_FileRead* pFileAccess, uint32_t HeaderOffset); 28 void InitParser(IFX_FileRead* pFileAccess, uint32_t HeaderOffset);
27 29
28 FX_FILESIZE SavePos() const { return m_Pos; } 30 FX_FILESIZE SavePos() const { return m_Pos; }
29 void RestorePos(FX_FILESIZE pos) { m_Pos = pos; } 31 void RestorePos(FX_FILESIZE pos) { m_Pos = pos; }
30 32
31 CPDF_Object* GetObject(CPDF_IndirectObjectHolder* pObjList, 33 CPDF_Object* GetObject(CPDF_IndirectObjectHolder* pObjList,
32 uint32_t objnum, 34 uint32_t objnum,
33 uint32_t gennum, 35 uint32_t gennum,
(...skipping 23 matching lines...) Expand all
57 59
58 private: 60 private:
59 friend class CPDF_Parser; 61 friend class CPDF_Parser;
60 friend class CPDF_DataAvail; 62 friend class CPDF_DataAvail;
61 friend class cpdf_syntax_parser_ReadHexString_Test; 63 friend class cpdf_syntax_parser_ReadHexString_Test;
62 64
63 static const int kParserMaxRecursionDepth = 64; 65 static const int kParserMaxRecursionDepth = 64;
64 static int s_CurrentRecursionDepth; 66 static int s_CurrentRecursionDepth;
65 67
66 uint32_t GetDirectNum(); 68 uint32_t GetDirectNum();
67
68 FX_BOOL GetNextChar(uint8_t& ch); 69 FX_BOOL GetNextChar(uint8_t& ch);
69 FX_BOOL GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch); 70 FX_BOOL GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch);
70 void GetNextWordInternal(bool* bIsNumber); 71 void GetNextWordInternal(bool* bIsNumber);
71 bool IsWholeWord(FX_FILESIZE startpos, 72 bool IsWholeWord(FX_FILESIZE startpos,
72 FX_FILESIZE limit, 73 FX_FILESIZE limit,
73 const CFX_ByteStringC& tag, 74 const CFX_ByteStringC& tag,
74 FX_BOOL checkKeyword); 75 FX_BOOL checkKeyword);
75 76
76 CFX_ByteString ReadString(); 77 CFX_ByteString ReadString();
77 CFX_ByteString ReadHexString(); 78 CFX_ByteString ReadHexString();
78 unsigned int ReadEOLMarkers(FX_FILESIZE pos); 79 unsigned int ReadEOLMarkers(FX_FILESIZE pos);
79 CPDF_Stream* ReadStream(CPDF_Dictionary* pDict, 80 CPDF_Stream* ReadStream(CPDF_Dictionary* pDict,
80 uint32_t objnum, 81 uint32_t objnum,
81 uint32_t gennum); 82 uint32_t gennum);
82 83
84 CFX_ByteString MaybeIntern(const CFX_ByteString& str);
85
83 FX_FILESIZE m_Pos; 86 FX_FILESIZE m_Pos;
84 int m_MetadataObjnum; 87 int m_MetadataObjnum;
85 IFX_FileRead* m_pFileAccess; 88 IFX_FileRead* m_pFileAccess;
86 FX_FILESIZE m_HeaderOffset; 89 FX_FILESIZE m_HeaderOffset;
87 FX_FILESIZE m_FileLen; 90 FX_FILESIZE m_FileLen;
88 uint8_t* m_pFileBuf; 91 uint8_t* m_pFileBuf;
89 uint32_t m_BufSize; 92 uint32_t m_BufSize;
90 FX_FILESIZE m_BufOffset; 93 FX_FILESIZE m_BufOffset;
91 std::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler; 94 std::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler;
92 uint8_t m_WordBuffer[257]; 95 uint8_t m_WordBuffer[257];
93 uint32_t m_WordSize; 96 uint32_t m_WordSize;
97 CFX_ByteStringPool* const m_pPool;
94 }; 98 };
95 99
96 #endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_SYNTAX_PARSER_H_ 100 #endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_SYNTAX_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698