summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_dest.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-01-10 20:10:05 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-10 20:10:05 +0000
commit326c38c4f2749e61fa2dec1d0f326e4099d6a24c (patch)
treeb640be3187b42d9cdc8756f88f87400e25440961 /core/fpdfdoc/cpdf_dest.cpp
parent678b97f3fc747cc203c036c01d23fe790b230b85 (diff)
downloadpdfium-326c38c4f2749e61fa2dec1d0f326e4099d6a24c.tar.xz
Remove unused parameter from FPDFDest_GetView().
Fix a bunch of nits as well. Change-Id: I874f9b1d4676823635aad8986fcf23a11ae6efd9 Reviewed-on: https://pdfium-review.googlesource.com/22473 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfdoc/cpdf_dest.cpp')
-rw-r--r--core/fpdfdoc/cpdf_dest.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/core/fpdfdoc/cpdf_dest.cpp b/core/fpdfdoc/cpdf_dest.cpp
index cb15bf1c33..0098f73f66 100644
--- a/core/fpdfdoc/cpdf_dest.cpp
+++ b/core/fpdfdoc/cpdf_dest.cpp
@@ -22,7 +22,11 @@ const char* const g_sZoomModes[] = {"Unknown", "XYZ", "Fit", "FitH",
"FitV", "FitR", "FitB", "FitBH",
"FitBV", nullptr};
-const int g_sZoomModeMaxParamCount[] = {0, 3, 0, 1, 1, 4, 0, 1, 1, 0};
+const uint8_t g_sZoomModeMaxParamCount[] = {0, 3, 0, 1, 1, 4, 0, 1, 1, 0};
+
+static_assert(FX_ArraySize(g_sZoomModes) ==
+ FX_ArraySize(g_sZoomModeMaxParamCount),
+ "Zoom mode count Mismatch");
} // namespace
@@ -34,7 +38,7 @@ CPDF_Dest::CPDF_Dest(CPDF_Object* pObj) : m_pObj(pObj) {}
CPDF_Dest::~CPDF_Dest() {}
-int CPDF_Dest::GetPageIndex(CPDF_Document* pDoc) {
+int CPDF_Dest::GetPageIndex(CPDF_Document* pDoc) const {
CPDF_Array* pArray = ToArray(m_pObj.Get());
if (!pArray)
return 0;
@@ -49,7 +53,7 @@ int CPDF_Dest::GetPageIndex(CPDF_Document* pDoc) {
return pDoc->GetPageIndex(pPage->GetObjNum());
}
-uint32_t CPDF_Dest::GetPageObjNum() {
+uint32_t CPDF_Dest::GetPageObjNum() const {
CPDF_Array* pArray = ToArray(m_pObj.Get());
if (!pArray)
return 0;
@@ -64,7 +68,7 @@ uint32_t CPDF_Dest::GetPageObjNum() {
return 0;
}
-int CPDF_Dest::GetZoomMode() {
+int CPDF_Dest::GetZoomMode() const {
CPDF_Array* pArray = ToArray(m_pObj.Get());
if (!pArray)
return 0;
@@ -129,21 +133,21 @@ bool CPDF_Dest::GetXYZ(bool* pHasX,
return true;
}
-unsigned int CPDF_Dest::GetNumParams() {
+unsigned long CPDF_Dest::GetNumParams() const {
CPDF_Array* pArray = ToArray(m_pObj.Get());
if (!pArray || pArray->GetCount() < 2)
return 0;
- size_t maxParamsForFitType = g_sZoomModeMaxParamCount[GetZoomMode()];
- size_t numParamsInArray = pArray->GetCount() - 2;
+ unsigned long maxParamsForFitType = g_sZoomModeMaxParamCount[GetZoomMode()];
+ unsigned long numParamsInArray = pArray->GetCount() - 2;
return std::min(maxParamsForFitType, numParamsInArray);
}
-float CPDF_Dest::GetParam(int index) {
+float CPDF_Dest::GetParam(int index) const {
CPDF_Array* pArray = ToArray(m_pObj.Get());
return pArray ? pArray->GetNumberAt(2 + index) : 0;
}
-ByteString CPDF_Dest::GetRemoteName() {
+ByteString CPDF_Dest::GetRemoteName() const {
return m_pObj ? m_pObj->GetString() : ByteString();
}