diff options
Diffstat (limited to 'core')
138 files changed, 2226 insertions, 2218 deletions
diff --git a/core/include/fdrm/fx_crypt.h b/core/include/fdrm/fx_crypt.h index 8b0ce2f703..af72fcf470 100644 --- a/core/include/fdrm/fx_crypt.h +++ b/core/include/fdrm/fx_crypt.h @@ -13,34 +13,34 @@ extern "C" { #endif -void CRYPT_ArcFourCryptBlock(FX_LPBYTE data, FX_DWORD size, FX_LPCBYTE key, FX_DWORD keylen); -void CRYPT_ArcFourSetup(FX_LPVOID context, FX_LPCBYTE key, FX_DWORD length); -void CRYPT_ArcFourCrypt(FX_LPVOID context, FX_LPBYTE data, FX_DWORD size); -void CRYPT_AESSetKey(FX_LPVOID context, FX_DWORD blocklen, FX_LPCBYTE key, FX_DWORD keylen, FX_BOOL bEncrypt); -void CRYPT_AESSetIV(FX_LPVOID context, FX_LPCBYTE iv); -void CRYPT_AESDecrypt(FX_LPVOID context, FX_LPBYTE dest, FX_LPCBYTE src, FX_DWORD size); -void CRYPT_AESEncrypt(FX_LPVOID context, FX_LPBYTE dest, FX_LPCBYTE src, FX_DWORD size); -void CRYPT_MD5Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[16]); -void CRYPT_MD5Start(FX_LPVOID context); -void CRYPT_MD5Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size); -void CRYPT_MD5Finish(FX_LPVOID context, uint8_t digest[16]); -void CRYPT_SHA1Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[20]); -void CRYPT_SHA1Start(FX_LPVOID context); -void CRYPT_SHA1Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size); -void CRYPT_SHA1Finish(FX_LPVOID context, uint8_t digest[20]); -void CRYPT_SHA256Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[32]); -void CRYPT_SHA256Start(FX_LPVOID context); -void CRYPT_SHA256Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size); -void CRYPT_SHA256Finish(FX_LPVOID context, uint8_t digest[32]); -void CRYPT_SHA384Start(FX_LPVOID context); -void CRYPT_SHA384Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size); -void CRYPT_SHA384Finish(FX_LPVOID context, uint8_t digest[48]); -void CRYPT_SHA384Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[48]); -void CRYPT_SHA512Start(FX_LPVOID context); -void CRYPT_SHA512Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size); -void CRYPT_SHA512Finish(FX_LPVOID context, uint8_t digest[64]); -void CRYPT_SHA512Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[64]); -void CRYPT_SetPubKeyDecryptor(FX_BOOL (*func)(FX_LPCBYTE pData, FX_DWORD size, FX_LPBYTE data_buf, FX_DWORD& data_len)); +void CRYPT_ArcFourCryptBlock(uint8_t* data, FX_DWORD size, const uint8_t* key, FX_DWORD keylen); +void CRYPT_ArcFourSetup(void* context, const uint8_t* key, FX_DWORD length); +void CRYPT_ArcFourCrypt(void* context, uint8_t* data, FX_DWORD size); +void CRYPT_AESSetKey(void* context, FX_DWORD blocklen, const uint8_t* key, FX_DWORD keylen, FX_BOOL bEncrypt); +void CRYPT_AESSetIV(void* context, const uint8_t* iv); +void CRYPT_AESDecrypt(void* context, uint8_t* dest, const uint8_t* src, FX_DWORD size); +void CRYPT_AESEncrypt(void* context, uint8_t* dest, const uint8_t* src, FX_DWORD size); +void CRYPT_MD5Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[16]); +void CRYPT_MD5Start(void* context); +void CRYPT_MD5Update(void* context, const uint8_t* data, FX_DWORD size); +void CRYPT_MD5Finish(void* context, uint8_t digest[16]); +void CRYPT_SHA1Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[20]); +void CRYPT_SHA1Start(void* context); +void CRYPT_SHA1Update(void* context, const uint8_t* data, FX_DWORD size); +void CRYPT_SHA1Finish(void* context, uint8_t digest[20]); +void CRYPT_SHA256Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[32]); +void CRYPT_SHA256Start(void* context); +void CRYPT_SHA256Update(void* context, const uint8_t* data, FX_DWORD size); +void CRYPT_SHA256Finish(void* context, uint8_t digest[32]); +void CRYPT_SHA384Start(void* context); +void CRYPT_SHA384Update(void* context, const uint8_t* data, FX_DWORD size); +void CRYPT_SHA384Finish(void* context, uint8_t digest[48]); +void CRYPT_SHA384Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[48]); +void CRYPT_SHA512Start(void* context); +void CRYPT_SHA512Update(void* context, const uint8_t* data, FX_DWORD size); +void CRYPT_SHA512Finish(void* context, uint8_t digest[64]); +void CRYPT_SHA512Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[64]); +void CRYPT_SetPubKeyDecryptor(FX_BOOL (*func)(const uint8_t* pData, FX_DWORD size, uint8_t* data_buf, FX_DWORD& data_len)); #ifdef __cplusplus }; diff --git a/core/include/fpdfapi/fpdf_module.h b/core/include/fpdfapi/fpdf_module.h index 5be2b192c4..c7977b6183 100644 --- a/core/include/fpdfapi/fpdf_module.h +++ b/core/include/fpdfapi/fpdf_module.h @@ -66,11 +66,11 @@ public: void InitRenderModule(); - void SetDownloadCallback(FX_BOOL (*callback)(FX_LPCSTR module_name)); + void SetDownloadCallback(FX_BOOL (*callback)(const FX_CHAR* module_name)); - FX_BOOL DownloadModule(FX_LPCSTR module_name); + FX_BOOL DownloadModule(const FX_CHAR* module_name); - void NotifyModuleAvailable(FX_LPCSTR module_name); + void NotifyModuleAvailable(const FX_CHAR* module_name); @@ -102,13 +102,13 @@ public: ICodec_IccModule* GetIccModule(); ICodec_FlateModule* GetFlateModule(); - void RegisterSecurityHandler(FX_LPCSTR name, CPDF_SecurityHandler * (*CreateHandler)(void* param), void* param); + void RegisterSecurityHandler(const FX_CHAR* name, CPDF_SecurityHandler * (*CreateHandler)(void* param), void* param); - CPDF_SecurityHandler* CreateSecurityHandler(FX_LPCSTR name); + CPDF_SecurityHandler* CreateSecurityHandler(const FX_CHAR* name); - void SetPrivateData(FX_LPVOID module_id, FX_LPVOID pData, PD_CALLBACK_FREEDATA callback); + void SetPrivateData(void* module_id, void* pData, PD_CALLBACK_FREEDATA callback); - FX_LPVOID GetPrivateData(FX_LPVOID module_id); + void* GetPrivateData(void* module_id); int m_FileBufSize; protected: @@ -129,7 +129,7 @@ protected: CPDF_PageModuleDef* m_pPageModule; - FX_BOOL (*m_pDownloadCallback)(FX_LPCSTR module_name); + FX_BOOL (*m_pDownloadCallback)(const FX_CHAR* module_name); CFX_MapByteStringToPtr m_SecurityHandlerMap; diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h index d0c76c5b0d..39a05c64f9 100644 --- a/core/include/fpdfapi/fpdf_objects.h +++ b/core/include/fpdfapi/fpdf_objects.h @@ -36,7 +36,7 @@ class IFX_FileRead; #define PDFOBJ_NULL 8 #define PDFOBJ_REFERENCE 9 -typedef IFX_FileStream* (*FPDF_LPFCloneStreamCallback)(CPDF_Stream *pStream, FX_LPVOID pUserData); +typedef IFX_FileStream* (*FPDF_LPFCloneStreamCallback)(CPDF_Stream *pStream, void* pUserData); class CPDF_Object { public: @@ -83,7 +83,7 @@ public: void SetString(const CFX_ByteString& str); - void SetUnicodeText(FX_LPCWSTR pUnicodes, int len = -1); + void SetUnicodeText(const FX_WCHAR* pUnicodes, int len = -1); int GetDirectType() const; @@ -265,14 +265,14 @@ public: return new CPDF_Name(str); } - static CPDF_Name* Create(FX_LPCSTR str) + static CPDF_Name* Create(const FX_CHAR* str) { return new CPDF_Name(str); } CPDF_Name(const CFX_ByteString& str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } CPDF_Name(FX_BSTR str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } - CPDF_Name(FX_LPCSTR str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } + CPDF_Name(const FX_CHAR* str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } CFX_ByteString& GetString() { @@ -506,19 +506,19 @@ class CPDF_Stream : public CPDF_Object { public: - static CPDF_Stream* Create(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pDict) + static CPDF_Stream* Create(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict) { return new CPDF_Stream(pData, size, pDict); } - CPDF_Stream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pDict); + CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict); CPDF_Dictionary* GetDict() const { return m_pDict; } - void SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed, FX_BOOL bKeepBuf); + void SetData(const uint8_t* pData, FX_DWORD size, FX_BOOL bCompressed, FX_BOOL bKeepBuf); void InitStream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict); @@ -535,7 +535,7 @@ public: return m_dwSize; } - FX_BOOL ReadRawData(FX_FILESIZE start_pos, FX_LPBYTE pBuf, FX_DWORD buf_size) const; + FX_BOOL ReadRawData(FX_FILESIZE start_pos, uint8_t* pBuf, FX_DWORD buf_size) const; FX_BOOL IsMemoryBased() const @@ -543,7 +543,7 @@ public: return m_GenNum == (FX_DWORD) - 1; } - CPDF_Stream* Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpfCallback, FX_LPVOID pUserData) const; + CPDF_Stream* Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpfCallback, void* pUserData) const; protected: ~CPDF_Stream(); @@ -556,7 +556,7 @@ protected: union { - FX_LPBYTE m_pDataBuf; + uint8_t* m_pDataBuf; IFX_FileRead* m_pFile; }; @@ -591,11 +591,11 @@ public: return m_pStream? m_pStream->GetDict() : NULL; } - FX_LPCBYTE GetData() const; + const uint8_t* GetData() const; FX_DWORD GetSize() const; - FX_LPBYTE DetachData(); + uint8_t* DetachData(); const CFX_ByteString& GetImageDecoder() { @@ -608,7 +608,7 @@ public: } protected: - FX_LPBYTE m_pData; + uint8_t* m_pData; FX_DWORD m_dwSize; @@ -620,7 +620,7 @@ protected: const CPDF_Stream* m_pStream; - FX_LPBYTE m_pSrcData; + uint8_t* m_pSrcData; }; CFX_DataFilter* FPDF_CreateFilter(FX_BSTR name, const CPDF_Dictionary* pParam, int width = 0, int height = 0); #define FPDF_FILTER_BUFFER_SIZE 20480 @@ -630,7 +630,7 @@ public: ~CPDF_StreamFilter(); - FX_DWORD ReadBlock(FX_LPBYTE buffer, FX_DWORD size); + FX_DWORD ReadBlock(uint8_t* buffer, FX_DWORD size); FX_DWORD GetSrcPos() { @@ -645,7 +645,7 @@ protected: CPDF_StreamFilter() {} - FX_DWORD ReadLeftOver(FX_LPBYTE buffer, FX_DWORD buf_size); + FX_DWORD ReadLeftOver(uint8_t* buffer, FX_DWORD buf_size); const CPDF_Stream* m_pStream; diff --git a/core/include/fpdfapi/fpdf_page.h b/core/include/fpdfapi/fpdf_page.h index d549b7713a..867f00208b 100644 --- a/core/include/fpdfapi/fpdf_page.h +++ b/core/include/fpdfapi/fpdf_page.h @@ -235,7 +235,7 @@ public: void TransformContent(CFX_Matrix& matrix); protected: void ProcessImage(CFX_ByteTextBuf& buf, CPDF_ImageObject* pImageObj); - void ProcessForm(CFX_ByteTextBuf& buf, FX_LPCBYTE data, FX_DWORD size, CFX_Matrix& matrix); + void ProcessForm(CFX_ByteTextBuf& buf, const uint8_t* data, FX_DWORD size, CFX_Matrix& matrix); CFX_ByteString RealizeResource(CPDF_Object* pResourceObj, const FX_CHAR* szType); private: CPDF_Page* m_pPage; diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h index f0e3e2ca08..cdd7aaaa11 100644 --- a/core/include/fpdfapi/fpdf_parser.h +++ b/core/include/fpdfapi/fpdf_parser.h @@ -202,7 +202,7 @@ class CPDF_SimpleParser { public: - CPDF_SimpleParser(FX_LPCBYTE pData, FX_DWORD dwSize); + CPDF_SimpleParser(const uint8_t* pData, FX_DWORD dwSize); CPDF_SimpleParser(FX_BSTR str); @@ -229,9 +229,9 @@ public: } private: - void ParseWord(FX_LPCBYTE& pStart, FX_DWORD& dwSize, int& type); + void ParseWord(const uint8_t*& pStart, FX_DWORD& dwSize, int& type); - FX_LPCBYTE m_pData; + const uint8_t* m_pData; FX_DWORD m_dwSize; @@ -306,7 +306,7 @@ protected: void GetNextWord(); - FX_BOOL IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, FX_LPCBYTE tag, FX_DWORD taglen); + FX_BOOL IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, const uint8_t* tag, FX_DWORD taglen); CFX_ByteString ReadString(); @@ -373,8 +373,8 @@ public: CPDF_Parser(); ~CPDF_Parser(); - FX_DWORD StartParse(FX_LPCSTR filename, FX_BOOL bReParse = FALSE); - FX_DWORD StartParse(FX_LPCWSTR filename, FX_BOOL bReParse = FALSE); + FX_DWORD StartParse(const FX_CHAR* filename, FX_BOOL bReParse = FALSE); + FX_DWORD StartParse(const FX_WCHAR* filename, FX_BOOL bReParse = FALSE); FX_DWORD StartParse(IFX_FileRead* pFile, FX_BOOL bReParse = FALSE, FX_BOOL bOwnFileRead = TRUE); void CloseParser(FX_BOOL bReParse = FALSE); @@ -592,7 +592,7 @@ public: virtual FX_BOOL IsOwner() = 0; - virtual FX_BOOL GetCryptInfo(int& cipher, FX_LPCBYTE& buffer, int& keylen) = 0; + virtual FX_BOOL GetCryptInfo(int& cipher, const uint8_t*& buffer, int& keylen) = 0; virtual FX_BOOL IsMetadataEncrypted() { @@ -619,7 +619,7 @@ public: { return m_bOwner; } - virtual FX_BOOL GetCryptInfo(int& cipher, FX_LPCBYTE& buffer, int& keylen); + virtual FX_BOOL GetCryptInfo(int& cipher, const uint8_t*& buffer, int& keylen); virtual FX_BOOL IsMetadataEncrypted(); virtual CPDF_CryptoHandler* CreateCryptoHandler(); virtual CPDF_StandardSecurityHandler* GetStandardHandler() @@ -628,14 +628,14 @@ public: } void OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, - FX_LPCBYTE user_pass, FX_DWORD user_size, - FX_LPCBYTE owner_pass, FX_DWORD owner_size, FX_DWORD type = PDF_ENCRYPT_CONTENT); + const uint8_t* user_pass, FX_DWORD user_size, + const uint8_t* owner_pass, FX_DWORD owner_size, FX_DWORD type = PDF_ENCRYPT_CONTENT); void OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, - FX_LPCBYTE user_pass, FX_DWORD user_size, FX_DWORD type = PDF_ENCRYPT_CONTENT); + const uint8_t* user_pass, FX_DWORD user_size, FX_DWORD type = PDF_ENCRYPT_CONTENT); - CFX_ByteString GetUserPassword(FX_LPCBYTE owner_pass, FX_DWORD pass_size); - CFX_ByteString GetUserPassword(FX_LPCBYTE owner_pass, FX_DWORD pass_size, int32_t key_len); + CFX_ByteString GetUserPassword(const uint8_t* owner_pass, FX_DWORD pass_size); + CFX_ByteString GetUserPassword(const uint8_t* owner_pass, FX_DWORD pass_size, int32_t key_len); int GetVersion() { return m_Version; @@ -645,8 +645,8 @@ public: return m_Revision; } - int CheckPassword(FX_LPCBYTE password, FX_DWORD pass_size, FX_BOOL bOwner, FX_LPBYTE key); - int CheckPassword(FX_LPCBYTE password, FX_DWORD pass_size, FX_BOOL bOwner, FX_LPBYTE key, int key_len); + int CheckPassword(const uint8_t* password, FX_DWORD pass_size, FX_BOOL bOwner, uint8_t* key); + int CheckPassword(const uint8_t* password, FX_DWORD pass_size, FX_BOOL bOwner, uint8_t* key, int key_len); private: int m_Version; @@ -660,16 +660,16 @@ private: FX_BOOL LoadDict(CPDF_Dictionary* pEncryptDict); FX_BOOL LoadDict(CPDF_Dictionary* pEncryptDict, FX_DWORD type, int& cipher, int& key_len); - FX_BOOL CheckUserPassword(FX_LPCBYTE password, FX_DWORD pass_size, - FX_BOOL bIgnoreEncryptMeta, FX_LPBYTE key, int32_t key_len); + FX_BOOL CheckUserPassword(const uint8_t* password, FX_DWORD pass_size, + FX_BOOL bIgnoreEncryptMeta, uint8_t* key, int32_t key_len); - FX_BOOL CheckOwnerPassword(FX_LPCBYTE password, FX_DWORD pass_size, FX_LPBYTE key, int32_t key_len); - FX_BOOL AES256_CheckPassword(FX_LPCBYTE password, FX_DWORD size, FX_BOOL bOwner, FX_LPBYTE key); - void AES256_SetPassword(CPDF_Dictionary* pEncryptDict, FX_LPCBYTE password, FX_DWORD size, FX_BOOL bOwner, FX_LPCBYTE key); - void AES256_SetPerms(CPDF_Dictionary* pEncryptDict, FX_DWORD permission, FX_BOOL bEncryptMetadata, FX_LPCBYTE key); + FX_BOOL CheckOwnerPassword(const uint8_t* password, FX_DWORD pass_size, uint8_t* key, int32_t key_len); + FX_BOOL AES256_CheckPassword(const uint8_t* password, FX_DWORD size, FX_BOOL bOwner, uint8_t* key); + void AES256_SetPassword(CPDF_Dictionary* pEncryptDict, const uint8_t* password, FX_DWORD size, FX_BOOL bOwner, const uint8_t* key); + void AES256_SetPerms(CPDF_Dictionary* pEncryptDict, FX_DWORD permission, FX_BOOL bEncryptMetadata, const uint8_t* key); void OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, - FX_LPCBYTE user_pass, FX_DWORD user_size, - FX_LPCBYTE owner_pass, FX_DWORD owner_size, FX_BOOL bDefault, FX_DWORD type); + const uint8_t* user_pass, FX_DWORD user_size, + const uint8_t* owner_pass, FX_DWORD owner_size, FX_BOOL bDefault, FX_DWORD type); FX_BOOL CheckSecurity(int32_t key_len); FX_BOOL m_bOwner; @@ -692,17 +692,17 @@ public: virtual FX_DWORD DecryptGetSize(FX_DWORD src_size) = 0; - virtual FX_LPVOID DecryptStart(FX_DWORD objnum, FX_DWORD gennum) = 0; + virtual void* DecryptStart(FX_DWORD objnum, FX_DWORD gennum) = 0; - virtual FX_BOOL DecryptStream(FX_LPVOID context, FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) = 0; + virtual FX_BOOL DecryptStream(void* context, const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) = 0; - virtual FX_BOOL DecryptFinish(FX_LPVOID context, CFX_BinaryBuf& dest_buf) = 0; + virtual FX_BOOL DecryptFinish(void* context, CFX_BinaryBuf& dest_buf) = 0; - virtual FX_DWORD EncryptGetSize(FX_DWORD objnum, FX_DWORD version, FX_LPCBYTE src_buf, FX_DWORD src_size) = 0; + virtual FX_DWORD EncryptGetSize(FX_DWORD objnum, FX_DWORD version, const uint8_t* src_buf, FX_DWORD src_size) = 0; - virtual FX_BOOL EncryptContent(FX_DWORD objnum, FX_DWORD version, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPBYTE dest_buf, FX_DWORD& dest_size) = 0; + virtual FX_BOOL EncryptContent(FX_DWORD objnum, FX_DWORD version, const uint8_t* src_buf, FX_DWORD src_size, + uint8_t* dest_buf, FX_DWORD& dest_size) = 0; void Decrypt(FX_DWORD objnum, FX_DWORD version, CFX_ByteString& str); }; @@ -714,22 +714,22 @@ public: virtual ~CPDF_StandardCryptoHandler(); - FX_BOOL Init(int cipher, FX_LPCBYTE key, int keylen); + FX_BOOL Init(int cipher, const uint8_t* key, int keylen); virtual FX_BOOL Init(CPDF_Dictionary* pEncryptDict, CPDF_SecurityHandler* pSecurityHandler); virtual FX_DWORD DecryptGetSize(FX_DWORD src_size); - virtual FX_LPVOID DecryptStart(FX_DWORD objnum, FX_DWORD gennum); - virtual FX_BOOL DecryptStream(FX_LPVOID context, FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); - virtual FX_BOOL DecryptFinish(FX_LPVOID context, CFX_BinaryBuf& dest_buf); - virtual FX_DWORD EncryptGetSize(FX_DWORD objnum, FX_DWORD version, FX_LPCBYTE src_buf, FX_DWORD src_size); - virtual FX_BOOL EncryptContent(FX_DWORD objnum, FX_DWORD version, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPBYTE dest_buf, FX_DWORD& dest_size); + virtual void* DecryptStart(FX_DWORD objnum, FX_DWORD gennum); + virtual FX_BOOL DecryptStream(void* context, const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + virtual FX_BOOL DecryptFinish(void* context, CFX_BinaryBuf& dest_buf); + virtual FX_DWORD EncryptGetSize(FX_DWORD objnum, FX_DWORD version, const uint8_t* src_buf, FX_DWORD src_size); + virtual FX_BOOL EncryptContent(FX_DWORD objnum, FX_DWORD version, const uint8_t* src_buf, FX_DWORD src_size, + uint8_t* dest_buf, FX_DWORD& dest_size); protected: - virtual void CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, FX_DWORD gennum, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPBYTE dest_buf, FX_DWORD& dest_size); - virtual FX_LPVOID CryptStart(FX_DWORD objnum, FX_DWORD gennum, FX_BOOL bEncrypt); - virtual FX_BOOL CryptStream(FX_LPVOID context, FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt); - virtual FX_BOOL CryptFinish(FX_LPVOID context, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt); + virtual void CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, FX_DWORD gennum, const uint8_t* src_buf, FX_DWORD src_size, + uint8_t* dest_buf, FX_DWORD& dest_size); + virtual void* CryptStart(FX_DWORD objnum, FX_DWORD gennum, FX_BOOL bEncrypt); + virtual FX_BOOL CryptStream(void* context, const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt); + virtual FX_BOOL CryptFinish(void* context, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt); uint8_t m_EncryptKey[32]; @@ -737,7 +737,7 @@ protected: int m_Cipher; - FX_LPBYTE m_pAESContext; + uint8_t* m_pAESContext; }; class CPDF_Point { @@ -760,11 +760,11 @@ CFX_ByteString PDF_NameDecode(FX_BSTR orig); CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig); CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig); CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex = FALSE); -CFX_WideString PDF_DecodeText(FX_LPCBYTE pData, FX_DWORD size, CFX_CharMap* pCharMap = NULL); +CFX_WideString PDF_DecodeText(const uint8_t* pData, FX_DWORD size, CFX_CharMap* pCharMap = NULL); inline CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr, CFX_CharMap* pCharMap = NULL) { - return PDF_DecodeText((FX_LPCBYTE)bstr.c_str(), bstr.GetLength(), pCharMap); + return PDF_DecodeText((const uint8_t*)bstr.c_str(), bstr.GetLength(), pCharMap); } -CFX_ByteString PDF_EncodeText(FX_LPCWSTR pString, int len = -1, CFX_CharMap* pCharMap = NULL); +CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len = -1, CFX_CharMap* pCharMap = NULL); inline CFX_ByteString PDF_EncodeText(const CFX_WideString& str, CFX_CharMap* pCharMap = NULL) { return PDF_EncodeText(str.c_str(), str.GetLength(), pCharMap); } @@ -774,7 +774,7 @@ class CFDF_Document : public CPDF_IndirectObjects public: static CFDF_Document* CreateNewDoc(); static CFDF_Document* ParseFile(IFX_FileRead *pFile, FX_BOOL bOwnFile = FALSE); - static CFDF_Document* ParseMemory(FX_LPCBYTE pData, FX_DWORD size); + static CFDF_Document* ParseMemory(const uint8_t* pData, FX_DWORD size); ~CFDF_Document(); @@ -798,9 +798,9 @@ protected: CFX_WideString FPDF_FileSpec_GetWin32Path(const CPDF_Object* pFileSpec); void FPDF_FileSpec_SetWin32Path(CPDF_Object* pFileSpec, const CFX_WideString& fullpath); -void FlateEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); -FX_DWORD FlateDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); -FX_DWORD RunLengthDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); +void FlateEncode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); +FX_DWORD FlateDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); +FX_DWORD RunLengthDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); class CPDF_NumberTree { public: diff --git a/core/include/fpdfapi/fpdf_resource.h b/core/include/fpdfapi/fpdf_resource.h index 054e90a158..651b894ec2 100644 --- a/core/include/fpdfapi/fpdf_resource.h +++ b/core/include/fpdfapi/fpdf_resource.h @@ -153,7 +153,7 @@ public: return m_Font.GetFace(); } - virtual FX_DWORD GetNextChar(FX_LPCSTR pString, int nStrLen, int& offset) const + virtual FX_DWORD GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const { if (offset < 0 || nStrLen < 1) { return 0; @@ -162,14 +162,14 @@ public: return static_cast<FX_DWORD>(ch); } - virtual int CountChar(FX_LPCSTR pString, int size) const + virtual int CountChar(const FX_CHAR* pString, int size) const { return size; } void AppendChar(CFX_ByteString& str, FX_DWORD charcode) const; - virtual int AppendChar(FX_LPSTR buf, FX_DWORD charcode) const + virtual int AppendChar(FX_CHAR* buf, FX_DWORD charcode) const { *buf = (FX_CHAR)charcode; return 1; @@ -512,9 +512,9 @@ public: return !m_bType1; } - virtual FX_DWORD GetNextChar(FX_LPCSTR pString, int nStrLen, int& offset) const override; - virtual int CountChar(FX_LPCSTR pString, int size) const; - virtual int AppendChar(FX_LPSTR str, FX_DWORD charcode) const; + virtual FX_DWORD GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const override; + virtual int CountChar(const FX_CHAR* pString, int size) const; + virtual int AppendChar(FX_CHAR* str, FX_DWORD charcode) const; virtual int GetCharSize(FX_DWORD charcode) const; int GetCharset() const @@ -522,7 +522,7 @@ public: return m_Charset; } - FX_LPCBYTE GetCIDTransform(FX_WORD CID) const; + const uint8_t* GetCIDTransform(FX_WORD CID) const; virtual FX_BOOL IsVertWriting() const; short GetVertWidth(FX_WORD CID) const; void GetVertOrigin(FX_WORD CID, short& vx, short& vy) const; @@ -622,7 +622,7 @@ public: FX_BOOL SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k) const; - virtual void TranslateImageLine(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf, int pixels, + virtual void TranslateImageLine(uint8_t* dest_buf, const uint8_t* src_buf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; CPDF_Array*& GetArray() @@ -940,7 +940,7 @@ private: CPDF_Document* m_pDocument; CPDF_Dictionary* m_pOC; - CPDF_Dictionary* InitJPEG(FX_LPBYTE pData, FX_DWORD size); + CPDF_Dictionary* InitJPEG(uint8_t* pData, FX_DWORD size); }; #endif // CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ diff --git a/core/include/fpdfapi/fpdf_serial.h b/core/include/fpdfapi/fpdf_serial.h index e4a0aec2e5..ada77a2075 100644 --- a/core/include/fpdfapi/fpdf_serial.h +++ b/core/include/fpdfapi/fpdf_serial.h @@ -26,7 +26,7 @@ class CPDF_ObjArchiveLoader : public CFX_ArchiveLoader { public: - CPDF_ObjArchiveLoader(FX_LPCBYTE pData, FX_DWORD dwSize) : CFX_ArchiveLoader(pData, dwSize), + CPDF_ObjArchiveLoader(const uint8_t* pData, FX_DWORD dwSize) : CFX_ArchiveLoader(pData, dwSize), m_IndirectObjects(NULL) {} friend CPDF_ObjArchiveLoader& operator >> (CPDF_ObjArchiveLoader& ar, CPDF_Object*& pObj); @@ -72,7 +72,7 @@ class CPDF_PageArchiveLoader : public CPDF_ObjArchiveLoader { public: - CPDF_PageArchiveLoader(CPDF_PageObjects* pPageObjs, FX_LPCBYTE pData, FX_DWORD dwSize); + CPDF_PageArchiveLoader(CPDF_PageObjects* pPageObjs, const uint8_t* pData, FX_DWORD dwSize); friend CPDF_PageArchiveLoader& operator >> (CPDF_PageArchiveLoader& ar, CPDF_PageObject*& pObj); @@ -91,7 +91,7 @@ public: protected: void PostProcColor(CPDF_Color& color); - CPDF_Object* AddResource(CPDF_Object* pSrcObj, FX_LPCSTR type); + CPDF_Object* AddResource(CPDF_Object* pSrcObj, const FX_CHAR* type); CPDF_ClipPath m_LastClipPath; @@ -121,9 +121,9 @@ public: void RemoveSecurity(); - FX_BOOL Create(FX_LPCWSTR filename, FX_DWORD flags = 0); + FX_BOOL Create(const FX_WCHAR* filename, FX_DWORD flags = 0); - FX_BOOL Create(FX_LPCSTR filename, FX_DWORD flags = 0); + FX_BOOL Create(const FX_CHAR* filename, FX_DWORD flags = 0); FX_BOOL Create(IFX_StreamWrite* pFile, FX_DWORD flags = 0); @@ -179,7 +179,7 @@ protected: int32_t WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, FX_BOOL bEncrypt = TRUE); int32_t WriteIndirectObjectToStream(const CPDF_Object* pObj); int32_t WriteIndirectObj(FX_DWORD objnum, const CPDF_Object* pObj); - int32_t WriteIndirectObjectToStream(FX_DWORD objnum, FX_LPCBYTE pBuffer, FX_DWORD dwSize); + int32_t WriteIndirectObjectToStream(FX_DWORD objnum, const uint8_t* pBuffer, FX_DWORD dwSize); int32_t AppendObjectNumberToXRef(FX_DWORD objnum); void InitID(FX_BOOL bDefault = TRUE); int32_t WriteStream(const CPDF_Object* pStream, FX_DWORD objnum, CPDF_CryptoHandler* pCrypto); diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h index 13fd41f432..b46579ac88 100644 --- a/core/include/fpdfdoc/fpdf_doc.h +++ b/core/include/fpdfdoc/fpdf_doc.h @@ -727,7 +727,7 @@ public: static FX_BOOL UpdatingAPEnabled(); - static CFX_ByteString GenerateNewResourceName(const CPDF_Dictionary* pResDict, FX_LPCSTR csType, int iMinLen = 2, FX_LPCSTR csPrefix = ""); + static CFX_ByteString GenerateNewResourceName(const CPDF_Dictionary* pResDict, const FX_CHAR* csType, int iMinLen = 2, const FX_CHAR* csPrefix = ""); @@ -739,9 +739,9 @@ public: static CPDF_Font* AddStandardFont(const CPDF_Document* pDocument, CFX_ByteString csFontName); - static CFX_ByteString GetNativeFont(uint8_t iCharSet, FX_LPVOID pLogFont = NULL); + static CFX_ByteString GetNativeFont(uint8_t iCharSet, void* pLogFont = NULL); - static CFX_ByteString GetNativeFont(FX_LPVOID pLogFont = NULL); + static CFX_ByteString GetNativeFont(void* pLogFont = NULL); static uint8_t GetNativeCharSet(); @@ -1543,7 +1543,7 @@ public: CXML_Element* GetRDF() const; protected: - FX_LPVOID m_pData; + void* m_pData; }; class CPDF_ViewerPreferences { diff --git a/core/include/fpdfdoc/fpdf_vt.h b/core/include/fpdfdoc/fpdf_vt.h index fbfeacb755..1fec0e629a 100644 --- a/core/include/fpdfdoc/fpdf_vt.h +++ b/core/include/fpdfdoc/fpdf_vt.h @@ -375,7 +375,7 @@ public: virtual void ResetAll() = 0; - virtual void SetText(FX_LPCWSTR text, int32_t charset = 1, const CPVT_SecProps * pSecProps = NULL, + virtual void SetText(const FX_WCHAR* text, int32_t charset = 1, const CPVT_SecProps * pSecProps = NULL, const CPVT_WordProps * pWordProps = NULL) = 0; virtual CPVT_WordPlace InsertWord(const CPVT_WordPlace & place, FX_WORD word, int32_t charset = 1, @@ -384,7 +384,7 @@ public: virtual CPVT_WordPlace InsertSection(const CPVT_WordPlace & place, const CPVT_SecProps * pSecProps = NULL, const CPVT_WordProps * pWordProps = NULL) = 0; - virtual CPVT_WordPlace InsertText(const CPVT_WordPlace & place, FX_LPCWSTR text, int32_t charset = 1, + virtual CPVT_WordPlace InsertText(const CPVT_WordPlace & place, const FX_WCHAR* text, int32_t charset = 1, const CPVT_SecProps * pSecProps = NULL, const CPVT_WordProps * pWordProps = NULL) = 0; virtual CPVT_WordPlace DeleteWords(const CPVT_WordRange & PlaceRange) = 0; diff --git a/core/include/fxcodec/fx_codec.h b/core/include/fxcodec/fx_codec.h index a16d0d7c5e..75c7480b3d 100644 --- a/core/include/fxcodec/fx_codec.h +++ b/core/include/fxcodec/fx_codec.h @@ -85,11 +85,11 @@ class ICodec_BasicModule public: virtual ~ICodec_BasicModule() {} - virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, + virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) = 0; - virtual FX_BOOL A85Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, + virtual FX_BOOL A85Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) = 0; - virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, + virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc) = 0; }; class ICodec_ScanlineDecoder @@ -102,7 +102,7 @@ public: virtual void DownScale(int dest_width, int dest_height) = 0; - virtual FX_LPBYTE GetScanline(int line) = 0; + virtual uint8_t* GetScanline(int line) = 0; virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) = 0; @@ -123,15 +123,15 @@ class ICodec_FlateModule public: virtual ~ICodec_FlateModule() {} - virtual ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, + virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, int predictor, int Colors, int BitsPerComponent, int Columns) = 0; virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, int predictor, int Colors, int BitsPerComponent, int Columns, - FX_DWORD estimated_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) = 0; + FX_DWORD estimated_size, uint8_t*& dest_buf, FX_DWORD& dest_size) = 0; virtual FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns, - FX_LPBYTE& dest_buf, FX_DWORD& dest_size) = 0; - virtual FX_BOOL Encode(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) = 0; + uint8_t*& dest_buf, FX_DWORD& dest_size) = 0; + virtual FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) = 0; }; class ICodec_FaxModule { @@ -139,12 +139,12 @@ public: virtual ~ICodec_FaxModule() {} - virtual ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, + virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows) = 0; - virtual FX_BOOL Encode(FX_LPCBYTE src_buf, int width, int height, int pitch, - FX_LPBYTE& dest_buf, FX_DWORD& dest_size) = 0; + virtual FX_BOOL Encode(const uint8_t* src_buf, int width, int height, int pitch, + uint8_t*& dest_buf, FX_DWORD& dest_size) = 0; }; class ICodec_JpegModule { @@ -154,21 +154,21 @@ public: virtual void SetPovider(IFX_JpegProvider* pJP) = 0; - virtual ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, + virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, FX_BOOL ColorTransform) = 0; - virtual FX_BOOL LoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int& width, int& height, + virtual FX_BOOL LoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height, int& num_components, int& bits_per_components, FX_BOOL& color_transform, - FX_LPBYTE* icc_buf_ptr = NULL, FX_DWORD* icc_length = NULL) = 0; + uint8_t** icc_buf_ptr = NULL, FX_DWORD* icc_length = NULL) = 0; - virtual FX_BOOL Encode(const class CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_STRSIZE& dest_size, int quality = 75, - FX_LPCBYTE icc_buf = NULL, FX_DWORD icc_length = 0) = 0; + virtual FX_BOOL Encode(const class CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality = 75, + const uint8_t* icc_buf = NULL, FX_DWORD icc_length = 0) = 0; virtual void* Start() = 0; virtual void Finish(void* pContext) = 0; - virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size) = 0; + virtual void Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size) = 0; virtual int ReadHeader(void* pContext, int* width, int* height, int* nComps) = 0; @@ -176,10 +176,10 @@ public: virtual int StartScanline(void* pContext, int down_scale) = 0; - virtual FX_BOOL ReadScanline(void* pContext, FX_LPBYTE dest_buf) = 0; + virtual FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf) = 0; - virtual FX_DWORD GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr = NULL) = 0; + virtual FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr = NULL) = 0; }; class ICodec_JpxModule { @@ -187,15 +187,15 @@ public: virtual ~ICodec_JpxModule() {} - virtual FX_LPVOID CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_BOOL useColorSpace = FALSE) = 0; + virtual void* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL useColorSpace = FALSE) = 0; - virtual void GetImageInfo(FX_LPVOID ctx, FX_DWORD& width, FX_DWORD& height, + virtual void GetImageInfo(void* ctx, FX_DWORD& width, FX_DWORD& height, FX_DWORD& codestream_nComps, FX_DWORD& output_nComps) = 0; - virtual FX_BOOL Decode(FX_LPVOID ctx, FX_LPBYTE dest_data, int pitch, - FX_BOOL bTranslateColor, FX_LPBYTE offsets) = 0; + virtual FX_BOOL Decode(void* ctx, uint8_t* dest_data, int pitch, + FX_BOOL bTranslateColor, uint8_t* offsets) = 0; - virtual void DestroyDecoder(FX_LPVOID ctx) = 0; + virtual void DestroyDecoder(void* ctx) = 0; }; class ICodec_Jbig2Module { @@ -203,18 +203,18 @@ public: virtual ~ICodec_Jbig2Module() {} - virtual FX_BOOL Decode(FX_DWORD width, FX_DWORD height, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPCBYTE global_data, FX_DWORD global_size, FX_LPBYTE dest_buf, FX_DWORD dest_pitch) = 0; + virtual FX_BOOL Decode(FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, + const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch) = 0; virtual FX_BOOL Decode(IFX_FileRead* file_ptr, FX_DWORD& width, FX_DWORD& height, - FX_DWORD& pitch, FX_LPBYTE& dest_buf) = 0; + FX_DWORD& pitch, uint8_t*& dest_buf) = 0; virtual void* CreateJbig2Context() = 0; - virtual FXCODEC_STATUS StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPCBYTE global_data, FX_DWORD global_size, FX_LPBYTE dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause) = 0; + virtual FXCODEC_STATUS StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, + const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause) = 0; virtual FXCODEC_STATUS StartDecode(void* pJbig2Context, IFX_FileRead* file_ptr, - FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, FX_LPBYTE& dest_buf, IFX_Pause* pPause) = 0; + FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf, IFX_Pause* pPause) = 0; virtual FXCODEC_STATUS ContinueDecode(void* pJbig2Content, IFX_Pause* pPause) = 0; virtual void DestroyJbig2Context(void* pJbig2Content) = 0; }; @@ -246,18 +246,18 @@ public: IccCS ColorSpace; FX_DWORD dwProfileType; FX_DWORD dwFormat; - FX_LPBYTE pProfileData; + uint8_t* pProfileData; FX_DWORD dwProfileSize; double Gamma; } IccParam; virtual ~ICodec_IccModule() {} - virtual IccCS GetProfileCS(FX_LPCBYTE pProfileData, unsigned int dwProfileSize) = 0; + virtual IccCS GetProfileCS(const uint8_t* pProfileData, unsigned int dwProfileSize) = 0; virtual IccCS GetProfileCS(IFX_FileRead* pFile) = 0; - virtual FX_LPVOID CreateTransform(ICodec_IccModule::IccParam* pInputParam, + virtual void* CreateTransform(ICodec_IccModule::IccParam* pInputParam, ICodec_IccModule::IccParam* pOutputParam, ICodec_IccModule::IccParam* pProofParam = NULL, FX_DWORD dwIntent = Icc_INTENT_PERCEPTUAL, @@ -267,24 +267,24 @@ public: ) = 0; - virtual FX_LPVOID CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent = 0, + virtual void* CreateTransform_sRGB(const uint8_t* pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent = 0, FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT) = 0; - virtual FX_LPVOID CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, - FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent = 0, + virtual void* CreateTransform_CMYK(const uint8_t* pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, + const uint8_t* pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent = 0, FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT ) = 0; - virtual void DestroyTransform(FX_LPVOID pTransform) = 0; + virtual void DestroyTransform(void* pTransform) = 0; - virtual void Translate(FX_LPVOID pTransform, FX_FLOAT* pSrcValues, FX_FLOAT* pDestValues) = 0; + virtual void Translate(void* pTransform, FX_FLOAT* pSrcValues, FX_FLOAT* pDestValues) = 0; - virtual void TranslateScanline(FX_LPVOID pTransform, FX_LPBYTE pDest, FX_LPCBYTE pSrc, int pixels) = 0; + virtual void TranslateScanline(void* pTransform, uint8_t* pDest, const uint8_t* pSrc, int pixels) = 0; virtual void SetComponents(FX_DWORD nComponents) = 0; }; void AdobeCMYK_to_sRGB(FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B); void AdobeCMYK_to_sRGB1(uint8_t c, uint8_t m, uint8_t y, uint8_t k, uint8_t& R, uint8_t& G, uint8_t& B); -FX_BOOL MD5ComputeID(FX_LPCVOID buf, FX_DWORD dwSize, uint8_t ID[16]); +FX_BOOL MD5ComputeID(const void* buf, FX_DWORD dwSize, uint8_t ID[16]); #endif // CORE_INCLUDE_FXCODEC_FX_CODEC_H_ diff --git a/core/include/fxcodec/fx_codec_provider.h b/core/include/fxcodec/fx_codec_provider.h index 6d15473ef7..20fd0c5357 100644 --- a/core/include/fxcodec/fx_codec_provider.h +++ b/core/include/fxcodec/fx_codec_provider.h @@ -12,7 +12,7 @@ class IFX_JpegProvider public: virtual void Release() = 0; - virtual void* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, FX_BOOL ColorTransform) = 0; + virtual void* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, FX_BOOL ColorTransform) = 0; virtual void DestroyDecoder(void* pDecoder) = 0; @@ -21,23 +21,23 @@ public: virtual FX_BOOL Rewind(void* pDecoder) = 0; - virtual FX_LPBYTE GetNextLine(void* pDecoder) = 0; + virtual uint8_t* GetNextLine(void* pDecoder) = 0; virtual FX_DWORD GetSrcOffset(void* pDecoder) = 0; - virtual FX_BOOL LoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int& width, int& height, + virtual FX_BOOL LoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height, int& num_components, int& bits_per_components, FX_BOOL& color_transform, - FX_LPBYTE* icc_buf_ptr = NULL, FX_DWORD* icc_length = NULL) = 0; + uint8_t** icc_buf_ptr = NULL, FX_DWORD* icc_length = NULL) = 0; - virtual FX_BOOL Encode(const class CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_STRSIZE& dest_size, int quality = 75, - FX_LPCBYTE icc_buf = NULL, FX_DWORD icc_length = 0) = 0; + virtual FX_BOOL Encode(const class CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality = 75, + const uint8_t* icc_buf = NULL, FX_DWORD icc_length = 0) = 0; virtual void* Start() = 0; virtual void Finish(void* pContext) = 0; - virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size) = 0; + virtual void Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size) = 0; virtual int ReadHeader(void* pContext, int* width, int* height, int* nComps) = 0; @@ -45,10 +45,10 @@ public: virtual int StartScanline(void* pContext, int down_scale) = 0; - virtual FX_BOOL ReadScanline(void* pContext, FX_LPBYTE dest_buf) = 0; + virtual FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf) = 0; - virtual FX_DWORD GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr = NULL) = 0; + virtual FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr = NULL) = 0; protected: ~IFX_JpegProvider() { } diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h index 3af8a60766..004b01875b 100644 --- a/core/include/fxcrt/fx_basic.h +++ b/core/include/fxcrt/fx_basic.h @@ -66,7 +66,7 @@ public: void Delete(int start_index, int count); - FX_LPBYTE GetBuffer() const + uint8_t* GetBuffer() const { return m_pBuffer; } @@ -83,7 +83,7 @@ protected: FX_STRSIZE m_AllocStep; - FX_LPBYTE m_pBuffer; + uint8_t* m_pBuffer; FX_STRSIZE m_DataSize; @@ -121,7 +121,7 @@ class CFX_WideTextBuf : public CFX_BinaryBuf { public: - void operator = (FX_LPCWSTR lpsz); + void operator = (const FX_WCHAR* lpsz); void operator = (FX_WSTR str); @@ -131,7 +131,7 @@ public: CFX_WideTextBuf& operator << (double f); - CFX_WideTextBuf& operator << (FX_LPCWSTR lpsz); + CFX_WideTextBuf& operator << (const FX_WCHAR* lpsz); CFX_WideTextBuf& operator << (FX_WSTR str); CFX_WideTextBuf& operator << (const CFX_WideString &str); @@ -143,9 +143,9 @@ public: return m_DataSize / sizeof(FX_WCHAR); } - FX_LPWSTR GetBuffer() const + FX_WCHAR* GetBuffer() const { - return (FX_LPWSTR)m_pBuffer; + return (FX_WCHAR*)m_pBuffer; } void Delete(int start_index, int count) @@ -172,7 +172,7 @@ public: CFX_ArchiveSaver& operator << (FX_BSTR bstr); - CFX_ArchiveSaver& operator << (FX_LPCWSTR bstr); + CFX_ArchiveSaver& operator << (const FX_WCHAR* bstr); CFX_ArchiveSaver& operator << (const CFX_WideString& wstr); @@ -183,7 +183,7 @@ public: return m_SavingBuf.GetSize(); } - FX_LPCBYTE GetBuffer() + const uint8_t* GetBuffer() { return m_SavingBuf.GetBuffer(); } @@ -202,7 +202,7 @@ class CFX_ArchiveLoader { public: - CFX_ArchiveLoader(FX_LPCBYTE pData, FX_DWORD dwSize); + CFX_ArchiveLoader(const uint8_t* pData, FX_DWORD dwSize); CFX_ArchiveLoader& operator >> (uint8_t& i); @@ -225,7 +225,7 @@ protected: FX_DWORD m_LoadingPos; - FX_LPCBYTE m_pLoadingBuf; + const uint8_t* m_pLoadingBuf; FX_DWORD m_LoadingSize; }; @@ -256,7 +256,7 @@ protected: FX_STRSIZE m_BufSize; - FX_LPBYTE m_pBuffer; + uint8_t* m_pBuffer; FX_STRSIZE m_Length; }; @@ -269,9 +269,9 @@ public: FX_BOOL AttachFile(IFX_StreamWrite *pFile, FX_BOOL bTakeover = FALSE); - FX_BOOL AttachFile(FX_LPCWSTR filename); + FX_BOOL AttachFile(const FX_WCHAR* filename); - FX_BOOL AttachFile(FX_LPCSTR filename); + FX_BOOL AttachFile(const FX_CHAR* filename); private: virtual FX_BOOL DoWork(const void* pBuf, size_t size); @@ -365,7 +365,7 @@ protected: FX_BOOL Copy(const CFX_BasicArray& src); - FX_LPBYTE InsertSpaceAt(int nIndex, int nCount); + uint8_t* InsertSpaceAt(int nIndex, int nCount); FX_BOOL RemoveAt(int nIndex, int nCount); @@ -374,7 +374,7 @@ protected: const void* GetDataPtr(int index) const; protected: - FX_LPBYTE m_pData; + uint8_t* m_pData; int m_nSize; @@ -713,7 +713,7 @@ private: void* m_pIndex; void** GetIndex(int seg_index) const; void* IterateIndex(int level, int& start, void** pIndex, FX_BOOL (*callback)(void* param, void* pData), void* param) const; - void* IterateSegment(FX_LPCBYTE pSegment, int count, FX_BOOL (*callback)(void* param, void* pData), void* param) const; + void* IterateSegment(const uint8_t* pSegment, int count, FX_BOOL (*callback)(void* param, void* pData), void* param) const; }; template <class ElementType> class CFX_SegmentedArray : public CFX_BaseSegmentedArray @@ -858,7 +858,7 @@ public: FX_BOOL Lookup(KeyType key, ValueType& rValue) const { - FX_LPVOID pValue = NULL; + void* pValue = NULL; if (!CFX_MapPtrToPtr::Lookup((void*)(uintptr_t)key, pValue)) { return FALSE; } @@ -954,7 +954,7 @@ public: void GetNextAssoc(FX_POSITION& rNextPosition, CFX_ByteString& rKey, void*& rValue) const; - FX_LPVOID GetNextValue(FX_POSITION& rNextPosition) const; + void* GetNextValue(FX_POSITION& rNextPosition) const; FX_DWORD GetHashTableSize() const { @@ -1000,7 +1000,7 @@ public: void GetNextAssoc(FX_POSITION& rNextPosition, CFX_ByteString& rKey, void*& rValue) const; - FX_LPVOID GetNextValue(FX_POSITION& rNextPosition) const; + void* GetNextValue(FX_POSITION& rNextPosition) const; FX_BOOL Lookup(FX_BSTR key, void*& rValue) const; @@ -1115,14 +1115,14 @@ public: ~CFX_PtrList(); }; -typedef void (*PD_CALLBACK_FREEDATA)(FX_LPVOID pData); +typedef void (*PD_CALLBACK_FREEDATA)(void* pData); struct FX_PRIVATEDATA { void FreeData(); - FX_LPVOID m_pModuleId; + void* m_pModuleId; - FX_LPVOID m_pData; + void* m_pData; PD_CALLBACK_FREEDATA m_pCallback; @@ -1136,13 +1136,13 @@ public: void ClearAll(); - void SetPrivateData(FX_LPVOID module_id, FX_LPVOID pData, PD_CALLBACK_FREEDATA callback); + void SetPrivateData(void* module_id, void* pData, PD_CALLBACK_FREEDATA callback); - void SetPrivateObj(FX_LPVOID module_id, CFX_DestructObject* pObj); + void SetPrivateObj(void* module_id, CFX_DestructObject* pObj); - FX_LPVOID GetPrivateData(FX_LPVOID module_id); + void* GetPrivateData(void* module_id); - FX_BOOL LookupPrivateData(FX_LPVOID module_id, FX_LPVOID &pData) const + FX_BOOL LookupPrivateData(void* module_id, void* &pData) const { if (!module_id) { return FALSE; @@ -1157,18 +1157,18 @@ public: return FALSE; } - FX_BOOL RemovePrivateData(FX_LPVOID module_id); + FX_BOOL RemovePrivateData(void* module_id); protected: CFX_ArrayTemplate<FX_PRIVATEDATA> m_DataList; - void AddData(FX_LPVOID module_id, FX_LPVOID pData, PD_CALLBACK_FREEDATA callback, FX_BOOL bSelfDestruct); + void AddData(void* module_id, void* pData, PD_CALLBACK_FREEDATA callback, FX_BOOL bSelfDestruct); }; class CFX_BitStream { public: - void Init(FX_LPCBYTE pData, FX_DWORD dwSize); + void Init(const uint8_t* pData, FX_DWORD dwSize); FX_DWORD GetBits(FX_DWORD nBits); @@ -1195,7 +1195,7 @@ protected: FX_DWORD m_BitSize; - FX_LPCBYTE m_pData; + const uint8_t* m_pData; }; template <class ObjClass> class CFX_CountRef { @@ -1356,13 +1356,13 @@ public: return m_SrcPos; } - void FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + void FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); void FilterFinish(CFX_BinaryBuf& dest_buf); protected: CFX_DataFilter(); - virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) = 0; + virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) = 0; virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) = 0; void ReportEOF(FX_DWORD left_input); @@ -1422,7 +1422,7 @@ protected: int32_t start; int32_t count; - FX_LPBYTE data; + uint8_t* data; }; public: @@ -1463,7 +1463,7 @@ public: } } - FX_LPBYTE GetAt(int32_t nIndex) + uint8_t* GetAt(int32_t nIndex) { if (nIndex < 0) { return NULL; @@ -1540,7 +1540,7 @@ public: T2& operator [] (int32_t nIndex) { - FX_LPBYTE data = m_Data.GetAt(nIndex); + uint8_t* data = m_Data.GetAt(nIndex); FXSYS_assert(data != NULL); return (T2&)(*(volatile T2*)data); } diff --git a/core/include/fxcrt/fx_ext.h b/core/include/fxcrt/fx_ext.h index 60cc259ff8..4e1525a1a0 100644 --- a/core/include/fxcrt/fx_ext.h +++ b/core/include/fxcrt/fx_ext.h @@ -19,11 +19,11 @@ extern "C" { FX_FLOAT FXSYS_tan(FX_FLOAT a); FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x); -FX_FLOAT FXSYS_strtof(FX_LPCSTR pcsStr, int32_t iLength = -1, int32_t *pUsedLen = NULL); -FX_FLOAT FXSYS_wcstof(FX_LPCWSTR pwsStr, int32_t iLength = -1, int32_t *pUsedLen = NULL); -FX_LPWSTR FXSYS_wcsncpy(FX_LPWSTR dstStr, FX_LPCWSTR srcStr, size_t count); -int32_t FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count); -int32_t FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count); +FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr, int32_t iLength = -1, int32_t *pUsedLen = NULL); +FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, int32_t iLength = -1, int32_t *pUsedLen = NULL); +FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr, const FX_WCHAR* srcStr, size_t count); +int32_t FXSYS_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count); +int32_t FXSYS_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count); inline FX_BOOL FXSYS_islower(int32_t ch) { @@ -42,8 +42,8 @@ inline int32_t FXSYS_toupper(int32_t ch) return ch < 'a' || ch > 'z' ? ch : (ch - 0x20); } -FX_DWORD FX_HashCode_String_GetA(FX_LPCSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE); -FX_DWORD FX_HashCode_String_GetW(FX_LPCWSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE); +FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE); +FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE); #ifdef __cplusplus } @@ -52,17 +52,17 @@ FX_DWORD FX_HashCode_String_GetW(FX_LPCWSTR pStr, int32_t iLength, FX_BOOL bIgno extern "C" { #endif -FX_LPVOID FX_Random_MT_Start(FX_DWORD dwSeed); +void* FX_Random_MT_Start(FX_DWORD dwSeed); -FX_DWORD FX_Random_MT_Generate(FX_LPVOID pContext); +FX_DWORD FX_Random_MT_Generate(void* pContext); -void FX_Random_MT_Close(FX_LPVOID pContext); +void FX_Random_MT_Close(void* pContext); -void FX_Random_GenerateBase(FX_LPDWORD pBuffer, int32_t iCount); +void FX_Random_GenerateBase(FX_DWORD* pBuffer, int32_t iCount); -void FX_Random_GenerateMT(FX_LPDWORD pBuffer, int32_t iCount); +void FX_Random_GenerateMT(FX_DWORD* pBuffer, int32_t iCount); -void FX_Random_GenerateCrypto(FX_LPDWORD pBuffer, int32_t iCount); +void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount); #ifdef __cplusplus } #endif diff --git a/core/include/fxcrt/fx_memory.h b/core/include/fxcrt/fx_memory.h index c6a7d486f1..93403302a1 100644 --- a/core/include/fxcrt/fx_memory.h +++ b/core/include/fxcrt/fx_memory.h @@ -89,14 +89,14 @@ public: m_TrunkSize = trunk_size; } - void* AllocDebug(size_t size, FX_LPCSTR file, int line) + void* AllocDebug(size_t size, const FX_CHAR* file, int line) { return Alloc(size); } void* Alloc(size_t size); - void* ReallocDebug(void* p, size_t new_size, FX_LPCSTR file, int line) + void* ReallocDebug(void* p, size_t new_size, const FX_CHAR* file, int line) { return NULL; } diff --git a/core/include/fxcrt/fx_stream.h b/core/include/fxcrt/fx_stream.h index a07fd6dc3a..44f911d150 100644 --- a/core/include/fxcrt/fx_stream.h +++ b/core/include/fxcrt/fx_stream.h @@ -10,14 +10,14 @@ #include "fx_memory.h" #include "fx_string.h" -void* FX_OpenFolder(FX_LPCSTR path); -void* FX_OpenFolder(FX_LPCWSTR path); +void* FX_OpenFolder(const FX_CHAR* path); +void* FX_OpenFolder(const FX_WCHAR* path); FX_BOOL FX_GetNextFile(void* handle, CFX_ByteString& filename, FX_BOOL& bFolder); FX_BOOL FX_GetNextFile(void* handle, CFX_WideString& filename, FX_BOOL& bFolder); void FX_CloseFolder(void* handle); FX_WCHAR FX_GetFolderSeparator(); typedef struct FX_HFILE_ { - FX_LPVOID pData; + void* pData; }* FX_HFILE; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ #define FX_FILESIZE int32_t @@ -88,8 +88,8 @@ public: return WriteBlock(pData, GetSize(), size); } }; -IFX_FileWrite* FX_CreateFileWrite(FX_LPCSTR filename); -IFX_FileWrite* FX_CreateFileWrite(FX_LPCWSTR filename); +IFX_FileWrite* FX_CreateFileWrite(const FX_CHAR* filename); +IFX_FileWrite* FX_CreateFileWrite(const FX_WCHAR* filename); class IFX_StreamRead { public: @@ -134,8 +134,8 @@ public: return 0; } }; -IFX_FileRead* FX_CreateFileRead(FX_LPCSTR filename); -IFX_FileRead* FX_CreateFileRead(FX_LPCWSTR filename); +IFX_FileRead* FX_CreateFileRead(const FX_CHAR* filename); +IFX_FileRead* FX_CreateFileRead(const FX_WCHAR* filename); class IFX_FileStream : public IFX_FileRead, public IFX_FileWrite { public: @@ -162,8 +162,8 @@ public: virtual FX_BOOL Flush() = 0; }; -IFX_FileStream* FX_CreateFileStream(FX_LPCSTR filename, FX_DWORD dwModes); -IFX_FileStream* FX_CreateFileStream(FX_LPCWSTR filename, FX_DWORD dwModes); +IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, FX_DWORD dwModes); +IFX_FileStream* FX_CreateFileStream(const FX_WCHAR* filename, FX_DWORD dwModes); class IFX_MemoryStream : public IFX_FileStream { public: @@ -172,13 +172,13 @@ public: virtual void EstimateSize(size_t nInitSize, size_t nGrowSize) = 0; - virtual FX_LPBYTE GetBuffer() const = 0; + virtual uint8_t* GetBuffer() const = 0; - virtual void AttachBuffer(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE) = 0; + virtual void AttachBuffer(uint8_t* pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE) = 0; virtual void DetachBuffer() = 0; }; -IFX_MemoryStream* FX_CreateMemoryStream(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE); +IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE); IFX_MemoryStream* FX_CreateMemoryStream(FX_BOOL bConsecutive = FALSE); class IFX_BufferRead : public IFX_StreamRead { @@ -194,7 +194,7 @@ public: virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) = 0; - virtual FX_LPCBYTE GetBlockBuffer() = 0; + virtual const uint8_t* GetBlockBuffer() = 0; virtual size_t GetBlockSize() = 0; diff --git a/core/include/fxcrt/fx_string.h b/core/include/fxcrt/fx_string.h index 8fc9d79ebb..5923ffdf2d 100644 --- a/core/include/fxcrt/fx_string.h +++ b/core/include/fxcrt/fx_string.h @@ -31,15 +31,15 @@ public: m_Length = 0; } - CFX_ByteStringC(FX_LPCBYTE ptr, FX_STRSIZE size) + CFX_ByteStringC(const uint8_t* ptr, FX_STRSIZE size) { m_Ptr = ptr; m_Length = size; } - CFX_ByteStringC(FX_LPCSTR ptr) + CFX_ByteStringC(const FX_CHAR* ptr) { - m_Ptr = (FX_LPCBYTE)ptr; + m_Ptr = (const uint8_t*)ptr; m_Length = ptr ? FXSYS_strlen(ptr) : 0; } @@ -52,13 +52,13 @@ public: // TODO(tsepez): Mark single-argument string constructors as explicit. CFX_ByteStringC(FX_CHAR& ch) { - m_Ptr = (FX_LPCBYTE)&ch; + m_Ptr = (const uint8_t*)&ch; m_Length = 1; } - CFX_ByteStringC(FX_LPCSTR ptr, FX_STRSIZE len) + CFX_ByteStringC(const FX_CHAR* ptr, FX_STRSIZE len) { - m_Ptr = (FX_LPCBYTE)ptr; + m_Ptr = (const uint8_t*)ptr; m_Length = (len == -1) ? FXSYS_strlen(ptr) : len; } @@ -70,9 +70,9 @@ public: CFX_ByteStringC(const CFX_ByteString& src); - CFX_ByteStringC& operator = (FX_LPCSTR src) + CFX_ByteStringC& operator = (const FX_CHAR* src) { - m_Ptr = (FX_LPCBYTE)src; + m_Ptr = (const uint8_t*)src; m_Length = m_Ptr ? FXSYS_strlen(src) : 0; return *this; } @@ -101,14 +101,14 @@ public: FX_DWORD GetID(FX_STRSIZE start_pos = 0) const; - FX_LPCBYTE GetPtr() const + const uint8_t* GetPtr() const { return m_Ptr; } - FX_LPCSTR GetCStr() const + const FX_CHAR* GetCStr() const { - return (FX_LPCSTR)m_Ptr; + return (const FX_CHAR*)m_Ptr; } FX_STRSIZE GetLength() const @@ -152,7 +152,7 @@ public: } protected: - FX_LPCBYTE m_Ptr; + const uint8_t* m_Ptr; FX_STRSIZE m_Length; private: @@ -190,36 +190,36 @@ public: } CFX_ByteString(char ch); - CFX_ByteString(FX_LPCSTR ptr) + CFX_ByteString(const FX_CHAR* ptr) : CFX_ByteString(ptr, ptr ? FXSYS_strlen(ptr) : 0) { } - CFX_ByteString(FX_LPCSTR ptr, FX_STRSIZE len); - CFX_ByteString(FX_LPCBYTE ptr, FX_STRSIZE len); + CFX_ByteString(const FX_CHAR* ptr, FX_STRSIZE len); + CFX_ByteString(const uint8_t* ptr, FX_STRSIZE len); CFX_ByteString(FX_BSTR bstrc); CFX_ByteString(FX_BSTR bstrc1, FX_BSTR bstrc2); ~CFX_ByteString(); - static CFX_ByteString FromUnicode(FX_LPCWSTR ptr, FX_STRSIZE len = -1); + static CFX_ByteString FromUnicode(const FX_WCHAR* ptr, FX_STRSIZE len = -1); static CFX_ByteString FromUnicode(const CFX_WideString& str); // Explicit conversion to raw string - FX_LPCSTR c_str() const + const FX_CHAR* c_str() const { return m_pData ? m_pData->m_String : ""; } // Implicit conversion to C-style string -- deprecated - operator FX_LPCSTR() const + operator const FX_CHAR*() const { return m_pData ? m_pData->m_String : ""; } - operator FX_LPCBYTE() const + operator const uint8_t*() const { - return m_pData ? (FX_LPCBYTE)m_pData->m_String : NULL; + return m_pData ? (const uint8_t*)m_pData->m_String : NULL; } FX_STRSIZE GetLength() const @@ -261,7 +261,7 @@ public: void Empty(); - const CFX_ByteString& operator = (FX_LPCSTR str); + const CFX_ByteString& operator = (const FX_CHAR* str); const CFX_ByteString& operator = (FX_BSTR bstrc); @@ -269,11 +269,11 @@ public: const CFX_ByteString& operator = (const CFX_BinaryBuf& buf); - void Load(FX_LPCBYTE str, FX_STRSIZE len); + void Load(const uint8_t* str, FX_STRSIZE len); const CFX_ByteString& operator += (FX_CHAR ch); - const CFX_ByteString& operator += (FX_LPCSTR str); + const CFX_ByteString& operator += (const FX_CHAR* str); const CFX_ByteString& operator += (const CFX_ByteString& str); @@ -296,14 +296,14 @@ public: FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1); - void Format(FX_LPCSTR lpszFormat, ... ); + void Format(const FX_CHAR* lpszFormat, ... ); - void FormatV(FX_LPCSTR lpszFormat, va_list argList); + void FormatV(const FX_CHAR* lpszFormat, va_list argList); void Reserve(FX_STRSIZE len); - FX_LPSTR GetBuffer(FX_STRSIZE len); + FX_CHAR* GetBuffer(FX_STRSIZE len); void ReleaseBuffer(FX_STRSIZE len = -1); @@ -384,9 +384,9 @@ protected: }; void AllocCopy(CFX_ByteString& dest, FX_STRSIZE nCopyLen, FX_STRSIZE nCopyIndex) const; - void AssignCopy(FX_STRSIZE nSrcLen, FX_LPCSTR lpszSrcData); - void ConcatCopy(FX_STRSIZE nSrc1Len, FX_LPCSTR lpszSrc1Data, FX_STRSIZE nSrc2Len, FX_LPCSTR lpszSrc2Data); - void ConcatInPlace(FX_STRSIZE nSrcLen, FX_LPCSTR lpszSrcData); + void AssignCopy(FX_STRSIZE nSrcLen, const FX_CHAR* lpszSrcData); + void ConcatCopy(FX_STRSIZE nSrc1Len, const FX_CHAR* lpszSrc1Data, FX_STRSIZE nSrc2Len, const FX_CHAR* lpszSrc2Data); + void ConcatInPlace(FX_STRSIZE nSrcLen, const FX_CHAR* lpszSrcData); void CopyBeforeWrite(); void AllocBeforeWrite(FX_STRSIZE nLen); @@ -395,12 +395,12 @@ protected: }; inline CFX_ByteStringC::CFX_ByteStringC(const CFX_ByteString& src) { - m_Ptr = (FX_LPCBYTE)src; + m_Ptr = (const uint8_t*)src; m_Length = src.GetLength(); } inline CFX_ByteStringC& CFX_ByteStringC::operator = (const CFX_ByteString& src) { - m_Ptr = (FX_LPCBYTE)src; + m_Ptr = (const uint8_t*)src; m_Length = src.GetLength(); return *this; } @@ -422,11 +422,11 @@ inline CFX_ByteString operator + (FX_BSTR str1, FX_BSTR str2) { return CFX_ByteString(str1, str2); } -inline CFX_ByteString operator + (FX_BSTR str1, FX_LPCSTR str2) +inline CFX_ByteString operator + (FX_BSTR str1, const FX_CHAR* str2) { return CFX_ByteString(str1, str2); } -inline CFX_ByteString operator + (FX_LPCSTR str1, FX_BSTR str2) +inline CFX_ByteString operator + (const FX_CHAR* str1, FX_BSTR str2) { return CFX_ByteString(str1, str2); } @@ -450,11 +450,11 @@ inline CFX_ByteString operator + (FX_CHAR ch, const CFX_ByteString& str2) { return CFX_ByteString(ch, str2); } -inline CFX_ByteString operator + (const CFX_ByteString& str1, FX_LPCSTR str2) +inline CFX_ByteString operator + (const CFX_ByteString& str1, const FX_CHAR* str2) { return CFX_ByteString(str1, str2); } -inline CFX_ByteString operator + (FX_LPCSTR str1, const CFX_ByteString& str2) +inline CFX_ByteString operator + (const FX_CHAR* str1, const CFX_ByteString& str2) { return CFX_ByteString(str1, str2); } @@ -477,7 +477,7 @@ public: m_Length = 0; } - CFX_WideStringC(FX_LPCWSTR ptr) + CFX_WideStringC(const FX_WCHAR* ptr) { m_Ptr = ptr; m_Length = ptr ? FXSYS_wcslen(ptr) : 0; @@ -489,7 +489,7 @@ public: m_Length = 1; } - CFX_WideStringC(FX_LPCWSTR ptr, FX_STRSIZE len) + CFX_WideStringC(const FX_WCHAR* ptr, FX_STRSIZE len) { m_Ptr = ptr; m_Length = (len == -1) ? FXSYS_wcslen(ptr) : len; @@ -503,7 +503,7 @@ public: CFX_WideStringC(const CFX_WideString& src); - CFX_WideStringC& operator = (FX_LPCWSTR src) + CFX_WideStringC& operator = (const FX_WCHAR* src) { m_Ptr = src; m_Length = FXSYS_wcslen(src); @@ -532,7 +532,7 @@ public: return !(*this == str); } - FX_LPCWSTR GetPtr() const + const FX_WCHAR* GetPtr() const { return m_Ptr; } @@ -600,7 +600,7 @@ public: } protected: - FX_LPCWSTR m_Ptr; + const FX_WCHAR* m_Ptr; FX_STRSIZE m_Length; private: @@ -636,10 +636,10 @@ public: other.m_pData = nullptr; } - CFX_WideString(FX_LPCWSTR ptr) + CFX_WideString(const FX_WCHAR* ptr) : CFX_WideString(ptr, ptr ? FXSYS_wcslen(ptr) : 0) { } - CFX_WideString(FX_LPCWSTR ptr, FX_STRSIZE len); + CFX_WideString(const FX_WCHAR* ptr, FX_STRSIZE len); CFX_WideString(FX_WCHAR ch); @@ -658,13 +658,13 @@ public: static FX_STRSIZE WStringLength(const unsigned short* str); // Explicit conversion to raw string - FX_LPCWSTR c_str() const + const FX_WCHAR* c_str() const { return m_pData ? m_pData->m_String : L""; } // Implicit conversion to C-style wide string -- deprecated - operator FX_LPCWSTR() const + operator const FX_WCHAR*() const { return m_pData ? m_pData->m_String : L""; } @@ -682,13 +682,13 @@ public: return m_pData ? m_pData->m_nDataLength : 0; } - const CFX_WideString& operator = (FX_LPCWSTR str); + const CFX_WideString& operator = (const FX_WCHAR* str); const CFX_WideString& operator =(const CFX_WideString& stringSrc); const CFX_WideString& operator =(const CFX_WideStringC& stringSrc); - const CFX_WideString& operator += (FX_LPCWSTR str); + const CFX_WideString& operator += (const FX_WCHAR* str); const CFX_WideString& operator += (FX_WCHAR ch); @@ -725,11 +725,11 @@ public: void SetAt(FX_STRSIZE nIndex, FX_WCHAR ch); - int Compare(FX_LPCWSTR str) const; + int Compare(const FX_WCHAR* str) const; int Compare(const CFX_WideString& str) const; - int CompareNoCase(FX_LPCWSTR str) const; + int CompareNoCase(const FX_WCHAR* str) const; bool Equal(const wchar_t* ptr) const; bool Equal(const CFX_WideStringC& str) const; @@ -747,9 +747,9 @@ public: FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1); - void Format(FX_LPCWSTR lpszFormat, ... ); + void Format(const FX_WCHAR* lpszFormat, ... ); - void FormatV(FX_LPCWSTR lpszFormat, va_list argList); + void FormatV(const FX_WCHAR* lpszFormat, va_list argList); void MakeLower(); @@ -759,17 +759,17 @@ public: void TrimRight(FX_WCHAR chTarget); - void TrimRight(FX_LPCWSTR lpszTargets); + void TrimRight(const FX_WCHAR* lpszTargets); void TrimLeft(); void TrimLeft(FX_WCHAR chTarget); - void TrimLeft(FX_LPCWSTR lpszTargets); + void TrimLeft(const FX_WCHAR* lpszTargets); void Reserve(FX_STRSIZE len); - FX_LPWSTR GetBuffer(FX_STRSIZE len); + FX_WCHAR* GetBuffer(FX_STRSIZE len); void ReleaseBuffer(FX_STRSIZE len = -1); @@ -777,11 +777,11 @@ public: FX_FLOAT GetFloat() const; - FX_STRSIZE Find(FX_LPCWSTR lpszSub, FX_STRSIZE start = 0) const; + FX_STRSIZE Find(const FX_WCHAR* lpszSub, FX_STRSIZE start = 0) const; FX_STRSIZE Find(FX_WCHAR ch, FX_STRSIZE start = 0) const; - FX_STRSIZE Replace(FX_LPCWSTR lpszOld, FX_LPCWSTR lpszNew); + FX_STRSIZE Replace(const FX_WCHAR* lpszOld, const FX_WCHAR* lpszNew); FX_STRSIZE Remove(FX_WCHAR ch); @@ -816,9 +816,9 @@ protected: void CopyBeforeWrite(); void AllocBeforeWrite(FX_STRSIZE nLen); - void ConcatInPlace(FX_STRSIZE nSrcLen, FX_LPCWSTR lpszSrcData); - void ConcatCopy(FX_STRSIZE nSrc1Len, FX_LPCWSTR lpszSrc1Data, FX_STRSIZE nSrc2Len, FX_LPCWSTR lpszSrc2Data); - void AssignCopy(FX_STRSIZE nSrcLen, FX_LPCWSTR lpszSrcData); + void ConcatInPlace(FX_STRSIZE nSrcLen, const FX_WCHAR* lpszSrcData); + void ConcatCopy(FX_STRSIZE nSrc1Len, const FX_WCHAR* lpszSrc1Data, FX_STRSIZE nSrc2Len, const FX_WCHAR* lpszSrc2Data); + void AssignCopy(FX_STRSIZE nSrcLen, const FX_WCHAR* lpszSrcData); void AllocCopy(CFX_WideString& dest, FX_STRSIZE nCopyLen, FX_STRSIZE nCopyIndex) const; StringData* m_pData; @@ -840,11 +840,11 @@ inline CFX_WideString operator + (const CFX_WideStringC& str1, const CFX_WideStr { return CFX_WideString(str1, str2); } -inline CFX_WideString operator + (const CFX_WideStringC& str1, FX_LPCWSTR str2) +inline CFX_WideString operator + (const CFX_WideStringC& str1, const FX_WCHAR* str2) { return CFX_WideString(str1, str2); } -inline CFX_WideString operator + (FX_LPCWSTR str1, const CFX_WideStringC& str2) +inline CFX_WideString operator + (const FX_WCHAR* str1, const CFX_WideStringC& str2) { return CFX_WideString(str1, str2); } @@ -868,11 +868,11 @@ inline CFX_WideString operator + (FX_WCHAR ch, const CFX_WideString& str2) { return CFX_WideString(ch, str2); } -inline CFX_WideString operator + (const CFX_WideString& str1, FX_LPCWSTR str2) +inline CFX_WideString operator + (const CFX_WideString& str1, const FX_WCHAR* str2) { return CFX_WideString(str1, str2); } -inline CFX_WideString operator + (FX_LPCWSTR str1, const CFX_WideString& str2) +inline CFX_WideString operator + (const FX_WCHAR* str1, const CFX_WideString& str2) { return CFX_WideString(str1, str2); } @@ -898,8 +898,8 @@ inline bool operator!= (const CFX_WideStringC& lhs, const CFX_WideString& rhs) { } FX_FLOAT FX_atof(FX_BSTR str); void FX_atonum(FX_BSTR str, FX_BOOL& bInteger, void* pData); -FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_LPSTR buf); -CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len); +FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); +CFX_ByteString FX_UTF8Encode(const FX_WCHAR* pwsStr, FX_STRSIZE len); inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) { return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); diff --git a/core/include/fxcrt/fx_system.h b/core/include/fxcrt/fx_system.h index 80d75908d4..ec6d6294b0 100644 --- a/core/include/fxcrt/fx_system.h +++ b/core/include/fxcrt/fx_system.h @@ -67,24 +67,13 @@ #ifdef __cplusplus extern "C" { #endif -typedef void* FX_LPVOID; // Deprecate, use with void*. -typedef const void* FX_LPCVOID; // Deprecate, use with const void*. typedef void* FX_POSITION; // Keep until fxcrt containers gone -typedef uint8_t* FX_LPBYTE; // Deprecate, use uint8_t*. -typedef const uint8_t* FX_LPCBYTE; // Deprecate, use const uint8_t*. typedef unsigned short FX_WORD; // Keep - "an efficient small type" -typedef FX_WORD* FX_LPWORD; // Deprecate, use FX_WORD*. -typedef const FX_WORD* FX_LPCWORD; // Deprecate, use const FX_WORD*. typedef unsigned int FX_DWORD; // Keep - "an efficient type" -typedef FX_DWORD* FX_LPDWORD; // Deprecate, use FX_DWORD*. typedef float FX_FLOAT; // Keep, allow upgrade to doubles. -typedef int FX_BOOL; // Sadly not always 0 or 1. +typedef int FX_BOOL; // Keep, sadly not always 0 or 1. typedef char FX_CHAR; // Keep, questionable signedness. -typedef FX_CHAR* FX_LPSTR; // Deprecate, use FX_CHAR*. -typedef const FX_CHAR* FX_LPCSTR; // Deprecate, use const FX_CHAR*. typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars. -typedef FX_WCHAR* FX_LPWSTR; // Deprecate, use FX_WCHAR*. -typedef const FX_WCHAR* FX_LPCWSTR; // Deprecate, use const FX_WCHAR*. // PDFium string sizes are limited to 2^31-1, and the value is signed to // allow -1 as a placeholder for "unknown". @@ -158,7 +147,7 @@ void FXSYS_vsnprintf(char *str, size_t size, const char* fmt, va_list ap); #define FXSYS_wfopen _wfopen #endif #else -FXSYS_FILE* FXSYS_wfopen(FX_LPCWSTR filename, FX_LPCWSTR mode); +FXSYS_FILE* FXSYS_wfopen(const FX_WCHAR* filename, const FX_WCHAR* mode); #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ #ifdef __cplusplus @@ -249,18 +238,18 @@ wchar_t* FXSYS_wcsupr(wchar_t* str); #define FXSYS_abs abs #define FXDWORD_FROM_LSBFIRST(i) (i) #define FXDWORD_FROM_MSBFIRST(i) (((uint8_t)(i) << 24) | ((uint8_t)((i) >> 8) << 16) | ((uint8_t)((i) >> 16) << 8) | (uint8_t)((i) >> 24)) -#define FXDWORD_GET_LSBFIRST(p) ((((FX_LPBYTE)(p))[3] << 24) | (((FX_LPBYTE)(p))[2] << 16) | (((FX_LPBYTE)(p))[1] << 8) | (((FX_LPBYTE)(p))[0])) -#define FXDWORD_GET_MSBFIRST(p) ((((FX_LPBYTE)(p))[0] << 24) | (((FX_LPBYTE)(p))[1] << 16) | (((FX_LPBYTE)(p))[2] << 8) | (((FX_LPBYTE)(p))[3])) +#define FXDWORD_GET_LSBFIRST(p) ((((uint8_t*)(p))[3] << 24) | (((uint8_t*)(p))[2] << 16) | (((uint8_t*)(p))[1] << 8) | (((uint8_t*)(p))[0])) +#define FXDWORD_GET_MSBFIRST(p) ((((uint8_t*)(p))[0] << 24) | (((uint8_t*)(p))[1] << 16) | (((uint8_t*)(p))[2] << 8) | (((uint8_t*)(p))[3])) #define FXSYS_HIBYTE(word) ((uint8_t)((word) >> 8)) #define FXSYS_LOBYTE(word) ((uint8_t)(word)) #define FXSYS_HIWORD(dword) ((FX_WORD)((dword) >> 16)) #define FXSYS_LOWORD(dword) ((FX_WORD)(dword)) -int32_t FXSYS_atoi(FX_LPCSTR str); -int32_t FXSYS_wtoi(FX_LPCWSTR str); -int64_t FXSYS_atoi64(FX_LPCSTR str); -int64_t FXSYS_wtoi64(FX_LPCWSTR str); -FX_LPCSTR FXSYS_i64toa(int64_t value, FX_LPSTR str, int radix); -FX_LPCWSTR FXSYS_i64tow(int64_t value, FX_LPWSTR str, int radix); +int32_t FXSYS_atoi(const FX_CHAR* str); +int32_t FXSYS_wtoi(const FX_WCHAR* str); +int64_t FXSYS_atoi64(const FX_CHAR* str); +int64_t FXSYS_wtoi64(const FX_WCHAR* str); +const FX_CHAR* FXSYS_i64toa(int64_t value, FX_CHAR* str, int radix); +const FX_WCHAR* FXSYS_i64tow(int64_t value, FX_WCHAR* str, int radix); int FXSYS_round(FX_FLOAT f); #define FXSYS_Mul(a, b) ((a) * (b)) #define FXSYS_Div(a, b) ((a) / (b)) diff --git a/core/include/fxge/fpf.h b/core/include/fxge/fpf.h index 30c1c77bbe..710600c84f 100644 --- a/core/include/fxge/fpf.h +++ b/core/include/fxge/fpf.h @@ -20,7 +20,7 @@ public: IFPF_DeviceModule* FPF_GetDeviceModule(); #define FPF_MATCHFONT_REPLACEANSI 1 typedef struct FPF_HFONT_ { - FX_LPVOID pData; + void* pData; }* FPF_HFONT; class IFPF_Font { @@ -44,7 +44,7 @@ public: virtual int32_t GetHeight() const = 0; virtual int32_t GetItalicAngle() const = 0; - virtual FX_DWORD GetFontData(FX_DWORD dwTable, FX_LPBYTE pBuffer, FX_DWORD dwSize) = 0; + virtual FX_DWORD GetFontData(FX_DWORD dwTable, uint8_t* pBuffer, FX_DWORD dwSize) = 0; protected: ~IFPF_Font() { } @@ -56,7 +56,7 @@ public: virtual void LoadSystemFonts() = 0; virtual void LoadPrivateFont(IFX_FileRead* pFontFile) = 0; virtual void LoadPrivateFont(FX_BSTR bsFileName) = 0; - virtual void LoadPrivateFont(FX_LPVOID pBuffer, size_t szBuffer) = 0; + virtual void LoadPrivateFont(void* pBuffer, size_t szBuffer) = 0; virtual IFPF_Font* CreateFont(FX_BSTR bsFamilyname, uint8_t charset, FX_DWORD dwStyle, FX_DWORD dwMatch = 0) = 0; }; diff --git a/core/include/fxge/fx_dib.h b/core/include/fxge/fx_dib.h index d798ca3511..50dd3e9eed 100644 --- a/core/include/fxge/fx_dib.h +++ b/core/include/fxge/fx_dib.h @@ -100,33 +100,33 @@ FX_ARGB ArgbEncode(int a, FX_COLORREF rgb); #define FXCMYK2GRAY(c,m,y,k) (((255-(c)) * (255-(k)) * 30 + (255-(m)) * (255-(k)) * 59 + (255-(y)) * (255-(k)) * 11) / 25500) #define FXDIB_ALPHA_MERGE(backdrop, source, source_alpha) (((backdrop) * (255-(source_alpha)) + (source)*(source_alpha))/255) #define FXDIB_ALPHA_UNION(dest, src) ((dest) + (src) - (dest)*(src)/255) -#define FXCMYK_GETDIB(p) ((((FX_LPBYTE)(p))[0] << 24 | (((FX_LPBYTE)(p))[1] << 16) | (((FX_LPBYTE)(p))[2] << 8) | ((FX_LPBYTE)(p))[3])) -#define FXCMYK_SETDIB(p, cmyk) ((FX_LPBYTE)(p))[0] = (uint8_t)((cmyk) >> 24), \ - ((FX_LPBYTE)(p))[1] = (uint8_t)((cmyk) >> 16), \ - ((FX_LPBYTE)(p))[2] = (uint8_t)((cmyk) >> 8), \ - ((FX_LPBYTE)(p))[3] = (uint8_t)(cmyk)) -#define FXARGB_GETDIB(p) ((((FX_LPBYTE)(p))[0]) | (((FX_LPBYTE)(p))[1] << 8) | (((FX_LPBYTE)(p))[2] << 16) | (((FX_LPBYTE)(p))[3] << 24)) -#define FXARGB_SETDIB(p, argb) ((FX_LPBYTE)(p))[0] = (uint8_t)(argb), \ - ((FX_LPBYTE)(p))[1] = (uint8_t)((argb) >> 8), \ - ((FX_LPBYTE)(p))[2] = (uint8_t)((argb) >> 16), \ - ((FX_LPBYTE)(p))[3] = (uint8_t)((argb) >> 24) -#define FXARGB_COPY(dest, src) *(FX_LPBYTE)(dest) = *(FX_LPBYTE)(src), \ - *((FX_LPBYTE)(dest)+1) = *((FX_LPBYTE)(src)+1), \ - *((FX_LPBYTE)(dest)+2) = *((FX_LPBYTE)(src)+2), \ - *((FX_LPBYTE)(dest)+3) = *((FX_LPBYTE)(src)+3) -#define FXCMYK_COPY(dest, src) *(FX_LPBYTE)(dest) = *(FX_LPBYTE)(src), \ - *((FX_LPBYTE)(dest)+1) = *((FX_LPBYTE)(src)+1), \ - *((FX_LPBYTE)(dest)+2) = *((FX_LPBYTE)(src)+2), \ - *((FX_LPBYTE)(dest)+3) = *((FX_LPBYTE)(src)+3) -#define FXARGB_SETRGBORDERDIB(p, argb) ((FX_LPBYTE)(p))[3] = (uint8_t)(argb>>24), \ - ((FX_LPBYTE)(p))[0] = (uint8_t)((argb) >> 16), \ - ((FX_LPBYTE)(p))[1] = (uint8_t)((argb) >> 8), \ - ((FX_LPBYTE)(p))[2] = (uint8_t)(argb) -#define FXARGB_GETRGBORDERDIB(p) (((FX_LPBYTE)(p))[2]) | (((FX_LPBYTE)(p))[1] << 8) | (((FX_LPBYTE)(p))[0] << 16) | (((FX_LPBYTE)(p))[3] << 24) -#define FXARGB_RGBORDERCOPY(dest, src) *((FX_LPBYTE)(dest)+3) = *((FX_LPBYTE)(src)+3), \ - *(FX_LPBYTE)(dest) = *((FX_LPBYTE)(src)+2), \ - *((FX_LPBYTE)(dest)+1) = *((FX_LPBYTE)(src)+1), \ - *((FX_LPBYTE)(dest)+2) = *((FX_LPBYTE)(src)) +#define FXCMYK_GETDIB(p) ((((uint8_t*)(p))[0] << 24 | (((uint8_t*)(p))[1] << 16) | (((uint8_t*)(p))[2] << 8) | ((uint8_t*)(p))[3])) +#define FXCMYK_SETDIB(p, cmyk) ((uint8_t*)(p))[0] = (uint8_t)((cmyk) >> 24), \ + ((uint8_t*)(p))[1] = (uint8_t)((cmyk) >> 16), \ + ((uint8_t*)(p))[2] = (uint8_t)((cmyk) >> 8), \ + ((uint8_t*)(p))[3] = (uint8_t)(cmyk)) +#define FXARGB_GETDIB(p) ((((uint8_t*)(p))[0]) | (((uint8_t*)(p))[1] << 8) | (((uint8_t*)(p))[2] << 16) | (((uint8_t*)(p))[3] << 24)) +#define FXARGB_SETDIB(p, argb) ((uint8_t*)(p))[0] = (uint8_t)(argb), \ + ((uint8_t*)(p))[1] = (uint8_t)((argb) >> 8), \ + ((uint8_t*)(p))[2] = (uint8_t)((argb) >> 16), \ + ((uint8_t*)(p))[3] = (uint8_t)((argb) >> 24) +#define FXARGB_COPY(dest, src) *(uint8_t*)(dest) = *(uint8_t*)(src), \ + *((uint8_t*)(dest)+1) = *((uint8_t*)(src)+1), \ + *((uint8_t*)(dest)+2) = *((uint8_t*)(src)+2), \ + *((uint8_t*)(dest)+3) = *((uint8_t*)(src)+3) +#define FXCMYK_COPY(dest, src) *(uint8_t*)(dest) = *(uint8_t*)(src), \ + *((uint8_t*)(dest)+1) = *((uint8_t*)(src)+1), \ + *((uint8_t*)(dest)+2) = *((uint8_t*)(src)+2), \ + *((uint8_t*)(dest)+3) = *((uint8_t*)(src)+3) +#define FXARGB_SETRGBORDERDIB(p, argb) ((uint8_t*)(p))[3] = (uint8_t)(argb>>24), \ + ((uint8_t*)(p))[0] = (uint8_t)((argb) >> 16), \ + ((uint8_t*)(p))[1] = (uint8_t)((argb) >> 8), \ + ((uint8_t*)(p))[2] = (uint8_t)(argb) +#define FXARGB_GETRGBORDERDIB(p) (((uint8_t*)(p))[2]) | (((uint8_t*)(p))[1] << 8) | (((uint8_t*)(p))[0] << 16) | (((uint8_t*)(p))[3] << 24) +#define FXARGB_RGBORDERCOPY(dest, src) *((uint8_t*)(dest)+3) = *((uint8_t*)(src)+3), \ + *(uint8_t*)(dest) = *((uint8_t*)(src)+2), \ + *((uint8_t*)(dest)+1) = *((uint8_t*)(src)+1), \ + *((uint8_t*)(dest)+2) = *((uint8_t*)(src)) #define FXARGB_TODIB(argb) (argb) #define FXCMYK_TODIB(cmyk) ((uint8_t)((cmyk) >> 24) | ((uint8_t)((cmyk) >> 16)) << 8 | ((uint8_t)((cmyk) >> 8)) << 16 | ((uint8_t)(cmyk) << 24)) #define FXARGB_TOBGRORDERDIB(argb) ((uint8_t)(argb>>16) | ((uint8_t)(argb>>8)) << 8 | ((uint8_t)(argb)) << 16 | ((uint8_t)(argb>>24) << 24)) @@ -171,19 +171,19 @@ public: - virtual FX_LPBYTE GetBuffer() const + virtual uint8_t* GetBuffer() const { return NULL; } - virtual FX_LPCBYTE GetScanline(int line) const = 0; + virtual const uint8_t* GetScanline(int line) const = 0; virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const { return FALSE; } - virtual void DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_bpp, + virtual void DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const = 0; virtual void SetDownSampleSize(int width, int height) const {} @@ -291,21 +291,21 @@ public: CFX_DIBitmap(const CFX_DIBitmap& src); - FX_BOOL Create(int width, int height, FXDIB_Format format, FX_LPBYTE pBuffer = NULL, int pitch = 0); + FX_BOOL Create(int width, int height, FXDIB_Format format, uint8_t* pBuffer = NULL, int pitch = 0); FX_BOOL Copy(const CFX_DIBSource* pSrc); - virtual FX_LPBYTE GetBuffer() const + virtual uint8_t* GetBuffer() const { return m_pBuffer; } - virtual FX_LPCBYTE GetScanline(int line) const + virtual const uint8_t* GetScanline(int line) const { return m_pBuffer ? m_pBuffer + line * m_Pitch : NULL; } - virtual void DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_bpp, + virtual void DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const; void TakeOver(CFX_DIBitmap* pSrcBitmap); @@ -347,7 +347,7 @@ public: FX_BOOL DitherFS(const FX_DWORD* pPalette, int pal_size, const FX_RECT* pRect = NULL); protected: - FX_LPBYTE m_pBuffer; + uint8_t* m_pBuffer; FX_BOOL m_bExtBuf; @@ -385,26 +385,26 @@ public: virtual FX_DWORD* GetDestPalette() = 0; - virtual void TranslateScanline(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf) const = 0; + virtual void TranslateScanline(uint8_t* dest_buf, const uint8_t* src_buf) const = 0; - virtual void TranslateDownSamples(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf, int pixels, int Bpp) const = 0; + virtual void TranslateDownSamples(uint8_t* dest_buf, const uint8_t* src_buf, int pixels, int Bpp) const = 0; protected: - virtual FX_LPCBYTE GetScanline(int line) const; - virtual void DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_bpp, + virtual const uint8_t* GetScanline(int line) const; + virtual void DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const; const CFX_DIBSource* m_pSrc; FX_BOOL m_bAutoDropSrc; - FX_LPBYTE m_pScanline; + uint8_t* m_pScanline; }; class IFX_ScanlineComposer { public: virtual ~IFX_ScanlineComposer() { } - virtual void ComposeScanline(int line, FX_LPCBYTE scanline, FX_LPCBYTE scan_extra_alpha = NULL) = 0; + virtual void ComposeScanline(int line, const uint8_t* scanline, const uint8_t* scan_extra_alpha = NULL) = 0; virtual FX_BOOL SetInfo(int width, int height, FXDIB_Format src_format, FX_DWORD* pSrcPalette) = 0; }; @@ -419,20 +419,20 @@ public: FX_DWORD mask_color, int blend_type, FX_BOOL bClip, FX_BOOL bRgbByteOrder = FALSE, int alpha_flag = 0, void* pIccTransform = NULL); - void CompositeRgbBitmapLine(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_extra_alpha = NULL, FX_LPBYTE dst_extra_alpha = NULL); + void CompositeRgbBitmapLine(uint8_t* dest_scan, const uint8_t* src_scan, int width, const uint8_t* clip_scan, + const uint8_t* src_extra_alpha = NULL, uint8_t* dst_extra_alpha = NULL); - void CompositePalBitmapLine(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, int width, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_extra_alpha = NULL, FX_LPBYTE dst_extra_alpha = NULL); + void CompositePalBitmapLine(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, int width, const uint8_t* clip_scan, + const uint8_t* src_extra_alpha = NULL, uint8_t* dst_extra_alpha = NULL); - void CompositeByteMaskLine(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, FX_LPCBYTE clip_scan, - FX_LPBYTE dst_extra_alpha = NULL); + void CompositeByteMaskLine(uint8_t* dest_scan, const uint8_t* src_scan, int width, const uint8_t* clip_scan, + uint8_t* dst_extra_alpha = NULL); - void CompositeBitMaskLine(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, int width, FX_LPCBYTE clip_scan, - FX_LPBYTE dst_extra_alpha = NULL); + void CompositeBitMaskLine(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, int width, const uint8_t* clip_scan, + uint8_t* dst_extra_alpha = NULL); protected: int m_Transparency; FXDIB_Format m_SrcFormat, @@ -446,7 +446,7 @@ protected: m_MaskBlack; int m_BlendType; void* m_pIccTransform; - FX_LPBYTE m_pCacheScanline; + uint8_t* m_pCacheScanline; int m_CacheSize; FX_BOOL m_bRgbByteOrder; }; @@ -467,11 +467,11 @@ public: virtual FX_BOOL SetInfo(int width, int height, FXDIB_Format src_format, FX_DWORD* pSrcPalette); - virtual void ComposeScanline(int line, FX_LPCBYTE scanline, FX_LPCBYTE scan_extra_alpha); + virtual void ComposeScanline(int line, const uint8_t* scanline, const uint8_t* scan_extra_alpha); protected: - void DoCompose(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int dest_width, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_extra_alpha = NULL, FX_LPBYTE dst_extra_alpha = NULL); + void DoCompose(uint8_t* dest_scan, const uint8_t* src_scan, int dest_width, const uint8_t* clip_scan, + const uint8_t* src_extra_alpha = NULL, uint8_t* dst_extra_alpha = NULL); CFX_DIBitmap* m_pBitmap; const CFX_ClipRgn* m_pClipRgn; FXDIB_Format m_SrcFormat; @@ -484,8 +484,11 @@ protected: void* m_pIccTransform; FX_BOOL m_bRgbByteOrder; int m_BlendType; - void ComposeScanlineV(int line, FX_LPCBYTE scanline, FX_LPCBYTE scan_extra_alpha = NULL); - FX_LPBYTE m_pScanlineV, m_pClipScanV, m_pAddClipScan, m_pScanlineAlphaV; + void ComposeScanlineV(int line, const uint8_t* scanline, const uint8_t* scan_extra_alpha = NULL); + uint8_t* m_pScanlineV; + uint8_t* m_pClipScanV; + uint8_t* m_pAddClipScan; + uint8_t* m_pScanlineAlphaV; }; class CFX_BitmapStorer : public IFX_ScanlineComposer { @@ -495,7 +498,7 @@ public: ~CFX_BitmapStorer(); - virtual void ComposeScanline(int line, FX_LPCBYTE scanline, FX_LPCBYTE scan_extra_alpha); + virtual void ComposeScanline(int line, const uint8_t* scanline, const uint8_t* scan_extra_alpha); virtual FX_BOOL SetInfo(int width, int height, FXDIB_Format src_format, FX_DWORD* pSrcPalette); @@ -535,8 +538,8 @@ public: FX_RECT m_ClipRect; int m_LineIndex; int m_DestBPP; - FX_LPBYTE m_pScanline; - FX_LPBYTE m_pMaskScanline; + uint8_t* m_pScanline; + uint8_t* m_pMaskScanline; FXDIB_Format m_DestFormat; int32_t m_Status; diff --git a/core/include/fxge/fx_font.h b/core/include/fxge/fx_font.h index aa985820c8..df752b4f77 100644 --- a/core/include/fxge/fx_font.h +++ b/core/include/fxge/fx_font.h @@ -57,7 +57,7 @@ public: FX_BOOL LoadSubst(const CFX_ByteString& face_name, FX_BOOL bTrueType, FX_DWORD flags, int weight, int italic_angle, int CharsetCP, FX_BOOL bVertical = FALSE); - FX_BOOL LoadEmbedded(FX_LPCBYTE data, FX_DWORD size); + FX_BOOL LoadEmbedded(const uint8_t* data, FX_DWORD size); FX_BOOL LoadFile(IFX_FileRead* pFile); @@ -122,9 +122,9 @@ public: } void AdjustMMParams(int glyph_index, int width, int weight); - FX_LPBYTE m_pFontDataAllocation; - FX_LPBYTE m_pFontData; - FX_LPBYTE m_pGsubData; + uint8_t* m_pFontDataAllocation; + uint8_t* m_pFontData; + uint8_t* m_pGsubData; FX_DWORD m_dwSize; CFX_BinaryBuf m_OtfFontData; void* m_hHandle; @@ -168,7 +168,7 @@ public: CFX_SubstFont(); - FX_LPVOID m_ExtHandle; + void* m_ExtHandle; CFX_ByteString m_Family; @@ -194,7 +194,7 @@ public: #define FX_FONT_FLAG_SYMBOLIC_DINGBATS 0x20 #define FX_FONT_FLAG_MULTIPLEMASTER 0x40 typedef struct { - FX_LPCBYTE m_pFontData; + const uint8_t* m_pFontData; FX_DWORD m_dwSize; } FoxitFonts; class CFX_FontMgr @@ -204,15 +204,15 @@ public: ~CFX_FontMgr(); void InitFTLibrary(); FXFT_Face GetCachedFace(const CFX_ByteString& face_name, - int weight, FX_BOOL bItalic, FX_LPBYTE& pFontData); + int weight, FX_BOOL bItalic, uint8_t*& pFontData); FXFT_Face AddCachedFace(const CFX_ByteString& face_name, - int weight, FX_BOOL bItalic, FX_LPBYTE pData, FX_DWORD size, int face_index); + int weight, FX_BOOL bItalic, uint8_t* pData, FX_DWORD size, int face_index); FXFT_Face GetCachedTTCFace(int ttc_size, FX_DWORD checksum, - int font_offset, FX_LPBYTE& pFontData); + int font_offset, uint8_t*& pFontData); FXFT_Face AddCachedTTCFace(int ttc_size, FX_DWORD checksum, - FX_LPBYTE pData, FX_DWORD size, int font_offset); - FXFT_Face GetFileFace(FX_LPCSTR filename, int face_index); - FXFT_Face GetFixedFace(FX_LPCBYTE pData, FX_DWORD size, int face_index); + uint8_t* pData, FX_DWORD size, int font_offset); + FXFT_Face GetFileFace(const FX_CHAR* filename, int face_index); + FXFT_Face GetFixedFace(const uint8_t* pData, FX_DWORD size, int face_index); void ReleaseFace(FXFT_Face face); void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo); FXFT_Face FindSubstFont(const CFX_ByteString& face_name, FX_BOOL bTrueType, FX_DWORD flags, @@ -220,7 +220,7 @@ public: void FreeCache(); - FX_BOOL GetStandardFont(FX_LPCBYTE& pFontData, FX_DWORD& size, int index); + FX_BOOL GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index); CFX_FontMapper* m_pBuiltinMapper; IFX_FontMapper* m_pExtMapper; CFX_MapByteStringToPtr m_FaceMap; @@ -298,9 +298,9 @@ public: virtual void Release() = 0; virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0; - virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR face, FX_BOOL& bExact) = 0; - virtual void* GetFont(FX_LPCSTR face) = 0; - virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffer, FX_DWORD size) = 0; + virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact) = 0; + virtual void* GetFont(const FX_CHAR* face) = 0; + virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer, FX_DWORD size) = 0; virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0; virtual FX_BOOL GetFontCharset(void* hFont, int& charset) = 0; virtual int GetFaceIndex(void* hFont) @@ -323,9 +323,9 @@ public: void AddPath(FX_BSTR path); virtual void Release(); virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper); - virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR face, FX_BOOL& bExact); - virtual void* GetFont(FX_LPCSTR face); - virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffer, FX_DWORD size); + virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact); + virtual void* GetFont(const FX_CHAR* face); + virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer, FX_DWORD size); virtual void DeleteFont(void* hFont); virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name); virtual FX_BOOL GetFontCharset(void* hFont, int& charset); diff --git a/core/include/fxge/fx_ge.h b/core/include/fxge/fx_ge.h index a880166c39..46ff0c30f8 100644 --- a/core/include/fxge/fx_ge.h +++ b/core/include/fxge/fx_ge.h @@ -41,7 +41,7 @@ public: return m_pFontMgr; } void SetTextGamma(FX_FLOAT gammaValue); - FX_LPCBYTE GetTextGammaTable(); + const uint8_t* GetTextGammaTable(); void SetExtFontMapper(IFX_FontMapper* pFontMapper); void SetCodecModule(CCodec_ModuleMgr* pCodecModule) @@ -423,12 +423,12 @@ public: FX_DWORD color, FX_DWORD flags = 0, int alpha_flag = 0, void* pIccTransform = NULL); FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, - const CFX_AffineMatrix* pMatrix, FX_DWORD flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD flags, void*& handle, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL); - FX_BOOL ContinueDIBits(FX_LPVOID handle, IFX_Pause* pPause); + FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause); - void CancelDIBits(FX_LPVOID handle); + void CancelDIBits(void* handle); FX_BOOL DrawNormalText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, @@ -601,15 +601,15 @@ public: int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL) = 0; virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, - const CFX_AffineMatrix* pMatrix, FX_DWORD flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD flags, void*& handle, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL) = 0; - virtual FX_BOOL ContinueDIBits(FX_LPVOID handle, IFX_Pause* pPause) + virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) { return FALSE; } - virtual void CancelDIBits(FX_LPVOID handle) {} + virtual void CancelDIBits(void* handle) {} virtual FX_BOOL DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color, @@ -634,7 +634,7 @@ class IFX_PSOutput { public: virtual void Release() = 0; - virtual void OutputPS(FX_LPCSTR string, int len) = 0; + virtual void OutputPS(const FX_CHAR* string, int len) = 0; protected: ~IFX_PSOutput() { } @@ -726,7 +726,7 @@ private: void FindPSFontGlyph(CFX_FaceCache* pFaceCache, CFX_Font* pFont, const FXTEXT_CHARPOS& charpos, int& ps_fontnum, int &ps_glyphindex); - void WritePSBinary(FX_LPCBYTE data, int len); + void WritePSBinary(const uint8_t* data, int len); }; #endif // CORE_INCLUDE_FXGE_FX_GE_H_ diff --git a/core/include/fxge/fx_ge_win32.h b/core/include/fxge/fx_ge_win32.h index 3972090326..57f30f7d35 100644 --- a/core/include/fxge/fx_ge_win32.h +++ b/core/include/fxge/fx_ge_win32.h @@ -21,7 +21,7 @@ typedef struct WINDIB_Open_Args_ { size_t memory_size; - FX_LPCWSTR path_name; + const FX_WCHAR* path_name; } WINDIB_Open_Args_; class CFX_WindowsDIB : public CFX_DIBitmap { @@ -35,9 +35,9 @@ public: static CFX_DIBitmap* LoadFromDDB(HDC hDC, HBITMAP hBitmap, FX_DWORD* pPalette = NULL, FX_DWORD size = 256); - static CFX_DIBitmap* LoadFromFile(FX_LPCWSTR filename); + static CFX_DIBitmap* LoadFromFile(const FX_WCHAR* filename); - static CFX_DIBitmap* LoadFromFile(FX_LPCSTR filename) + static CFX_DIBitmap* LoadFromFile(const FX_CHAR* filename) { return LoadFromFile(CFX_WideString::FromLocal(filename).c_str()); } diff --git a/core/include/reflow/fpdf_layout.h b/core/include/reflow/fpdf_layout.h index b1038db329..2fff2759ab 100644 --- a/core/include/reflow/fpdf_layout.h +++ b/core/include/reflow/fpdf_layout.h @@ -224,7 +224,7 @@ public: static IPDF_LayoutProcessor* Create_LayoutProcessor_Reflow(FX_FLOAT TopIndent, FX_FLOAT fWidth, FX_FLOAT fHeight, void* pReflowedPage, int flags, FX_FLOAT lineSpace = 0); - static IPDF_LayoutProcessor* Create_LayoutProcessor_2HTML(FX_LPCSTR fileName); + static IPDF_LayoutProcessor* Create_LayoutProcessor_2HTML(const FX_CHAR* fileName); virtual LayoutStatus StartProcess(IPDF_LayoutElement* pElement, IFX_Pause* pPause, const CFX_AffineMatrix* pPDFMatrix = NULL) = 0; diff --git a/core/src/fdrm/crypto/fx_crypt.cpp b/core/src/fdrm/crypto/fx_crypt.cpp index da9fcc5693..f6b3148dba 100644 --- a/core/src/fdrm/crypto/fx_crypt.cpp +++ b/core/src/fdrm/crypto/fx_crypt.cpp @@ -14,7 +14,7 @@ extern "C" { struct rc4_state { int x, y, m[256]; }; -void CRYPT_ArcFourSetup(void* context, FX_LPCBYTE key, FX_DWORD length ) +void CRYPT_ArcFourSetup(void* context, const uint8_t* key, FX_DWORD length ) { rc4_state *s = (rc4_state*)context; int i, j, k, *m, a; @@ -53,7 +53,7 @@ void CRYPT_ArcFourCrypt(void* context, unsigned char *data, FX_DWORD length ) s->x = x; s->y = y; } -void CRYPT_ArcFourCryptBlock(FX_LPBYTE pData, FX_DWORD size, FX_LPCBYTE key, FX_DWORD keylen) +void CRYPT_ArcFourCryptBlock(uint8_t* pData, FX_DWORD size, const uint8_t* key, FX_DWORD keylen) { rc4_state s; CRYPT_ArcFourSetup(&s, key, keylen); @@ -193,7 +193,7 @@ void CRYPT_MD5Start(void* context) ctx->state[2] = 0x98BADCFE; ctx->state[3] = 0x10325476; } -void CRYPT_MD5Update(FX_LPVOID pctx, FX_LPCBYTE input, FX_DWORD length ) +void CRYPT_MD5Update(void* pctx, const uint8_t* input, FX_DWORD length ) { struct md5_context *ctx = (struct md5_context *)pctx; FX_DWORD left, fill; @@ -228,7 +228,7 @@ const uint8_t md5_padding[64] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -void CRYPT_MD5Finish(FX_LPVOID pctx, uint8_t digest[16] ) +void CRYPT_MD5Finish(void* pctx, uint8_t digest[16] ) { struct md5_context *ctx = (struct md5_context *)pctx; FX_DWORD last, padn; @@ -244,15 +244,15 @@ void CRYPT_MD5Finish(FX_LPVOID pctx, uint8_t digest[16] ) PUT_FX_DWORD( ctx->state[2], digest, 8 ); PUT_FX_DWORD( ctx->state[3], digest, 12 ); } -void CRYPT_MD5Generate(FX_LPCBYTE input, FX_DWORD length, uint8_t digest[16]) +void CRYPT_MD5Generate(const uint8_t* input, FX_DWORD length, uint8_t digest[16]) { md5_context ctx; CRYPT_MD5Start(&ctx); CRYPT_MD5Update(&ctx, input, length); CRYPT_MD5Finish(&ctx, digest); } -static FX_BOOL (*g_PubKeyDecryptor)(FX_LPCBYTE pData, FX_DWORD size, FX_LPBYTE data_buf, FX_DWORD& data_len) = NULL; -void CRYPT_SetPubKeyDecryptor(FX_BOOL (*func)(FX_LPCBYTE pData, FX_DWORD size, FX_LPBYTE data_buf, FX_DWORD& data_len)) +static FX_BOOL (*g_PubKeyDecryptor)(const uint8_t* pData, FX_DWORD size, uint8_t* data_buf, FX_DWORD& data_len) = NULL; +void CRYPT_SetPubKeyDecryptor(FX_BOOL (*func)(const uint8_t* pData, FX_DWORD size, uint8_t* data_buf, FX_DWORD& data_len)) { g_PubKeyDecryptor = func; } diff --git a/core/src/fdrm/crypto/fx_crypt_aes.cpp b/core/src/fdrm/crypto/fx_crypt_aes.cpp index 6efa935be3..4de0f7e752 100644 --- a/core/src/fdrm/crypto/fx_crypt_aes.cpp +++ b/core/src/fdrm/crypto/fx_crypt_aes.cpp @@ -989,22 +989,22 @@ static void aes_encrypt_cbc(unsigned char *dest, const unsigned char *src, int l } FXSYS_memcpy32(ctx->iv, iv, sizeof(iv)); } -void CRYPT_AESSetKey(FX_LPVOID context, FX_DWORD blocklen, FX_LPCBYTE key, FX_DWORD keylen, FX_BOOL bEncrypt) +void CRYPT_AESSetKey(void* context, FX_DWORD blocklen, const uint8_t* key, FX_DWORD keylen, FX_BOOL bEncrypt) { aes_setup((AESContext*)context, blocklen, key, keylen); } -void CRYPT_AESSetIV(FX_LPVOID context, FX_LPCBYTE iv) +void CRYPT_AESSetIV(void* context, const uint8_t* iv) { int i; for (i = 0; i < ((AESContext*)context)->Nb; i++) { ((AESContext*)context)->iv[i] = GET_32BIT_MSB_FIRST(iv + 4 * i); } } -void CRYPT_AESDecrypt(FX_LPVOID context, FX_LPBYTE dest, FX_LPCBYTE src, FX_DWORD len) +void CRYPT_AESDecrypt(void* context, uint8_t* dest, const uint8_t* src, FX_DWORD len) { aes_decrypt_cbc(dest, src, len, (AESContext*)context); } -void CRYPT_AESEncrypt(FX_LPVOID context, FX_LPBYTE dest, FX_LPCBYTE src, FX_DWORD len) +void CRYPT_AESEncrypt(void* context, uint8_t* dest, const uint8_t* src, FX_DWORD len) { aes_encrypt_cbc(dest, src, len, (AESContext*)context); } diff --git a/core/src/fdrm/crypto/fx_crypt_sha.cpp b/core/src/fdrm/crypto/fx_crypt_sha.cpp index 1a55d11633..55a3f0e5bf 100644 --- a/core/src/fdrm/crypto/fx_crypt_sha.cpp +++ b/core/src/fdrm/crypto/fx_crypt_sha.cpp @@ -82,14 +82,14 @@ static void SHATransform(unsigned int * digest, unsigned int * block) digest[3] += d; digest[4] += e; } -void CRYPT_SHA1Start(FX_LPVOID context) +void CRYPT_SHA1Start(void* context) { SHA_State * s = (SHA_State*)context; SHA_Core_Init(s->h); s->blkused = 0; s->lenhi = s->lenlo = 0; } -void CRYPT_SHA1Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size) +void CRYPT_SHA1Update(void* context, const uint8_t* data, FX_DWORD size) { SHA_State * s = (SHA_State*)context; unsigned char *q = (unsigned char *)data; @@ -121,7 +121,7 @@ void CRYPT_SHA1Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size) s->blkused = len; } } -void CRYPT_SHA1Finish(FX_LPVOID context, uint8_t digest[20]) +void CRYPT_SHA1Finish(void* context, uint8_t digest[20]) { SHA_State * s = (SHA_State*)context; int i; @@ -154,7 +154,7 @@ void CRYPT_SHA1Finish(FX_LPVOID context, uint8_t digest[20]) digest[i * 4 + 3] = (s->h[i]) & 0xFF; } } -void CRYPT_SHA1Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[20]) +void CRYPT_SHA1Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[20]) { SHA_State s; CRYPT_SHA1Start(&s); @@ -181,7 +181,7 @@ sha256_context; (b)[(i) + 2] = (uint8_t) ( (n) >> 8 ); \ (b)[(i) + 3] = (uint8_t) ( (n) ); \ } -void CRYPT_SHA256Start( FX_LPVOID context ) +void CRYPT_SHA256Start( void* context ) { sha256_context *ctx = (sha256_context *)context; ctx->total[0] = 0; @@ -315,7 +315,7 @@ static void sha256_process( sha256_context *ctx, const uint8_t data[64] ) ctx->state[6] += G; ctx->state[7] += H; } -void CRYPT_SHA256Update( void* context, FX_LPCBYTE input, FX_DWORD length ) +void CRYPT_SHA256Update( void* context, const uint8_t* input, FX_DWORD length ) { sha256_context *ctx = (sha256_context *)context; FX_DWORD left, fill; @@ -353,7 +353,7 @@ static const uint8_t sha256_padding[64] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -void CRYPT_SHA256Finish( FX_LPVOID context, uint8_t digest[32] ) +void CRYPT_SHA256Finish( void* context, uint8_t digest[32] ) { sha256_context *ctx = (sha256_context *)context; FX_DWORD last, padn; @@ -377,7 +377,7 @@ void CRYPT_SHA256Finish( FX_LPVOID context, uint8_t digest[32] ) PUT_FX_DWORD( ctx->state[6], digest, 24 ); PUT_FX_DWORD( ctx->state[7], digest, 28 ); } -void CRYPT_SHA256Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[32]) +void CRYPT_SHA256Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[32]) { sha256_context ctx; CRYPT_SHA256Start(&ctx); @@ -389,7 +389,7 @@ typedef struct { uint64_t state[8]; uint8_t buffer[128]; } sha384_context; -uint64_t FX_ato64i(FX_LPCSTR str) +uint64_t FX_ato64i(const FX_CHAR* str) { FXSYS_assert(str != NULL); uint64_t ret = 0; @@ -411,7 +411,7 @@ uint64_t FX_ato64i(FX_LPCSTR str) } return ret; } -void CRYPT_SHA384Start(FX_LPVOID context) +void CRYPT_SHA384Start(void* context) { if (context == NULL) { return; @@ -452,7 +452,7 @@ static const uint8_t sha384_padding[128] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; #define SHA384_R(t) (W[t] = SHA384_S1(W[t - 2]) + W[t - 7] + SHA384_S0(W[t - 15]) + W[t - 16]) -static FX_LPCSTR constants[] = { +static const FX_CHAR* constants[] = { "428a2f98d728ae22", "7137449123ef65cd", "b5c0fbcfec4d3b2f", @@ -624,7 +624,7 @@ static void sha384_process( sha384_context *ctx, const uint8_t data[128] ) ctx->state[6] += G; ctx->state[7] += H; } -void CRYPT_SHA384Update(FX_LPVOID context, FX_LPCBYTE input, FX_DWORD length) +void CRYPT_SHA384Update(void* context, const uint8_t* input, FX_DWORD length) { sha384_context *ctx = (sha384_context *)context; FX_DWORD left, fill; @@ -655,7 +655,7 @@ void CRYPT_SHA384Update(FX_LPVOID context, FX_LPCBYTE input, FX_DWORD length) (void *) input, length ); } } -void CRYPT_SHA384Finish(FX_LPVOID context, uint8_t digest[48]) +void CRYPT_SHA384Finish(void* context, uint8_t digest[48]) { sha384_context *ctx = (sha384_context *)context; FX_DWORD last, padn; @@ -678,14 +678,14 @@ void CRYPT_SHA384Finish(FX_LPVOID context, uint8_t digest[48]) PUT_FX_64DWORD(ctx->state[4], digest, 32); PUT_FX_64DWORD(ctx->state[5], digest, 40); } -void CRYPT_SHA384Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[64]) +void CRYPT_SHA384Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[64]) { sha384_context context; CRYPT_SHA384Start(&context); CRYPT_SHA384Update(&context, data, size); CRYPT_SHA384Finish(&context, digest); } -void CRYPT_SHA512Start(FX_LPVOID context) +void CRYPT_SHA512Start(void* context) { if (context == NULL) { return; @@ -701,11 +701,11 @@ void CRYPT_SHA512Start(FX_LPVOID context) ctx->state[6] = FX_ato64i("1f83d9abfb41bd6b"); ctx->state[7] = FX_ato64i("5be0cd19137e2179"); } -void CRYPT_SHA512Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size) +void CRYPT_SHA512Update(void* context, const uint8_t* data, FX_DWORD size) { CRYPT_SHA384Update(context, data, size); } -void CRYPT_SHA512Finish(FX_LPVOID context, uint8_t digest[64]) +void CRYPT_SHA512Finish(void* context, uint8_t digest[64]) { sha384_context *ctx = (sha384_context *)context; FX_DWORD last, padn; @@ -730,7 +730,7 @@ void CRYPT_SHA512Finish(FX_LPVOID context, uint8_t digest[64]) PUT_FX_64DWORD(ctx->state[6], digest, 48); PUT_FX_64DWORD(ctx->state[7], digest, 56); } -void CRYPT_SHA512Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[64]) +void CRYPT_SHA512Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[64]) { sha384_context context; CRYPT_SHA512Start(&context); diff --git a/core/src/fpdfapi/fpdf_basic_module.cpp b/core/src/fpdfapi/fpdf_basic_module.cpp index d564bdb687..e3ec425ff6 100644 --- a/core/src/fpdfapi/fpdf_basic_module.cpp +++ b/core/src/fpdfapi/fpdf_basic_module.cpp @@ -50,18 +50,18 @@ CPDF_ModuleMgr::~CPDF_ModuleMgr() delete m_pRenderModule; } } -void CPDF_ModuleMgr::SetDownloadCallback(FX_BOOL (*callback)(FX_LPCSTR module_name)) +void CPDF_ModuleMgr::SetDownloadCallback(FX_BOOL (*callback)(const FX_CHAR* module_name)) { m_pDownloadCallback = callback; } -FX_BOOL CPDF_ModuleMgr::DownloadModule(FX_LPCSTR module_name) +FX_BOOL CPDF_ModuleMgr::DownloadModule(const FX_CHAR* module_name) { if (m_pDownloadCallback == NULL) { return FALSE; } return m_pDownloadCallback(module_name); } -void CPDF_ModuleMgr::NotifyModuleAvailable(FX_LPCSTR module_name) +void CPDF_ModuleMgr::NotifyModuleAvailable(const FX_CHAR* module_name) { if (FXSYS_strcmp(module_name, ADDIN_NAME_CJK) == 0) { m_pPageModule->NotifyCJKAvailable(); @@ -69,7 +69,7 @@ void CPDF_ModuleMgr::NotifyModuleAvailable(FX_LPCSTR module_name) m_pRenderModule->NotifyDecoderAvailable(); } } -void CPDF_ModuleMgr::RegisterSecurityHandler(FX_LPCSTR filter, CPDF_SecurityHandler * (*CreateHandler)(void* param), void* param) +void CPDF_ModuleMgr::RegisterSecurityHandler(const FX_CHAR* filter, CPDF_SecurityHandler * (*CreateHandler)(void* param), void* param) { if (CreateHandler == NULL) { m_SecurityHandlerMap.RemoveKey(filter); @@ -80,15 +80,15 @@ void CPDF_ModuleMgr::RegisterSecurityHandler(FX_LPCSTR filter, CPDF_SecurityHand m_SecurityHandlerMap.SetAt(FX_BSTRC("_param_") + filter, param); } } -void CPDF_ModuleMgr::SetPrivateData(FX_LPVOID module_id, FX_LPVOID pData, PD_CALLBACK_FREEDATA callback) +void CPDF_ModuleMgr::SetPrivateData(void* module_id, void* pData, PD_CALLBACK_FREEDATA callback) { m_privateData.SetPrivateData(module_id, pData, callback); } -FX_LPVOID CPDF_ModuleMgr::GetPrivateData(FX_LPVOID module_id) +void* CPDF_ModuleMgr::GetPrivateData(void* module_id) { return m_privateData.GetPrivateData(module_id); } -CPDF_SecurityHandler* CPDF_ModuleMgr::CreateSecurityHandler(FX_LPCSTR filter) +CPDF_SecurityHandler* CPDF_ModuleMgr::CreateSecurityHandler(const FX_CHAR* filter) { CPDF_SecurityHandler* (*CreateHandler)(void*) = NULL; if (!m_SecurityHandlerMap.Lookup(filter, (void*&)CreateHandler)) { diff --git a/core/src/fpdfapi/fpdf_edit/editint.h b/core/src/fpdfapi/fpdf_edit/editint.h index 38c33439ec..3a9d1588e0 100644 --- a/core/src/fpdfapi/fpdf_edit/editint.h +++ b/core/src/fpdfapi/fpdf_edit/editint.h @@ -15,7 +15,7 @@ public: FX_BOOL Start(); int32_t CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj); - int32_t CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize); + int32_t CompressIndirectObject(FX_DWORD dwObjNum, const uint8_t* pBuffer, FX_DWORD dwSize); FX_FILESIZE End(CPDF_Creator* pCreator); @@ -38,7 +38,7 @@ public: int32_t CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj, CPDF_Creator *pCreator); - int32_t CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator); + int32_t CompressIndirectObject(FX_DWORD dwObjNum, const uint8_t* pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator); FX_BOOL End(CPDF_Creator *pCreator, FX_BOOL bEOF = FALSE); FX_BOOL AddObjectNumberToIndexArray(FX_DWORD objnum); diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp index 65b482bf30..717386041d 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp @@ -99,7 +99,7 @@ void CPDF_PageContentGenerate::ProcessImage(CFX_ByteTextBuf& buf, CPDF_ImageObje buf << "/" << PDF_NameEncode(name) << " Do Q\n"; } } -void CPDF_PageContentGenerate::ProcessForm(CFX_ByteTextBuf& buf, FX_LPCBYTE data, FX_DWORD size, CFX_Matrix& matrix) +void CPDF_PageContentGenerate::ProcessForm(CFX_ByteTextBuf& buf, const uint8_t* data, FX_DWORD size, CFX_Matrix& matrix) { if (!data || !size) { return; @@ -111,7 +111,7 @@ void CPDF_PageContentGenerate::ProcessForm(CFX_ByteTextBuf& buf, FX_LPCBYTE data CFX_FloatRect bbox = m_pPage->GetPageBBox(); matrix.TransformRect(bbox); pFormDict->SetAtRect(FX_BSTR("BBox"), bbox); - pStream->InitStream((FX_LPBYTE)data, size, pFormDict); + pStream->InitStream((uint8_t*)data, size, pFormDict); buf << "q " << matrix << " cm "; CFX_ByteString name = RealizeResource(pStream, "XObject"); buf << "/" << PDF_NameEncode(name) << " Do Q\n"; @@ -142,7 +142,7 @@ void CPDF_PageContentGenerate::TransformContent(CFX_Matrix& matrix) size += pContentArray[i]->GetSize() + 1; } int pos = 0; - FX_LPBYTE pBuf = FX_Alloc(uint8_t, size); + uint8_t* pBuf = FX_Alloc(uint8_t, size); for (i = 0; i < iCount; ++i) { FXSYS_memcpy32(pBuf + pos, pContentArray[i]->GetData(), pContentArray[i]->GetSize()); pos += pContentArray[i]->GetSize() + 1; diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp index 035baa398f..0091613120 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp @@ -8,9 +8,9 @@ #include "editint.h" #define PDF_OBJECTSTREAM_MAXLENGTH (256 * 1024) #define PDF_XREFSTREAM_MAXSIZE 10000 -extern void FlateEncode(const uint8_t* src_buf, FX_DWORD src_data, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); -extern void FlateEncode(FX_LPCBYTE src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns, - FX_LPBYTE& dest_buf, FX_DWORD& dest_size); +extern void FlateEncode(const uint8_t* src_buf, FX_DWORD src_data, uint8_t*& dest_buf, FX_DWORD& dest_size); +extern void FlateEncode(const uint8_t* src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns, + uint8_t*& dest_buf, FX_DWORD& dest_size); extern FX_BOOL IsSignatureDict(const CPDF_Dictionary* pDict); int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive *pFile, FX_FILESIZE& offset) { @@ -283,12 +283,12 @@ int32_t PDF_CreatorWriteEncrypt(const CPDF_Dictionary* pEncryptDict, FX_DWORD dw offset += len + 6; return offset; } -FX_BOOL PDF_GenerateFileID(FX_DWORD dwSeed1, FX_DWORD dwSeed2, FX_LPDWORD pBuffer) +FX_BOOL PDF_GenerateFileID(FX_DWORD dwSeed1, FX_DWORD dwSeed2, FX_DWORD* pBuffer) { if (!pBuffer) { return FALSE; } - FX_LPVOID pContext = FX_Random_MT_Start(dwSeed1); + void* pContext = FX_Random_MT_Start(dwSeed1); int32_t i = 0; for (i = 0; i < 2; i++) { *pBuffer++ = FX_Random_MT_Generate(pContext); @@ -307,9 +307,9 @@ public: CPDF_FlateEncoder(); ~CPDF_FlateEncoder(); FX_BOOL Initialize(CPDF_Stream* pStream, FX_BOOL bFlateEncode); - FX_BOOL Initialize(FX_LPCBYTE pBuffer, FX_DWORD size, FX_BOOL bFlateEncode, FX_BOOL bXRefStream = FALSE); + FX_BOOL Initialize(const uint8_t* pBuffer, FX_DWORD size, FX_BOOL bFlateEncode, FX_BOOL bXRefStream = FALSE); void CloneDict(); - FX_LPBYTE m_pData; + uint8_t* m_pData; FX_DWORD m_dwSize; CPDF_Dictionary* m_pDict; FX_BOOL m_bCloned; @@ -339,13 +339,13 @@ FX_BOOL CPDF_FlateEncoder::Initialize(CPDF_Stream* pStream, FX_BOOL bFlateEncode CPDF_StreamAcc destAcc; destAcc.LoadAllData(pStream); m_dwSize = destAcc.GetSize(); - m_pData = (FX_LPBYTE)destAcc.DetachData(); + m_pData = (uint8_t*)destAcc.DetachData(); m_pDict = (CPDF_Dictionary*)pStream->GetDict()->Clone(); m_pDict->RemoveAt(FX_BSTRC("Filter")); m_bNewData = TRUE; m_bCloned = TRUE; } else { - m_pData = (FX_LPBYTE)m_Acc.GetData(); + m_pData = (uint8_t*)m_Acc.GetData(); m_dwSize = m_Acc.GetSize(); m_pDict = pStream->GetDict(); } @@ -362,10 +362,10 @@ FX_BOOL CPDF_FlateEncoder::Initialize(CPDF_Stream* pStream, FX_BOOL bFlateEncode m_pDict->RemoveAt("DecodeParms"); return TRUE; } -FX_BOOL CPDF_FlateEncoder::Initialize(FX_LPCBYTE pBuffer, FX_DWORD size, FX_BOOL bFlateEncode, FX_BOOL bXRefStream) +FX_BOOL CPDF_FlateEncoder::Initialize(const uint8_t* pBuffer, FX_DWORD size, FX_BOOL bFlateEncode, FX_BOOL bXRefStream) { if (!bFlateEncode) { - m_pData = (FX_LPBYTE)pBuffer; + m_pData = (uint8_t*)pBuffer; m_dwSize = size; return TRUE; } @@ -391,8 +391,8 @@ class CPDF_Encryptor public: CPDF_Encryptor(); ~CPDF_Encryptor(); - FX_BOOL Initialize(CPDF_CryptoHandler* pHandler, int objnum, FX_LPBYTE src_data, FX_DWORD src_size); - FX_LPBYTE m_pData; + FX_BOOL Initialize(CPDF_CryptoHandler* pHandler, int objnum, uint8_t* src_data, FX_DWORD src_size); + uint8_t* m_pData; FX_DWORD m_dwSize; FX_BOOL m_bNewBuf; }; @@ -402,13 +402,13 @@ CPDF_Encryptor::CPDF_Encryptor() m_dwSize = 0; m_bNewBuf = FALSE; } -FX_BOOL CPDF_Encryptor::Initialize(CPDF_CryptoHandler* pHandler, int objnum, FX_LPBYTE src_data, FX_DWORD src_size) +FX_BOOL CPDF_Encryptor::Initialize(CPDF_CryptoHandler* pHandler, int objnum, uint8_t* src_data, FX_DWORD src_size) { if (src_size == 0) { return TRUE; } if (pHandler == NULL) { - m_pData = (FX_LPBYTE)src_data; + m_pData = (uint8_t*)src_data; m_dwSize = src_size; m_bNewBuf = FALSE; return TRUE; @@ -446,7 +446,7 @@ int32_t CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_ m_Buffer << pObj; return 1; } -int32_t CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize) +int32_t CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, const uint8_t* pBuffer, FX_DWORD dwSize) { m_ObjNumArray.Add(dwObjNum); m_OffsetArray.Add(m_Buffer.GetLength()); @@ -564,7 +564,7 @@ int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Ob } return EndObjectStream(pCreator); } -int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator) +int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, const uint8_t* pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator) { if (!pCreator) { return 0; @@ -958,7 +958,7 @@ int32_t CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) } return 0; } -int32_t CPDF_Creator::WriteIndirectObjectToStream(FX_DWORD objnum, FX_LPCBYTE pBuffer, FX_DWORD dwSize) +int32_t CPDF_Creator::WriteIndirectObjectToStream(FX_DWORD objnum, const uint8_t* pBuffer, FX_DWORD dwSize) { if (!m_pXRefStream) { return 1; @@ -1104,8 +1104,8 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, F break; } CPDF_Encryptor encryptor; - encryptor.Initialize(m_pCryptoHandler, objnum, (FX_LPBYTE)str.c_str(), str.GetLength()); - CFX_ByteString content = PDF_EncodeString(CFX_ByteString((FX_LPCSTR)encryptor.m_pData, encryptor.m_dwSize), bHex); + encryptor.Initialize(m_pCryptoHandler, objnum, (uint8_t*)str.c_str(), str.GetLength()); + CFX_ByteString content = PDF_EncodeString(CFX_ByteString((const FX_CHAR*)encryptor.m_pData, encryptor.m_dwSize), bHex); if ((len = m_File.AppendString(content)) < 0) { return -1; } @@ -1252,8 +1252,8 @@ int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) return 0; } m_ObjectOffset[objnum] = m_Offset; - FX_LPVOID valuetemp = NULL; - FX_BOOL bExistInMap = m_pDocument->m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, valuetemp); + void* valuetemp = NULL; + FX_BOOL bExistInMap = m_pDocument->m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, valuetemp); FX_BOOL bObjStm = (m_pParser->m_V5Type[objnum] == 2) && m_pEncryptDict && !m_pXRefStream; if(m_pParser->m_bVersionUpdated || m_bSecurityChanged || bExistInMap || bObjStm) { CPDF_Object* pObj = m_pDocument->GetIndirectObject(objnum); @@ -1326,7 +1326,7 @@ int32_t CPDF_Creator::WriteOldObjs(IFX_Pause *pPause) } m_ObjectSize[objnum] = (FX_DWORD)(m_Offset - m_ObjectOffset[objnum]); if (pPause && pPause->NeedToPauseNow()) { - m_Pos = (FX_LPVOID)(uintptr_t)(objnum + 1); + m_Pos = (void*)(uintptr_t)(objnum + 1); return 1; } } @@ -1339,7 +1339,7 @@ int32_t CPDF_Creator::WriteNewObjs(FX_BOOL bIncremental, IFX_Pause *pPause) while (index < iCount) { FX_DWORD objnum = m_NewObjNumArray.ElementAt(index); CPDF_Object *pObj = NULL; - m_pDocument->m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, (FX_LPVOID&)pObj); + m_pDocument->m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, (void*&)pObj); if (NULL == pObj) { ++index; continue; @@ -1390,7 +1390,7 @@ void CPDF_Creator::InitNewObjNumOffsets() while (pos) { size_t key = 0; CPDF_Object* pObj; - m_pDocument->m_IndirectObjs.GetNextAssoc(pos, (FX_LPVOID&)key, (FX_LPVOID&)pObj); + m_pDocument->m_IndirectObjs.GetNextAssoc(pos, (void*&)key, (void*&)pObj); FX_DWORD objnum = (FX_DWORD)key; if (pObj->GetObjNum() == -1) { continue; @@ -1517,7 +1517,7 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause) } else { IFX_FileRead* pSrcFile = m_pParser->GetFileAccess(); m_Offset = pSrcFile->GetSize(); - m_Pos = (FX_LPVOID)(uintptr_t)m_Offset; + m_Pos = (void*)(uintptr_t)m_Offset; m_iStage = 15; } } @@ -1536,7 +1536,7 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause) } src_size -= block_size; if (pPause && pPause->NeedToPauseNow()) { - m_Pos = (FX_LPVOID)(uintptr_t)src_size; + m_Pos = (void*)(uintptr_t)src_size; return 1; } } @@ -1569,7 +1569,7 @@ int32_t CPDF_Creator::WriteDoc_Stage2(IFX_Pause *pPause) FXSYS_assert(m_iStage >= 20 || m_iStage < 30); if (m_iStage == 20) { if ((m_dwFlags & FPDFCREATE_INCREMENTAL) == 0 && m_pParser) { - m_Pos = (FX_LPVOID)(uintptr_t)0; + m_Pos = (void*)(uintptr_t)0; m_iStage = 21; } else { m_iStage = 25; @@ -1583,7 +1583,7 @@ int32_t CPDF_Creator::WriteDoc_Stage2(IFX_Pause *pPause) m_iStage = 25; } if (m_iStage == 25) { - m_Pos = (FX_LPVOID)(uintptr_t)0; + m_Pos = (void*)(uintptr_t)0; m_iStage = 26; } if (m_iStage == 26) { @@ -1630,13 +1630,13 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) if (m_File.AppendString(str) < 0) { return -1; } - m_Pos = (FX_LPVOID)(uintptr_t)1; + m_Pos = (void*)(uintptr_t)1; m_iStage = 81; } else { if (m_File.AppendString(FX_BSTRC("xref\r\n")) < 0) { return -1; } - m_Pos = (FX_LPVOID)(uintptr_t)0; + m_Pos = (void*)(uintptr_t)0; m_iStage = 82; } } else { @@ -1675,7 +1675,7 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) break; } if (pPause && pPause->NeedToPauseNow()) { - m_Pos = (FX_LPVOID)(uintptr_t)i; + m_Pos = (void*)(uintptr_t)i; return 1; } } @@ -1715,7 +1715,7 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) } } if (pPause && (i % 100) == 0 && pPause->NeedToPauseNow()) { - m_Pos = (FX_LPVOID)(uintptr_t)i; + m_Pos = (void*)(uintptr_t)i; return 1; } } @@ -1976,7 +1976,7 @@ void CPDF_Creator::Clear() m_pIDArray = NULL; } } -FX_BOOL CPDF_Creator::Create(FX_LPCSTR filename, FX_DWORD flags) +FX_BOOL CPDF_Creator::Create(const FX_CHAR* filename, FX_DWORD flags) { if (!m_File.AttachFile(filename)) { return FALSE; @@ -1987,7 +1987,7 @@ FX_BOOL CPDF_Creator::Create(FX_LPCSTR filename, FX_DWORD flags) } return bRet; } -FX_BOOL CPDF_Creator::Create(FX_LPCWSTR filename, FX_DWORD flags) +FX_BOOL CPDF_Creator::Create(const FX_WCHAR* filename, FX_DWORD flags) { if (!m_File.AttachFile(filename)) { return FALSE; @@ -2028,7 +2028,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault ) CPDF_Array* pOldIDArray = m_pParser ? m_pParser->GetIDArray() : NULL; FX_BOOL bNewId = !m_pIDArray; if (!m_pIDArray) { - FX_LPDWORD pBuffer = NULL; + FX_DWORD* pBuffer = NULL; m_pIDArray = CPDF_Array::Create(); CPDF_Object* pID1 = pOldIDArray ? pOldIDArray->GetElement(0) : NULL; if (pID1) { @@ -2036,7 +2036,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault ) } else { pBuffer = FX_Alloc(FX_DWORD, 4); PDF_GenerateFileID((FX_DWORD)(uintptr_t)this, m_dwLastObjNum, pBuffer); - CFX_ByteStringC bsBuffer((FX_LPCBYTE)pBuffer, 4 * sizeof(FX_DWORD)); + CFX_ByteStringC bsBuffer((const uint8_t*)pBuffer, 4 * sizeof(FX_DWORD)); m_pIDArray->Add(CPDF_String::Create(bsBuffer, TRUE), m_pDocument); } if (pBuffer) { @@ -2052,9 +2052,9 @@ void CPDF_Creator::InitID(FX_BOOL bDefault ) m_pIDArray->Add(pID2->Clone()); return; } - FX_LPDWORD pBuffer = FX_Alloc(FX_DWORD, 4); + FX_DWORD* pBuffer = FX_Alloc(FX_DWORD, 4); PDF_GenerateFileID((FX_DWORD)(uintptr_t)this, m_dwLastObjNum, pBuffer); - CFX_ByteStringC bsBuffer((FX_LPCBYTE)pBuffer, 4 * sizeof(FX_DWORD)); + CFX_ByteStringC bsBuffer((const uint8_t*)pBuffer, 4 * sizeof(FX_DWORD)); m_pIDArray->Add(CPDF_String::Create(bsBuffer, TRUE), m_pDocument); FX_Free(pBuffer); return; @@ -2065,7 +2065,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault ) CPDF_StandardSecurityHandler handler; CFX_ByteString user_pass = m_pParser->GetPassword(); FX_DWORD flag = PDF_ENCRYPT_CONTENT; - handler.OnCreate(m_pEncryptDict, m_pIDArray, (FX_LPCBYTE)user_pass, user_pass.GetLength(), flag); + handler.OnCreate(m_pEncryptDict, m_pIDArray, (const uint8_t*)user_pass, user_pass.GetLength(), flag); if (m_pCryptoHandler && m_bNewCrypto) { delete m_pCryptoHandler; } diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index d2d81d5566..7176a62435 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -226,7 +226,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTW* pLogFont, FX_BOOL bVert, FX_B FXSYS_strcpy(lfa.lfFaceName, face.c_str()); return AddWindowsFont(&lfa, bVert, bTranslateName); } -extern CFX_ByteString _FPDF_GetNameFromTT(FX_LPCBYTE name_table, FX_DWORD name); +extern CFX_ByteString _FPDF_GetNameFromTT(const uint8_t* name_table, FX_DWORD name); CFX_ByteString _FPDF_GetPSNameFromTT(HDC hDC) { CFX_ByteString result; @@ -429,11 +429,11 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, FX_BOOL bVert, FX_B } #endif #if (_FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_) -uint32_t FX_GetLangHashCode( FX_LPCSTR pStr) +uint32_t FX_GetLangHashCode( const FX_CHAR* pStr) { FXSYS_assert( pStr != NULL); int32_t iLength = FXSYS_strlen(pStr); - FX_LPCSTR pStrEnd = pStr + iLength; + const FX_CHAR* pStrEnd = pStr + iLength; uint32_t uHashCode = 0; while ( pStr < pStrEnd) { uHashCode = 31 * uHashCode + tolower(*pStr++); @@ -529,7 +529,7 @@ static FX_WORD FX_GetCsFromLangCode(uint32_t uCode) }; return 0; } -static FX_WORD FX_GetCharsetFromLang(FX_LPCSTR pLang, int32_t iLength) +static FX_WORD FX_GetCharsetFromLang(const FX_CHAR* pLang, int32_t iLength) { FXSYS_assert(pLang); if (iLength < 0) { @@ -545,7 +545,7 @@ static void _CFString2CFXByteString(CFStringRef src, CFX_ByteString &dest) CFIndex used = 0; UInt8* pBuffer = (UInt8*)calloc(len+1, sizeof(UInt8)); CFStringGetBytes(src, range, kCFStringEncodingASCII, 0, false, pBuffer, len, &used); - dest = (FX_LPSTR)pBuffer; + dest = (FX_CHAR*)pBuffer; free(pBuffer); } FX_BOOL IsHasCharSet(CFArrayRef languages, const CFX_DWordArray &charSets) @@ -1141,7 +1141,7 @@ CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) return pDict; } int _PDF_GetStandardFontName(CFX_ByteString& name); -CPDF_Font* CPDF_Document::AddStandardFont(FX_LPCSTR font, CPDF_FontEncoding* pEncoding) +CPDF_Font* CPDF_Document::AddStandardFont(const FX_CHAR* font, CPDF_FontEncoding* pEncoding) { CFX_ByteString name(font, -1); if (_PDF_GetStandardFontName(name) < 0) { diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp index 8d105a5bd8..fd715240a4 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp @@ -10,7 +10,7 @@ #include "../../../include/fpdfapi/fpdf_render.h" #include "../fpdf_page/pageint.h" #include "../fpdf_render/render_int.h" -CPDF_Dictionary* CPDF_Image::InitJPEG(FX_LPBYTE pData, FX_DWORD size) +CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, FX_DWORD size) { int32_t width, height, color_trans, num_comps, bits; if (!CPDF_ModuleMgr::Get()->GetJpegModule()-> @@ -22,7 +22,7 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(FX_LPBYTE pData, FX_DWORD size) pDict->SetAtName("Subtype", "Image"); pDict->SetAtInteger("Width", width); pDict->SetAtInteger("Height", height); - FX_LPCSTR csname = NULL; + const FX_CHAR* csname = NULL; if (num_comps == 1) { csname = "DeviceGray"; } else if (num_comps == 3) { @@ -52,7 +52,7 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(FX_LPBYTE pData, FX_DWORD size) } return pDict; } -void CPDF_Image::SetJpegImage(FX_LPBYTE pData, FX_DWORD size) +void CPDF_Image::SetJpegImage(uint8_t* pData, FX_DWORD size) { CPDF_Dictionary *pDict = InitJPEG(pData, size); if (!pDict) { @@ -70,7 +70,7 @@ void CPDF_Image::SetJpegImage(IFX_FileRead *pFile) if (dwEstimateSize > 8192) { dwEstimateSize = 8192; } - FX_LPBYTE pData = FX_Alloc(uint8_t, dwEstimateSize); + uint8_t* pData = FX_Alloc(uint8_t, dwEstimateSize); pFile->ReadBlock(pData, 0, dwEstimateSize); CPDF_Dictionary *pDict = InitJPEG(pData, dwEstimateSize); FX_Free(pData); @@ -85,10 +85,10 @@ void CPDF_Image::SetJpegImage(IFX_FileRead *pFile) } m_pStream->InitStream(pFile, pDict); } -void _DCTEncodeBitmap(CPDF_Dictionary *pBitmapDict, const CFX_DIBitmap* pBitmap, int quality, FX_LPBYTE &buf, FX_STRSIZE &size) +void _DCTEncodeBitmap(CPDF_Dictionary *pBitmapDict, const CFX_DIBitmap* pBitmap, int quality, uint8_t* &buf, FX_STRSIZE &size) { } -void _JBIG2EncodeBitmap(CPDF_Dictionary *pBitmapDict, const CFX_DIBitmap *pBitmap, CPDF_Document *pDoc, FX_LPBYTE &buf, FX_STRSIZE &size, FX_BOOL bLossLess) +void _JBIG2EncodeBitmap(CPDF_Dictionary *pBitmapDict, const CFX_DIBitmap *pBitmap, CPDF_Document *pDoc, uint8_t* &buf, FX_STRSIZE &size, FX_BOOL bLossLess) { } void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_FileWrite *pFileWrite, IFX_FileRead *pFileRead, const CFX_DIBitmap* pMask, const CPDF_ImageSetParam* pParam) @@ -98,7 +98,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi if (BitmapWidth < 1 || BitmapHeight < 1) { return; } - FX_LPBYTE src_buf = pBitmap->GetBuffer(); + uint8_t* src_buf = pBitmap->GetBuffer(); int32_t src_pitch = pBitmap->GetPitch(); int32_t bpp = pBitmap->GetBPP(); FX_BOOL bUseMatte = pParam && pParam->pMatteColor && (pBitmap->GetFormat() == FXDIB_Argb); @@ -107,7 +107,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi pDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Image")); pDict->SetAtInteger(FX_BSTRC("Width"), BitmapWidth); pDict->SetAtInteger(FX_BSTRC("Height"), BitmapHeight); - FX_LPBYTE dest_buf = NULL; + uint8_t* dest_buf = NULL; FX_STRSIZE dest_pitch = 0, dest_size = 0, opType = -1; if (bpp == 1) { int32_t reset_a = 0, reset_r = 0, reset_g = 0, reset_b = 0; @@ -130,7 +130,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi pCS->AddName(FX_BSTRC("DeviceRGB")); pCS->AddInteger(1); CFX_ByteString ct; - FX_LPSTR pBuf = ct.GetBuffer(6); + FX_CHAR* pBuf = ct.GetBuffer(6); pBuf[0] = (FX_CHAR)reset_r; pBuf[1] = (FX_CHAR)reset_g; pBuf[2] = (FX_CHAR)reset_b; @@ -156,8 +156,8 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi pCS->AddName(FX_BSTRC("Indexed")); pCS->AddName(FX_BSTRC("DeviceRGB")); pCS->AddInteger(iPalette - 1); - FX_LPBYTE pColorTable = FX_Alloc2D(uint8_t, iPalette, 3); - FX_LPBYTE ptr = pColorTable; + uint8_t* pColorTable = FX_Alloc2D(uint8_t, iPalette, 3); + uint8_t* ptr = pColorTable; for (int32_t i = 0; i < iPalette; i ++) { FX_DWORD argb = pBitmap->GetPaletteArgb(i); ptr[0] = (uint8_t)(argb >> 16); @@ -204,7 +204,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi if (pMaskBitmap) { int32_t maskWidth = pMaskBitmap->GetWidth(); int32_t maskHeight = pMaskBitmap->GetHeight(); - FX_LPBYTE mask_buf = NULL; + uint8_t* mask_buf = NULL; FX_STRSIZE mask_size; CPDF_Dictionary* pMaskDict = new CPDF_Dictionary; pMaskDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("XObject")); @@ -270,7 +270,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi if (bUseMatte) { CFX_DIBitmap *pNewBitmap = new CFX_DIBitmap(); pNewBitmap->Create(BitmapWidth, BitmapHeight, FXDIB_Argb); - FX_LPBYTE dst_buf = pNewBitmap->GetBuffer(); + uint8_t* dst_buf = pNewBitmap->GetBuffer(); int32_t src_offset = 0; for (int32_t row = 0; row < BitmapHeight; row ++) { src_offset = row * src_pitch; @@ -300,7 +300,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi dest_buf = FX_Alloc2D(uint8_t, dest_pitch, BitmapHeight); dest_size = dest_pitch * BitmapHeight; // Safe since checked alloc returned. } - FX_LPBYTE pDest = dest_buf; + uint8_t* pDest = dest_buf; for (int32_t i = 0; i < BitmapHeight; i ++) { if (!bStream) { FXSYS_memcpy32(pDest, src_buf, dest_pitch); @@ -317,7 +317,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi } else { dest_buf = FX_Alloc(uint8_t, dest_pitch); } - FX_LPBYTE pDest = dest_buf; + uint8_t* pDest = dest_buf; int32_t src_offset = 0; int32_t dest_offset = 0; for (int32_t row = 0; row < BitmapHeight; row ++) { diff --git a/core/src/fpdfapi/fpdf_font/font_int.h b/core/src/fpdfapi/fpdf_font/font_int.h index 1e52607d98..6f32f4fa98 100644 --- a/core/src/fpdfapi/fpdf_font/font_int.h +++ b/core/src/fpdfapi/fpdf_font/font_int.h @@ -12,7 +12,7 @@ class CPDF_CMapManager public: CPDF_CMapManager(); ~CPDF_CMapManager(); - FX_LPVOID GetPackage(FX_BOOL bPrompt); + void* GetPackage(FX_BOOL bPrompt); CPDF_CMap* GetPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPrompt); CPDF_CID2UnicodeMap* GetCID2UnicodeMap(int charset, FX_BOOL bPrompt); void ReloadAll(); @@ -44,7 +44,7 @@ public: } m_EmbeddedToUnicodes[NUMBER_OF_CIDSETS]; private: CFX_MapPtrToPtr m_pStockMap; - FX_LPBYTE m_pContrastRamps; + uint8_t* m_pContrastRamps; }; struct _CMap_CodeRange { int m_CharSize; @@ -81,7 +81,7 @@ class CPDF_CMap public: CPDF_CMap(); FX_BOOL LoadPredefined(CPDF_CMapManager* pMgr, const FX_CHAR* name, FX_BOOL bPromptCJK); - FX_BOOL LoadEmbedded(FX_LPCBYTE pData, FX_DWORD dwSize); + FX_BOOL LoadEmbedded(const uint8_t* pData, FX_DWORD dwSize); void Release(); FX_BOOL IsLoaded() const { @@ -98,9 +98,9 @@ public: FX_WORD CIDFromCharCode(FX_DWORD charcode) const; FX_DWORD CharCodeFromCID(FX_WORD CID) const; int GetCharSize(FX_DWORD charcode) const; - FX_DWORD GetNextChar(FX_LPCSTR pString, int nStrLen, int& offset) const; - int CountChar(FX_LPCSTR pString, int size) const; - int AppendChar(FX_LPSTR str, FX_DWORD charcode) const; + FX_DWORD GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const; + int CountChar(const FX_CHAR* pString, int size) const; + int AppendChar(FX_CHAR* str, FX_DWORD charcode) const; typedef enum {OneByte, TwoBytes, MixedTwoBytes, MixedFourBytes} CodingScheme; protected: ~CPDF_CMap(); @@ -115,7 +115,7 @@ protected: int m_nCodeRanges; uint8_t* m_pLeadingBytes; FX_WORD* m_pMapping; - FX_LPBYTE m_pAddMapping; + uint8_t* m_pAddMapping; FX_BOOL m_bLoaded; const FXCMAP_CMap* m_pEmbedMap; CPDF_CMap* m_pUseMap; @@ -123,7 +123,7 @@ protected: class CPDF_PredefinedCMap { public: - FX_LPCSTR m_pName; + const FX_CHAR* m_pName; int m_Charset; int m_Coding; CPDF_CMap::CodingScheme m_CodingScheme; diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp index 0058e140d4..c6922d11f8 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp @@ -205,7 +205,7 @@ CFX_WideString CPDF_Font::DecodeString(const CFX_ByteString& str) const CFX_WideString result; int src_len = str.GetLength(); result.Reserve(src_len); - FX_LPCSTR src_buf = str; + const FX_CHAR* src_buf = str; int src_pos = 0; while (src_pos < src_len) { FX_DWORD charcode = GetNextChar(src_buf, src_len, src_pos); @@ -222,8 +222,8 @@ CFX_ByteString CPDF_Font::EncodeString(const CFX_WideString& str) const { CFX_ByteString result; int src_len = str.GetLength(); - FX_LPSTR dest_buf = result.GetBuffer(src_len * 2); - FX_LPCWSTR src_buf = str.c_str(); + FX_CHAR* dest_buf = result.GetBuffer(src_len * 2); + const FX_WCHAR* src_buf = str.c_str(); int dest_pos = 0; for (int src_pos = 0; src_pos < src_len; src_pos ++) { FX_DWORD charcode = CharCodeFromUnicode(src_buf[src_pos]); @@ -289,7 +289,7 @@ void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) if (m_pFontFile == NULL) { return; } - FX_LPCBYTE pFontData = m_pFontFile->GetData(); + const uint8_t* pFontData = m_pFontFile->GetData(); FX_DWORD dwFontSize = m_pFontFile->GetSize(); m_Font.LoadEmbedded(pFontData, dwFontSize); if (m_Font.m_Face == NULL) { @@ -369,7 +369,7 @@ void CPDF_Font::LoadUnicodeMap() m_pToUnicodeMap = new CPDF_ToUnicodeMap; m_pToUnicodeMap->Load(pStream); } -int CPDF_Font::GetStringWidth(FX_LPCSTR pString, int size) +int CPDF_Font::GetStringWidth(const FX_CHAR* pString, int size) { int offset = 0; int width = 0; @@ -431,7 +431,7 @@ CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc, CPDF_Dictionary* pFontDic int i; int count = sizeof(ChineseFontNames) / sizeof(ChineseFontNames[0]); for (i = 0; i < count; ++i) { - if (tag == CFX_ByteString((FX_LPCSTR)ChineseFontNames[i])) { + if (tag == CFX_ByteString((const FX_CHAR*)ChineseFontNames[i])) { break; } } @@ -500,7 +500,7 @@ CFX_WideString CPDF_ToUnicodeMap::Lookup(FX_DWORD charcode) if (unicode != 0xffff) { return unicode; } - FX_LPCWSTR buf = m_MultiCharBuf.GetBuffer(); + const FX_WCHAR* buf = m_MultiCharBuf.GetBuffer(); FX_DWORD buf_len = m_MultiCharBuf.GetLength(); if (buf == NULL || buf_len == 0) { return CFX_WideString(); @@ -534,7 +534,7 @@ FX_DWORD CPDF_ToUnicodeMap::ReverseLookup(FX_WCHAR unicode) } static FX_DWORD _StringToCode(FX_BSTR str) { - FX_LPCSTR buf = str.GetCStr(); + const FX_CHAR* buf = str.GetCStr(); int len = str.GetLength(); if (len == 0) { return 0; @@ -586,7 +586,7 @@ static CFX_WideString _StringDataAdd(CFX_WideString str) } static CFX_WideString _StringToWideString(FX_BSTR str) { - FX_LPCSTR buf = str.GetCStr(); + const FX_CHAR* buf = str.GetCStr(); int len = str.GetLength(); if (len == 0) { return CFX_WideString(); @@ -816,7 +816,7 @@ FX_BOOL CPDF_Font::IsStandardFont() const } return TRUE; } -extern FX_LPCSTR PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode); +extern const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode); CPDF_SimpleFont::CPDF_SimpleFont(int fonttype) : CPDF_Font(fonttype) { FXSYS_memset8(m_CharBBox, 0xff, sizeof m_CharBBox); @@ -907,13 +907,13 @@ void CPDF_SimpleFont::GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level) rect.bottom = m_CharBBox[charcode].Bottom; rect.top = m_CharBBox[charcode].Top; } -FX_LPCSTR GetAdobeCharName(int iBaseEncoding, const CFX_ByteString* pCharNames, int charcode) +const FX_CHAR* GetAdobeCharName(int iBaseEncoding, const CFX_ByteString* pCharNames, int charcode) { ASSERT(charcode >= 0 && charcode < 256); if (charcode < 0 || charcode >= 256) { return NULL; } - FX_LPCSTR name = NULL; + const FX_CHAR* name = NULL; if (pCharNames) { name = pCharNames[charcode]; } @@ -1081,8 +1081,8 @@ int CPDF_Type1Font::GlyphFromCharCodeExt(FX_DWORD charcode) } #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ struct _GlyphNameMap { - FX_LPCSTR m_pStrAdobe; - FX_LPCSTR m_pStrUnicode; + const FX_CHAR* m_pStrAdobe; + const FX_CHAR* m_pStrUnicode; }; static const _GlyphNameMap g_GlyphNameSubsts[] = { {"ff", "uniFB00"}, @@ -1094,10 +1094,10 @@ static const _GlyphNameMap g_GlyphNameSubsts[] = { extern "C" { static int compareString(const void* key, const void* element) { - return FXSYS_stricmp((FX_LPCSTR)key, ((_GlyphNameMap*)element)->m_pStrAdobe); + return FXSYS_stricmp((const FX_CHAR*)key, ((_GlyphNameMap*)element)->m_pStrAdobe); } } -static FX_LPCSTR _GlyphNameRemap(FX_LPCSTR pStrAdobe) +static const FX_CHAR* _GlyphNameRemap(const FX_CHAR* pStrAdobe) { _GlyphNameMap* found = (_GlyphNameMap*)FXSYS_bsearch(pStrAdobe, g_GlyphNameSubsts, sizeof g_GlyphNameSubsts / sizeof(_GlyphNameMap), sizeof(_GlyphNameMap), @@ -1164,7 +1164,7 @@ void CPDF_Type1Font::LoadGlyphMap() m_BaseEncoding = PDFFONT_ENCODING_STANDARD; } for (int charcode = 0; charcode < 256; charcode ++) { - FX_LPCSTR name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); + const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); if (name == NULL) { continue; } @@ -1207,7 +1207,7 @@ void CPDF_Type1Font::LoadGlyphMap() if (bCoreText) { if (m_Flags & PDFFONT_SYMBOLIC) { for (int charcode = 0; charcode < 256; charcode ++) { - FX_LPCSTR name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); + const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); if (name) { m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); m_GlyphIndex[charcode] = FXFT_Get_Name_Index(m_Font.m_Face, (char*)name); @@ -1244,12 +1244,12 @@ void CPDF_Type1Font::LoadGlyphMap() bUnicode = TRUE; } for (int charcode = 0; charcode < 256; charcode ++) { - FX_LPCSTR name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); + const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); if (name == NULL) { continue; } m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); - FX_LPCSTR pStrUnicode = _GlyphNameRemap(name); + const FX_CHAR* pStrUnicode = _GlyphNameRemap(name); if (pStrUnicode && 0 == FXFT_Get_Name_Index(m_Font.m_Face, (char*)name)) { name = pStrUnicode; } @@ -1289,7 +1289,7 @@ void CPDF_Type1Font::LoadGlyphMap() #endif if (m_Flags & PDFFONT_SYMBOLIC) { for (int charcode = 0; charcode < 256; charcode ++) { - FX_LPCSTR name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); + const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); if (name) { m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); m_GlyphIndex[charcode] = FXFT_Get_Name_Index(m_Font.m_Face, (char*)name); @@ -1322,7 +1322,7 @@ void CPDF_Type1Font::LoadGlyphMap() bUnicode = TRUE; } for (int charcode = 0; charcode < 256; charcode ++) { - FX_LPCSTR name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); + const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); if (name == NULL) { continue; } @@ -1475,7 +1475,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() } FX_BOOL bToUnicode = m_pFontDict->KeyExist(FX_BSTRC("ToUnicode")); for (int charcode = 0; charcode < 256; charcode ++) { - FX_LPCSTR name = GetAdobeCharName(baseEncoding, m_pCharNames, charcode); + const FX_CHAR* name = GetAdobeCharName(baseEncoding, m_pCharNames, charcode); if (name == NULL) { m_GlyphIndex[charcode] = m_pFontFile ? FXFT_Get_Char_Index(m_Font.m_Face, charcode) : -1; continue; @@ -1540,7 +1540,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() if (bGotOne) { if (baseEncoding != PDFFONT_ENCODING_BUILTIN) { for (int charcode = 0; charcode < 256; charcode ++) { - FX_LPCSTR name = GetAdobeCharName(baseEncoding, m_pCharNames, charcode); + const FX_CHAR* name = GetAdobeCharName(baseEncoding, m_pCharNames, charcode); if (name == NULL) { continue; } @@ -1572,7 +1572,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() const FX_WORD* pUnicodes = PDF_UnicodesForPredefinedCharSet(baseEncoding); for (int charcode = 0; charcode < 256; charcode ++) { if (m_pFontFile == NULL) { - FX_LPCSTR name = GetAdobeCharName(0, m_pCharNames, charcode); + const FX_CHAR* name = GetAdobeCharName(0, m_pCharNames, charcode); if (name != NULL) { m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); } else if (pUnicodes) { @@ -1603,14 +1603,16 @@ CPDF_Type3Font::~CPDF_Type3Font() { FX_POSITION pos = m_CacheMap.GetStartPosition(); while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_CacheMap.GetNextAssoc(pos, key, value); delete (CPDF_Type3Char*)value; } m_CacheMap.RemoveAll(); pos = m_DeletedMap.GetStartPosition(); while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_DeletedMap.GetNextAssoc(pos, key, value); delete (CPDF_Type3Char*)key; } @@ -1671,15 +1673,15 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) return NULL; } CPDF_Type3Char* pChar = NULL; - if (m_CacheMap.Lookup((FX_LPVOID)(uintptr_t)charcode, (FX_LPVOID&)pChar)) { + if (m_CacheMap.Lookup((void*)(uintptr_t)charcode, (void*&)pChar)) { if (pChar->m_bPageRequired && m_pPageResources) { delete pChar; - m_CacheMap.RemoveKey((FX_LPVOID)(uintptr_t)charcode); + m_CacheMap.RemoveKey((void*)(uintptr_t)charcode); return LoadChar(charcode, level + 1); } return pChar; } - FX_LPCSTR name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); + const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); if (name == NULL) { return NULL; } @@ -1703,7 +1705,7 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) rcBBox.right = FXSYS_round(char_rect.right * 1000); rcBBox.top = FXSYS_round(char_rect.top * 1000); rcBBox.bottom = FXSYS_round(char_rect.bottom * 1000); - m_CacheMap.SetAt((FX_LPVOID)(uintptr_t)charcode, pChar); + m_CacheMap.SetAt((void*)(uintptr_t)charcode, pChar); if (pChar->m_pForm->CountObjects() == 0) { delete pChar->m_pForm; pChar->m_pForm = NULL; diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp index 8e8fccd8a3..8d2f922fb1 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp @@ -264,7 +264,7 @@ const FX_WORD ZapfEncoding[256] = { 0x0000, 0x27B1, 0x27B2, 0x27B3, 0x27B4, 0x27B5, 0x27B6, 0x27B7, 0x27B8, 0x27B9, 0x27BA, 0x27BB, 0x27BC, 0x27BD, 0x27BE, 0x0000, }; -const FX_LPCSTR StandardEncodingNames[224] = { +const FX_CHAR* const StandardEncodingNames[224] = { "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", @@ -294,7 +294,7 @@ const FX_LPCSTR StandardEncodingNames[224] = { NULL, "ae", NULL, NULL, NULL, "dotlessi", NULL, NULL, "lslash", "oslash", "oe", "germandbls", NULL, NULL, NULL, NULL, }; -const FX_LPCSTR AdobeWinAnsiEncodingNames[224] = { +const FX_CHAR* const AdobeWinAnsiEncodingNames[224] = { "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", @@ -324,7 +324,7 @@ const FX_LPCSTR AdobeWinAnsiEncodingNames[224] = { "eth", "ntilde", "ograve", "oacute", "ocircumflex", "otilde", "odieresis", "divide", "oslash", "ugrave", "uacute", "ucircumflex", "udieresis", "yacute", "thorn", "ydieresis", }; -const FX_LPCSTR MacRomanEncodingNames[224] = { +const FX_CHAR* const MacRomanEncodingNames[224] = { "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", @@ -354,7 +354,7 @@ const FX_LPCSTR MacRomanEncodingNames[224] = { "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", }; -const FX_LPCSTR MacExpertEncodingNames[224] = { +const FX_CHAR* const MacExpertEncodingNames[224] = { "space", "exclamsmall", "Hungarumlautsmall", "centoldstyle", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", @@ -384,7 +384,7 @@ const FX_LPCSTR MacExpertEncodingNames[224] = { NULL, "lsuperior", "Ogoneksmall", "Brevesmall", "Macronsmall", "bsuperior", "nsuperior", "msuperior", "commasuperior", "periodsuperior", "Dotaccentsmall", "Ringsmall", NULL, NULL, NULL, NULL, }; -const FX_LPCSTR PDFDocEncodingNames[232] = { +const FX_CHAR* const PDFDocEncodingNames[232] = { "breve", "caron", "circumflex", "dotaccent", "hungarumlaut", "ogonek", "ring", "tilde", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", @@ -415,7 +415,7 @@ const FX_LPCSTR PDFDocEncodingNames[232] = { "eth", "ntilde", "ograve", "oacute", "ocircumflex", "otilde", "odieresis", "divide", "oslash", "ugrave", "uacute", "ucircumflex", "udieresis", "yacute", "thorn", "ydieresis", }; -const FX_LPCSTR AdobeSymbolEncodingNames[224] = { +const FX_CHAR* const AdobeSymbolEncodingNames[224] = { "space", "exclam", "universal", "numbersign", "existential", "percent", "ampersand", "suchthat", "parenleft", "parenright", "asteriskmath", "plus", "comma", "minus", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", @@ -445,7 +445,7 @@ const FX_LPCSTR AdobeSymbolEncodingNames[224] = { NULL, "angleright", "integral", "integraltp", "integralex", "integralbt", "parenrighttp", "parenrightex", "parenrightbt", "bracketrighttp", "bracketrightex", "bracketrightbt", "bracerighttp", "bracerightmid", "bracerightbt", NULL, }; -const FX_LPCSTR ZapfEncodingNames[224] = { +const FX_CHAR* const ZapfEncodingNames[224] = { "space", "a1", "a2", "a202", "a3", "a4", "a5", "a119", "a118", "a117", "a11", "a12", "a13", "a14", "a15", "a16", "a105", "a17", "a18", "a19", "a20", "a21", "a22", "a23", diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp index a6209cb536..bec2c90144 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -13,7 +13,7 @@ extern FX_DWORD FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode); extern short TT2PDF(int m, FXFT_Face face); extern FX_BOOL FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id); -extern FX_LPCSTR GetAdobeCharName(int iBaseEncoding, const CFX_ByteString* pCharNames, int charcode); +extern const FX_CHAR* GetAdobeCharName(int iBaseEncoding, const CFX_ByteString* pCharNames, int charcode); CPDF_CMapManager::CPDF_CMapManager() { m_bPrompted = FALSE; @@ -26,7 +26,7 @@ CPDF_CMapManager::~CPDF_CMapManager() CPDF_CMap* CPDF_CMapManager::GetPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPromptCJK) { CPDF_CMap* pCMap; - if (m_CMaps.Lookup(name, (FX_LPVOID&)pCMap)) { + if (m_CMaps.Lookup(name, (void*&)pCMap)) { return pCMap; } pCMap = LoadPredefinedCMap(name, bPromptCJK); @@ -39,14 +39,14 @@ CPDF_CMap* CPDF_CMapManager::GetPredefinedCMap(const CFX_ByteString& name, FX_BO CPDF_CMap* CPDF_CMapManager::LoadPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPromptCJK) { CPDF_CMap* pCMap = new CPDF_CMap; - FX_LPCSTR pname = name; + const FX_CHAR* pname = name; if (*pname == '/') { pname ++; } pCMap->LoadPredefined(this, pname, bPromptCJK); return pCMap; } -static const FX_LPCSTR g_CharsetNames[NUMBER_OF_CIDSETS] = {NULL, "GB1", "CNS1", "Japan1", "Korea1", "UCS" }; +static const FX_CHAR* const g_CharsetNames[NUMBER_OF_CIDSETS] = {NULL, "GB1", "CNS1", "Japan1", "Korea1", "UCS" }; static const int g_CharsetCPs[NUMBER_OF_CIDSETS] = {0, 936, 950, 932, 949, 1200 }; int _CharsetFromOrdering(const CFX_ByteString& Ordering) { @@ -66,7 +66,7 @@ void CPDF_CMapManager::DropAll(FX_BOOL bReload) while (pos) { CFX_ByteString name; CPDF_CMap* pCMap; - m_CMaps.GetNextAssoc(pos, name, (FX_LPVOID&)pCMap); + m_CMaps.GetNextAssoc(pos, name, (void*&)pCMap); if (pCMap == NULL) { continue; } @@ -347,7 +347,7 @@ const CPDF_PredefinedCMap g_PredefinedCMaps[] = { }; extern void FPDFAPI_FindEmbeddedCMap(const char* name, int charset, int coding, const FXCMAP_CMap*& pMap); extern FX_WORD FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, FX_DWORD charcode); -FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, FX_LPCSTR pName, FX_BOOL bPromptCJK) +FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, const FX_CHAR* pName, FX_BOOL bPromptCJK) { m_PredefinedCMap = pName; if (m_PredefinedCMap == FX_BSTRC("Identity-H") || m_PredefinedCMap == FX_BSTRC("Identity-V")) { @@ -396,7 +396,7 @@ extern "C" { return (*(FX_DWORD*)data1) - (*(FX_DWORD*)data2); } }; -FX_BOOL CPDF_CMap::LoadEmbedded(FX_LPCBYTE pData, FX_DWORD size) +FX_BOOL CPDF_CMap::LoadEmbedded(const uint8_t* pData, FX_DWORD size) { m_pMapping = FX_Alloc(FX_WORD, 65536); CPDF_CMapParser parser; @@ -462,7 +462,7 @@ FX_WORD CPDF_CMap::CIDFromCharCode(FX_DWORD charcode) const } return (FX_WORD)CID; } -static int _CheckCodeRange(FX_LPBYTE codes, int size, _CMap_CodeRange* pRanges, int nRanges) +static int _CheckCodeRange(uint8_t* codes, int size, _CMap_CodeRange* pRanges, int nRanges) { int iSeg = nRanges - 1; while (iSeg >= 0) { @@ -491,26 +491,26 @@ static int _CheckCodeRange(FX_LPBYTE codes, int size, _CMap_CodeRange* pRanges, } return 0; } -FX_DWORD CPDF_CMap::GetNextChar(FX_LPCSTR pString, int nStrLen, int& offset) const +FX_DWORD CPDF_CMap::GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const { switch (m_CodingScheme) { case OneByte: - return ((FX_LPBYTE)pString)[offset++]; + return ((uint8_t*)pString)[offset++]; case TwoBytes: offset += 2; - return ((FX_LPBYTE)pString)[offset - 2] * 256 + ((FX_LPBYTE)pString)[offset - 1]; + return ((uint8_t*)pString)[offset - 2] * 256 + ((uint8_t*)pString)[offset - 1]; case MixedTwoBytes: { - uint8_t byte1 = ((FX_LPBYTE)pString)[offset++]; + uint8_t byte1 = ((uint8_t*)pString)[offset++]; if (!m_pLeadingBytes[byte1]) { return byte1; } - uint8_t byte2 = ((FX_LPBYTE)pString)[offset++]; + uint8_t byte2 = ((uint8_t*)pString)[offset++]; return byte1 * 256 + byte2; } case MixedFourBytes: { uint8_t codes[4]; int char_size = 1; - codes[0] = ((FX_LPBYTE)pString)[offset++]; + codes[0] = ((uint8_t*)pString)[offset++]; _CMap_CodeRange* pRanges = (_CMap_CodeRange*)m_pLeadingBytes; while (1) { int ret = _CheckCodeRange(codes, char_size, pRanges, m_nCodeRanges); @@ -527,7 +527,7 @@ FX_DWORD CPDF_CMap::GetNextChar(FX_LPCSTR pString, int nStrLen, int& offset) con if (char_size == 4 || offset == nStrLen) { return 0; } - codes[char_size ++] = ((FX_LPBYTE)pString)[offset++]; + codes[char_size ++] = ((uint8_t*)pString)[offset++]; } break; } @@ -556,7 +556,7 @@ int CPDF_CMap::GetCharSize(FX_DWORD charcode) const } return 1; } -int CPDF_CMap::CountChar(FX_LPCSTR pString, int size) const +int CPDF_CMap::CountChar(const FX_CHAR* pString, int size) const { switch (m_CodingScheme) { case OneByte: @@ -567,7 +567,7 @@ int CPDF_CMap::CountChar(FX_LPCSTR pString, int size) const int count = 0; for (int i = 0; i < size; i ++) { count ++; - if (m_pLeadingBytes[((FX_LPBYTE)pString)[i]]) { + if (m_pLeadingBytes[((uint8_t*)pString)[i]]) { i ++; } } @@ -619,7 +619,7 @@ int _GetCharSize(FX_DWORD charcode, _CMap_CodeRange* pRanges, int iRangesSize) } return 1; } -int CPDF_CMap::AppendChar(FX_LPSTR str, FX_DWORD charcode) const +int CPDF_CMap::AppendChar(FX_CHAR* str, FX_DWORD charcode) const { switch (m_CodingScheme) { case OneByte: @@ -793,7 +793,7 @@ FX_WCHAR CPDF_CIDFont::_UnicodeFromCharCode(FX_DWORD charcode) const charcode = (charcode % 256) * 256 + (charcode / 256); charsize = 2; } - int ret = FXSYS_MultiByteToWideChar(g_CharsetCPs[m_pCMap->m_Coding], 0, (FX_LPCSTR)&charcode, charsize, &unicode, 1); + int ret = FXSYS_MultiByteToWideChar(g_CharsetCPs[m_pCMap->m_Coding], 0, (const FX_CHAR*)&charcode, charsize, &unicode, 1); if (ret != 1) { return 0; } @@ -1056,7 +1056,7 @@ void CPDF_CIDFont::GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level) } if (m_pFontFile == NULL && m_Charset == CIDSET_JAPAN1) { FX_WORD CID = CIDFromCharCode(charcode); - FX_LPCBYTE pTransform = GetCIDTransform(CID); + const uint8_t* pTransform = GetCIDTransform(CID); if (pTransform && !bVert) { CFX_AffineMatrix matrix(_CIDTransformToFloat(pTransform[0]), _CIDTransformToFloat(pTransform[1]), _CIDTransformToFloat(pTransform[2]), _CIDTransformToFloat(pTransform[3]), @@ -1222,7 +1222,7 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL *pVertGlyph) } else if (bMacRoman) { iBaseEncoding = PDFFONT_ENCODING_MACROMAN; } - FX_LPCSTR name = GetAdobeCharName(iBaseEncoding, NULL, charcode); + const FX_CHAR* name = GetAdobeCharName(iBaseEncoding, NULL, charcode); if (name == NULL) { return charcode == 0 ? -1 : (int)charcode; } @@ -1314,10 +1314,10 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL *pVertGlyph) if (byte_pos + 2 > m_pCIDToGIDMap->GetSize()) { return -1; } - FX_LPCBYTE pdata = m_pCIDToGIDMap->GetData() + byte_pos; + const uint8_t* pdata = m_pCIDToGIDMap->GetData() + byte_pos; return pdata[0] * 256 + pdata[1]; } -FX_DWORD CPDF_CIDFont::GetNextChar(FX_LPCSTR pString, int nStrLen, int& offset) const +FX_DWORD CPDF_CIDFont::GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const { return m_pCMap->GetNextChar(pString, nStrLen, offset); } @@ -1325,11 +1325,11 @@ int CPDF_CIDFont::GetCharSize(FX_DWORD charcode) const { return m_pCMap->GetCharSize(charcode); } -int CPDF_CIDFont::CountChar(FX_LPCSTR pString, int size) const +int CPDF_CIDFont::CountChar(const FX_CHAR* pString, int size) const { return m_pCMap->CountChar(pString, size); } -int CPDF_CIDFont::AppendChar(FX_LPSTR str, FX_DWORD charcode) const +int CPDF_CIDFont::AppendChar(FX_CHAR* str, FX_DWORD charcode) const { return m_pCMap->AppendChar(str, charcode); } @@ -1579,7 +1579,7 @@ Japan1_VertCIDs[] = { {8818, 0, 129, 127, 0, 19, 114}, {8819, 0, 129, 127, 0, 218, 108}, }; -FX_LPCBYTE CPDF_CIDFont::GetCIDTransform(FX_WORD CID) const +const uint8_t* CPDF_CIDFont::GetCIDTransform(FX_WORD CID) const { if (m_Charset != CIDSET_JAPAN1 || m_pFontFile != NULL) { return NULL; diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp index ab15c47cb3..b6b2f57c02 100644 --- a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp +++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp @@ -48,7 +48,7 @@ void CFX_GlyphMap::SetAt(int key, int value) } FX_BOOL CFX_GlyphMap::Lookup(int key, int &value) { - FX_LPVOID pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(), m_Buffer.GetSize() / sizeof(_IntPair), + void* pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(), m_Buffer.GetSize() / sizeof(_IntPair), sizeof(_IntPair), _CompareInt); if (pResult == NULL) { return FALSE; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp index 82f90d17a6..046cebeb98 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp @@ -242,7 +242,7 @@ void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs, FX_FLOAT* pKernin m_pCharPos = FX_Alloc(FX_FLOAT, m_nChars - 1); int index = 0; for (int i = 0; i < nsegs; i ++) { - FX_LPCSTR segment = pStrs[i]; + const FX_CHAR* segment = pStrs[i]; int offset = 0, len = pStrs[i].GetLength(); while (offset < len) { m_pCharCodes[index++] = pFont->GetNextChar(segment, len, offset); diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp index ea61078209..1b989be040 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp @@ -125,7 +125,7 @@ FX_BOOL CPDF_DeviceCS::v_SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOA } return FALSE; } -static void ReverseRGB(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels) +static void ReverseRGB(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels) { if (pDestBuf == pSrcBuf) for (int i = 0; i < pixels; i ++) { @@ -142,7 +142,7 @@ static void ReverseRGB(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels) pSrcBuf += 3; } } -void CPDF_DeviceCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const +void CPDF_DeviceCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const { if (bTransMask && m_Family == PDFCS_DEVICECMYK) { for (int i = 0; i < pixels; i ++) { @@ -267,7 +267,7 @@ public: CPDF_CalGray(); virtual FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray); virtual FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const; - virtual void TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; + virtual void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const; FX_FLOAT m_WhitePoint[3]; FX_FLOAT m_BlackPoint[3]; @@ -310,7 +310,7 @@ FX_BOOL CPDF_CalGray::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) return FALSE; } } -void CPDF_CalGray::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const +void CPDF_CalGray::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const { for (int i = 0; i < pixels; i ++) { *pDestBuf ++ = pSrcBuf[i]; @@ -324,7 +324,7 @@ public: CPDF_CalRGB(); virtual FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray); virtual FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const; - virtual void TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; + virtual void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const; FX_FLOAT m_WhitePoint[3]; FX_FLOAT m_BlackPoint[3]; @@ -399,7 +399,7 @@ FX_BOOL CPDF_CalRGB::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) pBuf[2] = B; return TRUE; } -void CPDF_CalRGB::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const +void CPDF_CalRGB::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const { if (bTransMask) { FX_FLOAT Cal[3]; @@ -430,7 +430,7 @@ public: virtual void GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOAT& max) const; virtual FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const; FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const; - virtual void TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; + virtual void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; FX_FLOAT m_WhitePoint[3]; FX_FLOAT m_BlackPoint[3]; FX_FLOAT m_Ranges[4]; @@ -505,7 +505,7 @@ FX_BOOL CPDF_LabCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) c { return FALSE; } -void CPDF_LabCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const +void CPDF_LabCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const { for (int i = 0; i < pixels; i ++) { FX_FLOAT lab[3]; @@ -521,7 +521,7 @@ void CPDF_LabCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pSrcBuf += 3; } } -CPDF_IccProfile::CPDF_IccProfile(FX_LPCBYTE pData, FX_DWORD dwSize): +CPDF_IccProfile::CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize): m_bsRGB(FALSE), m_pTransform(NULL), m_nSrcComponents(0) @@ -555,11 +555,11 @@ public: FX_BOOL v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const; FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const; virtual void EnableStdConversion(FX_BOOL bEnabled); - virtual void TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; + virtual void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; FX_FLOAT* m_pRanges; CPDF_IccProfile* m_pProfile; CPDF_ColorSpace* m_pAlterCS; - FX_LPBYTE m_pCache; + uint8_t* m_pCache; FX_BOOL m_bOwn; }; CPDF_ICCBasedCS::CPDF_ICCBasedCS() @@ -702,7 +702,7 @@ void CPDF_ICCBasedCS::EnableStdConversion(FX_BOOL bEnabled) m_pAlterCS->EnableStdConversion(bEnabled); } } -void CPDF_ICCBasedCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const +void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const { if (m_pProfile->m_bsRGB) { ReverseRGB(pDestBuf, pSrcBuf, pixels); @@ -716,8 +716,8 @@ void CPDF_ICCBasedCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, } else { if (m_pCache == NULL) { ((CPDF_ICCBasedCS*)this)->m_pCache = FX_Alloc2D(uint8_t, nMaxColors, 3); - FX_LPBYTE temp_src = FX_Alloc2D(uint8_t, nMaxColors, m_nComponents); - FX_LPBYTE pSrc = temp_src; + uint8_t* temp_src = FX_Alloc2D(uint8_t, nMaxColors, m_nComponents); + uint8_t* pSrc = temp_src; for (int i = 0; i < nMaxColors; i ++) { FX_DWORD color = i; FX_DWORD order = nMaxColors / 52; @@ -839,7 +839,7 @@ FX_BOOL CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOA } CFX_FixedBufGrow<FX_FLOAT, 16> Comps(m_nBaseComponents); FX_FLOAT* comps = Comps; - FX_LPCBYTE pTable = m_Table; + const uint8_t* pTable = m_Table; for (int i = 0; i < m_nBaseComponents; i ++) { comps[i] = m_pCompMinMax[i * 2] + m_pCompMinMax[i * 2 + 1] * pTable[index * m_nBaseComponents + i] / 255; } @@ -1257,7 +1257,7 @@ int CPDF_ColorSpace::GetMaxIndex() const CPDF_IndexedCS* pCS = (CPDF_IndexedCS*)this; return pCS->m_MaxIndex; } -void CPDF_ColorSpace::TranslateImageLine(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const +void CPDF_ColorSpace::TranslateImageLine(uint8_t* dest_buf, const uint8_t* src_buf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const { CFX_FixedBufGrow<FX_FLOAT, 16> srcbuf(m_nComponents); FX_FLOAT* src = srcbuf; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp index dadf6bf9cb..2cfb02869c 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp @@ -64,10 +64,10 @@ CPDF_PSProc::~CPDF_PSProc() { int size = m_Operators.GetSize(); for (int i = 0; i < size; i ++) { - if (m_Operators[i] == (FX_LPVOID)PSOP_PROC) { + if (m_Operators[i] == (void*)PSOP_PROC) { delete (CPDF_PSProc*)m_Operators[i + 1]; i ++; - } else if (m_Operators[i] == (FX_LPVOID)PSOP_CONST) { + } else if (m_Operators[i] == (void*)PSOP_CONST) { FX_Free((FX_FLOAT*)m_Operators[i + 1]); i ++; } @@ -84,15 +84,15 @@ FX_BOOL CPDF_PSProc::Execute(CPDF_PSEngine* pEngine) pEngine->Push(*(FX_FLOAT*)m_Operators[i + 1]); i ++; } else if (op == PSOP_IF) { - if (i < 2 || m_Operators[i - 2] != (FX_LPVOID)PSOP_PROC) { + if (i < 2 || m_Operators[i - 2] != (void*)PSOP_PROC) { return FALSE; } if ((int)pEngine->Pop()) { ((CPDF_PSProc*)m_Operators[i - 1])->Execute(pEngine); } } else if (op == PSOP_IFELSE) { - if (i < 4 || m_Operators[i - 2] != (FX_LPVOID)PSOP_PROC || - m_Operators[i - 4] != (FX_LPVOID)PSOP_PROC) { + if (i < 4 || m_Operators[i - 2] != (void*)PSOP_PROC || + m_Operators[i - 4] != (void*)PSOP_PROC) { return FALSE; } if ((int)pEngine->Pop()) { @@ -147,7 +147,7 @@ const struct _PDF_PSOpName { }; FX_BOOL CPDF_PSEngine::Parse(const FX_CHAR* string, int size) { - CPDF_SimpleParser parser((FX_LPBYTE)string, size); + CPDF_SimpleParser parser((uint8_t*)string, size); CFX_ByteStringC word = parser.GetWord(); if (word != FX_BSTRC("{")) { return FALSE; @@ -166,7 +166,7 @@ FX_BOOL CPDF_PSProc::Parse(CPDF_SimpleParser& parser) } if (word == FX_BSTRC("{")) { CPDF_PSProc* pProc = new CPDF_PSProc; - m_Operators.Add((FX_LPVOID)PSOP_PROC); + m_Operators.Add((void*)PSOP_PROC); m_Operators.Add(pProc); if (!pProc->Parse(parser)) { return FALSE; @@ -175,7 +175,7 @@ FX_BOOL CPDF_PSProc::Parse(CPDF_SimpleParser& parser) int i = 0; while (_PDF_PSOpNames[i].name) { if (word == CFX_ByteStringC(_PDF_PSOpNames[i].name)) { - m_Operators.Add((FX_LPVOID)_PDF_PSOpNames[i].op); + m_Operators.Add((void*)_PDF_PSOpNames[i].op); break; } i ++; @@ -183,7 +183,7 @@ FX_BOOL CPDF_PSProc::Parse(CPDF_SimpleParser& parser) if (_PDF_PSOpNames[i].name == NULL) { FX_FLOAT* pd = FX_Alloc(FX_FLOAT, 1); *pd = FX_atof(word); - m_Operators.Add((FX_LPVOID)PSOP_CONST); + m_Operators.Add((void*)PSOP_CONST); m_Operators.Add(pd); } } @@ -424,7 +424,7 @@ static FX_FLOAT PDF_Interpolate(FX_FLOAT x, FX_FLOAT xmin, FX_FLOAT xmax, FX_FLO { return ((x - xmin) * (ymax - ymin) / (xmax - xmin)) + ymin; } -static FX_DWORD _GetBits32(FX_LPCBYTE pData, int bitpos, int nbits) +static FX_DWORD _GetBits32(const uint8_t* pData, int bitpos, int nbits) { int result = 0; for (int i = 0; i < nbits; i ++) @@ -561,7 +561,7 @@ FX_BOOL CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const if (!bitpos.IsValid()) { return FALSE; } - FX_LPCBYTE pSampleData = m_pSampleStream->GetData(); + const uint8_t* pSampleData = m_pSampleStream->GetData(); if (pSampleData == NULL) { return FALSE; } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp index bb4b9dee23..3ce4baf20c 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp @@ -349,7 +349,7 @@ FX_FLOAT CPDF_TextState::GetShearAngle() const CPDF_GeneralStateData::CPDF_GeneralStateData() { FXSYS_memset32(this, 0, sizeof(CPDF_GeneralStateData)); - FXSYS_strcpy((FX_LPSTR)m_BlendMode, "Normal"); + FXSYS_strcpy((FX_CHAR*)m_BlendMode, "Normal"); m_StrokeAlpha = 1.0f; m_FillAlpha = 1.0f; m_Flatness = 1.0f; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp index a92e9e783d..d898feecf4 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -113,7 +113,7 @@ int CPDF_StreamContentParser::GetNextParamPos() m_ParamCount ++; return index; } -void CPDF_StreamContentParser::AddNameParam(FX_LPCSTR name, int len) +void CPDF_StreamContentParser::AddNameParam(const FX_CHAR* name, int len) { int index = GetNextParamPos(); if (len > 32) { @@ -131,7 +131,7 @@ void CPDF_StreamContentParser::AddNameParam(FX_LPCSTR name, int len) } } } -void CPDF_StreamContentParser::AddNumberParam(FX_LPCSTR str, int len) +void CPDF_StreamContentParser::AddNumberParam(const FX_CHAR* str, int len) { int index = GetNextParamPos(); m_ParamBuf1[index].m_Type = PDFOBJ_NUMBER; @@ -321,7 +321,7 @@ const struct _OpCode { {FXBSTR_ID('w', 0, 0, 0), &CPDF_StreamContentParser::Handle_SetLineWidth}, {FXBSTR_ID('y', 0, 0, 0), &CPDF_StreamContentParser::Handle_CurveTo_13}, }; -FX_BOOL CPDF_StreamContentParser::OnOperator(FX_LPCSTR op) +FX_BOOL CPDF_StreamContentParser::OnOperator(const FX_CHAR* op) { int i = 0; FX_DWORD opid = 0; @@ -410,7 +410,7 @@ void CPDF_StreamContentParser::Handle_BeginMarkedContent() m_CurContentMark.GetModify()->AddMark(tag, NULL, FALSE); } struct _FX_BSTR { - FX_LPCSTR m_Ptr; + const FX_CHAR* m_Ptr; int m_Size; }; #define _FX_BSTRC(str) {str, sizeof(str)-1} @@ -1550,7 +1550,7 @@ CFX_ByteString _FPDF_ByteStringFromHex(CFX_BinaryBuf& src_buf) CFX_ByteTextBuf buf; FX_BOOL bFirst = TRUE; int code = 0; - FX_LPCBYTE str = src_buf.GetBuffer(); + const uint8_t* str = src_buf.GetBuffer(); FX_DWORD size = src_buf.GetSize(); for (FX_DWORD i = 0; i < size; i ++) { uint8_t ch = str[i]; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp index bc2138e19e..ec2b69f70b 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -9,7 +9,7 @@ #include "../../../include/fxcodec/fx_codec.h" #include "pageint.h" #include <limits.h> -extern const FX_LPCSTR _PDF_OpCharType = +const FX_CHAR* const _PDF_OpCharType = "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII" "IIVIIIIVIIVIIIIIVVIIIIIIIIIIIIII" "IIVVVVVVIVVVVVVIVVVVVIIVVIIIIIII" @@ -18,7 +18,7 @@ extern const FX_LPCSTR _PDF_OpCharType = "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII" "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII" "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII"; -FX_BOOL _PDF_HasInvalidOpChar(FX_LPCSTR op) +FX_BOOL _PDF_HasInvalidOpChar(const FX_CHAR* op) { if(!op) { return FALSE; @@ -41,7 +41,7 @@ class CPDF_StreamParserAutoClearer { private: CPDF_StreamParser** scoped_variable_; }; -FX_DWORD CPDF_StreamContentParser::Parse(FX_LPCBYTE pData, FX_DWORD dwSize, FX_DWORD max_cost) +FX_DWORD CPDF_StreamContentParser::Parse(const uint8_t* pData, FX_DWORD dwSize, FX_DWORD max_cost) { if (m_Level > _FPDF_MAX_FORM_LEVEL_) { return dwSize; @@ -71,7 +71,7 @@ FX_DWORD CPDF_StreamContentParser::Parse(FX_LPCBYTE pData, FX_DWORD dwSize, FX_D AddNumberParam((char*)syntax.GetWordBuf(), syntax.GetWordSize()); break; case CPDF_StreamParser::Name: - AddNameParam((FX_LPCSTR)syntax.GetWordBuf() + 1, syntax.GetWordSize() - 1); + AddNameParam((const FX_CHAR*)syntax.GetWordBuf() + 1, syntax.GetWordSize() - 1); break; default: AddObjectParam(syntax.GetObject()); @@ -97,7 +97,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() if (type != CPDF_StreamParser::Name) { break; } - CFX_ByteString key((FX_LPCSTR)m_pSyntax->GetWordBuf() + 1, m_pSyntax->GetWordSize() - 1); + CFX_ByteString key((const FX_CHAR*)m_pSyntax->GetWordBuf() + 1, m_pSyntax->GetWordSize() - 1); CPDF_Object* pObj = m_pSyntax->ReadNextObject(); if (!key.IsEmpty()) { pDict->SetAt(key, pObj, m_pDocument); @@ -248,7 +248,7 @@ CPDF_StreamParser::~CPDF_StreamParser() m_pLastObj->Release(); } } -FX_DWORD _DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +FX_DWORD _DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, uint8_t*& dest_buf, FX_DWORD& dest_size) { if (pDecoder == NULL) { return (FX_DWORD) - 1; @@ -265,7 +265,7 @@ FX_DWORD _DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, FX_LPBYTE& dest_b dest_buf = FX_Alloc2D(uint8_t, pitch, height); dest_size = pitch * height; // Safe since checked alloc returned. for (int row = 0; row < height; row ++) { - FX_LPBYTE pLine = pDecoder->GetScanline(row); + uint8_t* pLine = pDecoder->GetScanline(row); if (pLine == NULL) { break; } @@ -275,15 +275,15 @@ FX_DWORD _DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, FX_LPBYTE& dest_b delete pDecoder; return srcoff; } -ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, const CPDF_Dictionary* pParams); -FX_DWORD _A85Decode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); -FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); +FX_DWORD _A85Decode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); +FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams, - FX_DWORD estimated_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); + FX_DWORD estimated_size, uint8_t*& dest_buf, FX_DWORD& dest_size); FX_DWORD PDF_DecodeInlineStream(const uint8_t* src_buf, FX_DWORD limit, int width, int height, CFX_ByteString& decoder, - CPDF_Dictionary* pParam, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) + CPDF_Dictionary* pParam, uint8_t*& dest_buf, FX_DWORD& dest_size) { if (decoder == FX_BSTRC("CCITTFaxDecode") || decoder == FX_BSTRC("CCF")) { ICodec_ScanlineDecoder* pDecoder = FPDFAPI_CreateFaxDecoder(src_buf, limit, width, height, pParam); @@ -367,7 +367,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CPDF_Dicti return NULL; } OrigSize *= height; - FX_LPBYTE pData = NULL; + uint8_t* pData = NULL; FX_DWORD dwStreamSize; if (Decoder.IsEmpty()) { if (OrigSize > m_Size - m_Pos) { @@ -1026,7 +1026,7 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, CPDF_AllStates* pGraphicStates, } else { m_pSingleStream->LoadAllData(pForm->m_pFormStream, FALSE); } - m_pData = (FX_LPBYTE)m_pSingleStream->GetData(); + m_pData = (uint8_t*)m_pSingleStream->GetData(); m_Size = m_pSingleStream->GetSize(); m_Status = ToBeContinued; m_InternalStage = PAGEPARSE_STAGE_PARSE; @@ -1060,7 +1060,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) FX_Free(m_pStreamArray); m_pStreamArray = NULL; } else { - m_pData = (FX_LPBYTE)m_pSingleStream->GetData(); + m_pData = (uint8_t*)m_pSingleStream->GetData(); m_Size = m_pSingleStream->GetSize(); } m_InternalStage = PAGEPARSE_STAGE_PARSE; diff --git a/core/src/fpdfapi/fpdf_page/pageint.h b/core/src/fpdfapi/fpdf_page/pageint.h index 5c9312ea01..815e146ef8 100644 --- a/core/src/fpdfapi/fpdf_page/pageint.h +++ b/core/src/fpdfapi/fpdf_page/pageint.h @@ -25,7 +25,7 @@ public: typedef enum { EndOfData, Number, Keyword, Name, Others } SyntaxType; SyntaxType ParseNextElement(); - FX_LPBYTE GetWordBuf() + uint8_t* GetWordBuf() { return m_WordBuffer; } @@ -144,9 +144,9 @@ public: _ContentParam m_ParamBuf1[PARAM_BUF_SIZE]; FX_DWORD m_ParamStartPos; FX_DWORD m_ParamCount; - void AddNumberParam(FX_LPCSTR str, int len); + void AddNumberParam(const FX_CHAR* str, int len); void AddObjectParam(CPDF_Object* pObj); - void AddNameParam(FX_LPCSTR name, int size); + void AddNameParam(const FX_CHAR* name, int size); int GetNextParamPos(); void ClearAllParams(); CPDF_Object* GetObject(FX_DWORD index); @@ -157,7 +157,7 @@ public: { return (int32_t)(GetNumber(index)); } - FX_BOOL OnOperator(FX_LPCSTR op); + FX_BOOL OnOperator(const FX_CHAR* op); void BigCaseCaller(int index); FX_BOOL m_bAbort; CPDF_StreamParser* m_pSyntax; @@ -175,7 +175,7 @@ public: void ConvertUserSpace(FX_FLOAT& x, FX_FLOAT& y); void ConvertTextSpace(FX_FLOAT& x, FX_FLOAT& y); void OnChangeTextMatrix(); - FX_DWORD Parse(FX_LPCBYTE pData, FX_DWORD dwSize, FX_DWORD max_cost); + FX_DWORD Parse(const uint8_t* pData, FX_DWORD dwSize, FX_DWORD max_cost); void ParsePathObject(); int m_CompatCount; FX_PATHPOINT* m_pPathPoints; @@ -309,7 +309,7 @@ protected: CPDF_StreamAcc* m_pSingleStream; CPDF_StreamAcc** m_pStreamArray; FX_DWORD m_nStreams; - FX_LPBYTE m_pData; + uint8_t* m_pData; FX_DWORD m_Size; class CPDF_StreamContentParser* m_pParser; FX_DWORD m_CurrentOffset; @@ -429,11 +429,11 @@ protected: class CPDF_IccProfile { public: - CPDF_IccProfile(FX_LPCBYTE pData, FX_DWORD dwSize); + CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize); ~CPDF_IccProfile(); int32_t GetComponents() const { return m_nSrcComponents; } FX_BOOL m_bsRGB; - FX_LPVOID m_pTransform; + void* m_pTransform; private: int32_t m_nSrcComponents; }; @@ -445,7 +445,7 @@ public: FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const; FX_BOOL v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const; FX_BOOL v_SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k) const; - virtual void TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; + virtual void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; }; class CPDF_PatternCS : public CPDF_ColorSpace { @@ -470,7 +470,7 @@ public: int m_nIndex; }; ~CPDF_ResourceNaming(); - CFX_ByteString GetName(const CPDF_Dictionary* pResList, FX_LPCSTR szType); + CFX_ByteString GetName(const CPDF_Dictionary* pResList, const FX_CHAR* szType); protected: CFX_MapByteStringToPtr m_NamingCache; }; diff --git a/core/src/fpdfapi/fpdf_parser/filters_int.h b/core/src/fpdfapi/fpdf_parser/filters_int.h index 6652cc0ccc..38dcb171f5 100644 --- a/core/src/fpdfapi/fpdf_parser/filters_int.h +++ b/core/src/fpdfapi/fpdf_parser/filters_int.h @@ -12,10 +12,10 @@ class CPDF_DecryptFilter : public CFX_DataFilter public: CPDF_DecryptFilter(CPDF_CryptoHandler* pCryptoHandler, FX_DWORD objnum, FX_DWORD gennum); virtual ~CPDF_DecryptFilter(); - virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf); CPDF_CryptoHandler* m_pCryptoHandler; - FX_LPVOID m_pContext; + void* m_pContext; FX_DWORD m_ObjNum, m_GenNum; }; class CPDF_FlateFilter : public CFX_DataFilter @@ -23,7 +23,7 @@ class CPDF_FlateFilter : public CFX_DataFilter public: CPDF_FlateFilter(); virtual ~CPDF_FlateFilter(); - virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {} void* m_pContext; uint8_t m_DestBuffer[FPDF_FILTER_BUFFER_SIZE]; @@ -33,7 +33,7 @@ class CPDF_LzwFilter : public CFX_DataFilter public: CPDF_LzwFilter(FX_BOOL bEarlyChange); virtual ~CPDF_LzwFilter() {} - virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {} FX_BOOL m_bEarlyChange; FX_DWORD m_CodeArray[5021]; @@ -52,11 +52,12 @@ class CPDF_PredictorFilter : public CFX_DataFilter public: CPDF_PredictorFilter(int predictor, int colors, int bpc, int cols); virtual ~CPDF_PredictorFilter(); - virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {} FX_BOOL m_bTiff; FX_DWORD m_Pitch, m_Bpp; - FX_LPBYTE m_pRefLine, m_pCurLine; + uint8_t* m_pRefLine; + uint8_t* m_pCurLine; FX_DWORD m_iLine, m_LineInSize; }; class CPDF_AsciiHexFilter : public CFX_DataFilter @@ -64,7 +65,7 @@ class CPDF_AsciiHexFilter : public CFX_DataFilter public: CPDF_AsciiHexFilter(); virtual ~CPDF_AsciiHexFilter() {} - virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {} int m_State; int m_FirstDigit; @@ -74,7 +75,7 @@ class CPDF_Ascii85Filter : public CFX_DataFilter public: CPDF_Ascii85Filter(); virtual ~CPDF_Ascii85Filter() {} - virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {} int m_State; int m_CharCount; @@ -85,7 +86,7 @@ class CPDF_RunLenFilter : public CFX_DataFilter public: CPDF_RunLenFilter(); virtual ~CPDF_RunLenFilter() {} - virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {} int m_State; FX_DWORD m_Count; @@ -95,11 +96,11 @@ class CPDF_JpegFilter : public CFX_DataFilter public: CPDF_JpegFilter(); virtual ~CPDF_JpegFilter(); - virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {} void* m_pContext; CFX_BinaryBuf m_InputBuf; - FX_LPBYTE m_pScanline; + uint8_t* m_pScanline; int m_Pitch, m_Height, m_Width, m_nComps, m_iLine; FX_BOOL m_bGotHeader; }; @@ -109,16 +110,17 @@ public: CPDF_FaxFilter(); virtual ~CPDF_FaxFilter(); FX_BOOL Initialize(int Encoding, int bEndOfLine, int bByteAlign, int bBlack, int nRows, int nColumns); - virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf); int m_Encoding, m_bEndOfLine, m_bByteAlign, m_bBlack; int m_nRows, m_nColumns, m_Pitch, m_iRow; - FX_LPBYTE m_pScanlineBuf, m_pRefBuf; + uint8_t* m_pScanlineBuf; + uint8_t* m_pRefBuf; CFX_BinaryBuf m_InputBuf; int m_InputBitPos; - void ProcessData(FX_LPCBYTE src_buf, FX_DWORD src_size, int& bitpos, FX_BOOL bFinish, + void ProcessData(const uint8_t* src_buf, FX_DWORD src_size, int& bitpos, FX_BOOL bFinish, CFX_BinaryBuf& dest_buf); - FX_BOOL ReadLine(FX_LPCBYTE src_buf, int bitsize, int& bitpos); + FX_BOOL ReadLine(const uint8_t* src_buf, int bitsize, int& bitpos); }; #endif // CORE_SRC_FPDFAPI_FPDF_PARSER_FILTERS_INT_H_ diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp index b1fde0be71..bb490636a9 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp @@ -9,7 +9,7 @@ #include "../../../include/fxcodec/fx_codec.h" #include <limits.h> #define _STREAM_MAX_SIZE_ 20 * 1024 * 1024 -FX_DWORD _A85Decode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +FX_DWORD _A85Decode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { dest_size = 0; dest_buf = NULL; @@ -82,7 +82,7 @@ FX_DWORD _A85Decode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b } return pos; } -FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { FX_DWORD i; for (i = 0; i < src_size; i ++) @@ -122,7 +122,7 @@ FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b } return i; } -FX_DWORD RunLengthDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +FX_DWORD RunLengthDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { FX_DWORD i = 0; FX_DWORD old; @@ -182,7 +182,7 @@ FX_DWORD RunLengthDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& d } return ret; } -ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, const CPDF_Dictionary* pParams) { int K = 0; @@ -228,7 +228,7 @@ static FX_BOOL CheckFlateDecodeParams(int Colors, int BitsPerComponent, int Colu } return TRUE; } -ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, const CPDF_Dictionary* pParams) { int predictor = 0; @@ -246,7 +246,7 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD nComps, bpc, predictor, Colors, BitsPerComponent, Columns); } FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams, - FX_DWORD estimated_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) + FX_DWORD estimated_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { int predictor = 0; FX_BOOL bEarlyChange = TRUE; @@ -265,8 +265,8 @@ FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD bEarlyChange, predictor, Colors, BitsPerComponent, Columns, estimated_size, dest_buf, dest_size); } -FX_BOOL PDF_DataDecode(FX_LPCBYTE src_buf, FX_DWORD src_size, const CPDF_Dictionary* pDict, - FX_LPBYTE& dest_buf, FX_DWORD& dest_size, CFX_ByteString& ImageEncoding, +FX_BOOL PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF_Dictionary* pDict, + uint8_t*& dest_buf, FX_DWORD& dest_size, CFX_ByteString& ImageEncoding, CPDF_Dictionary*& pImageParms, FX_DWORD last_estimated_size, FX_BOOL bImageAcc) { @@ -295,19 +295,19 @@ FX_BOOL PDF_DataDecode(FX_LPCBYTE src_buf, FX_DWORD src_size, const CPDF_Diction DecoderList.Add(pDecoder->GetConstString()); ParamList.Add(pParams ? pParams->GetDict() : NULL); } - FX_LPBYTE last_buf = (FX_LPBYTE)src_buf; + uint8_t* last_buf = (uint8_t*)src_buf; FX_DWORD last_size = src_size; for (int i = 0; i < DecoderList.GetSize(); i ++) { int estimated_size = i == DecoderList.GetSize() - 1 ? last_estimated_size : 0; CFX_ByteString decoder = DecoderList[i]; CPDF_Dictionary* pParam = (CPDF_Dictionary*)ParamList[i]; - FX_LPBYTE new_buf = NULL; + uint8_t* new_buf = NULL; FX_DWORD new_size = (FX_DWORD) - 1; int offset = -1; if (decoder == FX_BSTRC("FlateDecode") || decoder == FX_BSTRC("Fl")) { if (bImageAcc && i == DecoderList.GetSize() - 1) { ImageEncoding = FX_BSTRC("FlateDecode"); - dest_buf = (FX_LPBYTE)last_buf; + dest_buf = (uint8_t*)last_buf; dest_size = last_size; pImageParms = pParam; return TRUE; @@ -323,7 +323,7 @@ FX_BOOL PDF_DataDecode(FX_LPCBYTE src_buf, FX_DWORD src_size, const CPDF_Diction } else if (decoder == FX_BSTRC("RunLengthDecode") || decoder == FX_BSTRC("RL")) { if (bImageAcc && i == DecoderList.GetSize() - 1) { ImageEncoding = FX_BSTRC("RunLengthDecode"); - dest_buf = (FX_LPBYTE)last_buf; + dest_buf = (uint8_t*)last_buf; dest_size = last_size; pImageParms = pParam; return TRUE; @@ -339,7 +339,7 @@ FX_BOOL PDF_DataDecode(FX_LPCBYTE src_buf, FX_DWORD src_size, const CPDF_Diction } ImageEncoding = decoder; pImageParms = pParam; - dest_buf = (FX_LPBYTE)last_buf; + dest_buf = (uint8_t*)last_buf; dest_size = last_size; return TRUE; } @@ -386,7 +386,7 @@ extern const FX_WORD PDFDocEncoding[256] = { 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff }; -CFX_WideString PDF_DecodeText(FX_LPCBYTE src_data, FX_DWORD src_len, CFX_CharMap* pCharMap) +CFX_WideString PDF_DecodeText(const uint8_t* src_data, FX_DWORD src_len, CFX_CharMap* pCharMap) { CFX_WideString result; if (src_len >= 2 && ((src_data[0] == 0xfe && src_data[1] == 0xff) || (src_data[0] == 0xff && src_data[1] == 0xfe))) { @@ -398,8 +398,8 @@ CFX_WideString PDF_DecodeText(FX_LPCBYTE src_data, FX_DWORD src_len, CFX_CharMap if (src_data[0] == 0xff) { bBE = !src_data[2]; } - FX_LPWSTR dest_buf = result.GetBuffer(max_chars); - FX_LPCBYTE uni_str = src_data + 2; + FX_WCHAR* dest_buf = result.GetBuffer(max_chars); + const uint8_t* uni_str = src_data + 2; int dest_pos = 0; for (FX_DWORD i = 0; i < max_chars * 2; i += 2) { FX_WORD unicode = bBE ? (uni_str[i] << 8 | uni_str[i + 1]) : (uni_str[i + 1] << 8 | uni_str[i]); @@ -418,24 +418,24 @@ CFX_WideString PDF_DecodeText(FX_LPCBYTE src_data, FX_DWORD src_len, CFX_CharMap } result.ReleaseBuffer(dest_pos); } else if (pCharMap == NULL) { - FX_LPWSTR dest_buf = result.GetBuffer(src_len); + FX_WCHAR* dest_buf = result.GetBuffer(src_len); for (FX_DWORD i = 0; i < src_len; i ++) { dest_buf[i] = PDFDocEncoding[src_data[i]]; } result.ReleaseBuffer(src_len); } else { - return (*pCharMap->m_GetWideString)(pCharMap, CFX_ByteString((FX_LPCSTR)src_data, src_len)); + return (*pCharMap->m_GetWideString)(pCharMap, CFX_ByteString((const FX_CHAR*)src_data, src_len)); } return result; } -CFX_ByteString PDF_EncodeText(FX_LPCWSTR pString, int len, CFX_CharMap* pCharMap) +CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len, CFX_CharMap* pCharMap) { if (len == -1) { len = FXSYS_wcslen(pString); } CFX_ByteString result; if (pCharMap == NULL) { - FX_LPSTR dest_buf1 = result.GetBuffer(len); + FX_CHAR* dest_buf1 = result.GetBuffer(len); int i; for (i = 0; i < len; i ++) { int code; @@ -462,7 +462,7 @@ CFX_ByteString PDF_EncodeText(FX_LPCWSTR pString, int len, CFX_CharMap* pCharMap int encLen = len * 2 + 2; - FX_LPBYTE dest_buf2 = (FX_LPBYTE)result.GetBuffer(encLen); + uint8_t* dest_buf2 = (uint8_t*)result.GetBuffer(encLen); dest_buf2[0] = 0xfe; dest_buf2[1] = 0xff; dest_buf2 += 2; @@ -503,22 +503,22 @@ CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex) result.AppendChar(')'); return result.GetByteString(); } -void FlateEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +void FlateEncode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); if (pEncoders) { pEncoders->GetFlateModule()->Encode(src_buf, src_size, dest_buf, dest_size); } } -void FlateEncode(FX_LPCBYTE src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns, - FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +void FlateEncode(const uint8_t* src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns, + uint8_t*& dest_buf, FX_DWORD& dest_size) { CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); if (pEncoders) { pEncoders->GetFlateModule()->Encode(src_buf, src_size, predictor, Colors, BitsPerComponent, Columns, dest_buf, dest_size); } } -FX_DWORD FlateDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +FX_DWORD FlateDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); if (pEncoders) { diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp index f2643694ec..bd15c7587e 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp @@ -343,7 +343,7 @@ FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const { { CPDF_Object* pObj; - if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, (FX_LPVOID&)pObj)) { + if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, (void*&)pObj)) { bForm = pObj->GetType() == PDFOBJ_STREAM && ((CPDF_Stream*)pObj)->GetDict()->GetString(FX_BSTRC("Subtype")) == FX_BSTRC("Form"); return TRUE; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp index 4ca97fe9e8..973a14e33b 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp @@ -13,8 +13,8 @@ const uint8_t defpasscode[32] = { 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80, 0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a }; -void CalcEncryptKey(CPDF_Dictionary* pEncrypt, FX_LPCBYTE password, FX_DWORD pass_size, - FX_LPBYTE key, int keylen, FX_BOOL bIgnoreMeta, CPDF_Array* pIdArray) +void CalcEncryptKey(CPDF_Dictionary* pEncrypt, const uint8_t* password, FX_DWORD pass_size, + uint8_t* key, int keylen, FX_BOOL bIgnoreMeta, CPDF_Array* pIdArray) { int revision = pEncrypt->GetInteger(FX_BSTRC("R")); uint8_t passcode[32]; @@ -25,16 +25,16 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt, FX_LPCBYTE password, FX_DWORD pas CRYPT_MD5Start(md5); CRYPT_MD5Update(md5, passcode, 32); CFX_ByteString okey = pEncrypt->GetString(FX_BSTRC("O")); - CRYPT_MD5Update(md5, (FX_LPBYTE)okey.c_str(), okey.GetLength()); + CRYPT_MD5Update(md5, (uint8_t*)okey.c_str(), okey.GetLength()); FX_DWORD perm = pEncrypt->GetInteger(FX_BSTRC("P")); - CRYPT_MD5Update(md5, (FX_LPBYTE)&perm, 4); + CRYPT_MD5Update(md5, (uint8_t*)&perm, 4); if (pIdArray) { CFX_ByteString id = pIdArray->GetString(0); - CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength()); + CRYPT_MD5Update(md5, (uint8_t*)id.c_str(), id.GetLength()); } if (!bIgnoreMeta && revision >= 3 && !pEncrypt->GetInteger(FX_BSTRC("EncryptMetadata"), 1)) { FX_DWORD tag = (FX_DWORD) - 1; - CRYPT_MD5Update(md5, (FX_LPBYTE)&tag, 4); + CRYPT_MD5Update(md5, (uint8_t*)&tag, 4); } uint8_t digest[16]; CRYPT_MD5Finish(md5, digest); @@ -189,7 +189,7 @@ FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict, FX return TRUE; return TRUE; } -FX_BOOL CPDF_StandardSecurityHandler::GetCryptInfo(int& cipher, FX_LPCBYTE& buffer, int& keylen) +FX_BOOL CPDF_StandardSecurityHandler::GetCryptInfo(int& cipher, const uint8_t*& buffer, int& keylen) { cipher = m_Cipher; buffer = m_EncryptKey; @@ -203,7 +203,7 @@ FX_BOOL CPDF_StandardSecurityHandler::GetCryptInfo(int& cipher, FX_LPCBYTE& buff | ( (uint64_t) (b)[(i) + 2] << 8 ) \ | ( (uint64_t) (b)[(i) + 3] )); \ } -int BigOrder64BitsMod3(FX_LPBYTE data) +int BigOrder64BitsMod3(uint8_t* data) { uint64_t ret = 0; for (int i = 0; i < 4; ++i) { @@ -215,7 +215,7 @@ int BigOrder64BitsMod3(FX_LPBYTE data) } return (int)ret; } -void Revision6_Hash(FX_LPCBYTE password, FX_DWORD size, FX_LPCBYTE salt, FX_LPCBYTE vector, FX_LPBYTE hash) +void Revision6_Hash(const uint8_t* password, FX_DWORD size, const uint8_t* salt, const uint8_t* vector, uint8_t* hash) { int iBlockSize = 32; uint8_t sha[128]; @@ -228,14 +228,14 @@ void Revision6_Hash(FX_LPCBYTE password, FX_DWORD size, FX_LPCBYTE salt, FX_LPCB uint8_t digest[32]; CRYPT_SHA256Finish(sha, digest); CFX_ByteTextBuf buf; - FX_LPBYTE input = digest; - FX_LPBYTE key = input; - FX_LPBYTE iv = input + 16; - FX_LPBYTE E = buf.GetBuffer(); + uint8_t* input = digest; + uint8_t* key = input; + uint8_t* iv = input + 16; + uint8_t* E = buf.GetBuffer(); int iBufLen = buf.GetLength(); CFX_ByteTextBuf interDigest; int i = 0; - FX_LPBYTE aes = FX_Alloc(uint8_t, 2048); + uint8_t* aes = FX_Alloc(uint8_t, 2048); while (i < 64 || i < E[iBufLen - 1] + 32) { int iRoundSize = size + iBlockSize; if (vector) { @@ -288,8 +288,8 @@ void Revision6_Hash(FX_LPCBYTE password, FX_DWORD size, FX_LPCBYTE salt, FX_LPCB FXSYS_memcpy32(hash, input, 32); } } -FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, FX_DWORD size, - FX_BOOL bOwner, FX_LPBYTE key) +FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(const uint8_t* password, FX_DWORD size, + FX_BOOL bOwner, uint8_t* key) { CFX_ByteString okey = m_pEncryptDict ? m_pEncryptDict->GetString(FX_BSTRC("O")) : CFX_ByteString(); if (okey.GetLength() < 48) { @@ -299,11 +299,11 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, if (ukey.GetLength() < 48) { return FALSE; } - FX_LPCBYTE pkey = bOwner ? (FX_LPCBYTE)okey : (FX_LPCBYTE)ukey; + const uint8_t* pkey = bOwner ? (const uint8_t*)okey : (const uint8_t*)ukey; uint8_t sha[128]; uint8_t digest[32]; if (m_Revision >= 6) { - Revision6_Hash(password, size, (FX_LPCBYTE)pkey + 32, (bOwner ? (FX_LPCBYTE)ukey : NULL), digest); + Revision6_Hash(password, size, (const uint8_t*)pkey + 32, (bOwner ? (const uint8_t*)ukey : NULL), digest); } else { CRYPT_SHA256Start(sha); CRYPT_SHA256Update(sha, password, size); @@ -320,7 +320,7 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, return TRUE; } if (m_Revision >= 6) { - Revision6_Hash(password, size, (FX_LPCBYTE)pkey + 40, (bOwner ? (FX_LPCBYTE)ukey : NULL), digest); + Revision6_Hash(password, size, (const uint8_t*)pkey + 40, (bOwner ? (const uint8_t*)ukey : NULL), digest); } else { CRYPT_SHA256Start(sha); CRYPT_SHA256Update(sha, password, size); @@ -352,7 +352,7 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, if (copy_len > (FX_DWORD)perms.GetLength()) { copy_len = perms.GetLength(); } - FXSYS_memcpy32(perms_buf, (FX_LPCBYTE)perms, copy_len); + FXSYS_memcpy32(perms_buf, (const uint8_t*)perms, copy_len); uint8_t buf[16]; CRYPT_AESDecrypt(aes, buf, perms_buf, 16); FX_Free(aes); @@ -367,11 +367,11 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, } return TRUE; } -int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD pass_size, FX_BOOL bOwner, FX_LPBYTE key) +int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password, FX_DWORD pass_size, FX_BOOL bOwner, uint8_t* key) { return CheckPassword(password, pass_size, bOwner, key, m_KeyLen); } -int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD size, FX_BOOL bOwner, FX_LPBYTE key, int32_t key_len) +int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password, FX_DWORD size, FX_BOOL bOwner, uint8_t* key, int32_t key_len) { if (m_Revision >= 5) { return AES256_CheckPassword(password, size, bOwner, key); @@ -385,8 +385,8 @@ int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD si } return CheckUserPassword(password, size, FALSE, key, key_len) || CheckUserPassword(password, size, TRUE, key, key_len); } -FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_DWORD pass_size, - FX_BOOL bIgnoreEncryptMeta, FX_LPBYTE key, int32_t key_len) +FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(const uint8_t* password, FX_DWORD pass_size, + FX_BOOL bIgnoreEncryptMeta, uint8_t* key, int32_t key_len) { CalcEncryptKey(m_pEncryptDict, password, pass_size, key, key_len, bIgnoreEncryptMeta, m_pParser->GetIDArray()); @@ -419,21 +419,21 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_ CPDF_Array* pIdArray = m_pParser->GetIDArray(); if (pIdArray) { CFX_ByteString id = pIdArray->GetString(0); - CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength()); + CRYPT_MD5Update(md5, (uint8_t*)id.c_str(), id.GetLength()); } CRYPT_MD5Finish(md5, ukeybuf); return FXSYS_memcmp32(test, ukeybuf, 16) == 0; } - if (FXSYS_memcmp32((FX_LPVOID)ukey.c_str(), ukeybuf, 16) == 0) { + if (FXSYS_memcmp32((void*)ukey.c_str(), ukeybuf, 16) == 0) { return TRUE; } return FALSE; } -CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pass, FX_DWORD pass_size) +CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(const uint8_t* owner_pass, FX_DWORD pass_size) { return GetUserPassword(owner_pass, pass_size, m_KeyLen); } -CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pass, FX_DWORD pass_size, int32_t key_len) +CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(const uint8_t* owner_pass, FX_DWORD pass_size, int32_t key_len) { CFX_ByteString okey = m_pEncryptDict->GetString(FX_BSTRC("O")); uint8_t passcode[32]; @@ -480,8 +480,8 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pa } return CFX_ByteString(okeybuf, len); } -FX_BOOL CPDF_StandardSecurityHandler::CheckOwnerPassword(FX_LPCBYTE password, FX_DWORD pass_size, - FX_LPBYTE key, int32_t key_len) +FX_BOOL CPDF_StandardSecurityHandler::CheckOwnerPassword(const uint8_t* password, FX_DWORD pass_size, + uint8_t* key, int32_t key_len) { CFX_ByteString user_pass = GetUserPassword(password, pass_size, key_len); if (CheckUserPassword(user_pass, user_pass.GetLength(), FALSE, key, key_len)) { @@ -498,8 +498,8 @@ CPDF_SecurityHandler* FPDF_CreateStandardSecurityHandler() return new CPDF_StandardSecurityHandler; } void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, - FX_LPCBYTE user_pass, FX_DWORD user_size, - FX_LPCBYTE owner_pass, FX_DWORD owner_size, FX_BOOL bDefault, FX_DWORD type) + const uint8_t* user_pass, FX_DWORD user_size, + const uint8_t* owner_pass, FX_DWORD owner_size, FX_BOOL bDefault, FX_DWORD type) { int cipher = 0, key_len = 0; if (!LoadDict(pEncryptDict, type, cipher, key_len)) { @@ -554,7 +554,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ } pEncryptDict->SetAtString(FX_BSTRC("O"), CFX_ByteString(passcode, 32)); } - CalcEncryptKey(m_pEncryptDict, (FX_LPBYTE)user_pass, user_size, m_EncryptKey, key_len, FALSE, pIdArray); + CalcEncryptKey(m_pEncryptDict, (uint8_t*)user_pass, user_size, m_EncryptKey, key_len, FALSE, pIdArray); if (m_Revision < 3) { uint8_t tempbuf[32]; FXSYS_memcpy32(tempbuf, defpasscode, 32); @@ -566,7 +566,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ CRYPT_MD5Update(md5, defpasscode, 32); if (pIdArray) { CFX_ByteString id = pIdArray->GetString(0); - CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength()); + CRYPT_MD5Update(md5, (uint8_t*)id.c_str(), id.GetLength()); } uint8_t digest[32]; CRYPT_MD5Finish(md5, digest); @@ -583,16 +583,16 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ } } void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, - FX_LPCBYTE user_pass, FX_DWORD user_size, - FX_LPCBYTE owner_pass, FX_DWORD owner_size, FX_DWORD type) + const uint8_t* user_pass, FX_DWORD user_size, + const uint8_t* owner_pass, FX_DWORD owner_size, FX_DWORD type) { OnCreate(pEncryptDict, pIdArray, user_pass, user_size, owner_pass, owner_size, TRUE, type); } -void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, FX_LPCBYTE user_pass, FX_DWORD user_size, FX_DWORD type) +void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, const uint8_t* user_pass, FX_DWORD user_size, FX_DWORD type) { OnCreate(pEncryptDict, pIdArray, user_pass, user_size, NULL, 0, FALSE, type); } -void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict, FX_LPCBYTE password, FX_DWORD size, FX_BOOL bOwner, FX_LPCBYTE key) +void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict, const uint8_t* password, FX_DWORD size, FX_BOOL bOwner, const uint8_t* key) { uint8_t sha[128]; CRYPT_SHA1Start(sha); @@ -603,7 +603,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD CFX_ByteString ukey = pEncryptDict->GetString(FX_BSTRC("U")); uint8_t digest1[48]; if (m_Revision >= 6) { - Revision6_Hash(password, size, digest, (bOwner ? (FX_LPCBYTE)ukey : NULL), digest1); + Revision6_Hash(password, size, digest, (bOwner ? (const uint8_t*)ukey : NULL), digest1); } else { CRYPT_SHA256Start(sha); CRYPT_SHA256Update(sha, password, size); @@ -616,7 +616,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD FXSYS_memcpy32(digest1 + 32, digest, 16); pEncryptDict->SetAtString(bOwner ? FX_BSTRC("O") : FX_BSTRC("U"), CFX_ByteString(digest1, 48)); if (m_Revision >= 6) { - Revision6_Hash(password, size, digest + 8, (bOwner ? (FX_LPCBYTE)ukey : NULL), digest1); + Revision6_Hash(password, size, digest + 8, (bOwner ? (const uint8_t*)ukey : NULL), digest1); } else { CRYPT_SHA256Start(sha); CRYPT_SHA256Update(sha, password, size); @@ -636,7 +636,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD pEncryptDict->SetAtString(bOwner ? FX_BSTRC("OE") : FX_BSTRC("UE"), CFX_ByteString(digest1, 32)); } void CPDF_StandardSecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict, FX_DWORD permissions, - FX_BOOL bEncryptMetadata, FX_LPCBYTE key) + FX_BOOL bEncryptMetadata, const uint8_t* key) { uint8_t buf[16]; buf[0] = (uint8_t)permissions; @@ -660,8 +660,8 @@ void CPDF_StandardSecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict FX_Free(aes); pEncryptDict->SetAtString(FX_BSTRC("Perms"), CFX_ByteString(buf1, 16)); } -void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, FX_DWORD gennum, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPBYTE dest_buf, FX_DWORD& dest_size) +void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, FX_DWORD gennum, const uint8_t* src_buf, FX_DWORD src_size, + uint8_t* dest_buf, FX_DWORD& dest_size) { if (m_Cipher == FXCIPHER_NONE) { FXSYS_memcpy32(dest_buf, src_buf, src_size); @@ -724,7 +724,7 @@ typedef struct _AESCryptContext { uint8_t m_Block[16]; FX_DWORD m_BlockOffset; } AESCryptContext; -FX_LPVOID CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennum, FX_BOOL bEncrypt) +void* CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennum, FX_BOOL bEncrypt) { if (m_Cipher == FXCIPHER_NONE) { return this; @@ -772,7 +772,7 @@ FX_LPVOID CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennu CRYPT_ArcFourSetup(pContext, realkey, realkeylen); return pContext; } -FX_BOOL CPDF_StandardCryptoHandler::CryptStream(FX_LPVOID context, FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt) +FX_BOOL CPDF_StandardCryptoHandler::CryptStream(void* context, const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt) { if (!context) { return FALSE; @@ -825,7 +825,7 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptStream(FX_LPVOID context, FX_LPCBYTE sr } return TRUE; } -FX_BOOL CPDF_StandardCryptoHandler::CryptFinish(FX_LPVOID context, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt) +FX_BOOL CPDF_StandardCryptoHandler::CryptFinish(void* context, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt) { if (!context) { return FALSE; @@ -858,7 +858,7 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptFinish(FX_LPVOID context, CFX_BinaryBuf FX_Free(pContext); return TRUE; } -FX_LPVOID CPDF_StandardCryptoHandler::DecryptStart(FX_DWORD objnum, FX_DWORD gennum) +void* CPDF_StandardCryptoHandler::DecryptStart(FX_DWORD objnum, FX_DWORD gennum) { return CryptStart(objnum, gennum, FALSE); } @@ -868,7 +868,7 @@ FX_DWORD CPDF_StandardCryptoHandler::DecryptGetSize(FX_DWORD src_size) } FX_BOOL CPDF_StandardCryptoHandler::Init(CPDF_Dictionary* pEncryptDict, CPDF_SecurityHandler* pSecurityHandler) { - FX_LPCBYTE key; + const uint8_t* key; if (!pSecurityHandler->GetCryptInfo(m_Cipher, key, m_KeyLen)) { return FALSE; } @@ -883,7 +883,7 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(CPDF_Dictionary* pEncryptDict, CPDF_Sec } return TRUE; } -FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher, FX_LPCBYTE key, int keylen) +FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher, const uint8_t* key, int keylen) { if (cipher == FXCIPHER_AES) { switch(keylen) { @@ -915,24 +915,24 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher, FX_LPCBYTE key, int keylen) } return TRUE; } -FX_BOOL CPDF_StandardCryptoHandler::DecryptStream(FX_LPVOID context, FX_LPCBYTE src_buf, FX_DWORD src_size, +FX_BOOL CPDF_StandardCryptoHandler::DecryptStream(void* context, const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { return CryptStream(context, src_buf, src_size, dest_buf, FALSE); } -FX_BOOL CPDF_StandardCryptoHandler::DecryptFinish(FX_LPVOID context, CFX_BinaryBuf& dest_buf) +FX_BOOL CPDF_StandardCryptoHandler::DecryptFinish(void* context, CFX_BinaryBuf& dest_buf) { return CryptFinish(context, dest_buf, FALSE); } -FX_DWORD CPDF_StandardCryptoHandler::EncryptGetSize(FX_DWORD objnum, FX_DWORD version, FX_LPCBYTE src_buf, FX_DWORD src_size) +FX_DWORD CPDF_StandardCryptoHandler::EncryptGetSize(FX_DWORD objnum, FX_DWORD version, const uint8_t* src_buf, FX_DWORD src_size) { if (m_Cipher == FXCIPHER_AES) { return src_size + 32; } return src_size; } -FX_BOOL CPDF_StandardCryptoHandler::EncryptContent(FX_DWORD objnum, FX_DWORD gennum, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPBYTE dest_buf, FX_DWORD& dest_size) +FX_BOOL CPDF_StandardCryptoHandler::EncryptContent(FX_DWORD objnum, FX_DWORD gennum, const uint8_t* src_buf, FX_DWORD src_size, + uint8_t* dest_buf, FX_DWORD& dest_size) { CryptBlock(TRUE, objnum, gennum, src_buf, src_size, dest_buf, dest_size); return TRUE; @@ -940,8 +940,8 @@ FX_BOOL CPDF_StandardCryptoHandler::EncryptContent(FX_DWORD objnum, FX_DWORD gen void CPDF_CryptoHandler::Decrypt(FX_DWORD objnum, FX_DWORD gennum, CFX_ByteString& str) { CFX_BinaryBuf dest_buf; - FX_LPVOID context = DecryptStart(objnum, gennum); - DecryptStream(context, (FX_LPCBYTE)str, str.GetLength(), dest_buf); + void* context = DecryptStart(objnum, gennum); + DecryptStream(context, (const uint8_t*)str, str.GetLength(), dest_buf); DecryptFinish(context, dest_buf); str = dest_buf; } diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp index 5bacfd7393..ceed675461 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp @@ -39,9 +39,9 @@ CFDF_Document* CFDF_Document::ParseFile(IFX_FileRead *pFile, FX_BOOL bOwnFile) } return pDoc; } -CFDF_Document* CFDF_Document::ParseMemory(FX_LPCBYTE pData, FX_DWORD size) +CFDF_Document* CFDF_Document::ParseMemory(const uint8_t* pData, FX_DWORD size) { - return CFDF_Document::ParseFile(FX_CreateMemoryStream((FX_LPBYTE)pData, size), TRUE); + return CFDF_Document::ParseFile(FX_CreateMemoryStream((uint8_t*)pData, size), TRUE); } void CFDF_Document::ParseStream(IFX_FileRead *pFile, FX_BOOL bOwnFile) { @@ -95,7 +95,7 @@ FX_BOOL CFDF_Document::WriteBuf(CFX_ByteTextBuf& buf) const while(pos) { size_t objnum; CPDF_Object* pObj; - m_IndirectObjs.GetNextAssoc(pos, (FX_LPVOID&)objnum, (FX_LPVOID&)pObj); + m_IndirectObjs.GetNextAssoc(pos, (void*&)objnum, (void*&)pObj); buf << (FX_DWORD)objnum << FX_BSTRC(" 0 obj\r\n") << pObj << FX_BSTRC("\r\nendobj\r\n\r\n"); } buf << FX_BSTRC("trailer\r\n<</Root ") << m_pRootDict->GetObjNum() << FX_BSTRC(" 0 R>>\r\n%%EOF\r\n"); @@ -113,7 +113,7 @@ CFX_WideString CFDF_Document::GetWin32Path() const } return FPDF_FileSpec_GetWin32Path(pFileSpec); } -static CFX_WideString ChangeSlash(FX_LPCWSTR str) +static CFX_WideString ChangeSlash(const FX_WCHAR* str) { CFX_WideString result; while (*str) { diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp index 8cb0cee82a..97e68b5c0c 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp @@ -29,7 +29,7 @@ void CFX_DataFilter::SetDestFilter(CFX_DataFilter* pFilter) m_pDestFilter = pFilter; } } -void CFX_DataFilter::FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) +void CFX_DataFilter::FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { if (m_bEOF) { return; @@ -199,7 +199,7 @@ CPDF_StreamFilter::~CPDF_StreamFilter() } } #define FPDF_FILTER_BUFFER_IN_SIZE FPDF_FILTER_BUFFER_SIZE -FX_DWORD CPDF_StreamFilter::ReadBlock(FX_LPBYTE buffer, FX_DWORD buf_size) +FX_DWORD CPDF_StreamFilter::ReadBlock(uint8_t* buffer, FX_DWORD buf_size) { if (m_pFilter == NULL) { FX_DWORD read_size = m_pStream->GetRawSize() - m_SrcOffset; @@ -249,7 +249,7 @@ FX_DWORD CPDF_StreamFilter::ReadBlock(FX_LPBYTE buffer, FX_DWORD buf_size) } return read_size + ReadLeftOver(buffer, buf_size); } -FX_DWORD CPDF_StreamFilter::ReadLeftOver(FX_LPBYTE buffer, FX_DWORD buf_size) +FX_DWORD CPDF_StreamFilter::ReadLeftOver(uint8_t* buffer, FX_DWORD buf_size) { FX_DWORD read_size = m_pBuffer->GetSize() - m_BufOffset; if (read_size > buf_size) { @@ -277,7 +277,7 @@ CPDF_DecryptFilter::~CPDF_DecryptFilter() m_pCryptoHandler->DecryptFinish(m_pContext, buf); } } -void CPDF_DecryptFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) +void CPDF_DecryptFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { if (m_pContext == NULL) { m_pContext = m_pCryptoHandler->DecryptStart(m_ObjNum, m_GenNum); @@ -320,7 +320,7 @@ CPDF_FlateFilter::~CPDF_FlateFilter() FPDFAPI_FlateEnd(m_pContext); } } -void CPDF_FlateFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) +void CPDF_FlateFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { if (m_pContext == NULL) { m_pContext = FPDFAPI_FlateInit(my_alloc_func, my_free_func); @@ -348,7 +348,7 @@ CPDF_LzwFilter::CPDF_LzwFilter(FX_BOOL bEarlyChange) m_LeftBits = 0; m_OldCode = (FX_DWORD) - 1; } -void CPDF_LzwFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) +void CPDF_LzwFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { for (FX_DWORD i = 0; i < src_size; i ++) { if (m_nLeftBits + 8 < m_CodeLen) { @@ -389,7 +389,7 @@ void CPDF_LzwFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_Binar DecodeString(code); } dest_buf.AppendBlock(NULL, m_StackLen); - FX_LPBYTE pOutput = dest_buf.GetBuffer() + dest_buf.GetSize() - m_StackLen; + uint8_t* pOutput = dest_buf.GetBuffer() + dest_buf.GetSize() - m_StackLen; for (FX_DWORD cc = 0; cc < m_StackLen; cc ++) { pOutput[cc] = m_DecodeStack[m_StackLen - cc - 1]; } @@ -475,7 +475,7 @@ static uint8_t PaethPredictor(int a, int b, int c) } return (uint8_t)c; } -static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, int Bpp) +static void PNG_PredictorLine(uint8_t* cur_buf, uint8_t* ref_buf, int pitch, int Bpp) { uint8_t tag = cur_buf[0]; if (tag == 0) { @@ -535,7 +535,7 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i } } } -void CPDF_PredictorFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) +void CPDF_PredictorFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { if (m_pCurLine == NULL) { m_pCurLine = FX_Alloc(uint8_t, m_Pitch); @@ -564,7 +564,7 @@ void CPDF_PredictorFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX PNG_PredictorLine(m_pCurLine, m_iLine ? m_pRefLine : NULL, m_Pitch - 1, m_Bpp); dest_buf.AppendBlock(m_pCurLine + 1, m_Pitch - 1); m_iLine ++; - FX_LPBYTE temp = m_pCurLine; + uint8_t* temp = m_pCurLine; m_pCurLine = m_pRefLine; m_pRefLine = temp; } @@ -576,7 +576,7 @@ CPDF_Ascii85Filter::CPDF_Ascii85Filter() m_State = 0; m_CharCount = 0; } -void CPDF_Ascii85Filter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) +void CPDF_Ascii85Filter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { for (FX_DWORD i = 0; i < src_size; i ++) { uint8_t byte = src_buf[i]; @@ -635,7 +635,7 @@ CPDF_AsciiHexFilter::CPDF_AsciiHexFilter() { m_State = 0; } -void CPDF_AsciiHexFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) +void CPDF_AsciiHexFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { for (FX_DWORD i = 0; i < src_size; i ++) { uint8_t byte = src_buf[i]; @@ -670,7 +670,7 @@ CPDF_RunLenFilter::CPDF_RunLenFilter() m_State = 0; m_Count = 0; } -void CPDF_RunLenFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) +void CPDF_RunLenFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { for (FX_DWORD i = 0; i < src_size; i ++) { uint8_t byte = src_buf[i]; @@ -719,12 +719,12 @@ CPDF_JpegFilter::~CPDF_JpegFilter() CPDF_ModuleMgr::Get()->GetJpegModule()->Finish(m_pContext); } } -void CPDF_JpegFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) +void CPDF_JpegFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { if (m_pContext == NULL) { m_pContext = CPDF_ModuleMgr::Get()->GetJpegModule()->Start(); } - FX_LPCBYTE jpeg_src_buf; + const uint8_t* jpeg_src_buf; FX_DWORD jpeg_src_size; CFX_BinaryBuf temp_buf; if (m_InputBuf.GetSize()) { @@ -811,9 +811,9 @@ FX_BOOL CPDF_FaxFilter::Initialize(int Encoding, int bEndOfLine, int bByteAlign, m_InputBitPos = 0; return TRUE; } -void CPDF_FaxFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) +void CPDF_FaxFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { - FX_LPCBYTE fax_src_buf; + const uint8_t* fax_src_buf; FX_DWORD fax_src_size; CFX_BinaryBuf temp_buf; int bitpos; @@ -840,9 +840,9 @@ void CPDF_FaxFilter::v_FilterFinish(CFX_BinaryBuf& dest_buf) ProcessData(m_InputBuf.GetBuffer(), m_InputBuf.GetSize(), m_InputBitPos, TRUE, dest_buf); } FX_BOOL _FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos); -FX_BOOL _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, const uint8_t* ref_buf, int columns); -FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns); -void CPDF_FaxFilter::ProcessData(FX_LPCBYTE src_buf, FX_DWORD src_size, int& bitpos, FX_BOOL bFinish, +FX_BOOL _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, const uint8_t* ref_buf, int columns); +FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, int columns); +void CPDF_FaxFilter::ProcessData(const uint8_t* src_buf, FX_DWORD src_size, int& bitpos, FX_BOOL bFinish, CFX_BinaryBuf& dest_buf) { int bitsize = src_size * 8; @@ -872,7 +872,7 @@ void CPDF_FaxFilter::ProcessData(FX_LPCBYTE src_buf, FX_DWORD src_size, int& bit } } } -FX_BOOL CPDF_FaxFilter::ReadLine(FX_LPCBYTE src_buf, int bitsize, int& bitpos) +FX_BOOL CPDF_FaxFilter::ReadLine(const uint8_t* src_buf, int bitsize, int& bitpos) { if (!_FaxSkipEOL(src_buf, bitsize, bitpos)) { return FALSE; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp index 8ecc0a5bf0..192be3a45c 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp @@ -51,7 +51,7 @@ CFX_ByteString CPDF_Object::GetString() const case PDFOBJ_NAME: return ((CPDF_Name*)this)->m_Name; case PDFOBJ_REFERENCE: { - CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this; + CPDF_Reference* pRef = (CPDF_Reference*)(void*)this; if (pRef->m_pObjList == NULL) { break; } @@ -68,11 +68,11 @@ CFX_ByteStringC CPDF_Object::GetConstString() const { switch (m_Type) { case PDFOBJ_STRING: - return CFX_ByteStringC((FX_LPCBYTE)((CPDF_String*)this)->m_String, ((CPDF_String*)this)->m_String.GetLength()); + return CFX_ByteStringC((const uint8_t*)((CPDF_String*)this)->m_String, ((CPDF_String*)this)->m_String.GetLength()); case PDFOBJ_NAME: - return CFX_ByteStringC((FX_LPCBYTE)((CPDF_Name*)this)->m_Name, ((CPDF_Name*)this)->m_Name.GetLength()); + return CFX_ByteStringC((const uint8_t*)((CPDF_Name*)this)->m_Name, ((CPDF_Name*)this)->m_Name.GetLength()); case PDFOBJ_REFERENCE: { - CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this; + CPDF_Reference* pRef = (CPDF_Reference*)(void*)this; if (pRef->m_pObjList == NULL) { break; } @@ -91,7 +91,7 @@ FX_FLOAT CPDF_Object::GetNumber() const case PDFOBJ_NUMBER: return ((CPDF_Number*)this)->GetNumber(); case PDFOBJ_REFERENCE: { - CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this; + CPDF_Reference* pRef = (CPDF_Reference*)(void*)this; if (pRef->m_pObjList == NULL) { break; } @@ -120,7 +120,7 @@ int CPDF_Object::GetInteger() const case PDFOBJ_NUMBER: return ((CPDF_Number*)this)->GetInteger(); case PDFOBJ_REFERENCE: { - CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this; + CPDF_Reference* pRef = (CPDF_Reference*)(void*)this; PARSE_CONTEXT context; FXSYS_memset32(&context, 0, sizeof(PARSE_CONTEXT)); if (pRef->m_pObjList == NULL) { @@ -233,7 +233,7 @@ CPDF_Object* CPDF_Object::GetDirect() const if (m_Type != PDFOBJ_REFERENCE) { return (CPDF_Object*)this; } - CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this; + CPDF_Reference* pRef = (CPDF_Reference*)(void*)this; if (pRef->m_pObjList == NULL) { return NULL; } @@ -331,13 +331,13 @@ CFX_WideString CPDF_Object::GetUnicodeText(CFX_CharMap* pCharMap) const } return CFX_WideString(); } -void CPDF_Object::SetUnicodeText(FX_LPCWSTR pUnicodes, int len) +void CPDF_Object::SetUnicodeText(const FX_WCHAR* pUnicodes, int len) { if (m_Type == PDFOBJ_STRING) { ((CPDF_String*)this)->m_String = PDF_EncodeText(pUnicodes, len); } else if (m_Type == PDFOBJ_STREAM) { CFX_ByteString result = PDF_EncodeText(pUnicodes, len); - ((CPDF_Stream*)this)->SetData((FX_LPBYTE)result.c_str(), result.GetLength(), FALSE, FALSE); + ((CPDF_Stream*)this)->SetData((uint8_t*)result.c_str(), result.GetLength(), FALSE, FALSE); } } @@ -570,7 +570,7 @@ CPDF_Dictionary::~CPDF_Dictionary() { FX_POSITION pos = m_Map.GetStartPosition(); while (pos) { - FX_LPVOID value = m_Map.GetNextValue(pos); + void* value = m_Map.GetNextValue(pos); if (value) ((CPDF_Object*)value)->Release(); } @@ -585,7 +585,7 @@ CPDF_Object* CPDF_Dictionary::GetNextElement(FX_POSITION& pos, CFX_ByteString& k return NULL; } CPDF_Object* p; - m_Map.GetNextAssoc(pos, key, (FX_LPVOID&)p); + m_Map.GetNextAssoc(pos, key, (void*&)p); return p; } CPDF_Object* CPDF_Dictionary::GetElement(FX_BSTR key) const @@ -736,7 +736,7 @@ CFX_AffineMatrix CPDF_Dictionary::GetMatrix(FX_BSTR key) const } FX_BOOL CPDF_Dictionary::KeyExist(FX_BSTR key) const { - FX_LPVOID value; + void* value; return m_Map.Lookup(key, value); } void CPDF_Dictionary::SetAt(FX_BSTR key, CPDF_Object* pObj, CPDF_IndirectObjects* pObjs) @@ -797,7 +797,7 @@ FX_BOOL CPDF_Dictionary::Identical(CPDF_Dictionary* pOther) const FX_POSITION pos = m_Map.GetStartPosition(); while (pos) { CFX_ByteString key; - FX_LPVOID value; + void* value; m_Map.GetNextAssoc(pos, key, value); if (!value) return FALSE; @@ -857,7 +857,7 @@ void CPDF_Dictionary::SetAtMatrix(FX_BSTR key, const CFX_AffineMatrix& matrix) pArray->AddNumber(matrix.f); SetAt(key, pArray); } -CPDF_Stream::CPDF_Stream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pDict) +CPDF_Stream::CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict) : CPDF_Object(PDFOBJ_STREAM) { m_pDict = pDict; m_dwSize = size; @@ -892,7 +892,7 @@ void CPDF_Stream::InitStream(CPDF_Dictionary* pDict) m_pCryptoHandler = NULL; m_FileOffset = 0; } -void CPDF_Stream::InitStream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pDict) +void CPDF_Stream::InitStream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict) { InitStream(pDict); m_GenNum = (FX_DWORD) - 1; @@ -905,7 +905,7 @@ void CPDF_Stream::InitStream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pD m_pDict->SetAtInteger(FX_BSTRC("Length"), size); } } -void CPDF_Stream::SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed, FX_BOOL bKeepBuf) +void CPDF_Stream::SetData(const uint8_t* pData, FX_DWORD size, FX_BOOL bCompressed, FX_BOOL bKeepBuf) { if (m_GenNum == (FX_DWORD) - 1) { if (m_pDataBuf) { @@ -916,7 +916,7 @@ void CPDF_Stream::SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed, m_pCryptoHandler = NULL; } if (bKeepBuf) { - m_pDataBuf = (FX_LPBYTE)pData; + m_pDataBuf = (uint8_t*)pData; } else { m_pDataBuf = FX_Alloc(uint8_t, size); if (pData) { @@ -933,7 +933,7 @@ void CPDF_Stream::SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed, m_pDict->RemoveAt(FX_BSTRC("DecodeParms")); } } -FX_BOOL CPDF_Stream::ReadRawData(FX_FILESIZE offset, FX_LPBYTE buf, FX_DWORD size) const +FX_BOOL CPDF_Stream::ReadRawData(FX_FILESIZE offset, uint8_t* buf, FX_DWORD size) const { if ((m_GenNum != (FX_DWORD) - 1) && m_pFile) { return m_pFile->ReadBlock(buf, m_FileOffset + offset, size); @@ -993,7 +993,7 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const } if (m_GenNum != (FX_DWORD) - 1 || pOther->m_GenNum != (FX_DWORD) - 1) { IFX_FileRead* pFile = NULL; - FX_LPBYTE pBuf = NULL; + uint8_t* pBuf = NULL; FX_DWORD offset = 0; if (pOther->m_GenNum != (FX_DWORD) - 1) { pFile = pOther->m_pFile; @@ -1023,7 +1023,7 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const } return FXSYS_memcmp32(m_pDataBuf, pOther->m_pDataBuf, m_dwSize) == 0; } -CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpfCallback, FX_LPVOID pUserData) const +CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpfCallback, void* pUserData) const { CPDF_Dictionary *pCloneDict = (CPDF_Dictionary*)m_pDict->Clone(bDirect); IFX_FileStream *pFS = NULL; @@ -1039,7 +1039,7 @@ CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpf CPDF_Stream* pObj = new CPDF_Stream(NULL, 0, NULL); CPDF_StreamFilter *pSF = GetStreamFilter(TRUE); if (pSF) { - FX_LPBYTE pBuf = FX_Alloc(uint8_t, 4096); + uint8_t* pBuf = FX_Alloc(uint8_t, 4096); FX_DWORD dwRead; do { dwRead = pSF->ReadBlock(pBuf, 4096); @@ -1054,8 +1054,8 @@ CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpf pObj->InitStream((IFX_FileRead*)pFS, pCloneDict); return pObj; } -extern FX_BOOL PDF_DataDecode(FX_LPCBYTE src_buf, FX_DWORD src_size, const CPDF_Dictionary* pDict, - FX_LPBYTE& dest_buf, FX_DWORD& dest_size, CFX_ByteString& ImageEncoding, +extern FX_BOOL PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF_Dictionary* pDict, + uint8_t*& dest_buf, FX_DWORD& dest_size, CFX_ByteString& ImageEncoding, CPDF_Dictionary*& pImageParms, FX_DWORD estimated_size, FX_BOOL bImageAcc); CPDF_StreamAcc::CPDF_StreamAcc() { @@ -1076,10 +1076,10 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, FX_BOOL bRawAccess, if (pStream->IsMemoryBased() && (!pStream->GetDict()->KeyExist(FX_BSTRC("Filter")) || bRawAccess)) { m_dwSize = pStream->m_dwSize; - m_pData = (FX_LPBYTE)pStream->m_pDataBuf; + m_pData = (uint8_t*)pStream->m_pDataBuf; return; } - FX_LPBYTE pSrcData; + uint8_t* pSrcData; FX_DWORD dwSrcSize = pStream->m_dwSize; if (dwSrcSize == 0) { return; @@ -1092,12 +1092,12 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, FX_BOOL bRawAccess, } else { pSrcData = pStream->m_pDataBuf; } - FX_LPBYTE pDecryptedData; + uint8_t* pDecryptedData; FX_DWORD dwDecryptedSize; if (pStream->m_pCryptoHandler) { CFX_BinaryBuf dest_buf; dest_buf.EstimateSize(pStream->m_pCryptoHandler->DecryptGetSize(dwSrcSize)); - FX_LPVOID context = pStream->m_pCryptoHandler->DecryptStart(pStream->GetObjNum(), pStream->m_GenNum); + void* context = pStream->m_pCryptoHandler->DecryptStart(pStream->GetObjNum(), pStream->m_GenNum); pStream->m_pCryptoHandler->DecryptStream(context, pSrcData, dwSrcSize, dest_buf); pStream->m_pCryptoHandler->DecryptFinish(context, dest_buf); pDecryptedData = dest_buf.GetBuffer(); @@ -1136,7 +1136,7 @@ CPDF_StreamAcc::~CPDF_StreamAcc() FX_Free(m_pSrcData); } } -FX_LPCBYTE CPDF_StreamAcc::GetData() const +const uint8_t* CPDF_StreamAcc::GetData() const { if (m_bNewBuf) { return m_pData; @@ -1156,15 +1156,15 @@ FX_DWORD CPDF_StreamAcc::GetSize() const } return m_pStream->m_dwSize; } -FX_LPBYTE CPDF_StreamAcc::DetachData() +uint8_t* CPDF_StreamAcc::DetachData() { if (m_bNewBuf) { - FX_LPBYTE p = m_pData; + uint8_t* p = m_pData; m_pData = NULL; m_dwSize = 0; return p; } - FX_LPBYTE p = FX_Alloc(uint8_t, m_dwSize); + uint8_t* p = FX_Alloc(uint8_t, m_dwSize); FXSYS_memcpy32(p, m_pData, m_dwSize); return p; } @@ -1187,7 +1187,8 @@ CPDF_IndirectObjects::~CPDF_IndirectObjects() { FX_POSITION pos = m_IndirectObjs.GetStartPosition(); while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_IndirectObjs.GetNextAssoc(pos, key, value); ((CPDF_Object*)value)->Destroy(); } @@ -1197,9 +1198,9 @@ CPDF_Object* CPDF_IndirectObjects::GetIndirectObject(FX_DWORD objnum, struct PAR if (objnum == 0) { return NULL; } - FX_LPVOID value; + void* value; { - if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { + if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) { if (((CPDF_Object*)value)->GetObjNum() == -1) { return NULL; } @@ -1217,18 +1218,18 @@ CPDF_Object* CPDF_IndirectObjects::GetIndirectObject(FX_DWORD objnum, struct PAR if (m_LastObjNum < objnum) { m_LastObjNum = objnum; } - if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { + if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) { if (value) { ((CPDF_Object *)value)->Destroy(); } } - m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)objnum, pObj); + m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); return pObj; } int CPDF_IndirectObjects::GetIndirectType(FX_DWORD objnum) { - FX_LPVOID value; - if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { + void* value; + if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) { return ((CPDF_Object*)value)->GetType(); } if (m_pParser) { @@ -1245,29 +1246,29 @@ FX_DWORD CPDF_IndirectObjects::AddIndirectObject(CPDF_Object* pObj) return pObj->m_ObjNum; } m_LastObjNum ++; - m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)m_LastObjNum, pObj); + m_IndirectObjs.SetAt((void*)(uintptr_t)m_LastObjNum, pObj); pObj->m_ObjNum = m_LastObjNum; return m_LastObjNum; } void CPDF_IndirectObjects::ReleaseIndirectObject(FX_DWORD objnum) { - FX_LPVOID value; - if (!m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { + void* value; + if (!m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) { return; } if (((CPDF_Object*)value)->GetObjNum() == -1) { return; } ((CPDF_Object*)value)->Destroy(); - m_IndirectObjs.RemoveKey((FX_LPVOID)(uintptr_t)objnum); + m_IndirectObjs.RemoveKey((void*)(uintptr_t)objnum); } void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pObj) { if (objnum == 0 || pObj == NULL) { return; } - FX_LPVOID value = NULL; - if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { + void* value = NULL; + if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) { if (value) { if (pObj->GetGenNum() <= ((CPDF_Object*)value)->GetGenNum()) @@ -1277,7 +1278,7 @@ void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pO } } pObj->m_ObjNum = objnum; - m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)objnum, pObj); + m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); if (m_LastObjNum < objnum) { m_LastObjNum = objnum; } diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp index a74d6a9841..3a03f33b29 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -84,7 +84,7 @@ void CPDF_Parser::CloseParser(FX_BOOL bReParse) } FX_POSITION pos = m_ObjectStreamMap.GetStartPosition(); while (pos) { - FX_LPVOID objnum; + void* objnum; CPDF_StreamAcc* pStream; m_ObjectStreamMap.GetNextAssoc(pos, objnum, (void*&)pStream); delete pStream; @@ -124,7 +124,7 @@ static int32_t GetHeaderOffset(IFX_FileRead* pFile) } return -1; } -FX_DWORD CPDF_Parser::StartParse(FX_LPCSTR filename, FX_BOOL bReParse) +FX_DWORD CPDF_Parser::StartParse(const FX_CHAR* filename, FX_BOOL bReParse) { IFX_FileRead* pFileAccess = FX_CreateFileRead(filename); if (!pFileAccess) { @@ -132,7 +132,7 @@ FX_DWORD CPDF_Parser::StartParse(FX_LPCSTR filename, FX_BOOL bReParse) } return StartParse(pFileAccess, bReParse); } -FX_DWORD CPDF_Parser::StartParse(FX_LPCWSTR filename, FX_BOOL bReParse) +FX_DWORD CPDF_Parser::StartParse(const FX_WCHAR* filename, FX_BOOL bReParse) { IFX_FileRead* pFileAccess = FX_CreateFileRead(filename); if (!pFileAccess) { @@ -179,7 +179,7 @@ FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse, FX FX_BOOL bXRefRebuilt = FALSE; if (m_Syntax.SearchWord(FX_BSTRC("startxref"), TRUE, FALSE, 4096)) { FX_FILESIZE startxref_offset = m_Syntax.SavePos(); - FX_LPVOID pResult = FXSYS_bsearch(&startxref_offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&startxref_offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_SortedOffset.Add(startxref_offset); } @@ -440,7 +440,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou { FX_FILESIZE dwStartPos = pos - m_Syntax.m_HeaderOffset; m_Syntax.RestorePos(dwStartPos); - FX_LPVOID pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_SortedOffset.Add(pos); } @@ -458,7 +458,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou FX_Free(pBuf); return FALSE; } - if (!m_Syntax.ReadBlock((FX_LPBYTE)pBuf, dwReadSize)) { + if (!m_Syntax.ReadBlock((uint8_t*)pBuf, dwReadSize)) { FX_Free(pBuf); return FALSE; } @@ -485,7 +485,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou } m_ObjVersion.SetAtGrow(objnum, version); if (m_CrossRef[objnum] < m_Syntax.m_FileLen) { - FX_LPVOID pResult = FXSYS_bsearch(&m_CrossRef[objnum], m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&m_CrossRef[objnum], m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_SortedOffset.Add(m_CrossRef[objnum]); } @@ -504,12 +504,12 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B if (m_Syntax.GetKeyword() != FX_BSTRC("xref")) { return FALSE; } - FX_LPVOID pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_SortedOffset.Add(pos); } if (streampos) { - FX_LPVOID pResult = FXSYS_bsearch(&streampos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&streampos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_SortedOffset.Add(streampos); } @@ -545,7 +545,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B FX_BOOL bFirstBlock = TRUE; for (int32_t block = 0; block < nBlocks; block ++) { int32_t block_size = block == nBlocks - 1 ? count % 1024 : 1024; - m_Syntax.ReadBlock((FX_LPBYTE)pBuf, block_size * recordsize); + m_Syntax.ReadBlock((uint8_t*)pBuf, block_size * recordsize); for (int32_t i = 0; i < block_size; i ++) { FX_DWORD objnum = start_objnum + block * 1024 + i; char* pEntry = pBuf + i * recordsize; @@ -581,7 +581,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B } m_ObjVersion.SetAtGrow(objnum, version); if (m_CrossRef[objnum] < m_Syntax.m_FileLen) { - FX_LPVOID pResult = FXSYS_bsearch(&m_CrossRef[objnum], m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&m_CrossRef[objnum], m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_SortedOffset.Add(m_CrossRef[objnum]); } @@ -630,7 +630,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() int32_t inside_index = 0; FX_DWORD objnum = 0, gennum = 0; int32_t depth = 0; - FX_LPBYTE buffer = FX_Alloc(uint8_t, 4096); + uint8_t* buffer = FX_Alloc(uint8_t, 4096); FX_FILESIZE pos = m_Syntax.m_HeaderOffset; FX_FILESIZE start_pos = 0, start_pos1 = 0; FX_FILESIZE last_obj = -1, last_xref = -1, last_trailer = -1; @@ -776,7 +776,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() } FX_FILESIZE obj_pos = start_pos - m_Syntax.m_HeaderOffset; last_obj = start_pos; - FX_LPVOID pResult = FXSYS_bsearch(&obj_pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&obj_pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_SortedOffset.Add(obj_pos); } @@ -979,14 +979,14 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() last_trailer = m_Syntax.m_FileLen; } FX_FILESIZE offset = last_trailer - m_Syntax.m_HeaderOffset; - FX_LPVOID pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_SortedOffset.Add(offset); } FX_Free(buffer); return TRUE; } -static FX_DWORD _GetVarInt(FX_LPCBYTE p, int32_t n) +static FX_DWORD _GetVarInt(const uint8_t* p, int32_t n) { FX_DWORD result = 0; for (int32_t i = 0; i < n; i ++) { @@ -1067,7 +1067,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL FX_DWORD totalWidth = dwAccWidth.ValueOrDie(); CPDF_StreamAcc acc; acc.LoadAllData(pStream); - FX_LPCBYTE pData = acc.GetData(); + const uint8_t* pData = acc.GetData(); FX_DWORD dwTotalSize = acc.GetSize(); FX_DWORD segindex = 0; for (FX_DWORD i = 0; i < arrIndex.size(); i ++) { @@ -1083,7 +1083,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL if (!dwCaculatedSize.IsValid() || dwCaculatedSize.ValueOrDie() > dwTotalSize) { continue; } - FX_LPCBYTE segstart = pData + segindex * totalWidth; + const uint8_t* segstart = pData + segindex * totalWidth; FX_SAFE_DWORD dwMaxObjNum = startnum; dwMaxObjNum += count; FX_DWORD dwV5Size = pdfium::base::checked_cast<FX_DWORD, int32_t> (m_V5Type.GetSize()); @@ -1092,14 +1092,14 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL } for (FX_DWORD j = 0; j < count; j ++) { int32_t type = 1; - FX_LPCBYTE entrystart = segstart + j * totalWidth; + const uint8_t* entrystart = segstart + j * totalWidth; if (WidthArray[0]) { type = _GetVarInt(entrystart, WidthArray[0]); } if (m_V5Type[startnum + j] == 255) { FX_FILESIZE offset = _GetVarInt(entrystart + WidthArray[0], WidthArray[1]); m_CrossRef[startnum + j] = offset; - FX_LPVOID pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_SortedOffset.Add(offset); } @@ -1115,7 +1115,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL FX_FILESIZE offset = _GetVarInt(entrystart + WidthArray[0], WidthArray[1]); m_CrossRef[startnum + j] = offset; if (type == 1) { - FX_LPVOID pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_SortedOffset.Add(offset); } @@ -1177,7 +1177,7 @@ FX_BOOL CPDF_Parser::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) return TRUE; } FX_FILESIZE pos = m_CrossRef[objnum]; - FX_LPVOID pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { return TRUE; } @@ -1211,7 +1211,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX int32_t n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N")); int32_t offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First")); CPDF_SyntaxParser syntax; - CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream((FX_LPBYTE)pObjStream->GetData(), (size_t)pObjStream->GetSize(), FALSE)); + CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream((uint8_t*)pObjStream->GetData(), (size_t)pObjStream->GetSize(), FALSE)); syntax.InitParser(file.Get(), 0); CPDF_Object* pRet = NULL; while (n) { @@ -1256,7 +1256,7 @@ FX_FILESIZE CPDF_Parser::GetObjectSize(FX_DWORD objnum) if (offset == 0) { return 0; } - FX_LPVOID pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { return 0; } @@ -1267,7 +1267,7 @@ FX_FILESIZE CPDF_Parser::GetObjectSize(FX_DWORD objnum) } return 0; } -void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWORD& size) +void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD& size) { pBuffer = NULL; size = 0; @@ -1282,9 +1282,9 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR int32_t n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N")); int32_t offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First")); CPDF_SyntaxParser syntax; - FX_LPCBYTE pData = pObjStream->GetData(); + const uint8_t* pData = pObjStream->GetData(); FX_DWORD totalsize = pObjStream->GetSize(); - CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream((FX_LPBYTE)pData, (size_t)totalsize, FALSE)); + CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream((uint8_t*)pData, (size_t)totalsize, FALSE)); syntax.InitParser(file.Get(), 0); while (n) { FX_DWORD thisnum = syntax.GetDirectNum(); @@ -1332,7 +1332,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR m_Syntax.RestorePos(SavedPos); return; } - FX_LPVOID pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_Syntax.RestorePos(SavedPos); return; @@ -1662,7 +1662,7 @@ FX_DWORD CPDF_Parser::LoadLinearizedMainXRefTable() m_LastXRefOffset += dwCount; FX_POSITION pos = m_ObjectStreamMap.GetStartPosition(); while (pos) { - FX_LPVOID objnum; + void* objnum; CPDF_StreamAcc* pStream; m_ObjectStreamMap.GetNextAssoc(pos, objnum, (void*&)pStream); delete pStream; @@ -1765,7 +1765,7 @@ FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch) ch = m_pFileBuf[pos - m_BufOffset]; return TRUE; } -FX_BOOL CPDF_SyntaxParser::ReadBlock(FX_LPBYTE pBuf, FX_DWORD size) +FX_BOOL CPDF_SyntaxParser::ReadBlock(uint8_t* pBuf, FX_DWORD size) { if (!m_pFileAccess->ReadBlock(pBuf, m_Pos + m_HeaderOffset, size)) { return FALSE; @@ -2047,12 +2047,12 @@ CFX_ByteString CPDF_SyntaxParser::GetNextWord(FX_BOOL& bIsNumber) { GetNextWord(); bIsNumber = m_bIsNumber; - return CFX_ByteString((FX_LPCSTR)m_WordBuffer, m_WordSize); + return CFX_ByteString((const FX_CHAR*)m_WordBuffer, m_WordSize); } CFX_ByteString CPDF_SyntaxParser::GetKeyword() { GetNextWord(); - return CFX_ByteString((FX_LPCSTR)m_WordBuffer, m_WordSize); + return CFX_ByteString((const FX_CHAR*)m_WordBuffer, m_WordSize); } CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWORD objnum, FX_DWORD gennum, PARSE_CONTEXT* pContext, FX_BOOL bDecrypt) { @@ -2477,12 +2477,12 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT m_Pos = StreamStartPos; } CPDF_Stream* pStream; - FX_LPBYTE pData = FX_Alloc(uint8_t, len); + uint8_t* pData = FX_Alloc(uint8_t, len); ReadBlock(pData, len); if (pCryptoHandler) { CFX_BinaryBuf dest_buf; dest_buf.EstimateSize(pCryptoHandler->DecryptGetSize(len)); - FX_LPVOID context = pCryptoHandler->DecryptStart(objnum, gennum); + void* context = pCryptoHandler->DecryptStart(objnum, gennum); pCryptoHandler->DecryptStream(context, pData, len, dest_buf); pCryptoHandler->DecryptFinish(context, dest_buf); FX_Free(pData); @@ -2522,9 +2522,9 @@ int32_t CPDF_SyntaxParser::GetDirectNum() return 0; } m_WordBuffer[m_WordSize] = 0; - return FXSYS_atoi((FX_LPCSTR)m_WordBuffer); + return FXSYS_atoi((const FX_CHAR*)m_WordBuffer); } -FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, FX_LPCBYTE tag, FX_DWORD taglen) +FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, const uint8_t* tag, FX_DWORD taglen) { uint8_t type = PDF_CharType[tag[0]]; FX_BOOL bCheckLeft = type != 'D' && type != 'W'; @@ -2556,7 +2556,7 @@ FX_BOOL CPDF_SyntaxParser::SearchWord(FX_BSTR tag, FX_BOOL bWholeWord, FX_BOOL b if (!bForward) { offset = taglen - 1; } - FX_LPCBYTE tag_data = tag.GetPtr(); + const uint8_t* tag_data = tag.GetPtr(); uint8_t byte; while (1) { if (bForward) { @@ -2612,7 +2612,7 @@ FX_BOOL CPDF_SyntaxParser::SearchWord(FX_BSTR tag, FX_BOOL bWholeWord, FX_BOOL b return FALSE; } struct _SearchTagRecord { - FX_LPCBYTE m_pTag; + const uint8_t* m_pTag; FX_DWORD m_Len; FX_DWORD m_Offset; }; @@ -2767,7 +2767,7 @@ protected: FX_BOOL CheckAllCrossRefStream(IFX_DownloadHints *pHints); int32_t CheckCrossRefStream(IFX_DownloadHints *pHints, FX_FILESIZE &xref_offset); - FX_BOOL IsLinearizedFile(FX_LPBYTE pData, FX_DWORD dwLen); + FX_BOOL IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen); void SetStartOffset(FX_FILESIZE dwOffset); FX_BOOL GetNextToken(CFX_ByteString &token); FX_BOOL GetNextChar(uint8_t &ch); @@ -3017,7 +3017,7 @@ FX_DWORD CPDF_DataAvail::GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset) if (offset == 0) { return 0; } - FX_LPVOID pResult = FXSYS_bsearch(&offset, pParser->m_SortedOffset.GetData(), pParser->m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&offset, pParser->m_SortedOffset.GetData(), pParser->m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { return 0; } @@ -3706,7 +3706,7 @@ int32_t CPDF_DataAvail::IsLinearizedPDF() } return PDF_NOT_LINEARIZED; } -FX_BOOL CPDF_DataAvail::IsLinearizedFile(FX_LPBYTE pData, FX_DWORD dwLen) +FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen) { CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pData, (size_t)dwLen, FALSE)); int32_t offset = GetHeaderOffset(file.Get()); @@ -3790,7 +3790,7 @@ int32_t CPDF_DataAvail::CheckCrossRefStream(IFX_DownloadHints* pHints, FX_FILESI if (m_pFileAvail->IsDataAvail(m_Pos, req_size)) { int32_t iSize = (int32_t)(m_Pos + req_size - m_dwCurrentXRefSteam); CFX_BinaryBuf buf(iSize); - FX_LPBYTE pBuf = buf.GetBuffer(); + uint8_t* pBuf = buf.GetBuffer(); m_pFileRead->ReadBlock(pBuf, m_dwCurrentXRefSteam, iSize); CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pBuf, (size_t)iSize, FALSE)); m_parser.m_Syntax.InitParser(file.Get(), 0); @@ -4028,7 +4028,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints) if (m_pFileAvail->IsDataAvail(m_Pos, iTrailerSize)) { int32_t iSize = (int32_t)(m_Pos + iTrailerSize - m_dwTrailerOffset); CFX_BinaryBuf buf(iSize); - FX_LPBYTE pBuf = buf.GetBuffer(); + uint8_t* pBuf = buf.GetBuffer(); if (!pBuf) { m_docStatus = PDF_DATAAVAIL_ERROR; return FALSE; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp index b02139db0f..e6474550a2 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp @@ -43,7 +43,7 @@ const char PDF_CharType[256] = { #ifndef MAX_PATH #define MAX_PATH 4096 #endif -CPDF_SimpleParser::CPDF_SimpleParser(FX_LPCBYTE pData, FX_DWORD dwSize) +CPDF_SimpleParser::CPDF_SimpleParser(const uint8_t* pData, FX_DWORD dwSize) { m_pData = pData; m_dwSize = dwSize; @@ -55,7 +55,7 @@ CPDF_SimpleParser::CPDF_SimpleParser(FX_BSTR str) m_dwSize = str.GetLength(); m_dwCurPos = 0; } -void CPDF_SimpleParser::ParseWord(FX_LPCBYTE& pStart, FX_DWORD& dwSize, int& type) +void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, FX_DWORD& dwSize, int& type) { pStart = NULL; dwSize = 0; @@ -153,7 +153,7 @@ void CPDF_SimpleParser::ParseWord(FX_LPCBYTE& pStart, FX_DWORD& dwSize, int& typ } CFX_ByteStringC CPDF_SimpleParser::GetWord() { - FX_LPCBYTE pStart; + const uint8_t* pStart; FX_DWORD dwSize; int type; ParseWord(pStart, dwSize, type); @@ -290,13 +290,13 @@ static int _hex2dec(char ch) CFX_ByteString PDF_NameDecode(FX_BSTR bstr) { int size = bstr.GetLength(); - FX_LPCSTR pSrc = bstr.GetCStr(); + const FX_CHAR* pSrc = bstr.GetCStr(); if (FXSYS_memchr(pSrc, '#', size) == NULL) { return bstr; } CFX_ByteString result; - FX_LPSTR pDestStart = result.GetBuffer(size); - FX_LPSTR pDest = pDestStart; + FX_CHAR* pDestStart = result.GetBuffer(size); + FX_CHAR* pDest = pDestStart; for (int i = 0; i < size; i ++) { if (pSrc[i] == '#' && i < size - 2) { *pDest ++ = _hex2dec(pSrc[i + 1]) * 16 + _hex2dec(pSrc[i + 2]); @@ -317,7 +317,7 @@ CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig) } CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) { - FX_LPBYTE src_buf = (FX_LPBYTE)orig.c_str(); + uint8_t* src_buf = (uint8_t*)orig.c_str(); int src_len = orig.GetLength(); int dest_len = 0; int i; @@ -334,7 +334,7 @@ CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) return orig; } CFX_ByteString res; - FX_LPSTR dest_buf = res.GetBuffer(dest_len); + FX_CHAR* dest_buf = res.GetBuffer(dest_len); dest_len = 0; for (i = 0; i < src_len; i ++) { uint8_t ch = src_buf[i]; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp index d22bd4b760..46f1640793 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp @@ -29,7 +29,8 @@ void CPDF_PageRenderCache::ClearAll() { FX_POSITION pos = m_ImageCaches.GetStartPosition(); while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_ImageCaches.GetNextAssoc(pos, key, value); delete (CPDF_ImageCache*)value; } @@ -47,7 +48,8 @@ void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) FX_POSITION pos = m_ImageCaches.GetStartPosition(); int i = 0; while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_ImageCaches.GetNextAssoc(pos, key, value); pCACHEINFO[i].time = ((CPDF_ImageCache*)value)->GetTimeCount(); pCACHEINFO[i++].pStream = ((CPDF_ImageCache*)value)->GetStream(); @@ -72,7 +74,7 @@ void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) } void CPDF_PageRenderCache::ClearImageCache(CPDF_Stream* pStream) { - FX_LPVOID value = m_ImageCaches.GetValueAt(pStream); + void* value = m_ImageCaches.GetValueAt(pStream); if (value == NULL) { m_ImageCaches.RemoveKey(pStream); return; @@ -86,7 +88,8 @@ FX_DWORD CPDF_PageRenderCache::EstimateSize() FX_DWORD dwSize = 0; FX_POSITION pos = m_ImageCaches.GetStartPosition(); while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_ImageCaches.GetNextAssoc(pos, key, value); dwSize += ((CPDF_ImageCache*)value)->EstimateSize(); } @@ -99,7 +102,7 @@ FX_DWORD CPDF_PageRenderCache::GetCachedSize(CPDF_Stream* pStream) const return m_nCacheSize; } CPDF_ImageCache* pImageCache; - if (!m_ImageCaches.Lookup(pStream, (FX_LPVOID&)pImageCache)) { + if (!m_ImageCaches.Lookup(pStream, (void*&)pImageCache)) { return 0; } return pImageCache->EstimateSize(); @@ -109,7 +112,7 @@ void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*& int32_t downsampleWidth, int32_t downsampleHeight) { CPDF_ImageCache* pImageCache; - FX_BOOL bFind = m_ImageCaches.Lookup(pStream, (FX_LPVOID&)pImageCache); + FX_BOOL bFind = m_ImageCaches.Lookup(pStream, (void*&)pImageCache); if (!bFind) { pImageCache = new CPDF_ImageCache(m_pPage->m_pDocument, pStream); } @@ -124,7 +127,7 @@ void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*& } FX_BOOL CPDF_PageRenderCache::StartGetCachedBitmap(CPDF_Stream* pStream, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t downsampleWidth, int32_t downsampleHeight) { - m_bCurFindCache = m_ImageCaches.Lookup(pStream, (FX_LPVOID&)m_pCurImageCache); + m_bCurFindCache = m_ImageCaches.Lookup(pStream, (void*&)m_pCurImageCache); if (!m_bCurFindCache) { m_pCurImageCache = new CPDF_ImageCache(m_pPage->m_pDocument, pStream); } @@ -159,7 +162,7 @@ FX_BOOL CPDF_PageRenderCache::Continue(IFX_Pause* pPause) void CPDF_PageRenderCache::ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap) { CPDF_ImageCache* pImageCache; - if (!m_ImageCaches.Lookup(pStream, (FX_LPVOID&)pImageCache)) { + if (!m_ImageCaches.Lookup(pStream, (void*&)pImageCache)) { if (pBitmap == NULL) { return; } @@ -209,7 +212,8 @@ void CPDF_PageRenderCache::ClearImageData() { FX_POSITION pos = m_ImageCaches.GetStartPosition(); while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_ImageCaches.GetNextAssoc(pos, key, value); ((CPDF_ImageCache*)value)->ClearImageData(); } diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp index 699f84830f..669ba4da49 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -141,7 +141,7 @@ CPDF_DIBTransferFunc::CPDF_DIBTransferFunc(const CPDF_TransferFunc* pTransferFun m_RampG = &pTransferFunc->m_Samples[256]; m_RampB = &pTransferFunc->m_Samples[512]; } -void CPDF_DIBTransferFunc::TranslateScanline(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf) const +void CPDF_DIBTransferFunc::TranslateScanline(uint8_t* dest_buf, const uint8_t* src_buf) const { int i; FX_BOOL bSkip = FALSE; @@ -234,7 +234,7 @@ void CPDF_DIBTransferFunc::TranslateScanline(FX_LPBYTE dest_buf, FX_LPCBYTE src_ break; } } -void CPDF_DIBTransferFunc::TranslateDownSamples(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf, int pixels, int Bpp) const +void CPDF_DIBTransferFunc::TranslateDownSamples(uint8_t* dest_buf, const uint8_t* src_buf, int pixels, int Bpp) const { if (Bpp == 8) { for (int i = 0; i < pixels; i ++) { @@ -519,8 +519,8 @@ FX_BOOL CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) int matte_g = FXARGB_G(m_Loader.m_MatteColor); int matte_b = FXARGB_B(m_Loader.m_MatteColor); for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = (FX_LPBYTE)bitmap_device1.GetBitmap()->GetScanline(row); - FX_LPCBYTE mask_scan = bitmap_device2.GetBitmap()->GetScanline(row); + uint8_t* dest_scan = (uint8_t*)bitmap_device1.GetBitmap()->GetScanline(row); + const uint8_t* mask_scan = bitmap_device2.GetBitmap()->GetScanline(row); for (int col = 0; col < width; col ++) { int alpha = *mask_scan ++; if (alpha) { @@ -606,8 +606,8 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() int matte_g = FXARGB_G(m_Loader.m_MatteColor); int matte_b = FXARGB_B(m_Loader.m_MatteColor); for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = (FX_LPBYTE)bitmap_device1.GetBitmap()->GetScanline(row); - FX_LPCBYTE mask_scan = bitmap_device2.GetBitmap()->GetScanline(row); + uint8_t* dest_scan = (uint8_t*)bitmap_device1.GetBitmap()->GetScanline(row); + const uint8_t* mask_scan = bitmap_device2.GetBitmap()->GetScanline(row); for (int col = 0; col < width; col ++) { int alpha = *mask_scan ++; if (alpha) { @@ -823,7 +823,7 @@ CPDF_QuickStretcher::~CPDF_QuickStretcher() delete m_pDecoder; } } -ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, const CPDF_Dictionary* pParams); FX_BOOL CPDF_QuickStretcher::Start(CPDF_ImageObject* pImageObj, CFX_AffineMatrix* pImage2Device, const FX_RECT* pClipBox) { @@ -903,7 +903,7 @@ FX_BOOL CPDF_QuickStretcher::Start(CPDF_ImageObject* pImageObj, CFX_AffineMatrix } FX_BOOL CPDF_QuickStretcher::Continue(IFX_Pause* pPause) { - FX_LPBYTE result_buf = m_pBitmap->GetBuffer(); + uint8_t* result_buf = m_pBitmap->GetBuffer(); int src_width = m_pDecoder ? m_pDecoder->GetWidth() : m_SrcWidth; int src_height = m_pDecoder ? m_pDecoder->GetHeight() : m_SrcHeight; int src_pitch = src_width * m_Bpp; @@ -916,7 +916,7 @@ FX_BOOL CPDF_QuickStretcher::Continue(IFX_Pause* pPause) dest_y = m_LineIndex; src_y = (dest_y + m_ClipTop) * src_height / m_DestHeight; } - FX_LPCBYTE src_scan; + const uint8_t* src_scan; if (m_pDecoder) { src_scan = m_pDecoder->GetScanline(src_y); if (src_scan == NULL) { @@ -929,11 +929,11 @@ FX_BOOL CPDF_QuickStretcher::Continue(IFX_Pause* pPause) } src_scan += src_y * src_pitch; } - FX_LPBYTE result_scan = result_buf + dest_y * m_pBitmap->GetPitch(); + uint8_t* result_scan = result_buf + dest_y * m_pBitmap->GetPitch(); for (int x = 0; x < m_ResultWidth; x ++) { int dest_x = m_ClipLeft + x; int src_x = (m_bFlipX ? (m_DestWidth - dest_x - 1) : dest_x) * src_width / m_DestWidth; - FX_LPCBYTE src_pixel = src_scan + src_x * m_Bpp; + const uint8_t* src_pixel = src_scan + src_x * m_Bpp; if (m_pCS == NULL) { *result_scan = src_pixel[2]; result_scan ++; @@ -1049,11 +1049,11 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, delete pMask; return NULL; } - FX_LPBYTE dest_buf = pMask->GetBuffer(); + uint8_t* dest_buf = pMask->GetBuffer(); int dest_pitch = pMask->GetPitch(); - FX_LPBYTE src_buf = bitmap.GetBuffer(); + uint8_t* src_buf = bitmap.GetBuffer(); int src_pitch = bitmap.GetPitch(); - FX_LPBYTE pTransfer = FX_Alloc(uint8_t, 256); + uint8_t* pTransfer = FX_Alloc(uint8_t, 256); if (pFunc) { CFX_FixedBufGrow<FX_FLOAT, 16> results(pFunc->CountOutputs()); for (int i = 0; i < 256; i ++) { @@ -1070,8 +1070,8 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, if (bLuminosity) { int Bpp = bitmap.GetBPP() / 8; for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_pos = dest_buf + row * dest_pitch; - FX_LPBYTE src_pos = src_buf + row * src_pitch; + uint8_t* dest_pos = dest_buf + row * dest_pitch; + uint8_t* src_pos = src_buf + row * src_pitch; for (int col = 0; col < width; col ++) { *dest_pos ++ = pTransfer[FXRGB2GRAY(src_pos[2], src_pos[1], *src_pos)]; src_pos += Bpp; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index d45cc1151f..2cbe2e8eb6 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -16,7 +16,7 @@ namespace { -unsigned int _GetBits8(FX_LPCBYTE pData, int bitpos, int nbits) +unsigned int _GetBits8(const uint8_t* pData, int bitpos, int nbits) { unsigned int byte = pData[bitpos / 8]; if (nbits == 8) { @@ -584,9 +584,9 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, FX } return pCompData; } -ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, const CPDF_Dictionary* pParams); -ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, const CPDF_Dictionary* pParams); int CPDF_DIBSource::CreateDecoder() { @@ -597,7 +597,7 @@ int CPDF_DIBSource::CreateDecoder() if (m_bDoBpcCheck && m_bpc == 0) { return 0; } - FX_LPCBYTE src_data = m_pStreamAcc->GetData(); + const uint8_t* src_data = m_pStreamAcc->GetData(); FX_DWORD src_size = m_pStreamAcc->GetSize(); const CPDF_Dictionary* pParams = m_pStreamAcc->GetImageParam(); if (decoder == FX_BSTRC("CCITTFaxDecode")) { @@ -750,7 +750,7 @@ void CPDF_DIBSource::LoadJpxBitmap() m_bpc < 8) { int scale = 8 - m_bpc; for (FX_DWORD row = 0; row < height; ++row) { - FX_LPBYTE scanline = (FX_LPBYTE)m_pCachedBitmap->GetScanline(row); + uint8_t* scanline = (uint8_t*)m_pCachedBitmap->GetScanline(row); for (FX_DWORD col = 0; col < width; ++col) { *scanline = (*scanline) >> scale; ++scanline; @@ -960,7 +960,7 @@ void CPDF_DIBSource::ValidateDictParam() } } #define NORMALCOLOR_MAX(color, max) (color) > (max) ? (max) : (color) < 0 ? 0 : (color); -void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan) const +void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan, const uint8_t* src_scan) const { if (m_bpc == 0) { return; @@ -968,7 +968,7 @@ void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_ int max_data = (1 << m_bpc) - 1; if (m_bDefaultDecode) { if (m_Family == PDFCS_DEVICERGB || m_Family == PDFCS_CALRGB) { - FX_LPCBYTE src_pos = src_scan; + const uint8_t* src_pos = src_scan; switch (m_bpc) { case 16: for (int col = 0; col < m_Width; col ++) { @@ -1070,14 +1070,14 @@ void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_ } } } -FX_LPBYTE CPDF_DIBSource::GetBuffer() const +uint8_t* CPDF_DIBSource::GetBuffer() const { if (m_pCachedBitmap) { return m_pCachedBitmap->GetBuffer(); } return NULL; } -FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const +const uint8_t* CPDF_DIBSource::GetScanline(int line) const { if (m_bpc == 0) { return NULL; @@ -1086,7 +1086,7 @@ FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const if (!src_pitch.IsValid()) return NULL; FX_DWORD src_pitch_value = src_pitch.ValueOrDie(); - FX_LPCBYTE pSrcLine = NULL; + const uint8_t* pSrcLine = NULL; if (m_pCachedBitmap) { if (line >= m_pCachedBitmap->GetHeight()) { line = m_pCachedBitmap->GetHeight() - 1; @@ -1100,7 +1100,7 @@ FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const } } if (pSrcLine == NULL) { - FX_LPBYTE pLineBuf = m_pMaskedLine ? m_pMaskedLine : m_pLineBuf; + uint8_t* pLineBuf = m_pMaskedLine ? m_pMaskedLine : m_pLineBuf; FXSYS_memset8(pLineBuf, 0xff, m_Pitch); return pLineBuf; } @@ -1152,8 +1152,8 @@ FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const } } if (m_bColorKey) { - FX_LPBYTE pDestPixel = m_pMaskedLine; - FX_LPCBYTE pSrcPixel = m_pLineBuf; + uint8_t* pDestPixel = m_pMaskedLine; + const uint8_t* pSrcPixel = m_pLineBuf; for (int col = 0; col < m_Width; col ++) { uint8_t index = *pSrcPixel++; if (m_pPalette) { @@ -1174,9 +1174,9 @@ FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const } if (m_bColorKey) { if (m_nComponents == 3 && m_bpc == 8) { - FX_LPBYTE alpha_channel = m_pMaskedLine + 3; + uint8_t* alpha_channel = m_pMaskedLine + 3; for (int col = 0; col < m_Width; col ++) { - FX_LPCBYTE pPixel = pSrcLine + col * 3; + const uint8_t* pPixel = pSrcLine + col * 3; alpha_channel[col * 4] = (pPixel[0] < m_pCompData[0].m_ColorKeyMin || pPixel[0] > m_pCompData[0].m_ColorKeyMax || pPixel[1] < m_pCompData[1].m_ColorKeyMin || pPixel[1] > m_pCompData[1].m_ColorKeyMax || pPixel[2] < m_pCompData[2].m_ColorKeyMin || pPixel[2] > m_pCompData[2].m_ColorKeyMax) ? 0xff : 0; @@ -1190,8 +1190,8 @@ FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const pSrcLine = m_pLineBuf; } if (m_bColorKey) { - FX_LPCBYTE pSrcPixel = pSrcLine; - FX_LPBYTE pDestPixel = m_pMaskedLine; + const uint8_t* pSrcPixel = pSrcLine; + uint8_t* pDestPixel = m_pMaskedLine; for (int col = 0; col < m_Width; col ++) { *pDestPixel++ = *pSrcPixel++; *pDestPixel++ = *pSrcPixel++; @@ -1209,7 +1209,7 @@ FX_BOOL CPDF_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const } return FALSE; } -void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_bpp, +void CPDF_DIBSource::DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const { if (line < 0 || dest_scan == NULL || dest_bpp <= 0 || @@ -1223,7 +1223,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ return; } - FX_LPCBYTE pSrcLine = NULL; + const uint8_t* pSrcLine = NULL; if (m_pCachedBitmap) { pSrcLine = m_pCachedBitmap->GetScanline(line); } else if (m_pDecoder) { @@ -1344,7 +1344,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ src_x = src_width - src_x - 1; } src_x %= src_width; - FX_LPBYTE pDestPixel = dest_scan + i * 4; + uint8_t* pDestPixel = dest_scan + i * 4; uint8_t index = pSrcLine[src_x]; if (m_pPalette) { *pDestPixel++ = FXARGB_B(m_pPalette[index]); @@ -1386,13 +1386,13 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ int dest_x = clip_left + i; FX_DWORD src_x = (bFlipX ? (dest_width - dest_x - 1) : dest_x) * (int64_t)src_width / dest_width; src_x %= src_width; - FX_LPCBYTE pSrcPixel = NULL; + const uint8_t* pSrcPixel = NULL; if (m_bpc % 8 == 0) { pSrcPixel = pSrcLine + src_x * orig_Bpp; } else { pSrcPixel = pSrcLine + (int)(src_x * orig_Not8Bpp); } - FX_LPBYTE pDestPixel = dest_scan + i * dest_Bpp; + uint8_t* pDestPixel = dest_scan + i * dest_Bpp; FX_ARGB argb; if (src_x == last_src_x) { argb = last_argb; @@ -1536,7 +1536,7 @@ FX_BOOL CPDF_ImageLoader::Load(const CPDF_ImageObject* pImage, CPDF_PageRenderCa } return FALSE; } -FX_BOOL CPDF_ImageLoader::StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_LPVOID& LoadHandle, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t nDownsampleWidth, int32_t nDownsampleHeight) +FX_BOOL CPDF_ImageLoader::StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, void*& LoadHandle, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t nDownsampleWidth, int32_t nDownsampleHeight) { m_nDownsampleWidth = nDownsampleWidth; m_nDownsampleHeight = nDownsampleHeight; @@ -1545,7 +1545,7 @@ FX_BOOL CPDF_ImageLoader::StartLoadImage(const CPDF_ImageObject* pImage, CPDF_Pa LoadHandle = pLoaderHandle; return ret; } -FX_BOOL CPDF_ImageLoader::Continue(FX_LPVOID LoadHandle, IFX_Pause* pPause) +FX_BOOL CPDF_ImageLoader::Continue(void* LoadHandle, IFX_Pause* pPause) { return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause); } diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index e02cd421ff..2243bff979 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -357,7 +357,7 @@ static void _DrawGouraud(CFX_DIBitmap* pBitmap, int alpha, CPDF_MeshVertex trian if (end_x > pBitmap->GetWidth()) { end_x = pBitmap->GetWidth(); } - FX_LPBYTE dib_buf = pBitmap->GetBuffer() + y * pBitmap->GetPitch() + start_x * 4; + uint8_t* dib_buf = pBitmap->GetBuffer() + y * pBitmap->GetPitch() + start_x * 4; FX_FLOAT r_unit = (r[end_index] - r[start_index]) / (max_x - min_x); FX_FLOAT g_unit = (g[end_index] - g[start_index]) / (max_x - min_x); FX_FLOAT b_unit = (b[end_index] - b[start_index]) / (max_x - min_x); @@ -1066,7 +1066,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, CPDF_Pag if (pPattern->m_bColored) { *dest_buf = *src_buf; } else { - *dest_buf = (*(FX_LPBYTE)src_buf << 24) | (fill_argb & 0xffffff); + *dest_buf = (*(uint8_t*)src_buf << 24) | (fill_argb & 0xffffff); } } else { if (pPattern->m_bColored) { diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp index 410e78a67b..e8ef861ba1 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -33,17 +33,17 @@ CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(FX_DWORD charcode, const CFX_AffineM m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); } CFX_GlyphBitmap* pGlyphBitmap; - if(pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(uintptr_t)charcode, (void*&)pGlyphBitmap)) { + if(pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)charcode, (void*&)pGlyphBitmap)) { return pGlyphBitmap; } pGlyphBitmap = RenderGlyph(pSizeCache, charcode, pMatrix, retinaScaleX, retinaScaleY); - pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)charcode, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)charcode, pGlyphBitmap); return pGlyphBitmap; } CPDF_Type3Glyphs::~CPDF_Type3Glyphs() { FX_POSITION pos = m_GlyphMap.GetStartPosition(); - FX_LPVOID Key; + void* Key; CFX_GlyphBitmap* pGlyphBitmap; while(pos) { m_GlyphMap.GetNextAssoc(pos, Key, (void*&)pGlyphBitmap); @@ -76,7 +76,7 @@ void CPDF_Type3Glyphs::AdjustBlue(FX_FLOAT top, FX_FLOAT bottom, int& top_line, top_line = _AdjustBlue(top, m_TopBlueCount, m_TopBlue); bottom_line = _AdjustBlue(bottom, m_BottomBlueCount, m_BottomBlue); } -static FX_BOOL _IsScanLine1bpp(FX_LPBYTE pBuf, int width) +static FX_BOOL _IsScanLine1bpp(uint8_t* pBuf, int width) { int size = width / 8; for (int i = 0; i < size; i ++) @@ -89,7 +89,7 @@ static FX_BOOL _IsScanLine1bpp(FX_LPBYTE pBuf, int width) } return FALSE; } -static FX_BOOL _IsScanLine8bpp(FX_LPBYTE pBuf, int width) +static FX_BOOL _IsScanLine8bpp(uint8_t* pBuf, int width) { for (int i = 0; i < width; i ++) if (pBuf[i] > 0x40) { @@ -104,7 +104,7 @@ static int _DetectFirstLastScan(const CFX_DIBitmap* pBitmap, FX_BOOL bFirst) if (bpp > 8) { width *= bpp / 8; } - FX_LPBYTE pBuf = pBitmap->GetBuffer(); + uint8_t* pBuf = pBitmap->GetBuffer(); int line = bFirst ? 0 : height - 1; int line_step = bFirst ? 1 : -1; int line_end = bFirst ? height : -1; @@ -564,7 +564,7 @@ void CPDF_CharPosList::Load(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pCharPos charpos.m_OriginX -= FontSize * vx / 1000; charpos.m_OriginY -= FontSize * vy / 1000; } - FX_LPCBYTE pTransform = pCIDFont->GetCIDTransform(CID); + const uint8_t* pTransform = pCIDFont->GetCIDTransform(CID); if (pTransform && !bVert) { charpos.m_AdjustMatrix[0] = _CIDTransformToFloat(pTransform[0]); charpos.m_AdjustMatrix[2] = _CIDTransformToFloat(pTransform[2]); diff --git a/core/src/fpdfapi/fpdf_render/render_int.h b/core/src/fpdfapi/fpdf_render/render_int.h index 0b6873409b..8d40b17f85 100644 --- a/core/src/fpdfapi/fpdf_render/render_int.h +++ b/core/src/fpdfapi/fpdf_render/render_int.h @@ -197,8 +197,8 @@ public: FX_BOOL Load(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL); - FX_BOOL StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_LPVOID& LoadHandle, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, int32_t nDownsampleWidth = 0, int32_t nDownsampleHeight = 0); - FX_BOOL Continue(FX_LPVOID LoadHandle, IFX_Pause* pPause); + FX_BOOL StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, void*& LoadHandle, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, int32_t nDownsampleWidth = 0, int32_t nDownsampleHeight = 0); + FX_BOOL Continue(void* LoadHandle, IFX_Pause* pPause); ~CPDF_ImageLoader(); CFX_DIBSource* m_pBitmap; CFX_DIBSource* m_pMask; @@ -250,8 +250,8 @@ protected: CPDF_QuickStretcher* m_pQuickStretcher; CFX_ImageTransformer* m_pTransformer; CPDF_ImageRenderer* m_pRenderer2; - FX_LPVOID m_DeviceHandle; - FX_LPVOID m_LoadHandle; + void* m_DeviceHandle; + void* m_LoadHandle; FX_BOOL m_bStdCS; int m_BlendType; FX_BOOL StartBitmapAlpha(); @@ -390,9 +390,9 @@ public: CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE); virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const; - virtual FX_LPBYTE GetBuffer() const; - virtual FX_LPCBYTE GetScanline(int line) const; - virtual void DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_bpp, + virtual uint8_t* GetBuffer() const; + virtual const uint8_t* GetScanline(int line) const; + virtual void DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const; virtual void SetDownSampleSize(int dest_width, int dest_height) const; CFX_DIBitmap* GetBitmap() const; @@ -410,7 +410,7 @@ public: CPDF_DIBSource* DetachMask(); CPDF_DIBSource* m_pMask; FX_DWORD m_MatteColor; - FX_LPVOID m_pJbig2Context; + void* m_pJbig2Context; CPDF_StreamAcc* m_pGlobalStream; FX_BOOL m_bStdCS; int m_Status; @@ -424,7 +424,7 @@ protected: void LoadJpxBitmap(); void LoadPalette(); int CreateDecoder(); - void TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan) const; + void TranslateScanline24bpp(uint8_t* dest_scan, const uint8_t* src_scan) const; void ValidateDictParam(); CPDF_Document* m_pDocument; const CPDF_Stream* m_pStream; @@ -442,8 +442,8 @@ protected: FX_BOOL m_bDoBpcCheck; FX_BOOL m_bColorKey; DIB_COMP_DATA* m_pCompData; - FX_LPBYTE m_pLineBuf; - FX_LPBYTE m_pMaskedLine; + uint8_t* m_pLineBuf; + uint8_t* m_pMaskedLine; nonstd::unique_ptr<CFX_DIBitmap> m_pCachedBitmap; ICodec_ScanlineDecoder* m_pDecoder; }; @@ -457,11 +457,11 @@ public: { return NULL; } - virtual void TranslateScanline(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf) const; - virtual void TranslateDownSamples(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf, int pixels, int Bpp) const; - FX_LPCBYTE m_RampR; - FX_LPCBYTE m_RampG; - FX_LPCBYTE m_RampB; + virtual void TranslateScanline(uint8_t* dest_buf, const uint8_t* src_buf) const; + virtual void TranslateDownSamples(uint8_t* dest_buf, const uint8_t* src_buf, int pixels, int Bpp) const; + const uint8_t* m_RampR; + const uint8_t* m_RampG; + const uint8_t* m_RampB; }; struct _CPDF_UniqueKeyGen { void Generate(int count, ...); diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp index 5086fba3a3..3fe20b6e28 100644 --- a/core/src/fpdfdoc/doc_annot.cpp +++ b/core/src/fpdfdoc/doc_annot.cpp @@ -129,7 +129,7 @@ void CPDF_AnnotList::DisplayAnnots(const CPDF_Page* pPage, CFX_RenderDevice* pDe int CPDF_AnnotList::GetIndex(CPDF_Annot* pAnnot) { for (int i = 0; i < m_AnnotList.GetSize(); ++i) - if (m_AnnotList[i] == (FX_LPVOID)pAnnot) { + if (m_AnnotList[i] == (void*)pAnnot) { return i; } return -1; diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp index dfa2e6718a..f9e692cb69 100644 --- a/core/src/fpdfdoc/doc_basic.cpp +++ b/core/src/fpdfdoc/doc_basic.cpp @@ -251,7 +251,7 @@ CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc, FX_BSTR sName) return NULL; } #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -static CFX_WideString ChangeSlashToPlatform(FX_LPCWSTR str) +static CFX_WideString ChangeSlashToPlatform(const FX_WCHAR* str) { CFX_WideString result; while (*str) { @@ -268,7 +268,7 @@ static CFX_WideString ChangeSlashToPlatform(FX_LPCWSTR str) } return result; } -static CFX_WideString ChangeSlashToPDF(FX_LPCWSTR str) +static CFX_WideString ChangeSlashToPDF(const FX_WCHAR* str) { CFX_WideString result; while (*str) { diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp index f791a325e4..753ade0411 100644 --- a/core/src/fpdfdoc/doc_form.cpp +++ b/core/src/fpdfdoc/doc_form.cpp @@ -19,7 +19,7 @@ public: m_pEnd = m_pStart + full_name.GetLength(); m_pCur = m_pStart; } - void GetNext(FX_LPCWSTR &pSubName, FX_STRSIZE& size) + void GetNext(const FX_WCHAR* &pSubName, FX_STRSIZE& size) { pSubName = m_pCur; while (m_pCur < m_pEnd && m_pCur[0] != L'.') { @@ -31,9 +31,9 @@ public: } } protected: - FX_LPCWSTR m_pStart; - FX_LPCWSTR m_pEnd; - FX_LPCWSTR m_pCur; + const FX_WCHAR* m_pStart; + const FX_WCHAR* m_pEnd; + const FX_WCHAR* m_pCur; }; class CFieldTree { @@ -159,7 +159,7 @@ void CFieldTree::SetField(const CFX_WideString &full_name, CPDF_FormField *field return; } _CFieldNameExtractor name_extractor(full_name); - FX_LPCWSTR pName; + const FX_WCHAR* pName; FX_STRSIZE nLength; name_extractor.GetNext(pName, nLength); _Node *pNode = &m_Root, *pLast = NULL; @@ -182,7 +182,7 @@ CPDF_FormField *CFieldTree::GetField(const CFX_WideString &full_name) return NULL; } _CFieldNameExtractor name_extractor(full_name); - FX_LPCWSTR pName; + const FX_WCHAR* pName; FX_STRSIZE nLength; name_extractor.GetNext(pName, nLength); _Node *pNode = &m_Root, *pLast = NULL; @@ -200,7 +200,7 @@ CPDF_FormField *CFieldTree::RemoveField(const CFX_WideString & full_name) return NULL; } _CFieldNameExtractor name_extractor(full_name); - FX_LPCWSTR pName; + const FX_WCHAR* pName; FX_STRSIZE nLength; name_extractor.GetNext(pName, nLength); _Node *pNode = &m_Root, *pLast = NULL; @@ -230,7 +230,7 @@ CFieldTree::_Node *CFieldTree::FindNode(const CFX_WideString& full_name) return NULL; } _CFieldNameExtractor name_extractor(full_name); - FX_LPCWSTR pName; + const FX_WCHAR* pName; FX_STRSIZE nLength; name_extractor.GetNext(pName, nLength); _Node *pNode = &m_Root, *pLast = NULL; @@ -267,7 +267,8 @@ CPDF_InterForm::~CPDF_InterForm() { FX_POSITION pos = m_ControlMap.GetStartPosition(); while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_ControlMap.GetNextAssoc(pos, key, value); delete (CPDF_FormControl*)value; } @@ -289,7 +290,7 @@ void CPDF_InterForm::EnableUpdateAP(FX_BOOL bUpdateAP) { m_bUpdateAP = bUpdateAP; } -CFX_ByteString CPDF_InterForm::GenerateNewResourceName(const CPDF_Dictionary* pResDict, FX_LPCSTR csType, int iMinLen, FX_LPCSTR csPrefix) +CFX_ByteString CPDF_InterForm::GenerateNewResourceName(const CPDF_Dictionary* pResDict, const FX_CHAR* csType, int iMinLen, const FX_CHAR* csPrefix) { CFX_ByteString csStr = csPrefix; CFX_ByteString csBType = csType; @@ -473,7 +474,7 @@ CPDF_Font* CPDF_InterForm::AddStandardFont(const CPDF_Document* pDocument, CFX_B } return pFont; } -CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, FX_LPVOID pLogFont) +CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, void* pLogFont) { CFX_ByteString csFontName; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ @@ -510,7 +511,7 @@ CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, FX_LPVOID pLogFont #endif return csFontName; } -CFX_ByteString CPDF_InterForm::GetNativeFont(FX_LPVOID pLogFont) +CFX_ByteString CPDF_InterForm::GetNativeFont(void* pLogFont) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ uint8_t charSet = GetNativeCharSet(); @@ -695,7 +696,8 @@ FX_BOOL CPDF_InterForm::ValidateFieldName(const CPDF_FormControl* pControl, CFX_ } int CPDF_InterForm::CompareFieldName(const CFX_ByteString& name1, const CFX_ByteString& name2) { - FX_LPCSTR ptr1 = name1, ptr2 = name2; + const FX_CHAR* ptr1 = name1; + const FX_CHAR* ptr2 = name2; if (name1.GetLength() != name2.GetLength()) { int i = 0; while (ptr1[i] == ptr2[i]) { @@ -714,8 +716,8 @@ int CPDF_InterForm::CompareFieldName(const CFX_ByteString& name1, const CFX_Byte } int CPDF_InterForm::CompareFieldName(const CFX_WideString& name1, const CFX_WideString& name2) { - FX_LPCWSTR ptr1 = name1.c_str(); - FX_LPCWSTR ptr2 = name2.c_str(); + const FX_WCHAR* ptr1 = name1.c_str(); + const FX_WCHAR* ptr2 = name2.c_str(); if (name1.GetLength() != name2.GetLength()) { int i = 0; while (ptr1[i] == ptr2[i]) { @@ -819,7 +821,7 @@ FX_BOOL CPDF_InterForm::IsValidFormControl(const void* pControl) while (pos) { CPDF_Dictionary* pWidgetDict = NULL; void* pFormControl = NULL; - m_ControlMap.GetNextAssoc(pos, (FX_LPVOID&)pWidgetDict, pFormControl); + m_ControlMap.GetNextAssoc(pos, (void*&)pWidgetDict, pFormControl); if (pControl == pFormControl) { return TRUE; } @@ -839,7 +841,7 @@ int CPDF_InterForm::CountPageControls(CPDF_Page* pPage) const continue; } CPDF_FormControl* pControl; - if (!m_ControlMap.Lookup(pAnnot, (FX_LPVOID&)pControl)) { + if (!m_ControlMap.Lookup(pAnnot, (void*&)pControl)) { continue; } count ++; @@ -859,7 +861,7 @@ CPDF_FormControl* CPDF_InterForm::GetPageControl(CPDF_Page* pPage, int index) co continue; } CPDF_FormControl* pControl; - if (!m_ControlMap.Lookup(pAnnot, (FX_LPVOID&)pControl)) { + if (!m_ControlMap.Lookup(pAnnot, (void*&)pControl)) { continue; } if (index == count) { @@ -881,7 +883,7 @@ CPDF_FormControl* CPDF_InterForm::GetControlAtPoint(CPDF_Page* pPage, FX_FLOAT p continue; } CPDF_FormControl* pControl; - if (!m_ControlMap.Lookup(pAnnot, (FX_LPVOID&)pControl)) { + if (!m_ControlMap.Lookup(pAnnot, (void*&)pControl)) { continue; } CFX_FloatRect rect = pControl->GetRect(); @@ -894,7 +896,7 @@ CPDF_FormControl* CPDF_InterForm::GetControlAtPoint(CPDF_Page* pPage, FX_FLOAT p CPDF_FormControl* CPDF_InterForm::GetControlByDict(CPDF_Dictionary* pWidgetDict) const { CPDF_FormControl* pControl = NULL; - m_ControlMap.Lookup(pWidgetDict, (FX_LPVOID&)pControl); + m_ControlMap.Lookup(pWidgetDict, (void*&)pControl); return pControl; } FX_DWORD CPDF_InterForm::CountInternalFields(const CFX_WideString& csFieldName) const @@ -1202,7 +1204,7 @@ void CPDF_InterForm::ReloadForm() while (pos) { CPDF_Dictionary* pWidgetDict; CPDF_FormControl* pControl; - m_ControlMap.GetNextAssoc(pos, (FX_LPVOID&)pWidgetDict, (FX_LPVOID&)pControl); + m_ControlMap.GetNextAssoc(pos, (void*&)pWidgetDict, (void*&)pControl); delete pControl; } m_ControlMap.RemoveAll(); @@ -1465,7 +1467,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF(FX_WSTR pdf_path, CFX_PtrArray& field return pDoc; } const struct _SupportFieldEncoding { - FX_LPCSTR m_name; + const FX_CHAR* m_name; int32_t m_codePage; } g_fieldEncoding[] = { { "BigFive", 950 }, diff --git a/core/src/fpdfdoc/doc_link.cpp b/core/src/fpdfdoc/doc_link.cpp index 0109e7c9b3..e614af3ec8 100644 --- a/core/src/fpdfdoc/doc_link.cpp +++ b/core/src/fpdfdoc/doc_link.cpp @@ -11,7 +11,8 @@ CPDF_LinkList::~CPDF_LinkList() { FX_POSITION pos = m_PageMap.GetStartPosition(); while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_PageMap.GetNextAssoc(pos, key, value); delete (CFX_PtrArray*)value; } @@ -23,9 +24,9 @@ CFX_PtrArray* CPDF_LinkList::GetPageLinks(CPDF_Page* pPage) return NULL; } CFX_PtrArray* pPageLinkList = NULL; - if (!m_PageMap.Lookup((FX_LPVOID)(uintptr_t)objnum, (FX_LPVOID&)pPageLinkList)) { + if (!m_PageMap.Lookup((void*)(uintptr_t)objnum, (void*&)pPageLinkList)) { pPageLinkList = new CFX_PtrArray; - m_PageMap.SetAt((FX_LPVOID)(uintptr_t)objnum, pPageLinkList); + m_PageMap.SetAt((void*)(uintptr_t)objnum, pPageLinkList); LoadPageLinks(pPage, pPageLinkList); } return pPageLinkList; diff --git a/core/src/fpdfdoc/doc_metadata.cpp b/core/src/fpdfdoc/doc_metadata.cpp index e3226bd7dd..0239e0ad55 100644 --- a/core/src/fpdfdoc/doc_metadata.cpp +++ b/core/src/fpdfdoc/doc_metadata.cpp @@ -13,7 +13,7 @@ typedef struct _PDFDOC_METADATA { CFX_CMapByteStringToPtr *m_pStringMap; } PDFDOC_METADATA, * PDFDOC_LPMETADATA; typedef PDFDOC_METADATA const * PDFDOC_LPCMETADATA; -const FX_LPCSTR gs_FPDFDOC_Metadata_Titles[] = { +const FX_CHAR* const gs_FPDFDOC_Metadata_Titles[] = { "Title", "title", "Subject", "description", "Author", "creator", @@ -60,7 +60,7 @@ void CPDF_Metadata::LoadDoc(CPDF_Document *pDoc) CPDF_StreamAcc acc; acc.LoadAllData(pStream, FALSE); int size = acc.GetSize(); - FX_LPCBYTE pBuf = acc.GetData(); + const uint8_t* pBuf = acc.GetData(); CXML_Element *&pXmlElmnt = ((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt; pXmlElmnt = CXML_Element::Parse(pBuf, size); if (!pXmlElmnt) { @@ -85,7 +85,7 @@ int32_t CPDF_Metadata::GetString(FX_BSTR bsItem, CFX_WideString &wsStr) if (!((PDFDOC_LPMETADATA)m_pData)->m_pStringMap->Lookup(bsItem, szTag)) { return -1; } - CFX_ByteString bsTag = (FX_LPCSTR)szTag; + CFX_ByteString bsTag = (const FX_CHAR*)szTag; wsStr = L""; CXML_Element *pElmntRdf = ((PDFDOC_LPMETADATA)m_pData)->m_pElmntRdf; if (!pElmntRdf) { diff --git a/core/src/fpdfdoc/doc_ocg.cpp b/core/src/fpdfdoc/doc_ocg.cpp index c2f77a58fa..318e9318ce 100644 --- a/core/src/fpdfdoc/doc_ocg.cpp +++ b/core/src/fpdfdoc/doc_ocg.cpp @@ -179,11 +179,11 @@ FX_BOOL CPDF_OCContext::GetOCGVisible(const CPDF_Dictionary *pOCGDict) if (!pOCGDict) { return FALSE; } - FX_LPVOID bState = NULL; + void* bState = NULL; if (m_OCGStates.Lookup(pOCGDict, bState)) { return (uintptr_t)bState != 0; } - bState = (FX_LPVOID)(uintptr_t)LoadOCGState(pOCGDict); + bState = (void*)(uintptr_t)LoadOCGState(pOCGDict); m_OCGStates.SetAt(pOCGDict, bState); return (uintptr_t)bState != 0; } diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp index e3cd744c61..a724565c3f 100644 --- a/core/src/fpdfdoc/doc_tagged.cpp +++ b/core/src/fpdfdoc/doc_tagged.cpp @@ -125,7 +125,7 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(CPDF_Dictionary* pDict, return NULL; } CPDF_StructElementImpl* pElement = NULL; - if (map.Lookup(pDict, (FX_LPVOID&)pElement)) { + if (map.Lookup(pDict, (void*&)pElement)) { return pElement; } pElement = new CPDF_StructElementImpl(this, NULL, pDict); diff --git a/core/src/fpdfdoc/doc_vt.cpp b/core/src/fpdfdoc/doc_vt.cpp index 52096f7090..31faf67c33 100644 --- a/core/src/fpdfdoc/doc_vt.cpp +++ b/core/src/fpdfdoc/doc_vt.cpp @@ -917,7 +917,7 @@ CPVT_WordPlace CPDF_VariableText::InsertSection(const CPVT_WordPlace & place, co } return newplace; } -CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace & place, FX_LPCWSTR text, int32_t charset, +CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace & place, const FX_WCHAR* text, int32_t charset, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pProps) { CFX_WideString swText = text; @@ -977,7 +977,7 @@ CPVT_WordPlace CPDF_VariableText::BackSpaceWord(const CPVT_WordPlace & place) { return ClearLeftWord(AjustLineHeader(place, TRUE)); } -void CPDF_VariableText::SetText(FX_LPCWSTR text, int32_t charset, const CPVT_SecProps * pSecProps, +void CPDF_VariableText::SetText(const FX_WCHAR* text, int32_t charset, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps) { DeleteWords(CPVT_WordRange(GetBeginWordPlace(), GetEndWordPlace())); diff --git a/core/src/fpdfdoc/pdf_vt.h b/core/src/fpdfdoc/pdf_vt.h index 662748fa6f..1ab8fdb918 100644 --- a/core/src/fpdfdoc/pdf_vt.h +++ b/core/src/fpdfdoc/pdf_vt.h @@ -469,13 +469,13 @@ public: void RearrangeAll(); void RearrangePart(const CPVT_WordRange & PlaceRange); void ResetAll(); - void SetText(FX_LPCWSTR text, int32_t charset = 1, const CPVT_SecProps * pSecProps = NULL, + void SetText(const FX_WCHAR* text, int32_t charset = 1, const CPVT_SecProps * pSecProps = NULL, const CPVT_WordProps * pWordProps = NULL); CPVT_WordPlace InsertWord(const CPVT_WordPlace & place, FX_WORD word, int32_t charset = 1, const CPVT_WordProps * pWordProps = NULL); CPVT_WordPlace InsertSection(const CPVT_WordPlace & place, const CPVT_SecProps * pSecProps = NULL, const CPVT_WordProps * pWordProps = NULL); - CPVT_WordPlace InsertText(const CPVT_WordPlace & place, FX_LPCWSTR text, int32_t charset = 1, + CPVT_WordPlace InsertText(const CPVT_WordPlace & place, const FX_WCHAR* text, int32_t charset = 1, const CPVT_SecProps * pSecProps = NULL, const CPVT_WordProps * pWordProps = NULL); CPVT_WordPlace DeleteWords(const CPVT_WordRange & PlaceRange); CPVT_WordPlace DeleteWord(const CPVT_WordPlace & place); diff --git a/core/src/fpdftext/fpdf_text.cpp b/core/src/fpdftext/fpdf_text.cpp index fbd6860afb..bb0ed98940 100644 --- a/core/src/fpdftext/fpdf_text.cpp +++ b/core/src/fpdftext/fpdf_text.cpp @@ -9,14 +9,14 @@ #include "../../include/fpdftext/fpdf_text.h" #include "txtproc.h" #include "text_int.h" -extern FX_LPCSTR FCS_GetAltStr(FX_WCHAR); -CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode, int destcp, FX_LPCSTR defchar) +extern const FX_CHAR* FCS_GetAltStr(FX_WCHAR); +CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode, int destcp, const FX_CHAR* defchar) { if (destcp == 0) { if (unicode < 0x80) { return CFX_ByteString((char)unicode); } - FX_LPCSTR altstr = FCS_GetAltStr(unicode); + const FX_CHAR* altstr = FCS_GetAltStr(unicode); if (altstr) { return CFX_ByteString(altstr, -1); } @@ -28,7 +28,7 @@ CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode, int destcp, FX_LPCSTR defcha if (ret && !bDef) { return CFX_ByteString(buf, ret); } - FX_LPCSTR altstr = FCS_GetAltStr(unicode); + const FX_CHAR* altstr = FCS_GetAltStr(unicode); if (altstr) { return CFX_ByteString(altstr, -1); } @@ -173,7 +173,7 @@ CTextBaseLine* CTextPage::InsertTextBox(CTextBaseLine* pBaseLine, FX_FLOAT basey } } CFX_WideString text; - FX_LPCSTR pStr = str; + const FX_CHAR* pStr = str; int len = str.GetLength(), offset = 0; while (offset < len) { FX_DWORD ch = pFont->GetNextChar(pStr, len, offset); @@ -286,7 +286,7 @@ void CTextPage::WriteOutput(CFX_WideStringArray& lines, int iMinWidth) void NormalizeCompositeChar(FX_WCHAR wChar, CFX_WideString& sDest) { wChar = FX_GetMirrorChar(wChar, TRUE, FALSE); - FX_LPWSTR pDst = NULL; + FX_WCHAR* pDst = NULL; FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst); if (nCount < 1 ) { sDest += wChar; diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp index f5fa3d4921..16421ed5b6 100644 --- a/core/src/fpdftext/fpdf_text_int.cpp +++ b/core/src/fpdftext/fpdf_text_int.cpp @@ -1160,7 +1160,7 @@ void CPDF_TextPage::AddCharInfoByLRDirection(CFX_WideString& str, int i) if(!IsControlChar(&Info)) { Info.m_Index = m_TextBuf.GetLength(); if (wChar >= 0xFB00 && wChar <= 0xFB06) { - FX_LPWSTR pDst = NULL; + FX_WCHAR* pDst = NULL; FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst); if (nCount >= 1) { pDst = FX_Alloc(FX_WCHAR, nCount); @@ -1192,7 +1192,7 @@ void CPDF_TextPage::AddCharInfoByRLDirection(CFX_WideString& str, int i) if(!IsControlChar(&Info)) { Info.m_Index = m_TextBuf.GetLength(); FX_WCHAR wChar = FX_GetMirrorChar(str.GetAt(i), TRUE, FALSE); - FX_LPWSTR pDst = NULL; + FX_WCHAR* pDst = NULL; FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst); if (nCount >= 1) { pDst = FX_Alloc(FX_WCHAR, nCount); @@ -2564,7 +2564,7 @@ FX_BOOL CPDF_TextPageFind::IsMatchWholeWord(const CFX_WideString& csPageText, in } return TRUE; } -FX_BOOL CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString, FX_LPCWSTR lpszFullString, +FX_BOOL CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString, const FX_WCHAR* lpszFullString, int iSubString, FX_WCHAR chSep) { if (lpszFullString == NULL) { @@ -2581,7 +2581,7 @@ FX_BOOL CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString, FX_LPCWSTR lpszFullString++; } } - FX_LPCWSTR lpchEnd = FXSYS_wcschr(lpszFullString, chSep); + const FX_WCHAR* lpchEnd = FXSYS_wcschr(lpszFullString, chSep); int nLen = (lpchEnd == NULL) ? (int)FXSYS_wcslen(lpszFullString) : (int)(lpchEnd - lpszFullString); ASSERT(nLen >= 0); diff --git a/core/src/fpdftext/text_int.h b/core/src/fpdftext/text_int.h index 70c53d909f..87d527d942 100644 --- a/core/src/fpdftext/text_int.h +++ b/core/src/fpdftext/text_int.h @@ -157,7 +157,7 @@ public: protected: void ExtractFindWhat(const CFX_WideString& findwhat); FX_BOOL IsMatchWholeWord(const CFX_WideString& csPageText, int startPos, int endPos); - FX_BOOL ExtractSubString(CFX_WideString& rString, FX_LPCWSTR lpszFullString, + FX_BOOL ExtractSubString(CFX_WideString& rString, const FX_WCHAR* lpszFullString, int iSubString, FX_WCHAR chSep); CFX_WideString MakeReverse(const CFX_WideString& str); int ReverseFind(const CFX_WideString& csPageText, const CFX_WideString& csWord, int nStartPos, int& WordLength); @@ -215,7 +215,7 @@ private: CFX_WideString m_strPageText; FX_BOOL m_IsParserd; }; -FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_LPWSTR pDst); +FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst); void NormalizeString(CFX_WideString& str); void NormalizeCompositeChar(FX_WCHAR wChar, CFX_WideString& sDest); diff --git a/core/src/fpdftext/unicodenormalization.cpp b/core/src/fpdftext/unicodenormalization.cpp index ad2f3f6aea..7b01830582 100644 --- a/core/src/fpdftext/unicodenormalization.cpp +++ b/core/src/fpdftext/unicodenormalization.cpp @@ -10,14 +10,14 @@ extern const FX_WCHAR g_UnicodeData_Normalization_Map1[]; extern const FX_WCHAR g_UnicodeData_Normalization_Map2[]; extern const FX_WCHAR g_UnicodeData_Normalization_Map3[]; extern const FX_WCHAR g_UnicodeData_Normalization_Map4[]; -FX_LPCWSTR g_UnicodeData_Normalization_Maps[5] = { +const FX_WCHAR* g_UnicodeData_Normalization_Maps[5] = { NULL, g_UnicodeData_Normalization_Map1, g_UnicodeData_Normalization_Map2, g_UnicodeData_Normalization_Map3, g_UnicodeData_Normalization_Map4 }; -FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_LPWSTR pDst) +FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst) { wch = wch & 0xFFFF; FX_WCHAR wFind = g_UnicodeData_Normalization[wch]; @@ -34,7 +34,7 @@ FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_LPWSTR pDst) wch = wFind & 0x0FFF; wFind >>= 12; } - FX_LPCWSTR pMap = g_UnicodeData_Normalization_Maps[wFind]; + const FX_WCHAR* pMap = g_UnicodeData_Normalization_Maps[wFind]; if (pMap == g_UnicodeData_Normalization_Map4) { pMap = g_UnicodeData_Normalization_Map4 + wch; wFind = (FX_WCHAR)(*pMap ++); @@ -49,7 +49,7 @@ FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_LPWSTR pDst) } return (FX_STRSIZE)wFind; } -FX_STRSIZE FX_WideString_GetNormalization(FX_WSTR wsSrc, FX_LPWSTR pDst) +FX_STRSIZE FX_WideString_GetNormalization(FX_WSTR wsSrc, FX_WCHAR* pDst) { FX_STRSIZE nCount = 0; for (FX_STRSIZE len = 0; len < wsSrc.GetLength(); len ++) { @@ -64,11 +64,11 @@ FX_STRSIZE FX_WideString_GetNormalization(FX_WSTR wsSrc, FX_LPWSTR pDst) } FX_STRSIZE FX_WideString_GetNormalization(FX_WSTR wsSrc, CFX_WideString &wsDst) { - FX_STRSIZE nLen = FX_WideString_GetNormalization(wsSrc, (FX_LPWSTR)NULL); + FX_STRSIZE nLen = FX_WideString_GetNormalization(wsSrc, (FX_WCHAR*)NULL); if (!nLen) { return 0; } - FX_LPWSTR pBuf = wsDst.GetBuffer(nLen); + FX_WCHAR* pBuf = wsDst.GetBuffer(nLen); FX_WideString_GetNormalization(wsSrc, pBuf); wsDst.ReleaseBuffer(nLen); return nLen; diff --git a/core/src/fxcodec/codec/codec_int.h b/core/src/fxcodec/codec/codec_int.h index d39a1fd18a..eb356aa531 100644 --- a/core/src/fxcodec/codec/codec_int.h +++ b/core/src/fxcodec/codec/codec_int.h @@ -17,11 +17,11 @@ class CCodec_BasicModule : public ICodec_BasicModule { public: - virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, + virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); - virtual FX_BOOL A85Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, + virtual FX_BOOL A85Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); - virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, + virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc); }; struct CCodec_ImageDataCache { @@ -44,7 +44,7 @@ public: virtual void DownScale(int dest_width, int dest_height); - FX_LPBYTE GetScanline(int line); + uint8_t* GetScanline(int line); FX_BOOL SkipToScanline(int line, IFX_Pause* pPause); @@ -100,39 +100,39 @@ protected: FX_BOOL m_bColorTransformed; - FX_LPBYTE ReadNextLine(); + uint8_t* ReadNextLine(); virtual FX_BOOL v_Rewind() = 0; - virtual FX_LPBYTE v_GetNextLine() = 0; + virtual uint8_t* v_GetNextLine() = 0; virtual void v_DownScale(int dest_width, int dest_height) = 0; int m_NextLine; - FX_LPBYTE m_pLastScanline; + uint8_t* m_pLastScanline; CCodec_ImageDataCache* m_pDataCache; }; class CCodec_FaxModule : public ICodec_FaxModule { public: - virtual ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, + virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows); - FX_BOOL Encode(FX_LPCBYTE src_buf, int width, int height, int pitch, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); + FX_BOOL Encode(const uint8_t* src_buf, int width, int height, int pitch, uint8_t*& dest_buf, FX_DWORD& dest_size); }; class CCodec_FlateModule : public ICodec_FlateModule { public: - virtual ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, + virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, int predictor, int Colors, int BitsPerComponent, int Columns); virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, int predictor, int Colors, int BitsPerComponent, int Columns, - FX_DWORD estimated_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); + FX_DWORD estimated_size, uint8_t*& dest_buf, FX_DWORD& dest_size); virtual FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns, - FX_LPBYTE& dest_buf, FX_DWORD& dest_size); - virtual FX_BOOL Encode(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); + uint8_t*& dest_buf, FX_DWORD& dest_size); + virtual FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); }; class CCodec_JpegModule : public ICodec_JpegModule { @@ -142,28 +142,28 @@ public: { m_pExtProvider = pJP; } - ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, + ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, FX_BOOL ColorTransform); - FX_BOOL LoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int& width, int& height, + FX_BOOL LoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height, int& num_components, int& bits_per_components, FX_BOOL& color_transform, - FX_LPBYTE* icc_buf_ptr, FX_DWORD* icc_length); - FX_BOOL Encode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_STRSIZE& dest_size, int quality, FX_LPCBYTE icc_buf, FX_DWORD icc_length); + uint8_t** icc_buf_ptr, FX_DWORD* icc_length); + FX_BOOL Encode(const CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, FX_DWORD icc_length); virtual void* Start(); virtual void Finish(void* pContext); - virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size); + virtual void Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size); virtual int ReadHeader(void* pContext, int* width, int* height, int* nComps); virtual FX_BOOL StartScanline(void* pContext, int down_scale); - virtual FX_BOOL ReadScanline(void* pContext, FX_LPBYTE dest_buf); - virtual FX_DWORD GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr); + virtual FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf); + virtual FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr); protected: IFX_JpegProvider* m_pExtProvider; }; class CCodec_IccModule : public ICodec_IccModule { public: - virtual IccCS GetProfileCS(FX_LPCBYTE pProfileData, unsigned int dwProfileSize); + virtual IccCS GetProfileCS(const uint8_t* pProfileData, unsigned int dwProfileSize); virtual IccCS GetProfileCS(IFX_FileRead* pFile); - virtual FX_LPVOID CreateTransform(ICodec_IccModule::IccParam* pInputParam, + virtual void* CreateTransform(ICodec_IccModule::IccParam* pInputParam, ICodec_IccModule::IccParam* pOutputParam, ICodec_IccModule::IccParam* pProofParam = NULL, FX_DWORD dwIntent = Icc_INTENT_PERCEPTUAL, @@ -171,16 +171,16 @@ public: FX_DWORD dwPrfIntent = Icc_INTENT_ABSOLUTE_COLORIMETRIC, FX_DWORD dwPrfFlag = Icc_FLAGS_SOFTPROOFING ); - virtual FX_LPVOID CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent = 0, + virtual void* CreateTransform_sRGB(const uint8_t* pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent = 0, FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT); - virtual FX_LPVOID CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, - FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent = 0, + virtual void* CreateTransform_CMYK(const uint8_t* pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, + const uint8_t* pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent = 0, FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT ); - virtual void DestroyTransform(FX_LPVOID pTransform); - virtual void Translate(FX_LPVOID pTransform, FX_FLOAT* pSrcValues, FX_FLOAT* pDestValues); - virtual void TranslateScanline(FX_LPVOID pTransform, FX_LPBYTE pDest, FX_LPCBYTE pSrc, int pixels); + virtual void DestroyTransform(void* pTransform); + virtual void Translate(void* pTransform, FX_FLOAT* pSrcValues, FX_FLOAT* pDestValues); + virtual void TranslateScanline(void* pTransform, uint8_t* pDest, const uint8_t* pSrc, int pixels); virtual void SetComponents(FX_DWORD nComponents) {m_nComponents = nComponents;} virtual ~CCodec_IccModule(); protected: @@ -193,16 +193,16 @@ protected: Icc_CLASS_PROOF, Icc_CLASS_MAX } Icc_CLASS; - FX_LPVOID CreateProfile(ICodec_IccModule::IccParam* pIccParam, Icc_CLASS ic, CFX_BinaryBuf* pTransformKey); + void* CreateProfile(ICodec_IccModule::IccParam* pIccParam, Icc_CLASS ic, CFX_BinaryBuf* pTransformKey); }; class CCodec_JpxModule : public ICodec_JpxModule { public: CCodec_JpxModule(); - void* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_BOOL useColorSpace = FALSE); - void GetImageInfo(FX_LPVOID ctx, FX_DWORD& width, FX_DWORD& height, + void* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL useColorSpace = FALSE); + void GetImageInfo(void* ctx, FX_DWORD& width, FX_DWORD& height, FX_DWORD& codestream_nComps, FX_DWORD& output_nComps); - FX_BOOL Decode(void* ctx, FX_LPBYTE dest_data, int pitch, FX_BOOL bTranslateColor, FX_LPBYTE offsets); + FX_BOOL Decode(void* ctx, uint8_t* dest_data, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets); void DestroyDecoder(void* ctx); }; class CPDF_Jbig2Interface : public CJBig2_Module @@ -230,11 +230,11 @@ public: } return FX_Alloc(uint8_t, num * size); } - virtual void *JBig2_Realloc(FX_LPVOID pMem, FX_DWORD dwSize) + virtual void *JBig2_Realloc(void* pMem, FX_DWORD dwSize) { return FX_Realloc(uint8_t, pMem, dwSize); } - virtual void JBig2_Free(FX_LPVOID pMem) + virtual void JBig2_Free(void* pMem) { FX_Free(pMem); } @@ -247,11 +247,11 @@ public: IFX_FileRead* m_file_ptr; FX_DWORD m_width; FX_DWORD m_height; - FX_LPBYTE m_src_buf; + uint8_t* m_src_buf; FX_DWORD m_src_size; - FX_LPCBYTE m_global_data; + const uint8_t* m_global_data; FX_DWORD m_global_size; - FX_LPBYTE m_dest_buf; + uint8_t* m_dest_buf; FX_DWORD m_dest_pitch; FX_BOOL m_bFileReader; IFX_Pause* m_pPause; @@ -263,16 +263,16 @@ class CCodec_Jbig2Module : public ICodec_Jbig2Module public: CCodec_Jbig2Module() {}; ~CCodec_Jbig2Module(); - FX_BOOL Decode(FX_DWORD width, FX_DWORD height, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPCBYTE global_data, FX_DWORD global_size, FX_LPBYTE dest_buf, FX_DWORD dest_pitch); + FX_BOOL Decode(FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, + const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch); FX_BOOL Decode(IFX_FileRead* file_ptr, - FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, FX_LPBYTE& dest_buf); + FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf); void* CreateJbig2Context(); - FXCODEC_STATUS StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPCBYTE global_data, FX_DWORD global_size, FX_LPBYTE dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause); + FXCODEC_STATUS StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, + const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause); FXCODEC_STATUS StartDecode(void* pJbig2Context, IFX_FileRead* file_ptr, - FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, FX_LPBYTE& dest_buf, IFX_Pause* pPause); + FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf, IFX_Pause* pPause); FXCODEC_STATUS ContinueDecode(void* pJbig2Context, IFX_Pause* pPause); void DestroyJbig2Context(void* pJbig2Context); CPDF_Jbig2Interface m_Module; diff --git a/core/src/fxcodec/codec/fx_codec.cpp b/core/src/fxcodec/codec/fx_codec.cpp index ee3ef8ce9d..1068126d5d 100644 --- a/core/src/fxcodec/codec/fx_codec.cpp +++ b/core/src/fxcodec/codec/fx_codec.cpp @@ -47,7 +47,7 @@ CCodec_ScanlineDecoder::~CCodec_ScanlineDecoder() FX_Free(m_pDataCache); } } -FX_LPBYTE CCodec_ScanlineDecoder::GetScanline(int line) +uint8_t* CCodec_ScanlineDecoder::GetScanline(int line) { if (m_pDataCache && line < m_pDataCache->m_nCachedLines) { return &m_pDataCache->m_Data + line * m_Pitch; @@ -91,9 +91,9 @@ FX_BOOL CCodec_ScanlineDecoder::SkipToScanline(int line, IFX_Pause* pPause) } return FALSE; } -FX_LPBYTE CCodec_ScanlineDecoder::ReadNextLine() +uint8_t* CCodec_ScanlineDecoder::ReadNextLine() { - FX_LPBYTE pLine = v_GetNextLine(); + uint8_t* pLine = v_GetNextLine(); if (pLine == NULL) { return NULL; } @@ -127,7 +127,7 @@ void CCodec_ScanlineDecoder::DownScale(int dest_width, int dest_height) m_pDataCache->m_Width = m_OutputWidth; m_pDataCache->m_nCachedLines = 0; } -FX_BOOL CCodec_BasicModule::RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, +FX_BOOL CCodec_BasicModule::RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { return FALSE; @@ -236,7 +236,7 @@ extern "C" double FXstrtod(const char* nptr, char** endptr) } return is_negative ? -ret : ret; } -FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, +FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { return FALSE; @@ -254,10 +254,10 @@ class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder public: CCodec_RLScanlineDecoder(); virtual ~CCodec_RLScanlineDecoder(); - FX_BOOL Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc); + FX_BOOL Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc); virtual void v_DownScale(int dest_width, int dest_height) {} virtual FX_BOOL v_Rewind(); - virtual FX_LPBYTE v_GetNextLine(); + virtual uint8_t* v_GetNextLine(); virtual FX_DWORD GetSrcOffset() { return m_SrcOffset; @@ -267,8 +267,8 @@ protected: void GetNextOperator(); void UpdateOperator(uint8_t used_bytes); - FX_LPBYTE m_pScanline; - FX_LPCBYTE m_pSrcBuf; + uint8_t* m_pScanline; + const uint8_t* m_pSrcBuf; FX_DWORD m_SrcSize; FX_DWORD m_dwLineBytes; FX_DWORD m_SrcOffset; @@ -320,7 +320,7 @@ FX_BOOL CCodec_RLScanlineDecoder::CheckDestSize() } return TRUE; } -FX_BOOL CCodec_RLScanlineDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc) +FX_BOOL CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc) { m_pSrcBuf = src_buf; m_SrcSize = src_size; @@ -343,7 +343,7 @@ FX_BOOL CCodec_RLScanlineDecoder::v_Rewind() m_Operator = 0; return TRUE; } -FX_LPBYTE CCodec_RLScanlineDecoder::v_GetNextLine() +uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() { if (m_SrcOffset == 0) { GetNextOperator(); @@ -427,7 +427,7 @@ void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) count -= used_bytes; m_Operator = 257 - count; } -ICodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc) { CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder; diff --git a/core/src/fxcodec/codec/fx_codec_fax.cpp b/core/src/fxcodec/codec/fx_codec_fax.cpp index 869751e05b..40502362d5 100644 --- a/core/src/fxcodec/codec/fx_codec_fax.cpp +++ b/core/src/fxcodec/codec/fx_codec_fax.cpp @@ -48,7 +48,7 @@ int _FindBit(const uint8_t* data_buf, int max_pos, int start_pos, int bit) if (start_pos >= max_pos) { return max_pos; } - FX_LPCBYTE leading_pos = bit ? OneLeadPos : ZeroLeadPos; + const uint8_t* leading_pos = bit ? OneLeadPos : ZeroLeadPos; if (start_pos % 8) { uint8_t data = data_buf[start_pos / 8]; if (bit) { @@ -100,7 +100,7 @@ void _FaxG4FindB1B2(const uint8_t* ref_buf, int columns, int a0, FX_BOOL a0color } b2 = _FindBit(ref_buf, columns, b1 + 1, first_bit); } -void _FaxFillBits(FX_LPBYTE dest_buf, int columns, int startpos, int endpos) +void _FaxFillBits(uint8_t* dest_buf, int columns, int startpos, int endpos) { if (startpos < 0) { startpos = 0; @@ -375,7 +375,7 @@ static const uint8_t FaxWhiteRunIns[] = { 0x1f, 2560 % 256, 2560 / 256, 0xff, }; -int _FaxGetRun(FX_LPCBYTE ins_array, const uint8_t* src_buf, int& bitpos, int bitsize) +int _FaxGetRun(const uint8_t* ins_array, const uint8_t* src_buf, int& bitpos, int bitsize) { FX_DWORD code = 0; int ins_off = 0; @@ -400,7 +400,7 @@ int _FaxGetRun(FX_LPCBYTE ins_array, const uint8_t* src_buf, int& bitpos, int bi } } } -FX_BOOL _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, const uint8_t* ref_buf, int columns) +FX_BOOL _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, const uint8_t* ref_buf, int columns) { int a0 = -1, a0color = 1; while (1) { @@ -536,7 +536,7 @@ FX_BOOL _FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos) } return FALSE; } -FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns) +FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, int columns) { int color = TRUE; int startpos = 0; @@ -577,17 +577,18 @@ class CCodec_FaxDecoder : public CCodec_ScanlineDecoder public: CCodec_FaxDecoder(); virtual ~CCodec_FaxDecoder(); - FX_BOOL Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, + FX_BOOL Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows); virtual void v_DownScale(int dest_width, int dest_height) {} virtual FX_BOOL v_Rewind(); - virtual FX_LPBYTE v_GetNextLine(); + virtual uint8_t* v_GetNextLine(); virtual FX_DWORD GetSrcOffset(); int m_Encoding, m_bEndOfLine, m_bByteAlign, m_bBlack; int bitpos; - FX_LPCBYTE m_pSrcBuf; + const uint8_t* m_pSrcBuf; FX_DWORD m_SrcSize; - FX_LPBYTE m_pScanlineBuf, m_pRefBuf; + uint8_t* m_pScanlineBuf; + uint8_t* m_pRefBuf; }; CCodec_FaxDecoder::CCodec_FaxDecoder() { @@ -603,7 +604,7 @@ CCodec_FaxDecoder::~CCodec_FaxDecoder() FX_Free(m_pRefBuf); } } -FX_BOOL CCodec_FaxDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +FX_BOOL CCodec_FaxDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows) { m_Encoding = K; @@ -636,7 +637,7 @@ FX_BOOL CCodec_FaxDecoder::v_Rewind() bitpos = 0; return TRUE; } -FX_LPBYTE CCodec_FaxDecoder::v_GetNextLine() +uint8_t* CCodec_FaxDecoder::v_GetNextLine() { int bitsize = m_SrcSize * 8; _FaxSkipEOL(m_pSrcBuf, bitsize, bitpos); @@ -693,16 +694,16 @@ FX_DWORD CCodec_FaxDecoder::GetSrcOffset() return ret; } extern "C" { - void _FaxG4Decode(void*, FX_LPCBYTE src_buf, FX_DWORD src_size, int* pbitpos, FX_LPBYTE dest_buf, int width, int height, int pitch) + void _FaxG4Decode(void*, const uint8_t* src_buf, FX_DWORD src_size, int* pbitpos, uint8_t* dest_buf, int width, int height, int pitch) { if (pitch == 0) { pitch = (width + 7) / 8; } - FX_LPBYTE ref_buf = FX_Alloc(uint8_t, pitch); + uint8_t* ref_buf = FX_Alloc(uint8_t, pitch); FXSYS_memset8(ref_buf, 0xff, pitch); int bitpos = *pbitpos; for (int iRow = 0; iRow < height; iRow ++) { - FX_LPBYTE line_buf = dest_buf + iRow * pitch; + uint8_t* line_buf = dest_buf + iRow * pitch; FXSYS_memset8(line_buf, 0xff, pitch); _FaxG4GetRow(src_buf, src_size << 3, bitpos, line_buf, ref_buf, width); FXSYS_memcpy32(ref_buf, line_buf, pitch); @@ -836,7 +837,7 @@ static const uint8_t WhiteRunMarkup[80] = { 0x1e, 12, 0x1f, 12, }; -static void _AddBitStream(FX_LPBYTE dest_buf, int& dest_bitpos, int data, int bitlen) +static void _AddBitStream(uint8_t* dest_buf, int& dest_bitpos, int data, int bitlen) { for (int i = bitlen - 1; i >= 0; i --) { if (data & (1 << i)) { @@ -845,7 +846,7 @@ static void _AddBitStream(FX_LPBYTE dest_buf, int& dest_bitpos, int data, int bi dest_bitpos ++; } } -static void _FaxEncodeRun(FX_LPBYTE dest_buf, int& dest_bitpos, int run, FX_BOOL bWhite) +static void _FaxEncodeRun(uint8_t* dest_buf, int& dest_bitpos, int run, FX_BOOL bWhite) { while (run >= 2560) { _AddBitStream(dest_buf, dest_bitpos, 0x1f, 12); @@ -853,16 +854,16 @@ static void _FaxEncodeRun(FX_LPBYTE dest_buf, int& dest_bitpos, int run, FX_BOOL } if (run >= 64) { int markup = run - run % 64; - FX_LPCBYTE p = bWhite ? WhiteRunMarkup : BlackRunMarkup; + const uint8_t* p = bWhite ? WhiteRunMarkup : BlackRunMarkup; p += (markup / 64 - 1) * 2; _AddBitStream(dest_buf, dest_bitpos, *p, p[1]); } run %= 64; - FX_LPCBYTE p = bWhite ? WhiteRunTerminator : BlackRunTerminator; + const uint8_t* p = bWhite ? WhiteRunTerminator : BlackRunTerminator; p += run * 2; _AddBitStream(dest_buf, dest_bitpos, *p, p[1]); } -static void _FaxEncode2DLine(FX_LPBYTE dest_buf, int& dest_bitpos, FX_LPCBYTE src_buf, FX_LPCBYTE ref_buf, int cols) +static void _FaxEncode2DLine(uint8_t* dest_buf, int& dest_bitpos, const uint8_t* src_buf, const uint8_t* ref_buf, int cols) { int a0 = -1, a0color = 1; while (1) { @@ -920,16 +921,17 @@ static void _FaxEncode2DLine(FX_LPBYTE dest_buf, int& dest_bitpos, FX_LPCBYTE sr class CCodec_FaxEncoder { public: - CCodec_FaxEncoder(FX_LPCBYTE src_buf, int width, int height, int pitch); + CCodec_FaxEncoder(const uint8_t* src_buf, int width, int height, int pitch); ~CCodec_FaxEncoder(); - void Encode(FX_LPBYTE& dest_buf, FX_DWORD& dest_size); - void Encode2DLine(FX_LPCBYTE scan_line); + void Encode(uint8_t*& dest_buf, FX_DWORD& dest_size); + void Encode2DLine(const uint8_t* scan_line); CFX_BinaryBuf m_DestBuf; - FX_LPBYTE m_pRefLine, m_pLineBuf; + uint8_t* m_pRefLine; + uint8_t* m_pLineBuf; int m_Cols, m_Rows, m_Pitch; - FX_LPCBYTE m_pSrcBuf; + const uint8_t* m_pSrcBuf; }; -CCodec_FaxEncoder::CCodec_FaxEncoder(FX_LPCBYTE src_buf, int width, int height, int pitch) +CCodec_FaxEncoder::CCodec_FaxEncoder(const uint8_t* src_buf, int width, int height, int pitch) { m_pSrcBuf = src_buf; m_Cols = width; @@ -949,12 +951,12 @@ CCodec_FaxEncoder::~CCodec_FaxEncoder() FX_Free(m_pLineBuf); } } -void CCodec_FaxEncoder::Encode(FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +void CCodec_FaxEncoder::Encode(uint8_t*& dest_buf, FX_DWORD& dest_size) { int dest_bitpos = 0; uint8_t last_byte = 0; for (int i = 0; i < m_Rows; i ++) { - FX_LPCBYTE scan_line = m_pSrcBuf + i * m_Pitch; + const uint8_t* scan_line = m_pSrcBuf + i * m_Pitch; FXSYS_memset32(m_pLineBuf, 0, m_Pitch * 8); m_pLineBuf[0] = last_byte; _FaxEncode2DLine(m_pLineBuf, dest_bitpos, scan_line, m_pRefLine, m_Cols); @@ -970,13 +972,13 @@ void CCodec_FaxEncoder::Encode(FX_LPBYTE& dest_buf, FX_DWORD& dest_size) dest_size = m_DestBuf.GetSize(); m_DestBuf.DetachBuffer(); } -FX_BOOL CCodec_FaxModule::Encode(FX_LPCBYTE src_buf, int width, int height, int pitch, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +FX_BOOL CCodec_FaxModule::Encode(const uint8_t* src_buf, int width, int height, int pitch, uint8_t*& dest_buf, FX_DWORD& dest_size) { CCodec_FaxEncoder encoder(src_buf, width, height, pitch); encoder.Encode(dest_buf, dest_size); return TRUE; } -ICodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows) { CCodec_FaxDecoder* pDecoder = new CCodec_FaxDecoder; diff --git a/core/src/fxcodec/codec/fx_codec_flate.cpp b/core/src/fxcodec/codec/fx_codec_flate.cpp index 9997a570d6..2e6cf4e8db 100644 --- a/core/src/fxcodec/codec/fx_codec_flate.cpp +++ b/core/src/fxcodec/codec/fx_codec_flate.cpp @@ -79,11 +79,11 @@ extern "C" class CLZWDecoder { public: - FX_BOOL Decode(FX_LPBYTE output, FX_DWORD& outlen, const uint8_t* input, FX_DWORD& size, FX_BOOL bEarlyChange); + FX_BOOL Decode(uint8_t* output, FX_DWORD& outlen, const uint8_t* input, FX_DWORD& size, FX_BOOL bEarlyChange); private: FX_DWORD m_InPos; FX_DWORD m_OutPos; - FX_LPBYTE m_pOutput; + uint8_t* m_pOutput; const uint8_t* m_pInput; FX_BOOL m_Early; void AddCode(FX_DWORD prefix_code, uint8_t append_char); @@ -127,7 +127,7 @@ void CLZWDecoder::DecodeString(FX_DWORD code) } m_DecodeStack[m_StackLen++] = (uint8_t)code; } -int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const uint8_t* src_buf, FX_DWORD& src_size, FX_BOOL bEarlyChange) +int CLZWDecoder::Decode(uint8_t* dest_buf, FX_DWORD& dest_size, const uint8_t* src_buf, FX_DWORD& src_size, FX_BOOL bEarlyChange) { m_CodeLen = 9; m_InPos = 0; @@ -231,7 +231,7 @@ static uint8_t PaethPredictor(int a, int b, int c) } return (uint8_t)c; } -static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, +static FX_BOOL PNG_PredictorEncode(uint8_t*& data_buf, FX_DWORD& data_size, int predictor, int Colors, int BitsPerComponent, int Columns) { @@ -241,10 +241,10 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, return FALSE; const int row_count = (data_size + row_size - 1) / row_size; const int last_row_size = data_size % row_size; - FX_LPBYTE dest_buf = FX_Alloc2D(uint8_t, row_size + 1, row_count); + uint8_t* dest_buf = FX_Alloc2D(uint8_t, row_size + 1, row_count); int byte_cnt = 0; - FX_LPBYTE pSrcData = data_buf; - FX_LPBYTE pDestData = dest_buf; + uint8_t* pSrcData = data_buf; + uint8_t* pDestData = dest_buf; for (int row = 0; row < row_count; row++) { if (predictor == 10) { pDestData[0] = 0; @@ -323,7 +323,7 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, data_size = (row_size + 1) * row_count - (last_row_size > 0 ? (row_size - last_row_size) : 0); return TRUE; } -static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE pLastLine, +static void PNG_PredictLine(uint8_t* pDestData, const uint8_t* pSrcData, const uint8_t* pLastLine, int bpc, int nColors, int nPixels) { int row_size = (nPixels * bpc * nColors + 7) / 8; @@ -386,7 +386,7 @@ static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE } } } -static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, +static FX_BOOL PNG_Predictor(uint8_t*& data_buf, FX_DWORD& data_size, int Colors, int BitsPerComponent, int Columns) { const int BytesPerPixel = (Colors * BitsPerComponent + 7) / 8; @@ -395,10 +395,10 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, return FALSE; const int row_count = (data_size + row_size) / (row_size + 1); const int last_row_size = data_size % (row_size + 1); - FX_LPBYTE dest_buf = FX_Alloc2D(uint8_t, row_size, row_count); + uint8_t* dest_buf = FX_Alloc2D(uint8_t, row_size, row_count); int byte_cnt = 0; - FX_LPBYTE pSrcData = data_buf; - FX_LPBYTE pDestData = dest_buf; + uint8_t* pSrcData = data_buf; + uint8_t* pDestData = dest_buf; for (int row = 0; row < row_count; row ++) { uint8_t tag = pSrcData[0]; byte_cnt++; @@ -474,7 +474,7 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, data_size = row_size * row_count - (last_row_size > 0 ? (row_size + 1 - last_row_size) : 0); return TRUE; } -static void TIFF_PredictorEncodeLine(FX_LPBYTE dest_buf, int row_size, int BitsPerComponent, int Colors, int Columns) +static void TIFF_PredictorEncodeLine(uint8_t* dest_buf, int row_size, int BitsPerComponent, int Colors, int Columns) { int BytesPerPixel = BitsPerComponent * Colors / 8; if (BitsPerComponent < 8) { @@ -511,7 +511,7 @@ static void TIFF_PredictorEncodeLine(FX_LPBYTE dest_buf, int row_size, int BitsP } } } -static FX_BOOL TIFF_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, +static FX_BOOL TIFF_PredictorEncode(uint8_t*& data_buf, FX_DWORD& data_size, int Colors, int BitsPerComponent, int Columns) { int row_size = (Colors * BitsPerComponent * Columns + 7) / 8; @@ -520,7 +520,7 @@ static FX_BOOL TIFF_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, const int row_count = (data_size + row_size - 1) / row_size; const int last_row_size = data_size % row_size; for (int row = 0; row < row_count; row++) { - FX_LPBYTE scan_line = data_buf + row * row_size; + uint8_t* scan_line = data_buf + row * row_size; if ((row + 1) * row_size > (int)data_size) { row_size = last_row_size; } @@ -528,7 +528,7 @@ static FX_BOOL TIFF_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, } return TRUE; } -static void TIFF_PredictLine(FX_LPBYTE dest_buf, int row_size, int BitsPerComponent, int Colors, int Columns) +static void TIFF_PredictLine(uint8_t* dest_buf, int row_size, int BitsPerComponent, int Colors, int Columns) { if (BitsPerComponent == 1) { int row_bits = FX_MIN(BitsPerComponent * Colors * Columns, row_size * 8); @@ -561,7 +561,7 @@ static void TIFF_PredictLine(FX_LPBYTE dest_buf, int row_size, int BitsPerCompon } } } -static FX_BOOL TIFF_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, +static FX_BOOL TIFF_Predictor(uint8_t*& data_buf, FX_DWORD& data_size, int Colors, int BitsPerComponent, int Columns) { int row_size = (Colors * BitsPerComponent * Columns + 7) / 8; @@ -570,7 +570,7 @@ static FX_BOOL TIFF_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, const int row_count = (data_size + row_size - 1) / row_size; const int last_row_size = data_size % row_size; for (int row = 0; row < row_count; row ++) { - FX_LPBYTE scan_line = data_buf + row * row_size; + uint8_t* scan_line = data_buf + row * row_size; if ((row + 1) * row_size > (int)data_size) { row_size = last_row_size; } @@ -583,7 +583,7 @@ class CCodec_FlateScanlineDecoder : public CCodec_ScanlineDecoder public: CCodec_FlateScanlineDecoder(); ~CCodec_FlateScanlineDecoder(); - void Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, + void Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, int predictor, int Colors, int BitsPerComponent, int Columns); virtual void Destroy() { @@ -591,15 +591,15 @@ public: } virtual void v_DownScale(int dest_width, int dest_height) {} virtual FX_BOOL v_Rewind(); - virtual FX_LPBYTE v_GetNextLine(); + virtual uint8_t* v_GetNextLine(); virtual FX_DWORD GetSrcOffset(); void* m_pFlate; - FX_LPCBYTE m_SrcBuf; + const uint8_t* m_SrcBuf; FX_DWORD m_SrcSize; - FX_LPBYTE m_pScanline; - FX_LPBYTE m_pLastLine; - FX_LPBYTE m_pPredictBuffer; - FX_LPBYTE m_pPredictRaw; + uint8_t* m_pScanline; + uint8_t* m_pLastLine; + uint8_t* m_pPredictBuffer; + uint8_t* m_pPredictRaw; int m_Predictor; int m_Colors, m_BitsPerComponent, m_Columns, m_PredictPitch, m_LeftOver; }; @@ -630,7 +630,7 @@ CCodec_FlateScanlineDecoder::~CCodec_FlateScanlineDecoder() FPDFAPI_FlateEnd(m_pFlate); } } -void CCodec_FlateScanlineDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, int predictor, int Colors, int BitsPerComponent, int Columns) { m_SrcBuf = src_buf; @@ -678,7 +678,7 @@ FX_BOOL CCodec_FlateScanlineDecoder::v_Rewind() m_LeftOver = 0; return TRUE; } -FX_LPBYTE CCodec_FlateScanlineDecoder::v_GetNextLine() +uint8_t* CCodec_FlateScanlineDecoder::v_GetNextLine() { if (m_Predictor) { if (m_Pitch == m_PredictPitch) { @@ -722,8 +722,8 @@ FX_DWORD CCodec_FlateScanlineDecoder::GetSrcOffset() { return FPDFAPI_FlateGetTotalIn(m_pFlate); } -static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig_size, - FX_LPBYTE& dest_buf, FX_DWORD& dest_size, FX_DWORD& offset) +static void FlateUncompress(const uint8_t* src_buf, FX_DWORD src_size, FX_DWORD orig_size, + uint8_t*& dest_buf, FX_DWORD& dest_size, FX_DWORD& offset) { const FX_BOOL useOldImpl = src_size < 10240; FX_DWORD guess_size = orig_size ? orig_size : src_size * 2; @@ -737,8 +737,8 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig FX_DWORD last_buf_size = buf_size; void* context = nullptr; - FX_LPBYTE guess_buf = FX_Alloc(uint8_t, guess_size + 1); - FX_LPBYTE cur_buf = guess_buf; + uint8_t* guess_buf = FX_Alloc(uint8_t, guess_size + 1); + uint8_t* cur_buf = guess_buf; guess_buf[guess_size] = '\0'; context = FPDFAPI_FlateInit(my_alloc_func, my_free_func); if (!context) @@ -776,7 +776,7 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig } dest_buf = guess_buf; } else { - CFX_ArrayTemplate<FX_LPBYTE> result_tmp_bufs; + CFX_ArrayTemplate<uint8_t*> result_tmp_bufs; while (1) { int32_t ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size); int32_t avail_buf_size = FPDFAPI_FlateGetAvailOut(context); @@ -801,10 +801,10 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig if (result_tmp_bufs.GetSize() == 1) { dest_buf = result_tmp_bufs[0]; } else { - FX_LPBYTE result_buf = FX_Alloc(uint8_t, dest_size); + uint8_t* result_buf = FX_Alloc(uint8_t, dest_size); FX_DWORD result_pos = 0; for (int32_t i = 0; i < result_tmp_bufs.GetSize(); i++) { - FX_LPBYTE tmp_buf = result_tmp_bufs[i]; + uint8_t* tmp_buf = result_tmp_bufs[i]; FX_DWORD tmp_buf_size = buf_size; if (i == result_tmp_bufs.GetSize() - 1) { tmp_buf_size = last_buf_size; @@ -825,7 +825,7 @@ fail: dest_size = 0; return; } -ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, int predictor, int Colors, int BitsPerComponent, int Columns) { CCodec_FlateScanlineDecoder* pDecoder = new CCodec_FlateScanlineDecoder; @@ -834,7 +834,7 @@ ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(FX_LPCBYTE src_buf, FX } FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, int predictor, int Colors, int BitsPerComponent, int Columns, - FX_DWORD estimated_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) + FX_DWORD estimated_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { dest_buf = NULL; FX_DWORD offset = 0; @@ -881,12 +881,12 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_b } FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns, - FX_LPBYTE& dest_buf, FX_DWORD& dest_size) + uint8_t*& dest_buf, FX_DWORD& dest_size) { if (predictor != 2 && predictor < 10) { return Encode(src_buf, src_size, dest_buf, dest_size); } - FX_LPBYTE pSrcBuf = NULL; + uint8_t* pSrcBuf = NULL; pSrcBuf = FX_Alloc(uint8_t, src_size); FXSYS_memcpy32(pSrcBuf, src_buf, src_size); FX_BOOL ret = TRUE; @@ -902,7 +902,7 @@ FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_Free(pSrcBuf); return ret; } -FX_BOOL CCodec_FlateModule::Encode(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { dest_size = src_size + src_size / 1000 + 12; dest_buf = FX_Alloc( uint8_t, dest_size); diff --git a/core/src/fxcodec/codec/fx_codec_icc.cpp b/core/src/fxcodec/codec/fx_codec_icc.cpp index cde5d4c1bd..6fe92ff240 100644 --- a/core/src/fxcodec/codec/fx_codec_icc.cpp +++ b/core/src/fxcodec/codec/fx_codec_icc.cpp @@ -13,7 +13,7 @@ const FX_DWORD N_COMPONENT_RGB = 3; const FX_DWORD N_COMPONENT_CMYK = 4; const FX_DWORD N_COMPONENT_DEFAULT = 3; -FX_BOOL MD5ComputeID( FX_LPCVOID buf, FX_DWORD dwSize, uint8_t ID[16] ) +FX_BOOL MD5ComputeID( const void* buf, FX_DWORD dwSize, uint8_t ID[16] ) { return cmsMD5computeIDExt(buf, dwSize, ID); } @@ -218,7 +218,7 @@ void IccLib_TranslateImage(void* pTransform, unsigned char* pDest, const unsigne { cmsDoTransform(((CLcmsCmm*)pTransform)->m_hTransform, (void*)pSrc, pDest, pixels); } -FX_LPVOID CreateProfile_Gray(double gamma) +void* CreateProfile_Gray(double gamma) { cmsCIExyY* D50 = (cmsCIExyY*)cmsD50_xyY(); if (!cmsWhitePointFromTemp(D50, 6504)) { @@ -228,11 +228,11 @@ FX_LPVOID CreateProfile_Gray(double gamma) if (curve == NULL) { return NULL; } - FX_LPVOID profile = cmsCreateGrayProfile(D50, curve); + void* profile = cmsCreateGrayProfile(D50, curve); cmsFreeToneCurve(curve); return profile; } -ICodec_IccModule::IccCS GetProfileCSFromHandle(FX_LPVOID pProfile) +ICodec_IccModule::IccCS GetProfileCSFromHandle(void* pProfile) { if (pProfile == NULL) { return ICodec_IccModule::IccCS_Unknown; @@ -264,7 +264,7 @@ ICodec_IccModule::IccCS GetProfileCSFromHandle(FX_LPVOID pProfile) return ICodec_IccModule::IccCS_Unknown; } } -ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize) +ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS(const uint8_t* pProfileData, FX_DWORD dwProfileSize) { ICodec_IccModule::IccCS cs; cmsHPROFILE hProfile = cmsOpenProfileFromMem((void*)pProfileData, dwProfileSize); @@ -284,13 +284,13 @@ ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS(IFX_FileRead* pFile) } ICodec_IccModule::IccCS cs; FX_DWORD dwSize = (FX_DWORD)pFile->GetSize(); - FX_LPBYTE pBuf = FX_Alloc(uint8_t, dwSize); + uint8_t* pBuf = FX_Alloc(uint8_t, dwSize); pFile->ReadBlock(pBuf, 0, dwSize); cs = GetProfileCS(pBuf, dwSize); FX_Free(pBuf); return cs; } -FX_DWORD TransferProfileType(FX_LPVOID pProfile, FX_DWORD dwFormat) +FX_DWORD TransferProfileType(void* pProfile, FX_DWORD dwFormat) { cmsColorSpaceSignature cs = cmsGetColorSpace(pProfile); switch (cs) { @@ -341,7 +341,7 @@ class CFX_IccProfileCache public: CFX_IccProfileCache(); ~CFX_IccProfileCache(); - FX_LPVOID m_pProfile; + void* m_pProfile; FX_DWORD m_dwRate; protected: void Purge(); @@ -365,7 +365,7 @@ class CFX_IccTransformCache public: CFX_IccTransformCache(CLcmsCmm* pCmm = NULL); ~CFX_IccTransformCache(); - FX_LPVOID m_pIccTransform; + void* m_pIccTransform; FX_DWORD m_dwRate; CLcmsCmm* m_pCmm; protected: @@ -400,7 +400,7 @@ CFX_ByteStringKey& CFX_ByteStringKey::operator << (FX_DWORD i) AppendBlock(&i, sizeof(FX_DWORD)); return *this; } -FX_LPVOID CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, Icc_CLASS ic, CFX_BinaryBuf* pTransformKey) +void* CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, Icc_CLASS ic, CFX_BinaryBuf* pTransformKey) { CFX_IccProfileCache* pCache = NULL; CFX_ByteStringKey key; @@ -431,7 +431,7 @@ FX_LPVOID CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, CFX_ByteString ProfileKey(key.GetBuffer(), key.GetSize()); ASSERT(pTransformKey); pTransformKey->AppendBlock(ProfileKey.GetBuffer(0), ProfileKey.GetLength()); - if (!m_MapProfile.Lookup(ProfileKey, (FX_LPVOID&)pCache)) { + if (!m_MapProfile.Lookup(ProfileKey, (void*&)pCache)) { pCache = new CFX_IccProfileCache; switch (pIccParam->dwProfileType) { case Icc_PARAMTYPE_BUFFER: @@ -458,7 +458,7 @@ FX_LPVOID CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, } return pCache->m_pProfile; } -FX_LPVOID CCodec_IccModule::CreateTransform(ICodec_IccModule::IccParam* pInputParam, +void* CCodec_IccModule::CreateTransform(ICodec_IccModule::IccParam* pInputParam, ICodec_IccModule::IccParam* pOutputParam, ICodec_IccModule::IccParam* pProofParam, FX_DWORD dwIntent, FX_DWORD dwFlag, FX_DWORD dwPrfIntent, FX_DWORD dwPrfFlag) @@ -466,11 +466,11 @@ FX_LPVOID CCodec_IccModule::CreateTransform(ICodec_IccModule::IccParam* pInputPa CLcmsCmm* pCmm = NULL; ASSERT(pInputParam && pOutputParam); CFX_ByteStringKey key; - FX_LPVOID pInputProfile = CreateProfile(pInputParam, Icc_CLASS_INPUT, &key); + void* pInputProfile = CreateProfile(pInputParam, Icc_CLASS_INPUT, &key); if (pInputProfile == NULL) { return NULL; } - FX_LPVOID pOutputProfile = CreateProfile(pOutputParam, Icc_CLASS_OUTPUT, &key); + void* pOutputProfile = CreateProfile(pOutputParam, Icc_CLASS_OUTPUT, &key); if (pOutputProfile == NULL) { return NULL; } @@ -479,14 +479,14 @@ FX_LPVOID CCodec_IccModule::CreateTransform(ICodec_IccModule::IccParam* pInputPa if (dwInputProfileType == 0 || dwOutputProfileType == 0) { return NULL; } - FX_LPVOID pProofProfile = NULL; + void* pProofProfile = NULL; if (pProofParam) { pProofProfile = CreateProfile(pProofParam, Icc_CLASS_PROOF, &key); } key << dwInputProfileType << dwOutputProfileType << dwIntent << dwFlag << (pProofProfile != NULL) << dwPrfIntent << dwPrfFlag; CFX_ByteStringC TransformKey(key.GetBuffer(), key.GetSize()); CFX_IccTransformCache* pTransformCache; - if (!m_MapTranform.Lookup(TransformKey, (FX_LPVOID&)pTransformCache)) { + if (!m_MapTranform.Lookup(TransformKey, (void*&)pTransformCache)) { pCmm = FX_Alloc(CLcmsCmm, 1); pCmm->m_nSrcComponents = T_CHANNELS(dwInputProfileType); pCmm->m_nDstComponents = T_CHANNELS(dwOutputProfileType); @@ -512,7 +512,7 @@ CCodec_IccModule::~CCodec_IccModule() CFX_ByteString key; CFX_IccProfileCache* pProfileCache; while (pos) { - m_MapProfile.GetNextAssoc(pos, key, (FX_LPVOID&)pProfileCache); + m_MapProfile.GetNextAssoc(pos, key, (void*&)pProfileCache); if (pProfileCache) { delete pProfileCache; } @@ -520,18 +520,18 @@ CCodec_IccModule::~CCodec_IccModule() pos = m_MapTranform.GetStartPosition(); CFX_IccTransformCache* pTransformCache; while (pos) { - m_MapTranform.GetNextAssoc(pos, key, (FX_LPVOID&)pTransformCache); + m_MapTranform.GetNextAssoc(pos, key, (void*&)pTransformCache); if (pTransformCache) { delete pTransformCache; } } } -void* CCodec_IccModule::CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent, FX_DWORD dwSrcFormat) +void* CCodec_IccModule::CreateTransform_sRGB(const uint8_t* pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent, FX_DWORD dwSrcFormat) { return IccLib_CreateTransform_sRGB(pProfileData, dwProfileSize, nComponents, intent, dwSrcFormat); } -void* CCodec_IccModule::CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, - FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent, +void* CCodec_IccModule::CreateTransform_CMYK(const uint8_t* pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, + const uint8_t* pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent, FX_DWORD dwSrcFormat , FX_DWORD dwDstFormat) { return IccLib_CreateTransform(pSrcProfileData, dwSrcProfileSize, nSrcComponents, @@ -545,7 +545,7 @@ void CCodec_IccModule::Translate(void* pTransform, FX_FLOAT* pSrcValues, FX_FLOA { IccLib_Translate(pTransform, m_nComponents, pSrcValues, pDestValues); } -void CCodec_IccModule::TranslateScanline(void* pTransform, FX_LPBYTE pDest, FX_LPCBYTE pSrc, int32_t pixels) +void CCodec_IccModule::TranslateScanline(void* pTransform, uint8_t* pDest, const uint8_t* pSrc, int32_t pixels) { IccLib_TranslateImage(pTransform, pDest, pSrc, pixels); } diff --git a/core/src/fxcodec/codec/fx_codec_jbig.cpp b/core/src/fxcodec/codec/fx_codec_jbig.cpp index 622448d659..b908915227 100644 --- a/core/src/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/src/fxcodec/codec/fx_codec_jbig.cpp @@ -25,12 +25,12 @@ void CCodec_Jbig2Module::DestroyJbig2Context(void* pJbig2Content) } pJbig2Content = NULL; } -FX_BOOL CCodec_Jbig2Module::Decode(FX_DWORD width, FX_DWORD height, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPCBYTE global_data, FX_DWORD global_size, FX_LPBYTE dest_buf, FX_DWORD dest_pitch) +FX_BOOL CCodec_Jbig2Module::Decode(FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, + const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch) { FXSYS_memset32(dest_buf, 0, height * dest_pitch); CJBig2_Context* pContext = CJBig2_Context::CreateContext(&m_Module, - (FX_LPBYTE)global_data, global_size, (FX_LPBYTE)src_buf, src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache); + (uint8_t*)global_data, global_size, (uint8_t*)src_buf, src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache); if (pContext == NULL) { return FALSE; } @@ -47,12 +47,12 @@ FX_BOOL CCodec_Jbig2Module::Decode(FX_DWORD width, FX_DWORD height, FX_LPCBYTE s return TRUE; } FX_BOOL CCodec_Jbig2Module::Decode(IFX_FileRead* file_ptr, - FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, FX_LPBYTE& dest_buf) + FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf) { CJBig2_Context* pContext = NULL; CJBig2_Image* dest_image = NULL; FX_DWORD src_size = (FX_DWORD)file_ptr->GetSize(); - FX_LPBYTE src_buf = FX_Alloc(uint8_t, src_size); + uint8_t* src_buf = FX_Alloc(uint8_t, src_size); int ret = 0; if(!file_ptr->ReadBlock(src_buf, 0, src_size)) { goto failed; @@ -80,8 +80,8 @@ failed: } return FALSE; } -FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPCBYTE global_data, FX_DWORD global_size, FX_LPBYTE dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause) +FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, + const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause) { if(!pJbig2Context) { return FXCODEC_STATUS_ERR_PARAMS; @@ -99,7 +99,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, FX_DWORD wid m_pJbig2Context->m_bFileReader = FALSE; FXSYS_memset32(dest_buf, 0, height * dest_pitch); m_pJbig2Context->m_pContext = CJBig2_Context::CreateContext(&m_Module, - (FX_LPBYTE)global_data, global_size, (FX_LPBYTE)src_buf, src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache, pPause); + (uint8_t*)global_data, global_size, (uint8_t*)src_buf, src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache, pPause); if(!m_pJbig2Context->m_pContext) { return FXCODEC_STATUS_ERROR; } @@ -120,7 +120,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, FX_DWORD wid return m_pJbig2Context->m_pContext->GetProcessiveStatus(); } FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, IFX_FileRead* file_ptr, - FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, FX_LPBYTE& dest_buf, IFX_Pause* pPause) + FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf, IFX_Pause* pPause) { if(!pJbig2Context) { return FXCODEC_STATUS_ERR_PARAMS; diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp index 111cbcf245..4017be56b3 100644 --- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp @@ -77,7 +77,7 @@ extern "C" { #define JPEG_MARKER_AUTHORTIME (JPEG_APP0 + 3) #define JPEG_MARKER_MAXSIZE 0xFFFF #define JPEG_OVERHEAD_LEN 14 -static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo, FX_LPCBYTE icc_buf_ptr, FX_DWORD icc_length) +static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo, const uint8_t* icc_buf_ptr, FX_DWORD icc_length) { if(icc_buf_ptr == NULL || icc_length == 0) { return FALSE; @@ -88,7 +88,7 @@ static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo, FX_LPCBYTE icc_buf_ptr return FALSE; } FX_DWORD icc_data_length = JPEG_OVERHEAD_LEN + (icc_segment_num > 1 ? icc_segment_size : icc_length); - FX_LPBYTE icc_data = FX_Alloc(uint8_t, icc_data_length); + uint8_t* icc_data = FX_Alloc(uint8_t, icc_data_length); FXSYS_memcpy32(icc_data, "\x49\x43\x43\x5f\x50\x52\x4f\x46\x49\x4c\x45\x00", 12); icc_data[13] = (uint8_t)icc_segment_num; for (uint8_t i = 0; i < (icc_segment_num - 1); i++) { @@ -113,7 +113,7 @@ extern "C" { } }; #define JPEG_BLOCK_SIZE 1048576 -static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_STRSIZE& dest_size, int quality, FX_LPCBYTE icc_buf, FX_DWORD icc_length) +static void _JpegEncode(const CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, FX_DWORD icc_length) { struct jpeg_error_mgr jerr; jerr.error_exit = _error_do_nothing; @@ -171,7 +171,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST } else { cinfo.in_color_space = JCS_CMYK; } - FX_LPBYTE line_buf = NULL; + uint8_t* line_buf = NULL; if (nComponents > 1) { line_buf = FX_Alloc2D(uint8_t, width, nComponents); } @@ -184,9 +184,9 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST JSAMPROW row_pointer[1]; JDIMENSION row; while (cinfo.next_scanline < cinfo.image_height) { - FX_LPCBYTE src_scan = pSource->GetScanline(cinfo.next_scanline); + const uint8_t* src_scan = pSource->GetScanline(cinfo.next_scanline); if (nComponents > 1) { - FX_LPBYTE dest_scan = line_buf; + uint8_t* dest_scan = line_buf; if (nComponents == 3) { for (int i = 0; i < width; i ++) { dest_scan[0] = src_scan[2]; @@ -202,7 +202,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST } row_pointer[0] = line_buf; } else { - row_pointer[0] = (FX_LPBYTE)src_scan; + row_pointer[0] = (uint8_t*)src_scan; } row = cinfo.next_scanline; jpeg_write_scanlines(&cinfo, row_pointer, 1); @@ -220,9 +220,9 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST } dest_size = dest_buf_length - (FX_STRSIZE)dest.free_in_buffer; } -static FX_BOOL _JpegLoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int& width, int& height, +static FX_BOOL _JpegLoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height, int& num_components, int& bits_per_components, FX_BOOL& color_transform, - FX_LPBYTE* icc_buf_ptr, FX_DWORD* icc_length) + uint8_t** icc_buf_ptr, FX_DWORD* icc_length) { _JpegScanSOI(src_buf, src_size); struct jpeg_decompress_struct cinfo; @@ -280,7 +280,7 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder public: CCodec_JpegDecoder(); ~CCodec_JpegDecoder(); - FX_BOOL Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, + FX_BOOL Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, FX_BOOL ColorTransform, IFX_JpegProvider* pJP); virtual void Destroy() { @@ -288,15 +288,15 @@ public: } virtual void v_DownScale(int dest_width, int dest_height); virtual FX_BOOL v_Rewind(); - virtual FX_LPBYTE v_GetNextLine(); + virtual uint8_t* v_GetNextLine(); virtual FX_DWORD GetSrcOffset(); jmp_buf m_JmpBuf; struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr; struct jpeg_source_mgr src; - FX_LPCBYTE m_SrcBuf; + const uint8_t* m_SrcBuf; FX_DWORD m_SrcSize; - FX_LPBYTE m_pScanlineBuf; + uint8_t* m_pScanlineBuf; FX_BOOL InitDecode(); FX_BOOL m_bInited, m_bStarted, m_bJpegTransform; protected: @@ -366,7 +366,7 @@ FX_BOOL CCodec_JpegDecoder::InitDecode() m_nDefaultScaleDenom = cinfo.scale_denom; return TRUE; } -FX_BOOL CCodec_JpegDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +FX_BOOL CCodec_JpegDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, FX_BOOL ColorTransform, IFX_JpegProvider* pJP) { if (pJP) { @@ -389,8 +389,8 @@ FX_BOOL CCodec_JpegDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int wi src.resync_to_restart = _src_resync; m_bJpegTransform = ColorTransform; if(src_size > 1 && FXSYS_memcmp32(src_buf + src_size - 2, "\xFF\xD9", 2) != 0) { - ((FX_LPBYTE)src_buf)[src_size - 2] = 0xFF; - ((FX_LPBYTE)src_buf)[src_size - 1] = 0xD9; + ((uint8_t*)src_buf)[src_size - 2] = 0xFF; + ((uint8_t*)src_buf)[src_size - 1] = 0xD9; } m_OutputWidth = m_OrigWidth = width; m_OutputHeight = m_OrigHeight = height; @@ -470,7 +470,7 @@ FX_BOOL CCodec_JpegDecoder::v_Rewind() m_bStarted = TRUE; return TRUE; } -FX_LPBYTE CCodec_JpegDecoder::v_GetNextLine() +uint8_t* CCodec_JpegDecoder::v_GetNextLine() { if (m_pExtProvider) { return m_pExtProvider->GetNextLine(m_pExtContext); @@ -488,7 +488,7 @@ FX_DWORD CCodec_JpegDecoder::GetSrcOffset() } return (FX_DWORD)(m_SrcSize - src.bytes_in_buffer); } -ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, +ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, FX_BOOL ColorTransform) { if (src_buf == NULL || src_size == 0) { @@ -501,9 +501,9 @@ ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(FX_LPCBYTE src_buf, FX_ } return pDecoder; } -FX_BOOL CCodec_JpegModule::LoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int& width, int& height, +FX_BOOL CCodec_JpegModule::LoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height, int& num_components, int& bits_per_components, FX_BOOL& color_transform, - FX_LPBYTE* icc_buf_ptr, FX_DWORD* icc_length) + uint8_t** icc_buf_ptr, FX_DWORD* icc_length) { if (m_pExtProvider) { return m_pExtProvider->LoadInfo(src_buf, src_size, width, height, @@ -512,7 +512,7 @@ FX_BOOL CCodec_JpegModule::LoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int& } return _JpegLoadInfo(src_buf, src_size, width, height, num_components, bits_per_components, color_transform, icc_buf_ptr, icc_length); } -FX_BOOL CCodec_JpegModule::Encode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_STRSIZE& dest_size, int quality, FX_LPCBYTE icc_buf, FX_DWORD icc_length) +FX_BOOL CCodec_JpegModule::Encode(const CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, FX_DWORD icc_length) { if (m_pExtProvider) { return m_pExtProvider->Encode(pSource, dest_buf, dest_size, quality, icc_buf, icc_length); @@ -662,7 +662,7 @@ FX_BOOL CCodec_JpegModule::ReadScanline(void* pContext, unsigned char* dest_buf) int nlines = jpeg_read_scanlines(&p->m_Info, &dest_buf, 1); return nlines == 1; } -FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr) +FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) { if (m_pExtProvider) { return m_pExtProvider->GetAvailInput(pContext, avail_buf_ptr); @@ -670,7 +670,7 @@ FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_p if(avail_buf_ptr != NULL) { *avail_buf_ptr = NULL; if(((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) { - *avail_buf_ptr = (FX_LPBYTE)((FXJPEG_Context*)pContext)->m_SrcMgr.next_input_byte; + *avail_buf_ptr = (uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.next_input_byte; } } return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; diff --git a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp index 01faf67a30..312ce78759 100644 --- a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp @@ -589,8 +589,8 @@ public: ~CJPX_Decoder(); FX_BOOL Init(const unsigned char* src_data, int src_size); void GetInfo(FX_DWORD& width, FX_DWORD& height, FX_DWORD& codestream_nComps, FX_DWORD& output_nComps); - FX_BOOL Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateColor, FX_LPBYTE offsets); - FX_LPCBYTE m_SrcData; + FX_BOOL Decode(uint8_t* dest_buf, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets); + const uint8_t* m_SrcData; int m_SrcSize; opj_image_t *image; opj_codec_t* l_codec; @@ -702,10 +702,12 @@ void CJPX_Decoder::GetInfo(FX_DWORD& width, FX_DWORD& height, FX_DWORD& codestre height = (FX_DWORD)image->y1; output_nComps = codestream_nComps = (FX_DWORD)image->numcomps; } -FX_BOOL CJPX_Decoder::Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateColor, FX_LPBYTE offsets) +FX_BOOL CJPX_Decoder::Decode(uint8_t* dest_buf, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets) { int i, wid, hei, row, col, channel, src; - FX_LPBYTE pChannel, pScanline, pPixel; + uint8_t* pChannel; + uint8_t* pScanline; + uint8_t* pPixel; if(image->comps[0].w != image->x1 || image->comps[0].h != image->y1) { return FALSE; @@ -784,7 +786,7 @@ void initialize_sign_lut(); CCodec_JpxModule::CCodec_JpxModule() { } -void* CCodec_JpxModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size , FX_BOOL useColorSpace) +void* CCodec_JpxModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size , FX_BOOL useColorSpace) { CJPX_Decoder* pDecoder = new CJPX_Decoder; pDecoder->m_useColorSpace = useColorSpace; @@ -794,13 +796,13 @@ void* CCodec_JpxModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size , FX } return pDecoder; } -void CCodec_JpxModule::GetImageInfo(FX_LPVOID ctx, FX_DWORD& width, FX_DWORD& height, +void CCodec_JpxModule::GetImageInfo(void* ctx, FX_DWORD& width, FX_DWORD& height, FX_DWORD& codestream_nComps, FX_DWORD& output_nComps) { CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; pDecoder->GetInfo(width, height, codestream_nComps, output_nComps); } -FX_BOOL CCodec_JpxModule::Decode(void* ctx, FX_LPBYTE dest_data, int pitch, FX_BOOL bTranslateColor, FX_LPBYTE offsets) +FX_BOOL CCodec_JpxModule::Decode(void* ctx, uint8_t* dest_data, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets) { CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; return pDecoder->Decode(dest_data, pitch, bTranslateColor, offsets); diff --git a/core/src/fxcodec/jbig2/JBig2_Define.h b/core/src/fxcodec/jbig2/JBig2_Define.h index 46c6e2b532..cc1e3904bd 100644 --- a/core/src/fxcodec/jbig2/JBig2_Define.h +++ b/core/src/fxcodec/jbig2/JBig2_Define.h @@ -24,7 +24,7 @@ typedef struct { int32_t code; } JBig2HuffmanCode; extern "C" { - void _FaxG4Decode(void *pModule, FX_LPCBYTE src_buf, FX_DWORD src_size, int* pbitpos, FX_LPBYTE dest_buf, int width, int height, int pitch = 0); + void _FaxG4Decode(void *pModule, const uint8_t* src_buf, FX_DWORD src_size, int* pbitpos, uint8_t* dest_buf, int width, int height, int pitch = 0); }; #define JBIG2_MAX_REFERRED_SEGMENT_COUNT 64 #define JBIG2_MAX_EXPORT_SYSMBOLS 65535 diff --git a/core/src/fxcodec/jbig2/JBig2_Module.h b/core/src/fxcodec/jbig2/JBig2_Module.h index aef31bb49f..5a96f4395e 100644 --- a/core/src/fxcodec/jbig2/JBig2_Module.h +++ b/core/src/fxcodec/jbig2/JBig2_Module.h @@ -18,16 +18,16 @@ public: virtual void *JBig2_Malloc3(FX_DWORD num, FX_DWORD dwSize, FX_DWORD dwSize2) = 0; - virtual void *JBig2_Realloc(FX_LPVOID pMem, FX_DWORD dwSize) = 0; + virtual void *JBig2_Realloc(void* pMem, FX_DWORD dwSize) = 0; - virtual void JBig2_Free(FX_LPVOID pMem) = 0; + virtual void JBig2_Free(void* pMem) = 0; virtual void JBig2_Assert(int32_t nExpression) {}; - virtual void JBig2_Error(FX_LPCSTR format, ...) {}; + virtual void JBig2_Error(const FX_CHAR* format, ...) {}; - virtual void JBig2_Warn(FX_LPCSTR format, ...) {}; + virtual void JBig2_Warn(const FX_CHAR* format, ...) {}; - virtual void JBig2_Log(FX_LPCSTR format, ...) {}; + virtual void JBig2_Log(const FX_CHAR* format, ...) {}; }; #endif diff --git a/core/src/fxcodec/jbig2/JBig2_Object.cpp b/core/src/fxcodec/jbig2/JBig2_Object.cpp index 4bb00b897b..1429a91644 100644 --- a/core/src/fxcodec/jbig2/JBig2_Object.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Object.cpp @@ -6,14 +6,14 @@ #include "JBig2_Object.h" #include "JBig2_Module.h" -void *CJBig2_Object::operator new(size_t size, CJBig2_Module *pModule, FX_LPCSTR filename, int line) +void *CJBig2_Object::operator new(size_t size, CJBig2_Module *pModule, const FX_CHAR* filename, int line) { CJBig2_Object *p; p = (CJBig2_Object *)pModule->JBig2_Malloc((FX_DWORD)size); p->m_pModule = pModule; return p; } -void CJBig2_Object::operator delete(void *p, CJBig2_Module *pModule, FX_LPCSTR filename, int line) +void CJBig2_Object::operator delete(void *p, CJBig2_Module *pModule, const FX_CHAR* filename, int line) { pModule->JBig2_Free(p); } @@ -33,7 +33,7 @@ void CJBig2_Object::operator delete(void *p, CJBig2_Module *pModule) pModule->JBig2_Free(p); } void *CJBig2_Object::operator new[](size_t size, CJBig2_Module *pModule, size_t unit_size, - FX_LPCSTR filename, int line) + const FX_CHAR* filename, int line) { void *p; uint8_t *pCur, *pEnd; @@ -46,7 +46,7 @@ void *CJBig2_Object::operator new[](size_t size, CJBig2_Module *pModule, size_t return p; } void CJBig2_Object::operator delete[](void *p, CJBig2_Module *pModule, size_t unit_size, - FX_LPCSTR filename, int line) + const FX_CHAR* filename, int line) { pModule->JBig2_Free(p); } diff --git a/core/src/fxcodec/jbig2/JBig2_Object.h b/core/src/fxcodec/jbig2/JBig2_Object.h index 23eecbf171..150a8e7e99 100644 --- a/core/src/fxcodec/jbig2/JBig2_Object.h +++ b/core/src/fxcodec/jbig2/JBig2_Object.h @@ -13,9 +13,9 @@ class CJBig2_Object { public: - void *operator new(size_t size, CJBig2_Module *pModule, FX_LPCSTR filename, int line); + void *operator new(size_t size, CJBig2_Module *pModule, const FX_CHAR* filename, int line); - void operator delete(void *p, CJBig2_Module *pModule, FX_LPCSTR filename, int line); + void operator delete(void *p, CJBig2_Module *pModule, const FX_CHAR* filename, int line); void *operator new(size_t size, CJBig2_Module *pModule); @@ -24,10 +24,10 @@ public: void operator delete(void *p, CJBig2_Module *pModule); void *operator new[](size_t size, CJBig2_Module *pModule, size_t unit_size, - FX_LPCSTR filename, int line); + const FX_CHAR* filename, int line); void operator delete[](void *p, CJBig2_Module *pModule, size_t unit_size, - FX_LPCSTR filename, int line); + const FX_CHAR* filename, int line); void *operator new[](size_t size, CJBig2_Module *pModule, size_t unit_size); diff --git a/core/src/fxcodec/jbig2/JBig2_Segment.h b/core/src/fxcodec/jbig2/JBig2_Segment.h index fe44bc962d..b61e8e5075 100644 --- a/core/src/fxcodec/jbig2/JBig2_Segment.h +++ b/core/src/fxcodec/jbig2/JBig2_Segment.h @@ -62,7 +62,7 @@ public: CJBig2_PatternDict *pd; CJBig2_Image *im; CJBig2_HuffmanTable *ht; - FX_LPVOID vd; + void* vd; } m_Result; }; #endif diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h index c2d72f4bf1..24f2cecbb5 100644 --- a/core/src/fxcrt/extension.h +++ b/core/src/fxcrt/extension.h @@ -146,7 +146,7 @@ public: { m_dwFlags = FX_MEMSTREAM_TakeOver | (bConsecutive ? FX_MEMSTREAM_Consecutive : 0); } - CFX_MemoryStream(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver) + CFX_MemoryStream(uint8_t* pBuffer, size_t nSize, FX_BOOL bTakeOver) : m_dwCount(1) , m_nTotalSize(nSize) , m_nCurSize(nSize) @@ -161,7 +161,7 @@ public: { if (m_dwFlags & FX_MEMSTREAM_TakeOver) { for (int32_t i = 0; i < m_Blocks.GetSize(); i++) { - FX_Free((FX_LPBYTE)m_Blocks[i]); + FX_Free((uint8_t*)m_Blocks[i]); } } m_Blocks.RemoveAll(); @@ -240,7 +240,7 @@ public: m_nCurPos = newPos.ValueOrDie(); if (m_dwFlags & FX_MEMSTREAM_Consecutive) { - FXSYS_memcpy32(buffer, (FX_LPBYTE)m_Blocks[0] + (size_t)offset, size); + FXSYS_memcpy32(buffer, (uint8_t*)m_Blocks[0] + (size_t)offset, size); return TRUE; } size_t nStartBlock = (size_t)offset / m_nGrowSize; @@ -250,8 +250,8 @@ public: if (nRead > size) { nRead = size; } - FXSYS_memcpy32(buffer, (FX_LPBYTE)m_Blocks[(int)nStartBlock] + (size_t)offset, nRead); - buffer = ((FX_LPBYTE)buffer) + nRead; + FXSYS_memcpy32(buffer, (uint8_t*)m_Blocks[(int)nStartBlock] + (size_t)offset, nRead); + buffer = ((uint8_t*)buffer) + nRead; size -= nRead; nStartBlock ++; offset = 0; @@ -303,7 +303,7 @@ public: return FALSE; } } - FXSYS_memcpy32((FX_LPBYTE)m_Blocks[0] + (size_t)offset, buffer, size); + FXSYS_memcpy32((uint8_t*)m_Blocks[0] + (size_t)offset, buffer, size); if (m_nCurSize < m_nCurPos) { m_nCurSize = m_nCurPos; } @@ -327,8 +327,8 @@ public: if (nWrite > size) { nWrite = size; } - FXSYS_memcpy32((FX_LPBYTE)m_Blocks[(int)nStartBlock] + (size_t)offset, buffer, nWrite); - buffer = ((FX_LPBYTE)buffer) + nWrite; + FXSYS_memcpy32((uint8_t*)m_Blocks[(int)nStartBlock] + (size_t)offset, buffer, nWrite); + buffer = ((uint8_t*)buffer) + nWrite; size -= nWrite; nStartBlock ++; offset = 0; @@ -347,7 +347,7 @@ public: { if (m_dwFlags & FX_MEMSTREAM_Consecutive) { if (m_Blocks.GetSize() < 1) { - FX_LPBYTE pBlock = FX_Alloc(uint8_t, FX_MAX(nInitSize, 4096)); + uint8_t* pBlock = FX_Alloc(uint8_t, FX_MAX(nInitSize, 4096)); m_Blocks.Add(pBlock); } m_nGrowSize = FX_MAX(nGrowSize, 4096); @@ -355,11 +355,11 @@ public: m_nGrowSize = FX_MAX(nGrowSize, 4096); } } - virtual FX_LPBYTE GetBuffer() const override + virtual uint8_t* GetBuffer() const override { - return m_Blocks.GetSize() ? (FX_LPBYTE)m_Blocks[0] : NULL; + return m_Blocks.GetSize() ? (uint8_t*)m_Blocks[0] : NULL; } - virtual void AttachBuffer(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE) override + virtual void AttachBuffer(uint8_t* pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE) override { if (!(m_dwFlags & FX_MEMSTREAM_Consecutive)) { return; @@ -404,7 +404,7 @@ protected: size = (size - m_nTotalSize + m_nGrowSize - 1) / m_nGrowSize; m_Blocks.SetSize(m_Blocks.GetSize() + (int32_t)size); while (size --) { - FX_LPBYTE pBlock = FX_Alloc(uint8_t, m_nGrowSize); + uint8_t* pBlock = FX_Alloc(uint8_t, m_nGrowSize); m_Blocks.SetAt(iCount ++, pBlock); m_nTotalSize += m_nGrowSize; } @@ -431,7 +431,7 @@ typedef struct _FX_MTRANDOMCONTEXT { } FX_MTRANDOMCONTEXT, * FX_LPMTRANDOMCONTEXT; typedef FX_MTRANDOMCONTEXT const * FX_LPCMTRANDOMCONTEXT; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, int32_t iCount); +FX_BOOL FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount); #endif #ifdef __cplusplus } diff --git a/core/src/fxcrt/fx_basic_array.cpp b/core/src/fxcrt/fx_basic_array.cpp index 315c83e53a..d21909f861 100644 --- a/core/src/fxcrt/fx_basic_array.cpp +++ b/core/src/fxcrt/fx_basic_array.cpp @@ -52,7 +52,7 @@ FX_BOOL CFX_BasicArray::SetSize(int nNewSize) if (!totalSize.IsValid() || nNewMax < m_nSize) { return FALSE; } - FX_LPBYTE pNewData = FX_Realloc(uint8_t, m_pData, totalSize.ValueOrDie()); + uint8_t* pNewData = FX_Realloc(uint8_t, m_pData, totalSize.ValueOrDie()); if (pNewData == NULL) { return FALSE; } @@ -83,7 +83,7 @@ FX_BOOL CFX_BasicArray::Copy(const CFX_BasicArray& src) FXSYS_memcpy32(m_pData, src.m_pData, src.m_nSize * m_nUnitSize); return TRUE; } -FX_LPBYTE CFX_BasicArray::InsertSpaceAt(int nIndex, int nCount) +uint8_t* CFX_BasicArray::InsertSpaceAt(int nIndex, int nCount) { if (nIndex < 0 || nCount <= 0) { return NULL; @@ -259,7 +259,7 @@ void** CFX_BaseSegmentedArray::GetIndex(int seg_index) const } return pSpot; } -void* CFX_BaseSegmentedArray::IterateSegment(FX_LPCBYTE pSegment, int count, FX_BOOL (*callback)(void* param, void* pData), void* param) const +void* CFX_BaseSegmentedArray::IterateSegment(const uint8_t* pSegment, int count, FX_BOOL (*callback)(void* param, void* pData), void* param) const { for (int i = 0; i < count; i ++) { if (!callback(param, (void*)(pSegment + i * m_UnitSize))) { @@ -276,7 +276,7 @@ void* CFX_BaseSegmentedArray::IterateIndex(int level, int& start, void** pIndex, count = m_SegmentSize; } start += count; - return IterateSegment((FX_LPCBYTE)pIndex, count, callback, param); + return IterateSegment((const uint8_t*)pIndex, count, callback, param); } for (int i = 0; i < m_IndexSize; i ++) { if (pIndex[i] == NULL) { @@ -303,10 +303,10 @@ void* CFX_BaseSegmentedArray::GetAt(int index) const return NULL; } if (m_IndexDepth == 0) { - return (FX_LPBYTE)m_pIndex + m_UnitSize * index; + return (uint8_t*)m_pIndex + m_UnitSize * index; } int seg_index = index / m_SegmentSize; - return (FX_LPBYTE)GetIndex(seg_index)[seg_index % m_IndexSize] + (index % m_SegmentSize) * m_UnitSize; + return (uint8_t*)GetIndex(seg_index)[seg_index % m_IndexSize] + (index % m_SegmentSize) * m_UnitSize; } void CFX_BaseSegmentedArray::Delete(int index, int count) { diff --git a/core/src/fxcrt/fx_basic_bstring.cpp b/core/src/fxcrt/fx_basic_bstring.cpp index 78698fc6d0..2baeb83b5d 100644 --- a/core/src/fxcrt/fx_basic_bstring.cpp +++ b/core/src/fxcrt/fx_basic_bstring.cpp @@ -22,7 +22,7 @@ static int _Buffer_itoa(char* buf, int i, FX_DWORD flags) u = -i; } int base = 10; - FX_LPCSTR string = "0123456789abcdef"; + const FX_CHAR* string = "0123456789abcdef"; if (flags & FXFORMAT_HEX) { base = 16; if (flags & FXFORMAT_CAPITAL) { @@ -81,7 +81,7 @@ CFX_ByteString::~CFX_ByteString() m_pData->Release(); } } -CFX_ByteString::CFX_ByteString(FX_LPCSTR lpsz, FX_STRSIZE nLen) +CFX_ByteString::CFX_ByteString(const FX_CHAR* lpsz, FX_STRSIZE nLen) { if (nLen < 0) { nLen = lpsz ? FXSYS_strlen(lpsz) : 0; @@ -95,7 +95,7 @@ CFX_ByteString::CFX_ByteString(FX_LPCSTR lpsz, FX_STRSIZE nLen) m_pData = NULL; } } -CFX_ByteString::CFX_ByteString(FX_LPCBYTE lpsz, FX_STRSIZE nLen) +CFX_ByteString::CFX_ByteString(const uint8_t* lpsz, FX_STRSIZE nLen) { if (nLen > 0) { m_pData = StringData::Create(nLen); @@ -150,7 +150,7 @@ CFX_ByteString::CFX_ByteString(FX_BSTR str1, FX_BSTR str2) FXSYS_memcpy32(m_pData->m_String + str1.GetLength(), str2.GetCStr(), str2.GetLength()); } } -const CFX_ByteString& CFX_ByteString::operator=(FX_LPCSTR lpsz) +const CFX_ByteString& CFX_ByteString::operator=(const FX_CHAR* lpsz) { if (lpsz == NULL || lpsz[0] == 0) { Empty(); @@ -192,7 +192,7 @@ const CFX_ByteString& CFX_ByteString::operator=(const CFX_BinaryBuf& buf) Load(buf.GetBuffer(), buf.GetSize()); return *this; } -void CFX_ByteString::Load(FX_LPCBYTE buf, FX_STRSIZE len) +void CFX_ByteString::Load(const uint8_t* buf, FX_STRSIZE len) { Empty(); if (len) { @@ -204,7 +204,7 @@ void CFX_ByteString::Load(FX_LPCBYTE buf, FX_STRSIZE len) m_pData = NULL; } } -const CFX_ByteString& CFX_ByteString::operator+=(FX_LPCSTR lpsz) +const CFX_ByteString& CFX_ByteString::operator+=(const FX_CHAR* lpsz) { if (lpsz) { ConcatInPlace(FXSYS_strlen(lpsz), lpsz); @@ -280,8 +280,8 @@ bool CFX_ByteString::EqualNoCase(FX_BSTR str) const if (m_pData->m_nDataLength != len) { return false; } - FX_LPCBYTE pThis = (FX_LPCBYTE)m_pData->m_String; - FX_LPCBYTE pThat = str.GetPtr(); + const uint8_t* pThis = (const uint8_t*)m_pData->m_String; + const uint8_t* pThat = str.GetPtr(); for (FX_STRSIZE i = 0; i < len; i ++) { if ((*pThis) != (*pThat)) { uint8_t bThis = *pThis; @@ -301,7 +301,7 @@ bool CFX_ByteString::EqualNoCase(FX_BSTR str) const } return true; } -void CFX_ByteString::AssignCopy(FX_STRSIZE nSrcLen, FX_LPCSTR lpszSrcData) +void CFX_ByteString::AssignCopy(FX_STRSIZE nSrcLen, const FX_CHAR* lpszSrcData) { AllocBeforeWrite(nSrcLen); FXSYS_memcpy32(m_pData->m_String, lpszSrcData, nSrcLen); @@ -336,7 +336,7 @@ void CFX_ByteString::ReleaseBuffer(FX_STRSIZE nNewLength) } CopyBeforeWrite(); if (nNewLength == -1) { - nNewLength = FXSYS_strlen((FX_LPCSTR)m_pData->m_String); + nNewLength = FXSYS_strlen((const FX_CHAR*)m_pData->m_String); } if (nNewLength == 0) { Empty(); @@ -351,7 +351,7 @@ void CFX_ByteString::Reserve(FX_STRSIZE len) GetBuffer(len); ReleaseBuffer(GetLength()); } -FX_LPSTR CFX_ByteString::GetBuffer(FX_STRSIZE nMinBufLength) +FX_CHAR* CFX_ByteString::GetBuffer(FX_STRSIZE nMinBufLength) { if (m_pData == NULL && nMinBufLength == 0) { return NULL; @@ -405,7 +405,7 @@ FX_STRSIZE CFX_ByteString::Delete(FX_STRSIZE nIndex, FX_STRSIZE nCount) } return m_pData->m_nDataLength; } -void CFX_ByteString::ConcatInPlace(FX_STRSIZE nSrcLen, FX_LPCSTR lpszSrcData) +void CFX_ByteString::ConcatInPlace(FX_STRSIZE nSrcLen, const FX_CHAR* lpszSrcData) { if (nSrcLen == 0 || lpszSrcData == NULL) { return; @@ -426,8 +426,8 @@ void CFX_ByteString::ConcatInPlace(FX_STRSIZE nSrcLen, FX_LPCSTR lpszSrcData) m_pData->m_String[m_pData->m_nDataLength] = 0; } } -void CFX_ByteString::ConcatCopy(FX_STRSIZE nSrc1Len, FX_LPCSTR lpszSrc1Data, - FX_STRSIZE nSrc2Len, FX_LPCSTR lpszSrc2Data) +void CFX_ByteString::ConcatCopy(FX_STRSIZE nSrc1Len, const FX_CHAR* lpszSrc1Data, + FX_STRSIZE nSrc2Len, const FX_CHAR* lpszSrc2Data) { int nNewLen = nSrc1Len + nSrc2Len; if (nNewLen <= 0) { @@ -486,7 +486,7 @@ void CFX_ByteString::AllocCopy(CFX_ByteString& dest, FX_STRSIZE nCopyLen, FX_STR #define FORCE_ANSI 0x10000 #define FORCE_UNICODE 0x20000 #define FORCE_INT64 0x40000 -void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList) +void CFX_ByteString::FormatV(const FX_CHAR* lpszFormat, va_list argList) { va_list argListSave; #if defined(__ARMCC_VERSION) || (!defined(_MSC_VER) && (_FX_CPU_ == _FX_X64_ || _FX_CPU_ == _FX_IA64_ || _FX_CPU_ == _FX_ARM64_)) || defined(__native_client__) @@ -495,7 +495,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList) argListSave = argList; #endif int nMaxLen = 0; - for (FX_LPCSTR lpsz = lpszFormat; *lpsz != 0; lpsz ++) { + for (const FX_CHAR* lpsz = lpszFormat; *lpsz != 0; lpsz ++) { if (*lpsz != '%' || *(lpsz = lpsz + 1) == '%') { nMaxLen += FXSYS_strlen(lpsz); continue; @@ -579,7 +579,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList) va_arg(argList, int); break; case 's': { - FX_LPCSTR pstrNextArg = va_arg(argList, FX_LPCSTR); + const FX_CHAR* pstrNextArg = va_arg(argList, const FX_CHAR*); if (pstrNextArg == NULL) { nItemLen = 6; } else { @@ -591,7 +591,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList) } break; case 'S': { - FX_LPWSTR pstrNextArg = va_arg(argList, FX_LPWSTR); + FX_WCHAR* pstrNextArg = va_arg(argList, FX_WCHAR*); if (pstrNextArg == NULL) { nItemLen = 6; } else { @@ -604,7 +604,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList) break; case 's'|FORCE_ANSI: case 'S'|FORCE_ANSI: { - FX_LPCSTR pstrNextArg = va_arg(argList, FX_LPCSTR); + const FX_CHAR* pstrNextArg = va_arg(argList, const FX_CHAR*); if (pstrNextArg == NULL) { nItemLen = 6; } else { @@ -617,7 +617,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList) break; case 's'|FORCE_UNICODE: case 'S'|FORCE_UNICODE: { - FX_LPWSTR pstrNextArg = va_arg(argList, FX_LPWSTR); + FX_WCHAR* pstrNextArg = va_arg(argList, FX_WCHAR*); if (pstrNextArg == NULL) { nItemLen = 6; } else { @@ -700,7 +700,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList) } va_end(argListSave); } -void CFX_ByteString::Format(FX_LPCSTR lpszFormat, ...) +void CFX_ByteString::Format(const FX_CHAR* lpszFormat, ...) { va_list argList; va_start(argList, lpszFormat); @@ -720,7 +720,7 @@ FX_STRSIZE CFX_ByteString::Insert(FX_STRSIZE nIndex, FX_CHAR ch) nNewLength++; if (m_pData == NULL || m_pData->m_nAllocLength < nNewLength) { StringData* pOldData = m_pData; - FX_LPCSTR pstr = m_pData->m_String; + const FX_CHAR* pstr = m_pData->m_String; m_pData = StringData::Create(nNewLength); if (!m_pData) { return 0; @@ -777,7 +777,7 @@ FX_STRSIZE CFX_ByteString::Find(FX_CHAR ch, FX_STRSIZE nStart) const if (nStart >= nLength) { return -1; } - FX_LPCSTR lpsz = FXSYS_strchr(m_pData->m_String + nStart, ch); + const FX_CHAR* lpsz = FXSYS_strchr(m_pData->m_String + nStart, ch); return (lpsz == NULL) ? -1 : (int)(lpsz - m_pData->m_String); } FX_STRSIZE CFX_ByteString::ReverseFind(FX_CHAR ch) const @@ -794,12 +794,12 @@ FX_STRSIZE CFX_ByteString::ReverseFind(FX_CHAR ch) const } return -1; } -FX_LPCSTR FX_strstr(FX_LPCSTR str1, int len1, FX_LPCSTR str2, int len2) +const FX_CHAR* FX_strstr(const FX_CHAR* str1, int len1, const FX_CHAR* str2, int len2) { if (len2 > len1 || len2 == 0) { return NULL; } - FX_LPCSTR end_ptr = str1 + len1 - len2; + const FX_CHAR* end_ptr = str1 + len1 - len2; while (str1 <= end_ptr) { int i = 0; while (1) { @@ -824,7 +824,7 @@ FX_STRSIZE CFX_ByteString::Find(FX_BSTR lpszSub, FX_STRSIZE nStart) const if (nStart > nLength) { return -1; } - FX_LPCSTR lpsz = FX_strstr(m_pData->m_String + nStart, m_pData->m_nDataLength - nStart, + const FX_CHAR* lpsz = FX_strstr(m_pData->m_String + nStart, m_pData->m_nDataLength - nStart, lpszSub.GetCStr(), lpszSub.GetLength()); return (lpsz == NULL) ? -1 : (int)(lpsz - m_pData->m_String); } @@ -859,9 +859,9 @@ FX_STRSIZE CFX_ByteString::Remove(FX_CHAR chRemove) if (GetLength() < 1) { return 0; } - FX_LPSTR pstrSource = m_pData->m_String; - FX_LPSTR pstrDest = m_pData->m_String; - FX_LPSTR pstrEnd = m_pData->m_String + m_pData->m_nDataLength; + FX_CHAR* pstrSource = m_pData->m_String; + FX_CHAR* pstrDest = m_pData->m_String; + FX_CHAR* pstrEnd = m_pData->m_String + m_pData->m_nDataLength; while (pstrSource < pstrEnd) { if (*pstrSource != chRemove) { *pstrDest = *pstrSource; @@ -885,10 +885,10 @@ FX_STRSIZE CFX_ByteString::Replace(FX_BSTR lpszOld, FX_BSTR lpszNew) FX_STRSIZE nSourceLen = lpszOld.GetLength(); FX_STRSIZE nReplacementLen = lpszNew.GetLength(); FX_STRSIZE nCount = 0; - FX_LPCSTR pStart = m_pData->m_String; - FX_LPSTR pEnd = m_pData->m_String + m_pData->m_nDataLength; + const FX_CHAR* pStart = m_pData->m_String; + FX_CHAR* pEnd = m_pData->m_String + m_pData->m_nDataLength; while (1) { - FX_LPCSTR pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart), lpszOld.GetCStr(), nSourceLen); + const FX_CHAR* pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart), lpszOld.GetCStr(), nSourceLen); if (pTarget == NULL) { break; } @@ -908,9 +908,9 @@ FX_STRSIZE CFX_ByteString::Replace(FX_BSTR lpszOld, FX_BSTR lpszNew) return 0; } pStart = m_pData->m_String; - FX_LPSTR pDest = pNewData->m_String; + FX_CHAR* pDest = pNewData->m_String; for (FX_STRSIZE i = 0; i < nCount; i ++) { - FX_LPCSTR pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart), lpszOld.GetCStr(), nSourceLen); + const FX_CHAR* pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart), lpszOld.GetCStr(), nSourceLen); FXSYS_memcpy32(pDest, pStart, pTarget - pStart); pDest += pTarget - pStart; FXSYS_memcpy32(pDest, lpszNew.GetCStr(), lpszNew.GetLength()); @@ -940,7 +940,7 @@ CFX_WideString CFX_ByteString::UTF8Decode() const } return decoder.GetResult(); } -CFX_ByteString CFX_ByteString::FromUnicode(FX_LPCWSTR str, FX_STRSIZE len) +CFX_ByteString CFX_ByteString::FromUnicode(const FX_WCHAR* str, FX_STRSIZE len) { if (len < 0) { len = FXSYS_wcslen(str); @@ -1078,7 +1078,7 @@ FX_DWORD CFX_ByteStringC::GetID(FX_STRSIZE start_pos) const } return strid; } -FX_STRSIZE FX_ftoa(FX_FLOAT d, FX_LPSTR buf) +FX_STRSIZE FX_ftoa(FX_FLOAT d, FX_CHAR* buf) { buf[0] = '0'; buf[1] = '\0'; diff --git a/core/src/fxcrt/fx_basic_bstring_unittest.cpp b/core/src/fxcrt/fx_basic_bstring_unittest.cpp index bcdd33b8b8..9d8f376544 100644 --- a/core/src/fxcrt/fx_basic_bstring_unittest.cpp +++ b/core/src/fxcrt/fx_basic_bstring_unittest.cpp @@ -278,7 +278,7 @@ TEST(fxcrt, ByteStringCNull) { EXPECT_EQ(null_string, assigned_null_string); CFX_ByteStringC assigned_nullptr_string("initially not NULL"); - assigned_nullptr_string = (FX_LPCSTR)nullptr; + assigned_nullptr_string = (const FX_CHAR*)nullptr; EXPECT_EQ(assigned_nullptr_string.GetPtr(), nullptr); EXPECT_EQ(assigned_nullptr_string.GetLength(), 0); EXPECT_TRUE(assigned_nullptr_string.IsEmpty()); diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp index 7d45a43128..f56c4299cc 100644 --- a/core/src/fxcrt/fx_basic_buffer.cpp +++ b/core/src/fxcrt/fx_basic_buffer.cpp @@ -5,7 +5,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/fxcrt/fx_basic.h" -FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_LPSTR buf); +FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); CFX_BinaryBuf::CFX_BinaryBuf() : m_AllocStep(0) , m_pBuffer(NULL) @@ -50,7 +50,7 @@ void CFX_BinaryBuf::AttachData(void* buffer, FX_STRSIZE size) FX_Free(m_pBuffer); } m_DataSize = size; - m_pBuffer = (FX_LPBYTE)buffer; + m_pBuffer = (uint8_t*)buffer; m_AllocSize = size; } void CFX_BinaryBuf::TakeOver(CFX_BinaryBuf& other) @@ -82,7 +82,7 @@ void CFX_BinaryBuf::ExpandBuf(FX_STRSIZE add_size) alloc_step = m_AllocStep; } new_size = (new_size + alloc_step - 1) / alloc_step * alloc_step; - FX_LPBYTE pNewBuffer = m_pBuffer; + uint8_t* pNewBuffer = m_pBuffer; if (pNewBuffer) { pNewBuffer = FX_Realloc(uint8_t, m_pBuffer, new_size); } else { @@ -202,7 +202,7 @@ CFX_WideTextBuf& CFX_WideTextBuf::operator << (int i) ExpandBuf(len * sizeof(FX_WCHAR)); } ASSERT(m_pBuffer != NULL); - FX_LPWSTR str = (FX_WCHAR*)(m_pBuffer + m_DataSize); + FX_WCHAR* str = (FX_WCHAR*)(m_pBuffer + m_DataSize); for (FX_STRSIZE j = 0; j < len; j ++) { *str ++ = buf[j]; } @@ -217,14 +217,14 @@ CFX_WideTextBuf& CFX_WideTextBuf::operator << (double f) ExpandBuf(len * sizeof(FX_WCHAR)); } ASSERT(m_pBuffer != NULL); - FX_LPWSTR str = (FX_WCHAR*)(m_pBuffer + m_DataSize); + FX_WCHAR* str = (FX_WCHAR*)(m_pBuffer + m_DataSize); for (FX_STRSIZE i = 0; i < len; i ++) { *str ++ = buf[i]; } m_DataSize += len * sizeof(FX_WCHAR); return *this; } -CFX_WideTextBuf& CFX_WideTextBuf::operator << (FX_LPCWSTR lpsz) +CFX_WideTextBuf& CFX_WideTextBuf::operator << (const FX_WCHAR* lpsz) { AppendBlock(lpsz, FXSYS_wcslen(lpsz)*sizeof(FX_WCHAR)); return *this; @@ -240,7 +240,7 @@ void CFX_WideTextBuf::operator =(FX_WSTR str) } CFX_WideStringC CFX_WideTextBuf::GetWideString() const { - return CFX_WideStringC((FX_LPCWSTR)m_pBuffer, m_DataSize / sizeof(FX_WCHAR)); + return CFX_WideStringC((const FX_WCHAR*)m_pBuffer, m_DataSize / sizeof(FX_WCHAR)); } CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (uint8_t i) { @@ -290,7 +290,7 @@ CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (FX_BSTR bstr) } return *this; } -CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (FX_LPCWSTR wstr) +CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (const FX_WCHAR* wstr) { FX_STRSIZE len = FXSYS_wcslen(wstr); if (m_pStream) { @@ -315,7 +315,7 @@ void CFX_ArchiveSaver::Write(const void* pData, FX_STRSIZE dwSize) m_SavingBuf.AppendBlock(pData, dwSize); } } -CFX_ArchiveLoader::CFX_ArchiveLoader(FX_LPCBYTE pData, FX_DWORD dwSize) +CFX_ArchiveLoader::CFX_ArchiveLoader(const uint8_t* pData, FX_DWORD dwSize) { m_pLoadingBuf = pData; m_LoadingPos = 0; @@ -359,7 +359,7 @@ CFX_ArchiveLoader& CFX_ArchiveLoader::operator >> (CFX_ByteString& str) if (len <= 0 || m_LoadingPos + len > m_LoadingSize) { return *this; } - FX_LPSTR buffer = str.GetBuffer(len); + FX_CHAR* buffer = str.GetBuffer(len); FXSYS_memcpy32(buffer, m_pLoadingBuf + m_LoadingPos, len); str.ReleaseBuffer(len); m_LoadingPos += len; @@ -381,7 +381,7 @@ FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize) m_LoadingPos += dwSize; return TRUE; } -void CFX_BitStream::Init(FX_LPCBYTE pData, FX_DWORD dwSize) +void CFX_BitStream::Init(const uint8_t* pData, FX_DWORD dwSize) { m_pData = pData; m_BitSize = dwSize * 8; @@ -455,7 +455,7 @@ int32_t IFX_BufferArchive::AppendBlock(const void* pBuf, size_t size) if (!m_pBuffer) { m_pBuffer = FX_Alloc(uint8_t, m_BufSize); } - FX_LPBYTE buffer = (FX_LPBYTE)pBuf; + uint8_t* buffer = (uint8_t*)pBuf; FX_STRSIZE temp_size = (FX_STRSIZE)size; while (temp_size > 0) { FX_STRSIZE buf_size = FX_MIN(m_BufSize - m_Length, (FX_STRSIZE)temp_size); @@ -516,7 +516,7 @@ FX_BOOL CFX_FileBufferArchive::AttachFile(IFX_StreamWrite *pFile, FX_BOOL bTakeo m_bTakeover = bTakeover; return TRUE; } -FX_BOOL CFX_FileBufferArchive::AttachFile(FX_LPCWSTR filename) +FX_BOOL CFX_FileBufferArchive::AttachFile(const FX_WCHAR* filename) { if (!filename) { return FALSE; @@ -531,7 +531,7 @@ FX_BOOL CFX_FileBufferArchive::AttachFile(FX_LPCWSTR filename) m_bTakeover = TRUE; return TRUE; } -FX_BOOL CFX_FileBufferArchive::AttachFile(FX_LPCSTR filename) +FX_BOOL CFX_FileBufferArchive::AttachFile(const FX_CHAR* filename) { if (!filename) { return FALSE; diff --git a/core/src/fxcrt/fx_basic_gcc.cpp b/core/src/fxcrt/fx_basic_gcc.cpp index caa99926a6..02a336af75 100644 --- a/core/src/fxcrt/fx_basic_gcc.cpp +++ b/core/src/fxcrt/fx_basic_gcc.cpp @@ -58,29 +58,29 @@ STR_T FXSYS_IntToStr(T value, STR_T string, int radix) #ifdef __cplusplus extern "C" { #endif -int32_t FXSYS_atoi(FX_LPCSTR str) +int32_t FXSYS_atoi(const FX_CHAR* str) { - return FXSYS_StrToInt<int32_t, FX_LPCSTR>(str); + return FXSYS_StrToInt<int32_t, const FX_CHAR*>(str); } -int32_t FXSYS_wtoi(FX_LPCWSTR str) +int32_t FXSYS_wtoi(const FX_WCHAR* str) { - return FXSYS_StrToInt<int32_t, FX_LPCWSTR>(str); + return FXSYS_StrToInt<int32_t, const FX_WCHAR*>(str); } -int64_t FXSYS_atoi64(FX_LPCSTR str) +int64_t FXSYS_atoi64(const FX_CHAR* str) { - return FXSYS_StrToInt<int64_t, FX_LPCSTR>(str); + return FXSYS_StrToInt<int64_t, const FX_CHAR*>(str); } -int64_t FXSYS_wtoi64(FX_LPCWSTR str) +int64_t FXSYS_wtoi64(const FX_WCHAR* str) { - return FXSYS_StrToInt<int64_t, FX_LPCWSTR>(str); + return FXSYS_StrToInt<int64_t, const FX_WCHAR*>(str); } -FX_LPCSTR FXSYS_i64toa(int64_t value, FX_LPSTR str, int radix) +const FX_CHAR* FXSYS_i64toa(int64_t value, FX_CHAR* str, int radix) { - return FXSYS_IntToStr<int64_t, FX_LPSTR>(value, str, radix); + return FXSYS_IntToStr<int64_t, FX_CHAR*>(value, str, radix); } -FX_LPCWSTR FXSYS_i64tow(int64_t value, FX_LPWSTR str, int radix) +const FX_WCHAR* FXSYS_i64tow(int64_t value, FX_WCHAR* str, int radix) { - return FXSYS_IntToStr<int64_t, FX_LPWSTR>(value, str, radix); + return FXSYS_IntToStr<int64_t, FX_WCHAR*>(value, str, radix); } #ifdef __cplusplus } @@ -93,7 +93,7 @@ int FXSYS_GetACP() { return 0; } -FX_DWORD FXSYS_GetFullPathName(FX_LPCSTR filename, FX_DWORD buflen, FX_LPSTR buf, FX_LPSTR* filepart) +FX_DWORD FXSYS_GetFullPathName(const FX_CHAR* filename, FX_DWORD buflen, FX_CHAR* buf, FX_CHAR** filepart) { int srclen = FXSYS_strlen(filename); if (buf == NULL || (int)buflen < srclen + 1) { @@ -102,7 +102,7 @@ FX_DWORD FXSYS_GetFullPathName(FX_LPCSTR filename, FX_DWORD buflen, FX_LPSTR buf FXSYS_strcpy(buf, filename); return srclen; } -FX_DWORD FXSYS_GetModuleFileName(FX_LPVOID hModule, char* buf, FX_DWORD bufsize) +FX_DWORD FXSYS_GetModuleFileName(void* hModule, char* buf, FX_DWORD bufsize) { return (FX_DWORD) - 1; } @@ -114,7 +114,7 @@ FX_DWORD FXSYS_GetModuleFileName(FX_LPVOID hModule, char* buf, FX_DWORD bufsize) #ifdef __cplusplus extern "C" { #endif -FXSYS_FILE* FXSYS_wfopen(FX_LPCWSTR filename, FX_LPCWSTR mode) +FXSYS_FILE* FXSYS_wfopen(const FX_WCHAR* filename, const FX_WCHAR* mode) { return FXSYS_fopen(CFX_ByteString::FromUnicode(filename), CFX_ByteString::FromUnicode(mode)); } @@ -194,7 +194,7 @@ int FXSYS_wcsicmp(const FX_WCHAR *dst, const FX_WCHAR *src) } char* FXSYS_itoa(int value, char* string, int radix) { - return FXSYS_IntToStr<int32_t, FX_LPSTR>(value, string, radix); + return FXSYS_IntToStr<int32_t, FX_CHAR*>(value, string, radix); } #ifdef __cplusplus } @@ -204,8 +204,8 @@ char* FXSYS_itoa(int value, char* string, int radix) #ifdef __cplusplus extern "C" { #endif -int FXSYS_WideCharToMultiByte(FX_DWORD codepage, FX_DWORD dwFlags, FX_LPCWSTR wstr, int wlen, - FX_LPSTR buf, int buflen, FX_LPCSTR default_str, FX_BOOL* pUseDefault) +int FXSYS_WideCharToMultiByte(FX_DWORD codepage, FX_DWORD dwFlags, const FX_WCHAR* wstr, int wlen, + FX_CHAR* buf, int buflen, const FX_CHAR* default_str, FX_BOOL* pUseDefault) { int len = 0; for (int i = 0; i < wlen; i ++) { @@ -218,8 +218,8 @@ int FXSYS_WideCharToMultiByte(FX_DWORD codepage, FX_DWORD dwFlags, FX_LPCWSTR ws } return len; } -int FXSYS_MultiByteToWideChar(FX_DWORD codepage, FX_DWORD dwFlags, FX_LPCSTR bstr, int blen, - FX_LPWSTR buf, int buflen) +int FXSYS_MultiByteToWideChar(FX_DWORD codepage, FX_DWORD dwFlags, const FX_CHAR* bstr, int blen, + FX_WCHAR* buf, int buflen) { int wlen = 0; for (int i = 0; i < blen; i ++) { diff --git a/core/src/fxcrt/fx_basic_maps.cpp b/core/src/fxcrt/fx_basic_maps.cpp index c0c394583e..7df4cdb8ed 100644 --- a/core/src/fxcrt/fx_basic_maps.cpp +++ b/core/src/fxcrt/fx_basic_maps.cpp @@ -238,7 +238,7 @@ void CFX_MapByteStringToPtr::GetNextAssoc(FX_POSITION& rNextPosition, rKey = pAssocRet->key; rValue = pAssocRet->value; } -FX_LPVOID CFX_MapByteStringToPtr::GetNextValue(FX_POSITION& rNextPosition) const +void* CFX_MapByteStringToPtr::GetNextValue(FX_POSITION& rNextPosition) const { ASSERT(m_pHashTable != NULL); CAssoc* pAssocRet = (CAssoc*)rNextPosition; @@ -352,7 +352,7 @@ inline FX_DWORD CFX_MapByteStringToPtr::HashKey(FX_BSTR key) const { FX_DWORD nHash = 0; int len = key.GetLength(); - FX_LPCBYTE buf = key.GetPtr(); + const uint8_t* buf = key.GetPtr(); for (int i = 0; i < len; i ++) { nHash = (nHash << 5) + nHash + buf[i]; } @@ -381,7 +381,7 @@ struct _CompactString { uint8_t m_LenHigh; uint8_t m_LenLow; uint8_t m_Unused; - FX_LPBYTE m_pBuffer; + uint8_t* m_pBuffer; }; static void _CompactStringRelease(_CompactString* pCompact) { @@ -389,7 +389,7 @@ static void _CompactStringRelease(_CompactString* pCompact) FX_Free(pCompact->m_pBuffer); } } -static FX_BOOL _CompactStringSame(_CompactString* pCompact, FX_LPCBYTE pStr, int len) +static FX_BOOL _CompactStringSame(_CompactString* pCompact, const uint8_t* pStr, int len) { if (len < sizeof(_CompactString)) { if (pCompact->m_CompactLen != len) { @@ -402,7 +402,7 @@ static FX_BOOL _CompactStringSame(_CompactString* pCompact, FX_LPCBYTE pStr, int } return FXSYS_memcmp32(pCompact->m_pBuffer, pStr, len) == 0; } -static void _CompactStringStore(_CompactString* pCompact, FX_LPCBYTE pStr, int len) +static void _CompactStringStore(_CompactString* pCompact, const uint8_t* pStr, int len) { if (len < (int)sizeof(_CompactString)) { pCompact->m_CompactLen = (uint8_t)len; @@ -475,14 +475,14 @@ void CFX_CMapByteStringToPtr::GetNextAssoc(FX_POSITION& rNextPosition, CFX_ByteS } rNextPosition = NULL; } -FX_LPVOID CFX_CMapByteStringToPtr::GetNextValue(FX_POSITION& rNextPosition) const +void* CFX_CMapByteStringToPtr::GetNextValue(FX_POSITION& rNextPosition) const { if (rNextPosition == NULL) { return NULL; } int index = (int)(uintptr_t)rNextPosition - 1; _CompactString* pKey = (_CompactString*)m_Buffer.GetAt(index); - FX_LPVOID rValue = *(void**)(pKey + 1); + void* rValue = *(void**)(pKey + 1); index ++; int size = m_Buffer.GetSize(); while (index < size) { @@ -580,7 +580,7 @@ struct _DWordPair { }; FX_BOOL CFX_CMapDWordToDWord::Lookup(FX_DWORD key, FX_DWORD& value) const { - FX_LPVOID pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(), m_Buffer.GetSize() / sizeof(_DWordPair), + void* pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(), m_Buffer.GetSize() / sizeof(_DWordPair), sizeof(_DWordPair), _CompareDWord); if (pResult == NULL) { return FALSE; diff --git a/core/src/fxcrt/fx_basic_memmgr.cpp b/core/src/fxcrt/fx_basic_memmgr.cpp index a381fa4ef5..2ae9075f04 100644 --- a/core/src/fxcrt/fx_basic_memmgr.cpp +++ b/core/src/fxcrt/fx_basic_memmgr.cpp @@ -56,7 +56,7 @@ void* CFX_GrowOnlyPool::Alloc(size_t size) _FX_GrowOnlyTrunk* pTrunk = (_FX_GrowOnlyTrunk*)m_pFirstTrunk; while (pTrunk) { if (pTrunk->m_Size - pTrunk->m_Allocated >= size) { - void* p = (FX_LPBYTE)(pTrunk + 1) + pTrunk->m_Allocated; + void* p = (uint8_t*)(pTrunk + 1) + pTrunk->m_Allocated; pTrunk->m_Allocated += size; return p; } diff --git a/core/src/fxcrt/fx_basic_utf.cpp b/core/src/fxcrt/fx_basic_utf.cpp index 1422b7abd4..5413ead0d5 100644 --- a/core/src/fxcrt/fx_basic_utf.cpp +++ b/core/src/fxcrt/fx_basic_utf.cpp @@ -76,7 +76,7 @@ void CFX_UTF8Encoder::Input(FX_WCHAR unicode) } } } -CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len) +CFX_ByteString FX_UTF8Encode(const FX_WCHAR* pwsStr, FX_STRSIZE len) { FXSYS_assert(pwsStr != NULL); if (len < 0) { diff --git a/core/src/fxcrt/fx_basic_util.cpp b/core/src/fxcrt/fx_basic_util.cpp index 4ccb93ccbb..db1a5b4b2a 100644 --- a/core/src/fxcrt/fx_basic_util.cpp +++ b/core/src/fxcrt/fx_basic_util.cpp @@ -26,7 +26,7 @@ void FX_PRIVATEDATA::FreeData() m_pCallback(m_pData); } } -void CFX_PrivateData::AddData(FX_LPVOID pModuleId, FX_LPVOID pData, PD_CALLBACK_FREEDATA callback, FX_BOOL bSelfDestruct) +void CFX_PrivateData::AddData(void* pModuleId, void* pData, PD_CALLBACK_FREEDATA callback, FX_BOOL bSelfDestruct) { if (pModuleId == NULL) { return; @@ -44,15 +44,15 @@ void CFX_PrivateData::AddData(FX_LPVOID pModuleId, FX_LPVOID pData, PD_CALLBACK_ FX_PRIVATEDATA data = {pModuleId, pData, callback, bSelfDestruct}; m_DataList.Add(data); } -void CFX_PrivateData::SetPrivateData(FX_LPVOID pModuleId, FX_LPVOID pData, PD_CALLBACK_FREEDATA callback) +void CFX_PrivateData::SetPrivateData(void* pModuleId, void* pData, PD_CALLBACK_FREEDATA callback) { AddData(pModuleId, pData, callback, FALSE); } -void CFX_PrivateData::SetPrivateObj(FX_LPVOID pModuleId, CFX_DestructObject* pObj) +void CFX_PrivateData::SetPrivateObj(void* pModuleId, CFX_DestructObject* pObj) { AddData(pModuleId, pObj, NULL, TRUE); } -FX_BOOL CFX_PrivateData::RemovePrivateData(FX_LPVOID pModuleId) +FX_BOOL CFX_PrivateData::RemovePrivateData(void* pModuleId) { if (pModuleId == NULL) { return FALSE; @@ -67,7 +67,7 @@ FX_BOOL CFX_PrivateData::RemovePrivateData(FX_LPVOID pModuleId) } return FALSE; } -FX_LPVOID CFX_PrivateData::GetPrivateData(FX_LPVOID pModuleId) +void* CFX_PrivateData::GetPrivateData(void* pModuleId) { if (pModuleId == NULL) { return NULL; @@ -95,7 +95,7 @@ void FX_atonum(FX_BSTR strc, FX_BOOL& bInteger, void* pData) if (FXSYS_memchr(strc.GetPtr(), '.', strc.GetLength()) == NULL) { bInteger = TRUE; int cc = 0, integer = 0; - FX_LPCSTR str = strc.GetCStr(); + const FX_CHAR* str = strc.GetCStr(); int len = strc.GetLength(); FX_BOOL bNegative = FALSE; if (str[0] == '+') { @@ -130,7 +130,7 @@ FX_FLOAT FX_atof(FX_BSTR strc) } int cc = 0; FX_BOOL bNegative = FALSE; - FX_LPCSTR str = strc.GetCStr(); + const FX_CHAR* str = strc.GetCStr(); int len = strc.GetLength(); if (str[0] == '+') { cc++; @@ -314,7 +314,7 @@ public: WIN32_FIND_DATAW m_FindData; }; #endif -void* FX_OpenFolder(FX_LPCSTR path) +void* FX_OpenFolder(const FX_CHAR* path) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ #ifndef _WIN32_WCE @@ -339,7 +339,7 @@ void* FX_OpenFolder(FX_LPCSTR path) return dir; #endif } -void* FX_OpenFolder(FX_LPCWSTR path) +void* FX_OpenFolder(const FX_WCHAR* path) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ CFindFileDataW* pData = new CFindFileDataW; diff --git a/core/src/fxcrt/fx_basic_wstring.cpp b/core/src/fxcrt/fx_basic_wstring.cpp index aeb366338e..1108a3ca52 100644 --- a/core/src/fxcrt/fx_basic_wstring.cpp +++ b/core/src/fxcrt/fx_basic_wstring.cpp @@ -56,7 +56,7 @@ CFX_WideString::CFX_WideString(const CFX_WideString& stringSrc) *this = stringSrc; } } -CFX_WideString::CFX_WideString(FX_LPCWSTR lpsz, FX_STRSIZE nLen) { +CFX_WideString::CFX_WideString(const FX_WCHAR* lpsz, FX_STRSIZE nLen) { if (nLen < 0) { nLen = lpsz ? FXSYS_wcslen(lpsz) : 0; } @@ -117,7 +117,7 @@ void CFX_WideString::ReleaseBuffer(FX_STRSIZE nNewLength) m_pData->m_nDataLength = nNewLength; m_pData->m_String[nNewLength] = 0; } -const CFX_WideString& CFX_WideString::operator=(FX_LPCWSTR lpsz) +const CFX_WideString& CFX_WideString::operator=(const FX_WCHAR* lpsz) { if (lpsz == NULL || lpsz[0] == 0) { Empty(); @@ -159,7 +159,7 @@ const CFX_WideString& CFX_WideString::operator+=(FX_WCHAR ch) ConcatInPlace(1, &ch); return *this; } -const CFX_WideString& CFX_WideString::operator+=(FX_LPCWSTR lpsz) +const CFX_WideString& CFX_WideString::operator+=(const FX_WCHAR* lpsz) { if (lpsz) { ConcatInPlace(FXSYS_wcslen(lpsz), lpsz); @@ -221,7 +221,7 @@ void CFX_WideString::Empty() m_pData = NULL; } } -void CFX_WideString::ConcatInPlace(FX_STRSIZE nSrcLen, FX_LPCWSTR lpszSrcData) +void CFX_WideString::ConcatInPlace(FX_STRSIZE nSrcLen, const FX_WCHAR* lpszSrcData) { if (nSrcLen == 0 || lpszSrcData == NULL) { return; @@ -241,8 +241,8 @@ void CFX_WideString::ConcatInPlace(FX_STRSIZE nSrcLen, FX_LPCWSTR lpszSrcData) m_pData->m_String[m_pData->m_nDataLength] = 0; } } -void CFX_WideString::ConcatCopy(FX_STRSIZE nSrc1Len, FX_LPCWSTR lpszSrc1Data, - FX_STRSIZE nSrc2Len, FX_LPCWSTR lpszSrc2Data) +void CFX_WideString::ConcatCopy(FX_STRSIZE nSrc1Len, const FX_WCHAR* lpszSrc1Data, + FX_STRSIZE nSrc2Len, const FX_WCHAR* lpszSrc2Data) { FX_STRSIZE nNewLen = nSrc1Len + nSrc2Len; if (nNewLen <= 0) { @@ -278,14 +278,14 @@ void CFX_WideString::AllocBeforeWrite(FX_STRSIZE nLen) Empty(); m_pData = StringData::Create(nLen); } -void CFX_WideString::AssignCopy(FX_STRSIZE nSrcLen, FX_LPCWSTR lpszSrcData) +void CFX_WideString::AssignCopy(FX_STRSIZE nSrcLen, const FX_WCHAR* lpszSrcData) { AllocBeforeWrite(nSrcLen); FXSYS_memcpy32(m_pData->m_String, lpszSrcData, nSrcLen * sizeof(FX_WCHAR)); m_pData->m_nDataLength = nSrcLen; m_pData->m_String[nSrcLen] = 0; } -int CFX_WideString::Compare(FX_LPCWSTR lpsz) const +int CFX_WideString::Compare(const FX_WCHAR* lpsz) const { if (m_pData == NULL) { return (lpsz == NULL || lpsz[0] == 0) ? 0 : -1; @@ -303,7 +303,7 @@ CFX_ByteString CFX_WideString::UTF16LE_Encode() const } int len = m_pData->m_nDataLength; CFX_ByteString result; - FX_LPSTR buffer = result.GetBuffer(len * 2 + 2); + FX_CHAR* buffer = result.GetBuffer(len * 2 + 2); for (int i = 0; i < len; i ++) { buffer[i * 2] = m_pData->m_String[i] & 0xff; buffer[i * 2 + 1] = m_pData->m_String[i] >> 8; @@ -325,7 +325,7 @@ void CFX_WideString::Reserve(FX_STRSIZE len) GetBuffer(len); ReleaseBuffer(GetLength()); } -FX_LPWSTR CFX_WideString::GetBuffer(FX_STRSIZE nMinBufLength) +FX_WCHAR* CFX_WideString::GetBuffer(FX_STRSIZE nMinBufLength) { if (m_pData == NULL && nMinBufLength == 0) { return NULL; @@ -471,7 +471,7 @@ CFX_WideString CFX_WideString::Right(FX_STRSIZE nCount) const AllocCopy(dest, nCount, m_pData->m_nDataLength - nCount); return dest; } -int CFX_WideString::CompareNoCase(FX_LPCWSTR lpsz) const +int CFX_WideString::CompareNoCase(const FX_WCHAR* lpsz) const { if (m_pData == NULL) { return (lpsz == NULL || lpsz[0] == 0) ? 0 : -1; @@ -537,13 +537,13 @@ void CFX_WideString::MakeUpper() } FXSYS_wcsupr(m_pData->m_String); } -FX_STRSIZE CFX_WideString::Find(FX_LPCWSTR lpszSub, FX_STRSIZE nStart) const +FX_STRSIZE CFX_WideString::Find(const FX_WCHAR* lpszSub, FX_STRSIZE nStart) const { FX_STRSIZE nLength = GetLength(); if (nLength < 1 || nStart > nLength) { return -1; } - FX_LPCWSTR lpsz = FXSYS_wcsstr(m_pData->m_String + nStart, lpszSub); + const FX_WCHAR* lpsz = FXSYS_wcsstr(m_pData->m_String + nStart, lpszSub); return (lpsz == NULL) ? -1 : (int)(lpsz - m_pData->m_String); } FX_STRSIZE CFX_WideString::Find(FX_WCHAR ch, FX_STRSIZE nStart) const @@ -555,10 +555,10 @@ FX_STRSIZE CFX_WideString::Find(FX_WCHAR ch, FX_STRSIZE nStart) const if (nStart >= nLength) { return -1; } - FX_LPCWSTR lpsz = FXSYS_wcschr(m_pData->m_String + nStart, ch); + const FX_WCHAR* lpsz = FXSYS_wcschr(m_pData->m_String + nStart, ch); return (lpsz == NULL) ? -1 : (int)(lpsz - m_pData->m_String); } -void CFX_WideString::TrimRight(FX_LPCWSTR lpszTargetList) +void CFX_WideString::TrimRight(const FX_WCHAR* lpszTargetList) { FXSYS_assert(lpszTargetList != NULL); if (m_pData == NULL || *lpszTargetList == 0) { @@ -590,7 +590,7 @@ void CFX_WideString::TrimRight() { TrimRight(L"\x09\x0a\x0b\x0c\x0d\x20"); } -void CFX_WideString::TrimLeft(FX_LPCWSTR lpszTargets) +void CFX_WideString::TrimLeft(const FX_WCHAR* lpszTargets) { FXSYS_assert(lpszTargets != NULL); if (m_pData == NULL || *lpszTargets == 0) { @@ -600,7 +600,7 @@ void CFX_WideString::TrimLeft(FX_LPCWSTR lpszTargets) if (GetLength() < 1) { return; } - FX_LPCWSTR lpsz = m_pData->m_String; + const FX_WCHAR* lpsz = m_pData->m_String; while (*lpsz != 0) { if (FXSYS_wcschr(lpszTargets, *lpsz) == NULL) { break; @@ -622,7 +622,7 @@ void CFX_WideString::TrimLeft() { TrimLeft(L"\x09\x0a\x0b\x0c\x0d\x20"); } -FX_STRSIZE CFX_WideString::Replace(FX_LPCWSTR lpszOld, FX_LPCWSTR lpszNew) +FX_STRSIZE CFX_WideString::Replace(const FX_WCHAR* lpszOld, const FX_WCHAR* lpszNew) { if (GetLength() < 1) { return 0; @@ -636,11 +636,11 @@ FX_STRSIZE CFX_WideString::Replace(FX_LPCWSTR lpszOld, FX_LPCWSTR lpszNew) } FX_STRSIZE nReplacementLen = lpszNew ? FXSYS_wcslen(lpszNew) : 0; FX_STRSIZE nCount = 0; - FX_LPWSTR lpszStart = m_pData->m_String; - FX_LPWSTR lpszEnd = m_pData->m_String + m_pData->m_nDataLength; - FX_LPWSTR lpszTarget; + FX_WCHAR* lpszStart = m_pData->m_String; + FX_WCHAR* lpszEnd = m_pData->m_String + m_pData->m_nDataLength; + FX_WCHAR* lpszTarget; { - while ((lpszTarget = (FX_LPWSTR)FXSYS_wcsstr(lpszStart, lpszOld)) != NULL && lpszStart < lpszEnd) { + while ((lpszTarget = (FX_WCHAR*)FXSYS_wcsstr(lpszStart, lpszOld)) != NULL && lpszStart < lpszEnd) { nCount++; lpszStart = lpszTarget + nSourceLen; } @@ -651,7 +651,7 @@ FX_STRSIZE CFX_WideString::Replace(FX_LPCWSTR lpszOld, FX_LPCWSTR lpszNew) FX_STRSIZE nNewLength = nOldLength + (nReplacementLen - nSourceLen) * nCount; if (m_pData->m_nAllocLength < nNewLength || m_pData->m_nRefs > 1) { StringData* pOldData = m_pData; - FX_LPCWSTR pstr = m_pData->m_String; + const FX_WCHAR* pstr = m_pData->m_String; m_pData = StringData::Create(nNewLength); if (!m_pData) { return 0; @@ -662,7 +662,7 @@ FX_STRSIZE CFX_WideString::Replace(FX_LPCWSTR lpszOld, FX_LPCWSTR lpszNew) lpszStart = m_pData->m_String; lpszEnd = m_pData->m_String + FX_MAX(m_pData->m_nDataLength, nNewLength); { - while ((lpszTarget = (FX_LPWSTR)FXSYS_wcsstr(lpszStart, lpszOld)) != NULL && lpszStart < lpszEnd) { + while ((lpszTarget = (FX_WCHAR*)FXSYS_wcsstr(lpszStart, lpszOld)) != NULL && lpszStart < lpszEnd) { FX_STRSIZE nBalance = nOldLength - (FX_STRSIZE)(lpszTarget - m_pData->m_String + nSourceLen); FXSYS_memmove32(lpszTarget + nReplacementLen, lpszTarget + nSourceLen, nBalance * sizeof(FX_WCHAR)); FXSYS_memcpy32(lpszTarget, lpszNew, nReplacementLen * sizeof(FX_WCHAR)); @@ -689,7 +689,7 @@ FX_STRSIZE CFX_WideString::Insert(FX_STRSIZE nIndex, FX_WCHAR ch) nNewLength++; if (m_pData == NULL || m_pData->m_nAllocLength < nNewLength) { StringData* pOldData = m_pData; - FX_LPCWSTR pstr = m_pData->m_String; + const FX_WCHAR* pstr = m_pData->m_String; m_pData = StringData::Create(nNewLength); if (!m_pData) { return 0; @@ -734,9 +734,9 @@ FX_STRSIZE CFX_WideString::Remove(FX_WCHAR chRemove) if (GetLength() < 1) { return 0; } - FX_LPWSTR pstrSource = m_pData->m_String; - FX_LPWSTR pstrDest = m_pData->m_String; - FX_LPWSTR pstrEnd = m_pData->m_String + m_pData->m_nDataLength; + FX_WCHAR* pstrSource = m_pData->m_String; + FX_WCHAR* pstrDest = m_pData->m_String; + FX_WCHAR* pstrEnd = m_pData->m_String + m_pData->m_nDataLength; while (pstrSource < pstrEnd) { if (*pstrSource != chRemove) { *pstrDest = *pstrSource; @@ -752,7 +752,7 @@ FX_STRSIZE CFX_WideString::Remove(FX_WCHAR chRemove) #define FORCE_ANSI 0x10000 #define FORCE_UNICODE 0x20000 #define FORCE_INT64 0x40000 -void CFX_WideString::FormatV(FX_LPCWSTR lpszFormat, va_list argList) +void CFX_WideString::FormatV(const FX_WCHAR* lpszFormat, va_list argList) { va_list argListSave; #if defined(__ARMCC_VERSION) || (!defined(_MSC_VER) && (_FX_CPU_ == _FX_X64_ || _FX_CPU_ == _FX_IA64_ || _FX_CPU_ == _FX_ARM64_)) || defined(__native_client__) @@ -761,7 +761,7 @@ void CFX_WideString::FormatV(FX_LPCWSTR lpszFormat, va_list argList) argListSave = argList; #endif int nMaxLen = 0; - for (FX_LPCWSTR lpsz = lpszFormat; *lpsz != 0; lpsz ++) { + for (const FX_WCHAR* lpsz = lpszFormat; *lpsz != 0; lpsz ++) { if (*lpsz != '%' || *(lpsz = lpsz + 1) == '%') { nMaxLen += FXSYS_wcslen(lpsz); continue; @@ -845,7 +845,7 @@ void CFX_WideString::FormatV(FX_LPCWSTR lpszFormat, va_list argList) va_arg(argList, int); break; case 's': { - FX_LPCWSTR pstrNextArg = va_arg(argList, FX_LPCWSTR); + const FX_WCHAR* pstrNextArg = va_arg(argList, const FX_WCHAR*); if (pstrNextArg == NULL) { nItemLen = 6; } else { @@ -857,7 +857,7 @@ void CFX_WideString::FormatV(FX_LPCWSTR lpszFormat, va_list argList) } break; case 'S': { - FX_LPCSTR pstrNextArg = va_arg(argList, FX_LPCSTR); + const FX_CHAR* pstrNextArg = va_arg(argList, const FX_CHAR*); if (pstrNextArg == NULL) { nItemLen = 6; } else { @@ -870,7 +870,7 @@ void CFX_WideString::FormatV(FX_LPCWSTR lpszFormat, va_list argList) break; case 's'|FORCE_ANSI: case 'S'|FORCE_ANSI: { - FX_LPCSTR pstrNextArg = va_arg(argList, FX_LPCSTR); + const FX_CHAR* pstrNextArg = va_arg(argList, const FX_CHAR*); if (pstrNextArg == NULL) { nItemLen = 6; } else { @@ -883,7 +883,7 @@ void CFX_WideString::FormatV(FX_LPCWSTR lpszFormat, va_list argList) break; case 's'|FORCE_UNICODE: case 'S'|FORCE_UNICODE: { - FX_LPWSTR pstrNextArg = va_arg(argList, FX_LPWSTR); + FX_WCHAR* pstrNextArg = va_arg(argList, FX_WCHAR*); if (pstrNextArg == NULL) { nItemLen = 6; } else { @@ -964,14 +964,14 @@ void CFX_WideString::FormatV(FX_LPCWSTR lpszFormat, va_list argList) } va_end(argListSave); } -void CFX_WideString::Format(FX_LPCWSTR lpszFormat, ...) +void CFX_WideString::Format(const FX_WCHAR* lpszFormat, ...) { va_list argList; va_start(argList, lpszFormat); FormatV(lpszFormat, argList); va_end(argList); } -FX_FLOAT FX_wtof(FX_LPCWSTR str, int len) +FX_FLOAT FX_wtof(const FX_WCHAR* str, int len) { if (len == 0) { return 0.0; @@ -1028,7 +1028,7 @@ static CFX_ByteString _DefMap_GetByteString(CFX_CharMap* pCharMap, const CFX_Wid return CFX_ByteString(); } CFX_ByteString bytestr; - FX_LPSTR dest_buf = bytestr.GetBuffer(dest_len); + FX_CHAR* dest_buf = bytestr.GetBuffer(dest_len); FXSYS_WideCharToMultiByte(codepage, 0, widestr.c_str(), src_len, dest_buf, dest_len, NULL, NULL); bytestr.ReleaseBuffer(dest_len); return bytestr; @@ -1042,7 +1042,7 @@ static CFX_WideString _DefMap_GetWideString(CFX_CharMap* pCharMap, const CFX_Byt return CFX_WideString(); } CFX_WideString widestr; - FX_LPWSTR dest_buf = widestr.GetBuffer(dest_len); + FX_WCHAR* dest_buf = widestr.GetBuffer(dest_len); FXSYS_MultiByteToWideChar(codepage, 0, bytestr, src_len, dest_buf, dest_len); widestr.ReleaseBuffer(dest_len); return widestr; diff --git a/core/src/fxcrt/fx_extension.cpp b/core/src/fxcrt/fx_extension.cpp index eeecc811c2..0ce98f87e4 100644 --- a/core/src/fxcrt/fx_extension.cpp +++ b/core/src/fxcrt/fx_extension.cpp @@ -80,7 +80,7 @@ FX_BOOL FX_File_Truncate(FX_HFILE hFile, FX_FILESIZE szFile) FXSYS_assert(hFile != NULL); return ((IFXCRT_FileAccess*)hFile)->Truncate(szFile); } -IFX_FileStream* FX_CreateFileStream(FX_LPCSTR filename, FX_DWORD dwModes) +IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, FX_DWORD dwModes) { IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create(); if (!pFA) { @@ -92,7 +92,7 @@ IFX_FileStream* FX_CreateFileStream(FX_LPCSTR filename, FX_DWORD dwModes) } return new CFX_CRTFileStream(pFA); } -IFX_FileStream* FX_CreateFileStream(FX_LPCWSTR filename, FX_DWORD dwModes) +IFX_FileStream* FX_CreateFileStream(const FX_WCHAR* filename, FX_DWORD dwModes) { IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create(); if (!pFA) { @@ -104,23 +104,23 @@ IFX_FileStream* FX_CreateFileStream(FX_LPCWSTR filename, FX_DWORD dwModes) } return new CFX_CRTFileStream(pFA); } -IFX_FileWrite* FX_CreateFileWrite(FX_LPCSTR filename) +IFX_FileWrite* FX_CreateFileWrite(const FX_CHAR* filename) { return FX_CreateFileStream(filename, FX_FILEMODE_Truncate); } -IFX_FileWrite* FX_CreateFileWrite(FX_LPCWSTR filename) +IFX_FileWrite* FX_CreateFileWrite(const FX_WCHAR* filename) { return FX_CreateFileStream(filename, FX_FILEMODE_Truncate); } -IFX_FileRead* FX_CreateFileRead(FX_LPCSTR filename) +IFX_FileRead* FX_CreateFileRead(const FX_CHAR* filename) { return FX_CreateFileStream(filename, FX_FILEMODE_ReadOnly); } -IFX_FileRead* FX_CreateFileRead(FX_LPCWSTR filename) +IFX_FileRead* FX_CreateFileRead(const FX_WCHAR* filename) { return FX_CreateFileStream(filename, FX_FILEMODE_ReadOnly); } -IFX_MemoryStream* FX_CreateMemoryStream(FX_LPBYTE pBuffer, size_t dwSize, FX_BOOL bTakeOver) +IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer, size_t dwSize, FX_BOOL bTakeOver) { return new CFX_MemoryStream(pBuffer, dwSize, bTakeOver); } @@ -139,7 +139,7 @@ FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x) { return FXSYS_log(x) / FXSYS_log(b); } -FX_FLOAT FXSYS_strtof(FX_LPCSTR pcsStr, int32_t iLength, int32_t *pUsedLen) +FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr, int32_t iLength, int32_t *pUsedLen) { FXSYS_assert(pcsStr != NULL); if (iLength < 0) { @@ -148,7 +148,7 @@ FX_FLOAT FXSYS_strtof(FX_LPCSTR pcsStr, int32_t iLength, int32_t *pUsedLen) CFX_WideString ws = CFX_WideString::FromLocal(pcsStr, iLength); return FXSYS_wcstof(ws.c_str(), iLength, pUsedLen); } -FX_FLOAT FXSYS_wcstof(FX_LPCWSTR pwsStr, int32_t iLength, int32_t *pUsedLen) +FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, int32_t iLength, int32_t *pUsedLen) { FXSYS_assert(pwsStr != NULL); if (iLength < 0) { @@ -193,7 +193,7 @@ FX_FLOAT FXSYS_wcstof(FX_LPCWSTR pwsStr, int32_t iLength, int32_t *pUsedLen) } return bNegtive ? -fValue : fValue; } -FX_LPWSTR FXSYS_wcsncpy(FX_LPWSTR dstStr, FX_LPCWSTR srcStr, size_t count) +FX_WCHAR* FXSYS_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) @@ -202,7 +202,7 @@ FX_LPWSTR FXSYS_wcsncpy(FX_LPWSTR dstStr, FX_LPCWSTR srcStr, size_t count) } return dstStr; } -int32_t FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count) +int32_t FXSYS_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; @@ -215,7 +215,7 @@ int32_t FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count) } return wch1 - wch2; } -int32_t FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count) +int32_t FXSYS_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; @@ -228,13 +228,13 @@ int32_t FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count) } return ch1 - ch2; } -FX_DWORD FX_HashCode_String_GetA(FX_LPCSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase) +FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase) { FXSYS_assert(pStr != NULL); if (iLength < 0) { iLength = (int32_t)FXSYS_strlen(pStr); } - FX_LPCSTR pStrEnd = pStr + iLength; + const FX_CHAR* pStrEnd = pStr + iLength; FX_DWORD dwHashCode = 0; if (bIgnoreCase) { while (pStr < pStrEnd) { @@ -247,13 +247,13 @@ FX_DWORD FX_HashCode_String_GetA(FX_LPCSTR pStr, int32_t iLength, FX_BOOL bIgnor } return dwHashCode; } -FX_DWORD FX_HashCode_String_GetW(FX_LPCWSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase) +FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase) { FXSYS_assert(pStr != NULL); if (iLength < 0) { iLength = (int32_t)FXSYS_wcslen(pStr); } - FX_LPCWSTR pStrEnd = pStr + iLength; + const FX_WCHAR* pStrEnd = pStr + iLength; FX_DWORD dwHashCode = 0; if (bIgnoreCase) { while (pStr < pStrEnd) { @@ -272,26 +272,26 @@ FX_DWORD FX_HashCode_String_GetW(FX_LPCWSTR pStr, int32_t iLength, FX_BOOL bIgno #ifdef __cplusplus extern "C" { #endif -FX_LPVOID FX_Random_MT_Start(FX_DWORD dwSeed) +void* FX_Random_MT_Start(FX_DWORD dwSeed) { FX_LPMTRANDOMCONTEXT pContext = FX_Alloc(FX_MTRANDOMCONTEXT, 1); pContext->mt[0] = dwSeed; FX_DWORD &i = pContext->mti; - FX_LPDWORD pBuf = pContext->mt; + FX_DWORD* pBuf = pContext->mt; for (i = 1; i < MT_N; i ++) { pBuf[i] = (1812433253UL * (pBuf[i - 1] ^ (pBuf[i - 1] >> 30)) + i); } pContext->bHaveSeed = TRUE; return pContext; } -FX_DWORD FX_Random_MT_Generate(FX_LPVOID pContext) +FX_DWORD FX_Random_MT_Generate(void* pContext) { FXSYS_assert(pContext != NULL); FX_LPMTRANDOMCONTEXT pMTC = (FX_LPMTRANDOMCONTEXT)pContext; FX_DWORD v; static FX_DWORD mag[2] = {0, MT_Matrix_A}; FX_DWORD &mti = pMTC->mti; - FX_LPDWORD pBuf = pMTC->mt; + FX_DWORD* pBuf = pMTC->mt; if ((int)mti < 0 || mti >= MT_N) { if (mti > MT_N && !pMTC->bHaveSeed) { return 0; @@ -316,12 +316,12 @@ FX_DWORD FX_Random_MT_Generate(FX_LPVOID pContext) v ^= (v >> 18); return v; } -void FX_Random_MT_Close(FX_LPVOID pContext) +void FX_Random_MT_Close(void* pContext) { FXSYS_assert(pContext != NULL); FX_Free(pContext); } -void FX_Random_GenerateMT(FX_LPDWORD pBuffer, int32_t iCount) +void FX_Random_GenerateMT(FX_DWORD* pBuffer, int32_t iCount) { FX_DWORD dwSeed; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ @@ -331,13 +331,13 @@ void FX_Random_GenerateMT(FX_LPDWORD pBuffer, int32_t iCount) #else FX_Random_GenerateBase(&dwSeed, 1); #endif - FX_LPVOID pContext = FX_Random_MT_Start(dwSeed); + void* pContext = FX_Random_MT_Start(dwSeed); while (iCount -- > 0) { *pBuffer ++ = FX_Random_MT_Generate(pContext); } FX_Random_MT_Close(pContext); } -void FX_Random_GenerateBase(FX_LPDWORD pBuffer, int32_t iCount) +void FX_Random_GenerateBase(FX_DWORD* pBuffer, int32_t iCount) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ SYSTEMTIME st1, st2; @@ -345,8 +345,8 @@ void FX_Random_GenerateBase(FX_LPDWORD pBuffer, int32_t iCount) do { ::GetSystemTime(&st2); } while (FXSYS_memcmp32(&st1, &st2, sizeof(SYSTEMTIME)) == 0); - FX_DWORD dwHash1 = FX_HashCode_String_GetA((FX_LPCSTR)&st1, sizeof(st1), TRUE); - FX_DWORD dwHash2 = FX_HashCode_String_GetA((FX_LPCSTR)&st2, sizeof(st2), TRUE); + FX_DWORD dwHash1 = FX_HashCode_String_GetA((const FX_CHAR*)&st1, sizeof(st1), TRUE); + FX_DWORD dwHash2 = FX_HashCode_String_GetA((const FX_CHAR*)&st2, sizeof(st2), TRUE); ::srand((dwHash1 << 16) | (FX_DWORD)dwHash2); #else time_t tmLast = time(NULL), tmCur; @@ -358,18 +358,18 @@ void FX_Random_GenerateBase(FX_LPDWORD pBuffer, int32_t iCount) } } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, int32_t iCount) +FX_BOOL FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount) { HCRYPTPROV hCP = NULL; if (!::CryptAcquireContext(&hCP, NULL, NULL, PROV_RSA_FULL, 0) || hCP == NULL) { return FALSE; } - ::CryptGenRandom(hCP, iCount * sizeof(FX_DWORD), (FX_LPBYTE)pBuffer); + ::CryptGenRandom(hCP, iCount * sizeof(FX_DWORD), (uint8_t*)pBuffer); ::CryptReleaseContext(hCP, 0); return TRUE; } #endif -void FX_Random_GenerateCrypto(FX_LPDWORD pBuffer, int32_t iCount) +void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ FX_GenerateCryptoRandom(pBuffer, iCount); diff --git a/core/src/fxcrt/fx_xml_parser.cpp b/core/src/fxcrt/fx_xml_parser.cpp index 5649a7db0e..c2f1f6433b 100644 --- a/core/src/fxcrt/fx_xml_parser.cpp +++ b/core/src/fxcrt/fx_xml_parser.cpp @@ -12,7 +12,7 @@ CXML_Parser::~CXML_Parser() m_pDataAcc->Release(); } } -FX_BOOL CXML_Parser::Init(FX_LPBYTE pBuffer, size_t size) +FX_BOOL CXML_Parser::Init(uint8_t* pBuffer, size_t size) { m_pDataAcc = new CXML_DataBufAcc(pBuffer, size); return Init(TRUE); @@ -473,7 +473,7 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, FX_BOOL bStartTag break; } pSubElement->m_pParent = pElement; - pElement->m_Children.Add((FX_LPVOID)CXML_Element::Element); + pElement->m_Children.Add((void*)CXML_Element::Element); pElement->m_Children.Add(pSubElement); SkipWhiteSpaces(); } @@ -519,7 +519,7 @@ void CXML_Parser::InsertContentSegment(FX_BOOL bCDATA, FX_WSTR content, CXML_Ele } CXML_Content* pContent = new CXML_Content; pContent->Set(bCDATA, content); - pElement->m_Children.Add((FX_LPVOID)CXML_Element::Content); + pElement->m_Children.Add((void*)CXML_Element::Content); pElement->m_Children.Add(pContent); } static CXML_Element* XML_ContinueParse(CXML_Parser &parser, FX_BOOL bSaveSpaceChars, FX_FILESIZE* pParsedSize) @@ -534,7 +534,7 @@ static CXML_Element* XML_ContinueParse(CXML_Parser &parser, FX_BOOL bSaveSpaceCh CXML_Element* CXML_Element::Parse(const void* pBuffer, size_t size, FX_BOOL bSaveSpaceChars, FX_FILESIZE* pParsedSize) { CXML_Parser parser; - if (!parser.Init((FX_LPBYTE)pBuffer, size)) { + if (!parser.Init((uint8_t*)pBuffer, size)) { return NULL; } return XML_ContinueParse(parser, bSaveSpaceChars, pParsedSize); diff --git a/core/src/fxcrt/fxcrt_platforms.cpp b/core/src/fxcrt/fxcrt_platforms.cpp index 0810c2ff65..9ad2e5a450 100644 --- a/core/src/fxcrt/fxcrt_platforms.cpp +++ b/core/src/fxcrt/fxcrt_platforms.cpp @@ -168,7 +168,7 @@ FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst) return FALSE; } FX_FILESIZE num = 0; - FX_LPBYTE pBuffer = FX_Alloc(uint8_t, 32768); + uint8_t* pBuffer = FX_Alloc(uint8_t, 32768); while (num = src.Read(pBuffer, 32768)) { if (dst.Write(pBuffer, num) != num) { break; diff --git a/core/src/fxcrt/fxcrt_posix.cpp b/core/src/fxcrt/fxcrt_posix.cpp index b5fb0219af..7a4e77a28d 100644 --- a/core/src/fxcrt/fxcrt_posix.cpp +++ b/core/src/fxcrt/fxcrt_posix.cpp @@ -164,7 +164,7 @@ FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst) return FALSE; } size_t num = 0; - FX_LPBYTE pBuffer = FX_Alloc(uint8_t, 32768); + uint8_t* pBuffer = FX_Alloc(uint8_t, 32768); num = src.Read(pBuffer, 32768); while (num) { if (dst.Write(pBuffer, num) != num) { diff --git a/core/src/fxcrt/fxcrt_windows.h b/core/src/fxcrt/fxcrt_windows.h index 1919f3e4d7..32531d568f 100644 --- a/core/src/fxcrt/fxcrt_windows.h +++ b/core/src/fxcrt/fxcrt_windows.h @@ -29,7 +29,7 @@ public: virtual FX_BOOL Flush(); virtual FX_BOOL Truncate(FX_FILESIZE szFile); protected: - FX_LPVOID m_hFile; + void* m_hFile; }; #endif diff --git a/core/src/fxcrt/xml_int.h b/core/src/fxcrt/xml_int.h index 4155a39ffa..0220301d17 100644 --- a/core/src/fxcrt/xml_int.h +++ b/core/src/fxcrt/xml_int.h @@ -10,7 +10,7 @@ class CXML_DataBufAcc : public IFX_BufferRead { public: - CXML_DataBufAcc(FX_LPCBYTE pBuffer, size_t size) + CXML_DataBufAcc(const uint8_t* pBuffer, size_t size) : m_pBuffer(pBuffer) , m_dwSize(size) , m_dwCurPos(0) @@ -44,7 +44,7 @@ public: } return FALSE; } - virtual FX_LPCBYTE GetBlockBuffer() + virtual const uint8_t* GetBlockBuffer() { return m_pBuffer; } @@ -57,7 +57,7 @@ public: return 0; } protected: - FX_LPCBYTE m_pBuffer; + const uint8_t* m_pBuffer; size_t m_dwSize; size_t m_dwCurPos; }; @@ -111,9 +111,9 @@ public: } return m_pFileRead->ReadBlock(m_pBuffer, m_nStart, m_dwSize); } - virtual FX_LPCBYTE GetBlockBuffer() + virtual const uint8_t* GetBlockBuffer() { - return (FX_LPCBYTE)m_pBuffer; + return (const uint8_t*)m_pBuffer; } virtual size_t GetBlockSize() { @@ -125,7 +125,7 @@ public: } protected: IFX_FileRead *m_pFileRead; - FX_LPBYTE m_pBuffer; + uint8_t* m_pBuffer; FX_FILESIZE m_nStart; size_t m_dwSize; }; @@ -137,11 +137,11 @@ public: FX_BOOL m_bOwnedStream; FX_FILESIZE m_nOffset; FX_BOOL m_bSaveSpaceChars; - FX_LPCBYTE m_pBuffer; + const uint8_t* m_pBuffer; size_t m_dwBufferSize; FX_FILESIZE m_nBufferOffset; size_t m_dwIndex; - FX_BOOL Init(FX_LPBYTE pBuffer, size_t size); + FX_BOOL Init(uint8_t* pBuffer, size_t size); FX_BOOL Init(IFX_FileRead *pFileRead); FX_BOOL Init(IFX_BufferRead *pBuffer); FX_BOOL Init(FX_BOOL bOwndedStream); diff --git a/core/src/fxge/agg/agg23/fx_agg_driver.cpp b/core/src/fxge/agg/agg23/fx_agg_driver.cpp index 60843d7441..0198872995 100644 --- a/core/src/fxge/agg/agg23/fx_agg_driver.cpp +++ b/core/src/fxge/agg/agg23/fx_agg_driver.cpp @@ -376,12 +376,12 @@ private: const CFX_DIBitmap* m_pClipMask; CFX_DIBitmap* m_pDevice; const CFX_ClipRgn* m_pClipRgn; - void (CFX_Renderer::*composite_span)(FX_LPBYTE, int, int, int, FX_LPBYTE, int, int, FX_LPBYTE, FX_LPBYTE); + void (CFX_Renderer::*composite_span)(uint8_t*, int, int, int, uint8_t*, int, int, uint8_t*, uint8_t*); public: void prepare(unsigned) {} - void CompositeSpan(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan, int Bpp, FX_BOOL bDestAlpha, - int span_left, int span_len, FX_LPBYTE cover_scan, - int clip_left, int clip_right, FX_LPBYTE clip_scan) + void CompositeSpan(uint8_t* dest_scan, uint8_t* ori_scan, int Bpp, FX_BOOL bDestAlpha, + int span_left, int span_len, uint8_t* cover_scan, + int clip_left, int clip_right, uint8_t* clip_scan) { ASSERT(!m_pDevice->IsCmykImage()); int col_start = span_left < clip_left ? clip_left - span_left : 0; @@ -542,7 +542,7 @@ public: index = i; } } - FX_LPBYTE dest_scan1 = dest_scan; + uint8_t* dest_scan1 = dest_scan; for (int col = col_start; col < col_end; col ++) { int src_alpha; if (clip_scan) { @@ -561,10 +561,10 @@ public: } } } - void CompositeSpan1bpp(FX_LPBYTE dest_scan, int Bpp, - int span_left, int span_len, FX_LPBYTE cover_scan, - int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + void CompositeSpan1bpp(uint8_t* dest_scan, int Bpp, + int span_left, int span_len, uint8_t* cover_scan, + int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_bRgbByteOrder); ASSERT(!m_pDevice->IsCmykImage()); @@ -580,7 +580,7 @@ public: index = i; } } - FX_LPBYTE dest_scan1 = dest_scan; + uint8_t* dest_scan1 = dest_scan; for (int col = col_start; col < col_end; col ++) { int src_alpha; if (clip_scan) { @@ -598,10 +598,10 @@ public: dest_scan1 = dest_scan + (span_left % 8 + col - col_start + 1) / 8; } } - void CompositeSpanGray(FX_LPBYTE dest_scan, int Bpp, - int span_left, int span_len, FX_LPBYTE cover_scan, - int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + void CompositeSpanGray(uint8_t* dest_scan, int Bpp, + int span_left, int span_len, uint8_t* cover_scan, + int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_bRgbByteOrder); int col_start = span_left < clip_left ? clip_left - span_left : 0; @@ -659,10 +659,10 @@ public: } } } - void CompositeSpanARGB(FX_LPBYTE dest_scan, int Bpp, - int span_left, int span_len, FX_LPBYTE cover_scan, - int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + void CompositeSpanARGB(uint8_t* dest_scan, int Bpp, + int span_left, int span_len, uint8_t* cover_scan, + int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); @@ -745,10 +745,10 @@ public: dest_scan += Bpp; } } - void CompositeSpanRGB(FX_LPBYTE dest_scan, int Bpp, - int span_left, int span_len, FX_LPBYTE cover_scan, - int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + void CompositeSpanRGB(uint8_t* dest_scan, int Bpp, + int span_left, int span_len, uint8_t* cover_scan, + int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); @@ -865,10 +865,10 @@ public: } } } - void CompositeSpanCMYK(FX_LPBYTE dest_scan, int Bpp, - int span_left, int span_len, FX_LPBYTE cover_scan, - int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + void CompositeSpanCMYK(uint8_t* dest_scan, int Bpp, + int span_left, int span_len, uint8_t* cover_scan, + int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_bRgbByteOrder); int col_start = span_left < clip_left ? clip_left - span_left : 0; @@ -949,13 +949,13 @@ public: if (y < m_ClipBox.top || y >= m_ClipBox.bottom) { return; } - FX_LPBYTE dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * y; - FX_LPBYTE dest_scan_extra_alpha = NULL; + uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * y; + uint8_t* dest_scan_extra_alpha = NULL; CFX_DIBitmap* pAlphaMask = m_pDevice->m_pAlphaMask; if (pAlphaMask) { dest_scan_extra_alpha = pAlphaMask->GetBuffer() + pAlphaMask->GetPitch() * y; } - FX_LPBYTE ori_scan = NULL; + uint8_t* ori_scan = NULL; if (m_pOriDevice) { ori_scan = m_pOriDevice->GetBuffer() + m_pOriDevice->GetPitch() * y; } @@ -966,9 +966,9 @@ public: while (1) { int x = span->x; ASSERT(span->len > 0); - FX_LPBYTE dest_pos = NULL; - FX_LPBYTE dest_extra_alpha_pos = NULL; - FX_LPBYTE ori_pos = NULL; + uint8_t* dest_pos = NULL; + uint8_t* dest_extra_alpha_pos = NULL; + uint8_t* ori_pos = NULL; if (Bpp) { ori_pos = ori_scan ? ori_scan + x * Bpp : NULL; dest_pos = dest_scan + x * Bpp; @@ -977,7 +977,7 @@ public: dest_pos = dest_scan + x / 8; ori_pos = ori_scan ? ori_scan + x / 8 : NULL; } - FX_LPBYTE clip_pos = NULL; + uint8_t* clip_pos = NULL; if (m_pClipMask) { clip_pos = m_pClipMask->GetBuffer() + (y - m_ClipBox.top) * m_pClipMask->GetPitch() + x - m_ClipBox.left; } @@ -1031,7 +1031,7 @@ public: if (pIccTransform) { uint8_t gray; color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); - pIccModule->TranslateScanline(pIccTransform, &gray, (FX_LPCBYTE)&color, 1); + pIccModule->TranslateScanline(pIccTransform, &gray, (const uint8_t*)&color, 1); m_Gray = gray; } else { if (bObjectCMYK) { @@ -1052,28 +1052,28 @@ public: if (bObjectCMYK) { m_Color = FXCMYK_TODIB(color); if (pIccTransform) { - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&m_Color, (FX_LPCBYTE)&m_Color, 1); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&m_Color, 1); } } else { if (!pIccTransform) { return FALSE; } color = FXARGB_TODIB(color); - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&m_Color, (FX_LPCBYTE)&color, 1); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&color, 1); } - m_Red = ((FX_LPBYTE)&m_Color)[0]; - m_Green = ((FX_LPBYTE)&m_Color)[1]; - m_Blue = ((FX_LPBYTE)&m_Color)[2]; - m_Gray = ((FX_LPBYTE)&m_Color)[3]; + m_Red = ((uint8_t*)&m_Color)[0]; + m_Green = ((uint8_t*)&m_Color)[1]; + m_Blue = ((uint8_t*)&m_Color)[2]; + m_Gray = ((uint8_t*)&m_Color)[3]; } else { composite_span = (pDevice->GetFormat() == FXDIB_Argb) ? &CFX_Renderer::CompositeSpanARGB : &CFX_Renderer::CompositeSpanRGB; if (pIccTransform) { color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&m_Color, (FX_LPCBYTE)&color, 1); - ((FX_LPBYTE)&m_Color)[3] = m_Alpha; - m_Red = ((FX_LPBYTE)&m_Color)[2]; - m_Green = ((FX_LPBYTE)&m_Color)[1]; - m_Blue = ((FX_LPBYTE)&m_Color)[0]; + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&color, 1); + ((uint8_t*)&m_Color)[3] = m_Alpha; + m_Red = ((uint8_t*)&m_Color)[2]; + m_Green = ((uint8_t*)&m_Color)[1]; + m_Blue = ((uint8_t*)&m_Color)[0]; if (m_bRgbByteOrder) { m_Color = FXARGB_TODIB(m_Color); m_Color = FXARGB_TOBGRORDERDIB(m_Color); @@ -1192,7 +1192,7 @@ void RgbByteOrderSetPixel(CFX_DIBitmap* pBitmap, int x, int y, FX_DWORD argb) if (x < 0 || x >= pBitmap->GetWidth() || y < 0 || y >= pBitmap->GetHeight()) { return; } - FX_LPBYTE pos = (uint8_t*)pBitmap->GetBuffer() + y * pBitmap->GetPitch() + x * pBitmap->GetBPP() / 8; + uint8_t* pos = (uint8_t*)pBitmap->GetBuffer() + y * pBitmap->GetPitch() + x * pBitmap->GetBPP() / 8; if (pBitmap->GetFormat() == FXDIB_Argb) { FXARGB_SETRGBORDERDIB(pos, ArgbGamma(argb)); } else { @@ -1218,7 +1218,7 @@ void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap, int left, int top, int wid uint8_t* pBuffer = pBitmap->GetBuffer(); if (src_alpha == 255) { for (int row = rect.top; row < rect.bottom; row ++) { - FX_LPBYTE dest_scan = pBuffer + row * pBitmap->GetPitch() + rect.left * Bpp; + uint8_t* dest_scan = pBuffer + row * pBitmap->GetPitch() + rect.left * Bpp; if (Bpp == 4) { FX_DWORD* scan = (FX_DWORD*)dest_scan; for (int col = 0; col < width; col ++) { @@ -1238,7 +1238,7 @@ void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap, int left, int top, int wid src_g = FX_GAMMA(src_g); src_b = FX_GAMMA(src_b); for (int row = rect.top; row < rect.bottom; row ++) { - FX_LPBYTE dest_scan = pBuffer + row * pBitmap->GetPitch() + rect.left * Bpp; + uint8_t* dest_scan = pBuffer + row * pBitmap->GetPitch() + rect.left * Bpp; if (bAlpha) { for (int col = 0; col < width; col ++) { uint8_t back_alpha = dest_scan[3]; @@ -1289,8 +1289,8 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t uint8_t* buffer = pBitmap->GetBuffer(); if (dest_format == src_format) { for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = buffer + (dest_top + row) * pitch + dest_left * Bpp; - FX_LPBYTE src_scan = (FX_LPBYTE)pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp; + uint8_t* dest_scan = buffer + (dest_top + row) * pitch + dest_left * Bpp; + uint8_t* src_scan = (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp; if (Bpp == 4) { for (int col = 0; col < width; col ++) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_scan[3], src_scan[0], src_scan[1], src_scan[2])); @@ -1308,12 +1308,12 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t } return; } - FX_LPBYTE dest_buf = buffer + dest_top * pitch + dest_left * Bpp; + uint8_t* dest_buf = buffer + dest_top * pitch + dest_left * Bpp; if (dest_format == FXDIB_Rgb) { if (src_format == FXDIB_Rgb32) { for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * pitch; - FX_LPBYTE src_scan = (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 4; + uint8_t* dest_scan = dest_buf + row * pitch; + uint8_t* src_scan = (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 4; for (int col = 0; col < width; col ++) { *dest_scan++ = src_scan[2]; *dest_scan++ = src_scan[1]; @@ -1328,7 +1328,7 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t if (src_format == FXDIB_Rgb) { for (int row = 0; row < height; row ++) { uint8_t* dest_scan = (uint8_t*)(dest_buf + row * pitch); - FX_LPBYTE src_scan = (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 3; + uint8_t* src_scan = (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 3; if (src_format == FXDIB_Argb) { for (int col = 0; col < width; col ++) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, FX_GAMMA(src_scan[0]), FX_GAMMA(src_scan[1]), FX_GAMMA(src_scan[2]))); @@ -1346,8 +1346,8 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t } else if (src_format == FXDIB_Rgb32) { ASSERT(dest_format == FXDIB_Argb); for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * pitch; - FX_LPBYTE src_scan = (FX_LPBYTE)(pSrcBitmap->GetScanline(src_top + row) + src_left * 4); + uint8_t* dest_scan = dest_buf + row * pitch; + uint8_t* src_scan = (uint8_t*)(pSrcBitmap->GetScanline(src_top + row) + src_left * 4); for (int col = 0; col < width; col++) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[0], src_scan[1], src_scan[2])); src_scan += 4; @@ -1373,7 +1373,7 @@ FX_BOOL _DibSetPixel(CFX_DIBitmap* pDevice, int x, int y, FX_DWORD color, int al if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); color = bObjCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&color, (FX_LPBYTE)&color, 1); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&color, (uint8_t*)&color, 1); color = bObjCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); if (!pDevice->IsCmykImage()) { color = (color & 0xffffff) | (alpha << 24); @@ -1550,7 +1550,7 @@ FX_BOOL CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWOR return TRUE; } FX_BOOL CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_alpha, FX_DWORD argb, - const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type) { if (m_pBitmap->GetBuffer() == NULL) { @@ -1561,14 +1561,14 @@ FX_BOOL CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int bitma handle = pRenderer; return TRUE; } -FX_BOOL CFX_AggDeviceDriver::ContinueDIBits(FX_LPVOID pHandle, IFX_Pause* pPause) +FX_BOOL CFX_AggDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) { if (m_pBitmap->GetBuffer() == NULL) { return TRUE; } return ((CFX_ImageRenderer*)pHandle)->Continue(pPause); } -void CFX_AggDeviceDriver::CancelDIBits(FX_LPVOID pHandle) +void CFX_AggDeviceDriver::CancelDIBits(void* pHandle) { if (m_pBitmap->GetBuffer() == NULL) { return; diff --git a/core/src/fxge/agg/include/fx_agg_driver.h b/core/src/fxge/agg/include/fx_agg_driver.h index f4b9368eff..803227e044 100644 --- a/core/src/fxge/agg/include/fx_agg_driver.h +++ b/core/src/fxge/agg/include/fx_agg_driver.h @@ -86,10 +86,10 @@ public: int alpha_flag, void* pIccTransform, int blend_type); virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, - const CFX_AffineMatrix* pMatrix, FX_DWORD flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type); - virtual FX_BOOL ContinueDIBits(FX_LPVOID handle, IFX_Pause* pPause); - virtual void CancelDIBits(FX_LPVOID handle); + virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause); + virtual void CancelDIBits(void* handle); virtual FX_BOOL DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color, @@ -99,7 +99,7 @@ public: void SetClipMask(FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa)& rasterizer); - virtual FX_LPBYTE GetBuffer() const + virtual uint8_t* GetBuffer() const { return m_pBitmap->GetBuffer(); } diff --git a/core/src/fxge/android/fpf_skiafont.cpp b/core/src/fxge/android/fpf_skiafont.cpp index 290d989851..213a6595aa 100644 --- a/core/src/fxge/android/fpf_skiafont.cpp +++ b/core/src/fxge/android/fpf_skiafont.cpp @@ -156,7 +156,7 @@ int32_t CFPF_SkiaFont::GetItalicAngle() const } return 0; } -FX_DWORD CFPF_SkiaFont::GetFontData(FX_DWORD dwTable, FX_LPBYTE pBuffer, FX_DWORD dwSize) +FX_DWORD CFPF_SkiaFont::GetFontData(FX_DWORD dwTable, uint8_t* pBuffer, FX_DWORD dwSize) { if (!m_Face) { return FALSE; @@ -184,7 +184,7 @@ FX_BOOL CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescrip break; case FPF_SKIAFONTTYPE_Buffer: { CFPF_SkiaBufferFont *pFont = (CFPF_SkiaBufferFont*)pFontDes; - m_Face = pFontMgr->GetFontFace((FX_LPCBYTE)pFont->m_pBuffer, pFont->m_szBuffer, pFont->m_iFaceIndex); + m_Face = pFontMgr->GetFontFace((const uint8_t*)pFont->m_pBuffer, pFont->m_szBuffer, pFont->m_iFaceIndex); } break; default: diff --git a/core/src/fxge/android/fpf_skiafont.h b/core/src/fxge/android/fpf_skiafont.h index 72b569fe2e..af33402846 100644 --- a/core/src/fxge/android/fpf_skiafont.h +++ b/core/src/fxge/android/fpf_skiafont.h @@ -44,7 +44,7 @@ public: virtual int32_t GetHeight() const; virtual int32_t GetItalicAngle() const; - virtual FX_DWORD GetFontData(FX_DWORD dwTable, FX_LPBYTE pBuffer, FX_DWORD dwSize); + virtual FX_DWORD GetFontData(FX_DWORD dwTable, uint8_t* pBuffer, FX_DWORD dwSize); FX_BOOL InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, FX_BSTR bsFamily, FX_DWORD dwStyle, uint8_t uCharset); protected: CFPF_SkiaFontMgr *m_pFontMgr; diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp index ba1e12acaf..214d67477b 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.cpp +++ b/core/src/fxge/android/fpf_skiafontmgr.cpp @@ -103,7 +103,7 @@ FX_DWORD FPF_SkiaGetSansFont(FX_DWORD dwHash) } return 0; } -static uint32_t FPF_GetHashCode_StringA(FX_LPCSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE) +static uint32_t FPF_GetHashCode_StringA(const FX_CHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE) { if (!pStr) { return 0; @@ -111,7 +111,7 @@ static uint32_t FPF_GetHashCode_StringA(FX_LPCSTR pStr, int32_t iLength, FX_BOOL if (iLength < 0) { iLength = FXSYS_strlen(pStr); } - FX_LPCSTR pStrEnd = pStr + iLength; + const FX_CHAR* pStrEnd = pStr + iLength; uint32_t uHashCode = 0; if (bIgnoreCase) { while (pStr < pStrEnd) { @@ -185,7 +185,7 @@ static FX_DWORD FPF_SKIANormalizeFontName(FX_BSTR bsfamily) { FX_DWORD dwHash = 0; int32_t iLength = bsfamily.GetLength(); - FX_LPCSTR pBuffer = bsfamily.GetCStr(); + const FX_CHAR* pBuffer = bsfamily.GetCStr(); for (int32_t i = 0; i < iLength; i++) { FX_CHAR ch = pBuffer[i]; if (ch == ' ' || ch == '-' || ch == ',') { @@ -276,7 +276,7 @@ void CFPF_SkiaFontMgr::LoadPrivateFont(IFX_FileRead* pFontFile) void CFPF_SkiaFontMgr::LoadPrivateFont(FX_BSTR bsFileName) { } -void CFPF_SkiaFontMgr::LoadPrivateFont(FX_LPVOID pBuffer, size_t szBuffer) +void CFPF_SkiaFontMgr::LoadPrivateFont(void* pBuffer, size_t szBuffer) { } IFPF_Font* CFPF_SkiaFontMgr::CreateFont(FX_BSTR bsFamilyname, uint8_t uCharset, FX_DWORD dwStyle, FX_DWORD dwMatch) @@ -406,7 +406,7 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(FX_BSTR bsFile, int32_t iFaceIndex ) FXFT_Set_Pixel_Sizes(face, 0, 64); return face; } -FXFT_Face CFPF_SkiaFontMgr::GetFontFace(FX_LPCBYTE pBuffer, size_t szBuffer, int32_t iFaceIndex ) +FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const uint8_t* pBuffer, size_t szBuffer, int32_t iFaceIndex ) { if (!pBuffer || szBuffer < 1) { return NULL; diff --git a/core/src/fxge/android/fpf_skiafontmgr.h b/core/src/fxge/android/fpf_skiafontmgr.h index 44d427f8af..ba9ea9134a 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.h +++ b/core/src/fxge/android/fpf_skiafontmgr.h @@ -26,7 +26,7 @@ public: { return FPF_SKIAFONTTYPE_Unknown; } - void SetFamily(FX_LPCSTR pFamily) + void SetFamily(const FX_CHAR* pFamily) { if (m_pFamily) { FX_Free(m_pFamily); @@ -36,7 +36,7 @@ public: FXSYS_memcpy32(m_pFamily, pFamily, iSize * sizeof(FX_CHAR)); m_pFamily[iSize] = 0; } - FX_LPSTR m_pFamily; + FX_CHAR* m_pFamily; FX_DWORD m_dwStyle; int32_t m_iFaceIndex; FX_DWORD m_dwCharsets; @@ -56,7 +56,7 @@ public: { return FPF_SKIAFONTTYPE_Path; } - void SetPath(FX_LPCSTR pPath) + void SetPath(const FX_CHAR* pPath) { if (m_pPath) { FX_Free(m_pPath); @@ -66,7 +66,7 @@ public: FXSYS_memcpy32(m_pPath, pPath, iSize * sizeof(FX_CHAR)); m_pPath[iSize] = 0; } - FX_LPSTR m_pPath; + FX_CHAR* m_pPath; }; class CFPF_SkiaFileFont : public CFPF_SkiaFontDescriptor { @@ -86,7 +86,7 @@ public: { return FPF_SKIAFONTTYPE_Buffer; } - FX_LPVOID m_pBuffer; + void* m_pBuffer; size_t m_szBuffer; }; class CFPF_SkiaFontMgr : public IFPF_FontMgr @@ -98,12 +98,12 @@ public: virtual void LoadSystemFonts(); virtual void LoadPrivateFont(IFX_FileRead* pFontFile); virtual void LoadPrivateFont(FX_BSTR bsFileName); - virtual void LoadPrivateFont(FX_LPVOID pBuffer, size_t szBuffer); + virtual void LoadPrivateFont(void* pBuffer, size_t szBuffer); virtual IFPF_Font* CreateFont(FX_BSTR bsFamilyname, uint8_t uCharset, FX_DWORD dwStyle, FX_DWORD dwMatch = 0); FXFT_Face GetFontFace(IFX_FileRead *pFileRead, int32_t iFaceIndex = 0); FXFT_Face GetFontFace(FX_BSTR bsFile, int32_t iFaceIndex = 0); - FXFT_Face GetFontFace(FX_LPCBYTE pBuffer, size_t szBuffer, int32_t iFaceIndex = 0); + FXFT_Face GetFontFace(const uint8_t* pBuffer, size_t szBuffer, int32_t iFaceIndex = 0); protected: void ScanPath(FX_BSTR path); void ScanFile(FX_BSTR file); diff --git a/core/src/fxge/android/fx_android_font.cpp b/core/src/fxge/android/fx_android_font.cpp index 5f8aafc393..48331c2dd0 100644 --- a/core/src/fxge/android/fx_android_font.cpp +++ b/core/src/fxge/android/fx_android_font.cpp @@ -23,7 +23,7 @@ FX_BOOL CFX_AndroidFontInfo::EnumFontList(CFX_FontMapper* pMapper) { return FALSE; } -void* CFX_AndroidFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR face, FX_BOOL& bExact) +void* CFX_AndroidFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact) { if (!m_pFontMgr) { return NULL; @@ -46,11 +46,11 @@ void* CFX_AndroidFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int } return m_pFontMgr->CreateFont(face, charset, dwStyle, FPF_MATCHFONT_REPLACEANSI); } -void* CFX_AndroidFontInfo::GetFont(FX_LPCSTR face) +void* CFX_AndroidFontInfo::GetFont(const FX_CHAR* face) { return NULL; } -FX_DWORD CFX_AndroidFontInfo::GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffer, FX_DWORD size) +FX_DWORD CFX_AndroidFontInfo::GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer, FX_DWORD size) { if (!hFont) { return 0; diff --git a/core/src/fxge/android/fx_android_font.h b/core/src/fxge/android/fx_android_font.h index fb7ff7cd92..0e79abaa9f 100644 --- a/core/src/fxge/android/fx_android_font.h +++ b/core/src/fxge/android/fx_android_font.h @@ -20,10 +20,10 @@ public: virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper); - virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR face, FX_BOOL& bExact); + virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact); - virtual void* GetFont(FX_LPCSTR face); - virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffer, FX_DWORD size); + virtual void* GetFont(const FX_CHAR* face); + virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer, FX_DWORD size); virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name); virtual FX_BOOL GetFontCharset(void* hFont, int& charset); diff --git a/core/src/fxge/apple/apple_int.h b/core/src/fxge/apple/apple_int.h index 6cd880603a..1e620a3a4f 100644 --- a/core/src/fxge/apple/apple_int.h +++ b/core/src/fxge/apple/apple_int.h @@ -48,7 +48,7 @@ public: void* createGraphics(CFX_DIBitmap* bitmap); void destroyGraphics(void* graphics); - void* CreateFont(FX_LPCBYTE pFontData, FX_DWORD dwFontSize); + void* CreateFont(const uint8_t* pFontData, FX_DWORD dwFontSize); void DestroyFont(void* pFont); void setGraphicsTextMatrix(void* graphics, CFX_AffineMatrix* matrix); FX_BOOL drawGraphicsString(void* graphics, @@ -141,17 +141,17 @@ public: int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL); virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, - const CFX_AffineMatrix* pMatrix, FX_DWORD flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD flags, void*& handle, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL) { return FALSE; } - virtual FX_BOOL ContinueDIBits(FX_LPVOID handle, IFX_Pause* pPause) + virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) { return FALSE; } - virtual void CancelDIBits(FX_LPVOID handle) {} + virtual void CancelDIBits(void* handle) {} virtual FX_BOOL DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color, int alpha_flag = 0, void* pIccTransform = NULL); @@ -239,10 +239,10 @@ private: int _tableCount; int _totalSize; }; -uint32_t FX_GetHashCode( FX_LPCSTR pStr); -FX_DWORD FX_IOSGetMatchFamilyNameHashcode(FX_LPCSTR pFontName); +uint32_t FX_GetHashCode( const FX_CHAR* pStr); +FX_DWORD FX_IOSGetMatchFamilyNameHashcode(const FX_CHAR* pFontName); uint32_t FX_IOSGetFamilyNamesCount(); -FX_LPCSTR FX_IOSGetFamilyName( uint32_t uIndex); +const FX_CHAR* FX_IOSGetFamilyName( uint32_t uIndex); #endif #endif // CORE_SRC_FXGE_APPLE_APPLE_INT_H_ diff --git a/core/src/fxge/apple/fx_mac_imp.cpp b/core/src/fxge/apple/fx_mac_imp.cpp index 75489ea2c3..a4ffd05928 100644 --- a/core/src/fxge/apple/fx_mac_imp.cpp +++ b/core/src/fxge/apple/fx_mac_imp.cpp @@ -8,8 +8,8 @@ #include "apple_int.h" #if _FX_OS_ == _FX_MACOSX_ static const struct { - FX_LPCSTR m_pName; - FX_LPCSTR m_pSubstName; + const FX_CHAR* m_pName; + const FX_CHAR* m_pSubstName; } Base14Substs[] = { {"Courier", "Courier New"}, @@ -28,7 +28,7 @@ Base14Substs[] = { class CFX_MacFontInfo : public CFX_FolderFontInfo { public: - virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR family, FX_BOOL& bExact); + virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL& bExact); }; #define JAPAN_GOTHIC "Hiragino Kaku Gothic Pro W6" #define JAPAN_MINCHO "Hiragino Mincho Pro W6" @@ -44,7 +44,7 @@ static void GetJapanesePreference(CFX_ByteString& face, int weight, int picth_fa face = JAPAN_MINCHO; } } -void* CFX_MacFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR cstr_face, FX_BOOL& bExact) +void* CFX_MacFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* cstr_face, FX_BOOL& bExact) { CFX_ByteString face = cstr_face; int iBaseFont; @@ -57,7 +57,7 @@ void* CFX_MacFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pit if (iBaseFont < 12) { return GetFont(face); } - FX_LPVOID p; + void* p; if (m_FontList.Lookup(face, p)) { return p; } diff --git a/core/src/fxge/apple/fx_quartz_device.cpp b/core/src/fxge/apple/fx_quartz_device.cpp index 6a97c7baf2..e10f1b5502 100644 --- a/core/src/fxge/apple/fx_quartz_device.cpp +++ b/core/src/fxge/apple/fx_quartz_device.cpp @@ -48,7 +48,7 @@ void CQuartz2D::destroyGraphics(void* graphics) CGContextRelease((CGContextRef) graphics); } } -void* CQuartz2D::CreateFont(FX_LPCBYTE pFontData, FX_DWORD dwFontSize) +void* CQuartz2D::CreateFont(const uint8_t* pFontData, FX_DWORD dwFontSize) { CGDataProviderRef pDataProvider = CGDataProviderCreateWithData(NULL, pFontData, (size_t)dwFontSize, NULL); if (NULL == pDataProvider) { @@ -541,7 +541,7 @@ FX_BOOL CFX_QuartzDeviceDriver::GetDIBits(CFX_DIBitmap* bitmap, CGImageRelease(image); if (bitmap->HasAlpha()) { for (int row = 0; row < bitmap->GetHeight(); row ++) { - FX_LPBYTE pScanline = (FX_LPBYTE)bitmap->GetScanline(row); + uint8_t* pScanline = (uint8_t*)bitmap->GetScanline(row); for (int col = 0; col < bitmap->GetWidth(); col ++) { if (pScanline[3] > 0) { pScanline[0] = (pScanline[0] * 255.f / pScanline[3] + .5f); @@ -654,7 +654,7 @@ FX_BOOL CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, } } for (int row = 0; row < pBitmap1->GetHeight(); row ++) { - FX_LPBYTE pScanline = (FX_LPBYTE)pBitmap1->GetScanline(row); + uint8_t* pScanline = (uint8_t*)pBitmap1->GetScanline(row); for (int col = 0; col < pBitmap1->GetWidth(); col ++) { pScanline[0] = (uint8_t)(pScanline[0] * pScanline[3] / 255.f + .5f); pScanline[1] = (uint8_t)(pScanline[1] * pScanline[3] / 255.f + .5f); @@ -779,7 +779,7 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap, } } for (int row = 0; row < pBitmap1->GetHeight(); row ++) { - FX_LPBYTE pScanline = (FX_LPBYTE)pBitmap1->GetScanline(row); + uint8_t* pScanline = (uint8_t*)pBitmap1->GetScanline(row); for (int col = 0; col < pBitmap1->GetWidth(); col ++) { pScanline[0] = (uint8_t)(pScanline[0] * pScanline[3] / 255.f + .5f); pScanline[1] = (uint8_t)(pScanline[1] * pScanline[3] / 255.f + .5f); diff --git a/core/src/fxge/dib/dib_int.h b/core/src/fxge/dib/dib_int.h index c82a0378b8..9eeb0fddc0 100644 --- a/core/src/fxge/dib/dib_int.h +++ b/core/src/fxge/dib/dib_int.h @@ -54,7 +54,7 @@ public: return (PixelWeight*)(m_pWeightTables + (pixel - m_DestMin) * m_ItemSize); } int m_DestMin, m_ItemSize; - FX_LPBYTE m_pWeightTables; + uint8_t* m_pWeightTables; }; class CStretchEngine { @@ -70,8 +70,8 @@ public: IFX_ScanlineComposer* m_pDestBitmap; int m_DestWidth, m_DestHeight; FX_RECT m_DestClip; - FX_LPBYTE m_pDestScanline; - FX_LPBYTE m_pDestMaskScanline; + uint8_t* m_pDestScanline; + uint8_t* m_pDestMaskScanline; FX_RECT m_SrcClip; const CFX_DIBSource* m_pSource; FX_DWORD* m_pSrcPalette; diff --git a/core/src/fxge/dib/fx_dib_composite.cpp b/core/src/fxge/dib/fx_dib_composite.cpp index 970325a2d4..aeee91bb4b 100644 --- a/core/src/fxge/dib/fx_dib_composite.cpp +++ b/core/src/fxge/dib/fx_dib_composite.cpp @@ -227,7 +227,7 @@ static _RGB _SetSat(_RGB color, int s) } return color; } -void _RGB_Blend(int blend_mode, FX_LPCBYTE src_scan, uint8_t* dest_scan, int results[3]) +void _RGB_Blend(int blend_mode, const uint8_t* src_scan, uint8_t* dest_scan, int results[3]) { _RGB src, back, result; src.red = src_scan[2]; @@ -254,7 +254,7 @@ void _RGB_Blend(int blend_mode, FX_LPCBYTE src_scan, uint8_t* dest_scan, int res results[1] = result.green; results[2] = result.red; } -inline void _CompositeRow_Argb2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel_count, FX_LPCBYTE clip_scan) +inline void _CompositeRow_Argb2Mask(uint8_t* dest_scan, const uint8_t* src_scan, int pixel_count, const uint8_t* clip_scan) { src_scan += 3; for (int col = 0; col < pixel_count; col ++) { @@ -272,7 +272,7 @@ inline void _CompositeRow_Argb2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, in src_scan += 4; } } -void _CompositeRow_Rgba2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_alpha_scan, int pixel_count, FX_LPCBYTE clip_scan) +void _CompositeRow_Rgba2Mask(uint8_t* dest_scan, const uint8_t* src_alpha_scan, int pixel_count, const uint8_t* clip_scan) { for (int col = 0; col < pixel_count; col ++) { int src_alpha = *src_alpha_scan++; @@ -288,7 +288,7 @@ void _CompositeRow_Rgba2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_alpha_scan, int dest_scan ++; } } -void _CompositeRow_Rgb2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, FX_LPCBYTE clip_scan) +void _CompositeRow_Rgb2Mask(uint8_t* dest_scan, const uint8_t* src_scan, int width, const uint8_t* clip_scan) { if (clip_scan) { for (int i = 0; i < width; i ++) { @@ -300,8 +300,8 @@ void _CompositeRow_Rgb2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, FXSYS_memset8(dest_scan, 0xff, width); } } -void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel_count, int blend_type, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_alpha_scan, FX_LPBYTE dst_alpha_scan, void* pIccTransform) +void _CompositeRow_Argb2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int pixel_count, int blend_type, const uint8_t* clip_scan, + const uint8_t* src_alpha_scan, uint8_t* dst_alpha_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = NULL; if (pIccTransform) { @@ -493,9 +493,9 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe src_scan += 4; } } -inline void _CompositeRow_Argb2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel_count, - int blend_type, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_alpha_scan, void* pIccTransform) +inline void _CompositeRow_Argb2Gray(uint8_t* dest_scan, const uint8_t* src_scan, int pixel_count, + int blend_type, const uint8_t* clip_scan, + const uint8_t* src_alpha_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = NULL; uint8_t gray; @@ -584,8 +584,8 @@ inline void _CompositeRow_Argb2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, in src_scan += 4; } } -inline void _CompositeRow_Rgb2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_Bpp, int pixel_count, - int blend_type, FX_LPCBYTE clip_scan, +inline void _CompositeRow_Rgb2Gray(uint8_t* dest_scan, const uint8_t* src_scan, int src_Bpp, int pixel_count, + int blend_type, const uint8_t* clip_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = NULL; @@ -631,9 +631,9 @@ inline void _CompositeRow_Rgb2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_scan += src_Bpp; } } -void _CompositeRow_Rgb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_Bpp, int pixel_count, - int blend_type, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan, void* pIccTransform) +void _CompositeRow_Rgb2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int src_Bpp, int pixel_count, + int blend_type, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = NULL; if (pIccTransform) { @@ -721,8 +721,8 @@ void _CompositeRow_Rgb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_B src_scan += src_Bpp; } } -void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel_count, int blend_type, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan, FX_LPCBYTE src_alpha_scan) +void _CompositeRow_Argb2Argb(uint8_t* dest_scan, const uint8_t* src_scan, int pixel_count, int blend_type, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan, const uint8_t* src_alpha_scan) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -928,8 +928,8 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel } } } -void _CompositeRow_Rgb2Argb_Blend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int src_Bpp, - FX_LPBYTE dest_alpha_scan) +void _CompositeRow_Rgb2Argb_Blend_NoClip(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int src_Bpp, + uint8_t* dest_alpha_scan) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -989,8 +989,8 @@ void _CompositeRow_Rgb2Argb_Blend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE src_sca } } } -inline void _CompositeRow_Rgb2Argb_Blend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int src_Bpp, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan) +inline void _CompositeRow_Rgb2Argb_Blend_Clip(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int src_Bpp, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -1067,8 +1067,8 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE sr } } } -inline void _CompositeRow_Rgb2Argb_NoBlend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int src_Bpp, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan) +inline void _CompositeRow_Rgb2Argb_NoBlend_Clip(uint8_t* dest_scan, const uint8_t* src_scan, int width, int src_Bpp, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan) { int src_gap = src_Bpp - 3; if (dest_alpha_scan == NULL) { @@ -1129,8 +1129,8 @@ inline void _CompositeRow_Rgb2Argb_NoBlend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE } } } -inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int src_Bpp, - FX_LPBYTE dest_alpha_scan) +inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip(uint8_t* dest_scan, const uint8_t* src_scan, int width, int src_Bpp, + uint8_t* dest_alpha_scan) { if (dest_alpha_scan == NULL) { for (int col = 0; col < width; col ++) { @@ -1153,8 +1153,8 @@ inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYT } } } -inline void _CompositeRow_Argb2Rgb_Blend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_alpha_scan) +inline void _CompositeRow_Argb2Rgb_Blend(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, const uint8_t* clip_scan, + const uint8_t* src_alpha_scan) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -1214,8 +1214,8 @@ inline void _CompositeRow_Argb2Rgb_Blend(FX_LPBYTE dest_scan, FX_LPCBYTE src_sca } } } -inline void _CompositeRow_Argb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int dest_Bpp, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_alpha_scan) +inline void _CompositeRow_Argb2Rgb_NoBlend(uint8_t* dest_scan, const uint8_t* src_scan, int width, int dest_Bpp, const uint8_t* clip_scan, + const uint8_t* src_alpha_scan) { int dest_gap = dest_Bpp - 3; if (src_alpha_scan == NULL) { @@ -1276,7 +1276,7 @@ inline void _CompositeRow_Argb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_s } } } -inline void _CompositeRow_Rgb2Rgb_Blend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp) +inline void _CompositeRow_Rgb2Rgb_Blend_NoClip(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -1299,7 +1299,7 @@ inline void _CompositeRow_Rgb2Rgb_Blend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE s src_scan += src_gap; } } -inline void _CompositeRow_Rgb2Rgb_Blend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_Rgb2Rgb_Blend_Clip(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, const uint8_t* clip_scan) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -1328,7 +1328,7 @@ inline void _CompositeRow_Rgb2Rgb_Blend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE src src_scan += src_gap; } } -inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int dest_Bpp, int src_Bpp) +inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip(uint8_t* dest_scan, const uint8_t* src_scan, int width, int dest_Bpp, int src_Bpp) { if (dest_Bpp == src_Bpp) { FXSYS_memcpy32(dest_scan, src_scan, width * dest_Bpp); @@ -1342,7 +1342,7 @@ inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan += src_Bpp; } } -inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int dest_Bpp, int src_Bpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip(uint8_t* dest_scan, const uint8_t* src_scan, int width, int dest_Bpp, int src_Bpp, const uint8_t* clip_scan) { for (int col = 0; col < width; col ++) { int src_alpha = clip_scan[col]; @@ -1366,10 +1366,10 @@ inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE s src_scan += src_Bpp; } } -void _CompositeRow_Argb2Argb_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel_count, int blend_type, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan, FX_LPCBYTE src_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform) +void _CompositeRow_Argb2Argb_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int pixel_count, int blend_type, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan, const uint8_t* src_alpha_scan, uint8_t* src_cache_scan, void* pIccTransform) { - FX_LPBYTE dp = src_cache_scan; + uint8_t* dp = src_cache_scan; ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_alpha_scan) { if (dest_alpha_scan == NULL) { @@ -1451,14 +1451,14 @@ void _CompositeRow_Argb2Argb_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, } _CompositeRow_Argb2Argb(dest_scan, src_cache_scan, pixel_count, blend_type, clip_scan, dest_alpha_scan, src_alpha_scan); } -void _CompositeRow_Rgb2Argb_Blend_NoClip_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int src_Bpp, - FX_LPBYTE dest_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform) +void _CompositeRow_Rgb2Argb_Blend_NoClip_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int src_Bpp, + uint8_t* dest_alpha_scan, uint8_t* src_cache_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_Bpp == 3) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, width); } else { - FX_LPBYTE dp = src_cache_scan; + uint8_t* dp = src_cache_scan; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); src_scan += 4; @@ -1467,14 +1467,14 @@ void _CompositeRow_Rgb2Argb_Blend_NoClip_Transform(FX_LPBYTE dest_scan, FX_LPCBY } _CompositeRow_Rgb2Argb_Blend_NoClip(dest_scan, src_cache_scan, width, blend_type, 3, dest_alpha_scan); } -inline void _CompositeRow_Rgb2Argb_Blend_Clip_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int src_Bpp, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform) +inline void _CompositeRow_Rgb2Argb_Blend_Clip_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int src_Bpp, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan, uint8_t* src_cache_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_Bpp == 3) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, width); } else { - FX_LPBYTE dp = src_cache_scan; + uint8_t* dp = src_cache_scan; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); src_scan += 4; @@ -1483,14 +1483,14 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip_Transform(FX_LPBYTE dest_scan, FX_ } _CompositeRow_Rgb2Argb_Blend_Clip(dest_scan, src_cache_scan, width, blend_type, 3, clip_scan, dest_alpha_scan); } -inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int src_Bpp, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform) +inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int width, int src_Bpp, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan, uint8_t* src_cache_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_Bpp == 3) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, width); } else { - FX_LPBYTE dp = src_cache_scan; + uint8_t* dp = src_cache_scan; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); src_scan += 4; @@ -1499,14 +1499,14 @@ inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_Transform(FX_LPBYTE dest_scan, F } _CompositeRow_Rgb2Argb_NoBlend_Clip(dest_scan, src_cache_scan, width, 3, clip_scan, dest_alpha_scan); } -inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int src_Bpp, - FX_LPBYTE dest_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform) +inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int width, int src_Bpp, + uint8_t* dest_alpha_scan, uint8_t* src_cache_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_Bpp == 3) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, width); } else { - FX_LPBYTE dp = src_cache_scan; + uint8_t* dp = src_cache_scan; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); src_scan += 4; @@ -1515,8 +1515,8 @@ inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_Transform(FX_LPBYTE dest_scan, } _CompositeRow_Rgb2Argb_NoBlend_NoClip(dest_scan, src_cache_scan, width, 3, dest_alpha_scan); } -inline void _CompositeRow_Argb2Rgb_Blend_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform) +inline void _CompositeRow_Argb2Rgb_Blend_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, const uint8_t* clip_scan, + const uint8_t* src_alpha_scan, uint8_t* src_cache_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_alpha_scan) { @@ -1556,8 +1556,8 @@ inline void _CompositeRow_Argb2Rgb_Blend_Transform(FX_LPBYTE dest_scan, FX_LPCBY } _CompositeRow_Argb2Rgb_Blend(dest_scan, src_cache_scan, width, blend_type, dest_Bpp, clip_scan, src_alpha_scan); } -inline void _CompositeRow_Argb2Rgb_NoBlend_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int dest_Bpp, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform) +inline void _CompositeRow_Argb2Rgb_NoBlend_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int width, int dest_Bpp, const uint8_t* clip_scan, + const uint8_t* src_alpha_scan, uint8_t* src_cache_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_alpha_scan) { @@ -1596,14 +1596,14 @@ inline void _CompositeRow_Argb2Rgb_NoBlend_Transform(FX_LPBYTE dest_scan, FX_LPC } _CompositeRow_Argb2Rgb_NoBlend(dest_scan, src_cache_scan, width, dest_Bpp, clip_scan, src_alpha_scan); } -inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, - FX_LPBYTE src_cache_scan, void* pIccTransform) +inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, + uint8_t* src_cache_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_Bpp == 3) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, width); } else { - FX_LPBYTE dp = src_cache_scan; + uint8_t* dp = src_cache_scan; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); src_scan += 4; @@ -1612,14 +1612,14 @@ inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_Transform(FX_LPBYTE dest_scan, FX } _CompositeRow_Rgb2Rgb_Blend_NoClip(dest_scan, src_cache_scan, width, blend_type, dest_Bpp, 3); } -inline void _CompositeRow_Rgb2Rgb_Blend_Clip_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, FX_LPCBYTE clip_scan, - FX_LPBYTE src_cache_scan, void* pIccTransform) +inline void _CompositeRow_Rgb2Rgb_Blend_Clip_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, const uint8_t* clip_scan, + uint8_t* src_cache_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_Bpp == 3) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, width); } else { - FX_LPBYTE dp = src_cache_scan; + uint8_t* dp = src_cache_scan; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); src_scan += 4; @@ -1628,14 +1628,14 @@ inline void _CompositeRow_Rgb2Rgb_Blend_Clip_Transform(FX_LPBYTE dest_scan, FX_L } _CompositeRow_Rgb2Rgb_Blend_Clip(dest_scan, src_cache_scan, width, blend_type, dest_Bpp, 3, clip_scan); } -inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int dest_Bpp, int src_Bpp, - FX_LPBYTE src_cache_scan, void* pIccTransform) +inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int width, int dest_Bpp, int src_Bpp, + uint8_t* src_cache_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_Bpp == 3) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, width); } else { - FX_LPBYTE dp = src_cache_scan; + uint8_t* dp = src_cache_scan; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); src_scan += 4; @@ -1644,14 +1644,14 @@ inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_Transform(FX_LPBYTE dest_scan, } _CompositeRow_Rgb2Rgb_NoBlend_NoClip(dest_scan, src_cache_scan, width, dest_Bpp, 3); } -inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int dest_Bpp, int src_Bpp, FX_LPCBYTE clip_scan, - FX_LPBYTE src_cache_scan, void* pIccTransform) +inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int width, int dest_Bpp, int src_Bpp, const uint8_t* clip_scan, + uint8_t* src_cache_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_Bpp == 3) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, width); } else { - FX_LPBYTE dp = src_cache_scan; + uint8_t* dp = src_cache_scan; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); src_scan += 4; @@ -1660,9 +1660,9 @@ inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip_Transform(FX_LPBYTE dest_scan, FX } _CompositeRow_Rgb2Rgb_NoBlend_Clip(dest_scan, src_cache_scan, width, dest_Bpp, 3, clip_scan); } -inline void _CompositeRow_8bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, FX_LPCBYTE pPalette, int pixel_count, - int blend_type, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_alpha_scan) +inline void _CompositeRow_8bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_scan, const uint8_t* pPalette, int pixel_count, + int blend_type, const uint8_t* clip_scan, + const uint8_t* src_alpha_scan) { if (src_alpha_scan) { if (blend_type) { @@ -1734,9 +1734,9 @@ inline void _CompositeRow_8bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, } } } -inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, FX_LPCBYTE pPalette, int pixel_count, - int blend_type, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan, FX_LPCBYTE src_alpha_scan) +inline void _CompositeRow_8bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_scan, const uint8_t* pPalette, int pixel_count, + int blend_type, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan, const uint8_t* src_alpha_scan) { if (src_alpha_scan) { if (blend_type) { @@ -1866,8 +1866,8 @@ inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan } } } -inline void _CompositeRow_1bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, - FX_LPCBYTE pPalette, int pixel_count, int blend_type, FX_LPCBYTE clip_scan) +inline void _CompositeRow_1bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, + const uint8_t* pPalette, int pixel_count, int blend_type, const uint8_t* clip_scan) { int reset_gray = pPalette[0]; int set_gray = pPalette[1]; @@ -1899,9 +1899,9 @@ inline void _CompositeRow_1bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, dest_scan ++; } } -inline void _CompositeRow_1bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, - FX_LPCBYTE pPalette, int pixel_count, int blend_type, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan) +inline void _CompositeRow_1bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, + const uint8_t* pPalette, int pixel_count, int blend_type, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan) { int reset_gray = pPalette[0]; int set_gray = pPalette[1]; @@ -1955,9 +1955,9 @@ inline void _CompositeRow_1bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan dest_scan ++; } } -inline void _CompositeRow_8bppRgb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, FX_DWORD* pPalette, int pixel_count, - int DestBpp, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_alpha_scan) +inline void _CompositeRow_8bppRgb2Rgb_NoBlend(uint8_t* dest_scan, const uint8_t* src_scan, FX_DWORD* pPalette, int pixel_count, + int DestBpp, const uint8_t* clip_scan, + const uint8_t* src_alpha_scan) { if (src_alpha_scan) { int dest_gap = DestBpp - 3; @@ -2019,8 +2019,8 @@ inline void _CompositeRow_8bppRgb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE sr } } } -inline void _CompositeRow_1bppRgb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, - FX_DWORD* pPalette, int pixel_count, int DestBpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_1bppRgb2Rgb_NoBlend(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, + FX_DWORD* pPalette, int pixel_count, int DestBpp, const uint8_t* clip_scan) { int reset_r, reset_g, reset_b; int set_r, set_g, set_b; @@ -2058,9 +2058,9 @@ inline void _CompositeRow_1bppRgb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE sr } } } -inline void _CompositeRow_8bppRgb2Argb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, - FX_DWORD* pPalette, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_alpha_scan) +inline void _CompositeRow_8bppRgb2Argb_NoBlend(uint8_t* dest_scan, const uint8_t* src_scan, int width, + FX_DWORD* pPalette, const uint8_t* clip_scan, + const uint8_t* src_alpha_scan) { if (src_alpha_scan) { for (int col = 0; col < width; col ++) { @@ -2136,9 +2136,9 @@ inline void _CompositeRow_8bppRgb2Argb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE s src_scan ++; } } -void _CompositeRow_8bppRgb2Rgba_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, - FX_DWORD* pPalette, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan, FX_LPCBYTE src_alpha_scan) +void _CompositeRow_8bppRgb2Rgba_NoBlend(uint8_t* dest_scan, const uint8_t* src_scan, int width, + FX_DWORD* pPalette, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan, const uint8_t* src_alpha_scan) { if (src_alpha_scan) { for (int col = 0; col < width; col ++) { @@ -2216,8 +2216,8 @@ void _CompositeRow_8bppRgb2Rgba_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan src_scan ++; } } -inline void _CompositeRow_1bppRgb2Argb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, int width, - FX_DWORD* pPalette, FX_LPCBYTE clip_scan) +inline void _CompositeRow_1bppRgb2Argb_NoBlend(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, int width, + FX_DWORD* pPalette, const uint8_t* clip_scan) { int reset_r, reset_g, reset_b; int set_r, set_g, set_b; @@ -2263,9 +2263,9 @@ inline void _CompositeRow_1bppRgb2Argb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE s dest_scan ++; } } -void _CompositeRow_1bppRgb2Rgba_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, int width, - FX_DWORD* pPalette, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan) +void _CompositeRow_1bppRgb2Rgba_NoBlend(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, int width, + FX_DWORD* pPalette, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan) { int reset_r, reset_g, reset_b; int set_r, set_g, set_b; @@ -2311,8 +2311,8 @@ void _CompositeRow_1bppRgb2Rgba_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan dest_scan ++; } } -void _CompositeRow_ByteMask2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, - int blend_type, FX_LPCBYTE clip_scan) +void _CompositeRow_ByteMask2Argb(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, + int blend_type, const uint8_t* clip_scan) { for (int col = 0; col < pixel_count; col ++) { int src_alpha; @@ -2368,9 +2368,9 @@ void _CompositeRow_ByteMask2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m dest_scan += 2; } } -void _CompositeRow_ByteMask2Rgba(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, - int blend_type, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan) +void _CompositeRow_ByteMask2Rgba(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, + int blend_type, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan) { for (int col = 0; col < pixel_count; col ++) { int src_alpha; @@ -2431,8 +2431,8 @@ void _CompositeRow_ByteMask2Rgba(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m } } } -void _CompositeRow_ByteMask2Rgb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, - int blend_type, int Bpp, FX_LPCBYTE clip_scan) +void _CompositeRow_ByteMask2Rgb(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, + int blend_type, int Bpp, const uint8_t* clip_scan) { for (int col = 0; col < pixel_count; col ++) { int src_alpha; @@ -2476,8 +2476,8 @@ void _CompositeRow_ByteMask2Rgb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma dest_scan += Bpp - 2; } } -void _CompositeRow_ByteMask2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int pixel_count, - FX_LPCBYTE clip_scan) +void _CompositeRow_ByteMask2Mask(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int pixel_count, + const uint8_t* clip_scan) { for (int col = 0; col < pixel_count; col ++) { int src_alpha; @@ -2495,8 +2495,8 @@ void _CompositeRow_ByteMask2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m dest_scan ++; } } -void _CompositeRow_ByteMask2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_gray, - int pixel_count, FX_LPCBYTE clip_scan) +void _CompositeRow_ByteMask2Gray(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_gray, + int pixel_count, const uint8_t* clip_scan) { for (int col = 0; col < pixel_count; col ++) { int src_alpha; @@ -2511,9 +2511,9 @@ void _CompositeRow_ByteMask2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m dest_scan ++; } } -void _CompositeRow_ByteMask2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_gray, - int pixel_count, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan) +void _CompositeRow_ByteMask2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_gray, + int pixel_count, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan) { for (int col = 0; col < pixel_count; col ++) { int src_alpha; @@ -2540,8 +2540,8 @@ void _CompositeRow_ByteMask2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int dest_scan ++; } } -void _CompositeRow_BitMask2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_r, int src_g, int src_b, - int src_left, int pixel_count, int blend_type, FX_LPCBYTE clip_scan) +void _CompositeRow_BitMask2Argb(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_r, int src_g, int src_b, + int src_left, int pixel_count, int blend_type, const uint8_t* clip_scan) { if (blend_type == FXDIB_BLEND_NORMAL && clip_scan == NULL && mask_alpha == 255) { FX_ARGB argb = FXARGB_MAKE(0xff, src_r, src_g, src_b); @@ -2607,9 +2607,9 @@ void _CompositeRow_BitMask2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma dest_scan += 2; } } -void _CompositeRow_BitMask2Rgba(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_r, int src_g, int src_b, - int src_left, int pixel_count, int blend_type, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan) +void _CompositeRow_BitMask2Rgba(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_r, int src_g, int src_b, + int src_left, int pixel_count, int blend_type, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan) { if (blend_type == FXDIB_BLEND_NORMAL && clip_scan == NULL && mask_alpha == 255) { for (int col = 0; col < pixel_count; col ++) { @@ -2683,8 +2683,8 @@ void _CompositeRow_BitMask2Rgba(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma } } } -void _CompositeRow_BitMask2Rgb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_r, int src_g, int src_b, - int src_left, int pixel_count, int blend_type, int Bpp, FX_LPCBYTE clip_scan) +void _CompositeRow_BitMask2Rgb(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_r, int src_g, int src_b, + int src_left, int pixel_count, int blend_type, int Bpp, const uint8_t* clip_scan) { if (blend_type == FXDIB_BLEND_NORMAL && clip_scan == NULL && mask_alpha == 255) { for (int col = 0; col < pixel_count; col ++) { @@ -2743,8 +2743,8 @@ void _CompositeRow_BitMask2Rgb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mas dest_scan += Bpp - 2; } } -void _CompositeRow_BitMask2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_left, - int pixel_count, FX_LPCBYTE clip_scan) +void _CompositeRow_BitMask2Mask(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_left, + int pixel_count, const uint8_t* clip_scan) { for (int col = 0; col < pixel_count; col ++) { if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) { @@ -2766,8 +2766,8 @@ void _CompositeRow_BitMask2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma dest_scan ++; } } -void _CompositeRow_BitMask2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_gray, - int src_left, int pixel_count, FX_LPCBYTE clip_scan) +void _CompositeRow_BitMask2Gray(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_gray, + int src_left, int pixel_count, const uint8_t* clip_scan) { for (int col = 0; col < pixel_count; col ++) { if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) { @@ -2786,9 +2786,9 @@ void _CompositeRow_BitMask2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma dest_scan ++; } } -void _CompositeRow_BitMask2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_gray, - int src_left, int pixel_count, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan) +void _CompositeRow_BitMask2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_gray, + int src_left, int pixel_count, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan) { for (int col = 0; col < pixel_count; col ++) { if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) { @@ -2820,7 +2820,7 @@ void _CompositeRow_BitMask2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m dest_scan ++; } } -void _CompositeRow_Argb2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel_count, int blend_type, FX_LPCBYTE clip_scan) +void _CompositeRow_Argb2Argb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int pixel_count, int blend_type, const uint8_t* clip_scan) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -2877,7 +2877,7 @@ void _CompositeRow_Argb2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_sc src_scan++; } } -void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int src_Bpp) +void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int src_Bpp) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -2914,7 +2914,7 @@ void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LP src_scan += src_gap; } } -inline void _CompositeRow_Argb2Rgb_Blend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_Argb2Rgb_Blend_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, const uint8_t* clip_scan) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -2949,7 +2949,7 @@ inline void _CompositeRow_Argb2Rgb_Blend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LP src_scan ++; } } -inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int src_Bpp) +inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int src_Bpp) { for (int col = 0; col < width; col ++) { if (src_Bpp == 4) { @@ -2961,7 +2961,7 @@ inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_RgbByteOrder(FX_LPBYTE dest_sc src_scan += src_Bpp; } } -inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp) +inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -2987,7 +2987,7 @@ inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, src_scan += src_gap; } } -inline void _CompositeRow_Argb2Rgb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int dest_Bpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_Argb2Rgb_NoBlend_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int dest_Bpp, const uint8_t* clip_scan) { for (int col = 0; col < width; col ++) { uint8_t src_alpha; @@ -3018,7 +3018,7 @@ inline void _CompositeRow_Argb2Rgb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, FX_ src_scan ++; } } -inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int dest_Bpp, int src_Bpp) +inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int dest_Bpp, int src_Bpp) { for (int col = 0; col < width; col ++) { dest_scan[2] = src_scan[0]; @@ -3028,7 +3028,7 @@ inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_RgbByteOrder(FX_LPBYTE dest_sca src_scan += src_Bpp; } } -inline void _CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int src_Bpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int src_Bpp, const uint8_t* clip_scan) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -3072,7 +3072,7 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, src_scan += src_gap; } } -inline void _CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, const uint8_t* clip_scan) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -3104,7 +3104,7 @@ inline void _CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, F src_scan += src_gap; } } -inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int src_Bpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int src_Bpp, const uint8_t* clip_scan) { int src_gap = src_Bpp - 3; for (int col = 0; col < width; col ++) { @@ -3136,7 +3136,7 @@ inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_RgbByteOrder(FX_LPBYTE dest_scan src_scan += src_gap; } } -inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int dest_Bpp, int src_Bpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int dest_Bpp, int src_Bpp, const uint8_t* clip_scan) { for (int col = 0; col < width; col ++) { int src_alpha = clip_scan[col]; @@ -3158,8 +3158,8 @@ inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, src_scan += src_Bpp; } } -inline void _CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, FX_ARGB* pPalette, int pixel_count, - int DestBpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, FX_ARGB* pPalette, int pixel_count, + int DestBpp, const uint8_t* clip_scan) { for (int col = 0; col < pixel_count; col ++) { FX_ARGB argb = pPalette ? pPalette[*src_scan] : (*src_scan) * 0x010101; @@ -3179,8 +3179,8 @@ inline void _CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, src_scan ++; } } -inline void _CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, - FX_ARGB* pPalette, int pixel_count, int DestBpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, + FX_ARGB* pPalette, int pixel_count, int DestBpp, const uint8_t* clip_scan) { int reset_r, reset_g, reset_b; int set_r, set_g, set_b; @@ -3218,8 +3218,8 @@ inline void _CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, dest_scan += DestBpp; } } -inline void _CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, - FX_ARGB* pPalette, FX_LPCBYTE clip_scan) +inline void _CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, + FX_ARGB* pPalette, const uint8_t* clip_scan) { for (int col = 0; col < width; col ++) { int src_r, src_g, src_b; @@ -3257,8 +3257,8 @@ inline void _CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, src_scan ++; } } -inline void _CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, int width, - FX_ARGB* pPalette, FX_LPCBYTE clip_scan) +inline void _CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, int width, + FX_ARGB* pPalette, const uint8_t* clip_scan) { int reset_r, reset_g, reset_b; int set_r, set_g, set_b; @@ -3307,8 +3307,8 @@ inline void _CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, dest_scan += 4; } } -void _CompositeRow_ByteMask2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, - int blend_type, FX_LPCBYTE clip_scan) +void _CompositeRow_ByteMask2Argb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, + int blend_type, const uint8_t* clip_scan) { for (int col = 0; col < pixel_count; col ++) { int src_alpha; @@ -3362,8 +3362,8 @@ void _CompositeRow_ByteMask2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE sr dest_scan += 4; } } -void _CompositeRow_ByteMask2Rgb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, - int blend_type, int Bpp, FX_LPCBYTE clip_scan) +void _CompositeRow_ByteMask2Rgb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, + int blend_type, int Bpp, const uint8_t* clip_scan) { for (int col = 0; col < pixel_count; col ++) { int src_alpha; @@ -3405,8 +3405,8 @@ void _CompositeRow_ByteMask2Rgb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src dest_scan += Bpp; } } -void _CompositeRow_BitMask2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_r, int src_g, int src_b, - int src_left, int pixel_count, int blend_type, FX_LPCBYTE clip_scan) +void _CompositeRow_BitMask2Argb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_r, int src_g, int src_b, + int src_left, int pixel_count, int blend_type, const uint8_t* clip_scan) { if (blend_type == FXDIB_BLEND_NORMAL && clip_scan == NULL && mask_alpha == 255) { FX_ARGB argb = FXARGB_MAKE(0xff, src_r, src_g, src_b); @@ -3470,8 +3470,8 @@ void _CompositeRow_BitMask2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src dest_scan += 4; } } -void _CompositeRow_BitMask2Rgb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_r, int src_g, int src_b, - int src_left, int pixel_count, int blend_type, int Bpp, FX_LPCBYTE clip_scan) +void _CompositeRow_BitMask2Rgb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_r, int src_g, int src_b, + int src_left, int pixel_count, int blend_type, int Bpp, const uint8_t* clip_scan) { if (blend_type == FXDIB_BLEND_NORMAL && clip_scan == NULL && mask_alpha == 255) { for (int col = 0; col < pixel_count; col ++) { @@ -3554,7 +3554,7 @@ inline FX_BOOL _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, int if ((dest_format & 0xff) == 8) { if (pIccTransform) { mask_color = (alpha_flag >> 8) ? FXCMYK_TODIB(mask_color) : FXARGB_TODIB(mask_color); - FX_LPBYTE gray_p = (FX_LPBYTE)&mask_color; + uint8_t* gray_p = (uint8_t*)&mask_color; pIccModule->TranslateScanline(pIccTransform, gray_p, gray_p, 1); mask_red = dest_format & 0x0400 ? FX_CCOLOR(gray_p[0]) : gray_p[0]; } else { @@ -3571,7 +3571,7 @@ inline FX_BOOL _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, int } } } else { - FX_LPBYTE mask_color_p = (FX_LPBYTE)&mask_color; + uint8_t* mask_color_p = (uint8_t*)&mask_color; mask_color = (alpha_flag >> 8) ? FXCMYK_TODIB(mask_color) : FXARGB_TODIB(mask_color); if (pIccTransform) { pIccModule->TranslateScanline(pIccTransform, mask_color_p, mask_color_p, 1); @@ -3600,11 +3600,11 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB if (pSrcPalette) { if ((dest_format & 0xff) == 8) { int pal_count = 1 << (src_format & 0xff); - FX_LPBYTE gray_pal = FX_Alloc(uint8_t, pal_count); + uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); pDestPalette = (FX_DWORD*)gray_pal; for (int i = 0; i < pal_count; i ++) { FX_DWORD color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) : FXARGB_TODIB(pSrcPalette[i]); - pIccModule->TranslateScanline(pIccTransform, gray_pal, (FX_LPCBYTE)&color, 1); + pIccModule->TranslateScanline(pIccTransform, gray_pal, (const uint8_t*)&color, 1); gray_pal ++; } } else { @@ -3612,13 +3612,13 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB pDestPalette = FX_Alloc(FX_DWORD, palsize); for (int i = 0; i < palsize; i ++) { FX_DWORD color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) : FXARGB_TODIB(pSrcPalette[i]); - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&color, (FX_LPCBYTE)&color, 1); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&color, (const uint8_t*)&color, 1); pDestPalette[i] = isDstCmyk ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); } } } else { int pal_count = 1 << (src_format & 0xff); - FX_LPBYTE gray_pal = FX_Alloc(uint8_t, pal_count); + uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); if (pal_count == 2) { gray_pal[0] = 0; gray_pal[1] = 255; @@ -3633,7 +3633,7 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB } else { pDestPalette = FX_Alloc(FX_DWORD, pal_count); for (int i = 0; i < pal_count; i ++) { - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&pDestPalette[i], &gray_pal[i], 1); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&pDestPalette[i], &gray_pal[i], 1); pDestPalette[i] = isDstCmyk ? FXCMYK_TODIB(pDestPalette[i]) : FXARGB_TODIB(pDestPalette[i]); } FX_Free(gray_pal); @@ -3643,7 +3643,7 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB if (pSrcPalette) { if ((dest_format & 0xff) == 8) { int pal_count = 1 << (src_format & 0xff); - FX_LPBYTE gray_pal = FX_Alloc(uint8_t, pal_count); + uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); pDestPalette = (FX_DWORD*)gray_pal; if (isSrcCmyk) { for (int i = 0; i < pal_count; i ++) { @@ -3676,7 +3676,7 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB } else { if ((dest_format & 0xff) == 8) { int pal_count = 1 << (src_format & 0xff); - FX_LPBYTE gray_pal = FX_Alloc(uint8_t, pal_count); + uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); if (pal_count == 2) { gray_pal[0] = 0; gray_pal[1] = 255; @@ -3774,8 +3774,8 @@ FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_ + (pIccTransform ? 64 : 0); return TRUE; } -void CFX_ScanlineCompositor::CompositeRgbBitmapLine(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_extra_alpha, FX_LPBYTE dst_extra_alpha) +void CFX_ScanlineCompositor::CompositeRgbBitmapLine(uint8_t* dest_scan, const uint8_t* src_scan, int width, const uint8_t* clip_scan, + const uint8_t* src_extra_alpha, uint8_t* dst_extra_alpha) { int src_Bpp = (m_SrcFormat & 0xff) >> 3; int dest_Bpp = (m_DestFormat & 0xff) >> 3; @@ -3967,8 +3967,8 @@ void CFX_ScanlineCompositor::CompositeRgbBitmapLine(FX_LPBYTE dest_scan, FX_LPCB } } } -void CFX_ScanlineCompositor::CompositePalBitmapLine(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, int width, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_extra_alpha, FX_LPBYTE dst_extra_alpha) +void CFX_ScanlineCompositor::CompositePalBitmapLine(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, int width, const uint8_t* clip_scan, + const uint8_t* src_extra_alpha, uint8_t* dst_extra_alpha) { if (m_bRgbByteOrder) { if (m_SrcFormat == FXDIB_1bppRgb) { @@ -3996,16 +3996,16 @@ void CFX_ScanlineCompositor::CompositePalBitmapLine(FX_LPBYTE dest_scan, FX_LPCB } else if ((m_DestFormat & 0xff) == 8) { if (m_Transparency & 8) { if (m_DestFormat & 0x0200) { - _CompositeRow_1bppPal2Graya(dest_scan, src_scan, src_left, (FX_LPCBYTE)m_pSrcPalette, width, m_BlendType, clip_scan, dst_extra_alpha); + _CompositeRow_1bppPal2Graya(dest_scan, src_scan, src_left, (const uint8_t*)m_pSrcPalette, width, m_BlendType, clip_scan, dst_extra_alpha); } else { - _CompositeRow_1bppPal2Gray(dest_scan, src_scan, src_left, (FX_LPCBYTE)m_pSrcPalette, width, m_BlendType, clip_scan); + _CompositeRow_1bppPal2Gray(dest_scan, src_scan, src_left, (const uint8_t*)m_pSrcPalette, width, m_BlendType, clip_scan); } } else { if (m_DestFormat & 0x0200) - _CompositeRow_8bppPal2Graya(dest_scan, src_scan, (FX_LPCBYTE)m_pSrcPalette, width, m_BlendType, clip_scan, + _CompositeRow_8bppPal2Graya(dest_scan, src_scan, (const uint8_t*)m_pSrcPalette, width, m_BlendType, clip_scan, dst_extra_alpha, src_extra_alpha); else - _CompositeRow_8bppPal2Gray(dest_scan, src_scan, (FX_LPCBYTE)m_pSrcPalette, width, m_BlendType, clip_scan, + _CompositeRow_8bppPal2Gray(dest_scan, src_scan, (const uint8_t*)m_pSrcPalette, width, m_BlendType, clip_scan, src_extra_alpha); } } else { @@ -4036,8 +4036,8 @@ void CFX_ScanlineCompositor::CompositePalBitmapLine(FX_LPBYTE dest_scan, FX_LPCB } } } -void CFX_ScanlineCompositor::CompositeByteMaskLine(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, FX_LPCBYTE clip_scan, - FX_LPBYTE dst_extra_alpha) +void CFX_ScanlineCompositor::CompositeByteMaskLine(uint8_t* dest_scan, const uint8_t* src_scan, int width, const uint8_t* clip_scan, + uint8_t* dst_extra_alpha) { if (m_DestFormat == FXDIB_8bppMask) { _CompositeRow_ByteMask2Mask(dest_scan, src_scan, m_MaskAlpha, width, clip_scan); @@ -4065,8 +4065,8 @@ void CFX_ScanlineCompositor::CompositeByteMaskLine(FX_LPBYTE dest_scan, FX_LPCBY _CompositeRow_ByteMask2Rgba(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, width, m_BlendType, clip_scan, dst_extra_alpha); } -void CFX_ScanlineCompositor::CompositeBitMaskLine(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, int width, FX_LPCBYTE clip_scan, - FX_LPBYTE dst_extra_alpha) +void CFX_ScanlineCompositor::CompositeBitMaskLine(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, int width, const uint8_t* clip_scan, + uint8_t* dst_extra_alpha) { if (m_DestFormat == FXDIB_8bppMask) { _CompositeRow_BitMask2Mask(dest_scan, src_scan, m_MaskAlpha, src_left, width, clip_scan); @@ -4126,11 +4126,11 @@ FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left, int dest_top, int width, in FX_BOOL bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage(); CFX_DIBitmap* pSrcAlphaMask = pSrcBitmap->m_pAlphaMask; for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * dest_Bpp; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * src_Bpp; - FX_LPCBYTE src_scan_extra_alpha = pSrcAlphaMask ? pSrcAlphaMask->GetScanline(src_top + row) + src_left : NULL; - FX_LPBYTE dst_scan_extra_alpha = m_pAlphaMask ? (FX_LPBYTE)m_pAlphaMask->GetScanline(dest_top + row) + dest_left : NULL; - FX_LPCBYTE clip_scan = NULL; + uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * dest_Bpp; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * src_Bpp; + const uint8_t* src_scan_extra_alpha = pSrcAlphaMask ? pSrcAlphaMask->GetScanline(src_top + row) + src_left : NULL; + uint8_t* dst_scan_extra_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left : NULL; + const uint8_t* clip_scan = NULL; if (pClipMask) { clip_scan = pClipMask->m_pBuffer + (dest_top + row - clip_box.top) * pClipMask->m_Pitch + (dest_left - clip_box.left); } @@ -4176,10 +4176,10 @@ FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left, int dest_top, int width, int return FALSE; } for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * Bpp; - FX_LPCBYTE src_scan = pMask->GetScanline(src_top + row); - FX_LPBYTE dst_scan_extra_alpha = m_pAlphaMask ? (FX_LPBYTE)m_pAlphaMask->GetScanline(dest_top + row) + dest_left : NULL; - FX_LPCBYTE clip_scan = NULL; + uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * Bpp; + const uint8_t* src_scan = pMask->GetScanline(src_top + row); + uint8_t* dst_scan_extra_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left : NULL; + const uint8_t* clip_scan = NULL; if (pClipMask) { clip_scan = pClipMask->m_pBuffer + (dest_top + row - clip_box.top) * pClipMask->m_Pitch + (dest_left - clip_box.left); } @@ -4212,7 +4212,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX } else { dst_color = FXARGB_TODIB(color); } - FX_LPBYTE color_p = (FX_LPBYTE)&dst_color; + uint8_t* color_p = (uint8_t*)&dst_color; if (m_bpp == 8) { uint8_t gray = 255; if (!IsAlphaMask()) { @@ -4234,7 +4234,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX } } for (int row = rect.top; row < rect.bottom; row ++) { - FX_LPBYTE dest_scan = m_pBuffer + row * m_Pitch + rect.left; + uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left; if (src_alpha == 255) { FXSYS_memset8(dest_scan, gray, width); } else @@ -4305,8 +4305,8 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX FX_BOOL bArgb = GetFormat() == FXDIB_Argb ? TRUE : FALSE; if (src_alpha == 255) { for (int row = rect.top; row < rect.bottom; row ++) { - FX_LPBYTE dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; - FX_LPBYTE dest_scan_alpha = m_pAlphaMask ? (FX_LPBYTE)m_pAlphaMask->GetScanline(row) + rect.left : NULL; + uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; + uint8_t* dest_scan_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->GetScanline(row) + rect.left : NULL; if (dest_scan_alpha) { FXSYS_memset8(dest_scan_alpha, 0xff, width); } @@ -4326,7 +4326,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX return TRUE; } for (int row = rect.top; row < rect.bottom; row ++) { - FX_LPBYTE dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; + uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; if (bAlpha) { if (bArgb) { for (int col = 0; col < width; col ++) { @@ -4347,7 +4347,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX *dest_scan++ = dest_alpha; } } else { - FX_LPBYTE dest_scan_alpha = (FX_LPBYTE)m_pAlphaMask->GetScanline(row) + rect.left; + uint8_t* dest_scan_alpha = (uint8_t*)m_pAlphaMask->GetScanline(row) + rect.left; for (int col = 0; col < width; col ++) { uint8_t back_alpha = *dest_scan_alpha; if (back_alpha == 0) { @@ -4448,8 +4448,8 @@ FX_BOOL CFX_BitmapComposer::SetInfo(int width, int height, FXDIB_Format src_form } return TRUE; } -void CFX_BitmapComposer::DoCompose(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int dest_width, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_extra_alpha, FX_LPBYTE dst_extra_alpha) +void CFX_BitmapComposer::DoCompose(uint8_t* dest_scan, const uint8_t* src_scan, int dest_width, const uint8_t* clip_scan, + const uint8_t* src_extra_alpha, uint8_t* dst_extra_alpha) { if (m_BitmapAlpha < 255) { if (clip_scan) { @@ -4469,31 +4469,31 @@ void CFX_BitmapComposer::DoCompose(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m_Compositor.CompositeRgbBitmapLine(dest_scan, src_scan, dest_width, clip_scan, src_extra_alpha, dst_extra_alpha); } } -void CFX_BitmapComposer::ComposeScanline(int line, FX_LPCBYTE scanline, FX_LPCBYTE scan_extra_alpha) +void CFX_BitmapComposer::ComposeScanline(int line, const uint8_t* scanline, const uint8_t* scan_extra_alpha) { if (m_bVertical) { ComposeScanlineV(line, scanline, scan_extra_alpha); return; } - FX_LPCBYTE clip_scan = NULL; + const uint8_t* clip_scan = NULL; if (m_pClipMask) clip_scan = m_pClipMask->GetBuffer() + (m_DestTop + line - m_pClipRgn->GetBox().top) * m_pClipMask->GetPitch() + (m_DestLeft - m_pClipRgn->GetBox().left); - FX_LPBYTE dest_scan = (FX_LPBYTE)m_pBitmap->GetScanline(line + m_DestTop) + + uint8_t* dest_scan = (uint8_t*)m_pBitmap->GetScanline(line + m_DestTop) + m_DestLeft * m_pBitmap->GetBPP() / 8; - FX_LPBYTE dest_alpha_scan = m_pBitmap->m_pAlphaMask ? - (FX_LPBYTE)m_pBitmap->m_pAlphaMask->GetScanline(line + m_DestTop) + m_DestLeft : NULL; + uint8_t* dest_alpha_scan = m_pBitmap->m_pAlphaMask ? + (uint8_t*)m_pBitmap->m_pAlphaMask->GetScanline(line + m_DestTop) + m_DestLeft : NULL; DoCompose(dest_scan, scanline, m_DestWidth, clip_scan, scan_extra_alpha, dest_alpha_scan); } -void CFX_BitmapComposer::ComposeScanlineV(int line, FX_LPCBYTE scanline, FX_LPCBYTE scan_extra_alpha) +void CFX_BitmapComposer::ComposeScanlineV(int line, const uint8_t* scanline, const uint8_t* scan_extra_alpha) { int i; int Bpp = m_pBitmap->GetBPP() / 8; int dest_pitch = m_pBitmap->GetPitch(); int dest_alpha_pitch = m_pBitmap->m_pAlphaMask ? m_pBitmap->m_pAlphaMask->GetPitch() : 0; int dest_x = m_DestLeft + (m_bFlipX ? (m_DestWidth - line - 1) : line); - FX_LPBYTE dest_buf = m_pBitmap->GetBuffer() + dest_x * Bpp + m_DestTop * dest_pitch; - FX_LPBYTE dest_alpha_buf = m_pBitmap->m_pAlphaMask ? + uint8_t* dest_buf = m_pBitmap->GetBuffer() + dest_x * Bpp + m_DestTop * dest_pitch; + uint8_t* dest_alpha_buf = m_pBitmap->m_pAlphaMask ? m_pBitmap->m_pAlphaMask->GetBuffer() + dest_x + m_DestTop * dest_alpha_pitch : NULL; if (m_bFlipY) { dest_buf += dest_pitch * (m_DestHeight - 1); @@ -4505,27 +4505,27 @@ void CFX_BitmapComposer::ComposeScanlineV(int line, FX_LPCBYTE scanline, FX_LPCB y_step = -y_step; y_alpha_step = -y_alpha_step; } - FX_LPBYTE src_scan = m_pScanlineV; - FX_LPBYTE dest_scan = dest_buf; + uint8_t* src_scan = m_pScanlineV; + uint8_t* dest_scan = dest_buf; for (i = 0; i < m_DestHeight; i ++) { for (int j = 0; j < Bpp; j ++) { *src_scan++ = dest_scan[j]; } dest_scan += y_step; } - FX_LPBYTE src_alpha_scan = m_pScanlineAlphaV; - FX_LPBYTE dest_alpha_scan = dest_alpha_buf; + uint8_t* src_alpha_scan = m_pScanlineAlphaV; + uint8_t* dest_alpha_scan = dest_alpha_buf; if (dest_alpha_scan) { for (i = 0; i < m_DestHeight; i ++) { *src_alpha_scan++ = *dest_alpha_scan; dest_alpha_scan += y_alpha_step; } } - FX_LPBYTE clip_scan = NULL; + uint8_t* clip_scan = NULL; if (m_pClipMask) { clip_scan = m_pClipScanV; int clip_pitch = m_pClipMask->GetPitch(); - FX_LPCBYTE src_clip = m_pClipMask->GetBuffer() + (m_DestTop - m_pClipRgn->GetBox().top) * + const uint8_t* src_clip = m_pClipMask->GetBuffer() + (m_DestTop - m_pClipRgn->GetBox().top) * clip_pitch + (dest_x - m_pClipRgn->GetBox().left); if (m_bFlipY) { src_clip += clip_pitch * (m_DestHeight - 1); diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp index 0f866a7cc7..c8de6cae7c 100644 --- a/core/src/fxge/dib/fx_dib_convert.cpp +++ b/core/src/fxge/dib/fx_dib_convert.cpp @@ -279,16 +279,16 @@ FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap, int pal_type) _Obtain_Pal(m_aLut, m_cLut, m_pPalette, pal_type, win_mac_pal, m_lut); return TRUE; } -FX_BOOL _ConvertBuffer_1bppMask2Gray(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top) { uint8_t set_gray, reset_gray; set_gray = 0xff; reset_gray = 0x00; for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; + uint8_t* dest_scan = dest_buf + row * dest_pitch; FXSYS_memset8(dest_scan, reset_gray, width); - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row); + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row); for (int col = src_left; col < src_left + width; col ++) { if (src_scan[col / 8] & (1 << (7 - col % 8))) { *dest_scan = set_gray; @@ -298,17 +298,17 @@ FX_BOOL _ConvertBuffer_1bppMask2Gray(FX_LPBYTE dest_buf, int dest_pitch, int wid } return TRUE; } -FX_BOOL _ConvertBuffer_8bppMask2Gray(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_8bppMask2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top) { for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; FXSYS_memcpy32(dest_scan, src_scan, width); } return TRUE; } -FX_BOOL _ConvertBuffer_1bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { FX_DWORD* src_plt = pSrcBitmap->GetPalette(); @@ -319,7 +319,7 @@ FX_BOOL _ConvertBuffer_1bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt plt[0] = FXCMYK_TODIB(src_plt[0]); plt[1] = FXCMYK_TODIB(src_plt[1]); } else { - FX_LPBYTE bgr_ptr = (FX_LPBYTE)plt; + uint8_t* bgr_ptr = (uint8_t*)plt; bgr_ptr[0] = FXARGB_B(src_plt[0]); bgr_ptr[1] = FXARGB_G(src_plt[0]); bgr_ptr[2] = FXARGB_R(src_plt[0]); @@ -328,7 +328,7 @@ FX_BOOL _ConvertBuffer_1bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt bgr_ptr[5] = FXARGB_R(src_plt[1]); } ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); - pIccModule->TranslateScanline(pIccTransform, gray, (FX_LPCBYTE)plt, 2); + pIccModule->TranslateScanline(pIccTransform, gray, (const uint8_t*)plt, 2); } else { uint8_t reset_r, reset_g, reset_b, set_r, set_g, set_b; @@ -349,9 +349,9 @@ FX_BOOL _ConvertBuffer_1bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt gray[1] = FXRGB2GRAY(set_r, set_g, set_b); } for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; + uint8_t* dest_scan = dest_buf + row * dest_pitch; FXSYS_memset8(dest_scan, gray[0], width); - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row); + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row); for (int col = src_left; col < src_left + width; col ++) { if (src_scan[col / 8] & (1 << (7 - col % 8))) { *dest_scan = gray[1]; @@ -361,7 +361,7 @@ FX_BOOL _ConvertBuffer_1bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt } return TRUE; } -FX_BOOL _ConvertBuffer_8bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { FX_DWORD* src_plt = pSrcBitmap->GetPalette(); @@ -373,7 +373,7 @@ FX_BOOL _ConvertBuffer_8bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt plt[i] = FXCMYK_TODIB(src_plt[i]); } } else { - FX_LPBYTE bgr_ptr = (FX_LPBYTE)plt; + uint8_t* bgr_ptr = (uint8_t*)plt; for (int i = 0; i < 256; i ++) { *bgr_ptr++ = FXARGB_B(src_plt[i]); *bgr_ptr++ = FXARGB_G(src_plt[i]); @@ -381,7 +381,7 @@ FX_BOOL _ConvertBuffer_8bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt } } ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); - pIccModule->TranslateScanline(pIccTransform, gray, (FX_LPCBYTE)plt, 256); + pIccModule->TranslateScanline(pIccTransform, gray, (const uint8_t*)plt, 256); } else { if (pSrcBitmap->IsCmykImage()) { uint8_t r, g, b; @@ -396,15 +396,15 @@ FX_BOOL _ConvertBuffer_8bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt } } for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; for (int col = 0; col < width; col ++) { *dest_scan++ = gray[*src_scan++]; } } return TRUE; } -FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { int Bpp = pSrcBitmap->GetBPP() / 8; @@ -412,14 +412,14 @@ FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(FX_LPBYTE dest_buf, int dest_pitch, int wi ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (Bpp == 3 || pSrcBitmap->IsCmykImage()) { for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp; pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, width); } } else { for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 4; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 4; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1); dest_scan++; @@ -430,8 +430,8 @@ FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(FX_LPBYTE dest_buf, int dest_pitch, int wi } else { if (pSrcBitmap->IsCmykImage()) { for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 4; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 4; for (int col = 0; col < width; col ++) { uint8_t r, g, b; AdobeCMYK_to_sRGB1(FXSYS_GetCValue((FX_DWORD)src_scan[0]), FXSYS_GetMValue((FX_DWORD)src_scan[1]), FXSYS_GetYValue((FX_DWORD)src_scan[2]), FXSYS_GetKValue((FX_DWORD)src_scan[3]), @@ -442,8 +442,8 @@ FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(FX_LPBYTE dest_buf, int dest_pitch, int wi } } else { for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp; for (int col = 0; col < width; col ++) { *dest_scan++ = FXRGB2GRAY(src_scan[2], src_scan[1], src_scan[0]); src_scan += Bpp; @@ -453,14 +453,14 @@ FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(FX_LPBYTE dest_buf, int dest_pitch, int wi } return TRUE; } -inline void _ConvertBuffer_IndexCopy(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +inline void _ConvertBuffer_IndexCopy(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top) { if (pSrcBitmap->GetBPP() == 1) { for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; + uint8_t* dest_scan = dest_buf + row * dest_pitch; FXSYS_memset32(dest_scan, 0, width); - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row); + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row); for (int col = src_left; col < src_left + width; col ++) { if (src_scan[col / 8] & (1 << (7 - col % 8))) { *dest_scan = 1; @@ -470,13 +470,13 @@ inline void _ConvertBuffer_IndexCopy(FX_LPBYTE dest_buf, int dest_pitch, int wid } } else { for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; FXSYS_memcpy32(dest_scan, src_scan, width); } } } -FX_BOOL _ConvertBuffer_Plt2PltRgb8(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, FX_DWORD* dst_plt, void* pIccTransform) { _ConvertBuffer_IndexCopy(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top); @@ -484,7 +484,7 @@ FX_BOOL _ConvertBuffer_Plt2PltRgb8(FX_LPBYTE dest_buf, int dest_pitch, int width int plt_size = pSrcBitmap->GetPaletteSize(); if (pIccTransform) { FX_DWORD plt[256]; - FX_LPBYTE bgr_ptr = (FX_LPBYTE)plt; + uint8_t* bgr_ptr = (uint8_t*)plt; if (pSrcBitmap->IsCmykImage()) { for (int i = 0; i < plt_size; i ++) { plt[i] = FXCMYK_TODIB(src_plt[i]); @@ -495,10 +495,10 @@ FX_BOOL _ConvertBuffer_Plt2PltRgb8(FX_LPBYTE dest_buf, int dest_pitch, int width *bgr_ptr++ = FXARGB_G(src_plt[i]); *bgr_ptr++ = FXARGB_R(src_plt[i]); } - bgr_ptr = (FX_LPBYTE)plt; + bgr_ptr = (uint8_t*)plt; } ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)plt, (FX_LPCBYTE)plt, plt_size); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)plt, (const uint8_t*)plt, plt_size); for (int i = 0; i < plt_size; i ++) { dst_plt[i] = FXARGB_MAKE(0xff, bgr_ptr[2], bgr_ptr[1], bgr_ptr[0]); bgr_ptr += 3; @@ -517,7 +517,7 @@ FX_BOOL _ConvertBuffer_Plt2PltRgb8(FX_LPBYTE dest_buf, int dest_pitch, int width } return TRUE; } -inline FX_BOOL _ConvertBuffer_Rgb2PltRgb8_NoTransform(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +inline FX_BOOL _ConvertBuffer_Rgb2PltRgb8_NoTransform(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, FX_DWORD* dst_plt) { int bpp = pSrcBitmap->GetBPP() / 8; @@ -573,7 +573,7 @@ inline FX_BOOL _ConvertBuffer_Rgb2PltRgb8_NoTransform(FX_LPBYTE dest_buf, int de FXSYS_memcpy32(dst_plt, pPalette, sizeof(FX_DWORD) * 256); return TRUE; } -FX_BOOL _ConvertBuffer_Rgb2PltRgb8(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, FX_DWORD* dst_plt, void* pIccTransform) { FX_BOOL ret = _ConvertBuffer_Rgb2PltRgb8_NoTransform(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, dst_plt); @@ -582,13 +582,13 @@ FX_BOOL _ConvertBuffer_Rgb2PltRgb8(FX_LPBYTE dest_buf, int dest_pitch, int width for (int i = 0; i < 256; i++) { FX_ARGB* plt = dst_plt + i; FX_ARGB plt_entry = FXARGB_TODIB(*plt); - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&plt_entry, (FX_LPCBYTE)&plt_entry, 1); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&plt_entry, (const uint8_t*)&plt_entry, 1); *plt = FXARGB_TODIB(plt_entry); } } return ret; } -FX_BOOL _ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top) { int comps = (dst_format & 0xff) / 8; @@ -596,8 +596,8 @@ FX_BOOL _ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, set_gray = 0xff; reset_gray = 0x00; for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row); + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row); for (int col = src_left; col < src_left + width; col ++) { if (src_scan[col / 8] & (1 << (7 - col % 8))) { dest_scan[0] = set_gray; @@ -613,13 +613,13 @@ FX_BOOL _ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, } return TRUE; } -FX_BOOL _ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top) { int comps = (dst_format & 0xff) / 8; for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; uint8_t src_pixel; for (int col = 0; col < width; col ++) { src_pixel = *src_scan++; @@ -631,13 +631,13 @@ FX_BOOL _ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, } return TRUE; } -FX_BOOL _ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { int comps = (dst_format & 0xff) / 8; FX_DWORD* src_plt = pSrcBitmap->GetPalette(); FX_DWORD plt[2]; - FX_LPBYTE bgr_ptr = (FX_LPBYTE)plt; + uint8_t* bgr_ptr = (uint8_t*)plt; if (pSrcBitmap->IsCmykImage()) { plt[0] = FXCMYK_TODIB(src_plt[0]); plt[1] = FXCMYK_TODIB(src_plt[1]); @@ -651,7 +651,7 @@ FX_BOOL _ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, } if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)plt, (FX_LPCBYTE)plt, 2); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)plt, (const uint8_t*)plt, 2); } else { if (pSrcBitmap->IsCmykImage()) { AdobeCMYK_to_sRGB1(FXSYS_GetCValue(src_plt[0]), FXSYS_GetMValue(src_plt[0]), FXSYS_GetYValue(src_plt[0]), FXSYS_GetKValue(src_plt[0]), @@ -661,8 +661,8 @@ FX_BOOL _ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, } } for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row); + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row); for (int col = src_left; col < src_left + width; col ++) { if (src_scan[col / 8] & (1 << (7 - col % 8))) { *dest_scan++ = bgr_ptr[3]; @@ -678,20 +678,20 @@ FX_BOOL _ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, } return TRUE; } -FX_BOOL _ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { int comps = (dst_format & 0xff) / 8; FX_DWORD* src_plt = pSrcBitmap->GetPalette(); FX_DWORD plt[256]; - FX_LPBYTE bgr_ptr = (FX_LPBYTE)plt; + uint8_t* bgr_ptr = (uint8_t*)plt; if (!pSrcBitmap->IsCmykImage()) { for (int i = 0; i < 256; i++) { *bgr_ptr++ = FXARGB_B(src_plt[i]); *bgr_ptr++ = FXARGB_G(src_plt[i]); *bgr_ptr++ = FXARGB_R(src_plt[i]); } - bgr_ptr = (FX_LPBYTE)plt; + bgr_ptr = (uint8_t*)plt; } if (pIccTransform) { if (pSrcBitmap->IsCmykImage()) { @@ -700,7 +700,7 @@ FX_BOOL _ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, } } ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)plt, (FX_LPCBYTE)plt, 256); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)plt, (const uint8_t*)plt, 256); } else { if (pSrcBitmap->IsCmykImage()) { for (int i = 0; i < 256; i++) { @@ -708,14 +708,14 @@ FX_BOOL _ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, bgr_ptr[2], bgr_ptr[1], bgr_ptr[0]); bgr_ptr += 3; } - bgr_ptr = (FX_LPBYTE)plt; + bgr_ptr = (uint8_t*)plt; } } for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; for (int col = 0; col < width; col ++) { - FX_LPBYTE src_pixel = bgr_ptr + 3 * (*src_scan++); + uint8_t* src_pixel = bgr_ptr + 3 * (*src_scan++); *dest_scan++ = *src_pixel++; *dest_scan++ = *src_pixel++; *dest_scan = *src_pixel++; @@ -724,31 +724,31 @@ FX_BOOL _ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, } return TRUE; } -FX_BOOL _ConvertBuffer_24bppRgb2Rgb24(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_24bppRgb2Rgb24(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 3; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 3; pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, width); } } else { for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 3; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 3; FXSYS_memcpy32(dest_scan, src_scan, width * 3); } } return TRUE; } -FX_BOOL _ConvertBuffer_32bppRgb2Rgb24(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 4; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 4; for (int col = 0; col < width; col ++) { *dest_scan++ = *src_scan++; *dest_scan++ = *src_scan++; @@ -759,21 +759,21 @@ FX_BOOL _ConvertBuffer_32bppRgb2Rgb24(FX_LPBYTE dest_buf, int dest_pitch, int wi if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; + uint8_t* dest_scan = dest_buf + row * dest_pitch; pIccModule->TranslateScanline(pIccTransform, dest_scan, dest_scan, width); } } return TRUE; } -FX_BOOL _ConvertBuffer_Rgb2Rgb32(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { int comps = pSrcBitmap->GetBPP() / 8; if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * comps; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * comps; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1); dest_scan += 4; @@ -782,8 +782,8 @@ FX_BOOL _ConvertBuffer_Rgb2Rgb32(FX_LPBYTE dest_buf, int dest_pitch, int width, } } else { for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * comps; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * comps; for (int col = 0; col < width; col ++) { *dest_scan++ = *src_scan++; *dest_scan++ = *src_scan++; @@ -795,14 +795,14 @@ FX_BOOL _ConvertBuffer_Rgb2Rgb32(FX_LPBYTE dest_buf, int dest_pitch, int width, } return TRUE; } -FX_BOOL _ConvertBuffer_32bppCmyk2Rgb32(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 4; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 4; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1); dest_scan += 4; @@ -811,8 +811,8 @@ FX_BOOL _ConvertBuffer_32bppCmyk2Rgb32(FX_LPBYTE dest_buf, int dest_pitch, int w } } else { for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 4; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 4; for (int col = 0; col < width; col ++) { AdobeCMYK_to_sRGB1(src_scan[0], src_scan[1], src_scan[2], src_scan[3], dest_scan[2], dest_scan[1], dest_scan[0]); @@ -823,7 +823,7 @@ FX_BOOL _ConvertBuffer_32bppCmyk2Rgb32(FX_LPBYTE dest_buf, int dest_pitch, int w } return TRUE; } -FX_BOOL ConvertBuffer(FXDIB_Format dest_format, FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, FX_DWORD*& d_pal, void* pIccTransform) { FXDIB_Format src_format = pSrcBitmap->GetFormat(); @@ -986,7 +986,7 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransfor if (dest_format == FXDIB_Argb && src_format == FXDIB_Rgb32 && pIccTransform == NULL) { m_AlphaFlag = 2; for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE scanline = m_pBuffer + row * m_Pitch + 3; + uint8_t* scanline = m_pBuffer + row * m_Pitch + 3; for (int col = 0; col < m_Width; col ++) { *scanline = 0xff; scanline += 4; @@ -996,7 +996,7 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransfor } int dest_bpp = dest_format & 0xff; int dest_pitch = (dest_bpp * m_Width + 31) / 32 * 4; - FX_LPBYTE dest_buf = FX_TryAlloc(uint8_t, dest_pitch * m_Height + 4); + uint8_t* dest_buf = FX_TryAlloc(uint8_t, dest_pitch * m_Height + 4); if (dest_buf == NULL) { return FALSE; } @@ -1005,8 +1005,8 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransfor FXSYS_memset8(dest_buf, 0xff, dest_pitch * m_Height + 4); if (m_pAlphaMask) { for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE pDstScanline = dest_buf + row * dest_pitch + 3; - FX_LPCBYTE pSrcScanline = m_pAlphaMask->GetScanline(row); + uint8_t* pDstScanline = dest_buf + row * dest_pitch + 3; + const uint8_t* pSrcScanline = m_pAlphaMask->GetScanline(row); for (int col = 0; col < m_Width; col ++) { *pDstScanline = *pSrcScanline++; pDstScanline += 4; diff --git a/core/src/fxge/dib/fx_dib_engine.cpp b/core/src/fxge/dib/fx_dib_engine.cpp index f52c30e95a..be39e35ce0 100644 --- a/core/src/fxge/dib/fx_dib_engine.cpp +++ b/core/src/fxge/dib/fx_dib_engine.cpp @@ -350,10 +350,10 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) rows_to_go = FX_STRECH_PAUSE_ROWS; } } - FX_LPCBYTE src_scan = m_pSource->GetScanline(m_CurRow); - FX_LPBYTE dest_scan = m_pInterBuf + (m_CurRow - m_SrcClip.top) * m_InterPitch; - FX_LPCBYTE src_scan_mask = NULL; - FX_LPBYTE dest_scan_mask = NULL; + const uint8_t* src_scan = m_pSource->GetScanline(m_CurRow); + uint8_t* dest_scan = m_pInterBuf + (m_CurRow - m_SrcClip.top) * m_InterPitch; + const uint8_t* src_scan_mask = NULL; + uint8_t* dest_scan_mask = NULL; if (m_pExtraAlphaBuf) { src_scan_mask = m_pSource->m_pAlphaMask->GetScanline(m_CurRow); dest_scan_mask = m_pExtraAlphaBuf + (m_CurRow - m_SrcClip.top) * m_ExtraMaskPitch; @@ -477,7 +477,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) int dest_r_y = 0, dest_g_m = 0, dest_b_c = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j ++) { int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart]; - FX_LPCBYTE src_pixel = src_scan + j * Bpp; + const uint8_t* src_pixel = src_scan + j * Bpp; dest_b_c += pixel_weight * (*src_pixel++); dest_g_m += pixel_weight * (*src_pixel++); dest_r_y += pixel_weight * (*src_pixel); @@ -500,7 +500,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) int dest_a = 0, dest_r_y = 0, dest_g_m = 0, dest_b_c = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j ++) { int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart]; - FX_LPCBYTE src_pixel = src_scan + j * Bpp; + const uint8_t* src_pixel = src_scan + j * Bpp; if (m_DestFormat == FXDIB_Argb) { pixel_weight = pixel_weight * src_pixel[3] / 255; } else { @@ -596,7 +596,7 @@ void CStretchEngine::StretchVert() int dest_r_y = 0, dest_g_m = 0, dest_b_c = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j ++) { int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart]; - FX_LPCBYTE src_pixel = src_scan + (j - m_SrcClip.top) * m_InterPitch; + const uint8_t* src_pixel = src_scan + (j - m_SrcClip.top) * m_InterPitch; dest_b_c += pixel_weight * (*src_pixel++); dest_g_m += pixel_weight * (*src_pixel++); dest_r_y += pixel_weight * (*src_pixel); @@ -624,7 +624,7 @@ void CStretchEngine::StretchVert() int dest_a = 0, dest_r_y = 0, dest_g_m = 0, dest_b_c = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j ++) { int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart]; - FX_LPCBYTE src_pixel = src_scan + (j - m_SrcClip.top) * m_InterPitch; + const uint8_t* src_pixel = src_scan + (j - m_SrcClip.top) * m_InterPitch; int mask_v = 255; if (src_scan_mask) { mask_v = src_scan_mask[(j - m_SrcClip.top) * m_ExtraMaskPitch]; diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp index f02dd6e382..ddbe554a04 100644 --- a/core/src/fxge/dib/fx_dib_main.cpp +++ b/core/src/fxge/dib/fx_dib_main.cpp @@ -9,7 +9,7 @@ #include "../../../include/fxcodec/fx_codec.h" #include "dib_int.h" #include <limits.h> -FX_BOOL ConvertBuffer(FXDIB_Format dest_format, FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, FX_DWORD*& pal, void* pIccTransform); void CmykDecode(FX_DWORD cmyk, int& c, int& m, int& y, int& k) { @@ -59,7 +59,7 @@ CFX_DIBitmap::CFX_DIBitmap() m_pPalette = NULL; } #define _MAX_OOM_LIMIT_ 12000000 -FX_BOOL CFX_DIBitmap::Create(int width, int height, FXDIB_Format format, FX_LPBYTE pBuffer, int pitch) +FX_BOOL CFX_DIBitmap::Create(int width, int height, FXDIB_Format format, uint8_t* pBuffer, int pitch) { m_pBuffer = NULL; m_bpp = (uint8_t)format; @@ -188,8 +188,8 @@ CFX_DIBitmap* CFX_DIBSource::Clone(const FX_RECT* pClip) const copy_len = m_Pitch; } for (int row = rect.top; row < rect.bottom; row ++) { - FX_LPCBYTE src_scan = GetScanline(row) + rect.left * m_bpp / 8; - FX_LPBYTE dest_scan = (FX_LPBYTE)pNewBitmap->GetScanline(row - rect.top); + const uint8_t* src_scan = GetScanline(row) + rect.left * m_bpp / 8; + uint8_t* dest_scan = (uint8_t*)pNewBitmap->GetScanline(row - rect.top); FXSYS_memcpy32(dest_scan, src_scan, copy_len); } } @@ -386,8 +386,8 @@ FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left, int dest_top, int width, int if (dest_format == src_format && pIccTransform == NULL) { if (GetBPP() == 1) { for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = m_pBuffer + (dest_top + row) * m_Pitch; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row); + uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row); for (int col = 0; col < width; col ++) { if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) { dest_scan[(dest_left + col) / 8] |= 1 << (7 - (dest_left + col) % 8); @@ -399,8 +399,8 @@ FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left, int dest_top, int width, int } else { int Bpp = GetBPP() / 8; for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * Bpp; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp; + uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * Bpp; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp; FXSYS_memcpy32(dest_scan, src_scan, width * Bpp); } } @@ -411,7 +411,7 @@ FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left, int dest_top, int width, int if (m_bpp == 8) { dest_format = FXDIB_8bppMask; } - FX_LPBYTE dest_buf = m_pBuffer + dest_top * m_Pitch + dest_left * GetBPP() / 8; + uint8_t* dest_buf = m_pBuffer + dest_top * m_Pitch + dest_left * GetBPP() / 8; FX_DWORD* d_plt = NULL; if(!ConvertBuffer(dest_format, dest_buf, m_Pitch, width, height, pSrcBitmap, src_left, src_top, d_plt, pIccTransform)) { return FALSE; @@ -444,7 +444,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, int dest_top, int width, int h alpha = FXARGB_A(color); dst_color = FXARGB_TODIB(color); } - FX_LPBYTE color_p = (FX_LPBYTE)&dst_color; + uint8_t* color_p = (uint8_t*)&dst_color; if (pIccTransform && CFX_GEModule::Get()->GetCodecModule() && CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); pIccModule->TranslateScanline(pIccTransform, color_p, color_p, 1); @@ -462,7 +462,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, int dest_top, int width, int h if (GetFormat() == FXDIB_Argb) { for (int row = 0; row < height; row ++) { FX_DWORD* dest_pos = (FX_DWORD*)(m_pBuffer + (dest_top + row) * m_Pitch + dest_left * 4); - FX_LPCBYTE src_scan = pMask->GetScanline(src_top + row); + const uint8_t* src_scan = pMask->GetScanline(src_top + row); if (src_bpp == 1) { for (int col = 0; col < width; col ++) { int src_bitpos = src_left + col; @@ -485,9 +485,9 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, int dest_top, int width, int h } else { int comps = m_bpp / 8; for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_color_pos = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * comps; - FX_LPBYTE dest_alpha_pos = (FX_LPBYTE)m_pAlphaMask->GetScanline(dest_top + row) + dest_left; - FX_LPCBYTE src_scan = pMask->GetScanline(src_top + row); + uint8_t* dest_color_pos = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * comps; + uint8_t* dest_alpha_pos = (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left; + const uint8_t* src_scan = pMask->GetScanline(src_top + row); if (src_bpp == 1) { for (int col = 0; col < width; col ++) { int src_bitpos = src_left + col; @@ -565,8 +565,8 @@ CFX_DIBitmap* CFX_DIBSource::GetAlphaMask(const FX_RECT* pClip) const return NULL; } for (int row = rect.top; row < rect.bottom; row ++) { - FX_LPCBYTE src_scan = GetScanline(row) + rect.left * 4 + 3; - FX_LPBYTE dest_scan = (FX_LPBYTE)pMask->GetScanline(row - rect.top); + const uint8_t* src_scan = GetScanline(row) + rect.left * 4 + 3; + uint8_t* dest_scan = (uint8_t*)pMask->GetScanline(row - rect.top); for (int col = rect.left; col < rect.right; col ++) { *dest_scan ++ = *src_scan; src_scan += 4; @@ -725,8 +725,8 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource int srcBytes = pSrcClone->GetBPP() / 8; int destBytes = pDst->GetBPP() / 8; for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE dest_pos = (FX_LPBYTE)pDst->GetScanline(row) + destOffset; - FX_LPCBYTE src_pos = pSrcClone->GetScanline(row) + srcOffset; + uint8_t* dest_pos = (uint8_t*)pDst->GetScanline(row) + destOffset; + const uint8_t* src_pos = pSrcClone->GetScanline(row) + srcOffset; for (int col = 0; col < m_Width; col ++) { *dest_pos = *src_pos; dest_pos += destBytes; @@ -791,7 +791,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) return TRUE; } for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE scan_line = m_pBuffer + row * m_Pitch + destOffset; + uint8_t* scan_line = m_pBuffer + row * m_Pitch + destOffset; for (int col = 0; col < m_Width; col ++) { *scan_line = value; scan_line += Bpp; @@ -827,8 +827,8 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) return FALSE; } for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE dest_scan = m_pBuffer + m_Pitch * row; - FX_LPBYTE src_scan = pSrcClone->m_pBuffer + pSrcClone->m_Pitch * row; + uint8_t* dest_scan = m_pBuffer + m_Pitch * row; + uint8_t* src_scan = pSrcClone->m_pBuffer + pSrcClone->m_Pitch * row; if (pSrcClone->GetBPP() == 1) { for (int col = 0; col < m_Width; col ++) { if (!((1 << (7 - col % 8)) & src_scan[col / 8])) { @@ -851,8 +851,8 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) return FALSE; } for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE dest_scan = m_pBuffer + m_Pitch * row + 3; - FX_LPBYTE src_scan = pSrcClone->m_pBuffer + pSrcClone->m_Pitch * row; + uint8_t* dest_scan = m_pBuffer + m_Pitch * row + 3; + uint8_t* src_scan = pSrcClone->m_pBuffer + pSrcClone->m_Pitch * row; for (int col = 0; col < m_Width; col ++) { *dest_scan = (*dest_scan) * src_scan[col] / 255; dest_scan += 4; @@ -891,8 +891,8 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) } FXSYS_memset8(pMask->GetBuffer(), gray[0], pMask->GetPitch() * m_Height); for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE src_pos = m_pBuffer + row * m_Pitch; - FX_LPBYTE dest_pos = (FX_LPBYTE)pMask->GetScanline(row); + uint8_t* src_pos = m_pBuffer + row * m_Pitch; + uint8_t* dest_pos = (uint8_t*)pMask->GetScanline(row); for (int col = 0; col < m_Width; col ++) { if (src_pos[col / 8] & (1 << (7 - col % 8))) { *dest_pos = gray[1]; @@ -921,8 +921,8 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) return FALSE; } for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE dest_pos = pMask->GetBuffer() + row * pMask->GetPitch(); - FX_LPBYTE src_pos = m_pBuffer + row * m_Pitch; + uint8_t* dest_pos = pMask->GetBuffer() + row * pMask->GetPitch(); + uint8_t* src_pos = m_pBuffer + row * m_Pitch; for (int col = 0; col < m_Width; col ++) { *dest_pos ++ = gray[*src_pos ++]; } @@ -938,8 +938,8 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) return FALSE; } for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE src_pos = m_pBuffer + row * m_Pitch; - FX_LPBYTE dest_pos = pMask->GetBuffer() + row * pMask->GetPitch(); + uint8_t* src_pos = m_pBuffer + row * m_Pitch; + uint8_t* dest_pos = pMask->GetBuffer() + row * pMask->GetPitch(); for (int col = 0; col < m_Width; col ++) { *dest_pos ++ = FXRGB2GRAY(src_pos[2], src_pos[1], *src_pos); src_pos += 3; @@ -956,8 +956,8 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) return FALSE; } for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE src_pos = m_pBuffer + row * m_Pitch; - FX_LPBYTE dest_pos = pMask->GetBuffer() + row * pMask->GetPitch(); + uint8_t* src_pos = m_pBuffer + row * m_Pitch; + uint8_t* dest_pos = pMask->GetBuffer() + row * pMask->GetPitch(); for (int col = 0; col < m_Width; col ++) { *dest_pos ++ = FXRGB2GRAY(src_pos[2], src_pos[1], *src_pos); src_pos += 4; @@ -986,7 +986,7 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(int alpha) break; case FXDIB_8bppMask: { for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE scan_line = m_pBuffer + row * m_Pitch; + uint8_t* scan_line = m_pBuffer + row * m_Pitch; for (int col = 0; col < m_Width; col ++) { scan_line[col] = scan_line[col] * alpha / 255; } @@ -995,7 +995,7 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(int alpha) } case FXDIB_Argb: { for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE scan_line = m_pBuffer + row * m_Pitch + 3; + uint8_t* scan_line = m_pBuffer + row * m_Pitch + 3; for (int col = 0; col < m_Width; col ++) { *scan_line = (*scan_line) * alpha / 255; scan_line += 4; @@ -1026,7 +1026,7 @@ FX_DWORD CFX_DIBitmap::GetPixel(int x, int y) const if (m_pBuffer == NULL) { return 0; } - FX_LPBYTE pos = m_pBuffer + y * m_Pitch + x * GetBPP() / 8; + uint8_t* pos = m_pBuffer + y * m_Pitch + x * GetBPP() / 8; switch (GetFormat()) { case FXDIB_1bppMask: { if ((*pos) & (1 << (7 - x % 8))) { @@ -1065,7 +1065,7 @@ void CFX_DIBitmap::SetPixel(int x, int y, FX_DWORD color) if (x < 0 || x >= m_Width || y < 0 || y >= m_Height) { return; } - FX_LPBYTE pos = m_pBuffer + y * m_Pitch + x * GetBPP() / 8; + uint8_t* pos = m_pBuffer + y * m_Pitch + x * GetBPP() / 8; switch (GetFormat()) { case FXDIB_1bppMask: if (color >> 24) { @@ -1127,14 +1127,14 @@ void CFX_DIBitmap::SetPixel(int x, int y, FX_DWORD color) break; } } -void CFX_DIBitmap::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_bpp, +void CFX_DIBitmap::DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const { if (m_pBuffer == NULL) { return; } int src_Bpp = m_bpp / 8; - FX_LPBYTE scanline = m_pBuffer + line * m_Pitch; + uint8_t* scanline = m_pBuffer + line * m_Pitch; if (src_Bpp == 0) { for (int i = 0; i < clip_width; i ++) { FX_DWORD dest_x = clip_left + i; @@ -1243,7 +1243,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) if (isCmykImage) { if (forecolor == 0xff && backcolor == 0x00) { for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE scanline = m_pBuffer + row * m_Pitch; + uint8_t* scanline = m_pBuffer + row * m_Pitch; for (int col = 0; col < m_Width; col ++) { uint8_t b, g, r; AdobeCMYK_to_sRGB1(scanline[0], scanline[1], scanline[2], scanline[3], @@ -1258,7 +1258,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) } } else if (forecolor == 0 && backcolor == 0xffffff) { for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE scanline = m_pBuffer + row * m_Pitch; + uint8_t* scanline = m_pBuffer + row * m_Pitch; int gap = m_bpp / 8 - 2; for (int col = 0; col < m_Width; col ++) { int gray = FXRGB2GRAY(scanline[2], scanline[1], scanline[0]); @@ -1272,7 +1272,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) } if (isCmykImage) { for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE scanline = m_pBuffer + row * m_Pitch; + uint8_t* scanline = m_pBuffer + row * m_Pitch; for (int col = 0; col < m_Width; col ++) { uint8_t b, g, r; AdobeCMYK_to_sRGB1(scanline[0], scanline[1], scanline[2], scanline[3], @@ -1286,7 +1286,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) } } else { for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE scanline = m_pBuffer + row * m_Pitch; + uint8_t* scanline = m_pBuffer + row * m_Pitch; int gap = m_bpp / 8 - 2; for (int col = 0; col < m_Width; col ++) { int gray = FXRGB2GRAY(scanline[2], scanline[1], scanline[0]); @@ -1327,8 +1327,8 @@ FX_BOOL CFX_DIBitmap::DitherFS(const FX_DWORD* pPalette, int pal_size, const FX_ } } for (int row = rect.top; row < rect.bottom; row ++) { - FX_LPBYTE scan = m_pBuffer + row * m_Pitch; - FX_LPBYTE next_scan = m_pBuffer + (row + 1) * m_Pitch; + uint8_t* scan = m_pBuffer + row * m_Pitch; + uint8_t* next_scan = m_pBuffer + (row + 1) * m_Pitch; for (int col = rect.left; col < rect.right; col ++) { int src_pixel = scan[col]; int dest_pixel = translate[src_pixel]; @@ -1390,11 +1390,11 @@ CFX_DIBitmap* CFX_DIBSource::FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const return NULL; } pFlipped->CopyPalette(m_pPalette); - FX_LPBYTE pDestBuffer = pFlipped->GetBuffer(); + uint8_t* pDestBuffer = pFlipped->GetBuffer(); int Bpp = m_bpp / 8; for (int row = 0; row < m_Height; row ++) { - FX_LPCBYTE src_scan = GetScanline(row); - FX_LPBYTE dest_scan = pDestBuffer + m_Pitch * (bYFlip ? (m_Height - row - 1) : row); + const uint8_t* src_scan = GetScanline(row); + uint8_t* dest_scan = pDestBuffer + m_Pitch * (bYFlip ? (m_Height - row - 1) : row); if (!bXFlip) { FXSYS_memcpy32(dest_scan, src_scan, m_Pitch); continue; @@ -1436,8 +1436,8 @@ CFX_DIBitmap* CFX_DIBSource::FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const pDestBuffer = pFlipped->m_pAlphaMask->GetBuffer(); FX_DWORD dest_pitch = pFlipped->m_pAlphaMask->GetPitch(); for (int row = 0; row < m_Height; row ++) { - FX_LPCBYTE src_scan = m_pAlphaMask->GetScanline(row); - FX_LPBYTE dest_scan = pDestBuffer + dest_pitch * (bYFlip ? (m_Height - row - 1) : row); + const uint8_t* src_scan = m_pAlphaMask->GetScanline(row); + uint8_t* dest_scan = pDestBuffer + dest_pitch * (bYFlip ? (m_Height - row - 1) : row); if (!bXFlip) { FXSYS_memcpy32(dest_scan, src_scan, dest_pitch); continue; @@ -1501,12 +1501,12 @@ void CFX_FilteredDIB::LoadSrc(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc) m_pPalette = GetDestPalette(); m_pScanline = FX_Alloc(uint8_t, m_Pitch); } -FX_LPCBYTE CFX_FilteredDIB::GetScanline(int line) const +const uint8_t* CFX_FilteredDIB::GetScanline(int line) const { TranslateScanline(m_pScanline, m_pSrc->GetScanline(line)); return m_pScanline; } -void CFX_FilteredDIB::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_bpp, +void CFX_FilteredDIB::DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const { m_pSrc->DownSampleScanline(line, dest_scan, dest_bpp, dest_width, bFlipX, clip_left, clip_width); @@ -1654,11 +1654,11 @@ void CFX_BitmapStorer::Replace(CFX_DIBitmap* pBitmap) } m_pBitmap = pBitmap; } -void CFX_BitmapStorer::ComposeScanline(int line, FX_LPCBYTE scanline, FX_LPCBYTE scan_extra_alpha) +void CFX_BitmapStorer::ComposeScanline(int line, const uint8_t* scanline, const uint8_t* scan_extra_alpha) { - FX_LPBYTE dest_buf = (FX_LPBYTE)m_pBitmap->GetScanline(line); - FX_LPBYTE dest_alpha_buf = m_pBitmap->m_pAlphaMask ? - (FX_LPBYTE)m_pBitmap->m_pAlphaMask->GetScanline(line) : NULL; + uint8_t* dest_buf = (uint8_t*)m_pBitmap->GetScanline(line); + uint8_t* dest_alpha_buf = m_pBitmap->m_pAlphaMask ? + (uint8_t*)m_pBitmap->m_pAlphaMask->GetScanline(line) : NULL; if (dest_buf) { FXSYS_memcpy32(dest_buf, scanline, m_pBitmap->GetPitch()); } diff --git a/core/src/fxge/dib/fx_dib_transform.cpp b/core/src/fxge/dib/fx_dib_transform.cpp index 073248823d..5a104c702d 100644 --- a/core/src/fxge/dib/fx_dib_transform.cpp +++ b/core/src/fxge/dib/fx_dib_transform.cpp @@ -71,7 +71,7 @@ CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, FX_BOOL bYFlip, const FX_REC } pTransBitmap->CopyPalette(m_pPalette); int dest_pitch = pTransBitmap->GetPitch(); - FX_LPBYTE dest_buf = pTransBitmap->GetBuffer(); + uint8_t* dest_buf = pTransBitmap->GetBuffer(); int row_start = bXFlip ? m_Height - dest_clip.right : dest_clip.left; int row_end = bXFlip ? m_Height - dest_clip.left : dest_clip.right; int col_start = bYFlip ? m_Width - dest_clip.bottom : dest_clip.top; @@ -79,9 +79,9 @@ CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, FX_BOOL bYFlip, const FX_REC if (GetBPP() == 1) { FXSYS_memset8(dest_buf, 0xff, dest_pitch * result_height); for (int row = row_start; row < row_end; row ++) { - FX_LPCBYTE src_scan = GetScanline(row); + const uint8_t* src_scan = GetScanline(row); int dest_col = (bXFlip ? dest_clip.right - (row - row_start) - 1 : row) - dest_clip.left; - FX_LPBYTE dest_scan = dest_buf; + uint8_t* dest_scan = dest_buf; if (bYFlip) { dest_scan += (result_height - 1) * dest_pitch; } @@ -101,7 +101,7 @@ CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, FX_BOOL bYFlip, const FX_REC } for (int row = row_start; row < row_end; row ++) { int dest_col = (bXFlip ? dest_clip.right - (row - row_start) - 1 : row) - dest_clip.left; - FX_LPBYTE dest_scan = dest_buf + dest_col * nBytes; + uint8_t* dest_scan = dest_buf + dest_col * nBytes; if (bYFlip) { dest_scan += (result_height - 1) * dest_pitch; } @@ -112,7 +112,7 @@ CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, FX_BOOL bYFlip, const FX_REC dest_scan += dest_step; } } else { - FX_LPCBYTE src_scan = GetScanline(row) + col_start * nBytes; + const uint8_t* src_scan = GetScanline(row) + col_start * nBytes; if (nBytes == 1) for (int col = col_start; col < col_end; col ++) { *dest_scan = *src_scan++; @@ -134,11 +134,11 @@ CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, FX_BOOL bYFlip, const FX_REC int dest_step = bYFlip ? -dest_pitch : dest_pitch; for (int row = row_start; row < row_end; row ++) { int dest_col = (bXFlip ? dest_clip.right - (row - row_start) - 1 : row) - dest_clip.left; - FX_LPBYTE dest_scan = dest_buf + dest_col; + uint8_t* dest_scan = dest_buf + dest_col; if (bYFlip) { dest_scan += (result_height - 1) * dest_pitch; } - FX_LPCBYTE src_scan = m_pAlphaMask->GetScanline(row) + col_start; + const uint8_t* src_scan = m_pAlphaMask->GetScanline(row) + col_start; for (int col = col_start; col < col_end; col ++) { *dest_scan = *src_scan++; dest_scan += dest_step; @@ -256,24 +256,24 @@ FX_BOOL CFX_ImageTransformer::Start(const CFX_DIBSource* pSrc, const CFX_AffineM m_Status = 3; return TRUE; } -uint8_t _bilinear_interpol(FX_LPCBYTE buf, int row_offset_l, int row_offset_r, +uint8_t _bilinear_interpol(const uint8_t* buf, int row_offset_l, int row_offset_r, int src_col_l, int src_col_r, int res_x, int res_y, int bpp, int c_offset) { int i_resx = 255 - res_x; int col_bpp_l = src_col_l * bpp; int col_bpp_r = src_col_r * bpp; - FX_LPCBYTE buf_u = buf + row_offset_l + c_offset; - FX_LPCBYTE buf_d = buf + row_offset_r + c_offset; - FX_LPCBYTE src_pos0 = buf_u + col_bpp_l; - FX_LPCBYTE src_pos1 = buf_u + col_bpp_r; - FX_LPCBYTE src_pos2 = buf_d + col_bpp_l; - FX_LPCBYTE src_pos3 = buf_d + col_bpp_r; + const uint8_t* buf_u = buf + row_offset_l + c_offset; + const uint8_t* buf_d = buf + row_offset_r + c_offset; + const uint8_t* src_pos0 = buf_u + col_bpp_l; + const uint8_t* src_pos1 = buf_u + col_bpp_r; + const uint8_t* src_pos2 = buf_d + col_bpp_l; + const uint8_t* src_pos3 = buf_d + col_bpp_r; uint8_t r_pos_0 = (*src_pos0 * i_resx + *src_pos1 * res_x) >> 8; uint8_t r_pos_1 = (*src_pos2 * i_resx + *src_pos3 * res_x) >> 8; return (r_pos_0 * (255 - res_y) + r_pos_1 * res_y) >> 8; } -uint8_t _bicubic_interpol(FX_LPCBYTE buf, int pitch, int pos_pixel[], int u_w[], int v_w[], int res_x, int res_y, +uint8_t _bicubic_interpol(const uint8_t* buf, int pitch, int pos_pixel[], int u_w[], int v_w[], int res_x, int res_y, int bpp, int c_offset) { int s_result = 0; @@ -358,8 +358,8 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) if (m_Storer.GetBitmap() == NULL) { return FALSE; } - FX_LPCBYTE stretch_buf = m_Storer.GetBitmap()->GetBuffer(); - FX_LPCBYTE stretch_buf_mask = NULL; + const uint8_t* stretch_buf = m_Storer.GetBitmap()->GetBuffer(); + const uint8_t* stretch_buf_mask = NULL; if (m_Storer.GetBitmap()->m_pAlphaMask) { stretch_buf_mask = m_Storer.GetBitmap()->m_pAlphaMask->GetBuffer(); } @@ -457,7 +457,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) if (!(m_Flags & FXDIB_DOWNSAMPLE) && !(m_Flags & FXDIB_BICUBIC_INTERPOL)) { CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); for (int row = 0; row < m_ResultHeight; row ++) { - FX_LPBYTE dest_scan = (FX_LPBYTE)pTransformed->GetScanline(row); + uint8_t* dest_scan = (uint8_t*)pTransformed->GetScanline(row); for (int col = 0; col < m_ResultWidth; col ++) { int src_col_l, src_row_l, res_x, res_y; result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, res_y); @@ -486,7 +486,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) { CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); for (int row = 0; row < m_ResultHeight; row ++) { - FX_LPBYTE dest_scan = (FX_LPBYTE)pTransformed->GetScanline(row); + uint8_t* dest_scan = (uint8_t*)pTransformed->GetScanline(row); for (int col = 0; col < m_ResultWidth; col ++) { int src_col_l, src_row_l, res_x, res_y; result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, res_y); @@ -508,7 +508,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) } else { CPDF_FixedMatrix result2stretch_fix(result2stretch, 8); for (int row = 0; row < m_ResultHeight; row ++) { - FX_LPBYTE dest_scan = (FX_LPBYTE)pTransformed->GetScanline(row); + uint8_t* dest_scan = (uint8_t*)pTransformed->GetScanline(row); for (int col = 0; col < m_ResultWidth; col ++) { int src_col, src_row; result2stretch_fix.Transform(col, row, src_col, src_row); @@ -519,7 +519,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) if (src_row == stretch_height) { src_row --; } - FX_LPCBYTE src_pixel = stretch_buf + stretch_pitch * src_row + src_col; + const uint8_t* src_pixel = stretch_buf + stretch_pitch * src_row + src_col; *dest_scan = *src_pixel; } dest_scan ++; @@ -756,7 +756,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) if (src_row == stretch_height) { src_row --; } - FX_LPCBYTE src_pos = stretch_buf + src_row * stretch_pitch + src_col * Bpp; + const uint8_t* src_pos = stretch_buf + src_row * stretch_pitch + src_col * Bpp; if (bHasAlpha) { if (transformF != FXDIB_Argb) { if (transformF == FXDIB_Rgba) { diff --git a/core/src/fxge/ge/fx_ge.cpp b/core/src/fxge/ge/fx_ge.cpp index dffc98962f..734d0d4eb7 100644 --- a/core/src/fxge/ge/fx_ge.cpp +++ b/core/src/fxge/ge/fx_ge.cpp @@ -65,7 +65,7 @@ void CFX_GEModule::SetTextGamma(FX_FLOAT gammaValue) i++; } } -FX_LPCBYTE CFX_GEModule::GetTextGammaTable() +const uint8_t* CFX_GEModule::GetTextGammaTable() { return m_GammaValue; } diff --git a/core/src/fxge/ge/fx_ge_device.cpp b/core/src/fxge/ge/fx_ge_device.cpp index 0b4ffd5f4c..8461396c1f 100644 --- a/core/src/fxge/ge/fx_ge_device.cpp +++ b/core/src/fxge/ge/fx_ge_device.cpp @@ -390,16 +390,16 @@ FX_BOOL CFX_RenderDevice::StretchBitMask(const CFX_DIBSource* pBitmap, int left, return m_pDeviceDriver->StretchDIBits(pBitmap, argb, left, top, dest_width, dest_height, &clip_box, flags, alpha_flag, pIccTransform); } FX_BOOL CFX_RenderDevice::StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD argb, - const CFX_AffineMatrix* pMatrix, FX_DWORD flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_mode) { return m_pDeviceDriver->StartDIBits(pBitmap, bitmap_alpha, argb, pMatrix, flags, handle, alpha_flag, pIccTransform, blend_mode); } -FX_BOOL CFX_RenderDevice::ContinueDIBits(FX_LPVOID handle, IFX_Pause* pPause) +FX_BOOL CFX_RenderDevice::ContinueDIBits(void* handle, IFX_Pause* pPause) { return m_pDeviceDriver->ContinueDIBits(handle, pPause); } -void CFX_RenderDevice::CancelDIBits(FX_LPVOID handle) +void CFX_RenderDevice::CancelDIBits(void* handle) { m_pDeviceDriver->CancelDIBits(handle); } diff --git a/core/src/fxge/ge/fx_ge_font.cpp b/core/src/fxge/ge/fx_ge_font.cpp index 8928d25d4c..21c1081480 100644 --- a/core/src/fxge/ge/fx_ge_font.cpp +++ b/core/src/fxge/ge/fx_ge_font.cpp @@ -8,7 +8,7 @@ #include "../../../include/fxge/fx_freetype.h" #include "text_int.h" #define EM_ADJUST(em, a) (em == 0?(a): (a)*1000/em) -extern void _FPDFAPI_GetInternalFontData(int id1, FX_LPCBYTE& data, FX_DWORD& size); +extern void _FPDFAPI_GetInternalFontData(int id1, const uint8_t*& data, FX_DWORD& size); CFX_Font::CFX_Font() { m_pSubstFont = NULL; @@ -153,7 +153,7 @@ int CFX_Font::GetGlyphWidth(FX_DWORD glyph_index) int width = EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Glyph_HoriAdvance(m_Face)); return width; } -static FXFT_Face FT_LoadFont(FX_LPBYTE pData, int size) +static FXFT_Face FT_LoadFont(uint8_t* pData, int size) { FXFT_Library library; if (CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary == NULL) { @@ -171,12 +171,12 @@ static FXFT_Face FT_LoadFont(FX_LPBYTE pData, int size) } return face; } -FX_BOOL CFX_Font::LoadEmbedded(FX_LPCBYTE data, FX_DWORD size) +FX_BOOL CFX_Font::LoadEmbedded(const uint8_t* data, FX_DWORD size) { m_pFontDataAllocation = FX_Alloc(uint8_t, size); FXSYS_memcpy32(m_pFontDataAllocation, data, size); - m_Face = FT_LoadFont((FX_LPBYTE)m_pFontDataAllocation, size); - m_pFontData = (FX_LPBYTE)m_pFontDataAllocation; + m_Face = FT_LoadFont((uint8_t*)m_pFontDataAllocation, size); + m_pFontData = (uint8_t*)m_pFontDataAllocation; m_bEmbedded = TRUE; m_dwSize = size; return m_Face != NULL; diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp index 9bb53c638f..afa9918690 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -117,7 +117,7 @@ FXFT_Face CFX_FontMgr::FindSubstFont(const CFX_ByteString& face_name, FX_BOOL bT CharsetCP, pSubstFont); } FXFT_Face CFX_FontMgr::GetCachedFace(const CFX_ByteString& face_name, - int weight, FX_BOOL bItalic, FX_LPBYTE& pFontData) + int weight, FX_BOOL bItalic, uint8_t*& pFontData) { CFX_ByteString key(face_name); key += ','; @@ -133,7 +133,7 @@ FXFT_Face CFX_FontMgr::GetCachedFace(const CFX_ByteString& face_name, return NULL; } FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name, - int weight, FX_BOOL bItalic, FX_LPBYTE pData, FX_DWORD size, int face_index) + int weight, FX_BOOL bItalic, uint8_t* pData, FX_DWORD size, int face_index) { CTTFontDesc* pFontDesc = new CTTFontDesc; pFontDesc->m_Type = 1; @@ -164,7 +164,7 @@ FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name, m_FaceMap.SetAt(key, pFontDesc); return pFontDesc->m_SingleFace.m_pFace; } -const FX_LPCSTR g_Base14FontNames[14] = { +const FX_CHAR* const g_Base14FontNames[14] = { "Courier", "Courier-Bold", "Courier-BoldOblique", @@ -278,7 +278,7 @@ g_AltFontNames[] = { extern "C" { static int compareString(const void* key, const void* element) { - return FXSYS_stricmp((FX_LPCSTR)key, ((_AltFontName*)element)->m_pName); + return FXSYS_stricmp((const FX_CHAR*)key, ((_AltFontName*)element)->m_pName); } } int _PDF_GetStandardFontName(CFX_ByteString& name) @@ -291,10 +291,10 @@ int _PDF_GetStandardFontName(CFX_ByteString& name) name = g_Base14FontNames[found->m_Index]; return found->m_Index; } -int GetTTCIndex(FX_LPCBYTE pFontData, FX_DWORD ttc_size, FX_DWORD font_offset) +int GetTTCIndex(const uint8_t* pFontData, FX_DWORD ttc_size, FX_DWORD font_offset) { int face_index = 0; - FX_LPCBYTE p = pFontData + 8; + const uint8_t* p = pFontData + 8; FX_DWORD nfont = GET_TT_LONG(p); FX_DWORD index; for (index = 0; index < nfont; index ++) { @@ -311,7 +311,7 @@ int GetTTCIndex(FX_LPCBYTE pFontData, FX_DWORD ttc_size, FX_DWORD font_offset) return face_index; } FXFT_Face CFX_FontMgr::GetCachedTTCFace(int ttc_size, FX_DWORD checksum, - int font_offset, FX_LPBYTE& pFontData) + int font_offset, uint8_t*& pFontData) { CFX_ByteString key; key.Format("%d:%d", ttc_size, checksum); @@ -329,7 +329,7 @@ FXFT_Face CFX_FontMgr::GetCachedTTCFace(int ttc_size, FX_DWORD checksum, return pFontDesc->m_TTCFace.m_pFaces[face_index]; } FXFT_Face CFX_FontMgr::AddCachedTTCFace(int ttc_size, FX_DWORD checksum, - FX_LPBYTE pData, FX_DWORD size, int font_offset) + uint8_t* pData, FX_DWORD size, int font_offset) { CFX_ByteString key; key.Format("%d:%d", ttc_size, checksum); @@ -346,7 +346,7 @@ FXFT_Face CFX_FontMgr::AddCachedTTCFace(int ttc_size, FX_DWORD checksum, pFontDesc->m_TTCFace.m_pFaces[face_index] = GetFixedFace(pFontDesc->m_pFontData, ttc_size, face_index); return pFontDesc->m_TTCFace.m_pFaces[face_index]; } -FXFT_Face CFX_FontMgr::GetFixedFace(FX_LPCBYTE pData, FX_DWORD size, int face_index) +FXFT_Face CFX_FontMgr::GetFixedFace(const uint8_t* pData, FX_DWORD size, int face_index) { FXFT_Library library; if (m_FTLibrary == NULL) { @@ -364,7 +364,7 @@ FXFT_Face CFX_FontMgr::GetFixedFace(FX_LPCBYTE pData, FX_DWORD size, int face_in } return face; } -FXFT_Face CFX_FontMgr::GetFileFace(FX_LPCSTR filename, int face_index) +FXFT_Face CFX_FontMgr::GetFileFace(const FX_CHAR* filename, int face_index) { FXFT_Library library; if (m_FTLibrary == NULL) { @@ -431,11 +431,11 @@ const FoxitFonts g_FoxitFonts[14] = { {g_FoxitSymbolFontData, 16729}, {g_FoxitDingbatsFontData, 29513}, }; -void _FPDFAPI_GetInternalFontData(int id, FX_LPCBYTE& data, FX_DWORD& size) +void _FPDFAPI_GetInternalFontData(int id, const uint8_t*& data, FX_DWORD& size) { CFX_GEModule::Get()->GetFontMgr()->GetStandardFont(data, size, id); } -FX_BOOL CFX_FontMgr::GetStandardFont(FX_LPCBYTE& pFontData, FX_DWORD& size, int index) +FX_BOOL CFX_FontMgr::GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index) { if (index > 15 || index < 0) { return FALSE; @@ -490,7 +490,7 @@ void CFX_FontMapper::SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) } m_pFontInfo = pFontInfo; } -static CFX_ByteString _TT_NormalizeName(FX_LPCSTR family) +static CFX_ByteString _TT_NormalizeName(const FX_CHAR* family) { CFX_ByteString norm(family, -1); norm.Remove(' '); @@ -503,12 +503,12 @@ static CFX_ByteString _TT_NormalizeName(FX_LPCSTR family) norm.MakeLower(); return norm; } -CFX_ByteString _FPDF_GetNameFromTT(FX_LPCBYTE name_table, FX_DWORD name_id) +CFX_ByteString _FPDF_GetNameFromTT(const uint8_t* name_table, FX_DWORD name_id) { - FX_LPCBYTE ptr = name_table + 2; + const uint8_t* ptr = name_table + 2; int name_count = GET_TT_SHORT(ptr); int string_offset = GET_TT_SHORT(ptr + 2); - FX_LPCBYTE string_ptr = name_table + string_offset; + const uint8_t* string_ptr = name_table + string_offset; ptr += 4; for (int i = 0; i < name_count; i ++) { if (GET_TT_SHORT(ptr + 6) == name_id && GET_TT_SHORT(ptr) == 1 && GET_TT_SHORT(ptr + 2) == 0) { @@ -527,10 +527,10 @@ static CFX_ByteString _FPDF_ReadStringFromFile(FXSYS_FILE* pFile, FX_DWORD size) buffer.ReleaseBuffer(size); return buffer; } -CFX_ByteString _FPDF_LoadTableFromTT(FXSYS_FILE* pFile, FX_LPCBYTE pTables, FX_DWORD nTables, FX_DWORD tag) +CFX_ByteString _FPDF_LoadTableFromTT(FXSYS_FILE* pFile, const uint8_t* pTables, FX_DWORD nTables, FX_DWORD tag) { for (FX_DWORD i = 0; i < nTables; i ++) { - FX_LPCBYTE p = pTables + i * 16; + const uint8_t* p = pTables + i * 16; if (GET_TT_LONG(p) == tag) { FX_DWORD offset = GET_TT_LONG(p + 8); FX_DWORD size = GET_TT_LONG(p + 12); @@ -540,10 +540,10 @@ CFX_ByteString _FPDF_LoadTableFromTT(FXSYS_FILE* pFile, FX_LPCBYTE pTables, FX_D } return CFX_ByteString(); } -CFX_ByteString _FPDF_LoadTableFromTTStreamFile(IFX_FileStream* pFile, FX_LPCBYTE pTables, FX_DWORD nTables, FX_DWORD tag) +CFX_ByteString _FPDF_LoadTableFromTTStreamFile(IFX_FileStream* pFile, const uint8_t* pTables, FX_DWORD nTables, FX_DWORD tag) { for (FX_DWORD i = 0; i < nTables; i ++) { - FX_LPCBYTE p = pTables + i * 16; + const uint8_t* p = pTables + i * 16; if (GET_TT_LONG(p) == tag) { FX_DWORD offset = GET_TT_LONG(p + 8); FX_DWORD size = GET_TT_LONG(p + 12); @@ -565,7 +565,7 @@ CFX_ByteString CFX_FontMapper::GetPSNameFromTT(void* hFont) CFX_ByteString result; FX_DWORD size = m_pFontInfo->GetFontData(hFont, 0x6e616d65, NULL, 0); if (size) { - FX_LPBYTE buffer = FX_Alloc(uint8_t, size); + uint8_t* buffer = FX_Alloc(uint8_t, size); m_pFontInfo->GetFontData(hFont, 0x6e616d65, buffer, size); result = _FPDF_GetNameFromTT(buffer, 6); FX_Free(buffer); @@ -584,7 +584,7 @@ void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) if (name == m_LastFamily) { return; } - FX_LPCBYTE ptr = name; + const uint8_t* ptr = name; FX_BOOL bLocalized = FALSE; for (int i = 0; i < name.GetLength(); i ++) if (ptr[i] > 0x80) { @@ -744,7 +744,7 @@ FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont, int iBaseF if (m_FoxitFaces[iBaseFont]) { return m_FoxitFaces[iBaseFont]; } - FX_LPCBYTE pFontData = NULL; + const uint8_t* pFontData = NULL; FX_DWORD size = 0; if (m_pFontMgr->GetStandardFont(pFontData, size, iBaseFont)) { m_FoxitFaces[iBaseFont] = m_pFontMgr->GetFixedFace(pFontData, size, 0); @@ -762,7 +762,7 @@ FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont, int iBaseF if (m_MMFaces[1]) { return m_MMFaces[1]; } - FX_LPCBYTE pFontData = NULL; + const uint8_t* pFontData = NULL; FX_DWORD size; m_pFontMgr->GetStandardFont(pFontData, size, 14); m_MMFaces[1] = m_pFontMgr->GetFixedFace(pFontData, size, 0); @@ -772,15 +772,15 @@ FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont, int iBaseF if (m_MMFaces[0]) { return m_MMFaces[0]; } - FX_LPCBYTE pFontData = NULL; + const uint8_t* pFontData = NULL; FX_DWORD size = 0; m_pFontMgr->GetStandardFont(pFontData, size, 15); m_MMFaces[0] = m_pFontMgr->GetFixedFace(pFontData, size, 0); return m_MMFaces[0]; } const struct _AltFontFamily { - FX_LPCSTR m_pFontName; - FX_LPCSTR m_pFontFamily; + const FX_CHAR* m_pFontName; + const FX_CHAR* m_pFontFamily; } g_AltFontFamilies[] = { {"AGaramondPro", "Adobe Garamond Pro"}, @@ -790,11 +790,11 @@ g_AltFontFamilies[] = { extern "C" { static int compareFontFamilyString(const void* key, const void* element) { - CFX_ByteString str_key((FX_LPCSTR)key); + CFX_ByteString str_key((const FX_CHAR*)key); if (str_key.Find(((_AltFontFamily*)element)->m_pFontName) != -1) { return 0; } - return FXSYS_stricmp((FX_LPCSTR)key, ((_AltFontFamily*)element)->m_pFontName); + return FXSYS_stricmp((const FX_CHAR*)key, ((_AltFontFamily*)element)->m_pFontName); } } #define FX_FONT_STYLE_None 0x00 @@ -823,7 +823,7 @@ static CFX_ByteString _GetFontFamily(CFX_ByteString fontName, int nStyle) return found->m_pFontFamily; }; typedef struct _FX_FontStyle { - FX_LPCSTR style; + const FX_CHAR* style; int32_t len; } FX_FontStyle; const FX_FontStyle g_FontStyles[] = { @@ -833,7 +833,7 @@ const FX_FontStyle g_FontStyles[] = { { "Reg", 3 }, { "Regular", 7 }, }; -CFX_ByteString ParseStyle(FX_LPCSTR pStyle, int iLen, int iIndex) +CFX_ByteString ParseStyle(const FX_CHAR* pStyle, int iLen, int iIndex) { CFX_ByteTextBuf buf; if (!iLen || iLen <= iIndex) { @@ -903,7 +903,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru if (m_FoxitFaces[12]) { return m_FoxitFaces[12]; } - FX_LPCBYTE pFontData = NULL; + const uint8_t* pFontData = NULL; FX_DWORD size = 0; m_pFontMgr->GetStandardFont(pFontData, size, 12); m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0); @@ -916,7 +916,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru if (m_FoxitFaces[13]) { return m_FoxitFaces[13]; } - FX_LPCBYTE pFontData = NULL; + const uint8_t* pFontData = NULL; FX_DWORD size = 0; m_pFontMgr->GetStandardFont(pFontData, size, 13); m_FoxitFaces[13] = m_pFontMgr->GetFixedFace(pFontData, size, 0); @@ -994,7 +994,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru } if (!style.IsEmpty()) { int nLen = style.GetLength(); - FX_LPCSTR pStyle = style; + const FX_CHAR* pStyle = style; int i = 0; FX_BOOL bFirstItem = TRUE; CFX_ByteString buf; @@ -1156,7 +1156,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru if (m_FoxitFaces[12]) { return m_FoxitFaces[12]; } - FX_LPCBYTE pFontData = NULL; + const uint8_t* pFontData = NULL; FX_DWORD size = 0; m_pFontMgr->GetStandardFont(pFontData, size, 12); m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0); @@ -1204,7 +1204,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru for (int i = 0; i < 256; i ++) { checksum += ((FX_DWORD*)temp)[i]; } - FX_LPBYTE pFontData; + uint8_t* pFontData; face = m_pFontMgr->GetCachedTTCFace(ttc_size, checksum, ttc_size - font_size, pFontData); if (face == NULL) { pFontData = FX_Alloc(uint8_t, ttc_size); @@ -1213,7 +1213,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru ttc_size - font_size); } } else { - FX_LPBYTE pFontData; + uint8_t* pFontData; face = m_pFontMgr->GetCachedFace(SubstName, weight, bItalic, pFontData); if (face == NULL) { pFontData = FX_Alloc(uint8_t, font_size); @@ -1293,7 +1293,7 @@ CFX_FolderFontInfo::~CFX_FolderFontInfo() FX_POSITION pos = m_FontList.GetStartPosition(); while (pos) { CFX_ByteString key; - FX_LPVOID value; + void* value; m_FontList.GetNextAssoc(pos, key, value); delete (CFontFaceInfo*)value; } @@ -1372,7 +1372,7 @@ void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path) return; } FX_DWORD face_bytes = nFaces * 4; - FX_LPBYTE offsets = FX_Alloc(uint8_t, face_bytes); + uint8_t* offsets = FX_Alloc(uint8_t, face_bytes); readCnt = FXSYS_fread(offsets, face_bytes, 1, pFile); if (readCnt != face_bytes) { FX_Free(offsets); @@ -1380,7 +1380,7 @@ void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path) return; } for (FX_DWORD i = 0; i < nFaces; i ++) { - FX_LPBYTE p = offsets + i * 4; + uint8_t* p = offsets + i * 4; ReportFace(path, pFile, filesize, GET_TT_LONG(p)); } FX_Free(offsets); @@ -1407,7 +1407,7 @@ void CFX_FolderFontInfo::ReportFace(CFX_ByteString& path, FXSYS_FILE* pFile, FX_ if (style != "Regular") { facename += " " + style; } - FX_LPVOID p; + void* p; if (m_FontList.Lookup(facename, p)) { return; } @@ -1420,7 +1420,7 @@ void CFX_FolderFontInfo::ReportFace(CFX_ByteString& path, FXSYS_FILE* pFile, FX_ pInfo->m_Charsets = 0; CFX_ByteString os2 = _FPDF_LoadTableFromTT(pFile, tables, nTables, 0x4f532f32); if (os2.GetLength() >= 86) { - FX_LPCBYTE p = (FX_LPCBYTE)os2 + 78; + const uint8_t* p = (const uint8_t*)os2 + 78; FX_DWORD codepages = GET_TT_LONG(p); if (codepages & (1 << 17)) { m_pMapper->AddInstalledFont(facename, FXFONT_SHIFTJIS_CHARSET); @@ -1457,19 +1457,19 @@ void CFX_FolderFontInfo::ReportFace(CFX_ByteString& path, FXSYS_FILE* pFile, FX_ } m_FontList.SetAt(facename, pInfo); } -void* CFX_FolderFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR family, FX_BOOL& bExact) +void* CFX_FolderFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL& bExact) { return NULL; } -void* CFX_FolderFontInfo::GetFont(FX_LPCSTR face) +void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) { - FX_LPVOID p; + void* p; if (!m_FontList.Lookup(face, p)) { return NULL; } return p; } -FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffer, FX_DWORD size) +FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer, FX_DWORD size) { if (hFont == NULL) { return 0; @@ -1493,7 +1493,7 @@ FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE } else { FX_DWORD nTables = pFont->m_FontTables.GetLength() / 16; for (FX_DWORD i = 0; i < nTables; i ++) { - FX_LPCBYTE p = (FX_LPCBYTE)pFont->m_FontTables + i * 16; + const uint8_t* p = (const uint8_t*)pFont->m_FontTables + i * 16; if (GET_TT_LONG(p) == table) { offset = GET_TT_LONG(p + 8); datasize = GET_TT_LONG(p + 12); diff --git a/core/src/fxge/ge/fx_ge_linux.cpp b/core/src/fxge/ge/fx_ge_linux.cpp index e2ed84e081..027c519fea 100644 --- a/core/src/fxge/ge/fx_ge_linux.cpp +++ b/core/src/fxge/ge/fx_ge_linux.cpp @@ -9,8 +9,8 @@ #include "text_int.h" #if _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ static const struct { - FX_LPCSTR m_pName; - FX_LPCSTR m_pSubstName; + const FX_CHAR* m_pName; + const FX_CHAR* m_pSubstName; } Base14Substs[] = { {"Courier", "Courier New"}, @@ -29,13 +29,13 @@ Base14Substs[] = { class CFX_LinuxFontInfo : public CFX_FolderFontInfo { public: - virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR family, FX_BOOL& bExact); + virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL& bExact); FX_BOOL ParseFontCfg(); - void* FindFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR family, FX_BOOL bMatchName); + void* FindFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL bMatchName); }; #define LINUX_GPNAMESIZE 6 static const struct { - FX_LPCSTR NameArr[LINUX_GPNAMESIZE]; + const FX_CHAR* NameArr[LINUX_GPNAMESIZE]; } LinuxGpFontList[] = { {{"TakaoPGothic", "VL PGothic", "IPAPGothic", "VL Gothic", "Kochi Gothic", "VL Gothic regular"}}, @@ -43,20 +43,20 @@ LinuxGpFontList[] = { {{"TakaoPMincho", "IPAPMincho", "VL Gothic", "Kochi Mincho", NULL, "VL Gothic regular"}}, {{"TakaoMincho", "IPAMincho", "VL Gothic", "Kochi Mincho", NULL, "VL Gothic regular"}}, }; -static const FX_LPCSTR g_LinuxGbFontList[] = { +static const FX_CHAR* const g_LinuxGbFontList[] = { "AR PL UMing CN Light", "WenQuanYi Micro Hei", "AR PL UKai CN", }; -static const FX_LPCSTR g_LinuxB5FontList[] = { +static const FX_CHAR* const g_LinuxB5FontList[] = { "AR PL UMing TW Light", "WenQuanYi Micro Hei", "AR PL UKai TW", }; -static const FX_LPCSTR g_LinuxHGFontList[] = { +static const FX_CHAR* const g_LinuxHGFontList[] = { "UnDotum", }; -static int32_t GetJapanesePreference(FX_LPCSTR facearr, int weight, int picth_family) +static int32_t GetJapanesePreference(const FX_CHAR* facearr, int weight, int picth_family) { CFX_ByteString face = facearr; if (face.Find("Gothic") >= 0 || face.Find("\x83\x53\x83\x56\x83\x62\x83\x4e") >= 0) { @@ -77,7 +77,7 @@ static int32_t GetJapanesePreference(FX_LPCSTR facearr, int weight, int picth_fa } return 2; } -void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR cstr_face, FX_BOOL& bExact) +void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* cstr_face, FX_BOOL& bExact) { CFX_ByteString face = cstr_face; int iBaseFont; @@ -90,7 +90,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int p if (iBaseFont < 12) { return GetFont(face); } - FX_LPVOID p = NULL; + void* p = NULL; FX_BOOL bCJK = TRUE; switch (charset) { case FXFONT_SHIFTJIS_CHARSET: { @@ -105,7 +105,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int p } break; case FXFONT_GB2312_CHARSET: { - static int32_t s_gbCount = sizeof(g_LinuxGbFontList) / sizeof(FX_LPCSTR); + static int32_t s_gbCount = sizeof(g_LinuxGbFontList) / sizeof(const FX_CHAR*); for (int32_t i = 0; i < s_gbCount; i++) if (m_FontList.Lookup(g_LinuxGbFontList[i], p)) { return p; @@ -113,7 +113,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int p } break; case FXFONT_CHINESEBIG5_CHARSET: { - static int32_t s_b5Count = sizeof(g_LinuxB5FontList) / sizeof(FX_LPCSTR); + static int32_t s_b5Count = sizeof(g_LinuxB5FontList) / sizeof(const FX_CHAR*); for (int32_t i = 0; i < s_b5Count; i++) if (m_FontList.Lookup(g_LinuxB5FontList[i], p)) { return p; @@ -121,7 +121,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int p } break; case FXFONT_HANGEUL_CHARSET: { - static int32_t s_hgCount = sizeof(g_LinuxHGFontList) / sizeof(FX_LPCSTR); + static int32_t s_hgCount = sizeof(g_LinuxHGFontList) / sizeof(const FX_CHAR*); for (int32_t i = 0; i < s_hgCount; i++) if (m_FontList.Lookup(g_LinuxHGFontList[i], p)) { return p; @@ -177,7 +177,7 @@ static int32_t _LinuxGetSimilarValue(int weight, FX_BOOL bItalic, int pitch_fami } return iSimilarValue; } -void* CFX_LinuxFontInfo::FindFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR family, FX_BOOL bMatchName) +void* CFX_LinuxFontInfo::FindFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL bMatchName) { CFontFaceInfo* pFind = NULL; FX_DWORD charset_flag = _LinuxGetCharset(charset); @@ -186,7 +186,7 @@ void* CFX_LinuxFontInfo::FindFont(int weight, FX_BOOL bItalic, int charset, int while (pos) { CFX_ByteString bsName; CFontFaceInfo* pFont = NULL; - m_FontList.GetNextAssoc(pos, bsName, (FX_LPVOID&)pFont); + m_FontList.GetNextAssoc(pos, bsName, (void*&)pFont); if (!(pFont->m_Charsets & charset_flag) && charset != FXFONT_DEFAULT_CHARSET) { continue; } diff --git a/core/src/fxge/ge/fx_ge_path.cpp b/core/src/fxge/ge/fx_ge_path.cpp index 51d5908a81..4ae7b42b39 100644 --- a/core/src/fxge/ge/fx_ge_path.cpp +++ b/core/src/fxge/ge/fx_ge_path.cpp @@ -65,8 +65,8 @@ void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect, FX_RECT mask_rect, CFX_DIBitma } new_dib->Create(m_Box.Width(), m_Box.Height(), FXDIB_8bppMask); for (int row = m_Box.top; row < m_Box.bottom; row ++) { - FX_LPBYTE dest_scan = new_dib->GetBuffer() + new_dib->GetPitch() * (row - m_Box.top); - FX_LPBYTE src_scan = mask_dib->GetBuffer() + mask_dib->GetPitch() * (row - mask_rect.top); + uint8_t* dest_scan = new_dib->GetBuffer() + new_dib->GetPitch() * (row - m_Box.top); + uint8_t* src_scan = mask_dib->GetBuffer() + mask_dib->GetPitch() * (row - mask_rect.top); for (int col = m_Box.left; col < m_Box.right; col ++) { dest_scan[col - m_Box.left] = src_scan[col - mask_rect.left]; } @@ -98,9 +98,9 @@ void CFX_ClipRgn::IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask) new_dib->Create(new_box.Width(), new_box.Height(), FXDIB_8bppMask); const CFX_DIBitmap* old_dib = m_Mask; for (int row = new_box.top; row < new_box.bottom; row ++) { - FX_LPBYTE old_scan = old_dib->GetBuffer() + (row - m_Box.top) * old_dib->GetPitch(); - FX_LPBYTE mask_scan = mask_dib->GetBuffer() + (row - top) * mask_dib->GetPitch(); - FX_LPBYTE new_scan = new_dib->GetBuffer() + (row - new_box.top) * new_dib->GetPitch(); + uint8_t* old_scan = old_dib->GetBuffer() + (row - m_Box.top) * old_dib->GetPitch(); + uint8_t* mask_scan = mask_dib->GetBuffer() + (row - top) * mask_dib->GetPitch(); + uint8_t* new_scan = new_dib->GetBuffer() + (row - new_box.top) * new_dib->GetPitch(); for (int col = new_box.left; col < new_box.right; col ++) { new_scan[col - new_box.left] = old_scan[col - m_Box.left] * mask_scan[col - left] / 255; } diff --git a/core/src/fxge/ge/fx_ge_ps.cpp b/core/src/fxge/ge/fx_ge_ps.cpp index 1829386755..c8e56ada85 100644 --- a/core/src/fxge/ge/fx_ge_ps.cpp +++ b/core/src/fxge/ge/fx_ge_ps.cpp @@ -131,7 +131,7 @@ void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData, const CFX_AffineM } } } - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); } void CFX_PSRenderer::SetClip_PathFill(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, @@ -163,7 +163,7 @@ void CFX_PSRenderer::SetClip_PathStroke(const CFX_PathData* pPathData, buf << FX_BSTRC("mx Cm [") << pObject2Device->a << FX_BSTRC(" ") << pObject2Device->b << FX_BSTRC(" ") << pObject2Device->c << FX_BSTRC(" ") << pObject2Device->d << FX_BSTRC(" ") << pObject2Device->e << FX_BSTRC(" ") << pObject2Device->f << FX_BSTRC("]cm "); - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); } OutputPath(pPathData, NULL); CFX_FloatRect rect = pPathData->GetBoundingBox(pGraphState->m_LineWidth, pGraphState->m_MiterLimit); @@ -204,7 +204,7 @@ FX_BOOL CFX_PSRenderer::DrawPath(const CFX_PathData* pPathData, buf << FX_BSTRC("mx Cm [") << pObject2Device->a << FX_BSTRC(" ") << pObject2Device->b << FX_BSTRC(" ") << pObject2Device->c << FX_BSTRC(" ") << pObject2Device->d << FX_BSTRC(" ") << pObject2Device->e << FX_BSTRC(" ") << pObject2Device->f << FX_BSTRC("]cm "); - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); } } OutputPath(pPathData, stroke_alpha ? NULL : pObject2Device); @@ -261,10 +261,10 @@ void CFX_PSRenderer::SetGraphState(const CFX_GraphStateData* pGraphState) m_CurGraphState.Copy(*pGraphState); m_bGraphStateSet = TRUE; if (buf.GetSize()) { - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); } } -static void FaxCompressData(FX_LPBYTE src_buf, int width, int height, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +static void FaxCompressData(uint8_t* src_buf, int width, int height, uint8_t*& dest_buf, FX_DWORD& dest_size) { CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); if (width * height > 128 && pEncoders && pEncoders->GetFaxModule()->Encode(src_buf, width, height, (width + 7) / 8, dest_buf, dest_size)) { @@ -274,8 +274,8 @@ static void FaxCompressData(FX_LPBYTE src_buf, int width, int height, FX_LPBYTE& dest_size = (width + 7) / 8 * height; } } -static void PSCompressData(int PSLevel, FX_LPBYTE src_buf, FX_DWORD src_size, - FX_LPBYTE& output_buf, FX_DWORD& output_size, FX_LPCSTR& filter) +static void PSCompressData(int PSLevel, uint8_t* src_buf, FX_DWORD src_size, + uint8_t*& output_buf, FX_DWORD& output_size, const FX_CHAR*& filter) { output_buf = src_buf; output_size = src_size; @@ -284,7 +284,7 @@ static void PSCompressData(int PSLevel, FX_LPBYTE src_buf, FX_DWORD src_size, return; } CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); - FX_LPBYTE dest_buf = NULL; + uint8_t* dest_buf = NULL; FX_DWORD dest_size = src_size; if (PSLevel >= 3) { if (pEncoders && pEncoders->GetFlateModule()->Encode(src_buf, src_size, dest_buf, dest_size)) { @@ -348,12 +348,12 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, if (pSource->GetBPP() == 1 && pSource->GetPalette() == NULL) { int pitch = (width + 7) / 8; FX_DWORD src_size = height * pitch; - FX_LPBYTE src_buf = FX_Alloc(uint8_t, src_size); + uint8_t* src_buf = FX_Alloc(uint8_t, src_size); for (int row = 0; row < height; row ++) { - FX_LPCBYTE src_scan = pSource->GetScanline(row); + const uint8_t* src_scan = pSource->GetScanline(row); FXSYS_memcpy32(src_buf + row * pitch, src_scan, pitch); } - FX_LPBYTE output_buf; + uint8_t* output_buf; FX_DWORD output_size; FaxCompressData(src_buf, width, height, output_buf, output_size); if (pSource->IsAlphaMask()) { @@ -373,7 +373,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, } else { buf << FX_BSTRC("false 1 colorimage\n"); } - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); WritePSBinary(output_buf, output_size); FX_Free(output_buf); } else { @@ -409,9 +409,9 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, return FALSE; } int Bpp = pConverted->GetBPP() / 8; - FX_LPBYTE output_buf = NULL; + uint8_t* output_buf = NULL; FX_STRSIZE output_size = 0; - FX_LPCSTR filter = NULL; + const FX_CHAR* filter = NULL; if (flags & FXRENDER_IMAGE_LOSSY) { CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); if (pEncoders && pEncoders->GetJpegModule()->Encode(pConverted, output_buf, output_size)) { @@ -423,8 +423,8 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, output_size = height * src_pitch; output_buf = FX_Alloc(uint8_t, output_size); for (int row = 0; row < height; row ++) { - FX_LPCBYTE src_scan = pConverted->GetScanline(row); - FX_LPBYTE dest_scan = output_buf + row * src_pitch; + const uint8_t* src_scan = pConverted->GetScanline(row); + uint8_t* dest_scan = output_buf + row * src_pitch; if (Bpp == 3) { for (int col = 0; col < width; col ++) { *dest_scan++ = src_scan[2]; @@ -436,7 +436,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, FXSYS_memcpy32(dest_scan, src_scan, src_pitch); } } - FX_LPBYTE compressed_buf; + uint8_t* compressed_buf; FX_DWORD compressed_size; PSCompressData(m_PSLevel, output_buf, output_size, compressed_buf, compressed_size, filter); if (output_buf != compressed_buf) { @@ -457,7 +457,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, } buf << FX_BSTRC("false ") << Bpp; buf << FX_BSTRC(" colorimage\n"); - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); WritePSBinary(output_buf, output_size); FX_Free(output_buf); } @@ -473,7 +473,7 @@ void CFX_PSRenderer::SetColor(FX_DWORD color, int alpha_flag, void* pIccTransfor if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); color = FXGETFLAG_COLORTYPE(alpha_flag) ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); - FX_LPBYTE pColor = (FX_LPBYTE)&color; + uint8_t* pColor = (uint8_t*)&color; pIccModule->TranslateScanline(pIccTransform, pColor, pColor, 1); color = m_bCmykOutput ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); bCMYK = m_bCmykOutput; @@ -493,7 +493,7 @@ void CFX_PSRenderer::SetColor(FX_DWORD color, int alpha_flag, void* pIccTransfor m_bColorSet = TRUE; m_LastColor = color; } - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); } } void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache, CFX_Font* pFont, const FXTEXT_CHARPOS& charpos, @@ -527,7 +527,7 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache, CFX_Font* pFont, "/BuildChar{1 index/Encoding get exch get 1 index/BuildGlyph get exec}bind def\n" "currentdict end\n"); buf << FX_BSTRC("/X") << m_PSFontList.GetSize() - 1 << FX_BSTRC(" exch definefont pop\n"); - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); buf.Clear(); } ps_fontnum = m_PSFontList.GetSize() - 1; @@ -586,7 +586,7 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache, CFX_Font* pFont, buf << FX_BSTRC("}bind def end\n"); buf << FX_BSTRC("/X") << ps_fontnum << FX_BSTRC(" Ff/Encoding get ") << ps_glyphindex << FX_BSTRC("/") << ps_glyphindex << FX_BSTRC(" put\n"); - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); } FX_BOOL CFX_PSRenderer::DrawText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, @@ -627,18 +627,18 @@ FX_BOOL CFX_PSRenderer::DrawText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX buf << hex << FX_BSTRC("Tj\n"); } buf << FX_BSTRC("Q\n"); - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); return TRUE; } -void CFX_PSRenderer::WritePSBinary(FX_LPCBYTE data, int len) +void CFX_PSRenderer::WritePSBinary(const uint8_t* data, int len) { - FX_LPBYTE dest_buf; + uint8_t* dest_buf; FX_DWORD dest_size; CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); if (pEncoders && pEncoders->GetBasicModule()->A85Encode(data, len, dest_buf, dest_size)) { - m_pOutput->OutputPS((FX_LPCSTR)dest_buf, dest_size); + m_pOutput->OutputPS((const FX_CHAR*)dest_buf, dest_size); FX_Free(dest_buf); } else { - m_pOutput->OutputPS((FX_LPCSTR)data, len); + m_pOutput->OutputPS((const FX_CHAR*)data, len); } } diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp index f3a720397b..1cdf5b2ef3 100644 --- a/core/src/fxge/ge/fx_ge_text.cpp +++ b/core/src/fxge/ge/fx_ge_text.cpp @@ -111,7 +111,7 @@ void _Color2Argb(FX_ARGB& argb, FX_DWORD color, int alpha_flag, void* pIccTransf if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); color = FXGETFLAG_COLORTYPE(alpha_flag) ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); - pIccModule->TranslateScanline(pIccTransform, bgra, (FX_LPCBYTE)&color, 1); + pIccModule->TranslateScanline(pIccTransform, bgra, (const uint8_t*)&color, 1); bgra[3] = FXGETFLAG_COLORTYPE(alpha_flag) ? (alpha_flag >> 24) ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXGETFLAG_ALPHA_STROKE(alpha_flag) : FXARGB_A(color); @@ -298,7 +298,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar } } int dest_width = pixel_width; - FX_LPBYTE dest_buf = bitmap.GetBuffer(); + uint8_t* dest_buf = bitmap.GetBuffer(); int dest_pitch = bitmap.GetPitch(); int Bpp = bitmap.GetBPP() / 8; int a, r, g, b; @@ -330,7 +330,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar FX_BOOL bBGRStripe = text_flags & FXTEXT_BGR_STRIPE; ncols /= 3; int x_subpixel = (int)(glyph.m_fOriginX * 3) % 3; - FX_LPBYTE src_buf = pGlyph->GetBuffer(); + uint8_t* src_buf = pGlyph->GetBuffer(); int src_pitch = pGlyph->GetPitch(); int start_col = left; if (start_col < 0) { @@ -349,8 +349,8 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar if (dest_row < 0 || dest_row >= bitmap.GetHeight()) { continue; } - FX_LPBYTE src_scan = src_buf + row * src_pitch + (start_col - left) * 3; - FX_LPBYTE dest_scan = dest_buf + dest_row * dest_pitch + (start_col << 2); + uint8_t* src_scan = src_buf + row * src_pitch + (start_col - left) * 3; + uint8_t* dest_scan = dest_buf + dest_row * dest_pitch + (start_col << 2); if (bBGRStripe) { if (x_subpixel == 0) { for (int col = start_col; col < end_col; col ++) { @@ -662,8 +662,8 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar if (dest_row < 0 || dest_row >= bitmap.GetHeight()) { continue; } - FX_LPBYTE src_scan = src_buf + row * src_pitch + (start_col - left) * 3; - FX_LPBYTE dest_scan = dest_buf + dest_row * dest_pitch + start_col * Bpp; + uint8_t* src_scan = src_buf + row * src_pitch + (start_col - left) * 3; + uint8_t* dest_scan = dest_buf + dest_row * dest_pitch + start_col * Bpp; if (bBGRStripe) { if (x_subpixel == 0) { for (int col = start_col; col < end_col; col ++) { @@ -1045,10 +1045,10 @@ CFX_FaceCache::~CFX_FaceCache() } m_SizeMap.RemoveAll(); pos = m_PathMap.GetStartPosition(); - FX_LPVOID key1; + void* key1; CFX_PathData* pPath; while (pos) { - m_PathMap.GetNextAssoc(pos, key1, (FX_LPVOID&)pPath); + m_PathMap.GetNextAssoc(pos, key1, (void*&)pPath); delete pPath; } if (m_pBitmap) { @@ -1071,14 +1071,14 @@ CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap(CFX_Font* pFont, const CFX_Aff m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); } CFX_GlyphBitmap* pGlyphBitmap = NULL; - if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(uintptr_t)glyph_index, (void*&)pGlyphBitmap)) { + if (pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)glyph_index, (void*&)pGlyphBitmap)) { return pGlyphBitmap; } pGlyphBitmap = RenderGlyph(pFont, glyph_index, bFontStyle, pMatrix, dest_width, anti_alias); if (pGlyphBitmap == NULL) { return NULL; } - pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)glyph_index, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap); return pGlyphBitmap; } const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD glyph_index, FX_BOOL bFontStyle, const CFX_AffineMatrix* pMatrix, @@ -1125,12 +1125,12 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD CFX_GlyphBitmap* pGlyphBitmap; CFX_SizeGlyphCache* pSizeCache = NULL; if (m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) { - if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(uintptr_t)glyph_index, (void*&)pGlyphBitmap)) { + if (pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)glyph_index, (void*&)pGlyphBitmap)) { return pGlyphBitmap; } pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_width, anti_alias); if (pGlyphBitmap) { - pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)glyph_index, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap); return pGlyphBitmap; } } else { @@ -1138,7 +1138,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD if (pGlyphBitmap) { pSizeCache = new CFX_SizeGlyphCache; m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); - pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)glyph_index, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap); return pGlyphBitmap; } } @@ -1158,7 +1158,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD CFX_SizeGlyphCache::~CFX_SizeGlyphCache() { FX_POSITION pos = m_GlyphMap.GetStartPosition(); - FX_LPVOID Key; + void* Key; CFX_GlyphBitmap* pGlyphBitmap = NULL; while(pos) { m_GlyphMap.GetNextAssoc(pos, Key, (void*&)pGlyphBitmap); @@ -1232,20 +1232,20 @@ static const uint8_t g_WeightPow_SHIFTJIS[WEIGHTPOW_ARRAY_SIZE] = { 55, 55, 55, 56, 56, 56, 56, 56 , 56, 57, 57, 57 , 57 , 57, 57, 57, 58, 58, 58, 58, 58, 58, 58, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 60, }; -static void _GammaAdjust(FX_LPBYTE pData, int nWid, int nHei, int src_pitch, FX_LPCBYTE gammaTable) +static void _GammaAdjust(uint8_t* pData, int nWid, int nHei, int src_pitch, const uint8_t* gammaTable) { int count = nHei * src_pitch; for(int i = 0; i < count; i++) { pData[i] = gammaTable[pData[i]]; } } -static void _ContrastAdjust(FX_LPBYTE pDataIn, FX_LPBYTE pDataOut, int nWid, int nHei, int nSrcRowBytes, int nDstRowBytes) +static void _ContrastAdjust(uint8_t* pDataIn, uint8_t* pDataOut, int nWid, int nHei, int nSrcRowBytes, int nDstRowBytes) { int col, row, temp; int max = 0, min = 255; FX_FLOAT rate; for (row = 0; row < nHei; row ++) { - FX_LPBYTE pRow = pDataIn + row * nSrcRowBytes; + uint8_t* pRow = pDataIn + row * nSrcRowBytes; for (col = 0; col < nWid; col++) { temp = *pRow ++; if (temp > max) { @@ -1266,8 +1266,8 @@ static void _ContrastAdjust(FX_LPBYTE pDataIn, FX_LPBYTE pDataOut, int nWid, int } rate = 255.f / temp; for (row = 0; row < nHei; row ++) { - FX_LPBYTE pSrcRow = pDataIn + row * nSrcRowBytes; - FX_LPBYTE pDstRow = pDataOut + row * nDstRowBytes; + uint8_t* pSrcRow = pDataIn + row * nSrcRowBytes; + uint8_t* pDstRow = pDataOut + row * nDstRowBytes; for (col = 0; col < nWid; col ++) { temp = (int)((*(pSrcRow++) - min) * rate + 0.5); if (temp > 255) { @@ -1407,15 +1407,15 @@ FX_BOOL _OutputGlyph(void* dib, int x, int y, CFX_Font* pFont, int bmheight = FXFT_Get_Bitmap_Rows(FXFT_Get_Glyph_Bitmap(face)); int left = FXFT_Get_Glyph_BitmapLeft(face); int top = FXFT_Get_Glyph_BitmapTop(face); - FX_LPCBYTE src_buf = (FX_LPCBYTE)FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(face)); + const uint8_t* src_buf = (const uint8_t*)FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(face)); int src_pitch = FXFT_Get_Bitmap_Pitch(FXFT_Get_Glyph_Bitmap(face)); CFX_DIBitmap mask; mask.Create(bmwidth, bmheight, FXDIB_8bppMask); - FX_LPBYTE dest_buf = mask.GetBuffer(); + uint8_t* dest_buf = mask.GetBuffer(); int dest_pitch = mask.GetPitch(); for (int row = 0; row < bmheight; row ++) { - FX_LPCBYTE src_scan = src_buf + row * src_pitch; - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = src_buf + row * src_pitch; + uint8_t* dest_scan = dest_buf + row * dest_pitch; FXSYS_memcpy32(dest_scan, src_scan, dest_pitch); } pDib->CompositeMask(x + left, y - top, bmwidth, bmheight, &mask, argb, 0, 0); @@ -1483,15 +1483,15 @@ const CFX_PathData* CFX_FaceCache::LoadGlyphPath(CFX_Font* pFont, FX_DWORD glyph return NULL; } CFX_PathData* pGlyphPath = NULL; - FX_LPVOID key; + void* key; if (pFont->GetSubstFont()) - key = (FX_LPVOID)(uintptr_t)(glyph_index + ((pFont->GetSubstFont()->m_Weight / 16) << 15) + + key = (void*)(uintptr_t)(glyph_index + ((pFont->GetSubstFont()->m_Weight / 16) << 15) + ((pFont->GetSubstFont()->m_ItalicAngle / 2) << 21) + ((dest_width / 16) << 25) + (pFont->IsVertical() << 31)); else { - key = (FX_LPVOID)(uintptr_t)glyph_index; + key = (void*)(uintptr_t)glyph_index; } - if (m_PathMap.Lookup(key, (FX_LPVOID&)pGlyphPath)) { + if (m_PathMap.Lookup(key, (void*&)pGlyphPath)) { return pGlyphPath; } pGlyphPath = pFont->LoadGlyphPath(glyph_index, dest_width); diff --git a/core/src/fxge/skia/fx_skia_blitter_new.cpp b/core/src/fxge/skia/fx_skia_blitter_new.cpp index 3b3bd3349c..362e8bf59f 100644 --- a/core/src/fxge/skia/fx_skia_blitter_new.cpp +++ b/core/src/fxge/skia/fx_skia_blitter_new.cpp @@ -73,10 +73,10 @@ blitV(x, y, height, rightAlpha); } /*---------------------------------------------------------------------------------------------------*/ - void CFX_SkiaRenderer::CompositeSpan1bpp_0(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpan1bpp_0(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_bRgbByteOrder); ASSERT(!m_pDevice->IsCmykImage()); @@ -94,7 +94,7 @@ if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) index = i; } - FX_LPBYTE dest_scan1 = dest_scan; + uint8_t* dest_scan1 = dest_scan; int src_alpha = m_Alpha * cover_scan / 255; for (int col = col_start; col < col_end; col ++) { if (src_alpha) { @@ -106,10 +106,10 @@ dest_scan1 = dest_scan+(span_left%8+col-col_start+1)/8; } } - void CFX_SkiaRenderer::CompositeSpan1bpp_4(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpan1bpp_4(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_bRgbByteOrder); ASSERT(!m_pDevice->IsCmykImage()); @@ -128,7 +128,7 @@ if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) index = i; } - FX_LPBYTE dest_scan1 = dest_scan; + uint8_t* dest_scan1 = dest_scan; int src_alpha = m_Alpha * cover_scan / 255; for (int col = col_start; col < col_end; col ++) { int src_alpha1 = src_alpha * clip_scan[col] / 255; @@ -142,10 +142,10 @@ } } /*-----------------------------------------------------------------------------------------------------*/ - void CFX_SkiaRenderer::CompositeSpanGray_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanGray_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); ASSERT(!m_bRgbByteOrder); @@ -164,10 +164,10 @@ dest_scan++; } } - void CFX_SkiaRenderer::CompositeSpanGray_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanGray_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); ASSERT(!m_bRgbByteOrder); @@ -207,10 +207,10 @@ } } - void CFX_SkiaRenderer::CompositeSpanGray_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanGray_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_bRgbByteOrder); dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left; @@ -235,10 +235,10 @@ } } - void CFX_SkiaRenderer::CompositeSpanGray_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanGray_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left; @@ -295,10 +295,10 @@ } /*--------------------------------------------------------------------------------------------------*/ - void CFX_SkiaRenderer::CompositeSpanARGB_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanARGB_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); int col_start = span_left < clip_left ? clip_left - span_left : 0; @@ -343,10 +343,10 @@ } } - void CFX_SkiaRenderer::CompositeSpanARGB_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanARGB_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); @@ -392,10 +392,10 @@ dest_scan += 2; } } - void CFX_SkiaRenderer::CompositeSpanARGB_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanARGB_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; @@ -507,10 +507,10 @@ #endif } - void CFX_SkiaRenderer::CompositeSpanARGB_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanARGB_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); @@ -557,10 +557,10 @@ } /*-----------------------------------------------------------------------------------------------------------*/ - void CFX_SkiaRenderer::CompositeSpanRGB32_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanRGB32_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); int col_start = span_left < clip_left ? clip_left - span_left : 0; @@ -588,10 +588,10 @@ dest_scan += 2; } } - void CFX_SkiaRenderer::CompositeSpanRGB32_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanRGB32_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left<<2); @@ -627,10 +627,10 @@ dest_scan += 2; } } - void CFX_SkiaRenderer::CompositeSpanRGB32_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanRGB32_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; @@ -705,10 +705,10 @@ } #endif } - void CFX_SkiaRenderer::CompositeSpanRGB32_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanRGB32_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); @@ -784,10 +784,10 @@ #endif } /*-----------------------------------------------------------------------------------------------------*/ - void CFX_SkiaRenderer::CompositeSpanRGB24_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanRGB24_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left + (span_left<<1); int col_start = span_left < clip_left ? clip_left - span_left : 0; @@ -818,10 +818,10 @@ dest_scan ++; } } - void CFX_SkiaRenderer::CompositeSpanRGB24_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanRGB24_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left + (span_left<<1); @@ -859,10 +859,10 @@ dest_scan ++; } } - void CFX_SkiaRenderer::CompositeSpanRGB24_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanRGB24_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1); clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; @@ -939,10 +939,10 @@ } #endif } - void CFX_SkiaRenderer::CompositeSpanRGB24_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanRGB24_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1); @@ -1017,10 +1017,10 @@ } #endif } - void CFX_SkiaRenderer::CompositeSpanRGB24_10(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanRGB24_10(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1); dest_extra_alpha_scan = (uint8_t*)m_pDevice->m_pAlphaMask->GetScanline(span_top)+span_left; @@ -1106,10 +1106,10 @@ } #endif } - void CFX_SkiaRenderer::CompositeSpanRGB24_14(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanRGB24_14(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1); dest_extra_alpha_scan = (uint8_t*)m_pDevice->m_pAlphaMask->GetScanline(span_top)+span_left; @@ -1211,10 +1211,10 @@ /*-----------------------------------------------------------------------------------------------------*/ // A general alpha merge function (with clipping mask). Cmyka/Cmyk device. - void CFX_SkiaRenderer::CompositeSpanCMYK(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanCMYK(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_bRgbByteOrder); // Cmyk(a) @@ -1353,7 +1353,7 @@ if (pIccTransform) { uint8_t gray; color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); - pIccModule->TranslateScanline(pIccTransform, &gray, (FX_LPCBYTE)&color, 1); + pIccModule->TranslateScanline(pIccTransform, &gray, (const uint8_t*)&color, 1); m_Gray = gray; } else { if (bObjectCMYK) { @@ -1374,31 +1374,31 @@ if (bObjectCMYK) { m_Color = FXCMYK_TODIB(color); if (pIccTransform) - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&m_Color, (FX_LPCBYTE)&m_Color, 1); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&m_Color, 1); } else { // Object RGB if (!pIccTransform) return FALSE; color = FXARGB_TODIB(color); - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&m_Color, (FX_LPCBYTE)&color, 1); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&color, 1); } - m_Red = ((FX_LPBYTE)&m_Color)[0]; - m_Green = ((FX_LPBYTE)&m_Color)[1]; - m_Blue = ((FX_LPBYTE)&m_Color)[2]; - m_Gray = ((FX_LPBYTE)&m_Color)[3]; + m_Red = ((uint8_t*)&m_Color)[0]; + m_Green = ((uint8_t*)&m_Color)[1]; + m_Blue = ((uint8_t*)&m_Color)[2]; + m_Gray = ((uint8_t*)&m_Color)[3]; return TRUE; } else { if (pIccTransform) { color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&m_Color, (FX_LPCBYTE)&color, 1); - ((FX_LPBYTE)&m_Color)[3] = m_Alpha; - m_Red = ((FX_LPBYTE)&m_Color)[2]; - m_Green = ((FX_LPBYTE)&m_Color)[1]; - m_Blue = ((FX_LPBYTE)&m_Color)[0]; + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&color, 1); + ((uint8_t*)&m_Color)[3] = m_Alpha; + m_Red = ((uint8_t*)&m_Color)[2]; + m_Green = ((uint8_t*)&m_Color)[1]; + m_Blue = ((uint8_t*)&m_Color)[0]; // Need Johnson to improvement it. if (m_bRgbByteOrder) { // swap - m_Red = ((FX_LPBYTE)&m_Color)[0]; - m_Blue = ((FX_LPBYTE)&m_Color)[2]; + m_Red = ((uint8_t*)&m_Color)[0]; + m_Blue = ((uint8_t*)&m_Color)[2]; m_Color = FXARGB_TODIB(m_Color); m_Color = FXARGB_TOBGRORDERDIB(m_Color); } @@ -1509,8 +1509,8 @@ if (dst_y < 0 || dst_y >= m_pDevice->GetHeight()) return; - FX_LPBYTE dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * dst_y; - FX_LPBYTE dest_pos = dest_scan; + uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * dst_y; + uint8_t* dest_pos = dest_scan; while (1) { if (x >= m_dstWidth) @@ -1546,7 +1546,7 @@ return; if (x >= m_dstWidth) return; - FX_LPBYTE dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * dst_y; + uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * dst_y; int col_start = x < m_Left ? 0 : x - m_Left; int col_end = x + width; col_end = col_end < m_dstWidth ? col_end - m_Left: m_pDevice->GetWidth(); diff --git a/core/src/fxge/skia/fx_skia_blitter_new.h b/core/src/fxge/skia/fx_skia_blitter_new.h index a80e56b2aa..8372ca3355 100644 --- a/core/src/fxge/skia/fx_skia_blitter_new.h +++ b/core/src/fxge/skia/fx_skia_blitter_new.h @@ -25,12 +25,12 @@ protected: const CFX_ClipRgn* m_pClipRgn; const CFX_DIBitmap* m_pClipMask; - FX_LPBYTE m_pDestScan; - FX_LPBYTE m_pDestExtraAlphaScan; - FX_LPBYTE m_pOriScan; - FX_LPBYTE m_pClipScan; + uint8_t* m_pDestScan; + uint8_t* m_pDestExtraAlphaScan; + uint8_t* m_pOriScan; + uint8_t* m_pClipScan; - void (CFX_SkiaRenderer::*composite_span)(FX_LPBYTE,FX_LPBYTE,int,int,int,int,uint8_t,int,int,int,FX_LPBYTE,FX_LPBYTE); + void (CFX_SkiaRenderer::*composite_span)(uint8_t*,uint8_t*,int,int,int,int,uint8_t,int,int,int,uint8_t*,uint8_t*); public: //-------------------------------------------------------------------- @@ -42,166 +42,166 @@ public: /*------------------------------------------------------------------------------------------------------*/ // A general alpha merge function (with clipping mask). Gray device. - void CompositeSpan1bpp_0(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpan1bpp_0(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); - void CompositeSpan1bpp_1(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpan1bpp_1(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); - void CompositeSpan1bpp_4(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpan1bpp_4(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); - void CompositeSpan1bpp_5(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpan1bpp_5(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); - void CompositeSpan1bpp_8(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpan1bpp_8(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); - void CompositeSpan1bpp_9(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpan1bpp_9(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); - void CompositeSpan1bpp_12(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpan1bpp_12(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); - void CompositeSpan1bpp_13(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpan1bpp_13(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); /*--------------------------------------------------------------------------------------------------------*/ // A general alpha merge function (with clipping mask). Gray device. - void CompositeSpanGray_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanGray_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); - void CompositeSpanGray_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanGray_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); - void CompositeSpanGray_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanGray_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); - void CompositeSpanGray_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanGray_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); - void CompositeSpanGray_10(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanGray_10(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); - void CompositeSpanGray_11(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanGray_11(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); - void CompositeSpanGray_14(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanGray_14(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); - void CompositeSpanGray_15(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanGray_15(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); /*--------------------------------------------------------------------------------------------------------*/ - void CompositeSpanARGB_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanARGB_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); - void CompositeSpanARGB_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanARGB_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); - void CompositeSpanARGB_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanARGB_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); - void CompositeSpanARGB_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanARGB_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); // ... /*--------------------------------------------------------------------------------------------------------*/ - void CompositeSpanRGB32_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanRGB32_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); - void CompositeSpanRGB32_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpanRGB32_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); - void CompositeSpanRGB32_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpanRGB32_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); - void CompositeSpanRGB32_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpanRGB32_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); /*---------------------------------------------------------------------------------------------------------*/ - void CompositeSpanRGB24_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanRGB24_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); - void CompositeSpanRGB24_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpanRGB24_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); - void CompositeSpanRGB24_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpanRGB24_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); - void CompositeSpanRGB24_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpanRGB24_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); - void CompositeSpanRGB24_10(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpanRGB24_10(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); - void CompositeSpanRGB24_11(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpanRGB24_11(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); - void CompositeSpanRGB24_14(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpanRGB24_14(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); - void CompositeSpanRGB24_15(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpanRGB24_15(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); /*----------------------------------------------------------------------------------------------------------*/ // A general alpha merge function (with clipping mask). Cmyka/Cmyk device. - void CompositeSpanCMYK(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanCMYK(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, int span_left, int span_len, int span_top, uint8_t cover_scan, - int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); //-------------------------------------------------------------------- diff --git a/core/src/fxge/skia/fx_skia_device.cpp b/core/src/fxge/skia/fx_skia_device.cpp index a483eca5ca..a11b92526c 100644 --- a/core/src/fxge/skia/fx_skia_device.cpp +++ b/core/src/fxge/skia/fx_skia_device.cpp @@ -478,19 +478,19 @@ FX_BOOL CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWO } FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_alpha, FX_DWORD argb, - const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform) { return m_pAggDriver->StartDIBits(pSource, bitmap_alpha, argb, pMatrix, render_flags, handle, alpha_flag, pIccTransform); } -FX_BOOL CFX_SkiaDeviceDriver::ContinueDIBits(FX_LPVOID pHandle, IFX_Pause* pPause) +FX_BOOL CFX_SkiaDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) { return m_pAggDriver->ContinueDIBits(pHandle, pPause); } -void CFX_SkiaDeviceDriver::CancelDIBits(FX_LPVOID pHandle) +void CFX_SkiaDeviceDriver::CancelDIBits(void* pHandle) { m_pAggDriver->CancelDIBits(pHandle); } diff --git a/core/src/fxge/skia/fx_skia_device.h b/core/src/fxge/skia/fx_skia_device.h index 7ae019c124..582b844fb9 100644 --- a/core/src/fxge/skia/fx_skia_device.h +++ b/core/src/fxge/skia/fx_skia_device.h @@ -67,10 +67,10 @@ public: int alpha_flag = 0, void* pIccTransform = NULL); virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, - const CFX_AffineMatrix* pMatrix, FX_DWORD flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD flags, void*& handle, int alpha_flag = 0, void* pIccTransform = NULL); - virtual FX_BOOL ContinueDIBits(FX_LPVOID handle, IFX_Pause* pPause); - virtual void CancelDIBits(FX_LPVOID handle); + virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause); + virtual void CancelDIBits(void* handle); virtual FX_BOOL DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FIXFLOAT font_size, FX_DWORD color, @@ -82,7 +82,7 @@ public: int alpha_flag, void* pIccTransform, FX_BOOL bFill = TRUE); void SetClipMask(rasterizer_scanline_aa& rasterizer); void SetClipMask(SkPath& skPath, SkPaint* spaint); - virtual FX_LPBYTE GetBuffer() const {return m_pAggDriver->GetBuffer();} + virtual uint8_t* GetBuffer() const {return m_pAggDriver->GetBuffer();} CFX_AggDeviceDriver* m_pAggDriver; }; diff --git a/core/src/fxge/win32/dwrite_int.h b/core/src/fxge/win32/dwrite_int.h index d95f115fbc..4192fb74ae 100644 --- a/core/src/fxge/win32/dwrite_int.h +++ b/core/src/fxge/win32/dwrite_int.h @@ -40,7 +40,7 @@ public: return m_pDWriteFactory != NULL; } - void* DwCreateFontFaceFromStream(FX_LPBYTE pData, FX_DWORD size, int simulation_style); + void* DwCreateFontFaceFromStream(uint8_t* pData, FX_DWORD size, int simulation_style); FX_BOOL DwCreateRenderingTarget(CFX_DIBitmap* pSrc, void** renderTarget); void DwDeleteRenderingTarget(void* renderTarget); FX_BOOL DwRendingString(void* renderTarget, CFX_ClipRgn* pClipRgn, FX_RECT& stringRect, CFX_AffineMatrix* pMatrix, diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp index d2d83dea75..effff0922f 100644 --- a/core/src/fxge/win32/fx_win32_device.cpp +++ b/core/src/fxge/win32/fx_win32_device.cpp @@ -23,12 +23,12 @@ public: ~CWin32FontInfo(); virtual void Release(); virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper); - virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR face, FX_BOOL& bExact); - virtual void* GetFont(FX_LPCSTR face) + virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact); + virtual void* GetFont(const FX_CHAR* face) { return NULL; } - virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffer, FX_DWORD size); + virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer, FX_DWORD size); virtual void DeleteFont(void* hFont); virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name); virtual FX_BOOL GetFontCharset(void* hFont, int& charset); @@ -152,15 +152,15 @@ FX_BOOL CWin32FontInfo::EnumFontList(CFX_FontMapper* pMapper) return TRUE; } static const struct { - FX_LPCSTR m_pFaceName; - FX_LPCSTR m_pVariantName; + const FX_CHAR* m_pFaceName; + const FX_CHAR* m_pVariantName; } VariantNames[] = { {"DFKai-SB", "\x19\x6A\x77\x69\xD4\x9A"}, }; static const struct { - FX_LPCSTR m_pName; - FX_LPCSTR m_pWinName; + const FX_CHAR* m_pName; + const FX_CHAR* m_pWinName; FX_BOOL m_bBold; FX_BOOL m_bItalic; } @@ -197,8 +197,8 @@ CFX_ByteString CWin32FontInfo::FindFont(const CFX_ByteString& name) return CFX_ByteString(); } struct _FontNameMap { - FX_LPCSTR m_pSubFontName; - FX_LPCSTR m_pSrcFontName; + const FX_CHAR* m_pSubFontName; + const FX_CHAR* m_pSrcFontName; }; const _FontNameMap g_JpFontNameMap[] = { {"MS Mincho", "Heiseimin-W3"}, @@ -207,7 +207,7 @@ const _FontNameMap g_JpFontNameMap[] = { extern "C" { static int compareString(const void* key, const void* element) { - return FXSYS_stricmp((FX_LPCSTR)key, ((_FontNameMap*)element)->m_pSrcFontName); + return FXSYS_stricmp((const FX_CHAR*)key, ((_FontNameMap*)element)->m_pSrcFontName); } } FX_BOOL _GetSubFontName(CFX_ByteString& name) @@ -282,7 +282,7 @@ void CWin32FontInfo::GetJapanesePreference(CFX_ByteString& face, int weight, int face = "MS PMincho"; } } -void* CWin32FontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR cstr_face, FX_BOOL& bExact) +void* CWin32FontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* cstr_face, FX_BOOL& bExact) { CFX_ByteString face = cstr_face; int iBaseFont; @@ -359,7 +359,7 @@ void CWin32FontInfo::DeleteFont(void* hFont) { ::DeleteObject(hFont); } -FX_DWORD CWin32FontInfo::GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffer, FX_DWORD size) +FX_DWORD CWin32FontInfo::GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer, FX_DWORD size) { HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont); table = FXDWORD_FROM_MSBFIRST(table); @@ -456,14 +456,14 @@ int CGdiDeviceDriver::GetDeviceCaps(int caps_id) } return 0; } -FX_LPVOID CGdiDeviceDriver::GetClipRgn() +void* CGdiDeviceDriver::GetClipRgn() { HRGN hClipRgn = CreateRectRgn(0, 0, 1, 1); if (::GetClipRgn(m_hDC, hClipRgn) == 0) { DeleteObject(hClipRgn); hClipRgn = NULL; } - return (FX_LPVOID)hClipRgn; + return (void*)hClipRgn; } FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(const CFX_DIBitmap* pBitmap1, const FX_RECT* pSrcRect, int left, int top, void* pIccTransform) { @@ -597,7 +597,7 @@ BOOL CGdiDeviceDriver::GetClipBox(FX_RECT* pRect) { return ::GetClipBox(m_hDC, (RECT*)pRect); } -FX_BOOL CGdiDeviceDriver::SetClipRgn(FX_LPVOID hRgn) +FX_BOOL CGdiDeviceDriver::SetClipRgn(void* hRgn) { ::SelectClipRgn(m_hDC, (HRGN)hRgn); return TRUE; @@ -927,7 +927,7 @@ FX_BOOL CGdiDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2 DeleteObject(hPen); return TRUE; } -FX_BOOL CGdiDeviceDriver::DeleteDeviceRgn(FX_LPVOID pRgn) +FX_BOOL CGdiDeviceDriver::DeleteDeviceRgn(void* pRgn) { DeleteObject((HGDIOBJ)pRgn); return TRUE; @@ -1176,8 +1176,8 @@ CFX_WinBitmapDevice::CFX_WinBitmapDevice(int width, int height, FXDIB_Format for bmih.biHeight = -height; bmih.biPlanes = 1; bmih.biWidth = width; - FX_LPBYTE pBuffer; - m_hBitmap = CreateDIBSection(NULL, (BITMAPINFO*)&bmih, DIB_RGB_COLORS, (FX_LPVOID*)&pBuffer, NULL, 0); + uint8_t* pBuffer; + m_hBitmap = CreateDIBSection(NULL, (BITMAPINFO*)&bmih, DIB_RGB_COLORS, (void**)&pBuffer, NULL, 0); if (m_hBitmap == NULL) { return; } diff --git a/core/src/fxge/win32/fx_win32_dib.cpp b/core/src/fxge/win32/fx_win32_dib.cpp index 659e602e1a..a9b3662b15 100644 --- a/core/src/fxge/win32/fx_win32_dib.cpp +++ b/core/src/fxge/win32/fx_win32_dib.cpp @@ -68,7 +68,7 @@ CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, LPVOID pData, FX_BOOL } FXSYS_memcpy32(pBitmap->GetBuffer(), pData, pitch * height); if (bBottomUp) { - FX_LPBYTE temp_buf = FX_Alloc(uint8_t, pitch); + uint8_t* temp_buf = FX_Alloc(uint8_t, pitch); int top = 0, bottom = height - 1; while (top < bottom) { FXSYS_memcpy32(temp_buf, pBitmap->GetBuffer() + top * pitch, pitch); @@ -110,7 +110,7 @@ void GetBitmapSize(HBITMAP hBitmap, int& w, int& h) w = bmp.bmWidth; h = bmp.bmHeight; } -CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(FX_LPCWSTR filename) +CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(const FX_WCHAR* filename) { CWin32Platform* pPlatform = (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData(); if (pPlatform->m_GdiplusExt.IsAvailable()) { @@ -253,7 +253,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC, HBITMAP hBitmap, FX_DWORD* pP } CFX_WindowsDIB::CFX_WindowsDIB(HDC hDC, int width, int height) { - Create(width, height, FXDIB_Rgb, (FX_LPBYTE)1); + Create(width, height, FXDIB_Rgb, (uint8_t*)1); BITMAPINFOHEADER bmih; FXSYS_memset32(&bmih, 0, sizeof bmih); bmih.biSize = sizeof bmih; diff --git a/core/src/fxge/win32/fx_win32_dwrite.cpp b/core/src/fxge/win32/fx_win32_dwrite.cpp index e2951e4d07..b310bcf73f 100644 --- a/core/src/fxge/win32/fx_win32_dwrite.cpp +++ b/core/src/fxge/win32/fx_win32_dwrite.cpp @@ -128,7 +128,7 @@ CDWriteExt::~CDWriteExt() { Unload(); } -LPVOID CDWriteExt::DwCreateFontFaceFromStream(FX_LPBYTE pData, FX_DWORD size, int simulation_style) +LPVOID CDWriteExt::DwCreateFontFaceFromStream(uint8_t* pData, FX_DWORD size, int simulation_style) { IDWriteFactory* pDwFactory = (IDWriteFactory*)m_pDWriteFactory; IDWriteFontFile* pDwFontFile = NULL; @@ -433,7 +433,7 @@ STDMETHODIMP CDwGdiTextRenderer::DrawGlyphRun( bitmap.bmWidth, bitmap.bmHeight, bitmap.bmBitsPixel == 24 ? FXDIB_Rgb : FXDIB_Rgb32, - (FX_LPBYTE)bitmap.bmBits + (uint8_t*)bitmap.bmBits ); dib.CompositeBitmap( text_bbox.left, diff --git a/core/src/fxge/win32/fx_win32_gdipext.cpp b/core/src/fxge/win32/fx_win32_gdipext.cpp index 944266c1c9..863281b8e5 100644 --- a/core/src/fxge/win32/fx_win32_gdipext.cpp +++ b/core/src/fxge/win32/fx_win32_gdipext.cpp @@ -349,7 +349,7 @@ static void OutputImageMask(GpGraphics* pGraphics, BOOL bMonoDevice, const CFX_D CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; int src_width = pBitmap->GetWidth(), src_height = pBitmap->GetHeight(); int src_pitch = pBitmap->GetPitch(); - FX_LPBYTE scan0 = pBitmap->GetBuffer(); + uint8_t* scan0 = pBitmap->GetBuffer(); if (src_width == 1 && src_height == 1) { if ((scan0[0] & 0x80) == 0) { return; @@ -430,7 +430,7 @@ static void OutputImage(GpGraphics* pGraphics, const CFX_DIBitmap* pBitmap, cons return; } int src_pitch = pBitmap->GetPitch(); - FX_LPBYTE scan0 = pBitmap->GetBuffer() + pSrcRect->top * src_pitch + pBitmap->GetBPP() * pSrcRect->left / 8; + uint8_t* scan0 = pBitmap->GetBuffer() + pSrcRect->top * src_pitch + pBitmap->GetBPP() * pSrcRect->left / 8; GpBitmap* bitmap = NULL; switch (pBitmap->GetFormat()) { case FXDIB_Argb: @@ -569,7 +569,7 @@ FX_BOOL CGdiplusExt::GdipCreateFromImage(void* bitmap, void** graphics) } return FALSE; } -FX_BOOL CGdiplusExt::GdipCreateFontFamilyFromName(FX_LPCWSTR name, void* pFontCollection, void**pFamily) +FX_BOOL CGdiplusExt::GdipCreateFontFamilyFromName(const FX_WCHAR* name, void* pFontCollection, void**pFamily) { CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; GpStatus status = CallFunc(GdipCreateFontFamilyFromName)((GDIPCONST WCHAR *)name, (GpFontCollection*)pFontCollection, (GpFontFamily**)pFamily); diff --git a/core/src/fxge/win32/fx_win32_print.cpp b/core/src/fxge/win32/fx_win32_print.cpp index 7740fbd87a..e921d4c7a9 100644 --- a/core/src/fxge/win32/fx_win32_print.cpp +++ b/core/src/fxge/win32/fx_win32_print.cpp @@ -121,7 +121,7 @@ static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, const CFX_Af return NULL; } int src_width = pSrcBitmap->GetWidth(), src_height = pSrcBitmap->GetHeight(); - FX_LPBYTE src_buf = pSrcBitmap->GetBuffer(); + uint8_t* src_buf = pSrcBitmap->GetBuffer(); FX_DWORD src_pitch = pSrcBitmap->GetPitch(); FX_FLOAT dest_area = pDestMatrix->GetUnitArea(); FX_FLOAT area_scale = FXSYS_Div((FX_FLOAT)(src_width * src_height), dest_area); @@ -152,12 +152,12 @@ static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, const CFX_Af return NULL; } pTempBitmap->CopyPalette(pSrc->GetPalette()); - FX_LPBYTE dest_buf = pTempBitmap->GetBuffer(); + uint8_t* dest_buf = pTempBitmap->GetBuffer(); int dest_pitch = pTempBitmap->GetPitch(); FXSYS_memset8(dest_buf, pSrc->IsAlphaMask() ? 0 : 0xff, dest_pitch * result_height); if (pSrcBitmap->IsAlphaMask()) { for (int dest_y = 0; dest_y < result_height; dest_y ++) { - FX_LPBYTE dest_scan = dest_buf + dest_y * dest_pitch; + uint8_t* dest_scan = dest_buf + dest_y * dest_pitch; for (int dest_x = 0; dest_x < result_width; dest_x ++) { int src_x, src_y; result2src_fix.Transform(dest_x, dest_y, src_x, src_y); @@ -172,7 +172,7 @@ static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, const CFX_Af } } else { for (int dest_y = 0; dest_y < result_height; dest_y ++) { - FX_LPBYTE dest_scan = dest_buf + dest_y * dest_pitch; + uint8_t* dest_scan = dest_buf + dest_y * dest_pitch; for (int dest_x = 0; dest_x < result_width; dest_x ++) { int src_x, src_y; result2src_fix.Transform(dest_x, dest_y, src_x, src_y); @@ -192,7 +192,7 @@ static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, const CFX_Af return pTempBitmap; } FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_alpha, FX_DWORD color, - const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type) { if (bitmap_alpha < 255 || pSource->HasAlpha() || (pSource->IsAlphaMask() && (pSource->GetBPP() != 1 || !m_bSupportROP))) { @@ -250,7 +250,7 @@ void CPSOutput::Init() { m_pBuf = FX_Alloc(FX_CHAR, 1026); } -void CPSOutput::OutputPS(FX_LPCSTR string, int len) +void CPSOutput::OutputPS(const FX_CHAR* string, int len) { if (len < 0) { len = (int)FXSYS_strlen(string); @@ -393,7 +393,7 @@ FX_BOOL CPSPrinterDriver::StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD c return m_PSRenderer.StretchDIBits(pBitmap, color, dest_left, dest_top, dest_width, dest_height, flags, alpha_flag, pIccTransform); } FX_BOOL CPSPrinterDriver::StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, - const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type) { if (blend_type != FXDIB_BLEND_NORMAL) { diff --git a/core/src/fxge/win32/win32_int.h b/core/src/fxge/win32/win32_int.h index a3380f3b5b..1f8f5d7995 100644 --- a/core/src/fxge/win32/win32_int.h +++ b/core/src/fxge/win32/win32_int.h @@ -41,7 +41,7 @@ public: void GdipDeleteBrush(void* pBrush); void GdipCreateMatrix(FX_FLOAT a, FX_FLOAT b, FX_FLOAT c, FX_FLOAT d, FX_FLOAT e, FX_FLOAT f, void** matrix); void GdipDeleteMatrix(void* matrix); - FX_BOOL GdipCreateFontFamilyFromName(FX_LPCWSTR name, void* pFontCollection, void**pFamily); + FX_BOOL GdipCreateFontFamilyFromName(const FX_WCHAR* name, void* pFontCollection, void**pFamily); void GdipDeleteFontFamily(void* pFamily); FX_BOOL GdipCreateFontFromFamily(void* pFamily, FX_FLOAT font_size, int fontstyle, int flag, void** pFont); void* GdipCreateFontFromCollection(void* pFontCollection, FX_FLOAT font_size, int fontstyle); @@ -105,10 +105,10 @@ protected: int alpha_flag, void* pIccTransform, int blend_type); virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, FX_DWORD color, int alpha_flag, void* pIccTransform, int blend_type); - virtual FX_LPVOID GetClipRgn() ; - virtual FX_BOOL SetClipRgn(FX_LPVOID pRgn) ; + virtual void* GetClipRgn() ; + virtual FX_BOOL SetClipRgn(void* pRgn) ; virtual FX_BOOL GetClipBox(FX_RECT* pRect); - virtual FX_BOOL DeleteDeviceRgn(FX_LPVOID pRgn); + virtual FX_BOOL DeleteDeviceRgn(void* pRgn); virtual void DrawLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2); virtual void* GetPlatformSurface() { @@ -140,7 +140,7 @@ protected: int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag, void* pIccTransform, int blend_type); virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, - const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type) { return FALSE; @@ -161,7 +161,7 @@ protected: int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag, void* pIccTransform, int blend_type); virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, - const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type); int m_HorzSize, m_VertSize; FX_BOOL m_bSupportROP; @@ -176,9 +176,9 @@ public: delete this; } void Init(); - virtual void OutputPS(FX_LPCSTR string, int len); + virtual void OutputPS(const FX_CHAR* string, int len); HDC m_hDC; - FX_LPSTR m_pBuf; + FX_CHAR* m_pBuf; }; class CPSPrinterDriver : public IFX_RenderDeviceDriver { @@ -221,7 +221,7 @@ protected: int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag, void* pIccTransform, int blend_type); virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, - const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type); virtual FX_BOOL DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color, |