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/fgas/xml/fgas_sax.h" | 7 #include "xfa/fgas/xml/fgas_sax.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 m_dwBufSize(0), | 25 m_dwBufSize(0), |
26 m_dwBufIndex(0) {} | 26 m_dwBufIndex(0) {} |
27 FX_BOOL CFX_SAXFile::StartFile(IFX_FileRead* pFile, | 27 FX_BOOL CFX_SAXFile::StartFile(IFX_FileRead* pFile, |
28 uint32_t dwStart, | 28 uint32_t dwStart, |
29 uint32_t dwLen) { | 29 uint32_t dwLen) { |
30 ASSERT(m_pFile == NULL && pFile != NULL); | 30 ASSERT(m_pFile == NULL && pFile != NULL); |
31 uint32_t dwSize = pFile->GetSize(); | 31 uint32_t dwSize = pFile->GetSize(); |
32 if (dwStart >= dwSize) { | 32 if (dwStart >= dwSize) { |
33 return FALSE; | 33 return FALSE; |
34 } | 34 } |
35 if (dwLen == -1 || dwStart + dwLen > dwSize) { | 35 if (dwLen == static_cast<uint32_t>(-1) || dwStart + dwLen > dwSize) { |
36 dwLen = dwSize - dwStart; | 36 dwLen = dwSize - dwStart; |
37 } | 37 } |
38 if (dwLen == 0) { | 38 if (dwLen == 0) { |
39 return FALSE; | 39 return FALSE; |
40 } | 40 } |
41 m_dwBufSize = std::min(dwLen, kSaxFileBufSize); | 41 m_dwBufSize = std::min(dwLen, kSaxFileBufSize); |
42 m_pBuf = FX_Alloc(uint8_t, m_dwBufSize); | 42 m_pBuf = FX_Alloc(uint8_t, m_dwBufSize); |
43 if (!pFile->ReadBlock(m_pBuf, dwStart, m_dwBufSize)) { | 43 if (!pFile->ReadBlock(m_pBuf, dwStart, m_dwBufSize)) { |
44 return FALSE; | 44 return FALSE; |
45 } | 45 } |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 void CFX_SAXReader::SkipCurrentNode() { | 679 void CFX_SAXReader::SkipCurrentNode() { |
680 if (!m_pCurItem) | 680 if (!m_pCurItem) |
681 return; | 681 return; |
682 | 682 |
683 m_pCurItem->m_bSkip = TRUE; | 683 m_pCurItem->m_bSkip = TRUE; |
684 } | 684 } |
685 | 685 |
686 void CFX_SAXReader::SetHandler(CXFA_SAXReaderHandler* pHandler) { | 686 void CFX_SAXReader::SetHandler(CXFA_SAXReaderHandler* pHandler) { |
687 m_pHandler = pHandler; | 687 m_pHandler = pHandler; |
688 } | 688 } |
OLD | NEW |