summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fpdfapi')
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp2
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp15
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp24
3 files changed, 24 insertions, 17 deletions
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
index 3cbd67633f..7c85b8213d 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
@@ -720,7 +720,7 @@ FX_DWORD CPDF_CMapParser::CMap_GetCode(const CFX_ByteStringC& word) {
}
for (int i = 0; i < word.GetLength() && std::isdigit(word.GetAt(i)); ++i)
- num = num * 10 + FXSYS_toDecimalDigit(word.GetAt(i));
+ num = num * 10 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(word.GetAt(i)));
return num;
}
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);
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 16d1134cb1..737bbe49be 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -208,12 +208,12 @@ CPDF_Parser::Error CPDF_Parser::StartParse(IFX_FileRead* pFileAccess) {
if (!m_Syntax.GetCharAt(5, ch))
return FORMAT_ERROR;
if (std::isdigit(ch))
- m_FileVersion = FXSYS_toDecimalDigit(ch) * 10;
+ m_FileVersion = FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch)) * 10;
if (!m_Syntax.GetCharAt(7, ch))
return FORMAT_ERROR;
if (std::isdigit(ch))
- m_FileVersion += FXSYS_toDecimalDigit(ch);
+ m_FileVersion += FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
if (m_Syntax.m_FileLen < m_Syntax.m_HeaderOffset + 9)
return FORMAT_ERROR;
@@ -669,7 +669,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
if (std::isdigit(byte)) {
start_pos = pos + i;
state = ParserState::kObjNum;
- objnum = FXSYS_toDecimalDigit(byte);
+ objnum = FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(byte));
} else if (byte == 't') {
state = ParserState::kTrailer;
inside_index = 1;
@@ -684,7 +684,8 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
case ParserState::kObjNum:
if (std::isdigit(byte)) {
- objnum = objnum * 10 + FXSYS_toDecimalDigit(byte);
+ objnum =
+ objnum * 10 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(byte));
} else if (PDFCharIsWhitespace(byte)) {
state = ParserState::kPostObjNum;
} else {
@@ -698,7 +699,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
if (std::isdigit(byte)) {
start_pos1 = pos + i;
state = ParserState::kGenNum;
- gennum = FXSYS_toDecimalDigit(byte);
+ gennum = FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(byte));
} else if (byte == 't') {
state = ParserState::kTrailer;
inside_index = 1;
@@ -710,7 +711,8 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
case ParserState::kGenNum:
if (std::isdigit(byte)) {
- gennum = gennum * 10 + FXSYS_toDecimalDigit(byte);
+ gennum =
+ gennum * 10 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(byte));
} else if (PDFCharIsWhitespace(byte)) {
state = ParserState::kPostGenNum;
} else {
@@ -725,7 +727,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
inside_index = 1;
} else if (std::isdigit(byte)) {
objnum = gennum;
- gennum = FXSYS_toDecimalDigit(byte);
+ gennum = FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(byte));
start_pos = start_pos1;
start_pos1 = pos + i;
state = ParserState::kGenNum;
@@ -1876,7 +1878,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadString() {
break;
case 1:
if (ch >= '0' && ch <= '7') {
- iEscCode = FXSYS_toDecimalDigit(ch);
+ iEscCode = FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
status = 2;
break;
}
@@ -1901,7 +1903,8 @@ CFX_ByteString CPDF_SyntaxParser::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);
@@ -1911,7 +1914,8 @@ CFX_ByteString CPDF_SyntaxParser::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 {