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

Side by Side Diff: core/src/fxcrt/xml_int.h

Issue 1252613002: FX_BOOL considered harmful. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual edits. Created 5 years, 5 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
« no previous file with comments | « core/src/fxcrt/fxcrt_windows.cpp ('k') | core/src/fxge/agg/include/fx_agg_driver.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_SRC_FXCRT_XML_INT_H_ 7 #ifndef CORE_SRC_FXCRT_XML_INT_H_
8 #define CORE_SRC_FXCRT_XML_INT_H_ 8 #define CORE_SRC_FXCRT_XML_INT_H_
9 9
10 #include "../../include/fxcrt/fx_stream.h" 10 #include "../../include/fxcrt/fx_stream.h"
11 11
12 class CXML_DataBufAcc : public IFX_BufferRead 12 class CXML_DataBufAcc : public IFX_BufferRead
13 { 13 {
14 public: 14 public:
15 CXML_DataBufAcc(const uint8_t* pBuffer, size_t size) 15 CXML_DataBufAcc(const uint8_t* pBuffer, size_t size)
16 : m_pBuffer(pBuffer) 16 : m_pBuffer(pBuffer)
17 , m_dwSize(size) 17 , m_dwSize(size)
18 , m_dwCurPos(0) 18 , m_dwCurPos(0)
19 { 19 {
20 } 20 }
21 virtual ~CXML_DataBufAcc() {} 21 virtual ~CXML_DataBufAcc() {}
22 virtual void Release() 22 virtual void Release()
23 { 23 {
24 delete this; 24 delete this;
25 } 25 }
26 virtual FX_BOOL» » » IsEOF() 26 virtual bool» » » IsEOF()
27 { 27 {
28 return m_dwCurPos >= m_dwSize; 28 return m_dwCurPos >= m_dwSize;
29 } 29 }
30 virtual FX_FILESIZE GetPosition() 30 virtual FX_FILESIZE GetPosition()
31 { 31 {
32 return (FX_FILESIZE)m_dwCurPos; 32 return (FX_FILESIZE)m_dwCurPos;
33 } 33 }
34 virtual size_t ReadBlock(void* buffer, size_t size) 34 virtual size_t ReadBlock(void* buffer, size_t size)
35 { 35 {
36 return 0; 36 return 0;
37 } 37 }
38 virtual FX_BOOL» » » ReadNextBlock(FX_BOOL bRestart = FALSE) 38 virtual bool» » » ReadNextBlock(bool bRestart = false)
39 { 39 {
40 if (bRestart) { 40 if (bRestart) {
41 m_dwCurPos = 0; 41 m_dwCurPos = 0;
42 } 42 }
43 if (m_dwCurPos < m_dwSize) { 43 if (m_dwCurPos < m_dwSize) {
44 m_dwCurPos = m_dwSize; 44 m_dwCurPos = m_dwSize;
45 return TRUE; 45 return true;
46 } 46 }
47 return FALSE; 47 return false;
48 } 48 }
49 virtual const uint8_t* GetBlockBuffer() 49 virtual const uint8_t* GetBlockBuffer()
50 { 50 {
51 return m_pBuffer; 51 return m_pBuffer;
52 } 52 }
53 virtual size_t GetBlockSize() 53 virtual size_t GetBlockSize()
54 { 54 {
55 return m_dwSize; 55 return m_dwSize;
56 } 56 }
57 virtual FX_FILESIZE GetBlockOffset() 57 virtual FX_FILESIZE GetBlockOffset()
(...skipping 20 matching lines...) Expand all
78 virtual ~CXML_DataStmAcc() 78 virtual ~CXML_DataStmAcc()
79 { 79 {
80 if (m_pBuffer) { 80 if (m_pBuffer) {
81 FX_Free(m_pBuffer); 81 FX_Free(m_pBuffer);
82 } 82 }
83 } 83 }
84 virtual void Release() 84 virtual void Release()
85 { 85 {
86 delete this; 86 delete this;
87 } 87 }
88 virtual FX_BOOL» » » IsEOF() 88 virtual bool» » » IsEOF()
89 { 89 {
90 return m_nStart + (FX_FILESIZE)m_dwSize >= m_pFileRead->GetSize(); 90 return m_nStart + (FX_FILESIZE)m_dwSize >= m_pFileRead->GetSize();
91 } 91 }
92 virtual FX_FILESIZE GetPosition() 92 virtual FX_FILESIZE GetPosition()
93 { 93 {
94 return m_nStart + (FX_FILESIZE)m_dwSize; 94 return m_nStart + (FX_FILESIZE)m_dwSize;
95 } 95 }
96 virtual size_t ReadBlock(void* buffer, size_t size) 96 virtual size_t ReadBlock(void* buffer, size_t size)
97 { 97 {
98 return 0; 98 return 0;
99 } 99 }
100 virtual FX_BOOL» » » ReadNextBlock(FX_BOOL bRestart = FALSE) 100 virtual bool» » » ReadNextBlock(bool bRestart = false)
101 { 101 {
102 if (bRestart) { 102 if (bRestart) {
103 m_nStart = 0; 103 m_nStart = 0;
104 } 104 }
105 FX_FILESIZE nLength = m_pFileRead->GetSize(); 105 FX_FILESIZE nLength = m_pFileRead->GetSize();
106 m_nStart += (FX_FILESIZE)m_dwSize; 106 m_nStart += (FX_FILESIZE)m_dwSize;
107 if (m_nStart >= nLength) { 107 if (m_nStart >= nLength) {
108 return FALSE; 108 return false;
109 } 109 }
110 m_dwSize = (size_t)FX_MIN(FX_XMLDATASTREAM_BufferSize, nLength - m_nStar t); 110 m_dwSize = (size_t)FX_MIN(FX_XMLDATASTREAM_BufferSize, nLength - m_nStar t);
111 if (!m_pBuffer) { 111 if (!m_pBuffer) {
112 m_pBuffer = FX_Alloc(uint8_t, m_dwSize); 112 m_pBuffer = FX_Alloc(uint8_t, m_dwSize);
113 } 113 }
114 return m_pFileRead->ReadBlock(m_pBuffer, m_nStart, m_dwSize); 114 return m_pFileRead->ReadBlock(m_pBuffer, m_nStart, m_dwSize);
115 } 115 }
116 virtual const uint8_t* GetBlockBuffer() 116 virtual const uint8_t* GetBlockBuffer()
117 { 117 {
118 return (const uint8_t*)m_pBuffer; 118 return (const uint8_t*)m_pBuffer;
(...skipping 10 matching lines...) Expand all
129 IFX_FileRead *m_pFileRead; 129 IFX_FileRead *m_pFileRead;
130 uint8_t* m_pBuffer; 130 uint8_t* m_pBuffer;
131 FX_FILESIZE m_nStart; 131 FX_FILESIZE m_nStart;
132 size_t m_dwSize; 132 size_t m_dwSize;
133 }; 133 };
134 class CXML_Parser 134 class CXML_Parser
135 { 135 {
136 public: 136 public:
137 ~CXML_Parser(); 137 ~CXML_Parser();
138 IFX_BufferRead* m_pDataAcc; 138 IFX_BufferRead* m_pDataAcc;
139 FX_BOOL» » » m_bOwnedStream; 139 bool» » » m_bOwnedStream;
140 FX_FILESIZE m_nOffset; 140 FX_FILESIZE m_nOffset;
141 FX_BOOL» » » m_bSaveSpaceChars; 141 bool» » » m_bSaveSpaceChars;
142 const uint8_t* m_pBuffer; 142 const uint8_t* m_pBuffer;
143 size_t m_dwBufferSize; 143 size_t m_dwBufferSize;
144 FX_FILESIZE m_nBufferOffset; 144 FX_FILESIZE m_nBufferOffset;
145 size_t m_dwIndex; 145 size_t m_dwIndex;
146 FX_BOOL» » » Init(uint8_t* pBuffer, size_t size); 146 bool» » » Init(uint8_t* pBuffer, size_t size);
147 FX_BOOL» » » Init(IFX_FileRead *pFileRead); 147 bool» » » Init(IFX_FileRead *pFileRead);
148 FX_BOOL» » » Init(IFX_BufferRead *pBuffer); 148 bool» » » Init(IFX_BufferRead *pBuffer);
149 FX_BOOL» » » Init(FX_BOOL bOwndedStream); 149 bool» » » Init(bool bOwndedStream);
150 FX_BOOL» » » ReadNextBlock(); 150 bool» » » ReadNextBlock();
151 FX_BOOL» » » IsEOF(); 151 bool» » » IsEOF();
152 FX_BOOL» » » HaveAvailData(); 152 bool» » » HaveAvailData();
153 void SkipWhiteSpaces(); 153 void SkipWhiteSpaces();
154 void GetName(CFX_ByteString& space, CFX_ByteString& n ame); 154 void GetName(CFX_ByteString& space, CFX_ByteString& n ame);
155 void GetAttrValue(CFX_WideString &value); 155 void GetAttrValue(CFX_WideString &value);
156 FX_DWORD GetCharRef(); 156 FX_DWORD GetCharRef();
157 void» » » GetTagName(CFX_ByteString &space, CFX_ByteString &name, FX_BOOL &bEndTag, FX_BOOL bStartTag = FALSE); 157 void» » » GetTagName(CFX_ByteString &space, CFX_ByteString &name, bool &bEndTag, bool bStartTag = false);
158 void SkipLiterals(const CFX_ByteStringC& str); 158 void SkipLiterals(const CFX_ByteStringC& str);
159 CXML_Element*» ParseElement(CXML_Element* pParent, FX_BOOL bStartTag = FALSE); 159 CXML_Element*» ParseElement(CXML_Element* pParent, bool bStartTag = fal se);
160 void» » » InsertContentSegment(FX_BOOL bCDATA, const CFX_W ideStringC& content, CXML_Element* pElement); 160 void» » » InsertContentSegment(bool bCDATA, const CFX_Wide StringC& content, CXML_Element* pElement);
161 void InsertCDATASegment(CFX_UTF8Decoder& decoder, CXM L_Element* pElement); 161 void InsertCDATASegment(CFX_UTF8Decoder& decoder, CXM L_Element* pElement);
162 }; 162 };
163 void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName, CFX_ByteString C &bsSpace, CFX_ByteStringC &bsName); 163 void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName, CFX_ByteString C &bsSpace, CFX_ByteStringC &bsName);
164 164
165 #endif // CORE_SRC_FXCRT_XML_INT_H_ 165 #endif // CORE_SRC_FXCRT_XML_INT_H_
OLDNEW
« no previous file with comments | « core/src/fxcrt/fxcrt_windows.cpp ('k') | core/src/fxge/agg/include/fx_agg_driver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698