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

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: 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) { 2246 if (!pTextPage) {
Tom Sepez 2015/05/15 15:25:22 nit: is this even possible?
Lei Zhang 2015/05/15 22:19:07 Nope.
2240 return; 2247 return;
2241 } 2248 }
2242 m_pTextPage = pTextPage;
2243 m_strText = m_pTextPage->GetPageText(); 2249 m_strText = m_pTextPage->GetPageText();
2244 int nCount = pTextPage->CountChars(); 2250 int nCount = pTextPage->CountChars();
2245 if(nCount) { 2251 if(nCount) {
2246 m_CharIndex.Add(0); 2252 m_CharIndex.Add(0);
2247 } 2253 }
2248 for(int i = 0; i < nCount; i++) { 2254 for(int i = 0; i < nCount; i++) {
2249 FPDF_CHAR_INFO info; 2255 FPDF_CHAR_INFO info;
2250 pTextPage->GetCharInfo(i, info); 2256 pTextPage->GetCharInfo(i, info);
2251 int indexSize = m_CharIndex.GetSize(); 2257 int indexSize = m_CharIndex.GetSize();
2252 if(info.m_Flag == CHAR_NORMAL || info.m_Flag == CHAR_GENERATED) { 2258 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); 2272 m_CharIndex.SetAt(indexSize - 1, i + 1);
2267 } else { 2273 } else {
2268 m_CharIndex.Add(i + 1); 2274 m_CharIndex.Add(i + 1);
2269 } 2275 }
2270 } 2276 }
2271 } 2277 }
2272 int indexSize = m_CharIndex.GetSize(); 2278 int indexSize = m_CharIndex.GetSize();
2273 if(indexSize % 2) { 2279 if(indexSize % 2) {
2274 m_CharIndex.RemoveAt(indexSize - 1); 2280 m_CharIndex.RemoveAt(indexSize - 1);
2275 } 2281 }
2276 m_resStart = 0;
2277 m_resEnd = -1;
2278 } 2282 }
2279 int CPDF_TextPageFind::GetCharIndex(int index) const 2283 int CPDF_TextPageFind::GetCharIndex(int index) const
2280 { 2284 {
2281 return m_pTextPage->CharIndexFromTextIndex(index); 2285 return m_pTextPage->CharIndexFromTextIndex(index);
2282 int indexSize = m_CharIndex.GetSize(); 2286 int indexSize = m_CharIndex.GetSize();
2283 int count = 0; 2287 int count = 0;
2284 for(int i = 0; i < indexSize; i += 2) { 2288 for(int i = 0; i < indexSize; i += 2) {
2285 count += m_CharIndex.GetAt(i + 1); 2289 count += m_CharIndex.GetAt(i + 1);
2286 if(count > index) { 2290 if(count > index) {
2287 return index - count + m_CharIndex.GetAt(i + 1) + m_CharIndex.G etAt(i); 2291 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()) { 2840 if (!m_IsParserd || index < 0 || index >= m_LinkList.GetSize()) {
2837 return; 2841 return;
2838 } 2842 }
2839 CPDF_LinkExt* link = NULL; 2843 CPDF_LinkExt* link = NULL;
2840 link = m_LinkList.GetAt(index); 2844 link = m_LinkList.GetAt(index);
2841 if (!link) { 2845 if (!link) {
2842 return ; 2846 return ;
2843 } 2847 }
2844 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects); 2848 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects);
2845 } 2849 }
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