summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_page
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2016-03-03 17:12:58 -0500
committerDan Sinclair <dsinclair@chromium.org>2016-03-03 17:12:58 -0500
commit1c91537c9f9669246713a5be628493ae2fc4899a (patch)
treeb40c06fde5dd0410f4eb7a0734f11758aa6c5d37 /core/src/fpdfapi/fpdf_page
parent44beca7313284a60c21b4973d42f993b8c248ec9 (diff)
downloadpdfium-1c91537c9f9669246713a5be628493ae2fc4899a.tar.xz
Combine StrToInt methods.
This Cl combines the two StrToInt implementations. In doing so I had to add some more overrides to toDecimalDigit() and add a isDecimalDigit(). BUG=pdfium:423 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1757283002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_page')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index 02e3617feb..b49607e743 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -533,10 +533,11 @@ CFX_ByteString CPDF_StreamParser::ReadString() {
if (!PositionIsInBounds())
return CFX_ByteString();
- int ch = m_pBuf[m_Pos++];
+ uint8_t ch = m_pBuf[m_Pos++];
CFX_ByteTextBuf buf;
int parlevel = 0;
- int status = 0, iEscCode = 0;
+ int status = 0;
+ int iEscCode = 0;
while (1) {
switch (status) {
case 0:
@@ -560,7 +561,7 @@ CFX_ByteString CPDF_StreamParser::ReadString() {
break;
case 1:
if (ch >= '0' && ch <= '7') {
- iEscCode = FXSYS_toDecimalDigit(ch);
+ iEscCode = FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
status = 2;
break;
}
@@ -585,7 +586,8 @@ CFX_ByteString CPDF_StreamParser::ReadString() {
break;
case 2:
if (ch >= '0' && ch <= '7') {
- iEscCode = iEscCode * 8 + FXSYS_toDecimalDigit(ch);
+ iEscCode =
+ iEscCode * 8 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
status = 3;
} else {
buf.AppendChar(iEscCode);
@@ -595,7 +597,8 @@ CFX_ByteString CPDF_StreamParser::ReadString() {
break;
case 3:
if (ch >= '0' && ch <= '7') {
- iEscCode = iEscCode * 8 + FXSYS_toDecimalDigit(ch);
+ iEscCode =
+ iEscCode * 8 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
buf.AppendChar(iEscCode);
status = 0;
} else {
@@ -617,7 +620,7 @@ CFX_ByteString CPDF_StreamParser::ReadString() {
ch = m_pBuf[m_Pos++];
}
if (PositionIsInBounds())
- ch = m_pBuf[m_Pos++];
+ ++m_Pos;
if (buf.GetLength() > MAX_STRING_LENGTH) {
return CFX_ByteString(buf.GetBuffer(), MAX_STRING_LENGTH);