Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2046)

Unified Diff: core/fpdfdoc/doc_basic.cpp

Issue 1817283002: Make predefined character table slightly smaller. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfdoc/doc_action.cpp ('k') | core/include/fpdfapi/fpdf_resource.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfdoc/doc_basic.cpp
diff --git a/core/fpdfdoc/doc_basic.cpp b/core/fpdfdoc/doc_basic.cpp
index 851730346cd42b6c9a0a583cf7e3c7c215c3f6b5..cd2afab4086e1089b9e8cf0a5c3a9de367c12949 100644
--- a/core/fpdfdoc/doc_basic.cpp
+++ b/core/fpdfdoc/doc_basic.cpp
@@ -9,7 +9,14 @@
#include "core/fpdfdoc/doc_utils.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
+namespace {
+
const int nMaxRecursion = 32;
+const FX_CHAR* const g_sZoomModes[] = {"XYZ", "Fit", "FitH", "FitV", "FitR",
+ "FitB", "FitBH", "FitBV", nullptr};
+
+} // namespace
+
int CPDF_Dest::GetPageIndex(CPDF_Document* pDoc) {
CPDF_Array* pArray = ToArray(m_pObj);
if (!pArray)
@@ -38,25 +45,25 @@ FX_DWORD CPDF_Dest::GetPageObjNum() {
return pPage->GetObjNum();
return 0;
}
-const FX_CHAR* g_sZoomModes[] = {"XYZ", "Fit", "FitH", "FitV", "FitR",
- "FitB", "FitBH", "FitBV", ""};
+
int CPDF_Dest::GetZoomMode() {
CPDF_Array* pArray = ToArray(m_pObj);
if (!pArray)
return 0;
- CFX_ByteString mode;
CPDF_Object* pObj = pArray->GetElementValue(1);
- mode = pObj ? pObj->GetString() : CFX_ByteString();
- int i = 0;
- while (g_sZoomModes[i][0] != '\0') {
- if (mode == g_sZoomModes[i]) {
+ if (!pObj)
+ return 0;
+
+ CFX_ByteString mode = pObj->GetString();
+ for (int i = 0; g_sZoomModes[i]; ++i) {
+ if (mode == g_sZoomModes[i])
return i + 1;
- }
- i++;
}
+
return 0;
}
+
FX_FLOAT CPDF_Dest::GetParam(int index) {
CPDF_Array* pArray = ToArray(m_pObj);
return pArray ? pArray->GetNumberAt(2 + index) : 0;
« no previous file with comments | « core/fpdfdoc/doc_action.cpp ('k') | core/include/fpdfapi/fpdf_resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698