diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-06-09 11:30:25 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-06-09 11:30:25 -0700 |
commit | bb17868d736f698d5217c30d52c5bbfed62c5936 (patch) | |
tree | 9d4d3e2538a81e6241d4992570bc3f3c1af71d28 /core/src/fxcodec | |
parent | bf6c2a4873f8cc12ad910fb904218a78087a3735 (diff) | |
download | pdfium-bb17868d736f698d5217c30d52c5bbfed62c5936.tar.xz |
Use stdint.h types throughout PDFium.
It's redundant nowadays to provide our own equivalents, now
that this is done for us by the system header.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1177483002
Diffstat (limited to 'core/src/fxcodec')
21 files changed, 605 insertions, 605 deletions
diff --git a/core/src/fxcodec/codec/codec_int.h b/core/src/fxcodec/codec/codec_int.h index 2b693e88b6..d39a1fd18a 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); @@ -171,10 +171,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 ); @@ -210,14 +210,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) { @@ -228,11 +228,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 c325cccdd4..ee3ef8ce9d 100644 --- a/core/src/fxcodec/codec/fx_codec.cpp +++ b/core/src/fxcodec/codec/fx_codec.cpp @@ -119,7 +119,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; } @@ -127,7 +127,7 @@ void CCodec_ScanlineDecoder::DownScale(int dest_width, int dest_height) m_pDataCache->m_Width = m_OutputWidth; m_pDataCache->m_nCachedLines = 0; } -FX_BOOL CCodec_BasicModule::RunLengthEncode(const 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; @@ -236,7 +236,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; @@ -265,7 +265,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; @@ -273,7 +273,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) @@ -332,7 +332,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() @@ -368,7 +368,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) { @@ -381,7 +381,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; @@ -398,7 +398,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; @@ -417,7 +417,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_fax.cpp b/core/src/fxcodec/codec/fx_codec_fax.cpp index dc2ee2aacd..869751e05b 100644 --- a/core/src/fxcodec/codec/fx_codec_fax.cpp +++ b/core/src/fxcodec/codec/fx_codec_fax.cpp @@ -6,7 +6,7 @@ #include "../../../include/fxcodec/fx_codec.h" #include "codec_int.h" -const FX_BYTE OneLeadPos[256] = { +const uint8_t OneLeadPos[256] = { 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -24,7 +24,7 @@ const FX_BYTE OneLeadPos[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -const FX_BYTE ZeroLeadPos[256] = { +const uint8_t ZeroLeadPos[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -43,14 +43,14 @@ const FX_BYTE ZeroLeadPos[256] = { 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8, }; -int _FindBit(const FX_BYTE* data_buf, int max_pos, int start_pos, int bit) +int _FindBit(const uint8_t* data_buf, int max_pos, int start_pos, int bit) { if (start_pos >= max_pos) { return max_pos; } FX_LPCBYTE leading_pos = bit ? OneLeadPos : ZeroLeadPos; if (start_pos % 8) { - FX_BYTE data = data_buf[start_pos / 8]; + uint8_t data = data_buf[start_pos / 8]; if (bit) { data &= 0xff >> (start_pos % 8); } else { @@ -61,7 +61,7 @@ int _FindBit(const FX_BYTE* data_buf, int max_pos, int start_pos, int bit) } start_pos += 7; } - FX_BYTE skip = bit ? 0x00 : 0xff; + uint8_t skip = bit ? 0x00 : 0xff; int byte_pos = start_pos / 8; int max_byte = (max_pos + 7) / 8; while (byte_pos < max_byte) { @@ -79,12 +79,12 @@ int _FindBit(const FX_BYTE* data_buf, int max_pos, int start_pos, int bit) } return pos; } -void _FaxG4FindB1B2(const FX_BYTE* ref_buf, int columns, int a0, FX_BOOL a0color, int& b1, int& b2) +void _FaxG4FindB1B2(const uint8_t* ref_buf, int columns, int a0, FX_BOOL a0color, int& b1, int& b2) { if (a0color) { a0color = 1; } - FX_BYTE first_bit = (a0 < 0) ? 1 : ((ref_buf[a0 / 8] & (1 << (7 - a0 % 8))) != 0); + uint8_t first_bit = (a0 < 0) ? 1 : ((ref_buf[a0 / 8] & (1 << (7 - a0 % 8))) != 0); b1 = _FindBit(ref_buf, columns, a0 + 1, !first_bit); if (b1 >= columns) { b1 = b2 = columns; @@ -136,7 +136,7 @@ void _FaxFillBits(FX_LPBYTE dest_buf, int columns, int startpos, int endpos) #define NEXTBIT src_buf[bitpos/8] & (1 << (7-bitpos%8)); bitpos ++; #define ADDBIT(code, bit) code = code << 1; if (bit) code ++; #define GETBIT(bitpos) src_buf[bitpos/8] & (1 << (7-bitpos%8)) -static const FX_BYTE FaxBlackRunIns[] = { +static const uint8_t FaxBlackRunIns[] = { 0, 2, 0x02, 3, 0, @@ -256,7 +256,7 @@ static const FX_BYTE FaxBlackRunIns[] = { 0x77, 1216 % 256, 1216 / 256, 0xff }; -static const FX_BYTE FaxWhiteRunIns[] = { +static const uint8_t FaxWhiteRunIns[] = { 0, 0, 0, @@ -375,12 +375,12 @@ static const FX_BYTE FaxWhiteRunIns[] = { 0x1f, 2560 % 256, 2560 / 256, 0xff, }; -int _FaxGetRun(FX_LPCBYTE ins_array, const FX_BYTE* src_buf, int& bitpos, int bitsize) +int _FaxGetRun(FX_LPCBYTE ins_array, const uint8_t* src_buf, int& bitpos, int bitsize) { FX_DWORD code = 0; int ins_off = 0; while (1) { - FX_BYTE ins = ins_array[ins_off++]; + uint8_t ins = ins_array[ins_off++]; if (ins == 0xff) { return -1; } @@ -400,7 +400,7 @@ int _FaxGetRun(FX_LPCBYTE ins_array, const FX_BYTE* src_buf, int& bitpos, int bi } } } -FX_BOOL _FaxG4GetRow(const FX_BYTE* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, const FX_BYTE* ref_buf, int columns) +FX_BOOL _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, const uint8_t* ref_buf, int columns) { int a0 = -1, a0color = 1; while (1) { @@ -522,7 +522,7 @@ FX_BOOL _FaxG4GetRow(const FX_BYTE* src_buf, int bitsize, int& bitpos, FX_LPBYTE a0color = !a0color; } } -FX_BOOL _FaxSkipEOL(const FX_BYTE* src_buf, int bitsize, int& bitpos) +FX_BOOL _FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos) { int startbit = bitpos; while (bitpos < bitsize) { @@ -536,7 +536,7 @@ FX_BOOL _FaxSkipEOL(const FX_BYTE* src_buf, int bitsize, int& bitpos) } return FALSE; } -FX_BOOL _FaxGet1DLine(const FX_BYTE* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns) +FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns) { int color = TRUE; int startpos = 0; @@ -621,8 +621,8 @@ FX_BOOL CCodec_FaxDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int wid m_Pitch = (m_OrigWidth + 31) / 32 * 4; m_OutputWidth = m_OrigWidth; m_OutputHeight = m_OrigHeight; - m_pScanlineBuf = FX_Alloc(FX_BYTE, m_Pitch); - m_pRefBuf = FX_Alloc(FX_BYTE, m_Pitch); + m_pScanlineBuf = FX_Alloc(uint8_t, m_Pitch); + m_pRefBuf = FX_Alloc(uint8_t, m_Pitch); m_pSrcBuf = src_buf; m_SrcSize = src_size; m_nComps = 1; @@ -698,7 +698,7 @@ extern "C" { if (pitch == 0) { pitch = (width + 7) / 8; } - FX_LPBYTE ref_buf = FX_Alloc(FX_BYTE, pitch); + FX_LPBYTE ref_buf = FX_Alloc(uint8_t, pitch); FXSYS_memset8(ref_buf, 0xff, pitch); int bitpos = *pbitpos; for (int iRow = 0; iRow < height; iRow ++) { @@ -711,7 +711,7 @@ extern "C" { *pbitpos = bitpos; } }; -static const FX_BYTE BlackRunTerminator[128] = { +static const uint8_t BlackRunTerminator[128] = { 0x37, 10, 0x02, 3, 0x03, 2, 0x02, 2, 0x03, 3, 0x03, 4, 0x02, 4, 0x03, 5, 0x05, 6, 0x04, 6, 0x04, 7, 0x05, 7, 0x07, 7, 0x04, 8, 0x07, 8, 0x18, 9, 0x17, 10, 0x18, 10, 0x08, 10, 0x67, 11, 0x68, 11, 0x6c, 11, 0x37, 11, 0x28, 11, @@ -721,14 +721,14 @@ static const FX_BYTE BlackRunTerminator[128] = { 0x64, 12, 0x65, 12, 0x52, 12, 0x53, 12, 0x24, 12, 0x37, 12, 0x38, 12, 0x27, 12, 0x28, 12, 0x58, 12, 0x59, 12, 0x2b, 12, 0x2c, 12, 0x5a, 12, 0x66, 12, 0x67, 12, }; -static const FX_BYTE BlackRunMarkup[80] = { +static const uint8_t BlackRunMarkup[80] = { 0x0f, 10, 0xc8, 12, 0xc9, 12, 0x5b, 12, 0x33, 12, 0x34, 12, 0x35, 12, 0x6c, 13, 0x6d, 13, 0x4a, 13, 0x4b, 13, 0x4c, 13, 0x4d, 13, 0x72, 13, 0x73, 13, 0x74, 13, 0x75, 13, 0x76, 13, 0x77, 13, 0x52, 13, 0x53, 13, 0x54, 13, 0x55, 13, 0x5a, 13, 0x5b, 13, 0x64, 13, 0x65, 13, 0x08, 11, 0x0c, 11, 0x0d, 11, 0x12, 12, 0x13, 12, 0x14, 12, 0x15, 12, 0x16, 12, 0x17, 12, 0x1c, 12, 0x1d, 12, 0x1e, 12, 0x1f, 12, }; -static const FX_BYTE WhiteRunTerminator[128] = { +static const uint8_t WhiteRunTerminator[128] = { 0x35, 8, 0x07, 6, 0x07, 4, @@ -794,7 +794,7 @@ static const FX_BYTE WhiteRunTerminator[128] = { 0x33, 8, 0x34, 8, }; -static const FX_BYTE WhiteRunMarkup[80] = { +static const uint8_t WhiteRunMarkup[80] = { 0x1b, 5, 0x12, 5, 0x17, 6, @@ -935,9 +935,9 @@ CCodec_FaxEncoder::CCodec_FaxEncoder(FX_LPCBYTE src_buf, int width, int height, m_Cols = width; m_Rows = height; m_Pitch = pitch; - m_pRefLine = FX_Alloc(FX_BYTE, m_Pitch); + m_pRefLine = FX_Alloc(uint8_t, m_Pitch); FXSYS_memset8(m_pRefLine, 0xff, m_Pitch); - m_pLineBuf = FX_Alloc2D(FX_BYTE, m_Pitch, 8); + m_pLineBuf = FX_Alloc2D(uint8_t, m_Pitch, 8); m_DestBuf.EstimateSize(0, 10240); } CCodec_FaxEncoder::~CCodec_FaxEncoder() @@ -952,7 +952,7 @@ CCodec_FaxEncoder::~CCodec_FaxEncoder() void CCodec_FaxEncoder::Encode(FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { int dest_bitpos = 0; - FX_BYTE last_byte = 0; + uint8_t last_byte = 0; for (int i = 0; i < m_Rows; i ++) { FX_LPCBYTE scan_line = m_pSrcBuf + i * m_Pitch; FXSYS_memset32(m_pLineBuf, 0, m_Pitch * 8); diff --git a/core/src/fxcodec/codec/fx_codec_flate.cpp b/core/src/fxcodec/codec/fx_codec_flate.cpp index 7a19e8b855..9997a570d6 100644 --- a/core/src/fxcodec/codec/fx_codec_flate.cpp +++ b/core/src/fxcodec/codec/fx_codec_flate.cpp @@ -13,7 +13,7 @@ extern "C" { static void* my_alloc_func (void* opaque, unsigned int items, unsigned int size) { - return FX_Alloc2D(FX_BYTE, items, size); + return FX_Alloc2D(uint8_t, items, size); } static void my_free_func (void* opaque, void* address) { @@ -79,22 +79,22 @@ extern "C" class CLZWDecoder { public: - FX_BOOL Decode(FX_LPBYTE output, FX_DWORD& outlen, const FX_BYTE* input, FX_DWORD& size, FX_BOOL bEarlyChange); + FX_BOOL Decode(FX_LPBYTE output, FX_DWORD& outlen, const uint8_t* input, FX_DWORD& size, FX_BOOL bEarlyChange); private: FX_DWORD m_InPos; FX_DWORD m_OutPos; FX_LPBYTE m_pOutput; - const FX_BYTE* m_pInput; + const uint8_t* m_pInput; FX_BOOL m_Early; - void AddCode(FX_DWORD prefix_code, FX_BYTE append_char); + void AddCode(FX_DWORD prefix_code, uint8_t append_char); FX_DWORD m_CodeArray[5021]; FX_DWORD m_nCodes; - FX_BYTE m_DecodeStack[4000]; + uint8_t m_DecodeStack[4000]; FX_DWORD m_StackLen; void DecodeString(FX_DWORD code); int m_CodeLen; }; -void CLZWDecoder::AddCode(FX_DWORD prefix_code, FX_BYTE append_char) +void CLZWDecoder::AddCode(FX_DWORD prefix_code, uint8_t append_char) { if (m_nCodes + m_Early == 4094) { return; @@ -119,15 +119,15 @@ void CLZWDecoder::DecodeString(FX_DWORD code) if (m_StackLen >= sizeof(m_DecodeStack)) { return; } - m_DecodeStack[m_StackLen++] = (FX_BYTE)data; + m_DecodeStack[m_StackLen++] = (uint8_t)data; code = data >> 16; } if (m_StackLen >= sizeof(m_DecodeStack)) { return; } - m_DecodeStack[m_StackLen++] = (FX_BYTE)code; + m_DecodeStack[m_StackLen++] = (uint8_t)code; } -int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const FX_BYTE* src_buf, FX_DWORD& src_size, FX_BOOL bEarlyChange) +int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const uint8_t* src_buf, FX_DWORD& src_size, FX_BOOL bEarlyChange) { m_CodeLen = 9; m_InPos = 0; @@ -137,7 +137,7 @@ int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const FX_BYTE* m_Early = bEarlyChange ? 1 : 0; m_nCodes = 0; FX_DWORD old_code = (FX_DWORD) - 1; - FX_BYTE last_char; + uint8_t last_char; while (1) { if (m_InPos + m_CodeLen > src_size * 8) { break; @@ -164,10 +164,10 @@ int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const FX_BYTE* return -5; } if (m_pOutput) { - m_pOutput[m_OutPos] = (FX_BYTE)code; + m_pOutput[m_OutPos] = (uint8_t)code; } m_OutPos ++; - last_char = (FX_BYTE)code; + last_char = (uint8_t)code; if (old_code != (FX_DWORD) - 1) { AddCode(old_code, last_char); } @@ -217,19 +217,19 @@ int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const FX_BYTE* src_size = (m_InPos + 7) / 8; return 0; } -static FX_BYTE PaethPredictor(int a, int b, int c) +static uint8_t PaethPredictor(int a, int b, int c) { int p = a + b - c; int pa = FXSYS_abs(p - a); int pb = FXSYS_abs(p - b); int pc = FXSYS_abs(p - c); if (pa <= pb && pa <= pc) { - return (FX_BYTE)a; + return (uint8_t)a; } if (pb <= pc) { - return (FX_BYTE)b; + return (uint8_t)b; } - return (FX_BYTE)c; + return (uint8_t)c; } static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, int predictor, int Colors, @@ -241,7 +241,7 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, return FALSE; const int row_count = (data_size + row_size - 1) / row_size; const int last_row_size = data_size % row_size; - FX_LPBYTE dest_buf = FX_Alloc2D(FX_BYTE, row_size + 1, row_count); + FX_LPBYTE dest_buf = FX_Alloc2D(uint8_t, row_size + 1, row_count); int byte_cnt = 0; FX_LPBYTE pSrcData = data_buf; FX_LPBYTE pDestData = dest_buf; @@ -262,7 +262,7 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, switch (predictor) { case 11: { pDestData[0] = 1; - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pSrcData[byte - BytesPerPixel]; } @@ -271,7 +271,7 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; case 12: { pDestData[0] = 2; - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pSrcData[byte - row_size]; } @@ -280,11 +280,11 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; case 13: { pDestData[0] = 3; - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pSrcData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pSrcData[byte - row_size]; } @@ -293,15 +293,15 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; case 14: { pDestData[0] = 4; - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pSrcData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pSrcData[byte - row_size]; } - FX_BYTE upper_left = 0; + uint8_t upper_left = 0; if (byte >= BytesPerPixel && row) { upper_left = pSrcData[byte - row_size - BytesPerPixel]; } @@ -328,16 +328,16 @@ static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE { int row_size = (nPixels * bpc * nColors + 7) / 8; int BytesPerPixel = (bpc * nColors + 7) / 8; - FX_BYTE tag = pSrcData[0]; + uint8_t tag = pSrcData[0]; if (tag == 0) { FXSYS_memmove32(pDestData, pSrcData + 1, row_size); return; } for (int byte = 0; byte < row_size; byte ++) { - FX_BYTE raw_byte = pSrcData[byte + 1]; + uint8_t raw_byte = pSrcData[byte + 1]; switch (tag) { case 1: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } @@ -345,7 +345,7 @@ static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE break; } case 2: { - FX_BYTE up = 0; + uint8_t up = 0; if (pLastLine) { up = pLastLine[byte]; } @@ -353,11 +353,11 @@ static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE break; } case 3: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (pLastLine) { up = pLastLine[byte]; } @@ -365,15 +365,15 @@ static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE break; } case 4: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (pLastLine) { up = pLastLine[byte]; } - FX_BYTE upper_left = 0; + uint8_t upper_left = 0; if (byte >= BytesPerPixel && pLastLine) { upper_left = pLastLine[byte - BytesPerPixel]; } @@ -395,12 +395,12 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, return FALSE; const int row_count = (data_size + row_size) / (row_size + 1); const int last_row_size = data_size % (row_size + 1); - FX_LPBYTE dest_buf = FX_Alloc2D(FX_BYTE, row_size, row_count); + FX_LPBYTE dest_buf = FX_Alloc2D(uint8_t, row_size, row_count); int byte_cnt = 0; FX_LPBYTE pSrcData = data_buf; FX_LPBYTE pDestData = dest_buf; for (int row = 0; row < row_count; row ++) { - FX_BYTE tag = pSrcData[0]; + uint8_t tag = pSrcData[0]; byte_cnt++; if (tag == 0) { int move_size = row_size; @@ -414,10 +414,10 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, continue; } for (int byte = 0; byte < row_size && byte_cnt < (int)data_size; byte ++) { - FX_BYTE raw_byte = pSrcData[byte + 1]; + uint8_t raw_byte = pSrcData[byte + 1]; switch (tag) { case 1: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } @@ -425,7 +425,7 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; } case 2: { - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pDestData[byte - row_size]; } @@ -433,11 +433,11 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; } case 3: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pDestData[byte - row_size]; } @@ -445,15 +445,15 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; } case 4: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pDestData[byte - row_size]; } - FX_BYTE upper_left = 0; + uint8_t upper_left = 0; if (byte >= BytesPerPixel && row) { upper_left = pDestData[byte - row_size - BytesPerPixel]; } @@ -478,7 +478,7 @@ static void TIFF_PredictorEncodeLine(FX_LPBYTE dest_buf, int row_size, int BitsP { int BytesPerPixel = BitsPerComponent * Colors / 8; if (BitsPerComponent < 8) { - FX_BYTE mask = 0x01; + uint8_t mask = 0x01; if (BitsPerComponent == 2) { mask = 0x03; } else if (BitsPerComponent == 4) { @@ -490,8 +490,8 @@ static void TIFF_PredictorEncodeLine(FX_LPBYTE dest_buf, int row_size, int BitsP int index = i / 8; int col_pre = (col == 0) ? (8 - BitsPerComponent) : (col - BitsPerComponent); int index_pre = (col == 0) ? (index - 1) : index; - FX_BYTE cur = (dest_buf[index] >> (8 - col - BitsPerComponent)) & mask; - FX_BYTE left = (dest_buf[index_pre] >> (8 - col_pre - BitsPerComponent)) & mask; + uint8_t cur = (dest_buf[index] >> (8 - col - BitsPerComponent)) & mask; + uint8_t left = (dest_buf[index_pre] >> (8 - col_pre - BitsPerComponent)) & mask; cur -= left; cur &= mask; cur <<= (8 - col - BitsPerComponent); @@ -507,7 +507,7 @@ static void TIFF_PredictorEncodeLine(FX_LPBYTE dest_buf, int row_size, int BitsP FX_WORD pixel = (dest_buf[i] << 8) | dest_buf[i + 1]; pixel -= (dest_buf[i - BytesPerPixel] << 8) | dest_buf[i - BytesPerPixel + 1]; dest_buf[i] = pixel >> 8; - dest_buf[i + 1] = (FX_BYTE)pixel; + dest_buf[i + 1] = (uint8_t)pixel; } } } @@ -553,7 +553,7 @@ static void TIFF_PredictLine(FX_LPBYTE dest_buf, int row_size, int BitsPerCompon FX_WORD pixel = (dest_buf[i - BytesPerPixel] << 8) | dest_buf[i - BytesPerPixel + 1]; pixel += (dest_buf[i] << 8) | dest_buf[i + 1]; dest_buf[i] = pixel >> 8; - dest_buf[i + 1] = (FX_BYTE)pixel; + dest_buf[i + 1] = (uint8_t)pixel; } } else { for (int i = BytesPerPixel; i < row_size; i ++) { @@ -641,7 +641,7 @@ void CCodec_FlateScanlineDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, m_bpc = bpc; m_bColorTransformed = FALSE; m_Pitch = (width * nComps * bpc + 7) / 8; - m_pScanline = FX_Alloc(FX_BYTE, m_Pitch); + m_pScanline = FX_Alloc(uint8_t, m_Pitch); m_Predictor = 0; if (predictor) { if (predictor >= 10) { @@ -659,9 +659,9 @@ void CCodec_FlateScanlineDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, m_BitsPerComponent = BitsPerComponent; m_Columns = Columns; m_PredictPitch = (m_BitsPerComponent * m_Colors * m_Columns + 7) / 8; - m_pLastLine = FX_Alloc(FX_BYTE, m_PredictPitch); - m_pPredictRaw = FX_Alloc(FX_BYTE, m_PredictPitch + 1); - m_pPredictBuffer = FX_Alloc(FX_BYTE, m_PredictPitch); + m_pLastLine = FX_Alloc(uint8_t, m_PredictPitch); + m_pPredictRaw = FX_Alloc(uint8_t, m_PredictPitch + 1); + m_pPredictBuffer = FX_Alloc(uint8_t, m_PredictPitch); } } } @@ -737,7 +737,7 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig FX_DWORD last_buf_size = buf_size; void* context = nullptr; - FX_LPBYTE guess_buf = FX_Alloc(FX_BYTE, guess_size + 1); + FX_LPBYTE guess_buf = FX_Alloc(uint8_t, guess_size + 1); FX_LPBYTE cur_buf = guess_buf; guess_buf[guess_size] = '\0'; context = FPDFAPI_FlateInit(my_alloc_func, my_free_func); @@ -746,10 +746,10 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig FPDFAPI_FlateInput(context, src_buf, src_size); if (useOldImpl) { while (1) { - FX_INT32 ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size); + int32_t ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size); if (ret != Z_OK) break; - FX_INT32 avail_buf_size = FPDFAPI_FlateGetAvailOut(context); + int32_t avail_buf_size = FPDFAPI_FlateGetAvailOut(context); if (avail_buf_size != 0) break; @@ -758,7 +758,7 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig guess_size += alloc_step; if (guess_size < old_size || guess_size + 1 < guess_size) goto fail; - guess_buf = FX_Realloc(FX_BYTE, guess_buf, guess_size + 1); + guess_buf = FX_Realloc(uint8_t, guess_buf, guess_size + 1); if (!guess_buf) goto fail; guess_buf[guess_size] = '\0'; @@ -768,7 +768,7 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig dest_size = FPDFAPI_FlateGetTotalOut(context); offset = FPDFAPI_FlateGetTotalIn(context); if (guess_size / 2 > dest_size) { - guess_buf = FX_Realloc(FX_BYTE, guess_buf, dest_size + 1); + guess_buf = FX_Realloc(uint8_t, guess_buf, dest_size + 1); if (!guess_buf) goto fail; guess_size = dest_size; @@ -778,8 +778,8 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig } else { CFX_ArrayTemplate<FX_LPBYTE> result_tmp_bufs; while (1) { - FX_INT32 ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size); - FX_INT32 avail_buf_size = FPDFAPI_FlateGetAvailOut(context); + int32_t ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size); + int32_t avail_buf_size = FPDFAPI_FlateGetAvailOut(context); if (ret != Z_OK) { last_buf_size = buf_size - avail_buf_size; result_tmp_bufs.Add(cur_buf); @@ -793,7 +793,7 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig // |avail_buf_size| == 0 case. result_tmp_bufs.Add(cur_buf); - cur_buf = FX_Alloc(FX_BYTE, buf_size + 1); + cur_buf = FX_Alloc(uint8_t, buf_size + 1); cur_buf[buf_size] = '\0'; } dest_size = FPDFAPI_FlateGetTotalOut(context); @@ -801,9 +801,9 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig if (result_tmp_bufs.GetSize() == 1) { dest_buf = result_tmp_bufs[0]; } else { - FX_LPBYTE result_buf = FX_Alloc(FX_BYTE, dest_size); + FX_LPBYTE result_buf = FX_Alloc(uint8_t, dest_size); FX_DWORD result_pos = 0; - for (FX_INT32 i = 0; i < result_tmp_bufs.GetSize(); i++) { + for (int32_t i = 0; i < result_tmp_bufs.GetSize(); i++) { FX_LPBYTE tmp_buf = result_tmp_bufs[i]; FX_DWORD tmp_buf_size = buf_size; if (i == result_tmp_bufs.GetSize() - 1) { @@ -832,7 +832,7 @@ ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(FX_LPCBYTE src_buf, FX pDecoder->Create(src_buf, src_size, width, height, nComps, bpc, predictor, Colors, BitsPerComponent, Columns); return pDecoder; } -FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, +FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, int predictor, int Colors, int BitsPerComponent, int Columns, FX_DWORD estimated_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { @@ -859,7 +859,7 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_b } { nonstd::unique_ptr<CLZWDecoder> decoder(new CLZWDecoder); - dest_buf = FX_Alloc( FX_BYTE, dest_size + 1); + dest_buf = FX_Alloc( uint8_t, dest_size + 1); dest_buf[dest_size] = '\0'; decoder->Decode(dest_buf, dest_size, src_buf, offset, bEarlyChange); } @@ -879,7 +879,7 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_b } return ret ? offset : -1; } -FX_BOOL CCodec_FlateModule::Encode(const FX_BYTE* src_buf, FX_DWORD src_size, +FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { @@ -887,7 +887,7 @@ FX_BOOL CCodec_FlateModule::Encode(const FX_BYTE* src_buf, FX_DWORD src_size, return Encode(src_buf, src_size, dest_buf, dest_size); } FX_LPBYTE pSrcBuf = NULL; - pSrcBuf = FX_Alloc(FX_BYTE, src_size); + pSrcBuf = FX_Alloc(uint8_t, src_size); FXSYS_memcpy32(pSrcBuf, src_buf, src_size); FX_BOOL ret = TRUE; if (predictor == 2) { @@ -905,7 +905,7 @@ FX_BOOL CCodec_FlateModule::Encode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_BOOL CCodec_FlateModule::Encode(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { dest_size = src_size + src_size / 1000 + 12; - dest_buf = FX_Alloc( FX_BYTE, dest_size); + dest_buf = FX_Alloc( uint8_t, dest_size); unsigned long temp_size = dest_size; FPDFAPI_FlateCompress(dest_buf, &temp_size, src_buf, src_size); dest_size = (FX_DWORD)temp_size; diff --git a/core/src/fxcodec/codec/fx_codec_icc.cpp b/core/src/fxcodec/codec/fx_codec_icc.cpp index 26b4c1adfc..cde5d4c1bd 100644 --- a/core/src/fxcodec/codec/fx_codec_icc.cpp +++ b/core/src/fxcodec/codec/fx_codec_icc.cpp @@ -13,7 +13,7 @@ const FX_DWORD N_COMPONENT_RGB = 3; const FX_DWORD N_COMPONENT_CMYK = 4; const FX_DWORD N_COMPONENT_DEFAULT = 3; -FX_BOOL MD5ComputeID( FX_LPCVOID buf, FX_DWORD dwSize, FX_BYTE ID[16] ) +FX_BOOL MD5ComputeID( FX_LPCVOID buf, FX_DWORD dwSize, uint8_t ID[16] ) { return cmsMD5computeIDExt(buf, dwSize, ID); } @@ -65,7 +65,7 @@ FX_BOOL CheckComponents(cmsColorSpaceSignature cs, int nComponents, FX_BOOL bDst } return TRUE; } -FX_INT32 GetCSComponents(cmsColorSpaceSignature cs) +int32_t GetCSComponents(cmsColorSpaceSignature cs) { FX_DWORD components; switch (cs) { @@ -87,8 +87,8 @@ FX_INT32 GetCSComponents(cmsColorSpaceSignature cs) } return components; } -void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, FX_DWORD dwSrcProfileSize, FX_INT32& nSrcComponents, - const unsigned char* pDstProfileData, FX_DWORD dwDstProfileSize, FX_INT32 nDstComponents, +void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, + const unsigned char* pDstProfileData, FX_DWORD dwDstProfileSize, int32_t nDstComponents, int intent, FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT) { cmsHPROFILE srcProfile = NULL; @@ -157,7 +157,7 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, FX_DWORD dwSr cmsCloseProfile(dstProfile); return pCmm; } -void* IccLib_CreateTransform_sRGB(const unsigned char* pProfileData, FX_DWORD dwProfileSize, FX_INT32& nComponents, FX_INT32 intent, FX_DWORD dwSrcFormat) +void* IccLib_CreateTransform_sRGB(const unsigned char* pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent, FX_DWORD dwSrcFormat) { return IccLib_CreateTransform(pProfileData, dwProfileSize, nComponents, NULL, 0, 3, intent, dwSrcFormat); } @@ -175,7 +175,7 @@ void IccLib_Translate(void* pTransform, FX_DWORD nSrcComponents, FX_FLOAT* pSrcV return; } CLcmsCmm* p = (CLcmsCmm*)pTransform; - FX_BYTE output[4]; + uint8_t output[4]; if (p->m_bLab) { CFX_FixedBufGrow<double, 16> inputs(nSrcComponents); double* input = inputs; @@ -184,8 +184,8 @@ void IccLib_Translate(void* pTransform, FX_DWORD nSrcComponents, FX_FLOAT* pSrcV } cmsDoTransform(p->m_hTransform, input, output, 1); } else { - CFX_FixedBufGrow<FX_BYTE, 16> inputs(nSrcComponents); - FX_BYTE* input = inputs; + CFX_FixedBufGrow<uint8_t, 16> inputs(nSrcComponents); + uint8_t* input = inputs; for (FX_DWORD i = 0; i < nSrcComponents; i ++) { if (pSrcValues[i] > 1.0f) { input[i] = 255; @@ -214,7 +214,7 @@ void IccLib_Translate(void* pTransform, FX_DWORD nSrcComponents, FX_FLOAT* pSrcV break; } } -void IccLib_TranslateImage(void* pTransform, unsigned char* pDest, const unsigned char* pSrc, FX_INT32 pixels) +void IccLib_TranslateImage(void* pTransform, unsigned char* pDest, const unsigned char* pSrc, int32_t pixels) { cmsDoTransform(((CLcmsCmm*)pTransform)->m_hTransform, (void*)pSrc, pDest, pixels); } @@ -284,7 +284,7 @@ ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS(IFX_FileRead* pFile) } ICodec_IccModule::IccCS cs; FX_DWORD dwSize = (FX_DWORD)pFile->GetSize(); - FX_LPBYTE pBuf = FX_Alloc(FX_BYTE, dwSize); + FX_LPBYTE pBuf = FX_Alloc(uint8_t, dwSize); pFile->ReadBlock(pBuf, 0, dwSize); cs = GetProfileCS(pBuf, dwSize); FX_Free(pBuf); @@ -406,7 +406,7 @@ FX_LPVOID CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, CFX_ByteStringKey key; CFX_ByteString text; key << pIccParam->ColorSpace << (pIccParam->dwProfileType | ic << 8); - FX_BYTE ID[16]; + uint8_t ID[16]; switch (pIccParam->dwProfileType) { case Icc_PARAMTYPE_NONE: return NULL; @@ -526,12 +526,12 @@ CCodec_IccModule::~CCodec_IccModule() } } } -void* CCodec_IccModule::CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize, FX_INT32& nComponents, FX_INT32 intent, FX_DWORD dwSrcFormat) +void* CCodec_IccModule::CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent, FX_DWORD dwSrcFormat) { return IccLib_CreateTransform_sRGB(pProfileData, dwProfileSize, nComponents, intent, dwSrcFormat); } -void* CCodec_IccModule::CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWORD dwSrcProfileSize, FX_INT32& nSrcComponents, - FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, FX_INT32 intent, +void* CCodec_IccModule::CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, + FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent, FX_DWORD dwSrcFormat , FX_DWORD dwDstFormat) { return IccLib_CreateTransform(pSrcProfileData, dwSrcProfileSize, nSrcComponents, @@ -545,11 +545,11 @@ void CCodec_IccModule::Translate(void* pTransform, FX_FLOAT* pSrcValues, FX_FLOA { IccLib_Translate(pTransform, m_nComponents, pSrcValues, pDestValues); } -void CCodec_IccModule::TranslateScanline(void* pTransform, FX_LPBYTE pDest, FX_LPCBYTE pSrc, FX_INT32 pixels) +void CCodec_IccModule::TranslateScanline(void* pTransform, FX_LPBYTE pDest, FX_LPCBYTE pSrc, int32_t pixels) { IccLib_TranslateImage(pTransform, pDest, pSrc, pixels); } -const FX_BYTE g_CMYKSamples[81 * 81 * 3] = { +const uint8_t g_CMYKSamples[81 * 81 * 3] = { 255, 255, 255, 225, 226, 228, 199, 200, 202, 173, 174, 178, 147, 149, 152, 123, 125, 128, 99, 99, 102, 69, 70, 71, 34, 30, 31, 255, 253, 229, 226, 224, 203, 200, 199, 182, 173, 173, 158, 149, 148, 135, 125, 124, 113, 99, 99, 90, 70, 69, 63, 33, 29, 24, 255, 251, 204, 228, 223, 182, 201, 198, 163, 174, 172, 142, 150, 147, 122, 125, 123, 101, 99, 98, 80, 70, 68, 54, 32, 28, 16, @@ -1280,7 +1280,7 @@ const FX_BYTE g_CMYKSamples[81 * 81 * 3] = { 53, 53, 66, 47, 44, 57, 40, 36, 48, 32, 27, 39, 22, 18, 30, 9, 4, 18, 0, 0, 3, 0, 0, 0, 0, 0, 0, 54, 53, 57, 48, 45, 49, 41, 37, 41, 33, 28, 32, 22, 19, 23, 11, 6, 10, 1, 0, 0, 0, 0, 0, 0, 0, 0, }; -void AdobeCMYK_to_sRGB1(FX_BYTE c, FX_BYTE m, FX_BYTE y, FX_BYTE k, FX_BYTE& R, FX_BYTE& G, FX_BYTE& B) +void AdobeCMYK_to_sRGB1(uint8_t c, uint8_t m, uint8_t y, uint8_t k, uint8_t& R, uint8_t& G, uint8_t& B) { int fix_c = c << 8; int fix_m = m << 8; @@ -1357,11 +1357,11 @@ void AdobeCMYK_to_sRGB1(FX_BYTE c, FX_BYTE m, FX_BYTE y, FX_BYTE k, FX_BYTE& R, } void AdobeCMYK_to_sRGB(FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) { - FX_BYTE c1 = FXSYS_round(c * 255); - FX_BYTE m1 = FXSYS_round(m * 255); - FX_BYTE y1 = FXSYS_round(y * 255); - FX_BYTE k1 = FXSYS_round(k * 255); - FX_BYTE r, g, b; + uint8_t c1 = FXSYS_round(c * 255); + uint8_t m1 = FXSYS_round(m * 255); + uint8_t y1 = FXSYS_round(y * 255); + uint8_t k1 = FXSYS_round(k * 255); + uint8_t r, g, b; AdobeCMYK_to_sRGB1(c1, m1, y1, k1, r, g, b); R = 1.0f * r / 255; G = 1.0f * g / 255; diff --git a/core/src/fxcodec/codec/fx_codec_jbig.cpp b/core/src/fxcodec/codec/fx_codec_jbig.cpp index 8fcd9f4711..622448d659 100644 --- a/core/src/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/src/fxcodec/codec/fx_codec_jbig.cpp @@ -52,7 +52,7 @@ FX_BOOL CCodec_Jbig2Module::Decode(IFX_FileRead* file_ptr, CJBig2_Context* pContext = NULL; CJBig2_Image* dest_image = NULL; FX_DWORD src_size = (FX_DWORD)file_ptr->GetSize(); - FX_LPBYTE src_buf = FX_Alloc(FX_BYTE, src_size); + FX_LPBYTE src_buf = FX_Alloc(uint8_t, src_size); int ret = 0; if(!file_ptr->ReadBlock(src_buf, 0, src_size)) { goto failed; @@ -129,7 +129,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, IFX_FileRead m_pJbig2Context->m_bFileReader = TRUE; m_pJbig2Context->m_dest_image = NULL; m_pJbig2Context->m_src_size = (FX_DWORD)file_ptr->GetSize(); - m_pJbig2Context->m_src_buf = FX_Alloc(FX_BYTE, m_pJbig2Context->m_src_size); + m_pJbig2Context->m_src_buf = FX_Alloc(uint8_t, m_pJbig2Context->m_src_size); int ret = 0; if(!file_ptr->ReadBlock((void*)m_pJbig2Context->m_src_buf, 0, m_pJbig2Context->m_src_size)) { goto failed; diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp index 9dcc87bcdf..111cbcf245 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; @@ -88,15 +88,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); @@ -144,11 +144,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) { @@ -173,7 +173,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) { @@ -207,7 +207,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; @@ -404,7 +404,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; @@ -412,7 +412,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; @@ -564,7 +564,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/jbig2/JBig2_BitStream.h b/core/src/fxcodec/jbig2/JBig2_BitStream.h index 9d5d29468f..ff0b9fcfeb 100644 --- a/core/src/fxcodec/jbig2/JBig2_BitStream.h +++ b/core/src/fxcodec/jbig2/JBig2_BitStream.h @@ -11,41 +11,41 @@ class CJBig2_BitStream : public CJBig2_Object { public: - CJBig2_BitStream(FX_BYTE *pBuffer, FX_DWORD dwLength); + CJBig2_BitStream(uint8_t *pBuffer, FX_DWORD dwLength); CJBig2_BitStream(CJBig2_BitStream &bs); ~CJBig2_BitStream(); - FX_INT32 readNBits(FX_DWORD nBits, FX_DWORD *dwResult); + int32_t readNBits(FX_DWORD nBits, FX_DWORD *dwResult); - FX_INT32 readNBits(FX_DWORD nBits, FX_INT32 *nResult); + int32_t readNBits(FX_DWORD nBits, int32_t *nResult); - FX_INT32 read1Bit(FX_DWORD *dwResult); + int32_t read1Bit(FX_DWORD *dwResult); - FX_INT32 read1Bit(FX_BOOL *bResult); + int32_t read1Bit(FX_BOOL *bResult); - FX_INT32 read1Byte(FX_BYTE *cResult); + int32_t read1Byte(uint8_t *cResult); - FX_INT32 readInteger(FX_DWORD *dwResult); + int32_t readInteger(FX_DWORD *dwResult); - FX_INT32 readShortInteger(FX_WORD *wResult); + int32_t readShortInteger(FX_WORD *wResult); void alignByte(); void align4Byte(); - FX_BYTE getAt(FX_DWORD dwOffset); + uint8_t getAt(FX_DWORD dwOffset); - FX_BYTE getCurByte(); + uint8_t getCurByte(); - FX_BYTE getNextByte(); + uint8_t getNextByte(); - FX_INT32 incByteIdx(); + int32_t incByteIdx(); - FX_BYTE getCurByte_arith(); + uint8_t getCurByte_arith(); - FX_BYTE getNextByte_arith(); + uint8_t getNextByte_arith(); FX_DWORD getOffset(); @@ -55,21 +55,21 @@ public: void setBitPos(FX_DWORD dwBitPos); - FX_BYTE *getBuf(); + uint8_t *getBuf(); FX_DWORD getLength() { return m_dwLength; } - FX_BYTE *getPointer(); + uint8_t *getPointer(); void offset(FX_DWORD dwOffset); FX_DWORD getByteLeft(); private: - FX_BYTE *m_pBuf; + uint8_t *m_pBuf; FX_DWORD m_dwLength; @@ -77,7 +77,7 @@ private: FX_DWORD m_dwBitIdx; }; -inline CJBig2_BitStream::CJBig2_BitStream(FX_BYTE *pBuffer, FX_DWORD dwLength) +inline CJBig2_BitStream::CJBig2_BitStream(uint8_t *pBuffer, FX_DWORD dwLength) { m_pBuf = pBuffer; m_dwLength = dwLength; @@ -98,7 +98,7 @@ inline CJBig2_BitStream::CJBig2_BitStream(CJBig2_BitStream &bs) inline CJBig2_BitStream::~CJBig2_BitStream() { } -inline FX_INT32 CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_DWORD *dwResult) +inline int32_t CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_DWORD *dwResult) { FX_DWORD dwTemp = (m_dwByteIdx << 3) + m_dwBitIdx; if(dwTemp <= (m_dwLength << 3)) { @@ -123,7 +123,7 @@ inline FX_INT32 CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_DWORD *dwResult) return -1; } } -inline FX_INT32 CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_INT32 *nResult) +inline int32_t CJBig2_BitStream::readNBits(FX_DWORD dwBits, int32_t *nResult) { FX_DWORD dwTemp = (m_dwByteIdx << 3) + m_dwBitIdx; if(dwTemp <= (m_dwLength << 3)) { @@ -149,7 +149,7 @@ inline FX_INT32 CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_INT32 *nResult) } } -inline FX_INT32 CJBig2_BitStream::read1Bit(FX_DWORD *dwResult) +inline int32_t CJBig2_BitStream::read1Bit(FX_DWORD *dwResult) { if(m_dwByteIdx < m_dwLength) { *dwResult = (m_pBuf[m_dwByteIdx] >> (7 - m_dwBitIdx)) & 0x01; @@ -165,7 +165,7 @@ inline FX_INT32 CJBig2_BitStream::read1Bit(FX_DWORD *dwResult) } } -inline FX_INT32 CJBig2_BitStream::read1Bit(FX_BOOL *bResult) +inline int32_t CJBig2_BitStream::read1Bit(FX_BOOL *bResult) { if(m_dwByteIdx < m_dwLength) { *bResult = (m_pBuf[m_dwByteIdx] >> (7 - m_dwBitIdx)) & 0x01; @@ -180,7 +180,7 @@ inline FX_INT32 CJBig2_BitStream::read1Bit(FX_BOOL *bResult) return -1; } } -inline FX_INT32 CJBig2_BitStream::read1Byte(FX_BYTE *cResult) +inline int32_t CJBig2_BitStream::read1Byte(uint8_t *cResult) { if(m_dwByteIdx < m_dwLength) { *cResult = m_pBuf[m_dwByteIdx]; @@ -191,7 +191,7 @@ inline FX_INT32 CJBig2_BitStream::read1Byte(FX_BYTE *cResult) } } -inline FX_INT32 CJBig2_BitStream::readInteger(FX_DWORD *dwResult) +inline int32_t CJBig2_BitStream::readInteger(FX_DWORD *dwResult) { if(m_dwByteIdx + 3 < m_dwLength) { *dwResult = (m_pBuf[m_dwByteIdx] << 24) | (m_pBuf[m_dwByteIdx + 1] << 16) @@ -203,7 +203,7 @@ inline FX_INT32 CJBig2_BitStream::readInteger(FX_DWORD *dwResult) } } -inline FX_INT32 CJBig2_BitStream::readShortInteger(FX_WORD *dwResult) +inline int32_t CJBig2_BitStream::readShortInteger(FX_WORD *dwResult) { if(m_dwByteIdx + 1 < m_dwLength) { *dwResult = (m_pBuf[m_dwByteIdx] << 8) | m_pBuf[m_dwByteIdx + 1]; @@ -228,7 +228,7 @@ inline void CJBig2_BitStream::align4Byte() } m_dwByteIdx = (m_dwByteIdx + 3) & -4; } -inline FX_BYTE CJBig2_BitStream::getAt(FX_DWORD dwOffset) +inline uint8_t CJBig2_BitStream::getAt(FX_DWORD dwOffset) { if(dwOffset < m_dwLength) { return m_pBuf[dwOffset]; @@ -236,7 +236,7 @@ inline FX_BYTE CJBig2_BitStream::getAt(FX_DWORD dwOffset) return 0; } } -inline FX_BYTE CJBig2_BitStream::getCurByte() +inline uint8_t CJBig2_BitStream::getCurByte() { if(m_dwByteIdx < m_dwLength) { return m_pBuf[m_dwByteIdx]; @@ -244,7 +244,7 @@ inline FX_BYTE CJBig2_BitStream::getCurByte() return 0; } } -inline FX_BYTE CJBig2_BitStream::getNextByte() +inline uint8_t CJBig2_BitStream::getNextByte() { if(m_dwByteIdx + 1 < m_dwLength) { return m_pBuf[m_dwByteIdx + 1]; @@ -252,7 +252,7 @@ inline FX_BYTE CJBig2_BitStream::getNextByte() return 0; } } -inline FX_INT32 CJBig2_BitStream::incByteIdx() +inline int32_t CJBig2_BitStream::incByteIdx() { if(m_dwByteIdx < m_dwLength) { m_dwByteIdx ++; @@ -261,7 +261,7 @@ inline FX_INT32 CJBig2_BitStream::incByteIdx() return -1; } } -inline FX_BYTE CJBig2_BitStream::getCurByte_arith() +inline uint8_t CJBig2_BitStream::getCurByte_arith() { if(m_dwByteIdx < m_dwLength) { return m_pBuf[m_dwByteIdx]; @@ -269,7 +269,7 @@ inline FX_BYTE CJBig2_BitStream::getCurByte_arith() return 0xff; } } -inline FX_BYTE CJBig2_BitStream::getNextByte_arith() +inline uint8_t CJBig2_BitStream::getNextByte_arith() { if(m_dwByteIdx + 1 < m_dwLength) { return m_pBuf[m_dwByteIdx + 1]; @@ -297,11 +297,11 @@ inline void CJBig2_BitStream::setBitPos(FX_DWORD dwBitPos) m_dwByteIdx = dwBitPos >> 3; m_dwBitIdx = dwBitPos & 7; } -inline FX_BYTE *CJBig2_BitStream::getBuf() +inline uint8_t *CJBig2_BitStream::getBuf() { return m_pBuf; } -inline FX_BYTE *CJBig2_BitStream::getPointer() +inline uint8_t *CJBig2_BitStream::getPointer() { return m_pBuf + m_dwByteIdx; } diff --git a/core/src/fxcodec/jbig2/JBig2_Context.cpp b/core/src/fxcodec/jbig2/JBig2_Context.cpp index bcd16e7e14..1c7592778d 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Context.cpp @@ -23,8 +23,8 @@ void OutputBitmap(CJBig2_Image* pImage) return; } } -CJBig2_Context *CJBig2_Context::CreateContext(CJBig2_Module *pModule, FX_BYTE *pGlobalData, FX_DWORD dwGlobalLength, - FX_BYTE *pData, FX_DWORD dwLength, FX_INT32 nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause) +CJBig2_Context *CJBig2_Context::CreateContext(CJBig2_Module *pModule, uint8_t *pGlobalData, FX_DWORD dwGlobalLength, + uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause) { return new(pModule)CJBig2_Context(pGlobalData, dwGlobalLength, pData, dwLength, nStreamType, pSymbolDictCache, pPause); } @@ -34,8 +34,8 @@ void CJBig2_Context::DestroyContext(CJBig2_Context *pContext) delete pContext; } } -CJBig2_Context::CJBig2_Context(FX_BYTE *pGlobalData, FX_DWORD dwGlobalLength, - FX_BYTE *pData, FX_DWORD dwLength, FX_INT32 nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause) +CJBig2_Context::CJBig2_Context(uint8_t *pGlobalData, FX_DWORD dwGlobalLength, + uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause) { if(pGlobalData && (dwGlobalLength > 0)) { JBIG2_ALLOC(m_pGlobalContext, CJBig2_Context(NULL, 0, pGlobalData, dwGlobalLength, @@ -96,12 +96,12 @@ CJBig2_Context::~CJBig2_Context() } m_pSegmentList = NULL; } -FX_INT32 CJBig2_Context::decodeFile(IFX_Pause* pPause) +int32_t CJBig2_Context::decodeFile(IFX_Pause* pPause) { - FX_BYTE cFlags; + uint8_t cFlags; FX_DWORD dwTemp; - const FX_BYTE fileID[] = {0x97, 0x4A, 0x42, 0x32, 0x0D, 0x0A, 0x1A, 0x0A}; - FX_INT32 nRet; + const uint8_t fileID[] = {0x97, 0x4A, 0x42, 0x32, 0x0D, 0x0A, 0x1A, 0x0A}; + int32_t nRet; if(m_pStream->getByteLeft() < 8) { m_pModule->JBig2_Error("file header too short."); nRet = JBIG2_ERROR_TOO_SHORT; @@ -139,9 +139,9 @@ FX_INT32 CJBig2_Context::decodeFile(IFX_Pause* pPause) failed: return nRet; } -FX_INT32 CJBig2_Context::decode_SquentialOrgnazation(IFX_Pause* pPause) +int32_t CJBig2_Context::decode_SquentialOrgnazation(IFX_Pause* pPause) { - FX_INT32 nRet; + int32_t nRet; if(m_pStream->getByteLeft() > 0) { while(m_pStream->getByteLeft() >= JBIG2_MIN_SEGMENT_SIZE) { if(m_pSegment == NULL) { @@ -189,14 +189,14 @@ FX_INT32 CJBig2_Context::decode_SquentialOrgnazation(IFX_Pause* pPause) } return JBIG2_SUCCESS; } -FX_INT32 CJBig2_Context::decode_EmbedOrgnazation(IFX_Pause* pPause) +int32_t CJBig2_Context::decode_EmbedOrgnazation(IFX_Pause* pPause) { return decode_SquentialOrgnazation(pPause); } -FX_INT32 CJBig2_Context::decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause) +int32_t CJBig2_Context::decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause) { CJBig2_Segment *pSegment; - FX_INT32 nRet; + int32_t nRet; while(m_pStream->getByteLeft() > JBIG2_MIN_SEGMENT_SIZE) { JBIG2_ALLOC(pSegment, CJBig2_Segment()); nRet = parseSegmentHeader(pSegment); @@ -217,9 +217,9 @@ FX_INT32 CJBig2_Context::decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause) m_nSegmentDecoded = 0; return decode_RandomOrgnazation(pPause); } -FX_INT32 CJBig2_Context::decode_RandomOrgnazation(IFX_Pause* pPause) +int32_t CJBig2_Context::decode_RandomOrgnazation(IFX_Pause* pPause) { - FX_INT32 nRet; + int32_t nRet; for(; m_nSegmentDecoded < m_pSegmentList->getLength(); m_nSegmentDecoded++) { nRet = parseSegmentData(m_pSegmentList->getAt(m_nSegmentDecoded), pPause); if((nRet == JBIG2_END_OF_PAGE) || (nRet == JBIG2_END_OF_FILE)) { @@ -235,9 +235,9 @@ FX_INT32 CJBig2_Context::decode_RandomOrgnazation(IFX_Pause* pPause) } return JBIG2_SUCCESS; } -FX_INT32 CJBig2_Context::getFirstPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT32 stride, IFX_Pause* pPause) +int32_t CJBig2_Context::getFirstPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t stride, IFX_Pause* pPause) { - FX_INT32 nRet = 0; + int32_t nRet = 0; if(m_pGlobalContext) { nRet = m_pGlobalContext->decode_EmbedOrgnazation(pPause); if(nRet != JBIG2_SUCCESS) { @@ -260,10 +260,10 @@ FX_INT32 CJBig2_Context::getFirstPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 he int ret = Continue(pPause); return ret; } -FX_INT32 CJBig2_Context::Continue(IFX_Pause* pPause) +int32_t CJBig2_Context::Continue(IFX_Pause* pPause) { m_ProcessiveStatus = FXCODEC_STATUS_DECODE_READY; - FX_INT32 nRet; + int32_t nRet; if(m_PauseStep <= 1) { switch(m_nStreamType) { case JBIG2_FILE_STREAM: @@ -311,9 +311,9 @@ FX_INT32 CJBig2_Context::Continue(IFX_Pause* pPause) } return nRet; } -FX_INT32 CJBig2_Context::getNextPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT32 stride, IFX_Pause* pPause) +int32_t CJBig2_Context::getNextPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t stride, IFX_Pause* pPause) { - FX_INT32 nRet = JBIG2_ERROR_STREAM_TYPE; + int32_t nRet = JBIG2_ERROR_STREAM_TYPE; m_bFirstPage = FALSE; m_PauseStep = 0; if(m_pPage) { @@ -345,9 +345,9 @@ FX_INT32 CJBig2_Context::getNextPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 hei } return nRet; } -FX_INT32 CJBig2_Context::getFirstPage(CJBig2_Image **image, IFX_Pause* pPause) +int32_t CJBig2_Context::getFirstPage(CJBig2_Image **image, IFX_Pause* pPause) { - FX_INT32 nRet; + int32_t nRet; m_bFirstPage = TRUE; m_PauseStep = 0; if(m_pGlobalContext) { @@ -359,9 +359,9 @@ FX_INT32 CJBig2_Context::getFirstPage(CJBig2_Image **image, IFX_Pause* pPause) m_bBufSpecified = FALSE; return Continue(pPause); } -FX_INT32 CJBig2_Context::getNextPage(CJBig2_Image **image, IFX_Pause* pPause) +int32_t CJBig2_Context::getNextPage(CJBig2_Image **image, IFX_Pause* pPause) { - FX_INT32 nRet; + int32_t nRet; m_bBufSpecified = FALSE; m_bFirstPage = FALSE; m_PauseStep = 0; @@ -391,7 +391,7 @@ FX_INT32 CJBig2_Context::getNextPage(CJBig2_Image **image, IFX_Pause* pPause) CJBig2_Segment *CJBig2_Context::findSegmentByNumber(FX_DWORD dwNumber) { CJBig2_Segment *pSeg; - FX_INT32 i; + int32_t i; if(m_pGlobalContext) { pSeg = m_pGlobalContext->findSegmentByNumber(dwNumber); if(pSeg) { @@ -407,10 +407,10 @@ CJBig2_Segment *CJBig2_Context::findSegmentByNumber(FX_DWORD dwNumber) return NULL; } CJBig2_Segment *CJBig2_Context::findReferredSegmentByTypeAndIndex(CJBig2_Segment *pSegment, - FX_BYTE cType, FX_INT32 nIndex) + uint8_t cType, int32_t nIndex) { CJBig2_Segment *pSeg; - FX_INT32 i, count; + int32_t i, count; count = 0; for(i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { pSeg = findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]); @@ -424,10 +424,10 @@ CJBig2_Segment *CJBig2_Context::findReferredSegmentByTypeAndIndex(CJBig2_Segment } return NULL; } -FX_INT32 CJBig2_Context::parseSegmentHeader(CJBig2_Segment *pSegment) +int32_t CJBig2_Context::parseSegmentHeader(CJBig2_Segment *pSegment) { - FX_BYTE cSSize, cPSize; - FX_BYTE cTemp; + uint8_t cSSize, cPSize; + uint8_t cTemp; FX_WORD wTemp; FX_DWORD dwTemp; if((m_pStream->readInteger(&pSegment->m_dwNumber) != 0) @@ -457,7 +457,7 @@ FX_INT32 CJBig2_Context::parseSegmentHeader(CJBig2_Segment *pSegment) if(pSegment->m_nReferred_to_segment_count) { pSegment->m_pReferred_to_segment_numbers = (FX_DWORD*)m_pModule->JBig2_Malloc2( sizeof(FX_DWORD), pSegment->m_nReferred_to_segment_count); - for(FX_INT32 i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { + for(int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { switch(cSSize) { case 1: if(m_pStream->read1Byte(&cTemp) != 0) { @@ -504,15 +504,15 @@ failed: m_pModule->JBig2_Error("header too short."); return JBIG2_ERROR_TOO_SHORT; } -FX_INT32 CJBig2_Context::parseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause) +int32_t CJBig2_Context::parseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause) { - FX_INT32 ret = ProcessiveParseSegmentData(pSegment, pPause); + int32_t ret = ProcessiveParseSegmentData(pSegment, pPause); while(m_ProcessiveStatus == FXCODEC_STATUS_DECODE_TOBECONTINUE && m_pStream->getByteLeft() > 0) { ret = ProcessiveParseSegmentData(pSegment, pPause); } return ret; } -FX_INT32 CJBig2_Context::ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause) +int32_t CJBig2_Context::ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause) { switch(pSegment->m_cFlags.s.type) { case 0: @@ -613,13 +613,13 @@ failed2: m_pModule->JBig2_Error("segment syntax error."); return JBIG2_ERROR_FETAL; } -FX_INT32 CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPause) +int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPause) { FX_DWORD dwTemp; FX_WORD wFlags; - FX_BYTE cSDHUFFDH, cSDHUFFDW, cSDHUFFBMSIZE, cSDHUFFAGGINST; + uint8_t cSDHUFFDH, cSDHUFFDW, cSDHUFFBMSIZE, cSDHUFFAGGINST; CJBig2_HuffmanTable *Table_B1 = NULL, *Table_B2 = NULL, *Table_B3 = NULL, *Table_B4 = NULL, *Table_B5 = NULL; - FX_INT32 i, nIndex, nRet; + int32_t i, nIndex, nRet; CJBig2_Segment *pSeg = NULL, *pLRSeg = NULL; FX_BOOL bUsed; CJBig2_Image ** SDINSYMS = NULL; @@ -627,7 +627,7 @@ FX_INT32 CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pP JBig2ArithCtx *gbContext = NULL, *grContext = NULL; CJBig2_ArithDecoder *pArithDecoder; JBIG2_ALLOC(pSymbolDictDecoder, CJBig2_SDDProc()); - FX_BYTE *key = pSegment->m_pData; + uint8_t *key = pSegment->m_pData; FX_BOOL cache_hit = false; if(m_pStream->readShortInteger(&wFlags) != 0) { m_pModule->JBig2_Error("symbol dictionary segment : data header too short."); @@ -648,8 +648,8 @@ FX_INT32 CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pP } else { dwTemp = 2; } - for(i = 0; i < (FX_INT32)dwTemp; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&pSymbolDictDecoder->SDAT[i]) != 0) { + for(i = 0; i < (int32_t)dwTemp; i++) { + if(m_pStream->read1Byte((uint8_t*)&pSymbolDictDecoder->SDAT[i]) != 0) { m_pModule->JBig2_Error("symbol dictionary segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -658,7 +658,7 @@ FX_INT32 CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pP } if((pSymbolDictDecoder->SDREFAGG == 1) && (pSymbolDictDecoder->SDRTEMPLATE == 0)) { for(i = 0; i < 4; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&pSymbolDictDecoder->SDRAT[i]) != 0) { + if(m_pStream->read1Byte((uint8_t*)&pSymbolDictDecoder->SDRAT[i]) != 0) { m_pModule->JBig2_Error("symbol dictionary segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -917,12 +917,12 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment) { FX_DWORD dwTemp; FX_WORD wFlags; - FX_INT32 i, nIndex, nRet; + int32_t i, nIndex, nRet; JBig2RegionInfo ri; CJBig2_Segment *pSeg; CJBig2_Image **SBSYMS = NULL; JBig2HuffmanCode *SBSYMCODES = NULL; - FX_BYTE cSBHUFFFS, cSBHUFFDS, cSBHUFFDT, cSBHUFFRDW, cSBHUFFRDH, cSBHUFFRDX, cSBHUFFRDY, cSBHUFFRSIZE; + uint8_t cSBHUFFFS, cSBHUFFDS, cSBHUFFDT, cSBHUFFRDW, cSBHUFFRDH, cSBHUFFRDX, cSBHUFFRDY, cSBHUFFRSIZE; CJBig2_HuffmanTable *Table_B1 = NULL, *Table_B6 = NULL, *Table_B7 = NULL, @@ -976,7 +976,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment) } if((pTRD->SBREFINE == 1) && (pTRD->SBRTEMPLATE == 0)) { for(i = 0; i < 4; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&pTRD->SBRAT[i]) != 0) { + if(m_pStream->read1Byte((uint8_t*)&pTRD->SBRAT[i]) != 0) { m_pModule->JBig2_Error("text region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -1032,7 +1032,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment) while((FX_DWORD)(1 << dwTemp) < pTRD->SBNUMSYMS) { dwTemp ++; } - pTRD->SBSYMCODELEN = (FX_BYTE)dwTemp; + pTRD->SBSYMCODELEN = (uint8_t)dwTemp; } if(pTRD->SBHUFF == 1) { if((cSBHUFFFS == 2) || (cSBHUFFRDW == 2) || (cSBHUFFRDH == 2) @@ -1326,11 +1326,11 @@ failed: FX_BOOL CJBig2_Context::parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pPause) { FX_DWORD dwTemp; - FX_BYTE cFlags; + uint8_t cFlags; JBig2ArithCtx *gbContext; CJBig2_ArithDecoder *pArithDecoder; CJBig2_PDDProc *pPDD; - FX_INT32 nRet; + int32_t nRet; JBIG2_ALLOC(pPDD, CJBig2_PDDProc()); if((m_pStream->read1Byte(&cFlags) != 0) || (m_pStream->read1Byte(&pPDD->HDPW) != 0) @@ -1380,14 +1380,14 @@ failed: FX_BOOL CJBig2_Context::parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause) { FX_DWORD dwTemp; - FX_BYTE cFlags; + uint8_t cFlags; JBig2RegionInfo ri; CJBig2_Segment *pSeg; CJBig2_PatternDict *pPatternDict; JBig2ArithCtx *gbContext; CJBig2_ArithDecoder *pArithDecoder; CJBig2_HTRDProc *pHRD; - FX_INT32 nRet; + int32_t nRet; JBIG2_ALLOC(pHRD, CJBig2_HTRDProc()); if((parseRegionInfo(&ri) != JBIG2_SUCCESS) || (m_pStream->read1Byte(&cFlags) != 0) @@ -1474,8 +1474,8 @@ failed: FX_BOOL CJBig2_Context::parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause) { FX_DWORD dwTemp; - FX_BYTE cFlags; - FX_INT32 i, nRet; + uint8_t cFlags; + int32_t i, nRet; if(m_pGRD == NULL) { JBIG2_ALLOC(m_pGRD, CJBig2_GRDProc()); if((parseRegionInfo(&m_ri) != JBIG2_SUCCESS) @@ -1497,7 +1497,7 @@ FX_BOOL CJBig2_Context::parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* if(m_pGRD->MMR == 0) { if(m_pGRD->GBTEMPLATE == 0) { for(i = 0; i < 8; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&m_pGRD->GBAT[i]) != 0) { + if(m_pStream->read1Byte((uint8_t*)&m_pGRD->GBAT[i]) != 0) { m_pModule->JBig2_Error("generic region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -1505,7 +1505,7 @@ FX_BOOL CJBig2_Context::parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* } } else { for(i = 0; i < 2; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&m_pGRD->GBAT[i]) != 0) { + if(m_pStream->read1Byte((uint8_t*)&m_pGRD->GBAT[i]) != 0) { m_pModule->JBig2_Error("generic region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -1593,8 +1593,8 @@ FX_BOOL CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment *pSegment) FX_DWORD dwTemp; JBig2RegionInfo ri; CJBig2_Segment *pSeg; - FX_INT32 i, nRet; - FX_BYTE cFlags; + int32_t i, nRet; + uint8_t cFlags; JBig2ArithCtx *grContext; CJBig2_GRRDProc *pGRRD; CJBig2_ArithDecoder *pArithDecoder; @@ -1611,7 +1611,7 @@ FX_BOOL CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment *pSegment) pGRRD->TPGRON = (cFlags >> 1) & 0x01; if(pGRRD->GRTEMPLATE == 0) { for(i = 0; i < 4; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&pGRRD->GRAT[i]) != 0) { + if(m_pStream->read1Byte((uint8_t*)&pGRRD->GRAT[i]) != 0) { m_pModule->JBig2_Error("generic refinement region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -1687,7 +1687,7 @@ FX_BOOL CJBig2_Context::parseTable(CJBig2_Segment *pSegment) m_pStream->alignByte(); return JBIG2_SUCCESS; } -FX_INT32 CJBig2_Context::parseRegionInfo(JBig2RegionInfo *pRI) +int32_t CJBig2_Context::parseRegionInfo(JBig2RegionInfo *pRI) { if((m_pStream->readInteger((FX_DWORD*)&pRI->width) != 0) || (m_pStream->readInteger((FX_DWORD*)&pRI->height) != 0) @@ -1702,9 +1702,9 @@ JBig2HuffmanCode *CJBig2_Context::decodeSymbolIDHuffmanTable(CJBig2_BitStream *p FX_DWORD SBNUMSYMS) { JBig2HuffmanCode *SBSYMCODES; - FX_INT32 runcodes[35], runcodes_len[35], runcode; - FX_INT32 i, j, nTemp, nVal, nBits; - FX_INT32 run; + int32_t runcodes[35], runcodes_len[35], runcode; + int32_t i, j, nTemp, nVal, nBits; + int32_t run; SBSYMCODES = (JBig2HuffmanCode*)m_pModule->JBig2_Malloc2(sizeof(JBig2HuffmanCode), SBNUMSYMS); for (i = 0; i < 35; i ++) { if(pStream->readNBits(4, &runcodes_len[i]) != 0) { diff --git a/core/src/fxcodec/jbig2/JBig2_Context.h b/core/src/fxcodec/jbig2/JBig2_Context.h index f46530e005..b12853accf 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.h +++ b/core/src/fxcodec/jbig2/JBig2_Context.h @@ -14,7 +14,7 @@ #include "../../../include/fxcodec/fx_codec_def.h" #include "../../../include/fxcrt/fx_basic.h" #include <utility> -typedef std::pair<FX_BYTE*, CJBig2_SymbolDict*> CJBig2_CachePair; +typedef std::pair<uint8_t*, CJBig2_SymbolDict*> CJBig2_CachePair; typedef enum { JBIG2_OUT_OF_PAGE = 0, JBIG2_IN_PAGE, @@ -37,64 +37,64 @@ class CJBig2_Context : public CJBig2_Object { public: - static CJBig2_Context *CreateContext(CJBig2_Module *pModule, FX_BYTE *pGlobalData, FX_DWORD dwGlobalLength, - FX_BYTE *pData, FX_DWORD dwLength, FX_INT32 nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause = NULL); + static CJBig2_Context *CreateContext(CJBig2_Module *pModule, uint8_t *pGlobalData, FX_DWORD dwGlobalLength, + uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause = NULL); static void DestroyContext(CJBig2_Context *pContext); - FX_INT32 getFirstPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT32 stride, IFX_Pause* pPause); + int32_t getFirstPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t stride, IFX_Pause* pPause); - FX_INT32 getNextPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT32 stride, IFX_Pause* pPause); + int32_t getNextPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t stride, IFX_Pause* pPause); - FX_INT32 getFirstPage(CJBig2_Image **image, IFX_Pause* pPause); + int32_t getFirstPage(CJBig2_Image **image, IFX_Pause* pPause); - FX_INT32 getNextPage(CJBig2_Image **image, IFX_Pause* pPause); - FX_INT32 Continue(IFX_Pause* pPause); + int32_t getNextPage(CJBig2_Image **image, IFX_Pause* pPause); + int32_t Continue(IFX_Pause* pPause); FXCODEC_STATUS GetProcessiveStatus() { return m_ProcessiveStatus; }; private: - CJBig2_Context(FX_BYTE *pGlobalData, FX_DWORD dwGlobalLength, - FX_BYTE *pData, FX_DWORD dwLength, FX_INT32 nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause); + CJBig2_Context(uint8_t *pGlobalData, FX_DWORD dwGlobalLength, + uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause); ~CJBig2_Context(); - FX_INT32 decodeFile(IFX_Pause* pPause); + int32_t decodeFile(IFX_Pause* pPause); - FX_INT32 decode_SquentialOrgnazation(IFX_Pause* pPause); + int32_t decode_SquentialOrgnazation(IFX_Pause* pPause); - FX_INT32 decode_EmbedOrgnazation(IFX_Pause* pPause); + int32_t decode_EmbedOrgnazation(IFX_Pause* pPause); - FX_INT32 decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause); + int32_t decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause); - FX_INT32 decode_RandomOrgnazation(IFX_Pause* pPause); + int32_t decode_RandomOrgnazation(IFX_Pause* pPause); CJBig2_Segment *findSegmentByNumber(FX_DWORD dwNumber); - CJBig2_Segment *findReferredSegmentByTypeAndIndex(CJBig2_Segment *pSegment, FX_BYTE cType, FX_INT32 nIndex); + CJBig2_Segment *findReferredSegmentByTypeAndIndex(CJBig2_Segment *pSegment, uint8_t cType, int32_t nIndex); - FX_INT32 parseSegmentHeader(CJBig2_Segment *pSegment); + int32_t parseSegmentHeader(CJBig2_Segment *pSegment); - FX_INT32 parseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 parseTextRegion(CJBig2_Segment *pSegment); + int32_t parseTextRegion(CJBig2_Segment *pSegment); - FX_INT32 parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 parseGenericRefinementRegion(CJBig2_Segment *pSegment); + int32_t parseGenericRefinementRegion(CJBig2_Segment *pSegment); - FX_INT32 parseTable(CJBig2_Segment *pSegment); + int32_t parseTable(CJBig2_Segment *pSegment); - FX_INT32 parseRegionInfo(JBig2RegionInfo *pRI); + int32_t parseRegionInfo(JBig2RegionInfo *pRI); @@ -108,11 +108,11 @@ private: CJBig2_Context *m_pGlobalContext; - FX_INT32 m_nStreamType; + int32_t m_nStreamType; CJBig2_BitStream *m_pStream; - FX_INT32 m_nState; + int32_t m_nState; CJBig2_List<CJBig2_Segment> *m_pSegmentList; @@ -122,9 +122,9 @@ private: FX_BOOL m_bBufSpecified; - FX_INT32 m_nSegmentDecoded; + int32_t m_nSegmentDecoded; IFX_Pause* m_pPause; - FX_INT32 m_PauseStep; + int32_t m_PauseStep; FXCODEC_STATUS m_ProcessiveStatus; FX_BOOL m_bFirstPage; CJBig2_ArithDecoder *m_pArithDecoder; diff --git a/core/src/fxcodec/jbig2/JBig2_Define.h b/core/src/fxcodec/jbig2/JBig2_Define.h index ccf15d07ba..46c6e2b532 100644 --- a/core/src/fxcodec/jbig2/JBig2_Define.h +++ b/core/src/fxcodec/jbig2/JBig2_Define.h @@ -13,15 +13,15 @@ #include "JBig2_Object.h" #define JBIG2_OOB 1 typedef struct { - FX_INT32 width, + int32_t width, height; - FX_INT32 x, + int32_t x, y; - FX_BYTE flags; + uint8_t flags; } JBig2RegionInfo; typedef struct { - FX_INT32 codelen; - FX_INT32 code; + int32_t codelen; + int32_t code; } JBig2HuffmanCode; extern "C" { void _FaxG4Decode(void *pModule, FX_LPCBYTE src_buf, FX_DWORD src_size, int* pbitpos, FX_LPBYTE dest_buf, int width, int height, int pitch = 0); diff --git a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp index a5928f9ea3..bad595e6b7 100644 --- a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp +++ b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp @@ -150,9 +150,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_opt2(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, cVal; - FX_INTPTR nStride, nStride2; - FX_INT32 nBits, k; + uint8_t *pLine, cVal; + intptr_t nStride, nStride2; + int32_t nBits, k; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -217,9 +217,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_opt3(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine, *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -401,9 +401,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_opt2(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, cVal; - FX_INTPTR nStride, nStride2; - FX_INT32 nBits, k; + uint8_t *pLine, cVal; + intptr_t nStride, nStride2; + int32_t nBits, k; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -468,9 +468,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_opt3(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine, *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -647,9 +647,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_opt2(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, cVal; - FX_INTPTR nStride, nStride2; - FX_INT32 nBits, k; + uint8_t *pLine, cVal; + intptr_t nStride, nStride2; + int32_t nBits, k; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -714,9 +714,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_opt3(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine, *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -887,9 +887,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_opt2(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1; - FX_BYTE *pLine, cVal; - FX_INTPTR nStride; - FX_INT32 nBits, k; + uint8_t *pLine, cVal; + intptr_t nStride; + int32_t nBits, k; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -945,9 +945,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_opt3(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1; - FX_BYTE *pLine, *pLine1, cVal; - FX_INT32 nStride, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine, *pLine1, cVal; + int32_t nStride, k; + int32_t nLineBytes, nBitsLeft, cc; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -1428,13 +1428,13 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithD FX_DWORD CONTEXT; CJBig2_Image *GRREG; FX_DWORD line1, line1_r, line2_r, line3_r; - FX_BYTE *pLine, *pLineR, cVal; - FX_INTPTR nStride, nStrideR, nOffset; - FX_INT32 k, nBits; - FX_INT32 GRWR, GRHR; - FX_INT32 GRW, GRH; - GRW = (FX_INT32)CJBig2_GRRDProc::GRW; - GRH = (FX_INT32)CJBig2_GRRDProc::GRH; + uint8_t *pLine, *pLineR, cVal; + intptr_t nStride, nStrideR, nOffset; + int32_t k, nBits; + int32_t GRWR, GRHR; + int32_t GRW, GRH; + GRW = (int32_t)CJBig2_GRRDProc::GRW; + GRH = (int32_t)CJBig2_GRRDProc::GRH; LTP = 0; JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH)); if (GRREG->m_pData == NULL) { @@ -1446,19 +1446,19 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithD pLineR = GRREFERENCE->m_pData; nStride = GRREG->m_nStride; nStrideR = GRREFERENCE->m_nStride; - GRWR = (FX_INT32)GRREFERENCE->m_nWidth; - GRHR = (FX_INT32)GRREFERENCE->m_nHeight; + GRWR = (int32_t)GRREFERENCE->m_nWidth; + GRHR = (int32_t)GRREFERENCE->m_nHeight; if (GRREFERENCEDY < -GRHR + 1 || GRREFERENCEDY > GRHR - 1) { GRREFERENCEDY = 0; } nOffset = -GRREFERENCEDY * nStrideR; - for (FX_INT32 h = 0; h < GRH; h++) { + for (int32_t h = 0; h < GRH; h++) { if(TPGRON) { SLTP = pArithDecoder->DECODE(&grContext[0x0010]); LTP = LTP ^ SLTP; } line1 = (h > 0) ? pLine[-nStride] << 4 : 0; - FX_INT32 reference_h = h - GRREFERENCEDY; + int32_t reference_h = h - GRREFERENCEDY; FX_BOOL line1_r_ok = (reference_h > 0 && reference_h < GRHR + 1); FX_BOOL line2_r_ok = (reference_h > -1 && reference_h < GRHR); FX_BOOL line3_r_ok = (reference_h > -2 && reference_h < GRHR - 1); @@ -1468,7 +1468,7 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithD if(LTP == 0) { CONTEXT = (line1 & 0x1c00) | (line1_r & 0x01c0) | ((line2_r >> 3) & 0x0038) | ((line3_r >> 6) & 0x0007); - for (FX_INT32 w = 0; w < GRW; w += 8) { + for (int32_t w = 0; w < GRW; w += 8) { nBits = GRW - w > 8 ? 8 : GRW - w; if (h > 0) line1 = (line1 << 8) | @@ -1506,7 +1506,7 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithD } else { CONTEXT = (line1 & 0x1c00) | (line1_r & 0x01c0) | ((line2_r >> 3) & 0x0038) | ((line3_r >> 6) & 0x0007); - for (FX_INT32 w = 0; w < GRW; w += 8) { + for (int32_t w = 0; w < GRW; w += 8) { nBits = GRW - w > 8 ? 8 : GRW - w; if (h > 0) line1 = (line1 << 8) | @@ -1637,13 +1637,13 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithD FX_DWORD CONTEXT; CJBig2_Image *GRREG; FX_DWORD line1, line1_r, line2_r, line3_r; - FX_BYTE *pLine, *pLineR, cVal; - FX_INTPTR nStride, nStrideR, nOffset; - FX_INT32 k, nBits; - FX_INT32 GRWR, GRHR; - FX_INT32 GRW, GRH; - GRW = (FX_INT32)CJBig2_GRRDProc::GRW; - GRH = (FX_INT32)CJBig2_GRRDProc::GRH; + uint8_t *pLine, *pLineR, cVal; + intptr_t nStride, nStrideR, nOffset; + int32_t k, nBits; + int32_t GRWR, GRHR; + int32_t GRW, GRH; + GRW = (int32_t)CJBig2_GRRDProc::GRW; + GRH = (int32_t)CJBig2_GRRDProc::GRH; LTP = 0; JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH)); if (GRREG->m_pData == NULL) { @@ -1655,19 +1655,19 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithD pLineR = GRREFERENCE->m_pData; nStride = GRREG->m_nStride; nStrideR = GRREFERENCE->m_nStride; - GRWR = (FX_INT32)GRREFERENCE->m_nWidth; - GRHR = (FX_INT32)GRREFERENCE->m_nHeight; + GRWR = (int32_t)GRREFERENCE->m_nWidth; + GRHR = (int32_t)GRREFERENCE->m_nHeight; if (GRREFERENCEDY < -GRHR + 1 || GRREFERENCEDY > GRHR - 1) { GRREFERENCEDY = 0; } nOffset = -GRREFERENCEDY * nStrideR; - for (FX_INT32 h = 0; h < GRH; h++) { + for (int32_t h = 0; h < GRH; h++) { if(TPGRON) { SLTP = pArithDecoder->DECODE(&grContext[0x0008]); LTP = LTP ^ SLTP; } line1 = (h > 0) ? pLine[-nStride] << 1 : 0; - FX_INT32 reference_h = h - GRREFERENCEDY; + int32_t reference_h = h - GRREFERENCEDY; FX_BOOL line1_r_ok = (reference_h > 0 && reference_h < GRHR + 1); FX_BOOL line2_r_ok = (reference_h > -1 && reference_h < GRHR); FX_BOOL line3_r_ok = (reference_h > -2 && reference_h < GRHR - 1); @@ -1677,7 +1677,7 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithD if(LTP == 0) { CONTEXT = (line1 & 0x0380) | ((line1_r >> 2) & 0x0020) | ((line2_r >> 4) & 0x001c) | ((line3_r >> 6) & 0x0003); - for (FX_INT32 w = 0; w < GRW; w += 8) { + for (int32_t w = 0; w < GRW; w += 8) { nBits = GRW - w > 8 ? 8 : GRW - w; if (h > 0) line1 = (line1 << 8) | @@ -1709,7 +1709,7 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithD } else { CONTEXT = (line1 & 0x0380) | ((line1_r >> 2) & 0x0020) | ((line2_r >> 4) & 0x001c) | ((line3_r >> 6) & 0x0003); - for (FX_INT32 w = 0; w < GRW; w += 8) { + for (int32_t w = 0; w < GRW; w += 8) { nBits = GRW - w > 8 ? 8 : GRW - w; if (h > 0) line1 = (line1 << 8) | @@ -1872,23 +1872,23 @@ CJBig2_Image *CJBig2_GRRDProc::decode_V1(CJBig2_ArithDecoder *pArithDecoder, JBi } CJBig2_Image *CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream *pStream, JBig2ArithCtx *grContext) { - FX_INT32 STRIPT, FIRSTS; + int32_t STRIPT, FIRSTS; FX_DWORD NINSTANCES; - FX_INT32 DT, DFS, CURS; - FX_BYTE CURT; - FX_INT32 SI, TI; + int32_t DT, DFS, CURS; + uint8_t CURT; + int32_t SI, TI; FX_DWORD IDI; CJBig2_Image *IBI; FX_DWORD WI, HI; - FX_INT32 IDS; + int32_t IDS; FX_BOOL RI; - FX_INT32 RDWI, RDHI, RDXI, RDYI; + int32_t RDWI, RDHI, RDXI, RDYI; CJBig2_Image *IBOI; FX_DWORD WOI, HOI; CJBig2_Image *SBREG; FX_BOOL bFirst; FX_DWORD nTmp; - FX_INT32 nVal, nBits; + int32_t nVal, nBits; CJBig2_HuffmanDecoder *pHuffmanDecoder; CJBig2_GRRDProc *pGRRD; CJBig2_ArithDecoder *pArithDecoder; @@ -2092,23 +2092,23 @@ failed: CJBig2_Image *CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *grContext, JBig2IntDecoderState *pIDS) { - FX_INT32 STRIPT, FIRSTS; + int32_t STRIPT, FIRSTS; FX_DWORD NINSTANCES; - FX_INT32 DT, DFS, CURS; - FX_INT32 CURT; - FX_INT32 SI, TI; + int32_t DT, DFS, CURS; + int32_t CURT; + int32_t SI, TI; FX_DWORD IDI; CJBig2_Image *IBI; FX_DWORD WI, HI; - FX_INT32 IDS; + int32_t IDS; FX_BOOL RI; - FX_INT32 RDWI, RDHI, RDXI, RDYI; + int32_t RDWI, RDHI, RDXI, RDYI; CJBig2_Image *IBOI; FX_DWORD WOI, HOI; CJBig2_Image *SBREG; FX_BOOL bFirst; - FX_INT32 nRet, nVal; - FX_INT32 bRetained; + int32_t nRet, nVal; + int32_t bRetained; CJBig2_ArithIntDecoder *IADT, *IAFS, *IADS, *IAIT, *IARI, *IARDW, *IARDH, *IARDX, *IARDY; CJBig2_ArithIaidDecoder *IAID; CJBig2_GRRDProc *pGRRD; @@ -2333,21 +2333,21 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecod { CJBig2_Image **SDNEWSYMS; FX_DWORD HCHEIGHT, NSYMSDECODED; - FX_INT32 HCDH; + int32_t HCDH; FX_DWORD SYMWIDTH, TOTWIDTH; - FX_INT32 DW; + int32_t DW; CJBig2_Image *BS; FX_DWORD I, J, REFAGGNINST; FX_BOOL *EXFLAGS; FX_DWORD EXINDEX; FX_BOOL CUREXFLAG; FX_DWORD EXRUNLENGTH; - FX_INT32 nVal; + int32_t nVal; FX_DWORD nTmp; FX_DWORD SBNUMSYMS; - FX_BYTE SBSYMCODELEN; + uint8_t SBSYMCODELEN; FX_DWORD IDI; - FX_INT32 RDXI, RDYI; + int32_t RDXI, RDYI; CJBig2_Image **SBSYMS; CJBig2_HuffmanTable *SBHUFFFS, *SBHUFFDS, *SBHUFFDT, *SBHUFFRDW, *SBHUFFRDH, *SBHUFFRDX, *SBHUFFRDY, *SBHUFFRSIZE; @@ -2374,7 +2374,7 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecod while((FX_DWORD)(1 << nTmp) < (SDNUMINSYMS + SDNUMNEWSYMS)) { nTmp ++; } - JBIG2_ALLOC(IAID, CJBig2_ArithIaidDecoder((FX_BYTE)nTmp)); + JBIG2_ALLOC(IAID, CJBig2_ArithIaidDecoder((uint8_t)nTmp)); SDNEWSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2(SDNUMNEWSYMS, sizeof(CJBig2_Image*)); FXSYS_memset32(SDNEWSYMS, 0 , SDNUMNEWSYMS * sizeof(CJBig2_Image*)); HCHEIGHT = 0; @@ -2458,7 +2458,7 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecod while((FX_DWORD)(1 << nTmp) < SBNUMSYMS) { nTmp ++; } - SBSYMCODELEN = (FX_BYTE)nTmp; + SBSYMCODELEN = (uint8_t)nTmp; pDecoder->SBSYMCODELEN = SBSYMCODELEN; SBSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2(SBNUMSYMS, sizeof(CJBig2_Image*)); JBIG2_memcpy(SBSYMS, SDINSYMS, SDNUMINSYMS * sizeof(CJBig2_Image*)); @@ -2671,22 +2671,22 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream *pStream, CJBig2_Image **SDNEWSYMS; FX_DWORD *SDNEWSYMWIDTHS; FX_DWORD HCHEIGHT, NSYMSDECODED; - FX_INT32 HCDH; + int32_t HCDH; FX_DWORD SYMWIDTH, TOTWIDTH, HCFIRSTSYM; - FX_INT32 DW; + int32_t DW; CJBig2_Image *BS, *BHC; FX_DWORD I, J, REFAGGNINST; FX_BOOL *EXFLAGS; FX_DWORD EXINDEX; FX_BOOL CUREXFLAG; FX_DWORD EXRUNLENGTH; - FX_INT32 nVal, nBits; + int32_t nVal, nBits; FX_DWORD nTmp; FX_DWORD SBNUMSYMS; - FX_BYTE SBSYMCODELEN; + uint8_t SBSYMCODELEN; JBig2HuffmanCode *SBSYMCODES; FX_DWORD IDI; - FX_INT32 RDXI, RDYI; + int32_t RDXI, RDYI; FX_DWORD BMSIZE; FX_DWORD stride; CJBig2_Image **SBSYMS; @@ -2843,7 +2843,7 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream *pStream, while((FX_DWORD)(1 << nTmp) < SBNUMSYMS) { nTmp ++; } - SBSYMCODELEN = (FX_BYTE)nTmp; + SBSYMCODELEN = (uint8_t)nTmp; SBSYMCODES = (JBig2HuffmanCode*)m_pModule->JBig2_Malloc2(SBNUMSYMS, sizeof(JBig2HuffmanCode)); for(I = 0; I < SBNUMSYMS; I++) { SBSYMCODES[I].codelen = SBSYMCODELEN; @@ -2931,7 +2931,7 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream *pStream, NSYMSDECODED = NSYMSDECODED + 1; } if(SDREFAGG == 0) { - if(pHuffmanDecoder->decodeAValue(SDHUFFBMSIZE, (FX_INT32*)&BMSIZE) != 0) { + if(pHuffmanDecoder->decodeAValue(SDHUFFBMSIZE, (int32_t*)&BMSIZE) != 0) { m_pModule->JBig2_Error("symbol dictionary decoding procedure (huffman): too short."); goto failed; } @@ -3042,7 +3042,7 @@ CJBig2_Image *CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause) { FX_DWORD ng, mg; - FX_INT32 x, y; + int32_t x, y; CJBig2_Image *HSKIP; FX_DWORD HBPP; FX_DWORD *GI; @@ -3057,8 +3057,8 @@ CJBig2_Image *CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, for(ng = 0; ng < HGW; ng++) { x = (HGX + mg * HRY + ng * HRX) >> 8; y = (HGY + mg * HRX - ng * HRY) >> 8; - if((x + HPW <= 0) | (x >= (FX_INT32)HBW) - | (y + HPH <= 0) | (y >= (FX_INT32)HPH)) { + if((x + HPW <= 0) | (x >= (int32_t)HBW) + | (y + HPH <= 0) | (y >= (int32_t)HPH)) { HSKIP->setPixel(ng, mg, 1); } else { HSKIP->setPixel(ng, mg, 0); @@ -3074,7 +3074,7 @@ CJBig2_Image *CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, pGID->GSMMR = HMMR; pGID->GSW = HGW; pGID->GSH = HGH; - pGID->GSBPP = (FX_BYTE)HBPP; + pGID->GSBPP = (uint8_t)HBPP; pGID->GSUSESKIP = HENABLESKIP; pGID->GSKIP = HSKIP; pGID->GSTEMPLATE = HTEMPLATE; @@ -3110,7 +3110,7 @@ failed: CJBig2_Image *CJBig2_HTRDProc::decode_MMR(CJBig2_BitStream *pStream, IFX_Pause* pPause) { FX_DWORD ng, mg; - FX_INT32 x, y; + int32_t x, y; FX_DWORD HBPP; FX_DWORD *GI; CJBig2_Image *HTREG; @@ -3125,7 +3125,7 @@ CJBig2_Image *CJBig2_HTRDProc::decode_MMR(CJBig2_BitStream *pStream, IFX_Pause* pGID->GSMMR = HMMR; pGID->GSW = HGW; pGID->GSH = HGH; - pGID->GSBPP = (FX_BYTE)HBPP; + pGID->GSBPP = (uint8_t)HBPP; pGID->GSUSESKIP = 0; GI = pGID->decode_MMR(pStream, pPause); if(GI == NULL) { @@ -3168,7 +3168,7 @@ CJBig2_PatternDict *CJBig2_PDDProc::decode_Arith(CJBig2_ArithDecoder *pArithDeco pGRD->GBTEMPLATE = HDTEMPLATE; pGRD->TPGDON = 0; pGRD->USESKIP = 0; - pGRD->GBAT[0] = -(FX_INT32)HDPW; + pGRD->GBAT[0] = -(int32_t)HDPW; pGRD->GBAT[1] = 0; if(pGRD->GBTEMPLATE == 0) { pGRD->GBAT[2] = -3; @@ -3237,7 +3237,7 @@ FX_DWORD *CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause) { CJBig2_Image **GSPLANES; - FX_INT32 J, K; + int32_t J, K; FX_DWORD x, y; FX_DWORD *GSVALS; CJBig2_GRDProc *pGRD; @@ -3318,7 +3318,7 @@ failed: FX_DWORD *CJBig2_GSIDProc::decode_MMR(CJBig2_BitStream *pStream, IFX_Pause* pPause) { CJBig2_Image **GSPLANES; - FX_INT32 J, K; + int32_t J, K; FX_DWORD x, y; FX_DWORD *GSVALS; CJBig2_GRDProc *pGRD; @@ -3808,9 +3808,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3(CJBig2_Image *pImage, FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1, line2; - FX_BYTE *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; if(m_pLine == NULL) { m_pLine = pImage->m_pData; } @@ -3949,9 +3949,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3(CJBig2_Image *pImage, FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1, line2; - FX_BYTE *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; if (!m_pLine) { m_pLine = pImage->m_pData; } @@ -4087,9 +4087,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3(CJBig2_Image *pImage, FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1, line2; - FX_BYTE *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; if(!m_pLine) { m_pLine = pImage->m_pData; } @@ -4223,9 +4223,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3(CJBig2_Image *pImage, FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1; - FX_BYTE *pLine1, cVal; - FX_INT32 nStride, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine1, cVal; + int32_t nStride, k; + int32_t nLineBytes, nBitsLeft, cc; if (!m_pLine) { m_pLine = pImage->m_pData; } diff --git a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h index 3f43c979a5..45e2940d3a 100644 --- a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h +++ b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h @@ -68,7 +68,7 @@ private: FXCODEC_STATUS decode_Arith_Template3_opt3(CJBig2_Image *pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause); FXCODEC_STATUS decode_Arith_Template3_unopt(CJBig2_Image * pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause); FX_DWORD m_loopIndex; - FX_BYTE * m_pLine; + uint8_t * m_pLine; IFX_Pause* m_pPause; FXCODEC_STATUS m_ProssiveStatus; CJBig2_Image** m_pImage; @@ -114,7 +114,7 @@ public: FX_BOOL MMR; FX_DWORD GBW; FX_DWORD GBH; - FX_BYTE GBTEMPLATE; + uint8_t GBTEMPLATE; FX_BOOL TPGDON; FX_BOOL USESKIP; CJBig2_Image * SKIP; @@ -140,8 +140,8 @@ public: FX_DWORD GRH; FX_BOOL GRTEMPLATE; CJBig2_Image *GRREFERENCE; - FX_INT32 GRREFERENCEDX; - FX_INT32 GRREFERENCEDY; + int32_t GRREFERENCEDX; + int32_t GRREFERENCEDY; FX_BOOL TPGRON; signed char GRAT[4]; }; @@ -175,7 +175,7 @@ public: FX_DWORD SBNUMSYMS; JBig2HuffmanCode *SBSYMCODES; - FX_BYTE SBSYMCODELEN; + uint8_t SBSYMCODELEN; CJBig2_Image **SBSYMS; FX_BOOL SBDEFPIXEL; @@ -214,7 +214,7 @@ public: *SDHUFFDW, *SDHUFFBMSIZE, *SDHUFFAGGINST; - FX_BYTE SDTEMPLATE; + uint8_t SDTEMPLATE; signed char SDAT[8]; FX_BOOL SDRTEMPLATE; signed char SDRAT[4]; @@ -230,7 +230,7 @@ public: FX_DWORD HBW, HBH; FX_BOOL HMMR; - FX_BYTE HTEMPLATE; + uint8_t HTEMPLATE; FX_DWORD HNUMPATS; CJBig2_Image **HPATS; FX_BOOL HDEFPIXEL; @@ -238,11 +238,11 @@ public: FX_BOOL HENABLESKIP; FX_DWORD HGW, HGH; - FX_INT32 HGX, + int32_t HGX, HGY; FX_WORD HRX, HRY; - FX_BYTE HPW, + uint8_t HPW, HPH; }; class CJBig2_PDDProc : public CJBig2_Object @@ -254,10 +254,10 @@ public: CJBig2_PatternDict *decode_MMR(CJBig2_BitStream *pStream, IFX_Pause* pPause); public: FX_BOOL HDMMR; - FX_BYTE HDPW, + uint8_t HDPW, HDPH; FX_DWORD GRAYMAX; - FX_BYTE HDTEMPLATE; + uint8_t HDTEMPLATE; }; class CJBig2_GSIDProc : public CJBig2_Object { @@ -269,10 +269,10 @@ public: public: FX_BOOL GSMMR; FX_BOOL GSUSESKIP; - FX_BYTE GSBPP; + uint8_t GSBPP; FX_DWORD GSW, GSH; - FX_BYTE GSTEMPLATE; + uint8_t GSTEMPLATE; CJBig2_Image *GSKIP; }; #endif diff --git a/core/src/fxcodec/jbig2/JBig2_Image.cpp b/core/src/fxcodec/jbig2/JBig2_Image.cpp index f2cea597c1..044ccf7410 100644 --- a/core/src/fxcodec/jbig2/JBig2_Image.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Image.cpp @@ -11,7 +11,7 @@ #include "../../../include/fxcrt/fx_safe_types.h" #include "JBig2_Image.h" -CJBig2_Image::CJBig2_Image(FX_INT32 w, FX_INT32 h) +CJBig2_Image::CJBig2_Image(int32_t w, int32_t h) { m_nWidth = w; m_nHeight = h; @@ -22,13 +22,13 @@ CJBig2_Image::CJBig2_Image(FX_INT32 w, FX_INT32 h) } m_nStride = ((w + 31) >> 5) << 2; if (m_nStride * m_nHeight > 0 && 104857600 / (int)m_nStride > m_nHeight) { - m_pData = (FX_BYTE *)m_pModule->JBig2_Malloc2(m_nStride, m_nHeight); + m_pData = (uint8_t *)m_pModule->JBig2_Malloc2(m_nStride, m_nHeight); } else { m_pData = NULL; } m_bNeedFree = TRUE; } -CJBig2_Image::CJBig2_Image(FX_INT32 w, FX_INT32 h, FX_INT32 stride, FX_BYTE*pBuf) +CJBig2_Image::CJBig2_Image(int32_t w, int32_t h, int32_t stride, uint8_t*pBuf) { m_nWidth = w; m_nHeight = h; @@ -43,7 +43,7 @@ CJBig2_Image::CJBig2_Image(CJBig2_Image &im) m_nHeight = im.m_nHeight; m_nStride = im.m_nStride; if (im.m_pData) { - m_pData = (FX_BYTE*)m_pModule->JBig2_Malloc2(m_nStride, m_nHeight); + m_pData = (uint8_t*)m_pModule->JBig2_Malloc2(m_nStride, m_nHeight); JBIG2_memcpy(m_pData, im.m_pData, m_nStride * m_nHeight); } else { m_pData = NULL; @@ -56,12 +56,12 @@ CJBig2_Image::~CJBig2_Image() m_pModule->JBig2_Free(m_pData); } } -FX_BOOL CJBig2_Image::getPixel(FX_INT32 x, FX_INT32 y) +FX_BOOL CJBig2_Image::getPixel(int32_t x, int32_t y) { if (!m_pData) { return 0; } - FX_INT32 m, n; + int32_t m, n; if(x < 0 || x >= m_nWidth) { return 0; } @@ -73,12 +73,12 @@ FX_BOOL CJBig2_Image::getPixel(FX_INT32 x, FX_INT32 y) return ((m_pData[m] >> (7 - n)) & 1); } -FX_INT32 CJBig2_Image::setPixel(FX_INT32 x, FX_INT32 y, FX_BOOL v) +int32_t CJBig2_Image::setPixel(int32_t x, int32_t y, FX_BOOL v) { if (!m_pData) { return 0; } - FX_INT32 m, n; + int32_t m, n; if(x < 0 || x >= m_nWidth) { return 0; } @@ -94,7 +94,7 @@ FX_INT32 CJBig2_Image::setPixel(FX_INT32 x, FX_INT32 y, FX_BOOL v) } return 1; } -void CJBig2_Image::copyLine(FX_INT32 hTo, FX_INT32 hFrom) +void CJBig2_Image::copyLine(int32_t hTo, int32_t hFrom) { if (!m_pData) { return; @@ -112,14 +112,14 @@ void CJBig2_Image::fill(FX_BOOL v) } JBIG2_memset(m_pData, v ? 0xff : 0, m_nStride * m_nHeight); } -FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) { if (!m_pData) { return FALSE; } return composeTo_opt2(pDst, x, y, op); } -FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op, const FX_RECT* pSrcRect) +FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect) { if (!m_pData) { return FALSE; @@ -129,10 +129,10 @@ FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig } return composeTo_opt2(pDst, x, y, op, pSrcRect); } -FX_BOOL CJBig2_Image::composeTo_unopt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeTo_unopt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) { - FX_INT32 w, h, dx, dy; - FX_INT32 i, j; + int32_t w, h, dx, dy; + int32_t i, j; w = m_nWidth; h = m_nHeight; dx = dy = 0; @@ -196,10 +196,10 @@ FX_BOOL CJBig2_Image::composeTo_unopt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y return TRUE; } -FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) { - FX_INT32 x0, x1, y0, y1, xx, yy; - FX_BYTE *pLineSrc, *pLineDst, *srcPtr, *destPtr; + int32_t x0, x1, y0, y1, xx, yy; + uint8_t *pLineSrc, *pLineDst, *srcPtr, *destPtr; FX_DWORD src0, src1, src, dest, s1, s2, m1, m2, m3; FX_BOOL oneByte; if (!m_pData) { @@ -247,7 +247,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc; dest = *destPtr; dest |= (*srcPtr >> s1) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -259,7 +259,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc; dest = *destPtr; dest &= ((0xff00 | *srcPtr) >> s1) | m1; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -271,7 +271,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc; dest = *destPtr; dest ^= (*srcPtr >> s1) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -283,7 +283,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc; dest = *destPtr; dest ^= ((*srcPtr ^ 0xff) >> s1) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -295,7 +295,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc; dest = *destPtr; dest = (dest & ~m3) | ((*srcPtr >> s1) & m3); - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -310,7 +310,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc + (-x >> 3); dest = *destPtr; dest |= *srcPtr & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -322,7 +322,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc + (-x >> 3); dest = *destPtr; dest &= *srcPtr | m1; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -334,7 +334,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc + (-x >> 3); dest = *destPtr; dest ^= *srcPtr & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -346,7 +346,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc + (-x >> 3); dest = *destPtr; dest ^= (*srcPtr ^ 0xff) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -358,7 +358,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc + (-x >> 3); dest = *destPtr; dest = (*srcPtr & m2) | (dest & m1); - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -376,7 +376,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; dest = *destPtr; dest |= src1 >> s1; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; xx = x0 + 8; for (; xx < x1 - 8; xx += 8) { dest = *destPtr; @@ -384,7 +384,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest |= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -395,7 +395,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest |= src & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -408,7 +408,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; dest = *destPtr; dest &= (0xff00 | src1) >> s1; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; xx = x0 + 8; for (; xx < x1 - 8; xx += 8) { dest = *destPtr; @@ -416,7 +416,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest &= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -427,7 +427,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest &= src | m1; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -440,7 +440,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; dest = *destPtr; dest ^= src1 >> s1; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; xx = x0 + 8; for (; xx < x1 - 8; xx += 8) { dest = *destPtr; @@ -448,7 +448,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -459,7 +459,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -472,7 +472,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; dest = *destPtr; dest ^= (src1 ^ 0xff) >> s1; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; xx = x0 + 8; for (; xx < x1 - 8; xx += 8) { dest = *destPtr; @@ -480,7 +480,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src ^ 0xff; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -491,7 +491,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= (src ^ 0xff) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -504,7 +504,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; dest = *destPtr; dest = (dest & (0xff << s2)) | (src1 >> s1); - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; xx = x0 + 8; for (; xx < x1 - 8; xx += 8) { dest = *destPtr; @@ -512,7 +512,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest = src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -523,7 +523,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest = (src & m2) | (dest & m1); - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -544,7 +544,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest |= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -555,7 +555,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest |= src & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -573,7 +573,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest &= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -584,7 +584,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest &= src | m1; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -602,7 +602,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -613,7 +613,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -631,7 +631,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src ^ 0xff; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -642,7 +642,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= (src ^ 0xff) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -660,7 +660,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest = src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -671,7 +671,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest = (src & m2) | (dest & m1); - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -682,24 +682,24 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } return TRUE; } -FX_BOOL CJBig2_Image::composeFrom(FX_INT32 x, FX_INT32 y, CJBig2_Image *pSrc, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op) { if (!m_pData) { return FALSE; } return pSrc->composeTo(this, x, y, op); } -FX_BOOL CJBig2_Image::composeFrom(FX_INT32 x, FX_INT32 y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect) +FX_BOOL CJBig2_Image::composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect) { if (!m_pData) { return FALSE; } return pSrc->composeTo(this, x, y, op, pSrcRect); } -CJBig2_Image *CJBig2_Image::subImage_unopt(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT32 h) +CJBig2_Image *CJBig2_Image::subImage_unopt(int32_t x, int32_t y, int32_t w, int32_t h) { CJBig2_Image *pImage; - FX_INT32 i, j; + int32_t i, j; JBIG2_ALLOC(pImage, CJBig2_Image(w, h)); for(j = 0; j < h; j++) { for(i = 0; i < w; i++) { @@ -709,13 +709,13 @@ CJBig2_Image *CJBig2_Image::subImage_unopt(FX_INT32 x, FX_INT32 y, FX_INT32 w, F return pImage; } #define JBIG2_GETDWORD(buf) ((FX_DWORD)(((buf)[0] << 24) | ((buf)[1] << 16) | ((buf)[2] << 8) | (buf)[3])) -CJBig2_Image *CJBig2_Image::subImage(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT32 h) +CJBig2_Image *CJBig2_Image::subImage(int32_t x, int32_t y, int32_t w, int32_t h) { CJBig2_Image *pImage; - FX_INT32 m, n, j; - FX_BYTE *pLineSrc, *pLineDst; + int32_t m, n, j; + uint8_t *pLineSrc, *pLineDst; FX_DWORD wTmp; - FX_BYTE *pSrc, *pSrcEnd, *pDst, *pDstEnd; + uint8_t *pSrc, *pSrcEnd, *pDst, *pDstEnd; if (w == 0 || h == 0) { return NULL; } @@ -755,10 +755,10 @@ CJBig2_Image *CJBig2_Image::subImage(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT3 } else { wTmp = JBIG2_GETDWORD(pSrc) << n; } - pDst[0] = (FX_BYTE)(wTmp >> 24); - pDst[1] = (FX_BYTE)(wTmp >> 16); - pDst[2] = (FX_BYTE)(wTmp >> 8); - pDst[3] = (FX_BYTE)wTmp; + pDst[0] = (uint8_t)(wTmp >> 24); + pDst[1] = (uint8_t)(wTmp >> 16); + pDst[2] = (uint8_t)(wTmp >> 8); + pDst[3] = (uint8_t)wTmp; } pLineSrc += m_nStride; pLineDst += pImage->m_nStride; @@ -766,7 +766,7 @@ CJBig2_Image *CJBig2_Image::subImage(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT3 } return pImage; } -void CJBig2_Image::expand(FX_INT32 h, FX_BOOL v) +void CJBig2_Image::expand(int32_t h, FX_BOOL v) { if (!m_pData || h <= m_nHeight) { return; @@ -780,7 +780,7 @@ void CJBig2_Image::expand(FX_INT32 h, FX_BOOL v) return; } //The guaranteed reallocated memory is to be < 4GB (unsigned int). - m_pData = (FX_BYTE*)m_pModule->JBig2_Realloc(m_pData, safeMemSize.ValueOrDie()); + m_pData = (uint8_t*)m_pModule->JBig2_Realloc(m_pData, safeMemSize.ValueOrDie()); //The result of dwHeight * dwStride doesn't overflow after the //checking of safeMemSize. //The same as the result of (dwH - dwHeight) * dwStride) because @@ -789,15 +789,15 @@ void CJBig2_Image::expand(FX_INT32 h, FX_BOOL v) JBIG2_memset(m_pData + dwHeight * dwStride, v ? 0xff : 0, (dwH - dwHeight) * dwStride); m_nHeight = h; } -FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) { - FX_INT32 xs0 = 0, ys0 = 0, xs1 = 0, ys1 = 0, xd0 = 0, yd0 = 0, xd1 = 0, + int32_t xs0 = 0, ys0 = 0, xs1 = 0, ys1 = 0, xd0 = 0, yd0 = 0, xd1 = 0, yd1 = 0, xx = 0, yy = 0, w = 0, h = 0, middleDwords = 0, lineLeft = 0; FX_DWORD s1 = 0, d1 = 0, d2 = 0, shift = 0, shift1 = 0, shift2 = 0, tmp = 0, tmp1 = 0, tmp2 = 0, maskL = 0, maskR = 0, maskM = 0; - FX_BYTE *lineSrc = NULL, *lineDst = NULL, *sp = NULL, *dp = NULL; + uint8_t *lineSrc = NULL, *lineDst = NULL, *sp = NULL, *dp = NULL; if (!m_pData) { return FALSE; @@ -867,10 +867,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -896,10 +896,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -927,10 +927,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -963,10 +963,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -990,10 +990,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1018,10 +1018,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; @@ -1051,10 +1051,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1078,10 +1078,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1105,10 +1105,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; @@ -1140,10 +1140,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; dp += 4; } for(xx = 0; xx < middleDwords; xx++) { @@ -1166,10 +1166,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1194,10 +1194,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; @@ -1206,12 +1206,12 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } return 1; } -FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op, const FX_RECT* pSrcRect) +FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect) { - FX_INT32 xs0, ys0, xs1, ys1, xd0, yd0, xd1, yd1, xx, yy, w, h, middleDwords, lineLeft; + int32_t xs0, ys0, xs1, ys1, xd0, yd0, xd1, yd1, xx, yy, w, h, middleDwords, lineLeft; FX_DWORD s1, d1, d2, shift, shift1, shift2, tmp, tmp1, tmp2, maskL, maskR, maskM; - FX_BYTE *lineSrc, *lineDst, *sp, *dp; - FX_INT32 sw, sh; + uint8_t *lineSrc, *lineDst, *sp, *dp; + int32_t sw, sh; if (!m_pData) { return FALSE; } @@ -1290,10 +1290,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -1319,10 +1319,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -1350,10 +1350,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -1386,10 +1386,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1413,10 +1413,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1441,10 +1441,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; @@ -1474,10 +1474,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1501,10 +1501,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1528,10 +1528,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; @@ -1563,10 +1563,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; dp += 4; } for(xx = 0; xx < middleDwords; xx++) { @@ -1589,10 +1589,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1617,10 +1617,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; diff --git a/core/src/fxcodec/jbig2/JBig2_Image.h b/core/src/fxcodec/jbig2/JBig2_Image.h index 5d06695c7c..423bebcede 100644 --- a/core/src/fxcodec/jbig2/JBig2_Image.h +++ b/core/src/fxcodec/jbig2/JBig2_Image.h @@ -20,48 +20,48 @@ class CJBig2_Image : public CJBig2_Object { public: - CJBig2_Image(FX_INT32 w, FX_INT32 h); + CJBig2_Image(int32_t w, int32_t h); - CJBig2_Image(FX_INT32 w, FX_INT32 h, FX_INT32 stride, FX_BYTE*pBuf); + CJBig2_Image(int32_t w, int32_t h, int32_t stride, uint8_t*pBuf); CJBig2_Image(CJBig2_Image &im); ~CJBig2_Image(); - FX_BOOL getPixel(FX_INT32 x, FX_INT32 y); + FX_BOOL getPixel(int32_t x, int32_t y); - FX_INT32 setPixel(FX_INT32 x, FX_INT32 y, FX_BOOL v); + int32_t setPixel(int32_t x, int32_t y, FX_BOOL v); - void copyLine(FX_INT32 hTo, FX_INT32 hFrom); + void copyLine(int32_t hTo, int32_t hFrom); void fill(FX_BOOL v); - FX_BOOL composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op); - FX_BOOL composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op, const FX_RECT* pSrcRect); + FX_BOOL composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); + FX_BOOL composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect); - FX_BOOL composeTo_unopt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op); + FX_BOOL composeTo_unopt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); - FX_BOOL composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op); + FX_BOOL composeTo_opt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); - FX_BOOL composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op); - FX_BOOL composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op, const FX_RECT* pSrcRect); + FX_BOOL composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); + FX_BOOL composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect); - FX_BOOL composeFrom(FX_INT32 x, FX_INT32 y, CJBig2_Image *pSrc, JBig2ComposeOp op); - FX_BOOL composeFrom(FX_INT32 x, FX_INT32 y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect); - CJBig2_Image *subImage_unopt(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT32 h); + FX_BOOL composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op); + FX_BOOL composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect); + CJBig2_Image *subImage_unopt(int32_t x, int32_t y, int32_t w, int32_t h); - CJBig2_Image *subImage(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT32 h); + CJBig2_Image *subImage(int32_t x, int32_t y, int32_t w, int32_t h); - void expand(FX_INT32 h, FX_BOOL v); + void expand(int32_t h, FX_BOOL v); public: - FX_INT32 m_nWidth; + int32_t m_nWidth; - FX_INT32 m_nHeight; + int32_t m_nHeight; - FX_INT32 m_nStride; + int32_t m_nStride; - FX_BYTE *m_pData; + uint8_t *m_pData; FX_BOOL m_bNeedFree; }; diff --git a/core/src/fxcodec/jbig2/JBig2_List.h b/core/src/fxcodec/jbig2/JBig2_List.h index 9292724b1e..19f99dec3d 100644 --- a/core/src/fxcodec/jbig2/JBig2_List.h +++ b/core/src/fxcodec/jbig2/JBig2_List.h @@ -13,7 +13,7 @@ class CJBig2_List : public CJBig2_Object { public: - CJBig2_List(FX_INT32 nSize = 8) + CJBig2_List(int32_t nSize = 8) { m_nSize = nSize; m_pArray = (TYPE**)m_pModule->JBig2_Malloc2(sizeof(TYPE*), nSize); @@ -28,7 +28,7 @@ public: void clear() { - FX_INT32 i; + int32_t i; for(i = 0; i < m_nLength; i++) { delete m_pArray[i]; } @@ -45,12 +45,12 @@ public: } - FX_INT32 getLength() + int32_t getLength() { return m_nLength; } - TYPE *getAt(FX_INT32 nIndex) + TYPE *getAt(int32_t nIndex) { return m_pArray[nIndex]; } @@ -60,8 +60,8 @@ public: return m_pArray[m_nLength - 1]; } private: - FX_INT32 m_nSize; + int32_t m_nSize; TYPE **m_pArray; - FX_INT32 m_nLength; + int32_t m_nLength; }; #endif diff --git a/core/src/fxcodec/jbig2/JBig2_Module.h b/core/src/fxcodec/jbig2/JBig2_Module.h index 711cf4047b..aef31bb49f 100644 --- a/core/src/fxcodec/jbig2/JBig2_Module.h +++ b/core/src/fxcodec/jbig2/JBig2_Module.h @@ -22,7 +22,7 @@ public: virtual void JBig2_Free(FX_LPVOID pMem) = 0; - virtual void JBig2_Assert(FX_INT32 nExpression) {}; + virtual void JBig2_Assert(int32_t nExpression) {}; virtual void JBig2_Error(FX_LPCSTR format, ...) {}; diff --git a/core/src/fxcodec/jbig2/JBig2_Object.cpp b/core/src/fxcodec/jbig2/JBig2_Object.cpp index 2bb267b085..4bb00b897b 100644 --- a/core/src/fxcodec/jbig2/JBig2_Object.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Object.cpp @@ -36,9 +36,9 @@ void *CJBig2_Object::operator new[](size_t size, CJBig2_Module *pModule, size_t FX_LPCSTR filename, int line) { void *p; - FX_BYTE *pCur, *pEnd; - p = (FX_BYTE *)pModule->JBig2_Malloc((FX_DWORD)size); - pCur = (FX_BYTE *)p; + uint8_t *pCur, *pEnd; + p = (uint8_t *)pModule->JBig2_Malloc((FX_DWORD)size); + pCur = (uint8_t *)p; pEnd = pCur + size; for(; pCur < pEnd; pCur += unit_size) { ((CJBig2_Object *)pCur)->m_pModule = pModule; @@ -53,9 +53,9 @@ void CJBig2_Object::operator delete[](void *p, CJBig2_Module *pModule, size_t un void *CJBig2_Object::operator new[](size_t size, CJBig2_Module *pModule, size_t unit_size) { void *p; - FX_BYTE *pCur, *pEnd; - p = (FX_BYTE *)pModule->JBig2_Malloc((FX_DWORD)size); - pCur = (FX_BYTE *)p; + uint8_t *pCur, *pEnd; + p = (uint8_t *)pModule->JBig2_Malloc((FX_DWORD)size); + pCur = (uint8_t *)p; pEnd = pCur + size; for(; pCur < pEnd; pCur += unit_size) { ((CJBig2_Object *)pCur)->m_pModule = pModule; diff --git a/core/src/fxcodec/jbig2/JBig2_Page.h b/core/src/fxcodec/jbig2/JBig2_Page.h index d7399bd452..b07eba8a3a 100644 --- a/core/src/fxcodec/jbig2/JBig2_Page.h +++ b/core/src/fxcodec/jbig2/JBig2_Page.h @@ -12,7 +12,7 @@ struct JBig2PageInfo : public CJBig2_Object { m_dwHeight; FX_DWORD m_dwResolutionX, m_dwResolutionY; - FX_BYTE m_cFlags; + uint8_t m_cFlags; FX_BOOL m_bIsStriped; FX_WORD m_wMaxStripeSize; }; diff --git a/core/src/fxcodec/jbig2/JBig2_Segment.h b/core/src/fxcodec/jbig2/JBig2_Segment.h index 33ee721a1b..fe44bc962d 100644 --- a/core/src/fxcodec/jbig2/JBig2_Segment.h +++ b/core/src/fxcodec/jbig2/JBig2_Segment.h @@ -42,19 +42,19 @@ public: FX_DWORD m_dwNumber; union { struct { - FX_BYTE type : 6; - FX_BYTE page_association_size : 1; - FX_BYTE deferred_non_retain : 1; + uint8_t type : 6; + uint8_t page_association_size : 1; + uint8_t deferred_non_retain : 1; } s; - FX_BYTE c; + uint8_t c; } m_cFlags; - FX_INT32 m_nReferred_to_segment_count; + int32_t m_nReferred_to_segment_count; FX_DWORD * m_pReferred_to_segment_numbers; FX_DWORD m_dwPage_association; FX_DWORD m_dwData_length; FX_DWORD m_dwHeader_Length; - FX_BYTE *m_pData; + uint8_t *m_pData; JBig2_SegmentState m_State; JBig2_ResultType m_nResultType; union { |