diff options
author | dsinclair <dsinclair@chromium.org> | 2016-04-27 12:47:01 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-27 12:47:01 -0700 |
commit | 303e525325904cd9b6a847f48951510e7dd8a45e (patch) | |
tree | dab3ff0e3bda317dc51ef0caf8d15daf88e7e6b8 /xfa/fxfa/app/xfa_checksum.cpp | |
parent | 43854a5073602a4613131aa6dbac5f7b9a095bcd (diff) | |
download | pdfium-303e525325904cd9b6a847f48951510e7dd8a45e.tar.xz |
More IFX_ interface cleanup.
Remove IFX_FontProvider, IFX_FontSourceEnum, IFX_SAXReader and
IFX_SAXReaderHandler.
Review-Url: https://codereview.chromium.org/1930533002
Diffstat (limited to 'xfa/fxfa/app/xfa_checksum.cpp')
-rw-r--r-- | xfa/fxfa/app/xfa_checksum.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/xfa/fxfa/app/xfa_checksum.cpp b/xfa/fxfa/app/xfa_checksum.cpp index 59bf37b6a5..195033bfab 100644 --- a/xfa/fxfa/app/xfa_checksum.cpp +++ b/xfa/fxfa/app/xfa_checksum.cpp @@ -126,30 +126,28 @@ void CXFA_SAXReaderHandler::UpdateChecksum(FX_BOOL bCheckSpace) { } CXFA_ChecksumContext::CXFA_ChecksumContext() - : m_pSAXReader(NULL), m_pByteContext(NULL) {} + : m_pSAXReader(nullptr), m_pByteContext(nullptr) {} + CXFA_ChecksumContext::~CXFA_ChecksumContext() { FinishChecksum(); } -FX_BOOL CXFA_ChecksumContext::StartChecksum() { + +void CXFA_ChecksumContext::StartChecksum() { FinishChecksum(); m_pByteContext = FX_Alloc(uint8_t, 128); CRYPT_SHA1Start(m_pByteContext); m_bsChecksum.clear(); - m_pSAXReader = FX_SAXReader_Create(); - return m_pSAXReader != NULL; + m_pSAXReader = new CFX_SAXReader; } + FX_BOOL CXFA_ChecksumContext::UpdateChecksum(IFX_FileRead* pSrcFile, FX_FILESIZE offset, size_t size) { - if (m_pSAXReader == NULL) { - return FALSE; - } - if (pSrcFile == NULL) { + if (!m_pSAXReader || !pSrcFile) return FALSE; - } - if (size < 1) { + if (size < 1) size = pSrcFile->GetSize(); - } + CXFA_SAXReaderHandler handler(this); m_pSAXReader->SetHandler(&handler); if (m_pSAXReader->StartParse( @@ -161,6 +159,7 @@ FX_BOOL CXFA_ChecksumContext::UpdateChecksum(IFX_FileRead* pSrcFile, } return m_pSAXReader->ContinueParse(NULL) > 99; } + void CXFA_ChecksumContext::FinishChecksum() { if (m_pSAXReader) { m_pSAXReader->Release(); |