From 812e96c2b4c5908a1979da5e27cdcecda0d1dfc9 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 13 Mar 2017 16:43:37 -0400 Subject: Replace FX_CHAR and FX_WCHAR with underlying types. Change-Id: I96e0a20d66b9184d22f64d8e4ce0dadd5a78c1e8 Reviewed-on: https://pdfium-review.googlesource.com/2967 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- core/fdrm/crypto/fx_crypt_sha.cpp | 4 +- core/fpdfapi/edit/fpdf_edit_create.cpp | 8 +- core/fpdfapi/font/cpdf_cidfont.cpp | 42 +++---- core/fpdfapi/font/cpdf_cidfont.h | 10 +- core/fpdfapi/font/cpdf_font.cpp | 16 +-- core/fpdfapi/font/cpdf_font.h | 16 +-- core/fpdfapi/font/cpdf_fontencoding.cpp | 29 +++-- core/fpdfapi/font/cpdf_fontencoding.h | 19 ++- core/fpdfapi/font/cpdf_simplefont.cpp | 4 +- core/fpdfapi/font/cpdf_simplefont.h | 2 +- core/fpdfapi/font/cpdf_truetypefont.cpp | 7 +- core/fpdfapi/font/cpdf_type1font.cpp | 33 +++--- core/fpdfapi/font/cpdf_type1font.h | 2 +- core/fpdfapi/font/cpdf_type3font.cpp | 2 +- core/fpdfapi/font/font_int.h | 10 +- core/fpdfapi/font/fpdf_font.cpp | 12 +- core/fpdfapi/font/fpdf_font_cid.cpp | 18 +-- core/fpdfapi/page/cpdf_image.cpp | 16 +-- core/fpdfapi/page/cpdf_psengine.h | 2 +- core/fpdfapi/page/cpdf_streamcontentparser.cpp | 4 +- core/fpdfapi/page/cpdf_streamparser.cpp | 6 +- core/fpdfapi/page/cpdf_textobject.cpp | 2 +- core/fpdfapi/page/fpdf_page_func.cpp | 6 +- core/fpdfapi/parser/cpdf_document.cpp | 23 ++-- core/fpdfapi/parser/cpdf_document.h | 4 +- core/fpdfapi/parser/cpdf_parser.cpp | 14 +-- core/fpdfapi/parser/cpdf_parser.h | 2 +- core/fpdfapi/parser/cpdf_parser_unittest.cpp | 2 +- core/fpdfapi/parser/cpdf_syntax_parser.cpp | 10 +- core/fpdfapi/parser/fpdf_parser_decode.cpp | 8 +- core/fpdfapi/parser/fpdf_parser_decode.h | 2 +- .../fpdfapi/parser/fpdf_parser_decode_unittest.cpp | 6 +- core/fpdfapi/parser/fpdf_parser_utility.cpp | 6 +- core/fpdfapi/render/cpdf_type3cache.cpp | 2 +- core/fpdfdoc/cpdf_aaction.cpp | 6 +- core/fpdfdoc/cpdf_action.cpp | 2 +- core/fpdfdoc/cpdf_annot.cpp | 2 +- core/fpdfdoc/cpdf_bookmark.cpp | 4 +- core/fpdfdoc/cpdf_dest.cpp | 4 +- core/fpdfdoc/cpdf_filespec.cpp | 4 +- core/fpdfdoc/cpdf_formcontrol.cpp | 2 +- core/fpdfdoc/cpdf_formfield.cpp | 2 +- core/fpdfdoc/cpdf_formfield.h | 2 +- core/fpdfdoc/cpdf_interform.cpp | 22 ++-- core/fpdfdoc/cpdf_interform.h | 4 +- core/fpdfdoc/cpdf_pagelabel.cpp | 2 +- core/fpdfdoc/cpdf_variabletext.cpp | 2 +- core/fpdfdoc/cpdf_variabletext.h | 2 +- core/fpdftext/cpdf_linkextract.cpp | 6 +- core/fpdftext/cpdf_textpage.cpp | 52 ++++---- core/fpdftext/cpdf_textpage.h | 16 +-- core/fpdftext/cpdf_textpagefind.cpp | 23 ++-- core/fpdftext/cpdf_textpagefind.h | 4 +- core/fxcodec/codec/ccodec_bmpmodule.cpp | 2 +- core/fxcodec/codec/ccodec_bmpmodule.h | 2 +- core/fxcodec/codec/ccodec_gifmodule.cpp | 2 +- core/fxcodec/codec/ccodec_gifmodule.h | 2 +- core/fxcodec/codec/ccodec_pngmodule.cpp | 4 +- core/fxcodec/codec/ccodec_pngmodule.h | 2 +- core/fxcodec/codec/ccodec_tiffmodule.cpp | 2 +- core/fxcodec/lbmp/fx_bmp.cpp | 2 +- core/fxcodec/lbmp/fx_bmp.h | 6 +- core/fxcodec/lgif/fx_gif.cpp | 10 +- core/fxcodec/lgif/fx_gif.h | 12 +- core/fxcrt/cfx_string_c_template.h | 4 +- core/fxcrt/cfx_string_data_template.h | 4 +- core/fxcrt/fx_arabic.cpp | 30 ++--- core/fxcrt/fx_arabic.h | 14 +-- core/fxcrt/fx_basic.h | 26 ++-- core/fxcrt/fx_basic_bstring.cpp | 95 ++++++++------- core/fxcrt/fx_basic_bstring_unittest.cpp | 34 +++--- core/fxcrt/fx_basic_buffer.cpp | 28 ++--- core/fxcrt/fx_basic_gcc.cpp | 60 +++++----- core/fxcrt/fx_basic_utf.cpp | 6 +- core/fxcrt/fx_basic_util.cpp | 4 +- core/fxcrt/fx_basic_wstring.cpp | 104 ++++++++-------- core/fxcrt/fx_basic_wstring_unittest.cpp | 32 ++--- core/fxcrt/fx_bidi.cpp | 2 +- core/fxcrt/fx_bidi.h | 4 +- core/fxcrt/fx_bidi_unittest.cpp | 24 ++-- core/fxcrt/fx_ext.h | 22 ++-- core/fxcrt/fx_extension.cpp | 40 +++---- core/fxcrt/fx_stream.h | 10 +- core/fxcrt/fx_string.h | 132 ++++++++++----------- core/fxcrt/fx_system.h | 30 +++-- core/fxcrt/fx_system_unittest.cpp | 18 +-- core/fxcrt/fx_ucd.h | 14 +-- core/fxcrt/fx_unicode.cpp | 12 +- core/fxcrt/fx_xml_parser.cpp | 4 +- core/fxge/android/cfpf_skiafont.cpp | 2 +- core/fxge/android/cfpf_skiafont.h | 2 +- core/fxge/android/cfpf_skiafontdescriptor.h | 8 +- core/fxge/android/cfpf_skiafontmgr.cpp | 8 +- core/fxge/android/cfpf_skiapathfont.h | 8 +- core/fxge/android/cfx_androidfontinfo.cpp | 4 +- core/fxge/android/cfx_androidfontinfo.h | 4 +- core/fxge/apple/fx_mac_imp.cpp | 8 +- core/fxge/cfx_fontmgr.h | 2 +- core/fxge/cfx_unicodeencodingex.h | 2 +- core/fxge/ge/cfx_folderfontinfo.cpp | 10 +- core/fxge/ge/cfx_folderfontinfo.h | 6 +- core/fxge/ge/cfx_fontmapper.cpp | 23 ++-- core/fxge/ge/cfx_fontmgr.cpp | 2 +- core/fxge/ge/cfx_unicodeencodingex.cpp | 2 +- core/fxge/ge/fx_ge_linux.cpp | 14 +-- core/fxge/ge/fx_text_int.h | 2 +- core/fxge/ifx_systemfontinfo.h | 4 +- core/fxge/win32/cfx_psrenderer.cpp | 28 ++--- core/fxge/win32/cfx_windowsdib.h | 6 +- core/fxge/win32/cpsoutput.cpp | 4 +- core/fxge/win32/cpsoutput.h | 2 +- core/fxge/win32/fx_win32_device.cpp | 22 ++-- core/fxge/win32/fx_win32_dib.cpp | 4 +- core/fxge/win32/fx_win32_gdipext.cpp | 4 +- core/fxge/win32/win32_int.h | 2 +- 115 files changed, 737 insertions(+), 755 deletions(-) (limited to 'core') 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(charcode); + return static_cast(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(&charcode), charsize, &unicode, 1); + int ret = FXSYS_MultiByteToWideChar(g_CharsetCPs[m_pCMap->m_Coding], 0, + reinterpret_cast(&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(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(), charcode); if (!name) return charcode ? static_cast(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(charcode)); + static_cast(charcode)); if (ret == 0) continue; FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[i]); - unicode = static_cast(ret); + unicode = static_cast(ret); break; } if (i == FXFT_Get_Face_CharmapCount(face) && i) { FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[0]); - unicode = static_cast(charcode); + unicode = static_cast(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* result, int nElements); void LoadSubstFont(); - FX_WCHAR GetUnicodeFromCharCode(uint32_t charcode) const; + wchar_t GetUnicodeFromCharCode(uint32_t charcode) const; CFX_MaybeOwned 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(charcode); +int CPDF_Font::AppendChar(char* buf, uint32_t charcode) const { + *buf = static_cast(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::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& 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& charnames, - int charcode); + const char* GetAdobeCharName(int iBaseEncoding, + const std::vector& 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_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 Realize(CFX_WeakPtr 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(key), + return FXSYS_stricmp(static_cast(key), static_cast(element)->m_pStrAdobe); } -const FX_CHAR* GlyphNameRemap(const FX_CHAR* pStrAdobe) { +const char* GlyphNameRemap(const char* pStrAdobe) { const GlyphNameMap* found = static_cast(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(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_CMapManager::LoadPredefinedCMap( const CFX_ByteString& name, bool bPromptCJK) { auto pCMap = pdfium::MakeUnique(); - 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(word.GetAt(i))); + num = num * 10 + FXSYS_toDecimalDigit(static_cast(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_Image::InitJPEG(uint8_t* pData, pDict->SetNewFor("Subtype", "Image"); pDict->SetNewFor("Width", width); pDict->SetNewFor("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("DeviceRGB"); pCS->AddNew(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(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(ch)); + iEscCode = FXSYS_toDecimalDigit(static_cast(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(ch)); + iEscCode * 8 + FXSYS_toDecimalDigit(static_cast(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(ch)); + iEscCode * 8 + FXSYS_toDecimalDigit(static_cast(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(acc.GetData()), + return m_PS.Parse(reinterpret_cast(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 Insert) { + std::function Insert) { CPDF_Dictionary* pFontDict = NewIndirect(); 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 Insert); + std::function 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(ch)) * 10; + m_FileVersion = FXSYS_toDecimalDigit(static_cast(ch)) * 10; if (!m_pSyntax->GetCharAt(7, ch)) return FORMAT_ERROR; if (std::isdigit(ch)) - m_FileVersion += FXSYS_toDecimalDigit(static_cast(ch)); + m_FileVersion += FXSYS_toDecimalDigit(static_cast(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(byte)); + objnum = FXSYS_toDecimalDigit(static_cast(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(byte)); + objnum * 10 + FXSYS_toDecimalDigit(static_cast(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(byte)); + gennum = FXSYS_toDecimalDigit(static_cast(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(byte)); + gennum * 10 + FXSYS_toDecimalDigit(static_cast(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(byte)); + gennum = FXSYS_toDecimalDigit(static_cast(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& 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 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(ch)); + iEscCode = FXSYS_toDecimalDigit(static_cast(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(ch)); + iEscCode * 8 + FXSYS_toDecimalDigit(static_cast(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(ch)); + iEscCode * 8 + FXSYS_toDecimalDigit(static_cast(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(m_WordBuffer)); + return FXSYS_atoui(reinterpret_cast(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 buf(new FX_WCHAR[len]); + std::unique_ptr 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(-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(item.m_CharCode); + wstrItem += static_cast(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(item.m_CharCode); - FX_WCHAR curChar = wstrItem.GetAt(0); + wstrItem += static_cast(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& rhs) { return rhs != lhs; } -extern template class CFX_StringCTemplate; -extern template class CFX_StringCTemplate; +extern template class CFX_StringCTemplate; +extern template class CFX_StringCTemplate; #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; -extern template class CFX_StringDataTemplate; +extern template class CFX_StringDataTemplate; +extern template class CFX_StringDataTemplate; #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(wsText.c_str()); + wchar_t wch; + wchar_t* pStart = const_cast(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& 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(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(m_pBuffer.get()); } CFX_WideStringC AsStringC() const { - return CFX_WideStringC(reinterpret_cast(m_pBuffer.get()), - m_DataSize / sizeof(FX_WCHAR)); + return CFX_WideStringC(reinterpret_cast(m_pBuffer.get()), + m_DataSize / sizeof(wchar_t)); } CFX_WideString MakeString() const { - return CFX_WideString(reinterpret_cast(m_pBuffer.get()), - m_DataSize / sizeof(FX_WCHAR)); + return CFX_WideString(reinterpret_cast(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; -template class CFX_StringCTemplate; +template class CFX_StringDataTemplate; +template class CFX_StringCTemplate; template class CFX_StringPoolTemplate; template struct std::hash; @@ -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(pStr), nLen)); + StringData::Create(reinterpret_cast(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 char* pStr = static_cast( 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 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(str); +int32_t FXSYS_atoi(const char* str) { + return FXSYS_StrToInt(str); } -uint32_t FXSYS_atoui(const FX_CHAR* str) { +uint32_t FXSYS_atoui(const char* str) { return FXSYS_StrToInt(str); } -int32_t FXSYS_wtoi(const FX_WCHAR* str) { - return FXSYS_StrToInt(str); +int32_t FXSYS_wtoi(const wchar_t* str) { + return FXSYS_StrToInt(str); } -int64_t FXSYS_atoi64(const FX_CHAR* str) { - return FXSYS_StrToInt(str); +int64_t FXSYS_atoi64(const char* str) { + return FXSYS_StrToInt(str); } -int64_t FXSYS_wtoi64(const FX_WCHAR* str) { - return FXSYS_StrToInt(str); +int64_t FXSYS_wtoi64(const wchar_t* str) { + return FXSYS_StrToInt(str); } -const FX_CHAR* FXSYS_i64toa(int64_t value, FX_CHAR* str, int radix) { - return FXSYS_IntToStr(value, str, radix); +const char* FXSYS_i64toa(int64_t value, char* str, int radix) { + return FXSYS_IntToStr(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(value, str, radix); + return FXSYS_IntToStr(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(wstr[i]); + buf[len] = static_cast(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 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; -template class CFX_StringCTemplate; +template class CFX_StringDataTemplate; +template class CFX_StringCTemplate; template class CFX_StringPoolTemplate; template struct std::hash; @@ -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 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::CreateDefault( // static CFX_RetainPtr IFX_SeekableStream::CreateFromFilename( - const FX_CHAR* filename, + const char* filename, uint32_t dwModes) { std::unique_ptr pFA(IFXCRT_FileAccess::Create()); if (!pFA->Open(filename, dwModes)) @@ -397,7 +397,7 @@ CFX_RetainPtr IFX_SeekableStream::CreateFromFilename( // static CFX_RetainPtr IFX_SeekableStream::CreateFromFilename( - const FX_WCHAR* filename, + const wchar_t* filename, uint32_t dwModes) { std::unique_ptr pFA(IFXCRT_FileAccess::Create()); if (!pFA->Open(filename, dwModes)) @@ -407,7 +407,7 @@ CFX_RetainPtr IFX_SeekableStream::CreateFromFilename( // static CFX_RetainPtr -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 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 CreateFromFilename( - const FX_CHAR* filename, + const char* filename, uint32_t dwModes); static CFX_RetainPtr 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; -using CFX_WideStringC = CFX_StringCTemplate; +using CFX_ByteStringC = CFX_StringCTemplate; +using CFX_WideStringC = CFX_StringCTemplate; #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; // 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; + using StringData = CFX_StringDataTemplate; 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 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; + using StringData = CFX_StringDataTemplate; 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 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(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(memchr(ptr, ch, len)); +inline const char* FXSYS_chr(const char* ptr, char ch, size_t len) { + return reinterpret_cast(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(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(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(ch)); + code = code * 10 + FXSYS_toDecimalDigit(static_cast(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(ch)); + (code << 4) + FXSYS_toDecimalDigit(static_cast(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 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 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(element); if (str_key.Find(family->m_pFontName) != -1) return 0; - return FXSYS_stricmp(reinterpret_cast(key), - family->m_pFontName); + return FXSYS_stricmp(reinterpret_cast(key), family->m_pFontName); } int CompareString(const void* key, const void* element) { - return FXSYS_stricmp(reinterpret_cast(key), + return FXSYS_stricmp(reinterpret_cast(key), reinterpret_cast(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(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(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(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); -- cgit v1.2.3