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

Side by Side Diff: core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp

Issue 1405253007: Revert "Revert "Cleanup some numeric code."" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix mac build 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 "../../../include/fpdfapi/fpdf_page.h" 7 #include "../../../include/fpdfapi/fpdf_page.h"
8 #include "../../../include/fpdfapi/fpdf_module.h" 8 #include "../../../include/fpdfapi/fpdf_module.h"
9 #include "../../../include/fpdfapi/fpdf_serial.h" 9 #include "../../../include/fpdfapi/fpdf_serial.h"
10 #include "pageint.h" 10 #include "pageint.h"
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 m_pObjectList->m_ObjectList.AddTail(pPathObj); 1525 m_pObjectList->m_ObjectList.AddTail(pPathObj);
1526 } 1526 }
1527 if (PathClipType) { 1527 if (PathClipType) {
1528 if (!matrix.IsIdentity()) { 1528 if (!matrix.IsIdentity()) {
1529 Path.Transform(&matrix); 1529 Path.Transform(&matrix);
1530 matrix.SetIdentity(); 1530 matrix.SetIdentity();
1531 } 1531 }
1532 m_pCurStates->m_ClipPath.AppendPath(Path, PathClipType, TRUE); 1532 m_pCurStates->m_ClipPath.AppendPath(Path, PathClipType, TRUE);
1533 } 1533 }
1534 } 1534 }
1535 CFX_ByteString _FPDF_ByteStringFromHex(CFX_BinaryBuf& src_buf) { 1535 CFX_ByteString _FPDF_ByteStringFromHex(CFX_BinaryBuf& src_buf) {
Tom Sepez 2015/10/29 19:28:31 test
dsinclair 2015/11/03 15:59:02 Removed: https://codereview.chromium.org/142791300
1536 CFX_ByteTextBuf buf; 1536 CFX_ByteTextBuf buf;
1537 FX_BOOL bFirst = TRUE; 1537 FX_BOOL bFirst = TRUE;
1538 int code = 0; 1538 int code = 0;
1539 const uint8_t* str = src_buf.GetBuffer(); 1539 const uint8_t* str = src_buf.GetBuffer();
1540 FX_DWORD size = src_buf.GetSize(); 1540 FX_DWORD size = src_buf.GetSize();
1541 for (FX_DWORD i = 0; i < size; i++) { 1541 for (FX_DWORD i = 0; i < size; i++) {
1542 uint8_t ch = str[i]; 1542 uint8_t ch = str[i];
1543 if (ch >= '0' && ch <= '9') { 1543 if (std::isdigit(ch)) {
1544 if (bFirst) { 1544 if (bFirst) {
1545 code = (ch - '0') * 16; 1545 code = (ch - '0') * 16;
1546 } else { 1546 } else {
1547 code += ch - '0'; 1547 code += ch - '0';
1548 buf.AppendChar((char)code); 1548 buf.AppendChar((char)code);
1549 } 1549 }
1550 bFirst = !bFirst; 1550 bFirst = !bFirst;
1551 } else if (ch >= 'A' && ch <= 'F') { 1551 } else if (ch >= 'A' && ch <= 'F') {
1552 if (bFirst) { 1552 if (bFirst) {
1553 code = (ch - 'A' + 10) * 16; 1553 code = (ch - 'A' + 10) * 16;
(...skipping 10 matching lines...) Expand all
1564 buf.AppendChar((char)code); 1564 buf.AppendChar((char)code);
1565 } 1565 }
1566 bFirst = !bFirst; 1566 bFirst = !bFirst;
1567 } 1567 }
1568 } 1568 }
1569 if (!bFirst) { 1569 if (!bFirst) {
1570 buf.AppendChar((char)code); 1570 buf.AppendChar((char)code);
1571 } 1571 }
1572 return buf.GetByteString(); 1572 return buf.GetByteString();
1573 } 1573 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698