summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc/doc_basic.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2015-10-21 11:07:42 -0400
committerDan Sinclair <dsinclair@chromium.org>2015-10-21 11:07:42 -0400
commit43ce9035a026c7b4f15aa938dc39444d9253ea9f (patch)
tree8f18c1508dfd0db47d9dec1dbc708fd018349b3f /core/src/fpdfdoc/doc_basic.cpp
parent1edb860fd465879311ec85c5c6385067b7985013 (diff)
downloadpdfium-43ce9035a026c7b4f15aa938dc39444d9253ea9f.tar.xz
Merge to XFA: Add type cast definitions for CPDF_Number.
This Cl adds ToNumber, CPDF_Object::AsNumber and CPDF_Object::IsNumber and updates the src to use them as needed. BUG=pdfium:201 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1410673005 . (cherry picked from commit 83bf02dfb860a66d756434d194118dae572d04d3) Review URL: https://codereview.chromium.org/1422583002 .
Diffstat (limited to 'core/src/fpdfdoc/doc_basic.cpp')
-rw-r--r--core/src/fpdfdoc/doc_basic.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp
index e3b630862c..bbf51139ad 100644
--- a/core/src/fpdfdoc/doc_basic.cpp
+++ b/core/src/fpdfdoc/doc_basic.cpp
@@ -11,15 +11,12 @@ int CPDF_Dest::GetPageIndex(CPDF_Document* pDoc) {
return 0;
}
CPDF_Object* pPage = ((CPDF_Array*)m_pObj)->GetElementValue(0);
- if (pPage == NULL) {
+ if (!pPage)
return 0;
- }
- if (pPage->GetType() == PDFOBJ_NUMBER) {
+ if (pPage->IsNumber())
return pPage->GetInteger();
- }
- if (!pPage->IsDictionary()) {
+ if (!pPage->IsDictionary())
return 0;
- }
return pDoc->GetPageIndex(pPage->GetObjNum());
}
FX_DWORD CPDF_Dest::GetPageObjNum() {
@@ -27,15 +24,12 @@ FX_DWORD CPDF_Dest::GetPageObjNum() {
return 0;
}
CPDF_Object* pPage = ((CPDF_Array*)m_pObj)->GetElementValue(0);
- if (pPage == NULL) {
+ if (!pPage)
return 0;
- }
- if (pPage->GetType() == PDFOBJ_NUMBER) {
+ if (pPage->IsNumber())
return pPage->GetInteger();
- }
- if (pPage->IsDictionary()) {
+ if (pPage->IsDictionary())
return pPage->GetObjNum();
- }
return 0;
}
const FX_CHAR* g_sZoomModes[] = {"XYZ", "Fit", "FitH", "FitV", "FitR",