diff options
author | tsepez <tsepez@chromium.org> | 2016-06-09 14:08:11 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-09 14:08:11 -0700 |
commit | 77b909e059283c1d4c1654a626fc05c584af11a3 (patch) | |
tree | e474e1ac1b04dfeb58c2cd1ea63fc180bd0b0b6f /fpdfsdk | |
parent | 8bd9ce00a0755d72c9b5b8ad43d8f50c2f51e5c5 (diff) | |
download | pdfium-77b909e059283c1d4c1654a626fc05c584af11a3.tar.xz |
Remove more casts, part 7.
Replacing a void* member in CFX_SAXItem saves lots of casts.
Review-Url: https://codereview.chromium.org/2051233002
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp | 9 | ||||
-rw-r--r-- | fpdfsdk/fsdk_annothandler.cpp | 14 |
2 files changed, 9 insertions, 14 deletions
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp index 9d8fb42059..c8aca0d5b0 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; } } } diff --git a/fpdfsdk/fsdk_annothandler.cpp b/fpdfsdk/fsdk_annothandler.cpp index ded04c9371..c3bc1953f1 100644 --- a/fpdfsdk/fsdk_annothandler.cpp +++ b/fpdfsdk/fsdk_annothandler.cpp @@ -97,7 +97,7 @@ void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { pAnnotHandler->OnRelease(pAnnot); pAnnotHandler->ReleaseAnnot(pAnnot); } else { - delete (CPDFSDK_Annot*)pAnnot; + delete pAnnot; } } @@ -402,7 +402,7 @@ FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { if (pAnnot->GetSubType() == BFFT_SIGNATURE) return FALSE; - CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; + CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); if (!pWidget->IsVisible()) return FALSE; @@ -451,12 +451,10 @@ void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { if (m_pFormFiller) m_pFormFiller->OnDelete(pAnnot); - CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; + std::unique_ptr<CPDFSDK_Widget> pWidget(static_cast<CPDFSDK_Widget*>(pAnnot)); CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); - CPDF_FormControl* pCtrol = pWidget->GetFormControl(); - pInterForm->RemoveMap(pCtrol); - - delete pWidget; + CPDF_FormControl* pControl = pWidget->GetFormControl(); + pInterForm->RemoveMap(pControl); } void CPDFSDK_BFAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView, @@ -651,7 +649,7 @@ void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) { if (pAnnot->GetSubType() == BFFT_SIGNATURE) return; - CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; + CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); if (!pWidget->IsAppearanceValid()) pWidget->ResetAppearance(nullptr, FALSE); |