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 | |
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>
297 files changed, 2000 insertions, 2044 deletions
diff --git a/core/fdrm/crypto/fx_crypt_sha.cpp b/core/fdrm/crypto/fx_crypt_sha.cpp index 79ff503334..6837649145 100644 --- a/core/fdrm/crypto/fx_crypt_sha.cpp +++ b/core/fdrm/crypto/fx_crypt_sha.cpp @@ -359,7 +359,7 @@ void CRYPT_SHA256Generate(const uint8_t* data, CRYPT_SHA256Finish(&ctx, digest); } -uint64_t FX_ato64i(const FX_CHAR* str) { +uint64_t FX_ato64i(const char* str) { ASSERT(str); uint64_t ret = 0; int len = (int)FXSYS_strlen(str); @@ -426,7 +426,7 @@ static const uint8_t sha384_padding[128] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const FX_CHAR* constants[] = { +static const char* constants[] = { "428a2f98d728ae22", "7137449123ef65cd", "b5c0fbcfec4d3b2f", "e9b5dba58189dbbc", "3956c25bf348b538", "59f111f1b605d019", "923f82a4af194f9b", "ab1c5ed5da6d8118", "d807aa98a3030242", 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; }; diff --git a/core/fpdfdoc/cpdf_aaction.cpp b/core/fpdfdoc/cpdf_aaction.cpp index 39120fcdb3..7dc42828f4 100644 --- a/core/fpdfdoc/cpdf_aaction.cpp +++ b/core/fpdfdoc/cpdf_aaction.cpp @@ -8,9 +8,9 @@ namespace { -const FX_CHAR* g_sAATypes[] = {"E", "X", "D", "U", "Fo", "Bl", "PO", "PC", - "PV", "PI", "O", "C", "K", "F", "V", "C", - "WC", "WS", "DS", "WP", "DP", ""}; +const char* g_sAATypes[] = {"E", "X", "D", "U", "Fo", "Bl", "PO", "PC", + "PV", "PI", "O", "C", "K", "F", "V", "C", + "WC", "WS", "DS", "WP", "DP", ""}; } // namespace diff --git a/core/fpdfdoc/cpdf_action.cpp b/core/fpdfdoc/cpdf_action.cpp index dabc0bb102..f523f86b37 100644 --- a/core/fpdfdoc/cpdf_action.cpp +++ b/core/fpdfdoc/cpdf_action.cpp @@ -13,7 +13,7 @@ namespace { -const FX_CHAR* const g_sATypes[] = { +const char* const g_sATypes[] = { "Unknown", "GoTo", "GoToR", "GoToE", "Launch", "Thread", "URI", "Sound", "Movie", "Hide", "Named", "SubmitForm", "ResetForm", "ImportData", "JavaScript", diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp index 89c4785d98..f15d39d89b 100644 --- a/core/fpdfdoc/cpdf_annot.cpp +++ b/core/fpdfdoc/cpdf_annot.cpp @@ -163,7 +163,7 @@ CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, if (!pAP) { return nullptr; } - const FX_CHAR* ap_entry = "N"; + const char* ap_entry = "N"; if (mode == CPDF_Annot::Down) ap_entry = "D"; else if (mode == CPDF_Annot::Rollover) diff --git a/core/fpdfdoc/cpdf_bookmark.cpp b/core/fpdfdoc/cpdf_bookmark.cpp index c2c3705717..ba1e18c46d 100644 --- a/core/fpdfdoc/cpdf_bookmark.cpp +++ b/core/fpdfdoc/cpdf_bookmark.cpp @@ -44,9 +44,9 @@ CFX_WideString CPDF_Bookmark::GetTitle() const { if (!len) return CFX_WideString(); - std::unique_ptr<FX_WCHAR[]> buf(new FX_WCHAR[len]); + std::unique_ptr<wchar_t[]> buf(new wchar_t[len]); for (int i = 0; i < len; i++) { - FX_WCHAR w = title[i]; + wchar_t w = title[i]; buf[i] = w > 0x20 ? w : 0x20; } return CFX_WideString(buf.get(), len); diff --git a/core/fpdfdoc/cpdf_dest.cpp b/core/fpdfdoc/cpdf_dest.cpp index 51e2d0b534..11264f729d 100644 --- a/core/fpdfdoc/cpdf_dest.cpp +++ b/core/fpdfdoc/cpdf_dest.cpp @@ -13,8 +13,8 @@ namespace { -const FX_CHAR* const g_sZoomModes[] = {"XYZ", "Fit", "FitH", "FitV", "FitR", - "FitB", "FitBH", "FitBV", nullptr}; +const char* const g_sZoomModes[] = {"XYZ", "Fit", "FitH", "FitV", "FitR", + "FitB", "FitBH", "FitBV", nullptr}; } // namespace diff --git a/core/fpdfdoc/cpdf_filespec.cpp b/core/fpdfdoc/cpdf_filespec.cpp index ce6f9a247e..e5f026e573 100644 --- a/core/fpdfdoc/cpdf_filespec.cpp +++ b/core/fpdfdoc/cpdf_filespec.cpp @@ -17,7 +17,7 @@ namespace { #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \ _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -CFX_WideString ChangeSlashToPlatform(const FX_WCHAR* str) { +CFX_WideString ChangeSlashToPlatform(const wchar_t* str) { CFX_WideString result; while (*str) { if (*str == '/') { @@ -34,7 +34,7 @@ CFX_WideString ChangeSlashToPlatform(const FX_WCHAR* str) { return result; } -CFX_WideString ChangeSlashToPDF(const FX_WCHAR* str) { +CFX_WideString ChangeSlashToPDF(const wchar_t* str) { CFX_WideString result; while (*str) { if (*str == '\\' || *str == ':') diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp index 54edb4910c..0a5363ed96 100644 --- a/core/fpdfdoc/cpdf_formcontrol.cpp +++ b/core/fpdfdoc/cpdf_formcontrol.cpp @@ -20,7 +20,7 @@ namespace { -const FX_CHAR* const g_sHighlightingMode[] = { +const char* const g_sHighlightingMode[] = { // Must match order of HighlightingMode enum. "N", "I", "O", "P", "T"}; diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp index f9187d8d27..c697cbbf16 100644 --- a/core/fpdfdoc/cpdf_formfield.cpp +++ b/core/fpdfdoc/cpdf_formfield.cpp @@ -48,7 +48,7 @@ bool IsUnison(CPDF_FormField* pField) { } // namespace CPDF_Object* FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict, - const FX_CHAR* name, + const char* name, int nLevel) { if (nLevel > kMaxRecursion) return nullptr; diff --git a/core/fpdfdoc/cpdf_formfield.h b/core/fpdfdoc/cpdf_formfield.h index 42608b1122..0cb0a481c2 100644 --- a/core/fpdfdoc/cpdf_formfield.h +++ b/core/fpdfdoc/cpdf_formfield.h @@ -36,7 +36,7 @@ class CPDF_InterForm; class CPDF_String; CPDF_Object* FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict, - const FX_CHAR* name, + const char* name, int nLevel = 0); CFX_WideString FPDF_GetFullName(CPDF_Dictionary* pFieldDict); diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp index d9f0db9747..9b2c2eb323 100644 --- a/core/fpdfdoc/cpdf_interform.cpp +++ b/core/fpdfdoc/cpdf_interform.cpp @@ -29,7 +29,7 @@ namespace { const int nMaxRecursion = 32; const struct SupportFieldEncoding { - const FX_CHAR* m_name; + const char* m_name; uint16_t m_codePage; } g_fieldEncoding[] = { {"BigFive", 950}, @@ -307,7 +307,7 @@ class CFieldNameExtractor { m_pEnd = m_pCur + m_FullName.GetLength(); } - void GetNext(const FX_WCHAR*& pSubName, FX_STRSIZE& size) { + void GetNext(const wchar_t*& pSubName, FX_STRSIZE& size) { pSubName = m_pCur; while (m_pCur < m_pEnd && m_pCur[0] != L'.') m_pCur++; @@ -319,8 +319,8 @@ class CFieldNameExtractor { protected: CFX_WideString m_FullName; - const FX_WCHAR* m_pCur; - const FX_WCHAR* m_pEnd; + const wchar_t* m_pCur; + const wchar_t* m_pEnd; }; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ @@ -372,8 +372,8 @@ bool RetrieveSpecificFont(uint8_t charSet, #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ int CompareFieldName(const CFX_WideString& name1, const CFX_WideString& name2) { - const FX_WCHAR* ptr1 = name1.c_str(); - const FX_WCHAR* ptr2 = name2.c_str(); + const wchar_t* ptr1 = name1.c_str(); + const wchar_t* ptr2 = name2.c_str(); if (name1.GetLength() == name2.GetLength()) return name1 == name2 ? 1 : 0; @@ -523,7 +523,7 @@ void CFieldTree::SetField(const CFX_WideString& full_name, return; CFieldNameExtractor name_extractor(full_name); - const FX_WCHAR* pName; + const wchar_t* pName; FX_STRSIZE nLength; name_extractor.GetNext(pName, nLength); Node* pNode = &m_Root; @@ -546,7 +546,7 @@ CPDF_FormField* CFieldTree::GetField(const CFX_WideString& full_name) { return nullptr; CFieldNameExtractor name_extractor(full_name); - const FX_WCHAR* pName; + const wchar_t* pName; FX_STRSIZE nLength; name_extractor.GetNext(pName, nLength); Node* pNode = &m_Root; @@ -565,7 +565,7 @@ CFieldTree::Node* CFieldTree::FindNode(const CFX_WideString& full_name) { return nullptr; CFieldNameExtractor name_extractor(full_name); - const FX_WCHAR* pName; + const wchar_t* pName; FX_STRSIZE nLength; name_extractor.GetNext(pName, nLength); Node* pNode = &m_Root; @@ -687,9 +687,9 @@ void CPDF_InterForm::SetUpdateAP(bool bUpdateAP) { CFX_ByteString CPDF_InterForm::GenerateNewResourceName( const CPDF_Dictionary* pResDict, - const FX_CHAR* csType, + const char* csType, int iMinLen, - const FX_CHAR* csPrefix) { + const char* csPrefix) { CFX_ByteString csStr = csPrefix; CFX_ByteString csBType = csType; if (csStr.IsEmpty()) { diff --git a/core/fpdfdoc/cpdf_interform.h b/core/fpdfdoc/cpdf_interform.h index cbaaa7bc2d..fdf08ac79e 100644 --- a/core/fpdfdoc/cpdf_interform.h +++ b/core/fpdfdoc/cpdf_interform.h @@ -39,9 +39,9 @@ class CPDF_InterForm { static void SetUpdateAP(bool bUpdateAP); static bool IsUpdateAPEnabled(); static CFX_ByteString GenerateNewResourceName(const CPDF_Dictionary* pResDict, - const FX_CHAR* csType, + const char* csType, int iMinLen, - const FX_CHAR* csPrefix); + const char* csPrefix); static CPDF_Font* AddStandardFont(CPDF_Document* pDocument, CFX_ByteString csFontName); static CFX_ByteString GetNativeFont(uint8_t iCharSet, void* pLogFont); diff --git a/core/fpdfdoc/cpdf_pagelabel.cpp b/core/fpdfdoc/cpdf_pagelabel.cpp index 2a79d77ca7..4200a28f64 100644 --- a/core/fpdfdoc/cpdf_pagelabel.cpp +++ b/core/fpdfdoc/cpdf_pagelabel.cpp @@ -44,7 +44,7 @@ CFX_WideString MakeLetters(int num) { int count = num / nLetterCount + 1; count %= nMaxCount; - FX_WCHAR ch = L'a' + num % nLetterCount; + wchar_t ch = L'a' + num % nLetterCount; for (int i = 0; i < count; i++) wsLetters += ch; return wsLetters; diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp index 94b3425a09..aa393f7657 100644 --- a/core/fpdfdoc/cpdf_variabletext.cpp +++ b/core/fpdfdoc/cpdf_variabletext.cpp @@ -338,7 +338,7 @@ CPVT_WordPlace CPDF_VariableText::InsertSection( } CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace& place, - const FX_WCHAR* text) { + const wchar_t* text) { CFX_WideString swText = text; CPVT_WordPlace wp = place; for (int32_t i = 0, sz = swText.GetLength(); i < sz; i++) { diff --git a/core/fpdfdoc/cpdf_variabletext.h b/core/fpdfdoc/cpdf_variabletext.h index 8e7c0c964a..3bec89abec 100644 --- a/core/fpdfdoc/cpdf_variabletext.h +++ b/core/fpdfdoc/cpdf_variabletext.h @@ -114,7 +114,7 @@ class CPDF_VariableText { CPVT_WordPlace InsertSection(const CPVT_WordPlace& place, const CPVT_SecProps* pSecProps, const CPVT_WordProps* pWordProps); - CPVT_WordPlace InsertText(const CPVT_WordPlace& place, const FX_WCHAR* text); + CPVT_WordPlace InsertText(const CPVT_WordPlace& place, const wchar_t* text); CPVT_WordPlace DeleteWords(const CPVT_WordRange& PlaceRange); CPVT_WordPlace DeleteWord(const CPVT_WordPlace& place); CPVT_WordPlace BackSpaceWord(const CPVT_WordPlace& place); diff --git a/core/fpdftext/cpdf_linkextract.cpp b/core/fpdftext/cpdf_linkextract.cpp index a1fc93e158..686b6a23b8 100644 --- a/core/fpdftext/cpdf_linkextract.cpp +++ b/core/fpdftext/cpdf_linkextract.cpp @@ -45,7 +45,7 @@ void CPDF_LinkExtract::ParseLink() { strBeCheck = m_pTextPage->GetPageText(start, nCount); if (strBeCheck.GetLength() > 5) { while (strBeCheck.GetLength() > 0) { - FX_WCHAR ch = strBeCheck.GetAt(strBeCheck.GetLength() - 1); + wchar_t ch = strBeCheck.GetAt(strBeCheck.GetLength() - 1); if (ch == L')' || ch == L',' || ch == L'>' || ch == L'.') { strBeCheck = strBeCheck.Mid(0, strBeCheck.GetLength() - 1); nCount--; @@ -101,7 +101,7 @@ bool CPDF_LinkExtract::CheckMailLink(CFX_WideString& str) { // Check the local part. int pPos = aPos; // Used to track the position of '@' or '.'. for (int i = aPos - 1; i >= 0; i--) { - FX_WCHAR ch = str.GetAt(i); + wchar_t ch = str.GetAt(i); if (ch == L'_' || ch == L'-' || FXSYS_iswalnum(ch)) continue; @@ -137,7 +137,7 @@ bool CPDF_LinkExtract::CheckMailLink(CFX_WideString& str) { int nLen = str.GetLength(); pPos = 0; // Used to track the position of '.'. for (int i = aPos + 1; i < nLen; i++) { - FX_WCHAR wch = str.GetAt(i); + wchar_t wch = str.GetAt(i); if (wch == L'-' || FXSYS_iswalnum(wch)) continue; diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp index 73a1a7e88e..1a1edcb0ff 100644 --- a/core/fpdftext/cpdf_textpage.cpp +++ b/core/fpdftext/cpdf_textpage.cpp @@ -66,9 +66,9 @@ FX_FLOAT CalculateBaseSpace(const CPDF_TextObject* pTextObj, return baseSpace; } -FX_STRSIZE Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst) { +FX_STRSIZE Unicode_GetNormalization(wchar_t wch, wchar_t* pDst) { wch = wch & 0xFFFF; - FX_WCHAR wFind = g_UnicodeData_Normalization[wch]; + wchar_t wFind = g_UnicodeData_Normalization[wch]; if (!wFind) { if (pDst) *pDst = wch; @@ -84,12 +84,12 @@ FX_STRSIZE Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst) { const uint16_t* pMap = g_UnicodeData_Normalization_Maps[wFind]; if (pMap == g_UnicodeData_Normalization_Map4) { pMap = g_UnicodeData_Normalization_Map4 + wch; - wFind = (FX_WCHAR)(*pMap++); + wFind = (wchar_t)(*pMap++); } else { pMap += wch; } if (pDst) { - FX_WCHAR n = wFind; + wchar_t n = wFind; while (n--) *pDst++ = *pMap++; } @@ -568,7 +568,7 @@ CPDF_TextPage::TextOrientation CPDF_TextPage::FindTextlineFlowOrientation() return TextOrientation::Unknown; } -void CPDF_TextPage::AppendGeneratedCharacter(FX_WCHAR unicode, +void CPDF_TextPage::AppendGeneratedCharacter(wchar_t unicode, const CFX_Matrix& formMatrix) { PAGECHAR_INFO generateChar; if (!GenerateCharInfo(unicode, generateChar)) @@ -639,7 +639,7 @@ int CPDF_TextPage::GetCharWidth(uint32_t charCode, CPDF_Font* pFont) const { return pFont->GetCharBBox(charCode).Width(); } -void CPDF_TextPage::AddCharInfoByLRDirection(FX_WCHAR wChar, +void CPDF_TextPage::AddCharInfoByLRDirection(wchar_t wChar, PAGECHAR_INFO info) { if (IsControlChar(info)) { info.m_Index = -1; @@ -649,10 +649,10 @@ void CPDF_TextPage::AddCharInfoByLRDirection(FX_WCHAR wChar, info.m_Index = m_TextBuf.GetLength(); if (wChar >= 0xFB00 && wChar <= 0xFB06) { - FX_WCHAR* pDst = nullptr; + wchar_t* pDst = nullptr; FX_STRSIZE nCount = Unicode_GetNormalization(wChar, pDst); if (nCount >= 1) { - pDst = FX_Alloc(FX_WCHAR, nCount); + pDst = FX_Alloc(wchar_t, nCount); Unicode_GetNormalization(wChar, pDst); for (int nIndex = 0; nIndex < nCount; nIndex++) { PAGECHAR_INFO info2 = info; @@ -669,7 +669,7 @@ void CPDF_TextPage::AddCharInfoByLRDirection(FX_WCHAR wChar, m_CharList.push_back(info); } -void CPDF_TextPage::AddCharInfoByRLDirection(FX_WCHAR wChar, +void CPDF_TextPage::AddCharInfoByRLDirection(wchar_t wChar, PAGECHAR_INFO info) { if (IsControlChar(info)) { info.m_Index = -1; @@ -679,10 +679,10 @@ void CPDF_TextPage::AddCharInfoByRLDirection(FX_WCHAR wChar, info.m_Index = m_TextBuf.GetLength(); wChar = FX_GetMirrorChar(wChar, true, false); - FX_WCHAR* pDst = nullptr; + wchar_t* pDst = nullptr; FX_STRSIZE nCount = Unicode_GetNormalization(wChar, pDst); if (nCount >= 1) { - pDst = FX_Alloc(FX_WCHAR, nCount); + pDst = FX_Alloc(wchar_t, nCount); Unicode_GetNormalization(wChar, pDst); for (int nIndex = 0; nIndex < nCount; nIndex++) { PAGECHAR_INFO info2 = info; @@ -858,7 +858,7 @@ FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) { bExist = false; for (FX_STRSIZE i = 0; i < nItems; i++) { - FX_WCHAR wChar = actText.GetAt(i); + wchar_t wChar = actText.GetAt(i); if ((wChar > 0x80 && wChar < 0xFFFD) || (wChar <= 0x80 && isprint(wChar))) { bExist = true; break; @@ -895,7 +895,7 @@ void CPDF_TextPage::ProcessMarkedContent(PDFTEXT_Obj Obj) { matrix.Concat(Obj.m_formMatrix); for (FX_STRSIZE k = 0; k < nItems; k++) { - FX_WCHAR wChar = actText.GetAt(k); + wchar_t wChar = actText.GetAt(k); if (wChar <= 0x80 && !isprint(wChar)) wChar = 0x20; if (wChar >= 0xFFFD) @@ -934,7 +934,7 @@ void CPDF_TextPage::SwapTempTextBuf(int32_t iCharListStartAppend, std::swap(m_TempCharList[i], m_TempCharList[j]); std::swap(m_TempCharList[i].m_Index, m_TempCharList[j].m_Index); } - FX_WCHAR* pTempBuffer = m_TempTextBuf.GetBuffer(); + wchar_t* pTempBuffer = m_TempTextBuf.GetBuffer(); i = iBufStartAppend; j = m_TempTextBuf.GetLength() - 1; for (; i < j; i++, j--) @@ -951,9 +951,9 @@ bool CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj, if (item.m_CharCode == static_cast<uint32_t>(-1)) continue; CFX_WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode); - FX_WCHAR wChar = wstrItem.GetAt(0); + wchar_t wChar = wstrItem.GetAt(0); if ((wstrItem.IsEmpty() || wChar == 0) && item.m_CharCode) - wChar = (FX_WCHAR)item.m_CharCode; + wChar = (wchar_t)item.m_CharCode; if (wChar) str += wChar; } @@ -1010,8 +1010,8 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { CFX_WideString wstrItem = pTextObj->GetFont()->UnicodeFromCharCode(item.m_CharCode); if (wstrItem.IsEmpty()) - wstrItem += (FX_WCHAR)item.m_CharCode; - FX_WCHAR curChar = wstrItem.GetAt(0); + wstrItem += (wchar_t)item.m_CharCode; + wchar_t curChar = wstrItem.GetAt(0); if (curChar == 0x2D || curChar == 0xAD) return; } @@ -1112,7 +1112,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { CFX_WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode); bool bNoUnicode = false; if (wstrItem.IsEmpty() && item.m_CharCode) { - wstrItem += static_cast<FX_WCHAR>(item.m_CharCode); + wstrItem += static_cast<wchar_t>(item.m_CharCode); bNoUnicode = true; } charinfo.m_Index = -1; @@ -1223,18 +1223,18 @@ CPDF_TextPage::TextOrientation CPDF_TextPage::GetTextObjectWritingMode( return m_TextlineDir; } -bool CPDF_TextPage::IsHyphen(FX_WCHAR curChar) { +bool CPDF_TextPage::IsHyphen(wchar_t curChar) { CFX_WideString strCurText = m_TempTextBuf.MakeString(); if (strCurText.IsEmpty()) strCurText = m_TextBuf.AsStringC(); FX_STRSIZE nCount = strCurText.GetLength(); int nIndex = nCount - 1; - FX_WCHAR wcTmp = strCurText.GetAt(nIndex); + wchar_t wcTmp = strCurText.GetAt(nIndex); while (wcTmp == 0x20 && nIndex <= nCount - 1 && nIndex >= 0) wcTmp = strCurText.GetAt(--nIndex); if (0x2D == wcTmp || 0xAD == wcTmp) { if (--nIndex > 0) { - FX_WCHAR preChar = strCurText.GetAt((nIndex)); + wchar_t preChar = strCurText.GetAt((nIndex)); if (((preChar >= L'A' && preChar <= L'Z') || (preChar >= L'a' && preChar <= L'z')) && ((curChar >= L'A' && curChar <= L'Z') || @@ -1275,8 +1275,8 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject( CFX_WideString wstrItem = pObj->GetFont()->UnicodeFromCharCode(item.m_CharCode); if (wstrItem.IsEmpty()) - wstrItem += static_cast<FX_WCHAR>(item.m_CharCode); - FX_WCHAR curChar = wstrItem.GetAt(0); + wstrItem += static_cast<wchar_t>(item.m_CharCode); + wchar_t curChar = wstrItem.GetAt(0); if (WritingMode == TextOrientation::Horizontal) { if (this_rect.Height() > 4.5 && prev_rect.Height() > 4.5) { FX_FLOAT top = @@ -1368,7 +1368,7 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject( } CFX_WideString PrevStr = m_pPreTextObj->GetFont()->UnicodeFromCharCode(PrevItem.m_CharCode); - FX_WCHAR preChar = PrevStr.GetAt(PrevStr.GetLength() - 1); + wchar_t preChar = PrevStr.GetAt(PrevStr.GetLength() - 1); CFX_Matrix matrix = pObj->GetTextMatrix(); matrix.Concat(formMatrix); @@ -1482,7 +1482,7 @@ bool CPDF_TextPage::IsSameAsPreTextObject( return false; } -bool CPDF_TextPage::GenerateCharInfo(FX_WCHAR unicode, PAGECHAR_INFO& info) { +bool CPDF_TextPage::GenerateCharInfo(wchar_t unicode, PAGECHAR_INFO& info) { const PAGECHAR_INFO* preChar; if (!m_TempCharList.empty()) preChar = &m_TempCharList.back(); diff --git a/core/fpdftext/cpdf_textpage.h b/core/fpdftext/cpdf_textpage.h index 91942d1bec..e8de6205a2 100644 --- a/core/fpdftext/cpdf_textpage.h +++ b/core/fpdftext/cpdf_textpage.h @@ -49,8 +49,8 @@ class FPDF_CHAR_INFO { FPDF_CHAR_INFO(); ~FPDF_CHAR_INFO(); - FX_WCHAR m_Unicode; - FX_WCHAR m_Charcode; + wchar_t m_Unicode; + wchar_t m_Charcode; int32_t m_Flag; FX_FLOAT m_FontSize; CFX_PointF m_Origin; @@ -72,7 +72,7 @@ class PAGECHAR_INFO { int m_Index; int m_CharCode; - FX_WCHAR m_Unicode; + wchar_t m_Unicode; int32_t m_Flag; CFX_PointF m_Origin; CFX_FloatRect m_CharBox; @@ -125,7 +125,7 @@ class CPDF_TextPage { Hyphen, }; - bool IsHyphen(FX_WCHAR curChar); + bool IsHyphen(wchar_t curChar); bool IsControlChar(const PAGECHAR_INFO& charInfo); void ProcessObject(); void ProcessFormObject(CPDF_FormObject* pFormObj, @@ -137,7 +137,7 @@ class CPDF_TextPage { CPDF_PageObjectList::const_iterator ObjPos); GenerateCharacter ProcessInsertObject(const CPDF_TextObject* pObj, const CFX_Matrix& formMatrix); - bool GenerateCharInfo(FX_WCHAR unicode, PAGECHAR_INFO& info); + bool GenerateCharInfo(wchar_t unicode, PAGECHAR_INFO& info); bool IsSameAsPreTextObject(CPDF_TextObject* pTextObj, const CPDF_PageObjectList* pObjList, CPDF_PageObjectList::const_iterator ObjPos); @@ -148,12 +148,12 @@ class CPDF_TextPage { void ProcessMarkedContent(PDFTEXT_Obj pObj); void CheckMarkedContentObject(int32_t& start, int32_t& nCount) const; void FindPreviousTextObject(); - void AddCharInfoByLRDirection(FX_WCHAR wChar, PAGECHAR_INFO info); - void AddCharInfoByRLDirection(FX_WCHAR wChar, PAGECHAR_INFO info); + void AddCharInfoByLRDirection(wchar_t wChar, PAGECHAR_INFO info); + void AddCharInfoByRLDirection(wchar_t wChar, PAGECHAR_INFO info); TextOrientation GetTextObjectWritingMode( const CPDF_TextObject* pTextObj) const; TextOrientation FindTextlineFlowOrientation() const; - void AppendGeneratedCharacter(FX_WCHAR unicode, const CFX_Matrix& formMatrix); + void AppendGeneratedCharacter(wchar_t unicode, const CFX_Matrix& formMatrix); void SwapTempTextBuf(int32_t iCharListStartAppend, int32_t iBufStartAppend); bool IsRightToLeft(const CPDF_TextObject* pTextObj, diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp index a79b5e7e8a..e268975aa7 100644 --- a/core/fpdftext/cpdf_textpagefind.cpp +++ b/core/fpdftext/cpdf_textpagefind.cpp @@ -17,7 +17,7 @@ namespace { -bool IsIgnoreSpaceCharacter(FX_WCHAR curChar) { +bool IsIgnoreSpaceCharacter(wchar_t curChar) { if (curChar < 255 || (curChar >= 0x0600 && curChar <= 0x06FF) || (curChar >= 0xFE70 && curChar <= 0xFEFF) || (curChar >= 0xFB50 && curChar <= 0xFDFF) || @@ -150,7 +150,7 @@ bool CPDF_TextPageFind::FindNext() { CFX_WideString csWord = m_csFindWhatArray[iWord]; if (csWord.IsEmpty()) { if (iWord == nCount - 1) { - FX_WCHAR strInsert = m_strText.GetAt(nStartPos); + wchar_t strInsert = m_strText.GetAt(nStartPos); if (strInsert == TEXT_LINEFEED_CHAR || strInsert == TEXT_SPACE_CHAR || strInsert == TEXT_RETURN_CHAR || strInsert == 160) { nResultPos = nStartPos + 1; @@ -183,7 +183,7 @@ bool CPDF_TextPageFind::FindNext() { bMatch = false; } for (int d = PreResEndPos; d < nResultPos; d++) { - FX_WCHAR strInsert = m_strText.GetAt(d); + wchar_t strInsert = m_strText.GetAt(d); if (strInsert != TEXT_LINEFEED_CHAR && strInsert != TEXT_SPACE_CHAR && strInsert != TEXT_RETURN_CHAR && strInsert != 160) { bMatch = false; @@ -192,7 +192,7 @@ bool CPDF_TextPageFind::FindNext() { } } else if (bSpaceStart) { if (nResultPos > 0) { - FX_WCHAR strInsert = m_strText.GetAt(nResultPos - 1); + wchar_t strInsert = m_strText.GetAt(nResultPos - 1); if (strInsert != TEXT_LINEFEED_CHAR && strInsert != TEXT_SPACE_CHAR && strInsert != TEXT_RETURN_CHAR && strInsert != 160) { bMatch = false; @@ -293,7 +293,7 @@ void CPDF_TextPageFind::ExtractFindWhat(const CFX_WideString& findwhat) { int pos = 0; while (pos < csWord.GetLength()) { CFX_WideString curStr = csWord.Mid(pos, 1); - FX_WCHAR curChar = csWord.GetAt(pos); + wchar_t curChar = csWord.GetAt(pos); if (IsIgnoreSpaceCharacter(curChar)) { if (pos > 0 && curChar == 0x2019) { pos++; @@ -321,8 +321,8 @@ void CPDF_TextPageFind::ExtractFindWhat(const CFX_WideString& findwhat) { bool CPDF_TextPageFind::IsMatchWholeWord(const CFX_WideString& csPageText, int startPos, int endPos) { - FX_WCHAR char_left = 0; - FX_WCHAR char_right = 0; + wchar_t char_left = 0; + wchar_t char_right = 0; int char_count = endPos - startPos + 1; if (char_count < 1) return false; @@ -362,9 +362,9 @@ bool CPDF_TextPageFind::IsMatchWholeWord(const CFX_WideString& csPageText, } bool CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString, - const FX_WCHAR* lpszFullString, + const wchar_t* lpszFullString, int iSubString, - FX_WCHAR chSep) { + wchar_t chSep) { if (!lpszFullString) return false; while (iSubString--) { @@ -377,12 +377,11 @@ bool CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString, while (*lpszFullString == chSep) lpszFullString++; } - const FX_WCHAR* lpchEnd = std::wcschr(lpszFullString, chSep); + const wchar_t* lpchEnd = std::wcschr(lpszFullString, chSep); int nLen = lpchEnd ? (int)(lpchEnd - lpszFullString) : (int)FXSYS_wcslen(lpszFullString); ASSERT(nLen >= 0); - FXSYS_memcpy(rString.GetBuffer(nLen), lpszFullString, - nLen * sizeof(FX_WCHAR)); + FXSYS_memcpy(rString.GetBuffer(nLen), lpszFullString, nLen * sizeof(wchar_t)); rString.ReleaseBuffer(); return true; } diff --git a/core/fpdftext/cpdf_textpagefind.h b/core/fpdftext/cpdf_textpagefind.h index c60cb576a7..dd509018bd 100644 --- a/core/fpdftext/cpdf_textpagefind.h +++ b/core/fpdftext/cpdf_textpagefind.h @@ -32,9 +32,9 @@ class CPDF_TextPageFind { int startPos, int endPos); bool ExtractSubString(CFX_WideString& rString, - const FX_WCHAR* lpszFullString, + const wchar_t* lpszFullString, int iSubString, - FX_WCHAR chSep); + wchar_t chSep); CFX_WideString MakeReverse(const CFX_WideString& str); int GetCharIndex(int index) const; diff --git a/core/fxcodec/codec/ccodec_bmpmodule.cpp b/core/fxcodec/codec/ccodec_bmpmodule.cpp index 9d64199501..f237b14448 100644 --- a/core/fxcodec/codec/ccodec_bmpmodule.cpp +++ b/core/fxcodec/codec/ccodec_bmpmodule.cpp @@ -27,7 +27,7 @@ static void bmp_free_func(void* p) { } }; static void bmp_error_data(bmp_decompress_struct_p bmp_ptr, - const FX_CHAR* err_msg) { + const char* err_msg) { FXSYS_strncpy((char*)bmp_ptr->err_ptr, err_msg, BMP_MAX_ERROR_SIZE - 1); longjmp(bmp_ptr->jmpbuf, 1); } diff --git a/core/fxcodec/codec/ccodec_bmpmodule.h b/core/fxcodec/codec/ccodec_bmpmodule.h index 11d5931cac..d07d9850c6 100644 --- a/core/fxcodec/codec/ccodec_bmpmodule.h +++ b/core/fxcodec/codec/ccodec_bmpmodule.h @@ -33,7 +33,7 @@ class CCodec_BmpModule : public ICodec_BmpModule { int32_t LoadImage(FXBMP_Context* pContext) override; protected: - FX_CHAR m_szLastError[256]; + char m_szLastError[256]; }; #endif // CORE_FXCODEC_CODEC_CCODEC_BMPMODULE_H_ diff --git a/core/fxcodec/codec/ccodec_gifmodule.cpp b/core/fxcodec/codec/ccodec_gifmodule.cpp index a85bc5eddc..91c64a06a1 100644 --- a/core/fxcodec/codec/ccodec_gifmodule.cpp +++ b/core/fxcodec/codec/ccodec_gifmodule.cpp @@ -29,7 +29,7 @@ static void gif_free_func(void* p) { }; static void gif_error_data(gif_decompress_struct_p gif_ptr, - const FX_CHAR* err_msg) { + const char* err_msg) { FXSYS_strncpy((char*)gif_ptr->err_ptr, err_msg, GIF_MAX_ERROR_SIZE - 1); longjmp(gif_ptr->jmpbuf, 1); } diff --git a/core/fxcodec/codec/ccodec_gifmodule.h b/core/fxcodec/codec/ccodec_gifmodule.h index 7721d7a767..6830064d43 100644 --- a/core/fxcodec/codec/ccodec_gifmodule.h +++ b/core/fxcodec/codec/ccodec_gifmodule.h @@ -39,7 +39,7 @@ class CCodec_GifModule : public ICodec_GifModule { CFX_DIBAttribute* pAttribute) override; protected: - FX_CHAR m_szLastError[256]; + char m_szLastError[256]; }; #endif // CORE_FXCODEC_CODEC_CCODEC_GIFMODULE_H_ diff --git a/core/fxcodec/codec/ccodec_pngmodule.cpp b/core/fxcodec/codec/ccodec_pngmodule.cpp index 028513b729..4bd4cfce93 100644 --- a/core/fxcodec/codec/ccodec_pngmodule.cpp +++ b/core/fxcodec/codec/ccodec_pngmodule.cpp @@ -57,7 +57,7 @@ static void _png_load_bmp_attribute(png_structp png_ptr, png_get_tIME(png_ptr, info_ptr, &t); if (t) { FXSYS_memset(pAttribute->m_strTime, 0, sizeof(pAttribute->m_strTime)); - FXSYS_snprintf((FX_CHAR*)pAttribute->m_strTime, + FXSYS_snprintf((char*)pAttribute->m_strTime, sizeof(pAttribute->m_strTime), "%4u:%2u:%2u %2u:%2u:%2u", t->year, t->month, t->day, t->hour, t->minute, t->second); pAttribute->m_strTime[sizeof(pAttribute->m_strTime) - 1] = 0; @@ -67,7 +67,7 @@ static void _png_load_bmp_attribute(png_structp png_ptr, #if defined(PNG_TEXT_SUPPORTED) int i; FX_STRSIZE len; - const FX_CHAR* buf; + const char* buf; int num_text; png_textp text = nullptr; png_get_text(png_ptr, info_ptr, &text, &num_text); diff --git a/core/fxcodec/codec/ccodec_pngmodule.h b/core/fxcodec/codec/ccodec_pngmodule.h index 1f3a3d96cc..0ca33f03c6 100644 --- a/core/fxcodec/codec/ccodec_pngmodule.h +++ b/core/fxcodec/codec/ccodec_pngmodule.h @@ -25,7 +25,7 @@ class CCodec_PngModule : public ICodec_PngModule { CFX_DIBAttribute* pAttribute) override; protected: - FX_CHAR m_szLastError[PNG_ERROR_SIZE]; + char m_szLastError[PNG_ERROR_SIZE]; }; #endif // CORE_FXCODEC_CODEC_CCODEC_PNGMODULE_H_ diff --git a/core/fxcodec/codec/ccodec_tiffmodule.cpp b/core/fxcodec/codec/ccodec_tiffmodule.cpp index 736772892a..3d7db88b18 100644 --- a/core/fxcodec/codec/ccodec_tiffmodule.cpp +++ b/core/fxcodec/codec/ccodec_tiffmodule.cpp @@ -193,7 +193,7 @@ bool Tiff_Exif_GetInfo(TIFF* tif_ctx, ttag_t tag, CFX_DIBAttribute* pAttr) { void Tiff_Exif_GetStringInfo(TIFF* tif_ctx, ttag_t tag, CFX_DIBAttribute* pAttr) { - FX_CHAR* buf = nullptr; + char* buf = nullptr; TIFFGetField(tif_ctx, tag, &buf); if (!buf) return; diff --git a/core/fxcodec/lbmp/fx_bmp.cpp b/core/fxcodec/lbmp/fx_bmp.cpp index 6d4fb51fcd..c31886dcfd 100644 --- a/core/fxcodec/lbmp/fx_bmp.cpp +++ b/core/fxcodec/lbmp/fx_bmp.cpp @@ -34,7 +34,7 @@ void SetWord_LSBFirst(uint8_t* p, uint16_t v) { p[0] = (uint8_t)v; p[1] = (uint8_t)(v >> 8); } -void bmp_error(bmp_decompress_struct_p bmp_ptr, const FX_CHAR* err_msg) { +void bmp_error(bmp_decompress_struct_p bmp_ptr, const char* err_msg) { if (bmp_ptr && bmp_ptr->bmp_error_fn) { bmp_ptr->bmp_error_fn(bmp_ptr, err_msg); } diff --git a/core/fxcodec/lbmp/fx_bmp.h b/core/fxcodec/lbmp/fx_bmp.h index b0233d1ef0..5d1f799fd1 100644 --- a/core/fxcodec/lbmp/fx_bmp.h +++ b/core/fxcodec/lbmp/fx_bmp.h @@ -70,8 +70,8 @@ typedef bmp_decompress_struct* bmp_decompress_struct_p; typedef bmp_decompress_struct_p* bmp_decompress_struct_pp; struct tag_bmp_decompress_struct { jmp_buf jmpbuf; - FX_CHAR* err_ptr; - void (*bmp_error_fn)(bmp_decompress_struct_p gif_ptr, const FX_CHAR* err_msg); + char* err_ptr; + void (*bmp_error_fn)(bmp_decompress_struct_p gif_ptr, const char* err_msg); void* context_ptr; @@ -111,7 +111,7 @@ struct tag_bmp_decompress_struct { uint32_t skip_size; int32_t decode_status; }; -void bmp_error(bmp_decompress_struct_p bmp_ptr, const FX_CHAR* err_msg); +void bmp_error(bmp_decompress_struct_p bmp_ptr, const char* err_msg); bmp_decompress_struct_p bmp_create_decompress(); void bmp_destroy_decompress(bmp_decompress_struct_pp bmp_ptr_ptr); int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr); diff --git a/core/fxcodec/lgif/fx_gif.cpp b/core/fxcodec/lgif/fx_gif.cpp index d62dacb36c..c4661b0acd 100644 --- a/core/fxcodec/lgif/fx_gif.cpp +++ b/core/fxcodec/lgif/fx_gif.cpp @@ -18,7 +18,7 @@ uint32_t CGifLZWDecoder::GetAvailInput() { return avail_in; } -CGifLZWDecoder::CGifLZWDecoder(FX_CHAR* error_ptr) +CGifLZWDecoder::CGifLZWDecoder(char* error_ptr) : code_size(0), code_size_cur(0), code_clear(0), @@ -506,12 +506,12 @@ void gif_destroy_compress(gif_compress_struct_pp gif_ptr_ptr) { FX_Free(gif_ptr->pte_ptr); FX_Free(gif_ptr); } -void gif_error(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg) { +void gif_error(gif_decompress_struct_p gif_ptr, const char* err_msg) { if (gif_ptr && gif_ptr->gif_error_fn) { gif_ptr->gif_error_fn(gif_ptr, err_msg); } } -void gif_warn(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg) {} +void gif_warn(gif_decompress_struct_p gif_ptr, const char* err_msg) {} int32_t gif_read_header(gif_decompress_struct_p gif_ptr) { if (!gif_ptr) return 0; @@ -680,7 +680,7 @@ int32_t gif_decode_extension(gif_decompress_struct_p gif_ptr) { return 2; } *(gif_ptr->cmt_data_ptr) += - CFX_ByteString((const FX_CHAR*)data_ptr, data_size); + CFX_ByteString((const char*)data_ptr, data_size); } } break; case GIF_D_STATUS_EXT_PTE: { @@ -731,7 +731,7 @@ int32_t gif_decode_extension(gif_decompress_struct_p gif_ptr) { return 2; } *(gif_pt_ptr->string_ptr) += - CFX_ByteString((const FX_CHAR*)data_ptr, data_size); + CFX_ByteString((const char*)data_ptr, data_size); } gif_ptr->pt_ptr_arr_ptr->push_back(gif_pt_ptr); } break; diff --git a/core/fxcodec/lgif/fx_gif.h b/core/fxcodec/lgif/fx_gif.h index a8b780b099..5027c447d5 100644 --- a/core/fxcodec/lgif/fx_gif.h +++ b/core/fxcodec/lgif/fx_gif.h @@ -122,7 +122,7 @@ class CGifLZWDecoder { uint8_t suffix; }; - explicit CGifLZWDecoder(FX_CHAR* error_ptr); + explicit CGifLZWDecoder(char* error_ptr); ~CGifLZWDecoder(); void InitTable(uint8_t code_len); @@ -152,7 +152,7 @@ class CGifLZWDecoder { uint8_t bits_left; uint32_t code_store; - FX_CHAR* err_msg_ptr; + char* err_msg_ptr; }; class CGifLZWEncoder { @@ -208,8 +208,8 @@ typedef gif_decompress_struct_p* gif_decompress_struct_pp; static const int32_t s_gif_interlace_step[4] = {8, 8, 4, 2}; struct tag_gif_decompress_struct { jmp_buf jmpbuf; - FX_CHAR* err_ptr; - void (*gif_error_fn)(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg); + char* err_ptr; + void (*gif_error_fn)(gif_decompress_struct_p gif_ptr, const char* err_msg); void* context_ptr; int width; int height; @@ -280,8 +280,8 @@ struct tag_gif_compress_struct { uint32_t pte_data_len; }; -void gif_error(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg); -void gif_warn(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg); +void gif_error(gif_decompress_struct_p gif_ptr, const char* err_msg); +void gif_warn(gif_decompress_struct_p gif_ptr, const char* err_msg); gif_decompress_struct_p gif_create_decompress(); void gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr); gif_compress_struct_p gif_create_compress(); diff --git a/core/fxcrt/cfx_string_c_template.h b/core/fxcrt/cfx_string_c_template.h index 3bfcc915fb..3e3972ca92 100644 --- a/core/fxcrt/cfx_string_c_template.h +++ b/core/fxcrt/cfx_string_c_template.h @@ -164,7 +164,7 @@ inline bool operator!=(const T* lhs, const CFX_StringCTemplate<T>& rhs) { return rhs != lhs; } -extern template class CFX_StringCTemplate<FX_CHAR>; -extern template class CFX_StringCTemplate<FX_WCHAR>; +extern template class CFX_StringCTemplate<char>; +extern template class CFX_StringCTemplate<wchar_t>; #endif // CORE_FXCRT_CFX_STRING_C_TEMPLATE_H_ diff --git a/core/fxcrt/cfx_string_data_template.h b/core/fxcrt/cfx_string_data_template.h index c3e090fef0..2e87a811a5 100644 --- a/core/fxcrt/cfx_string_data_template.h +++ b/core/fxcrt/cfx_string_data_template.h @@ -110,7 +110,7 @@ class CFX_StringDataTemplate { ~CFX_StringDataTemplate() = delete; }; -extern template class CFX_StringDataTemplate<FX_CHAR>; -extern template class CFX_StringDataTemplate<FX_WCHAR>; +extern template class CFX_StringDataTemplate<char>; +extern template class CFX_StringDataTemplate<wchar_t>; #endif // CORE_FXCRT_CFX_STRING_DATA_TEMPLATE_H_ diff --git a/core/fxcrt/fx_arabic.cpp b/core/fxcrt/fx_arabic.cpp index 11743e41ad..103271cd02 100644 --- a/core/fxcrt/fx_arabic.cpp +++ b/core/fxcrt/fx_arabic.cpp @@ -236,7 +236,7 @@ const int32_t gc_FX_BidiAddLevel[][4] = { }; const FX_ARBFORMTABLE* ParseChar(const CFX_Char* pTC, - FX_WCHAR& wChar, + wchar_t& wChar, FX_CHARTYPE& eType) { if (!pTC) { eType = FX_CHARTYPE_Unknown; @@ -244,7 +244,7 @@ const FX_ARBFORMTABLE* ParseChar(const CFX_Char* pTC, return nullptr; } eType = pTC->GetCharType(); - wChar = (FX_WCHAR)pTC->m_wCharCode; + wChar = (wchar_t)pTC->m_wCharCode; const FX_ARBFORMTABLE* pFT = FX_GetArabicFormTable(wChar); if (!pFT || eType >= FX_CHARTYPE_ArabicNormal) eType = FX_CHARTYPE_Unknown; @@ -254,13 +254,13 @@ const FX_ARBFORMTABLE* ParseChar(const CFX_Char* pTC, } // namespace -const FX_ARBFORMTABLE* FX_GetArabicFormTable(FX_WCHAR unicode) { +const FX_ARBFORMTABLE* FX_GetArabicFormTable(wchar_t unicode) { if (unicode < 0x622 || unicode > 0x6d5) { return nullptr; } return g_FX_ArabicFormTables + unicode - 0x622; } -FX_WCHAR FX_GetArabicFromAlefTable(FX_WCHAR alef) { +wchar_t FX_GetArabicFromAlefTable(wchar_t alef) { static const int32_t s_iAlefCount = sizeof(gs_FX_AlefTable) / sizeof(FX_ARAALEF); for (int32_t iStart = 0; iStart < s_iAlefCount; iStart++) { @@ -271,7 +271,7 @@ FX_WCHAR FX_GetArabicFromAlefTable(FX_WCHAR alef) { } return alef; } -FX_WCHAR FX_GetArabicFromShaddaTable(FX_WCHAR shadda) { +wchar_t FX_GetArabicFromShaddaTable(wchar_t shadda) { static const int32_t s_iShaddaCount = sizeof(gs_FX_ShaddaTable) / sizeof(FX_ARASHADDA); for (int32_t iStart = 0; iStart < s_iShaddaCount; iStart++) { @@ -286,30 +286,30 @@ FX_WCHAR FX_GetArabicFromShaddaTable(FX_WCHAR shadda) { namespace pdfium { namespace arabic { -FX_WCHAR GetFormChar(FX_WCHAR wch, FX_WCHAR prev, FX_WCHAR next) { +wchar_t GetFormChar(wchar_t wch, wchar_t prev, wchar_t next) { CFX_Char c(wch, kTextLayoutCodeProperties[(uint16_t)wch]); CFX_Char p(prev, kTextLayoutCodeProperties[(uint16_t)prev]); CFX_Char n(next, kTextLayoutCodeProperties[(uint16_t)next]); return GetFormChar(&c, &p, &n); } -FX_WCHAR GetFormChar(const CFX_Char* cur, - const CFX_Char* prev, - const CFX_Char* next) { +wchar_t GetFormChar(const CFX_Char* cur, + const CFX_Char* prev, + const CFX_Char* next) { FX_CHARTYPE eCur; - FX_WCHAR wCur; + wchar_t wCur; const FX_ARBFORMTABLE* ft = ParseChar(cur, wCur, eCur); if (eCur < FX_CHARTYPE_ArabicAlef || eCur >= FX_CHARTYPE_ArabicNormal) { return wCur; } FX_CHARTYPE ePrev; - FX_WCHAR wPrev; + wchar_t wPrev; ParseChar(prev, wPrev, ePrev); if (wPrev == 0x0644 && eCur == FX_CHARTYPE_ArabicAlef) { return 0xFEFF; } FX_CHARTYPE eNext; - FX_WCHAR wNext; + wchar_t wNext; ParseChar(next, wNext, eNext); bool bAlef = (eNext == FX_CHARTYPE_ArabicAlef && wCur == 0x644); if (ePrev < FX_CHARTYPE_ArabicAlef) { @@ -336,10 +336,10 @@ void FX_BidiReverseString(CFX_WideString& wsText, int32_t iCount) { ASSERT(iStart > -1 && iStart < wsText.GetLength()); ASSERT(iCount >= 0 && iStart + iCount <= wsText.GetLength()); - FX_WCHAR wch; - FX_WCHAR* pStart = const_cast<FX_WCHAR*>(wsText.c_str()); + wchar_t wch; + wchar_t* pStart = const_cast<wchar_t*>(wsText.c_str()); pStart += iStart; - FX_WCHAR* pEnd = pStart + iCount - 1; + wchar_t* pEnd = pStart + iCount - 1; while (pStart < pEnd) { wch = *pStart; *pStart++ = *pEnd; diff --git a/core/fxcrt/fx_arabic.h b/core/fxcrt/fx_arabic.h index 1856f106c2..8adb419f01 100644 --- a/core/fxcrt/fx_arabic.h +++ b/core/fxcrt/fx_arabic.h @@ -20,10 +20,10 @@ namespace pdfium { namespace arabic { -FX_WCHAR GetFormChar(FX_WCHAR wch, FX_WCHAR prev, FX_WCHAR next); -FX_WCHAR GetFormChar(const CFX_Char* cur, - const CFX_Char* prev, - const CFX_Char* next); +wchar_t GetFormChar(wchar_t wch, wchar_t prev, wchar_t next); +wchar_t GetFormChar(const CFX_Char* cur, + const CFX_Char* prev, + const CFX_Char* next); } // namespace arabic } // namespace pdfium @@ -160,9 +160,9 @@ struct FX_ARASHADDA { uint16_t wIsolated; }; -const FX_ARBFORMTABLE* FX_GetArabicFormTable(FX_WCHAR unicode); -FX_WCHAR FX_GetArabicFromAlefTable(FX_WCHAR alef); -FX_WCHAR FX_GetArabicFromShaddaTable(FX_WCHAR shadda); +const FX_ARBFORMTABLE* FX_GetArabicFormTable(wchar_t unicode); +wchar_t FX_GetArabicFromAlefTable(wchar_t alef); +wchar_t FX_GetArabicFromShaddaTable(wchar_t shadda); void FX_BidiLine(std::vector<CFX_Char>& chars, int32_t iCount, diff --git a/core/fxcrt/fx_basic.h b/core/fxcrt/fx_basic.h index 18413b2e70..007c362ad6 100644 --- a/core/fxcrt/fx_basic.h +++ b/core/fxcrt/fx_basic.h @@ -70,7 +70,7 @@ class CFX_ByteTextBuf : public CFX_BinaryBuf { CFX_ByteTextBuf& operator<<(int i); CFX_ByteTextBuf& operator<<(uint32_t i); CFX_ByteTextBuf& operator<<(double f); - CFX_ByteTextBuf& operator<<(const FX_CHAR* pStr) { + CFX_ByteTextBuf& operator<<(const char* pStr) { return *this << CFX_ByteStringC(pStr); } CFX_ByteTextBuf& operator<<(const CFX_ByteString& str) { @@ -82,29 +82,29 @@ class CFX_ByteTextBuf : public CFX_BinaryBuf { class CFX_WideTextBuf : public CFX_BinaryBuf { public: - void AppendChar(FX_WCHAR wch); - FX_STRSIZE GetLength() const { return m_DataSize / sizeof(FX_WCHAR); } - FX_WCHAR* GetBuffer() const { - return reinterpret_cast<FX_WCHAR*>(m_pBuffer.get()); + void AppendChar(wchar_t wch); + FX_STRSIZE GetLength() const { return m_DataSize / sizeof(wchar_t); } + wchar_t* GetBuffer() const { + return reinterpret_cast<wchar_t*>(m_pBuffer.get()); } CFX_WideStringC AsStringC() const { - return CFX_WideStringC(reinterpret_cast<const FX_WCHAR*>(m_pBuffer.get()), - m_DataSize / sizeof(FX_WCHAR)); + return CFX_WideStringC(reinterpret_cast<const wchar_t*>(m_pBuffer.get()), + m_DataSize / sizeof(wchar_t)); } CFX_WideString MakeString() const { - return CFX_WideString(reinterpret_cast<const FX_WCHAR*>(m_pBuffer.get()), - m_DataSize / sizeof(FX_WCHAR)); + return CFX_WideString(reinterpret_cast<const wchar_t*>(m_pBuffer.get()), + m_DataSize / sizeof(wchar_t)); } void Delete(int start_index, int count) { - CFX_BinaryBuf::Delete(start_index * sizeof(FX_WCHAR), - count * sizeof(FX_WCHAR)); + CFX_BinaryBuf::Delete(start_index * sizeof(wchar_t), + count * sizeof(wchar_t)); } CFX_WideTextBuf& operator<<(int i); CFX_WideTextBuf& operator<<(double f); - CFX_WideTextBuf& operator<<(const FX_WCHAR* lpsz); + CFX_WideTextBuf& operator<<(const wchar_t* lpsz); CFX_WideTextBuf& operator<<(const CFX_WideStringC& str); CFX_WideTextBuf& operator<<(const CFX_WideString& str); CFX_WideTextBuf& operator<<(const CFX_WideTextBuf& buf); @@ -168,7 +168,7 @@ class CFX_UTF8Encoder { public: CFX_UTF8Encoder() {} - void Input(FX_WCHAR unicode); + void Input(wchar_t unicode); void AppendStr(const CFX_ByteStringC& str) { m_Buffer << str; } CFX_ByteStringC GetResult() const { return m_Buffer.AsStringC(); } diff --git a/core/fxcrt/fx_basic_bstring.cpp b/core/fxcrt/fx_basic_bstring.cpp index 2669474f00..cbd8b379b9 100644 --- a/core/fxcrt/fx_basic_bstring.cpp +++ b/core/fxcrt/fx_basic_bstring.cpp @@ -13,8 +13,8 @@ #include "core/fxcrt/fx_basic.h" #include "third_party/base/numerics/safe_math.h" -template class CFX_StringDataTemplate<FX_CHAR>; -template class CFX_StringCTemplate<FX_CHAR>; +template class CFX_StringDataTemplate<char>; +template class CFX_StringCTemplate<char>; template class CFX_StringPoolTemplate<CFX_ByteString>; template struct std::hash<CFX_ByteString>; @@ -32,7 +32,7 @@ int Buffer_itoa(char* buf, int i, uint32_t flags) { u = -i; } int base = 10; - const FX_CHAR* str = "0123456789abcdef"; + const char* str = "0123456789abcdef"; if (flags & FXFORMAT_HEX) { base = 16; if (flags & FXFORMAT_CAPITAL) { @@ -53,14 +53,14 @@ int Buffer_itoa(char* buf, int i, uint32_t flags) { return len; } -const FX_CHAR* FX_strstr(const FX_CHAR* haystack, - int haystack_len, - const FX_CHAR* needle, - int needle_len) { +const char* FX_strstr(const char* haystack, + int haystack_len, + const char* needle, + int needle_len) { if (needle_len > haystack_len || needle_len == 0) { return nullptr; } - const FX_CHAR* end_ptr = haystack + haystack_len - needle_len; + const char* end_ptr = haystack + haystack_len - needle_len; while (haystack <= end_ptr) { int i = 0; while (1) { @@ -79,10 +79,10 @@ const FX_CHAR* FX_strstr(const FX_CHAR* haystack, } // namespace -static_assert(sizeof(CFX_ByteString) <= sizeof(FX_CHAR*), +static_assert(sizeof(CFX_ByteString) <= sizeof(char*), "Strings must not require more space than pointers"); -CFX_ByteString::CFX_ByteString(const FX_CHAR* pStr, FX_STRSIZE nLen) { +CFX_ByteString::CFX_ByteString(const char* pStr, FX_STRSIZE nLen) { if (nLen < 0) nLen = pStr ? FXSYS_strlen(pStr) : 0; @@ -93,7 +93,7 @@ CFX_ByteString::CFX_ByteString(const FX_CHAR* pStr, FX_STRSIZE nLen) { CFX_ByteString::CFX_ByteString(const uint8_t* pStr, FX_STRSIZE nLen) { if (nLen > 0) { m_pData.Reset( - StringData::Create(reinterpret_cast<const FX_CHAR*>(pStr), nLen)); + StringData::Create(reinterpret_cast<const char*>(pStr), nLen)); } } @@ -111,7 +111,7 @@ CFX_ByteString::CFX_ByteString(char ch) { m_pData->m_String[0] = ch; } -CFX_ByteString::CFX_ByteString(const FX_CHAR* ptr) +CFX_ByteString::CFX_ByteString(const char* ptr) : CFX_ByteString(ptr, ptr ? FXSYS_strlen(ptr) : 0) {} CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& stringSrc) { @@ -132,7 +132,7 @@ CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& str1, CFX_ByteString::~CFX_ByteString() {} -const CFX_ByteString& CFX_ByteString::operator=(const FX_CHAR* pStr) { +const CFX_ByteString& CFX_ByteString::operator=(const char* pStr) { if (!pStr || !pStr[0]) clear(); else @@ -159,7 +159,7 @@ const CFX_ByteString& CFX_ByteString::operator=( return *this; } -const CFX_ByteString& CFX_ByteString::operator+=(const FX_CHAR* pStr) { +const CFX_ByteString& CFX_ByteString::operator+=(const char* pStr) { if (pStr) Concat(pStr, FXSYS_strlen(pStr)); @@ -257,7 +257,7 @@ bool CFX_ByteString::EqualNoCase(const CFX_ByteStringC& str) const { return true; } -void CFX_ByteString::AssignCopy(const FX_CHAR* pSrcData, FX_STRSIZE nSrcLen) { +void CFX_ByteString::AssignCopy(const char* pSrcData, FX_STRSIZE nSrcLen) { AllocBeforeWrite(nSrcLen); m_pData->CopyContents(pSrcData, nSrcLen); m_pData->m_nDataLength = nSrcLen; @@ -324,7 +324,7 @@ void CFX_ByteString::Reserve(FX_STRSIZE len) { GetBuffer(len); } -FX_CHAR* CFX_ByteString::GetBuffer(FX_STRSIZE nMinBufLength) { +char* CFX_ByteString::GetBuffer(FX_STRSIZE nMinBufLength) { if (!m_pData) { if (nMinBufLength == 0) return nullptr; @@ -372,7 +372,7 @@ FX_STRSIZE CFX_ByteString::Delete(FX_STRSIZE nIndex, FX_STRSIZE nCount) { return m_pData->m_nDataLength; } -void CFX_ByteString::Concat(const FX_CHAR* pSrcData, FX_STRSIZE nSrcLen) { +void CFX_ByteString::Concat(const char* pSrcData, FX_STRSIZE nSrcLen) { if (!pSrcData || nSrcLen <= 0) return; @@ -438,7 +438,7 @@ CFX_ByteString CFX_ByteString::FormatInteger(int i, uint32_t flags) { return CFX_ByteString(buf, Buffer_itoa(buf, i, flags)); } -void CFX_ByteString::FormatV(const FX_CHAR* pFormat, va_list argList) { +void CFX_ByteString::FormatV(const char* pFormat, va_list argList) { va_list argListSave; #if defined(__ARMCC_VERSION) || \ (!defined(_MSC_VER) && (_FX_CPU_ == _FX_X64_ || _FX_CPU_ == _FX_IA64_ || \ @@ -449,7 +449,7 @@ void CFX_ByteString::FormatV(const FX_CHAR* pFormat, va_list argList) { argListSave = argList; #endif int nMaxLen = 0; - for (const FX_CHAR* pStr = pFormat; *pStr != 0; pStr++) { + for (const char* pStr = pFormat; *pStr != 0; pStr++) { if (*pStr != '%' || *(pStr = pStr + 1) == '%') { nMaxLen += FXSYS_strlen(pStr); continue; @@ -530,7 +530,7 @@ void CFX_ByteString::FormatV(const FX_CHAR* pFormat, va_list argList) { va_arg(argList, int); break; case 's': { - const FX_CHAR* pstrNextArg = va_arg(argList, const FX_CHAR*); + const char* pstrNextArg = va_arg(argList, const char*); if (pstrNextArg) { nItemLen = FXSYS_strlen(pstrNextArg); if (nItemLen < 1) { @@ -541,7 +541,7 @@ void CFX_ByteString::FormatV(const FX_CHAR* pFormat, va_list argList) { } } break; case 'S': { - FX_WCHAR* pstrNextArg = va_arg(argList, FX_WCHAR*); + wchar_t* pstrNextArg = va_arg(argList, wchar_t*); if (pstrNextArg) { nItemLen = FXSYS_wcslen(pstrNextArg); if (nItemLen < 1) { @@ -553,7 +553,7 @@ void CFX_ByteString::FormatV(const FX_CHAR* pFormat, va_list argList) { } break; case 's' | FORCE_ANSI: case 'S' | FORCE_ANSI: { - const FX_CHAR* pstrNextArg = va_arg(argList, const FX_CHAR*); + const char* pstrNextArg = va_arg(argList, const char*); if (pstrNextArg) { nItemLen = FXSYS_strlen(pstrNextArg); if (nItemLen < 1) { @@ -565,7 +565,7 @@ void CFX_ByteString::FormatV(const FX_CHAR* pFormat, va_list argList) { } break; case 's' | FORCE_UNICODE: case 'S' | FORCE_UNICODE: { - FX_WCHAR* pstrNextArg = va_arg(argList, FX_WCHAR*); + wchar_t* pstrNextArg = va_arg(argList, wchar_t*); if (pstrNextArg) { nItemLen = FXSYS_wcslen(pstrNextArg); if (nItemLen < 1) { @@ -649,14 +649,14 @@ void CFX_ByteString::FormatV(const FX_CHAR* pFormat, va_list argList) { va_end(argListSave); } -void CFX_ByteString::Format(const FX_CHAR* pFormat, ...) { +void CFX_ByteString::Format(const char* pFormat, ...) { va_list argList; va_start(argList, pFormat); FormatV(pFormat, argList); va_end(argList); } -FX_STRSIZE CFX_ByteString::Insert(FX_STRSIZE nIndex, FX_CHAR ch) { +FX_STRSIZE CFX_ByteString::Insert(FX_STRSIZE nIndex, char ch) { FX_STRSIZE nNewLength = m_pData ? m_pData->m_nDataLength : 0; nIndex = std::max(nIndex, 0); nIndex = std::min(nIndex, nNewLength); @@ -696,19 +696,19 @@ CFX_ByteString CFX_ByteString::Left(FX_STRSIZE nCount) const { return dest; } -FX_STRSIZE CFX_ByteString::Find(FX_CHAR ch, FX_STRSIZE nStart) const { +FX_STRSIZE CFX_ByteString::Find(char ch, FX_STRSIZE nStart) const { if (!m_pData) return -1; if (nStart < 0 || nStart >= m_pData->m_nDataLength) return -1; - const FX_CHAR* pStr = static_cast<const FX_CHAR*>( + const char* pStr = static_cast<const char*>( memchr(m_pData->m_String + nStart, ch, m_pData->m_nDataLength - nStart)); return pStr ? pStr - m_pData->m_String : -1; } -FX_STRSIZE CFX_ByteString::ReverseFind(FX_CHAR ch) const { +FX_STRSIZE CFX_ByteString::ReverseFind(char ch) const { if (!m_pData) return -1; @@ -729,7 +729,7 @@ FX_STRSIZE CFX_ByteString::Find(const CFX_ByteStringC& pSub, if (nStart > nLength) return -1; - const FX_CHAR* pStr = + const char* pStr = FX_strstr(m_pData->m_String + nStart, m_pData->m_nDataLength - nStart, pSub.c_str(), pSub.GetLength()); return pStr ? (int)(pStr - m_pData->m_String) : -1; @@ -751,12 +751,12 @@ void CFX_ByteString::MakeUpper() { FXSYS_strupr(m_pData->m_String); } -FX_STRSIZE CFX_ByteString::Remove(FX_CHAR chRemove) { +FX_STRSIZE CFX_ByteString::Remove(char chRemove) { if (!m_pData || m_pData->m_nDataLength < 1) return 0; - FX_CHAR* pstrSource = m_pData->m_String; - FX_CHAR* pstrEnd = m_pData->m_String + m_pData->m_nDataLength; + char* pstrSource = m_pData->m_String; + char* pstrEnd = m_pData->m_String + m_pData->m_nDataLength; while (pstrSource < pstrEnd) { if (*pstrSource == chRemove) break; @@ -770,7 +770,7 @@ FX_STRSIZE CFX_ByteString::Remove(FX_CHAR chRemove) { pstrSource = m_pData->m_String + copied; pstrEnd = m_pData->m_String + m_pData->m_nDataLength; - FX_CHAR* pstrDest = pstrSource; + char* pstrDest = pstrSource; while (pstrSource < pstrEnd) { if (*pstrSource != chRemove) { *pstrDest = *pstrSource; @@ -793,11 +793,11 @@ FX_STRSIZE CFX_ByteString::Replace(const CFX_ByteStringC& pOld, FX_STRSIZE nSourceLen = pOld.GetLength(); FX_STRSIZE nReplacementLen = pNew.GetLength(); FX_STRSIZE nCount = 0; - const FX_CHAR* pStart = m_pData->m_String; - FX_CHAR* pEnd = m_pData->m_String + m_pData->m_nDataLength; + const char* pStart = m_pData->m_String; + char* pEnd = m_pData->m_String + m_pData->m_nDataLength; while (1) { - const FX_CHAR* pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart), - pOld.c_str(), nSourceLen); + const char* pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart), + pOld.c_str(), nSourceLen); if (!pTarget) break; @@ -817,10 +817,10 @@ FX_STRSIZE CFX_ByteString::Replace(const CFX_ByteStringC& pOld, CFX_RetainPtr<StringData> pNewData(StringData::Create(nNewLength)); pStart = m_pData->m_String; - FX_CHAR* pDest = pNewData->m_String; + char* pDest = pNewData->m_String; for (FX_STRSIZE i = 0; i < nCount; i++) { - const FX_CHAR* pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart), - pOld.c_str(), nSourceLen); + const char* pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart), + pOld.c_str(), nSourceLen); FXSYS_memcpy(pDest, pStart, pTarget - pStart); pDest += pTarget - pStart; FXSYS_memcpy(pDest, pNew.c_str(), pNew.GetLength()); @@ -832,7 +832,7 @@ FX_STRSIZE CFX_ByteString::Replace(const CFX_ByteStringC& pOld, return nCount; } -void CFX_ByteString::SetAt(FX_STRSIZE nIndex, FX_CHAR ch) { +void CFX_ByteString::SetAt(FX_STRSIZE nIndex, char ch) { if (!m_pData) { return; } @@ -851,8 +851,7 @@ CFX_WideString CFX_ByteString::UTF8Decode() const { } // static -CFX_ByteString CFX_ByteString::FromUnicode(const FX_WCHAR* str, - FX_STRSIZE len) { +CFX_ByteString CFX_ByteString::FromUnicode(const wchar_t* str, FX_STRSIZE len) { FX_STRSIZE str_len = len >= 0 ? len : FXSYS_wcslen(str); return FromUnicode(CFX_WideString(str, str_len)); } @@ -912,7 +911,7 @@ void CFX_ByteString::TrimRight(const CFX_ByteStringC& pTargets) { } } -void CFX_ByteString::TrimRight(FX_CHAR chTarget) { +void CFX_ByteString::TrimRight(char chTarget) { TrimRight(CFX_ByteStringC(chTarget)); } @@ -943,12 +942,12 @@ void CFX_ByteString::TrimLeft(const CFX_ByteStringC& pTargets) { ReallocBeforeWrite(len); FX_STRSIZE nDataLength = len - pos; FXSYS_memmove(m_pData->m_String, m_pData->m_String + pos, - (nDataLength + 1) * sizeof(FX_CHAR)); + (nDataLength + 1) * sizeof(char)); m_pData->m_nDataLength = nDataLength; } } -void CFX_ByteString::TrimLeft(FX_CHAR chTarget) { +void CFX_ByteString::TrimLeft(char chTarget) { TrimLeft(CFX_ByteStringC(chTarget)); } @@ -959,7 +958,7 @@ void CFX_ByteString::TrimLeft() { uint32_t CFX_ByteString::GetID(FX_STRSIZE start_pos) const { return AsStringC().GetID(start_pos); } -FX_STRSIZE FX_ftoa(FX_FLOAT d, FX_CHAR* buf) { +FX_STRSIZE FX_ftoa(FX_FLOAT d, char* buf) { buf[0] = '0'; buf[1] = '\0'; if (d == 0.0f) { @@ -1006,7 +1005,7 @@ FX_STRSIZE FX_ftoa(FX_FLOAT d, FX_CHAR* buf) { return buf_size; } CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { - FX_CHAR buf[32]; + char buf[32]; FX_STRSIZE len = FX_ftoa(d, buf); return CFX_ByteString(buf, len); } diff --git a/core/fxcrt/fx_basic_bstring_unittest.cpp b/core/fxcrt/fx_basic_bstring_unittest.cpp index 503e68458a..a58169d039 100644 --- a/core/fxcrt/fx_basic_bstring_unittest.cpp +++ b/core/fxcrt/fx_basic_bstring_unittest.cpp @@ -278,7 +278,7 @@ TEST(fxcrt, ByteStringCNull) { EXPECT_EQ(null_string, assigned_null_string); CFX_ByteStringC assigned_nullptr_string("initially not nullptr"); - assigned_nullptr_string = (const FX_CHAR*)nullptr; + assigned_nullptr_string = (const char*)nullptr; EXPECT_FALSE(assigned_nullptr_string.raw_str()); EXPECT_EQ(assigned_nullptr_string.GetLength(), 0); EXPECT_TRUE(assigned_nullptr_string.IsEmpty()); @@ -335,7 +335,7 @@ TEST(fxcrt, ByteStringRemove) { TEST(fxcrt, ByteStringRemoveCopies) { CFX_ByteString freed("FREED"); - const FX_CHAR* old_buffer = freed.c_str(); + const char* old_buffer = freed.c_str(); // No change with single reference - no copy. freed.Remove('Q'); @@ -538,7 +538,7 @@ TEST(fxcrt, ByteStringTrimRightCopies) { { // With a single reference, no copy takes place. CFX_ByteString fred(" FRED "); - const FX_CHAR* old_buffer = fred.c_str(); + const char* old_buffer = fred.c_str(); fred.TrimRight(); EXPECT_EQ(" FRED", fred); EXPECT_EQ(old_buffer, fred.c_str()); @@ -547,7 +547,7 @@ TEST(fxcrt, ByteStringTrimRightCopies) { // With multiple references, we must copy. CFX_ByteString fred(" FRED "); CFX_ByteString other_fred = fred; - const FX_CHAR* old_buffer = fred.c_str(); + const char* old_buffer = fred.c_str(); fred.TrimRight(); EXPECT_EQ(" FRED", fred); EXPECT_EQ(" FRED ", other_fred); @@ -557,7 +557,7 @@ TEST(fxcrt, ByteStringTrimRightCopies) { // With multiple references, but no modifications, no copy. CFX_ByteString fred("FRED"); CFX_ByteString other_fred = fred; - const FX_CHAR* old_buffer = fred.c_str(); + const char* old_buffer = fred.c_str(); fred.TrimRight(); EXPECT_EQ("FRED", fred); EXPECT_EQ("FRED", other_fred); @@ -597,7 +597,7 @@ TEST(fxcrt, ByteStringTrimLeftCopies) { { // With a single reference, no copy takes place. CFX_ByteString fred(" FRED "); - const FX_CHAR* old_buffer = fred.c_str(); + const char* old_buffer = fred.c_str(); fred.TrimLeft(); EXPECT_EQ("FRED ", fred); EXPECT_EQ(old_buffer, fred.c_str()); @@ -606,7 +606,7 @@ TEST(fxcrt, ByteStringTrimLeftCopies) { // With multiple references, we must copy. CFX_ByteString fred(" FRED "); CFX_ByteString other_fred = fred; - const FX_CHAR* old_buffer = fred.c_str(); + const char* old_buffer = fred.c_str(); fred.TrimLeft(); EXPECT_EQ("FRED ", fred); EXPECT_EQ(" FRED ", other_fred); @@ -616,7 +616,7 @@ TEST(fxcrt, ByteStringTrimLeftCopies) { // With multiple references, but no modifications, no copy. CFX_ByteString fred("FRED"); CFX_ByteString other_fred = fred; - const FX_CHAR* old_buffer = fred.c_str(); + const char* old_buffer = fred.c_str(); fred.TrimLeft(); EXPECT_EQ("FRED", fred); EXPECT_EQ("FRED", other_fred); @@ -628,7 +628,7 @@ TEST(fxcrt, ByteStringReserve) { { CFX_ByteString str; str.Reserve(6); - const FX_CHAR* old_buffer = str.c_str(); + const char* old_buffer = str.c_str(); str += "ABCDEF"; EXPECT_EQ(old_buffer, str.c_str()); str += "Blah Blah Blah Blah Blah Blah"; @@ -637,7 +637,7 @@ TEST(fxcrt, ByteStringReserve) { { CFX_ByteString str("A"); str.Reserve(6); - const FX_CHAR* old_buffer = str.c_str(); + const char* old_buffer = str.c_str(); str += "BCDEF"; EXPECT_EQ(old_buffer, str.c_str()); str += "Blah Blah Blah Blah Blah Blah"; @@ -648,7 +648,7 @@ TEST(fxcrt, ByteStringReserve) { TEST(fxcrt, ByteStringGetBuffer) { { CFX_ByteString str; - FX_CHAR* buffer = str.GetBuffer(12); + char* buffer = str.GetBuffer(12); // NOLINTNEXTLINE(runtime/printf) strcpy(buffer, "clams"); str.ReleaseBuffer(); @@ -656,7 +656,7 @@ TEST(fxcrt, ByteStringGetBuffer) { } { CFX_ByteString str("cl"); - FX_CHAR* buffer = str.GetBuffer(12); + char* buffer = str.GetBuffer(12); // NOLINTNEXTLINE(runtime/printf) strcpy(buffer + 2, "ams"); str.ReleaseBuffer(); @@ -669,7 +669,7 @@ TEST(fxcrt, ByteStringReleaseBuffer) { CFX_ByteString str; str.Reserve(12); str += "clams"; - const FX_CHAR* old_buffer = str.c_str(); + const char* old_buffer = str.c_str(); str.ReleaseBuffer(4); EXPECT_EQ(old_buffer, str.c_str()); EXPECT_EQ("clam", str); @@ -678,7 +678,7 @@ TEST(fxcrt, ByteStringReleaseBuffer) { CFX_ByteString str("c"); str.Reserve(12); str += "lams"; - const FX_CHAR* old_buffer = str.c_str(); + const char* old_buffer = str.c_str(); str.ReleaseBuffer(4); EXPECT_EQ(old_buffer, str.c_str()); EXPECT_EQ("clam", str); @@ -687,7 +687,7 @@ TEST(fxcrt, ByteStringReleaseBuffer) { CFX_ByteString str; str.Reserve(200); str += "clams"; - const FX_CHAR* old_buffer = str.c_str(); + const char* old_buffer = str.c_str(); str.ReleaseBuffer(4); EXPECT_NE(old_buffer, str.c_str()); EXPECT_EQ("clam", str); @@ -696,7 +696,7 @@ TEST(fxcrt, ByteStringReleaseBuffer) { CFX_ByteString str("c"); str.Reserve(200); str += "lams"; - const FX_CHAR* old_buffer = str.c_str(); + const char* old_buffer = str.c_str(); str.ReleaseBuffer(4); EXPECT_NE(old_buffer, str.c_str()); EXPECT_EQ("clam", str); @@ -1097,6 +1097,6 @@ TEST(fxcrt, EmptyByteString) { CFX_ByteString empty_str; EXPECT_TRUE(empty_str.IsEmpty()); EXPECT_EQ(0, empty_str.GetLength()); - const FX_CHAR* cstr = empty_str.c_str(); + const char* cstr = empty_str.c_str(); EXPECT_EQ(0, FXSYS_strlen(cstr)); } diff --git a/core/fxcrt/fx_basic_buffer.cpp b/core/fxcrt/fx_basic_buffer.cpp index 14a85c2ee5..eaa79c9af1 100644 --- a/core/fxcrt/fx_basic_buffer.cpp +++ b/core/fxcrt/fx_basic_buffer.cpp @@ -127,19 +127,19 @@ CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(const CFX_ByteTextBuf& buf) { return *this; } -void CFX_WideTextBuf::AppendChar(FX_WCHAR ch) { - ExpandBuf(sizeof(FX_WCHAR)); - *(FX_WCHAR*)(m_pBuffer.get() + m_DataSize) = ch; - m_DataSize += sizeof(FX_WCHAR); +void CFX_WideTextBuf::AppendChar(wchar_t ch) { + ExpandBuf(sizeof(wchar_t)); + *(wchar_t*)(m_pBuffer.get() + m_DataSize) = ch; + m_DataSize += sizeof(wchar_t); } CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const CFX_WideStringC& str) { - AppendBlock(str.c_str(), str.GetLength() * sizeof(FX_WCHAR)); + AppendBlock(str.c_str(), str.GetLength() * sizeof(wchar_t)); return *this; } CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const CFX_WideString& str) { - AppendBlock(str.c_str(), str.GetLength() * sizeof(FX_WCHAR)); + AppendBlock(str.c_str(), str.GetLength() * sizeof(wchar_t)); return *this; } @@ -147,29 +147,29 @@ CFX_WideTextBuf& CFX_WideTextBuf::operator<<(int i) { char buf[32]; FXSYS_itoa(i, buf, 10); FX_STRSIZE len = FXSYS_strlen(buf); - ExpandBuf(len * sizeof(FX_WCHAR)); - FX_WCHAR* str = (FX_WCHAR*)(m_pBuffer.get() + m_DataSize); + ExpandBuf(len * sizeof(wchar_t)); + wchar_t* str = (wchar_t*)(m_pBuffer.get() + m_DataSize); for (FX_STRSIZE j = 0; j < len; j++) { *str++ = buf[j]; } - m_DataSize += len * sizeof(FX_WCHAR); + m_DataSize += len * sizeof(wchar_t); return *this; } CFX_WideTextBuf& CFX_WideTextBuf::operator<<(double f) { char buf[32]; FX_STRSIZE len = FX_ftoa((FX_FLOAT)f, buf); - ExpandBuf(len * sizeof(FX_WCHAR)); - FX_WCHAR* str = (FX_WCHAR*)(m_pBuffer.get() + m_DataSize); + ExpandBuf(len * sizeof(wchar_t)); + wchar_t* str = (wchar_t*)(m_pBuffer.get() + m_DataSize); for (FX_STRSIZE i = 0; i < len; i++) { *str++ = buf[i]; } - m_DataSize += len * sizeof(FX_WCHAR); + m_DataSize += len * sizeof(wchar_t); return *this; } -CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const FX_WCHAR* lpsz) { - AppendBlock(lpsz, FXSYS_wcslen(lpsz) * sizeof(FX_WCHAR)); +CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const wchar_t* lpsz) { + AppendBlock(lpsz, FXSYS_wcslen(lpsz) * sizeof(wchar_t)); return *this; } diff --git a/core/fxcrt/fx_basic_gcc.cpp b/core/fxcrt/fx_basic_gcc.cpp index 42fb2a17f7..4960dc8432 100644 --- a/core/fxcrt/fx_basic_gcc.cpp +++ b/core/fxcrt/fx_basic_gcc.cpp @@ -82,23 +82,23 @@ STR_T FXSYS_IntToStr(T value, STR_T str, int radix) { #ifdef __cplusplus extern "C" { #endif -int32_t FXSYS_atoi(const FX_CHAR* str) { - return FXSYS_StrToInt<int32_t, FX_CHAR>(str); +int32_t FXSYS_atoi(const char* str) { + return FXSYS_StrToInt<int32_t, char>(str); } -uint32_t FXSYS_atoui(const FX_CHAR* str) { +uint32_t FXSYS_atoui(const char* str) { return FXSYS_StrToInt<uint32_t>(str); } -int32_t FXSYS_wtoi(const FX_WCHAR* str) { - return FXSYS_StrToInt<int32_t, FX_WCHAR>(str); +int32_t FXSYS_wtoi(const wchar_t* str) { + return FXSYS_StrToInt<int32_t, wchar_t>(str); } -int64_t FXSYS_atoi64(const FX_CHAR* str) { - return FXSYS_StrToInt<int64_t, FX_CHAR>(str); +int64_t FXSYS_atoi64(const char* str) { + return FXSYS_StrToInt<int64_t, char>(str); } -int64_t FXSYS_wtoi64(const FX_WCHAR* str) { - return FXSYS_StrToInt<int64_t, FX_WCHAR>(str); +int64_t FXSYS_wtoi64(const wchar_t* str) { + return FXSYS_StrToInt<int64_t, wchar_t>(str); } -const FX_CHAR* FXSYS_i64toa(int64_t value, FX_CHAR* str, int radix) { - return FXSYS_IntToStr<int64_t, uint64_t, FX_CHAR*>(value, str, radix); +const char* FXSYS_i64toa(int64_t value, char* str, int radix) { + return FXSYS_IntToStr<int64_t, uint64_t, char*>(value, str, radix); } #ifdef __cplusplus } @@ -110,10 +110,10 @@ extern "C" { int FXSYS_GetACP() { return 0; } -uint32_t FXSYS_GetFullPathName(const FX_CHAR* filename, +uint32_t FXSYS_GetFullPathName(const char* filename, uint32_t buflen, - FX_CHAR* buf, - FX_CHAR** filepart) { + char* buf, + char** filepart) { int srclen = FXSYS_strlen(filename); if (!buf || (int)buflen < srclen + 1) { return srclen + 1; @@ -132,7 +132,7 @@ uint32_t FXSYS_GetModuleFileName(void* hModule, char* buf, uint32_t bufsize) { #ifdef __cplusplus extern "C" { #endif -FXSYS_FILE* FXSYS_wfopen(const FX_WCHAR* filename, const FX_WCHAR* mode) { +FXSYS_FILE* FXSYS_wfopen(const wchar_t* filename, const wchar_t* mode) { return FXSYS_fopen(CFX_ByteString::FromUnicode(filename).c_str(), CFX_ByteString::FromUnicode(mode).c_str()); } @@ -158,22 +158,22 @@ char* FXSYS_strupr(char* str) { } return s; } -FX_WCHAR* FXSYS_wcslwr(FX_WCHAR* str) { +wchar_t* FXSYS_wcslwr(wchar_t* str) { if (!str) { return nullptr; } - FX_WCHAR* s = str; + wchar_t* s = str; while (*str) { *str = FXSYS_tolower(*str); str++; } return s; } -FX_WCHAR* FXSYS_wcsupr(FX_WCHAR* str) { +wchar_t* FXSYS_wcsupr(wchar_t* str) { if (!str) { return nullptr; } - FX_WCHAR* s = str; + wchar_t* s = str; while (*str) { *str = FXSYS_toupper(*str); str++; @@ -192,20 +192,20 @@ int FXSYS_stricmp(const char* dst, const char* src) { } while (f && (f == l)); return (f - l); } -int FXSYS_wcsicmp(const FX_WCHAR* dst, const FX_WCHAR* src) { - FX_WCHAR f, l; +int FXSYS_wcsicmp(const wchar_t* dst, const wchar_t* src) { + wchar_t f, l; do { - if (((f = (FX_WCHAR)(*(dst++))) >= 'A') && (f <= 'Z')) { + if (((f = (wchar_t)(*(dst++))) >= 'A') && (f <= 'Z')) { f -= ('A' - 'a'); } - if (((l = (FX_WCHAR)(*(src++))) >= 'A') && (l <= 'Z')) { + if (((l = (wchar_t)(*(src++))) >= 'A') && (l <= 'Z')) { l -= ('A' - 'a'); } } while (f && (f == l)); return (f - l); } char* FXSYS_itoa(int value, char* str, int radix) { - return FXSYS_IntToStr<int32_t, uint32_t, FX_CHAR*>(value, str, radix); + return FXSYS_IntToStr<int32_t, uint32_t, char*>(value, str, radix); } #ifdef __cplusplus } @@ -217,17 +217,17 @@ extern "C" { #endif int FXSYS_WideCharToMultiByte(uint32_t codepage, uint32_t dwFlags, - const FX_WCHAR* wstr, + const wchar_t* wstr, int wlen, - FX_CHAR* buf, + char* buf, int buflen, - const FX_CHAR* default_str, + const char* default_str, int* pUseDefault) { int len = 0; for (int i = 0; i < wlen; i++) { if (wstr[i] < 0x100) { if (buf && len < buflen) - buf[len] = static_cast<FX_CHAR>(wstr[i]); + buf[len] = static_cast<char>(wstr[i]); len++; } } @@ -235,9 +235,9 @@ int FXSYS_WideCharToMultiByte(uint32_t codepage, } int FXSYS_MultiByteToWideChar(uint32_t codepage, uint32_t dwFlags, - const FX_CHAR* bstr, + const char* bstr, int blen, - FX_WCHAR* buf, + wchar_t* buf, int buflen) { int wlen = 0; for (int i = 0; i < blen; i++) { diff --git a/core/fxcrt/fx_basic_utf.cpp b/core/fxcrt/fx_basic_utf.cpp index c0f14c8178..10aa918962 100644 --- a/core/fxcrt/fx_basic_utf.cpp +++ b/core/fxcrt/fx_basic_utf.cpp @@ -11,7 +11,7 @@ void CFX_UTF8Decoder::Clear() { m_PendingBytes = 0; } void CFX_UTF8Decoder::AppendChar(uint32_t ch) { - m_Buffer.AppendChar((FX_WCHAR)ch); + m_Buffer.AppendChar((wchar_t)ch); } void CFX_UTF8Decoder::Input(uint8_t byte) { if (byte < 0x80) { @@ -43,7 +43,7 @@ void CFX_UTF8Decoder::Input(uint8_t byte) { m_PendingChar = (byte & 0x01) << 30; } } -void CFX_UTF8Encoder::Input(FX_WCHAR unicode) { +void CFX_UTF8Encoder::Input(wchar_t unicode) { if ((uint32_t)unicode < 0x80) { m_Buffer.AppendChar(unicode); } else { @@ -76,7 +76,7 @@ void CFX_UTF8Encoder::Input(FX_WCHAR unicode) { CFX_ByteString FX_UTF8Encode(const CFX_WideStringC& wsStr) { FX_STRSIZE len = wsStr.GetLength(); - const FX_WCHAR* pStr = wsStr.c_str(); + const wchar_t* pStr = wsStr.c_str(); CFX_UTF8Encoder encoder; while (len-- > 0) encoder.Input(*pStr++); diff --git a/core/fxcrt/fx_basic_util.cpp b/core/fxcrt/fx_basic_util.cpp index f608e290a2..45543dc317 100644 --- a/core/fxcrt/fx_basic_util.cpp +++ b/core/fxcrt/fx_basic_util.cpp @@ -140,7 +140,7 @@ void FXSYS_vsnprintf(char* str, size_t size, const char* fmt, va_list ap) { } #endif // _FXM_PLATFORM_WINDOWS_ && _MSC_VER < 1900 -FX_FileHandle* FX_OpenFolder(const FX_CHAR* path) { +FX_FileHandle* FX_OpenFolder(const char* path) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ std::unique_ptr<CFindFileDataA> pData(new CFindFileDataA); pData->m_Handle = FindFirstFileExA((CFX_ByteString(path) + "/*.*").c_str(), @@ -197,7 +197,7 @@ void FX_CloseFolder(FX_FileHandle* handle) { #endif } -FX_WCHAR FX_GetFolderSeparator() { +wchar_t FX_GetFolderSeparator() { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ return '\\'; #else diff --git a/core/fxcrt/fx_basic_wstring.cpp b/core/fxcrt/fx_basic_wstring.cpp index 93b9ba7c25..3b9fa2435c 100644 --- a/core/fxcrt/fx_basic_wstring.cpp +++ b/core/fxcrt/fx_basic_wstring.cpp @@ -14,8 +14,8 @@ #include "core/fxcrt/fx_ext.h" #include "third_party/base/numerics/safe_math.h" -template class CFX_StringDataTemplate<FX_WCHAR>; -template class CFX_StringCTemplate<FX_WCHAR>; +template class CFX_StringDataTemplate<wchar_t>; +template class CFX_StringCTemplate<wchar_t>; template class CFX_StringPoolTemplate<CFX_WideString>; template struct std::hash<CFX_WideString>; @@ -37,14 +37,14 @@ bool IsValidCodePage(uint16_t codepage) { } #endif -const FX_WCHAR* FX_wcsstr(const FX_WCHAR* haystack, - int haystack_len, - const FX_WCHAR* needle, - int needle_len) { +const wchar_t* FX_wcsstr(const wchar_t* haystack, + int haystack_len, + const wchar_t* needle, + int needle_len) { if (needle_len > haystack_len || needle_len == 0) { return nullptr; } - const FX_WCHAR* end_ptr = haystack + haystack_len - needle_len; + const wchar_t* end_ptr = haystack + haystack_len - needle_len; while (haystack <= end_ptr) { int i = 0; while (1) { @@ -63,7 +63,7 @@ const FX_WCHAR* FX_wcsstr(const FX_WCHAR* haystack, } // namespace -static_assert(sizeof(CFX_WideString) <= sizeof(FX_WCHAR*), +static_assert(sizeof(CFX_WideString) <= sizeof(wchar_t*), "Strings must not require more space than pointers"); CFX_WideString::CFX_WideString() {} @@ -75,7 +75,7 @@ CFX_WideString::CFX_WideString(CFX_WideString&& other) { m_pData.Swap(other.m_pData); } -CFX_WideString::CFX_WideString(const FX_WCHAR* pStr, FX_STRSIZE nLen) { +CFX_WideString::CFX_WideString(const wchar_t* pStr, FX_STRSIZE nLen) { if (nLen < 0) nLen = pStr ? FXSYS_wcslen(pStr) : 0; @@ -83,12 +83,12 @@ CFX_WideString::CFX_WideString(const FX_WCHAR* pStr, FX_STRSIZE nLen) { m_pData.Reset(StringData::Create(pStr, nLen)); } -CFX_WideString::CFX_WideString(FX_WCHAR ch) { +CFX_WideString::CFX_WideString(wchar_t ch) { m_pData.Reset(StringData::Create(1)); m_pData->m_String[0] = ch; } -CFX_WideString::CFX_WideString(const FX_WCHAR* ptr) +CFX_WideString::CFX_WideString(const wchar_t* ptr) : CFX_WideString(ptr, ptr ? FXSYS_wcslen(ptr) : 0) {} CFX_WideString::CFX_WideString(const CFX_WideStringC& stringSrc) { @@ -110,7 +110,7 @@ CFX_WideString::CFX_WideString(const CFX_WideStringC& str1, CFX_WideString::~CFX_WideString() {} -const CFX_WideString& CFX_WideString::operator=(const FX_WCHAR* pStr) { +const CFX_WideString& CFX_WideString::operator=(const wchar_t* pStr) { if (!pStr || !pStr[0]) clear(); else @@ -137,14 +137,14 @@ const CFX_WideString& CFX_WideString::operator=( return *this; } -const CFX_WideString& CFX_WideString::operator+=(const FX_WCHAR* pStr) { +const CFX_WideString& CFX_WideString::operator+=(const wchar_t* pStr) { if (pStr) Concat(pStr, FXSYS_wcslen(pStr)); return *this; } -const CFX_WideString& CFX_WideString::operator+=(FX_WCHAR ch) { +const CFX_WideString& CFX_WideString::operator+=(wchar_t ch) { Concat(&ch, 1); return *this; } @@ -206,7 +206,7 @@ bool CFX_WideString::operator<(const CFX_WideString& str) const { return result < 0 || (result == 0 && GetLength() < str.GetLength()); } -void CFX_WideString::AssignCopy(const FX_WCHAR* pSrcData, FX_STRSIZE nSrcLen) { +void CFX_WideString::AssignCopy(const wchar_t* pSrcData, FX_STRSIZE nSrcLen) { AllocBeforeWrite(nSrcLen); m_pData->CopyContents(pSrcData, nSrcLen); m_pData->m_nDataLength = nSrcLen; @@ -273,7 +273,7 @@ void CFX_WideString::Reserve(FX_STRSIZE len) { GetBuffer(len); } -FX_WCHAR* CFX_WideString::GetBuffer(FX_STRSIZE nMinBufLength) { +wchar_t* CFX_WideString::GetBuffer(FX_STRSIZE nMinBufLength) { if (!m_pData) { if (nMinBufLength == 0) return nullptr; @@ -321,7 +321,7 @@ FX_STRSIZE CFX_WideString::Delete(FX_STRSIZE nIndex, FX_STRSIZE nCount) { return m_pData->m_nDataLength; } -void CFX_WideString::Concat(const FX_WCHAR* pSrcData, FX_STRSIZE nSrcLen) { +void CFX_WideString::Concat(const wchar_t* pSrcData, FX_STRSIZE nSrcLen) { if (!pSrcData || nSrcLen <= 0) return; @@ -353,7 +353,7 @@ CFX_ByteString CFX_WideString::UTF16LE_Encode() const { } int len = m_pData->m_nDataLength; CFX_ByteString result; - FX_CHAR* buffer = result.GetBuffer(len * 2 + 2); + char* buffer = result.GetBuffer(len * 2 + 2); for (int i = 0; i < len; i++) { buffer[i * 2] = m_pData->m_String[i] & 0xff; buffer[i * 2 + 1] = m_pData->m_String[i] >> 8; @@ -403,7 +403,7 @@ void CFX_WideString::AllocCopy(CFX_WideString& dest, #define FORCE_UNICODE 0x20000 #define FORCE_INT64 0x40000 -void CFX_WideString::FormatV(const FX_WCHAR* pFormat, va_list argList) { +void CFX_WideString::FormatV(const wchar_t* pFormat, va_list argList) { va_list argListSave; #if defined(__ARMCC_VERSION) || \ (!defined(_MSC_VER) && (_FX_CPU_ == _FX_X64_ || _FX_CPU_ == _FX_IA64_ || \ @@ -414,7 +414,7 @@ void CFX_WideString::FormatV(const FX_WCHAR* pFormat, va_list argList) { argListSave = argList; #endif int nMaxLen = 0; - for (const FX_WCHAR* pStr = pFormat; *pStr != 0; pStr++) { + for (const wchar_t* pStr = pFormat; *pStr != 0; pStr++) { if (*pStr != '%' || *(pStr = pStr + 1) == '%') { nMaxLen += FXSYS_wcslen(pStr); continue; @@ -495,7 +495,7 @@ void CFX_WideString::FormatV(const FX_WCHAR* pFormat, va_list argList) { va_arg(argList, int); break; case 's': { - const FX_WCHAR* pstrNextArg = va_arg(argList, const FX_WCHAR*); + const wchar_t* pstrNextArg = va_arg(argList, const wchar_t*); if (pstrNextArg) { nItemLen = FXSYS_wcslen(pstrNextArg); if (nItemLen < 1) { @@ -506,7 +506,7 @@ void CFX_WideString::FormatV(const FX_WCHAR* pFormat, va_list argList) { } } break; case 'S': { - const FX_CHAR* pstrNextArg = va_arg(argList, const FX_CHAR*); + const char* pstrNextArg = va_arg(argList, const char*); if (pstrNextArg) { nItemLen = FXSYS_strlen(pstrNextArg); if (nItemLen < 1) { @@ -518,7 +518,7 @@ void CFX_WideString::FormatV(const FX_WCHAR* pFormat, va_list argList) { } break; case 's' | FORCE_ANSI: case 'S' | FORCE_ANSI: { - const FX_CHAR* pstrNextArg = va_arg(argList, const FX_CHAR*); + const char* pstrNextArg = va_arg(argList, const char*); if (pstrNextArg) { nItemLen = FXSYS_strlen(pstrNextArg); if (nItemLen < 1) { @@ -530,7 +530,7 @@ void CFX_WideString::FormatV(const FX_WCHAR* pFormat, va_list argList) { } break; case 's' | FORCE_UNICODE: case 'S' | FORCE_UNICODE: { - const FX_WCHAR* pstrNextArg = va_arg(argList, FX_WCHAR*); + const wchar_t* pstrNextArg = va_arg(argList, wchar_t*); if (pstrNextArg) { nItemLen = FXSYS_wcslen(pstrNextArg); if (nItemLen < 1) { @@ -613,14 +613,14 @@ void CFX_WideString::FormatV(const FX_WCHAR* pFormat, va_list argList) { va_end(argListSave); } -void CFX_WideString::Format(const FX_WCHAR* pFormat, ...) { +void CFX_WideString::Format(const wchar_t* pFormat, ...) { va_list argList; va_start(argList, pFormat); FormatV(pFormat, argList); va_end(argList); } -FX_STRSIZE CFX_WideString::Insert(FX_STRSIZE nIndex, FX_WCHAR ch) { +FX_STRSIZE CFX_WideString::Insert(FX_STRSIZE nIndex, wchar_t ch) { FX_STRSIZE nNewLength = m_pData ? m_pData->m_nDataLength : 0; nIndex = std::max(nIndex, 0); nIndex = std::min(nIndex, nNewLength); @@ -660,14 +660,14 @@ CFX_WideString CFX_WideString::Left(FX_STRSIZE nCount) const { return dest; } -FX_STRSIZE CFX_WideString::Find(FX_WCHAR ch, FX_STRSIZE nStart) const { +FX_STRSIZE CFX_WideString::Find(wchar_t ch, FX_STRSIZE nStart) const { if (!m_pData) return -1; if (nStart < 0 || nStart >= m_pData->m_nDataLength) return -1; - const FX_WCHAR* pStr = + const wchar_t* pStr = wmemchr(m_pData->m_String + nStart, ch, m_pData->m_nDataLength - nStart); return pStr ? pStr - m_pData->m_String : -1; } @@ -681,7 +681,7 @@ FX_STRSIZE CFX_WideString::Find(const CFX_WideStringC& pSub, if (nStart > nLength) return -1; - const FX_WCHAR* pStr = + const wchar_t* pStr = FX_wcsstr(m_pData->m_String + nStart, m_pData->m_nDataLength - nStart, pSub.c_str(), pSub.GetLength()); return pStr ? (int)(pStr - m_pData->m_String) : -1; @@ -703,12 +703,12 @@ void CFX_WideString::MakeUpper() { FXSYS_wcsupr(m_pData->m_String); } -FX_STRSIZE CFX_WideString::Remove(FX_WCHAR chRemove) { +FX_STRSIZE CFX_WideString::Remove(wchar_t chRemove) { if (!m_pData || m_pData->m_nDataLength < 1) return 0; - FX_WCHAR* pstrSource = m_pData->m_String; - FX_WCHAR* pstrEnd = m_pData->m_String + m_pData->m_nDataLength; + wchar_t* pstrSource = m_pData->m_String; + wchar_t* pstrEnd = m_pData->m_String + m_pData->m_nDataLength; while (pstrSource < pstrEnd) { if (*pstrSource == chRemove) break; @@ -722,7 +722,7 @@ FX_STRSIZE CFX_WideString::Remove(FX_WCHAR chRemove) { pstrSource = m_pData->m_String + copied; pstrEnd = m_pData->m_String + m_pData->m_nDataLength; - FX_WCHAR* pstrDest = pstrSource; + wchar_t* pstrDest = pstrSource; while (pstrSource < pstrEnd) { if (*pstrSource != chRemove) { *pstrDest = *pstrSource; @@ -745,11 +745,11 @@ FX_STRSIZE CFX_WideString::Replace(const CFX_WideStringC& pOld, FX_STRSIZE nSourceLen = pOld.GetLength(); FX_STRSIZE nReplacementLen = pNew.GetLength(); FX_STRSIZE nCount = 0; - const FX_WCHAR* pStart = m_pData->m_String; - FX_WCHAR* pEnd = m_pData->m_String + m_pData->m_nDataLength; + const wchar_t* pStart = m_pData->m_String; + wchar_t* pEnd = m_pData->m_String + m_pData->m_nDataLength; while (1) { - const FX_WCHAR* pTarget = FX_wcsstr(pStart, (FX_STRSIZE)(pEnd - pStart), - pOld.c_str(), nSourceLen); + const wchar_t* pTarget = FX_wcsstr(pStart, (FX_STRSIZE)(pEnd - pStart), + pOld.c_str(), nSourceLen); if (!pTarget) break; @@ -769,10 +769,10 @@ FX_STRSIZE CFX_WideString::Replace(const CFX_WideStringC& pOld, CFX_RetainPtr<StringData> pNewData(StringData::Create(nNewLength)); pStart = m_pData->m_String; - FX_WCHAR* pDest = pNewData->m_String; + wchar_t* pDest = pNewData->m_String; for (FX_STRSIZE i = 0; i < nCount; i++) { - const FX_WCHAR* pTarget = FX_wcsstr(pStart, (FX_STRSIZE)(pEnd - pStart), - pOld.c_str(), nSourceLen); + const wchar_t* pTarget = FX_wcsstr(pStart, (FX_STRSIZE)(pEnd - pStart), + pOld.c_str(), nSourceLen); wmemcpy(pDest, pStart, pTarget - pStart); pDest += pTarget - pStart; wmemcpy(pDest, pNew.c_str(), pNew.GetLength()); @@ -784,7 +784,7 @@ FX_STRSIZE CFX_WideString::Replace(const CFX_WideStringC& pOld, return nCount; } -void CFX_WideString::SetAt(FX_STRSIZE nIndex, FX_WCHAR ch) { +void CFX_WideString::SetAt(FX_STRSIZE nIndex, wchar_t ch) { if (!m_pData) { return; } @@ -825,7 +825,7 @@ CFX_WideString CFX_WideString::FromUTF16LE(const unsigned short* wstr, } CFX_WideString result; - FX_WCHAR* buf = result.GetBuffer(wlen); + wchar_t* buf = result.GetBuffer(wlen); for (int i = 0; i < wlen; i++) { buf[i] = wstr[i]; } @@ -833,7 +833,7 @@ CFX_WideString CFX_WideString::FromUTF16LE(const unsigned short* wstr, return result; } -int CFX_WideString::Compare(const FX_WCHAR* lpsz) const { +int CFX_WideString::Compare(const wchar_t* lpsz) const { if (m_pData) return FXSYS_wcscmp(m_pData->m_String, lpsz); return (!lpsz || lpsz[0] == 0) ? 0 : -1; @@ -869,7 +869,7 @@ int CFX_WideString::Compare(const CFX_WideString& str) const { return 0; } -int CFX_WideString::CompareNoCase(const FX_WCHAR* lpsz) const { +int CFX_WideString::CompareNoCase(const wchar_t* lpsz) const { if (!m_pData) { return (!lpsz || lpsz[0] == 0) ? 0 : -1; } @@ -899,8 +899,8 @@ void CFX_WideString::TrimRight(const CFX_WideStringC& pTargets) { } } -void CFX_WideString::TrimRight(FX_WCHAR chTarget) { - FX_WCHAR str[2] = {chTarget, 0}; +void CFX_WideString::TrimRight(wchar_t chTarget) { + wchar_t str[2] = {chTarget, 0}; TrimRight(str); } @@ -932,20 +932,20 @@ void CFX_WideString::TrimLeft(const CFX_WideStringC& pTargets) { ReallocBeforeWrite(len); FX_STRSIZE nDataLength = len - pos; FXSYS_memmove(m_pData->m_String, m_pData->m_String + pos, - (nDataLength + 1) * sizeof(FX_WCHAR)); + (nDataLength + 1) * sizeof(wchar_t)); m_pData->m_nDataLength = nDataLength; } } -void CFX_WideString::TrimLeft(FX_WCHAR chTarget) { - FX_WCHAR str[2] = {chTarget, 0}; +void CFX_WideString::TrimLeft(wchar_t chTarget) { + wchar_t str[2] = {chTarget, 0}; TrimLeft(str); } void CFX_WideString::TrimLeft() { TrimLeft(L"\x09\x0a\x0b\x0c\x0d\x20"); } -FX_FLOAT FX_wtof(const FX_WCHAR* str, int len) { +FX_FLOAT FX_wtof(const wchar_t* str, int len) { if (len == 0) { return 0.0; } @@ -996,7 +996,7 @@ CFX_ByteString CFX_CharMap::GetByteString(uint16_t codepage, nullptr, 0, nullptr, nullptr); CFX_ByteString bstr; if (dest_len) { - FX_CHAR* dest_buf = bstr.GetBuffer(dest_len); + char* dest_buf = bstr.GetBuffer(dest_len); FXSYS_WideCharToMultiByte(codepage, 0, wstr.c_str(), src_len, dest_buf, dest_len, nullptr, nullptr); bstr.ReleaseBuffer(dest_len); @@ -1013,7 +1013,7 @@ CFX_WideString CFX_CharMap::GetWideString(uint16_t codepage, FXSYS_MultiByteToWideChar(codepage, 0, bstr.c_str(), src_len, nullptr, 0); CFX_WideString wstr; if (dest_len) { - FX_WCHAR* dest_buf = wstr.GetBuffer(dest_len); + wchar_t* dest_buf = wstr.GetBuffer(dest_len); FXSYS_MultiByteToWideChar(codepage, 0, bstr.c_str(), src_len, dest_buf, dest_len); wstr.ReleaseBuffer(dest_len); diff --git a/core/fxcrt/fx_basic_wstring_unittest.cpp b/core/fxcrt/fx_basic_wstring_unittest.cpp index 07b5aaf13c..ceb4616b8a 100644 --- a/core/fxcrt/fx_basic_wstring_unittest.cpp +++ b/core/fxcrt/fx_basic_wstring_unittest.cpp @@ -296,7 +296,7 @@ TEST(fxcrt, WideStringRemove) { TEST(fxcrt, WideStringRemoveCopies) { CFX_WideString freed(L"FREED"); - const FX_WCHAR* old_buffer = freed.c_str(); + const wchar_t* old_buffer = freed.c_str(); // No change with single reference - no copy. freed.Remove(L'Q'); @@ -505,7 +505,7 @@ TEST(fxcrt, WideStringTrimRightCopies) { { // With a single reference, no copy takes place. CFX_WideString fred(L" FRED "); - const FX_WCHAR* old_buffer = fred.c_str(); + const wchar_t* old_buffer = fred.c_str(); fred.TrimRight(); EXPECT_EQ(L" FRED", fred); EXPECT_EQ(old_buffer, fred.c_str()); @@ -514,7 +514,7 @@ TEST(fxcrt, WideStringTrimRightCopies) { // With multiple references, we must copy. CFX_WideString fred(L" FRED "); CFX_WideString other_fred = fred; - const FX_WCHAR* old_buffer = fred.c_str(); + const wchar_t* old_buffer = fred.c_str(); fred.TrimRight(); EXPECT_EQ(L" FRED", fred); EXPECT_EQ(L" FRED ", other_fred); @@ -524,7 +524,7 @@ TEST(fxcrt, WideStringTrimRightCopies) { // With multiple references, but no modifications, no copy. CFX_WideString fred(L"FRED"); CFX_WideString other_fred = fred; - const FX_WCHAR* old_buffer = fred.c_str(); + const wchar_t* old_buffer = fred.c_str(); fred.TrimRight(); EXPECT_EQ(L"FRED", fred); EXPECT_EQ(L"FRED", other_fred); @@ -564,7 +564,7 @@ TEST(fxcrt, WideStringTrimLeftCopies) { { // With a single reference, no copy takes place. CFX_WideString fred(L" FRED "); - const FX_WCHAR* old_buffer = fred.c_str(); + const wchar_t* old_buffer = fred.c_str(); fred.TrimLeft(); EXPECT_EQ(L"FRED ", fred); EXPECT_EQ(old_buffer, fred.c_str()); @@ -573,7 +573,7 @@ TEST(fxcrt, WideStringTrimLeftCopies) { // With multiple references, we must copy. CFX_WideString fred(L" FRED "); CFX_WideString other_fred = fred; - const FX_WCHAR* old_buffer = fred.c_str(); + const wchar_t* old_buffer = fred.c_str(); fred.TrimLeft(); EXPECT_EQ(L"FRED ", fred); EXPECT_EQ(L" FRED ", other_fred); @@ -583,7 +583,7 @@ TEST(fxcrt, WideStringTrimLeftCopies) { // With multiple references, but no modifications, no copy. CFX_WideString fred(L"FRED"); CFX_WideString other_fred = fred; - const FX_WCHAR* old_buffer = fred.c_str(); + const wchar_t* old_buffer = fred.c_str(); fred.TrimLeft(); EXPECT_EQ(L"FRED", fred); EXPECT_EQ(L"FRED", other_fred); @@ -595,7 +595,7 @@ TEST(fxcrt, WideStringReserve) { { CFX_WideString str; str.Reserve(6); - const FX_WCHAR* old_buffer = str.c_str(); + const wchar_t* old_buffer = str.c_str(); str += L"ABCDEF"; EXPECT_EQ(old_buffer, str.c_str()); str += L"Blah Blah Blah Blah Blah Blah"; @@ -604,7 +604,7 @@ TEST(fxcrt, WideStringReserve) { { CFX_WideString str(L"A"); str.Reserve(6); - const FX_WCHAR* old_buffer = str.c_str(); + const wchar_t* old_buffer = str.c_str(); str += L"BCDEF"; EXPECT_EQ(old_buffer, str.c_str()); str += L"Blah Blah Blah Blah Blah Blah"; @@ -615,14 +615,14 @@ TEST(fxcrt, WideStringReserve) { TEST(fxcrt, WideStringGetBuffer) { { CFX_WideString str; - FX_WCHAR* buffer = str.GetBuffer(12); + wchar_t* buffer = str.GetBuffer(12); wcscpy(buffer, L"clams"); str.ReleaseBuffer(); EXPECT_EQ(L"clams", str); } { CFX_WideString str(L"cl"); - FX_WCHAR* buffer = str.GetBuffer(12); + wchar_t* buffer = str.GetBuffer(12); wcscpy(buffer + 2, L"ams"); str.ReleaseBuffer(); EXPECT_EQ(L"clams", str); @@ -634,7 +634,7 @@ TEST(fxcrt, WideStringReleaseBuffer) { CFX_WideString str; str.Reserve(12); str += L"clams"; - const FX_WCHAR* old_buffer = str.c_str(); + const wchar_t* old_buffer = str.c_str(); str.ReleaseBuffer(4); EXPECT_EQ(old_buffer, str.c_str()); EXPECT_EQ(L"clam", str); @@ -643,7 +643,7 @@ TEST(fxcrt, WideStringReleaseBuffer) { CFX_WideString str(L"c"); str.Reserve(12); str += L"lams"; - const FX_WCHAR* old_buffer = str.c_str(); + const wchar_t* old_buffer = str.c_str(); str.ReleaseBuffer(4); EXPECT_EQ(old_buffer, str.c_str()); EXPECT_EQ(L"clam", str); @@ -652,7 +652,7 @@ TEST(fxcrt, WideStringReleaseBuffer) { CFX_WideString str; str.Reserve(200); str += L"clams"; - const FX_WCHAR* old_buffer = str.c_str(); + const wchar_t* old_buffer = str.c_str(); str.ReleaseBuffer(4); EXPECT_NE(old_buffer, str.c_str()); EXPECT_EQ(L"clam", str); @@ -661,7 +661,7 @@ TEST(fxcrt, WideStringReleaseBuffer) { CFX_WideString str(L"c"); str.Reserve(200); str += L"lams"; - const FX_WCHAR* old_buffer = str.c_str(); + const wchar_t* old_buffer = str.c_str(); str.ReleaseBuffer(4); EXPECT_NE(old_buffer, str.c_str()); EXPECT_EQ(L"clam", str); @@ -936,6 +936,6 @@ TEST(fxcrt, EmptyWideString) { CFX_WideString empty_str; EXPECT_TRUE(empty_str.IsEmpty()); EXPECT_EQ(0, empty_str.GetLength()); - const FX_WCHAR* cstr = empty_str.c_str(); + const wchar_t* cstr = empty_str.c_str(); EXPECT_EQ(0, FXSYS_wcslen(cstr)); } diff --git a/core/fxcrt/fx_bidi.cpp b/core/fxcrt/fx_bidi.cpp index e82b3e7284..5ad6439e07 100644 --- a/core/fxcrt/fx_bidi.cpp +++ b/core/fxcrt/fx_bidi.cpp @@ -12,7 +12,7 @@ CFX_BidiChar::CFX_BidiChar() : m_CurrentSegment({0, 0, NEUTRAL}), m_LastSegment({0, 0, NEUTRAL}) {} -bool CFX_BidiChar::AppendChar(FX_WCHAR wch) { +bool CFX_BidiChar::AppendChar(wchar_t wch) { uint32_t dwProps = FX_GetUnicodeProperties(wch); int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; Direction direction = NEUTRAL; diff --git a/core/fxcrt/fx_bidi.h b/core/fxcrt/fx_bidi.h index 8d12cc8997..d5e0bd3f62 100644 --- a/core/fxcrt/fx_bidi.h +++ b/core/fxcrt/fx_bidi.h @@ -28,7 +28,7 @@ class CFX_BidiChar { // Append a character and classify it as left, right, or neutral. // Returns true if the character has a different direction than the // existing direction to indicate there is a segment to process. - bool AppendChar(FX_WCHAR wch); + bool AppendChar(wchar_t wch); // Call this after the last character has been appended. AppendChar() // must not be called after this. @@ -61,7 +61,7 @@ class CFX_BidiString { // Force the overall direction to be R2L regardless of what was detected. void SetOverallDirectionRight(); - FX_WCHAR CharAt(size_t x) const { return m_Str[x]; } + wchar_t CharAt(size_t x) const { return m_Str[x]; } const_iterator begin() const { return m_Order.begin(); } const_iterator end() const { return m_Order.end(); } diff --git a/core/fxcrt/fx_bidi_unittest.cpp b/core/fxcrt/fx_bidi_unittest.cpp index 2c1996be46..ad598a6741 100644 --- a/core/fxcrt/fx_bidi_unittest.cpp +++ b/core/fxcrt/fx_bidi_unittest.cpp @@ -7,9 +7,9 @@ namespace { -const FX_WCHAR kNeutralChar = 32; -const FX_WCHAR kLeftChar = 65; -const FX_WCHAR kRightChar = 1424; +const wchar_t kNeutralChar = 32; +const wchar_t kLeftChar = 65; +const wchar_t kRightChar = 1424; } // namespace @@ -126,7 +126,7 @@ TEST(fxcrt, BidiStringEmpty) { TEST(fxcrt, BidiStringAllNeutral) { { - const FX_WCHAR str[] = {kNeutralChar, 0}; + const wchar_t str[] = {kNeutralChar, 0}; CFX_BidiString bidi(str); EXPECT_EQ(CFX_BidiChar::LEFT, bidi.OverallDirection()); @@ -139,7 +139,7 @@ TEST(fxcrt, BidiStringAllNeutral) { EXPECT_TRUE(it == bidi.end()); } { - const FX_WCHAR str[] = {kNeutralChar, kNeutralChar, kNeutralChar, 0}; + const wchar_t str[] = {kNeutralChar, kNeutralChar, kNeutralChar, 0}; CFX_BidiString bidi(str); EXPECT_EQ(CFX_BidiChar::LEFT, bidi.OverallDirection()); @@ -155,7 +155,7 @@ TEST(fxcrt, BidiStringAllNeutral) { TEST(fxcrt, BidiStringAllLeft) { { - const FX_WCHAR str[] = {kLeftChar, 0}; + const wchar_t str[] = {kLeftChar, 0}; CFX_BidiString bidi(str); EXPECT_EQ(CFX_BidiChar::LEFT, bidi.OverallDirection()); @@ -176,7 +176,7 @@ TEST(fxcrt, BidiStringAllLeft) { EXPECT_TRUE(it == bidi.end()); } { - const FX_WCHAR str[] = {kLeftChar, kLeftChar, kLeftChar, 0}; + const wchar_t str[] = {kLeftChar, kLeftChar, kLeftChar, 0}; CFX_BidiString bidi(str); EXPECT_EQ(CFX_BidiChar::LEFT, bidi.OverallDirection()); @@ -200,7 +200,7 @@ TEST(fxcrt, BidiStringAllLeft) { TEST(fxcrt, BidiStringAllRight) { { - const FX_WCHAR str[] = {kRightChar, 0}; + const wchar_t str[] = {kRightChar, 0}; CFX_BidiString bidi(str); EXPECT_EQ(CFX_BidiChar::RIGHT, bidi.OverallDirection()); @@ -221,7 +221,7 @@ TEST(fxcrt, BidiStringAllRight) { EXPECT_TRUE(it == bidi.end()); } { - const FX_WCHAR str[] = {kRightChar, kRightChar, kRightChar, 0}; + const wchar_t str[] = {kRightChar, kRightChar, kRightChar, 0}; CFX_BidiString bidi(str); EXPECT_EQ(CFX_BidiChar::RIGHT, bidi.OverallDirection()); @@ -244,7 +244,7 @@ TEST(fxcrt, BidiStringAllRight) { } TEST(fxcrt, BidiStringLeftNeutralLeftRight) { - const FX_WCHAR str[] = {kLeftChar, kNeutralChar, kLeftChar, kRightChar, 0}; + const wchar_t str[] = {kLeftChar, kNeutralChar, kLeftChar, kRightChar, 0}; CFX_BidiString bidi(str); EXPECT_EQ(CFX_BidiChar::LEFT, bidi.OverallDirection()); @@ -284,7 +284,7 @@ TEST(fxcrt, BidiStringLeftNeutralLeftRight) { } TEST(fxcrt, BidiStringRightNeutralLeftRight) { - const FX_WCHAR str[] = {kRightChar, kNeutralChar, kLeftChar, kRightChar, 0}; + const wchar_t str[] = {kRightChar, kNeutralChar, kLeftChar, kRightChar, 0}; CFX_BidiString bidi(str); EXPECT_EQ(CFX_BidiChar::RIGHT, bidi.OverallDirection()); @@ -324,7 +324,7 @@ TEST(fxcrt, BidiStringRightNeutralLeftRight) { } TEST(fxcrt, BidiStringReverse) { - const FX_WCHAR str[] = {kLeftChar, kNeutralChar, kRightChar, kLeftChar, 0}; + const wchar_t str[] = {kLeftChar, kNeutralChar, kRightChar, kLeftChar, 0}; CFX_BidiString bidi(str); EXPECT_EQ(CFX_BidiChar::LEFT, bidi.OverallDirection()); bidi.SetOverallDirectionRight(); diff --git a/core/fxcrt/fx_ext.h b/core/fxcrt/fx_ext.h index 9203938c2c..3ee5a4f91f 100644 --- a/core/fxcrt/fx_ext.h +++ b/core/fxcrt/fx_ext.h @@ -17,15 +17,15 @@ FX_FLOAT FXSYS_tan(FX_FLOAT a); FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x); -FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr, +FX_FLOAT FXSYS_strtof(const char* pcsStr, int32_t iLength = -1, int32_t* pUsedLen = nullptr); -FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, +FX_FLOAT FXSYS_wcstof(const wchar_t* pwsStr, int32_t iLength = -1, int32_t* pUsedLen = nullptr); -FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr, const FX_WCHAR* srcStr, size_t count); -int32_t FXSYS_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count); -int32_t FXSYS_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count); +wchar_t* FXSYS_wcsncpy(wchar_t* dstStr, const wchar_t* srcStr, size_t count); +int32_t FXSYS_wcsnicmp(const wchar_t* s1, const wchar_t* s2, size_t count); +int32_t FXSYS_strnicmp(const char* s1, const char* s2, size_t count); inline bool FXSYS_islower(int32_t ch) { return ch >= 'a' && ch <= 'z'; @@ -48,30 +48,30 @@ inline bool FXSYS_iswdigit(wchar_t wch) { inline bool FXSYS_iswalnum(wchar_t wch) { return FXSYS_iswalpha(wch) || FXSYS_iswdigit(wch); } -inline bool FXSYS_iswspace(FX_WCHAR c) { +inline bool FXSYS_iswspace(wchar_t c) { return (c == 0x20) || (c == 0x0d) || (c == 0x0a) || (c == 0x09); } -inline int FXSYS_toHexDigit(const FX_CHAR c) { +inline int FXSYS_toHexDigit(const char c) { if (!std::isxdigit(c)) return 0; char upchar = std::toupper(c); return upchar > '9' ? upchar - 'A' + 10 : upchar - '0'; } -inline bool FXSYS_isDecimalDigit(const FX_CHAR c) { +inline bool FXSYS_isDecimalDigit(const char c) { return !!std::isdigit(c); } -inline bool FXSYS_isDecimalDigit(const FX_WCHAR c) { +inline bool FXSYS_isDecimalDigit(const wchar_t c) { return !!std::iswdigit(c); } -inline int FXSYS_toDecimalDigit(const FX_CHAR c) { +inline int FXSYS_toDecimalDigit(const char c) { return std::isdigit(c) ? c - '0' : 0; } -inline int FXSYS_toDecimalDigit(const FX_WCHAR c) { +inline int FXSYS_toDecimalDigit(const wchar_t c) { return std::iswdigit(c) ? c - L'0' : 0; } diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp index 5b577f745c..0b7197ec7c 100644 --- a/core/fxcrt/fx_extension.cpp +++ b/core/fxcrt/fx_extension.cpp @@ -387,7 +387,7 @@ CFX_RetainPtr<IFX_FileAccess> IFX_FileAccess::CreateDefault( // static CFX_RetainPtr<IFX_SeekableStream> IFX_SeekableStream::CreateFromFilename( - const FX_CHAR* filename, + const char* filename, uint32_t dwModes) { std::unique_ptr<IFXCRT_FileAccess> pFA(IFXCRT_FileAccess::Create()); if (!pFA->Open(filename, dwModes)) @@ -397,7 +397,7 @@ CFX_RetainPtr<IFX_SeekableStream> IFX_SeekableStream::CreateFromFilename( // static CFX_RetainPtr<IFX_SeekableStream> IFX_SeekableStream::CreateFromFilename( - const FX_WCHAR* filename, + const wchar_t* filename, uint32_t dwModes) { std::unique_ptr<IFXCRT_FileAccess> pFA(IFXCRT_FileAccess::Create()); if (!pFA->Open(filename, dwModes)) @@ -407,7 +407,7 @@ CFX_RetainPtr<IFX_SeekableStream> IFX_SeekableStream::CreateFromFilename( // static CFX_RetainPtr<IFX_SeekableReadStream> -IFX_SeekableReadStream::CreateFromFilename(const FX_CHAR* filename) { +IFX_SeekableReadStream::CreateFromFilename(const char* filename) { return IFX_SeekableStream::CreateFromFilename(filename, FX_FILEMODE_ReadOnly); } @@ -429,9 +429,7 @@ FX_FLOAT FXSYS_tan(FX_FLOAT a) { FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x) { return FXSYS_log(x) / FXSYS_log(b); } -FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr, - int32_t iLength, - int32_t* pUsedLen) { +FX_FLOAT FXSYS_strtof(const char* pcsStr, int32_t iLength, int32_t* pUsedLen) { ASSERT(pcsStr); if (iLength < 0) { iLength = (int32_t)FXSYS_strlen(pcsStr); @@ -440,7 +438,7 @@ FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr, CFX_WideString::FromLocal(CFX_ByteStringC(pcsStr, iLength)); return FXSYS_wcstof(ws.c_str(), iLength, pUsedLen); } -FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, +FX_FLOAT FXSYS_wcstof(const wchar_t* pwsStr, int32_t iLength, int32_t* pUsedLen) { ASSERT(pwsStr); @@ -461,7 +459,7 @@ FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, } FX_FLOAT fValue = 0.0f; while (iUsedLen < iLength) { - FX_WCHAR wch = pwsStr[iUsedLen]; + wchar_t wch = pwsStr[iUsedLen]; if (wch >= L'0' && wch <= L'9') { fValue = fValue * 10.0f + (wch - L'0'); } else { @@ -472,7 +470,7 @@ FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, if (iUsedLen < iLength && pwsStr[iUsedLen] == L'.') { FX_FLOAT fPrecise = 0.1f; while (++iUsedLen < iLength) { - FX_WCHAR wch = pwsStr[iUsedLen]; + wchar_t wch = pwsStr[iUsedLen]; if (wch >= L'0' && wch <= L'9') { fValue += (wch - L'0') * fPrecise; fPrecise *= 0.1f; @@ -486,9 +484,7 @@ FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, } return bNegtive ? -fValue : fValue; } -FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr, - const FX_WCHAR* srcStr, - size_t count) { +wchar_t* FXSYS_wcsncpy(wchar_t* dstStr, const wchar_t* srcStr, size_t count) { ASSERT(dstStr && srcStr && count > 0); for (size_t i = 0; i < count; ++i) if ((dstStr[i] = srcStr[i]) == L'\0') { @@ -496,24 +492,24 @@ FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr, } return dstStr; } -int32_t FXSYS_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count) { +int32_t FXSYS_wcsnicmp(const wchar_t* s1, const wchar_t* s2, size_t count) { ASSERT(s1 && s2 && count > 0); - FX_WCHAR wch1 = 0, wch2 = 0; + wchar_t wch1 = 0, wch2 = 0; while (count-- > 0) { - wch1 = (FX_WCHAR)FXSYS_tolower(*s1++); - wch2 = (FX_WCHAR)FXSYS_tolower(*s2++); + wch1 = (wchar_t)FXSYS_tolower(*s1++); + wch2 = (wchar_t)FXSYS_tolower(*s2++); if (wch1 != wch2) { break; } } return wch1 - wch2; } -int32_t FXSYS_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count) { +int32_t FXSYS_strnicmp(const char* s1, const char* s2, size_t count) { ASSERT(s1 && s2 && count > 0); - FX_CHAR ch1 = 0, ch2 = 0; + char ch1 = 0, ch2 = 0; while (count-- > 0) { - ch1 = (FX_CHAR)FXSYS_tolower(*s1++); - ch2 = (FX_CHAR)FXSYS_tolower(*s2++); + ch1 = (char)FXSYS_tolower(*s1++); + ch2 = (char)FXSYS_tolower(*s2++); if (ch1 != ch2) { break; } @@ -652,7 +648,7 @@ void FX_Random_GenerateCrypto(uint32_t* pBuffer, int32_t iCount) { } #ifdef PDF_ENABLE_XFA -static const FX_CHAR gs_FX_pHexChars[] = "0123456789ABCDEF"; +static const char gs_FX_pHexChars[] = "0123456789ABCDEF"; void FX_GUID_CreateV4(FX_GUID* pGUID) { FX_Random_GenerateMT((uint32_t*)pGUID, 4); uint8_t& b = ((uint8_t*)pGUID)[6]; @@ -661,7 +657,7 @@ void FX_GUID_CreateV4(FX_GUID* pGUID) { void FX_GUID_ToString(const FX_GUID* pGUID, CFX_ByteString& bsStr, bool bSeparator) { - FX_CHAR* pBuf = bsStr.GetBuffer(40); + char* pBuf = bsStr.GetBuffer(40); uint8_t b; for (int32_t i = 0; i < 16; i++) { b = ((const uint8_t*)pGUID)[i]; diff --git a/core/fxcrt/fx_stream.h b/core/fxcrt/fx_stream.h index 2f4b5ad280..4a89a3400e 100644 --- a/core/fxcrt/fx_stream.h +++ b/core/fxcrt/fx_stream.h @@ -38,12 +38,12 @@ typedef DIR FX_FileHandle; #define FX_FILESIZE off_t #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_FileHandle* FX_OpenFolder(const FX_CHAR* path); +FX_FileHandle* FX_OpenFolder(const char* path); bool FX_GetNextFile(FX_FileHandle* handle, CFX_ByteString* filename, bool* bFolder); void FX_CloseFolder(FX_FileHandle* handle); -FX_WCHAR FX_GetFolderSeparator(); +wchar_t FX_GetFolderSeparator(); #define FX_FILEMODE_Write 0 #define FX_FILEMODE_ReadOnly 1 @@ -76,7 +76,7 @@ class IFX_SeekableWriteStream : public IFX_WriteStream { class IFX_SeekableReadStream : public IFX_ReadStream { public: static CFX_RetainPtr<IFX_SeekableReadStream> CreateFromFilename( - const FX_CHAR* filename); + const char* filename); // IFX_ReadStream: bool IsEOF() override; @@ -91,11 +91,11 @@ class IFX_SeekableStream : public IFX_SeekableReadStream, public IFX_SeekableWriteStream { public: static CFX_RetainPtr<IFX_SeekableStream> CreateFromFilename( - const FX_CHAR* filename, + const char* filename, uint32_t dwModes); static CFX_RetainPtr<IFX_SeekableStream> CreateFromFilename( - const FX_WCHAR* filename, + const wchar_t* filename, uint32_t dwModes); // IFX_SeekableReadStream: diff --git a/core/fxcrt/fx_string.h b/core/fxcrt/fx_string.h index cd93f27275..01be6a1901 100644 --- a/core/fxcrt/fx_string.h +++ b/core/fxcrt/fx_string.h @@ -21,8 +21,8 @@ class CFX_ByteString; class CFX_WideString; -using CFX_ByteStringC = CFX_StringCTemplate<FX_CHAR>; -using CFX_WideStringC = CFX_StringCTemplate<FX_WCHAR>; +using CFX_ByteStringC = CFX_StringCTemplate<char>; +using CFX_WideStringC = CFX_StringCTemplate<wchar_t>; #define FXBSTR_ID(c1, c2, c3, c4) \ (((uint32_t)c1 << 24) | ((uint32_t)c2 << 16) | ((uint32_t)c3 << 8) | \ @@ -32,7 +32,7 @@ using CFX_WideStringC = CFX_StringCTemplate<FX_WCHAR>; // avoids the cost of std::string's iterator stability guarantees. class CFX_ByteString { public: - using CharType = FX_CHAR; + using CharType = char; CFX_ByteString(); CFX_ByteString(const CFX_ByteString& other); @@ -42,9 +42,9 @@ class CFX_ByteString { // NOLINTNEXTLINE(runtime/explicit) CFX_ByteString(char ch); // NOLINTNEXTLINE(runtime/explicit) - CFX_ByteString(const FX_CHAR* ptr); + CFX_ByteString(const char* ptr); - CFX_ByteString(const FX_CHAR* ptr, FX_STRSIZE len); + CFX_ByteString(const char* ptr, FX_STRSIZE len); CFX_ByteString(const uint8_t* ptr, FX_STRSIZE len); explicit CFX_ByteString(const CFX_ByteStringC& bstrc); @@ -54,12 +54,12 @@ class CFX_ByteString { void clear() { m_pData.Reset(); } - static CFX_ByteString FromUnicode(const FX_WCHAR* ptr, FX_STRSIZE len = -1); + static CFX_ByteString FromUnicode(const wchar_t* ptr, FX_STRSIZE len = -1); static CFX_ByteString FromUnicode(const CFX_WideString& str); // Explicit conversion to C-style string. // Note: Any subsequent modification of |this| will invalidate the result. - const FX_CHAR* c_str() const { return m_pData ? m_pData->m_String : ""; } + const char* c_str() const { return m_pData ? m_pData->m_String : ""; } // Explicit conversion to uint8_t*. // Note: Any subsequent modification of |this| will invalidate the result. @@ -92,12 +92,12 @@ class CFX_ByteString { bool operator<(const CFX_ByteString& str) const; - const CFX_ByteString& operator=(const FX_CHAR* str); + const CFX_ByteString& operator=(const char* str); const CFX_ByteString& operator=(const CFX_ByteStringC& bstrc); const CFX_ByteString& operator=(const CFX_ByteString& stringSrc); - const CFX_ByteString& operator+=(FX_CHAR ch); - const CFX_ByteString& operator+=(const FX_CHAR* str); + const CFX_ByteString& operator+=(char ch); + const CFX_ByteString& operator+=(const char* str); const CFX_ByteString& operator+=(const CFX_ByteString& str); const CFX_ByteString& operator+=(const CFX_ByteStringC& bstrc); @@ -109,15 +109,15 @@ class CFX_ByteString { return m_pData ? m_pData->m_String[nIndex] : 0; } - void SetAt(FX_STRSIZE nIndex, FX_CHAR ch); - FX_STRSIZE Insert(FX_STRSIZE index, FX_CHAR ch); + void SetAt(FX_STRSIZE nIndex, char ch); + FX_STRSIZE Insert(FX_STRSIZE index, char ch); FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1); - void Format(const FX_CHAR* lpszFormat, ...); - void FormatV(const FX_CHAR* lpszFormat, va_list argList); + void Format(const char* lpszFormat, ...); + void FormatV(const char* lpszFormat, va_list argList); void Reserve(FX_STRSIZE len); - FX_CHAR* GetBuffer(FX_STRSIZE len); + char* GetBuffer(FX_STRSIZE len); void ReleaseBuffer(FX_STRSIZE len = -1); CFX_ByteString Mid(FX_STRSIZE first) const; @@ -126,24 +126,24 @@ class CFX_ByteString { CFX_ByteString Right(FX_STRSIZE count) const; FX_STRSIZE Find(const CFX_ByteStringC& lpszSub, FX_STRSIZE start = 0) const; - FX_STRSIZE Find(FX_CHAR ch, FX_STRSIZE start = 0) const; - FX_STRSIZE ReverseFind(FX_CHAR ch) const; + FX_STRSIZE Find(char ch, FX_STRSIZE start = 0) const; + FX_STRSIZE ReverseFind(char ch) const; void MakeLower(); void MakeUpper(); void TrimRight(); - void TrimRight(FX_CHAR chTarget); + void TrimRight(char chTarget); void TrimRight(const CFX_ByteStringC& lpszTargets); void TrimLeft(); - void TrimLeft(FX_CHAR chTarget); + void TrimLeft(char chTarget); void TrimLeft(const CFX_ByteStringC& lpszTargets); FX_STRSIZE Replace(const CFX_ByteStringC& lpszOld, const CFX_ByteStringC& lpszNew); - FX_STRSIZE Remove(FX_CHAR ch); + FX_STRSIZE Remove(char ch); CFX_WideString UTF8Decode() const; @@ -157,15 +157,15 @@ class CFX_ByteString { static CFX_ByteString FormatFloat(FX_FLOAT f, int precision = 0); protected: - using StringData = CFX_StringDataTemplate<FX_CHAR>; + using StringData = CFX_StringDataTemplate<char>; void ReallocBeforeWrite(FX_STRSIZE nNewLen); void AllocBeforeWrite(FX_STRSIZE nNewLen); void AllocCopy(CFX_ByteString& dest, FX_STRSIZE nCopyLen, FX_STRSIZE nCopyIndex) const; - void AssignCopy(const FX_CHAR* pSrcData, FX_STRSIZE nSrcLen); - void Concat(const FX_CHAR* lpszSrcData, FX_STRSIZE nSrcLen); + void AssignCopy(const char* pSrcData, FX_STRSIZE nSrcLen); + void Concat(const char* lpszSrcData, FX_STRSIZE nSrcLen); CFX_RetainPtr<StringData> m_pData; @@ -190,36 +190,32 @@ inline CFX_ByteString operator+(const CFX_ByteStringC& str1, const CFX_ByteStringC& str2) { return CFX_ByteString(str1, str2); } -inline CFX_ByteString operator+(const CFX_ByteStringC& str1, - const FX_CHAR* str2) { +inline CFX_ByteString operator+(const CFX_ByteStringC& str1, const char* str2) { return CFX_ByteString(str1, str2); } -inline CFX_ByteString operator+(const FX_CHAR* str1, - const CFX_ByteStringC& str2) { +inline CFX_ByteString operator+(const char* str1, const CFX_ByteStringC& str2) { return CFX_ByteString(str1, str2); } -inline CFX_ByteString operator+(const CFX_ByteStringC& str1, FX_CHAR ch) { +inline CFX_ByteString operator+(const CFX_ByteStringC& str1, char ch) { return CFX_ByteString(str1, CFX_ByteStringC(ch)); } -inline CFX_ByteString operator+(FX_CHAR ch, const CFX_ByteStringC& str2) { +inline CFX_ByteString operator+(char ch, const CFX_ByteStringC& str2) { return CFX_ByteString(ch, str2); } inline CFX_ByteString operator+(const CFX_ByteString& str1, const CFX_ByteString& str2) { return CFX_ByteString(str1.AsStringC(), str2.AsStringC()); } -inline CFX_ByteString operator+(const CFX_ByteString& str1, FX_CHAR ch) { +inline CFX_ByteString operator+(const CFX_ByteString& str1, char ch) { return CFX_ByteString(str1.AsStringC(), CFX_ByteStringC(ch)); } -inline CFX_ByteString operator+(FX_CHAR ch, const CFX_ByteString& str2) { +inline CFX_ByteString operator+(char ch, const CFX_ByteString& str2) { return CFX_ByteString(ch, str2.AsStringC()); } -inline CFX_ByteString operator+(const CFX_ByteString& str1, - const FX_CHAR* str2) { +inline CFX_ByteString operator+(const CFX_ByteString& str1, const char* str2) { return CFX_ByteString(str1.AsStringC(), str2); } -inline CFX_ByteString operator+(const FX_CHAR* str1, - const CFX_ByteString& str2) { +inline CFX_ByteString operator+(const char* str1, const CFX_ByteString& str2) { return CFX_ByteString(str1, str2.AsStringC()); } inline CFX_ByteString operator+(const CFX_ByteString& str1, @@ -235,7 +231,7 @@ inline CFX_ByteString operator+(const CFX_ByteStringC& str1, // avoids the cost of std::string's iterator stability guarantees. class CFX_WideString { public: - using CharType = FX_WCHAR; + using CharType = wchar_t; CFX_WideString(); CFX_WideString(const CFX_WideString& other); @@ -243,11 +239,11 @@ class CFX_WideString { // Deliberately implicit to avoid calling on every string literal. // NOLINTNEXTLINE(runtime/explicit) - CFX_WideString(FX_WCHAR ch); + CFX_WideString(wchar_t ch); // NOLINTNEXTLINE(runtime/explicit) - CFX_WideString(const FX_WCHAR* ptr); + CFX_WideString(const wchar_t* ptr); - CFX_WideString(const FX_WCHAR* ptr, FX_STRSIZE len); + CFX_WideString(const wchar_t* ptr, FX_STRSIZE len); explicit CFX_WideString(const CFX_WideStringC& str); CFX_WideString(const CFX_WideStringC& str1, const CFX_WideStringC& str2); @@ -265,7 +261,7 @@ class CFX_WideString { // Explicit conversion to C-style wide string. // Note: Any subsequent modification of |this| will invalidate the result. - const FX_WCHAR* c_str() const { return m_pData ? m_pData->m_String : L""; } + const wchar_t* c_str() const { return m_pData ? m_pData->m_String : L""; } // Explicit conversion to CFX_WideStringC. // Note: Any subsequent modification of |this| will invalidate the result. @@ -278,12 +274,12 @@ class CFX_WideString { FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; } bool IsEmpty() const { return !GetLength(); } - const CFX_WideString& operator=(const FX_WCHAR* str); + const CFX_WideString& operator=(const wchar_t* str); const CFX_WideString& operator=(const CFX_WideString& stringSrc); const CFX_WideString& operator=(const CFX_WideStringC& stringSrc); - const CFX_WideString& operator+=(const FX_WCHAR* str); - const CFX_WideString& operator+=(FX_WCHAR ch); + const CFX_WideString& operator+=(const wchar_t* str); + const CFX_WideString& operator+=(wchar_t ch); const CFX_WideString& operator+=(const CFX_WideString& str); const CFX_WideString& operator+=(const CFX_WideStringC& str); @@ -299,67 +295,67 @@ class CFX_WideString { bool operator<(const CFX_WideString& str) const; - FX_WCHAR GetAt(FX_STRSIZE nIndex) const { + wchar_t GetAt(FX_STRSIZE nIndex) const { return m_pData ? m_pData->m_String[nIndex] : 0; } - FX_WCHAR operator[](FX_STRSIZE nIndex) const { + wchar_t operator[](FX_STRSIZE nIndex) const { return m_pData ? m_pData->m_String[nIndex] : 0; } - void SetAt(FX_STRSIZE nIndex, FX_WCHAR ch); + void SetAt(FX_STRSIZE nIndex, wchar_t ch); - int Compare(const FX_WCHAR* str) const; + int Compare(const wchar_t* str) const; int Compare(const CFX_WideString& str) const; - int CompareNoCase(const FX_WCHAR* str) const; + int CompareNoCase(const wchar_t* str) const; CFX_WideString Mid(FX_STRSIZE first) const; CFX_WideString Mid(FX_STRSIZE first, FX_STRSIZE count) const; CFX_WideString Left(FX_STRSIZE count) const; CFX_WideString Right(FX_STRSIZE count) const; - FX_STRSIZE Insert(FX_STRSIZE index, FX_WCHAR ch); + FX_STRSIZE Insert(FX_STRSIZE index, wchar_t ch); FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1); - void Format(const FX_WCHAR* lpszFormat, ...); - void FormatV(const FX_WCHAR* lpszFormat, va_list argList); + void Format(const wchar_t* lpszFormat, ...); + void FormatV(const wchar_t* lpszFormat, va_list argList); void MakeLower(); void MakeUpper(); void TrimRight(); - void TrimRight(FX_WCHAR chTarget); + void TrimRight(wchar_t chTarget); void TrimRight(const CFX_WideStringC& pTargets); void TrimLeft(); - void TrimLeft(FX_WCHAR chTarget); + void TrimLeft(wchar_t chTarget); void TrimLeft(const CFX_WideStringC& pTargets); void Reserve(FX_STRSIZE len); - FX_WCHAR* GetBuffer(FX_STRSIZE len); + wchar_t* GetBuffer(FX_STRSIZE len); void ReleaseBuffer(FX_STRSIZE len = -1); int GetInteger() const; FX_FLOAT GetFloat() const; FX_STRSIZE Find(const CFX_WideStringC& pSub, FX_STRSIZE start = 0) const; - FX_STRSIZE Find(FX_WCHAR ch, FX_STRSIZE start = 0) const; + FX_STRSIZE Find(wchar_t ch, FX_STRSIZE start = 0) const; FX_STRSIZE Replace(const CFX_WideStringC& pOld, const CFX_WideStringC& pNew); - FX_STRSIZE Remove(FX_WCHAR ch); + FX_STRSIZE Remove(wchar_t ch); CFX_ByteString UTF8Encode() const; CFX_ByteString UTF16LE_Encode() const; protected: - using StringData = CFX_StringDataTemplate<FX_WCHAR>; + using StringData = CFX_StringDataTemplate<wchar_t>; void ReallocBeforeWrite(FX_STRSIZE nLen); void AllocBeforeWrite(FX_STRSIZE nLen); void AllocCopy(CFX_WideString& dest, FX_STRSIZE nCopyLen, FX_STRSIZE nCopyIndex) const; - void AssignCopy(const FX_WCHAR* pSrcData, FX_STRSIZE nSrcLen); - void Concat(const FX_WCHAR* lpszSrcData, FX_STRSIZE nSrcLen); + void AssignCopy(const wchar_t* pSrcData, FX_STRSIZE nSrcLen); + void Concat(const wchar_t* lpszSrcData, FX_STRSIZE nSrcLen); CFX_RetainPtr<StringData> m_pData; @@ -372,34 +368,34 @@ inline CFX_WideString operator+(const CFX_WideStringC& str1, return CFX_WideString(str1, str2); } inline CFX_WideString operator+(const CFX_WideStringC& str1, - const FX_WCHAR* str2) { + const wchar_t* str2) { return CFX_WideString(str1, str2); } -inline CFX_WideString operator+(const FX_WCHAR* str1, +inline CFX_WideString operator+(const wchar_t* str1, const CFX_WideStringC& str2) { return CFX_WideString(str1, str2); } -inline CFX_WideString operator+(const CFX_WideStringC& str1, FX_WCHAR ch) { +inline CFX_WideString operator+(const CFX_WideStringC& str1, wchar_t ch) { return CFX_WideString(str1, CFX_WideStringC(ch)); } -inline CFX_WideString operator+(FX_WCHAR ch, const CFX_WideStringC& str2) { +inline CFX_WideString operator+(wchar_t ch, const CFX_WideStringC& str2) { return CFX_WideString(ch, str2); } inline CFX_WideString operator+(const CFX_WideString& str1, const CFX_WideString& str2) { return CFX_WideString(str1.AsStringC(), str2.AsStringC()); } -inline CFX_WideString operator+(const CFX_WideString& str1, FX_WCHAR ch) { +inline CFX_WideString operator+(const CFX_WideString& str1, wchar_t ch) { return CFX_WideString(str1.AsStringC(), CFX_WideStringC(ch)); } -inline CFX_WideString operator+(FX_WCHAR ch, const CFX_WideString& str2) { +inline CFX_WideString operator+(wchar_t ch, const CFX_WideString& str2) { return CFX_WideString(ch, str2.AsStringC()); } inline CFX_WideString operator+(const CFX_WideString& str1, - const FX_WCHAR* str2) { + const wchar_t* str2) { return CFX_WideString(str1.AsStringC(), str2); } -inline CFX_WideString operator+(const FX_WCHAR* str1, +inline CFX_WideString operator+(const wchar_t* str1, const CFX_WideString& str2) { return CFX_WideString(str1, str2.AsStringC()); } @@ -430,7 +426,7 @@ inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) { return FX_atof(FX_UTF8Encode(wsStr).c_str()); } bool FX_atonum(const CFX_ByteStringC& str, void* pData); -FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); +FX_STRSIZE FX_ftoa(FX_FLOAT f, char* buf); uint32_t FX_HashCode_GetA(const CFX_ByteStringC& str, bool bIgnoreCase); uint32_t FX_HashCode_GetW(const CFX_WideStringC& str, bool bIgnoreCase); diff --git a/core/fxcrt/fx_system.h b/core/fxcrt/fx_system.h index c31bef974f..a0878981d8 100644 --- a/core/fxcrt/fx_system.h +++ b/core/fxcrt/fx_system.h @@ -70,8 +70,6 @@ extern "C" { typedef void* FX_POSITION; // Keep until fxcrt containers gone typedef float FX_FLOAT; // Keep, allow upgrade to doubles. typedef double FX_DOUBLE; // Keep, allow downgrade to floats. -typedef char FX_CHAR; // Keep, questionable signedness. -typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars. #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) @@ -141,7 +139,7 @@ void FXSYS_vsnprintf(char* str, size_t size, const char* fmt, va_list ap); #define FXSYS_wfopen _wfopen #endif #else -FXSYS_FILE* FXSYS_wfopen(const FX_WCHAR* filename, const FX_WCHAR* mode); +FXSYS_FILE* FXSYS_wfopen(const wchar_t* filename, const wchar_t* mode); #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ #ifdef __cplusplus @@ -153,27 +151,27 @@ FXSYS_FILE* FXSYS_wfopen(const FX_WCHAR* filename, const FX_WCHAR* mode); #define FXSYS_wcslen(ptr) pdfium::base::checked_cast<FX_STRSIZE>(wcslen(ptr)) // Overloaded functions for C++ templates -inline FX_STRSIZE FXSYS_len(const FX_CHAR* ptr) { +inline FX_STRSIZE FXSYS_len(const char* ptr) { return FXSYS_strlen(ptr); } -inline FX_STRSIZE FXSYS_len(const FX_WCHAR* ptr) { +inline FX_STRSIZE FXSYS_len(const wchar_t* ptr) { return FXSYS_wcslen(ptr); } -inline int FXSYS_cmp(const FX_CHAR* ptr1, const FX_CHAR* ptr2, size_t len) { +inline int FXSYS_cmp(const char* ptr1, const char* ptr2, size_t len) { return memcmp(ptr1, ptr2, len); } -inline int FXSYS_cmp(const FX_WCHAR* ptr1, const FX_WCHAR* ptr2, size_t len) { +inline int FXSYS_cmp(const wchar_t* ptr1, const wchar_t* ptr2, size_t len) { return wmemcmp(ptr1, ptr2, len); } -inline const FX_CHAR* FXSYS_chr(const FX_CHAR* ptr, FX_CHAR ch, size_t len) { - return reinterpret_cast<const FX_CHAR*>(memchr(ptr, ch, len)); +inline const char* FXSYS_chr(const char* ptr, char ch, size_t len) { + return reinterpret_cast<const char*>(memchr(ptr, ch, len)); } -inline const FX_WCHAR* FXSYS_chr(const FX_WCHAR* ptr, FX_WCHAR ch, size_t len) { +inline const wchar_t* FXSYS_chr(const wchar_t* ptr, wchar_t ch, size_t len) { return wmemchr(ptr, ch, len); } @@ -276,12 +274,12 @@ wchar_t* FXSYS_wcsupr(wchar_t* str); #define FXSYS_LOBYTE(word) ((uint8_t)(word)) #define FXSYS_HIWORD(dword) ((uint16_t)((dword) >> 16)) #define FXSYS_LOWORD(dword) ((uint16_t)(dword)) -int32_t FXSYS_atoi(const FX_CHAR* str); -uint32_t FXSYS_atoui(const FX_CHAR* str); -int32_t FXSYS_wtoi(const FX_WCHAR* str); -int64_t FXSYS_atoi64(const FX_CHAR* str); -int64_t FXSYS_wtoi64(const FX_WCHAR* str); -const FX_CHAR* FXSYS_i64toa(int64_t value, FX_CHAR* str, int radix); +int32_t FXSYS_atoi(const char* str); +uint32_t FXSYS_atoui(const char* str); +int32_t FXSYS_wtoi(const wchar_t* str); +int64_t FXSYS_atoi64(const char* str); +int64_t FXSYS_wtoi64(const wchar_t* str); +const char* FXSYS_i64toa(int64_t value, char* str, int radix); int FXSYS_round(FX_FLOAT f); #define FXSYS_sqrt2(a, b) (FX_FLOAT) FXSYS_sqrt((a) * (a) + (b) * (b)) #ifdef __cplusplus diff --git a/core/fxcrt/fx_system_unittest.cpp b/core/fxcrt/fx_system_unittest.cpp index 4ab37c7bdb..def0043bab 100644 --- a/core/fxcrt/fx_system_unittest.cpp +++ b/core/fxcrt/fx_system_unittest.cpp @@ -16,11 +16,11 @@ namespace { -const FX_CHAR kSentinel = 0x7f; +const char kSentinel = 0x7f; void Check32BitBase16Itoa(int32_t input, const char* expected_output) { const size_t kBufLen = 11; // "-" + 8 digits + NUL + sentinel. - FX_CHAR buf[kBufLen]; + char buf[kBufLen]; buf[kBufLen - 1] = kSentinel; FXSYS_itoa(input, buf, 16); EXPECT_EQ(std::string(expected_output), buf); @@ -29,7 +29,7 @@ void Check32BitBase16Itoa(int32_t input, const char* expected_output) { void Check32BitBase10Itoa(int32_t input, const char* expected_output) { const size_t kBufLen = 13; // "-" + 10 digits + NUL + sentinel. - FX_CHAR buf[kBufLen]; + char buf[kBufLen]; buf[kBufLen - 1] = kSentinel; FXSYS_itoa(input, buf, 10); EXPECT_EQ(std::string(expected_output), buf); @@ -38,7 +38,7 @@ void Check32BitBase10Itoa(int32_t input, const char* expected_output) { void Check32BitBase2Itoa(int32_t input, const char* expected_output) { const size_t kBufLen = 35; // "-" + 32 digits + NUL + sentinel. - FX_CHAR buf[kBufLen]; + char buf[kBufLen]; buf[kBufLen - 1] = kSentinel; FXSYS_itoa(input, buf, 2); EXPECT_EQ(std::string(expected_output), buf); @@ -47,7 +47,7 @@ void Check32BitBase2Itoa(int32_t input, const char* expected_output) { void Check64BitBase16Itoa(int64_t input, const char* expected_output) { const size_t kBufLen = 19; // "-" + 16 digits + NUL + sentinel. - FX_CHAR buf[kBufLen]; + char buf[kBufLen]; buf[kBufLen - 1] = kSentinel; FXSYS_i64toa(input, buf, 16); EXPECT_EQ(std::string(expected_output), buf); @@ -56,7 +56,7 @@ void Check64BitBase16Itoa(int64_t input, const char* expected_output) { void Check64BitBase10Itoa(int64_t input, const char* expected_output) { const size_t kBufLen = 22; // "-" + 19 digits + NUL + sentinel. - FX_CHAR buf[kBufLen]; + char buf[kBufLen]; buf[kBufLen - 1] = kSentinel; FXSYS_i64toa(input, buf, 10); EXPECT_EQ(std::string(expected_output), buf); @@ -65,7 +65,7 @@ void Check64BitBase10Itoa(int64_t input, const char* expected_output) { void Check64BitBase2Itoa(int64_t input, const char* expected_output) { const size_t kBufLen = 67; // "-" + 64 digits + NUL + sentinel. - FX_CHAR buf[kBufLen]; + char buf[kBufLen]; buf[kBufLen - 1] = kSentinel; FXSYS_i64toa(input, buf, 2); EXPECT_EQ(std::string(expected_output), buf); @@ -75,7 +75,7 @@ void Check64BitBase2Itoa(int64_t input, const char* expected_output) { } // namespace TEST(fxcrt, FXSYS_itoa_InvalidRadix) { - FX_CHAR buf[32]; + char buf[32]; FXSYS_itoa(42, buf, 17); // Ours stops at 16. EXPECT_EQ(std::string(""), buf); @@ -115,7 +115,7 @@ TEST(fxcrt, FXSYS_itoa) { } TEST(fxcrt, FXSYS_i64toa_InvalidRadix) { - FX_CHAR buf[32]; + char buf[32]; FXSYS_i64toa(42, buf, 17); // Ours stops at 16. EXPECT_EQ(std::string(""), buf); diff --git a/core/fxcrt/fx_ucd.h b/core/fxcrt/fx_ucd.h index 488c275808..b96d09a406 100644 --- a/core/fxcrt/fx_ucd.h +++ b/core/fxcrt/fx_ucd.h @@ -45,13 +45,13 @@ extern const size_t kFXTextLayoutVerticalMirrorSize; extern const uint16_t kFXTextLayoutBidiMirror[]; extern const size_t kFXTextLayoutBidiMirrorSize; -uint32_t FX_GetUnicodeProperties(FX_WCHAR wch); -FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, bool bRTL, bool bVertical); +uint32_t FX_GetUnicodeProperties(wchar_t wch); +wchar_t FX_GetMirrorChar(wchar_t wch, bool bRTL, bool bVertical); #ifdef PDF_ENABLE_XFA // As defined in http://www.unicode.org/reports/tr14/ -enum FX_CHARBREAKPROP { +enum FXCHAR_BREAKPROP { FX_CBP_OP = 0, // Opening Punctuation FX_CBP_CL = 1, // Closing Punctuation FX_CBP_QU = 2, // Ambiguous Quotation @@ -114,10 +114,10 @@ inline FX_CHARTYPE GetCharTypeFromProp(uint32_t prop) { return static_cast<FX_CHARTYPE>(prop & FX_CHARTYPEBITSMASK); } -FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, - uint32_t dwProps, - bool bRTL, - bool bVertical); +wchar_t FX_GetMirrorChar(wchar_t wch, + uint32_t dwProps, + bool bRTL, + bool bVertical); #endif // PDF_ENABLE_XFA diff --git a/core/fxcrt/fx_unicode.cpp b/core/fxcrt/fx_unicode.cpp index 44fa8e743d..fce826dac8 100644 --- a/core/fxcrt/fx_unicode.cpp +++ b/core/fxcrt/fx_unicode.cpp @@ -6,14 +6,14 @@ #include "core/fxcrt/fx_ucd.h" -uint32_t FX_GetUnicodeProperties(FX_WCHAR wch) { +uint32_t FX_GetUnicodeProperties(wchar_t wch) { size_t idx = static_cast<size_t>(wch); if (idx < kTextLayoutCodePropertiesSize) return kTextLayoutCodeProperties[(uint16_t)wch]; return 0; } -FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, bool bRTL, bool bVertical) { +wchar_t FX_GetMirrorChar(wchar_t wch, bool bRTL, bool bVertical) { uint32_t dwProps = FX_GetUnicodeProperties(wch); uint32_t dwTemp = (dwProps & 0xFF800000); if (bRTL && dwTemp < 0xFF800000) { @@ -35,10 +35,10 @@ FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, bool bRTL, bool bVertical) { } #ifdef PDF_ENABLE_XFA -FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, - uint32_t dwProps, - bool bRTL, - bool bVertical) { +wchar_t FX_GetMirrorChar(wchar_t wch, + uint32_t dwProps, + bool bRTL, + bool bVertical) { uint32_t dwTemp = (dwProps & 0xFF800000); if (bRTL && dwTemp < 0xFF800000) { size_t idx = dwTemp >> 23; diff --git a/core/fxcrt/fx_xml_parser.cpp b/core/fxcrt/fx_xml_parser.cpp index 761aae7775..b81ae4e0d9 100644 --- a/core/fxcrt/fx_xml_parser.cpp +++ b/core/fxcrt/fx_xml_parser.cpp @@ -367,7 +367,7 @@ uint32_t CXML_Parser::GetCharRef() { break; } if (g_FXCRT_XML_IsDigital(ch)) - code = code * 10 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch)); + code = code * 10 + FXSYS_toDecimalDigit(static_cast<wchar_t>(ch)); break; case 4: m_dwIndex++; @@ -380,7 +380,7 @@ uint32_t CXML_Parser::GetCharRef() { if (nHex) { if (nHex == FXCRTM_XML_CHARTYPE_HexDigital) { code = - (code << 4) + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch)); + (code << 4) + FXSYS_toDecimalDigit(static_cast<wchar_t>(ch)); } else if (nHex == FXCRTM_XML_CHARTYPE_HexLowerLetter) { code = (code << 4) + ch - 87; } else { diff --git a/core/fxge/android/cfpf_skiafont.cpp b/core/fxge/android/cfpf_skiafont.cpp index 5e11efae9d..e00aa840e4 100644 --- a/core/fxge/android/cfpf_skiafont.cpp +++ b/core/fxge/android/cfpf_skiafont.cpp @@ -53,7 +53,7 @@ CFX_ByteString CFPF_SkiaFont::GetPsName() { return FXFT_Get_Postscript_Name(m_Face); } -int32_t CFPF_SkiaFont::GetGlyphIndex(FX_WCHAR wUnicode) { +int32_t CFPF_SkiaFont::GetGlyphIndex(wchar_t wUnicode) { if (!m_Face) return wUnicode; if (FXFT_Select_Charmap(m_Face, FXFT_ENCODING_UNICODE)) diff --git a/core/fxge/android/cfpf_skiafont.h b/core/fxge/android/cfpf_skiafont.h index b72c111177..657ced88f2 100644 --- a/core/fxge/android/cfpf_skiafont.h +++ b/core/fxge/android/cfpf_skiafont.h @@ -25,7 +25,7 @@ class CFPF_SkiaFont { CFX_ByteString GetPsName(); uint32_t GetFontStyle() const { return m_dwStyle; } uint8_t GetCharset() const { return m_uCharset; } - int32_t GetGlyphIndex(FX_WCHAR wUnicode); + int32_t GetGlyphIndex(wchar_t wUnicode); int32_t GetGlyphWidth(int32_t iGlyphIndex); int32_t GetAscent() const; int32_t GetDescent() const; diff --git a/core/fxge/android/cfpf_skiafontdescriptor.h b/core/fxge/android/cfpf_skiafontdescriptor.h index 57b85404ad..56f8a34fa5 100644 --- a/core/fxge/android/cfpf_skiafontdescriptor.h +++ b/core/fxge/android/cfpf_skiafontdescriptor.h @@ -23,14 +23,14 @@ class CFPF_SkiaFontDescriptor { virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Unknown; } - void SetFamily(const FX_CHAR* pFamily) { + void SetFamily(const char* pFamily) { FX_Free(m_pFamily); int32_t iSize = FXSYS_strlen(pFamily); - m_pFamily = FX_Alloc(FX_CHAR, iSize + 1); - FXSYS_memcpy(m_pFamily, pFamily, iSize * sizeof(FX_CHAR)); + m_pFamily = FX_Alloc(char, iSize + 1); + FXSYS_memcpy(m_pFamily, pFamily, iSize * sizeof(char)); m_pFamily[iSize] = 0; } - FX_CHAR* m_pFamily; + char* m_pFamily; uint32_t m_dwStyle; int32_t m_iFaceIndex; uint32_t m_dwCharsets; diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp index e3511be67a..00d989e55c 100644 --- a/core/fxge/android/cfpf_skiafontmgr.cpp +++ b/core/fxge/android/cfpf_skiafontmgr.cpp @@ -87,12 +87,12 @@ uint32_t FPF_SkiaGetSubstFont(uint32_t dwHash, return 0; } -uint32_t FPF_GetHashCode_StringA(const FX_CHAR* pStr, int32_t iLength) { +uint32_t FPF_GetHashCode_StringA(const char* pStr, int32_t iLength) { if (!pStr) return 0; if (iLength < 0) iLength = FXSYS_strlen(pStr); - const FX_CHAR* pStrEnd = pStr + iLength; + const char* pStrEnd = pStr + iLength; uint32_t uHashCode = 0; while (pStr < pStrEnd) uHashCode = 31 * uHashCode + FXSYS_tolower(*pStr++); @@ -160,9 +160,9 @@ uint32_t FPF_SkiaGetCharset(uint8_t uCharset) { uint32_t FPF_SKIANormalizeFontName(const CFX_ByteStringC& bsfamily) { uint32_t dwHash = 0; int32_t iLength = bsfamily.GetLength(); - const FX_CHAR* pBuffer = bsfamily.c_str(); + const char* pBuffer = bsfamily.c_str(); for (int32_t i = 0; i < iLength; i++) { - FX_CHAR ch = pBuffer[i]; + char ch = pBuffer[i]; if (ch == ' ' || ch == '-' || ch == ',') continue; dwHash = 31 * dwHash + FXSYS_tolower(ch); diff --git a/core/fxge/android/cfpf_skiapathfont.h b/core/fxge/android/cfpf_skiapathfont.h index f1cff2574b..f8ddc6c83a 100644 --- a/core/fxge/android/cfpf_skiapathfont.h +++ b/core/fxge/android/cfpf_skiapathfont.h @@ -20,14 +20,14 @@ class CFPF_SkiaPathFont : public CFPF_SkiaFontDescriptor { // CFPF_SkiaFontDescriptor int32_t GetType() const override { return FPF_SKIAFONTTYPE_Path; } - void SetPath(const FX_CHAR* pPath) { + void SetPath(const char* pPath) { FX_Free(m_pPath); int32_t iSize = FXSYS_strlen(pPath); - m_pPath = FX_Alloc(FX_CHAR, iSize + 1); - FXSYS_memcpy(m_pPath, pPath, iSize * sizeof(FX_CHAR)); + m_pPath = FX_Alloc(char, iSize + 1); + FXSYS_memcpy(m_pPath, pPath, iSize * sizeof(char)); m_pPath[iSize] = 0; } - FX_CHAR* m_pPath; + char* m_pPath; }; #endif // CORE_FXGE_ANDROID_CFPF_SKIAPATHFONT_H_ diff --git a/core/fxge/android/cfx_androidfontinfo.cpp b/core/fxge/android/cfx_androidfontinfo.cpp index 03a7ffbd9e..6ab9c6479a 100644 --- a/core/fxge/android/cfx_androidfontinfo.cpp +++ b/core/fxge/android/cfx_androidfontinfo.cpp @@ -30,7 +30,7 @@ void* CFX_AndroidFontInfo::MapFont(int weight, bool bItalic, int charset, int pitch_family, - const FX_CHAR* face, + const char* face, int& iExact) { if (!m_pFontMgr) return nullptr; @@ -50,7 +50,7 @@ void* CFX_AndroidFontInfo::MapFont(int weight, FPF_MATCHFONT_REPLACEANSI); } -void* CFX_AndroidFontInfo::GetFont(const FX_CHAR* face) { +void* CFX_AndroidFontInfo::GetFont(const char* face) { return nullptr; } diff --git a/core/fxge/android/cfx_androidfontinfo.h b/core/fxge/android/cfx_androidfontinfo.h index 94e1db88ac..076b956a0c 100644 --- a/core/fxge/android/cfx_androidfontinfo.h +++ b/core/fxge/android/cfx_androidfontinfo.h @@ -27,9 +27,9 @@ class CFX_AndroidFontInfo : public IFX_SystemFontInfo { bool bItalic, int charset, int pitch_family, - const FX_CHAR* face, + const char* face, int& bExact) override; - void* GetFont(const FX_CHAR* face) override; + void* GetFont(const char* face) override; uint32_t GetFontData(void* hFont, uint32_t table, uint8_t* buffer, diff --git a/core/fxge/apple/fx_mac_imp.cpp b/core/fxge/apple/fx_mac_imp.cpp index c05aea34f5..2df6e754a0 100644 --- a/core/fxge/apple/fx_mac_imp.cpp +++ b/core/fxge/apple/fx_mac_imp.cpp @@ -14,8 +14,8 @@ namespace { const struct { - const FX_CHAR* m_pName; - const FX_CHAR* m_pSubstName; + const char* m_pName; + const char* m_pSubstName; } g_Base14Substs[] = { {"Courier", "Courier New"}, {"Courier-Bold", "Courier New Bold"}, @@ -41,7 +41,7 @@ class CFX_MacFontInfo : public CFX_FolderFontInfo { bool bItalic, int charset, int pitch_family, - const FX_CHAR* family, + const char* family, int& iExact) override; }; @@ -61,7 +61,7 @@ void* CFX_MacFontInfo::MapFont(int weight, bool bItalic, int charset, int pitch_family, - const FX_CHAR* cstr_face, + const char* cstr_face, int& iExact) { CFX_ByteString face = cstr_face; for (size_t i = 0; i < FX_ArraySize(g_Base14Substs); ++i) { diff --git a/core/fxge/cfx_fontmgr.h b/core/fxge/cfx_fontmgr.h index 432f34b38c..b7f2e1a032 100644 --- a/core/fxge/cfx_fontmgr.h +++ b/core/fxge/cfx_fontmgr.h @@ -43,7 +43,7 @@ class CFX_FontMgr { uint8_t* pData, uint32_t size, int font_offset); - FXFT_Face GetFileFace(const FX_CHAR* filename, int face_index); + FXFT_Face GetFileFace(const char* filename, int face_index); FXFT_Face GetFixedFace(const uint8_t* pData, uint32_t size, int face_index); void ReleaseFace(FXFT_Face face); void SetSystemFontInfo(std::unique_ptr<IFX_SystemFontInfo> pFontInfo); diff --git a/core/fxge/cfx_unicodeencodingex.h b/core/fxge/cfx_unicodeencodingex.h index df2edbe1bf..21deb44d79 100644 --- a/core/fxge/cfx_unicodeencodingex.h +++ b/core/fxge/cfx_unicodeencodingex.h @@ -24,7 +24,7 @@ class CFX_UnicodeEncodingEx : public CFX_UnicodeEncoding { // CFX_UnicodeEncoding: uint32_t GlyphFromCharCode(uint32_t charcode) override; - uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const; + uint32_t CharCodeFromUnicode(wchar_t Unicode) const; private: uint32_t m_nEncodingID; diff --git a/core/fxge/ge/cfx_folderfontinfo.cpp b/core/fxge/ge/cfx_folderfontinfo.cpp index 776a37319b..52dfc2d243 100644 --- a/core/fxge/ge/cfx_folderfontinfo.cpp +++ b/core/fxge/ge/cfx_folderfontinfo.cpp @@ -16,8 +16,8 @@ namespace { const struct { - const FX_CHAR* m_pName; - const FX_CHAR* m_pSubstName; + const char* m_pName; + const char* m_pSubstName; } Base14Substs[] = { {"Courier", "Courier New"}, {"Courier-Bold", "Courier New Bold"}, @@ -275,7 +275,7 @@ void* CFX_FolderFontInfo::FindFont(int weight, bool bItalic, int charset, int pitch_family, - const FX_CHAR* family, + const char* family, bool bMatchName) { CFX_FontFaceInfo* pFind = nullptr; if (charset == FXFONT_ANSI_CHARSET && (pitch_family & FXFONT_FF_FIXEDPITCH)) @@ -306,7 +306,7 @@ void* CFX_FolderFontInfo::MapFont(int weight, bool bItalic, int charset, int pitch_family, - const FX_CHAR* family, + const char* family, int& iExact) { return nullptr; } @@ -320,7 +320,7 @@ void* CFX_FolderFontInfo::MapFontByUnicode(uint32_t dwUnicode, } #endif // PDF_ENABLE_XFA -void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) { +void* CFX_FolderFontInfo::GetFont(const char* face) { auto it = m_FontList.find(face); return it != m_FontList.end() ? it->second : nullptr; } diff --git a/core/fxge/ge/cfx_folderfontinfo.h b/core/fxge/ge/cfx_folderfontinfo.h index d031eef3d0..9e9a1a2a6a 100644 --- a/core/fxge/ge/cfx_folderfontinfo.h +++ b/core/fxge/ge/cfx_folderfontinfo.h @@ -27,7 +27,7 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo { bool bItalic, int charset, int pitch_family, - const FX_CHAR* face, + const char* face, int& bExact) override; #ifdef PDF_ENABLE_XFA void* MapFontByUnicode(uint32_t dwUnicode, @@ -35,7 +35,7 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo { bool bItalic, int pitch_family) override; #endif // PDF_ENABLE_XFA - void* GetFont(const FX_CHAR* face) override; + void* GetFont(const char* face) override; uint32_t GetFontData(void* hFont, uint32_t table, uint8_t* buffer, @@ -56,7 +56,7 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo { bool bItalic, int charset, int pitch_family, - const FX_CHAR* family, + const char* family, bool bMatchName); std::map<CFX_ByteString, CFX_FontFaceInfo*> m_FontList; diff --git a/core/fxge/ge/cfx_fontmapper.cpp b/core/fxge/ge/cfx_fontmapper.cpp index 064fc9610a..622b457396 100644 --- a/core/fxge/ge/cfx_fontmapper.cpp +++ b/core/fxge/ge/cfx_fontmapper.cpp @@ -25,7 +25,7 @@ namespace { const int kNumStandardFonts = 14; -const FX_CHAR* const g_Base14FontNames[kNumStandardFonts] = { +const char* const g_Base14FontNames[kNumStandardFonts] = { "Courier", "Courier-Bold", "Courier-BoldOblique", @@ -43,7 +43,7 @@ const FX_CHAR* const g_Base14FontNames[kNumStandardFonts] = { }; const struct AltFontName { - const FX_CHAR* m_pName; + const char* m_pName; int m_Index; } g_AltFontNames[] = { {"Arial", 4}, @@ -138,8 +138,8 @@ const struct AltFontName { }; const struct AltFontFamily { - const FX_CHAR* m_pFontName; - const FX_CHAR* m_pFontFamily; + const char* m_pFontName; + const char* m_pFontFamily; } g_AltFontFamilies[] = { {"AGaramondPro", "Adobe Garamond Pro"}, {"BankGothicBT-Medium", "BankGothic Md BT"}, @@ -147,7 +147,7 @@ const struct AltFontFamily { }; const struct FX_FontStyle { - const FX_CHAR* style; + const char* style; int32_t len; } g_FontStyles[] = { {"Bold", 4}, {"Italic", 6}, {"BoldItalic", 10}, {"Reg", 3}, {"Regular", 7}, @@ -167,20 +167,19 @@ const struct CODEPAGE_MAP { }; int CompareFontFamilyString(const void* key, const void* element) { - CFX_ByteString str_key((const FX_CHAR*)key); + CFX_ByteString str_key((const char*)key); const AltFontFamily* family = reinterpret_cast<const AltFontFamily*>(element); if (str_key.Find(family->m_pFontName) != -1) return 0; - return FXSYS_stricmp(reinterpret_cast<const FX_CHAR*>(key), - family->m_pFontName); + return FXSYS_stricmp(reinterpret_cast<const char*>(key), family->m_pFontName); } int CompareString(const void* key, const void* element) { - return FXSYS_stricmp(reinterpret_cast<const FX_CHAR*>(key), + return FXSYS_stricmp(reinterpret_cast<const char*>(key), reinterpret_cast<const AltFontName*>(element)->m_pName); } -CFX_ByteString TT_NormalizeName(const FX_CHAR* family) { +CFX_ByteString TT_NormalizeName(const char* family) { CFX_ByteString norm(family); norm.Remove(' '); norm.Remove('-'); @@ -223,7 +222,7 @@ CFX_ByteString GetFontFamily(CFX_ByteString fontName, int nStyle) { return found ? CFX_ByteString(found->m_pFontFamily) : fontName; } -CFX_ByteString ParseStyle(const FX_CHAR* pStyle, int iLen, int iIndex) { +CFX_ByteString ParseStyle(const char* pStyle, int iLen, int iIndex) { CFX_ByteTextBuf buf; if (!iLen || iLen <= iIndex) return buf.MakeString(); @@ -505,7 +504,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, } if (!style.IsEmpty()) { int nLen = style.GetLength(); - const FX_CHAR* pStyle = style.c_str(); + const char* pStyle = style.c_str(); int i = 0; bool bFirstItem = true; CFX_ByteString buf; diff --git a/core/fxge/ge/cfx_fontmgr.cpp b/core/fxge/ge/cfx_fontmgr.cpp index 64f647e3f6..97d143804b 100644 --- a/core/fxge/ge/cfx_fontmgr.cpp +++ b/core/fxge/ge/cfx_fontmgr.cpp @@ -215,7 +215,7 @@ FXFT_Face CFX_FontMgr::GetFixedFace(const uint8_t* pData, return FXFT_Set_Pixel_Sizes(face, 64, 64) ? nullptr : face; } -FXFT_Face CFX_FontMgr::GetFileFace(const FX_CHAR* filename, int face_index) { +FXFT_Face CFX_FontMgr::GetFileFace(const char* filename, int face_index) { InitFTLibrary(); FXFT_Library library = m_FTLibrary; FXFT_Face face = nullptr; diff --git a/core/fxge/ge/cfx_unicodeencodingex.cpp b/core/fxge/ge/cfx_unicodeencodingex.cpp index c7e3303f02..cd7625fb17 100644 --- a/core/fxge/ge/cfx_unicodeencodingex.cpp +++ b/core/fxge/ge/cfx_unicodeencodingex.cpp @@ -62,7 +62,7 @@ uint32_t CFX_UnicodeEncodingEx::GlyphFromCharCode(uint32_t charcode) { return 0; } -uint32_t CFX_UnicodeEncodingEx::CharCodeFromUnicode(FX_WCHAR Unicode) const { +uint32_t CFX_UnicodeEncodingEx::CharCodeFromUnicode(wchar_t Unicode) const { if (m_nEncodingID == FXFM_ENCODING_UNICODE || m_nEncodingID == FXFM_ENCODING_MS_SYMBOL) { return Unicode; diff --git a/core/fxge/ge/fx_ge_linux.cpp b/core/fxge/ge/fx_ge_linux.cpp index e7086bb4e0..502a3674ab 100644 --- a/core/fxge/ge/fx_ge_linux.cpp +++ b/core/fxge/ge/fx_ge_linux.cpp @@ -15,7 +15,7 @@ namespace { const size_t kLinuxGpNameSize = 6; -const FX_CHAR* const g_LinuxGpFontList[][kLinuxGpNameSize] = { +const char* const g_LinuxGpFontList[][kLinuxGpNameSize] = { {"TakaoPGothic", "VL PGothic", "IPAPGothic", "VL Gothic", "Kochi Gothic", "VL Gothic regular"}, {"TakaoGothic", "VL Gothic", "IPAGothic", "Kochi Gothic", nullptr, @@ -26,19 +26,19 @@ const FX_CHAR* const g_LinuxGpFontList[][kLinuxGpNameSize] = { "VL Gothic regular"}, }; -const FX_CHAR* const g_LinuxGbFontList[] = { +const char* const g_LinuxGbFontList[] = { "AR PL UMing CN Light", "WenQuanYi Micro Hei", "AR PL UKai CN", }; -const FX_CHAR* const g_LinuxB5FontList[] = { +const char* const g_LinuxB5FontList[] = { "AR PL UMing TW Light", "WenQuanYi Micro Hei", "AR PL UKai TW", }; -const FX_CHAR* const g_LinuxHGFontList[] = { +const char* const g_LinuxHGFontList[] = { "UnDotum", }; -size_t GetJapanesePreference(const FX_CHAR* facearr, +size_t GetJapanesePreference(const char* facearr, int weight, int pitch_family) { CFX_ByteString face = facearr; @@ -72,7 +72,7 @@ class CFX_LinuxFontInfo : public CFX_FolderFontInfo { bool bItalic, int charset, int pitch_family, - const FX_CHAR* family, + const char* family, int& iExact) override; bool ParseFontCfg(const char** pUserPaths); }; @@ -81,7 +81,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight, bool bItalic, int charset, int pitch_family, - const FX_CHAR* cstr_face, + const char* cstr_face, int& iExact) { void* font = GetSubstFont(cstr_face); if (font) { diff --git a/core/fxge/ge/fx_text_int.h b/core/fxge/ge/fx_text_int.h index 4de6587d41..8ea01f91d6 100644 --- a/core/fxge/ge/fx_text_int.h +++ b/core/fxge/ge/fx_text_int.h @@ -14,7 +14,7 @@ struct _CFX_UniqueKeyGen { void Generate(int count, ...); - FX_CHAR m_Key[128]; + char m_Key[128]; int m_KeyLen; }; diff --git a/core/fxge/ifx_systemfontinfo.h b/core/fxge/ifx_systemfontinfo.h index 1ab0ab677c..1453590148 100644 --- a/core/fxge/ifx_systemfontinfo.h +++ b/core/fxge/ifx_systemfontinfo.h @@ -27,7 +27,7 @@ class IFX_SystemFontInfo { bool bItalic, int charset, int pitch_family, - const FX_CHAR* face, + const char* face, int& iExact) = 0; #ifdef PDF_ENABLE_XFA @@ -37,7 +37,7 @@ class IFX_SystemFontInfo { int pitch_family); #endif // PDF_ENABLE_XFA - virtual void* GetFont(const FX_CHAR* face) = 0; + virtual void* GetFont(const char* face) = 0; virtual uint32_t GetFontData(void* hFont, uint32_t table, uint8_t* buffer, diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp index 74fae088d9..c3d2c66d9d 100644 --- a/core/fxge/win32/cfx_psrenderer.cpp +++ b/core/fxge/win32/cfx_psrenderer.cpp @@ -147,7 +147,7 @@ void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData, } } } - m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const char*)buf.GetBuffer(), buf.GetSize()); } void CFX_PSRenderer::SetClip_PathFill(const CFX_PathData* pPathData, @@ -180,7 +180,7 @@ void CFX_PSRenderer::SetClip_PathStroke(const CFX_PathData* pPathData, buf << "mx Cm [" << pObject2Device->a << " " << pObject2Device->b << " " << pObject2Device->c << " " << pObject2Device->d << " " << pObject2Device->e << " " << pObject2Device->f << "]cm "; - m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const char*)buf.GetBuffer(), buf.GetSize()); } OutputPath(pPathData, nullptr); CFX_FloatRect rect = pPathData->GetBoundingBox(pGraphState->m_LineWidth, @@ -219,7 +219,7 @@ bool CFX_PSRenderer::DrawPath(const CFX_PathData* pPathData, buf << "mx Cm [" << pObject2Device->a << " " << pObject2Device->b << " " << pObject2Device->c << " " << pObject2Device->d << " " << pObject2Device->e << " " << pObject2Device->f << "]cm "; - m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const char*)buf.GetBuffer(), buf.GetSize()); } } OutputPath(pPathData, stroke_alpha ? nullptr : pObject2Device); @@ -282,7 +282,7 @@ void CFX_PSRenderer::SetGraphState(const CFX_GraphStateData* pGraphState) { m_CurGraphState.Copy(*pGraphState); m_bGraphStateSet = true; if (buf.GetSize()) { - m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const char*)buf.GetBuffer(), buf.GetSize()); } } @@ -306,7 +306,7 @@ static void PSCompressData(int PSLevel, uint32_t src_size, uint8_t** output_buf, uint32_t* output_size, - const FX_CHAR** filter) { + const char** filter) { *output_buf = src_buf; *output_size = src_size; *filter = ""; @@ -415,7 +415,7 @@ bool CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, } else { buf << "false 1 colorimage\n"; } - m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const char*)buf.GetBuffer(), buf.GetSize()); WritePSBinary(output_buf.get(), output_size); output_buf.release(); } else { @@ -451,7 +451,7 @@ bool CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, int bpp = pConverted->GetBPP() / 8; uint8_t* output_buf = nullptr; FX_STRSIZE output_size = 0; - const FX_CHAR* filter = nullptr; + const char* filter = nullptr; if ((m_PSLevel == 2 || flags & FXRENDER_IMAGE_LOSSY) && CCodec_JpegModule::JpegEncode(pConverted.Get(), &output_buf, &output_size)) { @@ -493,7 +493,7 @@ bool CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, } buf << "false " << bpp; buf << " colorimage\n"; - m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const char*)buf.GetBuffer(), buf.GetSize()); WritePSBinary(output_buf, output_size); FX_Free(output_buf); } @@ -518,7 +518,7 @@ void CFX_PSRenderer::SetColor(uint32_t color) { m_bColorSet = true; m_LastColor = color; } - m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const char*)buf.GetBuffer(), buf.GetSize()); } } @@ -564,7 +564,7 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache, "currentdict end\n"; buf << "/X" << static_cast<uint32_t>(m_PSFontList.size() - 1) << " exch definefont pop\n"; - m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const char*)buf.GetBuffer(), buf.GetSize()); buf.Clear(); } *ps_fontnum = m_PSFontList.size() - 1; @@ -625,7 +625,7 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache, buf << "f}bind def end\n"; buf << "/X" << *ps_fontnum << " Ff/Encoding get " << glyphindex << "/" << glyphindex << " put\n"; - m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const char*)buf.GetBuffer(), buf.GetSize()); } bool CFX_PSRenderer::DrawText(int nChars, @@ -666,7 +666,7 @@ bool CFX_PSRenderer::DrawText(int nChars, buf << hex.AsStringC() << "Tj\n"; } buf << "Q\n"; - m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const char*)buf.GetBuffer(), buf.GetSize()); pCache->ReleaseCachedFace(pFont); return true; } @@ -678,9 +678,9 @@ void CFX_PSRenderer::WritePSBinary(const uint8_t* data, int len) { if (pEncoders && pEncoders->GetBasicModule()->A85Encode(data, len, &dest_buf, &dest_size)) { - m_pOutput->OutputPS((const FX_CHAR*)dest_buf, dest_size); + m_pOutput->OutputPS((const char*)dest_buf, dest_size); FX_Free(dest_buf); } else { - m_pOutput->OutputPS((const FX_CHAR*)data, len); + m_pOutput->OutputPS((const char*)data, len); } } diff --git a/core/fxge/win32/cfx_windowsdib.h b/core/fxge/win32/cfx_windowsdib.h index 2564b7fa36..0bfab3fee1 100644 --- a/core/fxge/win32/cfx_windowsdib.h +++ b/core/fxge/win32/cfx_windowsdib.h @@ -20,7 +20,7 @@ typedef struct WINDIB_Open_Args_ { size_t memory_size; - const FX_WCHAR* path_name; + const wchar_t* path_name; } WINDIB_Open_Args_; class CFX_WindowsDIB : public CFX_DIBitmap { @@ -31,8 +31,8 @@ class CFX_WindowsDIB : public CFX_DIBitmap { static CFX_ByteString GetBitmapInfo(const CFX_DIBitmap* pBitmap); static CFX_DIBitmap* LoadFromBuf(BITMAPINFO* pbmi, void* pData); static HBITMAP GetDDBitmap(const CFX_DIBitmap* pBitmap, HDC hDC); - static CFX_DIBitmap* LoadFromFile(const FX_WCHAR* filename); - static CFX_DIBitmap* LoadFromFile(const FX_CHAR* filename); + static CFX_DIBitmap* LoadFromFile(const wchar_t* filename); + static CFX_DIBitmap* LoadFromFile(const char* filename); static CFX_DIBitmap* LoadDIBitmap(WINDIB_Open_Args_ args); HDC GetDC() const { return m_hMemDC; } diff --git a/core/fxge/win32/cpsoutput.cpp b/core/fxge/win32/cpsoutput.cpp index 76b37d7dac..24df15226b 100644 --- a/core/fxge/win32/cpsoutput.cpp +++ b/core/fxge/win32/cpsoutput.cpp @@ -20,13 +20,13 @@ void CPSOutput::Release() { delete this; } -void CPSOutput::OutputPS(const FX_CHAR* str, int len) { +void CPSOutput::OutputPS(const char* str, int len) { if (len < 0) len = static_cast<int>(FXSYS_strlen(str)); int sent_len = 0; while (len > 0) { - FX_CHAR buffer[1026]; + char buffer[1026]; int send_len = std::min(len, 1024); *(reinterpret_cast<uint16_t*>(buffer)) = send_len; FXSYS_memcpy(buffer + 2, str + sent_len, send_len); diff --git a/core/fxge/win32/cpsoutput.h b/core/fxge/win32/cpsoutput.h index bc9225bd7e..1a4709b36b 100644 --- a/core/fxge/win32/cpsoutput.h +++ b/core/fxge/win32/cpsoutput.h @@ -18,7 +18,7 @@ class CPSOutput { // IFX_PSOutput void Release(); - void OutputPS(const FX_CHAR* str, int len); + void OutputPS(const char* str, int len); HDC m_hDC; }; diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index 92e9b41e06..d1d81b18e4 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -34,15 +34,15 @@ namespace { const struct { - const FX_CHAR* m_pFaceName; - const FX_CHAR* m_pVariantName; + const char* m_pFaceName; + const char* m_pVariantName; } g_VariantNames[] = { {"DFKai-SB", "\x19\x6A\x77\x69\xD4\x9A"}, }; const struct { - const FX_CHAR* m_pName; - const FX_CHAR* m_pWinName; + const char* m_pName; + const char* m_pWinName; bool m_bBold; bool m_bItalic; } g_Base14Substs[] = { @@ -61,8 +61,8 @@ const struct { }; struct FontNameMap { - const FX_CHAR* m_pSubFontName; - const FX_CHAR* m_pSrcFontName; + const char* m_pSubFontName; + const char* m_pSrcFontName; }; const FontNameMap g_JpFontNameMap[] = { {"MS Mincho", "Heiseimin-W3"}, @@ -324,7 +324,7 @@ class CFX_Win32FallbackFontInfo final : public CFX_FolderFontInfo { bool bItalic, int charset, int pitch_family, - const FX_CHAR* family, + const char* family, int& iExact) override; }; @@ -339,9 +339,9 @@ class CFX_Win32FontInfo final : public IFX_SystemFontInfo { bool bItalic, int charset, int pitch_family, - const FX_CHAR* face, + const char* face, int& iExact) override; - void* GetFont(const FX_CHAR* face) override { return nullptr; } + void* GetFont(const char* face) override { return nullptr; } uint32_t GetFontData(void* hFont, uint32_t table, uint8_t* buffer, @@ -476,7 +476,7 @@ void* CFX_Win32FallbackFontInfo::MapFont(int weight, bool bItalic, int charset, int pitch_family, - const FX_CHAR* cstr_face, + const char* cstr_face, int& iExact) { void* font = GetSubstFont(cstr_face); if (font) { @@ -569,7 +569,7 @@ void* CFX_Win32FontInfo::MapFont(int weight, bool bItalic, int charset, int pitch_family, - const FX_CHAR* cstr_face, + const char* cstr_face, int& iExact) { CFX_ByteString face = cstr_face; int iBaseFont; diff --git a/core/fxge/win32/fx_win32_dib.cpp b/core/fxge/win32/fx_win32_dib.cpp index 40c9ca6e31..9b85b57317 100644 --- a/core/fxge/win32/fx_win32_dib.cpp +++ b/core/fxge/win32/fx_win32_dib.cpp @@ -116,7 +116,7 @@ void GetBitmapSize(HBITMAP hBitmap, int& w, int& h) { h = bmp.bmHeight; } -CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(const FX_WCHAR* filename) { +CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(const wchar_t* filename) { CWin32Platform* pPlatform = (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData(); if (pPlatform->m_GdiplusExt.IsAvailable()) { @@ -150,7 +150,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(const FX_WCHAR* filename) { return pDIBitmap; } -CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(const FX_CHAR* filename) { +CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(const char* filename) { return LoadFromFile(CFX_WideString::FromLocal(filename).c_str()); } diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp index 1be2a54b18..1e51bba2b3 100644 --- a/core/fxge/win32/fx_win32_gdipext.cpp +++ b/core/fxge/win32/fx_win32_gdipext.cpp @@ -680,7 +680,7 @@ CGdiplusExt::CGdiplusExt() { } void CGdiplusExt::Load() { CFX_ByteString strPlusPath = ""; - FX_CHAR buf[MAX_PATH]; + char buf[MAX_PATH]; GetSystemDirectoryA(buf, MAX_PATH); strPlusPath += buf; strPlusPath += "\\"; @@ -765,7 +765,7 @@ bool CGdiplusExt::GdipCreateFromImage(void* bitmap, void** graphics) { } return false; } -bool CGdiplusExt::GdipCreateFontFamilyFromName(const FX_WCHAR* name, +bool CGdiplusExt::GdipCreateFontFamilyFromName(const wchar_t* name, void* pFontCollection, void** pFamily) { CGdiplusExt& GdiplusExt = diff --git a/core/fxge/win32/win32_int.h b/core/fxge/win32/win32_int.h index f8eae87308..08a8224db6 100644 --- a/core/fxge/win32/win32_int.h +++ b/core/fxge/win32/win32_int.h @@ -83,7 +83,7 @@ class CGdiplusExt { FX_FLOAT f, void** matrix); void GdipDeleteMatrix(void* matrix); - bool GdipCreateFontFamilyFromName(const FX_WCHAR* name, + bool GdipCreateFontFamilyFromName(const wchar_t* name, void* pFontCollection, void** pFamily); void GdipDeleteFontFamily(void* pFamily); diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp index 3eedf1502c..3c96550a42 100644 --- a/fpdfsdk/cpdfsdk_baannot.cpp +++ b/fpdfsdk/cpdfsdk_baannot.cpp @@ -71,7 +71,7 @@ bool CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { return false; // Choose the right sub-ap - const FX_CHAR* ap_entry = "N"; + const char* ap_entry = "N"; if (mode == CPDF_Annot::Down) ap_entry = "D"; else if (mode == CPDF_Annot::Rollover) diff --git a/fpdfsdk/cpdfsdk_datetime.cpp b/fpdfsdk/cpdfsdk_datetime.cpp index 72f50a6b44..e10a223408 100644 --- a/fpdfsdk/cpdfsdk_datetime.cpp +++ b/fpdfsdk/cpdfsdk_datetime.cpp @@ -143,7 +143,7 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( int j = 0; int k = 0; - FX_CHAR ch; + char ch; while (i < strLength && j < 4) { ch = dtStr[i]; k = k * 10 + FXSYS_toDecimalDigit(ch); diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp index 4ef766d9f8..091ccfc42f 100644 --- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp +++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp @@ -60,8 +60,8 @@ CPDFSDK_FormFillEnvironment::~CPDFSDK_FormFillEnvironment() { m_pInfo->Release(m_pInfo); } -int CPDFSDK_FormFillEnvironment::JS_appAlert(const FX_WCHAR* Msg, - const FX_WCHAR* Title, +int CPDFSDK_FormFillEnvironment::JS_appAlert(const wchar_t* Msg, + const wchar_t* Title, uint32_t Type, uint32_t Icon) { if (!m_pInfo || !m_pInfo->m_pJsPlatform || @@ -75,10 +75,10 @@ int CPDFSDK_FormFillEnvironment::JS_appAlert(const FX_WCHAR* Msg, AsFPDFWideString(&bsTitle), Type, Icon); } -int CPDFSDK_FormFillEnvironment::JS_appResponse(const FX_WCHAR* Question, - const FX_WCHAR* Title, - const FX_WCHAR* Default, - const FX_WCHAR* cLabel, +int CPDFSDK_FormFillEnvironment::JS_appResponse(const wchar_t* Question, + const wchar_t* Title, + const wchar_t* Default, + const wchar_t* cLabel, FPDF_BOOL bPassword, void* response, int length) { @@ -146,7 +146,7 @@ CFX_WideString CPDFSDK_FormFillEnvironment::JS_docGetFilePath() { void CPDFSDK_FormFillEnvironment::JS_docSubmitForm(void* formData, int length, - const FX_WCHAR* URL) { + const wchar_t* URL) { if (!m_pInfo || !m_pInfo->m_pJsPlatform || !m_pInfo->m_pJsPlatform->Doc_submitForm) { return; @@ -160,11 +160,11 @@ void CPDFSDK_FormFillEnvironment::JS_docSubmitForm(void* formData, void CPDFSDK_FormFillEnvironment::JS_docmailForm(void* mailData, int length, FPDF_BOOL bUI, - const FX_WCHAR* To, - const FX_WCHAR* Subject, - const FX_WCHAR* CC, - const FX_WCHAR* BCC, - const FX_WCHAR* Msg) { + const wchar_t* To, + const wchar_t* Subject, + const wchar_t* CC, + const wchar_t* BCC, + const wchar_t* Msg) { if (!m_pInfo || !m_pInfo->m_pJsPlatform || !m_pInfo->m_pJsPlatform->Doc_mail) { return; @@ -313,8 +313,7 @@ FPDF_PAGE CPDFSDK_FormFillEnvironment::GetCurrentPage(FPDF_DOCUMENT document) { return nullptr; } -void CPDFSDK_FormFillEnvironment::ExecuteNamedAction( - const FX_CHAR* namedAction) { +void CPDFSDK_FormFillEnvironment::ExecuteNamedAction(const char* namedAction) { if (m_pInfo && m_pInfo->FFI_ExecuteNamedAction) m_pInfo->FFI_ExecuteNamedAction(m_pInfo, namedAction); } @@ -327,7 +326,7 @@ void CPDFSDK_FormFillEnvironment::OnSetFieldInputFocus( m_pInfo->FFI_SetTextFieldFocus(m_pInfo, focusText, nTextLen, bFocus); } -void CPDFSDK_FormFillEnvironment::DoURIAction(const FX_CHAR* bsURI) { +void CPDFSDK_FormFillEnvironment::DoURIAction(const char* bsURI) { if (m_pInfo && m_pInfo->FFI_DoURIAction) m_pInfo->FFI_DoURIAction(m_pInfo, bsURI); } @@ -462,7 +461,7 @@ FPDF_FILEHANDLER* CPDFSDK_FormFillEnvironment::OpenFile(int fileType, } CFX_RetainPtr<IFX_SeekableReadStream> -CPDFSDK_FormFillEnvironment::DownloadFromURL(const FX_WCHAR* url) { +CPDFSDK_FormFillEnvironment::DownloadFromURL(const wchar_t* url) { if (!m_pInfo || !m_pInfo->FFI_DownloadFromURL) return nullptr; @@ -475,11 +474,11 @@ CPDFSDK_FormFillEnvironment::DownloadFromURL(const FX_WCHAR* url) { } CFX_WideString CPDFSDK_FormFillEnvironment::PostRequestURL( - const FX_WCHAR* wsURL, - const FX_WCHAR* wsData, - const FX_WCHAR* wsContentType, - const FX_WCHAR* wsEncode, - const FX_WCHAR* wsHeader) { + const wchar_t* wsURL, + const wchar_t* wsData, + const wchar_t* wsContentType, + const wchar_t* wsEncode, + const wchar_t* wsHeader) { if (!m_pInfo || !m_pInfo->FFI_PostRequestURL) return L""; @@ -513,9 +512,9 @@ CFX_WideString CPDFSDK_FormFillEnvironment::PostRequestURL( return wsRet; } -FPDF_BOOL CPDFSDK_FormFillEnvironment::PutRequestURL(const FX_WCHAR* wsURL, - const FX_WCHAR* wsData, - const FX_WCHAR* wsEncode) { +FPDF_BOOL CPDFSDK_FormFillEnvironment::PutRequestURL(const wchar_t* wsURL, + const wchar_t* wsData, + const wchar_t* wsEncode) { if (!m_pInfo || !m_pInfo->FFI_PutRequestURL) return false; diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h index eead8734f1..5aead04191 100644 --- a/fpdfsdk/cpdfsdk_formfillenvironment.h +++ b/fpdfsdk/cpdfsdk_formfillenvironment.h @@ -84,11 +84,11 @@ class CPDFSDK_FormFillEnvironment FPDF_PAGE GetPage(FPDF_DOCUMENT document, int nPageIndex); FPDF_PAGE GetCurrentPage(FPDF_DOCUMENT document); - void ExecuteNamedAction(const FX_CHAR* namedAction); + void ExecuteNamedAction(const char* namedAction); void OnSetFieldInputFocus(FPDF_WIDESTRING focusText, FPDF_DWORD nTextLen, bool bFocus); - void DoURIAction(const FX_CHAR* bsURI); + void DoURIAction(const char* bsURI); void DoGoToAction(int nPageIndex, int zoomMode, float* fPosArray, @@ -141,15 +141,15 @@ class CPDFSDK_FormFillEnvironment FPDF_FILEHANDLER* OpenFile(int fileType, FPDF_WIDESTRING wsURL, const char* mode); - CFX_RetainPtr<IFX_SeekableReadStream> DownloadFromURL(const FX_WCHAR* url); - CFX_WideString PostRequestURL(const FX_WCHAR* wsURL, - const FX_WCHAR* wsData, - const FX_WCHAR* wsContentType, - const FX_WCHAR* wsEncode, - const FX_WCHAR* wsHeader); - FPDF_BOOL PutRequestURL(const FX_WCHAR* wsURL, - const FX_WCHAR* wsData, - const FX_WCHAR* wsEncode); + CFX_RetainPtr<IFX_SeekableReadStream> DownloadFromURL(const wchar_t* url); + CFX_WideString PostRequestURL(const wchar_t* wsURL, + const wchar_t* wsData, + const wchar_t* wsContentType, + const wchar_t* wsEncode, + const wchar_t* wsHeader); + FPDF_BOOL PutRequestURL(const wchar_t* wsURL, + const wchar_t* wsData, + const wchar_t* wsEncode); CFX_WideString GetLanguage(); void PageEvent(int iPageCount, uint32_t dwEventType) const; @@ -157,29 +157,29 @@ class CPDFSDK_FormFillEnvironment CPDF_Document* GetPDFDocument() const { return m_pUnderlyingDoc; } #endif // PDF_ENABLE_XFA - int JS_appAlert(const FX_WCHAR* Msg, - const FX_WCHAR* Title, + int JS_appAlert(const wchar_t* Msg, + const wchar_t* Title, uint32_t Type, uint32_t Icon); - int JS_appResponse(const FX_WCHAR* Question, - const FX_WCHAR* Title, - const FX_WCHAR* Default, - const FX_WCHAR* cLabel, + int JS_appResponse(const wchar_t* Question, + const wchar_t* Title, + const wchar_t* Default, + const wchar_t* cLabel, FPDF_BOOL bPassword, void* response, int length); void JS_appBeep(int nType); CFX_WideString JS_fieldBrowse(); CFX_WideString JS_docGetFilePath(); - void JS_docSubmitForm(void* formData, int length, const FX_WCHAR* URL); + void JS_docSubmitForm(void* formData, int length, const wchar_t* URL); void JS_docmailForm(void* mailData, int length, FPDF_BOOL bUI, - const FX_WCHAR* To, - const FX_WCHAR* Subject, - const FX_WCHAR* CC, - const FX_WCHAR* BCC, - const FX_WCHAR* Msg); + const wchar_t* To, + const wchar_t* Subject, + const wchar_t* CC, + const wchar_t* BCC, + const wchar_t* Msg); void JS_docprint(FPDF_BOOL bUI, int nStart, int nEnd, diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp index cd86f7a0b5..e5df453d90 100644 --- a/fpdfsdk/cpdfsdk_widget.cpp +++ b/fpdfsdk/cpdfsdk_widget.cpp @@ -466,7 +466,7 @@ bool CPDFSDK_Widget::IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode) { return false; // Choose the right sub-ap - const FX_CHAR* ap_entry = "N"; + const char* ap_entry = "N"; if (mode == CPDF_Annot::Down) ap_entry = "D"; else if (mode == CPDF_Annot::Rollover) diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp index e649bacf49..06ea939b72 100644 --- a/fpdfsdk/fpdf_flatten.cpp +++ b/fpdfsdk/fpdf_flatten.cpp @@ -208,7 +208,7 @@ void SetPageContents(const CFX_ByteString& key, acc.LoadAllData(pContentsStream); CFX_ByteString sStream = "q\n"; CFX_ByteString sBody = - CFX_ByteString((const FX_CHAR*)acc.GetData(), acc.GetSize()); + CFX_ByteString((const char*)acc.GetData(), acc.GetSize()); sStream = sStream + sBody + "\nQ"; pContentsStream->SetData(sStream.raw_str(), sStream.GetLength()); pContentsArray->AddNew<CPDF_Reference>(pDocument, diff --git a/fpdfsdk/fpdf_structtree_embeddertest.cpp b/fpdfsdk/fpdf_structtree_embeddertest.cpp index 58b3172057..8ddde5317c 100644 --- a/fpdfsdk/fpdf_structtree_embeddertest.cpp +++ b/fpdfsdk/fpdf_structtree_embeddertest.cpp @@ -56,7 +56,7 @@ TEST_F(FPDFStructTreeEmbeddertest, GetAltText) { ASSERT_EQ(24U, FPDF_StructElement_GetAltText(gchild_element, buffer, sizeof(buffer))); - const FX_WCHAR kExpected[] = L"Black Image"; + const wchar_t kExpected[] = L"Black Image"; EXPECT_EQ(CFX_WideString(kExpected), CFX_WideString::FromUTF16LE(buffer, FXSYS_len(kExpected))); diff --git a/fpdfsdk/fpdf_sysfontinfo.cpp b/fpdfsdk/fpdf_sysfontinfo.cpp index 1b62dc48ac..5bce4b4cc4 100644 --- a/fpdfsdk/fpdf_sysfontinfo.cpp +++ b/fpdfsdk/fpdf_sysfontinfo.cpp @@ -35,7 +35,7 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo { bool bItalic, int charset, int pitch_family, - const FX_CHAR* family, + const char* family, int& iExact) override { if (!m_pInfo->MapFont) return nullptr; @@ -43,7 +43,7 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo { family, &iExact); } - void* GetFont(const FX_CHAR* family) override { + void* GetFont(const char* family) override { if (!m_pInfo->GetFont) return nullptr; return m_pInfo->GetFont(m_pInfo, family); diff --git a/fpdfsdk/fpdfdoc_embeddertest.cpp b/fpdfsdk/fpdfdoc_embeddertest.cpp index 3666687d4d..2472db9746 100644 --- a/fpdfsdk/fpdfdoc_embeddertest.cpp +++ b/fpdfsdk/fpdfdoc_embeddertest.cpp @@ -198,37 +198,37 @@ TEST_F(FPDFDocEmbeddertest, GetPageLabels) { EXPECT_EQ(0u, FPDF_GetPageLabel(document(), -2, buf, sizeof(buf))); EXPECT_EQ(0u, FPDF_GetPageLabel(document(), -1, buf, sizeof(buf))); - const FX_WCHAR kExpectedPageLabel0[] = L"i"; + const wchar_t kExpectedPageLabel0[] = L"i"; ASSERT_EQ(4u, FPDF_GetPageLabel(document(), 0, buf, sizeof(buf))); EXPECT_EQ(CFX_WideString(kExpectedPageLabel0), CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel0))); - const FX_WCHAR kExpectedPageLabel1[] = L"ii"; + const wchar_t kExpectedPageLabel1[] = L"ii"; ASSERT_EQ(6u, FPDF_GetPageLabel(document(), 1, buf, sizeof(buf))); EXPECT_EQ(CFX_WideString(kExpectedPageLabel1), CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel1))); - const FX_WCHAR kExpectedPageLabel2[] = L"1"; + const wchar_t kExpectedPageLabel2[] = L"1"; ASSERT_EQ(4u, FPDF_GetPageLabel(document(), 2, buf, sizeof(buf))); EXPECT_EQ(CFX_WideString(kExpectedPageLabel2), CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel2))); - const FX_WCHAR kExpectedPageLabel3[] = L"2"; + const wchar_t kExpectedPageLabel3[] = L"2"; ASSERT_EQ(4u, FPDF_GetPageLabel(document(), 3, buf, sizeof(buf))); EXPECT_EQ(CFX_WideString(kExpectedPageLabel3), CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel3))); - const FX_WCHAR kExpectedPageLabel4[] = L"zzA"; + const wchar_t kExpectedPageLabel4[] = L"zzA"; ASSERT_EQ(8u, FPDF_GetPageLabel(document(), 4, buf, sizeof(buf))); EXPECT_EQ(CFX_WideString(kExpectedPageLabel4), CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel4))); - const FX_WCHAR kExpectedPageLabel5[] = L"zzB"; + const wchar_t kExpectedPageLabel5[] = L"zzB"; ASSERT_EQ(8u, FPDF_GetPageLabel(document(), 5, buf, sizeof(buf))); EXPECT_EQ(CFX_WideString(kExpectedPageLabel5), CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel5))); - const FX_WCHAR kExpectedPageLabel6[] = L""; + const wchar_t kExpectedPageLabel6[] = L""; ASSERT_EQ(2u, FPDF_GetPageLabel(document(), 6, buf, sizeof(buf))); EXPECT_EQ(CFX_WideString(kExpectedPageLabel6), CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel6))); diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index 1e7a651aa8..9100017bea 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -490,7 +490,7 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, // NOTE: the creation of the file needs to be by the embedder on the // other side of this API. CFX_RetainPtr<IFX_SeekableReadStream> pFileAccess = - IFX_SeekableReadStream::CreateFromFilename((const FX_CHAR*)file_path); + IFX_SeekableReadStream::CreateFromFilename((const char*)file_path); if (!pFileAccess) return nullptr; diff --git a/fpdfsdk/fxedit/fxet_list.cpp b/fpdfsdk/fxedit/fxet_list.cpp index 39877c955f..3782cf0a33 100644 --- a/fpdfsdk/fxedit/fxet_list.cpp +++ b/fpdfsdk/fxedit/fxet_list.cpp @@ -728,13 +728,13 @@ int32_t CFX_ListCtrl::GetLastSelected() const { return -1; } -FX_WCHAR CFX_ListCtrl::Toupper(FX_WCHAR c) const { +wchar_t CFX_ListCtrl::Toupper(wchar_t c) const { if ((c >= 'a') && (c <= 'z')) c = c - ('a' - 'A'); return c; } -int32_t CFX_ListCtrl::FindNext(int32_t nIndex, FX_WCHAR nChar) const { +int32_t CFX_ListCtrl::FindNext(int32_t nIndex, wchar_t nChar) const { int32_t nCircleIndex = nIndex; for (int32_t i = 0, sz = m_aListItems.GetSize(); i < sz; i++) { diff --git a/fpdfsdk/fxedit/fxet_list.h b/fpdfsdk/fxedit/fxet_list.h index 01e18bc000..9d07187560 100644 --- a/fpdfsdk/fxedit/fxet_list.h +++ b/fpdfsdk/fxedit/fxet_list.h @@ -262,7 +262,7 @@ class CFX_ListCtrl : protected CFX_ListContainer { void SetMultipleSel(bool bMultiple); bool IsMultipleSel() const; bool IsValid(int32_t nItemIndex) const; - int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const; + int32_t FindNext(int32_t nIndex, wchar_t nChar) const; int32_t GetFirstSelected() const; CFX_PointF InToOut(const CFX_PointF& point) const; @@ -285,7 +285,7 @@ class CFX_ListCtrl : protected CFX_ListContainer { CFX_WideString GetItemText(int32_t nIndex) const; void SetItemSelect(int32_t nItemIndex, bool bSelected); int32_t GetLastSelected() const; - FX_WCHAR Toupper(FX_WCHAR c) const; + wchar_t Toupper(wchar_t c) const; CPWL_List_Notify* m_pNotify; bool m_bNotifyFlag; diff --git a/fpdfsdk/javascript/Consts.cpp b/fpdfsdk/javascript/Consts.cpp index 82f9b4c945..8c01ae0d48 100644 --- a/fpdfsdk/javascript/Consts.cpp +++ b/fpdfsdk/javascript/Consts.cpp @@ -139,7 +139,7 @@ void CJS_GlobalConsts::DefineJSObjects(CJS_Runtime* pRuntime) { #define GLOBAL_ARRAY(rt, name, ...) \ { \ - const FX_WCHAR* values[] = {__VA_ARGS__}; \ + const wchar_t* values[] = {__VA_ARGS__}; \ v8::Local<v8::Array> array = (rt)->NewArray(); \ for (size_t i = 0; i < FX_ArraySize(values); ++i) \ array->Set(i, (rt)->NewString(values[i])); \ diff --git a/fpdfsdk/javascript/JS_EventHandler.cpp b/fpdfsdk/javascript/JS_EventHandler.cpp index bd1c8e29d0..a63b7a82fe 100644 --- a/fpdfsdk/javascript/JS_EventHandler.cpp +++ b/fpdfsdk/javascript/JS_EventHandler.cpp @@ -435,7 +435,7 @@ bool CJS_EventHandler::Modifier() { return m_bModifier; } -const FX_WCHAR* CJS_EventHandler::Name() { +const wchar_t* CJS_EventHandler::Name() { switch (m_eEventType) { case JET_APP_INIT: return L"Init"; @@ -506,7 +506,7 @@ const FX_WCHAR* CJS_EventHandler::Name() { } } -const FX_WCHAR* CJS_EventHandler::Type() { +const wchar_t* CJS_EventHandler::Type() { switch (m_eEventType) { case JET_APP_INIT: return L"App"; diff --git a/fpdfsdk/javascript/JS_EventHandler.h b/fpdfsdk/javascript/JS_EventHandler.h index b9836b04e4..1e70a358bc 100644 --- a/fpdfsdk/javascript/JS_EventHandler.h +++ b/fpdfsdk/javascript/JS_EventHandler.h @@ -150,8 +150,8 @@ class CJS_EventHandler { bool FieldFull(); bool KeyDown(); bool Modifier(); - const FX_WCHAR* Name(); - const FX_WCHAR* Type(); + const wchar_t* Name(); + const wchar_t* Type(); bool& Rc(); int& SelEnd(); int& SelStart(); diff --git a/fpdfsdk/javascript/JS_GlobalData.cpp b/fpdfsdk/javascript/JS_GlobalData.cpp index 68d929fb3a..048fca0591 100644 --- a/fpdfsdk/javascript/JS_GlobalData.cpp +++ b/fpdfsdk/javascript/JS_GlobalData.cpp @@ -336,18 +336,18 @@ void CJS_GlobalData::SaveGlobalPersisitentVariables() { CRYPT_ArcFourCryptBlock(sFile.GetBuffer(), sFile.GetSize(), JS_RC4KEY, sizeof(JS_RC4KEY)); - WriteFileBuffer(m_sFilePath.c_str(), (const FX_CHAR*)sFile.GetBuffer(), + WriteFileBuffer(m_sFilePath.c_str(), (const char*)sFile.GetBuffer(), sFile.GetSize()); } -void CJS_GlobalData::LoadFileBuffer(const FX_WCHAR* sFilePath, +void CJS_GlobalData::LoadFileBuffer(const wchar_t* sFilePath, uint8_t*& pBuffer, int32_t& nLength) { // UnSupport. } -void CJS_GlobalData::WriteFileBuffer(const FX_WCHAR* sFilePath, - const FX_CHAR* pBuffer, +void CJS_GlobalData::WriteFileBuffer(const wchar_t* sFilePath, + const char* pBuffer, int32_t nLength) { // UnSupport. } diff --git a/fpdfsdk/javascript/JS_GlobalData.h b/fpdfsdk/javascript/JS_GlobalData.h index c8947cd580..c4e8e48b36 100644 --- a/fpdfsdk/javascript/JS_GlobalData.h +++ b/fpdfsdk/javascript/JS_GlobalData.h @@ -59,11 +59,11 @@ class CJS_GlobalData { iterator FindGlobalVariable(const CFX_ByteString& sPropname); const_iterator FindGlobalVariable(const CFX_ByteString& sPropname) const; - void LoadFileBuffer(const FX_WCHAR* sFilePath, + void LoadFileBuffer(const wchar_t* sFilePath, uint8_t*& pBuffer, int32_t& nLength); - void WriteFileBuffer(const FX_WCHAR* sFilePath, - const FX_CHAR* pBuffer, + void WriteFileBuffer(const wchar_t* sFilePath, + const char* pBuffer, int32_t nLength); void MakeByteString(const CFX_ByteString& name, CJS_KeyValue* pData, diff --git a/fpdfsdk/javascript/JS_Value.cpp b/fpdfsdk/javascript/JS_Value.cpp index b058847564..a0c286f68d 100644 --- a/fpdfsdk/javascript/JS_Value.cpp +++ b/fpdfsdk/javascript/JS_Value.cpp @@ -55,10 +55,10 @@ CJS_Value::CJS_Value(CJS_Runtime* pRuntime, CJS_Object* pObj) { m_pValue = pObj->ToV8Object(); } -CJS_Value::CJS_Value(CJS_Runtime* pRuntime, const FX_WCHAR* pWstr) +CJS_Value::CJS_Value(CJS_Runtime* pRuntime, const wchar_t* pWstr) : m_pValue(pRuntime->NewString(pWstr)) {} -CJS_Value::CJS_Value(CJS_Runtime* pRuntime, const FX_CHAR* pStr) +CJS_Value::CJS_Value(CJS_Runtime* pRuntime, const char* pStr) : m_pValue(pRuntime->NewString(CFX_WideString::FromLocal(pStr).c_str())) {} CJS_Value::CJS_Value(CJS_Runtime* pRuntime, const CJS_Array& array) @@ -267,7 +267,7 @@ void CJS_PropValue::operator>>(CFX_ByteString& str) const { str = m_Value.ToCFXByteString(m_pJSRuntime); } -void CJS_PropValue::operator<<(const FX_WCHAR* str) { +void CJS_PropValue::operator<<(const wchar_t* str) { ASSERT(!m_bIsSetting); m_Value = CJS_Value(m_pJSRuntime, str); } diff --git a/fpdfsdk/javascript/JS_Value.h b/fpdfsdk/javascript/JS_Value.h index 313f0c3e7b..0c19701587 100644 --- a/fpdfsdk/javascript/JS_Value.h +++ b/fpdfsdk/javascript/JS_Value.h @@ -38,8 +38,8 @@ class CJS_Value { CJS_Value(CJS_Runtime* pRuntime, const float& fValue); CJS_Value(CJS_Runtime* pRuntime, const bool& bValue); CJS_Value(CJS_Runtime* pRuntime, CJS_Object* pObj); - CJS_Value(CJS_Runtime* pRuntime, const FX_CHAR* pStr); - CJS_Value(CJS_Runtime* pRuntime, const FX_WCHAR* pWstr); + CJS_Value(CJS_Runtime* pRuntime, const char* pStr); + CJS_Value(CJS_Runtime* pRuntime, const wchar_t* pWstr); CJS_Value(CJS_Runtime* pRuntime, const CJS_Array& array); CJS_Value(CJS_Runtime* pRuntime, const CJS_Date& date); CJS_Value(CJS_Runtime* pRuntime, const CJS_Object* object); @@ -107,7 +107,7 @@ class CJS_PropValue { void operator>>(CFX_ByteString&) const; void operator<<(CFX_WideString); void operator>>(CFX_WideString&) const; - void operator<<(const FX_WCHAR* c_string); + void operator<<(const wchar_t* c_string); void operator<<(v8::Local<v8::Object>); void operator>>(v8::Local<v8::Object>&) const; void operator>>(CJS_Array& array) const; diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp index 3bcbc341ac..f479527ef6 100644 --- a/fpdfsdk/javascript/PublicMethods.cpp +++ b/fpdfsdk/javascript/PublicMethods.cpp @@ -59,14 +59,14 @@ IMPLEMENT_JS_STATIC_GLOBAL_FUN(CJS_PublicMethods) namespace { -const FX_WCHAR* const months[] = {L"Jan", L"Feb", L"Mar", L"Apr", - L"May", L"Jun", L"Jul", L"Aug", - L"Sep", L"Oct", L"Nov", L"Dec"}; +const wchar_t* const months[] = {L"Jan", L"Feb", L"Mar", L"Apr", + L"May", L"Jun", L"Jul", L"Aug", + L"Sep", L"Oct", L"Nov", L"Dec"}; -const FX_WCHAR* const fullmonths[] = {L"January", L"February", L"March", - L"April", L"May", L"June", - L"July", L"August", L"September", - L"October", L"November", L"December"}; +const wchar_t* const fullmonths[] = {L"January", L"February", L"March", + L"April", L"May", L"June", + L"July", L"August", L"September", + L"October", L"November", L"December"}; CFX_ByteString StrTrim(const CFX_ByteString& pStr) { CFX_ByteString result(pStr); @@ -82,7 +82,7 @@ CFX_WideString StrTrim(const CFX_WideString& pStr) { return result; } -void AlertIfPossible(CJS_EventContext* pContext, const FX_WCHAR* swMsg) { +void AlertIfPossible(CJS_EventContext* pContext, const wchar_t* swMsg) { CPDFSDK_FormFillEnvironment* pFormFillEnv = pContext->GetFormFillEnv(); if (pFormFillEnv) pFormFillEnv->JS_appAlert(swMsg, nullptr, 0, 3); @@ -115,8 +115,8 @@ CFX_ByteString CalculateString(double dValue, bool CJS_PublicMethods::IsNumber(const CFX_WideString& str) { CFX_WideString sTrim = StrTrim(str); - const FX_WCHAR* pTrim = sTrim.c_str(); - const FX_WCHAR* p = pTrim; + const wchar_t* pTrim = sTrim.c_str(); + const wchar_t* p = pTrim; bool bDot = false; bool bKXJS = false; @@ -168,7 +168,7 @@ bool CJS_PublicMethods::isReservedMaskChar(wchar_t ch) { return ch == L'9' || ch == L'A' || ch == L'O' || ch == L'X'; } -double CJS_PublicMethods::AF_Simple(const FX_WCHAR* sFuction, +double CJS_PublicMethods::AF_Simple(const wchar_t* sFuction, double dValue1, double dValue2) { if (FXSYS_wcsicmp(sFuction, L"AVG") == 0 || @@ -235,7 +235,7 @@ int CJS_PublicMethods::ParseStringInteger(const CFX_WideString& str, if (i - nStart > 10) break; - FX_WCHAR c = str.GetAt(i); + wchar_t c = str.GetAt(i); if (!FXSYS_iswdigit(c)) break; @@ -254,7 +254,7 @@ CFX_WideString CJS_PublicMethods::ParseStringString(const CFX_WideString& str, CFX_WideString swRet; nSkip = 0; for (int i = nStart, sz = str.GetLength(); i < sz; i++) { - FX_WCHAR c = str.GetAt(i); + wchar_t c = str.GetAt(i); if (!FXSYS_iswdigit(c)) break; @@ -286,7 +286,7 @@ double CJS_PublicMethods::ParseNormalDate(const CFX_WideString& value, if (nIndex > 2) break; - FX_WCHAR c = value.GetAt(i); + wchar_t c = value.GetAt(i); if (FXSYS_iswdigit(c)) { number[nIndex++] = ParseStringInteger(value, i, nSkip, 4); i += nSkip; @@ -373,7 +373,7 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value, if (bExit) break; - FX_WCHAR c = format.GetAt(i); + wchar_t c = format.GetAt(i); switch (c) { case ':': case '.': @@ -630,7 +630,7 @@ CFX_WideString CJS_PublicMethods::MakeFormatDate(double dDate, int i = 0; while (i < format.GetLength()) { - FX_WCHAR c = format.GetAt(i); + wchar_t c = format.GetAt(i); int remaining = format.GetLength() - i - 1; sPart = L""; switch (c) { @@ -946,7 +946,7 @@ bool CJS_PublicMethods::AFNumber_Keystroke(CJS_Runtime* pRuntime, int iSepStyle = params[1].ToInt(pRuntime); if (iSepStyle < 0 || iSepStyle > 3) iSepStyle = 0; - const FX_WCHAR cSep = iSepStyle < 2 ? L'.' : L','; + const wchar_t cSep = iSepStyle < 2 ? L'.' : L','; bool bHasSep = wstrValue.Find(cSep) != -1; for (FX_STRSIZE i = 0; i < wstrChange.GetLength(); ++i) { @@ -1142,7 +1142,7 @@ double CJS_PublicMethods::MakeInterDate(const CFX_WideString& strValue) { std::vector<CFX_WideString> wsArray; CFX_WideString sTemp = L""; for (int i = 0; i < strValue.GetLength(); ++i) { - FX_WCHAR c = strValue.GetAt(i); + wchar_t c = strValue.GetAt(i); if (c == L' ' || c == L':') { wsArray.push_back(sTemp); sTemp = L""; @@ -1239,20 +1239,20 @@ bool CJS_PublicMethods::AFDate_Format(CJS_Runtime* pRuntime, } int iIndex = params[0].ToInt(pRuntime); - const FX_WCHAR* cFormats[] = {L"m/d", - L"m/d/yy", - L"mm/dd/yy", - L"mm/yy", - L"d-mmm", - L"d-mmm-yy", - L"dd-mmm-yy", - L"yy-mm-dd", - L"mmm-yy", - L"mmmm-yy", - L"mmm d, yyyy", - L"mmmm d, yyyy", - L"m/d/yy h:MM tt", - L"m/d/yy HH:MM"}; + const wchar_t* cFormats[] = {L"m/d", + L"m/d/yy", + L"mm/dd/yy", + L"mm/yy", + L"d-mmm", + L"d-mmm-yy", + L"dd-mmm-yy", + L"yy-mm-dd", + L"mmm-yy", + L"mmmm-yy", + L"mmm d, yyyy", + L"mmmm d, yyyy", + L"m/d/yy h:MM tt", + L"m/d/yy HH:MM"}; if (iIndex < 0 || (static_cast<size_t>(iIndex) >= FX_ArraySize(cFormats))) iIndex = 0; @@ -1273,20 +1273,20 @@ bool CJS_PublicMethods::AFDate_Keystroke(CJS_Runtime* pRuntime, } int iIndex = params[0].ToInt(pRuntime); - const FX_WCHAR* cFormats[] = {L"m/d", - L"m/d/yy", - L"mm/dd/yy", - L"mm/yy", - L"d-mmm", - L"d-mmm-yy", - L"dd-mmm-yy", - L"yy-mm-dd", - L"mmm-yy", - L"mmmm-yy", - L"mmm d, yyyy", - L"mmmm d, yyyy", - L"m/d/yy h:MM tt", - L"m/d/yy HH:MM"}; + const wchar_t* cFormats[] = {L"m/d", + L"m/d/yy", + L"mm/dd/yy", + L"mm/yy", + L"d-mmm", + L"d-mmm-yy", + L"dd-mmm-yy", + L"yy-mm-dd", + L"mmm-yy", + L"mmmm-yy", + L"mmm d, yyyy", + L"mmmm d, yyyy", + L"m/d/yy h:MM tt", + L"m/d/yy HH:MM"}; if (iIndex < 0 || (static_cast<size_t>(iIndex) >= FX_ArraySize(cFormats))) iIndex = 0; @@ -1307,8 +1307,8 @@ bool CJS_PublicMethods::AFTime_Format(CJS_Runtime* pRuntime, } int iIndex = params[0].ToInt(pRuntime); - const FX_WCHAR* cFormats[] = {L"HH:MM", L"h:MM tt", L"HH:MM:ss", - L"h:MM:ss tt"}; + const wchar_t* cFormats[] = {L"HH:MM", L"h:MM tt", L"HH:MM:ss", + L"h:MM:ss tt"}; if (iIndex < 0 || (static_cast<size_t>(iIndex) >= FX_ArraySize(cFormats))) iIndex = 0; @@ -1328,8 +1328,8 @@ bool CJS_PublicMethods::AFTime_Keystroke(CJS_Runtime* pRuntime, } int iIndex = params[0].ToInt(pRuntime); - const FX_WCHAR* cFormats[] = {L"HH:MM", L"h:MM tt", L"HH:MM:ss", - L"h:MM:ss tt"}; + const wchar_t* cFormats[] = {L"HH:MM", L"h:MM tt", L"HH:MM:ss", + L"h:MM:ss tt"}; if (iIndex < 0 || (static_cast<size_t>(iIndex) >= FX_ArraySize(cFormats))) iIndex = 0; @@ -1461,7 +1461,7 @@ bool CJS_PublicMethods::AFSpecial_KeystrokeEx( pEvent->Rc() = false; return true; } - FX_WCHAR wMask = wstrMask[iIndexMask]; + wchar_t wMask = wstrMask[iIndexMask]; if (!isReservedMaskChar(wMask)) wChange.SetAt(i, wMask); @@ -1776,7 +1776,7 @@ bool CJS_PublicMethods::AFExtractNums(CJS_Runtime* pRuntime, CJS_Array nums; int nIndex = 0; for (int i = 0, sz = str.GetLength(); i < sz; i++) { - FX_WCHAR wc = str.GetAt(i); + wchar_t wc = str.GetAt(i); if (FXSYS_iswdigit(wc)) { sPart += wc; } else { diff --git a/fpdfsdk/javascript/PublicMethods.h b/fpdfsdk/javascript/PublicMethods.h index 060c74303a..0f6123cd17 100644 --- a/fpdfsdk/javascript/PublicMethods.h +++ b/fpdfsdk/javascript/PublicMethods.h @@ -153,7 +153,7 @@ class CJS_PublicMethods : public CJS_Object { static bool maskSatisfied(wchar_t c_Change, wchar_t c_Mask); static bool isReservedMaskChar(wchar_t ch); - static double AF_Simple(const FX_WCHAR* sFuction, + static double AF_Simple(const wchar_t* sFuction, double dValue1, double dValue2); static CJS_Array AF_MakeArrayFromList(CJS_Runtime* pRuntime, CJS_Value val); diff --git a/fpdfsdk/javascript/cjs_runtime.cpp b/fpdfsdk/javascript/cjs_runtime.cpp index 1ece0b6f79..a6da9c494a 100644 --- a/fpdfsdk/javascript/cjs_runtime.cpp +++ b/fpdfsdk/javascript/cjs_runtime.cpp @@ -221,7 +221,7 @@ CFX_WideString ChangeObjName(const CFX_WideString& str) { } bool CJS_Runtime::GetValueByName(const CFX_ByteStringC& utf8Name, CFXJSE_Value* pValue) { - const FX_CHAR* name = utf8Name.c_str(); + const char* name = utf8Name.c_str(); v8::Isolate::Scope isolate_scope(GetIsolate()); v8::HandleScope handle_scope(GetIsolate()); @@ -243,7 +243,7 @@ bool CJS_Runtime::SetValueByName(const CFX_ByteStringC& utf8Name, CFXJSE_Value* pValue) { if (utf8Name.IsEmpty() || !pValue) return false; - const FX_CHAR* name = utf8Name.c_str(); + const char* name = utf8Name.c_str(); v8::Isolate* pIsolate = GetIsolate(); v8::Isolate::Scope isolate_scope(pIsolate); v8::HandleScope handle_scope(pIsolate); diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp index a450606b1a..92fbc9eec6 100644 --- a/fpdfsdk/javascript/global.cpp +++ b/fpdfsdk/javascript/global.cpp @@ -60,12 +60,12 @@ void JSGlobalAlternate::Initial(CPDFSDK_FormFillEnvironment* pFormFillEnv) { UpdateGlobalPersistentVariables(); } -bool JSGlobalAlternate::QueryProperty(const FX_WCHAR* propname) { +bool JSGlobalAlternate::QueryProperty(const wchar_t* propname) { return CFX_WideString(propname) != L"setPersistent"; } bool JSGlobalAlternate::DelProperty(CJS_Runtime* pRuntime, - const FX_WCHAR* propname, + const wchar_t* propname, CFX_WideString& sError) { auto it = m_mapGlobal.find(CFX_ByteString::FromUnicode(propname)); if (it == m_mapGlobal.end()) @@ -76,7 +76,7 @@ bool JSGlobalAlternate::DelProperty(CJS_Runtime* pRuntime, } bool JSGlobalAlternate::DoProperty(CJS_Runtime* pRuntime, - const FX_WCHAR* propname, + const wchar_t* propname, CJS_PropValue& vp, CFX_WideString& sError) { if (vp.IsSetting()) { diff --git a/fpdfsdk/javascript/global.h b/fpdfsdk/javascript/global.h index e313929bea..7c002488d2 100644 --- a/fpdfsdk/javascript/global.h +++ b/fpdfsdk/javascript/global.h @@ -39,13 +39,13 @@ class JSGlobalAlternate : public CJS_EmbedObj { const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - bool QueryProperty(const FX_WCHAR* propname); + bool QueryProperty(const wchar_t* propname); bool DoProperty(CJS_Runtime* pRuntime, - const FX_WCHAR* propname, + const wchar_t* propname, CJS_PropValue& vp, CFX_WideString& sError); bool DelProperty(CJS_Runtime* pRuntime, - const FX_WCHAR* propname, + const wchar_t* propname, CFX_WideString& sError); void Initial(CPDFSDK_FormFillEnvironment* pFormFillEnv); diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp index 3221cfb0cb..32104b41a6 100644 --- a/fpdfsdk/javascript/util.cpp +++ b/fpdfsdk/javascript/util.cpp @@ -46,14 +46,14 @@ namespace { // Map PDF-style directives to equivalent wcsftime directives. Not // all have direct equivalents, though. struct TbConvert { - const FX_WCHAR* lpszJSMark; - const FX_WCHAR* lpszCppMark; + const wchar_t* lpszJSMark; + const wchar_t* lpszCppMark; }; // Map PDF-style directives lacking direct wcsftime directives to // the value with which they will be replaced. struct TbConvertAdditional { - const FX_WCHAR* lpszJSMark; + const wchar_t* lpszJSMark; int iValue; }; @@ -318,7 +318,7 @@ bool util::printx(CJS_Runtime* pRuntime, enum CaseMode { kPreserveCase, kUpperCase, kLowerCase }; -static FX_WCHAR TranslateCase(FX_WCHAR input, CaseMode eMode) { +static wchar_t TranslateCase(wchar_t input, CaseMode eMode) { if (eMode == kLowerCase && input >= 'A' && input <= 'Z') return input | 0x20; if (eMode == kUpperCase && input >= 'a' && input <= 'z') @@ -456,7 +456,7 @@ bool util::byteToChar(CJS_Runtime* pRuntime, return false; } - CFX_WideString wStr(static_cast<FX_WCHAR>(arg)); + CFX_WideString wStr(static_cast<wchar_t>(arg)); vRet = CJS_Value(pRuntime, wStr.c_str()); return true; } diff --git a/fpdfsdk/pdfwindow/PWL_Icon.cpp b/fpdfsdk/pdfwindow/PWL_Icon.cpp index b0d0c7686d..4ce63299e4 100644 --- a/fpdfsdk/pdfwindow/PWL_Icon.cpp +++ b/fpdfsdk/pdfwindow/PWL_Icon.cpp @@ -96,7 +96,7 @@ CFX_ByteString CPWL_Image::GetImageAlias() { return CFX_ByteString(); } -void CPWL_Image::SetImageAlias(const FX_CHAR* sImageAlias) { +void CPWL_Image::SetImageAlias(const char* sImageAlias) { m_sImageAlias = sImageAlias; } diff --git a/fpdfsdk/pdfwindow/PWL_Icon.h b/fpdfsdk/pdfwindow/PWL_Icon.h index 4b62db4c99..bdcae9f7bd 100644 --- a/fpdfsdk/pdfwindow/PWL_Icon.h +++ b/fpdfsdk/pdfwindow/PWL_Icon.h @@ -26,7 +26,7 @@ class CPWL_Image : public CPWL_Wnd { void GetImageSize(FX_FLOAT& fWidth, FX_FLOAT& fHeight); CFX_Matrix GetImageMatrix(); CFX_ByteString GetImageAlias(); - void SetImageAlias(const FX_CHAR* sImageAlias); + void SetImageAlias(const char* sImageAlias); protected: CPDF_Stream* m_pPDFStream; diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp index ed96e203fd..18b45b5c3f 100644 --- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp @@ -428,7 +428,7 @@ int32_t CPWL_ListBox::GetCount() const { return m_pList->GetCount(); } -int32_t CPWL_ListBox::FindNext(int32_t nIndex, FX_WCHAR nChar) const { +int32_t CPWL_ListBox::FindNext(int32_t nIndex, wchar_t nChar) const { return m_pList->FindNext(nIndex, nChar); } diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.h b/fpdfsdk/pdfwindow/PWL_ListBox.h index f9108a17de..fa78b37bcb 100644 --- a/fpdfsdk/pdfwindow/PWL_ListBox.h +++ b/fpdfsdk/pdfwindow/PWL_ListBox.h @@ -92,7 +92,7 @@ class CPWL_ListBox : public CPWL_Wnd { int32_t GetCurSel() const; bool IsItemSelected(int32_t nItemIndex) const; int32_t GetTopVisibleIndex() const; - int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const; + int32_t FindNext(int32_t nIndex, wchar_t nChar) const; CFX_FloatRect GetContentRect() const; FX_FLOAT GetFirstHeight() const; CFX_FloatRect GetListRect() const; diff --git a/fxjs/cfxjse_context.cpp b/fxjs/cfxjse_context.cpp index d82f875e0f..076e6cf2b1 100644 --- a/fxjs/cfxjse_context.cpp +++ b/fxjs/cfxjse_context.cpp @@ -11,7 +11,7 @@ namespace { -const FX_CHAR szCompatibleModeScript[] = +const char szCompatibleModeScript[] = "(function(global, list) {\n" " 'use strict';\n" " var objname;\n" @@ -202,7 +202,7 @@ void CFXJSE_Context::EnableCompatibleMode() { ExecuteScript(szCompatibleModeScript, nullptr, nullptr); } -bool CFXJSE_Context::ExecuteScript(const FX_CHAR* szScript, +bool CFXJSE_Context::ExecuteScript(const char* szScript, CFXJSE_Value* lpRetValue, CFXJSE_Value* lpNewThisObject) { CFXJSE_ScopeUtil_IsolateHandleContext scope(this); diff --git a/fxjs/cfxjse_context.h b/fxjs/cfxjse_context.h index a694514770..7b83aee4aa 100644 --- a/fxjs/cfxjse_context.h +++ b/fxjs/cfxjse_context.h @@ -30,7 +30,7 @@ class CFXJSE_Context { v8::Isolate* GetRuntime() { return m_pIsolate; } std::unique_ptr<CFXJSE_Value> GetGlobalObject(); void EnableCompatibleMode(); - bool ExecuteScript(const FX_CHAR* szScript, + bool ExecuteScript(const char* szScript, CFXJSE_Value* lpRetValue, CFXJSE_Value* lpNewThisObject = nullptr); diff --git a/fxjs/fxjse.h b/fxjs/fxjse.h index 069a3b29a3..a29c0893af 100644 --- a/fxjs/fxjse.h +++ b/fxjs/fxjse.h @@ -39,18 +39,18 @@ enum FXJSE_ClassPropTypes { }; struct FXJSE_FUNCTION_DESCRIPTOR { - const FX_CHAR* name; + const char* name; FXJSE_FuncCallback callbackProc; }; struct FXJSE_PROPERTY_DESCRIPTOR { - const FX_CHAR* name; + const char* name; FXJSE_PropAccessor getProc; FXJSE_PropAccessor setProc; }; struct FXJSE_CLASS_DESCRIPTOR { - const FX_CHAR* name; + const char* name; FXJSE_FuncCallback constructor; const FXJSE_PROPERTY_DESCRIPTOR* properties; const FXJSE_FUNCTION_DESCRIPTOR* methods; diff --git a/xfa/fde/cfde_txtedtbuf.cpp b/xfa/fde/cfde_txtedtbuf.cpp index 1c2e0d1f3f..ba9f5cdca0 100644 --- a/xfa/fde/cfde_txtedtbuf.cpp +++ b/xfa/fde/cfde_txtedtbuf.cpp @@ -44,7 +44,7 @@ void CFDE_TxtEdtBuf::SetText(const CFX_WideString& wsText) { m_chunks.push_back(NewChunk()); int32_t nTotalCount = m_chunks.size(); - const FX_WCHAR* lpSrcBuf = wsText.c_str(); + const wchar_t* lpSrcBuf = wsText.c_str(); int32_t nLeave = nTextLength; int32_t nCopyedLength = GetChunkSize(); for (i = 0; i < nTotalCount && nLeave > 0; i++) { @@ -54,7 +54,7 @@ void CFDE_TxtEdtBuf::SetText(const CFX_WideString& wsText) { ChunkHeader* chunk = m_chunks[i].get(); FXSYS_memcpy(chunk->wChars.get(), lpSrcBuf, - nCopyedLength * sizeof(FX_WCHAR)); + nCopyedLength * sizeof(wchar_t)); nLeave -= nCopyedLength; lpSrcBuf += nCopyedLength; chunk->nUsed = nCopyedLength; @@ -66,7 +66,7 @@ CFX_WideString CFDE_TxtEdtBuf::GetText() const { return GetRange(0, m_nTotal); } -FX_WCHAR CFDE_TxtEdtBuf::GetCharByIndex(int32_t nIndex) const { +wchar_t CFDE_TxtEdtBuf::GetCharByIndex(int32_t nIndex) const { ASSERT(nIndex >= 0 && nIndex < GetTextLength()); ChunkHeader* pChunkHeader = nullptr; @@ -79,7 +79,7 @@ FX_WCHAR CFDE_TxtEdtBuf::GetCharByIndex(int32_t nIndex) const { } ASSERT(pChunkHeader); - FX_WCHAR* buf = pChunkHeader->wChars.get(); + wchar_t* buf = pChunkHeader->wChars.get(); return buf[pChunkHeader->nUsed - (nTotal - nIndex)]; } @@ -98,17 +98,17 @@ CFX_WideString CFDE_TxtEdtBuf::GetRange(int32_t nBegin, int32_t nLength) const { int32_t nCount = m_chunks.size(); CFX_WideString wsText; - FX_WCHAR* lpDstBuf = wsText.GetBuffer(nLength); + wchar_t* lpDstBuf = wsText.GetBuffer(nLength); int32_t nChunkIndex = chunkIndex; ChunkHeader* chunkHeader = m_chunks[nChunkIndex].get(); int32_t nCopyLength = chunkHeader->nUsed - charIndex; - FX_WCHAR* lpSrcBuf = chunkHeader->wChars.get() + charIndex; + wchar_t* lpSrcBuf = chunkHeader->wChars.get() + charIndex; while (nLeave > 0) { if (nLeave <= nCopyLength) { nCopyLength = nLeave; } - FXSYS_memcpy(lpDstBuf, lpSrcBuf, nCopyLength * sizeof(FX_WCHAR)); + FXSYS_memcpy(lpDstBuf, lpSrcBuf, nCopyLength * sizeof(wchar_t)); nChunkIndex++; if (nChunkIndex >= nCount) { break; @@ -125,7 +125,7 @@ CFX_WideString CFDE_TxtEdtBuf::GetRange(int32_t nBegin, int32_t nLength) const { } void CFDE_TxtEdtBuf::Insert(int32_t nPos, - const FX_WCHAR* lpText, + const wchar_t* lpText, int32_t nLength) { ASSERT(nPos >= 0 && nPos <= m_nTotal); ASSERT(nLength > 0); @@ -142,7 +142,7 @@ void CFDE_TxtEdtBuf::Insert(int32_t nPos, int32_t nCopy = chunk->nUsed - charIndex; FXSYS_memcpy(newChunk->wChars.get(), chunk->wChars.get() + charIndex, - nCopy * sizeof(FX_WCHAR)); + nCopy * sizeof(wchar_t)); chunk->nUsed -= nCopy; chunkIndex++; @@ -158,7 +158,7 @@ void CFDE_TxtEdtBuf::Insert(int32_t nPos, int32_t nFree = GetChunkSize() - chunk->nUsed; int32_t nCopy = std::min(nLengthTemp, nFree); FXSYS_memcpy(chunk->wChars.get() + chunk->nUsed, lpText, - nCopy * sizeof(FX_WCHAR)); + nCopy * sizeof(wchar_t)); lpText += nCopy; nLengthTemp -= nCopy; chunk->nUsed += nCopy; @@ -170,7 +170,7 @@ void CFDE_TxtEdtBuf::Insert(int32_t nPos, auto chunk = NewChunk(); int32_t nCopy = std::min(nLengthTemp, GetChunkSize()); - FXSYS_memcpy(chunk->wChars.get(), lpText, nCopy * sizeof(FX_WCHAR)); + FXSYS_memcpy(chunk->wChars.get(), lpText, nCopy * sizeof(wchar_t)); lpText += nCopy; nLengthTemp -= nCopy; chunk->nUsed = nCopy; @@ -195,7 +195,7 @@ void CFDE_TxtEdtBuf::Delete(int32_t nIndex, int32_t nLength) { int32_t nDelete = std::min(nFirstPart, nLength); FXSYS_memmove(chunk->wChars.get() + nFirstPart - nDelete, chunk->wChars.get() + nFirstPart, - nMovePart * sizeof(FX_WCHAR)); + nMovePart * sizeof(wchar_t)); chunk->nUsed -= nDelete; nLength -= nDelete; endChunkIndex--; @@ -255,7 +255,7 @@ std::tuple<int32_t, int32_t> CFDE_TxtEdtBuf::Index2CP(int32_t nIndex) const { std::unique_ptr<CFDE_TxtEdtBuf::ChunkHeader> CFDE_TxtEdtBuf::NewChunk() { auto chunk = pdfium::MakeUnique<ChunkHeader>(); - chunk->wChars.reset(FX_Alloc(FX_WCHAR, GetChunkSize())); + chunk->wChars.reset(FX_Alloc(wchar_t, GetChunkSize())); chunk->nUsed = 0; return chunk; } @@ -264,7 +264,7 @@ CFDE_TxtEdtBuf::ChunkHeader::ChunkHeader() {} CFDE_TxtEdtBuf::ChunkHeader::~ChunkHeader() {} -CFDE_TxtEdtBuf::Iterator::Iterator(CFDE_TxtEdtBuf* pBuf, FX_WCHAR wcAlias) +CFDE_TxtEdtBuf::Iterator::Iterator(CFDE_TxtEdtBuf* pBuf, wchar_t wcAlias) : m_pBuf(pBuf), m_nCurChunk(0), m_nCurIndex(0), @@ -332,10 +332,10 @@ int32_t CFDE_TxtEdtBuf::Iterator::GetAt() const { return m_nIndex; } -FX_WCHAR CFDE_TxtEdtBuf::Iterator::GetChar() { +wchar_t CFDE_TxtEdtBuf::Iterator::GetChar() { ASSERT(m_nIndex >= 0 && m_nIndex < m_pBuf->m_nTotal); if (m_Alias == 0 || m_nIndex == (m_pBuf->m_nTotal - 1)) { - FX_WCHAR* buf = m_pBuf->m_chunks[m_nCurChunk]->wChars.get(); + wchar_t* buf = m_pBuf->m_chunks[m_nCurChunk]->wChars.get(); return buf[m_nCurIndex]; } return m_Alias; diff --git a/xfa/fde/cfde_txtedtbuf.h b/xfa/fde/cfde_txtedtbuf.h index 9eeee5632e..6a20ae0de1 100644 --- a/xfa/fde/cfde_txtedtbuf.h +++ b/xfa/fde/cfde_txtedtbuf.h @@ -21,11 +21,11 @@ class CFDE_TxtEdtBuf { public: class Iterator : public IFX_CharIter { public: - explicit Iterator(CFDE_TxtEdtBuf* pBuf, FX_WCHAR wcAlias = 0); + explicit Iterator(CFDE_TxtEdtBuf* pBuf, wchar_t wcAlias = 0); ~Iterator() override; bool Next(bool bPrev = false) override; - FX_WCHAR GetChar() override; + wchar_t GetChar() override; void SetAt(int32_t nIndex) override; int32_t GetAt() const override; @@ -38,7 +38,7 @@ class CFDE_TxtEdtBuf { int32_t m_nCurChunk; int32_t m_nCurIndex; int32_t m_nIndex; - FX_WCHAR m_Alias; + wchar_t m_Alias; }; CFDE_TxtEdtBuf(); @@ -50,10 +50,10 @@ class CFDE_TxtEdtBuf { void SetText(const CFX_WideString& wsText); CFX_WideString GetText() const; - FX_WCHAR GetCharByIndex(int32_t nIndex) const; + wchar_t GetCharByIndex(int32_t nIndex) const; CFX_WideString GetRange(int32_t nBegin, int32_t nCount) const; - void Insert(int32_t nPos, const FX_WCHAR* lpText, int32_t nLength); + void Insert(int32_t nPos, const wchar_t* lpText, int32_t nLength); void Delete(int32_t nIndex, int32_t nLength); void Clear(bool bRelease); @@ -67,7 +67,7 @@ class CFDE_TxtEdtBuf { ~ChunkHeader(); int32_t nUsed; - std::unique_ptr<FX_WCHAR, FxFreeDeleter> wChars; + std::unique_ptr<wchar_t, FxFreeDeleter> wChars; }; void SetChunkSizeForTesting(size_t size); diff --git a/xfa/fde/cfde_txtedtdorecord_insert.cpp b/xfa/fde/cfde_txtedtdorecord_insert.cpp index b80b15dff6..0e3f9218dd 100644 --- a/xfa/fde/cfde_txtedtdorecord_insert.cpp +++ b/xfa/fde/cfde_txtedtdorecord_insert.cpp @@ -12,12 +12,12 @@ CFDE_TxtEdtDoRecord_Insert::CFDE_TxtEdtDoRecord_Insert( CFDE_TxtEdtEngine* pEngine, int32_t nCaret, - const FX_WCHAR* lpText, + const wchar_t* lpText, int32_t nLength) : m_pEngine(pEngine), m_nCaret(nCaret) { ASSERT(pEngine); - FX_WCHAR* lpBuffer = m_wsInsert.GetBuffer(nLength); - FXSYS_memcpy(lpBuffer, lpText, nLength * sizeof(FX_WCHAR)); + wchar_t* lpBuffer = m_wsInsert.GetBuffer(nLength); + FXSYS_memcpy(lpBuffer, lpText, nLength * sizeof(wchar_t)); m_wsInsert.ReleaseBuffer(); } diff --git a/xfa/fde/cfde_txtedtdorecord_insert.h b/xfa/fde/cfde_txtedtdorecord_insert.h index e80453e9e3..05922378d3 100644 --- a/xfa/fde/cfde_txtedtdorecord_insert.h +++ b/xfa/fde/cfde_txtedtdorecord_insert.h @@ -17,7 +17,7 @@ class CFDE_TxtEdtDoRecord_Insert : public IFDE_TxtEdtDoRecord { public: CFDE_TxtEdtDoRecord_Insert(CFDE_TxtEdtEngine* pEngine, int32_t nCaret, - const FX_WCHAR* lpText, + const wchar_t* lpText, int32_t nLength); ~CFDE_TxtEdtDoRecord_Insert() override; diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp index 0a955ff60f..33efa2ddf0 100644 --- a/xfa/fde/cfde_txtedtengine.cpp +++ b/xfa/fde/cfde_txtedtengine.cpp @@ -122,7 +122,7 @@ void CFDE_TxtEdtEngine::SetTextByStream( int32_t nPos = pStream->GetBOM(bom); pStream->Seek(FX_STREAMSEEK_Begin, nPos); int32_t nPlateSize = std::min(nStreamLength, m_pTxtBuf->GetChunkSize()); - FX_WCHAR* lpwstr = FX_Alloc(FX_WCHAR, nPlateSize); + wchar_t* lpwstr = FX_Alloc(wchar_t, nPlateSize); bool bEos = false; while (!bEos) { int32_t nRead = pStream->ReadString(lpwstr, nPlateSize, bEos); @@ -142,8 +142,8 @@ void CFDE_TxtEdtEngine::SetText(const CFX_WideString& wsText) { int32_t nLength = wsText.GetLength(); if (nLength > 0) { CFX_WideString wsTemp; - FX_WCHAR* lpBuffer = wsTemp.GetBuffer(nLength); - FXSYS_memcpy(lpBuffer, wsText.c_str(), nLength * sizeof(FX_WCHAR)); + wchar_t* lpBuffer = wsTemp.GetBuffer(nLength); + FXSYS_memcpy(lpBuffer, wsText.c_str(), nLength * sizeof(wchar_t)); ReplaceParagEnd(lpBuffer, nLength, false); wsTemp.ReleaseBuffer(nLength); if (m_nLimit > 0 && nLength > m_nLimit) { @@ -315,14 +315,14 @@ bool CFDE_TxtEdtEngine::IsLocked() const { } int32_t CFDE_TxtEdtEngine::Insert(int32_t nStart, - const FX_WCHAR* lpText, + const wchar_t* lpText, int32_t nLength) { if (IsLocked()) { return FDE_TXTEDT_MODIFY_RET_F_Locked; } CFX_WideString wsTemp; - FX_WCHAR* lpBuffer = wsTemp.GetBuffer(nLength); - FXSYS_memcpy(lpBuffer, lpText, nLength * sizeof(FX_WCHAR)); + wchar_t* lpBuffer = wsTemp.GetBuffer(nLength); + FXSYS_memcpy(lpBuffer, lpText, nLength * sizeof(wchar_t)); ReplaceParagEnd(lpBuffer, nLength, false); wsTemp.ReleaseBuffer(nLength); bool bPart = false; @@ -349,7 +349,7 @@ int32_t CFDE_TxtEdtEngine::Insert(int32_t nStart, while (nLength > 0) { CFX_WideString wsText = GetPreInsertText(m_nCaret, lpBuffer, nLength); int32_t nTotal = wsText.GetLength(); - FX_WCHAR* lpBuf = wsText.GetBuffer(nTotal); + wchar_t* lpBuf = wsText.GetBuffer(nTotal); for (int32_t i = 0; i < nTotal; i++) { lpBuf[i] = m_wcAliasChar; } @@ -393,7 +393,7 @@ int32_t CFDE_TxtEdtEngine::Insert(int32_t nStart, m_ChangeInfo.wsInsert = CFX_WideString(lpBuffer, nLength); nStart = m_nCaret; nStart += nLength; - FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nStart - 1); + wchar_t wChar = m_pTxtBuf->GetCharByIndex(nStart - 1); bool bBefore = true; if (wChar != L'\n' && wChar != L'\r') { nStart--; @@ -498,7 +498,7 @@ int32_t CFDE_TxtEdtEngine::Replace(int32_t nStart, m_ChangeInfo.wsInsert = CFX_WideString(wsReplace.c_str(), nTextLength); nStart += nTextLength; - FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nStart - 1); + wchar_t wChar = m_pTxtBuf->GetCharByIndex(nStart - 1); bool bBefore = true; if (wChar != L'\n' && wChar != L'\r') { nStart--; @@ -515,7 +515,7 @@ void CFDE_TxtEdtEngine::SetLimit(int32_t nLimit) { m_nLimit = nLimit; } -void CFDE_TxtEdtEngine::SetAliasChar(FX_WCHAR wcAlias) { +void CFDE_TxtEdtEngine::SetAliasChar(wchar_t wcAlias) { m_wcAliasChar = wcAlias; } @@ -733,7 +733,7 @@ CFX_WideString CFDE_TxtEdtEngine::GetPreDeleteText(int32_t nIndex, } CFX_WideString CFDE_TxtEdtEngine::GetPreInsertText(int32_t nIndex, - const FX_WCHAR* lpText, + const wchar_t* lpText, int32_t nLength) { CFX_WideString wsText = GetText(0, GetTextBufLength()); int32_t nSelIndex = 0; @@ -746,12 +746,12 @@ CFX_WideString CFDE_TxtEdtEngine::GetPreInsertText(int32_t nIndex, } CFX_WideString wsTemp; int32_t nOldLength = wsText.GetLength(); - const FX_WCHAR* pOldBuffer = wsText.c_str(); - FX_WCHAR* lpBuffer = wsTemp.GetBuffer(nOldLength + nLength); - FXSYS_memcpy(lpBuffer, pOldBuffer, (nIndex) * sizeof(FX_WCHAR)); - FXSYS_memcpy(lpBuffer + nIndex, lpText, nLength * sizeof(FX_WCHAR)); + const wchar_t* pOldBuffer = wsText.c_str(); + wchar_t* lpBuffer = wsTemp.GetBuffer(nOldLength + nLength); + FXSYS_memcpy(lpBuffer, pOldBuffer, (nIndex) * sizeof(wchar_t)); + FXSYS_memcpy(lpBuffer + nIndex, lpText, nLength * sizeof(wchar_t)); FXSYS_memcpy(lpBuffer + nIndex + nLength, pOldBuffer + nIndex, - (nOldLength - nIndex) * sizeof(FX_WCHAR)); + (nOldLength - nIndex) * sizeof(wchar_t)); wsTemp.ReleaseBuffer(nOldLength + nLength); wsText = wsTemp; return wsText; @@ -759,7 +759,7 @@ CFX_WideString CFDE_TxtEdtEngine::GetPreInsertText(int32_t nIndex, CFX_WideString CFDE_TxtEdtEngine::GetPreReplaceText(int32_t nIndex, int32_t nOriginLength, - const FX_WCHAR* lpText, + const wchar_t* lpText, int32_t nLength) { CFX_WideString wsText = GetText(0, GetTextBufLength()); int32_t nSelIndex = 0; @@ -778,7 +778,7 @@ CFX_WideString CFDE_TxtEdtEngine::GetPreReplaceText(int32_t nIndex, } void CFDE_TxtEdtEngine::Inner_Insert(int32_t nStart, - const FX_WCHAR* lpText, + const wchar_t* lpText, int32_t nLength) { ASSERT(nLength > 0); FDE_TXTEDTPARAGPOS ParagPos; @@ -795,8 +795,8 @@ void CFDE_TxtEdtEngine::Inner_Insert(int32_t nStart, int32_t nLeavePart = ParagPos.nCharIndex; int32_t nCutPart = pParag->GetTextLength() - ParagPos.nCharIndex; int32_t nTextStart = 0; - FX_WCHAR wCurChar = L' '; - const FX_WCHAR* lpPos = lpText; + wchar_t wCurChar = L' '; + const wchar_t* lpPos = lpText; bool bFirst = true; int32_t nParagIndex = ParagPos.nParagIndex; for (i = 0; i < nLength; i++, lpPos++) { @@ -926,7 +926,7 @@ void CFDE_TxtEdtEngine::ResetEngine() { void CFDE_TxtEdtEngine::RebuildParagraphs() { RemoveAllParags(); - FX_WCHAR wChar = L' '; + wchar_t wChar = L' '; int32_t nParagStart = 0; int32_t nIndex = 0; auto pIter = pdfium::MakeUnique<CFDE_TxtEdtBuf::Iterator>(m_pTxtBuf.get()); @@ -1045,11 +1045,11 @@ void CFDE_TxtEdtEngine::UpdateTxtBreak() { m_pTextBreak->SetCharSpace(m_Param.fCharSpace); } -bool CFDE_TxtEdtEngine::ReplaceParagEnd(FX_WCHAR*& lpText, +bool CFDE_TxtEdtEngine::ReplaceParagEnd(wchar_t*& lpText, int32_t& nLength, bool bPreIsCR) { for (int32_t i = 0; i < nLength; i++) { - FX_WCHAR wc = lpText[i]; + wchar_t wc = lpText[i]; switch (wc) { case L'\r': { lpText[i] = m_wLineEnd; @@ -1060,7 +1060,7 @@ bool CFDE_TxtEdtEngine::ReplaceParagEnd(FX_WCHAR*& lpText, int32_t nNext = i + 1; if (nNext < nLength) { FXSYS_memmove(lpText + i, lpText + nNext, - (nLength - nNext) * sizeof(FX_WCHAR)); + (nLength - nNext) * sizeof(wchar_t)); } i--; nLength--; @@ -1090,29 +1090,29 @@ bool CFDE_TxtEdtEngine::ReplaceParagEnd(FX_WCHAR*& lpText, } void CFDE_TxtEdtEngine::RecoverParagEnd(CFX_WideString& wsText) const { - FX_WCHAR wc = (m_nFirstLineEnd == FDE_TXTEDIT_LINEEND_CR) ? L'\n' : L'\r'; + wchar_t wc = (m_nFirstLineEnd == FDE_TXTEDIT_LINEEND_CR) ? L'\n' : L'\r'; if (m_nFirstLineEnd == FDE_TXTEDIT_LINEEND_CRLF) { CFX_ArrayTemplate<int32_t> PosArr; int32_t nLength = wsText.GetLength(); int32_t i = 0; - FX_WCHAR* lpPos = const_cast<FX_WCHAR*>(wsText.c_str()); + wchar_t* lpPos = const_cast<wchar_t*>(wsText.c_str()); for (i = 0; i < nLength; i++, lpPos++) { if (*lpPos == m_wLineEnd) { *lpPos = wc; PosArr.Add(i); } } - const FX_WCHAR* lpSrcBuf = wsText.c_str(); + const wchar_t* lpSrcBuf = wsText.c_str(); CFX_WideString wsTemp; int32_t nCount = PosArr.GetSize(); - FX_WCHAR* lpDstBuf = wsTemp.GetBuffer(nLength + nCount); + wchar_t* lpDstBuf = wsTemp.GetBuffer(nLength + nCount); int32_t nDstPos = 0; int32_t nSrcPos = 0; for (i = 0; i < nCount; i++) { int32_t nPos = PosArr[i]; int32_t nCopyLen = nPos - nSrcPos + 1; FXSYS_memcpy(lpDstBuf + nDstPos, lpSrcBuf + nSrcPos, - nCopyLen * sizeof(FX_WCHAR)); + nCopyLen * sizeof(wchar_t)); nDstPos += nCopyLen; nSrcPos += nCopyLen; lpDstBuf[nDstPos] = L'\n'; @@ -1120,13 +1120,13 @@ void CFDE_TxtEdtEngine::RecoverParagEnd(CFX_WideString& wsText) const { } if (nSrcPos < nLength) { FXSYS_memcpy(lpDstBuf + nDstPos, lpSrcBuf + nSrcPos, - (nLength - nSrcPos) * sizeof(FX_WCHAR)); + (nLength - nSrcPos) * sizeof(wchar_t)); } wsTemp.ReleaseBuffer(nLength + nCount); wsText = wsTemp; } else { int32_t nLength = wsText.GetLength(); - FX_WCHAR* lpBuf = const_cast<FX_WCHAR*>(wsText.c_str()); + wchar_t* lpBuf = const_cast<wchar_t*>(wsText.c_str()); for (int32_t i = 0; i < nLength; i++, lpBuf++) { if (*lpBuf == m_wLineEnd) *lpBuf = wc; @@ -1305,7 +1305,7 @@ bool CFDE_TxtEdtEngine::MoveLineEnd() { } nIndex = nStart + nCount - 1; ASSERT(nIndex <= GetTextBufLength()); - FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nIndex); + wchar_t wChar = m_pTxtBuf->GetCharByIndex(nIndex); bool bBefore = false; if (nIndex <= GetTextBufLength()) { if (wChar == L'\r') { @@ -1339,7 +1339,7 @@ bool CFDE_TxtEdtEngine::MoveParagEnd() { TextPos2ParagPos(nIndex, ParagPos); CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; nIndex = pParag->GetStartIndex() + pParag->GetTextLength() - 1; - FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nIndex); + wchar_t wChar = m_pTxtBuf->GetCharByIndex(nIndex); if (wChar == L'\n' && nIndex > 0) { nIndex--; wChar = m_pTxtBuf->GetCharByIndex(nIndex); diff --git a/xfa/fde/cfde_txtedtengine.h b/xfa/fde/cfde_txtedtengine.h index ee1cc1015d..63d97d33a3 100644 --- a/xfa/fde/cfde_txtedtengine.h +++ b/xfa/fde/cfde_txtedtengine.h @@ -46,7 +46,7 @@ class CFDE_TxtEdtEngine { void Unlock(); bool IsLocked() const; - int32_t Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLength); + int32_t Insert(int32_t nStart, const wchar_t* lpText, int32_t nLength); int32_t Delete(int32_t nStart, bool bBackspace = false); int32_t DeleteRange(int32_t nStart, int32_t nCount = -1); int32_t Replace(int32_t nStart, @@ -54,7 +54,7 @@ class CFDE_TxtEdtEngine { const CFX_WideString& wsReplace); void SetLimit(int32_t nLimit); - void SetAliasChar(FX_WCHAR wcAlias); + void SetAliasChar(wchar_t wcAlias); void RemoveSelRange(int32_t nStart, int32_t nCount); @@ -83,7 +83,7 @@ class CFDE_TxtEdtEngine { int32_t nStartLineofParag, int32_t nLineIndex, int32_t& nStartLine) const; - FX_WCHAR GetAliasChar() const { return m_wcAliasChar; } + wchar_t GetAliasChar() const { return m_wcAliasChar; } private: friend class CFDE_TxtEdtDoRecord_Insert; @@ -100,14 +100,14 @@ class CFDE_TxtEdtEngine { int32_t nCharIndex; }; - void Inner_Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLength); + void Inner_Insert(int32_t nStart, const wchar_t* lpText, int32_t nLength); CFX_WideString GetPreDeleteText(int32_t nIndex, int32_t nLength); CFX_WideString GetPreInsertText(int32_t nIndex, - const FX_WCHAR* lpText, + const wchar_t* lpText, int32_t nLength); CFX_WideString GetPreReplaceText(int32_t nIndex, int32_t nOriginLength, - const FX_WCHAR* lpText, + const wchar_t* lpText, int32_t nLength); void Inner_DeleteRange(int32_t nStart, int32_t nCount = -1); @@ -120,7 +120,7 @@ class CFDE_TxtEdtEngine { void UpdatePages(); void UpdateTxtBreak(); - bool ReplaceParagEnd(FX_WCHAR*& lpText, + bool ReplaceParagEnd(wchar_t*& lpText, int32_t& nLength, bool bPreIsCR = false); void RecoverParagEnd(CFX_WideString& wsText) const; @@ -165,10 +165,10 @@ class CFDE_TxtEdtEngine { uint32_t m_dwFindFlags; bool m_bLock; int32_t m_nLimit; - FX_WCHAR m_wcAliasChar; + wchar_t m_wcAliasChar; int32_t m_nFirstLineEnd; bool m_bAutoLineEnd; - FX_WCHAR m_wLineEnd; + wchar_t m_wLineEnd; FDE_TXTEDT_TEXTCHANGE_INFO m_ChangeInfo; }; diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp index f0a33d0516..f229a01fcb 100644 --- a/xfa/fde/cfde_txtedtpage.cpp +++ b/xfa/fde/cfde_txtedtpage.cpp @@ -109,7 +109,7 @@ int32_t CFDE_TxtEdtPage::GetCharIndex(const CFX_PointF& fPoint, bool& bBefore) { bBefore = true; return m_pEditEngine->GetTextBufLength(); } - FX_WCHAR wChar = m_pEditEngine->GetTextBuf()->GetCharByIndex(nCaret); + wchar_t wChar = m_pEditEngine->GetTextBuf()->GetCharByIndex(nCaret); if (wChar == L'\n' || wChar == L'\r') { if (wChar == L'\n') { if (m_pEditEngine->GetTextBuf()->GetCharByIndex(nCaret - 1) == @@ -234,7 +234,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, } CFDE_TxtEdtBuf* pBuf = m_pEditEngine->GetTextBuf(); const FDE_TXTEDTPARAMS* pParams = m_pEditEngine->GetEditParams(); - FX_WCHAR wcAlias = 0; + wchar_t wcAlias = 0; if (pParams->dwMode & FDE_TEXTEDITMODE_Password) { wcAlias = m_pEditEngine->GetAliasChar(); } @@ -287,7 +287,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, if (bReload) { dwBreakStatus = pBreak->EndBreak(CFX_BreakType::Paragraph); } else { - FX_WCHAR wAppend = pIter->GetChar(); + wchar_t wAppend = pIter->GetChar(); dwBreakStatus = pBreak->AppendChar(wAppend); } if (pIter->GetAt() == nPageEnd && CFX_BreakTypeNoneOrPiece(dwBreakStatus)) @@ -308,11 +308,11 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, } FX_FLOAT fParaBreakWidth = 0.0f; if (!CFX_BreakTypeNoneOrPiece(pPiece->m_dwStatus)) { - FX_WCHAR wRtChar = pParams->wLineBreakChar; + wchar_t wRtChar = pParams->wLineBreakChar; if (TxtEdtPiece.nCount >= 2) { - FX_WCHAR wChar = pBuf->GetCharByIndex( + wchar_t wChar = pBuf->GetCharByIndex( m_nPageStart + TxtEdtPiece.nStart + TxtEdtPiece.nCount - 1); - FX_WCHAR wCharPre = pBuf->GetCharByIndex( + wchar_t wCharPre = pBuf->GetCharByIndex( m_nPageStart + TxtEdtPiece.nStart + TxtEdtPiece.nCount - 2); if (wChar == wRtChar) { fParaBreakWidth += fDefCharWidth; @@ -321,7 +321,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, fParaBreakWidth += fDefCharWidth; } } else if (TxtEdtPiece.nCount >= 1) { - FX_WCHAR wChar = pBuf->GetCharByIndex( + wchar_t wChar = pBuf->GetCharByIndex( m_nPageStart + TxtEdtPiece.nStart + TxtEdtPiece.nCount - 1); if (wChar == wRtChar) { fParaBreakWidth += fDefCharWidth; @@ -434,13 +434,13 @@ FDE_TEXTEDITPIECE* CFDE_TxtEdtPage::GetNext(FX_POSITION& pos, return &m_Pieces[nPos - 1]; } -FX_WCHAR CFDE_TxtEdtPage::GetChar(const FDE_TEXTEDITPIECE* pIdentity, - int32_t index) const { +wchar_t CFDE_TxtEdtPage::GetChar(const FDE_TEXTEDITPIECE* pIdentity, + int32_t index) const { int32_t nIndex = m_nPageStart + pIdentity->nStart + index; if (nIndex != m_pIter->GetAt()) m_pIter->SetAt(nIndex); - FX_WCHAR wChar = m_pIter->GetChar(); + wchar_t wChar = m_pIter->GetChar(); m_pIter->Next(); return wChar; } diff --git a/xfa/fde/cfde_txtedtpage.h b/xfa/fde/cfde_txtedtpage.h index 6d700d202c..11c8050735 100644 --- a/xfa/fde/cfde_txtedtpage.h +++ b/xfa/fde/cfde_txtedtpage.h @@ -49,7 +49,7 @@ class CFDE_TxtEdtPage : public IFDE_VisualSet { FX_POSITION GetFirstPosition(); FDE_TEXTEDITPIECE* GetNext(FX_POSITION& pos, IFDE_VisualSet*& pVisualSet); - FX_WCHAR GetChar(const FDE_TEXTEDITPIECE* pIdentity, int32_t index) const; + wchar_t GetChar(const FDE_TEXTEDITPIECE* pIdentity, int32_t index) const; int32_t GetWidth(const FDE_TEXTEDITPIECE* pIdentity, int32_t index) const; private: diff --git a/xfa/fde/cfde_txtedtparag.cpp b/xfa/fde/cfde_txtedtparag.cpp index 79dcc2fbac..d22fa53c02 100644 --- a/xfa/fde/cfde_txtedtparag.cpp +++ b/xfa/fde/cfde_txtedtparag.cpp @@ -37,7 +37,7 @@ void CFDE_TxtEdtParag::LoadParag() { CFX_TxtBreak* pTxtBreak = m_pEngine->GetTextBreak(); CFDE_TxtEdtBuf* pTxtBuf = m_pEngine->GetTextBuf(); const FDE_TXTEDTPARAMS* pParam = m_pEngine->GetEditParams(); - FX_WCHAR wcAlias = 0; + wchar_t wcAlias = 0; if (pParam->dwMode & FDE_TEXTEDITMODE_Password) wcAlias = m_pEngine->GetAliasChar(); @@ -52,7 +52,7 @@ void CFDE_TxtEdtParag::LoadParag() { if (bReload) { dwBreakStatus = pTxtBreak->EndBreak(CFX_BreakType::Paragraph); } else { - FX_WCHAR wAppend = pIter->GetChar(); + wchar_t wAppend = pIter->GetChar(); dwBreakStatus = pTxtBreak->AppendChar(wAppend); } if (pIter->GetAt() + 1 == nEndIndex && @@ -117,7 +117,7 @@ void CFDE_TxtEdtParag::CalcLines() { if (bReload) { dwBreakStatus = pTxtBreak->EndBreak(CFX_BreakType::Paragraph); } else { - FX_WCHAR wAppend = pIter->GetChar(); + wchar_t wAppend = pIter->GetChar(); dwBreakStatus = pTxtBreak->AppendChar(wAppend); } if (pIter->GetAt() + 1 == nEndIndex && diff --git a/xfa/fde/cfde_txtedttextset.cpp b/xfa/fde/cfde_txtedttextset.cpp index a6503f4022..78a7ec49d5 100644 --- a/xfa/fde/cfde_txtedttextset.cpp +++ b/xfa/fde/cfde_txtedttextset.cpp @@ -26,7 +26,7 @@ CFX_RectF CFDE_TxtEdtTextSet::GetRect(const FDE_TEXTEDITPIECE& pPiece) { int32_t CFDE_TxtEdtTextSet::GetString(FDE_TEXTEDITPIECE* pPiece, CFX_WideString& wsText) { - FX_WCHAR* pBuffer = wsText.GetBuffer(pPiece->nCount); + wchar_t* pBuffer = wsText.GetBuffer(pPiece->nCount); for (int32_t i = 0; i < pPiece->nCount; i++) pBuffer[i] = m_pPage->GetChar(pPiece, i); diff --git a/xfa/fde/cfx_chariter.cpp b/xfa/fde/cfx_chariter.cpp index 568ecd6cf0..ff5b0d9c3a 100644 --- a/xfa/fde/cfx_chariter.cpp +++ b/xfa/fde/cfx_chariter.cpp @@ -26,7 +26,7 @@ bool CFX_CharIter::Next(bool bPrev) { return true; } -FX_WCHAR CFX_CharIter::GetChar() { +wchar_t CFX_CharIter::GetChar() { return m_wsText.GetAt(m_nIndex); } diff --git a/xfa/fde/cfx_chariter.h b/xfa/fde/cfx_chariter.h index d122af21f1..ab554b2716 100644 --- a/xfa/fde/cfx_chariter.h +++ b/xfa/fde/cfx_chariter.h @@ -17,7 +17,7 @@ class CFX_CharIter : public IFX_CharIter { ~CFX_CharIter() override; bool Next(bool bPrev = false) override; - FX_WCHAR GetChar() override; + wchar_t GetChar() override; void SetAt(int32_t nIndex) override; int32_t GetAt() const override; bool IsEOF(bool bTail = true) const override; diff --git a/xfa/fde/cfx_wordbreak.cpp b/xfa/fde/cfx_wordbreak.cpp index 2d37ba1707..9ab3a9230a 100644 --- a/xfa/fde/cfx_wordbreak.cpp +++ b/xfa/fde/cfx_wordbreak.cpp @@ -2770,7 +2770,7 @@ const uint8_t gs_FX_WordBreak_CodePointProperties[(0xFFFF - 1) / 2 + 1] = 0x00, 0x00, 0x00, 0x00, 0x05, 0x55, 0x00, 0x00, }; -FX_WordBreakProp GetWordBreakProperty(FX_WCHAR wcCodePoint) { +FX_WordBreakProp GetWordBreakProperty(wchar_t wcCodePoint) { uint32_t dwProperty = (uint32_t)gs_FX_WordBreak_CodePointProperties[wcCodePoint >> 1]; return (FX_WordBreakProp)(((wcCodePoint)&1) ? (dwProperty & 0x0F) @@ -2836,7 +2836,7 @@ void CFX_WordBreak::GetWord(CFX_WideString& wsWord) const { if (nWordLength <= 0) { return; } - FX_WCHAR* lpBuf = wsWord.GetBuffer(nWordLength); + wchar_t* lpBuf = wsWord.GetBuffer(nWordLength); std::unique_ptr<IFX_CharIter> pTempIter(m_pPreIter->Clone()); int32_t i = 0; while (pTempIter->GetAt() <= m_pCurIter->GetAt()) { diff --git a/xfa/fde/css/cfde_cssdeclaration.cpp b/xfa/fde/css/cfde_cssdeclaration.cpp index 3c776ca771..2d1e707caa 100644 --- a/xfa/fde/css/cfde_cssdeclaration.cpp +++ b/xfa/fde/css/cfde_cssdeclaration.cpp @@ -23,7 +23,7 @@ uint8_t Hex2Dec(uint8_t hexHigh, uint8_t hexLow) { return (FXSYS_toHexDigit(hexHigh) << 4) + FXSYS_toHexDigit(hexLow); } -bool ParseCSSNumber(const FX_WCHAR* pszValue, +bool ParseCSSNumber(const wchar_t* pszValue, int32_t iValueLen, FX_FLOAT& fValue, FDE_CSSNumberType& eUnit) { @@ -50,7 +50,7 @@ bool ParseCSSNumber(const FX_WCHAR* pszValue, } // namespace // static -bool CFDE_CSSDeclaration::ParseCSSString(const FX_WCHAR* pszValue, +bool CFDE_CSSDeclaration::ParseCSSString(const wchar_t* pszValue, int32_t iValueLen, int32_t* iOffset, int32_t* iLength) { @@ -58,7 +58,7 @@ bool CFDE_CSSDeclaration::ParseCSSString(const FX_WCHAR* pszValue, *iOffset = 0; *iLength = iValueLen; if (iValueLen >= 2) { - FX_WCHAR first = pszValue[0], last = pszValue[iValueLen - 1]; + wchar_t first = pszValue[0], last = pszValue[iValueLen - 1]; if ((first == '\"' && last == '\"') || (first == '\'' && last == '\'')) { *iOffset = 1; *iLength -= 2; @@ -68,7 +68,7 @@ bool CFDE_CSSDeclaration::ParseCSSString(const FX_WCHAR* pszValue, } // static. -bool CFDE_CSSDeclaration::ParseCSSColor(const FX_WCHAR* pszValue, +bool CFDE_CSSDeclaration::ParseCSSColor(const wchar_t* pszValue, int32_t iValueLen, FX_ARGB* dwColor) { ASSERT(pszValue && iValueLen > 0); @@ -159,7 +159,7 @@ void CFDE_CSSDeclaration::AddProperty(const FDE_CSSPropertyTable* pTable, const CFX_WideStringC& value) { ASSERT(!value.IsEmpty()); - const FX_WCHAR* pszValue = value.c_str(); + const wchar_t* pszValue = value.c_str(); int32_t iValueLen = value.GetLength(); bool bImportant = false; @@ -277,7 +277,7 @@ void CFDE_CSSDeclaration::AddProperty(const CFX_WideString& prop, } CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseNumber( - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen) { FX_FLOAT fValue; FDE_CSSNumberType eUnit; @@ -287,7 +287,7 @@ CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseNumber( } CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseEnum( - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen) { const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); @@ -296,7 +296,7 @@ CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseEnum( } CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseColor( - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen) { FX_ARGB dwColor; if (!ParseCSSColor(pszValue, iValueLen, &dwColor)) @@ -305,7 +305,7 @@ CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseColor( } CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseString( - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen) { int32_t iOffset; if (!ParseCSSString(pszValue, iValueLen, &iOffset, &iValueLen)) @@ -320,10 +320,10 @@ CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseString( void CFDE_CSSDeclaration::ParseValueListProperty( const FDE_CSSPropertyTable* pTable, - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen, bool bImportant) { - FX_WCHAR separator = + wchar_t separator = (pTable->eName == FDE_CSSProperty::FontFamily) ? ',' : ' '; CFDE_CSSValueListParser parser(pszValue, iValueLen, separator); @@ -444,7 +444,7 @@ void CFDE_CSSDeclaration::Add4ValuesProperty( } bool CFDE_CSSDeclaration::ParseBorderProperty( - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen, CFX_RetainPtr<CFDE_CSSValue>& pWidth) const { pWidth.Reset(nullptr); @@ -497,7 +497,7 @@ bool CFDE_CSSDeclaration::ParseBorderProperty( return true; } -void CFDE_CSSDeclaration::ParseFontProperty(const FX_WCHAR* pszValue, +void CFDE_CSSDeclaration::ParseFontProperty(const wchar_t* pszValue, int32_t iValueLen, bool bImportant) { CFDE_CSSValueListParser parser(pszValue, iValueLen, '/'); diff --git a/xfa/fde/css/cfde_cssdeclaration.h b/xfa/fde/css/cfde_cssdeclaration.h index eb287308f8..3c2e058a43 100644 --- a/xfa/fde/css/cfde_cssdeclaration.h +++ b/xfa/fde/css/cfde_cssdeclaration.h @@ -23,11 +23,11 @@ class CFDE_CSSDeclaration { using const_custom_iterator = std::vector<std::unique_ptr<CFDE_CSSCustomProperty>>::const_iterator; - static bool ParseCSSString(const FX_WCHAR* pszValue, + static bool ParseCSSString(const wchar_t* pszValue, int32_t iValueLen, int32_t* iOffset, int32_t* iLength); - static bool ParseCSSColor(const FX_WCHAR* pszValue, + static bool ParseCSSColor(const wchar_t* pszValue, int32_t iValueLen, FX_ARGB* dwColor); @@ -53,19 +53,19 @@ class CFDE_CSSDeclaration { size_t PropertyCountForTesting() const; - FX_ARGB ParseColorForTest(const FX_WCHAR* pszValue, + FX_ARGB ParseColorForTest(const wchar_t* pszValue, int32_t iValueLen, FX_ARGB* dwColor) const; private: - void ParseFontProperty(const FX_WCHAR* pszValue, + void ParseFontProperty(const wchar_t* pszValue, int32_t iValueLen, bool bImportant); - bool ParseBorderProperty(const FX_WCHAR* pszValue, + bool ParseBorderProperty(const wchar_t* pszValue, int32_t iValueLen, CFX_RetainPtr<CFDE_CSSValue>& pWidth) const; void ParseValueListProperty(const FDE_CSSPropertyTable* pTable, - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen, bool bImportant); void Add4ValuesProperty(const std::vector<CFX_RetainPtr<CFDE_CSSValue>>& list, @@ -74,13 +74,13 @@ class CFDE_CSSDeclaration { FDE_CSSProperty eTop, FDE_CSSProperty eRight, FDE_CSSProperty eBottom); - CFX_RetainPtr<CFDE_CSSValue> ParseNumber(const FX_WCHAR* pszValue, + CFX_RetainPtr<CFDE_CSSValue> ParseNumber(const wchar_t* pszValue, int32_t iValueLen); - CFX_RetainPtr<CFDE_CSSValue> ParseEnum(const FX_WCHAR* pszValue, + CFX_RetainPtr<CFDE_CSSValue> ParseEnum(const wchar_t* pszValue, int32_t iValueLen); - CFX_RetainPtr<CFDE_CSSValue> ParseColor(const FX_WCHAR* pszValue, + CFX_RetainPtr<CFDE_CSSValue> ParseColor(const wchar_t* pszValue, int32_t iValueLen); - CFX_RetainPtr<CFDE_CSSValue> ParseString(const FX_WCHAR* pszValue, + CFX_RetainPtr<CFDE_CSSValue> ParseString(const wchar_t* pszValue, int32_t iValueLen); void AddPropertyHolder(FDE_CSSProperty eProperty, CFX_RetainPtr<CFDE_CSSValue> pValue, diff --git a/xfa/fde/css/cfde_cssselector.cpp b/xfa/fde/css/cfde_cssselector.cpp index 03580236f5..6842d58738 100644 --- a/xfa/fde/css/cfde_cssselector.cpp +++ b/xfa/fde/css/cfde_cssselector.cpp @@ -12,14 +12,14 @@ namespace { -bool IsCSSChar(FX_WCHAR wch) { +bool IsCSSChar(wchar_t wch) { return (wch >= 'a' && wch <= 'z') || (wch >= 'A' && wch <= 'Z'); } -int32_t GetCSSNameLen(const FX_WCHAR* psz, const FX_WCHAR* pEnd) { - const FX_WCHAR* pStart = psz; +int32_t GetCSSNameLen(const wchar_t* psz, const wchar_t* pEnd) { + const wchar_t* pStart = psz; while (psz < pEnd) { - FX_WCHAR wch = *psz; + wchar_t wch = *psz; if (IsCSSChar(wch) || (wch >= '0' && wch <= '9') || wch == '_' || wch == '-') { ++psz; @@ -33,7 +33,7 @@ int32_t GetCSSNameLen(const FX_WCHAR* psz, const FX_WCHAR* pEnd) { } // namespace CFDE_CSSSelector::CFDE_CSSSelector(FDE_CSSSelectorType eType, - const FX_WCHAR* psz, + const wchar_t* psz, int32_t iLen, bool bIgnoreCase) : m_eType(eType), @@ -58,9 +58,9 @@ std::unique_ptr<CFDE_CSSSelector> CFDE_CSSSelector::FromString( const CFX_WideStringC& str) { ASSERT(!str.IsEmpty()); - const FX_WCHAR* psz = str.c_str(); - const FX_WCHAR* pStart = psz; - const FX_WCHAR* pEnd = psz + str.GetLength(); + const wchar_t* psz = str.c_str(); + const wchar_t* pStart = psz; + const wchar_t* pEnd = psz + str.GetLength(); for (; psz < pEnd; ++psz) { switch (*psz) { case '>': @@ -72,7 +72,7 @@ std::unique_ptr<CFDE_CSSSelector> CFDE_CSSSelector::FromString( std::unique_ptr<CFDE_CSSSelector> pFirst = nullptr; for (psz = pStart; psz < pEnd;) { - FX_WCHAR wch = *psz; + wchar_t wch = *psz; if (IsCSSChar(wch) || wch == '*') { int32_t iNameLen = wch == '*' ? 1 : GetCSSNameLen(psz, pEnd); auto p = pdfium::MakeUnique<CFDE_CSSSelector>( diff --git a/xfa/fde/css/cfde_cssselector.h b/xfa/fde/css/cfde_cssselector.h index d585b3f368..048c51339e 100644 --- a/xfa/fde/css/cfde_cssselector.h +++ b/xfa/fde/css/cfde_cssselector.h @@ -19,7 +19,7 @@ class CFDE_CSSSelector { const CFX_WideStringC& str); CFDE_CSSSelector(FDE_CSSSelectorType eType, - const FX_WCHAR* psz, + const wchar_t* psz, int32_t iLen, bool bIgnoreCase); ~CFDE_CSSSelector(); diff --git a/xfa/fde/css/cfde_cssstylesheet.cpp b/xfa/fde/css/cfde_cssstylesheet.cpp index e259e2f332..175289be11 100644 --- a/xfa/fde/css/cfde_cssstylesheet.cpp +++ b/xfa/fde/css/cfde_cssstylesheet.cpp @@ -34,7 +34,7 @@ CFDE_CSSStyleRule* CFDE_CSSStyleSheet::GetRule(int32_t index) const { return m_RuleArray[index].get(); } -bool CFDE_CSSStyleSheet::LoadBuffer(const FX_WCHAR* pBuffer, int32_t iBufSize) { +bool CFDE_CSSStyleSheet::LoadBuffer(const wchar_t* pBuffer, int32_t iBufSize) { ASSERT(pBuffer && iBufSize > 0); auto pSyntax = pdfium::MakeUnique<CFDE_CSSSyntaxParser>(); diff --git a/xfa/fde/css/cfde_cssstylesheet.h b/xfa/fde/css/cfde_cssstylesheet.h index 4de377219c..fa73460634 100644 --- a/xfa/fde/css/cfde_cssstylesheet.h +++ b/xfa/fde/css/cfde_cssstylesheet.h @@ -21,7 +21,7 @@ class CFDE_CSSStyleSheet { CFDE_CSSStyleSheet(); ~CFDE_CSSStyleSheet(); - bool LoadBuffer(const FX_WCHAR* pBuffer, int32_t iBufSize); + bool LoadBuffer(const wchar_t* pBuffer, int32_t iBufSize); int32_t CountRules() const; CFDE_CSSStyleRule* GetRule(int32_t index) const; @@ -34,7 +34,7 @@ class CFDE_CSSStyleSheet { void SkipRuleSet(CFDE_CSSSyntaxParser* pSyntax); std::vector<std::unique_ptr<CFDE_CSSStyleRule>> m_RuleArray; - std::unordered_map<uint32_t, FX_WCHAR*> m_StringCache; + std::unordered_map<uint32_t, wchar_t*> m_StringCache; }; #endif // XFA_FDE_CSS_CFDE_CSSSTYLESHEET_H_ diff --git a/xfa/fde/css/cfde_cssstylesheet_unittest.cpp b/xfa/fde/css/cfde_cssstylesheet_unittest.cpp index 9d8ecb9347..0f450e9c3a 100644 --- a/xfa/fde/css/cfde_cssstylesheet_unittest.cpp +++ b/xfa/fde/css/cfde_cssstylesheet_unittest.cpp @@ -27,7 +27,7 @@ class CFDE_CSSStyleSheetTest : public testing::Test { void TearDown() override { decl_ = nullptr; } - void LoadAndVerifyDecl(const FX_WCHAR* buf, + void LoadAndVerifyDecl(const wchar_t* buf, const std::vector<CFX_WideString>& selectors, size_t decl_count) { ASSERT(sheet_); @@ -87,7 +87,7 @@ class CFDE_CSSStyleSheetTest : public testing::Test { }; TEST_F(CFDE_CSSStyleSheetTest, ParseMultipleSelectors) { - const FX_WCHAR* buf = + const wchar_t* buf = L"a { border: 10px; }\nb { text-decoration: underline; }"; EXPECT_TRUE(sheet_->LoadBuffer(buf, FXSYS_wcslen(buf))); EXPECT_EQ(2, sheet_->CountRules()); @@ -136,7 +136,7 @@ TEST_F(CFDE_CSSStyleSheetTest, ParseMultipleSelectors) { } TEST_F(CFDE_CSSStyleSheetTest, ParseChildSelectors) { - const FX_WCHAR* buf = L"a b c { border: 10px; }"; + const wchar_t* buf = L"a b c { border: 10px; }"; EXPECT_TRUE(sheet_->LoadBuffer(buf, FXSYS_wcslen(buf))); EXPECT_EQ(1, sheet_->CountRules()); @@ -171,7 +171,7 @@ TEST_F(CFDE_CSSStyleSheetTest, ParseChildSelectors) { } TEST_F(CFDE_CSSStyleSheetTest, ParseUnhandledSelectors) { - const FX_WCHAR* buf = L"a > b { padding: 0; }"; + const wchar_t* buf = L"a > b { padding: 0; }"; EXPECT_TRUE(sheet_->LoadBuffer(buf, FXSYS_wcslen(buf))); EXPECT_EQ(0, sheet_->CountRules()); diff --git a/xfa/fde/css/cfde_csssyntaxparser.cpp b/xfa/fde/css/cfde_csssyntaxparser.cpp index 2f7bcce9d7..fada76b6b1 100644 --- a/xfa/fde/css/cfde_csssyntaxparser.cpp +++ b/xfa/fde/css/cfde_csssyntaxparser.cpp @@ -14,7 +14,7 @@ namespace { -bool IsSelectorStart(FX_WCHAR wch) { +bool IsSelectorStart(wchar_t wch) { return wch == '.' || wch == '#' || wch == '*' || (wch >= 'a' && wch <= 'z') || (wch >= 'A' && wch <= 'Z'); } @@ -32,7 +32,7 @@ CFDE_CSSSyntaxParser::~CFDE_CSSSyntaxParser() { m_TextPlane.Reset(); } -bool CFDE_CSSSyntaxParser::Init(const FX_WCHAR* pBuffer, +bool CFDE_CSSSyntaxParser::Init(const wchar_t* pBuffer, int32_t iBufferSize, int32_t iTextDatSize, bool bOnlyDeclaration) { @@ -65,7 +65,7 @@ FDE_CSSSyntaxStatus CFDE_CSSSyntaxParser::DoSyntaxParse() { m_eStatus = FDE_CSSSyntaxStatus::EOS; return m_eStatus; } - FX_WCHAR wch; + wchar_t wch; while (!m_TextPlane.IsEOF()) { wch = m_TextPlane.GetChar(); switch (m_eMode) { @@ -198,7 +198,7 @@ bool CFDE_CSSSyntaxParser::IsImportEnabled() const { return true; } -bool CFDE_CSSSyntaxParser::AppendChar(FX_WCHAR wch) { +bool CFDE_CSSSyntaxParser::AppendChar(wchar_t wch) { m_TextPlane.MoveNext(); if (m_TextData.GetLength() > 0 || wch > ' ') { m_TextData.AppendChar(wch); diff --git a/xfa/fde/css/cfde_csssyntaxparser.h b/xfa/fde/css/cfde_csssyntaxparser.h index b583b98b15..a5e79d50e5 100644 --- a/xfa/fde/css/cfde_csssyntaxparser.h +++ b/xfa/fde/css/cfde_csssyntaxparser.h @@ -40,7 +40,7 @@ class CFDE_CSSSyntaxParser { CFDE_CSSSyntaxParser(); ~CFDE_CSSSyntaxParser(); - bool Init(const FX_WCHAR* pBuffer, + bool Init(const wchar_t* pBuffer, int32_t iBufferSize, int32_t iTextDatSize = 32, bool bOnlyDeclaration = false); @@ -53,7 +53,7 @@ class CFDE_CSSSyntaxParser { int32_t SwitchToComment(); bool RestoreMode(); - bool AppendChar(FX_WCHAR wch); + bool AppendChar(wchar_t wch); int32_t SaveTextData(); bool IsCharsetEnabled() const { return (m_dwCheck & FDE_CSSSYNTAXCHECK_AllowCharset) != 0; diff --git a/xfa/fde/css/cfde_csstextbuf.cpp b/xfa/fde/css/cfde_csstextbuf.cpp index 83b2899f19..5df09f0936 100644 --- a/xfa/fde/css/cfde_csstextbuf.cpp +++ b/xfa/fde/css/cfde_csstextbuf.cpp @@ -27,9 +27,9 @@ void CFDE_CSSTextBuf::Reset() { m_iDatPos = m_iDatLen = m_iBufLen; } -bool CFDE_CSSTextBuf::AttachBuffer(const FX_WCHAR* pBuffer, int32_t iBufLen) { +bool CFDE_CSSTextBuf::AttachBuffer(const wchar_t* pBuffer, int32_t iBufLen) { Reset(); - m_pBuffer = const_cast<FX_WCHAR*>(pBuffer); + m_pBuffer = const_cast<wchar_t*>(pBuffer); m_iDatLen = m_iBufLen = iBufLen; return m_bExtBuf = true; } @@ -63,9 +63,9 @@ bool CFDE_CSSTextBuf::ExpandBuf(int32_t iDesiredSize) { if (m_bExtBuf) return false; if (!m_pBuffer) - m_pBuffer = FX_Alloc(FX_WCHAR, iDesiredSize); + m_pBuffer = FX_Alloc(wchar_t, iDesiredSize); else if (m_iBufLen != iDesiredSize) - m_pBuffer = FX_Realloc(FX_WCHAR, m_pBuffer, iDesiredSize); + m_pBuffer = FX_Realloc(wchar_t, m_pBuffer, iDesiredSize); else return true; @@ -81,6 +81,6 @@ void CFDE_CSSTextBuf::Subtract(int32_t iStart, int32_t iLength) { ASSERT(iStart >= 0 && iLength >= 0); iLength = std::max(std::min(iLength, m_iDatLen - iStart), 0); - FXSYS_memmove(m_pBuffer, m_pBuffer + iStart, iLength * sizeof(FX_WCHAR)); + FXSYS_memmove(m_pBuffer, m_pBuffer + iStart, iLength * sizeof(wchar_t)); m_iDatLen = iLength; } diff --git a/xfa/fde/css/cfde_csstextbuf.h b/xfa/fde/css/cfde_csstextbuf.h index df151e02d8..9ade44be8a 100644 --- a/xfa/fde/css/cfde_csstextbuf.h +++ b/xfa/fde/css/cfde_csstextbuf.h @@ -17,13 +17,13 @@ class CFDE_CSSTextBuf { CFDE_CSSTextBuf(); ~CFDE_CSSTextBuf(); - bool AttachBuffer(const FX_WCHAR* pBuffer, int32_t iBufLen); + bool AttachBuffer(const wchar_t* pBuffer, int32_t iBufLen); bool EstimateSize(int32_t iAllocSize); int32_t LoadFromStream(const CFX_RetainPtr<IFGAS_Stream>& pTxtStream, int32_t iStreamOffset, int32_t iMaxChars, bool& bEOS); - bool AppendChar(FX_WCHAR wch) { + bool AppendChar(wchar_t wch) { if (m_iDatLen >= m_iBufLen && !ExpandBuf(m_iBufLen * 2)) return false; m_pBuffer[m_iDatLen++] = wch; @@ -43,21 +43,21 @@ class CFDE_CSSTextBuf { void Subtract(int32_t iStart, int32_t iLength); bool IsEOF() const { return m_iDatPos >= m_iDatLen; } - FX_WCHAR GetAt(int32_t index) const { return m_pBuffer[index]; } - FX_WCHAR GetChar() const { return m_pBuffer[m_iDatPos]; } - FX_WCHAR GetNextChar() const { + wchar_t GetAt(int32_t index) const { return m_pBuffer[index]; } + wchar_t GetChar() const { return m_pBuffer[m_iDatPos]; } + wchar_t GetNextChar() const { return (m_iDatPos + 1 >= m_iDatLen) ? 0 : m_pBuffer[m_iDatPos + 1]; } void MoveNext() { m_iDatPos++; } int32_t GetLength() const { return m_iDatLen; } - const FX_WCHAR* GetBuffer() const { return m_pBuffer; } + const wchar_t* GetBuffer() const { return m_pBuffer; } protected: bool ExpandBuf(int32_t iDesiredSize); bool m_bExtBuf; - FX_WCHAR* m_pBuffer; + wchar_t* m_pBuffer; int32_t m_iBufLen; int32_t m_iDatLen; int32_t m_iDatPos; diff --git a/xfa/fde/css/cfde_cssvaluelistparser.cpp b/xfa/fde/css/cfde_cssvaluelistparser.cpp index 42c3296865..36d5edc3c7 100644 --- a/xfa/fde/css/cfde_cssvaluelistparser.cpp +++ b/xfa/fde/css/cfde_cssvaluelistparser.cpp @@ -6,15 +6,15 @@ #include "xfa/fde/css/cfde_cssvaluelistparser.h" -CFDE_CSSValueListParser::CFDE_CSSValueListParser(const FX_WCHAR* psz, +CFDE_CSSValueListParser::CFDE_CSSValueListParser(const wchar_t* psz, int32_t iLen, - FX_WCHAR separator) + wchar_t separator) : m_Separator(separator), m_pCur(psz), m_pEnd(psz + iLen) { ASSERT(psz && iLen > 0); } bool CFDE_CSSValueListParser::NextValue(FDE_CSSPrimitiveType& eType, - const FX_WCHAR*& pStart, + const wchar_t*& pStart, int32_t& iLength) { while (m_pCur < m_pEnd && (*m_pCur <= ' ' || *m_pCur == m_Separator)) ++m_pCur; @@ -25,7 +25,7 @@ bool CFDE_CSSValueListParser::NextValue(FDE_CSSPrimitiveType& eType, eType = FDE_CSSPrimitiveType::Unknown; pStart = m_pCur; iLength = 0; - FX_WCHAR wch = *m_pCur; + wchar_t wch = *m_pCur; if (wch == '#') { iLength = SkipTo(' ', false, false); if (iLength == 4 || iLength == 7) @@ -56,10 +56,10 @@ bool CFDE_CSSValueListParser::NextValue(FDE_CSSPrimitiveType& eType, return m_pCur <= m_pEnd && iLength > 0; } -int32_t CFDE_CSSValueListParser::SkipTo(FX_WCHAR wch, +int32_t CFDE_CSSValueListParser::SkipTo(wchar_t wch, bool breakOnSpace, bool matchBrackets) { - const FX_WCHAR* pStart = m_pCur; + const wchar_t* pStart = m_pCur; int32_t bracketCount = 0; while (m_pCur < m_pEnd && *m_pCur != wch) { if (breakOnSpace && *m_pCur <= ' ') diff --git a/xfa/fde/css/cfde_cssvaluelistparser.h b/xfa/fde/css/cfde_cssvaluelistparser.h index 734aed8a52..e41ee5c313 100644 --- a/xfa/fde/css/cfde_cssvaluelistparser.h +++ b/xfa/fde/css/cfde_cssvaluelistparser.h @@ -12,21 +12,19 @@ class CFDE_CSSValueListParser { public: - CFDE_CSSValueListParser(const FX_WCHAR* psz, - int32_t iLen, - FX_WCHAR separator); + CFDE_CSSValueListParser(const wchar_t* psz, int32_t iLen, wchar_t separator); bool NextValue(FDE_CSSPrimitiveType& eType, - const FX_WCHAR*& pStart, + const wchar_t*& pStart, int32_t& iLength); - FX_WCHAR m_Separator; + wchar_t m_Separator; private: - int32_t SkipTo(FX_WCHAR wch, bool breakOnSpace, bool matchBrackets); + int32_t SkipTo(wchar_t wch, bool breakOnSpace, bool matchBrackets); - const FX_WCHAR* m_pCur; - const FX_WCHAR* m_pEnd; + const wchar_t* m_pCur; + const wchar_t* m_pEnd; }; #endif // XFA_FDE_CSS_CFDE_CSSVALUELISTPARSER_H_ diff --git a/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp b/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp index 71bb807f3d..2864c842ad 100644 --- a/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp +++ b/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp @@ -11,7 +11,7 @@ TEST(CFDE_CSSValueListParser, rgb_short) { FDE_CSSPrimitiveType type; - const FX_WCHAR* start; + const wchar_t* start; int32_t len; auto parser = pdfium::MakeUnique<CFDE_CSSValueListParser>(L"#abc", 4, L' '); @@ -42,7 +42,7 @@ TEST(CFDE_CSSValueListParser, rgb_short) { TEST(CFDE_CSSValueListParser, number_parsing) { FDE_CSSPrimitiveType type; - const FX_WCHAR* start; + const wchar_t* start; int32_t len; auto parser = pdfium::MakeUnique<CFDE_CSSValueListParser>(L"1234", 4, L' '); @@ -84,7 +84,7 @@ TEST(CFDE_CSSValueListParser, number_parsing) { TEST(CFDE_CSSValueListParser, string_parsing) { FDE_CSSPrimitiveType type; - const FX_WCHAR* start; + const wchar_t* start; int32_t len; auto parser = @@ -107,7 +107,7 @@ TEST(CFDE_CSSValueListParser, string_parsing) { TEST(CFDE_CSSValueListParser, multiparsing) { FDE_CSSPrimitiveType type; - const FX_WCHAR* start; + const wchar_t* start; int32_t len; auto parser = diff --git a/xfa/fde/css/fde_cssdatatable.h b/xfa/fde/css/fde_cssdatatable.h index afb0b8502d..d1745f5d50 100644 --- a/xfa/fde/css/fde_cssdatatable.h +++ b/xfa/fde/css/fde_cssdatatable.h @@ -20,14 +20,14 @@ struct FDE_CSSPropertyTable { FDE_CSSProperty eName; - const FX_WCHAR* pszName; + const wchar_t* pszName; uint32_t dwHash; uint32_t dwType; }; struct FDE_CSSPropertyValueTable { FDE_CSSPropertyValue eName; - const FX_WCHAR* pszName; + const wchar_t* pszName; uint32_t dwHash; }; diff --git a/xfa/fde/ifde_txtedtengine.h b/xfa/fde/ifde_txtedtengine.h index 67944e01f9..f803eff079 100644 --- a/xfa/fde/ifde_txtedtengine.h +++ b/xfa/fde/ifde_txtedtengine.h @@ -85,8 +85,8 @@ struct FDE_TXTEDTPARAMS { FX_FLOAT fLineSpace; FX_FLOAT fTabWidth; bool bTabEquidistant; - FX_WCHAR wDefChar; - FX_WCHAR wLineBreakChar; + wchar_t wDefChar; + wchar_t wLineBreakChar; int32_t nLineEnd; int32_t nHorzScale; FX_FLOAT fCharSpace; diff --git a/xfa/fde/ifx_chariter.h b/xfa/fde/ifx_chariter.h index c967efd4d6..0e4adc5d01 100644 --- a/xfa/fde/ifx_chariter.h +++ b/xfa/fde/ifx_chariter.h @@ -14,7 +14,7 @@ class IFX_CharIter { virtual ~IFX_CharIter() {} virtual bool Next(bool bPrev = false) = 0; - virtual FX_WCHAR GetChar() = 0; + virtual wchar_t GetChar() = 0; virtual void SetAt(int32_t nIndex) = 0; virtual int32_t GetAt() const = 0; virtual bool IsEOF(bool bTail = true) const = 0; diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp index 02b1522823..36f341b39c 100644 --- a/xfa/fde/tto/fde_textout.cpp +++ b/xfa/fde/tto/fde_textout.cpp @@ -82,7 +82,7 @@ void CFDE_TextOut::SetEllipsisString(const CFX_WideString& wsEllipsis) { m_wsEllipsis = wsEllipsis; } -void CFDE_TextOut::SetParagraphBreakChar(FX_WCHAR wch) { +void CFDE_TextOut::SetParagraphBreakChar(wchar_t wch) { m_wParagraphBkChar = wch; m_pTxtBreak->SetParagraphBreakChar(wch); } @@ -151,7 +151,7 @@ int32_t CFDE_TextOut::GetTotalLines() { return m_iTotalLines; } -void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr, +void CFDE_TextOut::CalcLogicSize(const wchar_t* pwsStr, int32_t iLength, CFX_SizeF& size) { CFX_RectF rtText(0.0f, 0.0f, size.width, size.height); @@ -159,7 +159,7 @@ void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr, size = rtText.Size(); } -void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr, +void CFDE_TextOut::CalcLogicSize(const wchar_t* pwsStr, int32_t iLength, CFX_RectF& rect) { if (!pwsStr || iLength < 1) { @@ -170,21 +170,21 @@ void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr, } } -void CFDE_TextOut::CalcTextSize(const FX_WCHAR* pwsStr, +void CFDE_TextOut::CalcTextSize(const wchar_t* pwsStr, int32_t iLength, CFX_RectF& rect) { ASSERT(m_pFont && m_fFontSize >= 1.0f); SetLineWidth(rect); m_iTotalLines = 0; - const FX_WCHAR* pStr = pwsStr; + const wchar_t* pStr = pwsStr; bool bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey); FX_FLOAT fWidth = 0.0f; FX_FLOAT fHeight = 0.0f; FX_FLOAT fStartPos = rect.right(); CFX_BreakType dwBreakStatus = CFX_BreakType::None; - FX_WCHAR wPreChar = 0; - FX_WCHAR wch; - FX_WCHAR wBreak = 0; + wchar_t wPreChar = 0; + wchar_t wch; + wchar_t wBreak = 0; while (iLength-- > 0) { wch = *pStr++; if (wBreak == 0 && (wch == L'\n' || wch == L'\r')) { @@ -264,7 +264,7 @@ bool CFDE_TextOut::RetrieveLineWidth(CFX_BreakType dwBreakStatus, return true; } -void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, +void CFDE_TextOut::DrawText(const wchar_t* pwsStr, int32_t iLength, int32_t x, int32_t y) { @@ -273,7 +273,7 @@ void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, DrawText(pwsStr, iLength, rtText); } -void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, +void CFDE_TextOut::DrawText(const wchar_t* pwsStr, int32_t iLength, FX_FLOAT x, FX_FLOAT y) { @@ -281,13 +281,13 @@ void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, CFX_RectF(x, y, m_fFontSize * 1000.0f, m_fFontSize * 1000.0f)); } -void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, +void CFDE_TextOut::DrawText(const wchar_t* pwsStr, int32_t iLength, const CFX_Rect& rect) { DrawText(pwsStr, iLength, rect.As<FX_FLOAT>()); } -void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, +void CFDE_TextOut::DrawText(const wchar_t* pwsStr, int32_t iLength, const CFX_RectF& rect) { CFX_RectF rtText(rect.left, rect.top, rect.width, rect.height); @@ -297,7 +297,7 @@ void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, DrawText(pwsStr, iLength, rtText, m_rtClip); } -void CFDE_TextOut::DrawLogicText(const FX_WCHAR* pwsStr, +void CFDE_TextOut::DrawLogicText(const wchar_t* pwsStr, int32_t iLength, FX_FLOAT x, FX_FLOAT y) { @@ -305,7 +305,7 @@ void CFDE_TextOut::DrawLogicText(const FX_WCHAR* pwsStr, DrawLogicText(pwsStr, iLength, rtText); } -void CFDE_TextOut::DrawLogicText(const FX_WCHAR* pwsStr, +void CFDE_TextOut::DrawLogicText(const wchar_t* pwsStr, int32_t iLength, const CFX_RectF& rect) { CFX_RectF rtClip(m_rtLogicClip.left, m_rtLogicClip.top, m_rtLogicClip.width, @@ -314,7 +314,7 @@ void CFDE_TextOut::DrawLogicText(const FX_WCHAR* pwsStr, DrawText(pwsStr, iLength, rect, rtClip); } -void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, +void CFDE_TextOut::DrawText(const wchar_t* pwsStr, int32_t iLength, const CFX_RectF& rect, const CFX_RectF& rtClip) { @@ -367,9 +367,9 @@ void CFDE_TextOut::LoadEllipsis() { return; } ExpandBuffer(iLength, 1); - const FX_WCHAR* pStr = m_wsEllipsis.c_str(); + const wchar_t* pStr = m_wsEllipsis.c_str(); CFX_BreakType dwBreakStatus; - FX_WCHAR wch; + wchar_t wch; while (iLength-- > 0) { wch = *pStr++; dwBreakStatus = m_pTxtBreak->AppendChar(wch); @@ -399,10 +399,10 @@ void CFDE_TextOut::RetrieveEllPieces(std::vector<int32_t>* pCharWidths) { m_pTxtBreak->ClearBreakPieces(); } -void CFDE_TextOut::LoadText(const FX_WCHAR* pwsStr, +void CFDE_TextOut::LoadText(const wchar_t* pwsStr, int32_t iLength, const CFX_RectF& rect) { - FX_WCHAR* pStr = m_wsText.GetBuffer(iLength); + wchar_t* pStr = m_wsText.GetBuffer(iLength); int32_t iTxtLength = iLength; ExpandBuffer(iTxtLength, 0); bool bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey); @@ -416,7 +416,7 @@ void CFDE_TextOut::LoadText(const FX_WCHAR* pwsStr, int32_t iChars = 0; int32_t iPieceWidths = 0; CFX_BreakType dwBreakStatus; - FX_WCHAR wch; + wchar_t wch; bool bRet = false; while (iTxtLength-- > 0) { wch = *pwsStr++; @@ -591,7 +591,7 @@ void CFDE_TextOut::Reload(const CFX_RectF& rect) { } void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) { - const FX_WCHAR* pwsStr = m_wsText.c_str(); + const wchar_t* pwsStr = m_wsText.c_str(); int32_t iPieceWidths = 0; FDE_TTOPIECE* pPiece = pLine->GetPtrAt(0); int32_t iStartChar = pPiece->iStartChar; @@ -599,7 +599,7 @@ void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) { int32_t iPieceCount = pLine->GetSize(); int32_t iPieceIndex = 0; CFX_BreakType dwBreakStatus = CFX_BreakType::None; - FX_WCHAR wch; + wchar_t wch; while (iPieceIndex < iPieceCount) { int32_t iStar = iStartChar; int32_t iEnd = pPiece->iChars + iStar; diff --git a/xfa/fde/tto/fde_textout.h b/xfa/fde/tto/fde_textout.h index 1519a81e8f..224a584a4e 100644 --- a/xfa/fde/tto/fde_textout.h +++ b/xfa/fde/tto/fde_textout.h @@ -84,7 +84,7 @@ class CFDE_TextOut { void SetStyles(uint32_t dwStyles); void SetTabWidth(FX_FLOAT fTabWidth); void SetEllipsisString(const CFX_WideString& wsEllipsis); - void SetParagraphBreakChar(FX_WCHAR wch); + void SetParagraphBreakChar(wchar_t wch); void SetAlignment(int32_t iAlignment); void SetLineSpace(FX_FLOAT fLineSpace); void SetDIBitmap(CFX_DIBitmap* pDIB); @@ -94,38 +94,35 @@ class CFDE_TextOut { void SetMatrix(const CFX_Matrix& matrix); void SetLineBreakTolerance(FX_FLOAT fTolerance); - void DrawText(const FX_WCHAR* pwsStr, int32_t iLength, int32_t x, int32_t y); - void DrawText(const FX_WCHAR* pwsStr, - int32_t iLength, - FX_FLOAT x, - FX_FLOAT y); - void DrawText(const FX_WCHAR* pwsStr, int32_t iLength, const CFX_Rect& rect); - void DrawText(const FX_WCHAR* pwsStr, int32_t iLength, const CFX_RectF& rect); + void DrawText(const wchar_t* pwsStr, int32_t iLength, int32_t x, int32_t y); + void DrawText(const wchar_t* pwsStr, int32_t iLength, FX_FLOAT x, FX_FLOAT y); + void DrawText(const wchar_t* pwsStr, int32_t iLength, const CFX_Rect& rect); + void DrawText(const wchar_t* pwsStr, int32_t iLength, const CFX_RectF& rect); void SetLogicClipRect(const CFX_RectF& rtClip); - void CalcLogicSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_SizeF& size); - void CalcLogicSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_RectF& rect); - void DrawLogicText(const FX_WCHAR* pwsStr, + void CalcLogicSize(const wchar_t* pwsStr, int32_t iLength, CFX_SizeF& size); + void CalcLogicSize(const wchar_t* pwsStr, int32_t iLength, CFX_RectF& rect); + void DrawLogicText(const wchar_t* pwsStr, int32_t iLength, FX_FLOAT x, FX_FLOAT y); - void DrawLogicText(const FX_WCHAR* pwsStr, + void DrawLogicText(const wchar_t* pwsStr, int32_t iLength, const CFX_RectF& rect); int32_t GetTotalLines(); protected: - void CalcTextSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_RectF& rect); + void CalcTextSize(const wchar_t* pwsStr, int32_t iLength, CFX_RectF& rect); bool RetrieveLineWidth(CFX_BreakType dwBreakStatus, FX_FLOAT& fStartPos, FX_FLOAT& fWidth, FX_FLOAT& fHeight); void SetLineWidth(CFX_RectF& rect); - void DrawText(const FX_WCHAR* pwsStr, + void DrawText(const wchar_t* pwsStr, int32_t iLength, const CFX_RectF& rect, const CFX_RectF& rtClip); - void LoadText(const FX_WCHAR* pwsStr, int32_t iLength, const CFX_RectF& rect); + void LoadText(const wchar_t* pwsStr, int32_t iLength, const CFX_RectF& rect); void LoadEllipsis(); void ExpandBuffer(int32_t iSize, int32_t iType); void RetrieveEllPieces(std::vector<int32_t>* pCharWidths); @@ -157,7 +154,7 @@ class CFDE_TextOut { int32_t m_iTxtBkAlignment; std::vector<int32_t> m_CharWidths; std::vector<int32_t> m_EllCharWidths; - FX_WCHAR m_wParagraphBkChar; + wchar_t m_wParagraphBkChar; FX_ARGB m_TxtColor; uint32_t m_dwStyles; uint32_t m_dwTxtBkStyles; diff --git a/xfa/fde/xml/fde_xml.h b/xfa/fde/xml/fde_xml.h index e773b30851..399a930615 100644 --- a/xfa/fde/xml/fde_xml.h +++ b/xfa/fde/xml/fde_xml.h @@ -40,6 +40,6 @@ struct FDE_XMLNODE { FDE_XMLNODETYPE eNodeType; }; -bool FDE_IsXMLValidChar(FX_WCHAR ch); +bool FDE_IsXMLValidChar(wchar_t ch); #endif // XFA_FDE_XML_FDE_XML_H_ diff --git a/xfa/fde/xml/fde_xml_imp.cpp b/xfa/fde/xml/fde_xml_imp.cpp index 3e5edaf459..541fd98a00 100644 --- a/xfa/fde/xml/fde_xml_imp.cpp +++ b/xfa/fde/xml/fde_xml_imp.cpp @@ -24,7 +24,7 @@ const uint16_t g_XMLValidCharRange[][2] = {{0x09, 0x09}, {0x20, 0xD7FF}, {0xE000, 0xFFFD}}; -bool FDE_IsXMLWhiteSpace(FX_WCHAR ch) { +bool FDE_IsXMLWhiteSpace(wchar_t ch) { return ch == L' ' || ch == 0x0A || ch == 0x0D || ch == 0x09; } @@ -44,7 +44,7 @@ const FDE_XMLNAMECHAR g_XMLNameChars[] = { {0xF900, 0xFDCF, true}, {0xFDF0, 0xFFFD, true}, }; -bool FDE_IsXMLNameChar(FX_WCHAR ch, bool bFirstChar) { +bool FDE_IsXMLNameChar(wchar_t ch, bool bFirstChar) { int32_t iStart = 0; int32_t iEnd = FX_ArraySize(g_XMLNameChars) - 1; while (iStart <= iEnd) { @@ -62,7 +62,7 @@ bool FDE_IsXMLNameChar(FX_WCHAR ch, bool bFirstChar) { } // namespace -bool FDE_IsXMLValidChar(FX_WCHAR ch) { +bool FDE_IsXMLValidChar(wchar_t ch) { int32_t iStart = 0; int32_t iEnd = FX_ArraySize(g_XMLValidCharRange) - 1; while (iStart <= iEnd) { @@ -137,7 +137,7 @@ int32_t CFDE_XMLNode::GetChildNodeIndex(CFDE_XMLNode* pNode) const { return -1; } -CFDE_XMLNode* CFDE_XMLNode::GetPath(const FX_WCHAR* pPath, +CFDE_XMLNode* CFDE_XMLNode::GetPath(const wchar_t* pPath, int32_t iLength, bool bQualifiedName) const { ASSERT(pPath); @@ -148,9 +148,9 @@ CFDE_XMLNode* CFDE_XMLNode::GetPath(const FX_WCHAR* pPath, return nullptr; } CFX_WideString csPath; - const FX_WCHAR* pStart = pPath; - const FX_WCHAR* pEnd = pPath + iLength; - FX_WCHAR ch; + const wchar_t* pStart = pPath; + const wchar_t* pEnd = pPath + iLength; + wchar_t ch; while (pStart < pEnd) { ch = *pStart++; if (ch == L'/') { @@ -562,7 +562,7 @@ bool CFDE_XMLInstruction::GetAttribute(int32_t index, return false; } -bool CFDE_XMLInstruction::HasAttribute(const FX_WCHAR* pwsAttriName) const { +bool CFDE_XMLInstruction::HasAttribute(const wchar_t* pwsAttriName) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) { @@ -572,9 +572,9 @@ bool CFDE_XMLInstruction::HasAttribute(const FX_WCHAR* pwsAttriName) const { return false; } -void CFDE_XMLInstruction::GetString(const FX_WCHAR* pwsAttriName, +void CFDE_XMLInstruction::GetString(const wchar_t* pwsAttriName, CFX_WideString& wsAttriValue, - const FX_WCHAR* pwsDefValue) const { + const wchar_t* pwsDefValue) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) { @@ -600,7 +600,7 @@ void CFDE_XMLInstruction::SetString(const CFX_WideString& wsAttriName, m_Attributes.push_back(wsAttriValue); } -int32_t CFDE_XMLInstruction::GetInteger(const FX_WCHAR* pwsAttriName, +int32_t CFDE_XMLInstruction::GetInteger(const wchar_t* pwsAttriName, int32_t iDefValue) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { @@ -611,14 +611,14 @@ int32_t CFDE_XMLInstruction::GetInteger(const FX_WCHAR* pwsAttriName, return iDefValue; } -void CFDE_XMLInstruction::SetInteger(const FX_WCHAR* pwsAttriName, +void CFDE_XMLInstruction::SetInteger(const wchar_t* pwsAttriName, int32_t iAttriValue) { CFX_WideString wsValue; wsValue.Format(L"%d", iAttriValue); SetString(pwsAttriName, wsValue); } -FX_FLOAT CFDE_XMLInstruction::GetFloat(const FX_WCHAR* pwsAttriName, +FX_FLOAT CFDE_XMLInstruction::GetFloat(const wchar_t* pwsAttriName, FX_FLOAT fDefValue) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { @@ -629,14 +629,14 @@ FX_FLOAT CFDE_XMLInstruction::GetFloat(const FX_WCHAR* pwsAttriName, return fDefValue; } -void CFDE_XMLInstruction::SetFloat(const FX_WCHAR* pwsAttriName, +void CFDE_XMLInstruction::SetFloat(const wchar_t* pwsAttriName, FX_FLOAT fAttriValue) { CFX_WideString wsValue; wsValue.Format(L"%f", fAttriValue); SetString(pwsAttriName, wsValue); } -void CFDE_XMLInstruction::RemoveAttribute(const FX_WCHAR* pwsAttriName) { +void CFDE_XMLInstruction::RemoveAttribute(const wchar_t* pwsAttriName) { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) { @@ -774,7 +774,7 @@ bool CFDE_XMLElement::GetAttribute(int32_t index, return false; } -bool CFDE_XMLElement::HasAttribute(const FX_WCHAR* pwsAttriName) const { +bool CFDE_XMLElement::HasAttribute(const wchar_t* pwsAttriName) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) @@ -783,9 +783,9 @@ bool CFDE_XMLElement::HasAttribute(const FX_WCHAR* pwsAttriName) const { return false; } -void CFDE_XMLElement::GetString(const FX_WCHAR* pwsAttriName, +void CFDE_XMLElement::GetString(const wchar_t* pwsAttriName, CFX_WideString& wsAttriValue, - const FX_WCHAR* pwsDefValue) const { + const wchar_t* pwsDefValue) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) { @@ -811,7 +811,7 @@ void CFDE_XMLElement::SetString(const CFX_WideString& wsAttriName, m_Attributes.push_back(wsAttriValue); } -int32_t CFDE_XMLElement::GetInteger(const FX_WCHAR* pwsAttriName, +int32_t CFDE_XMLElement::GetInteger(const wchar_t* pwsAttriName, int32_t iDefValue) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { @@ -822,14 +822,14 @@ int32_t CFDE_XMLElement::GetInteger(const FX_WCHAR* pwsAttriName, return iDefValue; } -void CFDE_XMLElement::SetInteger(const FX_WCHAR* pwsAttriName, +void CFDE_XMLElement::SetInteger(const wchar_t* pwsAttriName, int32_t iAttriValue) { CFX_WideString wsValue; wsValue.Format(L"%d", iAttriValue); SetString(pwsAttriName, wsValue); } -FX_FLOAT CFDE_XMLElement::GetFloat(const FX_WCHAR* pwsAttriName, +FX_FLOAT CFDE_XMLElement::GetFloat(const wchar_t* pwsAttriName, FX_FLOAT fDefValue) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { @@ -840,14 +840,14 @@ FX_FLOAT CFDE_XMLElement::GetFloat(const FX_WCHAR* pwsAttriName, return fDefValue; } -void CFDE_XMLElement::SetFloat(const FX_WCHAR* pwsAttriName, +void CFDE_XMLElement::SetFloat(const wchar_t* pwsAttriName, FX_FLOAT fAttriValue) { CFX_WideString wsValue; wsValue.Format(L"%f", fAttriValue); SetString(pwsAttriName, wsValue); } -void CFDE_XMLElement::RemoveAttribute(const FX_WCHAR* pwsAttriName) { +void CFDE_XMLElement::RemoveAttribute(const wchar_t* pwsAttriName) { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) { @@ -1112,14 +1112,14 @@ CFDE_BlockBuffer::~CFDE_BlockBuffer() { ClearBuffer(); } -FX_WCHAR* CFDE_BlockBuffer::GetAvailableBlock(int32_t& iIndexInBlock) { +wchar_t* CFDE_BlockBuffer::GetAvailableBlock(int32_t& iIndexInBlock) { iIndexInBlock = 0; if (!m_BlockArray.GetSize()) { return nullptr; } int32_t iRealIndex = m_iStartPosition + m_iDataLength; if (iRealIndex == m_iBufferSize) { - FX_WCHAR* pBlock = FX_Alloc(FX_WCHAR, m_iAllocStep); + wchar_t* pBlock = FX_Alloc(wchar_t, m_iAllocStep); m_BlockArray.Add(pBlock); m_iBufferSize += m_iAllocStep; return pBlock; @@ -1132,13 +1132,13 @@ bool CFDE_BlockBuffer::InitBuffer(int32_t iBufferSize) { ClearBuffer(); int32_t iNumOfBlock = (iBufferSize - 1) / m_iAllocStep + 1; for (int32_t i = 0; i < iNumOfBlock; i++) { - m_BlockArray.Add(FX_Alloc(FX_WCHAR, m_iAllocStep)); + m_BlockArray.Add(FX_Alloc(wchar_t, m_iAllocStep)); } m_iBufferSize = iNumOfBlock * m_iAllocStep; return true; } -void CFDE_BlockBuffer::SetTextChar(int32_t iIndex, FX_WCHAR ch) { +void CFDE_BlockBuffer::SetTextChar(int32_t iIndex, wchar_t ch) { if (iIndex < 0) { return; } @@ -1149,12 +1149,12 @@ void CFDE_BlockBuffer::SetTextChar(int32_t iIndex, FX_WCHAR ch) { if (iBlockIndex >= iBlockSize) { int32_t iNewBlocks = iBlockIndex - iBlockSize + 1; do { - FX_WCHAR* pBlock = FX_Alloc(FX_WCHAR, m_iAllocStep); + wchar_t* pBlock = FX_Alloc(wchar_t, m_iAllocStep); m_BlockArray.Add(pBlock); m_iBufferSize += m_iAllocStep; } while (--iNewBlocks); } - FX_WCHAR* pTextData = m_BlockArray[iBlockIndex]; + wchar_t* pTextData = m_BlockArray[iBlockIndex]; *(pTextData + iInnerIndex) = ch; if (m_iDataLength <= iIndex) { m_iDataLength = iIndex + 1; @@ -1192,7 +1192,7 @@ void CFDE_BlockBuffer::GetTextData(CFX_WideString& wsTextData, if (iLength <= 0) { return; } - FX_WCHAR* pBuf = wsTextData.GetBuffer(iLength); + wchar_t* pBuf = wsTextData.GetBuffer(iLength); if (!pBuf) { return; } @@ -1213,9 +1213,9 @@ void CFDE_BlockBuffer::GetTextData(CFX_WideString& wsTextData, if (i == iEndBlockIndex) { iCopyLength -= ((m_iAllocStep - 1) - iEndInnerIndex); } - FX_WCHAR* pBlockBuf = m_BlockArray[i]; + wchar_t* pBlockBuf = m_BlockArray[i]; FXSYS_memcpy(pBuf + iPointer, pBlockBuf + iBufferPointer, - iCopyLength * sizeof(FX_WCHAR)); + iCopyLength * sizeof(wchar_t)); iPointer += iCopyLength; } wsTextData.ReleaseBuffer(iLength); @@ -1286,7 +1286,7 @@ void CFDE_XMLSyntaxParser::Init(const CFX_RetainPtr<IFGAS_Stream>& pStream, } m_pBuffer = FX_Alloc( - FX_WCHAR, pdfium::base::ValueOrDieForType<size_t>(alloc_size_safe)); + wchar_t, pdfium::base::ValueOrDieForType<size_t>(alloc_size_safe)); m_pStart = m_pEnd = m_pBuffer; ASSERT(!m_BlockBuffer.IsInitialized()); m_BlockBuffer.InitBuffer(); @@ -1330,7 +1330,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() { } while (m_pStart < m_pEnd) { - FX_WCHAR ch = *m_pStart; + wchar_t ch = *m_pStart; switch (m_syntaxParserState) { case FDE_XmlSyntaxState::Text: if (ch == L'<') { @@ -1778,7 +1778,7 @@ int32_t CFDE_XMLSyntaxParser::GetStatus() const { return m_iParsedBytes * 100 / iStreamLength; } -static int32_t FX_GetUTF8EncodeLength(const FX_WCHAR* pSrc, int32_t iSrcLen) { +static int32_t FX_GetUTF8EncodeLength(const wchar_t* pSrc, int32_t iSrcLen) { uint32_t unicode = 0; int32_t iDstNum = 0; while (iSrcLen-- > 0) { @@ -1811,7 +1811,7 @@ FX_FILESIZE CFDE_XMLSyntaxParser::GetCurrentBinaryPos() const { return m_iParsedBytes + nDstLen; } -void CFDE_XMLSyntaxParser::ParseTextChar(FX_WCHAR character) { +void CFDE_XMLSyntaxParser::ParseTextChar(wchar_t character) { if (m_iIndexInBlock == m_iAllocStep) { m_pCurrentBlock = m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock); if (!m_pCurrentBlock) { @@ -1828,7 +1828,7 @@ void CFDE_XMLSyntaxParser::ParseTextChar(FX_WCHAR character) { if (iLen > 0) { if (csEntity[0] == L'#') { uint32_t ch = 0; - FX_WCHAR w; + wchar_t w; if (iLen > 1 && csEntity[1] == L'x') { for (int32_t i = 2; i < iLen; i++) { w = csEntity[i]; @@ -1853,7 +1853,7 @@ void CFDE_XMLSyntaxParser::ParseTextChar(FX_WCHAR character) { if (ch > kMaxCharRange) ch = ' '; - character = static_cast<FX_WCHAR>(ch); + character = static_cast<wchar_t>(ch); if (character != 0) { m_BlockBuffer.SetTextChar(m_iEntityStart, character); m_iEntityStart++; diff --git a/xfa/fde/xml/fde_xml_imp.h b/xfa/fde/xml/fde_xml_imp.h index d9ccbea506..7ae05a4936 100644 --- a/xfa/fde/xml/fde_xml_imp.h +++ b/xfa/fde/xml/fde_xml_imp.h @@ -56,7 +56,7 @@ class CFDE_XMLNode { void DeleteChildren(); void CloneChildren(CFDE_XMLNode* pClone); - CFDE_XMLNode* GetPath(const FX_WCHAR* pPath, + CFDE_XMLNode* GetPath(const wchar_t* pPath, int32_t iLength = -1, bool bQualifiedName = true) const; @@ -87,17 +87,17 @@ class CFDE_XMLInstruction : public CFDE_XMLNode { bool GetAttribute(int32_t index, CFX_WideString& wsAttriName, CFX_WideString& wsAttriValue) const; - bool HasAttribute(const FX_WCHAR* pwsAttriName) const; - void GetString(const FX_WCHAR* pwsAttriName, + bool HasAttribute(const wchar_t* pwsAttriName) const; + void GetString(const wchar_t* pwsAttriName, CFX_WideString& wsAttriValue, - const FX_WCHAR* pwsDefValue = nullptr) const; + const wchar_t* pwsDefValue = nullptr) const; void SetString(const CFX_WideString& wsAttriName, const CFX_WideString& wsAttriValue); - int32_t GetInteger(const FX_WCHAR* pwsAttriName, int32_t iDefValue = 0) const; - void SetInteger(const FX_WCHAR* pwsAttriName, int32_t iAttriValue); - FX_FLOAT GetFloat(const FX_WCHAR* pwsAttriName, FX_FLOAT fDefValue = 0) const; - void SetFloat(const FX_WCHAR* pwsAttriName, FX_FLOAT fAttriValue); - void RemoveAttribute(const FX_WCHAR* pwsAttriName); + int32_t GetInteger(const wchar_t* pwsAttriName, int32_t iDefValue = 0) const; + void SetInteger(const wchar_t* pwsAttriName, int32_t iAttriValue); + FX_FLOAT GetFloat(const wchar_t* pwsAttriName, FX_FLOAT fDefValue = 0) const; + void SetFloat(const wchar_t* pwsAttriName, FX_FLOAT fAttriValue); + void RemoveAttribute(const wchar_t* pwsAttriName); int32_t CountData() const; bool GetData(int32_t index, CFX_WideString& wsData) const; void AppendData(const CFX_WideString& wsData); @@ -127,20 +127,20 @@ class CFDE_XMLElement : public CFDE_XMLNode { bool GetAttribute(int32_t index, CFX_WideString& wsAttriName, CFX_WideString& wsAttriValue) const; - bool HasAttribute(const FX_WCHAR* pwsAttriName) const; - void RemoveAttribute(const FX_WCHAR* pwsAttriName); + bool HasAttribute(const wchar_t* pwsAttriName) const; + void RemoveAttribute(const wchar_t* pwsAttriName); - void GetString(const FX_WCHAR* pwsAttriName, + void GetString(const wchar_t* pwsAttriName, CFX_WideString& wsAttriValue, - const FX_WCHAR* pwsDefValue = nullptr) const; + const wchar_t* pwsDefValue = nullptr) const; void SetString(const CFX_WideString& wsAttriName, const CFX_WideString& wsAttriValue); - int32_t GetInteger(const FX_WCHAR* pwsAttriName, int32_t iDefValue = 0) const; - void SetInteger(const FX_WCHAR* pwsAttriName, int32_t iAttriValue); + int32_t GetInteger(const wchar_t* pwsAttriName, int32_t iDefValue = 0) const; + void SetInteger(const wchar_t* pwsAttriName, int32_t iAttriValue); - FX_FLOAT GetFloat(const FX_WCHAR* pwsAttriName, FX_FLOAT fDefValue = 0) const; - void SetFloat(const FX_WCHAR* pwsAttriName, FX_FLOAT fAttriValue); + FX_FLOAT GetFloat(const wchar_t* pwsAttriName, FX_FLOAT fDefValue = 0) const; + void SetFloat(const wchar_t* pwsAttriName, FX_FLOAT fAttriValue); void GetTextData(CFX_WideString& wsText) const; void SetTextData(const CFX_WideString& wsText); @@ -222,7 +222,7 @@ class CFDE_BlockBuffer { bool InitBuffer(int32_t iBufferSize = 1024 * 1024); bool IsInitialized() { return m_iBufferSize / m_iAllocStep >= 1; } - FX_WCHAR* GetAvailableBlock(int32_t& iIndexInBlock); + wchar_t* GetAvailableBlock(int32_t& iIndexInBlock); inline int32_t GetAllocStep() const { return m_iAllocStep; } inline int32_t& GetDataLengthRef() { return m_iDataLength; } inline void Reset(bool bReserveData = true) { @@ -231,7 +231,7 @@ class CFDE_BlockBuffer { } m_iDataLength = 0; } - void SetTextChar(int32_t iIndex, FX_WCHAR ch); + void SetTextChar(int32_t iIndex, wchar_t ch); int32_t DeleteTextChars(int32_t iCount, bool bDirection = true); void GetTextData(CFX_WideString& wsTextData, int32_t iStart = 0, @@ -243,7 +243,7 @@ class CFDE_BlockBuffer { int32_t& iInnerIndex) const; void ClearBuffer(); - CFX_ArrayTemplate<FX_WCHAR*> m_BlockArray; + CFX_ArrayTemplate<wchar_t*> m_BlockArray; int32_t m_iDataLength; int32_t m_iBufferSize; int32_t m_iAllocStep; @@ -312,7 +312,7 @@ class CFDE_XMLSyntaxParser { TargetData }; - void ParseTextChar(FX_WCHAR ch); + void ParseTextChar(wchar_t ch); CFX_RetainPtr<IFGAS_Stream> m_pStream; int32_t m_iXMLPlaneSize; @@ -321,25 +321,25 @@ class CFDE_XMLSyntaxParser { int32_t m_iLastNodeNum; int32_t m_iParsedChars; int32_t m_iParsedBytes; - FX_WCHAR* m_pBuffer; + wchar_t* m_pBuffer; int32_t m_iBufferChars; bool m_bEOS; - FX_WCHAR* m_pStart; - FX_WCHAR* m_pEnd; + wchar_t* m_pStart; + wchar_t* m_pEnd; FDE_XMLNODE m_CurNode; std::stack<FDE_XMLNODE> m_XMLNodeStack; CFDE_BlockBuffer m_BlockBuffer; int32_t m_iAllocStep; int32_t& m_iDataLength; - FX_WCHAR* m_pCurrentBlock; + wchar_t* m_pCurrentBlock; int32_t m_iIndexInBlock; int32_t m_iTextDataLength; FDE_XmlSyntaxResult m_syntaxParserResult; FDE_XmlSyntaxState m_syntaxParserState; - FX_WCHAR m_wQuotationMark; + wchar_t m_wQuotationMark; int32_t m_iEntityStart; - std::stack<FX_WCHAR> m_SkipStack; - FX_WCHAR m_SkipChar; + std::stack<wchar_t> m_SkipStack; + wchar_t m_SkipChar; }; #endif // XFA_FDE_XML_FDE_XML_IMP_H_ diff --git a/xfa/fde/xml/fde_xml_imp_unittest.cpp b/xfa/fde/xml/fde_xml_imp_unittest.cpp index 6db1b1905a..6191025fd2 100644 --- a/xfa/fde/xml/fde_xml_imp_unittest.cpp +++ b/xfa/fde/xml/fde_xml_imp_unittest.cpp @@ -10,7 +10,7 @@ #include "xfa/fgas/crt/fgas_stream.h" TEST(CFDE_XMLSyntaxParser, CData) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <![CDATA[\n" L" if (a[1] < 3)\n" @@ -18,16 +18,16 @@ TEST(CFDE_XMLSyntaxParser, CData) { L" ]]>\n" L"</script>"; - const FX_WCHAR* cdata = + const wchar_t* cdata = L"\n" L" if (a[1] < 3)\n" L" app.alert(\"Tclams\");\n" L" "; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -65,7 +65,7 @@ TEST(CFDE_XMLSyntaxParser, CData) { } TEST(CFDE_XMLSyntaxParser, CDataWithInnerScript) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <![CDATA[\n" L" if (a[1] < 3)\n" @@ -74,17 +74,17 @@ TEST(CFDE_XMLSyntaxParser, CDataWithInnerScript) { L" ]]>\n" L"</script>"; - const FX_WCHAR* cdata = + const wchar_t* cdata = L"\n" L" if (a[1] < 3)\n" L" app.alert(\"Tclams\");\n" L" </script>\n" L" "; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -122,15 +122,15 @@ TEST(CFDE_XMLSyntaxParser, CDataWithInnerScript) { } TEST(CFDE_XMLSyntaxParser, ArrowBangArrow) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <!>\n" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -164,15 +164,15 @@ TEST(CFDE_XMLSyntaxParser, ArrowBangArrow) { } TEST(CFDE_XMLSyntaxParser, ArrowBangBracketArrow) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <![>\n" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -200,15 +200,15 @@ TEST(CFDE_XMLSyntaxParser, ArrowBangBracketArrow) { } TEST(CFDE_XMLSyntaxParser, IncompleteCData) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <![CDATA>\n" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -236,15 +236,15 @@ TEST(CFDE_XMLSyntaxParser, IncompleteCData) { } TEST(CFDE_XMLSyntaxParser, UnClosedCData) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <![CDATA[\n" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -272,15 +272,15 @@ TEST(CFDE_XMLSyntaxParser, UnClosedCData) { } TEST(CFDE_XMLSyntaxParser, EmptyCData) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <![CDATA[]]>\n" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -318,15 +318,15 @@ TEST(CFDE_XMLSyntaxParser, EmptyCData) { } TEST(CFDE_XMLSyntaxParser, Comment) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <!-- A Comment -->\n" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -360,15 +360,15 @@ TEST(CFDE_XMLSyntaxParser, Comment) { } TEST(CFDE_XMLSyntaxParser, IncorrectCommentStart) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <!- A Comment -->\n" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -402,15 +402,15 @@ TEST(CFDE_XMLSyntaxParser, IncorrectCommentStart) { } TEST(CFDE_XMLSyntaxParser, CommentEmpty) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <!---->\n" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -444,15 +444,15 @@ TEST(CFDE_XMLSyntaxParser, CommentEmpty) { } TEST(CFDE_XMLSyntaxParser, CommentThreeDash) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <!--->\n" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -478,15 +478,15 @@ TEST(CFDE_XMLSyntaxParser, CommentThreeDash) { } TEST(CFDE_XMLSyntaxParser, CommentTwoDash) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <!-->\n" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -512,7 +512,7 @@ TEST(CFDE_XMLSyntaxParser, CommentTwoDash) { } TEST(CFDE_XMLSyntaxParser, Entities) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">" L"B" L"T" @@ -521,10 +521,10 @@ TEST(CFDE_XMLSyntaxParser, Entities) { L"�" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -554,16 +554,16 @@ TEST(CFDE_XMLSyntaxParser, Entities) { } TEST(CFDE_XMLSyntaxParser, EntityOverflowHex) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">" L"�" L"�" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -593,16 +593,16 @@ TEST(CFDE_XMLSyntaxParser, EntityOverflowHex) { } TEST(CFDE_XMLSyntaxParser, EntityOverflowDecimal) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">" L"�" L"�" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); diff --git a/xfa/fgas/crt/fgas_codepage.cpp b/xfa/fgas/crt/fgas_codepage.cpp index 36f87a36f3..5f824667fb 100644 --- a/xfa/fgas/crt/fgas_codepage.cpp +++ b/xfa/fgas/crt/fgas_codepage.cpp @@ -261,7 +261,7 @@ const FX_STR2CPHASH g_FXCPHashTable[] = { {0xf637e157, 0x478}, {0xfc213f3a, 0x2717}, {0xff654d14, 0x3b5}, }; -uint16_t GetCodePageFromStringA(const FX_CHAR* pStr, int32_t iLength) { +uint16_t GetCodePageFromStringA(const char* pStr, int32_t iLength) { ASSERT(pStr); if (iLength < 0) { iLength = FXSYS_strlen(pStr); @@ -325,7 +325,7 @@ uint16_t FX_GetDefCodePageByLanguage(uint16_t wLanguage) { return 0xFFFF; } -uint16_t FX_GetCodePageFromStringW(const FX_WCHAR* pStr, int32_t iLength) { +uint16_t FX_GetCodePageFromStringW(const wchar_t* pStr, int32_t iLength) { if (iLength < 0) { iLength = FXSYS_wcslen(pStr); } @@ -333,21 +333,21 @@ uint16_t FX_GetCodePageFromStringW(const FX_WCHAR* pStr, int32_t iLength) { return 0xFFFF; } CFX_ByteString csStr; - FX_CHAR* pBuf = csStr.GetBuffer(iLength + 1); + char* pBuf = csStr.GetBuffer(iLength + 1); for (int32_t i = 0; i < iLength; ++i) { - *pBuf++ = (FX_CHAR)*pStr++; + *pBuf++ = (char)*pStr++; } csStr.ReleaseBuffer(iLength); return GetCodePageFromStringA(csStr.c_str(), iLength); } -void FX_SwapByteOrder(FX_WCHAR* pStr, int32_t iLength) { +void FX_SwapByteOrder(wchar_t* pStr, int32_t iLength) { ASSERT(pStr); if (iLength < 0) { iLength = FXSYS_wcslen(pStr); } uint16_t wch; - if (sizeof(FX_WCHAR) > 2) { + if (sizeof(wchar_t) > 2) { while (iLength-- > 0) { wch = (uint16_t)*pStr; wch = (wch >> 8) | (wch << 8); @@ -365,20 +365,20 @@ void FX_SwapByteOrder(FX_WCHAR* pStr, int32_t iLength) { void FX_UTF16ToWChar(void* pBuffer, int32_t iLength) { ASSERT(pBuffer && iLength > 0); - if (sizeof(FX_WCHAR) == 2) { + if (sizeof(wchar_t) == 2) { return; } uint16_t* pSrc = (uint16_t*)pBuffer; - FX_WCHAR* pDst = (FX_WCHAR*)pBuffer; + wchar_t* pDst = (wchar_t*)pBuffer; while (--iLength >= 0) { - pDst[iLength] = (FX_WCHAR)pSrc[iLength]; + pDst[iLength] = (wchar_t)pSrc[iLength]; } } int32_t FX_DecodeString(uint16_t wCodePage, - const FX_CHAR* pSrc, + const char* pSrc, int32_t* pSrcLen, - FX_WCHAR* pDst, + wchar_t* pDst, int32_t* pDstLen, bool bErrBreak) { if (wCodePage == FX_CODEPAGE_UTF8) { @@ -386,9 +386,9 @@ int32_t FX_DecodeString(uint16_t wCodePage, } return -1; } -int32_t FX_UTF8Decode(const FX_CHAR* pSrc, +int32_t FX_UTF8Decode(const char* pSrc, int32_t* pSrcLen, - FX_WCHAR* pDst, + wchar_t* pDst, int32_t* pDstLen) { if (!pSrcLen || !pDstLen) { return -1; diff --git a/xfa/fgas/crt/fgas_codepage.h b/xfa/fgas/crt/fgas_codepage.h index 780c20e233..e3a535edfc 100644 --- a/xfa/fgas/crt/fgas_codepage.h +++ b/xfa/fgas/crt/fgas_codepage.h @@ -134,20 +134,20 @@ #define FX_CHARSET_OEM 255 uint16_t FX_GetCodePageFromCharset(uint8_t charset); -uint16_t FX_GetCodePageFromStringW(const FX_WCHAR* pStr, int32_t iLength); +uint16_t FX_GetCodePageFromStringW(const wchar_t* pStr, int32_t iLength); uint16_t FX_GetDefCodePageByLanguage(uint16_t wLanguage); -void FX_SwapByteOrder(FX_WCHAR* pStr, int32_t iLength); +void FX_SwapByteOrder(wchar_t* pStr, int32_t iLength); void FX_UTF16ToWChar(void* pBuffer, int32_t iLength); int32_t FX_DecodeString(uint16_t wCodePage, - const FX_CHAR* pSrc, + const char* pSrc, int32_t* pSrcLen, - FX_WCHAR* pDst, + wchar_t* pDst, int32_t* pDstLen, bool bErrBreak); -int32_t FX_UTF8Decode(const FX_CHAR* pSrc, +int32_t FX_UTF8Decode(const char* pSrc, int32_t* pSrcLen, - FX_WCHAR* pDst, + wchar_t* pDst, int32_t* pDstLen); #endif // XFA_FGAS_CRT_FGAS_CODEPAGE_H_ diff --git a/xfa/fgas/crt/fgas_stream.cpp b/xfa/fgas/crt/fgas_stream.cpp index 424b191cb8..02096d4966 100644 --- a/xfa/fgas/crt/fgas_stream.cpp +++ b/xfa/fgas/crt/fgas_stream.cpp @@ -28,11 +28,9 @@ class IFGAS_StreamImp { virtual int32_t GetPosition() = 0; virtual bool IsEOF() const = 0; virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) = 0; - virtual int32_t ReadString(FX_WCHAR* pStr, - int32_t iMaxLength, - bool& bEOS) = 0; + virtual int32_t ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) = 0; virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) = 0; - virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) = 0; + virtual int32_t WriteString(const wchar_t* pStr, int32_t iLength) = 0; virtual void Flush() = 0; virtual bool SetLength(int32_t iLength) = 0; @@ -51,7 +49,7 @@ class CFGAS_FileStreamImp : public IFGAS_StreamImp { CFGAS_FileStreamImp(); ~CFGAS_FileStreamImp() override; - bool LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess); + bool LoadFile(const wchar_t* pszSrcFileName, uint32_t dwAccess); // IFGAS_StreamImp: int32_t GetLength() const override; @@ -59,9 +57,9 @@ class CFGAS_FileStreamImp : public IFGAS_StreamImp { int32_t GetPosition() override; bool IsEOF() const override; int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override; - int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override; + int32_t ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) override; int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override; - int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override; + int32_t WriteString(const wchar_t* pStr, int32_t iLength) override; void Flush() override; bool SetLength(int32_t iLength) override; @@ -83,9 +81,9 @@ class CFGAS_BufferStreamImp : public IFGAS_StreamImp { int32_t GetPosition() override; bool IsEOF() const override; int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override; - int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override; + int32_t ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) override; int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override; - int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override; + int32_t WriteString(const wchar_t* pStr, int32_t iLength) override; void Flush() override {} bool SetLength(int32_t iLength) override { return false; } @@ -110,11 +108,11 @@ class CFGAS_FileReadStreamImp : public IFGAS_StreamImp { int32_t GetPosition() override { return m_iPosition; } bool IsEOF() const override; int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override; - int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override; + int32_t ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) override; int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override { return 0; } - int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override { + int32_t WriteString(const wchar_t* pStr, int32_t iLength) override { return 0; } void Flush() override {} @@ -141,11 +139,11 @@ class CFGAS_BufferReadStreamImp : public IFGAS_StreamImp { int32_t GetPosition() override { return m_iPosition; } bool IsEOF() const override; int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override; - int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override; + int32_t ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) override; int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override { return 0; } - int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override { + int32_t WriteString(const wchar_t* pStr, int32_t iLength) override { return 0; } void Flush() override {} @@ -171,11 +169,11 @@ class CFGAS_FileWriteStreamImp : public IFGAS_StreamImp { int32_t GetPosition() override { return m_iPosition; } bool IsEOF() const override; int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override { return 0; } - int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override { + int32_t ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) override { return 0; } int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override; - int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override; + int32_t WriteString(const wchar_t* pStr, int32_t iLength) override; void Flush() override; bool SetLength(int32_t iLength) override { return false; } @@ -197,7 +195,7 @@ class CFGAS_Stream : public IFGAS_Stream { template <typename T, typename... Args> friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args); - bool LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess); + bool LoadFile(const wchar_t* pszSrcFileName, uint32_t dwAccess); bool LoadBuffer(uint8_t* pData, int32_t iTotalSize, uint32_t dwAccess); bool LoadFileRead(const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead, uint32_t dwAccess); @@ -214,9 +212,9 @@ class CFGAS_Stream : public IFGAS_Stream { int32_t GetPosition() override; bool IsEOF() const override; int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override; - int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override; + int32_t ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) override; int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override; - int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override; + int32_t WriteString(const wchar_t* pStr, int32_t iLength) override; void Flush() override; bool SetLength(int32_t iLength) override; int32_t GetBOM(uint8_t bom[4]) const override; @@ -252,9 +250,9 @@ class CFGAS_TextStream : public IFGAS_Stream { int32_t GetPosition() override; bool IsEOF() const override; int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override; - int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override; + int32_t ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) override; int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override; - int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override; + int32_t WriteString(const wchar_t* pStr, int32_t iLength) override; void Flush() override; bool SetLength(int32_t iLength) override; int32_t GetBOM(uint8_t bom[4]) const override; @@ -376,13 +374,13 @@ CFGAS_FileStreamImp::~CFGAS_FileStreamImp() { FXSYS_fclose(m_hFile); } -bool CFGAS_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName, +bool CFGAS_FileStreamImp::LoadFile(const wchar_t* pszSrcFileName, uint32_t dwAccess) { ASSERT(!m_hFile); ASSERT(pszSrcFileName && FXSYS_wcslen(pszSrcFileName) > 0); #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \ _FX_OS_ == _FX_WIN64_ - const FX_WCHAR* wsMode; + const wchar_t* wsMode; if (dwAccess & FX_STREAMACCESS_Write) { if (dwAccess & FX_STREAMACCESS_Append) { wsMode = L"a+b"; @@ -414,7 +412,7 @@ bool CFGAS_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName, } } #else - const FX_CHAR* wsMode = "rb"; + const char* wsMode = "rb"; if (dwAccess & FX_STREAMACCESS_Write) { if (dwAccess & FX_STREAMACCESS_Append) { wsMode = "a+b"; @@ -476,7 +474,7 @@ int32_t CFGAS_FileStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { ASSERT(pBuffer && iBufferSize > 0); return FXSYS_fread(pBuffer, 1, iBufferSize, m_hFile); } -int32_t CFGAS_FileStreamImp::ReadString(FX_WCHAR* pStr, +int32_t CFGAS_FileStreamImp::ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) { ASSERT(m_hFile); @@ -514,8 +512,7 @@ int32_t CFGAS_FileStreamImp::WriteData(const uint8_t* pBuffer, } return iRet; } -int32_t CFGAS_FileStreamImp::WriteString(const FX_WCHAR* pStr, - int32_t iLength) { +int32_t CFGAS_FileStreamImp::WriteString(const wchar_t* pStr, int32_t iLength) { ASSERT(m_hFile && (GetAccessModes() & FX_STREAMACCESS_Write) != 0); ASSERT(pStr && iLength > 0); int32_t iRet = FXSYS_fwrite(pStr, 2, iLength, m_hFile); @@ -591,7 +588,7 @@ int32_t CFGAS_FileReadStreamImp::ReadData(uint8_t* pBuffer, } return 0; } -int32_t CFGAS_FileReadStreamImp::ReadString(FX_WCHAR* pStr, +int32_t CFGAS_FileReadStreamImp::ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) { ASSERT(m_pFileRead); @@ -716,7 +713,7 @@ int32_t CFGAS_BufferReadStreamImp::ReadData(uint8_t* pBuffer, m_iPosition += dwOffsetTmp; return dwOffsetTmp; } -int32_t CFGAS_BufferReadStreamImp::ReadString(FX_WCHAR* pStr, +int32_t CFGAS_BufferReadStreamImp::ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) { ASSERT(m_pBufferRead); @@ -788,9 +785,9 @@ int32_t CFGAS_FileWriteStreamImp::WriteData(const uint8_t* pBuffer, } return iBufferSize; } -int32_t CFGAS_FileWriteStreamImp::WriteString(const FX_WCHAR* pStr, +int32_t CFGAS_FileWriteStreamImp::WriteString(const wchar_t* pStr, int32_t iLength) { - return WriteData((const uint8_t*)pStr, iLength * sizeof(FX_WCHAR)); + return WriteData((const uint8_t*)pStr, iLength * sizeof(wchar_t)); } void CFGAS_FileWriteStreamImp::Flush() { if (m_pFileWrite) { @@ -851,7 +848,7 @@ int32_t CFGAS_BufferStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { m_iPosition += iLen; return iLen; } -int32_t CFGAS_BufferStreamImp::ReadString(FX_WCHAR* pStr, +int32_t CFGAS_BufferStreamImp::ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) { ASSERT(m_pData); @@ -860,7 +857,7 @@ int32_t CFGAS_BufferStreamImp::ReadString(FX_WCHAR* pStr, if (iLen <= 0) { return 0; } - const FX_WCHAR* pSrc = (const FX_WCHAR*)(FX_CHAR*)(m_pData + m_iPosition); + const wchar_t* pSrc = (const wchar_t*)(char*)(m_pData + m_iPosition); int32_t iCount = 0; while (*pSrc && iCount < iLen) { *pStr++ = *pSrc++; @@ -885,7 +882,7 @@ int32_t CFGAS_BufferStreamImp::WriteData(const uint8_t* pBuffer, } return iLen; } -int32_t CFGAS_BufferStreamImp::WriteString(const FX_WCHAR* pStr, +int32_t CFGAS_BufferStreamImp::WriteString(const wchar_t* pStr, int32_t iLength) { ASSERT(m_pData && (GetAccessModes() & FX_STREAMACCESS_Write) != 0); ASSERT(pStr && iLength > 0); @@ -1043,7 +1040,7 @@ uint16_t CFGAS_TextStream::SetCodePage(uint16_t wCodePage) { return v; } -int32_t CFGAS_TextStream::ReadString(FX_WCHAR* pStr, +int32_t CFGAS_TextStream::ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) { ASSERT(pStr && iMaxLength > 0); @@ -1056,7 +1053,7 @@ int32_t CFGAS_TextStream::ReadString(FX_WCHAR* pStr, int32_t iBytes = iMaxLength * 2; iLen = m_pStreamImp->ReadData((uint8_t*)pStr, iBytes); iMaxLength = iLen / 2; - if (sizeof(FX_WCHAR) > 2) { + if (sizeof(wchar_t) > 2) { FX_UTF16ToWChar(pStr, iMaxLength); } #if _FX_ENDIAN_ == _FX_BIG_ENDIAN_ @@ -1082,8 +1079,8 @@ int32_t CFGAS_TextStream::ReadString(FX_WCHAR* pStr, } iLen = m_pStreamImp->ReadData(m_pBuf, iBytes); int32_t iSrc = iLen; - int32_t iDecode = FX_DecodeString(m_wCodePage, (const FX_CHAR*)m_pBuf, - &iSrc, pStr, &iMaxLength, true); + int32_t iDecode = FX_DecodeString(m_wCodePage, (const char*)m_pBuf, &iSrc, + pStr, &iMaxLength, true); m_pStreamImp->Seek(FX_STREAMSEEK_Current, iSrc - iLen); if (iDecode < 1) { return -1; @@ -1096,7 +1093,7 @@ int32_t CFGAS_TextStream::ReadString(FX_WCHAR* pStr, return iMaxLength; } -int32_t CFGAS_TextStream::WriteString(const FX_WCHAR* pStr, int32_t iLength) { +int32_t CFGAS_TextStream::WriteString(const wchar_t* pStr, int32_t iLength) { ASSERT(pStr && iLength > 0); if ((m_pStreamImp->GetAccessModes() & FX_STREAMACCESS_Write) == 0) return -1; @@ -1129,7 +1126,7 @@ CFGAS_Stream::~CFGAS_Stream() { delete m_pStreamImp; } -bool CFGAS_Stream::LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess) { +bool CFGAS_Stream::LoadFile(const wchar_t* pszSrcFileName, uint32_t dwAccess) { if (m_eStreamType != FX_SREAMTYPE_Unknown || m_pStreamImp) return false; @@ -1303,7 +1300,7 @@ int32_t CFGAS_Stream::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { m_iPosition = m_pStreamImp->GetPosition(); return iLen; } -int32_t CFGAS_Stream::ReadString(FX_WCHAR* pStr, +int32_t CFGAS_Stream::ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) { ASSERT(pStr && iMaxLength > 0); @@ -1353,7 +1350,7 @@ int32_t CFGAS_Stream::WriteData(const uint8_t* pBuffer, int32_t iBufferSize) { } return iLen; } -int32_t CFGAS_Stream::WriteString(const FX_WCHAR* pStr, int32_t iLength) { +int32_t CFGAS_Stream::WriteString(const wchar_t* pStr, int32_t iLength) { ASSERT(pStr && iLength > 0); if (!m_pStreamImp) { return -1; diff --git a/xfa/fgas/crt/fgas_stream.h b/xfa/fgas/crt/fgas_stream.h index 79fda58d2a..fdfc08205a 100644 --- a/xfa/fgas/crt/fgas_stream.h +++ b/xfa/fgas/crt/fgas_stream.h @@ -51,11 +51,9 @@ class IFGAS_Stream : public CFX_Retainable { virtual int32_t GetPosition() = 0; virtual bool IsEOF() const = 0; virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) = 0; - virtual int32_t ReadString(FX_WCHAR* pStr, - int32_t iMaxLength, - bool& bEOS) = 0; + virtual int32_t ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) = 0; virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) = 0; - virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) = 0; + virtual int32_t WriteString(const wchar_t* pStr, int32_t iLength) = 0; virtual void Flush() = 0; virtual bool SetLength(int32_t iLength) = 0; virtual int32_t GetBOM(uint8_t bom[4]) const = 0; diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp index aa41318f5d..0173a6a24c 100644 --- a/xfa/fgas/font/cfgas_fontmgr.cpp +++ b/xfa/fgas/font/cfgas_fontmgr.cpp @@ -113,7 +113,7 @@ CFGAS_FontMgr::~CFGAS_FontMgr() {} CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( uint16_t wCodePage, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily) { + const wchar_t* pszFontFamily) { uint32_t dwHash = FGAS_GetFontHashCode(wCodePage, dwFontStyles); auto it = m_CPFonts.find(dwHash); if (it != m_CPFonts.end()) { @@ -141,9 +141,9 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( } CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode( - FX_WCHAR wUnicode, + wchar_t wUnicode, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily) { + const wchar_t* pszFontFamily) { const FGAS_FONTUSB* pRet = FGAS_GetUnicodeBitField(wUnicode); if (pRet->wBitField == 999) return nullptr; @@ -166,7 +166,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode( return nullptr; uint16_t wCodePage = FX_GetCodePageFromCharset(pFD->uCharSet); - const FX_WCHAR* pFontFace = pFD->wsFontFace; + const wchar_t* pFontFace = pFD->wsFontFace; CFX_RetainPtr<CFGAS_GEFont> pFont = CFGAS_GEFont::LoadFont(pFontFace, dwFontStyles, wCodePage, this); if (!pFont) @@ -181,7 +181,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode( } CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( - const FX_WCHAR* pszFontFamily, + const wchar_t* pszFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { CFX_RetainPtr<CFGAS_GEFont> pFont; @@ -262,12 +262,12 @@ void CFGAS_FontMgr::RemoveFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont) { m_Fonts.erase(it); } -const FX_FONTDESCRIPTOR* CFGAS_FontMgr::FindFont(const FX_WCHAR* pszFontFamily, +const FX_FONTDESCRIPTOR* CFGAS_FontMgr::FindFont(const wchar_t* pszFontFamily, uint32_t dwFontStyles, uint32_t dwMatchFlags, uint16_t wCodePage, uint32_t dwUSB, - FX_WCHAR wUnicode) { + wchar_t wUnicode) { FX_FONTMATCHPARAMS params; FXSYS_memset(¶ms, 0, sizeof(params)); params.dwUSB = dwUSB; @@ -325,7 +325,7 @@ static int32_t CALLBACK FX_GdiFontEnumProc(ENUMLOGFONTEX* lpelfe, FXSYS_memset(pFont, 0, sizeof(FX_FONTDESCRIPTOR)); pFont->uCharSet = lf.lfCharSet; pFont->dwFontStyles = FX_GetGdiFontStyles(lf); - FXSYS_wcsncpy(pFont->wsFontFace, (const FX_WCHAR*)lf.lfFaceName, 31); + FXSYS_wcsncpy(pFont->wsFontFace, (const wchar_t*)lf.lfFaceName, 31); pFont->wsFontFace[31] = 0; FXSYS_memcpy(&pFont->FontSignature, &lpntme->ntmFontSig, sizeof(lpntme->ntmFontSig)); @@ -335,8 +335,8 @@ static int32_t CALLBACK FX_GdiFontEnumProc(ENUMLOGFONTEX* lpelfe, } static void FX_EnumGdiFonts(std::deque<FX_FONTDESCRIPTOR>* fonts, - const FX_WCHAR* pwsFaceName, - FX_WCHAR wUnicode) { + const wchar_t* pwsFaceName, + wchar_t wUnicode) { HDC hDC = ::GetDC(nullptr); LOGFONTW lfFind; FXSYS_memset(&lfFind, 0, sizeof(lfFind)); @@ -358,7 +358,7 @@ FX_LPEnumAllFonts FX_GetDefFontEnumerator() { namespace { -const FX_CHAR* g_FontFolders[] = { +const char* g_FontFolders[] = { #if _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ "/usr/share/fonts", "/usr/share/X11/fonts/Type1", "/usr/share/X11/fonts/TTF", "/usr/local/share/fonts", @@ -396,7 +396,7 @@ uint16_t FX_GetCodePageBit(uint16_t wCodePage) { return static_cast<uint16_t>(-1); } -uint16_t FX_GetUnicodeBit(FX_WCHAR wcUnicode) { +uint16_t FX_GetUnicodeBit(wchar_t wcUnicode) { const FGAS_FONTUSB* x = FGAS_GetUnicodeBitField(wcUnicode); return x ? x->wBitField : 999; } @@ -616,7 +616,7 @@ bool CFGAS_FontMgr::EnumFonts() { } CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( - const FX_WCHAR* pszFontFamily, + const wchar_t* pszFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { return GetFontByCodePage(wCodePage, dwFontStyles, pszFontFamily); @@ -625,7 +625,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( uint16_t wCodePage, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily) { + const wchar_t* pszFontFamily) { CFX_ByteString bsHash; bsHash.Format("%d, %d", wCodePage, dwFontStyles); bsHash += FX_UTF8Encode(CFX_WideStringC(pszFontFamily)); @@ -658,9 +658,9 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( } CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode( - FX_WCHAR wUnicode, + wchar_t wUnicode, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily) { + const wchar_t* pszFontFamily) { if (pdfium::ContainsKey(m_FailedUnicodesSet, wUnicode)) return nullptr; @@ -706,7 +706,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode( } bool CFGAS_FontMgr::VerifyUnicode(CFX_FontDescriptor* pDesc, - FX_WCHAR wcUnicode) { + wchar_t wcUnicode) { CFX_RetainPtr<IFX_SeekableReadStream> pFileRead = CreateFontStream(pDesc->m_wsFaceName.UTF8Encode()); if (!pFileRead) @@ -726,7 +726,7 @@ bool CFGAS_FontMgr::VerifyUnicode(CFX_FontDescriptor* pDesc, } bool CFGAS_FontMgr::VerifyUnicode(const CFX_RetainPtr<CFGAS_GEFont>& pFont, - FX_WCHAR wcUnicode) { + wchar_t wcUnicode) { if (!pFont) return false; @@ -878,7 +878,7 @@ void CFGAS_FontMgr::MatchFonts( uint16_t wCodePage, uint32_t dwFontStyles, const CFX_WideString& FontName, - FX_WCHAR wcUnicode) { + wchar_t wcUnicode) { pMatchedFonts->clear(); for (const auto& pFont : m_InstalledFonts) { int32_t nPenalty = @@ -896,7 +896,7 @@ int32_t CFGAS_FontMgr::CalcPenalty(CFX_FontDescriptor* pInstalled, uint16_t wCodePage, uint32_t dwFontStyles, const CFX_WideString& FontName, - FX_WCHAR wcUnicode) { + wchar_t wcUnicode) { int32_t nPenalty = 30000; if (FontName.GetLength() != 0) { if (FontName != pInstalled->m_wsFaceName) { @@ -1077,14 +1077,14 @@ void CFGAS_FontMgr::GetNames(const uint8_t* name_table, wsFamily.clear(); if (nPlatformID != 1) { for (uint16_t k = 0; k < nNameLength / 2; k++) { - FX_WCHAR wcTemp = GetUInt16(lpStr + nNameOffset + k * 2); + wchar_t wcTemp = GetUInt16(lpStr + nNameOffset + k * 2); wsFamily += wcTemp; } Names.push_back(wsFamily); continue; } for (uint16_t k = 0; k < nNameLength; k++) { - FX_WCHAR wcTemp = GetUInt8(lpStr + nNameOffset + k); + wchar_t wcTemp = GetUInt8(lpStr + nNameOffset + k); wsFamily += wcTemp; } Names.push_back(wsFamily); diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h index 23ab523e78..63a8d3b146 100644 --- a/xfa/fgas/font/cfgas_fontmgr.h +++ b/xfa/fgas/font/cfgas_fontmgr.h @@ -40,11 +40,11 @@ class CFGAS_GEFont; #define FX_FONTMATCHPARA_MatchStyle 0x01 struct FX_FONTMATCHPARAMS { - const FX_WCHAR* pwsFamily; + const wchar_t* pwsFamily; uint32_t dwFontStyles; uint32_t dwUSB; uint32_t dwMatchFlags; - FX_WCHAR wUnicode; + wchar_t wUnicode; uint16_t wCodePage; }; @@ -61,7 +61,7 @@ inline bool operator==(const FX_FONTSIGNATURE& left, } struct FX_FONTDESCRIPTOR { - FX_WCHAR wsFontFace[32]; + wchar_t wsFontFace[32]; uint32_t dwFontStyles; uint8_t uCharSet; FX_FONTSIGNATURE FontSignature; @@ -76,8 +76,8 @@ inline bool operator==(const FX_FONTDESCRIPTOR& left, } typedef void (*FX_LPEnumAllFonts)(std::deque<FX_FONTDESCRIPTOR>* fonts, - const FX_WCHAR* pwsFaceName, - FX_WCHAR wUnicode); + const wchar_t* pwsFaceName, + wchar_t wUnicode); FX_LPEnumAllFonts FX_GetDefFontEnumerator(); @@ -90,11 +90,11 @@ class CFGAS_FontMgr { CFX_RetainPtr<CFGAS_GEFont> GetFontByCodePage(uint16_t wCodePage, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily); - CFX_RetainPtr<CFGAS_GEFont> GetFontByUnicode(FX_WCHAR wUnicode, + const wchar_t* pszFontFamily); + CFX_RetainPtr<CFGAS_GEFont> GetFontByUnicode(wchar_t wUnicode, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily); - CFX_RetainPtr<CFGAS_GEFont> LoadFont(const FX_WCHAR* pszFontFamily, + const wchar_t* pszFontFamily); + CFX_RetainPtr<CFGAS_GEFont> LoadFont(const wchar_t* pszFontFamily, uint32_t dwFontStyles, uint16_t wCodePage); void RemoveFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont); @@ -106,12 +106,12 @@ class CFGAS_FontMgr { uint16_t wCodePage); void RemoveFont(std::map<uint32_t, CFX_RetainPtr<CFGAS_GEFont>>* pFontMap, const CFX_RetainPtr<CFGAS_GEFont>& pFont); - const FX_FONTDESCRIPTOR* FindFont(const FX_WCHAR* pszFontFamily, + const FX_FONTDESCRIPTOR* FindFont(const wchar_t* pszFontFamily, uint32_t dwFontStyles, uint32_t dwMatchFlags, uint16_t wCodePage, uint32_t dwUSB = 999, - FX_WCHAR wUnicode = 0); + wchar_t wUnicode = 0); FX_LPEnumAllFonts m_pEnumerator; std::deque<FX_FONTDESCRIPTOR> m_FontFaces; @@ -190,11 +190,11 @@ class CFGAS_FontMgr { CFX_RetainPtr<CFGAS_GEFont> GetFontByCodePage(uint16_t wCodePage, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily); - CFX_RetainPtr<CFGAS_GEFont> GetFontByUnicode(FX_WCHAR wUnicode, + const wchar_t* pszFontFamily); + CFX_RetainPtr<CFGAS_GEFont> GetFontByUnicode(wchar_t wUnicode, uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily); - CFX_RetainPtr<CFGAS_GEFont> LoadFont(const FX_WCHAR* pszFontFamily, + const wchar_t* pszFontFamily); + CFX_RetainPtr<CFGAS_GEFont> LoadFont(const wchar_t* pszFontFamily, uint32_t dwFontStyles, uint16_t wCodePage); void RemoveFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont); @@ -210,20 +210,20 @@ class CFGAS_FontMgr { std::vector<uint16_t> GetCharsets(FXFT_Face pFace) const; void GetUSBCSB(FXFT_Face pFace, uint32_t* USB, uint32_t* CSB); uint32_t GetFlags(FXFT_Face pFace); - bool VerifyUnicode(CFX_FontDescriptor* pDesc, FX_WCHAR wcUnicode); + bool VerifyUnicode(CFX_FontDescriptor* pDesc, wchar_t wcUnicode); bool VerifyUnicode(const CFX_RetainPtr<CFGAS_GEFont>& pFont, - FX_WCHAR wcUnicode); + wchar_t wcUnicode); int32_t IsPartName(const CFX_WideString& Name1, const CFX_WideString& Name2); void MatchFonts(std::vector<CFX_FontDescriptorInfo>* MatchedFonts, uint16_t wCodePage, uint32_t dwFontStyles, const CFX_WideString& FontName, - FX_WCHAR wcUnicode = 0xFFFE); + wchar_t wcUnicode = 0xFFFE); int32_t CalcPenalty(CFX_FontDescriptor* pInstalled, uint16_t wCodePage, uint32_t dwFontStyles, const CFX_WideString& FontName, - FX_WCHAR wcUnicode = 0xFFFE); + wchar_t wcUnicode = 0xFFFE); CFX_RetainPtr<CFGAS_GEFont> LoadFont(const CFX_WideString& wsFaceName, int32_t iFaceIndex, int32_t* pFaceCount); @@ -243,7 +243,7 @@ class CFGAS_FontMgr { std::map<uint32_t, std::vector<CFX_RetainPtr<CFGAS_GEFont>>> m_Hash2Fonts; std::map<CFX_RetainPtr<CFGAS_GEFont>, CFX_RetainPtr<IFX_SeekableReadStream>> m_IFXFont2FileRead; - std::set<FX_WCHAR> m_FailedUnicodesSet; + std::set<wchar_t> m_FailedUnicodesSet; }; #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp index 2d5a927cde..769ce36417 100644 --- a/xfa/fgas/font/cfgas_gefont.cpp +++ b/xfa/fgas/font/cfgas_gefont.cpp @@ -18,11 +18,10 @@ #include "xfa/fxfa/xfa_fontmgr.h" // static -CFX_RetainPtr<CFGAS_GEFont> CFGAS_GEFont::LoadFont( - const FX_WCHAR* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage, - CFGAS_FontMgr* pFontMgr) { +CFX_RetainPtr<CFGAS_GEFont> CFGAS_GEFont::LoadFont(const wchar_t* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage, + CFGAS_FontMgr* pFontMgr) { #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ if (!pFontMgr) return nullptr; @@ -123,7 +122,7 @@ CFGAS_GEFont::~CFGAS_GEFont() { } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -bool CFGAS_GEFont::LoadFontInternal(const FX_WCHAR* pszFontFamily, +bool CFGAS_GEFont::LoadFontInternal(const wchar_t* pszFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { if (m_pFont) @@ -259,13 +258,13 @@ uint32_t CFGAS_GEFont::GetFontStyles() const { return dwStyles; } -bool CFGAS_GEFont::GetCharWidth(FX_WCHAR wUnicode, +bool CFGAS_GEFont::GetCharWidth(wchar_t wUnicode, int32_t& iWidth, bool bCharCode) { return GetCharWidthInternal(wUnicode, iWidth, true, bCharCode); } -bool CFGAS_GEFont::GetCharWidthInternal(FX_WCHAR wUnicode, +bool CFGAS_GEFont::GetCharWidthInternal(wchar_t wUnicode, int32_t& iWidth, bool bRecursive, bool bCharCode) { @@ -299,13 +298,13 @@ bool CFGAS_GEFont::GetCharWidthInternal(FX_WCHAR wUnicode, return iWidth > 0; } -bool CFGAS_GEFont::GetCharBBox(FX_WCHAR wUnicode, +bool CFGAS_GEFont::GetCharBBox(wchar_t wUnicode, CFX_Rect* bbox, bool bCharCode) { return GetCharBBoxInternal(wUnicode, bbox, true, bCharCode); } -bool CFGAS_GEFont::GetCharBBoxInternal(FX_WCHAR wUnicode, +bool CFGAS_GEFont::GetCharBBoxInternal(wchar_t wUnicode, CFX_Rect* bbox, bool bRecursive, bool bCharCode) { @@ -345,11 +344,11 @@ bool CFGAS_GEFont::GetBBox(CFX_Rect* bbox) { return true; } -int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, bool bCharCode) { +int32_t CFGAS_GEFont::GetGlyphIndex(wchar_t wUnicode, bool bCharCode) { return GetGlyphIndex(wUnicode, true, nullptr, bCharCode); } -int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, +int32_t CFGAS_GEFont::GetGlyphIndex(wchar_t wUnicode, bool bRecursive, CFX_RetainPtr<CFGAS_GEFont>* ppFont, bool bCharCode) { diff --git a/xfa/fgas/font/cfgas_gefont.h b/xfa/fgas/font/cfgas_gefont.h index 0a8e7bad76..b460cee496 100644 --- a/xfa/fgas/font/cfgas_gefont.h +++ b/xfa/fgas/font/cfgas_gefont.h @@ -28,7 +28,7 @@ class CFGAS_GEFont : public CFX_Retainable { template <typename T, typename... Args> friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args); - static CFX_RetainPtr<CFGAS_GEFont> LoadFont(const FX_WCHAR* pszFontFamily, + static CFX_RetainPtr<CFGAS_GEFont> LoadFont(const wchar_t* pszFontFamily, uint32_t dwFontStyles, uint16_t wCodePage, CFGAS_FontMgr* pFontMgr); @@ -50,11 +50,11 @@ class CFGAS_GEFont : public CFX_Retainable { CFX_RetainPtr<CFGAS_GEFont> Derive(uint32_t dwFontStyles, uint16_t wCodePage = 0); uint32_t GetFontStyles() const; - bool GetCharWidth(FX_WCHAR wUnicode, int32_t& iWidth, bool bCharCode); - int32_t GetGlyphIndex(FX_WCHAR wUnicode, bool bCharCode = false); + bool GetCharWidth(wchar_t wUnicode, int32_t& iWidth, bool bCharCode); + int32_t GetGlyphIndex(wchar_t wUnicode, bool bCharCode = false); int32_t GetAscent() const; int32_t GetDescent() const; - bool GetCharBBox(FX_WCHAR wUnicode, CFX_Rect* bbox, bool bCharCode = false); + bool GetCharBBox(wchar_t wUnicode, CFX_Rect* bbox, bool bCharCode = false); bool GetBBox(CFX_Rect* bbox); CFX_RetainPtr<CFGAS_GEFont> GetSubstFont(int32_t iGlyphIndex); CFX_Font* GetDevFont() const { return m_pFont; } @@ -72,7 +72,7 @@ class CFGAS_GEFont : public CFX_Retainable { ~CFGAS_GEFont() override; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - bool LoadFontInternal(const FX_WCHAR* pszFontFamily, + bool LoadFontInternal(const wchar_t* pszFontFamily, uint32_t dwFontStyles, uint16_t wCodePage); bool LoadFontInternal(const uint8_t* pBuffer, int32_t length); @@ -82,15 +82,15 @@ class CFGAS_GEFont : public CFX_Retainable { bool LoadFontInternal(CFX_Font* pExternalFont); bool LoadFontInternal(std::unique_ptr<CFX_Font> pInternalFont); bool InitFont(); - bool GetCharBBoxInternal(FX_WCHAR wUnicode, + bool GetCharBBoxInternal(wchar_t wUnicode, CFX_Rect* bbox, bool bRecursive, bool bCharCode = false); - bool GetCharWidthInternal(FX_WCHAR wUnicode, + bool GetCharWidthInternal(wchar_t wUnicode, int32_t& iWidth, bool bRecursive, bool bCharCode); - int32_t GetGlyphIndex(FX_WCHAR wUnicode, + int32_t GetGlyphIndex(wchar_t wUnicode, bool bRecursive, CFX_RetainPtr<CFGAS_GEFont>* ppFont, bool bCharCode = false); @@ -107,11 +107,11 @@ class CFGAS_GEFont : public CFX_Retainable { CFX_RetainPtr<IFGAS_Stream> m_pStream; CFX_RetainPtr<IFX_SeekableReadStream> m_pFileRead; std::unique_ptr<CFX_UnicodeEncoding> m_pFontEncoding; - std::map<FX_WCHAR, int32_t> m_CharWidthMap; - std::map<FX_WCHAR, CFX_Rect> m_BBoxMap; + std::map<wchar_t, int32_t> m_CharWidthMap; + std::map<wchar_t, CFX_Rect> m_BBoxMap; CXFA_PDFFontMgr* m_pProvider; // not owned. std::vector<CFX_RetainPtr<CFGAS_GEFont>> m_SubstFonts; - std::map<FX_WCHAR, CFX_RetainPtr<CFGAS_GEFont>> m_FontMapper; + std::map<wchar_t, CFX_RetainPtr<CFGAS_GEFont>> m_FontMapper; }; #endif // XFA_FGAS_FONT_CFGAS_GEFONT_H_ diff --git a/xfa/fgas/font/fgas_fontutils.cpp b/xfa/fgas/font/fgas_fontutils.cpp index e74056b53e..e775ebdf0c 100644 --- a/xfa/fgas/font/fgas_fontutils.cpp +++ b/xfa/fgas/font/fgas_fontutils.cpp @@ -31,7 +31,7 @@ uint32_t FGAS_GetFontHashCode(uint16_t wCodePage, uint32_t dwFontStyles) { } return dwHash; } -uint32_t FGAS_GetFontFamilyHash(const FX_WCHAR* pszFontFamily, +uint32_t FGAS_GetFontFamilyHash(const wchar_t* pszFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { CFX_WideString wsFont(pszFontFamily); @@ -134,7 +134,7 @@ static const FGAS_FONTUSB g_FXGdiFontUSBTable[] = { {0xFFA0, 0xFFEF, 68, 0xFFFF}, }; -const FGAS_FONTUSB* FGAS_GetUnicodeBitField(FX_WCHAR wUnicode) { +const FGAS_FONTUSB* FGAS_GetUnicodeBitField(wchar_t wUnicode) { int32_t iEnd = sizeof(g_FXGdiFontUSBTable) / sizeof(FGAS_FONTUSB) - 1; ASSERT(iEnd >= 0); int32_t iStart = 0, iMid; diff --git a/xfa/fgas/font/fgas_fontutils.h b/xfa/fgas/font/fgas_fontutils.h index d7055ced9b..d92b469e7b 100644 --- a/xfa/fgas/font/fgas_fontutils.h +++ b/xfa/fgas/font/fgas_fontutils.h @@ -17,9 +17,9 @@ struct FGAS_FONTUSB { }; uint32_t FGAS_GetFontHashCode(uint16_t wCodePage, uint32_t dwFontStyles); -uint32_t FGAS_GetFontFamilyHash(const FX_WCHAR* pszFontFamily, +uint32_t FGAS_GetFontFamilyHash(const wchar_t* pszFontFamily, uint32_t dwFontStyles, uint16_t wCodePage); -const FGAS_FONTUSB* FGAS_GetUnicodeBitField(FX_WCHAR wUnicode); +const FGAS_FONTUSB* FGAS_GetUnicodeBitField(wchar_t wUnicode); #endif // XFA_FGAS_FONT_FGAS_FONTUTILS_H_ diff --git a/xfa/fgas/layout/cfx_breakline.cpp b/xfa/fgas/layout/cfx_breakline.cpp index 4e9d8ad5ae..65860e4013 100644 --- a/xfa/fgas/layout/cfx_breakline.cpp +++ b/xfa/fgas/layout/cfx_breakline.cpp @@ -37,9 +37,9 @@ const CFX_BreakPiece* CFX_BreakLine::GetPiece(int32_t index) const { void CFX_BreakLine::GetString(CFX_WideString& wsStr) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_LineChars); - FX_WCHAR* pBuf = wsStr.GetBuffer(iCount); + wchar_t* pBuf = wsStr.GetBuffer(iCount); for (int32_t i = 0; i < iCount; i++) - *pBuf++ = static_cast<FX_WCHAR>(m_LineChars[i].m_wCharCode); + *pBuf++ = static_cast<wchar_t>(m_LineChars[i].m_wCharCode); wsStr.ReleaseBuffer(iCount); } diff --git a/xfa/fgas/layout/cfx_breakpiece.cpp b/xfa/fgas/layout/cfx_breakpiece.cpp index d31c53f964..dd8b451790 100644 --- a/xfa/fgas/layout/cfx_breakpiece.cpp +++ b/xfa/fgas/layout/cfx_breakpiece.cpp @@ -40,7 +40,7 @@ CFX_WideString CFX_BreakPiece::GetString() const { CFX_WideString ret; ret.Reserve(m_iChars); for (int32_t i = m_iStartChar; i < m_iStartChar + m_iChars; i++) - ret += static_cast<FX_WCHAR>((*m_pChars)[i].m_wCharCode); + ret += static_cast<wchar_t>((*m_pChars)[i].m_wCharCode); return ret; } diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp index 85edaf7f99..1e0cc9c25e 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.cpp +++ b/xfa/fgas/layout/fgas_rtfbreak.cpp @@ -190,7 +190,7 @@ bool CFX_RTFBreak::GetPositionedTab(int32_t* iTabPos) const { return true; } -CFX_BreakType CFX_RTFBreak::AppendChar(FX_WCHAR wch) { +CFX_BreakType CFX_RTFBreak::AppendChar(wchar_t wch) { ASSERT(m_pFont && m_pCurLine); uint32_t dwProps = kTextLayoutCodeProperties[static_cast<uint16_t>(wch)]; @@ -313,7 +313,7 @@ CFX_BreakType CFX_RTFBreak::AppendChar_Control(CFX_Char* pCurChar) { CFX_BreakType CFX_RTFBreak::AppendChar_Arabic(CFX_Char* pCurChar) { CFX_Char* pLastChar = nullptr; int32_t iCharWidth = 0; - FX_WCHAR wForm; + wchar_t wForm; bool bAlef = false; if (m_eCharType >= FX_CHARTYPE_ArabicAlef && m_eCharType <= FX_CHARTYPE_ArabicDistortion) { @@ -357,7 +357,7 @@ CFX_BreakType CFX_RTFBreak::AppendChar_Arabic(CFX_Char* pCurChar) { CFX_BreakType CFX_RTFBreak::AppendChar_Others(CFX_Char* pCurChar) { FX_CHARTYPE chartype = pCurChar->GetCharType(); - FX_WCHAR wForm = pCurChar->m_wCharCode; + wchar_t wForm = pCurChar->m_wCharCode; int32_t iCharWidth = 0; if (!m_pFont->GetCharWidth(wForm, iCharWidth, false)) iCharWidth = m_iDefChar; @@ -842,8 +842,8 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, FX_FLOAT fFontHeight = fFontSize; FX_FLOAT fAscent = fFontHeight * static_cast<FX_FLOAT>(iAscent) / static_cast<FX_FLOAT>(iMaxHeight); - FX_WCHAR wPrev = 0xFEFF; - FX_WCHAR wNext; + wchar_t wPrev = 0xFEFF; + wchar_t wNext; FX_FLOAT fX = rtText.left; int32_t iHorScale = pText->iHorizontalScale; int32_t iVerScale = pText->iVerticalScale; @@ -853,7 +853,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, FX_FLOAT fY = rtText.top + fAscent; int32_t iCount = 0; for (int32_t i = 0; i < pText->iLength; ++i) { - FX_WCHAR wch = pText->pStr[i]; + wchar_t wch = pText->pStr[i]; int32_t iWidth = pText->pWidths[i]; uint32_t dwProps = FX_GetUnicodeProperties(wch); uint32_t dwCharType = (dwProps & FX_CHARTYPEBITSMASK); @@ -871,7 +871,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, if (pCharPos) { iCharWidth /= iFontSize; - FX_WCHAR wForm = wch; + wchar_t wForm = wch; if (dwCharType >= FX_CHARTYPE_ArabicAlef) { if (i + 1 < pText->iLength) { wNext = pText->pStr[i + 1]; diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h index b3def63251..339d2f4bcd 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.h +++ b/xfa/fgas/layout/fgas_rtfbreak.h @@ -36,7 +36,7 @@ struct FX_RTFTEXTOBJ { std::vector<int32_t> pWidths; CFX_RetainPtr<CFGAS_GEFont> pFont; const CFX_RectF* pRect; - FX_WCHAR wLineBreakChar; + wchar_t wLineBreakChar; FX_FLOAT fFontSize; int32_t iLength; int32_t iBidiLevel; @@ -74,7 +74,7 @@ class CFX_RTFBreak { FXTEXT_CHARPOS* pCharPos, bool bCharCode) const; - CFX_BreakType AppendChar(FX_WCHAR wch); + CFX_BreakType AppendChar(wchar_t wch); CFX_BreakLine* GetCurrentLineForTesting() const { return m_pCurLine; } @@ -116,9 +116,9 @@ class CFX_RTFBreak { int32_t m_iFontSize; int32_t m_iTabWidth; std::vector<int32_t> m_PositionedTabs; - FX_WCHAR m_wDefChar; + wchar_t m_wDefChar; int32_t m_iDefChar; - FX_WCHAR m_wLineBreakChar; + wchar_t m_wLineBreakChar; int32_t m_iHorizontalScale; int32_t m_iVerticalScale; int32_t m_iCharSpace; diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp index 9343f94cc6..eabe381621 100644 --- a/xfa/fgas/layout/fgas_textbreak.cpp +++ b/xfa/fgas/layout/fgas_textbreak.cpp @@ -29,7 +29,7 @@ const FX_TxtBreak_LPFAppendChar g_FX_TxtBreak_lpfAppendChar[16] = { &CFX_TxtBreak::AppendChar_Others, &CFX_TxtBreak::AppendChar_Others, }; -bool IsCtrlCode(FX_WCHAR ch) { +bool IsCtrlCode(wchar_t ch) { uint32_t dwRet = (FX_GetUnicodeProperties(ch) & FX_CHARTYPEBITSMASK); return dwRet == FX_CHARTYPE_Tab || dwRet == FX_CHARTYPE_Control; } @@ -112,7 +112,7 @@ void CFX_TxtBreak::SetTabWidth(FX_FLOAT fTabWidth, bool bEquidistant) { m_bEquidistant = bEquidistant; } -void CFX_TxtBreak::SetDefaultChar(FX_WCHAR wch) { +void CFX_TxtBreak::SetDefaultChar(wchar_t wch) { m_wDefChar = wch; m_iDefChar = 0; if (m_wDefChar == 0xFEFF || !m_pFont) @@ -125,7 +125,7 @@ void CFX_TxtBreak::SetDefaultChar(FX_WCHAR wch) { m_iDefChar *= m_iFontSize; } -void CFX_TxtBreak::SetParagraphBreakChar(FX_WCHAR wch) { +void CFX_TxtBreak::SetParagraphBreakChar(wchar_t wch) { if (wch != L'\r' && wch != L'\n') return; m_wParagBreakChar = wch; @@ -208,8 +208,8 @@ void CFX_TxtBreak::AppendChar_PageLoad(CFX_Char* pCurChar, uint32_t dwProps) { } CFX_BreakType CFX_TxtBreak::AppendChar_Combination(CFX_Char* pCurChar) { - FX_WCHAR wch = pCurChar->m_wCharCode; - FX_WCHAR wForm; + wchar_t wch = pCurChar->m_wCharCode; + wchar_t wForm; int32_t iCharWidth = 0; pCurChar->m_iCharWidth = -1; if (m_bCombText) { @@ -221,7 +221,7 @@ CFX_BreakType CFX_TxtBreak::AppendChar_Combination(CFX_Char* pCurChar) { (pLastChar->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicShadda) == 0) { bool bShadda = false; if (wch == 0x0651) { - FX_WCHAR wLast = pLastChar->m_wCharCode; + wchar_t wLast = pLastChar->m_wCharCode; if (wLast >= 0x064C && wLast <= 0x0650) { wForm = FX_GetArabicFromShaddaTable(wLast); bShadda = true; @@ -257,7 +257,7 @@ CFX_BreakType CFX_TxtBreak::AppendChar_Control(CFX_Char* pCurChar) { m_eCharType = FX_CHARTYPE_Control; CFX_BreakType dwRet = CFX_BreakType::None; if (!m_bSingleLine) { - FX_WCHAR wch = pCurChar->m_wCharCode; + wchar_t wch = pCurChar->m_wCharCode; switch (wch) { case L'\v': case 0x2028: @@ -283,7 +283,7 @@ CFX_BreakType CFX_TxtBreak::AppendChar_Control(CFX_Char* pCurChar) { CFX_BreakType CFX_TxtBreak::AppendChar_Arabic(CFX_Char* pCurChar) { FX_CHARTYPE chartype = pCurChar->GetCharType(); int32_t& iLineWidth = m_pCurLine->m_iWidth; - FX_WCHAR wForm; + wchar_t wForm; int32_t iCharWidth = 0; CFX_Char* pLastChar = nullptr; bool bAlef = false; @@ -339,8 +339,8 @@ CFX_BreakType CFX_TxtBreak::AppendChar_Others(CFX_Char* pCurChar) { int32_t& iLineWidth = m_pCurLine->m_iWidth; int32_t iCharWidth = 0; m_eCharType = chartype; - FX_WCHAR wch = pCurChar->m_wCharCode; - FX_WCHAR wForm = wch; + wchar_t wch = pCurChar->m_wCharCode; + wchar_t wForm = wch; if (m_bCombText) { iCharWidth = m_iCombWidth; @@ -363,7 +363,7 @@ CFX_BreakType CFX_TxtBreak::AppendChar_Others(CFX_Char* pCurChar) { return CFX_BreakType::None; } -CFX_BreakType CFX_TxtBreak::AppendChar(FX_WCHAR wch) { +CFX_BreakType CFX_TxtBreak::AppendChar(wchar_t wch) { uint32_t dwProps = kTextLayoutCodeProperties[static_cast<uint16_t>(wch)]; FX_CHARTYPE chartype = GetCharTypeFromProp(dwProps); m_pCurLine->m_LineChars.emplace_back(); @@ -834,7 +834,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, CFDE_TxtEdtPage* pAccess = pTxtRun->pAccess; const FDE_TEXTEDITPIECE* pIdentity = pTxtRun->pIdentity; - const FX_WCHAR* pStr = pTxtRun->wsStr.c_str(); + const wchar_t* pStr = pTxtRun->wsStr.c_str(); int32_t* pWidths = pTxtRun->pWidths; int32_t iLength = pTxtRun->iLength - 1; CFX_RetainPtr<CFGAS_GEFont> pFont = pTxtRun->pFont; @@ -866,15 +866,15 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, int32_t iCount = 0; int32_t iNext = 0; - FX_WCHAR wPrev = 0xFEFF; - FX_WCHAR wNext = 0xFEFF; - FX_WCHAR wForm = 0xFEFF; - FX_WCHAR wLast = 0xFEFF; + wchar_t wPrev = 0xFEFF; + wchar_t wNext = 0xFEFF; + wchar_t wForm = 0xFEFF; + wchar_t wLast = 0xFEFF; bool bShadda = false; bool bLam = false; for (int32_t i = 0; i <= iLength; i++) { int32_t iWidth; - FX_WCHAR wch; + wchar_t wch; if (pAccess) { wch = pAccess->GetChar(pIdentity, i); iWidth = pAccess->GetWidth(pIdentity, i); @@ -1006,12 +1006,12 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, } for (int32_t j = 0; j < iForms; j++) { - wForm = (FX_WCHAR)formChars[j].wForm; + wForm = (wchar_t)formChars[j].wForm; iCharWidth = formChars[j].iWidth; if (j > 0) { chartype = FX_CHARTYPE_Combination; wch = wForm; - wLast = (FX_WCHAR)formChars[j - 1].wForm; + wLast = (wchar_t)formChars[j - 1].wForm; } if (!bEmptyChar || (bEmptyChar && !bSkipSpace)) { pCharPos->m_GlyphIndex = @@ -1085,7 +1085,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, } } if (iWidth > 0) - wPrev = static_cast<FX_WCHAR>(formChars[0].wch); + wPrev = static_cast<wchar_t>(formChars[0].wch); wLast = wch; } return iCount; @@ -1098,7 +1098,7 @@ std::vector<CFX_RectF> CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, CFDE_TxtEdtPage* pAccess = pTxtRun->pAccess; const FDE_TEXTEDITPIECE* pIdentity = pTxtRun->pIdentity; - const FX_WCHAR* pStr = pTxtRun->wsStr.c_str(); + const wchar_t* pStr = pTxtRun->wsStr.c_str(); int32_t* pWidths = pTxtRun->pWidths; int32_t iLength = pTxtRun->iLength; CFX_RectF rect(*pTxtRun->pRect); @@ -1118,8 +1118,8 @@ std::vector<CFX_RectF> CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, bool bRTLPiece = !!(pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel); bool bSingleLine = !!(pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_SingleLine); bool bCombText = !!(pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_CombText); - FX_WCHAR wch; - FX_WCHAR wLineBreakChar = pTxtRun->wLineBreakChar; + wchar_t wch; + wchar_t wLineBreakChar = pTxtRun->wLineBreakChar; int32_t iCharSize; FX_FLOAT fCharSize; FX_FLOAT fStart = bRTLPiece ? rect.right() : rect.left; diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h index 9aa576f380..fd864f1296 100644 --- a/xfa/fgas/layout/fgas_textbreak.h +++ b/xfa/fgas/layout/fgas_textbreak.h @@ -61,7 +61,7 @@ struct FX_TXTRUN { int32_t iVerticalScale; uint32_t dwCharStyles; const CFX_RectF* pRect; - FX_WCHAR wLineBreakChar; + wchar_t wLineBreakChar; bool bSkipSpace; }; @@ -76,8 +76,8 @@ class CFX_TxtBreak { void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont); void SetFontSize(FX_FLOAT fFontSize); void SetTabWidth(FX_FLOAT fTabWidth, bool bEquidistant); - void SetDefaultChar(FX_WCHAR wch); - void SetParagraphBreakChar(FX_WCHAR wch); + void SetDefaultChar(wchar_t wch); + void SetParagraphBreakChar(wchar_t wch); void SetLineBreakTolerance(FX_FLOAT fTolerance); void SetHorizontalScale(int32_t iScale); void SetCharSpace(FX_FLOAT fCharSpace); @@ -95,7 +95,7 @@ class CFX_TxtBreak { std::vector<CFX_RectF> GetCharRects(const FX_TXTRUN* pTxtRun, bool bCharBBox = false) const; void AppendChar_PageLoad(CFX_Char* pCurChar, uint32_t dwProps); - CFX_BreakType AppendChar(FX_WCHAR wch); + CFX_BreakType AppendChar(wchar_t wch); CFX_BreakType AppendChar_Combination(CFX_Char* pCurChar); CFX_BreakType AppendChar_Tab(CFX_Char* pCurChar); CFX_BreakType AppendChar_Control(CFX_Char* pCurChar); @@ -133,8 +133,8 @@ class CFX_TxtBreak { CFX_RetainPtr<CFGAS_GEFont> m_pFont; int32_t m_iFontSize; int32_t m_iTabWidth; - FX_WCHAR m_wDefChar; - FX_WCHAR m_wParagBreakChar; + wchar_t m_wDefChar; + wchar_t m_wParagBreakChar; int32_t m_iDefChar; int32_t m_iAlignment; uint32_t m_dwContextCharStyles; diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/fgas_locale.cpp index 7d538411f5..430215662e 100644 --- a/xfa/fgas/localization/fgas_locale.cpp +++ b/xfa/fgas/localization/fgas_locale.cpp @@ -23,7 +23,7 @@ struct FX_LOCALESUBCATEGORYINFO { uint32_t uHash; - const FX_WCHAR* pName; + const wchar_t* pName; int32_t eSubCategory; }; @@ -59,11 +59,11 @@ static const FX_LOCALETIMEZONEINFO g_FXLocaleTimeZoneData[] = { {FXBSTR_ID(0, 'P', 'D', 'T'), -7, 0}, {FXBSTR_ID(0, 'P', 'S', 'T'), -8, 0}, }; -static const FX_WCHAR gs_wsTimeSymbols[] = L"hHkKMSFAzZ"; -static const FX_WCHAR gs_wsDateSymbols[] = L"DJMEeGgYwW"; -static const FX_WCHAR gs_wsConstChars[] = L",-:/. "; +static const wchar_t gs_wsTimeSymbols[] = L"hHkKMSFAzZ"; +static const wchar_t gs_wsDateSymbols[] = L"DJMEeGgYwW"; +static const wchar_t gs_wsConstChars[] = L",-:/. "; -static int32_t FX_ParseTimeZone(const FX_WCHAR* pStr, +static int32_t FX_ParseTimeZone(const wchar_t* pStr, int32_t iLen, FX_TIMEZONE& tz) { tz.tzHour = 0; @@ -122,7 +122,7 @@ static bool FX_WStringToNumeric(const CFX_WideString& wsValue, int32_t cc = 0; bool bNegative = false; bool bExpSign = false; - const FX_WCHAR* str = wsValue.c_str(); + const wchar_t* str = wsValue.c_str(); int32_t len = wsValue.GetLength(); while (cc < len && FXSYS_iswspace(str[cc])) cc++; @@ -270,9 +270,9 @@ void CFX_FormatString::SplitFormatString( const CFX_WideString& wsFormatString, std::vector<CFX_WideString>& wsPatterns) { int32_t iStrLen = wsFormatString.GetLength(); - const FX_WCHAR* pStr = wsFormatString.c_str(); - const FX_WCHAR* pToken = pStr; - const FX_WCHAR* pEnd = pStr + iStrLen; + const wchar_t* pStr = wsFormatString.c_str(); + const wchar_t* pToken = pStr; + const wchar_t* pEnd = pStr + iStrLen; bool iQuote = false; while (true) { if (pStr >= pEnd) { @@ -289,7 +289,7 @@ void CFX_FormatString::SplitFormatString( } } -static CFX_WideString FX_GetLiteralText(const FX_WCHAR* pStrPattern, +static CFX_WideString FX_GetLiteralText(const wchar_t* pStrPattern, int32_t& iPattern, int32_t iLenPattern) { CFX_WideString wsOutput; @@ -314,7 +314,7 @@ static CFX_WideString FX_GetLiteralText(const FX_WCHAR* pStrPattern, iPattern += 2; int32_t i = 0; while (iPattern < iLenPattern && i++ < 4) { - FX_WCHAR ch = pStrPattern[iPattern++]; + wchar_t ch = pStrPattern[iPattern++]; if ((ch >= '0' && ch <= '9')) { iKeyValue = iKeyValue * 16 + ch - '0'; } else if ((ch >= 'a' && ch <= 'f')) { @@ -324,7 +324,7 @@ static CFX_WideString FX_GetLiteralText(const FX_WCHAR* pStrPattern, } } if (iKeyValue != 0) { - wsOutput += (FX_WCHAR)(iKeyValue & 0x0000FFFF); + wsOutput += (wchar_t)(iKeyValue & 0x0000FFFF); } continue; } @@ -332,7 +332,7 @@ static CFX_WideString FX_GetLiteralText(const FX_WCHAR* pStrPattern, } return wsOutput; } -static CFX_WideString FX_GetLiteralTextReverse(const FX_WCHAR* pStrPattern, +static CFX_WideString FX_GetLiteralTextReverse(const wchar_t* pStrPattern, int32_t& iPattern) { CFX_WideString wsOutput; if (pStrPattern[iPattern] != '\'') { @@ -356,7 +356,7 @@ static CFX_WideString FX_GetLiteralTextReverse(const FX_WCHAR* pStrPattern, int32_t iLen = wsOutput.GetLength(); int32_t i = 1; for (; i < iLen && i < 5; i++) { - FX_WCHAR ch = wsOutput[i]; + wchar_t ch = wsOutput[i]; if ((ch >= '0' && ch <= '9')) { iKeyValue = iKeyValue * 16 + ch - '0'; } else if ((ch >= 'a' && ch <= 'f')) { @@ -367,7 +367,7 @@ static CFX_WideString FX_GetLiteralTextReverse(const FX_WCHAR* pStrPattern, } if (iKeyValue != 0) { wsOutput.Delete(0, i); - wsOutput = (FX_WCHAR)(iKeyValue & 0x0000FFFF) + wsOutput; + wsOutput = (wchar_t)(iKeyValue & 0x0000FFFF) + wsOutput; } continue; } @@ -380,7 +380,7 @@ FX_LOCALECATEGORY CFX_FormatString::GetCategory( FX_LOCALECATEGORY eCategory = FX_LOCALECATEGORY_Unknown; int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); - const FX_WCHAR* pStr = wsPattern.c_str(); + const wchar_t* pStr = wsPattern.c_str(); bool bBraceOpen = false; CFX_WideStringC wsConstChars(gs_wsConstChars); while (ccf < iLenf) { @@ -432,7 +432,7 @@ FX_LOCALECATEGORY CFX_FormatString::GetCategory( } return eCategory; } -static uint16_t FX_WStringToLCID(const FX_WCHAR* pstrLCID) { +static uint16_t FX_WStringToLCID(const wchar_t* pstrLCID) { if (!pstrLCID) { return 0; } @@ -446,7 +446,7 @@ CFX_WideString CFX_FormatString::GetLocaleName( const CFX_WideString& wsPattern) { int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); - const FX_WCHAR* pStr = wsPattern.c_str(); + const wchar_t* pStr = wsPattern.c_str(); while (ccf < iLenf) { if (pStr[ccf] == '\'') { FX_GetLiteralText(pStr, ccf, iLenf); @@ -468,7 +468,7 @@ IFX_Locale* CFX_FormatString::GetTextFormat(const CFX_WideString& wsPattern, IFX_Locale* pLocale = nullptr; int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); - const FX_WCHAR* pStr = wsPattern.c_str(); + const wchar_t* pStr = wsPattern.c_str(); bool bBrackOpen = false; CFX_WideStringC wsConstChars(gs_wsConstChars); while (ccf < iLenf) { @@ -525,7 +525,7 @@ IFX_Locale* CFX_FormatString::GetNumericFormat(const CFX_WideString& wsPattern, IFX_Locale* pLocale = nullptr; int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); - const FX_WCHAR* pStr = wsPattern.c_str(); + const wchar_t* pStr = wsPattern.c_str(); bool bFindDot = false; bool bBrackOpen = false; CFX_WideStringC wsConstChars(gs_wsConstChars); @@ -625,7 +625,7 @@ static bool FX_GetNumericDotIndex(const CFX_WideString& wsNum, int32_t& iDotIndex) { int32_t ccf = 0; int32_t iLenf = wsNum.GetLength(); - const FX_WCHAR* pStr = wsNum.c_str(); + const wchar_t* pStr = wsNum.c_str(); int32_t iLenDot = wsDotSymbol.GetLength(); while (ccf < iLenf) { if (pStr[ccf] == '\'') { @@ -657,9 +657,9 @@ bool CFX_FormatString::ParseText(const CFX_WideString& wsSrcText, return false; } int32_t iText = 0, iPattern = 0; - const FX_WCHAR* pStrText = wsSrcText.c_str(); + const wchar_t* pStrText = wsSrcText.c_str(); int32_t iLenText = wsSrcText.GetLength(); - const FX_WCHAR* pStrPattern = wsTextFormat.c_str(); + const wchar_t* pStrPattern = wsTextFormat.c_str(); int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern && iText < iLenText) { switch (pStrPattern[iPattern]) { @@ -741,9 +741,9 @@ bool CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinus); int32_t iMinusLen = wsMinus.GetLength(); int cc = 0, ccf = 0; - const FX_WCHAR* str = wsSrcNum.c_str(); + const wchar_t* str = wsSrcNum.c_str(); int len = wsSrcNum.GetLength(); - const FX_WCHAR* strf = wsNumFormat.c_str(); + const wchar_t* strf = wsNumFormat.c_str(); int lenf = wsNumFormat.GetLength(); double dbRetValue = 0; double coeff = 1; @@ -1449,9 +1449,9 @@ bool CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinus); int32_t iMinusLen = wsMinus.GetLength(); int cc = 0, ccf = 0; - const FX_WCHAR* str = wsSrcNum.c_str(); + const wchar_t* str = wsSrcNum.c_str(); int len = wsSrcNum.GetLength(); - const FX_WCHAR* strf = wsNumFormat.c_str(); + const wchar_t* strf = wsNumFormat.c_str(); int lenf = wsNumFormat.GetLength(); bool bHavePercentSymbol = false; bool bNeg = false; @@ -1915,7 +1915,7 @@ FX_DATETIMETYPE CFX_FormatString::GetDateTimeFormat( FX_LOCALECATEGORY eCategory = FX_LOCALECATEGORY_Unknown; int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); - const FX_WCHAR* pStr = wsPattern.c_str(); + const wchar_t* pStr = wsPattern.c_str(); int32_t iFindCategory = 0; bool bBraceOpen = false; CFX_WideStringC wsConstChars(gs_wsConstChars); @@ -2052,9 +2052,9 @@ static bool FX_ParseLocaleDate(const CFX_WideString& wsDate, int32_t month = 1; int32_t day = 1; int32_t ccf = 0; - const FX_WCHAR* str = wsDate.c_str(); + const wchar_t* str = wsDate.c_str(); int32_t len = wsDate.GetLength(); - const FX_WCHAR* strf = wsDatePattern.c_str(); + const wchar_t* strf = wsDatePattern.c_str(); int32_t lenf = wsDatePattern.GetLength(); CFX_WideStringC wsDateSymbols(gs_wsDateSymbols); while (cc < len && ccf < lenf) { @@ -2076,7 +2076,7 @@ static bool FX_ParseLocaleDate(const CFX_WideString& wsDate, continue; } uint32_t dwSymbolNum = 1; - FX_WCHAR dwCharSymbol = strf[ccf++]; + wchar_t dwCharSymbol = strf[ccf++]; while (ccf < lenf && strf[ccf] == dwCharSymbol) { ccf++; dwSymbolNum++; @@ -2270,9 +2270,9 @@ static bool FX_ParseLocaleTime(const CFX_WideString& wsTime, uint8_t second = 0; uint16_t millisecond = 0; int32_t ccf = 0; - const FX_WCHAR* str = wsTime.c_str(); + const wchar_t* str = wsTime.c_str(); int len = wsTime.GetLength(); - const FX_WCHAR* strf = wsTimePattern.c_str(); + const wchar_t* strf = wsTimePattern.c_str(); int lenf = wsTimePattern.GetLength(); bool bHasA = false; bool bPM = false; @@ -2296,7 +2296,7 @@ static bool FX_ParseLocaleTime(const CFX_WideString& wsTime, continue; } uint32_t dwSymbolNum = 1; - FX_WCHAR dwCharSymbol = strf[ccf++]; + wchar_t dwCharSymbol = strf[ccf++]; while (ccf < lenf && strf[ccf] == dwCharSymbol) { ccf++; dwSymbolNum++; @@ -2508,9 +2508,9 @@ bool CFX_FormatString::ParseZero(const CFX_WideString& wsSrcText, CFX_WideString wsTextFormat; GetTextFormat(wsPattern, L"zero", wsTextFormat); int32_t iText = 0, iPattern = 0; - const FX_WCHAR* pStrText = wsSrcText.c_str(); + const wchar_t* pStrText = wsSrcText.c_str(); int32_t iLenText = wsSrcText.GetLength(); - const FX_WCHAR* pStrPattern = wsTextFormat.c_str(); + const wchar_t* pStrPattern = wsTextFormat.c_str(); int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern && iText < iLenText) { if (pStrPattern[iPattern] == '\'') { @@ -2538,9 +2538,9 @@ bool CFX_FormatString::ParseNull(const CFX_WideString& wsSrcText, CFX_WideString wsTextFormat; GetTextFormat(wsPattern, L"null", wsTextFormat); int32_t iText = 0, iPattern = 0; - const FX_WCHAR* pStrText = wsSrcText.c_str(); + const wchar_t* pStrText = wsSrcText.c_str(); int32_t iLenText = wsSrcText.GetLength(); - const FX_WCHAR* pStrPattern = wsTextFormat.c_str(); + const wchar_t* pStrPattern = wsTextFormat.c_str(); int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern && iText < iLenText) { if (pStrPattern[iPattern] == '\'') { @@ -2576,8 +2576,8 @@ bool CFX_FormatString::FormatText(const CFX_WideString& wsSrcText, CFX_WideString wsTextFormat; GetTextFormat(wsPattern, L"text", wsTextFormat); int32_t iText = 0, iPattern = 0; - const FX_WCHAR* pStrText = wsSrcText.c_str(); - const FX_WCHAR* pStrPattern = wsTextFormat.c_str(); + const wchar_t* pStrText = wsSrcText.c_str(); + const wchar_t* pStrPattern = wsTextFormat.c_str(); int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern) { switch (pStrPattern[iPattern]) { @@ -2632,7 +2632,7 @@ static int32_t FX_GetNumTrailingLimit(const CFX_WideString& wsFormat, int32_t iCount = wsFormat.GetLength(); int32_t iTreading = 0; for (iDotPos++; iDotPos < iCount; iDotPos++) { - FX_WCHAR wc = wsFormat[iDotPos]; + wchar_t wc = wsFormat[iDotPos]; if (wc == L'z' || wc == L'9' || wc == 'Z') { iTreading++; bTrimTailZeros = (wc == L'9' ? false : true); @@ -2655,7 +2655,7 @@ bool CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, return false; } int32_t cc = 0, ccf = 0; - const FX_WCHAR* strf = wsNumFormat.c_str(); + const wchar_t* strf = wsNumFormat.c_str(); int lenf = wsNumFormat.GetLength(); CFX_WideString wsSrcNum(wsInputNum); wsSrcNum.TrimLeft('0'); @@ -2725,7 +2725,7 @@ bool CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, wsSrcNum.Delete(0, 1); } bool bAddNeg = false; - const FX_WCHAR* str = wsSrcNum.c_str(); + const wchar_t* str = wsSrcNum.c_str(); int len = wsSrcNum.GetLength(); int dot_index = wsSrcNum.Find('.'); if (dot_index == -1) { @@ -3088,7 +3088,7 @@ bool CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, return false; } int32_t cc = 0, ccf = 0; - const FX_WCHAR* strf = wsNumFormat.c_str(); + const wchar_t* strf = wsNumFormat.c_str(); int lenf = wsNumFormat.GetLength(); double dbOrgRaw = lcNum.GetDouble(); double dbRetValue = dbOrgRaw; @@ -3151,7 +3151,7 @@ bool CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, wsNumeric.Delete(0, 1); } bool bAddNeg = false; - const FX_WCHAR* str = wsNumeric.c_str(); + const wchar_t* str = wsNumeric.c_str(); int len = wsNumeric.GetLength(); int dot_index = wsNumeric.Find('.'); if (dot_index == -1) { @@ -3507,7 +3507,7 @@ bool FX_DateFromCanonical(const CFX_WideString& wsDate, CFX_Unitime& datetime) { int32_t day = 1; uint16_t wYear = 0; int cc_start = 0, cc = 0; - const FX_WCHAR* str = wsDate.c_str(); + const wchar_t* str = wsDate.c_str(); int len = wsDate.GetLength(); if (len > 10) { return false; @@ -3590,7 +3590,7 @@ bool FX_TimeFromCanonical(const CFX_WideStringC& wsTime, uint8_t second = 0; uint16_t millisecond = 0; int cc_start = 0, cc = cc_start; - const FX_WCHAR* str = wsTime.c_str(); + const wchar_t* str = wsTime.c_str(); int len = wsTime.GetLength(); while (cc < len && cc < 2) { if (!FXSYS_isDecimalDigit(str[cc])) { @@ -3711,7 +3711,7 @@ static bool FX_DateFormat(const CFX_WideString& wsDatePattern, uint8_t month = datetime.GetMonth(); uint8_t day = datetime.GetDay(); int32_t ccf = 0; - const FX_WCHAR* strf = wsDatePattern.c_str(); + const wchar_t* strf = wsDatePattern.c_str(); int32_t lenf = wsDatePattern.GetLength(); CFX_WideStringC wsDateSymbols(gs_wsDateSymbols); while (ccf < lenf) { @@ -3724,7 +3724,7 @@ static bool FX_DateFormat(const CFX_WideString& wsDatePattern, continue; } uint32_t dwSymbolNum = 1; - FX_WCHAR dwCharSymbol = strf[ccf++]; + wchar_t dwCharSymbol = strf[ccf++]; while (ccf < lenf && strf[ccf] == dwCharSymbol) { ccf++; dwSymbolNum++; @@ -3831,7 +3831,7 @@ static bool FX_TimeFormat(const CFX_WideString& wsTimePattern, uint8_t second = datetime.GetSecond(); uint16_t millisecond = datetime.GetMillisecond(); int32_t ccf = 0; - const FX_WCHAR* strf = wsTimePattern.c_str(); + const wchar_t* strf = wsTimePattern.c_str(); int32_t lenf = wsTimePattern.GetLength(); uint16_t wHour = hour; bool bPM = false; @@ -3851,7 +3851,7 @@ static bool FX_TimeFormat(const CFX_WideString& wsTimePattern, continue; } uint32_t dwSymbolNum = 1; - FX_WCHAR dwCharSymbol = strf[ccf++]; + wchar_t dwCharSymbol = strf[ccf++]; while (ccf < lenf && strf[ccf] == dwCharSymbol) { ccf++; dwSymbolNum++; @@ -4081,7 +4081,7 @@ bool CFX_FormatString::FormatZero(const CFX_WideString& wsPattern, CFX_WideString wsTextFormat; GetTextFormat(wsPattern, L"zero", wsTextFormat); int32_t iPattern = 0; - const FX_WCHAR* pStrPattern = wsTextFormat.c_str(); + const wchar_t* pStrPattern = wsTextFormat.c_str(); int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern) { if (pStrPattern[iPattern] == '\'') { @@ -4103,7 +4103,7 @@ bool CFX_FormatString::FormatNull(const CFX_WideString& wsPattern, CFX_WideString wsTextFormat; GetTextFormat(wsPattern, L"null", wsTextFormat); int32_t iPattern = 0; - const FX_WCHAR* pStrPattern = wsTextFormat.c_str(); + const wchar_t* pStrPattern = wsTextFormat.c_str(); int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern) { if (pStrPattern[iPattern] == '\'') { @@ -4433,8 +4433,8 @@ CFX_Decimal::CFX_Decimal(FX_FLOAT val, uint8_t scale) { m_uFlags = FXMATH_DECIMAL_MAKEFLAGS(val < 0 && IsNotZero(), scale); } CFX_Decimal::CFX_Decimal(const CFX_WideStringC& strObj) { - const FX_WCHAR* str = strObj.c_str(); - const FX_WCHAR* strBound = str + strObj.GetLength(); + const wchar_t* str = strObj.c_str(); + const wchar_t* strBound = str + strObj.GetLength(); bool pointmet = 0; bool negmet = 0; uint8_t scale = 0; diff --git a/xfa/fwl/cfwl_barcode.cpp b/xfa/fwl/cfwl_barcode.cpp index 0412b86958..e894d25d64 100644 --- a/xfa/fwl/cfwl_barcode.cpp +++ b/xfa/fwl/cfwl_barcode.cpp @@ -136,12 +136,12 @@ void CFWL_Barcode::SetWideNarrowRatio(int32_t ratio) { m_nWideNarrowRatio = ratio; } -void CFWL_Barcode::SetStartChar(FX_CHAR startChar) { +void CFWL_Barcode::SetStartChar(char startChar) { m_dwAttributeMask |= FWL_BCDATTRIBUTE_STARTCHAR; m_cStartChar = startChar; } -void CFWL_Barcode::SetEndChar(FX_CHAR endChar) { +void CFWL_Barcode::SetEndChar(char endChar) { m_dwAttributeMask |= FWL_BCDATTRIBUTE_ENDCHAR; m_cEndChar = endChar; } diff --git a/xfa/fwl/cfwl_barcode.h b/xfa/fwl/cfwl_barcode.h index 2e9799172b..101cc602fb 100644 --- a/xfa/fwl/cfwl_barcode.h +++ b/xfa/fwl/cfwl_barcode.h @@ -63,8 +63,8 @@ class CFWL_Barcode : public CFWL_Edit { void SetPrintChecksum(bool printChecksum); void SetTextLocation(BC_TEXT_LOC location); void SetWideNarrowRatio(int32_t ratio); - void SetStartChar(FX_CHAR startChar); - void SetEndChar(FX_CHAR endChar); + void SetStartChar(char startChar); + void SetEndChar(char endChar); void SetErrorCorrectionLevel(int32_t ecLevel); void SetTruncated(bool truncated); @@ -83,8 +83,8 @@ class CFWL_Barcode : public CFWL_Edit { bool m_bPrintChecksum; BC_TEXT_LOC m_eTextLocation; int32_t m_nWideNarrowRatio; - FX_CHAR m_cStartChar; - FX_CHAR m_cEndChar; + char m_cStartChar; + char m_cEndChar; int32_t m_nECLevel; bool m_bTruncated; uint32_t m_dwAttributeMask; diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp index a7c85d57b7..b3b05a52d0 100644 --- a/xfa/fwl/cfwl_edit.cpp +++ b/xfa/fwl/cfwl_edit.cpp @@ -38,7 +38,7 @@ namespace { const int kEditMargin = 3; -bool FX_EDIT_ISLATINWORD(FX_WCHAR c) { +bool FX_EDIT_ISLATINWORD(wchar_t c) { return c == 0x2D || (c <= 0x005A && c >= 0x0041) || (c <= 0x007A && c >= 0x0061) || (c <= 0x02AF && c >= 0x00C0) || c == 0x0027; @@ -203,7 +203,7 @@ void CFWL_Edit::DrawSpellCheck(CFX_Graphics* pGraphics, if (FX_EDIT_ISLATINWORD(wsSpell[i])) { if (sLatinWord.IsEmpty()) nStart = i; - sLatinWord += (FX_CHAR)wsSpell[i]; + sLatinWord += (char)wsSpell[i]; continue; } checkWordEvent.bsWord = sLatinWord; @@ -314,7 +314,7 @@ void CFWL_Edit::SetLimit(int32_t nLimit) { m_EdtEngine.SetLimit(nLimit); } -void CFWL_Edit::SetAliasChar(FX_WCHAR wAlias) { +void CFWL_Edit::SetAliasChar(wchar_t wAlias) { m_EdtEngine.SetAliasChar(wAlias); } @@ -1137,7 +1137,7 @@ void CFWL_Edit::HideCaret(CFX_RectF* pRect) { pDocEnvironment->DisplayCaret(pXFAWidget, false, pRect); } -bool CFWL_Edit::ValidateNumberChar(FX_WCHAR cNum) { +bool CFWL_Edit::ValidateNumberChar(wchar_t cNum) { if (!m_bSetRange) return true; @@ -1434,7 +1434,7 @@ void CFWL_Edit::OnChar(CFWL_MessageKey* pMsg) { } int32_t iError = 0; - FX_WCHAR c = static_cast<FX_WCHAR>(pMsg->m_dwKeyCode); + wchar_t c = static_cast<wchar_t>(pMsg->m_dwKeyCode); int32_t nCaret = m_EdtEngine.GetCaretPos(); switch (c) { case FWL_VKEY_Back: diff --git a/xfa/fwl/cfwl_edit.h b/xfa/fwl/cfwl_edit.h index 154e286331..13e4be2c68 100644 --- a/xfa/fwl/cfwl_edit.h +++ b/xfa/fwl/cfwl_edit.h @@ -80,7 +80,7 @@ class CFWL_Edit : public CFWL_Widget { void ClearSelections(); int32_t GetLimit() const; void SetLimit(int32_t nLimit); - void SetAliasChar(FX_WCHAR wAlias); + void SetAliasChar(wchar_t wAlias); bool Copy(CFX_WideString& wsCopy); bool Cut(CFX_WideString& wsCut); bool Paste(const CFX_WideString& wsPaste); @@ -132,7 +132,7 @@ class CFWL_Edit : public CFWL_Widget { void InitHorizontalScrollBar(); void InitEngine(); void InitCaret(); - bool ValidateNumberChar(FX_WCHAR cNum); + bool ValidateNumberChar(wchar_t cNum); void ClearRecord(); bool IsShowScrollBar(bool bVert); bool IsContentHeightOverflow(); diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp index 6882d709bf..2dcac03731 100644 --- a/xfa/fwl/cfwl_monthcalendar.cpp +++ b/xfa/fwl/cfwl_monthcalendar.cpp @@ -674,10 +674,10 @@ void CFWL_MonthCalendar::JumpToToday() { CFX_WideString CFWL_MonthCalendar::GetHeadText(int32_t iYear, int32_t iMonth) { ASSERT(iMonth > 0 && iMonth < 13); - static const FX_WCHAR* const pMonth[] = { - L"January", L"February", L"March", L"April", - L"May", L"June", L"July", L"August", - L"September", L"October", L"November", L"December"}; + static const wchar_t* const pMonth[] = {L"January", L"February", L"March", + L"April", L"May", L"June", + L"July", L"August", L"September", + L"October", L"November", L"December"}; CFX_WideString wsHead; wsHead.Format(L"%s, %d", pMonth[iMonth - 1], iYear); return wsHead; diff --git a/xfa/fwl/cfx_barcode.cpp b/xfa/fwl/cfx_barcode.cpp index 7af3aa1888..1c22367901 100644 --- a/xfa/fwl/cfx_barcode.cpp +++ b/xfa/fwl/cfx_barcode.cpp @@ -235,8 +235,8 @@ bool CFX_Barcode::SetWideNarrowRatio(int32_t ratio) { return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(ratio) : false; } -bool CFX_Barcode::SetStartChar(FX_CHAR start) { - typedef bool (CBC_CodeBase::*memptrtype)(FX_CHAR); +bool CFX_Barcode::SetStartChar(char start) { + typedef bool (CBC_CodeBase::*memptrtype)(char); memptrtype memptr = nullptr; switch (GetType()) { case BC_CODABAR: @@ -248,8 +248,8 @@ bool CFX_Barcode::SetStartChar(FX_CHAR start) { return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(start) : false; } -bool CFX_Barcode::SetEndChar(FX_CHAR end) { - typedef bool (CBC_CodeBase::*memptrtype)(FX_CHAR); +bool CFX_Barcode::SetEndChar(char end) { + typedef bool (CBC_CodeBase::*memptrtype)(char); memptrtype memptr = nullptr; switch (GetType()) { case BC_CODABAR: diff --git a/xfa/fwl/cfx_barcode.h b/xfa/fwl/cfx_barcode.h index f639977cfc..3f4b340d95 100644 --- a/xfa/fwl/cfx_barcode.h +++ b/xfa/fwl/cfx_barcode.h @@ -52,8 +52,8 @@ class CFX_Barcode { bool SetTextLocation(BC_TEXT_LOC location); bool SetWideNarrowRatio(int32_t ratio); - bool SetStartChar(FX_CHAR start); - bool SetEndChar(FX_CHAR end); + bool SetStartChar(char start); + bool SetEndChar(char end); bool SetVersion(int32_t version); bool SetErrorCorrectionLevel(int32_t level); bool SetTruncated(bool truncated); diff --git a/xfa/fxbarcode/BC_Dimension.cpp b/xfa/fxbarcode/BC_Dimension.cpp index 0cb076ce22..7a4b256f31 100644 --- a/xfa/fxbarcode/BC_Dimension.cpp +++ b/xfa/fxbarcode/BC_Dimension.cpp @@ -42,5 +42,5 @@ int32_t CBC_Dimension::hashCode() { return m_width * 32713 + m_height; } CFX_WideString CBC_Dimension::toString() { - return (FX_WCHAR)(m_width + (FX_WCHAR)'x' + m_height); + return (wchar_t)(m_width + (wchar_t)'x' + m_height); } diff --git a/xfa/fxbarcode/BC_Utils.cpp b/xfa/fxbarcode/BC_Utils.cpp index 5d881c7be1..b1dcf4a973 100644 --- a/xfa/fxbarcode/BC_Utils.cpp +++ b/xfa/fxbarcode/BC_Utils.cpp @@ -11,7 +11,7 @@ bool BC_FX_ByteString_Replace(CFX_ByteString& dst, uint32_t first, uint32_t last, int32_t count, - FX_CHAR c) { + char c) { if (first > last || count <= 0) { return false; } @@ -21,7 +21,7 @@ bool BC_FX_ByteString_Replace(CFX_ByteString& dst, } return true; } -void BC_FX_ByteString_Append(CFX_ByteString& dst, int32_t count, FX_CHAR c) { +void BC_FX_ByteString_Append(CFX_ByteString& dst, int32_t count, char c) { for (int32_t i = 0; i < count; i++) { dst += c; } diff --git a/xfa/fxbarcode/cbc_codabar.cpp b/xfa/fxbarcode/cbc_codabar.cpp index 6f6ab4a96c..53e351d5a2 100644 --- a/xfa/fxbarcode/cbc_codabar.cpp +++ b/xfa/fxbarcode/cbc_codabar.cpp @@ -27,14 +27,14 @@ CBC_Codabar::CBC_Codabar() : CBC_OneCode(new CBC_OnedCodaBarWriter) {} CBC_Codabar::~CBC_Codabar() {} -bool CBC_Codabar::SetStartChar(FX_CHAR start) { +bool CBC_Codabar::SetStartChar(char start) { if (!m_pBCWriter) return false; return static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get()) ->SetStartChar(start); } -bool CBC_Codabar::SetEndChar(FX_CHAR end) { +bool CBC_Codabar::SetEndChar(char end) { if (m_pBCWriter) return static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get()) ->SetEndChar(end); diff --git a/xfa/fxbarcode/cbc_codabar.h b/xfa/fxbarcode/cbc_codabar.h index 28631a9cb5..43f1a010c0 100644 --- a/xfa/fxbarcode/cbc_codabar.h +++ b/xfa/fxbarcode/cbc_codabar.h @@ -27,8 +27,8 @@ class CBC_Codabar : public CBC_OneCode { bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override; BC_TYPE GetType() override; - bool SetStartChar(FX_CHAR start); - bool SetEndChar(FX_CHAR end); + bool SetStartChar(char start); + bool SetEndChar(char end); bool SetTextLocation(BC_TEXT_LOC location); bool SetWideNarrowRatio(int32_t ratio); diff --git a/xfa/fxbarcode/cbc_ean13.cpp b/xfa/fxbarcode/cbc_ean13.cpp index 450fba04c9..abd5f198a3 100644 --- a/xfa/fxbarcode/cbc_ean13.cpp +++ b/xfa/fxbarcode/cbc_ean13.cpp @@ -34,7 +34,7 @@ CFX_WideString CBC_EAN13::Preprocess(const CFX_WideStringC& contents) { int32_t length = encodeContents.GetLength(); if (length <= 12) { for (int32_t i = 0; i < 12 - length; i++) - encodeContents = FX_WCHAR('0') + encodeContents; + encodeContents = wchar_t('0') + encodeContents; CFX_ByteString byteString = encodeContents.UTF8Encode(); int32_t checksum = static_cast<CBC_OnedEAN13Writer*>(m_pBCWriter.get()) diff --git a/xfa/fxbarcode/cbc_ean8.cpp b/xfa/fxbarcode/cbc_ean8.cpp index 64ba617331..bfb458521e 100644 --- a/xfa/fxbarcode/cbc_ean8.cpp +++ b/xfa/fxbarcode/cbc_ean8.cpp @@ -34,12 +34,12 @@ CFX_WideString CBC_EAN8::Preprocess(const CFX_WideStringC& contents) { int32_t length = encodeContents.GetLength(); if (length <= 7) { for (int32_t i = 0; i < 7 - length; i++) - encodeContents = FX_WCHAR('0') + encodeContents; + encodeContents = wchar_t('0') + encodeContents; CFX_ByteString byteString = encodeContents.UTF8Encode(); int32_t checksum = static_cast<CBC_OnedEAN8Writer*>(m_pBCWriter.get()) ->CalcChecksum(byteString); - encodeContents += FX_WCHAR(checksum - 0 + '0'); + encodeContents += wchar_t(checksum - 0 + '0'); } if (length > 8) encodeContents = encodeContents.Mid(0, 8); diff --git a/xfa/fxbarcode/cbc_upca.cpp b/xfa/fxbarcode/cbc_upca.cpp index b282d5cd79..87f58093ae 100644 --- a/xfa/fxbarcode/cbc_upca.cpp +++ b/xfa/fxbarcode/cbc_upca.cpp @@ -34,7 +34,7 @@ CFX_WideString CBC_UPCA::Preprocess(const CFX_WideStringC& contents) { int32_t length = encodeContents.GetLength(); if (length <= 11) { for (int32_t i = 0; i < 11 - length; i++) - encodeContents = FX_WCHAR('0') + encodeContents; + encodeContents = wchar_t('0') + encodeContents; CFX_ByteString byteString = encodeContents.UTF8Encode(); int32_t checksum = pWriter->CalcChecksum(byteString); diff --git a/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp b/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp index 00d8fc1615..88a12b23a2 100644 --- a/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp @@ -37,16 +37,15 @@ void CBC_ASCIIEncoder::Encode(CBC_EncoderContext& context, int32_t& e) { int32_t n = CBC_HighLevelEncoder::determineConsecutiveDigitCount( context.m_msg, context.m_pos); if (n >= 2) { - FX_WCHAR code = - encodeASCIIDigits(context.m_msg.GetAt(context.m_pos), - context.m_msg.GetAt(context.m_pos + 1), e); + wchar_t code = encodeASCIIDigits(context.m_msg.GetAt(context.m_pos), + context.m_msg.GetAt(context.m_pos + 1), e); if (e != BCExceptionNO) { return; } context.writeCodeword(code); context.m_pos += 2; } else { - FX_WCHAR c = context.getCurrentChar(); + wchar_t c = context.getCurrentChar(); int32_t newMode = CBC_HighLevelEncoder::lookAheadTest( context.m_msg, context.m_pos, getEncodingMode()); if (newMode != getEncodingMode()) { @@ -77,21 +76,21 @@ void CBC_ASCIIEncoder::Encode(CBC_EncoderContext& context, int32_t& e) { } } else if (CBC_HighLevelEncoder::isExtendedASCII(c)) { context.writeCodeword(CBC_HighLevelEncoder::UPPER_SHIFT); - context.writeCodeword((FX_WCHAR)(c - 128 + 1)); + context.writeCodeword((wchar_t)(c - 128 + 1)); context.m_pos++; } else { - context.writeCodeword((FX_WCHAR)(c + 1)); + context.writeCodeword((wchar_t)(c + 1)); context.m_pos++; } } } -FX_WCHAR CBC_ASCIIEncoder::encodeASCIIDigits(FX_WCHAR digit1, - FX_WCHAR digit2, - int32_t& e) { +wchar_t CBC_ASCIIEncoder::encodeASCIIDigits(wchar_t digit1, + wchar_t digit2, + int32_t& e) { if (CBC_HighLevelEncoder::isDigit(digit1) && CBC_HighLevelEncoder::isDigit(digit2)) { int32_t num = (digit1 - 48) * 10 + (digit2 - 48); - return (FX_WCHAR)(num + 130); + return (wchar_t)(num + 130); } e = BCExceptionIllegalArgumentNotGigits; return 0; diff --git a/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.h b/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.h index 40559b532d..a0cfaa76ed 100644 --- a/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.h +++ b/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.h @@ -21,9 +21,7 @@ class CBC_ASCIIEncoder : public CBC_Encoder { void Encode(CBC_EncoderContext& context, int32_t& e) override; private: - static FX_WCHAR encodeASCIIDigits(FX_WCHAR digit1, - FX_WCHAR digit2, - int32_t& e); + static wchar_t encodeASCIIDigits(wchar_t digit1, wchar_t digit2, int32_t& e); }; #endif // XFA_FXBARCODE_DATAMATRIX_BC_ASCIIENCODER_H_ diff --git a/xfa/fxbarcode/datamatrix/BC_Base256Encoder.cpp b/xfa/fxbarcode/datamatrix/BC_Base256Encoder.cpp index b8e427c7fc..333377e392 100644 --- a/xfa/fxbarcode/datamatrix/BC_Base256Encoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_Base256Encoder.cpp @@ -35,9 +35,9 @@ int32_t CBC_Base256Encoder::getEncodingMode() { } void CBC_Base256Encoder::Encode(CBC_EncoderContext& context, int32_t& e) { CFX_WideString buffer; - buffer += (FX_WCHAR)'\0'; + buffer += (wchar_t)'\0'; while (context.hasMoreCharacters()) { - FX_WCHAR c = context.getCurrentChar(); + wchar_t c = context.getCurrentChar(); buffer += c; context.m_pos++; int32_t newMode = CBC_HighLevelEncoder::lookAheadTest( @@ -48,9 +48,9 @@ void CBC_Base256Encoder::Encode(CBC_EncoderContext& context, int32_t& e) { } } int32_t dataCount = buffer.GetLength() - 1; - FX_CHAR buf[128]; + char buf[128]; FXSYS_itoa(dataCount, buf, 10); - buffer.SetAt(0, FX_WCHAR(*buf) - '0'); + buffer.SetAt(0, wchar_t(*buf) - '0'); int32_t lengthFieldSize = 1; int32_t currentSize = context.getCodewordCount() + dataCount + lengthFieldSize; @@ -61,10 +61,10 @@ void CBC_Base256Encoder::Encode(CBC_EncoderContext& context, int32_t& e) { bool mustPad = (context.m_symbolInfo->m_dataCapacity - currentSize) > 0; if (context.hasMoreCharacters() || mustPad) { if (dataCount <= 249) { - buffer.SetAt(0, (FX_WCHAR)dataCount); + buffer.SetAt(0, (wchar_t)dataCount); } else if (dataCount > 249 && dataCount <= 1555) { - buffer.SetAt(0, (FX_WCHAR)((dataCount / 250) + 249)); - buffer.Insert(1, (FX_WCHAR)(dataCount % 250)); + buffer.SetAt(0, (wchar_t)((dataCount / 250) + 249)); + buffer.Insert(1, (wchar_t)(dataCount % 250)); } else { e = BCExceptionIllegalStateMessageLengthInvalid; return; @@ -75,13 +75,13 @@ void CBC_Base256Encoder::Encode(CBC_EncoderContext& context, int32_t& e) { randomize255State(buffer.GetAt(i), context.getCodewordCount() + 1)); } } -FX_WCHAR CBC_Base256Encoder::randomize255State(FX_WCHAR ch, - int32_t codewordPosition) { +wchar_t CBC_Base256Encoder::randomize255State(wchar_t ch, + int32_t codewordPosition) { int32_t pseudoRandom = ((149 * codewordPosition) % 255) + 1; int32_t tempVariable = ch + pseudoRandom; if (tempVariable <= 255) { - return (FX_WCHAR)tempVariable; + return (wchar_t)tempVariable; } else { - return (FX_WCHAR)(tempVariable - 256); + return (wchar_t)(tempVariable - 256); } } diff --git a/xfa/fxbarcode/datamatrix/BC_Base256Encoder.h b/xfa/fxbarcode/datamatrix/BC_Base256Encoder.h index c41c79db08..41229afb80 100644 --- a/xfa/fxbarcode/datamatrix/BC_Base256Encoder.h +++ b/xfa/fxbarcode/datamatrix/BC_Base256Encoder.h @@ -19,7 +19,7 @@ class CBC_Base256Encoder : public CBC_Encoder { void Encode(CBC_EncoderContext& context, int32_t& e) override; private: - static FX_WCHAR randomize255State(FX_WCHAR ch, int32_t codewordPosition); + static wchar_t randomize255State(wchar_t ch, int32_t codewordPosition); }; #endif // XFA_FXBARCODE_DATAMATRIX_BC_BASE256ENCODER_H_ diff --git a/xfa/fxbarcode/datamatrix/BC_C40Encoder.cpp b/xfa/fxbarcode/datamatrix/BC_C40Encoder.cpp index 50f02ca52d..04fcb6b541 100644 --- a/xfa/fxbarcode/datamatrix/BC_C40Encoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_C40Encoder.cpp @@ -37,7 +37,7 @@ int32_t CBC_C40Encoder::getEncodingMode() { void CBC_C40Encoder::Encode(CBC_EncoderContext& context, int32_t& e) { CFX_WideString buffer; while (context.hasMoreCharacters()) { - FX_WCHAR c = context.getCurrentChar(); + wchar_t c = context.getCurrentChar(); context.m_pos++; int32_t lastCharSize = encodeChar(c, buffer, e); if (e != BCExceptionNO) { @@ -100,7 +100,7 @@ void CBC_C40Encoder::handleEOD(CBC_EncoderContext& context, } int32_t available = context.m_symbolInfo->m_dataCapacity - curCodewordCount; if (rest == 2) { - buffer += (FX_WCHAR)'\0'; + buffer += (wchar_t)'\0'; while (buffer.GetLength() >= 3) { writeNextTriplet(context, buffer); } @@ -128,39 +128,39 @@ void CBC_C40Encoder::handleEOD(CBC_EncoderContext& context, } context.signalEncoderChange(ASCII_ENCODATION); } -int32_t CBC_C40Encoder::encodeChar(FX_WCHAR c, CFX_WideString& sb, int32_t& e) { +int32_t CBC_C40Encoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) { if (c == ' ') { - sb += (FX_WCHAR)'\3'; + sb += (wchar_t)'\3'; return 1; } else if ((c >= '0') && (c <= '9')) { - sb += (FX_WCHAR)(c - 48 + 4); + sb += (wchar_t)(c - 48 + 4); return 1; } else if ((c >= 'A') && (c <= 'Z')) { - sb += (FX_WCHAR)(c - 65 + 14); + sb += (wchar_t)(c - 65 + 14); return 1; } else if (c <= 0x1f) { - sb += (FX_WCHAR)'\0'; + sb += (wchar_t)'\0'; sb += c; return 2; } else if ((c >= '!') && (c <= '/')) { - sb += (FX_WCHAR)'\1'; - sb += (FX_WCHAR)(c - 33); + sb += (wchar_t)'\1'; + sb += (wchar_t)(c - 33); return 2; } else if ((c >= ':') && (c <= '@')) { - sb += (FX_WCHAR)'\1'; - sb += (FX_WCHAR)(c - 58 + 15); + sb += (wchar_t)'\1'; + sb += (wchar_t)(c - 58 + 15); return 2; } else if ((c >= '[') && (c <= '_')) { - sb += (FX_WCHAR)'\1'; - sb += (FX_WCHAR)(c - 91 + 22); + sb += (wchar_t)'\1'; + sb += (wchar_t)(c - 91 + 22); return 2; } else if ((c >= 60) && (c <= 0x7f)) { - sb += (FX_WCHAR)'\2'; - sb += (FX_WCHAR)(c - 96); + sb += (wchar_t)'\2'; + sb += (wchar_t)(c - 96); return 2; } else if (c >= 80) { - sb += (FX_WCHAR)'\1'; - sb += (FX_WCHAR)0x001e; + sb += (wchar_t)'\1'; + sb += (wchar_t)0x001e; int32_t len = 2; len += encodeChar((c - 128), sb, e); if (e != BCExceptionNO) @@ -179,7 +179,7 @@ int32_t CBC_C40Encoder::backtrackOneCharacter(CBC_EncoderContext& context, int32_t count = buffer.GetLength(); buffer.Delete(count - lastCharSize, count); context.m_pos--; - FX_WCHAR c = context.getCurrentChar(); + wchar_t c = context.getCurrentChar(); lastCharSize = encodeChar(c, removed, e); if (e != BCExceptionNO) return -1; @@ -188,12 +188,12 @@ int32_t CBC_C40Encoder::backtrackOneCharacter(CBC_EncoderContext& context, } CFX_WideString CBC_C40Encoder::encodeToCodewords(CFX_WideString sb, int32_t startPos) { - FX_WCHAR c1 = sb.GetAt(startPos); - FX_WCHAR c2 = sb.GetAt(startPos + 1); - FX_WCHAR c3 = sb.GetAt(startPos + 2); + wchar_t c1 = sb.GetAt(startPos); + wchar_t c2 = sb.GetAt(startPos + 1); + wchar_t c3 = sb.GetAt(startPos + 2); int32_t v = (1600 * c1) + (40 * c2) + c3 + 1; - FX_WCHAR cw1 = (FX_WCHAR)(v / 256); - FX_WCHAR cw2 = (FX_WCHAR)(v % 256); + wchar_t cw1 = (wchar_t)(v / 256); + wchar_t cw2 = (wchar_t)(v % 256); CFX_WideString b1(cw1); CFX_WideString b2(cw2); return b1 + b2; diff --git a/xfa/fxbarcode/datamatrix/BC_C40Encoder.h b/xfa/fxbarcode/datamatrix/BC_C40Encoder.h index 9737981f75..03dee140df 100644 --- a/xfa/fxbarcode/datamatrix/BC_C40Encoder.h +++ b/xfa/fxbarcode/datamatrix/BC_C40Encoder.h @@ -24,7 +24,7 @@ class CBC_C40Encoder : public CBC_Encoder { virtual void handleEOD(CBC_EncoderContext& context, CFX_WideString& buffer, int32_t& e); - virtual int32_t encodeChar(FX_WCHAR c, CFX_WideString& sb, int32_t& e); + virtual int32_t encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e); private: int32_t backtrackOneCharacter(CBC_EncoderContext& context, diff --git a/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.cpp b/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.cpp index 7db117d003..2ffc8413a3 100644 --- a/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.cpp @@ -37,7 +37,7 @@ int32_t CBC_EdifactEncoder::getEncodingMode() { void CBC_EdifactEncoder::Encode(CBC_EncoderContext& context, int32_t& e) { CFX_WideString buffer; while (context.hasMoreCharacters()) { - FX_WCHAR c = context.getCurrentChar(); + wchar_t c = context.getCurrentChar(); encodeChar(c, buffer, e); if (e != BCExceptionNO) { return; @@ -58,7 +58,7 @@ void CBC_EdifactEncoder::Encode(CBC_EncoderContext& context, int32_t& e) { } } } - buffer += (FX_WCHAR)31; + buffer += (wchar_t)31; handleEOD(context, buffer, e); } void CBC_EdifactEncoder::handleEOD(CBC_EncoderContext& context, @@ -115,13 +115,11 @@ void CBC_EdifactEncoder::handleEOD(CBC_EncoderContext& context, } context.signalEncoderChange(ASCII_ENCODATION); } -void CBC_EdifactEncoder::encodeChar(FX_WCHAR c, - CFX_WideString& sb, - int32_t& e) { +void CBC_EdifactEncoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) { if (c >= ' ' && c <= '?') { sb += c; } else if (c >= '@' && c <= '^') { - sb += (FX_WCHAR)(c - 64); + sb += (wchar_t)(c - 64); } else { CBC_HighLevelEncoder::illegalCharacter(c, e); } @@ -134,14 +132,14 @@ CFX_WideString CBC_EdifactEncoder::encodeToCodewords(CFX_WideString sb, e = BCExceptionNoContents; return CFX_WideString(); } - FX_WCHAR c1 = sb.GetAt(startPos); - FX_WCHAR c2 = len >= 2 ? sb.GetAt(startPos + 1) : 0; - FX_WCHAR c3 = len >= 3 ? sb.GetAt(startPos + 2) : 0; - FX_WCHAR c4 = len >= 4 ? sb.GetAt(startPos + 3) : 0; + wchar_t c1 = sb.GetAt(startPos); + wchar_t c2 = len >= 2 ? sb.GetAt(startPos + 1) : 0; + wchar_t c3 = len >= 3 ? sb.GetAt(startPos + 2) : 0; + wchar_t c4 = len >= 4 ? sb.GetAt(startPos + 3) : 0; int32_t v = (c1 << 18) + (c2 << 12) + (c3 << 6) + c4; - FX_WCHAR cw1 = (FX_WCHAR)((v >> 16) & 255); - FX_WCHAR cw2 = (FX_WCHAR)((v >> 8) & 255); - FX_WCHAR cw3 = (FX_WCHAR)(v & 255); + wchar_t cw1 = (wchar_t)((v >> 16) & 255); + wchar_t cw2 = (wchar_t)((v >> 8) & 255); + wchar_t cw3 = (wchar_t)(v & 255); CFX_WideString res; res += cw1; if (len >= 2) { diff --git a/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.h b/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.h index 3eb762fe6d..afe013e02e 100644 --- a/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.h +++ b/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.h @@ -22,7 +22,7 @@ class CBC_EdifactEncoder : public CBC_Encoder { static void handleEOD(CBC_EncoderContext& context, CFX_WideString buffer, int32_t& e); - static void encodeChar(FX_WCHAR c, CFX_WideString& sb, int32_t& e); + static void encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e); static CFX_WideString encodeToCodewords(CFX_WideString sb, int32_t startPos, int32_t& e); diff --git a/xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp b/xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp index b01b3120e3..6af2bc4e83 100644 --- a/xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp +++ b/xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp @@ -36,7 +36,7 @@ CBC_EncoderContext::CBC_EncoderContext(const CFX_WideString msg, CFX_WideString sb; int32_t c = dststr.GetLength(); for (int32_t i = 0; i < c; i++) { - FX_WCHAR ch = (FX_WCHAR)(dststr.GetAt(i) & 0xff); + wchar_t ch = (wchar_t)(dststr.GetAt(i) & 0xff); if (ch == '?' && dststr.GetAt(i) != '?') { e = BCExceptionCharactersOutsideISO88591Encoding; } @@ -66,16 +66,16 @@ CFX_WideString CBC_EncoderContext::getMessage() { void CBC_EncoderContext::setSkipAtEnd(int32_t count) { m_skipAtEnd = count; } -FX_WCHAR CBC_EncoderContext::getCurrentChar() { +wchar_t CBC_EncoderContext::getCurrentChar() { return m_msg.GetAt(m_pos); } -FX_WCHAR CBC_EncoderContext::getCurrent() { +wchar_t CBC_EncoderContext::getCurrent() { return m_msg.GetAt(m_pos); } void CBC_EncoderContext::writeCodewords(CFX_WideString codewords) { m_codewords += codewords; } -void CBC_EncoderContext::writeCodeword(FX_WCHAR codeword) { +void CBC_EncoderContext::writeCodeword(wchar_t codeword) { m_codewords += codeword; } int32_t CBC_EncoderContext::getCodewordCount() { diff --git a/xfa/fxbarcode/datamatrix/BC_EncoderContext.h b/xfa/fxbarcode/datamatrix/BC_EncoderContext.h index 8d0ea5d7ed..03018b2ffe 100644 --- a/xfa/fxbarcode/datamatrix/BC_EncoderContext.h +++ b/xfa/fxbarcode/datamatrix/BC_EncoderContext.h @@ -23,10 +23,10 @@ class CBC_EncoderContext : public CBC_SymbolShapeHint { void setSizeConstraints(CBC_Dimension* minSize, CBC_Dimension* maxSize); CFX_WideString getMessage(); void setSkipAtEnd(int32_t count); - FX_WCHAR getCurrentChar(); - FX_WCHAR getCurrent(); + wchar_t getCurrentChar(); + wchar_t getCurrent(); void writeCodewords(CFX_WideString codewords); - void writeCodeword(FX_WCHAR codeword); + void writeCodeword(wchar_t codeword); int32_t getCodewordCount(); void signalEncoderChange(int32_t encoding); void resetEncoderSignal(); diff --git a/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp b/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp index 17eec1ee4f..ffdd308d54 100644 --- a/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp +++ b/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp @@ -150,7 +150,7 @@ CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords, for (int32_t block = 0; block < blockCount; block++) { CFX_WideString temp; for (int32_t d = block; d < symbolInfo->m_dataCapacity; d += blockCount) { - temp += (FX_WCHAR)codewords.GetAt(d); + temp += (wchar_t)codewords.GetAt(d); } CFX_WideString ecc = createECCBlock(temp, errorSizes[block], e); if (e != BCExceptionNO) @@ -203,7 +203,7 @@ CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords, } CFX_WideString strecc; for (int32_t j = 0; j < numECWords; j++) { - strecc += (FX_WCHAR)ecc[numECWords - j - 1]; + strecc += (wchar_t)ecc[numECWords - j - 1]; } FX_Free(ecc); return strecc; diff --git a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp index abd3584761..ec6eb02b1c 100644 --- a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp @@ -40,17 +40,17 @@ #include "xfa/fxbarcode/datamatrix/BC_X12Encoder.h" #include "xfa/fxbarcode/utils.h" -FX_WCHAR CBC_HighLevelEncoder::LATCH_TO_C40 = 230; -FX_WCHAR CBC_HighLevelEncoder::LATCH_TO_BASE256 = 231; -FX_WCHAR CBC_HighLevelEncoder::UPPER_SHIFT = 235; -FX_WCHAR CBC_HighLevelEncoder::LATCH_TO_ANSIX12 = 238; -FX_WCHAR CBC_HighLevelEncoder::LATCH_TO_TEXT = 239; -FX_WCHAR CBC_HighLevelEncoder::LATCH_TO_EDIFACT = 240; -FX_WCHAR CBC_HighLevelEncoder::C40_UNLATCH = 254; -FX_WCHAR CBC_HighLevelEncoder::X12_UNLATCH = 254; -FX_WCHAR CBC_HighLevelEncoder::PAD = 129; -FX_WCHAR CBC_HighLevelEncoder::MACRO_05 = 236; -FX_WCHAR CBC_HighLevelEncoder::MACRO_06 = 237; +wchar_t CBC_HighLevelEncoder::LATCH_TO_C40 = 230; +wchar_t CBC_HighLevelEncoder::LATCH_TO_BASE256 = 231; +wchar_t CBC_HighLevelEncoder::UPPER_SHIFT = 235; +wchar_t CBC_HighLevelEncoder::LATCH_TO_ANSIX12 = 238; +wchar_t CBC_HighLevelEncoder::LATCH_TO_TEXT = 239; +wchar_t CBC_HighLevelEncoder::LATCH_TO_EDIFACT = 240; +wchar_t CBC_HighLevelEncoder::C40_UNLATCH = 254; +wchar_t CBC_HighLevelEncoder::X12_UNLATCH = 254; +wchar_t CBC_HighLevelEncoder::PAD = 129; +wchar_t CBC_HighLevelEncoder::MACRO_05 = 236; +wchar_t CBC_HighLevelEncoder::MACRO_06 = 237; const wchar_t* CBC_HighLevelEncoder::MACRO_05_HEADER = L"[)>05"; const wchar_t* CBC_HighLevelEncoder::MACRO_06_HEADER = L"[)>06"; const wchar_t CBC_HighLevelEncoder::MACRO_TRAILER = 0x0004; @@ -184,7 +184,7 @@ int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg, } return C40_ENCODATION; } - FX_WCHAR c = msg.GetAt(startpos + charsProcessed); + wchar_t c = msg.GetAt(startpos + charsProcessed); charsProcessed++; if (isDigit(c)) { charCounts[ASCII_ENCODATION] += 0.5; @@ -271,7 +271,7 @@ int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg, if (intCharCounts[C40_ENCODATION] == intCharCounts[X12_ENCODATION]) { int32_t p = startpos + charsProcessed + 1; while (p < msg.GetLength()) { - FX_WCHAR tc = msg.GetAt(p); + wchar_t tc = msg.GetAt(p); if (isX12TermSep(tc)) { return X12_ENCODATION; } @@ -286,10 +286,10 @@ int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg, } } } -bool CBC_HighLevelEncoder::isDigit(FX_WCHAR ch) { +bool CBC_HighLevelEncoder::isDigit(wchar_t ch) { return ch >= '0' && ch <= '9'; } -bool CBC_HighLevelEncoder::isExtendedASCII(FX_WCHAR ch) { +bool CBC_HighLevelEncoder::isExtendedASCII(wchar_t ch) { return ch >= 128 && ch <= 255; } int32_t CBC_HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideString msg, @@ -298,7 +298,7 @@ int32_t CBC_HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideString msg, int32_t len = msg.GetLength(); int32_t idx = startpos; if (idx < len) { - FX_WCHAR ch = msg.GetAt(idx); + wchar_t ch = msg.GetAt(idx); while (isDigit(ch) && idx < len) { count++; idx++; @@ -309,15 +309,15 @@ int32_t CBC_HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideString msg, } return count; } -void CBC_HighLevelEncoder::illegalCharacter(FX_WCHAR c, int32_t& e) { +void CBC_HighLevelEncoder::illegalCharacter(wchar_t c, int32_t& e) { e = BCExceptionIllegalArgument; } -FX_WCHAR CBC_HighLevelEncoder::randomize253State(FX_WCHAR ch, - int32_t codewordPosition) { +wchar_t CBC_HighLevelEncoder::randomize253State(wchar_t ch, + int32_t codewordPosition) { int32_t pseudoRandom = ((149 * codewordPosition) % 253) + 1; int32_t tempVariable = ch + pseudoRandom; - return tempVariable <= 254 ? (FX_WCHAR)tempVariable - : (FX_WCHAR)(tempVariable - 254); + return tempVariable <= 254 ? (wchar_t)tempVariable + : (wchar_t)(tempVariable - 254); } int32_t CBC_HighLevelEncoder::findMinimums( std::vector<FX_FLOAT>& charCounts, @@ -350,22 +350,22 @@ int32_t CBC_HighLevelEncoder::getMinimumCount( } return minCount; } -bool CBC_HighLevelEncoder::isNativeC40(FX_WCHAR ch) { +bool CBC_HighLevelEncoder::isNativeC40(wchar_t ch) { return (ch == ' ') || (ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z'); } -bool CBC_HighLevelEncoder::isNativeText(FX_WCHAR ch) { +bool CBC_HighLevelEncoder::isNativeText(wchar_t ch) { return (ch == ' ') || (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z'); } -bool CBC_HighLevelEncoder::isNativeX12(FX_WCHAR ch) { +bool CBC_HighLevelEncoder::isNativeX12(wchar_t ch) { return isX12TermSep(ch) || (ch == ' ') || (ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z'); } -bool CBC_HighLevelEncoder::isX12TermSep(FX_WCHAR ch) { +bool CBC_HighLevelEncoder::isX12TermSep(wchar_t ch) { return (ch == '\r') || (ch == '*') || (ch == '>'); } -bool CBC_HighLevelEncoder::isNativeEDIFACT(FX_WCHAR ch) { +bool CBC_HighLevelEncoder::isNativeEDIFACT(wchar_t ch) { return ch >= ' ' && ch <= '^'; } -bool CBC_HighLevelEncoder::isSpecialB256(FX_WCHAR ch) { +bool CBC_HighLevelEncoder::isSpecialB256(wchar_t ch) { return false; } diff --git a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h index 5d72f1074e..cfd16ed676 100644 --- a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h +++ b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h @@ -36,44 +36,44 @@ class CBC_HighLevelEncoder : public CBC_SymbolShapeHint { static int32_t lookAheadTest(CFX_WideString msg, int32_t startpos, int32_t currentMode); - static bool isDigit(FX_WCHAR ch); - static bool isExtendedASCII(FX_WCHAR ch); + static bool isDigit(wchar_t ch); + static bool isExtendedASCII(wchar_t ch); static int32_t determineConsecutiveDigitCount(CFX_WideString msg, int32_t startpos); - static void illegalCharacter(FX_WCHAR c, int32_t& e); + static void illegalCharacter(wchar_t c, int32_t& e); public: - static FX_WCHAR LATCH_TO_C40; - static FX_WCHAR LATCH_TO_BASE256; - static FX_WCHAR UPPER_SHIFT; - static FX_WCHAR LATCH_TO_ANSIX12; - static FX_WCHAR LATCH_TO_TEXT; - static FX_WCHAR LATCH_TO_EDIFACT; - static FX_WCHAR C40_UNLATCH; - static FX_WCHAR X12_UNLATCH; + static wchar_t LATCH_TO_C40; + static wchar_t LATCH_TO_BASE256; + static wchar_t UPPER_SHIFT; + static wchar_t LATCH_TO_ANSIX12; + static wchar_t LATCH_TO_TEXT; + static wchar_t LATCH_TO_EDIFACT; + static wchar_t C40_UNLATCH; + static wchar_t X12_UNLATCH; private: - static FX_WCHAR PAD; - static FX_WCHAR MACRO_05; - static FX_WCHAR MACRO_06; + static wchar_t PAD; + static wchar_t MACRO_05; + static wchar_t MACRO_06; static const wchar_t* MACRO_05_HEADER; static const wchar_t* MACRO_06_HEADER; static const wchar_t MACRO_TRAILER; CFX_ArrayTemplate<uint8_t> m_bytearray; private: - static FX_WCHAR randomize253State(FX_WCHAR ch, int32_t codewordPosition); + static wchar_t randomize253State(wchar_t ch, int32_t codewordPosition); static int32_t findMinimums(std::vector<FX_FLOAT>& charCounts, CFX_ArrayTemplate<int32_t>& intCharCounts, int32_t min, CFX_ArrayTemplate<uint8_t>& mins); static int32_t getMinimumCount(CFX_ArrayTemplate<uint8_t>& mins); - static bool isNativeC40(FX_WCHAR ch); - static bool isNativeText(FX_WCHAR ch); - static bool isNativeX12(FX_WCHAR ch); - static bool isX12TermSep(FX_WCHAR ch); - static bool isNativeEDIFACT(FX_WCHAR ch); - static bool isSpecialB256(FX_WCHAR ch); + static bool isNativeC40(wchar_t ch); + static bool isNativeText(wchar_t ch); + static bool isNativeX12(wchar_t ch); + static bool isX12TermSep(wchar_t ch); + static bool isNativeEDIFACT(wchar_t ch); + static bool isSpecialB256(wchar_t ch); }; #endif // XFA_FXBARCODE_DATAMATRIX_BC_HIGHLEVELENCODER_H_ diff --git a/xfa/fxbarcode/datamatrix/BC_TextEncoder.cpp b/xfa/fxbarcode/datamatrix/BC_TextEncoder.cpp index e3eb4a8c4e..cc02661c26 100644 --- a/xfa/fxbarcode/datamatrix/BC_TextEncoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_TextEncoder.cpp @@ -35,61 +35,59 @@ CBC_TextEncoder::~CBC_TextEncoder() {} int32_t CBC_TextEncoder::getEncodingMode() { return TEXT_ENCODATION; } -int32_t CBC_TextEncoder::encodeChar(FX_WCHAR c, - CFX_WideString& sb, - int32_t& e) { +int32_t CBC_TextEncoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) { if (c == ' ') { - sb += (FX_WCHAR)'\3'; + sb += (wchar_t)'\3'; return 1; } if (c >= '0' && c <= '9') { - sb += (FX_WCHAR)(c - 48 + 4); + sb += (wchar_t)(c - 48 + 4); return 1; } if (c >= 'a' && c <= 'z') { - sb += (FX_WCHAR)(c - 97 + 14); + sb += (wchar_t)(c - 97 + 14); return 1; } if (c <= 0x1f) { - sb += (FX_WCHAR)'\0'; + sb += (wchar_t)'\0'; sb += c; return 2; } if (c >= '!' && c <= '/') { - sb += (FX_WCHAR)'\1'; - sb += (FX_WCHAR)(c - 33); + sb += (wchar_t)'\1'; + sb += (wchar_t)(c - 33); return 2; } if (c >= ':' && c <= '@') { - sb += (FX_WCHAR)'\1'; - sb += (FX_WCHAR)(c - 58 + 15); + sb += (wchar_t)'\1'; + sb += (wchar_t)(c - 58 + 15); return 2; } if (c >= '[' && c <= '_') { - sb += (FX_WCHAR)'\1'; - sb += (FX_WCHAR)(c - 91 + 22); + sb += (wchar_t)'\1'; + sb += (wchar_t)(c - 91 + 22); return 2; } if (c == 0x0060) { - sb += (FX_WCHAR)'\2'; - sb += (FX_WCHAR)(c - 96); + sb += (wchar_t)'\2'; + sb += (wchar_t)(c - 96); return 2; } if (c >= 'A' && c <= 'Z') { - sb += (FX_WCHAR)'\2'; - sb += (FX_WCHAR)(c - 65 + 1); + sb += (wchar_t)'\2'; + sb += (wchar_t)(c - 65 + 1); return 2; } if (c >= '{' && c <= 0x007f) { - sb += (FX_WCHAR)'\2'; - sb += (FX_WCHAR)(c - 123 + 27); + sb += (wchar_t)'\2'; + sb += (wchar_t)(c - 123 + 27); return 2; } if (c >= 0x0080) { - sb += (FX_WCHAR)'\1'; - sb += (FX_WCHAR)0x001e; + sb += (wchar_t)'\1'; + sb += (wchar_t)0x001e; int32_t len = 2; - len += encodeChar((FX_WCHAR)(c - 128), sb, e); + len += encodeChar((wchar_t)(c - 128), sb, e); if (e != BCExceptionNO) return -1; return len; diff --git a/xfa/fxbarcode/datamatrix/BC_TextEncoder.h b/xfa/fxbarcode/datamatrix/BC_TextEncoder.h index e6013b9508..71092023da 100644 --- a/xfa/fxbarcode/datamatrix/BC_TextEncoder.h +++ b/xfa/fxbarcode/datamatrix/BC_TextEncoder.h @@ -16,7 +16,7 @@ class CBC_TextEncoder : public CBC_C40Encoder { // CBC_C40Encoder int32_t getEncodingMode() override; - int32_t encodeChar(FX_WCHAR c, CFX_WideString& sb, int32_t& e) override; + int32_t encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) override; }; #endif // XFA_FXBARCODE_DATAMATRIX_BC_TEXTENCODER_H_ diff --git a/xfa/fxbarcode/datamatrix/BC_X12Encoder.cpp b/xfa/fxbarcode/datamatrix/BC_X12Encoder.cpp index d77af9318a..570076b348 100644 --- a/xfa/fxbarcode/datamatrix/BC_X12Encoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_X12Encoder.cpp @@ -38,7 +38,7 @@ int32_t CBC_X12Encoder::getEncodingMode() { void CBC_X12Encoder::Encode(CBC_EncoderContext& context, int32_t& e) { CFX_WideString buffer; while (context.hasMoreCharacters()) { - FX_WCHAR c = context.getCurrentChar(); + wchar_t c = context.getCurrentChar(); context.m_pos++; encodeChar(c, buffer, e); if (e != BCExceptionNO) { @@ -79,19 +79,19 @@ void CBC_X12Encoder::handleEOD(CBC_EncoderContext& context, context.signalEncoderChange(ASCII_ENCODATION); } } -int32_t CBC_X12Encoder::encodeChar(FX_WCHAR c, CFX_WideString& sb, int32_t& e) { +int32_t CBC_X12Encoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) { if (c == '\r') { - sb += (FX_WCHAR)'\0'; + sb += (wchar_t)'\0'; } else if (c == '*') { - sb += (FX_WCHAR)'\1'; + sb += (wchar_t)'\1'; } else if (c == '>') { - sb += (FX_WCHAR)'\2'; + sb += (wchar_t)'\2'; } else if (c == ' ') { - sb += (FX_WCHAR)'\3'; + sb += (wchar_t)'\3'; } else if (c >= '0' && c <= '9') { - sb += (FX_WCHAR)(c - 48 + 4); + sb += (wchar_t)(c - 48 + 4); } else if (c >= 'A' && c <= 'Z') { - sb += (FX_WCHAR)(c - 65 + 14); + sb += (wchar_t)(c - 65 + 14); } else { CBC_HighLevelEncoder::illegalCharacter(c, e); if (e != BCExceptionNO) diff --git a/xfa/fxbarcode/datamatrix/BC_X12Encoder.h b/xfa/fxbarcode/datamatrix/BC_X12Encoder.h index 52239ce529..693b9bba6c 100644 --- a/xfa/fxbarcode/datamatrix/BC_X12Encoder.h +++ b/xfa/fxbarcode/datamatrix/BC_X12Encoder.h @@ -20,7 +20,7 @@ class CBC_X12Encoder : public CBC_C40Encoder { void handleEOD(CBC_EncoderContext& context, CFX_WideString& buffer, int32_t& e) override; - int32_t encodeChar(FX_WCHAR c, CFX_WideString& sb, int32_t& e) override; + int32_t encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) override; }; #endif // XFA_FXBARCODE_DATAMATRIX_BC_X12ENCODER_H_ diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp index bc0d61fd25..dd7fcaa864 100644 --- a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp @@ -83,7 +83,7 @@ void CBC_OneDimWriter::SetFontColor(FX_ARGB color) { m_fontColor = color; } -FX_WCHAR CBC_OneDimWriter::Upper(FX_WCHAR ch) { +wchar_t CBC_OneDimWriter::Upper(wchar_t ch) { if (ch >= 'a' && ch <= 'z') { ch = ch - ('a' - 'A'); } diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.h b/xfa/fxbarcode/oned/BC_OneDimWriter.h index e37d774341..b7c5cebe06 100644 --- a/xfa/fxbarcode/oned/BC_OneDimWriter.h +++ b/xfa/fxbarcode/oned/BC_OneDimWriter.h @@ -96,7 +96,7 @@ class CBC_OneDimWriter : public CBC_Writer { int32_t startColor, int32_t& e); - FX_WCHAR Upper(FX_WCHAR ch); + wchar_t Upper(wchar_t ch); bool m_bPrintChecksum; int32_t m_iDataLenth; diff --git a/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp index 399e5e7d40..7d51fa8f94 100644 --- a/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp @@ -28,17 +28,17 @@ namespace { -const FX_CHAR ALPHABET_STRING[] = "0123456789-$:/.+ABCDTN"; +const char ALPHABET_STRING[] = "0123456789-$:/.+ABCDTN"; const int32_t CHARACTER_ENCODINGS[22] = { 0x003, 0x006, 0x009, 0x060, 0x012, 0x042, 0x021, 0x024, 0x030, 0x048, 0x00c, 0x018, 0x045, 0x051, 0x054, 0x015, 0x01A, 0x029, 0x00B, 0x00E, 0x01A, 0x029}; -const FX_CHAR START_END_CHARS[] = {'A', 'B', 'C', 'D', 'T', 'N', '*', 'E', - 'a', 'b', 'c', 'd', 't', 'n', 'e'}; -const FX_CHAR CONTENT_CHARS[] = {'0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', '-', '$', '/', ':', '+', '.'}; +const char START_END_CHARS[] = {'A', 'B', 'C', 'D', 'T', 'N', '*', 'E', + 'a', 'b', 'c', 'd', 't', 'n', 'e'}; +const char CONTENT_CHARS[] = {'0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', '-', '$', '/', ':', '+', '.'}; } // namespace @@ -48,7 +48,7 @@ CBC_OnedCodaBarWriter::CBC_OnedCodaBarWriter() { m_iWideNarrRatio = 2; } CBC_OnedCodaBarWriter::~CBC_OnedCodaBarWriter() {} -bool CBC_OnedCodaBarWriter::SetStartChar(FX_CHAR start) { +bool CBC_OnedCodaBarWriter::SetStartChar(char start) { for (size_t i = 0; i < FX_ArraySize(START_END_CHARS); ++i) { if (START_END_CHARS[i] == start) { m_chStart = start; @@ -58,7 +58,7 @@ bool CBC_OnedCodaBarWriter::SetStartChar(FX_CHAR start) { return false; } -bool CBC_OnedCodaBarWriter::SetEndChar(FX_CHAR end) { +bool CBC_OnedCodaBarWriter::SetEndChar(char end) { for (size_t i = 0; i < FX_ArraySize(START_END_CHARS); ++i) { if (START_END_CHARS[i] == end) { m_chEnd = end; @@ -84,22 +84,22 @@ bool CBC_OnedCodaBarWriter::SetWideNarrowRatio(int32_t ratio) { m_iWideNarrRatio = ratio; return true; } -bool CBC_OnedCodaBarWriter::FindChar(FX_WCHAR ch, bool isContent) { +bool CBC_OnedCodaBarWriter::FindChar(wchar_t ch, bool isContent) { if (isContent) { for (size_t i = 0; i < FX_ArraySize(CONTENT_CHARS); ++i) { - if (ch == (FX_WCHAR)CONTENT_CHARS[i]) { + if (ch == (wchar_t)CONTENT_CHARS[i]) { return true; } } for (size_t j = 0; j < FX_ArraySize(START_END_CHARS); ++j) { - if (ch == (FX_WCHAR)START_END_CHARS[j]) { + if (ch == (wchar_t)START_END_CHARS[j]) { return true; } } return false; } else { for (size_t i = 0; i < FX_ArraySize(CONTENT_CHARS); ++i) { - if (ch == (FX_WCHAR)CONTENT_CHARS[i]) { + if (ch == (wchar_t)CONTENT_CHARS[i]) { return true; } } @@ -108,7 +108,7 @@ bool CBC_OnedCodaBarWriter::FindChar(FX_WCHAR ch, bool isContent) { } bool CBC_OnedCodaBarWriter::CheckContentValidity( const CFX_WideStringC& contents) { - FX_WCHAR ch; + wchar_t ch; int32_t index = 0; for (index = 0; index < contents.GetLength(); index++) { ch = contents.GetAt(index); @@ -123,7 +123,7 @@ bool CBC_OnedCodaBarWriter::CheckContentValidity( CFX_WideString CBC_OnedCodaBarWriter::FilterContents( const CFX_WideStringC& contents) { CFX_WideString filtercontents; - FX_WCHAR ch; + wchar_t ch; for (int32_t index = 0; index < contents.GetLength(); index++) { ch = contents.GetAt(index); if (ch > 175) { @@ -170,7 +170,7 @@ uint8_t* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString& contents, CFX_ByteString data = m_chStart + contents + m_chEnd; m_iContentLen = data.GetLength(); uint8_t* result = FX_Alloc2D(uint8_t, m_iWideNarrRatio * 7, data.GetLength()); - FX_CHAR ch; + char ch; int32_t position = 0; for (int32_t index = 0; index < data.GetLength(); index++) { ch = data.GetAt(index); diff --git a/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.h b/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.h index 301c34a751..0d01ad9242 100644 --- a/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.h +++ b/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.h @@ -37,11 +37,11 @@ class CBC_OnedCodaBarWriter : public CBC_OneDimWriter { void SetDataLength(int32_t length) override; virtual CFX_WideString encodedContents(const CFX_WideStringC& contents); - virtual bool SetStartChar(FX_CHAR start); - virtual bool SetEndChar(FX_CHAR end); + virtual bool SetStartChar(char start); + virtual bool SetEndChar(char end); virtual bool SetTextLocation(BC_TEXT_LOC location); virtual bool SetWideNarrowRatio(int32_t ratio); - virtual bool FindChar(FX_WCHAR ch, bool isContent); + virtual bool FindChar(wchar_t ch, bool isContent); private: void RenderResult(const CFX_WideStringC& contents, @@ -50,8 +50,8 @@ class CBC_OnedCodaBarWriter : public CBC_OneDimWriter { bool isDevice, int32_t& e) override; - FX_CHAR m_chStart; - FX_CHAR m_chEnd; + char m_chStart; + char m_chEnd; int32_t m_iWideNarrRatio; }; diff --git a/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp b/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp index f163b18663..c1e28a50c1 100644 --- a/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp @@ -102,7 +102,7 @@ bool CBC_OnedCode128Writer::CheckContentValidity( CFX_WideString CBC_OnedCode128Writer::FilterContents( const CFX_WideStringC& contents) { CFX_WideString filterChineseChar; - FX_WCHAR ch; + wchar_t ch; for (int32_t i = 0; i < contents.GetLength(); i++) { ch = contents.GetAt(i); if (ch > 175) { @@ -253,7 +253,7 @@ int32_t CBC_OnedCode128Writer::Encode128C( checkSum += CODE_START_C * checkWeight; while (position < contents.GetLength()) { int32_t patternIndex = 0; - FX_CHAR ch = contents.GetAt(position); + char ch = contents.GetAt(position); if (ch < '0' || ch > '9') { patternIndex = (int32_t)ch; position++; diff --git a/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp b/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp index a1ba5c8086..bd0607d3cd 100644 --- a/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp @@ -27,10 +27,9 @@ namespace { -const FX_CHAR ALPHABET_STRING[] = - "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%"; +const char ALPHABET_STRING[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%"; -const FX_CHAR CHECKSUM_STRING[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"; +const char CHECKSUM_STRING[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"; const int32_t CHARACTER_ENCODINGS[44] = { 0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124, @@ -48,12 +47,12 @@ CBC_OnedCode39Writer::~CBC_OnedCode39Writer() {} bool CBC_OnedCode39Writer::CheckContentValidity( const CFX_WideStringC& contents) { for (int32_t i = 0; i < contents.GetLength(); i++) { - FX_WCHAR ch = contents.GetAt(i); - if ((ch >= (FX_WCHAR)'0' && ch <= (FX_WCHAR)'9') || - (ch >= (FX_WCHAR)'A' && ch <= (FX_WCHAR)'Z') || ch == (FX_WCHAR)'-' || - ch == (FX_WCHAR)'.' || ch == (FX_WCHAR)' ' || ch == (FX_WCHAR)'*' || - ch == (FX_WCHAR)'$' || ch == (FX_WCHAR)'/' || ch == (FX_WCHAR)'+' || - ch == (FX_WCHAR)'%') { + wchar_t ch = contents.GetAt(i); + if ((ch >= (wchar_t)'0' && ch <= (wchar_t)'9') || + (ch >= (wchar_t)'A' && ch <= (wchar_t)'Z') || ch == (wchar_t)'-' || + ch == (wchar_t)'.' || ch == (wchar_t)' ' || ch == (wchar_t)'*' || + ch == (wchar_t)'$' || ch == (wchar_t)'/' || ch == (wchar_t)'+' || + ch == (wchar_t)'%') { continue; } return false; @@ -65,8 +64,8 @@ CFX_WideString CBC_OnedCode39Writer::FilterContents( const CFX_WideStringC& contents) { CFX_WideString filtercontents; for (int32_t i = 0; i < contents.GetLength(); i++) { - FX_WCHAR ch = contents.GetAt(i); - if (ch == (FX_WCHAR)'*' && (i == 0 || i == contents.GetLength() - 1)) { + wchar_t ch = contents.GetAt(i); + if (ch == (wchar_t)'*' && (i == 0 || i == contents.GetLength() - 1)) { continue; } if (ch > 175) { @@ -75,11 +74,11 @@ CFX_WideString CBC_OnedCode39Writer::FilterContents( } else { ch = Upper(ch); } - if ((ch >= (FX_WCHAR)'0' && ch <= (FX_WCHAR)'9') || - (ch >= (FX_WCHAR)'A' && ch <= (FX_WCHAR)'Z') || ch == (FX_WCHAR)'-' || - ch == (FX_WCHAR)'.' || ch == (FX_WCHAR)' ' || ch == (FX_WCHAR)'*' || - ch == (FX_WCHAR)'$' || ch == (FX_WCHAR)'/' || ch == (FX_WCHAR)'+' || - ch == (FX_WCHAR)'%') { + if ((ch >= (wchar_t)'0' && ch <= (wchar_t)'9') || + (ch >= (wchar_t)'A' && ch <= (wchar_t)'Z') || ch == (wchar_t)'-' || + ch == (wchar_t)'.' || ch == (wchar_t)' ' || ch == (wchar_t)'*' || + ch == (wchar_t)'$' || ch == (wchar_t)'/' || ch == (wchar_t)'+' || + ch == (wchar_t)'%') { filtercontents += ch; } } @@ -90,20 +89,20 @@ CFX_WideString CBC_OnedCode39Writer::RenderTextContents( const CFX_WideStringC& contents) { CFX_WideString renderContents; for (int32_t i = 0; i < contents.GetLength(); i++) { - FX_WCHAR ch = contents.GetAt(i); - if (ch == (FX_WCHAR)'*' && (i == 0 || i == contents.GetLength() - 1)) { + wchar_t ch = contents.GetAt(i); + if (ch == (wchar_t)'*' && (i == 0 || i == contents.GetLength() - 1)) { continue; } if (ch > 175) { i++; continue; } - if ((ch >= (FX_WCHAR)'0' && ch <= (FX_WCHAR)'9') || - (ch >= (FX_WCHAR)'A' && ch <= (FX_WCHAR)'Z') || - (ch >= (FX_WCHAR)'a' && ch <= (FX_WCHAR)'z') || ch == (FX_WCHAR)'-' || - ch == (FX_WCHAR)'.' || ch == (FX_WCHAR)' ' || ch == (FX_WCHAR)'*' || - ch == (FX_WCHAR)'$' || ch == (FX_WCHAR)'/' || ch == (FX_WCHAR)'+' || - ch == (FX_WCHAR)'%') { + if ((ch >= (wchar_t)'0' && ch <= (wchar_t)'9') || + (ch >= (wchar_t)'A' && ch <= (wchar_t)'Z') || + (ch >= (wchar_t)'a' && ch <= (wchar_t)'z') || ch == (wchar_t)'-' || + ch == (wchar_t)'.' || ch == (wchar_t)' ' || ch == (wchar_t)'*' || + ch == (wchar_t)'$' || ch == (wchar_t)'/' || ch == (wchar_t)'+' || + ch == (wchar_t)'%') { renderContents += ch; } } @@ -155,8 +154,8 @@ void CBC_OnedCode39Writer::ToIntArray(int32_t a, int32_t* toReturn) { toReturn[i] = (a & (1 << i)) == 0 ? 1 : m_iWideNarrRatio; } } -FX_CHAR CBC_OnedCode39Writer::CalcCheckSum(const CFX_ByteString& contents, - int32_t& e) { +char CBC_OnedCode39Writer::CalcCheckSum(const CFX_ByteString& contents, + int32_t& e) { int32_t length = contents.GetLength(); if (length > 80) { e = BCExceptionContentsLengthShouldBetween1and80; @@ -187,7 +186,7 @@ FX_CHAR CBC_OnedCode39Writer::CalcCheckSum(const CFX_ByteString& contents, uint8_t* CBC_OnedCode39Writer::Encode(const CFX_ByteString& contents, int32_t& outlength, int32_t& e) { - FX_CHAR checksum = CalcCheckSum(contents, e); + char checksum = CalcCheckSum(contents, e); if (checksum == '*') { return nullptr; } @@ -263,7 +262,7 @@ CFX_WideString CBC_OnedCode39Writer::encodedContents( if (m_bCalcChecksum && m_bPrintChecksum) { CFX_WideString checksumContent = FilterContents(contents); CFX_ByteString str = checksumContent.UTF8Encode(); - FX_CHAR checksum; + char checksum; checksum = CalcCheckSum(str, e); if (e != BCExceptionNO) return CFX_WideString(); diff --git a/xfa/fxbarcode/oned/BC_OnedCode39Writer.h b/xfa/fxbarcode/oned/BC_OnedCode39Writer.h index c8755a3e69..5f7c294c2b 100644 --- a/xfa/fxbarcode/oned/BC_OnedCode39Writer.h +++ b/xfa/fxbarcode/oned/BC_OnedCode39Writer.h @@ -46,7 +46,7 @@ class CBC_OnedCode39Writer : public CBC_OneDimWriter { private: void ToIntArray(int32_t a, int32_t* toReturn); - FX_CHAR CalcCheckSum(const CFX_ByteString& contents, int32_t& e); + char CalcCheckSum(const CFX_ByteString& contents, int32_t& e); int32_t m_iWideNarrRatio; }; diff --git a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp index bcbc80a61d..47e47eaddb 100644 --- a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp @@ -62,7 +62,7 @@ bool CBC_OnedEAN13Writer::CheckContentValidity( CFX_WideString CBC_OnedEAN13Writer::FilterContents( const CFX_WideStringC& contents) { CFX_WideString filtercontents; - FX_WCHAR ch; + wchar_t ch; for (int32_t i = 0; i < contents.GetLength(); i++) { ch = contents.GetAt(i); if (ch > 175) { diff --git a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp index c40223818f..cd21759a19 100644 --- a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp @@ -65,7 +65,7 @@ bool CBC_OnedEAN8Writer::CheckContentValidity(const CFX_WideStringC& contents) { CFX_WideString CBC_OnedEAN8Writer::FilterContents( const CFX_WideStringC& contents) { CFX_WideString filtercontents; - FX_WCHAR ch; + wchar_t ch; for (int32_t i = 0; i < contents.GetLength(); i++) { ch = contents.GetAt(i); if (ch > 175) { diff --git a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp index 6d6e79637c..3cb72f204a 100644 --- a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp @@ -50,7 +50,7 @@ bool CBC_OnedUPCAWriter::CheckContentValidity(const CFX_WideStringC& contents) { CFX_WideString CBC_OnedUPCAWriter::FilterContents( const CFX_WideStringC& contents) { CFX_WideString filtercontents; - FX_WCHAR ch; + wchar_t ch; for (int32_t i = 0; i < contents.GetLength(); i++) { ch = contents.GetAt(i); if (ch > 175) { diff --git a/xfa/fxbarcode/pdf417/BC_PDF417.cpp b/xfa/fxbarcode/pdf417/BC_PDF417.cpp index 2f01564b11..94c65b8538 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417.cpp +++ b/xfa/fxbarcode/pdf417/BC_PDF417.cpp @@ -427,10 +427,10 @@ void CBC_PDF417::generateBarcodeLogic(CFX_WideString msg, } int32_t n = sourceCodeWords + pad + 1; CFX_WideString sb; - sb += (FX_WCHAR)n; + sb += (wchar_t)n; sb += highLevel; for (int32_t i = 0; i < pad; i++) { - sb += (FX_WCHAR)900; + sb += (wchar_t)900; } CFX_WideString dataCodewords(sb); CFX_WideString ec = CBC_PDF417ErrorCorrection::generateErrorCorrection( diff --git a/xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp b/xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp index bdec403970..71cdc351db 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp +++ b/xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp @@ -163,8 +163,8 @@ CFX_WideString CBC_PDF417ErrorCorrection::generateErrorCorrection( int32_t k = getErrorCorrectionCodewordCount(errorCorrectionLevel, e); if (e != BCExceptionNO) return L" "; - FX_WCHAR* ech = FX_Alloc(FX_WCHAR, k); - FXSYS_memset(ech, 0, k * sizeof(FX_WCHAR)); + wchar_t* ech = FX_Alloc(wchar_t, k); + FXSYS_memset(ech, 0, k * sizeof(wchar_t)); int32_t sld = dataCodewords.GetLength(); for (int32_t i = 0; i < sld; i++) { int32_t t1 = (dataCodewords.GetAt(i) + ech[k - 1]) % 929; @@ -173,18 +173,18 @@ CFX_WideString CBC_PDF417ErrorCorrection::generateErrorCorrection( for (int32_t j = k - 1; j >= 1; j--) { t2 = (t1 * EC_COEFFICIENTS[errorCorrectionLevel][j]) % 929; t3 = 929 - t2; - ech[j] = (FX_WCHAR)((ech[j - 1] + t3) % 929); + ech[j] = (wchar_t)((ech[j - 1] + t3) % 929); } t2 = (t1 * EC_COEFFICIENTS[errorCorrectionLevel][0]) % 929; t3 = 929 - t2; - ech[0] = (FX_WCHAR)(t3 % 929); + ech[0] = (wchar_t)(t3 % 929); } CFX_WideString sb; for (int32_t j = k - 1; j >= 0; j--) { if (ech[j] != 0) { - ech[j] = (FX_WCHAR)(929 - ech[j]); + ech[j] = (wchar_t)(929 - ech[j]); } - sb += (FX_WCHAR)ech[j]; + sb += (wchar_t)ech[j]; } FX_Free(ech); return sb; diff --git a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp index 08a40c51b3..0d9c7cfbd0 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp +++ b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp @@ -64,7 +64,7 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel( CFX_WideString msg; int32_t len = bytes.GetLength(); for (int32_t i = 0; i < len; i++) { - FX_WCHAR ch = (FX_WCHAR)(bytes.GetAt(i) & 0xff); + wchar_t ch = (wchar_t)(bytes.GetAt(i) & 0xff); if (ch == '?' && bytes.GetAt(i) != '?') { e = BCExceptionCharactersOutsideISO88591Encoding; return CFX_WideString(); @@ -84,14 +84,14 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel( } else if (compaction == BYTES) { encodeBinary(&byteArr, p, byteArr.GetSize(), BYTE_COMPACTION, sb); } else if (compaction == NUMERIC) { - sb += (FX_WCHAR)LATCH_TO_NUMERIC; + sb += (wchar_t)LATCH_TO_NUMERIC; encodeNumeric(msg, p, len, sb); } else { int32_t encodingMode = LATCH_TO_TEXT; while (p < len) { int32_t n = determineConsecutiveDigitCount(msg, p); if (n >= 13) { - sb += (FX_WCHAR)LATCH_TO_NUMERIC; + sb += (wchar_t)LATCH_TO_NUMERIC; encodingMode = NUMERIC_COMPACTION; textSubMode = SUBMODE_ALPHA; encodeNumeric(msg, p, n, sb); @@ -100,7 +100,7 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel( int32_t t = determineConsecutiveTextCount(msg, p); if (t >= 5 || n == len) { if (encodingMode != TEXT_COMPACTION) { - sb += (FX_WCHAR)LATCH_TO_TEXT; + sb += (wchar_t)LATCH_TO_TEXT; encodingMode = TEXT_COMPACTION; textSubMode = SUBMODE_ALPHA; } @@ -157,26 +157,26 @@ int32_t CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, int32_t submode = initialSubmode; int32_t idx = 0; while (true) { - FX_WCHAR ch = msg.GetAt(startpos + idx); + wchar_t ch = msg.GetAt(startpos + idx); switch (submode) { case SUBMODE_ALPHA: if (isAlphaUpper(ch)) { if (ch == ' ') { - tmp += (FX_WCHAR)26; + tmp += (wchar_t)26; } else { - tmp += (FX_WCHAR)(ch - 65); + tmp += (wchar_t)(ch - 65); } } else { if (isAlphaLower(ch)) { submode = SUBMODE_LOWER; - tmp += (FX_WCHAR)27; + tmp += (wchar_t)27; continue; } else if (isMixed(ch)) { submode = SUBMODE_MIXED; - tmp += (FX_WCHAR)28; + tmp += (wchar_t)28; continue; } else { - tmp += (FX_WCHAR)29; + tmp += (wchar_t)29; tmp += PUNCTUATION[ch]; break; } @@ -185,21 +185,21 @@ int32_t CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, case SUBMODE_LOWER: if (isAlphaLower(ch)) { if (ch == ' ') { - tmp += (FX_WCHAR)26; + tmp += (wchar_t)26; } else { - tmp += (FX_WCHAR)(ch - 97); + tmp += (wchar_t)(ch - 97); } } else { if (isAlphaUpper(ch)) { - tmp += (FX_WCHAR)27; - tmp += (FX_WCHAR)(ch - 65); + tmp += (wchar_t)27; + tmp += (wchar_t)(ch - 65); break; } else if (isMixed(ch)) { submode = SUBMODE_MIXED; - tmp += (FX_WCHAR)28; + tmp += (wchar_t)28; continue; } else { - tmp += (FX_WCHAR)29; + tmp += (wchar_t)29; tmp += PUNCTUATION[ch]; break; } @@ -211,22 +211,22 @@ int32_t CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, } else { if (isAlphaUpper(ch)) { submode = SUBMODE_ALPHA; - tmp += (FX_WCHAR)28; + tmp += (wchar_t)28; continue; } else if (isAlphaLower(ch)) { submode = SUBMODE_LOWER; - tmp += (FX_WCHAR)27; + tmp += (wchar_t)27; continue; } else { if (startpos + idx + 1 < count) { - FX_WCHAR next = msg.GetAt(startpos + idx + 1); + wchar_t next = msg.GetAt(startpos + idx + 1); if (isPunctuation(next)) { submode = SUBMODE_PUNCTUATION; - tmp += (FX_WCHAR)25; + tmp += (wchar_t)25; continue; } } - tmp += (FX_WCHAR)29; + tmp += (wchar_t)29; tmp += PUNCTUATION[ch]; } } @@ -236,7 +236,7 @@ int32_t CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, tmp += PUNCTUATION[ch]; } else { submode = SUBMODE_ALPHA; - tmp += (FX_WCHAR)29; + tmp += (wchar_t)29; continue; } } @@ -245,19 +245,19 @@ int32_t CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, break; } } - FX_WCHAR h = 0; + wchar_t h = 0; int32_t len = tmp.GetLength(); for (int32_t i = 0; i < len; i++) { bool odd = (i % 2) != 0; if (odd) { - h = (FX_WCHAR)((h * 30) + tmp.GetAt(i)); + h = (wchar_t)((h * 30) + tmp.GetAt(i)); sb += h; } else { h = tmp.GetAt(i); } } if ((len % 2) != 0) { - sb += (FX_WCHAR)((h * 30) + 29); + sb += (wchar_t)((h * 30) + 29); } return submode; } @@ -267,13 +267,13 @@ void CBC_PDF417HighLevelEncoder::encodeBinary(CFX_ArrayTemplate<uint8_t>* bytes, int32_t startmode, CFX_WideString& sb) { if (count == 1 && startmode == TEXT_COMPACTION) { - sb += (FX_WCHAR)SHIFT_TO_BYTE; + sb += (wchar_t)SHIFT_TO_BYTE; } int32_t idx = startpos; int32_t i = 0; if (count >= 6) { - sb += (FX_WCHAR)LATCH_TO_BYTE; - FX_WCHAR chars[5]; + sb += (wchar_t)LATCH_TO_BYTE; + wchar_t chars[5]; while ((startpos + count - idx) >= 6) { int64_t t = 0; for (i = 0; i < 6; i++) { @@ -281,7 +281,7 @@ void CBC_PDF417HighLevelEncoder::encodeBinary(CFX_ArrayTemplate<uint8_t>* bytes, t += bytes->GetAt(idx + i) & 0xff; } for (i = 0; i < 5; i++) { - chars[i] = (FX_WCHAR)(t % 900); + chars[i] = (wchar_t)(t % 900); t /= 900; } for (i = 4; i >= 0; i--) { @@ -291,11 +291,11 @@ void CBC_PDF417HighLevelEncoder::encodeBinary(CFX_ArrayTemplate<uint8_t>* bytes, } } if (idx < startpos + count) { - sb += (FX_WCHAR)LATCH_TO_BYTE_PADDED; + sb += (wchar_t)LATCH_TO_BYTE_PADDED; } for (i = idx; i < startpos + count; i++) { int32_t ch = bytes->GetAt(i) & 0xff; - sb += (FX_WCHAR)ch; + sb += (wchar_t)ch; } } void CBC_PDF417HighLevelEncoder::encodeNumeric(CFX_WideString msg, @@ -308,11 +308,11 @@ void CBC_PDF417HighLevelEncoder::encodeNumeric(CFX_WideString msg, CFX_WideString tmp; int32_t len = 44 < count - idx ? 44 : count - idx; CFX_ByteString part = - ((FX_WCHAR)'1' + msg.Mid(startpos + idx, len)).UTF8Encode(); + ((wchar_t)'1' + msg.Mid(startpos + idx, len)).UTF8Encode(); BigInteger bigint = stringToBigInteger(part.c_str()); do { int32_t c = (bigint % num900).toInt(); - tmp += (FX_WCHAR)(c); + tmp += (wchar_t)(c); bigint = bigint / num900; } while (!bigint.isZero()); for (int32_t i = tmp.GetLength() - 1; i >= 0; i--) { @@ -321,22 +321,22 @@ void CBC_PDF417HighLevelEncoder::encodeNumeric(CFX_WideString msg, idx += len; } } -bool CBC_PDF417HighLevelEncoder::isDigit(FX_WCHAR ch) { +bool CBC_PDF417HighLevelEncoder::isDigit(wchar_t ch) { return ch >= '0' && ch <= '9'; } -bool CBC_PDF417HighLevelEncoder::isAlphaUpper(FX_WCHAR ch) { +bool CBC_PDF417HighLevelEncoder::isAlphaUpper(wchar_t ch) { return ch == ' ' || (ch >= 'A' && ch <= 'Z'); } -bool CBC_PDF417HighLevelEncoder::isAlphaLower(FX_WCHAR ch) { +bool CBC_PDF417HighLevelEncoder::isAlphaLower(wchar_t ch) { return ch == ' ' || (ch >= 'a' && ch <= 'z'); } -bool CBC_PDF417HighLevelEncoder::isMixed(FX_WCHAR ch) { +bool CBC_PDF417HighLevelEncoder::isMixed(wchar_t ch) { return MIXED[ch] != -1; } -bool CBC_PDF417HighLevelEncoder::isPunctuation(FX_WCHAR ch) { +bool CBC_PDF417HighLevelEncoder::isPunctuation(wchar_t ch) { return PUNCTUATION[ch] != -1; } -bool CBC_PDF417HighLevelEncoder::isText(FX_WCHAR ch) { +bool CBC_PDF417HighLevelEncoder::isText(wchar_t ch) { return ch == '\t' || ch == '\n' || ch == '\r' || (ch >= 32 && ch <= 126); } int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount( @@ -346,7 +346,7 @@ int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount( int32_t len = msg.GetLength(); int32_t idx = startpos; if (idx < len) { - FX_WCHAR ch = msg.GetAt(idx); + wchar_t ch = msg.GetAt(idx); while (isDigit(ch) && idx < len) { count++; idx++; @@ -363,7 +363,7 @@ int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount( int32_t len = msg.GetLength(); int32_t idx = startpos; while (idx < len) { - FX_WCHAR ch = msg.GetAt(idx); + wchar_t ch = msg.GetAt(idx); int32_t numericCount = 0; while (numericCount < 13 && isDigit(ch) && idx < len) { numericCount++; @@ -394,7 +394,7 @@ int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveBinaryCount( int32_t len = msg.GetLength(); int32_t idx = startpos; while (idx < len) { - FX_WCHAR ch = msg.GetAt(idx); + wchar_t ch = msg.GetAt(idx); int32_t numericCount = 0; while (numericCount < 13 && isDigit(ch)) { numericCount++; diff --git a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h index 38382c891c..01c2be02f8 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h +++ b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h @@ -48,12 +48,12 @@ class CBC_PDF417HighLevelEncoder { int32_t startpos, int32_t count, CFX_WideString& sb); - static bool isDigit(FX_WCHAR ch); - static bool isAlphaUpper(FX_WCHAR ch); - static bool isAlphaLower(FX_WCHAR ch); - static bool isMixed(FX_WCHAR ch); - static bool isPunctuation(FX_WCHAR ch); - static bool isText(FX_WCHAR ch); + static bool isDigit(wchar_t ch); + static bool isAlphaUpper(wchar_t ch); + static bool isAlphaLower(wchar_t ch); + static bool isMixed(wchar_t ch); + static bool isPunctuation(wchar_t ch); + static bool isText(wchar_t ch); static int32_t determineConsecutiveDigitCount(CFX_WideString msg, int32_t startpos); static int32_t determineConsecutiveTextCount(CFX_WideString msg, diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp index a5450cf085..2990d980fc 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp @@ -30,7 +30,7 @@ CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::H = nullptr; CBC_QRCoderErrorCorrectionLevel::CBC_QRCoderErrorCorrectionLevel( int32_t ordinal, int32_t bits, - const FX_CHAR* name) + const char* name) : m_ordinal(ordinal), m_bits(bits), m_name(name) {} CBC_QRCoderErrorCorrectionLevel::~CBC_QRCoderErrorCorrectionLevel() {} diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h b/xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h index e433ee1127..2f0d22eb29 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h +++ b/xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h @@ -30,7 +30,7 @@ class CBC_QRCoderErrorCorrectionLevel { private: CBC_QRCoderErrorCorrectionLevel(int32_t ordinal, int32_t bits, - const FX_CHAR* name); + const char* name); CBC_QRCoderErrorCorrectionLevel(); int32_t m_ordinal; diff --git a/xfa/fxbarcode/utils.h b/xfa/fxbarcode/utils.h index 1cb8d85013..21ef3830ef 100644 --- a/xfa/fxbarcode/utils.h +++ b/xfa/fxbarcode/utils.h @@ -13,8 +13,8 @@ bool BC_FX_ByteString_Replace(CFX_ByteString& dst, uint32_t first, uint32_t last, int32_t count, - FX_CHAR c); -void BC_FX_ByteString_Append(CFX_ByteString& dst, int32_t count, FX_CHAR c); + char c); +void BC_FX_ByteString_Append(CFX_ByteString& dst, int32_t count, char c); void BC_FX_ByteString_Append(CFX_ByteString& dst, const CFX_ArrayTemplate<uint8_t>& ba); diff --git a/xfa/fxfa/app/cxfa_linkuserdata.cpp b/xfa/fxfa/app/cxfa_linkuserdata.cpp index 4128cd8822..d657b28539 100644 --- a/xfa/fxfa/app/cxfa_linkuserdata.cpp +++ b/xfa/fxfa/app/cxfa_linkuserdata.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/app/cxfa_linkuserdata.h" -CXFA_LinkUserData::CXFA_LinkUserData(FX_WCHAR* pszText) +CXFA_LinkUserData::CXFA_LinkUserData(wchar_t* pszText) : m_wsURLContent(pszText) {} CXFA_LinkUserData::~CXFA_LinkUserData() {} diff --git a/xfa/fxfa/app/cxfa_linkuserdata.h b/xfa/fxfa/app/cxfa_linkuserdata.h index 852b467648..5f4675962d 100644 --- a/xfa/fxfa/app/cxfa_linkuserdata.h +++ b/xfa/fxfa/app/cxfa_linkuserdata.h @@ -17,10 +17,10 @@ class CXFA_LinkUserData : public CFX_Retainable { template <typename T, typename... Args> friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args); - const FX_WCHAR* GetLinkURL() const { return m_wsURLContent.c_str(); } + const wchar_t* GetLinkURL() const { return m_wsURLContent.c_str(); } protected: - explicit CXFA_LinkUserData(FX_WCHAR* pszText); + explicit CXFA_LinkUserData(wchar_t* pszText); ~CXFA_LinkUserData() override; CFX_WideString m_wsURLContent; diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp index c2d2a9ef6d..3c0087de09 100644 --- a/xfa/fxfa/app/cxfa_textlayout.cpp +++ b/xfa/fxfa/app/cxfa_textlayout.cpp @@ -897,7 +897,7 @@ bool CXFA_TextLayout::AppendChar(const CFX_WideString& wsText, int32_t iLength = wsText.GetLength(); for (int32_t i = iChar; i < iLength; i++) { - FX_WCHAR wch = wsText.GetAt(i); + wchar_t wch = wsText.GetAt(i); if (wch == 0xA0) wch = 0x20; @@ -932,9 +932,9 @@ void CXFA_TextLayout::ProcessText(CFX_WideString& wsText) { if (iLen == 0) return; - FX_WCHAR* psz = wsText.GetBuffer(iLen); + wchar_t* psz = wsText.GetBuffer(iLen); int32_t iTrimLeft = 0; - FX_WCHAR wch = 0, wPrev = 0; + wchar_t wch = 0, wPrev = 0; for (int32_t i = 0; i < iLen; i++) { wch = psz[i]; if (wch < 0x20) diff --git a/xfa/fxfa/app/cxfa_textparser.cpp b/xfa/fxfa/app/cxfa_textparser.cpp index 9759cb219d..750a0baaff 100644 --- a/xfa/fxfa/app/cxfa_textparser.cpp +++ b/xfa/fxfa/app/cxfa_textparser.cpp @@ -85,7 +85,7 @@ void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) { } std::unique_ptr<CFDE_CSSStyleSheet> CXFA_TextParser::LoadDefaultSheetStyle() { - static const FX_WCHAR s_pStyle[] = + static const wchar_t s_pStyle[] = L"html,body,ol,p,ul{display:block}" L"li{display:list-item}" L"ol,ul{padding-left:33px;margin:1.12em 0}" @@ -562,12 +562,12 @@ bool CXFA_TextParser::GetTabstops(CFDE_CSSComputedStyle* pStyle, } int32_t iLength = wsValue.GetLength(); - const FX_WCHAR* pTabStops = wsValue.c_str(); + const wchar_t* pTabStops = wsValue.c_str(); int32_t iCur = 0; int32_t iLast = 0; CFX_WideString wsAlign; TabStopStatus eStatus = TabStopStatus::None; - FX_WCHAR ch; + wchar_t ch; while (iCur < iLength) { ch = pTabStops[iCur]; switch (eStatus) { diff --git a/xfa/fxfa/app/xfa_checksum.cpp b/xfa/fxfa/app/xfa_checksum.cpp index 09c42719c1..a06fed870c 100644 --- a/xfa/fxfa/app/xfa_checksum.cpp +++ b/xfa/fxfa/app/xfa_checksum.cpp @@ -21,7 +21,7 @@ struct FX_BASE64DATA { uint32_t data7 : 8; }; -const FX_CHAR g_FXBase64EncoderMap[64] = { +const char g_FXBase64EncoderMap[64] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', @@ -29,9 +29,7 @@ const FX_CHAR g_FXBase64EncoderMap[64] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', }; -void Base64EncodePiece(const FX_BASE64DATA& src, - int32_t iBytes, - FX_CHAR dst[4]) { +void Base64EncodePiece(const FX_BASE64DATA& src, int32_t iBytes, char dst[4]) { dst[0] = g_FXBase64EncoderMap[src.data2]; uint32_t b = src.data1 << 4; if (iBytes > 1) { @@ -54,7 +52,7 @@ void Base64EncodePiece(const FX_BASE64DATA& src, } } -int32_t Base64EncodeA(const uint8_t* pSrc, int32_t iSrcLen, FX_CHAR* pDst) { +int32_t Base64EncodeA(const uint8_t* pSrc, int32_t iSrcLen, char* pDst) { ASSERT(pSrc); if (iSrcLen < 1) { return 0; @@ -68,7 +66,7 @@ int32_t Base64EncodeA(const uint8_t* pSrc, int32_t iSrcLen, FX_CHAR* pDst) { } FX_BASE64DATA srcData; int32_t iBytes = 3; - FX_CHAR* pDstEnd = pDst; + char* pDstEnd = pDst; while (iSrcLen > 0) { if (iSrcLen > 2) { ((uint8_t*)&srcData)[0] = *pSrc++; @@ -252,7 +250,7 @@ void CXFA_ChecksumContext::FinishChecksum() { FXSYS_memset(digest, 0, 20); CRYPT_SHA1Finish(m_pByteContext.get(), digest); int32_t nLen = Base64EncodeA(digest, 20, nullptr); - FX_CHAR* pBuffer = m_bsChecksum.GetBuffer(nLen); + char* pBuffer = m_bsChecksum.GetBuffer(nLen); Base64EncodeA(digest, 20, pBuffer); m_bsChecksum.ReleaseBuffer(nLen); m_pByteContext.reset(); diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp index b136b8da5a..3bbef30d06 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.cpp +++ b/xfa/fxfa/app/xfa_ffbarcode.cpp @@ -174,7 +174,7 @@ void CXFA_FFBarcode::UpdateWidgetProperty() { pBarCodeWidget->SetType(pBarcodeTypeInfo->eBCType); CXFA_WidgetAcc* pAcc = GetDataAcc(); int32_t intVal; - FX_CHAR charVal; + char charVal; bool boolVal; FX_FLOAT floatVal; if (pAcc->GetBarcodeAttribute_CharEncoding(intVal)) { diff --git a/xfa/fxfa/app/xfa_ffbarcode.h b/xfa/fxfa/app/xfa_ffbarcode.h index c20feb5167..1f11be6da7 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.h +++ b/xfa/fxfa/app/xfa_ffbarcode.h @@ -93,7 +93,7 @@ enum XFA_BARCODETYPEENUM { struct XFA_BARCODETYPEENUMINFO { uint32_t uHash; - const FX_WCHAR* pName; + const wchar_t* pName; XFA_BARCODETYPEENUM eName; BC_TYPE eBCType; }; diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index 911bdf8400..b6dba7f71a 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -59,7 +59,7 @@ uint8_t base64DecoderValue(uint8_t val) { return g_FXBase64DecoderMap[val - kStartValuesRemoved]; } -void Base64DecodePiece(const FX_CHAR src[4], +void Base64DecodePiece(const char src[4], int32_t iChars, FX_BASE64DATA& dst, int32_t& iBytes) { @@ -89,7 +89,7 @@ void Base64DecodePiece(const FX_CHAR src[4], } } -int32_t Base64DecodeW(const FX_WCHAR* pSrc, int32_t iSrcLen, uint8_t* pDst) { +int32_t Base64DecodeW(const wchar_t* pSrc, int32_t iSrcLen, uint8_t* pDst) { ASSERT(pSrc); if (iSrcLen < 1) { return 0; @@ -112,26 +112,26 @@ int32_t Base64DecodeW(const FX_WCHAR* pSrc, int32_t iSrcLen, uint8_t* pDst) { } return iDstLen; } - FX_CHAR srcData[4]; + char srcData[4]; FX_BASE64DATA dstData; int32_t iChars = 4, iBytes; uint8_t* pDstEnd = pDst; while (iSrcLen > 0) { if (iSrcLen > 3) { - srcData[0] = (FX_CHAR)*pSrc++; - srcData[1] = (FX_CHAR)*pSrc++; - srcData[2] = (FX_CHAR)*pSrc++; - srcData[3] = (FX_CHAR)*pSrc++; + srcData[0] = (char)*pSrc++; + srcData[1] = (char)*pSrc++; + srcData[2] = (char)*pSrc++; + srcData[3] = (char)*pSrc++; iSrcLen -= 4; } else { *((uint32_t*)&dstData) = 0; *((uint32_t*)srcData) = 0; - srcData[0] = (FX_CHAR)*pSrc++; + srcData[0] = (char)*pSrc++; if (iSrcLen > 1) { - srcData[1] = (FX_CHAR)*pSrc++; + srcData[1] = (char)*pSrc++; } if (iSrcLen > 2) { - srcData[2] = (FX_CHAR)*pSrc++; + srcData[2] = (char)*pSrc++; } iChars = iSrcLen; iSrcLen = 0; diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp index 951b4fd3f1..a0b834b96b 100644 --- a/xfa/fxfa/app/xfa_ffnotify.cpp +++ b/xfa/fxfa/app/xfa_ffnotify.cpp @@ -49,8 +49,8 @@ void CXFA_FFNotify::OnPageEvent(CXFA_ContainerLayoutItem* pSender, } void CXFA_FFNotify::OnWidgetListItemAdded(CXFA_WidgetData* pSender, - const FX_WCHAR* pLabel, - const FX_WCHAR* pValue, + const wchar_t* pLabel, + const wchar_t* pValue, int32_t iIndex) { CXFA_WidgetAcc* pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pSender); if (pWidgetAcc->GetUIType() != XFA_Element::ChoiceList) diff --git a/xfa/fxfa/app/xfa_ffnotify.h b/xfa/fxfa/app/xfa_ffnotify.h index 1bfaffec89..f76d35b639 100644 --- a/xfa/fxfa/app/xfa_ffnotify.h +++ b/xfa/fxfa/app/xfa_ffnotify.h @@ -20,8 +20,8 @@ class CXFA_FFNotify { void OnPageEvent(CXFA_ContainerLayoutItem* pSender, uint32_t dwEvent); void OnWidgetListItemAdded(CXFA_WidgetData* pSender, - const FX_WCHAR* pLabel, - const FX_WCHAR* pValue, + const wchar_t* pLabel, + const wchar_t* pValue, int32_t iIndex); void OnWidgetListItemRemoved(CXFA_WidgetData* pSender, int32_t iIndex); diff --git a/xfa/fxfa/app/xfa_fftext.cpp b/xfa/fxfa/app/xfa_fftext.cpp index e8d7aa32d0..04de9d918a 100644 --- a/xfa/fxfa/app/xfa_fftext.cpp +++ b/xfa/fxfa/app/xfa_fftext.cpp @@ -111,7 +111,7 @@ bool CXFA_FFText::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { if (!GetRectWithoutRotate().Contains(point)) return false; - const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(point); + const wchar_t* wsURLContent = GetLinkURLAtPoint(point); if (!wsURLContent) return false; @@ -128,7 +128,7 @@ bool CXFA_FFText::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) { return false; SetButtonDown(false); - const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(point); + const wchar_t* wsURLContent = GetLinkURLAtPoint(point); if (!wsURLContent) return false; @@ -145,7 +145,7 @@ FWL_WidgetHit CXFA_FFText::OnHitTest(const CFX_PointF& point) { return FWL_WidgetHit::HyperLink; } -const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(const CFX_PointF& point) { +const wchar_t* CXFA_FFText::GetLinkURLAtPoint(const CFX_PointF& point) { CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout(); if (!pTextLayout) return nullptr; diff --git a/xfa/fxfa/app/xfa_fftext.h b/xfa/fxfa/app/xfa_fftext.h index c553821791..eddc1224ac 100644 --- a/xfa/fxfa/app/xfa_fftext.h +++ b/xfa/fxfa/app/xfa_fftext.h @@ -26,7 +26,7 @@ class CXFA_FFText : public CXFA_FFDraw { bool PerformLayout() override; private: - const FX_WCHAR* GetLinkURLAtPoint(const CFX_PointF& point); + const wchar_t* GetLinkURLAtPoint(const CFX_PointF& point); }; #endif // XFA_FXFA_APP_XFA_FFTEXT_H_ diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index 9995fd11b2..ad175349f6 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -923,7 +923,7 @@ static uint8_t* XFA_RemoveBase64Whitespace(const uint8_t* pStr, int32_t iLen) { uint8_t* pCP; int32_t i = 0, j = 0; if (iLen == 0) { - iLen = FXSYS_strlen((FX_CHAR*)pStr); + iLen = FXSYS_strlen((char*)pStr); } pCP = FX_Alloc(uint8_t, iLen + 1); for (; i < iLen; i++) { @@ -936,16 +936,16 @@ static uint8_t* XFA_RemoveBase64Whitespace(const uint8_t* pStr, int32_t iLen) { pCP[j] = '\0'; return pCP; } -static int32_t XFA_Base64Decode(const FX_CHAR* pStr, uint8_t* pOutBuffer) { +static int32_t XFA_Base64Decode(const char* pStr, uint8_t* pOutBuffer) { if (!pStr) { return 0; } uint8_t* pBuffer = - XFA_RemoveBase64Whitespace((uint8_t*)pStr, FXSYS_strlen((FX_CHAR*)pStr)); + XFA_RemoveBase64Whitespace((uint8_t*)pStr, FXSYS_strlen((char*)pStr)); if (!pBuffer) { return 0; } - int32_t iLen = FXSYS_strlen((FX_CHAR*)pBuffer); + int32_t iLen = FXSYS_strlen((char*)pBuffer); int32_t i = 0, j = 0; uint32_t dwLimb = 0; for (; i + 3 < iLen; i += 4) { @@ -982,14 +982,14 @@ static int32_t XFA_Base64Decode(const FX_CHAR* pStr, uint8_t* pOutBuffer) { return j; } -static const FX_CHAR g_base64_chars[] = +static const char g_base64_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len) { - FX_CHAR* out = nullptr; +char* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len) { + char* out = nullptr; int i, j; uint32_t limb; - out = FX_Alloc(FX_CHAR, ((buf_len * 8 + 5) / 6) + 5); + out = FX_Alloc(char, ((buf_len * 8 + 5) / 6) + 5); for (i = 0, j = 0, limb = 0; i + 2 < buf_len; i += 3, j += 4) { limb = ((uint32_t)buf[i] << 16) | ((uint32_t)buf[i + 1] << 8) | ((uint32_t)buf[i + 2]); diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index 960771f9f8..655c9da511 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -838,8 +838,8 @@ void CXFA_WidgetAcc::CalculateTextContentSize(CFX_SizeF& size) { return; } - FX_WCHAR wcEnter = '\n'; - FX_WCHAR wsLast = wsText.GetAt(wsText.GetLength() - 1); + wchar_t wcEnter = '\n'; + wchar_t wsLast = wsText.GetAt(wsText.GetLength() - 1); if (wsLast == wcEnter) { wsText = wsText + wcEnter; } diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp index 5db389663a..d7e34fb944 100644 --- a/xfa/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/fxfa/app/xfa_fontmgr.cpp @@ -1762,10 +1762,10 @@ CFX_RetainPtr<CFGAS_GEFont> CXFA_DefFontMgr::GetFont( if (dwFontStyles & FX_FONTSTYLE_Italic) { dwStyle |= FX_FONTSTYLE_Italic; } - const FX_WCHAR* pReplace = pCurFont->pReplaceFont; + const wchar_t* pReplace = pCurFont->pReplaceFont; int32_t iLength = FXSYS_wcslen(pReplace); while (iLength > 0) { - const FX_WCHAR* pNameText = pReplace; + const wchar_t* pNameText = pReplace; while (*pNameText != L',' && iLength > 0) { pNameText++; iLength--; @@ -1796,7 +1796,7 @@ CFX_RetainPtr<CFGAS_GEFont> CXFA_DefFontMgr::GetDefaultFont( CFX_RetainPtr<CFGAS_GEFont> pFont = pFDEFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, wCodePage); if (!pFont) { - pFont = pFDEFontMgr->LoadFont(static_cast<const FX_WCHAR*>(nullptr), + pFont = pFDEFontMgr->LoadFont(static_cast<const wchar_t*>(nullptr), dwFontStyles, wCodePage); } if (pFont) @@ -1969,7 +1969,7 @@ bool CXFA_PDFFontMgr::PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName, } bool CXFA_PDFFontMgr::GetCharWidth(const CFX_RetainPtr<CFGAS_GEFont>& pFont, - FX_WCHAR wUnicode, + wchar_t wUnicode, bool bCharCode, int32_t* pWidth) { if (wUnicode != 0x20 || bCharCode) diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index 73abaecbc8..5ea2a0c6c7 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -28,7 +28,7 @@ namespace { -const FX_WCHAR* const g_FWLTheme_CalFonts[] = { +const wchar_t* const g_FWLTheme_CalFonts[] = { L"Arial", L"Courier New", L"DejaVu Sans", }; diff --git a/xfa/fxfa/fm2js/xfa_error.cpp b/xfa/fxfa/fm2js/xfa_error.cpp index 020d9bc509..9ca886954a 100644 --- a/xfa/fxfa/fm2js/xfa_error.cpp +++ b/xfa/fxfa/fm2js/xfa_error.cpp @@ -6,12 +6,12 @@ #include "xfa/fxfa/fm2js/xfa_error.h" -const FX_WCHAR kFMErrUnsupportedChar[] = L"unsupported char '%c'"; -const FX_WCHAR kFMErrBadSuffixNumber[] = L"bad suffix on number"; -const FX_WCHAR kFMErrExpectedIdentifier[] = +const wchar_t kFMErrUnsupportedChar[] = L"unsupported char '%c'"; +const wchar_t kFMErrBadSuffixNumber[] = L"bad suffix on number"; +const wchar_t kFMErrExpectedIdentifier[] = L"expected identifier instead of '%s'"; -const FX_WCHAR kFMErrExpectedToken[] = L"expected '%s' instead of '%s'"; -const FX_WCHAR kFMErrExpectedEndIf[] = L"expected 'endif' instead of '%s'"; -const FX_WCHAR kFMErrUnexpectedExpression[] = L"unexpected expression '%s'"; -const FX_WCHAR kFMErrExpectedNonEmptyExpression[] = +const wchar_t kFMErrExpectedToken[] = L"expected '%s' instead of '%s'"; +const wchar_t kFMErrExpectedEndIf[] = L"expected 'endif' instead of '%s'"; +const wchar_t kFMErrUnexpectedExpression[] = L"unexpected expression '%s'"; +const wchar_t kFMErrExpectedNonEmptyExpression[] = L"expected non-empty expression"; diff --git a/xfa/fxfa/fm2js/xfa_error.h b/xfa/fxfa/fm2js/xfa_error.h index 5e3fbbe1ba..d6bb72bb34 100644 --- a/xfa/fxfa/fm2js/xfa_error.h +++ b/xfa/fxfa/fm2js/xfa_error.h @@ -10,13 +10,13 @@ #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" -extern const FX_WCHAR kFMErrUnsupportedChar[]; -extern const FX_WCHAR kFMErrBadSuffixNumber[]; -extern const FX_WCHAR kFMErrExpectedIdentifier[]; -extern const FX_WCHAR kFMErrExpectedToken[]; -extern const FX_WCHAR kFMErrExpectedEndIf[]; -extern const FX_WCHAR kFMErrUnexpectedExpression[]; -extern const FX_WCHAR kFMErrExpectedNonEmptyExpression[]; +extern const wchar_t kFMErrUnsupportedChar[]; +extern const wchar_t kFMErrBadSuffixNumber[]; +extern const wchar_t kFMErrExpectedIdentifier[]; +extern const wchar_t kFMErrExpectedToken[]; +extern const wchar_t kFMErrExpectedEndIf[]; +extern const wchar_t kFMErrUnexpectedExpression[]; +extern const wchar_t kFMErrExpectedNonEmptyExpression[]; class CXFA_FMErrorInfo { public: diff --git a/xfa/fxfa/fm2js/xfa_expression.cpp b/xfa/fxfa/fm2js/xfa_expression.cpp index 32db6d24df..c1e451eade 100644 --- a/xfa/fxfa/fm2js/xfa_expression.cpp +++ b/xfa/fxfa/fm2js/xfa_expression.cpp @@ -12,10 +12,10 @@ namespace { -const FX_WCHAR RUNTIMEBLOCKTEMPARRAY[] = +const wchar_t RUNTIMEBLOCKTEMPARRAY[] = L"foxit_xfa_formcalc_runtime_block_temp_array"; -const FX_WCHAR RUNTIMEBLOCKTEMPARRAYINDEX[] = +const wchar_t RUNTIMEBLOCKTEMPARRAYINDEX[] = L"foxit_xfa_formcalc_runtime_block_temp_array_index"; } // namespace diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index e8cb2d0279..356180834f 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -28,7 +28,7 @@ const double kFinancialPrecision = 0.00000001; struct XFA_FMHtmlReserveCode { uint32_t m_uCode; - const FX_WCHAR* m_htmlReserve; + const wchar_t* m_htmlReserve; }; struct XFA_FMHtmlHashedReserveCode { @@ -384,7 +384,7 @@ void AlternateDateTimeSymbols(CFX_WideString& wsPattern, bool bEscape = false; int32_t i = 0; while (i < nLength) { - FX_WCHAR wc = wsPattern[i]; + wchar_t wc = wsPattern[i]; if (wc == L'\'') { bInConstRange = !bInConstRange; if (bEscape) { @@ -442,11 +442,11 @@ bool PatternStringType(const CFX_ByteStringC& szPattern, patternType = XFA_VT_NULL; wsPattern.MakeLower(); - const FX_WCHAR* pData = wsPattern.c_str(); + const wchar_t* pData = wsPattern.c_str(); int32_t iLength = wsPattern.GetLength(); int32_t iIndex = 0; bool bSingleQuotation = false; - FX_WCHAR patternChar; + wchar_t patternChar; while (iIndex < iLength) { patternChar = pData[iIndex]; if (patternChar == 0x27) { @@ -455,7 +455,7 @@ bool PatternStringType(const CFX_ByteStringC& szPattern, (patternChar == 'y' || patternChar == 'j')) { patternType = XFA_VT_DATE; iIndex++; - FX_WCHAR timePatternChar; + wchar_t timePatternChar; while (iIndex < iLength) { timePatternChar = pData[iIndex]; if (timePatternChar == 0x27) { @@ -1642,7 +1642,7 @@ void CXFA_FM2JSContext::TimeFmt(CFXJSE_Value* pThis, } // static -bool CXFA_FM2JSContext::IsIsoDateFormat(const FX_CHAR* pData, +bool CXFA_FM2JSContext::IsIsoDateFormat(const char* pData, int32_t iLength, int32_t& iStyle, int32_t& iYear, @@ -1655,7 +1655,7 @@ bool CXFA_FM2JSContext::IsIsoDateFormat(const FX_CHAR* pData, if (iLength < 4) return false; - FX_CHAR strYear[5]; + char strYear[5]; strYear[4] = '\0'; for (int32_t i = 0; i < 4; ++i) { if (pData[i] > '9' || pData[i] < '0') @@ -1670,7 +1670,7 @@ bool CXFA_FM2JSContext::IsIsoDateFormat(const FX_CHAR* pData, iStyle = pData[4] == '-' ? 1 : 0; - FX_CHAR strTemp[3]; + char strTemp[3]; strTemp[2] = '\0'; int32_t iPosOff = iStyle == 0 ? 4 : 5; if ((pData[iPosOff] > '9' || pData[iPosOff] < '0') || @@ -1721,7 +1721,7 @@ bool CXFA_FM2JSContext::IsIsoDateFormat(const FX_CHAR* pData, } // static -bool CXFA_FM2JSContext::IsIsoTimeFormat(const FX_CHAR* pData, +bool CXFA_FM2JSContext::IsIsoTimeFormat(const char* pData, int32_t iLength, int32_t& iHour, int32_t& iMinute, @@ -1738,7 +1738,7 @@ bool CXFA_FM2JSContext::IsIsoTimeFormat(const FX_CHAR* pData, if (!pData) return false; - FX_CHAR strTemp[3]; + char strTemp[3]; strTemp[2] = '\0'; int32_t iZone = 0; int32_t i = 0; @@ -1796,7 +1796,7 @@ bool CXFA_FM2JSContext::IsIsoTimeFormat(const FX_CHAR* pData, } if (pData[iIndex] == '.') { ++iIndex; - FX_CHAR strSec[4]; + char strSec[4]; strSec[3] = '\0'; if (pData[iIndex] > '9' || pData[iIndex] < '0') return false; @@ -1868,7 +1868,7 @@ bool CXFA_FM2JSContext::IsIsoTimeFormat(const FX_CHAR* pData, } // static -bool CXFA_FM2JSContext::IsIsoDateTimeFormat(const FX_CHAR* pData, +bool CXFA_FM2JSContext::IsIsoDateTimeFormat(const char* pData, int32_t iLength, int32_t& iYear, int32_t& iMonth, @@ -3059,14 +3059,14 @@ void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis, unitspanString.MakeLower(); CFX_WideString wsTypeString = CFX_WideString::FromUTF8(unitspanString.AsStringC()); - const FX_WCHAR* pData = wsTypeString.c_str(); + const wchar_t* pData = wsTypeString.c_str(); int32_t u = 0; int32_t uLen = wsTypeString.GetLength(); while (IsWhitespace(pData[u])) u++; XFA_FM2JS_VALUETYPE_ParserStatus eParserStatus = VALUETYPE_START; - FX_WCHAR typeChar; + wchar_t typeChar; // TODO(dsinclair): Cleanup this parser, figure out what the various checks // are for. while (u < uLen) { @@ -3086,7 +3086,7 @@ void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis, } eParserStatus = VALUETYPE_HAVEDIGIT; } else if ((typeChar == 'c' || typeChar == 'p') && (u + 1 < uLen)) { - FX_WCHAR nextChar = pData[u + 1]; + wchar_t nextChar = pData[u + 1]; if ((eParserStatus == VALUETYPE_START || eParserStatus == VALUETYPE_HAVEDIGIT || eParserStatus == VALUETYPE_HAVEDIGITWHITE) && @@ -3097,7 +3097,7 @@ void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis, } eParserStatus = VALUETYPE_HAVEINVALIDCHAR; } else if (typeChar == 'm' && (u + 1 < uLen)) { - FX_WCHAR nextChar = pData[u + 1]; + wchar_t nextChar = pData[u + 1]; if ((eParserStatus == VALUETYPE_START || eParserStatus == VALUETYPE_HAVEDIGIT || eParserStatus == VALUETYPE_HAVEDIGITWHITE) && @@ -3153,7 +3153,7 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, CFX_ByteString unitspanString; ValueToUTF8String(unitspanValue.get(), unitspanString); - const FX_CHAR* pData = unitspanString.c_str(); + const char* pData = unitspanString.c_str(); if (!pData) { args.GetReturnValue()->SetInteger(0); return; @@ -3171,7 +3171,7 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, ++u; } - FX_CHAR* pTemp = nullptr; + char* pTemp = nullptr; FX_DOUBLE dFirstNumber = strtod(pData, &pTemp); while (IsWhitespace(pData[u])) ++u; @@ -3192,7 +3192,7 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> unitValue = GetSimpleValue(pThis, args, 1); CFX_ByteString unitTempString; ValueToUTF8String(unitValue.get(), unitTempString); - const FX_CHAR* pChar = unitTempString.c_str(); + const char* pChar = unitTempString.c_str(); int32_t uVal = 0; while (IsWhitespace(pChar[uVal])) ++uVal; @@ -3393,18 +3393,18 @@ void CXFA_FM2JSContext::Decode(CFXJSE_Value* pThis, void CXFA_FM2JSContext::DecodeURL(const CFX_ByteStringC& szURLString, CFX_ByteTextBuf& szResultString) { CFX_WideString wsURLString = CFX_WideString::FromUTF8(szURLString); - const FX_WCHAR* pData = wsURLString.c_str(); + const wchar_t* pData = wsURLString.c_str(); int32_t i = 0; CFX_WideTextBuf wsResultBuf; while (i < wsURLString.GetLength()) { - FX_WCHAR ch = pData[i]; + wchar_t ch = pData[i]; if ('%' != ch) { wsResultBuf.AppendChar(ch); ++i; continue; } - FX_WCHAR chTemp = 0; + wchar_t chTemp = 0; int32_t iCount = 0; while (iCount < 2) { ++i; @@ -3434,15 +3434,15 @@ void CXFA_FM2JSContext::DecodeURL(const CFX_ByteStringC& szURLString, void CXFA_FM2JSContext::DecodeHTML(const CFX_ByteStringC& szHTMLString, CFX_ByteTextBuf& szResultString) { CFX_WideString wsHTMLString = CFX_WideString::FromUTF8(szHTMLString); - FX_WCHAR strString[9]; + wchar_t strString[9]; int32_t iStrIndex = 0; int32_t iLen = wsHTMLString.GetLength(); int32_t i = 0; int32_t iCode = 0; - const FX_WCHAR* pData = wsHTMLString.c_str(); + const wchar_t* pData = wsHTMLString.c_str(); CFX_WideTextBuf wsResultBuf; while (i < iLen) { - FX_WCHAR ch = pData[i]; + wchar_t ch = pData[i]; if (ch != '&') { wsResultBuf.AppendChar(ch); ++i; @@ -3492,7 +3492,7 @@ void CXFA_FM2JSContext::DecodeHTML(const CFX_ByteStringC& szHTMLString, } uint32_t iData = 0; if (HTMLSTR2Code(strString, iData)) { - wsResultBuf.AppendChar((FX_WCHAR)iData); + wsResultBuf.AppendChar((wchar_t)iData); } else { wsResultBuf.AppendChar(iCode); } @@ -3510,13 +3510,13 @@ void CXFA_FM2JSContext::DecodeHTML(const CFX_ByteStringC& szHTMLString, void CXFA_FM2JSContext::DecodeXML(const CFX_ByteStringC& szXMLString, CFX_ByteTextBuf& szResultString) { CFX_WideString wsXMLString = CFX_WideString::FromUTF8(szXMLString); - FX_WCHAR strString[9]; + wchar_t strString[9]; int32_t iStrIndex = 0; int32_t iLen = wsXMLString.GetLength(); int32_t i = 0; int32_t iCode = 0; - FX_WCHAR ch = 0; - const FX_WCHAR* pData = wsXMLString.c_str(); + wchar_t ch = 0; + const wchar_t* pData = wsXMLString.c_str(); CFX_WideTextBuf wsXMLBuf; while (i < iLen) { ch = pData[i]; @@ -3568,7 +3568,7 @@ void CXFA_FM2JSContext::DecodeXML(const CFX_ByteStringC& szXMLString, strString[iStrIndex] = 0; } - const FX_WCHAR* const strName[] = {L"quot", L"amp", L"apos", L"lt", L"gt"}; + const wchar_t* const strName[] = {L"quot", L"amp", L"apos", L"lt", L"gt"}; int32_t iIndex = 0; while (iIndex < 5) { if (FXSYS_memcmp(strString, strName[iIndex], @@ -3659,16 +3659,16 @@ void CXFA_FM2JSContext::EncodeURL(const CFX_ByteStringC& szURLString, CFX_ByteTextBuf& szResultBuf) { CFX_WideString wsURLString = CFX_WideString::FromUTF8(szURLString); CFX_WideTextBuf wsResultBuf; - FX_WCHAR strEncode[4]; + wchar_t strEncode[4]; strEncode[0] = '%'; strEncode[3] = 0; - FX_WCHAR strUnsafe[] = {' ', '<', '>', '"', '#', '%', '{', '}', - '|', '\\', '^', '~', '[', ']', '`'}; - FX_WCHAR strReserved[] = {';', '/', '?', ':', '@', '=', '&'}; - FX_WCHAR strSpecial[] = {'$', '-', '+', '!', '*', '\'', '(', ')', ','}; - const FX_WCHAR* strCode = L"0123456789abcdef"; + wchar_t strUnsafe[] = {' ', '<', '>', '"', '#', '%', '{', '}', + '|', '\\', '^', '~', '[', ']', '`'}; + wchar_t strReserved[] = {';', '/', '?', ':', '@', '=', '&'}; + wchar_t strSpecial[] = {'$', '-', '+', '!', '*', '\'', '(', ')', ','}; + const wchar_t* strCode = L"0123456789abcdef"; for (int32_t u = 0; u < wsURLString.GetLength(); ++u) { - FX_WCHAR ch = wsURLString.GetAt(u); + wchar_t ch = wsURLString.GetAt(u); int32_t i = 0; int32_t iCount = FX_ArraySize(strUnsafe); while (i < iCount) { @@ -3719,10 +3719,10 @@ void CXFA_FM2JSContext::EncodeURL(const CFX_ByteStringC& szURLString, } else if (ch >= 0x20 && ch <= 0x7e) { wsResultBuf.AppendChar(ch); } else { - const FX_WCHAR iRadix = 16; + const wchar_t iRadix = 16; CFX_WideString strTmp; while (ch >= iRadix) { - FX_WCHAR tmp = strCode[ch % iRadix]; + wchar_t tmp = strCode[ch % iRadix]; ch /= iRadix; strTmp += tmp; } @@ -3760,8 +3760,8 @@ void CXFA_FM2JSContext::EncodeHTML(const CFX_ByteStringC& szHTMLString, CFX_ByteTextBuf& szResultBuf) { CFX_ByteString str = szHTMLString.c_str(); CFX_WideString wsHTMLString = CFX_WideString::FromUTF8(str.AsStringC()); - const FX_WCHAR* strCode = L"0123456789abcdef"; - FX_WCHAR strEncode[9]; + const wchar_t* strCode = L"0123456789abcdef"; + wchar_t strEncode[9]; strEncode[0] = '&'; strEncode[1] = '#'; strEncode[2] = 'x'; @@ -3772,7 +3772,7 @@ void CXFA_FM2JSContext::EncodeHTML(const CFX_ByteStringC& szHTMLString, CFX_WideTextBuf wsResultBuf; int32_t iLen = wsHTMLString.GetLength(); int32_t i = 0; - const FX_WCHAR* pData = wsHTMLString.c_str(); + const wchar_t* pData = wsHTMLString.c_str(); while (i < iLen) { uint32_t ch = pData[i]; CFX_WideString htmlReserve; @@ -3781,7 +3781,7 @@ void CXFA_FM2JSContext::EncodeHTML(const CFX_ByteStringC& szHTMLString, wsResultBuf << htmlReserve; wsResultBuf.AppendChar(L';'); } else if (ch >= 32 && ch <= 126) { - wsResultBuf.AppendChar((FX_WCHAR)ch); + wsResultBuf.AppendChar((wchar_t)ch); } else if (ch < 256) { int32_t iIndex = ch / 16; strEncode[3] = strCode[iIndex]; @@ -3810,7 +3810,7 @@ void CXFA_FM2JSContext::EncodeXML(const CFX_ByteStringC& szXMLString, CFX_ByteTextBuf& szResultBuf) { CFX_WideString wsXMLString = CFX_WideString::FromUTF8(szXMLString); CFX_WideTextBuf wsResultBuf; - FX_WCHAR strEncode[9]; + wchar_t strEncode[9]; strEncode[0] = '&'; strEncode[1] = '#'; strEncode[2] = 'x'; @@ -3818,10 +3818,10 @@ void CXFA_FM2JSContext::EncodeXML(const CFX_ByteStringC& szXMLString, strEncode[6] = 0; strEncode[7] = ';'; strEncode[8] = 0; - const FX_WCHAR* strCode = L"0123456789abcdef"; - const FX_WCHAR* pData = wsXMLString.c_str(); + const wchar_t* strCode = L"0123456789abcdef"; + const wchar_t* pData = wsXMLString.c_str(); for (int32_t u = 0; u < wsXMLString.GetLength(); ++u) { - FX_WCHAR ch = pData[u]; + wchar_t ch = pData[u]; switch (ch) { case '"': wsResultBuf.AppendChar('&'); @@ -4060,7 +4060,7 @@ void CXFA_FM2JSContext::Lower(CFXJSE_Value* pThis, ValueToUTF8String(argOne.get(), argString); CFX_WideTextBuf lowStringBuf; CFX_WideString wsArgString = CFX_WideString::FromUTF8(argString.AsStringC()); - const FX_WCHAR* pData = wsArgString.c_str(); + const wchar_t* pData = wsArgString.c_str(); int32_t i = 0; while (i < argString.GetLength()) { int32_t ch = pData[i]; @@ -4399,7 +4399,7 @@ void CXFA_FM2JSContext::Str(CFXJSE_Value* pThis, formatStr += "f"; numberString.Format(formatStr.c_str(), fNumber); - const FX_CHAR* pData = numberString.c_str(); + const char* pData = numberString.c_str(); int32_t iLength = numberString.GetLength(); int32_t u = 0; while (u < iLength) { @@ -4608,7 +4608,7 @@ void CXFA_FM2JSContext::Upper(CFXJSE_Value* pThis, CFX_WideTextBuf upperStringBuf; CFX_WideString wsArgString = CFX_WideString::FromUTF8(argString.AsStringC()); - const FX_WCHAR* pData = wsArgString.c_str(); + const wchar_t* pData = wsArgString.c_str(); int32_t i = 0; while (i < wsArgString.GetLength()) { int32_t ch = pData[i]; @@ -4692,7 +4692,7 @@ void CXFA_FM2JSContext::TrillionUS(const CFX_ByteStringC& szData, "Sixty", "Seventy", "Eighty", "Ninety"}; CFX_ByteStringC pComm[] = {" Hundred ", " Thousand ", " Million ", " Billion ", "Trillion"}; - const FX_CHAR* pData = szData.c_str(); + const char* pData = szData.c_str(); int32_t iLength = szData.GetLength(); int32_t iComm = 0; if (iLength > 12) @@ -4781,7 +4781,7 @@ void CXFA_FM2JSContext::TrillionUS(const CFX_ByteStringC& szData, void CXFA_FM2JSContext::WordUS(const CFX_ByteStringC& szData, int32_t iStyle, CFX_ByteTextBuf& strBuf) { - const FX_CHAR* pData = szData.c_str(); + const char* pData = szData.c_str(); int32_t iLength = szData.GetLength(); if (iStyle < 0 || iStyle > 2) { return; @@ -6411,7 +6411,7 @@ void CXFA_FM2JSContext::ThrowArgumentMismatchException() const { ThrowException(L"Argument mismatch in property or function argument."); } -void CXFA_FM2JSContext::ThrowException(const FX_WCHAR* str, ...) const { +void CXFA_FM2JSContext::ThrowException(const wchar_t* str, ...) const { CFX_WideString wsMessage; va_list arg_ptr; va_start(arg_ptr, str); diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.h b/xfa/fxfa/fm2js/xfa_fm2jscontext.h index 0f802fe65e..b56a0212d8 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.h +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.h @@ -91,13 +91,13 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args); - static bool IsIsoDateFormat(const FX_CHAR* pData, + static bool IsIsoDateFormat(const char* pData, int32_t iLength, int32_t& iStyle, int32_t& iYear, int32_t& iMonth, int32_t& iDay); - static bool IsIsoTimeFormat(const FX_CHAR* pData, + static bool IsIsoTimeFormat(const char* pData, int32_t iLength, int32_t& iHour, int32_t& iMinute, @@ -105,7 +105,7 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { int32_t& iMilliSecond, int32_t& iZoneHour, int32_t& iZoneMinute); - static bool IsIsoDateTimeFormat(const FX_CHAR* pData, + static bool IsIsoDateTimeFormat(const char* pData, int32_t iLength, int32_t& iYear, int32_t& iMonth, @@ -462,7 +462,7 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { const CFX_WideString& exp) const; void ThrowArgumentMismatchException() const; void ThrowParamCountMismatchException(const CFX_WideString& method) const; - void ThrowException(const FX_WCHAR* str, ...) const; + void ThrowException(const wchar_t* str, ...) const; v8::Isolate* m_pIsolate; CFXJSE_Class* m_pFMClass; diff --git a/xfa/fxfa/fm2js/xfa_fmparse.cpp b/xfa/fxfa/fm2js/xfa_fmparse.cpp index 52161e8c0a..09e8f36298 100644 --- a/xfa/fxfa/fm2js/xfa_fmparse.cpp +++ b/xfa/fxfa/fm2js/xfa_fmparse.cpp @@ -39,7 +39,7 @@ void CXFA_FMParse::Check(XFA_FM_TOKEN op) { NextToken(); } -void CXFA_FMParse::Error(uint32_t lineNum, const FX_WCHAR* msg, ...) { +void CXFA_FMParse::Error(uint32_t lineNum, const wchar_t* msg, ...) { m_pErrorInfo->linenum = lineNum; va_list ap; va_start(ap, msg); @@ -832,7 +832,7 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseBlockExpression() { std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseIfExpression() { uint32_t line = m_pToken->m_uLinenum; - const FX_WCHAR* pStartPos = m_lexer->SavePos(); + const wchar_t* pStartPos = m_lexer->SavePos(); NextToken(); Check(TOKlparen); std::unique_ptr<CXFA_FMSimpleExpression> pExpression; diff --git a/xfa/fxfa/fm2js/xfa_fmparse.h b/xfa/fxfa/fm2js/xfa_fmparse.h index 8f2671d1b0..ccb793ae68 100644 --- a/xfa/fxfa/fm2js/xfa_fmparse.h +++ b/xfa/fxfa/fm2js/xfa_fmparse.h @@ -20,7 +20,7 @@ class CXFA_FMParse { void NextToken(); void Check(XFA_FM_TOKEN op); - void Error(uint32_t lineNum, const FX_WCHAR* msg, ...); + void Error(uint32_t lineNum, const wchar_t* msg, ...); std::vector<std::unique_ptr<CXFA_FMExpression>> ParseTopExpression(); std::unique_ptr<CXFA_FMExpression> ParseFunction(); std::unique_ptr<CXFA_FMExpression> ParseExpression(); diff --git a/xfa/fxfa/fm2js/xfa_lexer.cpp b/xfa/fxfa/fm2js/xfa_lexer.cpp index 6e844bcdf0..e83877eb13 100644 --- a/xfa/fxfa/fm2js/xfa_lexer.cpp +++ b/xfa/fxfa/fm2js/xfa_lexer.cpp @@ -11,41 +11,39 @@ namespace { struct XFA_FMDChar { - static const FX_WCHAR* inc(const FX_WCHAR*& p) { + static const wchar_t* inc(const wchar_t*& p) { ++p; return p; } - static const FX_WCHAR* dec(const FX_WCHAR*& p) { + static const wchar_t* dec(const wchar_t*& p) { --p; return p; } - static uint16_t get(const FX_WCHAR* p) { return *p; } - static bool isWhiteSpace(const FX_WCHAR* p) { + static uint16_t get(const wchar_t* p) { return *p; } + static bool isWhiteSpace(const wchar_t* p) { return (*p) == 0x09 || (*p) == 0x0b || (*p) == 0x0c || (*p) == 0x20; } - static bool isLineTerminator(const FX_WCHAR* p) { + static bool isLineTerminator(const wchar_t* p) { return *p == 0x0A || *p == 0x0D; } - static bool isBinary(const FX_WCHAR* p) { return (*p) >= '0' && (*p) <= '1'; } - static bool isOctal(const FX_WCHAR* p) { return (*p) >= '0' && (*p) <= '7'; } - static bool isDigital(const FX_WCHAR* p) { - return (*p) >= '0' && (*p) <= '9'; - } - static bool isHex(const FX_WCHAR* p) { + static bool isBinary(const wchar_t* p) { return (*p) >= '0' && (*p) <= '1'; } + static bool isOctal(const wchar_t* p) { return (*p) >= '0' && (*p) <= '7'; } + static bool isDigital(const wchar_t* p) { return (*p) >= '0' && (*p) <= '9'; } + static bool isHex(const wchar_t* p) { return isDigital(p) || ((*p) >= 'a' && (*p) <= 'f') || ((*p) >= 'A' && (*p) <= 'F'); } - static bool isAlpha(const FX_WCHAR* p) { + static bool isAlpha(const wchar_t* p) { return ((*p) <= 'z' && (*p) >= 'a') || ((*p) <= 'Z' && (*p) >= 'A'); } - static bool isAvalid(const FX_WCHAR* p, bool flag = 0); - static bool string2number(const FX_WCHAR* s, + static bool isAvalid(const wchar_t* p, bool flag = 0); + static bool string2number(const wchar_t* s, FX_DOUBLE* pValue, - const FX_WCHAR*& pEnd); + const wchar_t*& pEnd); static bool isUnicodeAlpha(uint16_t ch); }; -inline bool XFA_FMDChar::isAvalid(const FX_WCHAR* p, bool flag) { +inline bool XFA_FMDChar::isAvalid(const wchar_t* p, bool flag) { if (*p == 0) { return 1; } @@ -61,9 +59,9 @@ inline bool XFA_FMDChar::isAvalid(const FX_WCHAR* p, bool flag) { return 0; } -inline bool XFA_FMDChar::string2number(const FX_WCHAR* s, +inline bool XFA_FMDChar::string2number(const wchar_t* s, FX_DOUBLE* pValue, - const FX_WCHAR*& pEnd) { + const wchar_t*& pEnd) { if (s) { *pValue = wcstod((wchar_t*)s, (wchar_t**)&pEnd); } @@ -148,7 +146,7 @@ const XFA_FM_TOKEN KEYWORD_END = TOKendif; } // namespace -const FX_WCHAR* XFA_FM_KeywordToString(XFA_FM_TOKEN op) { +const wchar_t* XFA_FM_KeywordToString(XFA_FM_TOKEN op) { if (op < KEYWORD_START || op > KEYWORD_END) return L""; return keyWords[op].m_keyword; @@ -199,12 +197,12 @@ CXFA_FMToken* CXFA_FMLexer::Scan() { XFA_FMDChar::inc(m_ptr); break; case ';': { - const FX_WCHAR* pTemp = 0; + const wchar_t* pTemp = 0; Comment(m_ptr, pTemp); m_ptr = pTemp; } break; case '"': { - const FX_WCHAR* pTemp = 0; + const wchar_t* pTemp = 0; p->m_type = TOKstring; iRet = String(p, m_ptr, pTemp); m_ptr = pTemp; @@ -221,7 +219,7 @@ CXFA_FMToken* CXFA_FMLexer::Scan() { case '8': case '9': { p->m_type = TOKnumber; - const FX_WCHAR* pTemp = 0; + const wchar_t* pTemp = 0; iRet = Number(p, m_ptr, pTemp); m_ptr = pTemp; if (iRet) { @@ -333,7 +331,7 @@ CXFA_FMToken* CXFA_FMLexer::Scan() { if (XFA_FMDChar::isAvalid(m_ptr)) { ch = XFA_FMDChar::get(m_ptr); if (ch == '/') { - const FX_WCHAR* pTemp = 0; + const wchar_t* pTemp = 0; Comment(m_ptr, pTemp); m_ptr = pTemp; break; @@ -365,7 +363,7 @@ CXFA_FMToken* CXFA_FMLexer::Scan() { return p; } else if (ch <= '9' && ch >= '0') { p->m_type = TOKnumber; - const FX_WCHAR* pTemp = 0; + const wchar_t* pTemp = 0; XFA_FMDChar::dec(m_ptr); iRet = Number(p, m_ptr, pTemp); m_ptr = pTemp; @@ -389,7 +387,7 @@ CXFA_FMToken* CXFA_FMLexer::Scan() { XFA_FMDChar::inc(m_ptr); break; default: { - const FX_WCHAR* pTemp = 0; + const wchar_t* pTemp = 0; iRet = Identifiers(p, m_ptr, pTemp); m_ptr = pTemp; if (iRet) { @@ -403,8 +401,8 @@ CXFA_FMToken* CXFA_FMLexer::Scan() { } uint32_t CXFA_FMLexer::Number(CXFA_FMToken* t, - const FX_WCHAR* p, - const FX_WCHAR*& pEnd) { + const wchar_t* p, + const wchar_t*& pEnd) { FX_DOUBLE number = 0; if (XFA_FMDChar::string2number(p, &number, pEnd)) { return 1; @@ -417,9 +415,9 @@ uint32_t CXFA_FMLexer::Number(CXFA_FMToken* t, } uint32_t CXFA_FMLexer::String(CXFA_FMToken* t, - const FX_WCHAR* p, - const FX_WCHAR*& pEnd) { - const FX_WCHAR* pStart = p; + const wchar_t* p, + const wchar_t*& pEnd) { + const wchar_t* pStart = p; uint16_t ch = 0; XFA_FMDChar::inc(p); ch = XFA_FMDChar::get(p); @@ -457,9 +455,9 @@ uint32_t CXFA_FMLexer::String(CXFA_FMToken* t, } uint32_t CXFA_FMLexer::Identifiers(CXFA_FMToken* t, - const FX_WCHAR* p, - const FX_WCHAR*& pEnd) { - const FX_WCHAR* pStart = p; + const wchar_t* p, + const wchar_t*& pEnd) { + const wchar_t* pStart = p; uint16_t ch = 0; ch = XFA_FMDChar::get(p); XFA_FMDChar::inc(p); @@ -491,7 +489,7 @@ uint32_t CXFA_FMLexer::Identifiers(CXFA_FMToken* t, return 0; } -void CXFA_FMLexer::Comment(const FX_WCHAR* p, const FX_WCHAR*& pEnd) { +void CXFA_FMLexer::Comment(const wchar_t* p, const wchar_t*& pEnd) { unsigned ch = 0; XFA_FMDChar::inc(p); ch = XFA_FMDChar::get(p); @@ -530,7 +528,7 @@ XFA_FM_TOKEN CXFA_FMLexer::IsKeyword(const CFX_WideStringC& str) { return TOKidentifier; } -void CXFA_FMLexer::Error(const FX_WCHAR* msg, ...) { +void CXFA_FMLexer::Error(const wchar_t* msg, ...) { m_pErrorInfo->linenum = m_uCurrentLine; va_list ap; va_start(ap, msg); diff --git a/xfa/fxfa/fm2js/xfa_lexer.h b/xfa/fxfa/fm2js/xfa_lexer.h index 9395c06814..aa7904cfb3 100644 --- a/xfa/fxfa/fm2js/xfa_lexer.h +++ b/xfa/fxfa/fm2js/xfa_lexer.h @@ -86,10 +86,10 @@ enum XFA_FM_TOKEN { struct XFA_FMKeyword { XFA_FM_TOKEN m_type; uint32_t m_uHash; - const FX_WCHAR* m_keyword; + const wchar_t* m_keyword; }; -const FX_WCHAR* XFA_FM_KeywordToString(XFA_FM_TOKEN op); +const wchar_t* XFA_FM_KeywordToString(XFA_FM_TOKEN op); class CXFA_FMToken { public: @@ -107,27 +107,25 @@ class CXFA_FMLexer { ~CXFA_FMLexer(); CXFA_FMToken* NextToken(); - uint32_t Number(CXFA_FMToken* t, const FX_WCHAR* p, const FX_WCHAR*& pEnd); - uint32_t String(CXFA_FMToken* t, const FX_WCHAR* p, const FX_WCHAR*& pEnd); - uint32_t Identifiers(CXFA_FMToken* t, - const FX_WCHAR* p, - const FX_WCHAR*& pEnd); - void Comment(const FX_WCHAR* p, const FX_WCHAR*& pEnd); + uint32_t Number(CXFA_FMToken* t, const wchar_t* p, const wchar_t*& pEnd); + uint32_t String(CXFA_FMToken* t, const wchar_t* p, const wchar_t*& pEnd); + uint32_t Identifiers(CXFA_FMToken* t, const wchar_t* p, const wchar_t*& pEnd); + void Comment(const wchar_t* p, const wchar_t*& pEnd); XFA_FM_TOKEN IsKeyword(const CFX_WideStringC& p); void SetCurrentLine(uint32_t line) { m_uCurrentLine = line; } void SetToken(CXFA_FMToken* pToken) { if (m_pToken.get() != pToken) m_pToken.reset(pToken); } - const FX_WCHAR* SavePos() { return m_ptr; } - void RestorePos(const FX_WCHAR* pPos) { m_ptr = pPos; } - void Error(const FX_WCHAR* msg, ...); + const wchar_t* SavePos() { return m_ptr; } + void RestorePos(const wchar_t* pPos) { m_ptr = pPos; } + void Error(const wchar_t* msg, ...); bool HasError() const; protected: CXFA_FMToken* Scan(); - const FX_WCHAR* m_ptr; + const wchar_t* m_ptr; uint32_t m_uCurrentLine; std::unique_ptr<CXFA_FMToken> m_pToken; CXFA_FMErrorInfo* m_pErrorInfo; diff --git a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp index 686ddaa17d..7bc703b59b 100644 --- a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp +++ b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp @@ -12,7 +12,7 @@ namespace { -const FX_WCHAR* const gs_lpStrExpFuncName[] = { +const wchar_t* const gs_lpStrExpFuncName[] = { L"foxit_xfa_formcalc_runtime.assign_value_operator", L"foxit_xfa_formcalc_runtime.logical_or_operator", L"foxit_xfa_formcalc_runtime.logical_and_operator", @@ -42,7 +42,7 @@ const FX_WCHAR* const gs_lpStrExpFuncName[] = { struct XFA_FMBuildInFunc { uint32_t m_uHash; - const FX_WCHAR* m_buildinfunc; + const wchar_t* m_buildinfunc; }; const XFA_FMBuildInFunc g_BuildInFuncs[] = { @@ -83,7 +83,7 @@ const XFA_FMBuildInFunc g_BuildInFuncs[] = { struct XFA_FMSOMMethod { uint32_t m_uHash; - const FX_WCHAR* m_wsSomMethodName; + const wchar_t* m_wsSomMethodName; uint32_t m_dParameters; }; const XFA_FMSOMMethod gs_FMSomMethods[] = { @@ -155,7 +155,7 @@ void CXFA_FMStringExpression::ToJavaScript(CFX_WideTextBuf& javascript) { CFX_WideString tempStr(m_wsString); if (tempStr.GetLength() > 2) { javascript.AppendChar(L'\"'); - FX_WCHAR oneChar; + wchar_t oneChar; for (int16_t i = 1; i < tempStr.GetLength() - 1; i++) { oneChar = tempStr[i]; switch (oneChar) { diff --git a/xfa/fxfa/fxfa_basic.h b/xfa/fxfa/fxfa_basic.h index d16f50fd90..a33f8c8153 100644 --- a/xfa/fxfa/fxfa_basic.h +++ b/xfa/fxfa/fxfa_basic.h @@ -90,9 +90,9 @@ enum XFA_XDPPACKET_FLAGS { }; struct XFA_PACKETINFO { uint32_t uHash; - const FX_WCHAR* pName; + const wchar_t* pName; XFA_XDPPACKET eName; - const FX_WCHAR* pURI; + const wchar_t* pURI; uint32_t eFlags; }; @@ -928,7 +928,7 @@ enum class XFA_Element : int32_t { }; struct XFA_ELEMENTINFO { uint32_t uHash; - const FX_WCHAR* pName; + const wchar_t* pName; XFA_Element eName; uint32_t dwPackets; XFA_ObjectType eObjectType; @@ -944,7 +944,7 @@ enum XFA_ATTRIBUTETYPE { }; struct XFA_ATTRIBUTEINFO { uint32_t uHash; - const FX_WCHAR* pName; + const wchar_t* pName; XFA_ATTRIBUTE eName; XFA_ATTRIBUTETYPE eType; uint32_t dwPackets; @@ -974,7 +974,7 @@ struct XFA_PROPERTY { struct XFA_ATTRIBUTEENUMINFO { uint32_t uHash; - const FX_WCHAR* pName; + const wchar_t* pName; XFA_ATTRIBUTEENUM eName; }; @@ -1004,7 +1004,7 @@ class CXFA_Object; typedef void (CXFA_Object::*XFA_METHOD_CALLBACK)(CFXJSE_Arguments* pArguments); struct XFA_METHODINFO { uint32_t uHash; - const FX_WCHAR* pName; + const wchar_t* pName; XFA_METHOD_CALLBACK lpfnCallback; }; @@ -1017,7 +1017,7 @@ enum XFA_SCRIPT_TYPE { }; struct XFA_SCRIPTATTRIBUTEINFO { uint32_t uHash; - const FX_WCHAR* pName; + const wchar_t* pName; XFA_ATTRIBUTE_CALLBACK lpfnCallback; int32_t eAttribute; uint16_t eValueType; diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp index a06e02f56d..94958a58e6 100644 --- a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp @@ -322,10 +322,10 @@ static int32_t XFA_FilterName(const CFX_WideStringC& wsExpression, if (nStart >= iLength) { return iLength; } - FX_WCHAR* pBuf = wsFilter.GetBuffer(iLength - nStart); + wchar_t* pBuf = wsFilter.GetBuffer(iLength - nStart); int32_t nCount = 0; - const FX_WCHAR* pSrc = wsExpression.c_str(); - FX_WCHAR wCur; + const wchar_t* pSrc = wsExpression.c_str(); + wchar_t wCur; while (nStart < iLength) { wCur = pSrc[nStart++]; if (wCur == ',') { diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp index 152b568619..aa3117a734 100644 --- a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp @@ -50,7 +50,7 @@ void CScript_LayoutPseudoModel::HWXY(CFXJSE_Arguments* pArguments, XFA_LAYOUTMODEL_HWXY layoutModel) { int32_t iLength = pArguments->GetLength(); if (iLength < 1 || iLength > 3) { - const FX_WCHAR* methodName = nullptr; + const wchar_t* methodName = nullptr; switch (layoutModel) { case XFA_LAYOUTMODEL_H: methodName = L"h"; @@ -451,7 +451,7 @@ void CScript_LayoutPseudoModel::PageImp(CFXJSE_Arguments* pArguments, bool bAbsPage) { int32_t iLength = pArguments->GetLength(); if (iLength != 1) { - const FX_WCHAR* methodName; + const wchar_t* methodName; if (bAbsPage) { methodName = L"absPage"; } else { diff --git a/xfa/fxfa/parser/cxfa_data.cpp b/xfa/fxfa/parser/cxfa_data.cpp index 19f85088b8..3544a1de4c 100644 --- a/xfa/fxfa/parser/cxfa_data.cpp +++ b/xfa/fxfa/parser/cxfa_data.cpp @@ -17,7 +17,7 @@ FX_ARGB CXFA_Data::ToColor(const CFX_WideStringC& wsValue) { return 0xff000000; int cc = 0; - const FX_WCHAR* str = wsValue.c_str(); + const wchar_t* str = wsValue.c_str(); int len = wsValue.GetLength(); while (FXSYS_iswspace(str[cc]) && cc < len) cc++; diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp index fe9947527d..4d3b039b33 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp @@ -49,7 +49,7 @@ CFX_WideString ExportEncodeContent(const CFX_WideStringC& str) { CFX_WideTextBuf textBuf; int32_t iLen = str.GetLength(); for (int32_t i = 0; i < iLen; i++) { - FX_WCHAR ch = str.GetAt(i); + wchar_t ch = str.GetAt(i); if (!FDE_IsXMLValidChar(ch)) continue; @@ -332,7 +332,7 @@ void RegenerateFormFile_Container(CXFA_Node* pNode, RegenerateFormFile_Changed(pNode, buf, bSaveXML); FX_STRSIZE nLen = buf.GetLength(); if (nLen > 0) - pStream->WriteString((const FX_WCHAR*)buf.GetBuffer(), nLen); + pStream->WriteString((const wchar_t*)buf.GetBuffer(), nLen); return; } @@ -379,21 +379,21 @@ void RegenerateFormFile_Container(CXFA_Node* pNode, void XFA_DataExporter_RegenerateFormFile( CXFA_Node* pNode, const CFX_RetainPtr<IFGAS_Stream>& pStream, - const FX_CHAR* pChecksum, + const char* pChecksum, bool bSaveXML) { if (pNode->IsModelNode()) { - static const FX_WCHAR s_pwsTagName[] = L"<form"; - static const FX_WCHAR s_pwsClose[] = L"</form\n>"; + static const wchar_t s_pwsTagName[] = L"<form"; + static const wchar_t s_pwsClose[] = L"</form\n>"; pStream->WriteString(s_pwsTagName, FXSYS_wcslen(s_pwsTagName)); if (pChecksum) { - static const FX_WCHAR s_pwChecksum[] = L" checksum=\""; + static const wchar_t s_pwChecksum[] = L" checksum=\""; CFX_WideString wsChecksum = CFX_WideString::FromUTF8(pChecksum); pStream->WriteString(s_pwChecksum, FXSYS_wcslen(s_pwChecksum)); pStream->WriteString(wsChecksum.c_str(), wsChecksum.GetLength()); pStream->WriteString(L"\"", 1); } pStream->WriteString(L" xmlns=\"", FXSYS_wcslen(L" xmlns=\"")); - const FX_WCHAR* pURI = XFA_GetPacketByIndex(XFA_PACKET_Form)->pURI; + const wchar_t* pURI = XFA_GetPacketByIndex(XFA_PACKET_Form)->pURI; pStream->WriteString(pURI, FXSYS_wcslen(pURI)); CFX_WideString wsVersionNumber; RecognizeXFAVersionNumber( @@ -460,7 +460,7 @@ bool CXFA_DataExporter::Export( const CFX_RetainPtr<IFX_SeekableWriteStream>& pWrite, CXFA_Node* pNode, uint32_t dwFlag, - const FX_CHAR* pChecksum) { + const char* pChecksum) { ASSERT(pWrite); if (!pWrite) return false; @@ -478,19 +478,19 @@ bool CXFA_DataExporter::Export( bool CXFA_DataExporter::Export(const CFX_RetainPtr<IFGAS_Stream>& pStream, CXFA_Node* pNode, uint32_t dwFlag, - const FX_CHAR* pChecksum) { + const char* pChecksum) { CFDE_XMLDoc* pXMLDoc = m_pDocument->GetXMLDoc(); if (pNode->IsModelNode()) { switch (pNode->GetPacketID()) { case XFA_XDPPACKET_XDP: { - static const FX_WCHAR s_pwsPreamble[] = + static const wchar_t s_pwsPreamble[] = L"<xdp:xdp xmlns:xdp=\"http://ns.adobe.com/xdp/\">"; pStream->WriteString(s_pwsPreamble, FXSYS_wcslen(s_pwsPreamble)); for (CXFA_Node* pChild = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { Export(pStream, pChild, dwFlag, pChecksum); } - static const FX_WCHAR s_pwsPostamble[] = L"</xdp:xdp\n>"; + static const wchar_t s_pwsPostamble[] = L"</xdp:xdp\n>"; pStream->WriteString(s_pwsPostamble, FXSYS_wcslen(s_pwsPostamble)); break; } diff --git a/xfa/fxfa/parser/cxfa_dataexporter.h b/xfa/fxfa/parser/cxfa_dataexporter.h index 0e5de00796..2037167fba 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.h +++ b/xfa/fxfa/parser/cxfa_dataexporter.h @@ -23,13 +23,13 @@ class CXFA_DataExporter { bool Export(const CFX_RetainPtr<IFX_SeekableWriteStream>& pWrite, CXFA_Node* pNode, uint32_t dwFlag, - const FX_CHAR* pChecksum); + const char* pChecksum); protected: bool Export(const CFX_RetainPtr<IFGAS_Stream>& pStream, CXFA_Node* pNode, uint32_t dwFlag, - const FX_CHAR* pChecksum); + const char* pChecksum); CXFA_Document* const m_pDocument; }; diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index cd6b84424c..086c0e929d 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -350,7 +350,7 @@ CXFA_Node* CreateInstance(CXFA_Node* pInstMgrNode, bool bDataMerge) { struct XFA_ExecEventParaInfo { public: uint32_t m_uHash; - const FX_WCHAR* m_lpcEventName; + const wchar_t* m_lpcEventName; XFA_EVENTTYPE m_eventType; uint32_t m_validFlags; }; @@ -408,11 +408,11 @@ void StrToRGB(const CFX_WideString& strRGB, g = 0; b = 0; - FX_WCHAR zero = '0'; + wchar_t zero = '0'; int32_t iIndex = 0; int32_t iLen = strRGB.GetLength(); for (int32_t i = 0; i < iLen; ++i) { - FX_WCHAR ch = strRGB.GetAt(i); + wchar_t ch = strRGB.GetAt(i); if (ch == L',') ++iIndex; if (iIndex > 2) @@ -3949,7 +3949,7 @@ bool CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr, void* pValue = nullptr; if (XFA_GetAttributeDefaultValue(pValue, GetElementType(), eAttr, XFA_ATTRIBUTETYPE_Cdata, m_ePacket)) { - wsValue = (const FX_WCHAR*)pValue; + wsValue = (const wchar_t*)pValue; return true; } return false; @@ -3977,7 +3977,7 @@ bool CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr, void* pValue = nullptr; if (XFA_GetAttributeDefaultValue(pValue, GetElementType(), eAttr, XFA_ATTRIBUTETYPE_Cdata, m_ePacket)) { - wsValue = (CFX_WideStringC)(const FX_WCHAR*)pValue; + wsValue = (CFX_WideStringC)(const wchar_t*)pValue; return true; } return false; @@ -4898,7 +4898,7 @@ bool CXFA_Node::GetMapModuleValue(void* pKey, void*& pValue) { void CXFA_Node::SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue) { SetMapModuleBuffer(pKey, (void*)wsValue.c_str(), - wsValue.GetLength() * sizeof(FX_WCHAR)); + wsValue.GetLength() * sizeof(wchar_t)); } bool CXFA_Node::GetMapModuleString(void* pKey, CFX_WideStringC& wsValue) { @@ -4907,7 +4907,7 @@ bool CXFA_Node::GetMapModuleString(void* pKey, CFX_WideStringC& wsValue) { if (!GetMapModuleBuffer(pKey, pValue, iBytes)) { return false; } - wsValue = CFX_WideStringC((const FX_WCHAR*)pValue, iBytes / sizeof(FX_WCHAR)); + wsValue = CFX_WideStringC((const wchar_t*)pValue, iBytes / sizeof(wchar_t)); return true; } diff --git a/xfa/fxfa/parser/cxfa_nodehelper.cpp b/xfa/fxfa/parser/cxfa_nodehelper.cpp index 2290892318..641697dc81 100644 --- a/xfa/fxfa/parser/cxfa_nodehelper.cpp +++ b/xfa/fxfa/parser/cxfa_nodehelper.cpp @@ -25,7 +25,7 @@ CXFA_NodeHelper::CXFA_NodeHelper() CXFA_NodeHelper::~CXFA_NodeHelper() {} CXFA_Node* CXFA_NodeHelper::ResolveNodes_GetOneChild(CXFA_Node* parent, - const FX_WCHAR* pwsName, + const wchar_t* pwsName, bool bIsClassName) { if (!parent) { return nullptr; @@ -316,7 +316,7 @@ bool CXFA_NodeHelper::CreateNode_ForCondition(CFX_WideString& wsCondition) { if (wsCondition.GetAt(0) == '[') { int32_t i = 1; for (; i < iLen; ++i) { - FX_WCHAR ch = wsCondition[i]; + wchar_t ch = wsCondition[i]; if (ch == ' ') { continue; } diff --git a/xfa/fxfa/parser/cxfa_nodehelper.h b/xfa/fxfa/parser/cxfa_nodehelper.h index 5097feabac..1db8321690 100644 --- a/xfa/fxfa/parser/cxfa_nodehelper.h +++ b/xfa/fxfa/parser/cxfa_nodehelper.h @@ -23,7 +23,7 @@ class CXFA_NodeHelper { ~CXFA_NodeHelper(); CXFA_Node* ResolveNodes_GetOneChild(CXFA_Node* parent, - const FX_WCHAR* pwsName, + const wchar_t* pwsName, bool bIsClassName = false); CXFA_Node* ResolveNodes_GetParent( CXFA_Node* pNode, diff --git a/xfa/fxfa/parser/cxfa_object.cpp b/xfa/fxfa/parser/cxfa_object.cpp index c8cd354b48..4964265b4d 100644 --- a/xfa/fxfa/parser/cxfa_object.cpp +++ b/xfa/fxfa/parser/cxfa_object.cpp @@ -63,7 +63,7 @@ void CXFA_Object::ThrowArgumentMismatchException() const { ThrowException(L"Argument mismatch in property or function argument."); } -void CXFA_Object::ThrowException(const FX_WCHAR* str, ...) const { +void CXFA_Object::ThrowException(const wchar_t* str, ...) const { CFX_WideString wsMessage; va_list arg_ptr; va_start(arg_ptr, str); diff --git a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp index 3ef4e976ca..94fd761bdf 100644 --- a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp @@ -34,7 +34,7 @@ int32_t CXFA_ResolveProcessor::Resolve(CXFA_ResolveNodesData& rnd) { if (rnd.m_dwStyles & XFA_RESOLVENODE_AnyChild) { return ResolveAnyChild(rnd); } - FX_WCHAR wch = rnd.m_wsName.GetAt(0); + wchar_t wch = rnd.m_wsName.GetAt(0); switch (wch) { case '$': return ResolveDollar(rnd); @@ -517,14 +517,14 @@ int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression, } CFX_WideString& wsName = rnd.m_wsName; CFX_WideString& wsCondition = rnd.m_wsCondition; - FX_WCHAR* pNameBuf = wsName.GetBuffer(iLength - nStart); - FX_WCHAR* pConditionBuf = wsCondition.GetBuffer(iLength - nStart); + wchar_t* pNameBuf = wsName.GetBuffer(iLength - nStart); + wchar_t* pConditionBuf = wsCondition.GetBuffer(iLength - nStart); int32_t nNameCount = 0; int32_t nConditionCount = 0; CFX_ArrayTemplate<int32_t> stack; int32_t nType = -1; - const FX_WCHAR* pSrc = wsExpression.c_str(); - FX_WCHAR wPrev = 0, wCur; + const wchar_t* pSrc = wsExpression.c_str(); + wchar_t wPrev = 0, wCur; bool bIsCondition = false; while (nStart < iLength) { wCur = pSrc[nStart++]; @@ -537,7 +537,7 @@ int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression, rnd.m_dwStyles |= XFA_RESOLVENODE_AnyChild; continue; } - FX_WCHAR wLookahead = nStart < iLength ? pSrc[nStart] : 0; + wchar_t wLookahead = nStart < iLength ? pSrc[nStart] : 0; if (wLookahead != '[' && wLookahead != '(') { if (nType < 0) { break; @@ -617,7 +617,7 @@ void CXFA_ResolveProcessor::ConditionArray(int32_t iCurIndex, bool bAll = false; int32_t i = 1; for (; i < iLen; ++i) { - FX_WCHAR ch = wsCondition[i]; + wchar_t ch = wsCondition[i]; if (ch == ' ') { continue; } @@ -746,7 +746,7 @@ void CXFA_ResolveProcessor::FilterCondition(CXFA_ResolveNodesData& rnd, return; } } - FX_WCHAR wTypeChar = wsCondition[0]; + wchar_t wTypeChar = wsCondition[0]; switch (wTypeChar) { case '[': ConditionArray(iCurrIndex, wsCondition, iFoundCount, rnd); diff --git a/xfa/fxfa/parser/cxfa_widetextread.cpp b/xfa/fxfa/parser/cxfa_widetextread.cpp index 34fa6b9c5e..bba7cbdaa1 100644 --- a/xfa/fxfa/parser/cxfa_widetextread.cpp +++ b/xfa/fxfa/parser/cxfa_widetextread.cpp @@ -21,7 +21,7 @@ uint32_t CXFA_WideTextRead::GetAccessModes() const { } int32_t CXFA_WideTextRead::GetLength() const { - return m_wsBuffer.GetLength() * sizeof(FX_WCHAR); + return m_wsBuffer.GetLength() * sizeof(wchar_t); } int32_t CXFA_WideTextRead::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) { @@ -41,7 +41,7 @@ int32_t CXFA_WideTextRead::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) { } int32_t CXFA_WideTextRead::GetPosition() { - return m_iPosition * sizeof(FX_WCHAR); + return m_iPosition * sizeof(wchar_t); } bool CXFA_WideTextRead::IsEOF() const { @@ -52,7 +52,7 @@ int32_t CXFA_WideTextRead::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { return 0; } -int32_t CXFA_WideTextRead::ReadString(FX_WCHAR* pStr, +int32_t CXFA_WideTextRead::ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) { iMaxLength = std::min(iMaxLength, m_wsBuffer.GetLength() - m_iPosition); @@ -70,7 +70,7 @@ int32_t CXFA_WideTextRead::WriteData(const uint8_t* pBuffer, return 0; } -int32_t CXFA_WideTextRead::WriteString(const FX_WCHAR* pStr, int32_t iLength) { +int32_t CXFA_WideTextRead::WriteString(const wchar_t* pStr, int32_t iLength) { return 0; } @@ -83,7 +83,7 @@ int32_t CXFA_WideTextRead::GetBOM(uint8_t bom[4]) const { } uint16_t CXFA_WideTextRead::GetCodePage() const { - return (sizeof(FX_WCHAR) == 2) ? FX_CODEPAGE_UTF16LE : FX_CODEPAGE_UTF32LE; + return (sizeof(wchar_t) == 2) ? FX_CODEPAGE_UTF16LE : FX_CODEPAGE_UTF32LE; } uint16_t CXFA_WideTextRead::SetCodePage(uint16_t wCodePage) { diff --git a/xfa/fxfa/parser/cxfa_widetextread.h b/xfa/fxfa/parser/cxfa_widetextread.h index 2ccb042908..6c4a97f358 100644 --- a/xfa/fxfa/parser/cxfa_widetextread.h +++ b/xfa/fxfa/parser/cxfa_widetextread.h @@ -22,9 +22,9 @@ class CXFA_WideTextRead : public IFGAS_Stream { int32_t GetPosition() override; bool IsEOF() const override; int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override; - int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override; + int32_t ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) override; int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override; - int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override; + int32_t WriteString(const wchar_t* pStr, int32_t iLength) override; void Flush() override {} bool SetLength(int32_t iLength) override; int32_t GetBOM(uint8_t bom[4]) const override; diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index d3533c277a..ca0303d00c 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -225,7 +225,7 @@ CFX_WideStringC GetAttributeDefaultValue_Cdata(XFA_Element eElement, void* pValue; if (XFA_GetAttributeDefaultValue(pValue, eElement, eAttribute, XFA_ATTRIBUTETYPE_Cdata, dwPacket)) { - return (const FX_WCHAR*)pValue; + return (const wchar_t*)pValue; } return nullptr; } @@ -1292,24 +1292,24 @@ bool CXFA_WidgetData::GetBarcodeAttribute_DataLength(int32_t& val) { return false; } -bool CXFA_WidgetData::GetBarcodeAttribute_StartChar(FX_CHAR& val) { +bool CXFA_WidgetData::GetBarcodeAttribute_StartChar(char& val) { CXFA_Node* pUIChild = GetUIChild(); CFX_WideStringC wsStartEndChar; if (pUIChild->TryCData(XFA_ATTRIBUTE_StartChar, wsStartEndChar)) { if (wsStartEndChar.GetLength()) { - val = (FX_CHAR)wsStartEndChar.GetAt(0); + val = (char)wsStartEndChar.GetAt(0); return true; } } return false; } -bool CXFA_WidgetData::GetBarcodeAttribute_EndChar(FX_CHAR& val) { +bool CXFA_WidgetData::GetBarcodeAttribute_EndChar(char& val) { CXFA_Node* pUIChild = GetUIChild(); CFX_WideStringC wsStartEndChar; if (pUIChild->TryCData(XFA_ATTRIBUTE_EndChar, wsStartEndChar)) { if (wsStartEndChar.GetLength()) { - val = (FX_CHAR)wsStartEndChar.GetAt(0); + val = (char)wsStartEndChar.GetAt(0); return true; } } @@ -1919,7 +1919,7 @@ CFX_WideString CXFA_WidgetData::NumericLimit(const CFX_WideString& wsValue, i++; } for (; i < iCount; i++) { - FX_WCHAR wc = wsValue[i]; + wchar_t wc = wsValue[i]; if (FXSYS_isDecimalDigit(wc)) { if (iLead >= 0) { iLead_++; diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h index 4f5db3bad6..3eca270320 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.h +++ b/xfa/fxfa/parser/cxfa_widgetdata.h @@ -140,8 +140,8 @@ class CXFA_WidgetData : public CXFA_Data { bool GetBarcodeAttribute_CharEncoding(int32_t& val); bool GetBarcodeAttribute_Checksum(bool& val); bool GetBarcodeAttribute_DataLength(int32_t& val); - bool GetBarcodeAttribute_StartChar(FX_CHAR& val); - bool GetBarcodeAttribute_EndChar(FX_CHAR& val); + bool GetBarcodeAttribute_StartChar(char& val); + bool GetBarcodeAttribute_EndChar(char& val); bool GetBarcodeAttribute_ECLevel(int32_t& val); bool GetBarcodeAttribute_ModuleWidth(int32_t& val); bool GetBarcodeAttribute_ModuleHeight(int32_t& val); diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp index dd04668a33..193ffdd497 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp @@ -26,17 +26,17 @@ namespace { -std::vector<CFX_WideString> SeparateStringW(const FX_WCHAR* pStr, +std::vector<CFX_WideString> SeparateStringW(const wchar_t* pStr, int32_t iStrLen, - FX_WCHAR delimiter) { + wchar_t delimiter) { std::vector<CFX_WideString> ret; if (!pStr) return ret; if (iStrLen < 0) iStrLen = FXSYS_wcslen(pStr); - const FX_WCHAR* pToken = pStr; - const FX_WCHAR* pEnd = pStr + iStrLen; + const wchar_t* pToken = pStr; + const wchar_t* pEnd = pStr + iStrLen; while (true) { if (pStr >= pEnd || delimiter == *pStr) { ret.push_back(CFX_WideString(pToken, pStr - pToken)); diff --git a/xfa/fxfa/parser/xfa_locale.cpp b/xfa/fxfa/parser/xfa_locale.cpp index d835eb2bc7..a9ddbcec3c 100644 --- a/xfa/fxfa/parser/xfa_locale.cpp +++ b/xfa/fxfa/parser/xfa_locale.cpp @@ -14,10 +14,10 @@ #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxfa/parser/xfa_utils.h" -static const FX_WCHAR g_FX_Percent[] = L"z,zzz,zzz,zzz,zzz,zzz%"; -static const FX_WCHAR g_FX_Currency[] = L"$z,zzz,zzz,zzz,zzz,zz9.99"; -static const FX_WCHAR g_FX_Decimal[] = L"z,zzz,zzz,zzz,zzz,zz9.zzz"; -static const FX_WCHAR g_FX_Integer[] = L"z,zzz,zzz,zzz,zzz,zzz"; +static const wchar_t g_FX_Percent[] = L"z,zzz,zzz,zzz,zzz,zzz%"; +static const wchar_t g_FX_Currency[] = L"$z,zzz,zzz,zzz,zzz,zz9.99"; +static const wchar_t g_FX_Decimal[] = L"z,zzz,zzz,zzz,zzz,zz9.zzz"; +static const wchar_t g_FX_Integer[] = L"z,zzz,zzz,zzz,zzz,zzz"; CXFA_XMLLocale::CXFA_XMLLocale(std::unique_ptr<CXML_Element> pLocaleData) : m_pLocaleData(std::move(pLocaleData)) {} diff --git a/xfa/fxfa/parser/xfa_localevalue.cpp b/xfa/fxfa/parser/xfa_localevalue.cpp index 7e92535c3d..6dd02e6a85 100644 --- a/xfa/fxfa/parser/xfa_localevalue.cpp +++ b/xfa/fxfa/parser/xfa_localevalue.cpp @@ -218,7 +218,7 @@ FX_FLOAT CXFA_LocaleValue::GetNum() const { int32_t nExponent = 0; int cc = 0; bool bNegative = false, bExpSign = false; - const FX_WCHAR* str = m_wsValue.c_str(); + const wchar_t* str = m_wsValue.c_str(); int len = m_wsValue.GetLength(); while (FXSYS_iswspace(str[cc]) && cc < len) { cc++; @@ -294,7 +294,7 @@ FX_DOUBLE CXFA_LocaleValue::GetDoubleNum() const { int32_t nExponent = 0; int32_t cc = 0; bool bNegative = false, bExpSign = false; - const FX_WCHAR* str = m_wsValue.c_str(); + const wchar_t* str = m_wsValue.c_str(); int len = m_wsValue.GetLength(); while (FXSYS_iswspace(str[cc]) && cc < len) { cc++; @@ -605,7 +605,7 @@ bool CXFA_LocaleValue::ValidateCanonicalDate(const CFX_WideString& wsDate, uint16_t wYear = 0; uint16_t wMonth = 0; uint16_t wDay = 0; - const FX_WCHAR* pDate = wsDate.c_str(); + const wchar_t* pDate = wsDate.c_str(); int nIndex = 0, nStart = 0; while (pDate[nIndex] != '\0' && nIndex < wCountY) { if (!FXSYS_isDecimalDigit(pDate[nIndex])) { @@ -691,7 +691,7 @@ bool CXFA_LocaleValue::ValidateCanonicalTime(const CFX_WideString& wsTime) { uint16_t wMinute = 0; uint16_t wSecond = 0; uint16_t wFraction = 0; - const FX_WCHAR* pTime = wsTime.c_str(); + const wchar_t* pTime = wsTime.c_str(); int nIndex = 0; int nStart = 0; while (nIndex - nStart < wCountH && pTime[nIndex]) { @@ -880,7 +880,7 @@ void CXFA_LocaleValue::GetNumbericFormat(CFX_WideString& wsFormat, ASSERT(nIntLen >= -1 && nDecLen >= -1); int32_t nTotalLen = (nIntLen >= 0 ? nIntLen : 2) + (bSign ? 1 : 0) + (nDecLen >= 0 ? nDecLen : 2) + (nDecLen == 0 ? 0 : 1); - FX_WCHAR* lpBuf = wsFormat.GetBuffer(nTotalLen); + wchar_t* lpBuf = wsFormat.GetBuffer(nTotalLen); int32_t nPos = 0; if (bSign) { lpBuf[nPos++] = L's'; @@ -915,11 +915,11 @@ bool CXFA_LocaleValue::ValidateNumericTemp(CFX_WideString& wsNumeric, if (wsFormat.IsEmpty() || wsNumeric.IsEmpty()) { return true; } - const FX_WCHAR* pNum = wsNumeric.c_str(); - const FX_WCHAR* pFmt = wsFormat.c_str(); + const wchar_t* pNum = wsNumeric.c_str(); + const wchar_t* pFmt = wsFormat.c_str(); int32_t n = 0, nf = 0; - FX_WCHAR c = pNum[n]; - FX_WCHAR cf = pFmt[nf]; + wchar_t c = pNum[n]; + wchar_t cf = pFmt[nf]; if (cf == L's') { if (c == L'-' || c == L'+') { ++n; diff --git a/xfa/fxfa/parser/xfa_object.h b/xfa/fxfa/parser/xfa_object.h index e4f7ab2cb1..2300cc2209 100644 --- a/xfa/fxfa/parser/xfa_object.h +++ b/xfa/fxfa/parser/xfa_object.h @@ -98,7 +98,7 @@ class CXFA_Object : public CFXJSE_HostObject { void ThrowParamCountMismatchException(const CFX_WideString& method) const; protected: - void ThrowException(const FX_WCHAR* str, ...) const; + void ThrowException(const wchar_t* str, ...) const; CXFA_Document* const m_pDocument; const XFA_ObjectType m_objectType; diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp index 216c5a56c4..ef7e939a85 100644 --- a/xfa/fxfa/parser/xfa_utils.cpp +++ b/xfa/fxfa/parser/xfa_utils.cpp @@ -44,7 +44,7 @@ FX_DOUBLE WideStringToDouble(const CFX_WideString& wsStringVal) { int32_t cc = 0; bool bNegative = false; bool bExpSign = false; - const FX_WCHAR* str = wsValue.c_str(); + const wchar_t* str = wsValue.c_str(); int32_t len = wsValue.GetLength(); if (str[0] == '+') { cc++; diff --git a/xfa/fxfa/parser/xfa_utils.h b/xfa/fxfa/parser/xfa_utils.h index 3e95612132..a5bdeea192 100644 --- a/xfa/fxfa/parser/xfa_utils.h +++ b/xfa/fxfa/parser/xfa_utils.h @@ -154,7 +154,7 @@ void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode); void XFA_DataExporter_RegenerateFormFile( CXFA_Node* pNode, const CFX_RetainPtr<IFGAS_Stream>& pStream, - const FX_CHAR* pChecksum = nullptr, + const char* pChecksum = nullptr, bool bSaveXML = false); const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute( diff --git a/xfa/fxfa/xfa_ffwidget.h b/xfa/fxfa/xfa_ffwidget.h index 5972b8ad70..5345bc451e 100644 --- a/xfa/fxfa/xfa_ffwidget.h +++ b/xfa/fxfa/xfa_ffwidget.h @@ -173,7 +173,7 @@ CFX_DIBitmap* XFA_LoadImageFromBuffer( int32_t& iImageYDpi); FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideString& wsType); -FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len); +char* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len); void XFA_RectWidthoutMargin(CFX_RectF& rt, const CXFA_Margin& mg, bool bUI = false); diff --git a/xfa/fxfa/xfa_fontmgr.h b/xfa/fxfa/xfa_fontmgr.h index f00b069ef0..b3ed8ab236 100644 --- a/xfa/fxfa/xfa_fontmgr.h +++ b/xfa/fxfa/xfa_fontmgr.h @@ -21,8 +21,8 @@ class CPDF_Font; struct XFA_FONTINFO { uint32_t dwFontNameHash; - const FX_WCHAR* pPsName; - const FX_WCHAR* pReplaceFont; + const wchar_t* pPsName; + const wchar_t* pReplaceFont; uint16_t dwStyles; uint16_t wCodePage; }; @@ -56,7 +56,7 @@ class CXFA_PDFFontMgr { CPDF_Font** pPDFFont, bool bStrictMatch); bool GetCharWidth(const CFX_RetainPtr<CFGAS_GEFont>& pFont, - FX_WCHAR wUnicode, + wchar_t wUnicode, bool bCharCode, int32_t* pWidth); void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont, CPDF_Font* pPDFFont); |