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

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

Issue 1405253007: Revert "Revert "Cleanup some numeric code."" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master 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 ((ch < '0' || ch > '9') && ch != '-' && ch != '+' && ch != '.' && 439 if (!std::isdigit(ch) && ch != '-' && ch != '+' && ch != '.' && ch != ' ')
440 ch != ' ') {
441 return FALSE; 440 return FALSE;
442 }
443 } 441 }
444 return TRUE; 442 return TRUE;
445 } 443 }
446 void CTextPage::FindColumns() { 444 void CTextPage::FindColumns() {
447 int i; 445 int i;
448 for (i = 0; i < m_BaseLines.GetSize(); i++) { 446 for (i = 0; i < m_BaseLines.GetSize(); i++) {
449 CTextBaseLine* pBaseLine = (CTextBaseLine*)m_BaseLines.GetAt(i); 447 CTextBaseLine* pBaseLine = (CTextBaseLine*)m_BaseLines.GetAt(i);
450 for (int j = 0; j < pBaseLine->m_TextList.GetSize(); j++) { 448 for (int j = 0; j < pBaseLine->m_TextList.GetSize(); j++) {
451 CTextBox* pTextBox = (CTextBox*)pBaseLine->m_TextList.GetAt(j); 449 CTextBox* pTextBox = (CTextBox*)pBaseLine->m_TextList.GetAt(j);
452 CTextColumn* pColumn = FindColumn(pTextBox->m_Right); 450 CTextColumn* pColumn = FindColumn(pTextBox->m_Right);
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 FX_DWORD flags) { 781 FX_DWORD flags) {
784 buffer.EstimateSize(0, 10240); 782 buffer.EstimateSize(0, 10240);
785 CPDF_Page page; 783 CPDF_Page page;
786 page.Load(pDoc, pPage); 784 page.Load(pDoc, pPage);
787 CPDF_ParseOptions options; 785 CPDF_ParseOptions options;
788 options.m_bTextOnly = TRUE; 786 options.m_bTextOnly = TRUE;
789 options.m_bSeparateForm = FALSE; 787 options.m_bSeparateForm = FALSE;
790 page.ParseContent(&options); 788 page.ParseContent(&options);
791 GetTextStream_Unicode(buffer, &page, TRUE, NULL); 789 GetTextStream_Unicode(buffer, &page, TRUE, NULL);
792 } 790 }
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