From bfa9a824a20f37c2dd7111012b46c929cf2ed8a0 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 9 Jun 2015 13:24:12 -0700 Subject: Merge to XFA: Use stdint.h types throughout PDFium. Near-automatic merge, plus re-running scripts to update additional usage. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1172793002 --- core/src/fxcodec/codec/codec_int.h | 38 ++-- core/src/fxcodec/codec/fx_codec.cpp | 36 ++-- core/src/fxcodec/codec/fx_codec_bmp.cpp | 10 +- core/src/fxcodec/codec/fx_codec_fax.cpp | 48 ++--- core/src/fxcodec/codec/fx_codec_flate.cpp | 134 ++++++------ core/src/fxcodec/codec/fx_codec_gif.cpp | 28 +-- core/src/fxcodec/codec/fx_codec_icc.cpp | 44 ++-- core/src/fxcodec/codec/fx_codec_jbig.cpp | 4 +- core/src/fxcodec/codec/fx_codec_jpeg.cpp | 30 +-- core/src/fxcodec/codec/fx_codec_jpx_opj.cpp | 8 +- core/src/fxcodec/codec/fx_codec_png.cpp | 2 +- core/src/fxcodec/codec/fx_codec_progress.cpp | 294 +++++++++++++-------------- core/src/fxcodec/codec/fx_codec_progress.h | 32 +-- core/src/fxcodec/codec/fx_codec_tiff.cpp | 90 ++++---- 14 files changed, 399 insertions(+), 399 deletions(-) (limited to 'core/src/fxcodec/codec') 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_MapPtrTemplateLookup(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_MapPtrTemplateLookup(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* 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* 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* 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* 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* 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* 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 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 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 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 inputs(nSrcComponents); - FX_BYTE* input = inputs; + CFX_FixedBufGrow 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(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(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); -- cgit v1.2.3