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

Unified Diff: fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp

Issue 2051233002: Remove more casts, part 7. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 6 months 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 | « no previous file | fpdfsdk/fsdk_annothandler.cpp » ('j') | xfa/fxfa/include/xfa_checksum.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
index 9d8fb42059237ee0bf6c4f7b92eb95f72cb27259..c8aca0d5b032a46acd06af5ee5254c026e9f7529 100644
--- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
+++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
@@ -677,8 +677,8 @@ void CPDFXFA_Document::ExportData(CXFA_FFDoc* hDoc,
continue;
if (!pPDFObj->IsReference())
continue;
- CPDF_Object* pDirectObj = pPDFObj->GetDirect();
- if (!pDirectObj->IsStream())
+ CPDF_Stream* pStream = ToStream(pPDFObj->GetDirect());
+ if (!pStream)
continue;
if (pPrePDFObj->GetString() == "form") {
m_pXFADocView->GetDoc()->SavePackage(XFA_HASHCODE_Form, &fileWrite,
@@ -698,13 +698,10 @@ void CPDFXFA_Document::ExportData(CXFA_FFDoc* hDoc,
fileWrite.WriteBlock(content.c_str(), fileWrite.GetSize(),
content.GetLength());
}
-
- CPDF_Stream* pStream = (CPDF_Stream*)pDirectObj;
- CPDF_StreamAcc* pAcc = new CPDF_StreamAcc;
+ std::unique_ptr<CPDF_StreamAcc> pAcc(new CPDF_StreamAcc);
pAcc->LoadAllData(pStream);
fileWrite.WriteBlock(pAcc->GetData(), fileWrite.GetSize(),
pAcc->GetSize());
- delete pAcc;
}
}
}
« no previous file with comments | « no previous file | fpdfsdk/fsdk_annothandler.cpp » ('j') | xfa/fxfa/include/xfa_checksum.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698