| OLD | NEW |
| 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 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1546 } | 1546 } |
| 1547 } | 1547 } |
| 1548 CFX_ByteString _FPDF_ByteStringFromHex(CFX_BinaryBuf& src_buf) | 1548 CFX_ByteString _FPDF_ByteStringFromHex(CFX_BinaryBuf& src_buf) |
| 1549 { | 1549 { |
| 1550 CFX_ByteTextBuf buf; | 1550 CFX_ByteTextBuf buf; |
| 1551 FX_BOOL bFirst = TRUE; | 1551 FX_BOOL bFirst = TRUE; |
| 1552 int code = 0; | 1552 int code = 0; |
| 1553 FX_LPCBYTE str = src_buf.GetBuffer(); | 1553 FX_LPCBYTE str = src_buf.GetBuffer(); |
| 1554 FX_DWORD size = src_buf.GetSize(); | 1554 FX_DWORD size = src_buf.GetSize(); |
| 1555 for (FX_DWORD i = 0; i < size; i ++) { | 1555 for (FX_DWORD i = 0; i < size; i ++) { |
| 1556 FX_BYTE ch = str[i]; | 1556 uint8_t ch = str[i]; |
| 1557 if (ch >= '0' && ch <= '9') { | 1557 if (ch >= '0' && ch <= '9') { |
| 1558 if (bFirst) { | 1558 if (bFirst) { |
| 1559 code = (ch - '0') * 16; | 1559 code = (ch - '0') * 16; |
| 1560 } else { | 1560 } else { |
| 1561 code += ch - '0'; | 1561 code += ch - '0'; |
| 1562 buf.AppendChar((char)code); | 1562 buf.AppendChar((char)code); |
| 1563 } | 1563 } |
| 1564 bFirst = !bFirst; | 1564 bFirst = !bFirst; |
| 1565 } else if (ch >= 'A' && ch <= 'F') { | 1565 } else if (ch >= 'A' && ch <= 'F') { |
| 1566 if (bFirst) { | 1566 if (bFirst) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1578 buf.AppendChar((char)code); | 1578 buf.AppendChar((char)code); |
| 1579 } | 1579 } |
| 1580 bFirst = !bFirst; | 1580 bFirst = !bFirst; |
| 1581 } | 1581 } |
| 1582 } | 1582 } |
| 1583 if (!bFirst) { | 1583 if (!bFirst) { |
| 1584 buf.AppendChar((char)code); | 1584 buf.AppendChar((char)code); |
| 1585 } | 1585 } |
| 1586 return buf.GetByteString(); | 1586 return buf.GetByteString(); |
| 1587 } | 1587 } |
| OLD | NEW |