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

Unified Diff: xfa/fxfa/parser/cxfa_dataexporter.cpp

Issue 2559763002: Refcount IFGAS_ streams all the time, too (Closed)
Patch Set: more Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fxfa/parser/cxfa_dataexporter.h ('k') | xfa/fxfa/parser/cxfa_node.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/parser/cxfa_dataexporter.cpp
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp
index 9760261baf94288f866d8f9b36955b9b1f080793..a9965f52a52436646d1399b03233b9cb0a674506 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) {
« no previous file with comments | « xfa/fxfa/parser/cxfa_dataexporter.h ('k') | xfa/fxfa/parser/cxfa_node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698