summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-03-13 16:43:37 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-14 14:14:51 +0000
commit812e96c2b4c5908a1979da5e27cdcecda0d1dfc9 (patch)
treef0b0607f6b757eb22237527215094bd87b5d03ba /core/fpdfapi/parser
parent893822aa5b6254591f8e80fbffcbb4fa6ad849aa (diff)
downloadpdfium-812e96c2b4c5908a1979da5e27cdcecda0d1dfc9.tar.xz
Replace FX_CHAR and FX_WCHAR with underlying types.
Change-Id: I96e0a20d66b9184d22f64d8e4ce0dadd5a78c1e8 Reviewed-on: https://pdfium-review.googlesource.com/2967 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r--core/fpdfapi/parser/cpdf_document.cpp23
-rw-r--r--core/fpdfapi/parser/cpdf_document.h4
-rw-r--r--core/fpdfapi/parser/cpdf_parser.cpp14
-rw-r--r--core/fpdfapi/parser/cpdf_parser.h2
-rw-r--r--core/fpdfapi/parser/cpdf_parser_unittest.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_syntax_parser.cpp10
-rw-r--r--core/fpdfapi/parser/fpdf_parser_decode.cpp8
-rw-r--r--core/fpdfapi/parser/fpdf_parser_decode.h2
-rw-r--r--core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp6
-rw-r--r--core/fpdfapi/parser/fpdf_parser_utility.cpp6
10 files changed, 38 insertions, 39 deletions
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
index 21eb61a991..ed88a4f82a 100644
--- a/core/fpdfapi/parser/cpdf_document.cpp
+++ b/core/fpdfapi/parser/cpdf_document.cpp
@@ -231,8 +231,8 @@ CFX_ByteString FPDF_GetPSNameFromTT(HDC hDC) {
void InsertWidthArray1(CFX_Font* pFont,
CFX_UnicodeEncoding* pEncoding,
- FX_WCHAR start,
- FX_WCHAR end,
+ wchar_t start,
+ wchar_t end,
CPDF_Array* pWidthArray) {
int size = end - start + 1;
int* widths = FX_Alloc(int, size);
@@ -765,7 +765,7 @@ void CPDF_Document::DeletePage(int iPage) {
m_PageList.erase(m_PageList.begin() + iPage);
}
-CPDF_Font* CPDF_Document::AddStandardFont(const FX_CHAR* font,
+CPDF_Font* CPDF_Document::AddStandardFont(const char* font,
CPDF_FontEncoding* pEncoding) {
CFX_ByteString name(font);
if (PDF_GetStandardFontName(&name) < 0)
@@ -804,7 +804,7 @@ CPDF_Dictionary* CPDF_Document::ProcessbCJK(
int charset,
bool bVert,
CFX_ByteString basefont,
- std::function<void(FX_WCHAR, FX_WCHAR, CPDF_Array*)> Insert) {
+ std::function<void(wchar_t, wchar_t, CPDF_Array*)> Insert) {
CPDF_Dictionary* pFontDict = NewIndirect<CPDF_Dictionary>();
CFX_ByteString cmap;
CFX_ByteString ordering;
@@ -914,12 +914,11 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, bool bVert) {
ProcessNonbCJK(pBaseDict, pFont->IsBold(), pFont->IsItalic(), basefont,
std::move(pWidths));
} else {
- pFontDict = ProcessbCJK(pBaseDict, charset, bVert, basefont,
- [pFont, &pEncoding](FX_WCHAR start, FX_WCHAR end,
- CPDF_Array* widthArr) {
- InsertWidthArray1(pFont, pEncoding.get(), start,
- end, widthArr);
- });
+ pFontDict = ProcessbCJK(
+ pBaseDict, charset, bVert, basefont,
+ [pFont, &pEncoding](wchar_t start, wchar_t end, CPDF_Array* widthArr) {
+ InsertWidthArray1(pFont, pEncoding.get(), start, end, widthArr);
+ });
}
int italicangle =
pFont->GetSubstFont() ? pFont->GetSubstFont()->m_ItalicAngle : 0;
@@ -934,7 +933,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, bool bVert) {
if (pFont->GetSubstFont()) {
nStemV = pFont->GetSubstFont()->m_Weight / 5;
} else {
- static const FX_CHAR stem_chars[] = {'i', 'I', '!', '1'};
+ static const char stem_chars[] = {'i', 'I', '!', '1'};
const size_t count = FX_ArraySize(stem_chars);
uint32_t glyph = pEncoding->GlyphFromCharCode(stem_chars[0]);
nStemV = pFont->GetGlyphWidth(glyph);
@@ -1032,7 +1031,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont,
} else {
pFontDict =
ProcessbCJK(pBaseDict, pLogFont->lfCharSet, bVert, basefont,
- [&hDC](FX_WCHAR start, FX_WCHAR end, CPDF_Array* widthArr) {
+ [&hDC](wchar_t start, wchar_t end, CPDF_Array* widthArr) {
InsertWidthArray(hDC, start, end, widthArr);
});
}
diff --git a/core/fpdfapi/parser/cpdf_document.h b/core/fpdfapi/parser/cpdf_document.h
index 3848ad6220..3524231c48 100644
--- a/core/fpdfapi/parser/cpdf_document.h
+++ b/core/fpdfapi/parser/cpdf_document.h
@@ -89,7 +89,7 @@ class CPDF_Document : public CPDF_IndirectObjectHolder {
void CreateNewDoc();
CPDF_Dictionary* CreateNewPage(int iPage);
- CPDF_Font* AddStandardFont(const FX_CHAR* font, CPDF_FontEncoding* pEncoding);
+ CPDF_Font* AddStandardFont(const char* font, CPDF_FontEncoding* pEncoding);
CPDF_Font* AddFont(CFX_Font* pFont, int charset, bool bVert);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
CPDF_Font* AddWindowsFont(LOGFONTA* pLogFont,
@@ -119,7 +119,7 @@ class CPDF_Document : public CPDF_IndirectObjectHolder {
int charset,
bool bVert,
CFX_ByteString basefont,
- std::function<void(FX_WCHAR, FX_WCHAR, CPDF_Array*)> Insert);
+ std::function<void(wchar_t, wchar_t, CPDF_Array*)> Insert);
bool InsertDeletePDFPage(CPDF_Dictionary* pPages,
int nPagesToGo,
CPDF_Dictionary* pPageDict,
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index f9d9eb3a97..323f91779c 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -143,13 +143,13 @@ CPDF_Parser::Error CPDF_Parser::StartParse(
return FORMAT_ERROR;
if (std::isdigit(ch))
- m_FileVersion = FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch)) * 10;
+ m_FileVersion = FXSYS_toDecimalDigit(static_cast<wchar_t>(ch)) * 10;
if (!m_pSyntax->GetCharAt(7, ch))
return FORMAT_ERROR;
if (std::isdigit(ch))
- m_FileVersion += FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
+ m_FileVersion += FXSYS_toDecimalDigit(static_cast<wchar_t>(ch));
if (m_pSyntax->m_FileLen < m_pSyntax->m_HeaderOffset + 9)
return FORMAT_ERROR;
@@ -627,7 +627,7 @@ bool CPDF_Parser::RebuildCrossRef() {
if (std::isdigit(byte)) {
start_pos = pos + i;
state = ParserState::kObjNum;
- objnum = FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(byte));
+ objnum = FXSYS_toDecimalDigit(static_cast<wchar_t>(byte));
} else if (byte == 't') {
state = ParserState::kTrailer;
inside_index = 1;
@@ -643,7 +643,7 @@ bool CPDF_Parser::RebuildCrossRef() {
case ParserState::kObjNum:
if (std::isdigit(byte)) {
objnum =
- objnum * 10 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(byte));
+ objnum * 10 + FXSYS_toDecimalDigit(static_cast<wchar_t>(byte));
} else if (PDFCharIsWhitespace(byte)) {
state = ParserState::kPostObjNum;
} else {
@@ -657,7 +657,7 @@ bool CPDF_Parser::RebuildCrossRef() {
if (std::isdigit(byte)) {
start_pos1 = pos + i;
state = ParserState::kGenNum;
- gennum = FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(byte));
+ gennum = FXSYS_toDecimalDigit(static_cast<wchar_t>(byte));
} else if (byte == 't') {
state = ParserState::kTrailer;
inside_index = 1;
@@ -670,7 +670,7 @@ bool CPDF_Parser::RebuildCrossRef() {
case ParserState::kGenNum:
if (std::isdigit(byte)) {
gennum =
- gennum * 10 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(byte));
+ gennum * 10 + FXSYS_toDecimalDigit(static_cast<wchar_t>(byte));
} else if (PDFCharIsWhitespace(byte)) {
state = ParserState::kPostGenNum;
} else {
@@ -685,7 +685,7 @@ bool CPDF_Parser::RebuildCrossRef() {
inside_index = 1;
} else if (std::isdigit(byte)) {
objnum = gennum;
- gennum = FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(byte));
+ gennum = FXSYS_toDecimalDigit(static_cast<wchar_t>(byte));
start_pos = start_pos1;
start_pos1 = pos + i;
state = ParserState::kGenNum;
diff --git a/core/fpdfapi/parser/cpdf_parser.h b/core/fpdfapi/parser/cpdf_parser.h
index f8ff7a17ec..0b73857649 100644
--- a/core/fpdfapi/parser/cpdf_parser.h
+++ b/core/fpdfapi/parser/cpdf_parser.h
@@ -48,7 +48,7 @@ class CPDF_Parser {
Error StartLinearizedParse(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
CPDF_Document* pDocument);
- void SetPassword(const FX_CHAR* password) { m_Password = password; }
+ void SetPassword(const char* password) { m_Password = password; }
CFX_ByteString GetPassword() { return m_Password; }
CPDF_Dictionary* GetTrailer() const { return m_pTrailer.get(); }
FX_FILESIZE GetLastXRefOffset() const { return m_LastXRefOffset; }
diff --git a/core/fpdfapi/parser/cpdf_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_parser_unittest.cpp
index 3518f7d16b..a90477f930 100644
--- a/core/fpdfapi/parser/cpdf_parser_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_parser_unittest.cpp
@@ -49,7 +49,7 @@ class CPDF_TestParser : public CPDF_Parser {
~CPDF_TestParser() {}
// Setup reading from a file and initial states.
- bool InitTestFromFile(const FX_CHAR* path) {
+ bool InitTestFromFile(const char* path) {
CFX_RetainPtr<IFX_SeekableReadStream> pFileAccess =
IFX_SeekableReadStream::CreateFromFilename(path);
if (!pFileAccess)
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index 1b81b98c96..2a0bf360fc 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -225,7 +225,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadString() {
break;
case ReadStatus::Backslash:
if (ch >= '0' && ch <= '7') {
- iEscCode = FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
+ iEscCode = FXSYS_toDecimalDigit(static_cast<wchar_t>(ch));
status = ReadStatus::Octal;
break;
}
@@ -251,7 +251,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadString() {
case ReadStatus::Octal:
if (ch >= '0' && ch <= '7') {
iEscCode =
- iEscCode * 8 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
+ iEscCode * 8 + FXSYS_toDecimalDigit(static_cast<wchar_t>(ch));
status = ReadStatus::FinishOctal;
} else {
buf.AppendChar(iEscCode);
@@ -263,7 +263,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadString() {
status = ReadStatus::Normal;
if (ch >= '0' && ch <= '7') {
iEscCode =
- iEscCode * 8 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
+ iEscCode * 8 + FXSYS_toDecimalDigit(static_cast<wchar_t>(ch));
buf.AppendChar(iEscCode);
} else {
buf.AppendChar(iEscCode);
@@ -358,7 +358,7 @@ void CPDF_SyntaxParser::ToNextWord() {
CFX_ByteString CPDF_SyntaxParser::GetNextWord(bool* bIsNumber) {
GetNextWordInternal(bIsNumber);
- return CFX_ByteString((const FX_CHAR*)m_WordBuffer, m_WordSize);
+ return CFX_ByteString((const char*)m_WordBuffer, m_WordSize);
}
CFX_ByteString CPDF_SyntaxParser::GetKeyword() {
@@ -781,7 +781,7 @@ uint32_t CPDF_SyntaxParser::GetDirectNum() {
return 0;
m_WordBuffer[m_WordSize] = 0;
- return FXSYS_atoui(reinterpret_cast<const FX_CHAR*>(m_WordBuffer));
+ return FXSYS_atoui(reinterpret_cast<const char*>(m_WordBuffer));
}
bool CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos,
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp
index 480e2c111f..98bb4eedf5 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp
@@ -432,7 +432,7 @@ CFX_WideString PDF_DecodeText(const uint8_t* src_data, uint32_t src_len) {
if (src_data[0] == 0xff) {
bBE = !src_data[2];
}
- FX_WCHAR* dest_buf = result.GetBuffer(max_chars);
+ wchar_t* dest_buf = result.GetBuffer(max_chars);
const uint8_t* uni_str = src_data + 2;
int dest_pos = 0;
for (uint32_t i = 0; i < max_chars * 2; i += 2) {
@@ -453,7 +453,7 @@ CFX_WideString PDF_DecodeText(const uint8_t* src_data, uint32_t src_len) {
}
result.ReleaseBuffer(dest_pos);
} else {
- FX_WCHAR* dest_buf = result.GetBuffer(src_len);
+ wchar_t* dest_buf = result.GetBuffer(src_len);
for (uint32_t i = 0; i < src_len; i++)
dest_buf[i] = PDFDocEncoding[src_data[i]];
result.ReleaseBuffer(src_len);
@@ -465,12 +465,12 @@ CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr) {
return PDF_DecodeText((const uint8_t*)bstr.c_str(), bstr.GetLength());
}
-CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len) {
+CFX_ByteString PDF_EncodeText(const wchar_t* pString, int len) {
if (len == -1) {
len = FXSYS_wcslen(pString);
}
CFX_ByteString result;
- FX_CHAR* dest_buf1 = result.GetBuffer(len);
+ char* dest_buf1 = result.GetBuffer(len);
int i;
for (i = 0; i < len; i++) {
int code;
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.h b/core/fpdfapi/parser/fpdf_parser_decode.h
index dc8ecf0c9b..0c74e41058 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.h
+++ b/core/fpdfapi/parser/fpdf_parser_decode.h
@@ -23,7 +23,7 @@ CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig);
CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, bool bHex = false);
CFX_WideString PDF_DecodeText(const uint8_t* pData, uint32_t size);
CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr);
-CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len = -1);
+CFX_ByteString PDF_EncodeText(const wchar_t* pString, int len = -1);
CFX_ByteString PDF_EncodeText(const CFX_WideString& str);
bool FlateEncode(const uint8_t* src_buf,
diff --git a/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp b/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
index 30d30a433d..f8c9863c32 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
@@ -79,8 +79,8 @@ TEST(fpdf_parser_decode, HexDecode) {
TEST(fpdf_parser_decode, EncodeText) {
struct EncodeTestData {
- const FX_WCHAR* input;
- const FX_CHAR* expected_output;
+ const wchar_t* input;
+ const char* expected_output;
FX_STRSIZE expected_length;
} test_data[] = {
// Empty src string.
@@ -102,7 +102,7 @@ TEST(fpdf_parser_decode, EncodeText) {
CFX_ByteString output = PDF_EncodeText(test_case.input);
ASSERT_EQ(test_case.expected_length, output.GetLength()) << "for case "
<< i;
- const FX_CHAR* str_ptr = output.c_str();
+ const char* str_ptr = output.c_str();
for (FX_STRSIZE j = 0; j < test_case.expected_length; ++j) {
EXPECT_EQ(test_case.expected_output[j], str_ptr[j]) << "for case " << i
<< " char " << j;
diff --git a/core/fpdfapi/parser/fpdf_parser_utility.cpp b/core/fpdfapi/parser/fpdf_parser_utility.cpp
index 9583ea70bc..10ba23125e 100644
--- a/core/fpdfapi/parser/fpdf_parser_utility.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_utility.cpp
@@ -93,8 +93,8 @@ CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& bstr) {
int size = bstr.GetLength();
CFX_ByteString result;
- FX_CHAR* pDestStart = result.GetBuffer(size);
- FX_CHAR* pDest = pDestStart;
+ char* pDestStart = result.GetBuffer(size);
+ char* pDest = pDestStart;
for (int i = 0; i < size; i++) {
if (bstr[i] == '#' && i < size - 2) {
*pDest++ =
@@ -132,7 +132,7 @@ CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) {
return orig;
CFX_ByteString res;
- FX_CHAR* dest_buf = res.GetBuffer(dest_len);
+ char* dest_buf = res.GetBuffer(dest_len);
dest_len = 0;
for (i = 0; i < src_len; i++) {
uint8_t ch = src_buf[i];