summaryrefslogtreecommitdiff
path: root/xfa/fde/xml/cfx_saxreader.h
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-09-30 15:49:23 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-30 15:49:23 -0700
commitaa69291d2c0f86259351a857acc3f9f073b56a55 (patch)
treee8c1529296b1943fc7394a0a8a170aa418ab9658 /xfa/fde/xml/cfx_saxreader.h
parentcd5bca472261cebc60b37d7bbc8b81b4091a6cd6 (diff)
downloadpdfium-aa69291d2c0f86259351a857acc3f9f073b56a55.tar.xz
Switch CFX_SAXReader to use std::stack.
Fix some nullptr errors. BUG=pdfium:608 Review-Url: https://codereview.chromium.org/2378133003
Diffstat (limited to 'xfa/fde/xml/cfx_saxreader.h')
-rw-r--r--xfa/fde/xml/cfx_saxreader.h20
1 files changed, 8 insertions, 12 deletions
diff --git a/xfa/fde/xml/cfx_saxreader.h b/xfa/fde/xml/cfx_saxreader.h
index 7253c8d633..b6bedfe65c 100644
--- a/xfa/fde/xml/cfx_saxreader.h
+++ b/xfa/fde/xml/cfx_saxreader.h
@@ -7,6 +7,9 @@
#ifndef XFA_FDE_XML_CFX_SAXREADER_H_
#define XFA_FDE_XML_CFX_SAXREADER_H_
+#include <memory>
+#include <stack>
+
#include "core/fxcrt/fx_basic.h"
class CXFA_SAXContext;
@@ -23,20 +26,13 @@ class CFX_SAXItem {
CharData,
};
- CFX_SAXItem()
- : m_pNode(nullptr),
- m_eNode(Type::Unknown),
- m_dwID(0),
- m_bSkip(FALSE),
- m_pPrev(nullptr),
- m_pNext(nullptr) {}
+ explicit CFX_SAXItem(uint32_t id)
+ : m_pNode(nullptr), m_eNode(Type::Unknown), m_dwID(id), m_bSkip(FALSE) {}
CXFA_SAXContext* m_pNode;
Type m_eNode;
- uint32_t m_dwID;
+ const uint32_t m_dwID;
FX_BOOL m_bSkip;
- CFX_SAXItem* m_pPrev;
- CFX_SAXItem* m_pNext;
};
class CFX_SAXFile {
@@ -103,6 +99,7 @@ class CFX_SAXReader {
void Reset();
void Push();
void Pop();
+ CFX_SAXItem* GetCurrentItem() const;
FX_BOOL SkipSpace(uint8_t ch);
void SkipNode();
void NotifyData();
@@ -119,8 +116,7 @@ class CFX_SAXReader {
CFX_SAXFile m_File;
CXFA_SAXReaderHandler* m_pHandler;
int32_t m_iState;
- CFX_SAXItem* m_pRoot;
- CFX_SAXItem* m_pCurItem;
+ std::stack<std::unique_ptr<CFX_SAXItem>> m_Stack;
uint32_t m_dwItemID;
CFX_SaxMode m_eMode;
CFX_SaxMode m_ePrevMode;