diff options
Diffstat (limited to 'core/fxcodec')
46 files changed, 785 insertions, 785 deletions
diff --git a/core/fxcodec/codec/codec_int.h b/core/fxcodec/codec/codec_int.h index d19a694222..c7bd9fc6fe 100644 --- a/core/fxcodec/codec/codec_int.h +++ b/core/fxcodec/codec/codec_int.h @@ -26,15 +26,15 @@ class CCodec_BasicModule : public ICodec_BasicModule { public: // ICodec_BasicModule: FX_BOOL RunLengthEncode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) override; + uint32_t& dest_size) override; FX_BOOL A85Encode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) override; + uint32_t& dest_size) override; ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -60,7 +60,7 @@ class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder { protected: class ImageDataCache { public: - ImageDataCache(int width, int height, FX_DWORD pitch); + ImageDataCache(int width, int height, uint32_t pitch); ~ImageDataCache(); bool AllocateCache(); @@ -77,7 +77,7 @@ class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder { const int m_Width; const int m_Height; - const FX_DWORD m_Pitch; + const uint32_t m_Pitch; int m_nCachedLines; std::unique_ptr<uint8_t, FxFreeDeleter> m_Data; }; @@ -95,7 +95,7 @@ class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder { int m_OutputHeight; int m_nComps; int m_bpc; - FX_DWORD m_Pitch; + uint32_t m_Pitch; FX_BOOL m_bColorTransformed; int m_NextLine; uint8_t* m_pLastScanline; @@ -106,7 +106,7 @@ class CCodec_FaxModule : public ICodec_FaxModule { public: // ICodec_FaxModule: ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int K, @@ -120,13 +120,13 @@ class CCodec_FaxModule : public ICodec_FaxModule { int height, int pitch, uint8_t*& dest_buf, - FX_DWORD& dest_size) override; + uint32_t& dest_size) override; }; class CCodec_FlateModule : public ICodec_FlateModule { public: virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -135,60 +135,60 @@ class CCodec_FlateModule : public ICodec_FlateModule { int Colors, int BitsPerComponent, int Columns); - virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, + virtual uint32_t FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, FX_BOOL bEarlyChange, int predictor, int Colors, int BitsPerComponent, int Columns, - FX_DWORD estimated_size, + uint32_t estimated_size, uint8_t*& dest_buf, - FX_DWORD& dest_size); + uint32_t& dest_size); virtual FX_BOOL Encode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int predictor, int Colors, int BitsPerComponent, int Columns, uint8_t*& dest_buf, - FX_DWORD& dest_size); + uint32_t& dest_size); virtual FX_BOOL Encode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size); + uint32_t& dest_size); }; class CCodec_JpegModule : public ICodec_JpegModule { public: CCodec_JpegModule() {} ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, FX_BOOL ColorTransform) override; FX_BOOL LoadInfo(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int& width, int& height, int& num_components, int& bits_per_components, FX_BOOL& color_transform, uint8_t** icc_buf_ptr, - FX_DWORD* icc_length) override; + uint32_t* icc_length) override; FX_BOOL Encode(const CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, - FX_DWORD icc_length) override; + uint32_t icc_length) override; void* Start() override; void Finish(void* pContext) override; void Input(void* pContext, const uint8_t* src_buf, - FX_DWORD src_size) override; + uint32_t src_size) override; #ifndef PDF_ENABLE_XFA int ReadHeader(void* pContext, int* width, int* height, int* nComps) override; #else // PDF_ENABLE_XFA @@ -200,7 +200,7 @@ class CCodec_JpegModule : public ICodec_JpegModule { #endif // PDF_ENABLE_XFA int StartScanline(void* pContext, int down_scale) override; FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf) override; - FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override; + uint32_t GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override; }; #ifdef PDF_ENABLE_XFA @@ -213,7 +213,7 @@ class CCodec_PngModule : public ICodec_PngModule { virtual void Finish(void* pContext); virtual FX_BOOL Input(void* pContext, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, CFX_DIBAttribute* pAttribute); protected: @@ -224,8 +224,8 @@ class CCodec_GifModule : public ICodec_GifModule { CCodec_GifModule() { FXSYS_memset(m_szLastError, '\0', 256); } virtual void* Start(void* pModule); virtual void Finish(void* pContext); - virtual FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr); - virtual void Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size); + virtual uint32_t GetAvailInput(void* pContext, uint8_t** avail_buf_ptr); + virtual void Input(void* pContext, const uint8_t* src_buf, uint32_t src_size); virtual int32_t ReadHeader(void* pContext, int* width, @@ -249,17 +249,17 @@ class CCodec_BmpModule : public ICodec_BmpModule { CCodec_BmpModule() { FXSYS_memset(m_szLastError, 0, sizeof(m_szLastError)); } void* Start(void* pModule) override; void Finish(void* pContext) override; - FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override; + uint32_t GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override; void Input(void* pContext, const uint8_t* src_buf, - FX_DWORD src_size) override; + uint32_t src_size) override; int32_t ReadHeader(void* pContext, int32_t* width, int32_t* height, FX_BOOL* tb_flag, int32_t* components, int32_t* pal_num, - FX_DWORD** pal_pp, + uint32_t** pal_pp, CFX_DIBAttribute* pAttribute) override; int32_t LoadImage(void* pContext) override; @@ -279,25 +279,25 @@ class CCodec_IccModule : public ICodec_IccModule { void* CreateTransform(ICodec_IccModule::IccParam* pInputParam, ICodec_IccModule::IccParam* pOutputParam, ICodec_IccModule::IccParam* pProofParam = NULL, - FX_DWORD dwIntent = Icc_INTENT_PERCEPTUAL, - FX_DWORD dwFlag = Icc_FLAGS_DEFAULT, - FX_DWORD dwPrfIntent = Icc_INTENT_ABSOLUTE_COLORIMETRIC, - FX_DWORD dwPrfFlag = Icc_FLAGS_SOFTPROOFING) override; + uint32_t dwIntent = Icc_INTENT_PERCEPTUAL, + uint32_t dwFlag = Icc_FLAGS_DEFAULT, + uint32_t dwPrfIntent = Icc_INTENT_ABSOLUTE_COLORIMETRIC, + uint32_t dwPrfFlag = Icc_FLAGS_SOFTPROOFING) override; void* CreateTransform_sRGB( const uint8_t* pProfileData, - FX_DWORD dwProfileSize, - FX_DWORD& nComponents, + uint32_t dwProfileSize, + uint32_t& nComponents, int32_t intent = 0, - FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT) override; + uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT) override; void* CreateTransform_CMYK( const uint8_t* pSrcProfileData, - FX_DWORD dwSrcProfileSize, - FX_DWORD& nSrcComponents, + uint32_t dwSrcProfileSize, + uint32_t& nSrcComponents, const uint8_t* pDstProfileData, - FX_DWORD dwDstProfileSize, + uint32_t dwDstProfileSize, int32_t intent = 0, - FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, - FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT) override; + uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT, + uint32_t dwDstFormat = Icc_FORMAT_DEFAULT) override; void DestroyTransform(void* pTransform) override; void Translate(void* pTransform, FX_FLOAT* pSrcValues, @@ -306,7 +306,7 @@ class CCodec_IccModule : public ICodec_IccModule { uint8_t* pDest, const uint8_t* pSrc, int pixels) override; - void SetComponents(FX_DWORD nComponents) override { + void SetComponents(uint32_t nComponents) override { m_nComponents = nComponents; } @@ -321,7 +321,7 @@ class CCodec_IccModule : public ICodec_IccModule { Icc_CLASS ic, CFX_BinaryBuf* pTransformKey); - FX_DWORD m_nComponents; + uint32_t m_nComponents; std::map<CFX_ByteString, CFX_IccTransformCache*> m_MapTranform; std::map<CFX_ByteString, CFX_IccProfileCache*> m_MapProfile; }; @@ -333,12 +333,12 @@ class CCodec_JpxModule : public ICodec_JpxModule { // ICodec_JpxModule: CJPX_Decoder* CreateDecoder(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, CPDF_ColorSpace* cs) override; void GetImageInfo(CJPX_Decoder* pDecoder, - FX_DWORD* width, - FX_DWORD* height, - FX_DWORD* components) override; + uint32_t* width, + uint32_t* height, + uint32_t* components) override; bool Decode(CJPX_Decoder* pDecoder, uint8_t* dest_data, int pitch, @@ -354,10 +354,10 @@ class CCodec_TiffModule : public ICodec_TiffModule { void GetFrames(void* ctx, int32_t& frames) override; FX_BOOL LoadFrameInfo(void* ctx, int32_t frame, - FX_DWORD& width, - FX_DWORD& height, - FX_DWORD& comps, - FX_DWORD& bpc, + uint32_t& width, + uint32_t& height, + uint32_t& comps, + uint32_t& bpc, CFX_DIBAttribute* pAttribute) override; FX_BOOL Decode(void* ctx, class CFX_DIBitmap* pDIBitmap) override; void DestroyDecoder(void* ctx) override; @@ -372,12 +372,12 @@ class CCodec_Jbig2Context { CCodec_Jbig2Context(); ~CCodec_Jbig2Context() {} - FX_DWORD m_width; - FX_DWORD m_height; + uint32_t m_width; + uint32_t m_height; CPDF_StreamAcc* m_pGlobalStream; CPDF_StreamAcc* m_pSrcStream; uint8_t* m_dest_buf; - FX_DWORD m_dest_pitch; + uint32_t m_dest_pitch; IFX_Pause* m_pPause; CJBig2_Context* m_pContext; CJBig2_Image* m_dest_image; @@ -391,12 +391,12 @@ class CCodec_Jbig2Module : public ICodec_Jbig2Module { void* CreateJbig2Context() override; FXCODEC_STATUS StartDecode(void* pJbig2Context, CFX_PrivateData* pPrivateData, - FX_DWORD width, - FX_DWORD height, + uint32_t width, + uint32_t height, CPDF_StreamAcc* src_stream, CPDF_StreamAcc* global_stream, uint8_t* dest_buf, - FX_DWORD dest_pitch, + uint32_t dest_pitch, IFX_Pause* pPause) override; FXCODEC_STATUS ContinueDecode(void* pJbig2Context, IFX_Pause* pPause) override; diff --git a/core/fxcodec/codec/fx_codec.cpp b/core/fxcodec/codec/fx_codec.cpp index 92dba69acf..0952c809ac 100644 --- a/core/fxcodec/codec/fx_codec.cpp +++ b/core/fxcodec/codec/fx_codec.cpp @@ -32,7 +32,7 @@ CCodec_ModuleMgr::CCodec_ModuleMgr() CCodec_ScanlineDecoder::ImageDataCache::ImageDataCache(int width, int height, - FX_DWORD pitch) + uint32_t pitch) : m_Width(width), m_Height(height), m_Pitch(pitch), m_nCachedLines(0) {} CCodec_ScanlineDecoder::ImageDataCache::~ImageDataCache() {} @@ -147,9 +147,9 @@ void CCodec_ScanlineDecoder::DownScale(int dest_width, int dest_height) { } FX_BOOL CCodec_BasicModule::RunLengthEncode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { return FALSE; } @@ -256,9 +256,9 @@ extern "C" double FXstrtod(const char* nptr, char** endptr) { #undef EXPONENT_DETECT FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { return FALSE; } @@ -287,7 +287,7 @@ class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder { ~CCodec_RLScanlineDecoder() override; FX_BOOL Create(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -297,7 +297,7 @@ class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder { void v_DownScale(int dest_width, int dest_height) override {} FX_BOOL v_Rewind() override; uint8_t* v_GetNextLine() override; - FX_DWORD GetSrcOffset() override { return m_SrcOffset; } + uint32_t GetSrcOffset() override { return m_SrcOffset; } protected: FX_BOOL CheckDestSize(); @@ -306,9 +306,9 @@ class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder { uint8_t* m_pScanline; const uint8_t* m_pSrcBuf; - FX_DWORD m_SrcSize; - FX_DWORD m_dwLineBytes; - FX_DWORD m_SrcOffset; + uint32_t m_SrcSize; + uint32_t m_dwLineBytes; + uint32_t m_SrcOffset; FX_BOOL m_bEOD; uint8_t m_Operator; }; @@ -324,9 +324,9 @@ CCodec_RLScanlineDecoder::~CCodec_RLScanlineDecoder() { FX_Free(m_pScanline); } FX_BOOL CCodec_RLScanlineDecoder::CheckDestSize() { - FX_DWORD i = 0; - FX_DWORD old_size = 0; - FX_DWORD dest_size = 0; + uint32_t i = 0; + uint32_t old_size = 0; + uint32_t dest_size = 0; while (i < m_SrcSize) { if (m_pSrcBuf[i] < 128) { old_size = dest_size; @@ -346,14 +346,14 @@ FX_BOOL CCodec_RLScanlineDecoder::CheckDestSize() { break; } } - if (((FX_DWORD)m_OrigWidth * m_nComps * m_bpc * m_OrigHeight + 7) / 8 > + if (((uint32_t)m_OrigWidth * m_nComps * m_bpc * m_OrigHeight + 7) / 8 > dest_size) { return FALSE; } return TRUE; } FX_BOOL CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -378,7 +378,7 @@ FX_BOOL CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf, } m_Pitch = pitch.ValueOrDie(); // Overflow should already have been checked before this is called. - m_dwLineBytes = (static_cast<FX_DWORD>(width) * nComps * bpc + 7) / 8; + m_dwLineBytes = (static_cast<uint32_t>(width) * nComps * bpc + 7) / 8; m_pScanline = FX_Alloc(uint8_t, m_Pitch); return CheckDestSize(); } @@ -398,11 +398,11 @@ uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() { } } FXSYS_memset(m_pScanline, 0, m_Pitch); - FX_DWORD col_pos = 0; + uint32_t col_pos = 0; FX_BOOL eol = FALSE; while (m_SrcOffset < m_SrcSize && !eol) { if (m_Operator < 128) { - FX_DWORD copy_len = m_Operator + 1; + uint32_t copy_len = m_Operator + 1; if (col_pos + copy_len >= m_dwLineBytes) { copy_len = m_dwLineBytes - col_pos; eol = TRUE; @@ -419,7 +419,7 @@ uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() { if (m_SrcOffset - 1 < m_SrcSize - 1) { fill = m_pSrcBuf[m_SrcOffset]; } - FX_DWORD duplicate_len = 257 - m_Operator; + uint32_t duplicate_len = 257 - m_Operator; if (col_pos + duplicate_len >= m_dwLineBytes) { duplicate_len = m_dwLineBytes - col_pos; eol = TRUE; @@ -447,7 +447,7 @@ void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) { return; } if (m_Operator < 128) { - FXSYS_assert((FX_DWORD)m_Operator + 1 >= used_bytes); + FXSYS_assert((uint32_t)m_Operator + 1 >= used_bytes); if (used_bytes == m_Operator + 1) { m_SrcOffset += used_bytes; GetNextOperator(); @@ -461,7 +461,7 @@ void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) { return; } uint8_t count = 257 - m_Operator; - FXSYS_assert((FX_DWORD)count >= used_bytes); + FXSYS_assert((uint32_t)count >= used_bytes); if (used_bytes == count) { m_SrcOffset++; GetNextOperator(); @@ -472,7 +472,7 @@ void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) { } ICodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder( const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, diff --git a/core/fxcodec/codec/fx_codec_bmp.cpp b/core/fxcodec/codec/fx_codec_bmp.cpp index d2299d6e56..31383774aa 100644 --- a/core/fxcodec/codec/fx_codec_bmp.cpp +++ b/core/fxcodec/codec/fx_codec_bmp.cpp @@ -37,7 +37,7 @@ static void bmp_read_scanline(bmp_decompress_struct_p bmp_ptr, pModule->ReadScanlineCallback(p->child_ptr, row_num, row_buf); } static FX_BOOL bmp_get_data_position(bmp_decompress_struct_p bmp_ptr, - FX_DWORD rcd_pos) { + uint32_t rcd_pos) { FXBMP_Context* p = (FXBMP_Context*)bmp_ptr->context_ptr; CCodec_BmpModule* pModule = (CCodec_BmpModule*)p->parent_ptr; return pModule->InputImagePositionBufCallback(p->child_ptr, rcd_pos); @@ -81,7 +81,7 @@ int32_t CCodec_BmpModule::ReadHeader(void* pContext, FX_BOOL* tb_flag, int32_t* components, int32_t* pal_num, - FX_DWORD** pal_pp, + uint32_t** pal_pp, CFX_DIBAttribute* pAttribute) { FXBMP_Context* p = (FXBMP_Context*)pContext; if (setjmp(p->bmp_ptr->jmpbuf)) { @@ -112,14 +112,14 @@ int32_t CCodec_BmpModule::LoadImage(void* pContext) { } return bmp_decode_image(p->bmp_ptr); } -FX_DWORD CCodec_BmpModule::GetAvailInput(void* pContext, +uint32_t CCodec_BmpModule::GetAvailInput(void* pContext, uint8_t** avial_buf_ptr) { FXBMP_Context* p = (FXBMP_Context*)pContext; return bmp_get_avail_input(p->bmp_ptr, avial_buf_ptr); } void CCodec_BmpModule::Input(void* pContext, const uint8_t* src_buf, - FX_DWORD src_size) { + uint32_t src_size) { FXBMP_Context* p = (FXBMP_Context*)pContext; bmp_input_buffer(p->bmp_ptr, (uint8_t*)src_buf, src_size); } diff --git a/core/fxcodec/codec/fx_codec_fax.cpp b/core/fxcodec/codec/fx_codec_fax.cpp index 13ffcda174..0ccebba14e 100644 --- a/core/fxcodec/codec/fx_codec_fax.cpp +++ b/core/fxcodec/codec/fx_codec_fax.cpp @@ -257,7 +257,7 @@ int FaxGetRun(const uint8_t* ins_array, const uint8_t* src_buf, int& bitpos, int bitsize) { - FX_DWORD code = 0; + uint32_t code = 0; int ins_off = 0; while (1) { uint8_t ins = ins_array[ins_off++]; @@ -602,7 +602,7 @@ class CCodec_FaxDecoder : public CCodec_ScanlineDecoder { ~CCodec_FaxDecoder() override; FX_BOOL Create(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int K, @@ -616,12 +616,12 @@ class CCodec_FaxDecoder : public CCodec_ScanlineDecoder { void v_DownScale(int dest_width, int dest_height) override {} FX_BOOL v_Rewind() override; uint8_t* v_GetNextLine() override; - FX_DWORD GetSrcOffset() override; + uint32_t GetSrcOffset() override; int m_Encoding, m_bEndOfLine, m_bByteAlign, m_bBlack; int bitpos; const uint8_t* m_pSrcBuf; - FX_DWORD m_SrcSize; + uint32_t m_SrcSize; uint8_t* m_pScanlineBuf; uint8_t* m_pRefBuf; }; @@ -635,7 +635,7 @@ CCodec_FaxDecoder::~CCodec_FaxDecoder() { FX_Free(m_pRefBuf); } FX_BOOL CCodec_FaxDecoder::Create(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int K, @@ -657,7 +657,7 @@ FX_BOOL CCodec_FaxDecoder::Create(const uint8_t* src_buf, m_OrigHeight = height; } // Should not overflow. Checked by FPDFAPI_CreateFaxDecoder. - m_Pitch = (static_cast<FX_DWORD>(m_OrigWidth) + 31) / 32 * 4; + m_Pitch = (static_cast<uint32_t>(m_OrigWidth) + 31) / 32 * 4; m_OutputWidth = m_OrigWidth; m_OutputHeight = m_OrigHeight; m_pScanlineBuf = FX_Alloc(uint8_t, m_Pitch); @@ -717,14 +717,14 @@ uint8_t* CCodec_FaxDecoder::v_GetNextLine() { } } if (m_bBlack) { - for (FX_DWORD i = 0; i < m_Pitch; i++) { + for (uint32_t i = 0; i < m_Pitch; i++) { m_pScanlineBuf[i] = ~m_pScanlineBuf[i]; } } return m_pScanlineBuf; } -FX_DWORD CCodec_FaxDecoder::GetSrcOffset() { - FX_DWORD ret = (bitpos + 7) / 8; +uint32_t CCodec_FaxDecoder::GetSrcOffset() { + uint32_t ret = (bitpos + 7) / 8; if (ret > m_SrcSize) { ret = m_SrcSize; } @@ -732,7 +732,7 @@ FX_DWORD CCodec_FaxDecoder::GetSrcOffset() { } void FaxG4Decode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int* pbitpos, uint8_t* dest_buf, int width, @@ -758,7 +758,7 @@ class CCodec_FaxEncoder { public: CCodec_FaxEncoder(const uint8_t* src_buf, int width, int height, int pitch); ~CCodec_FaxEncoder(); - void Encode(uint8_t*& dest_buf, FX_DWORD& dest_size); + void Encode(uint8_t*& dest_buf, uint32_t& dest_size); void Encode2DLine(const uint8_t* scan_line); CFX_BinaryBuf m_DestBuf; uint8_t* m_pRefLine; @@ -783,7 +783,7 @@ CCodec_FaxEncoder::~CCodec_FaxEncoder() { FX_Free(m_pRefLine); FX_Free(m_pLineBuf); } -void CCodec_FaxEncoder::Encode(uint8_t*& dest_buf, FX_DWORD& dest_size) { +void CCodec_FaxEncoder::Encode(uint8_t*& dest_buf, uint32_t& dest_size) { int dest_bitpos = 0; uint8_t last_byte = 0; for (int i = 0; i < m_Rows; i++) { @@ -807,14 +807,14 @@ FX_BOOL CCodec_FaxModule::Encode(const uint8_t* src_buf, int height, int pitch, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { CCodec_FaxEncoder encoder(src_buf, width, height, pitch); encoder.Encode(dest_buf, dest_size); return TRUE; } ICodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder( const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int K, diff --git a/core/fxcodec/codec/fx_codec_flate.cpp b/core/fxcodec/codec/fx_codec_flate.cpp index d4ad241a4d..e69c017ee7 100644 --- a/core/fxcodec/codec/fx_codec_flate.cpp +++ b/core/fxcodec/codec/fx_codec_flate.cpp @@ -83,27 +83,27 @@ namespace { class CLZWDecoder { public: int Decode(uint8_t* output, - FX_DWORD& outlen, + uint32_t& outlen, const uint8_t* input, - FX_DWORD& size, + uint32_t& size, FX_BOOL bEarlyChange); private: - void AddCode(FX_DWORD prefix_code, uint8_t append_char); - void DecodeString(FX_DWORD code); + void AddCode(uint32_t prefix_code, uint8_t append_char); + void DecodeString(uint32_t code); - FX_DWORD m_InPos; - FX_DWORD m_OutPos; + uint32_t m_InPos; + uint32_t m_OutPos; uint8_t* m_pOutput; const uint8_t* m_pInput; FX_BOOL m_Early; - FX_DWORD m_CodeArray[5021]; - FX_DWORD m_nCodes; + uint32_t m_CodeArray[5021]; + uint32_t m_nCodes; uint8_t m_DecodeStack[4000]; - FX_DWORD m_StackLen; + uint32_t m_StackLen; int m_CodeLen; }; -void CLZWDecoder::AddCode(FX_DWORD prefix_code, uint8_t append_char) { +void CLZWDecoder::AddCode(uint32_t prefix_code, uint8_t append_char) { if (m_nCodes + m_Early == 4094) { return; } @@ -116,13 +116,13 @@ void CLZWDecoder::AddCode(FX_DWORD prefix_code, uint8_t append_char) { m_CodeLen = 12; } } -void CLZWDecoder::DecodeString(FX_DWORD code) { +void CLZWDecoder::DecodeString(uint32_t code) { while (1) { int index = code - 258; if (index < 0 || index >= (int)m_nCodes) { break; } - FX_DWORD data = m_CodeArray[index]; + uint32_t data = m_CodeArray[index]; if (m_StackLen >= sizeof(m_DecodeStack)) { return; } @@ -135,9 +135,9 @@ void CLZWDecoder::DecodeString(FX_DWORD code) { m_DecodeStack[m_StackLen++] = (uint8_t)code; } int CLZWDecoder::Decode(uint8_t* dest_buf, - FX_DWORD& dest_size, + uint32_t& dest_size, const uint8_t* src_buf, - FX_DWORD& src_size, + uint32_t& src_size, FX_BOOL bEarlyChange) { m_CodeLen = 9; m_InPos = 0; @@ -146,7 +146,7 @@ int CLZWDecoder::Decode(uint8_t* dest_buf, m_pOutput = dest_buf; m_Early = bEarlyChange ? 1 : 0; m_nCodes = 0; - FX_DWORD old_code = (FX_DWORD)-1; + uint32_t old_code = (uint32_t)-1; uint8_t last_char = 0; while (1) { if (m_InPos + m_CodeLen > src_size * 8) { @@ -154,7 +154,7 @@ int CLZWDecoder::Decode(uint8_t* dest_buf, } int byte_pos = m_InPos / 8; int bit_pos = m_InPos % 8, bit_left = m_CodeLen; - FX_DWORD code = 0; + uint32_t code = 0; if (bit_pos) { bit_left -= 8 - bit_pos; code = (m_pInput[byte_pos++] & ((1 << (8 - bit_pos)) - 1)) << bit_left; @@ -178,18 +178,18 @@ int CLZWDecoder::Decode(uint8_t* dest_buf, } m_OutPos++; last_char = (uint8_t)code; - if (old_code != (FX_DWORD)-1) { + if (old_code != (uint32_t)-1) { AddCode(old_code, last_char); } old_code = code; } else if (code == 256) { m_CodeLen = 9; m_nCodes = 0; - old_code = (FX_DWORD)-1; + old_code = (uint32_t)-1; } else if (code == 257) { break; } else { - if (old_code == (FX_DWORD)-1) { + if (old_code == (uint32_t)-1) { return 2; } m_StackLen = 0; @@ -205,7 +205,7 @@ int CLZWDecoder::Decode(uint8_t* dest_buf, return -5; } if (m_pOutput) { - for (FX_DWORD i = 0; i < m_StackLen; i++) { + for (uint32_t i = 0; i < m_StackLen; i++) { m_pOutput[m_OutPos + i] = m_DecodeStack[m_StackLen - i - 1]; } } @@ -243,7 +243,7 @@ uint8_t PaethPredictor(int a, int b, int c) { } FX_BOOL PNG_PredictorEncode(uint8_t*& data_buf, - FX_DWORD& data_size, + uint32_t& data_size, int predictor, int Colors, int BitsPerComponent, @@ -400,7 +400,7 @@ void PNG_PredictLine(uint8_t* pDestData, } FX_BOOL PNG_Predictor(uint8_t*& data_buf, - FX_DWORD& data_size, + uint32_t& data_size, int Colors, int BitsPerComponent, int Columns) { @@ -540,7 +540,7 @@ void TIFF_PredictorEncodeLine(uint8_t* dest_buf, } FX_BOOL TIFF_PredictorEncode(uint8_t*& data_buf, - FX_DWORD& data_size, + uint32_t& data_size, int Colors, int BitsPerComponent, int Columns) { @@ -561,7 +561,7 @@ FX_BOOL TIFF_PredictorEncode(uint8_t*& data_buf, } void TIFF_PredictLine(uint8_t* dest_buf, - FX_DWORD row_size, + uint32_t row_size, int BitsPerComponent, int Colors, int Columns) { @@ -586,7 +586,7 @@ void TIFF_PredictLine(uint8_t* dest_buf, } int BytesPerPixel = BitsPerComponent * Colors / 8; if (BitsPerComponent == 16) { - for (FX_DWORD i = BytesPerPixel; i < row_size; i += 2) { + for (uint32_t i = BytesPerPixel; i < row_size; i += 2) { uint16_t pixel = (dest_buf[i - BytesPerPixel] << 8) | dest_buf[i - BytesPerPixel + 1]; pixel += (dest_buf[i] << 8) | dest_buf[i + 1]; @@ -594,14 +594,14 @@ void TIFF_PredictLine(uint8_t* dest_buf, dest_buf[i + 1] = (uint8_t)pixel; } } else { - for (FX_DWORD i = BytesPerPixel; i < row_size; i++) { + for (uint32_t i = BytesPerPixel; i < row_size; i++) { dest_buf[i] += dest_buf[i - BytesPerPixel]; } } } FX_BOOL TIFF_Predictor(uint8_t*& data_buf, - FX_DWORD& data_size, + uint32_t& data_size, int Colors, int BitsPerComponent, int Columns) { @@ -621,21 +621,21 @@ FX_BOOL TIFF_Predictor(uint8_t*& data_buf, } void FlateUncompress(const uint8_t* src_buf, - FX_DWORD src_size, - FX_DWORD orig_size, + uint32_t src_size, + uint32_t orig_size, uint8_t*& dest_buf, - FX_DWORD& dest_size, - FX_DWORD& offset) { - FX_DWORD guess_size = orig_size ? orig_size : src_size * 2; - const FX_DWORD kStepSize = 10240; - FX_DWORD alloc_step = orig_size ? kStepSize : std::min(src_size, kStepSize); - static const FX_DWORD kMaxInitialAllocSize = 10000000; + uint32_t& dest_size, + uint32_t& offset) { + uint32_t guess_size = orig_size ? orig_size : src_size * 2; + const uint32_t kStepSize = 10240; + uint32_t alloc_step = orig_size ? kStepSize : std::min(src_size, kStepSize); + static const uint32_t kMaxInitialAllocSize = 10000000; if (guess_size > kMaxInitialAllocSize) { guess_size = kMaxInitialAllocSize; alloc_step = kMaxInitialAllocSize; } - FX_DWORD buf_size = guess_size; - FX_DWORD last_buf_size = buf_size; + uint32_t buf_size = guess_size; + uint32_t last_buf_size = buf_size; dest_buf = nullptr; dest_size = 0; @@ -660,7 +660,7 @@ void FlateUncompress(const uint8_t* src_buf, if (avail_buf_size != 0) break; - FX_DWORD old_size = guess_size; + uint32_t old_size = guess_size; guess_size += alloc_step; if (guess_size < old_size || guess_size + 1 < guess_size) { FPDFAPI_FlateEnd(context); @@ -715,10 +715,10 @@ void FlateUncompress(const uint8_t* src_buf, dest_buf = result_tmp_bufs[0]; } else { uint8_t* result_buf = FX_Alloc(uint8_t, dest_size); - FX_DWORD result_pos = 0; + uint32_t result_pos = 0; for (int32_t i = 0; i < result_tmp_bufs.GetSize(); i++) { uint8_t* tmp_buf = result_tmp_bufs[i]; - FX_DWORD tmp_buf_size = buf_size; + uint32_t tmp_buf_size = buf_size; if (i == result_tmp_bufs.GetSize() - 1) { tmp_buf_size = last_buf_size; } @@ -740,7 +740,7 @@ class CCodec_FlateScanlineDecoder : public CCodec_ScanlineDecoder { ~CCodec_FlateScanlineDecoder() override; void Create(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -755,11 +755,11 @@ class CCodec_FlateScanlineDecoder : public CCodec_ScanlineDecoder { void v_DownScale(int dest_width, int dest_height) override {} FX_BOOL v_Rewind() override; uint8_t* v_GetNextLine() override; - FX_DWORD GetSrcOffset() override; + uint32_t GetSrcOffset() override; void* m_pFlate; const uint8_t* m_SrcBuf; - FX_DWORD m_SrcSize; + uint32_t m_SrcSize; uint8_t* m_pScanline; uint8_t* m_pLastLine; uint8_t* m_pPredictBuffer; @@ -768,7 +768,7 @@ class CCodec_FlateScanlineDecoder : public CCodec_ScanlineDecoder { int m_Colors; int m_BitsPerComponent; int m_Columns; - FX_DWORD m_PredictPitch; + uint32_t m_PredictPitch; size_t m_LeftOver; }; @@ -790,7 +790,7 @@ CCodec_FlateScanlineDecoder::~CCodec_FlateScanlineDecoder() { } } void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -806,7 +806,7 @@ void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf, m_nComps = nComps; m_bpc = bpc; m_bColorTransformed = FALSE; - m_Pitch = (static_cast<FX_DWORD>(width) * nComps * bpc + 7) / 8; + m_Pitch = (static_cast<uint32_t>(width) * nComps * bpc + 7) / 8; m_pScanline = FX_Alloc(uint8_t, m_Pitch); m_Predictor = 0; if (predictor) { @@ -825,7 +825,7 @@ void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf, m_BitsPerComponent = BitsPerComponent; m_Columns = Columns; m_PredictPitch = - (static_cast<FX_DWORD>(m_BitsPerComponent) * m_Colors * m_Columns + + (static_cast<uint32_t>(m_BitsPerComponent) * m_Colors * m_Columns + 7) / 8; m_pLastLine = FX_Alloc(uint8_t, m_PredictPitch); @@ -894,13 +894,13 @@ uint8_t* CCodec_FlateScanlineDecoder::v_GetNextLine() { } return m_pScanline; } -FX_DWORD CCodec_FlateScanlineDecoder::GetSrcOffset() { +uint32_t CCodec_FlateScanlineDecoder::GetSrcOffset() { return FPDFAPI_FlateGetTotalIn(m_pFlate); } ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder( const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -914,19 +914,19 @@ ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder( Colors, BitsPerComponent, Columns); return pDecoder; } -FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, +uint32_t CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, FX_BOOL bEarlyChange, int predictor, int Colors, int BitsPerComponent, int Columns, - FX_DWORD estimated_size, + uint32_t estimated_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { dest_buf = NULL; - FX_DWORD offset = 0; + uint32_t offset = 0; int predictor_type = 0; if (predictor) { if (predictor >= 10) { @@ -938,11 +938,11 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, if (bLZW) { { std::unique_ptr<CLZWDecoder> decoder(new CLZWDecoder); - dest_size = (FX_DWORD)-1; + dest_size = (uint32_t)-1; offset = src_size; int err = decoder->Decode(NULL, dest_size, src_buf, offset, bEarlyChange); if (err || dest_size == 0 || dest_size + 1 < dest_size) { - return static_cast<FX_DWORD>(-1); + return static_cast<uint32_t>(-1); } } { @@ -965,16 +965,16 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, ret = TIFF_Predictor(dest_buf, dest_size, Colors, BitsPerComponent, Columns); } - return ret ? offset : static_cast<FX_DWORD>(-1); + return ret ? offset : static_cast<uint32_t>(-1); } FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int predictor, int Colors, int BitsPerComponent, int Columns, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { if (predictor != 2 && predictor < 10) { return Encode(src_buf, src_size, dest_buf, dest_size); } @@ -995,13 +995,13 @@ FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, return ret; } FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { dest_size = src_size + src_size / 1000 + 12; 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; + dest_size = (uint32_t)temp_size; return TRUE; } diff --git a/core/fxcodec/codec/fx_codec_gif.cpp b/core/fxcodec/codec/fx_codec_gif.cpp index 60ca00f9fa..1657d7257e 100644 --- a/core/fxcodec/codec/fx_codec_gif.cpp +++ b/core/fxcodec/codec/fx_codec_gif.cpp @@ -37,7 +37,7 @@ static uint8_t* gif_ask_buf_for_pal(gif_decompress_struct_p gif_ptr, p->child_ptr, gif_get_frame_num(gif_ptr), pal_size); } static void gif_record_current_position(gif_decompress_struct_p gif_ptr, - FX_DWORD* cur_pos_ptr) { + uint32_t* cur_pos_ptr) { FXGIF_Context* p = (FXGIF_Context*)gif_ptr->context_ptr; CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr; pModule->RecordCurrentPositionCallback(p->child_ptr, *cur_pos_ptr); @@ -50,7 +50,7 @@ static void gif_read_scanline(gif_decompress_struct_p gif_ptr, pModule->ReadScanlineCallback(p->child_ptr, row_num, row_buf); } static FX_BOOL gif_get_record_position(gif_decompress_struct_p gif_ptr, - FX_DWORD cur_pos, + uint32_t cur_pos, int32_t left, int32_t top, int32_t width, @@ -155,7 +155,7 @@ int32_t CCodec_GifModule::LoadFrame(void* pContext, if (p->gif_ptr->cmt_data_ptr) { const uint8_t* buf = (const uint8_t*)p->gif_ptr->cmt_data_ptr->GetBuffer(0); - FX_DWORD len = p->gif_ptr->cmt_data_ptr->GetLength(); + uint32_t len = p->gif_ptr->cmt_data_ptr->GetLength(); if (len > 21) { uint8_t size = *buf++; if (size) { @@ -174,14 +174,14 @@ int32_t CCodec_GifModule::LoadFrame(void* pContext, } return ret; } -FX_DWORD CCodec_GifModule::GetAvailInput(void* pContext, +uint32_t CCodec_GifModule::GetAvailInput(void* pContext, uint8_t** avial_buf_ptr) { FXGIF_Context* p = (FXGIF_Context*)pContext; return gif_get_avail_input(p->gif_ptr, avial_buf_ptr); } void CCodec_GifModule::Input(void* pContext, const uint8_t* src_buf, - FX_DWORD src_size) { + uint32_t src_size) { FXGIF_Context* p = (FXGIF_Context*)pContext; gif_input_buffer(p->gif_ptr, (uint8_t*)src_buf, src_size); } diff --git a/core/fxcodec/codec/fx_codec_icc.cpp b/core/fxcodec/codec/fx_codec_icc.cpp index fc8113e4e6..13280d7f49 100644 --- a/core/fxcodec/codec/fx_codec_icc.cpp +++ b/core/fxcodec/codec/fx_codec_icc.cpp @@ -8,13 +8,13 @@ #include "core/include/fxcodec/fx_codec.h" #include "third_party/lcms2-2.6/include/lcms2.h" -const FX_DWORD N_COMPONENT_LAB = 3; -const FX_DWORD N_COMPONENT_GRAY = 1; -const FX_DWORD N_COMPONENT_RGB = 3; -const FX_DWORD N_COMPONENT_CMYK = 4; -const FX_DWORD N_COMPONENT_DEFAULT = 3; +const uint32_t N_COMPONENT_LAB = 3; +const uint32_t N_COMPONENT_GRAY = 1; +const uint32_t N_COMPONENT_RGB = 3; +const uint32_t N_COMPONENT_CMYK = 4; +const uint32_t N_COMPONENT_DEFAULT = 3; -FX_BOOL MD5ComputeID(const void* buf, FX_DWORD dwSize, uint8_t ID[16]) { +FX_BOOL MD5ComputeID(const void* buf, uint32_t dwSize, uint8_t ID[16]) { return cmsMD5computeIDExt(buf, dwSize, ID); } struct CLcmsCmm { @@ -67,8 +67,8 @@ FX_BOOL CheckComponents(cmsColorSpaceSignature cs, return TRUE; } -FX_DWORD GetCSComponents(cmsColorSpaceSignature cs) { - FX_DWORD components; +uint32_t GetCSComponents(cmsColorSpaceSignature cs) { + uint32_t components; switch (cs) { case cmsSigLabData: components = N_COMPONENT_LAB; @@ -90,14 +90,14 @@ FX_DWORD GetCSComponents(cmsColorSpaceSignature cs) { } void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, - FX_DWORD dwSrcProfileSize, - FX_DWORD& nSrcComponents, + uint32_t dwSrcProfileSize, + uint32_t& nSrcComponents, const unsigned char* pDstProfileData, - FX_DWORD dwDstProfileSize, + uint32_t dwDstProfileSize, int32_t nDstComponents, int intent, - FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, - FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT) { + uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT, + uint32_t dwDstFormat = Icc_FORMAT_DEFAULT) { cmsHPROFILE srcProfile = NULL; cmsHPROFILE dstProfile = NULL; cmsHTRANSFORM hTransform = NULL; @@ -170,10 +170,10 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, return pCmm; } void* IccLib_CreateTransform_sRGB(const unsigned char* pProfileData, - FX_DWORD dwProfileSize, - FX_DWORD& nComponents, + uint32_t dwProfileSize, + uint32_t& nComponents, int32_t intent, - FX_DWORD dwSrcFormat) { + uint32_t dwSrcFormat) { return IccLib_CreateTransform(pProfileData, dwProfileSize, nComponents, NULL, 0, 3, intent, dwSrcFormat); } @@ -185,7 +185,7 @@ void IccLib_DestroyTransform(void* pTransform) { delete (CLcmsCmm*)pTransform; } void IccLib_Translate(void* pTransform, - FX_DWORD nSrcComponents, + uint32_t nSrcComponents, FX_FLOAT* pSrcValues, FX_FLOAT* pDestValues) { if (!pTransform) { @@ -196,14 +196,14 @@ void IccLib_Translate(void* pTransform, if (p->m_bLab) { CFX_FixedBufGrow<double, 16> inputs(nSrcComponents); double* input = inputs; - for (FX_DWORD i = 0; i < nSrcComponents; i++) { + for (uint32_t i = 0; i < nSrcComponents; i++) { input[i] = pSrcValues[i]; } cmsDoTransform(p->m_hTransform, input, output, 1); } else { CFX_FixedBufGrow<uint8_t, 16> inputs(nSrcComponents); uint8_t* input = inputs; - for (FX_DWORD i = 0; i < nSrcComponents; i++) { + for (uint32_t i = 0; i < nSrcComponents; i++) { if (pSrcValues[i] > 1.0f) { input[i] = 255; } else if (pSrcValues[i] < 0) { @@ -284,7 +284,7 @@ ICodec_IccModule::IccCS GetProfileCSFromHandle(void* pProfile) { } ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS( const uint8_t* pProfileData, - FX_DWORD dwProfileSize) { + uint32_t dwProfileSize) { ICodec_IccModule::IccCS cs; cmsHPROFILE hProfile = cmsOpenProfileFromMem((void*)pProfileData, dwProfileSize); @@ -302,14 +302,14 @@ ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS(IFX_FileRead* pFile) { return IccCS_Unknown; } ICodec_IccModule::IccCS cs; - FX_DWORD dwSize = (FX_DWORD)pFile->GetSize(); + uint32_t dwSize = (uint32_t)pFile->GetSize(); uint8_t* pBuf = FX_Alloc(uint8_t, dwSize); pFile->ReadBlock(pBuf, 0, dwSize); cs = GetProfileCS(pBuf, dwSize); FX_Free(pBuf); return cs; } -FX_DWORD TransferProfileType(void* pProfile, FX_DWORD dwFormat) { +uint32_t TransferProfileType(void* pProfile, uint32_t dwFormat) { cmsColorSpaceSignature cs = cmsGetColorSpace(pProfile); switch (cs) { case cmsSigXYZData: @@ -359,7 +359,7 @@ class CFX_IccProfileCache { CFX_IccProfileCache(); ~CFX_IccProfileCache(); void* m_pProfile; - FX_DWORD m_dwRate; + uint32_t m_dwRate; protected: void Purge(); @@ -379,7 +379,7 @@ class CFX_IccTransformCache { CFX_IccTransformCache(CLcmsCmm* pCmm = NULL); ~CFX_IccTransformCache(); void* m_pIccTransform; - FX_DWORD m_dwRate; + uint32_t m_dwRate; CLcmsCmm* m_pCmm; protected: @@ -400,10 +400,10 @@ void CFX_IccTransformCache::Purge() {} class CFX_ByteStringKey : public CFX_BinaryBuf { public: CFX_ByteStringKey() : CFX_BinaryBuf() {} - CFX_ByteStringKey& operator<<(FX_DWORD i); + CFX_ByteStringKey& operator<<(uint32_t i); }; -CFX_ByteStringKey& CFX_ByteStringKey::operator<<(FX_DWORD i) { - AppendBlock(&i, sizeof(FX_DWORD)); +CFX_ByteStringKey& CFX_ByteStringKey::operator<<(uint32_t i) { + AppendBlock(&i, sizeof(uint32_t)); return *this; } void* CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, @@ -472,10 +472,10 @@ void* CCodec_IccModule::CreateTransform( ICodec_IccModule::IccParam* pInputParam, ICodec_IccModule::IccParam* pOutputParam, ICodec_IccModule::IccParam* pProofParam, - FX_DWORD dwIntent, - FX_DWORD dwFlag, - FX_DWORD dwPrfIntent, - FX_DWORD dwPrfFlag) { + uint32_t dwIntent, + uint32_t dwFlag, + uint32_t dwPrfIntent, + uint32_t dwPrfFlag) { CLcmsCmm* pCmm = NULL; ASSERT(pInputParam && pOutputParam); CFX_ByteStringKey key; @@ -487,9 +487,9 @@ void* CCodec_IccModule::CreateTransform( if (!pOutputProfile) { return NULL; } - FX_DWORD dwInputProfileType = + uint32_t dwInputProfileType = TransferProfileType(pInputProfile, pInputParam->dwFormat); - FX_DWORD dwOutputProfileType = + uint32_t dwOutputProfileType = TransferProfileType(pOutputProfile, pOutputParam->dwFormat); if (dwInputProfileType == 0 || dwOutputProfileType == 0) { return NULL; @@ -537,22 +537,22 @@ CCodec_IccModule::~CCodec_IccModule() { m_MapTranform.clear(); } void* CCodec_IccModule::CreateTransform_sRGB(const uint8_t* pProfileData, - FX_DWORD dwProfileSize, - FX_DWORD& nComponents, + uint32_t dwProfileSize, + uint32_t& nComponents, int32_t intent, - FX_DWORD dwSrcFormat) { + uint32_t dwSrcFormat) { return IccLib_CreateTransform_sRGB(pProfileData, dwProfileSize, nComponents, intent, dwSrcFormat); } void* CCodec_IccModule::CreateTransform_CMYK(const uint8_t* pSrcProfileData, - FX_DWORD dwSrcProfileSize, - FX_DWORD& nSrcComponents, + uint32_t dwSrcProfileSize, + uint32_t& nSrcComponents, const uint8_t* pDstProfileData, - FX_DWORD dwDstProfileSize, + uint32_t dwDstProfileSize, int32_t intent, - FX_DWORD dwSrcFormat, - FX_DWORD dwDstFormat) { + uint32_t dwSrcFormat, + uint32_t dwDstFormat) { return IccLib_CreateTransform( pSrcProfileData, dwSrcProfileSize, nSrcComponents, pDstProfileData, dwDstProfileSize, 4, intent, dwSrcFormat, dwDstFormat); diff --git a/core/fxcodec/codec/fx_codec_jbig.cpp b/core/fxcodec/codec/fx_codec_jbig.cpp index 557d246ca4..ddcec6c6bb 100644 --- a/core/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/fxcodec/codec/fx_codec_jbig.cpp @@ -58,12 +58,12 @@ void CCodec_Jbig2Module::DestroyJbig2Context(void* pJbig2Content) { } FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, CFX_PrivateData* pPrivateData, - FX_DWORD width, - FX_DWORD height, + uint32_t width, + uint32_t height, CPDF_StreamAcc* src_stream, CPDF_StreamAcc* global_stream, uint8_t* dest_buf, - FX_DWORD dest_pitch, + uint32_t dest_pitch, IFX_Pause* pPause) { if (!pJbig2Context) { return FXCODEC_STATUS_ERR_PARAMS; @@ -95,7 +95,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, return FXCODEC_STATUS_ERROR; } int dword_size = height * dest_pitch / 4; - FX_DWORD* dword_buf = (FX_DWORD*)dest_buf; + uint32_t* dword_buf = (uint32_t*)dest_buf; for (int i = 0; i < dword_size; i++) { dword_buf[i] = ~dword_buf[i]; } @@ -118,7 +118,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::ContinueDecode(void* pJbig2Context, } int dword_size = m_pJbig2Context->m_height * m_pJbig2Context->m_dest_pitch / 4; - FX_DWORD* dword_buf = (FX_DWORD*)m_pJbig2Context->m_dest_buf; + uint32_t* dword_buf = (uint32_t*)m_pJbig2Context->m_dest_buf; for (int i = 0; i < dword_size; i++) { dword_buf[i] = ~dword_buf[i]; } diff --git a/core/fxcodec/codec/fx_codec_jpeg.cpp b/core/fxcodec/codec/fx_codec_jpeg.cpp index 1b0dff7499..a81926e053 100644 --- a/core/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/fxcodec/codec/fx_codec_jpeg.cpp @@ -23,11 +23,11 @@ extern "C" { } extern "C" { -static void _JpegScanSOI(const uint8_t*& src_buf, FX_DWORD& src_size) { +static void _JpegScanSOI(const uint8_t*& src_buf, uint32_t& src_size) { if (src_size == 0) { return; } - FX_DWORD offset = 0; + uint32_t offset = 0; while (offset < src_size - 1) { if (src_buf[offset] == 0xff && src_buf[offset + 1] == 0xd8) { src_buf += offset; @@ -81,16 +81,16 @@ static void _error_do_nothing2(j_common_ptr cinfo, char*) {} #define JPEG_OVERHEAD_LEN 14 static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo, const uint8_t* icc_buf_ptr, - FX_DWORD icc_length) { + uint32_t icc_length) { if (!icc_buf_ptr || icc_length == 0) { return FALSE; } - FX_DWORD icc_segment_size = (JPEG_MARKER_MAXSIZE - 2 - JPEG_OVERHEAD_LEN); - FX_DWORD icc_segment_num = (icc_length / icc_segment_size) + 1; + uint32_t icc_segment_size = (JPEG_MARKER_MAXSIZE - 2 - JPEG_OVERHEAD_LEN); + uint32_t icc_segment_num = (icc_length / icc_segment_size) + 1; if (icc_segment_num > 255) { return FALSE; } - FX_DWORD icc_data_length = + uint32_t icc_data_length = JPEG_OVERHEAD_LEN + (icc_segment_num > 1 ? icc_segment_size : icc_length); uint8_t* icc_data = FX_Alloc(uint8_t, icc_data_length); FXSYS_memcpy(icc_data, "\x49\x43\x43\x5f\x50\x52\x4f\x46\x49\x4c\x45\x00", @@ -103,7 +103,7 @@ static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo, jpeg_write_marker(cinfo, JPEG_MARKER_ICC, icc_data, icc_data_length); } icc_data[12] = (uint8_t)icc_segment_num; - FX_DWORD icc_size = (icc_segment_num - 1) * icc_segment_size; + uint32_t icc_size = (icc_segment_num - 1) * icc_segment_size; FXSYS_memcpy(icc_data + JPEG_OVERHEAD_LEN, icc_buf_ptr + icc_size, icc_length - icc_size); jpeg_write_marker(cinfo, JPEG_MARKER_ICC, icc_data, @@ -125,7 +125,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, - FX_DWORD icc_length) { + uint32_t icc_length) { struct jpeg_error_mgr jerr; jerr.error_exit = _error_do_nothing; jerr.emit_message = _error_do_nothing1; @@ -138,10 +138,10 @@ static void _JpegEncode(const CFX_DIBSource* pSource, cinfo.err = &jerr; jpeg_create_compress(&cinfo); int Bpp = pSource->GetBPP() / 8; - FX_DWORD nComponents = Bpp >= 3 ? (pSource->IsCmykImage() ? 4 : 3) : 1; - FX_DWORD pitch = pSource->GetPitch(); - FX_DWORD width = pdfium::base::checked_cast<FX_DWORD>(pSource->GetWidth()); - FX_DWORD height = pdfium::base::checked_cast<FX_DWORD>(pSource->GetHeight()); + uint32_t nComponents = Bpp >= 3 ? (pSource->IsCmykImage() ? 4 : 3) : 1; + uint32_t pitch = pSource->GetPitch(); + uint32_t width = pdfium::base::checked_cast<uint32_t>(pSource->GetWidth()); + uint32_t height = pdfium::base::checked_cast<uint32_t>(pSource->GetHeight()); FX_SAFE_DWORD safe_buf_len = width; safe_buf_len *= height; safe_buf_len *= nComponents; @@ -150,7 +150,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, safe_buf_len += 255 * 18; safe_buf_len += icc_length; } - FX_DWORD dest_buf_length = 0; + uint32_t dest_buf_length = 0; if (!safe_buf_len.IsValid()) { dest_buf = nullptr; } else { @@ -199,7 +199,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, if (nComponents > 1) { uint8_t* dest_scan = line_buf; if (nComponents == 3) { - for (FX_DWORD i = 0; i < width; i++) { + for (uint32_t i = 0; i < width; i++) { dest_scan[0] = src_scan[2]; dest_scan[1] = src_scan[1]; dest_scan[2] = src_scan[0]; @@ -207,7 +207,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, src_scan += Bpp; } } else { - for (FX_DWORD i = 0; i < pitch; i++) { + for (uint32_t i = 0; i < pitch; i++) { *dest_scan++ = ~*src_scan++; } } @@ -246,14 +246,14 @@ static void _JpegLoadAttribute(struct jpeg_decompress_struct* pInfo, #endif // PDF_ENABLE_XFA static FX_BOOL _JpegLoadInfo(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int& width, int& height, int& num_components, int& bits_per_components, FX_BOOL& color_transform, uint8_t** icc_buf_ptr, - FX_DWORD* icc_length) { + uint32_t* icc_length) { _JpegScanSOI(src_buf, src_size); struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr; @@ -313,7 +313,7 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder { ~CCodec_JpegDecoder() override; FX_BOOL Create(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -324,7 +324,7 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder { void v_DownScale(int dest_width, int dest_height) override; FX_BOOL v_Rewind() override; uint8_t* v_GetNextLine() override; - FX_DWORD GetSrcOffset() override; + uint32_t GetSrcOffset() override; FX_BOOL InitDecode(); @@ -333,7 +333,7 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder { struct jpeg_error_mgr jerr; struct jpeg_source_mgr src; const uint8_t* m_SrcBuf; - FX_DWORD m_SrcSize; + uint32_t m_SrcSize; uint8_t* m_pScanlineBuf; FX_BOOL m_bInited; @@ -341,7 +341,7 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder { FX_BOOL m_bJpegTransform; protected: - FX_DWORD m_nDefaultScaleDenom; + uint32_t m_nDefaultScaleDenom; }; CCodec_JpegDecoder::CCodec_JpegDecoder() { @@ -396,7 +396,7 @@ FX_BOOL CCodec_JpegDecoder::InitDecode() { return TRUE; } FX_BOOL CCodec_JpegDecoder::Create(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -432,7 +432,7 @@ FX_BOOL CCodec_JpegDecoder::Create(const uint8_t* src_buf, return FALSE; } m_Pitch = - (static_cast<FX_DWORD>(cinfo.image_width) * cinfo.num_components + 3) / + (static_cast<uint32_t>(cinfo.image_width) * cinfo.num_components + 3) / 4 * 4; m_pScanlineBuf = FX_Alloc(uint8_t, m_Pitch); m_nComps = cinfo.num_components; @@ -467,7 +467,7 @@ void CCodec_JpegDecoder::v_DownScale(int dest_width, int dest_height) { FX_GetDownsampleRatio(m_OrigWidth, m_OrigHeight, dest_width, dest_height); m_OutputWidth = (m_OrigWidth + m_DownScale - 1) / m_DownScale; m_OutputHeight = (m_OrigHeight + m_DownScale - 1) / m_DownScale; - m_Pitch = (static_cast<FX_DWORD>(m_OutputWidth) * m_nComps + 3) / 4 * 4; + m_Pitch = (static_cast<uint32_t>(m_OutputWidth) * m_nComps + 3) / 4 * 4; if (old_scale != m_DownScale) { m_NextLine = -1; } @@ -506,12 +506,12 @@ uint8_t* CCodec_JpegDecoder::v_GetNextLine() { } return m_pScanlineBuf; } -FX_DWORD CCodec_JpegDecoder::GetSrcOffset() { - return (FX_DWORD)(m_SrcSize - src.bytes_in_buffer); +uint32_t CCodec_JpegDecoder::GetSrcOffset() { + return (uint32_t)(m_SrcSize - src.bytes_in_buffer); } ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder( const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -528,14 +528,14 @@ ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder( return pDecoder; } FX_BOOL CCodec_JpegModule::LoadInfo(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int& width, int& height, int& num_components, int& bits_per_components, FX_BOOL& color_transform, uint8_t** icc_buf_ptr, - FX_DWORD* icc_length) { + uint32_t* icc_length) { return _JpegLoadInfo(src_buf, src_size, width, height, num_components, bits_per_components, color_transform, icc_buf_ptr, icc_length); @@ -545,7 +545,7 @@ FX_BOOL CCodec_JpegModule::Encode(const CFX_DIBSource* pSource, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, - FX_DWORD icc_length) { + uint32_t icc_length) { if (pSource->GetBPP() < 8 || pSource->GetPalette()) return FALSE; @@ -615,7 +615,7 @@ void CCodec_JpegModule::Finish(void* pContext) { } void CCodec_JpegModule::Input(void* pContext, const unsigned char* src_buf, - FX_DWORD src_size) { + uint32_t src_size) { FXJPEG_Context* p = (FXJPEG_Context*)pContext; if (p->m_SkipSize) { if (p->m_SkipSize > src_size) { @@ -679,7 +679,7 @@ FX_BOOL CCodec_JpegModule::ReadScanline(void* pContext, int nlines = jpeg_read_scanlines(&p->m_Info, &dest_buf, 1); return nlines == 1; } -FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext, +uint32_t CCodec_JpegModule::GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) { if (avail_buf_ptr) { *avail_buf_ptr = NULL; @@ -688,5 +688,5 @@ FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext, (uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.next_input_byte; } } - return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; + return (uint32_t)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; } diff --git a/core/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/fxcodec/codec/fx_codec_jpx_opj.cpp index 99eb78f9f1..27b645c137 100644 --- a/core/fxcodec/codec/fx_codec_jpx_opj.cpp +++ b/core/fxcodec/codec/fx_codec_jpx_opj.cpp @@ -675,15 +675,15 @@ class CJPX_Decoder { public: explicit CJPX_Decoder(CPDF_ColorSpace* cs); ~CJPX_Decoder(); - FX_BOOL Init(const unsigned char* src_data, FX_DWORD src_size); - void GetInfo(FX_DWORD* width, FX_DWORD* height, FX_DWORD* components); + FX_BOOL Init(const unsigned char* src_data, uint32_t src_size); + void GetInfo(uint32_t* width, uint32_t* height, uint32_t* components); bool Decode(uint8_t* dest_buf, int pitch, const std::vector<uint8_t>& offsets); private: const uint8_t* m_SrcData; - FX_DWORD m_SrcSize; + uint32_t m_SrcSize; opj_image_t* image; opj_codec_t* l_codec; opj_stream_t* l_stream; @@ -705,7 +705,7 @@ CJPX_Decoder::~CJPX_Decoder() { } } -FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, FX_DWORD src_size) { +FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, uint32_t src_size) { static const unsigned char szJP2Header[] = { 0x00, 0x00, 0x00, 0x0c, 0x6a, 0x50, 0x20, 0x20, 0x0d, 0x0a, 0x87, 0x0a}; if (!src_data || src_size < sizeof(szJP2Header)) @@ -788,12 +788,12 @@ FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, FX_DWORD src_size) { return TRUE; } -void CJPX_Decoder::GetInfo(FX_DWORD* width, - FX_DWORD* height, - FX_DWORD* components) { - *width = (FX_DWORD)image->x1; - *height = (FX_DWORD)image->y1; - *components = (FX_DWORD)image->numcomps; +void CJPX_Decoder::GetInfo(uint32_t* width, + uint32_t* height, + uint32_t* components) { + *width = (uint32_t)image->x1; + *height = (uint32_t)image->y1; + *components = (uint32_t)image->numcomps; } bool CJPX_Decoder::Decode(uint8_t* dest_buf, @@ -874,16 +874,16 @@ CCodec_JpxModule::CCodec_JpxModule() {} CCodec_JpxModule::~CCodec_JpxModule() {} CJPX_Decoder* CCodec_JpxModule::CreateDecoder(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, CPDF_ColorSpace* cs) { std::unique_ptr<CJPX_Decoder> decoder(new CJPX_Decoder(cs)); return decoder->Init(src_buf, src_size) ? decoder.release() : nullptr; } void CCodec_JpxModule::GetImageInfo(CJPX_Decoder* pDecoder, - FX_DWORD* width, - FX_DWORD* height, - FX_DWORD* components) { + uint32_t* width, + uint32_t* height, + uint32_t* components) { pDecoder->GetInfo(width, height, components); } diff --git a/core/fxcodec/codec/fx_codec_png.cpp b/core/fxcodec/codec/fx_codec_png.cpp index a3882ba8fb..f8621001b6 100644 --- a/core/fxcodec/codec/fx_codec_png.cpp +++ b/core/fxcodec/codec/fx_codec_png.cpp @@ -239,7 +239,7 @@ void CCodec_PngModule::Finish(void* pContext) { } FX_BOOL CCodec_PngModule::Input(void* pContext, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, CFX_DIBAttribute* pAttribute) { FXPNG_Context* p = (FXPNG_Context*)pContext; if (setjmp(png_jmpbuf(p->png_ptr))) { diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp index b22d20339b..9e113c695c 100644 --- a/core/fxcodec/codec/fx_codec_progress.cpp +++ b/core/fxcodec/codec/fx_codec_progress.cpp @@ -296,12 +296,12 @@ CCodec_ProgressiveDecoder::~CCodec_ProgressiveDecoder() { FX_BOOL CCodec_ProgressiveDecoder::JpegReadMoreData( ICodec_JpegModule* pJpegModule, FXCODEC_STATUS& err_status) { - FX_DWORD dwSize = (FX_DWORD)m_pFile->GetSize(); + uint32_t dwSize = (uint32_t)m_pFile->GetSize(); if (dwSize <= m_offSet) { return FALSE; } dwSize = dwSize - m_offSet; - FX_DWORD dwAvail = pJpegModule->GetAvailInput(m_pJpegContext, NULL); + uint32_t dwAvail = pJpegModule->GetAvailInput(m_pJpegContext, NULL); if (dwAvail == m_SrcSize) { if (dwSize > FXCODEC_BLOCK_SIZE) { dwSize = FXCODEC_BLOCK_SIZE; @@ -314,7 +314,7 @@ FX_BOOL CCodec_ProgressiveDecoder::JpegReadMoreData( return FALSE; } } else { - FX_DWORD dwConsume = m_SrcSize - dwAvail; + uint32_t dwConsume = m_SrcSize - dwAvail; if (dwAvail) { FXSYS_memcpy(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail); } @@ -417,13 +417,13 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, if (pDIBitmap->GetPalette()) { return FALSE; } - FX_DWORD des_g = 0; + uint32_t des_g = 0; des_g += pPixelWeights->m_Weights[0] * src_scan[src_col]; des_scan[pPixelWeights->m_SrcStart] = (uint8_t)(des_g >> 16); } break; case FXDIB_Rgb: case FXDIB_Rgb32: { - FX_DWORD des_b = 0, des_g = 0, des_r = 0; + uint32_t des_b = 0, des_g = 0, des_r = 0; const uint8_t* p = src_scan + src_col * src_Bpp; des_b += pPixelWeights->m_Weights[0] * (*p++); des_g += pPixelWeights->m_Weights[0] * (*p++); @@ -434,7 +434,7 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, *pDes = (uint8_t)((des_r) >> 16); } break; case FXDIB_Argb: { - FX_DWORD des_r = 0, des_g = 0, des_b = 0; + uint32_t des_r = 0, des_g = 0, des_b = 0; const uint8_t* p = src_scan + src_col * src_Bpp; des_b += pPixelWeights->m_Weights[0] * (*p++); des_g += pPixelWeights->m_Weights[0] * (*p++); @@ -476,7 +476,7 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz( if (pDeviceBitmap->GetPalette()) { return; } - FX_DWORD des_g = 0; + uint32_t des_g = 0; des_g += pPixelWeights->m_Weights[0] * src_scan[pPixelWeights->m_SrcStart]; des_g += @@ -485,7 +485,7 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz( } break; case FXDIB_Rgb: case FXDIB_Rgb32: { - FX_DWORD des_b = 0, des_g = 0, des_r = 0; + uint32_t des_b = 0, des_g = 0, des_r = 0; const uint8_t* p = src_scan; p = src_scan + pPixelWeights->m_SrcStart * src_Bpp; des_b += pPixelWeights->m_Weights[0] * (*p++); @@ -501,7 +501,7 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz( des_scan += des_Bpp - 3; } break; case FXDIB_Argb: { - FX_DWORD des_a = 0, des_b = 0, des_g = 0, des_r = 0; + uint32_t des_a = 0, des_b = 0, des_g = 0, des_r = 0; const uint8_t* p = src_scan; p = src_scan + pPixelWeights->m_SrcStart * src_Bpp; des_b += pPixelWeights->m_Weights[0] * (*p++); @@ -554,12 +554,12 @@ void CCodec_ProgressiveDecoder::PngFillScanlineBufCompletedFunc(void* pModule, } FX_BOOL CCodec_ProgressiveDecoder::GifReadMoreData(ICodec_GifModule* pGifModule, FXCODEC_STATUS& err_status) { - FX_DWORD dwSize = (FX_DWORD)m_pFile->GetSize(); + uint32_t dwSize = (uint32_t)m_pFile->GetSize(); if (dwSize <= m_offSet) { return FALSE; } dwSize = dwSize - m_offSet; - FX_DWORD dwAvail = pGifModule->GetAvailInput(m_pGifContext, NULL); + uint32_t dwAvail = pGifModule->GetAvailInput(m_pGifContext, NULL); if (dwAvail == m_SrcSize) { if (dwSize > FXCODEC_BLOCK_SIZE) { dwSize = FXCODEC_BLOCK_SIZE; @@ -572,7 +572,7 @@ FX_BOOL CCodec_ProgressiveDecoder::GifReadMoreData(ICodec_GifModule* pGifModule, return FALSE; } } else { - FX_DWORD dwConsume = m_SrcSize - dwAvail; + uint32_t dwConsume = m_SrcSize - dwAvail; if (dwAvail) { FXSYS_memcpy(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail); } @@ -590,9 +590,9 @@ FX_BOOL CCodec_ProgressiveDecoder::GifReadMoreData(ICodec_GifModule* pGifModule, } void CCodec_ProgressiveDecoder::GifRecordCurrentPositionCallback( void* pModule, - FX_DWORD& cur_pos) { + uint32_t& cur_pos) { CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule; - FX_DWORD remain_size = + uint32_t remain_size = pCodec->m_pCodecMgr->GetGifModule()->GetAvailInput(pCodec->m_pGifContext); cur_pos = pCodec->m_offSet - remain_size; } @@ -604,7 +604,7 @@ uint8_t* CCodec_ProgressiveDecoder::GifAskLocalPaletteBufCallback( } FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback( void* pModule, - FX_DWORD rcd_pos, + uint32_t rcd_pos, const FX_RECT& img_rc, int32_t pal_num, void* pal_ptr, @@ -637,7 +637,7 @@ FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback( } pCodec->m_SrcPaletteNumber = pal_num; for (int i = 0; i < pal_num; i++) { - FX_DWORD j = i * 3; + uint32_t j = i * 3; pCodec->m_pSrcPalette[i] = ArgbEncode(0xff, pPalette[j], pPalette[j + 1], pPalette[j + 2]); } @@ -738,7 +738,7 @@ void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule, if (scale_y > 1.0) { int des_bottom = des_top + pCodec->m_sizeY; int des_Bpp = pDIBitmap->GetBPP() >> 3; - FX_DWORD des_ScanOffet = pCodec->m_startX * des_Bpp; + uint32_t des_ScanOffet = pCodec->m_startX * des_Bpp; if (des_row + (int)scale_y >= des_bottom - 1) { uint8_t* scan_src = (uint8_t*)pDIBitmap->GetScanline(des_row) + des_ScanOffet; @@ -746,7 +746,7 @@ void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule, while (++cur_row < des_bottom) { uint8_t* scan_des = (uint8_t*)pDIBitmap->GetScanline(cur_row) + des_ScanOffet; - FX_DWORD size = pCodec->m_sizeX * des_Bpp; + uint32_t size = pCodec->m_sizeX * des_Bpp; FXSYS_memcpy(scan_des, scan_src, size); } } @@ -761,7 +761,7 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert( double scale_y, int des_row) { int des_Bpp = pDeviceBitmap->GetBPP() >> 3; - FX_DWORD des_ScanOffet = m_startX * des_Bpp; + uint32_t des_ScanOffet = m_startX * des_Bpp; int des_top = m_startY; int des_row_1 = des_row - int(2 * scale_y); if (des_row_1 < des_top) { @@ -794,7 +794,7 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert( } break; case FXDIB_Rgb: case FXDIB_Rgb32: { - FX_DWORD des_b = 0, des_g = 0, des_r = 0; + uint32_t des_b = 0, des_g = 0, des_r = 0; des_b += pWeight->m_Weights[0] * (*scan_src1++); des_g += pWeight->m_Weights[0] * (*scan_src1++); des_r += pWeight->m_Weights[0] * (*scan_src1++); @@ -809,7 +809,7 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert( scan_des += des_Bpp - 3; } break; case FXDIB_Argb: { - FX_DWORD des_a = 0, des_b = 0, des_g = 0, des_r = 0; + uint32_t des_a = 0, des_b = 0, des_g = 0, des_r = 0; des_b += pWeight->m_Weights[0] * (*scan_src1++); des_g += pWeight->m_Weights[0] * (*scan_src1++); des_r += pWeight->m_Weights[0] * (*scan_src1++); @@ -836,12 +836,12 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert( } FX_BOOL CCodec_ProgressiveDecoder::BmpReadMoreData(ICodec_BmpModule* pBmpModule, FXCODEC_STATUS& err_status) { - FX_DWORD dwSize = (FX_DWORD)m_pFile->GetSize(); + uint32_t dwSize = (uint32_t)m_pFile->GetSize(); if (dwSize <= m_offSet) { return FALSE; } dwSize = dwSize - m_offSet; - FX_DWORD dwAvail = pBmpModule->GetAvailInput(m_pBmpContext, NULL); + uint32_t dwAvail = pBmpModule->GetAvailInput(m_pBmpContext, NULL); if (dwAvail == m_SrcSize) { if (dwSize > FXCODEC_BLOCK_SIZE) { dwSize = FXCODEC_BLOCK_SIZE; @@ -854,7 +854,7 @@ FX_BOOL CCodec_ProgressiveDecoder::BmpReadMoreData(ICodec_BmpModule* pBmpModule, return FALSE; } } else { - FX_DWORD dwConsume = m_SrcSize - dwAvail; + uint32_t dwConsume = m_SrcSize - dwAvail; if (dwAvail) { FXSYS_memcpy(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail); } @@ -872,7 +872,7 @@ FX_BOOL CCodec_ProgressiveDecoder::BmpReadMoreData(ICodec_BmpModule* pBmpModule, } FX_BOOL CCodec_ProgressiveDecoder::BmpInputImagePositionBufCallback( void* pModule, - FX_DWORD rcd_pos) { + uint32_t rcd_pos) { CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule; pCodec->m_offSet = rcd_pos; FXCODEC_STATUS error_status = FXCODEC_STATUS_ERROR; @@ -917,7 +917,7 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row) { int des_Bpp = pDeviceBitmap->GetBPP() >> 3; - FX_DWORD des_ScanOffet = m_startX * des_Bpp; + uint32_t des_ScanOffet = m_startX * des_Bpp; int des_top = m_startY; int des_bottom = m_startY + m_sizeY; int des_row_1 = des_row + int(scale_y); @@ -927,7 +927,7 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, while (++des_row < des_bottom) { uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet; - FX_DWORD size = m_sizeX * des_Bpp; + uint32_t size = m_sizeX * des_Bpp; FXSYS_memcpy(scan_des, scan_src, size); } return; @@ -959,7 +959,7 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, } break; case FXDIB_Rgb: case FXDIB_Rgb32: { - FX_DWORD des_b = 0, des_g = 0, des_r = 0; + uint32_t des_b = 0, des_g = 0, des_r = 0; des_b += pWeight->m_Weights[0] * (*scan_src1++); des_g += pWeight->m_Weights[0] * (*scan_src1++); des_r += pWeight->m_Weights[0] * (*scan_src1++); @@ -974,7 +974,7 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, scan_des += des_Bpp - 3; } break; case FXDIB_Argb: { - FX_DWORD des_a = 0, des_b = 0, des_g = 0, des_r = 0; + uint32_t des_a = 0, des_b = 0, des_g = 0, des_r = 0; des_b += pWeight->m_Weights[0] * (*scan_src1++); des_g += pWeight->m_Weights[0] * (*scan_src1++); des_r += pWeight->m_Weights[0] * (*scan_src1++); @@ -998,7 +998,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType( FXCODEC_IMAGE_TYPE imageType, CFX_DIBAttribute* pAttribute) { m_offSet = 0; - FX_DWORD size = (FX_DWORD)m_pFile->GetSize(); + uint32_t size = (uint32_t)m_pFile->GetSize(); if (size > FXCODEC_BLOCK_SIZE) { size = FXCODEC_BLOCK_SIZE; } @@ -1028,7 +1028,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType( } m_offSet += size; pBmpModule->Input(m_pBmpContext, m_pSrcBuf, size); - FX_DWORD* pPalette = NULL; + uint32_t* pPalette = NULL; int32_t readResult = pBmpModule->ReadHeader( m_pBmpContext, &m_SrcWidth, &m_SrcHeight, &m_BmpIsTopBottom, &m_SrcComponents, &m_SrcPaletteNumber, &pPalette, pAttribute); @@ -1049,7 +1049,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType( if (m_SrcPaletteNumber) { m_pSrcPalette = FX_Alloc(FX_ARGB, m_SrcPaletteNumber); FXSYS_memcpy(m_pSrcPalette, pPalette, - m_SrcPaletteNumber * sizeof(FX_DWORD)); + m_SrcPaletteNumber * sizeof(uint32_t)); } else { m_pSrcPalette = nullptr; } @@ -1130,8 +1130,8 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType( m_offSet += size; bResult = pPngModule->Input(m_pPngContext, m_pSrcBuf, size, pAttribute); while (bResult) { - FX_DWORD remain_size = (FX_DWORD)m_pFile->GetSize() - m_offSet; - FX_DWORD input_size = + uint32_t remain_size = (uint32_t)m_pFile->GetSize() - m_offSet; + uint32_t input_size = remain_size > FXCODEC_BLOCK_SIZE ? FXCODEC_BLOCK_SIZE : remain_size; if (input_size == 0) { if (m_pPngContext) { @@ -1231,10 +1231,10 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType( } int32_t frames = 0; pTiffModule->GetFrames(m_pTiffContext, frames); - FX_DWORD bpc; + uint32_t bpc; FX_BOOL ret = pTiffModule->LoadFrameInfo( - m_pTiffContext, 0, (FX_DWORD&)m_SrcWidth, (FX_DWORD&)m_SrcHeight, - (FX_DWORD&)m_SrcComponents, bpc, pAttribute); + m_pTiffContext, 0, (uint32_t&)m_SrcWidth, (uint32_t&)m_SrcHeight, + (uint32_t&)m_SrcComponents, bpc, pAttribute); m_SrcComponents = 4; m_clipBox = FX_RECT(0, 0, m_SrcWidth, m_SrcHeight); if (!ret) { @@ -1475,7 +1475,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, case 1: return; case 2: { - FX_DWORD des_g = 0; + uint32_t des_g = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) { int pixel_weight = @@ -1499,7 +1499,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, (uint8_t)FXRGB2GRAY((des_r >> 16), (des_g >> 16), (des_b >> 16)); } break; case 4: { - FX_DWORD des_b = 0, des_g = 0, des_r = 0; + uint32_t des_b = 0, des_g = 0, des_r = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) { int pixel_weight = @@ -1513,7 +1513,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, (uint8_t)FXRGB2GRAY((des_r >> 16), (des_g >> 16), (des_b >> 16)); } break; case 5: { - FX_DWORD des_b = 0, des_g = 0, des_r = 0; + uint32_t des_b = 0, des_g = 0, des_r = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) { int pixel_weight = @@ -1533,7 +1533,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, case 6: return; case 7: { - FX_DWORD des_g = 0; + uint32_t des_g = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) { int pixel_weight = @@ -1594,7 +1594,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, } } break; case 9: { - FX_DWORD des_b = 0, des_g = 0, des_r = 0; + uint32_t des_b = 0, des_g = 0, des_r = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) { int pixel_weight = @@ -1610,7 +1610,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, des_scan += des_Bpp - 3; } break; case 10: { - FX_DWORD des_b = 0, des_g = 0, des_r = 0; + uint32_t des_b = 0, des_g = 0, des_r = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) { int pixel_weight = @@ -1630,7 +1630,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, des_scan += des_Bpp - 3; } break; case 11: { - FX_DWORD des_alpha = 0, des_r = 0, des_g = 0, des_b = 0; + uint32_t des_alpha = 0, des_r = 0, des_g = 0, des_b = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) { int pixel_weight = @@ -1656,7 +1656,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row) { int des_Bpp = pDeviceBitmap->GetBPP() >> 3; - FX_DWORD des_ScanOffet = m_startX * des_Bpp; + uint32_t des_ScanOffet = m_startX * des_Bpp; if (m_bInterpol) { int des_top = m_startY; int des_row_1 = des_row - int(scale_y); @@ -1668,7 +1668,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, while (++des_row < des_bottom) { uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet; - FX_DWORD size = m_sizeX * des_Bpp; + uint32_t size = m_sizeX * des_Bpp; FXSYS_memcpy(scan_des, scan_src, size); } } @@ -1702,7 +1702,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, } break; case FXDIB_Rgb: case FXDIB_Rgb32: { - FX_DWORD des_b = 0, des_g = 0, des_r = 0; + uint32_t des_b = 0, des_g = 0, des_r = 0; des_b += pWeight->m_Weights[0] * (*scan_src1++); des_g += pWeight->m_Weights[0] * (*scan_src1++); des_r += pWeight->m_Weights[0] * (*scan_src1++); @@ -1717,7 +1717,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, scan_des += des_Bpp - 3; } break; case FXDIB_Argb: { - FX_DWORD des_a = 0, des_b = 0, des_g = 0, des_r = 0; + uint32_t des_a = 0, des_b = 0, des_g = 0, des_r = 0; des_b += pWeight->m_Weights[0] * (*scan_src1++); des_g += pWeight->m_Weights[0] * (*scan_src1++); des_r += pWeight->m_Weights[0] * (*scan_src1++); @@ -1743,7 +1743,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, while (++des_row < des_bottom) { uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet; - FX_DWORD size = m_sizeX * des_Bpp; + uint32_t size = m_sizeX * des_Bpp; FXSYS_memcpy(scan_des, scan_src, size); } } @@ -1759,7 +1759,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, } uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row + i) + des_ScanOffet; - FX_DWORD size = m_sizeX * des_Bpp; + uint32_t size = m_sizeX * des_Bpp; FXSYS_memcpy(scan_des, scan_src, size); } } @@ -2063,8 +2063,8 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) { case FXCODEC_IMAGE_PNG: { ICodec_PngModule* pPngModule = m_pCodecMgr->GetPngModule(); while (TRUE) { - FX_DWORD remain_size = (FX_DWORD)m_pFile->GetSize() - m_offSet; - FX_DWORD input_size = + uint32_t remain_size = (uint32_t)m_pFile->GetSize() - m_offSet; + uint32_t input_size = remain_size > FXCODEC_BLOCK_SIZE ? FXCODEC_BLOCK_SIZE : remain_size; if (input_size == 0) { if (m_pPngContext) { diff --git a/core/fxcodec/codec/fx_codec_progress.h b/core/fxcodec/codec/fx_codec_progress.h index e4335ccf47..ccd52a95b1 100644 --- a/core/fxcodec/codec/fx_codec_progress.h +++ b/core/fxcodec/codec/fx_codec_progress.h @@ -122,12 +122,12 @@ class CCodec_ProgressiveDecoder : public ICodec_ProgressiveDecoder { int pass, int line); static void GifRecordCurrentPositionCallback(void* pModule, - FX_DWORD& cur_pos); + uint32_t& cur_pos); static uint8_t* GifAskLocalPaletteBufCallback(void* pModule, int32_t frame_num, int32_t pal_size); static FX_BOOL GifInputRecordPositionBufCallback(void* pModule, - FX_DWORD rcd_pos, + uint32_t rcd_pos, const FX_RECT& img_rc, int32_t pal_num, void* pal_ptr, @@ -140,7 +140,7 @@ class CCodec_ProgressiveDecoder : public ICodec_ProgressiveDecoder { int32_t row_num, uint8_t* row_buf); static FX_BOOL BmpInputImagePositionBufCallback(void* pModule, - FX_DWORD rcd_pos); + uint32_t rcd_pos); static void BmpReadScanlineCallback(void* pModule, int32_t row_num, uint8_t* row_buf); @@ -182,9 +182,9 @@ class CCodec_ProgressiveDecoder : public ICodec_ProgressiveDecoder { void* m_pBmpContext; void* m_pTiffContext; FXCODEC_IMAGE_TYPE m_imagType; - FX_DWORD m_offSet; + uint32_t m_offSet; uint8_t* m_pSrcBuf; - FX_DWORD m_SrcSize; + uint32_t m_SrcSize; uint8_t* m_pDecodeBuf; int m_ScanlineSize; CFX_DIBitmap* m_pDeviceBitmap; diff --git a/core/fxcodec/codec/fx_codec_tiff.cpp b/core/fxcodec/codec/fx_codec_tiff.cpp index 58f08707cb..96249f9d14 100644 --- a/core/fxcodec/codec/fx_codec_tiff.cpp +++ b/core/fxcodec/codec/fx_codec_tiff.cpp @@ -16,7 +16,7 @@ void* IccLib_CreateTransform_sRGB(const unsigned char* pProfileData, unsigned int dwProfileSize, int nComponents, int intent, - FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT); + uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT); void IccLib_TranslateImage(void* pTransform, unsigned char* pDest, const unsigned char* pSrc, @@ -30,10 +30,10 @@ class CCodec_TiffContext { FX_BOOL InitDecoder(IFX_FileRead* file_ptr); void GetFrames(int32_t& frames); FX_BOOL LoadFrameInfo(int32_t frame, - FX_DWORD& width, - FX_DWORD& height, - FX_DWORD& comps, - FX_DWORD& bpc, + uint32_t& width, + uint32_t& height, + uint32_t& comps, + uint32_t& bpc, CFX_DIBAttribute* pAttribute); FX_BOOL Decode(CFX_DIBitmap* pDIBitmap); @@ -42,7 +42,7 @@ class CCodec_TiffContext { IFX_FileStream* out; } io; - FX_DWORD offset; + uint32_t offset; TIFF* tif_ctx; void* icc_ctx; @@ -98,7 +98,7 @@ static tsize_t _tiff_read(thandle_t context, tdata_t buf, tsize_t length) { if (!ret) { return 0; } - pTiffContext->offset += (FX_DWORD)length; + pTiffContext->offset += (uint32_t)length; return length; } static tsize_t _tiff_write(thandle_t context, tdata_t buf, tsize_t length) { @@ -107,17 +107,17 @@ static tsize_t _tiff_write(thandle_t context, tdata_t buf, tsize_t length) { if (!pTiffContext->io.out->WriteBlock(buf, pTiffContext->offset, length)) { return 0; } - pTiffContext->offset += (FX_DWORD)length; + pTiffContext->offset += (uint32_t)length; return length; } static toff_t _tiff_seek(thandle_t context, toff_t offset, int whence) { CCodec_TiffContext* pTiffContext = (CCodec_TiffContext*)context; switch (whence) { case 0: - pTiffContext->offset = (FX_DWORD)offset; + pTiffContext->offset = (uint32_t)offset; break; case 1: - pTiffContext->offset += (FX_DWORD)offset; + pTiffContext->offset += (uint32_t)offset; break; case 2: if (pTiffContext->isDecoder) { @@ -125,20 +125,20 @@ static toff_t _tiff_seek(thandle_t context, toff_t offset, int whence) { return static_cast<toff_t>(-1); } pTiffContext->offset = - (FX_DWORD)(pTiffContext->io.in->GetSize() - offset); + (uint32_t)(pTiffContext->io.in->GetSize() - offset); } else { if (pTiffContext->io.out->GetSize() < (FX_FILESIZE)offset) { return static_cast<toff_t>(-1); } pTiffContext->offset = - (FX_DWORD)(pTiffContext->io.out->GetSize() - offset); + (uint32_t)(pTiffContext->io.out->GetSize() - offset); } break; default: return static_cast<toff_t>(-1); } ASSERT(pTiffContext->isDecoder ? (pTiffContext->offset <= - (FX_DWORD)pTiffContext->io.in->GetSize()) + (uint32_t)pTiffContext->io.in->GetSize()) : TRUE); return pTiffContext->offset; } @@ -234,7 +234,7 @@ void CCodec_TiffContext::GetFrames(int32_t& frames) { (key) = NULL; #define TIFF_EXIF_GETSTRINGINFO(key, tag) \ { \ - FX_DWORD size = 0; \ + uint32_t size = 0; \ uint8_t* buf = NULL; \ TIFFGetField(tif_ctx, tag, &size, &buf); \ if (size && buf) { \ @@ -277,20 +277,20 @@ void Tiff_Exif_GetStringInfo(TIFF* tif_ctx, } // namespace FX_BOOL CCodec_TiffContext::LoadFrameInfo(int32_t frame, - FX_DWORD& width, - FX_DWORD& height, - FX_DWORD& comps, - FX_DWORD& bpc, + uint32_t& width, + uint32_t& height, + uint32_t& comps, + uint32_t& bpc, CFX_DIBAttribute* pAttribute) { if (!TIFFSetDirectory(tif_ctx, (uint16)frame)) { return FALSE; } uint16_t tif_cs; - FX_DWORD tif_icc_size = 0; + uint32_t tif_icc_size = 0; uint8_t* tif_icc_buf = NULL; uint16_t tif_bpc = 0; uint16_t tif_cps; - FX_DWORD tif_rps; + uint32_t tif_rps; width = height = comps = 0; TIFFGetField(tif_ctx, TIFFTAG_IMAGEWIDTH, &width); TIFFGetField(tif_ctx, TIFFTAG_IMAGELENGTH, &height); @@ -379,10 +379,10 @@ void CCodec_TiffContext::SetPalette(CFX_DIBitmap* pDIBitmap, uint16_t bps) { } int32_t len = 1 << bps; for (int32_t index = 0; index < len; index++) { - FX_DWORD r = red_orig[index] & 0xFF; - FX_DWORD g = green_orig[index] & 0xFF; - FX_DWORD b = blue_orig[index] & 0xFF; - FX_DWORD color = (uint32_t)b | ((uint32_t)g << 8) | ((uint32_t)r << 16) | + uint32_t r = red_orig[index] & 0xFF; + uint32_t g = green_orig[index] & 0xFF; + uint32_t b = blue_orig[index] & 0xFF; + uint32_t color = (uint32_t)b | ((uint32_t)g << 8) | ((uint32_t)r << 16) | (((uint32)0xffL) << 24); pDIBitmap->SetPaletteEntry(index, color); } @@ -404,7 +404,7 @@ FX_BOOL CCodec_TiffContext::Decode1bppRGB(CFX_DIBitmap* pDIBitmap, return FALSE; } uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer(); - FX_DWORD pitch = pDIBitmap->GetPitch(); + uint32_t pitch = pDIBitmap->GetPitch(); for (int32_t row = 0; row < height; row++) { TIFFReadScanline(tif_ctx, buf, row, 0); for (int32_t j = 0; j < size; j++) { @@ -431,7 +431,7 @@ FX_BOOL CCodec_TiffContext::Decode8bppRGB(CFX_DIBitmap* pDIBitmap, return FALSE; } uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer(); - FX_DWORD pitch = pDIBitmap->GetPitch(); + uint32_t pitch = pDIBitmap->GetPitch(); for (int32_t row = 0; row < height; row++) { TIFFReadScanline(tif_ctx, buf, row, 0); for (int32_t j = 0; j < size; j++) { @@ -464,7 +464,7 @@ FX_BOOL CCodec_TiffContext::Decode24bppRGB(CFX_DIBitmap* pDIBitmap, return FALSE; } uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer(); - FX_DWORD pitch = pDIBitmap->GetPitch(); + uint32_t pitch = pDIBitmap->GetPitch(); for (int32_t row = 0; row < height; row++) { TIFFReadScanline(tif_ctx, buf, row, 0); for (int32_t j = 0; j < size - 2; j += 3) { @@ -477,10 +477,10 @@ FX_BOOL CCodec_TiffContext::Decode24bppRGB(CFX_DIBitmap* pDIBitmap, return TRUE; } FX_BOOL CCodec_TiffContext::Decode(CFX_DIBitmap* pDIBitmap) { - FX_DWORD img_wid = pDIBitmap->GetWidth(); - FX_DWORD img_hei = pDIBitmap->GetHeight(); - FX_DWORD width = 0; - FX_DWORD height = 0; + uint32_t img_wid = pDIBitmap->GetWidth(); + uint32_t img_hei = pDIBitmap->GetHeight(); + uint32_t width = 0; + uint32_t height = 0; TIFFGetField(tif_ctx, TIFFTAG_IMAGEWIDTH, &width); TIFFGetField(tif_ctx, TIFFTAG_IMAGELENGTH, &height); if (img_wid != width || img_hei != height) { @@ -492,7 +492,7 @@ FX_BOOL CCodec_TiffContext::Decode(CFX_DIBitmap* pDIBitmap) { if (TIFFReadRGBAImageOriented(tif_ctx, img_wid, img_hei, (uint32*)pDIBitmap->GetBuffer(), rotation, 1)) { - for (FX_DWORD row = 0; row < img_hei; row++) { + for (uint32_t row = 0; row < img_hei; row++) { uint8_t* row_buf = (uint8_t*)pDIBitmap->GetScanline(row); _TiffBGRA2RGBA(row_buf, img_wid, 4); } @@ -502,7 +502,7 @@ FX_BOOL CCodec_TiffContext::Decode(CFX_DIBitmap* pDIBitmap) { uint16_t spp, bps; TIFFGetField(tif_ctx, TIFFTAG_SAMPLESPERPIXEL, &spp); TIFFGetField(tif_ctx, TIFFTAG_BITSPERSAMPLE, &bps); - FX_DWORD bpp = bps * spp; + uint32_t bpp = bps * spp; if (bpp == 1) { return Decode1bppRGB(pDIBitmap, height, width, bps, spp); } else if (bpp <= 8) { @@ -526,10 +526,10 @@ void CCodec_TiffModule::GetFrames(void* ctx, int32_t& frames) { } FX_BOOL CCodec_TiffModule::LoadFrameInfo(void* ctx, int32_t frame, - FX_DWORD& width, - FX_DWORD& height, - FX_DWORD& comps, - FX_DWORD& bpc, + uint32_t& width, + uint32_t& height, + uint32_t& comps, + uint32_t& bpc, CFX_DIBAttribute* pAttribute) { CCodec_TiffContext* pDecoder = (CCodec_TiffContext*)ctx; return pDecoder->LoadFrameInfo(frame, width, height, comps, bpc, pAttribute); diff --git a/core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp b/core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp index 720b96ec36..6be90941d6 100644 --- a/core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp +++ b/core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp @@ -81,7 +81,7 @@ CJBig2_ArithIaidDecoder::CJBig2_ArithIaidDecoder(unsigned char SBSYMCODELENA) CJBig2_ArithIaidDecoder::~CJBig2_ArithIaidDecoder() {} void CJBig2_ArithIaidDecoder::decode(CJBig2_ArithDecoder* pArithDecoder, - FX_DWORD* nResult) { + uint32_t* nResult) { int PREV = 1; for (unsigned char i = 0; i < SBSYMCODELEN; ++i) { JBig2ArithCtx* pCX = &m_IAID[PREV]; diff --git a/core/fxcodec/jbig2/JBig2_ArithIntDecoder.h b/core/fxcodec/jbig2/JBig2_ArithIntDecoder.h index 50327cc151..f1eb68d5df 100644 --- a/core/fxcodec/jbig2/JBig2_ArithIntDecoder.h +++ b/core/fxcodec/jbig2/JBig2_ArithIntDecoder.h @@ -30,7 +30,7 @@ class CJBig2_ArithIaidDecoder { explicit CJBig2_ArithIaidDecoder(unsigned char SBSYMCODELENA); ~CJBig2_ArithIaidDecoder(); - void decode(CJBig2_ArithDecoder* pArithDecoder, FX_DWORD* nResult); + void decode(CJBig2_ArithDecoder* pArithDecoder, uint32_t* nResult); private: std::vector<JBig2ArithCtx> m_IAID; diff --git a/core/fxcodec/jbig2/JBig2_BitStream.cpp b/core/fxcodec/jbig2/JBig2_BitStream.cpp index 4ca4be16d4..ddf092dbc4 100644 --- a/core/fxcodec/jbig2/JBig2_BitStream.cpp +++ b/core/fxcodec/jbig2/JBig2_BitStream.cpp @@ -26,8 +26,8 @@ CJBig2_BitStream::CJBig2_BitStream(CPDF_StreamAcc* pSrcStream) CJBig2_BitStream::~CJBig2_BitStream() {} -int32_t CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_DWORD* dwResult) { - FX_DWORD dwBitPos = getBitPos(); +int32_t CJBig2_BitStream::readNBits(uint32_t dwBits, uint32_t* dwResult) { + uint32_t dwBitPos = getBitPos(); if (dwBitPos > LengthInBits()) return -1; @@ -45,8 +45,8 @@ int32_t CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_DWORD* dwResult) { return 0; } -int32_t CJBig2_BitStream::readNBits(FX_DWORD dwBits, int32_t* nResult) { - FX_DWORD dwBitPos = getBitPos(); +int32_t CJBig2_BitStream::readNBits(uint32_t dwBits, int32_t* nResult) { + uint32_t dwBitPos = getBitPos(); if (dwBitPos > LengthInBits()) return -1; @@ -64,7 +64,7 @@ int32_t CJBig2_BitStream::readNBits(FX_DWORD dwBits, int32_t* nResult) { return 0; } -int32_t CJBig2_BitStream::read1Bit(FX_DWORD* dwResult) { +int32_t CJBig2_BitStream::read1Bit(uint32_t* dwResult) { if (!IsInBound()) return -1; @@ -91,7 +91,7 @@ int32_t CJBig2_BitStream::read1Byte(uint8_t* cResult) { return 0; } -int32_t CJBig2_BitStream::readInteger(FX_DWORD* dwResult) { +int32_t CJBig2_BitStream::readInteger(uint32_t* dwResult) { if (m_dwByteIdx + 3 >= m_dwLength) return -1; @@ -134,19 +134,19 @@ uint8_t CJBig2_BitStream::getNextByte_arith() const { return m_dwByteIdx + 1 < m_dwLength ? m_pBuf[m_dwByteIdx + 1] : 0xFF; } -FX_DWORD CJBig2_BitStream::getOffset() const { +uint32_t CJBig2_BitStream::getOffset() const { return m_dwByteIdx; } -void CJBig2_BitStream::setOffset(FX_DWORD dwOffset) { +void CJBig2_BitStream::setOffset(uint32_t dwOffset) { m_dwByteIdx = std::min(dwOffset, m_dwLength); } -FX_DWORD CJBig2_BitStream::getBitPos() const { +uint32_t CJBig2_BitStream::getBitPos() const { return (m_dwByteIdx << 3) + m_dwBitIdx; } -void CJBig2_BitStream::setBitPos(FX_DWORD dwBitPos) { +void CJBig2_BitStream::setBitPos(uint32_t dwBitPos) { m_dwByteIdx = dwBitPos >> 3; m_dwBitIdx = dwBitPos & 7; } @@ -159,11 +159,11 @@ const uint8_t* CJBig2_BitStream::getPointer() const { return m_pBuf + m_dwByteIdx; } -void CJBig2_BitStream::offset(FX_DWORD dwOffset) { +void CJBig2_BitStream::offset(uint32_t dwOffset) { m_dwByteIdx += dwOffset; } -FX_DWORD CJBig2_BitStream::getByteLeft() const { +uint32_t CJBig2_BitStream::getByteLeft() const { return m_dwLength - m_dwByteIdx; } @@ -180,10 +180,10 @@ bool CJBig2_BitStream::IsInBound() const { return m_dwByteIdx < m_dwLength; } -FX_DWORD CJBig2_BitStream::LengthInBits() const { +uint32_t CJBig2_BitStream::LengthInBits() const { return m_dwLength << 3; } -FX_DWORD CJBig2_BitStream::getObjNum() const { +uint32_t CJBig2_BitStream::getObjNum() const { return m_dwObjNum; } diff --git a/core/fxcodec/jbig2/JBig2_BitStream.h b/core/fxcodec/jbig2/JBig2_BitStream.h index 45eb44c46a..191438fee7 100644 --- a/core/fxcodec/jbig2/JBig2_BitStream.h +++ b/core/fxcodec/jbig2/JBig2_BitStream.h @@ -17,39 +17,39 @@ class CJBig2_BitStream { ~CJBig2_BitStream(); // TODO(thestig): readFoo() should return bool. - int32_t readNBits(FX_DWORD nBits, FX_DWORD* dwResult); - int32_t readNBits(FX_DWORD nBits, int32_t* nResult); - int32_t read1Bit(FX_DWORD* dwResult); + int32_t readNBits(uint32_t nBits, uint32_t* dwResult); + int32_t readNBits(uint32_t nBits, int32_t* nResult); + int32_t read1Bit(uint32_t* dwResult); int32_t read1Bit(FX_BOOL* bResult); int32_t read1Byte(uint8_t* cResult); - int32_t readInteger(FX_DWORD* dwResult); + int32_t readInteger(uint32_t* dwResult); int32_t readShortInteger(uint16_t* wResult); void alignByte(); uint8_t getCurByte() const; void incByteIdx(); uint8_t getCurByte_arith() const; uint8_t getNextByte_arith() const; - FX_DWORD getOffset() const; - void setOffset(FX_DWORD dwOffset); - FX_DWORD getBitPos() const; - void setBitPos(FX_DWORD dwBitPos); + uint32_t getOffset() const; + void setOffset(uint32_t dwOffset); + uint32_t getBitPos() const; + void setBitPos(uint32_t dwBitPos); const uint8_t* getBuf() const; - FX_DWORD getLength() const { return m_dwLength; } + uint32_t getLength() const { return m_dwLength; } const uint8_t* getPointer() const; - void offset(FX_DWORD dwOffset); - FX_DWORD getByteLeft() const; - FX_DWORD getObjNum() const; + void offset(uint32_t dwOffset); + uint32_t getByteLeft() const; + uint32_t getObjNum() const; private: void AdvanceBit(); bool IsInBound() const; - FX_DWORD LengthInBits() const; + uint32_t LengthInBits() const; const uint8_t* m_pBuf; - FX_DWORD m_dwLength; - FX_DWORD m_dwByteIdx; - FX_DWORD m_dwBitIdx; - const FX_DWORD m_dwObjNum; + uint32_t m_dwLength; + uint32_t m_dwByteIdx; + uint32_t m_dwBitIdx; + const uint32_t m_dwObjNum; CJBig2_BitStream(const CJBig2_BitStream&) = delete; void operator=(const CJBig2_BitStream&) = delete; diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp index da020a6a75..1c316a0dd2 100644 --- a/core/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/fxcodec/jbig2/JBig2_Context.cpp @@ -230,7 +230,7 @@ int32_t CJBig2_Context::Continue(IFX_Pause* pPause) { return nRet; } -CJBig2_Segment* CJBig2_Context::findSegmentByNumber(FX_DWORD dwNumber) { +CJBig2_Segment* CJBig2_Context::findSegmentByNumber(uint32_t dwNumber) { if (m_pGlobalContext) { CJBig2_Segment* pSeg = m_pGlobalContext->findSegmentByNumber(dwNumber); if (pSeg) { @@ -267,11 +267,11 @@ int32_t CJBig2_Context::parseSegmentHeader(CJBig2_Segment* pSegment) { return JBIG2_ERROR_TOO_SHORT; } - FX_DWORD dwTemp; + uint32_t dwTemp; uint8_t cTemp = m_pStream->getCurByte(); if ((cTemp >> 5) == 7) { if (m_pStream->readInteger( - (FX_DWORD*)&pSegment->m_nReferred_to_segment_count) != 0) { + (uint32_t*)&pSegment->m_nReferred_to_segment_count) != 0) { return JBIG2_ERROR_TOO_SHORT; } pSegment->m_nReferred_to_segment_count &= 0x1fffffff; @@ -292,7 +292,7 @@ int32_t CJBig2_Context::parseSegmentHeader(CJBig2_Segment* pSegment) { uint8_t cPSize = pSegment->m_cFlags.s.page_association_size ? 4 : 1; if (pSegment->m_nReferred_to_segment_count) { pSegment->m_pReferred_to_segment_numbers = - FX_Alloc(FX_DWORD, pSegment->m_nReferred_to_segment_count); + FX_Alloc(uint32_t, pSegment->m_nReferred_to_segment_count); for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) { switch (cSSize) { case 1: @@ -396,7 +396,7 @@ int32_t CJBig2_Context::ProcessingParseSegmentData(CJBig2_Segment* pSegment, pPageInfo->m_bIsStriped = TRUE; if (!m_bBufSpecified) { - FX_DWORD height = + uint32_t height = bMaxHeight ? pPageInfo->m_wMaxStripeSize : pPageInfo->m_dwHeight; m_pPage.reset(new CJBig2_Image(pPageInfo->m_dwWidth, height)); } @@ -449,8 +449,8 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, uint8_t cSDHUFFBMSIZE = (wFlags >> 6) & 0x0001; uint8_t cSDHUFFAGGINST = (wFlags >> 7) & 0x0001; if (pSymbolDictDecoder->SDHUFF == 0) { - const FX_DWORD dwTemp = (pSymbolDictDecoder->SDTEMPLATE == 0) ? 8 : 2; - for (FX_DWORD i = 0; i < dwTemp; ++i) { + const uint32_t dwTemp = (pSymbolDictDecoder->SDTEMPLATE == 0) ? 8 : 2; + for (uint32_t i = 0; i < dwTemp; ++i) { if (m_pStream->read1Byte((uint8_t*)&pSymbolDictDecoder->SDAT[i]) != 0) return JBIG2_ERROR_TOO_SHORT; } @@ -488,7 +488,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, std::unique_ptr<CJBig2_Image*, FxFreeDeleter> SDINSYMS; if (pSymbolDictDecoder->SDNUMINSYMS != 0) { SDINSYMS.reset(FX_Alloc(CJBig2_Image*, pSymbolDictDecoder->SDNUMINSYMS)); - FX_DWORD dwTemp = 0; + uint32_t dwTemp = 0; for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) { CJBig2_Segment* pSeg = findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]); @@ -665,7 +665,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pTRD->SBH = ri.height; pTRD->SBHUFF = wFlags & 0x0001; pTRD->SBREFINE = (wFlags >> 1) & 0x0001; - FX_DWORD dwTemp = (wFlags >> 2) & 0x0003; + uint32_t dwTemp = (wFlags >> 2) & 0x0003; pTRD->SBSTRIPS = 1 << dwTemp; pTRD->REFCORNER = (JBig2Corner)((wFlags >> 4) & 0x0003); pTRD->TRANSPOSED = (wFlags >> 6) & 0x0001; @@ -751,7 +751,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pTRD->SBSYMCODES = SBSYMCODES.get(); } else { dwTemp = 0; - while ((FX_DWORD)(1 << dwTemp) < pTRD->SBNUMSYMS) { + while ((uint32_t)(1 << dwTemp) < pTRD->SBNUMSYMS) { ++dwTemp; } pTRD->SBSYMCODELEN = (uint8_t)dwTemp; @@ -999,8 +999,8 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, m_pStream->read1Byte(&cFlags) != 0 || m_pStream->readInteger(&pHRD->HGW) != 0 || m_pStream->readInteger(&pHRD->HGH) != 0 || - m_pStream->readInteger((FX_DWORD*)&pHRD->HGX) != 0 || - m_pStream->readInteger((FX_DWORD*)&pHRD->HGY) != 0 || + m_pStream->readInteger((uint32_t*)&pHRD->HGX) != 0 || + m_pStream->readInteger((uint32_t*)&pHRD->HGY) != 0 || m_pStream->readShortInteger(&pHRD->HRX) != 0 || m_pStream->readShortInteger(&pHRD->HRY) != 0) { return JBIG2_ERROR_TOO_SHORT; @@ -1261,10 +1261,10 @@ int32_t CJBig2_Context::parseTable(CJBig2_Segment* pSegment) { } int32_t CJBig2_Context::parseRegionInfo(JBig2RegionInfo* pRI) { - if (m_pStream->readInteger((FX_DWORD*)&pRI->width) != 0 || - m_pStream->readInteger((FX_DWORD*)&pRI->height) != 0 || - m_pStream->readInteger((FX_DWORD*)&pRI->x) != 0 || - m_pStream->readInteger((FX_DWORD*)&pRI->y) != 0 || + if (m_pStream->readInteger((uint32_t*)&pRI->width) != 0 || + m_pStream->readInteger((uint32_t*)&pRI->height) != 0 || + m_pStream->readInteger((uint32_t*)&pRI->x) != 0 || + m_pStream->readInteger((uint32_t*)&pRI->y) != 0 || m_pStream->read1Byte(&pRI->flags) != 0) { return JBIG2_ERROR_TOO_SHORT; } @@ -1273,7 +1273,7 @@ int32_t CJBig2_Context::parseRegionInfo(JBig2RegionInfo* pRI) { JBig2HuffmanCode* CJBig2_Context::decodeSymbolIDHuffmanTable( CJBig2_BitStream* pStream, - FX_DWORD SBNUMSYMS) { + uint32_t SBNUMSYMS) { const size_t kRunCodesSize = 35; int32_t runcodes[kRunCodesSize]; int32_t runcodes_len[kRunCodesSize]; @@ -1291,7 +1291,7 @@ JBig2HuffmanCode* CJBig2_Context::decodeSymbolIDHuffmanTable( int32_t j; int32_t nVal = 0; int32_t nBits = 0; - FX_DWORD nTemp; + uint32_t nTemp; while (true) { if (pStream->read1Bit(&nTemp) != 0) return nullptr; diff --git a/core/fxcodec/jbig2/JBig2_Context.h b/core/fxcodec/jbig2/JBig2_Context.h index aff3b1bb38..4a32e61489 100644 --- a/core/fxcodec/jbig2/JBig2_Context.h +++ b/core/fxcodec/jbig2/JBig2_Context.h @@ -23,7 +23,7 @@ class CPDF_StreamAcc; class IFX_Pause; // Cache is keyed by the ObjNum of a stream and an index within the stream. -using CJBig2_CacheKey = std::pair<FX_DWORD, FX_DWORD>; +using CJBig2_CacheKey = std::pair<uint32_t, uint32_t>; // NB: CJBig2_SymbolDict* is owned. using CJBig2_CachePair = std::pair<CJBig2_CacheKey, CJBig2_SymbolDict*>; @@ -74,7 +74,7 @@ class CJBig2_Context { int32_t decode_RandomOrgnazation(IFX_Pause* pPause); - CJBig2_Segment* findSegmentByNumber(FX_DWORD dwNumber); + CJBig2_Segment* findSegmentByNumber(uint32_t dwNumber); CJBig2_Segment* findReferredSegmentByTypeAndIndex(CJBig2_Segment* pSegment, uint8_t cType, @@ -103,7 +103,7 @@ class CJBig2_Context { int32_t parseRegionInfo(JBig2RegionInfo* pRI); JBig2HuffmanCode* decodeSymbolIDHuffmanTable(CJBig2_BitStream* pStream, - FX_DWORD SBNUMSYMS); + uint32_t SBNUMSYMS); void huffman_assign_code(int* CODES, int* PREFLEN, int NTEMP); @@ -125,7 +125,7 @@ class CJBig2_Context { std::unique_ptr<CJBig2_GRDProc> m_pGRD; JBig2ArithCtx* m_gbContext; std::unique_ptr<CJBig2_Segment> m_pSegment; - FX_DWORD m_dwOffset; + uint32_t m_dwOffset; JBig2RegionInfo m_ri; std::list<CJBig2_CachePair>* const m_pSymbolDictCache; bool m_bIsGlobal; diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrdProc.cpp index a3fc33c2be..5f3b47f659 100644 --- a/core/fxcodec/jbig2/JBig2_GrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_GrdProc.cpp @@ -66,8 +66,8 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2; + uint32_t CONTEXT; + uint32_t line1, line2; uint8_t *pLine, *pLine1, *pLine2, cVal; int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; @@ -81,8 +81,8 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_opt3( nStride2 = nStride << 1; nLineBytes = ((GBW + 7) >> 3) - 1; nBitsLeft = GBW - (nLineBytes << 3); - FX_DWORD height = GBH & 0x7fffffff; - for (FX_DWORD h = 0; h < height; h++) { + uint32_t height = GBH & 0x7fffffff; + for (uint32_t h = 0; h < height; h++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]); LTP = LTP ^ SLTP; @@ -156,12 +156,12 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2, line3; + uint32_t CONTEXT; + uint32_t line1, line2, line3; LTP = 0; std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); GBREG->fill(0); - for (FX_DWORD h = 0; h < GBH; h++) { + for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]); LTP = LTP ^ SLTP; @@ -175,7 +175,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_unopt( line2 |= GBREG->getPixel(1, h - 1) << 1; line2 |= GBREG->getPixel(0, h - 1) << 2; line3 = 0; - for (FX_DWORD w = 0; w < GBW; w++) { + for (uint32_t w = 0; w < GBW; w++) { if (USESKIP && SKIP->getPixel(w, h)) { bVal = 0; } else { @@ -204,8 +204,8 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2; + uint32_t CONTEXT; + uint32_t line1, line2; uint8_t *pLine, *pLine1, *pLine2, cVal; int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; @@ -219,7 +219,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_opt3( nStride2 = nStride << 1; nLineBytes = ((GBW + 7) >> 3) - 1; nBitsLeft = GBW - (nLineBytes << 3); - for (FX_DWORD h = 0; h < GBH; h++) { + for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x0795]); LTP = LTP ^ SLTP; @@ -293,12 +293,12 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2, line3; + uint32_t CONTEXT; + uint32_t line1, line2, line3; LTP = 0; std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); GBREG->fill(0); - for (FX_DWORD h = 0; h < GBH; h++) { + for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x0795]); LTP = LTP ^ SLTP; @@ -313,7 +313,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_unopt( line2 |= GBREG->getPixel(1, h - 1) << 1; line2 |= GBREG->getPixel(0, h - 1) << 2; line3 = 0; - for (FX_DWORD w = 0; w < GBW; w++) { + for (uint32_t w = 0; w < GBW; w++) { if (USESKIP && SKIP->getPixel(w, h)) { bVal = 0; } else { @@ -338,8 +338,8 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2; + uint32_t CONTEXT; + uint32_t line1, line2; uint8_t *pLine, *pLine1, *pLine2, cVal; int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; @@ -353,7 +353,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_opt3( nStride2 = nStride << 1; nLineBytes = ((GBW + 7) >> 3) - 1; nBitsLeft = GBW - (nLineBytes << 3); - for (FX_DWORD h = 0; h < GBH; h++) { + for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x00e5]); LTP = LTP ^ SLTP; @@ -427,12 +427,12 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2, line3; + uint32_t CONTEXT; + uint32_t line1, line2, line3; LTP = 0; std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); GBREG->fill(0); - for (FX_DWORD h = 0; h < GBH; h++) { + for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x00e5]); LTP = LTP ^ SLTP; @@ -445,7 +445,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_unopt( line2 = GBREG->getPixel(1, h - 1); line2 |= GBREG->getPixel(0, h - 1) << 1; line3 = 0; - for (FX_DWORD w = 0; w < GBW; w++) { + for (uint32_t w = 0; w < GBW; w++) { if (USESKIP && SKIP->getPixel(w, h)) { bVal = 0; } else { @@ -471,8 +471,8 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1; + uint32_t CONTEXT; + uint32_t line1; uint8_t *pLine, *pLine1, cVal; int32_t nStride, k; int32_t nLineBytes, nBitsLeft, cc; @@ -485,7 +485,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_opt3( nStride = GBREG->m_nStride; nLineBytes = ((GBW + 7) >> 3) - 1; nBitsLeft = GBW - (nLineBytes << 3); - for (FX_DWORD h = 0; h < GBH; h++) { + for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x0195]); LTP = LTP ^ SLTP; @@ -546,12 +546,12 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2; + uint32_t CONTEXT; + uint32_t line1, line2; LTP = 0; std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); GBREG->fill(0); - for (FX_DWORD h = 0; h < GBH; h++) { + for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x0195]); LTP = LTP ^ SLTP; @@ -562,7 +562,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_unopt( line1 = GBREG->getPixel(1, h - 1); line1 |= GBREG->getPixel(0, h - 1) << 1; line2 = 0; - for (FX_DWORD w = 0; w < GBW; w++) { + for (uint32_t w = 0; w < GBW; w++) { if (USESKIP && SKIP->getPixel(w, h)) { bVal = 0; } else { @@ -673,7 +673,7 @@ FXCODEC_STATUS CJBig2_GRDProc::Start_decode_MMR(CJBig2_Image** pImage, FaxG4Decode(pStream->getBuf(), pStream->getLength(), &bitpos, (*pImage)->m_pData, GBW, GBH, (*pImage)->m_nStride); pStream->setBitPos(bitpos); - for (i = 0; (FX_DWORD)i < (*pImage)->m_nStride * GBH; i++) { + for (i = 0; (uint32_t)i < (*pImage)->m_nStride * GBH; i++) { (*pImage)->m_pData[i] = ~(*pImage)->m_pData[i]; } m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; @@ -698,8 +698,8 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3( JBig2ArithCtx* gbContext, IFX_Pause* pPause) { FX_BOOL SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2; + uint32_t CONTEXT; + uint32_t line1, line2; uint8_t *pLine1, *pLine2, cVal; int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; @@ -710,7 +710,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3( nStride2 = nStride << 1; nLineBytes = ((GBW + 7) >> 3) - 1; nBitsLeft = GBW - (nLineBytes << 3); - FX_DWORD height = GBH & 0x7fffffff; + uint32_t height = GBH & 0x7fffffff; for (; m_loopIndex < height; m_loopIndex++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]); @@ -793,8 +793,8 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_unopt( JBig2ArithCtx* gbContext, IFX_Pause* pPause) { FX_BOOL SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2, line3; + uint32_t CONTEXT; + uint32_t line1, line2, line3; for (; m_loopIndex < GBH; m_loopIndex++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]); @@ -809,7 +809,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_unopt( line2 |= pImage->getPixel(1, m_loopIndex - 1) << 1; line2 |= pImage->getPixel(0, m_loopIndex - 1) << 2; line3 = 0; - for (FX_DWORD w = 0; w < GBW; w++) { + for (uint32_t w = 0; w < GBW; w++) { if (USESKIP && SKIP->getPixel(w, m_loopIndex)) { bVal = 0; } else { @@ -848,8 +848,8 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3( JBig2ArithCtx* gbContext, IFX_Pause* pPause) { FX_BOOL SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2; + uint32_t CONTEXT; + uint32_t line1, line2; uint8_t *pLine1, *pLine2, cVal; int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; @@ -942,9 +942,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_unopt( JBig2ArithCtx* gbContext, IFX_Pause* pPause) { FX_BOOL SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2, line3; - for (FX_DWORD h = 0; h < GBH; h++) { + uint32_t CONTEXT; + uint32_t line1, line2, line3; + for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x0795]); LTP = LTP ^ SLTP; @@ -959,7 +959,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_unopt( line2 |= pImage->getPixel(1, h - 1) << 1; line2 |= pImage->getPixel(0, h - 1) << 2; line3 = 0; - for (FX_DWORD w = 0; w < GBW; w++) { + for (uint32_t w = 0; w < GBW; w++) { if (USESKIP && SKIP->getPixel(w, h)) { bVal = 0; } else { @@ -993,8 +993,8 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3( JBig2ArithCtx* gbContext, IFX_Pause* pPause) { FX_BOOL SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2; + uint32_t CONTEXT; + uint32_t line1, line2; uint8_t *pLine1, *pLine2, cVal; int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; @@ -1087,8 +1087,8 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_unopt( JBig2ArithCtx* gbContext, IFX_Pause* pPause) { FX_BOOL SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2, line3; + uint32_t CONTEXT; + uint32_t line1, line2, line3; for (; m_loopIndex < GBH; m_loopIndex++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x00e5]); @@ -1102,7 +1102,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_unopt( line2 = pImage->getPixel(1, m_loopIndex - 1); line2 |= pImage->getPixel(0, m_loopIndex - 1) << 1; line3 = 0; - for (FX_DWORD w = 0; w < GBW; w++) { + for (uint32_t w = 0; w < GBW; w++) { if (USESKIP && SKIP->getPixel(w, m_loopIndex)) { bVal = 0; } else { @@ -1138,8 +1138,8 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3( JBig2ArithCtx* gbContext, IFX_Pause* pPause) { FX_BOOL SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1; + uint32_t CONTEXT; + uint32_t line1; uint8_t *pLine1, cVal; int32_t nStride, k; int32_t nLineBytes, nBitsLeft, cc; @@ -1218,8 +1218,8 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_unopt( JBig2ArithCtx* gbContext, IFX_Pause* pPause) { FX_BOOL SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2; + uint32_t CONTEXT; + uint32_t line1, line2; for (; m_loopIndex < GBH; m_loopIndex++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x0195]); @@ -1231,7 +1231,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_unopt( line1 = pImage->getPixel(1, m_loopIndex - 1); line1 |= pImage->getPixel(0, m_loopIndex - 1) << 1; line2 = 0; - for (FX_DWORD w = 0; w < GBW; w++) { + for (uint32_t w = 0; w < GBW; w++) { if (USESKIP && SKIP->getPixel(w, m_loopIndex)) { bVal = 0; } else { diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.h b/core/fxcodec/jbig2/JBig2_GrdProc.h index 2a638aa8d6..f6a5448769 100644 --- a/core/fxcodec/jbig2/JBig2_GrdProc.h +++ b/core/fxcodec/jbig2/JBig2_GrdProc.h @@ -35,8 +35,8 @@ class CJBig2_GRDProc { FX_RECT GetReplaceRect() const { return m_ReplaceRect; } FX_BOOL MMR; - FX_DWORD GBW; - FX_DWORD GBH; + uint32_t GBW; + uint32_t GBH; uint8_t GBTEMPLATE; FX_BOOL TPGDON; FX_BOOL USESKIP; @@ -109,7 +109,7 @@ class CJBig2_GRDProc { CJBig2_Image* decode_Arith_Template3_unopt(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext); - FX_DWORD m_loopIndex; + uint32_t m_loopIndex; uint8_t* m_pLine; IFX_Pause* m_pPause; FXCODEC_STATUS m_ProssiveStatus; diff --git a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp index c6ff3dd647..17d17d558e 100644 --- a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp @@ -20,13 +20,13 @@ CJBig2_Image* CJBig2_GRRDProc::decode(CJBig2_ArithDecoder* pArithDecoder, if (GRTEMPLATE == 0) { if ((GRAT[0] == -1) && (GRAT[1] == -1) && (GRAT[2] == -1) && (GRAT[3] == -1) && (GRREFERENCEDX == 0) && - (GRW == (FX_DWORD)GRREFERENCE->m_nWidth)) { + (GRW == (uint32_t)GRREFERENCE->m_nWidth)) { return decode_Template0_opt(pArithDecoder, grContext); } return decode_Template0_unopt(pArithDecoder, grContext); } - if ((GRREFERENCEDX == 0) && (GRW == (FX_DWORD)GRREFERENCE->m_nWidth)) + if ((GRREFERENCEDX == 0) && (GRW == (uint32_t)GRREFERENCE->m_nWidth)) return decode_Template1_opt(pArithDecoder, grContext); return decode_Template1_unopt(pArithDecoder, grContext); } @@ -35,12 +35,12 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext) { FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2, line3, line4, line5; + uint32_t CONTEXT; + uint32_t line1, line2, line3, line4, line5; LTP = 0; std::unique_ptr<CJBig2_Image> GRREG(new CJBig2_Image(GRW, GRH)); GRREG->fill(0); - for (FX_DWORD h = 0; h < GRH; h++) { + for (uint32_t h = 0; h < GRH; h++) { if (TPGRON) { SLTP = pArithDecoder->DECODE(&grContext[0x0010]); LTP = LTP ^ SLTP; @@ -61,7 +61,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_unopt( << 1; line5 |= GRREFERENCE->getPixel(-GRREFERENCEDX - 1, h - GRREFERENCEDY + 1) << 2; - for (FX_DWORD w = 0; w < GRW; w++) { + for (uint32_t w = 0; w < GRW; w++) { CONTEXT = line5; CONTEXT |= line4 << 3; CONTEXT |= line3 << 6; @@ -104,7 +104,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_unopt( << 1; line5 |= GRREFERENCE->getPixel(-GRREFERENCEDX - 1, h - GRREFERENCEDY + 1) << 2; - for (FX_DWORD w = 0; w < GRW; w++) { + for (uint32_t w = 0; w < GRW; w++) { bVal = GRREFERENCE->getPixel(w, h); if (!(TPGRON && (bVal == GRREFERENCE->getPixel(w - 1, h - 1)) && (bVal == GRREFERENCE->getPixel(w, h - 1)) && @@ -153,8 +153,8 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_opt( return nullptr; FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line1_r, line2_r, line3_r; + uint32_t CONTEXT; + uint32_t line1, line1_r, line2_r, line3_r; uint8_t *pLine, *pLineR, cVal; intptr_t nStride, nStrideR, nOffset; int32_t k, nBits; @@ -287,12 +287,12 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext) { FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2, line3, line4, line5; + uint32_t CONTEXT; + uint32_t line1, line2, line3, line4, line5; LTP = 0; std::unique_ptr<CJBig2_Image> GRREG(new CJBig2_Image(GRW, GRH)); GRREG->fill(0); - for (FX_DWORD h = 0; h < GRH; h++) { + for (uint32_t h = 0; h < GRH; h++) { if (TPGRON) { SLTP = pArithDecoder->DECODE(&grContext[0x0008]); LTP = LTP ^ SLTP; @@ -310,7 +310,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_unopt( line5 = GRREFERENCE->getPixel(-GRREFERENCEDX + 1, h - GRREFERENCEDY + 1); line5 |= GRREFERENCE->getPixel(-GRREFERENCEDX, h - GRREFERENCEDY + 1) << 1; - for (FX_DWORD w = 0; w < GRW; w++) { + for (uint32_t w = 0; w < GRW; w++) { CONTEXT = line5; CONTEXT |= line4 << 2; CONTEXT |= line3 << 5; @@ -346,7 +346,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_unopt( line5 = GRREFERENCE->getPixel(-GRREFERENCEDX + 1, h - GRREFERENCEDY + 1); line5 |= GRREFERENCE->getPixel(-GRREFERENCEDX, h - GRREFERENCEDY + 1) << 1; - for (FX_DWORD w = 0; w < GRW; w++) { + for (uint32_t w = 0; w < GRW; w++) { bVal = GRREFERENCE->getPixel(w, h); if (!(TPGRON && (bVal == GRREFERENCE->getPixel(w - 1, h - 1)) && (bVal == GRREFERENCE->getPixel(w, h - 1)) && @@ -391,8 +391,8 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_opt( return nullptr; FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line1_r, line2_r, line3_r; + uint32_t CONTEXT; + uint32_t line1, line1_r, line2_r, line3_r; uint8_t *pLine, *pLineR, cVal; intptr_t nStride, nStrideR, nOffset; int32_t k, nBits; diff --git a/core/fxcodec/jbig2/JBig2_GrrdProc.h b/core/fxcodec/jbig2/JBig2_GrrdProc.h index 2c6d02d271..17adf1900e 100644 --- a/core/fxcodec/jbig2/JBig2_GrrdProc.h +++ b/core/fxcodec/jbig2/JBig2_GrrdProc.h @@ -30,8 +30,8 @@ class CJBig2_GRRDProc { CJBig2_Image* decode_Template1_opt(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext); - FX_DWORD GRW; - FX_DWORD GRH; + uint32_t GRW; + uint32_t GRH; FX_BOOL GRTEMPLATE; CJBig2_Image* GRREFERENCE; int32_t GRREFERENCEDX; diff --git a/core/fxcodec/jbig2/JBig2_GsidProc.cpp b/core/fxcodec/jbig2/JBig2_GsidProc.cpp index 2ac96fc9d8..30f95b8200 100644 --- a/core/fxcodec/jbig2/JBig2_GsidProc.cpp +++ b/core/fxcodec/jbig2/JBig2_GsidProc.cpp @@ -14,7 +14,7 @@ #include "core/fxcodec/jbig2/JBig2_List.h" #include "core/fxcrt/include/fx_basic.h" -FX_DWORD* CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, +uint32_t* CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, IFX_Pause* pPause) { std::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); @@ -56,11 +56,11 @@ FX_DWORD* CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, if (i < GSBPP - 1) pImage->composeFrom(0, 0, GSPLANES.get(i + 1), JBIG2_COMPOSE_XOR); } - std::unique_ptr<FX_DWORD, FxFreeDeleter> GSVALS( - FX_Alloc2D(FX_DWORD, GSW, GSH)); - JBIG2_memset(GSVALS.get(), 0, sizeof(FX_DWORD) * GSW * GSH); - for (FX_DWORD y = 0; y < GSH; ++y) { - for (FX_DWORD x = 0; x < GSW; ++x) { + std::unique_ptr<uint32_t, FxFreeDeleter> GSVALS( + FX_Alloc2D(uint32_t, GSW, GSH)); + JBIG2_memset(GSVALS.get(), 0, sizeof(uint32_t) * GSW * GSH); + for (uint32_t y = 0; y < GSH; ++y) { + for (uint32_t x = 0; x < GSW; ++x) { for (int32_t i = 0; i < GSBPP; ++i) { GSVALS.get()[y * GSW + x] |= GSPLANES.get(i)->getPixel(x, y) << i; } @@ -69,7 +69,7 @@ FX_DWORD* CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, return GSVALS.release(); } -FX_DWORD* CJBig2_GSIDProc::decode_MMR(CJBig2_BitStream* pStream, +uint32_t* CJBig2_GSIDProc::decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause) { std::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); pGRD->MMR = GSMMR; @@ -106,10 +106,10 @@ FX_DWORD* CJBig2_GSIDProc::decode_MMR(CJBig2_BitStream* pStream, JBIG2_COMPOSE_XOR); J = J - 1; } - std::unique_ptr<FX_DWORD> GSVALS(FX_Alloc2D(FX_DWORD, GSW, GSH)); - JBIG2_memset(GSVALS.get(), 0, sizeof(FX_DWORD) * GSW * GSH); - for (FX_DWORD y = 0; y < GSH; ++y) { - for (FX_DWORD x = 0; x < GSW; ++x) { + std::unique_ptr<uint32_t> GSVALS(FX_Alloc2D(uint32_t, GSW, GSH)); + JBIG2_memset(GSVALS.get(), 0, sizeof(uint32_t) * GSW * GSH); + for (uint32_t y = 0; y < GSH; ++y) { + for (uint32_t x = 0; x < GSW; ++x) { for (J = 0; J < GSBPP; ++J) { GSVALS.get()[y * GSW + x] |= GSPLANES.get()[J]->getPixel(x, y) << J; } diff --git a/core/fxcodec/jbig2/JBig2_GsidProc.h b/core/fxcodec/jbig2/JBig2_GsidProc.h index 8124db54d2..b3bd022f03 100644 --- a/core/fxcodec/jbig2/JBig2_GsidProc.h +++ b/core/fxcodec/jbig2/JBig2_GsidProc.h @@ -17,18 +17,18 @@ struct JBig2ArithCtx; class CJBig2_GSIDProc { public: - FX_DWORD* decode_Arith(CJBig2_ArithDecoder* pArithDecoder, + uint32_t* decode_Arith(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, IFX_Pause* pPause); - FX_DWORD* decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause); + uint32_t* decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause); public: FX_BOOL GSMMR; FX_BOOL GSUSESKIP; uint8_t GSBPP; - FX_DWORD GSW; - FX_DWORD GSH; + uint32_t GSW; + uint32_t GSH; uint8_t GSTEMPLATE; CJBig2_Image* GSKIP; }; diff --git a/core/fxcodec/jbig2/JBig2_HtrdProc.cpp b/core/fxcodec/jbig2/JBig2_HtrdProc.cpp index a9f15343d2..aaa617cd73 100644 --- a/core/fxcodec/jbig2/JBig2_HtrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_HtrdProc.cpp @@ -14,10 +14,10 @@ CJBig2_Image* CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, IFX_Pause* pPause) { - FX_DWORD ng, mg; + uint32_t ng, mg; int32_t x, y; - FX_DWORD HBPP; - FX_DWORD* GI; + uint32_t HBPP; + uint32_t* GI; std::unique_ptr<CJBig2_Image> HSKIP; std::unique_ptr<CJBig2_Image> HTREG(new CJBig2_Image(HBW, HBH)); HTREG->fill(HDEFPIXEL); @@ -37,7 +37,7 @@ CJBig2_Image* CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, } } HBPP = 1; - while ((FX_DWORD)(1 << HBPP) < HNUMPATS) { + while ((uint32_t)(1 << HBPP) < HNUMPATS) { HBPP++; } std::unique_ptr<CJBig2_GSIDProc> pGID(new CJBig2_GSIDProc()); @@ -56,7 +56,7 @@ 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; - FX_DWORD pat_index = GI[mg * HGW + ng]; + uint32_t pat_index = GI[mg * HGW + ng]; if (pat_index >= HNUMPATS) { pat_index = HNUMPATS - 1; } @@ -69,13 +69,13 @@ CJBig2_Image* CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, CJBig2_Image* CJBig2_HTRDProc::decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause) { - FX_DWORD ng, mg; + uint32_t ng, mg; int32_t x, y; - FX_DWORD* GI; + uint32_t* GI; std::unique_ptr<CJBig2_Image> HTREG(new CJBig2_Image(HBW, HBH)); HTREG->fill(HDEFPIXEL); - FX_DWORD HBPP = 1; - while ((FX_DWORD)(1 << HBPP) < HNUMPATS) { + uint32_t HBPP = 1; + while ((uint32_t)(1 << HBPP) < HNUMPATS) { HBPP++; } std::unique_ptr<CJBig2_GSIDProc> pGID(new CJBig2_GSIDProc()); @@ -92,7 +92,7 @@ CJBig2_Image* CJBig2_HTRDProc::decode_MMR(CJBig2_BitStream* pStream, for (ng = 0; ng < HGW; ng++) { x = (HGX + mg * HRY + ng * HRX) >> 8; y = (HGY + mg * HRX - ng * HRY) >> 8; - FX_DWORD pat_index = GI[mg * HGW + ng]; + uint32_t pat_index = GI[mg * HGW + ng]; if (pat_index >= HNUMPATS) { pat_index = HNUMPATS - 1; } diff --git a/core/fxcodec/jbig2/JBig2_HtrdProc.h b/core/fxcodec/jbig2/JBig2_HtrdProc.h index 62ae57d9c9..b4f55c6124 100644 --- a/core/fxcodec/jbig2/JBig2_HtrdProc.h +++ b/core/fxcodec/jbig2/JBig2_HtrdProc.h @@ -24,17 +24,17 @@ class CJBig2_HTRDProc { CJBig2_Image* decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause); public: - FX_DWORD HBW; - FX_DWORD HBH; + uint32_t HBW; + uint32_t HBH; FX_BOOL HMMR; uint8_t HTEMPLATE; - FX_DWORD HNUMPATS; + uint32_t HNUMPATS; CJBig2_Image** HPATS; FX_BOOL HDEFPIXEL; JBig2ComposeOp HCOMBOP; FX_BOOL HENABLESKIP; - FX_DWORD HGW; - FX_DWORD HGH; + uint32_t HGW; + uint32_t HGH; int32_t HGX; int32_t HGY; uint16_t HRX; diff --git a/core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp b/core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp index afcc17a55e..050b5e6074 100644 --- a/core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp +++ b/core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp @@ -18,13 +18,13 @@ int CJBig2_HuffmanDecoder::decodeAValue(CJBig2_HuffmanTable* pTable, int nVal = 0; int nBits = 0; while (1) { - FX_DWORD nTmp; + uint32_t nTmp; if (m_pStream->read1Bit(&nTmp) == -1) break; nVal = (nVal << 1) | nTmp; ++nBits; - for (FX_DWORD i = 0; i < pTable->Size(); ++i) { + for (uint32_t i = 0; i < pTable->Size(); ++i) { if (pTable->GetPREFLEN()[i] == nBits && pTable->GetCODES()[i] == nVal) { if (pTable->IsHTOOB() && i == pTable->Size() - 1) return JBIG2_OOB; @@ -32,7 +32,7 @@ int CJBig2_HuffmanDecoder::decodeAValue(CJBig2_HuffmanTable* pTable, if (m_pStream->readNBits(pTable->GetRANGELEN()[i], &nTmp) == -1) return -1; - FX_DWORD offset = pTable->IsHTOOB() ? 3 : 2; + uint32_t offset = pTable->IsHTOOB() ? 3 : 2; if (i == pTable->Size() - offset) *nResult = pTable->GetRANGELOW()[i] - nTmp; else diff --git a/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp b/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp index 7b1855113d..038921e740 100644 --- a/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp +++ b/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp @@ -15,7 +15,7 @@ #include "core/fxcrt/include/fx_memory.h" CJBig2_HuffmanTable::CJBig2_HuffmanTable(const JBig2TableLine* pTable, - FX_DWORD nLines, + uint32_t nLines, bool bHTOOB) : m_bOK(true), HTOOB(bHTOOB), NTEMP(nLines) { ParseFromStandardTable(pTable); @@ -32,7 +32,7 @@ void CJBig2_HuffmanTable::ParseFromStandardTable(const JBig2TableLine* pTable) { PREFLEN.resize(NTEMP); RANGELEN.resize(NTEMP); RANGELOW.resize(NTEMP); - for (FX_DWORD i = 0; i < NTEMP; ++i) { + for (uint32_t i = 0; i < NTEMP; ++i) { PREFLEN[i] = pTable[i].PREFLEN; RANGELEN[i] = pTable[i].RANDELEN; RANGELOW[i] = pTable[i].RANGELOW; @@ -48,8 +48,8 @@ bool CJBig2_HuffmanTable::ParseFromCodedBuffer(CJBig2_BitStream* pStream) { HTOOB = !!(cTemp & 0x01); unsigned char HTPS = ((cTemp >> 1) & 0x07) + 1; unsigned char HTRS = ((cTemp >> 4) & 0x07) + 1; - FX_DWORD HTLOW; - FX_DWORD HTHIGH; + uint32_t HTLOW; + uint32_t HTHIGH; if (pStream->readInteger(&HTLOW) == -1 || pStream->readInteger(&HTHIGH) == -1) { return false; @@ -99,7 +99,7 @@ bool CJBig2_HuffmanTable::ParseFromCodedBuffer(CJBig2_BitStream* pStream) { void CJBig2_HuffmanTable::InitCodes() { int lenmax = 0; - for (FX_DWORD i = 0; i < NTEMP; ++i) + for (uint32_t i = 0; i < NTEMP; ++i) lenmax = std::max(PREFLEN[i], lenmax); CODES.resize(NTEMP); @@ -113,7 +113,7 @@ void CJBig2_HuffmanTable::InitCodes() { for (int i = 1; i <= lenmax; ++i) { FIRSTCODE[i] = (FIRSTCODE[i - 1] + LENCOUNT[i - 1]) << 1; int CURCODE = FIRSTCODE[i]; - for (FX_DWORD j = 0; j < NTEMP; ++j) { + for (uint32_t j = 0; j < NTEMP; ++j) { if (PREFLEN[j] == i) CODES[j] = CURCODE++; } diff --git a/core/fxcodec/jbig2/JBig2_HuffmanTable.h b/core/fxcodec/jbig2/JBig2_HuffmanTable.h index 7a31cf60dd..9b29847e4d 100644 --- a/core/fxcodec/jbig2/JBig2_HuffmanTable.h +++ b/core/fxcodec/jbig2/JBig2_HuffmanTable.h @@ -17,7 +17,7 @@ struct JBig2TableLine; class CJBig2_HuffmanTable { public: CJBig2_HuffmanTable(const JBig2TableLine* pTable, - FX_DWORD nLines, + uint32_t nLines, bool bHTOOB); explicit CJBig2_HuffmanTable(CJBig2_BitStream* pStream); @@ -25,7 +25,7 @@ class CJBig2_HuffmanTable { ~CJBig2_HuffmanTable(); bool IsHTOOB() const { return HTOOB; } - FX_DWORD Size() const { return NTEMP; } + uint32_t Size() const { return NTEMP; } const std::vector<int>& GetCODES() const { return CODES; } const std::vector<int>& GetPREFLEN() const { return PREFLEN; } const std::vector<int>& GetRANGELEN() const { return RANGELEN; } @@ -40,7 +40,7 @@ class CJBig2_HuffmanTable { bool m_bOK; bool HTOOB; - FX_DWORD NTEMP; + uint32_t NTEMP; std::vector<int> CODES; std::vector<int> PREFLEN; std::vector<int> RANGELEN; diff --git a/core/fxcodec/jbig2/JBig2_Image.cpp b/core/fxcodec/jbig2/JBig2_Image.cpp index bb3674000f..7297199112 100644 --- a/core/fxcodec/jbig2/JBig2_Image.cpp +++ b/core/fxcodec/jbig2/JBig2_Image.cpp @@ -149,14 +149,14 @@ FX_BOOL CJBig2_Image::composeFrom(int32_t x, return pSrc->composeTo(this, x, y, op, pSrcRect); } #define JBIG2_GETDWORD(buf) \ - ((FX_DWORD)(((buf)[0] << 24) | ((buf)[1] << 16) | ((buf)[2] << 8) | (buf)[3])) + ((uint32_t)(((buf)[0] << 24) | ((buf)[1] << 16) | ((buf)[2] << 8) | (buf)[3])) CJBig2_Image* CJBig2_Image::subImage(int32_t x, int32_t y, int32_t w, int32_t h) { int32_t m, n, j; uint8_t *pLineSrc, *pLineDst; - FX_DWORD wTmp; + uint32_t wTmp; uint8_t *pSrc, *pSrcEnd, *pDst, *pDstEnd; if (w == 0 || h == 0) { return NULL; @@ -180,7 +180,7 @@ CJBig2_Image* CJBig2_Image::subImage(int32_t x, pDst = pLineDst; pDstEnd = pLineDst + pImage->m_nStride; for (; pDst < pDstEnd; pSrc += 4, pDst += 4) { - *((FX_DWORD*)pDst) = *((FX_DWORD*)pSrc); + *((uint32_t*)pDst) = *((uint32_t*)pSrc); } pLineSrc += m_nStride; pLineDst += pImage->m_nStride; @@ -213,9 +213,9 @@ void CJBig2_Image::expand(int32_t h, FX_BOOL v) { if (!m_pData || h <= m_nHeight) { return; } - FX_DWORD dwH = pdfium::base::checked_cast<FX_DWORD>(h); - FX_DWORD dwStride = pdfium::base::checked_cast<FX_DWORD>(m_nStride); - FX_DWORD dwHeight = pdfium::base::checked_cast<FX_DWORD>(m_nHeight); + uint32_t dwH = pdfium::base::checked_cast<uint32_t>(h); + uint32_t dwStride = pdfium::base::checked_cast<uint32_t>(m_nStride); + uint32_t dwHeight = pdfium::base::checked_cast<uint32_t>(m_nHeight); FX_SAFE_DWORD safeMemSize = dwH; safeMemSize *= dwStride; if (!safeMemSize.IsValid()) { @@ -240,7 +240,7 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, 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, + uint32_t s1 = 0, d1 = 0, d2 = 0, shift = 0, shift1 = 0, shift2 = 0, tmp = 0, tmp1 = 0, tmp2 = 0, maskL = 0, maskR = 0, maskM = 0; uint8_t *lineSrc = NULL, *lineDst = NULL, *sp = NULL, *dp = NULL; @@ -700,11 +700,11 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, if ((xd0 & ~31) == ((xd1 - 1) & ~31)) { if ((xs0 & ~31) == ((xs1 - 1) & ~31)) { if (s1 > d1) { - FX_DWORD shift = s1 - d1; + uint32_t shift = s1 - d1; for (int32_t yy = yd0; yy < yd1; yy++) { - FX_DWORD tmp1 = JBIG2_GETDWORD(lineSrc) << shift; - FX_DWORD tmp2 = JBIG2_GETDWORD(lineDst); - FX_DWORD tmp = 0; + uint32_t tmp1 = JBIG2_GETDWORD(lineSrc) << shift; + uint32_t tmp2 = JBIG2_GETDWORD(lineDst); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = (tmp2 & ~maskM) | ((tmp1 | tmp2) & maskM); @@ -730,11 +730,11 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, lineDst += pDst->m_nStride; } } else { - FX_DWORD shift = d1 - s1; + uint32_t shift = d1 - s1; for (int32_t yy = yd0; yy < yd1; yy++) { - FX_DWORD tmp1 = JBIG2_GETDWORD(lineSrc) >> shift; - FX_DWORD tmp2 = JBIG2_GETDWORD(lineDst); - FX_DWORD tmp = 0; + uint32_t tmp1 = JBIG2_GETDWORD(lineSrc) >> shift; + uint32_t tmp2 = JBIG2_GETDWORD(lineDst); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = (tmp2 & ~maskM) | ((tmp1 | tmp2) & maskM); @@ -761,13 +761,13 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, } } } else { - FX_DWORD shift1 = s1 - d1; - FX_DWORD shift2 = 32 - shift1; + uint32_t shift1 = s1 - d1; + uint32_t shift2 = 32 - shift1; for (int32_t yy = yd0; yy < yd1; yy++) { - FX_DWORD tmp1 = (JBIG2_GETDWORD(lineSrc) << shift1) | + uint32_t tmp1 = (JBIG2_GETDWORD(lineSrc) << shift1) | (JBIG2_GETDWORD(lineSrc + 4) >> shift2); - FX_DWORD tmp2 = JBIG2_GETDWORD(lineDst); - FX_DWORD tmp = 0; + uint32_t tmp2 = JBIG2_GETDWORD(lineDst); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = (tmp2 & ~maskM) | ((tmp1 | tmp2) & maskM); @@ -795,17 +795,17 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, } } else { if (s1 > d1) { - FX_DWORD shift1 = s1 - d1; - FX_DWORD shift2 = 32 - shift1; + uint32_t shift1 = s1 - d1; + uint32_t shift2 = 32 - shift1; int32_t middleDwords = (xd1 >> 5) - ((xd0 + 31) >> 5); for (int32_t yy = yd0; yy < yd1; yy++) { uint8_t* sp = lineSrc; uint8_t* dp = lineDst; if (d1 != 0) { - FX_DWORD tmp1 = (JBIG2_GETDWORD(sp) << shift1) | + uint32_t tmp1 = (JBIG2_GETDWORD(sp) << shift1) | (JBIG2_GETDWORD(sp + 4) >> shift2); - FX_DWORD tmp2 = JBIG2_GETDWORD(dp); - FX_DWORD tmp = 0; + uint32_t tmp2 = JBIG2_GETDWORD(dp); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = (tmp2 & ~maskL) | ((tmp1 | tmp2) & maskL); @@ -831,10 +831,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, dp += 4; } for (int32_t xx = 0; xx < middleDwords; xx++) { - FX_DWORD tmp1 = (JBIG2_GETDWORD(sp) << shift1) | + uint32_t tmp1 = (JBIG2_GETDWORD(sp) << shift1) | (JBIG2_GETDWORD(sp + 4) >> shift2); - FX_DWORD tmp2 = JBIG2_GETDWORD(dp); - FX_DWORD tmp = 0; + uint32_t tmp2 = JBIG2_GETDWORD(dp); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = tmp1 | tmp2; @@ -860,12 +860,12 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, dp += 4; } if (d2 != 0) { - FX_DWORD tmp1 = + uint32_t tmp1 = (JBIG2_GETDWORD(sp) << shift1) | (((sp + 4) < lineSrc + lineLeft ? JBIG2_GETDWORD(sp + 4) : 0) >> shift2); - FX_DWORD tmp2 = JBIG2_GETDWORD(dp); - FX_DWORD tmp = 0; + uint32_t tmp2 = JBIG2_GETDWORD(dp); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = (tmp2 & ~maskR) | ((tmp1 | tmp2) & maskR); @@ -897,9 +897,9 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, uint8_t* sp = lineSrc; uint8_t* dp = lineDst; if (d1 != 0) { - FX_DWORD tmp1 = JBIG2_GETDWORD(sp); - FX_DWORD tmp2 = JBIG2_GETDWORD(dp); - FX_DWORD tmp = 0; + uint32_t tmp1 = JBIG2_GETDWORD(sp); + uint32_t tmp2 = JBIG2_GETDWORD(dp); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = (tmp2 & ~maskL) | ((tmp1 | tmp2) & maskL); @@ -925,9 +925,9 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, dp += 4; } for (int32_t xx = 0; xx < middleDwords; xx++) { - FX_DWORD tmp1 = JBIG2_GETDWORD(sp); - FX_DWORD tmp2 = JBIG2_GETDWORD(dp); - FX_DWORD tmp = 0; + uint32_t tmp1 = JBIG2_GETDWORD(sp); + uint32_t tmp2 = JBIG2_GETDWORD(dp); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = tmp1 | tmp2; @@ -953,9 +953,9 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, dp += 4; } if (d2 != 0) { - FX_DWORD tmp1 = JBIG2_GETDWORD(sp); - FX_DWORD tmp2 = JBIG2_GETDWORD(dp); - FX_DWORD tmp = 0; + uint32_t tmp1 = JBIG2_GETDWORD(sp); + uint32_t tmp2 = JBIG2_GETDWORD(dp); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = (tmp2 & ~maskR) | ((tmp1 | tmp2) & maskR); @@ -982,16 +982,16 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, lineDst += pDst->m_nStride; } } else { - FX_DWORD shift1 = d1 - s1; - FX_DWORD shift2 = 32 - shift1; + uint32_t shift1 = d1 - s1; + uint32_t shift2 = 32 - shift1; int32_t middleDwords = (xd1 >> 5) - ((xd0 + 31) >> 5); for (int32_t yy = yd0; yy < yd1; yy++) { uint8_t* sp = lineSrc; uint8_t* dp = lineDst; if (d1 != 0) { - FX_DWORD tmp1 = JBIG2_GETDWORD(sp) >> shift1; - FX_DWORD tmp2 = JBIG2_GETDWORD(dp); - FX_DWORD tmp = 0; + uint32_t tmp1 = JBIG2_GETDWORD(sp) >> shift1; + uint32_t tmp2 = JBIG2_GETDWORD(dp); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = (tmp2 & ~maskL) | ((tmp1 | tmp2) & maskL); @@ -1016,10 +1016,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, dp += 4; } for (int32_t xx = 0; xx < middleDwords; xx++) { - FX_DWORD tmp1 = (JBIG2_GETDWORD(sp) << shift2) | + uint32_t tmp1 = (JBIG2_GETDWORD(sp) << shift2) | ((JBIG2_GETDWORD(sp + 4)) >> shift1); - FX_DWORD tmp2 = JBIG2_GETDWORD(dp); - FX_DWORD tmp = 0; + uint32_t tmp2 = JBIG2_GETDWORD(dp); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = tmp1 | tmp2; @@ -1045,12 +1045,12 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, dp += 4; } if (d2 != 0) { - FX_DWORD tmp1 = + uint32_t tmp1 = (JBIG2_GETDWORD(sp) << shift2) | (((sp + 4) < lineSrc + lineLeft ? JBIG2_GETDWORD(sp + 4) : 0) >> shift1); - FX_DWORD tmp2 = JBIG2_GETDWORD(dp); - FX_DWORD tmp = 0; + uint32_t tmp2 = JBIG2_GETDWORD(dp); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = (tmp2 & ~maskR) | ((tmp1 | tmp2) & maskR); diff --git a/core/fxcodec/jbig2/JBig2_Page.h b/core/fxcodec/jbig2/JBig2_Page.h index 6a33549145..e9ffa76791 100644 --- a/core/fxcodec/jbig2/JBig2_Page.h +++ b/core/fxcodec/jbig2/JBig2_Page.h @@ -10,10 +10,10 @@ #include "core/fxcrt/include/fx_system.h" struct JBig2PageInfo { - FX_DWORD m_dwWidth; - FX_DWORD m_dwHeight; - FX_DWORD m_dwResolutionX; - FX_DWORD m_dwResolutionY; + uint32_t m_dwWidth; + uint32_t m_dwHeight; + uint32_t m_dwResolutionX; + uint32_t m_dwResolutionY; uint8_t m_cFlags; FX_BOOL m_bIsStriped; uint16_t m_wMaxStripeSize; diff --git a/core/fxcodec/jbig2/JBig2_PatternDict.cpp b/core/fxcodec/jbig2/JBig2_PatternDict.cpp index 3db672e86b..e74d83647c 100644 --- a/core/fxcodec/jbig2/JBig2_PatternDict.cpp +++ b/core/fxcodec/jbig2/JBig2_PatternDict.cpp @@ -15,7 +15,7 @@ CJBig2_PatternDict::CJBig2_PatternDict() { CJBig2_PatternDict::~CJBig2_PatternDict() { if (HDPATS) { - for (FX_DWORD i = 0; i < NUMPATS; i++) { + for (uint32_t i = 0; i < NUMPATS; i++) { delete HDPATS[i]; } FX_Free(HDPATS); diff --git a/core/fxcodec/jbig2/JBig2_PatternDict.h b/core/fxcodec/jbig2/JBig2_PatternDict.h index 3196fcaaf3..dddd4747f0 100644 --- a/core/fxcodec/jbig2/JBig2_PatternDict.h +++ b/core/fxcodec/jbig2/JBig2_PatternDict.h @@ -16,7 +16,7 @@ class CJBig2_PatternDict { ~CJBig2_PatternDict(); - FX_DWORD NUMPATS; + uint32_t NUMPATS; CJBig2_Image** HDPATS; }; diff --git a/core/fxcodec/jbig2/JBig2_PddProc.cpp b/core/fxcodec/jbig2/JBig2_PddProc.cpp index 5b67aadb57..12f66c3b7d 100644 --- a/core/fxcodec/jbig2/JBig2_PddProc.cpp +++ b/core/fxcodec/jbig2/JBig2_PddProc.cpp @@ -16,7 +16,7 @@ CJBig2_PatternDict* CJBig2_PDDProc::decode_Arith( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, IFX_Pause* pPause) { - FX_DWORD GRAY; + uint32_t GRAY; CJBig2_Image* BHDC = nullptr; std::unique_ptr<CJBig2_PatternDict> pDict(new CJBig2_PatternDict()); pDict->NUMPATS = GRAYMAX + 1; @@ -59,7 +59,7 @@ CJBig2_PatternDict* CJBig2_PDDProc::decode_Arith( CJBig2_PatternDict* CJBig2_PDDProc::decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause) { - FX_DWORD GRAY; + uint32_t GRAY; CJBig2_Image* BHDC = nullptr; std::unique_ptr<CJBig2_PatternDict> pDict(new CJBig2_PatternDict()); pDict->NUMPATS = GRAYMAX + 1; diff --git a/core/fxcodec/jbig2/JBig2_PddProc.h b/core/fxcodec/jbig2/JBig2_PddProc.h index ce0089ac14..6bdd186ffc 100644 --- a/core/fxcodec/jbig2/JBig2_PddProc.h +++ b/core/fxcodec/jbig2/JBig2_PddProc.h @@ -27,7 +27,7 @@ class CJBig2_PDDProc { FX_BOOL HDMMR; uint8_t HDPW; uint8_t HDPH; - FX_DWORD GRAYMAX; + uint32_t GRAYMAX; uint8_t HDTEMPLATE; }; diff --git a/core/fxcodec/jbig2/JBig2_SddProc.cpp b/core/fxcodec/jbig2/JBig2_SddProc.cpp index 54c0bb9dd6..81d7c89270 100644 --- a/core/fxcodec/jbig2/JBig2_SddProc.cpp +++ b/core/fxcodec/jbig2/JBig2_SddProc.cpp @@ -24,18 +24,18 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( std::vector<JBig2ArithCtx>* gbContext, std::vector<JBig2ArithCtx>* grContext) { CJBig2_Image** SDNEWSYMS; - FX_DWORD HCHEIGHT, NSYMSDECODED; + uint32_t HCHEIGHT, NSYMSDECODED; int32_t HCDH; - FX_DWORD SYMWIDTH, TOTWIDTH; + uint32_t SYMWIDTH, TOTWIDTH; int32_t DW; CJBig2_Image* BS; - FX_DWORD I, J, REFAGGNINST; + uint32_t I, J, REFAGGNINST; FX_BOOL* EXFLAGS; - FX_DWORD EXINDEX; + uint32_t EXINDEX; FX_BOOL CUREXFLAG; - FX_DWORD EXRUNLENGTH; - FX_DWORD nTmp; - FX_DWORD SBNUMSYMS; + uint32_t EXRUNLENGTH; + uint32_t nTmp; + uint32_t SBNUMSYMS; uint8_t SBSYMCODELEN; int32_t RDXI, RDYI; CJBig2_Image** SBSYMS; @@ -55,7 +55,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( std::unique_ptr<CJBig2_ArithIntDecoder> IARDW(new CJBig2_ArithIntDecoder); std::unique_ptr<CJBig2_ArithIntDecoder> IARDH(new CJBig2_ArithIntDecoder); nTmp = 0; - while ((FX_DWORD)(1 << nTmp) < (SDNUMINSYMS + SDNUMNEWSYMS)) { + while ((uint32_t)(1 << nTmp) < (SDNUMINSYMS + SDNUMNEWSYMS)) { nTmp++; } IAID.reset(new CJBig2_ArithIaidDecoder((uint8_t)nTmp)); @@ -124,7 +124,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( pDecoder->SBNUMSYMS = SDNUMINSYMS + NSYMSDECODED; SBNUMSYMS = pDecoder->SBNUMSYMS; nTmp = 0; - while ((FX_DWORD)(1 << nTmp) < SBNUMSYMS) { + while ((uint32_t)(1 << nTmp) < SBNUMSYMS) { nTmp++; } SBSYMCODELEN = (uint8_t)nTmp; @@ -192,7 +192,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( FX_Free(SBSYMS); } else if (REFAGGNINST == 1) { SBNUMSYMS = SDNUMINSYMS + NSYMSDECODED; - FX_DWORD IDI; + uint32_t IDI; IAID->decode(pArithDecoder, &IDI); IARDX->decode(pArithDecoder, &RDXI); IARDY->decode(pArithDecoder, &RDYI); @@ -283,26 +283,26 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( std::vector<JBig2ArithCtx>* grContext, IFX_Pause* pPause) { CJBig2_Image** SDNEWSYMS; - FX_DWORD* SDNEWSYMWIDTHS; - FX_DWORD HCHEIGHT, NSYMSDECODED; + uint32_t* SDNEWSYMWIDTHS; + uint32_t HCHEIGHT, NSYMSDECODED; int32_t HCDH; - FX_DWORD SYMWIDTH, TOTWIDTH, HCFIRSTSYM; + uint32_t SYMWIDTH, TOTWIDTH, HCFIRSTSYM; int32_t DW; CJBig2_Image *BS, *BHC; - FX_DWORD I, J, REFAGGNINST; + uint32_t I, J, REFAGGNINST; FX_BOOL* EXFLAGS; - FX_DWORD EXINDEX; + uint32_t EXINDEX; FX_BOOL CUREXFLAG; - FX_DWORD EXRUNLENGTH; + uint32_t EXRUNLENGTH; int32_t nVal, nBits; - FX_DWORD nTmp; - FX_DWORD SBNUMSYMS; + uint32_t nTmp; + uint32_t SBNUMSYMS; uint8_t SBSYMCODELEN; JBig2HuffmanCode* SBSYMCODES; - FX_DWORD IDI; + uint32_t IDI; int32_t RDXI, RDYI; - FX_DWORD BMSIZE; - FX_DWORD stride; + uint32_t BMSIZE; + uint32_t stride; CJBig2_Image** SBSYMS; std::unique_ptr<CJBig2_HuffmanDecoder> pHuffmanDecoder( new CJBig2_HuffmanDecoder(pStream)); @@ -311,8 +311,8 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( SDNEWSYMWIDTHS = nullptr; BHC = nullptr; if (SDREFAGG == 0) { - SDNEWSYMWIDTHS = FX_Alloc(FX_DWORD, SDNUMNEWSYMS); - FXSYS_memset(SDNEWSYMWIDTHS, 0, SDNUMNEWSYMS * sizeof(FX_DWORD)); + SDNEWSYMWIDTHS = FX_Alloc(uint32_t, SDNUMNEWSYMS); + FXSYS_memset(SDNEWSYMWIDTHS, 0, SDNUMNEWSYMS * sizeof(uint32_t)); } std::unique_ptr<CJBig2_SymbolDict> pDict(new CJBig2_SymbolDict()); std::unique_ptr<CJBig2_HuffmanTable> pTable; @@ -370,7 +370,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( SBNUMSYMS = pDecoder->SBNUMSYMS; SBSYMCODES = FX_Alloc(JBig2HuffmanCode, SBNUMSYMS); nTmp = 1; - while ((FX_DWORD)(1 << nTmp) < SBNUMSYMS) { + while ((uint32_t)(1 << nTmp) < SBNUMSYMS) { nTmp++; } for (I = 0; I < SBNUMSYMS; I++) { @@ -433,7 +433,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( } else if (REFAGGNINST == 1) { SBNUMSYMS = SDNUMINSYMS + SDNUMNEWSYMS; nTmp = 1; - while ((FX_DWORD)(1 << nTmp) < SBNUMSYMS) { + while ((uint32_t)(1 << nTmp) < SBNUMSYMS) { nTmp++; } SBSYMCODELEN = (uint8_t)nTmp; @@ -499,7 +499,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( } pStream->alignByte(); pStream->offset(2); - if ((FX_DWORD)nVal != (pStream->getOffset() - nTmp)) { + if ((uint32_t)nVal != (pStream->getOffset() - nTmp)) { delete BS; FX_Free(SBSYMS); goto failed; diff --git a/core/fxcodec/jbig2/JBig2_SddProc.h b/core/fxcodec/jbig2/JBig2_SddProc.h index edfc37263b..4febc8d553 100644 --- a/core/fxcodec/jbig2/JBig2_SddProc.h +++ b/core/fxcodec/jbig2/JBig2_SddProc.h @@ -32,10 +32,10 @@ class CJBig2_SDDProc { public: FX_BOOL SDHUFF; FX_BOOL SDREFAGG; - FX_DWORD SDNUMINSYMS; + uint32_t SDNUMINSYMS; CJBig2_Image** SDINSYMS; - FX_DWORD SDNUMNEWSYMS; - FX_DWORD SDNUMEXSYMS; + uint32_t SDNUMNEWSYMS; + uint32_t SDNUMEXSYMS; CJBig2_HuffmanTable* SDHUFFDH; CJBig2_HuffmanTable* SDHUFFDW; CJBig2_HuffmanTable* SDHUFFBMSIZE; diff --git a/core/fxcodec/jbig2/JBig2_Segment.h b/core/fxcodec/jbig2/JBig2_Segment.h index 61550ada09..d89d652699 100644 --- a/core/fxcodec/jbig2/JBig2_Segment.h +++ b/core/fxcodec/jbig2/JBig2_Segment.h @@ -35,7 +35,7 @@ class CJBig2_Segment { ~CJBig2_Segment(); - FX_DWORD m_dwNumber; + uint32_t m_dwNumber; union { struct { uint8_t type : 6; @@ -45,13 +45,13 @@ class CJBig2_Segment { uint8_t c; } m_cFlags; int32_t m_nReferred_to_segment_count; - FX_DWORD* m_pReferred_to_segment_numbers; - FX_DWORD m_dwPage_association; - FX_DWORD m_dwData_length; + uint32_t* m_pReferred_to_segment_numbers; + uint32_t m_dwPage_association; + uint32_t m_dwData_length; - FX_DWORD m_dwHeader_Length; - FX_DWORD m_dwObjNum; - FX_DWORD m_dwDataOffset; + uint32_t m_dwHeader_Length; + uint32_t m_dwObjNum; + uint32_t m_dwDataOffset; JBig2_SegmentState m_State; JBig2_ResultType m_nResultType; union { diff --git a/core/fxcodec/jbig2/JBig2_TrdProc.cpp b/core/fxcodec/jbig2/JBig2_TrdProc.cpp index 1a078a1592..5b0ef19505 100644 --- a/core/fxcodec/jbig2/JBig2_TrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_TrdProc.cpp @@ -25,7 +25,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, STRIPT *= SBSTRIPS; STRIPT = -STRIPT; - FX_DWORD NINSTANCES = 0; + uint32_t NINSTANCES = 0; while (NINSTANCES < SBNUMINSTANCES) { int32_t DT; if (pHuffmanDecoder->decodeAValue(SBHUFFDT, &DT) != 0) @@ -58,8 +58,8 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, } uint8_t CURT = 0; if (SBSTRIPS != 1) { - FX_DWORD nTmp = 1; - while ((FX_DWORD)(1 << nTmp) < SBSTRIPS) { + uint32_t nTmp = 1; + while ((uint32_t)(1 << nTmp) < SBSTRIPS) { nTmp++; } int32_t nVal; @@ -71,9 +71,9 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, int32_t TI = STRIPT + CURT; int32_t nVal = 0; int32_t nBits = 0; - FX_DWORD IDI; + uint32_t IDI; for (;;) { - FX_DWORD nTmp; + uint32_t nTmp; if (pStream->read1Bit(&nTmp) != 0) return nullptr; @@ -109,13 +109,13 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, return nullptr; } pStream->alignByte(); - FX_DWORD nTmp = pStream->getOffset(); + uint32_t nTmp = pStream->getOffset(); CJBig2_Image* IBOI = SBSYMS[IDI]; if (!IBOI) return nullptr; - FX_DWORD WOI = IBOI->m_nWidth; - FX_DWORD HOI = IBOI->m_nHeight; + uint32_t WOI = IBOI->m_nWidth; + uint32_t HOI = IBOI->m_nHeight; if ((int)(WOI + RDWI) < 0 || (int)(HOI + RDHI) < 0) return nullptr; @@ -142,7 +142,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, pStream->alignByte(); pStream->offset(2); - if ((FX_DWORD)nVal != (pStream->getOffset() - nTmp)) { + if ((uint32_t)nVal != (pStream->getOffset() - nTmp)) { delete IBI; return nullptr; } @@ -150,8 +150,8 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, if (!IBI) { continue; } - FX_DWORD WI = IBI->m_nWidth; - FX_DWORD HI = IBI->m_nHeight; + uint32_t WI = IBI->m_nWidth; + uint32_t HI = IBI->m_nHeight; if (TRANSPOSED == 0 && ((REFCORNER == JBIG2_CORNER_TOPRIGHT) || (REFCORNER == JBIG2_CORNER_BOTTOMRIGHT))) { CURS = CURS + WI - 1; @@ -270,7 +270,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, STRIPT *= SBSTRIPS; STRIPT = -STRIPT; int32_t FIRSTS = 0; - FX_DWORD NINSTANCES = 0; + uint32_t NINSTANCES = 0; while (NINSTANCES < SBNUMINSTANCES) { int32_t CURS = 0; int32_t DT; @@ -299,7 +299,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, pIAIT->decode(pArithDecoder, &CURT); int32_t TI = STRIPT + CURT; - FX_DWORD IDI; + uint32_t IDI; pIAID->decode(pArithDecoder, &IDI); if (IDI >= SBNUMSYMS) return nullptr; @@ -324,8 +324,8 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, pIARDX->decode(pArithDecoder, &RDXI); pIARDY->decode(pArithDecoder, &RDYI); CJBig2_Image* IBOI = SBSYMS[IDI]; - FX_DWORD WOI = IBOI->m_nWidth; - FX_DWORD HOI = IBOI->m_nHeight; + uint32_t WOI = IBOI->m_nWidth; + uint32_t HOI = IBOI->m_nHeight; if ((int)(WOI + RDWI) < 0 || (int)(HOI + RDHI) < 0) { return nullptr; } @@ -347,8 +347,8 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, if (!pIBI) return nullptr; - FX_DWORD WI = pIBI->m_nWidth; - FX_DWORD HI = pIBI->m_nHeight; + uint32_t WI = pIBI->m_nWidth; + uint32_t HI = pIBI->m_nHeight; if (TRANSPOSED == 0 && ((REFCORNER == JBIG2_CORNER_TOPRIGHT) || (REFCORNER == JBIG2_CORNER_BOTTOMRIGHT))) { CURS += WI - 1; diff --git a/core/fxcodec/jbig2/JBig2_TrdProc.h b/core/fxcodec/jbig2/JBig2_TrdProc.h index d73e012296..fdad75fb6e 100644 --- a/core/fxcodec/jbig2/JBig2_TrdProc.h +++ b/core/fxcodec/jbig2/JBig2_TrdProc.h @@ -50,11 +50,11 @@ class CJBig2_TRDProc { public: FX_BOOL SBHUFF; FX_BOOL SBREFINE; - FX_DWORD SBW; - FX_DWORD SBH; - FX_DWORD SBNUMINSTANCES; - FX_DWORD SBSTRIPS; - FX_DWORD SBNUMSYMS; + uint32_t SBW; + uint32_t SBH; + uint32_t SBNUMINSTANCES; + uint32_t SBSTRIPS; + uint32_t SBNUMSYMS; JBig2HuffmanCode* SBSYMCODES; uint8_t SBSYMCODELEN; diff --git a/core/fxcodec/lbmp/fx_bmp.cpp b/core/fxcodec/lbmp/fx_bmp.cpp index 90d8fe1247..be5d93e1b8 100644 --- a/core/fxcodec/lbmp/fx_bmp.cpp +++ b/core/fxcodec/lbmp/fx_bmp.cpp @@ -14,11 +14,11 @@ const size_t kBmpCoreHeaderSize = 12; const size_t kBmpInfoHeaderSize = 40; // TODO(thestig): Replace with FXDWORD_GET_LSBFIRST? -FX_DWORD GetDWord_LSBFirst(uint8_t* p) { +uint32_t GetDWord_LSBFirst(uint8_t* p) { return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24); } -void SetDWord_LSBFirst(uint8_t* p, FX_DWORD v) { +void SetDWord_LSBFirst(uint8_t* p, uint32_t v) { p[0] = (uint8_t)v; p[1] = (uint8_t)(v >> 8); p[2] = (uint8_t)(v >> 16); @@ -65,7 +65,7 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) { if (bmp_ptr == NULL) { return 0; } - FX_DWORD skip_size_org = bmp_ptr->skip_size; + uint32_t skip_size_org = bmp_ptr->skip_size; if (bmp_ptr->decode_status == BMP_D_STATUS_HEADER) { ASSERT(sizeof(BmpFileHeader) == 14); BmpFileHeader* bmp_header_ptr = NULL; @@ -81,7 +81,7 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) { bmp_error(bmp_ptr, "Not A Bmp Image"); return 0; } - if (bmp_ptr->avail_in < sizeof(FX_DWORD)) { + if (bmp_ptr->avail_in < sizeof(uint32_t)) { bmp_ptr->skip_size = skip_size_org; return 2; } @@ -182,7 +182,7 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) { case 8: case 16: case 24: { - if (bmp_ptr->color_used > ((FX_DWORD)1) << bmp_ptr->bitCounts) { + if (bmp_ptr->color_used > ((uint32_t)1) << bmp_ptr->bitCounts) { bmp_error(bmp_ptr, "The Bmp File Is Corrupt"); return 0; } @@ -227,8 +227,8 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) { bmp_error(bmp_ptr, "The Bmp File Is Corrupt"); return 0; } - FX_DWORD* mask; - if (bmp_read_data(bmp_ptr, (uint8_t**)&mask, 3 * sizeof(FX_DWORD)) == + uint32_t* mask; + if (bmp_read_data(bmp_ptr, (uint8_t**)&mask, 3 * sizeof(uint32_t)) == NULL) { bmp_ptr->skip_size = skip_size_org; return 2; @@ -259,14 +259,14 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) { bmp_ptr->pal_num = bmp_ptr->color_used; } uint8_t* src_pal_ptr = NULL; - FX_DWORD src_pal_size = bmp_ptr->pal_num * (bmp_ptr->pal_type ? 3 : 4); + uint32_t src_pal_size = bmp_ptr->pal_num * (bmp_ptr->pal_type ? 3 : 4); if (bmp_read_data(bmp_ptr, (uint8_t**)&src_pal_ptr, src_pal_size) == NULL) { bmp_ptr->skip_size = skip_size_org; return 2; } FX_Free(bmp_ptr->pal_ptr); - bmp_ptr->pal_ptr = FX_Alloc(FX_DWORD, bmp_ptr->pal_num); + bmp_ptr->pal_ptr = FX_Alloc(uint32_t, bmp_ptr->pal_num); int32_t src_pal_index = 0; if (bmp_ptr->pal_type == BMP_PAL_OLD) { while (src_pal_index < bmp_ptr->pal_num) { @@ -388,7 +388,7 @@ int32_t bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) { uint8_t* second_byte_ptr = NULL; bmp_ptr->col_num = 0; while (TRUE) { - FX_DWORD skip_size_org = bmp_ptr->skip_size; + uint32_t skip_size_org = bmp_ptr->skip_size; if (bmp_read_data(bmp_ptr, &first_byte_ptr, 1) == NULL) { return 2; } @@ -490,7 +490,7 @@ int32_t bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) { uint8_t* second_byte_ptr = NULL; bmp_ptr->col_num = 0; while (TRUE) { - FX_DWORD skip_size_org = bmp_ptr->skip_size; + uint32_t skip_size_org = bmp_ptr->skip_size; if (bmp_read_data(bmp_ptr, &first_byte_ptr, 1) == NULL) { return 2; } @@ -608,7 +608,7 @@ int32_t bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) { } uint8_t* bmp_read_data(bmp_decompress_struct_p bmp_ptr, uint8_t** des_buf_pp, - FX_DWORD data_size) { + uint32_t data_size) { if (bmp_ptr == NULL || bmp_ptr->avail_in < bmp_ptr->skip_size + data_size) { return NULL; } @@ -624,12 +624,12 @@ void bmp_save_decoding_status(bmp_decompress_struct_p bmp_ptr, int32_t status) { } void bmp_input_buffer(bmp_decompress_struct_p bmp_ptr, uint8_t* src_buf, - FX_DWORD src_size) { + uint32_t src_size) { bmp_ptr->next_in = src_buf; bmp_ptr->avail_in = src_size; bmp_ptr->skip_size = 0; } -FX_DWORD bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr, +uint32_t bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr, uint8_t** avial_buf_ptr) { if (avial_buf_ptr) { *avial_buf_ptr = NULL; @@ -656,7 +656,7 @@ void bmp_destroy_compress(bmp_compress_struct_p bmp_ptr) { } } static void WriteFileHeader(BmpFileHeaderPtr head_ptr, uint8_t* dst_buf) { - FX_DWORD offset; + uint32_t offset; offset = 0; SetWord_LSBFirst(&dst_buf[offset], head_ptr->bfType); offset += 2; @@ -670,7 +670,7 @@ static void WriteFileHeader(BmpFileHeaderPtr head_ptr, uint8_t* dst_buf) { offset += 4; } static void WriteInfoHeader(BmpInfoHeaderPtr info_head_ptr, uint8_t* dst_buf) { - FX_DWORD offset; + uint32_t offset; offset = sizeof(BmpFileHeader); SetDWord_LSBFirst(&dst_buf[offset], info_head_ptr->biSize); offset += 4; @@ -697,12 +697,12 @@ static void WriteInfoHeader(BmpInfoHeaderPtr info_head_ptr, uint8_t* dst_buf) { } static void bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, - FX_DWORD& dst_size) { + uint32_t& dst_size) { if (bmp_ptr->info_header.biBitCount != 16 && bmp_ptr->info_header.biBitCount != 32) { return; } - FX_DWORD size, dst_pos, i; + uint32_t size, dst_pos, i; size = bmp_ptr->src_pitch * bmp_ptr->src_row * bmp_ptr->info_header.biBitCount / 16; dst_pos = bmp_ptr->file_header.bfOffBits; @@ -712,9 +712,9 @@ static void bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, return; } FXSYS_memset(&dst_buf[dst_pos], 0, size); - FX_DWORD mask_red; - FX_DWORD mask_green; - FX_DWORD mask_blue; + uint32_t mask_red; + uint32_t mask_green; + uint32_t mask_blue; mask_red = 0x7C00; mask_green = 0x03E0; mask_blue = 0x001F; @@ -765,7 +765,7 @@ static void bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, if (bmp_ptr->src_bpp == 32) { i++; } - FX_DWORD pix_val = 0; + uint32_t pix_val = 0; pix_val |= (b >> blue_bits) & mask_blue; pix_val |= (g << green_bits) & mask_green; pix_val |= (r << red_bits) & mask_red; @@ -783,13 +783,13 @@ static void bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, static void bmp_encode_rgb(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, - FX_DWORD& dst_size) { + uint32_t& dst_size) { if (bmp_ptr->info_header.biBitCount == 16) { bmp_encode_bitfields(bmp_ptr, dst_buf, dst_size); return; } - FX_DWORD size, dst_pos; - FX_DWORD dst_pitch = + uint32_t size, dst_pos; + uint32_t dst_pitch = (bmp_ptr->src_width * bmp_ptr->info_header.biBitCount + 31) / 32 * 4; size = dst_pitch * bmp_ptr->src_row; dst_pos = bmp_ptr->file_header.bfOffBits; @@ -820,8 +820,8 @@ static uint8_t bmp_rle8_search(const uint8_t* buf, int32_t len) { } static void bmp_encode_rle8(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, - FX_DWORD& dst_size) { - FX_DWORD size, dst_pos, index; + uint32_t& dst_size) { + uint32_t size, dst_pos, index; uint8_t rle[2] = {0}; size = bmp_ptr->src_pitch * bmp_ptr->src_row * 2; dst_pos = bmp_ptr->file_header.bfOffBits; @@ -868,8 +868,8 @@ static uint8_t bmp_rle4_search(const uint8_t* buf, int32_t len) { } static void bmp_encode_rle4(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, - FX_DWORD& dst_size) { - FX_DWORD size, dst_pos, index; + uint32_t& dst_size) { + uint32_t size, dst_pos, index; uint8_t rle[2] = {0}; size = bmp_ptr->src_pitch * bmp_ptr->src_row; dst_pos = bmp_ptr->file_header.bfOffBits; @@ -907,14 +907,14 @@ static void bmp_encode_rle4(bmp_compress_struct_p bmp_ptr, } FX_BOOL bmp_encode_image(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, - FX_DWORD& dst_size) { - FX_DWORD head_size = sizeof(BmpFileHeader) + sizeof(BmpInfoHeader); - FX_DWORD pal_size = sizeof(FX_DWORD) * bmp_ptr->pal_num; + uint32_t& dst_size) { + uint32_t head_size = sizeof(BmpFileHeader) + sizeof(BmpInfoHeader); + uint32_t pal_size = sizeof(uint32_t) * bmp_ptr->pal_num; if (bmp_ptr->info_header.biClrUsed > 0 && bmp_ptr->info_header.biClrUsed < bmp_ptr->pal_num) { - pal_size = sizeof(FX_DWORD) * bmp_ptr->info_header.biClrUsed; + pal_size = sizeof(uint32_t) * bmp_ptr->info_header.biClrUsed; } - dst_size = head_size + sizeof(FX_DWORD) * bmp_ptr->pal_num; + dst_size = head_size + sizeof(uint32_t) * bmp_ptr->pal_num; dst_buf = FX_TryAlloc(uint8_t, dst_size); if (dst_buf == NULL) { return FALSE; diff --git a/core/fxcodec/lbmp/fx_bmp.h b/core/fxcodec/lbmp/fx_bmp.h index c0baf8693a..870eae478c 100644 --- a/core/fxcodec/lbmp/fx_bmp.h +++ b/core/fxcodec/lbmp/fx_bmp.h @@ -13,7 +13,7 @@ #define BMP_WIDTHBYTES(width, bitCount) ((width * bitCount) + 31) / 32 * 4 #define BMP_PAL_ENCODE(a, r, g, b) \ - (((FX_DWORD)(a) << 24) | ((r) << 16) | ((g) << 8) | (b)) + (((uint32_t)(a) << 24) | ((r) << 16) | ((g) << 8) | (b)) #define BMP_D_STATUS_HEADER 0x01 #define BMP_D_STATUS_PAL 0x02 #define BMP_D_STATUS_DATA_PRE 0x03 @@ -36,30 +36,30 @@ #pragma pack(1) typedef struct tagBmpFileHeader { uint16_t bfType; - FX_DWORD bfSize; + uint32_t bfSize; uint16_t bfReserved1; uint16_t bfReserved2; - FX_DWORD bfOffBits; + uint32_t bfOffBits; } BmpFileHeader, *BmpFileHeaderPtr; typedef struct tagBmpCoreHeader { - FX_DWORD bcSize; + uint32_t bcSize; uint16_t bcWidth; uint16_t bcHeight; uint16_t bcPlanes; uint16_t bcBitCount; } BmpCoreHeader, *BmpCoreHeaderPtr; typedef struct tagBmpInfoHeader { - FX_DWORD biSize; + uint32_t biSize; int32_t biWidth; int32_t biHeight; uint16_t biPlanes; uint16_t biBitCount; - FX_DWORD biCompression; - FX_DWORD biSizeImage; + uint32_t biCompression; + uint32_t biSizeImage; int32_t biXPelsPerMeter; int32_t biYPelsPerMeter; - FX_DWORD biClrUsed; - FX_DWORD biClrImportant; + uint32_t biClrUsed; + uint32_t biClrImportant; } BmpInfoHeader, *BmpInfoHeaderPtr; #pragma pack() @@ -77,36 +77,36 @@ struct tag_bmp_decompress_struct { BmpInfoHeaderPtr bmp_infoheader_ptr; int32_t width; int32_t height; - FX_DWORD compress_flag; + uint32_t compress_flag; int32_t components; int32_t src_row_bytes; int32_t out_row_bytes; uint8_t* out_row_buffer; uint16_t bitCounts; - FX_DWORD color_used; + uint32_t color_used; FX_BOOL imgTB_flag; int32_t pal_num; int32_t pal_type; - FX_DWORD* pal_ptr; - FX_DWORD data_size; - FX_DWORD img_data_offset; - FX_DWORD img_ifh_size; + uint32_t* pal_ptr; + uint32_t data_size; + uint32_t img_data_offset; + uint32_t img_ifh_size; int32_t row_num; int32_t col_num; int32_t dpi_x; int32_t dpi_y; - FX_DWORD mask_red; - FX_DWORD mask_green; - FX_DWORD mask_blue; + uint32_t mask_red; + uint32_t mask_green; + uint32_t mask_blue; FX_BOOL (*bmp_get_data_position_fn)(bmp_decompress_struct_p bmp_ptr, - FX_DWORD cur_pos); + uint32_t cur_pos); void (*bmp_get_row_fn)(bmp_decompress_struct_p bmp_ptr, int32_t row_num, uint8_t* row_buf); uint8_t* next_in; - FX_DWORD avail_in; - FX_DWORD skip_size; + uint32_t avail_in; + uint32_t skip_size; int32_t decode_status; }; void bmp_error(bmp_decompress_struct_p bmp_ptr, const FX_CHAR* err_msg); @@ -119,12 +119,12 @@ int32_t bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr); int32_t bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr); uint8_t* bmp_read_data(bmp_decompress_struct_p bmp_ptr, uint8_t** des_buf_pp, - FX_DWORD data_size); + uint32_t data_size); void bmp_save_decoding_status(bmp_decompress_struct_p bmp_ptr, int32_t status); void bmp_input_buffer(bmp_decompress_struct_p bmp_ptr, uint8_t* src_buf, - FX_DWORD src_size); -FX_DWORD bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr, + uint32_t src_size); +uint32_t bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr, uint8_t** avial_buf_ptr); typedef struct tag_bmp_compress_struct bmp_compress_struct; typedef bmp_compress_struct* bmp_compress_struct_p; @@ -133,12 +133,12 @@ struct tag_bmp_compress_struct { BmpFileHeader file_header; BmpInfoHeader info_header; uint8_t* src_buf; - FX_DWORD src_pitch; - FX_DWORD src_row; + uint32_t src_pitch; + uint32_t src_row; uint8_t src_bpp; - FX_DWORD src_width; + uint32_t src_width; FX_BOOL src_free; - FX_DWORD* pal_ptr; + uint32_t* pal_ptr; uint16_t pal_num; uint8_t bit_type; }; @@ -147,7 +147,7 @@ bmp_compress_struct_p bmp_create_compress(); void bmp_destroy_compress(bmp_compress_struct_p bmp_ptr); FX_BOOL bmp_encode_image(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, - FX_DWORD& dst_size); + uint32_t& dst_size); uint16_t GetWord_LSBFirst(uint8_t* p); void SetWord_LSBFirst(uint8_t* p, uint16_t v); diff --git a/core/fxcodec/lgif/fx_gif.cpp b/core/fxcodec/lgif/fx_gif.cpp index b20b4dfdec..059fa9a70b 100644 --- a/core/fxcodec/lgif/fx_gif.cpp +++ b/core/fxcodec/lgif/fx_gif.cpp @@ -8,11 +8,11 @@ #include "core/fxcodec/lbmp/fx_bmp.h" -void CGifLZWDecoder::Input(uint8_t* src_buf, FX_DWORD src_size) { +void CGifLZWDecoder::Input(uint8_t* src_buf, uint32_t src_size) { next_in = src_buf; avail_in = src_size; } -FX_DWORD CGifLZWDecoder::GetAvailInput() { +uint32_t CGifLZWDecoder::GetAvailInput() { return avail_in; } void CGifLZWDecoder::InitTable(uint8_t code_len) { @@ -62,11 +62,11 @@ void CGifLZWDecoder::AddCode(uint16_t prefix_code, uint8_t append_char) { } } } -int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, FX_DWORD& des_size) { +int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, uint32_t& des_size) { if (des_size == 0) { return 3; } - FX_DWORD i = 0; + uint32_t i = 0; if (stack_size != 0) { if (des_size < stack_size) { FXSYS_memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size], des_size); @@ -145,10 +145,10 @@ int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, FX_DWORD& des_size) { return 0; } static FX_BOOL gif_grow_buf(uint8_t*& dst_buf, - FX_DWORD& dst_len, - FX_DWORD size) { + uint32_t& dst_len, + uint32_t size) { if (dst_len < size) { - FX_DWORD len_org = dst_len; + uint32_t len_org = dst_len; while (dst_buf && dst_len < size) { dst_len <<= 1; dst_buf = FX_Realloc(uint8_t, dst_buf, dst_len); @@ -166,18 +166,18 @@ static FX_BOOL gif_grow_buf(uint8_t*& dst_buf, return TRUE; } static inline void gif_cut_index(uint8_t& val, - FX_DWORD index, + uint32_t index, uint8_t index_bit, uint8_t index_bit_use, uint8_t bit_use) { - FX_DWORD cut = ((1 << (index_bit - index_bit_use)) - 1) << index_bit_use; + uint32_t cut = ((1 << (index_bit - index_bit_use)) - 1) << index_bit_use; val |= ((index & cut) >> index_bit_use) << bit_use; } static inline uint8_t gif_cut_buf(const uint8_t* buf, - FX_DWORD& offset, + uint32_t& offset, uint8_t bit_cut, uint8_t& bit_offset, - FX_DWORD& bit_num) { + uint32_t& bit_num) { if (bit_cut != 8) { uint16_t index = 0; index |= ((1 << bit_cut) - 1) << (7 - bit_offset); @@ -212,7 +212,7 @@ void CGifLZWEncoder::ClearTable() { void CGifLZWEncoder::Start(uint8_t code_len, const uint8_t* src_buf, uint8_t*& dst_buf, - FX_DWORD& offset) { + uint32_t& offset) { code_size = code_len + 1; src_bit_cut = code_size; if (code_len == 0) { @@ -233,8 +233,8 @@ void CGifLZWEncoder::Start(uint8_t code_len, src_bit_offset, src_bit_num); } void CGifLZWEncoder::WriteBlock(uint8_t*& dst_buf, - FX_DWORD& dst_len, - FX_DWORD& offset) { + uint32_t& dst_len, + uint32_t& offset) { if (!gif_grow_buf(dst_buf, dst_len, offset + GIF_DATA_BLOCK + 1)) { longjmp(jmp, 1); } @@ -244,10 +244,10 @@ void CGifLZWEncoder::WriteBlock(uint8_t*& dst_buf, FXSYS_memset(index_buf, 0, GIF_DATA_BLOCK); index_buf_len = 0; } -void CGifLZWEncoder::EncodeString(FX_DWORD index, +void CGifLZWEncoder::EncodeString(uint32_t index, uint8_t*& dst_buf, - FX_DWORD& dst_len, - FX_DWORD& offset) { + uint32_t& dst_len, + uint32_t& offset) { uint8_t index_bit_use; index_bit_use = 0; if (index_buf_len == GIF_DATA_BLOCK) { @@ -302,10 +302,10 @@ void CGifLZWEncoder::EncodeString(FX_DWORD index, } } FX_BOOL CGifLZWEncoder::Encode(const uint8_t* src_buf, - FX_DWORD src_len, + uint32_t src_len, uint8_t*& dst_buf, - FX_DWORD& dst_len, - FX_DWORD& offset) { + uint32_t& dst_len, + uint32_t& offset) { uint8_t suffix; if (setjmp(jmp)) { return FALSE; @@ -333,7 +333,7 @@ FX_BOOL CGifLZWEncoder::Encode(const uint8_t* src_buf, return TRUE; } FX_BOOL CGifLZWEncoder::LookUpInTable(const uint8_t* buf, - FX_DWORD& offset, + uint32_t& offset, uint8_t& bit_offset) { for (uint16_t i = table_cur; i < index_num; i++) { if (code_table[i].prefix == code_table[index_num].prefix && @@ -349,8 +349,8 @@ FX_BOOL CGifLZWEncoder::LookUpInTable(const uint8_t* buf, return FALSE; } void CGifLZWEncoder::Finish(uint8_t*& dst_buf, - FX_DWORD& dst_len, - FX_DWORD& offset) { + uint32_t& dst_len, + uint32_t& offset) { EncodeString(code_table[index_num].prefix, dst_buf, dst_len, offset); EncodeString(code_end, dst_buf, dst_len, offset); bit_offset = 0; @@ -491,7 +491,7 @@ int32_t gif_read_header(gif_decompress_struct_p gif_ptr) { if (gif_ptr == NULL) { return 0; } - FX_DWORD skip_size_org = gif_ptr->skip_size; + uint32_t skip_size_org = gif_ptr->skip_size; ASSERT(sizeof(GifHeader) == 6); GifHeader* gif_header_ptr = NULL; if (gif_read_data(gif_ptr, (uint8_t**)&gif_header_ptr, 6) == NULL) { @@ -600,7 +600,7 @@ int32_t gif_get_frame(gif_decompress_struct_p gif_ptr) { case GIF_D_STATUS_IMG_DATA: { uint8_t* data_size_ptr = NULL; uint8_t* data_ptr = NULL; - FX_DWORD skip_size_org = gif_ptr->skip_size; + uint32_t skip_size_org = gif_ptr->skip_size; if (gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) { return 2; } @@ -640,7 +640,7 @@ void gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr, int32_t gif_decode_extension(gif_decompress_struct_p gif_ptr) { uint8_t* data_size_ptr = NULL; uint8_t* data_ptr = NULL; - FX_DWORD skip_size_org = gif_ptr->skip_size; + uint32_t skip_size_org = gif_ptr->skip_size; switch (gif_ptr->decode_status) { case GIF_D_STATUS_EXT_CE: { if (gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) { @@ -751,7 +751,7 @@ int32_t gif_decode_image_info(gif_decompress_struct_p gif_ptr) { gif_error(gif_ptr, "No Image Header Info"); return 0; } - FX_DWORD skip_size_org = gif_ptr->skip_size; + uint32_t skip_size_org = gif_ptr->skip_size; ASSERT(sizeof(GifImageInfo) == 9); GifImageInfo* gif_img_info_ptr = NULL; if (gif_read_data(gif_ptr, (uint8_t**)&gif_img_info_ptr, 9) == NULL) { @@ -826,9 +826,9 @@ int32_t gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num) { } uint8_t* data_size_ptr = NULL; uint8_t* data_ptr = NULL; - FX_DWORD skip_size_org = gif_ptr->skip_size; + uint32_t skip_size_org = gif_ptr->skip_size; GifImage* gif_image_ptr = gif_ptr->img_ptr_arr_ptr->GetAt(frame_num); - FX_DWORD gif_img_row_bytes = gif_image_ptr->image_info_ptr->width; + uint32_t gif_img_row_bytes = gif_image_ptr->image_info_ptr->width; if (gif_ptr->decode_status == GIF_D_STATUS_TAIL) { if (gif_image_ptr->image_row_buf) { FX_Free(gif_image_ptr->image_row_buf); @@ -991,7 +991,7 @@ void gif_save_decoding_status(gif_decompress_struct_p gif_ptr, int32_t status) { } uint8_t* gif_read_data(gif_decompress_struct_p gif_ptr, uint8_t** des_buf_pp, - FX_DWORD data_size) { + uint32_t data_size) { if (gif_ptr == NULL || gif_ptr->avail_in < gif_ptr->skip_size + data_size) { return NULL; } @@ -1001,12 +1001,12 @@ uint8_t* gif_read_data(gif_decompress_struct_p gif_ptr, } void gif_input_buffer(gif_decompress_struct_p gif_ptr, uint8_t* src_buf, - FX_DWORD src_size) { + uint32_t src_size) { gif_ptr->next_in = src_buf; gif_ptr->avail_in = src_size; gif_ptr->skip_size = 0; } -FX_DWORD gif_get_avail_input(gif_decompress_struct_p gif_ptr, +uint32_t gif_get_avail_input(gif_decompress_struct_p gif_ptr, uint8_t** avial_buf_ptr) { if (avial_buf_ptr) { *avial_buf_ptr = NULL; @@ -1021,7 +1021,7 @@ int32_t gif_get_frame_num(gif_decompress_struct_p gif_ptr) { } static FX_BOOL gif_write_header(gif_compress_struct_p gif_ptr, uint8_t*& dst_buf, - FX_DWORD& dst_len) { + uint32_t& dst_len) { if (gif_ptr->cur_offset) { return TRUE; } @@ -1050,10 +1050,10 @@ static FX_BOOL gif_write_header(gif_compress_struct_p gif_ptr, } return TRUE; } -void interlace_buf(const uint8_t* buf, FX_DWORD pitch, FX_DWORD height) { +void interlace_buf(const uint8_t* buf, uint32_t pitch, uint32_t height) { CFX_ArrayTemplate<uint8_t*> pass[4]; int i, j; - FX_DWORD row; + uint32_t row; row = 0; uint8_t* temp; while (row < height) { @@ -1082,11 +1082,11 @@ void interlace_buf(const uint8_t* buf, FX_DWORD pitch, FX_DWORD height) { } } static void gif_write_block_data(const uint8_t* src_buf, - FX_DWORD src_len, + uint32_t src_len, uint8_t*& dst_buf, - FX_DWORD& dst_len, - FX_DWORD& dst_offset) { - FX_DWORD src_offset = 0; + uint32_t& dst_len, + uint32_t& dst_offset) { + uint32_t src_offset = 0; while (src_len > GIF_DATA_BLOCK) { dst_buf[dst_offset++] = GIF_DATA_BLOCK; FXSYS_memcpy(&dst_buf[dst_offset], &src_buf[src_offset], GIF_DATA_BLOCK); @@ -1100,7 +1100,7 @@ static void gif_write_block_data(const uint8_t* src_buf, } static FX_BOOL gif_write_data(gif_compress_struct_p gif_ptr, uint8_t*& dst_buf, - FX_DWORD& dst_len) { + uint32_t& dst_len) { if (!gif_grow_buf(dst_buf, dst_len, gif_ptr->cur_offset + GIF_DATA_BLOCK)) { return FALSE; } @@ -1134,7 +1134,7 @@ static FX_BOOL gif_write_data(gif_compress_struct_p gif_ptr, GifLF& lf = (GifLF&)gif_ptr->image_info_ptr->local_flag; dst_buf[gif_ptr->cur_offset++] = gif_ptr->image_info_ptr->local_flag; if (gif_ptr->local_pal) { - FX_DWORD pal_size = sizeof(GifPalette) * gif_ptr->lpal_num; + uint32_t pal_size = sizeof(GifPalette) * gif_ptr->lpal_num; if (!gif_grow_buf(dst_buf, dst_len, pal_size + gif_ptr->cur_offset)) { return FALSE; } @@ -1152,7 +1152,7 @@ static FX_BOOL gif_write_data(gif_compress_struct_p gif_ptr, } gif_ptr->img_encoder_ptr->Start(code_bit, gif_ptr->src_buf, dst_buf, gif_ptr->cur_offset); - FX_DWORD i; + uint32_t i; for (i = 0; i < gif_ptr->src_row; i++) { if (!gif_ptr->img_encoder_ptr->Encode( &gif_ptr->src_buf[i * gif_ptr->src_pitch], @@ -1207,11 +1207,11 @@ static FX_BOOL gif_write_data(gif_compress_struct_p gif_ptr, } FX_BOOL gif_encode(gif_compress_struct_p gif_ptr, uint8_t*& dst_buf, - FX_DWORD& dst_len) { + uint32_t& dst_len) { if (!gif_write_header(gif_ptr, dst_buf, dst_len)) { return FALSE; } - FX_DWORD cur_offset = gif_ptr->cur_offset; + uint32_t cur_offset = gif_ptr->cur_offset; FX_BOOL res = TRUE; if (gif_ptr->frames) { gif_ptr->cur_offset--; diff --git a/core/fxcodec/lgif/fx_gif.h b/core/fxcodec/lgif/fx_gif.h index 5ed9ce1fe2..47e5eebab7 100644 --- a/core/fxcodec/lgif/fx_gif.h +++ b/core/fxcodec/lgif/fx_gif.h @@ -103,7 +103,7 @@ typedef struct tagGifImage { GifPalette* local_pal_ptr; GifImageInfo* image_info_ptr; uint8_t image_code_size; - FX_DWORD image_data_pos; + uint32_t image_data_pos; uint8_t* image_row_buf; int32_t image_row_num; } GifImage; @@ -121,10 +121,10 @@ class CGifLZWDecoder { CGifLZWDecoder(FX_CHAR* error_ptr = NULL) { err_msg_ptr = error_ptr; } void InitTable(uint8_t code_len); - int32_t Decode(uint8_t* des_buf, FX_DWORD& des_size); + int32_t Decode(uint8_t* des_buf, uint32_t& des_size); - void Input(uint8_t* src_buf, FX_DWORD src_size); - FX_DWORD GetAvailInput(); + void Input(uint8_t* src_buf, uint32_t src_size); + uint32_t GetAvailInput(); private: void ClearTable(); @@ -142,10 +142,10 @@ class CGifLZWDecoder { uint16_t code_old; uint8_t* next_in; - FX_DWORD avail_in; + uint32_t avail_in; uint8_t bits_left; - FX_DWORD code_store; + uint32_t code_store; FX_CHAR* err_msg_ptr; }; @@ -160,29 +160,29 @@ class CGifLZWEncoder { void Start(uint8_t code_len, const uint8_t* src_buf, uint8_t*& dst_buf, - FX_DWORD& offset); + uint32_t& offset); FX_BOOL Encode(const uint8_t* src_buf, - FX_DWORD src_len, + uint32_t src_len, uint8_t*& dst_buf, - FX_DWORD& dst_len, - FX_DWORD& offset); - void Finish(uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset); + uint32_t& dst_len, + uint32_t& offset); + void Finish(uint8_t*& dst_buf, uint32_t& dst_len, uint32_t& offset); private: void ClearTable(); FX_BOOL LookUpInTable(const uint8_t* buf, - FX_DWORD& offset, + uint32_t& offset, uint8_t& bit_offset); - void EncodeString(FX_DWORD index, + void EncodeString(uint32_t index, uint8_t*& dst_buf, - FX_DWORD& dst_len, - FX_DWORD& offset); - void WriteBlock(uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset); + uint32_t& dst_len, + uint32_t& offset); + void WriteBlock(uint8_t*& dst_buf, uint32_t& dst_len, uint32_t& offset); jmp_buf jmp; - FX_DWORD src_offset; + uint32_t src_offset; uint8_t src_bit_offset; uint8_t src_bit_cut; - FX_DWORD src_bit_num; + uint32_t src_bit_num; uint8_t code_size; uint16_t code_clear; uint16_t code_end; @@ -213,23 +213,23 @@ struct tag_gif_decompress_struct { uint8_t bc_index; uint8_t pixel_aspect; CGifLZWDecoder* img_decoder_ptr; - FX_DWORD img_row_offset; - FX_DWORD img_row_avail_size; + uint32_t img_row_offset; + uint32_t img_row_avail_size; uint8_t img_pass_num; CFX_ArrayTemplate<GifImage*>* img_ptr_arr_ptr; uint8_t* (*gif_ask_buf_for_pal_fn)(gif_decompress_struct_p gif_ptr, int32_t pal_size); uint8_t* next_in; - FX_DWORD avail_in; + uint32_t avail_in; int32_t decode_status; - FX_DWORD skip_size; + uint32_t skip_size; void (*gif_record_current_position_fn)(gif_decompress_struct_p gif_ptr, - FX_DWORD* cur_pos_ptr); + uint32_t* cur_pos_ptr); void (*gif_get_row_fn)(gif_decompress_struct_p gif_ptr, int32_t row_num, uint8_t* row_buf); FX_BOOL (*gif_get_record_position_fn)(gif_decompress_struct_p gif_ptr, - FX_DWORD cur_pos, + uint32_t cur_pos, int32_t left, int32_t top, int32_t width, int32_t height, int32_t pal_num, void* pal_ptr, int32_t delay_time, FX_BOOL user_input, @@ -243,11 +243,11 @@ typedef gif_compress_struct* gif_compress_struct_p; typedef gif_compress_struct_p* gif_compress_struct_pp; struct tag_gif_compress_struct { const uint8_t* src_buf; - FX_DWORD src_pitch; - FX_DWORD src_width; - FX_DWORD src_row; - FX_DWORD cur_offset; - FX_DWORD frames; + uint32_t src_pitch; + uint32_t src_width; + uint32_t src_row; + uint32_t cur_offset; + uint32_t frames; GifHeader* header_ptr; GifLSD* lsd_ptr; GifPalette* global_pal; @@ -258,11 +258,11 @@ struct tag_gif_compress_struct { CGifLZWEncoder* img_encoder_ptr; uint8_t* cmt_data_ptr; - FX_DWORD cmt_data_len; + uint32_t cmt_data_len; GifGCE* gce_ptr; GifPTE* pte_ptr; const uint8_t* pte_data_ptr; - FX_DWORD pte_data_len; + uint32_t pte_data_len; }; void gif_error(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg); @@ -281,16 +281,16 @@ void gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr, int32_t gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num); uint8_t* gif_read_data(gif_decompress_struct_p gif_ptr, uint8_t** des_buf_pp, - FX_DWORD data_size); + uint32_t data_size); void gif_save_decoding_status(gif_decompress_struct_p gif_ptr, int32_t status); void gif_input_buffer(gif_decompress_struct_p gif_ptr, uint8_t* src_buf, - FX_DWORD src_size); -FX_DWORD gif_get_avail_input(gif_decompress_struct_p gif_ptr, + uint32_t src_size); +uint32_t gif_get_avail_input(gif_decompress_struct_p gif_ptr, uint8_t** avial_buf_ptr); -void interlace_buf(const uint8_t* buf, FX_DWORD width, FX_DWORD height); +void interlace_buf(const uint8_t* buf, uint32_t width, uint32_t height); FX_BOOL gif_encode(gif_compress_struct_p gif_ptr, uint8_t*& dst_buf, - FX_DWORD& dst_len); + uint32_t& dst_len); #endif // CORE_FXCODEC_LGIF_FX_GIF_H_ |