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

Unified Diff: core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp

Issue 1757283002: Combine StrToInt methods. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
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 02e3617feb2a83789c5890517d28ed8f09dbb6f2..b49607e743f3aa090e8c764a697c871be7a4f348 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);
« no previous file with comments | « core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698