diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-03-13 16:43:37 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-14 14:14:51 +0000 |
commit | 812e96c2b4c5908a1979da5e27cdcecda0d1dfc9 (patch) | |
tree | f0b0607f6b757eb22237527215094bd87b5d03ba /core/fpdfapi | |
parent | 893822aa5b6254591f8e80fbffcbb4fa6ad849aa (diff) | |
download | pdfium-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')
33 files changed, 170 insertions, 175 deletions
diff --git a/core/fpdfapi/edit/fpdf_edit_create.cpp b/core/fpdfapi/edit/fpdf_edit_create.cpp index fec0de9512..75d6765927 100644 --- a/core/fpdfapi/edit/fpdf_edit_create.cpp +++ b/core/fpdfapi/edit/fpdf_edit_create.cpp @@ -778,7 +778,7 @@ bool CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, bool bEOF) { if (pFile->AppendString("/Prev ") < 0) { return false; } - FX_CHAR offset_buf[20]; + char offset_buf[20]; FXSYS_memset(offset_buf, 0, sizeof(offset_buf)); FXSYS_i64toa(m_PrevOffset, offset_buf, 10); int32_t offset_len = (int32_t)FXSYS_strlen(offset_buf); @@ -1090,7 +1090,7 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum, CPDF_Encryptor encryptor(m_pCryptoHandler, objnum, (uint8_t*)str.c_str(), str.GetLength()); CFX_ByteString content = PDF_EncodeString( - CFX_ByteString((const FX_CHAR*)encryptor.m_pData, encryptor.m_dwSize), + CFX_ByteString((const char*)encryptor.m_pData, encryptor.m_dwSize), bHex); if ((len = m_File.AppendString(content.AsStringC())) < 0) { return -1; @@ -1778,7 +1778,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) { if (m_File.AppendString("/Prev ") < 0) { return -1; } - FX_CHAR offset_buf[20]; + char offset_buf[20]; FXSYS_memset(offset_buf, 0, sizeof(offset_buf)); FXSYS_i64toa(prev, offset_buf, 10); if (m_File.AppendBlock(offset_buf, FXSYS_strlen(offset_buf)) < 0) { @@ -1860,7 +1860,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) { if (m_File.AppendString("\r\nstartxref\r\n") < 0) { return -1; } - FX_CHAR offset_buf[20]; + char offset_buf[20]; FXSYS_memset(offset_buf, 0, sizeof(offset_buf)); FXSYS_i64toa(m_XrefStart, offset_buf, 10); if (m_File.AppendBlock(offset_buf, FXSYS_strlen(offset_buf)) < 0) { diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp index b0ae05c8c5..6e050c4bc7 100644 --- a/core/fpdfapi/font/cpdf_cidfont.cpp +++ b/core/fpdfapi/font/cpdf_cidfont.cpp @@ -136,9 +136,9 @@ bool IsValidEmbeddedCharcodeFromUnicodeCharset(CIDSet charset) { } } -FX_WCHAR EmbeddedUnicodeFromCharcode(const FXCMAP_CMap* pEmbedMap, - CIDSet charset, - uint32_t charcode) { +wchar_t EmbeddedUnicodeFromCharcode(const FXCMAP_CMap* pEmbedMap, + CIDSet charset, + uint32_t charcode) { if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset)) return 0; @@ -151,7 +151,7 @@ FX_WCHAR EmbeddedUnicodeFromCharcode(const FXCMAP_CMap* pEmbedMap, uint32_t EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap, CIDSet charset, - FX_WCHAR unicode) { + wchar_t unicode) { if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset)) return 0; @@ -239,15 +239,15 @@ CFX_WideString CPDF_CIDFont::UnicodeFromCharCode(uint32_t charcode) const { CFX_WideString str = CPDF_Font::UnicodeFromCharCode(charcode); if (!str.IsEmpty()) return str; - FX_WCHAR ret = GetUnicodeFromCharCode(charcode); + wchar_t ret = GetUnicodeFromCharCode(charcode); return ret ? ret : CFX_WideString(); } -FX_WCHAR CPDF_CIDFont::GetUnicodeFromCharCode(uint32_t charcode) const { +wchar_t CPDF_CIDFont::GetUnicodeFromCharCode(uint32_t charcode) const { switch (m_pCMap->m_Coding) { case CIDCODING_UCS2: case CIDCODING_UTF16: - return static_cast<FX_WCHAR>(charcode); + return static_cast<wchar_t>(charcode); case CIDCODING_CID: if (!m_pCID2UnicodeMap || !m_pCID2UnicodeMap->IsLoaded()) return 0; @@ -257,15 +257,15 @@ FX_WCHAR CPDF_CIDFont::GetUnicodeFromCharCode(uint32_t charcode) const { return m_pCID2UnicodeMap->UnicodeFromCID(CIDFromCharCode(charcode)); #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - FX_WCHAR unicode; + wchar_t unicode; int charsize = 1; if (charcode > 255) { charcode = (charcode % 256) * 256 + (charcode / 256); charsize = 2; } - int ret = FXSYS_MultiByteToWideChar( - g_CharsetCPs[m_pCMap->m_Coding], 0, - reinterpret_cast<const FX_CHAR*>(&charcode), charsize, &unicode, 1); + int ret = FXSYS_MultiByteToWideChar(g_CharsetCPs[m_pCMap->m_Coding], 0, + reinterpret_cast<const char*>(&charcode), + charsize, &unicode, 1); return ret == 1 ? unicode : 0; #else if (!m_pCMap->m_pEmbedMap) @@ -275,7 +275,7 @@ FX_WCHAR CPDF_CIDFont::GetUnicodeFromCharCode(uint32_t charcode) const { #endif } -uint32_t CPDF_CIDFont::CharCodeFromUnicode(FX_WCHAR unicode) const { +uint32_t CPDF_CIDFont::CharCodeFromUnicode(wchar_t unicode) const { uint32_t charcode = CPDF_Font::CharCodeFromUnicode(unicode); if (charcode) return charcode; @@ -290,7 +290,7 @@ uint32_t CPDF_CIDFont::CharCodeFromUnicode(FX_WCHAR unicode) const { return 0; uint32_t CID = 0; while (CID < 65536) { - FX_WCHAR this_unicode = + wchar_t this_unicode = m_pCID2UnicodeMap->UnicodeFromCID(static_cast<uint16_t>(CID)); if (this_unicode == unicode) return CID; @@ -611,7 +611,7 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) { if (!m_pFontFile && !m_pStreamAcc) { uint16_t cid = CIDFromCharCode(charcode); - FX_WCHAR unicode = 0; + wchar_t unicode = 0; if (m_bCIDIsGID) { #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ return cid; @@ -649,7 +649,7 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) { iBaseEncoding = PDFFONT_ENCODING_WINANSI; else if (bMacRoman) iBaseEncoding = PDFFONT_ENCODING_MACROMAN; - const FX_CHAR* name = GetAdobeCharName( + const char* name = GetAdobeCharName( iBaseEncoding, std::vector<CFX_ByteString>(), charcode); if (!name) return charcode ? static_cast<int>(charcode) : -1; @@ -693,16 +693,16 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) { for (i = 0; i < FXFT_Get_Face_CharmapCount(face); i++) { uint32_t ret = FT_CharCodeFromUnicode( FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[i]), - static_cast<FX_WCHAR>(charcode)); + static_cast<wchar_t>(charcode)); if (ret == 0) continue; FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[i]); - unicode = static_cast<FX_WCHAR>(ret); + unicode = static_cast<wchar_t>(ret); break; } if (i == FXFT_Get_Face_CharmapCount(face) && i) { FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[0]); - unicode = static_cast<FX_WCHAR>(charcode); + unicode = static_cast<wchar_t>(charcode); } } if (FXFT_Get_Face_Charmap(face)) { @@ -744,7 +744,7 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) { return pdata[0] * 256 + pdata[1]; } -uint32_t CPDF_CIDFont::GetNextChar(const FX_CHAR* pString, +uint32_t CPDF_CIDFont::GetNextChar(const char* pString, int nStrLen, int& offset) const { return m_pCMap->GetNextChar(pString, nStrLen, offset); @@ -754,11 +754,11 @@ int CPDF_CIDFont::GetCharSize(uint32_t charcode) const { return m_pCMap->GetCharSize(charcode); } -int CPDF_CIDFont::CountChar(const FX_CHAR* pString, int size) const { +int CPDF_CIDFont::CountChar(const char* pString, int size) const { return m_pCMap->CountChar(pString, size); } -int CPDF_CIDFont::AppendChar(FX_CHAR* str, uint32_t charcode) const { +int CPDF_CIDFont::AppendChar(char* str, uint32_t charcode) const { return m_pCMap->AppendChar(str, charcode); } diff --git a/core/fpdfapi/font/cpdf_cidfont.h b/core/fpdfapi/font/cpdf_cidfont.h index 79ec7cbb35..e256be1af5 100644 --- a/core/fpdfapi/font/cpdf_cidfont.h +++ b/core/fpdfapi/font/cpdf_cidfont.h @@ -45,16 +45,16 @@ class CPDF_CIDFont : public CPDF_Font { int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) override; int GetCharWidthF(uint32_t charcode) override; FX_RECT GetCharBBox(uint32_t charcode) override; - uint32_t GetNextChar(const FX_CHAR* pString, + uint32_t GetNextChar(const char* pString, int nStrLen, int& offset) const override; - int CountChar(const FX_CHAR* pString, int size) const override; - int AppendChar(FX_CHAR* str, uint32_t charcode) const override; + int CountChar(const char* pString, int size) const override; + int AppendChar(char* str, uint32_t charcode) const override; bool IsVertWriting() const override; bool IsUnicodeCompatible() const override; bool Load() override; CFX_WideString UnicodeFromCharCode(uint32_t charcode) const override; - uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const override; + uint32_t CharCodeFromUnicode(wchar_t Unicode) const override; uint16_t CIDFromCharCode(uint32_t charcode) const; const uint8_t* GetCIDTransform(uint16_t CID) const; @@ -70,7 +70,7 @@ class CPDF_CIDFont : public CPDF_Font { std::vector<uint32_t>* result, int nElements); void LoadSubstFont(); - FX_WCHAR GetUnicodeFromCharCode(uint32_t charcode) const; + wchar_t GetUnicodeFromCharCode(uint32_t charcode) const; CFX_MaybeOwned<CPDF_CMap> m_pCMap; CPDF_CID2UnicodeMap* m_pCID2UnicodeMap; diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp index 36d7d6aeeb..7988ec7124 100644 --- a/core/fpdfapi/font/cpdf_font.cpp +++ b/core/fpdfapi/font/cpdf_font.cpp @@ -118,7 +118,7 @@ bool CPDF_Font::IsUnicodeCompatible() const { return false; } -int CPDF_Font::CountChar(const FX_CHAR* pString, int size) const { +int CPDF_Font::CountChar(const char* pString, int size) const { return size; } @@ -131,8 +131,8 @@ bool CPDF_Font::IsVertWriting() const { return pCIDFont ? pCIDFont->IsVertWriting() : m_Font.IsVertical(); } -int CPDF_Font::AppendChar(FX_CHAR* buf, uint32_t charcode) const { - *buf = static_cast<FX_CHAR>(charcode); +int CPDF_Font::AppendChar(char* buf, uint32_t charcode) const { + *buf = static_cast<char>(charcode); return 1; } @@ -153,7 +153,7 @@ CFX_WideString CPDF_Font::UnicodeFromCharCode(uint32_t charcode) const { return m_pToUnicodeMap ? m_pToUnicodeMap->Lookup(charcode) : CFX_WideString(); } -uint32_t CPDF_Font::CharCodeFromUnicode(FX_WCHAR unicode) const { +uint32_t CPDF_Font::CharCodeFromUnicode(wchar_t unicode) const { if (!m_bToUnicodeLoaded) LoadUnicodeMap(); @@ -281,7 +281,7 @@ void CPDF_Font::LoadUnicodeMap() const { m_pToUnicodeMap->Load(pStream); } -int CPDF_Font::GetStringWidth(const FX_CHAR* pString, int size) { +int CPDF_Font::GetStringWidth(const char* pString, int size) { int offset = 0; int width = 0; while (offset < size) { @@ -341,7 +341,7 @@ std::unique_ptr<CPDF_Font> CPDF_Font::Create(CPDF_Document* pDoc, return pFont->Load() ? std::move(pFont) : nullptr; } -uint32_t CPDF_Font::GetNextChar(const FX_CHAR* pString, +uint32_t CPDF_Font::GetNextChar(const char* pString, int nStrLen, int& offset) const { if (offset < 0 || nStrLen < 1) { @@ -429,7 +429,7 @@ bool CPDF_Font::IsStandardFont() const { return true; } -const FX_CHAR* CPDF_Font::GetAdobeCharName( +const char* CPDF_Font::GetAdobeCharName( int iBaseEncoding, const std::vector<CFX_ByteString>& charnames, int charcode) { @@ -441,7 +441,7 @@ const FX_CHAR* CPDF_Font::GetAdobeCharName( if (!charnames.empty() && !charnames[charcode].IsEmpty()) return charnames[charcode].c_str(); - const FX_CHAR* name = nullptr; + const char* name = nullptr; if (iBaseEncoding) name = PDF_CharNameFromPredefinedCharSet(iBaseEncoding, charcode); return name && name[0] ? name : nullptr; diff --git a/core/fpdfapi/font/cpdf_font.h b/core/fpdfapi/font/cpdf_font.h index 6025a82d7a..6dac3f2778 100644 --- a/core/fpdfapi/font/cpdf_font.h +++ b/core/fpdfapi/font/cpdf_font.h @@ -50,15 +50,15 @@ class CPDF_Font { virtual bool IsVertWriting() const; virtual bool IsUnicodeCompatible() const; - virtual uint32_t GetNextChar(const FX_CHAR* pString, + virtual uint32_t GetNextChar(const char* pString, int nStrLen, int& offset) const; - virtual int CountChar(const FX_CHAR* pString, int size) const; - virtual int AppendChar(FX_CHAR* buf, uint32_t charcode) const; + virtual int CountChar(const char* pString, int size) const; + virtual int AppendChar(char* buf, uint32_t charcode) const; virtual int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) = 0; virtual int GlyphFromCharCodeExt(uint32_t charcode); virtual CFX_WideString UnicodeFromCharCode(uint32_t charcode) const; - virtual uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const; + virtual uint32_t CharCodeFromUnicode(wchar_t Unicode) const; const CFX_ByteString& GetBaseFont() const { return m_BaseFont; } CFX_SubstFont* GetSubstFont() const { return m_Font.GetSubstFont(); } @@ -71,7 +71,7 @@ class CPDF_Font { void GetFontBBox(FX_RECT& rect) const { rect = m_FontBBox; } int GetTypeAscent() const { return m_Ascent; } int GetTypeDescent() const { return m_Descent; } - int GetStringWidth(const FX_CHAR* pString, int size); + int GetStringWidth(const char* pString, int size); uint32_t FallbackFontFromCharcode(uint32_t charcode); int FallbackGlyphFromCharcode(int fallbackFont, uint32_t charcode); @@ -96,9 +96,9 @@ class CPDF_Font { void LoadFontDescriptor(CPDF_Dictionary* pDict); void CheckFontMetrics(); - const FX_CHAR* GetAdobeCharName(int iBaseEncoding, - const std::vector<CFX_ByteString>& charnames, - int charcode); + const char* GetAdobeCharName(int iBaseEncoding, + const std::vector<CFX_ByteString>& charnames, + int charcode); CFX_ByteString m_BaseFont; CPDF_StreamAcc* m_pFontFile; diff --git a/core/fpdfapi/font/cpdf_fontencoding.cpp b/core/fpdfapi/font/cpdf_fontencoding.cpp index 88b2c8d6a5..be4eaff13b 100644 --- a/core/fpdfapi/font/cpdf_fontencoding.cpp +++ b/core/fpdfapi/font/cpdf_fontencoding.cpp @@ -236,7 +236,7 @@ const uint16_t ZapfEncoding[256] = { 0x27BC, 0x27BD, 0x27BE, 0x0000, }; -const FX_CHAR* const StandardEncodingNames[224] = { +const char* const StandardEncodingNames[224] = { "space", "exclam", "quotedbl", @@ -463,7 +463,7 @@ const FX_CHAR* const StandardEncodingNames[224] = { nullptr, }; -const FX_CHAR* const AdobeWinAnsiEncodingNames[224] = { +const char* const AdobeWinAnsiEncodingNames[224] = { "space", "exclam", "quotedbl", @@ -690,7 +690,7 @@ const FX_CHAR* const AdobeWinAnsiEncodingNames[224] = { "ydieresis", }; -const FX_CHAR* const MacRomanEncodingNames[224] = { +const char* const MacRomanEncodingNames[224] = { "space", "exclam", "quotedbl", @@ -917,7 +917,7 @@ const FX_CHAR* const MacRomanEncodingNames[224] = { "caron", }; -const FX_CHAR* const MacExpertEncodingNames[224] = { +const char* const MacExpertEncodingNames[224] = { "space", "exclamsmall", "Hungarumlautsmall", @@ -1144,7 +1144,7 @@ const FX_CHAR* const MacExpertEncodingNames[224] = { nullptr, }; -const FX_CHAR* const PDFDocEncodingNames[232] = { +const char* const PDFDocEncodingNames[232] = { "breve", "caron", "circumflex", @@ -1379,7 +1379,7 @@ const FX_CHAR* const PDFDocEncodingNames[232] = { "ydieresis", }; -const FX_CHAR* const AdobeSymbolEncodingNames[224] = { +const char* const AdobeSymbolEncodingNames[224] = { "space", "exclam", "universal", @@ -1606,7 +1606,7 @@ const FX_CHAR* const AdobeSymbolEncodingNames[224] = { nullptr, }; -const FX_CHAR* const ZapfEncodingNames[224] = { +const char* const ZapfEncodingNames[224] = { "space", "a1", "a2", "a202", "a3", "a4", "a5", "a119", "a118", "a117", "a11", "a12", "a13", "a14", "a15", "a16", "a105", "a17", "a18", "a19", "a20", "a21", "a22", "a23", @@ -1649,7 +1649,7 @@ CPDF_FontEncoding::CPDF_FontEncoding() { FXSYS_memset(m_Unicodes, 0, sizeof(m_Unicodes)); } -int CPDF_FontEncoding::CharCodeFromUnicode(FX_WCHAR unicode) const { +int CPDF_FontEncoding::CharCodeFromUnicode(wchar_t unicode) const { for (int i = 0; i < 256; i++) if (m_Unicodes[i] == unicode) { return i; @@ -1717,7 +1717,7 @@ std::unique_ptr<CPDF_Object> CPDF_FontEncoding::Realize( return std::move(pDict); } -uint32_t FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode) { +uint32_t FT_CharCodeFromUnicode(int encoding, wchar_t unicode) { switch (encoding) { case FXFT_ENCODING_UNICODE: return unicode; @@ -1758,18 +1758,17 @@ const uint16_t* PDF_UnicodesForPredefinedCharSet(int encoding) { return nullptr; } -FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name) { - return (FX_WCHAR)(FXFT_unicode_from_adobe_name(name) & 0x7FFFFFFF); +wchar_t PDF_UnicodeFromAdobeName(const char* name) { + return (wchar_t)(FXFT_unicode_from_adobe_name(name) & 0x7FFFFFFF); } -CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode) { +CFX_ByteString PDF_AdobeNameFromUnicode(wchar_t unicode) { char glyph_name[64]; FXFT_adobe_name_from_unicode(glyph_name, unicode); return CFX_ByteString(glyph_name); } -const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, - uint8_t charcode) { +const char* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode) { if (encoding == PDFFONT_ENCODING_PDFDOC) { if (charcode < 24) return nullptr; @@ -1800,7 +1799,7 @@ const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, return nullptr; } -FX_WCHAR FT_UnicodeFromCharCode(int encoding, uint32_t charcode) { +wchar_t FT_UnicodeFromCharCode(int encoding, uint32_t charcode) { switch (encoding) { case FXFT_ENCODING_UNICODE: return (uint16_t)charcode; diff --git a/core/fpdfapi/font/cpdf_fontencoding.h b/core/fpdfapi/font/cpdf_fontencoding.h index 6c0de909e1..7a94db9f0e 100644 --- a/core/fpdfapi/font/cpdf_fontencoding.h +++ b/core/fpdfapi/font/cpdf_fontencoding.h @@ -24,15 +24,14 @@ #define PDFFONT_ENCODING_MS_SYMBOL 8 #define PDFFONT_ENCODING_UNICODE 9 -uint32_t FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode); -FX_WCHAR FT_UnicodeFromCharCode(int encoding, uint32_t charcode); +uint32_t FT_CharCodeFromUnicode(int encoding, wchar_t unicode); +wchar_t FT_UnicodeFromCharCode(int encoding, uint32_t charcode); -FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name); -CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode); +wchar_t PDF_UnicodeFromAdobeName(const char* name); +CFX_ByteString PDF_AdobeNameFromUnicode(wchar_t unicode); const uint16_t* PDF_UnicodesForPredefinedCharSet(int encoding); -const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, - uint8_t charcode); +const char* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode); class CPDF_Object; @@ -45,19 +44,19 @@ class CPDF_FontEncoding { bool IsIdentical(CPDF_FontEncoding* pAnother) const; - FX_WCHAR UnicodeFromCharCode(uint8_t charcode) const { + wchar_t UnicodeFromCharCode(uint8_t charcode) const { return m_Unicodes[charcode]; } - int CharCodeFromUnicode(FX_WCHAR unicode) const; + int CharCodeFromUnicode(wchar_t unicode) const; - void SetUnicode(uint8_t charcode, FX_WCHAR unicode) { + void SetUnicode(uint8_t charcode, wchar_t unicode) { m_Unicodes[charcode] = unicode; } std::unique_ptr<CPDF_Object> Realize(CFX_WeakPtr<CFX_ByteStringPool> pPool); public: - FX_WCHAR m_Unicodes[256]; + wchar_t m_Unicodes[256]; }; #endif // CORE_FPDFAPI_FONT_CPDF_FONTENCODING_H_ diff --git a/core/fpdfapi/font/cpdf_simplefont.cpp b/core/fpdfapi/font/cpdf_simplefont.cpp index c414270068..94a690f221 100644 --- a/core/fpdfapi/font/cpdf_simplefont.cpp +++ b/core/fpdfapi/font/cpdf_simplefont.cpp @@ -198,13 +198,13 @@ CFX_WideString CPDF_SimpleFont::UnicodeFromCharCode(uint32_t charcode) const { CFX_WideString unicode = CPDF_Font::UnicodeFromCharCode(charcode); if (!unicode.IsEmpty()) return unicode; - FX_WCHAR ret = m_Encoding.UnicodeFromCharCode((uint8_t)charcode); + wchar_t ret = m_Encoding.UnicodeFromCharCode((uint8_t)charcode); if (ret == 0) return CFX_WideString(); return ret; } -uint32_t CPDF_SimpleFont::CharCodeFromUnicode(FX_WCHAR unicode) const { +uint32_t CPDF_SimpleFont::CharCodeFromUnicode(wchar_t unicode) const { uint32_t ret = CPDF_Font::CharCodeFromUnicode(unicode); if (ret) return ret; diff --git a/core/fpdfapi/font/cpdf_simplefont.h b/core/fpdfapi/font/cpdf_simplefont.h index 592290b99b..3e414fa788 100644 --- a/core/fpdfapi/font/cpdf_simplefont.h +++ b/core/fpdfapi/font/cpdf_simplefont.h @@ -25,7 +25,7 @@ class CPDF_SimpleFont : public CPDF_Font { int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) override; bool IsUnicodeCompatible() const override; CFX_WideString UnicodeFromCharCode(uint32_t charcode) const override; - uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const override; + uint32_t CharCodeFromUnicode(wchar_t Unicode) const override; CPDF_FontEncoding* GetEncoding() { return &m_Encoding; } diff --git a/core/fpdfapi/font/cpdf_truetypefont.cpp b/core/fpdfapi/font/cpdf_truetypefont.cpp index b8bee2968e..a87370f971 100644 --- a/core/fpdfapi/font/cpdf_truetypefont.cpp +++ b/core/fpdfapi/font/cpdf_truetypefont.cpp @@ -96,8 +96,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() { } bool bToUnicode = m_pFontDict->KeyExist("ToUnicode"); for (int charcode = 0; charcode < 256; charcode++) { - const FX_CHAR* name = - GetAdobeCharName(baseEncoding, m_CharNames, charcode); + const char* name = GetAdobeCharName(baseEncoding, m_CharNames, charcode); if (!name) { m_GlyphIndex[charcode] = m_pFontFile ? FXFT_Get_Char_Index(m_Font.GetFace(), charcode) : -1; @@ -170,7 +169,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() { if (bFound) { if (baseEncoding != PDFFONT_ENCODING_BUILTIN) { for (int charcode = 0; charcode < 256; charcode++) { - const FX_CHAR* name = + const char* name = GetAdobeCharName(baseEncoding, m_CharNames, charcode); if (name) m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); @@ -204,7 +203,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() { if (m_pFontFile) { m_Encoding.m_Unicodes[charcode] = charcode; } else { - const FX_CHAR* name = GetAdobeCharName(0, m_CharNames, charcode); + const char* name = GetAdobeCharName(0, m_CharNames, charcode); if (name) m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); else if (pUnicodes) diff --git a/core/fpdfapi/font/cpdf_type1font.cpp b/core/fpdfapi/font/cpdf_type1font.cpp index 1a37555a50..4c7b86a567 100644 --- a/core/fpdfapi/font/cpdf_type1font.cpp +++ b/core/fpdfapi/font/cpdf_type1font.cpp @@ -19,8 +19,8 @@ namespace { #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ struct GlyphNameMap { - const FX_CHAR* m_pStrAdobe; - const FX_CHAR* m_pStrUnicode; + const char* m_pStrAdobe; + const char* m_pStrUnicode; }; const GlyphNameMap g_GlyphNameSubsts[] = {{"ff", "uniFB00"}, @@ -30,11 +30,11 @@ const GlyphNameMap g_GlyphNameSubsts[] = {{"ff", "uniFB00"}, {"fl", "uniFB02"}}; int compareString(const void* key, const void* element) { - return FXSYS_stricmp(static_cast<const FX_CHAR*>(key), + return FXSYS_stricmp(static_cast<const char*>(key), static_cast<const GlyphNameMap*>(element)->m_pStrAdobe); } -const FX_CHAR* GlyphNameRemap(const FX_CHAR* pStrAdobe) { +const char* GlyphNameRemap(const char* pStrAdobe) { const GlyphNameMap* found = static_cast<const GlyphNameMap*>(FXSYS_bsearch( pStrAdobe, g_GlyphNameSubsts, FX_ArraySize(g_GlyphNameSubsts), sizeof(GlyphNameMap), compareString)); @@ -161,7 +161,7 @@ void CPDF_Type1Font::LoadGlyphMap() { m_BaseEncoding = PDFFONT_ENCODING_STANDARD; } for (int charcode = 0; charcode < 256; charcode++) { - const FX_CHAR* name = + const char* name = GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode); if (!name) continue; @@ -191,7 +191,7 @@ void CPDF_Type1Font::LoadGlyphMap() { if (bCoreText) { if (m_Flags & FXFONT_SYMBOLIC) { for (int charcode = 0; charcode < 256; charcode++) { - const FX_CHAR* name = + const char* name = GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode); if (name) { m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); @@ -201,12 +201,12 @@ void CPDF_Type1Font::LoadGlyphMap() { } else { m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.GetFace(), charcode); - FX_WCHAR unicode = 0; + wchar_t unicode = 0; if (m_GlyphIndex[charcode]) { unicode = FT_UnicodeFromCharCode(PDFFONT_ENCODING_STANDARD, charcode); } - FX_CHAR name_glyph[256]; + char name_glyph[256]; FXSYS_memset(name_glyph, 0, sizeof(name_glyph)); FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode], name_glyph, 256); @@ -225,13 +225,13 @@ void CPDF_Type1Font::LoadGlyphMap() { bUnicode = true; } for (int charcode = 0; charcode < 256; charcode++) { - const FX_CHAR* name = + const char* name = GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode); if (!name) { continue; } m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); - const FX_CHAR* pStrUnicode = GlyphNameRemap(name); + const char* pStrUnicode = GlyphNameRemap(name); if (pStrUnicode && 0 == FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name)) { name = pStrUnicode; @@ -259,7 +259,7 @@ void CPDF_Type1Font::LoadGlyphMap() { #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ if (m_Flags & FXFONT_SYMBOLIC) { for (int charcode = 0; charcode < 256; charcode++) { - const FX_CHAR* name = + const char* name = GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode); if (name) { m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); @@ -269,10 +269,10 @@ void CPDF_Type1Font::LoadGlyphMap() { m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.GetFace(), charcode); if (m_GlyphIndex[charcode]) { - FX_WCHAR unicode = + wchar_t unicode = FT_UnicodeFromCharCode(PDFFONT_ENCODING_STANDARD, charcode); if (unicode == 0) { - FX_CHAR name_glyph[256]; + char name_glyph[256]; FXSYS_memset(name_glyph, 0, sizeof(name_glyph)); FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode], name_glyph, 256); @@ -297,8 +297,7 @@ void CPDF_Type1Font::LoadGlyphMap() { bUnicode = true; } for (int charcode = 0; charcode < 256; charcode++) { - const FX_CHAR* name = - GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode); + const char* name = GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode); if (!name) { continue; } @@ -323,7 +322,7 @@ void CPDF_Type1Font::LoadGlyphMap() { } #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ -void CPDF_Type1Font::SetExtGID(const FX_CHAR* name, int charcode) { +void CPDF_Type1Font::SetExtGID(const char* name, int charcode) { CFStringRef name_ct = CFStringCreateWithCStringNoCopy( kCFAllocatorDefault, name, kCFStringEncodingASCII, kCFAllocatorNull); m_ExtGID[charcode] = @@ -333,7 +332,7 @@ void CPDF_Type1Font::SetExtGID(const FX_CHAR* name, int charcode) { } void CPDF_Type1Font::CalcExtGID(int charcode) { - FX_CHAR name_glyph[256]; + char name_glyph[256]; FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode], name_glyph, 256); name_glyph[255] = 0; diff --git a/core/fpdfapi/font/cpdf_type1font.h b/core/fpdfapi/font/cpdf_type1font.h index f5f378561d..8039583d8e 100644 --- a/core/fpdfapi/font/cpdf_type1font.h +++ b/core/fpdfapi/font/cpdf_type1font.h @@ -30,7 +30,7 @@ class CPDF_Type1Font : public CPDF_SimpleFont { void LoadGlyphMap() override; #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ - void SetExtGID(const FX_CHAR* name, int charcode); + void SetExtGID(const char* name, int charcode); void CalcExtGID(int charcode); #endif diff --git a/core/fpdfapi/font/cpdf_type3font.cpp b/core/fpdfapi/font/cpdf_type3font.cpp index f6cd6ecf26..b7ff8c9cf0 100644 --- a/core/fpdfapi/font/cpdf_type3font.cpp +++ b/core/fpdfapi/font/cpdf_type3font.cpp @@ -89,7 +89,7 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(uint32_t charcode) { if (it != m_CacheMap.end()) return it->second.get(); - const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode); + const char* name = GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode); if (!name) return nullptr; diff --git a/core/fpdfapi/font/font_int.h b/core/fpdfapi/font/font_int.h index 41d821ec81..23513d4e90 100644 --- a/core/fpdfapi/font/font_int.h +++ b/core/fpdfapi/font/font_int.h @@ -148,9 +148,9 @@ class CPDF_CMap { bool IsVertWriting() const; uint16_t CIDFromCharCode(uint32_t charcode) const; int GetCharSize(uint32_t charcode) const; - uint32_t GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const; - int CountChar(const FX_CHAR* pString, int size) const; - int AppendChar(FX_CHAR* str, uint32_t charcode) const; + uint32_t GetNextChar(const char* pString, int nStrLen, int& offset) const; + int CountChar(const char* pString, int size) const; + int AppendChar(char* str, uint32_t charcode) const; private: friend class CPDF_CMapParser; @@ -176,7 +176,7 @@ class CPDF_CID2UnicodeMap { bool IsLoaded(); void Load(CPDF_CMapManager* pMgr, CIDSet charset, bool bPromptCJK); - FX_WCHAR UnicodeFromCID(uint16_t CID); + wchar_t UnicodeFromCID(uint16_t CID); private: CIDSet m_Charset; @@ -192,7 +192,7 @@ class CPDF_ToUnicodeMap { void Load(CPDF_Stream* pStream); CFX_WideString Lookup(uint32_t charcode) const; - uint32_t ReverseLookup(FX_WCHAR unicode) const; + uint32_t ReverseLookup(wchar_t unicode) const; private: friend class fpdf_font_StringToCode_Test; diff --git a/core/fpdfapi/font/fpdf_font.cpp b/core/fpdfapi/font/fpdf_font.cpp index 86beccaeb4..706ae62cd9 100644 --- a/core/fpdfapi/font/fpdf_font.cpp +++ b/core/fpdfapi/font/fpdf_font.cpp @@ -100,11 +100,11 @@ CFX_WideString CPDF_ToUnicodeMap::Lookup(uint32_t charcode) const { auto it = m_Map.find(charcode); if (it != m_Map.end()) { uint32_t value = it->second; - FX_WCHAR unicode = (FX_WCHAR)(value & 0xffff); + wchar_t unicode = (wchar_t)(value & 0xffff); if (unicode != 0xffff) { return unicode; } - const FX_WCHAR* buf = m_MultiCharBuf.GetBuffer(); + const wchar_t* buf = m_MultiCharBuf.GetBuffer(); uint32_t buf_len = m_MultiCharBuf.GetLength(); if (!buf || buf_len == 0) { return CFX_WideString(); @@ -125,7 +125,7 @@ CFX_WideString CPDF_ToUnicodeMap::Lookup(uint32_t charcode) const { return CFX_WideString(); } -uint32_t CPDF_ToUnicodeMap::ReverseLookup(FX_WCHAR unicode) const { +uint32_t CPDF_ToUnicodeMap::ReverseLookup(wchar_t unicode) const { for (const auto& pair : m_Map) { if (pair.second == static_cast<uint32_t>(unicode)) return pair.first; @@ -155,9 +155,9 @@ uint32_t CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) { static CFX_WideString StringDataAdd(CFX_WideString str) { CFX_WideString ret; int len = str.GetLength(); - FX_WCHAR value = 1; + wchar_t value = 1; for (int i = len - 1; i >= 0; --i) { - FX_WCHAR ch = str[i] + value; + wchar_t ch = str[i] + value; if (ch < str[i]) { ret.Insert(0, 0); } else { @@ -181,7 +181,7 @@ CFX_WideString CPDF_ToUnicodeMap::StringToWideString( CFX_WideString result; if (str[0] == '<') { int byte_pos = 0; - FX_WCHAR ch = 0; + wchar_t ch = 0; for (int i = 1; i < len && std::isxdigit(str[i]); ++i) { ch = ch * 16 + FXSYS_toHexDigit(str[i]); byte_pos++; diff --git a/core/fpdfapi/font/fpdf_font_cid.cpp b/core/fpdfapi/font/fpdf_font_cid.cpp index afb186d070..e6be712a13 100644 --- a/core/fpdfapi/font/fpdf_font_cid.cpp +++ b/core/fpdfapi/font/fpdf_font_cid.cpp @@ -23,12 +23,12 @@ namespace { -const FX_CHAR* const g_CharsetNames[CIDSET_NUM_SETS] = { - nullptr, "GB1", "CNS1", "Japan1", "Korea1", "UCS"}; +const char* const g_CharsetNames[CIDSET_NUM_SETS] = {nullptr, "GB1", "CNS1", + "Japan1", "Korea1", "UCS"}; class CPDF_PredefinedCMap { public: - const FX_CHAR* m_pName; + const char* m_pName; CIDSet m_Charset; CIDCoding m_Coding; CPDF_CMap::CodingScheme m_CodingScheme; @@ -306,7 +306,7 @@ std::unique_ptr<CPDF_CMap> CPDF_CMapManager::LoadPredefinedCMap( const CFX_ByteString& name, bool bPromptCJK) { auto pCMap = pdfium::MakeUnique<CPDF_CMap>(); - const FX_CHAR* pname = name.c_str(); + const char* pname = name.c_str(); if (*pname == '/') pname++; @@ -451,7 +451,7 @@ uint32_t 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(static_cast<FX_WCHAR>(word.GetAt(i))); + num = num * 10 + FXSYS_toDecimalDigit(static_cast<wchar_t>(word.GetAt(i))); if (!num.IsValid()) return 0; } @@ -610,7 +610,7 @@ uint16_t CPDF_CMap::CIDFromCharCode(uint32_t charcode) const { return m_pMapping[charcode]; } -uint32_t CPDF_CMap::GetNextChar(const FX_CHAR* pString, +uint32_t CPDF_CMap::GetNextChar(const char* pString, int nStrLen, int& offset) const { switch (m_CodingScheme) { @@ -676,7 +676,7 @@ int CPDF_CMap::GetCharSize(uint32_t charcode) const { } return 1; } -int CPDF_CMap::CountChar(const FX_CHAR* pString, int size) const { +int CPDF_CMap::CountChar(const char* pString, int size) const { switch (m_CodingScheme) { case OneByte: return size; @@ -704,7 +704,7 @@ int CPDF_CMap::CountChar(const FX_CHAR* pString, int size) const { return size; } -int CPDF_CMap::AppendChar(FX_CHAR* str, uint32_t charcode) const { +int CPDF_CMap::AppendChar(char* str, uint32_t charcode) const { switch (m_CodingScheme) { case OneByte: str[0] = (uint8_t)charcode; @@ -757,7 +757,7 @@ bool CPDF_CID2UnicodeMap::IsLoaded() { return m_EmbeddedCount != 0; } -FX_WCHAR CPDF_CID2UnicodeMap::UnicodeFromCID(uint16_t CID) { +wchar_t CPDF_CID2UnicodeMap::UnicodeFromCID(uint16_t CID) { if (m_Charset == CIDSET_UNICODE) { return CID; } diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp index 6b0bfd7d6d..fea03c70e1 100644 --- a/core/fpdfapi/page/cpdf_image.cpp +++ b/core/fpdfapi/page/cpdf_image.cpp @@ -88,7 +88,7 @@ std::unique_ptr<CPDF_Dictionary> CPDF_Image::InitJPEG(uint8_t* pData, pDict->SetNewFor<CPDF_Name>("Subtype", "Image"); pDict->SetNewFor<CPDF_Number>("Width", width); pDict->SetNewFor<CPDF_Number>("Height", height); - const FX_CHAR* csname = nullptr; + const char* csname = nullptr; if (num_comps == 1) { csname = "DeviceGray"; } else if (num_comps == 3) { @@ -200,13 +200,13 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap) { pCS->AddNew<CPDF_Name>("DeviceRGB"); pCS->AddNew<CPDF_Number>(1); CFX_ByteString ct; - FX_CHAR* pBuf = ct.GetBuffer(6); - pBuf[0] = (FX_CHAR)reset_r; - pBuf[1] = (FX_CHAR)reset_g; - pBuf[2] = (FX_CHAR)reset_b; - pBuf[3] = (FX_CHAR)set_r; - pBuf[4] = (FX_CHAR)set_g; - pBuf[5] = (FX_CHAR)set_b; + char* pBuf = ct.GetBuffer(6); + pBuf[0] = (char)reset_r; + pBuf[1] = (char)reset_g; + pBuf[2] = (char)reset_b; + pBuf[3] = (char)set_r; + pBuf[4] = (char)set_g; + pBuf[5] = (char)set_b; ct.ReleaseBuffer(6); pCS->AddNew<CPDF_String>(ct, true); } diff --git a/core/fpdfapi/page/cpdf_psengine.h b/core/fpdfapi/page/cpdf_psengine.h index 659ca82f6b..eba3e9bbf2 100644 --- a/core/fpdfapi/page/cpdf_psengine.h +++ b/core/fpdfapi/page/cpdf_psengine.h @@ -83,7 +83,7 @@ class CPDF_PSEngine { CPDF_PSEngine(); ~CPDF_PSEngine(); - bool Parse(const FX_CHAR* str, int size); + bool Parse(const char* str, int size); bool Execute(); bool DoOperator(PDF_PSOP op); void Reset() { m_StackCount = 0; } diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp index 102ec7973a..fe277f2839 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp +++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp @@ -135,8 +135,8 @@ CFX_FloatRect GetShadingBBox(CPDF_ShadingPattern* pShading, } struct AbbrPair { - const FX_CHAR* abbr; - const FX_CHAR* full_name; + const char* abbr; + const char* full_name; }; const AbbrPair InlineKeyAbbr[] = { diff --git a/core/fpdfapi/page/cpdf_streamparser.cpp b/core/fpdfapi/page/cpdf_streamparser.cpp index 294d72c950..978617ee8d 100644 --- a/core/fpdfapi/page/cpdf_streamparser.cpp +++ b/core/fpdfapi/page/cpdf_streamparser.cpp @@ -500,7 +500,7 @@ CFX_ByteString CPDF_StreamParser::ReadString() { break; case 1: if (ch >= '0' && ch <= '7') { - iEscCode = FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch)); + iEscCode = FXSYS_toDecimalDigit(static_cast<wchar_t>(ch)); status = 2; break; } @@ -526,7 +526,7 @@ CFX_ByteString CPDF_StreamParser::ReadString() { case 2: 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 = 3; } else { buf.AppendChar(iEscCode); @@ -537,7 +537,7 @@ CFX_ByteString CPDF_StreamParser::ReadString() { case 3: 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); status = 0; } else { diff --git a/core/fpdfapi/page/cpdf_textobject.cpp b/core/fpdfapi/page/cpdf_textobject.cpp index da69de8ce1..1c940bc057 100644 --- a/core/fpdfapi/page/cpdf_textobject.cpp +++ b/core/fpdfapi/page/cpdf_textobject.cpp @@ -149,7 +149,7 @@ void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs, m_CharPos.resize(nChars - 1); int index = 0; for (int i = 0; i < nsegs; ++i) { - const FX_CHAR* segment = pStrs[i].c_str(); + const char* segment = pStrs[i].c_str(); int len = pStrs[i].GetLength(); int offset = 0; while (offset < len) diff --git a/core/fpdfapi/page/fpdf_page_func.cpp b/core/fpdfapi/page/fpdf_page_func.cpp index f81ec9e6bd..9c0cc945b3 100644 --- a/core/fpdfapi/page/fpdf_page_func.cpp +++ b/core/fpdfapi/page/fpdf_page_func.cpp @@ -25,7 +25,7 @@ namespace { struct PDF_PSOpName { - const FX_CHAR* name; + const char* name; PDF_PSOP op; }; @@ -95,7 +95,7 @@ class CPDF_PSFunc : public CPDF_Function { bool CPDF_PSFunc::v_Init(CPDF_Object* pObj) { CPDF_StreamAcc acc; acc.LoadAllData(pObj->AsStream(), false); - return m_PS.Parse(reinterpret_cast<const FX_CHAR*>(acc.GetData()), + return m_PS.Parse(reinterpret_cast<const char*>(acc.GetData()), acc.GetSize()); } @@ -200,7 +200,7 @@ FX_FLOAT CPDF_PSEngine::Pop() { } return m_Stack[--m_StackCount]; } -bool CPDF_PSEngine::Parse(const FX_CHAR* str, int size) { +bool CPDF_PSEngine::Parse(const char* str, int size) { CPDF_SimpleParser parser((uint8_t*)str, size); CFX_ByteStringC word = parser.GetWord(); if (word != "{") { 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]; diff --git a/core/fpdfapi/render/cpdf_type3cache.cpp b/core/fpdfapi/render/cpdf_type3cache.cpp index 63cc780d1d..a5de13b464 100644 --- a/core/fpdfapi/render/cpdf_type3cache.cpp +++ b/core/fpdfapi/render/cpdf_type3cache.cpp @@ -19,7 +19,7 @@ namespace { struct CPDF_UniqueKeyGen { void Generate(int count, ...); - FX_CHAR m_Key[128]; + char m_Key[128]; int m_KeyLen; }; |