diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-07-28 00:00:25 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-07-28 00:00:25 +0000 |
commit | 522d77db501ab7ae33f7d17e4ab456232ca5a70c (patch) | |
tree | d53f5d73117cd098bf3ee4ff6e1fc05b59becdb8 /fxjs/cjs_document.cpp | |
parent | f19ae5dcd0b618cdeb80d6a1df5b13610d0ff7da (diff) | |
download | pdfium-522d77db501ab7ae33f7d17e4ab456232ca5a70c.tar.xz |
Add CPDSDK_Annot::AsBAAnnot() checked downcast method
XFA introduces some additional subclasses, so it doesn't hurt
to be sure in all cases before making a static cast.
Change-Id: I7447ca58be0b57201b39ba40a3fc5f47505cee58
Reviewed-on: https://pdfium-review.googlesource.com/39013
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fxjs/cjs_document.cpp')
-rw-r--r-- | fxjs/cjs_document.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp index 4ac2f15abd..b135805363 100644 --- a/fxjs/cjs_document.cpp +++ b/fxjs/cjs_document.cpp @@ -1003,7 +1003,7 @@ CJS_Return CJS_Document::getAnnot( CPDFSDK_AnnotIteration annotIteration(pPageView, false); CPDFSDK_BAAnnot* pSDKBAAnnot = nullptr; for (const auto& pSDKAnnotCur : annotIteration) { - auto* pBAAnnot = static_cast<CPDFSDK_BAAnnot*>(pSDKAnnotCur.Get()); + auto* pBAAnnot = pSDKAnnotCur->AsBAAnnot(); if (pBAAnnot && pBAAnnot->GetAnnotName() == swAnnotName) { pSDKBAAnnot = pBAAnnot; break; @@ -1054,7 +1054,7 @@ CJS_Return CJS_Document::getAnnots( auto* pJS_Annot = static_cast<CJS_Annot*>(CFXJS_Engine::GetObjectPrivate(pObj)); - pJS_Annot->SetSDKAnnot(static_cast<CPDFSDK_BAAnnot*>(pSDKAnnotCur.Get())); + pJS_Annot->SetSDKAnnot(pSDKAnnotCur->AsBAAnnot()); pRuntime->PutArrayElement( annots, i, pJS_Annot ? v8::Local<v8::Value>(pJS_Annot->ToV8Object()) |