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

Side by Side Diff: core/src/fpdftext/fpdf_text_int.cpp

Issue 1137933004: Initialize members of CPDF_TextPageFind class. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nit Created 5 years, 7 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 | « no previous file | no next file » | 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 "../../include/fpdfapi/fpdf_resource.h" 7 #include "../../include/fpdfapi/fpdf_resource.h"
8 #include "../../include/fpdfapi/fpdf_pageobj.h" 8 #include "../../include/fpdfapi/fpdf_pageobj.h"
9 #include "../../include/fpdftext/fpdf_text.h" 9 #include "../../include/fpdftext/fpdf_text.h"
10 #include "../../include/fpdfapi/fpdf_page.h" 10 #include "../../include/fpdfapi/fpdf_page.h"
(...skipping 2215 matching lines...) Expand 10 before | Expand all | Expand 10 after
2226 } 2226 }
2227 if (unicode > L'Z' && unicode < L'a') { 2227 if (unicode > L'Z' && unicode < L'a') {
2228 return FALSE; 2228 return FALSE;
2229 } 2229 }
2230 if (unicode > L'z') { 2230 if (unicode > L'z') {
2231 return FALSE; 2231 return FALSE;
2232 } 2232 }
2233 return TRUE; 2233 return TRUE;
2234 } 2234 }
2235 CPDF_TextPageFind::CPDF_TextPageFind(const IPDF_TextPage* pTextPage) 2235 CPDF_TextPageFind::CPDF_TextPageFind(const IPDF_TextPage* pTextPage)
2236 : m_pTextPage(NULL), 2236 : m_pTextPage(pTextPage),
2237 m_flags(0),
2238 m_findNextStart(-1),
2239 m_findPreStart(-1),
2240 m_bMatchCase(FALSE),
2241 m_bMatchWholeWord(FALSE),
2242 m_resStart(0),
2243 m_resEnd(-1),
2237 m_IsFind(FALSE) 2244 m_IsFind(FALSE)
2238 { 2245 {
2239 if (!pTextPage) {
2240 return;
2241 }
2242 m_pTextPage = pTextPage;
2243 m_strText = m_pTextPage->GetPageText(); 2246 m_strText = m_pTextPage->GetPageText();
2244 int nCount = pTextPage->CountChars(); 2247 int nCount = pTextPage->CountChars();
2245 if(nCount) { 2248 if(nCount) {
2246 m_CharIndex.Add(0); 2249 m_CharIndex.Add(0);
2247 } 2250 }
2248 for(int i = 0; i < nCount; i++) { 2251 for(int i = 0; i < nCount; i++) {
2249 FPDF_CHAR_INFO info; 2252 FPDF_CHAR_INFO info;
2250 pTextPage->GetCharInfo(i, info); 2253 pTextPage->GetCharInfo(i, info);
2251 int indexSize = m_CharIndex.GetSize(); 2254 int indexSize = m_CharIndex.GetSize();
2252 if(info.m_Flag == CHAR_NORMAL || info.m_Flag == CHAR_GENERATED) { 2255 if(info.m_Flag == CHAR_NORMAL || info.m_Flag == CHAR_GENERATED) {
(...skipping 13 matching lines...) Expand all
2266 m_CharIndex.SetAt(indexSize - 1, i + 1); 2269 m_CharIndex.SetAt(indexSize - 1, i + 1);
2267 } else { 2270 } else {
2268 m_CharIndex.Add(i + 1); 2271 m_CharIndex.Add(i + 1);
2269 } 2272 }
2270 } 2273 }
2271 } 2274 }
2272 int indexSize = m_CharIndex.GetSize(); 2275 int indexSize = m_CharIndex.GetSize();
2273 if(indexSize % 2) { 2276 if(indexSize % 2) {
2274 m_CharIndex.RemoveAt(indexSize - 1); 2277 m_CharIndex.RemoveAt(indexSize - 1);
2275 } 2278 }
2276 m_resStart = 0;
2277 m_resEnd = -1;
2278 } 2279 }
2279 int CPDF_TextPageFind::GetCharIndex(int index) const 2280 int CPDF_TextPageFind::GetCharIndex(int index) const
2280 { 2281 {
2281 return m_pTextPage->CharIndexFromTextIndex(index); 2282 return m_pTextPage->CharIndexFromTextIndex(index);
2282 int indexSize = m_CharIndex.GetSize(); 2283 int indexSize = m_CharIndex.GetSize();
2283 int count = 0; 2284 int count = 0;
2284 for(int i = 0; i < indexSize; i += 2) { 2285 for(int i = 0; i < indexSize; i += 2) {
2285 count += m_CharIndex.GetAt(i + 1); 2286 count += m_CharIndex.GetAt(i + 1);
2286 if(count > index) { 2287 if(count > index) {
2287 return index - count + m_CharIndex.GetAt(i + 1) + m_CharIndex.G etAt(i); 2288 return index - count + m_CharIndex.GetAt(i + 1) + m_CharIndex.G etAt(i);
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
2836 if (!m_IsParserd || index < 0 || index >= m_LinkList.GetSize()) { 2837 if (!m_IsParserd || index < 0 || index >= m_LinkList.GetSize()) {
2837 return; 2838 return;
2838 } 2839 }
2839 CPDF_LinkExt* link = NULL; 2840 CPDF_LinkExt* link = NULL;
2840 link = m_LinkList.GetAt(index); 2841 link = m_LinkList.GetAt(index);
2841 if (!link) { 2842 if (!link) {
2842 return ; 2843 return ;
2843 } 2844 }
2844 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects); 2845 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects);
2845 } 2846 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698