From d7e5cc754a937605d1f73db5e7967c58ddd80742 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 10 Jun 2015 14:33:37 -0700 Subject: Merge to XFA: Remove typdefs for pointer types in fx_system.h. Original Review URL: https://codereview.chromium.org/1171733003 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1178613002. --- xfa/src/fgas/include/fx_alg.h | 8 +- xfa/src/fgas/include/fx_cpg.h | 24 ++-- xfa/src/fgas/include/fx_fnt.h | 66 ++++----- xfa/src/fgas/include/fx_lbk.h | 4 +- xfa/src/fgas/include/fx_locale.h | 2 +- xfa/src/fgas/include/fx_rbk.h | 6 +- xfa/src/fgas/include/fx_sax.h | 14 +- xfa/src/fgas/include/fx_stm.h | 12 +- xfa/src/fgas/include/fx_sys.h | 14 +- xfa/src/fgas/include/fx_tbk.h | 16 +-- xfa/src/fgas/include/fx_utl.h | 38 ++--- xfa/src/fgas/src/crt/fx_algorithm.cpp | 46 +++--- xfa/src/fgas/src/crt/fx_codepage.cpp | 6 +- xfa/src/fgas/src/crt/fx_encode.cpp | 24 ++-- xfa/src/fgas/src/crt/fx_memory.cpp | 13 +- xfa/src/fgas/src/crt/fx_memory.h | 18 +-- xfa/src/fgas/src/crt/fx_stream.cpp | 98 ++++++------- xfa/src/fgas/src/crt/fx_stream.h | 76 +++++----- xfa/src/fgas/src/crt/fx_system.cpp | 22 +-- xfa/src/fgas/src/crt/fx_utils.cpp | 66 ++++----- xfa/src/fgas/src/crt/fx_utils.h | 6 +- xfa/src/fgas/src/font/fx_fontutils.cpp | 4 +- xfa/src/fgas/src/font/fx_fontutils.h | 2 +- xfa/src/fgas/src/font/fx_gdifont.cpp | 34 ++--- xfa/src/fgas/src/font/fx_gdifont.h | 14 +- xfa/src/fgas/src/font/fx_gefont.cpp | 18 +-- xfa/src/fgas/src/font/fx_gefont.h | 6 +- xfa/src/fgas/src/font/fx_stdfontmgr.cpp | 98 ++++++------- xfa/src/fgas/src/font/fx_stdfontmgr.h | 54 +++---- xfa/src/fgas/src/layout/fx_linebreak.cpp | 4 +- xfa/src/fgas/src/layout/fx_rtfbreak.cpp | 4 +- xfa/src/fgas/src/layout/fx_textbreak.cpp | 10 +- xfa/src/fgas/src/layout/fx_textbreak.h | 6 +- xfa/src/fgas/src/localization/fx_locale.cpp | 192 ++++++++++++------------- xfa/src/fgas/src/localization/fx_localemgr.cpp | 16 +-- xfa/src/fgas/src/xml/fx_sax_imp.cpp | 10 +- xfa/src/fgas/src/xml/fx_sax_imp.h | 8 +- 37 files changed, 530 insertions(+), 529 deletions(-) (limited to 'xfa/src/fgas') diff --git a/xfa/src/fgas/include/fx_alg.h b/xfa/src/fgas/include/fx_alg.h index 0ee8508083..65403ec7da 100644 --- a/xfa/src/fgas/include/fx_alg.h +++ b/xfa/src/fgas/include/fx_alg.h @@ -10,11 +10,11 @@ #ifdef __cplusplus extern "C" { #endif -int32_t FX_Base64EncodeA(FX_LPCBYTE pSrc, int32_t iSrcLen, FX_LPSTR pDst); -int32_t FX_Base64DecodeA(FX_LPCSTR pSrc, int32_t iSrcLen, FX_LPBYTE pDst); -int32_t FX_Base64DecodeW(FX_LPCWSTR pSrc, int32_t iSrcLen, FX_LPBYTE pDst); +int32_t FX_Base64EncodeA(const uint8_t* pSrc, int32_t iSrcLen, FX_CHAR* pDst); +int32_t FX_Base64DecodeA(const FX_CHAR* pSrc, int32_t iSrcLen, uint8_t* pDst); +int32_t FX_Base64DecodeW(const FX_WCHAR* pSrc, int32_t iSrcLen, uint8_t* pDst); uint8_t FX_Hex2Dec(uint8_t hexHigh, uint8_t hexLow); -int32_t FX_SeparateStringW(FX_LPCWSTR pStr, int32_t iStrLen, FX_WCHAR delimiter, CFX_WideStringArray &pieces); +int32_t FX_SeparateStringW(const FX_WCHAR* pStr, int32_t iStrLen, FX_WCHAR delimiter, CFX_WideStringArray &pieces); #ifdef __cplusplus }; #endif diff --git a/xfa/src/fgas/include/fx_cpg.h b/xfa/src/fgas/include/fx_cpg.h index 2556426dbc..0b58727fa3 100644 --- a/xfa/src/fgas/include/fx_cpg.h +++ b/xfa/src/fgas/include/fx_cpg.h @@ -132,17 +132,17 @@ class IFX_CodePage; #define FX_CHARSET_OEM 255 FX_WORD FX_GetCodePageFromCharset(uint8_t charset); FX_WORD FX_GetCharsetFromCodePage(FX_WORD codepage); -FX_WORD FX_GetCodePageFromStringA(FX_LPCSTR pStr, int32_t iLength); -FX_WORD FX_GetCodePageFormStringW(FX_LPCWSTR pStr, int32_t iLength); +FX_WORD FX_GetCodePageFromStringA(const FX_CHAR* pStr, int32_t iLength); +FX_WORD FX_GetCodePageFormStringW(const FX_WCHAR* pStr, int32_t iLength); FX_WORD FX_GetDefCodePageByLanguage(FX_WORD wLanguage); -void FX_SwapByteOrder(FX_LPWSTR pStr, int32_t iLength); -void FX_SwapByteOrderCopy(FX_LPCWSTR pSrc, FX_LPWSTR pDst, int32_t iLength); -void FX_UTF16ToWChar(FX_LPVOID pBuffer, int32_t iLength); -void FX_UTF16ToWCharCopy(const FX_WORD *pUTF16, FX_LPWSTR pWChar, int32_t iLength); -void FX_WCharToUTF16(FX_LPVOID pBuffer, int32_t iLength); -void FX_WCharToUTF16Copy(FX_LPCWSTR pWChar, FX_WORD *pUTF16, int32_t iLength); -int32_t FX_DecodeString(FX_WORD wCodePage, FX_LPCSTR pSrc, int32_t *pSrcLen, FX_LPWSTR pDst, int32_t *pDstLen, FX_BOOL bErrBreak = FALSE); -int32_t FX_UTF8Decode(FX_LPCSTR pSrc, int32_t *pSrcLen, FX_LPWSTR pDst, int32_t *pDstLen); +void FX_SwapByteOrder(FX_WCHAR* pStr, int32_t iLength); +void FX_SwapByteOrderCopy(const FX_WCHAR* pSrc, FX_WCHAR* pDst, int32_t iLength); +void FX_UTF16ToWChar(void* pBuffer, int32_t iLength); +void FX_UTF16ToWCharCopy(const FX_WORD *pUTF16, FX_WCHAR* pWChar, int32_t iLength); +void FX_WCharToUTF16(void* pBuffer, int32_t iLength); +void FX_WCharToUTF16Copy(const FX_WCHAR* pWChar, FX_WORD *pUTF16, int32_t iLength); +int32_t FX_DecodeString(FX_WORD wCodePage, const FX_CHAR* pSrc, int32_t *pSrcLen, FX_WCHAR* pDst, int32_t *pDstLen, FX_BOOL bErrBreak = FALSE); +int32_t FX_UTF8Decode(const FX_CHAR* pSrc, int32_t *pSrcLen, FX_WCHAR* pDst, int32_t *pDstLen); enum FX_CODESYSTEM { FX_MBCS = 0, FX_SBCS , @@ -177,7 +177,7 @@ typedef struct _FX_CPCU_MAPTABLE2 { typedef struct _FX_CPCU_MAPINFO { FX_CPCU_MAPTABLE1 *pMapTable1; FX_CPCU_MAPTABLE2 *pMapTable2; - FX_LPCBYTE pMapData; + const uint8_t* pMapData; } FX_CPCU_MAPINFO; typedef struct _FX_CPUC_MAPTABLE { uint16_t uStartUnicode; @@ -188,7 +188,7 @@ typedef struct _FX_CPUC_MAPTABLE { typedef struct _FX_CPUC_MAPINFO { uint32_t uMapCount; FX_CPUC_MAPTABLE *pMapTable; - FX_LPCBYTE pMapData; + const uint8_t* pMapData; } FX_CPUC_MAPINFO; typedef struct _FX_CODEPAGE { FX_CODEPAGE_HEADER const *pCPHeader; diff --git a/xfa/src/fgas/include/fx_fnt.h b/xfa/src/fgas/include/fx_fnt.h index 85d6e3edff..6b328d9741 100644 --- a/xfa/src/fgas/include/fx_fnt.h +++ b/xfa/src/fgas/include/fx_fnt.h @@ -45,9 +45,9 @@ public: class IFX_Font { public: - static IFX_Font* LoadFont(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage, IFX_FontMgr *pFontMgr); - static IFX_Font* LoadFont(FX_LPCBYTE pBuffer, int32_t iLength, IFX_FontMgr *pFontMgr); - static IFX_Font* LoadFont(FX_LPCWSTR pszFileName, IFX_FontMgr *pFontMgr); + static IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage, IFX_FontMgr *pFontMgr); + static IFX_Font* LoadFont(const uint8_t* pBuffer, int32_t iLength, IFX_FontMgr *pFontMgr); + static IFX_Font* LoadFont(const FX_WCHAR* pszFileName, IFX_FontMgr *pFontMgr); static IFX_Font* LoadFont(IFX_Stream *pFontStream, IFX_FontMgr *pFontMgr, FX_BOOL bSaveStream = FALSE); static IFX_Font* LoadFont(CFX_Font *pExtFont, IFX_FontMgr *pFontMgr, FX_BOOL bTakeOver = FALSE); virtual void Release() = 0; @@ -74,7 +74,7 @@ public: }; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ typedef struct _FX_FONTMATCHPARAMS { - FX_LPCWSTR pwsFamily; + const FX_WCHAR* pwsFamily; FX_DWORD dwFontStyles; FX_DWORD dwUSB; FX_DWORD dwMatchFlags; @@ -104,23 +104,23 @@ inline FX_BOOL operator == (const FX_FONTDESCRIPTOR &left, const FX_FONTDESCRIPT #define FX_FONTMATCHPARA_MacthStyle 0x01 #define FX_FONTMATCHPARA_MacthFamily 0x02 #define FX_FONTMATCHPARA_MacthUnicode 0x04 -typedef void (*FX_LPEnumAllFonts)(CFX_FontDescriptors &fonts, FX_LPVOID pUserData, FX_LPCWSTR pwsFaceName, FX_WCHAR wUnicode); +typedef void (*FX_LPEnumAllFonts)(CFX_FontDescriptors &fonts, void* pUserData, const FX_WCHAR* pwsFaceName, FX_WCHAR wUnicode); FX_LPEnumAllFonts FX_GetDefFontEnumerator(); -typedef FX_LPCFONTDESCRIPTOR (*FX_LPMatchFont)(FX_LPFONTMATCHPARAMS pParams, const CFX_FontDescriptors &fonts, FX_LPVOID pUserData); +typedef FX_LPCFONTDESCRIPTOR (*FX_LPMatchFont)(FX_LPFONTMATCHPARAMS pParams, const CFX_FontDescriptors &fonts, void* pUserData); FX_LPMatchFont FX_GetDefFontMatchor(); class IFX_FontMgr { public: - static IFX_FontMgr* Create(FX_LPEnumAllFonts pEnumerator, FX_LPMatchFont pMatcher = NULL, FX_LPVOID pUserData = NULL); + static IFX_FontMgr* Create(FX_LPEnumAllFonts pEnumerator, FX_LPMatchFont pMatcher = NULL, void* pUserData = NULL); virtual void Release() = 0; - virtual IFX_Font* GetDefFontByCodePage(FX_WORD wCodePage, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL) = 0; - virtual IFX_Font* GetDefFontByCharset(uint8_t nCharset, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL) = 0; - virtual IFX_Font* GetDefFontByUnicode(FX_WCHAR wUnicode, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL) = 0; - virtual IFX_Font* GetDefFontByLanguage(FX_WORD wLanguage, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL) = 0; - virtual IFX_Font* LoadFont(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage = 0xFFFF) = 0; - virtual IFX_Font* LoadFont(FX_LPCBYTE pBuffer, int32_t iLength) = 0; - virtual IFX_Font* LoadFont(FX_LPCWSTR pszFileName) = 0; - virtual IFX_Font* LoadFont(IFX_Stream *pFontStream, FX_LPCWSTR pszFontAlias = NULL, FX_DWORD dwFontStyles = 0, FX_WORD wCodePage = 0, FX_BOOL bSaveStream = FALSE) = 0; + virtual IFX_Font* GetDefFontByCodePage(FX_WORD wCodePage, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; + virtual IFX_Font* GetDefFontByCharset(uint8_t nCharset, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; + virtual IFX_Font* GetDefFontByUnicode(FX_WCHAR wUnicode, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; + virtual IFX_Font* GetDefFontByLanguage(FX_WORD wLanguage, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; + virtual IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage = 0xFFFF) = 0; + virtual IFX_Font* LoadFont(const uint8_t* pBuffer, int32_t iLength) = 0; + virtual IFX_Font* LoadFont(const FX_WCHAR* pszFileName) = 0; + virtual IFX_Font* LoadFont(IFX_Stream *pFontStream, const FX_WCHAR* pszFontAlias = NULL, FX_DWORD dwFontStyles = 0, FX_WORD wCodePage = 0, FX_BOOL bSaveStream = FALSE) = 0; virtual IFX_Font* LoadFont(IFX_Font *pSrcFont, FX_DWORD dwFontStyles, FX_WORD wCodePage = 0xFFFF) = 0; virtual void ClearFontCache() = 0; virtual void RemoveFont(IFX_Font *pFont) = 0; @@ -129,38 +129,38 @@ public: class IFX_FontMgrDelegate { public: - virtual IFX_Font* GetDefFontByCodePage(IFX_FontMgr* pFontMgr, FX_WORD wCodePage, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL) = 0; - virtual IFX_Font* GetDefFontByCharset(IFX_FontMgr* pFontMgr, uint8_t nCharset, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL) = 0; - virtual IFX_Font* GetDefFontByUnicode(IFX_FontMgr* pFontMgr, FX_WCHAR wUnicode, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL) = 0; - virtual IFX_Font* GetDefFontByLanguage(IFX_FontMgr* pFontMgr, FX_WORD wLanguage, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL) = 0; + virtual IFX_Font* GetDefFontByCodePage(IFX_FontMgr* pFontMgr, FX_WORD wCodePage, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; + virtual IFX_Font* GetDefFontByCharset(IFX_FontMgr* pFontMgr, uint8_t nCharset, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; + virtual IFX_Font* GetDefFontByUnicode(IFX_FontMgr* pFontMgr, FX_WCHAR wUnicode, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; + virtual IFX_Font* GetDefFontByLanguage(IFX_FontMgr* pFontMgr, FX_WORD wLanguage, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; }; class IFX_FontSourceEnum { public: virtual void Release() = 0; - virtual FX_POSITION GetStartPosition(FX_LPVOID pUserData = NULL) = 0; - virtual IFX_FileAccess* GetNext(FX_POSITION& pos, FX_LPVOID pUserData = NULL) = 0; + virtual FX_POSITION GetStartPosition(void* pUserData = NULL) = 0; + virtual IFX_FileAccess* GetNext(FX_POSITION& pos, void* pUserData = NULL) = 0; }; IFX_FontSourceEnum* FX_CreateDefaultFontSourceEnum(); class IFX_FontMgr { public: - static IFX_FontMgr* Create(IFX_FontSourceEnum* pFontEnum, IFX_FontMgrDelegate* pDelegate = NULL, FX_LPVOID pUserData = NULL); + static IFX_FontMgr* Create(IFX_FontSourceEnum* pFontEnum, IFX_FontMgrDelegate* pDelegate = NULL, void* pUserData = NULL); virtual void Release() = 0; - virtual IFX_Font* GetDefFontByCodePage(FX_WORD wCodePage, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL) = 0; - virtual IFX_Font* GetDefFontByCharset(uint8_t nCharset, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL) = 0; - virtual IFX_Font* GetDefFontByUnicode(FX_WCHAR wUnicode, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL) = 0; - virtual IFX_Font* GetDefFontByLanguage(FX_WORD wLanguage, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL) = 0; - virtual IFX_Font* GetFontByCodePage(FX_WORD wCodePage, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL) = 0; - inline IFX_Font* LoadFont(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage) + virtual IFX_Font* GetDefFontByCodePage(FX_WORD wCodePage, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; + virtual IFX_Font* GetDefFontByCharset(uint8_t nCharset, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; + virtual IFX_Font* GetDefFontByUnicode(FX_WCHAR wUnicode, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; + virtual IFX_Font* GetDefFontByLanguage(FX_WORD wLanguage, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; + virtual IFX_Font* GetFontByCodePage(FX_WORD wCodePage, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; + inline IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage) { return GetFontByCodePage(wCodePage, dwFontStyles, pszFontFamily); } - virtual IFX_Font* GetFontByCharset(uint8_t nCharset, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL) = 0; - virtual IFX_Font* GetFontByUnicode(FX_WCHAR wUnicode, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL) = 0; - virtual IFX_Font* GetFontByLanguage(FX_WORD wLanguage, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL) = 0; - virtual IFX_Font* LoadFont(FX_LPCBYTE pBuffer, int32_t iLength, int32_t iFaceIndex, int32_t* pFaceCount = NULL) = 0; - virtual IFX_Font* LoadFont(FX_LPCWSTR pszFileName, int32_t iFaceIndex, int32_t* pFaceCount = NULL) = 0; + virtual IFX_Font* GetFontByCharset(uint8_t nCharset, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; + virtual IFX_Font* GetFontByUnicode(FX_WCHAR wUnicode, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; + virtual IFX_Font* GetFontByLanguage(FX_WORD wLanguage, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; + virtual IFX_Font* LoadFont(const uint8_t* pBuffer, int32_t iLength, int32_t iFaceIndex, int32_t* pFaceCount = NULL) = 0; + virtual IFX_Font* LoadFont(const FX_WCHAR* pszFileName, int32_t iFaceIndex, int32_t* pFaceCount = NULL) = 0; virtual IFX_Font* LoadFont(IFX_Stream *pFontStream, int32_t iFaceIndex, int32_t* pFaceCount = NULL, FX_BOOL bSaveStream = FALSE) = 0; virtual void ClearFontCache() = 0; diff --git a/xfa/src/fgas/include/fx_lbk.h b/xfa/src/fgas/include/fx_lbk.h index f161bb4355..27a072a3b8 100644 --- a/xfa/src/fgas/include/fx_lbk.h +++ b/xfa/src/fgas/include/fx_lbk.h @@ -22,6 +22,6 @@ enum FX_LINEBREAKTYPE { #define FX_LBCP FX_LBT_COM_PROHIBITED_BRK #define FX_LBPB FX_LBT_PROHIBITED_BRK #define FX_LBHS FX_LBT_HANGUL_SPACE_BRK -void FX_GetLineBreakPositions(FX_LPCWSTR pwsText, FX_LINEBREAKTYPE *pBrkType, int32_t iLength); -void FX_GetLineBreakPositions(FX_LPCWSTR pwsText, int32_t iLength, CFX_Int32MassArray &bp); +void FX_GetLineBreakPositions(const FX_WCHAR* pwsText, FX_LINEBREAKTYPE *pBrkType, int32_t iLength); +void FX_GetLineBreakPositions(const FX_WCHAR* pwsText, int32_t iLength, CFX_Int32MassArray &bp); #endif diff --git a/xfa/src/fgas/include/fx_locale.h b/xfa/src/fgas/include/fx_locale.h index 7f4cce5776..ef6b910b00 100644 --- a/xfa/src/fgas/include/fx_locale.h +++ b/xfa/src/fgas/include/fx_locale.h @@ -79,7 +79,7 @@ public: virtual IFX_Locale* GetLocale(FX_WORD lcid) = 0; virtual IFX_Locale* GetLocaleByName(FX_WSTR wsLocaleName) = 0; }; -IFX_LocaleMgr* FX_LocaleMgr_Create(FX_LPCWSTR pszLocalPath, FX_WORD wDefaultLCID); +IFX_LocaleMgr* FX_LocaleMgr_Create(const FX_WCHAR* pszLocalPath, FX_WORD wDefaultLCID); void FX_ParseNumString(const CFX_WideString& wsNum, CFX_WideString& wsResult); FX_BOOL FX_DateFromCanonical(const CFX_WideString& wsDate, CFX_Unitime& datetime); FX_BOOL FX_TimeFromCanonical(FX_WSTR wsTime, CFX_Unitime& datetime, IFX_Locale* pLocale); diff --git a/xfa/src/fgas/include/fx_rbk.h b/xfa/src/fgas/include/fx_rbk.h index cff63ee490..282b6e37db 100644 --- a/xfa/src/fgas/include/fx_rbk.h +++ b/xfa/src/fgas/include/fx_rbk.h @@ -68,7 +68,7 @@ typedef struct _FX_RTFTEXTOBJ { iHorizontalScale = 100; iVerticalScale = 100; } - FX_LPCWSTR pStr; + const FX_WCHAR* pStr; int32_t *pWidths; int32_t iLength; IFX_Font *pFont; @@ -139,7 +139,7 @@ public: FXSYS_assert(index > -1 && index < m_iChars && m_pChars != NULL); return m_pChars->GetDataPtr(m_iStartChar + index); } - void GetString (FX_LPWSTR pText) const + void GetString (FX_WCHAR* pText) const { FXSYS_assert(pText != NULL); int32_t iEndChar = m_iStartChar + m_iChars; @@ -151,7 +151,7 @@ public: } void GetString(CFX_WideString &wsText) const { - FX_LPWSTR pText = wsText.GetBuffer(m_iChars); + FX_WCHAR* pText = wsText.GetBuffer(m_iChars); GetString(pText); wsText.ReleaseBuffer(m_iChars); } diff --git a/xfa/src/fgas/include/fx_sax.h b/xfa/src/fgas/include/fx_sax.h index e45ca4e6d8..a6122c48e5 100644 --- a/xfa/src/fgas/include/fx_sax.h +++ b/xfa/src/fgas/include/fx_sax.h @@ -27,13 +27,13 @@ enum FX_SAXNODE { class IFX_SAXReaderHandler { public: - virtual FX_LPVOID OnTagEnter(FX_BSTR bsTagName, FX_SAXNODE eType, FX_DWORD dwStartPos) = 0; - virtual void OnTagAttribute(FX_LPVOID pTag, FX_BSTR bsAttri, FX_BSTR bsValue) = 0; - virtual void OnTagBreak(FX_LPVOID pTag) = 0; - virtual void OnTagData(FX_LPVOID pTag, FX_SAXNODE eType, FX_BSTR bsData, FX_DWORD dwStartPos) = 0; - virtual void OnTagClose(FX_LPVOID pTag, FX_DWORD dwEndPos) = 0; - virtual void OnTagEnd(FX_LPVOID pTag, FX_BSTR bsTagName, FX_DWORD dwEndPos) = 0; - virtual void OnTargetData(FX_LPVOID pTag, FX_SAXNODE eType, FX_BSTR bsData, FX_DWORD dwStartPos) = 0; + virtual void* OnTagEnter(FX_BSTR bsTagName, FX_SAXNODE eType, FX_DWORD dwStartPos) = 0; + virtual void OnTagAttribute(void* pTag, FX_BSTR bsAttri, FX_BSTR bsValue) = 0; + virtual void OnTagBreak(void* pTag) = 0; + virtual void OnTagData(void* pTag, FX_SAXNODE eType, FX_BSTR bsData, FX_DWORD dwStartPos) = 0; + virtual void OnTagClose(void* pTag, FX_DWORD dwEndPos) = 0; + virtual void OnTagEnd(void* pTag, FX_BSTR bsTagName, FX_DWORD dwEndPos) = 0; + virtual void OnTargetData(void* pTag, FX_SAXNODE eType, FX_BSTR bsData, FX_DWORD dwStartPos) = 0; }; class IFX_SAXReader { diff --git a/xfa/src/fgas/include/fx_stm.h b/xfa/src/fgas/include/fx_stm.h index e6094d445c..b10b06a830 100644 --- a/xfa/src/fgas/include/fx_stm.h +++ b/xfa/src/fgas/include/fx_stm.h @@ -33,8 +33,8 @@ class IFX_Stream public: static IFX_Stream* CreateStream(IFX_FileRead *pFileRead, FX_DWORD dwAccess); static IFX_Stream* CreateStream(IFX_FileWrite *pFileWrite, FX_DWORD dwAccess); - static IFX_Stream* CreateStream(FX_LPCWSTR pszFileName, FX_DWORD dwAccess); - static IFX_Stream* CreateStream(FX_LPBYTE pData, int32_t length, FX_DWORD dwAccess); + static IFX_Stream* CreateStream(const FX_WCHAR* pszFileName, FX_DWORD dwAccess); + static IFX_Stream* CreateStream(uint8_t* pData, int32_t length, FX_DWORD dwAccess); static IFX_Stream* CreateStream(IFX_BufferRead *pBufferRead, FX_DWORD dwAccess, int32_t iFileSize = -1, FX_BOOL bReleaseBufferRead = TRUE); static IFX_Stream* CreateTextStream(IFX_Stream *pBaseStream, FX_BOOL bDeleteOnRelease); virtual void Release() = 0; @@ -44,10 +44,10 @@ public: virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) = 0; virtual int32_t GetPosition() = 0; virtual FX_BOOL IsEOF() const = 0; - virtual int32_t ReadData(FX_LPBYTE pBuffer, int32_t iBufferSize) = 0; - virtual int32_t ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_BOOL &bEOS, int32_t const *pByteSize = NULL) = 0; - virtual int32_t WriteData(FX_LPCBYTE pBuffer, int32_t iBufferSize) = 0; - virtual int32_t WriteString(FX_LPCWSTR pStr, int32_t iLength) = 0; + virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) = 0; + virtual int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL &bEOS, int32_t const *pByteSize = NULL) = 0; + virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) = 0; + virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) = 0; virtual void Flush() = 0; virtual FX_BOOL SetLength(int32_t iLength) = 0; virtual int32_t GetBOM(uint8_t bom[4]) const = 0; diff --git a/xfa/src/fgas/include/fx_sys.h b/xfa/src/fgas/include/fx_sys.h index 8e099bce05..3982e0d285 100644 --- a/xfa/src/fgas/include/fx_sys.h +++ b/xfa/src/fgas/include/fx_sys.h @@ -24,11 +24,11 @@ typedef FX_DOUBLE * FX_LPDOUBLE; typedef FX_DOUBLE const * FX_LPCDOUBLE; FX_FLOAT FX_tan(FX_FLOAT a); FX_FLOAT FX_log(FX_FLOAT b, FX_FLOAT x); -FX_FLOAT FX_strtof(FX_LPCSTR pcsStr, int32_t iLength = -1, int32_t *pUsedLen = NULL); -FX_FLOAT FX_wcstof(FX_LPCWSTR pwsStr, int32_t iLength = -1, int32_t *pUsedLen = NULL); -FX_LPWSTR FX_wcsncpy(FX_LPWSTR dstStr, FX_LPCWSTR srcStr, size_t count); -int32_t FX_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count); -int32_t FX_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count); +FX_FLOAT FX_strtof(const FX_CHAR* pcsStr, int32_t iLength = -1, int32_t *pUsedLen = NULL); +FX_FLOAT FX_wcstof(const FX_WCHAR* pwsStr, int32_t iLength = -1, int32_t *pUsedLen = NULL); +FX_WCHAR* FX_wcsncpy(FX_WCHAR* dstStr, const FX_WCHAR* srcStr, size_t count); +int32_t FX_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count); +int32_t FX_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count); inline FX_BOOL FX_islower(int32_t ch) { return ch >= 'a' && ch <= 'z'; @@ -47,8 +47,8 @@ inline int32_t FX_toupper(int32_t ch) } int32_t FX_filelength(FXSYS_FILE *file); FX_BOOL FX_fsetsize(FXSYS_FILE *file, int32_t size); -void FX_memset(FX_LPVOID pBuf, int32_t iValue, size_t size); -void FX_memcpy(FX_LPVOID pDst, FX_LPCVOID pSrc, size_t size); +void FX_memset(void* pBuf, int32_t iValue, size_t size); +void FX_memcpy(void* pDst, const void* pSrc, size_t size); FX_BOOL FX_IsRelativePath(const CFX_WideStringC &wsPath); FX_BOOL FX_JoinPath(const CFX_WideStringC &wsBasePath, const CFX_WideStringC &wsRelativePath, CFX_WideString &wsAbsolutePath); typedef struct _FX_VERSION { diff --git a/xfa/src/fgas/include/fx_tbk.h b/xfa/src/fgas/include/fx_tbk.h index 69b42f1fd7..e48e2eedf4 100644 --- a/xfa/src/fgas/include/fx_tbk.h +++ b/xfa/src/fgas/include/fx_tbk.h @@ -60,8 +60,8 @@ class IFX_TxtBreak; class IFX_TxtAccess { public: - virtual FX_WCHAR GetChar(FX_LPVOID pIdentity, int32_t index) const = 0; - virtual int32_t GetWidth(FX_LPVOID pIdentity, int32_t index) const = 0; + virtual FX_WCHAR GetChar(void* pIdentity, int32_t index) const = 0; + virtual int32_t GetWidth(void* pIdentity, int32_t index) const = 0; }; typedef struct _FX_TXTRUN { _FX_TXTRUN() @@ -83,8 +83,8 @@ typedef struct _FX_TXTRUN { bSkipSpace = TRUE; } IFX_TxtAccess *pAccess; - FX_LPVOID pIdentity; - FX_LPCWSTR pStr; + void* pIdentity; + const FX_WCHAR* pStr; int32_t *pWidths; int32_t iLength; IFX_Font *pFont; @@ -133,7 +133,7 @@ public: FXSYS_assert(index > -1 && index < m_iChars && m_pChars != NULL); return m_pChars->GetDataPtr(m_iStartChar + index); } - void GetString(FX_LPWSTR pText) const + void GetString(FX_WCHAR* pText) const { FXSYS_assert(pText != NULL); int32_t iEndChar = m_iStartChar + m_iChars; @@ -146,7 +146,7 @@ public: void GetString(CFX_WideString &wsText) const { - FX_LPWSTR pText = wsText.GetBuffer(m_iChars); + FX_WCHAR* pText = wsText.GetBuffer(m_iChars); GetString(pText); wsText.ReleaseBuffer(m_iChars); } @@ -171,7 +171,7 @@ public: int32_t m_iVerticalScale; FX_DWORD m_dwCharStyles; CFX_TxtCharArray *m_pChars; - FX_LPVOID m_pUserData; + void* m_pUserData; }; typedef CFX_BaseArrayTemplate CFX_TxtPieceArray; class IFX_TxtBreak @@ -197,7 +197,7 @@ public: virtual FX_DWORD GetContextCharStyles() const = 0; virtual void SetContextCharStyles(FX_DWORD dwCharStyles) = 0; virtual void SetCombWidth(FX_FLOAT fCombWidth) = 0; - virtual void SetUserData(FX_LPVOID pUserData) = 0; + virtual void SetUserData(void* pUserData) = 0; virtual FX_DWORD AppendChar(FX_WCHAR wch) = 0; virtual FX_DWORD EndBreak(FX_DWORD dwStatus = FX_TXTBREAK_PieceBreak) = 0; virtual int32_t CountBreakChars() const = 0; diff --git a/xfa/src/fgas/include/fx_utl.h b/xfa/src/fgas/include/fx_utl.h index 35b676f41e..38342a8cc8 100644 --- a/xfa/src/fgas/include/fx_utl.h +++ b/xfa/src/fgas/include/fx_utl.h @@ -29,7 +29,7 @@ public: void Lock(); void Unlock(); private: - FX_LPVOID m_pData; + void* m_pData; }; class CFX_BaseArray : public CFX_Target { @@ -38,14 +38,14 @@ protected: ~CFX_BaseArray(); int32_t GetSize() const; int32_t GetBlockSize() const; - FX_LPBYTE AddSpaceTo(int32_t index); - FX_LPBYTE GetAt(int32_t index) const; - FX_LPBYTE GetBuffer() const; + uint8_t* AddSpaceTo(int32_t index); + uint8_t* GetAt(int32_t index) const; + uint8_t* GetBuffer() const; int32_t Append(const CFX_BaseArray &src, int32_t iStart = 0, int32_t iCount = -1); int32_t Copy(const CFX_BaseArray &src, int32_t iStart = 0, int32_t iCount = -1); int32_t RemoveLast(int32_t iCount = -1); void RemoveAll(FX_BOOL bLeaveMemory = FALSE); - FX_LPVOID m_pData; + void* m_pData; }; template class CFX_BaseArrayTemplate : public CFX_BaseArray @@ -108,7 +108,7 @@ public: CFX_BaseArray::RemoveAll(bLeaveMemory); } }; -typedef CFX_BaseArrayTemplate CFDE_PtrArray; +typedef CFX_BaseArrayTemplate CFDE_PtrArray; typedef CFX_BaseArrayTemplate CFDE_DWordArray; typedef CFX_BaseArrayTemplate CFDE_WordArray; template @@ -162,7 +162,7 @@ public: } iSize = CFX_BaseArray::GetSize(); CFX_BaseArray::AddSpaceTo(iSize + iCount - 1); - FX_LPBYTE *pStart = CFX_BaseArray::GetAt(iSize); + uint8_t* *pStart = CFX_BaseArray::GetAt(iSize); int32_t iBlockSize = CFX_BaseArray::GetBlockSize(); iSize = iStart + iCount; for (int32_t i = iStart; i < iSize; i ++) { @@ -190,7 +190,7 @@ public: } RemoveAll(TRUE); CFX_BaseArray::AddSpaceTo(iCount - 1); - FX_LPBYTE *pStart = CFX_BaseArray::GetAt(0); + uint8_t* *pStart = CFX_BaseArray::GetAt(0); int32_t iBlockSize = CFX_BaseArray::GetBlockSize(); iSize = iStart + iCount; for (int32_t i = iStart; i < iSize; i ++) { @@ -228,8 +228,8 @@ protected: CFX_BaseMassArray(int32_t iChunkSize, int32_t iBlockSize); ~CFX_BaseMassArray(); int32_t GetSize() const; - FX_LPBYTE AddSpaceTo(int32_t index); - FX_LPBYTE GetAt(int32_t index) const; + uint8_t* AddSpaceTo(int32_t index); + uint8_t* GetAt(int32_t index) const; int32_t Append(const CFX_BaseMassArray &src, int32_t iStart = 0, int32_t iCount = -1); int32_t Copy(const CFX_BaseMassArray &src, int32_t iStart = 0, int32_t iCount = -1); int32_t RemoveLast(int32_t iCount = -1); @@ -289,7 +289,7 @@ public: CFX_BaseMassArray::RemoveAll(bLeaveMemory); } }; -typedef CFX_MassArrayTemplate CFX_PtrMassArray; +typedef CFX_MassArrayTemplate CFX_PtrMassArray; typedef CFX_MassArrayTemplate CFX_Int32MassArray; typedef CFX_MassArrayTemplate CFX_DWordMassArray; typedef CFX_MassArrayTemplate CFX_WordMassArray; @@ -390,10 +390,10 @@ class CFX_BaseDiscreteArray : public CFX_Target protected: CFX_BaseDiscreteArray(int32_t iChunkSize, int32_t iBlockSize); ~CFX_BaseDiscreteArray(); - FX_LPBYTE AddSpaceTo(int32_t index); - FX_LPBYTE GetAt(int32_t index) const; + uint8_t* AddSpaceTo(int32_t index); + uint8_t* GetAt(int32_t index) const; void RemoveAll(); - FX_LPVOID m_pData; + void* m_pData; }; template class CFX_DiscreteArrayTemplate : public CFX_BaseDiscreteArray @@ -418,7 +418,7 @@ public: CFX_BaseDiscreteArray::RemoveAll(); } }; -typedef CFX_DiscreteArrayTemplate CFX_PtrDiscreteArray; +typedef CFX_DiscreteArrayTemplate CFX_PtrDiscreteArray; typedef CFX_DiscreteArrayTemplate CFX_DWordDiscreteArray; typedef CFX_DiscreteArrayTemplate CFX_WordDiscreteArray; class CFX_BaseStack : public CFX_Target @@ -426,11 +426,11 @@ class CFX_BaseStack : public CFX_Target protected: CFX_BaseStack(int32_t iChunkSize, int32_t iBlockSize); ~CFX_BaseStack(); - FX_LPBYTE Push(); + uint8_t* Push(); void Pop(); - FX_LPBYTE GetTopElement() const; + uint8_t* GetTopElement() const; int32_t GetSize() const; - FX_LPBYTE GetAt(int32_t index) const; + uint8_t* GetAt(int32_t index) const; void RemoveAll(FX_BOOL bLeaveMemory = FALSE); CFX_BaseMassArrayImp* m_pData; }; @@ -466,7 +466,7 @@ public: CFX_BaseStack::RemoveAll(bLeaveMemory); } }; -typedef CFX_StackTemplate CFX_PtrStack; +typedef CFX_StackTemplate CFX_PtrStack; typedef CFX_StackTemplate CFX_DWordStack; typedef CFX_StackTemplate CFX_WordStack; typedef CFX_StackTemplate CFX_Int32Stack; diff --git a/xfa/src/fgas/src/crt/fx_algorithm.cpp b/xfa/src/fgas/src/crt/fx_algorithm.cpp index 86a6095d45..eb133a3a62 100644 --- a/xfa/src/fgas/src/crt/fx_algorithm.cpp +++ b/xfa/src/fgas/src/crt/fx_algorithm.cpp @@ -52,7 +52,7 @@ static void FX_Base64EncodePiece(const FX_BASE64DATA &src, int32_t iBytes, FX_CH dst[2] = dst[3] = '='; } } -int32_t FX_Base64EncodeA(FX_LPCBYTE pSrc, int32_t iSrcLen, FX_LPSTR pDst) +int32_t FX_Base64EncodeA(const uint8_t* pSrc, int32_t iSrcLen, FX_CHAR* pDst) { FXSYS_assert(pSrc != NULL); if (iSrcLen < 1) { @@ -67,18 +67,18 @@ int32_t FX_Base64EncodeA(FX_LPCBYTE pSrc, int32_t iSrcLen, FX_LPSTR pDst) } FX_BASE64DATA srcData; int32_t iBytes = 3; - FX_LPSTR pDstEnd = pDst; + FX_CHAR* pDstEnd = pDst; while (iSrcLen > 0) { if (iSrcLen > 2) { - ((FX_LPBYTE)&srcData)[0] = *pSrc ++; - ((FX_LPBYTE)&srcData)[1] = *pSrc ++; - ((FX_LPBYTE)&srcData)[2] = *pSrc ++; + ((uint8_t*)&srcData)[0] = *pSrc ++; + ((uint8_t*)&srcData)[1] = *pSrc ++; + ((uint8_t*)&srcData)[2] = *pSrc ++; iSrcLen -= 3; } else { - *((FX_LPDWORD)&srcData) = 0; - ((FX_LPBYTE)&srcData)[0] = *pSrc ++; + *((FX_DWORD*)&srcData) = 0; + ((uint8_t*)&srcData)[0] = *pSrc ++; if (iSrcLen > 1) { - ((FX_LPBYTE)&srcData)[1] = *pSrc ++; + ((uint8_t*)&srcData)[1] = *pSrc ++; } iBytes = iSrcLen; iSrcLen = 0; @@ -149,7 +149,7 @@ static void FX_Base64DecodePiece(const FX_CHAR src[4], int32_t iChars, FX_BASE64 dst.data1 = 0; } } -int32_t FX_Base64DecodeA(FX_LPCSTR pSrc, int32_t iSrcLen, FX_LPBYTE pDst) +int32_t FX_Base64DecodeA(const FX_CHAR* pSrc, int32_t iSrcLen, uint8_t* pDst) { FXSYS_assert(pSrc != NULL); if (iSrcLen < 1) { @@ -176,14 +176,14 @@ int32_t FX_Base64DecodeA(FX_LPCSTR pSrc, int32_t iSrcLen, FX_LPBYTE pDst) FX_CHAR srcData[4]; FX_BASE64DATA dstData; int32_t iChars = 4, iBytes; - FX_LPBYTE pDstEnd = pDst; + uint8_t* pDstEnd = pDst; while (iSrcLen > 0) { if (iSrcLen > 3) { *((FX_DWORD*)srcData) = *((FX_DWORD*)pSrc); pSrc += 4; iSrcLen -= 4; } else { - *((FX_LPDWORD)&dstData) = 0; + *((FX_DWORD*)&dstData) = 0; *((FX_DWORD*)srcData) = 0; srcData[0] = *pSrc ++; if (iSrcLen > 1) { @@ -196,17 +196,17 @@ int32_t FX_Base64DecodeA(FX_LPCSTR pSrc, int32_t iSrcLen, FX_LPBYTE pDst) iSrcLen = 0; } FX_Base64DecodePiece(srcData, iChars, dstData, iBytes); - *pDstEnd ++ = ((FX_LPBYTE)&dstData)[0]; + *pDstEnd ++ = ((uint8_t*)&dstData)[0]; if (iBytes > 1) { - *pDstEnd ++ = ((FX_LPBYTE)&dstData)[1]; + *pDstEnd ++ = ((uint8_t*)&dstData)[1]; } if (iBytes > 2) { - *pDstEnd ++ = ((FX_LPBYTE)&dstData)[2]; + *pDstEnd ++ = ((uint8_t*)&dstData)[2]; } } return pDstEnd - pDst; } -int32_t FX_Base64DecodeW(FX_LPCWSTR pSrc, int32_t iSrcLen, FX_LPBYTE pDst) +int32_t FX_Base64DecodeW(const FX_WCHAR* pSrc, int32_t iSrcLen, uint8_t* pDst) { FXSYS_assert(pSrc != NULL); if (iSrcLen < 1) { @@ -233,7 +233,7 @@ int32_t FX_Base64DecodeW(FX_LPCWSTR pSrc, int32_t iSrcLen, FX_LPBYTE pDst) FX_CHAR srcData[4]; FX_BASE64DATA dstData; int32_t iChars = 4, iBytes; - FX_LPBYTE pDstEnd = pDst; + uint8_t* pDstEnd = pDst; while (iSrcLen > 0) { if (iSrcLen > 3) { srcData[0] = (FX_CHAR) * pSrc ++; @@ -242,7 +242,7 @@ int32_t FX_Base64DecodeW(FX_LPCWSTR pSrc, int32_t iSrcLen, FX_LPBYTE pDst) srcData[3] = (FX_CHAR) * pSrc ++; iSrcLen -= 4; } else { - *((FX_LPDWORD)&dstData) = 0; + *((FX_DWORD*)&dstData) = 0; *((FX_DWORD*)srcData) = 0; srcData[0] = (FX_CHAR) * pSrc ++; if (iSrcLen > 1) { @@ -255,12 +255,12 @@ int32_t FX_Base64DecodeW(FX_LPCWSTR pSrc, int32_t iSrcLen, FX_LPBYTE pDst) iSrcLen = 0; } FX_Base64DecodePiece(srcData, iChars, dstData, iBytes); - *pDstEnd ++ = ((FX_LPBYTE)&dstData)[0]; + *pDstEnd ++ = ((uint8_t*)&dstData)[0]; if (iBytes > 1) { - *pDstEnd ++ = ((FX_LPBYTE)&dstData)[1]; + *pDstEnd ++ = ((uint8_t*)&dstData)[1]; } if (iBytes > 2) { - *pDstEnd ++ = ((FX_LPBYTE)&dstData)[2]; + *pDstEnd ++ = ((uint8_t*)&dstData)[2]; } } return pDstEnd - pDst; @@ -287,7 +287,7 @@ uint8_t FX_Hex2Dec(uint8_t hexHigh, uint8_t hexLow) { return (g_FXHex2DecMap[hexHigh] << 4) + g_FXHex2DecMap[hexLow]; } -int32_t FX_SeparateStringW(FX_LPCWSTR pStr, int32_t iStrLen, FX_WCHAR delimiter, CFX_WideStringArray &pieces) +int32_t FX_SeparateStringW(const FX_WCHAR* pStr, int32_t iStrLen, FX_WCHAR delimiter, CFX_WideStringArray &pieces) { if (pStr == NULL) { return 0; @@ -295,8 +295,8 @@ int32_t FX_SeparateStringW(FX_LPCWSTR pStr, int32_t iStrLen, FX_WCHAR delimiter, if (iStrLen < 0) { iStrLen = FXSYS_wcslen(pStr); } - FX_LPCWSTR pToken = pStr; - FX_LPCWSTR pEnd = pStr + iStrLen; + const FX_WCHAR* pToken = pStr; + const FX_WCHAR* pEnd = pStr + iStrLen; while (TRUE) { if (pStr >= pEnd || delimiter == *pStr) { CFX_WideString sub(pToken, pStr - pToken); diff --git a/xfa/src/fgas/src/crt/fx_codepage.cpp b/xfa/src/fgas/src/crt/fx_codepage.cpp index 239fa8874c..86d8b45c82 100644 --- a/xfa/src/fgas/src/crt/fx_codepage.cpp +++ b/xfa/src/fgas/src/crt/fx_codepage.cpp @@ -329,7 +329,7 @@ static const FX_STR2CPHASH g_FXCPHashTable[] = { { 0xf2a9730b, 0x3a8 }, { 0xf3d463c2, 0x3a4 }, { 0xf52a70a3, 0xc42e }, { 0xf5693147, 0x6fb3 }, { 0xf637e157, 0x478 }, { 0xfc213f3a, 0x2717 }, { 0xff654d14, 0x3b5 }, }; -FX_WORD FX_GetCodePageFromStringA(FX_LPCSTR pStr, int32_t iLength) +FX_WORD FX_GetCodePageFromStringA(const FX_CHAR* pStr, int32_t iLength) { FXSYS_assert(pStr != NULL); if (iLength < 0) { @@ -355,7 +355,7 @@ FX_WORD FX_GetCodePageFromStringA(FX_LPCSTR pStr, int32_t iLength) } while (iStart <= iEnd); return 0xFFFF; } -FX_WORD FX_GetCodePageFormStringW(FX_LPCWSTR pStr, int32_t iLength) +FX_WORD FX_GetCodePageFormStringW(const FX_WCHAR* pStr, int32_t iLength) { if (iLength < 0) { iLength = FXSYS_wcslen(pStr); @@ -364,7 +364,7 @@ FX_WORD FX_GetCodePageFormStringW(FX_LPCWSTR pStr, int32_t iLength) return 0xFFFF; } CFX_ByteString csStr; - FX_LPSTR pBuf = csStr.GetBuffer(iLength + 1); + FX_CHAR* pBuf = csStr.GetBuffer(iLength + 1); for (int32_t i = 0; i < iLength; ++i) { *pBuf ++ = (FX_CHAR) * pStr ++; } diff --git a/xfa/src/fgas/src/crt/fx_encode.cpp b/xfa/src/fgas/src/crt/fx_encode.cpp index 9de79e3649..0f9bb1a5ce 100644 --- a/xfa/src/fgas/src/crt/fx_encode.cpp +++ b/xfa/src/fgas/src/crt/fx_encode.cpp @@ -6,7 +6,7 @@ #include "../fgas_base.h" #include "fx_codepage.h" -void FX_SwapByteOrder(FX_LPWSTR pStr, int32_t iLength) +void FX_SwapByteOrder(FX_WCHAR* pStr, int32_t iLength) { FXSYS_assert(pStr != NULL); if (iLength < 0) { @@ -28,7 +28,7 @@ void FX_SwapByteOrder(FX_LPWSTR pStr, int32_t iLength) } } } -void FX_SwapByteOrderCopy(FX_LPCWSTR pSrc, FX_LPWSTR pDst, int32_t iLength) +void FX_SwapByteOrderCopy(const FX_WCHAR* pSrc, FX_WCHAR* pDst, int32_t iLength) { FXSYS_assert(pSrc != NULL && pDst != NULL); if (iLength < 0) { @@ -50,19 +50,19 @@ void FX_SwapByteOrderCopy(FX_LPCWSTR pSrc, FX_LPWSTR pDst, int32_t iLength) } } } -void FX_UTF16ToWChar(FX_LPVOID pBuffer, int32_t iLength) +void FX_UTF16ToWChar(void* pBuffer, int32_t iLength) { FXSYS_assert(pBuffer != NULL && iLength > 0); if (sizeof(FX_WCHAR) == 2) { return; } FX_WORD *pSrc = (FX_WORD*)pBuffer; - FX_LPWSTR pDst = (FX_LPWSTR)pBuffer; + FX_WCHAR* pDst = (FX_WCHAR*)pBuffer; while (--iLength >= 0) { pDst[iLength] = (FX_WCHAR)pSrc[iLength]; } } -void FX_UTF16ToWCharCopy(const FX_WORD *pUTF16, FX_LPWSTR pWChar, int32_t iLength) +void FX_UTF16ToWCharCopy(const FX_WORD *pUTF16, FX_WCHAR* pWChar, int32_t iLength) { FXSYS_assert(pUTF16 != NULL && pWChar != NULL && iLength > 0); if (sizeof(FX_WCHAR) == 2) { @@ -73,19 +73,19 @@ void FX_UTF16ToWCharCopy(const FX_WORD *pUTF16, FX_LPWSTR pWChar, int32_t iLengt } } } -void FX_WCharToUTF16(FX_LPVOID pBuffer, int32_t iLength) +void FX_WCharToUTF16(void* pBuffer, int32_t iLength) { FXSYS_assert(pBuffer != NULL && iLength > 0); if (sizeof(FX_WCHAR) == 2) { return; } - FX_LPCWSTR pSrc = (FX_LPCWSTR)pBuffer; + const FX_WCHAR* pSrc = (const FX_WCHAR*)pBuffer; FX_WORD *pDst = (FX_WORD*)pBuffer; while (--iLength >= 0) { *pDst++ = (FX_WORD) * pSrc++; } } -void FX_WCharToUTF16Copy(FX_LPCWSTR pWChar, FX_WORD *pUTF16, int32_t iLength) +void FX_WCharToUTF16Copy(const FX_WCHAR* pWChar, FX_WORD *pUTF16, int32_t iLength) { FXSYS_assert(pWChar != NULL && pUTF16 != NULL && iLength > 0); if (sizeof(FX_WCHAR) == 2) { @@ -96,22 +96,22 @@ void FX_WCharToUTF16Copy(FX_LPCWSTR pWChar, FX_WORD *pUTF16, int32_t iLength) } } } -inline FX_DWORD FX_DWordFromBytes(FX_LPCBYTE pStr) +inline FX_DWORD FX_DWordFromBytes(const uint8_t* pStr) { return FXBSTR_ID(pStr[3], pStr[2], pStr[1], pStr[0]); } -inline FX_WORD FX_WordFromBytes(FX_LPCBYTE pStr) +inline FX_WORD FX_WordFromBytes(const uint8_t* pStr) { return (pStr[1] << 8 | pStr[0]); } -int32_t FX_DecodeString(FX_WORD wCodePage, FX_LPCSTR pSrc, int32_t *pSrcLen, FX_LPWSTR pDst, int32_t *pDstLen, FX_BOOL bErrBreak) +int32_t FX_DecodeString(FX_WORD wCodePage, const FX_CHAR* pSrc, int32_t *pSrcLen, FX_WCHAR* pDst, int32_t *pDstLen, FX_BOOL bErrBreak) { if (wCodePage == FX_CODEPAGE_UTF8) { return FX_UTF8Decode(pSrc, pSrcLen, pDst, pDstLen); } return -1; } -int32_t FX_UTF8Decode(FX_LPCSTR pSrc, int32_t *pSrcLen, FX_LPWSTR pDst, int32_t *pDstLen) +int32_t FX_UTF8Decode(const FX_CHAR* pSrc, int32_t *pSrcLen, FX_WCHAR* pDst, int32_t *pDstLen) { if (pSrcLen == NULL || pDstLen == NULL) { return -1; diff --git a/xfa/src/fgas/src/crt/fx_memory.cpp b/xfa/src/fgas/src/crt/fx_memory.cpp index 9645852cb7..6d34a03e0c 100644 --- a/xfa/src/fgas/src/crt/fx_memory.cpp +++ b/xfa/src/fgas/src/crt/fx_memory.cpp @@ -74,7 +74,7 @@ void* CFX_StaticStore::Alloc(size_t size) FXSYS_assert(size != 0); register FX_LPSTATICSTORECHUNK pChunk = FindChunk(size); FXSYS_assert(pChunk != NULL && pChunk->iFreeSize >= size); - register FX_LPBYTE p = (FX_LPBYTE)pChunk; + register uint8_t* p = (uint8_t*)pChunk; p += sizeof(FX_STATICSTORECHUNK) + pChunk->iChunkSize - pChunk->iFreeSize; pChunk->iFreeSize -= size; m_iAllocatedSize += size; @@ -134,7 +134,7 @@ void* CFX_FixedStore::Alloc(size_t size) pChunk = AllocChunk(); } FXSYS_assert(pChunk != NULL); - register FX_LPBYTE pFlags = pChunk->FirstFlag(); + register uint8_t* pFlags = pChunk->FirstFlag(); register size_t i = 0; for (; i < pChunk->iChunkSize; i ++) if (pFlags[i] == 0) { @@ -150,7 +150,8 @@ void CFX_FixedStore::Free(void* pBlock) FXSYS_assert(pBlock != NULL); register FX_LPFIXEDSTORECHUNK pPrior, pChunk; pPrior = NULL, pChunk = m_pChunk; - register FX_LPBYTE pStart = NULL, pEnd; + uint8_t* pStart = NULL; + uint8_t* pEnd; while (pChunk != NULL) { pStart = pChunk->FirstBlock(); if (pBlock >= pStart) { @@ -162,9 +163,9 @@ void CFX_FixedStore::Free(void* pBlock) pPrior = pChunk, pChunk = pChunk->pNextChunk; } FXSYS_assert(pChunk != NULL); - register size_t iPos = ((FX_LPBYTE)pBlock - pStart) / m_iBlockSize; + register size_t iPos = ((uint8_t*)pBlock - pStart) / m_iBlockSize; FXSYS_assert(iPos < pChunk->iChunkSize); - register FX_LPBYTE pFlags = pChunk->FirstFlag(); + register uint8_t* pFlags = pChunk->FirstFlag(); if (pFlags[iPos] == 0) { return; } @@ -279,7 +280,7 @@ void CFX_DynamicStore::Free(void* pBlock) register FX_LPDYNAMICSTORECHUNK pPriorChunk, pChunk; pPriorChunk = NULL, pChunk = m_pChunk; while (pChunk != NULL) { - if (pBlock > pChunk && pBlock <= ((FX_LPBYTE)pChunk + sizeof(FX_DYNAMICSTORECHUNK) + pChunk->iChunkSize)) { + if (pBlock > pChunk && pBlock <= ((uint8_t*)pChunk + sizeof(FX_DYNAMICSTORECHUNK) + pChunk->iChunkSize)) { break; } pPriorChunk = pChunk, pChunk = pChunk->pNextChunk; diff --git a/xfa/src/fgas/src/crt/fx_memory.h b/xfa/src/fgas/src/crt/fx_memory.h index fa58429107..9ce8d2f11c 100644 --- a/xfa/src/fgas/src/crt/fx_memory.h +++ b/xfa/src/fgas/src/crt/fx_memory.h @@ -66,7 +66,7 @@ public: FXTARGET_Delete this; } virtual void* Alloc(size_t size); - virtual void Free(FX_LPVOID pBlock) {} + virtual void Free(void* pBlock) {} virtual size_t GetBlockSize() const { return 0; @@ -92,11 +92,11 @@ protected: #pragma pack(push, 1) #endif typedef struct _FX_FIXEDSTORECHUNK { - FX_LPBYTE FirstFlag() const + uint8_t* FirstFlag() const { - return (FX_LPBYTE)this + sizeof(_FX_FIXEDSTORECHUNK); + return (uint8_t*)this + sizeof(_FX_FIXEDSTORECHUNK); } - FX_LPBYTE FirstBlock() const + uint8_t* FirstBlock() const { return FirstFlag() + iChunkSize; } @@ -118,7 +118,7 @@ public: FXTARGET_Delete this; } virtual void* Alloc(size_t size); - virtual void Free(FX_LPVOID pBlock); + virtual void Free(void* pBlock); virtual size_t GetBlockSize() const { return m_iBlockSize; @@ -146,9 +146,9 @@ typedef struct _FX_DYNAMICSTOREBLOCK { { return (_FX_DYNAMICSTOREBLOCK*)(Data() + iBlockSize); } - FX_LPBYTE Data() const + uint8_t* Data() const { - return (FX_LPBYTE)this + sizeof(_FX_DYNAMICSTOREBLOCK); + return (uint8_t*)this + sizeof(_FX_DYNAMICSTOREBLOCK); } size_t iBlockSize; FX_BOOL bUsed; @@ -157,7 +157,7 @@ typedef FX_DYNAMICSTOREBLOCK const * FX_LPCDYNAMICSTOREBLOCK; typedef struct _FX_DYNAMICSTORECHUNK { FX_LPDYNAMICSTOREBLOCK FirstBlock() const { - return (FX_LPDYNAMICSTOREBLOCK)((FX_LPBYTE)this + sizeof(_FX_DYNAMICSTORECHUNK)); + return (FX_LPDYNAMICSTOREBLOCK)((uint8_t*)this + sizeof(_FX_DYNAMICSTORECHUNK)); } _FX_DYNAMICSTORECHUNK* pNextChunk; size_t iChunkSize; @@ -177,7 +177,7 @@ public: FXTARGET_Delete this; } virtual void* Alloc(size_t size); - virtual void Free(FX_LPVOID pBlock); + virtual void Free(void* pBlock); virtual size_t GetBlockSize() const { return 0; diff --git a/xfa/src/fgas/src/crt/fx_stream.cpp b/xfa/src/fgas/src/crt/fx_stream.cpp index 009cb41f5a..a70fbb6819 100644 --- a/xfa/src/fgas/src/crt/fx_stream.cpp +++ b/xfa/src/fgas/src/crt/fx_stream.cpp @@ -66,7 +66,7 @@ IFX_Stream* IFX_Stream::CreateStream(IFX_FileWrite *pFileWrite, FX_DWORD dwAcces } return pSR; } -IFX_Stream* IFX_Stream::CreateStream(FX_LPCWSTR pszFileName, FX_DWORD dwAccess) +IFX_Stream* IFX_Stream::CreateStream(const FX_WCHAR* pszFileName, FX_DWORD dwAccess) { CFX_Stream *pSR = FX_NEW CFX_Stream; if (pSR == NULL) { @@ -86,7 +86,7 @@ IFX_Stream* IFX_Stream::CreateStream(FX_LPCWSTR pszFileName, FX_DWORD dwAccess) } return pSR; } -IFX_Stream* IFX_Stream::CreateStream(FX_LPBYTE pData, int32_t length, FX_DWORD dwAccess) +IFX_Stream* IFX_Stream::CreateStream(uint8_t* pData, int32_t length, FX_DWORD dwAccess) { CFX_Stream *pSR = FX_NEW CFX_Stream; if (pSR == NULL) { @@ -123,7 +123,7 @@ CFX_FileStreamImp::~CFX_FileStreamImp() FXSYS_fclose(m_hFile); } } -FX_BOOL CFX_FileStreamImp::LoadFile(FX_LPCWSTR pszSrcFileName, FX_DWORD dwAccess) +FX_BOOL CFX_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName, FX_DWORD dwAccess) { FXSYS_assert(m_hFile == NULL); FXSYS_assert(pszSrcFileName != NULL && FXSYS_wcslen(pszSrcFileName) > 0); @@ -237,13 +237,13 @@ FX_BOOL CFX_FileStreamImp::IsEOF() const FXSYS_assert(m_hFile != NULL); return FXSYS_ftell(m_hFile) >= m_iLength; } -int32_t CFX_FileStreamImp::ReadData(FX_LPBYTE pBuffer, int32_t iBufferSize) +int32_t CFX_FileStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { FXSYS_assert(m_hFile != NULL); FXSYS_assert(pBuffer != NULL && iBufferSize > 0); return FXSYS_fread(pBuffer, 1, iBufferSize, m_hFile); } -int32_t CFX_FileStreamImp::ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_BOOL &bEOS) +int32_t CFX_FileStreamImp::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL &bEOS) { FXSYS_assert(m_hFile != NULL); FXSYS_assert(pStr != NULL && iMaxLength > 0); @@ -267,7 +267,7 @@ int32_t CFX_FileStreamImp::ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_BOO bEOS = (iPosition >= m_iLength); return iCount; } -int32_t CFX_FileStreamImp::WriteData(FX_LPCBYTE pBuffer, int32_t iBufferSize) +int32_t CFX_FileStreamImp::WriteData(const uint8_t* pBuffer, int32_t iBufferSize) { FXSYS_assert(m_hFile != NULL && (m_dwAccess & FX_STREAMACCESS_Write) != 0); FXSYS_assert(pBuffer != NULL && iBufferSize > 0); @@ -280,7 +280,7 @@ int32_t CFX_FileStreamImp::WriteData(FX_LPCBYTE pBuffer, int32_t iBufferSize) } return iRet; } -int32_t CFX_FileStreamImp::WriteString(FX_LPCWSTR pStr, int32_t iLength) +int32_t CFX_FileStreamImp::WriteString(const FX_WCHAR* pStr, int32_t iLength) { FXSYS_assert(m_hFile != NULL && (m_dwAccess & FX_STREAMACCESS_Write) != 0); FXSYS_assert(pStr != NULL && iLength > 0); @@ -349,7 +349,7 @@ FX_BOOL CFX_FileReadStreamImp::IsEOF() const { return m_iPosition >= m_iLength; } -int32_t CFX_FileReadStreamImp::ReadData(FX_LPBYTE pBuffer, int32_t iBufferSize) +int32_t CFX_FileReadStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { FXSYS_assert(m_pFileRead != NULL); FXSYS_assert(pBuffer != NULL && iBufferSize > 0); @@ -362,11 +362,11 @@ int32_t CFX_FileReadStreamImp::ReadData(FX_LPBYTE pBuffer, int32_t iBufferSize) } return 0; } -int32_t CFX_FileReadStreamImp::ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_BOOL &bEOS) +int32_t CFX_FileReadStreamImp::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL &bEOS) { FXSYS_assert(m_pFileRead != NULL); FXSYS_assert(pStr != NULL && iMaxLength > 0); - iMaxLength = ReadData((FX_LPBYTE)pStr, iMaxLength * 2) / 2; + iMaxLength = ReadData((uint8_t*)pStr, iMaxLength * 2) / 2; if (iMaxLength <= 0) { return 0; } @@ -441,7 +441,7 @@ FX_BOOL CFX_BufferReadStreamImp::IsEOF() const { return m_pBufferRead ? m_pBufferRead->IsEOF() : TRUE; } -int32_t CFX_BufferReadStreamImp::ReadData(FX_LPBYTE pBuffer, int32_t iBufferSize) +int32_t CFX_BufferReadStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { FXSYS_assert(m_pBufferRead != NULL); FXSYS_assert(pBuffer != NULL && iBufferSize > 0); @@ -471,7 +471,7 @@ int32_t CFX_BufferReadStreamImp::ReadData(FX_LPBYTE pBuffer, int32_t iBufferSize if (m_iPosition < (int32_t)dwBlockOffset || m_iPosition >= (int32_t)(dwBlockOffset + dwBlockSize)) { return 0; } - FX_LPCBYTE pBufferTmp = m_pBufferRead->GetBlockBuffer(); + const uint8_t* pBufferTmp = m_pBufferRead->GetBlockBuffer(); FX_DWORD dwOffsetTmp = m_iPosition - dwBlockOffset; FX_DWORD dwCopySize = FX_MIN(iBufferSize, (int32_t)(dwBlockSize - dwOffsetTmp)); FXSYS_memcpy(pBuffer, pBufferTmp + dwOffsetTmp, dwCopySize); @@ -492,11 +492,11 @@ int32_t CFX_BufferReadStreamImp::ReadData(FX_LPBYTE pBuffer, int32_t iBufferSize m_iPosition += dwOffsetTmp; return dwOffsetTmp; } -int32_t CFX_BufferReadStreamImp::ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_BOOL &bEOS) +int32_t CFX_BufferReadStreamImp::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL &bEOS) { FXSYS_assert(m_pBufferRead != NULL); FXSYS_assert(pStr != NULL && iMaxLength > 0); - iMaxLength = ReadData((FX_LPBYTE)pStr, iMaxLength * 2) / 2; + iMaxLength = ReadData((uint8_t*)pStr, iMaxLength * 2) / 2; if (iMaxLength <= 0) { return 0; } @@ -556,7 +556,7 @@ FX_BOOL CFX_FileWriteStreamImp::IsEOF() const { return m_iPosition >= GetLength(); } -int32_t CFX_FileWriteStreamImp::WriteData(FX_LPCBYTE pBuffer, int32_t iBufferSize) +int32_t CFX_FileWriteStreamImp::WriteData(const uint8_t* pBuffer, int32_t iBufferSize) { if (!m_pFileWrite) { return 0; @@ -566,9 +566,9 @@ int32_t CFX_FileWriteStreamImp::WriteData(FX_LPCBYTE pBuffer, int32_t iBufferSiz } return iBufferSize; } -int32_t CFX_FileWriteStreamImp::WriteString(FX_LPCWSTR pStr, int32_t iLength) +int32_t CFX_FileWriteStreamImp::WriteString(const FX_WCHAR* pStr, int32_t iLength) { - return WriteData((FX_LPCBYTE)pStr, iLength * sizeof(FX_WCHAR)); + return WriteData((const uint8_t*)pStr, iLength * sizeof(FX_WCHAR)); } void CFX_FileWriteStreamImp::Flush() { @@ -584,7 +584,7 @@ CFX_BufferStreamImp::CFX_BufferStreamImp() , m_iLength(0) { } -FX_BOOL CFX_BufferStreamImp::LoadBuffer(FX_LPBYTE pData, int32_t iTotalSize, FX_DWORD dwAccess) +FX_BOOL CFX_BufferStreamImp::LoadBuffer(uint8_t* pData, int32_t iTotalSize, FX_DWORD dwAccess) { FXSYS_assert(m_pData == NULL); FXSYS_assert(pData != NULL && iTotalSize > 0); @@ -628,7 +628,7 @@ FX_BOOL CFX_BufferStreamImp::IsEOF() const FXSYS_assert(m_pData != NULL); return m_iPosition >= m_iLength; } -int32_t CFX_BufferStreamImp::ReadData(FX_LPBYTE pBuffer, int32_t iBufferSize) +int32_t CFX_BufferStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { FXSYS_assert(m_pData != NULL); FXSYS_assert(pBuffer != NULL && iBufferSize > 0); @@ -640,7 +640,7 @@ int32_t CFX_BufferStreamImp::ReadData(FX_LPBYTE pBuffer, int32_t iBufferSize) m_iPosition += iLen; return iLen; } -int32_t CFX_BufferStreamImp::ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_BOOL &bEOS) +int32_t CFX_BufferStreamImp::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL &bEOS) { FXSYS_assert(m_pData != NULL); FXSYS_assert(pStr != NULL && iMaxLength > 0); @@ -648,7 +648,7 @@ int32_t CFX_BufferStreamImp::ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_B if (iLen <= 0) { return 0; } - FX_LPCWSTR pSrc = (FX_LPCWSTR)(FX_LPSTR)(m_pData + m_iPosition); + const FX_WCHAR* pSrc = (const FX_WCHAR*)(FX_CHAR*)(m_pData + m_iPosition); int32_t iCount = 0; while (*pSrc != L'\0' && iCount < iLen) { *pStr ++ = *pSrc ++, iCount ++; @@ -657,7 +657,7 @@ int32_t CFX_BufferStreamImp::ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_B bEOS = (*pSrc == L'\0') || (m_iPosition >= m_iLength); return iCount; } -int32_t CFX_BufferStreamImp::WriteData(FX_LPCBYTE pBuffer, int32_t iBufferSize) +int32_t CFX_BufferStreamImp::WriteData(const uint8_t* pBuffer, int32_t iBufferSize) { FXSYS_assert(m_pData != NULL && (m_dwAccess & FX_STREAMACCESS_Write) != 0); FXSYS_assert(pBuffer != NULL && iBufferSize > 0); @@ -672,7 +672,7 @@ int32_t CFX_BufferStreamImp::WriteData(FX_LPCBYTE pBuffer, int32_t iBufferSize) } return iLen; } -int32_t CFX_BufferStreamImp::WriteString(FX_LPCWSTR pStr, int32_t iLength) +int32_t CFX_BufferStreamImp::WriteString(const FX_WCHAR* pStr, int32_t iLength) { FXSYS_assert(m_pData != NULL && (m_dwAccess & FX_STREAMACCESS_Write) != 0); FXSYS_assert(pStr != NULL && iLength > 0); @@ -720,7 +720,7 @@ void CFX_TextStream::InitStream() { int32_t iPosition = m_pStreamImp->GetPosition(); m_pStreamImp->Seek(FX_STREAMSEEK_Begin, 0); - m_pStreamImp->ReadData((FX_LPBYTE)&m_dwBOM, 3); + m_pStreamImp->ReadData((uint8_t*)&m_dwBOM, 3); #if _FX_ENDIAN_ == _FX_LITTLE_ENDIAN_ m_dwBOM &= 0x00FFFFFF; if (m_dwBOM == 0x00BFBBEF) { @@ -793,11 +793,11 @@ FX_BOOL CFX_TextStream::IsEOF() const { return m_pStreamImp->IsEOF(); } -int32_t CFX_TextStream::ReadData(FX_LPBYTE pBuffer, int32_t iBufferSize) +int32_t CFX_TextStream::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { return m_pStreamImp->ReadData(pBuffer, iBufferSize); } -int32_t CFX_TextStream::WriteData(FX_LPCBYTE pBuffer, int32_t iBufferSize) +int32_t CFX_TextStream::WriteData(const uint8_t* pBuffer, int32_t iBufferSize) { return m_pStreamImp->WriteData(pBuffer, iBufferSize); } @@ -846,7 +846,7 @@ FX_WORD CFX_TextStream::SetCodePage(FX_WORD wCodePage) m_wCodePage = wCodePage; return v; } -int32_t CFX_TextStream::ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_BOOL &bEOS, int32_t const *pByteSize) +int32_t CFX_TextStream::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL &bEOS, int32_t const *pByteSize) { FXSYS_assert(pStr != NULL && iMaxLength > 0); if (m_pStreamImp == NULL) { @@ -856,7 +856,7 @@ int32_t CFX_TextStream::ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_BOOL & if (m_wCodePage == FX_CODEPAGE_UTF16LE || m_wCodePage == FX_CODEPAGE_UTF16BE) { int32_t iBytes = pByteSize == NULL ? iMaxLength * 2 : *pByteSize; m_pStreamImp->Lock(); - iLen = m_pStreamImp->ReadData((FX_LPBYTE)pStr, iBytes); + iLen = m_pStreamImp->ReadData((uint8_t*)pStr, iBytes); m_pStreamImp->Unlock(); iMaxLength = iLen / 2; if (sizeof(FX_WCHAR) > 2) { @@ -877,16 +877,16 @@ int32_t CFX_TextStream::ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_BOOL & iBytes = FX_MIN(iBytes, m_pStreamImp->GetLength() - pos); if (iBytes > 0) { if (m_pBuf == NULL) { - m_pBuf = (FX_LPBYTE)FX_Alloc(uint8_t, iBytes); + m_pBuf = (uint8_t*)FX_Alloc(uint8_t, iBytes); m_iBufSize = iBytes; } else if (iBytes > m_iBufSize) { - m_pBuf = (FX_LPBYTE)FX_Realloc(uint8_t, m_pBuf, iBytes); + m_pBuf = (uint8_t*)FX_Realloc(uint8_t, m_pBuf, iBytes); m_iBufSize = iBytes; } m_pStreamImp->Lock(); iLen = m_pStreamImp->ReadData(m_pBuf, iBytes); int32_t iSrc = iLen; - int32_t iDecode = FX_DecodeString(m_wCodePage, (FX_LPCSTR)m_pBuf, &iSrc, pStr, &iMaxLength, TRUE); + int32_t iDecode = FX_DecodeString(m_wCodePage, (const FX_CHAR*)m_pBuf, &iSrc, pStr, &iMaxLength, TRUE); m_pStreamImp->Seek(FX_STREAMSEEK_Current, iSrc - iLen); m_pStreamImp->Unlock(); if (iDecode < 1) { @@ -899,7 +899,7 @@ int32_t CFX_TextStream::ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_BOOL & bEOS = m_pStreamImp->IsEOF(); return iMaxLength; } -int32_t CFX_TextStream::WriteString(FX_LPCWSTR pStr, int32_t iLength) +int32_t CFX_TextStream::WriteString(const FX_WCHAR* pStr, int32_t iLength) { FXSYS_assert(pStr != NULL && iLength > 0); if ((m_pStreamImp->GetAccessModes() & FX_STREAMACCESS_Write) == 0) { @@ -913,7 +913,7 @@ int32_t CFX_TextStream::WriteString(FX_LPCWSTR pStr, int32_t iLength) } CFX_ByteStringC bsResult = encoder.GetResult(); m_pStreamImp->Lock(); - m_pStreamImp->WriteData((FX_LPCBYTE)bsResult.GetCStr(), bsResult.GetLength()); + m_pStreamImp->WriteData((const uint8_t*)bsResult.GetCStr(), bsResult.GetLength()); m_pStreamImp->Unlock(); } return iLength; @@ -935,7 +935,7 @@ CFX_Stream::~CFX_Stream() m_pStreamImp->Release(); } } -FX_BOOL CFX_Stream::LoadFile(FX_LPCWSTR pszSrcFileName, FX_DWORD dwAccess) +FX_BOOL CFX_Stream::LoadFile(const FX_WCHAR* pszSrcFileName, FX_DWORD dwAccess) { if (m_eStreamType != FX_SREAMTYPE_Unknown || m_pStreamImp != NULL) { return FALSE; @@ -1004,7 +1004,7 @@ FX_BOOL CFX_Stream::LoadFileWrite(IFX_FileWrite *pFileWrite, FX_DWORD dwAccess) } return bRet; } -FX_BOOL CFX_Stream::LoadBuffer(FX_LPBYTE pData, int32_t iTotalSize, FX_DWORD dwAccess) +FX_BOOL CFX_Stream::LoadBuffer(uint8_t* pData, int32_t iTotalSize, FX_DWORD dwAccess) { if (m_eStreamType != FX_SREAMTYPE_Unknown || m_pStreamImp != NULL) { return FALSE; @@ -1116,7 +1116,7 @@ FX_BOOL CFX_Stream::IsEOF() const } return m_iPosition >= m_iStart + m_iLength; } -int32_t CFX_Stream::ReadData(FX_LPBYTE pBuffer, int32_t iBufferSize) +int32_t CFX_Stream::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { FXSYS_assert(pBuffer != NULL && iBufferSize > 0); if (m_pStreamImp == NULL) { @@ -1135,7 +1135,7 @@ int32_t CFX_Stream::ReadData(FX_LPBYTE pBuffer, int32_t iBufferSize) m_pStreamImp->Unlock(); return iLen; } -int32_t CFX_Stream::ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_BOOL &bEOS, int32_t const *pByteSize) +int32_t CFX_Stream::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL &bEOS, int32_t const *pByteSize) { FXSYS_assert(pStr != NULL && iMaxLength > 0); if (m_pStreamImp == NULL) { @@ -1162,7 +1162,7 @@ int32_t CFX_Stream::ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_BOOL &bEOS m_pStreamImp->Unlock(); return iLen; } -int32_t CFX_Stream::WriteData(FX_LPCBYTE pBuffer, int32_t iBufferSize) +int32_t CFX_Stream::WriteData(const uint8_t* pBuffer, int32_t iBufferSize) { FXSYS_assert(pBuffer != NULL && iBufferSize > 0); if (m_pStreamImp == NULL) { @@ -1191,7 +1191,7 @@ int32_t CFX_Stream::WriteData(FX_LPCBYTE pBuffer, int32_t iBufferSize) m_pStreamImp->Unlock(); return iLen; } -int32_t CFX_Stream::WriteString(FX_LPCWSTR pStr, int32_t iLength) +int32_t CFX_Stream::WriteString(const FX_WCHAR* pStr, int32_t iLength) { FXSYS_assert(pStr != NULL && iLength > 0); if (m_pStreamImp == NULL) { @@ -1326,7 +1326,7 @@ FX_BOOL CFGAS_FileRead::ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) { m_pStream->Lock(); m_pStream->Seek(FX_STREAMSEEK_Begin, (int32_t)offset); - int32_t iLen = m_pStream->ReadData((FX_LPBYTE)buffer, (int32_t)size); + int32_t iLen = m_pStream->ReadData((uint8_t*)buffer, (int32_t)size); m_pStream->Unlock(); return iLen == (int32_t)size; } @@ -1351,7 +1351,7 @@ FX_BOOL CFGAS_FileRead::ReadBlock(void* buffer, FX_DWORD offset, FX_DWORD size) { m_pStream->Lock(); m_pStream->Seek(FX_STREAMSEEK_Begin, (int32_t)offset); - int32_t iLen = m_pStream->ReadData((FX_LPBYTE)buffer, (int32_t)size); + int32_t iLen = m_pStream->ReadData((uint8_t*)buffer, (int32_t)size); m_pStream->Unlock(); return iLen == (int32_t)size; } @@ -1426,7 +1426,7 @@ FX_BOOL CFX_BufferAccImp::ReadBlock(void* buffer, FX_FILESIZE offset, size_t siz if (offset < dwBlockOffset || offset >= (FX_FILESIZE)(dwBlockOffset + dwBlockSize)) { return FALSE; } - FX_LPCBYTE pBuffer = m_pBufferRead->GetBlockBuffer(); + const uint8_t* pBuffer = m_pBufferRead->GetBlockBuffer(); FX_FILESIZE dwOffset = offset - dwBlockOffset; size_t dwCopySize = FX_MIN(size, dwBlockSize - dwOffset); FXSYS_memcpy(buffer, pBuffer + dwOffset, dwCopySize); @@ -1440,7 +1440,7 @@ FX_BOOL CFX_BufferAccImp::ReadBlock(void* buffer, FX_FILESIZE offset, size_t siz dwBlockSize = m_pBufferRead->GetBlockSize(); pBuffer = m_pBufferRead->GetBlockBuffer(); dwCopySize = FX_MIN(size, dwBlockSize); - FXSYS_memcpy(((FX_LPBYTE)buffer) + offset, pBuffer, dwCopySize); + FXSYS_memcpy(((uint8_t*)buffer) + offset, pBuffer, dwCopySize); offset += dwCopySize; size -= dwCopySize; } @@ -1516,7 +1516,7 @@ FX_BOOL CFX_BufferAccImp::ReadBlock(void* buffer, FX_DWORD offset, FX_DWORD size if (offset < dwBlockOffset || offset >= (FX_DWORD)(dwBlockOffset + dwBlockSize)) { return FALSE; } - FX_LPCBYTE pBuffer = m_pBufferRead->GetBlockBuffer(); + const uint8_t* pBuffer = m_pBufferRead->GetBlockBuffer(); FX_DWORD dwOffset = offset - dwBlockOffset; FX_DWORD dwCopySize = FX_MIN(size, dwBlockSize - dwOffset); FXSYS_memcpy(buffer, pBuffer + dwOffset, dwCopySize); @@ -1530,7 +1530,7 @@ FX_BOOL CFX_BufferAccImp::ReadBlock(void* buffer, FX_DWORD offset, FX_DWORD size dwBlockSize = m_pBufferRead->GetBlockSize(); pBuffer = m_pBufferRead->GetBlockBuffer(); dwCopySize = FX_MIN(size, dwBlockSize); - FXSYS_memcpy(((FX_LPBYTE)buffer) + offset, pBuffer, dwCopySize); + FXSYS_memcpy(((uint8_t*)buffer) + offset, pBuffer, dwCopySize); offset += dwCopySize; size -= dwCopySize; } @@ -1566,13 +1566,13 @@ FX_BOOL CFGAS_FileWrite::Flush() } FX_BOOL CFGAS_FileWrite::WriteBlock(const void* pData, size_t size) { - return m_pStream->WriteData((FX_LPCBYTE)pData, (int32_t)size) == (int32_t)size; + return m_pStream->WriteData((const uint8_t*)pData, (int32_t)size) == (int32_t)size; } FX_BOOL CFGAS_FileWrite::WriteBlock(const void* pData, FX_FILESIZE offset, size_t size) { m_pStream->Lock(); m_pStream->Seek(FX_STREAMSEEK_Begin, offset); - int32_t iLen = m_pStream->WriteData((FX_LPBYTE)pData, (int32_t)size); + int32_t iLen = m_pStream->WriteData((uint8_t*)pData, (int32_t)size); m_pStream->Unlock(); return iLen == (int32_t)size; } @@ -1600,13 +1600,13 @@ FX_DWORD CFGAS_FileWrite::Flush() } FX_BOOL CFGAS_FileWrite::WriteBlock(const void* pData, FX_DWORD size) { - return m_pStream->WriteData((FX_LPCBYTE)pData, (int32_t)size) == (int32_t)size; + return m_pStream->WriteData((const uint8_t*)pData, (int32_t)size) == (int32_t)size; } FX_BOOL CFGAS_FileWrite::WriteBlock(const void* pData, FX_DWORD offset, FX_DWORD size) { m_pStream->Lock(); m_pStream->Seek(FX_STREAMSEEK_Begin, offset); - int32_t iLen = m_pStream->WriteData((FX_LPBYTE)pData, (int32_t)size); + int32_t iLen = m_pStream->WriteData((uint8_t*)pData, (int32_t)size); m_pStream->Unlock(); return iLen == (int32_t)size; } diff --git a/xfa/src/fgas/src/crt/fx_stream.h b/xfa/src/fgas/src/crt/fx_stream.h index 2273ab1d9b..d89731b4ec 100644 --- a/xfa/src/fgas/src/crt/fx_stream.h +++ b/xfa/src/fgas/src/crt/fx_stream.h @@ -32,10 +32,10 @@ public: virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) = 0; virtual int32_t GetPosition() = 0; virtual FX_BOOL IsEOF() const = 0; - virtual int32_t ReadData(FX_LPBYTE pBuffer, int32_t iBufferSize) = 0; - virtual int32_t ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_BOOL &bEOS) = 0; - virtual int32_t WriteData(FX_LPCBYTE pBuffer, int32_t iBufferSize) = 0; - virtual int32_t WriteString(FX_LPCWSTR pStr, int32_t iLength) = 0; + virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) = 0; + virtual int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL &bEOS) = 0; + virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) = 0; + virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) = 0; virtual void Flush() = 0; virtual FX_BOOL SetLength(int32_t iLength) = 0; protected: @@ -48,15 +48,15 @@ class CFX_FileStreamImp : public CFX_StreamImp public: CFX_FileStreamImp(); virtual ~CFX_FileStreamImp(); - FX_BOOL LoadFile(FX_LPCWSTR pszSrcFileName, FX_DWORD dwAccess); + FX_BOOL LoadFile(const FX_WCHAR* pszSrcFileName, FX_DWORD dwAccess); virtual int32_t GetLength() const; virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset); virtual int32_t GetPosition(); virtual FX_BOOL IsEOF() const; - virtual int32_t ReadData(FX_LPBYTE pBuffer, int32_t iBufferSize); - virtual int32_t ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_BOOL &bEOS); - virtual int32_t WriteData(FX_LPCBYTE pBuffer, int32_t iBufferSize); - virtual int32_t WriteString(FX_LPCWSTR pStr, int32_t iLength); + virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize); + virtual int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL &bEOS); + virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize); + virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength); virtual void Flush(); virtual FX_BOOL SetLength(int32_t iLength); protected: @@ -68,22 +68,22 @@ class CFX_BufferStreamImp : public CFX_StreamImp public: CFX_BufferStreamImp(); virtual ~CFX_BufferStreamImp() {} - FX_BOOL LoadBuffer(FX_LPBYTE pData, int32_t iTotalSize, FX_DWORD dwAccess); + FX_BOOL LoadBuffer(uint8_t* pData, int32_t iTotalSize, FX_DWORD dwAccess); virtual int32_t GetLength() const; virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset); virtual int32_t GetPosition(); virtual FX_BOOL IsEOF() const; - virtual int32_t ReadData(FX_LPBYTE pBuffer, int32_t iBufferSize); - virtual int32_t ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_BOOL &bEOS); - virtual int32_t WriteData(FX_LPCBYTE pBuffer, int32_t iBufferSize); - virtual int32_t WriteString(FX_LPCWSTR pStr, int32_t iLength); + virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize); + virtual int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL &bEOS); + virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize); + virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength); virtual void Flush() {} virtual FX_BOOL SetLength(int32_t iLength) { return FALSE; } protected: - FX_LPBYTE m_pData; + uint8_t* m_pData; int32_t m_iTotalSize; int32_t m_iPosition; int32_t m_iLength; @@ -102,13 +102,13 @@ public: } virtual FX_BOOL IsEOF() const; - virtual int32_t ReadData(FX_LPBYTE pBuffer, int32_t iBufferSize); - virtual int32_t ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_BOOL &bEOS); - virtual int32_t WriteData(FX_LPCBYTE pBuffer, int32_t iBufferSize) + virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize); + virtual int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL &bEOS); + virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) { return 0; } - virtual int32_t WriteString(FX_LPCWSTR pStr, int32_t iLength) + virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) { return 0; } @@ -137,13 +137,13 @@ public: } virtual FX_BOOL IsEOF() const; - virtual int32_t ReadData(FX_LPBYTE pBuffer, int32_t iBufferSize); - virtual int32_t ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_BOOL &bEOS); - virtual int32_t WriteData(FX_LPCBYTE pBuffer, int32_t iBufferSize) + virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize); + virtual int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL &bEOS); + virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) { return 0; } - virtual int32_t WriteString(FX_LPCWSTR pStr, int32_t iLength) + virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) { return 0; } @@ -171,16 +171,16 @@ public: return m_iPosition; } virtual FX_BOOL IsEOF() const; - virtual int32_t ReadData(FX_LPBYTE pBuffer, int32_t iBufferSize) + virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) { return 0; } - virtual int32_t ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_BOOL &bEOS) + virtual int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL &bEOS) { return 0; } - virtual int32_t WriteData(FX_LPCBYTE pBuffer, int32_t iBufferSize); - virtual int32_t WriteString(FX_LPCWSTR pStr, int32_t iLength); + virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize); + virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength); virtual void Flush(); virtual FX_BOOL SetLength(int32_t iLength) { @@ -202,8 +202,8 @@ class CFX_Stream : public IFX_Stream, public CFX_ThreadLock public: CFX_Stream(); ~CFX_Stream(); - FX_BOOL LoadFile(FX_LPCWSTR pszSrcFileName, FX_DWORD dwAccess); - FX_BOOL LoadBuffer(FX_LPBYTE pData, int32_t iTotalSize, FX_DWORD dwAccess); + FX_BOOL LoadFile(const FX_WCHAR* pszSrcFileName, FX_DWORD dwAccess); + FX_BOOL LoadBuffer(uint8_t* pData, int32_t iTotalSize, FX_DWORD dwAccess); FX_BOOL LoadFileRead(IFX_FileRead *pFileRead, FX_DWORD dwAccess); FX_BOOL LoadFileWrite(IFX_FileWrite *pFileWrite, FX_DWORD dwAccess); FX_BOOL LoadBufferRead(IFX_BufferRead *pBufferRead, int32_t iFileSize, FX_DWORD dwAccess, FX_BOOL bReleaseBufferRead); @@ -217,10 +217,10 @@ public: virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset); virtual int32_t GetPosition(); virtual FX_BOOL IsEOF() const; - virtual int32_t ReadData(FX_LPBYTE pBuffer, int32_t iBufferSize); - virtual int32_t ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_BOOL &bEOS, int32_t const *pByteSize = NULL); - virtual int32_t WriteData(FX_LPCBYTE pBuffer, int32_t iBufferSize); - virtual int32_t WriteString(FX_LPCWSTR pStr, int32_t iLength); + virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize); + virtual int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL &bEOS, int32_t const *pByteSize = NULL); + virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize); + virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength); virtual void Flush(); virtual FX_BOOL SetLength(int32_t iLength); virtual int32_t GetBOM(uint8_t bom[4]) const; @@ -259,10 +259,10 @@ public: virtual int32_t GetPosition(); virtual FX_BOOL IsEOF() const; - virtual int32_t ReadData(FX_LPBYTE pBuffer, int32_t iBufferSize); - virtual int32_t ReadString(FX_LPWSTR pStr, int32_t iMaxLength, FX_BOOL &bEOS, int32_t const *pByteSize = NULL); - virtual int32_t WriteData(FX_LPCBYTE pBuffer, int32_t iBufferSize); - virtual int32_t WriteString(FX_LPCWSTR pStr, int32_t iLength); + virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize); + virtual int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL &bEOS, int32_t const *pByteSize = NULL); + virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize); + virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength); virtual void Flush(); virtual FX_BOOL SetLength(int32_t iLength); @@ -284,7 +284,7 @@ protected: FX_WORD m_wCodePage; FX_WORD m_wBOMLength; FX_DWORD m_dwBOM; - FX_LPBYTE m_pBuf; + uint8_t* m_pBuf; int32_t m_iBufSize; FX_BOOL m_bDelStream; IFX_Stream *m_pStreamImp; diff --git a/xfa/src/fgas/src/crt/fx_system.cpp b/xfa/src/fgas/src/crt/fx_system.cpp index 88f1631b7f..843e29c447 100644 --- a/xfa/src/fgas/src/crt/fx_system.cpp +++ b/xfa/src/fgas/src/crt/fx_system.cpp @@ -21,7 +21,7 @@ FX_FLOAT FX_log(FX_FLOAT b, FX_FLOAT x) { return FXSYS_log(x) / FXSYS_log(b); } -FX_LPWSTR FX_wcsncpy(FX_LPWSTR dstStr, FX_LPCWSTR srcStr, size_t count) +FX_WCHAR* FX_wcsncpy(FX_WCHAR* dstStr, const FX_WCHAR* srcStr, size_t count) { FXSYS_assert(dstStr != NULL && srcStr != NULL && count > 0); for (size_t i = 0; i < count; ++i) @@ -30,7 +30,7 @@ FX_LPWSTR FX_wcsncpy(FX_LPWSTR dstStr, FX_LPCWSTR srcStr, size_t count) } return dstStr; } -int32_t FX_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count) +int32_t FX_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count) { FXSYS_assert(s1 != NULL && s2 != NULL && count > 0); FX_WCHAR wch1 = 0, wch2 = 0; @@ -43,7 +43,7 @@ int32_t FX_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count) } return wch1 - wch2; } -int32_t FX_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count) +int32_t FX_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count) { FXSYS_assert(s1 != NULL && s2 != NULL && count > 0); FX_CHAR ch1 = 0, ch2 = 0; @@ -85,7 +85,7 @@ FX_BOOL FX_fsetsize(FXSYS_FILE *file, int32_t size) return FALSE; #endif } -FX_FLOAT FX_strtof(FX_LPCSTR pcsStr, int32_t iLength , int32_t *pUsedLen ) +FX_FLOAT FX_strtof(const FX_CHAR* pcsStr, int32_t iLength , int32_t *pUsedLen ) { FXSYS_assert(pcsStr != NULL); if (iLength < 0) { @@ -93,7 +93,7 @@ FX_FLOAT FX_strtof(FX_LPCSTR pcsStr, int32_t iLength , int32_t *pUsedLen ) } return FX_wcstof(CFX_WideString::FromLocal(pcsStr, iLength), iLength, pUsedLen); } -FX_FLOAT FX_wcstof(FX_LPCWSTR pwsStr, int32_t iLength , int32_t *pUsedLen ) +FX_FLOAT FX_wcstof(const FX_WCHAR* pwsStr, int32_t iLength , int32_t *pUsedLen ) { FXSYS_assert(pwsStr != NULL); if (iLength < 0) { @@ -138,7 +138,7 @@ FX_FLOAT FX_wcstof(FX_LPCWSTR pwsStr, int32_t iLength , int32_t *pUsedLen ) } return bNegtive ? -fValue : fValue; } -void FX_memset(FX_LPVOID pBuf, int32_t iValue, size_t size) +void FX_memset(void* pBuf, int32_t iValue, size_t size) { FXSYS_assert(pBuf != NULL && size > 0 && (size & 0x03) == 0); FXSYS_assert((((size_t)pBuf) & 0x03) == 0); @@ -148,7 +148,7 @@ void FX_memset(FX_LPVOID pBuf, int32_t iValue, size_t size) *pStart ++ = iValue; } } -void FX_memcpy(FX_LPVOID pDst, FX_LPCVOID pSrc, size_t size) +void FX_memcpy(void* pDst, const void* pSrc, size_t size) { FXSYS_assert(pDst != NULL && pSrc != NULL && size > 0 && (size & 0x03) == 0); FXSYS_assert((((size_t)pDst) & 0x03) == 0 && (((size_t)pSrc) & 0x03) == 0); @@ -177,8 +177,8 @@ FX_BOOL FX_JoinPath(const CFX_WideStringC &wsBasePath, const CFX_WideStringC &ws wsAbsolutePath = wsRelativePath; return TRUE; } - FX_LPCWSTR pRelStart = wsRelativePath.GetPtr(); - FX_LPCWSTR pRelEnd = pRelStart + wsRelativePath.GetLength(); + const FX_WCHAR* pRelStart = wsRelativePath.GetPtr(); + const FX_WCHAR* pRelEnd = pRelStart + wsRelativePath.GetLength(); if (pRelStart < pRelEnd) { switch (*pRelStart) { case '#': @@ -211,8 +211,8 @@ FX_BOOL FX_JoinPath(const CFX_WideStringC &wsBasePath, const CFX_WideStringC &ws return FALSE; } } - FX_LPCWSTR pBaseStart = wsBasePath.GetPtr(); - FX_LPCWSTR pBaseEnd = pBaseStart + wsBasePath.GetLength(); + const FX_WCHAR* pBaseStart = wsBasePath.GetPtr(); + const FX_WCHAR* pBaseEnd = pBaseStart + wsBasePath.GetLength(); while(pBaseStart < (--pBaseEnd) && *pBaseEnd != '/' && *pBaseEnd != '\\') ; if (pBaseStart == pBaseEnd) { diff --git a/xfa/src/fgas/src/crt/fx_utils.cpp b/xfa/src/fgas/src/crt/fx_utils.cpp index 55d97f0ea6..85f650b1d1 100644 --- a/xfa/src/fgas/src/crt/fx_utils.cpp +++ b/xfa/src/fgas/src/crt/fx_utils.cpp @@ -24,7 +24,7 @@ typedef struct _FX_BASEARRAYDATA : public CFX_Target { int32_t iBlockSize; int32_t iTotalCount; int32_t iBlockCount; - FX_LPBYTE pBuffer; + uint8_t* pBuffer; } FX_BASEARRAYDATA, * FX_LPBASEARRAYDATA; typedef FX_BASEARRAYDATA const * FX_LPCBASEARRAYDATA; CFX_BaseArray::CFX_BaseArray(int32_t iGrowSize, int32_t iBlockSize) @@ -51,10 +51,10 @@ int32_t CFX_BaseArray::GetBlockSize() const { return ((FX_LPBASEARRAYDATA)m_pData)->iBlockSize; } -FX_LPBYTE CFX_BaseArray::AddSpaceTo(int32_t index) +uint8_t* CFX_BaseArray::AddSpaceTo(int32_t index) { FXSYS_assert(index > -1); - FX_LPBYTE &pBuffer = ((FX_LPBASEARRAYDATA)m_pData)->pBuffer; + uint8_t* &pBuffer = ((FX_LPBASEARRAYDATA)m_pData)->pBuffer; int32_t &iTotalCount = ((FX_LPBASEARRAYDATA)m_pData)->iTotalCount; int32_t iBlockSize = ((FX_LPBASEARRAYDATA)m_pData)->iBlockSize; if (index >= iTotalCount) { @@ -62,9 +62,9 @@ FX_LPBYTE CFX_BaseArray::AddSpaceTo(int32_t index) iTotalCount = (index / iGrowSize + 1) * iGrowSize; int32_t iNewSize = iTotalCount * iBlockSize; if (pBuffer == NULL) { - pBuffer = (FX_LPBYTE)FX_Alloc(uint8_t, iNewSize); + pBuffer = (uint8_t*)FX_Alloc(uint8_t, iNewSize); } else { - pBuffer = (FX_LPBYTE)FX_Realloc(uint8_t, pBuffer, iNewSize); + pBuffer = (uint8_t*)FX_Realloc(uint8_t, pBuffer, iNewSize); } } FXSYS_assert(pBuffer != NULL); @@ -74,12 +74,12 @@ FX_LPBYTE CFX_BaseArray::AddSpaceTo(int32_t index) } return pBuffer + index * iBlockSize; } -FX_LPBYTE CFX_BaseArray::GetAt(int32_t index) const +uint8_t* CFX_BaseArray::GetAt(int32_t index) const { FXSYS_assert(index > -1 && index < ((FX_LPBASEARRAYDATA)m_pData)->iBlockCount); return ((FX_LPBASEARRAYDATA)m_pData)->pBuffer + index * ((FX_LPBASEARRAYDATA)m_pData)->iBlockSize; } -FX_LPBYTE CFX_BaseArray::GetBuffer() const +uint8_t* CFX_BaseArray::GetBuffer() const { return ((FX_LPBASEARRAYDATA)m_pData)->pBuffer; } @@ -99,7 +99,7 @@ int32_t CFX_BaseArray::Append(const CFX_BaseArray &src, int32_t iStart, int32_t if (iCount < 1) { return 0; } - FX_LPBYTE pDst = ((FX_LPBASEARRAYDATA)m_pData)->pBuffer + iBlockCount * iBlockSize; + uint8_t* pDst = ((FX_LPBASEARRAYDATA)m_pData)->pBuffer + iBlockCount * iBlockSize; AddSpaceTo(iBlockCount + iCount - 1); FX_memcpy(pDst, ((FX_LPBASEARRAYDATA)src.m_pData)->pBuffer + iStart * iBlockSize, iCount * iBlockSize); return iCount; @@ -138,7 +138,7 @@ int32_t CFX_BaseArray::RemoveLast(int32_t iCount) void CFX_BaseArray::RemoveAll(FX_BOOL bLeaveMemory) { if (!bLeaveMemory) { - FX_LPBYTE &pBuffer = ((FX_LPBASEARRAYDATA)m_pData)->pBuffer; + uint8_t* &pBuffer = ((FX_LPBASEARRAYDATA)m_pData)->pBuffer; if (pBuffer != NULL) { FX_Free(pBuffer); pBuffer = NULL; @@ -162,20 +162,20 @@ CFX_BaseMassArrayImp::~CFX_BaseMassArrayImp() RemoveAll(); delete m_pData; } -FX_LPBYTE CFX_BaseMassArrayImp::AddSpaceTo(int32_t index) +uint8_t* CFX_BaseMassArrayImp::AddSpaceTo(int32_t index) { FXSYS_assert(index > -1); - FX_LPBYTE pChunk; + uint8_t* pChunk; if (index < m_iBlockCount) { - pChunk = (FX_LPBYTE)m_pData->GetAt(index / m_iChunkSize); + pChunk = (uint8_t*)m_pData->GetAt(index / m_iChunkSize); } else { int32_t iMemSize = m_iChunkSize * m_iBlockSize; while (TRUE) { if (index < m_iChunkCount * m_iChunkSize) { - pChunk = (FX_LPBYTE)m_pData->GetAt(index / m_iChunkSize); + pChunk = (uint8_t*)m_pData->GetAt(index / m_iChunkSize); break; } else { - pChunk = (FX_LPBYTE)FX_Alloc(uint8_t, iMemSize); + pChunk = (uint8_t*)FX_Alloc(uint8_t, iMemSize); if (m_iChunkCount < m_pData->GetSize()) { m_pData->SetAt(m_iChunkCount, pChunk); } else { @@ -189,10 +189,10 @@ FX_LPBYTE CFX_BaseMassArrayImp::AddSpaceTo(int32_t index) m_iBlockCount = index + 1; return pChunk + (index % m_iChunkSize) * m_iBlockSize; } -FX_LPBYTE CFX_BaseMassArrayImp::GetAt(int32_t index) const +uint8_t* CFX_BaseMassArrayImp::GetAt(int32_t index) const { FXSYS_assert(index > -1 && index < m_iBlockCount); - FX_LPBYTE pChunk = (FX_LPBYTE)m_pData->GetAt(index / m_iChunkSize); + uint8_t* pChunk = (uint8_t*)m_pData->GetAt(index / m_iChunkSize); FXSYS_assert(pChunk != NULL); return pChunk + (index % m_iChunkSize) * m_iBlockSize; } @@ -248,8 +248,8 @@ void CFX_BaseMassArrayImp::Append(int32_t iDstStart, const CFX_BaseMassArrayImp FXSYS_assert(iSrcStart > -1 && iSrcStart < iSrcTotal && iSrcCount > 0 && iSrcStart + iSrcCount <= iSrcTotal); int32_t iDstChunkIndex = iDstStart / m_iChunkSize; int32_t iSrcChunkIndex = iSrcStart / src.m_iChunkSize; - FX_LPBYTE pDstChunk = (FX_LPBYTE)GetAt(iDstStart); - FX_LPBYTE pSrcChunk = (FX_LPBYTE)src.GetAt(iSrcStart); + uint8_t* pDstChunk = (uint8_t*)GetAt(iDstStart); + uint8_t* pSrcChunk = (uint8_t*)src.GetAt(iSrcStart); int32_t iDstChunkSize = m_iChunkSize - (iDstStart % m_iChunkSize); int32_t iSrcChunkSize = src.m_iChunkSize - (iSrcStart % src.m_iChunkSize); int32_t iCopySize = FX_MIN(iSrcCount, FX_MIN(iSrcChunkSize, iDstChunkSize)); @@ -262,7 +262,7 @@ void CFX_BaseMassArrayImp::Append(int32_t iDstStart, const CFX_BaseMassArrayImp if (iSrcChunkSize < 1) { iSrcChunkSize = src.m_iChunkSize; iSrcChunkIndex ++; - pSrcChunk = (FX_LPBYTE)src.m_pData->GetAt(iSrcChunkIndex); + pSrcChunk = (uint8_t*)src.m_pData->GetAt(iSrcChunkIndex); } else { pSrcChunk += iCopyBytes; } @@ -270,7 +270,7 @@ void CFX_BaseMassArrayImp::Append(int32_t iDstStart, const CFX_BaseMassArrayImp if (iDstChunkSize < 1) { iDstChunkSize = m_iChunkSize; iDstChunkIndex ++; - pDstChunk = (FX_LPBYTE)m_pData->GetAt(iDstChunkIndex); + pDstChunk = (uint8_t*)m_pData->GetAt(iDstChunkIndex); } else { pDstChunk += iCopyBytes; } @@ -294,7 +294,7 @@ void CFX_BaseMassArrayImp::RemoveAll(FX_BOOL bLeaveMemory) return; } for (int32_t i = 0; i < m_iChunkCount; i ++) { - FX_LPVOID p = m_pData->GetAt(i); + void* p = m_pData->GetAt(i); if (p == NULL) { continue; } @@ -316,11 +316,11 @@ int32_t CFX_BaseMassArray::GetSize() const { return m_pData->m_iBlockCount; } -FX_LPBYTE CFX_BaseMassArray::AddSpaceTo(int32_t index) +uint8_t* CFX_BaseMassArray::AddSpaceTo(int32_t index) { return m_pData->AddSpaceTo(index); } -FX_LPBYTE CFX_BaseMassArray::GetAt(int32_t index) const +uint8_t* CFX_BaseMassArray::GetAt(int32_t index) const { return m_pData->GetAt(index); } @@ -362,20 +362,20 @@ CFX_BaseDiscreteArray::~CFX_BaseDiscreteArray() RemoveAll(); delete (FX_LPBASEDISCRETEARRAYDATA)m_pData; } -FX_LPBYTE CFX_BaseDiscreteArray::AddSpaceTo(int32_t index) +uint8_t* CFX_BaseDiscreteArray::AddSpaceTo(int32_t index) { FXSYS_assert(index > -1); FX_LPBASEDISCRETEARRAYDATA pData = (FX_LPBASEDISCRETEARRAYDATA)m_pData; int32_t &iChunkCount = pData->iChunkCount; int32_t iChunkSize = pData->iChunkSize; - FX_LPBYTE pChunk = NULL; + uint8_t* pChunk = NULL; int32_t iChunk = index / iChunkSize; if (iChunk < iChunkCount) { - pChunk = (FX_LPBYTE)pData->ChunkBuffer.GetAt(iChunk); + pChunk = (uint8_t*)pData->ChunkBuffer.GetAt(iChunk); } if (pChunk == NULL) { int32_t iMemSize = iChunkSize * pData->iBlockSize; - pChunk = (FX_LPBYTE)FX_Alloc(uint8_t, iMemSize); + pChunk = (uint8_t*)FX_Alloc(uint8_t, iMemSize); FXSYS_memset(pChunk, 0, iMemSize); pData->ChunkBuffer.SetAtGrow(iChunk, pChunk); if (iChunkCount <= iChunk) { @@ -384,7 +384,7 @@ FX_LPBYTE CFX_BaseDiscreteArray::AddSpaceTo(int32_t index) } return pChunk + (index % iChunkSize) * pData->iBlockSize; } -FX_LPBYTE CFX_BaseDiscreteArray::GetAt(int32_t index) const +uint8_t* CFX_BaseDiscreteArray::GetAt(int32_t index) const { FXSYS_assert(index > -1); FX_LPBASEDISCRETEARRAYDATA pData = (FX_LPBASEDISCRETEARRAYDATA)m_pData; @@ -393,7 +393,7 @@ FX_LPBYTE CFX_BaseDiscreteArray::GetAt(int32_t index) const if (iChunk >= pData->iChunkCount) { return NULL; } - FX_LPBYTE pChunk = (FX_LPBYTE)pData->ChunkBuffer.GetAt(iChunk); + uint8_t* pChunk = (uint8_t*)pData->ChunkBuffer.GetAt(iChunk); if (pChunk == NULL) { return NULL; } @@ -405,7 +405,7 @@ void CFX_BaseDiscreteArray::RemoveAll() CFX_PtrArray &ChunkBuffer = pData->ChunkBuffer; int32_t &iChunkCount = pData->iChunkCount; for (int32_t i = 0; i < iChunkCount; i++) { - FX_LPVOID p = ChunkBuffer.GetAt(i); + void* p = ChunkBuffer.GetAt(i); if (p == NULL) { continue; } @@ -422,7 +422,7 @@ CFX_BaseStack::~CFX_BaseStack() { FXTARGET_Delete (CFX_BaseMassArrayImp*)m_pData; } -FX_LPBYTE CFX_BaseStack::Push() +uint8_t* CFX_BaseStack::Push() { return m_pData->AddSpace(); } @@ -434,7 +434,7 @@ void CFX_BaseStack::Pop() } iBlockCount --; } -FX_LPBYTE CFX_BaseStack::GetTopElement() const +uint8_t* CFX_BaseStack::GetTopElement() const { int32_t iSize = m_pData->m_iBlockCount; if (iSize < 1) { @@ -446,7 +446,7 @@ int32_t CFX_BaseStack::GetSize() const { return m_pData->m_iBlockCount; } -FX_LPBYTE CFX_BaseStack::GetAt(int32_t index) const +uint8_t* CFX_BaseStack::GetAt(int32_t index) const { return m_pData->GetAt(index); } diff --git a/xfa/src/fgas/src/crt/fx_utils.h b/xfa/src/fgas/src/crt/fx_utils.h index 92c2bcb198..42326570f0 100644 --- a/xfa/src/fgas/src/crt/fx_utils.h +++ b/xfa/src/fgas/src/crt/fx_utils.h @@ -11,12 +11,12 @@ class CFX_BaseMassArrayImp : public CFX_Target public: CFX_BaseMassArrayImp(int32_t iChunkSize, int32_t iBlockSize); ~CFX_BaseMassArrayImp(); - FX_LPBYTE AddSpace() + uint8_t* AddSpace() { return AddSpaceTo(m_iBlockCount); } - FX_LPBYTE AddSpaceTo(int32_t index); - FX_LPBYTE GetAt(int32_t index) const; + uint8_t* AddSpaceTo(int32_t index); + uint8_t* GetAt(int32_t index) const; int32_t Append(const CFX_BaseMassArrayImp &src, int32_t iStart = 0, int32_t iCount = -1); int32_t Copy(const CFX_BaseMassArrayImp &src, int32_t iStart = 0, int32_t iCount = -1); int32_t RemoveLast(int32_t iCount = -1); diff --git a/xfa/src/fgas/src/font/fx_fontutils.cpp b/xfa/src/fgas/src/font/fx_fontutils.cpp index 24e77c1c93..f6fe9c66e7 100644 --- a/xfa/src/fgas/src/font/fx_fontutils.cpp +++ b/xfa/src/fgas/src/font/fx_fontutils.cpp @@ -29,7 +29,7 @@ FX_DWORD FGAS_GetFontHashCode(FX_WORD wCodePage, FX_DWORD dwFontStyles) } return dwHash; } -FX_DWORD FGAS_GetFontFamilyHash(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage) +FX_DWORD FGAS_GetFontFamilyHash(const FX_WCHAR* pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage) { CFX_WideString wsFont(pszFontFamily); if (dwFontStyles & FX_FONTSTYLE_Bold) { @@ -39,7 +39,7 @@ FX_DWORD FGAS_GetFontFamilyHash(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, wsFont += L"Italic"; } wsFont += wCodePage; - return FX_HashCode_String_GetW((FX_LPCWSTR)wsFont, wsFont.GetLength()); + return FX_HashCode_String_GetW((const FX_WCHAR*)wsFont, wsFont.GetLength()); } static const FGAS_FONTUSB g_FXGdiFontUSBTable[] = { {0x0000 , 0x007F , 0 , 1252 }, diff --git a/xfa/src/fgas/src/font/fx_fontutils.h b/xfa/src/fgas/src/font/fx_fontutils.h index 1e3088fde8..2f13e7d1c2 100644 --- a/xfa/src/fgas/src/font/fx_fontutils.h +++ b/xfa/src/fgas/src/font/fx_fontutils.h @@ -14,6 +14,6 @@ typedef struct _FGAS_FONTUSB { } FGAS_FONTUSB, * FGAS_LPFONTUSB; typedef FGAS_FONTUSB const * FGAS_LPCFONTUSB; FX_DWORD FGAS_GetFontHashCode(FX_WORD wCodePage, FX_DWORD dwFontStyles); -FX_DWORD FGAS_GetFontFamilyHash(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage); +FX_DWORD FGAS_GetFontFamilyHash(const FX_WCHAR* pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage); FGAS_LPCFONTUSB FGAS_GetUnicodeBitField(FX_WCHAR wUnicode); #endif diff --git a/xfa/src/fgas/src/font/fx_gdifont.cpp b/xfa/src/fgas/src/font/fx_gdifont.cpp index 437a25c7e4..729af40e06 100644 --- a/xfa/src/fgas/src/font/fx_gdifont.cpp +++ b/xfa/src/fgas/src/font/fx_gdifont.cpp @@ -28,7 +28,7 @@ CFX_GdiFontCache::~CFX_GdiFontCache() } m_GlyphMap.RemoveAll(); } -void CFX_GdiFontCache::SetCachedGlyphOutline(FX_DWORD dwGlyph, const GLYPHMETRICS &gm, FX_LPBYTE pOutline) +void CFX_GdiFontCache::SetCachedGlyphOutline(FX_DWORD dwGlyph, const GLYPHMETRICS &gm, uint8_t* pOutline) { FXSYS_assert(pOutline != NULL); FX_LPGDIGOCACHE pGlyph = (FX_LPGDIGOCACHE)FDE_Alloc(sizeof(FX_GDIGOCACHE)); @@ -44,7 +44,7 @@ FX_LPCGDIGOCACHE CFX_GdiFontCache::GetCachedGlyphOutline(FX_DWORD dwGlyph) const } return pGlyph; } -IFX_Font* IFX_Font::LoadFont(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage, IFX_FontMgr *pFontMgr) +IFX_Font* IFX_Font::LoadFont(const FX_WCHAR* pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage, IFX_FontMgr *pFontMgr) { CFX_GdiFont *pFont = FX_NEW CFX_GdiFont(pFontMgr); if (!pFont->LoadFont(pszFontFamily, dwFontStyles, wCodePage)) { @@ -53,7 +53,7 @@ IFX_Font* IFX_Font::LoadFont(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, FX } return pFont; } -IFX_Font* IFX_Font::LoadFont(FX_LPCBYTE pBuffer, int32_t iLength, IFX_FontMgr *pFontMgr) +IFX_Font* IFX_Font::LoadFont(const uint8_t* pBuffer, int32_t iLength, IFX_FontMgr *pFontMgr) { CFX_GdiFont *pFont = FX_NEW CFX_GdiFont(pFontMgr); if (!pFont->LoadFont(pBuffer, iLength)) { @@ -62,7 +62,7 @@ IFX_Font* IFX_Font::LoadFont(FX_LPCBYTE pBuffer, int32_t iLength, IFX_FontMgr *p } return pFont; } -IFX_Font* IFX_Font::LoadFont(FX_LPCWSTR pszFileName, IFX_FontMgr *pFontMgr) +IFX_Font* IFX_Font::LoadFont(const FX_WCHAR* pszFileName, IFX_FontMgr *pFontMgr) { CFX_GdiFont *pFont = FX_NEW CFX_GdiFont(pFontMgr); if (!pFont->LoadFont(pszFileName)) { @@ -121,7 +121,7 @@ CFX_GdiFont::~CFX_GdiFont() ::DeleteDC(m_hDC); if (m_hRes != NULL) { if (m_wsFontFileName.GetLength() > 0) { - ::RemoveFontResourceW((FX_LPCWSTR)m_wsFontFileName); + ::RemoveFontResourceW((const FX_WCHAR*)m_wsFontFileName); } else { ::RemoveFontMemResourceEx(m_hRes); } @@ -162,7 +162,7 @@ IFX_Font* CFX_GdiFont::Retain() ++ m_iRefCount; return this; } -FX_BOOL CFX_GdiFont::LoadFont(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage) +FX_BOOL CFX_GdiFont::LoadFont(const FX_WCHAR* pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage) { FXSYS_assert(m_hFont == NULL); LOGFONTW lf; @@ -190,7 +190,7 @@ FX_BOOL CFX_GdiFont::LoadFont(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, F } return LoadFont(lf); } -FX_BOOL CFX_GdiFont::LoadFont(FX_LPCBYTE pBuffer, int32_t iLength) +FX_BOOL CFX_GdiFont::LoadFont(const uint8_t* pBuffer, int32_t iLength) { FXSYS_assert(m_hFont == NULL && pBuffer != NULL && iLength > 0); Gdiplus::PrivateFontCollection pfc; @@ -206,7 +206,7 @@ FX_BOOL CFX_GdiFont::LoadFont(FX_LPCBYTE pBuffer, int32_t iLength) return FALSE; } CFX_WideString wsFamily = m_FontFamilies[0]; - m_hFont = ::CreateFontW(-1000, 0, 0, 0, FW_NORMAL, FALSE, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 0, (FX_LPCWSTR)wsFamily); + m_hFont = ::CreateFontW(-1000, 0, 0, 0, FW_NORMAL, FALSE, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 0, (const FX_WCHAR*)wsFamily); if (m_hFont == NULL) { ::RemoveFontMemResourceEx(m_hRes); m_hRes = NULL; @@ -217,7 +217,7 @@ FX_BOOL CFX_GdiFont::LoadFont(FX_LPCBYTE pBuffer, int32_t iLength) ::GetOutlineTextMetricsW(m_hDC, sizeof(m_OutlineTM), &m_OutlineTM); return TRUE; } -FX_BOOL CFX_GdiFont::LoadFont(FX_LPCWSTR pszFileName) +FX_BOOL CFX_GdiFont::LoadFont(const FX_WCHAR* pszFileName) { FXSYS_assert(m_hFont == NULL && pszFileName != NULL); Gdiplus::PrivateFontCollection pfc; @@ -233,7 +233,7 @@ FX_BOOL CFX_GdiFont::LoadFont(FX_LPCWSTR pszFileName) return FALSE; } CFX_WideString wsFamily = m_FontFamilies[0]; - m_hFont = ::CreateFontW(-1000, 0, 0, 0, FW_NORMAL, FALSE, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 0, (FX_LPCWSTR)wsFamily); + m_hFont = ::CreateFontW(-1000, 0, 0, 0, FW_NORMAL, FALSE, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 0, (const FX_WCHAR*)wsFamily); if (m_hFont == NULL) { ::RemoveFontResourceW(pszFileName); m_hRes = NULL; @@ -251,7 +251,7 @@ FX_BOOL CFX_GdiFont::LoadFont(IFX_Stream *pFontStream) if (iLength < 1) { return FALSE; } - FX_LPBYTE pBuf = (FX_LPBYTE)FDE_Alloc(iLength); + uint8_t* pBuf = (uint8_t*)FDE_Alloc(iLength); if (pBuf == NULL) { return FALSE; } @@ -286,7 +286,7 @@ int32_t CFX_GdiFont::GetFontFamilies(Gdiplus::FontCollection &fc) fc.GetFamilies(iCount, pFontFamilies, &iFind); for (int32_t i = 0; i < iCount; i ++) { CFX_WideString wsFamilyName; - FX_LPWSTR pName = wsFamilyName.GetBuffer(LF_FACESIZE); + FX_WCHAR* pName = wsFamilyName.GetBuffer(LF_FACESIZE); pFontFamilies[i].GetFamilyName(pName); wsFamilyName.ReleaseBuffer(); m_FontFamilies.Add(wsFamilyName); @@ -451,7 +451,7 @@ IFX_Font* CFX_GdiFont::GetSubstFont(int32_t iGlyphIndex) const } return (IFX_Font*)m_SubstFonts[iHigher - 1]; } -FX_DWORD CFX_GdiFont::GetGlyphDIBits(int32_t iGlyphIndex, FX_ARGB argb, const MAT2 *pMatrix, GLYPHMETRICS &gm, FX_LPVOID pBuffer, FX_DWORD bufSize) +FX_DWORD CFX_GdiFont::GetGlyphDIBits(int32_t iGlyphIndex, FX_ARGB argb, const MAT2 *pMatrix, GLYPHMETRICS &gm, void* pBuffer, FX_DWORD bufSize) { static const UINT uFormat = GGO_GLYPH_INDEX | GGO_GRAY8_BITMAP; IFX_Font *pFont = GetSubstFont(iGlyphIndex); @@ -461,7 +461,7 @@ FX_DWORD CFX_GdiFont::GetGlyphDIBits(int32_t iGlyphIndex, FX_ARGB argb, const MA if (pFont != (IFX_Font*)this) { return ((CFX_GdiFont*)pFont)->GetGlyphDIBits(iGlyphIndex & 0x00FFFFFF, argb, pMatrix, gm, pBuffer, bufSize); } - FX_LPBYTE pGlyphOutline = NULL; + uint8_t* pGlyphOutline = NULL; FXSYS_assert(pMatrix != NULL); FX_DWORD dwMAT2 = GetMAT2HashCode((const FIXED*)pMatrix); CFX_GdiFontCache *pCache = NULL; @@ -477,7 +477,7 @@ FX_DWORD CFX_GdiFont::GetGlyphDIBits(int32_t iGlyphIndex, FX_ARGB argb, const MA if (dwGlyphSize == 0 || dwGlyphSize == GDI_ERROR) { return 0; } - pGlyphOutline = (FX_LPBYTE)FX_Alloc(dwGlyphSize); + pGlyphOutline = (uint8_t*)FX_Alloc(dwGlyphSize); ::GetGlyphOutlineW(m_hDC, iGlyphIndex, uFormat, &gm, dwGlyphSize, pGlyphOutline, pMatrix); if (pCache == NULL) { pCache = FX_NEW CFX_GdiFontCache; @@ -492,7 +492,7 @@ FX_DWORD CFX_GdiFont::GetGlyphDIBits(int32_t iGlyphIndex, FX_ARGB argb, const MA if (pBuffer == NULL || bufSize < dwDibSize) { return dwDibSize; } - CreateGlyphBitmap(gm.gmBlackBoxX, gm.gmBlackBoxY, pGlyphOutline, (FX_LPDWORD)pBuffer, argb); + CreateGlyphBitmap(gm.gmBlackBoxX, gm.gmBlackBoxY, pGlyphOutline, (FX_DWORD*)pBuffer, argb); return dwDibSize; } FX_DWORD CFX_GdiFont::GetHashCode() const @@ -511,7 +511,7 @@ FX_DWORD CFX_GdiFont::GetMAT2HashCode(const FIXED *pFixed) } return ((dwHash1 & 0x0000FFFF) << 16) | (dwHash2 & 0x0000FFFF); } -void CFX_GdiFont::CreateGlyphBitmap(int32_t iWidth, int32_t iHeight, FX_LPBYTE pOutline, FX_LPDWORD pDIB, FX_ARGB argb) +void CFX_GdiFont::CreateGlyphBitmap(int32_t iWidth, int32_t iHeight, uint8_t* pOutline, FX_DWORD* pDIB, FX_ARGB argb) { int32_t padding = ((iWidth + 3) / 4) * 4 - iWidth; FX_DWORD alpha; diff --git a/xfa/src/fgas/src/font/fx_gdifont.h b/xfa/src/fgas/src/font/fx_gdifont.h index b9143602e6..85af1c9685 100644 --- a/xfa/src/fgas/src/font/fx_gdifont.h +++ b/xfa/src/fgas/src/font/fx_gdifont.h @@ -10,7 +10,7 @@ #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || _FX_OS_ == _FX_WIN64_ typedef struct _FX_GDIGOCACHE { GLYPHMETRICS gm; - FX_LPBYTE pOutline; + uint8_t* pOutline; } FX_GDIGOCACHE, * FX_LPGDIGOCACHE; typedef FX_GDIGOCACHE const * FX_LPCGDIGOCACHE; class CFX_GdiFontCache @@ -18,7 +18,7 @@ class CFX_GdiFontCache public: CFX_GdiFontCache(); ~CFX_GdiFontCache(); - void SetCachedGlyphOutline(FX_DWORD dwGlyph, const GLYPHMETRICS &gm, FX_LPBYTE pOutline); + void SetCachedGlyphOutline(FX_DWORD dwGlyph, const GLYPHMETRICS &gm, uint8_t* pOutline); FX_LPCGDIGOCACHE GetCachedGlyphOutline(FX_DWORD dwGlyph) const; protected: CFX_MapPtrToPtr m_GlyphMap; @@ -30,9 +30,9 @@ public: ~CFX_GdiFont(); virtual void Release(); virtual IFX_Font* Retain(); - FX_BOOL LoadFont(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage); - FX_BOOL LoadFont(FX_LPCBYTE pBuffer, int32_t iLength); - FX_BOOL LoadFont(FX_LPCWSTR pszFileName); + FX_BOOL LoadFont(const FX_WCHAR* pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage); + FX_BOOL LoadFont(const uint8_t* pBuffer, int32_t iLength); + FX_BOOL LoadFont(const FX_WCHAR* pszFileName); FX_BOOL LoadFont(IFX_Stream *pFontStream); FX_BOOL LoadFont(const LOGFONTW &lf); virtual IFX_Font* Derive(FX_DWORD dwFontStyles, FX_WORD wCodePage = 0) @@ -56,7 +56,7 @@ public: virtual FX_BOOL GetBBox(CFX_Rect &bbox); virtual int32_t GetItalicAngle() const; virtual void Reset(); - FX_DWORD GetGlyphDIBits(int32_t iGlyphIndex, FX_ARGB argb, const MAT2 *pMatrix, GLYPHMETRICS &gm, FX_LPVOID pBuffer, FX_DWORD bufSize); + FX_DWORD GetGlyphDIBits(int32_t iGlyphIndex, FX_ARGB argb, const MAT2 *pMatrix, GLYPHMETRICS &gm, void* pBuffer, FX_DWORD bufSize); FX_DWORD GetHashCode() const; protected: IFX_FontMgr *m_pFontMgr; @@ -81,7 +81,7 @@ protected: FX_BOOL GetCharWidth(FX_WCHAR wUnicode, int32_t &iWidth, FX_BOOL bRecursive, FX_BOOL bCharCode = FALSE); int32_t GetGlyphIndex(FX_WCHAR wUnicode, FX_BOOL bRecursive, IFX_Font **ppFont, FX_BOOL bCharCode = FALSE); FX_DWORD GetMAT2HashCode(const FIXED *pFixed); - void CreateGlyphBitmap(int32_t iWidth, int32_t iHeight, FX_LPBYTE pOutline, FX_LPDWORD pDIB, FX_ARGB argb); + void CreateGlyphBitmap(int32_t iWidth, int32_t iHeight, uint8_t* pOutline, FX_DWORD* pDIB, FX_ARGB argb); friend class CFX_GdiFontMgr; }; #endif diff --git a/xfa/src/fgas/src/font/fx_gefont.cpp b/xfa/src/fgas/src/font/fx_gefont.cpp index a67b7b47bb..c9948cfa4f 100644 --- a/xfa/src/fgas/src/font/fx_gefont.cpp +++ b/xfa/src/fgas/src/font/fx_gefont.cpp @@ -8,7 +8,7 @@ #include "fx_gefont.h" #include "fx_fontutils.h" #ifndef _FXPLUS -IFX_Font* IFX_Font::LoadFont(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage, IFX_FontMgr *pFontMgr) +IFX_Font* IFX_Font::LoadFont(const FX_WCHAR* pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage, IFX_FontMgr *pFontMgr) { #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ if (NULL != pFontMgr) { @@ -24,7 +24,7 @@ IFX_Font* IFX_Font::LoadFont(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, FX return pFont; #endif } -IFX_Font* IFX_Font::LoadFont(FX_LPCBYTE pBuffer, int32_t iLength, IFX_FontMgr *pFontMgr) +IFX_Font* IFX_Font::LoadFont(const uint8_t* pBuffer, int32_t iLength, IFX_FontMgr *pFontMgr) { #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ if (NULL != pFontMgr) { @@ -40,7 +40,7 @@ IFX_Font* IFX_Font::LoadFont(FX_LPCBYTE pBuffer, int32_t iLength, IFX_FontMgr *p return pFont; #endif } -IFX_Font* IFX_Font::LoadFont(FX_LPCWSTR pszFileName, IFX_FontMgr *pFontMgr) +IFX_Font* IFX_Font::LoadFont(const FX_WCHAR* pszFileName, IFX_FontMgr *pFontMgr) { #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ if (NULL != pFontMgr) { @@ -181,7 +181,7 @@ IFX_Font* CFX_GEFont::Retain() ++ m_iRefCount; return this; } -FX_BOOL CFX_GEFont::LoadFont(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage) +FX_BOOL CFX_GEFont::LoadFont(const FX_WCHAR* pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage) { if (m_pFont != NULL) { return FALSE; @@ -235,7 +235,7 @@ FX_BOOL CFX_GEFont::LoadFont(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, FX Unlock(); return bRet; } -FX_BOOL CFX_GEFont::LoadFont(FX_LPCBYTE pBuffer, int32_t length) +FX_BOOL CFX_GEFont::LoadFont(const uint8_t* pBuffer, int32_t length) { if (m_pFont != NULL) { return FALSE; @@ -250,7 +250,7 @@ FX_BOOL CFX_GEFont::LoadFont(FX_LPCBYTE pBuffer, int32_t length) Unlock(); return bRet; } -FX_BOOL CFX_GEFont::LoadFont(FX_LPCWSTR pszFileName) +FX_BOOL CFX_GEFont::LoadFont(const FX_WCHAR* pszFileName) { if (m_pFont != NULL) { return FALSE; @@ -446,7 +446,7 @@ FX_BOOL CFX_GEFont::GetCharBBox(FX_WCHAR wUnicode, CFX_Rect &bbox, FX_BOOL bRecu { FXSYS_assert(m_pRectArray != NULL); FXSYS_assert(m_pBBoxMap != NULL); - FX_LPVOID pRect = NULL; + void* pRect = NULL; if (!m_pBBoxMap->Lookup((void*)(uintptr_t)wUnicode, pRect)) { IFX_Font *pFont = NULL; int32_t iGlyph = GetGlyphIndex(wUnicode, TRUE, &pFont, bCharCode); @@ -533,9 +533,9 @@ int32_t CFX_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, FX_BOOL bRecursive, IFX_Fon CFX_WideString wsFamily; GetFamilyName(wsFamily); #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - IFX_Font *pFont = m_pFontMgr->GetDefFontByUnicode(wUnicode, GetFontStyles(), (FX_LPCWSTR)wsFamily); + IFX_Font *pFont = m_pFontMgr->GetDefFontByUnicode(wUnicode, GetFontStyles(), (const FX_WCHAR*)wsFamily); #else - IFX_Font *pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), (FX_LPCWSTR)wsFamily); + IFX_Font *pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), (const FX_WCHAR*)wsFamily); if (NULL == pFont) { pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), NULL); } diff --git a/xfa/src/fgas/src/font/fx_gefont.h b/xfa/src/fgas/src/font/fx_gefont.h index e03fd8844e..7c4aa754db 100644 --- a/xfa/src/fgas/src/font/fx_gefont.h +++ b/xfa/src/fgas/src/font/fx_gefont.h @@ -19,9 +19,9 @@ public: ~CFX_GEFont(); virtual void Release(); virtual IFX_Font* Retain(); - FX_BOOL LoadFont(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage); - FX_BOOL LoadFont(FX_LPCBYTE pBuffer, int32_t length); - FX_BOOL LoadFont(FX_LPCWSTR pszFileName); + FX_BOOL LoadFont(const FX_WCHAR* pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage); + FX_BOOL LoadFont(const uint8_t* pBuffer, int32_t length); + FX_BOOL LoadFont(const FX_WCHAR* pszFileName); FX_BOOL LoadFont(IFX_Stream *pFontStream, FX_BOOL bSaveStream); FX_BOOL LoadFont(CFX_Font *pExtFont, FX_BOOL bTakeOver = FALSE); virtual IFX_Font* Derive(FX_DWORD dwFontStyles, FX_WORD wCodePage = 0); diff --git a/xfa/src/fgas/src/font/fx_stdfontmgr.cpp b/xfa/src/fgas/src/font/fx_stdfontmgr.cpp index 2f4ef2038f..3569f78b11 100644 --- a/xfa/src/fgas/src/font/fx_stdfontmgr.cpp +++ b/xfa/src/fgas/src/font/fx_stdfontmgr.cpp @@ -8,11 +8,11 @@ #include "fx_stdfontmgr.h" #include "fx_fontutils.h" #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -IFX_FontMgr* IFX_FontMgr::Create(FX_LPEnumAllFonts pEnumerator, FX_LPMatchFont pMatcher , FX_LPVOID pUserData ) +IFX_FontMgr* IFX_FontMgr::Create(FX_LPEnumAllFonts pEnumerator, FX_LPMatchFont pMatcher , void* pUserData ) { return FX_NEW CFX_StdFontMgrImp(pEnumerator, pMatcher, pUserData); } -CFX_StdFontMgrImp::CFX_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator, FX_LPMatchFont pMatcher, FX_LPVOID pUserData) +CFX_StdFontMgrImp::CFX_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator, FX_LPMatchFont pMatcher, void* pUserData) : m_pMatcher(pMatcher) , m_pEnumerator(pEnumerator) , m_FontFaces() @@ -52,7 +52,7 @@ CFX_StdFontMgrImp::~CFX_StdFontMgrImp() } m_Fonts.RemoveAll(); } -IFX_Font* CFX_StdFontMgrImp::GetDefFontByCodePage(FX_WORD wCodePage, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily) +IFX_Font* CFX_StdFontMgrImp::GetDefFontByCodePage(FX_WORD wCodePage, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily) { FX_DWORD dwHash = FGAS_GetFontHashCode(wCodePage, dwFontStyles); IFX_Font *pFont = NULL; @@ -76,12 +76,12 @@ IFX_Font* CFX_StdFontMgrImp::GetDefFontByCodePage(FX_WORD wCodePage, FX_DWORD dw } return NULL; } -IFX_Font* CFX_StdFontMgrImp::GetDefFontByCharset(uint8_t nCharset, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily) +IFX_Font* CFX_StdFontMgrImp::GetDefFontByCharset(uint8_t nCharset, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily) { return GetDefFontByCodePage(FX_GetCodePageFromCharset(nCharset), dwFontStyles, pszFontFamily); } #define _FX_USEGASFONTMGR_ -IFX_Font* CFX_StdFontMgrImp::GetDefFontByUnicode(FX_WCHAR wUnicode, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily) +IFX_Font* CFX_StdFontMgrImp::GetDefFontByUnicode(FX_WCHAR wUnicode, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily) { FGAS_LPCFONTUSB pRet = FGAS_GetUnicodeBitField(wUnicode); if (pRet->wBitField == 999) { @@ -102,7 +102,7 @@ IFX_Font* CFX_StdFontMgrImp::GetDefFontByUnicode(FX_WCHAR wUnicode, FX_DWORD dwF } FXSYS_assert(pFD); FX_WORD wCodePage = FX_GetCodePageFromCharset(pFD->uCharSet); - FX_LPCWSTR pFontFace = pFD->wsFontFace; + const FX_WCHAR* pFontFace = pFD->wsFontFace; pFont = IFX_Font::LoadFont(pFontFace, dwFontStyles, wCodePage, this); #else CFX_FontMapper* pBuiltinMapper = CFX_GEModule::Get()->GetFontMgr()->m_pBuiltinMapper; @@ -125,7 +125,7 @@ IFX_Font* CFX_StdFontMgrImp::GetDefFontByUnicode(FX_WCHAR wUnicode, FX_DWORD dwF pFont = IFX_Font::LoadFont(pFXFont, this); FX_WORD wCodePage = pRet->wCodePage; CFX_WideString wsPsName = pFXFont->GetPsName(); - FX_LPCWSTR pFontFace = wsPsName; + const FX_WCHAR* pFontFace = wsPsName; #endif if (pFont != NULL) { m_Fonts.Add(pFont); @@ -138,11 +138,11 @@ IFX_Font* CFX_StdFontMgrImp::GetDefFontByUnicode(FX_WCHAR wUnicode, FX_DWORD dwF } return NULL; } -IFX_Font* CFX_StdFontMgrImp::GetDefFontByLanguage(FX_WORD wLanguage, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily) +IFX_Font* CFX_StdFontMgrImp::GetDefFontByLanguage(FX_WORD wLanguage, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily) { return GetDefFontByCodePage(FX_GetDefCodePageByLanguage(wLanguage), dwFontStyles, pszFontFamily); } -IFX_Font* CFX_StdFontMgrImp::LoadFont(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage) +IFX_Font* CFX_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage) { FX_DWORD dwHash = FGAS_GetFontFamilyHash(pszFontFamily, dwFontStyles, wCodePage); IFX_Font *pFont = NULL; @@ -168,7 +168,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontS } return NULL; } -IFX_Font* CFX_StdFontMgrImp::LoadFont(FX_LPCBYTE pBuffer, int32_t iLength) +IFX_Font* CFX_StdFontMgrImp::LoadFont(const uint8_t* pBuffer, int32_t iLength) { FXSYS_assert(pBuffer != NULL && iLength > 0); IFX_Font *pFont = NULL; @@ -185,7 +185,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(FX_LPCBYTE pBuffer, int32_t iLength) } return NULL; } -IFX_Font* CFX_StdFontMgrImp::LoadFont(FX_LPCWSTR pszFileName) +IFX_Font* CFX_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFileName) { FXSYS_assert(pszFileName != NULL); FX_DWORD dwHash = FX_HashCode_String_GetW(pszFileName, -1); @@ -203,7 +203,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(FX_LPCWSTR pszFileName) } return NULL; } -IFX_Font* CFX_StdFontMgrImp::LoadFont(IFX_Stream *pFontStream, FX_LPCWSTR pszFontAlias , FX_DWORD dwFontStyles , FX_WORD wCodePage , FX_BOOL bSaveStream ) +IFX_Font* CFX_StdFontMgrImp::LoadFont(IFX_Stream *pFontStream, const FX_WCHAR* pszFontAlias , FX_DWORD dwFontStyles , FX_WORD wCodePage , FX_BOOL bSaveStream ) { FXSYS_assert(pFontStream != NULL && pFontStream->GetLength() > 0); IFX_Font *pFont = NULL; @@ -235,7 +235,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(IFX_Font *pSrcFont, FX_DWORD dwFontStyles, return pSrcFont->Retain(); } void* buffer[3] = {pSrcFont, (void*)(uintptr_t)dwFontStyles, (void*)(uintptr_t)wCodePage}; - FX_DWORD dwHash = FX_HashCode_String_GetA((FX_LPCSTR)buffer, 3 * sizeof(void*)); + FX_DWORD dwHash = FX_HashCode_String_GetA((const FX_CHAR*)buffer, 3 * sizeof(void*)); IFX_Font *pFont = NULL; if (m_DeriveFonts.GetCount() > 0) { m_DeriveFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont); @@ -268,8 +268,8 @@ void CFX_StdFontMgrImp::ClearFontCache() void CFX_StdFontMgrImp::RemoveFont(CFX_MapPtrToPtr &fontMap, IFX_Font *pFont) { FX_POSITION pos = fontMap.GetStartPosition(); - FX_LPVOID pKey; - FX_LPVOID pFind; + void* pKey; + void* pFind; while (pos != NULL) { pFind = NULL; fontMap.GetNextAssoc(pos, pKey, pFind); @@ -294,7 +294,7 @@ void CFX_StdFontMgrImp::RemoveFont(IFX_Font *pFont) m_Fonts.RemoveAt(iFind, 1); } } -FX_LPCFONTDESCRIPTOR CFX_StdFontMgrImp::FindFont(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, FX_DWORD dwMatchFlags, FX_WORD wCodePage, FX_DWORD dwUSB , FX_WCHAR wUnicode ) +FX_LPCFONTDESCRIPTOR CFX_StdFontMgrImp::FindFont(const FX_WCHAR* pszFontFamily, FX_DWORD dwFontStyles, FX_DWORD dwMatchFlags, FX_WORD wCodePage, FX_DWORD dwUSB , FX_WCHAR wUnicode ) { if (m_pMatcher == NULL) { return NULL; @@ -330,7 +330,7 @@ FX_LPCFONTDESCRIPTOR CFX_StdFontMgrImp::FindFont(FX_LPCWSTR pszFontFamily, FX_DW } return NULL; } -FX_LPCFONTDESCRIPTOR FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams, const CFX_FontDescriptors &fonts, FX_LPVOID pUserData) +FX_LPCFONTDESCRIPTOR FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams, const CFX_FontDescriptors &fonts, void* pUserData) { FX_LPCFONTDESCRIPTOR pBestFont = NULL; int32_t iBestSimilar = 0; @@ -440,21 +440,21 @@ static int32_t CALLBACK FX_GdiFontEnumProc(ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICE FXSYS_memset(pFont, 0, sizeof(FX_FONTDESCRIPTOR)); pFont->uCharSet = lf.lfCharSet; pFont->dwFontStyles = FX_GetGdiFontStyles(lf); - FXSYS_wcsncpy(pFont->wsFontFace, (FX_LPCWSTR)lf.lfFaceName, 31); + FXSYS_wcsncpy(pFont->wsFontFace, (const FX_WCHAR*)lf.lfFaceName, 31); pFont->wsFontFace[31] = 0; FX_memcpy(&pFont->FontSignature, &lpntme->ntmFontSig, sizeof(lpntme->ntmFontSig)); ((CFX_FontDescriptors*)lParam)->Add(*pFont); FX_Free(pFont); return 1; } -static void FX_EnumGdiFonts(CFX_FontDescriptors &fonts, FX_LPVOID pUserData, FX_LPCWSTR pwsFaceName, FX_WCHAR wUnicode) +static void FX_EnumGdiFonts(CFX_FontDescriptors &fonts, void* pUserData, const FX_WCHAR* pwsFaceName, FX_WCHAR wUnicode) { HDC hDC = ::GetDC(NULL); LOGFONTW lfFind; FX_memset(&lfFind, 0, sizeof(lfFind)); lfFind.lfCharSet = DEFAULT_CHARSET; if (pwsFaceName) { - FXSYS_wcsncpy((FX_LPWSTR)lfFind.lfFaceName, pwsFaceName, 31); + FXSYS_wcsncpy((FX_WCHAR*)lfFind.lfFaceName, pwsFaceName, 31); lfFind.lfFaceName[31] = 0; } EnumFontFamiliesExW(hDC, (LPLOGFONTW)&lfFind, (FONTENUMPROCW)FX_GdiFontEnumProc, (LPARAM)&fonts, 0); @@ -465,7 +465,7 @@ FX_LPEnumAllFonts FX_GetDefFontEnumerator() return FX_EnumGdiFonts; } #else -FX_LPCSTR g_FontFolders[] = { +const FX_CHAR* g_FontFolders[] = { #if _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ "/usr/share/fonts", "/usr/share/X11/fonts/Type1", @@ -481,14 +481,14 @@ FX_LPCSTR g_FontFolders[] = { }; CFX_FontSourceEnum_File::CFX_FontSourceEnum_File() { - for (int32_t i = 0; i < sizeof(g_FontFolders) / sizeof(FX_LPCSTR); i++) { + for (int32_t i = 0; i < sizeof(g_FontFolders) / sizeof(const FX_CHAR*); i++) { m_FolderPaths.Add(g_FontFolders[i]); } } CFX_ByteString CFX_FontSourceEnum_File::GetNextFile() { Restart: - FX_LPVOID pCurHandle = m_FolderQueue.GetSize() == 0 ? NULL : m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->pFileHandle; + void* pCurHandle = m_FolderQueue.GetSize() == 0 ? NULL : m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->pFileHandle; if (NULL == pCurHandle) { if (m_FolderPaths.GetSize() < 1) { return ""; @@ -536,7 +536,7 @@ Restart: } return bsName; } -FX_POSITION CFX_FontSourceEnum_File::GetStartPosition( FX_LPVOID pUserData ) +FX_POSITION CFX_FontSourceEnum_File::GetStartPosition( void* pUserData ) { m_wsNext = GetNextFile().UTF8Decode(); if (0 == m_wsNext.GetLength()) { @@ -544,7 +544,7 @@ FX_POSITION CFX_FontSourceEnum_File::GetStartPosition( FX_LPVOID pUserData ) } return (FX_POSITION) - 1; } -IFX_FileAccess* CFX_FontSourceEnum_File::GetNext( FX_POSITION& pos, FX_LPVOID pUserData ) +IFX_FileAccess* CFX_FontSourceEnum_File::GetNext( FX_POSITION& pos, void* pUserData ) { IFX_FileAccess* pAccess = FX_CreateDefaultFileAccess(m_wsNext); m_wsNext = GetNextFile().UTF8Decode(); @@ -555,7 +555,7 @@ IFX_FontSourceEnum* FX_CreateDefaultFontSourceEnum() { return (IFX_FontSourceEnum*)FX_NEW CFX_FontSourceEnum_File; } -IFX_FontMgr* IFX_FontMgr::Create(IFX_FontSourceEnum* pFontEnum, IFX_FontMgrDelegate* pDelegate, FX_LPVOID pUserData) +IFX_FontMgr* IFX_FontMgr::Create(IFX_FontSourceEnum* pFontEnum, IFX_FontMgrDelegate* pDelegate, void* pUserData) { if (NULL == pFontEnum) { return NULL; @@ -570,7 +570,7 @@ IFX_FontMgr* IFX_FontMgr::Create(IFX_FontSourceEnum* pFontEnum, IFX_FontMgrDeleg delete pFontMgr; return NULL; } -CFX_FontMgrImp::CFX_FontMgrImp( IFX_FontSourceEnum* pFontEnum, IFX_FontMgrDelegate* pDelegate , FX_LPVOID pUserData ) +CFX_FontMgrImp::CFX_FontMgrImp( IFX_FontSourceEnum* pFontEnum, IFX_FontMgrDelegate* pDelegate , void* pUserData ) : m_pFontSource(pFontEnum) , m_pDelegate(pDelegate) , m_pUserData(pUserData) @@ -673,23 +673,23 @@ void CFX_FontMgrImp::Release() } delete this; } -IFX_Font* CFX_FontMgrImp::GetDefFontByCodePage( FX_WORD wCodePage, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily ) +IFX_Font* CFX_FontMgrImp::GetDefFontByCodePage( FX_WORD wCodePage, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily ) { return NULL == m_pDelegate ? NULL : m_pDelegate->GetDefFontByCodePage(this, wCodePage, dwFontStyles, pszFontFamily); } -IFX_Font* CFX_FontMgrImp::GetDefFontByCharset( uint8_t nCharset, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily ) +IFX_Font* CFX_FontMgrImp::GetDefFontByCharset( uint8_t nCharset, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily ) { return NULL == m_pDelegate ? NULL : m_pDelegate->GetDefFontByCharset(this, nCharset, dwFontStyles, pszFontFamily); } -IFX_Font* CFX_FontMgrImp::GetDefFontByUnicode( FX_WCHAR wUnicode, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily ) +IFX_Font* CFX_FontMgrImp::GetDefFontByUnicode( FX_WCHAR wUnicode, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily ) { return NULL == m_pDelegate ? NULL : m_pDelegate->GetDefFontByUnicode(this, wUnicode, dwFontStyles, pszFontFamily); } -IFX_Font* CFX_FontMgrImp::GetDefFontByLanguage( FX_WORD wLanguage, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily ) +IFX_Font* CFX_FontMgrImp::GetDefFontByLanguage( FX_WORD wLanguage, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily ) { return NULL == m_pDelegate ? NULL : m_pDelegate->GetDefFontByLanguage(this, wLanguage, dwFontStyles, pszFontFamily); } -IFX_Font* CFX_FontMgrImp::GetFontByCodePage( FX_WORD wCodePage, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily ) +IFX_Font* CFX_FontMgrImp::GetFontByCodePage( FX_WORD wCodePage, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily ) { CFX_ByteString bsHash; bsHash.Format("%d, %d", wCodePage, dwFontStyles); @@ -729,11 +729,11 @@ IFX_Font* CFX_FontMgrImp::GetFontByCodePage( FX_WORD wCodePage, FX_DWORD dwFontS pFonts->Add(pFont); return pFont; } -IFX_Font* CFX_FontMgrImp::GetFontByCharset( uint8_t nCharset, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily ) +IFX_Font* CFX_FontMgrImp::GetFontByCharset( uint8_t nCharset, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily ) { return GetFontByCodePage(FX_GetCodePageFromCharset(nCharset), dwFontStyles, pszFontFamily); } -IFX_Font* CFX_FontMgrImp::GetFontByUnicode( FX_WCHAR wUnicode, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily ) +IFX_Font* CFX_FontMgrImp::GetFontByUnicode( FX_WCHAR wUnicode, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily ) { IFX_Font* pFont = NULL; if (m_FailedUnicodes2NULL.Lookup(wUnicode, pFont)) { @@ -842,14 +842,14 @@ FX_BOOL CFX_FontMgrImp::VerifyUnicode( IFX_Font* pFont, FX_WCHAR wcUnicode ) } return TRUE; } -IFX_Font* CFX_FontMgrImp::GetFontByLanguage( FX_WORD wLanguage, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily ) +IFX_Font* CFX_FontMgrImp::GetFontByLanguage( FX_WORD wLanguage, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily ) { return GetFontByCodePage(FX_GetDefCodePageByLanguage(wLanguage), dwFontStyles, pszFontFamily); } -IFX_Font* CFX_FontMgrImp::LoadFont( FX_LPCBYTE pBuffer, int32_t iLength, int32_t iFaceIndex, int32_t* pFaceCount ) +IFX_Font* CFX_FontMgrImp::LoadFont( const uint8_t* pBuffer, int32_t iLength, int32_t iFaceIndex, int32_t* pFaceCount ) { - FX_LPVOID Hash[2] = {(FX_LPVOID)(uintptr_t)pBuffer, (FX_LPVOID)(uintptr_t)iLength}; - FX_DWORD dwHash = FX_HashCode_String_GetA((FX_LPCSTR)Hash, 2 * sizeof (FX_LPVOID)); + void* Hash[2] = {(void*)(uintptr_t)pBuffer, (void*)(uintptr_t)iLength}; + FX_DWORD dwHash = FX_HashCode_String_GetA((const FX_CHAR*)Hash, 2 * sizeof (void*)); IFX_FileAccess* pFontAccess = NULL; if (!m_Hash2FileAccess.Lookup(dwHash, pFontAccess)) { } @@ -859,11 +859,11 @@ IFX_Font* CFX_FontMgrImp::LoadFont( FX_LPCBYTE pBuffer, int32_t iLength, int32_t return NULL; } } -IFX_Font* CFX_FontMgrImp::LoadFont( FX_LPCWSTR pszFileName, int32_t iFaceIndex, int32_t* pFaceCount ) +IFX_Font* CFX_FontMgrImp::LoadFont( const FX_WCHAR* pszFileName, int32_t iFaceIndex, int32_t* pFaceCount ) { CFX_ByteString bsHash; bsHash += CFX_WideString(pszFileName).UTF8Encode(); - FX_DWORD dwHash = FX_HashCode_String_GetA((FX_LPCSTR)bsHash, bsHash.GetLength()); + FX_DWORD dwHash = FX_HashCode_String_GetA((const FX_CHAR*)bsHash, bsHash.GetLength()); IFX_FileAccess* pFontAccess = NULL; if (!m_Hash2FileAccess.Lookup(dwHash, pFontAccess)) { pFontAccess = FX_CreateDefaultFileAccess(pszFileName); @@ -877,8 +877,8 @@ IFX_Font* CFX_FontMgrImp::LoadFont( FX_LPCWSTR pszFileName, int32_t iFaceIndex, } IFX_Font* CFX_FontMgrImp::LoadFont( IFX_Stream* pFontStream, int32_t iFaceIndex, int32_t* pFaceCount, FX_BOOL bSaveStream ) { - FX_LPVOID Hash[1] = {(FX_LPVOID)(uintptr_t)pFontStream}; - FX_DWORD dwHash = FX_HashCode_String_GetA((FX_LPCSTR)Hash, 1 * sizeof (FX_LPVOID)); + void* Hash[1] = {(void*)(uintptr_t)pFontStream}; + FX_DWORD dwHash = FX_HashCode_String_GetA((const FX_CHAR*)Hash, 1 * sizeof (void*)); IFX_FileAccess* pFontAccess = NULL; if (!m_Hash2FileAccess.Lookup(dwHash, pFontAccess)) { } @@ -1263,7 +1263,7 @@ void CFX_FontMgrImp::ReportFace( FXFT_Face pFace, CFX_FontDescriptors& Fonts, IF GetUSBCSB(pFace, pFont->m_dwUsb, pFont->m_dwCsb); unsigned long nLength = 0; FT_ULong dwTag; - FX_LPBYTE pTable = NULL; + uint8_t* pTable = NULL; FT_ENC_TAG(dwTag, 'n', 'a', 'm', 'e'); unsigned int error = FXFT_Load_Sfnt_Table(pFace, dwTag, 0, NULL, &nLength); if (0 == error && 0 != nLength) { @@ -1314,17 +1314,17 @@ FX_DWORD CFX_FontMgrImp::GetFlags(FXFT_Face pFace) #define GetUInt8(p) ((uint8_t)((p)[0])) #define GetUInt16(p) ((uint16_t)((p)[0] << 8 | (p)[1])) #define GetUInt32(p) ((uint32_t)((p)[0] << 24 | (p)[1] << 16 | (p)[2] << 8 | (p)[3])) -void CFX_FontMgrImp::GetNames(FX_LPCBYTE name_table, CFX_WideStringArray& Names) +void CFX_FontMgrImp::GetNames(const uint8_t* name_table, CFX_WideStringArray& Names) { if (NULL == name_table) { return; } - FX_LPBYTE lpTable = (FX_LPBYTE)name_table; + uint8_t* lpTable = (uint8_t*)name_table; CFX_WideString wsFamily; - FX_LPBYTE sp = lpTable + 2; - FX_LPBYTE lpNameRecord = lpTable + 6; + uint8_t* sp = lpTable + 2; + uint8_t* lpNameRecord = lpTable + 6; uint16_t nNameCount = GetUInt16(sp); - FX_LPBYTE lpStr = lpTable + GetUInt16(sp + 2); + uint8_t* lpStr = lpTable + GetUInt16(sp + 2); for (uint16_t j = 0; j < nNameCount; j++) { uint16_t nNameID = GetUInt16(lpNameRecord + j * 12 + 6); if (nNameID != 1) { @@ -1482,7 +1482,7 @@ void CFX_FontMgrImp::NormalizeFontName( CFX_WideString& FontName ) } int32_t CFX_FontMgrImp::IsPartName( const CFX_WideString& Name1, const CFX_WideString& Name2 ) { - if (Name1.Find((FX_LPCWSTR)Name2) != -1) { + if (Name1.Find((const FX_WCHAR*)Name2) != -1) { return 1; } return 0; diff --git a/xfa/src/fgas/src/font/fx_stdfontmgr.h b/xfa/src/fgas/src/font/fx_stdfontmgr.h index 37b0b63da0..3377995b70 100644 --- a/xfa/src/fgas/src/font/fx_stdfontmgr.h +++ b/xfa/src/fgas/src/font/fx_stdfontmgr.h @@ -8,24 +8,24 @@ #define _FX_FONTMGR_IMP #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ int32_t FX_GetSimilarValue(FX_LPCFONTDESCRIPTOR pFont, FX_DWORD dwFontStyles); -FX_LPCFONTDESCRIPTOR FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams, const CFX_FontDescriptors &fonts, FX_LPVOID pUserData); +FX_LPCFONTDESCRIPTOR FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams, const CFX_FontDescriptors &fonts, void* pUserData); class CFX_StdFontMgrImp : public IFX_FontMgr { public: - CFX_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator, FX_LPMatchFont pMatcher, FX_LPVOID pUserData); + CFX_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator, FX_LPMatchFont pMatcher, void* pUserData); ~CFX_StdFontMgrImp(); virtual void Release() { delete this; } - virtual IFX_Font* GetDefFontByCodePage(FX_WORD wCodePage, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL); - virtual IFX_Font* GetDefFontByCharset(uint8_t nCharset, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL); - virtual IFX_Font* GetDefFontByUnicode(FX_WCHAR wUnicode, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL); - virtual IFX_Font* GetDefFontByLanguage(FX_WORD wLanguage, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL); - virtual IFX_Font* LoadFont(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage = 0xFFFF); - virtual IFX_Font* LoadFont(FX_LPCBYTE pBuffer, int32_t iLength); - virtual IFX_Font* LoadFont(FX_LPCWSTR pszFileName); - virtual IFX_Font* LoadFont(IFX_Stream *pFontStream, FX_LPCWSTR pszFontAlias = NULL, FX_DWORD dwFontStyles = 0, FX_WORD wCodePage = 0, FX_BOOL bSaveStream = FALSE); + virtual IFX_Font* GetDefFontByCodePage(FX_WORD wCodePage, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL); + virtual IFX_Font* GetDefFontByCharset(uint8_t nCharset, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL); + virtual IFX_Font* GetDefFontByUnicode(FX_WCHAR wUnicode, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL); + virtual IFX_Font* GetDefFontByLanguage(FX_WORD wLanguage, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL); + virtual IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage = 0xFFFF); + virtual IFX_Font* LoadFont(const uint8_t* pBuffer, int32_t iLength); + virtual IFX_Font* LoadFont(const FX_WCHAR* pszFileName); + virtual IFX_Font* LoadFont(IFX_Stream *pFontStream, const FX_WCHAR* pszFontAlias = NULL, FX_DWORD dwFontStyles = 0, FX_WORD wCodePage = 0, FX_BOOL bSaveStream = FALSE); virtual IFX_Font* LoadFont(IFX_Font *pSrcFont, FX_DWORD dwFontStyles, FX_WORD wCodePage = 0xFFFF); virtual void ClearFontCache(); virtual void RemoveFont(IFX_Font *pFont); @@ -41,9 +41,9 @@ protected: CFX_MapPtrToPtr m_FileFonts; CFX_MapPtrToPtr m_StreamFonts; CFX_MapPtrToPtr m_DeriveFonts; - FX_LPVOID m_pUserData; + void* m_pUserData; void RemoveFont(CFX_MapPtrToPtr &fontMap, IFX_Font *pFont); - FX_LPCFONTDESCRIPTOR FindFont(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, FX_DWORD dwMatchFlags, FX_WORD wCodePage, FX_DWORD dwUSB = 999, FX_WCHAR wUnicode = 0); + FX_LPCFONTDESCRIPTOR FindFont(const FX_WCHAR* pszFontFamily, FX_DWORD dwFontStyles, FX_DWORD dwMatchFlags, FX_WORD wCodePage, FX_DWORD dwUSB = 999, FX_WCHAR wUnicode = 0); IFX_Font* GetFont(FX_LPCFONTDESCRIPTOR pFD, FX_DWORD dwFontStyles); }; FX_DWORD FX_GetGdiFontStyles(const LOGFONTW &lf); @@ -112,8 +112,8 @@ public: { delete this; }; - virtual FX_POSITION GetStartPosition(FX_LPVOID pUserData = NULL); - virtual IFX_FileAccess* GetNext(FX_POSITION& pos, FX_LPVOID pUserData = NULL); + virtual FX_POSITION GetStartPosition(void* pUserData = NULL); + virtual IFX_FileAccess* GetNext(FX_POSITION& pos, void* pUserData = NULL); private: CFX_ByteString GetNextFile(); CFX_WideString m_wsNext; @@ -130,25 +130,25 @@ typedef CFX_MapPtrTemplate CFX_FonStreamtMap; class CFX_FontMgrImp : public IFX_FontMgr { public: - CFX_FontMgrImp(IFX_FontSourceEnum* pFontEnum, IFX_FontMgrDelegate* pDelegate = NULL, FX_LPVOID pUserData = NULL); + CFX_FontMgrImp(IFX_FontSourceEnum* pFontEnum, IFX_FontMgrDelegate* pDelegate = NULL, void* pUserData = NULL); virtual void Release(); - virtual IFX_Font* GetDefFontByCodePage(FX_WORD wCodePage, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL); - virtual IFX_Font* GetDefFontByCharset(uint8_t nCharset, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL); - virtual IFX_Font* GetDefFontByUnicode(FX_WCHAR wUnicode, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL); - virtual IFX_Font* GetDefFontByLanguage(FX_WORD wLanguage, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL); - virtual IFX_Font* GetFontByCodePage(FX_WORD wCodePage, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL); - virtual IFX_Font* GetFontByCharset(uint8_t nCharset, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL); - virtual IFX_Font* GetFontByUnicode(FX_WCHAR wUnicode, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL); - virtual IFX_Font* GetFontByLanguage(FX_WORD wLanguage, FX_DWORD dwFontStyles, FX_LPCWSTR pszFontFamily = NULL); - virtual IFX_Font* LoadFont(FX_LPCBYTE pBuffer, int32_t iLength, int32_t iFaceIndex, int32_t* pFaceCount); - virtual IFX_Font* LoadFont(FX_LPCWSTR pszFileName, int32_t iFaceIndex, int32_t* pFaceCount); + virtual IFX_Font* GetDefFontByCodePage(FX_WORD wCodePage, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL); + virtual IFX_Font* GetDefFontByCharset(uint8_t nCharset, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL); + virtual IFX_Font* GetDefFontByUnicode(FX_WCHAR wUnicode, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL); + virtual IFX_Font* GetDefFontByLanguage(FX_WORD wLanguage, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL); + virtual IFX_Font* GetFontByCodePage(FX_WORD wCodePage, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL); + virtual IFX_Font* GetFontByCharset(uint8_t nCharset, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL); + virtual IFX_Font* GetFontByUnicode(FX_WCHAR wUnicode, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL); + virtual IFX_Font* GetFontByLanguage(FX_WORD wLanguage, FX_DWORD dwFontStyles, const FX_WCHAR* pszFontFamily = NULL); + virtual IFX_Font* LoadFont(const uint8_t* pBuffer, int32_t iLength, int32_t iFaceIndex, int32_t* pFaceCount); + virtual IFX_Font* LoadFont(const FX_WCHAR* pszFileName, int32_t iFaceIndex, int32_t* pFaceCount); virtual IFX_Font* LoadFont(IFX_Stream* pFontStream, int32_t iFaceIndex, int32_t* pFaceCount, FX_BOOL bSaveStream = FALSE); virtual void ClearFontCache(); virtual void RemoveFont(IFX_Font* pFont); FX_BOOL EnumFonts(); protected: void ReportFace(FXFT_Face pFace, CFX_FontDescriptors& Fonts, IFX_FileAccess* pFontAccess); - void GetNames(FX_LPCBYTE name_table, CFX_WideStringArray& Names); + void GetNames(const uint8_t* name_table, CFX_WideStringArray& Names); void GetCharsets(FXFT_Face pFace, CFX_WordArray& Charsets); void GetUSBCSB(FXFT_Face pFace, FX_DWORD* USB, FX_DWORD* CSB); FX_DWORD GetFlags(FXFT_Face pFace); @@ -169,7 +169,7 @@ protected: CFX_UnicodeFontMap m_FailedUnicodes2NULL; IFX_FontSourceEnum* m_pFontSource; IFX_FontMgrDelegate* m_pDelegate; - FX_LPVOID m_pUserData; + void* m_pUserData; }; #endif #endif diff --git a/xfa/src/fgas/src/layout/fx_linebreak.cpp b/xfa/src/fgas/src/layout/fx_linebreak.cpp index dde8b8cc61..e4a0987fd7 100644 --- a/xfa/src/fgas/src/layout/fx_linebreak.cpp +++ b/xfa/src/fgas/src/layout/fx_linebreak.cpp @@ -72,7 +72,7 @@ extern const FX_LINEBREAKTYPE gs_FX_LineBreak_PairTable[64][32] = { {FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN}, {FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN}, }; -void FX_GetLineBreakPositions(FX_LPCWSTR pwsText, FX_LINEBREAKTYPE *pBrkType, int32_t iLength) +void FX_GetLineBreakPositions(const FX_WCHAR* pwsText, FX_LINEBREAKTYPE *pBrkType, int32_t iLength) { if (iLength < 2) { return; @@ -94,7 +94,7 @@ void FX_GetLineBreakPositions(FX_LPCWSTR pwsText, FX_LINEBREAKTYPE *pBrkType, in } pBrkType[iLength] = FX_LBT_INDIRECT_BRK; } -void FX_GetLineBreakPositions(FX_LPCWSTR pwsText, int32_t iLength, CFX_Int32MassArray &bp) +void FX_GetLineBreakPositions(const FX_WCHAR* pwsText, int32_t iLength, CFX_Int32MassArray &bp) { if (iLength < 2) { return; diff --git a/xfa/src/fgas/src/layout/fx_rtfbreak.cpp b/xfa/src/fgas/src/layout/fx_rtfbreak.cpp index 95c9118f90..44b0dc8fdd 100644 --- a/xfa/src/fgas/src/layout/fx_rtfbreak.cpp +++ b/xfa/src/fgas/src/layout/fx_rtfbreak.cpp @@ -1190,7 +1190,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(FX_LPCRTFTEXTOBJ pText, FXTEXT_CHARPOS *pCha return 0; } FXSYS_assert(pText->pStr != NULL && pText->pWidths != NULL && pText->pFont != NULL && pText->pRect != NULL); - FX_LPCWSTR pStr = pText->pStr; + const FX_WCHAR* pStr = pText->pStr; int32_t *pWidths = pText->pWidths; int32_t iLength = pText->iLength - 1; IFX_Font *pFont = pText->pFont; @@ -1423,7 +1423,7 @@ int32_t CFX_RTFBreak::GetCharRects(FX_LPCRTFTEXTOBJ pText, CFX_RectFArray &rtArr return 0; } FXSYS_assert(pText->pStr != NULL && pText->pWidths != NULL && pText->pFont != NULL && pText->pRect != NULL); - FX_LPCWSTR pStr = pText->pStr; + const FX_WCHAR* pStr = pText->pStr; int32_t *pWidths = pText->pWidths; int32_t iLength = pText->iLength; CFX_RectF rect(*pText->pRect); diff --git a/xfa/src/fgas/src/layout/fx_textbreak.cpp b/xfa/src/fgas/src/layout/fx_textbreak.cpp index 80d56c7191..7a740f5212 100644 --- a/xfa/src/fgas/src/layout/fx_textbreak.cpp +++ b/xfa/src/fgas/src/layout/fx_textbreak.cpp @@ -216,7 +216,7 @@ void CFX_TxtBreak::SetCombWidth(FX_FLOAT fCombWidth) { m_iCombWidth = FXSYS_round(fCombWidth * 20000.0f); } -void CFX_TxtBreak::SetUserData(FX_LPVOID pUserData) +void CFX_TxtBreak::SetUserData(void* pUserData) { if (m_pUserData == pUserData) { return; @@ -1183,8 +1183,8 @@ int32_t CFX_TxtBreak::GetDisplayPos(FX_LPCTXTRUN pTxtRun, FXTEXT_CHARPOS *pCharP return 0; } IFX_TxtAccess *pAccess = pTxtRun->pAccess; - FX_LPVOID pIdentity = pTxtRun->pIdentity; - FX_LPCWSTR pStr = pTxtRun->pStr; + void* pIdentity = pTxtRun->pIdentity; + const FX_WCHAR* pStr = pTxtRun->pStr; int32_t *pWidths = pTxtRun->pWidths; int32_t iLength = pTxtRun->iLength - 1; IFX_Font *pFont = pTxtRun->pFont; @@ -1550,8 +1550,8 @@ int32_t CFX_TxtBreak::GetCharRects(FX_LPCTXTRUN pTxtRun, CFX_RectFArray &rtArray return 0; } IFX_TxtAccess *pAccess = pTxtRun->pAccess; - FX_LPVOID pIdentity = pTxtRun->pIdentity; - FX_LPCWSTR pStr = pTxtRun->pStr; + void* pIdentity = pTxtRun->pIdentity; + const FX_WCHAR* pStr = pTxtRun->pStr; int32_t *pWidths = pTxtRun->pWidths; int32_t iLength = pTxtRun->iLength; CFX_RectF rect(*pTxtRun->pRect); diff --git a/xfa/src/fgas/src/layout/fx_textbreak.h b/xfa/src/fgas/src/layout/fx_textbreak.h index c38fc0b1ba..13e79dae60 100644 --- a/xfa/src/fgas/src/layout/fx_textbreak.h +++ b/xfa/src/fgas/src/layout/fx_textbreak.h @@ -45,7 +45,7 @@ public: void GetString(CFX_WideString &wsStr) const { int32_t iCount = m_pLineChars->GetSize(); - FX_LPWSTR pBuf = wsStr.GetBuffer(iCount); + FX_WCHAR* pBuf = wsStr.GetBuffer(iCount); CFX_Char *pChar; for (int32_t i = 0; i < iCount; i ++) { pChar = m_pLineChars->GetDataPtr(i); @@ -96,7 +96,7 @@ public: virtual FX_DWORD GetContextCharStyles() const; virtual void SetContextCharStyles(FX_DWORD dwCharStyles); virtual void SetCombWidth(FX_FLOAT fCombWidth); - virtual void SetUserData(FX_LPVOID pUserData); + virtual void SetUserData(void* pUserData); virtual FX_DWORD AppendChar(FX_WCHAR wch); virtual FX_DWORD EndBreak(FX_DWORD dwStatus = FX_TXTBREAK_PieceBreak); virtual int32_t CountBreakChars() const; @@ -139,7 +139,7 @@ protected: int32_t m_iAlignment; FX_DWORD m_dwContextCharStyles; int32_t m_iCombWidth; - FX_LPVOID m_pUserData; + void* m_pUserData; FX_DWORD m_dwCharType; FX_BOOL m_bCurRTL; int32_t m_iCurAlignment; diff --git a/xfa/src/fgas/src/localization/fx_locale.cpp b/xfa/src/fgas/src/localization/fx_locale.cpp index 4f046df119..8e564354a7 100644 --- a/xfa/src/fgas/src/localization/fx_locale.cpp +++ b/xfa/src/fgas/src/localization/fx_locale.cpp @@ -15,7 +15,7 @@ #define FX_LOCALECATEGORY_NullHash 0x052931bb typedef struct _FX_LOCALESUBCATEGORYINFO { uint32_t uHash; - FX_LPCWSTR pName; + const FX_WCHAR* pName; int32_t eSubCategory; } FX_LOCALESUBCATEGORYINFO, * FX_LPLOCALESUBCATEGORYINFO; typedef FX_LOCALESUBCATEGORYINFO const * FX_LPCLOCALESUBCATEGORYINFO; @@ -57,10 +57,10 @@ static FX_STRSIZE FX_Local_Find(FX_WSTR wsSymbols, FX_WCHAR ch, FX_STRSIZE nStar if (nLength < 1 || nStart > nLength) { return -1; } - FX_LPCWSTR lpsz = (FX_LPCWSTR)FXSYS_wcschr(wsSymbols.GetPtr() + nStart, ch); + const FX_WCHAR* lpsz = (const FX_WCHAR*)FXSYS_wcschr(wsSymbols.GetPtr() + nStart, ch); return (lpsz == NULL) ? -1 : (FX_STRSIZE)(lpsz - wsSymbols.GetPtr()); } -const static FX_LPCWSTR gs_LocalNumberSymbols[] = { +static const FX_WCHAR* const gs_LocalNumberSymbols[] = { L"decimal", L"grouping", L"percent", L"minus", L"zero", L"currencySymbol", L"currencyName", }; @@ -163,7 +163,7 @@ void CFX_Locale::GetMeridiemName(CFX_WideString& wsMeridiemName, FX_BOOL bAM ) c } FX_GetCalendarSymbol(m_pElement, "meridiem", bAM ? 0 : 1, FALSE, wsMeridiemName); } -static int32_t FX_ParseTimeZone(FX_LPCWSTR pStr, int32_t iLen, FX_TIMEZONE& tz) +static int32_t FX_ParseTimeZone(const FX_WCHAR* pStr, int32_t iLen, FX_TIMEZONE& tz) { tz.tzHour = 0; tz.tzMinute = 0; @@ -293,7 +293,7 @@ static FX_BOOL FX_WStringToNumeric(const CFX_WideString& wsValue, CFX_LCNumeric& const int32_t nIntegralMaxLen = 17; int32_t cc = 0; FX_BOOL bNegative = FALSE, bExpSign = FALSE; - FX_LPCWSTR str = (FX_LPCWSTR)wsValue; + const FX_WCHAR* str = (const FX_WCHAR*)wsValue; int32_t len = wsValue.GetLength(); while (cc < len && FX_IsSpace(str[cc])) { cc++; @@ -436,7 +436,7 @@ CFX_WideString CFX_LCNumeric::ToString(int32_t nTreading, FX_BOOL bTrimTailZeros const int32_t nIntegralMaxLen = 17; int32_t cc = 0; FX_BOOL bNegative = FALSE, bExpSign = FALSE; - FX_LPCWSTR str = (FX_LPCWSTR)m_wsValue; + const FX_WCHAR* str = (const FX_WCHAR*)m_wsValue; int32_t len = m_wsValue.GetLength(); while (cc < len && FX_IsSpace(str[cc])) { cc++; @@ -504,8 +504,8 @@ CFX_WideString CFX_LCNumeric::ToString(int32_t nTreading, FX_BOOL bTrimTailZeros wsFormat.Format(L"%%.%dG", nTreading); double dblMantissa = (dbValeu > 0) ? (dbValeu - iInte) : (iInte - dbValeu); CFX_WideString wsFrac; - wsFrac.Format((FX_LPCWSTR)wsFormat, dblMantissa); - wsResult += CFX_WideStringC((FX_LPCWSTR)wsFrac + 1, wsFrac.GetLength() - 1); + wsFrac.Format((const FX_WCHAR*)wsFormat, dblMantissa); + wsResult += CFX_WideStringC((const FX_WCHAR*)wsFrac + 1, wsFrac.GetLength() - 1); if (bTrimTailZeros && nTreading > 0) { wsResult.TrimRight(L"0"); wsResult.TrimRight(L"."); @@ -515,7 +515,7 @@ CFX_WideString CFX_LCNumeric::ToString(int32_t nTreading, FX_BOOL bTrimTailZeros CFX_WideString wsFormat; wsFormat.Format(L"%%.%df", nTreading); CFX_WideString wsResult; - wsResult.Format(FX_LPCWSTR(wsFormat), GetDouble()); + wsResult.Format(wsFormat.c_str(), GetDouble()); if (bTrimTailZeros && nTreading > 0) { wsResult.TrimRight(L"0"); wsResult.TrimRight(L"."); @@ -540,9 +540,9 @@ CFX_FormatString::~CFX_FormatString() void CFX_FormatString::SplitFormatString(const CFX_WideString& wsFormatString, CFX_WideStringArray& wsPatterns) { int32_t iStrLen = wsFormatString.GetLength(); - FX_LPCWSTR pStr = (FX_LPCWSTR)wsFormatString; - FX_LPCWSTR pToken = pStr; - FX_LPCWSTR pEnd = pStr + iStrLen; + const FX_WCHAR* pStr = (const FX_WCHAR*)wsFormatString; + const FX_WCHAR* pToken = pStr; + const FX_WCHAR* pEnd = pStr + iStrLen; FX_BOOL iQuote = FALSE; while (TRUE) { if (pStr >= pEnd) { @@ -559,7 +559,7 @@ void CFX_FormatString::SplitFormatString(const CFX_WideString& wsFormatString, C pStr ++; } } -static CFX_WideString FX_GetLiteralText(FX_LPCWSTR pStrPattern, int32_t &iPattern, int32_t iLenPattern) +static CFX_WideString FX_GetLiteralText(const FX_WCHAR* pStrPattern, int32_t &iPattern, int32_t iLenPattern) { CFX_WideString wsOutput; if (pStrPattern[iPattern] != '\'') { @@ -599,7 +599,7 @@ static CFX_WideString FX_GetLiteralText(FX_LPCWSTR pStrPattern, int32_t &iPatter } return wsOutput; } -static CFX_WideString FX_GetLiteralTextReverse(FX_LPCWSTR pStrPattern, int32_t &iPattern) +static CFX_WideString FX_GetLiteralTextReverse(const FX_WCHAR* pStrPattern, int32_t &iPattern) { CFX_WideString wsOutput; if (pStrPattern[iPattern] != '\'') { @@ -646,7 +646,7 @@ FX_LOCALECATEGORY CFX_FormatString::GetCategory(const CFX_WideString& wsPattern) FX_LOCALECATEGORY eCategory = FX_LOCALECATEGORY_Unknown; int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); - FX_LPCWSTR pStr = (FX_LPCWSTR)wsPattern; + const FX_WCHAR* pStr = (const FX_WCHAR*)wsPattern; FX_BOOL bBraceOpen = FALSE; while (ccf < iLenf) { if (pStr[ccf] == '\'') { @@ -697,7 +697,7 @@ FX_LOCALECATEGORY CFX_FormatString::GetCategory(const CFX_WideString& wsPattern) } return eCategory; } -static FX_WORD FX_WStringToLCID(FX_LPCWSTR pstrLCID) +static FX_WORD FX_WStringToLCID(const FX_WCHAR* pstrLCID) { if (!pstrLCID) { return 0; @@ -713,7 +713,7 @@ CFX_WideString CFX_FormatString::GetLocaleName(const CFX_WideString& wsPattern) { int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); - FX_LPCWSTR pStr = (FX_LPCWSTR)wsPattern; + const FX_WCHAR* pStr = (const FX_WCHAR*)wsPattern; while (ccf < iLenf) { if (pStr[ccf] == '\'') { FX_GetLiteralText(pStr, ccf, iLenf); @@ -734,7 +734,7 @@ IFX_Locale* CFX_FormatString::GetTextFormat(const CFX_WideString &wsPattern, FX_ IFX_Locale* pLocale = NULL; int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); - FX_LPCWSTR pStr = (FX_LPCWSTR)wsPattern; + const FX_WCHAR* pStr = (const FX_WCHAR*)wsPattern; FX_BOOL bBrackOpen = FALSE; while (ccf < iLenf) { if (pStr[ccf] == '\'') { @@ -787,7 +787,7 @@ IFX_Locale* CFX_FormatString::GetNumericFormat(const CFX_WideString& wsPattern, IFX_Locale* pLocale = NULL; int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); - FX_LPCWSTR pStr = (FX_LPCWSTR)wsPattern; + const FX_WCHAR* pStr = (const FX_WCHAR*)wsPattern; FX_BOOL bFindDot = FALSE; FX_BOOL bBrackOpen = FALSE; while (ccf < iLenf) { @@ -882,12 +882,12 @@ static FX_BOOL FX_GetNumericDotIndex(const CFX_WideString& wsNum, const CFX_Wide { int32_t ccf = 0; int32_t iLenf = wsNum.GetLength(); - FX_LPCWSTR pStr = (FX_LPCWSTR)wsNum; + const FX_WCHAR* pStr = (const FX_WCHAR*)wsNum; int32_t iLenDot = wsDotSymbol.GetLength(); while (ccf < iLenf) { if (pStr[ccf] == '\'') { FX_GetLiteralText(pStr, ccf, iLenf); - } else if (ccf + iLenDot <= iLenf && !FXSYS_wcsncmp(pStr + ccf, (FX_LPCWSTR)wsDotSymbol, iLenDot)) { + } else if (ccf + iLenDot <= iLenf && !FXSYS_wcsncmp(pStr + ccf, (const FX_WCHAR*)wsDotSymbol, iLenDot)) { iDotIndex = ccf; return TRUE; } @@ -912,16 +912,16 @@ FX_BOOL CFX_FormatString::ParseText(const CFX_WideString& wsSrcText, const CFX_W return FALSE; } int32_t iText = 0, iPattern = 0; - FX_LPCWSTR pStrText = (FX_LPCWSTR)wsSrcText; + const FX_WCHAR* pStrText = (const FX_WCHAR*)wsSrcText; int32_t iLenText = wsSrcText.GetLength(); - FX_LPCWSTR pStrPattern = (FX_LPCWSTR)wsTextFormat; + const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat; int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern && iText < iLenText) { switch (pStrPattern[iPattern]) { case '\'': { CFX_WideString wsLiteral = FX_GetLiteralText(pStrPattern, iPattern, iLenPattern); int32_t iLiteralLen = wsLiteral.GetLength(); - if (iText + iLiteralLen > iLenText || FXSYS_wcsncmp(pStrText + iText, (FX_LPCWSTR)wsLiteral, iLiteralLen)) { + if (iText + iLiteralLen > iLenText || FXSYS_wcsncmp(pStrText + iText, (const FX_WCHAR*)wsLiteral, iLiteralLen)) { wsValue = wsSrcText; return FALSE; } @@ -992,9 +992,9 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinus); int32_t iMinusLen = wsMinus.GetLength(); int cc = 0, ccf = 0; - FX_LPCWSTR str = (FX_LPCWSTR)wsSrcNum; + const FX_WCHAR* str = (const FX_WCHAR*)wsSrcNum; int len = wsSrcNum.GetLength(); - FX_LPCWSTR strf = (FX_LPCWSTR)wsNumFormat; + const FX_WCHAR* strf = (const FX_WCHAR*)wsNumFormat; int lenf = wsNumFormat.GetLength(); double dbRetValue = 0; double coeff = 1; @@ -1015,7 +1015,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid CFX_WideString wsLiteral = FX_GetLiteralTextReverse(strf, ccf); int32_t iLiteralLen = wsLiteral.GetLength(); cc -= iLiteralLen - 1; - if (cc < 0 || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsLiteral, iLiteralLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsLiteral, iLiteralLen)) { return FALSE; } cc--; @@ -1052,7 +1052,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid cc--; } else { cc -= iMinusLen - 1; - if (cc < 0 || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsMinus, iMinusLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsMinus, iMinusLen)) { return FALSE; } cc--; @@ -1065,7 +1065,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid cc--; } else { cc -= iMinusLen - 1; - if (cc < 0 || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsMinus, iMinusLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsMinus, iMinusLen)) { return FALSE; } cc--; @@ -1089,7 +1089,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid } else if (str[cc] == '+') { cc--; continue; - } else if (cc - iMinusLen + 1 > 0 && !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), (FX_LPCWSTR)wsMinus, iMinusLen)) { + } else if (cc - iMinusLen + 1 > 0 && !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), (const FX_WCHAR*)wsMinus, iMinusLen)) { bExpSign = TRUE; cc -= iMinusLen; } else { @@ -1106,7 +1106,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol, wsSymbol); int32_t iSymbolLen = wsSymbol.GetLength(); cc -= iSymbolLen - 1; - if (cc < 0 || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsSymbol, iSymbolLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsSymbol, iSymbolLen)) { return FALSE; } cc--; @@ -1170,7 +1170,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol); int32_t iSysmbolLen = wsSymbol.GetLength(); cc -= iSysmbolLen - 1; - if (cc < 0 || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsSymbol, iSysmbolLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsSymbol, iSysmbolLen)) { return FALSE; } cc--; @@ -1191,7 +1191,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid case ',': { if (cc >= 0) { cc -= iGroupLen - 1; - if (cc >= 0 && FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsGroupSymbol, iGroupLen) == 0) { + if (cc >= 0 && FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsGroupSymbol, iGroupLen) == 0) { cc--; } else { cc += iGroupLen - 1; @@ -1237,7 +1237,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid CFX_WideString wsLiteral = FX_GetLiteralTextReverse(strf, ccf); int32_t iLiteralLen = wsLiteral.GetLength(); cc -= iLiteralLen - 1; - if (cc < 0 || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsLiteral, iLiteralLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsLiteral, iLiteralLen)) { return FALSE; } cc--; @@ -1278,7 +1278,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid cc--; } else { cc -= iMinusLen - 1; - if (cc < 0 || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsMinus, iMinusLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsMinus, iMinusLen)) { return FALSE; } cc--; @@ -1291,7 +1291,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid cc--; } else { cc -= iMinusLen - 1; - if (cc < 0 || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsMinus, iMinusLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsMinus, iMinusLen)) { return FALSE; } cc--; @@ -1315,7 +1315,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid } else if (str[cc] == '+') { cc--; continue; - } else if (cc - iMinusLen + 1 > 0 && !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), (FX_LPCWSTR)wsMinus, iMinusLen)) { + } else if (cc - iMinusLen + 1 > 0 && !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), (const FX_WCHAR*)wsMinus, iMinusLen)) { bExpSign = TRUE; cc -= iMinusLen; } else { @@ -1332,7 +1332,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol, wsSymbol); int32_t iSymbolLen = wsSymbol.GetLength(); cc -= iSymbolLen - 1; - if (cc < 0 || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsSymbol, iSymbolLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsSymbol, iSymbolLen)) { return FALSE; } cc--; @@ -1396,7 +1396,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol); int32_t iSysmbolLen = wsSymbol.GetLength(); cc -= iSysmbolLen - 1; - if (cc < 0 || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsSymbol, iSysmbolLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsSymbol, iSysmbolLen)) { return FALSE; } cc--; @@ -1409,7 +1409,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid case ',': { if (cc >= 0) { cc -= iGroupLen - 1; - if (cc >= 0 && FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsGroupSymbol, iGroupLen) == 0) { + if (cc >= 0 && FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsGroupSymbol, iGroupLen) == 0) { cc--; } else { cc += iGroupLen - 1; @@ -1456,7 +1456,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid case '\'': { CFX_WideString wsLiteral = FX_GetLiteralText(strf, ccf, lenf); int32_t iLiteralLen = wsLiteral.GetLength(); - if (cc + iLiteralLen > len || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsLiteral, iLiteralLen)) { + if (cc + iLiteralLen > len || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsLiteral, iLiteralLen)) { return FALSE; } cc += iLiteralLen; @@ -1498,7 +1498,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid if (str[cc] == '+' || str[cc] == ' ') { cc++; } else { - if (cc + iMinusLen > len || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsMinus, iMinusLen)) { + if (cc + iMinusLen > len || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsMinus, iMinusLen)) { return FALSE; } bNeg = TRUE; @@ -1510,7 +1510,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid if (str[cc] == '+') { cc++; } else { - if (cc + iMinusLen > len || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsMinus, iMinusLen)) { + if (cc + iMinusLen > len || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsMinus, iMinusLen)) { return FALSE; } bNeg = TRUE; @@ -1547,7 +1547,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid CFX_WideString wsSymbol; pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol, wsSymbol); int32_t iSymbolLen = wsSymbol.GetLength(); - if (cc + iSymbolLen > len || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsSymbol, iSymbolLen)) { + if (cc + iSymbolLen > len || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsSymbol, iSymbolLen)) { return FALSE; } cc += iSymbolLen; @@ -1602,7 +1602,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid CFX_WideString wsSymbol; pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol); int32_t iSysmbolLen = wsSymbol.GetLength(); - if (cc + iSysmbolLen <= len && !FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsSymbol, iSysmbolLen)) { + if (cc + iSysmbolLen <= len && !FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsSymbol, iSysmbolLen)) { cc += iSysmbolLen; } ccf++; @@ -1621,7 +1621,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid } break; case ',': { - if (cc + iGroupLen <= len && FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsGroupSymbol, iGroupLen) == 0) { + if (cc + iGroupLen <= len && FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsGroupSymbol, iGroupLen) == 0) { cc += iGroupLen; } ccf++; @@ -1672,8 +1672,8 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid void FX_ParseNumString(const CFX_WideString& wsNum, CFX_WideString& wsResult) { int32_t iCount = wsNum.GetLength(); - FX_LPCWSTR pStr = (FX_LPCWSTR)wsNum; - FX_LPWSTR pDst = wsResult.GetBuffer(iCount); + const FX_WCHAR* pStr = (const FX_WCHAR*)wsNum; + FX_WCHAR* pDst = wsResult.GetBuffer(iCount); int32_t nIndex = 0; FX_BOOL bMinus = FALSE; int32_t i = 0; @@ -1741,9 +1741,9 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinus); int32_t iMinusLen = wsMinus.GetLength(); int cc = 0, ccf = 0; - FX_LPCWSTR str = (FX_LPCWSTR)wsSrcNum; + const FX_WCHAR* str = (const FX_WCHAR*)wsSrcNum; int len = wsSrcNum.GetLength(); - FX_LPCWSTR strf = (FX_LPCWSTR)wsNumFormat; + const FX_WCHAR* strf = (const FX_WCHAR*)wsNumFormat; int lenf = wsNumFormat.GetLength(); FX_BOOL bHavePercentSymbol = FALSE; FX_BOOL bNeg = FALSE; @@ -1761,7 +1761,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid CFX_WideString wsLiteral = FX_GetLiteralTextReverse(strf, ccf); int32_t iLiteralLen = wsLiteral.GetLength(); cc -= iLiteralLen - 1; - if (cc < 0 || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsLiteral, iLiteralLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsLiteral, iLiteralLen)) { return FALSE; } cc--; @@ -1799,7 +1799,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid cc--; } else { cc -= iMinusLen - 1; - if (cc < 0 || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsMinus, iMinusLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsMinus, iMinusLen)) { return FALSE; } cc--; @@ -1812,7 +1812,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid cc--; } else { cc -= iMinusLen - 1; - if (cc < 0 || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsMinus, iMinusLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsMinus, iMinusLen)) { return FALSE; } cc--; @@ -1836,7 +1836,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid } else if (str[cc] == '+') { cc--; continue; - } else if (cc - iMinusLen + 1 > 0 && !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), (FX_LPCWSTR)wsMinus, iMinusLen)) { + } else if (cc - iMinusLen + 1 > 0 && !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), (const FX_WCHAR*)wsMinus, iMinusLen)) { bExpSign = TRUE; cc -= iMinusLen; } else { @@ -1853,7 +1853,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol, wsSymbol); int32_t iSymbolLen = wsSymbol.GetLength(); cc -= iSymbolLen - 1; - if (cc < 0 || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsSymbol, iSymbolLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsSymbol, iSymbolLen)) { return FALSE; } cc--; @@ -1917,7 +1917,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol); int32_t iSysmbolLen = wsSymbol.GetLength(); cc -= iSysmbolLen - 1; - if (cc < 0 || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsSymbol, iSysmbolLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsSymbol, iSysmbolLen)) { return FALSE; } cc--; @@ -1930,7 +1930,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid case ',': { if (cc >= 0) { cc -= iGroupLen - 1; - if (cc >= 0 && FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsGroupSymbol, iGroupLen) == 0) { + if (cc >= 0 && FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsGroupSymbol, iGroupLen) == 0) { cc--; } else { cc += iGroupLen - 1; @@ -1985,7 +1985,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid case '\'': { CFX_WideString wsLiteral = FX_GetLiteralText(strf, ccf, lenf); int32_t iLiteralLen = wsLiteral.GetLength(); - if (cc + iLiteralLen > len || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsLiteral, iLiteralLen)) { + if (cc + iLiteralLen > len || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsLiteral, iLiteralLen)) { return FALSE; } cc += iLiteralLen; @@ -2024,7 +2024,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid if (str[cc] == '+' || str[cc] == ' ') { cc++; } else { - if (cc + iMinusLen > len || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsMinus, iMinusLen)) { + if (cc + iMinusLen > len || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsMinus, iMinusLen)) { return FALSE; } bNeg = TRUE; @@ -2036,7 +2036,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid if (str[cc] == '+') { cc++; } else { - if (cc + iMinusLen > len || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsMinus, iMinusLen)) { + if (cc + iMinusLen > len || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsMinus, iMinusLen)) { return FALSE; } bNeg = TRUE; @@ -2073,7 +2073,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid CFX_WideString wsSymbol; pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol, wsSymbol); int32_t iSymbolLen = wsSymbol.GetLength(); - if (cc + iSymbolLen > len || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsSymbol, iSymbolLen)) { + if (cc + iSymbolLen > len || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsSymbol, iSymbolLen)) { return FALSE; } cc += iSymbolLen; @@ -2128,7 +2128,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid CFX_WideString wsSymbol; pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol); int32_t iSysmbolLen = wsSymbol.GetLength(); - if (cc + iSysmbolLen <= len && !FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsSymbol, iSysmbolLen)) { + if (cc + iSysmbolLen <= len && !FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsSymbol, iSysmbolLen)) { cc += iSysmbolLen; } ccf++; @@ -2146,7 +2146,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, const CFX_Wid } break; case ',': { - if (cc + iGroupLen <= len && FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsGroupSymbol, iGroupLen) == 0) { + if (cc + iGroupLen <= len && FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsGroupSymbol, iGroupLen) == 0) { cc += iGroupLen; } ccf++; @@ -2204,7 +2204,7 @@ FX_DATETIMETYPE CFX_FormatString::GetDateTimeFormat(const CFX_WideString& wsPatt FX_LOCALECATEGORY eCategory = FX_LOCALECATEGORY_Unknown; int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); - FX_LPCWSTR pStr = (FX_LPCWSTR)wsPattern; + const FX_WCHAR* pStr = (const FX_WCHAR*)wsPattern; int32_t iFindCategory = 0; FX_BOOL bBraceOpen = FALSE; while (ccf < iLenf) { @@ -2331,15 +2331,15 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, const CFX_WideSt int32_t month = 1; int32_t day = 1; int32_t ccf = 0; - FX_LPCWSTR str = (FX_LPCWSTR)wsDate; + const FX_WCHAR* str = (const FX_WCHAR*)wsDate; int32_t len = wsDate.GetLength(); - FX_LPCWSTR strf = (FX_LPCWSTR)wsDatePattern; + const FX_WCHAR* strf = (const FX_WCHAR*)wsDatePattern; int32_t lenf = wsDatePattern.GetLength(); while (cc < len && ccf < lenf) { if (strf[ccf] == '\'') { CFX_WideString wsLiteral = FX_GetLiteralText(strf, ccf, lenf); int32_t iLiteralLen = wsLiteral.GetLength(); - if (cc + iLiteralLen > len || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsLiteral, iLiteralLen)) { + if (cc + iLiteralLen > len || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsLiteral, iLiteralLen)) { return FALSE; } cc += iLiteralLen; @@ -2408,7 +2408,7 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, const CFX_WideSt if (wsMonthNameAbbr.IsEmpty()) { continue; } - if (!FXSYS_wcsncmp((FX_LPCWSTR)wsMonthNameAbbr, str + cc, wsMonthNameAbbr.GetLength())) { + if (!FXSYS_wcsncmp((const FX_WCHAR*)wsMonthNameAbbr, str + cc, wsMonthNameAbbr.GetLength())) { break; } } @@ -2424,7 +2424,7 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, const CFX_WideSt if (wsMonthName.IsEmpty()) { continue; } - if (!FXSYS_wcsncmp((FX_LPCWSTR)wsMonthName, str + cc, wsMonthName.GetLength())) { + if (!FXSYS_wcsncmp((const FX_WCHAR*)wsMonthName, str + cc, wsMonthName.GetLength())) { break; } } @@ -2442,7 +2442,7 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, const CFX_WideSt if (wsDayNameAbbr.IsEmpty()) { continue; } - if (!FXSYS_wcsncmp((FX_LPCWSTR)wsDayNameAbbr, str + cc, wsDayNameAbbr.GetLength())) { + if (!FXSYS_wcsncmp((const FX_WCHAR*)wsDayNameAbbr, str + cc, wsDayNameAbbr.GetLength())) { break; } } @@ -2457,7 +2457,7 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, const CFX_WideSt if (wsDayName == L"") { continue; } - if (!FXSYS_wcsncmp((FX_LPCWSTR)wsDayName, str + cc, wsDayName.GetLength())) { + if (!FXSYS_wcsncmp((const FX_WCHAR*)wsDayName, str + cc, wsDayName.GetLength())) { break; } } @@ -2536,9 +2536,9 @@ static FX_BOOL FX_ParseLocaleTime(const CFX_WideString& wsTime, const CFX_WideSt uint8_t second = 0; FX_WORD millisecond = 0; int32_t ccf = 0; - FX_LPCWSTR str = (FX_LPCWSTR)wsTime; + const FX_WCHAR* str = (const FX_WCHAR*)wsTime; int len = wsTime.GetLength(); - FX_LPCWSTR strf = (FX_LPCWSTR)wsTimePattern; + const FX_WCHAR* strf = (const FX_WCHAR*)wsTimePattern; int lenf = wsTimePattern.GetLength(); FX_BOOL bHasA = FALSE; FX_BOOL bPM = FALSE; @@ -2546,7 +2546,7 @@ static FX_BOOL FX_ParseLocaleTime(const CFX_WideString& wsTime, const CFX_WideSt if (strf[ccf] == '\'') { CFX_WideString wsLiteral = FX_GetLiteralText(strf, ccf, lenf); int32_t iLiteralLen = wsLiteral.GetLength(); - if (cc + iLiteralLen > len || FXSYS_wcsncmp(str + cc, (FX_LPCWSTR)wsLiteral, iLiteralLen)) { + if (cc + iLiteralLen > len || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsLiteral, iLiteralLen)) { return FALSE; } cc += iLiteralLen; @@ -2762,15 +2762,15 @@ FX_BOOL CFX_FormatString::ParseZero(const CFX_WideString& wsSrcText, const CFX_W CFX_WideString wsTextFormat; IFX_Locale* pLocale = GetTextFormat(wsPattern, FX_WSTRC(L"zero"), wsTextFormat); int32_t iText = 0, iPattern = 0; - FX_LPCWSTR pStrText = (FX_LPCWSTR)wsSrcText; + const FX_WCHAR* pStrText = (const FX_WCHAR*)wsSrcText; int32_t iLenText = wsSrcText.GetLength(); - FX_LPCWSTR pStrPattern = (FX_LPCWSTR)wsTextFormat; + const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat; int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern && iText < iLenText) { if (pStrPattern[iPattern] == '\'') { CFX_WideString wsLiteral = FX_GetLiteralText(pStrPattern, iPattern, iLenPattern); int32_t iLiteralLen = wsLiteral.GetLength(); - if (iText + iLiteralLen > iLenText || FXSYS_wcsncmp(pStrText + iText, (FX_LPCWSTR)wsLiteral, iLiteralLen)) { + if (iText + iLiteralLen > iLenText || FXSYS_wcsncmp(pStrText + iText, (const FX_WCHAR*)wsLiteral, iLiteralLen)) { return FALSE; } iText += iLiteralLen; @@ -2790,15 +2790,15 @@ FX_BOOL CFX_FormatString::ParseNull(const CFX_WideString& wsSrcText, const CFX_W CFX_WideString wsTextFormat; IFX_Locale* pLocale = GetTextFormat(wsPattern, FX_WSTRC(L"null"), wsTextFormat); int32_t iText = 0, iPattern = 0; - FX_LPCWSTR pStrText = (FX_LPCWSTR)wsSrcText; + const FX_WCHAR* pStrText = (const FX_WCHAR*)wsSrcText; int32_t iLenText = wsSrcText.GetLength(); - FX_LPCWSTR pStrPattern = (FX_LPCWSTR)wsTextFormat; + const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat; int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern && iText < iLenText) { if (pStrPattern[iPattern] == '\'') { CFX_WideString wsLiteral = FX_GetLiteralText(pStrPattern, iPattern, iLenPattern); int32_t iLiteralLen = wsLiteral.GetLength(); - if (iText + iLiteralLen > iLenText || FXSYS_wcsncmp(pStrText + iText, (FX_LPCWSTR)wsLiteral, iLiteralLen)) { + if (iText + iLiteralLen > iLenText || FXSYS_wcsncmp(pStrText + iText, (const FX_WCHAR*)wsLiteral, iLiteralLen)) { return FALSE; } iText += iLiteralLen; @@ -2825,8 +2825,8 @@ FX_BOOL CFX_FormatString::FormatText(const CFX_WideString& wsSrcText, const CFX_ CFX_WideString wsTextFormat; IFX_Locale* pLocale = GetTextFormat(wsPattern, FX_WSTRC(L"text"), wsTextFormat); int32_t iText = 0, iPattern = 0; - FX_LPCWSTR pStrText = (FX_LPCWSTR)wsSrcText; - FX_LPCWSTR pStrPattern = (FX_LPCWSTR)wsTextFormat; + const FX_WCHAR* pStrText = (const FX_WCHAR*)wsSrcText; + const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat; int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern) { switch (pStrPattern[iPattern]) { @@ -2900,7 +2900,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(FX_WSTR wsInputNum, const CFX_WideString& return FALSE; } int32_t cc = 0, ccf = 0; - FX_LPCWSTR strf = (FX_LPCWSTR)wsNumFormat; + const FX_WCHAR* strf = (const FX_WCHAR*)wsNumFormat; int lenf = wsNumFormat.GetLength(); CFX_WideString wsSrcNum = wsInputNum; wsSrcNum.TrimLeft('0'); @@ -2969,7 +2969,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(FX_WSTR wsInputNum, const CFX_WideString& wsSrcNum.Delete(0, 1); } FX_BOOL bAddNeg = FALSE; - FX_LPCWSTR str = (FX_LPCWSTR)wsSrcNum; + const FX_WCHAR* str = (const FX_WCHAR*)wsSrcNum; int len = wsSrcNum.GetLength(); int dot_index = wsSrcNum.Find('.'); if (dot_index == -1) { @@ -3330,7 +3330,7 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, const CFX_WideSt return FALSE; } int32_t cc = 0, ccf = 0; - FX_LPCWSTR strf = (FX_LPCWSTR)wsNumFormat; + const FX_WCHAR* strf = (const FX_WCHAR*)wsNumFormat; int lenf = wsNumFormat.GetLength(); double dbOrgRaw = lcNum.GetDouble(); double dbRetValue = dbOrgRaw; @@ -3392,7 +3392,7 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, const CFX_WideSt wsNumeric.Delete(0, 1); } FX_BOOL bAddNeg = FALSE; - FX_LPCWSTR str = (FX_LPCWSTR)wsNumeric; + const FX_WCHAR* str = (const FX_WCHAR*)wsNumeric; int len = wsNumeric.GetLength(); int dot_index = wsNumeric.Find('.'); if (dot_index == -1) { @@ -3747,7 +3747,7 @@ FX_BOOL FX_DateFromCanonical(const CFX_WideString& wsDate, CFX_Unitime& datetime int32_t day = 1; FX_WORD wYear = 0; int cc_start = 0, cc = 0; - FX_LPCWSTR str = (FX_LPCWSTR)wsDate; + const FX_WCHAR* str = (const FX_WCHAR*)wsDate; int len = wsDate.GetLength(); if(len > 10) { return FALSE; @@ -3826,7 +3826,7 @@ FX_BOOL FX_TimeFromCanonical(FX_WSTR wsTime, CFX_Unitime& datetime, IFX_Locale* uint8_t second = 0; FX_WORD millisecond = 0; int cc_start = 0, cc = cc_start; - FX_LPCWSTR str = (FX_LPCWSTR)wsTime.GetPtr(); + const FX_WCHAR* str = (const FX_WCHAR*)wsTime.GetPtr(); int len = wsTime.GetLength(); while (cc < len && cc < 2) { if (!FX_IsDigit(str[cc])) { @@ -3949,7 +3949,7 @@ static FX_BOOL FX_DateFormat(const CFX_WideString& wsDatePattern, IFX_Locale *pL uint8_t month = datetime.GetMonth(); uint8_t day = datetime.GetDay(); int32_t ccf = 0; - FX_LPCWSTR strf = (FX_LPCWSTR)wsDatePattern; + const FX_WCHAR* strf = (const FX_WCHAR*)wsDatePattern; int32_t lenf = wsDatePattern.GetLength(); while (ccf < lenf) { if (strf[ccf] == '\'') { @@ -4066,7 +4066,7 @@ static FX_BOOL FX_TimeFormat(const CFX_WideString& wsTimePattern, IFX_Locale *pL uint8_t second = datetime.GetSecond(); FX_WORD millisecond = datetime.GetMillisecond(); int32_t ccf = 0; - FX_LPCWSTR strf = (FX_LPCWSTR)wsTimePattern; + const FX_WCHAR* strf = (const FX_WCHAR*)wsTimePattern; int32_t lenf = wsTimePattern.GetLength(); FX_WORD wHour = hour; FX_BOOL bPM = FALSE; @@ -4259,8 +4259,8 @@ FX_BOOL CFX_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, co return FX_FormatDateTime(dt, wsDatePattern, wsTimePattern, TRUE, pLocale, wsOutput); } } else { - CFX_WideStringC wsSrcDate((FX_LPCWSTR)wsSrcDateTime, iT); - CFX_WideStringC wsSrcTime((FX_LPCWSTR)wsSrcDateTime + iT + 1, wsSrcDateTime.GetLength() - iT - 1); + CFX_WideStringC wsSrcDate((const FX_WCHAR*)wsSrcDateTime, iT); + CFX_WideStringC wsSrcTime((const FX_WCHAR*)wsSrcDateTime + iT + 1, wsSrcDateTime.GetLength() - iT - 1); if(wsSrcDate.IsEmpty() || wsSrcTime.IsEmpty()) { return FALSE; } @@ -4291,7 +4291,7 @@ FX_BOOL CFX_FormatString::FormatZero(const CFX_WideString& wsPattern, CFX_WideSt CFX_WideString wsTextFormat; IFX_Locale* pLocale = GetTextFormat(wsPattern, FX_WSTRC(L"zero"), wsTextFormat); int32_t iPattern = 0; - FX_LPCWSTR pStrPattern = (FX_LPCWSTR)wsTextFormat; + const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat; int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern) { if (pStrPattern[iPattern] == '\'') { @@ -4313,7 +4313,7 @@ FX_BOOL CFX_FormatString::FormatNull(const CFX_WideString& wsPattern, CFX_WideSt CFX_WideString wsTextFormat; IFX_Locale* pLocale = GetTextFormat(wsPattern, FX_WSTRC(L"null"), wsTextFormat); int32_t iPattern = 0; - FX_LPCWSTR pStrPattern = (FX_LPCWSTR)wsTextFormat; + const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat; int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern) { if (pStrPattern[iPattern] == '\'') { @@ -4625,8 +4625,8 @@ CFX_Decimal::CFX_Decimal(FX_FLOAT val, uint8_t scale ) } CFX_Decimal::CFX_Decimal(FX_WSTR strObj) { - FX_LPCWSTR str = strObj.GetPtr(); - FX_LPCWSTR strBound = str + strObj.GetLength(); + const FX_WCHAR* str = strObj.GetPtr(); + const FX_WCHAR* strBound = str + strObj.GetLength(); FX_BOOL pointmet = 0; FX_BOOL negmet = 0; uint8_t scale = 0; diff --git a/xfa/src/fgas/src/localization/fx_localemgr.cpp b/xfa/src/fgas/src/localization/fx_localemgr.cpp index b3f0e80d7a..0623fe1789 100644 --- a/xfa/src/fgas/src/localization/fx_localemgr.cpp +++ b/xfa/src/fgas/src/localization/fx_localemgr.cpp @@ -6,7 +6,7 @@ #include "../fgas_base.h" #include "fx_localemgr.h" -IFX_LocaleMgr* FX_LocaleMgr_Create(FX_LPCWSTR pszLocalPath, FX_WORD wDefaultLCID) +IFX_LocaleMgr* FX_LocaleMgr_Create(const FX_WCHAR* pszLocalPath, FX_WORD wDefaultLCID) { void* pPathHandle = FX_OpenFolder(pszLocalPath); if (!pPathHandle) { @@ -38,10 +38,10 @@ IFX_LocaleMgr* FX_LocaleMgr_Create(FX_LPCWSTR pszLocalPath, FX_WORD wDefaultLCID CFX_WideString wsLCID = pXmlLocale->GetAttrValue("", "lcid"); wchar_t* pEnd = NULL; FX_DWORD dwLCID = wcstol(wsLCID, &pEnd, 16); - if (pLocaleMgr->m_lcid2xml.GetValueAt((FX_LPVOID)(uintptr_t)dwLCID)) { + if (pLocaleMgr->m_lcid2xml.GetValueAt((void*)(uintptr_t)dwLCID)) { delete pXmlLocale; } else { - pLocaleMgr->m_lcid2xml.SetAt((FX_LPVOID)(uintptr_t)dwLCID, pXmlLocale); + pLocaleMgr->m_lcid2xml.SetAt((void*)(uintptr_t)dwLCID, pXmlLocale); } } else { delete pXmlLocale; @@ -59,7 +59,7 @@ CFX_LocaleMgr::~CFX_LocaleMgr() { FX_POSITION ps = m_lcid2locale.GetStartPosition(); while (ps) { - FX_LPVOID plcid; + void* plcid; IFX_Locale* pLocale = NULL; m_lcid2locale.GetNextAssoc(ps, plcid, (void*&)pLocale); pLocale->Release(); @@ -67,7 +67,7 @@ CFX_LocaleMgr::~CFX_LocaleMgr() m_lcid2locale.RemoveAll(); ps = m_lcid2xml.GetStartPosition(); while (ps) { - FX_LPVOID plcid; + void* plcid; CXML_Element* pxml = NULL; m_lcid2xml.GetNextAssoc(ps, plcid, (void*&)pxml); delete pxml; @@ -84,12 +84,12 @@ IFX_Locale* CFX_LocaleMgr::GetDefLocale() } IFX_Locale* CFX_LocaleMgr::GetLocale(FX_WORD lcid) { - IFX_Locale* pLocale = (IFX_Locale*)m_lcid2locale.GetValueAt((FX_LPVOID)(uintptr_t)lcid); + IFX_Locale* pLocale = (IFX_Locale*)m_lcid2locale.GetValueAt((void*)(uintptr_t)lcid); if (!pLocale) { - CXML_Element* pxml = (CXML_Element*)m_lcid2xml.GetValueAt((FX_LPVOID)(uintptr_t)lcid); + CXML_Element* pxml = (CXML_Element*)m_lcid2xml.GetValueAt((void*)(uintptr_t)lcid); if (pxml) { pLocale = IFX_Locale::Create(pxml); - m_lcid2locale.SetAt((FX_LPVOID)(uintptr_t)lcid, pLocale); + m_lcid2locale.SetAt((void*)(uintptr_t)lcid, pLocale); } } return pLocale; diff --git a/xfa/src/fgas/src/xml/fx_sax_imp.cpp b/xfa/src/fgas/src/xml/fx_sax_imp.cpp index fedf89f9f9..0e47ce53d4 100644 --- a/xfa/src/fgas/src/xml/fx_sax_imp.cpp +++ b/xfa/src/fgas/src/xml/fx_sax_imp.cpp @@ -102,8 +102,8 @@ CFX_SAXReader::CFX_SAXReader() , m_pCommentContext(NULL) , m_dwParseMode(0) { - m_pszData = (FX_LPBYTE)FX_Alloc(uint8_t, m_iDataSize); - m_pszName = (FX_LPBYTE)FX_Alloc(uint8_t, m_iNameSize); + m_pszData = (uint8_t*)FX_Alloc(uint8_t, m_iDataSize); + m_pszName = (uint8_t*)FX_Alloc(uint8_t, m_iNameSize); } CFX_SAXReader::~CFX_SAXReader() { @@ -179,7 +179,7 @@ void CFX_SAXReader::ReallocDataBuffer() } else { m_iDataSize += 1024 * 1024; } - m_pszData = (FX_LPBYTE)FX_Realloc(uint8_t, m_pszData, m_iDataSize); + m_pszData = (uint8_t*)FX_Realloc(uint8_t, m_pszData, m_iDataSize); } void CFX_SAXReader::ReallocNameBuffer() { @@ -191,7 +191,7 @@ void CFX_SAXReader::ReallocNameBuffer() } else { m_iNameSize += 1024 * 1024; } - m_pszName = (FX_LPBYTE)FX_Realloc(uint8_t, m_pszName, m_iNameSize); + m_pszName = (uint8_t*)FX_Realloc(uint8_t, m_pszName, m_iNameSize); } inline FX_BOOL CFX_SAXReader::SkipSpace(uint8_t ch) { @@ -239,7 +239,7 @@ int32_t CFX_SAXReader::ContinueParse(IFX_Pause *pPause ) while(m_File.m_dwCur < m_File.m_dwEnd) { FX_DWORD &index = m_File.m_dwBufIndex; FX_DWORD size = m_File.m_dwBufSize; - FX_LPCBYTE pBuf = m_File.m_pBuf; + const uint8_t* pBuf = m_File.m_pBuf; while (index < size) { m_CurByte = pBuf[index]; (this->*g_FX_SAXReader_LPFParse[m_eMode])(); diff --git a/xfa/src/fgas/src/xml/fx_sax_imp.h b/xfa/src/fgas/src/xml/fx_sax_imp.h index a2f7259235..6e95c81fae 100644 --- a/xfa/src/fgas/src/xml/fx_sax_imp.h +++ b/xfa/src/fgas/src/xml/fx_sax_imp.h @@ -18,7 +18,7 @@ public: FX_DWORD m_dwStart; FX_DWORD m_dwEnd; FX_DWORD m_dwCur; - FX_LPBYTE m_pBuf; + uint8_t* m_pBuf; FX_DWORD m_dwBufSize; FX_DWORD m_dwBufIndex; }; @@ -49,7 +49,7 @@ public: , m_pPrev(NULL) , m_pNext(NULL) {} - FX_LPVOID m_pNode; + void* m_pNode; FX_SAXNODE m_eNode; FX_DWORD m_dwID; FX_BOOL m_bSkip; @@ -111,12 +111,12 @@ protected: CFX_ByteArray m_SkipStack; uint8_t m_SkipChar; FX_DWORD m_dwNodePos; - FX_LPBYTE m_pszData; + uint8_t* m_pszData; int32_t m_iDataSize; int32_t m_iDataLength; int32_t m_iEntityStart; int32_t m_iDataPos; - FX_LPBYTE m_pszName; + uint8_t* m_pszName; int32_t m_iNameSize; int32_t m_iNameLength; FX_DWORD m_dwParseMode; -- cgit v1.2.3