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

Side by Side Diff: core/fpdfdoc/doc_basic.cpp

Issue 1832173003: Remove FX_DWORD from core/ and delete definition (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « core/fpdfdoc/doc_ap.cpp ('k') | core/fpdfdoc/doc_bookmark.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
8 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 8 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
9 #include "core/fpdfdoc/doc_utils.h" 9 #include "core/fpdfdoc/doc_utils.h"
10 #include "core/include/fpdfdoc/fpdf_doc.h" 10 #include "core/include/fpdfdoc/fpdf_doc.h"
(...skipping 13 matching lines...) Expand all
24 24
25 CPDF_Object* pPage = pArray->GetElementValue(0); 25 CPDF_Object* pPage = pArray->GetElementValue(0);
26 if (!pPage) 26 if (!pPage)
27 return 0; 27 return 0;
28 if (pPage->IsNumber()) 28 if (pPage->IsNumber())
29 return pPage->GetInteger(); 29 return pPage->GetInteger();
30 if (!pPage->IsDictionary()) 30 if (!pPage->IsDictionary())
31 return 0; 31 return 0;
32 return pDoc->GetPageIndex(pPage->GetObjNum()); 32 return pDoc->GetPageIndex(pPage->GetObjNum());
33 } 33 }
34 FX_DWORD CPDF_Dest::GetPageObjNum() { 34 uint32_t CPDF_Dest::GetPageObjNum() {
35 CPDF_Array* pArray = ToArray(m_pObj); 35 CPDF_Array* pArray = ToArray(m_pObj);
36 if (!pArray) 36 if (!pArray)
37 return 0; 37 return 0;
38 38
39 CPDF_Object* pPage = pArray->GetElementValue(0); 39 CPDF_Object* pPage = pArray->GetElementValue(0);
40 if (!pPage) 40 if (!pPage)
41 return 0; 41 return 0;
42 if (pPage->IsNumber()) 42 if (pPage->IsNumber())
43 return pPage->GetInteger(); 43 return pPage->GetInteger();
44 if (pPage->IsDictionary()) 44 if (pPage->IsDictionary())
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 CFX_ByteString csTmp = csRight; 94 CFX_ByteString csTmp = csRight;
95 csRight = csLeft; 95 csRight = csLeft;
96 csLeft = csTmp; 96 csLeft = csTmp;
97 } 97 }
98 if (csName.Compare(csLeft) < 0 || csName.Compare(csRight) > 0) { 98 if (csName.Compare(csLeft) < 0 || csName.Compare(csRight) > 0) {
99 return NULL; 99 return NULL;
100 } 100 }
101 } 101 }
102 CPDF_Array* pNames = pNode->GetArrayBy("Names"); 102 CPDF_Array* pNames = pNode->GetArrayBy("Names");
103 if (pNames) { 103 if (pNames) {
104 FX_DWORD dwCount = pNames->GetCount() / 2; 104 uint32_t dwCount = pNames->GetCount() / 2;
105 for (FX_DWORD i = 0; i < dwCount; i++) { 105 for (uint32_t i = 0; i < dwCount; i++) {
106 CFX_ByteString csValue = pNames->GetStringAt(i * 2); 106 CFX_ByteString csValue = pNames->GetStringAt(i * 2);
107 int32_t iCompare = csValue.Compare(csName); 107 int32_t iCompare = csValue.Compare(csName);
108 if (iCompare <= 0) { 108 if (iCompare <= 0) {
109 if (ppFind) { 109 if (ppFind) {
110 *ppFind = pNames; 110 *ppFind = pNames;
111 } 111 }
112 if (iCompare < 0) { 112 if (iCompare < 0) {
113 continue; 113 continue;
114 } 114 }
115 } else { 115 } else {
116 break; 116 break;
117 } 117 }
118 nIndex += i; 118 nIndex += i;
119 return pNames->GetElementValue(i * 2 + 1); 119 return pNames->GetElementValue(i * 2 + 1);
120 } 120 }
121 nIndex += dwCount; 121 nIndex += dwCount;
122 return NULL; 122 return NULL;
123 } 123 }
124 CPDF_Array* pKids = pNode->GetArrayBy("Kids"); 124 CPDF_Array* pKids = pNode->GetArrayBy("Kids");
125 if (!pKids) { 125 if (!pKids) {
126 return NULL; 126 return NULL;
127 } 127 }
128 for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { 128 for (uint32_t i = 0; i < pKids->GetCount(); i++) {
129 CPDF_Dictionary* pKid = pKids->GetDictAt(i); 129 CPDF_Dictionary* pKid = pKids->GetDictAt(i);
130 if (!pKid) { 130 if (!pKid) {
131 continue; 131 continue;
132 } 132 }
133 CPDF_Object* pFound = 133 CPDF_Object* pFound =
134 SearchNameNode(pKid, csName, nIndex, ppFind, nLevel + 1); 134 SearchNameNode(pKid, csName, nIndex, ppFind, nLevel + 1);
135 if (pFound) { 135 if (pFound) {
136 return pFound; 136 return pFound;
137 } 137 }
138 } 138 }
(...skipping 18 matching lines...) Expand all
157 if (ppFind) { 157 if (ppFind) {
158 *ppFind = pNames; 158 *ppFind = pNames;
159 } 159 }
160 csName = pNames->GetStringAt((nIndex - nCurIndex) * 2); 160 csName = pNames->GetStringAt((nIndex - nCurIndex) * 2);
161 return pNames->GetElementValue((nIndex - nCurIndex) * 2 + 1); 161 return pNames->GetElementValue((nIndex - nCurIndex) * 2 + 1);
162 } 162 }
163 CPDF_Array* pKids = pNode->GetArrayBy("Kids"); 163 CPDF_Array* pKids = pNode->GetArrayBy("Kids");
164 if (!pKids) { 164 if (!pKids) {
165 return NULL; 165 return NULL;
166 } 166 }
167 for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { 167 for (uint32_t i = 0; i < pKids->GetCount(); i++) {
168 CPDF_Dictionary* pKid = pKids->GetDictAt(i); 168 CPDF_Dictionary* pKid = pKids->GetDictAt(i);
169 if (!pKid) { 169 if (!pKid) {
170 continue; 170 continue;
171 } 171 }
172 CPDF_Object* pFound = 172 CPDF_Object* pFound =
173 SearchNameNode(pKid, nIndex, nCurIndex, csName, ppFind, nLevel + 1); 173 SearchNameNode(pKid, nIndex, nCurIndex, csName, ppFind, nLevel + 1);
174 if (pFound) { 174 if (pFound) {
175 return pFound; 175 return pFound;
176 } 176 }
177 } 177 }
178 return NULL; 178 return NULL;
179 } 179 }
180 static int CountNames(CPDF_Dictionary* pNode, int nLevel = 0) { 180 static int CountNames(CPDF_Dictionary* pNode, int nLevel = 0) {
181 if (nLevel > nMaxRecursion) { 181 if (nLevel > nMaxRecursion) {
182 return 0; 182 return 0;
183 } 183 }
184 CPDF_Array* pNames = pNode->GetArrayBy("Names"); 184 CPDF_Array* pNames = pNode->GetArrayBy("Names");
185 if (pNames) { 185 if (pNames) {
186 return pNames->GetCount() / 2; 186 return pNames->GetCount() / 2;
187 } 187 }
188 CPDF_Array* pKids = pNode->GetArrayBy("Kids"); 188 CPDF_Array* pKids = pNode->GetArrayBy("Kids");
189 if (!pKids) { 189 if (!pKids) {
190 return 0; 190 return 0;
191 } 191 }
192 int nCount = 0; 192 int nCount = 0;
193 for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { 193 for (uint32_t i = 0; i < pKids->GetCount(); i++) {
194 CPDF_Dictionary* pKid = pKids->GetDictAt(i); 194 CPDF_Dictionary* pKid = pKids->GetDictAt(i);
195 if (!pKid) { 195 if (!pKid) {
196 continue; 196 continue;
197 } 197 }
198 nCount += CountNames(pKid, nLevel + 1); 198 nCount += CountNames(pKid, nLevel + 1);
199 } 199 }
200 return nCount; 200 return nCount;
201 } 201 }
202 int CPDF_NameTree::GetCount() const { 202 int CPDF_NameTree::GetCount() const {
203 if (!m_pRoot) { 203 if (!m_pRoot) {
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 int nPage = FXSYS_atoi(bsLbl); 508 int nPage = FXSYS_atoi(bsLbl);
509 if (nPage > 0 && nPage <= nPages) { 509 if (nPage > 0 && nPage <= nPages) {
510 return nPage; 510 return nPage;
511 } 511 }
512 return -1; 512 return -1;
513 } 513 }
514 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { 514 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const {
515 CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr()); 515 CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr());
516 return GetPageByLabel(bsLabel); 516 return GetPageByLabel(bsLabel);
517 } 517 }
OLDNEW
« no previous file with comments | « core/fpdfdoc/doc_ap.cpp ('k') | core/fpdfdoc/doc_bookmark.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698