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

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

Issue 1431683008: Revert "Revert "Revert "Cleanup some numeric code.""" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 1 month 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
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 "../../../third_party/base/nonstd_unique_ptr.h" 7 #include "../../../third_party/base/nonstd_unique_ptr.h"
8 #include "../../include/fpdfapi/fpdf_page.h" 8 #include "../../include/fpdfapi/fpdf_page.h"
9 #include "../../include/fpdfapi/fpdf_pageobj.h" 9 #include "../../include/fpdfapi/fpdf_pageobj.h"
10 #include "../../include/fpdfapi/fpdf_resource.h" 10 #include "../../include/fpdfapi/fpdf_resource.h"
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 } 429 }
430 } 430 }
431 } 431 }
432 } 432 }
433 str.Empty(); 433 str.Empty();
434 str += sBuffer; 434 str += sBuffer;
435 } 435 }
436 static FX_BOOL IsNumber(CFX_WideString& str) { 436 static FX_BOOL IsNumber(CFX_WideString& str) {
437 for (int i = 0; i < str.GetLength(); i++) { 437 for (int i = 0; i < str.GetLength(); i++) {
438 FX_WCHAR ch = str[i]; 438 FX_WCHAR ch = str[i];
439 if (!std::isdigit(ch) && ch != '-' && ch != '+' && ch != '.' && ch != ' ') 439 if ((ch < '0' || ch > '9') && ch != '-' && ch != '+' && ch != '.' &&
440 ch != ' ') {
440 return FALSE; 441 return FALSE;
442 }
441 } 443 }
442 return TRUE; 444 return TRUE;
443 } 445 }
444 void CTextPage::FindColumns() { 446 void CTextPage::FindColumns() {
445 int i; 447 int i;
446 for (i = 0; i < m_BaseLines.GetSize(); i++) { 448 for (i = 0; i < m_BaseLines.GetSize(); i++) {
447 CTextBaseLine* pBaseLine = (CTextBaseLine*)m_BaseLines.GetAt(i); 449 CTextBaseLine* pBaseLine = (CTextBaseLine*)m_BaseLines.GetAt(i);
448 for (int j = 0; j < pBaseLine->m_TextList.GetSize(); j++) { 450 for (int j = 0; j < pBaseLine->m_TextList.GetSize(); j++) {
449 CTextBox* pTextBox = (CTextBox*)pBaseLine->m_TextList.GetAt(j); 451 CTextBox* pTextBox = (CTextBox*)pBaseLine->m_TextList.GetAt(j);
450 CTextColumn* pColumn = FindColumn(pTextBox->m_Right); 452 CTextColumn* pColumn = FindColumn(pTextBox->m_Right);
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 FX_DWORD flags) { 783 FX_DWORD flags) {
782 buffer.EstimateSize(0, 10240); 784 buffer.EstimateSize(0, 10240);
783 CPDF_Page page; 785 CPDF_Page page;
784 page.Load(pDoc, pPage); 786 page.Load(pDoc, pPage);
785 CPDF_ParseOptions options; 787 CPDF_ParseOptions options;
786 options.m_bTextOnly = TRUE; 788 options.m_bTextOnly = TRUE;
787 options.m_bSeparateForm = FALSE; 789 options.m_bSeparateForm = FALSE;
788 page.ParseContent(&options); 790 page.ParseContent(&options);
789 GetTextStream_Unicode(buffer, &page, TRUE, NULL); 791 GetTextStream_Unicode(buffer, &page, TRUE, NULL);
790 } 792 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp ('k') | core/src/fpdftext/fpdf_text_int.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698