summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_dataexporter.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-12-07 12:10:20 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-07 12:10:20 -0800
commit7cda31ac2f2884166f044937619478a6103198cf (patch)
tree640f14ab5c81696cfffdedf0644eac4b1f2bc47f /xfa/fxfa/parser/cxfa_dataexporter.cpp
parentab5a20d9de8c801b8376bfe2d6f7cf9ac7d26028 (diff)
downloadpdfium-7cda31ac2f2884166f044937619478a6103198cf.tar.xz
Refcount IFGAS_ streams all the time, too
IFGAS_Streams are not part of the IFX_Stream hierarchy, but can be made from such. Review-Url: https://codereview.chromium.org/2559763002
Diffstat (limited to 'xfa/fxfa/parser/cxfa_dataexporter.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_dataexporter.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp
index 9760261baf..a9965f52a5 100644
--- a/xfa/fxfa/parser/cxfa_dataexporter.cpp
+++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp
@@ -201,7 +201,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
IFX_MemoryStream::Create(true);
// Note: ambiguous without cast below.
- IFGAS_Stream* pTempStream = IFGAS_Stream::CreateStream(
+ CFX_RetainPtr<IFGAS_Stream> pTempStream = IFGAS_Stream::CreateStream(
CFX_RetainPtr<IFX_SeekableWriteStream>(pMemStream),
FX_STREAMACCESS_Text | FX_STREAMACCESS_Write |
FX_STREAMACCESS_Append);
@@ -210,7 +210,6 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
pRichTextXML->SaveXMLNode(pTempStream);
wsChildren += CFX_WideString::FromUTF8(
CFX_ByteStringC(pMemStream->GetBuffer(), pMemStream->GetSize()));
- pTempStream->Release();
} else if (pRawValueNode->GetElementType() == XFA_Element::Sharpxml &&
wsContentType == FX_WSTRC(L"text/xml")) {
CFX_WideString wsRawValue;
@@ -320,7 +319,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
}
void RegenerateFormFile_Container(CXFA_Node* pNode,
- IFGAS_Stream* pStream,
+ const CFX_RetainPtr<IFGAS_Stream>& pStream,
bool bSaveXML = false) {
XFA_Element eType = pNode->GetElementType();
if (eType == XFA_Element::Field || eType == XFA_Element::Draw ||
@@ -373,10 +372,11 @@ void RegenerateFormFile_Container(CXFA_Node* pNode,
} // namespace
-void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode,
- IFGAS_Stream* pStream,
- const FX_CHAR* pChecksum,
- bool bSaveXML) {
+void XFA_DataExporter_RegenerateFormFile(
+ CXFA_Node* pNode,
+ const CFX_RetainPtr<IFGAS_Stream>& pStream,
+ const FX_CHAR* pChecksum,
+ bool bSaveXML) {
if (pNode->IsModelNode()) {
static const FX_WCHAR s_pwsTagName[] = L"<form";
static const FX_WCHAR s_pwsClose[] = L"</form\n>";
@@ -461,19 +461,17 @@ bool CXFA_DataExporter::Export(
if (!pWrite)
return false;
- IFGAS_Stream* pStream = IFGAS_Stream::CreateStream(
+ CFX_RetainPtr<IFGAS_Stream> pStream = IFGAS_Stream::CreateStream(
pWrite,
FX_STREAMACCESS_Text | FX_STREAMACCESS_Write | FX_STREAMACCESS_Append);
if (!pStream)
return false;
pStream->SetCodePage(FX_CODEPAGE_UTF8);
- bool bRet = Export(pStream, pNode, dwFlag, pChecksum);
- pStream->Release();
- return bRet;
+ return Export(pStream, pNode, dwFlag, pChecksum);
}
-bool CXFA_DataExporter::Export(IFGAS_Stream* pStream,
+bool CXFA_DataExporter::Export(const CFX_RetainPtr<IFGAS_Stream>& pStream,
CXFA_Node* pNode,
uint32_t dwFlag,
const FX_CHAR* pChecksum) {