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

Side by Side Diff: xfa/fgas/xml/fgas_sax.cpp

Issue 1930533002: More IFX_ interface cleanup. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 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 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/fgas/xml/fgas_sax_imp.h" 7 #include "xfa/fgas/xml/fgas_sax.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "xfa/fxfa/include/xfa_checksum.h"
12
11 namespace { 13 namespace {
12 14
13 const uint32_t kSaxFileBufSize = 32768; 15 const uint32_t kSaxFileBufSize = 32768;
14 16
15 } // namespace 17 } // namespace
16 18
17 IFX_SAXReader* FX_SAXReader_Create() {
18 return new CFX_SAXReader;
19 }
20 CFX_SAXFile::CFX_SAXFile() 19 CFX_SAXFile::CFX_SAXFile()
21 : m_pFile(NULL), 20 : m_pFile(NULL),
22 m_dwStart(0), 21 m_dwStart(0),
23 m_dwEnd(0), 22 m_dwEnd(0),
24 m_dwCur(0), 23 m_dwCur(0),
25 m_pBuf(NULL), 24 m_pBuf(NULL),
26 m_dwBufSize(0), 25 m_dwBufSize(0),
27 m_dwBufIndex(0) {} 26 m_dwBufIndex(0) {}
28 FX_BOOL CFX_SAXFile::StartFile(IFX_FileRead* pFile, 27 FX_BOOL CFX_SAXFile::StartFile(IFX_FileRead* pFile,
29 uint32_t dwStart, 28 uint32_t dwStart,
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 m_pHandler->OnTagBreak(m_pCurItem->m_pNode); 649 m_pHandler->OnTagBreak(m_pCurItem->m_pNode);
651 } 650 }
652 } 651 }
653 void CFX_SAXReader::NotifyClose() { 652 void CFX_SAXReader::NotifyClose() {
654 FXSYS_assert(m_pHandler != NULL); 653 FXSYS_assert(m_pHandler != NULL);
655 if (m_pCurItem->m_eNode == FX_SAXNODE_Tag || 654 if (m_pCurItem->m_eNode == FX_SAXNODE_Tag ||
656 m_pCurItem->m_eNode == FX_SAXNODE_Instruction) { 655 m_pCurItem->m_eNode == FX_SAXNODE_Instruction) {
657 m_pHandler->OnTagClose(m_pCurItem->m_pNode, m_dwNodePos); 656 m_pHandler->OnTagClose(m_pCurItem->m_pNode, m_dwNodePos);
658 } 657 }
659 } 658 }
659
660 void CFX_SAXReader::NotifyEnd() { 660 void CFX_SAXReader::NotifyEnd() {
661 FXSYS_assert(m_pHandler != NULL); 661 FXSYS_assert(m_pHandler);
Lei Zhang 2016/04/27 19:23:49 Delete? If the assertion fails, this will likely c
dsinclair 2016/04/27 19:31:32 Done.
662 if (m_pCurItem->m_eNode == FX_SAXNODE_Tag) { 662
663 m_pHandler->OnTagEnd(m_pCurItem->m_pNode, 663 if (m_pCurItem->m_eNode != FX_SAXNODE_Tag)
664 CFX_ByteStringC(m_pszData, m_iDataLength), 664 return;
665 m_dwNodePos); 665
666 } 666 m_pHandler->OnTagEnd(m_pCurItem->m_pNode,
667 CFX_ByteStringC(m_pszData, m_iDataLength), m_dwNodePos);
667 } 668 }
669
668 void CFX_SAXReader::NotifyTargetData() { 670 void CFX_SAXReader::NotifyTargetData() {
669 FXSYS_assert(m_pHandler != NULL); 671 FXSYS_assert(m_pHandler);
672
670 if (m_pCurItem->m_eNode == FX_SAXNODE_Instruction) { 673 if (m_pCurItem->m_eNode == FX_SAXNODE_Instruction) {
671 m_pHandler->OnTargetData(m_pCurItem->m_pNode, m_pCurItem->m_eNode, 674 m_pHandler->OnTargetData(m_pCurItem->m_pNode, m_pCurItem->m_eNode,
672 CFX_ByteStringC(m_pszName, m_iNameLength), 675 CFX_ByteStringC(m_pszName, m_iNameLength),
673 m_dwNodePos); 676 m_dwNodePos);
674 } else if (m_pCurItem->m_eNode == FX_SAXNODE_Comment) { 677 } else if (m_pCurItem->m_eNode == FX_SAXNODE_Comment) {
675 m_pHandler->OnTargetData(m_pCurItem->m_pNode, m_pCurItem->m_eNode, 678 m_pHandler->OnTargetData(m_pCurItem->m_pNode, m_pCurItem->m_eNode,
676 CFX_ByteStringC(m_pszData, m_iDataLength), 679 CFX_ByteStringC(m_pszData, m_iDataLength),
677 m_dwNodePos); 680 m_dwNodePos);
678 } 681 }
679 } 682 }
683
680 void CFX_SAXReader::SkipCurrentNode() { 684 void CFX_SAXReader::SkipCurrentNode() {
681 if (!m_pCurItem) { 685 if (!m_pCurItem)
682 return; 686 return;
683 } 687
684 m_pCurItem->m_bSkip = TRUE; 688 m_pCurItem->m_bSkip = TRUE;
685 } 689 }
686 void CFX_SAXReader::SetHandler(IFX_SAXReaderHandler* pHandler) { 690
691 void CFX_SAXReader::SetHandler(CXFA_SAXReaderHandler* pHandler) {
687 m_pHandler = pHandler; 692 m_pHandler = pHandler;
688 } 693 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698