diff options
Diffstat (limited to 'core')
169 files changed, 3330 insertions, 3337 deletions
diff --git a/core/include/fdrm/fx_crypt.h b/core/include/fdrm/fx_crypt.h index 7bd69defdf..8b0ce2f703 100644 --- a/core/include/fdrm/fx_crypt.h +++ b/core/include/fdrm/fx_crypt.h @@ -20,26 +20,26 @@ void CRYPT_AESSetKey(FX_LPVOID context, FX_DWORD blocklen, FX_LPCBYTE key, FX_DW 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, FX_BYTE digest[16]); +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, FX_BYTE digest[16]); -void CRYPT_SHA1Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[20]); +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, FX_BYTE digest[20]); -void CRYPT_SHA256Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[32]); +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, FX_BYTE digest[32]); +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, FX_BYTE digest[48]); -void CRYPT_SHA384Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[48]); +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, FX_BYTE digest[64]); -void CRYPT_SHA512Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[64]); +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)); #ifdef __cplusplus diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h index c0065def47..8444f09b70 100644 --- a/core/include/fpdfapi/fpdf_objects.h +++ b/core/include/fpdfapi/fpdf_objects.h @@ -520,7 +520,7 @@ public: void SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed, FX_BOOL bKeepBuf); - void InitStream(FX_BYTE* pData, FX_DWORD size, CPDF_Dictionary* pDict); + void InitStream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict); void InitStream(IFX_FileRead *pFile, CPDF_Dictionary* pDict); @@ -657,7 +657,7 @@ protected: FX_DWORD m_SrcOffset; - FX_BYTE m_SrcBuffer[FPDF_FILTER_BUFFER_SIZE]; + uint8_t m_SrcBuffer[FPDF_FILTER_BUFFER_SIZE]; friend class CPDF_Stream; }; class CPDF_Null : public CPDF_Object diff --git a/core/include/fpdfapi/fpdf_pageobj.h b/core/include/fpdfapi/fpdf_pageobj.h index 1b53bdc859..e09c0456fe 100644 --- a/core/include/fpdfapi/fpdf_pageobj.h +++ b/core/include/fpdfapi/fpdf_pageobj.h @@ -114,7 +114,7 @@ public: CPDF_Path* m_pPathList; - FX_BYTE* m_pTypeList; + uint8_t* m_pTypeList; int m_TextCount; diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h index d18d362ec0..f0e3e2ca08 100644 --- a/core/include/fpdfapi/fpdf_parser.h +++ b/core/include/fpdfapi/fpdf_parser.h @@ -269,7 +269,7 @@ public: CFX_ByteString GetKeyword(); - void GetBinary(FX_BYTE* buffer, FX_DWORD size); + void GetBinary(uint8_t* buffer, FX_DWORD size); void ToNextLine(); @@ -291,18 +291,18 @@ public: return m_pCryptoHandler != NULL; } - FX_BOOL GetCharAt(FX_FILESIZE pos, FX_BYTE& ch); + FX_BOOL GetCharAt(FX_FILESIZE pos, uint8_t& ch); - FX_BOOL ReadBlock(FX_BYTE* pBuf, FX_DWORD size); + FX_BOOL ReadBlock(uint8_t* pBuf, FX_DWORD size); CFX_ByteString GetNextWord(FX_BOOL& bIsNumber); protected: static const int kParserMaxRecursionDepth = 64; static int s_CurrentRecursionDepth; - virtual FX_BOOL GetNextChar(FX_BYTE& ch); + virtual FX_BOOL GetNextChar(uint8_t& ch); - FX_BOOL GetCharAtBackward(FX_FILESIZE pos, FX_BYTE& ch); + FX_BOOL GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch); void GetNextWord(); @@ -326,7 +326,7 @@ protected: FX_FILESIZE m_FileLen; - FX_BYTE* m_pFileBuf; + uint8_t* m_pFileBuf; FX_DWORD m_BufSize; @@ -334,7 +334,7 @@ protected: CPDF_CryptoHandler* m_pCryptoHandler; - FX_BYTE m_WordBuffer[257]; + uint8_t m_WordBuffer[257]; FX_DWORD m_WordSize; @@ -458,7 +458,7 @@ public: return m_ObjVersion[objnum]; } - void GetIndirectBinary(FX_DWORD objnum, FX_BYTE*& pBuffer, FX_DWORD& size); + void GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD& size); FX_BOOL GetFileStreamOption() { @@ -635,7 +635,7 @@ public: FX_LPCBYTE 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, FX_INT32 key_len); + CFX_ByteString GetUserPassword(FX_LPCBYTE owner_pass, FX_DWORD pass_size, int32_t key_len); int GetVersion() { return m_Version; @@ -661,16 +661,16 @@ private: 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, FX_INT32 key_len); + FX_BOOL bIgnoreEncryptMeta, FX_LPBYTE key, int32_t key_len); - FX_BOOL CheckOwnerPassword(FX_LPCBYTE password, FX_DWORD pass_size, FX_LPBYTE key, FX_INT32 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); 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); - FX_BOOL CheckSecurity(FX_INT32 key_len); + FX_BOOL CheckSecurity(int32_t key_len); FX_BOOL m_bOwner; @@ -678,7 +678,7 @@ private: int m_Cipher; - FX_BYTE m_EncryptKey[32]; + uint8_t m_EncryptKey[32]; int m_KeyLen; }; @@ -731,7 +731,7 @@ protected: 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); - FX_BYTE m_EncryptKey[32]; + uint8_t m_EncryptKey[32]; int m_KeyLen; @@ -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 FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); -FX_DWORD FlateDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); -FX_DWORD RunLengthDecode(const FX_BYTE* 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, 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); class CPDF_NumberTree { public: @@ -847,8 +847,8 @@ public: virtual void SetDocument(CPDF_Document* pDoc) = 0; virtual FX_BOOL IsPageAvail(int iPage, IFX_DownloadHints* pHints) = 0; virtual FX_BOOL IsLinearized() = 0; - virtual FX_INT32 IsFormAvail(IFX_DownloadHints *pHints) = 0; - virtual FX_INT32 IsLinearizedPDF() = 0; + virtual int32_t IsFormAvail(IFX_DownloadHints *pHints) = 0; + virtual int32_t IsLinearizedPDF() = 0; virtual void GetLinearizedMainXRefInfo(FX_FILESIZE *pPos, FX_DWORD *pSize) = 0; protected: diff --git a/core/include/fpdfapi/fpdf_render.h b/core/include/fpdfapi/fpdf_render.h index 47d1b19920..2f03ae5bb7 100644 --- a/core/include/fpdfapi/fpdf_render.h +++ b/core/include/fpdfapi/fpdf_render.h @@ -241,7 +241,7 @@ public: void ClearImageData(); FX_DWORD EstimateSize(); - void CacheOptimization(FX_INT32 dwLimitCacheSize); + void CacheOptimization(int32_t dwLimitCacheSize); FX_DWORD GetCachedSize(CPDF_Stream* pStream) const; FX_DWORD GetTimeCount() const { @@ -254,7 +254,7 @@ public: void GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, FX_DWORD& MatteColor, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = NULL, FX_INT32 downsampleWidth = 0, FX_INT32 downsampleHeight = 0); + CPDF_RenderStatus* pRenderStatus = NULL, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); void ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap); void ClearImageCache(CPDF_Stream* pStream); @@ -266,7 +266,7 @@ public: public: FX_BOOL StartGetCachedBitmap(CPDF_Stream* pStream, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, - FX_INT32 downsampleWidth = 0, FX_INT32 downsampleHeight = 0); + int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); FX_BOOL Continue(IFX_Pause* pPause); CPDF_ImageCache* m_pCurImageCache; diff --git a/core/include/fpdfapi/fpdf_resource.h b/core/include/fpdfapi/fpdf_resource.h index f1ea6b5a23..06dcdfec44 100644 --- a/core/include/fpdfapi/fpdf_resource.h +++ b/core/include/fpdfapi/fpdf_resource.h @@ -160,7 +160,7 @@ public: if (offset < 0 || nStrLen < 1) { return 0; } - FX_BYTE ch = offset < nStrLen ? pString[offset++] : pString[nStrLen-1]; + uint8_t ch = offset < nStrLen ? pString[offset++] : pString[nStrLen-1]; return static_cast<FX_DWORD>(ch); } @@ -326,14 +326,14 @@ public: FX_BOOL IsIdentical(CPDF_FontEncoding* pAnother) const; - FX_WCHAR UnicodeFromCharCode(FX_BYTE charcode) const + FX_WCHAR UnicodeFromCharCode(uint8_t charcode) const { return m_Unicodes[charcode]; } int CharCodeFromUnicode(FX_WCHAR unicode) const; - void SetUnicode(FX_BYTE charcode, FX_WCHAR unicode) + void SetUnicode(uint8_t charcode, FX_WCHAR unicode) { m_Unicodes[charcode] = unicode; } @@ -368,7 +368,7 @@ protected: virtual void LoadGlyphMap() = 0; virtual FX_WCHAR _UnicodeFromCharCode(FX_DWORD charcode) const { - return m_Encoding.UnicodeFromCharCode((FX_BYTE)charcode); + return m_Encoding.UnicodeFromCharCode((uint8_t)charcode); } virtual FX_DWORD _CharCodeFromUnicode(FX_WCHAR Unicode) const { @@ -831,7 +831,7 @@ public: { } FX_ARGB* pMatteColor; - FX_INT32 nQuality; + int32_t nQuality; }; class CPDF_Image { @@ -884,12 +884,12 @@ public: - FX_INT32 GetPixelHeight() const + int32_t GetPixelHeight() const { return m_Height; } - FX_INT32 GetPixelWidth() const + int32_t GetPixelWidth() const { return m_Width; } @@ -909,9 +909,9 @@ public: - void SetImage(const CFX_DIBitmap* pDIBitmap, FX_INT32 iCompress, IFX_FileWrite *pFileWrite = NULL, IFX_FileRead *pFileRead = NULL, const CFX_DIBitmap* pMask = NULL, const CPDF_ImageSetParam* pParam = NULL); + void SetImage(const CFX_DIBitmap* pDIBitmap, int32_t iCompress, IFX_FileWrite *pFileWrite = NULL, IFX_FileRead *pFileRead = NULL, const CFX_DIBitmap* pMask = NULL, const CPDF_ImageSetParam* pParam = NULL); - void SetJpegImage(FX_BYTE* pImageData, FX_DWORD size); + void SetJpegImage(uint8_t* pImageData, FX_DWORD size); void SetJpegImage(IFX_FileRead *pFile); @@ -931,9 +931,9 @@ private: FX_BOOL m_bInline; CPDF_Dictionary* m_pInlineDict; - FX_INT32 m_Height; + int32_t m_Height; - FX_INT32 m_Width; + int32_t m_Width; FX_BOOL m_bIsMask; diff --git a/core/include/fpdfapi/fpdf_serial.h b/core/include/fpdfapi/fpdf_serial.h index fc55fa08a9..e4a0aec2e5 100644 --- a/core/include/fpdfapi/fpdf_serial.h +++ b/core/include/fpdfapi/fpdf_serial.h @@ -127,9 +127,9 @@ public: FX_BOOL Create(IFX_StreamWrite* pFile, FX_DWORD flags = 0); - FX_INT32 Continue(IFX_Pause *pPause = NULL); + int32_t Continue(IFX_Pause *pPause = NULL); - FX_BOOL SetFileVersion(FX_INT32 fileVersion = 17); + FX_BOOL SetFileVersion(int32_t fileVersion = 17); protected: CPDF_Document* m_pDocument; @@ -155,16 +155,16 @@ protected: CPDF_XRefStream* m_pXRefStream; - FX_INT32 m_ObjectStreamSize; + int32_t m_ObjectStreamSize; FX_DWORD m_dwLastObjNum; FX_BOOL Create(FX_DWORD flags); void ResetStandardSecurity(); void Clear(); - FX_INT32 WriteDoc_Stage1(IFX_Pause *pPause); - FX_INT32 WriteDoc_Stage2(IFX_Pause *pPause); - FX_INT32 WriteDoc_Stage3(IFX_Pause *pPause); - FX_INT32 WriteDoc_Stage4(IFX_Pause *pPause); + int32_t WriteDoc_Stage1(IFX_Pause *pPause); + int32_t WriteDoc_Stage2(IFX_Pause *pPause); + int32_t WriteDoc_Stage3(IFX_Pause *pPause); + int32_t WriteDoc_Stage4(IFX_Pause *pPause); CFX_FileBufferArchive m_File; @@ -172,19 +172,19 @@ protected: void InitOldObjNumOffsets(); void InitNewObjNumOffsets(); void AppendNewObjNum(FX_DWORD objbum); - FX_INT32 WriteOldIndirectObject(FX_DWORD objnum); - FX_INT32 WriteOldObjs(IFX_Pause *pPause); - FX_INT32 WriteNewObjs(FX_BOOL bIncremental, IFX_Pause *pPause); - FX_INT32 WriteIndirectObj(const CPDF_Object* pObj); - FX_INT32 WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, FX_BOOL bEncrypt = TRUE); - FX_INT32 WriteIndirectObjectToStream(const CPDF_Object* pObj); - FX_INT32 WriteIndirectObj(FX_DWORD objnum, const CPDF_Object* pObj); - FX_INT32 WriteIndirectObjectToStream(FX_DWORD objnum, FX_LPCBYTE pBuffer, FX_DWORD dwSize); - FX_INT32 AppendObjectNumberToXRef(FX_DWORD objnum); + int32_t WriteOldIndirectObject(FX_DWORD objnum); + int32_t WriteOldObjs(IFX_Pause *pPause); + int32_t WriteNewObjs(FX_BOOL bIncremental, IFX_Pause *pPause); + int32_t WriteIndirectObj(const CPDF_Object* pObj); + 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 AppendObjectNumberToXRef(FX_DWORD objnum); void InitID(FX_BOOL bDefault = TRUE); - FX_INT32 WriteStream(const CPDF_Object* pStream, FX_DWORD objnum, CPDF_CryptoHandler* pCrypto); + int32_t WriteStream(const CPDF_Object* pStream, FX_DWORD objnum, CPDF_CryptoHandler* pCrypto); - FX_INT32 m_iStage; + int32_t m_iStage; FX_DWORD m_dwFlags; FX_POSITION m_Pos; FX_FILESIZE m_XrefStart; @@ -196,7 +196,7 @@ protected: CPDF_Array* m_pIDArray; - FX_INT32 m_FileVersion; + int32_t m_FileVersion; friend class CPDF_ObjectStream; friend class CPDF_XRefStream; }; diff --git a/core/include/fpdfdoc/fpdf_ap.h b/core/include/fpdfdoc/fpdf_ap.h index 39daf028ac..1d30ebbb0a 100644 --- a/core/include/fpdfdoc/fpdf_ap.h +++ b/core/include/fpdfdoc/fpdf_ap.h @@ -15,19 +15,19 @@ class IPVT_FontMap { public: virtual ~IPVT_FontMap() { } - virtual CPDF_Font* GetPDFFont(FX_INT32 nFontIndex) = 0; - virtual CFX_ByteString GetPDFFontAlias(FX_INT32 nFontIndex) = 0; + virtual CPDF_Font* GetPDFFont(int32_t nFontIndex) = 0; + virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) = 0; }; struct CPVT_Dash { - CPVT_Dash(FX_INT32 dash, FX_INT32 gap, FX_INT32 phase) : nDash(dash), nGap(gap), nPhase(phase) + CPVT_Dash(int32_t dash, int32_t gap, int32_t phase) : nDash(dash), nGap(gap), nPhase(phase) {} - FX_INT32 nDash; + int32_t nDash; - FX_INT32 nGap; + int32_t nGap; - FX_INT32 nPhase; + int32_t nPhase; }; #define CT_TRANSPARENT 0 #define CT_GRAY 1 @@ -35,11 +35,11 @@ struct CPVT_Dash { #define CT_CMYK 3 struct CPVT_Color { - CPVT_Color(FX_INT32 type = 0, FX_FLOAT color1 = 0.0f, FX_FLOAT color2 = 0.0f, FX_FLOAT color3 = 0.0f, FX_FLOAT color4 = 0.0f) + CPVT_Color(int32_t type = 0, FX_FLOAT color1 = 0.0f, FX_FLOAT color2 = 0.0f, FX_FLOAT color3 = 0.0f, FX_FLOAT color4 = 0.0f) : nColorType(type), fColor1(color1), fColor2(color2), fColor3(color3), fColor4(color4) {} - FX_INT32 nColorType; + int32_t nColorType; FX_FLOAT fColor1; FX_FLOAT fColor2; FX_FLOAT fColor3; @@ -53,17 +53,17 @@ public: virtual ~CPVT_Provider(); - FX_INT32 GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_INT32 nWordStyle); + int32_t GetCharWidth(int32_t nFontIndex, FX_WORD word, int32_t nWordStyle); - FX_INT32 GetTypeAscent(FX_INT32 nFontIndex); + int32_t GetTypeAscent(int32_t nFontIndex); - FX_INT32 GetTypeDescent(FX_INT32 nFontIndex); + int32_t GetTypeDescent(int32_t nFontIndex); - FX_INT32 GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex); + int32_t GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex); FX_BOOL IsLatinWord(FX_WORD word); - FX_INT32 GetDefaultFontIndex(); + int32_t GetDefaultFontIndex(); private: IPVT_FontMap * m_pFontMap; @@ -88,7 +88,7 @@ public: static CFX_ByteString GenerateBorderAP(const CPDF_Rect & rect, FX_FLOAT fWidth, const CPVT_Color & color, const CPVT_Color & crLeftTop, const CPVT_Color & crRightBottom, - FX_INT32 nStyle, const CPVT_Dash & dash); + int32_t nStyle, const CPVT_Dash & dash); static CFX_ByteString GenerateColorAP(const CPVT_Color & color, const FX_BOOL & bFillOrStroke); }; diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h index 307a31cd20..14cc145d6d 100644 --- a/core/include/fpdfdoc/fpdf_doc.h +++ b/core/include/fpdfdoc/fpdf_doc.h @@ -331,7 +331,7 @@ public: CPDF_Dictionary* GetAnnot() const; - FX_INT32 GetOperationType() const; + int32_t GetOperationType() const; CPDF_Stream* GetSoundStream() const { @@ -733,19 +733,19 @@ public: static CPDF_Font* AddSystemDefaultFont(const CPDF_Document* pDocument); - static CPDF_Font* AddSystemFont(const CPDF_Document* pDocument, CFX_ByteString csFontName, FX_BYTE iCharSet = 1); + static CPDF_Font* AddSystemFont(const CPDF_Document* pDocument, CFX_ByteString csFontName, uint8_t iCharSet = 1); - static CPDF_Font* AddSystemFont(const CPDF_Document* pDocument, CFX_WideString csFontName, FX_BYTE iCharSet = 1); + static CPDF_Font* AddSystemFont(const CPDF_Document* pDocument, CFX_WideString csFontName, uint8_t iCharSet = 1); static CPDF_Font* AddStandardFont(const CPDF_Document* pDocument, CFX_ByteString csFontName); - static CFX_ByteString GetNativeFont(FX_BYTE iCharSet, FX_LPVOID pLogFont = NULL); + static CFX_ByteString GetNativeFont(uint8_t iCharSet, FX_LPVOID pLogFont = NULL); static CFX_ByteString GetNativeFont(FX_LPVOID pLogFont = NULL); - static FX_BYTE GetNativeCharSet(); + static uint8_t GetNativeCharSet(); - static CPDF_Font* AddNativeFont(FX_BYTE iCharSet, const CPDF_Document* pDocument); + static CPDF_Font* AddNativeFont(uint8_t iCharSet, const CPDF_Document* pDocument); static CPDF_Font* AddNativeFont(const CPDF_Document* pDocument); @@ -837,7 +837,7 @@ public: CPDF_Font* GetFormFont(CFX_ByteString csFontName, CFX_ByteString& csNameTag); - CPDF_Font* GetNativeFormFont(FX_BYTE iCharSet, CFX_ByteString& csNameTag); + CPDF_Font* GetNativeFormFont(uint8_t iCharSet, CFX_ByteString& csNameTag); CPDF_Font* GetNativeFormFont(CFX_ByteString& csNameTag); @@ -856,7 +856,7 @@ public: void AddFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameTag); - CPDF_Font* AddNativeFormFont(FX_BYTE iCharSet, CFX_ByteString& csNameTag); + CPDF_Font* AddNativeFormFont(uint8_t iCharSet, CFX_ByteString& csNameTag); CPDF_Font* AddNativeFormFont(CFX_ByteString& csNameTag); @@ -1517,10 +1517,10 @@ public: CFX_WideString GetLabel(int nPage) const; - FX_INT32 GetPageByLabel(FX_BSTR bsLabel) const; + int32_t GetPageByLabel(FX_BSTR bsLabel) const; - FX_INT32 GetPageByLabel(FX_WSTR wsLabel) const; + int32_t GetPageByLabel(FX_WSTR wsLabel) const; protected: CPDF_Document* m_pDocument; @@ -1537,7 +1537,7 @@ public: void LoadDoc(CPDF_Document *pDoc); - FX_INT32 GetString(FX_BSTR bsItem, CFX_WideString &wsStr); + int32_t GetString(FX_BSTR bsItem, CFX_WideString &wsStr); CXML_Element* GetRoot() const; @@ -1560,7 +1560,7 @@ public: FX_BOOL PrintScaling() const; - FX_INT32 NumCopies() const; + int32_t NumCopies() const; CPDF_Array* PrintPageRange() const; diff --git a/core/include/fpdfdoc/fpdf_vt.h b/core/include/fpdfdoc/fpdf_vt.h index 87ef02576b..fbfeacb755 100644 --- a/core/include/fpdfdoc/fpdf_vt.h +++ b/core/include/fpdfdoc/fpdf_vt.h @@ -26,7 +26,7 @@ struct CPVT_WordPlace { { } - CPVT_WordPlace(FX_INT32 nSecIndex, FX_INT32 nLineIndex, FX_INT32 nWordIndex) + CPVT_WordPlace(int32_t nSecIndex, int32_t nLineIndex, int32_t nWordIndex) { this->nSecIndex = nSecIndex; this->nLineIndex = nLineIndex; @@ -48,7 +48,7 @@ struct CPVT_WordPlace { return wp.nSecIndex != this->nSecIndex || wp.nLineIndex != this->nLineIndex || wp.nWordIndex != this->nWordIndex; } - inline FX_INT32 WordCmp(const CPVT_WordPlace & wp) const + inline int32_t WordCmp(const CPVT_WordPlace & wp) const { if (this->nSecIndex > wp.nSecIndex) { return 1; @@ -71,7 +71,7 @@ struct CPVT_WordPlace { return 0; } - inline FX_INT32 LineCmp(const CPVT_WordPlace & wp) const + inline int32_t LineCmp(const CPVT_WordPlace & wp) const { if (this->nSecIndex > wp.nSecIndex) { return 1; @@ -88,7 +88,7 @@ struct CPVT_WordPlace { return 0; } - inline FX_INT32 SecCmp(const CPVT_WordPlace & wp) const + inline int32_t SecCmp(const CPVT_WordPlace & wp) const { if (this->nSecIndex > wp.nSecIndex) { return 1; @@ -99,11 +99,11 @@ struct CPVT_WordPlace { return 0; } - FX_INT32 nSecIndex; + int32_t nSecIndex; - FX_INT32 nLineIndex; + int32_t nLineIndex; - FX_INT32 nWordIndex; + int32_t nWordIndex; }; struct CPVT_WordRange { @@ -170,7 +170,7 @@ struct CPVT_SecProps { { } - CPVT_SecProps(FX_FLOAT lineLeading, FX_FLOAT lineIndent, FX_INT32 alignment) : + CPVT_SecProps(FX_FLOAT lineLeading, FX_FLOAT lineIndent, int32_t alignment) : fLineLeading(lineLeading), fLineIndent(lineIndent), nAlignment(alignment) { } @@ -184,7 +184,7 @@ struct CPVT_SecProps { FX_FLOAT fLineIndent; - FX_INT32 nAlignment; + int32_t nAlignment; }; struct CPVT_WordProps { @@ -193,8 +193,8 @@ struct CPVT_WordProps { { } - CPVT_WordProps(FX_INT32 fontIndex, FX_FLOAT fontSize, FX_COLORREF wordColor = 0, FX_INT32 scriptType = 0, FX_INT32 wordStyle = 0, - FX_FLOAT charSpace = 0, FX_INT32 horzScale = 100) : + CPVT_WordProps(int32_t fontIndex, FX_FLOAT fontSize, FX_COLORREF wordColor = 0, int32_t scriptType = 0, int32_t wordStyle = 0, + FX_FLOAT charSpace = 0, int32_t horzScale = 100) : nFontIndex(fontIndex), fFontSize(fontSize), dwWordColor(wordColor), nScriptType(scriptType), nWordStyle(wordStyle), fCharSpace(charSpace), nHorzScale(horzScale) { @@ -207,19 +207,19 @@ struct CPVT_WordProps { { } - FX_INT32 nFontIndex; + int32_t nFontIndex; FX_FLOAT fFontSize; FX_COLORREF dwWordColor; - FX_INT32 nScriptType; + int32_t nScriptType; - FX_INT32 nWordStyle; + int32_t nWordStyle; FX_FLOAT fCharSpace; - FX_INT32 nHorzScale; + int32_t nHorzScale; }; struct CPVT_Word { @@ -230,7 +230,7 @@ struct CPVT_Word { FX_WORD Word; - FX_INT32 nCharset; + int32_t nCharset; CPVT_WordPlace WordPlace; @@ -242,7 +242,7 @@ struct CPVT_Word { FX_FLOAT fWidth; - FX_INT32 nFontIndex; + int32_t nFontIndex; FX_FLOAT fFontSize; @@ -281,17 +281,17 @@ class IPDF_VariableText_Provider public: virtual ~IPDF_VariableText_Provider() { } - virtual FX_INT32 GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_INT32 nWordStyle) = 0; + virtual int32_t GetCharWidth(int32_t nFontIndex, FX_WORD word, int32_t nWordStyle) = 0; - virtual FX_INT32 GetTypeAscent(FX_INT32 nFontIndex) = 0; + virtual int32_t GetTypeAscent(int32_t nFontIndex) = 0; - virtual FX_INT32 GetTypeDescent(FX_INT32 nFontIndex) = 0; + virtual int32_t GetTypeDescent(int32_t nFontIndex) = 0; - virtual FX_INT32 GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex) = 0; + virtual int32_t GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex) = 0; virtual FX_BOOL IsLatinWord(FX_WORD word) = 0; - virtual FX_INT32 GetDefaultFontIndex() = 0; + virtual int32_t GetDefaultFontIndex() = 0; }; class IPDF_VariableText_Iterator { @@ -320,7 +320,7 @@ public: virtual FX_BOOL SetSection(const CPVT_Section & section) = 0; - virtual void SetAt(FX_INT32 nWordIndex) = 0; + virtual void SetAt(int32_t nWordIndex) = 0; virtual void SetAt(const CPVT_WordPlace & place) = 0; @@ -339,17 +339,17 @@ public: virtual void SetPlateRect(const CPDF_Rect & rect) = 0; - virtual void SetAlignment(FX_INT32 nFormat = 0) = 0; + virtual void SetAlignment(int32_t nFormat = 0) = 0; virtual void SetPasswordChar(FX_WORD wSubWord = '*') = 0; - virtual void SetLimitChar(FX_INT32 nLimitChar = 0) = 0; + virtual void SetLimitChar(int32_t nLimitChar = 0) = 0; - virtual void SetCharArray(FX_INT32 nCharArray = 0) = 0; + virtual void SetCharArray(int32_t nCharArray = 0) = 0; virtual void SetCharSpace(FX_FLOAT fCharSpace = 0.0f) = 0; - virtual void SetHorzScale(FX_INT32 nHorzScale = 100) = 0; + virtual void SetHorzScale(int32_t nHorzScale = 100) = 0; virtual void SetMultiLine(FX_BOOL bMultiLine = TRUE) = 0; @@ -375,16 +375,16 @@ public: virtual void ResetAll() = 0; - virtual void SetText(FX_LPCWSTR text, FX_INT32 charset = 1, const CPVT_SecProps * pSecProps = NULL, + virtual void SetText(FX_LPCWSTR 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, FX_INT32 charset = 1, + virtual CPVT_WordPlace InsertWord(const CPVT_WordPlace & place, FX_WORD word, int32_t charset = 1, const CPVT_WordProps * pWordProps = NULL) = 0; 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, FX_INT32 charset = 1, + virtual CPVT_WordPlace InsertText(const CPVT_WordPlace & place, FX_LPCWSTR 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; @@ -397,21 +397,21 @@ public: virtual CPDF_Rect GetContentRect() const = 0; - virtual FX_INT32 GetTotalWords() const = 0; + virtual int32_t GetTotalWords() const = 0; virtual FX_FLOAT GetFontSize() const = 0; - virtual FX_INT32 GetAlignment() const = 0; + virtual int32_t GetAlignment() const = 0; virtual FX_WORD GetPasswordChar() const = 0; - virtual FX_INT32 GetCharArray() const = 0; + virtual int32_t GetCharArray() const = 0; - virtual FX_INT32 GetLimitChar() const = 0; + virtual int32_t GetLimitChar() const = 0; virtual FX_BOOL IsMultiLine() const = 0; - virtual FX_INT32 GetHorzScale() const = 0; + virtual int32_t GetHorzScale() const = 0; virtual FX_FLOAT GetCharSpace() const = 0; @@ -441,9 +441,9 @@ public: virtual CPVT_WordPlace AjustLineHeader(const CPVT_WordPlace & place, FX_BOOL bPrevOrNext) const = 0; - virtual FX_INT32 WordPlaceToWordIndex(const CPVT_WordPlace & place) const = 0; + virtual int32_t WordPlaceToWordIndex(const CPVT_WordPlace & place) const = 0; - virtual CPVT_WordPlace WordIndexToWordPlace(FX_INT32 index) const = 0; + virtual CPVT_WordPlace WordIndexToWordPlace(int32_t index) const = 0; protected: ~IPDF_VariableText() { } diff --git a/core/include/fpdftext/fpdf_text.h b/core/include/fpdftext/fpdf_text.h index d18a7692c6..65c20b04b4 100644 --- a/core/include/fpdftext/fpdf_text.h +++ b/core/include/fpdftext/fpdf_text.h @@ -36,7 +36,7 @@ CFX_WideString PDF_GetFirstTextLine_Unicode(CPDF_Document* pDoc, CPDF_Dictionary typedef struct { FX_WCHAR m_Unicode; FX_WCHAR m_Charcode; - FX_INT32 m_Flag; + int32_t m_Flag; FX_FLOAT m_FontSize; FX_FLOAT m_OriginX; FX_FLOAT m_OriginY; diff --git a/core/include/fxcodec/fx_codec.h b/core/include/fxcodec/fx_codec.h index 6a62c2d12c..31dea3b8d2 100644 --- a/core/include/fxcodec/fx_codec.h +++ b/core/include/fxcodec/fx_codec.h @@ -114,9 +114,9 @@ class ICodec_BasicModule public: virtual ~ICodec_BasicModule() {} - virtual FX_BOOL RunLengthEncode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, + virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) = 0; - virtual FX_BOOL A85Encode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, + virtual FX_BOOL A85Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) = 0; virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc) = 0; @@ -154,10 +154,10 @@ public: virtual ~ICodec_FlateModule() {} virtual ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE 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 FX_BYTE* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, + 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; - virtual FX_BOOL Encode(const FX_BYTE* src_buf, FX_DWORD src_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) = 0; virtual FX_BOOL Encode(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) = 0; @@ -258,23 +258,23 @@ public: virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size) = 0;
- virtual FX_INT32 ReadHeader(void* pContext, int* width, int* height,
+ virtual int32_t ReadHeader(void* pContext, int* width, int* height,
int* pal_num, void** pal_pp, int* bg_index, CFX_DIBAttribute* pAttribute = NULL) = 0;
- virtual FX_INT32 LoadFrameInfo(void* pContext, int* frame_num) = 0;
+ virtual int32_t LoadFrameInfo(void* pContext, int* frame_num) = 0;
void (*RecordCurrentPositionCallback)(void* pModule, FX_DWORD& cur_pos);
- FX_LPBYTE (*AskLocalPaletteBufCallback)(void* pModule, FX_INT32 frame_num, FX_INT32 pal_size);
+ FX_LPBYTE (*AskLocalPaletteBufCallback)(void* pModule, int32_t frame_num, int32_t pal_size);
- virtual FX_INT32 LoadFrame(void* pContext, int frame_num, CFX_DIBAttribute* pAttribute = NULL) = 0;
+ virtual int32_t LoadFrame(void* pContext, int frame_num, CFX_DIBAttribute* pAttribute = NULL) = 0;
FX_BOOL (*InputRecordPositionBufCallback)(void* pModule, FX_DWORD rcd_pos, const FX_RECT& img_rc,
- FX_INT32 pal_num, void* pal_ptr,
- FX_INT32 delay_time, FX_BOOL user_input,
- FX_INT32 trans_index, FX_INT32 disposal_method, FX_BOOL interlace);
+ int32_t pal_num, void* pal_ptr,
+ int32_t delay_time, FX_BOOL user_input,
+ int32_t trans_index, int32_t disposal_method, FX_BOOL interlace);
- void (*ReadScanlineCallback)(void* pModule, FX_INT32 row_num, FX_LPBYTE row_buf);
+ void (*ReadScanlineCallback)(void* pModule, int32_t row_num, FX_LPBYTE row_buf);
};
class ICodec_BmpModule {
@@ -290,14 +290,14 @@ public: virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size) = 0;
- virtual FX_INT32 ReadHeader(void* pContext, FX_INT32* width, FX_INT32* height, FX_BOOL* tb_flag, FX_INT32* components,
+ virtual int32_t ReadHeader(void* pContext, int32_t* width, int32_t* height, FX_BOOL* tb_flag, int32_t* components,
int* pal_num, FX_DWORD** pal_pp, CFX_DIBAttribute* pAttribute = NULL) = 0;
- virtual FX_INT32 LoadImage(void* pContext) = 0;
+ virtual int32_t LoadImage(void* pContext) = 0;
FX_BOOL (*InputImagePositionBufCallback)(void* pModule, FX_DWORD rcd_pos);
- void (*ReadScanlineCallback)(void* pModule, FX_INT32 row_num, FX_LPBYTE row_buf);
+ void (*ReadScanlineCallback)(void* pModule, int32_t row_num, FX_LPBYTE row_buf);
};
class ICodec_TiffModule {
@@ -308,9 +308,9 @@ public: virtual FX_LPVOID CreateDecoder(IFX_FileRead* file_ptr) = 0;
- virtual void GetFrames(FX_LPVOID ctx, FX_INT32& frames) = 0;
+ virtual void GetFrames(FX_LPVOID ctx, int32_t& frames) = 0;
- virtual FX_BOOL LoadFrameInfo(FX_LPVOID ctx, FX_INT32 frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute = NULL) = 0;
+ virtual FX_BOOL LoadFrameInfo(FX_LPVOID ctx, int32_t frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute = NULL) = 0;
virtual FX_BOOL Decode(FX_LPVOID ctx, class CFX_DIBitmap* pDIBitmap) = 0;
@@ -348,21 +348,21 @@ public: virtual FXCODEC_IMAGE_TYPE GetType() = 0;
- virtual FX_INT32 GetWidth() = 0;
+ virtual int32_t GetWidth() = 0;
- virtual FX_INT32 GetHeight() = 0;
+ virtual int32_t GetHeight() = 0;
- virtual FX_INT32 GetNumComponents() = 0;
+ virtual int32_t GetNumComponents() = 0;
- virtual FX_INT32 GetBPC() = 0;
+ virtual int32_t GetBPC() = 0;
virtual void SetClipBox(FX_RECT* clip) = 0;
- virtual FXCODEC_STATUS GetFrames(FX_INT32& frames, IFX_Pause* pPause = NULL) = 0;
+ virtual FXCODEC_STATUS GetFrames(int32_t& frames, IFX_Pause* pPause = NULL) = 0;
virtual FXCODEC_STATUS StartDecode(class CFX_DIBitmap* pDIBitmap,
- FX_INT32 start_x, FX_INT32 start_y, FX_INT32 size_x, FX_INT32 size_y,
- FX_INT32 frames = 0, FX_BOOL bInterpol = TRUE) = 0;
+ int32_t start_x, int32_t start_y, int32_t size_x, int32_t size_y,
+ int32_t frames = 0, FX_BOOL bInterpol = TRUE) = 0;
virtual FXCODEC_STATUS ContinueDecode(IFX_Pause* pPause = NULL) = 0;
};
@@ -415,11 +415,11 @@ public: ) = 0; - virtual FX_LPVOID CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize, FX_INT32& nComponents, FX_INT32 intent = 0, + virtual FX_LPVOID CreateTransform_sRGB(FX_LPCBYTE 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, FX_INT32& nSrcComponents, - FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, FX_INT32 intent = 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, FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT ) = 0; @@ -431,18 +431,19 @@ public: virtual void TranslateScanline(FX_LPVOID pTransform, FX_LPBYTE pDest, FX_LPCBYTE 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(FX_BYTE c, FX_BYTE m, FX_BYTE y, FX_BYTE k, FX_BYTE& R, FX_BYTE& G, FX_BYTE& B); -FX_BOOL MD5ComputeID(FX_LPCVOID buf, FX_DWORD dwSize, FX_BYTE ID[16]); +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]); class CFX_DIBAttribute {
public:
CFX_DIBAttribute();
~CFX_DIBAttribute();
- FX_INT32 m_nXDPI;
+ int32_t m_nXDPI;
- FX_INT32 m_nYDPI;
+ int32_t m_nYDPI;
FX_FLOAT m_fAspectRatio;
@@ -450,16 +451,16 @@ public: CFX_ByteString m_strAuthor;
- FX_BYTE m_strTime[20];
+ uint8_t m_strTime[20];
- FX_INT32 m_nGifLeft;
- FX_INT32 m_nGifTop;
+ int32_t m_nGifLeft;
+ int32_t m_nGifTop;
FX_DWORD* m_pGifLocalPalette;
FX_DWORD m_nGifLocalPalNum;
- FX_INT32 m_nBmpCompressType;
+ int32_t m_nBmpCompressType;
class IFX_DIBAttributeExif* m_pExif;
};
class IFX_DIBAttributeExif diff --git a/core/include/fxcrt/fx_arb.h b/core/include/fxcrt/fx_arb.h index 8c2a8eba42..56f56fb9ab 100644 --- a/core/include/fxcrt/fx_arb.h +++ b/core/include/fxcrt/fx_arb.h @@ -55,9 +55,9 @@ public: virtual FX_WCHAR GetFormChar(FX_WCHAR wch, FX_WCHAR prev = 0, FX_WCHAR next = 0) const = 0; virtual FX_WCHAR GetFormChar(const CFX_Char *cur, const CFX_Char *prev, const CFX_Char *next) const = 0; }; -void FX_BidiLine(CFX_WideString &wsText, FX_INT32 iBaseLevel = 0); -void FX_BidiLine(CFX_TxtCharArray &chars, FX_INT32 iCount, FX_INT32 iBaseLevel = 0); -void FX_BidiLine(CFX_RTFCharArray &chars, FX_INT32 iCount, FX_INT32 iBaseLevel = 0); +void FX_BidiLine(CFX_WideString &wsText, int32_t iBaseLevel = 0); +void FX_BidiLine(CFX_TxtCharArray &chars, int32_t iCount, int32_t iBaseLevel = 0); +void FX_BidiLine(CFX_RTFCharArray &chars, int32_t iCount, int32_t iBaseLevel = 0); class IFX_BidiChar { public: @@ -66,7 +66,7 @@ public: virtual void SetPolicy(FX_BOOL bSeparateNeutral = TRUE) = 0; virtual FX_BOOL AppendChar(FX_WCHAR wch) = 0; virtual FX_BOOL EndChar() = 0; - virtual FX_INT32 GetBidiInfo(FX_INT32 &iStart, FX_INT32 &iCount) = 0; + virtual int32_t GetBidiInfo(int32_t &iStart, int32_t &iCount) = 0; virtual void Reset() = 0; protected: diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h index 111e0d3876..fbcb657012 100644 --- a/core/include/fxcrt/fx_basic.h +++ b/core/include/fxcrt/fx_basic.h @@ -41,14 +41,14 @@ public: void AppendBlock(const void* pBuf, FX_STRSIZE size); - void AppendFill(FX_BYTE byte, FX_STRSIZE count); + void AppendFill(uint8_t byte, FX_STRSIZE count); void AppendString(FX_BSTR str) { AppendBlock(str.GetPtr(), str.GetLength()); } - inline void AppendByte(FX_BYTE byte) + inline void AppendByte(uint8_t byte) { if (m_AllocSize <= m_DataSize) { ExpandBuf(1); @@ -99,7 +99,7 @@ public: void AppendChar(int ch) { - AppendByte((FX_BYTE)ch); + AppendByte((uint8_t)ch); } CFX_ByteTextBuf& operator << (int i); @@ -160,7 +160,7 @@ class CFX_ArchiveSaver public: CFX_ArchiveSaver() : m_pStream(NULL) {} - CFX_ArchiveSaver& operator << (FX_BYTE i); + CFX_ArchiveSaver& operator << (uint8_t i); CFX_ArchiveSaver& operator << (int i); @@ -178,7 +178,7 @@ public: void Write(const void* pData, FX_STRSIZE dwSize); - FX_INTPTR GetLength() + intptr_t GetLength() { return m_SavingBuf.GetSize(); } @@ -204,7 +204,7 @@ public: CFX_ArchiveLoader(FX_LPCBYTE pData, FX_DWORD dwSize); - CFX_ArchiveLoader& operator >> (FX_BYTE& i); + CFX_ArchiveLoader& operator >> (uint8_t& i); CFX_ArchiveLoader& operator >> (int& i); @@ -241,14 +241,14 @@ public: FX_BOOL Flush(); - FX_INT32 AppendBlock(const void* pBuf, size_t size); + int32_t AppendBlock(const void* pBuf, size_t size); - FX_INT32 AppendByte(FX_BYTE byte); + int32_t AppendByte(uint8_t byte); - FX_INT32 AppendDWord(FX_DWORD i); + int32_t AppendDWord(FX_DWORD i); - FX_INT32 AppendString(FX_BSTR lpsz); + int32_t AppendString(FX_BSTR lpsz); protected: @@ -282,14 +282,14 @@ private: }; struct CFX_CharMap { - static CFX_CharMap* GetDefaultMapper(FX_INT32 codepage = 0); + static CFX_CharMap* GetDefaultMapper(int32_t codepage = 0); CFX_WideString (*m_GetWideString)(CFX_CharMap* pMap, const CFX_ByteString& bstr); CFX_ByteString (*m_GetByteString)(CFX_CharMap* pMap, const CFX_WideString& wstr); - FX_INT32 (*m_GetCodePage)(); + int32_t (*m_GetCodePage)(); }; class CFX_UTF8Decoder { @@ -301,7 +301,7 @@ public: void Clear(); - void Input(FX_BYTE byte); + void Input(uint8_t byte); void AppendChar(FX_DWORD ch); @@ -541,13 +541,13 @@ public: return -1; } }; -typedef CFX_ArrayTemplate<FX_BYTE> CFX_ByteArray; +typedef CFX_ArrayTemplate<uint8_t> CFX_ByteArray; typedef CFX_ArrayTemplate<FX_WORD> CFX_WordArray; typedef CFX_ArrayTemplate<FX_DWORD> CFX_DWordArray; typedef CFX_ArrayTemplate<void*> CFX_PtrArray; typedef CFX_ArrayTemplate<FX_FILESIZE> CFX_FileSizeArray; typedef CFX_ArrayTemplate<FX_FLOAT> CFX_FloatArray; -typedef CFX_ArrayTemplate<FX_INT32> CFX_Int32Array; +typedef CFX_ArrayTemplate<int32_t> CFX_Int32Array; template <class ObjectClass> class CFX_ObjectArray : public CFX_BasicArray { @@ -574,12 +574,12 @@ public: return InsertSpaceAt(m_nSize, 1); } - FX_INT32 Append(const CFX_ObjectArray& src, FX_INT32 nStart = 0, FX_INT32 nCount = -1) + int32_t Append(const CFX_ObjectArray& src, int32_t nStart = 0, int32_t nCount = -1) { if (nCount == 0) { return 0; } - FX_INT32 nSize = src.GetSize(); + int32_t nSize = src.GetSize(); if (!nSize) { return 0; } @@ -597,18 +597,18 @@ public: InsertSpaceAt(m_nSize, nCount); ObjectClass* pStartObj = (ObjectClass*)GetDataPtr(nSize); nSize = nStart + nCount; - for (FX_INT32 i = nStart; i < nSize; i ++, pStartObj++) { + for (int32_t i = nStart; i < nSize; i ++, pStartObj++) { new ((void*)pStartObj) ObjectClass(src[i]); } return nCount; } - FX_INT32 Copy(const CFX_ObjectArray& src, FX_INT32 nStart = 0, FX_INT32 nCount = -1) + int32_t Copy(const CFX_ObjectArray& src, int32_t nStart = 0, int32_t nCount = -1) { if (nCount == 0) { return 0; } - FX_INT32 nSize = src.GetSize(); + int32_t nSize = src.GetSize(); if (!nSize) { return 0; } @@ -626,7 +626,7 @@ public: SetSize(nCount); ObjectClass* pStartObj = (ObjectClass*)m_pData; nSize = nStart + nCount; - for (FX_INT32 i = nStart; i < nSize; i ++, pStartObj++) { + for (int32_t i = nStart; i < nSize; i ++, pStartObj++) { new ((void*)pStartObj) ObjectClass(src[i]); } return nCount; @@ -704,9 +704,9 @@ private: short m_SegmentSize; - FX_BYTE m_IndexSize; + uint8_t m_IndexSize; - FX_BYTE m_IndexDepth; + uint8_t m_IndexDepth; int m_DataSize; @@ -859,26 +859,26 @@ public: FX_BOOL Lookup(KeyType key, ValueType& rValue) const { FX_LPVOID pValue = NULL; - if (!CFX_MapPtrToPtr::Lookup((void*)(FX_UINTPTR)key, pValue)) { + if (!CFX_MapPtrToPtr::Lookup((void*)(uintptr_t)key, pValue)) { return FALSE; } - rValue = (ValueType)(FX_UINTPTR)pValue; + rValue = (ValueType)(uintptr_t)pValue; return TRUE; } ValueType& operator[](KeyType key) { - return (ValueType&)CFX_MapPtrToPtr::operator []((void*)(FX_UINTPTR)key); + return (ValueType&)CFX_MapPtrToPtr::operator []((void*)(uintptr_t)key); } void SetAt(KeyType key, ValueType newValue) { - CFX_MapPtrToPtr::SetAt((void*)(FX_UINTPTR)key, (void*)(FX_UINTPTR)newValue); + CFX_MapPtrToPtr::SetAt((void*)(uintptr_t)key, (void*)(uintptr_t)newValue); } FX_BOOL RemoveKey(KeyType key) { - return CFX_MapPtrToPtr::RemoveKey((void*)(FX_UINTPTR)key); + return CFX_MapPtrToPtr::RemoveKey((void*)(uintptr_t)key); } void GetNextAssoc(FX_POSITION& rNextPosition, KeyType& rKey, ValueType& rValue) const @@ -886,8 +886,8 @@ public: void* pKey = NULL; void* pValue = NULL; CFX_MapPtrToPtr::GetNextAssoc(rNextPosition, pKey, pValue); - rKey = (KeyType)(FX_UINTPTR)pKey; - rValue = (ValueType)(FX_UINTPTR)pValue; + rKey = (KeyType)(uintptr_t)pKey; + rValue = (ValueType)(uintptr_t)pValue; } }; class CFX_CMapDWordToDWord @@ -1428,9 +1428,9 @@ protected: struct DataList { - FX_INT32 start; + int32_t start; - FX_INT32 count; + int32_t count; FX_LPBYTE data; }; public: @@ -1445,7 +1445,7 @@ public: void Clear() { - for (FX_INT32 i = m_DataLists.GetUpperBound(); i >= 0; i--) { + for (int32_t i = m_DataLists.GetUpperBound(); i >= 0; i--) { DataList list = m_DataLists.ElementAt(i); if (list.data) { FX_Free(list.data); @@ -1455,15 +1455,15 @@ public: m_CurList = 0; } - void Append(FX_INT32 nStart, FX_INT32 nCount) + void Append(int32_t nStart, int32_t nCount) { if (nStart < 0) { return; } while (nCount > 0) { - FX_INT32 temp_count = FX_MIN(nCount, FX_DATALIST_LENGTH); + int32_t temp_count = FX_MIN(nCount, FX_DATALIST_LENGTH); DataList list; - list.data = FX_Alloc2D(FX_BYTE, temp_count, unit); + list.data = FX_Alloc2D(uint8_t, temp_count, unit); list.start = nStart; list.count = temp_count; Append(list); @@ -1472,7 +1472,7 @@ public: } } - FX_LPBYTE GetAt(FX_INT32 nIndex) + FX_LPBYTE GetAt(int32_t nIndex) { if (nIndex < 0) { return NULL; @@ -1483,9 +1483,9 @@ public: DataList *pCurList = m_DataLists.GetDataPtr(m_CurList); if (!pCurList || nIndex < pCurList->start || nIndex >= pCurList->start + pCurList->count) { pCurList = NULL; - FX_INT32 iStart = 0; - FX_INT32 iEnd = m_DataLists.GetUpperBound(); - FX_INT32 iMid = 0; + int32_t iStart = 0; + int32_t iEnd = m_DataLists.GetUpperBound(); + int32_t iMid = 0; while (iStart <= iEnd) { iMid = (iStart + iEnd) / 2; DataList* list = m_DataLists.GetDataPtr(iMid); @@ -1505,11 +1505,11 @@ public: protected: void Append(const DataList& list) { - FX_INT32 iStart = 0; - FX_INT32 iEnd = m_DataLists.GetUpperBound(); - FX_INT32 iFind = 0; + int32_t iStart = 0; + int32_t iEnd = m_DataLists.GetUpperBound(); + int32_t iFind = 0; while (iStart <= iEnd) { - FX_INT32 iMid = (iStart + iEnd) / 2; + int32_t iMid = (iStart + iEnd) / 2; DataList* cur_list = m_DataLists.GetDataPtr(iMid); if (list.start < cur_list->start + cur_list->count) { iEnd = iMid - 1; @@ -1529,7 +1529,7 @@ protected: } m_DataLists.InsertAt(iFind, list); } - FX_INT32 m_CurList; + int32_t m_CurList; CFX_ArrayTemplate<DataList> m_DataLists; }; template<typename T1, typename T2> @@ -1542,19 +1542,19 @@ public: m_Data.Clear(); } - void Add(FX_INT32 nStart, FX_INT32 nCount) + void Add(int32_t nStart, int32_t nCount) { m_Data.Append(nStart, nCount); } - T2& operator [] (FX_INT32 nIndex) + T2& operator [] (int32_t nIndex) { FX_LPBYTE data = m_Data.GetAt(nIndex); FXSYS_assert(data != NULL); return (T2&)(*(volatile T2*)data); } - T2* GetPtrAt(FX_INT32 nIndex) + T2* GetPtrAt(int32_t nIndex) { return (T2*)m_Data.GetAt(nIndex); } diff --git a/core/include/fxcrt/fx_coordinates.h b/core/include/fxcrt/fx_coordinates.h index 076c0e6a2f..c98ece9e07 100644 --- a/core/include/fxcrt/fx_coordinates.h +++ b/core/include/fxcrt/fx_coordinates.h @@ -113,15 +113,15 @@ public: } baseType x, y; }; -typedef CFX_PSVTemplate<FX_INT32> CFX_Point; +typedef CFX_PSVTemplate<int32_t> CFX_Point; typedef CFX_PSVTemplate<FX_FLOAT> CFX_PointF; -typedef CFX_PSVTemplate<FX_INT32> CFX_Size; +typedef CFX_PSVTemplate<int32_t> CFX_Size; typedef CFX_PSVTemplate<FX_FLOAT> CFX_SizeF; typedef CFX_ArrayTemplate<CFX_Point> CFX_Points; typedef CFX_ArrayTemplate<CFX_PointF> CFX_PointsF; -typedef CFX_PSVTemplate<FX_INT32> * FX_LPPOINT; +typedef CFX_PSVTemplate<int32_t> * FX_LPPOINT; typedef CFX_PSVTemplate<FX_FLOAT> * FX_LPPOINTF; -typedef CFX_PSVTemplate<FX_INT32> const * FX_LPCPOINT; +typedef CFX_PSVTemplate<int32_t> const * FX_LPCPOINT; typedef CFX_PSVTemplate<FX_FLOAT> const * FX_LPCPOINTF; #define CFX_FloatPoint CFX_PointF template<class baseType> @@ -227,7 +227,7 @@ public: return v.y < 0 ? -fSlope : fSlope; } }; -typedef CFX_VTemplate<FX_INT32> CFX_Vector; +typedef CFX_VTemplate<int32_t> CFX_Vector; typedef CFX_VTemplate<FX_FLOAT> CFX_VectorF; template<class baseType> class CFX_RTemplate @@ -524,11 +524,11 @@ public: baseType left, top; baseType width, height; }; -typedef CFX_RTemplate<FX_INT32> CFX_Rect; +typedef CFX_RTemplate<int32_t> CFX_Rect; typedef CFX_RTemplate<FX_FLOAT> CFX_RectF; -typedef CFX_RTemplate<FX_INT32> * FX_LPRECT; +typedef CFX_RTemplate<int32_t> * FX_LPRECT; typedef CFX_RTemplate<FX_FLOAT> * FX_LPRECTF; -typedef CFX_RTemplate<FX_INT32> const * FX_LPCRECT; +typedef CFX_RTemplate<int32_t> const * FX_LPCRECT; typedef CFX_RTemplate<FX_FLOAT> const * FX_LPCRECTF; typedef CFX_ArrayTemplate<CFX_RectF> CFX_RectFArray; struct FX_RECT { @@ -602,13 +602,13 @@ struct FX_RECT { }; struct FX_SMALL_RECT { - FX_SHORT Left; + int16_t Left; - FX_SHORT Top; + int16_t Top; - FX_SHORT Right; + int16_t Right; - FX_SHORT Bottom; + int16_t Bottom; }; class CFX_FloatRect { @@ -807,7 +807,7 @@ public: void Translate(FX_FLOAT x, FX_FLOAT y, FX_BOOL bPrepended = FALSE); - void TranslateI(FX_INT32 x, FX_INT32 y, FX_BOOL bPrepended = FALSE) + void TranslateI(int32_t x, int32_t y, FX_BOOL bPrepended = FALSE) { Translate((FX_FLOAT)x, (FX_FLOAT)y, bPrepended); } @@ -831,17 +831,17 @@ public: FX_FLOAT GetUnitArea() const; FX_FLOAT TransformXDistance(FX_FLOAT dx) const; - FX_INT32 TransformXDistance(FX_INT32 dx) const; + int32_t TransformXDistance(int32_t dx) const; FX_FLOAT TransformYDistance(FX_FLOAT dy) const; - FX_INT32 TransformYDistance(FX_INT32 dy) const; + int32_t TransformYDistance(int32_t dy) const; FX_FLOAT TransformDistance(FX_FLOAT dx, FX_FLOAT dy) const; - FX_INT32 TransformDistance(FX_INT32 dx, FX_INT32 dy) const; + int32_t TransformDistance(int32_t dx, int32_t dy) const; FX_FLOAT TransformDistance(FX_FLOAT distance) const; void TransformPoint(FX_FLOAT &x, FX_FLOAT &y) const; - void TransformPoint(FX_INT32 &x, FX_INT32 &y) const; - void TransformPoints(CFX_PointF *points, FX_INT32 iCount) const; - void TransformPoints(CFX_Point *points, FX_INT32 iCount) const; + void TransformPoint(int32_t &x, int32_t &y) const; + void TransformPoints(CFX_PointF *points, int32_t iCount) const; + void TransformPoints(CFX_Point *points, int32_t iCount) const; void Transform(FX_FLOAT& x, FX_FLOAT& y) const { diff --git a/core/include/fxcrt/fx_ext.h b/core/include/fxcrt/fx_ext.h index 97c47df6f6..b31d7a43f7 100644 --- a/core/include/fxcrt/fx_ext.h +++ b/core/include/fxcrt/fx_ext.h @@ -19,31 +19,31 @@ 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, FX_INT32 iLength = -1, FX_INT32 *pUsedLen = NULL); -FX_FLOAT FXSYS_wcstof(FX_LPCWSTR pwsStr, FX_INT32 iLength = -1, FX_INT32 *pUsedLen = NULL); +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); -FX_INT32 FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count); -FX_INT32 FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, 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); -inline FX_BOOL FXSYS_islower(FX_INT32 ch) +inline FX_BOOL FXSYS_islower(int32_t ch) { return ch >= 'a' && ch <= 'z'; } -inline FX_BOOL FXSYS_isupper(FX_INT32 ch) +inline FX_BOOL FXSYS_isupper(int32_t ch) { return ch >= 'A' && ch <= 'Z'; } -inline FX_INT32 FXSYS_tolower(FX_INT32 ch) +inline int32_t FXSYS_tolower(int32_t ch) { return ch < 'A' || ch > 'Z' ? ch : (ch + 0x20); } -inline FX_INT32 FXSYS_toupper(FX_INT32 ch) +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, FX_INT32 iLength, FX_BOOL bIgnoreCase = FALSE); -FX_DWORD FX_HashCode_String_GetW(FX_LPCWSTR pStr, FX_INT32 iLength, FX_BOOL bIgnoreCase = FALSE); +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); #ifdef __cplusplus } @@ -58,11 +58,11 @@ FX_DWORD FX_Random_MT_Generate(FX_LPVOID pContext); void FX_Random_MT_Close(FX_LPVOID pContext); -void FX_Random_GenerateBase(FX_LPDWORD pBuffer, FX_INT32 iCount); +void FX_Random_GenerateBase(FX_LPDWORD pBuffer, int32_t iCount); -void FX_Random_GenerateMT(FX_LPDWORD pBuffer, FX_INT32 iCount); +void FX_Random_GenerateMT(FX_LPDWORD pBuffer, int32_t iCount); -void FX_Random_GenerateCrypto(FX_LPDWORD pBuffer, FX_INT32 iCount); +void FX_Random_GenerateCrypto(FX_LPDWORD pBuffer, int32_t iCount); #ifdef __cplusplus } #endif @@ -74,7 +74,7 @@ typedef struct FX_GUID { FX_DWORD data1; FX_WORD data2; FX_WORD data3; - FX_BYTE data4[8]; + uint8_t data4[8]; } FX_GUID, * FX_LPGUID; typedef FX_GUID const * FX_LPCGUID; @@ -88,10 +88,10 @@ template<class baseType> class CFX_SSortTemplate { public: - void ShellSort(baseType *pArray, FX_INT32 iCount) + void ShellSort(baseType *pArray, int32_t iCount) { FXSYS_assert(pArray != NULL && iCount > 0); - FX_INT32 i, j, gap; + int32_t i, j, gap; baseType v1, v2; gap = iCount >> 1; while (gap > 0) { diff --git a/core/include/fxcrt/fx_safe_types.h b/core/include/fxcrt/fx_safe_types.h index e45e6d3c8d..ee50a53e34 100644 --- a/core/include/fxcrt/fx_safe_types.h +++ b/core/include/fxcrt/fx_safe_types.h @@ -12,7 +12,7 @@ #include "fx_system.h" typedef pdfium::base::CheckedNumeric<FX_DWORD> FX_SAFE_DWORD; -typedef pdfium::base::CheckedNumeric<FX_INT32> FX_SAFE_INT32; +typedef pdfium::base::CheckedNumeric<int32_t> FX_SAFE_INT32; typedef pdfium::base::CheckedNumeric<size_t> FX_SAFE_SIZE_T; typedef pdfium::base::CheckedNumeric<FX_FILESIZE> FX_SAFE_FILESIZE; diff --git a/core/include/fxcrt/fx_stream.h b/core/include/fxcrt/fx_stream.h index 35c54cb3d2..190ce97cac 100644 --- a/core/include/fxcrt/fx_stream.h +++ b/core/include/fxcrt/fx_stream.h @@ -20,7 +20,7 @@ typedef struct FX_HFILE_ { FX_LPVOID pData; }* FX_HFILE; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -#define FX_FILESIZE FX_INT32 +#define FX_FILESIZE int32_t #else #include <fcntl.h> #include <unistd.h> @@ -37,10 +37,10 @@ typedef struct FX_HFILE_ { #define FX_GETBYTEOFFSET40(a) 0 #define FX_GETBYTEOFFSET48(a) 0 #define FX_GETBYTEOFFSET56(a) 0 -#define FX_GETBYTEOFFSET24(a) ((FX_BYTE)(a>>24)) -#define FX_GETBYTEOFFSET16(a) ((FX_BYTE)(a>>16)) -#define FX_GETBYTEOFFSET8(a) ((FX_BYTE)(a>>8)) -#define FX_GETBYTEOFFSET0(a) ((FX_BYTE)(a)) +#define FX_GETBYTEOFFSET24(a) ((uint8_t)(a>>24)) +#define FX_GETBYTEOFFSET16(a) ((uint8_t)(a>>16)) +#define FX_GETBYTEOFFSET8(a) ((uint8_t)(a>>8)) +#define FX_GETBYTEOFFSET0(a) ((uint8_t)(a)) #define FX_FILEMODE_Write 0 #define FX_FILEMODE_ReadOnly 1 #define FX_FILEMODE_Truncate 2 diff --git a/core/include/fxcrt/fx_string.h b/core/include/fxcrt/fx_string.h index 9903dad942..8fc9d79ebb 100644 --- a/core/include/fxcrt/fx_string.h +++ b/core/include/fxcrt/fx_string.h @@ -121,7 +121,7 @@ public: return m_Length == 0; } - FX_BYTE GetAt(FX_STRSIZE index) const + uint8_t GetAt(FX_STRSIZE index) const { return m_Ptr[index]; } @@ -140,7 +140,7 @@ public: return CFX_ByteStringC(m_Ptr + index, count); } - const FX_BYTE& operator[] (size_t index) const + const uint8_t& operator[] (size_t index) const { return m_Ptr[index]; } @@ -279,12 +279,12 @@ public: const CFX_ByteString& operator += (FX_BSTR bstrc); - FX_BYTE GetAt(FX_STRSIZE nIndex) const + uint8_t GetAt(FX_STRSIZE nIndex) const { return m_pData ? m_pData->m_String[nIndex] : 0; } - FX_BYTE operator[](FX_STRSIZE nIndex) const + uint8_t operator[](FX_STRSIZE nIndex) const { return m_pData ? m_pData->m_String[nIndex] : 0; } diff --git a/core/include/fxcrt/fx_system.h b/core/include/fxcrt/fx_system.h index f0ebcf90b1..80d75908d4 100644 --- a/core/include/fxcrt/fx_system.h +++ b/core/include/fxcrt/fx_system.h @@ -68,35 +68,23 @@ extern "C" { #endif typedef void* FX_LPVOID; // Deprecate, use with void*. -typedef void const* FX_LPCVOID; // Deprecate, use with const void*. +typedef const void* FX_LPCVOID; // Deprecate, use with const void*. typedef void* FX_POSITION; // Keep until fxcrt containers gone -typedef signed char FX_INT8; // Deprecate, use int8_t. -typedef unsigned char FX_UINT8; // Deprecate, use uint8_t. -typedef unsigned char FX_BYTE; // Deprecate, use uint8_t. -typedef unsigned char* FX_LPBYTE; // Deprecate, use uint8_t*. -typedef unsigned char const* FX_LPCBYTE; // Deprecate, use const uint8_t*. -typedef short FX_INT16; // Deprecate, use int16_t. -typedef unsigned short FX_UINT16; // Deprecate, use uint16_t. -typedef short FX_SHORT; // Deprecate, use int16_t. +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 unsigned short* FX_LPWORD; // Deprecate, use FX_WORD*. -typedef unsigned short const* FX_LPCWORD; // Deprecate, use const FX_WORD*. -typedef int FX_INT32; // Deprecate, use int32_t. -typedef unsigned int FX_UINT32; // Deprecate, use uint32_t. +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 unsigned int* FX_LPDWORD; // Deprecate, use FX_DWORD*. -typedef int64_t FX_INT64; // Deprecate, use int64_t. -typedef uint64_t FX_UINT64; // Deprecate, use uint64_t. -typedef intptr_t FX_INTPTR; // Deprecate, use intptr_t. -typedef uintptr_t FX_UINTPTR; // Deprecate, use uintptr_t. +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 char FX_CHAR; // Keep, questionable signedness. -typedef char* FX_LPSTR; // Deprecate, use FX_CHAR*. -typedef char const* FX_LPCSTR; // Deprecate, use const FX_CHAR*. +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 wchar_t* FX_LPWSTR; // Deprecate, use FX_WCHAR*. -typedef wchar_t const* FX_LPCWSTR; // Deprecate, use const FX_WCHAR*. +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". @@ -260,19 +248,19 @@ wchar_t* FXSYS_wcsupr(wchar_t* str); #define FXSYS_fmod(a, b) (FX_FLOAT)fmod(a, b) #define FXSYS_abs abs #define FXDWORD_FROM_LSBFIRST(i) (i) -#define FXDWORD_FROM_MSBFIRST(i) (((FX_BYTE)(i) << 24) | ((FX_BYTE)((i) >> 8) << 16) | ((FX_BYTE)((i) >> 16) << 8) | (FX_BYTE)((i) >> 24)) +#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 FXSYS_HIBYTE(word) ((FX_BYTE)((word) >> 8)) -#define FXSYS_LOBYTE(word) ((FX_BYTE)(word)) +#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)) -FX_INT32 FXSYS_atoi(FX_LPCSTR str); -FX_INT32 FXSYS_wtoi(FX_LPCWSTR str); -FX_INT64 FXSYS_atoi64(FX_LPCSTR str); -FX_INT64 FXSYS_wtoi64(FX_LPCWSTR str); -FX_LPCSTR FXSYS_i64toa(FX_INT64 value, FX_LPSTR str, int radix); -FX_LPCWSTR FXSYS_i64tow(FX_INT64 value, FX_LPWSTR str, int radix); +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); 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/fxcrt/fx_ucd.h b/core/include/fxcrt/fx_ucd.h index 42ab623afb..466acd45d4 100644 --- a/core/include/fxcrt/fx_ucd.h +++ b/core/include/fxcrt/fx_ucd.h @@ -141,13 +141,13 @@ public: return m_dwCharProps & FX_CHARTYPEBITSMASK;
}
FX_WORD m_wCharCode;
- FX_BYTE m_nBreakType;
- FX_INT8 m_nRotation;
+ uint8_t m_nBreakType;
+ int8_t m_nRotation;
FX_DWORD m_dwCharProps;
FX_DWORD m_dwCharStyles;
- FX_INT32 m_iCharWidth;
- FX_INT32 m_iHorizontalScale;
- FX_INT32 m_iVertialScale;
+ int32_t m_iCharWidth;
+ int32_t m_iHorizontalScale;
+ int32_t m_iVertialScale;
};
typedef CFX_ArrayTemplate<CFX_Char> CFX_CharArray;
class CFX_TxtChar : public CFX_Char
@@ -163,10 +163,10 @@ public: {
}
FX_DWORD m_dwStatus;
- FX_INT16 m_iBidiClass;
- FX_INT16 m_iBidiLevel;
- FX_INT16 m_iBidiPos;
- FX_INT16 m_iBidiOrder;
+ int16_t m_iBidiClass;
+ int16_t m_iBidiLevel;
+ int16_t m_iBidiPos;
+ int16_t m_iBidiOrder;
FX_LPVOID m_pUserData;
};
typedef CFX_ArrayTemplate<CFX_TxtChar> CFX_TxtCharArray;
@@ -186,12 +186,12 @@ public: {
}
FX_DWORD m_dwStatus;
- FX_INT32 m_iFontSize;
- FX_INT32 m_iFontHeight;
- FX_INT16 m_iBidiClass;
- FX_INT16 m_iBidiLevel;
- FX_INT16 m_iBidiPos;
- FX_INT16 m_iBidiOrder;
+ int32_t m_iFontSize;
+ int32_t m_iFontHeight;
+ int16_t m_iBidiClass;
+ int16_t m_iBidiLevel;
+ int16_t m_iBidiPos;
+ int16_t m_iBidiOrder;
FX_DWORD m_dwLayoutStyles;
FX_DWORD m_dwIdentity;
IFX_Unknown *m_pUserData;
diff --git a/core/include/fxge/fpf.h b/core/include/fxge/fpf.h index 440c329439..30c1c77bbe 100644 --- a/core/include/fxge/fpf.h +++ b/core/include/fxge/fpf.h @@ -31,19 +31,19 @@ public: virtual CFX_ByteString GetFamilyName() = 0; virtual CFX_WideString GetPsName() = 0; virtual FX_DWORD GetFontStyle() const = 0; - virtual FX_BYTE GetCharset() const = 0; + virtual uint8_t GetCharset() const = 0; - virtual FX_INT32 GetGlyphIndex(FX_WCHAR wUnicode) = 0; - virtual FX_INT32 GetGlyphWidth(FX_INT32 iGlyphIndex) = 0; + virtual int32_t GetGlyphIndex(FX_WCHAR wUnicode) = 0; + virtual int32_t GetGlyphWidth(int32_t iGlyphIndex) = 0; - virtual FX_INT32 GetAscent() const = 0; - virtual FX_INT32 GetDescent() const = 0; + virtual int32_t GetAscent() const = 0; + virtual int32_t GetDescent() const = 0; - virtual FX_BOOL GetGlyphBBox(FX_INT32 iGlyphIndex, FX_RECT &rtBBox) = 0; + virtual FX_BOOL GetGlyphBBox(int32_t iGlyphIndex, FX_RECT &rtBBox) = 0; virtual FX_BOOL GetBBox(FX_RECT &rtBBox) = 0; - virtual FX_INT32 GetHeight() const = 0; - virtual FX_INT32 GetItalicAngle() const = 0; + 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; protected: @@ -58,7 +58,7 @@ public: virtual void LoadPrivateFont(FX_BSTR bsFileName) = 0; virtual void LoadPrivateFont(FX_LPVOID pBuffer, size_t szBuffer) = 0; - virtual IFPF_Font* CreateFont(FX_BSTR bsFamilyname, FX_BYTE charset, FX_DWORD dwStyle, FX_DWORD dwMatch = 0) = 0; + virtual IFPF_Font* CreateFont(FX_BSTR bsFamilyname, uint8_t charset, FX_DWORD dwStyle, FX_DWORD dwMatch = 0) = 0; }; #endif // CORE_INCLUDE_FXGE_FPF_H_ diff --git a/core/include/fxge/fx_dib.h b/core/include/fxge/fx_dib.h index 74738d0d0f..d798ca3511 100644 --- a/core/include/fxge/fx_dib.h +++ b/core/include/fxge/fx_dib.h @@ -74,10 +74,10 @@ class CFX_DIBitmap; #define FXSYS_GetBValue(rgb) (((rgb) >> 16) & 0xff) #define FX_CCOLOR(val) (255-(val)) #define FXSYS_CMYK(c, m, y, k) (((c) << 24) | ((m) << 16) | ((y) << 8) | (k)) -#define FXSYS_GetCValue(cmyk) ((FX_BYTE)((cmyk) >> 24) & 0xff) -#define FXSYS_GetMValue(cmyk) ((FX_BYTE)((cmyk) >> 16) & 0xff) -#define FXSYS_GetYValue(cmyk) ((FX_BYTE)((cmyk) >> 8) & 0xff) -#define FXSYS_GetKValue(cmyk) ((FX_BYTE)(cmyk) & 0xff) +#define FXSYS_GetCValue(cmyk) ((uint8_t)((cmyk) >> 24) & 0xff) +#define FXSYS_GetMValue(cmyk) ((uint8_t)((cmyk) >> 16) & 0xff) +#define FXSYS_GetYValue(cmyk) ((uint8_t)((cmyk) >> 8) & 0xff) +#define FXSYS_GetKValue(cmyk) ((uint8_t)(cmyk) & 0xff) void CmykDecode(FX_CMYK cmyk, int& c, int& m, int& y, int& k); inline FX_CMYK CmykEncode(int c, int m, int y, int k) { @@ -90,10 +90,10 @@ inline FX_ARGB ArgbEncode(int a, int r, int g, int b) return (a << 24) | (r << 16) | (g << 8) | b; } FX_ARGB ArgbEncode(int a, FX_COLORREF rgb); -#define FXARGB_A(argb) ((FX_BYTE)((argb) >> 24)) -#define FXARGB_R(argb) ((FX_BYTE)((argb) >> 16)) -#define FXARGB_G(argb) ((FX_BYTE)((argb) >> 8)) -#define FXARGB_B(argb) ((FX_BYTE)(argb)) +#define FXARGB_A(argb) ((uint8_t)((argb) >> 24)) +#define FXARGB_R(argb) ((uint8_t)((argb) >> 16)) +#define FXARGB_G(argb) ((uint8_t)((argb) >> 8)) +#define FXARGB_B(argb) ((uint8_t)(argb)) #define FXARGB_MAKE(a,r,g,b) (((FX_DWORD)(a) << 24) | ((r) << 16) | ((g) << 8) | (b)) #define FXARGB_MUL_ALPHA(argb, alpha) (((((argb) >> 24) * (alpha) / 255) << 24) | ((argb) & 0xffffff)) #define FXRGB2GRAY(r,g,b) (((b) * 11 + (g) * 59 + (r) * 30) / 100) @@ -101,15 +101,15 @@ FX_ARGB ArgbEncode(int a, FX_COLORREF rgb); #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] = (FX_BYTE)((cmyk) >> 24), \ - ((FX_LPBYTE)(p))[1] = (FX_BYTE)((cmyk) >> 16), \ - ((FX_LPBYTE)(p))[2] = (FX_BYTE)((cmyk) >> 8), \ - ((FX_LPBYTE)(p))[3] = (FX_BYTE)(cmyk)) +#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] = (FX_BYTE)(argb), \ - ((FX_LPBYTE)(p))[1] = (FX_BYTE)((argb) >> 8), \ - ((FX_LPBYTE)(p))[2] = (FX_BYTE)((argb) >> 16), \ - ((FX_LPBYTE)(p))[3] = (FX_BYTE)((argb) >> 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), \ @@ -118,21 +118,21 @@ FX_ARGB ArgbEncode(int a, FX_COLORREF rgb); *((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] = (FX_BYTE)(argb>>24), \ - ((FX_LPBYTE)(p))[0] = (FX_BYTE)((argb) >> 16), \ - ((FX_LPBYTE)(p))[1] = (FX_BYTE)((argb) >> 8), \ - ((FX_LPBYTE)(p))[2] = (FX_BYTE)(argb) +#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 FXARGB_TODIB(argb) (argb) -#define FXCMYK_TODIB(cmyk) ((FX_BYTE)((cmyk) >> 24) | ((FX_BYTE)((cmyk) >> 16)) << 8 | ((FX_BYTE)((cmyk) >> 8)) << 16 | ((FX_BYTE)(cmyk) << 24)) -#define FXARGB_TOBGRORDERDIB(argb) ((FX_BYTE)(argb>>16) | ((FX_BYTE)(argb>>8)) << 8 | ((FX_BYTE)(argb)) << 16 | ((FX_BYTE)(argb>>24) << 24)) -#define FXGETFLAG_COLORTYPE(flag) (FX_BYTE)((flag)>>8) -#define FXGETFLAG_ALPHA_FILL(flag) (FX_BYTE)(flag) -#define FXGETFLAG_ALPHA_STROKE(flag) (FX_BYTE)((flag)>>16) +#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)) +#define FXGETFLAG_COLORTYPE(flag) (uint8_t)((flag)>>8) +#define FXGETFLAG_ALPHA_FILL(flag) (uint8_t)(flag) +#define FXGETFLAG_ALPHA_STROKE(flag) (uint8_t)((flag)>>16) #define FXSETFLAG_COLORTYPE(flag, val) flag = (((val)<<8)|(flag&0xffff00ff)) #define FXSETFLAG_ALPHA_FILL(flag, val) flag = ((val)|(flag&0xffffff00)) #define FXSETFLAG_ALPHA_STROKE(flag, val) flag = (((val)<<16)|(flag&0xff00ffff)) @@ -415,7 +415,7 @@ public: ~CFX_ScanlineCompositor(); - FX_BOOL Init(FXDIB_Format dest_format, FXDIB_Format src_format, FX_INT32 width, FX_DWORD* pSrcPalette, + FX_BOOL Init(FXDIB_Format dest_format, FXDIB_Format src_format, int32_t width, FX_DWORD* pSrcPalette, FX_DWORD mask_color, int blend_type, FX_BOOL bClip, FX_BOOL bRgbByteOrder = FALSE, int alpha_flag = 0, void* pIccTransform = NULL); @@ -519,11 +519,11 @@ public: ~CFX_ImageStretcher(); - FX_INT32 Start(IFX_ScanlineComposer* pDest, const CFX_DIBSource* pBitmap, + int32_t Start(IFX_ScanlineComposer* pDest, const CFX_DIBSource* pBitmap, int dest_width, int dest_height, const FX_RECT& bitmap_rect, FX_DWORD flags); - FX_INT32 Continue(IFX_Pause* pPause); + int32_t Continue(IFX_Pause* pPause); IFX_ScanlineComposer* m_pDest; const CFX_DIBSource* m_pSource; CStretchEngine* m_pStretchEngine; @@ -538,15 +538,15 @@ public: FX_LPBYTE m_pScanline; FX_LPBYTE m_pMaskScanline; FXDIB_Format m_DestFormat; - FX_INT32 m_Status; + int32_t m_Status; - FX_INT32 StartQuickStretch(); + int32_t StartQuickStretch(); - FX_INT32 StartStretch(); + int32_t StartStretch(); - FX_INT32 ContinueQuickStretch(IFX_Pause* pPause); + int32_t ContinueQuickStretch(IFX_Pause* pPause); - FX_INT32 ContinueStretch(IFX_Pause* pPause); + int32_t ContinueStretch(IFX_Pause* pPause); }; class CFX_ImageTransformer { @@ -556,10 +556,10 @@ public: ~CFX_ImageTransformer(); - FX_INT32 Start(const CFX_DIBSource* pSrc, const CFX_AffineMatrix* pMatrix, int flags, const FX_RECT* pClip); + int32_t Start(const CFX_DIBSource* pSrc, const CFX_AffineMatrix* pMatrix, int flags, const FX_RECT* pClip); - FX_INT32 Continue(IFX_Pause* pPause); + int32_t Continue(IFX_Pause* pPause); CFX_AffineMatrix* m_pMatrix; FX_RECT m_StretchClip; int m_ResultLeft, m_ResultTop, m_ResultWidth, m_ResultHeight; @@ -577,13 +577,13 @@ public: ~CFX_ImageRenderer(); - FX_INT32 Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClipRgn, + int32_t Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClipRgn, const CFX_DIBSource* pSource, int bitmap_alpha, FX_DWORD mask_color, const CFX_AffineMatrix* pMatrix, FX_DWORD dib_flags, FX_BOOL bRgbByteOrder = FALSE, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL); - FX_INT32 Continue(IFX_Pause* pPause); + int32_t Continue(IFX_Pause* pPause); protected: CFX_DIBitmap* m_pDevice; const CFX_ClipRgn* m_pClipRgn; diff --git a/core/include/fxge/fx_ge.h b/core/include/fxge/fx_ge.h index 60374eff45..a880166c39 100644 --- a/core/include/fxge/fx_ge.h +++ b/core/include/fxge/fx_ge.h @@ -65,7 +65,7 @@ protected: void InitPlatform(); void DestroyPlatform(); private: - FX_BYTE m_GammaValue[256]; + uint8_t m_GammaValue[256]; CFX_FontCache* m_pFontCache; CFX_FontMgr* m_pFontMgr; CCodec_ModuleMgr* m_pCodecModule; @@ -133,8 +133,8 @@ protected: void IntersectMaskRect(FX_RECT rect, FX_RECT mask_box, CFX_DIBitmapRef Mask); }; -extern const FX_BYTE g_GammaRamp[256]; -extern const FX_BYTE g_GammaInverse[256]; +extern const uint8_t g_GammaRamp[256]; +extern const uint8_t g_GammaInverse[256]; #define FX_GAMMA(value) (value) #define FX_GAMMA_INVERSE(value) (value) inline FX_ARGB ArgbGamma(FX_ARGB argb) diff --git a/core/include/fxge/fx_ge_apple.h b/core/include/fxge/fx_ge_apple.h index 90cd03455b..b22d31fa9f 100644 --- a/core/include/fxge/fx_ge_apple.h +++ b/core/include/fxge/fx_ge_apple.h @@ -13,9 +13,9 @@ class CFX_QuartzDevice : public CFX_RenderDevice public: CFX_QuartzDevice(); ~CFX_QuartzDevice(); - FX_BOOL Attach(CGContextRef context, FX_INT32 nDeviceClass = FXDC_DISPLAY); + FX_BOOL Attach(CGContextRef context, int32_t nDeviceClass = FXDC_DISPLAY); FX_BOOL Attach(CFX_DIBitmap* pBitmap); - FX_BOOL Create(FX_INT32 width, FX_INT32 height, FXDIB_Format format); + FX_BOOL Create(int32_t width, int32_t height, FXDIB_Format format); CGContextRef GetContext(); diff --git a/core/include/fxge/fx_ge_win32.h b/core/include/fxge/fx_ge_win32.h index c9cb2a35a9..3972090326 100644 --- a/core/include/fxge/fx_ge_win32.h +++ b/core/include/fxge/fx_ge_win32.h @@ -17,7 +17,7 @@ typedef struct WINDIB_Open_Args_ { int flags; - const FX_BYTE* memory_base; + const uint8_t* memory_base; size_t memory_size; diff --git a/core/include/reflow/fpdf_layout.h b/core/include/reflow/fpdf_layout.h index ebd879c764..b1038db329 100644 --- a/core/include/reflow/fpdf_layout.h +++ b/core/include/reflow/fpdf_layout.h @@ -252,7 +252,7 @@ typedef struct _LayoutProviderStyle { m_Language = LP_Lang_Unknow; m_bIgnoreInvisibleText = TRUE; } - FX_INT32 m_Language; + int32_t m_Language; FX_BOOL m_bIgnoreInvisibleText; } LAYOUTPROVIDER_STYLE; class IPDF_LayoutProvider diff --git a/core/include/reflow/reflowengine.h b/core/include/reflow/reflowengine.h index af3c943e97..30c7174053 100644 --- a/core/include/reflow/reflowengine.h +++ b/core/include/reflow/reflowengine.h @@ -22,11 +22,11 @@ public: virtual CFX_PrivateData* GetPrivateDataCtrl() = 0; - virtual void GetDisplayMatrix(CFX_AffineMatrix& matrix, FX_INT32 xPos, FX_INT32 yPos, FX_INT32 xSize, FX_INT32 ySize, FX_INT32 iRotate, const CFX_AffineMatrix* pPageMatrix) = 0; + virtual void GetDisplayMatrix(CFX_AffineMatrix& matrix, int32_t xPos, int32_t yPos, int32_t xSize, int32_t ySize, int32_t iRotate, const CFX_AffineMatrix* pPageMatrix) = 0; virtual FX_FLOAT GetPageHeight() = 0; virtual FX_FLOAT GetPageWidth() = 0; - virtual void FocusGetData(const CFX_AffineMatrix matrix, FX_INT32 x, FX_INT32 y, CFX_ByteString& str) = 0; - virtual FX_BOOL FocusGetPosition(const CFX_AffineMatrix matrix, CFX_ByteString str, FX_INT32& x, FX_INT32& y) = 0; + virtual void FocusGetData(const CFX_AffineMatrix matrix, int32_t x, int32_t y, CFX_ByteString& str) = 0; + virtual FX_BOOL FocusGetPosition(const CFX_AffineMatrix matrix, CFX_ByteString str, int32_t& x, int32_t& y) = 0; }; typedef struct _RF_ParseStyle { _RF_ParseStyle() diff --git a/core/src/fdrm/crypto/fx_crypt.cpp b/core/src/fdrm/crypto/fx_crypt.cpp index e67e5d7aab..da9fcc5693 100644 --- a/core/src/fdrm/crypto/fx_crypt.cpp +++ b/core/src/fdrm/crypto/fx_crypt.cpp @@ -62,23 +62,23 @@ void CRYPT_ArcFourCryptBlock(FX_LPBYTE pData, FX_DWORD size, FX_LPCBYTE key, FX_ struct md5_context { FX_DWORD total[2]; FX_DWORD state[4]; - FX_BYTE buffer[64]; + uint8_t buffer[64]; }; #define GET_FX_DWORD(n,b,i) \ { \ - (n) = (FX_DWORD) ((FX_BYTE *) b)[(i)] \ - | (((FX_DWORD) ((FX_BYTE *) b)[(i)+1]) << 8) \ - | (((FX_DWORD) ((FX_BYTE *) b)[(i)+2]) << 16) \ - | (((FX_DWORD) ((FX_BYTE *) b)[(i)+3]) << 24); \ + (n) = (FX_DWORD) ((uint8_t *) b)[(i)] \ + | (((FX_DWORD) ((uint8_t *) b)[(i)+1]) << 8) \ + | (((FX_DWORD) ((uint8_t *) b)[(i)+2]) << 16) \ + | (((FX_DWORD) ((uint8_t *) b)[(i)+3]) << 24); \ } #define PUT_FX_DWORD(n,b,i) \ { \ - (((FX_BYTE *) b)[(i)] ) = (FX_BYTE) (((n) ) & 0xFF); \ - (((FX_BYTE *) b)[(i)+1]) = (FX_BYTE) (((n) >> 8) & 0xFF); \ - (((FX_BYTE *) b)[(i)+2]) = (FX_BYTE) (((n) >> 16) & 0xFF); \ - (((FX_BYTE *) b)[(i)+3]) = (FX_BYTE) (((n) >> 24) & 0xFF); \ + (((uint8_t *) b)[(i)] ) = (uint8_t) (((n) ) & 0xFF); \ + (((uint8_t *) b)[(i)+1]) = (uint8_t) (((n) >> 8) & 0xFF); \ + (((uint8_t *) b)[(i)+2]) = (uint8_t) (((n) >> 16) & 0xFF); \ + (((uint8_t *) b)[(i)+3]) = (uint8_t) (((n) >> 24) & 0xFF); \ } -void md5_process( struct md5_context *ctx, const FX_BYTE data[64] ) +void md5_process( struct md5_context *ctx, const uint8_t data[64] ) { FX_DWORD A, B, C, D, X[16]; GET_FX_DWORD( X[0], data, 0 ); @@ -222,17 +222,17 @@ void CRYPT_MD5Update(FX_LPVOID pctx, FX_LPCBYTE input, FX_DWORD length ) FXSYS_memcpy32( (void *) (ctx->buffer + left), (void *) input, length ); } } -const FX_BYTE md5_padding[64] = { +const uint8_t md5_padding[64] = { 0x80, 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, 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, FX_BYTE digest[16] ) +void CRYPT_MD5Finish(FX_LPVOID pctx, uint8_t digest[16] ) { struct md5_context *ctx = (struct md5_context *)pctx; FX_DWORD last, padn; - FX_BYTE msglen[8]; + uint8_t msglen[8]; PUT_FX_DWORD( ctx->total[0], msglen, 0 ); PUT_FX_DWORD( ctx->total[1], msglen, 4 ); last = ( ctx->total[0] >> 3 ) & 0x3F; @@ -244,7 +244,7 @@ void CRYPT_MD5Finish(FX_LPVOID pctx, FX_BYTE 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, FX_BYTE digest[16]) +void CRYPT_MD5Generate(FX_LPCBYTE input, FX_DWORD length, uint8_t digest[16]) { md5_context ctx; CRYPT_MD5Start(&ctx); diff --git a/core/src/fdrm/crypto/fx_crypt_sha.cpp b/core/src/fdrm/crypto/fx_crypt_sha.cpp index 4e931b2d03..1a55d11633 100644 --- a/core/src/fdrm/crypto/fx_crypt_sha.cpp +++ b/core/src/fdrm/crypto/fx_crypt_sha.cpp @@ -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, FX_BYTE digest[20]) +void CRYPT_SHA1Finish(FX_LPVOID context, uint8_t digest[20]) { SHA_State * s = (SHA_State*)context; int i; @@ -154,7 +154,7 @@ void CRYPT_SHA1Finish(FX_LPVOID context, FX_BYTE digest[20]) digest[i * 4 + 3] = (s->h[i]) & 0xFF; } } -void CRYPT_SHA1Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[20]) +void CRYPT_SHA1Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[20]) { SHA_State s; CRYPT_SHA1Start(&s); @@ -164,7 +164,7 @@ void CRYPT_SHA1Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[20]) typedef struct { FX_DWORD total[2]; FX_DWORD state[8]; - FX_BYTE buffer[64]; + uint8_t buffer[64]; } sha256_context; #define GET_FX_DWORD(n,b,i) \ @@ -176,10 +176,10 @@ sha256_context; } #define PUT_FX_DWORD(n,b,i) \ { \ - (b)[(i) ] = (FX_BYTE) ( (n) >> 24 ); \ - (b)[(i) + 1] = (FX_BYTE) ( (n) >> 16 ); \ - (b)[(i) + 2] = (FX_BYTE) ( (n) >> 8 ); \ - (b)[(i) + 3] = (FX_BYTE) ( (n) ); \ + (b)[(i) ] = (uint8_t) ( (n) >> 24 ); \ + (b)[(i) + 1] = (uint8_t) ( (n) >> 16 ); \ + (b)[(i) + 2] = (uint8_t) ( (n) >> 8 ); \ + (b)[(i) + 3] = (uint8_t) ( (n) ); \ } void CRYPT_SHA256Start( FX_LPVOID context ) { @@ -195,7 +195,7 @@ void CRYPT_SHA256Start( FX_LPVOID context ) ctx->state[6] = 0x1F83D9AB; ctx->state[7] = 0x5BE0CD19; } -static void sha256_process( sha256_context *ctx, const FX_BYTE data[64] ) +static void sha256_process( sha256_context *ctx, const uint8_t data[64] ) { FX_DWORD temp1, temp2, W[64]; FX_DWORD A, B, C, D, E, F, G, H; @@ -347,18 +347,18 @@ void CRYPT_SHA256Update( void* context, FX_LPCBYTE input, FX_DWORD length ) (void *) input, length ); } } -static const FX_BYTE sha256_padding[64] = { +static const uint8_t sha256_padding[64] = { 0x80, 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, 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, FX_BYTE digest[32] ) +void CRYPT_SHA256Finish( FX_LPVOID context, uint8_t digest[32] ) { sha256_context *ctx = (sha256_context *)context; FX_DWORD last, padn; FX_DWORD high, low; - FX_BYTE msglen[8]; + uint8_t msglen[8]; high = ( ctx->total[0] >> 29 ) | ( ctx->total[1] << 3 ); low = ( ctx->total[0] << 3 ); @@ -377,7 +377,7 @@ void CRYPT_SHA256Finish( FX_LPVOID context, FX_BYTE 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, FX_BYTE digest[32]) +void CRYPT_SHA256Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[32]) { sha256_context ctx; CRYPT_SHA256Start(&ctx); @@ -385,14 +385,14 @@ void CRYPT_SHA256Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[32]) CRYPT_SHA256Finish(&ctx, digest); } typedef struct { - FX_UINT64 total[2]; - FX_UINT64 state[8]; - FX_BYTE buffer[128]; + uint64_t total[2]; + uint64_t state[8]; + uint8_t buffer[128]; } sha384_context; -FX_UINT64 FX_ato64i(FX_LPCSTR str) +uint64_t FX_ato64i(FX_LPCSTR str) { FXSYS_assert(str != NULL); - FX_UINT64 ret = 0; + uint64_t ret = 0; int len = (int)FXSYS_strlen(str); len = len > 16 ? 16 : len; for (int i = 0; i < len; ++i) { @@ -441,7 +441,7 @@ void CRYPT_SHA384Start(FX_LPVOID context) temp2 = SHA384_S2(a) + SHA384_F0(a,b,c); \ d += temp1; h = temp1 + temp2; \ } -static const FX_BYTE sha384_padding[128] = { +static const uint8_t sha384_padding[128] = { 0x80, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -536,31 +536,31 @@ static FX_LPCSTR constants[] = { }; #define GET_FX_64WORD(n,b,i) \ { \ - (n) = ( (FX_UINT64) (b)[(i) ] << 56 ) \ - | ( (FX_UINT64) (b)[(i) + 1] << 48 ) \ - | ( (FX_UINT64) (b)[(i) + 2] << 40 ) \ - | ( (FX_UINT64) (b)[(i) + 3] << 32 ) \ - | ( (FX_UINT64) (b)[(i) + 4] << 24 ) \ - | ( (FX_UINT64) (b)[(i) + 5] << 16 ) \ - | ( (FX_UINT64) (b)[(i) + 6] << 8 ) \ - | ( (FX_UINT64) (b)[(i) + 7] ); \ + (n) = ( (uint64_t) (b)[(i) ] << 56 ) \ + | ( (uint64_t) (b)[(i) + 1] << 48 ) \ + | ( (uint64_t) (b)[(i) + 2] << 40 ) \ + | ( (uint64_t) (b)[(i) + 3] << 32 ) \ + | ( (uint64_t) (b)[(i) + 4] << 24 ) \ + | ( (uint64_t) (b)[(i) + 5] << 16 ) \ + | ( (uint64_t) (b)[(i) + 6] << 8 ) \ + | ( (uint64_t) (b)[(i) + 7] ); \ } #define PUT_FX_64DWORD(n,b,i) \ { \ - (b)[(i) ] = (FX_BYTE) ( (n) >> 56 ); \ - (b)[(i) + 1] = (FX_BYTE) ( (n) >> 48 ); \ - (b)[(i) + 2] = (FX_BYTE) ( (n) >> 40 ); \ - (b)[(i) + 3] = (FX_BYTE) ( (n) >> 32 ); \ - (b)[(i) + 4] = (FX_BYTE) ( (n) >> 24 ); \ - (b)[(i) + 5] = (FX_BYTE) ( (n) >> 16 ); \ - (b)[(i) + 6] = (FX_BYTE) ( (n) >> 8 ); \ - (b)[(i) + 7] = (FX_BYTE) ( (n) ); \ + (b)[(i) ] = (uint8_t) ( (n) >> 56 ); \ + (b)[(i) + 1] = (uint8_t) ( (n) >> 48 ); \ + (b)[(i) + 2] = (uint8_t) ( (n) >> 40 ); \ + (b)[(i) + 3] = (uint8_t) ( (n) >> 32 ); \ + (b)[(i) + 4] = (uint8_t) ( (n) >> 24 ); \ + (b)[(i) + 5] = (uint8_t) ( (n) >> 16 ); \ + (b)[(i) + 6] = (uint8_t) ( (n) >> 8 ); \ + (b)[(i) + 7] = (uint8_t) ( (n) ); \ } -static void sha384_process( sha384_context *ctx, const FX_BYTE data[128] ) +static void sha384_process( sha384_context *ctx, const uint8_t data[128] ) { - FX_UINT64 temp1, temp2; - FX_UINT64 A, B, C, D, E, F, G, H; - FX_UINT64 W[80]; + uint64_t temp1, temp2; + uint64_t A, B, C, D, E, F, G, H; + uint64_t W[80]; GET_FX_64WORD(W[0], data, 0); GET_FX_64WORD(W[1], data, 8); GET_FX_64WORD(W[2], data, 16); @@ -586,7 +586,7 @@ static void sha384_process( sha384_context *ctx, const FX_BYTE data[128] ) G = ctx->state[6]; H = ctx->state[7]; for (int i = 0; i < 10; ++i) { - FX_UINT64 temp[8]; + uint64_t temp[8]; if (i < 2) { temp[0] = W[i * 8]; temp[1] = W[i * 8 + 1]; @@ -655,13 +655,13 @@ void CRYPT_SHA384Update(FX_LPVOID context, FX_LPCBYTE input, FX_DWORD length) (void *) input, length ); } } -void CRYPT_SHA384Finish(FX_LPVOID context, FX_BYTE digest[48]) +void CRYPT_SHA384Finish(FX_LPVOID context, uint8_t digest[48]) { sha384_context *ctx = (sha384_context *)context; FX_DWORD last, padn; - FX_BYTE msglen[16]; + uint8_t msglen[16]; FXSYS_memset32(msglen, 0, 16); - FX_UINT64 high, low; + uint64_t high, low; high = ( ctx->total[0] >> 29 ) | ( ctx->total[1] << 3 ); low = ( ctx->total[0] << 3 ); @@ -678,7 +678,7 @@ void CRYPT_SHA384Finish(FX_LPVOID context, FX_BYTE 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, FX_BYTE digest[64]) +void CRYPT_SHA384Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[64]) { sha384_context context; CRYPT_SHA384Start(&context); @@ -705,13 +705,13 @@ void CRYPT_SHA512Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size) { CRYPT_SHA384Update(context, data, size); } -void CRYPT_SHA512Finish(FX_LPVOID context, FX_BYTE digest[64]) +void CRYPT_SHA512Finish(FX_LPVOID context, uint8_t digest[64]) { sha384_context *ctx = (sha384_context *)context; FX_DWORD last, padn; - FX_BYTE msglen[16]; + uint8_t msglen[16]; FXSYS_memset32(msglen, 0, 16); - FX_UINT64 high, low; + uint64_t high, low; high = ( ctx->total[0] >> 29 ) | ( ctx->total[1] << 3 ); low = ( ctx->total[0] << 3 ); @@ -730,7 +730,7 @@ void CRYPT_SHA512Finish(FX_LPVOID context, FX_BYTE 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, FX_BYTE digest[64]) +void CRYPT_SHA512Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[64]) { sha384_context context; CRYPT_SHA512Start(&context); diff --git a/core/src/fpdfapi/fpdf_edit/editint.h b/core/src/fpdfapi/fpdf_edit/editint.h index faa23f929d..38c33439ec 100644 --- a/core/src/fpdfapi/fpdf_edit/editint.h +++ b/core/src/fpdfapi/fpdf_edit/editint.h @@ -14,8 +14,8 @@ public: FX_BOOL Start(); - FX_INT32 CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj); - FX_INT32 CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize); + int32_t CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj); + int32_t CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize); FX_FILESIZE End(CPDF_Creator* pCreator); @@ -23,7 +23,7 @@ public: CFX_ByteTextBuf m_Buffer; FX_DWORD m_dwObjNum; - FX_INT32 m_index; + int32_t m_index; protected: CFX_DWordArray m_OffsetArray; @@ -36,9 +36,9 @@ public: FX_BOOL Start(); - FX_INT32 CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj, CPDF_Creator *pCreator); + int32_t CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj, CPDF_Creator *pCreator); - FX_INT32 CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator); + int32_t CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator); FX_BOOL End(CPDF_Creator *pCreator, FX_BOOL bEOF = FALSE); FX_BOOL AddObjectNumberToIndexArray(FX_DWORD objnum); @@ -51,9 +51,9 @@ public: FX_DWORD m_dwTempObjNum; protected: - FX_INT32 EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF = TRUE); + int32_t EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF = TRUE); FX_BOOL GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF); - FX_INT32 m_iSeg; + int32_t m_iSeg; CPDF_ObjectStream m_ObjStream; CFX_ByteTextBuf m_Buffer; }; diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp index b64151ad06..65b482bf30 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp @@ -142,7 +142,7 @@ void CPDF_PageContentGenerate::TransformContent(CFX_Matrix& matrix) size += pContentArray[i]->GetSize() + 1; } int pos = 0; - FX_LPBYTE pBuf = FX_Alloc(FX_BYTE, size); + FX_LPBYTE 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 3abbcee046..035baa398f 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp @@ -8,13 +8,13 @@ #include "editint.h" #define PDF_OBJECTSTREAM_MAXLENGTH (256 * 1024) #define PDF_XREFSTREAM_MAXSIZE 10000 -extern void FlateEncode(const FX_BYTE* src_buf, FX_DWORD src_data, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); +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 FX_BOOL IsSignatureDict(const CPDF_Dictionary* pDict); -FX_INT32 PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive *pFile, FX_FILESIZE& offset) +int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive *pFile, FX_FILESIZE& offset) { - FX_INT32 len = 0; + int32_t len = 0; if (pObj == NULL) { if (pFile->AppendString(FX_BSTRC(" null")) < 0) { return -1; @@ -171,10 +171,10 @@ FX_INT32 PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive } return 1; } -FX_INT32 PDF_CreatorWriteTrailer(CPDF_Document* pDocument, CFX_FileBufferArchive* pFile, CPDF_Array* pIDArray, FX_BOOL bCompress) +int32_t PDF_CreatorWriteTrailer(CPDF_Document* pDocument, CFX_FileBufferArchive* pFile, CPDF_Array* pIDArray, FX_BOOL bCompress) { FX_FILESIZE offset = 0; - FX_INT32 len = 0; + int32_t len = 0; FXSYS_assert(pDocument && pFile); CPDF_Parser *pParser = (CPDF_Parser*)pDocument->GetParser(); if (pParser) { @@ -259,14 +259,14 @@ FX_INT32 PDF_CreatorWriteTrailer(CPDF_Document* pDocument, CFX_FileBufferArchive } return offset; } -FX_INT32 PDF_CreatorWriteEncrypt(const CPDF_Dictionary* pEncryptDict, FX_DWORD dwObjNum, CFX_FileBufferArchive *pFile) +int32_t PDF_CreatorWriteEncrypt(const CPDF_Dictionary* pEncryptDict, FX_DWORD dwObjNum, CFX_FileBufferArchive *pFile) { if (!pEncryptDict) { return 0; } FXSYS_assert(pFile); FX_FILESIZE offset = 0; - FX_INT32 len = 0; + int32_t len = 0; if (pFile->AppendString(FX_BSTRC("/Encrypt")) < 0) { return -1; } @@ -289,7 +289,7 @@ FX_BOOL PDF_GenerateFileID(FX_DWORD dwSeed1, FX_DWORD dwSeed2, FX_LPDWORD pBuffe return FALSE; } FX_LPVOID pContext = FX_Random_MT_Start(dwSeed1); - FX_INT32 i = 0; + int32_t i = 0; for (i = 0; i < 2; i++) { *pBuffer++ = FX_Random_MT_Generate(pContext); } @@ -414,7 +414,7 @@ FX_BOOL CPDF_Encryptor::Initialize(CPDF_CryptoHandler* pHandler, int objnum, FX_ return TRUE; } m_dwSize = pHandler->EncryptGetSize(objnum, 0, src_data, src_size); - m_pData = FX_Alloc(FX_BYTE, m_dwSize); + m_pData = FX_Alloc(uint8_t, m_dwSize); pHandler->EncryptContent(objnum, 0, src_data, src_size, m_pData, m_dwSize); m_bNewBuf = TRUE; return TRUE; @@ -439,14 +439,14 @@ FX_BOOL CPDF_ObjectStream::Start() m_index = 0; return TRUE; } -FX_INT32 CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj) +int32_t CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj) { m_ObjNumArray.Add(dwObjNum); m_OffsetArray.Add(m_Buffer.GetLength()); m_Buffer << pObj; return 1; } -FX_INT32 CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize) +int32_t CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize) { m_ObjNumArray.Add(dwObjNum); m_OffsetArray.Add(m_Buffer.GetLength()); @@ -466,12 +466,12 @@ FX_FILESIZE CPDF_ObjectStream::End(CPDF_Creator* pCreator) m_dwObjNum = ++pCreator->m_dwLastObjNum; } CFX_ByteTextBuf tempBuffer; - FX_INT32 iCount = m_ObjNumArray.GetSize(); - for (FX_INT32 i = 0; i < iCount; i++) { + int32_t iCount = m_ObjNumArray.GetSize(); + for (int32_t i = 0; i < iCount; i++) { tempBuffer << m_ObjNumArray.ElementAt(i) << FX_BSTRC(" ") << m_OffsetArray.ElementAt(i) << FX_BSTRC(" "); } FX_FILESIZE &offset = pCreator->m_Offset; - FX_INT32 len = pFile->AppendDWord(m_dwObjNum); + int32_t len = pFile->AppendDWord(m_dwObjNum); if (len < 0) { return -1; } @@ -552,7 +552,7 @@ FX_BOOL CPDF_XRefStream::Start() m_iSeg = 0; return TRUE; } -FX_INT32 CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj, CPDF_Creator *pCreator) +int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj, CPDF_Creator *pCreator) { if (!pCreator) { return 0; @@ -564,7 +564,7 @@ FX_INT32 CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_O } return EndObjectStream(pCreator); } -FX_INT32 CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator) +int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator) { if (!pCreator) { return 0; @@ -601,7 +601,7 @@ static void _AppendIndex1(CFX_ByteTextBuf& buffer, FX_FILESIZE offset) buffer.AppendByte(0); buffer.AppendByte(0); } -static void _AppendIndex2(CFX_ByteTextBuf& buffer, FX_DWORD objnum, FX_INT32 index) +static void _AppendIndex2(CFX_ByteTextBuf& buffer, FX_DWORD objnum, int32_t index) { buffer.AppendByte(2); buffer.AppendByte(FX_GETBYTEOFFSET24(objnum)); @@ -611,7 +611,7 @@ static void _AppendIndex2(CFX_ByteTextBuf& buffer, FX_DWORD objnum, FX_INT32 ind buffer.AppendByte(FX_GETBYTEOFFSET8(index)); buffer.AppendByte(FX_GETBYTEOFFSET0(index)); } -FX_INT32 CPDF_XRefStream::EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF) +int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF) { FX_FILESIZE objOffset = 0; if (bEOF) { @@ -624,8 +624,8 @@ FX_INT32 CPDF_XRefStream::EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF) if (!dwObjStmNum) { dwObjStmNum = ++pCreator->m_dwLastObjNum; } - FX_INT32 iSize = m_ObjStream.m_ObjNumArray.GetSize(); - FX_INT32 iSeg = m_IndexArray.GetSize() / 2; + int32_t iSize = m_ObjStream.m_ObjNumArray.GetSize(); + int32_t iSeg = m_IndexArray.GetSize() / 2; if (!(pCreator->m_dwFlags & FPDFCREATE_INCREMENTAL)) { if (m_dwTempObjNum == 0) { _AppendIndex0(m_Buffer); @@ -656,7 +656,7 @@ FX_INT32 CPDF_XRefStream::EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF) } return 1; } - FX_INT32 &j = m_ObjStream.m_index; + int32_t &j = m_ObjStream.m_index; for (int i = m_iSeg; i < iSeg; i++) { FX_DWORD start = m_IndexArray.ElementAt(i * 2); FX_DWORD end = m_IndexArray.ElementAt(i * 2 + 1) + start; @@ -700,7 +700,7 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF } _AppendIndex1(m_Buffer, offset_tmp); FX_FILESIZE &offset = pCreator->m_Offset; - FX_INT32 len = pFile->AppendDWord(objnum); + int32_t len = pFile->AppendDWord(objnum); if (len < 0) { return FALSE; } @@ -722,8 +722,8 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF } offset += len; } else { - FX_INT32 iSeg = m_IndexArray.GetSize() / 2; - for (FX_INT32 i = 0; i < iSeg; i++) { + int32_t iSeg = m_IndexArray.GetSize() / 2; + for (int32_t i = 0; i < iSeg; i++) { if ((len = pFile->AppendDWord(m_IndexArray.ElementAt(i * 2))) < 0) { return FALSE; } @@ -754,7 +754,7 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF FX_CHAR offset_buf[20]; FXSYS_memset32(offset_buf, 0, sizeof(offset_buf)); FXSYS_i64toa(m_PrevOffset, offset_buf, 10); - FX_INT32 len = (FX_INT32)FXSYS_strlen(offset_buf); + int32_t len = (int32_t)FXSYS_strlen(offset_buf); if (pFile->AppendBlock(offset_buf, len) < 0) { return -1; } @@ -832,7 +832,7 @@ FX_BOOL CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator) } } } else { - FX_INT32 iSeg = m_IndexArray.GetSize() / 2; + int32_t iSeg = m_IndexArray.GetSize() / 2; for (int i = 0; i < iSeg; i++) { FX_DWORD start = m_IndexArray.ElementAt(i * 2); FX_DWORD end = m_IndexArray.ElementAt(i * 2 + 1) + start; @@ -845,14 +845,14 @@ FX_BOOL CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator) } FX_BOOL CPDF_XRefStream::AddObjectNumberToIndexArray(FX_DWORD objnum) { - FX_INT32 iSize = m_IndexArray.GetSize(); + int32_t iSize = m_IndexArray.GetSize(); if (iSize == 0) { m_IndexArray.Add(objnum); m_IndexArray.Add(1); } else { FXSYS_assert(iSize > 1); FX_DWORD startobjnum = m_IndexArray.ElementAt(iSize - 2); - FX_INT32 iCount = m_IndexArray.ElementAt(iSize - 1); + int32_t iCount = m_IndexArray.ElementAt(iSize - 1); if (objnum == startobjnum + iCount) { m_IndexArray[iSize - 1] = iCount + 1; } else { @@ -906,20 +906,20 @@ static FX_BOOL _IsXRefNeedEnd(CPDF_XRefStream* pXRef, FX_DWORD flag) if (!(flag & FPDFCREATE_INCREMENTAL)) { return FALSE; } - FX_INT32 iSize = pXRef->m_IndexArray.GetSize() / 2; - FX_INT32 iCount = 0; - for (FX_INT32 i = 0; i < iSize; i++) { + int32_t iSize = pXRef->m_IndexArray.GetSize() / 2; + int32_t iCount = 0; + for (int32_t i = 0; i < iSize; i++) { iCount += pXRef->m_IndexArray.ElementAt(i * 2 + 1); } return (iCount >= PDF_XREFSTREAM_MAXSIZE); } -FX_INT32 CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) +int32_t CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) { if (!m_pXRefStream) { return 1; } FX_DWORD objnum = pObj->GetObjNum(); - if (m_pParser && m_pParser->m_ObjVersion.GetSize() > (FX_INT32)objnum && m_pParser->m_ObjVersion[objnum] > 0) { + if (m_pParser && m_pParser->m_ObjVersion.GetSize() > (int32_t)objnum && m_pParser->m_ObjVersion[objnum] > 0) { return 1; } if (pObj->GetType() == PDFOBJ_NUMBER) { @@ -958,13 +958,13 @@ FX_INT32 CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) } return 0; } -FX_INT32 CPDF_Creator::WriteIndirectObjectToStream(FX_DWORD objnum, FX_LPCBYTE pBuffer, FX_DWORD dwSize) +int32_t CPDF_Creator::WriteIndirectObjectToStream(FX_DWORD objnum, FX_LPCBYTE pBuffer, FX_DWORD dwSize) { if (!m_pXRefStream) { return 1; } m_pXRefStream->AddObjectNumberToIndexArray(objnum); - FX_INT32 iRet = m_pXRefStream->CompressIndirectObject(objnum, pBuffer, dwSize, this); + int32_t iRet = m_pXRefStream->CompressIndirectObject(objnum, pBuffer, dwSize, this); if (iRet < 1) { return iRet; } @@ -979,7 +979,7 @@ FX_INT32 CPDF_Creator::WriteIndirectObjectToStream(FX_DWORD objnum, FX_LPCBYTE p } return 0; } -FX_INT32 CPDF_Creator::AppendObjectNumberToXRef(FX_DWORD objnum) +int32_t CPDF_Creator::AppendObjectNumberToXRef(FX_DWORD objnum) { if (!m_pXRefStream) { return 1; @@ -996,7 +996,7 @@ FX_INT32 CPDF_Creator::AppendObjectNumberToXRef(FX_DWORD objnum) } return 0; } -FX_INT32 CPDF_Creator::WriteStream(const CPDF_Object* pStream, FX_DWORD objnum, CPDF_CryptoHandler* pCrypto) +int32_t CPDF_Creator::WriteStream(const CPDF_Object* pStream, FX_DWORD objnum, CPDF_CryptoHandler* pCrypto) { CPDF_FlateEncoder encoder; encoder.Initialize((CPDF_Stream*)pStream, pStream == m_pMetadata ? FALSE : m_bCompress); @@ -1026,9 +1026,9 @@ FX_INT32 CPDF_Creator::WriteStream(const CPDF_Object* pStream, FX_DWORD objnum, m_Offset += len; return 1; } -FX_INT32 CPDF_Creator::WriteIndirectObj(FX_DWORD objnum, const CPDF_Object* pObj) +int32_t CPDF_Creator::WriteIndirectObj(FX_DWORD objnum, const CPDF_Object* pObj) { - FX_INT32 len = m_File.AppendDWord(objnum); + int32_t len = m_File.AppendDWord(objnum); if (len < 0) { return -1; } @@ -1057,17 +1057,17 @@ FX_INT32 CPDF_Creator::WriteIndirectObj(FX_DWORD objnum, const CPDF_Object* pObj } return 0; } -FX_INT32 CPDF_Creator::WriteIndirectObj(const CPDF_Object* pObj) +int32_t CPDF_Creator::WriteIndirectObj(const CPDF_Object* pObj) { - FX_INT32 iRet = WriteIndirectObjectToStream(pObj); + int32_t iRet = WriteIndirectObjectToStream(pObj); if (iRet < 1) { return iRet; } return WriteIndirectObj(pObj->GetObjNum(), pObj); } -FX_INT32 CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, FX_BOOL bEncrypt) +int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, FX_BOOL bEncrypt) { - FX_INT32 len = 0; + int32_t len = 0; if (pObj == NULL) { if (m_File.AppendString(FX_BSTRC(" null")) < 0) { return -1; @@ -1246,14 +1246,14 @@ FX_INT32 CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, } return 1; } -FX_INT32 CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) +int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) { if(m_pParser->m_V5Type[objnum] == 0 || m_pParser->m_V5Type[objnum] == 255) { return 0; } m_ObjectOffset[objnum] = m_Offset; FX_LPVOID valuetemp = NULL; - FX_BOOL bExistInMap = m_pDocument->m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, valuetemp); + FX_BOOL bExistInMap = m_pDocument->m_IndirectObjs.Lookup((FX_LPVOID)(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); @@ -1269,7 +1269,7 @@ FX_INT32 CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) m_pDocument->ReleaseIndirectObject(objnum); } } else { - FX_BYTE* pBuffer; + uint8_t* pBuffer; FX_DWORD size; m_pParser->GetIndirectBinary(objnum, pBuffer, size); if (pBuffer == NULL) { @@ -1282,7 +1282,7 @@ FX_INT32 CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) return -1; } } else { - FX_INT32 len = m_File.AppendDWord(objnum); + int32_t len = m_File.AppendDWord(objnum); if (len < 0) { return -1; } @@ -1312,12 +1312,12 @@ FX_INT32 CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) } return 1; } -FX_INT32 CPDF_Creator::WriteOldObjs(IFX_Pause *pPause) +int32_t CPDF_Creator::WriteOldObjs(IFX_Pause *pPause) { FX_DWORD nOldSize = m_pParser->m_CrossRef.GetSize(); - FX_DWORD objnum = (FX_DWORD)(FX_UINTPTR)m_Pos; + FX_DWORD objnum = (FX_DWORD)(uintptr_t)m_Pos; for(; objnum < nOldSize; objnum ++) { - FX_INT32 iRet = WriteOldIndirectObject(objnum); + int32_t iRet = WriteOldIndirectObject(objnum); if (!iRet) { continue; } @@ -1326,20 +1326,20 @@ FX_INT32 CPDF_Creator::WriteOldObjs(IFX_Pause *pPause) } m_ObjectSize[objnum] = (FX_DWORD)(m_Offset - m_ObjectOffset[objnum]); if (pPause && pPause->NeedToPauseNow()) { - m_Pos = (FX_LPVOID)(FX_UINTPTR)(objnum + 1); + m_Pos = (FX_LPVOID)(uintptr_t)(objnum + 1); return 1; } } return 0; } -FX_INT32 CPDF_Creator::WriteNewObjs(FX_BOOL bIncremental, IFX_Pause *pPause) +int32_t CPDF_Creator::WriteNewObjs(FX_BOOL bIncremental, IFX_Pause *pPause) { - FX_INT32 iCount = m_NewObjNumArray.GetSize(); - FX_INT32 index = (FX_INT32)(FX_UINTPTR)m_Pos; + int32_t iCount = m_NewObjNumArray.GetSize(); + int32_t index = (int32_t)(uintptr_t)m_Pos; while (index < iCount) { FX_DWORD objnum = m_NewObjNumArray.ElementAt(index); CPDF_Object *pObj = NULL; - m_pDocument->m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, (FX_LPVOID&)pObj); + m_pDocument->m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, (FX_LPVOID&)pObj); if (NULL == pObj) { ++index; continue; @@ -1351,7 +1351,7 @@ FX_INT32 CPDF_Creator::WriteNewObjs(FX_BOOL bIncremental, IFX_Pause *pPause) m_ObjectSize[objnum] = (FX_DWORD)(m_Offset - m_ObjectOffset[objnum]); index++; if (pPause && pPause->NeedToPauseNow()) { - m_Pos = (FX_POSITION)(FX_UINTPTR)index; + m_Pos = (FX_POSITION)(uintptr_t)index; return 1; } } @@ -1406,11 +1406,11 @@ void CPDF_Creator::InitNewObjNumOffsets() } AppendNewObjNum(objnum); } - FX_INT32 iCount = m_NewObjNumArray.GetSize(); + int32_t iCount = m_NewObjNumArray.GetSize(); if (iCount == 0) { return; } - FX_INT32 i = 0; + int32_t i = 0; FX_DWORD dwStartObjNum = 0; FX_BOOL bCrossRefValid = m_pParser && m_pParser->GetLastXRefOffset() > 0; while (i < iCount) { @@ -1447,10 +1447,10 @@ void CPDF_Creator::InitNewObjNumOffsets() } void CPDF_Creator::AppendNewObjNum(FX_DWORD objbum) { - FX_INT32 iStart = 0, iFind = 0; - FX_INT32 iEnd = m_NewObjNumArray.GetUpperBound(); + int32_t iStart = 0, iFind = 0; + int32_t iEnd = m_NewObjNumArray.GetUpperBound(); while (iStart <= iEnd) { - FX_INT32 iMid = (iStart + iEnd) / 2; + int32_t iMid = (iStart + iEnd) / 2; FX_DWORD dwMid = m_NewObjNumArray.ElementAt(iMid); if (objbum < dwMid) { iEnd = iMid - 1; @@ -1469,7 +1469,7 @@ void CPDF_Creator::AppendNewObjNum(FX_DWORD objbum) } m_NewObjNumArray.InsertAt(iFind, objbum); } -FX_INT32 CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause) +int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause) { FXSYS_assert(m_iStage > -1 || m_iStage < 20); if (m_iStage == 0) { @@ -1497,13 +1497,13 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause) return -1; } m_Offset += 7; - FX_INT32 version = 7; + int32_t version = 7; if (m_FileVersion) { version = m_FileVersion; } else if (m_pParser) { version = m_pParser->GetFileVersion(); } - FX_INT32 len = m_File.AppendDWord(version % 10); + int32_t len = m_File.AppendDWord(version % 10); if (len < 0) { return -1; } @@ -1517,15 +1517,15 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause) } else { IFX_FileRead* pSrcFile = m_pParser->GetFileAccess(); m_Offset = pSrcFile->GetSize(); - m_Pos = (FX_LPVOID)(FX_UINTPTR)m_Offset; + m_Pos = (FX_LPVOID)(uintptr_t)m_Offset; m_iStage = 15; } } if (m_iStage == 15) { if ((m_dwFlags & FPDFCREATE_NO_ORIGINAL) == 0 && m_Pos) { IFX_FileRead* pSrcFile = m_pParser->GetFileAccess(); - FX_BYTE buffer[4096]; - FX_DWORD src_size = (FX_DWORD)(FX_UINTPTR)m_Pos; + uint8_t buffer[4096]; + FX_DWORD src_size = (FX_DWORD)(uintptr_t)m_Pos; while (src_size) { FX_DWORD block_size = src_size > 4096 ? 4096 : src_size; if (!pSrcFile->ReadBlock(buffer, m_Offset - src_size, block_size)) { @@ -1536,7 +1536,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause) } src_size -= block_size; if (pPause && pPause->NeedToPauseNow()) { - m_Pos = (FX_LPVOID)(FX_UINTPTR)src_size; + m_Pos = (FX_LPVOID)(uintptr_t)src_size; return 1; } } @@ -1564,30 +1564,30 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause) InitNewObjNumOffsets(); return m_iStage; } -FX_INT32 CPDF_Creator::WriteDoc_Stage2(IFX_Pause *pPause) +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)(FX_UINTPTR)0; + m_Pos = (FX_LPVOID)(uintptr_t)0; m_iStage = 21; } else { m_iStage = 25; } } if (m_iStage == 21) { - FX_INT32 iRet = WriteOldObjs(pPause); + int32_t iRet = WriteOldObjs(pPause); if (iRet) { return iRet; } m_iStage = 25; } if (m_iStage == 25) { - m_Pos = (FX_LPVOID)(FX_UINTPTR)0; + m_Pos = (FX_LPVOID)(uintptr_t)0; m_iStage = 26; } if (m_iStage == 26) { - FX_INT32 iRet = WriteNewObjs((m_dwFlags & FPDFCREATE_INCREMENTAL) != 0, pPause); + int32_t iRet = WriteNewObjs((m_dwFlags & FPDFCREATE_INCREMENTAL) != 0, pPause); if (iRet) { return iRet; } @@ -1613,7 +1613,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage2(IFX_Pause *pPause) } return m_iStage; } -FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) +int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) { FXSYS_assert(m_iStage >= 80 || m_iStage < 90); FX_DWORD dwLastObjNum = m_dwLastObjNum; @@ -1630,13 +1630,13 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) if (m_File.AppendString(str) < 0) { return -1; } - m_Pos = (FX_LPVOID)(FX_UINTPTR)1; + m_Pos = (FX_LPVOID)(uintptr_t)1; m_iStage = 81; } else { if (m_File.AppendString(FX_BSTRC("xref\r\n")) < 0) { return -1; } - m_Pos = (FX_LPVOID)(FX_UINTPTR)0; + m_Pos = (FX_LPVOID)(uintptr_t)0; m_iStage = 82; } } else { @@ -1645,7 +1645,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) } if (m_iStage == 81) { CFX_ByteString str; - FX_DWORD i = (FX_DWORD)(FX_UINTPTR)m_Pos, j; + FX_DWORD i = (FX_DWORD)(uintptr_t)m_Pos, j; while (i <= dwLastObjNum) { while (i <= dwLastObjNum && !m_ObjectOffset.GetPtrAt(i)) { i++; @@ -1675,7 +1675,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) break; } if (pPause && pPause->NeedToPauseNow()) { - m_Pos = (FX_LPVOID)(FX_UINTPTR)i; + m_Pos = (FX_LPVOID)(uintptr_t)i; return 1; } } @@ -1683,10 +1683,10 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) } if (m_iStage == 82) { CFX_ByteString str; - FX_INT32 iCount = m_NewObjNumArray.GetSize(); - FX_INT32 i = (FX_INT32)(FX_UINTPTR)m_Pos; + int32_t iCount = m_NewObjNumArray.GetSize(); + int32_t i = (int32_t)(uintptr_t)m_Pos; while (i < iCount) { - FX_INT32 j = i; + int32_t j = i; FX_DWORD objnum = m_NewObjNumArray.ElementAt(i); while (j < iCount) { if (++j == iCount) { @@ -1715,7 +1715,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) } } if (pPause && (i % 100) == 0 && pPause->NeedToPauseNow()) { - m_Pos = (FX_LPVOID)(FX_UINTPTR)i; + m_Pos = (FX_LPVOID)(uintptr_t)i; return 1; } } @@ -1723,7 +1723,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) } return m_iStage; } -static FX_INT32 _OutPutIndex(CFX_FileBufferArchive* pFile, FX_FILESIZE offset) +static int32_t _OutPutIndex(CFX_FileBufferArchive* pFile, FX_FILESIZE offset) { FXSYS_assert(pFile); if (sizeof(offset) > 4) { @@ -1759,7 +1759,7 @@ static FX_INT32 _OutPutIndex(CFX_FileBufferArchive* pFile, FX_FILESIZE offset) } return 0; } -FX_INT32 CPDF_Creator::WriteDoc_Stage4(IFX_Pause *pPause) +int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause *pPause) { FXSYS_assert(m_iStage >= 90); if ((m_dwFlags & FPDFCREATE_OBJECTSTREAM) == 0) { @@ -1918,7 +1918,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage4(IFX_Pause *pPause) } } else { int count = m_NewObjNumArray.GetSize(); - FX_INT32 i = 0; + int32_t i = 0; for (i = 0; i < count; i++) { FX_DWORD objnum = m_NewObjNumArray.ElementAt(i); if (m_File.AppendDWord(objnum) < 0) { @@ -2035,7 +2035,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault ) m_pIDArray->Add(pID1->Clone()); } else { pBuffer = FX_Alloc(FX_DWORD, 4); - PDF_GenerateFileID((FX_DWORD)(FX_UINTPTR)this, m_dwLastObjNum, pBuffer); + PDF_GenerateFileID((FX_DWORD)(uintptr_t)this, m_dwLastObjNum, pBuffer); CFX_ByteStringC bsBuffer((FX_LPCBYTE)pBuffer, 4 * sizeof(FX_DWORD)); m_pIDArray->Add(CPDF_String::Create(bsBuffer, TRUE), m_pDocument); } @@ -2053,7 +2053,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault ) return; } FX_LPDWORD pBuffer = FX_Alloc(FX_DWORD, 4); - PDF_GenerateFileID((FX_DWORD)(FX_UINTPTR)this, m_dwLastObjNum, pBuffer); + PDF_GenerateFileID((FX_DWORD)(uintptr_t)this, m_dwLastObjNum, pBuffer); CFX_ByteStringC bsBuffer((FX_LPCBYTE)pBuffer, 4 * sizeof(FX_DWORD)); m_pIDArray->Add(CPDF_String::Create(bsBuffer, TRUE), m_pDocument); FX_Free(pBuffer); @@ -2076,12 +2076,12 @@ void CPDF_Creator::InitID(FX_BOOL bDefault ) } } } -FX_INT32 CPDF_Creator::Continue(IFX_Pause *pPause) +int32_t CPDF_Creator::Continue(IFX_Pause *pPause) { if (m_iStage < 0) { return m_iStage; } - FX_INT32 iRet = 0; + int32_t iRet = 0; while (m_iStage < 100) { if (m_iStage < 20) { iRet = WriteDoc_Stage1(pPause); @@ -2103,7 +2103,7 @@ FX_INT32 CPDF_Creator::Continue(IFX_Pause *pPause) } return m_iStage; } -FX_BOOL CPDF_Creator::SetFileVersion(FX_INT32 fileVersion ) +FX_BOOL CPDF_Creator::SetFileVersion(int32_t fileVersion ) { if (fileVersion < 10 || fileVersion > 17) { return FALSE; diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index e75fd079bf..d2d81d5566 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -178,7 +178,7 @@ static const FX_WCHAR g_FX_CP1257Unicodes[128] = { 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9, }; typedef struct { - FX_BYTE m_Charset; + uint8_t m_Charset; const FX_WCHAR* m_pUnicodes; } FX_CharsetUnicodes; const FX_CharsetUnicodes g_FX_CharsetUnicodes[] = { @@ -429,12 +429,12 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, FX_BOOL bVert, FX_B } #endif #if (_FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_) -FX_UINT32 FX_GetLangHashCode( FX_LPCSTR pStr) +uint32_t FX_GetLangHashCode( FX_LPCSTR pStr) { FXSYS_assert( pStr != NULL); - FX_INT32 iLength = FXSYS_strlen(pStr); + int32_t iLength = FXSYS_strlen(pStr); FX_LPCSTR pStrEnd = pStr + iLength; - FX_UINT32 uHashCode = 0; + uint32_t uHashCode = 0; while ( pStr < pStrEnd) { uHashCode = 31 * uHashCode + tolower(*pStr++); } @@ -512,12 +512,12 @@ static const FX_LANG2CS gs_FXLang2CharsetTable[] = { {3923451837, 134}, {3923451838, 136}, }; -static FX_WORD FX_GetCsFromLangCode(FX_UINT32 uCode) +static FX_WORD FX_GetCsFromLangCode(uint32_t uCode) { - FX_INT32 iStart = 0; - FX_INT32 iEnd = sizeof(gs_FXLang2CharsetTable) / sizeof(FX_LANG2CS) - 1; + int32_t iStart = 0; + int32_t iEnd = sizeof(gs_FXLang2CharsetTable) / sizeof(FX_LANG2CS) - 1; while (iStart <= iEnd) { - FX_INT32 iMid = (iStart + iEnd) / 2; + int32_t iMid = (iStart + iEnd) / 2; const FX_LANG2CS &charset = gs_FXLang2CharsetTable[iMid]; if (uCode == charset.uLang) { return charset.uCharset; @@ -529,13 +529,13 @@ static FX_WORD FX_GetCsFromLangCode(FX_UINT32 uCode) }; return 0; } -static FX_WORD FX_GetCharsetFromLang(FX_LPCSTR pLang, FX_INT32 iLength) +static FX_WORD FX_GetCharsetFromLang(FX_LPCSTR pLang, int32_t iLength) { FXSYS_assert(pLang); if (iLength < 0) { iLength = FXSYS_strlen(pLang); } - FX_UINT32 uHash = FX_GetLangHashCode(pLang); + uint32_t uHash = FX_GetLangHashCode(pLang); return FX_GetCsFromLangCode(uHash); } static void _CFString2CFXByteString(CFStringRef src, CFX_ByteString &dest) @@ -1028,7 +1028,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) pBBox->AddInteger(bbox.right); pBBox->AddInteger(bbox.top); pFontDesc->SetAt("FontBBox", pBBox); - FX_INT32 nStemV = 0; + int32_t nStemV = 0; if (pFont->m_pSubstFont) { nStemV = pFont->m_pSubstFont->m_Weight / 5; } else { diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp index 9096bf938e..8d105a5bd8 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp @@ -12,7 +12,7 @@ #include "../fpdf_render/render_int.h" CPDF_Dictionary* CPDF_Image::InitJPEG(FX_LPBYTE pData, FX_DWORD size) { - FX_INT32 width, height, color_trans, num_comps, bits; + int32_t width, height, color_trans, num_comps, bits; if (!CPDF_ModuleMgr::Get()->GetJpegModule()-> LoadInfo(pData, size, width, height, num_comps, bits, color_trans)) { return NULL; @@ -70,12 +70,12 @@ void CPDF_Image::SetJpegImage(IFX_FileRead *pFile) if (dwEstimateSize > 8192) { dwEstimateSize = 8192; } - FX_LPBYTE pData = FX_Alloc(FX_BYTE, dwEstimateSize); + FX_LPBYTE pData = FX_Alloc(uint8_t, dwEstimateSize); pFile->ReadBlock(pData, 0, dwEstimateSize); CPDF_Dictionary *pDict = InitJPEG(pData, dwEstimateSize); FX_Free(pData); if (!pDict && size > dwEstimateSize) { - pData = FX_Alloc(FX_BYTE, size); + pData = FX_Alloc(uint8_t, size); pFile->ReadBlock(pData, 0, size); pDict = InitJPEG(pData, size); FX_Free(pData); @@ -91,16 +91,16 @@ void _DCTEncodeBitmap(CPDF_Dictionary *pBitmapDict, const CFX_DIBitmap* pBitmap, void _JBIG2EncodeBitmap(CPDF_Dictionary *pBitmapDict, const CFX_DIBitmap *pBitmap, CPDF_Document *pDoc, FX_LPBYTE &buf, FX_STRSIZE &size, FX_BOOL bLossLess) { } -void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_FileWrite *pFileWrite, IFX_FileRead *pFileRead, const CFX_DIBitmap* pMask, const CPDF_ImageSetParam* pParam) +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) { - FX_INT32 BitmapWidth = pBitmap->GetWidth(); - FX_INT32 BitmapHeight = pBitmap->GetHeight(); + int32_t BitmapWidth = pBitmap->GetWidth(); + int32_t BitmapHeight = pBitmap->GetHeight(); if (BitmapWidth < 1 || BitmapHeight < 1) { return; } FX_LPBYTE src_buf = pBitmap->GetBuffer(); - FX_INT32 src_pitch = pBitmap->GetPitch(); - FX_INT32 bpp = pBitmap->GetBPP(); + int32_t src_pitch = pBitmap->GetPitch(); + int32_t bpp = pBitmap->GetBPP(); FX_BOOL bUseMatte = pParam && pParam->pMatteColor && (pBitmap->GetFormat() == FXDIB_Argb); CPDF_Dictionary* pDict = new CPDF_Dictionary; pDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("XObject")); @@ -110,8 +110,8 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F FX_LPBYTE dest_buf = NULL; FX_STRSIZE dest_pitch = 0, dest_size = 0, opType = -1; if (bpp == 1) { - FX_INT32 reset_a = 0, reset_r = 0, reset_g = 0, reset_b = 0; - FX_INT32 set_a = 0, set_r = 0, set_g = 0, set_b = 0; + int32_t reset_a = 0, reset_r = 0, reset_g = 0, reset_b = 0; + int32_t set_a = 0, set_r = 0, set_g = 0, set_b = 0; if (!pBitmap->IsAlphaMask()) { ArgbDecode(pBitmap->GetPaletteArgb(0), reset_a, reset_r, reset_g, reset_b); ArgbDecode(pBitmap->GetPaletteArgb(1), set_a, set_r, set_g, set_b); @@ -149,20 +149,20 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F opType = 0; } } else if (bpp == 8) { - FX_INT32 iPalette = pBitmap->GetPaletteSize(); + int32_t iPalette = pBitmap->GetPaletteSize(); if (iPalette > 0) { CPDF_Array* pCS = new CPDF_Array; m_pDocument->AddIndirectObject(pCS); pCS->AddName(FX_BSTRC("Indexed")); pCS->AddName(FX_BSTRC("DeviceRGB")); pCS->AddInteger(iPalette - 1); - FX_LPBYTE pColorTable = FX_Alloc2D(FX_BYTE, iPalette, 3); + FX_LPBYTE pColorTable = FX_Alloc2D(uint8_t, iPalette, 3); FX_LPBYTE ptr = pColorTable; - for (FX_INT32 i = 0; i < iPalette; i ++) { + for (int32_t i = 0; i < iPalette; i ++) { FX_DWORD argb = pBitmap->GetPaletteArgb(i); - ptr[0] = (FX_BYTE)(argb >> 16); - ptr[1] = (FX_BYTE)(argb >> 8); - ptr[2] = (FX_BYTE)argb; + ptr[0] = (uint8_t)(argb >> 16); + ptr[1] = (uint8_t)(argb >> 8); + ptr[2] = (uint8_t)argb; ptr += 3; } CPDF_Stream *pCTS = CPDF_Stream::Create(pColorTable, iPalette * 3, CPDF_Dictionary::Create()); @@ -202,8 +202,8 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F } } if (pMaskBitmap) { - FX_INT32 maskWidth = pMaskBitmap->GetWidth(); - FX_INT32 maskHeight = pMaskBitmap->GetHeight(); + int32_t maskWidth = pMaskBitmap->GetWidth(); + int32_t maskHeight = pMaskBitmap->GetHeight(); FX_LPBYTE mask_buf = NULL; FX_STRSIZE mask_size; CPDF_Dictionary* pMaskDict = new CPDF_Dictionary; @@ -218,9 +218,9 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F } else if (pMaskBitmap->GetFormat() == FXDIB_1bppMask) { _JBIG2EncodeBitmap(pMaskDict, pMaskBitmap, m_pDocument, mask_buf, mask_size, TRUE); } else { - mask_buf = FX_Alloc2D(FX_BYTE, maskHeight, maskWidth); + mask_buf = FX_Alloc2D(uint8_t, maskHeight, maskWidth); mask_size = maskHeight * maskWidth; // Safe since checked alloc returned. - for (FX_INT32 a = 0; a < maskHeight; a ++) { + for (int32_t a = 0; a < maskHeight; a ++) { FXSYS_memcpy32(mask_buf + a * maskWidth, pMaskBitmap->GetScanline(a), maskWidth); } } @@ -271,15 +271,15 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F CFX_DIBitmap *pNewBitmap = new CFX_DIBitmap(); pNewBitmap->Create(BitmapWidth, BitmapHeight, FXDIB_Argb); FX_LPBYTE dst_buf = pNewBitmap->GetBuffer(); - FX_INT32 src_offset = 0; - for (FX_INT32 row = 0; row < BitmapHeight; row ++) { + int32_t src_offset = 0; + for (int32_t row = 0; row < BitmapHeight; row ++) { src_offset = row * src_pitch; - for (FX_INT32 column = 0; column < BitmapWidth; column ++) { + for (int32_t column = 0; column < BitmapWidth; column ++) { FX_FLOAT alpha = src_buf[src_offset + 3] / 255.0f; - dst_buf[src_offset] = (FX_BYTE)(src_buf[src_offset] * alpha); - dst_buf[src_offset + 1] = (FX_BYTE)(src_buf[src_offset + 1] * alpha); - dst_buf[src_offset + 2] = (FX_BYTE)(src_buf[src_offset + 2] * alpha); - dst_buf[src_offset + 3] = (FX_BYTE)(src_buf[src_offset + 3]); + dst_buf[src_offset] = (uint8_t)(src_buf[src_offset] * alpha); + dst_buf[src_offset + 1] = (uint8_t)(src_buf[src_offset + 1] * alpha); + dst_buf[src_offset + 2] = (uint8_t)(src_buf[src_offset + 2] * alpha); + dst_buf[src_offset + 3] = (uint8_t)(src_buf[src_offset + 3]); src_offset += 4; } } @@ -297,11 +297,11 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F } } else if (opType == 1) { if (!bStream) { - dest_buf = FX_Alloc2D(FX_BYTE, dest_pitch, BitmapHeight); + dest_buf = FX_Alloc2D(uint8_t, dest_pitch, BitmapHeight); dest_size = dest_pitch * BitmapHeight; // Safe since checked alloc returned. } FX_LPBYTE pDest = dest_buf; - for (FX_INT32 i = 0; i < BitmapHeight; i ++) { + for (int32_t i = 0; i < BitmapHeight; i ++) { if (!bStream) { FXSYS_memcpy32(pDest, src_buf, dest_pitch); pDest += dest_pitch; @@ -312,21 +312,21 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F } } else if (opType == 2) { if (!bStream) { - dest_buf = FX_Alloc2D(FX_BYTE, dest_pitch, BitmapHeight); + dest_buf = FX_Alloc2D(uint8_t, dest_pitch, BitmapHeight); dest_size = dest_pitch * BitmapHeight; // Safe since checked alloc returned. } else { - dest_buf = FX_Alloc(FX_BYTE, dest_pitch); + dest_buf = FX_Alloc(uint8_t, dest_pitch); } FX_LPBYTE pDest = dest_buf; - FX_INT32 src_offset = 0; - FX_INT32 dest_offset = 0; - for (FX_INT32 row = 0; row < BitmapHeight; row ++) { + int32_t src_offset = 0; + int32_t dest_offset = 0; + for (int32_t row = 0; row < BitmapHeight; row ++) { src_offset = row * src_pitch; - for (FX_INT32 column = 0; column < BitmapWidth; column ++) { + for (int32_t column = 0; column < BitmapWidth; column ++) { FX_FLOAT alpha = bUseMatte ? src_buf[src_offset + 3] / 255.0f : 1; - pDest[dest_offset] = (FX_BYTE)(src_buf[src_offset + 2] * alpha); - pDest[dest_offset + 1] = (FX_BYTE)(src_buf[src_offset + 1] * alpha); - pDest[dest_offset + 2] = (FX_BYTE)(src_buf[src_offset] * alpha); + pDest[dest_offset] = (uint8_t)(src_buf[src_offset + 2] * alpha); + pDest[dest_offset + 1] = (uint8_t)(src_buf[src_offset + 1] * alpha); + pDest[dest_offset + 2] = (uint8_t)(src_buf[src_offset] * alpha); dest_offset += 3; src_offset += bpp == 24 ? 3 : 4; } diff --git a/core/src/fpdfapi/fpdf_font/common.h b/core/src/fpdfapi/fpdf_font/common.h index 923a394662..57461d1908 100644 --- a/core/src/fpdfapi/fpdf_font/common.h +++ b/core/src/fpdfapi/fpdf_font/common.h @@ -11,9 +11,9 @@ typedef signed char TT_int8_t; typedef unsigned char TT_uint8_t; typedef signed short TT_int16_t; typedef unsigned short TT_uint16_t; -typedef FX_INT32 TT_int32_t; +typedef int32_t TT_int32_t; typedef FX_DWORD TT_uint32_t; -typedef FX_INT64 TT_int64_t; -typedef FX_UINT64 TT_uint64_t; +typedef int64_t TT_int64_t; +typedef uint64_t TT_uint64_t; #endif // CORE_SRC_FPDFAPI_FPDF_FONT_COMMON_H_ diff --git a/core/src/fpdfapi/fpdf_font/font_int.h b/core/src/fpdfapi/fpdf_font/font_int.h index 697ccffafd..1e52607d98 100644 --- a/core/src/fpdfapi/fpdf_font/font_int.h +++ b/core/src/fpdfapi/fpdf_font/font_int.h @@ -48,8 +48,8 @@ private: }; struct _CMap_CodeRange { int m_CharSize; - FX_BYTE m_Lower[4]; - FX_BYTE m_Upper[4]; + uint8_t m_Lower[4]; + uint8_t m_Upper[4]; }; class CPDF_CMapParser { @@ -113,7 +113,7 @@ protected: int m_Charset, m_Coding; CodingScheme m_CodingScheme; int m_nCodeRanges; - FX_BYTE* m_pLeadingBytes; + uint8_t* m_pLeadingBytes; FX_WORD* m_pMapping; FX_LPBYTE m_pAddMapping; FX_BOOL m_bLoaded; @@ -128,13 +128,13 @@ public: int m_Coding; CPDF_CMap::CodingScheme m_CodingScheme; FX_DWORD m_LeadingSegCount; - FX_BYTE m_LeadingSegs[4]; + uint8_t m_LeadingSegs[4]; }; typedef struct _FileHeader { - FX_BYTE btTag[4]; - FX_BYTE btVersion; - FX_BYTE btFormat; - FX_BYTE btReserved1[2]; + uint8_t btTag[4]; + uint8_t btVersion; + uint8_t btFormat; + uint8_t btReserved1[2]; FX_DWORD dwStartIndex; FX_DWORD dwEndIndex; FX_DWORD dwDataSize; diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp index 80dd1df803..0058e140d4 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp @@ -412,7 +412,7 @@ CPDF_Font* CPDF_Font::GetStockFont(CPDF_Document* pDoc, FX_BSTR name) pFontGlobals->Set(pDoc, font_id, pFont); return pFont; } -const FX_BYTE ChineseFontNames[][5] = { +const uint8_t ChineseFontNames[][5] = { {0xCB, 0xCE, 0xCC, 0xE5, 0x00}, {0xBF, 0xAC, 0xCC, 0xE5, 0x00}, {0xBA, 0xDA, 0xCC, 0xE5, 0x00}, @@ -816,7 +816,7 @@ FX_BOOL CPDF_Font::IsStandardFont() const } return TRUE; } -extern FX_LPCSTR PDF_CharNameFromPredefinedCharSet(int encoding, FX_BYTE charcode); +extern FX_LPCSTR PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode); CPDF_SimpleFont::CPDF_SimpleFont(int fonttype) : CPDF_Font(fonttype) { FXSYS_memset8(m_CharBBox, 0xff, sizeof m_CharBBox); @@ -838,7 +838,7 @@ int CPDF_SimpleFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL *pVertGlyph) if (charcode > 0xff) { return -1; } - int index = m_GlyphIndex[(FX_BYTE)charcode]; + int index = m_GlyphIndex[(uint8_t)charcode]; if (index == 0xffff) { return -1; } @@ -892,14 +892,14 @@ int CPDF_SimpleFont::GetCharWidthF(FX_DWORD charcode, int level) m_CharWidth[charcode] = 0; } } - return (FX_INT16)m_CharWidth[charcode]; + return (int16_t)m_CharWidth[charcode]; } void CPDF_SimpleFont::GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level) { if (charcode > 0xff) { charcode = 0; } - if (m_CharBBox[charcode].Left == (FX_SHORT)0xffff) { + if (m_CharBBox[charcode].Left == (int16_t)0xffff) { LoadCharMetrics(charcode); } rect.left = m_CharBBox[charcode].Left; @@ -1073,7 +1073,7 @@ int CPDF_Type1Font::GlyphFromCharCodeExt(FX_DWORD charcode) if (charcode > 0xff) { return -1; } - int index = m_ExtGID[(FX_BYTE)charcode]; + int index = m_ExtGID[(uint8_t)charcode]; if (index == 0xffff) { return -1; } @@ -1130,7 +1130,7 @@ void CPDF_Type1Font::LoadGlyphMap() if (FT_UseTTCharmap(m_Font.m_Face, 3, 0)) { FX_BOOL bGotOne = FALSE; for (int charcode = 0; charcode < 256; charcode ++) { - const FX_BYTE prefix[4] = {0x00, 0xf0, 0xf1, 0xf2}; + const uint8_t prefix[4] = {0x00, 0xf0, 0xf1, 0xf2}; for (int j = 0; j < 4; j ++) { FX_WORD unicode = prefix[j] * 256 + charcode; m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, unicode); @@ -1482,7 +1482,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() } m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); if (bMSSymbol) { - const FX_BYTE prefix[4] = {0x00, 0xf0, 0xf1, 0xf2}; + const uint8_t prefix[4] = {0x00, 0xf0, 0xf1, 0xf2}; for (int j = 0; j < 4; j ++) { FX_WORD unicode = prefix[j] * 256 + charcode; m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, unicode); @@ -1525,7 +1525,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() return; } if (FT_UseTTCharmap(m_Font.m_Face, 3, 0)) { - const FX_BYTE prefix[4] = {0x00, 0xf0, 0xf1, 0xf2}; + const uint8_t prefix[4] = {0x00, 0xf0, 0xf1, 0xf2}; FX_BOOL bGotOne = FALSE; for (int charcode = 0; charcode < 256; charcode ++) { for (int j = 0; j < 4; j ++) { @@ -1627,10 +1627,10 @@ FX_BOOL CPDF_Type3Font::_Load() } CPDF_Array* pBBox = m_pFontDict->GetArray(FX_BSTRC("FontBBox")); if (pBBox) { - m_FontBBox.left = (FX_INT32)(FXSYS_Mul(pBBox->GetNumber(0), xscale) * 1000); - m_FontBBox.bottom = (FX_INT32)(FXSYS_Mul(pBBox->GetNumber(1), yscale) * 1000); - m_FontBBox.right = (FX_INT32)(FXSYS_Mul(pBBox->GetNumber(2), xscale) * 1000); - m_FontBBox.top = (FX_INT32)(FXSYS_Mul(pBBox->GetNumber(3), yscale) * 1000); + m_FontBBox.left = (int32_t)(FXSYS_Mul(pBBox->GetNumber(0), xscale) * 1000); + m_FontBBox.bottom = (int32_t)(FXSYS_Mul(pBBox->GetNumber(1), yscale) * 1000); + m_FontBBox.right = (int32_t)(FXSYS_Mul(pBBox->GetNumber(2), xscale) * 1000); + m_FontBBox.top = (int32_t)(FXSYS_Mul(pBBox->GetNumber(3), yscale) * 1000); } int StartChar = m_pFontDict->GetInteger(FX_BSTRC("FirstChar")); CPDF_Array* pWidthArray = m_pFontDict->GetArray(FX_BSTRC("Widths")); @@ -1671,10 +1671,10 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) return NULL; } CPDF_Type3Char* pChar = NULL; - if (m_CacheMap.Lookup((FX_LPVOID)(FX_UINTPTR)charcode, (FX_LPVOID&)pChar)) { + if (m_CacheMap.Lookup((FX_LPVOID)(uintptr_t)charcode, (FX_LPVOID&)pChar)) { if (pChar->m_bPageRequired && m_pPageResources) { delete pChar; - m_CacheMap.RemoveKey((FX_LPVOID)(FX_UINTPTR)charcode); + m_CacheMap.RemoveKey((FX_LPVOID)(uintptr_t)charcode); return LoadChar(charcode, level + 1); } return pChar; @@ -1691,7 +1691,7 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) pChar->m_pForm = new CPDF_Form(m_pDocument, m_pFontResources ? m_pFontResources : m_pPageResources, pStream, NULL); pChar->m_pForm->ParseContent(NULL, NULL, pChar, NULL, level + 1); FX_FLOAT scale = m_FontMatrix.GetXUnit(); - pChar->m_Width = (FX_INT32)(pChar->m_Width * scale + 0.5f); + pChar->m_Width = (int32_t)(pChar->m_Width * scale + 0.5f); FX_RECT &rcBBox = pChar->m_BBox; CFX_FloatRect char_rect((FX_FLOAT)rcBBox.left / 1000.0f, (FX_FLOAT)rcBBox.bottom / 1000.0f, (FX_FLOAT)rcBBox.right / 1000.0f, (FX_FLOAT)rcBBox.top / 1000.0f); @@ -1703,7 +1703,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)(FX_UINTPTR)charcode, pChar); + m_CacheMap.SetAt((FX_LPVOID)(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 c7110d39c9..8e8fccd8a3 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp @@ -475,7 +475,7 @@ const FX_LPCSTR ZapfEncodingNames[224] = { NULL, "a201", "a183", "a184", "a197", "a185", "a194", "a198", "a186", "a195", "a187", "a188", "a189", "a190", "a191", NULL }; -const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, FX_BYTE charcode) +const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode) { if (encoding == PDFFONT_ENCODING_PDFDOC) { if (charcode < 24) { @@ -512,15 +512,15 @@ FX_WCHAR FT_UnicodeFromCharCode(int encoding, FX_DWORD charcode) case FXFT_ENCODING_UNICODE: return (FX_WORD)charcode; case FXFT_ENCODING_ADOBE_STANDARD: - return StandardEncoding[(FX_BYTE)charcode]; + return StandardEncoding[(uint8_t)charcode]; case FXFT_ENCODING_ADOBE_EXPERT: - return MacExpertEncoding[(FX_BYTE)charcode]; + return MacExpertEncoding[(uint8_t)charcode]; case FXFT_ENCODING_ADOBE_LATIN_1: - return AdobeWinAnsiEncoding[(FX_BYTE)charcode]; + return AdobeWinAnsiEncoding[(uint8_t)charcode]; case FXFT_ENCODING_APPLE_ROMAN: - return MacRomanEncoding[(FX_BYTE)charcode]; + return MacRomanEncoding[(uint8_t)charcode]; case PDFFONT_ENCODING_PDFDOC: - return PDFDocEncoding[(FX_BYTE)charcode]; + return PDFDocEncoding[(uint8_t)charcode]; } return 0; } diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp index a08660c52f..a6209cb536 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -124,7 +124,7 @@ static FX_DWORD CMap_GetCode(FX_BSTR word) int num = 0; if (word.GetAt(0) == '<') { for (int i = 1; i < word.GetLength(); i ++) { - FX_BYTE digit = word.GetAt(i); + uint8_t digit = word.GetAt(i); if (digit >= '0' && digit <= '9') { digit = digit - '0'; } else if (digit >= 'a' && digit <= 'f') { @@ -161,17 +161,17 @@ static FX_BOOL _CMap_GetCodeRange(_CMap_CodeRange& range, FX_BSTR first, FX_BSTR return FALSE; } for (i = 0; i < range.m_CharSize; i ++) { - FX_BYTE digit1 = first.GetAt(i * 2 + 1); - FX_BYTE digit2 = first.GetAt(i * 2 + 2); - FX_BYTE byte = (digit1 >= '0' && digit1 <= '9') ? (digit1 - '0') : ((digit1 & 0xdf) - 'A' + 10); + uint8_t digit1 = first.GetAt(i * 2 + 1); + uint8_t digit2 = first.GetAt(i * 2 + 2); + uint8_t byte = (digit1 >= '0' && digit1 <= '9') ? (digit1 - '0') : ((digit1 & 0xdf) - 'A' + 10); byte = byte * 16 + ((digit2 >= '0' && digit2 <= '9') ? (digit2 - '0') : ((digit2 & 0xdf) - 'A' + 10)); range.m_Lower[i] = byte; } FX_DWORD size = second.GetLength(); for (i = 0; i < range.m_CharSize; i ++) { - FX_BYTE digit1 = ((FX_DWORD)i * 2 + 1 < size) ? second.GetAt((FX_STRSIZE)i * 2 + 1) : 0; - FX_BYTE digit2 = ((FX_DWORD)i * 2 + 2 < size) ? second.GetAt((FX_STRSIZE)i * 2 + 2) : 0; - FX_BYTE byte = (digit1 >= '0' && digit1 <= '9') ? (digit1 - '0') : ((digit1 & 0xdf) - 'A' + 10); + uint8_t digit1 = ((FX_DWORD)i * 2 + 1 < size) ? second.GetAt((FX_STRSIZE)i * 2 + 1) : 0; + uint8_t digit2 = ((FX_DWORD)i * 2 + 2 < size) ? second.GetAt((FX_STRSIZE)i * 2 + 2) : 0; + uint8_t byte = (digit1 >= '0' && digit1 <= '9') ? (digit1 - '0') : ((digit1 & 0xdf) - 'A' + 10); byte = byte * 16 + ((digit2 >= '0' && digit2 <= '9') ? (digit2 - '0') : ((digit2 & 0xdf) - 'A' + 10)); range.m_Upper[i] = byte; } @@ -254,7 +254,7 @@ void CPDF_CMapParser::ParseWord(FX_BSTR word) if (nSegs > 1) { m_pCMap->m_CodingScheme = CPDF_CMap::MixedFourBytes; m_pCMap->m_nCodeRanges = nSegs; - m_pCMap->m_pLeadingBytes = FX_Alloc2D(FX_BYTE, nSegs, sizeof(_CMap_CodeRange)); + m_pCMap->m_pLeadingBytes = FX_Alloc2D(uint8_t, nSegs, sizeof(_CMap_CodeRange)); FXSYS_memcpy32(m_pCMap->m_pLeadingBytes, m_CodeRanges.GetData(), nSegs * sizeof(_CMap_CodeRange)); } else if (nSegs == 1) { m_pCMap->m_CodingScheme = (m_CodeRanges[0].m_CharSize == 2) ? CPDF_CMap::TwoBytes : CPDF_CMap::OneByte; @@ -376,7 +376,7 @@ FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, FX_LPCSTR pName, FX_BO m_Coding = map.m_Coding; m_CodingScheme = map.m_CodingScheme; if (m_CodingScheme == MixedTwoBytes) { - m_pLeadingBytes = FX_Alloc(FX_BYTE, 256); + m_pLeadingBytes = FX_Alloc(uint8_t, 256); for (FX_DWORD i = 0; i < map.m_LeadingSegCount; i ++) { for (int b = map.m_LeadingSegs[i * 2]; b <= map.m_LeadingSegs[i * 2 + 1]; b ++) { m_pLeadingBytes[b] = 1; @@ -410,7 +410,7 @@ FX_BOOL CPDF_CMap::LoadEmbedded(FX_LPCBYTE pData, FX_DWORD size) parser.ParseWord(word); } if (m_CodingScheme == MixedFourBytes && parser.m_AddMaps.GetSize()) { - m_pAddMapping = FX_Alloc(FX_BYTE, parser.m_AddMaps.GetSize() + 4); + m_pAddMapping = FX_Alloc(uint8_t, parser.m_AddMaps.GetSize() + 4); *(FX_DWORD*)m_pAddMapping = parser.m_AddMaps.GetSize() / 8; FXSYS_memcpy32(m_pAddMapping + 4, parser.m_AddMaps.GetBuffer(), parser.m_AddMaps.GetSize()); FXSYS_qsort(m_pAddMapping + 4, parser.m_AddMaps.GetSize() / 8, 8, compare_dword); @@ -500,15 +500,15 @@ FX_DWORD CPDF_CMap::GetNextChar(FX_LPCSTR pString, int nStrLen, int& offset) con offset += 2; return ((FX_LPBYTE)pString)[offset - 2] * 256 + ((FX_LPBYTE)pString)[offset - 1]; case MixedTwoBytes: { - FX_BYTE byte1 = ((FX_LPBYTE)pString)[offset++]; + uint8_t byte1 = ((FX_LPBYTE)pString)[offset++]; if (!m_pLeadingBytes[byte1]) { return byte1; } - FX_BYTE byte2 = ((FX_LPBYTE)pString)[offset++]; + uint8_t byte2 = ((FX_LPBYTE)pString)[offset++]; return byte1 * 256 + byte2; } case MixedFourBytes: { - FX_BYTE codes[4]; + uint8_t codes[4]; int char_size = 1; codes[0] = ((FX_LPBYTE)pString)[offset++]; _CMap_CodeRange* pRanges = (_CMap_CodeRange*)m_pLeadingBytes; @@ -589,10 +589,10 @@ int _GetCharSize(FX_DWORD charcode, _CMap_CodeRange* pRanges, int iRangesSize) if (!iRangesSize) { return 1; } - FX_BYTE codes[4]; + uint8_t codes[4]; codes[0] = codes[1] = 0x00; - codes[2] = (FX_BYTE)(charcode >> 8 & 0xFF); - codes[3] = (FX_BYTE)charcode; + codes[2] = (uint8_t)(charcode >> 8 & 0xFF); + codes[3] = (uint8_t)charcode; int offset = 0, size = 4; for (int i = 0; i < 4; ++i) { int iSeg = iRangesSize - 1; @@ -623,11 +623,11 @@ int CPDF_CMap::AppendChar(FX_LPSTR str, FX_DWORD charcode) const { switch (m_CodingScheme) { case OneByte: - str[0] = (FX_BYTE)charcode; + str[0] = (uint8_t)charcode; return 1; case TwoBytes: - str[0] = (FX_BYTE)(charcode / 256); - str[1] = (FX_BYTE)(charcode % 256); + str[0] = (uint8_t)(charcode / 256); + str[1] = (uint8_t)(charcode % 256); return 2; case MixedTwoBytes: case MixedFourBytes: @@ -638,24 +638,24 @@ int CPDF_CMap::AppendChar(FX_LPSTR str, FX_DWORD charcode) const iSize = 1; } if (iSize > 1) { - FXSYS_memset32(str, 0, sizeof(FX_BYTE) * iSize); + FXSYS_memset32(str, 0, sizeof(uint8_t) * iSize); } - str[iSize - 1] = (FX_BYTE)charcode; + str[iSize - 1] = (uint8_t)charcode; return iSize; } else if (charcode < 0x10000) { - str[0] = (FX_BYTE)(charcode >> 8); - str[1] = (FX_BYTE)charcode; + str[0] = (uint8_t)(charcode >> 8); + str[1] = (uint8_t)charcode; return 2; } else if (charcode < 0x1000000) { - str[0] = (FX_BYTE)(charcode >> 16); - str[1] = (FX_BYTE)(charcode >> 8); - str[2] = (FX_BYTE)charcode; + str[0] = (uint8_t)(charcode >> 16); + str[1] = (uint8_t)(charcode >> 8); + str[2] = (uint8_t)charcode; return 3; } else { - str[0] = (FX_BYTE)(charcode >> 24); - str[1] = (FX_BYTE)(charcode >> 16); - str[2] = (FX_BYTE)(charcode >> 8); - str[3] = (FX_BYTE)charcode; + str[0] = (uint8_t)(charcode >> 24); + str[1] = (uint8_t)(charcode >> 16); + str[2] = (uint8_t)(charcode >> 8); + str[3] = (uint8_t)charcode; return 4; } } @@ -837,7 +837,7 @@ FX_DWORD CPDF_CIDFont::_CharCodeFromUnicode(FX_WCHAR unicode) const return 0; } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - FX_BYTE buffer[32]; + uint8_t buffer[32]; int ret = FXSYS_WideCharToMultiByte(g_CharsetCPs[m_pCMap->m_Coding], 0, &unicode, 1, (char*)buffer, 4, NULL, NULL); if (ret == 1) { return buffer[0]; @@ -990,7 +990,7 @@ FX_BOOL CPDF_CIDFont::_Load() } return TRUE; } -FX_FLOAT _CIDTransformToFloat(FX_BYTE ch) +FX_FLOAT _CIDTransformToFloat(uint8_t ch) { if (ch < 128) { return ch * 1.0f / 127; @@ -1150,7 +1150,7 @@ int CPDF_CIDFont::GetGlyphIndex(FX_DWORD unicode, FX_BOOL *pVertGlyph) unsigned long length = 0; int error = FXFT_Load_Sfnt_Table( m_Font.m_Face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, NULL, &length); if (!error) { - m_Font.m_pGsubData = (unsigned char*)FX_Alloc(FX_BYTE, length); + m_Font.m_pGsubData = (unsigned char*)FX_Alloc(uint8_t, length); } } int error = FXFT_Load_Sfnt_Table( m_Font.m_Face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, m_Font.m_pGsubData, NULL); @@ -1421,7 +1421,7 @@ FX_BOOL CPDF_CIDFont::LoadGB2312() } const struct _CIDTransform { FX_WORD CID; - FX_BYTE a, b, c, d, e, f; + uint8_t a, b, c, d, e, f; } Japan1_VertCIDs[] = { {97, 129, 0, 0, 127, 55, 0}, diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp index ae67d2f0ef..ab15c47cb3 100644 --- a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp +++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp @@ -20,8 +20,8 @@ extern "C" { } }; struct _IntPair { - FX_INT32 key; - FX_INT32 value; + int32_t key; + int32_t value; }; void CFX_GlyphMap::SetAt(int key, int value) { @@ -431,7 +431,7 @@ IFX_GSUBTable* FXGE_CreateGSUBTable(CFX_Font* pFont) unsigned long length = 0; int error = FXFT_Load_Sfnt_Table(pFont->m_Face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, NULL, &length); if (!error) { - pFont->m_pGsubData = (unsigned char*)FX_Alloc(FX_BYTE, length); + pFont->m_pGsubData = (unsigned char*)FX_Alloc(uint8_t, length); } if (!pFont->m_pGsubData) { return NULL; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp index 5a9f1a8cb8..82f90d17a6 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp @@ -113,7 +113,7 @@ CPDF_TextObject::~CPDF_TextObject() } void CPDF_TextObject::GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const { - pInfo->m_CharCode = m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)m_pCharCodes : m_pCharCodes[index]; + pInfo->m_CharCode = m_nChars == 1 ? (FX_DWORD)(uintptr_t)m_pCharCodes : m_pCharCodes[index]; pInfo->m_OriginX = index ? m_pCharPos[index - 1] : 0; pInfo->m_OriginY = 0; if (pInfo->m_CharCode == -1) { @@ -150,7 +150,7 @@ int CPDF_TextObject::CountChars() const void CPDF_TextObject::GetCharInfo(int index, FX_DWORD& charcode, FX_FLOAT& kerning) const { if (m_nChars == 1) { - charcode = (FX_DWORD)(FX_UINTPTR)m_pCharCodes; + charcode = (FX_DWORD)(uintptr_t)m_pCharCodes; kerning = 0; return; } @@ -254,7 +254,7 @@ void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs, FX_FLOAT* pKernin } } else { int offset = 0; - m_pCharCodes = (FX_DWORD*)(FX_UINTPTR)pFont->GetNextChar(pStrs[0], pStrs[0].GetLength(), offset); + m_pCharCodes = (FX_DWORD*)(uintptr_t)pFont->GetNextChar(pStrs[0], pStrs[0].GetLength(), offset); } } void CPDF_TextObject::SetText(const CFX_ByteString& str) @@ -311,7 +311,7 @@ void CPDF_TextObject::SetText(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pKerni } } } else { - m_pCharCodes = (FX_DWORD*)(FX_UINTPTR)pCharCodes[0]; + m_pCharCodes = (FX_DWORD*)(uintptr_t)pCharCodes[0]; } RecalcPositionData(); } @@ -360,7 +360,7 @@ void CPDF_TextObject::GetCharRect(int index, CFX_FloatRect& rect) const FX_FLOAT fontsize = m_TextState.GetFontSize() / 1000; int count = 0; for (int i = 0; i < m_nChars; i ++) { - FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)m_pCharCodes : m_pCharCodes[i]; + FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(uintptr_t)m_pCharCodes : m_pCharCodes[i]; if (charcode == (FX_DWORD) - 1) { continue; } @@ -404,7 +404,7 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX, FX_FLOAT* pTextA } FX_FLOAT fontsize = m_TextState.GetFontSize(); for (int i = 0; i < m_nChars; i ++) { - FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)m_pCharCodes : m_pCharCodes[i]; + FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(uintptr_t)m_pCharCodes : m_pCharCodes[i]; if (charcode == (FX_DWORD) - 1) { curpos -= FXSYS_Mul(m_pCharPos[i - 1], fontsize) / 1000; continue; @@ -531,7 +531,7 @@ void CPDF_TextObject::CalcCharPos(FX_FLOAT* pPosArray) const FX_FLOAT fontsize = m_TextState.GetFontSize(); int index = 0; for (int i = 0; i < m_nChars; i ++) { - FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)m_pCharCodes : m_pCharCodes[i]; + FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(uintptr_t)m_pCharCodes : m_pCharCodes[i]; if (charcode == (FX_DWORD) - 1) { continue; } @@ -583,7 +583,7 @@ void CPDF_TextObject::SetData(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pCharP return; } if (nChars == 1) { - m_pCharCodes = (FX_DWORD*)(FX_UINTPTR) * pCharCodes; + m_pCharCodes = (FX_DWORD*)(uintptr_t) * pCharCodes; } else { m_pCharCodes = FX_Alloc(FX_DWORD, nChars); FXSYS_memcpy32(m_pCharCodes, pCharCodes, sizeof(FX_DWORD)*nChars); diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp index 8b9ff8ea96..ea61078209 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp @@ -129,7 +129,7 @@ static void ReverseRGB(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels) { if (pDestBuf == pSrcBuf) for (int i = 0; i < pixels; i ++) { - FX_BYTE temp = pDestBuf[2]; + uint8_t temp = pDestBuf[2]; pDestBuf[2] = pDestBuf[0]; pDestBuf[0] = temp; pDestBuf += 3; @@ -168,7 +168,7 @@ void CPDF_DeviceCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, i if (!m_dwStdConversion) { AdobeCMYK_to_sRGB1(pSrcBuf[0], pSrcBuf[1], pSrcBuf[2], pSrcBuf[3], pDestBuf[2], pDestBuf[1], pDestBuf[0]); } else { - FX_BYTE k = pSrcBuf[3]; + uint8_t k = pSrcBuf[3]; pDestBuf[2] = 255 - FX_MIN(255, pSrcBuf[0] + k); pDestBuf[1] = 255 - FX_MIN(255, pSrcBuf[1] + k); pDestBuf[0] = 255 - FX_MIN(255, pSrcBuf[2] + k); @@ -178,7 +178,7 @@ void CPDF_DeviceCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, i } } } -const FX_BYTE g_sRGBSamples1[] = { +const uint8_t g_sRGBSamples1[] = { 0, 3, 6, 10, 13, 15, 18, 20, 22, 23, 25, 27, 28, 30, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 53, 54, 55, 56, 56, 57, 58, 58, 59, 60, 61, @@ -192,7 +192,7 @@ const FX_BYTE g_sRGBSamples1[] = { 110, 110, 111, 111, 111, 112, 112, 112, 113, 113, 113, 114, 114, 114, 115, 115, 115, 115, 116, 116, 116, 117, 117, 117, 118, 118, 118, 118, 119, 119, 119, 120, }; -const FX_BYTE g_sRGBSamples2[] = { +const uint8_t g_sRGBSamples2[] = { 120, 121, 122, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 148, 149, 150, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 163, 164, @@ -514,9 +514,9 @@ void CPDF_LabCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int lab[1] = (FX_FLOAT)(pSrcBuf[1] - 128); lab[2] = (FX_FLOAT)(pSrcBuf[2] - 128); GetRGB(lab, R, G, B); - pDestBuf[0] = (FX_INT32)(B * 255); - pDestBuf[1] = (FX_INT32)(G * 255); - pDestBuf[2] = (FX_INT32)(R * 255); + pDestBuf[0] = (int32_t)(B * 255); + pDestBuf[1] = (int32_t)(G * 255); + pDestBuf[2] = (int32_t)(R * 255); pDestBuf += 3; pSrcBuf += 3; } @@ -611,7 +611,7 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) } else { // No valid alternative colorspace pAlterCS->ReleaseCS(); - FX_INT32 nDictComponents = pDict ? pDict->GetInteger(FX_BSTRC("N")) : 0; + int32_t nDictComponents = pDict ? pDict->GetInteger(FX_BSTRC("N")) : 0; if (nDictComponents != 1 && nDictComponents != 3 && nDictComponents != 4) { return FALSE; } @@ -715,14 +715,14 @@ void CPDF_ICCBasedCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, CPDF_ModuleMgr::Get()->GetIccModule()->TranslateScanline(m_pProfile->m_pTransform, pDestBuf, pSrcBuf, pixels); } else { if (m_pCache == NULL) { - ((CPDF_ICCBasedCS*)this)->m_pCache = FX_Alloc2D(FX_BYTE, nMaxColors, 3); - FX_LPBYTE temp_src = FX_Alloc2D(FX_BYTE, nMaxColors, m_nComponents); + ((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; for (int i = 0; i < nMaxColors; i ++) { FX_DWORD color = i; FX_DWORD order = nMaxColors / 52; for (int c = 0; c < m_nComponents; c ++) { - *pSrc++ = (FX_BYTE)(color / order * 5); + *pSrc++ = (uint8_t)(color / order * 5); color %= order; order /= 52; } @@ -826,7 +826,7 @@ FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) } FX_BOOL CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const { - int index = (FX_INT32)(*pBuf); + int index = (int32_t)(*pBuf); if (index < 0 || index > m_MaxIndex) { return FALSE; } @@ -1204,7 +1204,7 @@ int CPDF_ColorSpace::GetBufSize() const FX_FLOAT* CPDF_ColorSpace::CreateBuf() { int size = GetBufSize(); - FX_BYTE* pBuf = FX_Alloc(FX_BYTE, size); + uint8_t* pBuf = FX_Alloc(uint8_t, size); return (FX_FLOAT*)pBuf; } FX_BOOL CPDF_ColorSpace::sRGB() const @@ -1270,9 +1270,9 @@ void CPDF_ColorSpace::TranslateImageLine(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf, src[j] = (FX_FLOAT)(*src_buf ++) / 255; } GetRGB(src, R, G, B); - *dest_buf ++ = (FX_INT32)(B * 255); - *dest_buf ++ = (FX_INT32)(G * 255); - *dest_buf ++ = (FX_INT32)(R * 255); + *dest_buf ++ = (int32_t)(B * 255); + *dest_buf ++ = (int32_t)(G * 255); + *dest_buf ++ = (int32_t)(R * 255); } } void CPDF_ColorSpace::EnableStdConversion(FX_BOOL bEnabled) @@ -1420,9 +1420,9 @@ FX_BOOL CPDF_Color::GetRGB(int& R, int& G, int& B) const if (!m_pCS->GetRGB(m_pBuffer, r, g, b)) { return FALSE; } - R = (FX_INT32)(r * 255 + 0.5f); - G = (FX_INT32)(g * 255 + 0.5f); - B = (FX_INT32)(b * 255 + 0.5f); + R = (int32_t)(r * 255 + 0.5f); + G = (int32_t)(g * 255 + 0.5f); + B = (int32_t)(b * 255 + 0.5f); return TRUE; } CPDF_Pattern* CPDF_Color::GetPattern() const diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp index 241b5895c5..00ea4c5fce 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp @@ -572,7 +572,7 @@ CPDF_IccProfile* CPDF_DocPageData::GetIccProfile(CPDF_Stream* pIccProfileStream) } CPDF_StreamAcc stream; stream.LoadAllData(pIccProfileStream, FALSE); - FX_BYTE digest[20]; + uint8_t digest[20]; CPDF_Stream* pCopiedStream = NULL; CRYPT_SHA1Generate(stream.GetData(), stream.GetSize(), digest); if (m_HashProfileMap.Lookup(CFX_ByteStringC(digest, 20), (void*&)pCopiedStream)) { @@ -621,7 +621,7 @@ CPDF_StreamAcc* CPDF_DocPageData::GetFontFileStreamAcc(CPDF_Stream* pFontStream) ftData = new CPDF_CountedObject<CPDF_StreamAcc*>; CPDF_StreamAcc* pFontFile = new CPDF_StreamAcc; CPDF_Dictionary* pFontDict = pFontStream->GetDict(); - FX_INT32 org_size = pFontDict->GetInteger(FX_BSTRC("Length1")) + pFontDict->GetInteger(FX_BSTRC("Length2")) + pFontDict->GetInteger(FX_BSTRC("Length3")); + int32_t org_size = pFontDict->GetInteger(FX_BSTRC("Length1")) + pFontDict->GetInteger(FX_BSTRC("Length2")) + pFontDict->GetInteger(FX_BSTRC("Length3")); if (org_size < 0) { org_size = 0; } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp index d29dee77d8..dadf6bf9cb 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp @@ -77,7 +77,7 @@ FX_BOOL CPDF_PSProc::Execute(CPDF_PSEngine* pEngine) { int size = m_Operators.GetSize(); for (int i = 0; i < size; i ++) { - PDF_PSOP op = (PDF_PSOP)(FX_UINTPTR)m_Operators[i]; + PDF_PSOP op = (PDF_PSOP)(uintptr_t)m_Operators[i]; if (op == PSOP_PROC) { i ++; } else if (op == PSOP_CONST) { @@ -492,7 +492,7 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) if (!pSize && i == 0) { m_pEncodeInfo[i].sizes = pDict->GetInteger(FX_BSTRC("Size")); } - if (nTotalSamples > 0 && (FX_UINT32)(m_pEncodeInfo[i].sizes) > UINT_MAX / nTotalSamples) { + if (nTotalSamples > 0 && (uint32_t)(m_pEncodeInfo[i].sizes) > UINT_MAX / nTotalSamples) { return FALSE; } nTotalSamples *= m_pEncodeInfo[i].sizes; @@ -512,7 +512,7 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) return FALSE; } nTotalSamples *= m_nBitsPerSample; - if (nTotalSamples > 0 && ((FX_UINT32)m_nOutputs) > UINT_MAX / nTotalSamples) { + if (nTotalSamples > 0 && ((uint32_t)m_nOutputs) > UINT_MAX / nTotalSamples) { return FALSE; } nTotalSamples *= m_nOutputs; 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 2bf3b1d4c3..bb4b9dee23 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp @@ -60,7 +60,7 @@ CPDF_ClipPathData::CPDF_ClipPathData(const CPDF_ClipPathData& src) for (int i = 0; i < m_PathCount; i ++) { m_pPathList[i] = src.m_pPathList[i]; } - m_pTypeList = FX_Alloc(FX_BYTE, alloc_size); + m_pTypeList = FX_Alloc(uint8_t, alloc_size); FXSYS_memcpy32(m_pTypeList, src.m_pTypeList, m_PathCount); } else { m_pPathList = NULL; @@ -88,7 +88,7 @@ void CPDF_ClipPathData::SetCount(int path_count, int text_count) m_PathCount = path_count; int alloc_size = (path_count + 7) / 8 * 8; m_pPathList = new CPDF_Path[alloc_size]; - m_pTypeList = FX_Alloc(FX_BYTE, alloc_size); + m_pTypeList = FX_Alloc(uint8_t, alloc_size); } if (text_count) { m_TextCount = text_count; @@ -155,7 +155,7 @@ void CPDF_ClipPath::AppendPath(CPDF_Path path, int type, FX_BOOL bAutoMerge) pNewPath[i] = pData->m_pPathList[i]; } delete[] pData->m_pPathList; - FX_BYTE* pNewType = FX_Alloc(FX_BYTE, pData->m_PathCount + 8); + uint8_t* pNewType = FX_Alloc(uint8_t, pData->m_PathCount + 8); FXSYS_memcpy32(pNewType, pData->m_pTypeList, pData->m_PathCount); if (pData->m_pTypeList) { FX_Free(pData->m_pTypeList); @@ -164,7 +164,7 @@ void CPDF_ClipPath::AppendPath(CPDF_Path path, int type, FX_BOOL bAutoMerge) pData->m_pTypeList = pNewType; } pData->m_pPathList[pData->m_PathCount] = path; - pData->m_pTypeList[pData->m_PathCount] = (FX_BYTE)type; + pData->m_pTypeList[pData->m_PathCount] = (uint8_t)type; pData->m_PathCount ++; } void CPDF_ClipPath::DeletePath(int index) diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp index b3e3cd6a2c..a92e9e783d 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -1553,7 +1553,7 @@ CFX_ByteString _FPDF_ByteStringFromHex(CFX_BinaryBuf& src_buf) FX_LPCBYTE str = src_buf.GetBuffer(); FX_DWORD size = src_buf.GetSize(); for (FX_DWORD i = 0; i < size; i ++) { - FX_BYTE ch = str[i]; + uint8_t ch = str[i]; if (ch >= '0' && ch <= '9') { if (bFirst) { code = (ch - '0') * 16; 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 d8b24593ef..bc2138e19e 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -23,7 +23,7 @@ FX_BOOL _PDF_HasInvalidOpChar(FX_LPCSTR op) if(!op) { return FALSE; } - FX_BYTE ch; + uint8_t ch; while((ch = *op++)) { if(_PDF_OpCharType[ch] == 'I') { return TRUE; @@ -235,7 +235,7 @@ void CPDF_StreamContentParser::ParsePathObject() } } } -CPDF_StreamParser::CPDF_StreamParser(const FX_BYTE* pData, FX_DWORD dwSize) +CPDF_StreamParser::CPDF_StreamParser(const uint8_t* pData, FX_DWORD dwSize) { m_pBuf = pData; m_Size = dwSize; @@ -262,7 +262,7 @@ FX_DWORD _DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, FX_LPBYTE& dest_b delete pDecoder; return -1; } - dest_buf = FX_Alloc2D(FX_BYTE, pitch, height); + 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); @@ -277,11 +277,11 @@ FX_DWORD _DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, FX_LPBYTE& dest_b } ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, const CPDF_Dictionary* pParams); -FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); -FX_DWORD _HexDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); -FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_buf, FX_DWORD src_size, 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 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 PDF_DecodeInlineStream(const FX_BYTE* src_buf, FX_DWORD limit, +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) { @@ -373,7 +373,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CPDF_Dicti if (OrigSize > m_Size - m_Pos) { OrigSize = m_Size - m_Pos; } - pData = FX_Alloc(FX_BYTE, OrigSize); + pData = FX_Alloc(uint8_t, OrigSize); FXSYS_memcpy32(pData, m_pBuf + m_Pos, OrigSize); dwStreamSize = OrigSize; m_Pos += OrigSize; @@ -421,7 +421,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CPDF_Dicti dwStreamSize += m_Pos - dwPrevPos; } m_Pos = dwSavePos; - pData = FX_Alloc(FX_BYTE, dwStreamSize); + pData = FX_Alloc(uint8_t, dwStreamSize); FXSYS_memcpy32(pData, m_pBuf + m_Pos, dwStreamSize); m_Pos += dwStreamSize; } @@ -1049,7 +1049,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) } m_Size += size + 1; } - m_pData = FX_Alloc(FX_BYTE, m_Size); + m_pData = FX_Alloc(uint8_t, m_Size); FX_DWORD pos = 0; for (i = 0; i < m_nStreams; i ++) { FXSYS_memcpy32(m_pData + pos, m_pStreamArray[i]->GetData(), m_pStreamArray[i]->GetSize()); diff --git a/core/src/fpdfapi/fpdf_page/pageint.h b/core/src/fpdfapi/fpdf_page/pageint.h index 7c527150b3..1f5428d56f 100644 --- a/core/src/fpdfapi/fpdf_page/pageint.h +++ b/core/src/fpdfapi/fpdf_page/pageint.h @@ -16,7 +16,7 @@ class CPDF_StreamParser { public: - CPDF_StreamParser(const FX_BYTE* pData, FX_DWORD dwSize); + CPDF_StreamParser(const uint8_t* pData, FX_DWORD dwSize); ~CPDF_StreamParser(); CPDF_Stream* ReadInlineStream(CPDF_Document* pDoc, CPDF_Dictionary* pDict, CPDF_Object* pCSObj, FX_BOOL bDecode); @@ -52,10 +52,10 @@ protected: void GetNextWord(FX_BOOL& bIsNumber); CFX_ByteString ReadString(); CFX_ByteString ReadHexString(); - const FX_BYTE* m_pBuf; + const uint8_t* m_pBuf; FX_DWORD m_Size; FX_DWORD m_Pos; - FX_BYTE m_WordBuffer[256]; + uint8_t m_WordBuffer[256]; FX_DWORD m_WordSize; CPDF_Object* m_pLastObj; }; @@ -153,7 +153,7 @@ public: FX_FLOAT GetNumber16(FX_DWORD index); int GetInteger(FX_DWORD index) { - return (FX_INT32)(GetNumber(index)); + return (int32_t)(GetNumber(index)); } FX_BOOL OnOperator(FX_LPCSTR op); void BigCaseCaller(int index); @@ -338,7 +338,7 @@ KeyType PDF_DocPageData_FindValue(const CFX_MapPtrTemplate<KeyType, CPDF_Counted } } findData = NULL; - return (KeyType)(FX_UINTPTR)NULL; + return (KeyType)(uintptr_t)NULL; } template <class KeyType, class ValueType> FX_BOOL PDF_DocPageData_Release(CFX_MapPtrTemplate<KeyType, CPDF_CountedObject<ValueType>*> &map, KeyType findKey, ValueType findValue, FX_BOOL bForce = FALSE) @@ -422,11 +422,11 @@ class CPDF_IccProfile public: CPDF_IccProfile(FX_LPCBYTE pData, FX_DWORD dwSize); ~CPDF_IccProfile(); - FX_INT32 GetComponents() const { return m_nSrcComponents; } + int32_t GetComponents() const { return m_nSrcComponents; } FX_BOOL m_bsRGB; FX_LPVOID m_pTransform; private: - FX_INT32 m_nSrcComponents; + int32_t m_nSrcComponents; }; class CPDF_DeviceCS : public CPDF_ColorSpace { diff --git a/core/src/fpdfapi/fpdf_parser/filters_int.h b/core/src/fpdfapi/fpdf_parser/filters_int.h index 1139371fda..6652cc0ccc 100644 --- a/core/src/fpdfapi/fpdf_parser/filters_int.h +++ b/core/src/fpdfapi/fpdf_parser/filters_int.h @@ -26,7 +26,7 @@ public: virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {} void* m_pContext; - FX_BYTE m_DestBuffer[FPDF_FILTER_BUFFER_SIZE]; + uint8_t m_DestBuffer[FPDF_FILTER_BUFFER_SIZE]; }; class CPDF_LzwFilter : public CFX_DataFilter { @@ -40,11 +40,11 @@ public: FX_DWORD m_nCodes; FX_DWORD m_CodeLen; FX_DWORD m_OldCode; - FX_BYTE m_LastChar; + uint8_t m_LastChar; FX_DWORD m_nLeftBits, m_LeftBits; - FX_BYTE m_DecodeStack[4000]; + uint8_t m_DecodeStack[4000]; FX_DWORD m_StackLen; - void AddCode(FX_DWORD prefix_code, FX_BYTE append_char); + void AddCode(FX_DWORD prefix_code, uint8_t append_char); void DecodeString(FX_DWORD code); }; class CPDF_PredictorFilter : public CFX_DataFilter diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp index d18caab217..b1fde0be71 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 FX_BYTE* 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, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { dest_size = 0; dest_buf = NULL; @@ -19,7 +19,7 @@ FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b FX_DWORD zcount = 0; FX_DWORD pos = 0; while (pos < src_size) { - FX_BYTE ch = src_buf[pos]; + uint8_t ch = src_buf[pos]; if (ch < '!' && ch != '\n' && ch != '\r' && ch != ' ' && ch != '\t') { break; } @@ -39,12 +39,12 @@ FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b if (zcount * 4 > UINT_MAX - (pos - zcount)) { return (FX_DWORD) - 1; } - dest_buf = FX_Alloc(FX_BYTE, zcount * 4 + (pos - zcount)); + dest_buf = FX_Alloc(uint8_t, zcount * 4 + (pos - zcount)); int state = 0; - FX_UINT32 res = 0; + uint32_t res = 0; pos = dest_size = 0; while (pos < src_size) { - FX_BYTE ch = src_buf[pos++]; + uint8_t ch = src_buf[pos++]; if (ch == '\n' || ch == '\r' || ch == ' ' || ch == '\t') { continue; } @@ -61,7 +61,7 @@ FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b state ++; if (state == 5) { for (int i = 0; i < 4; i ++) { - dest_buf[dest_size++] = (FX_BYTE)(res >> (3 - i) * 8); + dest_buf[dest_size++] = (uint8_t)(res >> (3 - i) * 8); } state = 0; res = 0; @@ -74,7 +74,7 @@ FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b res = res * 85 + 84; } for (i = 0; i < state - 1; i ++) { - dest_buf[dest_size++] = (FX_BYTE)(res >> (3 - i) * 8); + dest_buf[dest_size++] = (uint8_t)(res >> (3 - i) * 8); } } if (pos < src_size && src_buf[pos] == '>') { @@ -82,18 +82,18 @@ FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b } return pos; } -FX_DWORD _HexDecode(const FX_BYTE* 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 i; for (i = 0; i < src_size; i ++) if (src_buf[i] == '>') { break; } - dest_buf = FX_Alloc( FX_BYTE, i / 2 + 1); + dest_buf = FX_Alloc( uint8_t, i / 2 + 1); dest_size = 0; FX_BOOL bFirstDigit = TRUE; for (i = 0; i < src_size; i ++) { - FX_BYTE ch = src_buf[i]; + uint8_t ch = src_buf[i]; if (ch == ' ' || ch == '\n' || ch == '\t' || ch == '\r') { continue; } @@ -122,7 +122,7 @@ FX_DWORD _HexDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b } return i; } -FX_DWORD RunLengthDecode(const FX_BYTE* 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) { FX_DWORD i = 0; FX_DWORD old; @@ -149,7 +149,7 @@ FX_DWORD RunLengthDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& d if (dest_size >= _STREAM_MAX_SIZE_) { return -1; } - dest_buf = FX_Alloc( FX_BYTE, dest_size); + dest_buf = FX_Alloc( uint8_t, dest_size); i = 0; int dest_count = 0; while (i < src_size) { @@ -245,7 +245,7 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD return CPDF_ModuleMgr::Get()->GetFlateModule()->CreateDecoder(src_buf, src_size, width, height, nComps, bpc, predictor, Colors, BitsPerComponent, Columns); } -FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams, +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) { int predictor = 0; @@ -468,7 +468,7 @@ CFX_ByteString PDF_EncodeText(FX_LPCWSTR pString, int len, CFX_CharMap* pCharMap dest_buf2 += 2; for (int i = 0; i < len; i ++) { *dest_buf2++ = pString[i] >> 8; - *dest_buf2++ = (FX_BYTE)pString[i]; + *dest_buf2++ = (uint8_t)pString[i]; } result.ReleaseBuffer(encLen); return result; @@ -488,7 +488,7 @@ CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex) } result.AppendChar('('); for (int i = 0; i < srclen; i ++) { - FX_BYTE ch = src[i]; + uint8_t ch = src[i]; if (ch == ')' || ch == '\\' || ch == '(') { result.AppendChar('\\'); } else if (ch == 0x0a) { @@ -503,7 +503,7 @@ CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex) result.AppendChar(')'); return result.GetByteString(); } -void FlateEncode(const FX_BYTE* 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, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); if (pEncoders) { @@ -518,7 +518,7 @@ void FlateEncode(FX_LPCBYTE src_buf, FX_DWORD src_size, int predictor, int Color pEncoders->GetFlateModule()->Encode(src_buf, src_size, predictor, Colors, BitsPerComponent, Columns, dest_buf, dest_size); } } -FX_DWORD FlateDecode(const FX_BYTE* 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) { 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 b11c7eeb44..f2643694ec 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)(FX_UINTPTR)objnum, (FX_LPVOID&)pObj)) { + if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, (FX_LPVOID&)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 e35b0a9d10..4ca97fe9e8 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp @@ -7,7 +7,7 @@ #include <time.h> #include "../../../include/fpdfapi/fpdf_parser.h" #include "../../../include/fdrm/fx_crypt.h" -const FX_BYTE defpasscode[32] = { +const uint8_t defpasscode[32] = { 0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e, 0x56, 0xff, 0xfa, 0x01, 0x08, 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80, @@ -17,11 +17,11 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt, FX_LPCBYTE password, FX_DWORD pas FX_LPBYTE key, int keylen, FX_BOOL bIgnoreMeta, CPDF_Array* pIdArray) { int revision = pEncrypt->GetInteger(FX_BSTRC("R")); - FX_BYTE passcode[32]; + uint8_t passcode[32]; for (FX_DWORD i = 0; i < 32; i ++) { passcode[i] = i < pass_size ? password[i] : defpasscode[i - pass_size]; } - FX_BYTE md5[100]; + uint8_t md5[100]; CRYPT_MD5Start(md5); CRYPT_MD5Update(md5, passcode, 32); CFX_ByteString okey = pEncrypt->GetString(FX_BSTRC("O")); @@ -36,7 +36,7 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt, FX_LPCBYTE password, FX_DWORD pas FX_DWORD tag = (FX_DWORD) - 1; CRYPT_MD5Update(md5, (FX_LPBYTE)&tag, 4); } - FX_BYTE digest[16]; + uint8_t digest[16]; CRYPT_MD5Finish(md5, digest); FX_DWORD copy_len = keylen; if (copy_len > sizeof(digest)) { @@ -55,8 +55,8 @@ CPDF_CryptoHandler* CPDF_StandardSecurityHandler::CreateCryptoHandler() return new CPDF_StandardCryptoHandler; } typedef struct _PDF_CRYPTOITEM { - FX_INT32 m_Cipher; - FX_INT32 m_KeyLen; + int32_t m_Cipher; + int32_t m_KeyLen; FX_BOOL m_bChecked; CPDF_StandardCryptoHandler* m_pCryptoHandler; } PDF_CRYPTOITEM; @@ -85,7 +85,7 @@ FX_BOOL CPDF_StandardSecurityHandler::OnInit(CPDF_Parser* pParser, CPDF_Dictiona } return CheckSecurity(m_KeyLen); } -FX_BOOL CPDF_StandardSecurityHandler::CheckSecurity(FX_INT32 key_len) +FX_BOOL CPDF_StandardSecurityHandler::CheckSecurity(int32_t key_len) { CFX_ByteString password = m_pParser->GetPassword(); if (CheckPassword(password, password.GetLength(), TRUE, m_EncryptKey, key_len)) { @@ -198,14 +198,14 @@ FX_BOOL CPDF_StandardSecurityHandler::GetCryptInfo(int& cipher, FX_LPCBYTE& buff } #define FX_GET_32WORD(n,b,i) \ { \ - (n) = (FX_DWORD)(( (FX_UINT64) (b)[(i)] << 24 ) \ - | ( (FX_UINT64) (b)[(i) + 1] << 16 ) \ - | ( (FX_UINT64) (b)[(i) + 2] << 8 ) \ - | ( (FX_UINT64) (b)[(i) + 3] )); \ + (n) = (FX_DWORD)(( (uint64_t) (b)[(i)] << 24 ) \ + | ( (uint64_t) (b)[(i) + 1] << 16 ) \ + | ( (uint64_t) (b)[(i) + 2] << 8 ) \ + | ( (uint64_t) (b)[(i) + 3] )); \ } int BigOrder64BitsMod3(FX_LPBYTE data) { - FX_UINT64 ret = 0; + uint64_t ret = 0; for (int i = 0; i < 4; ++i) { FX_DWORD value; FX_GET_32WORD(value, data, 4 * i); @@ -218,14 +218,14 @@ int BigOrder64BitsMod3(FX_LPBYTE data) void Revision6_Hash(FX_LPCBYTE password, FX_DWORD size, FX_LPCBYTE salt, FX_LPCBYTE vector, FX_LPBYTE hash) { int iBlockSize = 32; - FX_BYTE sha[128]; + uint8_t sha[128]; CRYPT_SHA256Start(sha); CRYPT_SHA256Update(sha, password, size); CRYPT_SHA256Update(sha, salt, 8); if (vector) { CRYPT_SHA256Update(sha, vector, 48); } - FX_BYTE digest[32]; + uint8_t digest[32]; CRYPT_SHA256Finish(sha, digest); CFX_ByteTextBuf buf; FX_LPBYTE input = digest; @@ -235,7 +235,7 @@ void Revision6_Hash(FX_LPCBYTE password, FX_DWORD size, FX_LPCBYTE salt, FX_LPCB int iBufLen = buf.GetLength(); CFX_ByteTextBuf interDigest; int i = 0; - FX_LPBYTE aes = FX_Alloc(FX_BYTE, 2048); + FX_LPBYTE aes = FX_Alloc(uint8_t, 2048); while (i < 64 || i < E[iBufLen - 1] + 32) { int iRoundSize = size + iBlockSize; if (vector) { @@ -300,8 +300,8 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, return FALSE; } FX_LPCBYTE pkey = bOwner ? (FX_LPCBYTE)okey : (FX_LPCBYTE)ukey; - FX_BYTE sha[128]; - FX_BYTE digest[32]; + 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); } else { @@ -334,9 +334,9 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, if (ekey.GetLength() < 32) { return FALSE; } - FX_BYTE* aes = FX_Alloc(FX_BYTE, 2048); + uint8_t* aes = FX_Alloc(uint8_t, 2048); CRYPT_AESSetKey(aes, 16, digest, 32, FALSE); - FX_BYTE iv[16]; + uint8_t iv[16]; FXSYS_memset32(iv, 0, 16); CRYPT_AESSetIV(aes, iv); CRYPT_AESDecrypt(aes, key, ekey, 32); @@ -346,14 +346,14 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, if (perms.IsEmpty()) { return FALSE; } - FX_BYTE perms_buf[16]; + uint8_t perms_buf[16]; FXSYS_memset32(perms_buf, 0, sizeof(perms_buf)); FX_DWORD copy_len = sizeof(perms_buf); if (copy_len > (FX_DWORD)perms.GetLength()) { copy_len = perms.GetLength(); } FXSYS_memcpy32(perms_buf, (FX_LPCBYTE)perms, copy_len); - FX_BYTE buf[16]; + uint8_t buf[16]; CRYPT_AESDecrypt(aes, buf, perms_buf, 16); FX_Free(aes); if (buf[9] != 'a' || buf[10] != 'd' || buf[11] != 'b') { @@ -371,12 +371,12 @@ int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD pa { 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, FX_INT32 key_len) +int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD size, FX_BOOL bOwner, FX_LPBYTE key, int32_t key_len) { if (m_Revision >= 5) { return AES256_CheckPassword(password, size, bOwner, key); } - FX_BYTE keybuf[32]; + uint8_t keybuf[32]; if (key == NULL) { key = keybuf; } @@ -386,7 +386,7 @@ 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, FX_INT32 key_len) + FX_BOOL bIgnoreEncryptMeta, FX_LPBYTE key, int32_t key_len) { CalcEncryptKey(m_pEncryptDict, password, pass_size, key, key_len, bIgnoreEncryptMeta, m_pParser->GetIDArray()); @@ -394,12 +394,12 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_ if (ukey.GetLength() < 16) { return FALSE; } - FX_BYTE ukeybuf[32]; + uint8_t ukeybuf[32]; if (m_Revision == 2) { FXSYS_memcpy32(ukeybuf, defpasscode, 32); CRYPT_ArcFourCryptBlock(ukeybuf, 32, key, key_len); } else { - FX_BYTE test[32], tmpkey[32]; + uint8_t test[32], tmpkey[32]; FX_DWORD copy_len = sizeof(test); if (copy_len > (FX_DWORD)ukey.GetLength()) { copy_len = ukey.GetLength(); @@ -413,7 +413,7 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_ } CRYPT_ArcFourCryptBlock(test, 32, tmpkey, key_len); } - FX_BYTE md5[100]; + uint8_t md5[100]; CRYPT_MD5Start(md5); CRYPT_MD5Update(md5, defpasscode, 32); CPDF_Array* pIdArray = m_pParser->GetIDArray(); @@ -433,22 +433,22 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pa { return GetUserPassword(owner_pass, pass_size, m_KeyLen); } -CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pass, FX_DWORD pass_size, FX_INT32 key_len) +CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pass, FX_DWORD pass_size, int32_t key_len) { CFX_ByteString okey = m_pEncryptDict->GetString(FX_BSTRC("O")); - FX_BYTE passcode[32]; + uint8_t passcode[32]; FX_DWORD i; for (i = 0; i < 32; i ++) { passcode[i] = i < pass_size ? owner_pass[i] : defpasscode[i - pass_size]; } - FX_BYTE digest[16]; + uint8_t digest[16]; CRYPT_MD5Generate(passcode, 32, digest); if (m_Revision >= 3) { for (int i = 0; i < 50; i ++) { CRYPT_MD5Generate(digest, 16, digest); } } - FX_BYTE enckey[32]; + uint8_t enckey[32]; FXSYS_memset32(enckey, 0, sizeof(enckey)); FX_DWORD copy_len = key_len; if (copy_len > sizeof(digest)) { @@ -459,14 +459,14 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pa if (okeylen > 32) { okeylen = 32; } - FX_BYTE okeybuf[64]; + uint8_t okeybuf[64]; FXSYS_memset32(okeybuf, 0, sizeof(okeybuf)); FXSYS_memcpy32(okeybuf, okey.c_str(), okeylen); if (m_Revision == 2) { CRYPT_ArcFourCryptBlock(okeybuf, okeylen, enckey, key_len); } else { for (int i = 19; i >= 0; i --) { - FX_BYTE tempkey[32]; + uint8_t tempkey[32]; FXSYS_memset32(tempkey, 0, sizeof(tempkey)); for (int j = 0; j < m_KeyLen; j ++) { tempkey[j] = enckey[j] ^ i; @@ -481,7 +481,7 @@ 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, FX_INT32 key_len) + FX_LPBYTE 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)) { @@ -511,11 +511,11 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ } if (m_Revision >= 5) { int t = (int)time(NULL); - FX_BYTE sha[128]; + uint8_t sha[128]; CRYPT_SHA256Start(sha); - CRYPT_SHA256Update(sha, (FX_BYTE*)&t, sizeof t); + CRYPT_SHA256Update(sha, (uint8_t*)&t, sizeof t); CRYPT_SHA256Update(sha, m_EncryptKey, 32); - CRYPT_SHA256Update(sha, (FX_BYTE*)"there", 5); + CRYPT_SHA256Update(sha, (uint8_t*)"there", 5); CRYPT_SHA256Finish(sha, m_EncryptKey); AES256_SetPassword(pEncryptDict, user_pass, user_size, FALSE, m_EncryptKey); if (bDefault) { @@ -525,29 +525,29 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ return; } if (bDefault) { - FX_BYTE passcode[32]; + uint8_t passcode[32]; FX_DWORD i; for (i = 0; i < 32; i ++) { passcode[i] = i < owner_size ? owner_pass[i] : defpasscode[i - owner_size]; } - FX_BYTE digest[16]; + uint8_t digest[16]; CRYPT_MD5Generate(passcode, 32, digest); if (m_Revision >= 3) { for (int i = 0; i < 50; i ++) { CRYPT_MD5Generate(digest, 16, digest); } } - FX_BYTE enckey[32]; + uint8_t enckey[32]; FXSYS_memcpy32(enckey, digest, key_len); for (i = 0; i < 32; i ++) { passcode[i] = i < user_size ? user_pass[i] : defpasscode[i - user_size]; } CRYPT_ArcFourCryptBlock(passcode, 32, enckey, key_len); - FX_BYTE tempkey[32]; + uint8_t tempkey[32]; if (m_Revision >= 3) { for (i = 1; i <= 19; i ++) { for (int j = 0; j < key_len; j ++) { - tempkey[j] = enckey[j] ^ (FX_BYTE)i; + tempkey[j] = enckey[j] ^ (uint8_t)i; } CRYPT_ArcFourCryptBlock(passcode, 32, tempkey, key_len); } @@ -556,25 +556,25 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ } CalcEncryptKey(m_pEncryptDict, (FX_LPBYTE)user_pass, user_size, m_EncryptKey, key_len, FALSE, pIdArray); if (m_Revision < 3) { - FX_BYTE tempbuf[32]; + uint8_t tempbuf[32]; FXSYS_memcpy32(tempbuf, defpasscode, 32); CRYPT_ArcFourCryptBlock(tempbuf, 32, m_EncryptKey, key_len); pEncryptDict->SetAtString(FX_BSTRC("U"), CFX_ByteString(tempbuf, 32)); } else { - FX_BYTE md5[100]; + uint8_t md5[100]; CRYPT_MD5Start(md5); CRYPT_MD5Update(md5, defpasscode, 32); if (pIdArray) { CFX_ByteString id = pIdArray->GetString(0); CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength()); } - FX_BYTE digest[32]; + uint8_t digest[32]; CRYPT_MD5Finish(md5, digest); CRYPT_ArcFourCryptBlock(digest, 16, m_EncryptKey, key_len); - FX_BYTE tempkey[32]; + uint8_t tempkey[32]; for (int i = 1; i <= 19; i ++) { for (int j = 0; j < key_len; j ++) { - tempkey[j] = m_EncryptKey[j] ^ (FX_BYTE)i; + tempkey[j] = m_EncryptKey[j] ^ (uint8_t)i; } CRYPT_ArcFourCryptBlock(digest, 16, tempkey, key_len); } @@ -594,14 +594,14 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ } void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict, FX_LPCBYTE password, FX_DWORD size, FX_BOOL bOwner, FX_LPCBYTE key) { - FX_BYTE sha[128]; + uint8_t sha[128]; CRYPT_SHA1Start(sha); CRYPT_SHA1Update(sha, key, 32); - CRYPT_SHA1Update(sha, (FX_BYTE*)"hello", 5); - FX_BYTE digest[20]; + CRYPT_SHA1Update(sha, (uint8_t*)"hello", 5); + uint8_t digest[20]; CRYPT_SHA1Finish(sha, digest); CFX_ByteString ukey = pEncryptDict->GetString(FX_BSTRC("U")); - FX_BYTE digest1[48]; + uint8_t digest1[48]; if (m_Revision >= 6) { Revision6_Hash(password, size, digest, (bOwner ? (FX_LPCBYTE)ukey : NULL), digest1); } else { @@ -626,9 +626,9 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD } CRYPT_SHA256Finish(sha, digest1); } - FX_BYTE* aes = FX_Alloc(FX_BYTE, 2048); + uint8_t* aes = FX_Alloc(uint8_t, 2048); CRYPT_AESSetKey(aes, 16, digest1, 32, TRUE); - FX_BYTE iv[16]; + uint8_t iv[16]; FXSYS_memset32(iv, 0, 16); CRYPT_AESSetIV(aes, iv); CRYPT_AESEncrypt(aes, digest1, key, 32); @@ -638,11 +638,11 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD void CPDF_StandardSecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict, FX_DWORD permissions, FX_BOOL bEncryptMetadata, FX_LPCBYTE key) { - FX_BYTE buf[16]; - buf[0] = (FX_BYTE)permissions; - buf[1] = (FX_BYTE)(permissions >> 8); - buf[2] = (FX_BYTE)(permissions >> 16); - buf[3] = (FX_BYTE)(permissions >> 24); + uint8_t buf[16]; + buf[0] = (uint8_t)permissions; + buf[1] = (uint8_t)(permissions >> 8); + buf[2] = (uint8_t)(permissions >> 16); + buf[3] = (uint8_t)(permissions >> 24); buf[4] = 0xff; buf[5] = 0xff; buf[6] = 0xff; @@ -651,9 +651,9 @@ void CPDF_StandardSecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict buf[9] = 'a'; buf[10] = 'd'; buf[11] = 'b'; - FX_BYTE* aes = FX_Alloc(FX_BYTE, 2048); + uint8_t* aes = FX_Alloc(uint8_t, 2048); CRYPT_AESSetKey(aes, 16, key, 32, TRUE); - FX_BYTE iv[16], buf1[16]; + uint8_t iv[16], buf1[16]; FXSYS_memset32(iv, 0, 16); CRYPT_AESSetIV(aes, iv); CRYPT_AESEncrypt(aes, buf1, buf, 16); @@ -667,16 +667,16 @@ void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, F FXSYS_memcpy32(dest_buf, src_buf, src_size); return; } - FX_BYTE realkey[16]; + uint8_t realkey[16]; int realkeylen = 16; if (m_Cipher != FXCIPHER_AES || m_KeyLen != 32) { - FX_BYTE key1[32]; + uint8_t key1[32]; FXSYS_memcpy32(key1, m_EncryptKey, m_KeyLen); - key1[m_KeyLen + 0] = (FX_BYTE)objnum; - key1[m_KeyLen + 1] = (FX_BYTE)(objnum >> 8); - key1[m_KeyLen + 2] = (FX_BYTE)(objnum >> 16); - key1[m_KeyLen + 3] = (FX_BYTE)gennum; - key1[m_KeyLen + 4] = (FX_BYTE)(gennum >> 8); + key1[m_KeyLen + 0] = (uint8_t)objnum; + key1[m_KeyLen + 1] = (uint8_t)(objnum >> 8); + key1[m_KeyLen + 2] = (uint8_t)(objnum >> 16); + key1[m_KeyLen + 3] = (uint8_t)gennum; + key1[m_KeyLen + 4] = (uint8_t)(gennum >> 8); FXSYS_memcpy32(key1 + m_KeyLen, &objnum, 3); FXSYS_memcpy32(key1 + m_KeyLen + 3, &gennum, 2); if (m_Cipher == FXCIPHER_AES) { @@ -691,15 +691,15 @@ void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, F if (m_Cipher == FXCIPHER_AES) { CRYPT_AESSetKey(m_pAESContext, 16, m_KeyLen == 32 ? m_EncryptKey : realkey, m_KeyLen, bEncrypt); if (bEncrypt) { - FX_BYTE iv[16]; + uint8_t iv[16]; for (int i = 0; i < 16; i ++) { - iv[i] = (FX_BYTE)rand(); + iv[i] = (uint8_t)rand(); } CRYPT_AESSetIV(m_pAESContext, iv); FXSYS_memcpy32(dest_buf, iv, 16); int nblocks = src_size / 16; CRYPT_AESEncrypt(m_pAESContext, dest_buf + 16, src_buf, nblocks * 16); - FX_BYTE padding[16]; + uint8_t padding[16]; FXSYS_memcpy32(padding, src_buf + nblocks * 16, src_size % 16); FXSYS_memset8(padding + src_size % 16, 16 - src_size % 16, 16 - src_size % 16); CRYPT_AESEncrypt(m_pAESContext, dest_buf + nblocks * 16 + 16, padding, 16); @@ -719,9 +719,9 @@ void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, F } } typedef struct _AESCryptContext { - FX_BYTE m_Context[2048]; + uint8_t m_Context[2048]; FX_BOOL m_bIV; - FX_BYTE m_Block[16]; + uint8_t m_Block[16]; FX_DWORD m_BlockOffset; } AESCryptContext; FX_LPVOID CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennum, FX_BOOL bEncrypt) @@ -736,20 +736,20 @@ FX_LPVOID CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennu CRYPT_AESSetKey(pContext->m_Context, 16, m_EncryptKey, 32, bEncrypt); if (bEncrypt) { for (int i = 0; i < 16; i ++) { - pContext->m_Block[i] = (FX_BYTE)rand(); + pContext->m_Block[i] = (uint8_t)rand(); } CRYPT_AESSetIV(pContext->m_Context, pContext->m_Block); } return pContext; } - FX_BYTE key1[48]; + uint8_t key1[48]; FXSYS_memcpy32(key1, m_EncryptKey, m_KeyLen); FXSYS_memcpy32(key1 + m_KeyLen, &objnum, 3); FXSYS_memcpy32(key1 + m_KeyLen + 3, &gennum, 2); if (m_Cipher == FXCIPHER_AES) { FXSYS_memcpy32(key1 + m_KeyLen + 5, "sAlT", 4); } - FX_BYTE realkey[16]; + uint8_t realkey[16]; CRYPT_MD5Generate(key1, m_Cipher == FXCIPHER_AES ? m_KeyLen + 9 : m_KeyLen + 5, realkey); int realkeylen = m_KeyLen + 5; if (realkeylen > 16) { @@ -762,13 +762,13 @@ FX_LPVOID CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennu CRYPT_AESSetKey(pContext->m_Context, 16, realkey, 16, bEncrypt); if (bEncrypt) { for (int i = 0; i < 16; i ++) { - pContext->m_Block[i] = (FX_BYTE)rand(); + pContext->m_Block[i] = (uint8_t)rand(); } CRYPT_AESSetIV(pContext->m_Context, pContext->m_Block); } return pContext; } - void* pContext = FX_Alloc(FX_BYTE, 1040); + void* pContext = FX_Alloc(uint8_t, 1040); CRYPT_ArcFourSetup(pContext, realkey, realkeylen); return pContext; } @@ -809,7 +809,7 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptStream(FX_LPVOID context, FX_LPCBYTE sr pContext->m_bIV = FALSE; pContext->m_BlockOffset = 0; } else if (src_off < src_size) { - FX_BYTE block_buf[16]; + uint8_t block_buf[16]; if (bEncrypt) { CRYPT_AESEncrypt(pContext->m_Context, block_buf, pContext->m_Block, 16); } else { @@ -839,17 +839,17 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptFinish(FX_LPVOID context, CFX_BinaryBuf } AESCryptContext* pContext = (AESCryptContext*)context; if (bEncrypt) { - FX_BYTE block_buf[16]; + uint8_t block_buf[16]; if (pContext->m_BlockOffset == 16) { CRYPT_AESEncrypt(pContext->m_Context, block_buf, pContext->m_Block, 16); dest_buf.AppendBlock(block_buf, 16); pContext->m_BlockOffset = 0; } - FXSYS_memset8(pContext->m_Block + pContext->m_BlockOffset, (FX_BYTE)(16 - pContext->m_BlockOffset), 16 - pContext->m_BlockOffset); + FXSYS_memset8(pContext->m_Block + pContext->m_BlockOffset, (uint8_t)(16 - pContext->m_BlockOffset), 16 - pContext->m_BlockOffset); CRYPT_AESEncrypt(pContext->m_Context, block_buf, pContext->m_Block, 16); dest_buf.AppendBlock(block_buf, 16); } else if (pContext->m_BlockOffset == 16) { - FX_BYTE block_buf[16]; + uint8_t block_buf[16]; CRYPT_AESDecrypt(pContext->m_Context, block_buf, pContext->m_Block, 16); if (block_buf[15] <= 16) { dest_buf.AppendBlock(block_buf, 16 - block_buf[15]); @@ -879,7 +879,7 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(CPDF_Dictionary* pEncryptDict, CPDF_Sec FXSYS_memcpy32(m_EncryptKey, key, m_KeyLen); } if (m_Cipher == FXCIPHER_AES) { - m_pAESContext = FX_Alloc(FX_BYTE, 2048); + m_pAESContext = FX_Alloc(uint8_t, 2048); } return TRUE; } @@ -911,7 +911,7 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher, FX_LPCBYTE key, int keylen) m_KeyLen = keylen; FXSYS_memcpy32(m_EncryptKey, key, keylen); if (m_Cipher == FXCIPHER_AES) { - m_pAESContext = FX_Alloc(FX_BYTE, 2048); + m_pAESContext = FX_Alloc(uint8_t, 2048); } return TRUE; } diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp index 6fa7419a41..8cb0cee82a 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp @@ -296,7 +296,7 @@ void CPDF_DecryptFilter::v_FilterFinish(CFX_BinaryBuf& dest_buf) extern "C" { static void* my_alloc_func (void* opaque, unsigned int items, unsigned int size) { - return FX_Alloc2D(FX_BYTE, items, size); + return FX_Alloc2D(uint8_t, items, size); } static void my_free_func (void* opaque, void* address) { @@ -361,8 +361,8 @@ void CPDF_LzwFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_Binar m_nLeftBits = 8 - new_bits; m_LeftBits = src_buf[i] % (1 << m_nLeftBits); if (code < 256) { - dest_buf.AppendByte((FX_BYTE)code); - m_LastChar = (FX_BYTE)code; + dest_buf.AppendByte((uint8_t)code); + m_LastChar = (uint8_t)code; if (m_OldCode != -1) { AddCode(m_OldCode, m_LastChar); } @@ -406,7 +406,7 @@ void CPDF_LzwFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_Binar } } } -void CPDF_LzwFilter::AddCode(FX_DWORD prefix_code, FX_BYTE append_char) +void CPDF_LzwFilter::AddCode(FX_DWORD prefix_code, uint8_t append_char) { if (m_nCodes + m_bEarlyChange == 4094) { return; @@ -431,13 +431,13 @@ void CPDF_LzwFilter::DecodeString(FX_DWORD code) if (m_StackLen >= sizeof(m_DecodeStack)) { return; } - m_DecodeStack[m_StackLen++] = (FX_BYTE)data; + m_DecodeStack[m_StackLen++] = (uint8_t)data; code = data >> 16; } if (m_StackLen >= sizeof(m_DecodeStack)) { return; } - m_DecodeStack[m_StackLen++] = (FX_BYTE)code; + m_DecodeStack[m_StackLen++] = (uint8_t)code; } CPDF_PredictorFilter::CPDF_PredictorFilter(int predictor, int colors, int bpc, int cols) { @@ -461,23 +461,23 @@ CPDF_PredictorFilter::~CPDF_PredictorFilter() FX_Free(m_pRefLine); } } -static FX_BYTE PaethPredictor(int a, int b, int c) +static uint8_t PaethPredictor(int a, int b, int c) { int p = a + b - c; int pa = FXSYS_abs(p - a); int pb = FXSYS_abs(p - b); int pc = FXSYS_abs(p - c); if (pa <= pb && pa <= pc) { - return (FX_BYTE)a; + return (uint8_t)a; } if (pb <= pc) { - return (FX_BYTE)b; + return (uint8_t)b; } - return (FX_BYTE)c; + return (uint8_t)c; } static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, int Bpp) { - FX_BYTE tag = cur_buf[0]; + uint8_t tag = cur_buf[0]; if (tag == 0) { return; } @@ -486,10 +486,10 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i ref_buf ++; } for (int byte = 0; byte < pitch; byte ++) { - FX_BYTE raw_byte = cur_buf[byte]; + uint8_t raw_byte = cur_buf[byte]; switch (tag) { case 1: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= Bpp) { left = cur_buf[byte - Bpp]; } @@ -497,7 +497,7 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i break; } case 2: { - FX_BYTE up = 0; + uint8_t up = 0; if (ref_buf) { up = ref_buf[byte]; } @@ -505,11 +505,11 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i break; } case 3: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= Bpp) { left = cur_buf[byte - Bpp]; } - FX_BYTE up = 0; + uint8_t up = 0; if (ref_buf) { up = ref_buf[byte]; } @@ -517,15 +517,15 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i break; } case 4: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= Bpp) { left = cur_buf[byte - Bpp]; } - FX_BYTE up = 0; + uint8_t up = 0; if (ref_buf) { up = ref_buf[byte]; } - FX_BYTE upper_left = 0; + uint8_t upper_left = 0; if (byte >= Bpp && ref_buf) { upper_left = ref_buf[byte - Bpp]; } @@ -538,9 +538,9 @@ 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) { if (m_pCurLine == NULL) { - m_pCurLine = FX_Alloc(FX_BYTE, m_Pitch); + m_pCurLine = FX_Alloc(uint8_t, m_Pitch); if (!m_bTiff) { - m_pRefLine = FX_Alloc(FX_BYTE, m_Pitch); + m_pRefLine = FX_Alloc(uint8_t, m_Pitch); } } while (1) { @@ -579,7 +579,7 @@ CPDF_Ascii85Filter::CPDF_Ascii85Filter() void CPDF_Ascii85Filter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { for (FX_DWORD i = 0; i < src_size; i ++) { - FX_BYTE byte = src_buf[i]; + uint8_t byte = src_buf[i]; if (PDF_CharType[byte] == 'W') { continue; } @@ -604,7 +604,7 @@ void CPDF_Ascii85Filter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_B m_CharCount ++; if (m_CharCount == 5) { for (int i = 0; i < 4; i ++) { - dest_buf.AppendByte((FX_BYTE)(m_CurDWord >> (3 - i) * 8)); + dest_buf.AppendByte((uint8_t)(m_CurDWord >> (3 - i) * 8)); } m_State = 0; } @@ -615,7 +615,7 @@ void CPDF_Ascii85Filter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_B m_CurDWord = m_CurDWord * 85 + 84; } for (i = 0; i < m_CharCount - 1; i ++) { - dest_buf.AppendByte((FX_BYTE)(m_CurDWord >> (3 - i) * 8)); + dest_buf.AppendByte((uint8_t)(m_CurDWord >> (3 - i) * 8)); } } m_State = 2; @@ -638,7 +638,7 @@ CPDF_AsciiHexFilter::CPDF_AsciiHexFilter() void CPDF_AsciiHexFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { for (FX_DWORD i = 0; i < src_size; i ++) { - FX_BYTE byte = src_buf[i]; + uint8_t byte = src_buf[i]; if (PDF_CharType[byte] == 'W') { continue; } @@ -673,7 +673,7 @@ CPDF_RunLenFilter::CPDF_RunLenFilter() void CPDF_RunLenFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { for (FX_DWORD i = 0; i < src_size; i ++) { - FX_BYTE byte = src_buf[i]; + uint8_t byte = src_buf[i]; switch (m_State) { case 0: if (byte < 128) { @@ -755,7 +755,7 @@ void CPDF_JpegFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_Bina m_Pitch = m_Width * m_nComps; } if (m_pScanline == NULL) { - m_pScanline = FX_Alloc(FX_BYTE, m_Pitch + 4); + m_pScanline = FX_Alloc(uint8_t, m_Pitch + 4); } while (1) { if (!CPDF_ModuleMgr::Get()->GetJpegModule()->ReadScanline(m_pContext, m_pScanline)) { @@ -803,8 +803,8 @@ FX_BOOL CPDF_FaxFilter::Initialize(int Encoding, int bEndOfLine, int bByteAlign, m_nRows = nRows; m_nColumns = nColumns; m_Pitch = (m_nColumns + 7) / 8; - m_pScanlineBuf = FX_Alloc(FX_BYTE, m_Pitch); - m_pRefBuf = FX_Alloc(FX_BYTE, m_Pitch); + m_pScanlineBuf = FX_Alloc(uint8_t, m_Pitch); + m_pRefBuf = FX_Alloc(uint8_t, m_Pitch); FXSYS_memset8(m_pScanlineBuf, 0xff, m_Pitch); FXSYS_memset8(m_pRefBuf, 0xff, m_Pitch); m_iRow = 0; @@ -839,9 +839,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 FX_BYTE* src_buf, int bitsize, int& bitpos); -FX_BOOL _FaxG4GetRow(const FX_BYTE* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, const FX_BYTE* ref_buf, int columns); -FX_BOOL _FaxGet1DLine(const FX_BYTE* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns); +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, CFX_BinaryBuf& dest_buf) { diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp index c18668d683..d636f96b68 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp @@ -295,8 +295,8 @@ CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visite case PDFOBJ_REFERENCE: { CPDF_Reference* pRef = (CPDF_Reference*)this; FX_DWORD obj_num = pRef->m_RefObjNum; - if (bDirect && !visited->GetValueAt((void*)(FX_UINTPTR)obj_num)) { - visited->SetAt((void*)(FX_UINTPTR)obj_num, (void*)1); + if (bDirect && !visited->GetValueAt((void*)(uintptr_t)obj_num)) { + visited->SetAt((void*)(uintptr_t)obj_num, (void*)1); CPDF_Object* ret; if (pRef->GetDirect()) ret = pRef->GetDirect()->CloneInternal(TRUE, visited); @@ -896,7 +896,7 @@ void CPDF_Stream::InitStream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pD { InitStream(pDict); m_GenNum = (FX_DWORD) - 1; - m_pDataBuf = FX_Alloc(FX_BYTE, size); + m_pDataBuf = FX_Alloc(uint8_t, size); if (pData) { FXSYS_memcpy32(m_pDataBuf, pData, size); } @@ -918,7 +918,7 @@ void CPDF_Stream::SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed, if (bKeepBuf) { m_pDataBuf = (FX_LPBYTE)pData; } else { - m_pDataBuf = FX_Alloc(FX_BYTE, size); + m_pDataBuf = FX_Alloc(uint8_t, size); if (pData) { FXSYS_memcpy32(m_pDataBuf, pData, size); } @@ -970,8 +970,8 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const if (!m_pFile || !pOther->m_pFile) { return FALSE; } - FX_BYTE srcBuf[1024]; - FX_BYTE destBuf[1024]; + uint8_t srcBuf[1024]; + uint8_t destBuf[1024]; FX_DWORD size = m_dwSize; FX_DWORD srcOffset = m_FileOffset; FX_DWORD destOffset = pOther->m_FileOffset; @@ -1008,7 +1008,7 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const if (NULL == pBuf) { return FALSE; } - FX_BYTE srcBuf[1024]; + uint8_t srcBuf[1024]; FX_DWORD size = m_dwSize; while (size > 0) { FX_DWORD actualSize = size > 1024 ? 1024 : size; @@ -1040,7 +1040,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(FX_BYTE, 4096); + FX_LPBYTE pBuf = FX_Alloc(uint8_t, 4096); FX_DWORD dwRead; do { dwRead = pSF->ReadBlock(pBuf, 4096); @@ -1086,7 +1086,7 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, FX_BOOL bRawAccess, return; } if (!pStream->IsMemoryBased()) { - pSrcData = m_pSrcData = FX_Alloc(FX_BYTE, dwSrcSize); + pSrcData = m_pSrcData = FX_Alloc(uint8_t, dwSrcSize); if (!pStream->ReadRawData(0, pSrcData, dwSrcSize)) { return; } @@ -1165,7 +1165,7 @@ FX_LPBYTE CPDF_StreamAcc::DetachData() m_dwSize = 0; return p; } - FX_LPBYTE p = FX_Alloc(FX_BYTE, m_dwSize); + FX_LPBYTE p = FX_Alloc(uint8_t, m_dwSize); FXSYS_memcpy32(p, m_pData, m_dwSize); return p; } @@ -1200,7 +1200,7 @@ CPDF_Object* CPDF_IndirectObjects::GetIndirectObject(FX_DWORD objnum, struct PAR } FX_LPVOID value; { - if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) { + if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { if (((CPDF_Object*)value)->GetObjNum() == -1) { return NULL; } @@ -1218,25 +1218,25 @@ CPDF_Object* CPDF_IndirectObjects::GetIndirectObject(FX_DWORD objnum, struct PAR if (m_LastObjNum < objnum) { m_LastObjNum = objnum; } - if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) { + if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { if (value) { ((CPDF_Object *)value)->Destroy(); } } - m_IndirectObjs.SetAt((FX_LPVOID)(FX_UINTPTR)objnum, pObj); + m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)objnum, pObj); return pObj; } int CPDF_IndirectObjects::GetIndirectType(FX_DWORD objnum) { FX_LPVOID value; - if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) { + if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { return ((CPDF_Object*)value)->GetType(); } if (m_pParser) { PARSE_CONTEXT context; FXSYS_memset32(&context, 0, sizeof(PARSE_CONTEXT)); context.m_Flags = PDFPARSE_TYPEONLY; - return (int)(FX_UINTPTR)m_pParser->ParseIndirectObject(this, objnum, &context); + return (int)(uintptr_t)m_pParser->ParseIndirectObject(this, objnum, &context); } return 0; } @@ -1246,21 +1246,21 @@ FX_DWORD CPDF_IndirectObjects::AddIndirectObject(CPDF_Object* pObj) return pObj->m_ObjNum; } m_LastObjNum ++; - m_IndirectObjs.SetAt((FX_LPVOID)(FX_UINTPTR)m_LastObjNum, pObj); + m_IndirectObjs.SetAt((FX_LPVOID)(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)(FX_UINTPTR)objnum, value)) { + if (!m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { return; } if (((CPDF_Object*)value)->GetObjNum() == -1) { return; } ((CPDF_Object*)value)->Destroy(); - m_IndirectObjs.RemoveKey((FX_LPVOID)(FX_UINTPTR)objnum); + m_IndirectObjs.RemoveKey((FX_LPVOID)(uintptr_t)objnum); } void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pObj) { @@ -1268,7 +1268,7 @@ void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pO return; } FX_LPVOID value = NULL; - if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) { + if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { if (value) { if (pObj->GetGenNum() <= ((CPDF_Object*)value)->GetGenNum()) @@ -1278,7 +1278,7 @@ void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pO } } pObj->m_ObjNum = objnum; - m_IndirectObjs.SetAt((FX_LPVOID)(FX_UINTPTR)objnum, pObj); + m_IndirectObjs.SetAt((FX_LPVOID)(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 9c35615a72..4afc3a668b 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -27,7 +27,7 @@ FX_BOOL IsSignatureDict(const CPDF_Dictionary* pDict) } return FALSE; } -static FX_INT32 _CompareDWord(const void* p1, const void* p2) +static int32_t _CompareDWord(const void* p1, const void* p2) { return (*(FX_DWORD*)p1) - (*(FX_DWORD*)p2); } @@ -98,8 +98,8 @@ void CPDF_Parser::CloseParser(FX_BOOL bReParse) m_CrossRef.RemoveAll(); m_V5Type.RemoveAll(); m_ObjVersion.RemoveAll(); - FX_INT32 iLen = m_Trailers.GetSize(); - for (FX_INT32 i = 0; i < iLen; ++i) { + int32_t iLen = m_Trailers.GetSize(); + for (int32_t i = 0; i < iLen; ++i) { if (CPDF_Dictionary* trailer = m_Trailers.GetAt(i)) trailer->Release(); } @@ -109,11 +109,11 @@ void CPDF_Parser::CloseParser(FX_BOOL bReParse) m_pLinearized = NULL; } } -static FX_INT32 GetHeaderOffset(IFX_FileRead* pFile) +static int32_t GetHeaderOffset(IFX_FileRead* pFile) { FX_DWORD tag = FXDWORD_FROM_LSBFIRST(0x46445025); - FX_BYTE buf[4]; - FX_INT32 offset = 0; + uint8_t buf[4]; + int32_t offset = 0; while (1) { if (!pFile->ReadBlock(buf, offset, 4)) { return -1; @@ -152,7 +152,7 @@ FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse, FX m_bXRefStream = FALSE; m_LastXRefOffset = 0; m_bOwnFileRead = bOwnFileRead; - FX_INT32 offset = GetHeaderOffset(pFileAccess); + int32_t offset = GetHeaderOffset(pFileAccess); if (offset == -1) { if (bOwnFileRead && pFileAccess) { pFileAccess->Release(); @@ -160,7 +160,7 @@ FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse, FX return PDFPARSE_ERROR_FORMAT; } m_Syntax.InitParser(pFileAccess, offset); - FX_BYTE ch; + uint8_t ch; if (!m_Syntax.GetCharAt(5, ch)) { return PDFPARSE_ERROR_FORMAT; } @@ -331,11 +331,11 @@ FX_FILESIZE CPDF_Parser::GetObjectOffset(FX_DWORD objnum) return m_CrossRef[objnum]; } if (m_V5Type[objnum] == 2) { - return m_CrossRef[(FX_INT32)m_CrossRef[objnum]]; + return m_CrossRef[(int32_t)m_CrossRef[objnum]]; } return 0; } -static FX_INT32 GetDirectInteger(CPDF_Dictionary* pDict, FX_BSTR key) +static int32_t GetDirectInteger(CPDF_Dictionary* pDict, FX_BSTR key) { CPDF_Object* pObj = pDict->GetElement(key); if (pObj == NULL) { @@ -346,7 +346,7 @@ static FX_INT32 GetDirectInteger(CPDF_Dictionary* pDict, FX_BSTR key) } return 0; } -static FX_BOOL CheckDirectType(CPDF_Dictionary* pDict, FX_BSTR key, FX_INT32 iType) +static FX_BOOL CheckDirectType(CPDF_Dictionary* pDict, FX_BSTR key, int32_t iType) { CPDF_Object* pObj = pDict->GetElement(key); if (!pObj) { @@ -363,7 +363,7 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) if (m_pTrailer == NULL) { return FALSE; } - FX_INT32 xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); + int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); if (xrefsize <= 0 || xrefsize > (1 << 20)) { return FALSE; } @@ -400,7 +400,7 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) XRefStreamList.InsertAt(0, pDict->GetInteger(FX_BSTRC("XRefStm"))); m_Trailers.Add(pDict); } - for (FX_INT32 i = 0; i < CrossRefList.GetSize(); i ++) + for (int32_t i = 0; i < CrossRefList.GetSize(); i ++) if (!LoadCrossRefV4(CrossRefList[i], XRefStreamList[i], FALSE, i == 0)) { return FALSE; } @@ -415,7 +415,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos, FX_DWORD d if (m_pTrailer == NULL) { return FALSE; } - FX_INT32 xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); + int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); if (xrefsize == 0) { return FALSE; } @@ -434,7 +434,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos, FX_DWORD d XRefStreamList.InsertAt(0, pDict->GetInteger(FX_BSTRC("XRefStm"))); m_Trailers.Add(pDict); } - for (FX_INT32 i = 1; i < CrossRefList.GetSize(); i ++) + for (int32_t i = 1; i < CrossRefList.GetSize(); i ++) if (!LoadCrossRefV4(CrossRefList[i], XRefStreamList[i], FALSE, i == 0)) { return FALSE; } @@ -451,12 +451,12 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou FX_DWORD start_objnum = 0; FX_DWORD count = dwObjCount; FX_FILESIZE SavedPos = m_Syntax.SavePos(); - FX_INT32 recordsize = 20; + int32_t recordsize = 20; char* pBuf = FX_Alloc(char, 1024 * recordsize + 1); pBuf[1024 * recordsize] = '\0'; - FX_INT32 nBlocks = count / 1024 + 1; - for (FX_INT32 block = 0; block < nBlocks; block ++) { - FX_INT32 block_size = block == nBlocks - 1 ? count % 1024 : 1024; + int32_t nBlocks = count / 1024 + 1; + for (int32_t block = 0; block < nBlocks; block ++) { + int32_t block_size = block == nBlocks - 1 ? count % 1024 : 1024; FX_DWORD dwReadSize = block_size * recordsize; if ((FX_FILESIZE)(dwStartPos + dwReadSize) > m_Syntax.m_FileLen) { FX_Free(pBuf); @@ -466,16 +466,16 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou FX_Free(pBuf); return FALSE; } - for (FX_INT32 i = 0; i < block_size; i ++) { + for (int32_t i = 0; i < block_size; i ++) { FX_DWORD objnum = start_objnum + block * 1024 + i; char* pEntry = pBuf + i * recordsize; if (pEntry[17] == 'f') { m_CrossRef.SetAtGrow(objnum, 0); m_V5Type.SetAtGrow(objnum, 0); } else { - FX_INT32 offset = FXSYS_atoi(pEntry); + int32_t offset = FXSYS_atoi(pEntry); if (offset == 0) { - for (FX_INT32 c = 0; c < 10; c ++) { + for (int32_t c = 0; c < 10; c ++) { if (pEntry[c] < '0' || pEntry[c] > '9') { FX_Free(pBuf); return FALSE; @@ -483,7 +483,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou } } m_CrossRef.SetAtGrow(objnum, offset); - FX_INT32 version = FXSYS_atoi(pEntry + 11); + int32_t version = FXSYS_atoi(pEntry + 11); if (version >= 1) { m_bVersionUpdated = TRUE; } @@ -537,7 +537,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B m_Syntax.ToNextWord(); SavedPos = m_Syntax.SavePos(); FX_BOOL bFirstItem = FALSE; - FX_INT32 recordsize = 20; + int32_t recordsize = 20; if (bFirst) { bFirstItem = TRUE; } @@ -545,12 +545,12 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B if (!bSkip) { char* pBuf = FX_Alloc(char, 1024 * recordsize + 1); pBuf[1024 * recordsize] = '\0'; - FX_INT32 nBlocks = count / 1024 + 1; + int32_t nBlocks = count / 1024 + 1; FX_BOOL bFirstBlock = TRUE; - for (FX_INT32 block = 0; block < nBlocks; block ++) { - FX_INT32 block_size = block == nBlocks - 1 ? count % 1024 : 1024; + 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); - for (FX_INT32 i = 0; i < block_size; i ++) { + for (int32_t i = 0; i < block_size; i ++) { FX_DWORD objnum = start_objnum + block * 1024 + i; char* pEntry = pBuf + i * recordsize; if (pEntry[17] == 'f') { @@ -560,7 +560,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B } if (bFirstBlock) { FX_FILESIZE offset = (FX_FILESIZE)FXSYS_atoi64(pEntry); - FX_INT32 version = FXSYS_atoi(pEntry + 11); + int32_t version = FXSYS_atoi(pEntry + 11); if (offset == 0 && version == 65535 && start_objnum != 0) { start_objnum--; objnum = 0; @@ -571,7 +571,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B } else { FX_FILESIZE offset = (FX_FILESIZE)FXSYS_atoi64(pEntry); if (offset == 0) { - for (FX_INT32 c = 0; c < 10; c ++) { + for (int32_t c = 0; c < 10; c ++) { if (pEntry[c] < '0' || pEntry[c] > '9') { FX_Free(pBuf); return FALSE; @@ -579,7 +579,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B } } m_CrossRef.SetAtGrow(objnum, offset); - FX_INT32 version = FXSYS_atoi(pEntry + 11); + int32_t version = FXSYS_atoi(pEntry + 11); if (version >= 1) { m_bVersionUpdated = TRUE; } @@ -630,11 +630,11 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() m_pTrailer->Release(); m_pTrailer = NULL; } - FX_INT32 status = 0; - FX_INT32 inside_index = 0; + int32_t status = 0; + int32_t inside_index = 0; FX_DWORD objnum = 0, gennum = 0; - FX_INT32 depth = 0; - FX_LPBYTE buffer = FX_Alloc(FX_BYTE, 4096); + int32_t depth = 0; + FX_LPBYTE 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; @@ -648,7 +648,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() break; } for (FX_DWORD i = 0; i < size; i ++) { - FX_BYTE byte = buffer[i]; + uint8_t byte = buffer[i]; switch (status) { case 0: if (PDF_CharType[byte] == 'W') { @@ -822,11 +822,11 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() } else { i += (FX_DWORD)nLen; } - if (m_CrossRef.GetSize() > (FX_INT32)objnum && m_CrossRef[objnum]) { + if (m_CrossRef.GetSize() > (int32_t)objnum && m_CrossRef[objnum]) { if (pObject) { FX_DWORD oldgen = m_ObjVersion.GetAt(objnum); m_CrossRef[objnum] = obj_pos; - m_ObjVersion.SetAt(objnum, (FX_SHORT)gennum); + m_ObjVersion.SetAt(objnum, (int16_t)gennum); if (oldgen != gennum) { m_bVersionUpdated = TRUE; } @@ -834,7 +834,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() } else { m_CrossRef.SetAtGrow(objnum, obj_pos); m_V5Type.SetAtGrow(objnum, 1); - m_ObjVersion.SetAtGrow(objnum, (FX_SHORT)gennum); + m_ObjVersion.SetAtGrow(objnum, (int16_t)gennum); } if (pObject) { pObject->Release(); @@ -990,10 +990,10 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() FX_Free(buffer); return TRUE; } -static FX_DWORD _GetVarInt(FX_LPCBYTE p, FX_INT32 n) +static FX_DWORD _GetVarInt(FX_LPCBYTE p, int32_t n) { FX_DWORD result = 0; - for (FX_INT32 i = 0; i < n; i ++) { + for (int32_t i = 0; i < n; i ++) { result = result * 256 + p[i]; } return result; @@ -1019,7 +1019,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL return FALSE; } prev = pStream->GetDict()->GetInteger(FX_BSTRC("Prev")); - FX_INT32 size = pStream->GetDict()->GetInteger(FX_BSTRC("Size")); + int32_t size = pStream->GetDict()->GetInteger(FX_BSTRC("Size")); if (size < 0) { pStream->Release(); return FALSE; @@ -1033,7 +1033,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL } else { m_Trailers.Add((CPDF_Dictionary*)pStream->GetDict()->Clone()); } - std::vector<std::pair<FX_INT32, FX_INT32> > arrIndex; + std::vector<std::pair<int32_t, int32_t> > arrIndex; CPDF_Array* pArray = pStream->GetDict()->GetArray(FX_BSTRC("Index")); if (pArray) { FX_DWORD nPairSize = pArray->GetCount() / 2; @@ -1075,12 +1075,12 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL FX_DWORD dwTotalSize = acc.GetSize(); FX_DWORD segindex = 0; for (FX_DWORD i = 0; i < arrIndex.size(); i ++) { - FX_INT32 startnum = arrIndex[i].first; + int32_t startnum = arrIndex[i].first; if (startnum < 0) { continue; } - m_dwXrefStartObjNum = pdfium::base::checked_cast<FX_DWORD, FX_INT32> (startnum); - FX_DWORD count = pdfium::base::checked_cast<FX_DWORD, FX_INT32> (arrIndex[i].second); + m_dwXrefStartObjNum = pdfium::base::checked_cast<FX_DWORD, int32_t> (startnum); + FX_DWORD count = pdfium::base::checked_cast<FX_DWORD, int32_t> (arrIndex[i].second); FX_SAFE_DWORD dwCaculatedSize = segindex; dwCaculatedSize += count; dwCaculatedSize *= totalWidth; @@ -1090,12 +1090,12 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL FX_LPCBYTE segstart = pData + segindex * totalWidth; FX_SAFE_DWORD dwMaxObjNum = startnum; dwMaxObjNum += count; - FX_DWORD dwV5Size = pdfium::base::checked_cast<FX_DWORD, FX_INT32> (m_V5Type.GetSize()); + FX_DWORD dwV5Size = pdfium::base::checked_cast<FX_DWORD, int32_t> (m_V5Type.GetSize()); if (!dwMaxObjNum.IsValid() || dwMaxObjNum.ValueOrDie() > dwV5Size) { continue; } for (FX_DWORD j = 0; j < count; j ++) { - FX_INT32 type = 1; + int32_t type = 1; FX_LPCBYTE entrystart = segstart + j * totalWidth; if (WidthArray[0]) { type = _GetVarInt(entrystart, WidthArray[0]); @@ -1212,8 +1212,8 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX if (pObjStream == NULL) { return NULL; } - FX_INT32 n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N")); - FX_INT32 offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First")); + 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)); syntax.InitParser(file.Get(), 0); @@ -1235,7 +1235,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) { CPDF_StreamAcc* pStreamAcc = NULL; - if (m_ObjectStreamMap.Lookup((void*)(FX_UINTPTR)objnum, (void*&)pStreamAcc)) { + if (m_ObjectStreamMap.Lookup((void*)(uintptr_t)objnum, (void*&)pStreamAcc)) { return pStreamAcc; } const CPDF_Stream* pStream = m_pDocument ? (CPDF_Stream*)m_pDocument->GetIndirectObject(objnum) : NULL; @@ -1244,7 +1244,7 @@ CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) } pStreamAcc = new CPDF_StreamAcc; pStreamAcc->LoadAllData(pStream); - m_ObjectStreamMap.SetAt((void*)(FX_UINTPTR)objnum, pStreamAcc); + m_ObjectStreamMap.SetAt((void*)(uintptr_t)objnum, pStreamAcc); return pStreamAcc; } FX_FILESIZE CPDF_Parser::GetObjectSize(FX_DWORD objnum) @@ -1283,8 +1283,8 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR if (pObjStream == NULL) { return; } - FX_INT32 n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N")); - FX_INT32 offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First")); + 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(); FX_DWORD totalsize = pObjStream->GetSize(); @@ -1301,7 +1301,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR FX_DWORD nextoff = syntax.GetDirectNum(); size = nextoff - thisoff; } - pBuffer = FX_Alloc(FX_BYTE, size); + pBuffer = FX_Alloc(uint8_t, size); FXSYS_memcpy32(pBuffer, pData + thisoff + offset, size); return; } @@ -1368,7 +1368,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR nextoff = m_Syntax.SavePos(); } size = (FX_DWORD)(nextoff - pos); - pBuffer = FX_Alloc(FX_BYTE, size); + pBuffer = FX_Alloc(uint8_t, size); m_Syntax.RestorePos(pos); m_Syntax.ReadBlock(pBuffer, size); m_Syntax.RestorePos(SavedPos); @@ -1553,7 +1553,7 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse m_bXRefStream = FALSE; m_LastXRefOffset = 0; m_bOwnFileRead = bOwnFileRead; - FX_INT32 offset = GetHeaderOffset(pFileAccess); + int32_t offset = GetHeaderOffset(pFileAccess); if (offset == -1) { return PDFPARSE_ERROR_FORMAT; } @@ -1579,7 +1579,7 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse if (m_pTrailer == NULL) { return FALSE; } - FX_INT32 xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); + int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); if (xrefsize > 0) { m_CrossRef.SetSize(xrefsize); m_V5Type.SetSize(xrefsize); @@ -1651,10 +1651,10 @@ FX_DWORD CPDF_Parser::LoadLinearizedMainXRefTable() m_pTrailer = NULL; } m_Syntax.RestorePos(m_LastXRefOffset - m_Syntax.m_HeaderOffset); - FX_BYTE ch = 0; + uint8_t ch = 0; FX_DWORD dwCount = 0; m_Syntax.GetNextChar(ch); - FX_INT32 type = PDF_CharType[ch]; + int32_t type = PDF_CharType[ch]; while (type == 'W') { ++dwCount; if (m_Syntax.m_FileLen >= (FX_FILESIZE)(m_Syntax.SavePos() + m_Syntax.m_HeaderOffset)) { @@ -1702,7 +1702,7 @@ CPDF_SyntaxParser::~CPDF_SyntaxParser() FX_Free(m_pFileBuf); } } -FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, FX_BYTE& ch) +FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, uint8_t& ch) { FX_FILESIZE save_pos = m_Pos; m_Pos = pos; @@ -1710,7 +1710,7 @@ FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, FX_BYTE& ch) m_Pos = save_pos; return ret; } -FX_BOOL CPDF_SyntaxParser::GetNextChar(FX_BYTE& ch) +FX_BOOL CPDF_SyntaxParser::GetNextChar(uint8_t& ch) { FX_FILESIZE pos = m_Pos + m_HeaderOffset; if (pos >= m_FileLen) { @@ -1739,7 +1739,7 @@ FX_BOOL CPDF_SyntaxParser::GetNextChar(FX_BYTE& ch) m_Pos ++; return TRUE; } -FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, FX_BYTE& ch) +FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch) { pos += m_HeaderOffset; if (pos >= m_FileLen) { @@ -1782,11 +1782,11 @@ void CPDF_SyntaxParser::GetNextWord() { m_WordSize = 0; m_bIsNumber = TRUE; - FX_BYTE ch; + uint8_t ch; if (!GetNextChar(ch)) { return; } - FX_BYTE type = PDF_CharType[ch]; + uint8_t type = PDF_CharType[ch]; while (1) { while (type == 'W') { if (!GetNextChar(ch)) { @@ -1864,13 +1864,13 @@ void CPDF_SyntaxParser::GetNextWord() } CFX_ByteString CPDF_SyntaxParser::ReadString() { - FX_BYTE ch; + uint8_t ch; if (!GetNextChar(ch)) { return CFX_ByteString(); } CFX_ByteTextBuf buf; - FX_INT32 parlevel = 0; - FX_INT32 status = 0, iEscCode = 0; + int32_t parlevel = 0; + int32_t status = 0, iEscCode = 0; while (1) { switch (status) { case 0: @@ -1951,13 +1951,13 @@ CFX_ByteString CPDF_SyntaxParser::ReadString() } CFX_ByteString CPDF_SyntaxParser::ReadHexString() { - FX_BYTE ch; + uint8_t ch; if (!GetNextChar(ch)) { return CFX_ByteString(); } CFX_BinaryBuf buf; FX_BOOL bFirst = TRUE; - FX_BYTE code = 0; + uint8_t code = 0; while (1) { if (ch == '>') { break; @@ -1967,7 +1967,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() code = (ch - '0') * 16; } else { code += ch - '0'; - buf.AppendByte((FX_BYTE)code); + buf.AppendByte((uint8_t)code); } bFirst = !bFirst; } else if (ch >= 'A' && ch <= 'F') { @@ -1975,7 +1975,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() code = (ch - 'A' + 10) * 16; } else { code += ch - 'A' + 10; - buf.AppendByte((FX_BYTE)code); + buf.AppendByte((uint8_t)code); } bFirst = !bFirst; } else if (ch >= 'a' && ch <= 'f') { @@ -1983,7 +1983,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() code = (ch - 'a' + 10) * 16; } else { code += ch - 'a' + 10; - buf.AppendByte((FX_BYTE)code); + buf.AppendByte((uint8_t)code); } bFirst = !bFirst; } @@ -1992,13 +1992,13 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() } } if (!bFirst) { - buf.AppendByte((FX_BYTE)code); + buf.AppendByte((uint8_t)code); } return buf.GetByteString(); } void CPDF_SyntaxParser::ToNextLine() { - FX_BYTE ch; + uint8_t ch; while (1) { if (!GetNextChar(ch)) { return; @@ -2019,11 +2019,11 @@ void CPDF_SyntaxParser::ToNextLine() } void CPDF_SyntaxParser::ToNextWord() { - FX_BYTE ch; + uint8_t ch; if (!GetNextChar(ch)) { return; } - FX_BYTE type = PDF_CharType[ch]; + uint8_t type = PDF_CharType[ch]; while (1) { while (type == 'W') { m_dwWordPos = m_Pos; @@ -2168,7 +2168,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWO pContext->m_DictStart = SavedPos; } CPDF_Dictionary* pDict = CPDF_Dictionary::Create(); - FX_INT32 nKeys = 0; + int32_t nKeys = 0; FX_FILESIZE dwSignValuePos = 0; while (1) { FX_BOOL bIsNumber; @@ -2377,7 +2377,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(CPDF_IndirectObjects* pObjList if (pDict) { pDict->Release(); } - FX_BYTE ch; + uint8_t ch; while (1) { if (!GetNextChar(ch)) { break; @@ -2461,7 +2461,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT } else { m_Pos = curPos; } - FX_BYTE byte1, byte2; + uint8_t byte1, byte2; GetCharAt(StreamStartPos + offset - 1, byte1); GetCharAt(StreamStartPos + offset - 2, byte2); if (byte1 == 0x0a && byte2 == 0x0d) { @@ -2481,7 +2481,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT m_Pos = StreamStartPos; } CPDF_Stream* pStream; - FX_LPBYTE pData = FX_Alloc(FX_BYTE, len); + FX_LPBYTE pData = FX_Alloc(uint8_t, len); ReadBlock(pData, len); if (pCryptoHandler) { CFX_BinaryBuf dest_buf; @@ -2511,7 +2511,7 @@ void CPDF_SyntaxParser::InitParser(IFX_FileRead* pFileAccess, FX_DWORD HeaderOff FX_Free(m_pFileBuf); m_pFileBuf = NULL; } - m_pFileBuf = FX_Alloc(FX_BYTE, m_BufSize); + m_pFileBuf = FX_Alloc(uint8_t, m_BufSize); m_HeaderOffset = HeaderOffset; m_FileLen = pFileAccess->GetSize(); m_Pos = 0; @@ -2519,7 +2519,7 @@ void CPDF_SyntaxParser::InitParser(IFX_FileRead* pFileAccess, FX_DWORD HeaderOff m_BufOffset = 0; pFileAccess->ReadBlock(m_pFileBuf, 0, (size_t)((FX_FILESIZE)m_BufSize > m_FileLen ? m_FileLen : m_BufSize)); } -FX_INT32 CPDF_SyntaxParser::GetDirectNum() +int32_t CPDF_SyntaxParser::GetDirectNum() { GetNextWord(); if (!m_bIsNumber) { @@ -2530,19 +2530,19 @@ FX_INT32 CPDF_SyntaxParser::GetDirectNum() } FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, FX_LPCBYTE tag, FX_DWORD taglen) { - FX_BYTE type = PDF_CharType[tag[0]]; + uint8_t type = PDF_CharType[tag[0]]; FX_BOOL bCheckLeft = type != 'D' && type != 'W'; type = PDF_CharType[tag[taglen - 1]]; FX_BOOL bCheckRight = type != 'D' && type != 'W'; - FX_BYTE ch; - if (bCheckRight && startpos + (FX_INT32)taglen <= limit && GetCharAt(startpos + (FX_INT32)taglen, ch)) { - FX_BYTE type = PDF_CharType[ch]; + uint8_t ch; + if (bCheckRight && startpos + (int32_t)taglen <= limit && GetCharAt(startpos + (int32_t)taglen, ch)) { + uint8_t type = PDF_CharType[ch]; if (type == 'N' || type == 'R') { return FALSE; } } if (bCheckLeft && startpos > 0 && GetCharAt(startpos - 1, ch)) { - FX_BYTE type = PDF_CharType[ch]; + uint8_t type = PDF_CharType[ch]; if (type == 'N' || type == 'R') { return FALSE; } @@ -2551,17 +2551,17 @@ FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, } FX_BOOL CPDF_SyntaxParser::SearchWord(FX_BSTR tag, FX_BOOL bWholeWord, FX_BOOL bForward, FX_FILESIZE limit) { - FX_INT32 taglen = tag.GetLength(); + int32_t taglen = tag.GetLength(); if (taglen == 0) { return FALSE; } FX_FILESIZE pos = m_Pos; - FX_INT32 offset = 0; + int32_t offset = 0; if (!bForward) { offset = taglen - 1; } FX_LPCBYTE tag_data = tag.GetPtr(); - FX_BYTE byte; + uint8_t byte; while (1) { if (bForward) { if (limit) { @@ -2620,9 +2620,9 @@ struct _SearchTagRecord { FX_DWORD m_Len; FX_DWORD m_Offset; }; -FX_INT32 CPDF_SyntaxParser::SearchMultiWord(FX_BSTR tags, FX_BOOL bWholeWord, FX_FILESIZE limit) +int32_t CPDF_SyntaxParser::SearchMultiWord(FX_BSTR tags, FX_BOOL bWholeWord, FX_FILESIZE limit) { - FX_INT32 ntags = 1, i; + int32_t ntags = 1, i; for (i = 0; i < tags.GetLength(); i ++) if (tags[i] == 0) { ntags ++; @@ -2643,9 +2643,9 @@ FX_INT32 CPDF_SyntaxParser::SearchMultiWord(FX_BSTR tags, FX_BOOL bWholeWord, FX } } FX_FILESIZE pos = m_Pos; - FX_BYTE byte; + uint8_t byte; GetCharAt(pos++, byte); - FX_INT32 found = -1; + int32_t found = -1; while (1) { for (i = 0; i < ntags; i ++) { if (pPatterns[i].m_pTag[pPatterns[i].m_Offset] == byte) { @@ -2684,12 +2684,12 @@ end: } FX_FILESIZE CPDF_SyntaxParser::FindTag(FX_BSTR tag, FX_FILESIZE limit) { - FX_INT32 taglen = tag.GetLength(); - FX_INT32 match = 0; + int32_t taglen = tag.GetLength(); + int32_t match = 0; limit += m_Pos; FX_FILESIZE startpos = m_Pos; while (1) { - FX_BYTE ch; + uint8_t ch; if (!GetNextChar(ch)) { return -1; } @@ -2707,10 +2707,10 @@ FX_FILESIZE CPDF_SyntaxParser::FindTag(FX_BSTR tag, FX_FILESIZE limit) } return -1; } -void CPDF_SyntaxParser::GetBinary(FX_BYTE* buffer, FX_DWORD size) +void CPDF_SyntaxParser::GetBinary(uint8_t* buffer, FX_DWORD size) { FX_DWORD offset = 0; - FX_BYTE ch; + uint8_t ch; while (1) { if (!GetNextChar(ch)) { return; @@ -2734,9 +2734,9 @@ public: virtual FX_BOOL IsPageAvail(int iPage, IFX_DownloadHints* pHints) override; - virtual FX_INT32 IsFormAvail(IFX_DownloadHints *pHints) override; + virtual int32_t IsFormAvail(IFX_DownloadHints *pHints) override; - virtual FX_INT32 IsLinearizedPDF() override; + virtual int32_t IsLinearizedPDF() override; virtual FX_BOOL IsLinearized() override { @@ -2770,11 +2770,11 @@ protected: FX_BOOL CheckPageStatus(IFX_DownloadHints* pHints); FX_BOOL CheckAllCrossRefStream(IFX_DownloadHints *pHints); - FX_INT32 CheckCrossRefStream(IFX_DownloadHints *pHints, FX_FILESIZE &xref_offset); + int32_t CheckCrossRefStream(IFX_DownloadHints *pHints, FX_FILESIZE &xref_offset); FX_BOOL IsLinearizedFile(FX_LPBYTE pData, FX_DWORD dwLen); void SetStartOffset(FX_FILESIZE dwOffset); FX_BOOL GetNextToken(CFX_ByteString &token); - FX_BOOL GetNextChar(FX_BYTE &ch); + FX_BOOL GetNextChar(uint8_t &ch); CPDF_Object * ParseIndirectObjectAt(FX_FILESIZE pos, FX_DWORD objnum); CPDF_Object * GetObject(FX_DWORD objnum, IFX_DownloadHints* pHints, FX_BOOL *pExistInFile); FX_BOOL GetPageKids(CPDF_Parser *pParser, CPDF_Object *pPages); @@ -2788,10 +2788,10 @@ protected: FX_BOOL CheckLinearizedFirstPage(int iPage, IFX_DownloadHints* pHints); FX_BOOL HaveResourceAncestor(CPDF_Dictionary *pDict); - FX_BOOL CheckPage(FX_INT32 iPage, IFX_DownloadHints* pHints); + FX_BOOL CheckPage(int32_t iPage, IFX_DownloadHints* pHints); FX_BOOL LoadDocPages(IFX_DownloadHints* pHints); - FX_BOOL LoadDocPage(FX_INT32 iPage, IFX_DownloadHints* pHints); - FX_BOOL CheckPageNode(CPDF_PageNode &pageNodes, FX_INT32 iPage, FX_INT32 &iCount, IFX_DownloadHints* pHints); + FX_BOOL LoadDocPage(int32_t iPage, IFX_DownloadHints* pHints); + FX_BOOL CheckPageNode(CPDF_PageNode &pageNodes, int32_t iPage, int32_t &iCount, IFX_DownloadHints* pHints); FX_BOOL CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints); FX_BOOL CheckArrayPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints); FX_BOOL CheckPageCount(IFX_DownloadHints* pHints); @@ -2842,11 +2842,11 @@ protected: CFX_ByteString m_WordBuf; - FX_BYTE m_WordBuffer[257]; + uint8_t m_WordBuffer[257]; FX_DWORD m_WordSize; - FX_BYTE m_bufferData[512]; + uint8_t m_bufferData[512]; CFX_FileSizeArray m_CrossOffset; @@ -2994,8 +2994,8 @@ CPDF_DataAvail::~CPDF_DataAvail() if (m_pagesLoadState) { delete m_pagesLoadState; } - FX_INT32 i = 0; - FX_INT32 iSize = m_arrayAcroforms.GetSize(); + int32_t i = 0; + int32_t iSize = m_arrayAcroforms.GetSize(); for (i = 0; i < iSize; ++i) { ((CPDF_Object *)m_arrayAcroforms.GetAt(i))->Release(); } @@ -3039,13 +3039,13 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(CFX_PtrArray& obj_array, FX_BOOL bParsePa } FX_DWORD count = 0; CFX_PtrArray new_obj_array; - FX_INT32 i = 0; + int32_t i = 0; for (i = 0; i < obj_array.GetSize(); i++) { CPDF_Object *pObj = (CPDF_Object *)obj_array[i]; if (!pObj) { continue; } - FX_INT32 type = pObj->GetType(); + int32_t type = pObj->GetType(); switch (type) { case PDFOBJ_ARRAY: { CPDF_Array *pArray = pObj->GetArray(); @@ -3111,10 +3111,10 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(CFX_PtrArray& obj_array, FX_BOOL bParsePa } } if (count > 0) { - FX_INT32 iSize = new_obj_array.GetSize(); + int32_t iSize = new_obj_array.GetSize(); for (i = 0; i < iSize; ++i) { CPDF_Object *pObj = (CPDF_Object *)new_obj_array[i]; - FX_INT32 type = pObj->GetType(); + int32_t type = pObj->GetType(); if (type == PDFOBJ_REFERENCE) { CPDF_Reference *pRef = (CPDF_Reference *)pObj; FX_DWORD dwNum = pRef->GetRefObjNum(); @@ -3162,8 +3162,8 @@ FX_BOOL CPDF_DataAvail::CheckAcroFormSubObject(IFX_DownloadHints* pHints) CFX_PtrArray new_objs_array; FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array); if (bRet) { - FX_INT32 iSize = m_arrayAcroforms.GetSize(); - for (FX_INT32 i = 0; i < iSize; ++i) { + int32_t iSize = m_arrayAcroforms.GetSize(); + for (int32_t i = 0; i < iSize; ++i) { ((CPDF_Object *)m_arrayAcroforms.GetAt(i))->Release(); } m_arrayAcroforms.RemoveAll(); @@ -3475,9 +3475,9 @@ FX_BOOL CPDF_DataAvail::CheckPage(IFX_DownloadHints* pHints) if (pObj->GetType() == PDFOBJ_ARRAY) { CPDF_Array *pArray = pObj->GetArray(); if (pArray) { - FX_INT32 iSize = pArray->GetCount(); + int32_t iSize = pArray->GetCount(); CPDF_Object *pItem = NULL; - for (FX_INT32 j = 0; j < iSize; ++j) { + for (int32_t j = 0; j < iSize; ++j) { pItem = pArray->GetElement(j); if (pItem && pItem->GetType() == PDFOBJ_REFERENCE) { UnavailObjList.Add(((CPDF_Reference *)pItem)->GetRefObjNum()); @@ -3589,7 +3589,7 @@ FX_BOOL CPDF_DataAvail::CheckHeader(IFX_DownloadHints* pHints) req_size = (FX_DWORD)m_dwFileLen; } if (m_pFileAvail->IsDataAvail(0, req_size)) { - FX_BYTE buffer[1024]; + uint8_t buffer[1024]; m_pFileRead->ReadBlock(buffer, 0, req_size); if (IsLinearizedFile(buffer, req_size)) { m_docStatus = PDF_DATAAVAIL_FIRSTPAGE; @@ -3629,8 +3629,8 @@ FX_BOOL CPDF_DataAvail::CheckFirstPage(IFX_DownloadHints *pHints) if ((FX_FILESIZE)dwEnd > m_dwFileLen) { dwEnd = (FX_DWORD)m_dwFileLen; } - FX_INT32 iStartPos = (FX_INT32)(m_dwFileLen > 1024 ? 1024 : m_dwFileLen); - FX_INT32 iSize = dwEnd > 1024 ? dwEnd - 1024 : 0; + int32_t iStartPos = (int32_t)(m_dwFileLen > 1024 ? 1024 : m_dwFileLen); + int32_t iSize = dwEnd > 1024 ? dwEnd - 1024 : 0; if (!m_pFileAvail->IsDataAvail(iStartPos, iSize)) { pHints->AddSegment(iStartPos, iSize); bNeedDownLoad = TRUE; @@ -3690,7 +3690,7 @@ CPDF_Object * CPDF_DataAvail::ParseIndirectObjectAt(FX_FILESIZE pos, FX_DWORD ob m_syntaxParser.RestorePos(SavedPos); return pObj; } -FX_INT32 CPDF_DataAvail::IsLinearizedPDF() +int32_t CPDF_DataAvail::IsLinearizedPDF() { FX_DWORD req_size = 1024; if (!m_pFileAvail->IsDataAvail(0, req_size)) { @@ -3703,7 +3703,7 @@ FX_INT32 CPDF_DataAvail::IsLinearizedPDF() if (dwSize < (FX_FILESIZE)req_size) { return PDF_UNKNOW_LINEARIZED; } - FX_BYTE buffer[1024]; + uint8_t buffer[1024]; m_pFileRead->ReadBlock(buffer, 0, req_size); if (IsLinearizedFile(buffer, req_size)) { return PDF_IS_LINEARIZED; @@ -3713,7 +3713,7 @@ FX_INT32 CPDF_DataAvail::IsLinearizedPDF() FX_BOOL CPDF_DataAvail::IsLinearizedFile(FX_LPBYTE pData, FX_DWORD dwLen) { CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pData, (size_t)dwLen, FALSE)); - FX_INT32 offset = GetHeaderOffset(file.Get()); + int32_t offset = GetHeaderOffset(file.Get()); if (offset == -1) { m_docStatus = PDF_DATAAVAIL_ERROR; return FALSE; @@ -3757,7 +3757,7 @@ FX_BOOL CPDF_DataAvail::CheckEnd(IFX_DownloadHints* pHints) FX_DWORD req_pos = (FX_DWORD)(m_dwFileLen > 1024 ? m_dwFileLen - 1024 : 0); FX_DWORD dwSize = (FX_DWORD)(m_dwFileLen - req_pos); if (m_pFileAvail->IsDataAvail(req_pos, dwSize)) { - FX_BYTE buffer[1024]; + uint8_t buffer[1024]; m_pFileRead->ReadBlock(buffer, req_pos, dwSize); CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(buffer, (size_t)dwSize, FALSE)); m_syntaxParser.InitParser(file.Get(), 0); @@ -3787,12 +3787,12 @@ FX_BOOL CPDF_DataAvail::CheckEnd(IFX_DownloadHints* pHints) pHints->AddSegment(req_pos, dwSize); return FALSE; } -FX_INT32 CPDF_DataAvail::CheckCrossRefStream(IFX_DownloadHints* pHints, FX_FILESIZE &xref_offset) +int32_t CPDF_DataAvail::CheckCrossRefStream(IFX_DownloadHints* pHints, FX_FILESIZE &xref_offset) { xref_offset = 0; FX_DWORD req_size = (FX_DWORD)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); if (m_pFileAvail->IsDataAvail(m_Pos, req_size)) { - FX_INT32 iSize = (FX_INT32)(m_Pos + req_size - m_dwCurrentXRefSteam); + int32_t iSize = (int32_t)(m_Pos + req_size - m_dwCurrentXRefSteam); CFX_BinaryBuf buf(iSize); FX_LPBYTE pBuf = buf.GetBuffer(); m_pFileRead->ReadBlock(pBuf, m_dwCurrentXRefSteam, iSize); @@ -3836,11 +3836,11 @@ inline void CPDF_DataAvail::SetStartOffset(FX_FILESIZE dwOffset) FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString &token) { m_WordSize = 0; - FX_BYTE ch; + uint8_t ch; if (!GetNextChar(ch)) { return FALSE; } - FX_BYTE type = PDF_CharType[ch]; + uint8_t type = PDF_CharType[ch]; while (1) { while (type == 'W') { if (!GetNextChar(ch)) { @@ -3919,7 +3919,7 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString &token) token = ret; return TRUE; } -FX_BOOL CPDF_DataAvail::GetNextChar(FX_BYTE &ch) +FX_BOOL CPDF_DataAvail::GetNextChar(uint8_t &ch) { FX_FILESIZE pos = m_Pos; if (pos >= m_dwFileLen) { @@ -3946,11 +3946,11 @@ FX_BOOL CPDF_DataAvail::GetNextChar(FX_BYTE &ch) } FX_BOOL CPDF_DataAvail::CheckCrossRefItem(IFX_DownloadHints *pHints) { - FX_INT32 iSize = 0; + int32_t iSize = 0; CFX_ByteString token; while (1) { if (!GetNextToken(token)) { - iSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); + iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); pHints->AddSegment(m_Pos, iSize); return FALSE; } @@ -3964,7 +3964,7 @@ FX_BOOL CPDF_DataAvail::CheckCrossRefItem(IFX_DownloadHints *pHints) FX_BOOL CPDF_DataAvail::CheckAllCrossRefStream(IFX_DownloadHints *pHints) { FX_FILESIZE xref_offset = 0; - FX_INT32 nRet = CheckCrossRefStream(pHints, xref_offset); + int32_t nRet = CheckCrossRefStream(pHints, xref_offset); if (nRet == 1) { if (!xref_offset) { m_docStatus = PDF_DATAAVAIL_LOADALLCRSOSSREF; @@ -3980,10 +3980,10 @@ FX_BOOL CPDF_DataAvail::CheckAllCrossRefStream(IFX_DownloadHints *pHints) } FX_BOOL CPDF_DataAvail::CheckCrossRef(IFX_DownloadHints* pHints) { - FX_INT32 iSize = 0; + int32_t iSize = 0; CFX_ByteString token; if (!GetNextToken(token)) { - iSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); + iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); pHints->AddSegment(m_Pos, iSize); return FALSE; } @@ -3991,7 +3991,7 @@ FX_BOOL CPDF_DataAvail::CheckCrossRef(IFX_DownloadHints* pHints) m_CrossOffset.InsertAt(0, m_dwXRefOffset); while (1) { if (!GetNextToken(token)) { - iSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); + iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); pHints->AddSegment(m_Pos, iSize); m_docStatus = PDF_DATAAVAIL_CROSSREF_ITEM; return FALSE; @@ -4012,7 +4012,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailerAppend(IFX_DownloadHints* pHints) { if (m_Pos < m_dwFileLen) { FX_FILESIZE dwAppendPos = m_Pos + m_syntaxParser.SavePos(); - FX_INT32 iSize = (FX_INT32)(dwAppendPos + 512 > m_dwFileLen ? m_dwFileLen - dwAppendPos : 512); + int32_t iSize = (int32_t)(dwAppendPos + 512 > m_dwFileLen ? m_dwFileLen - dwAppendPos : 512); if (!m_pFileAvail->IsDataAvail(dwAppendPos, iSize)) { pHints->AddSegment(dwAppendPos, iSize); return FALSE; @@ -4028,9 +4028,9 @@ FX_BOOL CPDF_DataAvail::CheckTrailerAppend(IFX_DownloadHints* pHints) } FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints) { - FX_INT32 iTrailerSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); + int32_t iTrailerSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); if (m_pFileAvail->IsDataAvail(m_Pos, iTrailerSize)) { - FX_INT32 iSize = (FX_INT32)(m_Pos + iTrailerSize - m_dwTrailerOffset); + int32_t iSize = (int32_t)(m_Pos + iTrailerSize - m_dwTrailerOffset); CFX_BinaryBuf buf(iSize); FX_LPBYTE pBuf = buf.GetBuffer(); if (!pBuf) { @@ -4086,7 +4086,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints) pHints->AddSegment(m_Pos, iTrailerSize); return FALSE; } -FX_BOOL CPDF_DataAvail::CheckPage(FX_INT32 iPage, IFX_DownloadHints* pHints) +FX_BOOL CPDF_DataAvail::CheckPage(int32_t iPage, IFX_DownloadHints* pHints) { while (TRUE) { switch (m_docStatus) { @@ -4215,14 +4215,14 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pP pPage->Release(); return TRUE; } -FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, FX_INT32 iPage, FX_INT32 &iCount, IFX_DownloadHints* pHints) +FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, int32_t iPage, int32_t &iCount, IFX_DownloadHints* pHints) { - FX_INT32 iSize = pageNodes.m_childNode.GetSize(); + int32_t iSize = pageNodes.m_childNode.GetSize(); if (iSize <= 0 || iPage >= iSize) { m_docStatus = PDF_DATAAVAIL_ERROR; return FALSE; } - for (FX_INT32 i = 0; i < iSize; ++i) { + for (int32_t i = 0; i < iSize; ++i) { CPDF_PageNode *pNode = (CPDF_PageNode*)pageNodes.m_childNode.GetAt(i); if (!pNode) { continue; @@ -4259,7 +4259,7 @@ FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, FX_INT32 iPage, } return TRUE; } -FX_BOOL CPDF_DataAvail::LoadDocPage(FX_INT32 iPage, IFX_DownloadHints* pHints) +FX_BOOL CPDF_DataAvail::LoadDocPage(int32_t iPage, IFX_DownloadHints* pHints) { if (m_pDocument->GetPageCount() <= iPage || m_pDocument->m_PageList.GetAt(iPage)) { m_docStatus = PDF_DATAAVAIL_DONE; @@ -4273,7 +4273,7 @@ FX_BOOL CPDF_DataAvail::LoadDocPage(FX_INT32 iPage, IFX_DownloadHints* pHints) m_docStatus = PDF_DATAAVAIL_ERROR; return TRUE; } - FX_INT32 iCount = -1; + int32_t iCount = -1; return CheckPageNode(m_pageNodes, iPage, iCount, pHints); } FX_BOOL CPDF_DataAvail::CheckPageCount(IFX_DownloadHints* pHints) @@ -4361,7 +4361,7 @@ FX_BOOL CPDF_DataAvail::CheckLinearizedData(IFX_DownloadHints* pHints) return m_bLinearedDataOK; } -FX_BOOL CPDF_DataAvail::CheckPageAnnots(FX_INT32 iPage, IFX_DownloadHints* pHints) +FX_BOOL CPDF_DataAvail::CheckPageAnnots(int32_t iPage, IFX_DownloadHints* pHints) { if (!m_objs_array.GetSize()) { m_objs_array.RemoveAll(); @@ -4391,7 +4391,7 @@ FX_BOOL CPDF_DataAvail::CheckPageAnnots(FX_INT32 iPage, IFX_DownloadHints* pHint return bRet; } } -FX_BOOL CPDF_DataAvail::CheckLinearizedFirstPage(FX_INT32 iPage, IFX_DownloadHints* pHints) +FX_BOOL CPDF_DataAvail::CheckLinearizedFirstPage(int32_t iPage, IFX_DownloadHints* pHints) { if (!m_bAnnotsLoad) { if (!CheckPageAnnots(iPage, pHints)) { @@ -4427,7 +4427,7 @@ FX_BOOL CPDF_DataAvail::HaveResourceAncestor(CPDF_Dictionary *pDict) } return HaveResourceAncestor(pParentDict); } -FX_BOOL CPDF_DataAvail::IsPageAvail(FX_INT32 iPage, IFX_DownloadHints* pHints) +FX_BOOL CPDF_DataAvail::IsPageAvail(int32_t iPage, IFX_DownloadHints* pHints) { if (!m_pDocument) { return FALSE; @@ -4576,7 +4576,7 @@ void CPDF_DataAvail::GetLinearizedMainXRefInfo(FX_FILESIZE *pPos, FX_DWORD *pSiz *pSize = (FX_DWORD)(m_dwFileLen - m_dwLastXRefOffset); } } -FX_INT32 CPDF_DataAvail::IsFormAvail(IFX_DownloadHints *pHints) +int32_t CPDF_DataAvail::IsFormAvail(IFX_DownloadHints *pHints) { if (!m_pDocument) { return PDFFORM_AVAIL; @@ -4609,7 +4609,7 @@ FX_INT32 CPDF_DataAvail::IsFormAvail(IFX_DownloadHints *pHints) } void CPDF_SortObjNumArray::AddObjNum(FX_DWORD dwObjNum) { - FX_INT32 iNext = 0; + int32_t iNext = 0; if (BinarySearch(dwObjNum, iNext)) { return; } @@ -4617,15 +4617,15 @@ void CPDF_SortObjNumArray::AddObjNum(FX_DWORD dwObjNum) } FX_BOOL CPDF_SortObjNumArray::Find(FX_DWORD dwObjNum) { - FX_INT32 iNext = 0; + int32_t iNext = 0; return BinarySearch(dwObjNum, iNext); } -FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, FX_INT32 &iNext) +FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, int32_t &iNext) { - FX_INT32 iLen = m_number_array.GetSize(); - FX_INT32 iLow = 0; - FX_INT32 iHigh = iLen - 1; - FX_INT32 iMid = 0; + int32_t iLen = m_number_array.GetSize(); + int32_t iLow = 0; + int32_t iHigh = iLen - 1; + int32_t iMid = 0; while (iLow <= iHigh) { iMid = (iLow + iHigh) / 2; if (m_number_array.GetAt(iMid) == value) { @@ -4642,8 +4642,8 @@ FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, FX_INT32 &iNext) } CPDF_PageNode::~CPDF_PageNode() { - FX_INT32 iSize = m_childNode.GetSize(); - for (FX_INT32 i = 0; i < iSize; ++i) { + int32_t iSize = m_childNode.GetSize(); + for (int32_t i = 0; i < iSize; ++i) { CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; if (pNode) { delete pNode; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp index df154eae90..b02139db0f 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp @@ -60,7 +60,7 @@ void CPDF_SimpleParser::ParseWord(FX_LPCBYTE& pStart, FX_DWORD& dwSize, int& typ pStart = NULL; dwSize = 0; type = PDFWORD_EOF; - FX_BYTE ch; + uint8_t ch; char chartype; while (1) { if (m_dwSize <= m_dwCurPos) { @@ -322,7 +322,7 @@ CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) int dest_len = 0; int i; for (i = 0; i < src_len; i ++) { - FX_BYTE ch = src_buf[i]; + uint8_t ch = src_buf[i]; if (ch >= 0x80 || PDF_CharType[ch] == 'W' || ch == '#' || PDF_CharType[ch] == 'D') { dest_len += 3; @@ -337,7 +337,7 @@ CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) FX_LPSTR dest_buf = res.GetBuffer(dest_len); dest_len = 0; for (i = 0; i < src_len; i ++) { - FX_BYTE ch = src_buf[i]; + uint8_t ch = src_buf[i]; if (ch >= 0x80 || PDF_CharType[ch] == 'W' || ch == '#' || PDF_CharType[ch] == 'D') { dest_buf[dest_len++] = '#'; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp index a9212522b8..a98c57d86c 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp @@ -361,10 +361,10 @@ FX_BOOL CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj, con FX_FLOAT a = FXSYS_fabs(dCTM.a); FX_FLOAT d = FXSYS_fabs(dCTM.d); if (a != 1.0f || d != 1.0f) { - rect.right = rect.left + (FX_INT32)FXSYS_ceil((FX_FLOAT)rect.Width() * a); - rect.bottom = rect.top + (FX_INT32)FXSYS_ceil((FX_FLOAT)rect.Height() * d); - rtClip.right = rtClip.left + (FX_INT32)FXSYS_ceil((FX_FLOAT)rtClip.Width() * a); - rtClip.bottom = rtClip.top + (FX_INT32)FXSYS_ceil((FX_FLOAT)rtClip.Height() * d); + rect.right = rect.left + (int32_t)FXSYS_ceil((FX_FLOAT)rect.Width() * a); + rect.bottom = rect.top + (int32_t)FXSYS_ceil((FX_FLOAT)rect.Height() * d); + rtClip.right = rtClip.left + (int32_t)FXSYS_ceil((FX_FLOAT)rtClip.Width() * a); + rtClip.bottom = rtClip.top + (int32_t)FXSYS_ceil((FX_FLOAT)rtClip.Height() * d); } } rect.Intersect(rtClip); @@ -568,7 +568,7 @@ FX_ARGB CPDF_RenderStatus::GetFillArgb(const CPDF_PageObject* pObj, FX_BOOL bTyp const CPDF_GeneralStateData* pGeneralData = pObj->m_GeneralState; int alpha; if (pGeneralData) { - alpha = (FX_INT32)(pGeneralData->m_FillAlpha * 255); + alpha = (int32_t)(pGeneralData->m_FillAlpha * 255); if (pGeneralData->m_pTR) { if (!pGeneralData->m_pTransferFunc) { ((CPDF_GeneralStateData*)pGeneralData)->m_pTransferFunc = GetTransferFunc(pGeneralData->m_pTR); @@ -597,7 +597,7 @@ FX_ARGB CPDF_RenderStatus::GetStrokeArgb(const CPDF_PageObject* pObj) const const CPDF_GeneralStateData* pGeneralData = pObj->m_GeneralState; int alpha; if (pGeneralData) { - alpha = (FX_INT32)(pGeneralData->m_StrokeAlpha * 255); + alpha = (int32_t)(pGeneralData->m_StrokeAlpha * 255); if (pGeneralData->m_pTR) { if (!pGeneralData->m_pTransferFunc) { ((CPDF_GeneralStateData*)pGeneralData)->m_pTransferFunc = GetTransferFunc(pGeneralData->m_pTR); @@ -857,7 +857,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, pTextMask = NULL; } if (Transparency & PDFTRANS_GROUP && group_alpha != 1.0f) { - bitmap->MultiplyAlpha((FX_INT32)(group_alpha * 255)); + bitmap->MultiplyAlpha((int32_t)(group_alpha * 255)); } Transparency = m_Transparency; if (pPageObj->m_Type == PDFPAGE_FORM) { @@ -1371,13 +1371,13 @@ FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, CFX_Re } m_pBitmapDevice = new CFX_FxgeDevice; FXDIB_Format dibFormat = FXDIB_Rgb; - FX_INT32 bpp = 24; + int32_t bpp = 24; if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_ALPHA_OUTPUT) { dibFormat = FXDIB_Argb; bpp = 32; } CFX_FloatRect rect; - FX_INT32 iWidth, iHeight, iPitch; + int32_t iWidth, iHeight, iPitch; while (1) { rect = *pRect; m_Matrix.TransformRect(rect); diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp index 83d5f0a4c1..d22bd4b760 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp @@ -37,13 +37,13 @@ void CPDF_PageRenderCache::ClearAll() m_nCacheSize = 0; m_nTimeCount = 0; } -void CPDF_PageRenderCache::CacheOptimization(FX_INT32 dwLimitCacheSize) +void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) { if (m_nCacheSize <= (FX_DWORD)dwLimitCacheSize) { return; } int nCount = m_ImageCaches.GetCount(); - CACHEINFO* pCACHEINFO = (CACHEINFO*)FX_Alloc2D(FX_BYTE, sizeof(CACHEINFO), nCount); + CACHEINFO* pCACHEINFO = (CACHEINFO*)FX_Alloc2D(uint8_t, sizeof(CACHEINFO), nCount); FX_POSITION pos = m_ImageCaches.GetStartPosition(); int i = 0; while (pos) { @@ -106,7 +106,7 @@ FX_DWORD CPDF_PageRenderCache::GetCachedSize(CPDF_Stream* pStream) const } void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, FX_DWORD& MatteColor, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, - FX_INT32 downsampleWidth, FX_INT32 downsampleHeight) + int32_t downsampleWidth, int32_t downsampleHeight) { CPDF_ImageCache* pImageCache; FX_BOOL bFind = m_ImageCaches.Lookup(pStream, (FX_LPVOID&)pImageCache); @@ -122,7 +122,7 @@ void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*& m_nCacheSize += pImageCache->EstimateSize(); } } -FX_BOOL CPDF_PageRenderCache::StartGetCachedBitmap(CPDF_Stream* pStream, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, FX_INT32 downsampleWidth, FX_INT32 downsampleHeight) +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); if (!m_bCurFindCache) { @@ -226,7 +226,7 @@ static FX_DWORD FPDF_ImageCache_EstimateImageSize(const CFX_DIBSource* pDIB) } FX_BOOL CPDF_ImageCache::GetCachedBitmap(CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, FX_DWORD& MatteColor, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, - FX_INT32 downsampleWidth, FX_INT32 downsampleHeight) + int32_t downsampleWidth, int32_t downsampleHeight) { if (m_pCachedBitmap) { pBitmap = m_pCachedBitmap; @@ -278,7 +278,7 @@ CFX_DIBSource* CPDF_ImageCache::DetachMask() } int CPDF_ImageCache::StartGetCachedBitmap(CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, - FX_INT32 downsampleWidth, FX_INT32 downsampleHeight) + int32_t downsampleWidth, int32_t downsampleHeight) { if (m_pCachedBitmap) { m_pCurBitmap = m_pCachedBitmap; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp index 214e4314da..699f84830f 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -40,7 +40,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, int left, int } else { FX_DWORD fill_argb = m_Options.TranslateColor(mask_argb); if (bitmap_alpha < 255) { - ((FX_BYTE*)&fill_argb)[3] = ((FX_BYTE*)&fill_argb)[3] * bitmap_alpha / 255; + ((uint8_t*)&fill_argb)[3] = ((uint8_t*)&fill_argb)[3] * bitmap_alpha / 255; } if (m_pDevice->SetBitMask(pDIBitmap, left, top, fill_argb)) { return; @@ -1010,7 +1010,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, if (pCS) { FX_FLOAT R, G, B; FX_DWORD comps = 8; - if (pCS->CountComponents() > static_cast<FX_INT32>(comps)) { + if (pCS->CountComponents() > static_cast<int32_t>(comps)) { comps = (FX_DWORD)pCS->CountComponents(); } CFX_FixedBufGrow<FX_FLOAT, 8> float_array(comps); @@ -1026,7 +1026,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, pFloats[i] = pBC->GetNumber(i); } pCS->GetRGB(pFloats, R, G, B); - back_color = 0xff000000 | ((FX_INT32)(R * 255) << 16) | ((FX_INT32)(G * 255) << 8) | (FX_INT32)(B * 255); + back_color = 0xff000000 | ((int32_t)(R * 255) << 16) | ((int32_t)(G * 255) << 8) | (int32_t)(B * 255); m_pContext->m_pDocument->GetPageData()->ReleaseColorSpace(pCSObj); } } @@ -1053,7 +1053,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, int dest_pitch = pMask->GetPitch(); FX_LPBYTE src_buf = bitmap.GetBuffer(); int src_pitch = bitmap.GetPitch(); - FX_LPBYTE pTransfer = FX_Alloc(FX_BYTE, 256); + FX_LPBYTE pTransfer = FX_Alloc(uint8_t, 256); if (pFunc) { CFX_FixedBufGrow<FX_FLOAT, 16> results(pFunc->CountOutputs()); for (int i = 0; i < 256; i ++) { diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index b1fd51ebe9..d45cc1151f 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -270,7 +270,7 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream, CP if (!pitch.IsValid()) { return FALSE; } - m_pLineBuf = FX_Alloc(FX_BYTE, pitch.ValueOrDie()); + m_pLineBuf = FX_Alloc(uint8_t, pitch.ValueOrDie()); if (m_pColorSpace && bStdCS) { m_pColorSpace->EnableStdConversion(TRUE); } @@ -282,7 +282,7 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream, CP if (!pitch.IsValid()) { return FALSE; } - m_pMaskedLine = FX_Alloc(FX_BYTE, pitch.ValueOrDie()); + m_pMaskedLine = FX_Alloc(uint8_t, pitch.ValueOrDie()); } m_Pitch = pitch.ValueOrDie(); if (ppMask) { @@ -314,7 +314,7 @@ int CPDF_DIBSource::ContinueToLoadMask() if (!pitch.IsValid()) { return 0; } - m_pLineBuf = FX_Alloc(FX_BYTE, pitch.ValueOrDie()); + m_pLineBuf = FX_Alloc(uint8_t, pitch.ValueOrDie()); if (m_pColorSpace && m_bStdCS) { m_pColorSpace->EnableStdConversion(TRUE); } @@ -326,7 +326,7 @@ int CPDF_DIBSource::ContinueToLoadMask() if (!pitch.IsValid()) { return 0; } - m_pMaskedLine = FX_Alloc(FX_BYTE, pitch.ValueOrDie()); + m_pMaskedLine = FX_Alloc(uint8_t, pitch.ValueOrDie()); } m_Pitch = pitch.ValueOrDie(); return 1; @@ -730,7 +730,7 @@ void CPDF_DIBSource::LoadJpxBitmap() return; } m_pCachedBitmap->Clear(0xFFFFFFFF); - context->set_output_offsets(FX_Alloc(unsigned char, output_nComps)); + context->set_output_offsets(FX_Alloc(uint8_t, output_nComps)); for (int i = 0; i < output_nComps; ++i) context->output_offsets()[i] = i; if (bSwapRGB) { @@ -1037,9 +1037,9 @@ void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_ R = NORMALCOLOR_MAX(R, 1); G = NORMALCOLOR_MAX(G, 1); B = NORMALCOLOR_MAX(B, 1); - dest_scan[dest_byte_pos] = (FX_INT32)(B * 255); - dest_scan[dest_byte_pos + 1] = (FX_INT32)(G * 255); - dest_scan[dest_byte_pos + 2] = (FX_INT32)(R * 255); + dest_scan[dest_byte_pos] = (int32_t)(B * 255); + dest_scan[dest_byte_pos + 1] = (int32_t)(G * 255); + dest_scan[dest_byte_pos + 2] = (int32_t)(R * 255); dest_byte_pos += 3; } } else { @@ -1063,9 +1063,9 @@ void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_ R = NORMALCOLOR_MAX(R, 1); G = NORMALCOLOR_MAX(G, 1); B = NORMALCOLOR_MAX(B, 1); - dest_scan[dest_byte_pos] = (FX_INT32)(B * 255); - dest_scan[dest_byte_pos + 1] = (FX_INT32)(G * 255); - dest_scan[dest_byte_pos + 2] = (FX_INT32)(R * 255); + dest_scan[dest_byte_pos] = (int32_t)(B * 255); + dest_scan[dest_byte_pos + 1] = (int32_t)(G * 255); + dest_scan[dest_byte_pos + 2] = (int32_t)(R * 255); dest_byte_pos += 3; } } @@ -1155,7 +1155,7 @@ FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const FX_LPBYTE pDestPixel = m_pMaskedLine; FX_LPCBYTE pSrcPixel = m_pLineBuf; for (int col = 0; col < m_Width; col ++) { - FX_BYTE index = *pSrcPixel++; + uint8_t index = *pSrcPixel++; if (m_pPalette) { *pDestPixel++ = FXARGB_B(m_pPalette[index]); *pDestPixel++ = FXARGB_G(m_pPalette[index]); @@ -1254,7 +1254,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ return; } - CFX_FixedBufGrow<FX_BYTE, 128> temp(orig_Bpp); + CFX_FixedBufGrow<uint8_t, 128> temp(orig_Bpp); if (m_bpc * m_nComponents == 1) { FX_DWORD set_argb = (FX_DWORD) - 1, reset_argb = 0; if (m_bImageMask) { @@ -1302,7 +1302,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ int dest_pos = i * dest_Bpp; if (pSrcLine[src_x / 8] & (1 << (7 - src_x % 8))) { if (dest_Bpp == 1) { - dest_scan[dest_pos] = (FX_BYTE)set_argb; + dest_scan[dest_pos] = (uint8_t)set_argb; } else if (dest_Bpp == 3) { dest_scan[dest_pos] = FXARGB_B(set_argb); dest_scan[dest_pos + 1] = FXARGB_G(set_argb); @@ -1312,7 +1312,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ } } else { if (dest_Bpp == 1) { - dest_scan[dest_pos] = (FX_BYTE)reset_argb; + dest_scan[dest_pos] = (uint8_t)reset_argb; } else if (dest_Bpp == 3) { dest_scan[dest_pos] = FXARGB_B(reset_argb); dest_scan[dest_pos + 1] = FXARGB_G(reset_argb); @@ -1345,7 +1345,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ } src_x %= src_width; FX_LPBYTE pDestPixel = dest_scan + i * 4; - FX_BYTE index = pSrcLine[src_x]; + uint8_t index = pSrcLine[src_x]; if (m_pPalette) { *pDestPixel++ = FXARGB_B(m_pPalette[index]); *pDestPixel++ = FXARGB_G(m_pPalette[index]); @@ -1365,7 +1365,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_BYTE index = pSrcLine[src_x]; + uint8_t index = pSrcLine[src_x]; if (dest_Bpp == 1) { dest_scan[i] = index; } else { @@ -1384,7 +1384,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ FX_FLOAT unit_To8Bpc = 255.0f / ((1 << m_bpc) - 1); for (int i = 0; i < clip_width; i ++) { int dest_x = clip_left + i; - FX_DWORD src_x = (bFlipX ? (dest_width - dest_x - 1) : dest_x) * (FX_INT64)src_width / dest_width; + 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; if (m_bpc % 8 == 0) { @@ -1398,7 +1398,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ argb = last_argb; } else { if (m_pColorSpace) { - FX_BYTE color[4]; + uint8_t color[4]; if (!m_bDefaultDecode) { for (int i = 0; i < m_nComponents; i ++) { int color_value = (int)((m_pCompData[i].m_DecodeMin + m_pCompData[i].m_DecodeStep * (FX_FLOAT)pSrcPixel[i]) * 255.0f + 0.5f); @@ -1412,7 +1412,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ src_bit_pos = 4; } for (FX_DWORD i = 0; i < m_nComponents; i ++) { - temp[i] = (FX_BYTE)(_GetBits8(pSrcPixel, src_bit_pos, m_bpc) * unit_To8Bpc); + temp[i] = (uint8_t)(_GetBits8(pSrcPixel, src_bit_pos, m_bpc) * unit_To8Bpc); src_bit_pos += m_bpc; } m_pColorSpace->TranslateImageLine(color, temp, 1, 0, 0, m_bLoadMask && m_GroupFamily == PDFCS_DEVICECMYK && m_Family == PDFCS_DEVICECMYK); @@ -1473,7 +1473,7 @@ CPDF_ProgressiveImageLoaderHandle::CPDF_ProgressiveImageLoaderHandle() CPDF_ProgressiveImageLoaderHandle::~CPDF_ProgressiveImageLoaderHandle() { } -FX_BOOL CPDF_ProgressiveImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader, const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, FX_INT32 nDownsampleWidth, FX_INT32 nDownsampleHeight) +FX_BOOL CPDF_ProgressiveImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader, const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t nDownsampleWidth, int32_t nDownsampleHeight) { m_pImageLoader = pImageLoader; m_pCache = pCache; @@ -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, FX_INT32 nDownsampleWidth, FX_INT32 nDownsampleHeight) +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) { m_nDownsampleWidth = nDownsampleWidth; m_nDownsampleHeight = nDownsampleHeight; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index f9eec23f7a..e02cd421ff 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -77,7 +77,7 @@ static void _DrawAxialShading(CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2B FX_FLOAT x = (FX_FLOAT)column, y = (FX_FLOAT)row; matrix.Transform(x, y); FX_FLOAT scale = FXSYS_Div(FXSYS_Mul(x - start_x, x_span) + FXSYS_Mul(y - start_y, y_span), axis_len_square); - int index = (FX_INT32)(scale * (SHADING_STEPS - 1)); + int index = (int32_t)(scale * (SHADING_STEPS - 1)); if (index < 0) { if (!bStartExtend) { continue; @@ -205,7 +205,7 @@ static void _DrawRadialShading(CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2 continue; } } - int index = (FX_INT32)(s * (SHADING_STEPS - 1)); + int index = (int32_t)(s * (SHADING_STEPS - 1)); if (index < 0) { if (!bStartExtend) { continue; @@ -277,7 +277,7 @@ static void _DrawFuncShading(CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2Bi } FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f; pCS->GetRGB(pResults, R, G, B); - dib_buf[column] = FXARGB_TODIB(FXARGB_MAKE(alpha, (FX_INT32)(R * 255), (FX_INT32)(G * 255), (FX_INT32)(B * 255))); + dib_buf[column] = FXARGB_TODIB(FXARGB_MAKE(alpha, (int32_t)(R * 255), (int32_t)(G * 255), (int32_t)(B * 255))); } } } @@ -368,7 +368,7 @@ static void _DrawGouraud(CFX_DIBitmap* pBitmap, int alpha, CPDF_MeshVertex trian R += r_unit; G += g_unit; B += b_unit; - FXARGB_SETDIB(dib_buf, FXARGB_MAKE(alpha, (FX_INT32)(R * 255), (FX_INT32)(G * 255), (FX_INT32)(B * 255))); + FXARGB_SETDIB(dib_buf, FXARGB_MAKE(alpha, (int32_t)(R * 255), (int32_t)(G * 255), (int32_t)(B * 255))); dib_buf += 4; } } @@ -746,9 +746,9 @@ static void _DrawCoonPatchMeshes(FX_BOOL bTensor, CFX_DIBitmap* pBitmap, CFX_Aff for (i = iStartColor; i < 4; i ++) { FX_FLOAT r=0.0f, g=0.0f, b=0.0f; stream.GetColor(r, g, b); - patch.patch_colors[i].comp[0] = (FX_INT32)(r * 255); - patch.patch_colors[i].comp[1] = (FX_INT32)(g * 255); - patch.patch_colors[i].comp[2] = (FX_INT32)(b * 255); + patch.patch_colors[i].comp[0] = (int32_t)(r * 255); + patch.patch_colors[i].comp[1] = (int32_t)(g * 255); + patch.patch_colors[i].comp[2] = (int32_t)(b * 255); } CFX_FloatRect bbox = CFX_FloatRect::GetBBox(coords, point_count); if (bbox.right <= 0 || bbox.left >= (FX_FLOAT)pBitmap->GetWidth() || bbox.top <= 0 || @@ -787,7 +787,7 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, CFX_AffineMat } FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f; pColorSpace->GetRGB(comps, R, G, B); - background = ArgbEncode(255, (FX_INT32)(R * 255), (FX_INT32)(G * 255), (FX_INT32)(B * 255)); + background = ArgbEncode(255, (int32_t)(R * 255), (int32_t)(G * 255), (int32_t)(B * 255)); } } if (pDict->KeyExist(FX_BSTRC("BBox"))) { @@ -939,8 +939,8 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, CPDF_Pag CFX_Matrix dCTM = m_pDevice->GetCTM(); FX_FLOAT sa = FXSYS_fabs(dCTM.a); FX_FLOAT sd = FXSYS_fabs(dCTM.d); - clip_box.right = clip_box.left + (FX_INT32)FXSYS_ceil(clip_box.Width() * sa); - clip_box.bottom = clip_box.top + (FX_INT32)FXSYS_ceil(clip_box.Height() * sd); + clip_box.right = clip_box.left + (int32_t)FXSYS_ceil(clip_box.Width() * sa); + clip_box.bottom = clip_box.top + (int32_t)FXSYS_ceil(clip_box.Height() * sd); CFX_AffineMatrix mtPattern2Device = pPattern->m_Pattern2Form; mtPattern2Device.Concat(*pObj2Device); GetScaledMatrix(mtPattern2Device); diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp index 09843c9c62..410e78a67b 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -33,11 +33,11 @@ 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)(FX_UINTPTR)charcode, (void*&)pGlyphBitmap)) { + if(pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(uintptr_t)charcode, (void*&)pGlyphBitmap)) { return pGlyphBitmap; } pGlyphBitmap = RenderGlyph(pSizeCache, charcode, pMatrix, retinaScaleX, retinaScaleY); - pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(FX_UINTPTR)charcode, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)charcode, pGlyphBitmap); return pGlyphBitmap; } CPDF_Type3Glyphs::~CPDF_Type3Glyphs() @@ -512,7 +512,7 @@ public: FXTEXT_CHARPOS* m_pCharPos; FX_DWORD m_nChars; }; -FX_FLOAT _CIDTransformToFloat(FX_BYTE ch); +FX_FLOAT _CIDTransformToFloat(uint8_t ch); CPDF_CharPosList::CPDF_CharPosList() { m_pCharPos = NULL; @@ -531,7 +531,7 @@ void CPDF_CharPosList::Load(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pCharPos CPDF_CIDFont* pCIDFont = pFont->GetCIDFont(); FX_BOOL bVertWriting = pCIDFont && pCIDFont->IsVertWriting(); for (int iChar = 0; iChar < nChars; iChar ++) { - FX_DWORD CharCode = nChars == 1 ? (FX_DWORD)(FX_UINTPTR)pCharCodes : pCharCodes[iChar]; + FX_DWORD CharCode = nChars == 1 ? (FX_DWORD)(uintptr_t)pCharCodes : pCharCodes[iChar]; if (CharCode == (FX_DWORD) - 1) { continue; } @@ -614,7 +614,7 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice, FX_FLOAT origi FX_FLOAT* pCharPos; if (nChars == 1) { charcode = pFont->GetNextChar(str, str.GetLength(), offset); - pCharCodes = (FX_DWORD*)(FX_UINTPTR)charcode; + pCharCodes = (FX_DWORD*)(uintptr_t)charcode; pCharPos = NULL; } else { pCharCodes = FX_Alloc(FX_DWORD, nChars); diff --git a/core/src/fpdfapi/fpdf_render/render_int.h b/core/src/fpdfapi/fpdf_render/render_int.h index 529128e8f9..0b6873409b 100644 --- a/core/src/fpdfapi/fpdf_render/render_int.h +++ b/core/src/fpdfapi/fpdf_render/render_int.h @@ -46,7 +46,7 @@ class CPDF_TransferFunc { public: CPDF_Document* m_pPDFDoc; - FX_BYTE m_Samples[256 * 3]; + uint8_t m_Samples[256 * 3]; FX_BOOL m_bIdentity; CFX_DIBSource* TranslateImage(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc); @@ -197,7 +197,7 @@ 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, FX_INT32 nDownsampleWidth = 0, FX_INT32 nDownsampleHeight = 0); + 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); ~CPDF_ImageLoader(); CFX_DIBSource* m_pBitmap; @@ -205,8 +205,8 @@ public: FX_DWORD m_MatteColor; FX_BOOL m_bCached; protected: - FX_INT32 m_nDownsampleWidth; - FX_INT32 m_nDownsampleHeight; + int32_t m_nDownsampleWidth; + int32_t m_nDownsampleHeight; }; class CPDF_ProgressiveImageLoaderHandle { @@ -214,14 +214,14 @@ public: CPDF_ProgressiveImageLoaderHandle(); ~CPDF_ProgressiveImageLoaderHandle(); - FX_BOOL Start(CPDF_ImageLoader* pImageLoader, const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, FX_INT32 nDownsampleWidth = 0, FX_INT32 nDownsampleHeight = 0); + FX_BOOL Start(CPDF_ImageLoader* pImageLoader, const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, 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(IFX_Pause* pPause); protected: CPDF_ImageLoader* m_pImageLoader; CPDF_PageRenderCache* m_pCache; CPDF_ImageObject* m_pImage; - FX_INT32 m_nDownsampleWidth; - FX_INT32 m_nDownsampleHeight; + int32_t m_nDownsampleWidth; + int32_t m_nDownsampleHeight; }; class CFX_ImageTransformer; class CPDF_ImageRenderer : public IPDF_ObjectRenderer @@ -336,7 +336,7 @@ public: void Reset(const CFX_DIBitmap* pBitmap); FX_BOOL GetCachedBitmap(CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, FX_DWORD& MatteColor, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = NULL, FX_INT32 downsampleWidth = 0, FX_INT32 downsampleHeight = 0); + CPDF_RenderStatus* pRenderStatus = NULL, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); FX_DWORD EstimateSize() const { return m_dwCacheSize; @@ -357,7 +357,7 @@ public: public: int StartGetCachedBitmap(CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, - FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, FX_INT32 downsampleWidth = 0, FX_INT32 downsampleHeight = 0); + FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); int Continue(IFX_Pause* pPause); int ContinueGetCachedBitmap(); CFX_DIBSource* DetachBitmap(); diff --git a/core/src/fpdfdoc/doc_action.cpp b/core/src/fpdfdoc/doc_action.cpp index ac40335a4c..e98d3af9e7 100644 --- a/core/src/fpdfdoc/doc_action.cpp +++ b/core/src/fpdfdoc/doc_action.cpp @@ -218,7 +218,7 @@ CPDF_Dictionary* CPDF_Action::GetAnnot() const } return NULL; } -FX_INT32 CPDF_Action::GetOperationType() const +int32_t CPDF_Action::GetOperationType() const { if (m_pDict == NULL) { return 0; diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp index 908333c0f6..ef6c34701b 100644 --- a/core/src/fpdfdoc/doc_annot.cpp +++ b/core/src/fpdfdoc/doc_annot.cpp @@ -332,9 +332,9 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, const CFX_AffineMatrix* p CPDF_Array* pColor = m_pAnnotDict->GetArray("C"); FX_DWORD argb = 0xff000000; if (pColor != NULL) { - int R = (FX_INT32)(pColor->GetNumber(0) * 255); - int G = (FX_INT32)(pColor->GetNumber(1) * 255); - int B = (FX_INT32)(pColor->GetNumber(2) * 255); + int R = (int32_t)(pColor->GetNumber(0) * 255); + int G = (int32_t)(pColor->GetNumber(1) * 255); + int B = (int32_t)(pColor->GetNumber(2) * 255); argb = ArgbEncode(0xff, R, G, B); } CPDF_GraphStateData graph_state; diff --git a/core/src/fpdfdoc/doc_ap.cpp b/core/src/fpdfdoc/doc_ap.cpp index 8a195a747d..d11b78b399 100644 --- a/core/src/fpdfdoc/doc_ap.cpp +++ b/core/src/fpdfdoc/doc_ap.cpp @@ -42,8 +42,8 @@ public: CPVT_FontMap(CPDF_Document * pDoc, CPDF_Dictionary * pResDict, CPDF_Font * pDefFont, const CFX_ByteString & sDefFontAlias); virtual ~CPVT_FontMap(); - CPDF_Font* GetPDFFont(FX_INT32 nFontIndex); - CFX_ByteString GetPDFFontAlias(FX_INT32 nFontIndex); + CPDF_Font* GetPDFFont(int32_t nFontIndex); + CFX_ByteString GetPDFFontAlias(int32_t nFontIndex); static void GetAnnotSysPDFFont(CPDF_Document * pDoc, CPDF_Dictionary * pResDict, CPDF_Font * & pSysFont, CFX_ByteString & sSysFontAlias); private: @@ -84,7 +84,7 @@ void CPVT_FontMap::GetAnnotSysPDFFont(CPDF_Document * pDoc, CPDF_Dictionary * pR } } } -CPDF_Font* CPVT_FontMap::GetPDFFont(FX_INT32 nFontIndex) +CPDF_Font* CPVT_FontMap::GetPDFFont(int32_t nFontIndex) { switch (nFontIndex) { case 0: @@ -97,7 +97,7 @@ CPDF_Font* CPVT_FontMap::GetPDFFont(FX_INT32 nFontIndex) } return NULL; } -CFX_ByteString CPVT_FontMap::GetPDFFontAlias(FX_INT32 nFontIndex) +CFX_ByteString CPVT_FontMap::GetPDFFontAlias(int32_t nFontIndex) { switch (nFontIndex) { case 0: @@ -117,7 +117,7 @@ CPVT_Provider::CPVT_Provider(IPVT_FontMap * pFontMap) : m_pFontMap(pFontMap) CPVT_Provider::~CPVT_Provider() { } -FX_INT32 CPVT_Provider::GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_INT32 nWordStyle) +int32_t CPVT_Provider::GetCharWidth(int32_t nFontIndex, FX_WORD word, int32_t nWordStyle) { if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) { FX_DWORD charcode = pPDFFont->CharCodeFromUnicode(word); @@ -127,21 +127,21 @@ FX_INT32 CPVT_Provider::GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_INT32 } return 0; } -FX_INT32 CPVT_Provider::GetTypeAscent(FX_INT32 nFontIndex) +int32_t CPVT_Provider::GetTypeAscent(int32_t nFontIndex) { if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) { return pPDFFont->GetTypeAscent(); } return 0; } -FX_INT32 CPVT_Provider::GetTypeDescent(FX_INT32 nFontIndex) +int32_t CPVT_Provider::GetTypeDescent(int32_t nFontIndex) { if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) { return pPDFFont->GetTypeDescent(); } return 0; } -FX_INT32 CPVT_Provider::GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex) +int32_t CPVT_Provider::GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex) { if (CPDF_Font* pDefFont = m_pFontMap->GetPDFFont(0)) { if (pDefFont->CharCodeFromUnicode(word) != -1) { @@ -161,11 +161,11 @@ FX_BOOL CPVT_Provider::IsLatinWord(FX_WORD word) } return FALSE; } -FX_INT32 CPVT_Provider::GetDefaultFontIndex() +int32_t CPVT_Provider::GetDefaultFontIndex() { return 0; } -static CFX_ByteString GetPDFWordString(IPVT_FontMap * pFontMap, FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord) +static CFX_ByteString GetPDFWordString(IPVT_FontMap * pFontMap, int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord) { CFX_ByteString sWord; if (SubWord > 0) { @@ -193,7 +193,7 @@ static CFX_ByteString GetWordRenderString(const CFX_ByteString & strWords) } return ""; } -static CFX_ByteString GetFontSetString(IPVT_FontMap * pFontMap, FX_INT32 nFontIndex, FX_FLOAT fFontSize) +static CFX_ByteString GetFontSetString(IPVT_FontMap * pFontMap, int32_t nFontIndex, FX_FLOAT fFontSize) { CFX_ByteTextBuf sRet; if (pFontMap) { @@ -244,7 +244,7 @@ static CPVT_Color ParseColor(const CPDF_Array & array) } return rt; } -static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict, const FX_INT32 & nWidgetType) +static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict, const int32_t & nWidgetType) { CPDF_Dictionary* pFormDict = NULL; if (CPDF_Dictionary * pRootDict = pDoc->GetRoot()) { @@ -310,7 +310,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict return FALSE; } CPDF_Rect rcAnnot = pAnnotDict->GetRect("Rect"); - FX_INT32 nRotate = 0; + int32_t nRotate = 0; if (CPDF_Dictionary * pMKDict = pAnnotDict->GetDict("MK")) { nRotate = pMKDict->GetInteger("R"); } @@ -333,7 +333,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict rcBBox = CPDF_Rect(0, 0, rcAnnot.top - rcAnnot.bottom, rcAnnot.right - rcAnnot.left); break; } - FX_INT32 nBorderStyle = PBS_SOLID; + int32_t nBorderStyle = PBS_SOLID; FX_FLOAT fBorderWidth = 1; CPVT_Dash dsBorder(3, 0, 0); CPVT_Color crLeftTop, crRightBottom; @@ -405,7 +405,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict if (pNormalStream == NULL) { return FALSE; } - FX_INT32 objnum = pDoc->AddIndirectObject(pNormalStream); + int32_t objnum = pDoc->AddIndirectObject(pNormalStream); pAnnotDict->GetDict("AP")->SetAtReference("N", pDoc, objnum); } CPDF_Dictionary * pStreamDict = pNormalStream->GetDict(); @@ -433,7 +433,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict switch (nWidgetType) { case 0: { CFX_WideString swValue = FPDF_GetFieldAttr(pAnnotDict, "V")? FPDF_GetFieldAttr(pAnnotDict, "V")->GetUnicodeText() : CFX_WideString(); - FX_INT32 nAlign = FPDF_GetFieldAttr(pAnnotDict, "Q")? FPDF_GetFieldAttr(pAnnotDict, "Q")->GetInteger() : 0; + int32_t nAlign = FPDF_GetFieldAttr(pAnnotDict, "Q")? FPDF_GetFieldAttr(pAnnotDict, "Q")->GetInteger() : 0; FX_DWORD dwFlags = FPDF_GetFieldAttr(pAnnotDict, "Ff")? FPDF_GetFieldAttr(pAnnotDict, "Ff")->GetInteger() : 0; FX_DWORD dwMaxLen = FPDF_GetFieldAttr(pAnnotDict, "MaxLen") ? FPDF_GetFieldAttr(pAnnotDict, "MaxLen")->GetInteger() : 0; CPVT_FontMap map(pDoc, pStreamDict ? pStreamDict->GetDict("Resources") : NULL , pDefFont, sFontName.Right(sFontName.GetLength() - 1)); @@ -540,11 +540,11 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict CPVT_Provider prd(&map); CPDF_Array * pOpts = FPDF_GetFieldAttr(pAnnotDict, "Opt") ? FPDF_GetFieldAttr(pAnnotDict, "Opt")->GetArray() : NULL; CPDF_Array * pSels = FPDF_GetFieldAttr(pAnnotDict, "I") ? FPDF_GetFieldAttr(pAnnotDict, "I")->GetArray() : NULL; - FX_INT32 nTop = FPDF_GetFieldAttr(pAnnotDict, "TI") ? FPDF_GetFieldAttr(pAnnotDict, "TI")->GetInteger() : 0; + int32_t nTop = FPDF_GetFieldAttr(pAnnotDict, "TI") ? FPDF_GetFieldAttr(pAnnotDict, "TI")->GetInteger() : 0; CFX_ByteTextBuf sBody; if (pOpts) { FX_FLOAT fy = rcBody.top; - for (FX_INT32 i = nTop, sz = pOpts->GetCount(); i < sz; i++) { + for (int32_t i = nTop, sz = pOpts->GetCount(); i < sz; i++) { if (IsFloatSmaller(fy, rcBody.bottom)) { break; } @@ -598,7 +598,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict break; } if (pNormalStream) { - pNormalStream->SetData((FX_BYTE*)sAppStream.GetBuffer(), sAppStream.GetSize(), FALSE, FALSE); + pNormalStream->SetData((uint8_t*)sAppStream.GetBuffer(), sAppStream.GetSize(), FALSE, FALSE); pStreamDict = pNormalStream->GetDict(); if (pStreamDict) { pStreamDict->SetAtMatrix("Matrix", matrix); @@ -640,7 +640,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP(IPVT_FontMap * pFontMap, IPDF_Var { CFX_ByteTextBuf sEditStream, sLineStream, sWords; CPDF_Point ptOld(0.0f, 0.0f), ptNew(0.0f, 0.0f); - FX_INT32 nCurFontIndex = -1; + int32_t nCurFontIndex = -1; if (pIterator) { if (pVisible) { pIterator->SetAt(pVisible->BeginPos); @@ -713,7 +713,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP(IPVT_FontMap * pFontMap, IPDF_Var } CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(const CPDF_Rect & rect, FX_FLOAT fWidth, const CPVT_Color & color, const CPVT_Color & crLeftTop, const CPVT_Color & crRightBottom, - FX_INT32 nStyle, const CPVT_Dash & dash) + int32_t nStyle, const CPVT_Dash & dash) { CFX_ByteTextBuf sAppStream; CFX_ByteString sColor; diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp index 48f3ccae98..dfa2e6718a 100644 --- a/core/src/fpdfdoc/doc_basic.cpp +++ b/core/src/fpdfdoc/doc_basic.cpp @@ -103,7 +103,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, const CFX_ByteString& FX_DWORD dwCount = pNames->GetCount() / 2; for (FX_DWORD i = 0; i < dwCount; i ++) { CFX_ByteString csValue = pNames->GetString(i * 2); - FX_INT32 iCompare = csValue.Compare(csName); + int32_t iCompare = csValue.Compare(csName); if (iCompare <= 0) { if (ppFind != NULL) { *ppFind = pNames; @@ -405,7 +405,7 @@ CPDF_Stream* CPDF_FileSpec::GetFileStream() const if (m_pObj == NULL) { return NULL; } - FX_INT32 iType = m_pObj->GetType(); + int32_t iType = m_pObj->GetType(); if (iType == PDFOBJ_STREAM) { return (CPDF_Stream*)m_pObj; } else if (iType == PDFOBJ_DICTIONARY) { @@ -426,7 +426,7 @@ static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object *pObj, FX_WSTR wsFileName, } else { wsStr = FILESPEC_EncodeFileName(wsFileName); } - FX_INT32 iType = pObj->GetType(); + int32_t iType = pObj->GetType(); if (iType == PDFOBJ_STRING) { pObj->SetString(CFX_ByteString::FromUnicode(wsStr)); } else if (iType == PDFOBJ_DICTIONARY) { @@ -540,7 +540,7 @@ CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const wsLabel.Format(L"%d", nPage + 1); return wsLabel; } -FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_BSTR bsLabel) const +int32_t CPDF_PageLabel::GetPageByLabel(FX_BSTR bsLabel) const { if (m_pDocument == NULL) { return -1; @@ -565,7 +565,7 @@ FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_BSTR bsLabel) const } return -1; } -FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_WSTR wsLabel) const +int32_t CPDF_PageLabel::GetPageByLabel(FX_WSTR wsLabel) const { CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr()); return GetPageByLabel(bsLabel); diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp index dff6039bc8..0fbbd1d38f 100644 --- a/core/src/fpdfdoc/doc_form.cpp +++ b/core/src/fpdfdoc/doc_form.cpp @@ -376,7 +376,7 @@ static FX_BOOL RetrieveSpecificFont(LOGFONTA& lf) } return fd.bFind; } -static FX_BOOL RetrieveSpecificFont(FX_BYTE charSet, FX_BYTE pitchAndFamily, LPCSTR pcsFontName, LOGFONTA& lf) +static FX_BOOL RetrieveSpecificFont(uint8_t charSet, uint8_t pitchAndFamily, LPCSTR pcsFontName, LOGFONTA& lf) { memset(&lf, 0, sizeof(LOGFONTA)); lf.lfCharSet = charSet; @@ -386,7 +386,7 @@ static FX_BOOL RetrieveSpecificFont(FX_BYTE charSet, FX_BYTE pitchAndFamily, LPC } return RetrieveSpecificFont(lf); } -static FX_BOOL RetrieveStockFont(int iFontObject, FX_BYTE charSet, LOGFONTA& lf) +static FX_BOOL RetrieveStockFont(int iFontObject, uint8_t charSet, LOGFONTA& lf) { HFONT hFont = (HFONT)::GetStockObject(iFontObject); if (hFont != NULL) { @@ -418,7 +418,7 @@ CPDF_Font* CPDF_InterForm::AddSystemDefaultFont(const CPDF_Document* pDocument) #endif return pFont; } -CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_ByteString csFontName, FX_BYTE iCharSet) +CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_ByteString csFontName, uint8_t iCharSet) { if (pDocument == NULL || csFontName.IsEmpty()) { return NULL; @@ -440,7 +440,7 @@ CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_Byt #endif return NULL; } -CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_WideString csFontName, FX_BYTE iCharSet) +CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_WideString csFontName, uint8_t iCharSet) { if (pDocument == NULL || csFontName.IsEmpty()) { return NULL; @@ -476,7 +476,7 @@ CPDF_Font* CPDF_InterForm::AddStandardFont(const CPDF_Document* pDocument, CFX_B } return pFont; } -CFX_ByteString CPDF_InterForm::GetNativeFont(FX_BYTE charSet, FX_LPVOID pLogFont) +CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, FX_LPVOID pLogFont) { CFX_ByteString csFontName; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ @@ -516,16 +516,16 @@ CFX_ByteString CPDF_InterForm::GetNativeFont(FX_BYTE charSet, FX_LPVOID pLogFont CFX_ByteString CPDF_InterForm::GetNativeFont(FX_LPVOID pLogFont) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - FX_BYTE charSet = GetNativeCharSet(); + uint8_t charSet = GetNativeCharSet(); return GetNativeFont(charSet, pLogFont); #else return CFX_ByteString(); #endif } -FX_BYTE CPDF_InterForm::GetNativeCharSet() +uint8_t CPDF_InterForm::GetNativeCharSet() { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - FX_BYTE charSet = ANSI_CHARSET; + uint8_t charSet = ANSI_CHARSET; UINT iCodePage = ::GetACP(); switch (iCodePage) { case 932: @@ -582,7 +582,7 @@ FX_BYTE CPDF_InterForm::GetNativeCharSet() return 0; #endif } -CPDF_Font* CPDF_InterForm::AddNativeFont(FX_BYTE charSet, const CPDF_Document* pDocument) +CPDF_Font* CPDF_InterForm::AddNativeFont(uint8_t charSet, const CPDF_Document* pDocument) { if (pDocument == NULL) { return NULL; @@ -607,7 +607,7 @@ CPDF_Font* CPDF_InterForm::AddNativeFont(const CPDF_Document* pDocument) return NULL; } CPDF_Font* pFont = NULL; - FX_BYTE charSet = GetNativeCharSet(); + uint8_t charSet = GetNativeCharSet(); pFont = AddNativeFont(charSet, pDocument); return pFont; } @@ -1086,7 +1086,7 @@ CPDF_Font* CPDF_InterForm::GetFormFont(CFX_ByteString csFontName, CFX_ByteString { return GetInterFormFont(m_pFormDict, m_pDocument, csFontName, csNameTag); } -CPDF_Font* CPDF_InterForm::GetNativeFormFont(FX_BYTE charSet, CFX_ByteString& csNameTag) +CPDF_Font* CPDF_InterForm::GetNativeFormFont(uint8_t charSet, CFX_ByteString& csNameTag) { return GetNativeInterFormFont(m_pFormDict, m_pDocument, charSet, csNameTag); } @@ -1107,7 +1107,7 @@ void CPDF_InterForm::AddFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameT AddInterFormFont(m_pFormDict, m_pDocument, pFont, csNameTag); m_bUpdated = TRUE; } -CPDF_Font* CPDF_InterForm::AddNativeFormFont(FX_BYTE charSet, CFX_ByteString& csNameTag) +CPDF_Font* CPDF_InterForm::AddNativeFormFont(uint8_t charSet, CFX_ByteString& csNameTag) { m_bUpdated = TRUE; return AddNativeInterFormFont(m_pFormDict, m_pDocument, charSet, csNameTag); @@ -1369,7 +1369,7 @@ CPDF_FormField* CPDF_InterForm::CheckRequiredFields(const CFX_PtrArray *fields, if (pField == NULL) { continue; } - FX_INT32 iType = pField->GetType(); + int32_t iType = pField->GetType(); if (iType == CPDF_FormField::PushButton || iType == CPDF_FormField::CheckBox || iType == CPDF_FormField::ListBox) { continue; } @@ -1472,7 +1472,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF(FX_WSTR pdf_path, CFX_PtrArray& field } const struct _SupportFieldEncoding { FX_LPCSTR m_name; - FX_INT32 m_codePage; + int32_t m_codePage; } g_fieldEncoding[] = { { "BigFive", 950 }, { "GBK", 936 }, @@ -1483,8 +1483,8 @@ static void FPDFDOC_FDF_GetFieldValue(CPDF_Dictionary *pFieldDict, CFX_WideStrin { ASSERT(pFieldDict != NULL); CFX_ByteString csBValue = pFieldDict->GetString("V"); - FX_INT32 iCount = sizeof(g_fieldEncoding) / sizeof(g_fieldEncoding[0]); - FX_INT32 i = 0; + int32_t iCount = sizeof(g_fieldEncoding) / sizeof(g_fieldEncoding[0]); + int32_t i = 0; for (; i < iCount; ++i) if (bsEncoding == g_fieldEncoding[i].m_name) { break; diff --git a/core/src/fpdfdoc/doc_link.cpp b/core/src/fpdfdoc/doc_link.cpp index 2f770d7d00..71be0c36ab 100644 --- a/core/src/fpdfdoc/doc_link.cpp +++ b/core/src/fpdfdoc/doc_link.cpp @@ -23,12 +23,12 @@ CFX_PtrArray* CPDF_LinkList::GetPageLinks(CPDF_Page* pPage) return NULL; } CFX_PtrArray* pPageLinkList = NULL; - if (!m_PageMap.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, (FX_LPVOID&)pPageLinkList)) { + if (!m_PageMap.Lookup((FX_LPVOID)(uintptr_t)objnum, (FX_LPVOID&)pPageLinkList)) { pPageLinkList = FX_NEW CFX_PtrArray; if (pPageLinkList == NULL) { return NULL; } - m_PageMap.SetAt((FX_LPVOID)(FX_UINTPTR)objnum, pPageLinkList); + m_PageMap.SetAt((FX_LPVOID)(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 232f6eea21..677d0e91af 100644 --- a/core/src/fpdfdoc/doc_metadata.cpp +++ b/core/src/fpdfdoc/doc_metadata.cpp @@ -74,7 +74,7 @@ void CPDF_Metadata::LoadDoc(CPDF_Document *pDoc) pElmntRdf = pXmlElmnt->GetElement(NULL, FX_BSTRC("RDF")); } } -FX_INT32 CPDF_Metadata::GetString(FX_BSTR bsItem, CFX_WideString &wsStr) +int32_t CPDF_Metadata::GetString(FX_BSTR bsItem, CFX_WideString &wsStr) { if (!((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt) { return -1; diff --git a/core/src/fpdfdoc/doc_ocg.cpp b/core/src/fpdfdoc/doc_ocg.cpp index 0ca9fc0313..c2f77a58fa 100644 --- a/core/src/fpdfdoc/doc_ocg.cpp +++ b/core/src/fpdfdoc/doc_ocg.cpp @@ -5,12 +5,12 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/fpdfdoc/fpdf_doc.h" -static FX_INT32 FPDFDOC_OCG_FindGroup(const CPDF_Object *pObject, const CPDF_Dictionary *pGroupDict) +static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object *pObject, const CPDF_Dictionary *pGroupDict) { if (pObject == NULL || pGroupDict == NULL) { return -1; } - FX_INT32 iType = pObject->GetType(); + int32_t iType = pObject->GetType(); if (iType == PDFOBJ_ARRAY) { FX_DWORD dwCount = ((CPDF_Array*)pObject)->GetCount(); for (FX_DWORD i = 0; i < dwCount; i++) { @@ -64,8 +64,8 @@ static CPDF_Dictionary* FPDFDOC_OCG_GetConfig(CPDF_Document *pDoc, const CPDF_Di CPDF_Array *pConfigs = pOCProperties->GetArray(FX_BSTRC("Configs")); if (pConfigs) { CPDF_Dictionary *pFind; - FX_INT32 iCount = pConfigs->GetCount(); - for (FX_INT32 i = 0; i < iCount; i ++) { + int32_t iCount = pConfigs->GetCount(); + for (int32_t i = 0; i < iCount; i ++) { pFind = pConfigs->GetDict(i); if (!pFind) { continue; @@ -124,8 +124,8 @@ FX_BOOL CPDF_OCContext::LoadOCGStateFromConfig(FX_BSTR csConfig, const CPDF_Dict pArray = pConfig->GetArray(FX_BSTRC("AS")); if (pArray) { CFX_ByteString csFind = csConfig + FX_BSTRC("State"); - FX_INT32 iCount = pArray->GetCount(); - for (FX_INT32 i = 0; i < iCount; i ++) { + int32_t iCount = pArray->GetCount(); + for (int32_t i = 0; i < iCount; i ++) { CPDF_Dictionary *pUsage = pArray->GetDict(i); if (!pUsage) { continue; @@ -181,11 +181,11 @@ FX_BOOL CPDF_OCContext::GetOCGVisible(const CPDF_Dictionary *pOCGDict) } FX_LPVOID bState = NULL; if (m_OCGStates.Lookup(pOCGDict, bState)) { - return (FX_UINTPTR)bState != 0; + return (uintptr_t)bState != 0; } - bState = (FX_LPVOID)(FX_UINTPTR)LoadOCGState(pOCGDict); + bState = (FX_LPVOID)(uintptr_t)LoadOCGState(pOCGDict); m_OCGStates.SetAt(pOCGDict, bState); - return (FX_UINTPTR)bState != 0; + return (uintptr_t)bState != 0; } FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array *pExpression, FX_BOOL bFromConfig, int nLevel) { @@ -195,7 +195,7 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array *pExpression, FX_BOOL bFromConfig, i if (pExpression == NULL) { return FALSE; } - FX_INT32 iCount = pExpression->GetCount(); + int32_t iCount = pExpression->GetCount(); CPDF_Object *pOCGObj; CFX_ByteString csOperator = pExpression->GetString(0); if (csOperator == FX_BSTRC("Not")) { @@ -213,7 +213,7 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array *pExpression, FX_BOOL bFromConfig, i } if (csOperator == FX_BSTRC("Or") || csOperator == FX_BSTRC("And")) { FX_BOOL bValue = FALSE; - for (FX_INT32 i = 1; i < iCount; i ++) { + for (int32_t i = 1; i < iCount; i ++) { pOCGObj = pExpression->GetElementValue(1); if (pOCGObj == NULL) { continue; @@ -260,8 +260,8 @@ FX_BOOL CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary *pOCMDDict, FX_BOOL if (csP == FX_BSTRC("AllOn") || csP == FX_BSTRC("AllOff")) { bState = TRUE; } - FX_INT32 iCount = ((CPDF_Array*)pOCGObj)->GetCount(); - for (FX_INT32 i = 0; i < iCount; i ++) { + int32_t iCount = ((CPDF_Array*)pOCGObj)->GetCount(); + for (int32_t i = 0; i < iCount; i ++) { FX_BOOL bItem = TRUE; CPDF_Dictionary* pItemDict = ((CPDF_Array*)pOCGObj)->GetDict(i); if (pItemDict) { diff --git a/core/src/fpdfdoc/doc_utils.cpp b/core/src/fpdfdoc/doc_utils.cpp index 35e001ea69..df393b2f77 100644 --- a/core/src/fpdfdoc/doc_utils.cpp +++ b/core/src/fpdfdoc/doc_utils.cpp @@ -245,7 +245,7 @@ void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) if (!pFormDict->KeyExist("DR")) { CPDF_Font* pFont = NULL; CFX_ByteString csBaseName, csDefault; - FX_BYTE charSet = CPDF_InterForm::GetNativeCharSet(); + uint8_t charSet = CPDF_InterForm::GetNativeCharSet(); pFont = CPDF_InterForm::AddStandardFont(pDocument, "Helvetica"); if (pFont != NULL) { AddInterFormFont(pFormDict, pDocument, pFont, csBaseName); @@ -409,7 +409,7 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument } return NULL; } -CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag) +CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, uint8_t charSet, CFX_ByteString& csNameTag) { if (pFormDict == NULL) { return NULL; @@ -456,7 +456,7 @@ CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDo CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag) { csNameTag = ""; - FX_BYTE charSet = CPDF_InterForm::GetNativeCharSet(); + uint8_t charSet = CPDF_InterForm::GetNativeCharSet(); CFX_SubstFont* pSubst; CPDF_Font* pFont = GetDefaultInterFormFont(pFormDict, pDocument); if (pFont != NULL) { @@ -586,7 +586,7 @@ void AddInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, con csNameTag = CPDF_InterForm::GenerateNewResourceName(pDR, "Font", 4, csNameTag); pFonts->SetAtReference(csNameTag, pDocument, pFont->GetFontDict()); } -CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag) +CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, uint8_t charSet, CFX_ByteString& csNameTag) { if (pFormDict == NULL) { InitInterFormDict(pFormDict, pDocument); @@ -611,7 +611,7 @@ CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pD } CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag) { - FX_BYTE charSet = CPDF_InterForm::GetNativeCharSet(); + uint8_t charSet = CPDF_InterForm::GetNativeCharSet(); return AddNativeInterFormFont(pFormDict, pDocument, charSet, csNameTag); } void RemoveInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont) diff --git a/core/src/fpdfdoc/doc_utils.h b/core/src/fpdfdoc/doc_utils.h index 08c4e7e552..6bb1d30dbb 100644 --- a/core/src/fpdfdoc/doc_utils.h +++ b/core/src/fpdfdoc/doc_utils.h @@ -13,12 +13,12 @@ FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict); CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, FX_DWORD index, CFX_ByteString& csNameTag); CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csNameTag); CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CFX_ByteString& csNameTag); -CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag); +CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, uint8_t charSet, CFX_ByteString& csNameTag); CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag); FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont, CFX_ByteString& csNameTag); FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag); void AddInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, const CPDF_Font* pFont, CFX_ByteString& csNameTag); -CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag); +CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, uint8_t charSet, CFX_ByteString& csNameTag); CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag); void RemoveInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont); void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag); diff --git a/core/src/fpdfdoc/doc_viewerPreferences.cpp b/core/src/fpdfdoc/doc_viewerPreferences.cpp index f68d3fbdc7..7ec325cfb4 100644 --- a/core/src/fpdfdoc/doc_viewerPreferences.cpp +++ b/core/src/fpdfdoc/doc_viewerPreferences.cpp @@ -29,7 +29,7 @@ FX_BOOL CPDF_ViewerPreferences::PrintScaling() const } return FX_BSTRC("None") != pDict->GetString(FX_BSTRC("PrintScaling")); } -FX_INT32 CPDF_ViewerPreferences::NumCopies() const +int32_t CPDF_ViewerPreferences::NumCopies() const { CPDF_Dictionary *pDict = m_pDoc->GetRoot(); pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); diff --git a/core/src/fpdfdoc/doc_vt.cpp b/core/src/fpdfdoc/doc_vt.cpp index fd3f5bafd1..7ed5b4ad3c 100644 --- a/core/src/fpdfdoc/doc_vt.cpp +++ b/core/src/fpdfdoc/doc_vt.cpp @@ -7,7 +7,7 @@ #include "../../include/fpdfdoc/fpdf_doc.h" #include "../../include/fpdfdoc/fpdf_vt.h" #include "pdf_vt.h" -const FX_BYTE gFontSizeSteps[] = { 4, 6, 8, 9, 10, 12, 14, 18, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80, 90, 100, 110, 120, 130, 144}; +const uint8_t gFontSizeSteps[] = { 4, 6, 8, 9, 10, 12, 14, 18, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80, 90, 100, 110, 120, 130, 144}; #define PVT_RETURN_LENGTH 1 #define PVT_DEFAULT_FONTSIZE 18.0f #define PVTWORD_SCRIPT_NORMAL 0 @@ -62,14 +62,14 @@ void CSection::ResetLineArray() } void CSection::ResetWordArray() { - for (FX_INT32 i = 0, sz = m_WordArray.GetSize(); i < sz; i++) { + for (int32_t i = 0, sz = m_WordArray.GetSize(); i < sz; i++) { delete m_WordArray.GetAt(i); } m_WordArray.RemoveAll(); } void CSection::ResetLinePlace() { - for (FX_INT32 i = 0, sz = m_LineArray.GetSize(); i < sz; i++) { + for (int32_t i = 0, sz = m_LineArray.GetSize(); i < sz; i++) { if (CLine * pLine = m_LineArray.GetAt(i)) { pLine->LinePlace = CPVT_WordPlace(SecPlace.nSecIndex, i, -1); } @@ -78,7 +78,7 @@ void CSection::ResetLinePlace() CPVT_WordPlace CSection::AddWord(const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo) { if (CPVT_WordInfo * pWord = FX_NEW CPVT_WordInfo(wordinfo)) { - FX_INT32 nWordIndex = FPDF_MAX(FPDF_MIN(place.nWordIndex, this->m_WordArray.GetSize()), 0); + int32_t nWordIndex = FPDF_MAX(FPDF_MIN(place.nWordIndex, this->m_WordArray.GetSize()), 0); if (nWordIndex == m_WordArray.GetSize()) { m_WordArray.Add(pWord); } else { @@ -162,9 +162,9 @@ CPVT_WordPlace CSection::GetNextWordPlace(const CPVT_WordPlace & place) const } void CSection::UpdateWordPlace(CPVT_WordPlace & place) const { - FX_INT32 nLeft = 0; - FX_INT32 nRight = m_LineArray.GetSize() - 1; - FX_INT32 nMid = (nLeft + nRight) / 2; + int32_t nLeft = 0; + int32_t nRight = m_LineArray.GetSize() - 1; + int32_t nMid = (nLeft + nRight) / 2; while (nLeft <= nRight) { if (CLine * pLine = m_LineArray.GetAt(nMid)) { if (place.nWordIndex < pLine->m_LineInfo.nBeginWordIndex) { @@ -188,9 +188,9 @@ CPVT_WordPlace CSection::SearchWordPlace(const CPDF_Point & point) const CPVT_WordPlace place = GetBeginWordPlace(); FX_BOOL bUp = TRUE; FX_BOOL bDown = TRUE; - FX_INT32 nLeft = 0; - FX_INT32 nRight = m_LineArray.GetSize() - 1; - FX_INT32 nMid = m_LineArray.GetSize() / 2; + int32_t nLeft = 0; + int32_t nRight = m_LineArray.GetSize() - 1; + int32_t nMid = m_LineArray.GetSize() / 2; FX_FLOAT fTop = 0; FX_FLOAT fBottom = 0; while (nLeft <= nRight) { @@ -243,9 +243,9 @@ CPVT_WordPlace CSection::SearchWordPlace(FX_FLOAT fx, const CPVT_WordRange & ran if (!m_pVT) { return wordplace; } - FX_INT32 nLeft = range.BeginPos.nWordIndex; - FX_INT32 nRight = range.EndPos.nWordIndex + 1; - FX_INT32 nMid = (nLeft + nRight) / 2; + int32_t nLeft = range.BeginPos.nWordIndex; + int32_t nRight = range.EndPos.nWordIndex + 1; + int32_t nMid = (nLeft + nRight) / 2; while (nLeft < nRight) { if (nMid == nLeft) { break; @@ -275,23 +275,23 @@ CPVT_WordPlace CSection::SearchWordPlace(FX_FLOAT fx, const CPVT_WordRange & ran } return wordplace; } -void CSection::ClearLeftWords(FX_INT32 nWordIndex) +void CSection::ClearLeftWords(int32_t nWordIndex) { - for (FX_INT32 i = nWordIndex; i >= 0; i--) { + for (int32_t i = nWordIndex; i >= 0; i--) { delete m_WordArray.GetAt(i); m_WordArray.RemoveAt(i); } } -void CSection::ClearRightWords(FX_INT32 nWordIndex) +void CSection::ClearRightWords(int32_t nWordIndex) { - for (FX_INT32 i = m_WordArray.GetSize() - 1; i > nWordIndex; i--) { + for (int32_t i = m_WordArray.GetSize() - 1; i > nWordIndex; i--) { delete m_WordArray.GetAt(i); m_WordArray.RemoveAt(i); } } -void CSection::ClearMidWords(FX_INT32 nBeginIndex, FX_INT32 nEndIndex) +void CSection::ClearMidWords(int32_t nBeginIndex, int32_t nEndIndex) { - for (FX_INT32 i = nEndIndex; i > nBeginIndex; i--) { + for (int32_t i = nEndIndex; i > nBeginIndex; i--) { delete m_WordArray.GetAt(i); m_WordArray.RemoveAt(i); } @@ -332,7 +332,7 @@ CPVT_FloatRect CTypeset::CharArray() m_rcRet.Default(); FX_FLOAT x = 0.0f, y = 0.0f; FX_FLOAT fNextWidth; - FX_INT32 nStart = 0; + int32_t nStart = 0; FX_FLOAT fNodeWidth = m_pVT->GetPlateWidth() / (m_pVT->m_nCharArray <= 0 ? 1 : m_pVT->m_nCharArray); if (CLine * pLine = m_pSection->m_LineArray.GetAt(0)) { x = 0.0f; @@ -352,7 +352,7 @@ CPVT_FloatRect CTypeset::CharArray() pLine->m_LineInfo.fLineX = fNodeWidth * nStart - fNodeWidth * PVT_HALF; break; } - for (FX_INT32 w = 0, sz = m_pSection->m_WordArray.GetSize(); w < sz; w++) { + for (int32_t w = 0, sz = m_pSection->m_WordArray.GetSize(); w < sz; w++) { if (w >= m_pVT->m_nCharArray) { break; } @@ -591,23 +591,23 @@ void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize) { ASSERT(m_pVT != NULL); ASSERT(m_pSection != NULL); - FX_INT32 nLineHead = 0; - FX_INT32 nLineTail = 0; + int32_t nLineHead = 0; + int32_t nLineTail = 0; FX_FLOAT fMaxX = 0.0f, fMaxY = 0.0f; FX_FLOAT fLineWidth = 0.0f, fBackupLineWidth = 0.0f; FX_FLOAT fLineAscent = 0.0f, fBackupLineAscent = 0.0f; FX_FLOAT fLineDescent = 0.0f, fBackupLineDescent = 0.0f; - FX_INT32 nWordStartPos = 0; + int32_t nWordStartPos = 0; FX_BOOL bFullWord = FALSE; - FX_INT32 nLineFullWordIndex = 0; - FX_INT32 nCharIndex = 0; + int32_t nLineFullWordIndex = 0; + int32_t nCharIndex = 0; CPVT_LineInfo line; FX_FLOAT fWordWidth = 0; FX_FLOAT fTypesetWidth = FPDF_MAX(m_pVT->GetPlateWidth() - m_pVT->GetLineIndent(m_pSection->m_SecInfo), 0.0f); - FX_INT32 nTotalWords = m_pSection->m_WordArray.GetSize(); + int32_t nTotalWords = m_pSection->m_WordArray.GetSize(); FX_BOOL bOpened = FALSE; if (nTotalWords > 0) { - FX_INT32 i = 0; + int32_t i = 0; while (i < nTotalWords) { CPVT_WordInfo * pWord = m_pSection->m_WordArray.GetAt(i); CPVT_WordInfo* pOldWord = pWord; @@ -753,10 +753,10 @@ void CTypeset::OutputLines() fMaxX = fMinX + m_rcRet.Width(); fMinY = 0.0f; fMaxY = m_rcRet.Height(); - FX_INT32 nTotalLines = m_pSection->m_LineArray.GetSize(); + int32_t nTotalLines = m_pSection->m_LineArray.GetSize(); if (nTotalLines > 0) { m_pSection->m_SecInfo.nTotalLine = nTotalLines; - for (FX_INT32 l = 0; l < nTotalLines; l++) { + for (int32_t l = 0; l < nTotalLines; l++) { if (CLine * pLine = m_pSection->m_LineArray.GetAt(l)) { switch (m_pVT->GetAlignment(m_pSection->m_SecInfo)) { default: @@ -775,7 +775,7 @@ void CTypeset::OutputLines() fPosY += pLine->m_LineInfo.fLineAscent; pLine->m_LineInfo.fLineX = fPosX - fMinX; pLine->m_LineInfo.fLineY = fPosY - fMinY; - for (FX_INT32 w = pLine->m_LineInfo.nBeginWordIndex; w <= pLine->m_LineInfo.nEndWordIndex; w++) { + for (int32_t w = pLine->m_LineInfo.nBeginWordIndex; w <= pLine->m_LineInfo.nEndWordIndex; w++) { if (CPVT_WordInfo * pWord = m_pSection->m_WordArray.GetAt(w)) { pWord->fWordX = fPosX - fMinX; if (pWord->pWordProps) { @@ -855,10 +855,10 @@ void CPDF_VariableText::ResetAll() m_bInitial = FALSE; ResetSectionArray(); } -CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WORD word, FX_INT32 charset, +CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WORD word, int32_t charset, const CPVT_WordProps * pWordProps) { - FX_INT32 nTotlaWords = this->GetTotalWords(); + int32_t nTotlaWords = this->GetTotalWords(); if (m_nLimitChar > 0 && nTotlaWords >= m_nLimitChar) { return place; } @@ -874,7 +874,7 @@ CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WO return AddWord(newplace, CPVT_WordInfo(word, charset, -1, pNewProps)); } } else { - FX_INT32 nFontIndex = GetSubWord() > 0 ? GetDefaultFontIndex() : GetWordFontIndex(word, charset, GetDefaultFontIndex()); + int32_t nFontIndex = GetSubWord() > 0 ? GetDefaultFontIndex() : GetWordFontIndex(word, charset, GetDefaultFontIndex()); return AddWord(newplace, CPVT_WordInfo(word, charset, nFontIndex, NULL)); } return place; @@ -882,7 +882,7 @@ CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WO CPVT_WordPlace CPDF_VariableText::InsertSection(const CPVT_WordPlace & place, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps) { - FX_INT32 nTotlaWords = this->GetTotalWords(); + int32_t nTotlaWords = this->GetTotalWords(); if (m_nLimitChar > 0 && nTotlaWords >= m_nLimitChar) { return place; } @@ -909,7 +909,7 @@ CPVT_WordPlace CPDF_VariableText::InsertSection(const CPVT_WordPlace & place, co AddSection(NewPlace, secinfo); newplace = NewPlace; if (CSection * pNewSection = m_SectionArray.GetAt(NewPlace.nSecIndex)) { - for (FX_INT32 w = wordplace.nWordIndex + 1, sz = pSection->m_WordArray.GetSize(); w < sz; w++) { + for (int32_t w = wordplace.nWordIndex + 1, sz = pSection->m_WordArray.GetSize(); w < sz; w++) { if (CPVT_WordInfo * pWord = pSection->m_WordArray.GetAt(w)) { NewPlace.nWordIndex++; pNewSection->AddWord(NewPlace, *pWord); @@ -920,12 +920,12 @@ CPVT_WordPlace CPDF_VariableText::InsertSection(const CPVT_WordPlace & place, co } return newplace; } -CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace & place, FX_LPCWSTR text, FX_INT32 charset, +CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace & place, FX_LPCWSTR text, int32_t charset, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pProps) { CFX_WideString swText = text; CPVT_WordPlace wp = place; - for (FX_INT32 i = 0, sz = swText.GetLength(); i < sz; i++) { + for (int32_t i = 0, sz = swText.GetLength(); i < sz; i++) { CPVT_WordPlace oldwp = wp; FX_WORD word = swText.GetAt(i); switch (word) { @@ -980,7 +980,7 @@ CPVT_WordPlace CPDF_VariableText::BackSpaceWord(const CPVT_WordPlace & place) { return ClearLeftWord(AjustLineHeader(place, TRUE)); } -void CPDF_VariableText::SetText(FX_LPCWSTR text, FX_INT32 charset, const CPVT_SecProps * pSecProps, +void CPDF_VariableText::SetText(FX_LPCWSTR text, int32_t charset, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps) { DeleteWords(CPVT_WordRange(GetBeginWordPlace(), GetEndWordPlace())); @@ -998,8 +998,8 @@ void CPDF_VariableText::SetText(FX_LPCWSTR text, FX_INT32 charset, const CPVT_Se if (CSection * pSection = m_SectionArray.GetAt(0)) { pSection->m_SecInfo = secinfo; } - FX_INT32 nCharCount = 0; - for (FX_INT32 i = 0, sz = swText.GetLength(); i < sz; i++) { + int32_t nCharCount = 0; + for (int32_t i = 0, sz = swText.GetLength(); i < sz; i++) { if (m_nLimitChar > 0 && nCharCount >= m_nLimitChar) { break; } @@ -1052,13 +1052,13 @@ void CPDF_VariableText::UpdateWordPlace(CPVT_WordPlace & place) const pSection->UpdateWordPlace(place); } } -FX_INT32 CPDF_VariableText::WordPlaceToWordIndex(const CPVT_WordPlace & place) const +int32_t CPDF_VariableText::WordPlaceToWordIndex(const CPVT_WordPlace & place) const { CPVT_WordPlace newplace = place; UpdateWordPlace(newplace); - FX_INT32 nIndex = 0; - FX_INT32 i = 0; - FX_INT32 sz = 0; + int32_t nIndex = 0; + int32_t i = 0; + int32_t sz = 0; for (i = 0, sz = m_SectionArray.GetSize(); i < sz && i < newplace.nSecIndex; i++) { if (CSection * pSection = m_SectionArray.GetAt(i)) { nIndex += pSection->m_WordArray.GetSize(); @@ -1072,12 +1072,12 @@ FX_INT32 CPDF_VariableText::WordPlaceToWordIndex(const CPVT_WordPlace & place) c } return nIndex; } -CPVT_WordPlace CPDF_VariableText::WordIndexToWordPlace(FX_INT32 index) const +CPVT_WordPlace CPDF_VariableText::WordIndexToWordPlace(int32_t index) const { CPVT_WordPlace place = GetBeginWordPlace(); - FX_INT32 nOldIndex = 0 , nIndex = 0; + int32_t nOldIndex = 0 , nIndex = 0; FX_BOOL bFind = FALSE; - for (FX_INT32 i = 0, sz = m_SectionArray.GetSize(); i < sz; i++) { + for (int32_t i = 0, sz = m_SectionArray.GetSize(); i < sz; i++) { if (CSection * pSection = m_SectionArray.GetAt(i)) { nIndex += pSection->m_WordArray.GetSize(); if (nIndex == index) { @@ -1159,9 +1159,9 @@ CPVT_WordPlace CPDF_VariableText::SearchWordPlace(const CPDF_Point & point) cons { CPDF_Point pt = OutToIn(point); CPVT_WordPlace place = GetBeginWordPlace(); - FX_INT32 nLeft = 0; - FX_INT32 nRight = m_SectionArray.GetSize() - 1; - FX_INT32 nMid = m_SectionArray.GetSize() / 2; + int32_t nLeft = 0; + int32_t nRight = m_SectionArray.GetSize() - 1; + int32_t nMid = m_SectionArray.GetSize() / 2; FX_BOOL bUp = TRUE; FX_BOOL bDown = TRUE; while (nLeft <= nRight) { @@ -1258,10 +1258,10 @@ CPVT_WordPlace CPDF_VariableText::GetSectionEndPlace(const CPVT_WordPlace & plac } return place; } -FX_INT32 CPDF_VariableText::GetTotalWords() const +int32_t CPDF_VariableText::GetTotalWords() const { - FX_INT32 nTotal = 0; - for (FX_INT32 i = 0, sz = m_SectionArray.GetSize(); i < sz; i++) + int32_t nTotal = 0; + for (int32_t i = 0, sz = m_SectionArray.GetSize(); i < sz; i++) if (CSection * pSection = m_SectionArray.GetAt(i)) { nTotal += (pSection->m_WordArray.GetSize() + PVT_RETURN_LENGTH); } @@ -1269,7 +1269,7 @@ FX_INT32 CPDF_VariableText::GetTotalWords() const } void CPDF_VariableText::ResetSectionArray() { - for (FX_INT32 s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { + for (int32_t s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { delete m_SectionArray.GetAt(s); } m_SectionArray.RemoveAll(); @@ -1279,11 +1279,8 @@ CPVT_WordPlace CPDF_VariableText::AddSection(const CPVT_WordPlace & place, const if (IsValid() && !m_bMultiLine) { return place; } - FX_INT32 nSecIndex = FPDF_MAX(FPDF_MIN(place.nSecIndex, m_SectionArray.GetSize()), 0); - CSection * pSection = FX_NEW CSection(this); - if (!pSection) { - return place; - } + int32_t nSecIndex = FPDF_MAX(FPDF_MIN(place.nSecIndex, m_SectionArray.GetSize()), 0); + CSection* pSection = new CSection(this); pSection->m_SecInfo = secinfo; pSection->SecPlace.nSecIndex = nSecIndex; if (nSecIndex == m_SectionArray.GetSize()) { @@ -1361,13 +1358,13 @@ FX_FLOAT CPDF_VariableText::GetWordFontSize(const CPVT_WordInfo & WordInfo, FX_B { return m_bRichText && WordInfo.pWordProps ? (WordInfo.pWordProps->nScriptType == PVTWORD_SCRIPT_NORMAL || bFactFontSize ? WordInfo.pWordProps->fFontSize : WordInfo.pWordProps->fFontSize * PVT_HALF) : GetFontSize(); } -FX_INT32 CPDF_VariableText::GetWordFontIndex(const CPVT_WordInfo & WordInfo) +int32_t CPDF_VariableText::GetWordFontIndex(const CPVT_WordInfo & WordInfo) { return m_bRichText && WordInfo.pWordProps ? WordInfo.pWordProps->nFontIndex : WordInfo.nFontIndex; } -FX_FLOAT CPDF_VariableText::GetWordWidth(FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord, - FX_FLOAT fCharSpace, FX_INT32 nHorzScale, - FX_FLOAT fFontSize, FX_FLOAT fWordTail, FX_INT32 nWordStyle) +FX_FLOAT CPDF_VariableText::GetWordWidth(int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord, + FX_FLOAT fCharSpace, int32_t nHorzScale, + FX_FLOAT fFontSize, FX_FLOAT fWordTail, int32_t nWordStyle) { return (GetCharWidth(nFontIndex, Word, SubWord, nWordStyle) * fFontSize * PVT_FONTSCALE + fCharSpace) * nHorzScale * PVT_PERCENT + fWordTail; } @@ -1387,11 +1384,11 @@ FX_FLOAT CPDF_VariableText::GetLineDescent(const CPVT_SectionInfo & SecInfo) return m_bRichText && SecInfo.pWordProps ? GetFontDescent(SecInfo.pWordProps->nFontIndex, SecInfo.pWordProps->fFontSize) : GetFontDescent(GetDefaultFontIndex(), GetFontSize()); } -FX_FLOAT CPDF_VariableText::GetFontAscent(FX_INT32 nFontIndex, FX_FLOAT fFontSize) +FX_FLOAT CPDF_VariableText::GetFontAscent(int32_t nFontIndex, FX_FLOAT fFontSize) { return (FX_FLOAT)GetTypeAscent(nFontIndex) * fFontSize * PVT_FONTSCALE; } -FX_FLOAT CPDF_VariableText::GetFontDescent(FX_INT32 nFontIndex, FX_FLOAT fFontSize) +FX_FLOAT CPDF_VariableText::GetFontDescent(int32_t nFontIndex, FX_FLOAT fFontSize) { return (FX_FLOAT)GetTypeDescent(nFontIndex) * fFontSize * PVT_FONTSCALE; } @@ -1419,7 +1416,7 @@ FX_FLOAT CPDF_VariableText::GetLineIndent(const CPVT_SectionInfo & SecInfo) { return m_bRichText && SecInfo.pSecProps ? SecInfo.pSecProps->fLineIndent : 0.0f; } -FX_INT32 CPDF_VariableText::GetAlignment(const CPVT_SectionInfo& SecInfo) +int32_t CPDF_VariableText::GetAlignment(const CPVT_SectionInfo& SecInfo) { return m_bRichText && SecInfo.pSecProps ? SecInfo.pSecProps->nAlignment : this->m_nAlignment; } @@ -1427,7 +1424,7 @@ FX_FLOAT CPDF_VariableText::GetCharSpace(const CPVT_WordInfo & WordInfo) { return m_bRichText && WordInfo.pWordProps ? WordInfo.pWordProps->fCharSpace : m_fCharSpace; } -FX_INT32 CPDF_VariableText::GetHorzScale(const CPVT_WordInfo & WordInfo) +int32_t CPDF_VariableText::GetHorzScale(const CPVT_WordInfo & WordInfo) { return m_bRichText && WordInfo.pWordProps ? WordInfo.pWordProps->nHorzScale : m_nHorzScale; } @@ -1435,7 +1432,7 @@ void CPDF_VariableText::ClearSectionRightWords(const CPVT_WordPlace & place) { CPVT_WordPlace wordplace = AjustLineHeader(place, TRUE); if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { - for (FX_INT32 w = pSection->m_WordArray.GetSize() - 1; w > wordplace.nWordIndex; w--) { + for (int32_t w = pSection->m_WordArray.GetSize() - 1; w > wordplace.nWordIndex; w--) { delete pSection->m_WordArray.GetAt(w); pSection->m_WordArray.RemoveAt(w); } @@ -1469,7 +1466,7 @@ FX_BOOL CPDF_VariableText::ClearEmptySection(const CPVT_WordPlace & place) void CPDF_VariableText::ClearEmptySections(const CPVT_WordRange & PlaceRange) { CPVT_WordPlace wordplace; - for (FX_INT32 s = PlaceRange.EndPos.nSecIndex; s > PlaceRange.BeginPos.nSecIndex; s--) { + for (int32_t s = PlaceRange.EndPos.nSecIndex; s > PlaceRange.BeginPos.nSecIndex; s--) { wordplace.nSecIndex = s; ClearEmptySection(wordplace); } @@ -1479,7 +1476,7 @@ void CPDF_VariableText::LinkLatterSection(const CPVT_WordPlace & place) CPVT_WordPlace oldplace = AjustLineHeader(place, TRUE); if (CSection * pNextSection = m_SectionArray.GetAt(place.nSecIndex + 1)) { if (CSection * pSection = m_SectionArray.GetAt(oldplace.nSecIndex)) { - for (FX_INT32 w = 0, sz = pNextSection->m_WordArray.GetSize(); w < sz; w++) { + for (int32_t w = 0, sz = pNextSection->m_WordArray.GetSize(); w < sz; w++) { if (CPVT_WordInfo * pWord = pNextSection->m_WordArray.GetAt(w)) { oldplace.nWordIndex ++; pSection->AddWord(oldplace, *pWord); @@ -1495,7 +1492,7 @@ void CPDF_VariableText::ClearWords(const CPVT_WordRange & PlaceRange) CPVT_WordRange NewRange; NewRange.BeginPos = AjustLineHeader(PlaceRange.BeginPos, TRUE); NewRange.EndPos = AjustLineHeader(PlaceRange.EndPos, TRUE); - for (FX_INT32 s = NewRange.EndPos.nSecIndex; s >= NewRange.BeginPos.nSecIndex; s--) { + for (int32_t s = NewRange.EndPos.nSecIndex; s >= NewRange.BeginPos.nSecIndex; s--) { if (CSection * pSection = m_SectionArray.GetAt(s)) { pSection->ClearWords(NewRange); } @@ -1558,7 +1555,7 @@ CPVT_FloatRect CPDF_VariableText::Rearrange(const CPVT_WordRange & PlaceRange) } FX_FLOAT CPDF_VariableText::GetAutoFontSize() { - FX_INT32 nTotal = sizeof(gFontSizeSteps) / sizeof(FX_BYTE); + int32_t nTotal = sizeof(gFontSizeSteps) / sizeof(uint8_t); if (IsMultiLine()) { nTotal /= 4; } @@ -1568,9 +1565,9 @@ FX_FLOAT CPDF_VariableText::GetAutoFontSize() if (GetPlateWidth() <= 0) { return 0; } - FX_INT32 nLeft = 0; - FX_INT32 nRight = nTotal - 1; - FX_INT32 nMid = nTotal / 2; + int32_t nLeft = 0; + int32_t nRight = nTotal - 1; + int32_t nMid = nTotal / 2; while (nLeft <= nRight) { if (IsBigger(gFontSizeSteps[nMid])) { nRight = nMid - 1; @@ -1588,7 +1585,7 @@ FX_BOOL CPDF_VariableText::IsBigger(FX_FLOAT fFontSize) { FX_BOOL bBigger = FALSE; CPVT_Size szTotal; - for (FX_INT32 s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { + for (int32_t s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { if (CSection * pSection = m_SectionArray.GetAt(s)) { CPVT_Size size = pSection->GetSectionSize(fFontSize); szTotal.x = FPDF_MAX(size.x, szTotal.x); @@ -1608,10 +1605,10 @@ CPVT_FloatRect CPDF_VariableText::RearrangeSections(const CPVT_WordRange & Place CPVT_WordPlace place; FX_FLOAT fPosY = 0; FX_FLOAT fOldHeight; - FX_INT32 nSSecIndex = PlaceRange.BeginPos.nSecIndex; - FX_INT32 nESecIndex = PlaceRange.EndPos.nSecIndex; + int32_t nSSecIndex = PlaceRange.BeginPos.nSecIndex; + int32_t nESecIndex = PlaceRange.EndPos.nSecIndex; CPVT_FloatRect rcRet; - for (FX_INT32 s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { + for (int32_t s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { place.nSecIndex = s; if (CSection * pSection = m_SectionArray.GetAt(s)) { pSection->SecPlace = place; @@ -1642,7 +1639,7 @@ CPVT_FloatRect CPDF_VariableText::RearrangeSections(const CPVT_WordRange & Place } return rcRet; } -FX_INT32 CPDF_VariableText::GetCharWidth(FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord, FX_INT32 nWordStyle) +int32_t CPDF_VariableText::GetCharWidth(int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord, int32_t nWordStyle) { if (m_pVTProvider) { if (SubWord > 0) { @@ -1653,19 +1650,19 @@ FX_INT32 CPDF_VariableText::GetCharWidth(FX_INT32 nFontIndex, FX_WORD Word, FX_W } return 0; } -FX_INT32 CPDF_VariableText::GetTypeAscent(FX_INT32 nFontIndex) +int32_t CPDF_VariableText::GetTypeAscent(int32_t nFontIndex) { return m_pVTProvider ? m_pVTProvider->GetTypeAscent(nFontIndex) : 0; } -FX_INT32 CPDF_VariableText::GetTypeDescent(FX_INT32 nFontIndex) +int32_t CPDF_VariableText::GetTypeDescent(int32_t nFontIndex) { return m_pVTProvider ? m_pVTProvider->GetTypeDescent(nFontIndex) : 0; } -FX_INT32 CPDF_VariableText::GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex) +int32_t CPDF_VariableText::GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex) { return m_pVTProvider ? m_pVTProvider->GetWordFontIndex(word, charset, nFontIndex) : -1; } -FX_INT32 CPDF_VariableText::GetDefaultFontIndex() +int32_t CPDF_VariableText::GetDefaultFontIndex() { return m_pVTProvider ? m_pVTProvider->GetDefaultFontIndex() : -1; } @@ -1694,7 +1691,7 @@ CPDF_VariableText_Iterator::CPDF_VariableText_Iterator(CPDF_VariableText * pVT): CPDF_VariableText_Iterator::~CPDF_VariableText_Iterator() { } -void CPDF_VariableText_Iterator::SetAt(FX_INT32 nWordIndex) +void CPDF_VariableText_Iterator::SetAt(int32_t nWordIndex) { ASSERT(m_pVT != NULL); m_CurPos = m_pVT->WordIndexToWordPlace(nWordIndex); diff --git a/core/src/fpdfdoc/pdf_vt.h b/core/src/fpdfdoc/pdf_vt.h index 9c38ffc00c..5d8b20cf52 100644 --- a/core/src/fpdfdoc/pdf_vt.h +++ b/core/src/fpdfdoc/pdf_vt.h @@ -118,7 +118,7 @@ struct CPVT_SectionInfo { } } CPVT_FloatRect rcSection; - FX_INT32 nTotalLine; + int32_t nTotalLine; CPVT_SecProps* pSecProps; CPVT_WordProps* pWordProps; }; @@ -127,9 +127,9 @@ struct CPVT_LineInfo { fLineX(0.0f), fLineY(0.0f), fLineWidth(0.0f), fLineAscent(0.0f), fLineDescent(0.0f) { } - FX_INT32 nTotalWord; - FX_INT32 nBeginWordIndex; - FX_INT32 nEndWordIndex; + int32_t nTotalWord; + int32_t nBeginWordIndex; + int32_t nEndWordIndex; FX_FLOAT fLineX; FX_FLOAT fLineY; FX_FLOAT fLineWidth; @@ -141,7 +141,7 @@ struct CPVT_WordInfo { fWordX(0.0f), fWordY(0.0f), fWordTail(0.0f), nFontIndex(-1), pWordProps(NULL) { } - CPVT_WordInfo(FX_WORD word, FX_INT32 charset, FX_INT32 fontIndex, CPVT_WordProps * pProps): + CPVT_WordInfo(FX_WORD word, int32_t charset, int32_t fontIndex, CPVT_WordProps * pProps): Word(word), nCharset(charset), fWordX(0.0f), fWordY(0.0f), fWordTail(0.0f), nFontIndex(fontIndex), pWordProps(pProps) { @@ -174,11 +174,11 @@ struct CPVT_WordInfo { } } FX_WORD Word; - FX_INT32 nCharset; + int32_t nCharset; FX_FLOAT fWordX; FX_FLOAT fWordY; FX_FLOAT fWordTail; - FX_INT32 nFontIndex; + int32_t nFontIndex; CPVT_WordProps* pWordProps; }; struct CPVT_FloatRange { @@ -235,11 +235,11 @@ public: { RemoveAll(); } - FX_INT32 GetSize() const + int32_t GetSize() const { return m_Lines.GetSize(); } - CLine * GetAt(FX_INT32 nIndex) const + CLine * GetAt(int32_t nIndex) const { return m_Lines.GetAt(nIndex); } @@ -249,13 +249,13 @@ public: } void RemoveAll() { - for (FX_INT32 i = 0, sz = GetSize(); i < sz; i++) { + for (int32_t i = 0, sz = GetSize(); i < sz; i++) { delete GetAt(i); } m_Lines.RemoveAll(); m_nTotal = 0; } - FX_INT32 Add(const CPVT_LineInfo & lineinfo) + int32_t Add(const CPVT_LineInfo & lineinfo) { if (m_nTotal >= GetSize()) { if (CLine * pLine = FX_NEW CLine) { @@ -273,14 +273,14 @@ public: } void Clear() { - for (FX_INT32 i = GetSize() - 1; i >= m_nTotal; i--) { + for (int32_t i = GetSize() - 1; i >= m_nTotal; i--) { delete GetAt(i); m_Lines.RemoveAt(i); } } private: CPVT_ArrayTemplate<CLine*> m_Lines; - FX_INT32 m_nTotal; + int32_t m_nTotal; }; class CSection { @@ -312,9 +312,9 @@ public: CLines m_LineArray; CPVT_ArrayTemplate<CPVT_WordInfo*> m_WordArray; private: - void ClearLeftWords(FX_INT32 nWordIndex); - void ClearRightWords(FX_INT32 nWordIndex); - void ClearMidWords(FX_INT32 nBeginIndex, FX_INT32 nEndIndex); + void ClearLeftWords(int32_t nWordIndex); + void ClearRightWords(int32_t nWordIndex); + void ClearMidWords(int32_t nBeginIndex, int32_t nEndIndex); CPDF_VariableText *m_pVT; }; @@ -414,7 +414,7 @@ public: { CPDF_EditContainer::SetPlateRect(rect); } - void SetAlignment(FX_INT32 nFormat = 0) + void SetAlignment(int32_t nFormat = 0) { m_nAlignment = nFormat; } @@ -422,7 +422,7 @@ public: { m_wSubWord = wSubWord; } - void SetLimitChar(FX_INT32 nLimitChar = 0) + void SetLimitChar(int32_t nLimitChar = 0) { m_nLimitChar = nLimitChar; } @@ -430,7 +430,7 @@ public: { m_fCharSpace = fCharSpace; } - void SetHorzScale(FX_INT32 nHorzScale = 100) + void SetHorzScale(int32_t nHorzScale = 100) { m_nHorzScale = nHorzScale; } @@ -446,7 +446,7 @@ public: { m_fFontSize = fFontSize; } - void SetCharArray(FX_INT32 nCharArray = 0) + void SetCharArray(int32_t nCharArray = 0) { m_nCharArray = nCharArray; } @@ -474,13 +474,13 @@ public: void RearrangeAll(); void RearrangePart(const CPVT_WordRange & PlaceRange); void ResetAll(); - void SetText(FX_LPCWSTR text, FX_INT32 charset = 1, const CPVT_SecProps * pSecProps = NULL, + void SetText(FX_LPCWSTR 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, FX_INT32 charset = 1, + 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, FX_INT32 charset = 1, + CPVT_WordPlace InsertText(const CPVT_WordPlace & place, FX_LPCWSTR 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); @@ -490,20 +490,20 @@ public: return CPDF_EditContainer::GetPlateRect(); } CPDF_Rect GetContentRect() const; - FX_INT32 GetTotalWords() const; + int32_t GetTotalWords() const; FX_FLOAT GetFontSize() const { return m_fFontSize; } - FX_INT32 GetAlignment() const + int32_t GetAlignment() const { return m_nAlignment; } - FX_INT32 GetCharArray() const + int32_t GetCharArray() const { return m_nCharArray; } - FX_INT32 GetLimitChar() const + int32_t GetLimitChar() const { return m_nLimitChar; } @@ -511,7 +511,7 @@ public: { return m_bMultiLine; } - FX_INT32 GetHorzScale() const + int32_t GetHorzScale() const { return m_nHorzScale; } @@ -532,8 +532,8 @@ public: CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace & place) const; CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace & place) const; void UpdateWordPlace(CPVT_WordPlace & place) const; - FX_INT32 WordPlaceToWordIndex(const CPVT_WordPlace & place) const; - CPVT_WordPlace WordIndexToWordPlace(FX_INT32 index) const; + int32_t WordPlaceToWordIndex(const CPVT_WordPlace & place) const; + CPVT_WordPlace WordIndexToWordPlace(int32_t index) const; FX_WORD GetPasswordChar() const { return GetSubWord(); @@ -543,11 +543,11 @@ public: return m_wSubWord; } private: - FX_INT32 GetCharWidth(FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord, FX_INT32 nWordStyle); - FX_INT32 GetTypeAscent(FX_INT32 nFontIndex); - FX_INT32 GetTypeDescent(FX_INT32 nFontIndex); - FX_INT32 GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex); - FX_INT32 GetDefaultFontIndex(); + int32_t GetCharWidth(int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord, int32_t nWordStyle); + int32_t GetTypeAscent(int32_t nFontIndex); + int32_t GetTypeDescent(int32_t nFontIndex); + int32_t GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex); + int32_t GetDefaultFontIndex(); FX_BOOL IsLatinWord(FX_WORD word); private: @@ -559,9 +559,9 @@ private: FX_BOOL GetLineInfo(const CPVT_WordPlace & place, CPVT_LineInfo & lineinfo); FX_BOOL GetSectionInfo(const CPVT_WordPlace & place, CPVT_SectionInfo & secinfo); FX_FLOAT GetWordFontSize(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize = FALSE); - FX_FLOAT GetWordWidth(FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord, - FX_FLOAT fCharSpace, FX_INT32 nHorzScale, - FX_FLOAT fFontSize, FX_FLOAT fWordTail, FX_INT32 nWordStyle); + FX_FLOAT GetWordWidth(int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord, + FX_FLOAT fCharSpace, int32_t nHorzScale, + FX_FLOAT fFontSize, FX_FLOAT fWordTail, int32_t nWordStyle); FX_FLOAT GetWordWidth(const CPVT_WordInfo & WordInfo); FX_FLOAT GetWordAscent(const CPVT_WordInfo & WordInfo, FX_FLOAT fFontSize); FX_FLOAT GetWordDescent(const CPVT_WordInfo & WordInfo, FX_FLOAT fFontSize); @@ -569,14 +569,14 @@ private: FX_FLOAT GetWordDescent(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize = FALSE); FX_FLOAT GetLineAscent(const CPVT_SectionInfo & SecInfo); FX_FLOAT GetLineDescent(const CPVT_SectionInfo & SecInfo); - FX_FLOAT GetFontAscent(FX_INT32 nFontIndex, FX_FLOAT fFontSize); - FX_FLOAT GetFontDescent(FX_INT32 nFontIndex, FX_FLOAT fFontSize); - FX_INT32 GetWordFontIndex(const CPVT_WordInfo & WordInfo); + FX_FLOAT GetFontAscent(int32_t nFontIndex, FX_FLOAT fFontSize); + FX_FLOAT GetFontDescent(int32_t nFontIndex, FX_FLOAT fFontSize); + int32_t GetWordFontIndex(const CPVT_WordInfo & WordInfo); FX_FLOAT GetCharSpace(const CPVT_WordInfo & WordInfo); - FX_INT32 GetHorzScale(const CPVT_WordInfo & WordInfo); + int32_t GetHorzScale(const CPVT_WordInfo & WordInfo); FX_FLOAT GetLineLeading(const CPVT_SectionInfo & SecInfo); FX_FLOAT GetLineIndent(const CPVT_SectionInfo & SecInfo); - FX_INT32 GetAlignment(const CPVT_SectionInfo& SecInfo); + int32_t GetAlignment(const CPVT_SectionInfo& SecInfo); void ClearSectionRightWords(const CPVT_WordPlace & place); CPVT_WordPlace AjustLineHeader(const CPVT_WordPlace & place, FX_BOOL bPrevOrNext) const; @@ -595,15 +595,15 @@ private: void ResetSectionArray(); private: CPVT_ArrayTemplate<CSection*> m_SectionArray; - FX_INT32 m_nLimitChar; - FX_INT32 m_nCharArray; + int32_t m_nLimitChar; + int32_t m_nCharArray; FX_BOOL m_bMultiLine; FX_BOOL m_bLimitWidth; FX_BOOL m_bAutoFontSize; - FX_INT32 m_nAlignment; + int32_t m_nAlignment; FX_FLOAT m_fLineLeading; FX_FLOAT m_fCharSpace; - FX_INT32 m_nHorzScale; + int32_t m_nHorzScale; FX_WORD m_wSubWord; FX_FLOAT m_fFontSize; @@ -629,7 +629,7 @@ public: FX_BOOL GetLine(CPVT_Line & line) const; FX_BOOL GetSection(CPVT_Section & section) const; FX_BOOL SetSection(const CPVT_Section & section); - void SetAt(FX_INT32 nWordIndex); + void SetAt(int32_t nWordIndex); void SetAt(const CPVT_WordPlace & place); const CPVT_WordPlace & GetAt() const { diff --git a/core/src/fpdftext/fpdf_text.cpp b/core/src/fpdftext/fpdf_text.cpp index c391524b9e..5efbe51c03 100644 --- a/core/src/fpdftext/fpdf_text.cpp +++ b/core/src/fpdftext/fpdf_text.cpp @@ -75,7 +75,7 @@ void CTextPage::ProcessObject(CPDF_PageObject* pObject) CFX_AffineMatrix matrix; pText->GetTextMatrix(&matrix); for (int i = 0; i < pText->m_nChars; i ++) { - FX_DWORD charcode = pText->m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)pText->m_pCharCodes : pText->m_pCharCodes[i]; + FX_DWORD charcode = pText->m_nChars == 1 ? (FX_DWORD)(uintptr_t)pText->m_pCharCodes : pText->m_pCharCodes[i]; if (charcode == (FX_DWORD) - 1) { continue; } @@ -113,7 +113,7 @@ void CTextPage::ProcessObject(CPDF_PageObject* pObject) int space_count = 0; FX_FLOAT last_left = 0, last_right = 0, segment_left = 0, segment_right = 0; for (int i = 0; i < pText->m_nChars; i ++) { - FX_DWORD charcode = pText->m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)pText->m_pCharCodes : pText->m_pCharCodes[i]; + FX_DWORD charcode = pText->m_nChars == 1 ? (FX_DWORD)(uintptr_t)pText->m_pCharCodes : pText->m_pCharCodes[i]; if (charcode == (FX_DWORD) - 1) { continue; } @@ -314,11 +314,11 @@ void NormalizeString(CFX_WideString& str) } CFX_WordArray order; FX_BOOL bR2L = FALSE; - FX_INT32 start = 0, count = 0, i = 0; + int32_t start = 0, count = 0, i = 0; int nR2L = 0, nL2R = 0; for (i = 0; i < str.GetLength(); i++) { if(BidiChar->AppendChar(str.GetAt(i))) { - FX_INT32 ret = BidiChar->GetBidiInfo(start, count); + int32_t ret = BidiChar->GetBidiInfo(start, count); order.Add(start); order.Add(count); order.Add(ret); @@ -332,7 +332,7 @@ void NormalizeString(CFX_WideString& str) } } if(BidiChar->EndChar()) { - FX_INT32 ret = BidiChar->GetBidiInfo(start, count); + int32_t ret = BidiChar->GetBidiInfo(start, count); order.Add(start); order.Add(count); order.Add(ret); diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp index b0c4ae2753..10bd3c8b36 100644 --- a/core/src/fpdftext/fpdf_text_int.cpp +++ b/core/src/fpdftext/fpdf_text_int.cpp @@ -652,7 +652,7 @@ void CPDF_TextPage::GetCharInfo(int index, FPDF_CHAR_INFO & info) const info.m_Matrix.Copy(charinfo.m_Matrix); return; } -void CPDF_TextPage::CheckMarkedContentObject(FX_INT32& start, FX_INT32& nCount) const +void CPDF_TextPage::CheckMarkedContentObject(int32_t& start, int32_t& nCount) const { PAGECHAR_INFO charinfo = *(PAGECHAR_INFO*)m_charList.GetAt(start); PAGECHAR_INFO charinfo2 = *(PAGECHAR_INFO*)m_charList.GetAt(start + nCount - 1); @@ -963,24 +963,24 @@ int CPDF_TextPage::GetWordBreak(int index, int direction) const } return breakPos; } -FX_INT32 CPDF_TextPage::FindTextlineFlowDirection() +int32_t CPDF_TextPage::FindTextlineFlowDirection() { if (!m_pPage) { return -1; } - const FX_INT32 nPageWidth = (FX_INT32)((CPDF_Page*)m_pPage)->GetPageWidth(); - const FX_INT32 nPageHeight = (FX_INT32)((CPDF_Page*)m_pPage)->GetPageHeight(); + const int32_t nPageWidth = (int32_t)((CPDF_Page*)m_pPage)->GetPageWidth(); + const int32_t nPageHeight = (int32_t)((CPDF_Page*)m_pPage)->GetPageHeight(); CFX_ByteArray nHorizontalMask; if (!nHorizontalMask.SetSize(nPageWidth)) { return -1; } - FX_BYTE* pDataH = nHorizontalMask.GetData(); + uint8_t* pDataH = nHorizontalMask.GetData(); CFX_ByteArray nVerticalMask; if (!nVerticalMask.SetSize(nPageHeight)) { return -1; } - FX_BYTE* pDataV = nVerticalMask.GetData(); - FX_INT32 index = 0; + uint8_t* pDataV = nVerticalMask.GetData(); + int32_t index = 0; FX_FLOAT fLineHeight = 0.0f; CPDF_PageObject* pPageObj = NULL; FX_POSITION pos = NULL; @@ -996,10 +996,10 @@ FX_INT32 CPDF_TextPage::FindTextlineFlowDirection() if(PDFPAGE_TEXT != pPageObj->m_Type) { continue; } - FX_INT32 minH = (FX_INT32)pPageObj->m_Left < 0 ? 0 : (FX_INT32)pPageObj->m_Left; - FX_INT32 maxH = (FX_INT32)pPageObj->m_Right > nPageWidth ? nPageWidth : (FX_INT32)pPageObj->m_Right; - FX_INT32 minV = (FX_INT32)pPageObj->m_Bottom < 0 ? 0 : (FX_INT32)pPageObj->m_Bottom; - FX_INT32 maxV = (FX_INT32)pPageObj->m_Top > nPageHeight ? nPageHeight : (FX_INT32)pPageObj->m_Top; + int32_t minH = (int32_t)pPageObj->m_Left < 0 ? 0 : (int32_t)pPageObj->m_Left; + int32_t maxH = (int32_t)pPageObj->m_Right > nPageWidth ? nPageWidth : (int32_t)pPageObj->m_Right; + int32_t minV = (int32_t)pPageObj->m_Bottom < 0 ? 0 : (int32_t)pPageObj->m_Bottom; + int32_t maxV = (int32_t)pPageObj->m_Top > nPageHeight ? nPageHeight : (int32_t)pPageObj->m_Top; if (minH >= maxH || minV >= maxV) { continue; } @@ -1010,8 +1010,8 @@ FX_INT32 CPDF_TextPage::FindTextlineFlowDirection() } pPageObj = NULL; } - FX_INT32 nStartH = 0; - FX_INT32 nEndH = 0; + int32_t nStartH = 0; + int32_t nEndH = 0; FX_FLOAT nSumH = 0.0f; for (index = 0; index < nPageWidth; index++) if(1 == nHorizontalMask[index]) { @@ -1027,8 +1027,8 @@ FX_INT32 CPDF_TextPage::FindTextlineFlowDirection() nSumH += nHorizontalMask[index]; } nSumH /= nEndH - nStartH; - FX_INT32 nStartV = 0; - FX_INT32 nEndV = 0; + int32_t nStartV = 0; + int32_t nEndV = 0; FX_FLOAT nSumV = 0.0f; for (index = 0; index < nPageHeight; index++) if(1 == nVerticalMask[index]) { @@ -1044,10 +1044,10 @@ FX_INT32 CPDF_TextPage::FindTextlineFlowDirection() nSumV += nVerticalMask[index]; } nSumV /= nEndV - nStartV; - if ((nEndV - nStartV) < (FX_INT32)(2 * fLineHeight)) { + if ((nEndV - nStartV) < (int32_t)(2 * fLineHeight)) { return 0; } - if ((nEndH - nStartH) < (FX_INT32)(2 * fLineHeight)) { + if ((nEndH - nStartH) < (int32_t)(2 * fLineHeight)) { return 1; } if (nSumH > 0.8f) { @@ -1141,8 +1141,8 @@ int CPDF_TextPage::GetCharWidth(FX_DWORD charCode, CPDF_Font* pFont) const } void CPDF_TextPage::OnPiece(IFX_BidiChar* pBidi, CFX_WideString& str) { - FX_INT32 start, count; - FX_INT32 ret = pBidi->GetBidiInfo(start, count); + int32_t start, count; + int32_t ret = pBidi->GetBidiInfo(start, count); if(ret == 2) { for(int i = start + count - 1; i >= start; i--) { m_TextBuf.AppendChar(str.GetAt(i)); @@ -1232,7 +1232,7 @@ void CPDF_TextPage::CloseTempLine() CFX_WideString str = m_TempTextBuf.GetWideString(); CFX_WordArray order; FX_BOOL bR2L = FALSE; - FX_INT32 start = 0, count = 0; + int32_t start = 0, count = 0; int nR2L = 0, nL2R = 0; FX_BOOL bPrevSpace = FALSE; for (int i = 0; i < str.GetLength(); i++) { @@ -1250,7 +1250,7 @@ void CPDF_TextPage::CloseTempLine() bPrevSpace = FALSE; } if(BidiChar && BidiChar->AppendChar(str.GetAt(i))) { - FX_INT32 ret = BidiChar->GetBidiInfo(start, count); + int32_t ret = BidiChar->GetBidiInfo(start, count); order.Add(start); order.Add(count); order.Add(ret); @@ -1264,7 +1264,7 @@ void CPDF_TextPage::CloseTempLine() } } if(BidiChar && BidiChar->EndChar()) { - FX_INT32 ret = BidiChar->GetBidiInfo(start, count); + int32_t ret = BidiChar->GetBidiInfo(start, count); order.Add(start); order.Add(count); order.Add(ret); @@ -1438,7 +1438,7 @@ void CPDF_TextPage::ProcessTextObject(CPDF_TextObject* pTextObj, const CFX_Affin m_LineObj.Add(Obj); } } -FX_INT32 CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) +int32_t CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) { CPDF_TextObject* pTextObj = Obj.m_pTextObj; CPDF_ContentMarkData* pMarkData = (CPDF_ContentMarkData*)pTextObj->m_ContentMark.GetObject(); @@ -1598,7 +1598,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) CFX_AffineMatrix matrix; pTextObj->GetTextMatrix(&matrix); matrix.Concat(formMatrix); - FX_INT32 bPreMKC = PreMarkedContent(Obj); + int32_t bPreMKC = PreMarkedContent(Obj); if (FPDFTEXT_MC_DONE == bPreMKC) { m_pPreTextObj = pTextObj; m_perMatrix.Copy(formMatrix); @@ -1645,7 +1645,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) } } } else if (result == 3 && !m_ParseOptions.m_bOutputHyphen) { - FX_INT32 nChars = pTextObj->CountChars(); + int32_t nChars = pTextObj->CountChars(); if (nChars == 1) { CPDF_TextObjectItem item; pTextObj->GetCharInfo(0, &item); @@ -1684,11 +1684,11 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) FX_BOOL bIsBidiAndMirrosInverse = FALSE; IFX_BidiChar* BidiChar = IFX_BidiChar::Create(); - FX_INT32 nR2L = 0; - FX_INT32 nL2R = 0; - FX_INT32 start = 0, count = 0; + int32_t nR2L = 0; + int32_t nL2R = 0; + int32_t start = 0, count = 0; CPDF_TextObjectItem item; - for (FX_INT32 i = 0; i < nItems; i++) { + for (int32_t i = 0; i < nItems; i++) { pTextObj->GetItemInfo(i, &item); if (item.m_CharCode == (FX_DWORD)-1) { continue; @@ -1702,7 +1702,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) continue; } if (BidiChar && BidiChar->AppendChar(wChar)) { - FX_INT32 ret = BidiChar->GetBidiInfo(start, count); + int32_t ret = BidiChar->GetBidiInfo(start, count); if (ret == 2) { nR2L++; } @@ -1712,7 +1712,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) } } if (BidiChar && BidiChar->EndChar()) { - FX_INT32 ret = BidiChar->GetBidiInfo(start, count); + int32_t ret = BidiChar->GetBidiInfo(start, count); if (ret == 2) { nR2L++; } @@ -1725,8 +1725,8 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) bR2L = TRUE; } bIsBidiAndMirrosInverse = bR2L && (matrix.a * matrix.d - matrix.b * matrix.c) < 0; - FX_INT32 iBufStartAppend = m_TempTextBuf.GetLength(); - FX_INT32 iCharListStartAppend = m_TempCharList.GetSize(); + int32_t iBufStartAppend = m_TempTextBuf.GetLength(); + int32_t iCharListStartAppend = m_TempCharList.GetSize(); FX_FLOAT spacing = 0; for (int i = 0; i < nItems; i++) { @@ -1870,7 +1870,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) } } if (bIsBidiAndMirrosInverse) { - FX_INT32 i, j; + int32_t i, j; i = iCharListStartAppend; j = m_TempCharList.GetSize() - 1; for (; i < j; i++, j--) { @@ -1885,9 +1885,9 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) } } } -FX_INT32 CPDF_TextPage::GetTextObjectWritingMode(const CPDF_TextObject* pTextObj) +int32_t CPDF_TextPage::GetTextObjectWritingMode(const CPDF_TextObject* pTextObj) { - FX_INT32 nChars = pTextObj->CountChars(); + int32_t nChars = pTextObj->CountChars(); if (nChars == 1) { return m_TextlineDir; } @@ -2051,7 +2051,7 @@ int CPDF_TextPage::ProcessInsertObject(const CPDF_TextObject* pObj, const CFX_Af } return 2; } - FX_INT32 nChars = pObj->CountChars(); + int32_t nChars = pObj->CountChars(); if (nChars == 1 && ( 0x2D == curChar || 0xAD == curChar)) if (IsHyphen(curChar)) { return 3; diff --git a/core/src/fpdftext/fpdf_text_search.cpp b/core/src/fpdftext/fpdf_text_search.cpp index bfd742f1ab..89e132991d 100644 --- a/core/src/fpdftext/fpdf_text_search.cpp +++ b/core/src/fpdftext/fpdf_text_search.cpp @@ -266,14 +266,14 @@ FX_BOOL CPDF_TextStream::ProcessObject(const CPDF_TextObject* pObj, FX_BOOL bFir m_Buffer.AppendChar((FX_WCHAR)item.m_CharCode); if (m_pObjArray) { m_pObjArray->Add((void*)pObj); - m_pObjArray->Add((void*)(FX_INTPTR)item_index); + m_pObjArray->Add((void*)(intptr_t)item_index); } } else { m_Buffer << unicode_str; if (m_pObjArray) { for (int i = 0; i < unicode_str.GetLength(); i ++) { m_pObjArray->Add((void*)pObj); - m_pObjArray->Add((void*)(FX_INTPTR)item_index); + m_pObjArray->Add((void*)(intptr_t)item_index); } } } diff --git a/core/src/fpdftext/text_int.h b/core/src/fpdftext/text_int.h index 59dcd329b3..03f6ce1dc8 100644 --- a/core/src/fpdftext/text_int.h +++ b/core/src/fpdftext/text_int.h @@ -33,7 +33,7 @@ typedef struct _PAGECHAR_INFO { FX_WCHAR m_Unicode; FX_FLOAT m_OriginX; FX_FLOAT m_OriginY; - FX_INT32 m_Flag; + int32_t m_Flag; CFX_FloatRect m_CharBox; CPDF_TextObject* m_pTextObj; CFX_AffineMatrix m_Matrix; @@ -108,14 +108,14 @@ private: int GetCharWidth(FX_DWORD charCode, CPDF_Font* pFont) const; void CloseTempLine(); void OnPiece(IFX_BidiChar* pBidi, CFX_WideString& str); - FX_INT32 PreMarkedContent(PDFTEXT_Obj pObj); + int32_t PreMarkedContent(PDFTEXT_Obj pObj); void ProcessMarkedContent(PDFTEXT_Obj pObj); - void CheckMarkedContentObject(FX_INT32& start, FX_INT32& nCount) const; + void CheckMarkedContentObject(int32_t& start, int32_t& nCount) const; void FindPreviousTextObject(void); void AddCharInfoByLRDirection(CFX_WideString& str, int i); void AddCharInfoByRLDirection(CFX_WideString& str, int i); - FX_INT32 GetTextObjectWritingMode(const CPDF_TextObject* pTextObj); - FX_INT32 FindTextlineFlowDirection(); + int32_t GetTextObjectWritingMode(const CPDF_TextObject* pTextObj); + int32_t FindTextlineFlowDirection(); protected: CPDFText_ParseOptions m_ParseOptions; CFX_WordArray m_CharIndex; diff --git a/core/src/fxcodec/codec/codec_int.h b/core/src/fxcodec/codec/codec_int.h index ae9f22bc4a..c50faaa936 100644 --- a/core/src/fxcodec/codec/codec_int.h +++ b/core/src/fxcodec/codec/codec_int.h @@ -17,9 +17,9 @@ class CCodec_BasicModule : public ICodec_BasicModule { public: - virtual FX_BOOL RunLengthEncode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, + virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); - virtual FX_BOOL A85Encode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, + virtual FX_BOOL A85Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc); @@ -27,7 +27,7 @@ public: struct CCodec_ImageDataCache { int m_Width, m_Height; int m_nCachedLines; - FX_BYTE m_Data; + uint8_t m_Data; }; class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder { @@ -126,10 +126,10 @@ class CCodec_FlateModule : public ICodec_FlateModule public: virtual ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE 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 FX_BYTE* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, + 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); - virtual FX_BOOL Encode(const FX_BYTE* src_buf, FX_DWORD src_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); @@ -185,12 +185,12 @@ public: virtual FX_DWORD GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr); virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size); - virtual FX_INT32 ReadHeader(void* pContext, int* width, int* height, + virtual int32_t ReadHeader(void* pContext, int* width, int* height, int* pal_num, void** pal_pp, int* bg_index, CFX_DIBAttribute* pAttribute); - virtual FX_INT32 LoadFrameInfo(void* pContext, int* frame_num); + virtual int32_t LoadFrameInfo(void* pContext, int* frame_num); - virtual FX_INT32 LoadFrame(void* pContext, int frame_num, CFX_DIBAttribute* pAttribute); + virtual int32_t LoadFrame(void* pContext, int frame_num, CFX_DIBAttribute* pAttribute); protected: FX_CHAR m_szLastError[256]; @@ -206,8 +206,8 @@ public: virtual void Finish(void* pContext); virtual FX_DWORD GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr); virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size); - virtual FX_INT32 ReadHeader(void* pContext, FX_INT32* width, FX_INT32* height, FX_BOOL* tb_flag, FX_INT32* components, FX_INT32* pal_num, FX_DWORD** pal_pp, CFX_DIBAttribute* pAttribute); - virtual FX_INT32 LoadImage(void* pContext); + virtual int32_t ReadHeader(void* pContext, int32_t* width, int32_t* height, FX_BOOL* tb_flag, int32_t* components, int32_t* pal_num, FX_DWORD** pal_pp, CFX_DIBAttribute* pAttribute); + virtual int32_t LoadImage(void* pContext); protected: FX_CHAR m_szLastError[256]; @@ -225,10 +225,10 @@ 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, FX_INT32& nComponents, FX_INT32 intent = 0, + virtual FX_LPVOID CreateTransform_sRGB(FX_LPCBYTE 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, FX_INT32& nSrcComponents, - FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, FX_INT32 intent = 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, FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT ); @@ -263,8 +263,8 @@ class CCodec_TiffModule : public ICodec_TiffModule { public: virtual FX_LPVOID CreateDecoder(IFX_FileRead* file_ptr); - virtual void GetFrames(FX_LPVOID ctx, FX_INT32& frames); - virtual FX_BOOL LoadFrameInfo(FX_LPVOID ctx, FX_INT32 frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute = NULL); + virtual void GetFrames(FX_LPVOID ctx, int32_t& frames); + virtual FX_BOOL LoadFrameInfo(FX_LPVOID ctx, int32_t frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute = NULL); virtual FX_BOOL Decode(FX_LPVOID ctx, class CFX_DIBitmap* pDIBitmap); virtual void DestroyDecoder(FX_LPVOID ctx); }; @@ -273,14 +273,14 @@ class CPDF_Jbig2Interface : public CJBig2_Module public: virtual void *JBig2_Malloc(FX_DWORD dwSize) { - return FX_Alloc(FX_BYTE, dwSize); + return FX_Alloc(uint8_t, dwSize); } virtual void *JBig2_Malloc2(FX_DWORD num, FX_DWORD dwSize) { if (dwSize && num >= UINT_MAX / dwSize) { return NULL; } - return FX_Alloc(FX_BYTE, num * dwSize); + return FX_Alloc(uint8_t, num * dwSize); } virtual void *JBig2_Malloc3(FX_DWORD num, FX_DWORD dwSize, FX_DWORD dwSize2) { @@ -291,11 +291,11 @@ public: if (size && num >= UINT_MAX / size) { return NULL; } - return FX_Alloc(FX_BYTE, num * size); + return FX_Alloc(uint8_t, num * size); } virtual void *JBig2_Realloc(FX_LPVOID pMem, FX_DWORD dwSize) { - return FX_Realloc(FX_BYTE, pMem, dwSize); + return FX_Realloc(uint8_t, pMem, dwSize); } virtual void JBig2_Free(FX_LPVOID pMem) { diff --git a/core/src/fxcodec/codec/fx_codec.cpp b/core/src/fxcodec/codec/fx_codec.cpp index 711e2898a1..5676e46be0 100644 --- a/core/src/fxcodec/codec/fx_codec.cpp +++ b/core/src/fxcodec/codec/fx_codec.cpp @@ -123,7 +123,7 @@ void CCodec_ScanlineDecoder::DownScale(int dest_width, int dest_height) FX_Free(m_pDataCache); m_pDataCache = NULL; } - m_pDataCache = (CCodec_ImageDataCache*)FX_TryAlloc(FX_BYTE, sizeof(CCodec_ImageDataCache) + m_Pitch * m_OutputHeight); + m_pDataCache = (CCodec_ImageDataCache*)FX_TryAlloc(uint8_t, sizeof(CCodec_ImageDataCache) + m_Pitch * m_OutputHeight); if (m_pDataCache == NULL) { return; } @@ -131,7 +131,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 FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, +FX_BOOL CCodec_BasicModule::RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { return FALSE; @@ -240,7 +240,7 @@ extern "C" double FXstrtod(const char* nptr, char** endptr) } return is_negative ? -ret : ret; } -FX_BOOL CCodec_BasicModule::A85Encode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, +FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { return FALSE; @@ -368,7 +368,7 @@ FX_BOOL CFX_DIBAttributeExif::ParseExifIFD(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYT wTag = m_readWord(data); data += 2; if (!pMap->Lookup(wTag, buf)) { - buf = FX_Alloc(FX_BYTE, 10); + buf = FX_Alloc(uint8_t, 10); if (buf == NULL) { return FALSE; } @@ -387,7 +387,7 @@ FX_BOOL CFX_DIBAttributeExif::ParseExifIFD(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYT wTag = m_readWord(data); data += 2; if (!pMap->Lookup(wTag, buf)) { - buf = FX_Alloc(FX_BYTE, 10); + buf = FX_Alloc(uint8_t, 10); if (buf == NULL) { return FALSE; } @@ -452,7 +452,7 @@ FX_BOOL CFX_DIBAttributeExif::ParseExif(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* case FX_SignedByte: case FX_Undefined: dwSize = dwModuleNum; - val = FX_Alloc(FX_BYTE, dwSize); + val = FX_Alloc(uint8_t, dwSize); if (val == NULL) { return FALSE; } @@ -465,7 +465,7 @@ FX_BOOL CFX_DIBAttributeExif::ParseExif(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* case FX_UnsignedShort: case FX_SignedShort: dwSize = dwModuleNum << 1; - val = FX_Alloc(FX_BYTE, dwSize); + val = FX_Alloc(uint8_t, dwSize); if (val == NULL) { return FALSE; } @@ -484,7 +484,7 @@ FX_BOOL CFX_DIBAttributeExif::ParseExif(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* case FX_SignedLong: case FX_SignedFloat: dwSize = dwModuleNum << 2; - val = FX_Alloc(FX_BYTE, dwSize); + val = FX_Alloc(uint8_t, dwSize); if (val == NULL) { return FALSE; } @@ -502,7 +502,7 @@ FX_BOOL CFX_DIBAttributeExif::ParseExif(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* case FX_UnsignedRation: case FX_SignedRation: { dwSize = dwModuleNum << 3; - buf = FX_Alloc(FX_BYTE, dwSize); + buf = FX_Alloc(uint8_t, dwSize); if (buf == NULL) { return FALSE; } @@ -512,7 +512,7 @@ FX_BOOL CFX_DIBAttributeExif::ParseExif(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* FXSYS_memcpy32(buf, head, dwSize); } temp = buf; - val = FX_Alloc(FX_BYTE, dwSize / 2); + val = FX_Alloc(uint8_t, dwSize / 2); if (val == NULL) { FX_Free(buf); return FALSE; @@ -530,7 +530,7 @@ FX_BOOL CFX_DIBAttributeExif::ParseExif(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* break; case FX_DoubleFloat: dwSize = dwModuleNum << 3; - val = FX_Alloc(FX_BYTE, dwSize); + val = FX_Alloc(uint8_t, dwSize); if (val == NULL) { return FALSE; } @@ -606,7 +606,7 @@ public: protected: FX_BOOL CheckDestSize(); void GetNextOperator(); - void UpdateOperator(FX_BYTE used_bytes); + void UpdateOperator(uint8_t used_bytes); FX_LPBYTE m_pScanline; FX_LPCBYTE m_pSrcBuf; @@ -614,7 +614,7 @@ protected: FX_DWORD m_dwLineBytes; FX_DWORD m_SrcOffset; FX_BOOL m_bEOD; - FX_BYTE m_Operator; + uint8_t m_Operator; }; CCodec_RLScanlineDecoder::CCodec_RLScanlineDecoder() : m_pScanline(NULL) @@ -673,7 +673,7 @@ FX_BOOL CCodec_RLScanlineDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, m_DownScale = 1; m_Pitch = (width * nComps * bpc + 31) / 32 * 4; m_dwLineBytes = (width * nComps * bpc + 7) / 8; - m_pScanline = FX_Alloc(FX_BYTE, m_Pitch); + m_pScanline = FX_Alloc(uint8_t, m_Pitch); return CheckDestSize(); } FX_BOOL CCodec_RLScanlineDecoder::v_Rewind() @@ -709,7 +709,7 @@ FX_LPBYTE CCodec_RLScanlineDecoder::v_GetNextLine() } FXSYS_memcpy32(m_pScanline + col_pos, m_pSrcBuf + m_SrcOffset, copy_len); col_pos += copy_len; - UpdateOperator((FX_BYTE)copy_len); + UpdateOperator((uint8_t)copy_len); } else if (m_Operator > 128) { int fill = 0; if (m_SrcOffset - 1 < m_SrcSize - 1) { @@ -722,7 +722,7 @@ FX_LPBYTE CCodec_RLScanlineDecoder::v_GetNextLine() } FXSYS_memset8(m_pScanline + col_pos, fill, duplicate_len); col_pos += duplicate_len; - UpdateOperator((FX_BYTE)duplicate_len); + UpdateOperator((uint8_t)duplicate_len); } else { m_bEOD = TRUE; break; @@ -739,7 +739,7 @@ void CCodec_RLScanlineDecoder::GetNextOperator() m_Operator = m_pSrcBuf[m_SrcOffset]; m_SrcOffset ++; } -void CCodec_RLScanlineDecoder::UpdateOperator(FX_BYTE used_bytes) +void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) { if (used_bytes == 0) { return; @@ -758,7 +758,7 @@ void CCodec_RLScanlineDecoder::UpdateOperator(FX_BYTE used_bytes) } return; } - FX_BYTE count = 257 - m_Operator; + uint8_t count = 257 - m_Operator; FXSYS_assert((FX_DWORD)count >= used_bytes); if (used_bytes == count) { m_SrcOffset ++; diff --git a/core/src/fxcodec/codec/fx_codec_bmp.cpp b/core/src/fxcodec/codec/fx_codec_bmp.cpp index 4e974e2124..924eaa91a4 100644 --- a/core/src/fxcodec/codec/fx_codec_bmp.cpp +++ b/core/src/fxcodec/codec/fx_codec_bmp.cpp @@ -33,7 +33,7 @@ static void _bmp_error_data(bmp_decompress_struct_p bmp_ptr, FX_LPCSTR err_msg) FXSYS_strncpy((char*)bmp_ptr->err_ptr, err_msg, BMP_MAX_ERROR_SIZE - 1);
longjmp(bmp_ptr->jmpbuf, 1);
}
-static void _bmp_read_scanline(bmp_decompress_struct_p bmp_ptr, FX_INT32 row_num, FX_LPBYTE row_buf)
+static void _bmp_read_scanline(bmp_decompress_struct_p bmp_ptr, int32_t row_num, FX_LPBYTE row_buf)
{
FXBMP_Context* p = (FXBMP_Context*)bmp_ptr->context_ptr;
CCodec_BmpModule* pModule = (CCodec_BmpModule*)p->parent_ptr;
@@ -47,7 +47,7 @@ static FX_BOOL _bmp_get_data_position(bmp_decompress_struct_p bmp_ptr, FX_DWORD }
void* CCodec_BmpModule::Start(void* pModule)
{
- FXBMP_Context* p = (FXBMP_Context*)FX_Alloc(FX_BYTE, sizeof(FXBMP_Context));
+ FXBMP_Context* p = (FXBMP_Context*)FX_Alloc(uint8_t, sizeof(FXBMP_Context));
if (p == NULL) {
return NULL;
}
@@ -80,13 +80,13 @@ void CCodec_BmpModule::Finish(void* pContext) p->m_FreeFunc(p);
}
}
-FX_INT32 CCodec_BmpModule::ReadHeader(void* pContext, FX_INT32* width, FX_INT32* height, FX_BOOL* tb_flag, FX_INT32* components, FX_INT32* pal_num, FX_DWORD** pal_pp, CFX_DIBAttribute* pAttribute)
+int32_t CCodec_BmpModule::ReadHeader(void* pContext, int32_t* width, int32_t* height, FX_BOOL* tb_flag, int32_t* components, int32_t* pal_num, FX_DWORD** pal_pp, CFX_DIBAttribute* pAttribute)
{
FXBMP_Context* p = (FXBMP_Context*)pContext;
if(setjmp(p->bmp_ptr->jmpbuf)) {
return 0;
}
- FX_INT32 ret = _bmp_read_header(p->bmp_ptr);
+ int32_t ret = _bmp_read_header(p->bmp_ptr);
if (ret != 1) {
return ret;
}
@@ -104,7 +104,7 @@ FX_INT32 CCodec_BmpModule::ReadHeader(void* pContext, FX_INT32* width, FX_INT32* }
return 1;
}
-FX_INT32 CCodec_BmpModule::LoadImage(void* pContext)
+int32_t CCodec_BmpModule::LoadImage(void* pContext)
{
FXBMP_Context* p = (FXBMP_Context*)pContext;
if(setjmp(p->bmp_ptr->jmpbuf)) {
diff --git a/core/src/fxcodec/codec/fx_codec_fax.cpp b/core/src/fxcodec/codec/fx_codec_fax.cpp index dc2ee2aacd..869751e05b 100644 --- a/core/src/fxcodec/codec/fx_codec_fax.cpp +++ b/core/src/fxcodec/codec/fx_codec_fax.cpp @@ -6,7 +6,7 @@ #include "../../../include/fxcodec/fx_codec.h" #include "codec_int.h" -const FX_BYTE OneLeadPos[256] = { +const uint8_t OneLeadPos[256] = { 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -24,7 +24,7 @@ const FX_BYTE OneLeadPos[256] = { 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, }; -const FX_BYTE ZeroLeadPos[256] = { +const uint8_t ZeroLeadPos[256] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -43,14 +43,14 @@ const FX_BYTE ZeroLeadPos[256] = { 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8, }; -int _FindBit(const FX_BYTE* data_buf, int max_pos, int start_pos, int bit) +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; if (start_pos % 8) { - FX_BYTE data = data_buf[start_pos / 8]; + uint8_t data = data_buf[start_pos / 8]; if (bit) { data &= 0xff >> (start_pos % 8); } else { @@ -61,7 +61,7 @@ int _FindBit(const FX_BYTE* data_buf, int max_pos, int start_pos, int bit) } start_pos += 7; } - FX_BYTE skip = bit ? 0x00 : 0xff; + uint8_t skip = bit ? 0x00 : 0xff; int byte_pos = start_pos / 8; int max_byte = (max_pos + 7) / 8; while (byte_pos < max_byte) { @@ -79,12 +79,12 @@ int _FindBit(const FX_BYTE* data_buf, int max_pos, int start_pos, int bit) } return pos; } -void _FaxG4FindB1B2(const FX_BYTE* ref_buf, int columns, int a0, FX_BOOL a0color, int& b1, int& b2) +void _FaxG4FindB1B2(const uint8_t* ref_buf, int columns, int a0, FX_BOOL a0color, int& b1, int& b2) { if (a0color) { a0color = 1; } - FX_BYTE first_bit = (a0 < 0) ? 1 : ((ref_buf[a0 / 8] & (1 << (7 - a0 % 8))) != 0); + uint8_t first_bit = (a0 < 0) ? 1 : ((ref_buf[a0 / 8] & (1 << (7 - a0 % 8))) != 0); b1 = _FindBit(ref_buf, columns, a0 + 1, !first_bit); if (b1 >= columns) { b1 = b2 = columns; @@ -136,7 +136,7 @@ void _FaxFillBits(FX_LPBYTE dest_buf, int columns, int startpos, int endpos) #define NEXTBIT src_buf[bitpos/8] & (1 << (7-bitpos%8)); bitpos ++; #define ADDBIT(code, bit) code = code << 1; if (bit) code ++; #define GETBIT(bitpos) src_buf[bitpos/8] & (1 << (7-bitpos%8)) -static const FX_BYTE FaxBlackRunIns[] = { +static const uint8_t FaxBlackRunIns[] = { 0, 2, 0x02, 3, 0, @@ -256,7 +256,7 @@ static const FX_BYTE FaxBlackRunIns[] = { 0x77, 1216 % 256, 1216 / 256, 0xff }; -static const FX_BYTE FaxWhiteRunIns[] = { +static const uint8_t FaxWhiteRunIns[] = { 0, 0, 0, @@ -375,12 +375,12 @@ static const FX_BYTE FaxWhiteRunIns[] = { 0x1f, 2560 % 256, 2560 / 256, 0xff, }; -int _FaxGetRun(FX_LPCBYTE ins_array, const FX_BYTE* src_buf, int& bitpos, int bitsize) +int _FaxGetRun(FX_LPCBYTE ins_array, const uint8_t* src_buf, int& bitpos, int bitsize) { FX_DWORD code = 0; int ins_off = 0; while (1) { - FX_BYTE ins = ins_array[ins_off++]; + uint8_t ins = ins_array[ins_off++]; if (ins == 0xff) { return -1; } @@ -400,7 +400,7 @@ int _FaxGetRun(FX_LPCBYTE ins_array, const FX_BYTE* src_buf, int& bitpos, int bi } } } -FX_BOOL _FaxG4GetRow(const FX_BYTE* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, const FX_BYTE* ref_buf, int columns) +FX_BOOL _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, const uint8_t* ref_buf, int columns) { int a0 = -1, a0color = 1; while (1) { @@ -522,7 +522,7 @@ FX_BOOL _FaxG4GetRow(const FX_BYTE* src_buf, int bitsize, int& bitpos, FX_LPBYTE a0color = !a0color; } } -FX_BOOL _FaxSkipEOL(const FX_BYTE* src_buf, int bitsize, int& bitpos) +FX_BOOL _FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos) { int startbit = bitpos; while (bitpos < bitsize) { @@ -536,7 +536,7 @@ FX_BOOL _FaxSkipEOL(const FX_BYTE* src_buf, int bitsize, int& bitpos) } return FALSE; } -FX_BOOL _FaxGet1DLine(const FX_BYTE* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns) +FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns) { int color = TRUE; int startpos = 0; @@ -621,8 +621,8 @@ FX_BOOL CCodec_FaxDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int wid m_Pitch = (m_OrigWidth + 31) / 32 * 4; m_OutputWidth = m_OrigWidth; m_OutputHeight = m_OrigHeight; - m_pScanlineBuf = FX_Alloc(FX_BYTE, m_Pitch); - m_pRefBuf = FX_Alloc(FX_BYTE, m_Pitch); + m_pScanlineBuf = FX_Alloc(uint8_t, m_Pitch); + m_pRefBuf = FX_Alloc(uint8_t, m_Pitch); m_pSrcBuf = src_buf; m_SrcSize = src_size; m_nComps = 1; @@ -698,7 +698,7 @@ extern "C" { if (pitch == 0) { pitch = (width + 7) / 8; } - FX_LPBYTE ref_buf = FX_Alloc(FX_BYTE, pitch); + FX_LPBYTE ref_buf = FX_Alloc(uint8_t, pitch); FXSYS_memset8(ref_buf, 0xff, pitch); int bitpos = *pbitpos; for (int iRow = 0; iRow < height; iRow ++) { @@ -711,7 +711,7 @@ extern "C" { *pbitpos = bitpos; } }; -static const FX_BYTE BlackRunTerminator[128] = { +static const uint8_t BlackRunTerminator[128] = { 0x37, 10, 0x02, 3, 0x03, 2, 0x02, 2, 0x03, 3, 0x03, 4, 0x02, 4, 0x03, 5, 0x05, 6, 0x04, 6, 0x04, 7, 0x05, 7, 0x07, 7, 0x04, 8, 0x07, 8, 0x18, 9, 0x17, 10, 0x18, 10, 0x08, 10, 0x67, 11, 0x68, 11, 0x6c, 11, 0x37, 11, 0x28, 11, @@ -721,14 +721,14 @@ static const FX_BYTE BlackRunTerminator[128] = { 0x64, 12, 0x65, 12, 0x52, 12, 0x53, 12, 0x24, 12, 0x37, 12, 0x38, 12, 0x27, 12, 0x28, 12, 0x58, 12, 0x59, 12, 0x2b, 12, 0x2c, 12, 0x5a, 12, 0x66, 12, 0x67, 12, }; -static const FX_BYTE BlackRunMarkup[80] = { +static const uint8_t BlackRunMarkup[80] = { 0x0f, 10, 0xc8, 12, 0xc9, 12, 0x5b, 12, 0x33, 12, 0x34, 12, 0x35, 12, 0x6c, 13, 0x6d, 13, 0x4a, 13, 0x4b, 13, 0x4c, 13, 0x4d, 13, 0x72, 13, 0x73, 13, 0x74, 13, 0x75, 13, 0x76, 13, 0x77, 13, 0x52, 13, 0x53, 13, 0x54, 13, 0x55, 13, 0x5a, 13, 0x5b, 13, 0x64, 13, 0x65, 13, 0x08, 11, 0x0c, 11, 0x0d, 11, 0x12, 12, 0x13, 12, 0x14, 12, 0x15, 12, 0x16, 12, 0x17, 12, 0x1c, 12, 0x1d, 12, 0x1e, 12, 0x1f, 12, }; -static const FX_BYTE WhiteRunTerminator[128] = { +static const uint8_t WhiteRunTerminator[128] = { 0x35, 8, 0x07, 6, 0x07, 4, @@ -794,7 +794,7 @@ static const FX_BYTE WhiteRunTerminator[128] = { 0x33, 8, 0x34, 8, }; -static const FX_BYTE WhiteRunMarkup[80] = { +static const uint8_t WhiteRunMarkup[80] = { 0x1b, 5, 0x12, 5, 0x17, 6, @@ -935,9 +935,9 @@ CCodec_FaxEncoder::CCodec_FaxEncoder(FX_LPCBYTE src_buf, int width, int height, m_Cols = width; m_Rows = height; m_Pitch = pitch; - m_pRefLine = FX_Alloc(FX_BYTE, m_Pitch); + m_pRefLine = FX_Alloc(uint8_t, m_Pitch); FXSYS_memset8(m_pRefLine, 0xff, m_Pitch); - m_pLineBuf = FX_Alloc2D(FX_BYTE, m_Pitch, 8); + m_pLineBuf = FX_Alloc2D(uint8_t, m_Pitch, 8); m_DestBuf.EstimateSize(0, 10240); } CCodec_FaxEncoder::~CCodec_FaxEncoder() @@ -952,7 +952,7 @@ CCodec_FaxEncoder::~CCodec_FaxEncoder() void CCodec_FaxEncoder::Encode(FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { int dest_bitpos = 0; - FX_BYTE last_byte = 0; + uint8_t last_byte = 0; for (int i = 0; i < m_Rows; i ++) { FX_LPCBYTE scan_line = m_pSrcBuf + i * m_Pitch; FXSYS_memset32(m_pLineBuf, 0, m_Pitch * 8); diff --git a/core/src/fxcodec/codec/fx_codec_flate.cpp b/core/src/fxcodec/codec/fx_codec_flate.cpp index 7a19e8b855..9997a570d6 100644 --- a/core/src/fxcodec/codec/fx_codec_flate.cpp +++ b/core/src/fxcodec/codec/fx_codec_flate.cpp @@ -13,7 +13,7 @@ extern "C" { static void* my_alloc_func (void* opaque, unsigned int items, unsigned int size) { - return FX_Alloc2D(FX_BYTE, items, size); + return FX_Alloc2D(uint8_t, items, size); } static void my_free_func (void* opaque, void* address) { @@ -79,22 +79,22 @@ extern "C" class CLZWDecoder { public: - FX_BOOL Decode(FX_LPBYTE output, FX_DWORD& outlen, const FX_BYTE* input, FX_DWORD& size, FX_BOOL bEarlyChange); + FX_BOOL Decode(FX_LPBYTE 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; - const FX_BYTE* m_pInput; + const uint8_t* m_pInput; FX_BOOL m_Early; - void AddCode(FX_DWORD prefix_code, FX_BYTE append_char); + void AddCode(FX_DWORD prefix_code, uint8_t append_char); FX_DWORD m_CodeArray[5021]; FX_DWORD m_nCodes; - FX_BYTE m_DecodeStack[4000]; + uint8_t m_DecodeStack[4000]; FX_DWORD m_StackLen; void DecodeString(FX_DWORD code); int m_CodeLen; }; -void CLZWDecoder::AddCode(FX_DWORD prefix_code, FX_BYTE append_char) +void CLZWDecoder::AddCode(FX_DWORD prefix_code, uint8_t append_char) { if (m_nCodes + m_Early == 4094) { return; @@ -119,15 +119,15 @@ void CLZWDecoder::DecodeString(FX_DWORD code) if (m_StackLen >= sizeof(m_DecodeStack)) { return; } - m_DecodeStack[m_StackLen++] = (FX_BYTE)data; + m_DecodeStack[m_StackLen++] = (uint8_t)data; code = data >> 16; } if (m_StackLen >= sizeof(m_DecodeStack)) { return; } - m_DecodeStack[m_StackLen++] = (FX_BYTE)code; + m_DecodeStack[m_StackLen++] = (uint8_t)code; } -int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const FX_BYTE* src_buf, FX_DWORD& src_size, FX_BOOL bEarlyChange) +int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const uint8_t* src_buf, FX_DWORD& src_size, FX_BOOL bEarlyChange) { m_CodeLen = 9; m_InPos = 0; @@ -137,7 +137,7 @@ int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const FX_BYTE* m_Early = bEarlyChange ? 1 : 0; m_nCodes = 0; FX_DWORD old_code = (FX_DWORD) - 1; - FX_BYTE last_char; + uint8_t last_char; while (1) { if (m_InPos + m_CodeLen > src_size * 8) { break; @@ -164,10 +164,10 @@ int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const FX_BYTE* return -5; } if (m_pOutput) { - m_pOutput[m_OutPos] = (FX_BYTE)code; + m_pOutput[m_OutPos] = (uint8_t)code; } m_OutPos ++; - last_char = (FX_BYTE)code; + last_char = (uint8_t)code; if (old_code != (FX_DWORD) - 1) { AddCode(old_code, last_char); } @@ -217,19 +217,19 @@ int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const FX_BYTE* src_size = (m_InPos + 7) / 8; return 0; } -static FX_BYTE PaethPredictor(int a, int b, int c) +static uint8_t PaethPredictor(int a, int b, int c) { int p = a + b - c; int pa = FXSYS_abs(p - a); int pb = FXSYS_abs(p - b); int pc = FXSYS_abs(p - c); if (pa <= pb && pa <= pc) { - return (FX_BYTE)a; + return (uint8_t)a; } if (pb <= pc) { - return (FX_BYTE)b; + return (uint8_t)b; } - return (FX_BYTE)c; + return (uint8_t)c; } static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, int predictor, int Colors, @@ -241,7 +241,7 @@ 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(FX_BYTE, row_size + 1, row_count); + FX_LPBYTE 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; @@ -262,7 +262,7 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, switch (predictor) { case 11: { pDestData[0] = 1; - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pSrcData[byte - BytesPerPixel]; } @@ -271,7 +271,7 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; case 12: { pDestData[0] = 2; - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pSrcData[byte - row_size]; } @@ -280,11 +280,11 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; case 13: { pDestData[0] = 3; - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pSrcData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pSrcData[byte - row_size]; } @@ -293,15 +293,15 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; case 14: { pDestData[0] = 4; - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pSrcData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pSrcData[byte - row_size]; } - FX_BYTE upper_left = 0; + uint8_t upper_left = 0; if (byte >= BytesPerPixel && row) { upper_left = pSrcData[byte - row_size - BytesPerPixel]; } @@ -328,16 +328,16 @@ static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE { int row_size = (nPixels * bpc * nColors + 7) / 8; int BytesPerPixel = (bpc * nColors + 7) / 8; - FX_BYTE tag = pSrcData[0]; + uint8_t tag = pSrcData[0]; if (tag == 0) { FXSYS_memmove32(pDestData, pSrcData + 1, row_size); return; } for (int byte = 0; byte < row_size; byte ++) { - FX_BYTE raw_byte = pSrcData[byte + 1]; + uint8_t raw_byte = pSrcData[byte + 1]; switch (tag) { case 1: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } @@ -345,7 +345,7 @@ static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE break; } case 2: { - FX_BYTE up = 0; + uint8_t up = 0; if (pLastLine) { up = pLastLine[byte]; } @@ -353,11 +353,11 @@ static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE break; } case 3: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (pLastLine) { up = pLastLine[byte]; } @@ -365,15 +365,15 @@ static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE break; } case 4: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (pLastLine) { up = pLastLine[byte]; } - FX_BYTE upper_left = 0; + uint8_t upper_left = 0; if (byte >= BytesPerPixel && pLastLine) { upper_left = pLastLine[byte - BytesPerPixel]; } @@ -395,12 +395,12 @@ 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(FX_BYTE, row_size, row_count); + FX_LPBYTE dest_buf = FX_Alloc2D(uint8_t, row_size, row_count); int byte_cnt = 0; FX_LPBYTE pSrcData = data_buf; FX_LPBYTE pDestData = dest_buf; for (int row = 0; row < row_count; row ++) { - FX_BYTE tag = pSrcData[0]; + uint8_t tag = pSrcData[0]; byte_cnt++; if (tag == 0) { int move_size = row_size; @@ -414,10 +414,10 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, continue; } for (int byte = 0; byte < row_size && byte_cnt < (int)data_size; byte ++) { - FX_BYTE raw_byte = pSrcData[byte + 1]; + uint8_t raw_byte = pSrcData[byte + 1]; switch (tag) { case 1: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } @@ -425,7 +425,7 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; } case 2: { - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pDestData[byte - row_size]; } @@ -433,11 +433,11 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; } case 3: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pDestData[byte - row_size]; } @@ -445,15 +445,15 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; } case 4: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pDestData[byte - row_size]; } - FX_BYTE upper_left = 0; + uint8_t upper_left = 0; if (byte >= BytesPerPixel && row) { upper_left = pDestData[byte - row_size - BytesPerPixel]; } @@ -478,7 +478,7 @@ static void TIFF_PredictorEncodeLine(FX_LPBYTE dest_buf, int row_size, int BitsP { int BytesPerPixel = BitsPerComponent * Colors / 8; if (BitsPerComponent < 8) { - FX_BYTE mask = 0x01; + uint8_t mask = 0x01; if (BitsPerComponent == 2) { mask = 0x03; } else if (BitsPerComponent == 4) { @@ -490,8 +490,8 @@ static void TIFF_PredictorEncodeLine(FX_LPBYTE dest_buf, int row_size, int BitsP int index = i / 8; int col_pre = (col == 0) ? (8 - BitsPerComponent) : (col - BitsPerComponent); int index_pre = (col == 0) ? (index - 1) : index; - FX_BYTE cur = (dest_buf[index] >> (8 - col - BitsPerComponent)) & mask; - FX_BYTE left = (dest_buf[index_pre] >> (8 - col_pre - BitsPerComponent)) & mask; + uint8_t cur = (dest_buf[index] >> (8 - col - BitsPerComponent)) & mask; + uint8_t left = (dest_buf[index_pre] >> (8 - col_pre - BitsPerComponent)) & mask; cur -= left; cur &= mask; cur <<= (8 - col - BitsPerComponent); @@ -507,7 +507,7 @@ static void TIFF_PredictorEncodeLine(FX_LPBYTE dest_buf, int row_size, int BitsP FX_WORD pixel = (dest_buf[i] << 8) | dest_buf[i + 1]; pixel -= (dest_buf[i - BytesPerPixel] << 8) | dest_buf[i - BytesPerPixel + 1]; dest_buf[i] = pixel >> 8; - dest_buf[i + 1] = (FX_BYTE)pixel; + dest_buf[i + 1] = (uint8_t)pixel; } } } @@ -553,7 +553,7 @@ static void TIFF_PredictLine(FX_LPBYTE dest_buf, int row_size, int BitsPerCompon FX_WORD pixel = (dest_buf[i - BytesPerPixel] << 8) | dest_buf[i - BytesPerPixel + 1]; pixel += (dest_buf[i] << 8) | dest_buf[i + 1]; dest_buf[i] = pixel >> 8; - dest_buf[i + 1] = (FX_BYTE)pixel; + dest_buf[i + 1] = (uint8_t)pixel; } } else { for (int i = BytesPerPixel; i < row_size; i ++) { @@ -641,7 +641,7 @@ void CCodec_FlateScanlineDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, m_bpc = bpc; m_bColorTransformed = FALSE; m_Pitch = (width * nComps * bpc + 7) / 8; - m_pScanline = FX_Alloc(FX_BYTE, m_Pitch); + m_pScanline = FX_Alloc(uint8_t, m_Pitch); m_Predictor = 0; if (predictor) { if (predictor >= 10) { @@ -659,9 +659,9 @@ void CCodec_FlateScanlineDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, m_BitsPerComponent = BitsPerComponent; m_Columns = Columns; m_PredictPitch = (m_BitsPerComponent * m_Colors * m_Columns + 7) / 8; - m_pLastLine = FX_Alloc(FX_BYTE, m_PredictPitch); - m_pPredictRaw = FX_Alloc(FX_BYTE, m_PredictPitch + 1); - m_pPredictBuffer = FX_Alloc(FX_BYTE, m_PredictPitch); + m_pLastLine = FX_Alloc(uint8_t, m_PredictPitch); + m_pPredictRaw = FX_Alloc(uint8_t, m_PredictPitch + 1); + m_pPredictBuffer = FX_Alloc(uint8_t, m_PredictPitch); } } } @@ -737,7 +737,7 @@ 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(FX_BYTE, guess_size + 1); + FX_LPBYTE guess_buf = FX_Alloc(uint8_t, guess_size + 1); FX_LPBYTE cur_buf = guess_buf; guess_buf[guess_size] = '\0'; context = FPDFAPI_FlateInit(my_alloc_func, my_free_func); @@ -746,10 +746,10 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig FPDFAPI_FlateInput(context, src_buf, src_size); if (useOldImpl) { while (1) { - FX_INT32 ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size); + int32_t ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size); if (ret != Z_OK) break; - FX_INT32 avail_buf_size = FPDFAPI_FlateGetAvailOut(context); + int32_t avail_buf_size = FPDFAPI_FlateGetAvailOut(context); if (avail_buf_size != 0) break; @@ -758,7 +758,7 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig guess_size += alloc_step; if (guess_size < old_size || guess_size + 1 < guess_size) goto fail; - guess_buf = FX_Realloc(FX_BYTE, guess_buf, guess_size + 1); + guess_buf = FX_Realloc(uint8_t, guess_buf, guess_size + 1); if (!guess_buf) goto fail; guess_buf[guess_size] = '\0'; @@ -768,7 +768,7 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig dest_size = FPDFAPI_FlateGetTotalOut(context); offset = FPDFAPI_FlateGetTotalIn(context); if (guess_size / 2 > dest_size) { - guess_buf = FX_Realloc(FX_BYTE, guess_buf, dest_size + 1); + guess_buf = FX_Realloc(uint8_t, guess_buf, dest_size + 1); if (!guess_buf) goto fail; guess_size = dest_size; @@ -778,8 +778,8 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig } else { CFX_ArrayTemplate<FX_LPBYTE> result_tmp_bufs; while (1) { - FX_INT32 ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size); - FX_INT32 avail_buf_size = FPDFAPI_FlateGetAvailOut(context); + int32_t ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size); + int32_t avail_buf_size = FPDFAPI_FlateGetAvailOut(context); if (ret != Z_OK) { last_buf_size = buf_size - avail_buf_size; result_tmp_bufs.Add(cur_buf); @@ -793,7 +793,7 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig // |avail_buf_size| == 0 case. result_tmp_bufs.Add(cur_buf); - cur_buf = FX_Alloc(FX_BYTE, buf_size + 1); + cur_buf = FX_Alloc(uint8_t, buf_size + 1); cur_buf[buf_size] = '\0'; } dest_size = FPDFAPI_FlateGetTotalOut(context); @@ -801,9 +801,9 @@ 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(FX_BYTE, dest_size); + FX_LPBYTE result_buf = FX_Alloc(uint8_t, dest_size); FX_DWORD result_pos = 0; - for (FX_INT32 i = 0; i < result_tmp_bufs.GetSize(); i++) { + for (int32_t i = 0; i < result_tmp_bufs.GetSize(); i++) { FX_LPBYTE tmp_buf = result_tmp_bufs[i]; FX_DWORD tmp_buf_size = buf_size; if (i == result_tmp_bufs.GetSize() - 1) { @@ -832,7 +832,7 @@ ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(FX_LPCBYTE src_buf, FX pDecoder->Create(src_buf, src_size, width, height, nComps, bpc, predictor, Colors, BitsPerComponent, Columns); return pDecoder; } -FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, +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) { @@ -859,7 +859,7 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_b } { nonstd::unique_ptr<CLZWDecoder> decoder(new CLZWDecoder); - dest_buf = FX_Alloc( FX_BYTE, dest_size + 1); + dest_buf = FX_Alloc( uint8_t, dest_size + 1); dest_buf[dest_size] = '\0'; decoder->Decode(dest_buf, dest_size, src_buf, offset, bEarlyChange); } @@ -879,7 +879,7 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_b } return ret ? offset : -1; } -FX_BOOL CCodec_FlateModule::Encode(const FX_BYTE* src_buf, FX_DWORD src_size, +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) { @@ -887,7 +887,7 @@ FX_BOOL CCodec_FlateModule::Encode(const FX_BYTE* src_buf, FX_DWORD src_size, return Encode(src_buf, src_size, dest_buf, dest_size); } FX_LPBYTE pSrcBuf = NULL; - pSrcBuf = FX_Alloc(FX_BYTE, src_size); + pSrcBuf = FX_Alloc(uint8_t, src_size); FXSYS_memcpy32(pSrcBuf, src_buf, src_size); FX_BOOL ret = TRUE; if (predictor == 2) { @@ -905,7 +905,7 @@ FX_BOOL CCodec_FlateModule::Encode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_BOOL CCodec_FlateModule::Encode(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { dest_size = src_size + src_size / 1000 + 12; - dest_buf = FX_Alloc( FX_BYTE, dest_size); + dest_buf = FX_Alloc( uint8_t, dest_size); unsigned long temp_size = dest_size; FPDFAPI_FlateCompress(dest_buf, &temp_size, src_buf, src_size); dest_size = (FX_DWORD)temp_size; diff --git a/core/src/fxcodec/codec/fx_codec_gif.cpp b/core/src/fxcodec/codec/fx_codec_gif.cpp index 1fc708db5c..218b58a946 100644 --- a/core/src/fxcodec/codec/fx_codec_gif.cpp +++ b/core/src/fxcodec/codec/fx_codec_gif.cpp @@ -33,7 +33,7 @@ static void _gif_error_data(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg) FXSYS_strncpy((char*)gif_ptr->err_ptr, err_msg, GIF_MAX_ERROR_SIZE - 1);
longjmp(gif_ptr->jmpbuf, 1);
}
-static FX_LPBYTE _gif_ask_buf_for_pal(gif_decompress_struct_p gif_ptr, FX_INT32 pal_size)
+static FX_LPBYTE _gif_ask_buf_for_pal(gif_decompress_struct_p gif_ptr, int32_t pal_size)
{
FXGIF_Context* p = (FXGIF_Context*)gif_ptr->context_ptr;
CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr;
@@ -47,17 +47,17 @@ static void _gif_record_current_position(gif_decompress_struct_p gif_ptr, FX_DWO CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr;
pModule->RecordCurrentPositionCallback(p->child_ptr, *cur_pos_ptr);
}
-static void _gif_read_scanline(gif_decompress_struct_p gif_ptr, FX_INT32 row_num, FX_LPBYTE row_buf)
+static void _gif_read_scanline(gif_decompress_struct_p gif_ptr, int32_t row_num, FX_LPBYTE row_buf)
{
FXGIF_Context* p = (FXGIF_Context*)gif_ptr->context_ptr;
CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr;
pModule->ReadScanlineCallback(p->child_ptr, row_num, row_buf);
}
static FX_BOOL _gif_get_record_position(gif_decompress_struct_p gif_ptr, FX_DWORD cur_pos,
- FX_INT32 left, FX_INT32 top, FX_INT32 width, FX_INT32 height,
- FX_INT32 pal_num, void* pal_ptr,
- FX_INT32 delay_time, FX_BOOL user_input,
- FX_INT32 trans_index, FX_INT32 disposal_method, FX_BOOL interlace)
+ int32_t left, int32_t top, int32_t width, int32_t height,
+ int32_t pal_num, void* pal_ptr,
+ int32_t delay_time, FX_BOOL user_input,
+ int32_t trans_index, int32_t disposal_method, FX_BOOL interlace)
{
FXGIF_Context* p = (FXGIF_Context*)gif_ptr->context_ptr;
CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr;
@@ -66,7 +66,7 @@ static FX_BOOL _gif_get_record_position(gif_decompress_struct_p gif_ptr, FX_DWOR }
void* CCodec_GifModule::Start(void* pModule)
{
- FXGIF_Context* p = (FXGIF_Context*)FX_Alloc(FX_BYTE, sizeof(FXGIF_Context));
+ FXGIF_Context* p = (FXGIF_Context*)FX_Alloc(uint8_t, sizeof(FXGIF_Context));
if (p == NULL) {
return NULL;
}
@@ -98,14 +98,14 @@ void CCodec_GifModule::Finish(void* pContext) p->m_FreeFunc(p);
}
}
-FX_INT32 CCodec_GifModule::ReadHeader(void* pContext, int* width, int* height,
+int32_t CCodec_GifModule::ReadHeader(void* pContext, int* width, int* height,
int* pal_num, void** pal_pp, int* bg_index, CFX_DIBAttribute* pAttribute)
{
FXGIF_Context* p = (FXGIF_Context*)pContext;
if(setjmp(p->gif_ptr->jmpbuf)) {
return 0;
}
- FX_INT32 ret = _gif_read_header(p->gif_ptr);
+ int32_t ret = _gif_read_header(p->gif_ptr);
if (ret != 1) {
return ret;
}
@@ -118,26 +118,26 @@ FX_INT32 CCodec_GifModule::ReadHeader(void* pContext, int* width, int* height, *bg_index = p->gif_ptr->bc_index;
return 1;
}
-FX_INT32 CCodec_GifModule::LoadFrameInfo(void* pContext, int* frame_num)
+int32_t CCodec_GifModule::LoadFrameInfo(void* pContext, int* frame_num)
{
FXGIF_Context* p = (FXGIF_Context*)pContext;
if(setjmp(p->gif_ptr->jmpbuf)) {
return 0;
}
- FX_INT32 ret = _gif_get_frame(p->gif_ptr);
+ int32_t ret = _gif_get_frame(p->gif_ptr);
if (ret != 1) {
return ret;
}
*frame_num = _gif_get_frame_num(p->gif_ptr);
return 1;
}
-FX_INT32 CCodec_GifModule::LoadFrame(void* pContext, int frame_num, CFX_DIBAttribute* pAttribute)
+int32_t CCodec_GifModule::LoadFrame(void* pContext, int frame_num, CFX_DIBAttribute* pAttribute)
{
FXGIF_Context* p = (FXGIF_Context*)pContext;
if(setjmp(p->gif_ptr->jmpbuf)) {
return 0;
}
- FX_INT32 ret = _gif_load_frame(p->gif_ptr, frame_num);
+ int32_t ret = _gif_load_frame(p->gif_ptr, frame_num);
if (ret == 1) {
if (pAttribute) {
pAttribute->m_nGifLeft = p->gif_ptr->img_ptr_arr_ptr->GetAt(frame_num)->image_info_ptr->left;
@@ -147,7 +147,7 @@ FX_INT32 CCodec_GifModule::LoadFrame(void* pContext, int frame_num, CFX_DIBAttri FX_LPCBYTE buf = (FX_LPCBYTE)p->gif_ptr->cmt_data_ptr->GetBuffer(0);
FX_DWORD len = p->gif_ptr->cmt_data_ptr->GetLength();
if (len > 21) {
- FX_BYTE size = *buf++;
+ uint8_t size = *buf++;
if (size) {
pAttribute->m_strAuthor = CFX_ByteString(buf, size);
} else {
diff --git a/core/src/fxcodec/codec/fx_codec_icc.cpp b/core/src/fxcodec/codec/fx_codec_icc.cpp index 26b4c1adfc..cde5d4c1bd 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, FX_BYTE ID[16] ) +FX_BOOL MD5ComputeID( FX_LPCVOID buf, FX_DWORD dwSize, uint8_t ID[16] ) { return cmsMD5computeIDExt(buf, dwSize, ID); } @@ -65,7 +65,7 @@ FX_BOOL CheckComponents(cmsColorSpaceSignature cs, int nComponents, FX_BOOL bDst } return TRUE; } -FX_INT32 GetCSComponents(cmsColorSpaceSignature cs) +int32_t GetCSComponents(cmsColorSpaceSignature cs) { FX_DWORD components; switch (cs) { @@ -87,8 +87,8 @@ FX_INT32 GetCSComponents(cmsColorSpaceSignature cs) } return components; } -void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, FX_DWORD dwSrcProfileSize, FX_INT32& nSrcComponents, - const unsigned char* pDstProfileData, FX_DWORD dwDstProfileSize, FX_INT32 nDstComponents, +void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, + const unsigned char* pDstProfileData, FX_DWORD dwDstProfileSize, int32_t nDstComponents, int intent, FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT) { cmsHPROFILE srcProfile = NULL; @@ -157,7 +157,7 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, FX_DWORD dwSr cmsCloseProfile(dstProfile); return pCmm; } -void* IccLib_CreateTransform_sRGB(const unsigned char* pProfileData, FX_DWORD dwProfileSize, FX_INT32& nComponents, FX_INT32 intent, FX_DWORD dwSrcFormat) +void* IccLib_CreateTransform_sRGB(const unsigned char* pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent, FX_DWORD dwSrcFormat) { return IccLib_CreateTransform(pProfileData, dwProfileSize, nComponents, NULL, 0, 3, intent, dwSrcFormat); } @@ -175,7 +175,7 @@ void IccLib_Translate(void* pTransform, FX_DWORD nSrcComponents, FX_FLOAT* pSrcV return; } CLcmsCmm* p = (CLcmsCmm*)pTransform; - FX_BYTE output[4]; + uint8_t output[4]; if (p->m_bLab) { CFX_FixedBufGrow<double, 16> inputs(nSrcComponents); double* input = inputs; @@ -184,8 +184,8 @@ void IccLib_Translate(void* pTransform, FX_DWORD nSrcComponents, FX_FLOAT* pSrcV } cmsDoTransform(p->m_hTransform, input, output, 1); } else { - CFX_FixedBufGrow<FX_BYTE, 16> inputs(nSrcComponents); - FX_BYTE* input = inputs; + CFX_FixedBufGrow<uint8_t, 16> inputs(nSrcComponents); + uint8_t* input = inputs; for (FX_DWORD i = 0; i < nSrcComponents; i ++) { if (pSrcValues[i] > 1.0f) { input[i] = 255; @@ -214,7 +214,7 @@ void IccLib_Translate(void* pTransform, FX_DWORD nSrcComponents, FX_FLOAT* pSrcV break; } } -void IccLib_TranslateImage(void* pTransform, unsigned char* pDest, const unsigned char* pSrc, FX_INT32 pixels) +void IccLib_TranslateImage(void* pTransform, unsigned char* pDest, const unsigned char* pSrc, int32_t pixels) { cmsDoTransform(((CLcmsCmm*)pTransform)->m_hTransform, (void*)pSrc, pDest, pixels); } @@ -284,7 +284,7 @@ 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(FX_BYTE, dwSize); + FX_LPBYTE pBuf = FX_Alloc(uint8_t, dwSize); pFile->ReadBlock(pBuf, 0, dwSize); cs = GetProfileCS(pBuf, dwSize); FX_Free(pBuf); @@ -406,7 +406,7 @@ FX_LPVOID CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, CFX_ByteStringKey key; CFX_ByteString text; key << pIccParam->ColorSpace << (pIccParam->dwProfileType | ic << 8); - FX_BYTE ID[16]; + uint8_t ID[16]; switch (pIccParam->dwProfileType) { case Icc_PARAMTYPE_NONE: return NULL; @@ -526,12 +526,12 @@ CCodec_IccModule::~CCodec_IccModule() } } } -void* CCodec_IccModule::CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize, FX_INT32& nComponents, FX_INT32 intent, FX_DWORD dwSrcFormat) +void* CCodec_IccModule::CreateTransform_sRGB(FX_LPCBYTE 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, FX_INT32& nSrcComponents, - FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, FX_INT32 intent, +void* CCodec_IccModule::CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, + FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent, FX_DWORD dwSrcFormat , FX_DWORD dwDstFormat) { return IccLib_CreateTransform(pSrcProfileData, dwSrcProfileSize, nSrcComponents, @@ -545,11 +545,11 @@ 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, FX_INT32 pixels) +void CCodec_IccModule::TranslateScanline(void* pTransform, FX_LPBYTE pDest, FX_LPCBYTE pSrc, int32_t pixels) { IccLib_TranslateImage(pTransform, pDest, pSrc, pixels); } -const FX_BYTE g_CMYKSamples[81 * 81 * 3] = { +const uint8_t g_CMYKSamples[81 * 81 * 3] = { 255, 255, 255, 225, 226, 228, 199, 200, 202, 173, 174, 178, 147, 149, 152, 123, 125, 128, 99, 99, 102, 69, 70, 71, 34, 30, 31, 255, 253, 229, 226, 224, 203, 200, 199, 182, 173, 173, 158, 149, 148, 135, 125, 124, 113, 99, 99, 90, 70, 69, 63, 33, 29, 24, 255, 251, 204, 228, 223, 182, 201, 198, 163, 174, 172, 142, 150, 147, 122, 125, 123, 101, 99, 98, 80, 70, 68, 54, 32, 28, 16, @@ -1280,7 +1280,7 @@ const FX_BYTE g_CMYKSamples[81 * 81 * 3] = { 53, 53, 66, 47, 44, 57, 40, 36, 48, 32, 27, 39, 22, 18, 30, 9, 4, 18, 0, 0, 3, 0, 0, 0, 0, 0, 0, 54, 53, 57, 48, 45, 49, 41, 37, 41, 33, 28, 32, 22, 19, 23, 11, 6, 10, 1, 0, 0, 0, 0, 0, 0, 0, 0, }; -void AdobeCMYK_to_sRGB1(FX_BYTE c, FX_BYTE m, FX_BYTE y, FX_BYTE k, FX_BYTE& R, FX_BYTE& G, FX_BYTE& 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) { int fix_c = c << 8; int fix_m = m << 8; @@ -1357,11 +1357,11 @@ void AdobeCMYK_to_sRGB1(FX_BYTE c, FX_BYTE m, FX_BYTE y, FX_BYTE k, FX_BYTE& R, } 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) { - FX_BYTE c1 = FXSYS_round(c * 255); - FX_BYTE m1 = FXSYS_round(m * 255); - FX_BYTE y1 = FXSYS_round(y * 255); - FX_BYTE k1 = FXSYS_round(k * 255); - FX_BYTE r, g, b; + uint8_t c1 = FXSYS_round(c * 255); + uint8_t m1 = FXSYS_round(m * 255); + uint8_t y1 = FXSYS_round(y * 255); + uint8_t k1 = FXSYS_round(k * 255); + uint8_t r, g, b; AdobeCMYK_to_sRGB1(c1, m1, y1, k1, r, g, b); R = 1.0f * r / 255; G = 1.0f * g / 255; diff --git a/core/src/fxcodec/codec/fx_codec_jbig.cpp b/core/src/fxcodec/codec/fx_codec_jbig.cpp index 8fcd9f4711..622448d659 100644 --- a/core/src/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/src/fxcodec/codec/fx_codec_jbig.cpp @@ -52,7 +52,7 @@ FX_BOOL CCodec_Jbig2Module::Decode(IFX_FileRead* file_ptr, CJBig2_Context* pContext = NULL; CJBig2_Image* dest_image = NULL; FX_DWORD src_size = (FX_DWORD)file_ptr->GetSize(); - FX_LPBYTE src_buf = FX_Alloc(FX_BYTE, src_size); + FX_LPBYTE src_buf = FX_Alloc(uint8_t, src_size); int ret = 0; if(!file_ptr->ReadBlock(src_buf, 0, src_size)) { goto failed; @@ -129,7 +129,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, IFX_FileRead m_pJbig2Context->m_bFileReader = TRUE; m_pJbig2Context->m_dest_image = NULL; m_pJbig2Context->m_src_size = (FX_DWORD)file_ptr->GetSize(); - m_pJbig2Context->m_src_buf = FX_Alloc(FX_BYTE, m_pJbig2Context->m_src_size); + m_pJbig2Context->m_src_buf = FX_Alloc(uint8_t, m_pJbig2Context->m_src_size); int ret = 0; if(!file_ptr->ReadBlock((void*)m_pJbig2Context->m_src_buf, 0, m_pJbig2Context->m_src_size)) { goto failed; diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp index 7d18cb599f..4d06a77067 100644 --- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp @@ -12,7 +12,7 @@ #include "codec_int.h" extern "C" { - static void _JpegScanSOI(const FX_BYTE*& src_buf, FX_DWORD& src_size) + static void _JpegScanSOI(const uint8_t*& src_buf, FX_DWORD& src_size) { if (src_size == 0) { return; @@ -95,8 +95,8 @@ static FX_BOOL _JpegLoadIccProfile(j_decompress_ptr cinfo, FX_LPBYTE* icc_buf_pt *icc_length = 0; FX_LPBYTE icc_data_ptr = NULL; FX_DWORD icc_data_len = 0; - FX_BYTE count_icc_marker = 0; - FX_BYTE num_icc_marker = 0; + uint8_t count_icc_marker = 0; + uint8_t num_icc_marker = 0; jpeg_saved_marker_ptr marker_list[256] = {NULL}; for (jpeg_saved_marker_ptr cur_marker = cinfo->marker_list; cur_marker != NULL; @@ -126,7 +126,7 @@ static FX_BOOL _JpegLoadIccProfile(j_decompress_ptr cinfo, FX_LPBYTE* icc_buf_pt if(num_icc_marker == 0) { return TRUE; } - icc_data_ptr = FX_Alloc(FX_BYTE, icc_data_len); + icc_data_ptr = FX_Alloc(uint8_t, icc_data_len); if(icc_buf_ptr == NULL) { return FALSE; } @@ -150,15 +150,15 @@ 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(FX_BYTE, icc_data_length); + FX_LPBYTE 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] = (FX_BYTE)icc_segment_num; - for (FX_BYTE i = 0; i < (icc_segment_num - 1); i++) { + icc_data[13] = (uint8_t)icc_segment_num; + for (uint8_t i = 0; i < (icc_segment_num - 1); i++) { icc_data[12] = i + 1; FXSYS_memcpy32(icc_data + JPEG_OVERHEAD_LEN, icc_buf_ptr + i * icc_segment_size, icc_segment_size); jpeg_write_marker(cinfo, JPEG_MARKER_ICC, icc_data, icc_data_length); } - icc_data[12] = (FX_BYTE)icc_segment_num; + icc_data[12] = (uint8_t)icc_segment_num; FX_DWORD icc_size = (icc_segment_num - 1) * icc_segment_size; FXSYS_memcpy32(icc_data + JPEG_OVERHEAD_LEN, icc_buf_ptr + icc_size, icc_length - icc_size); jpeg_write_marker(cinfo, JPEG_MARKER_ICC, icc_data, JPEG_OVERHEAD_LEN + icc_length - icc_size); @@ -206,11 +206,11 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST dest_buf = nullptr; } else { dest_buf_length = safe_buf_len.ValueOrDie(); - dest_buf = FX_TryAlloc(FX_BYTE, dest_buf_length); + dest_buf = FX_TryAlloc(uint8_t, dest_buf_length); const int MIN_TRY_BUF_LEN = 1024; while (!dest_buf && dest_buf_length > MIN_TRY_BUF_LEN) { dest_buf_length >>= 1; - dest_buf = FX_TryAlloc(FX_BYTE, dest_buf_length); + dest_buf = FX_TryAlloc(uint8_t, dest_buf_length); } } if (!dest_buf) { @@ -235,7 +235,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST } FX_LPBYTE line_buf = NULL; if (nComponents > 1) { - line_buf = FX_Alloc2D(FX_BYTE, width, nComponents); + line_buf = FX_Alloc2D(uint8_t, width, nComponents); } jpeg_set_defaults(&cinfo); if(quality != 75) { @@ -269,7 +269,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST row = cinfo.next_scanline; jpeg_write_scanlines(&cinfo, row_pointer, 1); if (cinfo.next_scanline == row) { - dest_buf = FX_Realloc(FX_BYTE, dest_buf, dest_buf_length + JPEG_BLOCK_SIZE); + dest_buf = FX_Realloc(uint8_t, dest_buf, dest_buf_length + JPEG_BLOCK_SIZE); dest.next_output_byte = dest_buf + dest_buf_length - dest.free_in_buffer; dest_buf_length += JPEG_BLOCK_SIZE; dest.free_in_buffer += JPEG_BLOCK_SIZE; @@ -477,7 +477,7 @@ FX_BOOL CCodec_JpegDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int wi return FALSE; } m_Pitch = (cinfo.image_width * cinfo.num_components + 3) / 4 * 4; - m_pScanlineBuf = FX_Alloc(FX_BYTE, m_Pitch); + m_pScanlineBuf = FX_Alloc(uint8_t, m_Pitch); m_nComps = cinfo.num_components; m_bpc = 8; m_bColorTransformed = FALSE; @@ -485,7 +485,7 @@ FX_BOOL CCodec_JpegDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int wi return TRUE; } extern "C" { - FX_INT32 FX_GetDownsampleRatio(FX_INT32 originWidth, FX_INT32 originHeight, FX_INT32 downsampleWidth, FX_INT32 downsampleHeight) + int32_t FX_GetDownsampleRatio(int32_t originWidth, int32_t originHeight, int32_t downsampleWidth, int32_t downsampleHeight) { int iratio_w = originWidth / downsampleWidth; int iratio_h = originHeight / downsampleHeight; @@ -637,7 +637,7 @@ void* CCodec_JpegModule::Start() if (m_pExtProvider) { return m_pExtProvider->Start(); } - FXJPEG_Context* p = (FXJPEG_Context*)FX_Alloc(FX_BYTE, sizeof(FXJPEG_Context)); + FXJPEG_Context* p = (FXJPEG_Context*)FX_Alloc(uint8_t, sizeof(FXJPEG_Context)); p->m_AllocFunc = jpeg_alloc_func; p->m_FreeFunc = jpeg_free_func; p->m_ErrMgr.error_exit = _error_fatal1; diff --git a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp index 1a1616c0a1..01faf67a30 100644 --- a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp @@ -714,7 +714,7 @@ FX_BOOL CJPX_Decoder::Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateCo return FALSE; } FXSYS_memset8(dest_buf, 0xff, image->y1 * pitch); - FX_BYTE** channel_bufs = FX_Alloc(FX_BYTE*, image->numcomps); + uint8_t** channel_bufs = FX_Alloc(uint8_t*, image->numcomps); FX_BOOL result = FALSE; int* adjust_comps = FX_Alloc(int, image->numcomps); for (i = 0; i < (int)image->numcomps; i ++) { @@ -742,7 +742,7 @@ FX_BOOL CJPX_Decoder::Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateCo if (adjust_comps[channel] > 0) { *pPixel = 0; } else { - *pPixel = (FX_BYTE)(src << -adjust_comps[channel]); + *pPixel = (uint8_t)(src << -adjust_comps[channel]); } } } @@ -757,7 +757,7 @@ FX_BOOL CJPX_Decoder::Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateCo src = image->comps[channel].data[row * wid + col]; src += image->comps[channel].sgnd ? 1 << (image->comps[channel].prec - 1) : 0; if (adjust_comps[channel] - 1 < 0) { - *pPixel = (FX_BYTE)((src >> adjust_comps[channel])); + *pPixel = (uint8_t)((src >> adjust_comps[channel])); } else { int tmpPixel = (src >> adjust_comps[channel]) + ((src >> (adjust_comps[channel] - 1)) % 2); if (tmpPixel > 255) { @@ -765,7 +765,7 @@ FX_BOOL CJPX_Decoder::Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateCo } else if (tmpPixel < 0) { tmpPixel = 0; } - *pPixel = (FX_BYTE)tmpPixel; + *pPixel = (uint8_t)tmpPixel; } } } diff --git a/core/src/fxcodec/codec/fx_codec_png.cpp b/core/src/fxcodec/codec/fx_codec_png.cpp index ea5ffaf68a..8cb24ba2fa 100644 --- a/core/src/fxcodec/codec/fx_codec_png.cpp +++ b/core/src/fxcodec/codec/fx_codec_png.cpp @@ -191,7 +191,7 @@ static void _png_get_row_func(png_structp png_ptr, png_bytep new_row, png_uint_3 }
void* CCodec_PngModule::Start(void* pModule)
{
- FXPNG_Context* p = (FXPNG_Context*)FX_Alloc(FX_BYTE, sizeof(FXPNG_Context));
+ FXPNG_Context* p = (FXPNG_Context*)FX_Alloc(uint8_t, sizeof(FXPNG_Context));
if(p == NULL) {
return NULL;
}
diff --git a/core/src/fxcodec/codec/fx_codec_progress.cpp b/core/src/fxcodec/codec/fx_codec_progress.cpp index 0a51a9d437..d6ef06311c 100644 --- a/core/src/fxcodec/codec/fx_codec_progress.cpp +++ b/core/src/fxcodec/codec/fx_codec_progress.cpp @@ -21,7 +21,7 @@ void CFXCODEC_WeightTable::Calc(int dest_len, int dest_min, int dest_max, int sr }
m_ItemSize = (int)(sizeof(int) * 2 + sizeof(int) * (FXSYS_ceil(FXSYS_fabs((FX_FLOAT)scale)) + 1));
m_DestMin = dest_min;
- m_pWeightTables = FX_Alloc(FX_BYTE, (dest_max - dest_min) * m_ItemSize + 4);
+ m_pWeightTables = FX_Alloc(uint8_t, (dest_max - dest_min) * m_ItemSize + 4);
if(m_pWeightTables == NULL) {
return;
}
@@ -103,7 +103,7 @@ void CFXCODEC_HorzTable::Calc(int dest_len, int src_len, FX_BOOL bInterpol) double scale = (double)dest_len / (double)src_len;
m_ItemSize = sizeof(int) * 4;
int size = dest_len * m_ItemSize + 4;
- m_pWeightTables = FX_Alloc(FX_BYTE, size);
+ m_pWeightTables = FX_Alloc(uint8_t, size);
if(m_pWeightTables == NULL) {
return;
}
@@ -160,7 +160,7 @@ void CFXCODEC_VertTable::Calc(int dest_len, int src_len) double scale = (double)dest_len / (double)src_len;
m_ItemSize = sizeof(int) * 4;
int size = dest_len * m_ItemSize + 4;
- m_pWeightTables = FX_Alloc(FX_BYTE, size);
+ m_pWeightTables = FX_Alloc(uint8_t, size);
if(m_pWeightTables == NULL) {
return;
}
@@ -288,7 +288,7 @@ FX_BOOL CCodec_ProgressiveDecoder::JpegReadMoreData(ICodec_JpegModule* pJpegModu dwSize = FXCODEC_BLOCK_SIZE;
}
m_SrcSize = (dwSize + dwAvail + FXCODEC_BLOCK_SIZE - 1) / FXCODEC_BLOCK_SIZE * FXCODEC_BLOCK_SIZE;
- m_pSrcBuf = FX_Realloc(FX_BYTE, m_pSrcBuf, m_SrcSize);
+ m_pSrcBuf = FX_Realloc(uint8_t, m_pSrcBuf, m_SrcSize);
if (!m_pSrcBuf) {
err_status = FXCODEC_STATUS_ERR_MEMORY;
return FALSE;
@@ -360,17 +360,17 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line }
if(line >= pCodec->m_clipBox.top && line < pCodec->m_clipBox.bottom) {
double scale_y = (double)pCodec->m_sizeY / (double)pCodec->m_clipBox.Height();
- FX_INT32 row = (FX_INT32)((line - pCodec->m_clipBox.top) * scale_y) + pCodec->m_startY;
+ int32_t row = (int32_t)((line - pCodec->m_clipBox.top) * scale_y) + pCodec->m_startY;
FX_LPBYTE src_scan = (FX_LPBYTE)pDIBitmap->GetScanline(row);
FX_LPBYTE des_scan = pCodec->m_pDecodeBuf;
src_buf = pCodec->m_pDecodeBuf;
- FX_INT32 src_Bpp = pDIBitmap->GetBPP() >> 3;
- FX_INT32 des_Bpp = (pCodec->m_SrcFormat & 0xff) >> 3;
- FX_INT32 src_left = pCodec->m_startX;
- FX_INT32 des_left = pCodec->m_clipBox.left;
+ int32_t src_Bpp = pDIBitmap->GetBPP() >> 3;
+ int32_t des_Bpp = (pCodec->m_SrcFormat & 0xff) >> 3;
+ int32_t src_left = pCodec->m_startX;
+ int32_t des_left = pCodec->m_clipBox.left;
src_scan += src_left * src_Bpp;
des_scan += des_left * des_Bpp;
- for (FX_INT32 src_col = 0; src_col < pCodec->m_sizeX; src_col++) {
+ for (int32_t src_col = 0; src_col < pCodec->m_sizeX; src_col++) {
PixelWeight* pPixelWeights = pCodec->m_WeightHorzOO.GetPixelWeight(src_col);
if(pPixelWeights->m_SrcStart != pPixelWeights->m_SrcEnd) {
continue;
@@ -387,7 +387,7 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line }
FX_DWORD des_g = 0;
des_g += pPixelWeights->m_Weights[0] * src_scan[src_col];
- des_scan[pPixelWeights->m_SrcStart] = (FX_BYTE)(des_g >> 16);
+ des_scan[pPixelWeights->m_SrcStart] = (uint8_t)(des_g >> 16);
}
break;
case FXDIB_Rgb:
@@ -398,9 +398,9 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line des_g += pPixelWeights->m_Weights[0] * (*p++);
des_r += pPixelWeights->m_Weights[0] * (*p);
FX_LPBYTE pDes = &des_scan[pPixelWeights->m_SrcStart * des_Bpp];
- *pDes++ = (FX_BYTE)((des_b) >> 16);
- *pDes++ = (FX_BYTE)((des_g) >> 16);
- *pDes = (FX_BYTE)((des_r) >> 16);
+ *pDes++ = (uint8_t)((des_b) >> 16);
+ *pDes++ = (uint8_t)((des_g) >> 16);
+ *pDes = (uint8_t)((des_r) >> 16);
}
break;
case FXDIB_Argb: {
@@ -410,9 +410,9 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line des_g += pPixelWeights->m_Weights[0] * (*p++);
des_r += pPixelWeights->m_Weights[0] * (*p++);
FX_LPBYTE pDes = &des_scan[pPixelWeights->m_SrcStart * des_Bpp];
- *pDes++ = (FX_BYTE)((des_b) >> 16);
- *pDes++ = (FX_BYTE)((des_g) >> 16);
- *pDes++ = (FX_BYTE)((des_r) >> 16);
+ *pDes++ = (uint8_t)((des_b) >> 16);
+ *pDes++ = (uint8_t)((des_g) >> 16);
+ *pDes++ = (uint8_t)((des_r) >> 16);
*pDes = *p;
}
break;
@@ -423,16 +423,16 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line }
return TRUE;
}
-void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap, FX_INT32 des_line, FX_LPBYTE src_scan, FXCodec_Format src_format)
+void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap, int32_t des_line, FX_LPBYTE src_scan, FXCodec_Format src_format)
{
FX_LPBYTE des_scan = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_line);
- FX_INT32 src_Bpp = (m_SrcFormat & 0xff) >> 3;
- FX_INT32 des_Bpp = pDeviceBitmap->GetBPP() >> 3;
- FX_INT32 src_left = m_clipBox.left;
- FX_INT32 des_left = m_startX;
+ int32_t src_Bpp = (m_SrcFormat & 0xff) >> 3;
+ int32_t des_Bpp = pDeviceBitmap->GetBPP() >> 3;
+ int32_t src_left = m_clipBox.left;
+ int32_t des_left = m_startX;
src_scan += src_left * src_Bpp;
des_scan += des_left * des_Bpp;
- for (FX_INT32 des_col = 0; des_col < m_sizeX; des_col++) {
+ for (int32_t des_col = 0; des_col < m_sizeX; des_col++) {
PixelWeight* pPixelWeights = m_WeightHorzOO.GetPixelWeight(des_col);
switch(pDeviceBitmap->GetFormat()) {
case FXDIB_1bppMask:
@@ -447,7 +447,7 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBi FX_DWORD des_g = 0;
des_g += pPixelWeights->m_Weights[0] * src_scan[pPixelWeights->m_SrcStart];
des_g += pPixelWeights->m_Weights[1] * src_scan[pPixelWeights->m_SrcEnd];
- *des_scan++ = (FX_BYTE)(des_g >> 16);
+ *des_scan++ = (uint8_t)(des_g >> 16);
}
break;
case FXDIB_Rgb:
@@ -462,9 +462,9 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBi des_b += pPixelWeights->m_Weights[1] * (*p++);
des_g += pPixelWeights->m_Weights[1] * (*p++);
des_r += pPixelWeights->m_Weights[1] * (*p);
- *des_scan++ = (FX_BYTE)((des_b) >> 16);
- *des_scan++ = (FX_BYTE)((des_g) >> 16);
- *des_scan++ = (FX_BYTE)((des_r) >> 16);
+ *des_scan++ = (uint8_t)((des_b) >> 16);
+ *des_scan++ = (uint8_t)((des_g) >> 16);
+ *des_scan++ = (uint8_t)((des_r) >> 16);
des_scan += des_Bpp - 3;
}
break;
@@ -481,10 +481,10 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBi des_g += pPixelWeights->m_Weights[1] * (*p++);
des_r += pPixelWeights->m_Weights[1] * (*p++);
des_a += pPixelWeights->m_Weights[1] * (*p);
- *des_scan++ = (FX_BYTE)((des_b) >> 16);
- *des_scan++ = (FX_BYTE)((des_g) >> 16);
- *des_scan++ = (FX_BYTE)((des_r) >> 16);
- *des_scan++ = (FX_BYTE)((des_a) >> 16);
+ *des_scan++ = (uint8_t)((des_b) >> 16);
+ *des_scan++ = (uint8_t)((des_g) >> 16);
+ *des_scan++ = (uint8_t)((des_r) >> 16);
+ *des_scan++ = (uint8_t)((des_a) >> 16);
}
break;
default:
@@ -532,7 +532,7 @@ FX_BOOL CCodec_ProgressiveDecoder::GifReadMoreData(ICodec_GifModule* pGifModule, dwSize = FXCODEC_BLOCK_SIZE;
}
m_SrcSize = (dwSize + dwAvail + FXCODEC_BLOCK_SIZE - 1) / FXCODEC_BLOCK_SIZE * FXCODEC_BLOCK_SIZE;
- m_pSrcBuf = FX_Realloc(FX_BYTE, m_pSrcBuf, m_SrcSize);
+ m_pSrcBuf = FX_Realloc(uint8_t, m_pSrcBuf, m_SrcSize);
if (!m_pSrcBuf) {
err_status = FXCODEC_STATUS_ERR_MEMORY;
return FALSE;
@@ -560,14 +560,14 @@ void CCodec_ProgressiveDecoder::GifRecordCurrentPositionCallback(void* pModule, FX_DWORD remain_size = pCodec->m_pCodecMgr->GetGifModule()->GetAvailInput(pCodec->m_pGifContext);
cur_pos = pCodec->m_offSet - remain_size;
}
-FX_LPBYTE CCodec_ProgressiveDecoder::GifAskLocalPaletteBufCallback(void* pModule, FX_INT32 frame_num, FX_INT32 pal_size)
+FX_LPBYTE CCodec_ProgressiveDecoder::GifAskLocalPaletteBufCallback(void* pModule, int32_t frame_num, int32_t pal_size)
{
- return FX_Alloc(FX_BYTE, pal_size);
+ return FX_Alloc(uint8_t, pal_size);
}
FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback(void* pModule, FX_DWORD rcd_pos, const FX_RECT& img_rc,
- FX_INT32 pal_num, void* pal_ptr,
- FX_INT32 delay_time, FX_BOOL user_input,
- FX_INT32 trans_index, FX_INT32 disposal_method, FX_BOOL interlace)
+ int32_t pal_num, void* pal_ptr,
+ int32_t delay_time, FX_BOOL user_input,
+ int32_t trans_index, int32_t disposal_method, FX_BOOL interlace)
{
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
pCodec->m_offSet = rcd_pos;
@@ -599,7 +599,7 @@ FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback(void* pModu pCodec->m_GifTransIndex = trans_index;
pCodec->m_GifFrameRect = img_rc;
pCodec->m_SrcPassNumber = interlace ? 4 : 1;
- FX_INT32 pal_index = pCodec->m_GifBgIndex;
+ int32_t pal_index = pCodec->m_GifBgIndex;
CFX_DIBitmap* pDevice = pCodec->m_pDeviceBitmap;
if (trans_index >= pal_num) {
trans_index = -1;
@@ -620,7 +620,7 @@ FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback(void* pModu FX_LPBYTE pScanline = (FX_LPBYTE)pDevice->GetScanline(row + startY) + startX * Bpp;
switch(pCodec->m_TransMethod) {
case 3: {
- FX_BYTE gray = FXRGB2GRAY(FXARGB_R(argb), FXARGB_G(argb), FXARGB_B(argb));
+ uint8_t gray = FXRGB2GRAY(FXARGB_R(argb), FXARGB_G(argb), FXARGB_B(argb));
FXSYS_memset8(pScanline, gray, sizeX);
break;
}
@@ -644,12 +644,12 @@ FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback(void* pModu }
return TRUE;
}
-void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule, FX_INT32 row_num, FX_LPBYTE row_buf)
+void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule, int32_t row_num, FX_LPBYTE row_buf)
{
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
CFX_DIBitmap* pDIBitmap = pCodec->m_pDeviceBitmap;
ASSERT(pDIBitmap != NULL);
- FX_INT32 img_width = pCodec->m_GifFrameRect.Width();
+ int32_t img_width = pCodec->m_GifFrameRect.Width();
if (!pDIBitmap->HasAlpha()) {
FX_LPBYTE byte_ptr = row_buf;
for (int i = 0; i < img_width; i++ ) {
@@ -659,14 +659,14 @@ void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule, FX_INT32 byte_ptr++;
}
}
- FX_INT32 pal_index = pCodec->m_GifBgIndex;
+ int32_t pal_index = pCodec->m_GifBgIndex;
if (pCodec->m_GifTransIndex != -1 && pCodec->m_pDeviceBitmap->HasAlpha()) {
pal_index = pCodec->m_GifTransIndex;
}
FXSYS_memset8(pCodec->m_pDecodeBuf, pal_index, pCodec->m_SrcWidth);
FX_BOOL bLastPass = ((row_num % 2) == 1) ? TRUE : FALSE;
- FX_INT32 line = row_num + pCodec->m_GifFrameRect.top;
- FX_INT32 left = pCodec->m_GifFrameRect.left;
+ int32_t line = row_num + pCodec->m_GifFrameRect.top;
+ int32_t left = pCodec->m_GifFrameRect.left;
FXSYS_memcpy32(pCodec->m_pDecodeBuf + left, row_buf, img_width);
int src_top = pCodec->m_clipBox.top;
int src_bottom = pCodec->m_clipBox.bottom;
@@ -732,7 +732,7 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceB int des_g = 0;
des_g += pWeight->m_Weights[0] * (*scan_src1++);
des_g += pWeight->m_Weights[1] * (*scan_src2++);
- *scan_des++ = (FX_BYTE)(des_g >> 16);
+ *scan_des++ = (uint8_t)(des_g >> 16);
}
break;
case FXDIB_Rgb:
@@ -746,9 +746,9 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceB des_g += pWeight->m_Weights[1] * (*scan_src2++);
des_r += pWeight->m_Weights[1] * (*scan_src2++);
scan_src2 += des_Bpp - 3;
- *scan_des++ = (FX_BYTE)((des_b) >> 16);
- *scan_des++ = (FX_BYTE)((des_g) >> 16);
- *scan_des++ = (FX_BYTE)((des_r) >> 16);
+ *scan_des++ = (uint8_t)((des_b) >> 16);
+ *scan_des++ = (uint8_t)((des_g) >> 16);
+ *scan_des++ = (uint8_t)((des_r) >> 16);
scan_des += des_Bpp - 3;
}
break;
@@ -762,10 +762,10 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceB des_g += pWeight->m_Weights[1] * (*scan_src2++);
des_r += pWeight->m_Weights[1] * (*scan_src2++);
des_a += pWeight->m_Weights[1] * (*scan_src2++);
- *scan_des++ = (FX_BYTE)((des_b) >> 16);
- *scan_des++ = (FX_BYTE)((des_g) >> 16);
- *scan_des++ = (FX_BYTE)((des_r) >> 16);
- *scan_des++ = (FX_BYTE)((des_a) >> 16);
+ *scan_des++ = (uint8_t)((des_b) >> 16);
+ *scan_des++ = (uint8_t)((des_g) >> 16);
+ *scan_des++ = (uint8_t)((des_r) >> 16);
+ *scan_des++ = (uint8_t)((des_a) >> 16);
}
break;
default:
@@ -791,7 +791,7 @@ FX_BOOL CCodec_ProgressiveDecoder::BmpReadMoreData(ICodec_BmpModule* pBmpModule, dwSize = FXCODEC_BLOCK_SIZE;
}
m_SrcSize = (dwSize + dwAvail + FXCODEC_BLOCK_SIZE - 1) / FXCODEC_BLOCK_SIZE * FXCODEC_BLOCK_SIZE;
- m_pSrcBuf = FX_Realloc(FX_BYTE, m_pSrcBuf, m_SrcSize);
+ m_pSrcBuf = FX_Realloc(uint8_t, m_pSrcBuf, m_SrcSize);
if (!m_pSrcBuf) {
err_status = FXCODEC_STATUS_ERR_MEMORY;
return FALSE;
@@ -823,7 +823,7 @@ FX_BOOL CCodec_ProgressiveDecoder::BmpInputImagePositionBufCallback(void* pModul }
return TRUE;
}
-void CCodec_ProgressiveDecoder::BmpReadScanlineCallback(void* pModule, FX_INT32 row_num, FX_LPBYTE row_buf)
+void CCodec_ProgressiveDecoder::BmpReadScanlineCallback(void* pModule, int32_t row_num, FX_LPBYTE row_buf)
{
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
CFX_DIBitmap* pDIBitmap = pCodec->m_pDeviceBitmap;
@@ -887,7 +887,7 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, doub int des_g = 0;
des_g += pWeight->m_Weights[0] * (*scan_src1++);
des_g += pWeight->m_Weights[1] * (*scan_src2++);
- *scan_des++ = (FX_BYTE)(des_g >> 16);
+ *scan_des++ = (uint8_t)(des_g >> 16);
}
break;
case FXDIB_Rgb:
@@ -901,9 +901,9 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, doub des_g += pWeight->m_Weights[1] * (*scan_src2++);
des_r += pWeight->m_Weights[1] * (*scan_src2++);
scan_src2 += des_Bpp - 3;
- *scan_des++ = (FX_BYTE)((des_b) >> 16);
- *scan_des++ = (FX_BYTE)((des_g) >> 16);
- *scan_des++ = (FX_BYTE)((des_r) >> 16);
+ *scan_des++ = (uint8_t)((des_b) >> 16);
+ *scan_des++ = (uint8_t)((des_g) >> 16);
+ *scan_des++ = (uint8_t)((des_r) >> 16);
scan_des += des_Bpp - 3;
}
break;
@@ -917,10 +917,10 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, doub des_g += pWeight->m_Weights[1] * (*scan_src2++);
des_r += pWeight->m_Weights[1] * (*scan_src2++);
des_a += pWeight->m_Weights[1] * (*scan_src2++);
- *scan_des++ = (FX_BYTE)((des_b) >> 16);
- *scan_des++ = (FX_BYTE)((des_g) >> 16);
- *scan_des++ = (FX_BYTE)((des_r) >> 16);
- *scan_des++ = (FX_BYTE)((des_a) >> 16);
+ *scan_des++ = (uint8_t)((des_b) >> 16);
+ *scan_des++ = (uint8_t)((des_g) >> 16);
+ *scan_des++ = (uint8_t)((des_r) >> 16);
+ *scan_des++ = (uint8_t)((des_a) >> 16);
}
break;
default:
@@ -940,7 +940,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, FX_Free(m_pSrcBuf);
m_pSrcBuf = NULL;
}
- m_pSrcBuf = FX_Alloc(FX_BYTE, size);
+ m_pSrcBuf = FX_Alloc(uint8_t, size);
if(m_pSrcBuf == NULL) {
m_status = FXCODEC_STATUS_ERR_MEMORY;
return FALSE;
@@ -969,7 +969,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, m_offSet += size;
pBmpModule->Input(m_pBmpContext, m_pSrcBuf, size);
FX_DWORD* pPalette = NULL;
- FX_INT32 readResult = pBmpModule->ReadHeader(m_pBmpContext, &m_SrcWidth, &m_SrcHeight, &m_BmpIsTopBottom,
+ int32_t readResult = pBmpModule->ReadHeader(m_pBmpContext, &m_SrcWidth, &m_SrcHeight, &m_BmpIsTopBottom,
&m_SrcComponents, &m_SrcPaletteNumber, &pPalette, pAttribute);
while(readResult == 2) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_FORMAT;
@@ -1023,7 +1023,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, }
m_offSet += size;
pJpegModule->Input(m_pJpegContext, m_pSrcBuf, size);
- FX_INT32 readResult = pJpegModule->ReadHeader(m_pJpegContext, &m_SrcWidth, &m_SrcHeight, &m_SrcComponents, pAttribute);
+ int32_t readResult = pJpegModule->ReadHeader(m_pJpegContext, &m_SrcWidth, &m_SrcHeight, &m_SrcComponents, pAttribute);
while(readResult == 2) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_FORMAT;
if(!JpegReadMoreData(pJpegModule, error_status)) {
@@ -1079,7 +1079,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, }
if(m_pSrcBuf != NULL && input_size > m_SrcSize) {
FX_Free(m_pSrcBuf);
- m_pSrcBuf = FX_Alloc(FX_BYTE, input_size);
+ m_pSrcBuf = FX_Alloc(uint8_t, input_size);
if(m_pSrcBuf == NULL) {
m_status = FXCODEC_STATUS_ERR_MEMORY;
return FALSE;
@@ -1129,7 +1129,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, m_offSet += size;
pGifModule->Input(m_pGifContext, m_pSrcBuf, size);
m_SrcComponents = 1;
- FX_INT32 readResult = pGifModule->ReadHeader(m_pGifContext, &m_SrcWidth, &m_SrcHeight,
+ int32_t readResult = pGifModule->ReadHeader(m_pGifContext, &m_SrcWidth, &m_SrcHeight,
&m_GifPltNumber, (void**)&m_pGifPalette, &m_GifBgIndex);
while(readResult == 2) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_FORMAT;
@@ -1164,7 +1164,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, m_status = FXCODEC_STATUS_ERR_FORMAT;
return FALSE;
}
- FX_INT32 frames = 0;
+ int32_t frames = 0;
pTiffModule->GetFrames(m_pTiffContext, frames);
FX_DWORD bpc;
FX_BOOL ret = pTiffModule->LoadFrameInfo(m_pTiffContext, 0, (FX_DWORD&)m_SrcWidth, (FX_DWORD&)m_SrcHeight, (FX_DWORD&)m_SrcComponents, bpc, pAttribute);
@@ -1380,7 +1380,7 @@ void CCodec_ProgressiveDecoder::GetTransMethod(FXDIB_Format des_format, FXCodec_ void _RGB2BGR(FX_LPBYTE buffer, int width = 1)
{
if (buffer && width > 0) {
- FX_BYTE temp;
+ uint8_t temp;
int i = 0;
int j = 0;
for (; i < width; i++, j += 3) {
@@ -1416,7 +1416,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
des_g += pixel_weight * src_scan[j];
}
- *des_scan++ = (FX_BYTE)(des_g >> 16);
+ *des_scan++ = (uint8_t)(des_g >> 16);
}
break;
case 3: {
@@ -1424,11 +1424,11 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j ++) {
int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
unsigned long argb = m_pSrcPalette[src_scan[j]];
- des_r += pixel_weight * (FX_BYTE)(argb >> 16);
- des_g += pixel_weight * (FX_BYTE)(argb >> 8);
- des_b += pixel_weight * (FX_BYTE)argb;
+ des_r += pixel_weight * (uint8_t)(argb >> 16);
+ des_g += pixel_weight * (uint8_t)(argb >> 8);
+ des_b += pixel_weight * (uint8_t)argb;
}
- *des_scan++ = (FX_BYTE)FXRGB2GRAY((des_r >> 16), (des_g >> 16), (des_b >> 16));
+ *des_scan++ = (uint8_t)FXRGB2GRAY((des_r >> 16), (des_g >> 16), (des_b >> 16));
}
break;
case 4: {
@@ -1440,7 +1440,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in des_g += pixel_weight * (*src_pixel++);
des_r += pixel_weight * (*src_pixel);
}
- *des_scan++ = (FX_BYTE)FXRGB2GRAY((des_r >> 16), (des_g >> 16), (des_b >> 16));
+ *des_scan++ = (uint8_t)FXRGB2GRAY((des_r >> 16), (des_g >> 16), (des_b >> 16));
}
break;
case 5: {
@@ -1448,14 +1448,14 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in 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 * src_Bpp;
- FX_BYTE src_b = 0, src_g = 0, src_r = 0;
+ uint8_t src_b = 0, src_g = 0, src_r = 0;
AdobeCMYK_to_sRGB1(255 - src_pixel[0], 255 - src_pixel[1], 255 - src_pixel[2], 255 - src_pixel[3],
src_r, src_g, src_b);
des_b += pixel_weight * src_b;
des_g += pixel_weight * src_g;
des_r += pixel_weight * src_r;
}
- *des_scan++ = (FX_BYTE)FXRGB2GRAY((des_r >> 16), (des_g >> 16), (des_b >> 16));
+ *des_scan++ = (uint8_t)FXRGB2GRAY((des_r >> 16), (des_g >> 16), (des_b >> 16));
}
break;
case 6:
@@ -1466,7 +1466,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
des_g += pixel_weight * src_scan[j];
}
- FXSYS_memset8(des_scan, (FX_BYTE)(des_g >> 16), 3);
+ FXSYS_memset8(des_scan, (uint8_t)(des_g >> 16), 3);
des_scan += des_Bpp;
}
break;
@@ -1475,13 +1475,13 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j ++) {
int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
unsigned long argb = m_pSrcPalette[src_scan[j]];
- des_r += pixel_weight * (FX_BYTE)(argb >> 16);
- des_g += pixel_weight * (FX_BYTE)(argb >> 8);
- des_b += pixel_weight * (FX_BYTE)argb;
+ des_r += pixel_weight * (uint8_t)(argb >> 16);
+ des_g += pixel_weight * (uint8_t)(argb >> 8);
+ des_b += pixel_weight * (uint8_t)argb;
}
- *des_scan++ = (FX_BYTE)((des_b) >> 16);
- *des_scan++ = (FX_BYTE)((des_g) >> 16);
- *des_scan++ = (FX_BYTE)((des_r) >> 16);
+ *des_scan++ = (uint8_t)((des_b) >> 16);
+ *des_scan++ = (uint8_t)((des_g) >> 16);
+ *des_scan++ = (uint8_t)((des_r) >> 16);
des_scan += des_Bpp - 3;
}
break;
@@ -1491,28 +1491,28 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j ++) {
int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
unsigned long argb = m_pSrcPalette[src_scan[j]];
- des_r += pixel_weight * (FX_BYTE)(argb >> 16);
- des_g += pixel_weight * (FX_BYTE)(argb >> 8);
- des_b += pixel_weight * (FX_BYTE)argb;
+ des_r += pixel_weight * (uint8_t)(argb >> 16);
+ des_g += pixel_weight * (uint8_t)(argb >> 8);
+ des_b += pixel_weight * (uint8_t)argb;
}
- *des_scan++ = (FX_BYTE)((des_b) >> 16);
- *des_scan++ = (FX_BYTE)((des_g) >> 16);
- *des_scan++ = (FX_BYTE)((des_r) >> 16);
+ *des_scan++ = (uint8_t)((des_b) >> 16);
+ *des_scan++ = (uint8_t)((des_g) >> 16);
+ *des_scan++ = (uint8_t)((des_r) >> 16);
*des_scan++ = 0xFF;
} else {
int des_a = 0, des_r = 0, des_g = 0, des_b = 0;
for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j ++) {
int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
unsigned long argb = m_pSrcPalette[src_scan[j]];
- des_a += pixel_weight * (FX_BYTE)(argb >> 24);
- des_r += pixel_weight * (FX_BYTE)(argb >> 16);
- des_g += pixel_weight * (FX_BYTE)(argb >> 8);
- des_b += pixel_weight * (FX_BYTE)argb;
+ des_a += pixel_weight * (uint8_t)(argb >> 24);
+ des_r += pixel_weight * (uint8_t)(argb >> 16);
+ des_g += pixel_weight * (uint8_t)(argb >> 8);
+ des_b += pixel_weight * (uint8_t)argb;
}
- *des_scan++ = (FX_BYTE)((des_b) >> 16);
- *des_scan++ = (FX_BYTE)((des_g) >> 16);
- *des_scan++ = (FX_BYTE)((des_r) >> 16);
- *des_scan++ = (FX_BYTE)((des_a) >> 16);
+ *des_scan++ = (uint8_t)((des_b) >> 16);
+ *des_scan++ = (uint8_t)((des_g) >> 16);
+ *des_scan++ = (uint8_t)((des_r) >> 16);
+ *des_scan++ = (uint8_t)((des_a) >> 16);
}
}
break;
@@ -1525,9 +1525,9 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in des_g += pixel_weight * (*src_pixel++);
des_r += pixel_weight * (*src_pixel);
}
- *des_scan++ = (FX_BYTE)((des_b) >> 16);
- *des_scan++ = (FX_BYTE)((des_g) >> 16);
- *des_scan++ = (FX_BYTE)((des_r) >> 16);
+ *des_scan++ = (uint8_t)((des_b) >> 16);
+ *des_scan++ = (uint8_t)((des_g) >> 16);
+ *des_scan++ = (uint8_t)((des_r) >> 16);
des_scan += des_Bpp - 3;
}
break;
@@ -1536,16 +1536,16 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in 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 * src_Bpp;
- FX_BYTE src_b = 0, src_g = 0, src_r = 0;
+ uint8_t src_b = 0, src_g = 0, src_r = 0;
AdobeCMYK_to_sRGB1(255 - src_pixel[0], 255 - src_pixel[1], 255 - src_pixel[2], 255 - src_pixel[3],
src_r, src_g, src_b);
des_b += pixel_weight * src_b;
des_g += pixel_weight * src_g;
des_r += pixel_weight * src_r;
}
- *des_scan++ = (FX_BYTE)((des_b) >> 16);
- *des_scan++ = (FX_BYTE)((des_g) >> 16);
- *des_scan++ = (FX_BYTE)((des_r) >> 16);
+ *des_scan++ = (uint8_t)((des_b) >> 16);
+ *des_scan++ = (uint8_t)((des_g) >> 16);
+ *des_scan++ = (uint8_t)((des_r) >> 16);
des_scan += des_Bpp - 3;
}
break;
@@ -1560,10 +1560,10 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in des_r += pixel_weight * (*src_pixel);
des_alpha += pixel_weight;
}
- *des_scan++ = (FX_BYTE)((des_b) >> 16);
- *des_scan++ = (FX_BYTE)((des_g) >> 16);
- *des_scan++ = (FX_BYTE)((des_r) >> 16);
- *des_scan++ = (FX_BYTE)((des_alpha * 255) >> 16);
+ *des_scan++ = (uint8_t)((des_b) >> 16);
+ *des_scan++ = (uint8_t)((des_g) >> 16);
+ *des_scan++ = (uint8_t)((des_r) >> 16);
+ *des_scan++ = (uint8_t)((des_alpha * 255) >> 16);
}
break;
default:
@@ -1609,7 +1609,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, double int des_g = 0;
des_g += pWeight->m_Weights[0] * (*scan_src1++);
des_g += pWeight->m_Weights[1] * (*scan_src2++);
- *scan_des++ = (FX_BYTE)(des_g >> 16);
+ *scan_des++ = (uint8_t)(des_g >> 16);
}
break;
case FXDIB_Rgb:
@@ -1623,9 +1623,9 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, double des_g += pWeight->m_Weights[1] * (*scan_src2++);
des_r += pWeight->m_Weights[1] * (*scan_src2++);
scan_src2 += des_Bpp - 3;
- *scan_des++ = (FX_BYTE)((des_b) >> 16);
- *scan_des++ = (FX_BYTE)((des_g) >> 16);
- *scan_des++ = (FX_BYTE)((des_r) >> 16);
+ *scan_des++ = (uint8_t)((des_b) >> 16);
+ *scan_des++ = (uint8_t)((des_g) >> 16);
+ *scan_des++ = (uint8_t)((des_r) >> 16);
scan_des += des_Bpp - 3;
}
break;
@@ -1639,10 +1639,10 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, double des_g += pWeight->m_Weights[1] * (*scan_src2++);
des_r += pWeight->m_Weights[1] * (*scan_src2++);
des_a += pWeight->m_Weights[1] * (*scan_src2++);
- *scan_des++ = (FX_BYTE)((des_b) >> 16);
- *scan_des++ = (FX_BYTE)((des_g) >> 16);
- *scan_des++ = (FX_BYTE)((des_r) >> 16);
- *scan_des++ = (FX_BYTE)((des_a) >> 16);
+ *scan_des++ = (uint8_t)((des_b) >> 16);
+ *scan_des++ = (uint8_t)((des_g) >> 16);
+ *scan_des++ = (uint8_t)((des_r) >> 16);
+ *scan_des++ = (uint8_t)((des_a) >> 16);
}
break;
default:
@@ -1674,7 +1674,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, double }
}
}
-void CCodec_ProgressiveDecoder::Resample(CFX_DIBitmap* pDeviceBitmap, FX_INT32 src_line, FX_LPBYTE src_scan, FXCodec_Format src_format)
+void CCodec_ProgressiveDecoder::Resample(CFX_DIBitmap* pDeviceBitmap, int32_t src_line, FX_LPBYTE src_scan, FXCodec_Format src_format)
{
int src_top = m_clipBox.top;
int des_top = m_startY;
@@ -1693,7 +1693,7 @@ void CCodec_ProgressiveDecoder::Resample(CFX_DIBitmap* pDeviceBitmap, FX_INT32 s }
}
}
-FXCODEC_STATUS CCodec_ProgressiveDecoder::GetFrames(FX_INT32& frames, IFX_Pause* pPause)
+FXCODEC_STATUS CCodec_ProgressiveDecoder::GetFrames(int32_t& frames, IFX_Pause* pPause)
{
if(!(m_status == FXCODEC_STATUS_FRAME_READY || m_status == FXCODEC_STATUS_FRAME_TOBECONTINUE)) {
return FXCODEC_STATUS_ERROR;
@@ -1708,7 +1708,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::GetFrames(FX_INT32& frames, IFX_Pause* case FXCODEC_IMAGE_GIF: {
ICodec_GifModule* pGifModule = m_pCodecMgr->GetGifModule();
while (TRUE) {
- FX_INT32 readResult = pGifModule->LoadFrameInfo(m_pGifContext, &m_FrameNumber);
+ int32_t readResult = pGifModule->LoadFrameInfo(m_pGifContext, &m_FrameNumber);
while(readResult == 2) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_READ;
if(!GifReadMoreData(pGifModule, error_status)) {
@@ -1738,7 +1738,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::GetFrames(FX_INT32& frames, IFX_Pause* }
FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap,
int start_x, int start_y, int size_x, int size_y,
- FX_INT32 frames, FX_BOOL bInterpol)
+ int32_t frames, FX_BOOL bInterpol)
{
if(m_status != FXCODEC_STATUS_DECODE_READY) {
return FXCODEC_STATUS_ERROR;
@@ -1755,8 +1755,8 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap, return FXCODEC_STATUS_ERR_PARAMS;
}
FX_RECT device_rc = FX_RECT(start_x, start_y, start_x + size_x, start_y + size_y);
- FX_INT32 out_range_x = device_rc.right - pDIBitmap->GetWidth();
- FX_INT32 out_range_y = device_rc.bottom - pDIBitmap->GetHeight();
+ int32_t out_range_x = device_rc.right - pDIBitmap->GetWidth();
+ int32_t out_range_y = device_rc.bottom - pDIBitmap->GetHeight();
device_rc.Intersect(FX_RECT(0, 0, pDIBitmap->GetWidth(), pDIBitmap->GetHeight()));
if(device_rc.IsEmpty()) {
return FXCODEC_STATUS_ERR_PARAMS;
@@ -1770,19 +1770,19 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap, if(start_x < 0 || out_range_x > 0) {
FX_FLOAT scaleX = (FX_FLOAT)m_clipBox.Width() / (FX_FLOAT)size_x;
if(start_x < 0) {
- m_clipBox.left -= (FX_INT32)FXSYS_ceil((FX_FLOAT)start_x * scaleX);
+ m_clipBox.left -= (int32_t)FXSYS_ceil((FX_FLOAT)start_x * scaleX);
}
if(out_range_x > 0) {
- m_clipBox.right -= (FX_INT32)FXSYS_floor((FX_FLOAT)out_range_x * scaleX);
+ m_clipBox.right -= (int32_t)FXSYS_floor((FX_FLOAT)out_range_x * scaleX);
}
}
if(start_y < 0 || out_range_y > 0) {
FX_FLOAT scaleY = (FX_FLOAT)m_clipBox.Height() / (FX_FLOAT)size_y;
if(start_y < 0) {
- m_clipBox.top -= (FX_INT32)FXSYS_ceil((FX_FLOAT)start_y * scaleY);
+ m_clipBox.top -= (int32_t)FXSYS_ceil((FX_FLOAT)start_y * scaleY);
}
if(out_range_y > 0) {
- m_clipBox.bottom -= (FX_INT32)FXSYS_floor((FX_FLOAT)out_range_y * scaleY);
+ m_clipBox.bottom -= (int32_t)FXSYS_floor((FX_FLOAT)out_range_y * scaleY);
}
}
if(m_clipBox.IsEmpty()) {
@@ -1809,7 +1809,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap, FX_Free(m_pDecodeBuf);
m_pDecodeBuf = NULL;
}
- m_pDecodeBuf = FX_Alloc(FX_BYTE, scanline_size);
+ m_pDecodeBuf = FX_Alloc(uint8_t, scanline_size);
if(m_pDecodeBuf == NULL) {
m_pDeviceBitmap = NULL;
m_pFile = NULL;
@@ -1878,7 +1878,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap, FX_Free(m_pDecodeBuf);
m_pDecodeBuf = NULL;
}
- m_pDecodeBuf = FX_Alloc(FX_BYTE, scanline_size);
+ m_pDecodeBuf = FX_Alloc(uint8_t, scanline_size);
if(m_pDecodeBuf == NULL) {
m_pDeviceBitmap = NULL;
m_pFile = NULL;
@@ -1904,7 +1904,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap, FX_Free(m_pDecodeBuf);
m_pDecodeBuf = NULL;
}
- m_pDecodeBuf = FX_Alloc(FX_BYTE, scanline_size);
+ m_pDecodeBuf = FX_Alloc(uint8_t, scanline_size);
if(m_pDecodeBuf == NULL) {
m_pDeviceBitmap = NULL;
m_pFile = NULL;
@@ -1941,7 +1941,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap, FX_Free(m_pDecodeBuf);
m_pDecodeBuf = NULL;
}
- m_pDecodeBuf = FX_Alloc(FX_BYTE, m_ScanlineSize);
+ m_pDecodeBuf = FX_Alloc(uint8_t, m_ScanlineSize);
if(m_pDecodeBuf == NULL) {
m_pDeviceBitmap = NULL;
m_pFile = NULL;
@@ -2012,7 +2012,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) }
if(m_pSrcBuf != NULL && input_size > m_SrcSize) {
FX_Free(m_pSrcBuf);
- m_pSrcBuf = FX_Alloc(FX_BYTE, input_size);
+ m_pSrcBuf = FX_Alloc(uint8_t, input_size);
if(m_pSrcBuf == NULL) {
m_pDeviceBitmap = NULL;
m_pFile = NULL;
@@ -2043,7 +2043,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) case FXCODEC_IMAGE_GIF: {
ICodec_GifModule* pGifModule = m_pCodecMgr->GetGifModule();
while(TRUE) {
- FX_INT32 readRes = pGifModule->LoadFrame(m_pGifContext, m_FrameCur);
+ int32_t readRes = pGifModule->LoadFrame(m_pGifContext, m_FrameCur);
while(readRes == 2) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_DECODE_FINISH;
if(!GifReadMoreData(pGifModule, error_status)) {
@@ -2070,7 +2070,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) case FXCODEC_IMAGE_BMP: {
ICodec_BmpModule* pBmpModule = m_pCodecMgr->GetBmpModule();
while(TRUE) {
- FX_INT32 readRes = pBmpModule->LoadImage(m_pBmpContext);
+ int32_t readRes = pBmpModule->LoadImage(m_pBmpContext);
while(readRes == 2) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_DECODE_FINISH;
if(!BmpReadMoreData(pBmpModule, error_status)) {
@@ -2165,14 +2165,14 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) switch(m_pDeviceBitmap->GetFormat()) {
case FXDIB_8bppRgb:
case FXDIB_8bppMask: {
- for (FX_INT32 row = 0; row < pClipBitmap->GetHeight(); row++) {
+ for (int32_t row = 0; row < pClipBitmap->GetHeight(); row++) {
FX_LPBYTE src_line = (FX_LPBYTE)pClipBitmap->GetScanline(row);
FX_LPBYTE des_line = (FX_LPBYTE)pFormatBitmap->GetScanline(row);
- for (FX_INT32 col = 0; col < pClipBitmap->GetWidth(); col++) {
- FX_BYTE _a = 255 - src_line[3];
- FX_BYTE b = (src_line[0] * src_line[3] + 0xFF * _a) / 255;
- FX_BYTE g = (src_line[1] * src_line[3] + 0xFF * _a) / 255;
- FX_BYTE r = (src_line[2] * src_line[3] + 0xFF * _a) / 255;
+ for (int32_t col = 0; col < pClipBitmap->GetWidth(); col++) {
+ uint8_t _a = 255 - src_line[3];
+ uint8_t b = (src_line[0] * src_line[3] + 0xFF * _a) / 255;
+ uint8_t g = (src_line[1] * src_line[3] + 0xFF * _a) / 255;
+ uint8_t r = (src_line[2] * src_line[3] + 0xFF * _a) / 255;
*des_line++ = FXRGB2GRAY(r, g, b);
src_line += 4;
}
@@ -2181,15 +2181,15 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) break;
case FXDIB_Rgb:
case FXDIB_Rgb32: {
- FX_INT32 desBpp = (m_pDeviceBitmap->GetFormat() == FXDIB_Rgb) ? 3 : 4;
- for (FX_INT32 row = 0; row < pClipBitmap->GetHeight(); row++) {
+ int32_t desBpp = (m_pDeviceBitmap->GetFormat() == FXDIB_Rgb) ? 3 : 4;
+ for (int32_t row = 0; row < pClipBitmap->GetHeight(); row++) {
FX_LPBYTE src_line = (FX_LPBYTE)pClipBitmap->GetScanline(row);
FX_LPBYTE des_line = (FX_LPBYTE)pFormatBitmap->GetScanline(row);
- for (FX_INT32 col = 0; col < pClipBitmap->GetWidth(); col++) {
- FX_BYTE _a = 255 - src_line[3];
- FX_BYTE b = (src_line[0] * src_line[3] + 0xFF * _a) / 255;
- FX_BYTE g = (src_line[1] * src_line[3] + 0xFF * _a) / 255;
- FX_BYTE r = (src_line[2] * src_line[3] + 0xFF * _a) / 255;
+ for (int32_t col = 0; col < pClipBitmap->GetWidth(); col++) {
+ uint8_t _a = 255 - src_line[3];
+ uint8_t b = (src_line[0] * src_line[3] + 0xFF * _a) / 255;
+ uint8_t g = (src_line[1] * src_line[3] + 0xFF * _a) / 255;
+ uint8_t r = (src_line[2] * src_line[3] + 0xFF * _a) / 255;
*des_line++ = b;
*des_line++ = g;
*des_line++ = r;
diff --git a/core/src/fxcodec/codec/fx_codec_progress.h b/core/src/fxcodec/codec/fx_codec_progress.h index ea53c8f010..e5a4e53376 100644 --- a/core/src/fxcodec/codec/fx_codec_progress.h +++ b/core/src/fxcodec/codec/fx_codec_progress.h @@ -108,28 +108,28 @@ public: {
return m_imagType;
}
- virtual FX_INT32 GetWidth()
+ virtual int32_t GetWidth()
{
return m_SrcWidth;
}
- virtual FX_INT32 GetHeight()
+ virtual int32_t GetHeight()
{
return m_SrcHeight;
}
- virtual FX_INT32 GetNumComponents()
+ virtual int32_t GetNumComponents()
{
return m_SrcComponents;
}
- virtual FX_INT32 GetBPC()
+ virtual int32_t GetBPC()
{
return m_SrcBPC;
}
virtual void SetClipBox(FX_RECT* clip);
- virtual FXCODEC_STATUS GetFrames(FX_INT32& frames, IFX_Pause* pPause);
+ virtual FXCODEC_STATUS GetFrames(int32_t& frames, IFX_Pause* pPause);
virtual FXCODEC_STATUS StartDecode(CFX_DIBitmap* pDIBitmap,
int start_x, int start_y, int size_x, int size_y,
- FX_INT32 frames, FX_BOOL bInterpol);
+ int32_t frames, FX_BOOL bInterpol);
virtual FXCODEC_STATUS ContinueDecode(IFX_Pause* pPause);
@@ -137,27 +137,27 @@ protected: FX_BOOL DetectImageType(FXCODEC_IMAGE_TYPE imageType, CFX_DIBAttribute* pAttribute = NULL);
void GetDownScale(int& down_scale);
void GetTransMethod(FXDIB_Format des_format, FXCodec_Format src_format);
- void ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, FX_INT32 des_line, FX_LPBYTE src_scan, FXCodec_Format src_format);
- void Resample(CFX_DIBitmap* pDeviceBitmap, FX_INT32 src_line, FX_LPBYTE src_scan, FXCodec_Format src_format);
+ void ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, int32_t des_line, FX_LPBYTE src_scan, FXCodec_Format src_format);
+ void Resample(CFX_DIBitmap* pDeviceBitmap, int32_t src_line, FX_LPBYTE src_scan, FXCodec_Format src_format);
void ResampleVert(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
FX_BOOL JpegReadMoreData(ICodec_JpegModule* pJpegModule, FXCODEC_STATUS& err_status);
static FX_BOOL PngReadHeaderFunc(void* pModule, int width, int height, int bpc, int pass, int* color_type, double* gamma);
static FX_BOOL PngAskScanlineBufFunc(void* pModule, int line, FX_LPBYTE& src_buf);
static void PngFillScanlineBufCompletedFunc(void* pModule, int pass, int line);
- void PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap, FX_INT32 des_line, FX_LPBYTE src_scan, FXCodec_Format src_format);
+ void PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap, int32_t des_line, FX_LPBYTE src_scan, FXCodec_Format src_format);
FX_BOOL GifReadMoreData(ICodec_GifModule* pGifModule, FXCODEC_STATUS& err_status);
static void GifRecordCurrentPositionCallback(void* pModule, FX_DWORD& cur_pos);
- static FX_LPBYTE GifAskLocalPaletteBufCallback(void* pModule, FX_INT32 frame_num, FX_INT32 pal_size);
+ static FX_LPBYTE GifAskLocalPaletteBufCallback(void* pModule, int32_t frame_num, int32_t pal_size);
static FX_BOOL GifInputRecordPositionBufCallback(void* pModule, FX_DWORD rcd_pos, const FX_RECT& img_rc,
- FX_INT32 pal_num, void* pal_ptr,
- FX_INT32 delay_time, FX_BOOL user_input,
- FX_INT32 trans_index, FX_INT32 disposal_method, FX_BOOL interlace);
- static void GifReadScanlineCallback(void* pModule, FX_INT32 row_num, FX_LPBYTE row_buf);
+ int32_t pal_num, void* pal_ptr,
+ int32_t delay_time, FX_BOOL user_input,
+ int32_t trans_index, int32_t disposal_method, FX_BOOL interlace);
+ static void GifReadScanlineCallback(void* pModule, int32_t row_num, FX_LPBYTE row_buf);
void GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
FX_BOOL BmpReadMoreData(ICodec_BmpModule* pBmpModule, FXCODEC_STATUS& err_status);
static FX_BOOL BmpInputImagePositionBufCallback(void* pModule, FX_DWORD rcd_pos);
- static void BmpReadScanlineCallback(void* pModule, FX_INT32 row_num, FX_LPBYTE row_buf);
+ static void BmpReadScanlineCallback(void* pModule, int32_t row_num, FX_LPBYTE row_buf);
void ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
public:
IFX_FileRead* m_pFile;
@@ -197,7 +197,7 @@ public: int m_FrameCur;
int m_GifBgIndex;
FX_LPBYTE m_pGifPalette;
- FX_INT32 m_GifPltNumber;
+ int32_t m_GifPltNumber;
int m_GifTransIndex;
FX_RECT m_GifFrameRect;
FX_BOOL m_BmpIsTopBottom;
diff --git a/core/src/fxcodec/codec/fx_codec_tiff.cpp b/core/src/fxcodec/codec/fx_codec_tiff.cpp index fee2c783c5..8e9dd10f29 100644 --- a/core/src/fxcodec/codec/fx_codec_tiff.cpp +++ b/core/src/fxcodec/codec/fx_codec_tiff.cpp @@ -20,8 +20,8 @@ public: ~CCodec_TiffContext();
FX_BOOL InitDecoder(IFX_FileRead* file_ptr);
- void GetFrames(FX_INT32& frames);
- FX_BOOL LoadFrameInfo(FX_INT32 frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute);
+ void GetFrames(int32_t& frames);
+ FX_BOOL LoadFrameInfo(int32_t frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute);
FX_BOOL Decode(CFX_DIBitmap* pDIBitmap);
union {
@@ -33,15 +33,15 @@ public: TIFF* tif_ctx;
void* icc_ctx;
- FX_INT32 frame_num;
- FX_INT32 frame_cur;
+ int32_t frame_num;
+ int32_t frame_cur;
FX_BOOL isDecoder;
private:
FX_BOOL isSupport(CFX_DIBitmap* pDIBitmap);
- void SetPalette(CFX_DIBitmap* pDIBitmap, FX_UINT16 bps);
- FX_BOOL Decode1bppRGB(CFX_DIBitmap* pDIBitmap, FX_INT32 height, FX_INT32 width, FX_UINT16 bps, FX_UINT16 spp);
- FX_BOOL Decode8bppRGB(CFX_DIBitmap* pDIBitmap, FX_INT32 height, FX_INT32 width, FX_UINT16 bps, FX_UINT16 spp);
- FX_BOOL Decode24bppRGB(CFX_DIBitmap* pDIBitmap, FX_INT32 height, FX_INT32 width, FX_UINT16 bps, FX_UINT16 spp);
+ void SetPalette(CFX_DIBitmap* pDIBitmap, uint16_t bps);
+ FX_BOOL Decode1bppRGB(CFX_DIBitmap* pDIBitmap, int32_t height, int32_t width, uint16_t bps, uint16_t spp);
+ FX_BOOL Decode8bppRGB(CFX_DIBitmap* pDIBitmap, int32_t height, int32_t width, uint16_t bps, uint16_t spp);
+ FX_BOOL Decode24bppRGB(CFX_DIBitmap* pDIBitmap, int32_t height, int32_t width, uint16_t bps, uint16_t spp);
};
CCodec_TiffContext::CCodec_TiffContext()
{
@@ -142,7 +142,7 @@ TIFF* _tiff_open(void* context, const char* mode) _tiff_read, _tiff_write, _tiff_seek, _tiff_close,
_tiff_get_size, _tiff_map, _tiff_unmap);
if(tif) {
- tif->tif_fd = (int)(FX_INTPTR)context;
+ tif->tif_fd = (int)(intptr_t)context;
}
return tif;
}
@@ -207,7 +207,7 @@ FX_BOOL CCodec_TiffContext::InitDecoder(IFX_FileRead* file_ptr) }
return TRUE;
}
-void CCodec_TiffContext::GetFrames(FX_INT32& frames)
+void CCodec_TiffContext::GetFrames(int32_t& frames)
{
frames = frame_num = TIFFNumberOfDirectories(tif_ctx);
}
@@ -215,7 +215,7 @@ void CCodec_TiffContext::GetFrames(FX_INT32& frames) T val = (T)0;\
TIFFGetField(tif_ctx,tag,&val);\
if (val) {\
- (key) = FX_Alloc(FX_BYTE,sizeof(T));\
+ (key) = FX_Alloc(uint8_t,sizeof(T));\
if ((key)) {\
T* ptr = (T*)(key);\
*ptr = val;\
@@ -226,7 +226,7 @@ void CCodec_TiffContext::GetFrames(FX_INT32& frames) FX_LPBYTE buf = NULL;\
TIFFGetField(tif_ctx,tag,&size, &buf);\
if (size && buf) {\
- (key) = FX_Alloc(FX_BYTE,size);\
+ (key) = FX_Alloc(uint8_t,size);\
if ((key)) {\
FXSYS_memcpy32((key),buf,size);\
pExif->m_TagVal.SetAt(tag,(key));}}}\
@@ -238,7 +238,7 @@ static FX_BOOL Tiff_Exif_GetInfo(TIFF* tif_ctx, ttag_t tag, CFX_DIBAttributeExif T val = (T)0;
TIFFGetField(tif_ctx, tag, &val);
if (val) {
- (key) = FX_Alloc(FX_BYTE, sizeof(T));
+ (key) = FX_Alloc(uint8_t, sizeof(T));
if ((key) == NULL) {
return FALSE;
}
@@ -255,8 +255,8 @@ static void Tiff_Exif_GetStringInfo(TIFF* tif_ctx, ttag_t tag, CFX_DIBAttributeE FX_LPBYTE key = NULL;
TIFFGetField(tif_ctx, tag, &buf);
if (buf) {
- FX_INT32 size = (FX_INT32)FXSYS_strlen(buf);
- (key) = FX_Alloc(FX_BYTE, size + 1);
+ int32_t size = (int32_t)FXSYS_strlen(buf);
+ (key) = FX_Alloc(uint8_t, size + 1);
if ((key) == NULL) {
return;
}
@@ -265,7 +265,7 @@ static void Tiff_Exif_GetStringInfo(TIFF* tif_ctx, ttag_t tag, CFX_DIBAttributeE pExif->m_TagVal.SetAt(tag, (key));
}
}
-FX_BOOL CCodec_TiffContext::LoadFrameInfo(FX_INT32 frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute)
+FX_BOOL CCodec_TiffContext::LoadFrameInfo(int32_t frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute)
{
if (!TIFFSetDirectory(tif_ctx, (uint16)frame)) {
return FALSE;
@@ -296,12 +296,12 @@ FX_BOOL CCodec_TiffContext::LoadFrameInfo(FX_INT32 frame, FX_DWORD& width, FX_DW if (Tiff_Exif_GetInfo<FX_FLOAT>(tif_ctx, TIFFTAG_XRESOLUTION, pExif)) {
FX_FLOAT fDpi = 0;
pExif->GetInfo(TIFFTAG_XRESOLUTION, &fDpi);
- pAttribute->m_nXDPI = (FX_INT32)(fDpi + 0.5f);
+ pAttribute->m_nXDPI = (int32_t)(fDpi + 0.5f);
}
if (Tiff_Exif_GetInfo<FX_FLOAT>(tif_ctx, TIFFTAG_YRESOLUTION, pExif)) {
FX_FLOAT fDpi = 0;
pExif->GetInfo(TIFFTAG_YRESOLUTION, &fDpi);
- pAttribute->m_nYDPI = (FX_INT32)(fDpi + 0.5f);
+ pAttribute->m_nYDPI = (int32_t)(fDpi + 0.5f);
}
Tiff_Exif_GetStringInfo(tif_ctx, TIFFTAG_IMAGEDESCRIPTION, pExif);
Tiff_Exif_GetStringInfo(tif_ctx, TIFFTAG_MAKE, pExif);
@@ -313,10 +313,10 @@ FX_BOOL CCodec_TiffContext::LoadFrameInfo(FX_INT32 frame, FX_DWORD& width, FX_DW }
return TRUE;
}
-void _TiffBGRA2RGBA(FX_LPBYTE pBuf, FX_INT32 pixel, FX_INT32 spp)
+void _TiffBGRA2RGBA(FX_LPBYTE pBuf, int32_t pixel, int32_t spp)
{
- register FX_BYTE tmp;
- for (FX_INT32 n = 0; n < pixel; n++) {
+ register uint8_t tmp;
+ for (int32_t n = 0; n < pixel; n++) {
tmp = pBuf[0];
pBuf[0] = pBuf[2];
pBuf[2] = tmp;
@@ -328,7 +328,7 @@ FX_BOOL CCodec_TiffContext::isSupport(CFX_DIBitmap* pDIBitmap) if (TIFFIsTiled(tif_ctx)) {
return FALSE;
}
- FX_UINT16 photometric;
+ uint16_t photometric;
if (!TIFFGetField(tif_ctx, TIFFTAG_PHOTOMETRIC, &photometric)) {
return FALSE;
}
@@ -347,7 +347,7 @@ FX_BOOL CCodec_TiffContext::isSupport(CFX_DIBitmap* pDIBitmap) default:
return FALSE;
}
- FX_UINT16 planarconfig;
+ uint16_t planarconfig;
if (!TIFFGetFieldDefaulted(tif_ctx, TIFFTAG_PLANARCONFIG, &planarconfig)) {
return FALSE;
}
@@ -356,33 +356,33 @@ FX_BOOL CCodec_TiffContext::isSupport(CFX_DIBitmap* pDIBitmap) }
return TRUE;
}
-void CCodec_TiffContext::SetPalette(CFX_DIBitmap* pDIBitmap, FX_UINT16 bps)
+void CCodec_TiffContext::SetPalette(CFX_DIBitmap* pDIBitmap, uint16_t bps)
{
- FX_UINT16 *red_orig, *green_orig, *blue_orig;
+ uint16_t *red_orig, *green_orig, *blue_orig;
TIFFGetField(tif_ctx, TIFFTAG_COLORMAP, &red_orig, &green_orig, &blue_orig);
- for (FX_INT32 i = (1L << bps) - 1; i >= 0; i--) {
-#define CVT(x) ((FX_UINT16)((x)>>8))
+ for (int32_t i = (1L << bps) - 1; i >= 0; i--) {
+#define CVT(x) ((uint16_t)((x)>>8))
red_orig[i] = CVT(red_orig[i]);
green_orig[i] = CVT(green_orig[i]);
blue_orig[i] = CVT(blue_orig[i]);
#undef CVT
}
- FX_INT32 len = 1 << bps;
- for(FX_INT32 index = 0; index < len; index++) {
+ int32_t len = 1 << bps;
+ for(int32_t index = 0; index < len; index++) {
FX_DWORD r = red_orig[index] & 0xFF;
FX_DWORD g = green_orig[index] & 0xFF;
FX_DWORD b = blue_orig[index] & 0xFF;
- FX_DWORD color = (FX_UINT32)b | ((FX_UINT32)g << 8) | ((FX_UINT32)r << 16) | (((uint32)0xffL) << 24);
+ FX_DWORD color = (uint32_t)b | ((uint32_t)g << 8) | ((uint32_t)r << 16) | (((uint32)0xffL) << 24);
pDIBitmap->SetPaletteEntry(index, color);
}
}
-FX_BOOL CCodec_TiffContext::Decode1bppRGB(CFX_DIBitmap* pDIBitmap, FX_INT32 height, FX_INT32 width, FX_UINT16 bps, FX_UINT16 spp)
+FX_BOOL CCodec_TiffContext::Decode1bppRGB(CFX_DIBitmap* pDIBitmap, int32_t height, int32_t width, uint16_t bps, uint16_t spp)
{
if (pDIBitmap->GetBPP() != 1 || spp != 1 || bps != 1 || !isSupport(pDIBitmap)) {
return FALSE;
}
SetPalette(pDIBitmap, bps);
- FX_INT32 size = (FX_INT32)TIFFScanlineSize(tif_ctx);
+ int32_t size = (int32_t)TIFFScanlineSize(tif_ctx);
FX_LPBYTE buf = (FX_LPBYTE)_TIFFmalloc(size);
if (buf == NULL) {
TIFFError(TIFFFileName(tif_ctx), "No space for scanline buffer");
@@ -390,22 +390,22 @@ FX_BOOL CCodec_TiffContext::Decode1bppRGB(CFX_DIBitmap* pDIBitmap, FX_INT32 heig }
FX_LPBYTE bitMapbuffer = (FX_LPBYTE)pDIBitmap->GetBuffer();
FX_DWORD pitch = pDIBitmap->GetPitch();
- for(FX_INT32 row = 0; row < height; row++) {
+ for(int32_t row = 0; row < height; row++) {
TIFFReadScanline(tif_ctx, buf, row, 0);
- for(FX_INT32 j = 0; j < size; j++) {
+ for(int32_t j = 0; j < size; j++) {
bitMapbuffer[row * pitch + j] = buf[j];
}
}
_TIFFfree(buf);
return TRUE;
}
-FX_BOOL CCodec_TiffContext::Decode8bppRGB(CFX_DIBitmap* pDIBitmap, FX_INT32 height, FX_INT32 width, FX_UINT16 bps, FX_UINT16 spp)
+FX_BOOL CCodec_TiffContext::Decode8bppRGB(CFX_DIBitmap* pDIBitmap, int32_t height, int32_t width, uint16_t bps, uint16_t spp)
{
if (pDIBitmap->GetBPP() != 8 || spp != 1 || (bps != 4 && bps != 8) || !isSupport(pDIBitmap)) {
return FALSE;
}
SetPalette(pDIBitmap, bps);
- FX_INT32 size = (FX_INT32)TIFFScanlineSize(tif_ctx);
+ int32_t size = (int32_t)TIFFScanlineSize(tif_ctx);
FX_LPBYTE buf = (FX_LPBYTE)_TIFFmalloc(size);
if (buf == NULL) {
TIFFError(TIFFFileName(tif_ctx), "No space for scanline buffer");
@@ -413,9 +413,9 @@ FX_BOOL CCodec_TiffContext::Decode8bppRGB(CFX_DIBitmap* pDIBitmap, FX_INT32 heig }
FX_LPBYTE bitMapbuffer = (FX_LPBYTE)pDIBitmap->GetBuffer();
FX_DWORD pitch = pDIBitmap->GetPitch();
- for(FX_INT32 row = 0; row < height; row++) {
+ for(int32_t row = 0; row < height; row++) {
TIFFReadScanline(tif_ctx, buf, row, 0);
- for(FX_INT32 j = 0; j < size; j++) {
+ for(int32_t j = 0; j < size; j++) {
switch(bps) {
case 4:
bitMapbuffer[row * pitch + 2 * j + 0] = (buf[j] & 0xF0) >> 4;
@@ -430,12 +430,12 @@ FX_BOOL CCodec_TiffContext::Decode8bppRGB(CFX_DIBitmap* pDIBitmap, FX_INT32 heig _TIFFfree(buf);
return TRUE;
}
-FX_BOOL CCodec_TiffContext::Decode24bppRGB(CFX_DIBitmap* pDIBitmap, FX_INT32 height, FX_INT32 width, FX_UINT16 bps, FX_UINT16 spp)
+FX_BOOL CCodec_TiffContext::Decode24bppRGB(CFX_DIBitmap* pDIBitmap, int32_t height, int32_t width, uint16_t bps, uint16_t spp)
{
if (pDIBitmap->GetBPP() != 24 || !isSupport(pDIBitmap)) {
return FALSE;
}
- FX_INT32 size = (FX_INT32)TIFFScanlineSize(tif_ctx);
+ int32_t size = (int32_t)TIFFScanlineSize(tif_ctx);
FX_LPBYTE buf = (FX_LPBYTE)_TIFFmalloc(size);
if (buf == NULL) {
TIFFError(TIFFFileName(tif_ctx), "No space for scanline buffer");
@@ -443,9 +443,9 @@ FX_BOOL CCodec_TiffContext::Decode24bppRGB(CFX_DIBitmap* pDIBitmap, FX_INT32 hei }
FX_LPBYTE bitMapbuffer = (FX_LPBYTE)pDIBitmap->GetBuffer();
FX_DWORD pitch = pDIBitmap->GetPitch();
- for(FX_INT32 row = 0; row < height; row++) {
+ for(int32_t row = 0; row < height; row++) {
TIFFReadScanline(tif_ctx, buf, row, 0);
- for(FX_INT32 j = 0; j < size - 2; j += 3) {
+ for(int32_t j = 0; j < size - 2; j += 3) {
bitMapbuffer[row * pitch + j + 0] = buf[j + 2];
bitMapbuffer[row * pitch + j + 1] = buf[j + 1];
bitMapbuffer[row * pitch + j + 2] = buf[j + 0];
@@ -477,7 +477,7 @@ FX_BOOL CCodec_TiffContext::Decode(CFX_DIBitmap* pDIBitmap) return TRUE;
}
}
- FX_UINT16 spp, bps;
+ uint16_t spp, bps;
TIFFGetField(tif_ctx, TIFFTAG_SAMPLESPERPIXEL, &spp);
TIFFGetField(tif_ctx, TIFFTAG_BITSPERSAMPLE, &bps);
FX_DWORD bpp = bps * spp;
@@ -499,12 +499,12 @@ FX_LPVOID CCodec_TiffModule::CreateDecoder(IFX_FileRead* file_ptr) }
return pDecoder;
}
-void CCodec_TiffModule::GetFrames(FX_LPVOID ctx, FX_INT32& frames)
+void CCodec_TiffModule::GetFrames(FX_LPVOID ctx, int32_t& frames)
{
CCodec_TiffContext* pDecoder = (CCodec_TiffContext*)ctx;
pDecoder->GetFrames(frames);
}
-FX_BOOL CCodec_TiffModule::LoadFrameInfo(FX_LPVOID ctx, FX_INT32 frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute)
+FX_BOOL CCodec_TiffModule::LoadFrameInfo(FX_LPVOID ctx, int32_t frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute)
{
CCodec_TiffContext* pDecoder = (CCodec_TiffContext*)ctx;
return pDecoder->LoadFrameInfo(frame, width, height, comps, bpc, pAttribute);
diff --git a/core/src/fxcodec/fx_tiff/tiff_v403/tiffconf.h b/core/src/fxcodec/fx_tiff/tiff_v403/tiffconf.h index 3ca425c712..d0f823d8c3 100644 --- a/core/src/fxcodec/fx_tiff/tiff_v403/tiffconf.h +++ b/core/src/fxcodec/fx_tiff/tiff_v403/tiffconf.h @@ -44,7 +44,7 @@ /*#define HAVE_SEARCH_H 1 */ /* The size of a `int', as computed by sizeof. */ -/* According typedef int FX_INT32; in the fx_system.h*/ +/* According typedef int int32_t; in the fx_system.h*/ #define SIZEOF_INT 4 /* Sunliang.Liu 20110325. We should config the correct long size for tif diff --git a/core/src/fxcodec/jbig2/JBig2_BitStream.h b/core/src/fxcodec/jbig2/JBig2_BitStream.h index 9d5d29468f..ff0b9fcfeb 100644 --- a/core/src/fxcodec/jbig2/JBig2_BitStream.h +++ b/core/src/fxcodec/jbig2/JBig2_BitStream.h @@ -11,41 +11,41 @@ class CJBig2_BitStream : public CJBig2_Object { public: - CJBig2_BitStream(FX_BYTE *pBuffer, FX_DWORD dwLength); + CJBig2_BitStream(uint8_t *pBuffer, FX_DWORD dwLength); CJBig2_BitStream(CJBig2_BitStream &bs); ~CJBig2_BitStream(); - FX_INT32 readNBits(FX_DWORD nBits, FX_DWORD *dwResult); + int32_t readNBits(FX_DWORD nBits, FX_DWORD *dwResult); - FX_INT32 readNBits(FX_DWORD nBits, FX_INT32 *nResult); + int32_t readNBits(FX_DWORD nBits, int32_t *nResult); - FX_INT32 read1Bit(FX_DWORD *dwResult); + int32_t read1Bit(FX_DWORD *dwResult); - FX_INT32 read1Bit(FX_BOOL *bResult); + int32_t read1Bit(FX_BOOL *bResult); - FX_INT32 read1Byte(FX_BYTE *cResult); + int32_t read1Byte(uint8_t *cResult); - FX_INT32 readInteger(FX_DWORD *dwResult); + int32_t readInteger(FX_DWORD *dwResult); - FX_INT32 readShortInteger(FX_WORD *wResult); + int32_t readShortInteger(FX_WORD *wResult); void alignByte(); void align4Byte(); - FX_BYTE getAt(FX_DWORD dwOffset); + uint8_t getAt(FX_DWORD dwOffset); - FX_BYTE getCurByte(); + uint8_t getCurByte(); - FX_BYTE getNextByte(); + uint8_t getNextByte(); - FX_INT32 incByteIdx(); + int32_t incByteIdx(); - FX_BYTE getCurByte_arith(); + uint8_t getCurByte_arith(); - FX_BYTE getNextByte_arith(); + uint8_t getNextByte_arith(); FX_DWORD getOffset(); @@ -55,21 +55,21 @@ public: void setBitPos(FX_DWORD dwBitPos); - FX_BYTE *getBuf(); + uint8_t *getBuf(); FX_DWORD getLength() { return m_dwLength; } - FX_BYTE *getPointer(); + uint8_t *getPointer(); void offset(FX_DWORD dwOffset); FX_DWORD getByteLeft(); private: - FX_BYTE *m_pBuf; + uint8_t *m_pBuf; FX_DWORD m_dwLength; @@ -77,7 +77,7 @@ private: FX_DWORD m_dwBitIdx; }; -inline CJBig2_BitStream::CJBig2_BitStream(FX_BYTE *pBuffer, FX_DWORD dwLength) +inline CJBig2_BitStream::CJBig2_BitStream(uint8_t *pBuffer, FX_DWORD dwLength) { m_pBuf = pBuffer; m_dwLength = dwLength; @@ -98,7 +98,7 @@ inline CJBig2_BitStream::CJBig2_BitStream(CJBig2_BitStream &bs) inline CJBig2_BitStream::~CJBig2_BitStream() { } -inline FX_INT32 CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_DWORD *dwResult) +inline int32_t CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_DWORD *dwResult) { FX_DWORD dwTemp = (m_dwByteIdx << 3) + m_dwBitIdx; if(dwTemp <= (m_dwLength << 3)) { @@ -123,7 +123,7 @@ inline FX_INT32 CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_DWORD *dwResult) return -1; } } -inline FX_INT32 CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_INT32 *nResult) +inline int32_t CJBig2_BitStream::readNBits(FX_DWORD dwBits, int32_t *nResult) { FX_DWORD dwTemp = (m_dwByteIdx << 3) + m_dwBitIdx; if(dwTemp <= (m_dwLength << 3)) { @@ -149,7 +149,7 @@ inline FX_INT32 CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_INT32 *nResult) } } -inline FX_INT32 CJBig2_BitStream::read1Bit(FX_DWORD *dwResult) +inline int32_t CJBig2_BitStream::read1Bit(FX_DWORD *dwResult) { if(m_dwByteIdx < m_dwLength) { *dwResult = (m_pBuf[m_dwByteIdx] >> (7 - m_dwBitIdx)) & 0x01; @@ -165,7 +165,7 @@ inline FX_INT32 CJBig2_BitStream::read1Bit(FX_DWORD *dwResult) } } -inline FX_INT32 CJBig2_BitStream::read1Bit(FX_BOOL *bResult) +inline int32_t CJBig2_BitStream::read1Bit(FX_BOOL *bResult) { if(m_dwByteIdx < m_dwLength) { *bResult = (m_pBuf[m_dwByteIdx] >> (7 - m_dwBitIdx)) & 0x01; @@ -180,7 +180,7 @@ inline FX_INT32 CJBig2_BitStream::read1Bit(FX_BOOL *bResult) return -1; } } -inline FX_INT32 CJBig2_BitStream::read1Byte(FX_BYTE *cResult) +inline int32_t CJBig2_BitStream::read1Byte(uint8_t *cResult) { if(m_dwByteIdx < m_dwLength) { *cResult = m_pBuf[m_dwByteIdx]; @@ -191,7 +191,7 @@ inline FX_INT32 CJBig2_BitStream::read1Byte(FX_BYTE *cResult) } } -inline FX_INT32 CJBig2_BitStream::readInteger(FX_DWORD *dwResult) +inline int32_t CJBig2_BitStream::readInteger(FX_DWORD *dwResult) { if(m_dwByteIdx + 3 < m_dwLength) { *dwResult = (m_pBuf[m_dwByteIdx] << 24) | (m_pBuf[m_dwByteIdx + 1] << 16) @@ -203,7 +203,7 @@ inline FX_INT32 CJBig2_BitStream::readInteger(FX_DWORD *dwResult) } } -inline FX_INT32 CJBig2_BitStream::readShortInteger(FX_WORD *dwResult) +inline int32_t CJBig2_BitStream::readShortInteger(FX_WORD *dwResult) { if(m_dwByteIdx + 1 < m_dwLength) { *dwResult = (m_pBuf[m_dwByteIdx] << 8) | m_pBuf[m_dwByteIdx + 1]; @@ -228,7 +228,7 @@ inline void CJBig2_BitStream::align4Byte() } m_dwByteIdx = (m_dwByteIdx + 3) & -4; } -inline FX_BYTE CJBig2_BitStream::getAt(FX_DWORD dwOffset) +inline uint8_t CJBig2_BitStream::getAt(FX_DWORD dwOffset) { if(dwOffset < m_dwLength) { return m_pBuf[dwOffset]; @@ -236,7 +236,7 @@ inline FX_BYTE CJBig2_BitStream::getAt(FX_DWORD dwOffset) return 0; } } -inline FX_BYTE CJBig2_BitStream::getCurByte() +inline uint8_t CJBig2_BitStream::getCurByte() { if(m_dwByteIdx < m_dwLength) { return m_pBuf[m_dwByteIdx]; @@ -244,7 +244,7 @@ inline FX_BYTE CJBig2_BitStream::getCurByte() return 0; } } -inline FX_BYTE CJBig2_BitStream::getNextByte() +inline uint8_t CJBig2_BitStream::getNextByte() { if(m_dwByteIdx + 1 < m_dwLength) { return m_pBuf[m_dwByteIdx + 1]; @@ -252,7 +252,7 @@ inline FX_BYTE CJBig2_BitStream::getNextByte() return 0; } } -inline FX_INT32 CJBig2_BitStream::incByteIdx() +inline int32_t CJBig2_BitStream::incByteIdx() { if(m_dwByteIdx < m_dwLength) { m_dwByteIdx ++; @@ -261,7 +261,7 @@ inline FX_INT32 CJBig2_BitStream::incByteIdx() return -1; } } -inline FX_BYTE CJBig2_BitStream::getCurByte_arith() +inline uint8_t CJBig2_BitStream::getCurByte_arith() { if(m_dwByteIdx < m_dwLength) { return m_pBuf[m_dwByteIdx]; @@ -269,7 +269,7 @@ inline FX_BYTE CJBig2_BitStream::getCurByte_arith() return 0xff; } } -inline FX_BYTE CJBig2_BitStream::getNextByte_arith() +inline uint8_t CJBig2_BitStream::getNextByte_arith() { if(m_dwByteIdx + 1 < m_dwLength) { return m_pBuf[m_dwByteIdx + 1]; @@ -297,11 +297,11 @@ inline void CJBig2_BitStream::setBitPos(FX_DWORD dwBitPos) m_dwByteIdx = dwBitPos >> 3; m_dwBitIdx = dwBitPos & 7; } -inline FX_BYTE *CJBig2_BitStream::getBuf() +inline uint8_t *CJBig2_BitStream::getBuf() { return m_pBuf; } -inline FX_BYTE *CJBig2_BitStream::getPointer() +inline uint8_t *CJBig2_BitStream::getPointer() { return m_pBuf + m_dwByteIdx; } diff --git a/core/src/fxcodec/jbig2/JBig2_Context.cpp b/core/src/fxcodec/jbig2/JBig2_Context.cpp index bcd16e7e14..1c7592778d 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Context.cpp @@ -23,8 +23,8 @@ void OutputBitmap(CJBig2_Image* pImage) return; } } -CJBig2_Context *CJBig2_Context::CreateContext(CJBig2_Module *pModule, FX_BYTE *pGlobalData, FX_DWORD dwGlobalLength, - FX_BYTE *pData, FX_DWORD dwLength, FX_INT32 nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause) +CJBig2_Context *CJBig2_Context::CreateContext(CJBig2_Module *pModule, uint8_t *pGlobalData, FX_DWORD dwGlobalLength, + uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause) { return new(pModule)CJBig2_Context(pGlobalData, dwGlobalLength, pData, dwLength, nStreamType, pSymbolDictCache, pPause); } @@ -34,8 +34,8 @@ void CJBig2_Context::DestroyContext(CJBig2_Context *pContext) delete pContext; } } -CJBig2_Context::CJBig2_Context(FX_BYTE *pGlobalData, FX_DWORD dwGlobalLength, - FX_BYTE *pData, FX_DWORD dwLength, FX_INT32 nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause) +CJBig2_Context::CJBig2_Context(uint8_t *pGlobalData, FX_DWORD dwGlobalLength, + uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause) { if(pGlobalData && (dwGlobalLength > 0)) { JBIG2_ALLOC(m_pGlobalContext, CJBig2_Context(NULL, 0, pGlobalData, dwGlobalLength, @@ -96,12 +96,12 @@ CJBig2_Context::~CJBig2_Context() } m_pSegmentList = NULL; } -FX_INT32 CJBig2_Context::decodeFile(IFX_Pause* pPause) +int32_t CJBig2_Context::decodeFile(IFX_Pause* pPause) { - FX_BYTE cFlags; + uint8_t cFlags; FX_DWORD dwTemp; - const FX_BYTE fileID[] = {0x97, 0x4A, 0x42, 0x32, 0x0D, 0x0A, 0x1A, 0x0A}; - FX_INT32 nRet; + const uint8_t fileID[] = {0x97, 0x4A, 0x42, 0x32, 0x0D, 0x0A, 0x1A, 0x0A}; + int32_t nRet; if(m_pStream->getByteLeft() < 8) { m_pModule->JBig2_Error("file header too short."); nRet = JBIG2_ERROR_TOO_SHORT; @@ -139,9 +139,9 @@ FX_INT32 CJBig2_Context::decodeFile(IFX_Pause* pPause) failed: return nRet; } -FX_INT32 CJBig2_Context::decode_SquentialOrgnazation(IFX_Pause* pPause) +int32_t CJBig2_Context::decode_SquentialOrgnazation(IFX_Pause* pPause) { - FX_INT32 nRet; + int32_t nRet; if(m_pStream->getByteLeft() > 0) { while(m_pStream->getByteLeft() >= JBIG2_MIN_SEGMENT_SIZE) { if(m_pSegment == NULL) { @@ -189,14 +189,14 @@ FX_INT32 CJBig2_Context::decode_SquentialOrgnazation(IFX_Pause* pPause) } return JBIG2_SUCCESS; } -FX_INT32 CJBig2_Context::decode_EmbedOrgnazation(IFX_Pause* pPause) +int32_t CJBig2_Context::decode_EmbedOrgnazation(IFX_Pause* pPause) { return decode_SquentialOrgnazation(pPause); } -FX_INT32 CJBig2_Context::decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause) +int32_t CJBig2_Context::decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause) { CJBig2_Segment *pSegment; - FX_INT32 nRet; + int32_t nRet; while(m_pStream->getByteLeft() > JBIG2_MIN_SEGMENT_SIZE) { JBIG2_ALLOC(pSegment, CJBig2_Segment()); nRet = parseSegmentHeader(pSegment); @@ -217,9 +217,9 @@ FX_INT32 CJBig2_Context::decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause) m_nSegmentDecoded = 0; return decode_RandomOrgnazation(pPause); } -FX_INT32 CJBig2_Context::decode_RandomOrgnazation(IFX_Pause* pPause) +int32_t CJBig2_Context::decode_RandomOrgnazation(IFX_Pause* pPause) { - FX_INT32 nRet; + int32_t nRet; for(; m_nSegmentDecoded < m_pSegmentList->getLength(); m_nSegmentDecoded++) { nRet = parseSegmentData(m_pSegmentList->getAt(m_nSegmentDecoded), pPause); if((nRet == JBIG2_END_OF_PAGE) || (nRet == JBIG2_END_OF_FILE)) { @@ -235,9 +235,9 @@ FX_INT32 CJBig2_Context::decode_RandomOrgnazation(IFX_Pause* pPause) } return JBIG2_SUCCESS; } -FX_INT32 CJBig2_Context::getFirstPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT32 stride, IFX_Pause* pPause) +int32_t CJBig2_Context::getFirstPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t stride, IFX_Pause* pPause) { - FX_INT32 nRet = 0; + int32_t nRet = 0; if(m_pGlobalContext) { nRet = m_pGlobalContext->decode_EmbedOrgnazation(pPause); if(nRet != JBIG2_SUCCESS) { @@ -260,10 +260,10 @@ FX_INT32 CJBig2_Context::getFirstPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 he int ret = Continue(pPause); return ret; } -FX_INT32 CJBig2_Context::Continue(IFX_Pause* pPause) +int32_t CJBig2_Context::Continue(IFX_Pause* pPause) { m_ProcessiveStatus = FXCODEC_STATUS_DECODE_READY; - FX_INT32 nRet; + int32_t nRet; if(m_PauseStep <= 1) { switch(m_nStreamType) { case JBIG2_FILE_STREAM: @@ -311,9 +311,9 @@ FX_INT32 CJBig2_Context::Continue(IFX_Pause* pPause) } return nRet; } -FX_INT32 CJBig2_Context::getNextPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT32 stride, IFX_Pause* pPause) +int32_t CJBig2_Context::getNextPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t stride, IFX_Pause* pPause) { - FX_INT32 nRet = JBIG2_ERROR_STREAM_TYPE; + int32_t nRet = JBIG2_ERROR_STREAM_TYPE; m_bFirstPage = FALSE; m_PauseStep = 0; if(m_pPage) { @@ -345,9 +345,9 @@ FX_INT32 CJBig2_Context::getNextPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 hei } return nRet; } -FX_INT32 CJBig2_Context::getFirstPage(CJBig2_Image **image, IFX_Pause* pPause) +int32_t CJBig2_Context::getFirstPage(CJBig2_Image **image, IFX_Pause* pPause) { - FX_INT32 nRet; + int32_t nRet; m_bFirstPage = TRUE; m_PauseStep = 0; if(m_pGlobalContext) { @@ -359,9 +359,9 @@ FX_INT32 CJBig2_Context::getFirstPage(CJBig2_Image **image, IFX_Pause* pPause) m_bBufSpecified = FALSE; return Continue(pPause); } -FX_INT32 CJBig2_Context::getNextPage(CJBig2_Image **image, IFX_Pause* pPause) +int32_t CJBig2_Context::getNextPage(CJBig2_Image **image, IFX_Pause* pPause) { - FX_INT32 nRet; + int32_t nRet; m_bBufSpecified = FALSE; m_bFirstPage = FALSE; m_PauseStep = 0; @@ -391,7 +391,7 @@ FX_INT32 CJBig2_Context::getNextPage(CJBig2_Image **image, IFX_Pause* pPause) CJBig2_Segment *CJBig2_Context::findSegmentByNumber(FX_DWORD dwNumber) { CJBig2_Segment *pSeg; - FX_INT32 i; + int32_t i; if(m_pGlobalContext) { pSeg = m_pGlobalContext->findSegmentByNumber(dwNumber); if(pSeg) { @@ -407,10 +407,10 @@ CJBig2_Segment *CJBig2_Context::findSegmentByNumber(FX_DWORD dwNumber) return NULL; } CJBig2_Segment *CJBig2_Context::findReferredSegmentByTypeAndIndex(CJBig2_Segment *pSegment, - FX_BYTE cType, FX_INT32 nIndex) + uint8_t cType, int32_t nIndex) { CJBig2_Segment *pSeg; - FX_INT32 i, count; + int32_t i, count; count = 0; for(i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { pSeg = findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]); @@ -424,10 +424,10 @@ CJBig2_Segment *CJBig2_Context::findReferredSegmentByTypeAndIndex(CJBig2_Segment } return NULL; } -FX_INT32 CJBig2_Context::parseSegmentHeader(CJBig2_Segment *pSegment) +int32_t CJBig2_Context::parseSegmentHeader(CJBig2_Segment *pSegment) { - FX_BYTE cSSize, cPSize; - FX_BYTE cTemp; + uint8_t cSSize, cPSize; + uint8_t cTemp; FX_WORD wTemp; FX_DWORD dwTemp; if((m_pStream->readInteger(&pSegment->m_dwNumber) != 0) @@ -457,7 +457,7 @@ FX_INT32 CJBig2_Context::parseSegmentHeader(CJBig2_Segment *pSegment) if(pSegment->m_nReferred_to_segment_count) { pSegment->m_pReferred_to_segment_numbers = (FX_DWORD*)m_pModule->JBig2_Malloc2( sizeof(FX_DWORD), pSegment->m_nReferred_to_segment_count); - for(FX_INT32 i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { + for(int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { switch(cSSize) { case 1: if(m_pStream->read1Byte(&cTemp) != 0) { @@ -504,15 +504,15 @@ failed: m_pModule->JBig2_Error("header too short."); return JBIG2_ERROR_TOO_SHORT; } -FX_INT32 CJBig2_Context::parseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause) +int32_t CJBig2_Context::parseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause) { - FX_INT32 ret = ProcessiveParseSegmentData(pSegment, pPause); + int32_t ret = ProcessiveParseSegmentData(pSegment, pPause); while(m_ProcessiveStatus == FXCODEC_STATUS_DECODE_TOBECONTINUE && m_pStream->getByteLeft() > 0) { ret = ProcessiveParseSegmentData(pSegment, pPause); } return ret; } -FX_INT32 CJBig2_Context::ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause) +int32_t CJBig2_Context::ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause) { switch(pSegment->m_cFlags.s.type) { case 0: @@ -613,13 +613,13 @@ failed2: m_pModule->JBig2_Error("segment syntax error."); return JBIG2_ERROR_FETAL; } -FX_INT32 CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPause) +int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPause) { FX_DWORD dwTemp; FX_WORD wFlags; - FX_BYTE cSDHUFFDH, cSDHUFFDW, cSDHUFFBMSIZE, cSDHUFFAGGINST; + uint8_t cSDHUFFDH, cSDHUFFDW, cSDHUFFBMSIZE, cSDHUFFAGGINST; CJBig2_HuffmanTable *Table_B1 = NULL, *Table_B2 = NULL, *Table_B3 = NULL, *Table_B4 = NULL, *Table_B5 = NULL; - FX_INT32 i, nIndex, nRet; + int32_t i, nIndex, nRet; CJBig2_Segment *pSeg = NULL, *pLRSeg = NULL; FX_BOOL bUsed; CJBig2_Image ** SDINSYMS = NULL; @@ -627,7 +627,7 @@ FX_INT32 CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pP JBig2ArithCtx *gbContext = NULL, *grContext = NULL; CJBig2_ArithDecoder *pArithDecoder; JBIG2_ALLOC(pSymbolDictDecoder, CJBig2_SDDProc()); - FX_BYTE *key = pSegment->m_pData; + uint8_t *key = pSegment->m_pData; FX_BOOL cache_hit = false; if(m_pStream->readShortInteger(&wFlags) != 0) { m_pModule->JBig2_Error("symbol dictionary segment : data header too short."); @@ -648,8 +648,8 @@ FX_INT32 CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pP } else { dwTemp = 2; } - for(i = 0; i < (FX_INT32)dwTemp; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&pSymbolDictDecoder->SDAT[i]) != 0) { + for(i = 0; i < (int32_t)dwTemp; i++) { + if(m_pStream->read1Byte((uint8_t*)&pSymbolDictDecoder->SDAT[i]) != 0) { m_pModule->JBig2_Error("symbol dictionary segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -658,7 +658,7 @@ FX_INT32 CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pP } if((pSymbolDictDecoder->SDREFAGG == 1) && (pSymbolDictDecoder->SDRTEMPLATE == 0)) { for(i = 0; i < 4; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&pSymbolDictDecoder->SDRAT[i]) != 0) { + if(m_pStream->read1Byte((uint8_t*)&pSymbolDictDecoder->SDRAT[i]) != 0) { m_pModule->JBig2_Error("symbol dictionary segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -917,12 +917,12 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment) { FX_DWORD dwTemp; FX_WORD wFlags; - FX_INT32 i, nIndex, nRet; + int32_t i, nIndex, nRet; JBig2RegionInfo ri; CJBig2_Segment *pSeg; CJBig2_Image **SBSYMS = NULL; JBig2HuffmanCode *SBSYMCODES = NULL; - FX_BYTE cSBHUFFFS, cSBHUFFDS, cSBHUFFDT, cSBHUFFRDW, cSBHUFFRDH, cSBHUFFRDX, cSBHUFFRDY, cSBHUFFRSIZE; + uint8_t cSBHUFFFS, cSBHUFFDS, cSBHUFFDT, cSBHUFFRDW, cSBHUFFRDH, cSBHUFFRDX, cSBHUFFRDY, cSBHUFFRSIZE; CJBig2_HuffmanTable *Table_B1 = NULL, *Table_B6 = NULL, *Table_B7 = NULL, @@ -976,7 +976,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment) } if((pTRD->SBREFINE == 1) && (pTRD->SBRTEMPLATE == 0)) { for(i = 0; i < 4; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&pTRD->SBRAT[i]) != 0) { + if(m_pStream->read1Byte((uint8_t*)&pTRD->SBRAT[i]) != 0) { m_pModule->JBig2_Error("text region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -1032,7 +1032,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment) while((FX_DWORD)(1 << dwTemp) < pTRD->SBNUMSYMS) { dwTemp ++; } - pTRD->SBSYMCODELEN = (FX_BYTE)dwTemp; + pTRD->SBSYMCODELEN = (uint8_t)dwTemp; } if(pTRD->SBHUFF == 1) { if((cSBHUFFFS == 2) || (cSBHUFFRDW == 2) || (cSBHUFFRDH == 2) @@ -1326,11 +1326,11 @@ failed: FX_BOOL CJBig2_Context::parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pPause) { FX_DWORD dwTemp; - FX_BYTE cFlags; + uint8_t cFlags; JBig2ArithCtx *gbContext; CJBig2_ArithDecoder *pArithDecoder; CJBig2_PDDProc *pPDD; - FX_INT32 nRet; + int32_t nRet; JBIG2_ALLOC(pPDD, CJBig2_PDDProc()); if((m_pStream->read1Byte(&cFlags) != 0) || (m_pStream->read1Byte(&pPDD->HDPW) != 0) @@ -1380,14 +1380,14 @@ failed: FX_BOOL CJBig2_Context::parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause) { FX_DWORD dwTemp; - FX_BYTE cFlags; + uint8_t cFlags; JBig2RegionInfo ri; CJBig2_Segment *pSeg; CJBig2_PatternDict *pPatternDict; JBig2ArithCtx *gbContext; CJBig2_ArithDecoder *pArithDecoder; CJBig2_HTRDProc *pHRD; - FX_INT32 nRet; + int32_t nRet; JBIG2_ALLOC(pHRD, CJBig2_HTRDProc()); if((parseRegionInfo(&ri) != JBIG2_SUCCESS) || (m_pStream->read1Byte(&cFlags) != 0) @@ -1474,8 +1474,8 @@ failed: FX_BOOL CJBig2_Context::parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause) { FX_DWORD dwTemp; - FX_BYTE cFlags; - FX_INT32 i, nRet; + uint8_t cFlags; + int32_t i, nRet; if(m_pGRD == NULL) { JBIG2_ALLOC(m_pGRD, CJBig2_GRDProc()); if((parseRegionInfo(&m_ri) != JBIG2_SUCCESS) @@ -1497,7 +1497,7 @@ FX_BOOL CJBig2_Context::parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* if(m_pGRD->MMR == 0) { if(m_pGRD->GBTEMPLATE == 0) { for(i = 0; i < 8; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&m_pGRD->GBAT[i]) != 0) { + if(m_pStream->read1Byte((uint8_t*)&m_pGRD->GBAT[i]) != 0) { m_pModule->JBig2_Error("generic region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -1505,7 +1505,7 @@ FX_BOOL CJBig2_Context::parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* } } else { for(i = 0; i < 2; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&m_pGRD->GBAT[i]) != 0) { + if(m_pStream->read1Byte((uint8_t*)&m_pGRD->GBAT[i]) != 0) { m_pModule->JBig2_Error("generic region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -1593,8 +1593,8 @@ FX_BOOL CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment *pSegment) FX_DWORD dwTemp; JBig2RegionInfo ri; CJBig2_Segment *pSeg; - FX_INT32 i, nRet; - FX_BYTE cFlags; + int32_t i, nRet; + uint8_t cFlags; JBig2ArithCtx *grContext; CJBig2_GRRDProc *pGRRD; CJBig2_ArithDecoder *pArithDecoder; @@ -1611,7 +1611,7 @@ FX_BOOL CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment *pSegment) pGRRD->TPGRON = (cFlags >> 1) & 0x01; if(pGRRD->GRTEMPLATE == 0) { for(i = 0; i < 4; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&pGRRD->GRAT[i]) != 0) { + if(m_pStream->read1Byte((uint8_t*)&pGRRD->GRAT[i]) != 0) { m_pModule->JBig2_Error("generic refinement region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -1687,7 +1687,7 @@ FX_BOOL CJBig2_Context::parseTable(CJBig2_Segment *pSegment) m_pStream->alignByte(); return JBIG2_SUCCESS; } -FX_INT32 CJBig2_Context::parseRegionInfo(JBig2RegionInfo *pRI) +int32_t CJBig2_Context::parseRegionInfo(JBig2RegionInfo *pRI) { if((m_pStream->readInteger((FX_DWORD*)&pRI->width) != 0) || (m_pStream->readInteger((FX_DWORD*)&pRI->height) != 0) @@ -1702,9 +1702,9 @@ JBig2HuffmanCode *CJBig2_Context::decodeSymbolIDHuffmanTable(CJBig2_BitStream *p FX_DWORD SBNUMSYMS) { JBig2HuffmanCode *SBSYMCODES; - FX_INT32 runcodes[35], runcodes_len[35], runcode; - FX_INT32 i, j, nTemp, nVal, nBits; - FX_INT32 run; + int32_t runcodes[35], runcodes_len[35], runcode; + int32_t i, j, nTemp, nVal, nBits; + int32_t run; SBSYMCODES = (JBig2HuffmanCode*)m_pModule->JBig2_Malloc2(sizeof(JBig2HuffmanCode), SBNUMSYMS); for (i = 0; i < 35; i ++) { if(pStream->readNBits(4, &runcodes_len[i]) != 0) { diff --git a/core/src/fxcodec/jbig2/JBig2_Context.h b/core/src/fxcodec/jbig2/JBig2_Context.h index f46530e005..b12853accf 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.h +++ b/core/src/fxcodec/jbig2/JBig2_Context.h @@ -14,7 +14,7 @@ #include "../../../include/fxcodec/fx_codec_def.h" #include "../../../include/fxcrt/fx_basic.h" #include <utility> -typedef std::pair<FX_BYTE*, CJBig2_SymbolDict*> CJBig2_CachePair; +typedef std::pair<uint8_t*, CJBig2_SymbolDict*> CJBig2_CachePair; typedef enum { JBIG2_OUT_OF_PAGE = 0, JBIG2_IN_PAGE, @@ -37,64 +37,64 @@ class CJBig2_Context : public CJBig2_Object { public: - static CJBig2_Context *CreateContext(CJBig2_Module *pModule, FX_BYTE *pGlobalData, FX_DWORD dwGlobalLength, - FX_BYTE *pData, FX_DWORD dwLength, FX_INT32 nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause = NULL); + static CJBig2_Context *CreateContext(CJBig2_Module *pModule, uint8_t *pGlobalData, FX_DWORD dwGlobalLength, + uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause = NULL); static void DestroyContext(CJBig2_Context *pContext); - FX_INT32 getFirstPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT32 stride, IFX_Pause* pPause); + int32_t getFirstPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t stride, IFX_Pause* pPause); - FX_INT32 getNextPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT32 stride, IFX_Pause* pPause); + int32_t getNextPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t stride, IFX_Pause* pPause); - FX_INT32 getFirstPage(CJBig2_Image **image, IFX_Pause* pPause); + int32_t getFirstPage(CJBig2_Image **image, IFX_Pause* pPause); - FX_INT32 getNextPage(CJBig2_Image **image, IFX_Pause* pPause); - FX_INT32 Continue(IFX_Pause* pPause); + int32_t getNextPage(CJBig2_Image **image, IFX_Pause* pPause); + int32_t Continue(IFX_Pause* pPause); FXCODEC_STATUS GetProcessiveStatus() { return m_ProcessiveStatus; }; private: - CJBig2_Context(FX_BYTE *pGlobalData, FX_DWORD dwGlobalLength, - FX_BYTE *pData, FX_DWORD dwLength, FX_INT32 nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause); + CJBig2_Context(uint8_t *pGlobalData, FX_DWORD dwGlobalLength, + uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause); ~CJBig2_Context(); - FX_INT32 decodeFile(IFX_Pause* pPause); + int32_t decodeFile(IFX_Pause* pPause); - FX_INT32 decode_SquentialOrgnazation(IFX_Pause* pPause); + int32_t decode_SquentialOrgnazation(IFX_Pause* pPause); - FX_INT32 decode_EmbedOrgnazation(IFX_Pause* pPause); + int32_t decode_EmbedOrgnazation(IFX_Pause* pPause); - FX_INT32 decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause); + int32_t decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause); - FX_INT32 decode_RandomOrgnazation(IFX_Pause* pPause); + int32_t decode_RandomOrgnazation(IFX_Pause* pPause); CJBig2_Segment *findSegmentByNumber(FX_DWORD dwNumber); - CJBig2_Segment *findReferredSegmentByTypeAndIndex(CJBig2_Segment *pSegment, FX_BYTE cType, FX_INT32 nIndex); + CJBig2_Segment *findReferredSegmentByTypeAndIndex(CJBig2_Segment *pSegment, uint8_t cType, int32_t nIndex); - FX_INT32 parseSegmentHeader(CJBig2_Segment *pSegment); + int32_t parseSegmentHeader(CJBig2_Segment *pSegment); - FX_INT32 parseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 parseTextRegion(CJBig2_Segment *pSegment); + int32_t parseTextRegion(CJBig2_Segment *pSegment); - FX_INT32 parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 parseGenericRefinementRegion(CJBig2_Segment *pSegment); + int32_t parseGenericRefinementRegion(CJBig2_Segment *pSegment); - FX_INT32 parseTable(CJBig2_Segment *pSegment); + int32_t parseTable(CJBig2_Segment *pSegment); - FX_INT32 parseRegionInfo(JBig2RegionInfo *pRI); + int32_t parseRegionInfo(JBig2RegionInfo *pRI); @@ -108,11 +108,11 @@ private: CJBig2_Context *m_pGlobalContext; - FX_INT32 m_nStreamType; + int32_t m_nStreamType; CJBig2_BitStream *m_pStream; - FX_INT32 m_nState; + int32_t m_nState; CJBig2_List<CJBig2_Segment> *m_pSegmentList; @@ -122,9 +122,9 @@ private: FX_BOOL m_bBufSpecified; - FX_INT32 m_nSegmentDecoded; + int32_t m_nSegmentDecoded; IFX_Pause* m_pPause; - FX_INT32 m_PauseStep; + int32_t m_PauseStep; FXCODEC_STATUS m_ProcessiveStatus; FX_BOOL m_bFirstPage; CJBig2_ArithDecoder *m_pArithDecoder; diff --git a/core/src/fxcodec/jbig2/JBig2_Define.h b/core/src/fxcodec/jbig2/JBig2_Define.h index ccf15d07ba..46c6e2b532 100644 --- a/core/src/fxcodec/jbig2/JBig2_Define.h +++ b/core/src/fxcodec/jbig2/JBig2_Define.h @@ -13,15 +13,15 @@ #include "JBig2_Object.h" #define JBIG2_OOB 1 typedef struct { - FX_INT32 width, + int32_t width, height; - FX_INT32 x, + int32_t x, y; - FX_BYTE flags; + uint8_t flags; } JBig2RegionInfo; typedef struct { - FX_INT32 codelen; - FX_INT32 code; + int32_t codelen; + 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); diff --git a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp index a5928f9ea3..bad595e6b7 100644 --- a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp +++ b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp @@ -150,9 +150,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_opt2(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, cVal; - FX_INTPTR nStride, nStride2; - FX_INT32 nBits, k; + uint8_t *pLine, cVal; + intptr_t nStride, nStride2; + int32_t nBits, k; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -217,9 +217,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_opt3(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine, *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -401,9 +401,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_opt2(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, cVal; - FX_INTPTR nStride, nStride2; - FX_INT32 nBits, k; + uint8_t *pLine, cVal; + intptr_t nStride, nStride2; + int32_t nBits, k; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -468,9 +468,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_opt3(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine, *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -647,9 +647,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_opt2(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, cVal; - FX_INTPTR nStride, nStride2; - FX_INT32 nBits, k; + uint8_t *pLine, cVal; + intptr_t nStride, nStride2; + int32_t nBits, k; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -714,9 +714,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_opt3(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine, *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -887,9 +887,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_opt2(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1; - FX_BYTE *pLine, cVal; - FX_INTPTR nStride; - FX_INT32 nBits, k; + uint8_t *pLine, cVal; + intptr_t nStride; + int32_t nBits, k; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -945,9 +945,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_opt3(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1; - FX_BYTE *pLine, *pLine1, cVal; - FX_INT32 nStride, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine, *pLine1, cVal; + int32_t nStride, k; + int32_t nLineBytes, nBitsLeft, cc; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -1428,13 +1428,13 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithD FX_DWORD CONTEXT; CJBig2_Image *GRREG; FX_DWORD line1, line1_r, line2_r, line3_r; - FX_BYTE *pLine, *pLineR, cVal; - FX_INTPTR nStride, nStrideR, nOffset; - FX_INT32 k, nBits; - FX_INT32 GRWR, GRHR; - FX_INT32 GRW, GRH; - GRW = (FX_INT32)CJBig2_GRRDProc::GRW; - GRH = (FX_INT32)CJBig2_GRRDProc::GRH; + uint8_t *pLine, *pLineR, cVal; + intptr_t nStride, nStrideR, nOffset; + int32_t k, nBits; + int32_t GRWR, GRHR; + int32_t GRW, GRH; + GRW = (int32_t)CJBig2_GRRDProc::GRW; + GRH = (int32_t)CJBig2_GRRDProc::GRH; LTP = 0; JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH)); if (GRREG->m_pData == NULL) { @@ -1446,19 +1446,19 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithD pLineR = GRREFERENCE->m_pData; nStride = GRREG->m_nStride; nStrideR = GRREFERENCE->m_nStride; - GRWR = (FX_INT32)GRREFERENCE->m_nWidth; - GRHR = (FX_INT32)GRREFERENCE->m_nHeight; + GRWR = (int32_t)GRREFERENCE->m_nWidth; + GRHR = (int32_t)GRREFERENCE->m_nHeight; if (GRREFERENCEDY < -GRHR + 1 || GRREFERENCEDY > GRHR - 1) { GRREFERENCEDY = 0; } nOffset = -GRREFERENCEDY * nStrideR; - for (FX_INT32 h = 0; h < GRH; h++) { + for (int32_t h = 0; h < GRH; h++) { if(TPGRON) { SLTP = pArithDecoder->DECODE(&grContext[0x0010]); LTP = LTP ^ SLTP; } line1 = (h > 0) ? pLine[-nStride] << 4 : 0; - FX_INT32 reference_h = h - GRREFERENCEDY; + int32_t reference_h = h - GRREFERENCEDY; FX_BOOL line1_r_ok = (reference_h > 0 && reference_h < GRHR + 1); FX_BOOL line2_r_ok = (reference_h > -1 && reference_h < GRHR); FX_BOOL line3_r_ok = (reference_h > -2 && reference_h < GRHR - 1); @@ -1468,7 +1468,7 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithD if(LTP == 0) { CONTEXT = (line1 & 0x1c00) | (line1_r & 0x01c0) | ((line2_r >> 3) & 0x0038) | ((line3_r >> 6) & 0x0007); - for (FX_INT32 w = 0; w < GRW; w += 8) { + for (int32_t w = 0; w < GRW; w += 8) { nBits = GRW - w > 8 ? 8 : GRW - w; if (h > 0) line1 = (line1 << 8) | @@ -1506,7 +1506,7 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithD } else { CONTEXT = (line1 & 0x1c00) | (line1_r & 0x01c0) | ((line2_r >> 3) & 0x0038) | ((line3_r >> 6) & 0x0007); - for (FX_INT32 w = 0; w < GRW; w += 8) { + for (int32_t w = 0; w < GRW; w += 8) { nBits = GRW - w > 8 ? 8 : GRW - w; if (h > 0) line1 = (line1 << 8) | @@ -1637,13 +1637,13 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithD FX_DWORD CONTEXT; CJBig2_Image *GRREG; FX_DWORD line1, line1_r, line2_r, line3_r; - FX_BYTE *pLine, *pLineR, cVal; - FX_INTPTR nStride, nStrideR, nOffset; - FX_INT32 k, nBits; - FX_INT32 GRWR, GRHR; - FX_INT32 GRW, GRH; - GRW = (FX_INT32)CJBig2_GRRDProc::GRW; - GRH = (FX_INT32)CJBig2_GRRDProc::GRH; + uint8_t *pLine, *pLineR, cVal; + intptr_t nStride, nStrideR, nOffset; + int32_t k, nBits; + int32_t GRWR, GRHR; + int32_t GRW, GRH; + GRW = (int32_t)CJBig2_GRRDProc::GRW; + GRH = (int32_t)CJBig2_GRRDProc::GRH; LTP = 0; JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH)); if (GRREG->m_pData == NULL) { @@ -1655,19 +1655,19 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithD pLineR = GRREFERENCE->m_pData; nStride = GRREG->m_nStride; nStrideR = GRREFERENCE->m_nStride; - GRWR = (FX_INT32)GRREFERENCE->m_nWidth; - GRHR = (FX_INT32)GRREFERENCE->m_nHeight; + GRWR = (int32_t)GRREFERENCE->m_nWidth; + GRHR = (int32_t)GRREFERENCE->m_nHeight; if (GRREFERENCEDY < -GRHR + 1 || GRREFERENCEDY > GRHR - 1) { GRREFERENCEDY = 0; } nOffset = -GRREFERENCEDY * nStrideR; - for (FX_INT32 h = 0; h < GRH; h++) { + for (int32_t h = 0; h < GRH; h++) { if(TPGRON) { SLTP = pArithDecoder->DECODE(&grContext[0x0008]); LTP = LTP ^ SLTP; } line1 = (h > 0) ? pLine[-nStride] << 1 : 0; - FX_INT32 reference_h = h - GRREFERENCEDY; + int32_t reference_h = h - GRREFERENCEDY; FX_BOOL line1_r_ok = (reference_h > 0 && reference_h < GRHR + 1); FX_BOOL line2_r_ok = (reference_h > -1 && reference_h < GRHR); FX_BOOL line3_r_ok = (reference_h > -2 && reference_h < GRHR - 1); @@ -1677,7 +1677,7 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithD if(LTP == 0) { CONTEXT = (line1 & 0x0380) | ((line1_r >> 2) & 0x0020) | ((line2_r >> 4) & 0x001c) | ((line3_r >> 6) & 0x0003); - for (FX_INT32 w = 0; w < GRW; w += 8) { + for (int32_t w = 0; w < GRW; w += 8) { nBits = GRW - w > 8 ? 8 : GRW - w; if (h > 0) line1 = (line1 << 8) | @@ -1709,7 +1709,7 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithD } else { CONTEXT = (line1 & 0x0380) | ((line1_r >> 2) & 0x0020) | ((line2_r >> 4) & 0x001c) | ((line3_r >> 6) & 0x0003); - for (FX_INT32 w = 0; w < GRW; w += 8) { + for (int32_t w = 0; w < GRW; w += 8) { nBits = GRW - w > 8 ? 8 : GRW - w; if (h > 0) line1 = (line1 << 8) | @@ -1872,23 +1872,23 @@ CJBig2_Image *CJBig2_GRRDProc::decode_V1(CJBig2_ArithDecoder *pArithDecoder, JBi } CJBig2_Image *CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream *pStream, JBig2ArithCtx *grContext) { - FX_INT32 STRIPT, FIRSTS; + int32_t STRIPT, FIRSTS; FX_DWORD NINSTANCES; - FX_INT32 DT, DFS, CURS; - FX_BYTE CURT; - FX_INT32 SI, TI; + int32_t DT, DFS, CURS; + uint8_t CURT; + int32_t SI, TI; FX_DWORD IDI; CJBig2_Image *IBI; FX_DWORD WI, HI; - FX_INT32 IDS; + int32_t IDS; FX_BOOL RI; - FX_INT32 RDWI, RDHI, RDXI, RDYI; + int32_t RDWI, RDHI, RDXI, RDYI; CJBig2_Image *IBOI; FX_DWORD WOI, HOI; CJBig2_Image *SBREG; FX_BOOL bFirst; FX_DWORD nTmp; - FX_INT32 nVal, nBits; + int32_t nVal, nBits; CJBig2_HuffmanDecoder *pHuffmanDecoder; CJBig2_GRRDProc *pGRRD; CJBig2_ArithDecoder *pArithDecoder; @@ -2092,23 +2092,23 @@ failed: CJBig2_Image *CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *grContext, JBig2IntDecoderState *pIDS) { - FX_INT32 STRIPT, FIRSTS; + int32_t STRIPT, FIRSTS; FX_DWORD NINSTANCES; - FX_INT32 DT, DFS, CURS; - FX_INT32 CURT; - FX_INT32 SI, TI; + int32_t DT, DFS, CURS; + int32_t CURT; + int32_t SI, TI; FX_DWORD IDI; CJBig2_Image *IBI; FX_DWORD WI, HI; - FX_INT32 IDS; + int32_t IDS; FX_BOOL RI; - FX_INT32 RDWI, RDHI, RDXI, RDYI; + int32_t RDWI, RDHI, RDXI, RDYI; CJBig2_Image *IBOI; FX_DWORD WOI, HOI; CJBig2_Image *SBREG; FX_BOOL bFirst; - FX_INT32 nRet, nVal; - FX_INT32 bRetained; + int32_t nRet, nVal; + int32_t bRetained; CJBig2_ArithIntDecoder *IADT, *IAFS, *IADS, *IAIT, *IARI, *IARDW, *IARDH, *IARDX, *IARDY; CJBig2_ArithIaidDecoder *IAID; CJBig2_GRRDProc *pGRRD; @@ -2333,21 +2333,21 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecod { CJBig2_Image **SDNEWSYMS; FX_DWORD HCHEIGHT, NSYMSDECODED; - FX_INT32 HCDH; + int32_t HCDH; FX_DWORD SYMWIDTH, TOTWIDTH; - FX_INT32 DW; + int32_t DW; CJBig2_Image *BS; FX_DWORD I, J, REFAGGNINST; FX_BOOL *EXFLAGS; FX_DWORD EXINDEX; FX_BOOL CUREXFLAG; FX_DWORD EXRUNLENGTH; - FX_INT32 nVal; + int32_t nVal; FX_DWORD nTmp; FX_DWORD SBNUMSYMS; - FX_BYTE SBSYMCODELEN; + uint8_t SBSYMCODELEN; FX_DWORD IDI; - FX_INT32 RDXI, RDYI; + int32_t RDXI, RDYI; CJBig2_Image **SBSYMS; CJBig2_HuffmanTable *SBHUFFFS, *SBHUFFDS, *SBHUFFDT, *SBHUFFRDW, *SBHUFFRDH, *SBHUFFRDX, *SBHUFFRDY, *SBHUFFRSIZE; @@ -2374,7 +2374,7 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecod while((FX_DWORD)(1 << nTmp) < (SDNUMINSYMS + SDNUMNEWSYMS)) { nTmp ++; } - JBIG2_ALLOC(IAID, CJBig2_ArithIaidDecoder((FX_BYTE)nTmp)); + JBIG2_ALLOC(IAID, CJBig2_ArithIaidDecoder((uint8_t)nTmp)); SDNEWSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2(SDNUMNEWSYMS, sizeof(CJBig2_Image*)); FXSYS_memset32(SDNEWSYMS, 0 , SDNUMNEWSYMS * sizeof(CJBig2_Image*)); HCHEIGHT = 0; @@ -2458,7 +2458,7 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecod while((FX_DWORD)(1 << nTmp) < SBNUMSYMS) { nTmp ++; } - SBSYMCODELEN = (FX_BYTE)nTmp; + SBSYMCODELEN = (uint8_t)nTmp; pDecoder->SBSYMCODELEN = SBSYMCODELEN; SBSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2(SBNUMSYMS, sizeof(CJBig2_Image*)); JBIG2_memcpy(SBSYMS, SDINSYMS, SDNUMINSYMS * sizeof(CJBig2_Image*)); @@ -2671,22 +2671,22 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream *pStream, CJBig2_Image **SDNEWSYMS; FX_DWORD *SDNEWSYMWIDTHS; FX_DWORD HCHEIGHT, NSYMSDECODED; - FX_INT32 HCDH; + int32_t HCDH; FX_DWORD SYMWIDTH, TOTWIDTH, HCFIRSTSYM; - FX_INT32 DW; + int32_t DW; CJBig2_Image *BS, *BHC; FX_DWORD I, J, REFAGGNINST; FX_BOOL *EXFLAGS; FX_DWORD EXINDEX; FX_BOOL CUREXFLAG; FX_DWORD EXRUNLENGTH; - FX_INT32 nVal, nBits; + int32_t nVal, nBits; FX_DWORD nTmp; FX_DWORD SBNUMSYMS; - FX_BYTE SBSYMCODELEN; + uint8_t SBSYMCODELEN; JBig2HuffmanCode *SBSYMCODES; FX_DWORD IDI; - FX_INT32 RDXI, RDYI; + int32_t RDXI, RDYI; FX_DWORD BMSIZE; FX_DWORD stride; CJBig2_Image **SBSYMS; @@ -2843,7 +2843,7 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream *pStream, while((FX_DWORD)(1 << nTmp) < SBNUMSYMS) { nTmp ++; } - SBSYMCODELEN = (FX_BYTE)nTmp; + SBSYMCODELEN = (uint8_t)nTmp; SBSYMCODES = (JBig2HuffmanCode*)m_pModule->JBig2_Malloc2(SBNUMSYMS, sizeof(JBig2HuffmanCode)); for(I = 0; I < SBNUMSYMS; I++) { SBSYMCODES[I].codelen = SBSYMCODELEN; @@ -2931,7 +2931,7 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream *pStream, NSYMSDECODED = NSYMSDECODED + 1; } if(SDREFAGG == 0) { - if(pHuffmanDecoder->decodeAValue(SDHUFFBMSIZE, (FX_INT32*)&BMSIZE) != 0) { + if(pHuffmanDecoder->decodeAValue(SDHUFFBMSIZE, (int32_t*)&BMSIZE) != 0) { m_pModule->JBig2_Error("symbol dictionary decoding procedure (huffman): too short."); goto failed; } @@ -3042,7 +3042,7 @@ CJBig2_Image *CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause) { FX_DWORD ng, mg; - FX_INT32 x, y; + int32_t x, y; CJBig2_Image *HSKIP; FX_DWORD HBPP; FX_DWORD *GI; @@ -3057,8 +3057,8 @@ CJBig2_Image *CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, for(ng = 0; ng < HGW; ng++) { x = (HGX + mg * HRY + ng * HRX) >> 8; y = (HGY + mg * HRX - ng * HRY) >> 8; - if((x + HPW <= 0) | (x >= (FX_INT32)HBW) - | (y + HPH <= 0) | (y >= (FX_INT32)HPH)) { + if((x + HPW <= 0) | (x >= (int32_t)HBW) + | (y + HPH <= 0) | (y >= (int32_t)HPH)) { HSKIP->setPixel(ng, mg, 1); } else { HSKIP->setPixel(ng, mg, 0); @@ -3074,7 +3074,7 @@ CJBig2_Image *CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, pGID->GSMMR = HMMR; pGID->GSW = HGW; pGID->GSH = HGH; - pGID->GSBPP = (FX_BYTE)HBPP; + pGID->GSBPP = (uint8_t)HBPP; pGID->GSUSESKIP = HENABLESKIP; pGID->GSKIP = HSKIP; pGID->GSTEMPLATE = HTEMPLATE; @@ -3110,7 +3110,7 @@ failed: CJBig2_Image *CJBig2_HTRDProc::decode_MMR(CJBig2_BitStream *pStream, IFX_Pause* pPause) { FX_DWORD ng, mg; - FX_INT32 x, y; + int32_t x, y; FX_DWORD HBPP; FX_DWORD *GI; CJBig2_Image *HTREG; @@ -3125,7 +3125,7 @@ CJBig2_Image *CJBig2_HTRDProc::decode_MMR(CJBig2_BitStream *pStream, IFX_Pause* pGID->GSMMR = HMMR; pGID->GSW = HGW; pGID->GSH = HGH; - pGID->GSBPP = (FX_BYTE)HBPP; + pGID->GSBPP = (uint8_t)HBPP; pGID->GSUSESKIP = 0; GI = pGID->decode_MMR(pStream, pPause); if(GI == NULL) { @@ -3168,7 +3168,7 @@ CJBig2_PatternDict *CJBig2_PDDProc::decode_Arith(CJBig2_ArithDecoder *pArithDeco pGRD->GBTEMPLATE = HDTEMPLATE; pGRD->TPGDON = 0; pGRD->USESKIP = 0; - pGRD->GBAT[0] = -(FX_INT32)HDPW; + pGRD->GBAT[0] = -(int32_t)HDPW; pGRD->GBAT[1] = 0; if(pGRD->GBTEMPLATE == 0) { pGRD->GBAT[2] = -3; @@ -3237,7 +3237,7 @@ FX_DWORD *CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause) { CJBig2_Image **GSPLANES; - FX_INT32 J, K; + int32_t J, K; FX_DWORD x, y; FX_DWORD *GSVALS; CJBig2_GRDProc *pGRD; @@ -3318,7 +3318,7 @@ failed: FX_DWORD *CJBig2_GSIDProc::decode_MMR(CJBig2_BitStream *pStream, IFX_Pause* pPause) { CJBig2_Image **GSPLANES; - FX_INT32 J, K; + int32_t J, K; FX_DWORD x, y; FX_DWORD *GSVALS; CJBig2_GRDProc *pGRD; @@ -3808,9 +3808,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3(CJBig2_Image *pImage, FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1, line2; - FX_BYTE *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; if(m_pLine == NULL) { m_pLine = pImage->m_pData; } @@ -3949,9 +3949,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3(CJBig2_Image *pImage, FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1, line2; - FX_BYTE *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; if (!m_pLine) { m_pLine = pImage->m_pData; } @@ -4087,9 +4087,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3(CJBig2_Image *pImage, FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1, line2; - FX_BYTE *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; if(!m_pLine) { m_pLine = pImage->m_pData; } @@ -4223,9 +4223,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3(CJBig2_Image *pImage, FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1; - FX_BYTE *pLine1, cVal; - FX_INT32 nStride, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine1, cVal; + int32_t nStride, k; + int32_t nLineBytes, nBitsLeft, cc; if (!m_pLine) { m_pLine = pImage->m_pData; } diff --git a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h index 3f43c979a5..45e2940d3a 100644 --- a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h +++ b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h @@ -68,7 +68,7 @@ private: FXCODEC_STATUS decode_Arith_Template3_opt3(CJBig2_Image *pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause); FXCODEC_STATUS decode_Arith_Template3_unopt(CJBig2_Image * pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause); FX_DWORD m_loopIndex; - FX_BYTE * m_pLine; + uint8_t * m_pLine; IFX_Pause* m_pPause; FXCODEC_STATUS m_ProssiveStatus; CJBig2_Image** m_pImage; @@ -114,7 +114,7 @@ public: FX_BOOL MMR; FX_DWORD GBW; FX_DWORD GBH; - FX_BYTE GBTEMPLATE; + uint8_t GBTEMPLATE; FX_BOOL TPGDON; FX_BOOL USESKIP; CJBig2_Image * SKIP; @@ -140,8 +140,8 @@ public: FX_DWORD GRH; FX_BOOL GRTEMPLATE; CJBig2_Image *GRREFERENCE; - FX_INT32 GRREFERENCEDX; - FX_INT32 GRREFERENCEDY; + int32_t GRREFERENCEDX; + int32_t GRREFERENCEDY; FX_BOOL TPGRON; signed char GRAT[4]; }; @@ -175,7 +175,7 @@ public: FX_DWORD SBNUMSYMS; JBig2HuffmanCode *SBSYMCODES; - FX_BYTE SBSYMCODELEN; + uint8_t SBSYMCODELEN; CJBig2_Image **SBSYMS; FX_BOOL SBDEFPIXEL; @@ -214,7 +214,7 @@ public: *SDHUFFDW, *SDHUFFBMSIZE, *SDHUFFAGGINST; - FX_BYTE SDTEMPLATE; + uint8_t SDTEMPLATE; signed char SDAT[8]; FX_BOOL SDRTEMPLATE; signed char SDRAT[4]; @@ -230,7 +230,7 @@ public: FX_DWORD HBW, HBH; FX_BOOL HMMR; - FX_BYTE HTEMPLATE; + uint8_t HTEMPLATE; FX_DWORD HNUMPATS; CJBig2_Image **HPATS; FX_BOOL HDEFPIXEL; @@ -238,11 +238,11 @@ public: FX_BOOL HENABLESKIP; FX_DWORD HGW, HGH; - FX_INT32 HGX, + int32_t HGX, HGY; FX_WORD HRX, HRY; - FX_BYTE HPW, + uint8_t HPW, HPH; }; class CJBig2_PDDProc : public CJBig2_Object @@ -254,10 +254,10 @@ public: CJBig2_PatternDict *decode_MMR(CJBig2_BitStream *pStream, IFX_Pause* pPause); public: FX_BOOL HDMMR; - FX_BYTE HDPW, + uint8_t HDPW, HDPH; FX_DWORD GRAYMAX; - FX_BYTE HDTEMPLATE; + uint8_t HDTEMPLATE; }; class CJBig2_GSIDProc : public CJBig2_Object { @@ -269,10 +269,10 @@ public: public: FX_BOOL GSMMR; FX_BOOL GSUSESKIP; - FX_BYTE GSBPP; + uint8_t GSBPP; FX_DWORD GSW, GSH; - FX_BYTE GSTEMPLATE; + uint8_t GSTEMPLATE; CJBig2_Image *GSKIP; }; #endif diff --git a/core/src/fxcodec/jbig2/JBig2_Image.cpp b/core/src/fxcodec/jbig2/JBig2_Image.cpp index f2cea597c1..044ccf7410 100644 --- a/core/src/fxcodec/jbig2/JBig2_Image.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Image.cpp @@ -11,7 +11,7 @@ #include "../../../include/fxcrt/fx_safe_types.h" #include "JBig2_Image.h" -CJBig2_Image::CJBig2_Image(FX_INT32 w, FX_INT32 h) +CJBig2_Image::CJBig2_Image(int32_t w, int32_t h) { m_nWidth = w; m_nHeight = h; @@ -22,13 +22,13 @@ CJBig2_Image::CJBig2_Image(FX_INT32 w, FX_INT32 h) } m_nStride = ((w + 31) >> 5) << 2; if (m_nStride * m_nHeight > 0 && 104857600 / (int)m_nStride > m_nHeight) { - m_pData = (FX_BYTE *)m_pModule->JBig2_Malloc2(m_nStride, m_nHeight); + m_pData = (uint8_t *)m_pModule->JBig2_Malloc2(m_nStride, m_nHeight); } else { m_pData = NULL; } m_bNeedFree = TRUE; } -CJBig2_Image::CJBig2_Image(FX_INT32 w, FX_INT32 h, FX_INT32 stride, FX_BYTE*pBuf) +CJBig2_Image::CJBig2_Image(int32_t w, int32_t h, int32_t stride, uint8_t*pBuf) { m_nWidth = w; m_nHeight = h; @@ -43,7 +43,7 @@ CJBig2_Image::CJBig2_Image(CJBig2_Image &im) m_nHeight = im.m_nHeight; m_nStride = im.m_nStride; if (im.m_pData) { - m_pData = (FX_BYTE*)m_pModule->JBig2_Malloc2(m_nStride, m_nHeight); + m_pData = (uint8_t*)m_pModule->JBig2_Malloc2(m_nStride, m_nHeight); JBIG2_memcpy(m_pData, im.m_pData, m_nStride * m_nHeight); } else { m_pData = NULL; @@ -56,12 +56,12 @@ CJBig2_Image::~CJBig2_Image() m_pModule->JBig2_Free(m_pData); } } -FX_BOOL CJBig2_Image::getPixel(FX_INT32 x, FX_INT32 y) +FX_BOOL CJBig2_Image::getPixel(int32_t x, int32_t y) { if (!m_pData) { return 0; } - FX_INT32 m, n; + int32_t m, n; if(x < 0 || x >= m_nWidth) { return 0; } @@ -73,12 +73,12 @@ FX_BOOL CJBig2_Image::getPixel(FX_INT32 x, FX_INT32 y) return ((m_pData[m] >> (7 - n)) & 1); } -FX_INT32 CJBig2_Image::setPixel(FX_INT32 x, FX_INT32 y, FX_BOOL v) +int32_t CJBig2_Image::setPixel(int32_t x, int32_t y, FX_BOOL v) { if (!m_pData) { return 0; } - FX_INT32 m, n; + int32_t m, n; if(x < 0 || x >= m_nWidth) { return 0; } @@ -94,7 +94,7 @@ FX_INT32 CJBig2_Image::setPixel(FX_INT32 x, FX_INT32 y, FX_BOOL v) } return 1; } -void CJBig2_Image::copyLine(FX_INT32 hTo, FX_INT32 hFrom) +void CJBig2_Image::copyLine(int32_t hTo, int32_t hFrom) { if (!m_pData) { return; @@ -112,14 +112,14 @@ void CJBig2_Image::fill(FX_BOOL v) } JBIG2_memset(m_pData, v ? 0xff : 0, m_nStride * m_nHeight); } -FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) { if (!m_pData) { return FALSE; } return composeTo_opt2(pDst, x, y, op); } -FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op, const FX_RECT* pSrcRect) +FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect) { if (!m_pData) { return FALSE; @@ -129,10 +129,10 @@ FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig } return composeTo_opt2(pDst, x, y, op, pSrcRect); } -FX_BOOL CJBig2_Image::composeTo_unopt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeTo_unopt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) { - FX_INT32 w, h, dx, dy; - FX_INT32 i, j; + int32_t w, h, dx, dy; + int32_t i, j; w = m_nWidth; h = m_nHeight; dx = dy = 0; @@ -196,10 +196,10 @@ FX_BOOL CJBig2_Image::composeTo_unopt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y return TRUE; } -FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) { - FX_INT32 x0, x1, y0, y1, xx, yy; - FX_BYTE *pLineSrc, *pLineDst, *srcPtr, *destPtr; + int32_t x0, x1, y0, y1, xx, yy; + uint8_t *pLineSrc, *pLineDst, *srcPtr, *destPtr; FX_DWORD src0, src1, src, dest, s1, s2, m1, m2, m3; FX_BOOL oneByte; if (!m_pData) { @@ -247,7 +247,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc; dest = *destPtr; dest |= (*srcPtr >> s1) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -259,7 +259,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc; dest = *destPtr; dest &= ((0xff00 | *srcPtr) >> s1) | m1; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -271,7 +271,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc; dest = *destPtr; dest ^= (*srcPtr >> s1) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -283,7 +283,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc; dest = *destPtr; dest ^= ((*srcPtr ^ 0xff) >> s1) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -295,7 +295,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc; dest = *destPtr; dest = (dest & ~m3) | ((*srcPtr >> s1) & m3); - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -310,7 +310,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc + (-x >> 3); dest = *destPtr; dest |= *srcPtr & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -322,7 +322,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc + (-x >> 3); dest = *destPtr; dest &= *srcPtr | m1; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -334,7 +334,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc + (-x >> 3); dest = *destPtr; dest ^= *srcPtr & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -346,7 +346,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc + (-x >> 3); dest = *destPtr; dest ^= (*srcPtr ^ 0xff) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -358,7 +358,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc + (-x >> 3); dest = *destPtr; dest = (*srcPtr & m2) | (dest & m1); - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -376,7 +376,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; dest = *destPtr; dest |= src1 >> s1; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; xx = x0 + 8; for (; xx < x1 - 8; xx += 8) { dest = *destPtr; @@ -384,7 +384,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest |= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -395,7 +395,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest |= src & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -408,7 +408,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; dest = *destPtr; dest &= (0xff00 | src1) >> s1; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; xx = x0 + 8; for (; xx < x1 - 8; xx += 8) { dest = *destPtr; @@ -416,7 +416,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest &= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -427,7 +427,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest &= src | m1; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -440,7 +440,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; dest = *destPtr; dest ^= src1 >> s1; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; xx = x0 + 8; for (; xx < x1 - 8; xx += 8) { dest = *destPtr; @@ -448,7 +448,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -459,7 +459,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -472,7 +472,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; dest = *destPtr; dest ^= (src1 ^ 0xff) >> s1; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; xx = x0 + 8; for (; xx < x1 - 8; xx += 8) { dest = *destPtr; @@ -480,7 +480,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src ^ 0xff; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -491,7 +491,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= (src ^ 0xff) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -504,7 +504,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; dest = *destPtr; dest = (dest & (0xff << s2)) | (src1 >> s1); - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; xx = x0 + 8; for (; xx < x1 - 8; xx += 8) { dest = *destPtr; @@ -512,7 +512,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest = src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -523,7 +523,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest = (src & m2) | (dest & m1); - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -544,7 +544,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest |= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -555,7 +555,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest |= src & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -573,7 +573,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest &= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -584,7 +584,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest &= src | m1; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -602,7 +602,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -613,7 +613,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -631,7 +631,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src ^ 0xff; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -642,7 +642,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= (src ^ 0xff) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -660,7 +660,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest = src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -671,7 +671,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest = (src & m2) | (dest & m1); - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -682,24 +682,24 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } return TRUE; } -FX_BOOL CJBig2_Image::composeFrom(FX_INT32 x, FX_INT32 y, CJBig2_Image *pSrc, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op) { if (!m_pData) { return FALSE; } return pSrc->composeTo(this, x, y, op); } -FX_BOOL CJBig2_Image::composeFrom(FX_INT32 x, FX_INT32 y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect) +FX_BOOL CJBig2_Image::composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect) { if (!m_pData) { return FALSE; } return pSrc->composeTo(this, x, y, op, pSrcRect); } -CJBig2_Image *CJBig2_Image::subImage_unopt(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT32 h) +CJBig2_Image *CJBig2_Image::subImage_unopt(int32_t x, int32_t y, int32_t w, int32_t h) { CJBig2_Image *pImage; - FX_INT32 i, j; + int32_t i, j; JBIG2_ALLOC(pImage, CJBig2_Image(w, h)); for(j = 0; j < h; j++) { for(i = 0; i < w; i++) { @@ -709,13 +709,13 @@ CJBig2_Image *CJBig2_Image::subImage_unopt(FX_INT32 x, FX_INT32 y, FX_INT32 w, F return pImage; } #define JBIG2_GETDWORD(buf) ((FX_DWORD)(((buf)[0] << 24) | ((buf)[1] << 16) | ((buf)[2] << 8) | (buf)[3])) -CJBig2_Image *CJBig2_Image::subImage(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT32 h) +CJBig2_Image *CJBig2_Image::subImage(int32_t x, int32_t y, int32_t w, int32_t h) { CJBig2_Image *pImage; - FX_INT32 m, n, j; - FX_BYTE *pLineSrc, *pLineDst; + int32_t m, n, j; + uint8_t *pLineSrc, *pLineDst; FX_DWORD wTmp; - FX_BYTE *pSrc, *pSrcEnd, *pDst, *pDstEnd; + uint8_t *pSrc, *pSrcEnd, *pDst, *pDstEnd; if (w == 0 || h == 0) { return NULL; } @@ -755,10 +755,10 @@ CJBig2_Image *CJBig2_Image::subImage(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT3 } else { wTmp = JBIG2_GETDWORD(pSrc) << n; } - pDst[0] = (FX_BYTE)(wTmp >> 24); - pDst[1] = (FX_BYTE)(wTmp >> 16); - pDst[2] = (FX_BYTE)(wTmp >> 8); - pDst[3] = (FX_BYTE)wTmp; + pDst[0] = (uint8_t)(wTmp >> 24); + pDst[1] = (uint8_t)(wTmp >> 16); + pDst[2] = (uint8_t)(wTmp >> 8); + pDst[3] = (uint8_t)wTmp; } pLineSrc += m_nStride; pLineDst += pImage->m_nStride; @@ -766,7 +766,7 @@ CJBig2_Image *CJBig2_Image::subImage(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT3 } return pImage; } -void CJBig2_Image::expand(FX_INT32 h, FX_BOOL v) +void CJBig2_Image::expand(int32_t h, FX_BOOL v) { if (!m_pData || h <= m_nHeight) { return; @@ -780,7 +780,7 @@ void CJBig2_Image::expand(FX_INT32 h, FX_BOOL v) return; } //The guaranteed reallocated memory is to be < 4GB (unsigned int). - m_pData = (FX_BYTE*)m_pModule->JBig2_Realloc(m_pData, safeMemSize.ValueOrDie()); + m_pData = (uint8_t*)m_pModule->JBig2_Realloc(m_pData, safeMemSize.ValueOrDie()); //The result of dwHeight * dwStride doesn't overflow after the //checking of safeMemSize. //The same as the result of (dwH - dwHeight) * dwStride) because @@ -789,15 +789,15 @@ void CJBig2_Image::expand(FX_INT32 h, FX_BOOL v) JBIG2_memset(m_pData + dwHeight * dwStride, v ? 0xff : 0, (dwH - dwHeight) * dwStride); m_nHeight = h; } -FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) { - FX_INT32 xs0 = 0, ys0 = 0, xs1 = 0, ys1 = 0, xd0 = 0, yd0 = 0, xd1 = 0, + int32_t xs0 = 0, ys0 = 0, xs1 = 0, ys1 = 0, xd0 = 0, yd0 = 0, xd1 = 0, yd1 = 0, xx = 0, yy = 0, w = 0, h = 0, middleDwords = 0, lineLeft = 0; FX_DWORD s1 = 0, d1 = 0, d2 = 0, shift = 0, shift1 = 0, shift2 = 0, tmp = 0, tmp1 = 0, tmp2 = 0, maskL = 0, maskR = 0, maskM = 0; - FX_BYTE *lineSrc = NULL, *lineDst = NULL, *sp = NULL, *dp = NULL; + uint8_t *lineSrc = NULL, *lineDst = NULL, *sp = NULL, *dp = NULL; if (!m_pData) { return FALSE; @@ -867,10 +867,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -896,10 +896,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -927,10 +927,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -963,10 +963,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -990,10 +990,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1018,10 +1018,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; @@ -1051,10 +1051,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1078,10 +1078,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1105,10 +1105,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; @@ -1140,10 +1140,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; dp += 4; } for(xx = 0; xx < middleDwords; xx++) { @@ -1166,10 +1166,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1194,10 +1194,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; @@ -1206,12 +1206,12 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } return 1; } -FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op, const FX_RECT* pSrcRect) +FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect) { - FX_INT32 xs0, ys0, xs1, ys1, xd0, yd0, xd1, yd1, xx, yy, w, h, middleDwords, lineLeft; + int32_t xs0, ys0, xs1, ys1, xd0, yd0, xd1, yd1, xx, yy, w, h, middleDwords, lineLeft; FX_DWORD s1, d1, d2, shift, shift1, shift2, tmp, tmp1, tmp2, maskL, maskR, maskM; - FX_BYTE *lineSrc, *lineDst, *sp, *dp; - FX_INT32 sw, sh; + uint8_t *lineSrc, *lineDst, *sp, *dp; + int32_t sw, sh; if (!m_pData) { return FALSE; } @@ -1290,10 +1290,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -1319,10 +1319,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -1350,10 +1350,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -1386,10 +1386,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1413,10 +1413,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1441,10 +1441,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; @@ -1474,10 +1474,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1501,10 +1501,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1528,10 +1528,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; @@ -1563,10 +1563,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; dp += 4; } for(xx = 0; xx < middleDwords; xx++) { @@ -1589,10 +1589,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1617,10 +1617,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; diff --git a/core/src/fxcodec/jbig2/JBig2_Image.h b/core/src/fxcodec/jbig2/JBig2_Image.h index 5d06695c7c..423bebcede 100644 --- a/core/src/fxcodec/jbig2/JBig2_Image.h +++ b/core/src/fxcodec/jbig2/JBig2_Image.h @@ -20,48 +20,48 @@ class CJBig2_Image : public CJBig2_Object { public: - CJBig2_Image(FX_INT32 w, FX_INT32 h); + CJBig2_Image(int32_t w, int32_t h); - CJBig2_Image(FX_INT32 w, FX_INT32 h, FX_INT32 stride, FX_BYTE*pBuf); + CJBig2_Image(int32_t w, int32_t h, int32_t stride, uint8_t*pBuf); CJBig2_Image(CJBig2_Image &im); ~CJBig2_Image(); - FX_BOOL getPixel(FX_INT32 x, FX_INT32 y); + FX_BOOL getPixel(int32_t x, int32_t y); - FX_INT32 setPixel(FX_INT32 x, FX_INT32 y, FX_BOOL v); + int32_t setPixel(int32_t x, int32_t y, FX_BOOL v); - void copyLine(FX_INT32 hTo, FX_INT32 hFrom); + void copyLine(int32_t hTo, int32_t hFrom); void fill(FX_BOOL v); - FX_BOOL composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op); - FX_BOOL composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op, const FX_RECT* pSrcRect); + FX_BOOL composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); + FX_BOOL composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect); - FX_BOOL composeTo_unopt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op); + FX_BOOL composeTo_unopt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); - FX_BOOL composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op); + FX_BOOL composeTo_opt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); - FX_BOOL composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op); - FX_BOOL composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op, const FX_RECT* pSrcRect); + FX_BOOL composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); + FX_BOOL composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect); - FX_BOOL composeFrom(FX_INT32 x, FX_INT32 y, CJBig2_Image *pSrc, JBig2ComposeOp op); - FX_BOOL composeFrom(FX_INT32 x, FX_INT32 y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect); - CJBig2_Image *subImage_unopt(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT32 h); + FX_BOOL composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op); + FX_BOOL composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect); + CJBig2_Image *subImage_unopt(int32_t x, int32_t y, int32_t w, int32_t h); - CJBig2_Image *subImage(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT32 h); + CJBig2_Image *subImage(int32_t x, int32_t y, int32_t w, int32_t h); - void expand(FX_INT32 h, FX_BOOL v); + void expand(int32_t h, FX_BOOL v); public: - FX_INT32 m_nWidth; + int32_t m_nWidth; - FX_INT32 m_nHeight; + int32_t m_nHeight; - FX_INT32 m_nStride; + int32_t m_nStride; - FX_BYTE *m_pData; + uint8_t *m_pData; FX_BOOL m_bNeedFree; }; diff --git a/core/src/fxcodec/jbig2/JBig2_List.h b/core/src/fxcodec/jbig2/JBig2_List.h index 9292724b1e..19f99dec3d 100644 --- a/core/src/fxcodec/jbig2/JBig2_List.h +++ b/core/src/fxcodec/jbig2/JBig2_List.h @@ -13,7 +13,7 @@ class CJBig2_List : public CJBig2_Object { public: - CJBig2_List(FX_INT32 nSize = 8) + CJBig2_List(int32_t nSize = 8) { m_nSize = nSize; m_pArray = (TYPE**)m_pModule->JBig2_Malloc2(sizeof(TYPE*), nSize); @@ -28,7 +28,7 @@ public: void clear() { - FX_INT32 i; + int32_t i; for(i = 0; i < m_nLength; i++) { delete m_pArray[i]; } @@ -45,12 +45,12 @@ public: } - FX_INT32 getLength() + int32_t getLength() { return m_nLength; } - TYPE *getAt(FX_INT32 nIndex) + TYPE *getAt(int32_t nIndex) { return m_pArray[nIndex]; } @@ -60,8 +60,8 @@ public: return m_pArray[m_nLength - 1]; } private: - FX_INT32 m_nSize; + int32_t m_nSize; TYPE **m_pArray; - FX_INT32 m_nLength; + int32_t m_nLength; }; #endif diff --git a/core/src/fxcodec/jbig2/JBig2_Module.h b/core/src/fxcodec/jbig2/JBig2_Module.h index 711cf4047b..aef31bb49f 100644 --- a/core/src/fxcodec/jbig2/JBig2_Module.h +++ b/core/src/fxcodec/jbig2/JBig2_Module.h @@ -22,7 +22,7 @@ public: virtual void JBig2_Free(FX_LPVOID pMem) = 0; - virtual void JBig2_Assert(FX_INT32 nExpression) {}; + virtual void JBig2_Assert(int32_t nExpression) {}; virtual void JBig2_Error(FX_LPCSTR format, ...) {}; diff --git a/core/src/fxcodec/jbig2/JBig2_Object.cpp b/core/src/fxcodec/jbig2/JBig2_Object.cpp index 2bb267b085..4bb00b897b 100644 --- a/core/src/fxcodec/jbig2/JBig2_Object.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Object.cpp @@ -36,9 +36,9 @@ void *CJBig2_Object::operator new[](size_t size, CJBig2_Module *pModule, size_t FX_LPCSTR filename, int line) { void *p; - FX_BYTE *pCur, *pEnd; - p = (FX_BYTE *)pModule->JBig2_Malloc((FX_DWORD)size); - pCur = (FX_BYTE *)p; + uint8_t *pCur, *pEnd; + p = (uint8_t *)pModule->JBig2_Malloc((FX_DWORD)size); + pCur = (uint8_t *)p; pEnd = pCur + size; for(; pCur < pEnd; pCur += unit_size) { ((CJBig2_Object *)pCur)->m_pModule = pModule; @@ -53,9 +53,9 @@ void CJBig2_Object::operator delete[](void *p, CJBig2_Module *pModule, size_t un void *CJBig2_Object::operator new[](size_t size, CJBig2_Module *pModule, size_t unit_size) { void *p; - FX_BYTE *pCur, *pEnd; - p = (FX_BYTE *)pModule->JBig2_Malloc((FX_DWORD)size); - pCur = (FX_BYTE *)p; + uint8_t *pCur, *pEnd; + p = (uint8_t *)pModule->JBig2_Malloc((FX_DWORD)size); + pCur = (uint8_t *)p; pEnd = pCur + size; for(; pCur < pEnd; pCur += unit_size) { ((CJBig2_Object *)pCur)->m_pModule = pModule; diff --git a/core/src/fxcodec/jbig2/JBig2_Page.h b/core/src/fxcodec/jbig2/JBig2_Page.h index d7399bd452..b07eba8a3a 100644 --- a/core/src/fxcodec/jbig2/JBig2_Page.h +++ b/core/src/fxcodec/jbig2/JBig2_Page.h @@ -12,7 +12,7 @@ struct JBig2PageInfo : public CJBig2_Object { m_dwHeight; FX_DWORD m_dwResolutionX, m_dwResolutionY; - FX_BYTE m_cFlags; + uint8_t m_cFlags; FX_BOOL m_bIsStriped; FX_WORD m_wMaxStripeSize; }; diff --git a/core/src/fxcodec/jbig2/JBig2_Segment.h b/core/src/fxcodec/jbig2/JBig2_Segment.h index 33ee721a1b..fe44bc962d 100644 --- a/core/src/fxcodec/jbig2/JBig2_Segment.h +++ b/core/src/fxcodec/jbig2/JBig2_Segment.h @@ -42,19 +42,19 @@ public: FX_DWORD m_dwNumber; union { struct { - FX_BYTE type : 6; - FX_BYTE page_association_size : 1; - FX_BYTE deferred_non_retain : 1; + uint8_t type : 6; + uint8_t page_association_size : 1; + uint8_t deferred_non_retain : 1; } s; - FX_BYTE c; + uint8_t c; } m_cFlags; - FX_INT32 m_nReferred_to_segment_count; + int32_t m_nReferred_to_segment_count; FX_DWORD * m_pReferred_to_segment_numbers; FX_DWORD m_dwPage_association; FX_DWORD m_dwData_length; FX_DWORD m_dwHeader_Length; - FX_BYTE *m_pData; + uint8_t *m_pData; JBig2_SegmentState m_State; JBig2_ResultType m_nResultType; union { diff --git a/core/src/fxcodec/lbmp/fx_bmp.cpp b/core/src/fxcodec/lbmp/fx_bmp.cpp index e868fdeaef..3a6e3816ff 100644 --- a/core/src/fxcodec/lbmp/fx_bmp.cpp +++ b/core/src/fxcodec/lbmp/fx_bmp.cpp @@ -15,15 +15,15 @@ FX_WORD _GetWord_LSBFirst(FX_LPBYTE p) }
void _SetDWord_LSBFirst(FX_LPBYTE p, FX_DWORD v)
{
- p[0] = (FX_BYTE)v;
- p[1] = (FX_BYTE)(v >> 8);
- p[2] = (FX_BYTE)(v >> 16);
- p[3] = (FX_BYTE)(v >> 24);
+ p[0] = (uint8_t)v;
+ p[1] = (uint8_t)(v >> 8);
+ p[2] = (uint8_t)(v >> 16);
+ p[3] = (uint8_t)(v >> 24);
}
void _SetWord_LSBFirst(FX_LPBYTE p, FX_WORD v)
{
- p[0] = (FX_BYTE)v;
- p[1] = (FX_BYTE)(v >> 8);
+ p[0] = (uint8_t)v;
+ p[1] = (uint8_t)(v >> 8);
}
void _bmp_error(bmp_decompress_struct_p bmp_ptr, FX_LPCSTR err_msg)
{
@@ -60,7 +60,7 @@ void _bmp_destroy_decompress(bmp_decompress_struct_pp bmp_ptr_ptr) }
FX_Free(bmp_ptr);
}
-FX_INT32 _bmp_read_header(bmp_decompress_struct_p bmp_ptr)
+int32_t _bmp_read_header(bmp_decompress_struct_p bmp_ptr)
{
if(bmp_ptr == NULL) {
return 0;
@@ -113,8 +113,8 @@ FX_INT32 _bmp_read_header(bmp_decompress_struct_p bmp_ptr) bmp_ptr->bitCounts = _GetWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biBitCount);
bmp_ptr->compress_flag = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biCompression);
bmp_ptr->color_used = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biClrUsed);
- bmp_ptr->dpi_x = (FX_INT32)_GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biXPelsPerMeter);
- bmp_ptr->dpi_y = (FX_INT32)_GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biYPelsPerMeter);
+ bmp_ptr->dpi_x = (int32_t)_GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biXPelsPerMeter);
+ bmp_ptr->dpi_y = (int32_t)_GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biYPelsPerMeter);
if(bmp_ptr->height < 0) {
bmp_ptr->height = -bmp_ptr->height;
bmp_ptr->imgTB_flag = TRUE;
@@ -197,7 +197,7 @@ FX_INT32 _bmp_read_header(bmp_decompress_struct_p bmp_ptr) FX_Free(bmp_ptr->out_row_buffer);
bmp_ptr->out_row_buffer = NULL;
}
- bmp_ptr->out_row_buffer = FX_Alloc(FX_BYTE, bmp_ptr->out_row_bytes);
+ bmp_ptr->out_row_buffer = FX_Alloc(uint8_t, bmp_ptr->out_row_bytes);
BMP_PTR_NOT_NULL(bmp_ptr->out_row_buffer, bmp_ptr);
FXSYS_memset32(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes);
_bmp_save_decoding_status(bmp_ptr, BMP_D_STATUS_PAL);
@@ -258,7 +258,7 @@ FX_INT32 _bmp_read_header(bmp_decompress_struct_p bmp_ptr) }
bmp_ptr->pal_ptr = FX_Alloc(FX_DWORD, bmp_ptr->pal_num);
BMP_PTR_NOT_NULL(bmp_ptr->pal_ptr, bmp_ptr);
- FX_INT32 src_pal_index = 0;
+ int32_t src_pal_index = 0;
if(bmp_ptr->pal_type == BMP_PAL_OLD) {
while(src_pal_index < bmp_ptr->pal_num) {
bmp_ptr->pal_ptr[src_pal_index++] = BMP_PAL_ENCODE(0x00, src_pal_ptr[2], src_pal_ptr[1], src_pal_ptr[0]);
@@ -278,7 +278,7 @@ FX_INT32 _bmp_read_header(bmp_decompress_struct_p bmp_ptr) }
return 1;
}
-FX_INT32 _bmp_decode_image(bmp_decompress_struct_p bmp_ptr)
+int32_t _bmp_decode_image(bmp_decompress_struct_p bmp_ptr)
{
if(bmp_ptr->decode_status == BMP_D_STATUS_DATA_PRE) {
bmp_ptr->avail_in = 0;
@@ -304,7 +304,7 @@ FX_INT32 _bmp_decode_image(bmp_decompress_struct_p bmp_ptr) _bmp_error(bmp_ptr, "Any Uncontrol Error");
return 0;
}
-FX_INT32 _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr)
+int32_t _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr)
{
FX_LPBYTE row_buf = bmp_ptr->out_row_buffer;
FX_LPBYTE des_buf = NULL;
@@ -315,13 +315,13 @@ FX_INT32 _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr) _bmp_save_decoding_status(bmp_ptr, BMP_D_STATUS_DATA);
switch(bmp_ptr->bitCounts) {
case 1: {
- for (FX_INT32 col = 0; col < bmp_ptr->width; col++) {
+ for (int32_t col = 0; col < bmp_ptr->width; col++) {
*row_buf++ = des_buf[col >> 3] & (0x80 >> (col % 8)) ? 0x01 : 0x00;
}
}
break;
case 4: {
- for (FX_INT32 col = 0; col < bmp_ptr->width; col++) {
+ for (int32_t col = 0; col < bmp_ptr->width; col++) {
*row_buf++ = (col & 0x01) ?
(des_buf[col >> 1] & 0x0F) :
((des_buf[col >> 1] & 0xF0) >> 4);
@@ -331,10 +331,10 @@ FX_INT32 _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr) #ifdef BMP_SUPPORT_BITFIELD
case 16: {
FX_WORD* buf = (FX_WORD*)des_buf;
- FX_BYTE blue_bits = 0;
- FX_BYTE green_bits = 0;
- FX_BYTE red_bits = 0;
- for(FX_INT32 i = 0; i < 16; i++) {
+ uint8_t blue_bits = 0;
+ uint8_t green_bits = 0;
+ uint8_t red_bits = 0;
+ for(int32_t i = 0; i < 16; i++) {
if((bmp_ptr->mask_blue >> i) & 0x01) {
blue_bits++;
}
@@ -350,11 +350,11 @@ FX_INT32 _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr) blue_bits = 8 - blue_bits;
green_bits -= 8;
red_bits -= 8;
- for (FX_INT32 col = 0; col < bmp_ptr->width; col++) {
+ for (int32_t col = 0; col < bmp_ptr->width; col++) {
*buf = _GetWord_LSBFirst((FX_LPBYTE)buf);
- *row_buf++ = (FX_BYTE)((*buf & bmp_ptr->mask_blue) << blue_bits);
- *row_buf++ = (FX_BYTE)((*buf & bmp_ptr->mask_green) >> green_bits);
- *row_buf++ = (FX_BYTE)((*buf++ & bmp_ptr->mask_red) >> red_bits);
+ *row_buf++ = (uint8_t)((*buf & bmp_ptr->mask_blue) << blue_bits);
+ *row_buf++ = (uint8_t)((*buf & bmp_ptr->mask_green) >> green_bits);
+ *row_buf++ = (uint8_t)((*buf++ & bmp_ptr->mask_red) >> red_bits);
}
}
break;
@@ -373,7 +373,7 @@ FX_INT32 _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr) _bmp_save_decoding_status(bmp_ptr, BMP_D_STATUS_TAIL);
return 1;
}
-FX_INT32 _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr)
+int32_t _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr)
{
FX_LPBYTE first_byte_ptr = NULL;
FX_LPBYTE second_byte_ptr = NULL;
@@ -419,8 +419,8 @@ FX_INT32 _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) bmp_ptr->skip_size = skip_size_org;
return 2;
}
- bmp_ptr->col_num += (FX_INT32)delta_ptr[0];
- FX_INT32 bmp_row_num_next = bmp_ptr->row_num + (FX_INT32)delta_ptr[1];
+ bmp_ptr->col_num += (int32_t)delta_ptr[0];
+ int32_t bmp_row_num_next = bmp_ptr->row_num + (int32_t)delta_ptr[1];
if(bmp_ptr->col_num >= bmp_ptr->out_row_bytes || bmp_row_num_next >= bmp_ptr->height) {
_bmp_error(bmp_ptr, "The Bmp File Is Corrupt Or Not Supported");
return 0;
@@ -434,7 +434,7 @@ FX_INT32 _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) }
break;
default: {
- if((FX_INT32)(*first_byte_ptr) > bmp_ptr->src_row_bytes - bmp_ptr->col_num) {
+ if((int32_t)(*first_byte_ptr) > bmp_ptr->src_row_bytes - bmp_ptr->col_num) {
_bmp_error(bmp_ptr, "The Bmp File Is Corrupt");
return 0;
}
@@ -444,7 +444,7 @@ FX_INT32 _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) return 2;
}
FXSYS_memcpy32(bmp_ptr->out_row_buffer + bmp_ptr->col_num, second_byte_ptr, *first_byte_ptr);
- bmp_ptr->col_num += (FX_INT32)(*first_byte_ptr);
+ bmp_ptr->col_num += (int32_t)(*first_byte_ptr);
}
}
}
@@ -454,19 +454,19 @@ FX_INT32 _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) bmp_ptr->skip_size = skip_size_org;
return 2;
}
- if((FX_INT32)(*first_byte_ptr) > bmp_ptr->src_row_bytes - bmp_ptr->col_num) {
+ if((int32_t)(*first_byte_ptr) > bmp_ptr->src_row_bytes - bmp_ptr->col_num) {
_bmp_error(bmp_ptr, "The Bmp File Is Corrupt");
return 0;
}
FXSYS_memset8(bmp_ptr->out_row_buffer + bmp_ptr->col_num, *second_byte_ptr, *first_byte_ptr);
- bmp_ptr->col_num += (FX_INT32)(*first_byte_ptr);
+ bmp_ptr->col_num += (int32_t)(*first_byte_ptr);
}
}
}
_bmp_error(bmp_ptr, "Any Uncontrol Error");
return 0;
}
-FX_INT32 _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr)
+int32_t _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr)
{
FX_LPBYTE first_byte_ptr = NULL;
FX_LPBYTE second_byte_ptr = NULL;
@@ -512,8 +512,8 @@ FX_INT32 _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) bmp_ptr->skip_size = skip_size_org;
return 2;
}
- bmp_ptr->col_num += (FX_INT32)delta_ptr[0];
- FX_INT32 bmp_row_num_next = bmp_ptr->row_num + (FX_INT32)delta_ptr[1];
+ bmp_ptr->col_num += (int32_t)delta_ptr[0];
+ int32_t bmp_row_num_next = bmp_ptr->row_num + (int32_t)delta_ptr[1];
if(bmp_ptr->col_num >= bmp_ptr->out_row_bytes || bmp_row_num_next >= bmp_ptr->height) {
_bmp_error(bmp_ptr, "The Bmp File Is Corrupt Or Not Supported");
return 0;
@@ -527,8 +527,8 @@ FX_INT32 _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) }
break;
default: {
- FX_BYTE size = (FX_BYTE)(((FX_WORD)(*first_byte_ptr) + 1) >> 1);
- if((FX_INT32)*first_byte_ptr >= bmp_ptr->out_row_bytes - bmp_ptr->col_num) {
+ uint8_t size = (uint8_t)(((FX_WORD)(*first_byte_ptr) + 1) >> 1);
+ if((int32_t)*first_byte_ptr >= bmp_ptr->out_row_bytes - bmp_ptr->col_num) {
if(size + (bmp_ptr->col_num >> 1) > bmp_ptr->src_row_bytes) {
_bmp_error(bmp_ptr, "The Bmp File Is Corrupt");
return 0;
@@ -539,7 +539,7 @@ FX_INT32 _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) bmp_ptr->skip_size = skip_size_org;
return 2;
}
- for (FX_BYTE i = 0; i < *first_byte_ptr; i++) {
+ for (uint8_t i = 0; i < *first_byte_ptr; i++) {
if(i & 0x01) {
*(bmp_ptr->out_row_buffer + bmp_ptr->col_num++) = (*second_byte_ptr++ & 0x0F);
} else {
@@ -555,15 +555,15 @@ FX_INT32 _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) bmp_ptr->skip_size = skip_size_org;
return 2;
}
- if((FX_INT32)*first_byte_ptr > bmp_ptr->out_row_bytes - bmp_ptr->col_num) {
- FX_BYTE size = (FX_BYTE)(((FX_WORD)(*first_byte_ptr) + 1) >> 1);
+ if((int32_t)*first_byte_ptr > bmp_ptr->out_row_bytes - bmp_ptr->col_num) {
+ uint8_t size = (uint8_t)(((FX_WORD)(*first_byte_ptr) + 1) >> 1);
if(size + (bmp_ptr->col_num >> 1) > bmp_ptr->src_row_bytes) {
_bmp_error(bmp_ptr, "The Bmp File Is Corrupt");
return 0;
}
*first_byte_ptr = bmp_ptr->out_row_bytes - bmp_ptr->col_num - 1;
}
- for (FX_BYTE i = 0; i < *first_byte_ptr; i++) {
+ for (uint8_t i = 0; i < *first_byte_ptr; i++) {
if(i & 0x01) {
*(bmp_ptr->out_row_buffer + bmp_ptr->col_num++) = (*second_byte_ptr & 0x0F);
} else {
@@ -586,7 +586,7 @@ FX_LPBYTE _bmp_read_data(bmp_decompress_struct_p bmp_ptr, FX_LPBYTE* des_buf_pp, bmp_ptr->skip_size += data_size;
return *des_buf_pp;
}
-void _bmp_save_decoding_status(bmp_decompress_struct_p bmp_ptr, FX_INT32 status)
+void _bmp_save_decoding_status(bmp_decompress_struct_p bmp_ptr, int32_t status)
{
bmp_ptr->decode_status = status;
bmp_ptr->next_in += bmp_ptr->skip_size;
@@ -679,7 +679,7 @@ static void _bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_ size = bmp_ptr->src_pitch * bmp_ptr->src_row * bmp_ptr->info_header.biBitCount / 16;
dst_pos = bmp_ptr->file_header.bfOffBits;
dst_size += size;
- dst_buf = FX_Realloc(FX_BYTE, dst_buf, dst_size);
+ dst_buf = FX_Realloc(uint8_t, dst_buf, dst_size);
if (dst_buf == NULL) {
return;
}
@@ -709,9 +709,9 @@ static void _bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_ dst_pos += 4;
bmp_ptr->file_header.bfOffBits = dst_pos;
}
- FX_BYTE blue_bits = 0;
- FX_BYTE green_bits = 0;
- FX_BYTE red_bits = 0;
+ uint8_t blue_bits = 0;
+ uint8_t green_bits = 0;
+ uint8_t red_bits = 0;
for(i = 0; i < bmp_ptr->info_header.biBitCount; i++) {
if((mask_blue >> i) & 0x01) {
blue_bits++;
@@ -729,11 +729,11 @@ static void _bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_ green_bits -= 8;
red_bits -= 8;
i = 0;
- for (FX_INT32 row_num = bmp_ptr->src_row - 1; row_num > -1; row_num--, i = 0) {
+ for (int32_t row_num = bmp_ptr->src_row - 1; row_num > -1; row_num--, i = 0) {
while (i < bmp_ptr->src_width * bmp_ptr->src_bpp / 8) {
- FX_BYTE b = bmp_ptr->src_buf[row_num * bmp_ptr->src_pitch + i++];
- FX_BYTE g = bmp_ptr->src_buf[row_num * bmp_ptr->src_pitch + i++];
- FX_BYTE r = bmp_ptr->src_buf[row_num * bmp_ptr->src_pitch + i++];
+ uint8_t b = bmp_ptr->src_buf[row_num * bmp_ptr->src_pitch + i++];
+ uint8_t g = bmp_ptr->src_buf[row_num * bmp_ptr->src_pitch + i++];
+ uint8_t r = bmp_ptr->src_buf[row_num * bmp_ptr->src_pitch + i++];
if (bmp_ptr->src_bpp == 32) {
i++;
}
@@ -766,20 +766,20 @@ static void _bmp_encode_rgb(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, F size = dst_pitch * bmp_ptr->src_row;
dst_pos = bmp_ptr->file_header.bfOffBits;
dst_size += size;
- dst_buf = FX_Realloc(FX_BYTE, dst_buf, dst_size);
+ dst_buf = FX_Realloc(uint8_t, dst_buf, dst_size);
if (dst_buf == NULL) {
return;
}
FXSYS_memset32(&dst_buf[dst_pos], 0, size);
- for (FX_INT32 row_num = bmp_ptr->src_row - 1; row_num > -1; row_num--) {
+ for (int32_t row_num = bmp_ptr->src_row - 1; row_num > -1; row_num--) {
FXSYS_memcpy32(&dst_buf[dst_pos], &bmp_ptr->src_buf[row_num * bmp_ptr->src_pitch], bmp_ptr->src_pitch);
dst_pos += dst_pitch;
}
dst_size = dst_pos;
}
-static FX_BYTE _bmp_rle8_search(FX_LPCBYTE buf, FX_INT32 len)
+static uint8_t _bmp_rle8_search(FX_LPCBYTE buf, int32_t len)
{
- FX_BYTE num;
+ uint8_t num;
num = 1;
while (num < len) {
if (buf[num - 1] != buf[num] || num == 0xFF) {
@@ -792,21 +792,21 @@ static FX_BYTE _bmp_rle8_search(FX_LPCBYTE buf, FX_INT32 len) static void _bmp_encode_rle8(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_size)
{
FX_DWORD size, dst_pos, index;
- FX_BYTE rle[2] = {0};
+ uint8_t rle[2] = {0};
size = bmp_ptr->src_pitch * bmp_ptr->src_row * 2;
dst_pos = bmp_ptr->file_header.bfOffBits;
dst_size += size;
- dst_buf = FX_Realloc(FX_BYTE, dst_buf, dst_size);
+ dst_buf = FX_Realloc(uint8_t, dst_buf, dst_size);
if (dst_buf == NULL) {
return;
}
FXSYS_memset32(&dst_buf[dst_pos], 0, size);
- for (FX_INT32 row_num = bmp_ptr->src_row - 1, i = 0; row_num > -1; ) {
+ for (int32_t row_num = bmp_ptr->src_row - 1, i = 0; row_num > -1; ) {
index = row_num * bmp_ptr->src_pitch;
rle[0] = _bmp_rle8_search(&bmp_ptr->src_buf[index + i], size - index - i);
rle[1] = bmp_ptr->src_buf[index + i];
- if (i + rle[0] >= (FX_INT32)bmp_ptr->src_pitch) {
- rle[0] = FX_BYTE(bmp_ptr->src_pitch - i);
+ if (i + rle[0] >= (int32_t)bmp_ptr->src_pitch) {
+ rle[0] = uint8_t(bmp_ptr->src_pitch - i);
if (rle[0]) {
dst_buf[dst_pos++] = rle[0];
dst_buf[dst_pos++] = rle[1];
@@ -825,9 +825,9 @@ static void _bmp_encode_rle8(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, dst_buf[dst_pos++] = RLE_EOI;
dst_size = dst_pos;
}
-static FX_BYTE _bmp_rle4_search(FX_LPCBYTE buf, FX_INT32 len)
+static uint8_t _bmp_rle4_search(FX_LPCBYTE buf, int32_t len)
{
- FX_BYTE num;
+ uint8_t num;
num = 2;
while (num < len) {
if (buf[num - 2] != buf[num] || num == 0xFF) {
@@ -840,22 +840,22 @@ static FX_BYTE _bmp_rle4_search(FX_LPCBYTE buf, FX_INT32 len) static void _bmp_encode_rle4(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_size)
{
FX_DWORD size, dst_pos, index;
- FX_BYTE rle[2] = {0};
+ uint8_t rle[2] = {0};
size = bmp_ptr->src_pitch * bmp_ptr->src_row;
dst_pos = bmp_ptr->file_header.bfOffBits;
dst_size += size;
- dst_buf = FX_Realloc(FX_BYTE, dst_buf, dst_size);
+ dst_buf = FX_Realloc(uint8_t, dst_buf, dst_size);
if (dst_buf == NULL) {
return;
}
FXSYS_memset32(&dst_buf[dst_pos], 0, size);
- for (FX_INT32 row_num = bmp_ptr->src_row - 1, i = 0; row_num > -1; rle[1] = 0) {
+ for (int32_t row_num = bmp_ptr->src_row - 1, i = 0; row_num > -1; rle[1] = 0) {
index = row_num * bmp_ptr->src_pitch;
rle[0] = _bmp_rle4_search(&bmp_ptr->src_buf[index + i], size - index - i);
rle[1] |= (bmp_ptr->src_buf[index + i] & 0x0f) << 4;
rle[1] |= bmp_ptr->src_buf[index + i + 1] & 0x0f;
- if (i + rle[0] >= (FX_INT32)bmp_ptr->src_pitch) {
- rle[0] = FX_BYTE(bmp_ptr->src_pitch - i);
+ if (i + rle[0] >= (int32_t)bmp_ptr->src_pitch) {
+ rle[0] = uint8_t(bmp_ptr->src_pitch - i);
if (rle[0]) {
dst_buf[dst_pos++] = rle[0];
dst_buf[dst_pos++] = rle[1];
@@ -882,7 +882,7 @@ FX_BOOL _bmp_encode_image( bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, FX pal_size = sizeof(FX_DWORD) * bmp_ptr->info_header.biClrUsed;
}
dst_size = head_size + sizeof(FX_DWORD) * bmp_ptr->pal_num;
- dst_buf = FX_TryAlloc(FX_BYTE, dst_size);
+ dst_buf = FX_TryAlloc(uint8_t, dst_size);
if (dst_buf == NULL) {
return FALSE;
}
diff --git a/core/src/fxcodec/lbmp/fx_bmp.h b/core/src/fxcodec/lbmp/fx_bmp.h index b7c3617182..553a1501db 100644 --- a/core/src/fxcodec/lbmp/fx_bmp.h +++ b/core/src/fxcodec/lbmp/fx_bmp.h @@ -47,14 +47,14 @@ typedef struct tagBmpCoreHeader { } BmpCoreHeader, *BmpCoreHeaderPtr;
typedef struct tagBmpInfoHeader {
FX_DWORD biSize;
- FX_INT32 biWidth;
- FX_INT32 biHeight;
+ int32_t biWidth;
+ int32_t biHeight;
FX_WORD biPlanes;
FX_WORD biBitCount;
FX_DWORD biCompression;
FX_DWORD biSizeImage;
- FX_INT32 biXPelsPerMeter;
- FX_INT32 biYPelsPerMeter;
+ int32_t biXPelsPerMeter;
+ int32_t biYPelsPerMeter;
FX_DWORD biClrUsed;
FX_DWORD biClrImportant;
} BmpInfoHeader, *BmpInfoHeaderPtr;
@@ -71,26 +71,26 @@ struct tag_bmp_decompress_struct { BmpFileHeaderPtr bmp_header_ptr;
BmpInfoHeaderPtr bmp_infoheader_ptr;
- FX_INT32 width;
- FX_INT32 height;
+ int32_t width;
+ int32_t height;
FX_DWORD compress_flag;
- FX_INT32 components;
- FX_INT32 src_row_bytes;
- FX_INT32 out_row_bytes;
+ int32_t components;
+ int32_t src_row_bytes;
+ int32_t out_row_bytes;
FX_LPBYTE out_row_buffer;
FX_WORD bitCounts;
FX_DWORD color_used;
FX_BOOL imgTB_flag;
- FX_INT32 pal_num;
- FX_INT32 pal_type;
+ int32_t pal_num;
+ int32_t pal_type;
FX_DWORD* pal_ptr;
FX_DWORD data_size;
FX_DWORD img_data_offset;
FX_DWORD img_ifh_size;
- FX_INT32 row_num;
- FX_INT32 col_num;
- FX_INT32 dpi_x;
- FX_INT32 dpi_y;
+ int32_t row_num;
+ int32_t col_num;
+ int32_t dpi_x;
+ int32_t dpi_y;
#ifdef BMP_SUPPORT_BITFIELD
FX_DWORD mask_red;
FX_DWORD mask_green;
@@ -98,22 +98,22 @@ struct tag_bmp_decompress_struct { #endif
FX_BOOL (*_bmp_get_data_position_fn)(bmp_decompress_struct_p bmp_ptr, FX_DWORD cur_pos);
- void (*_bmp_get_row_fn)(bmp_decompress_struct_p bmp_ptr, FX_INT32 row_num, FX_LPBYTE row_buf);
+ void (*_bmp_get_row_fn)(bmp_decompress_struct_p bmp_ptr, int32_t row_num, FX_LPBYTE row_buf);
FX_LPBYTE next_in;
FX_DWORD avail_in;
FX_DWORD skip_size;
- FX_INT32 decode_status;
+ int32_t decode_status;
};
void _bmp_error(bmp_decompress_struct_p bmp_ptr, FX_LPCSTR err_msg);
bmp_decompress_struct_p _bmp_create_decompress();
void _bmp_destroy_decompress(bmp_decompress_struct_pp bmp_ptr_ptr);
-FX_INT32 _bmp_read_header(bmp_decompress_struct_p bmp_ptr);
-FX_INT32 _bmp_decode_image(bmp_decompress_struct_p bmp_ptr);
-FX_INT32 _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr);
-FX_INT32 _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr);
-FX_INT32 _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr);
+int32_t _bmp_read_header(bmp_decompress_struct_p bmp_ptr);
+int32_t _bmp_decode_image(bmp_decompress_struct_p bmp_ptr);
+int32_t _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr);
+int32_t _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr);
+int32_t _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr);
FX_LPBYTE _bmp_read_data(bmp_decompress_struct_p bmp_ptr, FX_LPBYTE* des_buf_pp, FX_DWORD data_size);
-void _bmp_save_decoding_status(bmp_decompress_struct_p bmp_ptr, FX_INT32 status);
+void _bmp_save_decoding_status(bmp_decompress_struct_p bmp_ptr, int32_t status);
void _bmp_input_buffer(bmp_decompress_struct_p bmp_ptr, FX_LPBYTE src_buf, FX_DWORD src_size);
FX_DWORD _bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr, FX_LPBYTE* avial_buf_ptr);
#define BMP_PTR_NOT_NULL(ptr,bmp_ptr) if(ptr == NULL){ \
@@ -129,13 +129,13 @@ struct tag_bmp_compress_struct { FX_LPBYTE src_buf;
FX_DWORD src_pitch;
FX_DWORD src_row;
- FX_BYTE src_bpp;
+ uint8_t src_bpp;
FX_DWORD src_width;
FX_BOOL src_free;
FX_DWORD* pal_ptr;
FX_WORD pal_num;
#ifdef BMP_SUPPORT_BITFIELD
- FX_BYTE bit_type;
+ uint8_t bit_type;
#endif
};
bmp_compress_struct_p _bmp_create_compress();
diff --git a/core/src/fxcodec/lgif/fx_gif.cpp b/core/src/fxcodec/lgif/fx_gif.cpp index bc6109e88e..1eb4a75f1a 100644 --- a/core/src/fxcodec/lgif/fx_gif.cpp +++ b/core/src/fxcodec/lgif/fx_gif.cpp @@ -14,7 +14,7 @@ FX_DWORD CGifLZWDecoder::GetAvailInput() {
return avail_in;
}
-void CGifLZWDecoder::InitTable(FX_BYTE code_len)
+void CGifLZWDecoder::InitTable(uint8_t code_len)
{
code_size = code_len;
code_clear = 1 << code_size;
@@ -35,7 +35,7 @@ void CGifLZWDecoder::ClearTable() FXSYS_memset32(code_table, 0, sizeof(tag_Table)*GIF_MAX_LZW_CODE);
FXSYS_memset32(stack, 0, GIF_MAX_LZW_CODE);
for (FX_WORD i = 0; i < code_clear; i++) {
- code_table[i].suffix = (FX_BYTE)i;
+ code_table[i].suffix = (uint8_t)i;
}
}
void CGifLZWDecoder::DecodeString(FX_WORD code)
@@ -49,10 +49,10 @@ void CGifLZWDecoder::DecodeString(FX_WORD code) stack[GIF_MAX_LZW_CODE - 1 - stack_size++] = code_table[code].suffix;
code = code_table[code].prefix;
}
- stack[GIF_MAX_LZW_CODE - 1 - stack_size++] = (FX_BYTE)code;
- code_first = (FX_BYTE)code;
+ stack[GIF_MAX_LZW_CODE - 1 - stack_size++] = (uint8_t)code;
+ code_first = (uint8_t)code;
}
-void CGifLZWDecoder::AddCode(FX_WORD prefix_code, FX_BYTE append_char)
+void CGifLZWDecoder::AddCode(FX_WORD prefix_code, uint8_t append_char)
{
if(code_next == GIF_MAX_LZW_CODE) {
return;
@@ -65,7 +65,7 @@ void CGifLZWDecoder::AddCode(FX_WORD prefix_code, FX_BYTE append_char) }
}
}
-FX_INT32 CGifLZWDecoder::Decode(FX_LPBYTE des_buf, FX_DWORD& des_size)
+int32_t CGifLZWDecoder::Decode(FX_LPBYTE des_buf, FX_DWORD& des_size)
{
if(des_size == 0) {
return 3;
@@ -118,7 +118,7 @@ FX_INT32 CGifLZWDecoder::Decode(FX_LPBYTE des_buf, FX_DWORD& des_size) return 0;
} else {
DecodeString(code);
- FX_BYTE append_char = stack[GIF_MAX_LZW_CODE - stack_size];
+ uint8_t append_char = stack[GIF_MAX_LZW_CODE - stack_size];
AddCode(code_old, append_char);
}
}
@@ -150,11 +150,11 @@ static FX_BOOL _gif_grow_buf(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD siz FX_DWORD len_org = dst_len;
while (dst_buf && dst_len < size) {
dst_len <<= 1;
- dst_buf = FX_Realloc(FX_BYTE, dst_buf, dst_len);
+ dst_buf = FX_Realloc(uint8_t, dst_buf, dst_len);
}
if (dst_buf == NULL) {
dst_len = size;
- dst_buf = FX_Realloc(FX_BYTE, dst_buf, dst_len);
+ dst_buf = FX_Realloc(uint8_t, dst_buf, dst_len);
if (dst_buf == NULL) {
return FALSE;
}
@@ -164,17 +164,17 @@ static FX_BOOL _gif_grow_buf(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD siz }
return TRUE;
}
-static inline void _gif_cut_index(FX_BYTE& val, FX_DWORD index, FX_BYTE index_bit, FX_BYTE index_bit_use, FX_BYTE bit_use)
+static inline void _gif_cut_index(uint8_t& val, FX_DWORD index, uint8_t index_bit, uint8_t index_bit_use, uint8_t bit_use)
{
FX_DWORD cut = ((1 << (index_bit - index_bit_use)) - 1) << index_bit_use;
val |= ((index & cut) >> index_bit_use) << bit_use;
}
-static inline FX_BYTE _gif_cut_buf(FX_LPCBYTE buf, FX_DWORD& offset, FX_BYTE bit_cut, FX_BYTE& bit_offset, FX_DWORD& bit_num)
+static inline uint8_t _gif_cut_buf(FX_LPCBYTE buf, FX_DWORD& offset, uint8_t bit_cut, uint8_t& bit_offset, FX_DWORD& bit_num)
{
if (bit_cut != 8) {
FX_WORD index = 0;
index |= ((1 << bit_cut) - 1) << (7 - bit_offset);
- FX_BYTE ret = ((index & buf[offset]) >> (7 - bit_offset));
+ uint8_t ret = ((index & buf[offset]) >> (7 - bit_offset));
bit_offset += bit_cut;
if (bit_offset >= 8) {
if (bit_offset > 8) {
@@ -206,7 +206,7 @@ void CGifLZWEncoder::ClearTable() code_table[i].suffix = 0;
}
}
-void CGifLZWEncoder::Start( FX_BYTE code_len, FX_LPCBYTE src_buf, FX_LPBYTE& dst_buf, FX_DWORD& offset)
+void CGifLZWEncoder::Start( uint8_t code_len, FX_LPCBYTE src_buf, FX_LPBYTE& dst_buf, FX_DWORD& offset)
{
code_size = code_len + 1;
src_bit_cut = code_size;
@@ -238,7 +238,7 @@ void CGifLZWEncoder::WriteBlock(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& }
void CGifLZWEncoder::EncodeString( FX_DWORD index, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset )
{
- FX_BYTE index_bit_use;
+ uint8_t index_bit_use;
index_bit_use = 0;
if (index_buf_len == GIF_DATA_BLOCK) {
WriteBlock(dst_buf, dst_len, offset);
@@ -289,7 +289,7 @@ void CGifLZWEncoder::EncodeString( FX_DWORD index, FX_LPBYTE& dst_buf, FX_DWORD& }
FX_BOOL CGifLZWEncoder::Encode( FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset )
{
- FX_BYTE suffix;
+ uint8_t suffix;
if (setjmp(jmp)) {
return FALSE;
}
@@ -313,7 +313,7 @@ FX_BOOL CGifLZWEncoder::Encode( FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYTE& src_bit_num = 0;
return TRUE;
}
-FX_BOOL CGifLZWEncoder::LookUpInTable( FX_LPCBYTE buf, FX_DWORD& offset, FX_BYTE& bit_offset )
+FX_BOOL CGifLZWEncoder::LookUpInTable( FX_LPCBYTE buf, FX_DWORD& offset, uint8_t& bit_offset )
{
for (FX_WORD i = table_cur; i < index_num; i++) {
if (code_table[i].prefix == code_table[index_num].prefix &&
@@ -336,7 +336,7 @@ void CGifLZWEncoder::Finish(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& off }
gif_decompress_struct_p _gif_create_decompress()
{
- gif_decompress_struct_p gif_ptr = (gif_decompress_struct*)FX_Alloc(FX_BYTE, sizeof(gif_decompress_struct));
+ gif_decompress_struct_p gif_ptr = (gif_decompress_struct*)FX_Alloc(uint8_t, sizeof(gif_decompress_struct));
if(gif_ptr == NULL) {
return NULL;
}
@@ -365,8 +365,8 @@ void _gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr) delete gif_ptr->img_decoder_ptr;
}
if(gif_ptr->img_ptr_arr_ptr != NULL) {
- FX_INT32 size_img_arr = gif_ptr->img_ptr_arr_ptr->GetSize();
- for (FX_INT32 i = 0; i < size_img_arr; i++) {
+ int32_t size_img_arr = gif_ptr->img_ptr_arr_ptr->GetSize();
+ for (int32_t i = 0; i < size_img_arr; i++) {
GifImage* p = gif_ptr->img_ptr_arr_ptr->GetAt(i);
if(p->image_info_ptr != NULL) {
FX_Free(p->image_info_ptr);
@@ -402,8 +402,8 @@ void _gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr) #endif
#ifdef GIF_SUPPORT_PLAIN_TEXT_EXTENSION
if(gif_ptr->pt_ptr_arr_ptr != NULL) {
- FX_INT32 size_pt_arr = gif_ptr->pt_ptr_arr_ptr->GetSize();
- for (FX_INT32 i = 0; i < size_pt_arr; i++) {
+ int32_t size_pt_arr = gif_ptr->pt_ptr_arr_ptr->GetSize();
+ for (int32_t i = 0; i < size_pt_arr; i++) {
GifPlainText* p = gif_ptr->pt_ptr_arr_ptr->GetAt(i);
if(p->gce_ptr != NULL) {
FX_Free(p->gce_ptr);
@@ -423,13 +423,13 @@ void _gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr) }
gif_compress_struct_p _gif_create_compress()
{
- gif_compress_struct_p gif_ptr = (gif_compress_struct*)FX_Alloc(FX_BYTE, sizeof(gif_compress_struct));
+ gif_compress_struct_p gif_ptr = (gif_compress_struct*)FX_Alloc(uint8_t, sizeof(gif_compress_struct));
if (gif_ptr == NULL) {
return NULL;
}
FXSYS_memset32(gif_ptr, 0, sizeof(gif_compress_struct));
gif_ptr->img_encoder_ptr = new CGifLZWEncoder;
- gif_ptr->header_ptr = (GifHeader*)FX_Alloc(FX_BYTE, sizeof(GifHeader));
+ gif_ptr->header_ptr = (GifHeader*)FX_Alloc(uint8_t, sizeof(GifHeader));
if (gif_ptr->header_ptr == NULL) {
delete(gif_ptr->img_encoder_ptr);
FX_Free(gif_ptr);
@@ -437,7 +437,7 @@ gif_compress_struct_p _gif_create_compress() }
FXSYS_memcpy32(gif_ptr->header_ptr->signature, GIF_SIGNATURE, 3);
FXSYS_memcpy32(gif_ptr->header_ptr->version, "89a", 3);
- gif_ptr->lsd_ptr = (GifLSD*)FX_Alloc(FX_BYTE, sizeof(GifLSD));
+ gif_ptr->lsd_ptr = (GifLSD*)FX_Alloc(uint8_t, sizeof(GifLSD));
if (gif_ptr->lsd_ptr == NULL) {
FX_Free(gif_ptr->header_ptr);
delete(gif_ptr->img_encoder_ptr);
@@ -445,7 +445,7 @@ gif_compress_struct_p _gif_create_compress() return NULL;
}
FXSYS_memset32(gif_ptr->lsd_ptr, 0, sizeof(GifLSD));
- gif_ptr->image_info_ptr = (GifImageInfo*)FX_Alloc(FX_BYTE, sizeof(GifImageInfo));
+ gif_ptr->image_info_ptr = (GifImageInfo*)FX_Alloc(uint8_t, sizeof(GifImageInfo));
if (gif_ptr->image_info_ptr == NULL) {
FX_Free(gif_ptr->lsd_ptr);
FX_Free(gif_ptr->header_ptr);
@@ -459,7 +459,7 @@ gif_compress_struct_p _gif_create_compress() FXSYS_memcpy32(gif_ptr->app_authentication, "2.0", 3);
#endif
#ifdef GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION
- gif_ptr->gce_ptr = (GifGCE*)FX_Alloc(FX_BYTE, sizeof(GifGCE));
+ gif_ptr->gce_ptr = (GifGCE*)FX_Alloc(uint8_t, sizeof(GifGCE));
if (gif_ptr->gce_ptr == NULL) {
FX_Free(gif_ptr->image_info_ptr);
FX_Free(gif_ptr->lsd_ptr);
@@ -470,7 +470,7 @@ gif_compress_struct_p _gif_create_compress() }
#endif
#ifdef GIF_SUPPORT_PLAIN_TEXT_EXTENSION
- gif_ptr->pte_ptr = (GifPTE*)FX_Alloc(FX_BYTE, sizeof(GifPTE));
+ gif_ptr->pte_ptr = (GifPTE*)FX_Alloc(uint8_t, sizeof(GifPTE));
if (gif_ptr->pte_ptr == NULL) {
FX_Free(gif_ptr->gce_ptr);
FX_Free(gif_ptr->image_info_ptr);
@@ -539,7 +539,7 @@ void _gif_error(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg) }
}
void _gif_warn(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg) {}
-FX_INT32 _gif_read_header(gif_decompress_struct_p gif_ptr)
+int32_t _gif_read_header(gif_decompress_struct_p gif_ptr)
{
if(gif_ptr == NULL) {
return 0;
@@ -565,7 +565,7 @@ FX_INT32 _gif_read_header(gif_decompress_struct_p gif_ptr) if(((GifGF*)&gif_lsd_ptr->global_flag)->global_pal) {
gif_ptr->global_pal_num = 2 << ((GifGF*)&gif_lsd_ptr->global_flag)->pal_bits;
ASSERT(sizeof(GifPalette) == 3);
- FX_INT32 global_pal_size = gif_ptr->global_pal_num * 3;
+ int32_t global_pal_size = gif_ptr->global_pal_num * 3;
FX_LPBYTE global_pal_ptr = NULL;
if (_gif_read_data(gif_ptr, &global_pal_ptr, global_pal_size) == NULL) {
gif_ptr->skip_size = skip_size_org;
@@ -577,7 +577,7 @@ FX_INT32 _gif_read_header(gif_decompress_struct_p gif_ptr) FX_Free(gif_ptr->global_pal_ptr);
}
gif_ptr->global_pal_ptr = NULL;
- gif_ptr->global_pal_ptr = (GifPalette*)FX_Alloc(FX_BYTE, global_pal_size);
+ gif_ptr->global_pal_ptr = (GifPalette*)FX_Alloc(uint8_t, global_pal_size);
GIF_PTR_NOT_NULL(gif_ptr->global_pal_ptr, gif_ptr);
FXSYS_memcpy32(gif_ptr->global_pal_ptr, global_pal_ptr, global_pal_size);
}
@@ -587,12 +587,12 @@ FX_INT32 _gif_read_header(gif_decompress_struct_p gif_ptr) gif_ptr->pixel_aspect = gif_lsd_ptr->pixel_aspect;
return 1;
}
-FX_INT32 _gif_get_frame(gif_decompress_struct_p gif_ptr)
+int32_t _gif_get_frame(gif_decompress_struct_p gif_ptr)
{
if(gif_ptr == NULL) {
return 0;
}
- FX_INT32 ret = 1;
+ int32_t ret = 1;
while (TRUE) {
switch(gif_ptr->decode_status) {
case GIF_D_STATUS_TAIL:
@@ -649,7 +649,7 @@ FX_INT32 _gif_get_frame(gif_decompress_struct_p gif_ptr) continue;
#endif
default: {
- FX_INT32 status = GIF_D_STATUS_EXT_UNE;
+ int32_t status = GIF_D_STATUS_EXT_UNE;
#ifndef GIF_SUPPORT_PLAIN_TEXT_EXTENSION
if(*ext_ptr == GIF_BLOCK_PTE) {
status = GIF_D_STATUS_EXT_PTE;
@@ -709,7 +709,7 @@ void _gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr, GifGCE** gce_ptr_ptr }
#endif
}
-FX_INT32 _gif_decode_extension(gif_decompress_struct_p gif_ptr)
+int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr)
{
FX_LPBYTE data_size_ptr = NULL;
FX_LPBYTE data_ptr = NULL;
@@ -728,7 +728,7 @@ FX_INT32 _gif_decode_extension(gif_decompress_struct_p gif_ptr) return 2;
}
while(*data_size_ptr != GIF_BLOCK_TERMINAL) {
- FX_BYTE data_size = *data_size_ptr;
+ uint8_t data_size = *data_size_ptr;
if(_gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL ||
_gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
gif_ptr->skip_size = skip_size_org;
@@ -743,7 +743,7 @@ FX_INT32 _gif_decode_extension(gif_decompress_struct_p gif_ptr) FX_Free(gif_ptr->app_data);
gif_ptr->app_data = NULL;
}
- gif_ptr->app_data = FX_Alloc(FX_BYTE, gif_ptr->app_data_size);
+ gif_ptr->app_data = FX_Alloc(uint8_t, gif_ptr->app_data_size);
GIF_PTR_NOT_NULL(gif_ptr->app_data, gif_ptr);
FXSYS_memcpy32(gif_ptr->app_data, FX_LPCBYTE(gif_ae_data_str), gif_ptr->app_data_size);
}
@@ -757,7 +757,7 @@ FX_INT32 _gif_decode_extension(gif_decompress_struct_p gif_ptr) }
gif_ptr->cmt_data_ptr->Empty();
while(*data_size_ptr != GIF_BLOCK_TERMINAL) {
- FX_BYTE data_size = *data_size_ptr;
+ uint8_t data_size = *data_size_ptr;
if(_gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL ||
_gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
gif_ptr->skip_size = skip_size_org;
@@ -779,7 +779,7 @@ FX_INT32 _gif_decode_extension(gif_decompress_struct_p gif_ptr) GIF_PTR_NOT_NULL(gif_pt_ptr, gif_ptr);
FXSYS_memset32(gif_pt_ptr, 0, sizeof(GifPlainText));
_gif_takeover_gce_ptr(gif_ptr, &gif_pt_ptr->gce_ptr);
- gif_pt_ptr->pte_ptr = (GifPTE*)FX_Alloc(FX_BYTE, sizeof(GifPTE));
+ gif_pt_ptr->pte_ptr = (GifPTE*)FX_Alloc(uint8_t, sizeof(GifPTE));
GIF_PTR_NOT_NULL(gif_pt_ptr->pte_ptr, gif_ptr);
gif_pt_ptr->string_ptr = new CFX_ByteString;
GIF_PTR_NOT_NULL(gif_pt_ptr->string_ptr, gif_ptr);
@@ -809,7 +809,7 @@ FX_INT32 _gif_decode_extension(gif_decompress_struct_p gif_ptr) return 2;
}
while(*data_size_ptr != GIF_BLOCK_TERMINAL) {
- FX_BYTE data_size = *data_size_ptr;
+ uint8_t data_size = *data_size_ptr;
if(_gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL ||
_gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
gif_ptr->skip_size = skip_size_org;
@@ -841,7 +841,7 @@ FX_INT32 _gif_decode_extension(gif_decompress_struct_p gif_ptr) return 2;
}
if(gif_ptr->gce_ptr == NULL) {
- gif_ptr->gce_ptr = (GifGCE*)FX_Alloc(FX_BYTE, sizeof(GifGCE));
+ gif_ptr->gce_ptr = (GifGCE*)FX_Alloc(uint8_t, sizeof(GifGCE));
GIF_PTR_NOT_NULL(gif_ptr->gce_ptr, gif_ptr);
}
gif_ptr->gce_ptr->block_size = gif_gce_ptr->block_size;
@@ -877,7 +877,7 @@ FX_INT32 _gif_decode_extension(gif_decompress_struct_p gif_ptr) _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_SIG);
return 1;
}
-FX_INT32 _gif_decode_image_info(gif_decompress_struct_p gif_ptr)
+int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr)
{
if(gif_ptr->width == 0 || gif_ptr->height == 0) {
_gif_error(gif_ptr, "No Image Header Info");
@@ -889,10 +889,10 @@ FX_INT32 _gif_decode_image_info(gif_decompress_struct_p gif_ptr) if(_gif_read_data(gif_ptr, (FX_LPBYTE*)&gif_img_info_ptr, 9) == NULL) {
return 2;
}
- GifImage* gif_image_ptr = (GifImage*)FX_Alloc(FX_BYTE, sizeof(GifImage));
+ GifImage* gif_image_ptr = (GifImage*)FX_Alloc(uint8_t, sizeof(GifImage));
GIF_PTR_NOT_NULL(gif_image_ptr, gif_ptr);
FXSYS_memset32(gif_image_ptr, 0, sizeof(GifImage));
- gif_image_ptr->image_info_ptr = (GifImageInfo*)FX_Alloc(FX_BYTE, sizeof(GifImageInfo));
+ gif_image_ptr->image_info_ptr = (GifImageInfo*)FX_Alloc(uint8_t, sizeof(GifImageInfo));
GIF_PTR_NOT_NULL(gif_image_ptr->image_info_ptr, gif_ptr);
gif_image_ptr->image_info_ptr->left = _GetWord_LSBFirst((FX_LPBYTE)&gif_img_info_ptr->left);
gif_image_ptr->image_info_ptr->top = _GetWord_LSBFirst((FX_LPBYTE)&gif_img_info_ptr->top);
@@ -914,7 +914,7 @@ FX_INT32 _gif_decode_image_info(gif_decompress_struct_p gif_ptr) GifLF* gif_img_info_lf_ptr = (GifLF*)&gif_img_info_ptr->local_flag;
if(gif_img_info_lf_ptr->local_pal) {
ASSERT(sizeof(GifPalette) == 3);
- FX_INT32 loc_pal_size = (2 << gif_img_info_lf_ptr->pal_bits) * 3;
+ int32_t loc_pal_size = (2 << gif_img_info_lf_ptr->pal_bits) * 3;
FX_LPBYTE loc_pal_ptr = NULL;
if(_gif_read_data(gif_ptr, &loc_pal_ptr, loc_pal_size) == NULL) {
gif_ptr->skip_size = skip_size_org;
@@ -955,7 +955,7 @@ FX_INT32 _gif_decode_image_info(gif_decompress_struct_p gif_ptr) _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_IMG_DATA);
return 1;
}
-FX_INT32 _gif_load_frame(gif_decompress_struct_p gif_ptr, FX_INT32 frame_num)
+int32_t _gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num)
{
if(gif_ptr == NULL ||
frame_num < 0 ||
@@ -973,10 +973,10 @@ FX_INT32 _gif_load_frame(gif_decompress_struct_p gif_ptr, FX_INT32 frame_num) FX_Free(gif_image_ptr->image_row_buf);
gif_image_ptr->image_row_buf = NULL;
}
- gif_image_ptr->image_row_buf = FX_Alloc(FX_BYTE, gif_img_row_bytes);
+ gif_image_ptr->image_row_buf = FX_Alloc(uint8_t, gif_img_row_bytes);
GIF_PTR_NOT_NULL(gif_image_ptr->image_row_buf, gif_ptr);
GifGCE* gif_img_gce_ptr = gif_image_ptr->image_gce_ptr;
- FX_INT32 loc_pal_num = ((GifLF*)&gif_image_ptr->image_info_ptr->local_flag)->local_pal ?
+ int32_t loc_pal_num = ((GifLF*)&gif_image_ptr->image_info_ptr->local_flag)->local_pal ?
(2 << ((GifLF*)&gif_image_ptr->image_info_ptr->local_flag)->pal_bits) : 0;
gif_ptr->avail_in = 0;
if(gif_img_gce_ptr == NULL) {
@@ -1002,11 +1002,11 @@ FX_INT32 _gif_load_frame(gif_decompress_struct_p gif_ptr, FX_INT32 frame_num) gif_image_ptr->image_info_ptr->width,
gif_image_ptr->image_info_ptr->height,
loc_pal_num, gif_image_ptr->local_pal_ptr,
- (FX_INT32)gif_image_ptr->image_gce_ptr->delay_time,
+ (int32_t)gif_image_ptr->image_gce_ptr->delay_time,
(FX_BOOL)((GifCEF*)&gif_image_ptr->image_gce_ptr->gce_flag)->user_input,
((GifCEF*)&gif_image_ptr->image_gce_ptr->gce_flag)->transparency ?
- (FX_INT32)gif_image_ptr->image_gce_ptr->trans_index : -1,
- (FX_INT32)((GifCEF*)&gif_image_ptr->image_gce_ptr->gce_flag)->disposal_method,
+ (int32_t)gif_image_ptr->image_gce_ptr->trans_index : -1,
+ (int32_t)((GifCEF*)&gif_image_ptr->image_gce_ptr->gce_flag)->disposal_method,
(FX_BOOL)((GifLF*)&gif_image_ptr->image_info_ptr->local_flag)->interlace
);
if(!bRes) {
@@ -1041,7 +1041,7 @@ FX_INT32 _gif_load_frame(gif_decompress_struct_p gif_ptr, FX_INT32 frame_num) _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_IMG_DATA);
gif_ptr->img_row_offset += gif_ptr->img_row_avail_size;
gif_ptr->img_row_avail_size = gif_img_row_bytes - gif_ptr->img_row_offset;
- FX_INT32 ret = img_decoder_ptr->Decode(gif_image_ptr->image_row_buf + gif_ptr->img_row_offset, gif_ptr->img_row_avail_size);
+ int32_t ret = img_decoder_ptr->Decode(gif_image_ptr->image_row_buf + gif_ptr->img_row_offset, gif_ptr->img_row_avail_size);
if(ret == 0) {
FX_Free(gif_image_ptr->image_row_buf);
gif_image_ptr->image_row_buf = NULL;
@@ -1079,7 +1079,7 @@ FX_INT32 _gif_load_frame(gif_decompress_struct_p gif_ptr, FX_INT32 frame_num) if(((GifLF*)&gif_image_ptr->image_info_ptr->local_flag)->interlace) {
gif_ptr->_gif_get_row_fn(gif_ptr, gif_image_ptr->image_row_num, gif_image_ptr->image_row_buf);
gif_image_ptr->image_row_num += s_gif_interlace_step[gif_ptr->img_pass_num];
- if(gif_image_ptr->image_row_num >= (FX_INT32)gif_image_ptr->image_info_ptr->height) {
+ if(gif_image_ptr->image_row_num >= (int32_t)gif_image_ptr->image_info_ptr->height) {
gif_ptr->img_pass_num++;
gif_image_ptr->image_row_num = s_gif_interlace_step[gif_ptr->img_pass_num] / 2;
}
@@ -1104,7 +1104,7 @@ FX_INT32 _gif_load_frame(gif_decompress_struct_p gif_ptr, FX_INT32 frame_num) _gif_error(gif_ptr, "Decode Image Data Error");
return 0;
}
-void _gif_save_decoding_status(gif_decompress_struct_p gif_ptr, FX_INT32 status)
+void _gif_save_decoding_status(gif_decompress_struct_p gif_ptr, int32_t status)
{
gif_ptr->decode_status = status;
gif_ptr->next_in += gif_ptr->skip_size;
@@ -1137,7 +1137,7 @@ FX_DWORD _gif_get_avail_input(gif_decompress_struct_p gif_ptr, FX_LPBYTE* avial_ }
return gif_ptr->avail_in;
}
-FX_INT32 _gif_get_frame_num(gif_decompress_struct_p gif_ptr)
+int32_t _gif_get_frame_num(gif_decompress_struct_p gif_ptr)
{
return gif_ptr->img_ptr_arr_ptr->GetSize();
}
@@ -1147,7 +1147,7 @@ static FX_BOOL _gif_write_header( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_ return TRUE;
}
dst_len = sizeof(GifHeader) + sizeof(GifLSD) + sizeof(GifGF);
- dst_buf = FX_TryAlloc(FX_BYTE, dst_len);
+ dst_buf = FX_TryAlloc(uint8_t, dst_len);
if (dst_buf == NULL) {
return FALSE;
}
@@ -1188,7 +1188,7 @@ void interlace_buf(FX_LPCBYTE buf, FX_DWORD pitch, FX_DWORD height) } else {
j = 3;
}
- temp = FX_Alloc(FX_BYTE, pitch);
+ temp = FX_Alloc(uint8_t, pitch);
if (temp == NULL) {
return;
}
@@ -1213,7 +1213,7 @@ static void _gif_write_block_data(FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYT src_offset += GIF_DATA_BLOCK;
src_len -= GIF_DATA_BLOCK;
}
- dst_buf[dst_offset++] = (FX_BYTE)src_len;
+ dst_buf[dst_offset++] = (uint8_t)src_len;
FXSYS_memcpy32(&dst_buf[dst_offset], &src_buf[src_offset], src_len);
dst_offset += src_len;
}
@@ -1260,7 +1260,7 @@ static FX_BOOL _gif_write_data( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_bu if (lf.interlace) {
interlace_buf(gif_ptr->src_buf, gif_ptr->src_pitch, gif_ptr->image_info_ptr->height);
}
- FX_BYTE code_bit = lf.pal_bits;
+ uint8_t code_bit = lf.pal_bits;
if (lf.local_pal == 0) {
GifGF& gf = (GifGF&)gif_ptr->lsd_ptr->global_flag;
code_bit = gf.pal_bits;
diff --git a/core/src/fxcodec/lgif/fx_gif.h b/core/src/fxcodec/lgif/fx_gif.h index 09c63e20f6..10aaf5f98f 100644 --- a/core/src/fxcodec/lgif/fx_gif.h +++ b/core/src/fxcodec/lgif/fx_gif.h @@ -10,7 +10,7 @@ extern FX_WORD _GetWord_LSBFirst(FX_LPBYTE p);
extern void _SetWord_LSBFirst(FX_LPBYTE p, FX_WORD v);
-extern void _BpcConvert(FX_LPCBYTE src_buf, FX_DWORD src_len, FX_INT32 src_bpc, FX_INT32 dst_bpc,
+extern void _BpcConvert(FX_LPCBYTE src_buf, FX_DWORD src_len, int32_t src_bpc, int32_t dst_bpc,
FX_LPBYTE& dst_buf, FX_DWORD& dst_len);
#define GIF_SUPPORT_COMMENT_EXTENSION
#define GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION
@@ -39,17 +39,17 @@ extern void _BpcConvert(FX_LPCBYTE src_buf, FX_DWORD src_len, FX_INT32 src_bpc, #define GIF_D_STATUS_IMG_DATA 0x0A
#pragma pack(1)
typedef struct tagGifGF {
- FX_BYTE pal_bits : 3;
- FX_BYTE sort_flag : 1;
- FX_BYTE color_resolution : 3;
- FX_BYTE global_pal : 1;
+ uint8_t pal_bits : 3;
+ uint8_t sort_flag : 1;
+ uint8_t color_resolution : 3;
+ uint8_t global_pal : 1;
} GifGF;
typedef struct tagGifLF {
- FX_BYTE pal_bits : 3;
- FX_BYTE reserved : 2;
- FX_BYTE sort_flag : 1;
- FX_BYTE interlace : 1;
- FX_BYTE local_pal : 1;
+ uint8_t pal_bits : 3;
+ uint8_t reserved : 2;
+ uint8_t sort_flag : 1;
+ uint8_t interlace : 1;
+ uint8_t local_pal : 1;
} GifLF;
typedef struct tagGifHeader {
char signature[3];
@@ -58,9 +58,9 @@ typedef struct tagGifHeader { typedef struct tagGifLSD {
FX_WORD width;
FX_WORD height;
- FX_BYTE global_flag;
- FX_BYTE bc_index;
- FX_BYTE pixel_aspect;
+ uint8_t global_flag;
+ uint8_t bc_index;
+ uint8_t pixel_aspect;
} GifLSD;
typedef struct tagGifImageInfo {
FX_WORD left;
@@ -68,50 +68,50 @@ typedef struct tagGifImageInfo { FX_WORD width;
FX_WORD height;
- FX_BYTE local_flag;
+ uint8_t local_flag;
} GifImageInfo;
typedef struct tagGifCEF {
- FX_BYTE transparency : 1;
- FX_BYTE user_input : 1;
- FX_BYTE disposal_method : 3;
- FX_BYTE reserved : 3;
+ uint8_t transparency : 1;
+ uint8_t user_input : 1;
+ uint8_t disposal_method : 3;
+ uint8_t reserved : 3;
} GifCEF;
typedef struct tagGifGCE {
- FX_BYTE block_size;
- FX_BYTE gce_flag;
+ uint8_t block_size;
+ uint8_t gce_flag;
FX_WORD delay_time;
- FX_BYTE trans_index;
+ uint8_t trans_index;
} GifGCE;
typedef struct tagGifPTE {
- FX_BYTE block_size;
+ uint8_t block_size;
FX_WORD grid_left;
FX_WORD grid_top;
FX_WORD grid_width;
FX_WORD grid_height;
- FX_BYTE char_width;
- FX_BYTE char_height;
+ uint8_t char_width;
+ uint8_t char_height;
- FX_BYTE fc_index;
- FX_BYTE bc_index;
+ uint8_t fc_index;
+ uint8_t bc_index;
} GifPTE;
typedef struct tagGifAE {
- FX_BYTE block_size;
- FX_BYTE app_identify[8];
- FX_BYTE app_authentication[3];
+ uint8_t block_size;
+ uint8_t app_identify[8];
+ uint8_t app_authentication[3];
} GifAE;
typedef struct tagGifPalette {
- FX_BYTE r, g, b;
+ uint8_t r, g, b;
} GifPalette;
#pragma pack()
typedef struct tagGifImage {
GifGCE* image_gce_ptr;
GifPalette* local_pal_ptr;
GifImageInfo* image_info_ptr;
- FX_BYTE image_code_size;
+ uint8_t image_code_size;
FX_DWORD image_data_pos;
FX_LPBYTE image_row_buf;
- FX_INT32 image_row_num;
+ int32_t image_row_num;
} GifImage;
typedef struct tagGifPlainText {
GifGCE* gce_ptr;
@@ -123,30 +123,30 @@ class CGifLZWDecoder public:
struct tag_Table {
FX_WORD prefix;
- FX_BYTE suffix;
+ uint8_t suffix;
};
CGifLZWDecoder(FX_LPSTR error_ptr = NULL)
{
err_msg_ptr = error_ptr;
}
- void InitTable(FX_BYTE code_len);
+ void InitTable(uint8_t code_len);
- FX_INT32 Decode(FX_LPBYTE des_buf, FX_DWORD& des_size);
+ int32_t Decode(FX_LPBYTE des_buf, FX_DWORD& des_size);
void Input(FX_LPBYTE src_buf, FX_DWORD src_size);
FX_DWORD GetAvailInput();
private:
void ClearTable();
- void AddCode(FX_WORD prefix_code, FX_BYTE append_char);
+ void AddCode(FX_WORD prefix_code, uint8_t append_char);
void DecodeString(FX_WORD code);
- FX_BYTE code_size;
- FX_BYTE code_size_cur;
+ uint8_t code_size;
+ uint8_t code_size_cur;
FX_WORD code_clear;
FX_WORD code_end;
FX_WORD code_next;
- FX_BYTE code_first;
- FX_BYTE stack[GIF_MAX_LZW_CODE];
+ uint8_t code_first;
+ uint8_t stack[GIF_MAX_LZW_CODE];
FX_WORD stack_size;
tag_Table code_table[GIF_MAX_LZW_CODE];
FX_WORD code_old;
@@ -154,7 +154,7 @@ private: FX_LPBYTE next_in;
FX_DWORD avail_in;
- FX_BYTE bits_left;
+ uint8_t bits_left;
FX_DWORD code_store;
FX_LPSTR err_msg_ptr;
@@ -164,38 +164,38 @@ class CGifLZWEncoder public:
struct tag_Table {
FX_WORD prefix;
- FX_BYTE suffix;
+ uint8_t suffix;
};
CGifLZWEncoder();
~CGifLZWEncoder();
- void Start(FX_BYTE code_len, FX_LPCBYTE src_buf, FX_LPBYTE& dst_buf, FX_DWORD& offset);
+ void Start(uint8_t code_len, FX_LPCBYTE src_buf, FX_LPBYTE& dst_buf, FX_DWORD& offset);
FX_BOOL Encode(FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
void Finish(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
private:
void ClearTable();
- FX_BOOL LookUpInTable(FX_LPCBYTE buf, FX_DWORD& offset, FX_BYTE& bit_offset);
+ FX_BOOL LookUpInTable(FX_LPCBYTE buf, FX_DWORD& offset, uint8_t& bit_offset);
void EncodeString(FX_DWORD index, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
void WriteBlock(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
jmp_buf jmp;
FX_DWORD src_offset;
- FX_BYTE src_bit_offset;
- FX_BYTE src_bit_cut;
+ uint8_t src_bit_offset;
+ uint8_t src_bit_cut;
FX_DWORD src_bit_num;
- FX_BYTE code_size;
+ uint8_t code_size;
FX_WORD code_clear;
FX_WORD code_end;
FX_WORD index_num;
- FX_BYTE bit_offset;
- FX_BYTE index_bit_cur;
- FX_BYTE index_buf[GIF_DATA_BLOCK];
- FX_BYTE index_buf_len;
+ uint8_t bit_offset;
+ uint8_t index_bit_cur;
+ uint8_t index_buf[GIF_DATA_BLOCK];
+ uint8_t index_buf_len;
tag_Table code_table[GIF_MAX_LZW_CODE];
FX_WORD table_cur;
};
typedef struct tag_gif_decompress_struct gif_decompress_struct;
typedef gif_decompress_struct *gif_decompress_struct_p;
typedef gif_decompress_struct_p *gif_decompress_struct_pp;
-static FX_INT32 s_gif_interlace_step[4] = {8, 8, 4, 2};
+static int32_t s_gif_interlace_step[4] = {8, 8, 4, 2};
struct tag_gif_decompress_struct {
jmp_buf jmpbuf;
FX_LPSTR err_ptr;
@@ -204,32 +204,32 @@ struct tag_gif_decompress_struct { int width;
int height;
GifPalette* global_pal_ptr;
- FX_INT32 global_pal_num;
- FX_BYTE global_sort_flag;
- FX_BYTE global_color_resolution;
+ int32_t global_pal_num;
+ uint8_t global_sort_flag;
+ uint8_t global_color_resolution;
- FX_BYTE bc_index;
- FX_BYTE pixel_aspect;
+ uint8_t bc_index;
+ uint8_t pixel_aspect;
CGifLZWDecoder* img_decoder_ptr;
FX_DWORD img_row_offset;
FX_DWORD img_row_avail_size;
- FX_BYTE img_pass_num;
+ uint8_t img_pass_num;
CFX_ArrayTemplate<GifImage*>* img_ptr_arr_ptr;
- FX_LPBYTE (*_gif_ask_buf_for_pal_fn)(gif_decompress_struct_p gif_ptr, FX_INT32 pal_size);
+ FX_LPBYTE (*_gif_ask_buf_for_pal_fn)(gif_decompress_struct_p gif_ptr, int32_t pal_size);
FX_LPBYTE next_in;
FX_DWORD avail_in;
- FX_INT32 decode_status;
+ int32_t decode_status;
FX_DWORD skip_size;
void (*_gif_record_current_position_fn)(gif_decompress_struct_p gif_ptr, FX_DWORD* cur_pos_ptr);
- void (*_gif_get_row_fn)(gif_decompress_struct_p gif_ptr, FX_INT32 row_num, FX_LPBYTE row_buf);
+ void (*_gif_get_row_fn)(gif_decompress_struct_p gif_ptr, int32_t row_num, FX_LPBYTE row_buf);
FX_BOOL (*_gif_get_record_position_fn)(gif_decompress_struct_p gif_ptr, FX_DWORD cur_pos,
- FX_INT32 left, FX_INT32 top, FX_INT32 width, FX_INT32 height,
- FX_INT32 pal_num, void* pal_ptr,
- FX_INT32 delay_time, FX_BOOL user_input,
- FX_INT32 trans_index, FX_INT32 disposal_method, FX_BOOL interlace);
+ int32_t left, int32_t top, int32_t width, int32_t height,
+ int32_t pal_num, void* pal_ptr,
+ int32_t delay_time, FX_BOOL user_input,
+ int32_t trans_index, int32_t disposal_method, FX_BOOL interlace);
#ifdef GIF_SUPPORT_APPLICATION_EXTENSION
- FX_BYTE app_identify[8];
- FX_BYTE app_authentication[3];
+ uint8_t app_identify[8];
+ uint8_t app_authentication[3];
FX_DWORD app_data_size;
FX_LPBYTE app_data;
#endif
@@ -262,8 +262,8 @@ struct tag_gif_compress_struct { GifImageInfo* image_info_ptr;
CGifLZWEncoder* img_encoder_ptr;
#ifdef GIF_SUPPORT_APPLICATION_EXTENSION
- FX_BYTE app_identify[8];
- FX_BYTE app_authentication[3];
+ uint8_t app_identify[8];
+ uint8_t app_authentication[3];
FX_DWORD app_data_size;
FX_LPBYTE app_data;
#endif
@@ -289,15 +289,15 @@ gif_decompress_struct_p _gif_create_decompress(); void _gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr);
gif_compress_struct_p _gif_create_compress();
void _gif_destroy_compress(gif_compress_struct_pp gif_ptr_ptr);
-FX_INT32 _gif_read_header(gif_decompress_struct_p gif_ptr);
-FX_INT32 _gif_get_frame(gif_decompress_struct_p gif_ptr);
-FX_INT32 _gif_get_frame_num(gif_decompress_struct_p gif_ptr);
-FX_INT32 _gif_decode_extension(gif_decompress_struct_p gif_ptr);
-FX_INT32 _gif_decode_image_info(gif_decompress_struct_p gif_ptr);
+int32_t _gif_read_header(gif_decompress_struct_p gif_ptr);
+int32_t _gif_get_frame(gif_decompress_struct_p gif_ptr);
+int32_t _gif_get_frame_num(gif_decompress_struct_p gif_ptr);
+int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr);
+int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr);
void _gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr, GifGCE** gce_ptr_ptr);
-FX_INT32 _gif_load_frame(gif_decompress_struct_p gif_ptr, FX_INT32 frame_num);
+int32_t _gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num);
FX_LPBYTE _gif_read_data(gif_decompress_struct_p gif_ptr, FX_LPBYTE* des_buf_pp, FX_DWORD data_size);
-void _gif_save_decoding_status(gif_decompress_struct_p gif_ptr, FX_INT32 status);
+void _gif_save_decoding_status(gif_decompress_struct_p gif_ptr, int32_t status);
void _gif_input_buffer(gif_decompress_struct_p gif_ptr, FX_LPBYTE src_buf, FX_DWORD src_size);
FX_DWORD _gif_get_avail_input(gif_decompress_struct_p gif_ptr, FX_LPBYTE* avial_buf_ptr);
void interlace_buf(FX_LPCBYTE buf, FX_DWORD width, FX_DWORD height);
diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h index 86e46eb5a0..99a5cf3c4e 100644 --- a/core/src/fxcrt/extension.h +++ b/core/src/fxcrt/extension.h @@ -198,7 +198,7 @@ public: ~CFX_MemoryStream() { if (m_dwFlags & FX_MEMSTREAM_TakeOver) { - for (FX_INT32 i = 0; i < m_Blocks.GetSize(); i++) { + for (int32_t i = 0; i < m_Blocks.GetSize(); i++) { FX_Free((FX_LPBYTE)m_Blocks[i]); } } @@ -308,7 +308,7 @@ public: } } size_t nRead = FX_MIN(size, m_nCurSize - m_nCurPos); - if (!ReadBlock(buffer, (FX_INT32)m_nCurPos, nRead)) { + if (!ReadBlock(buffer, (int32_t)m_nCurPos, nRead)) { return 0; } return nRead; @@ -331,10 +331,10 @@ public: if (m_nCurPos > m_nTotalSize) { m_nTotalSize = (m_nCurPos + m_nGrowSize - 1) / m_nGrowSize * m_nGrowSize; if (m_Blocks.GetSize() < 1) { - void* block = FX_Alloc(FX_BYTE, m_nTotalSize); + void* block = FX_Alloc(uint8_t, m_nTotalSize); m_Blocks.Add(block); } else { - m_Blocks[0] = FX_Realloc(FX_BYTE, m_Blocks[0], m_nTotalSize); + m_Blocks[0] = FX_Realloc(uint8_t, m_Blocks[0], m_nTotalSize); } if (!m_Blocks[0]) { m_Blocks.RemoveAll(); @@ -385,7 +385,7 @@ public: { if (m_dwFlags & FX_MEMSTREAM_Consecutive) { if (m_Blocks.GetSize() < 1) { - FX_LPBYTE pBlock = FX_Alloc(FX_BYTE, FX_MAX(nInitSize, 4096)); + FX_LPBYTE pBlock = FX_Alloc(uint8_t, FX_MAX(nInitSize, 4096)); m_Blocks.Add(pBlock); } m_nGrowSize = FX_MAX(nGrowSize, 4096); @@ -438,11 +438,11 @@ protected: if (size <= m_nTotalSize) { return TRUE; } - FX_INT32 iCount = m_Blocks.GetSize(); + int32_t iCount = m_Blocks.GetSize(); size = (size - m_nTotalSize + m_nGrowSize - 1) / m_nGrowSize; - m_Blocks.SetSize(m_Blocks.GetSize() + (FX_INT32)size); + m_Blocks.SetSize(m_Blocks.GetSize() + (int32_t)size); while (size --) { - FX_LPBYTE pBlock = FX_Alloc(FX_BYTE, m_nGrowSize); + FX_LPBYTE pBlock = FX_Alloc(uint8_t, m_nGrowSize); m_Blocks.SetAt(iCount ++, pBlock); m_nTotalSize += m_nGrowSize; } @@ -469,7 +469,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, FX_INT32 iCount); +FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, int32_t iCount); #endif #ifdef __cplusplus } diff --git a/core/src/fxcrt/fx_arabic.cpp b/core/src/fxcrt/fx_arabic.cpp index dd5d1d81bd..81c86542c7 100644 --- a/core/src/fxcrt/fx_arabic.cpp +++ b/core/src/fxcrt/fx_arabic.cpp @@ -214,8 +214,8 @@ FX_LPCARBFORMTABLE FX_GetArabicFormTable(FX_WCHAR unicode) } FX_WCHAR FX_GetArabicFromAlefTable(FX_WCHAR alef) { - static const FX_INT32 s_iAlefCount = sizeof(gs_FX_AlefTable) / sizeof(FX_ARAALEF); - for (FX_INT32 iStart = 0; iStart < s_iAlefCount; iStart ++) { + static const int32_t s_iAlefCount = sizeof(gs_FX_AlefTable) / sizeof(FX_ARAALEF); + for (int32_t iStart = 0; iStart < s_iAlefCount; iStart ++) { const FX_ARAALEF &v = gs_FX_AlefTable[iStart]; if (v.wAlef == alef) { return v.wIsolated; @@ -225,8 +225,8 @@ FX_WCHAR FX_GetArabicFromAlefTable(FX_WCHAR alef) } FX_WCHAR FX_GetArabicFromShaddaTable(FX_WCHAR shadda) { - static const FX_INT32 s_iShaddaCount = sizeof(gs_FX_ShaddaTable) / sizeof(FX_ARASHADDA); - for (FX_INT32 iStart = 0; iStart < s_iShaddaCount; iStart ++) { + static const int32_t s_iShaddaCount = sizeof(gs_FX_ShaddaTable) / sizeof(FX_ARASHADDA); + for (int32_t iStart = 0; iStart < s_iShaddaCount; iStart ++) { const FX_ARASHADDA &v = gs_FX_ShaddaTable[iStart]; if (v.wShadda == shadda) { return v.wIsolated; @@ -307,7 +307,7 @@ FX_LPCARBFORMTABLE CFX_ArabicChar::ParseChar(const CFX_Char *pTC, FX_WCHAR &wCha } return pFT; } -void FX_BidiReverseString(CFX_WideString &wsText, FX_INT32 iStart, FX_INT32 iCount) +void FX_BidiReverseString(CFX_WideString &wsText, int32_t iStart, int32_t iCount) { FXSYS_assert(iStart > -1 && iStart < wsText.GetLength()); FXSYS_assert(iCount >= 0 && iStart + iCount <= wsText.GetLength()); @@ -321,15 +321,15 @@ void FX_BidiReverseString(CFX_WideString &wsText, FX_INT32 iStart, FX_INT32 iCou *pEnd -- = wch; } } -void FX_BidiSetDeferredRun(CFX_Int32Array &values, FX_INT32 iStart, FX_INT32 iCount, FX_INT32 iValue) +void FX_BidiSetDeferredRun(CFX_Int32Array &values, int32_t iStart, int32_t iCount, int32_t iValue) { FXSYS_assert(iStart > -1 && iStart <= values.GetSize()); FXSYS_assert(iStart - iCount > -1); - for (FX_INT32 i = iStart - 1; i >= iStart - iCount; i --) { + for (int32_t i = iStart - 1; i >= iStart - iCount; i --) { values.SetAt(i, iValue); } } -const FX_INT32 gc_FX_BidiNTypes[] = { +const int32_t gc_FX_BidiNTypes[] = { FX_BIDICLASS_N, FX_BIDICLASS_L, FX_BIDICLASS_R, @@ -354,25 +354,25 @@ const FX_INT32 gc_FX_BidiNTypes[] = { void FX_BidiClassify(const CFX_WideString &wsText, CFX_Int32Array &classes, FX_BOOL bWS) { FXSYS_assert(wsText.GetLength() == classes.GetSize()); - FX_INT32 iCount = wsText.GetLength(); + int32_t iCount = wsText.GetLength(); FX_LPCWSTR pwsStart = (FX_LPCWSTR)wsText; FX_WCHAR wch; - FX_INT32 iCls; + int32_t iCls; if (bWS) { - for (FX_INT32 i = 0; i < iCount; i ++) { + for (int32_t i = 0; i < iCount; i ++) { wch = *pwsStart ++; iCls = ((gs_FX_TextLayout_CodeProperties[(FX_WORD)wch] & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS); classes.SetAt(i, iCls); } } else { - for (FX_INT32 i = 0; i < iCount; i ++) { + for (int32_t i = 0; i < iCount; i ++) { wch = *pwsStart ++; iCls = ((gs_FX_TextLayout_CodeProperties[(FX_WORD)wch] & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS); classes.SetAt(i, gc_FX_BidiNTypes[iCls]); } } } -FX_INT32 FX_BidiResolveExplicit(FX_INT32 iBaseLevel, FX_INT32 iDirection, CFX_Int32Array &classes, CFX_Int32Array &levels, FX_INT32 iStart, FX_INT32 iCount, FX_INT32 iNest) +int32_t FX_BidiResolveExplicit(int32_t iBaseLevel, int32_t iDirection, CFX_Int32Array &classes, CFX_Int32Array &levels, int32_t iStart, int32_t iCount, int32_t iNest) { FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL && iNest >= 0); FXSYS_assert(classes.GetSize() == levels.GetSize()); @@ -382,10 +382,10 @@ FX_INT32 FX_BidiResolveExplicit(FX_INT32 iBaseLevel, FX_INT32 iDirection, CFX_In return 0; } #if 0 - FX_INT32 iLastNest = iNest; + int32_t iLastNest = iNest; #endif - FX_INT32 iSize = classes.GetSize(); - FX_INT32 i = iStart, iCur, iCls; + int32_t iSize = classes.GetSize(); + int32_t i = iStart, iCur, iCls; for (; i < iSize && iCount > 0; i ++, iCount --) { iCur = iCls = classes.GetAt(i); #if 0 @@ -396,7 +396,7 @@ FX_INT32 FX_BidiResolveExplicit(FX_INT32 iBaseLevel, FX_INT32 iDirection, CFX_In iCls = FX_BIDICLASS_BN; iNest ++; if (FX_BidiGreaterEven(iBaseLevel) <= MAX_LEVEL) { - FX_INT32 iLevel = FX_BidiGreaterEven(iBaseLevel); + int32_t iLevel = FX_BidiGreaterEven(iBaseLevel); levels.SetAt(i, iLevel); i += FX_BidiResolveExplicit(iLevel, (iCls == FX_BIDICLASS_LRE ? FX_BIDICLASS_N : FX_BIDICLASS_L), @@ -415,7 +415,7 @@ FX_INT32 FX_BidiResolveExplicit(FX_INT32 iBaseLevel, FX_INT32 iDirection, CFX_In iCls = FX_BIDICLASS_BN; iNest ++; if (FX_BidiGreaterOdd(iBaseLevel) <= MAX_LEVEL) { - FX_INT32 iLevel = FX_BidiGreaterOdd(iBaseLevel); + int32_t iLevel = FX_BidiGreaterOdd(iBaseLevel); levels.SetAt(i, iLevel); i += FX_BidiResolveExplicit(iLevel, (iCls == FX_BIDICLASS_RLE ? FX_BIDICLASS_N : FX_BIDICLASS_R), @@ -452,7 +452,7 @@ FX_INT32 FX_BidiResolveExplicit(FX_INT32 iBaseLevel, FX_INT32 iDirection, CFX_In } return i - iStart; } -const FX_INT32 gc_FX_BidiWeakStates[][10] = { +const int32_t gc_FX_BidiWeakStates[][10] = { {FX_BWSao, FX_BWSxl, FX_BWSxr, FX_BWScn, FX_BWScn, FX_BWSxa, FX_BWSxa, FX_BWSao, FX_BWSao, FX_BWSao}, {FX_BWSro, FX_BWSxl, FX_BWSxr, FX_BWSra, FX_BWSre, FX_BWSxa, FX_BWSxr, FX_BWSro, FX_BWSro, FX_BWSrt}, {FX_BWSlo, FX_BWSxl, FX_BWSxr, FX_BWSla, FX_BWSle, FX_BWSxa, FX_BWSxl, FX_BWSlo, FX_BWSlo, FX_BWSlt}, @@ -474,7 +474,7 @@ const FX_INT32 gc_FX_BidiWeakStates[][10] = { {FX_BWSro, FX_BWSxl, FX_BWSxr, FX_BWSra, FX_BWSre, FX_BWSxa, FX_BWSret, FX_BWSro, FX_BWSro, FX_BWSret}, {FX_BWSlo, FX_BWSxl, FX_BWSxr, FX_BWSla, FX_BWSle, FX_BWSxa, FX_BWSlet, FX_BWSlo, FX_BWSlo, FX_BWSlet}, }; -const FX_INT32 gc_FX_BidiWeakActions[][10] = { +const int32_t gc_FX_BidiWeakActions[][10] = { {FX_BWAxxx, FX_BWAxxx, FX_BWAxxx, FX_BWAxxx, FX_BWAxxA, FX_BWAxxR, FX_BWAxxR, FX_BWAxxN, FX_BWAxxN, FX_BWAxxN}, {FX_BWAxxx, FX_BWAxxx, FX_BWAxxx, FX_BWAxxx, FX_BWAxxE, FX_BWAxxR, FX_BWAxxR, FX_BWAxxN, FX_BWAxxN, FX_BWAxIx}, {FX_BWAxxx, FX_BWAxxx, FX_BWAxxx, FX_BWAxxx, FX_BWAxxL, FX_BWAxxR, FX_BWAxxL, FX_BWAxxN, FX_BWAxxN, FX_BWAxIx}, @@ -496,18 +496,18 @@ const FX_INT32 gc_FX_BidiWeakActions[][10] = { {FX_BWAxxx, FX_BWAxxx, FX_BWAxxx, FX_BWAxxx, FX_BWAxxE, FX_BWAxxR, FX_BWAxxE, FX_BWAxxN, FX_BWAxxN, FX_BWAxxE}, {FX_BWAxxx, FX_BWAxxx, FX_BWAxxx, FX_BWAxxx, FX_BWAxxL, FX_BWAxxR, FX_BWAxxL, FX_BWAxxN, FX_BWAxxN, FX_BWAxxL}, }; -void FX_BidiResolveWeak(FX_INT32 iBaseLevel, CFX_Int32Array &classes, CFX_Int32Array &levels) +void FX_BidiResolveWeak(int32_t iBaseLevel, CFX_Int32Array &classes, CFX_Int32Array &levels) { FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL); FXSYS_assert(classes.GetSize() == levels.GetSize()); - FX_INT32 iSize = classes.GetSize(); + int32_t iSize = classes.GetSize(); if (iSize < 1) { return; } iSize --; - FX_INT32 iLevelCur = iBaseLevel; - FX_INT32 iState = FX_IsOdd(iBaseLevel) ? FX_BWSxr : FX_BWSxl; - FX_INT32 i = 0, iCount = 0, iClsCur, iClsRun, iClsNew, iAction; + int32_t iLevelCur = iBaseLevel; + int32_t iState = FX_IsOdd(iBaseLevel) ? FX_BWSxr : FX_BWSxl; + int32_t i = 0, iCount = 0, iClsCur, iClsRun, iClsNew, iAction; for (; i <= iSize; i ++) { iClsCur = classes.GetAt(i); #if 0 @@ -517,7 +517,7 @@ void FX_BidiResolveWeak(FX_INT32 iBaseLevel, CFX_Int32Array &classes, CFX_Int32A iClsCur = FX_BidiDirection(iLevelCur); classes.SetAt(i, iClsCur); } else if (i < iSize) { - FX_INT32 iLevelNext, iLevelNew; + int32_t iLevelNext, iLevelNew; iClsNew = classes.GetAt(i + 1); iLevelNext = levels.GetAt(i + 1); if (iClsNew != FX_BIDICLASS_BN && iLevelCur != iLevelNext) { @@ -565,7 +565,7 @@ void FX_BidiResolveWeak(FX_INT32 iBaseLevel, CFX_Int32Array &classes, CFX_Int32A FX_BidiSetDeferredRun(classes, i, iCount, iClsRun); } } -const FX_INT32 gc_FX_BidiNeutralStates[][5] = { +const int32_t gc_FX_BidiNeutralStates[][5] = { {FX_BNSrn, FX_BNSl, FX_BNSr, FX_BNSr, FX_BNSr}, {FX_BNSln, FX_BNSl, FX_BNSr, FX_BNSa, FX_BNSl}, {FX_BNSrn, FX_BNSl, FX_BNSr, FX_BNSr, FX_BNSr}, @@ -573,7 +573,7 @@ const FX_INT32 gc_FX_BidiNeutralStates[][5] = { {FX_BNSna, FX_BNSl, FX_BNSr, FX_BNSa, FX_BNSl}, {FX_BNSna, FX_BNSl, FX_BNSr, FX_BNSa, FX_BNSl}, }; -const FX_INT32 gc_FX_BidiNeutralActions[][5] = { +const int32_t gc_FX_BidiNeutralActions[][5] = { {FX_BNAIn, 0, 0, 0, 0 }, {FX_BNAIn, 0, 0, 0, FX_BCL }, {FX_BNAIn, FX_BNAEn, FX_BNARn, FX_BNARn, FX_BNARn }, @@ -581,7 +581,7 @@ const FX_INT32 gc_FX_BidiNeutralActions[][5] = { {FX_BNAIn, 0, 0, 0, FX_BCL }, {FX_BNAIn, FX_BNAEn, FX_BNARn, FX_BNARn, FX_BNAEn }, }; -FX_INT32 FX_BidiGetDeferredNeutrals(FX_INT32 iAction, FX_INT32 iLevel) +int32_t FX_BidiGetDeferredNeutrals(int32_t iAction, int32_t iLevel) { iAction = (iAction >> 4) & 0xF; if (iAction == (FX_BIDINEUTRALACTION_En >> 4)) { @@ -590,7 +590,7 @@ FX_INT32 FX_BidiGetDeferredNeutrals(FX_INT32 iAction, FX_INT32 iLevel) return iAction; } } -FX_INT32 FX_BidiGetResolvedNeutrals(FX_INT32 iAction) +int32_t FX_BidiGetResolvedNeutrals(int32_t iAction) { iAction = (iAction & 0xF); if (iAction == FX_BIDINEUTRALACTION_In) { @@ -599,18 +599,18 @@ FX_INT32 FX_BidiGetResolvedNeutrals(FX_INT32 iAction) return iAction; } } -void FX_BidiResolveNeutrals(FX_INT32 iBaseLevel, CFX_Int32Array &classes, const CFX_Int32Array &levels) +void FX_BidiResolveNeutrals(int32_t iBaseLevel, CFX_Int32Array &classes, const CFX_Int32Array &levels) { FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL); FXSYS_assert(classes.GetSize() == levels.GetSize()); - FX_INT32 iSize = classes.GetSize(); + int32_t iSize = classes.GetSize(); if (iSize < 1) { return; } iSize --; - FX_INT32 iLevel = iBaseLevel; - FX_INT32 iState = FX_IsOdd(iBaseLevel) ? FX_BNSr : FX_BNSl; - FX_INT32 i = 0, iCount = 0, iClsCur, iClsRun, iClsNew, iAction; + int32_t iLevel = iBaseLevel; + int32_t iState = FX_IsOdd(iBaseLevel) ? FX_BNSr : FX_BNSl; + int32_t i = 0, iCount = 0, iClsCur, iClsRun, iClsNew, iAction; for (; i <= iSize; i ++) { iClsCur = classes.GetAt(i); if (iClsCur == FX_BIDICLASS_BN) { @@ -642,20 +642,20 @@ void FX_BidiResolveNeutrals(FX_INT32 iBaseLevel, CFX_Int32Array &classes, const FX_BidiSetDeferredRun(classes, i, iCount, iClsRun); } } -const FX_INT32 gc_FX_BidiAddLevel[][4] = { +const int32_t gc_FX_BidiAddLevel[][4] = { {0, 1, 2, 2}, {1, 0, 1, 1}, }; void FX_BidiResolveImplicit(const CFX_Int32Array &classes, CFX_Int32Array &levels) { FXSYS_assert(classes.GetSize() == levels.GetSize()); - FX_INT32 iSize = classes.GetSize(); + int32_t iSize = classes.GetSize(); if (iSize < 1) { return; } iSize --; - FX_INT32 iCls, iLevel; - for (FX_INT32 i = 0; i <= iSize; i ++) { + int32_t iCls, iLevel; + for (int32_t i = 0; i <= iSize; i ++) { iCls = classes.GetAt(i); if (iCls == FX_BIDICLASS_BN) { continue; @@ -666,17 +666,17 @@ void FX_BidiResolveImplicit(const CFX_Int32Array &classes, CFX_Int32Array &level levels.SetAt(i, iLevel); } } -void FX_BidiResolveWhitespace(FX_INT32 iBaseLevel, const CFX_Int32Array &classes, CFX_Int32Array &levels) +void FX_BidiResolveWhitespace(int32_t iBaseLevel, const CFX_Int32Array &classes, CFX_Int32Array &levels) { FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL); FXSYS_assert(classes.GetSize() == levels.GetSize()); - FX_INT32 iSize = classes.GetSize(); + int32_t iSize = classes.GetSize(); if (iSize < 1) { return; } iSize --; - FX_INT32 iLevel = iBaseLevel; - FX_INT32 i = 0, iCount = 0; + int32_t iLevel = iBaseLevel; + int32_t i = 0, iCount = 0; for (; i <= iSize; i ++) { switch(classes.GetAt(i)) { case FX_BIDICLASS_WS: @@ -709,17 +709,17 @@ void FX_BidiResolveWhitespace(FX_INT32 iBaseLevel, const CFX_Int32Array &classes FX_BidiSetDeferredRun(levels, i, iCount, iBaseLevel); } } -FX_INT32 FX_BidiReorderLevel(FX_INT32 iBaseLevel, CFX_WideString &wsText, const CFX_Int32Array &levels, FX_INT32 iStart, FX_BOOL bReverse) +int32_t FX_BidiReorderLevel(int32_t iBaseLevel, CFX_WideString &wsText, const CFX_Int32Array &levels, int32_t iStart, FX_BOOL bReverse) { FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL); FXSYS_assert(wsText.GetLength() == levels.GetSize()); FXSYS_assert(iStart >= 0 && iStart < wsText.GetLength()); - FX_INT32 iSize = wsText.GetLength(); + int32_t iSize = wsText.GetLength(); if (iSize < 1) { return 0; } bReverse = bReverse || FX_IsOdd(iBaseLevel); - FX_INT32 i = iStart, iLevel; + int32_t i = iStart, iLevel; for (; i < iSize; i ++) { if ((iLevel = levels.GetAt(i)) == iBaseLevel) { continue; @@ -729,28 +729,28 @@ FX_INT32 FX_BidiReorderLevel(FX_INT32 iBaseLevel, CFX_WideString &wsText, const } i += FX_BidiReorderLevel(iBaseLevel + 1, wsText, levels, i, bReverse) - 1; } - FX_INT32 iCount = i - iStart; + int32_t iCount = i - iStart; if (bReverse && iCount > 1) { FX_BidiReverseString(wsText, iStart, iCount); } return iCount; } -void FX_BidiReorder(FX_INT32 iBaseLevel, CFX_WideString &wsText, const CFX_Int32Array &levels) +void FX_BidiReorder(int32_t iBaseLevel, CFX_WideString &wsText, const CFX_Int32Array &levels) { FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL); FXSYS_assert(wsText.GetLength() == levels.GetSize()); - FX_INT32 iSize = wsText.GetLength(); + int32_t iSize = wsText.GetLength(); if (iSize < 1) { return; } - FX_INT32 i = 0; + int32_t i = 0; while (i < iSize) { i += FX_BidiReorderLevel(iBaseLevel, wsText, levels, i, FALSE); } } -void FX_BidiLine(CFX_WideString &wsText, FX_INT32 iBaseLevel) +void FX_BidiLine(CFX_WideString &wsText, int32_t iBaseLevel) { - FX_INT32 iLength = wsText.GetLength(); + int32_t iLength = wsText.GetLength(); if (iLength < 2) { return; } @@ -772,12 +772,12 @@ template<class baseType> class CFX_BidiLineTemplate { public: - void FX_BidiReverseString(CFX_ArrayTemplate<baseType> &chars, FX_INT32 iStart, FX_INT32 iCount) + void FX_BidiReverseString(CFX_ArrayTemplate<baseType> &chars, int32_t iStart, int32_t iCount) { FXSYS_assert(iStart > -1 && iStart < chars.GetSize()); FXSYS_assert(iCount >= 0 && iStart + iCount <= chars.GetSize()); baseType *pStart, *pEnd; - FX_INT32 iEnd = iStart + iCount - 1, iTemp; + int32_t iEnd = iStart + iCount - 1, iTemp; while (iStart < iEnd) { pStart = chars.GetDataPtr(iStart ++); pEnd = chars.GetDataPtr(iEnd --); @@ -786,41 +786,41 @@ public: pEnd->m_iBidiPos = iTemp; } } - void FX_BidiSetDeferredRun(CFX_ArrayTemplate<baseType> &chars, FX_BOOL bClass, FX_INT32 iStart, FX_INT32 iCount, FX_INT32 iValue) + void FX_BidiSetDeferredRun(CFX_ArrayTemplate<baseType> &chars, FX_BOOL bClass, int32_t iStart, int32_t iCount, int32_t iValue) { FXSYS_assert(iStart > -1 && iStart <= chars.GetSize()); FXSYS_assert(iStart - iCount > -1); baseType *pTC; - FX_INT32 iLast = iStart - iCount; + int32_t iLast = iStart - iCount; if (bClass) { - for (FX_INT32 i = iStart - 1; i >= iLast; i --) { + for (int32_t i = iStart - 1; i >= iLast; i --) { pTC = chars.GetDataPtr(i); - pTC->m_iBidiClass = (FX_INT16)iValue; + pTC->m_iBidiClass = (int16_t)iValue; } } else { - for (FX_INT32 i = iStart - 1; i >= iLast; i --) { + for (int32_t i = iStart - 1; i >= iLast; i --) { pTC = chars.GetDataPtr(i); - pTC->m_iBidiLevel = (FX_INT16)iValue; + pTC->m_iBidiLevel = (int16_t)iValue; } } } - void FX_BidiClassify(CFX_ArrayTemplate<baseType> &chars, FX_INT32 iCount, FX_BOOL bWS) + void FX_BidiClassify(CFX_ArrayTemplate<baseType> &chars, int32_t iCount, FX_BOOL bWS) { FXSYS_assert(iCount > -1 && iCount <= chars.GetSize()); baseType *pTC; if (bWS) { - for (FX_INT32 i = 0; i < iCount; i ++) { + for (int32_t i = 0; i < iCount; i ++) { pTC = chars.GetDataPtr(i); - pTC->m_iBidiClass = (FX_INT16)(pTC->m_dwCharProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; + pTC->m_iBidiClass = (int16_t)(pTC->m_dwCharProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; } } else { - for (FX_INT32 i = 0; i < iCount; i ++) { + for (int32_t i = 0; i < iCount; i ++) { pTC = chars.GetDataPtr(i); - pTC->m_iBidiClass = (FX_INT16)gc_FX_BidiNTypes[(pTC->m_dwCharProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS]; + pTC->m_iBidiClass = (int16_t)gc_FX_BidiNTypes[(pTC->m_dwCharProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS]; } } } - void FX_BidiResolveExplicit(CFX_ArrayTemplate<baseType> &chars, FX_INT32 iCount, FX_INT32 iBaseLevel) + void FX_BidiResolveExplicit(CFX_ArrayTemplate<baseType> &chars, int32_t iCount, int32_t iBaseLevel) { FXSYS_assert(iCount > -1 && iCount <= chars.GetSize()); FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL); @@ -828,12 +828,12 @@ public: return; } baseType *pTC; - for (FX_INT32 i = 0; i < iCount; i ++) { + for (int32_t i = 0; i < iCount; i ++) { pTC = chars.GetDataPtr(i); - pTC->m_iBidiLevel = (FX_INT16)iBaseLevel; + pTC->m_iBidiLevel = (int16_t)iBaseLevel; } } - void FX_BidiResolveWeak(CFX_ArrayTemplate<baseType> &chars, FX_INT32 iCount, FX_INT32 iBaseLevel) + void FX_BidiResolveWeak(CFX_ArrayTemplate<baseType> &chars, int32_t iCount, int32_t iBaseLevel) { FXSYS_assert(iCount > -1 && iCount <= chars.GetSize()); iCount --; @@ -841,20 +841,20 @@ public: return; } baseType *pTC, *pTCNext; - FX_INT32 iLevelCur = iBaseLevel; - FX_INT32 iState = FX_IsOdd(iBaseLevel) ? FX_BWSxr : FX_BWSxl; - FX_INT32 i = 0, iNum = 0, iClsCur, iClsRun, iClsNew, iAction; + int32_t iLevelCur = iBaseLevel; + int32_t iState = FX_IsOdd(iBaseLevel) ? FX_BWSxr : FX_BWSxl; + int32_t i = 0, iNum = 0, iClsCur, iClsRun, iClsNew, iAction; for (; i <= iCount; i ++) { pTC = chars.GetDataPtr(i); iClsCur = pTC->m_iBidiClass; if (iClsCur == FX_BIDICLASS_BN) { - pTC->m_iBidiLevel = (FX_INT16)iLevelCur; + pTC->m_iBidiLevel = (int16_t)iLevelCur; if (i == iCount && iLevelCur != iBaseLevel) { iClsCur = FX_BidiDirection(iLevelCur); - pTC->m_iBidiClass = (FX_INT16)iClsCur; + pTC->m_iBidiClass = (int16_t)iClsCur; } else if (i < iCount) { pTCNext = chars.GetDataPtr(i + 1); - FX_INT32 iLevelNext, iLevelNew; + int32_t iLevelNext, iLevelNew; iClsNew = pTCNext->m_iBidiClass; iLevelNext = pTCNext->m_iBidiLevel; if (iClsNew != FX_BIDICLASS_BN && iLevelCur != iLevelNext) { @@ -862,9 +862,9 @@ public: if (iLevelCur > iLevelNew) { iLevelNew = iLevelCur; } - pTC->m_iBidiLevel = (FX_INT16)iLevelNew; + pTC->m_iBidiLevel = (int16_t)iLevelNew; iClsCur = FX_BidiDirection(iLevelNew); - pTC->m_iBidiClass = (FX_INT16)iClsCur; + pTC->m_iBidiClass = (int16_t)iClsCur; iLevelCur = iLevelNext; } else { if (iNum > 0) { @@ -888,7 +888,7 @@ public: } iClsNew = FX_BidiGetResolvedType(iAction); if (iClsNew != FX_BIDIWEAKACTION_XX) { - pTC->m_iBidiClass = (FX_INT16)iClsNew; + pTC->m_iBidiClass = (int16_t)iClsNew; } if (FX_BIDIWEAKACTION_IX & iAction) { iNum ++; @@ -903,7 +903,7 @@ public: } } } - void FX_BidiResolveNeutrals(CFX_ArrayTemplate<baseType> &chars, FX_INT32 iCount, FX_INT32 iBaseLevel) + void FX_BidiResolveNeutrals(CFX_ArrayTemplate<baseType> &chars, int32_t iCount, int32_t iBaseLevel) { FXSYS_assert(iCount > -1 && iCount <= chars.GetSize()); FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL); @@ -912,9 +912,9 @@ public: return; } baseType *pTC; - FX_INT32 iLevel = iBaseLevel; - FX_INT32 iState = FX_IsOdd(iBaseLevel) ? FX_BNSr : FX_BNSl; - FX_INT32 i = 0, iNum = 0, iClsCur, iClsRun, iClsNew, iAction; + int32_t iLevel = iBaseLevel; + int32_t iState = FX_IsOdd(iBaseLevel) ? FX_BNSr : FX_BNSl; + int32_t i = 0, iNum = 0, iClsCur, iClsRun, iClsNew, iAction; for (; i <= iCount; i ++) { pTC = chars.GetDataPtr(i); iClsCur = pTC->m_iBidiClass; @@ -933,7 +933,7 @@ public: } iClsNew = FX_BidiGetResolvedNeutrals(iAction); if (iClsNew != FX_BIDICLASS_N) { - pTC->m_iBidiClass = (FX_INT16)iClsNew; + pTC->m_iBidiClass = (int16_t)iClsNew; } if (FX_BIDINEUTRALACTION_In & iAction) { iNum ++; @@ -949,12 +949,12 @@ public: } } } - void FX_BidiResolveImplicit(CFX_ArrayTemplate<baseType> &chars, FX_INT32 iCount) + void FX_BidiResolveImplicit(CFX_ArrayTemplate<baseType> &chars, int32_t iCount) { FXSYS_assert(iCount > -1 && iCount <= chars.GetSize()); baseType *pTC; - FX_INT32 iCls, iLevel; - for (FX_INT32 i = 0; i < iCount; i ++) { + int32_t iCls, iLevel; + for (int32_t i = 0; i < iCount; i ++) { pTC = chars.GetDataPtr(i); iCls = pTC->m_iBidiClass; if (iCls == FX_BIDICLASS_BN) { @@ -963,10 +963,10 @@ public: FXSYS_assert(iCls > FX_BIDICLASS_ON && iCls < FX_BIDICLASS_AL); iLevel = pTC->m_iBidiLevel; iLevel += gc_FX_BidiAddLevel[FX_IsOdd(iLevel)][iCls - 1]; - pTC->m_iBidiLevel = (FX_INT16)iLevel; + pTC->m_iBidiLevel = (int16_t)iLevel; } } - void FX_BidiResolveWhitespace(CFX_ArrayTemplate<baseType> &chars, FX_INT32 iCount, FX_INT32 iBaseLevel) + void FX_BidiResolveWhitespace(CFX_ArrayTemplate<baseType> &chars, int32_t iCount, int32_t iBaseLevel) { FXSYS_assert(iCount > -1 && iCount <= chars.GetSize()); FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL); @@ -974,8 +974,8 @@ public: return; } iCount --; - FX_INT32 iLevel = iBaseLevel; - FX_INT32 i = 0, iNum = 0; + int32_t iLevel = iBaseLevel; + int32_t i = 0, iNum = 0; baseType *pTC; for (; i <= iCount; i ++) { pTC = chars.GetDataPtr(i); @@ -989,7 +989,7 @@ public: case FX_BIDICLASS_RLO: case FX_BIDICLASS_PDF: case FX_BIDICLASS_BN: - pTC->m_iBidiLevel = (FX_INT16)iLevel; + pTC->m_iBidiLevel = (int16_t)iLevel; iNum ++; break; case FX_BIDICLASS_S: @@ -997,7 +997,7 @@ public: if (iNum > 0) { FX_BidiSetDeferredRun(chars, FALSE, i, iNum, iBaseLevel); } - pTC->m_iBidiLevel = (FX_INT16)iBaseLevel; + pTC->m_iBidiLevel = (int16_t)iBaseLevel; iNum = 0; break; default: @@ -1010,7 +1010,7 @@ public: FX_BidiSetDeferredRun(chars, FALSE, i, iNum, iBaseLevel); } } - FX_INT32 FX_BidiReorderLevel(CFX_ArrayTemplate<baseType> &chars, FX_INT32 iCount, FX_INT32 iBaseLevel, FX_INT32 iStart, FX_BOOL bReverse) + int32_t FX_BidiReorderLevel(CFX_ArrayTemplate<baseType> &chars, int32_t iCount, int32_t iBaseLevel, int32_t iStart, FX_BOOL bReverse) { FXSYS_assert(iCount > -1 && iCount <= chars.GetSize()); FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL); @@ -1020,7 +1020,7 @@ public: } baseType *pTC; bReverse = bReverse || FX_IsOdd(iBaseLevel); - FX_INT32 i = iStart, iLevel; + int32_t i = iStart, iLevel; for (; i < iCount; i ++) { pTC = chars.GetDataPtr(i); if ((iLevel = pTC->m_iBidiLevel) == iBaseLevel) { @@ -1031,26 +1031,26 @@ public: } i += FX_BidiReorderLevel(chars, iCount, iBaseLevel + 1, i, bReverse) - 1; } - FX_INT32 iNum = i - iStart; + int32_t iNum = i - iStart; if (bReverse && iNum > 1) { FX_BidiReverseString(chars, iStart, iNum); } return iNum; } - void FX_BidiReorder(CFX_ArrayTemplate<baseType> &chars, FX_INT32 iCount, FX_INT32 iBaseLevel) + void FX_BidiReorder(CFX_ArrayTemplate<baseType> &chars, int32_t iCount, int32_t iBaseLevel) { FXSYS_assert(iCount > -1 && iCount <= chars.GetSize()); FXSYS_assert(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL); - FX_INT32 i = 0; + int32_t i = 0; while (i < iCount) { i += FX_BidiReorderLevel(chars, iCount, iBaseLevel, i, FALSE); } } - void FX_BidiPosition(CFX_ArrayTemplate<baseType> &chars, FX_INT32 iCount) + void FX_BidiPosition(CFX_ArrayTemplate<baseType> &chars, int32_t iCount) { FXSYS_assert(iCount > -1 && iCount <= chars.GetSize()); baseType *pTC; - FX_INT32 i = 0; + int32_t i = 0; while (i < iCount) { pTC = chars.GetDataPtr(i); pTC = chars.GetDataPtr(pTC->m_iBidiPos); @@ -1058,7 +1058,7 @@ public: } } - void FX_BidiLine(CFX_ArrayTemplate<baseType> &chars, FX_INT32 iCount, FX_INT32 iBaseLevel) + void FX_BidiLine(CFX_ArrayTemplate<baseType> &chars, int32_t iCount, int32_t iBaseLevel) { FXSYS_assert(iCount > -1 && iCount <= chars.GetSize()); if (iCount < 2) { @@ -1075,12 +1075,12 @@ public: FX_BidiPosition(chars, iCount); } }; -void FX_BidiLine(CFX_TxtCharArray &chars, FX_INT32 iCount, FX_INT32 iBaseLevel) +void FX_BidiLine(CFX_TxtCharArray &chars, int32_t iCount, int32_t iBaseLevel) { CFX_BidiLineTemplate<CFX_TxtChar> blt; blt.FX_BidiLine(chars, iCount, iBaseLevel); } -void FX_BidiLine(CFX_RTFCharArray &chars, FX_INT32 iCount, FX_INT32 iBaseLevel) +void FX_BidiLine(CFX_RTFCharArray &chars, int32_t iCount, int32_t iBaseLevel) { CFX_BidiLineTemplate<CFX_RTFChar> blt; blt.FX_BidiLine(chars, iCount, iBaseLevel); @@ -1102,8 +1102,8 @@ CFX_BidiChar::CFX_BidiChar() FX_BOOL CFX_BidiChar::AppendChar(FX_WCHAR wch) { FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; - FX_INT32 iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; - FX_INT32 iContext = 0; + int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; + int32_t iContext = 0; switch (iBidiCls) { case FX_BIDICLASS_L: case FX_BIDICLASS_AN: @@ -1147,7 +1147,7 @@ FX_BOOL CFX_BidiChar::EndChar() m_iLastCount = m_iCurCount - m_iLastStart; return m_iLastCount > 0; } -FX_INT32 CFX_BidiChar::GetBidiInfo(FX_INT32 &iStart, FX_INT32 &iCount) +int32_t CFX_BidiChar::GetBidiInfo(int32_t &iStart, int32_t &iCount) { iStart = m_iLastStart; iCount = m_iLastCount; diff --git a/core/src/fxcrt/fx_arabic.h b/core/src/fxcrt/fx_arabic.h index 66e8bc8000..27e519367a 100644 --- a/core/src/fxcrt/fx_arabic.h +++ b/core/src/fxcrt/fx_arabic.h @@ -26,8 +26,8 @@ public: protected: FX_LPCARBFORMTABLE ParseChar(const CFX_Char *pTC, FX_WCHAR &wChar, FX_CHARTYPE &eType) const; }; -void FX_BidiReverseString(CFX_WideString &wsText, FX_INT32 iStart, FX_INT32 iCount); -void FX_BidiSetDeferredRun(CFX_Int32Array &values, FX_INT32 iStart, FX_INT32 iCount, FX_INT32 iValue); +void FX_BidiReverseString(CFX_WideString &wsText, int32_t iStart, int32_t iCount); +void FX_BidiSetDeferredRun(CFX_Int32Array &values, int32_t iStart, int32_t iCount, int32_t iValue); #define FX_BCON FX_BIDICLASS_ON #define FX_BCL FX_BIDICLASS_L #define FX_BCR FX_BIDICLASS_R @@ -52,7 +52,7 @@ void FX_BidiClassify(const CFX_WideString &wsText, CFX_Int32Array &classes, FX_B #define FX_BIDIMAXLEVEL 61 #define FX_BidiGreaterEven(a) (FX_IsOdd(a) ? ((a) + 1) : ((a) + 2)) #define FX_BidiGreaterOdd(a) (FX_IsOdd(a) ? ((a) + 2) : ((a) + 1)) -FX_INT32 FX_BidiResolveExplicit(FX_INT32 iBaseLevel, FX_INT32 iDirection, CFX_Int32Array &classes, CFX_Int32Array &levels, FX_INT32 iStart, FX_INT32 iCount, FX_INT32 iNest = 0); +int32_t FX_BidiResolveExplicit(int32_t iBaseLevel, int32_t iDirection, CFX_Int32Array &classes, CFX_Int32Array &levels, int32_t iStart, int32_t iCount, int32_t iNest = 0); #define FX_BidiDirection(a) (FX_IsOdd(a) ? FX_BIDICLASS_R : FX_BIDICLASS_L) enum FX_BIDIWEAKSTATE { FX_BIDIWEAKSTATE_xa = 0, @@ -144,7 +144,7 @@ enum FX_BIDIWEAKACTION { #define FX_BWALxx FX_BIDIWEAKACTION_Lxx #define FX_BidiGetDeferredType(a) (((a) >> 4) & 0x0F) #define FX_BidiGetResolvedType(a) ((a) & 0x0F) -void FX_BidiResolveWeak(FX_INT32 iBaseLevel, CFX_Int32Array &classes, CFX_Int32Array &levels); +void FX_BidiResolveWeak(int32_t iBaseLevel, CFX_Int32Array &classes, CFX_Int32Array &levels); enum FX_BIDINEUTRALSTATE { FX_BIDINEUTRALSTATE_r = 0, FX_BIDINEUTRALSTATE_l, @@ -173,13 +173,13 @@ enum FX_BIDINEUTRALACTION { #define FX_BNALn FX_BIDINEUTRALACTION_Ln #define FX_BNAIn FX_BIDINEUTRALACTION_In #define FX_BNALnL FX_BIDINEUTRALACTION_LnL -FX_INT32 FX_BidiGetDeferredNeutrals(FX_INT32 iAction, FX_INT32 iLevel); -FX_INT32 FX_BidiGetResolvedNeutrals(FX_INT32 iAction); -void FX_BidiResolveNeutrals(FX_INT32 iBaseLevel, CFX_Int32Array &classes, const CFX_Int32Array &levels); +int32_t FX_BidiGetDeferredNeutrals(int32_t iAction, int32_t iLevel); +int32_t FX_BidiGetResolvedNeutrals(int32_t iAction); +void FX_BidiResolveNeutrals(int32_t iBaseLevel, CFX_Int32Array &classes, const CFX_Int32Array &levels); void FX_BidiResolveImplicit(const CFX_Int32Array &classes, CFX_Int32Array &levels); -void FX_BidiResolveWhitespace(FX_INT32 iBaseLevel, const CFX_Int32Array &classes, CFX_Int32Array &levels); -FX_INT32 FX_BidiReorderLevel(FX_INT32 iBaseLevel, CFX_WideString &wsText, const CFX_Int32Array &levels, FX_INT32 iStart, FX_BOOL bReverse = FALSE); -void FX_BidiReorder(FX_INT32 iBaseLevel, CFX_WideString &wsText, const CFX_Int32Array &levels); +void FX_BidiResolveWhitespace(int32_t iBaseLevel, const CFX_Int32Array &classes, CFX_Int32Array &levels); +int32_t FX_BidiReorderLevel(int32_t iBaseLevel, CFX_WideString &wsText, const CFX_Int32Array &levels, int32_t iStart, FX_BOOL bReverse = FALSE); +void FX_BidiReorder(int32_t iBaseLevel, CFX_WideString &wsText, const CFX_Int32Array &levels); class CFX_BidiChar final : public IFX_BidiChar { public: @@ -194,18 +194,18 @@ public: } virtual FX_BOOL AppendChar(FX_WCHAR wch) override; virtual FX_BOOL EndChar() override; - virtual FX_INT32 GetBidiInfo(FX_INT32 &iStart, FX_INT32 &iCount) override; + virtual int32_t GetBidiInfo(int32_t &iStart, int32_t &iCount) override; virtual void Reset() override; private: ~CFX_BidiChar() { } - FX_BOOL m_bSeparateNeutral; - FX_INT32 m_iCurStart; - FX_INT32 m_iCurCount; - FX_INT32 m_iCurBidi; - FX_INT32 m_iLastBidi; - FX_INT32 m_iLastStart; - FX_INT32 m_iLastCount; + FX_BOOL m_bSeparateNeutral; + int32_t m_iCurStart; + int32_t m_iCurCount; + int32_t m_iCurBidi; + int32_t m_iLastBidi; + int32_t m_iLastStart; + int32_t m_iLastCount; }; #endif // CORE_SRC_FXCRT_FX_ARABIC_H_ diff --git a/core/src/fxcrt/fx_basic_array.cpp b/core/src/fxcrt/fx_basic_array.cpp index 43a5417c00..315c83e53a 100644 --- a/core/src/fxcrt/fx_basic_array.cpp +++ b/core/src/fxcrt/fx_basic_array.cpp @@ -38,7 +38,7 @@ FX_BOOL CFX_BasicArray::SetSize(int nNewSize) m_nSize = m_nMaxSize = 0; return FALSE; } - m_pData = FX_Alloc(FX_BYTE, totalSize.ValueOrDie()); + m_pData = FX_Alloc(uint8_t, totalSize.ValueOrDie()); m_nSize = m_nMaxSize = nNewSize; } else if (nNewSize <= m_nMaxSize) { if (nNewSize > m_nSize) { @@ -52,7 +52,7 @@ FX_BOOL CFX_BasicArray::SetSize(int nNewSize) if (!totalSize.IsValid() || nNewMax < m_nSize) { return FALSE; } - FX_LPBYTE pNewData = FX_Realloc(FX_BYTE, m_pData, totalSize.ValueOrDie()); + FX_LPBYTE pNewData = FX_Realloc(uint8_t, m_pData, totalSize.ValueOrDie()); if (pNewData == NULL) { return FALSE; } @@ -185,7 +185,7 @@ void* CFX_BaseSegmentedArray::Add() if (m_DataSize % m_SegmentSize) { return GetAt(m_DataSize ++); } - void* pSegment = FX_Alloc2D(FX_BYTE, m_UnitSize, m_SegmentSize); + void* pSegment = FX_Alloc2D(uint8_t, m_UnitSize, m_SegmentSize); if (m_pIndex == NULL) { m_pIndex = pSegment; m_DataSize ++; @@ -315,8 +315,8 @@ void CFX_BaseSegmentedArray::Delete(int index, int count) } int i; for (i = index; i < m_DataSize - count; i ++) { - FX_BYTE* pSrc = (FX_BYTE*)GetAt(i + count); - FX_BYTE* pDest = (FX_BYTE*)GetAt(i); + uint8_t* pSrc = (uint8_t*)GetAt(i + count); + uint8_t* pDest = (uint8_t*)GetAt(i); for (int j = 0; j < m_UnitSize; j ++) { pDest[j] = pSrc[j]; } diff --git a/core/src/fxcrt/fx_basic_bstring.cpp b/core/src/fxcrt/fx_basic_bstring.cpp index 2377a6d624..78698fc6d0 100644 --- a/core/src/fxcrt/fx_basic_bstring.cpp +++ b/core/src/fxcrt/fx_basic_bstring.cpp @@ -72,7 +72,7 @@ CFX_ByteString::StringData* CFX_ByteString::StringData::Create(int nLen) int usableSize = totalSize - overhead; FXSYS_assert(usableSize >= nLen); - void* pData = FX_Alloc(FX_BYTE, totalSize); + void* pData = FX_Alloc(uint8_t, totalSize); return new (pData) StringData(nLen, usableSize); } CFX_ByteString::~CFX_ByteString() @@ -284,11 +284,11 @@ bool CFX_ByteString::EqualNoCase(FX_BSTR str) const FX_LPCBYTE pThat = str.GetPtr(); for (FX_STRSIZE i = 0; i < len; i ++) { if ((*pThis) != (*pThat)) { - FX_BYTE bThis = *pThis; + uint8_t bThis = *pThis; if (bThis >= 'A' && bThis <= 'Z') { bThis += 'a' - 'A'; } - FX_BYTE bThat = *pThat; + uint8_t bThat = *pThat; if (bThat >= 'A' && bThat <= 'Z') { bThat += 'a' - 'A'; } @@ -645,7 +645,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList) case 'X': case 'o': if (nModifier & FORCE_INT64) { - va_arg(argList, FX_INT64); + va_arg(argList, int64_t); } else { va_arg(argList, int); } @@ -936,7 +936,7 @@ CFX_WideString CFX_ByteString::UTF8Decode() const { CFX_UTF8Decoder decoder; for (FX_STRSIZE i = 0; i < GetLength(); i ++) { - decoder.Input((FX_BYTE)m_pData->m_String[i]); + decoder.Input((uint8_t)m_pData->m_String[i]); } return decoder.GetResult(); } @@ -969,9 +969,9 @@ int CFX_ByteString::Compare(FX_BSTR str) const int that_len = str.GetLength(); int min_len = this_len < that_len ? this_len : that_len; for (int i = 0; i < min_len; i ++) { - if ((FX_BYTE)m_pData->m_String[i] < str.GetAt(i)) { + if ((uint8_t)m_pData->m_String[i] < str.GetAt(i)) { return -1; - } else if ((FX_BYTE)m_pData->m_String[i] > str.GetAt(i)) { + } else if ((uint8_t)m_pData->m_String[i] > str.GetAt(i)) { return 1; } } diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp index 06ba9413a5..7d45a43128 100644 --- a/core/src/fxcrt/fx_basic_buffer.cpp +++ b/core/src/fxcrt/fx_basic_buffer.cpp @@ -18,7 +18,7 @@ CFX_BinaryBuf::CFX_BinaryBuf(FX_STRSIZE size) , m_DataSize(size) , m_AllocSize(size) { - m_pBuffer = FX_Alloc(FX_BYTE, size); + m_pBuffer = FX_Alloc(uint8_t, size); } CFX_BinaryBuf::~CFX_BinaryBuf() { @@ -84,9 +84,9 @@ void CFX_BinaryBuf::ExpandBuf(FX_STRSIZE add_size) new_size = (new_size + alloc_step - 1) / alloc_step * alloc_step; FX_LPBYTE pNewBuffer = m_pBuffer; if (pNewBuffer) { - pNewBuffer = FX_Realloc(FX_BYTE, m_pBuffer, new_size); + pNewBuffer = FX_Realloc(uint8_t, m_pBuffer, new_size); } else { - pNewBuffer = FX_Alloc(FX_BYTE, new_size); + pNewBuffer = FX_Alloc(uint8_t, new_size); } m_pBuffer = pNewBuffer; m_AllocSize = new_size; @@ -126,7 +126,7 @@ void CFX_BinaryBuf::InsertBlock(FX_STRSIZE pos, const void* pBuf, FX_STRSIZE siz } m_DataSize += size; } -void CFX_BinaryBuf::AppendFill(FX_BYTE byte, FX_STRSIZE count) +void CFX_BinaryBuf::AppendFill(uint8_t byte, FX_STRSIZE count) { ExpandBuf(count); if (!m_pBuffer) { @@ -242,7 +242,7 @@ CFX_WideStringC CFX_WideTextBuf::GetWideString() const { return CFX_WideStringC((FX_LPCWSTR)m_pBuffer, m_DataSize / sizeof(FX_WCHAR)); } -CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (FX_BYTE i) +CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (uint8_t i) { if (m_pStream) { m_pStream->WriteBlock(&i, 1); @@ -325,7 +325,7 @@ FX_BOOL CFX_ArchiveLoader::IsEOF() { return m_LoadingPos >= m_LoadingSize; } -CFX_ArchiveLoader& CFX_ArchiveLoader::operator >> (FX_BYTE& i) +CFX_ArchiveLoader& CFX_ArchiveLoader::operator >> (uint8_t& i) { if (m_LoadingPos >= m_LoadingSize) { return *this; @@ -447,13 +447,13 @@ FX_BOOL IFX_BufferArchive::Flush() m_Length = 0; return bRet; } -FX_INT32 IFX_BufferArchive::AppendBlock(const void* pBuf, size_t size) +int32_t IFX_BufferArchive::AppendBlock(const void* pBuf, size_t size) { if (!pBuf || size < 1) { return 0; } if (!m_pBuffer) { - m_pBuffer = FX_Alloc(FX_BYTE, m_BufSize); + m_pBuffer = FX_Alloc(uint8_t, m_BufSize); } FX_LPBYTE buffer = (FX_LPBYTE)pBuf; FX_STRSIZE temp_size = (FX_STRSIZE)size; @@ -469,19 +469,19 @@ FX_INT32 IFX_BufferArchive::AppendBlock(const void* pBuf, size_t size) temp_size -= buf_size; buffer += buf_size; } - return (FX_INT32)size; + return (int32_t)size; } -FX_INT32 IFX_BufferArchive::AppendByte(FX_BYTE byte) +int32_t IFX_BufferArchive::AppendByte(uint8_t byte) { return AppendBlock(&byte, 1); } -FX_INT32 IFX_BufferArchive::AppendDWord(FX_DWORD i) +int32_t IFX_BufferArchive::AppendDWord(FX_DWORD i) { char buf[32]; FXSYS_itoa(i, buf, 10); return AppendBlock(buf, (size_t)FXSYS_strlen(buf)); } -FX_INT32 IFX_BufferArchive::AppendString(FX_BSTR lpsz) +int32_t IFX_BufferArchive::AppendString(FX_BSTR lpsz) { return AppendBlock(lpsz.GetPtr(), lpsz.GetLength()); } diff --git a/core/src/fxcrt/fx_basic_coords.cpp b/core/src/fxcrt/fx_basic_coords.cpp index 8e7bb3e751..496b1443d1 100644 --- a/core/src/fxcrt/fx_basic_coords.cpp +++ b/core/src/fxcrt/fx_basic_coords.cpp @@ -430,7 +430,7 @@ FX_FLOAT CFX_Matrix::TransformXDistance(FX_FLOAT dx) const FX_FLOAT fx = a * dx, fy = b * dx; return FXSYS_sqrt(fx * fx + fy * fy); } -FX_INT32 CFX_Matrix::TransformXDistance(FX_INT32 dx) const +int32_t CFX_Matrix::TransformXDistance(int32_t dx) const { FX_FLOAT fx = a * dx, fy = b * dx; return FXSYS_round(FXSYS_sqrt(fx * fx + fy * fy)); @@ -440,7 +440,7 @@ FX_FLOAT CFX_Matrix::TransformYDistance(FX_FLOAT dy) const FX_FLOAT fx = c * dy, fy = d * dy; return FXSYS_sqrt(fx * fx + fy * fy); } -FX_INT32 CFX_Matrix::TransformYDistance(FX_INT32 dy) const +int32_t CFX_Matrix::TransformYDistance(int32_t dy) const { FX_FLOAT fx = c * dy, fy = d * dy; return FXSYS_round(FXSYS_sqrt(fx * fx + fy * fy)); @@ -450,7 +450,7 @@ FX_FLOAT CFX_Matrix::TransformDistance(FX_FLOAT dx, FX_FLOAT dy) const FX_FLOAT fx = a * dx + c * dy, fy = b * dx + d * dy; return FXSYS_sqrt(fx * fx + fy * fy); } -FX_INT32 CFX_Matrix::TransformDistance(FX_INT32 dx, FX_INT32 dy) const +int32_t CFX_Matrix::TransformDistance(int32_t dx, int32_t dy) const { FX_FLOAT fx = a * dx + c * dy, fy = b * dx + d * dy; return FXSYS_round(FXSYS_sqrt(fx * fx + fy * fy)); @@ -472,11 +472,11 @@ void CFX_Matrix::TransformVector(CFX_Vector &v) const v.x = FXSYS_round(fx); v.y = FXSYS_round(fy); } -void CFX_Matrix::TransformPoints(CFX_Point *points, FX_INT32 iCount) const +void CFX_Matrix::TransformPoints(CFX_Point *points, int32_t iCount) const { FXSYS_assert(iCount > 0); FX_FLOAT fx, fy; - for (FX_INT32 i = 0; i < iCount; i ++) { + for (int32_t i = 0; i < iCount; i ++) { fx = a * points->x + c * points->y + e; fy = b * points->x + d * points->y + f; points->x = FXSYS_round(fx); @@ -484,11 +484,11 @@ void CFX_Matrix::TransformPoints(CFX_Point *points, FX_INT32 iCount) const points ++; } } -void CFX_Matrix::TransformPoints(CFX_PointF *points, FX_INT32 iCount) const +void CFX_Matrix::TransformPoints(CFX_PointF *points, int32_t iCount) const { FXSYS_assert(iCount > 0); FX_FLOAT fx, fy; - for (FX_INT32 i = 0; i < iCount; i ++) { + for (int32_t i = 0; i < iCount; i ++) { fx = a * points->x + c * points->y + e; fy = b * points->x + d * points->y + f; points->x = fx, points->y = fy; @@ -501,7 +501,7 @@ void CFX_Matrix::TransformPoint(FX_FLOAT &x, FX_FLOAT &y) const FX_FLOAT fy = b * x + d * y + f; x = fx, y = fy; } -void CFX_Matrix::TransformPoint(FX_INT32 &x, FX_INT32 &y) const +void CFX_Matrix::TransformPoint(int32_t &x, int32_t &y) const { FX_FLOAT fx = a * x + c * y + e; FX_FLOAT fy = b * x + d * y + f; diff --git a/core/src/fxcrt/fx_basic_gcc.cpp b/core/src/fxcrt/fx_basic_gcc.cpp index 93c71ce660..caa99926a6 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 -FX_INT32 FXSYS_atoi(FX_LPCSTR str) +int32_t FXSYS_atoi(FX_LPCSTR str) { - return FXSYS_StrToInt<FX_INT32, FX_LPCSTR>(str); + return FXSYS_StrToInt<int32_t, FX_LPCSTR>(str); } -FX_INT32 FXSYS_wtoi(FX_LPCWSTR str) +int32_t FXSYS_wtoi(FX_LPCWSTR str) { - return FXSYS_StrToInt<FX_INT32, FX_LPCWSTR>(str); + return FXSYS_StrToInt<int32_t, FX_LPCWSTR>(str); } -FX_INT64 FXSYS_atoi64(FX_LPCSTR str) +int64_t FXSYS_atoi64(FX_LPCSTR str) { - return FXSYS_StrToInt<FX_INT64, FX_LPCSTR>(str); + return FXSYS_StrToInt<int64_t, FX_LPCSTR>(str); } -FX_INT64 FXSYS_wtoi64(FX_LPCWSTR str) +int64_t FXSYS_wtoi64(FX_LPCWSTR str) { - return FXSYS_StrToInt<FX_INT64, FX_LPCWSTR>(str); + return FXSYS_StrToInt<int64_t, FX_LPCWSTR>(str); } -FX_LPCSTR FXSYS_i64toa(FX_INT64 value, FX_LPSTR str, int radix) +FX_LPCSTR FXSYS_i64toa(int64_t value, FX_LPSTR str, int radix) { - return FXSYS_IntToStr<FX_INT64, FX_LPSTR>(value, str, radix); + return FXSYS_IntToStr<int64_t, FX_LPSTR>(value, str, radix); } -FX_LPCWSTR FXSYS_i64tow(FX_INT64 value, FX_LPWSTR str, int radix) +FX_LPCWSTR FXSYS_i64tow(int64_t value, FX_LPWSTR str, int radix) { - return FXSYS_IntToStr<FX_INT64, FX_LPWSTR>(value, str, radix); + return FXSYS_IntToStr<int64_t, FX_LPWSTR>(value, str, radix); } #ifdef __cplusplus } @@ -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<FX_INT32, FX_LPSTR>(value, string, radix); + return FXSYS_IntToStr<int32_t, FX_LPSTR>(value, string, radix); } #ifdef __cplusplus } diff --git a/core/src/fxcrt/fx_basic_maps.cpp b/core/src/fxcrt/fx_basic_maps.cpp index 7fca42acde..c0c394583e 100644 --- a/core/src/fxcrt/fx_basic_maps.cpp +++ b/core/src/fxcrt/fx_basic_maps.cpp @@ -42,7 +42,7 @@ CFX_MapPtrToPtr::~CFX_MapPtrToPtr() } FX_DWORD CFX_MapPtrToPtr::HashKey(void* key) const { - return ((FX_DWORD)(FX_UINTPTR)key) >> 4; + return ((FX_DWORD)(uintptr_t)key) >> 4; } void CFX_MapPtrToPtr::GetNextAssoc(FX_POSITION& rNextPosition, void*& rKey, void*& rValue) const { @@ -377,10 +377,10 @@ FX_BOOL CFX_MapByteStringToPtr::RemoveKey(FX_BSTR key) return FALSE; } struct _CompactString { - FX_BYTE m_CompactLen; - FX_BYTE m_LenHigh; - FX_BYTE m_LenLow; - FX_BYTE m_Unused; + uint8_t m_CompactLen; + uint8_t m_LenHigh; + uint8_t m_LenLow; + uint8_t m_Unused; FX_LPBYTE m_pBuffer; }; static void _CompactStringRelease(_CompactString* pCompact) @@ -405,14 +405,14 @@ static FX_BOOL _CompactStringSame(_CompactString* pCompact, FX_LPCBYTE pStr, int static void _CompactStringStore(_CompactString* pCompact, FX_LPCBYTE pStr, int len) { if (len < (int)sizeof(_CompactString)) { - pCompact->m_CompactLen = (FX_BYTE)len; + pCompact->m_CompactLen = (uint8_t)len; FXSYS_memcpy32(&pCompact->m_LenHigh, pStr, len); return; } pCompact->m_CompactLen = 0xff; pCompact->m_LenHigh = len / 256; pCompact->m_LenLow = len % 256; - pCompact->m_pBuffer = FX_Alloc(FX_BYTE, len); + pCompact->m_pBuffer = FX_Alloc(uint8_t, len); FXSYS_memcpy32(pCompact->m_pBuffer, pStr, len); } static CFX_ByteStringC _CompactStringGet(_CompactString* pCompact) @@ -449,7 +449,7 @@ FX_POSITION CFX_CMapByteStringToPtr::GetStartPosition() const for (int i = 0; i < size; i ++) { _CompactString* pKey = (_CompactString*)m_Buffer.GetAt(i); if (pKey->m_CompactLen != 0xfe) { - return (FX_POSITION)(FX_UINTPTR)(i + 1); + return (FX_POSITION)(uintptr_t)(i + 1); } } return NULL; @@ -459,7 +459,7 @@ void CFX_CMapByteStringToPtr::GetNextAssoc(FX_POSITION& rNextPosition, CFX_ByteS if (rNextPosition == NULL) { return; } - int index = (int)(FX_UINTPTR)rNextPosition - 1; + int index = (int)(uintptr_t)rNextPosition - 1; _CompactString* pKey = (_CompactString*)m_Buffer.GetAt(index); rKey = _CompactStringGet(pKey); rValue = *(void**)(pKey + 1); @@ -468,7 +468,7 @@ void CFX_CMapByteStringToPtr::GetNextAssoc(FX_POSITION& rNextPosition, CFX_ByteS while (index < size) { pKey = (_CompactString*)m_Buffer.GetAt(index); if (pKey->m_CompactLen != 0xfe) { - rNextPosition = (FX_POSITION)(FX_UINTPTR)(index + 1); + rNextPosition = (FX_POSITION)(uintptr_t)(index + 1); return; } index ++; @@ -480,7 +480,7 @@ FX_LPVOID CFX_CMapByteStringToPtr::GetNextValue(FX_POSITION& rNextPosition) cons if (rNextPosition == NULL) { return NULL; } - int index = (int)(FX_UINTPTR)rNextPosition - 1; + int index = (int)(uintptr_t)rNextPosition - 1; _CompactString* pKey = (_CompactString*)m_Buffer.GetAt(index); FX_LPVOID rValue = *(void**)(pKey + 1); index ++; @@ -488,7 +488,7 @@ FX_LPVOID CFX_CMapByteStringToPtr::GetNextValue(FX_POSITION& rNextPosition) cons while (index < size) { pKey = (_CompactString*)m_Buffer.GetAt(index); if (pKey->m_CompactLen != 0xfe) { - rNextPosition = (FX_POSITION)(FX_UINTPTR)(index + 1); + rNextPosition = (FX_POSITION)(uintptr_t)(index + 1); return rValue; } index ++; @@ -601,7 +601,7 @@ void CFX_CMapDWordToDWord::GetNextAssoc(FX_POSITION& pos, FX_DWORD& key, FX_DWOR if (pos == 0) { return; } - FX_DWORD index = ((FX_DWORD)(FX_UINTPTR)pos) - 1; + FX_DWORD index = ((FX_DWORD)(uintptr_t)pos) - 1; FX_DWORD count = m_Buffer.GetSize() / sizeof(_DWordPair); _DWordPair* buf = (_DWordPair*)m_Buffer.GetBuffer(); key = buf[index].key; @@ -609,7 +609,7 @@ void CFX_CMapDWordToDWord::GetNextAssoc(FX_POSITION& pos, FX_DWORD& key, FX_DWOR if (index == count - 1) { pos = 0; } else { - pos = (FX_POSITION)((FX_UINTPTR)pos + 1); + pos = (FX_POSITION)((uintptr_t)pos + 1); } } void CFX_CMapDWordToDWord::SetAt(FX_DWORD key, FX_DWORD value) diff --git a/core/src/fxcrt/fx_basic_memmgr.cpp b/core/src/fxcrt/fx_basic_memmgr.cpp index 63c609daec..a381fa4ef5 100644 --- a/core/src/fxcrt/fx_basic_memmgr.cpp +++ b/core/src/fxcrt/fx_basic_memmgr.cpp @@ -63,7 +63,7 @@ void* CFX_GrowOnlyPool::Alloc(size_t size) pTrunk = pTrunk->m_pNext; } size_t alloc_size = size > m_TrunkSize ? size : m_TrunkSize; - pTrunk = (_FX_GrowOnlyTrunk*)FX_Alloc(FX_BYTE, sizeof(_FX_GrowOnlyTrunk) + alloc_size); + pTrunk = (_FX_GrowOnlyTrunk*)FX_Alloc(uint8_t, sizeof(_FX_GrowOnlyTrunk) + alloc_size); pTrunk->m_Size = alloc_size; pTrunk->m_Allocated = size; pTrunk->m_pNext = (_FX_GrowOnlyTrunk*)m_pFirstTrunk; diff --git a/core/src/fxcrt/fx_basic_plex.cpp b/core/src/fxcrt/fx_basic_plex.cpp index 78319bd5da..802429600a 100644 --- a/core/src/fxcrt/fx_basic_plex.cpp +++ b/core/src/fxcrt/fx_basic_plex.cpp @@ -8,7 +8,7 @@ #include "plex.h" CFX_Plex* CFX_Plex::Create(CFX_Plex*& pHead, FX_DWORD nMax, FX_DWORD cbElement) { - CFX_Plex* p = (CFX_Plex*)FX_Alloc(FX_BYTE, sizeof(CFX_Plex) + nMax * cbElement); + CFX_Plex* p = (CFX_Plex*)FX_Alloc(uint8_t, sizeof(CFX_Plex) + nMax * cbElement); p->pNext = pHead; pHead = p; return p; @@ -17,7 +17,7 @@ void CFX_Plex::FreeDataChain() { CFX_Plex* p = this; while (p != NULL) { - FX_BYTE* bytes = (FX_BYTE*)p; + uint8_t* bytes = (uint8_t*)p; CFX_Plex* pNext = p->pNext; FX_Free(bytes); p = pNext; diff --git a/core/src/fxcrt/fx_basic_utf.cpp b/core/src/fxcrt/fx_basic_utf.cpp index f52b83efda..1422b7abd4 100644 --- a/core/src/fxcrt/fx_basic_utf.cpp +++ b/core/src/fxcrt/fx_basic_utf.cpp @@ -14,7 +14,7 @@ void CFX_UTF8Decoder::AppendChar(FX_DWORD ch) { m_Buffer.AppendChar((FX_WCHAR)ch); } -void CFX_UTF8Decoder::Input(FX_BYTE byte) +void CFX_UTF8Decoder::Input(uint8_t byte) { if (byte < 0x80) { m_PendingBytes = 0; @@ -65,7 +65,7 @@ void CFX_UTF8Encoder::Input(FX_WCHAR unicode) } else { nbytes = 6; } - static FX_BYTE prefix[] = {0xc0, 0xe0, 0xf0, 0xf8, 0xfc}; + static uint8_t prefix[] = {0xc0, 0xe0, 0xf0, 0xf8, 0xfc}; int order = 1 << ((nbytes - 1) * 6); int code = unicode; m_Buffer.AppendChar(prefix[nbytes - 2] | (code / order)); diff --git a/core/src/fxcrt/fx_basic_util.cpp b/core/src/fxcrt/fx_basic_util.cpp index be736f1b21..615b297421 100644 --- a/core/src/fxcrt/fx_basic_util.cpp +++ b/core/src/fxcrt/fx_basic_util.cpp @@ -187,22 +187,22 @@ void FXSYS_vsnprintf(char *str, size_t size, const char* fmt, va_list ap) } #endif // _FXM_PLATFORM_WINDOWS_ && _MSC_VER < 1900 -static FX_BOOL FX_IsDigit(FX_BYTE ch) +static FX_BOOL FX_IsDigit(uint8_t ch) { return (ch >= '0' && ch <= '9') ? TRUE : FALSE; } -static FX_BOOL FX_IsXDigit(FX_BYTE ch) +static FX_BOOL FX_IsXDigit(uint8_t ch) { return (FX_IsDigit(ch) || (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f')) ? TRUE : FALSE; } -static FX_BYTE FX_MakeUpper(FX_BYTE ch) +static uint8_t FX_MakeUpper(uint8_t ch) { if (ch < 'a' || ch > 'z') { return ch; } return ch - 32; } -static int FX_HexToI(FX_BYTE ch) +static int FX_HexToI(uint8_t ch) { ch = FX_MakeUpper(ch); return FX_IsDigit(ch) ? (ch - '0') : (ch - 55); @@ -237,7 +237,7 @@ CFX_ByteString FX_UrlEncode(const CFX_WideString& wsUrl) int nByte = bsUri.GetLength(); for (int j = 0; j < nByte; j++) { rUrl += '%'; - FX_BYTE code = bsUri.GetAt(j); + uint8_t code = bsUri.GetAt(j); rUrl += arDigits[code >> 4]; rUrl += arDigits[code & 0x0F]; } @@ -268,7 +268,7 @@ CFX_ByteString FX_EncodeURI(const CFX_WideString& wsURI) CFX_ByteString bsUri = wsURI.UTF8Encode(); int nLength = bsUri.GetLength(); for (int i = 0; i < nLength; i++) { - FX_BYTE code = bsUri.GetAt(i); + uint8_t code = bsUri.GetAt(i); if (code > 0x7F || url_encodeTable[code] == 1) { rURI += '%'; rURI += arDigits[code >> 4]; diff --git a/core/src/fxcrt/fx_basic_wstring.cpp b/core/src/fxcrt/fx_basic_wstring.cpp index 09e64e0c72..aeb366338e 100644 --- a/core/src/fxcrt/fx_basic_wstring.cpp +++ b/core/src/fxcrt/fx_basic_wstring.cpp @@ -33,7 +33,7 @@ CFX_WideString::StringData* CFX_WideString::StringData::Create(int nLen) int usableLen = (totalSize - overhead) / sizeof(FX_WCHAR); FXSYS_assert(usableLen >= nLen); - void* pData = FX_Alloc(FX_BYTE, iSize.ValueOrDie()); + void* pData = FX_Alloc(uint8_t, iSize.ValueOrDie()); return new (pData) StringData(nLen, usableLen); } CFX_WideString::~CFX_WideString() @@ -911,7 +911,7 @@ void CFX_WideString::FormatV(FX_LPCWSTR lpszFormat, va_list argList) case 'X': case 'o': if (nModifier & FORCE_INT64) { - va_arg(argList, FX_INT64); + va_arg(argList, int64_t); } else { va_arg(argList, int); } @@ -1068,7 +1068,7 @@ static const CFX_CharMap g_DefaultGBKMapper = {&_DefMap_GetWideString, &_DefMap_ static const CFX_CharMap g_DefaultJISMapper = {&_DefMap_GetWideString, &_DefMap_GetByteString, &_DefMap_GetJISCodePage}; static const CFX_CharMap g_DefaultUHCMapper = {&_DefMap_GetWideString, &_DefMap_GetByteString, &_DefMap_GetUHCCodePage}; static const CFX_CharMap g_DefaultBig5Mapper = {&_DefMap_GetWideString, &_DefMap_GetByteString, &_DefMap_GetBig5CodePage}; -CFX_CharMap* CFX_CharMap::GetDefaultMapper(FX_INT32 codepage) +CFX_CharMap* CFX_CharMap::GetDefaultMapper(int32_t codepage) { switch (codepage) { case 0: diff --git a/core/src/fxcrt/fx_extension.cpp b/core/src/fxcrt/fx_extension.cpp index 876cf47548..9490f3603c 100644 --- a/core/src/fxcrt/fx_extension.cpp +++ b/core/src/fxcrt/fx_extension.cpp @@ -151,25 +151,25 @@ FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x) { return FXSYS_log(x) / FXSYS_log(b); } -FX_FLOAT FXSYS_strtof(FX_LPCSTR pcsStr, FX_INT32 iLength, FX_INT32 *pUsedLen) +FX_FLOAT FXSYS_strtof(FX_LPCSTR pcsStr, int32_t iLength, int32_t *pUsedLen) { FXSYS_assert(pcsStr != NULL); if (iLength < 0) { - iLength = (FX_INT32)FXSYS_strlen(pcsStr); + iLength = (int32_t)FXSYS_strlen(pcsStr); } CFX_WideString ws = CFX_WideString::FromLocal(pcsStr, iLength); return FXSYS_wcstof(ws.c_str(), iLength, pUsedLen); } -FX_FLOAT FXSYS_wcstof(FX_LPCWSTR pwsStr, FX_INT32 iLength, FX_INT32 *pUsedLen) +FX_FLOAT FXSYS_wcstof(FX_LPCWSTR pwsStr, int32_t iLength, int32_t *pUsedLen) { FXSYS_assert(pwsStr != NULL); if (iLength < 0) { - iLength = (FX_INT32)FXSYS_wcslen(pwsStr); + iLength = (int32_t)FXSYS_wcslen(pwsStr); } if (iLength == 0) { return 0.0f; } - FX_INT32 iUsedLen = 0; + int32_t iUsedLen = 0; FX_BOOL bNegtive = FALSE; switch (pwsStr[iUsedLen]) { case '-': @@ -214,7 +214,7 @@ FX_LPWSTR FXSYS_wcsncpy(FX_LPWSTR dstStr, FX_LPCWSTR srcStr, size_t count) } return dstStr; } -FX_INT32 FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count) +int32_t FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count) { FXSYS_assert(s1 != NULL && s2 != NULL && count > 0); FX_WCHAR wch1 = 0, wch2 = 0; @@ -227,7 +227,7 @@ FX_INT32 FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count) } return wch1 - wch2; } -FX_INT32 FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count) +int32_t FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count) { FXSYS_assert(s1 != NULL && s2 != NULL && count > 0); FX_CHAR ch1 = 0, ch2 = 0; @@ -240,11 +240,11 @@ FX_INT32 FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count) } return ch1 - ch2; } -FX_DWORD FX_HashCode_String_GetA(FX_LPCSTR pStr, FX_INT32 iLength, FX_BOOL bIgnoreCase) +FX_DWORD FX_HashCode_String_GetA(FX_LPCSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase) { FXSYS_assert(pStr != NULL); if (iLength < 0) { - iLength = (FX_INT32)FXSYS_strlen(pStr); + iLength = (int32_t)FXSYS_strlen(pStr); } FX_LPCSTR pStrEnd = pStr + iLength; FX_DWORD dwHashCode = 0; @@ -259,11 +259,11 @@ FX_DWORD FX_HashCode_String_GetA(FX_LPCSTR pStr, FX_INT32 iLength, FX_BOOL bIgno } return dwHashCode; } -FX_DWORD FX_HashCode_String_GetW(FX_LPCWSTR pStr, FX_INT32 iLength, FX_BOOL bIgnoreCase) +FX_DWORD FX_HashCode_String_GetW(FX_LPCWSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase) { FXSYS_assert(pStr != NULL); if (iLength < 0) { - iLength = (FX_INT32)FXSYS_wcslen(pStr); + iLength = (int32_t)FXSYS_wcslen(pStr); } FX_LPCWSTR pStrEnd = pStr + iLength; FX_DWORD dwHashCode = 0; @@ -333,7 +333,7 @@ void FX_Random_MT_Close(FX_LPVOID pContext) FXSYS_assert(pContext != NULL); FX_Free(pContext); } -void FX_Random_GenerateMT(FX_LPDWORD pBuffer, FX_INT32 iCount) +void FX_Random_GenerateMT(FX_LPDWORD pBuffer, int32_t iCount) { FX_DWORD dwSeed; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ @@ -349,7 +349,7 @@ void FX_Random_GenerateMT(FX_LPDWORD pBuffer, FX_INT32 iCount) } FX_Random_MT_Close(pContext); } -void FX_Random_GenerateBase(FX_LPDWORD pBuffer, FX_INT32 iCount) +void FX_Random_GenerateBase(FX_LPDWORD pBuffer, int32_t iCount) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ SYSTEMTIME st1, st2; @@ -370,7 +370,7 @@ void FX_Random_GenerateBase(FX_LPDWORD pBuffer, FX_INT32 iCount) } } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, FX_INT32 iCount) +FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, int32_t iCount) { HCRYPTPROV hCP = NULL; if (!::CryptAcquireContext(&hCP, NULL, NULL, PROV_RSA_FULL, 0) || hCP == NULL) { @@ -381,7 +381,7 @@ FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, FX_INT32 iCount) return TRUE; } #endif -void FX_Random_GenerateCrypto(FX_LPDWORD pBuffer, FX_INT32 iCount) +void FX_Random_GenerateCrypto(FX_LPDWORD pBuffer, int32_t iCount) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ FX_GenerateCryptoRandom(pBuffer, iCount); @@ -408,15 +408,15 @@ void FX_GUID_CreateV4(FX_LPGUID pGUID) #else
FX_Random_GenerateMT((FX_LPDWORD)pGUID, 4);
#endif
- FX_BYTE &b = ((FX_LPBYTE)pGUID)[6];
+ uint8_t &b = ((FX_LPBYTE)pGUID)[6];
b = (b & 0x0F) | 0x40;
}
FX_LPCSTR gs_FX_pHexChars = "0123456789ABCDEF";
void FX_GUID_ToString(FX_LPCGUID pGUID, CFX_ByteString &bsStr, FX_BOOL bSeparator)
{
FX_LPSTR pBuf = bsStr.GetBuffer(40);
- FX_BYTE b;
- for (FX_INT32 i = 0; i < 16; i ++) {
+ uint8_t b;
+ for (int32_t i = 0; i < 16; i ++) {
b = ((FX_LPCBYTE)pGUID)[i];
*pBuf ++ = gs_FX_pHexChars[b >> 4];
*pBuf ++ = gs_FX_pHexChars[b & 0x0F];
diff --git a/core/src/fxcrt/fx_unicode.cpp b/core/src/fxcrt/fx_unicode.cpp index aac6142ce4..0117c1ffc5 100644 --- a/core/src/fxcrt/fx_unicode.cpp +++ b/core/src/fxcrt/fx_unicode.cpp @@ -29,7 +29,7 @@ FX_BOOL FX_IsCombinationChar(FX_WCHAR wch) FX_BOOL FX_IsBidiChar(FX_WCHAR wch) { FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; - FX_INT32 iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; + int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; return (FX_BIDICLASS_R == iBidiCls || FX_BIDICLASS_AL == iBidiCls); } FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical) diff --git a/core/src/fxcrt/fx_xml_composer.cpp b/core/src/fxcrt/fx_xml_composer.cpp index 97c5dfd130..7858290f9a 100644 --- a/core/src/fxcrt/fx_xml_composer.cpp +++ b/core/src/fxcrt/fx_xml_composer.cpp @@ -11,7 +11,7 @@ void FX_XML_SplitQualifiedName(FX_BSTR bsFullName, CFX_ByteStringC &bsSpace, CFX if (bsFullName.IsEmpty()) { return; } - FX_INT32 iStart = 0; + int32_t iStart = 0; for (; iStart < bsFullName.GetLength(); iStart ++) { if (bsFullName.GetAt(iStart) == ':') { break; diff --git a/core/src/fxcrt/fx_xml_parser.cpp b/core/src/fxcrt/fx_xml_parser.cpp index 8049a5587e..040fefab63 100644 --- a/core/src/fxcrt/fx_xml_parser.cpp +++ b/core/src/fxcrt/fx_xml_parser.cpp @@ -70,7 +70,7 @@ FX_BOOL CXML_Parser::IsEOF() #define FXCRTM_XML_CHARTYPE_HexLowerLetter 0x40 #define FXCRTM_XML_CHARTYPE_HexUpperLetter 0x60 #define FXCRTM_XML_CHARTYPE_HexChar 0x60 -FX_BYTE g_FXCRT_XML_ByteTypes[256] = { +uint8_t g_FXCRT_XML_ByteTypes[256] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, @@ -88,27 +88,27 @@ FX_BYTE g_FXCRT_XML_ByteTypes[256] = { 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x01, 0x01, }; -FX_BOOL g_FXCRT_XML_IsWhiteSpace(FX_BYTE ch) +FX_BOOL g_FXCRT_XML_IsWhiteSpace(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_SpaceChar) != 0; } -FX_BOOL g_FXCRT_XML_IsLetter(FX_BYTE ch) +FX_BOOL g_FXCRT_XML_IsLetter(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_Letter) != 0; } -FX_BOOL g_FXCRT_XML_IsDigital(FX_BYTE ch) +FX_BOOL g_FXCRT_XML_IsDigital(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_Digital) != 0; } -FX_BOOL g_FXCRT_XML_IsNameIntro(FX_BYTE ch) +FX_BOOL g_FXCRT_XML_IsNameIntro(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_NameIntro) != 0; } -FX_BOOL g_FXCRT_XML_IsNameChar(FX_BYTE ch) +FX_BOOL g_FXCRT_XML_IsNameChar(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_NameChar) != 0; } -FX_BOOL g_FXCRT_XML_IsHexChar(FX_BYTE ch) +FX_BOOL g_FXCRT_XML_IsHexChar(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_HexChar) != 0; } @@ -135,7 +135,7 @@ void CXML_Parser::GetName(CFX_ByteString &space, CFX_ByteString &name) return; } CFX_ByteTextBuf buf; - FX_BYTE ch; + uint8_t ch; do { while (m_dwIndex < m_dwBufferSize) { ch = m_pBuffer[m_dwIndex]; @@ -162,7 +162,7 @@ void CXML_Parser::SkipLiterals(FX_BSTR str) if (IsEOF()) { return; } - FX_INT32 i = 0, iLen = str.GetLength(); + int32_t i = 0, iLen = str.GetLength(); do { while (m_dwIndex < m_dwBufferSize) { if (str.GetAt(i) != m_pBuffer[m_dwIndex ++]) { @@ -194,8 +194,8 @@ FX_DWORD CXML_Parser::GetCharRef() if (IsEOF()) { return 0; } - FX_BYTE ch; - FX_INT32 iState = 0; + uint8_t ch; + int32_t iState = 0; CFX_ByteTextBuf buf; FX_DWORD code = 0; do { @@ -252,7 +252,7 @@ FX_DWORD CXML_Parser::GetCharRef() iState = 10; break; } - FX_BYTE nHex = g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_HexChar; + uint8_t nHex = g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_HexChar; if (nHex) { if (nHex == FXCRTM_XML_CHARTYPE_HexDigital) { code = (code << 4) + ch - '0'; @@ -282,7 +282,7 @@ void CXML_Parser::GetAttrValue(CFX_WideString &value) return; } CFX_UTF8Decoder decoder; - FX_BYTE mark = 0, ch = 0; + uint8_t mark = 0, ch = 0; do { while (m_dwIndex < m_dwBufferSize) { ch = m_pBuffer[m_dwIndex]; @@ -323,8 +323,8 @@ void CXML_Parser::GetTagName(CFX_ByteString &space, CFX_ByteString &name, FX_BOO return; } bEndTag = FALSE; - FX_BYTE ch; - FX_INT32 iState = bStartTag ? 1 : 0; + uint8_t ch; + int32_t iState = bStartTag ? 1 : 0; do { while (m_dwIndex < m_dwBufferSize) { ch = m_pBuffer[m_dwIndex]; @@ -422,7 +422,7 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, FX_BOOL bStartTag if (IsEOF()) { return pElement; } - FX_BYTE ch = m_pBuffer[m_dwIndex ++]; + uint8_t ch = m_pBuffer[m_dwIndex ++]; if (ch == '/') { m_dwIndex ++; m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex; @@ -440,7 +440,7 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, FX_BOOL bStartTag CFX_UTF8Decoder decoder; CFX_WideTextBuf content; FX_BOOL bCDATA = FALSE; - FX_INT32 iState = 0; + int32_t iState = 0; do { while (m_dwIndex < m_dwBufferSize) { ch = m_pBuffer[m_dwIndex ++]; @@ -604,7 +604,7 @@ void CXML_Element::Empty() void CXML_Element::RemoveChildren() { for (int i = 0; i < m_Children.GetSize(); i += 2) { - ChildType type = (ChildType)(FX_UINTPTR)m_Children.GetAt(i); + ChildType type = (ChildType)(uintptr_t)m_Children.GetAt(i); if (type == Content) { CXML_Content* content = (CXML_Content*)m_Children.GetAt(i + 1); delete content; @@ -726,13 +726,13 @@ CXML_Element::ChildType CXML_Element::GetChildType(FX_DWORD index) const if (index >= (FX_DWORD)m_Children.GetSize()) { return Invalid; } - return (ChildType)(FX_UINTPTR)m_Children.GetAt(index); + return (ChildType)(uintptr_t)m_Children.GetAt(index); } CFX_WideString CXML_Element::GetContent(FX_DWORD index) const { index <<= 1; if (index >= (FX_DWORD)m_Children.GetSize() || - (ChildType)(FX_UINTPTR)m_Children.GetAt(index) != Content) { + (ChildType)(uintptr_t)m_Children.GetAt(index) != Content) { return CFX_WideString(); } CXML_Content* pContent = (CXML_Content*)m_Children.GetAt(index + 1); @@ -745,7 +745,7 @@ CXML_Element* CXML_Element::GetElement(FX_DWORD index) const { index <<= 1; if (index >= (FX_DWORD)m_Children.GetSize() || - (ChildType)(FX_UINTPTR)m_Children.GetAt(index) != Element) { + (ChildType)(uintptr_t)m_Children.GetAt(index) != Element) { return NULL; } return (CXML_Element*)m_Children.GetAt(index + 1); @@ -754,7 +754,7 @@ FX_DWORD CXML_Element::CountElements(FX_BSTR space, FX_BSTR tag) const { int count = 0; for (int i = 0; i < m_Children.GetSize(); i += 2) { - ChildType type = (ChildType)(FX_UINTPTR)m_Children.GetAt(i); + ChildType type = (ChildType)(uintptr_t)m_Children.GetAt(i); if (type != Element) { continue; } @@ -771,7 +771,7 @@ CXML_Element* CXML_Element::GetElement(FX_BSTR space, FX_BSTR tag, int index) co return NULL; } for (int i = 0; i < m_Children.GetSize(); i += 2) { - ChildType type = (ChildType)(FX_UINTPTR)m_Children.GetAt(i); + ChildType type = (ChildType)(uintptr_t)m_Children.GetAt(i); if (type != Element) { continue; } @@ -788,7 +788,7 @@ CXML_Element* CXML_Element::GetElement(FX_BSTR space, FX_BSTR tag, int index) co FX_DWORD CXML_Element::FindElement(CXML_Element *pChild) const { for (int i = 0; i < m_Children.GetSize(); i += 2) { - if ((ChildType)(FX_UINTPTR)m_Children.GetAt(i) == Element && + if ((ChildType)(uintptr_t)m_Children.GetAt(i) == Element && (CXML_Element*)m_Children.GetAt(i + 1) == pChild) { return (FX_DWORD)(i >> 1); } diff --git a/core/src/fxcrt/fxcrt_platforms.cpp b/core/src/fxcrt/fxcrt_platforms.cpp index 0781ba436c..74affbe4b9 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(FX_BYTE, 32768); + FX_LPBYTE 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 5bc2dd44d2..701c910551 100644 --- a/core/src/fxcrt/fxcrt_posix.cpp +++ b/core/src/fxcrt/fxcrt_posix.cpp @@ -11,7 +11,7 @@ IFXCRT_FileAccess* FXCRT_FileAccess_Create() { return FX_NEW CFXCRT_FileAccess_Posix; } -void FXCRT_Posix_GetFileMode(FX_DWORD dwModes, FX_INT32 &nFlags, FX_INT32 &nMasks) +void FXCRT_Posix_GetFileMode(FX_DWORD dwModes, int32_t &nFlags, int32_t &nMasks) { nFlags = O_BINARY | O_LARGEFILE; if (dwModes & FX_FILEMODE_ReadOnly) { @@ -38,7 +38,7 @@ FX_BOOL CFXCRT_FileAccess_Posix::Open(FX_BSTR fileName, FX_DWORD dwMode) if (m_nFD > -1) { return FALSE; } - FX_INT32 nFlags, nMasks; + int32_t nFlags, nMasks; FXCRT_Posix_GetFileMode(dwMode, nFlags, nMasks); m_nFD = open(fileName.GetCStr(), nFlags, nMasks); return m_nFD > -1; @@ -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(FX_BYTE, 32768); + FX_LPBYTE 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_posix.h b/core/src/fxcrt/fxcrt_posix.h index 8c716cd6d6..0b4509ec73 100644 --- a/core/src/fxcrt/fxcrt_posix.h +++ b/core/src/fxcrt/fxcrt_posix.h @@ -29,7 +29,7 @@ public: virtual FX_BOOL Flush(); virtual FX_BOOL Truncate(FX_FILESIZE szFile); protected: - FX_INT32 m_nFD; + int32_t m_nFD; }; #endif diff --git a/core/src/fxcrt/xml_int.h b/core/src/fxcrt/xml_int.h index 7cfeec95f7..4155a39ffa 100644 --- a/core/src/fxcrt/xml_int.h +++ b/core/src/fxcrt/xml_int.h @@ -107,7 +107,7 @@ public: } m_dwSize = (size_t)FX_MIN(FX_XMLDATASTREAM_BufferSize, nLength - m_nStart); if (!m_pBuffer) { - m_pBuffer = FX_Alloc(FX_BYTE, m_dwSize); + m_pBuffer = FX_Alloc(uint8_t, m_dwSize); } return m_pFileRead->ReadBlock(m_pBuffer, m_nStart, m_dwSize); } diff --git a/core/src/fxge/agg/agg23/fx_agg_driver.cpp b/core/src/fxge/agg/agg23/fx_agg_driver.cpp index 5944332fd8..978756cd64 100644 --- a/core/src/fxge/agg/agg23/fx_agg_driver.cpp +++ b/core/src/fxge/agg/agg23/fx_agg_driver.cpp @@ -411,7 +411,7 @@ public: } else { src_alpha = m_Alpha; } - FX_BYTE dest_alpha = ori_scan[3] + src_alpha - ori_scan[3] * src_alpha / 255; + uint8_t dest_alpha = ori_scan[3] + src_alpha - ori_scan[3] * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (m_bFullCover) { @@ -485,7 +485,7 @@ public: dest_scan += 2; continue; } - FX_BYTE cover = cover_scan[col]; + uint8_t cover = cover_scan[col]; dest_scan[3] = FXDIB_ALPHA_MERGE(dest_scan[3], src_alpha, cover); *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, cover); dest_scan ++; @@ -544,7 +544,7 @@ public: } else { int index = 0; if (m_pDevice->GetPalette() == NULL) { - index = ((FX_BYTE)m_Color == 0xff) ? 1 : 0; + index = ((uint8_t)m_Color == 0xff) ? 1 : 0; } else { for (int i = 0; i < 2; i ++) if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) { @@ -582,7 +582,7 @@ public: dest_scan += col_start / 8; int index = 0; if (m_pDevice->GetPalette() == NULL) { - index = ((FX_BYTE)m_Color == 0xff) ? 1 : 0; + index = ((uint8_t)m_Color == 0xff) ? 1 : 0; } else { for (int i = 0; i < 2; i ++) if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) { @@ -637,7 +637,7 @@ public: *dest_scan = m_Gray; *dest_extra_alpha_scan = m_Alpha; } else { - FX_BYTE dest_alpha = (*dest_extra_alpha_scan) + src_alpha - + uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha - (*dest_extra_alpha_scan) * src_alpha / 255; *dest_extra_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; @@ -696,7 +696,7 @@ public: if (src_alpha == 255) { *(FX_DWORD*)dest_scan = m_Color; } else { - FX_BYTE dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255; + uint8_t dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio); @@ -739,7 +739,7 @@ public: dest_scan += 2; continue; } - FX_BYTE dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255; + uint8_t dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio); @@ -812,13 +812,13 @@ public: } if (src_alpha) { if (src_alpha == 255) { - *dest_scan++ = (FX_BYTE)m_Blue; - *dest_scan++ = (FX_BYTE)m_Green; - *dest_scan++ = (FX_BYTE)m_Red; - *dest_extra_alpha_scan++ = (FX_BYTE)m_Alpha; + *dest_scan++ = (uint8_t)m_Blue; + *dest_scan++ = (uint8_t)m_Green; + *dest_scan++ = (uint8_t)m_Red; + *dest_extra_alpha_scan++ = (uint8_t)m_Alpha; continue; } else { - FX_BYTE dest_alpha = (*dest_extra_alpha_scan) + src_alpha - + uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha - (*dest_extra_alpha_scan) * src_alpha / 255; *dest_extra_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; @@ -902,9 +902,9 @@ public: if (src_alpha) { if (src_alpha == 255) { *(FX_CMYK*)dest_scan = m_Color; - *dest_extra_alpha_scan = (FX_BYTE)m_Alpha; + *dest_extra_alpha_scan = (uint8_t)m_Alpha; } else { - FX_BYTE dest_alpha = (*dest_extra_alpha_scan) + src_alpha - + uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha - (*dest_extra_alpha_scan) * src_alpha / 255; *dest_extra_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; @@ -1038,13 +1038,13 @@ public: m_Gray = 255; } else { if (pIccTransform) { - FX_BYTE gray; + uint8_t gray; color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); pIccModule->TranslateScanline(pIccTransform, &gray, (FX_LPCBYTE)&color, 1); m_Gray = gray; } else { if (bObjectCMYK) { - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), FXSYS_GetYValue(color), FXSYS_GetKValue(color), r, g, b); m_Gray = FXRGB2GRAY(r, g, b); @@ -1089,7 +1089,7 @@ public: } } else { if (bObjectCMYK) { - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), FXSYS_GetYValue(color), FXSYS_GetKValue(color), r, g, b); m_Color = FXARGB_MAKE(m_Alpha, r, g, b); @@ -1201,7 +1201,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 = (FX_BYTE*)pBitmap->GetBuffer() + y * pBitmap->GetPitch() + x * pBitmap->GetBPP() / 8; + FX_LPBYTE pos = (uint8_t*)pBitmap->GetBuffer() + y * pBitmap->GetPitch() + x * pBitmap->GetBPP() / 8; if (pBitmap->GetFormat() == FXDIB_Argb) { FXARGB_SETRGBORDERDIB(pos, ArgbGamma(argb)); } else { @@ -1224,7 +1224,7 @@ void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap, int left, int top, int wid int Bpp = pBitmap->GetBPP() / 8; FX_BOOL bAlpha = pBitmap->HasAlpha(); int dib_argb = FXARGB_TOBGRORDERDIB(argb); - FX_BYTE* pBuffer = pBitmap->GetBuffer(); + 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; @@ -1250,13 +1250,13 @@ void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap, int left, int top, int wid FX_LPBYTE dest_scan = pBuffer + row * pBitmap->GetPitch() + rect.left * Bpp; if (bAlpha) { for (int col = 0; col < width; col ++) { - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); dest_scan += 4; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); @@ -1295,7 +1295,7 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t FXDIB_Format dest_format = pBitmap->GetFormat(); FXDIB_Format src_format = pSrcBitmap->GetFormat(); int pitch = pBitmap->GetPitch(); - FX_BYTE* buffer = pBitmap->GetBuffer(); + 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; @@ -1322,7 +1322,7 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t if (src_format == FXDIB_Rgb32) { for (int row = 0; row < height; row ++) { FX_LPBYTE dest_scan = dest_buf + row * pitch; - FX_LPBYTE src_scan = (FX_BYTE*)pSrcBitmap->GetScanline(src_top + row) + src_left * 4; + FX_LPBYTE 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]; @@ -1336,8 +1336,8 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t } else if (dest_format == FXDIB_Argb || dest_format == FXDIB_Rgb32) { if (src_format == FXDIB_Rgb) { for (int row = 0; row < height; row ++) { - FX_BYTE* dest_scan = (FX_BYTE*)(dest_buf + row * pitch); - FX_LPBYTE src_scan = (FX_BYTE*)pSrcBitmap->GetScanline(src_top + row) + src_left * 3; + uint8_t* dest_scan = (uint8_t*)(dest_buf + row * pitch); + FX_LPBYTE 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]))); @@ -1368,9 +1368,9 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t ASSERT(FALSE); } } -FX_ARGB _DefaultCMYK2ARGB(FX_CMYK cmyk, FX_BYTE alpha) +FX_ARGB _DefaultCMYK2ARGB(FX_CMYK cmyk, uint8_t alpha) { - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk), FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), r, g, b); return ArgbEncode(alpha, r, g, b); diff --git a/core/src/fxge/android/fpf_skiafont.cpp b/core/src/fxge/android/fpf_skiafont.cpp index 97eeb2f683..290d989851 100644 --- a/core/src/fxge/android/fpf_skiafont.cpp +++ b/core/src/fxge/android/fpf_skiafont.cpp @@ -53,7 +53,7 @@ CFX_WideString CFPF_SkiaFont::GetPsName() } return CFX_WideString::FromLocal(FXFT_Get_Postscript_Name(m_Face)); } -FX_INT32 CFPF_SkiaFont::GetGlyphIndex(FX_WCHAR wUnicode) +int32_t CFPF_SkiaFont::GetGlyphIndex(FX_WCHAR wUnicode) { if (!m_Face) { return wUnicode; @@ -63,7 +63,7 @@ FX_INT32 CFPF_SkiaFont::GetGlyphIndex(FX_WCHAR wUnicode) } return FXFT_Get_Char_Index(m_Face, wUnicode); } -FX_INT32 CFPF_SkiaFont::GetGlyphWidth(FX_INT32 iGlyphIndex) +int32_t CFPF_SkiaFont::GetGlyphWidth(int32_t iGlyphIndex) { if (!m_Face) { return 0; @@ -73,21 +73,21 @@ FX_INT32 CFPF_SkiaFont::GetGlyphWidth(FX_INT32 iGlyphIndex) } return FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Glyph_HoriAdvance(m_Face)); } -FX_INT32 CFPF_SkiaFont::GetAscent() const +int32_t CFPF_SkiaFont::GetAscent() const { if (!m_Face) { return 0; } return FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Face_Ascender(m_Face)); } -FX_INT32 CFPF_SkiaFont::GetDescent() const +int32_t CFPF_SkiaFont::GetDescent() const { if (!m_Face) { return 0; } return FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Face_Descender(m_Face)); } -FX_BOOL CFPF_SkiaFont::GetGlyphBBox(FX_INT32 iGlyphIndex, FX_RECT &rtBBox) +FX_BOOL CFPF_SkiaFont::GetGlyphBBox(int32_t iGlyphIndex, FX_RECT &rtBBox) { if (!m_Face) { return FALSE; @@ -107,8 +107,8 @@ FX_BOOL CFPF_SkiaFont::GetGlyphBBox(FX_INT32 iGlyphIndex, FX_RECT &rtBBox) } FXFT_BBox cbox; FXFT_Glyph_Get_CBox(glyph, FXFT_GLYPH_BBOX_PIXELS, &cbox); - FX_INT32 x_ppem = m_Face->size->metrics.x_ppem; - FX_INT32 y_ppem = m_Face->size->metrics.y_ppem; + int32_t x_ppem = m_Face->size->metrics.x_ppem; + int32_t y_ppem = m_Face->size->metrics.y_ppem; rtBBox.left = FPF_EM_ADJUST(x_ppem, cbox.xMin); rtBBox.right = FPF_EM_ADJUST(x_ppem, cbox.xMax); rtBBox.top = FPF_EM_ADJUST(y_ppem, cbox.yMax); @@ -138,14 +138,14 @@ FX_BOOL CFPF_SkiaFont::GetBBox(FX_RECT &rtBBox) rtBBox.bottom = FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Face_yMax(m_Face)); return TRUE; } -FX_INT32 CFPF_SkiaFont::GetHeight() const +int32_t CFPF_SkiaFont::GetHeight() const { if (!m_Face) { return 0; } return FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Face_Height(m_Face)); } -FX_INT32 CFPF_SkiaFont::GetItalicAngle() const +int32_t CFPF_SkiaFont::GetItalicAngle() const { if (!m_Face) { return 0; @@ -166,7 +166,7 @@ FX_DWORD CFPF_SkiaFont::GetFontData(FX_DWORD dwTable, FX_LPBYTE pBuffer, FX_DWOR } return dwSize; } -FX_BOOL CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, FX_BSTR bsFamily, FX_DWORD dwStyle, FX_BYTE uCharset) +FX_BOOL CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, FX_BSTR bsFamily, FX_DWORD dwStyle, uint8_t uCharset) { if (!pFontMgr || !pFontDes) { return FALSE; diff --git a/core/src/fxge/android/fpf_skiafont.h b/core/src/fxge/android/fpf_skiafont.h index 135c830c95..72b569fe2e 100644 --- a/core/src/fxge/android/fpf_skiafont.h +++ b/core/src/fxge/android/fpf_skiafont.h @@ -28,30 +28,30 @@ public: { return m_dwStyle; } - virtual FX_BYTE GetCharset() const + virtual uint8_t GetCharset() const { return m_uCharset; } - virtual FX_INT32 GetGlyphIndex(FX_WCHAR wUnicode); - virtual FX_INT32 GetGlyphWidth(FX_INT32 iGlyphIndex); + virtual int32_t GetGlyphIndex(FX_WCHAR wUnicode); + virtual int32_t GetGlyphWidth(int32_t iGlyphIndex); - virtual FX_INT32 GetAscent() const; - virtual FX_INT32 GetDescent() const; + virtual int32_t GetAscent() const; + virtual int32_t GetDescent() const; - virtual FX_BOOL GetGlyphBBox(FX_INT32 iGlyphIndex, FX_RECT &rtBBox); + virtual FX_BOOL GetGlyphBBox(int32_t iGlyphIndex, FX_RECT &rtBBox); virtual FX_BOOL GetBBox(FX_RECT &rtBBox); - virtual FX_INT32 GetHeight() const; - virtual FX_INT32 GetItalicAngle() const; + virtual int32_t GetHeight() const; + virtual int32_t GetItalicAngle() const; virtual FX_DWORD GetFontData(FX_DWORD dwTable, FX_LPBYTE pBuffer, FX_DWORD dwSize); - FX_BOOL InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, FX_BSTR bsFamily, FX_DWORD dwStyle, FX_BYTE uCharset); + FX_BOOL InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, FX_BSTR bsFamily, FX_DWORD dwStyle, uint8_t uCharset); protected: CFPF_SkiaFontMgr *m_pFontMgr; CFPF_SkiaFontDescriptor *m_pFontDes; FXFT_Face m_Face; FX_DWORD m_dwStyle; - FX_BYTE m_uCharset; + uint8_t m_uCharset; FX_DWORD m_dwRefCount; }; #endif diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp index a9bef8a2b8..6b27f073e5 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.cpp +++ b/core/src/fxge/android/fpf_skiafontmgr.cpp @@ -64,10 +64,10 @@ static const FPF_SKIAFONTMAP g_SkiaFontmap[] = { }; FX_DWORD FPF_SkiaGetSubstFont(FX_DWORD dwHash) { - FX_INT32 iStart = 0; - FX_INT32 iEnd = sizeof(g_SkiaFontmap) / sizeof(FPF_SKIAFONTMAP); + int32_t iStart = 0; + int32_t iEnd = sizeof(g_SkiaFontmap) / sizeof(FPF_SKIAFONTMAP); while (iStart <= iEnd) { - FX_INT32 iMid = (iStart + iEnd) / 2; + int32_t iMid = (iStart + iEnd) / 2; FPF_LPCSKIAFONTMAP pItem = &g_SkiaFontmap[iMid]; if (dwHash < pItem->dwFamily) { iEnd = iMid - 1; @@ -88,10 +88,10 @@ static const FPF_SKIAFONTMAP g_SkiaSansFontMap[] = { }; FX_DWORD FPF_SkiaGetSansFont(FX_DWORD dwHash) { - FX_INT32 iStart = 0; - FX_INT32 iEnd = sizeof(g_SkiaSansFontMap) / sizeof(FPF_SKIAFONTMAP); + int32_t iStart = 0; + int32_t iEnd = sizeof(g_SkiaSansFontMap) / sizeof(FPF_SKIAFONTMAP); while (iStart <= iEnd) { - FX_INT32 iMid = (iStart + iEnd) / 2; + int32_t iMid = (iStart + iEnd) / 2; FPF_LPCSKIAFONTMAP pItem = &g_SkiaSansFontMap[iMid]; if (dwHash < pItem->dwFamily) { iEnd = iMid - 1; @@ -103,7 +103,7 @@ FX_DWORD FPF_SkiaGetSansFont(FX_DWORD dwHash) } return 0; } -static FX_UINT32 FPF_GetHashCode_StringA(FX_LPCSTR pStr, FX_INT32 iLength, FX_BOOL bIgnoreCase = FALSE) +static uint32_t FPF_GetHashCode_StringA(FX_LPCSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE) { if (!pStr) { return 0; @@ -112,7 +112,7 @@ static FX_UINT32 FPF_GetHashCode_StringA(FX_LPCSTR pStr, FX_INT32 iLength, FX_BO iLength = FXSYS_strlen(pStr); } FX_LPCSTR pStrEnd = pStr + iLength; - FX_UINT32 uHashCode = 0; + uint32_t uHashCode = 0; if (bIgnoreCase) { while (pStr < pStrEnd) { uHashCode = 31 * uHashCode + FXSYS_tolower(*pStr++); @@ -145,7 +145,7 @@ enum FPF_SKIACHARSET { FPF_SKIACHARSET_PC = 1 << 17, FPF_SKIACHARSET_OEM = 1 << 18, }; -static FX_DWORD FPF_SkiaGetCharset(FX_BYTE uCharset) +static FX_DWORD FPF_SkiaGetCharset(uint8_t uCharset) { switch (uCharset) { case FXFONT_ANSI_CHARSET: @@ -184,9 +184,9 @@ static FX_DWORD FPF_SkiaGetCharset(FX_BYTE uCharset) static FX_DWORD FPF_SKIANormalizeFontName(FX_BSTR bsfamily) { FX_DWORD dwHash = 0; - FX_INT32 iLength = bsfamily.GetLength(); + int32_t iLength = bsfamily.GetLength(); FX_LPCSTR pBuffer = bsfamily.GetCStr(); - for (FX_INT32 i = 0; i < iLength; i++) { + for (int32_t i = 0; i < iLength; i++) { FX_CHAR ch = pBuffer[i]; if (ch == ' ' || ch == '-' || ch == ',') { continue; @@ -195,7 +195,7 @@ static FX_DWORD FPF_SKIANormalizeFontName(FX_BSTR bsfamily) } return dwHash; } -static FX_DWORD FPF_SKIAGetFamilyHash(FX_BSTR bsFamily, FX_DWORD dwStyle, FX_BYTE uCharset) +static FX_DWORD FPF_SKIAGetFamilyHash(FX_BSTR bsFamily, FX_DWORD dwStyle, uint8_t uCharset) { CFX_ByteString bsFont(bsFamily); if (dwStyle & FXFONT_BOLD) { @@ -210,7 +210,7 @@ static FX_DWORD FPF_SKIAGetFamilyHash(FX_BSTR bsFamily, FX_DWORD dwStyle, FX_BYT bsFont += uCharset; return FPF_GetHashCode_StringA(bsFont.c_str(), bsFont.GetLength(), TRUE); } -static FX_BOOL FPF_SkiaIsCJK(FX_BYTE uCharset) +static FX_BOOL FPF_SkiaIsCJK(uint8_t uCharset) { return (uCharset == FXFONT_GB2312_CHARSET) || (uCharset == FXFONT_CHINESEBIG5_CHARSET) || (uCharset == FXFONT_HANGEUL_CHARSET) || (uCharset == FXFONT_SHIFTJIS_CHARSET); @@ -243,7 +243,7 @@ CFPF_SkiaFontMgr::~CFPF_SkiaFontMgr() } } m_FamilyFonts.RemoveAll(); - for (FX_INT32 i = m_FontFaces.GetUpperBound(); i >= 0; i--) { + for (int32_t i = m_FontFaces.GetUpperBound(); i >= 0; i--) { CFPF_SkiaFontDescriptor *pFont = (CFPF_SkiaFontDescriptor*)m_FontFaces.ElementAt(i); if (pFont) { delete pFont; @@ -279,11 +279,11 @@ void CFPF_SkiaFontMgr::LoadPrivateFont(FX_BSTR bsFileName) void CFPF_SkiaFontMgr::LoadPrivateFont(FX_LPVOID pBuffer, size_t szBuffer) { } -IFPF_Font* CFPF_SkiaFontMgr::CreateFont(FX_BSTR bsFamilyname, FX_BYTE uCharset, FX_DWORD dwStyle, FX_DWORD dwMatch) +IFPF_Font* CFPF_SkiaFontMgr::CreateFont(FX_BSTR bsFamilyname, uint8_t uCharset, FX_DWORD dwStyle, FX_DWORD dwMatch) { FX_DWORD dwHash = FPF_SKIAGetFamilyHash(bsFamilyname, dwStyle, uCharset); IFPF_Font *pFont = NULL; - if (m_FamilyFonts.Lookup((void*)(FX_UINTPTR)dwHash, (void*&)pFont)) { + if (m_FamilyFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) { if (pFont) { return pFont->Retain(); } @@ -297,16 +297,16 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(FX_BSTR bsFamilyname, FX_BYTE uCharset, } else if (uCharset == FXFONT_ANSI_CHARSET && (dwMatch & FPF_MATCHFONT_REPLACEANSI)) { uCharset = FXFONT_DEFAULT_CHARSET; } - FX_INT32 nExpectVal = FPF_SKIAMATCHWEIGHT_NAME1 + FPF_SKIAMATCHWEIGHT_1 * 3 + FPF_SKIAMATCHWEIGHT_2 * 2; - FX_INT32 nItem = -1; - FX_INT32 nMax = -1; - FX_INT32 nGlyphNum = 0; - for (FX_INT32 i = m_FontFaces.GetUpperBound(); i >= 0; i--) { + int32_t nExpectVal = FPF_SKIAMATCHWEIGHT_NAME1 + FPF_SKIAMATCHWEIGHT_1 * 3 + FPF_SKIAMATCHWEIGHT_2 * 2; + int32_t nItem = -1; + int32_t nMax = -1; + int32_t nGlyphNum = 0; + for (int32_t i = m_FontFaces.GetUpperBound(); i >= 0; i--) { CFPF_SkiaPathFont *pFontDes = (CFPF_SkiaPathFont*)m_FontFaces.ElementAt(i); if(!(pFontDes->m_dwCharsets & FPF_SkiaGetCharset(uCharset))) { continue; } - FX_INT32 nFind = 0; + int32_t nFind = 0; FX_DWORD dwSysFontName = FPF_SKIANormalizeFontName(pFontDes->m_pFamily); if (dwFaceName == dwSysFontName) { nFind += FPF_SKIAMATCHWEIGHT_NAME1; @@ -352,20 +352,27 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(FX_BSTR bsFamilyname, FX_BYTE uCharset, } if (nItem > -1) { CFPF_SkiaFontDescriptor *pFontDes = (CFPF_SkiaFontDescriptor*)m_FontFaces.ElementAt(nItem); +<<<<<<< HEAD CFPF_SkiaFont *pFont = FX_NEW CFPF_SkiaFont; if (pFont) { if (pFont->InitFont(this, pFontDes, bsFamilyname, dwStyle, uCharset)) { - m_FamilyFonts.SetAt((void*)(FX_UINTPTR)dwHash, (void*)pFont); + m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); return pFont->Retain(); } pFont->Release(); pFont = NULL; +======= + CFPF_SkiaFont *pFont = new CFPF_SkiaFont; + if (pFont->InitFont(this, pFontDes, bsFamilyname, dwStyle, uCharset)) { + m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); + return pFont->Retain(); +>>>>>>> bb17868... Use stdint.h types throughout PDFium. } return pFont; } return NULL; } -FXFT_Face CFPF_SkiaFontMgr::GetFontFace(IFX_FileRead *pFileRead, FX_INT32 iFaceIndex) +FXFT_Face CFPF_SkiaFontMgr::GetFontFace(IFX_FileRead *pFileRead, int32_t iFaceIndex) { if (!pFileRead) { return NULL; @@ -392,7 +399,7 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(IFX_FileRead *pFileRead, FX_INT32 iFaceI FXFT_Set_Pixel_Sizes(face, 0, 64); return face; } -FXFT_Face CFPF_SkiaFontMgr::GetFontFace(FX_BSTR bsFile, FX_INT32 iFaceIndex ) +FXFT_Face CFPF_SkiaFontMgr::GetFontFace(FX_BSTR bsFile, int32_t iFaceIndex ) { if (bsFile.IsEmpty()) { return NULL; @@ -410,7 +417,7 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(FX_BSTR bsFile, FX_INT32 iFaceIndex ) FXFT_Set_Pixel_Sizes(face, 0, 64); return face; } -FXFT_Face CFPF_SkiaFontMgr::GetFontFace(FX_LPCBYTE pBuffer, size_t szBuffer, FX_INT32 iFaceIndex ) +FXFT_Face CFPF_SkiaFontMgr::GetFontFace(FX_LPCBYTE pBuffer, size_t szBuffer, int32_t iFaceIndex ) { if (!pBuffer || szBuffer < 1) { return NULL; @@ -512,7 +519,7 @@ static FX_DWORD FPF_SkiaGetFaceCharset(TT_OS2 *pOS2) { FX_DWORD dwCharset = 0; if (pOS2) { - for (FX_INT32 i = 0; i < 32; i++) { + for (int32_t i = 0; i < 32; i++) { if (pOS2->ulCodePageRange1 & (1 << i)) { dwCharset |= g_FPFSkiaFontCharsets[i]; } @@ -542,7 +549,7 @@ void CFPF_SkiaFontMgr::ReportFace(FXFT_Face face, CFPF_SkiaFontDescriptor *pFont pFontDesc->m_dwStyle |= FXFONT_SYMBOLIC; } if (pOS2->panose[0] == 2) { - FX_BYTE uSerif = pOS2->panose[1]; + uint8_t uSerif = pOS2->panose[1]; if ((uSerif > 1 && uSerif < 10) || uSerif > 13) { pFontDesc->m_dwStyle |= FXFONT_SERIF; } diff --git a/core/src/fxge/android/fpf_skiafontmgr.h b/core/src/fxge/android/fpf_skiafontmgr.h index 3c072fa186..44d427f8af 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.h +++ b/core/src/fxge/android/fpf_skiafontmgr.h @@ -22,7 +22,7 @@ public: FX_Free(m_pFamily); } } - virtual FX_INT32 GetType() const + virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Unknown; } @@ -31,16 +31,16 @@ public: if (m_pFamily) { FX_Free(m_pFamily); } - FX_INT32 iSize = FXSYS_strlen(pFamily); + int32_t iSize = FXSYS_strlen(pFamily); m_pFamily = FX_Alloc(FX_CHAR, iSize + 1); FXSYS_memcpy32(m_pFamily, pFamily, iSize * sizeof(FX_CHAR)); m_pFamily[iSize] = 0; } FX_LPSTR m_pFamily; FX_DWORD m_dwStyle; - FX_INT32 m_iFaceIndex; + int32_t m_iFaceIndex; FX_DWORD m_dwCharsets; - FX_INT32 m_iGlyphNum; + int32_t m_iGlyphNum; }; class CFPF_SkiaPathFont : public CFPF_SkiaFontDescriptor { @@ -52,7 +52,7 @@ public: FX_Free(m_pPath); } } - virtual FX_INT32 GetType() const + virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Path; } @@ -61,7 +61,7 @@ public: if (m_pPath) { FX_Free(m_pPath); } - FX_INT32 iSize = FXSYS_strlen(pPath); + int32_t iSize = FXSYS_strlen(pPath); m_pPath = FX_Alloc(FX_CHAR, iSize + 1); FXSYS_memcpy32(m_pPath, pPath, iSize * sizeof(FX_CHAR)); m_pPath[iSize] = 0; @@ -72,7 +72,7 @@ class CFPF_SkiaFileFont : public CFPF_SkiaFontDescriptor { public: CFPF_SkiaFileFont() : m_pFile(NULL) {} - virtual FX_INT32 GetType() const + virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_File; } @@ -82,7 +82,7 @@ class CFPF_SkiaBufferFont : public CFPF_SkiaFontDescriptor { public: CFPF_SkiaBufferFont() : m_pBuffer(NULL), m_szBuffer(0) {} - virtual FX_INT32 GetType() const + virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Buffer; } @@ -100,10 +100,10 @@ public: virtual void LoadPrivateFont(FX_BSTR bsFileName); virtual void LoadPrivateFont(FX_LPVOID pBuffer, size_t szBuffer); - virtual IFPF_Font* CreateFont(FX_BSTR bsFamilyname, FX_BYTE uCharset, FX_DWORD dwStyle, FX_DWORD dwMatch = 0); - FXFT_Face GetFontFace(IFX_FileRead *pFileRead, FX_INT32 iFaceIndex = 0); - FXFT_Face GetFontFace(FX_BSTR bsFile, FX_INT32 iFaceIndex = 0); - FXFT_Face GetFontFace(FX_LPCBYTE pBuffer, size_t szBuffer, FX_INT32 iFaceIndex = 0); + 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); protected: void ScanPath(FX_BSTR path); void ScanFile(FX_BSTR file); diff --git a/core/src/fxge/apple/apple_int.h b/core/src/fxge/apple/apple_int.h index 2466ecbc9a..6cd880603a 100644 --- a/core/src/fxge/apple/apple_int.h +++ b/core/src/fxge/apple/apple_int.h @@ -56,7 +56,7 @@ public: FX_FLOAT fontSize, FX_WORD* glyphIndices, CGPoint* glyphPositions, - FX_INT32 chars, + int32_t chars, FX_ARGB argb, CFX_AffineMatrix* matrix = NULL); void saveGraphicsState(void* graphics); @@ -81,7 +81,7 @@ public: class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver { public: - CFX_QuartzDeviceDriver(CGContextRef context, FX_INT32 deviceClass); + CFX_QuartzDeviceDriver(CGContextRef context, int32_t deviceClass); virtual ~CFX_QuartzDeviceDriver(); virtual int GetDeviceCaps(int caps_id); @@ -176,15 +176,15 @@ protected: CGContextRef _context; CGAffineTransform _foxitDevice2User; CGAffineTransform _user2FoxitDevice; - FX_INT32 m_saveCount; + int32_t m_saveCount; - FX_INT32 _width; - FX_INT32 _height; - FX_INT32 _bitsPerPixel; - FX_INT32 _deviceClass; - FX_INT32 _renderCaps; - FX_INT32 _horzSize; - FX_INT32 _vertSize; + int32_t _width; + int32_t _height; + int32_t _bitsPerPixel; + int32_t _deviceClass; + int32_t _renderCaps; + int32_t _horzSize; + int32_t _vertSize; }; class CFX_FontProvider final : public IFX_FileRead { @@ -239,10 +239,10 @@ private: int _tableCount; int _totalSize; }; -FX_UINT32 FX_GetHashCode( FX_LPCSTR pStr); +uint32_t FX_GetHashCode( FX_LPCSTR pStr); FX_DWORD FX_IOSGetMatchFamilyNameHashcode(FX_LPCSTR pFontName); -FX_UINT32 FX_IOSGetFamilyNamesCount(); -FX_LPCSTR FX_IOSGetFamilyName( FX_UINT32 uIndex); +uint32_t FX_IOSGetFamilyNamesCount(); +FX_LPCSTR FX_IOSGetFamilyName( uint32_t uIndex); #endif #endif // CORE_SRC_FXGE_APPLE_APPLE_INT_H_ diff --git a/core/src/fxge/apple/fx_quartz_device.cpp b/core/src/fxge/apple/fx_quartz_device.cpp index 050d8744bd..fa63d22028 100644 --- a/core/src/fxge/apple/fx_quartz_device.cpp +++ b/core/src/fxge/apple/fx_quartz_device.cpp @@ -81,7 +81,7 @@ FX_BOOL CQuartz2D::drawGraphicsString(void* graphics, FX_FLOAT fontSize, FX_WORD* glyphIndices, CGPoint* glyphPositions, - FX_INT32 charsCount, + int32_t charsCount, FX_ARGB argb, CFX_AffineMatrix* matrix ) { @@ -102,7 +102,7 @@ FX_BOOL CQuartz2D::drawGraphicsString(void* graphics, matrix->f)); CGContextSetTextMatrix(context, m); } - FX_INT32 a, r, g, b; + int32_t a, r, g, b; ArgbDecode(argb, a, r, g, b); CGContextSetRGBFillColor(context, r / 255.f, @@ -166,7 +166,7 @@ static CGContextRef createContextWithBitmap(CFX_DIBitmap* pBitmap) CGColorSpaceRelease(colorSpace); return context; } -CFX_QuartzDeviceDriver::CFX_QuartzDeviceDriver(CGContextRef context, FX_INT32 deviceClass) +CFX_QuartzDeviceDriver::CFX_QuartzDeviceDriver(CGContextRef context, int32_t deviceClass) { m_saveCount = 0; _context = context; @@ -438,7 +438,7 @@ FX_BOOL CFX_QuartzDeviceDriver::FillRect(const FX_RECT* rect, } CGRect rect_fx = CGRectMake(rect->left, rect->top, rect->Width(), rect->Height()); CGRect rect_usr = CGRectApplyAffineTransform(rect_fx, _foxitDevice2User); - FX_INT32 a, r, g, b; + int32_t a, r, g, b; ArgbDecode(fillArgb, a, r, g, b); CGContextSetRGBFillColor(_context, r / 255.f, @@ -470,7 +470,7 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, pt = CGPointApplyAffineTransform(CGPointMake(x2, y2), _foxitDevice2User); x2 = pt.x; y2 = pt.y; - FX_INT32 a, r, g, b; + int32_t a, r, g, b; ArgbDecode(argb, a, r, g, b); CGContextSetRGBStrokeColor(_context, r / 255.f, @@ -496,8 +496,8 @@ FX_BOOL CFX_QuartzDeviceDriver::GetClipBox(FX_RECT* rect) return TRUE; } FX_BOOL CFX_QuartzDeviceDriver::GetDIBits(CFX_DIBitmap* bitmap, - FX_INT32 left, - FX_INT32 top, + int32_t left, + int32_t top, void* pIccTransform, FX_BOOL bDEdge) { @@ -656,9 +656,9 @@ 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); for (int col = 0; col < pBitmap1->GetWidth(); col ++) { - pScanline[0] = (FX_BYTE)(pScanline[0] * pScanline[3] / 255.f + .5f); - pScanline[1] = (FX_BYTE)(pScanline[1] * pScanline[3] / 255.f + .5f); - pScanline[2] = (FX_BYTE)(pScanline[2] * pScanline[3] / 255.f + .5f); + pScanline[0] = (uint8_t)(pScanline[0] * pScanline[3] / 255.f + .5f); + pScanline[1] = (uint8_t)(pScanline[1] * pScanline[3] / 255.f + .5f); + pScanline[2] = (uint8_t)(pScanline[2] * pScanline[3] / 255.f + .5f); pScanline += 4; } } @@ -781,9 +781,9 @@ 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); for (int col = 0; col < pBitmap1->GetWidth(); col ++) { - pScanline[0] = (FX_BYTE)(pScanline[0] * pScanline[3] / 255.f + .5f); - pScanline[1] = (FX_BYTE)(pScanline[1] * pScanline[3] / 255.f + .5f); - pScanline[2] = (FX_BYTE)(pScanline[2] * pScanline[3] / 255.f + .5f); + pScanline[0] = (uint8_t)(pScanline[0] * pScanline[3] / 255.f + .5f); + pScanline[1] = (uint8_t)(pScanline[1] * pScanline[3] / 255.f + .5f); + pScanline[2] = (uint8_t)(pScanline[2] * pScanline[3] / 255.f + .5f); pScanline += 4; } } @@ -844,7 +844,7 @@ FX_BOOL CFX_QuartzDeviceDriver::CG_DrawGlypRun(int nChars CGContextSetTextMatrix(_context, matrix_cg); CGContextSetFont(_context, (CGFontRef)pFont->m_pPlatformFont); CGContextSetFontSize(_context, FXSYS_fabs(font_size)); - FX_INT32 a, r, g, b; + int32_t a, r, g, b; ArgbDecode(argb, a, r, g, b); CGContextSetRGBFillColor(_context, r / 255.f, @@ -897,7 +897,7 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawDeviceText(int nChars, SaveState(); CGContextSetTextDrawingMode(_context, kCGTextFillClip); FX_BOOL ret = FALSE; - FX_INT32 i = 0; + int32_t i = 0; while (i < nChars) { if (pCharPos[i].m_bGlyphAdjust || font_size < 0) { if (i > 0) { @@ -992,7 +992,7 @@ void CFX_QuartzDeviceDriver::setStrokeInfo(const CFX_GraphStateData* graphState, delete[] dashArray; #endif } - FX_INT32 a, r, g, b; + int32_t a, r, g, b; ArgbDecode(argb, a, r, g, b); CGContextSetRGBStrokeColor(_context, r / 255.f, @@ -1002,7 +1002,7 @@ void CFX_QuartzDeviceDriver::setStrokeInfo(const CFX_GraphStateData* graphState, } void CFX_QuartzDeviceDriver::setFillInfo(FX_ARGB argb) { - FX_INT32 a, r, g, b; + int32_t a, r, g, b; ArgbDecode(argb, a, r, g, b); CGContextSetRGBFillColor(_context, r / 255.f, @@ -1012,10 +1012,10 @@ void CFX_QuartzDeviceDriver::setFillInfo(FX_ARGB argb) } void CFX_QuartzDeviceDriver::setPathToContext(const CFX_PathData* pathData) { - FX_INT32 count = pathData->GetPointCount(); + int32_t count = pathData->GetPointCount(); FX_PATHPOINT* points = pathData->GetPoints(); CGContextBeginPath(_context); - for (FX_INT32 i = 0; i < count; i ++) { + for (int32_t i = 0; i < count; i ++) { switch (points[i].m_Flag & FXPT_TYPE) { case FXPT_MOVETO: CGContextMoveToPoint(_context, points[i].m_PointX, points[i].m_PointY); @@ -1090,7 +1090,7 @@ CGContextRef CFX_QuartzDevice::GetContext() { return m_pContext; } -FX_BOOL CFX_QuartzDevice::Attach(CGContextRef context, FX_INT32 nDeviceClass) +FX_BOOL CFX_QuartzDevice::Attach(CGContextRef context, int32_t nDeviceClass) { if (m_pContext) { CGContextRelease(m_pContext); @@ -1118,9 +1118,9 @@ FX_BOOL CFX_QuartzDevice::Attach(CFX_DIBitmap* pBitmap) SetDeviceDriver(pDriver); return TRUE; } -FX_BOOL CFX_QuartzDevice::Create(FX_INT32 width, FX_INT32 height, FXDIB_Format format) +FX_BOOL CFX_QuartzDevice::Create(int32_t width, int32_t height, FXDIB_Format format) { - if ((FX_BYTE)format < 32) { + if ((uint8_t)format < 32) { return FALSE; } CFX_DIBitmap* pBitmap = FX_NEW CFX_DIBitmap; diff --git a/core/src/fxge/dib/fx_dib_composite.cpp b/core/src/fxge/dib/fx_dib_composite.cpp index e385bc9ffe..970325a2d4 100644 --- a/core/src/fxge/dib/fx_dib_composite.cpp +++ b/core/src/fxge/dib/fx_dib_composite.cpp @@ -7,7 +7,7 @@ #include "../../../include/fxge/fx_ge.h" #include "../../../include/fxcodec/fx_codec.h" #include "dib_int.h" -const FX_BYTE g_GammaRamp[256] = { +const uint8_t g_GammaRamp[256] = { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, @@ -25,7 +25,7 @@ const FX_BYTE g_GammaRamp[256] = { 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 229, 231, 233, 235, 237, 239, 242, 244, 246, 248, 250, 253, 255, }; -const FX_BYTE g_GammaInverse[256] = { +const uint8_t g_GammaInverse[256] = { 0, 13, 22, 28, 34, 38, 42, 46, 50, 53, 56, 59, 61, 64, 66, 69, 71, 73, 75, 77, 79, 81, 83, 85, 86, 88, 90, 92, 93, 95, 96, 98, 99, 101, 102, 104, 105, 106, 108, 109, 110, 112, 113, 114, 115, 117, 118, 119, @@ -43,7 +43,7 @@ const FX_BYTE g_GammaInverse[256] = { 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 246, 247, 247, 248, 248, 249, 249, 250, 250, 251, 251, 251, 252, 252, 253, 253, 254, 254, 255, 255, }; -const FX_BYTE _color_sqrt[256] = { +const uint8_t _color_sqrt[256] = { 0x00, 0x03, 0x07, 0x0B, 0x0F, 0x12, 0x16, 0x19, 0x1D, 0x20, 0x23, 0x26, 0x29, 0x2C, 0x2F, 0x32, 0x35, 0x37, 0x3A, 0x3C, 0x3F, 0x41, 0x43, 0x46, 0x48, 0x4A, 0x4C, 0x4E, 0x50, 0x52, 0x54, 0x56, 0x57, 0x59, 0x5B, 0x5C, 0x5E, 0x60, 0x61, 0x63, 0x64, 0x65, 0x67, 0x68, 0x69, 0x6B, 0x6C, 0x6D, @@ -227,7 +227,7 @@ static _RGB _SetSat(_RGB color, int s) } return color; } -void _RGB_Blend(int blend_mode, FX_LPCBYTE src_scan, FX_BYTE* dest_scan, int results[3]) +void _RGB_Blend(int blend_mode, FX_LPCBYTE src_scan, uint8_t* dest_scan, int results[3]) { _RGB src, back, result; src.red = src_scan[2]; @@ -262,7 +262,7 @@ inline void _CompositeRow_Argb2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, in if (clip_scan) { src_alpha = clip_scan[col] * src_alpha / 255; } - FX_BYTE back_alpha = *dest_scan; + uint8_t back_alpha = *dest_scan; if (!back_alpha) { *dest_scan = src_alpha; } else if (src_alpha) { @@ -279,7 +279,7 @@ void _CompositeRow_Rgba2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_alpha_scan, int if (clip_scan) { src_alpha = clip_scan[col] * src_alpha / 255; } - FX_BYTE back_alpha = *dest_scan; + uint8_t back_alpha = *dest_scan; if (!back_alpha) { *dest_scan = src_alpha; } else if (src_alpha) { @@ -312,7 +312,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe int blended_color; if (src_alpha_scan) { for (int col = 0; col < pixel_count; col ++) { - FX_BYTE back_alpha = *dst_alpha_scan; + uint8_t back_alpha = *dst_alpha_scan; if (back_alpha == 0) { int src_alpha = *src_alpha_scan++; if (clip_scan) { @@ -331,7 +331,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe src_scan += 3; continue; } - FX_BYTE src_alpha = *src_alpha_scan++; + uint8_t src_alpha = *src_alpha_scan++; if (clip_scan) { src_alpha = clip_scan[col] * src_alpha / 255; } @@ -343,7 +343,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe } *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha); int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan); - FX_BYTE gray; + uint8_t gray; if (pIccTransform) { pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); } else { @@ -360,7 +360,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe } } else for (int col = 0; col < pixel_count; col ++) { - FX_BYTE back_alpha = *dst_alpha_scan; + uint8_t back_alpha = *dst_alpha_scan; if (back_alpha == 0) { int src_alpha = src_scan[3]; if (clip_scan) { @@ -379,7 +379,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe src_scan += 4; continue; } - FX_BYTE src_alpha = src_scan[3]; + uint8_t src_alpha = src_scan[3]; if (clip_scan) { src_alpha = clip_scan[col] * src_alpha / 255; } @@ -391,7 +391,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe } *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha); int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan); - FX_BYTE gray; + uint8_t gray; if (pIccTransform) { pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); } else { @@ -406,7 +406,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe } if (src_alpha_scan) { for (int col = 0; col < pixel_count; col ++) { - FX_BYTE back_alpha = *dst_alpha_scan; + uint8_t back_alpha = *dst_alpha_scan; if (back_alpha == 0) { int src_alpha = *src_alpha_scan++; if (clip_scan) { @@ -425,7 +425,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe src_scan += 3; continue; } - FX_BYTE src_alpha = *src_alpha_scan++; + uint8_t src_alpha = *src_alpha_scan++; if (clip_scan) { src_alpha = clip_scan[col] * src_alpha / 255; } @@ -437,7 +437,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe } *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha); int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan); - FX_BYTE gray; + uint8_t gray; if (pIccTransform) { pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); } else { @@ -450,7 +450,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe } } else for (int col = 0; col < pixel_count; col ++) { - FX_BYTE back_alpha = *dst_alpha_scan; + uint8_t back_alpha = *dst_alpha_scan; if (back_alpha == 0) { int src_alpha = src_scan[3]; if (clip_scan) { @@ -469,7 +469,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe src_scan += 4; continue; } - FX_BYTE src_alpha = src_scan[3]; + uint8_t src_alpha = src_scan[3]; if (clip_scan) { src_alpha = clip_scan[col] * src_alpha / 255; } @@ -481,7 +481,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe } *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha); int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan); - FX_BYTE gray; + uint8_t gray; if (pIccTransform) { pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); } else { @@ -498,7 +498,7 @@ inline void _CompositeRow_Argb2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, in FX_LPCBYTE src_alpha_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = NULL; - FX_BYTE gray; + uint8_t gray; if (pIccTransform) { pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); } @@ -589,7 +589,7 @@ inline void _CompositeRow_Rgb2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int void* pIccTransform) { ICodec_IccModule* pIccModule = NULL; - FX_BYTE gray; + uint8_t gray; if (pIccTransform) { pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); } @@ -665,10 +665,10 @@ void _CompositeRow_Rgb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_B src_scan += src_Bpp; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; - FX_BYTE gray; + uint8_t gray; if (pIccTransform) { pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); } else { @@ -707,10 +707,10 @@ void _CompositeRow_Rgb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_B continue; } int back_alpha = *dest_alpha_scan; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; - FX_BYTE gray; + uint8_t gray; if (pIccTransform) { pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); } else { @@ -728,7 +728,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; if (dest_alpha_scan == NULL) { if (src_alpha_scan == NULL) { - FX_BYTE back_alpha = 0; + uint8_t back_alpha = 0; for (int col = 0; col < pixel_count; col ++) { back_alpha = dest_scan[3]; if (back_alpha == 0) { @@ -742,7 +742,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel src_scan += 4; continue; } - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan == NULL) { src_alpha = src_scan[3]; } else { @@ -753,7 +753,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel src_scan += 4; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { @@ -776,7 +776,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel } } else { for (int col = 0; col < pixel_count; col ++) { - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { if (clip_scan) { int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255; @@ -789,7 +789,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel src_alpha_scan ++; continue; } - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan == NULL) { src_alpha = *src_alpha_scan ++; } else { @@ -800,7 +800,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel src_scan += 3; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { @@ -824,7 +824,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel } else { if (src_alpha_scan) { for (int col = 0; col < pixel_count; col ++) { - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { if (clip_scan) { int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255; @@ -842,7 +842,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel src_alpha_scan ++; continue; } - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan == NULL) { src_alpha = *src_alpha_scan ++; } else { @@ -854,7 +854,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel dest_alpha_scan ++; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { @@ -875,7 +875,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel } } else { for (int col = 0; col < pixel_count; col ++) { - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { if (clip_scan) { int src_alpha = clip_scan[col] * src_scan[3] / 255; @@ -893,7 +893,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel src_scan ++; continue; } - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan == NULL) { src_alpha = src_scan[3]; } else { @@ -905,7 +905,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel dest_alpha_scan ++; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { @@ -936,7 +936,7 @@ void _CompositeRow_Rgb2Argb_Blend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE src_sca int src_gap = src_Bpp - 3; if (dest_alpha_scan == NULL) { for (int col = 0; col < width; col ++) { - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { if (src_Bpp == 4) { FXARGB_SETDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan)); @@ -964,7 +964,7 @@ void _CompositeRow_Rgb2Argb_Blend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE src_sca } } else { for (int col = 0; col < width; col ++) { - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { *dest_scan++ = *src_scan++; *dest_scan++ = *src_scan++; @@ -998,7 +998,7 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE sr if (dest_alpha_scan == NULL) { for (int col = 0; col < width; col ++) { int src_alpha = *clip_scan ++; - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { *dest_scan++ = *src_scan++; *dest_scan++ = *src_scan++; @@ -1012,7 +1012,7 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE sr src_scan += src_Bpp; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { @@ -1033,7 +1033,7 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE sr } else { for (int col = 0; col < width; col ++) { int src_alpha = *clip_scan ++; - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { *dest_scan++ = *src_scan++; *dest_scan++ = *src_scan++; @@ -1048,7 +1048,7 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE sr src_scan += src_Bpp; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { @@ -1088,7 +1088,7 @@ inline void _CompositeRow_Rgb2Argb_NoBlend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE continue; } int back_alpha = dest_scan[3]; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; for (int color = 0; color < 3; color ++) { @@ -1117,7 +1117,7 @@ inline void _CompositeRow_Rgb2Argb_NoBlend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE continue; } int back_alpha = *dest_alpha_scan; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; for (int color = 0; color < 3; color ++) { @@ -1161,7 +1161,7 @@ inline void _CompositeRow_Argb2Rgb_Blend(FX_LPBYTE dest_scan, FX_LPCBYTE src_sca int dest_gap = dest_Bpp - 3; if (src_alpha_scan == NULL) { for (int col = 0; col < width; col ++) { - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan) { src_alpha = src_scan[3] * (*clip_scan++) / 255; } else { @@ -1188,7 +1188,7 @@ inline void _CompositeRow_Argb2Rgb_Blend(FX_LPBYTE dest_scan, FX_LPCBYTE src_sca } } else { for (int col = 0; col < width; col ++) { - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan) { src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255; } else { @@ -1220,7 +1220,7 @@ inline void _CompositeRow_Argb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_s int dest_gap = dest_Bpp - 3; if (src_alpha_scan == NULL) { for (int col = 0; col < width; col ++) { - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan) { src_alpha = src_scan[3] * (*clip_scan++) / 255; } else { @@ -1249,7 +1249,7 @@ inline void _CompositeRow_Argb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_s } } else { for (int col = 0; col < width; col ++) { - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan) { src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255; } else { @@ -1306,7 +1306,7 @@ inline void _CompositeRow_Rgb2Rgb_Blend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE src int dest_gap = dest_Bpp - 3; int src_gap = src_Bpp - 3; for (int col = 0; col < width; col ++) { - FX_BYTE src_alpha = *clip_scan ++; + uint8_t src_alpha = *clip_scan ++; if (src_alpha == 0) { dest_scan += dest_Bpp; src_scan += src_Bpp; @@ -1396,7 +1396,7 @@ void _CompositeRow_Argb2Argb_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < pixel_count; col ++) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1); - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { if (clip_scan) { int src_alpha = clip_scan[col] * src_scan[3] / 255; @@ -1414,7 +1414,7 @@ void _CompositeRow_Argb2Argb_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, src_scan += 4; continue; } - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan == NULL) { src_alpha = src_scan[3]; } else { @@ -1427,7 +1427,7 @@ void _CompositeRow_Argb2Argb_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, dest_alpha_scan ++; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { @@ -1527,7 +1527,7 @@ inline void _CompositeRow_Argb2Rgb_Blend_Transform(FX_LPBYTE dest_scan, FX_LPCBY int dest_gap = dest_Bpp - 3; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1); - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan) { src_alpha = src_scan[3] * (*clip_scan++) / 255; } else { @@ -1566,7 +1566,7 @@ inline void _CompositeRow_Argb2Rgb_NoBlend_Transform(FX_LPBYTE dest_scan, FX_LPC int dest_gap = dest_Bpp - 3; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1); - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan) { src_alpha = src_scan[3] * (*clip_scan++) / 255; } else { @@ -1669,7 +1669,7 @@ inline void _CompositeRow_8bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = pPalette[*src_scan]; + uint8_t gray = pPalette[*src_scan]; int src_alpha = *src_alpha_scan++; if (clip_scan) { src_alpha = clip_scan[col] * src_alpha / 255; @@ -1689,7 +1689,7 @@ inline void _CompositeRow_8bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, return; } for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = pPalette[*src_scan]; + uint8_t gray = pPalette[*src_scan]; int src_alpha = *src_alpha_scan++; if (clip_scan) { src_alpha = clip_scan[col] * src_alpha / 255; @@ -1707,7 +1707,7 @@ inline void _CompositeRow_8bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = pPalette[*src_scan]; + uint8_t gray = pPalette[*src_scan]; if (bNonseparableBlend) { blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; } @@ -1723,7 +1723,7 @@ inline void _CompositeRow_8bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, return; } for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = pPalette[*src_scan]; + uint8_t gray = pPalette[*src_scan]; if (clip_scan && clip_scan[col] < 255) { *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); } else { @@ -1743,9 +1743,9 @@ inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = pPalette[*src_scan]; + uint8_t gray = pPalette[*src_scan]; src_scan ++; - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { int src_alpha = *src_alpha_scan ++; if (clip_scan) { @@ -1759,7 +1759,7 @@ inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan dest_alpha_scan ++; continue; } - FX_BYTE src_alpha = *src_alpha_scan++; + uint8_t src_alpha = *src_alpha_scan++; if (clip_scan) { src_alpha = clip_scan[col] * src_alpha / 255; } @@ -1781,9 +1781,9 @@ inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan return; } for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = pPalette[*src_scan]; + uint8_t gray = pPalette[*src_scan]; src_scan ++; - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { int src_alpha = *src_alpha_scan ++; if (clip_scan) { @@ -1797,7 +1797,7 @@ inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan dest_alpha_scan ++; continue; } - FX_BYTE src_alpha = *src_alpha_scan++; + uint8_t src_alpha = *src_alpha_scan++; if (clip_scan) { src_alpha = clip_scan[col] * src_alpha / 255; } @@ -1817,7 +1817,7 @@ inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = pPalette[*src_scan]; + uint8_t gray = pPalette[*src_scan]; src_scan ++; if (clip_scan == NULL || clip_scan[col] == 255) { *dest_scan++ = gray; @@ -1831,7 +1831,7 @@ inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan continue; } int back_alpha = *dest_alpha_scan; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { @@ -1844,7 +1844,7 @@ inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan return; } for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = pPalette[*src_scan]; + uint8_t gray = pPalette[*src_scan]; src_scan ++; if (clip_scan == NULL || clip_scan[col] == 255) { *dest_scan++ = gray; @@ -1858,7 +1858,7 @@ inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan continue; } int back_alpha = *dest_alpha_scan; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); @@ -1875,7 +1875,7 @@ inline void _CompositeRow_1bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) ? set_gray : reset_gray; + uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) ? set_gray : reset_gray; if (bNonseparableBlend) { blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; } @@ -1890,7 +1890,7 @@ inline void _CompositeRow_1bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, return; } for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) ? set_gray : reset_gray; + uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) ? set_gray : reset_gray; if (clip_scan && clip_scan[col] < 255) { *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); } else { @@ -1909,7 +1909,7 @@ inline void _CompositeRow_1bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) ? set_gray : reset_gray; + uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) ? set_gray : reset_gray; if (clip_scan == NULL || clip_scan[col] == 255) { *dest_scan++ = gray; *dest_alpha_scan ++ = 255; @@ -1922,7 +1922,7 @@ inline void _CompositeRow_1bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan continue; } int back_alpha = *dest_alpha_scan; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { @@ -1935,7 +1935,7 @@ inline void _CompositeRow_1bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan return; } for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) ? set_gray : reset_gray; + uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) ? set_gray : reset_gray; if (clip_scan == NULL || clip_scan[col] == 255) { *dest_scan++ = gray; *dest_alpha_scan ++ = 255; @@ -1948,7 +1948,7 @@ inline void _CompositeRow_1bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan continue; } int back_alpha = *dest_alpha_scan; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); @@ -1968,7 +1968,7 @@ inline void _CompositeRow_8bppRgb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE sr int src_g = FXARGB_G(argb); int src_b = FXARGB_B(argb); src_scan ++; - FX_BYTE src_alpha = 0; + uint8_t src_alpha = 0; if (clip_scan) { src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255; } else { @@ -2069,7 +2069,7 @@ inline void _CompositeRow_8bppRgb2Argb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE s int src_r = FXARGB_R(argb); int src_g = FXARGB_G(argb); int src_b = FXARGB_B(argb); - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { if (clip_scan) { int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255; @@ -2081,7 +2081,7 @@ inline void _CompositeRow_8bppRgb2Argb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE s src_alpha_scan ++; continue; } - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan == NULL) { src_alpha = *src_alpha_scan ++; } else { @@ -2091,7 +2091,7 @@ inline void _CompositeRow_8bppRgb2Argb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE s dest_scan += 4; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); @@ -2123,7 +2123,7 @@ inline void _CompositeRow_8bppRgb2Argb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE s continue; } int back_alpha = dest_scan[3]; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); @@ -2147,7 +2147,7 @@ void _CompositeRow_8bppRgb2Rgba_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan int src_r = FXARGB_R(argb); int src_g = FXARGB_G(argb); int src_b = FXARGB_B(argb); - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { if (clip_scan) { int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255; @@ -2161,7 +2161,7 @@ void _CompositeRow_8bppRgb2Rgba_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan src_alpha_scan ++; continue; } - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan == NULL) { src_alpha = *src_alpha_scan++; } else { @@ -2172,7 +2172,7 @@ void _CompositeRow_8bppRgb2Rgba_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan dest_alpha_scan ++; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); @@ -2204,7 +2204,7 @@ void _CompositeRow_8bppRgb2Rgba_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan continue; } int back_alpha = *dest_alpha_scan; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); @@ -2251,7 +2251,7 @@ inline void _CompositeRow_1bppRgb2Argb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE s continue; } int back_alpha = dest_scan[3]; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); @@ -2300,7 +2300,7 @@ void _CompositeRow_1bppRgb2Rgba_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan continue; } int back_alpha = *dest_alpha_scan; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); @@ -2321,7 +2321,7 @@ void _CompositeRow_ByteMask2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m } else { src_alpha = mask_alpha * src_scan[col] / 255; } - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); dest_scan += 4; @@ -2331,12 +2331,12 @@ void _CompositeRow_ByteMask2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m dest_scan += 4; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { int blended_colors[3]; - FX_BYTE src_scan[3]; + uint8_t src_scan[3]; src_scan[0] = src_b; src_scan[1] = src_g; src_scan[2] = src_r; @@ -2379,7 +2379,7 @@ void _CompositeRow_ByteMask2Rgba(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m } else { src_alpha = mask_alpha * src_scan[col] / 255; } - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { *dest_scan ++ = src_b; *dest_scan ++ = src_g; @@ -2392,12 +2392,12 @@ void _CompositeRow_ByteMask2Rgba(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m dest_alpha_scan ++; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { int blended_colors[3]; - FX_BYTE src_scan[3]; + uint8_t src_scan[3]; src_scan[0] = src_b; src_scan[1] = src_g; src_scan[2] = src_r; @@ -2447,7 +2447,7 @@ void _CompositeRow_ByteMask2Rgb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma } if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { int blended_colors[3]; - FX_BYTE src_scan[3]; + uint8_t src_scan[3]; src_scan[0] = src_b; src_scan[1] = src_g; src_scan[2] = src_r; @@ -2486,7 +2486,7 @@ void _CompositeRow_ByteMask2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m } else { src_alpha = mask_alpha * src_scan[col] / 255; } - FX_BYTE back_alpha = *dest_scan; + uint8_t back_alpha = *dest_scan; if (!back_alpha) { *dest_scan = src_alpha; } else if (src_alpha) { @@ -2522,7 +2522,7 @@ void _CompositeRow_ByteMask2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int } else { src_alpha = mask_alpha * src_scan[col] / 255; } - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { *dest_scan ++ = src_gray; *dest_alpha_scan ++ = src_alpha; @@ -2533,7 +2533,7 @@ void _CompositeRow_ByteMask2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int dest_alpha_scan ++; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, alpha_ratio); @@ -2564,18 +2564,18 @@ void _CompositeRow_BitMask2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma } else { src_alpha = mask_alpha; } - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); dest_scan += 4; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { int blended_colors[3]; - FX_BYTE src_scan[3]; + uint8_t src_scan[3]; src_scan[0] = src_b; src_scan[1] = src_g; src_scan[2] = src_r; @@ -2636,7 +2636,7 @@ void _CompositeRow_BitMask2Rgba(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma } else { src_alpha = mask_alpha; } - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { *dest_scan ++ = src_b; *dest_scan ++ = src_g; @@ -2644,12 +2644,12 @@ void _CompositeRow_BitMask2Rgba(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma *dest_alpha_scan ++ = mask_alpha; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { int blended_colors[3]; - FX_BYTE src_scan[3]; + uint8_t src_scan[3]; src_scan[0] = src_b; src_scan[1] = src_g; src_scan[2] = src_r; @@ -2714,7 +2714,7 @@ void _CompositeRow_BitMask2Rgb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mas } if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { int blended_colors[3]; - FX_BYTE src_scan[3]; + uint8_t src_scan[3]; src_scan[0] = src_b; src_scan[1] = src_g; src_scan[2] = src_r; @@ -2757,7 +2757,7 @@ void _CompositeRow_BitMask2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma } else { src_alpha = mask_alpha; } - FX_BYTE back_alpha = *dest_scan; + uint8_t back_alpha = *dest_scan; if (!back_alpha) { *dest_scan = src_alpha; } else if (src_alpha) { @@ -2802,7 +2802,7 @@ void _CompositeRow_BitMask2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m } else { src_alpha = mask_alpha; } - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { *dest_scan ++ = src_gray; *dest_alpha_scan ++ = src_alpha; @@ -2813,7 +2813,7 @@ void _CompositeRow_BitMask2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m dest_alpha_scan ++; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, alpha_ratio); @@ -2825,7 +2825,7 @@ void _CompositeRow_Argb2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_sc int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < pixel_count; col ++) { - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { if (clip_scan) { int src_alpha = clip_scan[col] * src_scan[3] / 255; @@ -2840,7 +2840,7 @@ void _CompositeRow_Argb2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_sc src_scan += 4; continue; } - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan == NULL) { src_alpha = src_scan[3]; } else { @@ -2851,11 +2851,11 @@ void _CompositeRow_Argb2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_sc src_scan += 4; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { - FX_BYTE dest_scan_o[3]; + uint8_t dest_scan_o[3]; dest_scan_o[0] = dest_scan[2]; dest_scan_o[1] = dest_scan[1]; dest_scan_o[2] = dest_scan[0]; @@ -2883,7 +2883,7 @@ void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LP FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int src_gap = src_Bpp - 3; for (int col = 0; col < width; col ++) { - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { if (src_Bpp == 4) { FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan)); @@ -2896,7 +2896,7 @@ void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LP } dest_scan[3] = 0xff; if (bNonseparableBlend) { - FX_BYTE dest_scan_o[3]; + uint8_t dest_scan_o[3]; dest_scan_o[0] = dest_scan[2]; dest_scan_o[1] = dest_scan[1]; dest_scan_o[2] = dest_scan[0]; @@ -2919,7 +2919,7 @@ inline void _CompositeRow_Argb2Rgb_Blend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LP int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < width; col ++) { - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan) { src_alpha = src_scan[3] * (*clip_scan++) / 255; } else { @@ -2931,7 +2931,7 @@ inline void _CompositeRow_Argb2Rgb_Blend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LP continue; } if (bNonseparableBlend) { - FX_BYTE dest_scan_o[3]; + uint8_t dest_scan_o[3]; dest_scan_o[0] = dest_scan[2]; dest_scan_o[1] = dest_scan[1]; dest_scan_o[2] = dest_scan[0]; @@ -2968,7 +2968,7 @@ inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, int src_gap = src_Bpp - 3; for (int col = 0; col < width; col ++) { if (bNonseparableBlend) { - FX_BYTE dest_scan_o[3]; + uint8_t dest_scan_o[3]; dest_scan_o[0] = dest_scan[2]; dest_scan_o[1] = dest_scan[1]; dest_scan_o[2] = dest_scan[0]; @@ -2990,7 +2990,7 @@ inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, inline void _CompositeRow_Argb2Rgb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int dest_Bpp, FX_LPCBYTE clip_scan) { for (int col = 0; col < width; col ++) { - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan) { src_alpha = src_scan[3] * (*clip_scan++) / 255; } else { @@ -3035,7 +3035,7 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, int src_gap = src_Bpp - 3; for (int col = 0; col < width; col ++) { int src_alpha = *clip_scan ++; - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { dest_scan[2] = FX_GAMMA(*src_scan++); dest_scan[1] = FX_GAMMA(*src_scan++); @@ -3049,11 +3049,11 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, src_scan += src_Bpp; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { - FX_BYTE dest_scan_o[3]; + uint8_t dest_scan_o[3]; dest_scan_o[0] = dest_scan[2]; dest_scan_o[1] = dest_scan[1]; dest_scan_o[2] = dest_scan[0]; @@ -3078,14 +3078,14 @@ inline void _CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, F FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int src_gap = src_Bpp - 3; for (int col = 0; col < width; col ++) { - FX_BYTE src_alpha = *clip_scan ++; + uint8_t src_alpha = *clip_scan ++; if (src_alpha == 0) { dest_scan += dest_Bpp; src_scan += src_Bpp; continue; } if (bNonseparableBlend) { - FX_BYTE dest_scan_o[3]; + uint8_t dest_scan_o[3]; dest_scan_o[0] = dest_scan[2]; dest_scan_o[1] = dest_scan[1]; dest_scan_o[2] = dest_scan[0]; @@ -3124,7 +3124,7 @@ inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_RgbByteOrder(FX_LPBYTE dest_scan continue; } int back_alpha = dest_scan[3]; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; for (int color = 0; color < 3; color ++) { @@ -3247,7 +3247,7 @@ inline void _CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, continue; } int back_alpha = dest_scan[3]; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], FX_GAMMA(src_b), alpha_ratio); @@ -3298,7 +3298,7 @@ inline void _CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, continue; } int back_alpha = dest_scan[3]; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], FX_GAMMA(src_b), alpha_ratio); @@ -3317,7 +3317,7 @@ void _CompositeRow_ByteMask2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE sr } else { src_alpha = mask_alpha * src_scan[col] / 255; } - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); dest_scan += 4; @@ -3327,13 +3327,13 @@ void _CompositeRow_ByteMask2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE sr dest_scan += 4; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { int blended_colors[3]; - FX_BYTE src_scan[3]; - FX_BYTE dest_scan_o[3]; + uint8_t src_scan[3]; + uint8_t dest_scan_o[3]; src_scan[0] = src_b; src_scan[1] = src_g; src_scan[2] = src_r; @@ -3378,8 +3378,8 @@ void _CompositeRow_ByteMask2Rgb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src } if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { int blended_colors[3]; - FX_BYTE src_scan[3]; - FX_BYTE dest_scan_o[3]; + uint8_t src_scan[3]; + uint8_t dest_scan_o[3]; src_scan[0] = src_b; src_scan[1] = src_g; src_scan[2] = src_r; @@ -3429,19 +3429,19 @@ void _CompositeRow_BitMask2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src } else { src_alpha = mask_alpha; } - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); dest_scan += 4; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { int blended_colors[3]; - FX_BYTE src_scan[3]; - FX_BYTE dest_scan_o[3]; + uint8_t src_scan[3]; + uint8_t dest_scan_o[3]; src_scan[0] = src_b; src_scan[1] = src_g; src_scan[2] = src_r; @@ -3501,8 +3501,8 @@ void _CompositeRow_BitMask2Rgb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_ } if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { int blended_colors[3]; - FX_BYTE src_scan[3]; - FX_BYTE dest_scan_o[3]; + uint8_t src_scan[3]; + uint8_t dest_scan_o[3]; src_scan[0] = src_b; src_scan[1] = src_g; src_scan[2] = src_r; @@ -3559,7 +3559,7 @@ inline FX_BOOL _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, int mask_red = dest_format & 0x0400 ? FX_CCOLOR(gray_p[0]) : gray_p[0]; } else { if (alpha_flag >> 8) { - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(mask_red, mask_green, mask_blue, mask_black, r, g, b); mask_red = FXRGB2GRAY(r, g, b); @@ -3600,7 +3600,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(FX_BYTE, pal_count); + FX_LPBYTE 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]); @@ -3618,7 +3618,7 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB } } else { int pal_count = 1 << (src_format & 0xff); - FX_LPBYTE gray_pal = FX_Alloc(FX_BYTE, pal_count); + FX_LPBYTE gray_pal = FX_Alloc(uint8_t, pal_count); if (pal_count == 2) { gray_pal[0] = 0; gray_pal[1] = 255; @@ -3643,12 +3643,12 @@ 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(FX_BYTE, pal_count); + FX_LPBYTE gray_pal = FX_Alloc(uint8_t, pal_count); pDestPalette = (FX_DWORD*)gray_pal; if (isSrcCmyk) { for (int i = 0; i < pal_count; i ++) { FX_CMYK cmyk = pSrcPalette[i]; - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk), FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), r, g, b); *gray_pal ++ = FXRGB2GRAY(r, g, b); @@ -3666,7 +3666,7 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB } else { for (int i = 0; i < palsize; i ++) { FX_CMYK cmyk = pSrcPalette[i]; - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk), FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), r, g, b); pDestPalette[i] = FXARGB_MAKE(0xff, r, g, b); @@ -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(FX_BYTE, pal_count); + FX_LPBYTE gray_pal = FX_Alloc(uint8_t, pal_count); if (pal_count == 2) { gray_pal[0] = 0; gray_pal[1] = 255; @@ -3700,7 +3700,7 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB if (isSrcCmyk != isDstCmyk) { for (int i = 0; i < palsize; i ++) { FX_CMYK cmyk = pDestPalette[i]; - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk), FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), r, g, b); pDestPalette[i] = FXARGB_MAKE(0xff, r, g, b); @@ -3727,7 +3727,7 @@ CFX_ScanlineCompositor::~CFX_ScanlineCompositor() FX_Free(m_pCacheScanline); } } -FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_format, FX_INT32 width, FX_DWORD* pSrcPalette, +FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_format, int32_t width, FX_DWORD* pSrcPalette, FX_DWORD mask_color, int blend_type, FX_BOOL bClip, FX_BOOL bRgbByteOrder, int alpha_flag, void* pIccTransform) { m_SrcFormat = src_format; @@ -3861,7 +3861,7 @@ void CFX_ScanlineCompositor::CompositeRgbBitmapLine(FX_LPBYTE dest_scan, FX_LPCB } else { int dest_Size = width * dest_Bpp + 4; if (dest_Size > m_CacheSize) { - m_pCacheScanline = FX_Realloc(FX_BYTE, m_pCacheScanline, dest_Size); + m_pCacheScanline = FX_Realloc(uint8_t, m_pCacheScanline, dest_Size); if (!m_pCacheScanline) { return; } @@ -4158,7 +4158,7 @@ FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left, int dest_top, int width, int if (width == 0 || height == 0) { return TRUE; } - int src_alpha = (FX_BYTE)(alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color); + int src_alpha = (uint8_t)(alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color); if (src_alpha == 0) { return TRUE; } @@ -4214,19 +4214,19 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX } FX_LPBYTE color_p = (FX_LPBYTE)&dst_color; if (m_bpp == 8) { - FX_BYTE gray = 255; + uint8_t gray = 255; if (!IsAlphaMask()) { if (pIccTransform && CFX_GEModule::Get()->GetCodecModule() && CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); pIccModule->TranslateScanline(pIccTransform, &gray, color_p, 1); } else { if (alpha_flag >> 8) { - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(color_p[0], color_p[1], color_p[2], color_p[3], r, g, b); gray = FXRGB2GRAY(r, g, b); } else { - gray = (FX_BYTE)FXRGB2GRAY((int)color_p[2], color_p[1], color_p[0]); + gray = (uint8_t)FXRGB2GRAY((int)color_p[2], color_p[1], color_p[0]); } } if (IsCmykImage()) { @@ -4245,13 +4245,13 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX } return TRUE; } else if (m_bpp == 1) { - ASSERT(!IsCmykImage() && (FX_BYTE)(alpha_flag >> 8) == 0); + ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0); int left_shift = rect.left % 8; int right_shift = rect.right % 8; int width = rect.right / 8 - rect.left / 8; int index = 0; if (m_pPalette == NULL) { - index = ((FX_BYTE)color == 0xff) ? 1 : 0; + index = ((uint8_t)color == 0xff) ? 1 : 0; } else { for (int i = 0; i < 2; i ++) if (m_pPalette[i] == color) { @@ -4259,10 +4259,10 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX } } for (int row = rect.top; row < rect.bottom; row ++) { - FX_BYTE* dest_scan_top = (FX_BYTE*)GetScanline(row) + rect.left / 8; - FX_BYTE* dest_scan_top_r = (FX_BYTE*)GetScanline(row) + rect.right / 8; - FX_BYTE left_flag = *dest_scan_top & (255 << (8 - left_shift)); - FX_BYTE right_flag = *dest_scan_top_r & (255 >> right_shift); + uint8_t* dest_scan_top = (uint8_t*)GetScanline(row) + rect.left / 8; + uint8_t* dest_scan_top_r = (uint8_t*)GetScanline(row) + rect.right / 8; + uint8_t left_flag = *dest_scan_top & (255 << (8 - left_shift)); + uint8_t right_flag = *dest_scan_top_r & (255 >> right_shift); if (width) { FXSYS_memset8(dest_scan_top + 1, index ? 255 : 0, width - 1); if (!index) { @@ -4298,7 +4298,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX } } if(!IsCmykImage()) { - color_p[3] = (FX_BYTE)src_alpha; + color_p[3] = (uint8_t)src_alpha; } int Bpp = m_bpp / 8; FX_BOOL bAlpha = HasAlpha(); @@ -4330,13 +4330,13 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX if (bAlpha) { if (bArgb) { for (int col = 0; col < width; col ++) { - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, color_p[2], color_p[1], color_p[0])); dest_scan += 4; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[0], alpha_ratio); dest_scan ++; @@ -4349,14 +4349,14 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX } else { FX_LPBYTE dest_scan_alpha = (FX_LPBYTE)m_pAlphaMask->GetScanline(row) + rect.left; for (int col = 0; col < width; col ++) { - FX_BYTE back_alpha = *dest_scan_alpha; + uint8_t back_alpha = *dest_scan_alpha; if (back_alpha == 0) { *dest_scan_alpha++ = src_alpha; FXSYS_memcpy32(dest_scan, color_p, Bpp); dest_scan += Bpp; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_scan_alpha ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; for(int comps = 0; comps < Bpp; comps ++) { @@ -4437,14 +4437,14 @@ FX_BOOL CFX_BitmapComposer::SetInfo(int width, int height, FXDIB_Format src_form return FALSE; } if (m_bVertical) { - m_pScanlineV = FX_Alloc(FX_BYTE, m_pBitmap->GetBPP() / 8 * width + 4); - m_pClipScanV = FX_Alloc(FX_BYTE, m_pBitmap->GetHeight()); + m_pScanlineV = FX_Alloc(uint8_t, m_pBitmap->GetBPP() / 8 * width + 4); + m_pClipScanV = FX_Alloc(uint8_t, m_pBitmap->GetHeight()); if (m_pBitmap->m_pAlphaMask) { - m_pScanlineAlphaV = FX_Alloc(FX_BYTE, width + 4); + m_pScanlineAlphaV = FX_Alloc(uint8_t, width + 4); } } if (m_BitmapAlpha < 255) { - m_pAddClipScan = FX_Alloc(FX_BYTE, m_bVertical ? m_pBitmap->GetHeight() : m_pBitmap->GetWidth()); + m_pAddClipScan = FX_Alloc(uint8_t, m_bVertical ? m_pBitmap->GetHeight() : m_pBitmap->GetWidth()); } return TRUE; } diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp index 7ab2417a57..b4fdd3a1ba 100644 --- a/core/src/fxge/dib/fx_dib_convert.cpp +++ b/core/src/fxge/dib/fx_dib_convert.cpp @@ -117,7 +117,7 @@ public: { return m_aLut; } - FX_INT32 Getlut()const + int32_t Getlut()const { return m_lut; } @@ -159,11 +159,11 @@ void _Qsort(FX_DWORD* alut, FX_DWORD* clut, int l, int r) _Qsort(alut, clut, pI + 1, r); } } -void _ColorDecode(FX_DWORD pal_v, FX_BYTE& r, FX_BYTE& g, FX_BYTE& b) +void _ColorDecode(FX_DWORD pal_v, uint8_t& r, uint8_t& g, uint8_t& b) { - r = (FX_BYTE)((pal_v & 0xf00) >> 4); - g = (FX_BYTE)(pal_v & 0x0f0); - b = (FX_BYTE)((pal_v & 0x00f) << 4); + r = (uint8_t)((pal_v & 0xf00) >> 4); + g = (uint8_t)(pal_v & 0x0f0); + b = (uint8_t)((pal_v & 0x00f) << 4); } void _Obtain_Pal(FX_DWORD* aLut, FX_DWORD*cLut, FX_DWORD* dest_pal, int pal_type, FX_DWORD* win_mac_pal, FX_DWORD lut) { @@ -176,7 +176,7 @@ void _Obtain_Pal(FX_DWORD* aLut, FX_DWORD*cLut, FX_DWORD* dest_pal, int pal_type lut_offset += 256; } FX_DWORD color = cLut[lut_offset]; - FX_BYTE r, g, b; + uint8_t r, g, b; _ColorDecode(color, r, g, b); dest_pal[row] = ((FX_DWORD)r << 16) | ((FX_DWORD)g << 8) | b | 0xff000000; aLut[lut_offset] = row; @@ -187,15 +187,15 @@ void _Obtain_Pal(FX_DWORD* aLut, FX_DWORD*cLut, FX_DWORD* dest_pal, int pal_type if (lut_offset < 0) { lut_offset += 256; } - FX_BYTE r, g, b; + uint8_t r, g, b; _ColorDecode(cLut[lut_offset], r, g, b); int error, min_error = 1000000; int c_index = 0; for (col = 0; col < 256; col++) { FX_DWORD p_color = win_mac_pal[col]; - int d_r = r - (FX_BYTE)(p_color >> 16); - int d_g = g - (FX_BYTE)(p_color >> 8); - int d_b = b - (FX_BYTE)p_color; + int d_r = r - (uint8_t)(p_color >> 16); + int d_g = g - (uint8_t)(p_color >> 8); + int d_b = b - (uint8_t)p_color; error = d_r * d_r + d_g * d_g + d_b * d_b; if (error < min_error) { min_error = error; @@ -252,9 +252,9 @@ FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap, int pal_type) int row, col; m_lut = 0; for (row = 0; row < height; row++) { - FX_BYTE* scan_line = (FX_BYTE*)pBitmap->GetScanline(row); + uint8_t* scan_line = (uint8_t*)pBitmap->GetScanline(row); for (col = 0; col < width; col++) { - FX_BYTE* src_port = scan_line + col * bpp; + uint8_t* src_port = scan_line + col * bpp; FX_DWORD b = src_port[0] & 0xf0; FX_DWORD g = src_port[1] & 0xf0; FX_DWORD r = src_port[2] & 0xf0; @@ -282,7 +282,7 @@ FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap, int pal_type) FX_BOOL _ConvertBuffer_1bppMask2Gray(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top) { - FX_BYTE set_gray, reset_gray; + uint8_t set_gray, reset_gray; set_gray = 0xff; reset_gray = 0x00; for (int row = 0; row < height; row ++) { @@ -312,7 +312,7 @@ FX_BOOL _ConvertBuffer_1bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { FX_DWORD* src_plt = pSrcBitmap->GetPalette(); - FX_BYTE gray[2]; + uint8_t gray[2]; if (pIccTransform) { FX_DWORD plt[2]; if (pSrcBitmap->IsCmykImage()) { @@ -330,7 +330,7 @@ FX_BOOL _ConvertBuffer_1bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); pIccModule->TranslateScanline(pIccTransform, gray, (FX_LPCBYTE)plt, 2); } else { - FX_BYTE reset_r, reset_g, reset_b, + uint8_t reset_r, reset_g, reset_b, set_r, set_g, set_b; 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]), @@ -365,7 +365,7 @@ FX_BOOL _ConvertBuffer_8bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { FX_DWORD* src_plt = pSrcBitmap->GetPalette(); - FX_BYTE gray[256]; + uint8_t gray[256]; if (pIccTransform) { FX_DWORD plt[256]; if (pSrcBitmap->IsCmykImage()) { @@ -384,7 +384,7 @@ FX_BOOL _ConvertBuffer_8bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt pIccModule->TranslateScanline(pIccTransform, gray, (FX_LPCBYTE)plt, 256); } else { if (pSrcBitmap->IsCmykImage()) { - FX_BYTE r, g, b; + uint8_t r, g, b; for (int i = 0; i < 256; i ++) { AdobeCMYK_to_sRGB1(FXSYS_GetCValue(src_plt[i]), FXSYS_GetMValue(src_plt[i]), FXSYS_GetYValue(src_plt[i]), FXSYS_GetKValue(src_plt[i]), r, g, b); @@ -433,7 +433,7 @@ FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(FX_LPBYTE dest_buf, int dest_pitch, int wi FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 4; for (int col = 0; col < width; col ++) { - FX_BYTE r, g, b; + 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]), r, g, b); *dest_scan++ = FXRGB2GRAY(r, g, b); @@ -506,7 +506,7 @@ FX_BOOL _ConvertBuffer_Plt2PltRgb8(FX_LPBYTE dest_buf, int dest_pitch, int width } else { if (pSrcBitmap->IsCmykImage()) { for (int i = 0; i < plt_size; i ++) { - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(FXSYS_GetCValue(src_plt[i]), FXSYS_GetMValue(src_plt[i]), FXSYS_GetYValue(src_plt[i]), FXSYS_GetKValue(src_plt[i]), r, g, b); dst_plt[i] = FXARGB_MAKE(0xff, r, g, b); @@ -536,14 +536,14 @@ inline FX_BOOL _ConvertBuffer_Rgb2PltRgb8_NoTransform(FX_LPBYTE dest_buf, int de int lut_256 = lut - 256; for (row = 0; row < lut_256; row++) { min_err = 1000000; - FX_BYTE r, g, b; + uint8_t r, g, b; _ColorDecode(cLut[row], r, g, b); int clrindex = 0; for (int col = 0; col < 256; col++) { FX_DWORD p_color = *(pPalette + col); - int d_r = r - (FX_BYTE)(p_color >> 16); - int d_g = g - (FX_BYTE)(p_color >> 8); - int d_b = b - (FX_BYTE)(p_color); + int d_r = r - (uint8_t)(p_color >> 16); + int d_g = g - (uint8_t)(p_color >> 8); + int d_b = b - (uint8_t)(p_color); err = d_r * d_r + d_g * d_g + d_b * d_b; if (err < min_err) { min_err = err; @@ -553,19 +553,19 @@ inline FX_BOOL _ConvertBuffer_Rgb2PltRgb8_NoTransform(FX_LPBYTE dest_buf, int de aLut[row] = clrindex; } } - FX_INT32 lut_1 = lut - 1; + int32_t lut_1 = lut - 1; for (row = 0; row < height; row ++) { - FX_BYTE* src_scan = (FX_BYTE*)pSrcBitmap->GetScanline(src_top + row) + src_left; - FX_BYTE* dest_scan = dest_buf + row * dest_pitch; + uint8_t* src_scan = (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left; + uint8_t* dest_scan = dest_buf + row * dest_pitch; for (col = 0; col < width; col++) { - FX_BYTE* src_port = src_scan + col * bpp; + uint8_t* src_port = src_scan + col * bpp; int r = src_port[2] & 0xf0; int g = src_port[1] & 0xf0; int b = src_port[0] & 0xf0; FX_DWORD clrindex = (r << 4) + g + (b >> 4); for (int i = lut_1; i >= 0; i--) if (clrindex == cLut[i]) { - *(dest_scan + col) = (FX_BYTE)(aLut[i]); + *(dest_scan + col) = (uint8_t)(aLut[i]); break; } } @@ -596,7 +596,7 @@ FX_BOOL _ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top) { int comps = (dst_format & 0xff) / 8; - FX_BYTE set_gray, reset_gray; + uint8_t set_gray, reset_gray; set_gray = 0xff; reset_gray = 0x00; for (int row = 0; row < height; row ++) { @@ -624,7 +624,7 @@ FX_BOOL _ConvertBuffer_8bppMask2Rgb(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) + src_left; - FX_BYTE src_pixel; + uint8_t src_pixel; for (int col = 0; col < width; col ++) { src_pixel = *src_scan++; *dest_scan++ = src_pixel; @@ -1003,7 +1003,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(FX_BYTE, dest_pitch * m_Height + 4); + FX_LPBYTE dest_buf = FX_TryAlloc(uint8_t, dest_pitch * m_Height + 4); if (dest_buf == NULL) { return FALSE; } @@ -1068,8 +1068,8 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransfor } m_bExtBuf = FALSE; m_pBuffer = dest_buf; - m_bpp = (FX_BYTE)dest_format; - m_AlphaFlag = (FX_BYTE)(dest_format >> 8); + m_bpp = (uint8_t)dest_format; + m_AlphaFlag = (uint8_t)(dest_format >> 8); m_Pitch = dest_pitch; return TRUE; } diff --git a/core/src/fxge/dib/fx_dib_engine.cpp b/core/src/fxge/dib/fx_dib_engine.cpp index 6f8621e2a5..e0b21d2f59 100644 --- a/core/src/fxge/dib/fx_dib_engine.cpp +++ b/core/src/fxge/dib/fx_dib_engine.cpp @@ -28,7 +28,7 @@ void CWeightTable::Calc(int dest_len, int dest_min, int dest_max, int src_len, i if ((dest_max - dest_min) > (int)((1U << 30) - 4) / m_ItemSize) { return; } - m_pWeightTables = FX_TryAlloc(FX_BYTE, (dest_max - dest_min) * m_ItemSize + 4); + m_pWeightTables = FX_TryAlloc(uint8_t, (dest_max - dest_min) * m_ItemSize + 4); if (m_pWeightTables == NULL) { return; } @@ -202,7 +202,7 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap, FXDIB_Format d } size += 31; size = size / 32 * 4; - m_pDestScanline = FX_TryAlloc(FX_BYTE, size); + m_pDestScanline = FX_TryAlloc(uint8_t, size); if (m_pDestScanline == NULL) { return; } @@ -373,7 +373,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) if (m_Flags & FXDIB_BICUBIC_INTERPOL) { dest_a = dest_a < 0 ? 0 : dest_a > 16711680 ? 16711680 : dest_a; } - *dest_scan++ = (FX_BYTE)(dest_a >> 16); + *dest_scan++ = (uint8_t)(dest_a >> 16); } break; } @@ -388,7 +388,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) if (m_Flags & FXDIB_BICUBIC_INTERPOL) { dest_a = dest_a < 0 ? 0 : dest_a > 16711680 ? 16711680 : dest_a; } - *dest_scan++ = (FX_BYTE)(dest_a >> 16); + *dest_scan++ = (uint8_t)(dest_a >> 16); } break; } @@ -406,8 +406,8 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) dest_r = dest_r < 0 ? 0 : dest_r > 16711680 ? 16711680 : dest_r; dest_a = dest_a < 0 ? 0 : dest_a > 65536 ? 65536 : dest_a; } - *dest_scan++ = (FX_BYTE)(dest_r >> 16); - *dest_scan_mask++ = (FX_BYTE)((dest_a * 255) >> 16); + *dest_scan++ = (uint8_t)(dest_r >> 16); + *dest_scan_mask++ = (uint8_t)((dest_a * 255) >> 16); } break; } @@ -419,13 +419,13 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart]; unsigned long argb_cmyk = m_pSrcPalette[src_scan[j]]; if (m_DestFormat == FXDIB_Rgb) { - dest_r_y += pixel_weight * (FX_BYTE)(argb_cmyk >> 16); - dest_g_m += pixel_weight * (FX_BYTE)(argb_cmyk >> 8); - dest_b_c += pixel_weight * (FX_BYTE)argb_cmyk; + dest_r_y += pixel_weight * (uint8_t)(argb_cmyk >> 16); + dest_g_m += pixel_weight * (uint8_t)(argb_cmyk >> 8); + dest_b_c += pixel_weight * (uint8_t)argb_cmyk; } else { - dest_b_c += pixel_weight * (FX_BYTE)(argb_cmyk >> 24); - dest_g_m += pixel_weight * (FX_BYTE)(argb_cmyk >> 16); - dest_r_y += pixel_weight * (FX_BYTE)(argb_cmyk >> 8); + dest_b_c += pixel_weight * (uint8_t)(argb_cmyk >> 24); + dest_g_m += pixel_weight * (uint8_t)(argb_cmyk >> 16); + dest_r_y += pixel_weight * (uint8_t)(argb_cmyk >> 8); } } if (m_Flags & FXDIB_BICUBIC_INTERPOL) { @@ -433,9 +433,9 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) dest_g_m = dest_g_m < 0 ? 0 : dest_g_m > 16711680 ? 16711680 : dest_g_m; dest_b_c = dest_b_c < 0 ? 0 : dest_b_c > 16711680 ? 16711680 : dest_b_c; } - *dest_scan++ = (FX_BYTE)(dest_b_c >> 16); - *dest_scan++ = (FX_BYTE)(dest_g_m >> 16); - *dest_scan++ = (FX_BYTE)(dest_r_y >> 16); + *dest_scan++ = (uint8_t)(dest_b_c >> 16); + *dest_scan++ = (uint8_t)(dest_g_m >> 16); + *dest_scan++ = (uint8_t)(dest_r_y >> 16); } break; } @@ -448,13 +448,13 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) pixel_weight = pixel_weight * src_scan_mask[j] / 255; unsigned long argb_cmyk = m_pSrcPalette[src_scan[j]]; if (m_DestFormat == FXDIB_Rgba) { - dest_r_y += pixel_weight * (FX_BYTE)(argb_cmyk >> 16); - dest_g_m += pixel_weight * (FX_BYTE)(argb_cmyk >> 8); - dest_b_c += pixel_weight * (FX_BYTE)argb_cmyk; + dest_r_y += pixel_weight * (uint8_t)(argb_cmyk >> 16); + dest_g_m += pixel_weight * (uint8_t)(argb_cmyk >> 8); + dest_b_c += pixel_weight * (uint8_t)argb_cmyk; } else { - dest_b_c += pixel_weight * (FX_BYTE)(argb_cmyk >> 24); - dest_g_m += pixel_weight * (FX_BYTE)(argb_cmyk >> 16); - dest_r_y += pixel_weight * (FX_BYTE)(argb_cmyk >> 8); + dest_b_c += pixel_weight * (uint8_t)(argb_cmyk >> 24); + dest_g_m += pixel_weight * (uint8_t)(argb_cmyk >> 16); + dest_r_y += pixel_weight * (uint8_t)(argb_cmyk >> 8); } dest_a += pixel_weight; } @@ -464,10 +464,10 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) dest_r_y = dest_r_y < 0 ? 0 : dest_r_y > 16711680 ? 16711680 : dest_r_y; dest_a = dest_a < 0 ? 0 : dest_a > 65536 ? 65536 : dest_a; } - *dest_scan++ = (FX_BYTE)(dest_b_c >> 16); - *dest_scan++ = (FX_BYTE)(dest_g_m >> 16); - *dest_scan++ = (FX_BYTE)(dest_r_y >> 16); - *dest_scan_mask++ = (FX_BYTE)((dest_a * 255) >> 16); + *dest_scan++ = (uint8_t)(dest_b_c >> 16); + *dest_scan++ = (uint8_t)(dest_g_m >> 16); + *dest_scan++ = (uint8_t)(dest_r_y >> 16); + *dest_scan_mask++ = (uint8_t)((dest_a * 255) >> 16); } break; } @@ -487,9 +487,9 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) dest_g_m = dest_g_m < 0 ? 0 : dest_g_m > 16711680 ? 16711680 : dest_g_m; dest_r_y = dest_r_y < 0 ? 0 : dest_r_y > 16711680 ? 16711680 : dest_r_y; } - *dest_scan++ = (FX_BYTE)((dest_b_c) >> 16); - *dest_scan++ = (FX_BYTE)((dest_g_m) >> 16); - *dest_scan++ = (FX_BYTE)((dest_r_y) >> 16); + *dest_scan++ = (uint8_t)((dest_b_c) >> 16); + *dest_scan++ = (uint8_t)((dest_g_m) >> 16); + *dest_scan++ = (uint8_t)((dest_r_y) >> 16); dest_scan += Bpp - 3; } break; @@ -517,14 +517,14 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) dest_b_c = dest_b_c < 0 ? 0 : dest_b_c > 16711680 ? 16711680 : dest_b_c; dest_a = dest_a < 0 ? 0 : dest_a > 65536 ? 65536 : dest_a; } - *dest_scan++ = (FX_BYTE)((dest_b_c) >> 16); - *dest_scan++ = (FX_BYTE)((dest_g_m) >> 16); - *dest_scan++ = (FX_BYTE)((dest_r_y) >> 16); + *dest_scan++ = (uint8_t)((dest_b_c) >> 16); + *dest_scan++ = (uint8_t)((dest_g_m) >> 16); + *dest_scan++ = (uint8_t)((dest_r_y) >> 16); if (m_DestFormat == FXDIB_Argb) { - *dest_scan = (FX_BYTE)((dest_a * 255) >> 16); + *dest_scan = (uint8_t)((dest_a * 255) >> 16); } if (dest_scan_mask) { - *dest_scan_mask++ = (FX_BYTE)((dest_a * 255) >> 16); + *dest_scan_mask++ = (uint8_t)((dest_a * 255) >> 16); } dest_scan += Bpp - 3; } @@ -564,7 +564,7 @@ void CStretchEngine::StretchVert() if (m_Flags & FXDIB_BICUBIC_INTERPOL) { dest_a = dest_a < 0 ? 0 : dest_a > 16711680 ? 16711680 : dest_a; } - *dest_scan = (FX_BYTE)(dest_a >> 16); + *dest_scan = (uint8_t)(dest_a >> 16); dest_scan += DestBpp; } break; @@ -583,9 +583,9 @@ void CStretchEngine::StretchVert() dest_k = dest_k < 0 ? 0 : dest_k > 16711680 ? 16711680 : dest_k; dest_a = dest_a < 0 ? 0 : dest_a > 16711680 ? 16711680 : dest_a; } - *dest_scan = (FX_BYTE)(dest_k >> 16); + *dest_scan = (uint8_t)(dest_k >> 16); dest_scan += DestBpp; - *dest_sacn_mask++ = (FX_BYTE)(dest_a >> 16); + *dest_sacn_mask++ = (uint8_t)(dest_a >> 16); } break; } @@ -606,9 +606,9 @@ void CStretchEngine::StretchVert() dest_g_m = dest_g_m < 0 ? 0 : dest_g_m > 16711680 ? 16711680 : dest_g_m; dest_b_c = dest_b_c < 0 ? 0 : dest_b_c > 16711680 ? 16711680 : dest_b_c; } - dest_scan[0] = (FX_BYTE)((dest_b_c) >> 16); - dest_scan[1] = (FX_BYTE)((dest_g_m) >> 16); - dest_scan[2] = (FX_BYTE)((dest_r_y) >> 16); + dest_scan[0] = (uint8_t)((dest_b_c) >> 16); + dest_scan[1] = (uint8_t)((dest_g_m) >> 16); + dest_scan[2] = (uint8_t)((dest_r_y) >> 16); dest_scan += DestBpp; } break; @@ -653,9 +653,9 @@ void CStretchEngine::StretchVert() dest_scan[2] = r > 255 ? 255 : r < 0 ? 0 : r; } if (m_DestFormat == FXDIB_Argb) { - dest_scan[3] = (FX_BYTE)((dest_a) >> 16); + dest_scan[3] = (uint8_t)((dest_a) >> 16); } else { - *dest_sacn_mask = (FX_BYTE)((dest_a) >> 16); + *dest_sacn_mask = (uint8_t)((dest_a) >> 16); } dest_scan += DestBpp; if (dest_sacn_mask) { @@ -798,9 +798,9 @@ FX_BOOL CFX_ImageStretcher::StartQuickStretch() return FALSE; } size *= m_DestBPP; - m_pScanline = FX_Alloc(FX_BYTE, (size / 8 + 3) / 4 * 4); + m_pScanline = FX_Alloc(uint8_t, (size / 8 + 3) / 4 * 4); if (m_pSource->m_pAlphaMask) { - m_pMaskScanline = FX_Alloc(FX_BYTE, (m_ClipRect.Width() + 3) / 4 * 4); + m_pMaskScanline = FX_Alloc(uint8_t, (m_ClipRect.Width() + 3) / 4 * 4); } if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH_PIXELS) { ContinueQuickStretch(NULL); diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp index 12812b2f8d..74c4276695 100644 --- a/core/src/fxge/dib/fx_dib_main.cpp +++ b/core/src/fxge/dib/fx_dib_main.cpp @@ -62,8 +62,8 @@ CFX_DIBitmap::CFX_DIBitmap() FX_BOOL CFX_DIBitmap::Create(int width, int height, FXDIB_Format format, FX_LPBYTE pBuffer, int pitch) { m_pBuffer = NULL; - m_bpp = (FX_BYTE)format; - m_AlphaFlag = (FX_BYTE)(format >> 8); + m_bpp = (uint8_t)format; + m_AlphaFlag = (uint8_t)(format >> 8); m_Width = m_Height = m_Pitch = 0; if (width <= 0 || height <= 0 || pitch < 0) { return FALSE; @@ -84,12 +84,12 @@ FX_BOOL CFX_DIBitmap::Create(int width, int height, FXDIB_Format format, FX_LPBY int size = pitch * height + 4; int oomlimit = _MAX_OOM_LIMIT_; if (oomlimit >= 0 && size >= oomlimit) { - m_pBuffer = FX_TryAlloc(FX_BYTE, size); + m_pBuffer = FX_TryAlloc(uint8_t, size); if (m_pBuffer == NULL) { return FALSE; } } else { - m_pBuffer = FX_Alloc(FX_BYTE, size); + m_pBuffer = FX_Alloc(uint8_t, size); } } m_Width = width; @@ -273,14 +273,14 @@ int CFX_DIBSource::FindPalette(FX_DWORD color) const if (m_pPalette == NULL) { if (IsCmykImage()) { if (GetBPP() == 1) { - return ((FX_BYTE)color == 0xff) ? 0 : 1; + return ((uint8_t)color == 0xff) ? 0 : 1; } - return 0xff - (FX_BYTE)color; + return 0xff - (uint8_t)color; } if (GetBPP() == 1) { - return ((FX_BYTE)color == 0xff) ? 1 : 0; + return ((uint8_t)color == 0xff) ? 1 : 0; } - return (FX_BYTE)color; + return (uint8_t)color; } int palsize = (1 << GetBPP()); for (int i = 0; i < palsize; i ++) @@ -463,7 +463,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, int dest_top, int width, int h } } if(!IsCmykImage()) { - color_p[3] = (FX_BYTE)alpha; + color_p[3] = (uint8_t)alpha; } if (GetFormat() == FXDIB_Argb) { for (int row = 0; row < height; row ++) { @@ -886,12 +886,12 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) if (m_pPalette == NULL) { return FALSE; } - FX_BYTE gray[2]; + uint8_t gray[2]; for (int i = 0; i < 2; i ++) { - int r = (FX_BYTE)(m_pPalette[i] >> 16); - int g = (FX_BYTE)(m_pPalette[i] >> 8); - int b = (FX_BYTE)m_pPalette[i]; - gray[i] = (FX_BYTE)FXRGB2GRAY(r, g, b); + int r = (uint8_t)(m_pPalette[i] >> 16); + int g = (uint8_t)(m_pPalette[i] >> 8); + int b = (uint8_t)m_pPalette[i]; + gray[i] = (uint8_t)FXRGB2GRAY(r, g, b); } CFX_DIBitmap* pMask = FX_NEW CFX_DIBitmap; if (!pMask) { @@ -920,12 +920,12 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) if (m_pPalette == NULL) { return FALSE; } - FX_BYTE gray[256]; + uint8_t gray[256]; for (int i = 0; i < 256; i ++) { - int r = (FX_BYTE)(m_pPalette[i] >> 16); - int g = (FX_BYTE)(m_pPalette[i] >> 8); - int b = (FX_BYTE)m_pPalette[i]; - gray[i] = (FX_BYTE)FXRGB2GRAY(r, g, b); + int r = (uint8_t)(m_pPalette[i] >> 16); + int g = (uint8_t)(m_pPalette[i] >> 8); + int b = (uint8_t)m_pPalette[i]; + gray[i] = (uint8_t)FXRGB2GRAY(r, g, b); } CFX_DIBitmap* pMask = FX_NEW CFX_DIBitmap; if (!pMask) { @@ -1111,13 +1111,13 @@ void CFX_DIBitmap::SetPixel(int x, int y, FX_DWORD color) } break; case FXDIB_8bppMask: - *pos = (FX_BYTE)(color >> 24); + *pos = (uint8_t)(color >> 24); break; case FXDIB_8bppRgb: { if (m_pPalette) { for (int i = 0; i < 256; i ++) { if (m_pPalette[i] == color) { - *pos = (FX_BYTE)i; + *pos = (uint8_t)i; return; } } @@ -1246,7 +1246,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) int size = 1 << m_bpp; if (isCmykImage) { for (int i = 0; i < size; i ++) { - FX_BYTE b, g, r; + uint8_t b, g, r; AdobeCMYK_to_sRGB1(FXSYS_GetCValue(m_pPalette[i]), FXSYS_GetMValue(m_pPalette[i]), FXSYS_GetYValue(m_pPalette[i]), FXSYS_GetKValue(m_pPalette[i]), r, g, b); int gray = 255 - FXRGB2GRAY(r, g, b); @@ -1266,7 +1266,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) for (int row = 0; row < m_Height; row ++) { FX_LPBYTE scanline = m_pBuffer + row * m_Pitch; for (int col = 0; col < m_Width; col ++) { - FX_BYTE b, g, r; + uint8_t b, g, r; AdobeCMYK_to_sRGB1(scanline[0], scanline[1], scanline[2], scanline[3], r, g, b); *scanline ++ = 0; @@ -1295,7 +1295,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) for (int row = 0; row < m_Height; row ++) { FX_LPBYTE scanline = m_pBuffer + row * m_Pitch; for (int col = 0; col < m_Width; col ++) { - FX_BYTE b, g, r; + uint8_t b, g, r; AdobeCMYK_to_sRGB1(scanline[0], scanline[1], scanline[2], scanline[3], r, g, b); int gray = 255 - FXRGB2GRAY(r, g, b); @@ -1335,11 +1335,11 @@ FX_BOOL CFX_DIBitmap::DitherFS(const FX_DWORD* pPalette, int pal_size, const FX_ if (pRect) { rect.Intersect(*pRect); } - FX_BYTE translate[256]; + uint8_t translate[256]; for (int i = 0; i < 256; i ++) { int err2 = 65536; for (int j = 0; j < pal_size; j ++) { - FX_BYTE entry = (FX_BYTE)pPalette[j]; + uint8_t entry = (uint8_t)pPalette[j]; int err = (int)entry - i; if (err * err < err2) { err2 = err * err; @@ -1353,7 +1353,7 @@ FX_BOOL CFX_DIBitmap::DitherFS(const FX_DWORD* pPalette, int pal_size, const FX_ for (int col = rect.left; col < rect.right; col ++) { int src_pixel = scan[col]; int dest_pixel = translate[src_pixel]; - scan[col] = (FX_BYTE)dest_pixel; + scan[col] = (uint8_t)dest_pixel; int error = -dest_pixel + src_pixel; if (col < rect.right - 1) { int src = scan[col + 1]; @@ -1522,11 +1522,11 @@ void CFX_FilteredDIB::LoadSrc(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc) m_Width = pSrc->GetWidth(); m_Height = pSrc->GetHeight(); FXDIB_Format format = GetDestFormat(); - m_bpp = (FX_BYTE)format; - m_AlphaFlag = (FX_BYTE)(format >> 8); + m_bpp = (uint8_t)format; + m_AlphaFlag = (uint8_t)(format >> 8); m_Pitch = (m_Width * (format & 0xff) + 31) / 32 * 4; m_pPalette = GetDestPalette(); - m_pScanline = FX_Alloc(FX_BYTE, m_Pitch); + m_pScanline = FX_Alloc(uint8_t, m_Pitch); } FX_LPCBYTE CFX_FilteredDIB::GetScanline(int line) const { @@ -1641,7 +1641,7 @@ FX_BOOL CFX_ImageRenderer::Continue(IFX_Pause* pPause) if (pBitmap->IsAlphaMask()) { if (m_BitmapAlpha != 255) { if (m_AlphaFlag >> 8) { - m_AlphaFlag = (((FX_BYTE)((m_AlphaFlag & 0xff) * m_BitmapAlpha / 255)) | ((m_AlphaFlag >> 8) << 8)); + m_AlphaFlag = (((uint8_t)((m_AlphaFlag & 0xff) * m_BitmapAlpha / 255)) | ((m_AlphaFlag >> 8) << 8)); } else { m_MaskColor = FXARGB_MUL_ALPHA(m_MaskColor, m_BitmapAlpha); } diff --git a/core/src/fxge/dib/fx_dib_transform.cpp b/core/src/fxge/dib/fx_dib_transform.cpp index a9a1e66d99..7d91cdba4b 100644 --- a/core/src/fxge/dib/fx_dib_transform.cpp +++ b/core/src/fxge/dib/fx_dib_transform.cpp @@ -259,7 +259,7 @@ FX_BOOL CFX_ImageTransformer::Start(const CFX_DIBSource* pSrc, const CFX_AffineM m_Status = 3; return TRUE; } -FX_BYTE _bilinear_interpol(FX_LPCBYTE buf, int row_offset_l, int row_offset_r, +uint8_t _bilinear_interpol(FX_LPCBYTE 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) { @@ -272,23 +272,23 @@ FX_BYTE _bilinear_interpol(FX_LPCBYTE buf, int row_offset_l, int row_offset_r, 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; - FX_BYTE r_pos_0 = (*src_pos0 * i_resx + *src_pos1 * res_x) >> 8; - FX_BYTE r_pos_1 = (*src_pos2 * i_resx + *src_pos3 * res_x) >> 8; + 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; } -FX_BYTE _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(FX_LPCBYTE 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; for (int i = 0; i < 4; i ++) { int a_result = 0; for (int j = 0; j < 4; j ++) { - a_result += u_w[j] * (*(FX_BYTE*)(buf + pos_pixel[i + 4] * pitch + pos_pixel[j] * bpp + c_offset)); + a_result += u_w[j] * (*(uint8_t*)(buf + pos_pixel[i + 4] * pitch + pos_pixel[j] * bpp + c_offset)); } s_result += a_result * v_w[i]; } s_result >>= 16; - return (FX_BYTE)(s_result < 0 ? 0 : s_result > 255 ? 255 : s_result); + return (uint8_t)(s_result < 0 ? 0 : s_result > 255 ? 255 : s_result); } void _bicubic_get_pos_weight(int pos_pixel[], int u_w[], int v_w[], int src_col_l, int src_row_l, int res_x, int res_y, int stretch_width, int stretch_height) @@ -390,7 +390,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_BYTE* dest_pos_mask = (FX_BYTE*)pTransformed->m_pAlphaMask->GetScanline(row); + uint8_t* dest_pos_mask = (uint8_t*)pTransformed->m_pAlphaMask->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); @@ -419,7 +419,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_BYTE* dest_pos_mask = (FX_BYTE*)pTransformed->m_pAlphaMask->GetScanline(row); + uint8_t* dest_pos_mask = (uint8_t*)pTransformed->m_pAlphaMask->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); @@ -441,7 +441,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_BYTE* dest_pos_mask = (FX_BYTE*)pTransformed->m_pAlphaMask->GetScanline(row); + uint8_t* dest_pos_mask = (uint8_t*)pTransformed->m_pAlphaMask->GetScanline(row); for (int col = 0; col < m_ResultWidth; col ++) { int src_col, src_row; result2stretch_fix.Transform(col, row, src_col, src_row); @@ -555,7 +555,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_BYTE* dest_pos = (FX_BYTE*)pTransformed->GetScanline(row); + uint8_t* dest_pos = (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); @@ -578,9 +578,9 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) int row_offset_r = src_row_r * stretch_pitch; FX_DWORD r_bgra_cmyk = argb[_bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, 1, 0)]; if (transformF == FXDIB_Rgba) { - dest_pos[0] = (FX_BYTE)(r_bgra_cmyk >> 24); - dest_pos[1] = (FX_BYTE)(r_bgra_cmyk >> 16); - dest_pos[2] = (FX_BYTE)(r_bgra_cmyk >> 8); + dest_pos[0] = (uint8_t)(r_bgra_cmyk >> 24); + dest_pos[1] = (uint8_t)(r_bgra_cmyk >> 16); + dest_pos[2] = (uint8_t)(r_bgra_cmyk >> 8); } else { *(FX_DWORD*)dest_pos = r_bgra_cmyk; } @@ -591,7 +591,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_BYTE* dest_pos = (FX_BYTE*)pTransformed->GetScanline(row); + uint8_t* dest_pos = (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); @@ -607,9 +607,9 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) _bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l, res_x, res_y, stretch_width, stretch_height); FX_DWORD r_bgra_cmyk = argb[_bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, 1, 0)]; if (transformF == FXDIB_Rgba) { - dest_pos[0] = (FX_BYTE)(r_bgra_cmyk >> 24); - dest_pos[1] = (FX_BYTE)(r_bgra_cmyk >> 16); - dest_pos[2] = (FX_BYTE)(r_bgra_cmyk >> 8); + dest_pos[0] = (uint8_t)(r_bgra_cmyk >> 24); + dest_pos[1] = (uint8_t)(r_bgra_cmyk >> 16); + dest_pos[2] = (uint8_t)(r_bgra_cmyk >> 8); } else { *(FX_DWORD*)dest_pos = r_bgra_cmyk; } @@ -620,7 +620,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_BYTE* dest_pos = (FX_BYTE*)pTransformed->GetScanline(row); + uint8_t* dest_pos = (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); @@ -633,9 +633,9 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) } FX_DWORD r_bgra_cmyk = argb[stretch_buf[src_row * stretch_pitch + src_col]]; if (transformF == FXDIB_Rgba) { - dest_pos[0] = (FX_BYTE)(r_bgra_cmyk >> 24); - dest_pos[1] = (FX_BYTE)(r_bgra_cmyk >> 16); - dest_pos[2] = (FX_BYTE)(r_bgra_cmyk >> 8); + dest_pos[0] = (uint8_t)(r_bgra_cmyk >> 24); + dest_pos[1] = (uint8_t)(r_bgra_cmyk >> 16); + dest_pos[2] = (uint8_t)(r_bgra_cmyk >> 8); } else { *(FX_DWORD*)dest_pos = r_bgra_cmyk; } @@ -650,7 +650,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_BYTE* dest_pos = (FX_BYTE*)pTransformed->GetScanline(row); + uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row); for (int col = 0; col < m_ResultWidth; col ++) { int src_col_l, src_row_l, res_x, res_y, r_pos_k_r = 0; result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, res_y); @@ -671,9 +671,9 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) } int row_offset_l = src_row_l * stretch_pitch; int row_offset_r = src_row_r * stretch_pitch; - FX_BYTE r_pos_red_y_r = _bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, Bpp, 2); - FX_BYTE r_pos_green_m_r = _bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, Bpp, 1); - FX_BYTE r_pos_blue_c_r = _bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, Bpp, 0); + uint8_t r_pos_red_y_r = _bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, Bpp, 2); + uint8_t r_pos_green_m_r = _bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, Bpp, 1); + uint8_t r_pos_blue_c_r = _bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, Bpp, 0); if (bHasAlpha) { if (transformF != FXDIB_Argb) { if (transformF == FXDIB_Rgba) { @@ -685,7 +685,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) *(FX_DWORD*)dest_pos = FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r, r_pos_red_y_r, r_pos_k_r)); } } else { - FX_BYTE r_pos_a_r = _bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, Bpp, 3); + uint8_t r_pos_a_r = _bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, Bpp, 3); *(FX_DWORD*)dest_pos = FXARGB_TODIB(FXARGB_MAKE(r_pos_a_r, r_pos_red_y_r, r_pos_green_m_r, r_pos_blue_c_r)); } } else { @@ -704,7 +704,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_BYTE* dest_pos = (FX_BYTE*)pTransformed->GetScanline(row); + uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row); for (int col = 0; col < m_ResultWidth; col ++) { int src_col_l, src_row_l, res_x, res_y, r_pos_k_r = 0; result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, res_y); @@ -718,9 +718,9 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) src_row_l--; } _bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l, res_x, res_y, stretch_width, stretch_height); - FX_BYTE r_pos_red_y_r = _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 2); - FX_BYTE r_pos_green_m_r = _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 1); - FX_BYTE r_pos_blue_c_r = _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 0); + uint8_t r_pos_red_y_r = _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 2); + uint8_t r_pos_green_m_r = _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 1); + uint8_t r_pos_blue_c_r = _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 0); if (bHasAlpha) { if (transformF != FXDIB_Argb) { if (transformF == FXDIB_Rgba) { @@ -732,7 +732,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) *(FX_DWORD*)dest_pos = FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r, r_pos_red_y_r, r_pos_k_r)); } } else { - FX_BYTE r_pos_a_r = _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 3); + uint8_t r_pos_a_r = _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 3); *(FX_DWORD*)dest_pos = FXARGB_TODIB(FXARGB_MAKE(r_pos_a_r, r_pos_red_y_r, r_pos_green_m_r, r_pos_blue_c_r)); } } else { @@ -751,7 +751,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_BYTE* dest_pos = (FX_BYTE*)pTransformed->GetScanline(row); + uint8_t* dest_pos = (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); diff --git a/core/src/fxge/ge/fx_ge.cpp b/core/src/fxge/ge/fx_ge.cpp index d044d721e6..4cfa95b881 100644 --- a/core/src/fxge/ge/fx_ge.cpp +++ b/core/src/fxge/ge/fx_ge.cpp @@ -64,7 +64,7 @@ void CFX_GEModule::SetTextGamma(FX_FLOAT gammaValue) gammaValue /= 2.2f; int i = 0; while (i < 256) { - m_GammaValue[i] = (FX_BYTE)(FXSYS_pow((FX_FLOAT)i / 255, gammaValue) * 255.0f + 0.5f); + m_GammaValue[i] = (uint8_t)(FXSYS_pow((FX_FLOAT)i / 255, gammaValue) * 255.0f + 0.5f); i++; } } diff --git a/core/src/fxge/ge/fx_ge_device.cpp b/core/src/fxge/ge/fx_ge_device.cpp index 9c268b5606..0b4ffd5f4c 100644 --- a/core/src/fxge/ge/fx_ge_device.cpp +++ b/core/src/fxge/ge/fx_ge_device.cpp @@ -125,7 +125,7 @@ FX_BOOL CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData, FX_DWORD fill_color, FX_DWORD stroke_color, int fill_mode, int alpha_flag, void* pIccTransform, int blend_type) { - FX_BYTE fill_alpha, stroke_alpha; + uint8_t fill_alpha, stroke_alpha; if (FXGETFLAG_COLORTYPE(alpha_flag)) { fill_alpha = FXGETFLAG_ALPHA_FILL(alpha_flag); stroke_alpha = FXGETFLAG_ALPHA_STROKE(alpha_flag); diff --git a/core/src/fxge/ge/fx_ge_font.cpp b/core/src/fxge/ge/fx_ge_font.cpp index 46eecff323..4c6da4edc3 100644 --- a/core/src/fxge/ge/fx_ge_font.cpp +++ b/core/src/fxge/ge/fx_ge_font.cpp @@ -137,9 +137,9 @@ extern "C" { { } }; -FX_BOOL _LoadFile(FXFT_Library library, FXFT_Face* Face, IFX_FileRead* pFile, FXFT_Stream* stream, FX_INT32 faceIndex = 0) +FX_BOOL _LoadFile(FXFT_Library library, FXFT_Face* Face, IFX_FileRead* pFile, FXFT_Stream* stream, int32_t faceIndex = 0) { - FXFT_Stream stream1 = (FXFT_Stream)FX_Alloc(FX_BYTE, sizeof (FXFT_StreamRec)); + FXFT_Stream stream1 = (FXFT_Stream)FX_Alloc(uint8_t, sizeof (FXFT_StreamRec)); stream1->base = NULL; stream1->size = (unsigned long)pFile->GetSize(); stream1->pos = 0; @@ -209,7 +209,7 @@ static FXFT_Face FT_LoadFont(FX_LPBYTE pData, int size) } FX_BOOL CFX_Font::LoadEmbedded(FX_LPCBYTE data, FX_DWORD size) { - m_pFontDataAllocation = FX_Alloc(FX_BYTE, 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; diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp index acae306d6f..4df7def3b9 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -38,7 +38,7 @@ CTTFontDesc::~CTTFontDesc() FX_Free(m_pFontData); } } -FX_INT32 CTTFontDesc::ReleaseFace(FXFT_Face face) +int32_t CTTFontDesc::ReleaseFace(FXFT_Face face) { if (m_Type == 1) { if (m_SingleFace.m_pFace != face) { @@ -582,7 +582,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(FX_BYTE, size); + FX_LPBYTE buffer = FX_Alloc(uint8_t, size); m_pFontInfo->GetFontData(hFont, 0x6e616d65, buffer, size); result = _FPDF_GetNameFromTT(buffer, 6); FX_Free(buffer); @@ -661,7 +661,7 @@ CFX_ByteString CFX_FontMapper::MatchInstalledFonts(const CFX_ByteString& norm_na return match; } typedef struct _CHARSET_MAP_ { - FX_BYTE charset; + uint8_t charset; FX_WORD codepage; } CHARSET_MAP; static const CHARSET_MAP g_Codepage2CharsetTable[] = { @@ -697,11 +697,11 @@ static const CHARSET_MAP g_Codepage2CharsetTable[] = { { 88, 10029 }, { 89, 10007 }, }; -FX_BYTE _GetCharsetFromCodePage(FX_WORD codepage) +uint8_t _GetCharsetFromCodePage(FX_WORD codepage) { - FX_INT32 iEnd = sizeof(g_Codepage2CharsetTable) / sizeof(CHARSET_MAP) - 1; + int32_t iEnd = sizeof(g_Codepage2CharsetTable) / sizeof(CHARSET_MAP) - 1; FXSYS_assert(iEnd >= 0); - FX_INT32 iStart = 0, iMid; + int32_t iStart = 0, iMid; do { iMid = (iStart + iEnd) / 2; const CHARSET_MAP & cp = g_Codepage2CharsetTable[iMid]; @@ -841,7 +841,7 @@ static CFX_ByteString _GetFontFamily(CFX_ByteString fontName, int nStyle) }; typedef struct _FX_FontStyle { FX_LPCSTR style; - FX_INT32 len; + int32_t len; } FX_FontStyle; const FX_FontStyle g_FontStyles[] = { { "Bold", 4 }, @@ -865,9 +865,9 @@ CFX_ByteString ParseStyle(FX_LPCSTR pStyle, int iLen, int iIndex) } return buf.GetByteString(); } -FX_INT32 GetStyleType(const CFX_ByteString &bsStyle, FX_BOOL bRevert) +int32_t GetStyleType(const CFX_ByteString &bsStyle, FX_BOOL bRevert) { - FX_INT32 iLen = bsStyle.GetLength(); + int32_t iLen = bsStyle.GetLength(); if (!iLen) { return -1; } @@ -985,7 +985,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru } if (!bHasHypen) { int nLen = family.GetLength(); - FX_INT32 nRet = GetStyleType(family, TRUE); + int32_t nRet = GetStyleType(family, TRUE); if (nRet > -1) { family = family.Left(nLen - g_FontStyles[nRet].len); if (nRet == 0) { @@ -1017,7 +1017,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru CFX_ByteString buf; while (i < nLen) { buf = ParseStyle(pStyle, nLen, i); - FX_INT32 nRet = GetStyleType(buf, FALSE); + int32_t nRet = GetStyleType(buf, FALSE); if ((i && !bStyleAvail) || (!i && nRet < 0)) { family = SubstName; iBaseFont = 12; @@ -1218,7 +1218,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru } FXFT_Face face = NULL; if (ttc_size) { - FX_BYTE temp[1024]; + uint8_t temp[1024]; m_pFontInfo->GetFontData(hFont, 0x74746366, temp, 1024); FX_DWORD checksum = 0; for (int i = 0; i < 256; i ++) { @@ -1227,7 +1227,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru FX_LPBYTE pFontData; face = m_pFontMgr->GetCachedTTCFace(ttc_size, checksum, ttc_size - font_size, pFontData); if (face == NULL) { - pFontData = FX_Alloc(FX_BYTE, ttc_size); + pFontData = FX_Alloc(uint8_t, ttc_size); m_pFontInfo->GetFontData(hFont, 0x74746366, pFontData, ttc_size); face = m_pFontMgr->AddCachedTTCFace(ttc_size, checksum, pFontData, ttc_size, ttc_size - font_size); @@ -1236,7 +1236,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru FX_LPBYTE pFontData; face = m_pFontMgr->GetCachedFace(SubstName, weight, bItalic, pFontData); if (face == NULL) { - pFontData = FX_Alloc(FX_BYTE, font_size); + pFontData = FX_Alloc(uint8_t, font_size); m_pFontInfo->GetFontData(hFont, 0, pFontData, font_size); face = m_pFontMgr->AddCachedFace(SubstName, weight, bItalic, pFontData, font_size, m_pFontInfo->GetFaceIndex(hFont)); } @@ -1303,7 +1303,7 @@ FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(FX_DWORD dwUnicode, FX_DWORD fl }
FXFT_Face face = NULL;
if (ttc_size) {
- FX_BYTE temp[1024];
+ uint8_t temp[1024];
m_pFontInfo->GetFontData(hFont, 0x74746366, temp, 1024);
FX_DWORD checksum = 0;
for (int i = 0; i < 256; i ++) {
@@ -1312,7 +1312,7 @@ FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(FX_DWORD dwUnicode, FX_DWORD fl FX_LPBYTE pFontData;
face = m_pFontMgr->GetCachedTTCFace(ttc_size, checksum, ttc_size - font_size, pFontData);
if (face == NULL) {
- pFontData = FX_Alloc(FX_BYTE, ttc_size);
+ pFontData = FX_Alloc(uint8_t, ttc_size);
if (pFontData) {
m_pFontInfo->GetFontData(hFont, 0x74746366, pFontData, ttc_size);
face = m_pFontMgr->AddCachedTTCFace(ttc_size, checksum, pFontData, ttc_size,
@@ -1325,7 +1325,7 @@ FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(FX_DWORD dwUnicode, FX_DWORD fl FX_LPBYTE pFontData;
face = m_pFontMgr->GetCachedFace(SubstName, weight, bItalic, pFontData);
if (face == NULL) {
- pFontData = FX_Alloc(FX_BYTE, font_size);
+ pFontData = FX_Alloc(uint8_t, font_size);
if (!pFontData) {
m_pFontInfo->DeleteFont(hFont);
return NULL;
@@ -1454,7 +1454,7 @@ void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path) } FXSYS_fseek(pFile, 0, FXSYS_SEEK_END); FX_DWORD filesize = FXSYS_ftell(pFile); - FX_BYTE buffer[16]; + uint8_t buffer[16]; FXSYS_fseek(pFile, 0, FXSYS_SEEK_SET); size_t readCnt = FXSYS_fread(buffer, 12, 1, pFile); if (readCnt != 1) { @@ -1469,7 +1469,7 @@ void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path) return; } FX_DWORD face_bytes = nFaces * 4; - FX_LPBYTE offsets = FX_Alloc(FX_BYTE, face_bytes); + FX_LPBYTE offsets = FX_Alloc(uint8_t, face_bytes); readCnt = FXSYS_fread(offsets, face_bytes, 1, pFile); if (readCnt != face_bytes) { FX_Free(offsets); diff --git a/core/src/fxge/ge/fx_ge_linux.cpp b/core/src/fxge/ge/fx_ge_linux.cpp index ad0a70ab1f..5a0f0dffa5 100644 --- a/core/src/fxge/ge/fx_ge_linux.cpp +++ b/core/src/fxge/ge/fx_ge_linux.cpp @@ -56,7 +56,7 @@ static const FX_LPCSTR g_LinuxB5FontList[] = { static const FX_LPCSTR g_LinuxHGFontList[] = { "UnDotum", }; -static FX_INT32 GetJapanesePreference(FX_LPCSTR facearr, int weight, int picth_family) +static int32_t GetJapanesePreference(FX_LPCSTR 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) { @@ -94,35 +94,35 @@ void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int p FX_BOOL bCJK = TRUE; switch (charset) { case FXFONT_SHIFTJIS_CHARSET: { - FX_INT32 index = GetJapanesePreference(cstr_face, weight, pitch_family); + int32_t index = GetJapanesePreference(cstr_face, weight, pitch_family); if (index < 0) { break; } - for (FX_INT32 i = 0; i < LINUX_GPNAMESIZE; i++) + for (int32_t i = 0; i < LINUX_GPNAMESIZE; i++) if (m_FontList.Lookup(LinuxGpFontList[index].NameArr[i], p)) { return p; } } break; case FXFONT_GB2312_CHARSET: { - static FX_INT32 s_gbCount = sizeof(g_LinuxGbFontList) / sizeof(FX_LPCSTR); - for (FX_INT32 i = 0; i < s_gbCount; i++) + static int32_t s_gbCount = sizeof(g_LinuxGbFontList) / sizeof(FX_LPCSTR); + for (int32_t i = 0; i < s_gbCount; i++) if (m_FontList.Lookup(g_LinuxGbFontList[i], p)) { return p; } } break; case FXFONT_CHINESEBIG5_CHARSET: { - static FX_INT32 s_b5Count = sizeof(g_LinuxB5FontList) / sizeof(FX_LPCSTR); - for (FX_INT32 i = 0; i < s_b5Count; i++) + static int32_t s_b5Count = sizeof(g_LinuxB5FontList) / sizeof(FX_LPCSTR); + for (int32_t i = 0; i < s_b5Count; i++) if (m_FontList.Lookup(g_LinuxB5FontList[i], p)) { return p; } } break; case FXFONT_HANGEUL_CHARSET: { - static FX_INT32 s_hgCount = sizeof(g_LinuxHGFontList) / sizeof(FX_LPCSTR); - for (FX_INT32 i = 0; i < s_hgCount; i++) + static int32_t s_hgCount = sizeof(g_LinuxHGFontList) / sizeof(FX_LPCSTR); + for (int32_t i = 0; i < s_hgCount; i++) if (m_FontList.Lookup(g_LinuxHGFontList[i], p)) { return p; } @@ -157,9 +157,9 @@ static FX_DWORD _LinuxGetCharset(int charset) } return 0; } -static FX_INT32 _LinuxGetSimilarValue(int weight, FX_BOOL bItalic, int pitch_family, FX_DWORD style) +static int32_t _LinuxGetSimilarValue(int weight, FX_BOOL bItalic, int pitch_family, FX_DWORD style) { - FX_INT32 iSimilarValue = 0; + int32_t iSimilarValue = 0; if ((style & FXFONT_BOLD) == (weight > 400)) { iSimilarValue += 16; } @@ -181,7 +181,7 @@ void* CFX_LinuxFontInfo::FindFont(int weight, FX_BOOL bItalic, int charset, int { CFontFaceInfo* pFind = NULL; FX_DWORD charset_flag = _LinuxGetCharset(charset); - FX_INT32 iBestSimilar = 0; + int32_t iBestSimilar = 0; FX_POSITION pos = m_FontList.GetStartPosition(); while (pos) { CFX_ByteString bsName; @@ -190,8 +190,8 @@ void* CFX_LinuxFontInfo::FindFont(int weight, FX_BOOL bItalic, int charset, int if (!(pFont->m_Charsets & charset_flag) && charset != FXFONT_DEFAULT_CHARSET) { continue; } - FX_INT32 iSimilarValue = 0; - FX_INT32 index = bsName.Find(family); + int32_t iSimilarValue = 0; + int32_t index = bsName.Find(family); if (bMatchName && index < 0) { continue; } diff --git a/core/src/fxge/ge/fx_ge_ps.cpp b/core/src/fxge/ge/fx_ge_ps.cpp index 6522309f37..4ff40211d0 100644 --- a/core/src/fxge/ge/fx_ge_ps.cpp +++ b/core/src/fxge/ge/fx_ge_ps.cpp @@ -93,7 +93,7 @@ void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData, const CFX_AffineM CFX_ByteTextBuf buf; buf.EstimateSize(nPoints * 10); for (int i = 0; i < nPoints; i ++) { - FX_BYTE flag = pPathData->GetFlag(i); + uint8_t flag = pPathData->GetFlag(i); FX_FLOAT x = pPathData->GetPointX(i); FX_FLOAT y = pPathData->GetPointY(i); if (pObject2Device) { @@ -348,7 +348,7 @@ 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(FX_BYTE, src_size); + FX_LPBYTE src_buf = FX_Alloc(uint8_t, src_size); for (int row = 0; row < height; row ++) { FX_LPCBYTE src_scan = pSource->GetScanline(row); FXSYS_memcpy32(src_buf + row * pitch, src_scan, pitch); @@ -421,7 +421,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, if (filter == NULL) { int src_pitch = width * Bpp; output_size = height * src_pitch; - output_buf = FX_Alloc(FX_BYTE, output_size); + 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; diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp index 88f2967132..1aabbedd5b 100644 --- a/core/src/fxge/ge/fx_ge_text.cpp +++ b/core/src/fxge/ge/fx_ge_text.cpp @@ -78,7 +78,7 @@ static void _AdjustGlyphSpace(FXTEXT_GLYPHPOS* pGlyphAndPos, int nChars) next_origin_f = this_origin_f; } } -static const FX_BYTE g_TextGammaAdjust[256] = { +static const uint8_t g_TextGammaAdjust[256] = { 0, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, @@ -97,7 +97,7 @@ static const FX_BYTE g_TextGammaAdjust[256] = { 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 250, 251, 252, 253, 254, 255, }; #define ADJUST_ALPHA(background, foreground, src_alpha, text_flags, a) \ - src_alpha = g_TextGammaAdjust[(FX_BYTE)src_alpha]; + src_alpha = g_TextGammaAdjust[(uint8_t)src_alpha]; void _Color2Argb(FX_ARGB& argb, FX_DWORD color, int alpha_flag, void* pIccTransform) { if (pIccTransform == NULL && !FXGETFLAG_COLORTYPE(alpha_flag)) { @@ -107,7 +107,7 @@ void _Color2Argb(FX_ARGB& argb, FX_DWORD color, int alpha_flag, void* pIccTransf if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { pIccTransform = NULL; } - FX_BYTE bgra[4]; + uint8_t bgra[4]; if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); color = FXGETFLAG_COLORTYPE(alpha_flag) ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); @@ -441,7 +441,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar int src_alpha1 = (src_scan[0] + src_scan[1] + src_scan[2]) / 3; ADJUST_ALPHA(dest_scan[2], r, src_alpha1, nativetext_flags, a); src_alpha1 = src_alpha1 * a / 255; - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha1, r, g, b)); dest_scan += 4; @@ -453,7 +453,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar src_scan += 3; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; + uint8_t dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha1 * 255 / dest_alpha; dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); @@ -488,11 +488,11 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar dest_scan += 4; src_scan += 3; } else { - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha1, r, g, b)); } else { - FX_BYTE dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; + uint8_t dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha1 * 255 / dest_alpha; dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); @@ -526,7 +526,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar int src_alpha1 = (src_scan[-1] + src_scan[0] + src_scan[1]) / 3; ADJUST_ALPHA(dest_scan[2], r, src_alpha1, nativetext_flags, a); src_alpha1 = src_alpha1 * a / 255; - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha1, r, g, b)); dest_scan += 4; @@ -538,7 +538,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar src_scan += 3; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; + uint8_t dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha1 * 255 / dest_alpha; dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); @@ -573,11 +573,11 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar dest_scan += 4; src_scan += 3; } else { - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha1, r, g, b)); } else { - FX_BYTE dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; + uint8_t dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha1 * 255 / dest_alpha; dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); @@ -611,7 +611,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar int src_alpha1 = (src_scan[-2] + src_scan[-1] + src_scan[0]) / 3; ADJUST_ALPHA(dest_scan[2], r, src_alpha1, nativetext_flags, a); src_alpha1 = src_alpha1 * a / 255; - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha1, r, g, b)); dest_scan += 4; @@ -623,7 +623,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar src_scan += 3; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; + uint8_t dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha1 * 255 / dest_alpha; dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); @@ -1081,14 +1081,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)(FX_UINTPTR)glyph_index, (void*&)pGlyphBitmap)) { + if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(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)(FX_UINTPTR)glyph_index, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(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, @@ -1135,12 +1135,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)(FX_UINTPTR)glyph_index, (void*&)pGlyphBitmap)) { + if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(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)(FX_UINTPTR)glyph_index, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)glyph_index, pGlyphBitmap); return pGlyphBitmap; } } else { @@ -1151,7 +1151,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD return NULL; } m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); - pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(FX_UINTPTR)glyph_index, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)glyph_index, pGlyphBitmap); return pGlyphBitmap; } } @@ -1222,7 +1222,7 @@ static const char g_AngleSkew[ANGLESKEW_ARRAY_SIZE] = { 36, 38, 40, 42, 45, 47, 49, 51, 53, 55, }; static const size_t WEIGHTPOW_ARRAY_SIZE = 100; -static const FX_BYTE g_WeightPow[WEIGHTPOW_ARRAY_SIZE] = { +static const uint8_t g_WeightPow[WEIGHTPOW_ARRAY_SIZE] = { 0, 3, 6, 7, 8, 9, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, @@ -1230,7 +1230,7 @@ static const FX_BYTE g_WeightPow[WEIGHTPOW_ARRAY_SIZE] = { 47, 47, 48, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, }; -static const FX_BYTE g_WeightPow_11[WEIGHTPOW_ARRAY_SIZE] = { +static const uint8_t g_WeightPow_11[WEIGHTPOW_ARRAY_SIZE] = { 0, 4, 7, 8, 9, 10, 12, 13, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 39, 39, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 46, @@ -1238,7 +1238,7 @@ static const FX_BYTE g_WeightPow_11[WEIGHTPOW_ARRAY_SIZE] = { 52, 52, 53, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 58, 58, 58, 58, 58, }; -static const FX_BYTE g_WeightPow_SHIFTJIS[WEIGHTPOW_ARRAY_SIZE] = { +static const uint8_t g_WeightPow_SHIFTJIS[WEIGHTPOW_ARRAY_SIZE] = { 0, 0, 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 21, 22, 24, 26, 28, 30, 32, 33, 35, 37, 39, 41, 43, 45, 48, 48, 48, 48, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 55, 55, @@ -1288,7 +1288,7 @@ static void _ContrastAdjust(FX_LPBYTE pDataIn, FX_LPBYTE pDataOut, int nWid, int } else if (temp < 0) { temp = 0; } - *pDstRow ++ = (FX_BYTE)temp; + *pDstRow ++ = (uint8_t)temp; } } } @@ -1381,13 +1381,13 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, FX_DWORD glyph_inde pGlyphBitmap->m_Top = FXFT_Get_Glyph_BitmapTop(m_Face); int dest_pitch = pGlyphBitmap->m_Bitmap.GetPitch(); int src_pitch = FXFT_Get_Bitmap_Pitch(FXFT_Get_Glyph_Bitmap(m_Face)); - FX_BYTE* pDestBuf = pGlyphBitmap->m_Bitmap.GetBuffer(); - FX_BYTE* pSrcBuf = (FX_BYTE*)FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(m_Face)); + uint8_t* pDestBuf = pGlyphBitmap->m_Bitmap.GetBuffer(); + uint8_t* pSrcBuf = (uint8_t*)FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(m_Face)); if (anti_alias != FXFT_RENDER_MODE_MONO && FXFT_Get_Bitmap_PixelMode(FXFT_Get_Glyph_Bitmap(m_Face)) == FXFT_PIXEL_MODE_MONO) { int bytes = anti_alias == FXFT_RENDER_MODE_LCD ? 3 : 1; for(int i = 0; i < bmheight; i++) for(int n = 0; n < bmwidth; n++) { - FX_BYTE data = (pSrcBuf[i * src_pitch + n / 8] & (0x80 >> (n % 8))) ? 255 : 0; + uint8_t data = (pSrcBuf[i * src_pitch + n / 8] & (0x80 >> (n % 8))) ? 255 : 0; for (int b = 0; b < bytes; b ++) { pDestBuf[i * dest_pitch + n * bytes + b] = data; } @@ -1501,11 +1501,11 @@ const CFX_PathData* CFX_FaceCache::LoadGlyphPath(CFX_Font* pFont, FX_DWORD glyph CFX_PathData* pGlyphPath = NULL; FX_LPVOID key; if (pFont->GetSubstFont()) - key = (FX_LPVOID)(FX_UINTPTR)(glyph_index + ((pFont->GetSubstFont()->m_Weight / 16) << 15) + + key = (FX_LPVOID)(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)(FX_UINTPTR)glyph_index; + key = (FX_LPVOID)(uintptr_t)glyph_index; } if (m_PathMap.Lookup(key, (FX_LPVOID&)pGlyphPath)) { return pGlyphPath; diff --git a/core/src/fxge/ge/text_int.h b/core/src/fxge/ge/text_int.h index c08b3e0630..39f6cb8567 100644 --- a/core/src/fxge/ge/text_int.h +++ b/core/src/fxge/ge/text_int.h @@ -44,7 +44,7 @@ public: FXFT_Face m_pFaces[16]; } m_TTCFace; }; - FX_BYTE* m_pFontData; + uint8_t* m_pFontData; int m_RefCount; }; class CFX_UnicodeEncoding : public IFX_FontEncoding diff --git a/core/src/fxge/skia/fx_skia_blitter_new.cpp b/core/src/fxge/skia/fx_skia_blitter_new.cpp index a107485d72..3b3bd3349c 100644 --- a/core/src/fxge/skia/fx_skia_blitter_new.cpp +++ b/core/src/fxge/skia/fx_skia_blitter_new.cpp @@ -74,13 +74,13 @@ } /*---------------------------------------------------------------------------------------------------*/ void CFX_SkiaRenderer::CompositeSpan1bpp_0(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { ASSERT(!m_bRgbByteOrder); ASSERT(!m_pDevice->IsCmykImage()); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left/8; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left/8; 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); if (col_end < col_start) return; // do nothing. @@ -88,7 +88,7 @@ int index = 0; if (m_pDevice->GetPalette() == NULL) - index = ((FX_BYTE)m_Color == 0xff) ? 1 : 0; + index = ((uint8_t)m_Color == 0xff) ? 1 : 0; else { for (int i = 0; i < 2; i ++) if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) @@ -107,14 +107,14 @@ } } void CFX_SkiaRenderer::CompositeSpan1bpp_4(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { ASSERT(!m_bRgbByteOrder); ASSERT(!m_pDevice->IsCmykImage()); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left/8; - clip_scan = (FX_BYTE*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left/8; + clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; 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); if (col_end < col_start) return; // do nothing. @@ -122,7 +122,7 @@ int index = 0; if (m_pDevice->GetPalette() == NULL) - index = ((FX_BYTE)m_Color == 0xff) ? 1 : 0; + index = ((uint8_t)m_Color == 0xff) ? 1 : 0; else { for (int i = 0; i < 2; i ++) if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) @@ -143,13 +143,13 @@ } /*-----------------------------------------------------------------------------------------------------*/ void CFX_SkiaRenderer::CompositeSpanGray_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { ASSERT(!m_pDevice->IsCmykImage()); ASSERT(!m_bRgbByteOrder); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left; 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); if (col_end < col_start) return; // do nothing. @@ -165,14 +165,14 @@ } } void CFX_SkiaRenderer::CompositeSpanGray_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { ASSERT(!m_pDevice->IsCmykImage()); ASSERT(!m_bRgbByteOrder); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left; - ori_scan = (FX_BYTE*)m_pOriDevice->GetScanline(span_top) + span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left; + ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span_left; 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); if (col_end < col_start) return; // do nothing. @@ -208,13 +208,13 @@ } void CFX_SkiaRenderer::CompositeSpanGray_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { ASSERT(!m_bRgbByteOrder); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left; - clip_scan = (FX_BYTE*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left; + clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; 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); if (col_end < col_start) return; // do nothing. @@ -236,14 +236,14 @@ } void CFX_SkiaRenderer::CompositeSpanGray_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { ASSERT(!m_pDevice->IsCmykImage()); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left; - ori_scan = (FX_BYTE*)m_pOriDevice->GetScanline(span_top) + span_left; - clip_scan = (FX_BYTE*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left; + ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span_left; + clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; 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); if (col_end < col_start) return; // do nothing. @@ -296,11 +296,11 @@ /*--------------------------------------------------------------------------------------------------*/ void CFX_SkiaRenderer::CompositeSpanARGB_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + (span_left<<2); + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); 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); if (col_end < col_start) return; // do nothing. @@ -331,7 +331,7 @@ dest_scan += 2; continue; } - FX_BYTE dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255; + uint8_t dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha*255/dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio); @@ -344,13 +344,13 @@ } void CFX_SkiaRenderer::CompositeSpanARGB_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { ASSERT(!m_pDevice->IsCmykImage()); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + (span_left<<2); - //ori_scan = (FX_BYTE*)m_pOriDevice->GetScanline(span_top) + (span_left<<2); + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); + //ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left<<2); 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); if (col_end < col_start) return; // do nothing. @@ -393,12 +393,12 @@ } } void CFX_SkiaRenderer::CompositeSpanARGB_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + (span_left<<2); - clip_scan = (FX_BYTE*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; + 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; 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); if (col_end < col_start) return; // do nothing. @@ -425,7 +425,7 @@ dest_scan += 2; continue; } - FX_BYTE dest_alpha = dest_scan[3] + src_alpha1 - dest_scan[3] * src_alpha1 / 255; + uint8_t dest_alpha = dest_scan[3] + src_alpha1 - dest_scan[3] * src_alpha1 / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha1*255/dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio); @@ -459,7 +459,7 @@ dest_scan += 2; continue; } - FX_BYTE dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255; + uint8_t dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha*255/dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio); @@ -492,7 +492,7 @@ dest_scan += 2; continue; } - FX_BYTE dest_alpha = dest_scan[3] + src_alpha1 - dest_scan[3] * src_alpha1 / 255; + uint8_t dest_alpha = dest_scan[3] + src_alpha1 - dest_scan[3] * src_alpha1 / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha1*255/dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio); @@ -508,14 +508,14 @@ } void CFX_SkiaRenderer::CompositeSpanARGB_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { ASSERT(!m_pDevice->IsCmykImage()); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + (span_left<<2); - //ori_scan = (FX_BYTE*)m_pOriDevice->GetScanline(span_top) + (span_left<<2); - clip_scan = (FX_BYTE*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); + //ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left<<2); + clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; 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); if (col_end < col_start) return; // do nothing. @@ -558,11 +558,11 @@ /*-----------------------------------------------------------------------------------------------------------*/ void CFX_SkiaRenderer::CompositeSpanRGB32_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + (span_left<<2); + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); 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); if (col_end < col_start) return; // do nothing. @@ -589,12 +589,12 @@ } } void CFX_SkiaRenderer::CompositeSpanRGB32_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + (span_left<<2); - ori_scan = (FX_BYTE*)m_pOriDevice->GetScanline(span_top) + (span_left<<2); + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); + ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left<<2); 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); if (col_end < col_start) return; // do nothing. @@ -628,12 +628,12 @@ } } void CFX_SkiaRenderer::CompositeSpanRGB32_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + (span_left<<2); - clip_scan = (FX_BYTE*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; + 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; 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); if (col_end < col_start) return; // do nothing. @@ -706,14 +706,14 @@ #endif } void CFX_SkiaRenderer::CompositeSpanRGB32_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { ASSERT(!m_pDevice->IsCmykImage()); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + (span_left<<2); - ori_scan = (FX_BYTE*)m_pOriDevice->GetScanline(span_top) + (span_left<<2); - clip_scan = (FX_BYTE*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); + ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left<<2); + clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; 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); if (col_end < col_start) return; // do nothing. @@ -785,11 +785,11 @@ } /*-----------------------------------------------------------------------------------------------------*/ void CFX_SkiaRenderer::CompositeSpanRGB24_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left + (span_left<<1); + 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; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -819,13 +819,13 @@ } } void CFX_SkiaRenderer::CompositeSpanRGB24_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { ASSERT(!m_pDevice->IsCmykImage()); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left + (span_left<<1); - ori_scan = (FX_BYTE*)m_pOriDevice->GetScanline(span_top) + span_left + (span_left<<1); + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left + (span_left<<1); + ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span_left + (span_left<<1); 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); if (col_end < col_start) return; // do nothing. @@ -860,12 +860,12 @@ } } void CFX_SkiaRenderer::CompositeSpanRGB24_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1); - clip_scan = (FX_BYTE*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; + 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; 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); if (col_end < col_start) return; // do nothing. @@ -940,14 +940,14 @@ #endif } void CFX_SkiaRenderer::CompositeSpanRGB24_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { ASSERT(!m_pDevice->IsCmykImage()); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1); - ori_scan = (FX_BYTE*)m_pOriDevice->GetScanline(span_top) + span_left+(span_left<<1); - clip_scan = (FX_BYTE*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1); + ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span_left+(span_left<<1); + clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; 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); if (col_end < col_start) return; // do nothing. @@ -1018,12 +1018,12 @@ #endif } void CFX_SkiaRenderer::CompositeSpanRGB24_10(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1); - dest_extra_alpha_scan = (FX_BYTE*)m_pDevice->m_pAlphaMask->GetScanline(span_top)+span_left; + 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; 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); if (col_end < col_start) return; // do nothing. @@ -1031,9 +1031,9 @@ #if 1 if (m_Alpha == 255 && cover_scan == 255) { for (int col = col_start; col < col_end; col ++) { - *dest_scan++ = (FX_BYTE)m_Blue; - *dest_scan++ = (FX_BYTE)m_Green; - *dest_scan++ = (FX_BYTE)m_Red; + *dest_scan++ = (uint8_t)m_Blue; + *dest_scan++ = (uint8_t)m_Green; + *dest_scan++ = (uint8_t)m_Red; *dest_extra_alpha_scan++ = 255; } return; @@ -1042,7 +1042,7 @@ for (int col = col_start; col < col_end; col ++) { // Dest format: Rgba // calculate destination alpha (it's union of source and dest alpha) - FX_BYTE dest_alpha = (*dest_extra_alpha_scan) + src_alpha - + uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha - (*dest_extra_alpha_scan) * src_alpha / 255; *dest_extra_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha*255/dest_alpha; @@ -1057,9 +1057,9 @@ if (m_bFullCover) { if (m_Alpha == 255) { for (int col = col_start; col < col_end; col ++) { - *dest_scan++ = (FX_BYTE)m_Blue; - *dest_scan++ = (FX_BYTE)m_Green; - *dest_scan++ = (FX_BYTE)m_Red; + *dest_scan++ = (uint8_t)m_Blue; + *dest_scan++ = (uint8_t)m_Green; + *dest_scan++ = (uint8_t)m_Red; *dest_extra_alpha_scan++ = 255; } return; @@ -1067,7 +1067,7 @@ for (int col = col_start; col < col_end; col ++) { // Dest format: Rgba // calculate destination alpha (it's union of source and dest alpha) - FX_BYTE dest_alpha = (*dest_extra_alpha_scan) + m_Alpha - + uint8_t dest_alpha = (*dest_extra_alpha_scan) + m_Alpha - (*dest_extra_alpha_scan) * m_Alpha / 255; *dest_extra_alpha_scan++ = dest_alpha; int alpha_ratio = m_Alpha*255/dest_alpha; @@ -1081,9 +1081,9 @@ } else { if (m_Alpha == 255 && cover_scan == 255) { for (int col = col_start; col < col_end; col ++) { - *dest_scan++ = (FX_BYTE)m_Blue; - *dest_scan++ = (FX_BYTE)m_Green; - *dest_scan++ = (FX_BYTE)m_Red; + *dest_scan++ = (uint8_t)m_Blue; + *dest_scan++ = (uint8_t)m_Green; + *dest_scan++ = (uint8_t)m_Red; *dest_extra_alpha_scan++ = 255; } return; @@ -1092,7 +1092,7 @@ for (int col = col_start; col < col_end; col ++) { // Dest format: Rgba // calculate destination alpha (it's union of source and dest alpha) - FX_BYTE dest_alpha = (*dest_extra_alpha_scan) + src_alpha - + uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha - (*dest_extra_alpha_scan) * src_alpha / 255; *dest_extra_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha*255/dest_alpha; @@ -1107,13 +1107,13 @@ #endif } void CFX_SkiaRenderer::CompositeSpanRGB24_14(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1); - dest_extra_alpha_scan = (FX_BYTE*)m_pDevice->m_pAlphaMask->GetScanline(span_top)+span_left; - clip_scan = (FX_BYTE*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; + 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; + clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; 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); if (col_end < col_start) return; // do nothing. @@ -1128,14 +1128,14 @@ continue; } if (src_alpha1 == 255) { - *dest_scan++ = (FX_BYTE)m_Blue; - *dest_scan++ = (FX_BYTE)m_Green; - *dest_scan++ = (FX_BYTE)m_Red; - *dest_extra_alpha_scan++ = (FX_BYTE)m_Alpha; + *dest_scan++ = (uint8_t)m_Blue; + *dest_scan++ = (uint8_t)m_Green; + *dest_scan++ = (uint8_t)m_Red; + *dest_extra_alpha_scan++ = (uint8_t)m_Alpha; } else { // Dest format: Rgba // calculate destination alpha (it's union of source and dest alpha) - FX_BYTE dest_alpha = (*dest_extra_alpha_scan) + src_alpha1 - + uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha1 - (*dest_extra_alpha_scan) * src_alpha1 / 255; *dest_extra_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha1*255/dest_alpha; @@ -1157,14 +1157,14 @@ continue; } if (src_alpha == 255) { - *dest_scan++ = (FX_BYTE)m_Blue; - *dest_scan++ = (FX_BYTE)m_Green; - *dest_scan++ = (FX_BYTE)m_Red; - *dest_extra_alpha_scan++ = (FX_BYTE)m_Alpha; + *dest_scan++ = (uint8_t)m_Blue; + *dest_scan++ = (uint8_t)m_Green; + *dest_scan++ = (uint8_t)m_Red; + *dest_extra_alpha_scan++ = (uint8_t)m_Alpha; } else { // Dest format: Rgba // calculate destination alpha (it's union of source and dest alpha) - FX_BYTE dest_alpha = (*dest_extra_alpha_scan) + src_alpha - + uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha - (*dest_extra_alpha_scan) * src_alpha / 255; *dest_extra_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha*255/dest_alpha; @@ -1186,14 +1186,14 @@ continue; } if (src_alpha1 == 255) { - *dest_scan++ = (FX_BYTE)m_Blue; - *dest_scan++ = (FX_BYTE)m_Green; - *dest_scan++ = (FX_BYTE)m_Red; - *dest_extra_alpha_scan++ = (FX_BYTE)m_Alpha; + *dest_scan++ = (uint8_t)m_Blue; + *dest_scan++ = (uint8_t)m_Green; + *dest_scan++ = (uint8_t)m_Red; + *dest_extra_alpha_scan++ = (uint8_t)m_Alpha; } else { // Dest format: Rgba // calculate destination alpha (it's union of source and dest alpha) - FX_BYTE dest_alpha = (*dest_extra_alpha_scan) + src_alpha1 - + uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha1 - (*dest_extra_alpha_scan) * src_alpha1 / 255; *dest_extra_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha1*255/dest_alpha; @@ -1212,7 +1212,7 @@ // 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, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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) { @@ -1243,11 +1243,11 @@ if (src_alpha) { if (src_alpha == 255) { *(FX_CMYK*)dest_scan = m_Color; - *dest_extra_alpha_scan = (FX_BYTE)m_Alpha; + *dest_extra_alpha_scan = (uint8_t)m_Alpha; } else { // Dest format: Cmyka // calculate destination alpha (it's union of source and dest alpha) - FX_BYTE dest_alpha = (*dest_extra_alpha_scan) + src_alpha - + uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha - (*dest_extra_alpha_scan) * src_alpha / 255; *dest_extra_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha*255/dest_alpha; @@ -1351,13 +1351,13 @@ } else { //Gray(a) device if (pIccTransform) { - FX_BYTE gray; + uint8_t gray; color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); pIccModule->TranslateScanline(pIccTransform, &gray, (FX_LPCBYTE)&color, 1); m_Gray = gray; } else { if (bObjectCMYK) { - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), FXSYS_GetYValue(color), FXSYS_GetKValue(color), r, g, b); m_Gray = FXRGB2GRAY(r, g, b); @@ -1404,7 +1404,7 @@ } } else { if (bObjectCMYK) { - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), FXSYS_GetYValue(color), FXSYS_GetKValue(color), r, g, b); m_Color = FXARGB_MAKE(m_Alpha, r, g, b); @@ -1552,7 +1552,7 @@ col_end = col_end < m_dstWidth ? col_end - m_Left: m_pDevice->GetWidth(); int result = col_end - col_start; if (result > 0) { - FX_BYTE* dest_pos = dest_scan + col_start; + uint8_t* dest_pos = dest_scan + col_start; if (result >= 4) FXSYS_memset32(dest_pos, 0xffffffff,result); else diff --git a/core/src/fxge/skia/fx_skia_blitter_new.h b/core/src/fxge/skia/fx_skia_blitter_new.h index 1193e64c1c..a80e56b2aa 100644 --- a/core/src/fxge/skia/fx_skia_blitter_new.h +++ b/core/src/fxge/skia/fx_skia_blitter_new.h @@ -30,7 +30,7 @@ protected: FX_LPBYTE m_pOriScan; FX_LPBYTE m_pClipScan; - void (CFX_SkiaRenderer::*composite_span)(FX_LPBYTE,FX_LPBYTE,int,int,int,int,FX_BYTE,int,int,int,FX_LPBYTE,FX_LPBYTE); + void (CFX_SkiaRenderer::*composite_span)(FX_LPBYTE,FX_LPBYTE,int,int,int,int,uint8_t,int,int,int,FX_LPBYTE,FX_LPBYTE); public: //-------------------------------------------------------------------- @@ -43,35 +43,35 @@ public: /*------------------------------------------------------------------------------------------------------*/ // A general alpha merge function (with clipping mask). Gray device. void CompositeSpan1bpp_0(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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); @@ -79,119 +79,119 @@ public: // A general alpha merge function (with clipping mask). Gray device. void CompositeSpanGray_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 CompositeSpanGray_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 CompositeSpanGray_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 CompositeSpanGray_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 CompositeSpanGray_10(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 CompositeSpanGray_11(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 CompositeSpanGray_14(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 CompositeSpanGray_15(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 CompositeSpanARGB_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 CompositeSpanARGB_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 CompositeSpanARGB_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 CompositeSpanARGB_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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 span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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); @@ -199,7 +199,7 @@ public: // A general alpha merge function (with clipping mask). Cmyka/Cmyk device. void CompositeSpanCMYK(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + 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); diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp index 3372af103d..7ebdcb380e 100644 --- a/core/src/fxge/win32/fx_win32_device.cpp +++ b/core/src/fxge/win32/fx_win32_device.cpp @@ -64,9 +64,9 @@ FX_BOOL CWin32FontInfo::IsOpenTypeFromDiv(const LOGFONTA *plf) FX_DWORD font_size = GetFontData(hFont, 0, NULL, 0); if (font_size != GDI_ERROR && font_size >= sizeof(FX_DWORD)) { FX_DWORD lVersion = 0; - GetFontData(hFont, 0, (FX_BYTE*)(&lVersion), sizeof(FX_DWORD)); - lVersion = (((FX_DWORD)(FX_BYTE)(lVersion)) << 24) | ((FX_DWORD)((FX_BYTE)(lVersion >> 8))) << 16 | - ((FX_DWORD)((FX_BYTE)(lVersion >> 16))) << 8 | ((FX_BYTE)(lVersion >> 24)); + GetFontData(hFont, 0, (uint8_t*)(&lVersion), sizeof(FX_DWORD)); + lVersion = (((FX_DWORD)(uint8_t)(lVersion)) << 24) | ((FX_DWORD)((uint8_t)(lVersion >> 8))) << 16 | + ((FX_DWORD)((uint8_t)(lVersion >> 16))) << 8 | ((uint8_t)(lVersion >> 24)); if (lVersion == TT_MAKE_TAG('O', 'T', 'T', 'O') || lVersion == 0x00010000 || lVersion == TT_MAKE_TAG('t', 't', 'c', 'f') || @@ -85,9 +85,9 @@ FX_BOOL CWin32FontInfo::IsSupportFontFormDiv(const LOGFONTA* plf) FX_DWORD font_size = GetFontData(hFont, 0, NULL, 0); if (font_size != GDI_ERROR && font_size >= sizeof(FX_DWORD)) { FX_DWORD lVersion = 0; - GetFontData(hFont, 0, (FX_BYTE*)(&lVersion), sizeof(FX_DWORD)); - lVersion = (((FX_DWORD)(FX_BYTE)(lVersion)) << 24) | ((FX_DWORD)((FX_BYTE)(lVersion >> 8))) << 16 | - ((FX_DWORD)((FX_BYTE)(lVersion >> 16))) << 8 | ((FX_BYTE)(lVersion >> 24)); + GetFontData(hFont, 0, (uint8_t*)(&lVersion), sizeof(FX_DWORD)); + lVersion = (((FX_DWORD)(uint8_t)(lVersion)) << 24) | ((FX_DWORD)((uint8_t)(lVersion >> 8))) << 16 | + ((FX_DWORD)((uint8_t)(lVersion >> 16))) << 8 | ((uint8_t)(lVersion >> 24)); if (lVersion == TT_MAKE_TAG('O', 'T', 'T', 'O') || lVersion == 0x00010000 || lVersion == TT_MAKE_TAG('t', 't', 'c', 'f') || @@ -145,7 +145,7 @@ FX_BOOL CWin32FontInfo::EnumFontList(CFX_FontMapper* pMapper) lf.lfCharSet = DEFAULT_CHARSET; lf.lfFaceName[0] = 0; lf.lfPitchAndFamily = 0; - EnumFontFamiliesExA(m_hDC, &lf, (FONTENUMPROCA)FontEnumProc, (FX_UINTPTR)this, 0); + EnumFontFamiliesExA(m_hDC, &lf, (FONTENUMPROCA)FontEnumProc, (uintptr_t)this, 0); if (pMapper->GetFontEnumerator()) { pMapper->GetFontEnumerator()->Finish(); } @@ -521,7 +521,7 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(const CFX_DIBitmap* pBitmap1, int de return FALSE; } CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); - if ((FX_INT64)abs(dest_width) * abs(dest_height) < (FX_INT64)pBitmap1->GetWidth() * pBitmap1->GetHeight() * 4 || + if ((int64_t)abs(dest_width) * abs(dest_height) < (int64_t)pBitmap1->GetWidth() * pBitmap1->GetHeight() * 4 || (flags & FXDIB_INTERPOL) || (flags & FXDIB_BICUBIC_INTERPOL)) { SetStretchBltMode(m_hDC, HALFTONE); } else { @@ -529,7 +529,7 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(const CFX_DIBitmap* pBitmap1, int de } CFX_DIBitmap* pToStrechBitmap = pBitmap; bool del = false; - if (m_DeviceClass == FXDC_PRINTER && ((FX_INT64)pBitmap->GetWidth() * pBitmap->GetHeight() > (FX_INT64)abs(dest_width) * abs(dest_height))) { + if (m_DeviceClass == FXDC_PRINTER && ((int64_t)pBitmap->GetWidth() * pBitmap->GetHeight() > (int64_t)abs(dest_width) * abs(dest_height))) { pToStrechBitmap = pBitmap->StretchTo(dest_width, dest_height); del = true; } diff --git a/core/src/fxge/win32/fx_win32_dib.cpp b/core/src/fxge/win32/fx_win32_dib.cpp index 0c6a7e1068..7706ee289e 100644 --- a/core/src/fxge/win32/fx_win32_dib.cpp +++ b/core/src/fxge/win32/fx_win32_dib.cpp @@ -71,7 +71,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(FX_BYTE, pitch); + FX_LPBYTE 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); @@ -210,7 +210,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC, HBITMAP hBitmap, FX_DWORD* pP if (bmih.biBitCount == 8) { size += sizeof (FX_DWORD) * 254; } - BITMAPINFO* pbmih = (BITMAPINFO*)FX_Alloc(FX_BYTE, size); + BITMAPINFO* pbmih = (BITMAPINFO*)FX_Alloc(uint8_t, size); pbmih->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); pbmih->bmiHeader.biBitCount = bmih.biBitCount; pbmih->bmiHeader.biCompression = BI_RGB; @@ -246,7 +246,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC, HBITMAP hBitmap, FX_DWORD* pP if (ret != 0 && bmih.biBitCount == 32) { int pitch = pDIBitmap->GetPitch(); for (int row = 0; row < height; row ++) { - FX_BYTE* dest_scan = (FX_BYTE*)(pDIBitmap->GetBuffer() + row * pitch); + uint8_t* dest_scan = (uint8_t*)(pDIBitmap->GetBuffer() + row * pitch); for (int col = 0; col < width; col++) { dest_scan[3] = 255; dest_scan += 4; diff --git a/core/src/fxge/win32/fx_win32_dwrite.cpp b/core/src/fxge/win32/fx_win32_dwrite.cpp index 022325b5ac..2a490a62a4 100644 --- a/core/src/fxge/win32/fx_win32_dwrite.cpp +++ b/core/src/fxge/win32/fx_win32_dwrite.cpp @@ -314,7 +314,7 @@ HRESULT STDMETHODCALLTYPE CDwFontFileStream::ReadFileFragment( { if (fileOffset <= resourceSize_ && fragmentSize <= resourceSize_ - fileOffset) { - *fragmentStart = static_cast<FX_BYTE const*>(resourcePtr_) + static_cast<size_t>(fileOffset); + *fragmentStart = static_cast<uint8_t const*>(resourcePtr_) + static_cast<size_t>(fileOffset); *fragmentContext = NULL; return S_OK; } else { diff --git a/core/src/fxge/win32/fx_win32_gdipext.cpp b/core/src/fxge/win32/fx_win32_gdipext.cpp index d2aafe09d5..fd31d2da66 100644 --- a/core/src/fxge/win32/fx_win32_gdipext.cpp +++ b/core/src/fxge/win32/fx_win32_gdipext.cpp @@ -220,7 +220,7 @@ typedef GpStatus (WINGDIPAPI *FuncType_GdipSetImagePalette)(GpImage *image, GDIP typedef GpStatus (WINGDIPAPI *FuncType_GdipSetInterpolationMode)(GpGraphics *graphics, InterpolationMode interpolationMode); typedef GpStatus (WINGDIPAPI *FuncType_GdipDrawImagePointsI)(GpGraphics *graphics, GpImage *image, GDIPCONST GpPoint *dstpoints, INT count); typedef GpStatus (WINGDIPAPI *FuncType_GdipCreateBitmapFromGdiDib)(GDIPCONST BITMAPINFO* gdiBitmapInfo, VOID* gdiBitmapData, GpBitmap** bitmap); -typedef Status (WINAPI *FuncType_GdiplusStartup)(OUT FX_UINTPTR *token, const GdiplusStartupInput *input, OUT GdiplusStartupOutput *output); +typedef Status (WINAPI *FuncType_GdiplusStartup)(OUT uintptr_t *token, const GdiplusStartupInput *input, OUT GdiplusStartupOutput *output); typedef GpStatus (WINGDIPAPI *FuncType_GdipDrawLineI)(GpGraphics *graphics, GpPen *pen, int x1, int y1, int x2, int y2); typedef GpStatus (WINGDIPAPI *FuncType_GdipResetClip)(GpGraphics *graphics); typedef GpStatus (WINGDIPAPI *FuncType_GdipCreatePath)(GpFillMode brushMode, GpPath **path); @@ -509,7 +509,7 @@ void CGdiplusExt::Load() return; } } - FX_UINTPTR gdiplusToken; + uintptr_t gdiplusToken; GdiplusStartupInput gdiplusStartupInput; ((FuncType_GdiplusStartup)m_Functions[FuncId_GdiplusStartup])(&gdiplusToken, &gdiplusStartupInput, NULL); m_GdiModule = LoadLibraryA("GDI32.DLL"); @@ -1047,7 +1047,7 @@ public: bytes_left = m_InterStream.GetLength() - m_ReadPos; bytes_out = FX_MIN(cb, bytes_left); FXSYS_memcpy32(Output, m_InterStream.GetBuffer() + m_ReadPos, bytes_out); - m_ReadPos += (FX_INT32)bytes_out; + m_ReadPos += (int32_t)bytes_out; if (pcbRead != NULL) { *pcbRead = (ULONG)bytes_out; } diff --git a/core/src/fxge/win32/fx_win32_print.cpp b/core/src/fxge/win32/fx_win32_print.cpp index 149df5058c..4ebeab9023 100644 --- a/core/src/fxge/win32/fx_win32_print.cpp +++ b/core/src/fxge/win32/fx_win32_print.cpp @@ -303,7 +303,7 @@ FX_BOOL CPSPrinterDriver::Init(HDC hDC, int pslevel, FX_BOOL bCmykOutput) if (ret == 1) { ret = ::GetRegionData(hRgn, 0, NULL); if (ret) { - RGNDATA* pData = (RGNDATA*)FX_Alloc(FX_BYTE, ret); + RGNDATA* pData = (RGNDATA*)FX_Alloc(uint8_t, ret); ret = ::GetRegionData(hRgn, ret, pData); if (ret) { CFX_PathData path; diff --git a/core/src/fxge/win32/win32_int.h b/core/src/fxge/win32/win32_int.h index 7c5c0720b1..a3380f3b5b 100644 --- a/core/src/fxge/win32/win32_int.h +++ b/core/src/fxge/win32/win32_int.h @@ -29,7 +29,7 @@ public: int fill_mode ); - void* LoadMemFont(FX_BYTE* pData, FX_DWORD size); + void* LoadMemFont(uint8_t* pData, FX_DWORD size); void DeleteMemFont(void* pFontCollection); FX_BOOL GdipCreateFromImage(void* bitmap, void** graphics); void GdipDeleteGraphics(void* graphics); diff --git a/core/src/reflow/autoreflow.cpp b/core/src/reflow/autoreflow.cpp index 8c37960932..77d60c4efa 100644 --- a/core/src/reflow/autoreflow.cpp +++ b/core/src/reflow/autoreflow.cpp @@ -416,7 +416,7 @@ void CPDF_AutoReflowLayoutProvider::GenerateParagraph(CFX_PtrArray& cellArray) void CPDF_AutoReflowLayoutProvider::ProcessObj(CFX_PtrArray& cellArray, CPDF_PageObject* pObj, CFX_AffineMatrix matrix) { } -FX_INT32 CPDF_AutoReflowLayoutProvider::LogicPreObj(CPDF_PageObject* pObj) +int32_t CPDF_AutoReflowLayoutProvider::LogicPreObj(CPDF_PageObject* pObj) { CPDF_PageObject* pPreObj = m_pPreObj; m_pPreObj = pObj; diff --git a/core/src/reflow/autoreflow.h b/core/src/reflow/autoreflow.h index 95aebcfcdc..20babd72da 100644 --- a/core/src/reflow/autoreflow.h +++ b/core/src/reflow/autoreflow.h @@ -105,7 +105,7 @@ public: int GetRectHeight(FX_RECT rect); int GetRectWidth(FX_RECT rect); void ProcessObj(CFX_PtrArray& cellArray, CPDF_PageObject* pObj, CFX_AffineMatrix matrix); - FX_INT32 LogicPreObj(CPDF_PageObject* pObj); + int32_t LogicPreObj(CPDF_PageObject* pObj); CPDF_AutoReflowElement* m_pRoot; CPDF_AutoReflowElement* m_pCurrElm; diff --git a/core/src/reflow/layoutprocessor_reflow.cpp b/core/src/reflow/layoutprocessor_reflow.cpp index d2fa7e9371..371f47e19c 100644 --- a/core/src/reflow/layoutprocessor_reflow.cpp +++ b/core/src/reflow/layoutprocessor_reflow.cpp @@ -407,10 +407,10 @@ FX_BOOL IsSameLine(FX_BOOL bHorizontal, CFX_FloatRect Rect1, CFX_FloatRect Rect2 } return TRUE; } -FX_INT32 IsCanMergeParagraph(IPDF_LayoutElement* pPrevElement, IPDF_LayoutElement* pNextElement) +int32_t IsCanMergeParagraph(IPDF_LayoutElement* pPrevElement, IPDF_LayoutElement* pNextElement) { - FX_INT32 analogial = 100; - FX_INT32 nPrevObj = pPrevElement->CountObjects(), i; + int32_t analogial = 100; + int32_t nPrevObj = pPrevElement->CountObjects(), i; CPDF_PageObject* pPrevObj = NULL; CFX_FloatRect prevRect, rect; CFX_PtrArray prevLine, line; @@ -449,7 +449,7 @@ FX_INT32 IsCanMergeParagraph(IPDF_LayoutElement* pPrevElement, IPDF_LayoutElemen CPDF_PageObject* pObj = pPrevElement->GetObject(nPrevObj - 1); if(pObj->m_Type == PDFPAGE_TEXT) { CPDF_TextObject* pText = (CPDF_TextObject*)pObj; - FX_INT32 nItem = pText->CountItems(); + int32_t nItem = pText->CountItems(); CPDF_TextObjectItem item; pText->GetItemInfo(nItem - 1, &item); CFX_WideString wStr = pText->GetFont()->UnicodeFromCharCode(item.m_CharCode); @@ -471,7 +471,7 @@ FX_INT32 IsCanMergeParagraph(IPDF_LayoutElement* pPrevElement, IPDF_LayoutElemen prevLine.RemoveAll(); prevLine.Append(line); line.RemoveAll(); - FX_INT32 nNextObj = pNextElement->CountObjects(); + int32_t nNextObj = pNextElement->CountObjects(); pPrevObj = NULL; FX_BOOL bFirst = TRUE; for(i = 0; i < nNextObj; i++) { @@ -522,7 +522,7 @@ void CPDF_LayoutProcessor_Reflow::ProcessElement(IPDF_LayoutElement* pElement, F } if(m_Status == LayoutReady) { LayoutType layoutType = pElement->GetType(); - FX_INT32 ElementType = GetElementTypes(layoutType); + int32_t ElementType = GetElementTypes(layoutType); switch(ElementType) { case SST_IE: m_bIllustration = TRUE; @@ -645,7 +645,7 @@ void CPDF_LayoutProcessor_Reflow::ProcessElement(IPDF_LayoutElement* pElement, F if(m_Status == LayoutReady) { FX_FLOAT dx = 0; LayoutType layoutType = pElement->GetType(); - FX_INT32 ElementType = GetElementTypes(layoutType); + int32_t ElementType = GetElementTypes(layoutType); switch(ElementType) { case SST_IE: m_bIllustration = FALSE; @@ -711,7 +711,7 @@ void CPDF_LayoutProcessor_Reflow::ProcessElement(IPDF_LayoutElement* pElement, F m_PausePosition = 100; } } -FX_INT32 CPDF_LayoutProcessor_Reflow::GetElementTypes(LayoutType layoutType) +int32_t CPDF_LayoutProcessor_Reflow::GetElementTypes(LayoutType layoutType) { switch(layoutType) { case LayoutParagraph: @@ -1210,7 +1210,7 @@ int CPDF_LayoutProcessor_Reflow::ProcessInsertObject(CPDF_TextObject* pObj, CFX_ } return 0; } -FX_INT32 CPDF_LayoutProcessor_Reflow::LogicPreObj(CPDF_TextObject* pObj) +int32_t CPDF_LayoutProcessor_Reflow::LogicPreObj(CPDF_TextObject* pObj) { CPDF_TextObject* pPreObj = m_pPreObj; m_pPreObj = pObj; @@ -1347,7 +1347,7 @@ void CPDF_LayoutProcessor_Reflow::ProcessTextObject(CPDF_TextObject *pTextObj, F return; } CPDF_PageObject* pPreObj = m_pPreObj; - FX_INT32 logic = ProcessInsertObject(pTextObj, objMatrix); + int32_t logic = ProcessInsertObject(pTextObj, objMatrix); m_pPreObj = pTextObj; m_perMatrix.Copy(objMatrix); int size = m_pTempLine->GetSize(); @@ -1542,7 +1542,7 @@ void CPDF_LayoutProcessor_Reflow::ProcessUnitaryObjs(CPDF_PageObjects *pObjs, FX while(pos) { CPDF_PageObject* pObj = pObjs->GetNextObject(pos); if(pObj->m_Type == PDFPAGE_TEXT) { - FX_INT32 ret = LogicPreObj((CPDF_TextObject*)pObj); + int32_t ret = LogicPreObj((CPDF_TextObject*)pObj); if(ret == 1 || ret == 2) { continue; } diff --git a/core/src/reflow/reflowedpage.cpp b/core/src/reflow/reflowedpage.cpp index 11baef8718..b7048b6840 100644 --- a/core/src/reflow/reflowedpage.cpp +++ b/core/src/reflow/reflowedpage.cpp @@ -151,14 +151,14 @@ CPDF_Dictionary* CPDF_ReflowedPage::GetFormResDict(CPDF_PageObject* pObj) } return pPageInfo->GetFormDict(); } -void CPDF_ReflowedPage::GetDisplayMatrix(CFX_AffineMatrix& matrix, FX_INT32 xPos, FX_INT32 yPos, FX_INT32 xSize, FX_INT32 ySize, FX_INT32 iRotate, const CFX_AffineMatrix* pPageMatrix) +void CPDF_ReflowedPage::GetDisplayMatrix(CFX_AffineMatrix& matrix, int32_t xPos, int32_t yPos, int32_t xSize, int32_t ySize, int32_t iRotate, const CFX_AffineMatrix* pPageMatrix) { CFX_AffineMatrix display_matrix; if(m_PageHeight == 0) { matrix.Set(1, 0, 0, -1, 0, 0); return; } - FX_INT32 x0, y0, x1, y1, x2, y2; + int32_t x0, y0, x1, y1, x2, y2; iRotate %= 4; switch (iRotate) { case 0: @@ -207,7 +207,7 @@ FX_FLOAT CPDF_ReflowedPage::GetPageHeight() { return m_PageHeight; } -void CPDF_ReflowedPage::FocusGetData(const CFX_AffineMatrix matrix, FX_INT32 x, FX_INT32 y, CFX_ByteString& str) +void CPDF_ReflowedPage::FocusGetData(const CFX_AffineMatrix matrix, int32_t x, int32_t y, CFX_ByteString& str) { if (NULL == m_pReflowed) { return; @@ -218,8 +218,8 @@ void CPDF_ReflowedPage::FocusGetData(const CFX_AffineMatrix matrix, FX_INT32 x, revMatrix.Transform((float)x, (float)y, x1, y1); int count = m_pReflowed->GetSize(); FX_FLOAT dx = 1000, dy = 1000; - FX_INT32 pos = 0; - FX_INT32 i; + int32_t pos = 0; + int32_t i; for(i = 0; i < count; i++) { CRF_Data* pData = (*m_pReflowed)[i]; FX_FLOAT tempdy = FXSYS_fabs(pData->m_PosY - y1); @@ -266,12 +266,12 @@ void CPDF_ReflowedPage::FocusGetData(const CFX_AffineMatrix matrix, FX_INT32 x, } str.Format("%d", pos); } -FX_BOOL CPDF_ReflowedPage::FocusGetPosition(const CFX_AffineMatrix matrix, CFX_ByteString str, FX_INT32& x, FX_INT32& y) +FX_BOOL CPDF_ReflowedPage::FocusGetPosition(const CFX_AffineMatrix matrix, CFX_ByteString str, int32_t& x, int32_t& y) { if (NULL == m_pReflowed) { return FALSE; } - FX_INT32 pos = FXSYS_atoi(str); + int32_t pos = FXSYS_atoi(str); if(pos < 0 || pos >= m_pReflowed->GetSize()) { return FALSE; } @@ -426,7 +426,7 @@ CPDF_ProgressiveReflowPageRender::CPDF_ProgressiveReflowPageRender() m_pFontEncoding = NULL; m_DisplayColor = -1; } -static FX_FLOAT _CIDTransformToFloat(FX_BYTE ch) +static FX_FLOAT _CIDTransformToFloat(uint8_t ch) { if (ch < 128) { return ch * 1.0f / 127; diff --git a/core/src/reflow/reflowedpage.h b/core/src/reflow/reflowedpage.h index 3fef553d7a..79b4937bdb 100644 --- a/core/src/reflow/reflowedpage.h +++ b/core/src/reflow/reflowedpage.h @@ -48,14 +48,14 @@ protected: void ProcessTextObject(CPDF_TextObject *pObj, FX_FLOAT reflowWidth, CFX_AffineMatrix objMatrix); void ProcessPathObject(CPDF_PathObject *pObj, FX_FLOAT reflowWidth); void ProcessUnitaryObjs(CPDF_PageObjects *pObjs, FX_FLOAT reflowWidth, CFX_AffineMatrix objMatrix); - FX_INT32 LogicPreObj(CPDF_TextObject* pObj); + int32_t LogicPreObj(CPDF_TextObject* pObj); int ProcessInsertObject(CPDF_TextObject* pObj, CFX_AffineMatrix formMatrix); FX_WCHAR GetPreChar(); FX_BOOL IsSameTextObject(CPDF_TextObject* pTextObj1, CPDF_TextObject* pTextObj2); int GetCharWidth(FX_DWORD charCode, CPDF_Font* pFont) const; FX_BOOL IsCanBreakAfter(FX_DWORD unicode); FX_BOOL IsCanBreakBefore(FX_DWORD unicode); - FX_INT32 GetElementTypes(LayoutType layoutType); + int32_t GetElementTypes(LayoutType layoutType); void CreateRFData(CPDF_PageObject* pObj, CFX_AffineMatrix* pMatrix = NULL); CRF_CharState* GetCharState(CPDF_TextObject* pObj, CPDF_Font* pFont, FX_FLOAT fHeight, FX_ARGB color); FX_FLOAT ConverWidth(FX_FLOAT width); @@ -169,15 +169,15 @@ public: { return this; }; - void GetDisplayMatrix(CFX_AffineMatrix& matrix, FX_INT32 xPos, FX_INT32 yPos, FX_INT32 xSize, FX_INT32 ySize, FX_INT32 iRotate, const CFX_AffineMatrix* pPageMatrix); + void GetDisplayMatrix(CFX_AffineMatrix& matrix, int32_t xPos, int32_t yPos, int32_t xSize, int32_t ySize, int32_t iRotate, const CFX_AffineMatrix* pPageMatrix); FX_FLOAT GetPageHeight() ; FX_FLOAT GetPageWidth() { return m_PageWidth; }; - void FocusGetData(const CFX_AffineMatrix matrix, FX_INT32 x, FX_INT32 y, CFX_ByteString& str); - FX_BOOL FocusGetPosition(const CFX_AffineMatrix matrix, CFX_ByteString str, FX_INT32& x, FX_INT32& y); + void FocusGetData(const CFX_AffineMatrix matrix, int32_t x, int32_t y, CFX_ByteString& str); + FX_BOOL FocusGetPosition(const CFX_AffineMatrix matrix, CFX_ByteString str, int32_t& x, int32_t& y); CRF_DataPtrArray* m_pReflowed; FX_FLOAT m_PageWidth; FX_FLOAT m_PageHeight; diff --git a/core/src/reflow/reflowedtextpage.h b/core/src/reflow/reflowedtextpage.h index 288ceed48b..bb6e24a9cd 100644 --- a/core/src/reflow/reflowedtextpage.h +++ b/core/src/reflow/reflowedtextpage.h @@ -11,7 +11,7 @@ #include "../../src/reflow/reflowedpage.h" typedef CFX_SegmentedArray<CRF_CharData*> CRF_CharDataPtrArray; -typedef CFX_SegmentedArray<FX_INT32> CFX_CountBSINT32Array; +typedef CFX_SegmentedArray<int32_t> CFX_CountBSINT32Array; class CRF_TextPage : public IPDF_TextPage { public: |