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 "xfa/fde/xml/cfx_saxreader.h" | 7 #include "xfa/fde/xml/cfx_saxreader.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
| 12 #include "third_party/base/ptr_util.h" |
12 #include "xfa/fxfa/xfa_checksum.h" | 13 #include "xfa/fxfa/xfa_checksum.h" |
13 | 14 |
14 enum class CFX_SaxMode { | 15 enum class CFX_SaxMode { |
15 Text = 0, | 16 Text = 0, |
16 NodeStart, | 17 NodeStart, |
17 DeclOrComment, | 18 DeclOrComment, |
18 DeclNode, | 19 DeclNode, |
19 Comment, | 20 Comment, |
20 CommentContent, | 21 CommentContent, |
21 TagName, | 22 TagName, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 m_SkipChar = 0; | 153 m_SkipChar = 0; |
153 m_iDataLength = 0; | 154 m_iDataLength = 0; |
154 m_iEntityStart = -1; | 155 m_iEntityStart = -1; |
155 m_iNameLength = 0; | 156 m_iNameLength = 0; |
156 m_iDataPos = 0; | 157 m_iDataPos = 0; |
157 delete m_pCommentContext; | 158 delete m_pCommentContext; |
158 m_pCommentContext = nullptr; | 159 m_pCommentContext = nullptr; |
159 } | 160 } |
160 | 161 |
161 void CFX_SAXReader::Push() { | 162 void CFX_SAXReader::Push() { |
162 std::unique_ptr<CFX_SAXItem> pNew(WrapUnique(new CFX_SAXItem(++m_dwItemID))); | 163 std::unique_ptr<CFX_SAXItem> pNew = |
| 164 pdfium::MakeUnique<CFX_SAXItem>(++m_dwItemID); |
163 if (!m_Stack.empty()) | 165 if (!m_Stack.empty()) |
164 pNew->m_bSkip = m_Stack.top()->m_bSkip; | 166 pNew->m_bSkip = m_Stack.top()->m_bSkip; |
165 m_Stack.push(std::move(pNew)); | 167 m_Stack.push(std::move(pNew)); |
166 } | 168 } |
167 | 169 |
168 void CFX_SAXReader::Pop() { | 170 void CFX_SAXReader::Pop() { |
169 if (!m_Stack.empty()) | 171 if (!m_Stack.empty()) |
170 m_Stack.pop(); | 172 m_Stack.pop(); |
171 } | 173 } |
172 | 174 |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 CFX_SAXItem* pItem = GetCurrentItem(); | 727 CFX_SAXItem* pItem = GetCurrentItem(); |
726 if (!pItem) | 728 if (!pItem) |
727 return; | 729 return; |
728 | 730 |
729 pItem->m_bSkip = TRUE; | 731 pItem->m_bSkip = TRUE; |
730 } | 732 } |
731 | 733 |
732 void CFX_SAXReader::SetHandler(CXFA_SAXReaderHandler* pHandler) { | 734 void CFX_SAXReader::SetHandler(CXFA_SAXReaderHandler* pHandler) { |
733 m_pHandler = pHandler; | 735 m_pHandler = pHandler; |
734 } | 736 } |
OLD | NEW |