diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-03-06 12:28:34 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-03-06 12:28:34 -0800 |
commit | 0700106e13b84781c86398bb5e2b5dd3ed894007 (patch) | |
tree | 4037c37f3bfb07279ec7547a009641a3e4754eb3 /core/src/fpdfdoc/doc_link.cpp | |
parent | 8842c6214cf70fa4237d17684cc9f609536c0240 (diff) | |
download | pdfium-0700106e13b84781c86398bb5e2b5dd3ed894007.tar.xz |
Make conversions for CPDF_Link explicit.
Precursor to taking a second shot at cleaning up the FPDF_*
APIs. A FPDF_LINK is a CPDF_Dictionary, and a CPDF_Link
is a structure holding a FPDF_LINK. This goes against the
convention that FPDF_ types get cast to CPDF_* types, so we
want to make it clear where objects are getting constructed.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/985503005
Diffstat (limited to 'core/src/fpdfdoc/doc_link.cpp')
-rw-r--r-- | core/src/fpdfdoc/doc_link.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/core/src/fpdfdoc/doc_link.cpp b/core/src/fpdfdoc/doc_link.cpp index b7c640af5e..4a42e21388 100644 --- a/core/src/fpdfdoc/doc_link.cpp +++ b/core/src/fpdfdoc/doc_link.cpp @@ -44,26 +44,26 @@ int CPDF_LinkList::CountLinks(CPDF_Page* pPage) CPDF_Link CPDF_LinkList::GetLink(CPDF_Page* pPage, int index) { CFX_PtrArray* pPageLinkList = GetPageLinks(pPage); - if (pPageLinkList == NULL) { - return NULL; + if (!pPageLinkList) { + return CPDF_Link(); } - return (CPDF_Dictionary*)pPageLinkList->GetAt(index); + return CPDF_Link((CPDF_Dictionary*)pPageLinkList->GetAt(index)); } CPDF_Link CPDF_LinkList::GetLinkAtPoint(CPDF_Page* pPage, FX_FLOAT pdf_x, FX_FLOAT pdf_y) { CFX_PtrArray* pPageLinkList = GetPageLinks(pPage); - if (pPageLinkList == NULL) { - return NULL; + if (!pPageLinkList) { + return CPDF_Link(); } int size = pPageLinkList->GetSize(); for (int i = size - 1; i >= 0; --i) { - CPDF_Link Link = (CPDF_Dictionary*)pPageLinkList->GetAt(i); - CPDF_Rect rect = Link.GetRect(); + CPDF_Link link((CPDF_Dictionary*)pPageLinkList->GetAt(i)); + CPDF_Rect rect = link.GetRect(); if (rect.Contains(pdf_x, pdf_y)) { - return Link; + return link; } } - return NULL; + return CPDF_Link(); } void CPDF_LinkList::LoadPageLinks(CPDF_Page* pPage, CFX_PtrArray* pList) { |