diff options
author | tsepez <tsepez@chromium.org> | 2016-05-18 11:39:15 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-18 11:39:15 -0700 |
commit | 501e8cdc9143d4b1bebd22e7bfdcae4368e459ee (patch) | |
tree | bfa380d7dfe06f2fbcf7b59b26a7f61bbb0de07f /xfa/fxfa/parser | |
parent | 653951828cf934afb48b57989089a99b38620d02 (diff) | |
download | pdfium-501e8cdc9143d4b1bebd22e7bfdcae4368e459ee.tar.xz |
Remove Release() from CXFA_ChecksumContext
Review-Url: https://codereview.chromium.org/1991913002
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r-- | xfa/fxfa/parser/xfa_parser_imp.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp index 01ea1d6fae..3369e59479 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.cpp +++ b/xfa/fxfa/parser/xfa_parser_imp.cpp @@ -6,6 +6,8 @@ #include "xfa/fxfa/parser/xfa_parser_imp.h" +#include <memory> + #include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fgas/crt/fgas_codepage.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" @@ -565,24 +567,21 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( m_pXMLParser->m_dwCheckStatus != 0x03) { return NULL; } - CXFA_ChecksumContext* pChecksum = new CXFA_ChecksumContext; + std::unique_ptr<CXFA_ChecksumContext> pChecksum(new CXFA_ChecksumContext); pChecksum->StartChecksum(); pChecksum->UpdateChecksum(m_pFileRead, m_pXMLParser->m_nStart[0], m_pXMLParser->m_nSize[0]); pChecksum->UpdateChecksum(m_pFileRead, m_pXMLParser->m_nStart[1], m_pXMLParser->m_nSize[1]); pChecksum->FinishChecksum(); - CFX_ByteString bsCheck; - pChecksum->GetChecksum(bsCheck); - pChecksum->Release(); - if (bsCheck != wsChecksum.UTF8Encode()) { - return NULL; - } + CFX_ByteString bsCheck = pChecksum->GetChecksum(); + if (bsCheck != wsChecksum.UTF8Encode()) + return nullptr; pNode = m_pFactory->CreateNode(XFA_XDPPACKET_Form, XFA_ELEMENT_Form); - if (!pNode) { - return NULL; - } + if (!pNode) + return nullptr; + pNode->SetCData(XFA_ATTRIBUTE_Name, XFA_GetPacketByIndex(XFA_PACKET_Form)->pName); pNode->SetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum.AsStringC()); |