From bb17868d736f698d5217c30d52c5bbfed62c5936 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 9 Jun 2015 11:30:25 -0700 Subject: Use stdint.h types throughout PDFium. It's redundant nowadays to provide our own equivalents, now that this is done for us by the system header. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1177483002 --- core/include/fdrm/fx_crypt.h | 20 +- core/include/fpdfapi/fpdf_objects.h | 4 +- core/include/fpdfapi/fpdf_pageobj.h | 2 +- core/include/fpdfapi/fpdf_parser.h | 38 +-- core/include/fpdfapi/fpdf_render.h | 6 +- core/include/fpdfapi/fpdf_resource.h | 22 +- core/include/fpdfapi/fpdf_serial.h | 38 +-- core/include/fpdfdoc/fpdf_ap.h | 28 +- core/include/fpdfdoc/fpdf_doc.h | 24 +- core/include/fpdfdoc/fpdf_vt.h | 74 ++--- core/include/fpdftext/fpdf_text.h | 2 +- core/include/fxcodec/fx_codec.h | 18 +- core/include/fxcrt/fx_arb.h | 2 +- core/include/fxcrt/fx_basic.h | 96 +++--- core/include/fxcrt/fx_coordinates.h | 38 +-- core/include/fxcrt/fx_ext.h | 30 +- core/include/fxcrt/fx_safe_types.h | 2 +- core/include/fxcrt/fx_stream.h | 10 +- core/include/fxcrt/fx_string.h | 8 +- core/include/fxcrt/fx_system.h | 50 ++- core/include/fxge/fpf.h | 18 +- core/include/fxge/fx_dib.h | 74 ++--- core/include/fxge/fx_ge.h | 6 +- core/include/fxge/fx_ge_apple.h | 4 +- core/include/fxge/fx_ge_win32.h | 2 +- core/include/reflow/fpdf_layout.h | 2 +- core/include/reflow/reflowengine.h | 6 +- core/src/fdrm/crypto/fx_crypt.cpp | 28 +- core/src/fdrm/crypto/fx_crypt_sha.cpp | 94 +++--- core/src/fpdfapi/fpdf_edit/editint.h | 14 +- core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp | 2 +- core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp | 180 +++++------ core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 22 +- core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp | 76 ++--- core/src/fpdfapi/fpdf_font/common.h | 6 +- core/src/fpdfapi/fpdf_font/font_int.h | 16 +- core/src/fpdfapi/fpdf_font/fpdf_font.cpp | 34 +-- core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp | 12 +- core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp | 68 ++--- core/src/fpdfapi/fpdf_font/ttgsubtable.cpp | 6 +- core/src/fpdfapi/fpdf_page/fpdf_page.cpp | 16 +- core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp | 38 +-- core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp | 4 +- core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp | 6 +- .../fpdfapi/fpdf_page/fpdf_page_graph_state.cpp | 8 +- core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 2 +- .../src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp | 20 +- core/src/fpdfapi/fpdf_page/pageint.h | 14 +- core/src/fpdfapi/fpdf_parser/filters_int.h | 8 +- .../src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp | 34 +-- .../fpdfapi/fpdf_parser/fpdf_parser_document.cpp | 2 +- .../fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp | 166 +++++----- .../fpdfapi/fpdf_parser/fpdf_parser_filters.cpp | 64 ++-- .../fpdfapi/fpdf_parser/fpdf_parser_objects.cpp | 40 +-- .../src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp | 316 +++++++++---------- .../fpdfapi/fpdf_parser/fpdf_parser_utility.cpp | 6 +- core/src/fpdfapi/fpdf_render/fpdf_render.cpp | 18 +- core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp | 12 +- core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp | 8 +- .../fpdfapi/fpdf_render/fpdf_render_loadimage.cpp | 44 +-- .../fpdfapi/fpdf_render/fpdf_render_pattern.cpp | 20 +- core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp | 10 +- core/src/fpdfapi/fpdf_render/render_int.h | 18 +- core/src/fpdfdoc/doc_action.cpp | 2 +- core/src/fpdfdoc/doc_annot.cpp | 6 +- core/src/fpdfdoc/doc_ap.cpp | 42 +-- core/src/fpdfdoc/doc_basic.cpp | 10 +- core/src/fpdfdoc/doc_form.cpp | 32 +- core/src/fpdfdoc/doc_link.cpp | 4 +- core/src/fpdfdoc/doc_metadata.cpp | 2 +- core/src/fpdfdoc/doc_ocg.cpp | 26 +- core/src/fpdfdoc/doc_utils.cpp | 10 +- core/src/fpdfdoc/doc_utils.h | 4 +- core/src/fpdfdoc/doc_viewerPreferences.cpp | 2 +- core/src/fpdfdoc/doc_vt.cpp | 164 +++++----- core/src/fpdfdoc/pdf_vt.h | 96 +++--- core/src/fpdftext/fpdf_text.cpp | 10 +- core/src/fpdftext/fpdf_text_int.cpp | 78 ++--- core/src/fpdftext/fpdf_text_search.cpp | 4 +- core/src/fpdftext/text_int.h | 14 +- core/src/fxcodec/codec/codec_int.h | 24 +- core/src/fxcodec/codec/fx_codec.cpp | 20 +- core/src/fxcodec/codec/fx_codec_fax.cpp | 48 +-- core/src/fxcodec/codec/fx_codec_flate.cpp | 134 ++++---- core/src/fxcodec/codec/fx_codec_icc.cpp | 44 +-- core/src/fxcodec/codec/fx_codec_jbig.cpp | 4 +- core/src/fxcodec/codec/fx_codec_jpeg.cpp | 24 +- core/src/fxcodec/codec/fx_codec_jpx_opj.cpp | 8 +- core/src/fxcodec/jbig2/JBig2_BitStream.h | 66 ++-- core/src/fxcodec/jbig2/JBig2_Context.cpp | 122 ++++---- core/src/fxcodec/jbig2/JBig2_Context.h | 62 ++-- core/src/fxcodec/jbig2/JBig2_Define.h | 10 +- core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp | 200 ++++++------ core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h | 26 +- core/src/fxcodec/jbig2/JBig2_Image.cpp | 338 ++++++++++----------- core/src/fxcodec/jbig2/JBig2_Image.h | 40 +-- core/src/fxcodec/jbig2/JBig2_List.h | 12 +- core/src/fxcodec/jbig2/JBig2_Module.h | 2 +- core/src/fxcodec/jbig2/JBig2_Object.cpp | 12 +- core/src/fxcodec/jbig2/JBig2_Page.h | 2 +- core/src/fxcodec/jbig2/JBig2_Segment.h | 12 +- core/src/fxcrt/extension.h | 18 +- core/src/fxcrt/fx_arabic.cpp | 6 +- core/src/fxcrt/fx_arabic.h | 16 +- core/src/fxcrt/fx_basic_array.cpp | 10 +- core/src/fxcrt/fx_basic_bstring.cpp | 14 +- core/src/fxcrt/fx_basic_buffer.cpp | 24 +- core/src/fxcrt/fx_basic_coords.cpp | 16 +- core/src/fxcrt/fx_basic_gcc.cpp | 26 +- core/src/fxcrt/fx_basic_maps.cpp | 28 +- core/src/fxcrt/fx_basic_memmgr.cpp | 2 +- core/src/fxcrt/fx_basic_plex.cpp | 4 +- core/src/fxcrt/fx_basic_utf.cpp | 4 +- core/src/fxcrt/fx_basic_util.cpp | 12 +- core/src/fxcrt/fx_basic_wstring.cpp | 6 +- core/src/fxcrt/fx_extension.cpp | 30 +- core/src/fxcrt/fx_unicode.cpp | 2 +- core/src/fxcrt/fx_xml_composer.cpp | 2 +- core/src/fxcrt/fx_xml_parser.cpp | 48 +-- core/src/fxcrt/fxcrt_platforms.cpp | 2 +- core/src/fxcrt/fxcrt_posix.cpp | 6 +- core/src/fxcrt/fxcrt_posix.h | 2 +- core/src/fxcrt/xml_int.h | 2 +- core/src/fxge/agg/agg23/fx_agg_driver.cpp | 54 ++-- core/src/fxge/android/fpf_skiafont.cpp | 20 +- core/src/fxge/android/fpf_skiafont.h | 20 +- core/src/fxge/android/fpf_skiafontmgr.cpp | 56 ++-- core/src/fxge/android/fpf_skiafontmgr.h | 24 +- core/src/fxge/apple/apple_int.h | 26 +- core/src/fxge/apple/fx_quartz_device.cpp | 44 +-- core/src/fxge/dib/fx_dib_composite.cpp | 328 ++++++++++---------- core/src/fxge/dib/fx_dib_convert.cpp | 66 ++-- core/src/fxge/dib/fx_dib_engine.cpp | 86 +++--- core/src/fxge/dib/fx_dib_main.cpp | 62 ++-- core/src/fxge/dib/fx_dib_transform.cpp | 64 ++-- core/src/fxge/ge/fx_ge.cpp | 2 +- core/src/fxge/ge/fx_ge_device.cpp | 2 +- core/src/fxge/ge/fx_ge_font.cpp | 4 +- core/src/fxge/ge/fx_ge_fontmap.cpp | 30 +- core/src/fxge/ge/fx_ge_linux.cpp | 28 +- core/src/fxge/ge/fx_ge_ps.cpp | 6 +- core/src/fxge/ge/fx_ge_text.cpp | 54 ++-- core/src/fxge/ge/text_int.h | 2 +- core/src/fxge/skia/fx_skia_blitter_new.cpp | 200 ++++++------ core/src/fxge/skia/fx_skia_blitter_new.h | 68 ++--- core/src/fxge/win32/fx_win32_device.cpp | 18 +- core/src/fxge/win32/fx_win32_dib.cpp | 6 +- core/src/fxge/win32/fx_win32_dwrite.cpp | 2 +- core/src/fxge/win32/fx_win32_gdipext.cpp | 6 +- core/src/fxge/win32/fx_win32_print.cpp | 2 +- core/src/fxge/win32/win32_int.h | 2 +- core/src/reflow/autoreflow.cpp | 2 +- core/src/reflow/autoreflow.h | 2 +- core/src/reflow/layoutprocessor_reflow.cpp | 22 +- core/src/reflow/reflowedpage.cpp | 16 +- core/src/reflow/reflowedpage.h | 10 +- core/src/reflow/reflowedtextpage.h | 2 +- fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h | 4 +- fpdfsdk/include/formfiller/FFL_IFormFiller.h | 6 +- fpdfsdk/include/formfiller/FFL_Notify.h | 2 +- fpdfsdk/include/fsdk_baseannot.h | 16 +- fpdfsdk/include/fsdk_baseform.h | 14 +- fpdfsdk/include/fx_systemhandler.h | 28 +- fpdfsdk/include/fxedit/fx_edit.h | 86 +++--- fpdfsdk/include/fxedit/fxet_edit.h | 122 ++++---- fpdfsdk/include/fxedit/fxet_list.h | 90 +++--- fpdfsdk/include/javascript/Field.h | 4 +- fpdfsdk/include/javascript/IJavaScript.h | 2 +- fpdfsdk/include/javascript/JS_Define.h | 2 +- fpdfsdk/include/javascript/JS_GlobalData.h | 6 +- fpdfsdk/include/javascript/util.h | 2 +- fpdfsdk/include/pdfwindow/PWL_Caret.h | 2 +- fpdfsdk/include/pdfwindow/PWL_ComboBox.h | 14 +- fpdfsdk/include/pdfwindow/PWL_Edit.h | 14 +- fpdfsdk/include/pdfwindow/PWL_EditCtrl.h | 34 +-- fpdfsdk/include/pdfwindow/PWL_FontMap.h | 46 +-- fpdfsdk/include/pdfwindow/PWL_Icon.h | 2 +- fpdfsdk/include/pdfwindow/PWL_IconList.h | 50 +-- fpdfsdk/include/pdfwindow/PWL_Label.h | 6 +- fpdfsdk/include/pdfwindow/PWL_ListBox.h | 22 +- fpdfsdk/include/pdfwindow/PWL_ListCtrl.h | 6 +- fpdfsdk/include/pdfwindow/PWL_Note.h | 36 +-- fpdfsdk/include/pdfwindow/PWL_ScrollBar.h | 2 +- fpdfsdk/include/pdfwindow/PWL_Utils.h | 36 +-- fpdfsdk/include/pdfwindow/PWL_Wnd.h | 56 ++-- fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp | 12 +- fpdfsdk/src/formfiller/FFL_CheckBox.cpp | 2 +- fpdfsdk/src/formfiller/FFL_ComboBox.cpp | 8 +- fpdfsdk/src/formfiller/FFL_FormFiller.cpp | 6 +- fpdfsdk/src/formfiller/FFL_IFormFiller.cpp | 6 +- fpdfsdk/src/formfiller/FFL_ListBox.cpp | 16 +- fpdfsdk/src/formfiller/FFL_Notify.cpp | 2 +- fpdfsdk/src/formfiller/FFL_RadioButton.cpp | 2 +- fpdfsdk/src/formfiller/FFL_TextField.cpp | 2 +- fpdfsdk/src/formfiller/FFL_Utils.cpp | 2 +- fpdfsdk/src/fpdfppo.cpp | 2 +- fpdfsdk/src/fpdfview.cpp | 6 +- fpdfsdk/src/fsdk_actionhandler.cpp | 12 +- fpdfsdk/src/fsdk_baseannot.cpp | 52 ++-- fpdfsdk/src/fsdk_baseform.cpp | 46 +-- fpdfsdk/src/fsdk_mgr.cpp | 38 +-- fpdfsdk/src/fxedit/fxet_ap.cpp | 8 +- fpdfsdk/src/fxedit/fxet_edit.cpp | 108 +++---- fpdfsdk/src/fxedit/fxet_list.cpp | 122 ++++---- fpdfsdk/src/fxedit/fxet_pageobjs.cpp | 36 +-- fpdfsdk/src/javascript/Document.cpp | 2 +- fpdfsdk/src/javascript/Field.cpp | 56 ++-- fpdfsdk/src/javascript/JS_GlobalData.cpp | 12 +- fpdfsdk/src/javascript/util.cpp | 4 +- fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp | 12 +- fpdfsdk/src/pdfwindow/PWL_Edit.cpp | 48 +-- fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp | 30 +- fpdfsdk/src/pdfwindow/PWL_FontMap.cpp | 64 ++-- fpdfsdk/src/pdfwindow/PWL_Icon.cpp | 4 +- fpdfsdk/src/pdfwindow/PWL_IconList.cpp | 64 ++-- fpdfsdk/src/pdfwindow/PWL_Label.cpp | 6 +- fpdfsdk/src/pdfwindow/PWL_ListBox.cpp | 32 +- fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp | 22 +- fpdfsdk/src/pdfwindow/PWL_Note.cpp | 72 ++--- fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp | 14 +- fpdfsdk/src/pdfwindow/PWL_Signature.cpp | 4 +- fpdfsdk/src/pdfwindow/PWL_Utils.cpp | 86 +++--- fpdfsdk/src/pdfwindow/PWL_Wnd.cpp | 72 ++--- public/fpdf_edit.h | 12 +- 224 files changed, 3596 insertions(+), 3606 deletions(-) diff --git a/core/include/fdrm/fx_crypt.h b/core/include/fdrm/fx_crypt.h index 7bd69defdf..8b0ce2f703 100644 --- a/core/include/fdrm/fx_crypt.h +++ b/core/include/fdrm/fx_crypt.h @@ -20,26 +20,26 @@ void CRYPT_AESSetKey(FX_LPVOID context, FX_DWORD blocklen, FX_LPCBYTE key, FX_DW void CRYPT_AESSetIV(FX_LPVOID context, FX_LPCBYTE iv); void CRYPT_AESDecrypt(FX_LPVOID context, FX_LPBYTE dest, FX_LPCBYTE src, FX_DWORD size); void CRYPT_AESEncrypt(FX_LPVOID context, FX_LPBYTE dest, FX_LPCBYTE src, FX_DWORD size); -void CRYPT_MD5Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[16]); +void CRYPT_MD5Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[16]); void CRYPT_MD5Start(FX_LPVOID context); void CRYPT_MD5Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size); -void CRYPT_MD5Finish(FX_LPVOID context, FX_BYTE digest[16]); -void CRYPT_SHA1Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[20]); +void CRYPT_MD5Finish(FX_LPVOID context, uint8_t digest[16]); +void CRYPT_SHA1Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[20]); void CRYPT_SHA1Start(FX_LPVOID context); void CRYPT_SHA1Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size); -void CRYPT_SHA1Finish(FX_LPVOID context, FX_BYTE digest[20]); -void CRYPT_SHA256Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[32]); +void CRYPT_SHA1Finish(FX_LPVOID context, uint8_t digest[20]); +void CRYPT_SHA256Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[32]); void CRYPT_SHA256Start(FX_LPVOID context); void CRYPT_SHA256Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size); -void CRYPT_SHA256Finish(FX_LPVOID context, FX_BYTE digest[32]); +void CRYPT_SHA256Finish(FX_LPVOID context, uint8_t digest[32]); void CRYPT_SHA384Start(FX_LPVOID context); void CRYPT_SHA384Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size); -void CRYPT_SHA384Finish(FX_LPVOID context, FX_BYTE digest[48]); -void CRYPT_SHA384Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[48]); +void CRYPT_SHA384Finish(FX_LPVOID context, uint8_t digest[48]); +void CRYPT_SHA384Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[48]); void CRYPT_SHA512Start(FX_LPVOID context); void CRYPT_SHA512Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size); -void CRYPT_SHA512Finish(FX_LPVOID context, FX_BYTE digest[64]); -void CRYPT_SHA512Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[64]); +void CRYPT_SHA512Finish(FX_LPVOID context, uint8_t digest[64]); +void CRYPT_SHA512Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[64]); void CRYPT_SetPubKeyDecryptor(FX_BOOL (*func)(FX_LPCBYTE pData, FX_DWORD size, FX_LPBYTE data_buf, FX_DWORD& data_len)); #ifdef __cplusplus diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h index 0ad641a1e4..d0c76c5b0d 100644 --- a/core/include/fpdfapi/fpdf_objects.h +++ b/core/include/fpdfapi/fpdf_objects.h @@ -520,7 +520,7 @@ public: void SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed, FX_BOOL bKeepBuf); - void InitStream(FX_BYTE* pData, FX_DWORD size, CPDF_Dictionary* pDict); + void InitStream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict); void InitStream(IFX_FileRead *pFile, CPDF_Dictionary* pDict); @@ -657,7 +657,7 @@ protected: FX_DWORD m_SrcOffset; - FX_BYTE m_SrcBuffer[FPDF_FILTER_BUFFER_SIZE]; + uint8_t m_SrcBuffer[FPDF_FILTER_BUFFER_SIZE]; friend class CPDF_Stream; }; class CPDF_Null : public CPDF_Object diff --git a/core/include/fpdfapi/fpdf_pageobj.h b/core/include/fpdfapi/fpdf_pageobj.h index 1b53bdc859..e09c0456fe 100644 --- a/core/include/fpdfapi/fpdf_pageobj.h +++ b/core/include/fpdfapi/fpdf_pageobj.h @@ -114,7 +114,7 @@ public: CPDF_Path* m_pPathList; - FX_BYTE* m_pTypeList; + uint8_t* m_pTypeList; int m_TextCount; diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h index d18d362ec0..f0e3e2ca08 100644 --- a/core/include/fpdfapi/fpdf_parser.h +++ b/core/include/fpdfapi/fpdf_parser.h @@ -269,7 +269,7 @@ public: CFX_ByteString GetKeyword(); - void GetBinary(FX_BYTE* buffer, FX_DWORD size); + void GetBinary(uint8_t* buffer, FX_DWORD size); void ToNextLine(); @@ -291,18 +291,18 @@ public: return m_pCryptoHandler != NULL; } - FX_BOOL GetCharAt(FX_FILESIZE pos, FX_BYTE& ch); + FX_BOOL GetCharAt(FX_FILESIZE pos, uint8_t& ch); - FX_BOOL ReadBlock(FX_BYTE* pBuf, FX_DWORD size); + FX_BOOL ReadBlock(uint8_t* pBuf, FX_DWORD size); CFX_ByteString GetNextWord(FX_BOOL& bIsNumber); protected: static const int kParserMaxRecursionDepth = 64; static int s_CurrentRecursionDepth; - virtual FX_BOOL GetNextChar(FX_BYTE& ch); + virtual FX_BOOL GetNextChar(uint8_t& ch); - FX_BOOL GetCharAtBackward(FX_FILESIZE pos, FX_BYTE& ch); + FX_BOOL GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch); void GetNextWord(); @@ -326,7 +326,7 @@ protected: FX_FILESIZE m_FileLen; - FX_BYTE* m_pFileBuf; + uint8_t* m_pFileBuf; FX_DWORD m_BufSize; @@ -334,7 +334,7 @@ protected: CPDF_CryptoHandler* m_pCryptoHandler; - FX_BYTE m_WordBuffer[257]; + uint8_t m_WordBuffer[257]; FX_DWORD m_WordSize; @@ -458,7 +458,7 @@ public: return m_ObjVersion[objnum]; } - void GetIndirectBinary(FX_DWORD objnum, FX_BYTE*& pBuffer, FX_DWORD& size); + void GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD& size); FX_BOOL GetFileStreamOption() { @@ -635,7 +635,7 @@ public: FX_LPCBYTE user_pass, FX_DWORD user_size, FX_DWORD type = PDF_ENCRYPT_CONTENT); CFX_ByteString GetUserPassword(FX_LPCBYTE owner_pass, FX_DWORD pass_size); - CFX_ByteString GetUserPassword(FX_LPCBYTE owner_pass, FX_DWORD pass_size, FX_INT32 key_len); + CFX_ByteString GetUserPassword(FX_LPCBYTE owner_pass, FX_DWORD pass_size, int32_t key_len); int GetVersion() { return m_Version; @@ -661,16 +661,16 @@ private: FX_BOOL LoadDict(CPDF_Dictionary* pEncryptDict, FX_DWORD type, int& cipher, int& key_len); FX_BOOL CheckUserPassword(FX_LPCBYTE password, FX_DWORD pass_size, - FX_BOOL bIgnoreEncryptMeta, FX_LPBYTE key, FX_INT32 key_len); + FX_BOOL bIgnoreEncryptMeta, FX_LPBYTE key, int32_t key_len); - FX_BOOL CheckOwnerPassword(FX_LPCBYTE password, FX_DWORD pass_size, FX_LPBYTE key, FX_INT32 key_len); + FX_BOOL CheckOwnerPassword(FX_LPCBYTE password, FX_DWORD pass_size, FX_LPBYTE key, int32_t key_len); FX_BOOL AES256_CheckPassword(FX_LPCBYTE password, FX_DWORD size, FX_BOOL bOwner, FX_LPBYTE key); void AES256_SetPassword(CPDF_Dictionary* pEncryptDict, FX_LPCBYTE password, FX_DWORD size, FX_BOOL bOwner, FX_LPCBYTE key); void AES256_SetPerms(CPDF_Dictionary* pEncryptDict, FX_DWORD permission, FX_BOOL bEncryptMetadata, FX_LPCBYTE key); void OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, FX_LPCBYTE user_pass, FX_DWORD user_size, FX_LPCBYTE owner_pass, FX_DWORD owner_size, FX_BOOL bDefault, FX_DWORD type); - FX_BOOL CheckSecurity(FX_INT32 key_len); + FX_BOOL CheckSecurity(int32_t key_len); FX_BOOL m_bOwner; @@ -678,7 +678,7 @@ private: int m_Cipher; - FX_BYTE m_EncryptKey[32]; + uint8_t m_EncryptKey[32]; int m_KeyLen; }; @@ -731,7 +731,7 @@ protected: virtual FX_BOOL CryptStream(FX_LPVOID context, FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt); virtual FX_BOOL CryptFinish(FX_LPVOID context, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt); - FX_BYTE m_EncryptKey[32]; + uint8_t m_EncryptKey[32]; int m_KeyLen; @@ -798,9 +798,9 @@ protected: CFX_WideString FPDF_FileSpec_GetWin32Path(const CPDF_Object* pFileSpec); void FPDF_FileSpec_SetWin32Path(CPDF_Object* pFileSpec, const CFX_WideString& fullpath); -void FlateEncode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); -FX_DWORD FlateDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); -FX_DWORD RunLengthDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); +void FlateEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); +FX_DWORD FlateDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); +FX_DWORD RunLengthDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); class CPDF_NumberTree { public: @@ -847,8 +847,8 @@ public: virtual void SetDocument(CPDF_Document* pDoc) = 0; virtual FX_BOOL IsPageAvail(int iPage, IFX_DownloadHints* pHints) = 0; virtual FX_BOOL IsLinearized() = 0; - virtual FX_INT32 IsFormAvail(IFX_DownloadHints *pHints) = 0; - virtual FX_INT32 IsLinearizedPDF() = 0; + virtual int32_t IsFormAvail(IFX_DownloadHints *pHints) = 0; + virtual int32_t IsLinearizedPDF() = 0; virtual void GetLinearizedMainXRefInfo(FX_FILESIZE *pPos, FX_DWORD *pSize) = 0; protected: diff --git a/core/include/fpdfapi/fpdf_render.h b/core/include/fpdfapi/fpdf_render.h index 47d1b19920..2f03ae5bb7 100644 --- a/core/include/fpdfapi/fpdf_render.h +++ b/core/include/fpdfapi/fpdf_render.h @@ -241,7 +241,7 @@ public: void ClearImageData(); FX_DWORD EstimateSize(); - void CacheOptimization(FX_INT32 dwLimitCacheSize); + void CacheOptimization(int32_t dwLimitCacheSize); FX_DWORD GetCachedSize(CPDF_Stream* pStream) const; FX_DWORD GetTimeCount() const { @@ -254,7 +254,7 @@ public: void GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, FX_DWORD& MatteColor, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = NULL, FX_INT32 downsampleWidth = 0, FX_INT32 downsampleHeight = 0); + CPDF_RenderStatus* pRenderStatus = NULL, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); void ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap); void ClearImageCache(CPDF_Stream* pStream); @@ -266,7 +266,7 @@ public: public: FX_BOOL StartGetCachedBitmap(CPDF_Stream* pStream, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, - FX_INT32 downsampleWidth = 0, FX_INT32 downsampleHeight = 0); + int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); FX_BOOL Continue(IFX_Pause* pPause); CPDF_ImageCache* m_pCurImageCache; diff --git a/core/include/fpdfapi/fpdf_resource.h b/core/include/fpdfapi/fpdf_resource.h index f1ea6b5a23..06dcdfec44 100644 --- a/core/include/fpdfapi/fpdf_resource.h +++ b/core/include/fpdfapi/fpdf_resource.h @@ -160,7 +160,7 @@ public: if (offset < 0 || nStrLen < 1) { return 0; } - FX_BYTE ch = offset < nStrLen ? pString[offset++] : pString[nStrLen-1]; + uint8_t ch = offset < nStrLen ? pString[offset++] : pString[nStrLen-1]; return static_cast(ch); } @@ -326,14 +326,14 @@ public: FX_BOOL IsIdentical(CPDF_FontEncoding* pAnother) const; - FX_WCHAR UnicodeFromCharCode(FX_BYTE charcode) const + FX_WCHAR UnicodeFromCharCode(uint8_t charcode) const { return m_Unicodes[charcode]; } int CharCodeFromUnicode(FX_WCHAR unicode) const; - void SetUnicode(FX_BYTE charcode, FX_WCHAR unicode) + void SetUnicode(uint8_t charcode, FX_WCHAR unicode) { m_Unicodes[charcode] = unicode; } @@ -368,7 +368,7 @@ protected: virtual void LoadGlyphMap() = 0; virtual FX_WCHAR _UnicodeFromCharCode(FX_DWORD charcode) const { - return m_Encoding.UnicodeFromCharCode((FX_BYTE)charcode); + return m_Encoding.UnicodeFromCharCode((uint8_t)charcode); } virtual FX_DWORD _CharCodeFromUnicode(FX_WCHAR Unicode) const { @@ -831,7 +831,7 @@ public: { } FX_ARGB* pMatteColor; - FX_INT32 nQuality; + int32_t nQuality; }; class CPDF_Image { @@ -884,12 +884,12 @@ public: - FX_INT32 GetPixelHeight() const + int32_t GetPixelHeight() const { return m_Height; } - FX_INT32 GetPixelWidth() const + int32_t GetPixelWidth() const { return m_Width; } @@ -909,9 +909,9 @@ public: - void SetImage(const CFX_DIBitmap* pDIBitmap, FX_INT32 iCompress, IFX_FileWrite *pFileWrite = NULL, IFX_FileRead *pFileRead = NULL, const CFX_DIBitmap* pMask = NULL, const CPDF_ImageSetParam* pParam = NULL); + void SetImage(const CFX_DIBitmap* pDIBitmap, int32_t iCompress, IFX_FileWrite *pFileWrite = NULL, IFX_FileRead *pFileRead = NULL, const CFX_DIBitmap* pMask = NULL, const CPDF_ImageSetParam* pParam = NULL); - void SetJpegImage(FX_BYTE* pImageData, FX_DWORD size); + void SetJpegImage(uint8_t* pImageData, FX_DWORD size); void SetJpegImage(IFX_FileRead *pFile); @@ -931,9 +931,9 @@ private: FX_BOOL m_bInline; CPDF_Dictionary* m_pInlineDict; - FX_INT32 m_Height; + int32_t m_Height; - FX_INT32 m_Width; + int32_t m_Width; FX_BOOL m_bIsMask; diff --git a/core/include/fpdfapi/fpdf_serial.h b/core/include/fpdfapi/fpdf_serial.h index fc55fa08a9..e4a0aec2e5 100644 --- a/core/include/fpdfapi/fpdf_serial.h +++ b/core/include/fpdfapi/fpdf_serial.h @@ -127,9 +127,9 @@ public: FX_BOOL Create(IFX_StreamWrite* pFile, FX_DWORD flags = 0); - FX_INT32 Continue(IFX_Pause *pPause = NULL); + int32_t Continue(IFX_Pause *pPause = NULL); - FX_BOOL SetFileVersion(FX_INT32 fileVersion = 17); + FX_BOOL SetFileVersion(int32_t fileVersion = 17); protected: CPDF_Document* m_pDocument; @@ -155,16 +155,16 @@ protected: CPDF_XRefStream* m_pXRefStream; - FX_INT32 m_ObjectStreamSize; + int32_t m_ObjectStreamSize; FX_DWORD m_dwLastObjNum; FX_BOOL Create(FX_DWORD flags); void ResetStandardSecurity(); void Clear(); - FX_INT32 WriteDoc_Stage1(IFX_Pause *pPause); - FX_INT32 WriteDoc_Stage2(IFX_Pause *pPause); - FX_INT32 WriteDoc_Stage3(IFX_Pause *pPause); - FX_INT32 WriteDoc_Stage4(IFX_Pause *pPause); + int32_t WriteDoc_Stage1(IFX_Pause *pPause); + int32_t WriteDoc_Stage2(IFX_Pause *pPause); + int32_t WriteDoc_Stage3(IFX_Pause *pPause); + int32_t WriteDoc_Stage4(IFX_Pause *pPause); CFX_FileBufferArchive m_File; @@ -172,19 +172,19 @@ protected: void InitOldObjNumOffsets(); void InitNewObjNumOffsets(); void AppendNewObjNum(FX_DWORD objbum); - FX_INT32 WriteOldIndirectObject(FX_DWORD objnum); - FX_INT32 WriteOldObjs(IFX_Pause *pPause); - FX_INT32 WriteNewObjs(FX_BOOL bIncremental, IFX_Pause *pPause); - FX_INT32 WriteIndirectObj(const CPDF_Object* pObj); - FX_INT32 WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, FX_BOOL bEncrypt = TRUE); - FX_INT32 WriteIndirectObjectToStream(const CPDF_Object* pObj); - FX_INT32 WriteIndirectObj(FX_DWORD objnum, const CPDF_Object* pObj); - FX_INT32 WriteIndirectObjectToStream(FX_DWORD objnum, FX_LPCBYTE pBuffer, FX_DWORD dwSize); - FX_INT32 AppendObjectNumberToXRef(FX_DWORD objnum); + int32_t WriteOldIndirectObject(FX_DWORD objnum); + int32_t WriteOldObjs(IFX_Pause *pPause); + int32_t WriteNewObjs(FX_BOOL bIncremental, IFX_Pause *pPause); + int32_t WriteIndirectObj(const CPDF_Object* pObj); + int32_t WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, FX_BOOL bEncrypt = TRUE); + int32_t WriteIndirectObjectToStream(const CPDF_Object* pObj); + int32_t WriteIndirectObj(FX_DWORD objnum, const CPDF_Object* pObj); + int32_t WriteIndirectObjectToStream(FX_DWORD objnum, FX_LPCBYTE pBuffer, FX_DWORD dwSize); + int32_t AppendObjectNumberToXRef(FX_DWORD objnum); void InitID(FX_BOOL bDefault = TRUE); - FX_INT32 WriteStream(const CPDF_Object* pStream, FX_DWORD objnum, CPDF_CryptoHandler* pCrypto); + int32_t WriteStream(const CPDF_Object* pStream, FX_DWORD objnum, CPDF_CryptoHandler* pCrypto); - FX_INT32 m_iStage; + int32_t m_iStage; FX_DWORD m_dwFlags; FX_POSITION m_Pos; FX_FILESIZE m_XrefStart; @@ -196,7 +196,7 @@ protected: CPDF_Array* m_pIDArray; - FX_INT32 m_FileVersion; + int32_t m_FileVersion; friend class CPDF_ObjectStream; friend class CPDF_XRefStream; }; diff --git a/core/include/fpdfdoc/fpdf_ap.h b/core/include/fpdfdoc/fpdf_ap.h index 39daf028ac..1d30ebbb0a 100644 --- a/core/include/fpdfdoc/fpdf_ap.h +++ b/core/include/fpdfdoc/fpdf_ap.h @@ -15,19 +15,19 @@ class IPVT_FontMap { public: virtual ~IPVT_FontMap() { } - virtual CPDF_Font* GetPDFFont(FX_INT32 nFontIndex) = 0; - virtual CFX_ByteString GetPDFFontAlias(FX_INT32 nFontIndex) = 0; + virtual CPDF_Font* GetPDFFont(int32_t nFontIndex) = 0; + virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) = 0; }; struct CPVT_Dash { - CPVT_Dash(FX_INT32 dash, FX_INT32 gap, FX_INT32 phase) : nDash(dash), nGap(gap), nPhase(phase) + CPVT_Dash(int32_t dash, int32_t gap, int32_t phase) : nDash(dash), nGap(gap), nPhase(phase) {} - FX_INT32 nDash; + int32_t nDash; - FX_INT32 nGap; + int32_t nGap; - FX_INT32 nPhase; + int32_t nPhase; }; #define CT_TRANSPARENT 0 #define CT_GRAY 1 @@ -35,11 +35,11 @@ struct CPVT_Dash { #define CT_CMYK 3 struct CPVT_Color { - CPVT_Color(FX_INT32 type = 0, FX_FLOAT color1 = 0.0f, FX_FLOAT color2 = 0.0f, FX_FLOAT color3 = 0.0f, FX_FLOAT color4 = 0.0f) + CPVT_Color(int32_t type = 0, FX_FLOAT color1 = 0.0f, FX_FLOAT color2 = 0.0f, FX_FLOAT color3 = 0.0f, FX_FLOAT color4 = 0.0f) : nColorType(type), fColor1(color1), fColor2(color2), fColor3(color3), fColor4(color4) {} - FX_INT32 nColorType; + int32_t nColorType; FX_FLOAT fColor1; FX_FLOAT fColor2; FX_FLOAT fColor3; @@ -53,17 +53,17 @@ public: virtual ~CPVT_Provider(); - FX_INT32 GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_INT32 nWordStyle); + int32_t GetCharWidth(int32_t nFontIndex, FX_WORD word, int32_t nWordStyle); - FX_INT32 GetTypeAscent(FX_INT32 nFontIndex); + int32_t GetTypeAscent(int32_t nFontIndex); - FX_INT32 GetTypeDescent(FX_INT32 nFontIndex); + int32_t GetTypeDescent(int32_t nFontIndex); - FX_INT32 GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex); + int32_t GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex); FX_BOOL IsLatinWord(FX_WORD word); - FX_INT32 GetDefaultFontIndex(); + int32_t GetDefaultFontIndex(); private: IPVT_FontMap * m_pFontMap; @@ -88,7 +88,7 @@ public: static CFX_ByteString GenerateBorderAP(const CPDF_Rect & rect, FX_FLOAT fWidth, const CPVT_Color & color, const CPVT_Color & crLeftTop, const CPVT_Color & crRightBottom, - FX_INT32 nStyle, const CPVT_Dash & dash); + int32_t nStyle, const CPVT_Dash & dash); static CFX_ByteString GenerateColorAP(const CPVT_Color & color, const FX_BOOL & bFillOrStroke); }; diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h index 45cdebc94a..13fd41f432 100644 --- a/core/include/fpdfdoc/fpdf_doc.h +++ b/core/include/fpdfdoc/fpdf_doc.h @@ -331,7 +331,7 @@ public: CPDF_Dictionary* GetAnnot() const; - FX_INT32 GetOperationType() const; + int32_t GetOperationType() const; CPDF_Stream* GetSoundStream() const { @@ -733,19 +733,19 @@ public: static CPDF_Font* AddSystemDefaultFont(const CPDF_Document* pDocument); - static CPDF_Font* AddSystemFont(const CPDF_Document* pDocument, CFX_ByteString csFontName, FX_BYTE iCharSet = 1); + static CPDF_Font* AddSystemFont(const CPDF_Document* pDocument, CFX_ByteString csFontName, uint8_t iCharSet = 1); - static CPDF_Font* AddSystemFont(const CPDF_Document* pDocument, CFX_WideString csFontName, FX_BYTE iCharSet = 1); + static CPDF_Font* AddSystemFont(const CPDF_Document* pDocument, CFX_WideString csFontName, uint8_t iCharSet = 1); static CPDF_Font* AddStandardFont(const CPDF_Document* pDocument, CFX_ByteString csFontName); - static CFX_ByteString GetNativeFont(FX_BYTE iCharSet, FX_LPVOID pLogFont = NULL); + static CFX_ByteString GetNativeFont(uint8_t iCharSet, FX_LPVOID pLogFont = NULL); static CFX_ByteString GetNativeFont(FX_LPVOID pLogFont = NULL); - static FX_BYTE GetNativeCharSet(); + static uint8_t GetNativeCharSet(); - static CPDF_Font* AddNativeFont(FX_BYTE iCharSet, const CPDF_Document* pDocument); + static CPDF_Font* AddNativeFont(uint8_t iCharSet, const CPDF_Document* pDocument); static CPDF_Font* AddNativeFont(const CPDF_Document* pDocument); @@ -837,7 +837,7 @@ public: CPDF_Font* GetFormFont(CFX_ByteString csFontName, CFX_ByteString& csNameTag); - CPDF_Font* GetNativeFormFont(FX_BYTE iCharSet, CFX_ByteString& csNameTag); + CPDF_Font* GetNativeFormFont(uint8_t iCharSet, CFX_ByteString& csNameTag); CPDF_Font* GetNativeFormFont(CFX_ByteString& csNameTag); @@ -856,7 +856,7 @@ public: void AddFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameTag); - CPDF_Font* AddNativeFormFont(FX_BYTE iCharSet, CFX_ByteString& csNameTag); + CPDF_Font* AddNativeFormFont(uint8_t iCharSet, CFX_ByteString& csNameTag); CPDF_Font* AddNativeFormFont(CFX_ByteString& csNameTag); @@ -1516,10 +1516,10 @@ public: CFX_WideString GetLabel(int nPage) const; - FX_INT32 GetPageByLabel(FX_BSTR bsLabel) const; + int32_t GetPageByLabel(FX_BSTR bsLabel) const; - FX_INT32 GetPageByLabel(FX_WSTR wsLabel) const; + int32_t GetPageByLabel(FX_WSTR wsLabel) const; protected: CPDF_Document* m_pDocument; @@ -1536,7 +1536,7 @@ public: void LoadDoc(CPDF_Document *pDoc); - FX_INT32 GetString(FX_BSTR bsItem, CFX_WideString &wsStr); + int32_t GetString(FX_BSTR bsItem, CFX_WideString &wsStr); CXML_Element* GetRoot() const; @@ -1559,7 +1559,7 @@ public: FX_BOOL PrintScaling() const; - FX_INT32 NumCopies() const; + int32_t NumCopies() const; CPDF_Array* PrintPageRange() const; diff --git a/core/include/fpdfdoc/fpdf_vt.h b/core/include/fpdfdoc/fpdf_vt.h index 87ef02576b..fbfeacb755 100644 --- a/core/include/fpdfdoc/fpdf_vt.h +++ b/core/include/fpdfdoc/fpdf_vt.h @@ -26,7 +26,7 @@ struct CPVT_WordPlace { { } - CPVT_WordPlace(FX_INT32 nSecIndex, FX_INT32 nLineIndex, FX_INT32 nWordIndex) + CPVT_WordPlace(int32_t nSecIndex, int32_t nLineIndex, int32_t nWordIndex) { this->nSecIndex = nSecIndex; this->nLineIndex = nLineIndex; @@ -48,7 +48,7 @@ struct CPVT_WordPlace { return wp.nSecIndex != this->nSecIndex || wp.nLineIndex != this->nLineIndex || wp.nWordIndex != this->nWordIndex; } - inline FX_INT32 WordCmp(const CPVT_WordPlace & wp) const + inline int32_t WordCmp(const CPVT_WordPlace & wp) const { if (this->nSecIndex > wp.nSecIndex) { return 1; @@ -71,7 +71,7 @@ struct CPVT_WordPlace { return 0; } - inline FX_INT32 LineCmp(const CPVT_WordPlace & wp) const + inline int32_t LineCmp(const CPVT_WordPlace & wp) const { if (this->nSecIndex > wp.nSecIndex) { return 1; @@ -88,7 +88,7 @@ struct CPVT_WordPlace { return 0; } - inline FX_INT32 SecCmp(const CPVT_WordPlace & wp) const + inline int32_t SecCmp(const CPVT_WordPlace & wp) const { if (this->nSecIndex > wp.nSecIndex) { return 1; @@ -99,11 +99,11 @@ struct CPVT_WordPlace { return 0; } - FX_INT32 nSecIndex; + int32_t nSecIndex; - FX_INT32 nLineIndex; + int32_t nLineIndex; - FX_INT32 nWordIndex; + int32_t nWordIndex; }; struct CPVT_WordRange { @@ -170,7 +170,7 @@ struct CPVT_SecProps { { } - CPVT_SecProps(FX_FLOAT lineLeading, FX_FLOAT lineIndent, FX_INT32 alignment) : + CPVT_SecProps(FX_FLOAT lineLeading, FX_FLOAT lineIndent, int32_t alignment) : fLineLeading(lineLeading), fLineIndent(lineIndent), nAlignment(alignment) { } @@ -184,7 +184,7 @@ struct CPVT_SecProps { FX_FLOAT fLineIndent; - FX_INT32 nAlignment; + int32_t nAlignment; }; struct CPVT_WordProps { @@ -193,8 +193,8 @@ struct CPVT_WordProps { { } - CPVT_WordProps(FX_INT32 fontIndex, FX_FLOAT fontSize, FX_COLORREF wordColor = 0, FX_INT32 scriptType = 0, FX_INT32 wordStyle = 0, - FX_FLOAT charSpace = 0, FX_INT32 horzScale = 100) : + CPVT_WordProps(int32_t fontIndex, FX_FLOAT fontSize, FX_COLORREF wordColor = 0, int32_t scriptType = 0, int32_t wordStyle = 0, + FX_FLOAT charSpace = 0, int32_t horzScale = 100) : nFontIndex(fontIndex), fFontSize(fontSize), dwWordColor(wordColor), nScriptType(scriptType), nWordStyle(wordStyle), fCharSpace(charSpace), nHorzScale(horzScale) { @@ -207,19 +207,19 @@ struct CPVT_WordProps { { } - FX_INT32 nFontIndex; + int32_t nFontIndex; FX_FLOAT fFontSize; FX_COLORREF dwWordColor; - FX_INT32 nScriptType; + int32_t nScriptType; - FX_INT32 nWordStyle; + int32_t nWordStyle; FX_FLOAT fCharSpace; - FX_INT32 nHorzScale; + int32_t nHorzScale; }; struct CPVT_Word { @@ -230,7 +230,7 @@ struct CPVT_Word { FX_WORD Word; - FX_INT32 nCharset; + int32_t nCharset; CPVT_WordPlace WordPlace; @@ -242,7 +242,7 @@ struct CPVT_Word { FX_FLOAT fWidth; - FX_INT32 nFontIndex; + int32_t nFontIndex; FX_FLOAT fFontSize; @@ -281,17 +281,17 @@ class IPDF_VariableText_Provider public: virtual ~IPDF_VariableText_Provider() { } - virtual FX_INT32 GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_INT32 nWordStyle) = 0; + virtual int32_t GetCharWidth(int32_t nFontIndex, FX_WORD word, int32_t nWordStyle) = 0; - virtual FX_INT32 GetTypeAscent(FX_INT32 nFontIndex) = 0; + virtual int32_t GetTypeAscent(int32_t nFontIndex) = 0; - virtual FX_INT32 GetTypeDescent(FX_INT32 nFontIndex) = 0; + virtual int32_t GetTypeDescent(int32_t nFontIndex) = 0; - virtual FX_INT32 GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex) = 0; + virtual int32_t GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex) = 0; virtual FX_BOOL IsLatinWord(FX_WORD word) = 0; - virtual FX_INT32 GetDefaultFontIndex() = 0; + virtual int32_t GetDefaultFontIndex() = 0; }; class IPDF_VariableText_Iterator { @@ -320,7 +320,7 @@ public: virtual FX_BOOL SetSection(const CPVT_Section & section) = 0; - virtual void SetAt(FX_INT32 nWordIndex) = 0; + virtual void SetAt(int32_t nWordIndex) = 0; virtual void SetAt(const CPVT_WordPlace & place) = 0; @@ -339,17 +339,17 @@ public: virtual void SetPlateRect(const CPDF_Rect & rect) = 0; - virtual void SetAlignment(FX_INT32 nFormat = 0) = 0; + virtual void SetAlignment(int32_t nFormat = 0) = 0; virtual void SetPasswordChar(FX_WORD wSubWord = '*') = 0; - virtual void SetLimitChar(FX_INT32 nLimitChar = 0) = 0; + virtual void SetLimitChar(int32_t nLimitChar = 0) = 0; - virtual void SetCharArray(FX_INT32 nCharArray = 0) = 0; + virtual void SetCharArray(int32_t nCharArray = 0) = 0; virtual void SetCharSpace(FX_FLOAT fCharSpace = 0.0f) = 0; - virtual void SetHorzScale(FX_INT32 nHorzScale = 100) = 0; + virtual void SetHorzScale(int32_t nHorzScale = 100) = 0; virtual void SetMultiLine(FX_BOOL bMultiLine = TRUE) = 0; @@ -375,16 +375,16 @@ public: virtual void ResetAll() = 0; - virtual void SetText(FX_LPCWSTR text, FX_INT32 charset = 1, const CPVT_SecProps * pSecProps = NULL, + virtual void SetText(FX_LPCWSTR text, int32_t charset = 1, const CPVT_SecProps * pSecProps = NULL, const CPVT_WordProps * pWordProps = NULL) = 0; - virtual CPVT_WordPlace InsertWord(const CPVT_WordPlace & place, FX_WORD word, FX_INT32 charset = 1, + virtual CPVT_WordPlace InsertWord(const CPVT_WordPlace & place, FX_WORD word, int32_t charset = 1, const CPVT_WordProps * pWordProps = NULL) = 0; virtual CPVT_WordPlace InsertSection(const CPVT_WordPlace & place, const CPVT_SecProps * pSecProps = NULL, const CPVT_WordProps * pWordProps = NULL) = 0; - virtual CPVT_WordPlace InsertText(const CPVT_WordPlace & place, FX_LPCWSTR text, FX_INT32 charset = 1, + virtual CPVT_WordPlace InsertText(const CPVT_WordPlace & place, FX_LPCWSTR text, int32_t charset = 1, const CPVT_SecProps * pSecProps = NULL, const CPVT_WordProps * pWordProps = NULL) = 0; virtual CPVT_WordPlace DeleteWords(const CPVT_WordRange & PlaceRange) = 0; @@ -397,21 +397,21 @@ public: virtual CPDF_Rect GetContentRect() const = 0; - virtual FX_INT32 GetTotalWords() const = 0; + virtual int32_t GetTotalWords() const = 0; virtual FX_FLOAT GetFontSize() const = 0; - virtual FX_INT32 GetAlignment() const = 0; + virtual int32_t GetAlignment() const = 0; virtual FX_WORD GetPasswordChar() const = 0; - virtual FX_INT32 GetCharArray() const = 0; + virtual int32_t GetCharArray() const = 0; - virtual FX_INT32 GetLimitChar() const = 0; + virtual int32_t GetLimitChar() const = 0; virtual FX_BOOL IsMultiLine() const = 0; - virtual FX_INT32 GetHorzScale() const = 0; + virtual int32_t GetHorzScale() const = 0; virtual FX_FLOAT GetCharSpace() const = 0; @@ -441,9 +441,9 @@ public: virtual CPVT_WordPlace AjustLineHeader(const CPVT_WordPlace & place, FX_BOOL bPrevOrNext) const = 0; - virtual FX_INT32 WordPlaceToWordIndex(const CPVT_WordPlace & place) const = 0; + virtual int32_t WordPlaceToWordIndex(const CPVT_WordPlace & place) const = 0; - virtual CPVT_WordPlace WordIndexToWordPlace(FX_INT32 index) const = 0; + virtual CPVT_WordPlace WordIndexToWordPlace(int32_t index) const = 0; protected: ~IPDF_VariableText() { } diff --git a/core/include/fpdftext/fpdf_text.h b/core/include/fpdftext/fpdf_text.h index d18a7692c6..65c20b04b4 100644 --- a/core/include/fpdftext/fpdf_text.h +++ b/core/include/fpdftext/fpdf_text.h @@ -36,7 +36,7 @@ CFX_WideString PDF_GetFirstTextLine_Unicode(CPDF_Document* pDoc, CPDF_Dictionary typedef struct { FX_WCHAR m_Unicode; FX_WCHAR m_Charcode; - FX_INT32 m_Flag; + int32_t m_Flag; FX_FLOAT m_FontSize; FX_FLOAT m_OriginX; FX_FLOAT m_OriginY; diff --git a/core/include/fxcodec/fx_codec.h b/core/include/fxcodec/fx_codec.h index 2d902c898b..a16d0d7c5e 100644 --- a/core/include/fxcodec/fx_codec.h +++ b/core/include/fxcodec/fx_codec.h @@ -85,9 +85,9 @@ class ICodec_BasicModule public: virtual ~ICodec_BasicModule() {} - virtual FX_BOOL RunLengthEncode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, + virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) = 0; - virtual FX_BOOL A85Encode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, + virtual FX_BOOL A85Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) = 0; virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc) = 0; @@ -125,10 +125,10 @@ public: virtual ~ICodec_FlateModule() {} virtual ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, int predictor, int Colors, int BitsPerComponent, int Columns) = 0; - virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, + virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, int predictor, int Colors, int BitsPerComponent, int Columns, FX_DWORD estimated_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) = 0; - virtual FX_BOOL Encode(const FX_BYTE* src_buf, FX_DWORD src_size, + virtual FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) = 0; virtual FX_BOOL Encode(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) = 0; @@ -267,11 +267,11 @@ public: ) = 0; - virtual FX_LPVOID CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize, FX_INT32& nComponents, FX_INT32 intent = 0, + virtual FX_LPVOID CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent = 0, FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT) = 0; - virtual FX_LPVOID CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWORD dwSrcProfileSize, FX_INT32& nSrcComponents, - FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, FX_INT32 intent = 0, + virtual FX_LPVOID CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, + FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent = 0, FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT ) = 0; @@ -284,7 +284,7 @@ public: virtual void SetComponents(FX_DWORD nComponents) = 0; }; void AdobeCMYK_to_sRGB(FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B); -void AdobeCMYK_to_sRGB1(FX_BYTE c, FX_BYTE m, FX_BYTE y, FX_BYTE k, FX_BYTE& R, FX_BYTE& G, FX_BYTE& B); -FX_BOOL MD5ComputeID(FX_LPCVOID buf, FX_DWORD dwSize, FX_BYTE ID[16]); +void AdobeCMYK_to_sRGB1(uint8_t c, uint8_t m, uint8_t y, uint8_t k, uint8_t& R, uint8_t& G, uint8_t& B); +FX_BOOL MD5ComputeID(FX_LPCVOID buf, FX_DWORD dwSize, uint8_t ID[16]); #endif // CORE_INCLUDE_FXCODEC_FX_CODEC_H_ diff --git a/core/include/fxcrt/fx_arb.h b/core/include/fxcrt/fx_arb.h index ff86fa6cf7..220aec75c4 100644 --- a/core/include/fxcrt/fx_arb.h +++ b/core/include/fxcrt/fx_arb.h @@ -17,7 +17,7 @@ public: virtual void SetPolicy(FX_BOOL bSeparateNeutral = TRUE) = 0; virtual FX_BOOL AppendChar(FX_WCHAR wch) = 0; virtual FX_BOOL EndChar() = 0; - virtual FX_INT32 GetBidiInfo(FX_INT32 &iStart, FX_INT32 &iCount) = 0; + virtual int32_t GetBidiInfo(int32_t &iStart, int32_t &iCount) = 0; virtual void Reset() = 0; protected: diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h index 0a5d4907b1..3af8a60766 100644 --- a/core/include/fxcrt/fx_basic.h +++ b/core/include/fxcrt/fx_basic.h @@ -41,14 +41,14 @@ public: void AppendBlock(const void* pBuf, FX_STRSIZE size); - void AppendFill(FX_BYTE byte, FX_STRSIZE count); + void AppendFill(uint8_t byte, FX_STRSIZE count); void AppendString(FX_BSTR str) { AppendBlock(str.GetPtr(), str.GetLength()); } - inline void AppendByte(FX_BYTE byte) + inline void AppendByte(uint8_t byte) { if (m_AllocSize <= m_DataSize) { ExpandBuf(1); @@ -99,7 +99,7 @@ public: void AppendChar(int ch) { - AppendByte((FX_BYTE)ch); + AppendByte((uint8_t)ch); } CFX_ByteTextBuf& operator << (int i); @@ -160,7 +160,7 @@ class CFX_ArchiveSaver public: CFX_ArchiveSaver() : m_pStream(NULL) {} - CFX_ArchiveSaver& operator << (FX_BYTE i); + CFX_ArchiveSaver& operator << (uint8_t i); CFX_ArchiveSaver& operator << (int i); @@ -178,7 +178,7 @@ public: void Write(const void* pData, FX_STRSIZE dwSize); - FX_INTPTR GetLength() + intptr_t GetLength() { return m_SavingBuf.GetSize(); } @@ -204,7 +204,7 @@ public: CFX_ArchiveLoader(FX_LPCBYTE pData, FX_DWORD dwSize); - CFX_ArchiveLoader& operator >> (FX_BYTE& i); + CFX_ArchiveLoader& operator >> (uint8_t& i); CFX_ArchiveLoader& operator >> (int& i); @@ -241,14 +241,14 @@ public: FX_BOOL Flush(); - FX_INT32 AppendBlock(const void* pBuf, size_t size); + int32_t AppendBlock(const void* pBuf, size_t size); - FX_INT32 AppendByte(FX_BYTE byte); + int32_t AppendByte(uint8_t byte); - FX_INT32 AppendDWord(FX_DWORD i); + int32_t AppendDWord(FX_DWORD i); - FX_INT32 AppendString(FX_BSTR lpsz); + int32_t AppendString(FX_BSTR lpsz); protected: @@ -282,14 +282,14 @@ private: }; struct CFX_CharMap { - static CFX_CharMap* GetDefaultMapper(FX_INT32 codepage = 0); + static CFX_CharMap* GetDefaultMapper(int32_t codepage = 0); CFX_WideString (*m_GetWideString)(CFX_CharMap* pMap, const CFX_ByteString& bstr); CFX_ByteString (*m_GetByteString)(CFX_CharMap* pMap, const CFX_WideString& wstr); - FX_INT32 (*m_GetCodePage)(); + int32_t (*m_GetCodePage)(); }; class CFX_UTF8Decoder { @@ -301,7 +301,7 @@ public: void Clear(); - void Input(FX_BYTE byte); + void Input(uint8_t byte); void AppendChar(FX_DWORD ch); @@ -541,13 +541,13 @@ public: return -1; } }; -typedef CFX_ArrayTemplate CFX_ByteArray; +typedef CFX_ArrayTemplate CFX_ByteArray; typedef CFX_ArrayTemplate CFX_WordArray; typedef CFX_ArrayTemplate CFX_DWordArray; typedef CFX_ArrayTemplate CFX_PtrArray; typedef CFX_ArrayTemplate CFX_FileSizeArray; typedef CFX_ArrayTemplate CFX_FloatArray; -typedef CFX_ArrayTemplate CFX_Int32Array; +typedef CFX_ArrayTemplate CFX_Int32Array; template class CFX_ObjectArray : public CFX_BasicArray { @@ -574,12 +574,12 @@ public: return InsertSpaceAt(m_nSize, 1); } - FX_INT32 Append(const CFX_ObjectArray& src, FX_INT32 nStart = 0, FX_INT32 nCount = -1) + int32_t Append(const CFX_ObjectArray& src, int32_t nStart = 0, int32_t nCount = -1) { if (nCount == 0) { return 0; } - FX_INT32 nSize = src.GetSize(); + int32_t nSize = src.GetSize(); if (!nSize) { return 0; } @@ -597,18 +597,18 @@ public: InsertSpaceAt(m_nSize, nCount); ObjectClass* pStartObj = (ObjectClass*)GetDataPtr(nSize); nSize = nStart + nCount; - for (FX_INT32 i = nStart; i < nSize; i ++, pStartObj++) { + for (int32_t i = nStart; i < nSize; i ++, pStartObj++) { new ((void*)pStartObj) ObjectClass(src[i]); } return nCount; } - FX_INT32 Copy(const CFX_ObjectArray& src, FX_INT32 nStart = 0, FX_INT32 nCount = -1) + int32_t Copy(const CFX_ObjectArray& src, int32_t nStart = 0, int32_t nCount = -1) { if (nCount == 0) { return 0; } - FX_INT32 nSize = src.GetSize(); + int32_t nSize = src.GetSize(); if (!nSize) { return 0; } @@ -626,7 +626,7 @@ public: SetSize(nCount); ObjectClass* pStartObj = (ObjectClass*)m_pData; nSize = nStart + nCount; - for (FX_INT32 i = nStart; i < nSize; i ++, pStartObj++) { + for (int32_t i = nStart; i < nSize; i ++, pStartObj++) { new ((void*)pStartObj) ObjectClass(src[i]); } return nCount; @@ -704,9 +704,9 @@ private: short m_SegmentSize; - FX_BYTE m_IndexSize; + uint8_t m_IndexSize; - FX_BYTE m_IndexDepth; + uint8_t m_IndexDepth; int m_DataSize; @@ -859,26 +859,26 @@ public: FX_BOOL Lookup(KeyType key, ValueType& rValue) const { FX_LPVOID pValue = NULL; - if (!CFX_MapPtrToPtr::Lookup((void*)(FX_UINTPTR)key, pValue)) { + if (!CFX_MapPtrToPtr::Lookup((void*)(uintptr_t)key, pValue)) { return FALSE; } - rValue = (ValueType)(FX_UINTPTR)pValue; + rValue = (ValueType)(uintptr_t)pValue; return TRUE; } ValueType& operator[](KeyType key) { - return (ValueType&)CFX_MapPtrToPtr::operator []((void*)(FX_UINTPTR)key); + return (ValueType&)CFX_MapPtrToPtr::operator []((void*)(uintptr_t)key); } void SetAt(KeyType key, ValueType newValue) { - CFX_MapPtrToPtr::SetAt((void*)(FX_UINTPTR)key, (void*)(FX_UINTPTR)newValue); + CFX_MapPtrToPtr::SetAt((void*)(uintptr_t)key, (void*)(uintptr_t)newValue); } FX_BOOL RemoveKey(KeyType key) { - return CFX_MapPtrToPtr::RemoveKey((void*)(FX_UINTPTR)key); + return CFX_MapPtrToPtr::RemoveKey((void*)(uintptr_t)key); } void GetNextAssoc(FX_POSITION& rNextPosition, KeyType& rKey, ValueType& rValue) const @@ -886,8 +886,8 @@ public: void* pKey = NULL; void* pValue = NULL; CFX_MapPtrToPtr::GetNextAssoc(rNextPosition, pKey, pValue); - rKey = (KeyType)(FX_UINTPTR)pKey; - rValue = (ValueType)(FX_UINTPTR)pValue; + rKey = (KeyType)(uintptr_t)pKey; + rValue = (ValueType)(uintptr_t)pValue; } }; class CFX_CMapDWordToDWord @@ -1419,9 +1419,9 @@ protected: struct DataList { - FX_INT32 start; + int32_t start; - FX_INT32 count; + int32_t count; FX_LPBYTE data; }; public: @@ -1436,7 +1436,7 @@ public: void Clear() { - for (FX_INT32 i = m_DataLists.GetUpperBound(); i >= 0; i--) { + for (int32_t i = m_DataLists.GetUpperBound(); i >= 0; i--) { DataList list = m_DataLists.ElementAt(i); if (list.data) { FX_Free(list.data); @@ -1446,15 +1446,15 @@ public: m_CurList = 0; } - void Append(FX_INT32 nStart, FX_INT32 nCount) + void Append(int32_t nStart, int32_t nCount) { if (nStart < 0) { return; } while (nCount > 0) { - FX_INT32 temp_count = FX_MIN(nCount, FX_DATALIST_LENGTH); + int32_t temp_count = FX_MIN(nCount, FX_DATALIST_LENGTH); DataList list; - list.data = FX_Alloc2D(FX_BYTE, temp_count, unit); + list.data = FX_Alloc2D(uint8_t, temp_count, unit); list.start = nStart; list.count = temp_count; Append(list); @@ -1463,7 +1463,7 @@ public: } } - FX_LPBYTE GetAt(FX_INT32 nIndex) + FX_LPBYTE GetAt(int32_t nIndex) { if (nIndex < 0) { return NULL; @@ -1474,9 +1474,9 @@ public: DataList *pCurList = m_DataLists.GetDataPtr(m_CurList); if (!pCurList || nIndex < pCurList->start || nIndex >= pCurList->start + pCurList->count) { pCurList = NULL; - FX_INT32 iStart = 0; - FX_INT32 iEnd = m_DataLists.GetUpperBound(); - FX_INT32 iMid = 0; + int32_t iStart = 0; + int32_t iEnd = m_DataLists.GetUpperBound(); + int32_t iMid = 0; while (iStart <= iEnd) { iMid = (iStart + iEnd) / 2; DataList* list = m_DataLists.GetDataPtr(iMid); @@ -1496,11 +1496,11 @@ public: protected: void Append(const DataList& list) { - FX_INT32 iStart = 0; - FX_INT32 iEnd = m_DataLists.GetUpperBound(); - FX_INT32 iFind = 0; + int32_t iStart = 0; + int32_t iEnd = m_DataLists.GetUpperBound(); + int32_t iFind = 0; while (iStart <= iEnd) { - FX_INT32 iMid = (iStart + iEnd) / 2; + int32_t iMid = (iStart + iEnd) / 2; DataList* cur_list = m_DataLists.GetDataPtr(iMid); if (list.start < cur_list->start + cur_list->count) { iEnd = iMid - 1; @@ -1520,7 +1520,7 @@ protected: } m_DataLists.InsertAt(iFind, list); } - FX_INT32 m_CurList; + int32_t m_CurList; CFX_ArrayTemplate m_DataLists; }; template @@ -1533,19 +1533,19 @@ public: m_Data.Clear(); } - void Add(FX_INT32 nStart, FX_INT32 nCount) + void Add(int32_t nStart, int32_t nCount) { m_Data.Append(nStart, nCount); } - T2& operator [] (FX_INT32 nIndex) + T2& operator [] (int32_t nIndex) { FX_LPBYTE data = m_Data.GetAt(nIndex); FXSYS_assert(data != NULL); return (T2&)(*(volatile T2*)data); } - T2* GetPtrAt(FX_INT32 nIndex) + T2* GetPtrAt(int32_t nIndex) { return (T2*)m_Data.GetAt(nIndex); } diff --git a/core/include/fxcrt/fx_coordinates.h b/core/include/fxcrt/fx_coordinates.h index 076c0e6a2f..c98ece9e07 100644 --- a/core/include/fxcrt/fx_coordinates.h +++ b/core/include/fxcrt/fx_coordinates.h @@ -113,15 +113,15 @@ public: } baseType x, y; }; -typedef CFX_PSVTemplate CFX_Point; +typedef CFX_PSVTemplate CFX_Point; typedef CFX_PSVTemplate CFX_PointF; -typedef CFX_PSVTemplate CFX_Size; +typedef CFX_PSVTemplate CFX_Size; typedef CFX_PSVTemplate CFX_SizeF; typedef CFX_ArrayTemplate CFX_Points; typedef CFX_ArrayTemplate CFX_PointsF; -typedef CFX_PSVTemplate * FX_LPPOINT; +typedef CFX_PSVTemplate * FX_LPPOINT; typedef CFX_PSVTemplate * FX_LPPOINTF; -typedef CFX_PSVTemplate const * FX_LPCPOINT; +typedef CFX_PSVTemplate const * FX_LPCPOINT; typedef CFX_PSVTemplate const * FX_LPCPOINTF; #define CFX_FloatPoint CFX_PointF template @@ -227,7 +227,7 @@ public: return v.y < 0 ? -fSlope : fSlope; } }; -typedef CFX_VTemplate CFX_Vector; +typedef CFX_VTemplate CFX_Vector; typedef CFX_VTemplate CFX_VectorF; template class CFX_RTemplate @@ -524,11 +524,11 @@ public: baseType left, top; baseType width, height; }; -typedef CFX_RTemplate CFX_Rect; +typedef CFX_RTemplate CFX_Rect; typedef CFX_RTemplate CFX_RectF; -typedef CFX_RTemplate * FX_LPRECT; +typedef CFX_RTemplate * FX_LPRECT; typedef CFX_RTemplate * FX_LPRECTF; -typedef CFX_RTemplate const * FX_LPCRECT; +typedef CFX_RTemplate const * FX_LPCRECT; typedef CFX_RTemplate const * FX_LPCRECTF; typedef CFX_ArrayTemplate CFX_RectFArray; struct FX_RECT { @@ -602,13 +602,13 @@ struct FX_RECT { }; struct FX_SMALL_RECT { - FX_SHORT Left; + int16_t Left; - FX_SHORT Top; + int16_t Top; - FX_SHORT Right; + int16_t Right; - FX_SHORT Bottom; + int16_t Bottom; }; class CFX_FloatRect { @@ -807,7 +807,7 @@ public: void Translate(FX_FLOAT x, FX_FLOAT y, FX_BOOL bPrepended = FALSE); - void TranslateI(FX_INT32 x, FX_INT32 y, FX_BOOL bPrepended = FALSE) + void TranslateI(int32_t x, int32_t y, FX_BOOL bPrepended = FALSE) { Translate((FX_FLOAT)x, (FX_FLOAT)y, bPrepended); } @@ -831,17 +831,17 @@ public: FX_FLOAT GetUnitArea() const; FX_FLOAT TransformXDistance(FX_FLOAT dx) const; - FX_INT32 TransformXDistance(FX_INT32 dx) const; + int32_t TransformXDistance(int32_t dx) const; FX_FLOAT TransformYDistance(FX_FLOAT dy) const; - FX_INT32 TransformYDistance(FX_INT32 dy) const; + int32_t TransformYDistance(int32_t dy) const; FX_FLOAT TransformDistance(FX_FLOAT dx, FX_FLOAT dy) const; - FX_INT32 TransformDistance(FX_INT32 dx, FX_INT32 dy) const; + int32_t TransformDistance(int32_t dx, int32_t dy) const; FX_FLOAT TransformDistance(FX_FLOAT distance) const; void TransformPoint(FX_FLOAT &x, FX_FLOAT &y) const; - void TransformPoint(FX_INT32 &x, FX_INT32 &y) const; - void TransformPoints(CFX_PointF *points, FX_INT32 iCount) const; - void TransformPoints(CFX_Point *points, FX_INT32 iCount) const; + void TransformPoint(int32_t &x, int32_t &y) const; + void TransformPoints(CFX_PointF *points, int32_t iCount) const; + void TransformPoints(CFX_Point *points, int32_t iCount) const; void Transform(FX_FLOAT& x, FX_FLOAT& y) const { diff --git a/core/include/fxcrt/fx_ext.h b/core/include/fxcrt/fx_ext.h index 3d0cdedf9e..60cc259ff8 100644 --- a/core/include/fxcrt/fx_ext.h +++ b/core/include/fxcrt/fx_ext.h @@ -19,31 +19,31 @@ extern "C" { FX_FLOAT FXSYS_tan(FX_FLOAT a); FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x); -FX_FLOAT FXSYS_strtof(FX_LPCSTR pcsStr, FX_INT32 iLength = -1, FX_INT32 *pUsedLen = NULL); -FX_FLOAT FXSYS_wcstof(FX_LPCWSTR pwsStr, FX_INT32 iLength = -1, FX_INT32 *pUsedLen = NULL); +FX_FLOAT FXSYS_strtof(FX_LPCSTR pcsStr, int32_t iLength = -1, int32_t *pUsedLen = NULL); +FX_FLOAT FXSYS_wcstof(FX_LPCWSTR pwsStr, int32_t iLength = -1, int32_t *pUsedLen = NULL); FX_LPWSTR FXSYS_wcsncpy(FX_LPWSTR dstStr, FX_LPCWSTR srcStr, size_t count); -FX_INT32 FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count); -FX_INT32 FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count); +int32_t FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count); +int32_t FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count); -inline FX_BOOL FXSYS_islower(FX_INT32 ch) +inline FX_BOOL FXSYS_islower(int32_t ch) { return ch >= 'a' && ch <= 'z'; } -inline FX_BOOL FXSYS_isupper(FX_INT32 ch) +inline FX_BOOL FXSYS_isupper(int32_t ch) { return ch >= 'A' && ch <= 'Z'; } -inline FX_INT32 FXSYS_tolower(FX_INT32 ch) +inline int32_t FXSYS_tolower(int32_t ch) { return ch < 'A' || ch > 'Z' ? ch : (ch + 0x20); } -inline FX_INT32 FXSYS_toupper(FX_INT32 ch) +inline int32_t FXSYS_toupper(int32_t ch) { return ch < 'a' || ch > 'z' ? ch : (ch - 0x20); } -FX_DWORD FX_HashCode_String_GetA(FX_LPCSTR pStr, FX_INT32 iLength, FX_BOOL bIgnoreCase = FALSE); -FX_DWORD FX_HashCode_String_GetW(FX_LPCWSTR pStr, FX_INT32 iLength, FX_BOOL bIgnoreCase = FALSE); +FX_DWORD FX_HashCode_String_GetA(FX_LPCSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE); +FX_DWORD FX_HashCode_String_GetW(FX_LPCWSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE); #ifdef __cplusplus } @@ -58,11 +58,11 @@ FX_DWORD FX_Random_MT_Generate(FX_LPVOID pContext); void FX_Random_MT_Close(FX_LPVOID pContext); -void FX_Random_GenerateBase(FX_LPDWORD pBuffer, FX_INT32 iCount); +void FX_Random_GenerateBase(FX_LPDWORD pBuffer, int32_t iCount); -void FX_Random_GenerateMT(FX_LPDWORD pBuffer, FX_INT32 iCount); +void FX_Random_GenerateMT(FX_LPDWORD pBuffer, int32_t iCount); -void FX_Random_GenerateCrypto(FX_LPDWORD pBuffer, FX_INT32 iCount); +void FX_Random_GenerateCrypto(FX_LPDWORD pBuffer, int32_t iCount); #ifdef __cplusplus } #endif @@ -70,10 +70,10 @@ template class CFX_SSortTemplate { public: - void ShellSort(baseType *pArray, FX_INT32 iCount) + void ShellSort(baseType *pArray, int32_t iCount) { FXSYS_assert(pArray != NULL && iCount > 0); - FX_INT32 i, j, gap; + int32_t i, j, gap; baseType v1, v2; gap = iCount >> 1; while (gap > 0) { diff --git a/core/include/fxcrt/fx_safe_types.h b/core/include/fxcrt/fx_safe_types.h index e45e6d3c8d..ee50a53e34 100644 --- a/core/include/fxcrt/fx_safe_types.h +++ b/core/include/fxcrt/fx_safe_types.h @@ -12,7 +12,7 @@ #include "fx_system.h" typedef pdfium::base::CheckedNumeric FX_SAFE_DWORD; -typedef pdfium::base::CheckedNumeric FX_SAFE_INT32; +typedef pdfium::base::CheckedNumeric FX_SAFE_INT32; typedef pdfium::base::CheckedNumeric FX_SAFE_SIZE_T; typedef pdfium::base::CheckedNumeric FX_SAFE_FILESIZE; diff --git a/core/include/fxcrt/fx_stream.h b/core/include/fxcrt/fx_stream.h index 7f36342160..a07fd6dc3a 100644 --- a/core/include/fxcrt/fx_stream.h +++ b/core/include/fxcrt/fx_stream.h @@ -20,7 +20,7 @@ typedef struct FX_HFILE_ { FX_LPVOID pData; }* FX_HFILE; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -#define FX_FILESIZE FX_INT32 +#define FX_FILESIZE int32_t #else #include #include @@ -37,10 +37,10 @@ typedef struct FX_HFILE_ { #define FX_GETBYTEOFFSET40(a) 0 #define FX_GETBYTEOFFSET48(a) 0 #define FX_GETBYTEOFFSET56(a) 0 -#define FX_GETBYTEOFFSET24(a) ((FX_BYTE)(a>>24)) -#define FX_GETBYTEOFFSET16(a) ((FX_BYTE)(a>>16)) -#define FX_GETBYTEOFFSET8(a) ((FX_BYTE)(a>>8)) -#define FX_GETBYTEOFFSET0(a) ((FX_BYTE)(a)) +#define FX_GETBYTEOFFSET24(a) ((uint8_t)(a>>24)) +#define FX_GETBYTEOFFSET16(a) ((uint8_t)(a>>16)) +#define FX_GETBYTEOFFSET8(a) ((uint8_t)(a>>8)) +#define FX_GETBYTEOFFSET0(a) ((uint8_t)(a)) #define FX_FILEMODE_Write 0 #define FX_FILEMODE_ReadOnly 1 #define FX_FILEMODE_Truncate 2 diff --git a/core/include/fxcrt/fx_string.h b/core/include/fxcrt/fx_string.h index 9903dad942..8fc9d79ebb 100644 --- a/core/include/fxcrt/fx_string.h +++ b/core/include/fxcrt/fx_string.h @@ -121,7 +121,7 @@ public: return m_Length == 0; } - FX_BYTE GetAt(FX_STRSIZE index) const + uint8_t GetAt(FX_STRSIZE index) const { return m_Ptr[index]; } @@ -140,7 +140,7 @@ public: return CFX_ByteStringC(m_Ptr + index, count); } - const FX_BYTE& operator[] (size_t index) const + const uint8_t& operator[] (size_t index) const { return m_Ptr[index]; } @@ -279,12 +279,12 @@ public: const CFX_ByteString& operator += (FX_BSTR bstrc); - FX_BYTE GetAt(FX_STRSIZE nIndex) const + uint8_t GetAt(FX_STRSIZE nIndex) const { return m_pData ? m_pData->m_String[nIndex] : 0; } - FX_BYTE operator[](FX_STRSIZE nIndex) const + uint8_t operator[](FX_STRSIZE nIndex) const { return m_pData ? m_pData->m_String[nIndex] : 0; } diff --git a/core/include/fxcrt/fx_system.h b/core/include/fxcrt/fx_system.h index f0ebcf90b1..80d75908d4 100644 --- a/core/include/fxcrt/fx_system.h +++ b/core/include/fxcrt/fx_system.h @@ -68,35 +68,23 @@ extern "C" { #endif typedef void* FX_LPVOID; // Deprecate, use with void*. -typedef void const* FX_LPCVOID; // Deprecate, use with const void*. +typedef const void* FX_LPCVOID; // Deprecate, use with const void*. typedef void* FX_POSITION; // Keep until fxcrt containers gone -typedef signed char FX_INT8; // Deprecate, use int8_t. -typedef unsigned char FX_UINT8; // Deprecate, use uint8_t. -typedef unsigned char FX_BYTE; // Deprecate, use uint8_t. -typedef unsigned char* FX_LPBYTE; // Deprecate, use uint8_t*. -typedef unsigned char const* FX_LPCBYTE; // Deprecate, use const uint8_t*. -typedef short FX_INT16; // Deprecate, use int16_t. -typedef unsigned short FX_UINT16; // Deprecate, use uint16_t. -typedef short FX_SHORT; // Deprecate, use int16_t. +typedef uint8_t* FX_LPBYTE; // Deprecate, use uint8_t*. +typedef const uint8_t* FX_LPCBYTE; // Deprecate, use const uint8_t*. typedef unsigned short FX_WORD; // Keep - "an efficient small type" -typedef unsigned short* FX_LPWORD; // Deprecate, use FX_WORD*. -typedef unsigned short const* FX_LPCWORD; // Deprecate, use const FX_WORD*. -typedef int FX_INT32; // Deprecate, use int32_t. -typedef unsigned int FX_UINT32; // Deprecate, use uint32_t. +typedef FX_WORD* FX_LPWORD; // Deprecate, use FX_WORD*. +typedef const FX_WORD* FX_LPCWORD; // Deprecate, use const FX_WORD*. typedef unsigned int FX_DWORD; // Keep - "an efficient type" -typedef unsigned int* FX_LPDWORD; // Deprecate, use FX_DWORD*. -typedef int64_t FX_INT64; // Deprecate, use int64_t. -typedef uint64_t FX_UINT64; // Deprecate, use uint64_t. -typedef intptr_t FX_INTPTR; // Deprecate, use intptr_t. -typedef uintptr_t FX_UINTPTR; // Deprecate, use uintptr_t. +typedef FX_DWORD* FX_LPDWORD; // Deprecate, use FX_DWORD*. typedef float FX_FLOAT; // Keep, allow upgrade to doubles. typedef int FX_BOOL; // Sadly not always 0 or 1. typedef char FX_CHAR; // Keep, questionable signedness. -typedef char* FX_LPSTR; // Deprecate, use FX_CHAR*. -typedef char const* FX_LPCSTR; // Deprecate, use const FX_CHAR*. +typedef FX_CHAR* FX_LPSTR; // Deprecate, use FX_CHAR*. +typedef const FX_CHAR* FX_LPCSTR; // Deprecate, use const FX_CHAR*. typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars. -typedef wchar_t* FX_LPWSTR; // Deprecate, use FX_WCHAR*. -typedef wchar_t const* FX_LPCWSTR; // Deprecate, use const FX_WCHAR*. +typedef FX_WCHAR* FX_LPWSTR; // Deprecate, use FX_WCHAR*. +typedef const FX_WCHAR* FX_LPCWSTR; // Deprecate, use const FX_WCHAR*. // PDFium string sizes are limited to 2^31-1, and the value is signed to // allow -1 as a placeholder for "unknown". @@ -260,19 +248,19 @@ wchar_t* FXSYS_wcsupr(wchar_t* str); #define FXSYS_fmod(a, b) (FX_FLOAT)fmod(a, b) #define FXSYS_abs abs #define FXDWORD_FROM_LSBFIRST(i) (i) -#define FXDWORD_FROM_MSBFIRST(i) (((FX_BYTE)(i) << 24) | ((FX_BYTE)((i) >> 8) << 16) | ((FX_BYTE)((i) >> 16) << 8) | (FX_BYTE)((i) >> 24)) +#define FXDWORD_FROM_MSBFIRST(i) (((uint8_t)(i) << 24) | ((uint8_t)((i) >> 8) << 16) | ((uint8_t)((i) >> 16) << 8) | (uint8_t)((i) >> 24)) #define FXDWORD_GET_LSBFIRST(p) ((((FX_LPBYTE)(p))[3] << 24) | (((FX_LPBYTE)(p))[2] << 16) | (((FX_LPBYTE)(p))[1] << 8) | (((FX_LPBYTE)(p))[0])) #define FXDWORD_GET_MSBFIRST(p) ((((FX_LPBYTE)(p))[0] << 24) | (((FX_LPBYTE)(p))[1] << 16) | (((FX_LPBYTE)(p))[2] << 8) | (((FX_LPBYTE)(p))[3])) -#define FXSYS_HIBYTE(word) ((FX_BYTE)((word) >> 8)) -#define FXSYS_LOBYTE(word) ((FX_BYTE)(word)) +#define FXSYS_HIBYTE(word) ((uint8_t)((word) >> 8)) +#define FXSYS_LOBYTE(word) ((uint8_t)(word)) #define FXSYS_HIWORD(dword) ((FX_WORD)((dword) >> 16)) #define FXSYS_LOWORD(dword) ((FX_WORD)(dword)) -FX_INT32 FXSYS_atoi(FX_LPCSTR str); -FX_INT32 FXSYS_wtoi(FX_LPCWSTR str); -FX_INT64 FXSYS_atoi64(FX_LPCSTR str); -FX_INT64 FXSYS_wtoi64(FX_LPCWSTR str); -FX_LPCSTR FXSYS_i64toa(FX_INT64 value, FX_LPSTR str, int radix); -FX_LPCWSTR FXSYS_i64tow(FX_INT64 value, FX_LPWSTR str, int radix); +int32_t FXSYS_atoi(FX_LPCSTR str); +int32_t FXSYS_wtoi(FX_LPCWSTR str); +int64_t FXSYS_atoi64(FX_LPCSTR str); +int64_t FXSYS_wtoi64(FX_LPCWSTR str); +FX_LPCSTR FXSYS_i64toa(int64_t value, FX_LPSTR str, int radix); +FX_LPCWSTR FXSYS_i64tow(int64_t value, FX_LPWSTR str, int radix); int FXSYS_round(FX_FLOAT f); #define FXSYS_Mul(a, b) ((a) * (b)) #define FXSYS_Div(a, b) ((a) / (b)) diff --git a/core/include/fxge/fpf.h b/core/include/fxge/fpf.h index 440c329439..30c1c77bbe 100644 --- a/core/include/fxge/fpf.h +++ b/core/include/fxge/fpf.h @@ -31,19 +31,19 @@ public: virtual CFX_ByteString GetFamilyName() = 0; virtual CFX_WideString GetPsName() = 0; virtual FX_DWORD GetFontStyle() const = 0; - virtual FX_BYTE GetCharset() const = 0; + virtual uint8_t GetCharset() const = 0; - virtual FX_INT32 GetGlyphIndex(FX_WCHAR wUnicode) = 0; - virtual FX_INT32 GetGlyphWidth(FX_INT32 iGlyphIndex) = 0; + virtual int32_t GetGlyphIndex(FX_WCHAR wUnicode) = 0; + virtual int32_t GetGlyphWidth(int32_t iGlyphIndex) = 0; - virtual FX_INT32 GetAscent() const = 0; - virtual FX_INT32 GetDescent() const = 0; + virtual int32_t GetAscent() const = 0; + virtual int32_t GetDescent() const = 0; - virtual FX_BOOL GetGlyphBBox(FX_INT32 iGlyphIndex, FX_RECT &rtBBox) = 0; + virtual FX_BOOL GetGlyphBBox(int32_t iGlyphIndex, FX_RECT &rtBBox) = 0; virtual FX_BOOL GetBBox(FX_RECT &rtBBox) = 0; - virtual FX_INT32 GetHeight() const = 0; - virtual FX_INT32 GetItalicAngle() const = 0; + virtual int32_t GetHeight() const = 0; + virtual int32_t GetItalicAngle() const = 0; virtual FX_DWORD GetFontData(FX_DWORD dwTable, FX_LPBYTE pBuffer, FX_DWORD dwSize) = 0; protected: @@ -58,7 +58,7 @@ public: virtual void LoadPrivateFont(FX_BSTR bsFileName) = 0; virtual void LoadPrivateFont(FX_LPVOID pBuffer, size_t szBuffer) = 0; - virtual IFPF_Font* CreateFont(FX_BSTR bsFamilyname, FX_BYTE charset, FX_DWORD dwStyle, FX_DWORD dwMatch = 0) = 0; + virtual IFPF_Font* CreateFont(FX_BSTR bsFamilyname, uint8_t charset, FX_DWORD dwStyle, FX_DWORD dwMatch = 0) = 0; }; #endif // CORE_INCLUDE_FXGE_FPF_H_ diff --git a/core/include/fxge/fx_dib.h b/core/include/fxge/fx_dib.h index 74738d0d0f..d798ca3511 100644 --- a/core/include/fxge/fx_dib.h +++ b/core/include/fxge/fx_dib.h @@ -74,10 +74,10 @@ class CFX_DIBitmap; #define FXSYS_GetBValue(rgb) (((rgb) >> 16) & 0xff) #define FX_CCOLOR(val) (255-(val)) #define FXSYS_CMYK(c, m, y, k) (((c) << 24) | ((m) << 16) | ((y) << 8) | (k)) -#define FXSYS_GetCValue(cmyk) ((FX_BYTE)((cmyk) >> 24) & 0xff) -#define FXSYS_GetMValue(cmyk) ((FX_BYTE)((cmyk) >> 16) & 0xff) -#define FXSYS_GetYValue(cmyk) ((FX_BYTE)((cmyk) >> 8) & 0xff) -#define FXSYS_GetKValue(cmyk) ((FX_BYTE)(cmyk) & 0xff) +#define FXSYS_GetCValue(cmyk) ((uint8_t)((cmyk) >> 24) & 0xff) +#define FXSYS_GetMValue(cmyk) ((uint8_t)((cmyk) >> 16) & 0xff) +#define FXSYS_GetYValue(cmyk) ((uint8_t)((cmyk) >> 8) & 0xff) +#define FXSYS_GetKValue(cmyk) ((uint8_t)(cmyk) & 0xff) void CmykDecode(FX_CMYK cmyk, int& c, int& m, int& y, int& k); inline FX_CMYK CmykEncode(int c, int m, int y, int k) { @@ -90,10 +90,10 @@ inline FX_ARGB ArgbEncode(int a, int r, int g, int b) return (a << 24) | (r << 16) | (g << 8) | b; } FX_ARGB ArgbEncode(int a, FX_COLORREF rgb); -#define FXARGB_A(argb) ((FX_BYTE)((argb) >> 24)) -#define FXARGB_R(argb) ((FX_BYTE)((argb) >> 16)) -#define FXARGB_G(argb) ((FX_BYTE)((argb) >> 8)) -#define FXARGB_B(argb) ((FX_BYTE)(argb)) +#define FXARGB_A(argb) ((uint8_t)((argb) >> 24)) +#define FXARGB_R(argb) ((uint8_t)((argb) >> 16)) +#define FXARGB_G(argb) ((uint8_t)((argb) >> 8)) +#define FXARGB_B(argb) ((uint8_t)(argb)) #define FXARGB_MAKE(a,r,g,b) (((FX_DWORD)(a) << 24) | ((r) << 16) | ((g) << 8) | (b)) #define FXARGB_MUL_ALPHA(argb, alpha) (((((argb) >> 24) * (alpha) / 255) << 24) | ((argb) & 0xffffff)) #define FXRGB2GRAY(r,g,b) (((b) * 11 + (g) * 59 + (r) * 30) / 100) @@ -101,15 +101,15 @@ FX_ARGB ArgbEncode(int a, FX_COLORREF rgb); #define FXDIB_ALPHA_MERGE(backdrop, source, source_alpha) (((backdrop) * (255-(source_alpha)) + (source)*(source_alpha))/255) #define FXDIB_ALPHA_UNION(dest, src) ((dest) + (src) - (dest)*(src)/255) #define FXCMYK_GETDIB(p) ((((FX_LPBYTE)(p))[0] << 24 | (((FX_LPBYTE)(p))[1] << 16) | (((FX_LPBYTE)(p))[2] << 8) | ((FX_LPBYTE)(p))[3])) -#define FXCMYK_SETDIB(p, cmyk) ((FX_LPBYTE)(p))[0] = (FX_BYTE)((cmyk) >> 24), \ - ((FX_LPBYTE)(p))[1] = (FX_BYTE)((cmyk) >> 16), \ - ((FX_LPBYTE)(p))[2] = (FX_BYTE)((cmyk) >> 8), \ - ((FX_LPBYTE)(p))[3] = (FX_BYTE)(cmyk)) +#define FXCMYK_SETDIB(p, cmyk) ((FX_LPBYTE)(p))[0] = (uint8_t)((cmyk) >> 24), \ + ((FX_LPBYTE)(p))[1] = (uint8_t)((cmyk) >> 16), \ + ((FX_LPBYTE)(p))[2] = (uint8_t)((cmyk) >> 8), \ + ((FX_LPBYTE)(p))[3] = (uint8_t)(cmyk)) #define FXARGB_GETDIB(p) ((((FX_LPBYTE)(p))[0]) | (((FX_LPBYTE)(p))[1] << 8) | (((FX_LPBYTE)(p))[2] << 16) | (((FX_LPBYTE)(p))[3] << 24)) -#define FXARGB_SETDIB(p, argb) ((FX_LPBYTE)(p))[0] = (FX_BYTE)(argb), \ - ((FX_LPBYTE)(p))[1] = (FX_BYTE)((argb) >> 8), \ - ((FX_LPBYTE)(p))[2] = (FX_BYTE)((argb) >> 16), \ - ((FX_LPBYTE)(p))[3] = (FX_BYTE)((argb) >> 24) +#define FXARGB_SETDIB(p, argb) ((FX_LPBYTE)(p))[0] = (uint8_t)(argb), \ + ((FX_LPBYTE)(p))[1] = (uint8_t)((argb) >> 8), \ + ((FX_LPBYTE)(p))[2] = (uint8_t)((argb) >> 16), \ + ((FX_LPBYTE)(p))[3] = (uint8_t)((argb) >> 24) #define FXARGB_COPY(dest, src) *(FX_LPBYTE)(dest) = *(FX_LPBYTE)(src), \ *((FX_LPBYTE)(dest)+1) = *((FX_LPBYTE)(src)+1), \ *((FX_LPBYTE)(dest)+2) = *((FX_LPBYTE)(src)+2), \ @@ -118,21 +118,21 @@ FX_ARGB ArgbEncode(int a, FX_COLORREF rgb); *((FX_LPBYTE)(dest)+1) = *((FX_LPBYTE)(src)+1), \ *((FX_LPBYTE)(dest)+2) = *((FX_LPBYTE)(src)+2), \ *((FX_LPBYTE)(dest)+3) = *((FX_LPBYTE)(src)+3) -#define FXARGB_SETRGBORDERDIB(p, argb) ((FX_LPBYTE)(p))[3] = (FX_BYTE)(argb>>24), \ - ((FX_LPBYTE)(p))[0] = (FX_BYTE)((argb) >> 16), \ - ((FX_LPBYTE)(p))[1] = (FX_BYTE)((argb) >> 8), \ - ((FX_LPBYTE)(p))[2] = (FX_BYTE)(argb) +#define FXARGB_SETRGBORDERDIB(p, argb) ((FX_LPBYTE)(p))[3] = (uint8_t)(argb>>24), \ + ((FX_LPBYTE)(p))[0] = (uint8_t)((argb) >> 16), \ + ((FX_LPBYTE)(p))[1] = (uint8_t)((argb) >> 8), \ + ((FX_LPBYTE)(p))[2] = (uint8_t)(argb) #define FXARGB_GETRGBORDERDIB(p) (((FX_LPBYTE)(p))[2]) | (((FX_LPBYTE)(p))[1] << 8) | (((FX_LPBYTE)(p))[0] << 16) | (((FX_LPBYTE)(p))[3] << 24) #define FXARGB_RGBORDERCOPY(dest, src) *((FX_LPBYTE)(dest)+3) = *((FX_LPBYTE)(src)+3), \ *(FX_LPBYTE)(dest) = *((FX_LPBYTE)(src)+2), \ *((FX_LPBYTE)(dest)+1) = *((FX_LPBYTE)(src)+1), \ *((FX_LPBYTE)(dest)+2) = *((FX_LPBYTE)(src)) #define FXARGB_TODIB(argb) (argb) -#define FXCMYK_TODIB(cmyk) ((FX_BYTE)((cmyk) >> 24) | ((FX_BYTE)((cmyk) >> 16)) << 8 | ((FX_BYTE)((cmyk) >> 8)) << 16 | ((FX_BYTE)(cmyk) << 24)) -#define FXARGB_TOBGRORDERDIB(argb) ((FX_BYTE)(argb>>16) | ((FX_BYTE)(argb>>8)) << 8 | ((FX_BYTE)(argb)) << 16 | ((FX_BYTE)(argb>>24) << 24)) -#define FXGETFLAG_COLORTYPE(flag) (FX_BYTE)((flag)>>8) -#define FXGETFLAG_ALPHA_FILL(flag) (FX_BYTE)(flag) -#define FXGETFLAG_ALPHA_STROKE(flag) (FX_BYTE)((flag)>>16) +#define FXCMYK_TODIB(cmyk) ((uint8_t)((cmyk) >> 24) | ((uint8_t)((cmyk) >> 16)) << 8 | ((uint8_t)((cmyk) >> 8)) << 16 | ((uint8_t)(cmyk) << 24)) +#define FXARGB_TOBGRORDERDIB(argb) ((uint8_t)(argb>>16) | ((uint8_t)(argb>>8)) << 8 | ((uint8_t)(argb)) << 16 | ((uint8_t)(argb>>24) << 24)) +#define FXGETFLAG_COLORTYPE(flag) (uint8_t)((flag)>>8) +#define FXGETFLAG_ALPHA_FILL(flag) (uint8_t)(flag) +#define FXGETFLAG_ALPHA_STROKE(flag) (uint8_t)((flag)>>16) #define FXSETFLAG_COLORTYPE(flag, val) flag = (((val)<<8)|(flag&0xffff00ff)) #define FXSETFLAG_ALPHA_FILL(flag, val) flag = ((val)|(flag&0xffffff00)) #define FXSETFLAG_ALPHA_STROKE(flag, val) flag = (((val)<<16)|(flag&0xff00ffff)) @@ -415,7 +415,7 @@ public: ~CFX_ScanlineCompositor(); - FX_BOOL Init(FXDIB_Format dest_format, FXDIB_Format src_format, FX_INT32 width, FX_DWORD* pSrcPalette, + FX_BOOL Init(FXDIB_Format dest_format, FXDIB_Format src_format, int32_t width, FX_DWORD* pSrcPalette, FX_DWORD mask_color, int blend_type, FX_BOOL bClip, FX_BOOL bRgbByteOrder = FALSE, int alpha_flag = 0, void* pIccTransform = NULL); @@ -519,11 +519,11 @@ public: ~CFX_ImageStretcher(); - FX_INT32 Start(IFX_ScanlineComposer* pDest, const CFX_DIBSource* pBitmap, + int32_t Start(IFX_ScanlineComposer* pDest, const CFX_DIBSource* pBitmap, int dest_width, int dest_height, const FX_RECT& bitmap_rect, FX_DWORD flags); - FX_INT32 Continue(IFX_Pause* pPause); + int32_t Continue(IFX_Pause* pPause); IFX_ScanlineComposer* m_pDest; const CFX_DIBSource* m_pSource; CStretchEngine* m_pStretchEngine; @@ -538,15 +538,15 @@ public: FX_LPBYTE m_pScanline; FX_LPBYTE m_pMaskScanline; FXDIB_Format m_DestFormat; - FX_INT32 m_Status; + int32_t m_Status; - FX_INT32 StartQuickStretch(); + int32_t StartQuickStretch(); - FX_INT32 StartStretch(); + int32_t StartStretch(); - FX_INT32 ContinueQuickStretch(IFX_Pause* pPause); + int32_t ContinueQuickStretch(IFX_Pause* pPause); - FX_INT32 ContinueStretch(IFX_Pause* pPause); + int32_t ContinueStretch(IFX_Pause* pPause); }; class CFX_ImageTransformer { @@ -556,10 +556,10 @@ public: ~CFX_ImageTransformer(); - FX_INT32 Start(const CFX_DIBSource* pSrc, const CFX_AffineMatrix* pMatrix, int flags, const FX_RECT* pClip); + int32_t Start(const CFX_DIBSource* pSrc, const CFX_AffineMatrix* pMatrix, int flags, const FX_RECT* pClip); - FX_INT32 Continue(IFX_Pause* pPause); + int32_t Continue(IFX_Pause* pPause); CFX_AffineMatrix* m_pMatrix; FX_RECT m_StretchClip; int m_ResultLeft, m_ResultTop, m_ResultWidth, m_ResultHeight; @@ -577,13 +577,13 @@ public: ~CFX_ImageRenderer(); - FX_INT32 Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClipRgn, + int32_t Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClipRgn, const CFX_DIBSource* pSource, int bitmap_alpha, FX_DWORD mask_color, const CFX_AffineMatrix* pMatrix, FX_DWORD dib_flags, FX_BOOL bRgbByteOrder = FALSE, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL); - FX_INT32 Continue(IFX_Pause* pPause); + int32_t Continue(IFX_Pause* pPause); protected: CFX_DIBitmap* m_pDevice; const CFX_ClipRgn* m_pClipRgn; diff --git a/core/include/fxge/fx_ge.h b/core/include/fxge/fx_ge.h index 60374eff45..a880166c39 100644 --- a/core/include/fxge/fx_ge.h +++ b/core/include/fxge/fx_ge.h @@ -65,7 +65,7 @@ protected: void InitPlatform(); void DestroyPlatform(); private: - FX_BYTE m_GammaValue[256]; + uint8_t m_GammaValue[256]; CFX_FontCache* m_pFontCache; CFX_FontMgr* m_pFontMgr; CCodec_ModuleMgr* m_pCodecModule; @@ -133,8 +133,8 @@ protected: void IntersectMaskRect(FX_RECT rect, FX_RECT mask_box, CFX_DIBitmapRef Mask); }; -extern const FX_BYTE g_GammaRamp[256]; -extern const FX_BYTE g_GammaInverse[256]; +extern const uint8_t g_GammaRamp[256]; +extern const uint8_t g_GammaInverse[256]; #define FX_GAMMA(value) (value) #define FX_GAMMA_INVERSE(value) (value) inline FX_ARGB ArgbGamma(FX_ARGB argb) diff --git a/core/include/fxge/fx_ge_apple.h b/core/include/fxge/fx_ge_apple.h index 90cd03455b..b22d31fa9f 100644 --- a/core/include/fxge/fx_ge_apple.h +++ b/core/include/fxge/fx_ge_apple.h @@ -13,9 +13,9 @@ class CFX_QuartzDevice : public CFX_RenderDevice public: CFX_QuartzDevice(); ~CFX_QuartzDevice(); - FX_BOOL Attach(CGContextRef context, FX_INT32 nDeviceClass = FXDC_DISPLAY); + FX_BOOL Attach(CGContextRef context, int32_t nDeviceClass = FXDC_DISPLAY); FX_BOOL Attach(CFX_DIBitmap* pBitmap); - FX_BOOL Create(FX_INT32 width, FX_INT32 height, FXDIB_Format format); + FX_BOOL Create(int32_t width, int32_t height, FXDIB_Format format); CGContextRef GetContext(); diff --git a/core/include/fxge/fx_ge_win32.h b/core/include/fxge/fx_ge_win32.h index c9cb2a35a9..3972090326 100644 --- a/core/include/fxge/fx_ge_win32.h +++ b/core/include/fxge/fx_ge_win32.h @@ -17,7 +17,7 @@ typedef struct WINDIB_Open_Args_ { int flags; - const FX_BYTE* memory_base; + const uint8_t* memory_base; size_t memory_size; diff --git a/core/include/reflow/fpdf_layout.h b/core/include/reflow/fpdf_layout.h index ebd879c764..b1038db329 100644 --- a/core/include/reflow/fpdf_layout.h +++ b/core/include/reflow/fpdf_layout.h @@ -252,7 +252,7 @@ typedef struct _LayoutProviderStyle { m_Language = LP_Lang_Unknow; m_bIgnoreInvisibleText = TRUE; } - FX_INT32 m_Language; + int32_t m_Language; FX_BOOL m_bIgnoreInvisibleText; } LAYOUTPROVIDER_STYLE; class IPDF_LayoutProvider diff --git a/core/include/reflow/reflowengine.h b/core/include/reflow/reflowengine.h index af3c943e97..30c7174053 100644 --- a/core/include/reflow/reflowengine.h +++ b/core/include/reflow/reflowengine.h @@ -22,11 +22,11 @@ public: virtual CFX_PrivateData* GetPrivateDataCtrl() = 0; - virtual void GetDisplayMatrix(CFX_AffineMatrix& matrix, FX_INT32 xPos, FX_INT32 yPos, FX_INT32 xSize, FX_INT32 ySize, FX_INT32 iRotate, const CFX_AffineMatrix* pPageMatrix) = 0; + virtual void GetDisplayMatrix(CFX_AffineMatrix& matrix, int32_t xPos, int32_t yPos, int32_t xSize, int32_t ySize, int32_t iRotate, const CFX_AffineMatrix* pPageMatrix) = 0; virtual FX_FLOAT GetPageHeight() = 0; virtual FX_FLOAT GetPageWidth() = 0; - virtual void FocusGetData(const CFX_AffineMatrix matrix, FX_INT32 x, FX_INT32 y, CFX_ByteString& str) = 0; - virtual FX_BOOL FocusGetPosition(const CFX_AffineMatrix matrix, CFX_ByteString str, FX_INT32& x, FX_INT32& y) = 0; + virtual void FocusGetData(const CFX_AffineMatrix matrix, int32_t x, int32_t y, CFX_ByteString& str) = 0; + virtual FX_BOOL FocusGetPosition(const CFX_AffineMatrix matrix, CFX_ByteString str, int32_t& x, int32_t& y) = 0; }; typedef struct _RF_ParseStyle { _RF_ParseStyle() diff --git a/core/src/fdrm/crypto/fx_crypt.cpp b/core/src/fdrm/crypto/fx_crypt.cpp index e67e5d7aab..da9fcc5693 100644 --- a/core/src/fdrm/crypto/fx_crypt.cpp +++ b/core/src/fdrm/crypto/fx_crypt.cpp @@ -62,23 +62,23 @@ void CRYPT_ArcFourCryptBlock(FX_LPBYTE pData, FX_DWORD size, FX_LPCBYTE key, FX_ struct md5_context { FX_DWORD total[2]; FX_DWORD state[4]; - FX_BYTE buffer[64]; + uint8_t buffer[64]; }; #define GET_FX_DWORD(n,b,i) \ { \ - (n) = (FX_DWORD) ((FX_BYTE *) b)[(i)] \ - | (((FX_DWORD) ((FX_BYTE *) b)[(i)+1]) << 8) \ - | (((FX_DWORD) ((FX_BYTE *) b)[(i)+2]) << 16) \ - | (((FX_DWORD) ((FX_BYTE *) b)[(i)+3]) << 24); \ + (n) = (FX_DWORD) ((uint8_t *) b)[(i)] \ + | (((FX_DWORD) ((uint8_t *) b)[(i)+1]) << 8) \ + | (((FX_DWORD) ((uint8_t *) b)[(i)+2]) << 16) \ + | (((FX_DWORD) ((uint8_t *) b)[(i)+3]) << 24); \ } #define PUT_FX_DWORD(n,b,i) \ { \ - (((FX_BYTE *) b)[(i)] ) = (FX_BYTE) (((n) ) & 0xFF); \ - (((FX_BYTE *) b)[(i)+1]) = (FX_BYTE) (((n) >> 8) & 0xFF); \ - (((FX_BYTE *) b)[(i)+2]) = (FX_BYTE) (((n) >> 16) & 0xFF); \ - (((FX_BYTE *) b)[(i)+3]) = (FX_BYTE) (((n) >> 24) & 0xFF); \ + (((uint8_t *) b)[(i)] ) = (uint8_t) (((n) ) & 0xFF); \ + (((uint8_t *) b)[(i)+1]) = (uint8_t) (((n) >> 8) & 0xFF); \ + (((uint8_t *) b)[(i)+2]) = (uint8_t) (((n) >> 16) & 0xFF); \ + (((uint8_t *) b)[(i)+3]) = (uint8_t) (((n) >> 24) & 0xFF); \ } -void md5_process( struct md5_context *ctx, const FX_BYTE data[64] ) +void md5_process( struct md5_context *ctx, const uint8_t data[64] ) { FX_DWORD A, B, C, D, X[16]; GET_FX_DWORD( X[0], data, 0 ); @@ -222,17 +222,17 @@ void CRYPT_MD5Update(FX_LPVOID pctx, FX_LPCBYTE input, FX_DWORD length ) FXSYS_memcpy32( (void *) (ctx->buffer + left), (void *) input, length ); } } -const FX_BYTE md5_padding[64] = { +const uint8_t md5_padding[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -void CRYPT_MD5Finish(FX_LPVOID pctx, FX_BYTE digest[16] ) +void CRYPT_MD5Finish(FX_LPVOID pctx, uint8_t digest[16] ) { struct md5_context *ctx = (struct md5_context *)pctx; FX_DWORD last, padn; - FX_BYTE msglen[8]; + uint8_t msglen[8]; PUT_FX_DWORD( ctx->total[0], msglen, 0 ); PUT_FX_DWORD( ctx->total[1], msglen, 4 ); last = ( ctx->total[0] >> 3 ) & 0x3F; @@ -244,7 +244,7 @@ void CRYPT_MD5Finish(FX_LPVOID pctx, FX_BYTE digest[16] ) PUT_FX_DWORD( ctx->state[2], digest, 8 ); PUT_FX_DWORD( ctx->state[3], digest, 12 ); } -void CRYPT_MD5Generate(FX_LPCBYTE input, FX_DWORD length, FX_BYTE digest[16]) +void CRYPT_MD5Generate(FX_LPCBYTE input, FX_DWORD length, uint8_t digest[16]) { md5_context ctx; CRYPT_MD5Start(&ctx); diff --git a/core/src/fdrm/crypto/fx_crypt_sha.cpp b/core/src/fdrm/crypto/fx_crypt_sha.cpp index 4e931b2d03..1a55d11633 100644 --- a/core/src/fdrm/crypto/fx_crypt_sha.cpp +++ b/core/src/fdrm/crypto/fx_crypt_sha.cpp @@ -121,7 +121,7 @@ void CRYPT_SHA1Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size) s->blkused = len; } } -void CRYPT_SHA1Finish(FX_LPVOID context, FX_BYTE digest[20]) +void CRYPT_SHA1Finish(FX_LPVOID context, uint8_t digest[20]) { SHA_State * s = (SHA_State*)context; int i; @@ -154,7 +154,7 @@ void CRYPT_SHA1Finish(FX_LPVOID context, FX_BYTE digest[20]) digest[i * 4 + 3] = (s->h[i]) & 0xFF; } } -void CRYPT_SHA1Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[20]) +void CRYPT_SHA1Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[20]) { SHA_State s; CRYPT_SHA1Start(&s); @@ -164,7 +164,7 @@ void CRYPT_SHA1Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[20]) typedef struct { FX_DWORD total[2]; FX_DWORD state[8]; - FX_BYTE buffer[64]; + uint8_t buffer[64]; } sha256_context; #define GET_FX_DWORD(n,b,i) \ @@ -176,10 +176,10 @@ sha256_context; } #define PUT_FX_DWORD(n,b,i) \ { \ - (b)[(i) ] = (FX_BYTE) ( (n) >> 24 ); \ - (b)[(i) + 1] = (FX_BYTE) ( (n) >> 16 ); \ - (b)[(i) + 2] = (FX_BYTE) ( (n) >> 8 ); \ - (b)[(i) + 3] = (FX_BYTE) ( (n) ); \ + (b)[(i) ] = (uint8_t) ( (n) >> 24 ); \ + (b)[(i) + 1] = (uint8_t) ( (n) >> 16 ); \ + (b)[(i) + 2] = (uint8_t) ( (n) >> 8 ); \ + (b)[(i) + 3] = (uint8_t) ( (n) ); \ } void CRYPT_SHA256Start( FX_LPVOID context ) { @@ -195,7 +195,7 @@ void CRYPT_SHA256Start( FX_LPVOID context ) ctx->state[6] = 0x1F83D9AB; ctx->state[7] = 0x5BE0CD19; } -static void sha256_process( sha256_context *ctx, const FX_BYTE data[64] ) +static void sha256_process( sha256_context *ctx, const uint8_t data[64] ) { FX_DWORD temp1, temp2, W[64]; FX_DWORD A, B, C, D, E, F, G, H; @@ -347,18 +347,18 @@ void CRYPT_SHA256Update( void* context, FX_LPCBYTE input, FX_DWORD length ) (void *) input, length ); } } -static const FX_BYTE sha256_padding[64] = { +static const uint8_t sha256_padding[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -void CRYPT_SHA256Finish( FX_LPVOID context, FX_BYTE digest[32] ) +void CRYPT_SHA256Finish( FX_LPVOID context, uint8_t digest[32] ) { sha256_context *ctx = (sha256_context *)context; FX_DWORD last, padn; FX_DWORD high, low; - FX_BYTE msglen[8]; + uint8_t msglen[8]; high = ( ctx->total[0] >> 29 ) | ( ctx->total[1] << 3 ); low = ( ctx->total[0] << 3 ); @@ -377,7 +377,7 @@ void CRYPT_SHA256Finish( FX_LPVOID context, FX_BYTE digest[32] ) PUT_FX_DWORD( ctx->state[6], digest, 24 ); PUT_FX_DWORD( ctx->state[7], digest, 28 ); } -void CRYPT_SHA256Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[32]) +void CRYPT_SHA256Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[32]) { sha256_context ctx; CRYPT_SHA256Start(&ctx); @@ -385,14 +385,14 @@ void CRYPT_SHA256Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[32]) CRYPT_SHA256Finish(&ctx, digest); } typedef struct { - FX_UINT64 total[2]; - FX_UINT64 state[8]; - FX_BYTE buffer[128]; + uint64_t total[2]; + uint64_t state[8]; + uint8_t buffer[128]; } sha384_context; -FX_UINT64 FX_ato64i(FX_LPCSTR str) +uint64_t FX_ato64i(FX_LPCSTR str) { FXSYS_assert(str != NULL); - FX_UINT64 ret = 0; + uint64_t ret = 0; int len = (int)FXSYS_strlen(str); len = len > 16 ? 16 : len; for (int i = 0; i < len; ++i) { @@ -441,7 +441,7 @@ void CRYPT_SHA384Start(FX_LPVOID context) temp2 = SHA384_S2(a) + SHA384_F0(a,b,c); \ d += temp1; h = temp1 + temp2; \ } -static const FX_BYTE sha384_padding[128] = { +static const uint8_t sha384_padding[128] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -536,31 +536,31 @@ static FX_LPCSTR constants[] = { }; #define GET_FX_64WORD(n,b,i) \ { \ - (n) = ( (FX_UINT64) (b)[(i) ] << 56 ) \ - | ( (FX_UINT64) (b)[(i) + 1] << 48 ) \ - | ( (FX_UINT64) (b)[(i) + 2] << 40 ) \ - | ( (FX_UINT64) (b)[(i) + 3] << 32 ) \ - | ( (FX_UINT64) (b)[(i) + 4] << 24 ) \ - | ( (FX_UINT64) (b)[(i) + 5] << 16 ) \ - | ( (FX_UINT64) (b)[(i) + 6] << 8 ) \ - | ( (FX_UINT64) (b)[(i) + 7] ); \ + (n) = ( (uint64_t) (b)[(i) ] << 56 ) \ + | ( (uint64_t) (b)[(i) + 1] << 48 ) \ + | ( (uint64_t) (b)[(i) + 2] << 40 ) \ + | ( (uint64_t) (b)[(i) + 3] << 32 ) \ + | ( (uint64_t) (b)[(i) + 4] << 24 ) \ + | ( (uint64_t) (b)[(i) + 5] << 16 ) \ + | ( (uint64_t) (b)[(i) + 6] << 8 ) \ + | ( (uint64_t) (b)[(i) + 7] ); \ } #define PUT_FX_64DWORD(n,b,i) \ { \ - (b)[(i) ] = (FX_BYTE) ( (n) >> 56 ); \ - (b)[(i) + 1] = (FX_BYTE) ( (n) >> 48 ); \ - (b)[(i) + 2] = (FX_BYTE) ( (n) >> 40 ); \ - (b)[(i) + 3] = (FX_BYTE) ( (n) >> 32 ); \ - (b)[(i) + 4] = (FX_BYTE) ( (n) >> 24 ); \ - (b)[(i) + 5] = (FX_BYTE) ( (n) >> 16 ); \ - (b)[(i) + 6] = (FX_BYTE) ( (n) >> 8 ); \ - (b)[(i) + 7] = (FX_BYTE) ( (n) ); \ + (b)[(i) ] = (uint8_t) ( (n) >> 56 ); \ + (b)[(i) + 1] = (uint8_t) ( (n) >> 48 ); \ + (b)[(i) + 2] = (uint8_t) ( (n) >> 40 ); \ + (b)[(i) + 3] = (uint8_t) ( (n) >> 32 ); \ + (b)[(i) + 4] = (uint8_t) ( (n) >> 24 ); \ + (b)[(i) + 5] = (uint8_t) ( (n) >> 16 ); \ + (b)[(i) + 6] = (uint8_t) ( (n) >> 8 ); \ + (b)[(i) + 7] = (uint8_t) ( (n) ); \ } -static void sha384_process( sha384_context *ctx, const FX_BYTE data[128] ) +static void sha384_process( sha384_context *ctx, const uint8_t data[128] ) { - FX_UINT64 temp1, temp2; - FX_UINT64 A, B, C, D, E, F, G, H; - FX_UINT64 W[80]; + uint64_t temp1, temp2; + uint64_t A, B, C, D, E, F, G, H; + uint64_t W[80]; GET_FX_64WORD(W[0], data, 0); GET_FX_64WORD(W[1], data, 8); GET_FX_64WORD(W[2], data, 16); @@ -586,7 +586,7 @@ static void sha384_process( sha384_context *ctx, const FX_BYTE data[128] ) G = ctx->state[6]; H = ctx->state[7]; for (int i = 0; i < 10; ++i) { - FX_UINT64 temp[8]; + uint64_t temp[8]; if (i < 2) { temp[0] = W[i * 8]; temp[1] = W[i * 8 + 1]; @@ -655,13 +655,13 @@ void CRYPT_SHA384Update(FX_LPVOID context, FX_LPCBYTE input, FX_DWORD length) (void *) input, length ); } } -void CRYPT_SHA384Finish(FX_LPVOID context, FX_BYTE digest[48]) +void CRYPT_SHA384Finish(FX_LPVOID context, uint8_t digest[48]) { sha384_context *ctx = (sha384_context *)context; FX_DWORD last, padn; - FX_BYTE msglen[16]; + uint8_t msglen[16]; FXSYS_memset32(msglen, 0, 16); - FX_UINT64 high, low; + uint64_t high, low; high = ( ctx->total[0] >> 29 ) | ( ctx->total[1] << 3 ); low = ( ctx->total[0] << 3 ); @@ -678,7 +678,7 @@ void CRYPT_SHA384Finish(FX_LPVOID context, FX_BYTE digest[48]) PUT_FX_64DWORD(ctx->state[4], digest, 32); PUT_FX_64DWORD(ctx->state[5], digest, 40); } -void CRYPT_SHA384Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[64]) +void CRYPT_SHA384Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[64]) { sha384_context context; CRYPT_SHA384Start(&context); @@ -705,13 +705,13 @@ void CRYPT_SHA512Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size) { CRYPT_SHA384Update(context, data, size); } -void CRYPT_SHA512Finish(FX_LPVOID context, FX_BYTE digest[64]) +void CRYPT_SHA512Finish(FX_LPVOID context, uint8_t digest[64]) { sha384_context *ctx = (sha384_context *)context; FX_DWORD last, padn; - FX_BYTE msglen[16]; + uint8_t msglen[16]; FXSYS_memset32(msglen, 0, 16); - FX_UINT64 high, low; + uint64_t high, low; high = ( ctx->total[0] >> 29 ) | ( ctx->total[1] << 3 ); low = ( ctx->total[0] << 3 ); @@ -730,7 +730,7 @@ void CRYPT_SHA512Finish(FX_LPVOID context, FX_BYTE digest[64]) PUT_FX_64DWORD(ctx->state[6], digest, 48); PUT_FX_64DWORD(ctx->state[7], digest, 56); } -void CRYPT_SHA512Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[64]) +void CRYPT_SHA512Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[64]) { sha384_context context; CRYPT_SHA512Start(&context); diff --git a/core/src/fpdfapi/fpdf_edit/editint.h b/core/src/fpdfapi/fpdf_edit/editint.h index faa23f929d..38c33439ec 100644 --- a/core/src/fpdfapi/fpdf_edit/editint.h +++ b/core/src/fpdfapi/fpdf_edit/editint.h @@ -14,8 +14,8 @@ public: FX_BOOL Start(); - FX_INT32 CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj); - FX_INT32 CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize); + int32_t CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj); + int32_t CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize); FX_FILESIZE End(CPDF_Creator* pCreator); @@ -23,7 +23,7 @@ public: CFX_ByteTextBuf m_Buffer; FX_DWORD m_dwObjNum; - FX_INT32 m_index; + int32_t m_index; protected: CFX_DWordArray m_OffsetArray; @@ -36,9 +36,9 @@ public: FX_BOOL Start(); - FX_INT32 CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj, CPDF_Creator *pCreator); + int32_t CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj, CPDF_Creator *pCreator); - FX_INT32 CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator); + int32_t CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator); FX_BOOL End(CPDF_Creator *pCreator, FX_BOOL bEOF = FALSE); FX_BOOL AddObjectNumberToIndexArray(FX_DWORD objnum); @@ -51,9 +51,9 @@ public: FX_DWORD m_dwTempObjNum; protected: - FX_INT32 EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF = TRUE); + int32_t EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF = TRUE); FX_BOOL GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF); - FX_INT32 m_iSeg; + int32_t m_iSeg; CPDF_ObjectStream m_ObjStream; CFX_ByteTextBuf m_Buffer; }; diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp index b64151ad06..65b482bf30 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp @@ -142,7 +142,7 @@ void CPDF_PageContentGenerate::TransformContent(CFX_Matrix& matrix) size += pContentArray[i]->GetSize() + 1; } int pos = 0; - FX_LPBYTE pBuf = FX_Alloc(FX_BYTE, size); + FX_LPBYTE pBuf = FX_Alloc(uint8_t, size); for (i = 0; i < iCount; ++i) { FXSYS_memcpy32(pBuf + pos, pContentArray[i]->GetData(), pContentArray[i]->GetSize()); pos += pContentArray[i]->GetSize() + 1; diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp index 3abbcee046..035baa398f 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp @@ -8,13 +8,13 @@ #include "editint.h" #define PDF_OBJECTSTREAM_MAXLENGTH (256 * 1024) #define PDF_XREFSTREAM_MAXSIZE 10000 -extern void FlateEncode(const FX_BYTE* src_buf, FX_DWORD src_data, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); +extern void FlateEncode(const uint8_t* src_buf, FX_DWORD src_data, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); extern void FlateEncode(FX_LPCBYTE src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); extern FX_BOOL IsSignatureDict(const CPDF_Dictionary* pDict); -FX_INT32 PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive *pFile, FX_FILESIZE& offset) +int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive *pFile, FX_FILESIZE& offset) { - FX_INT32 len = 0; + int32_t len = 0; if (pObj == NULL) { if (pFile->AppendString(FX_BSTRC(" null")) < 0) { return -1; @@ -171,10 +171,10 @@ FX_INT32 PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive } return 1; } -FX_INT32 PDF_CreatorWriteTrailer(CPDF_Document* pDocument, CFX_FileBufferArchive* pFile, CPDF_Array* pIDArray, FX_BOOL bCompress) +int32_t PDF_CreatorWriteTrailer(CPDF_Document* pDocument, CFX_FileBufferArchive* pFile, CPDF_Array* pIDArray, FX_BOOL bCompress) { FX_FILESIZE offset = 0; - FX_INT32 len = 0; + int32_t len = 0; FXSYS_assert(pDocument && pFile); CPDF_Parser *pParser = (CPDF_Parser*)pDocument->GetParser(); if (pParser) { @@ -259,14 +259,14 @@ FX_INT32 PDF_CreatorWriteTrailer(CPDF_Document* pDocument, CFX_FileBufferArchive } return offset; } -FX_INT32 PDF_CreatorWriteEncrypt(const CPDF_Dictionary* pEncryptDict, FX_DWORD dwObjNum, CFX_FileBufferArchive *pFile) +int32_t PDF_CreatorWriteEncrypt(const CPDF_Dictionary* pEncryptDict, FX_DWORD dwObjNum, CFX_FileBufferArchive *pFile) { if (!pEncryptDict) { return 0; } FXSYS_assert(pFile); FX_FILESIZE offset = 0; - FX_INT32 len = 0; + int32_t len = 0; if (pFile->AppendString(FX_BSTRC("/Encrypt")) < 0) { return -1; } @@ -289,7 +289,7 @@ FX_BOOL PDF_GenerateFileID(FX_DWORD dwSeed1, FX_DWORD dwSeed2, FX_LPDWORD pBuffe return FALSE; } FX_LPVOID pContext = FX_Random_MT_Start(dwSeed1); - FX_INT32 i = 0; + int32_t i = 0; for (i = 0; i < 2; i++) { *pBuffer++ = FX_Random_MT_Generate(pContext); } @@ -414,7 +414,7 @@ FX_BOOL CPDF_Encryptor::Initialize(CPDF_CryptoHandler* pHandler, int objnum, FX_ return TRUE; } m_dwSize = pHandler->EncryptGetSize(objnum, 0, src_data, src_size); - m_pData = FX_Alloc(FX_BYTE, m_dwSize); + m_pData = FX_Alloc(uint8_t, m_dwSize); pHandler->EncryptContent(objnum, 0, src_data, src_size, m_pData, m_dwSize); m_bNewBuf = TRUE; return TRUE; @@ -439,14 +439,14 @@ FX_BOOL CPDF_ObjectStream::Start() m_index = 0; return TRUE; } -FX_INT32 CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj) +int32_t CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj) { m_ObjNumArray.Add(dwObjNum); m_OffsetArray.Add(m_Buffer.GetLength()); m_Buffer << pObj; return 1; } -FX_INT32 CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize) +int32_t CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize) { m_ObjNumArray.Add(dwObjNum); m_OffsetArray.Add(m_Buffer.GetLength()); @@ -466,12 +466,12 @@ FX_FILESIZE CPDF_ObjectStream::End(CPDF_Creator* pCreator) m_dwObjNum = ++pCreator->m_dwLastObjNum; } CFX_ByteTextBuf tempBuffer; - FX_INT32 iCount = m_ObjNumArray.GetSize(); - for (FX_INT32 i = 0; i < iCount; i++) { + int32_t iCount = m_ObjNumArray.GetSize(); + for (int32_t i = 0; i < iCount; i++) { tempBuffer << m_ObjNumArray.ElementAt(i) << FX_BSTRC(" ") << m_OffsetArray.ElementAt(i) << FX_BSTRC(" "); } FX_FILESIZE &offset = pCreator->m_Offset; - FX_INT32 len = pFile->AppendDWord(m_dwObjNum); + int32_t len = pFile->AppendDWord(m_dwObjNum); if (len < 0) { return -1; } @@ -552,7 +552,7 @@ FX_BOOL CPDF_XRefStream::Start() m_iSeg = 0; return TRUE; } -FX_INT32 CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj, CPDF_Creator *pCreator) +int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj, CPDF_Creator *pCreator) { if (!pCreator) { return 0; @@ -564,7 +564,7 @@ FX_INT32 CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_O } return EndObjectStream(pCreator); } -FX_INT32 CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator) +int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator) { if (!pCreator) { return 0; @@ -601,7 +601,7 @@ static void _AppendIndex1(CFX_ByteTextBuf& buffer, FX_FILESIZE offset) buffer.AppendByte(0); buffer.AppendByte(0); } -static void _AppendIndex2(CFX_ByteTextBuf& buffer, FX_DWORD objnum, FX_INT32 index) +static void _AppendIndex2(CFX_ByteTextBuf& buffer, FX_DWORD objnum, int32_t index) { buffer.AppendByte(2); buffer.AppendByte(FX_GETBYTEOFFSET24(objnum)); @@ -611,7 +611,7 @@ static void _AppendIndex2(CFX_ByteTextBuf& buffer, FX_DWORD objnum, FX_INT32 ind buffer.AppendByte(FX_GETBYTEOFFSET8(index)); buffer.AppendByte(FX_GETBYTEOFFSET0(index)); } -FX_INT32 CPDF_XRefStream::EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF) +int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF) { FX_FILESIZE objOffset = 0; if (bEOF) { @@ -624,8 +624,8 @@ FX_INT32 CPDF_XRefStream::EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF) if (!dwObjStmNum) { dwObjStmNum = ++pCreator->m_dwLastObjNum; } - FX_INT32 iSize = m_ObjStream.m_ObjNumArray.GetSize(); - FX_INT32 iSeg = m_IndexArray.GetSize() / 2; + int32_t iSize = m_ObjStream.m_ObjNumArray.GetSize(); + int32_t iSeg = m_IndexArray.GetSize() / 2; if (!(pCreator->m_dwFlags & FPDFCREATE_INCREMENTAL)) { if (m_dwTempObjNum == 0) { _AppendIndex0(m_Buffer); @@ -656,7 +656,7 @@ FX_INT32 CPDF_XRefStream::EndObjectStream(CPDF_Creator *pCreator, FX_BOOL bEOF) } return 1; } - FX_INT32 &j = m_ObjStream.m_index; + int32_t &j = m_ObjStream.m_index; for (int i = m_iSeg; i < iSeg; i++) { FX_DWORD start = m_IndexArray.ElementAt(i * 2); FX_DWORD end = m_IndexArray.ElementAt(i * 2 + 1) + start; @@ -700,7 +700,7 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF } _AppendIndex1(m_Buffer, offset_tmp); FX_FILESIZE &offset = pCreator->m_Offset; - FX_INT32 len = pFile->AppendDWord(objnum); + int32_t len = pFile->AppendDWord(objnum); if (len < 0) { return FALSE; } @@ -722,8 +722,8 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF } offset += len; } else { - FX_INT32 iSeg = m_IndexArray.GetSize() / 2; - for (FX_INT32 i = 0; i < iSeg; i++) { + int32_t iSeg = m_IndexArray.GetSize() / 2; + for (int32_t i = 0; i < iSeg; i++) { if ((len = pFile->AppendDWord(m_IndexArray.ElementAt(i * 2))) < 0) { return FALSE; } @@ -754,7 +754,7 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF FX_CHAR offset_buf[20]; FXSYS_memset32(offset_buf, 0, sizeof(offset_buf)); FXSYS_i64toa(m_PrevOffset, offset_buf, 10); - FX_INT32 len = (FX_INT32)FXSYS_strlen(offset_buf); + int32_t len = (int32_t)FXSYS_strlen(offset_buf); if (pFile->AppendBlock(offset_buf, len) < 0) { return -1; } @@ -832,7 +832,7 @@ FX_BOOL CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator) } } } else { - FX_INT32 iSeg = m_IndexArray.GetSize() / 2; + int32_t iSeg = m_IndexArray.GetSize() / 2; for (int i = 0; i < iSeg; i++) { FX_DWORD start = m_IndexArray.ElementAt(i * 2); FX_DWORD end = m_IndexArray.ElementAt(i * 2 + 1) + start; @@ -845,14 +845,14 @@ FX_BOOL CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator) } FX_BOOL CPDF_XRefStream::AddObjectNumberToIndexArray(FX_DWORD objnum) { - FX_INT32 iSize = m_IndexArray.GetSize(); + int32_t iSize = m_IndexArray.GetSize(); if (iSize == 0) { m_IndexArray.Add(objnum); m_IndexArray.Add(1); } else { FXSYS_assert(iSize > 1); FX_DWORD startobjnum = m_IndexArray.ElementAt(iSize - 2); - FX_INT32 iCount = m_IndexArray.ElementAt(iSize - 1); + int32_t iCount = m_IndexArray.ElementAt(iSize - 1); if (objnum == startobjnum + iCount) { m_IndexArray[iSize - 1] = iCount + 1; } else { @@ -906,20 +906,20 @@ static FX_BOOL _IsXRefNeedEnd(CPDF_XRefStream* pXRef, FX_DWORD flag) if (!(flag & FPDFCREATE_INCREMENTAL)) { return FALSE; } - FX_INT32 iSize = pXRef->m_IndexArray.GetSize() / 2; - FX_INT32 iCount = 0; - for (FX_INT32 i = 0; i < iSize; i++) { + int32_t iSize = pXRef->m_IndexArray.GetSize() / 2; + int32_t iCount = 0; + for (int32_t i = 0; i < iSize; i++) { iCount += pXRef->m_IndexArray.ElementAt(i * 2 + 1); } return (iCount >= PDF_XREFSTREAM_MAXSIZE); } -FX_INT32 CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) +int32_t CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) { if (!m_pXRefStream) { return 1; } FX_DWORD objnum = pObj->GetObjNum(); - if (m_pParser && m_pParser->m_ObjVersion.GetSize() > (FX_INT32)objnum && m_pParser->m_ObjVersion[objnum] > 0) { + if (m_pParser && m_pParser->m_ObjVersion.GetSize() > (int32_t)objnum && m_pParser->m_ObjVersion[objnum] > 0) { return 1; } if (pObj->GetType() == PDFOBJ_NUMBER) { @@ -958,13 +958,13 @@ FX_INT32 CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) } return 0; } -FX_INT32 CPDF_Creator::WriteIndirectObjectToStream(FX_DWORD objnum, FX_LPCBYTE pBuffer, FX_DWORD dwSize) +int32_t CPDF_Creator::WriteIndirectObjectToStream(FX_DWORD objnum, FX_LPCBYTE pBuffer, FX_DWORD dwSize) { if (!m_pXRefStream) { return 1; } m_pXRefStream->AddObjectNumberToIndexArray(objnum); - FX_INT32 iRet = m_pXRefStream->CompressIndirectObject(objnum, pBuffer, dwSize, this); + int32_t iRet = m_pXRefStream->CompressIndirectObject(objnum, pBuffer, dwSize, this); if (iRet < 1) { return iRet; } @@ -979,7 +979,7 @@ FX_INT32 CPDF_Creator::WriteIndirectObjectToStream(FX_DWORD objnum, FX_LPCBYTE p } return 0; } -FX_INT32 CPDF_Creator::AppendObjectNumberToXRef(FX_DWORD objnum) +int32_t CPDF_Creator::AppendObjectNumberToXRef(FX_DWORD objnum) { if (!m_pXRefStream) { return 1; @@ -996,7 +996,7 @@ FX_INT32 CPDF_Creator::AppendObjectNumberToXRef(FX_DWORD objnum) } return 0; } -FX_INT32 CPDF_Creator::WriteStream(const CPDF_Object* pStream, FX_DWORD objnum, CPDF_CryptoHandler* pCrypto) +int32_t CPDF_Creator::WriteStream(const CPDF_Object* pStream, FX_DWORD objnum, CPDF_CryptoHandler* pCrypto) { CPDF_FlateEncoder encoder; encoder.Initialize((CPDF_Stream*)pStream, pStream == m_pMetadata ? FALSE : m_bCompress); @@ -1026,9 +1026,9 @@ FX_INT32 CPDF_Creator::WriteStream(const CPDF_Object* pStream, FX_DWORD objnum, m_Offset += len; return 1; } -FX_INT32 CPDF_Creator::WriteIndirectObj(FX_DWORD objnum, const CPDF_Object* pObj) +int32_t CPDF_Creator::WriteIndirectObj(FX_DWORD objnum, const CPDF_Object* pObj) { - FX_INT32 len = m_File.AppendDWord(objnum); + int32_t len = m_File.AppendDWord(objnum); if (len < 0) { return -1; } @@ -1057,17 +1057,17 @@ FX_INT32 CPDF_Creator::WriteIndirectObj(FX_DWORD objnum, const CPDF_Object* pObj } return 0; } -FX_INT32 CPDF_Creator::WriteIndirectObj(const CPDF_Object* pObj) +int32_t CPDF_Creator::WriteIndirectObj(const CPDF_Object* pObj) { - FX_INT32 iRet = WriteIndirectObjectToStream(pObj); + int32_t iRet = WriteIndirectObjectToStream(pObj); if (iRet < 1) { return iRet; } return WriteIndirectObj(pObj->GetObjNum(), pObj); } -FX_INT32 CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, FX_BOOL bEncrypt) +int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, FX_BOOL bEncrypt) { - FX_INT32 len = 0; + int32_t len = 0; if (pObj == NULL) { if (m_File.AppendString(FX_BSTRC(" null")) < 0) { return -1; @@ -1246,14 +1246,14 @@ FX_INT32 CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, } return 1; } -FX_INT32 CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) +int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) { if(m_pParser->m_V5Type[objnum] == 0 || m_pParser->m_V5Type[objnum] == 255) { return 0; } m_ObjectOffset[objnum] = m_Offset; FX_LPVOID valuetemp = NULL; - FX_BOOL bExistInMap = m_pDocument->m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, valuetemp); + FX_BOOL bExistInMap = m_pDocument->m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, valuetemp); FX_BOOL bObjStm = (m_pParser->m_V5Type[objnum] == 2) && m_pEncryptDict && !m_pXRefStream; if(m_pParser->m_bVersionUpdated || m_bSecurityChanged || bExistInMap || bObjStm) { CPDF_Object* pObj = m_pDocument->GetIndirectObject(objnum); @@ -1269,7 +1269,7 @@ FX_INT32 CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) m_pDocument->ReleaseIndirectObject(objnum); } } else { - FX_BYTE* pBuffer; + uint8_t* pBuffer; FX_DWORD size; m_pParser->GetIndirectBinary(objnum, pBuffer, size); if (pBuffer == NULL) { @@ -1282,7 +1282,7 @@ FX_INT32 CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) return -1; } } else { - FX_INT32 len = m_File.AppendDWord(objnum); + int32_t len = m_File.AppendDWord(objnum); if (len < 0) { return -1; } @@ -1312,12 +1312,12 @@ FX_INT32 CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) } return 1; } -FX_INT32 CPDF_Creator::WriteOldObjs(IFX_Pause *pPause) +int32_t CPDF_Creator::WriteOldObjs(IFX_Pause *pPause) { FX_DWORD nOldSize = m_pParser->m_CrossRef.GetSize(); - FX_DWORD objnum = (FX_DWORD)(FX_UINTPTR)m_Pos; + FX_DWORD objnum = (FX_DWORD)(uintptr_t)m_Pos; for(; objnum < nOldSize; objnum ++) { - FX_INT32 iRet = WriteOldIndirectObject(objnum); + int32_t iRet = WriteOldIndirectObject(objnum); if (!iRet) { continue; } @@ -1326,20 +1326,20 @@ FX_INT32 CPDF_Creator::WriteOldObjs(IFX_Pause *pPause) } m_ObjectSize[objnum] = (FX_DWORD)(m_Offset - m_ObjectOffset[objnum]); if (pPause && pPause->NeedToPauseNow()) { - m_Pos = (FX_LPVOID)(FX_UINTPTR)(objnum + 1); + m_Pos = (FX_LPVOID)(uintptr_t)(objnum + 1); return 1; } } return 0; } -FX_INT32 CPDF_Creator::WriteNewObjs(FX_BOOL bIncremental, IFX_Pause *pPause) +int32_t CPDF_Creator::WriteNewObjs(FX_BOOL bIncremental, IFX_Pause *pPause) { - FX_INT32 iCount = m_NewObjNumArray.GetSize(); - FX_INT32 index = (FX_INT32)(FX_UINTPTR)m_Pos; + int32_t iCount = m_NewObjNumArray.GetSize(); + int32_t index = (int32_t)(uintptr_t)m_Pos; while (index < iCount) { FX_DWORD objnum = m_NewObjNumArray.ElementAt(index); CPDF_Object *pObj = NULL; - m_pDocument->m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, (FX_LPVOID&)pObj); + m_pDocument->m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, (FX_LPVOID&)pObj); if (NULL == pObj) { ++index; continue; @@ -1351,7 +1351,7 @@ FX_INT32 CPDF_Creator::WriteNewObjs(FX_BOOL bIncremental, IFX_Pause *pPause) m_ObjectSize[objnum] = (FX_DWORD)(m_Offset - m_ObjectOffset[objnum]); index++; if (pPause && pPause->NeedToPauseNow()) { - m_Pos = (FX_POSITION)(FX_UINTPTR)index; + m_Pos = (FX_POSITION)(uintptr_t)index; return 1; } } @@ -1406,11 +1406,11 @@ void CPDF_Creator::InitNewObjNumOffsets() } AppendNewObjNum(objnum); } - FX_INT32 iCount = m_NewObjNumArray.GetSize(); + int32_t iCount = m_NewObjNumArray.GetSize(); if (iCount == 0) { return; } - FX_INT32 i = 0; + int32_t i = 0; FX_DWORD dwStartObjNum = 0; FX_BOOL bCrossRefValid = m_pParser && m_pParser->GetLastXRefOffset() > 0; while (i < iCount) { @@ -1447,10 +1447,10 @@ void CPDF_Creator::InitNewObjNumOffsets() } void CPDF_Creator::AppendNewObjNum(FX_DWORD objbum) { - FX_INT32 iStart = 0, iFind = 0; - FX_INT32 iEnd = m_NewObjNumArray.GetUpperBound(); + int32_t iStart = 0, iFind = 0; + int32_t iEnd = m_NewObjNumArray.GetUpperBound(); while (iStart <= iEnd) { - FX_INT32 iMid = (iStart + iEnd) / 2; + int32_t iMid = (iStart + iEnd) / 2; FX_DWORD dwMid = m_NewObjNumArray.ElementAt(iMid); if (objbum < dwMid) { iEnd = iMid - 1; @@ -1469,7 +1469,7 @@ void CPDF_Creator::AppendNewObjNum(FX_DWORD objbum) } m_NewObjNumArray.InsertAt(iFind, objbum); } -FX_INT32 CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause) +int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause) { FXSYS_assert(m_iStage > -1 || m_iStage < 20); if (m_iStage == 0) { @@ -1497,13 +1497,13 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause) return -1; } m_Offset += 7; - FX_INT32 version = 7; + int32_t version = 7; if (m_FileVersion) { version = m_FileVersion; } else if (m_pParser) { version = m_pParser->GetFileVersion(); } - FX_INT32 len = m_File.AppendDWord(version % 10); + int32_t len = m_File.AppendDWord(version % 10); if (len < 0) { return -1; } @@ -1517,15 +1517,15 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause) } else { IFX_FileRead* pSrcFile = m_pParser->GetFileAccess(); m_Offset = pSrcFile->GetSize(); - m_Pos = (FX_LPVOID)(FX_UINTPTR)m_Offset; + m_Pos = (FX_LPVOID)(uintptr_t)m_Offset; m_iStage = 15; } } if (m_iStage == 15) { if ((m_dwFlags & FPDFCREATE_NO_ORIGINAL) == 0 && m_Pos) { IFX_FileRead* pSrcFile = m_pParser->GetFileAccess(); - FX_BYTE buffer[4096]; - FX_DWORD src_size = (FX_DWORD)(FX_UINTPTR)m_Pos; + uint8_t buffer[4096]; + FX_DWORD src_size = (FX_DWORD)(uintptr_t)m_Pos; while (src_size) { FX_DWORD block_size = src_size > 4096 ? 4096 : src_size; if (!pSrcFile->ReadBlock(buffer, m_Offset - src_size, block_size)) { @@ -1536,7 +1536,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause) } src_size -= block_size; if (pPause && pPause->NeedToPauseNow()) { - m_Pos = (FX_LPVOID)(FX_UINTPTR)src_size; + m_Pos = (FX_LPVOID)(uintptr_t)src_size; return 1; } } @@ -1564,30 +1564,30 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause) InitNewObjNumOffsets(); return m_iStage; } -FX_INT32 CPDF_Creator::WriteDoc_Stage2(IFX_Pause *pPause) +int32_t CPDF_Creator::WriteDoc_Stage2(IFX_Pause *pPause) { FXSYS_assert(m_iStage >= 20 || m_iStage < 30); if (m_iStage == 20) { if ((m_dwFlags & FPDFCREATE_INCREMENTAL) == 0 && m_pParser) { - m_Pos = (FX_LPVOID)(FX_UINTPTR)0; + m_Pos = (FX_LPVOID)(uintptr_t)0; m_iStage = 21; } else { m_iStage = 25; } } if (m_iStage == 21) { - FX_INT32 iRet = WriteOldObjs(pPause); + int32_t iRet = WriteOldObjs(pPause); if (iRet) { return iRet; } m_iStage = 25; } if (m_iStage == 25) { - m_Pos = (FX_LPVOID)(FX_UINTPTR)0; + m_Pos = (FX_LPVOID)(uintptr_t)0; m_iStage = 26; } if (m_iStage == 26) { - FX_INT32 iRet = WriteNewObjs((m_dwFlags & FPDFCREATE_INCREMENTAL) != 0, pPause); + int32_t iRet = WriteNewObjs((m_dwFlags & FPDFCREATE_INCREMENTAL) != 0, pPause); if (iRet) { return iRet; } @@ -1613,7 +1613,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage2(IFX_Pause *pPause) } return m_iStage; } -FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) +int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) { FXSYS_assert(m_iStage >= 80 || m_iStage < 90); FX_DWORD dwLastObjNum = m_dwLastObjNum; @@ -1630,13 +1630,13 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) if (m_File.AppendString(str) < 0) { return -1; } - m_Pos = (FX_LPVOID)(FX_UINTPTR)1; + m_Pos = (FX_LPVOID)(uintptr_t)1; m_iStage = 81; } else { if (m_File.AppendString(FX_BSTRC("xref\r\n")) < 0) { return -1; } - m_Pos = (FX_LPVOID)(FX_UINTPTR)0; + m_Pos = (FX_LPVOID)(uintptr_t)0; m_iStage = 82; } } else { @@ -1645,7 +1645,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) } if (m_iStage == 81) { CFX_ByteString str; - FX_DWORD i = (FX_DWORD)(FX_UINTPTR)m_Pos, j; + FX_DWORD i = (FX_DWORD)(uintptr_t)m_Pos, j; while (i <= dwLastObjNum) { while (i <= dwLastObjNum && !m_ObjectOffset.GetPtrAt(i)) { i++; @@ -1675,7 +1675,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) break; } if (pPause && pPause->NeedToPauseNow()) { - m_Pos = (FX_LPVOID)(FX_UINTPTR)i; + m_Pos = (FX_LPVOID)(uintptr_t)i; return 1; } } @@ -1683,10 +1683,10 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) } if (m_iStage == 82) { CFX_ByteString str; - FX_INT32 iCount = m_NewObjNumArray.GetSize(); - FX_INT32 i = (FX_INT32)(FX_UINTPTR)m_Pos; + int32_t iCount = m_NewObjNumArray.GetSize(); + int32_t i = (int32_t)(uintptr_t)m_Pos; while (i < iCount) { - FX_INT32 j = i; + int32_t j = i; FX_DWORD objnum = m_NewObjNumArray.ElementAt(i); while (j < iCount) { if (++j == iCount) { @@ -1715,7 +1715,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) } } if (pPause && (i % 100) == 0 && pPause->NeedToPauseNow()) { - m_Pos = (FX_LPVOID)(FX_UINTPTR)i; + m_Pos = (FX_LPVOID)(uintptr_t)i; return 1; } } @@ -1723,7 +1723,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) } return m_iStage; } -static FX_INT32 _OutPutIndex(CFX_FileBufferArchive* pFile, FX_FILESIZE offset) +static int32_t _OutPutIndex(CFX_FileBufferArchive* pFile, FX_FILESIZE offset) { FXSYS_assert(pFile); if (sizeof(offset) > 4) { @@ -1759,7 +1759,7 @@ static FX_INT32 _OutPutIndex(CFX_FileBufferArchive* pFile, FX_FILESIZE offset) } return 0; } -FX_INT32 CPDF_Creator::WriteDoc_Stage4(IFX_Pause *pPause) +int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause *pPause) { FXSYS_assert(m_iStage >= 90); if ((m_dwFlags & FPDFCREATE_OBJECTSTREAM) == 0) { @@ -1918,7 +1918,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage4(IFX_Pause *pPause) } } else { int count = m_NewObjNumArray.GetSize(); - FX_INT32 i = 0; + int32_t i = 0; for (i = 0; i < count; i++) { FX_DWORD objnum = m_NewObjNumArray.ElementAt(i); if (m_File.AppendDWord(objnum) < 0) { @@ -2035,7 +2035,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault ) m_pIDArray->Add(pID1->Clone()); } else { pBuffer = FX_Alloc(FX_DWORD, 4); - PDF_GenerateFileID((FX_DWORD)(FX_UINTPTR)this, m_dwLastObjNum, pBuffer); + PDF_GenerateFileID((FX_DWORD)(uintptr_t)this, m_dwLastObjNum, pBuffer); CFX_ByteStringC bsBuffer((FX_LPCBYTE)pBuffer, 4 * sizeof(FX_DWORD)); m_pIDArray->Add(CPDF_String::Create(bsBuffer, TRUE), m_pDocument); } @@ -2053,7 +2053,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault ) return; } FX_LPDWORD pBuffer = FX_Alloc(FX_DWORD, 4); - PDF_GenerateFileID((FX_DWORD)(FX_UINTPTR)this, m_dwLastObjNum, pBuffer); + PDF_GenerateFileID((FX_DWORD)(uintptr_t)this, m_dwLastObjNum, pBuffer); CFX_ByteStringC bsBuffer((FX_LPCBYTE)pBuffer, 4 * sizeof(FX_DWORD)); m_pIDArray->Add(CPDF_String::Create(bsBuffer, TRUE), m_pDocument); FX_Free(pBuffer); @@ -2076,12 +2076,12 @@ void CPDF_Creator::InitID(FX_BOOL bDefault ) } } } -FX_INT32 CPDF_Creator::Continue(IFX_Pause *pPause) +int32_t CPDF_Creator::Continue(IFX_Pause *pPause) { if (m_iStage < 0) { return m_iStage; } - FX_INT32 iRet = 0; + int32_t iRet = 0; while (m_iStage < 100) { if (m_iStage < 20) { iRet = WriteDoc_Stage1(pPause); @@ -2103,7 +2103,7 @@ FX_INT32 CPDF_Creator::Continue(IFX_Pause *pPause) } return m_iStage; } -FX_BOOL CPDF_Creator::SetFileVersion(FX_INT32 fileVersion ) +FX_BOOL CPDF_Creator::SetFileVersion(int32_t fileVersion ) { if (fileVersion < 10 || fileVersion > 17) { return FALSE; diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index e75fd079bf..d2d81d5566 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -178,7 +178,7 @@ static const FX_WCHAR g_FX_CP1257Unicodes[128] = { 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9, }; typedef struct { - FX_BYTE m_Charset; + uint8_t m_Charset; const FX_WCHAR* m_pUnicodes; } FX_CharsetUnicodes; const FX_CharsetUnicodes g_FX_CharsetUnicodes[] = { @@ -429,12 +429,12 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, FX_BOOL bVert, FX_B } #endif #if (_FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_) -FX_UINT32 FX_GetLangHashCode( FX_LPCSTR pStr) +uint32_t FX_GetLangHashCode( FX_LPCSTR pStr) { FXSYS_assert( pStr != NULL); - FX_INT32 iLength = FXSYS_strlen(pStr); + int32_t iLength = FXSYS_strlen(pStr); FX_LPCSTR pStrEnd = pStr + iLength; - FX_UINT32 uHashCode = 0; + uint32_t uHashCode = 0; while ( pStr < pStrEnd) { uHashCode = 31 * uHashCode + tolower(*pStr++); } @@ -512,12 +512,12 @@ static const FX_LANG2CS gs_FXLang2CharsetTable[] = { {3923451837, 134}, {3923451838, 136}, }; -static FX_WORD FX_GetCsFromLangCode(FX_UINT32 uCode) +static FX_WORD FX_GetCsFromLangCode(uint32_t uCode) { - FX_INT32 iStart = 0; - FX_INT32 iEnd = sizeof(gs_FXLang2CharsetTable) / sizeof(FX_LANG2CS) - 1; + int32_t iStart = 0; + int32_t iEnd = sizeof(gs_FXLang2CharsetTable) / sizeof(FX_LANG2CS) - 1; while (iStart <= iEnd) { - FX_INT32 iMid = (iStart + iEnd) / 2; + int32_t iMid = (iStart + iEnd) / 2; const FX_LANG2CS &charset = gs_FXLang2CharsetTable[iMid]; if (uCode == charset.uLang) { return charset.uCharset; @@ -529,13 +529,13 @@ static FX_WORD FX_GetCsFromLangCode(FX_UINT32 uCode) }; return 0; } -static FX_WORD FX_GetCharsetFromLang(FX_LPCSTR pLang, FX_INT32 iLength) +static FX_WORD FX_GetCharsetFromLang(FX_LPCSTR pLang, int32_t iLength) { FXSYS_assert(pLang); if (iLength < 0) { iLength = FXSYS_strlen(pLang); } - FX_UINT32 uHash = FX_GetLangHashCode(pLang); + uint32_t uHash = FX_GetLangHashCode(pLang); return FX_GetCsFromLangCode(uHash); } static void _CFString2CFXByteString(CFStringRef src, CFX_ByteString &dest) @@ -1028,7 +1028,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) pBBox->AddInteger(bbox.right); pBBox->AddInteger(bbox.top); pFontDesc->SetAt("FontBBox", pBBox); - FX_INT32 nStemV = 0; + int32_t nStemV = 0; if (pFont->m_pSubstFont) { nStemV = pFont->m_pSubstFont->m_Weight / 5; } else { diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp index 9096bf938e..8d105a5bd8 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp @@ -12,7 +12,7 @@ #include "../fpdf_render/render_int.h" CPDF_Dictionary* CPDF_Image::InitJPEG(FX_LPBYTE pData, FX_DWORD size) { - FX_INT32 width, height, color_trans, num_comps, bits; + int32_t width, height, color_trans, num_comps, bits; if (!CPDF_ModuleMgr::Get()->GetJpegModule()-> LoadInfo(pData, size, width, height, num_comps, bits, color_trans)) { return NULL; @@ -70,12 +70,12 @@ void CPDF_Image::SetJpegImage(IFX_FileRead *pFile) if (dwEstimateSize > 8192) { dwEstimateSize = 8192; } - FX_LPBYTE pData = FX_Alloc(FX_BYTE, dwEstimateSize); + FX_LPBYTE pData = FX_Alloc(uint8_t, dwEstimateSize); pFile->ReadBlock(pData, 0, dwEstimateSize); CPDF_Dictionary *pDict = InitJPEG(pData, dwEstimateSize); FX_Free(pData); if (!pDict && size > dwEstimateSize) { - pData = FX_Alloc(FX_BYTE, size); + pData = FX_Alloc(uint8_t, size); pFile->ReadBlock(pData, 0, size); pDict = InitJPEG(pData, size); FX_Free(pData); @@ -91,16 +91,16 @@ void _DCTEncodeBitmap(CPDF_Dictionary *pBitmapDict, const CFX_DIBitmap* pBitmap, void _JBIG2EncodeBitmap(CPDF_Dictionary *pBitmapDict, const CFX_DIBitmap *pBitmap, CPDF_Document *pDoc, FX_LPBYTE &buf, FX_STRSIZE &size, FX_BOOL bLossLess) { } -void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_FileWrite *pFileWrite, IFX_FileRead *pFileRead, const CFX_DIBitmap* pMask, const CPDF_ImageSetParam* pParam) +void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_FileWrite *pFileWrite, IFX_FileRead *pFileRead, const CFX_DIBitmap* pMask, const CPDF_ImageSetParam* pParam) { - FX_INT32 BitmapWidth = pBitmap->GetWidth(); - FX_INT32 BitmapHeight = pBitmap->GetHeight(); + int32_t BitmapWidth = pBitmap->GetWidth(); + int32_t BitmapHeight = pBitmap->GetHeight(); if (BitmapWidth < 1 || BitmapHeight < 1) { return; } FX_LPBYTE src_buf = pBitmap->GetBuffer(); - FX_INT32 src_pitch = pBitmap->GetPitch(); - FX_INT32 bpp = pBitmap->GetBPP(); + int32_t src_pitch = pBitmap->GetPitch(); + int32_t bpp = pBitmap->GetBPP(); FX_BOOL bUseMatte = pParam && pParam->pMatteColor && (pBitmap->GetFormat() == FXDIB_Argb); CPDF_Dictionary* pDict = new CPDF_Dictionary; pDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("XObject")); @@ -110,8 +110,8 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F FX_LPBYTE dest_buf = NULL; FX_STRSIZE dest_pitch = 0, dest_size = 0, opType = -1; if (bpp == 1) { - FX_INT32 reset_a = 0, reset_r = 0, reset_g = 0, reset_b = 0; - FX_INT32 set_a = 0, set_r = 0, set_g = 0, set_b = 0; + int32_t reset_a = 0, reset_r = 0, reset_g = 0, reset_b = 0; + int32_t set_a = 0, set_r = 0, set_g = 0, set_b = 0; if (!pBitmap->IsAlphaMask()) { ArgbDecode(pBitmap->GetPaletteArgb(0), reset_a, reset_r, reset_g, reset_b); ArgbDecode(pBitmap->GetPaletteArgb(1), set_a, set_r, set_g, set_b); @@ -149,20 +149,20 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F opType = 0; } } else if (bpp == 8) { - FX_INT32 iPalette = pBitmap->GetPaletteSize(); + int32_t iPalette = pBitmap->GetPaletteSize(); if (iPalette > 0) { CPDF_Array* pCS = new CPDF_Array; m_pDocument->AddIndirectObject(pCS); pCS->AddName(FX_BSTRC("Indexed")); pCS->AddName(FX_BSTRC("DeviceRGB")); pCS->AddInteger(iPalette - 1); - FX_LPBYTE pColorTable = FX_Alloc2D(FX_BYTE, iPalette, 3); + FX_LPBYTE pColorTable = FX_Alloc2D(uint8_t, iPalette, 3); FX_LPBYTE ptr = pColorTable; - for (FX_INT32 i = 0; i < iPalette; i ++) { + for (int32_t i = 0; i < iPalette; i ++) { FX_DWORD argb = pBitmap->GetPaletteArgb(i); - ptr[0] = (FX_BYTE)(argb >> 16); - ptr[1] = (FX_BYTE)(argb >> 8); - ptr[2] = (FX_BYTE)argb; + ptr[0] = (uint8_t)(argb >> 16); + ptr[1] = (uint8_t)(argb >> 8); + ptr[2] = (uint8_t)argb; ptr += 3; } CPDF_Stream *pCTS = CPDF_Stream::Create(pColorTable, iPalette * 3, CPDF_Dictionary::Create()); @@ -202,8 +202,8 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F } } if (pMaskBitmap) { - FX_INT32 maskWidth = pMaskBitmap->GetWidth(); - FX_INT32 maskHeight = pMaskBitmap->GetHeight(); + int32_t maskWidth = pMaskBitmap->GetWidth(); + int32_t maskHeight = pMaskBitmap->GetHeight(); FX_LPBYTE mask_buf = NULL; FX_STRSIZE mask_size; CPDF_Dictionary* pMaskDict = new CPDF_Dictionary; @@ -218,9 +218,9 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F } else if (pMaskBitmap->GetFormat() == FXDIB_1bppMask) { _JBIG2EncodeBitmap(pMaskDict, pMaskBitmap, m_pDocument, mask_buf, mask_size, TRUE); } else { - mask_buf = FX_Alloc2D(FX_BYTE, maskHeight, maskWidth); + mask_buf = FX_Alloc2D(uint8_t, maskHeight, maskWidth); mask_size = maskHeight * maskWidth; // Safe since checked alloc returned. - for (FX_INT32 a = 0; a < maskHeight; a ++) { + for (int32_t a = 0; a < maskHeight; a ++) { FXSYS_memcpy32(mask_buf + a * maskWidth, pMaskBitmap->GetScanline(a), maskWidth); } } @@ -271,15 +271,15 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F CFX_DIBitmap *pNewBitmap = new CFX_DIBitmap(); pNewBitmap->Create(BitmapWidth, BitmapHeight, FXDIB_Argb); FX_LPBYTE dst_buf = pNewBitmap->GetBuffer(); - FX_INT32 src_offset = 0; - for (FX_INT32 row = 0; row < BitmapHeight; row ++) { + int32_t src_offset = 0; + for (int32_t row = 0; row < BitmapHeight; row ++) { src_offset = row * src_pitch; - for (FX_INT32 column = 0; column < BitmapWidth; column ++) { + for (int32_t column = 0; column < BitmapWidth; column ++) { FX_FLOAT alpha = src_buf[src_offset + 3] / 255.0f; - dst_buf[src_offset] = (FX_BYTE)(src_buf[src_offset] * alpha); - dst_buf[src_offset + 1] = (FX_BYTE)(src_buf[src_offset + 1] * alpha); - dst_buf[src_offset + 2] = (FX_BYTE)(src_buf[src_offset + 2] * alpha); - dst_buf[src_offset + 3] = (FX_BYTE)(src_buf[src_offset + 3]); + dst_buf[src_offset] = (uint8_t)(src_buf[src_offset] * alpha); + dst_buf[src_offset + 1] = (uint8_t)(src_buf[src_offset + 1] * alpha); + dst_buf[src_offset + 2] = (uint8_t)(src_buf[src_offset + 2] * alpha); + dst_buf[src_offset + 3] = (uint8_t)(src_buf[src_offset + 3]); src_offset += 4; } } @@ -297,11 +297,11 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F } } else if (opType == 1) { if (!bStream) { - dest_buf = FX_Alloc2D(FX_BYTE, dest_pitch, BitmapHeight); + dest_buf = FX_Alloc2D(uint8_t, dest_pitch, BitmapHeight); dest_size = dest_pitch * BitmapHeight; // Safe since checked alloc returned. } FX_LPBYTE pDest = dest_buf; - for (FX_INT32 i = 0; i < BitmapHeight; i ++) { + for (int32_t i = 0; i < BitmapHeight; i ++) { if (!bStream) { FXSYS_memcpy32(pDest, src_buf, dest_pitch); pDest += dest_pitch; @@ -312,21 +312,21 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F } } else if (opType == 2) { if (!bStream) { - dest_buf = FX_Alloc2D(FX_BYTE, dest_pitch, BitmapHeight); + dest_buf = FX_Alloc2D(uint8_t, dest_pitch, BitmapHeight); dest_size = dest_pitch * BitmapHeight; // Safe since checked alloc returned. } else { - dest_buf = FX_Alloc(FX_BYTE, dest_pitch); + dest_buf = FX_Alloc(uint8_t, dest_pitch); } FX_LPBYTE pDest = dest_buf; - FX_INT32 src_offset = 0; - FX_INT32 dest_offset = 0; - for (FX_INT32 row = 0; row < BitmapHeight; row ++) { + int32_t src_offset = 0; + int32_t dest_offset = 0; + for (int32_t row = 0; row < BitmapHeight; row ++) { src_offset = row * src_pitch; - for (FX_INT32 column = 0; column < BitmapWidth; column ++) { + for (int32_t column = 0; column < BitmapWidth; column ++) { FX_FLOAT alpha = bUseMatte ? src_buf[src_offset + 3] / 255.0f : 1; - pDest[dest_offset] = (FX_BYTE)(src_buf[src_offset + 2] * alpha); - pDest[dest_offset + 1] = (FX_BYTE)(src_buf[src_offset + 1] * alpha); - pDest[dest_offset + 2] = (FX_BYTE)(src_buf[src_offset] * alpha); + pDest[dest_offset] = (uint8_t)(src_buf[src_offset + 2] * alpha); + pDest[dest_offset + 1] = (uint8_t)(src_buf[src_offset + 1] * alpha); + pDest[dest_offset + 2] = (uint8_t)(src_buf[src_offset] * alpha); dest_offset += 3; src_offset += bpp == 24 ? 3 : 4; } diff --git a/core/src/fpdfapi/fpdf_font/common.h b/core/src/fpdfapi/fpdf_font/common.h index 923a394662..57461d1908 100644 --- a/core/src/fpdfapi/fpdf_font/common.h +++ b/core/src/fpdfapi/fpdf_font/common.h @@ -11,9 +11,9 @@ typedef signed char TT_int8_t; typedef unsigned char TT_uint8_t; typedef signed short TT_int16_t; typedef unsigned short TT_uint16_t; -typedef FX_INT32 TT_int32_t; +typedef int32_t TT_int32_t; typedef FX_DWORD TT_uint32_t; -typedef FX_INT64 TT_int64_t; -typedef FX_UINT64 TT_uint64_t; +typedef int64_t TT_int64_t; +typedef uint64_t TT_uint64_t; #endif // CORE_SRC_FPDFAPI_FPDF_FONT_COMMON_H_ diff --git a/core/src/fpdfapi/fpdf_font/font_int.h b/core/src/fpdfapi/fpdf_font/font_int.h index 697ccffafd..1e52607d98 100644 --- a/core/src/fpdfapi/fpdf_font/font_int.h +++ b/core/src/fpdfapi/fpdf_font/font_int.h @@ -48,8 +48,8 @@ private: }; struct _CMap_CodeRange { int m_CharSize; - FX_BYTE m_Lower[4]; - FX_BYTE m_Upper[4]; + uint8_t m_Lower[4]; + uint8_t m_Upper[4]; }; class CPDF_CMapParser { @@ -113,7 +113,7 @@ protected: int m_Charset, m_Coding; CodingScheme m_CodingScheme; int m_nCodeRanges; - FX_BYTE* m_pLeadingBytes; + uint8_t* m_pLeadingBytes; FX_WORD* m_pMapping; FX_LPBYTE m_pAddMapping; FX_BOOL m_bLoaded; @@ -128,13 +128,13 @@ public: int m_Coding; CPDF_CMap::CodingScheme m_CodingScheme; FX_DWORD m_LeadingSegCount; - FX_BYTE m_LeadingSegs[4]; + uint8_t m_LeadingSegs[4]; }; typedef struct _FileHeader { - FX_BYTE btTag[4]; - FX_BYTE btVersion; - FX_BYTE btFormat; - FX_BYTE btReserved1[2]; + uint8_t btTag[4]; + uint8_t btVersion; + uint8_t btFormat; + uint8_t btReserved1[2]; FX_DWORD dwStartIndex; FX_DWORD dwEndIndex; FX_DWORD dwDataSize; diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp index 80dd1df803..0058e140d4 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp @@ -412,7 +412,7 @@ CPDF_Font* CPDF_Font::GetStockFont(CPDF_Document* pDoc, FX_BSTR name) pFontGlobals->Set(pDoc, font_id, pFont); return pFont; } -const FX_BYTE ChineseFontNames[][5] = { +const uint8_t ChineseFontNames[][5] = { {0xCB, 0xCE, 0xCC, 0xE5, 0x00}, {0xBF, 0xAC, 0xCC, 0xE5, 0x00}, {0xBA, 0xDA, 0xCC, 0xE5, 0x00}, @@ -816,7 +816,7 @@ FX_BOOL CPDF_Font::IsStandardFont() const } return TRUE; } -extern FX_LPCSTR PDF_CharNameFromPredefinedCharSet(int encoding, FX_BYTE charcode); +extern FX_LPCSTR PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode); CPDF_SimpleFont::CPDF_SimpleFont(int fonttype) : CPDF_Font(fonttype) { FXSYS_memset8(m_CharBBox, 0xff, sizeof m_CharBBox); @@ -838,7 +838,7 @@ int CPDF_SimpleFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL *pVertGlyph) if (charcode > 0xff) { return -1; } - int index = m_GlyphIndex[(FX_BYTE)charcode]; + int index = m_GlyphIndex[(uint8_t)charcode]; if (index == 0xffff) { return -1; } @@ -892,14 +892,14 @@ int CPDF_SimpleFont::GetCharWidthF(FX_DWORD charcode, int level) m_CharWidth[charcode] = 0; } } - return (FX_INT16)m_CharWidth[charcode]; + return (int16_t)m_CharWidth[charcode]; } void CPDF_SimpleFont::GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level) { if (charcode > 0xff) { charcode = 0; } - if (m_CharBBox[charcode].Left == (FX_SHORT)0xffff) { + if (m_CharBBox[charcode].Left == (int16_t)0xffff) { LoadCharMetrics(charcode); } rect.left = m_CharBBox[charcode].Left; @@ -1073,7 +1073,7 @@ int CPDF_Type1Font::GlyphFromCharCodeExt(FX_DWORD charcode) if (charcode > 0xff) { return -1; } - int index = m_ExtGID[(FX_BYTE)charcode]; + int index = m_ExtGID[(uint8_t)charcode]; if (index == 0xffff) { return -1; } @@ -1130,7 +1130,7 @@ void CPDF_Type1Font::LoadGlyphMap() if (FT_UseTTCharmap(m_Font.m_Face, 3, 0)) { FX_BOOL bGotOne = FALSE; for (int charcode = 0; charcode < 256; charcode ++) { - const FX_BYTE prefix[4] = {0x00, 0xf0, 0xf1, 0xf2}; + const uint8_t prefix[4] = {0x00, 0xf0, 0xf1, 0xf2}; for (int j = 0; j < 4; j ++) { FX_WORD unicode = prefix[j] * 256 + charcode; m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, unicode); @@ -1482,7 +1482,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() } m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); if (bMSSymbol) { - const FX_BYTE prefix[4] = {0x00, 0xf0, 0xf1, 0xf2}; + const uint8_t prefix[4] = {0x00, 0xf0, 0xf1, 0xf2}; for (int j = 0; j < 4; j ++) { FX_WORD unicode = prefix[j] * 256 + charcode; m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, unicode); @@ -1525,7 +1525,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() return; } if (FT_UseTTCharmap(m_Font.m_Face, 3, 0)) { - const FX_BYTE prefix[4] = {0x00, 0xf0, 0xf1, 0xf2}; + const uint8_t prefix[4] = {0x00, 0xf0, 0xf1, 0xf2}; FX_BOOL bGotOne = FALSE; for (int charcode = 0; charcode < 256; charcode ++) { for (int j = 0; j < 4; j ++) { @@ -1627,10 +1627,10 @@ FX_BOOL CPDF_Type3Font::_Load() } CPDF_Array* pBBox = m_pFontDict->GetArray(FX_BSTRC("FontBBox")); if (pBBox) { - m_FontBBox.left = (FX_INT32)(FXSYS_Mul(pBBox->GetNumber(0), xscale) * 1000); - m_FontBBox.bottom = (FX_INT32)(FXSYS_Mul(pBBox->GetNumber(1), yscale) * 1000); - m_FontBBox.right = (FX_INT32)(FXSYS_Mul(pBBox->GetNumber(2), xscale) * 1000); - m_FontBBox.top = (FX_INT32)(FXSYS_Mul(pBBox->GetNumber(3), yscale) * 1000); + m_FontBBox.left = (int32_t)(FXSYS_Mul(pBBox->GetNumber(0), xscale) * 1000); + m_FontBBox.bottom = (int32_t)(FXSYS_Mul(pBBox->GetNumber(1), yscale) * 1000); + m_FontBBox.right = (int32_t)(FXSYS_Mul(pBBox->GetNumber(2), xscale) * 1000); + m_FontBBox.top = (int32_t)(FXSYS_Mul(pBBox->GetNumber(3), yscale) * 1000); } int StartChar = m_pFontDict->GetInteger(FX_BSTRC("FirstChar")); CPDF_Array* pWidthArray = m_pFontDict->GetArray(FX_BSTRC("Widths")); @@ -1671,10 +1671,10 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) return NULL; } CPDF_Type3Char* pChar = NULL; - if (m_CacheMap.Lookup((FX_LPVOID)(FX_UINTPTR)charcode, (FX_LPVOID&)pChar)) { + if (m_CacheMap.Lookup((FX_LPVOID)(uintptr_t)charcode, (FX_LPVOID&)pChar)) { if (pChar->m_bPageRequired && m_pPageResources) { delete pChar; - m_CacheMap.RemoveKey((FX_LPVOID)(FX_UINTPTR)charcode); + m_CacheMap.RemoveKey((FX_LPVOID)(uintptr_t)charcode); return LoadChar(charcode, level + 1); } return pChar; @@ -1691,7 +1691,7 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) pChar->m_pForm = new CPDF_Form(m_pDocument, m_pFontResources ? m_pFontResources : m_pPageResources, pStream, NULL); pChar->m_pForm->ParseContent(NULL, NULL, pChar, NULL, level + 1); FX_FLOAT scale = m_FontMatrix.GetXUnit(); - pChar->m_Width = (FX_INT32)(pChar->m_Width * scale + 0.5f); + pChar->m_Width = (int32_t)(pChar->m_Width * scale + 0.5f); FX_RECT &rcBBox = pChar->m_BBox; CFX_FloatRect char_rect((FX_FLOAT)rcBBox.left / 1000.0f, (FX_FLOAT)rcBBox.bottom / 1000.0f, (FX_FLOAT)rcBBox.right / 1000.0f, (FX_FLOAT)rcBBox.top / 1000.0f); @@ -1703,7 +1703,7 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) rcBBox.right = FXSYS_round(char_rect.right * 1000); rcBBox.top = FXSYS_round(char_rect.top * 1000); rcBBox.bottom = FXSYS_round(char_rect.bottom * 1000); - m_CacheMap.SetAt((FX_LPVOID)(FX_UINTPTR)charcode, pChar); + m_CacheMap.SetAt((FX_LPVOID)(uintptr_t)charcode, pChar); if (pChar->m_pForm->CountObjects() == 0) { delete pChar->m_pForm; pChar->m_pForm = NULL; diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp index c7110d39c9..8e8fccd8a3 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp @@ -475,7 +475,7 @@ const FX_LPCSTR ZapfEncodingNames[224] = { NULL, "a201", "a183", "a184", "a197", "a185", "a194", "a198", "a186", "a195", "a187", "a188", "a189", "a190", "a191", NULL }; -const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, FX_BYTE charcode) +const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode) { if (encoding == PDFFONT_ENCODING_PDFDOC) { if (charcode < 24) { @@ -512,15 +512,15 @@ FX_WCHAR FT_UnicodeFromCharCode(int encoding, FX_DWORD charcode) case FXFT_ENCODING_UNICODE: return (FX_WORD)charcode; case FXFT_ENCODING_ADOBE_STANDARD: - return StandardEncoding[(FX_BYTE)charcode]; + return StandardEncoding[(uint8_t)charcode]; case FXFT_ENCODING_ADOBE_EXPERT: - return MacExpertEncoding[(FX_BYTE)charcode]; + return MacExpertEncoding[(uint8_t)charcode]; case FXFT_ENCODING_ADOBE_LATIN_1: - return AdobeWinAnsiEncoding[(FX_BYTE)charcode]; + return AdobeWinAnsiEncoding[(uint8_t)charcode]; case FXFT_ENCODING_APPLE_ROMAN: - return MacRomanEncoding[(FX_BYTE)charcode]; + return MacRomanEncoding[(uint8_t)charcode]; case PDFFONT_ENCODING_PDFDOC: - return PDFDocEncoding[(FX_BYTE)charcode]; + return PDFDocEncoding[(uint8_t)charcode]; } return 0; } diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp index a08660c52f..a6209cb536 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -124,7 +124,7 @@ static FX_DWORD CMap_GetCode(FX_BSTR word) int num = 0; if (word.GetAt(0) == '<') { for (int i = 1; i < word.GetLength(); i ++) { - FX_BYTE digit = word.GetAt(i); + uint8_t digit = word.GetAt(i); if (digit >= '0' && digit <= '9') { digit = digit - '0'; } else if (digit >= 'a' && digit <= 'f') { @@ -161,17 +161,17 @@ static FX_BOOL _CMap_GetCodeRange(_CMap_CodeRange& range, FX_BSTR first, FX_BSTR return FALSE; } for (i = 0; i < range.m_CharSize; i ++) { - FX_BYTE digit1 = first.GetAt(i * 2 + 1); - FX_BYTE digit2 = first.GetAt(i * 2 + 2); - FX_BYTE byte = (digit1 >= '0' && digit1 <= '9') ? (digit1 - '0') : ((digit1 & 0xdf) - 'A' + 10); + uint8_t digit1 = first.GetAt(i * 2 + 1); + uint8_t digit2 = first.GetAt(i * 2 + 2); + uint8_t byte = (digit1 >= '0' && digit1 <= '9') ? (digit1 - '0') : ((digit1 & 0xdf) - 'A' + 10); byte = byte * 16 + ((digit2 >= '0' && digit2 <= '9') ? (digit2 - '0') : ((digit2 & 0xdf) - 'A' + 10)); range.m_Lower[i] = byte; } FX_DWORD size = second.GetLength(); for (i = 0; i < range.m_CharSize; i ++) { - FX_BYTE digit1 = ((FX_DWORD)i * 2 + 1 < size) ? second.GetAt((FX_STRSIZE)i * 2 + 1) : 0; - FX_BYTE digit2 = ((FX_DWORD)i * 2 + 2 < size) ? second.GetAt((FX_STRSIZE)i * 2 + 2) : 0; - FX_BYTE byte = (digit1 >= '0' && digit1 <= '9') ? (digit1 - '0') : ((digit1 & 0xdf) - 'A' + 10); + uint8_t digit1 = ((FX_DWORD)i * 2 + 1 < size) ? second.GetAt((FX_STRSIZE)i * 2 + 1) : 0; + uint8_t digit2 = ((FX_DWORD)i * 2 + 2 < size) ? second.GetAt((FX_STRSIZE)i * 2 + 2) : 0; + uint8_t byte = (digit1 >= '0' && digit1 <= '9') ? (digit1 - '0') : ((digit1 & 0xdf) - 'A' + 10); byte = byte * 16 + ((digit2 >= '0' && digit2 <= '9') ? (digit2 - '0') : ((digit2 & 0xdf) - 'A' + 10)); range.m_Upper[i] = byte; } @@ -254,7 +254,7 @@ void CPDF_CMapParser::ParseWord(FX_BSTR word) if (nSegs > 1) { m_pCMap->m_CodingScheme = CPDF_CMap::MixedFourBytes; m_pCMap->m_nCodeRanges = nSegs; - m_pCMap->m_pLeadingBytes = FX_Alloc2D(FX_BYTE, nSegs, sizeof(_CMap_CodeRange)); + m_pCMap->m_pLeadingBytes = FX_Alloc2D(uint8_t, nSegs, sizeof(_CMap_CodeRange)); FXSYS_memcpy32(m_pCMap->m_pLeadingBytes, m_CodeRanges.GetData(), nSegs * sizeof(_CMap_CodeRange)); } else if (nSegs == 1) { m_pCMap->m_CodingScheme = (m_CodeRanges[0].m_CharSize == 2) ? CPDF_CMap::TwoBytes : CPDF_CMap::OneByte; @@ -376,7 +376,7 @@ FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, FX_LPCSTR pName, FX_BO m_Coding = map.m_Coding; m_CodingScheme = map.m_CodingScheme; if (m_CodingScheme == MixedTwoBytes) { - m_pLeadingBytes = FX_Alloc(FX_BYTE, 256); + m_pLeadingBytes = FX_Alloc(uint8_t, 256); for (FX_DWORD i = 0; i < map.m_LeadingSegCount; i ++) { for (int b = map.m_LeadingSegs[i * 2]; b <= map.m_LeadingSegs[i * 2 + 1]; b ++) { m_pLeadingBytes[b] = 1; @@ -410,7 +410,7 @@ FX_BOOL CPDF_CMap::LoadEmbedded(FX_LPCBYTE pData, FX_DWORD size) parser.ParseWord(word); } if (m_CodingScheme == MixedFourBytes && parser.m_AddMaps.GetSize()) { - m_pAddMapping = FX_Alloc(FX_BYTE, parser.m_AddMaps.GetSize() + 4); + m_pAddMapping = FX_Alloc(uint8_t, parser.m_AddMaps.GetSize() + 4); *(FX_DWORD*)m_pAddMapping = parser.m_AddMaps.GetSize() / 8; FXSYS_memcpy32(m_pAddMapping + 4, parser.m_AddMaps.GetBuffer(), parser.m_AddMaps.GetSize()); FXSYS_qsort(m_pAddMapping + 4, parser.m_AddMaps.GetSize() / 8, 8, compare_dword); @@ -500,15 +500,15 @@ FX_DWORD CPDF_CMap::GetNextChar(FX_LPCSTR pString, int nStrLen, int& offset) con offset += 2; return ((FX_LPBYTE)pString)[offset - 2] * 256 + ((FX_LPBYTE)pString)[offset - 1]; case MixedTwoBytes: { - FX_BYTE byte1 = ((FX_LPBYTE)pString)[offset++]; + uint8_t byte1 = ((FX_LPBYTE)pString)[offset++]; if (!m_pLeadingBytes[byte1]) { return byte1; } - FX_BYTE byte2 = ((FX_LPBYTE)pString)[offset++]; + uint8_t byte2 = ((FX_LPBYTE)pString)[offset++]; return byte1 * 256 + byte2; } case MixedFourBytes: { - FX_BYTE codes[4]; + uint8_t codes[4]; int char_size = 1; codes[0] = ((FX_LPBYTE)pString)[offset++]; _CMap_CodeRange* pRanges = (_CMap_CodeRange*)m_pLeadingBytes; @@ -589,10 +589,10 @@ int _GetCharSize(FX_DWORD charcode, _CMap_CodeRange* pRanges, int iRangesSize) if (!iRangesSize) { return 1; } - FX_BYTE codes[4]; + uint8_t codes[4]; codes[0] = codes[1] = 0x00; - codes[2] = (FX_BYTE)(charcode >> 8 & 0xFF); - codes[3] = (FX_BYTE)charcode; + codes[2] = (uint8_t)(charcode >> 8 & 0xFF); + codes[3] = (uint8_t)charcode; int offset = 0, size = 4; for (int i = 0; i < 4; ++i) { int iSeg = iRangesSize - 1; @@ -623,11 +623,11 @@ int CPDF_CMap::AppendChar(FX_LPSTR str, FX_DWORD charcode) const { switch (m_CodingScheme) { case OneByte: - str[0] = (FX_BYTE)charcode; + str[0] = (uint8_t)charcode; return 1; case TwoBytes: - str[0] = (FX_BYTE)(charcode / 256); - str[1] = (FX_BYTE)(charcode % 256); + str[0] = (uint8_t)(charcode / 256); + str[1] = (uint8_t)(charcode % 256); return 2; case MixedTwoBytes: case MixedFourBytes: @@ -638,24 +638,24 @@ int CPDF_CMap::AppendChar(FX_LPSTR str, FX_DWORD charcode) const iSize = 1; } if (iSize > 1) { - FXSYS_memset32(str, 0, sizeof(FX_BYTE) * iSize); + FXSYS_memset32(str, 0, sizeof(uint8_t) * iSize); } - str[iSize - 1] = (FX_BYTE)charcode; + str[iSize - 1] = (uint8_t)charcode; return iSize; } else if (charcode < 0x10000) { - str[0] = (FX_BYTE)(charcode >> 8); - str[1] = (FX_BYTE)charcode; + str[0] = (uint8_t)(charcode >> 8); + str[1] = (uint8_t)charcode; return 2; } else if (charcode < 0x1000000) { - str[0] = (FX_BYTE)(charcode >> 16); - str[1] = (FX_BYTE)(charcode >> 8); - str[2] = (FX_BYTE)charcode; + str[0] = (uint8_t)(charcode >> 16); + str[1] = (uint8_t)(charcode >> 8); + str[2] = (uint8_t)charcode; return 3; } else { - str[0] = (FX_BYTE)(charcode >> 24); - str[1] = (FX_BYTE)(charcode >> 16); - str[2] = (FX_BYTE)(charcode >> 8); - str[3] = (FX_BYTE)charcode; + str[0] = (uint8_t)(charcode >> 24); + str[1] = (uint8_t)(charcode >> 16); + str[2] = (uint8_t)(charcode >> 8); + str[3] = (uint8_t)charcode; return 4; } } @@ -837,7 +837,7 @@ FX_DWORD CPDF_CIDFont::_CharCodeFromUnicode(FX_WCHAR unicode) const return 0; } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - FX_BYTE buffer[32]; + uint8_t buffer[32]; int ret = FXSYS_WideCharToMultiByte(g_CharsetCPs[m_pCMap->m_Coding], 0, &unicode, 1, (char*)buffer, 4, NULL, NULL); if (ret == 1) { return buffer[0]; @@ -990,7 +990,7 @@ FX_BOOL CPDF_CIDFont::_Load() } return TRUE; } -FX_FLOAT _CIDTransformToFloat(FX_BYTE ch) +FX_FLOAT _CIDTransformToFloat(uint8_t ch) { if (ch < 128) { return ch * 1.0f / 127; @@ -1150,7 +1150,7 @@ int CPDF_CIDFont::GetGlyphIndex(FX_DWORD unicode, FX_BOOL *pVertGlyph) unsigned long length = 0; int error = FXFT_Load_Sfnt_Table( m_Font.m_Face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, NULL, &length); if (!error) { - m_Font.m_pGsubData = (unsigned char*)FX_Alloc(FX_BYTE, length); + m_Font.m_pGsubData = (unsigned char*)FX_Alloc(uint8_t, length); } } int error = FXFT_Load_Sfnt_Table( m_Font.m_Face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, m_Font.m_pGsubData, NULL); @@ -1421,7 +1421,7 @@ FX_BOOL CPDF_CIDFont::LoadGB2312() } const struct _CIDTransform { FX_WORD CID; - FX_BYTE a, b, c, d, e, f; + uint8_t a, b, c, d, e, f; } Japan1_VertCIDs[] = { {97, 129, 0, 0, 127, 55, 0}, diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp index ae67d2f0ef..ab15c47cb3 100644 --- a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp +++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp @@ -20,8 +20,8 @@ extern "C" { } }; struct _IntPair { - FX_INT32 key; - FX_INT32 value; + int32_t key; + int32_t value; }; void CFX_GlyphMap::SetAt(int key, int value) { @@ -431,7 +431,7 @@ IFX_GSUBTable* FXGE_CreateGSUBTable(CFX_Font* pFont) unsigned long length = 0; int error = FXFT_Load_Sfnt_Table(pFont->m_Face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, NULL, &length); if (!error) { - pFont->m_pGsubData = (unsigned char*)FX_Alloc(FX_BYTE, length); + pFont->m_pGsubData = (unsigned char*)FX_Alloc(uint8_t, length); } if (!pFont->m_pGsubData) { return NULL; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp index 5a9f1a8cb8..82f90d17a6 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp @@ -113,7 +113,7 @@ CPDF_TextObject::~CPDF_TextObject() } void CPDF_TextObject::GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const { - pInfo->m_CharCode = m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)m_pCharCodes : m_pCharCodes[index]; + pInfo->m_CharCode = m_nChars == 1 ? (FX_DWORD)(uintptr_t)m_pCharCodes : m_pCharCodes[index]; pInfo->m_OriginX = index ? m_pCharPos[index - 1] : 0; pInfo->m_OriginY = 0; if (pInfo->m_CharCode == -1) { @@ -150,7 +150,7 @@ int CPDF_TextObject::CountChars() const void CPDF_TextObject::GetCharInfo(int index, FX_DWORD& charcode, FX_FLOAT& kerning) const { if (m_nChars == 1) { - charcode = (FX_DWORD)(FX_UINTPTR)m_pCharCodes; + charcode = (FX_DWORD)(uintptr_t)m_pCharCodes; kerning = 0; return; } @@ -254,7 +254,7 @@ void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs, FX_FLOAT* pKernin } } else { int offset = 0; - m_pCharCodes = (FX_DWORD*)(FX_UINTPTR)pFont->GetNextChar(pStrs[0], pStrs[0].GetLength(), offset); + m_pCharCodes = (FX_DWORD*)(uintptr_t)pFont->GetNextChar(pStrs[0], pStrs[0].GetLength(), offset); } } void CPDF_TextObject::SetText(const CFX_ByteString& str) @@ -311,7 +311,7 @@ void CPDF_TextObject::SetText(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pKerni } } } else { - m_pCharCodes = (FX_DWORD*)(FX_UINTPTR)pCharCodes[0]; + m_pCharCodes = (FX_DWORD*)(uintptr_t)pCharCodes[0]; } RecalcPositionData(); } @@ -360,7 +360,7 @@ void CPDF_TextObject::GetCharRect(int index, CFX_FloatRect& rect) const FX_FLOAT fontsize = m_TextState.GetFontSize() / 1000; int count = 0; for (int i = 0; i < m_nChars; i ++) { - FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)m_pCharCodes : m_pCharCodes[i]; + FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(uintptr_t)m_pCharCodes : m_pCharCodes[i]; if (charcode == (FX_DWORD) - 1) { continue; } @@ -404,7 +404,7 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX, FX_FLOAT* pTextA } FX_FLOAT fontsize = m_TextState.GetFontSize(); for (int i = 0; i < m_nChars; i ++) { - FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)m_pCharCodes : m_pCharCodes[i]; + FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(uintptr_t)m_pCharCodes : m_pCharCodes[i]; if (charcode == (FX_DWORD) - 1) { curpos -= FXSYS_Mul(m_pCharPos[i - 1], fontsize) / 1000; continue; @@ -531,7 +531,7 @@ void CPDF_TextObject::CalcCharPos(FX_FLOAT* pPosArray) const FX_FLOAT fontsize = m_TextState.GetFontSize(); int index = 0; for (int i = 0; i < m_nChars; i ++) { - FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)m_pCharCodes : m_pCharCodes[i]; + FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(uintptr_t)m_pCharCodes : m_pCharCodes[i]; if (charcode == (FX_DWORD) - 1) { continue; } @@ -583,7 +583,7 @@ void CPDF_TextObject::SetData(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pCharP return; } if (nChars == 1) { - m_pCharCodes = (FX_DWORD*)(FX_UINTPTR) * pCharCodes; + m_pCharCodes = (FX_DWORD*)(uintptr_t) * pCharCodes; } else { m_pCharCodes = FX_Alloc(FX_DWORD, nChars); FXSYS_memcpy32(m_pCharCodes, pCharCodes, sizeof(FX_DWORD)*nChars); diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp index 8b9ff8ea96..ea61078209 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp @@ -129,7 +129,7 @@ static void ReverseRGB(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels) { if (pDestBuf == pSrcBuf) for (int i = 0; i < pixels; i ++) { - FX_BYTE temp = pDestBuf[2]; + uint8_t temp = pDestBuf[2]; pDestBuf[2] = pDestBuf[0]; pDestBuf[0] = temp; pDestBuf += 3; @@ -168,7 +168,7 @@ void CPDF_DeviceCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, i if (!m_dwStdConversion) { AdobeCMYK_to_sRGB1(pSrcBuf[0], pSrcBuf[1], pSrcBuf[2], pSrcBuf[3], pDestBuf[2], pDestBuf[1], pDestBuf[0]); } else { - FX_BYTE k = pSrcBuf[3]; + uint8_t k = pSrcBuf[3]; pDestBuf[2] = 255 - FX_MIN(255, pSrcBuf[0] + k); pDestBuf[1] = 255 - FX_MIN(255, pSrcBuf[1] + k); pDestBuf[0] = 255 - FX_MIN(255, pSrcBuf[2] + k); @@ -178,7 +178,7 @@ void CPDF_DeviceCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, i } } } -const FX_BYTE g_sRGBSamples1[] = { +const uint8_t g_sRGBSamples1[] = { 0, 3, 6, 10, 13, 15, 18, 20, 22, 23, 25, 27, 28, 30, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 53, 54, 55, 56, 56, 57, 58, 58, 59, 60, 61, @@ -192,7 +192,7 @@ const FX_BYTE g_sRGBSamples1[] = { 110, 110, 111, 111, 111, 112, 112, 112, 113, 113, 113, 114, 114, 114, 115, 115, 115, 115, 116, 116, 116, 117, 117, 117, 118, 118, 118, 118, 119, 119, 119, 120, }; -const FX_BYTE g_sRGBSamples2[] = { +const uint8_t g_sRGBSamples2[] = { 120, 121, 122, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 148, 149, 150, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 163, 164, @@ -514,9 +514,9 @@ void CPDF_LabCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int lab[1] = (FX_FLOAT)(pSrcBuf[1] - 128); lab[2] = (FX_FLOAT)(pSrcBuf[2] - 128); GetRGB(lab, R, G, B); - pDestBuf[0] = (FX_INT32)(B * 255); - pDestBuf[1] = (FX_INT32)(G * 255); - pDestBuf[2] = (FX_INT32)(R * 255); + pDestBuf[0] = (int32_t)(B * 255); + pDestBuf[1] = (int32_t)(G * 255); + pDestBuf[2] = (int32_t)(R * 255); pDestBuf += 3; pSrcBuf += 3; } @@ -611,7 +611,7 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) } else { // No valid alternative colorspace pAlterCS->ReleaseCS(); - FX_INT32 nDictComponents = pDict ? pDict->GetInteger(FX_BSTRC("N")) : 0; + int32_t nDictComponents = pDict ? pDict->GetInteger(FX_BSTRC("N")) : 0; if (nDictComponents != 1 && nDictComponents != 3 && nDictComponents != 4) { return FALSE; } @@ -715,14 +715,14 @@ void CPDF_ICCBasedCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, CPDF_ModuleMgr::Get()->GetIccModule()->TranslateScanline(m_pProfile->m_pTransform, pDestBuf, pSrcBuf, pixels); } else { if (m_pCache == NULL) { - ((CPDF_ICCBasedCS*)this)->m_pCache = FX_Alloc2D(FX_BYTE, nMaxColors, 3); - FX_LPBYTE temp_src = FX_Alloc2D(FX_BYTE, nMaxColors, m_nComponents); + ((CPDF_ICCBasedCS*)this)->m_pCache = FX_Alloc2D(uint8_t, nMaxColors, 3); + FX_LPBYTE temp_src = FX_Alloc2D(uint8_t, nMaxColors, m_nComponents); FX_LPBYTE pSrc = temp_src; for (int i = 0; i < nMaxColors; i ++) { FX_DWORD color = i; FX_DWORD order = nMaxColors / 52; for (int c = 0; c < m_nComponents; c ++) { - *pSrc++ = (FX_BYTE)(color / order * 5); + *pSrc++ = (uint8_t)(color / order * 5); color %= order; order /= 52; } @@ -826,7 +826,7 @@ FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) } FX_BOOL CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const { - int index = (FX_INT32)(*pBuf); + int index = (int32_t)(*pBuf); if (index < 0 || index > m_MaxIndex) { return FALSE; } @@ -1204,7 +1204,7 @@ int CPDF_ColorSpace::GetBufSize() const FX_FLOAT* CPDF_ColorSpace::CreateBuf() { int size = GetBufSize(); - FX_BYTE* pBuf = FX_Alloc(FX_BYTE, size); + uint8_t* pBuf = FX_Alloc(uint8_t, size); return (FX_FLOAT*)pBuf; } FX_BOOL CPDF_ColorSpace::sRGB() const @@ -1270,9 +1270,9 @@ void CPDF_ColorSpace::TranslateImageLine(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf, src[j] = (FX_FLOAT)(*src_buf ++) / 255; } GetRGB(src, R, G, B); - *dest_buf ++ = (FX_INT32)(B * 255); - *dest_buf ++ = (FX_INT32)(G * 255); - *dest_buf ++ = (FX_INT32)(R * 255); + *dest_buf ++ = (int32_t)(B * 255); + *dest_buf ++ = (int32_t)(G * 255); + *dest_buf ++ = (int32_t)(R * 255); } } void CPDF_ColorSpace::EnableStdConversion(FX_BOOL bEnabled) @@ -1420,9 +1420,9 @@ FX_BOOL CPDF_Color::GetRGB(int& R, int& G, int& B) const if (!m_pCS->GetRGB(m_pBuffer, r, g, b)) { return FALSE; } - R = (FX_INT32)(r * 255 + 0.5f); - G = (FX_INT32)(g * 255 + 0.5f); - B = (FX_INT32)(b * 255 + 0.5f); + R = (int32_t)(r * 255 + 0.5f); + G = (int32_t)(g * 255 + 0.5f); + B = (int32_t)(b * 255 + 0.5f); return TRUE; } CPDF_Pattern* CPDF_Color::GetPattern() const diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp index 241b5895c5..00ea4c5fce 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp @@ -572,7 +572,7 @@ CPDF_IccProfile* CPDF_DocPageData::GetIccProfile(CPDF_Stream* pIccProfileStream) } CPDF_StreamAcc stream; stream.LoadAllData(pIccProfileStream, FALSE); - FX_BYTE digest[20]; + uint8_t digest[20]; CPDF_Stream* pCopiedStream = NULL; CRYPT_SHA1Generate(stream.GetData(), stream.GetSize(), digest); if (m_HashProfileMap.Lookup(CFX_ByteStringC(digest, 20), (void*&)pCopiedStream)) { @@ -621,7 +621,7 @@ CPDF_StreamAcc* CPDF_DocPageData::GetFontFileStreamAcc(CPDF_Stream* pFontStream) ftData = new CPDF_CountedObject; CPDF_StreamAcc* pFontFile = new CPDF_StreamAcc; CPDF_Dictionary* pFontDict = pFontStream->GetDict(); - FX_INT32 org_size = pFontDict->GetInteger(FX_BSTRC("Length1")) + pFontDict->GetInteger(FX_BSTRC("Length2")) + pFontDict->GetInteger(FX_BSTRC("Length3")); + int32_t org_size = pFontDict->GetInteger(FX_BSTRC("Length1")) + pFontDict->GetInteger(FX_BSTRC("Length2")) + pFontDict->GetInteger(FX_BSTRC("Length3")); if (org_size < 0) { org_size = 0; } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp index d29dee77d8..dadf6bf9cb 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp @@ -77,7 +77,7 @@ FX_BOOL CPDF_PSProc::Execute(CPDF_PSEngine* pEngine) { int size = m_Operators.GetSize(); for (int i = 0; i < size; i ++) { - PDF_PSOP op = (PDF_PSOP)(FX_UINTPTR)m_Operators[i]; + PDF_PSOP op = (PDF_PSOP)(uintptr_t)m_Operators[i]; if (op == PSOP_PROC) { i ++; } else if (op == PSOP_CONST) { @@ -492,7 +492,7 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) if (!pSize && i == 0) { m_pEncodeInfo[i].sizes = pDict->GetInteger(FX_BSTRC("Size")); } - if (nTotalSamples > 0 && (FX_UINT32)(m_pEncodeInfo[i].sizes) > UINT_MAX / nTotalSamples) { + if (nTotalSamples > 0 && (uint32_t)(m_pEncodeInfo[i].sizes) > UINT_MAX / nTotalSamples) { return FALSE; } nTotalSamples *= m_pEncodeInfo[i].sizes; @@ -512,7 +512,7 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) return FALSE; } nTotalSamples *= m_nBitsPerSample; - if (nTotalSamples > 0 && ((FX_UINT32)m_nOutputs) > UINT_MAX / nTotalSamples) { + if (nTotalSamples > 0 && ((uint32_t)m_nOutputs) > UINT_MAX / nTotalSamples) { return FALSE; } nTotalSamples *= m_nOutputs; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp index 2bf3b1d4c3..bb4b9dee23 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp @@ -60,7 +60,7 @@ CPDF_ClipPathData::CPDF_ClipPathData(const CPDF_ClipPathData& src) for (int i = 0; i < m_PathCount; i ++) { m_pPathList[i] = src.m_pPathList[i]; } - m_pTypeList = FX_Alloc(FX_BYTE, alloc_size); + m_pTypeList = FX_Alloc(uint8_t, alloc_size); FXSYS_memcpy32(m_pTypeList, src.m_pTypeList, m_PathCount); } else { m_pPathList = NULL; @@ -88,7 +88,7 @@ void CPDF_ClipPathData::SetCount(int path_count, int text_count) m_PathCount = path_count; int alloc_size = (path_count + 7) / 8 * 8; m_pPathList = new CPDF_Path[alloc_size]; - m_pTypeList = FX_Alloc(FX_BYTE, alloc_size); + m_pTypeList = FX_Alloc(uint8_t, alloc_size); } if (text_count) { m_TextCount = text_count; @@ -155,7 +155,7 @@ void CPDF_ClipPath::AppendPath(CPDF_Path path, int type, FX_BOOL bAutoMerge) pNewPath[i] = pData->m_pPathList[i]; } delete[] pData->m_pPathList; - FX_BYTE* pNewType = FX_Alloc(FX_BYTE, pData->m_PathCount + 8); + uint8_t* pNewType = FX_Alloc(uint8_t, pData->m_PathCount + 8); FXSYS_memcpy32(pNewType, pData->m_pTypeList, pData->m_PathCount); if (pData->m_pTypeList) { FX_Free(pData->m_pTypeList); @@ -164,7 +164,7 @@ void CPDF_ClipPath::AppendPath(CPDF_Path path, int type, FX_BOOL bAutoMerge) pData->m_pTypeList = pNewType; } pData->m_pPathList[pData->m_PathCount] = path; - pData->m_pTypeList[pData->m_PathCount] = (FX_BYTE)type; + pData->m_pTypeList[pData->m_PathCount] = (uint8_t)type; pData->m_PathCount ++; } void CPDF_ClipPath::DeletePath(int index) diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp index b3e3cd6a2c..a92e9e783d 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -1553,7 +1553,7 @@ CFX_ByteString _FPDF_ByteStringFromHex(CFX_BinaryBuf& src_buf) FX_LPCBYTE str = src_buf.GetBuffer(); FX_DWORD size = src_buf.GetSize(); for (FX_DWORD i = 0; i < size; i ++) { - FX_BYTE ch = str[i]; + uint8_t ch = str[i]; if (ch >= '0' && ch <= '9') { if (bFirst) { code = (ch - '0') * 16; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp index d8b24593ef..bc2138e19e 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -23,7 +23,7 @@ FX_BOOL _PDF_HasInvalidOpChar(FX_LPCSTR op) if(!op) { return FALSE; } - FX_BYTE ch; + uint8_t ch; while((ch = *op++)) { if(_PDF_OpCharType[ch] == 'I') { return TRUE; @@ -235,7 +235,7 @@ void CPDF_StreamContentParser::ParsePathObject() } } } -CPDF_StreamParser::CPDF_StreamParser(const FX_BYTE* pData, FX_DWORD dwSize) +CPDF_StreamParser::CPDF_StreamParser(const uint8_t* pData, FX_DWORD dwSize) { m_pBuf = pData; m_Size = dwSize; @@ -262,7 +262,7 @@ FX_DWORD _DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, FX_LPBYTE& dest_b delete pDecoder; return -1; } - dest_buf = FX_Alloc2D(FX_BYTE, pitch, height); + dest_buf = FX_Alloc2D(uint8_t, pitch, height); dest_size = pitch * height; // Safe since checked alloc returned. for (int row = 0; row < height; row ++) { FX_LPBYTE pLine = pDecoder->GetScanline(row); @@ -277,11 +277,11 @@ FX_DWORD _DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, FX_LPBYTE& dest_b } ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, const CPDF_Dictionary* pParams); -FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); -FX_DWORD _HexDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); -FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams, +FX_DWORD _A85Decode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); +FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); +FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams, FX_DWORD estimated_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); -FX_DWORD PDF_DecodeInlineStream(const FX_BYTE* src_buf, FX_DWORD limit, +FX_DWORD PDF_DecodeInlineStream(const uint8_t* src_buf, FX_DWORD limit, int width, int height, CFX_ByteString& decoder, CPDF_Dictionary* pParam, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { @@ -373,7 +373,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CPDF_Dicti if (OrigSize > m_Size - m_Pos) { OrigSize = m_Size - m_Pos; } - pData = FX_Alloc(FX_BYTE, OrigSize); + pData = FX_Alloc(uint8_t, OrigSize); FXSYS_memcpy32(pData, m_pBuf + m_Pos, OrigSize); dwStreamSize = OrigSize; m_Pos += OrigSize; @@ -421,7 +421,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CPDF_Dicti dwStreamSize += m_Pos - dwPrevPos; } m_Pos = dwSavePos; - pData = FX_Alloc(FX_BYTE, dwStreamSize); + pData = FX_Alloc(uint8_t, dwStreamSize); FXSYS_memcpy32(pData, m_pBuf + m_Pos, dwStreamSize); m_Pos += dwStreamSize; } @@ -1049,7 +1049,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) } m_Size += size + 1; } - m_pData = FX_Alloc(FX_BYTE, m_Size); + m_pData = FX_Alloc(uint8_t, m_Size); FX_DWORD pos = 0; for (i = 0; i < m_nStreams; i ++) { FXSYS_memcpy32(m_pData + pos, m_pStreamArray[i]->GetData(), m_pStreamArray[i]->GetSize()); diff --git a/core/src/fpdfapi/fpdf_page/pageint.h b/core/src/fpdfapi/fpdf_page/pageint.h index 8b3c5171c8..bdbf8dc886 100644 --- a/core/src/fpdfapi/fpdf_page/pageint.h +++ b/core/src/fpdfapi/fpdf_page/pageint.h @@ -16,7 +16,7 @@ class CPDF_StreamParser { public: - CPDF_StreamParser(const FX_BYTE* pData, FX_DWORD dwSize); + CPDF_StreamParser(const uint8_t* pData, FX_DWORD dwSize); ~CPDF_StreamParser(); CPDF_Stream* ReadInlineStream(CPDF_Document* pDoc, CPDF_Dictionary* pDict, CPDF_Object* pCSObj, FX_BOOL bDecode); @@ -52,10 +52,10 @@ protected: void GetNextWord(FX_BOOL& bIsNumber); CFX_ByteString ReadString(); CFX_ByteString ReadHexString(); - const FX_BYTE* m_pBuf; + const uint8_t* m_pBuf; FX_DWORD m_Size; FX_DWORD m_Pos; - FX_BYTE m_WordBuffer[256]; + uint8_t m_WordBuffer[256]; FX_DWORD m_WordSize; CPDF_Object* m_pLastObj; }; @@ -153,7 +153,7 @@ public: FX_FLOAT GetNumber16(FX_DWORD index); int GetInteger(FX_DWORD index) { - return (FX_INT32)(GetNumber(index)); + return (int32_t)(GetNumber(index)); } FX_BOOL OnOperator(FX_LPCSTR op); void BigCaseCaller(int index); @@ -338,7 +338,7 @@ KeyType PDF_DocPageData_FindValue(const CFX_MapPtrTemplate FX_BOOL PDF_DocPageData_Release(CFX_MapPtrTemplate*> &map, KeyType findKey, ValueType findValue, FX_BOOL bForce = FALSE) @@ -422,11 +422,11 @@ class CPDF_IccProfile public: CPDF_IccProfile(FX_LPCBYTE pData, FX_DWORD dwSize); ~CPDF_IccProfile(); - FX_INT32 GetComponents() const { return m_nSrcComponents; } + int32_t GetComponents() const { return m_nSrcComponents; } FX_BOOL m_bsRGB; FX_LPVOID m_pTransform; private: - FX_INT32 m_nSrcComponents; + int32_t m_nSrcComponents; }; class CPDF_DeviceCS : public CPDF_ColorSpace { diff --git a/core/src/fpdfapi/fpdf_parser/filters_int.h b/core/src/fpdfapi/fpdf_parser/filters_int.h index 1139371fda..6652cc0ccc 100644 --- a/core/src/fpdfapi/fpdf_parser/filters_int.h +++ b/core/src/fpdfapi/fpdf_parser/filters_int.h @@ -26,7 +26,7 @@ public: virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {} void* m_pContext; - FX_BYTE m_DestBuffer[FPDF_FILTER_BUFFER_SIZE]; + uint8_t m_DestBuffer[FPDF_FILTER_BUFFER_SIZE]; }; class CPDF_LzwFilter : public CFX_DataFilter { @@ -40,11 +40,11 @@ public: FX_DWORD m_nCodes; FX_DWORD m_CodeLen; FX_DWORD m_OldCode; - FX_BYTE m_LastChar; + uint8_t m_LastChar; FX_DWORD m_nLeftBits, m_LeftBits; - FX_BYTE m_DecodeStack[4000]; + uint8_t m_DecodeStack[4000]; FX_DWORD m_StackLen; - void AddCode(FX_DWORD prefix_code, FX_BYTE append_char); + void AddCode(FX_DWORD prefix_code, uint8_t append_char); void DecodeString(FX_DWORD code); }; class CPDF_PredictorFilter : public CFX_DataFilter diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp index d18caab217..b1fde0be71 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp @@ -9,7 +9,7 @@ #include "../../../include/fxcodec/fx_codec.h" #include #define _STREAM_MAX_SIZE_ 20 * 1024 * 1024 -FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +FX_DWORD _A85Decode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { dest_size = 0; dest_buf = NULL; @@ -19,7 +19,7 @@ FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b FX_DWORD zcount = 0; FX_DWORD pos = 0; while (pos < src_size) { - FX_BYTE ch = src_buf[pos]; + uint8_t ch = src_buf[pos]; if (ch < '!' && ch != '\n' && ch != '\r' && ch != ' ' && ch != '\t') { break; } @@ -39,12 +39,12 @@ FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b if (zcount * 4 > UINT_MAX - (pos - zcount)) { return (FX_DWORD) - 1; } - dest_buf = FX_Alloc(FX_BYTE, zcount * 4 + (pos - zcount)); + dest_buf = FX_Alloc(uint8_t, zcount * 4 + (pos - zcount)); int state = 0; - FX_UINT32 res = 0; + uint32_t res = 0; pos = dest_size = 0; while (pos < src_size) { - FX_BYTE ch = src_buf[pos++]; + uint8_t ch = src_buf[pos++]; if (ch == '\n' || ch == '\r' || ch == ' ' || ch == '\t') { continue; } @@ -61,7 +61,7 @@ FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b state ++; if (state == 5) { for (int i = 0; i < 4; i ++) { - dest_buf[dest_size++] = (FX_BYTE)(res >> (3 - i) * 8); + dest_buf[dest_size++] = (uint8_t)(res >> (3 - i) * 8); } state = 0; res = 0; @@ -74,7 +74,7 @@ FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b res = res * 85 + 84; } for (i = 0; i < state - 1; i ++) { - dest_buf[dest_size++] = (FX_BYTE)(res >> (3 - i) * 8); + dest_buf[dest_size++] = (uint8_t)(res >> (3 - i) * 8); } } if (pos < src_size && src_buf[pos] == '>') { @@ -82,18 +82,18 @@ FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b } return pos; } -FX_DWORD _HexDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { FX_DWORD i; for (i = 0; i < src_size; i ++) if (src_buf[i] == '>') { break; } - dest_buf = FX_Alloc( FX_BYTE, i / 2 + 1); + dest_buf = FX_Alloc( uint8_t, i / 2 + 1); dest_size = 0; FX_BOOL bFirstDigit = TRUE; for (i = 0; i < src_size; i ++) { - FX_BYTE ch = src_buf[i]; + uint8_t ch = src_buf[i]; if (ch == ' ' || ch == '\n' || ch == '\t' || ch == '\r') { continue; } @@ -122,7 +122,7 @@ FX_DWORD _HexDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b } return i; } -FX_DWORD RunLengthDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +FX_DWORD RunLengthDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { FX_DWORD i = 0; FX_DWORD old; @@ -149,7 +149,7 @@ FX_DWORD RunLengthDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& d if (dest_size >= _STREAM_MAX_SIZE_) { return -1; } - dest_buf = FX_Alloc( FX_BYTE, dest_size); + dest_buf = FX_Alloc( uint8_t, dest_size); i = 0; int dest_count = 0; while (i < src_size) { @@ -245,7 +245,7 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD return CPDF_ModuleMgr::Get()->GetFlateModule()->CreateDecoder(src_buf, src_size, width, height, nComps, bpc, predictor, Colors, BitsPerComponent, Columns); } -FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams, +FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams, FX_DWORD estimated_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { int predictor = 0; @@ -468,7 +468,7 @@ CFX_ByteString PDF_EncodeText(FX_LPCWSTR pString, int len, CFX_CharMap* pCharMap dest_buf2 += 2; for (int i = 0; i < len; i ++) { *dest_buf2++ = pString[i] >> 8; - *dest_buf2++ = (FX_BYTE)pString[i]; + *dest_buf2++ = (uint8_t)pString[i]; } result.ReleaseBuffer(encLen); return result; @@ -488,7 +488,7 @@ CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex) } result.AppendChar('('); for (int i = 0; i < srclen; i ++) { - FX_BYTE ch = src[i]; + uint8_t ch = src[i]; if (ch == ')' || ch == '\\' || ch == '(') { result.AppendChar('\\'); } else if (ch == 0x0a) { @@ -503,7 +503,7 @@ CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex) result.AppendChar(')'); return result.GetByteString(); } -void FlateEncode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +void FlateEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); if (pEncoders) { @@ -518,7 +518,7 @@ void FlateEncode(FX_LPCBYTE src_buf, FX_DWORD src_size, int predictor, int Color pEncoders->GetFlateModule()->Encode(src_buf, src_size, predictor, Colors, BitsPerComponent, Columns, dest_buf, dest_size); } } -FX_DWORD FlateDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +FX_DWORD FlateDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); if (pEncoders) { diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp index b11c7eeb44..f2643694ec 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp @@ -343,7 +343,7 @@ FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const { { CPDF_Object* pObj; - if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, (FX_LPVOID&)pObj)) { + if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, (FX_LPVOID&)pObj)) { bForm = pObj->GetType() == PDFOBJ_STREAM && ((CPDF_Stream*)pObj)->GetDict()->GetString(FX_BSTRC("Subtype")) == FX_BSTRC("Form"); return TRUE; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp index e35b0a9d10..4ca97fe9e8 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp @@ -7,7 +7,7 @@ #include #include "../../../include/fpdfapi/fpdf_parser.h" #include "../../../include/fdrm/fx_crypt.h" -const FX_BYTE defpasscode[32] = { +const uint8_t defpasscode[32] = { 0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e, 0x56, 0xff, 0xfa, 0x01, 0x08, 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80, @@ -17,11 +17,11 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt, FX_LPCBYTE password, FX_DWORD pas FX_LPBYTE key, int keylen, FX_BOOL bIgnoreMeta, CPDF_Array* pIdArray) { int revision = pEncrypt->GetInteger(FX_BSTRC("R")); - FX_BYTE passcode[32]; + uint8_t passcode[32]; for (FX_DWORD i = 0; i < 32; i ++) { passcode[i] = i < pass_size ? password[i] : defpasscode[i - pass_size]; } - FX_BYTE md5[100]; + uint8_t md5[100]; CRYPT_MD5Start(md5); CRYPT_MD5Update(md5, passcode, 32); CFX_ByteString okey = pEncrypt->GetString(FX_BSTRC("O")); @@ -36,7 +36,7 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt, FX_LPCBYTE password, FX_DWORD pas FX_DWORD tag = (FX_DWORD) - 1; CRYPT_MD5Update(md5, (FX_LPBYTE)&tag, 4); } - FX_BYTE digest[16]; + uint8_t digest[16]; CRYPT_MD5Finish(md5, digest); FX_DWORD copy_len = keylen; if (copy_len > sizeof(digest)) { @@ -55,8 +55,8 @@ CPDF_CryptoHandler* CPDF_StandardSecurityHandler::CreateCryptoHandler() return new CPDF_StandardCryptoHandler; } typedef struct _PDF_CRYPTOITEM { - FX_INT32 m_Cipher; - FX_INT32 m_KeyLen; + int32_t m_Cipher; + int32_t m_KeyLen; FX_BOOL m_bChecked; CPDF_StandardCryptoHandler* m_pCryptoHandler; } PDF_CRYPTOITEM; @@ -85,7 +85,7 @@ FX_BOOL CPDF_StandardSecurityHandler::OnInit(CPDF_Parser* pParser, CPDF_Dictiona } return CheckSecurity(m_KeyLen); } -FX_BOOL CPDF_StandardSecurityHandler::CheckSecurity(FX_INT32 key_len) +FX_BOOL CPDF_StandardSecurityHandler::CheckSecurity(int32_t key_len) { CFX_ByteString password = m_pParser->GetPassword(); if (CheckPassword(password, password.GetLength(), TRUE, m_EncryptKey, key_len)) { @@ -198,14 +198,14 @@ FX_BOOL CPDF_StandardSecurityHandler::GetCryptInfo(int& cipher, FX_LPCBYTE& buff } #define FX_GET_32WORD(n,b,i) \ { \ - (n) = (FX_DWORD)(( (FX_UINT64) (b)[(i)] << 24 ) \ - | ( (FX_UINT64) (b)[(i) + 1] << 16 ) \ - | ( (FX_UINT64) (b)[(i) + 2] << 8 ) \ - | ( (FX_UINT64) (b)[(i) + 3] )); \ + (n) = (FX_DWORD)(( (uint64_t) (b)[(i)] << 24 ) \ + | ( (uint64_t) (b)[(i) + 1] << 16 ) \ + | ( (uint64_t) (b)[(i) + 2] << 8 ) \ + | ( (uint64_t) (b)[(i) + 3] )); \ } int BigOrder64BitsMod3(FX_LPBYTE data) { - FX_UINT64 ret = 0; + uint64_t ret = 0; for (int i = 0; i < 4; ++i) { FX_DWORD value; FX_GET_32WORD(value, data, 4 * i); @@ -218,14 +218,14 @@ int BigOrder64BitsMod3(FX_LPBYTE data) void Revision6_Hash(FX_LPCBYTE password, FX_DWORD size, FX_LPCBYTE salt, FX_LPCBYTE vector, FX_LPBYTE hash) { int iBlockSize = 32; - FX_BYTE sha[128]; + uint8_t sha[128]; CRYPT_SHA256Start(sha); CRYPT_SHA256Update(sha, password, size); CRYPT_SHA256Update(sha, salt, 8); if (vector) { CRYPT_SHA256Update(sha, vector, 48); } - FX_BYTE digest[32]; + uint8_t digest[32]; CRYPT_SHA256Finish(sha, digest); CFX_ByteTextBuf buf; FX_LPBYTE input = digest; @@ -235,7 +235,7 @@ void Revision6_Hash(FX_LPCBYTE password, FX_DWORD size, FX_LPCBYTE salt, FX_LPCB int iBufLen = buf.GetLength(); CFX_ByteTextBuf interDigest; int i = 0; - FX_LPBYTE aes = FX_Alloc(FX_BYTE, 2048); + FX_LPBYTE aes = FX_Alloc(uint8_t, 2048); while (i < 64 || i < E[iBufLen - 1] + 32) { int iRoundSize = size + iBlockSize; if (vector) { @@ -300,8 +300,8 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, return FALSE; } FX_LPCBYTE pkey = bOwner ? (FX_LPCBYTE)okey : (FX_LPCBYTE)ukey; - FX_BYTE sha[128]; - FX_BYTE digest[32]; + uint8_t sha[128]; + uint8_t digest[32]; if (m_Revision >= 6) { Revision6_Hash(password, size, (FX_LPCBYTE)pkey + 32, (bOwner ? (FX_LPCBYTE)ukey : NULL), digest); } else { @@ -334,9 +334,9 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, if (ekey.GetLength() < 32) { return FALSE; } - FX_BYTE* aes = FX_Alloc(FX_BYTE, 2048); + uint8_t* aes = FX_Alloc(uint8_t, 2048); CRYPT_AESSetKey(aes, 16, digest, 32, FALSE); - FX_BYTE iv[16]; + uint8_t iv[16]; FXSYS_memset32(iv, 0, 16); CRYPT_AESSetIV(aes, iv); CRYPT_AESDecrypt(aes, key, ekey, 32); @@ -346,14 +346,14 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, if (perms.IsEmpty()) { return FALSE; } - FX_BYTE perms_buf[16]; + uint8_t perms_buf[16]; FXSYS_memset32(perms_buf, 0, sizeof(perms_buf)); FX_DWORD copy_len = sizeof(perms_buf); if (copy_len > (FX_DWORD)perms.GetLength()) { copy_len = perms.GetLength(); } FXSYS_memcpy32(perms_buf, (FX_LPCBYTE)perms, copy_len); - FX_BYTE buf[16]; + uint8_t buf[16]; CRYPT_AESDecrypt(aes, buf, perms_buf, 16); FX_Free(aes); if (buf[9] != 'a' || buf[10] != 'd' || buf[11] != 'b') { @@ -371,12 +371,12 @@ int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD pa { return CheckPassword(password, pass_size, bOwner, key, m_KeyLen); } -int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD size, FX_BOOL bOwner, FX_LPBYTE key, FX_INT32 key_len) +int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD size, FX_BOOL bOwner, FX_LPBYTE key, int32_t key_len) { if (m_Revision >= 5) { return AES256_CheckPassword(password, size, bOwner, key); } - FX_BYTE keybuf[32]; + uint8_t keybuf[32]; if (key == NULL) { key = keybuf; } @@ -386,7 +386,7 @@ int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD si return CheckUserPassword(password, size, FALSE, key, key_len) || CheckUserPassword(password, size, TRUE, key, key_len); } FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_DWORD pass_size, - FX_BOOL bIgnoreEncryptMeta, FX_LPBYTE key, FX_INT32 key_len) + FX_BOOL bIgnoreEncryptMeta, FX_LPBYTE key, int32_t key_len) { CalcEncryptKey(m_pEncryptDict, password, pass_size, key, key_len, bIgnoreEncryptMeta, m_pParser->GetIDArray()); @@ -394,12 +394,12 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_ if (ukey.GetLength() < 16) { return FALSE; } - FX_BYTE ukeybuf[32]; + uint8_t ukeybuf[32]; if (m_Revision == 2) { FXSYS_memcpy32(ukeybuf, defpasscode, 32); CRYPT_ArcFourCryptBlock(ukeybuf, 32, key, key_len); } else { - FX_BYTE test[32], tmpkey[32]; + uint8_t test[32], tmpkey[32]; FX_DWORD copy_len = sizeof(test); if (copy_len > (FX_DWORD)ukey.GetLength()) { copy_len = ukey.GetLength(); @@ -413,7 +413,7 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_ } CRYPT_ArcFourCryptBlock(test, 32, tmpkey, key_len); } - FX_BYTE md5[100]; + uint8_t md5[100]; CRYPT_MD5Start(md5); CRYPT_MD5Update(md5, defpasscode, 32); CPDF_Array* pIdArray = m_pParser->GetIDArray(); @@ -433,22 +433,22 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pa { return GetUserPassword(owner_pass, pass_size, m_KeyLen); } -CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pass, FX_DWORD pass_size, FX_INT32 key_len) +CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pass, FX_DWORD pass_size, int32_t key_len) { CFX_ByteString okey = m_pEncryptDict->GetString(FX_BSTRC("O")); - FX_BYTE passcode[32]; + uint8_t passcode[32]; FX_DWORD i; for (i = 0; i < 32; i ++) { passcode[i] = i < pass_size ? owner_pass[i] : defpasscode[i - pass_size]; } - FX_BYTE digest[16]; + uint8_t digest[16]; CRYPT_MD5Generate(passcode, 32, digest); if (m_Revision >= 3) { for (int i = 0; i < 50; i ++) { CRYPT_MD5Generate(digest, 16, digest); } } - FX_BYTE enckey[32]; + uint8_t enckey[32]; FXSYS_memset32(enckey, 0, sizeof(enckey)); FX_DWORD copy_len = key_len; if (copy_len > sizeof(digest)) { @@ -459,14 +459,14 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pa if (okeylen > 32) { okeylen = 32; } - FX_BYTE okeybuf[64]; + uint8_t okeybuf[64]; FXSYS_memset32(okeybuf, 0, sizeof(okeybuf)); FXSYS_memcpy32(okeybuf, okey.c_str(), okeylen); if (m_Revision == 2) { CRYPT_ArcFourCryptBlock(okeybuf, okeylen, enckey, key_len); } else { for (int i = 19; i >= 0; i --) { - FX_BYTE tempkey[32]; + uint8_t tempkey[32]; FXSYS_memset32(tempkey, 0, sizeof(tempkey)); for (int j = 0; j < m_KeyLen; j ++) { tempkey[j] = enckey[j] ^ i; @@ -481,7 +481,7 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pa return CFX_ByteString(okeybuf, len); } FX_BOOL CPDF_StandardSecurityHandler::CheckOwnerPassword(FX_LPCBYTE password, FX_DWORD pass_size, - FX_LPBYTE key, FX_INT32 key_len) + FX_LPBYTE key, int32_t key_len) { CFX_ByteString user_pass = GetUserPassword(password, pass_size, key_len); if (CheckUserPassword(user_pass, user_pass.GetLength(), FALSE, key, key_len)) { @@ -511,11 +511,11 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ } if (m_Revision >= 5) { int t = (int)time(NULL); - FX_BYTE sha[128]; + uint8_t sha[128]; CRYPT_SHA256Start(sha); - CRYPT_SHA256Update(sha, (FX_BYTE*)&t, sizeof t); + CRYPT_SHA256Update(sha, (uint8_t*)&t, sizeof t); CRYPT_SHA256Update(sha, m_EncryptKey, 32); - CRYPT_SHA256Update(sha, (FX_BYTE*)"there", 5); + CRYPT_SHA256Update(sha, (uint8_t*)"there", 5); CRYPT_SHA256Finish(sha, m_EncryptKey); AES256_SetPassword(pEncryptDict, user_pass, user_size, FALSE, m_EncryptKey); if (bDefault) { @@ -525,29 +525,29 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ return; } if (bDefault) { - FX_BYTE passcode[32]; + uint8_t passcode[32]; FX_DWORD i; for (i = 0; i < 32; i ++) { passcode[i] = i < owner_size ? owner_pass[i] : defpasscode[i - owner_size]; } - FX_BYTE digest[16]; + uint8_t digest[16]; CRYPT_MD5Generate(passcode, 32, digest); if (m_Revision >= 3) { for (int i = 0; i < 50; i ++) { CRYPT_MD5Generate(digest, 16, digest); } } - FX_BYTE enckey[32]; + uint8_t enckey[32]; FXSYS_memcpy32(enckey, digest, key_len); for (i = 0; i < 32; i ++) { passcode[i] = i < user_size ? user_pass[i] : defpasscode[i - user_size]; } CRYPT_ArcFourCryptBlock(passcode, 32, enckey, key_len); - FX_BYTE tempkey[32]; + uint8_t tempkey[32]; if (m_Revision >= 3) { for (i = 1; i <= 19; i ++) { for (int j = 0; j < key_len; j ++) { - tempkey[j] = enckey[j] ^ (FX_BYTE)i; + tempkey[j] = enckey[j] ^ (uint8_t)i; } CRYPT_ArcFourCryptBlock(passcode, 32, tempkey, key_len); } @@ -556,25 +556,25 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ } CalcEncryptKey(m_pEncryptDict, (FX_LPBYTE)user_pass, user_size, m_EncryptKey, key_len, FALSE, pIdArray); if (m_Revision < 3) { - FX_BYTE tempbuf[32]; + uint8_t tempbuf[32]; FXSYS_memcpy32(tempbuf, defpasscode, 32); CRYPT_ArcFourCryptBlock(tempbuf, 32, m_EncryptKey, key_len); pEncryptDict->SetAtString(FX_BSTRC("U"), CFX_ByteString(tempbuf, 32)); } else { - FX_BYTE md5[100]; + uint8_t md5[100]; CRYPT_MD5Start(md5); CRYPT_MD5Update(md5, defpasscode, 32); if (pIdArray) { CFX_ByteString id = pIdArray->GetString(0); CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength()); } - FX_BYTE digest[32]; + uint8_t digest[32]; CRYPT_MD5Finish(md5, digest); CRYPT_ArcFourCryptBlock(digest, 16, m_EncryptKey, key_len); - FX_BYTE tempkey[32]; + uint8_t tempkey[32]; for (int i = 1; i <= 19; i ++) { for (int j = 0; j < key_len; j ++) { - tempkey[j] = m_EncryptKey[j] ^ (FX_BYTE)i; + tempkey[j] = m_EncryptKey[j] ^ (uint8_t)i; } CRYPT_ArcFourCryptBlock(digest, 16, tempkey, key_len); } @@ -594,14 +594,14 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ } void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict, FX_LPCBYTE password, FX_DWORD size, FX_BOOL bOwner, FX_LPCBYTE key) { - FX_BYTE sha[128]; + uint8_t sha[128]; CRYPT_SHA1Start(sha); CRYPT_SHA1Update(sha, key, 32); - CRYPT_SHA1Update(sha, (FX_BYTE*)"hello", 5); - FX_BYTE digest[20]; + CRYPT_SHA1Update(sha, (uint8_t*)"hello", 5); + uint8_t digest[20]; CRYPT_SHA1Finish(sha, digest); CFX_ByteString ukey = pEncryptDict->GetString(FX_BSTRC("U")); - FX_BYTE digest1[48]; + uint8_t digest1[48]; if (m_Revision >= 6) { Revision6_Hash(password, size, digest, (bOwner ? (FX_LPCBYTE)ukey : NULL), digest1); } else { @@ -626,9 +626,9 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD } CRYPT_SHA256Finish(sha, digest1); } - FX_BYTE* aes = FX_Alloc(FX_BYTE, 2048); + uint8_t* aes = FX_Alloc(uint8_t, 2048); CRYPT_AESSetKey(aes, 16, digest1, 32, TRUE); - FX_BYTE iv[16]; + uint8_t iv[16]; FXSYS_memset32(iv, 0, 16); CRYPT_AESSetIV(aes, iv); CRYPT_AESEncrypt(aes, digest1, key, 32); @@ -638,11 +638,11 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD void CPDF_StandardSecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict, FX_DWORD permissions, FX_BOOL bEncryptMetadata, FX_LPCBYTE key) { - FX_BYTE buf[16]; - buf[0] = (FX_BYTE)permissions; - buf[1] = (FX_BYTE)(permissions >> 8); - buf[2] = (FX_BYTE)(permissions >> 16); - buf[3] = (FX_BYTE)(permissions >> 24); + uint8_t buf[16]; + buf[0] = (uint8_t)permissions; + buf[1] = (uint8_t)(permissions >> 8); + buf[2] = (uint8_t)(permissions >> 16); + buf[3] = (uint8_t)(permissions >> 24); buf[4] = 0xff; buf[5] = 0xff; buf[6] = 0xff; @@ -651,9 +651,9 @@ void CPDF_StandardSecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict buf[9] = 'a'; buf[10] = 'd'; buf[11] = 'b'; - FX_BYTE* aes = FX_Alloc(FX_BYTE, 2048); + uint8_t* aes = FX_Alloc(uint8_t, 2048); CRYPT_AESSetKey(aes, 16, key, 32, TRUE); - FX_BYTE iv[16], buf1[16]; + uint8_t iv[16], buf1[16]; FXSYS_memset32(iv, 0, 16); CRYPT_AESSetIV(aes, iv); CRYPT_AESEncrypt(aes, buf1, buf, 16); @@ -667,16 +667,16 @@ void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, F FXSYS_memcpy32(dest_buf, src_buf, src_size); return; } - FX_BYTE realkey[16]; + uint8_t realkey[16]; int realkeylen = 16; if (m_Cipher != FXCIPHER_AES || m_KeyLen != 32) { - FX_BYTE key1[32]; + uint8_t key1[32]; FXSYS_memcpy32(key1, m_EncryptKey, m_KeyLen); - key1[m_KeyLen + 0] = (FX_BYTE)objnum; - key1[m_KeyLen + 1] = (FX_BYTE)(objnum >> 8); - key1[m_KeyLen + 2] = (FX_BYTE)(objnum >> 16); - key1[m_KeyLen + 3] = (FX_BYTE)gennum; - key1[m_KeyLen + 4] = (FX_BYTE)(gennum >> 8); + key1[m_KeyLen + 0] = (uint8_t)objnum; + key1[m_KeyLen + 1] = (uint8_t)(objnum >> 8); + key1[m_KeyLen + 2] = (uint8_t)(objnum >> 16); + key1[m_KeyLen + 3] = (uint8_t)gennum; + key1[m_KeyLen + 4] = (uint8_t)(gennum >> 8); FXSYS_memcpy32(key1 + m_KeyLen, &objnum, 3); FXSYS_memcpy32(key1 + m_KeyLen + 3, &gennum, 2); if (m_Cipher == FXCIPHER_AES) { @@ -691,15 +691,15 @@ void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, F if (m_Cipher == FXCIPHER_AES) { CRYPT_AESSetKey(m_pAESContext, 16, m_KeyLen == 32 ? m_EncryptKey : realkey, m_KeyLen, bEncrypt); if (bEncrypt) { - FX_BYTE iv[16]; + uint8_t iv[16]; for (int i = 0; i < 16; i ++) { - iv[i] = (FX_BYTE)rand(); + iv[i] = (uint8_t)rand(); } CRYPT_AESSetIV(m_pAESContext, iv); FXSYS_memcpy32(dest_buf, iv, 16); int nblocks = src_size / 16; CRYPT_AESEncrypt(m_pAESContext, dest_buf + 16, src_buf, nblocks * 16); - FX_BYTE padding[16]; + uint8_t padding[16]; FXSYS_memcpy32(padding, src_buf + nblocks * 16, src_size % 16); FXSYS_memset8(padding + src_size % 16, 16 - src_size % 16, 16 - src_size % 16); CRYPT_AESEncrypt(m_pAESContext, dest_buf + nblocks * 16 + 16, padding, 16); @@ -719,9 +719,9 @@ void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, F } } typedef struct _AESCryptContext { - FX_BYTE m_Context[2048]; + uint8_t m_Context[2048]; FX_BOOL m_bIV; - FX_BYTE m_Block[16]; + uint8_t m_Block[16]; FX_DWORD m_BlockOffset; } AESCryptContext; FX_LPVOID CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennum, FX_BOOL bEncrypt) @@ -736,20 +736,20 @@ FX_LPVOID CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennu CRYPT_AESSetKey(pContext->m_Context, 16, m_EncryptKey, 32, bEncrypt); if (bEncrypt) { for (int i = 0; i < 16; i ++) { - pContext->m_Block[i] = (FX_BYTE)rand(); + pContext->m_Block[i] = (uint8_t)rand(); } CRYPT_AESSetIV(pContext->m_Context, pContext->m_Block); } return pContext; } - FX_BYTE key1[48]; + uint8_t key1[48]; FXSYS_memcpy32(key1, m_EncryptKey, m_KeyLen); FXSYS_memcpy32(key1 + m_KeyLen, &objnum, 3); FXSYS_memcpy32(key1 + m_KeyLen + 3, &gennum, 2); if (m_Cipher == FXCIPHER_AES) { FXSYS_memcpy32(key1 + m_KeyLen + 5, "sAlT", 4); } - FX_BYTE realkey[16]; + uint8_t realkey[16]; CRYPT_MD5Generate(key1, m_Cipher == FXCIPHER_AES ? m_KeyLen + 9 : m_KeyLen + 5, realkey); int realkeylen = m_KeyLen + 5; if (realkeylen > 16) { @@ -762,13 +762,13 @@ FX_LPVOID CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennu CRYPT_AESSetKey(pContext->m_Context, 16, realkey, 16, bEncrypt); if (bEncrypt) { for (int i = 0; i < 16; i ++) { - pContext->m_Block[i] = (FX_BYTE)rand(); + pContext->m_Block[i] = (uint8_t)rand(); } CRYPT_AESSetIV(pContext->m_Context, pContext->m_Block); } return pContext; } - void* pContext = FX_Alloc(FX_BYTE, 1040); + void* pContext = FX_Alloc(uint8_t, 1040); CRYPT_ArcFourSetup(pContext, realkey, realkeylen); return pContext; } @@ -809,7 +809,7 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptStream(FX_LPVOID context, FX_LPCBYTE sr pContext->m_bIV = FALSE; pContext->m_BlockOffset = 0; } else if (src_off < src_size) { - FX_BYTE block_buf[16]; + uint8_t block_buf[16]; if (bEncrypt) { CRYPT_AESEncrypt(pContext->m_Context, block_buf, pContext->m_Block, 16); } else { @@ -839,17 +839,17 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptFinish(FX_LPVOID context, CFX_BinaryBuf } AESCryptContext* pContext = (AESCryptContext*)context; if (bEncrypt) { - FX_BYTE block_buf[16]; + uint8_t block_buf[16]; if (pContext->m_BlockOffset == 16) { CRYPT_AESEncrypt(pContext->m_Context, block_buf, pContext->m_Block, 16); dest_buf.AppendBlock(block_buf, 16); pContext->m_BlockOffset = 0; } - FXSYS_memset8(pContext->m_Block + pContext->m_BlockOffset, (FX_BYTE)(16 - pContext->m_BlockOffset), 16 - pContext->m_BlockOffset); + FXSYS_memset8(pContext->m_Block + pContext->m_BlockOffset, (uint8_t)(16 - pContext->m_BlockOffset), 16 - pContext->m_BlockOffset); CRYPT_AESEncrypt(pContext->m_Context, block_buf, pContext->m_Block, 16); dest_buf.AppendBlock(block_buf, 16); } else if (pContext->m_BlockOffset == 16) { - FX_BYTE block_buf[16]; + uint8_t block_buf[16]; CRYPT_AESDecrypt(pContext->m_Context, block_buf, pContext->m_Block, 16); if (block_buf[15] <= 16) { dest_buf.AppendBlock(block_buf, 16 - block_buf[15]); @@ -879,7 +879,7 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(CPDF_Dictionary* pEncryptDict, CPDF_Sec FXSYS_memcpy32(m_EncryptKey, key, m_KeyLen); } if (m_Cipher == FXCIPHER_AES) { - m_pAESContext = FX_Alloc(FX_BYTE, 2048); + m_pAESContext = FX_Alloc(uint8_t, 2048); } return TRUE; } @@ -911,7 +911,7 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher, FX_LPCBYTE key, int keylen) m_KeyLen = keylen; FXSYS_memcpy32(m_EncryptKey, key, keylen); if (m_Cipher == FXCIPHER_AES) { - m_pAESContext = FX_Alloc(FX_BYTE, 2048); + m_pAESContext = FX_Alloc(uint8_t, 2048); } return TRUE; } diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp index 6fa7419a41..8cb0cee82a 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp @@ -296,7 +296,7 @@ void CPDF_DecryptFilter::v_FilterFinish(CFX_BinaryBuf& dest_buf) extern "C" { static void* my_alloc_func (void* opaque, unsigned int items, unsigned int size) { - return FX_Alloc2D(FX_BYTE, items, size); + return FX_Alloc2D(uint8_t, items, size); } static void my_free_func (void* opaque, void* address) { @@ -361,8 +361,8 @@ void CPDF_LzwFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_Binar m_nLeftBits = 8 - new_bits; m_LeftBits = src_buf[i] % (1 << m_nLeftBits); if (code < 256) { - dest_buf.AppendByte((FX_BYTE)code); - m_LastChar = (FX_BYTE)code; + dest_buf.AppendByte((uint8_t)code); + m_LastChar = (uint8_t)code; if (m_OldCode != -1) { AddCode(m_OldCode, m_LastChar); } @@ -406,7 +406,7 @@ void CPDF_LzwFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_Binar } } } -void CPDF_LzwFilter::AddCode(FX_DWORD prefix_code, FX_BYTE append_char) +void CPDF_LzwFilter::AddCode(FX_DWORD prefix_code, uint8_t append_char) { if (m_nCodes + m_bEarlyChange == 4094) { return; @@ -431,13 +431,13 @@ void CPDF_LzwFilter::DecodeString(FX_DWORD code) if (m_StackLen >= sizeof(m_DecodeStack)) { return; } - m_DecodeStack[m_StackLen++] = (FX_BYTE)data; + m_DecodeStack[m_StackLen++] = (uint8_t)data; code = data >> 16; } if (m_StackLen >= sizeof(m_DecodeStack)) { return; } - m_DecodeStack[m_StackLen++] = (FX_BYTE)code; + m_DecodeStack[m_StackLen++] = (uint8_t)code; } CPDF_PredictorFilter::CPDF_PredictorFilter(int predictor, int colors, int bpc, int cols) { @@ -461,23 +461,23 @@ CPDF_PredictorFilter::~CPDF_PredictorFilter() FX_Free(m_pRefLine); } } -static FX_BYTE PaethPredictor(int a, int b, int c) +static uint8_t PaethPredictor(int a, int b, int c) { int p = a + b - c; int pa = FXSYS_abs(p - a); int pb = FXSYS_abs(p - b); int pc = FXSYS_abs(p - c); if (pa <= pb && pa <= pc) { - return (FX_BYTE)a; + return (uint8_t)a; } if (pb <= pc) { - return (FX_BYTE)b; + return (uint8_t)b; } - return (FX_BYTE)c; + return (uint8_t)c; } static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, int Bpp) { - FX_BYTE tag = cur_buf[0]; + uint8_t tag = cur_buf[0]; if (tag == 0) { return; } @@ -486,10 +486,10 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i ref_buf ++; } for (int byte = 0; byte < pitch; byte ++) { - FX_BYTE raw_byte = cur_buf[byte]; + uint8_t raw_byte = cur_buf[byte]; switch (tag) { case 1: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= Bpp) { left = cur_buf[byte - Bpp]; } @@ -497,7 +497,7 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i break; } case 2: { - FX_BYTE up = 0; + uint8_t up = 0; if (ref_buf) { up = ref_buf[byte]; } @@ -505,11 +505,11 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i break; } case 3: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= Bpp) { left = cur_buf[byte - Bpp]; } - FX_BYTE up = 0; + uint8_t up = 0; if (ref_buf) { up = ref_buf[byte]; } @@ -517,15 +517,15 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i break; } case 4: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= Bpp) { left = cur_buf[byte - Bpp]; } - FX_BYTE up = 0; + uint8_t up = 0; if (ref_buf) { up = ref_buf[byte]; } - FX_BYTE upper_left = 0; + uint8_t upper_left = 0; if (byte >= Bpp && ref_buf) { upper_left = ref_buf[byte - Bpp]; } @@ -538,9 +538,9 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i void CPDF_PredictorFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { if (m_pCurLine == NULL) { - m_pCurLine = FX_Alloc(FX_BYTE, m_Pitch); + m_pCurLine = FX_Alloc(uint8_t, m_Pitch); if (!m_bTiff) { - m_pRefLine = FX_Alloc(FX_BYTE, m_Pitch); + m_pRefLine = FX_Alloc(uint8_t, m_Pitch); } } while (1) { @@ -579,7 +579,7 @@ CPDF_Ascii85Filter::CPDF_Ascii85Filter() void CPDF_Ascii85Filter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { for (FX_DWORD i = 0; i < src_size; i ++) { - FX_BYTE byte = src_buf[i]; + uint8_t byte = src_buf[i]; if (PDF_CharType[byte] == 'W') { continue; } @@ -604,7 +604,7 @@ void CPDF_Ascii85Filter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_B m_CharCount ++; if (m_CharCount == 5) { for (int i = 0; i < 4; i ++) { - dest_buf.AppendByte((FX_BYTE)(m_CurDWord >> (3 - i) * 8)); + dest_buf.AppendByte((uint8_t)(m_CurDWord >> (3 - i) * 8)); } m_State = 0; } @@ -615,7 +615,7 @@ void CPDF_Ascii85Filter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_B m_CurDWord = m_CurDWord * 85 + 84; } for (i = 0; i < m_CharCount - 1; i ++) { - dest_buf.AppendByte((FX_BYTE)(m_CurDWord >> (3 - i) * 8)); + dest_buf.AppendByte((uint8_t)(m_CurDWord >> (3 - i) * 8)); } } m_State = 2; @@ -638,7 +638,7 @@ CPDF_AsciiHexFilter::CPDF_AsciiHexFilter() void CPDF_AsciiHexFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { for (FX_DWORD i = 0; i < src_size; i ++) { - FX_BYTE byte = src_buf[i]; + uint8_t byte = src_buf[i]; if (PDF_CharType[byte] == 'W') { continue; } @@ -673,7 +673,7 @@ CPDF_RunLenFilter::CPDF_RunLenFilter() void CPDF_RunLenFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { for (FX_DWORD i = 0; i < src_size; i ++) { - FX_BYTE byte = src_buf[i]; + uint8_t byte = src_buf[i]; switch (m_State) { case 0: if (byte < 128) { @@ -755,7 +755,7 @@ void CPDF_JpegFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_Bina m_Pitch = m_Width * m_nComps; } if (m_pScanline == NULL) { - m_pScanline = FX_Alloc(FX_BYTE, m_Pitch + 4); + m_pScanline = FX_Alloc(uint8_t, m_Pitch + 4); } while (1) { if (!CPDF_ModuleMgr::Get()->GetJpegModule()->ReadScanline(m_pContext, m_pScanline)) { @@ -803,8 +803,8 @@ FX_BOOL CPDF_FaxFilter::Initialize(int Encoding, int bEndOfLine, int bByteAlign, m_nRows = nRows; m_nColumns = nColumns; m_Pitch = (m_nColumns + 7) / 8; - m_pScanlineBuf = FX_Alloc(FX_BYTE, m_Pitch); - m_pRefBuf = FX_Alloc(FX_BYTE, m_Pitch); + m_pScanlineBuf = FX_Alloc(uint8_t, m_Pitch); + m_pRefBuf = FX_Alloc(uint8_t, m_Pitch); FXSYS_memset8(m_pScanlineBuf, 0xff, m_Pitch); FXSYS_memset8(m_pRefBuf, 0xff, m_Pitch); m_iRow = 0; @@ -839,9 +839,9 @@ void CPDF_FaxFilter::v_FilterFinish(CFX_BinaryBuf& dest_buf) { ProcessData(m_InputBuf.GetBuffer(), m_InputBuf.GetSize(), m_InputBitPos, TRUE, dest_buf); } -FX_BOOL _FaxSkipEOL(const FX_BYTE* src_buf, int bitsize, int& bitpos); -FX_BOOL _FaxG4GetRow(const FX_BYTE* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, const FX_BYTE* ref_buf, int columns); -FX_BOOL _FaxGet1DLine(const FX_BYTE* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns); +FX_BOOL _FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos); +FX_BOOL _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, const uint8_t* ref_buf, int columns); +FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns); void CPDF_FaxFilter::ProcessData(FX_LPCBYTE src_buf, FX_DWORD src_size, int& bitpos, FX_BOOL bFinish, CFX_BinaryBuf& dest_buf) { diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp index 0e176066ef..8ecc0a5bf0 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp @@ -295,8 +295,8 @@ CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visite case PDFOBJ_REFERENCE: { CPDF_Reference* pRef = (CPDF_Reference*)this; FX_DWORD obj_num = pRef->m_RefObjNum; - if (bDirect && !visited->GetValueAt((void*)(FX_UINTPTR)obj_num)) { - visited->SetAt((void*)(FX_UINTPTR)obj_num, (void*)1); + if (bDirect && !visited->GetValueAt((void*)(uintptr_t)obj_num)) { + visited->SetAt((void*)(uintptr_t)obj_num, (void*)1); CPDF_Object* ret; if (pRef->GetDirect()) ret = pRef->GetDirect()->CloneInternal(TRUE, visited); @@ -896,7 +896,7 @@ void CPDF_Stream::InitStream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pD { InitStream(pDict); m_GenNum = (FX_DWORD) - 1; - m_pDataBuf = FX_Alloc(FX_BYTE, size); + m_pDataBuf = FX_Alloc(uint8_t, size); if (pData) { FXSYS_memcpy32(m_pDataBuf, pData, size); } @@ -918,7 +918,7 @@ void CPDF_Stream::SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed, if (bKeepBuf) { m_pDataBuf = (FX_LPBYTE)pData; } else { - m_pDataBuf = FX_Alloc(FX_BYTE, size); + m_pDataBuf = FX_Alloc(uint8_t, size); if (pData) { FXSYS_memcpy32(m_pDataBuf, pData, size); } @@ -970,8 +970,8 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const if (!m_pFile || !pOther->m_pFile) { return FALSE; } - FX_BYTE srcBuf[1024]; - FX_BYTE destBuf[1024]; + uint8_t srcBuf[1024]; + uint8_t destBuf[1024]; FX_DWORD size = m_dwSize; FX_DWORD srcOffset = m_FileOffset; FX_DWORD destOffset = pOther->m_FileOffset; @@ -1007,7 +1007,7 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const if (NULL == pBuf) { return FALSE; } - FX_BYTE srcBuf[1024]; + uint8_t srcBuf[1024]; FX_DWORD size = m_dwSize; while (size > 0) { FX_DWORD actualSize = std::min(size, 1024U); @@ -1039,7 +1039,7 @@ CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpf CPDF_Stream* pObj = new CPDF_Stream(NULL, 0, NULL); CPDF_StreamFilter *pSF = GetStreamFilter(TRUE); if (pSF) { - FX_LPBYTE pBuf = FX_Alloc(FX_BYTE, 4096); + FX_LPBYTE pBuf = FX_Alloc(uint8_t, 4096); FX_DWORD dwRead; do { dwRead = pSF->ReadBlock(pBuf, 4096); @@ -1085,7 +1085,7 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, FX_BOOL bRawAccess, return; } if (!pStream->IsMemoryBased()) { - pSrcData = m_pSrcData = FX_Alloc(FX_BYTE, dwSrcSize); + pSrcData = m_pSrcData = FX_Alloc(uint8_t, dwSrcSize); if (!pStream->ReadRawData(0, pSrcData, dwSrcSize)) { return; } @@ -1164,7 +1164,7 @@ FX_LPBYTE CPDF_StreamAcc::DetachData() m_dwSize = 0; return p; } - FX_LPBYTE p = FX_Alloc(FX_BYTE, m_dwSize); + FX_LPBYTE p = FX_Alloc(uint8_t, m_dwSize); FXSYS_memcpy32(p, m_pData, m_dwSize); return p; } @@ -1199,7 +1199,7 @@ CPDF_Object* CPDF_IndirectObjects::GetIndirectObject(FX_DWORD objnum, struct PAR } FX_LPVOID value; { - if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) { + if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { if (((CPDF_Object*)value)->GetObjNum() == -1) { return NULL; } @@ -1217,25 +1217,25 @@ CPDF_Object* CPDF_IndirectObjects::GetIndirectObject(FX_DWORD objnum, struct PAR if (m_LastObjNum < objnum) { m_LastObjNum = objnum; } - if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) { + if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { if (value) { ((CPDF_Object *)value)->Destroy(); } } - m_IndirectObjs.SetAt((FX_LPVOID)(FX_UINTPTR)objnum, pObj); + m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)objnum, pObj); return pObj; } int CPDF_IndirectObjects::GetIndirectType(FX_DWORD objnum) { FX_LPVOID value; - if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) { + if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { return ((CPDF_Object*)value)->GetType(); } if (m_pParser) { PARSE_CONTEXT context; FXSYS_memset32(&context, 0, sizeof(PARSE_CONTEXT)); context.m_Flags = PDFPARSE_TYPEONLY; - return (int)(FX_UINTPTR)m_pParser->ParseIndirectObject(this, objnum, &context); + return (int)(uintptr_t)m_pParser->ParseIndirectObject(this, objnum, &context); } return 0; } @@ -1245,21 +1245,21 @@ FX_DWORD CPDF_IndirectObjects::AddIndirectObject(CPDF_Object* pObj) return pObj->m_ObjNum; } m_LastObjNum ++; - m_IndirectObjs.SetAt((FX_LPVOID)(FX_UINTPTR)m_LastObjNum, pObj); + m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)m_LastObjNum, pObj); pObj->m_ObjNum = m_LastObjNum; return m_LastObjNum; } void CPDF_IndirectObjects::ReleaseIndirectObject(FX_DWORD objnum) { FX_LPVOID value; - if (!m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) { + if (!m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { return; } if (((CPDF_Object*)value)->GetObjNum() == -1) { return; } ((CPDF_Object*)value)->Destroy(); - m_IndirectObjs.RemoveKey((FX_LPVOID)(FX_UINTPTR)objnum); + m_IndirectObjs.RemoveKey((FX_LPVOID)(uintptr_t)objnum); } void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pObj) { @@ -1267,7 +1267,7 @@ void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pO return; } FX_LPVOID value = NULL; - if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) { + if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { if (value) { if (pObj->GetGenNum() <= ((CPDF_Object*)value)->GetGenNum()) @@ -1277,7 +1277,7 @@ void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pO } } pObj->m_ObjNum = objnum; - m_IndirectObjs.SetAt((FX_LPVOID)(FX_UINTPTR)objnum, pObj); + m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)objnum, pObj); if (m_LastObjNum < objnum) { m_LastObjNum = objnum; } diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp index 792f6e076f..a74d6a9841 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -94,8 +94,8 @@ void CPDF_Parser::CloseParser(FX_BOOL bReParse) m_CrossRef.RemoveAll(); m_V5Type.RemoveAll(); m_ObjVersion.RemoveAll(); - FX_INT32 iLen = m_Trailers.GetSize(); - for (FX_INT32 i = 0; i < iLen; ++i) { + int32_t iLen = m_Trailers.GetSize(); + for (int32_t i = 0; i < iLen; ++i) { if (CPDF_Dictionary* trailer = m_Trailers.GetAt(i)) trailer->Release(); } @@ -105,11 +105,11 @@ void CPDF_Parser::CloseParser(FX_BOOL bReParse) m_pLinearized = NULL; } } -static FX_INT32 GetHeaderOffset(IFX_FileRead* pFile) +static int32_t GetHeaderOffset(IFX_FileRead* pFile) { FX_DWORD tag = FXDWORD_FROM_LSBFIRST(0x46445025); - FX_BYTE buf[4]; - FX_INT32 offset = 0; + uint8_t buf[4]; + int32_t offset = 0; while (1) { if (!pFile->ReadBlock(buf, offset, 4)) { return -1; @@ -148,7 +148,7 @@ FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse, FX m_bXRefStream = FALSE; m_LastXRefOffset = 0; m_bOwnFileRead = bOwnFileRead; - FX_INT32 offset = GetHeaderOffset(pFileAccess); + int32_t offset = GetHeaderOffset(pFileAccess); if (offset == -1) { if (bOwnFileRead && pFileAccess) { pFileAccess->Release(); @@ -156,7 +156,7 @@ FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse, FX return PDFPARSE_ERROR_FORMAT; } m_Syntax.InitParser(pFileAccess, offset); - FX_BYTE ch; + uint8_t ch; if (!m_Syntax.GetCharAt(5, ch)) { return PDFPARSE_ERROR_FORMAT; } @@ -327,11 +327,11 @@ FX_FILESIZE CPDF_Parser::GetObjectOffset(FX_DWORD objnum) return m_CrossRef[objnum]; } if (m_V5Type[objnum] == 2) { - return m_CrossRef[(FX_INT32)m_CrossRef[objnum]]; + return m_CrossRef[(int32_t)m_CrossRef[objnum]]; } return 0; } -static FX_INT32 GetDirectInteger(CPDF_Dictionary* pDict, FX_BSTR key) +static int32_t GetDirectInteger(CPDF_Dictionary* pDict, FX_BSTR key) { CPDF_Object* pObj = pDict->GetElement(key); if (pObj == NULL) { @@ -342,7 +342,7 @@ static FX_INT32 GetDirectInteger(CPDF_Dictionary* pDict, FX_BSTR key) } return 0; } -static FX_BOOL CheckDirectType(CPDF_Dictionary* pDict, FX_BSTR key, FX_INT32 iType) +static FX_BOOL CheckDirectType(CPDF_Dictionary* pDict, FX_BSTR key, int32_t iType) { CPDF_Object* pObj = pDict->GetElement(key); if (!pObj) { @@ -359,7 +359,7 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) if (m_pTrailer == NULL) { return FALSE; } - FX_INT32 xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); + int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); if (xrefsize <= 0 || xrefsize > (1 << 20)) { return FALSE; } @@ -396,7 +396,7 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) XRefStreamList.InsertAt(0, pDict->GetInteger(FX_BSTRC("XRefStm"))); m_Trailers.Add(pDict); } - for (FX_INT32 i = 0; i < CrossRefList.GetSize(); i ++) + for (int32_t i = 0; i < CrossRefList.GetSize(); i ++) if (!LoadCrossRefV4(CrossRefList[i], XRefStreamList[i], FALSE, i == 0)) { return FALSE; } @@ -411,7 +411,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos, FX_DWORD d if (m_pTrailer == NULL) { return FALSE; } - FX_INT32 xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); + int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); if (xrefsize == 0) { return FALSE; } @@ -430,7 +430,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos, FX_DWORD d XRefStreamList.InsertAt(0, pDict->GetInteger(FX_BSTRC("XRefStm"))); m_Trailers.Add(pDict); } - for (FX_INT32 i = 1; i < CrossRefList.GetSize(); i ++) + for (int32_t i = 1; i < CrossRefList.GetSize(); i ++) if (!LoadCrossRefV4(CrossRefList[i], XRefStreamList[i], FALSE, i == 0)) { return FALSE; } @@ -447,12 +447,12 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou FX_DWORD start_objnum = 0; FX_DWORD count = dwObjCount; FX_FILESIZE SavedPos = m_Syntax.SavePos(); - FX_INT32 recordsize = 20; + int32_t recordsize = 20; char* pBuf = FX_Alloc(char, 1024 * recordsize + 1); pBuf[1024 * recordsize] = '\0'; - FX_INT32 nBlocks = count / 1024 + 1; - for (FX_INT32 block = 0; block < nBlocks; block ++) { - FX_INT32 block_size = block == nBlocks - 1 ? count % 1024 : 1024; + int32_t nBlocks = count / 1024 + 1; + for (int32_t block = 0; block < nBlocks; block ++) { + int32_t block_size = block == nBlocks - 1 ? count % 1024 : 1024; FX_DWORD dwReadSize = block_size * recordsize; if ((FX_FILESIZE)(dwStartPos + dwReadSize) > m_Syntax.m_FileLen) { FX_Free(pBuf); @@ -462,16 +462,16 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou FX_Free(pBuf); return FALSE; } - for (FX_INT32 i = 0; i < block_size; i ++) { + for (int32_t i = 0; i < block_size; i ++) { FX_DWORD objnum = start_objnum + block * 1024 + i; char* pEntry = pBuf + i * recordsize; if (pEntry[17] == 'f') { m_CrossRef.SetAtGrow(objnum, 0); m_V5Type.SetAtGrow(objnum, 0); } else { - FX_INT32 offset = FXSYS_atoi(pEntry); + int32_t offset = FXSYS_atoi(pEntry); if (offset == 0) { - for (FX_INT32 c = 0; c < 10; c ++) { + for (int32_t c = 0; c < 10; c ++) { if (pEntry[c] < '0' || pEntry[c] > '9') { FX_Free(pBuf); return FALSE; @@ -479,7 +479,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou } } m_CrossRef.SetAtGrow(objnum, offset); - FX_INT32 version = FXSYS_atoi(pEntry + 11); + int32_t version = FXSYS_atoi(pEntry + 11); if (version >= 1) { m_bVersionUpdated = TRUE; } @@ -533,7 +533,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B m_Syntax.ToNextWord(); SavedPos = m_Syntax.SavePos(); FX_BOOL bFirstItem = FALSE; - FX_INT32 recordsize = 20; + int32_t recordsize = 20; if (bFirst) { bFirstItem = TRUE; } @@ -541,12 +541,12 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B if (!bSkip) { char* pBuf = FX_Alloc(char, 1024 * recordsize + 1); pBuf[1024 * recordsize] = '\0'; - FX_INT32 nBlocks = count / 1024 + 1; + int32_t nBlocks = count / 1024 + 1; FX_BOOL bFirstBlock = TRUE; - for (FX_INT32 block = 0; block < nBlocks; block ++) { - FX_INT32 block_size = block == nBlocks - 1 ? count % 1024 : 1024; + for (int32_t block = 0; block < nBlocks; block ++) { + int32_t block_size = block == nBlocks - 1 ? count % 1024 : 1024; m_Syntax.ReadBlock((FX_LPBYTE)pBuf, block_size * recordsize); - for (FX_INT32 i = 0; i < block_size; i ++) { + for (int32_t i = 0; i < block_size; i ++) { FX_DWORD objnum = start_objnum + block * 1024 + i; char* pEntry = pBuf + i * recordsize; if (pEntry[17] == 'f') { @@ -556,7 +556,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B } if (bFirstBlock) { FX_FILESIZE offset = (FX_FILESIZE)FXSYS_atoi64(pEntry); - FX_INT32 version = FXSYS_atoi(pEntry + 11); + int32_t version = FXSYS_atoi(pEntry + 11); if (offset == 0 && version == 65535 && start_objnum != 0) { start_objnum--; objnum = 0; @@ -567,7 +567,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B } else { FX_FILESIZE offset = (FX_FILESIZE)FXSYS_atoi64(pEntry); if (offset == 0) { - for (FX_INT32 c = 0; c < 10; c ++) { + for (int32_t c = 0; c < 10; c ++) { if (pEntry[c] < '0' || pEntry[c] > '9') { FX_Free(pBuf); return FALSE; @@ -575,7 +575,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B } } m_CrossRef.SetAtGrow(objnum, offset); - FX_INT32 version = FXSYS_atoi(pEntry + 11); + int32_t version = FXSYS_atoi(pEntry + 11); if (version >= 1) { m_bVersionUpdated = TRUE; } @@ -626,11 +626,11 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() m_pTrailer->Release(); m_pTrailer = NULL; } - FX_INT32 status = 0; - FX_INT32 inside_index = 0; + int32_t status = 0; + int32_t inside_index = 0; FX_DWORD objnum = 0, gennum = 0; - FX_INT32 depth = 0; - FX_LPBYTE buffer = FX_Alloc(FX_BYTE, 4096); + int32_t depth = 0; + FX_LPBYTE buffer = FX_Alloc(uint8_t, 4096); FX_FILESIZE pos = m_Syntax.m_HeaderOffset; FX_FILESIZE start_pos = 0, start_pos1 = 0; FX_FILESIZE last_obj = -1, last_xref = -1, last_trailer = -1; @@ -644,7 +644,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() break; } for (FX_DWORD i = 0; i < size; i ++) { - FX_BYTE byte = buffer[i]; + uint8_t byte = buffer[i]; switch (status) { case 0: if (PDF_CharType[byte] == 'W') { @@ -818,11 +818,11 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() } else { i += (FX_DWORD)nLen; } - if (m_CrossRef.GetSize() > (FX_INT32)objnum && m_CrossRef[objnum]) { + if (m_CrossRef.GetSize() > (int32_t)objnum && m_CrossRef[objnum]) { if (pObject) { FX_DWORD oldgen = m_ObjVersion.GetAt(objnum); m_CrossRef[objnum] = obj_pos; - m_ObjVersion.SetAt(objnum, (FX_SHORT)gennum); + m_ObjVersion.SetAt(objnum, (int16_t)gennum); if (oldgen != gennum) { m_bVersionUpdated = TRUE; } @@ -830,7 +830,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() } else { m_CrossRef.SetAtGrow(objnum, obj_pos); m_V5Type.SetAtGrow(objnum, 1); - m_ObjVersion.SetAtGrow(objnum, (FX_SHORT)gennum); + m_ObjVersion.SetAtGrow(objnum, (int16_t)gennum); } if (pObject) { pObject->Release(); @@ -986,10 +986,10 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() FX_Free(buffer); return TRUE; } -static FX_DWORD _GetVarInt(FX_LPCBYTE p, FX_INT32 n) +static FX_DWORD _GetVarInt(FX_LPCBYTE p, int32_t n) { FX_DWORD result = 0; - for (FX_INT32 i = 0; i < n; i ++) { + for (int32_t i = 0; i < n; i ++) { result = result * 256 + p[i]; } return result; @@ -1015,7 +1015,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL return FALSE; } prev = pStream->GetDict()->GetInteger(FX_BSTRC("Prev")); - FX_INT32 size = pStream->GetDict()->GetInteger(FX_BSTRC("Size")); + int32_t size = pStream->GetDict()->GetInteger(FX_BSTRC("Size")); if (size < 0) { pStream->Release(); return FALSE; @@ -1029,7 +1029,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL } else { m_Trailers.Add((CPDF_Dictionary*)pStream->GetDict()->Clone()); } - std::vector > arrIndex; + std::vector > arrIndex; CPDF_Array* pArray = pStream->GetDict()->GetArray(FX_BSTRC("Index")); if (pArray) { FX_DWORD nPairSize = pArray->GetCount() / 2; @@ -1071,12 +1071,12 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL FX_DWORD dwTotalSize = acc.GetSize(); FX_DWORD segindex = 0; for (FX_DWORD i = 0; i < arrIndex.size(); i ++) { - FX_INT32 startnum = arrIndex[i].first; + int32_t startnum = arrIndex[i].first; if (startnum < 0) { continue; } - m_dwXrefStartObjNum = pdfium::base::checked_cast (startnum); - FX_DWORD count = pdfium::base::checked_cast (arrIndex[i].second); + m_dwXrefStartObjNum = pdfium::base::checked_cast (startnum); + FX_DWORD count = pdfium::base::checked_cast (arrIndex[i].second); FX_SAFE_DWORD dwCaculatedSize = segindex; dwCaculatedSize += count; dwCaculatedSize *= totalWidth; @@ -1086,12 +1086,12 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL FX_LPCBYTE segstart = pData + segindex * totalWidth; FX_SAFE_DWORD dwMaxObjNum = startnum; dwMaxObjNum += count; - FX_DWORD dwV5Size = pdfium::base::checked_cast (m_V5Type.GetSize()); + FX_DWORD dwV5Size = pdfium::base::checked_cast (m_V5Type.GetSize()); if (!dwMaxObjNum.IsValid() || dwMaxObjNum.ValueOrDie() > dwV5Size) { continue; } for (FX_DWORD j = 0; j < count; j ++) { - FX_INT32 type = 1; + int32_t type = 1; FX_LPCBYTE entrystart = segstart + j * totalWidth; if (WidthArray[0]) { type = _GetVarInt(entrystart, WidthArray[0]); @@ -1208,8 +1208,8 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX if (pObjStream == NULL) { return NULL; } - FX_INT32 n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N")); - FX_INT32 offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First")); + int32_t n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N")); + int32_t offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First")); CPDF_SyntaxParser syntax; CFX_SmartPointer file(FX_CreateMemoryStream((FX_LPBYTE)pObjStream->GetData(), (size_t)pObjStream->GetSize(), FALSE)); syntax.InitParser(file.Get(), 0); @@ -1231,7 +1231,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) { CPDF_StreamAcc* pStreamAcc = NULL; - if (m_ObjectStreamMap.Lookup((void*)(FX_UINTPTR)objnum, (void*&)pStreamAcc)) { + if (m_ObjectStreamMap.Lookup((void*)(uintptr_t)objnum, (void*&)pStreamAcc)) { return pStreamAcc; } const CPDF_Stream* pStream = m_pDocument ? (CPDF_Stream*)m_pDocument->GetIndirectObject(objnum) : NULL; @@ -1240,7 +1240,7 @@ CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) } pStreamAcc = new CPDF_StreamAcc; pStreamAcc->LoadAllData(pStream); - m_ObjectStreamMap.SetAt((void*)(FX_UINTPTR)objnum, pStreamAcc); + m_ObjectStreamMap.SetAt((void*)(uintptr_t)objnum, pStreamAcc); return pStreamAcc; } FX_FILESIZE CPDF_Parser::GetObjectSize(FX_DWORD objnum) @@ -1279,8 +1279,8 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR if (pObjStream == NULL) { return; } - FX_INT32 n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N")); - FX_INT32 offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First")); + int32_t n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N")); + int32_t offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First")); CPDF_SyntaxParser syntax; FX_LPCBYTE pData = pObjStream->GetData(); FX_DWORD totalsize = pObjStream->GetSize(); @@ -1297,7 +1297,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR FX_DWORD nextoff = syntax.GetDirectNum(); size = nextoff - thisoff; } - pBuffer = FX_Alloc(FX_BYTE, size); + pBuffer = FX_Alloc(uint8_t, size); FXSYS_memcpy32(pBuffer, pData + thisoff + offset, size); return; } @@ -1364,7 +1364,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR nextoff = m_Syntax.SavePos(); } size = (FX_DWORD)(nextoff - pos); - pBuffer = FX_Alloc(FX_BYTE, size); + pBuffer = FX_Alloc(uint8_t, size); m_Syntax.RestorePos(pos); m_Syntax.ReadBlock(pBuffer, size); m_Syntax.RestorePos(SavedPos); @@ -1549,7 +1549,7 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse m_bXRefStream = FALSE; m_LastXRefOffset = 0; m_bOwnFileRead = bOwnFileRead; - FX_INT32 offset = GetHeaderOffset(pFileAccess); + int32_t offset = GetHeaderOffset(pFileAccess); if (offset == -1) { return PDFPARSE_ERROR_FORMAT; } @@ -1575,7 +1575,7 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse if (m_pTrailer == NULL) { return FALSE; } - FX_INT32 xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); + int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size")); if (xrefsize > 0) { m_CrossRef.SetSize(xrefsize); m_V5Type.SetSize(xrefsize); @@ -1647,10 +1647,10 @@ FX_DWORD CPDF_Parser::LoadLinearizedMainXRefTable() m_pTrailer = NULL; } m_Syntax.RestorePos(m_LastXRefOffset - m_Syntax.m_HeaderOffset); - FX_BYTE ch = 0; + uint8_t ch = 0; FX_DWORD dwCount = 0; m_Syntax.GetNextChar(ch); - FX_INT32 type = PDF_CharType[ch]; + int32_t type = PDF_CharType[ch]; while (type == 'W') { ++dwCount; if (m_Syntax.m_FileLen >= (FX_FILESIZE)(m_Syntax.SavePos() + m_Syntax.m_HeaderOffset)) { @@ -1698,7 +1698,7 @@ CPDF_SyntaxParser::~CPDF_SyntaxParser() FX_Free(m_pFileBuf); } } -FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, FX_BYTE& ch) +FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, uint8_t& ch) { FX_FILESIZE save_pos = m_Pos; m_Pos = pos; @@ -1706,7 +1706,7 @@ FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, FX_BYTE& ch) m_Pos = save_pos; return ret; } -FX_BOOL CPDF_SyntaxParser::GetNextChar(FX_BYTE& ch) +FX_BOOL CPDF_SyntaxParser::GetNextChar(uint8_t& ch) { FX_FILESIZE pos = m_Pos + m_HeaderOffset; if (pos >= m_FileLen) { @@ -1735,7 +1735,7 @@ FX_BOOL CPDF_SyntaxParser::GetNextChar(FX_BYTE& ch) m_Pos ++; return TRUE; } -FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, FX_BYTE& ch) +FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch) { pos += m_HeaderOffset; if (pos >= m_FileLen) { @@ -1778,11 +1778,11 @@ void CPDF_SyntaxParser::GetNextWord() { m_WordSize = 0; m_bIsNumber = TRUE; - FX_BYTE ch; + uint8_t ch; if (!GetNextChar(ch)) { return; } - FX_BYTE type = PDF_CharType[ch]; + uint8_t type = PDF_CharType[ch]; while (1) { while (type == 'W') { if (!GetNextChar(ch)) { @@ -1860,13 +1860,13 @@ void CPDF_SyntaxParser::GetNextWord() } CFX_ByteString CPDF_SyntaxParser::ReadString() { - FX_BYTE ch; + uint8_t ch; if (!GetNextChar(ch)) { return CFX_ByteString(); } CFX_ByteTextBuf buf; - FX_INT32 parlevel = 0; - FX_INT32 status = 0, iEscCode = 0; + int32_t parlevel = 0; + int32_t status = 0, iEscCode = 0; while (1) { switch (status) { case 0: @@ -1947,13 +1947,13 @@ CFX_ByteString CPDF_SyntaxParser::ReadString() } CFX_ByteString CPDF_SyntaxParser::ReadHexString() { - FX_BYTE ch; + uint8_t ch; if (!GetNextChar(ch)) { return CFX_ByteString(); } CFX_BinaryBuf buf; FX_BOOL bFirst = TRUE; - FX_BYTE code = 0; + uint8_t code = 0; while (1) { if (ch == '>') { break; @@ -1963,7 +1963,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() code = (ch - '0') * 16; } else { code += ch - '0'; - buf.AppendByte((FX_BYTE)code); + buf.AppendByte((uint8_t)code); } bFirst = !bFirst; } else if (ch >= 'A' && ch <= 'F') { @@ -1971,7 +1971,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() code = (ch - 'A' + 10) * 16; } else { code += ch - 'A' + 10; - buf.AppendByte((FX_BYTE)code); + buf.AppendByte((uint8_t)code); } bFirst = !bFirst; } else if (ch >= 'a' && ch <= 'f') { @@ -1979,7 +1979,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() code = (ch - 'a' + 10) * 16; } else { code += ch - 'a' + 10; - buf.AppendByte((FX_BYTE)code); + buf.AppendByte((uint8_t)code); } bFirst = !bFirst; } @@ -1988,13 +1988,13 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() } } if (!bFirst) { - buf.AppendByte((FX_BYTE)code); + buf.AppendByte((uint8_t)code); } return buf.GetByteString(); } void CPDF_SyntaxParser::ToNextLine() { - FX_BYTE ch; + uint8_t ch; while (1) { if (!GetNextChar(ch)) { return; @@ -2015,11 +2015,11 @@ void CPDF_SyntaxParser::ToNextLine() } void CPDF_SyntaxParser::ToNextWord() { - FX_BYTE ch; + uint8_t ch; if (!GetNextChar(ch)) { return; } - FX_BYTE type = PDF_CharType[ch]; + uint8_t type = PDF_CharType[ch]; while (1) { while (type == 'W') { m_dwWordPos = m_Pos; @@ -2164,7 +2164,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWO pContext->m_DictStart = SavedPos; } CPDF_Dictionary* pDict = CPDF_Dictionary::Create(); - FX_INT32 nKeys = 0; + int32_t nKeys = 0; FX_FILESIZE dwSignValuePos = 0; while (1) { FX_BOOL bIsNumber; @@ -2373,7 +2373,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(CPDF_IndirectObjects* pObjList if (pDict) { pDict->Release(); } - FX_BYTE ch; + uint8_t ch; while (1) { if (!GetNextChar(ch)) { break; @@ -2457,7 +2457,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT } else { m_Pos = curPos; } - FX_BYTE byte1, byte2; + uint8_t byte1, byte2; GetCharAt(StreamStartPos + offset - 1, byte1); GetCharAt(StreamStartPos + offset - 2, byte2); if (byte1 == 0x0a && byte2 == 0x0d) { @@ -2477,7 +2477,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT m_Pos = StreamStartPos; } CPDF_Stream* pStream; - FX_LPBYTE pData = FX_Alloc(FX_BYTE, len); + FX_LPBYTE pData = FX_Alloc(uint8_t, len); ReadBlock(pData, len); if (pCryptoHandler) { CFX_BinaryBuf dest_buf; @@ -2507,7 +2507,7 @@ void CPDF_SyntaxParser::InitParser(IFX_FileRead* pFileAccess, FX_DWORD HeaderOff FX_Free(m_pFileBuf); m_pFileBuf = NULL; } - m_pFileBuf = FX_Alloc(FX_BYTE, m_BufSize); + m_pFileBuf = FX_Alloc(uint8_t, m_BufSize); m_HeaderOffset = HeaderOffset; m_FileLen = pFileAccess->GetSize(); m_Pos = 0; @@ -2515,7 +2515,7 @@ void CPDF_SyntaxParser::InitParser(IFX_FileRead* pFileAccess, FX_DWORD HeaderOff m_BufOffset = 0; pFileAccess->ReadBlock(m_pFileBuf, 0, (size_t)((FX_FILESIZE)m_BufSize > m_FileLen ? m_FileLen : m_BufSize)); } -FX_INT32 CPDF_SyntaxParser::GetDirectNum() +int32_t CPDF_SyntaxParser::GetDirectNum() { GetNextWord(); if (!m_bIsNumber) { @@ -2526,19 +2526,19 @@ FX_INT32 CPDF_SyntaxParser::GetDirectNum() } FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, FX_LPCBYTE tag, FX_DWORD taglen) { - FX_BYTE type = PDF_CharType[tag[0]]; + uint8_t type = PDF_CharType[tag[0]]; FX_BOOL bCheckLeft = type != 'D' && type != 'W'; type = PDF_CharType[tag[taglen - 1]]; FX_BOOL bCheckRight = type != 'D' && type != 'W'; - FX_BYTE ch; - if (bCheckRight && startpos + (FX_INT32)taglen <= limit && GetCharAt(startpos + (FX_INT32)taglen, ch)) { - FX_BYTE type = PDF_CharType[ch]; + uint8_t ch; + if (bCheckRight && startpos + (int32_t)taglen <= limit && GetCharAt(startpos + (int32_t)taglen, ch)) { + uint8_t type = PDF_CharType[ch]; if (type == 'N' || type == 'R') { return FALSE; } } if (bCheckLeft && startpos > 0 && GetCharAt(startpos - 1, ch)) { - FX_BYTE type = PDF_CharType[ch]; + uint8_t type = PDF_CharType[ch]; if (type == 'N' || type == 'R') { return FALSE; } @@ -2547,17 +2547,17 @@ FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, } FX_BOOL CPDF_SyntaxParser::SearchWord(FX_BSTR tag, FX_BOOL bWholeWord, FX_BOOL bForward, FX_FILESIZE limit) { - FX_INT32 taglen = tag.GetLength(); + int32_t taglen = tag.GetLength(); if (taglen == 0) { return FALSE; } FX_FILESIZE pos = m_Pos; - FX_INT32 offset = 0; + int32_t offset = 0; if (!bForward) { offset = taglen - 1; } FX_LPCBYTE tag_data = tag.GetPtr(); - FX_BYTE byte; + uint8_t byte; while (1) { if (bForward) { if (limit) { @@ -2616,9 +2616,9 @@ struct _SearchTagRecord { FX_DWORD m_Len; FX_DWORD m_Offset; }; -FX_INT32 CPDF_SyntaxParser::SearchMultiWord(FX_BSTR tags, FX_BOOL bWholeWord, FX_FILESIZE limit) +int32_t CPDF_SyntaxParser::SearchMultiWord(FX_BSTR tags, FX_BOOL bWholeWord, FX_FILESIZE limit) { - FX_INT32 ntags = 1, i; + int32_t ntags = 1, i; for (i = 0; i < tags.GetLength(); i ++) if (tags[i] == 0) { ntags ++; @@ -2639,9 +2639,9 @@ FX_INT32 CPDF_SyntaxParser::SearchMultiWord(FX_BSTR tags, FX_BOOL bWholeWord, FX } } FX_FILESIZE pos = m_Pos; - FX_BYTE byte; + uint8_t byte; GetCharAt(pos++, byte); - FX_INT32 found = -1; + int32_t found = -1; while (1) { for (i = 0; i < ntags; i ++) { if (pPatterns[i].m_pTag[pPatterns[i].m_Offset] == byte) { @@ -2680,12 +2680,12 @@ end: } FX_FILESIZE CPDF_SyntaxParser::FindTag(FX_BSTR tag, FX_FILESIZE limit) { - FX_INT32 taglen = tag.GetLength(); - FX_INT32 match = 0; + int32_t taglen = tag.GetLength(); + int32_t match = 0; limit += m_Pos; FX_FILESIZE startpos = m_Pos; while (1) { - FX_BYTE ch; + uint8_t ch; if (!GetNextChar(ch)) { return -1; } @@ -2703,10 +2703,10 @@ FX_FILESIZE CPDF_SyntaxParser::FindTag(FX_BSTR tag, FX_FILESIZE limit) } return -1; } -void CPDF_SyntaxParser::GetBinary(FX_BYTE* buffer, FX_DWORD size) +void CPDF_SyntaxParser::GetBinary(uint8_t* buffer, FX_DWORD size) { FX_DWORD offset = 0; - FX_BYTE ch; + uint8_t ch; while (1) { if (!GetNextChar(ch)) { return; @@ -2730,9 +2730,9 @@ public: virtual FX_BOOL IsPageAvail(int iPage, IFX_DownloadHints* pHints) override; - virtual FX_INT32 IsFormAvail(IFX_DownloadHints *pHints) override; + virtual int32_t IsFormAvail(IFX_DownloadHints *pHints) override; - virtual FX_INT32 IsLinearizedPDF() override; + virtual int32_t IsLinearizedPDF() override; virtual FX_BOOL IsLinearized() override { @@ -2766,11 +2766,11 @@ protected: FX_BOOL CheckPageStatus(IFX_DownloadHints* pHints); FX_BOOL CheckAllCrossRefStream(IFX_DownloadHints *pHints); - FX_INT32 CheckCrossRefStream(IFX_DownloadHints *pHints, FX_FILESIZE &xref_offset); + int32_t CheckCrossRefStream(IFX_DownloadHints *pHints, FX_FILESIZE &xref_offset); FX_BOOL IsLinearizedFile(FX_LPBYTE pData, FX_DWORD dwLen); void SetStartOffset(FX_FILESIZE dwOffset); FX_BOOL GetNextToken(CFX_ByteString &token); - FX_BOOL GetNextChar(FX_BYTE &ch); + FX_BOOL GetNextChar(uint8_t &ch); CPDF_Object * ParseIndirectObjectAt(FX_FILESIZE pos, FX_DWORD objnum); CPDF_Object * GetObject(FX_DWORD objnum, IFX_DownloadHints* pHints, FX_BOOL *pExistInFile); FX_BOOL GetPageKids(CPDF_Parser *pParser, CPDF_Object *pPages); @@ -2784,10 +2784,10 @@ protected: FX_BOOL CheckLinearizedFirstPage(int iPage, IFX_DownloadHints* pHints); FX_BOOL HaveResourceAncestor(CPDF_Dictionary *pDict); - FX_BOOL CheckPage(FX_INT32 iPage, IFX_DownloadHints* pHints); + FX_BOOL CheckPage(int32_t iPage, IFX_DownloadHints* pHints); FX_BOOL LoadDocPages(IFX_DownloadHints* pHints); - FX_BOOL LoadDocPage(FX_INT32 iPage, IFX_DownloadHints* pHints); - FX_BOOL CheckPageNode(CPDF_PageNode &pageNodes, FX_INT32 iPage, FX_INT32 &iCount, IFX_DownloadHints* pHints); + FX_BOOL LoadDocPage(int32_t iPage, IFX_DownloadHints* pHints); + FX_BOOL CheckPageNode(CPDF_PageNode &pageNodes, int32_t iPage, int32_t &iCount, IFX_DownloadHints* pHints); FX_BOOL CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints); FX_BOOL CheckArrayPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints); FX_BOOL CheckPageCount(IFX_DownloadHints* pHints); @@ -2838,11 +2838,11 @@ protected: CFX_ByteString m_WordBuf; - FX_BYTE m_WordBuffer[257]; + uint8_t m_WordBuffer[257]; FX_DWORD m_WordSize; - FX_BYTE m_bufferData[512]; + uint8_t m_bufferData[512]; CFX_FileSizeArray m_CrossOffset; @@ -2990,8 +2990,8 @@ CPDF_DataAvail::~CPDF_DataAvail() if (m_pagesLoadState) { delete m_pagesLoadState; } - FX_INT32 i = 0; - FX_INT32 iSize = m_arrayAcroforms.GetSize(); + int32_t i = 0; + int32_t iSize = m_arrayAcroforms.GetSize(); for (i = 0; i < iSize; ++i) { ((CPDF_Object *)m_arrayAcroforms.GetAt(i))->Release(); } @@ -3035,13 +3035,13 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(CFX_PtrArray& obj_array, FX_BOOL bParsePa } FX_DWORD count = 0; CFX_PtrArray new_obj_array; - FX_INT32 i = 0; + int32_t i = 0; for (i = 0; i < obj_array.GetSize(); i++) { CPDF_Object *pObj = (CPDF_Object *)obj_array[i]; if (!pObj) { continue; } - FX_INT32 type = pObj->GetType(); + int32_t type = pObj->GetType(); switch (type) { case PDFOBJ_ARRAY: { CPDF_Array *pArray = pObj->GetArray(); @@ -3107,10 +3107,10 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(CFX_PtrArray& obj_array, FX_BOOL bParsePa } } if (count > 0) { - FX_INT32 iSize = new_obj_array.GetSize(); + int32_t iSize = new_obj_array.GetSize(); for (i = 0; i < iSize; ++i) { CPDF_Object *pObj = (CPDF_Object *)new_obj_array[i]; - FX_INT32 type = pObj->GetType(); + int32_t type = pObj->GetType(); if (type == PDFOBJ_REFERENCE) { CPDF_Reference *pRef = (CPDF_Reference *)pObj; FX_DWORD dwNum = pRef->GetRefObjNum(); @@ -3158,8 +3158,8 @@ FX_BOOL CPDF_DataAvail::CheckAcroFormSubObject(IFX_DownloadHints* pHints) CFX_PtrArray new_objs_array; FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array); if (bRet) { - FX_INT32 iSize = m_arrayAcroforms.GetSize(); - for (FX_INT32 i = 0; i < iSize; ++i) { + int32_t iSize = m_arrayAcroforms.GetSize(); + for (int32_t i = 0; i < iSize; ++i) { ((CPDF_Object *)m_arrayAcroforms.GetAt(i))->Release(); } m_arrayAcroforms.RemoveAll(); @@ -3471,9 +3471,9 @@ FX_BOOL CPDF_DataAvail::CheckPage(IFX_DownloadHints* pHints) if (pObj->GetType() == PDFOBJ_ARRAY) { CPDF_Array *pArray = pObj->GetArray(); if (pArray) { - FX_INT32 iSize = pArray->GetCount(); + int32_t iSize = pArray->GetCount(); CPDF_Object *pItem = NULL; - for (FX_INT32 j = 0; j < iSize; ++j) { + for (int32_t j = 0; j < iSize; ++j) { pItem = pArray->GetElement(j); if (pItem && pItem->GetType() == PDFOBJ_REFERENCE) { UnavailObjList.Add(((CPDF_Reference *)pItem)->GetRefObjNum()); @@ -3585,7 +3585,7 @@ FX_BOOL CPDF_DataAvail::CheckHeader(IFX_DownloadHints* pHints) req_size = (FX_DWORD)m_dwFileLen; } if (m_pFileAvail->IsDataAvail(0, req_size)) { - FX_BYTE buffer[1024]; + uint8_t buffer[1024]; m_pFileRead->ReadBlock(buffer, 0, req_size); if (IsLinearizedFile(buffer, req_size)) { m_docStatus = PDF_DATAAVAIL_FIRSTPAGE; @@ -3625,8 +3625,8 @@ FX_BOOL CPDF_DataAvail::CheckFirstPage(IFX_DownloadHints *pHints) if ((FX_FILESIZE)dwEnd > m_dwFileLen) { dwEnd = (FX_DWORD)m_dwFileLen; } - FX_INT32 iStartPos = (FX_INT32)(m_dwFileLen > 1024 ? 1024 : m_dwFileLen); - FX_INT32 iSize = dwEnd > 1024 ? dwEnd - 1024 : 0; + int32_t iStartPos = (int32_t)(m_dwFileLen > 1024 ? 1024 : m_dwFileLen); + int32_t iSize = dwEnd > 1024 ? dwEnd - 1024 : 0; if (!m_pFileAvail->IsDataAvail(iStartPos, iSize)) { pHints->AddSegment(iStartPos, iSize); bNeedDownLoad = TRUE; @@ -3686,7 +3686,7 @@ CPDF_Object * CPDF_DataAvail::ParseIndirectObjectAt(FX_FILESIZE pos, FX_DWORD ob m_syntaxParser.RestorePos(SavedPos); return pObj; } -FX_INT32 CPDF_DataAvail::IsLinearizedPDF() +int32_t CPDF_DataAvail::IsLinearizedPDF() { FX_DWORD req_size = 1024; if (!m_pFileAvail->IsDataAvail(0, req_size)) { @@ -3699,7 +3699,7 @@ FX_INT32 CPDF_DataAvail::IsLinearizedPDF() if (dwSize < (FX_FILESIZE)req_size) { return PDF_UNKNOW_LINEARIZED; } - FX_BYTE buffer[1024]; + uint8_t buffer[1024]; m_pFileRead->ReadBlock(buffer, 0, req_size); if (IsLinearizedFile(buffer, req_size)) { return PDF_IS_LINEARIZED; @@ -3709,7 +3709,7 @@ FX_INT32 CPDF_DataAvail::IsLinearizedPDF() FX_BOOL CPDF_DataAvail::IsLinearizedFile(FX_LPBYTE pData, FX_DWORD dwLen) { CFX_SmartPointer file(FX_CreateMemoryStream(pData, (size_t)dwLen, FALSE)); - FX_INT32 offset = GetHeaderOffset(file.Get()); + int32_t offset = GetHeaderOffset(file.Get()); if (offset == -1) { m_docStatus = PDF_DATAAVAIL_ERROR; return FALSE; @@ -3753,7 +3753,7 @@ FX_BOOL CPDF_DataAvail::CheckEnd(IFX_DownloadHints* pHints) FX_DWORD req_pos = (FX_DWORD)(m_dwFileLen > 1024 ? m_dwFileLen - 1024 : 0); FX_DWORD dwSize = (FX_DWORD)(m_dwFileLen - req_pos); if (m_pFileAvail->IsDataAvail(req_pos, dwSize)) { - FX_BYTE buffer[1024]; + uint8_t buffer[1024]; m_pFileRead->ReadBlock(buffer, req_pos, dwSize); CFX_SmartPointer file(FX_CreateMemoryStream(buffer, (size_t)dwSize, FALSE)); m_syntaxParser.InitParser(file.Get(), 0); @@ -3783,12 +3783,12 @@ FX_BOOL CPDF_DataAvail::CheckEnd(IFX_DownloadHints* pHints) pHints->AddSegment(req_pos, dwSize); return FALSE; } -FX_INT32 CPDF_DataAvail::CheckCrossRefStream(IFX_DownloadHints* pHints, FX_FILESIZE &xref_offset) +int32_t CPDF_DataAvail::CheckCrossRefStream(IFX_DownloadHints* pHints, FX_FILESIZE &xref_offset) { xref_offset = 0; FX_DWORD req_size = (FX_DWORD)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); if (m_pFileAvail->IsDataAvail(m_Pos, req_size)) { - FX_INT32 iSize = (FX_INT32)(m_Pos + req_size - m_dwCurrentXRefSteam); + int32_t iSize = (int32_t)(m_Pos + req_size - m_dwCurrentXRefSteam); CFX_BinaryBuf buf(iSize); FX_LPBYTE pBuf = buf.GetBuffer(); m_pFileRead->ReadBlock(pBuf, m_dwCurrentXRefSteam, iSize); @@ -3832,11 +3832,11 @@ inline void CPDF_DataAvail::SetStartOffset(FX_FILESIZE dwOffset) FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString &token) { m_WordSize = 0; - FX_BYTE ch; + uint8_t ch; if (!GetNextChar(ch)) { return FALSE; } - FX_BYTE type = PDF_CharType[ch]; + uint8_t type = PDF_CharType[ch]; while (1) { while (type == 'W') { if (!GetNextChar(ch)) { @@ -3915,7 +3915,7 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString &token) token = ret; return TRUE; } -FX_BOOL CPDF_DataAvail::GetNextChar(FX_BYTE &ch) +FX_BOOL CPDF_DataAvail::GetNextChar(uint8_t &ch) { FX_FILESIZE pos = m_Pos; if (pos >= m_dwFileLen) { @@ -3942,11 +3942,11 @@ FX_BOOL CPDF_DataAvail::GetNextChar(FX_BYTE &ch) } FX_BOOL CPDF_DataAvail::CheckCrossRefItem(IFX_DownloadHints *pHints) { - FX_INT32 iSize = 0; + int32_t iSize = 0; CFX_ByteString token; while (1) { if (!GetNextToken(token)) { - iSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); + iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); pHints->AddSegment(m_Pos, iSize); return FALSE; } @@ -3960,7 +3960,7 @@ FX_BOOL CPDF_DataAvail::CheckCrossRefItem(IFX_DownloadHints *pHints) FX_BOOL CPDF_DataAvail::CheckAllCrossRefStream(IFX_DownloadHints *pHints) { FX_FILESIZE xref_offset = 0; - FX_INT32 nRet = CheckCrossRefStream(pHints, xref_offset); + int32_t nRet = CheckCrossRefStream(pHints, xref_offset); if (nRet == 1) { if (!xref_offset) { m_docStatus = PDF_DATAAVAIL_LOADALLCRSOSSREF; @@ -3976,10 +3976,10 @@ FX_BOOL CPDF_DataAvail::CheckAllCrossRefStream(IFX_DownloadHints *pHints) } FX_BOOL CPDF_DataAvail::CheckCrossRef(IFX_DownloadHints* pHints) { - FX_INT32 iSize = 0; + int32_t iSize = 0; CFX_ByteString token; if (!GetNextToken(token)) { - iSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); + iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); pHints->AddSegment(m_Pos, iSize); return FALSE; } @@ -3987,7 +3987,7 @@ FX_BOOL CPDF_DataAvail::CheckCrossRef(IFX_DownloadHints* pHints) m_CrossOffset.InsertAt(0, m_dwXRefOffset); while (1) { if (!GetNextToken(token)) { - iSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); + iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); pHints->AddSegment(m_Pos, iSize); m_docStatus = PDF_DATAAVAIL_CROSSREF_ITEM; return FALSE; @@ -4008,7 +4008,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailerAppend(IFX_DownloadHints* pHints) { if (m_Pos < m_dwFileLen) { FX_FILESIZE dwAppendPos = m_Pos + m_syntaxParser.SavePos(); - FX_INT32 iSize = (FX_INT32)(dwAppendPos + 512 > m_dwFileLen ? m_dwFileLen - dwAppendPos : 512); + int32_t iSize = (int32_t)(dwAppendPos + 512 > m_dwFileLen ? m_dwFileLen - dwAppendPos : 512); if (!m_pFileAvail->IsDataAvail(dwAppendPos, iSize)) { pHints->AddSegment(dwAppendPos, iSize); return FALSE; @@ -4024,9 +4024,9 @@ FX_BOOL CPDF_DataAvail::CheckTrailerAppend(IFX_DownloadHints* pHints) } FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints) { - FX_INT32 iTrailerSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); + int32_t iTrailerSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); if (m_pFileAvail->IsDataAvail(m_Pos, iTrailerSize)) { - FX_INT32 iSize = (FX_INT32)(m_Pos + iTrailerSize - m_dwTrailerOffset); + int32_t iSize = (int32_t)(m_Pos + iTrailerSize - m_dwTrailerOffset); CFX_BinaryBuf buf(iSize); FX_LPBYTE pBuf = buf.GetBuffer(); if (!pBuf) { @@ -4082,7 +4082,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints) pHints->AddSegment(m_Pos, iTrailerSize); return FALSE; } -FX_BOOL CPDF_DataAvail::CheckPage(FX_INT32 iPage, IFX_DownloadHints* pHints) +FX_BOOL CPDF_DataAvail::CheckPage(int32_t iPage, IFX_DownloadHints* pHints) { while (TRUE) { switch (m_docStatus) { @@ -4211,14 +4211,14 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pP pPage->Release(); return TRUE; } -FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, FX_INT32 iPage, FX_INT32 &iCount, IFX_DownloadHints* pHints) +FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, int32_t iPage, int32_t &iCount, IFX_DownloadHints* pHints) { - FX_INT32 iSize = pageNodes.m_childNode.GetSize(); + int32_t iSize = pageNodes.m_childNode.GetSize(); if (iSize <= 0 || iPage >= iSize) { m_docStatus = PDF_DATAAVAIL_ERROR; return FALSE; } - for (FX_INT32 i = 0; i < iSize; ++i) { + for (int32_t i = 0; i < iSize; ++i) { CPDF_PageNode *pNode = (CPDF_PageNode*)pageNodes.m_childNode.GetAt(i); if (!pNode) { continue; @@ -4255,7 +4255,7 @@ FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, FX_INT32 iPage, } return TRUE; } -FX_BOOL CPDF_DataAvail::LoadDocPage(FX_INT32 iPage, IFX_DownloadHints* pHints) +FX_BOOL CPDF_DataAvail::LoadDocPage(int32_t iPage, IFX_DownloadHints* pHints) { if (m_pDocument->GetPageCount() <= iPage || m_pDocument->m_PageList.GetAt(iPage)) { m_docStatus = PDF_DATAAVAIL_DONE; @@ -4269,7 +4269,7 @@ FX_BOOL CPDF_DataAvail::LoadDocPage(FX_INT32 iPage, IFX_DownloadHints* pHints) m_docStatus = PDF_DATAAVAIL_ERROR; return TRUE; } - FX_INT32 iCount = -1; + int32_t iCount = -1; return CheckPageNode(m_pageNodes, iPage, iCount, pHints); } FX_BOOL CPDF_DataAvail::CheckPageCount(IFX_DownloadHints* pHints) @@ -4357,7 +4357,7 @@ FX_BOOL CPDF_DataAvail::CheckLinearizedData(IFX_DownloadHints* pHints) return m_bLinearedDataOK; } -FX_BOOL CPDF_DataAvail::CheckPageAnnots(FX_INT32 iPage, IFX_DownloadHints* pHints) +FX_BOOL CPDF_DataAvail::CheckPageAnnots(int32_t iPage, IFX_DownloadHints* pHints) { if (!m_objs_array.GetSize()) { m_objs_array.RemoveAll(); @@ -4387,7 +4387,7 @@ FX_BOOL CPDF_DataAvail::CheckPageAnnots(FX_INT32 iPage, IFX_DownloadHints* pHint return bRet; } } -FX_BOOL CPDF_DataAvail::CheckLinearizedFirstPage(FX_INT32 iPage, IFX_DownloadHints* pHints) +FX_BOOL CPDF_DataAvail::CheckLinearizedFirstPage(int32_t iPage, IFX_DownloadHints* pHints) { if (!m_bAnnotsLoad) { if (!CheckPageAnnots(iPage, pHints)) { @@ -4423,7 +4423,7 @@ FX_BOOL CPDF_DataAvail::HaveResourceAncestor(CPDF_Dictionary *pDict) } return HaveResourceAncestor(pParentDict); } -FX_BOOL CPDF_DataAvail::IsPageAvail(FX_INT32 iPage, IFX_DownloadHints* pHints) +FX_BOOL CPDF_DataAvail::IsPageAvail(int32_t iPage, IFX_DownloadHints* pHints) { if (!m_pDocument) { return FALSE; @@ -4572,7 +4572,7 @@ void CPDF_DataAvail::GetLinearizedMainXRefInfo(FX_FILESIZE *pPos, FX_DWORD *pSiz *pSize = (FX_DWORD)(m_dwFileLen - m_dwLastXRefOffset); } } -FX_INT32 CPDF_DataAvail::IsFormAvail(IFX_DownloadHints *pHints) +int32_t CPDF_DataAvail::IsFormAvail(IFX_DownloadHints *pHints) { if (!m_pDocument) { return PDFFORM_AVAIL; @@ -4605,7 +4605,7 @@ FX_INT32 CPDF_DataAvail::IsFormAvail(IFX_DownloadHints *pHints) } void CPDF_SortObjNumArray::AddObjNum(FX_DWORD dwObjNum) { - FX_INT32 iNext = 0; + int32_t iNext = 0; if (BinarySearch(dwObjNum, iNext)) { return; } @@ -4613,15 +4613,15 @@ void CPDF_SortObjNumArray::AddObjNum(FX_DWORD dwObjNum) } FX_BOOL CPDF_SortObjNumArray::Find(FX_DWORD dwObjNum) { - FX_INT32 iNext = 0; + int32_t iNext = 0; return BinarySearch(dwObjNum, iNext); } -FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, FX_INT32 &iNext) +FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, int32_t &iNext) { - FX_INT32 iLen = m_number_array.GetSize(); - FX_INT32 iLow = 0; - FX_INT32 iHigh = iLen - 1; - FX_INT32 iMid = 0; + int32_t iLen = m_number_array.GetSize(); + int32_t iLow = 0; + int32_t iHigh = iLen - 1; + int32_t iMid = 0; while (iLow <= iHigh) { iMid = (iLow + iHigh) / 2; if (m_number_array.GetAt(iMid) == value) { @@ -4638,8 +4638,8 @@ FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, FX_INT32 &iNext) } CPDF_PageNode::~CPDF_PageNode() { - FX_INT32 iSize = m_childNode.GetSize(); - for (FX_INT32 i = 0; i < iSize; ++i) { + int32_t iSize = m_childNode.GetSize(); + for (int32_t i = 0; i < iSize; ++i) { CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; if (pNode) { delete pNode; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp index df154eae90..b02139db0f 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp @@ -60,7 +60,7 @@ void CPDF_SimpleParser::ParseWord(FX_LPCBYTE& pStart, FX_DWORD& dwSize, int& typ pStart = NULL; dwSize = 0; type = PDFWORD_EOF; - FX_BYTE ch; + uint8_t ch; char chartype; while (1) { if (m_dwSize <= m_dwCurPos) { @@ -322,7 +322,7 @@ CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) int dest_len = 0; int i; for (i = 0; i < src_len; i ++) { - FX_BYTE ch = src_buf[i]; + uint8_t ch = src_buf[i]; if (ch >= 0x80 || PDF_CharType[ch] == 'W' || ch == '#' || PDF_CharType[ch] == 'D') { dest_len += 3; @@ -337,7 +337,7 @@ CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) FX_LPSTR dest_buf = res.GetBuffer(dest_len); dest_len = 0; for (i = 0; i < src_len; i ++) { - FX_BYTE ch = src_buf[i]; + uint8_t ch = src_buf[i]; if (ch >= 0x80 || PDF_CharType[ch] == 'W' || ch == '#' || PDF_CharType[ch] == 'D') { dest_buf[dest_len++] = '#'; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp index a9212522b8..a98c57d86c 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp @@ -361,10 +361,10 @@ FX_BOOL CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj, con FX_FLOAT a = FXSYS_fabs(dCTM.a); FX_FLOAT d = FXSYS_fabs(dCTM.d); if (a != 1.0f || d != 1.0f) { - rect.right = rect.left + (FX_INT32)FXSYS_ceil((FX_FLOAT)rect.Width() * a); - rect.bottom = rect.top + (FX_INT32)FXSYS_ceil((FX_FLOAT)rect.Height() * d); - rtClip.right = rtClip.left + (FX_INT32)FXSYS_ceil((FX_FLOAT)rtClip.Width() * a); - rtClip.bottom = rtClip.top + (FX_INT32)FXSYS_ceil((FX_FLOAT)rtClip.Height() * d); + rect.right = rect.left + (int32_t)FXSYS_ceil((FX_FLOAT)rect.Width() * a); + rect.bottom = rect.top + (int32_t)FXSYS_ceil((FX_FLOAT)rect.Height() * d); + rtClip.right = rtClip.left + (int32_t)FXSYS_ceil((FX_FLOAT)rtClip.Width() * a); + rtClip.bottom = rtClip.top + (int32_t)FXSYS_ceil((FX_FLOAT)rtClip.Height() * d); } } rect.Intersect(rtClip); @@ -568,7 +568,7 @@ FX_ARGB CPDF_RenderStatus::GetFillArgb(const CPDF_PageObject* pObj, FX_BOOL bTyp const CPDF_GeneralStateData* pGeneralData = pObj->m_GeneralState; int alpha; if (pGeneralData) { - alpha = (FX_INT32)(pGeneralData->m_FillAlpha * 255); + alpha = (int32_t)(pGeneralData->m_FillAlpha * 255); if (pGeneralData->m_pTR) { if (!pGeneralData->m_pTransferFunc) { ((CPDF_GeneralStateData*)pGeneralData)->m_pTransferFunc = GetTransferFunc(pGeneralData->m_pTR); @@ -597,7 +597,7 @@ FX_ARGB CPDF_RenderStatus::GetStrokeArgb(const CPDF_PageObject* pObj) const const CPDF_GeneralStateData* pGeneralData = pObj->m_GeneralState; int alpha; if (pGeneralData) { - alpha = (FX_INT32)(pGeneralData->m_StrokeAlpha * 255); + alpha = (int32_t)(pGeneralData->m_StrokeAlpha * 255); if (pGeneralData->m_pTR) { if (!pGeneralData->m_pTransferFunc) { ((CPDF_GeneralStateData*)pGeneralData)->m_pTransferFunc = GetTransferFunc(pGeneralData->m_pTR); @@ -857,7 +857,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, pTextMask = NULL; } if (Transparency & PDFTRANS_GROUP && group_alpha != 1.0f) { - bitmap->MultiplyAlpha((FX_INT32)(group_alpha * 255)); + bitmap->MultiplyAlpha((int32_t)(group_alpha * 255)); } Transparency = m_Transparency; if (pPageObj->m_Type == PDFPAGE_FORM) { @@ -1371,13 +1371,13 @@ FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, CFX_Re } m_pBitmapDevice = new CFX_FxgeDevice; FXDIB_Format dibFormat = FXDIB_Rgb; - FX_INT32 bpp = 24; + int32_t bpp = 24; if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_ALPHA_OUTPUT) { dibFormat = FXDIB_Argb; bpp = 32; } CFX_FloatRect rect; - FX_INT32 iWidth, iHeight, iPitch; + int32_t iWidth, iHeight, iPitch; while (1) { rect = *pRect; m_Matrix.TransformRect(rect); diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp index 83d5f0a4c1..d22bd4b760 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp @@ -37,13 +37,13 @@ void CPDF_PageRenderCache::ClearAll() m_nCacheSize = 0; m_nTimeCount = 0; } -void CPDF_PageRenderCache::CacheOptimization(FX_INT32 dwLimitCacheSize) +void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) { if (m_nCacheSize <= (FX_DWORD)dwLimitCacheSize) { return; } int nCount = m_ImageCaches.GetCount(); - CACHEINFO* pCACHEINFO = (CACHEINFO*)FX_Alloc2D(FX_BYTE, sizeof(CACHEINFO), nCount); + CACHEINFO* pCACHEINFO = (CACHEINFO*)FX_Alloc2D(uint8_t, sizeof(CACHEINFO), nCount); FX_POSITION pos = m_ImageCaches.GetStartPosition(); int i = 0; while (pos) { @@ -106,7 +106,7 @@ FX_DWORD CPDF_PageRenderCache::GetCachedSize(CPDF_Stream* pStream) const } void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, FX_DWORD& MatteColor, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, - FX_INT32 downsampleWidth, FX_INT32 downsampleHeight) + int32_t downsampleWidth, int32_t downsampleHeight) { CPDF_ImageCache* pImageCache; FX_BOOL bFind = m_ImageCaches.Lookup(pStream, (FX_LPVOID&)pImageCache); @@ -122,7 +122,7 @@ void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*& m_nCacheSize += pImageCache->EstimateSize(); } } -FX_BOOL CPDF_PageRenderCache::StartGetCachedBitmap(CPDF_Stream* pStream, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, FX_INT32 downsampleWidth, FX_INT32 downsampleHeight) +FX_BOOL CPDF_PageRenderCache::StartGetCachedBitmap(CPDF_Stream* pStream, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t downsampleWidth, int32_t downsampleHeight) { m_bCurFindCache = m_ImageCaches.Lookup(pStream, (FX_LPVOID&)m_pCurImageCache); if (!m_bCurFindCache) { @@ -226,7 +226,7 @@ static FX_DWORD FPDF_ImageCache_EstimateImageSize(const CFX_DIBSource* pDIB) } FX_BOOL CPDF_ImageCache::GetCachedBitmap(CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, FX_DWORD& MatteColor, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, - FX_INT32 downsampleWidth, FX_INT32 downsampleHeight) + int32_t downsampleWidth, int32_t downsampleHeight) { if (m_pCachedBitmap) { pBitmap = m_pCachedBitmap; @@ -278,7 +278,7 @@ CFX_DIBSource* CPDF_ImageCache::DetachMask() } int CPDF_ImageCache::StartGetCachedBitmap(CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, - FX_INT32 downsampleWidth, FX_INT32 downsampleHeight) + int32_t downsampleWidth, int32_t downsampleHeight) { if (m_pCachedBitmap) { m_pCurBitmap = m_pCachedBitmap; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp index 214e4314da..699f84830f 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -40,7 +40,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, int left, int } else { FX_DWORD fill_argb = m_Options.TranslateColor(mask_argb); if (bitmap_alpha < 255) { - ((FX_BYTE*)&fill_argb)[3] = ((FX_BYTE*)&fill_argb)[3] * bitmap_alpha / 255; + ((uint8_t*)&fill_argb)[3] = ((uint8_t*)&fill_argb)[3] * bitmap_alpha / 255; } if (m_pDevice->SetBitMask(pDIBitmap, left, top, fill_argb)) { return; @@ -1010,7 +1010,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, if (pCS) { FX_FLOAT R, G, B; FX_DWORD comps = 8; - if (pCS->CountComponents() > static_cast(comps)) { + if (pCS->CountComponents() > static_cast(comps)) { comps = (FX_DWORD)pCS->CountComponents(); } CFX_FixedBufGrow float_array(comps); @@ -1026,7 +1026,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, pFloats[i] = pBC->GetNumber(i); } pCS->GetRGB(pFloats, R, G, B); - back_color = 0xff000000 | ((FX_INT32)(R * 255) << 16) | ((FX_INT32)(G * 255) << 8) | (FX_INT32)(B * 255); + back_color = 0xff000000 | ((int32_t)(R * 255) << 16) | ((int32_t)(G * 255) << 8) | (int32_t)(B * 255); m_pContext->m_pDocument->GetPageData()->ReleaseColorSpace(pCSObj); } } @@ -1053,7 +1053,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, int dest_pitch = pMask->GetPitch(); FX_LPBYTE src_buf = bitmap.GetBuffer(); int src_pitch = bitmap.GetPitch(); - FX_LPBYTE pTransfer = FX_Alloc(FX_BYTE, 256); + FX_LPBYTE pTransfer = FX_Alloc(uint8_t, 256); if (pFunc) { CFX_FixedBufGrow results(pFunc->CountOutputs()); for (int i = 0; i < 256; i ++) { diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index b1fd51ebe9..d45cc1151f 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -270,7 +270,7 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream, CP if (!pitch.IsValid()) { return FALSE; } - m_pLineBuf = FX_Alloc(FX_BYTE, pitch.ValueOrDie()); + m_pLineBuf = FX_Alloc(uint8_t, pitch.ValueOrDie()); if (m_pColorSpace && bStdCS) { m_pColorSpace->EnableStdConversion(TRUE); } @@ -282,7 +282,7 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream, CP if (!pitch.IsValid()) { return FALSE; } - m_pMaskedLine = FX_Alloc(FX_BYTE, pitch.ValueOrDie()); + m_pMaskedLine = FX_Alloc(uint8_t, pitch.ValueOrDie()); } m_Pitch = pitch.ValueOrDie(); if (ppMask) { @@ -314,7 +314,7 @@ int CPDF_DIBSource::ContinueToLoadMask() if (!pitch.IsValid()) { return 0; } - m_pLineBuf = FX_Alloc(FX_BYTE, pitch.ValueOrDie()); + m_pLineBuf = FX_Alloc(uint8_t, pitch.ValueOrDie()); if (m_pColorSpace && m_bStdCS) { m_pColorSpace->EnableStdConversion(TRUE); } @@ -326,7 +326,7 @@ int CPDF_DIBSource::ContinueToLoadMask() if (!pitch.IsValid()) { return 0; } - m_pMaskedLine = FX_Alloc(FX_BYTE, pitch.ValueOrDie()); + m_pMaskedLine = FX_Alloc(uint8_t, pitch.ValueOrDie()); } m_Pitch = pitch.ValueOrDie(); return 1; @@ -730,7 +730,7 @@ void CPDF_DIBSource::LoadJpxBitmap() return; } m_pCachedBitmap->Clear(0xFFFFFFFF); - context->set_output_offsets(FX_Alloc(unsigned char, output_nComps)); + context->set_output_offsets(FX_Alloc(uint8_t, output_nComps)); for (int i = 0; i < output_nComps; ++i) context->output_offsets()[i] = i; if (bSwapRGB) { @@ -1037,9 +1037,9 @@ void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_ R = NORMALCOLOR_MAX(R, 1); G = NORMALCOLOR_MAX(G, 1); B = NORMALCOLOR_MAX(B, 1); - dest_scan[dest_byte_pos] = (FX_INT32)(B * 255); - dest_scan[dest_byte_pos + 1] = (FX_INT32)(G * 255); - dest_scan[dest_byte_pos + 2] = (FX_INT32)(R * 255); + dest_scan[dest_byte_pos] = (int32_t)(B * 255); + dest_scan[dest_byte_pos + 1] = (int32_t)(G * 255); + dest_scan[dest_byte_pos + 2] = (int32_t)(R * 255); dest_byte_pos += 3; } } else { @@ -1063,9 +1063,9 @@ void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_ R = NORMALCOLOR_MAX(R, 1); G = NORMALCOLOR_MAX(G, 1); B = NORMALCOLOR_MAX(B, 1); - dest_scan[dest_byte_pos] = (FX_INT32)(B * 255); - dest_scan[dest_byte_pos + 1] = (FX_INT32)(G * 255); - dest_scan[dest_byte_pos + 2] = (FX_INT32)(R * 255); + dest_scan[dest_byte_pos] = (int32_t)(B * 255); + dest_scan[dest_byte_pos + 1] = (int32_t)(G * 255); + dest_scan[dest_byte_pos + 2] = (int32_t)(R * 255); dest_byte_pos += 3; } } @@ -1155,7 +1155,7 @@ FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const FX_LPBYTE pDestPixel = m_pMaskedLine; FX_LPCBYTE pSrcPixel = m_pLineBuf; for (int col = 0; col < m_Width; col ++) { - FX_BYTE index = *pSrcPixel++; + uint8_t index = *pSrcPixel++; if (m_pPalette) { *pDestPixel++ = FXARGB_B(m_pPalette[index]); *pDestPixel++ = FXARGB_G(m_pPalette[index]); @@ -1254,7 +1254,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ return; } - CFX_FixedBufGrow temp(orig_Bpp); + CFX_FixedBufGrow temp(orig_Bpp); if (m_bpc * m_nComponents == 1) { FX_DWORD set_argb = (FX_DWORD) - 1, reset_argb = 0; if (m_bImageMask) { @@ -1302,7 +1302,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ int dest_pos = i * dest_Bpp; if (pSrcLine[src_x / 8] & (1 << (7 - src_x % 8))) { if (dest_Bpp == 1) { - dest_scan[dest_pos] = (FX_BYTE)set_argb; + dest_scan[dest_pos] = (uint8_t)set_argb; } else if (dest_Bpp == 3) { dest_scan[dest_pos] = FXARGB_B(set_argb); dest_scan[dest_pos + 1] = FXARGB_G(set_argb); @@ -1312,7 +1312,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ } } else { if (dest_Bpp == 1) { - dest_scan[dest_pos] = (FX_BYTE)reset_argb; + dest_scan[dest_pos] = (uint8_t)reset_argb; } else if (dest_Bpp == 3) { dest_scan[dest_pos] = FXARGB_B(reset_argb); dest_scan[dest_pos + 1] = FXARGB_G(reset_argb); @@ -1345,7 +1345,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ } src_x %= src_width; FX_LPBYTE pDestPixel = dest_scan + i * 4; - FX_BYTE index = pSrcLine[src_x]; + uint8_t index = pSrcLine[src_x]; if (m_pPalette) { *pDestPixel++ = FXARGB_B(m_pPalette[index]); *pDestPixel++ = FXARGB_G(m_pPalette[index]); @@ -1365,7 +1365,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ src_x = src_width - src_x - 1; } src_x %= src_width; - FX_BYTE index = pSrcLine[src_x]; + uint8_t index = pSrcLine[src_x]; if (dest_Bpp == 1) { dest_scan[i] = index; } else { @@ -1384,7 +1384,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ FX_FLOAT unit_To8Bpc = 255.0f / ((1 << m_bpc) - 1); for (int i = 0; i < clip_width; i ++) { int dest_x = clip_left + i; - FX_DWORD src_x = (bFlipX ? (dest_width - dest_x - 1) : dest_x) * (FX_INT64)src_width / dest_width; + FX_DWORD src_x = (bFlipX ? (dest_width - dest_x - 1) : dest_x) * (int64_t)src_width / dest_width; src_x %= src_width; FX_LPCBYTE pSrcPixel = NULL; if (m_bpc % 8 == 0) { @@ -1398,7 +1398,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ argb = last_argb; } else { if (m_pColorSpace) { - FX_BYTE color[4]; + uint8_t color[4]; if (!m_bDefaultDecode) { for (int i = 0; i < m_nComponents; i ++) { int color_value = (int)((m_pCompData[i].m_DecodeMin + m_pCompData[i].m_DecodeStep * (FX_FLOAT)pSrcPixel[i]) * 255.0f + 0.5f); @@ -1412,7 +1412,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ src_bit_pos = 4; } for (FX_DWORD i = 0; i < m_nComponents; i ++) { - temp[i] = (FX_BYTE)(_GetBits8(pSrcPixel, src_bit_pos, m_bpc) * unit_To8Bpc); + temp[i] = (uint8_t)(_GetBits8(pSrcPixel, src_bit_pos, m_bpc) * unit_To8Bpc); src_bit_pos += m_bpc; } m_pColorSpace->TranslateImageLine(color, temp, 1, 0, 0, m_bLoadMask && m_GroupFamily == PDFCS_DEVICECMYK && m_Family == PDFCS_DEVICECMYK); @@ -1473,7 +1473,7 @@ CPDF_ProgressiveImageLoaderHandle::CPDF_ProgressiveImageLoaderHandle() CPDF_ProgressiveImageLoaderHandle::~CPDF_ProgressiveImageLoaderHandle() { } -FX_BOOL CPDF_ProgressiveImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader, const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, FX_INT32 nDownsampleWidth, FX_INT32 nDownsampleHeight) +FX_BOOL CPDF_ProgressiveImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader, const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t nDownsampleWidth, int32_t nDownsampleHeight) { m_pImageLoader = pImageLoader; m_pCache = pCache; @@ -1536,7 +1536,7 @@ FX_BOOL CPDF_ImageLoader::Load(const CPDF_ImageObject* pImage, CPDF_PageRenderCa } return FALSE; } -FX_BOOL CPDF_ImageLoader::StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_LPVOID& LoadHandle, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, FX_INT32 nDownsampleWidth, FX_INT32 nDownsampleHeight) +FX_BOOL CPDF_ImageLoader::StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_LPVOID& LoadHandle, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t nDownsampleWidth, int32_t nDownsampleHeight) { m_nDownsampleWidth = nDownsampleWidth; m_nDownsampleHeight = nDownsampleHeight; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index f9eec23f7a..e02cd421ff 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -77,7 +77,7 @@ static void _DrawAxialShading(CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2B FX_FLOAT x = (FX_FLOAT)column, y = (FX_FLOAT)row; matrix.Transform(x, y); FX_FLOAT scale = FXSYS_Div(FXSYS_Mul(x - start_x, x_span) + FXSYS_Mul(y - start_y, y_span), axis_len_square); - int index = (FX_INT32)(scale * (SHADING_STEPS - 1)); + int index = (int32_t)(scale * (SHADING_STEPS - 1)); if (index < 0) { if (!bStartExtend) { continue; @@ -205,7 +205,7 @@ static void _DrawRadialShading(CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2 continue; } } - int index = (FX_INT32)(s * (SHADING_STEPS - 1)); + int index = (int32_t)(s * (SHADING_STEPS - 1)); if (index < 0) { if (!bStartExtend) { continue; @@ -277,7 +277,7 @@ static void _DrawFuncShading(CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2Bi } FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f; pCS->GetRGB(pResults, R, G, B); - dib_buf[column] = FXARGB_TODIB(FXARGB_MAKE(alpha, (FX_INT32)(R * 255), (FX_INT32)(G * 255), (FX_INT32)(B * 255))); + dib_buf[column] = FXARGB_TODIB(FXARGB_MAKE(alpha, (int32_t)(R * 255), (int32_t)(G * 255), (int32_t)(B * 255))); } } } @@ -368,7 +368,7 @@ static void _DrawGouraud(CFX_DIBitmap* pBitmap, int alpha, CPDF_MeshVertex trian R += r_unit; G += g_unit; B += b_unit; - FXARGB_SETDIB(dib_buf, FXARGB_MAKE(alpha, (FX_INT32)(R * 255), (FX_INT32)(G * 255), (FX_INT32)(B * 255))); + FXARGB_SETDIB(dib_buf, FXARGB_MAKE(alpha, (int32_t)(R * 255), (int32_t)(G * 255), (int32_t)(B * 255))); dib_buf += 4; } } @@ -746,9 +746,9 @@ static void _DrawCoonPatchMeshes(FX_BOOL bTensor, CFX_DIBitmap* pBitmap, CFX_Aff for (i = iStartColor; i < 4; i ++) { FX_FLOAT r=0.0f, g=0.0f, b=0.0f; stream.GetColor(r, g, b); - patch.patch_colors[i].comp[0] = (FX_INT32)(r * 255); - patch.patch_colors[i].comp[1] = (FX_INT32)(g * 255); - patch.patch_colors[i].comp[2] = (FX_INT32)(b * 255); + patch.patch_colors[i].comp[0] = (int32_t)(r * 255); + patch.patch_colors[i].comp[1] = (int32_t)(g * 255); + patch.patch_colors[i].comp[2] = (int32_t)(b * 255); } CFX_FloatRect bbox = CFX_FloatRect::GetBBox(coords, point_count); if (bbox.right <= 0 || bbox.left >= (FX_FLOAT)pBitmap->GetWidth() || bbox.top <= 0 || @@ -787,7 +787,7 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, CFX_AffineMat } FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f; pColorSpace->GetRGB(comps, R, G, B); - background = ArgbEncode(255, (FX_INT32)(R * 255), (FX_INT32)(G * 255), (FX_INT32)(B * 255)); + background = ArgbEncode(255, (int32_t)(R * 255), (int32_t)(G * 255), (int32_t)(B * 255)); } } if (pDict->KeyExist(FX_BSTRC("BBox"))) { @@ -939,8 +939,8 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, CPDF_Pag CFX_Matrix dCTM = m_pDevice->GetCTM(); FX_FLOAT sa = FXSYS_fabs(dCTM.a); FX_FLOAT sd = FXSYS_fabs(dCTM.d); - clip_box.right = clip_box.left + (FX_INT32)FXSYS_ceil(clip_box.Width() * sa); - clip_box.bottom = clip_box.top + (FX_INT32)FXSYS_ceil(clip_box.Height() * sd); + clip_box.right = clip_box.left + (int32_t)FXSYS_ceil(clip_box.Width() * sa); + clip_box.bottom = clip_box.top + (int32_t)FXSYS_ceil(clip_box.Height() * sd); CFX_AffineMatrix mtPattern2Device = pPattern->m_Pattern2Form; mtPattern2Device.Concat(*pObj2Device); GetScaledMatrix(mtPattern2Device); diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp index 09843c9c62..410e78a67b 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -33,11 +33,11 @@ CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(FX_DWORD charcode, const CFX_AffineM m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); } CFX_GlyphBitmap* pGlyphBitmap; - if(pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(FX_UINTPTR)charcode, (void*&)pGlyphBitmap)) { + if(pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(uintptr_t)charcode, (void*&)pGlyphBitmap)) { return pGlyphBitmap; } pGlyphBitmap = RenderGlyph(pSizeCache, charcode, pMatrix, retinaScaleX, retinaScaleY); - pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(FX_UINTPTR)charcode, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)charcode, pGlyphBitmap); return pGlyphBitmap; } CPDF_Type3Glyphs::~CPDF_Type3Glyphs() @@ -512,7 +512,7 @@ public: FXTEXT_CHARPOS* m_pCharPos; FX_DWORD m_nChars; }; -FX_FLOAT _CIDTransformToFloat(FX_BYTE ch); +FX_FLOAT _CIDTransformToFloat(uint8_t ch); CPDF_CharPosList::CPDF_CharPosList() { m_pCharPos = NULL; @@ -531,7 +531,7 @@ void CPDF_CharPosList::Load(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pCharPos CPDF_CIDFont* pCIDFont = pFont->GetCIDFont(); FX_BOOL bVertWriting = pCIDFont && pCIDFont->IsVertWriting(); for (int iChar = 0; iChar < nChars; iChar ++) { - FX_DWORD CharCode = nChars == 1 ? (FX_DWORD)(FX_UINTPTR)pCharCodes : pCharCodes[iChar]; + FX_DWORD CharCode = nChars == 1 ? (FX_DWORD)(uintptr_t)pCharCodes : pCharCodes[iChar]; if (CharCode == (FX_DWORD) - 1) { continue; } @@ -614,7 +614,7 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice, FX_FLOAT origi FX_FLOAT* pCharPos; if (nChars == 1) { charcode = pFont->GetNextChar(str, str.GetLength(), offset); - pCharCodes = (FX_DWORD*)(FX_UINTPTR)charcode; + pCharCodes = (FX_DWORD*)(uintptr_t)charcode; pCharPos = NULL; } else { pCharCodes = FX_Alloc(FX_DWORD, nChars); diff --git a/core/src/fpdfapi/fpdf_render/render_int.h b/core/src/fpdfapi/fpdf_render/render_int.h index 529128e8f9..0b6873409b 100644 --- a/core/src/fpdfapi/fpdf_render/render_int.h +++ b/core/src/fpdfapi/fpdf_render/render_int.h @@ -46,7 +46,7 @@ class CPDF_TransferFunc { public: CPDF_Document* m_pPDFDoc; - FX_BYTE m_Samples[256 * 3]; + uint8_t m_Samples[256 * 3]; FX_BOOL m_bIdentity; CFX_DIBSource* TranslateImage(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc); @@ -197,7 +197,7 @@ public: FX_BOOL Load(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL); - FX_BOOL StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_LPVOID& LoadHandle, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, FX_INT32 nDownsampleWidth = 0, FX_INT32 nDownsampleHeight = 0); + FX_BOOL StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_LPVOID& LoadHandle, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, int32_t nDownsampleWidth = 0, int32_t nDownsampleHeight = 0); FX_BOOL Continue(FX_LPVOID LoadHandle, IFX_Pause* pPause); ~CPDF_ImageLoader(); CFX_DIBSource* m_pBitmap; @@ -205,8 +205,8 @@ public: FX_DWORD m_MatteColor; FX_BOOL m_bCached; protected: - FX_INT32 m_nDownsampleWidth; - FX_INT32 m_nDownsampleHeight; + int32_t m_nDownsampleWidth; + int32_t m_nDownsampleHeight; }; class CPDF_ProgressiveImageLoaderHandle { @@ -214,14 +214,14 @@ public: CPDF_ProgressiveImageLoaderHandle(); ~CPDF_ProgressiveImageLoaderHandle(); - FX_BOOL Start(CPDF_ImageLoader* pImageLoader, const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, FX_INT32 nDownsampleWidth = 0, FX_INT32 nDownsampleHeight = 0); + FX_BOOL Start(CPDF_ImageLoader* pImageLoader, const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, int32_t nDownsampleWidth = 0, int32_t nDownsampleHeight = 0); FX_BOOL Continue(IFX_Pause* pPause); protected: CPDF_ImageLoader* m_pImageLoader; CPDF_PageRenderCache* m_pCache; CPDF_ImageObject* m_pImage; - FX_INT32 m_nDownsampleWidth; - FX_INT32 m_nDownsampleHeight; + int32_t m_nDownsampleWidth; + int32_t m_nDownsampleHeight; }; class CFX_ImageTransformer; class CPDF_ImageRenderer : public IPDF_ObjectRenderer @@ -336,7 +336,7 @@ public: void Reset(const CFX_DIBitmap* pBitmap); FX_BOOL GetCachedBitmap(CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, FX_DWORD& MatteColor, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = NULL, FX_INT32 downsampleWidth = 0, FX_INT32 downsampleHeight = 0); + CPDF_RenderStatus* pRenderStatus = NULL, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); FX_DWORD EstimateSize() const { return m_dwCacheSize; @@ -357,7 +357,7 @@ public: public: int StartGetCachedBitmap(CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, - FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, FX_INT32 downsampleWidth = 0, FX_INT32 downsampleHeight = 0); + FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); int Continue(IFX_Pause* pPause); int ContinueGetCachedBitmap(); CFX_DIBSource* DetachBitmap(); diff --git a/core/src/fpdfdoc/doc_action.cpp b/core/src/fpdfdoc/doc_action.cpp index ac40335a4c..e98d3af9e7 100644 --- a/core/src/fpdfdoc/doc_action.cpp +++ b/core/src/fpdfdoc/doc_action.cpp @@ -218,7 +218,7 @@ CPDF_Dictionary* CPDF_Action::GetAnnot() const } return NULL; } -FX_INT32 CPDF_Action::GetOperationType() const +int32_t CPDF_Action::GetOperationType() const { if (m_pDict == NULL) { return 0; diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp index db1e8c49d3..5086fba3a3 100644 --- a/core/src/fpdfdoc/doc_annot.cpp +++ b/core/src/fpdfdoc/doc_annot.cpp @@ -329,9 +329,9 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, const CFX_AffineMatrix* p CPDF_Array* pColor = m_pAnnotDict->GetArray("C"); FX_DWORD argb = 0xff000000; if (pColor != NULL) { - int R = (FX_INT32)(pColor->GetNumber(0) * 255); - int G = (FX_INT32)(pColor->GetNumber(1) * 255); - int B = (FX_INT32)(pColor->GetNumber(2) * 255); + int R = (int32_t)(pColor->GetNumber(0) * 255); + int G = (int32_t)(pColor->GetNumber(1) * 255); + int B = (int32_t)(pColor->GetNumber(2) * 255); argb = ArgbEncode(0xff, R, G, B); } CPDF_GraphStateData graph_state; diff --git a/core/src/fpdfdoc/doc_ap.cpp b/core/src/fpdfdoc/doc_ap.cpp index 8a195a747d..d11b78b399 100644 --- a/core/src/fpdfdoc/doc_ap.cpp +++ b/core/src/fpdfdoc/doc_ap.cpp @@ -42,8 +42,8 @@ public: CPVT_FontMap(CPDF_Document * pDoc, CPDF_Dictionary * pResDict, CPDF_Font * pDefFont, const CFX_ByteString & sDefFontAlias); virtual ~CPVT_FontMap(); - CPDF_Font* GetPDFFont(FX_INT32 nFontIndex); - CFX_ByteString GetPDFFontAlias(FX_INT32 nFontIndex); + CPDF_Font* GetPDFFont(int32_t nFontIndex); + CFX_ByteString GetPDFFontAlias(int32_t nFontIndex); static void GetAnnotSysPDFFont(CPDF_Document * pDoc, CPDF_Dictionary * pResDict, CPDF_Font * & pSysFont, CFX_ByteString & sSysFontAlias); private: @@ -84,7 +84,7 @@ void CPVT_FontMap::GetAnnotSysPDFFont(CPDF_Document * pDoc, CPDF_Dictionary * pR } } } -CPDF_Font* CPVT_FontMap::GetPDFFont(FX_INT32 nFontIndex) +CPDF_Font* CPVT_FontMap::GetPDFFont(int32_t nFontIndex) { switch (nFontIndex) { case 0: @@ -97,7 +97,7 @@ CPDF_Font* CPVT_FontMap::GetPDFFont(FX_INT32 nFontIndex) } return NULL; } -CFX_ByteString CPVT_FontMap::GetPDFFontAlias(FX_INT32 nFontIndex) +CFX_ByteString CPVT_FontMap::GetPDFFontAlias(int32_t nFontIndex) { switch (nFontIndex) { case 0: @@ -117,7 +117,7 @@ CPVT_Provider::CPVT_Provider(IPVT_FontMap * pFontMap) : m_pFontMap(pFontMap) CPVT_Provider::~CPVT_Provider() { } -FX_INT32 CPVT_Provider::GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_INT32 nWordStyle) +int32_t CPVT_Provider::GetCharWidth(int32_t nFontIndex, FX_WORD word, int32_t nWordStyle) { if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) { FX_DWORD charcode = pPDFFont->CharCodeFromUnicode(word); @@ -127,21 +127,21 @@ FX_INT32 CPVT_Provider::GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_INT32 } return 0; } -FX_INT32 CPVT_Provider::GetTypeAscent(FX_INT32 nFontIndex) +int32_t CPVT_Provider::GetTypeAscent(int32_t nFontIndex) { if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) { return pPDFFont->GetTypeAscent(); } return 0; } -FX_INT32 CPVT_Provider::GetTypeDescent(FX_INT32 nFontIndex) +int32_t CPVT_Provider::GetTypeDescent(int32_t nFontIndex) { if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) { return pPDFFont->GetTypeDescent(); } return 0; } -FX_INT32 CPVT_Provider::GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex) +int32_t CPVT_Provider::GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex) { if (CPDF_Font* pDefFont = m_pFontMap->GetPDFFont(0)) { if (pDefFont->CharCodeFromUnicode(word) != -1) { @@ -161,11 +161,11 @@ FX_BOOL CPVT_Provider::IsLatinWord(FX_WORD word) } return FALSE; } -FX_INT32 CPVT_Provider::GetDefaultFontIndex() +int32_t CPVT_Provider::GetDefaultFontIndex() { return 0; } -static CFX_ByteString GetPDFWordString(IPVT_FontMap * pFontMap, FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord) +static CFX_ByteString GetPDFWordString(IPVT_FontMap * pFontMap, int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord) { CFX_ByteString sWord; if (SubWord > 0) { @@ -193,7 +193,7 @@ static CFX_ByteString GetWordRenderString(const CFX_ByteString & strWords) } return ""; } -static CFX_ByteString GetFontSetString(IPVT_FontMap * pFontMap, FX_INT32 nFontIndex, FX_FLOAT fFontSize) +static CFX_ByteString GetFontSetString(IPVT_FontMap * pFontMap, int32_t nFontIndex, FX_FLOAT fFontSize) { CFX_ByteTextBuf sRet; if (pFontMap) { @@ -244,7 +244,7 @@ static CPVT_Color ParseColor(const CPDF_Array & array) } return rt; } -static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict, const FX_INT32 & nWidgetType) +static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict, const int32_t & nWidgetType) { CPDF_Dictionary* pFormDict = NULL; if (CPDF_Dictionary * pRootDict = pDoc->GetRoot()) { @@ -310,7 +310,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict return FALSE; } CPDF_Rect rcAnnot = pAnnotDict->GetRect("Rect"); - FX_INT32 nRotate = 0; + int32_t nRotate = 0; if (CPDF_Dictionary * pMKDict = pAnnotDict->GetDict("MK")) { nRotate = pMKDict->GetInteger("R"); } @@ -333,7 +333,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict rcBBox = CPDF_Rect(0, 0, rcAnnot.top - rcAnnot.bottom, rcAnnot.right - rcAnnot.left); break; } - FX_INT32 nBorderStyle = PBS_SOLID; + int32_t nBorderStyle = PBS_SOLID; FX_FLOAT fBorderWidth = 1; CPVT_Dash dsBorder(3, 0, 0); CPVT_Color crLeftTop, crRightBottom; @@ -405,7 +405,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict if (pNormalStream == NULL) { return FALSE; } - FX_INT32 objnum = pDoc->AddIndirectObject(pNormalStream); + int32_t objnum = pDoc->AddIndirectObject(pNormalStream); pAnnotDict->GetDict("AP")->SetAtReference("N", pDoc, objnum); } CPDF_Dictionary * pStreamDict = pNormalStream->GetDict(); @@ -433,7 +433,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict switch (nWidgetType) { case 0: { CFX_WideString swValue = FPDF_GetFieldAttr(pAnnotDict, "V")? FPDF_GetFieldAttr(pAnnotDict, "V")->GetUnicodeText() : CFX_WideString(); - FX_INT32 nAlign = FPDF_GetFieldAttr(pAnnotDict, "Q")? FPDF_GetFieldAttr(pAnnotDict, "Q")->GetInteger() : 0; + int32_t nAlign = FPDF_GetFieldAttr(pAnnotDict, "Q")? FPDF_GetFieldAttr(pAnnotDict, "Q")->GetInteger() : 0; FX_DWORD dwFlags = FPDF_GetFieldAttr(pAnnotDict, "Ff")? FPDF_GetFieldAttr(pAnnotDict, "Ff")->GetInteger() : 0; FX_DWORD dwMaxLen = FPDF_GetFieldAttr(pAnnotDict, "MaxLen") ? FPDF_GetFieldAttr(pAnnotDict, "MaxLen")->GetInteger() : 0; CPVT_FontMap map(pDoc, pStreamDict ? pStreamDict->GetDict("Resources") : NULL , pDefFont, sFontName.Right(sFontName.GetLength() - 1)); @@ -540,11 +540,11 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict CPVT_Provider prd(&map); CPDF_Array * pOpts = FPDF_GetFieldAttr(pAnnotDict, "Opt") ? FPDF_GetFieldAttr(pAnnotDict, "Opt")->GetArray() : NULL; CPDF_Array * pSels = FPDF_GetFieldAttr(pAnnotDict, "I") ? FPDF_GetFieldAttr(pAnnotDict, "I")->GetArray() : NULL; - FX_INT32 nTop = FPDF_GetFieldAttr(pAnnotDict, "TI") ? FPDF_GetFieldAttr(pAnnotDict, "TI")->GetInteger() : 0; + int32_t nTop = FPDF_GetFieldAttr(pAnnotDict, "TI") ? FPDF_GetFieldAttr(pAnnotDict, "TI")->GetInteger() : 0; CFX_ByteTextBuf sBody; if (pOpts) { FX_FLOAT fy = rcBody.top; - for (FX_INT32 i = nTop, sz = pOpts->GetCount(); i < sz; i++) { + for (int32_t i = nTop, sz = pOpts->GetCount(); i < sz; i++) { if (IsFloatSmaller(fy, rcBody.bottom)) { break; } @@ -598,7 +598,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict break; } if (pNormalStream) { - pNormalStream->SetData((FX_BYTE*)sAppStream.GetBuffer(), sAppStream.GetSize(), FALSE, FALSE); + pNormalStream->SetData((uint8_t*)sAppStream.GetBuffer(), sAppStream.GetSize(), FALSE, FALSE); pStreamDict = pNormalStream->GetDict(); if (pStreamDict) { pStreamDict->SetAtMatrix("Matrix", matrix); @@ -640,7 +640,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP(IPVT_FontMap * pFontMap, IPDF_Var { CFX_ByteTextBuf sEditStream, sLineStream, sWords; CPDF_Point ptOld(0.0f, 0.0f), ptNew(0.0f, 0.0f); - FX_INT32 nCurFontIndex = -1; + int32_t nCurFontIndex = -1; if (pIterator) { if (pVisible) { pIterator->SetAt(pVisible->BeginPos); @@ -713,7 +713,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP(IPVT_FontMap * pFontMap, IPDF_Var } CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(const CPDF_Rect & rect, FX_FLOAT fWidth, const CPVT_Color & color, const CPVT_Color & crLeftTop, const CPVT_Color & crRightBottom, - FX_INT32 nStyle, const CPVT_Dash & dash) + int32_t nStyle, const CPVT_Dash & dash) { CFX_ByteTextBuf sAppStream; CFX_ByteString sColor; diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp index 48f3ccae98..dfa2e6718a 100644 --- a/core/src/fpdfdoc/doc_basic.cpp +++ b/core/src/fpdfdoc/doc_basic.cpp @@ -103,7 +103,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, const CFX_ByteString& FX_DWORD dwCount = pNames->GetCount() / 2; for (FX_DWORD i = 0; i < dwCount; i ++) { CFX_ByteString csValue = pNames->GetString(i * 2); - FX_INT32 iCompare = csValue.Compare(csName); + int32_t iCompare = csValue.Compare(csName); if (iCompare <= 0) { if (ppFind != NULL) { *ppFind = pNames; @@ -405,7 +405,7 @@ CPDF_Stream* CPDF_FileSpec::GetFileStream() const if (m_pObj == NULL) { return NULL; } - FX_INT32 iType = m_pObj->GetType(); + int32_t iType = m_pObj->GetType(); if (iType == PDFOBJ_STREAM) { return (CPDF_Stream*)m_pObj; } else if (iType == PDFOBJ_DICTIONARY) { @@ -426,7 +426,7 @@ static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object *pObj, FX_WSTR wsFileName, } else { wsStr = FILESPEC_EncodeFileName(wsFileName); } - FX_INT32 iType = pObj->GetType(); + int32_t iType = pObj->GetType(); if (iType == PDFOBJ_STRING) { pObj->SetString(CFX_ByteString::FromUnicode(wsStr)); } else if (iType == PDFOBJ_DICTIONARY) { @@ -540,7 +540,7 @@ CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const wsLabel.Format(L"%d", nPage + 1); return wsLabel; } -FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_BSTR bsLabel) const +int32_t CPDF_PageLabel::GetPageByLabel(FX_BSTR bsLabel) const { if (m_pDocument == NULL) { return -1; @@ -565,7 +565,7 @@ FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_BSTR bsLabel) const } return -1; } -FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_WSTR wsLabel) const +int32_t CPDF_PageLabel::GetPageByLabel(FX_WSTR wsLabel) const { CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr()); return GetPageByLabel(bsLabel); diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp index 329d53b87f..f791a325e4 100644 --- a/core/src/fpdfdoc/doc_form.cpp +++ b/core/src/fpdfdoc/doc_form.cpp @@ -373,7 +373,7 @@ static FX_BOOL RetrieveSpecificFont(LOGFONTA& lf) } return fd.bFind; } -static FX_BOOL RetrieveSpecificFont(FX_BYTE charSet, FX_BYTE pitchAndFamily, LPCSTR pcsFontName, LOGFONTA& lf) +static FX_BOOL RetrieveSpecificFont(uint8_t charSet, uint8_t pitchAndFamily, LPCSTR pcsFontName, LOGFONTA& lf) { memset(&lf, 0, sizeof(LOGFONTA)); lf.lfCharSet = charSet; @@ -383,7 +383,7 @@ static FX_BOOL RetrieveSpecificFont(FX_BYTE charSet, FX_BYTE pitchAndFamily, LPC } return RetrieveSpecificFont(lf); } -static FX_BOOL RetrieveStockFont(int iFontObject, FX_BYTE charSet, LOGFONTA& lf) +static FX_BOOL RetrieveStockFont(int iFontObject, uint8_t charSet, LOGFONTA& lf) { HFONT hFont = (HFONT)::GetStockObject(iFontObject); if (hFont != NULL) { @@ -415,7 +415,7 @@ CPDF_Font* CPDF_InterForm::AddSystemDefaultFont(const CPDF_Document* pDocument) #endif return pFont; } -CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_ByteString csFontName, FX_BYTE iCharSet) +CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_ByteString csFontName, uint8_t iCharSet) { if (pDocument == NULL || csFontName.IsEmpty()) { return NULL; @@ -437,7 +437,7 @@ CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_Byt #endif return NULL; } -CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_WideString csFontName, FX_BYTE iCharSet) +CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_WideString csFontName, uint8_t iCharSet) { if (pDocument == NULL || csFontName.IsEmpty()) { return NULL; @@ -473,7 +473,7 @@ CPDF_Font* CPDF_InterForm::AddStandardFont(const CPDF_Document* pDocument, CFX_B } return pFont; } -CFX_ByteString CPDF_InterForm::GetNativeFont(FX_BYTE charSet, FX_LPVOID pLogFont) +CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, FX_LPVOID pLogFont) { CFX_ByteString csFontName; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ @@ -513,16 +513,16 @@ CFX_ByteString CPDF_InterForm::GetNativeFont(FX_BYTE charSet, FX_LPVOID pLogFont CFX_ByteString CPDF_InterForm::GetNativeFont(FX_LPVOID pLogFont) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - FX_BYTE charSet = GetNativeCharSet(); + uint8_t charSet = GetNativeCharSet(); return GetNativeFont(charSet, pLogFont); #else return CFX_ByteString(); #endif } -FX_BYTE CPDF_InterForm::GetNativeCharSet() +uint8_t CPDF_InterForm::GetNativeCharSet() { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - FX_BYTE charSet = ANSI_CHARSET; + uint8_t charSet = ANSI_CHARSET; UINT iCodePage = ::GetACP(); switch (iCodePage) { case 932: @@ -579,7 +579,7 @@ FX_BYTE CPDF_InterForm::GetNativeCharSet() return 0; #endif } -CPDF_Font* CPDF_InterForm::AddNativeFont(FX_BYTE charSet, const CPDF_Document* pDocument) +CPDF_Font* CPDF_InterForm::AddNativeFont(uint8_t charSet, const CPDF_Document* pDocument) { if (pDocument == NULL) { return NULL; @@ -604,7 +604,7 @@ CPDF_Font* CPDF_InterForm::AddNativeFont(const CPDF_Document* pDocument) return NULL; } CPDF_Font* pFont = NULL; - FX_BYTE charSet = GetNativeCharSet(); + uint8_t charSet = GetNativeCharSet(); pFont = AddNativeFont(charSet, pDocument); return pFont; } @@ -1083,7 +1083,7 @@ CPDF_Font* CPDF_InterForm::GetFormFont(CFX_ByteString csFontName, CFX_ByteString { return GetInterFormFont(m_pFormDict, m_pDocument, csFontName, csNameTag); } -CPDF_Font* CPDF_InterForm::GetNativeFormFont(FX_BYTE charSet, CFX_ByteString& csNameTag) +CPDF_Font* CPDF_InterForm::GetNativeFormFont(uint8_t charSet, CFX_ByteString& csNameTag) { return GetNativeInterFormFont(m_pFormDict, m_pDocument, charSet, csNameTag); } @@ -1104,7 +1104,7 @@ void CPDF_InterForm::AddFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameT AddInterFormFont(m_pFormDict, m_pDocument, pFont, csNameTag); m_bUpdated = TRUE; } -CPDF_Font* CPDF_InterForm::AddNativeFormFont(FX_BYTE charSet, CFX_ByteString& csNameTag) +CPDF_Font* CPDF_InterForm::AddNativeFormFont(uint8_t charSet, CFX_ByteString& csNameTag) { m_bUpdated = TRUE; return AddNativeInterFormFont(m_pFormDict, m_pDocument, charSet, csNameTag); @@ -1363,7 +1363,7 @@ CPDF_FormField* CPDF_InterForm::CheckRequiredFields(const CFX_PtrArray *fields, if (pField == NULL) { continue; } - FX_INT32 iType = pField->GetType(); + int32_t iType = pField->GetType(); if (iType == CPDF_FormField::PushButton || iType == CPDF_FormField::CheckBox || iType == CPDF_FormField::ListBox) { continue; } @@ -1466,7 +1466,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF(FX_WSTR pdf_path, CFX_PtrArray& field } const struct _SupportFieldEncoding { FX_LPCSTR m_name; - FX_INT32 m_codePage; + int32_t m_codePage; } g_fieldEncoding[] = { { "BigFive", 950 }, { "GBK", 936 }, @@ -1477,8 +1477,8 @@ static void FPDFDOC_FDF_GetFieldValue(CPDF_Dictionary *pFieldDict, CFX_WideStrin { ASSERT(pFieldDict != NULL); CFX_ByteString csBValue = pFieldDict->GetString("V"); - FX_INT32 iCount = sizeof(g_fieldEncoding) / sizeof(g_fieldEncoding[0]); - FX_INT32 i = 0; + int32_t iCount = sizeof(g_fieldEncoding) / sizeof(g_fieldEncoding[0]); + int32_t i = 0; for (; i < iCount; ++i) if (bsEncoding == g_fieldEncoding[i].m_name) { break; diff --git a/core/src/fpdfdoc/doc_link.cpp b/core/src/fpdfdoc/doc_link.cpp index 1957960d0f..0109e7c9b3 100644 --- a/core/src/fpdfdoc/doc_link.cpp +++ b/core/src/fpdfdoc/doc_link.cpp @@ -23,9 +23,9 @@ CFX_PtrArray* CPDF_LinkList::GetPageLinks(CPDF_Page* pPage) return NULL; } CFX_PtrArray* pPageLinkList = NULL; - if (!m_PageMap.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, (FX_LPVOID&)pPageLinkList)) { + if (!m_PageMap.Lookup((FX_LPVOID)(uintptr_t)objnum, (FX_LPVOID&)pPageLinkList)) { pPageLinkList = new CFX_PtrArray; - m_PageMap.SetAt((FX_LPVOID)(FX_UINTPTR)objnum, pPageLinkList); + m_PageMap.SetAt((FX_LPVOID)(uintptr_t)objnum, pPageLinkList); LoadPageLinks(pPage, pPageLinkList); } return pPageLinkList; diff --git a/core/src/fpdfdoc/doc_metadata.cpp b/core/src/fpdfdoc/doc_metadata.cpp index e6c7a641e6..e3226bd7dd 100644 --- a/core/src/fpdfdoc/doc_metadata.cpp +++ b/core/src/fpdfdoc/doc_metadata.cpp @@ -73,7 +73,7 @@ void CPDF_Metadata::LoadDoc(CPDF_Document *pDoc) pElmntRdf = pXmlElmnt->GetElement(NULL, FX_BSTRC("RDF")); } } -FX_INT32 CPDF_Metadata::GetString(FX_BSTR bsItem, CFX_WideString &wsStr) +int32_t CPDF_Metadata::GetString(FX_BSTR bsItem, CFX_WideString &wsStr) { if (!((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt) { return -1; diff --git a/core/src/fpdfdoc/doc_ocg.cpp b/core/src/fpdfdoc/doc_ocg.cpp index 0ca9fc0313..c2f77a58fa 100644 --- a/core/src/fpdfdoc/doc_ocg.cpp +++ b/core/src/fpdfdoc/doc_ocg.cpp @@ -5,12 +5,12 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/fpdfdoc/fpdf_doc.h" -static FX_INT32 FPDFDOC_OCG_FindGroup(const CPDF_Object *pObject, const CPDF_Dictionary *pGroupDict) +static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object *pObject, const CPDF_Dictionary *pGroupDict) { if (pObject == NULL || pGroupDict == NULL) { return -1; } - FX_INT32 iType = pObject->GetType(); + int32_t iType = pObject->GetType(); if (iType == PDFOBJ_ARRAY) { FX_DWORD dwCount = ((CPDF_Array*)pObject)->GetCount(); for (FX_DWORD i = 0; i < dwCount; i++) { @@ -64,8 +64,8 @@ static CPDF_Dictionary* FPDFDOC_OCG_GetConfig(CPDF_Document *pDoc, const CPDF_Di CPDF_Array *pConfigs = pOCProperties->GetArray(FX_BSTRC("Configs")); if (pConfigs) { CPDF_Dictionary *pFind; - FX_INT32 iCount = pConfigs->GetCount(); - for (FX_INT32 i = 0; i < iCount; i ++) { + int32_t iCount = pConfigs->GetCount(); + for (int32_t i = 0; i < iCount; i ++) { pFind = pConfigs->GetDict(i); if (!pFind) { continue; @@ -124,8 +124,8 @@ FX_BOOL CPDF_OCContext::LoadOCGStateFromConfig(FX_BSTR csConfig, const CPDF_Dict pArray = pConfig->GetArray(FX_BSTRC("AS")); if (pArray) { CFX_ByteString csFind = csConfig + FX_BSTRC("State"); - FX_INT32 iCount = pArray->GetCount(); - for (FX_INT32 i = 0; i < iCount; i ++) { + int32_t iCount = pArray->GetCount(); + for (int32_t i = 0; i < iCount; i ++) { CPDF_Dictionary *pUsage = pArray->GetDict(i); if (!pUsage) { continue; @@ -181,11 +181,11 @@ FX_BOOL CPDF_OCContext::GetOCGVisible(const CPDF_Dictionary *pOCGDict) } FX_LPVOID bState = NULL; if (m_OCGStates.Lookup(pOCGDict, bState)) { - return (FX_UINTPTR)bState != 0; + return (uintptr_t)bState != 0; } - bState = (FX_LPVOID)(FX_UINTPTR)LoadOCGState(pOCGDict); + bState = (FX_LPVOID)(uintptr_t)LoadOCGState(pOCGDict); m_OCGStates.SetAt(pOCGDict, bState); - return (FX_UINTPTR)bState != 0; + return (uintptr_t)bState != 0; } FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array *pExpression, FX_BOOL bFromConfig, int nLevel) { @@ -195,7 +195,7 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array *pExpression, FX_BOOL bFromConfig, i if (pExpression == NULL) { return FALSE; } - FX_INT32 iCount = pExpression->GetCount(); + int32_t iCount = pExpression->GetCount(); CPDF_Object *pOCGObj; CFX_ByteString csOperator = pExpression->GetString(0); if (csOperator == FX_BSTRC("Not")) { @@ -213,7 +213,7 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array *pExpression, FX_BOOL bFromConfig, i } if (csOperator == FX_BSTRC("Or") || csOperator == FX_BSTRC("And")) { FX_BOOL bValue = FALSE; - for (FX_INT32 i = 1; i < iCount; i ++) { + for (int32_t i = 1; i < iCount; i ++) { pOCGObj = pExpression->GetElementValue(1); if (pOCGObj == NULL) { continue; @@ -260,8 +260,8 @@ FX_BOOL CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary *pOCMDDict, FX_BOOL if (csP == FX_BSTRC("AllOn") || csP == FX_BSTRC("AllOff")) { bState = TRUE; } - FX_INT32 iCount = ((CPDF_Array*)pOCGObj)->GetCount(); - for (FX_INT32 i = 0; i < iCount; i ++) { + int32_t iCount = ((CPDF_Array*)pOCGObj)->GetCount(); + for (int32_t i = 0; i < iCount; i ++) { FX_BOOL bItem = TRUE; CPDF_Dictionary* pItemDict = ((CPDF_Array*)pOCGObj)->GetDict(i); if (pItemDict) { diff --git a/core/src/fpdfdoc/doc_utils.cpp b/core/src/fpdfdoc/doc_utils.cpp index 35e001ea69..df393b2f77 100644 --- a/core/src/fpdfdoc/doc_utils.cpp +++ b/core/src/fpdfdoc/doc_utils.cpp @@ -245,7 +245,7 @@ void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) if (!pFormDict->KeyExist("DR")) { CPDF_Font* pFont = NULL; CFX_ByteString csBaseName, csDefault; - FX_BYTE charSet = CPDF_InterForm::GetNativeCharSet(); + uint8_t charSet = CPDF_InterForm::GetNativeCharSet(); pFont = CPDF_InterForm::AddStandardFont(pDocument, "Helvetica"); if (pFont != NULL) { AddInterFormFont(pFormDict, pDocument, pFont, csBaseName); @@ -409,7 +409,7 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument } return NULL; } -CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag) +CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, uint8_t charSet, CFX_ByteString& csNameTag) { if (pFormDict == NULL) { return NULL; @@ -456,7 +456,7 @@ CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDo CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag) { csNameTag = ""; - FX_BYTE charSet = CPDF_InterForm::GetNativeCharSet(); + uint8_t charSet = CPDF_InterForm::GetNativeCharSet(); CFX_SubstFont* pSubst; CPDF_Font* pFont = GetDefaultInterFormFont(pFormDict, pDocument); if (pFont != NULL) { @@ -586,7 +586,7 @@ void AddInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, con csNameTag = CPDF_InterForm::GenerateNewResourceName(pDR, "Font", 4, csNameTag); pFonts->SetAtReference(csNameTag, pDocument, pFont->GetFontDict()); } -CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag) +CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, uint8_t charSet, CFX_ByteString& csNameTag) { if (pFormDict == NULL) { InitInterFormDict(pFormDict, pDocument); @@ -611,7 +611,7 @@ CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pD } CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag) { - FX_BYTE charSet = CPDF_InterForm::GetNativeCharSet(); + uint8_t charSet = CPDF_InterForm::GetNativeCharSet(); return AddNativeInterFormFont(pFormDict, pDocument, charSet, csNameTag); } void RemoveInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont) diff --git a/core/src/fpdfdoc/doc_utils.h b/core/src/fpdfdoc/doc_utils.h index 08c4e7e552..6bb1d30dbb 100644 --- a/core/src/fpdfdoc/doc_utils.h +++ b/core/src/fpdfdoc/doc_utils.h @@ -13,12 +13,12 @@ FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict); CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, FX_DWORD index, CFX_ByteString& csNameTag); CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csNameTag); CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CFX_ByteString& csNameTag); -CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag); +CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, uint8_t charSet, CFX_ByteString& csNameTag); CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag); FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont, CFX_ByteString& csNameTag); FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag); void AddInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, const CPDF_Font* pFont, CFX_ByteString& csNameTag); -CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag); +CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, uint8_t charSet, CFX_ByteString& csNameTag); CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag); void RemoveInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont); void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag); diff --git a/core/src/fpdfdoc/doc_viewerPreferences.cpp b/core/src/fpdfdoc/doc_viewerPreferences.cpp index f68d3fbdc7..7ec325cfb4 100644 --- a/core/src/fpdfdoc/doc_viewerPreferences.cpp +++ b/core/src/fpdfdoc/doc_viewerPreferences.cpp @@ -29,7 +29,7 @@ FX_BOOL CPDF_ViewerPreferences::PrintScaling() const } return FX_BSTRC("None") != pDict->GetString(FX_BSTRC("PrintScaling")); } -FX_INT32 CPDF_ViewerPreferences::NumCopies() const +int32_t CPDF_ViewerPreferences::NumCopies() const { CPDF_Dictionary *pDict = m_pDoc->GetRoot(); pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); diff --git a/core/src/fpdfdoc/doc_vt.cpp b/core/src/fpdfdoc/doc_vt.cpp index 3ae23ffcbc..52096f7090 100644 --- a/core/src/fpdfdoc/doc_vt.cpp +++ b/core/src/fpdfdoc/doc_vt.cpp @@ -7,7 +7,7 @@ #include "../../include/fpdfdoc/fpdf_doc.h" #include "../../include/fpdfdoc/fpdf_vt.h" #include "pdf_vt.h" -const FX_BYTE gFontSizeSteps[] = { 4, 6, 8, 9, 10, 12, 14, 18, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80, 90, 100, 110, 120, 130, 144}; +const uint8_t gFontSizeSteps[] = { 4, 6, 8, 9, 10, 12, 14, 18, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80, 90, 100, 110, 120, 130, 144}; #define PVT_RETURN_LENGTH 1 #define PVT_DEFAULT_FONTSIZE 18.0f #define PVTWORD_SCRIPT_NORMAL 0 @@ -62,14 +62,14 @@ void CSection::ResetLineArray() } void CSection::ResetWordArray() { - for (FX_INT32 i = 0, sz = m_WordArray.GetSize(); i < sz; i++) { + for (int32_t i = 0, sz = m_WordArray.GetSize(); i < sz; i++) { delete m_WordArray.GetAt(i); } m_WordArray.RemoveAll(); } void CSection::ResetLinePlace() { - for (FX_INT32 i = 0, sz = m_LineArray.GetSize(); i < sz; i++) { + for (int32_t i = 0, sz = m_LineArray.GetSize(); i < sz; i++) { if (CLine * pLine = m_LineArray.GetAt(i)) { pLine->LinePlace = CPVT_WordPlace(SecPlace.nSecIndex, i, -1); } @@ -78,7 +78,7 @@ void CSection::ResetLinePlace() CPVT_WordPlace CSection::AddWord(const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo) { CPVT_WordInfo * pWord = new CPVT_WordInfo(wordinfo); - FX_INT32 nWordIndex = FPDF_MAX(FPDF_MIN(place.nWordIndex, this->m_WordArray.GetSize()), 0); + int32_t nWordIndex = FPDF_MAX(FPDF_MIN(place.nWordIndex, this->m_WordArray.GetSize()), 0); if (nWordIndex == m_WordArray.GetSize()) { m_WordArray.Add(pWord); } else { @@ -161,9 +161,9 @@ CPVT_WordPlace CSection::GetNextWordPlace(const CPVT_WordPlace & place) const } void CSection::UpdateWordPlace(CPVT_WordPlace & place) const { - FX_INT32 nLeft = 0; - FX_INT32 nRight = m_LineArray.GetSize() - 1; - FX_INT32 nMid = (nLeft + nRight) / 2; + int32_t nLeft = 0; + int32_t nRight = m_LineArray.GetSize() - 1; + int32_t nMid = (nLeft + nRight) / 2; while (nLeft <= nRight) { if (CLine * pLine = m_LineArray.GetAt(nMid)) { if (place.nWordIndex < pLine->m_LineInfo.nBeginWordIndex) { @@ -187,9 +187,9 @@ CPVT_WordPlace CSection::SearchWordPlace(const CPDF_Point & point) const CPVT_WordPlace place = GetBeginWordPlace(); FX_BOOL bUp = TRUE; FX_BOOL bDown = TRUE; - FX_INT32 nLeft = 0; - FX_INT32 nRight = m_LineArray.GetSize() - 1; - FX_INT32 nMid = m_LineArray.GetSize() / 2; + int32_t nLeft = 0; + int32_t nRight = m_LineArray.GetSize() - 1; + int32_t nMid = m_LineArray.GetSize() / 2; FX_FLOAT fTop = 0; FX_FLOAT fBottom = 0; while (nLeft <= nRight) { @@ -242,9 +242,9 @@ CPVT_WordPlace CSection::SearchWordPlace(FX_FLOAT fx, const CPVT_WordRange & ran if (!m_pVT) { return wordplace; } - FX_INT32 nLeft = range.BeginPos.nWordIndex; - FX_INT32 nRight = range.EndPos.nWordIndex + 1; - FX_INT32 nMid = (nLeft + nRight) / 2; + int32_t nLeft = range.BeginPos.nWordIndex; + int32_t nRight = range.EndPos.nWordIndex + 1; + int32_t nMid = (nLeft + nRight) / 2; while (nLeft < nRight) { if (nMid == nLeft) { break; @@ -274,23 +274,23 @@ CPVT_WordPlace CSection::SearchWordPlace(FX_FLOAT fx, const CPVT_WordRange & ran } return wordplace; } -void CSection::ClearLeftWords(FX_INT32 nWordIndex) +void CSection::ClearLeftWords(int32_t nWordIndex) { - for (FX_INT32 i = nWordIndex; i >= 0; i--) { + for (int32_t i = nWordIndex; i >= 0; i--) { delete m_WordArray.GetAt(i); m_WordArray.RemoveAt(i); } } -void CSection::ClearRightWords(FX_INT32 nWordIndex) +void CSection::ClearRightWords(int32_t nWordIndex) { - for (FX_INT32 i = m_WordArray.GetSize() - 1; i > nWordIndex; i--) { + for (int32_t i = m_WordArray.GetSize() - 1; i > nWordIndex; i--) { delete m_WordArray.GetAt(i); m_WordArray.RemoveAt(i); } } -void CSection::ClearMidWords(FX_INT32 nBeginIndex, FX_INT32 nEndIndex) +void CSection::ClearMidWords(int32_t nBeginIndex, int32_t nEndIndex) { - for (FX_INT32 i = nEndIndex; i > nBeginIndex; i--) { + for (int32_t i = nEndIndex; i > nBeginIndex; i--) { delete m_WordArray.GetAt(i); m_WordArray.RemoveAt(i); } @@ -331,7 +331,7 @@ CPVT_FloatRect CTypeset::CharArray() m_rcRet.Default(); FX_FLOAT x = 0.0f, y = 0.0f; FX_FLOAT fNextWidth; - FX_INT32 nStart = 0; + int32_t nStart = 0; FX_FLOAT fNodeWidth = m_pVT->GetPlateWidth() / (m_pVT->m_nCharArray <= 0 ? 1 : m_pVT->m_nCharArray); if (CLine * pLine = m_pSection->m_LineArray.GetAt(0)) { x = 0.0f; @@ -351,7 +351,7 @@ CPVT_FloatRect CTypeset::CharArray() pLine->m_LineInfo.fLineX = fNodeWidth * nStart - fNodeWidth * PVT_HALF; break; } - for (FX_INT32 w = 0, sz = m_pSection->m_WordArray.GetSize(); w < sz; w++) { + for (int32_t w = 0, sz = m_pSection->m_WordArray.GetSize(); w < sz; w++) { if (w >= m_pVT->m_nCharArray) { break; } @@ -590,23 +590,23 @@ void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize) { ASSERT(m_pVT != NULL); ASSERT(m_pSection != NULL); - FX_INT32 nLineHead = 0; - FX_INT32 nLineTail = 0; + int32_t nLineHead = 0; + int32_t nLineTail = 0; FX_FLOAT fMaxX = 0.0f, fMaxY = 0.0f; FX_FLOAT fLineWidth = 0.0f, fBackupLineWidth = 0.0f; FX_FLOAT fLineAscent = 0.0f, fBackupLineAscent = 0.0f; FX_FLOAT fLineDescent = 0.0f, fBackupLineDescent = 0.0f; - FX_INT32 nWordStartPos = 0; + int32_t nWordStartPos = 0; FX_BOOL bFullWord = FALSE; - FX_INT32 nLineFullWordIndex = 0; - FX_INT32 nCharIndex = 0; + int32_t nLineFullWordIndex = 0; + int32_t nCharIndex = 0; CPVT_LineInfo line; FX_FLOAT fWordWidth = 0; FX_FLOAT fTypesetWidth = FPDF_MAX(m_pVT->GetPlateWidth() - m_pVT->GetLineIndent(m_pSection->m_SecInfo), 0.0f); - FX_INT32 nTotalWords = m_pSection->m_WordArray.GetSize(); + int32_t nTotalWords = m_pSection->m_WordArray.GetSize(); FX_BOOL bOpened = FALSE; if (nTotalWords > 0) { - FX_INT32 i = 0; + int32_t i = 0; while (i < nTotalWords) { CPVT_WordInfo * pWord = m_pSection->m_WordArray.GetAt(i); CPVT_WordInfo* pOldWord = pWord; @@ -752,10 +752,10 @@ void CTypeset::OutputLines() fMaxX = fMinX + m_rcRet.Width(); fMinY = 0.0f; fMaxY = m_rcRet.Height(); - FX_INT32 nTotalLines = m_pSection->m_LineArray.GetSize(); + int32_t nTotalLines = m_pSection->m_LineArray.GetSize(); if (nTotalLines > 0) { m_pSection->m_SecInfo.nTotalLine = nTotalLines; - for (FX_INT32 l = 0; l < nTotalLines; l++) { + for (int32_t l = 0; l < nTotalLines; l++) { if (CLine * pLine = m_pSection->m_LineArray.GetAt(l)) { switch (m_pVT->GetAlignment(m_pSection->m_SecInfo)) { default: @@ -774,7 +774,7 @@ void CTypeset::OutputLines() fPosY += pLine->m_LineInfo.fLineAscent; pLine->m_LineInfo.fLineX = fPosX - fMinX; pLine->m_LineInfo.fLineY = fPosY - fMinY; - for (FX_INT32 w = pLine->m_LineInfo.nBeginWordIndex; w <= pLine->m_LineInfo.nEndWordIndex; w++) { + for (int32_t w = pLine->m_LineInfo.nBeginWordIndex; w <= pLine->m_LineInfo.nEndWordIndex; w++) { if (CPVT_WordInfo * pWord = m_pSection->m_WordArray.GetAt(w)) { pWord->fWordX = fPosX - fMinX; if (pWord->pWordProps) { @@ -854,10 +854,10 @@ void CPDF_VariableText::ResetAll() m_bInitial = FALSE; ResetSectionArray(); } -CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WORD word, FX_INT32 charset, +CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WORD word, int32_t charset, const CPVT_WordProps * pWordProps) { - FX_INT32 nTotlaWords = this->GetTotalWords(); + int32_t nTotlaWords = this->GetTotalWords(); if (m_nLimitChar > 0 && nTotlaWords >= m_nLimitChar) { return place; } @@ -871,7 +871,7 @@ CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WO pNewProps->nFontIndex = GetWordFontIndex(word, charset, pWordProps->nFontIndex); return AddWord(newplace, CPVT_WordInfo(word, charset, -1, pNewProps)); } else { - FX_INT32 nFontIndex = GetSubWord() > 0 ? GetDefaultFontIndex() : GetWordFontIndex(word, charset, GetDefaultFontIndex()); + int32_t nFontIndex = GetSubWord() > 0 ? GetDefaultFontIndex() : GetWordFontIndex(word, charset, GetDefaultFontIndex()); return AddWord(newplace, CPVT_WordInfo(word, charset, nFontIndex, NULL)); } return place; @@ -879,7 +879,7 @@ CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WO CPVT_WordPlace CPDF_VariableText::InsertSection(const CPVT_WordPlace & place, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps) { - FX_INT32 nTotlaWords = this->GetTotalWords(); + int32_t nTotlaWords = this->GetTotalWords(); if (m_nLimitChar > 0 && nTotlaWords >= m_nLimitChar) { return place; } @@ -906,7 +906,7 @@ CPVT_WordPlace CPDF_VariableText::InsertSection(const CPVT_WordPlace & place, co AddSection(NewPlace, secinfo); newplace = NewPlace; if (CSection * pNewSection = m_SectionArray.GetAt(NewPlace.nSecIndex)) { - for (FX_INT32 w = wordplace.nWordIndex + 1, sz = pSection->m_WordArray.GetSize(); w < sz; w++) { + for (int32_t w = wordplace.nWordIndex + 1, sz = pSection->m_WordArray.GetSize(); w < sz; w++) { if (CPVT_WordInfo * pWord = pSection->m_WordArray.GetAt(w)) { NewPlace.nWordIndex++; pNewSection->AddWord(NewPlace, *pWord); @@ -917,12 +917,12 @@ CPVT_WordPlace CPDF_VariableText::InsertSection(const CPVT_WordPlace & place, co } return newplace; } -CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace & place, FX_LPCWSTR text, FX_INT32 charset, +CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace & place, FX_LPCWSTR text, int32_t charset, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pProps) { CFX_WideString swText = text; CPVT_WordPlace wp = place; - for (FX_INT32 i = 0, sz = swText.GetLength(); i < sz; i++) { + for (int32_t i = 0, sz = swText.GetLength(); i < sz; i++) { CPVT_WordPlace oldwp = wp; FX_WORD word = swText.GetAt(i); switch (word) { @@ -977,7 +977,7 @@ CPVT_WordPlace CPDF_VariableText::BackSpaceWord(const CPVT_WordPlace & place) { return ClearLeftWord(AjustLineHeader(place, TRUE)); } -void CPDF_VariableText::SetText(FX_LPCWSTR text, FX_INT32 charset, const CPVT_SecProps * pSecProps, +void CPDF_VariableText::SetText(FX_LPCWSTR text, int32_t charset, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps) { DeleteWords(CPVT_WordRange(GetBeginWordPlace(), GetEndWordPlace())); @@ -995,8 +995,8 @@ void CPDF_VariableText::SetText(FX_LPCWSTR text, FX_INT32 charset, const CPVT_Se if (CSection * pSection = m_SectionArray.GetAt(0)) { pSection->m_SecInfo = secinfo; } - FX_INT32 nCharCount = 0; - for (FX_INT32 i = 0, sz = swText.GetLength(); i < sz; i++) { + int32_t nCharCount = 0; + for (int32_t i = 0, sz = swText.GetLength(); i < sz; i++) { if (m_nLimitChar > 0 && nCharCount >= m_nLimitChar) { break; } @@ -1049,13 +1049,13 @@ void CPDF_VariableText::UpdateWordPlace(CPVT_WordPlace & place) const pSection->UpdateWordPlace(place); } } -FX_INT32 CPDF_VariableText::WordPlaceToWordIndex(const CPVT_WordPlace & place) const +int32_t CPDF_VariableText::WordPlaceToWordIndex(const CPVT_WordPlace & place) const { CPVT_WordPlace newplace = place; UpdateWordPlace(newplace); - FX_INT32 nIndex = 0; - FX_INT32 i = 0; - FX_INT32 sz = 0; + int32_t nIndex = 0; + int32_t i = 0; + int32_t sz = 0; for (i = 0, sz = m_SectionArray.GetSize(); i < sz && i < newplace.nSecIndex; i++) { if (CSection * pSection = m_SectionArray.GetAt(i)) { nIndex += pSection->m_WordArray.GetSize(); @@ -1069,12 +1069,12 @@ FX_INT32 CPDF_VariableText::WordPlaceToWordIndex(const CPVT_WordPlace & place) c } return nIndex; } -CPVT_WordPlace CPDF_VariableText::WordIndexToWordPlace(FX_INT32 index) const +CPVT_WordPlace CPDF_VariableText::WordIndexToWordPlace(int32_t index) const { CPVT_WordPlace place = GetBeginWordPlace(); - FX_INT32 nOldIndex = 0 , nIndex = 0; + int32_t nOldIndex = 0 , nIndex = 0; FX_BOOL bFind = FALSE; - for (FX_INT32 i = 0, sz = m_SectionArray.GetSize(); i < sz; i++) { + for (int32_t i = 0, sz = m_SectionArray.GetSize(); i < sz; i++) { if (CSection * pSection = m_SectionArray.GetAt(i)) { nIndex += pSection->m_WordArray.GetSize(); if (nIndex == index) { @@ -1156,9 +1156,9 @@ CPVT_WordPlace CPDF_VariableText::SearchWordPlace(const CPDF_Point & point) cons { CPDF_Point pt = OutToIn(point); CPVT_WordPlace place = GetBeginWordPlace(); - FX_INT32 nLeft = 0; - FX_INT32 nRight = m_SectionArray.GetSize() - 1; - FX_INT32 nMid = m_SectionArray.GetSize() / 2; + int32_t nLeft = 0; + int32_t nRight = m_SectionArray.GetSize() - 1; + int32_t nMid = m_SectionArray.GetSize() / 2; FX_BOOL bUp = TRUE; FX_BOOL bDown = TRUE; while (nLeft <= nRight) { @@ -1255,10 +1255,10 @@ CPVT_WordPlace CPDF_VariableText::GetSectionEndPlace(const CPVT_WordPlace & plac } return place; } -FX_INT32 CPDF_VariableText::GetTotalWords() const +int32_t CPDF_VariableText::GetTotalWords() const { - FX_INT32 nTotal = 0; - for (FX_INT32 i = 0, sz = m_SectionArray.GetSize(); i < sz; i++) + int32_t nTotal = 0; + for (int32_t i = 0, sz = m_SectionArray.GetSize(); i < sz; i++) if (CSection * pSection = m_SectionArray.GetAt(i)) { nTotal += (pSection->m_WordArray.GetSize() + PVT_RETURN_LENGTH); } @@ -1266,7 +1266,7 @@ FX_INT32 CPDF_VariableText::GetTotalWords() const } void CPDF_VariableText::ResetSectionArray() { - for (FX_INT32 s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { + for (int32_t s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { delete m_SectionArray.GetAt(s); } m_SectionArray.RemoveAll(); @@ -1276,7 +1276,7 @@ CPVT_WordPlace CPDF_VariableText::AddSection(const CPVT_WordPlace & place, const if (IsValid() && !m_bMultiLine) { return place; } - FX_INT32 nSecIndex = FPDF_MAX(FPDF_MIN(place.nSecIndex, m_SectionArray.GetSize()), 0); + int32_t nSecIndex = FPDF_MAX(FPDF_MIN(place.nSecIndex, m_SectionArray.GetSize()), 0); CSection * pSection = new CSection(this); pSection->m_SecInfo = secinfo; pSection->SecPlace.nSecIndex = nSecIndex; @@ -1355,13 +1355,13 @@ FX_FLOAT CPDF_VariableText::GetWordFontSize(const CPVT_WordInfo & WordInfo, FX_B { return m_bRichText && WordInfo.pWordProps ? (WordInfo.pWordProps->nScriptType == PVTWORD_SCRIPT_NORMAL || bFactFontSize ? WordInfo.pWordProps->fFontSize : WordInfo.pWordProps->fFontSize * PVT_HALF) : GetFontSize(); } -FX_INT32 CPDF_VariableText::GetWordFontIndex(const CPVT_WordInfo & WordInfo) +int32_t CPDF_VariableText::GetWordFontIndex(const CPVT_WordInfo & WordInfo) { return m_bRichText && WordInfo.pWordProps ? WordInfo.pWordProps->nFontIndex : WordInfo.nFontIndex; } -FX_FLOAT CPDF_VariableText::GetWordWidth(FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord, - FX_FLOAT fCharSpace, FX_INT32 nHorzScale, - FX_FLOAT fFontSize, FX_FLOAT fWordTail, FX_INT32 nWordStyle) +FX_FLOAT CPDF_VariableText::GetWordWidth(int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord, + FX_FLOAT fCharSpace, int32_t nHorzScale, + FX_FLOAT fFontSize, FX_FLOAT fWordTail, int32_t nWordStyle) { return (GetCharWidth(nFontIndex, Word, SubWord, nWordStyle) * fFontSize * PVT_FONTSCALE + fCharSpace) * nHorzScale * PVT_PERCENT + fWordTail; } @@ -1381,11 +1381,11 @@ FX_FLOAT CPDF_VariableText::GetLineDescent(const CPVT_SectionInfo & SecInfo) return m_bRichText && SecInfo.pWordProps ? GetFontDescent(SecInfo.pWordProps->nFontIndex, SecInfo.pWordProps->fFontSize) : GetFontDescent(GetDefaultFontIndex(), GetFontSize()); } -FX_FLOAT CPDF_VariableText::GetFontAscent(FX_INT32 nFontIndex, FX_FLOAT fFontSize) +FX_FLOAT CPDF_VariableText::GetFontAscent(int32_t nFontIndex, FX_FLOAT fFontSize) { return (FX_FLOAT)GetTypeAscent(nFontIndex) * fFontSize * PVT_FONTSCALE; } -FX_FLOAT CPDF_VariableText::GetFontDescent(FX_INT32 nFontIndex, FX_FLOAT fFontSize) +FX_FLOAT CPDF_VariableText::GetFontDescent(int32_t nFontIndex, FX_FLOAT fFontSize) { return (FX_FLOAT)GetTypeDescent(nFontIndex) * fFontSize * PVT_FONTSCALE; } @@ -1413,7 +1413,7 @@ FX_FLOAT CPDF_VariableText::GetLineIndent(const CPVT_SectionInfo & SecInfo) { return m_bRichText && SecInfo.pSecProps ? SecInfo.pSecProps->fLineIndent : 0.0f; } -FX_INT32 CPDF_VariableText::GetAlignment(const CPVT_SectionInfo& SecInfo) +int32_t CPDF_VariableText::GetAlignment(const CPVT_SectionInfo& SecInfo) { return m_bRichText && SecInfo.pSecProps ? SecInfo.pSecProps->nAlignment : this->m_nAlignment; } @@ -1421,7 +1421,7 @@ FX_FLOAT CPDF_VariableText::GetCharSpace(const CPVT_WordInfo & WordInfo) { return m_bRichText && WordInfo.pWordProps ? WordInfo.pWordProps->fCharSpace : m_fCharSpace; } -FX_INT32 CPDF_VariableText::GetHorzScale(const CPVT_WordInfo & WordInfo) +int32_t CPDF_VariableText::GetHorzScale(const CPVT_WordInfo & WordInfo) { return m_bRichText && WordInfo.pWordProps ? WordInfo.pWordProps->nHorzScale : m_nHorzScale; } @@ -1429,7 +1429,7 @@ void CPDF_VariableText::ClearSectionRightWords(const CPVT_WordPlace & place) { CPVT_WordPlace wordplace = AjustLineHeader(place, TRUE); if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { - for (FX_INT32 w = pSection->m_WordArray.GetSize() - 1; w > wordplace.nWordIndex; w--) { + for (int32_t w = pSection->m_WordArray.GetSize() - 1; w > wordplace.nWordIndex; w--) { delete pSection->m_WordArray.GetAt(w); pSection->m_WordArray.RemoveAt(w); } @@ -1463,7 +1463,7 @@ FX_BOOL CPDF_VariableText::ClearEmptySection(const CPVT_WordPlace & place) void CPDF_VariableText::ClearEmptySections(const CPVT_WordRange & PlaceRange) { CPVT_WordPlace wordplace; - for (FX_INT32 s = PlaceRange.EndPos.nSecIndex; s > PlaceRange.BeginPos.nSecIndex; s--) { + for (int32_t s = PlaceRange.EndPos.nSecIndex; s > PlaceRange.BeginPos.nSecIndex; s--) { wordplace.nSecIndex = s; ClearEmptySection(wordplace); } @@ -1473,7 +1473,7 @@ void CPDF_VariableText::LinkLatterSection(const CPVT_WordPlace & place) CPVT_WordPlace oldplace = AjustLineHeader(place, TRUE); if (CSection * pNextSection = m_SectionArray.GetAt(place.nSecIndex + 1)) { if (CSection * pSection = m_SectionArray.GetAt(oldplace.nSecIndex)) { - for (FX_INT32 w = 0, sz = pNextSection->m_WordArray.GetSize(); w < sz; w++) { + for (int32_t w = 0, sz = pNextSection->m_WordArray.GetSize(); w < sz; w++) { if (CPVT_WordInfo * pWord = pNextSection->m_WordArray.GetAt(w)) { oldplace.nWordIndex ++; pSection->AddWord(oldplace, *pWord); @@ -1489,7 +1489,7 @@ void CPDF_VariableText::ClearWords(const CPVT_WordRange & PlaceRange) CPVT_WordRange NewRange; NewRange.BeginPos = AjustLineHeader(PlaceRange.BeginPos, TRUE); NewRange.EndPos = AjustLineHeader(PlaceRange.EndPos, TRUE); - for (FX_INT32 s = NewRange.EndPos.nSecIndex; s >= NewRange.BeginPos.nSecIndex; s--) { + for (int32_t s = NewRange.EndPos.nSecIndex; s >= NewRange.BeginPos.nSecIndex; s--) { if (CSection * pSection = m_SectionArray.GetAt(s)) { pSection->ClearWords(NewRange); } @@ -1552,7 +1552,7 @@ CPVT_FloatRect CPDF_VariableText::Rearrange(const CPVT_WordRange & PlaceRange) } FX_FLOAT CPDF_VariableText::GetAutoFontSize() { - FX_INT32 nTotal = sizeof(gFontSizeSteps) / sizeof(FX_BYTE); + int32_t nTotal = sizeof(gFontSizeSteps) / sizeof(uint8_t); if (IsMultiLine()) { nTotal /= 4; } @@ -1562,9 +1562,9 @@ FX_FLOAT CPDF_VariableText::GetAutoFontSize() if (GetPlateWidth() <= 0) { return 0; } - FX_INT32 nLeft = 0; - FX_INT32 nRight = nTotal - 1; - FX_INT32 nMid = nTotal / 2; + int32_t nLeft = 0; + int32_t nRight = nTotal - 1; + int32_t nMid = nTotal / 2; while (nLeft <= nRight) { if (IsBigger(gFontSizeSteps[nMid])) { nRight = nMid - 1; @@ -1582,7 +1582,7 @@ FX_BOOL CPDF_VariableText::IsBigger(FX_FLOAT fFontSize) { FX_BOOL bBigger = FALSE; CPVT_Size szTotal; - for (FX_INT32 s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { + for (int32_t s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { if (CSection * pSection = m_SectionArray.GetAt(s)) { CPVT_Size size = pSection->GetSectionSize(fFontSize); szTotal.x = FPDF_MAX(size.x, szTotal.x); @@ -1602,10 +1602,10 @@ CPVT_FloatRect CPDF_VariableText::RearrangeSections(const CPVT_WordRange & Place CPVT_WordPlace place; FX_FLOAT fPosY = 0; FX_FLOAT fOldHeight; - FX_INT32 nSSecIndex = PlaceRange.BeginPos.nSecIndex; - FX_INT32 nESecIndex = PlaceRange.EndPos.nSecIndex; + int32_t nSSecIndex = PlaceRange.BeginPos.nSecIndex; + int32_t nESecIndex = PlaceRange.EndPos.nSecIndex; CPVT_FloatRect rcRet; - for (FX_INT32 s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { + for (int32_t s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { place.nSecIndex = s; if (CSection * pSection = m_SectionArray.GetAt(s)) { pSection->SecPlace = place; @@ -1636,7 +1636,7 @@ CPVT_FloatRect CPDF_VariableText::RearrangeSections(const CPVT_WordRange & Place } return rcRet; } -FX_INT32 CPDF_VariableText::GetCharWidth(FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord, FX_INT32 nWordStyle) +int32_t CPDF_VariableText::GetCharWidth(int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord, int32_t nWordStyle) { if (m_pVTProvider) { if (SubWord > 0) { @@ -1647,19 +1647,19 @@ FX_INT32 CPDF_VariableText::GetCharWidth(FX_INT32 nFontIndex, FX_WORD Word, FX_W } return 0; } -FX_INT32 CPDF_VariableText::GetTypeAscent(FX_INT32 nFontIndex) +int32_t CPDF_VariableText::GetTypeAscent(int32_t nFontIndex) { return m_pVTProvider ? m_pVTProvider->GetTypeAscent(nFontIndex) : 0; } -FX_INT32 CPDF_VariableText::GetTypeDescent(FX_INT32 nFontIndex) +int32_t CPDF_VariableText::GetTypeDescent(int32_t nFontIndex) { return m_pVTProvider ? m_pVTProvider->GetTypeDescent(nFontIndex) : 0; } -FX_INT32 CPDF_VariableText::GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex) +int32_t CPDF_VariableText::GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex) { return m_pVTProvider ? m_pVTProvider->GetWordFontIndex(word, charset, nFontIndex) : -1; } -FX_INT32 CPDF_VariableText::GetDefaultFontIndex() +int32_t CPDF_VariableText::GetDefaultFontIndex() { return m_pVTProvider ? m_pVTProvider->GetDefaultFontIndex() : -1; } @@ -1688,7 +1688,7 @@ CPDF_VariableText_Iterator::CPDF_VariableText_Iterator(CPDF_VariableText * pVT): CPDF_VariableText_Iterator::~CPDF_VariableText_Iterator() { } -void CPDF_VariableText_Iterator::SetAt(FX_INT32 nWordIndex) +void CPDF_VariableText_Iterator::SetAt(int32_t nWordIndex) { ASSERT(m_pVT != NULL); m_CurPos = m_pVT->WordIndexToWordPlace(nWordIndex); diff --git a/core/src/fpdfdoc/pdf_vt.h b/core/src/fpdfdoc/pdf_vt.h index 4062bf979d..662748fa6f 100644 --- a/core/src/fpdfdoc/pdf_vt.h +++ b/core/src/fpdfdoc/pdf_vt.h @@ -118,7 +118,7 @@ struct CPVT_SectionInfo { } } CPVT_FloatRect rcSection; - FX_INT32 nTotalLine; + int32_t nTotalLine; CPVT_SecProps* pSecProps; CPVT_WordProps* pWordProps; }; @@ -127,9 +127,9 @@ struct CPVT_LineInfo { fLineX(0.0f), fLineY(0.0f), fLineWidth(0.0f), fLineAscent(0.0f), fLineDescent(0.0f) { } - FX_INT32 nTotalWord; - FX_INT32 nBeginWordIndex; - FX_INT32 nEndWordIndex; + int32_t nTotalWord; + int32_t nBeginWordIndex; + int32_t nEndWordIndex; FX_FLOAT fLineX; FX_FLOAT fLineY; FX_FLOAT fLineWidth; @@ -141,7 +141,7 @@ struct CPVT_WordInfo { fWordX(0.0f), fWordY(0.0f), fWordTail(0.0f), nFontIndex(-1), pWordProps(NULL) { } - CPVT_WordInfo(FX_WORD word, FX_INT32 charset, FX_INT32 fontIndex, CPVT_WordProps * pProps): + CPVT_WordInfo(FX_WORD word, int32_t charset, int32_t fontIndex, CPVT_WordProps * pProps): Word(word), nCharset(charset), fWordX(0.0f), fWordY(0.0f), fWordTail(0.0f), nFontIndex(fontIndex), pWordProps(pProps) { @@ -174,11 +174,11 @@ struct CPVT_WordInfo { } } FX_WORD Word; - FX_INT32 nCharset; + int32_t nCharset; FX_FLOAT fWordX; FX_FLOAT fWordY; FX_FLOAT fWordTail; - FX_INT32 nFontIndex; + int32_t nFontIndex; CPVT_WordProps* pWordProps; }; struct CPVT_FloatRange { @@ -235,11 +235,11 @@ public: { RemoveAll(); } - FX_INT32 GetSize() const + int32_t GetSize() const { return m_Lines.GetSize(); } - CLine * GetAt(FX_INT32 nIndex) const + CLine * GetAt(int32_t nIndex) const { return m_Lines.GetAt(nIndex); } @@ -249,13 +249,13 @@ public: } void RemoveAll() { - for (FX_INT32 i = 0, sz = GetSize(); i < sz; i++) { + for (int32_t i = 0, sz = GetSize(); i < sz; i++) { delete GetAt(i); } m_Lines.RemoveAll(); m_nTotal = 0; } - FX_INT32 Add(const CPVT_LineInfo & lineinfo) + int32_t Add(const CPVT_LineInfo & lineinfo) { if (m_nTotal >= GetSize()) { CLine* pLine = new CLine; @@ -268,14 +268,14 @@ public: } void Clear() { - for (FX_INT32 i = GetSize() - 1; i >= m_nTotal; i--) { + for (int32_t i = GetSize() - 1; i >= m_nTotal; i--) { delete GetAt(i); m_Lines.RemoveAt(i); } } private: CPVT_ArrayTemplate m_Lines; - FX_INT32 m_nTotal; + int32_t m_nTotal; }; class CSection { @@ -307,9 +307,9 @@ public: CLines m_LineArray; CPVT_ArrayTemplate m_WordArray; private: - void ClearLeftWords(FX_INT32 nWordIndex); - void ClearRightWords(FX_INT32 nWordIndex); - void ClearMidWords(FX_INT32 nBeginIndex, FX_INT32 nEndIndex); + void ClearLeftWords(int32_t nWordIndex); + void ClearRightWords(int32_t nWordIndex); + void ClearMidWords(int32_t nBeginIndex, int32_t nEndIndex); CPDF_VariableText *m_pVT; }; @@ -409,7 +409,7 @@ public: { CPDF_EditContainer::SetPlateRect(rect); } - void SetAlignment(FX_INT32 nFormat = 0) + void SetAlignment(int32_t nFormat = 0) { m_nAlignment = nFormat; } @@ -417,7 +417,7 @@ public: { m_wSubWord = wSubWord; } - void SetLimitChar(FX_INT32 nLimitChar = 0) + void SetLimitChar(int32_t nLimitChar = 0) { m_nLimitChar = nLimitChar; } @@ -425,7 +425,7 @@ public: { m_fCharSpace = fCharSpace; } - void SetHorzScale(FX_INT32 nHorzScale = 100) + void SetHorzScale(int32_t nHorzScale = 100) { m_nHorzScale = nHorzScale; } @@ -441,7 +441,7 @@ public: { m_fFontSize = fFontSize; } - void SetCharArray(FX_INT32 nCharArray = 0) + void SetCharArray(int32_t nCharArray = 0) { m_nCharArray = nCharArray; } @@ -469,13 +469,13 @@ public: void RearrangeAll(); void RearrangePart(const CPVT_WordRange & PlaceRange); void ResetAll(); - void SetText(FX_LPCWSTR text, FX_INT32 charset = 1, const CPVT_SecProps * pSecProps = NULL, + void SetText(FX_LPCWSTR text, int32_t charset = 1, const CPVT_SecProps * pSecProps = NULL, const CPVT_WordProps * pWordProps = NULL); - CPVT_WordPlace InsertWord(const CPVT_WordPlace & place, FX_WORD word, FX_INT32 charset = 1, + CPVT_WordPlace InsertWord(const CPVT_WordPlace & place, FX_WORD word, int32_t charset = 1, const CPVT_WordProps * pWordProps = NULL); CPVT_WordPlace InsertSection(const CPVT_WordPlace & place, const CPVT_SecProps * pSecProps = NULL, const CPVT_WordProps * pWordProps = NULL); - CPVT_WordPlace InsertText(const CPVT_WordPlace & place, FX_LPCWSTR text, FX_INT32 charset = 1, + CPVT_WordPlace InsertText(const CPVT_WordPlace & place, FX_LPCWSTR text, int32_t charset = 1, const CPVT_SecProps * pSecProps = NULL, const CPVT_WordProps * pWordProps = NULL); CPVT_WordPlace DeleteWords(const CPVT_WordRange & PlaceRange); CPVT_WordPlace DeleteWord(const CPVT_WordPlace & place); @@ -485,20 +485,20 @@ public: return CPDF_EditContainer::GetPlateRect(); } CPDF_Rect GetContentRect() const; - FX_INT32 GetTotalWords() const; + int32_t GetTotalWords() const; FX_FLOAT GetFontSize() const { return m_fFontSize; } - FX_INT32 GetAlignment() const + int32_t GetAlignment() const { return m_nAlignment; } - FX_INT32 GetCharArray() const + int32_t GetCharArray() const { return m_nCharArray; } - FX_INT32 GetLimitChar() const + int32_t GetLimitChar() const { return m_nLimitChar; } @@ -506,7 +506,7 @@ public: { return m_bMultiLine; } - FX_INT32 GetHorzScale() const + int32_t GetHorzScale() const { return m_nHorzScale; } @@ -527,8 +527,8 @@ public: CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace & place) const; CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace & place) const; void UpdateWordPlace(CPVT_WordPlace & place) const; - FX_INT32 WordPlaceToWordIndex(const CPVT_WordPlace & place) const; - CPVT_WordPlace WordIndexToWordPlace(FX_INT32 index) const; + int32_t WordPlaceToWordIndex(const CPVT_WordPlace & place) const; + CPVT_WordPlace WordIndexToWordPlace(int32_t index) const; FX_WORD GetPasswordChar() const { return GetSubWord(); @@ -538,11 +538,11 @@ public: return m_wSubWord; } private: - FX_INT32 GetCharWidth(FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord, FX_INT32 nWordStyle); - FX_INT32 GetTypeAscent(FX_INT32 nFontIndex); - FX_INT32 GetTypeDescent(FX_INT32 nFontIndex); - FX_INT32 GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex); - FX_INT32 GetDefaultFontIndex(); + int32_t GetCharWidth(int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord, int32_t nWordStyle); + int32_t GetTypeAscent(int32_t nFontIndex); + int32_t GetTypeDescent(int32_t nFontIndex); + int32_t GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex); + int32_t GetDefaultFontIndex(); FX_BOOL IsLatinWord(FX_WORD word); private: @@ -554,9 +554,9 @@ private: FX_BOOL GetLineInfo(const CPVT_WordPlace & place, CPVT_LineInfo & lineinfo); FX_BOOL GetSectionInfo(const CPVT_WordPlace & place, CPVT_SectionInfo & secinfo); FX_FLOAT GetWordFontSize(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize = FALSE); - FX_FLOAT GetWordWidth(FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord, - FX_FLOAT fCharSpace, FX_INT32 nHorzScale, - FX_FLOAT fFontSize, FX_FLOAT fWordTail, FX_INT32 nWordStyle); + FX_FLOAT GetWordWidth(int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord, + FX_FLOAT fCharSpace, int32_t nHorzScale, + FX_FLOAT fFontSize, FX_FLOAT fWordTail, int32_t nWordStyle); FX_FLOAT GetWordWidth(const CPVT_WordInfo & WordInfo); FX_FLOAT GetWordAscent(const CPVT_WordInfo & WordInfo, FX_FLOAT fFontSize); FX_FLOAT GetWordDescent(const CPVT_WordInfo & WordInfo, FX_FLOAT fFontSize); @@ -564,14 +564,14 @@ private: FX_FLOAT GetWordDescent(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize = FALSE); FX_FLOAT GetLineAscent(const CPVT_SectionInfo & SecInfo); FX_FLOAT GetLineDescent(const CPVT_SectionInfo & SecInfo); - FX_FLOAT GetFontAscent(FX_INT32 nFontIndex, FX_FLOAT fFontSize); - FX_FLOAT GetFontDescent(FX_INT32 nFontIndex, FX_FLOAT fFontSize); - FX_INT32 GetWordFontIndex(const CPVT_WordInfo & WordInfo); + FX_FLOAT GetFontAscent(int32_t nFontIndex, FX_FLOAT fFontSize); + FX_FLOAT GetFontDescent(int32_t nFontIndex, FX_FLOAT fFontSize); + int32_t GetWordFontIndex(const CPVT_WordInfo & WordInfo); FX_FLOAT GetCharSpace(const CPVT_WordInfo & WordInfo); - FX_INT32 GetHorzScale(const CPVT_WordInfo & WordInfo); + int32_t GetHorzScale(const CPVT_WordInfo & WordInfo); FX_FLOAT GetLineLeading(const CPVT_SectionInfo & SecInfo); FX_FLOAT GetLineIndent(const CPVT_SectionInfo & SecInfo); - FX_INT32 GetAlignment(const CPVT_SectionInfo& SecInfo); + int32_t GetAlignment(const CPVT_SectionInfo& SecInfo); void ClearSectionRightWords(const CPVT_WordPlace & place); CPVT_WordPlace AjustLineHeader(const CPVT_WordPlace & place, FX_BOOL bPrevOrNext) const; @@ -590,15 +590,15 @@ private: void ResetSectionArray(); private: CPVT_ArrayTemplate m_SectionArray; - FX_INT32 m_nLimitChar; - FX_INT32 m_nCharArray; + int32_t m_nLimitChar; + int32_t m_nCharArray; FX_BOOL m_bMultiLine; FX_BOOL m_bLimitWidth; FX_BOOL m_bAutoFontSize; - FX_INT32 m_nAlignment; + int32_t m_nAlignment; FX_FLOAT m_fLineLeading; FX_FLOAT m_fCharSpace; - FX_INT32 m_nHorzScale; + int32_t m_nHorzScale; FX_WORD m_wSubWord; FX_FLOAT m_fFontSize; @@ -624,7 +624,7 @@ public: FX_BOOL GetLine(CPVT_Line & line) const; FX_BOOL GetSection(CPVT_Section & section) const; FX_BOOL SetSection(const CPVT_Section & section); - void SetAt(FX_INT32 nWordIndex); + void SetAt(int32_t nWordIndex); void SetAt(const CPVT_WordPlace & place); const CPVT_WordPlace & GetAt() const { diff --git a/core/src/fpdftext/fpdf_text.cpp b/core/src/fpdftext/fpdf_text.cpp index e58b50d182..fbd6860afb 100644 --- a/core/src/fpdftext/fpdf_text.cpp +++ b/core/src/fpdftext/fpdf_text.cpp @@ -75,7 +75,7 @@ void CTextPage::ProcessObject(CPDF_PageObject* pObject) CFX_AffineMatrix matrix; pText->GetTextMatrix(&matrix); for (int i = 0; i < pText->m_nChars; i ++) { - FX_DWORD charcode = pText->m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)pText->m_pCharCodes : pText->m_pCharCodes[i]; + FX_DWORD charcode = pText->m_nChars == 1 ? (FX_DWORD)(uintptr_t)pText->m_pCharCodes : pText->m_pCharCodes[i]; if (charcode == (FX_DWORD) - 1) { continue; } @@ -113,7 +113,7 @@ void CTextPage::ProcessObject(CPDF_PageObject* pObject) int space_count = 0; FX_FLOAT last_left = 0, last_right = 0, segment_left = 0, segment_right = 0; for (int i = 0; i < pText->m_nChars; i ++) { - FX_DWORD charcode = pText->m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)pText->m_pCharCodes : pText->m_pCharCodes[i]; + FX_DWORD charcode = pText->m_nChars == 1 ? (FX_DWORD)(uintptr_t)pText->m_pCharCodes : pText->m_pCharCodes[i]; if (charcode == (FX_DWORD) - 1) { continue; } @@ -311,11 +311,11 @@ void NormalizeString(CFX_WideString& str) } CFX_WordArray order; FX_BOOL bR2L = FALSE; - FX_INT32 start = 0, count = 0, i = 0; + int32_t start = 0, count = 0, i = 0; int nR2L = 0, nL2R = 0; for (i = 0; i < str.GetLength(); i++) { if(BidiChar->AppendChar(str.GetAt(i))) { - FX_INT32 ret = BidiChar->GetBidiInfo(start, count); + int32_t ret = BidiChar->GetBidiInfo(start, count); order.Add(start); order.Add(count); order.Add(ret); @@ -329,7 +329,7 @@ void NormalizeString(CFX_WideString& str) } } if(BidiChar->EndChar()) { - FX_INT32 ret = BidiChar->GetBidiInfo(start, count); + int32_t ret = BidiChar->GetBidiInfo(start, count); order.Add(start); order.Add(count); order.Add(ret); diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp index 69d0bc574f..f5fa3d4921 100644 --- a/core/src/fpdftext/fpdf_text_int.cpp +++ b/core/src/fpdftext/fpdf_text_int.cpp @@ -649,7 +649,7 @@ void CPDF_TextPage::GetCharInfo(int index, FPDF_CHAR_INFO & info) const info.m_Matrix.Copy(charinfo.m_Matrix); return; } -void CPDF_TextPage::CheckMarkedContentObject(FX_INT32& start, FX_INT32& nCount) const +void CPDF_TextPage::CheckMarkedContentObject(int32_t& start, int32_t& nCount) const { PAGECHAR_INFO charinfo = *(PAGECHAR_INFO*)m_charList.GetAt(start); PAGECHAR_INFO charinfo2 = *(PAGECHAR_INFO*)m_charList.GetAt(start + nCount - 1); @@ -960,24 +960,24 @@ int CPDF_TextPage::GetWordBreak(int index, int direction) const } return breakPos; } -FX_INT32 CPDF_TextPage::FindTextlineFlowDirection() +int32_t CPDF_TextPage::FindTextlineFlowDirection() { if (!m_pPage) { return -1; } - const FX_INT32 nPageWidth = (FX_INT32)((CPDF_Page*)m_pPage)->GetPageWidth(); - const FX_INT32 nPageHeight = (FX_INT32)((CPDF_Page*)m_pPage)->GetPageHeight(); + const int32_t nPageWidth = (int32_t)((CPDF_Page*)m_pPage)->GetPageWidth(); + const int32_t nPageHeight = (int32_t)((CPDF_Page*)m_pPage)->GetPageHeight(); CFX_ByteArray nHorizontalMask; if (!nHorizontalMask.SetSize(nPageWidth)) { return -1; } - FX_BYTE* pDataH = nHorizontalMask.GetData(); + uint8_t* pDataH = nHorizontalMask.GetData(); CFX_ByteArray nVerticalMask; if (!nVerticalMask.SetSize(nPageHeight)) { return -1; } - FX_BYTE* pDataV = nVerticalMask.GetData(); - FX_INT32 index = 0; + uint8_t* pDataV = nVerticalMask.GetData(); + int32_t index = 0; FX_FLOAT fLineHeight = 0.0f; CPDF_PageObject* pPageObj = NULL; FX_POSITION pos = NULL; @@ -993,10 +993,10 @@ FX_INT32 CPDF_TextPage::FindTextlineFlowDirection() if(PDFPAGE_TEXT != pPageObj->m_Type) { continue; } - FX_INT32 minH = (FX_INT32)pPageObj->m_Left < 0 ? 0 : (FX_INT32)pPageObj->m_Left; - FX_INT32 maxH = (FX_INT32)pPageObj->m_Right > nPageWidth ? nPageWidth : (FX_INT32)pPageObj->m_Right; - FX_INT32 minV = (FX_INT32)pPageObj->m_Bottom < 0 ? 0 : (FX_INT32)pPageObj->m_Bottom; - FX_INT32 maxV = (FX_INT32)pPageObj->m_Top > nPageHeight ? nPageHeight : (FX_INT32)pPageObj->m_Top; + int32_t minH = (int32_t)pPageObj->m_Left < 0 ? 0 : (int32_t)pPageObj->m_Left; + int32_t maxH = (int32_t)pPageObj->m_Right > nPageWidth ? nPageWidth : (int32_t)pPageObj->m_Right; + int32_t minV = (int32_t)pPageObj->m_Bottom < 0 ? 0 : (int32_t)pPageObj->m_Bottom; + int32_t maxV = (int32_t)pPageObj->m_Top > nPageHeight ? nPageHeight : (int32_t)pPageObj->m_Top; if (minH >= maxH || minV >= maxV) { continue; } @@ -1007,8 +1007,8 @@ FX_INT32 CPDF_TextPage::FindTextlineFlowDirection() } pPageObj = NULL; } - FX_INT32 nStartH = 0; - FX_INT32 nEndH = 0; + int32_t nStartH = 0; + int32_t nEndH = 0; FX_FLOAT nSumH = 0.0f; for (index = 0; index < nPageWidth; index++) if(1 == nHorizontalMask[index]) { @@ -1024,8 +1024,8 @@ FX_INT32 CPDF_TextPage::FindTextlineFlowDirection() nSumH += nHorizontalMask[index]; } nSumH /= nEndH - nStartH; - FX_INT32 nStartV = 0; - FX_INT32 nEndV = 0; + int32_t nStartV = 0; + int32_t nEndV = 0; FX_FLOAT nSumV = 0.0f; for (index = 0; index < nPageHeight; index++) if(1 == nVerticalMask[index]) { @@ -1041,10 +1041,10 @@ FX_INT32 CPDF_TextPage::FindTextlineFlowDirection() nSumV += nVerticalMask[index]; } nSumV /= nEndV - nStartV; - if ((nEndV - nStartV) < (FX_INT32)(2 * fLineHeight)) { + if ((nEndV - nStartV) < (int32_t)(2 * fLineHeight)) { return 0; } - if ((nEndH - nStartH) < (FX_INT32)(2 * fLineHeight)) { + if ((nEndH - nStartH) < (int32_t)(2 * fLineHeight)) { return 1; } if (nSumH > 0.8f) { @@ -1138,8 +1138,8 @@ int CPDF_TextPage::GetCharWidth(FX_DWORD charCode, CPDF_Font* pFont) const } void CPDF_TextPage::OnPiece(IFX_BidiChar* pBidi, CFX_WideString& str) { - FX_INT32 start, count; - FX_INT32 ret = pBidi->GetBidiInfo(start, count); + int32_t start, count; + int32_t ret = pBidi->GetBidiInfo(start, count); if(ret == 2) { for(int i = start + count - 1; i >= start; i--) { m_TextBuf.AppendChar(str.GetAt(i)); @@ -1229,7 +1229,7 @@ void CPDF_TextPage::CloseTempLine() CFX_WideString str = m_TempTextBuf.GetWideString(); CFX_WordArray order; FX_BOOL bR2L = FALSE; - FX_INT32 start = 0, count = 0; + int32_t start = 0, count = 0; int nR2L = 0, nL2R = 0; FX_BOOL bPrevSpace = FALSE; for (int i = 0; i < str.GetLength(); i++) { @@ -1247,7 +1247,7 @@ void CPDF_TextPage::CloseTempLine() bPrevSpace = FALSE; } if(BidiChar && BidiChar->AppendChar(str.GetAt(i))) { - FX_INT32 ret = BidiChar->GetBidiInfo(start, count); + int32_t ret = BidiChar->GetBidiInfo(start, count); order.Add(start); order.Add(count); order.Add(ret); @@ -1261,7 +1261,7 @@ void CPDF_TextPage::CloseTempLine() } } if(BidiChar && BidiChar->EndChar()) { - FX_INT32 ret = BidiChar->GetBidiInfo(start, count); + int32_t ret = BidiChar->GetBidiInfo(start, count); order.Add(start); order.Add(count); order.Add(ret); @@ -1435,7 +1435,7 @@ void CPDF_TextPage::ProcessTextObject(CPDF_TextObject* pTextObj, const CFX_Affin m_LineObj.Add(Obj); } } -FX_INT32 CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) +int32_t CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) { CPDF_TextObject* pTextObj = Obj.m_pTextObj; CPDF_ContentMarkData* pMarkData = (CPDF_ContentMarkData*)pTextObj->m_ContentMark.GetObject(); @@ -1595,7 +1595,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) CFX_AffineMatrix matrix; pTextObj->GetTextMatrix(&matrix); matrix.Concat(formMatrix); - FX_INT32 bPreMKC = PreMarkedContent(Obj); + int32_t bPreMKC = PreMarkedContent(Obj); if (FPDFTEXT_MC_DONE == bPreMKC) { m_pPreTextObj = pTextObj; m_perMatrix.Copy(formMatrix); @@ -1642,7 +1642,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) } } } else if (result == 3 && !m_ParseOptions.m_bOutputHyphen) { - FX_INT32 nChars = pTextObj->CountChars(); + int32_t nChars = pTextObj->CountChars(); if (nChars == 1) { CPDF_TextObjectItem item; pTextObj->GetCharInfo(0, &item); @@ -1682,8 +1682,8 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) const FX_BOOL bR2L = IsRightToLeft(pTextObj, pFont, nItems); const FX_BOOL bIsBidiAndMirrorInverse = bR2L && (matrix.a * matrix.d - matrix.b * matrix.c) < 0; - FX_INT32 iBufStartAppend = m_TempTextBuf.GetLength(); - FX_INT32 iCharListStartAppend = m_TempCharList.GetSize(); + int32_t iBufStartAppend = m_TempTextBuf.GetLength(); + int32_t iCharListStartAppend = m_TempCharList.GetSize(); FX_FLOAT spacing = 0; for (int i = 0; i < nItems; i++) { @@ -1830,10 +1830,10 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) SwapTempTextBuf(iCharListStartAppend, iBufStartAppend); } } -void CPDF_TextPage::SwapTempTextBuf(FX_INT32 iCharListStartAppend, - FX_INT32 iBufStartAppend) +void CPDF_TextPage::SwapTempTextBuf(int32_t iCharListStartAppend, + int32_t iBufStartAppend) { - FX_INT32 i, j; + int32_t i, j; i = iCharListStartAppend; j = m_TempCharList.GetSize() - 1; for (; i < j; i++, j--) { @@ -1852,11 +1852,11 @@ FX_BOOL CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj, int nItems) const { IFX_BidiChar* BidiChar = IFX_BidiChar::Create(); - FX_INT32 nR2L = 0; - FX_INT32 nL2R = 0; - FX_INT32 start = 0, count = 0; + int32_t nR2L = 0; + int32_t nL2R = 0; + int32_t start = 0, count = 0; CPDF_TextObjectItem item; - for (FX_INT32 i = 0; i < nItems; i++) { + for (int32_t i = 0; i < nItems; i++) { pTextObj->GetItemInfo(i, &item); if (item.m_CharCode == (FX_DWORD)-1) { continue; @@ -1870,7 +1870,7 @@ FX_BOOL CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj, continue; } if (BidiChar && BidiChar->AppendChar(wChar)) { - FX_INT32 ret = BidiChar->GetBidiInfo(start, count); + int32_t ret = BidiChar->GetBidiInfo(start, count); if (ret == 2) { nR2L++; } @@ -1880,7 +1880,7 @@ FX_BOOL CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj, } } if (BidiChar && BidiChar->EndChar()) { - FX_INT32 ret = BidiChar->GetBidiInfo(start, count); + int32_t ret = BidiChar->GetBidiInfo(start, count); if (ret == 2) { nR2L++; } @@ -1892,9 +1892,9 @@ FX_BOOL CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj, BidiChar->Release(); return (nR2L > 0 && nR2L >= nL2R); } -FX_INT32 CPDF_TextPage::GetTextObjectWritingMode(const CPDF_TextObject* pTextObj) +int32_t CPDF_TextPage::GetTextObjectWritingMode(const CPDF_TextObject* pTextObj) { - FX_INT32 nChars = pTextObj->CountChars(); + int32_t nChars = pTextObj->CountChars(); if (nChars == 1) { return m_TextlineDir; } @@ -2058,7 +2058,7 @@ int CPDF_TextPage::ProcessInsertObject(const CPDF_TextObject* pObj, const CFX_Af } return 2; } - FX_INT32 nChars = pObj->CountChars(); + int32_t nChars = pObj->CountChars(); if (nChars == 1 && ( 0x2D == curChar || 0xAD == curChar)) if (IsHyphen(curChar)) { return 3; diff --git a/core/src/fpdftext/fpdf_text_search.cpp b/core/src/fpdftext/fpdf_text_search.cpp index bfd742f1ab..89e132991d 100644 --- a/core/src/fpdftext/fpdf_text_search.cpp +++ b/core/src/fpdftext/fpdf_text_search.cpp @@ -266,14 +266,14 @@ FX_BOOL CPDF_TextStream::ProcessObject(const CPDF_TextObject* pObj, FX_BOOL bFir m_Buffer.AppendChar((FX_WCHAR)item.m_CharCode); if (m_pObjArray) { m_pObjArray->Add((void*)pObj); - m_pObjArray->Add((void*)(FX_INTPTR)item_index); + m_pObjArray->Add((void*)(intptr_t)item_index); } } else { m_Buffer << unicode_str; if (m_pObjArray) { for (int i = 0; i < unicode_str.GetLength(); i ++) { m_pObjArray->Add((void*)pObj); - m_pObjArray->Add((void*)(FX_INTPTR)item_index); + m_pObjArray->Add((void*)(intptr_t)item_index); } } } diff --git a/core/src/fpdftext/text_int.h b/core/src/fpdftext/text_int.h index 01d10236fc..70c53d909f 100644 --- a/core/src/fpdftext/text_int.h +++ b/core/src/fpdftext/text_int.h @@ -33,7 +33,7 @@ typedef struct _PAGECHAR_INFO { FX_WCHAR m_Unicode; FX_FLOAT m_OriginX; FX_FLOAT m_OriginY; - FX_INT32 m_Flag; + int32_t m_Flag; CFX_FloatRect m_CharBox; CPDF_TextObject* m_pTextObj; CFX_AffineMatrix m_Matrix; @@ -108,16 +108,16 @@ private: int GetCharWidth(FX_DWORD charCode, CPDF_Font* pFont) const; void CloseTempLine(); void OnPiece(IFX_BidiChar* pBidi, CFX_WideString& str); - FX_INT32 PreMarkedContent(PDFTEXT_Obj pObj); + int32_t PreMarkedContent(PDFTEXT_Obj pObj); void ProcessMarkedContent(PDFTEXT_Obj pObj); - void CheckMarkedContentObject(FX_INT32& start, FX_INT32& nCount) const; + void CheckMarkedContentObject(int32_t& start, int32_t& nCount) const; void FindPreviousTextObject(void); void AddCharInfoByLRDirection(CFX_WideString& str, int i); void AddCharInfoByRLDirection(CFX_WideString& str, int i); - FX_INT32 GetTextObjectWritingMode(const CPDF_TextObject* pTextObj); - FX_INT32 FindTextlineFlowDirection(); - void SwapTempTextBuf(FX_INT32 iCharListStartAppend, - FX_INT32 iBufStartAppend); + int32_t GetTextObjectWritingMode(const CPDF_TextObject* pTextObj); + int32_t FindTextlineFlowDirection(); + void SwapTempTextBuf(int32_t iCharListStartAppend, + int32_t iBufStartAppend); FX_BOOL IsRightToLeft(const CPDF_TextObject* pTextObj, const CPDF_Font* pFont, int nItems) const; diff --git a/core/src/fxcodec/codec/codec_int.h b/core/src/fxcodec/codec/codec_int.h index 2b693e88b6..d39a1fd18a 100644 --- a/core/src/fxcodec/codec/codec_int.h +++ b/core/src/fxcodec/codec/codec_int.h @@ -17,9 +17,9 @@ class CCodec_BasicModule : public ICodec_BasicModule { public: - virtual FX_BOOL RunLengthEncode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, + virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); - virtual FX_BOOL A85Encode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, + virtual FX_BOOL A85Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc); @@ -27,7 +27,7 @@ public: struct CCodec_ImageDataCache { int m_Width, m_Height; int m_nCachedLines; - FX_BYTE m_Data; + uint8_t m_Data; }; class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder { @@ -126,10 +126,10 @@ class CCodec_FlateModule : public ICodec_FlateModule public: virtual ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, int predictor, int Colors, int BitsPerComponent, int Columns); - virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, + virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, int predictor, int Colors, int BitsPerComponent, int Columns, FX_DWORD estimated_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); - virtual FX_BOOL Encode(const FX_BYTE* src_buf, FX_DWORD src_size, + virtual FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); virtual FX_BOOL Encode(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); @@ -171,10 +171,10 @@ public: FX_DWORD dwPrfIntent = Icc_INTENT_ABSOLUTE_COLORIMETRIC, FX_DWORD dwPrfFlag = Icc_FLAGS_SOFTPROOFING ); - virtual FX_LPVOID CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize, FX_INT32& nComponents, FX_INT32 intent = 0, + virtual FX_LPVOID CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent = 0, FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT); - virtual FX_LPVOID CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWORD dwSrcProfileSize, FX_INT32& nSrcComponents, - FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, FX_INT32 intent = 0, + virtual FX_LPVOID CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, + FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent = 0, FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT ); @@ -210,14 +210,14 @@ class CPDF_Jbig2Interface : public CJBig2_Module public: virtual void *JBig2_Malloc(FX_DWORD dwSize) { - return FX_Alloc(FX_BYTE, dwSize); + return FX_Alloc(uint8_t, dwSize); } virtual void *JBig2_Malloc2(FX_DWORD num, FX_DWORD dwSize) { if (dwSize && num >= UINT_MAX / dwSize) { return NULL; } - return FX_Alloc(FX_BYTE, num * dwSize); + return FX_Alloc(uint8_t, num * dwSize); } virtual void *JBig2_Malloc3(FX_DWORD num, FX_DWORD dwSize, FX_DWORD dwSize2) { @@ -228,11 +228,11 @@ public: if (size && num >= UINT_MAX / size) { return NULL; } - return FX_Alloc(FX_BYTE, num * size); + return FX_Alloc(uint8_t, num * size); } virtual void *JBig2_Realloc(FX_LPVOID pMem, FX_DWORD dwSize) { - return FX_Realloc(FX_BYTE, pMem, dwSize); + return FX_Realloc(uint8_t, pMem, dwSize); } virtual void JBig2_Free(FX_LPVOID pMem) { diff --git a/core/src/fxcodec/codec/fx_codec.cpp b/core/src/fxcodec/codec/fx_codec.cpp index c325cccdd4..ee3ef8ce9d 100644 --- a/core/src/fxcodec/codec/fx_codec.cpp +++ b/core/src/fxcodec/codec/fx_codec.cpp @@ -119,7 +119,7 @@ void CCodec_ScanlineDecoder::DownScale(int dest_width, int dest_height) FX_Free(m_pDataCache); m_pDataCache = NULL; } - m_pDataCache = (CCodec_ImageDataCache*)FX_TryAlloc(FX_BYTE, sizeof(CCodec_ImageDataCache) + m_Pitch * m_OutputHeight); + m_pDataCache = (CCodec_ImageDataCache*)FX_TryAlloc(uint8_t, sizeof(CCodec_ImageDataCache) + m_Pitch * m_OutputHeight); if (m_pDataCache == NULL) { return; } @@ -127,7 +127,7 @@ void CCodec_ScanlineDecoder::DownScale(int dest_width, int dest_height) m_pDataCache->m_Width = m_OutputWidth; m_pDataCache->m_nCachedLines = 0; } -FX_BOOL CCodec_BasicModule::RunLengthEncode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, +FX_BOOL CCodec_BasicModule::RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { return FALSE; @@ -236,7 +236,7 @@ extern "C" double FXstrtod(const char* nptr, char** endptr) } return is_negative ? -ret : ret; } -FX_BOOL CCodec_BasicModule::A85Encode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, +FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { return FALSE; @@ -265,7 +265,7 @@ public: protected: FX_BOOL CheckDestSize(); void GetNextOperator(); - void UpdateOperator(FX_BYTE used_bytes); + void UpdateOperator(uint8_t used_bytes); FX_LPBYTE m_pScanline; FX_LPCBYTE m_pSrcBuf; @@ -273,7 +273,7 @@ protected: FX_DWORD m_dwLineBytes; FX_DWORD m_SrcOffset; FX_BOOL m_bEOD; - FX_BYTE m_Operator; + uint8_t m_Operator; }; CCodec_RLScanlineDecoder::CCodec_RLScanlineDecoder() : m_pScanline(NULL) @@ -332,7 +332,7 @@ FX_BOOL CCodec_RLScanlineDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, m_DownScale = 1; m_Pitch = (width * nComps * bpc + 31) / 32 * 4; m_dwLineBytes = (width * nComps * bpc + 7) / 8; - m_pScanline = FX_Alloc(FX_BYTE, m_Pitch); + m_pScanline = FX_Alloc(uint8_t, m_Pitch); return CheckDestSize(); } FX_BOOL CCodec_RLScanlineDecoder::v_Rewind() @@ -368,7 +368,7 @@ FX_LPBYTE CCodec_RLScanlineDecoder::v_GetNextLine() } FXSYS_memcpy32(m_pScanline + col_pos, m_pSrcBuf + m_SrcOffset, copy_len); col_pos += copy_len; - UpdateOperator((FX_BYTE)copy_len); + UpdateOperator((uint8_t)copy_len); } else if (m_Operator > 128) { int fill = 0; if (m_SrcOffset - 1 < m_SrcSize - 1) { @@ -381,7 +381,7 @@ FX_LPBYTE CCodec_RLScanlineDecoder::v_GetNextLine() } FXSYS_memset8(m_pScanline + col_pos, fill, duplicate_len); col_pos += duplicate_len; - UpdateOperator((FX_BYTE)duplicate_len); + UpdateOperator((uint8_t)duplicate_len); } else { m_bEOD = TRUE; break; @@ -398,7 +398,7 @@ void CCodec_RLScanlineDecoder::GetNextOperator() m_Operator = m_pSrcBuf[m_SrcOffset]; m_SrcOffset ++; } -void CCodec_RLScanlineDecoder::UpdateOperator(FX_BYTE used_bytes) +void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) { if (used_bytes == 0) { return; @@ -417,7 +417,7 @@ void CCodec_RLScanlineDecoder::UpdateOperator(FX_BYTE used_bytes) } return; } - FX_BYTE count = 257 - m_Operator; + uint8_t count = 257 - m_Operator; FXSYS_assert((FX_DWORD)count >= used_bytes); if (used_bytes == count) { m_SrcOffset ++; diff --git a/core/src/fxcodec/codec/fx_codec_fax.cpp b/core/src/fxcodec/codec/fx_codec_fax.cpp index dc2ee2aacd..869751e05b 100644 --- a/core/src/fxcodec/codec/fx_codec_fax.cpp +++ b/core/src/fxcodec/codec/fx_codec_fax.cpp @@ -6,7 +6,7 @@ #include "../../../include/fxcodec/fx_codec.h" #include "codec_int.h" -const FX_BYTE OneLeadPos[256] = { +const uint8_t OneLeadPos[256] = { 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -24,7 +24,7 @@ const FX_BYTE OneLeadPos[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -const FX_BYTE ZeroLeadPos[256] = { +const uint8_t ZeroLeadPos[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -43,14 +43,14 @@ const FX_BYTE ZeroLeadPos[256] = { 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8, }; -int _FindBit(const FX_BYTE* data_buf, int max_pos, int start_pos, int bit) +int _FindBit(const uint8_t* data_buf, int max_pos, int start_pos, int bit) { if (start_pos >= max_pos) { return max_pos; } FX_LPCBYTE leading_pos = bit ? OneLeadPos : ZeroLeadPos; if (start_pos % 8) { - FX_BYTE data = data_buf[start_pos / 8]; + uint8_t data = data_buf[start_pos / 8]; if (bit) { data &= 0xff >> (start_pos % 8); } else { @@ -61,7 +61,7 @@ int _FindBit(const FX_BYTE* data_buf, int max_pos, int start_pos, int bit) } start_pos += 7; } - FX_BYTE skip = bit ? 0x00 : 0xff; + uint8_t skip = bit ? 0x00 : 0xff; int byte_pos = start_pos / 8; int max_byte = (max_pos + 7) / 8; while (byte_pos < max_byte) { @@ -79,12 +79,12 @@ int _FindBit(const FX_BYTE* data_buf, int max_pos, int start_pos, int bit) } return pos; } -void _FaxG4FindB1B2(const FX_BYTE* ref_buf, int columns, int a0, FX_BOOL a0color, int& b1, int& b2) +void _FaxG4FindB1B2(const uint8_t* ref_buf, int columns, int a0, FX_BOOL a0color, int& b1, int& b2) { if (a0color) { a0color = 1; } - FX_BYTE first_bit = (a0 < 0) ? 1 : ((ref_buf[a0 / 8] & (1 << (7 - a0 % 8))) != 0); + uint8_t first_bit = (a0 < 0) ? 1 : ((ref_buf[a0 / 8] & (1 << (7 - a0 % 8))) != 0); b1 = _FindBit(ref_buf, columns, a0 + 1, !first_bit); if (b1 >= columns) { b1 = b2 = columns; @@ -136,7 +136,7 @@ void _FaxFillBits(FX_LPBYTE dest_buf, int columns, int startpos, int endpos) #define NEXTBIT src_buf[bitpos/8] & (1 << (7-bitpos%8)); bitpos ++; #define ADDBIT(code, bit) code = code << 1; if (bit) code ++; #define GETBIT(bitpos) src_buf[bitpos/8] & (1 << (7-bitpos%8)) -static const FX_BYTE FaxBlackRunIns[] = { +static const uint8_t FaxBlackRunIns[] = { 0, 2, 0x02, 3, 0, @@ -256,7 +256,7 @@ static const FX_BYTE FaxBlackRunIns[] = { 0x77, 1216 % 256, 1216 / 256, 0xff }; -static const FX_BYTE FaxWhiteRunIns[] = { +static const uint8_t FaxWhiteRunIns[] = { 0, 0, 0, @@ -375,12 +375,12 @@ static const FX_BYTE FaxWhiteRunIns[] = { 0x1f, 2560 % 256, 2560 / 256, 0xff, }; -int _FaxGetRun(FX_LPCBYTE ins_array, const FX_BYTE* src_buf, int& bitpos, int bitsize) +int _FaxGetRun(FX_LPCBYTE ins_array, const uint8_t* src_buf, int& bitpos, int bitsize) { FX_DWORD code = 0; int ins_off = 0; while (1) { - FX_BYTE ins = ins_array[ins_off++]; + uint8_t ins = ins_array[ins_off++]; if (ins == 0xff) { return -1; } @@ -400,7 +400,7 @@ int _FaxGetRun(FX_LPCBYTE ins_array, const FX_BYTE* src_buf, int& bitpos, int bi } } } -FX_BOOL _FaxG4GetRow(const FX_BYTE* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, const FX_BYTE* ref_buf, int columns) +FX_BOOL _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, const uint8_t* ref_buf, int columns) { int a0 = -1, a0color = 1; while (1) { @@ -522,7 +522,7 @@ FX_BOOL _FaxG4GetRow(const FX_BYTE* src_buf, int bitsize, int& bitpos, FX_LPBYTE a0color = !a0color; } } -FX_BOOL _FaxSkipEOL(const FX_BYTE* src_buf, int bitsize, int& bitpos) +FX_BOOL _FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos) { int startbit = bitpos; while (bitpos < bitsize) { @@ -536,7 +536,7 @@ FX_BOOL _FaxSkipEOL(const FX_BYTE* src_buf, int bitsize, int& bitpos) } return FALSE; } -FX_BOOL _FaxGet1DLine(const FX_BYTE* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns) +FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns) { int color = TRUE; int startpos = 0; @@ -621,8 +621,8 @@ FX_BOOL CCodec_FaxDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int wid m_Pitch = (m_OrigWidth + 31) / 32 * 4; m_OutputWidth = m_OrigWidth; m_OutputHeight = m_OrigHeight; - m_pScanlineBuf = FX_Alloc(FX_BYTE, m_Pitch); - m_pRefBuf = FX_Alloc(FX_BYTE, m_Pitch); + m_pScanlineBuf = FX_Alloc(uint8_t, m_Pitch); + m_pRefBuf = FX_Alloc(uint8_t, m_Pitch); m_pSrcBuf = src_buf; m_SrcSize = src_size; m_nComps = 1; @@ -698,7 +698,7 @@ extern "C" { if (pitch == 0) { pitch = (width + 7) / 8; } - FX_LPBYTE ref_buf = FX_Alloc(FX_BYTE, pitch); + FX_LPBYTE ref_buf = FX_Alloc(uint8_t, pitch); FXSYS_memset8(ref_buf, 0xff, pitch); int bitpos = *pbitpos; for (int iRow = 0; iRow < height; iRow ++) { @@ -711,7 +711,7 @@ extern "C" { *pbitpos = bitpos; } }; -static const FX_BYTE BlackRunTerminator[128] = { +static const uint8_t BlackRunTerminator[128] = { 0x37, 10, 0x02, 3, 0x03, 2, 0x02, 2, 0x03, 3, 0x03, 4, 0x02, 4, 0x03, 5, 0x05, 6, 0x04, 6, 0x04, 7, 0x05, 7, 0x07, 7, 0x04, 8, 0x07, 8, 0x18, 9, 0x17, 10, 0x18, 10, 0x08, 10, 0x67, 11, 0x68, 11, 0x6c, 11, 0x37, 11, 0x28, 11, @@ -721,14 +721,14 @@ static const FX_BYTE BlackRunTerminator[128] = { 0x64, 12, 0x65, 12, 0x52, 12, 0x53, 12, 0x24, 12, 0x37, 12, 0x38, 12, 0x27, 12, 0x28, 12, 0x58, 12, 0x59, 12, 0x2b, 12, 0x2c, 12, 0x5a, 12, 0x66, 12, 0x67, 12, }; -static const FX_BYTE BlackRunMarkup[80] = { +static const uint8_t BlackRunMarkup[80] = { 0x0f, 10, 0xc8, 12, 0xc9, 12, 0x5b, 12, 0x33, 12, 0x34, 12, 0x35, 12, 0x6c, 13, 0x6d, 13, 0x4a, 13, 0x4b, 13, 0x4c, 13, 0x4d, 13, 0x72, 13, 0x73, 13, 0x74, 13, 0x75, 13, 0x76, 13, 0x77, 13, 0x52, 13, 0x53, 13, 0x54, 13, 0x55, 13, 0x5a, 13, 0x5b, 13, 0x64, 13, 0x65, 13, 0x08, 11, 0x0c, 11, 0x0d, 11, 0x12, 12, 0x13, 12, 0x14, 12, 0x15, 12, 0x16, 12, 0x17, 12, 0x1c, 12, 0x1d, 12, 0x1e, 12, 0x1f, 12, }; -static const FX_BYTE WhiteRunTerminator[128] = { +static const uint8_t WhiteRunTerminator[128] = { 0x35, 8, 0x07, 6, 0x07, 4, @@ -794,7 +794,7 @@ static const FX_BYTE WhiteRunTerminator[128] = { 0x33, 8, 0x34, 8, }; -static const FX_BYTE WhiteRunMarkup[80] = { +static const uint8_t WhiteRunMarkup[80] = { 0x1b, 5, 0x12, 5, 0x17, 6, @@ -935,9 +935,9 @@ CCodec_FaxEncoder::CCodec_FaxEncoder(FX_LPCBYTE src_buf, int width, int height, m_Cols = width; m_Rows = height; m_Pitch = pitch; - m_pRefLine = FX_Alloc(FX_BYTE, m_Pitch); + m_pRefLine = FX_Alloc(uint8_t, m_Pitch); FXSYS_memset8(m_pRefLine, 0xff, m_Pitch); - m_pLineBuf = FX_Alloc2D(FX_BYTE, m_Pitch, 8); + m_pLineBuf = FX_Alloc2D(uint8_t, m_Pitch, 8); m_DestBuf.EstimateSize(0, 10240); } CCodec_FaxEncoder::~CCodec_FaxEncoder() @@ -952,7 +952,7 @@ CCodec_FaxEncoder::~CCodec_FaxEncoder() void CCodec_FaxEncoder::Encode(FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { int dest_bitpos = 0; - FX_BYTE last_byte = 0; + uint8_t last_byte = 0; for (int i = 0; i < m_Rows; i ++) { FX_LPCBYTE scan_line = m_pSrcBuf + i * m_Pitch; FXSYS_memset32(m_pLineBuf, 0, m_Pitch * 8); diff --git a/core/src/fxcodec/codec/fx_codec_flate.cpp b/core/src/fxcodec/codec/fx_codec_flate.cpp index 7a19e8b855..9997a570d6 100644 --- a/core/src/fxcodec/codec/fx_codec_flate.cpp +++ b/core/src/fxcodec/codec/fx_codec_flate.cpp @@ -13,7 +13,7 @@ extern "C" { static void* my_alloc_func (void* opaque, unsigned int items, unsigned int size) { - return FX_Alloc2D(FX_BYTE, items, size); + return FX_Alloc2D(uint8_t, items, size); } static void my_free_func (void* opaque, void* address) { @@ -79,22 +79,22 @@ extern "C" class CLZWDecoder { public: - FX_BOOL Decode(FX_LPBYTE output, FX_DWORD& outlen, const FX_BYTE* input, FX_DWORD& size, FX_BOOL bEarlyChange); + FX_BOOL Decode(FX_LPBYTE output, FX_DWORD& outlen, const uint8_t* input, FX_DWORD& size, FX_BOOL bEarlyChange); private: FX_DWORD m_InPos; FX_DWORD m_OutPos; FX_LPBYTE m_pOutput; - const FX_BYTE* m_pInput; + const uint8_t* m_pInput; FX_BOOL m_Early; - void AddCode(FX_DWORD prefix_code, FX_BYTE append_char); + void AddCode(FX_DWORD prefix_code, uint8_t append_char); FX_DWORD m_CodeArray[5021]; FX_DWORD m_nCodes; - FX_BYTE m_DecodeStack[4000]; + uint8_t m_DecodeStack[4000]; FX_DWORD m_StackLen; void DecodeString(FX_DWORD code); int m_CodeLen; }; -void CLZWDecoder::AddCode(FX_DWORD prefix_code, FX_BYTE append_char) +void CLZWDecoder::AddCode(FX_DWORD prefix_code, uint8_t append_char) { if (m_nCodes + m_Early == 4094) { return; @@ -119,15 +119,15 @@ void CLZWDecoder::DecodeString(FX_DWORD code) if (m_StackLen >= sizeof(m_DecodeStack)) { return; } - m_DecodeStack[m_StackLen++] = (FX_BYTE)data; + m_DecodeStack[m_StackLen++] = (uint8_t)data; code = data >> 16; } if (m_StackLen >= sizeof(m_DecodeStack)) { return; } - m_DecodeStack[m_StackLen++] = (FX_BYTE)code; + m_DecodeStack[m_StackLen++] = (uint8_t)code; } -int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const FX_BYTE* src_buf, FX_DWORD& src_size, FX_BOOL bEarlyChange) +int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const uint8_t* src_buf, FX_DWORD& src_size, FX_BOOL bEarlyChange) { m_CodeLen = 9; m_InPos = 0; @@ -137,7 +137,7 @@ int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const FX_BYTE* m_Early = bEarlyChange ? 1 : 0; m_nCodes = 0; FX_DWORD old_code = (FX_DWORD) - 1; - FX_BYTE last_char; + uint8_t last_char; while (1) { if (m_InPos + m_CodeLen > src_size * 8) { break; @@ -164,10 +164,10 @@ int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const FX_BYTE* return -5; } if (m_pOutput) { - m_pOutput[m_OutPos] = (FX_BYTE)code; + m_pOutput[m_OutPos] = (uint8_t)code; } m_OutPos ++; - last_char = (FX_BYTE)code; + last_char = (uint8_t)code; if (old_code != (FX_DWORD) - 1) { AddCode(old_code, last_char); } @@ -217,19 +217,19 @@ int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const FX_BYTE* src_size = (m_InPos + 7) / 8; return 0; } -static FX_BYTE PaethPredictor(int a, int b, int c) +static uint8_t PaethPredictor(int a, int b, int c) { int p = a + b - c; int pa = FXSYS_abs(p - a); int pb = FXSYS_abs(p - b); int pc = FXSYS_abs(p - c); if (pa <= pb && pa <= pc) { - return (FX_BYTE)a; + return (uint8_t)a; } if (pb <= pc) { - return (FX_BYTE)b; + return (uint8_t)b; } - return (FX_BYTE)c; + return (uint8_t)c; } static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, int predictor, int Colors, @@ -241,7 +241,7 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, return FALSE; const int row_count = (data_size + row_size - 1) / row_size; const int last_row_size = data_size % row_size; - FX_LPBYTE dest_buf = FX_Alloc2D(FX_BYTE, row_size + 1, row_count); + FX_LPBYTE dest_buf = FX_Alloc2D(uint8_t, row_size + 1, row_count); int byte_cnt = 0; FX_LPBYTE pSrcData = data_buf; FX_LPBYTE pDestData = dest_buf; @@ -262,7 +262,7 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, switch (predictor) { case 11: { pDestData[0] = 1; - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pSrcData[byte - BytesPerPixel]; } @@ -271,7 +271,7 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; case 12: { pDestData[0] = 2; - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pSrcData[byte - row_size]; } @@ -280,11 +280,11 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; case 13: { pDestData[0] = 3; - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pSrcData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pSrcData[byte - row_size]; } @@ -293,15 +293,15 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; case 14: { pDestData[0] = 4; - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pSrcData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pSrcData[byte - row_size]; } - FX_BYTE upper_left = 0; + uint8_t upper_left = 0; if (byte >= BytesPerPixel && row) { upper_left = pSrcData[byte - row_size - BytesPerPixel]; } @@ -328,16 +328,16 @@ static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE { int row_size = (nPixels * bpc * nColors + 7) / 8; int BytesPerPixel = (bpc * nColors + 7) / 8; - FX_BYTE tag = pSrcData[0]; + uint8_t tag = pSrcData[0]; if (tag == 0) { FXSYS_memmove32(pDestData, pSrcData + 1, row_size); return; } for (int byte = 0; byte < row_size; byte ++) { - FX_BYTE raw_byte = pSrcData[byte + 1]; + uint8_t raw_byte = pSrcData[byte + 1]; switch (tag) { case 1: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } @@ -345,7 +345,7 @@ static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE break; } case 2: { - FX_BYTE up = 0; + uint8_t up = 0; if (pLastLine) { up = pLastLine[byte]; } @@ -353,11 +353,11 @@ static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE break; } case 3: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (pLastLine) { up = pLastLine[byte]; } @@ -365,15 +365,15 @@ static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE break; } case 4: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (pLastLine) { up = pLastLine[byte]; } - FX_BYTE upper_left = 0; + uint8_t upper_left = 0; if (byte >= BytesPerPixel && pLastLine) { upper_left = pLastLine[byte - BytesPerPixel]; } @@ -395,12 +395,12 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, return FALSE; const int row_count = (data_size + row_size) / (row_size + 1); const int last_row_size = data_size % (row_size + 1); - FX_LPBYTE dest_buf = FX_Alloc2D(FX_BYTE, row_size, row_count); + FX_LPBYTE dest_buf = FX_Alloc2D(uint8_t, row_size, row_count); int byte_cnt = 0; FX_LPBYTE pSrcData = data_buf; FX_LPBYTE pDestData = dest_buf; for (int row = 0; row < row_count; row ++) { - FX_BYTE tag = pSrcData[0]; + uint8_t tag = pSrcData[0]; byte_cnt++; if (tag == 0) { int move_size = row_size; @@ -414,10 +414,10 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, continue; } for (int byte = 0; byte < row_size && byte_cnt < (int)data_size; byte ++) { - FX_BYTE raw_byte = pSrcData[byte + 1]; + uint8_t raw_byte = pSrcData[byte + 1]; switch (tag) { case 1: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } @@ -425,7 +425,7 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; } case 2: { - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pDestData[byte - row_size]; } @@ -433,11 +433,11 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; } case 3: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pDestData[byte - row_size]; } @@ -445,15 +445,15 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, break; } case 4: { - FX_BYTE left = 0; + uint8_t left = 0; if (byte >= BytesPerPixel) { left = pDestData[byte - BytesPerPixel]; } - FX_BYTE up = 0; + uint8_t up = 0; if (row) { up = pDestData[byte - row_size]; } - FX_BYTE upper_left = 0; + uint8_t upper_left = 0; if (byte >= BytesPerPixel && row) { upper_left = pDestData[byte - row_size - BytesPerPixel]; } @@ -478,7 +478,7 @@ static void TIFF_PredictorEncodeLine(FX_LPBYTE dest_buf, int row_size, int BitsP { int BytesPerPixel = BitsPerComponent * Colors / 8; if (BitsPerComponent < 8) { - FX_BYTE mask = 0x01; + uint8_t mask = 0x01; if (BitsPerComponent == 2) { mask = 0x03; } else if (BitsPerComponent == 4) { @@ -490,8 +490,8 @@ static void TIFF_PredictorEncodeLine(FX_LPBYTE dest_buf, int row_size, int BitsP int index = i / 8; int col_pre = (col == 0) ? (8 - BitsPerComponent) : (col - BitsPerComponent); int index_pre = (col == 0) ? (index - 1) : index; - FX_BYTE cur = (dest_buf[index] >> (8 - col - BitsPerComponent)) & mask; - FX_BYTE left = (dest_buf[index_pre] >> (8 - col_pre - BitsPerComponent)) & mask; + uint8_t cur = (dest_buf[index] >> (8 - col - BitsPerComponent)) & mask; + uint8_t left = (dest_buf[index_pre] >> (8 - col_pre - BitsPerComponent)) & mask; cur -= left; cur &= mask; cur <<= (8 - col - BitsPerComponent); @@ -507,7 +507,7 @@ static void TIFF_PredictorEncodeLine(FX_LPBYTE dest_buf, int row_size, int BitsP FX_WORD pixel = (dest_buf[i] << 8) | dest_buf[i + 1]; pixel -= (dest_buf[i - BytesPerPixel] << 8) | dest_buf[i - BytesPerPixel + 1]; dest_buf[i] = pixel >> 8; - dest_buf[i + 1] = (FX_BYTE)pixel; + dest_buf[i + 1] = (uint8_t)pixel; } } } @@ -553,7 +553,7 @@ static void TIFF_PredictLine(FX_LPBYTE dest_buf, int row_size, int BitsPerCompon FX_WORD pixel = (dest_buf[i - BytesPerPixel] << 8) | dest_buf[i - BytesPerPixel + 1]; pixel += (dest_buf[i] << 8) | dest_buf[i + 1]; dest_buf[i] = pixel >> 8; - dest_buf[i + 1] = (FX_BYTE)pixel; + dest_buf[i + 1] = (uint8_t)pixel; } } else { for (int i = BytesPerPixel; i < row_size; i ++) { @@ -641,7 +641,7 @@ void CCodec_FlateScanlineDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, m_bpc = bpc; m_bColorTransformed = FALSE; m_Pitch = (width * nComps * bpc + 7) / 8; - m_pScanline = FX_Alloc(FX_BYTE, m_Pitch); + m_pScanline = FX_Alloc(uint8_t, m_Pitch); m_Predictor = 0; if (predictor) { if (predictor >= 10) { @@ -659,9 +659,9 @@ void CCodec_FlateScanlineDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, m_BitsPerComponent = BitsPerComponent; m_Columns = Columns; m_PredictPitch = (m_BitsPerComponent * m_Colors * m_Columns + 7) / 8; - m_pLastLine = FX_Alloc(FX_BYTE, m_PredictPitch); - m_pPredictRaw = FX_Alloc(FX_BYTE, m_PredictPitch + 1); - m_pPredictBuffer = FX_Alloc(FX_BYTE, m_PredictPitch); + m_pLastLine = FX_Alloc(uint8_t, m_PredictPitch); + m_pPredictRaw = FX_Alloc(uint8_t, m_PredictPitch + 1); + m_pPredictBuffer = FX_Alloc(uint8_t, m_PredictPitch); } } } @@ -737,7 +737,7 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig FX_DWORD last_buf_size = buf_size; void* context = nullptr; - FX_LPBYTE guess_buf = FX_Alloc(FX_BYTE, guess_size + 1); + FX_LPBYTE guess_buf = FX_Alloc(uint8_t, guess_size + 1); FX_LPBYTE cur_buf = guess_buf; guess_buf[guess_size] = '\0'; context = FPDFAPI_FlateInit(my_alloc_func, my_free_func); @@ -746,10 +746,10 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig FPDFAPI_FlateInput(context, src_buf, src_size); if (useOldImpl) { while (1) { - FX_INT32 ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size); + int32_t ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size); if (ret != Z_OK) break; - FX_INT32 avail_buf_size = FPDFAPI_FlateGetAvailOut(context); + int32_t avail_buf_size = FPDFAPI_FlateGetAvailOut(context); if (avail_buf_size != 0) break; @@ -758,7 +758,7 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig guess_size += alloc_step; if (guess_size < old_size || guess_size + 1 < guess_size) goto fail; - guess_buf = FX_Realloc(FX_BYTE, guess_buf, guess_size + 1); + guess_buf = FX_Realloc(uint8_t, guess_buf, guess_size + 1); if (!guess_buf) goto fail; guess_buf[guess_size] = '\0'; @@ -768,7 +768,7 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig dest_size = FPDFAPI_FlateGetTotalOut(context); offset = FPDFAPI_FlateGetTotalIn(context); if (guess_size / 2 > dest_size) { - guess_buf = FX_Realloc(FX_BYTE, guess_buf, dest_size + 1); + guess_buf = FX_Realloc(uint8_t, guess_buf, dest_size + 1); if (!guess_buf) goto fail; guess_size = dest_size; @@ -778,8 +778,8 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig } else { CFX_ArrayTemplate result_tmp_bufs; while (1) { - FX_INT32 ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size); - FX_INT32 avail_buf_size = FPDFAPI_FlateGetAvailOut(context); + int32_t ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size); + int32_t avail_buf_size = FPDFAPI_FlateGetAvailOut(context); if (ret != Z_OK) { last_buf_size = buf_size - avail_buf_size; result_tmp_bufs.Add(cur_buf); @@ -793,7 +793,7 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig // |avail_buf_size| == 0 case. result_tmp_bufs.Add(cur_buf); - cur_buf = FX_Alloc(FX_BYTE, buf_size + 1); + cur_buf = FX_Alloc(uint8_t, buf_size + 1); cur_buf[buf_size] = '\0'; } dest_size = FPDFAPI_FlateGetTotalOut(context); @@ -801,9 +801,9 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig if (result_tmp_bufs.GetSize() == 1) { dest_buf = result_tmp_bufs[0]; } else { - FX_LPBYTE result_buf = FX_Alloc(FX_BYTE, dest_size); + FX_LPBYTE result_buf = FX_Alloc(uint8_t, dest_size); FX_DWORD result_pos = 0; - for (FX_INT32 i = 0; i < result_tmp_bufs.GetSize(); i++) { + for (int32_t i = 0; i < result_tmp_bufs.GetSize(); i++) { FX_LPBYTE tmp_buf = result_tmp_bufs[i]; FX_DWORD tmp_buf_size = buf_size; if (i == result_tmp_bufs.GetSize() - 1) { @@ -832,7 +832,7 @@ ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(FX_LPCBYTE src_buf, FX pDecoder->Create(src_buf, src_size, width, height, nComps, bpc, predictor, Colors, BitsPerComponent, Columns); return pDecoder; } -FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, +FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, int predictor, int Colors, int BitsPerComponent, int Columns, FX_DWORD estimated_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { @@ -859,7 +859,7 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_b } { nonstd::unique_ptr decoder(new CLZWDecoder); - dest_buf = FX_Alloc( FX_BYTE, dest_size + 1); + dest_buf = FX_Alloc( uint8_t, dest_size + 1); dest_buf[dest_size] = '\0'; decoder->Decode(dest_buf, dest_size, src_buf, offset, bEarlyChange); } @@ -879,7 +879,7 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_b } return ret ? offset : -1; } -FX_BOOL CCodec_FlateModule::Encode(const FX_BYTE* src_buf, FX_DWORD src_size, +FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { @@ -887,7 +887,7 @@ FX_BOOL CCodec_FlateModule::Encode(const FX_BYTE* src_buf, FX_DWORD src_size, return Encode(src_buf, src_size, dest_buf, dest_size); } FX_LPBYTE pSrcBuf = NULL; - pSrcBuf = FX_Alloc(FX_BYTE, src_size); + pSrcBuf = FX_Alloc(uint8_t, src_size); FXSYS_memcpy32(pSrcBuf, src_buf, src_size); FX_BOOL ret = TRUE; if (predictor == 2) { @@ -905,7 +905,7 @@ FX_BOOL CCodec_FlateModule::Encode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_BOOL CCodec_FlateModule::Encode(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) { dest_size = src_size + src_size / 1000 + 12; - dest_buf = FX_Alloc( FX_BYTE, dest_size); + dest_buf = FX_Alloc( uint8_t, dest_size); unsigned long temp_size = dest_size; FPDFAPI_FlateCompress(dest_buf, &temp_size, src_buf, src_size); dest_size = (FX_DWORD)temp_size; diff --git a/core/src/fxcodec/codec/fx_codec_icc.cpp b/core/src/fxcodec/codec/fx_codec_icc.cpp index 26b4c1adfc..cde5d4c1bd 100644 --- a/core/src/fxcodec/codec/fx_codec_icc.cpp +++ b/core/src/fxcodec/codec/fx_codec_icc.cpp @@ -13,7 +13,7 @@ const FX_DWORD N_COMPONENT_RGB = 3; const FX_DWORD N_COMPONENT_CMYK = 4; const FX_DWORD N_COMPONENT_DEFAULT = 3; -FX_BOOL MD5ComputeID( FX_LPCVOID buf, FX_DWORD dwSize, FX_BYTE ID[16] ) +FX_BOOL MD5ComputeID( FX_LPCVOID buf, FX_DWORD dwSize, uint8_t ID[16] ) { return cmsMD5computeIDExt(buf, dwSize, ID); } @@ -65,7 +65,7 @@ FX_BOOL CheckComponents(cmsColorSpaceSignature cs, int nComponents, FX_BOOL bDst } return TRUE; } -FX_INT32 GetCSComponents(cmsColorSpaceSignature cs) +int32_t GetCSComponents(cmsColorSpaceSignature cs) { FX_DWORD components; switch (cs) { @@ -87,8 +87,8 @@ FX_INT32 GetCSComponents(cmsColorSpaceSignature cs) } return components; } -void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, FX_DWORD dwSrcProfileSize, FX_INT32& nSrcComponents, - const unsigned char* pDstProfileData, FX_DWORD dwDstProfileSize, FX_INT32 nDstComponents, +void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, + const unsigned char* pDstProfileData, FX_DWORD dwDstProfileSize, int32_t nDstComponents, int intent, FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT) { cmsHPROFILE srcProfile = NULL; @@ -157,7 +157,7 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, FX_DWORD dwSr cmsCloseProfile(dstProfile); return pCmm; } -void* IccLib_CreateTransform_sRGB(const unsigned char* pProfileData, FX_DWORD dwProfileSize, FX_INT32& nComponents, FX_INT32 intent, FX_DWORD dwSrcFormat) +void* IccLib_CreateTransform_sRGB(const unsigned char* pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent, FX_DWORD dwSrcFormat) { return IccLib_CreateTransform(pProfileData, dwProfileSize, nComponents, NULL, 0, 3, intent, dwSrcFormat); } @@ -175,7 +175,7 @@ void IccLib_Translate(void* pTransform, FX_DWORD nSrcComponents, FX_FLOAT* pSrcV return; } CLcmsCmm* p = (CLcmsCmm*)pTransform; - FX_BYTE output[4]; + uint8_t output[4]; if (p->m_bLab) { CFX_FixedBufGrow inputs(nSrcComponents); double* input = inputs; @@ -184,8 +184,8 @@ void IccLib_Translate(void* pTransform, FX_DWORD nSrcComponents, FX_FLOAT* pSrcV } cmsDoTransform(p->m_hTransform, input, output, 1); } else { - CFX_FixedBufGrow inputs(nSrcComponents); - FX_BYTE* input = inputs; + CFX_FixedBufGrow inputs(nSrcComponents); + uint8_t* input = inputs; for (FX_DWORD i = 0; i < nSrcComponents; i ++) { if (pSrcValues[i] > 1.0f) { input[i] = 255; @@ -214,7 +214,7 @@ void IccLib_Translate(void* pTransform, FX_DWORD nSrcComponents, FX_FLOAT* pSrcV break; } } -void IccLib_TranslateImage(void* pTransform, unsigned char* pDest, const unsigned char* pSrc, FX_INT32 pixels) +void IccLib_TranslateImage(void* pTransform, unsigned char* pDest, const unsigned char* pSrc, int32_t pixels) { cmsDoTransform(((CLcmsCmm*)pTransform)->m_hTransform, (void*)pSrc, pDest, pixels); } @@ -284,7 +284,7 @@ ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS(IFX_FileRead* pFile) } ICodec_IccModule::IccCS cs; FX_DWORD dwSize = (FX_DWORD)pFile->GetSize(); - FX_LPBYTE pBuf = FX_Alloc(FX_BYTE, dwSize); + FX_LPBYTE pBuf = FX_Alloc(uint8_t, dwSize); pFile->ReadBlock(pBuf, 0, dwSize); cs = GetProfileCS(pBuf, dwSize); FX_Free(pBuf); @@ -406,7 +406,7 @@ FX_LPVOID CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, CFX_ByteStringKey key; CFX_ByteString text; key << pIccParam->ColorSpace << (pIccParam->dwProfileType | ic << 8); - FX_BYTE ID[16]; + uint8_t ID[16]; switch (pIccParam->dwProfileType) { case Icc_PARAMTYPE_NONE: return NULL; @@ -526,12 +526,12 @@ CCodec_IccModule::~CCodec_IccModule() } } } -void* CCodec_IccModule::CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize, FX_INT32& nComponents, FX_INT32 intent, FX_DWORD dwSrcFormat) +void* CCodec_IccModule::CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent, FX_DWORD dwSrcFormat) { return IccLib_CreateTransform_sRGB(pProfileData, dwProfileSize, nComponents, intent, dwSrcFormat); } -void* CCodec_IccModule::CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWORD dwSrcProfileSize, FX_INT32& nSrcComponents, - FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, FX_INT32 intent, +void* CCodec_IccModule::CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, + FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent, FX_DWORD dwSrcFormat , FX_DWORD dwDstFormat) { return IccLib_CreateTransform(pSrcProfileData, dwSrcProfileSize, nSrcComponents, @@ -545,11 +545,11 @@ void CCodec_IccModule::Translate(void* pTransform, FX_FLOAT* pSrcValues, FX_FLOA { IccLib_Translate(pTransform, m_nComponents, pSrcValues, pDestValues); } -void CCodec_IccModule::TranslateScanline(void* pTransform, FX_LPBYTE pDest, FX_LPCBYTE pSrc, FX_INT32 pixels) +void CCodec_IccModule::TranslateScanline(void* pTransform, FX_LPBYTE pDest, FX_LPCBYTE pSrc, int32_t pixels) { IccLib_TranslateImage(pTransform, pDest, pSrc, pixels); } -const FX_BYTE g_CMYKSamples[81 * 81 * 3] = { +const uint8_t g_CMYKSamples[81 * 81 * 3] = { 255, 255, 255, 225, 226, 228, 199, 200, 202, 173, 174, 178, 147, 149, 152, 123, 125, 128, 99, 99, 102, 69, 70, 71, 34, 30, 31, 255, 253, 229, 226, 224, 203, 200, 199, 182, 173, 173, 158, 149, 148, 135, 125, 124, 113, 99, 99, 90, 70, 69, 63, 33, 29, 24, 255, 251, 204, 228, 223, 182, 201, 198, 163, 174, 172, 142, 150, 147, 122, 125, 123, 101, 99, 98, 80, 70, 68, 54, 32, 28, 16, @@ -1280,7 +1280,7 @@ const FX_BYTE g_CMYKSamples[81 * 81 * 3] = { 53, 53, 66, 47, 44, 57, 40, 36, 48, 32, 27, 39, 22, 18, 30, 9, 4, 18, 0, 0, 3, 0, 0, 0, 0, 0, 0, 54, 53, 57, 48, 45, 49, 41, 37, 41, 33, 28, 32, 22, 19, 23, 11, 6, 10, 1, 0, 0, 0, 0, 0, 0, 0, 0, }; -void AdobeCMYK_to_sRGB1(FX_BYTE c, FX_BYTE m, FX_BYTE y, FX_BYTE k, FX_BYTE& R, FX_BYTE& G, FX_BYTE& B) +void AdobeCMYK_to_sRGB1(uint8_t c, uint8_t m, uint8_t y, uint8_t k, uint8_t& R, uint8_t& G, uint8_t& B) { int fix_c = c << 8; int fix_m = m << 8; @@ -1357,11 +1357,11 @@ void AdobeCMYK_to_sRGB1(FX_BYTE c, FX_BYTE m, FX_BYTE y, FX_BYTE k, FX_BYTE& R, } void AdobeCMYK_to_sRGB(FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) { - FX_BYTE c1 = FXSYS_round(c * 255); - FX_BYTE m1 = FXSYS_round(m * 255); - FX_BYTE y1 = FXSYS_round(y * 255); - FX_BYTE k1 = FXSYS_round(k * 255); - FX_BYTE r, g, b; + uint8_t c1 = FXSYS_round(c * 255); + uint8_t m1 = FXSYS_round(m * 255); + uint8_t y1 = FXSYS_round(y * 255); + uint8_t k1 = FXSYS_round(k * 255); + uint8_t r, g, b; AdobeCMYK_to_sRGB1(c1, m1, y1, k1, r, g, b); R = 1.0f * r / 255; G = 1.0f * g / 255; diff --git a/core/src/fxcodec/codec/fx_codec_jbig.cpp b/core/src/fxcodec/codec/fx_codec_jbig.cpp index 8fcd9f4711..622448d659 100644 --- a/core/src/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/src/fxcodec/codec/fx_codec_jbig.cpp @@ -52,7 +52,7 @@ FX_BOOL CCodec_Jbig2Module::Decode(IFX_FileRead* file_ptr, CJBig2_Context* pContext = NULL; CJBig2_Image* dest_image = NULL; FX_DWORD src_size = (FX_DWORD)file_ptr->GetSize(); - FX_LPBYTE src_buf = FX_Alloc(FX_BYTE, src_size); + FX_LPBYTE src_buf = FX_Alloc(uint8_t, src_size); int ret = 0; if(!file_ptr->ReadBlock(src_buf, 0, src_size)) { goto failed; @@ -129,7 +129,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, IFX_FileRead m_pJbig2Context->m_bFileReader = TRUE; m_pJbig2Context->m_dest_image = NULL; m_pJbig2Context->m_src_size = (FX_DWORD)file_ptr->GetSize(); - m_pJbig2Context->m_src_buf = FX_Alloc(FX_BYTE, m_pJbig2Context->m_src_size); + m_pJbig2Context->m_src_buf = FX_Alloc(uint8_t, m_pJbig2Context->m_src_size); int ret = 0; if(!file_ptr->ReadBlock((void*)m_pJbig2Context->m_src_buf, 0, m_pJbig2Context->m_src_size)) { goto failed; diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp index 9dcc87bcdf..111cbcf245 100644 --- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp @@ -12,7 +12,7 @@ #include "codec_int.h" extern "C" { - static void _JpegScanSOI(const FX_BYTE*& src_buf, FX_DWORD& src_size) + static void _JpegScanSOI(const uint8_t*& src_buf, FX_DWORD& src_size) { if (src_size == 0) { return; @@ -88,15 +88,15 @@ static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo, FX_LPCBYTE icc_buf_ptr return FALSE; } FX_DWORD icc_data_length = JPEG_OVERHEAD_LEN + (icc_segment_num > 1 ? icc_segment_size : icc_length); - FX_LPBYTE icc_data = FX_Alloc(FX_BYTE, icc_data_length); + FX_LPBYTE icc_data = FX_Alloc(uint8_t, icc_data_length); FXSYS_memcpy32(icc_data, "\x49\x43\x43\x5f\x50\x52\x4f\x46\x49\x4c\x45\x00", 12); - icc_data[13] = (FX_BYTE)icc_segment_num; - for (FX_BYTE i = 0; i < (icc_segment_num - 1); i++) { + icc_data[13] = (uint8_t)icc_segment_num; + for (uint8_t i = 0; i < (icc_segment_num - 1); i++) { icc_data[12] = i + 1; FXSYS_memcpy32(icc_data + JPEG_OVERHEAD_LEN, icc_buf_ptr + i * icc_segment_size, icc_segment_size); jpeg_write_marker(cinfo, JPEG_MARKER_ICC, icc_data, icc_data_length); } - icc_data[12] = (FX_BYTE)icc_segment_num; + icc_data[12] = (uint8_t)icc_segment_num; FX_DWORD icc_size = (icc_segment_num - 1) * icc_segment_size; FXSYS_memcpy32(icc_data + JPEG_OVERHEAD_LEN, icc_buf_ptr + icc_size, icc_length - icc_size); jpeg_write_marker(cinfo, JPEG_MARKER_ICC, icc_data, JPEG_OVERHEAD_LEN + icc_length - icc_size); @@ -144,11 +144,11 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST dest_buf = nullptr; } else { dest_buf_length = safe_buf_len.ValueOrDie(); - dest_buf = FX_TryAlloc(FX_BYTE, dest_buf_length); + dest_buf = FX_TryAlloc(uint8_t, dest_buf_length); const int MIN_TRY_BUF_LEN = 1024; while (!dest_buf && dest_buf_length > MIN_TRY_BUF_LEN) { dest_buf_length >>= 1; - dest_buf = FX_TryAlloc(FX_BYTE, dest_buf_length); + dest_buf = FX_TryAlloc(uint8_t, dest_buf_length); } } if (!dest_buf) { @@ -173,7 +173,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST } FX_LPBYTE line_buf = NULL; if (nComponents > 1) { - line_buf = FX_Alloc2D(FX_BYTE, width, nComponents); + line_buf = FX_Alloc2D(uint8_t, width, nComponents); } jpeg_set_defaults(&cinfo); if(quality != 75) { @@ -207,7 +207,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST row = cinfo.next_scanline; jpeg_write_scanlines(&cinfo, row_pointer, 1); if (cinfo.next_scanline == row) { - dest_buf = FX_Realloc(FX_BYTE, dest_buf, dest_buf_length + JPEG_BLOCK_SIZE); + dest_buf = FX_Realloc(uint8_t, dest_buf, dest_buf_length + JPEG_BLOCK_SIZE); dest.next_output_byte = dest_buf + dest_buf_length - dest.free_in_buffer; dest_buf_length += JPEG_BLOCK_SIZE; dest.free_in_buffer += JPEG_BLOCK_SIZE; @@ -404,7 +404,7 @@ FX_BOOL CCodec_JpegDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int wi return FALSE; } m_Pitch = (cinfo.image_width * cinfo.num_components + 3) / 4 * 4; - m_pScanlineBuf = FX_Alloc(FX_BYTE, m_Pitch); + m_pScanlineBuf = FX_Alloc(uint8_t, m_Pitch); m_nComps = cinfo.num_components; m_bpc = 8; m_bColorTransformed = FALSE; @@ -412,7 +412,7 @@ FX_BOOL CCodec_JpegDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int wi return TRUE; } extern "C" { - FX_INT32 FX_GetDownsampleRatio(FX_INT32 originWidth, FX_INT32 originHeight, FX_INT32 downsampleWidth, FX_INT32 downsampleHeight) + int32_t FX_GetDownsampleRatio(int32_t originWidth, int32_t originHeight, int32_t downsampleWidth, int32_t downsampleHeight) { int iratio_w = originWidth / downsampleWidth; int iratio_h = originHeight / downsampleHeight; @@ -564,7 +564,7 @@ void* CCodec_JpegModule::Start() if (m_pExtProvider) { return m_pExtProvider->Start(); } - FXJPEG_Context* p = (FXJPEG_Context*)FX_Alloc(FX_BYTE, sizeof(FXJPEG_Context)); + FXJPEG_Context* p = (FXJPEG_Context*)FX_Alloc(uint8_t, sizeof(FXJPEG_Context)); p->m_AllocFunc = jpeg_alloc_func; p->m_FreeFunc = jpeg_free_func; p->m_ErrMgr.error_exit = _error_fatal1; diff --git a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp index 1a1616c0a1..01faf67a30 100644 --- a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp @@ -714,7 +714,7 @@ FX_BOOL CJPX_Decoder::Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateCo return FALSE; } FXSYS_memset8(dest_buf, 0xff, image->y1 * pitch); - FX_BYTE** channel_bufs = FX_Alloc(FX_BYTE*, image->numcomps); + uint8_t** channel_bufs = FX_Alloc(uint8_t*, image->numcomps); FX_BOOL result = FALSE; int* adjust_comps = FX_Alloc(int, image->numcomps); for (i = 0; i < (int)image->numcomps; i ++) { @@ -742,7 +742,7 @@ FX_BOOL CJPX_Decoder::Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateCo if (adjust_comps[channel] > 0) { *pPixel = 0; } else { - *pPixel = (FX_BYTE)(src << -adjust_comps[channel]); + *pPixel = (uint8_t)(src << -adjust_comps[channel]); } } } @@ -757,7 +757,7 @@ FX_BOOL CJPX_Decoder::Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateCo src = image->comps[channel].data[row * wid + col]; src += image->comps[channel].sgnd ? 1 << (image->comps[channel].prec - 1) : 0; if (adjust_comps[channel] - 1 < 0) { - *pPixel = (FX_BYTE)((src >> adjust_comps[channel])); + *pPixel = (uint8_t)((src >> adjust_comps[channel])); } else { int tmpPixel = (src >> adjust_comps[channel]) + ((src >> (adjust_comps[channel] - 1)) % 2); if (tmpPixel > 255) { @@ -765,7 +765,7 @@ FX_BOOL CJPX_Decoder::Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateCo } else if (tmpPixel < 0) { tmpPixel = 0; } - *pPixel = (FX_BYTE)tmpPixel; + *pPixel = (uint8_t)tmpPixel; } } } diff --git a/core/src/fxcodec/jbig2/JBig2_BitStream.h b/core/src/fxcodec/jbig2/JBig2_BitStream.h index 9d5d29468f..ff0b9fcfeb 100644 --- a/core/src/fxcodec/jbig2/JBig2_BitStream.h +++ b/core/src/fxcodec/jbig2/JBig2_BitStream.h @@ -11,41 +11,41 @@ class CJBig2_BitStream : public CJBig2_Object { public: - CJBig2_BitStream(FX_BYTE *pBuffer, FX_DWORD dwLength); + CJBig2_BitStream(uint8_t *pBuffer, FX_DWORD dwLength); CJBig2_BitStream(CJBig2_BitStream &bs); ~CJBig2_BitStream(); - FX_INT32 readNBits(FX_DWORD nBits, FX_DWORD *dwResult); + int32_t readNBits(FX_DWORD nBits, FX_DWORD *dwResult); - FX_INT32 readNBits(FX_DWORD nBits, FX_INT32 *nResult); + int32_t readNBits(FX_DWORD nBits, int32_t *nResult); - FX_INT32 read1Bit(FX_DWORD *dwResult); + int32_t read1Bit(FX_DWORD *dwResult); - FX_INT32 read1Bit(FX_BOOL *bResult); + int32_t read1Bit(FX_BOOL *bResult); - FX_INT32 read1Byte(FX_BYTE *cResult); + int32_t read1Byte(uint8_t *cResult); - FX_INT32 readInteger(FX_DWORD *dwResult); + int32_t readInteger(FX_DWORD *dwResult); - FX_INT32 readShortInteger(FX_WORD *wResult); + int32_t readShortInteger(FX_WORD *wResult); void alignByte(); void align4Byte(); - FX_BYTE getAt(FX_DWORD dwOffset); + uint8_t getAt(FX_DWORD dwOffset); - FX_BYTE getCurByte(); + uint8_t getCurByte(); - FX_BYTE getNextByte(); + uint8_t getNextByte(); - FX_INT32 incByteIdx(); + int32_t incByteIdx(); - FX_BYTE getCurByte_arith(); + uint8_t getCurByte_arith(); - FX_BYTE getNextByte_arith(); + uint8_t getNextByte_arith(); FX_DWORD getOffset(); @@ -55,21 +55,21 @@ public: void setBitPos(FX_DWORD dwBitPos); - FX_BYTE *getBuf(); + uint8_t *getBuf(); FX_DWORD getLength() { return m_dwLength; } - FX_BYTE *getPointer(); + uint8_t *getPointer(); void offset(FX_DWORD dwOffset); FX_DWORD getByteLeft(); private: - FX_BYTE *m_pBuf; + uint8_t *m_pBuf; FX_DWORD m_dwLength; @@ -77,7 +77,7 @@ private: FX_DWORD m_dwBitIdx; }; -inline CJBig2_BitStream::CJBig2_BitStream(FX_BYTE *pBuffer, FX_DWORD dwLength) +inline CJBig2_BitStream::CJBig2_BitStream(uint8_t *pBuffer, FX_DWORD dwLength) { m_pBuf = pBuffer; m_dwLength = dwLength; @@ -98,7 +98,7 @@ inline CJBig2_BitStream::CJBig2_BitStream(CJBig2_BitStream &bs) inline CJBig2_BitStream::~CJBig2_BitStream() { } -inline FX_INT32 CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_DWORD *dwResult) +inline int32_t CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_DWORD *dwResult) { FX_DWORD dwTemp = (m_dwByteIdx << 3) + m_dwBitIdx; if(dwTemp <= (m_dwLength << 3)) { @@ -123,7 +123,7 @@ inline FX_INT32 CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_DWORD *dwResult) return -1; } } -inline FX_INT32 CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_INT32 *nResult) +inline int32_t CJBig2_BitStream::readNBits(FX_DWORD dwBits, int32_t *nResult) { FX_DWORD dwTemp = (m_dwByteIdx << 3) + m_dwBitIdx; if(dwTemp <= (m_dwLength << 3)) { @@ -149,7 +149,7 @@ inline FX_INT32 CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_INT32 *nResult) } } -inline FX_INT32 CJBig2_BitStream::read1Bit(FX_DWORD *dwResult) +inline int32_t CJBig2_BitStream::read1Bit(FX_DWORD *dwResult) { if(m_dwByteIdx < m_dwLength) { *dwResult = (m_pBuf[m_dwByteIdx] >> (7 - m_dwBitIdx)) & 0x01; @@ -165,7 +165,7 @@ inline FX_INT32 CJBig2_BitStream::read1Bit(FX_DWORD *dwResult) } } -inline FX_INT32 CJBig2_BitStream::read1Bit(FX_BOOL *bResult) +inline int32_t CJBig2_BitStream::read1Bit(FX_BOOL *bResult) { if(m_dwByteIdx < m_dwLength) { *bResult = (m_pBuf[m_dwByteIdx] >> (7 - m_dwBitIdx)) & 0x01; @@ -180,7 +180,7 @@ inline FX_INT32 CJBig2_BitStream::read1Bit(FX_BOOL *bResult) return -1; } } -inline FX_INT32 CJBig2_BitStream::read1Byte(FX_BYTE *cResult) +inline int32_t CJBig2_BitStream::read1Byte(uint8_t *cResult) { if(m_dwByteIdx < m_dwLength) { *cResult = m_pBuf[m_dwByteIdx]; @@ -191,7 +191,7 @@ inline FX_INT32 CJBig2_BitStream::read1Byte(FX_BYTE *cResult) } } -inline FX_INT32 CJBig2_BitStream::readInteger(FX_DWORD *dwResult) +inline int32_t CJBig2_BitStream::readInteger(FX_DWORD *dwResult) { if(m_dwByteIdx + 3 < m_dwLength) { *dwResult = (m_pBuf[m_dwByteIdx] << 24) | (m_pBuf[m_dwByteIdx + 1] << 16) @@ -203,7 +203,7 @@ inline FX_INT32 CJBig2_BitStream::readInteger(FX_DWORD *dwResult) } } -inline FX_INT32 CJBig2_BitStream::readShortInteger(FX_WORD *dwResult) +inline int32_t CJBig2_BitStream::readShortInteger(FX_WORD *dwResult) { if(m_dwByteIdx + 1 < m_dwLength) { *dwResult = (m_pBuf[m_dwByteIdx] << 8) | m_pBuf[m_dwByteIdx + 1]; @@ -228,7 +228,7 @@ inline void CJBig2_BitStream::align4Byte() } m_dwByteIdx = (m_dwByteIdx + 3) & -4; } -inline FX_BYTE CJBig2_BitStream::getAt(FX_DWORD dwOffset) +inline uint8_t CJBig2_BitStream::getAt(FX_DWORD dwOffset) { if(dwOffset < m_dwLength) { return m_pBuf[dwOffset]; @@ -236,7 +236,7 @@ inline FX_BYTE CJBig2_BitStream::getAt(FX_DWORD dwOffset) return 0; } } -inline FX_BYTE CJBig2_BitStream::getCurByte() +inline uint8_t CJBig2_BitStream::getCurByte() { if(m_dwByteIdx < m_dwLength) { return m_pBuf[m_dwByteIdx]; @@ -244,7 +244,7 @@ inline FX_BYTE CJBig2_BitStream::getCurByte() return 0; } } -inline FX_BYTE CJBig2_BitStream::getNextByte() +inline uint8_t CJBig2_BitStream::getNextByte() { if(m_dwByteIdx + 1 < m_dwLength) { return m_pBuf[m_dwByteIdx + 1]; @@ -252,7 +252,7 @@ inline FX_BYTE CJBig2_BitStream::getNextByte() return 0; } } -inline FX_INT32 CJBig2_BitStream::incByteIdx() +inline int32_t CJBig2_BitStream::incByteIdx() { if(m_dwByteIdx < m_dwLength) { m_dwByteIdx ++; @@ -261,7 +261,7 @@ inline FX_INT32 CJBig2_BitStream::incByteIdx() return -1; } } -inline FX_BYTE CJBig2_BitStream::getCurByte_arith() +inline uint8_t CJBig2_BitStream::getCurByte_arith() { if(m_dwByteIdx < m_dwLength) { return m_pBuf[m_dwByteIdx]; @@ -269,7 +269,7 @@ inline FX_BYTE CJBig2_BitStream::getCurByte_arith() return 0xff; } } -inline FX_BYTE CJBig2_BitStream::getNextByte_arith() +inline uint8_t CJBig2_BitStream::getNextByte_arith() { if(m_dwByteIdx + 1 < m_dwLength) { return m_pBuf[m_dwByteIdx + 1]; @@ -297,11 +297,11 @@ inline void CJBig2_BitStream::setBitPos(FX_DWORD dwBitPos) m_dwByteIdx = dwBitPos >> 3; m_dwBitIdx = dwBitPos & 7; } -inline FX_BYTE *CJBig2_BitStream::getBuf() +inline uint8_t *CJBig2_BitStream::getBuf() { return m_pBuf; } -inline FX_BYTE *CJBig2_BitStream::getPointer() +inline uint8_t *CJBig2_BitStream::getPointer() { return m_pBuf + m_dwByteIdx; } diff --git a/core/src/fxcodec/jbig2/JBig2_Context.cpp b/core/src/fxcodec/jbig2/JBig2_Context.cpp index bcd16e7e14..1c7592778d 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Context.cpp @@ -23,8 +23,8 @@ void OutputBitmap(CJBig2_Image* pImage) return; } } -CJBig2_Context *CJBig2_Context::CreateContext(CJBig2_Module *pModule, FX_BYTE *pGlobalData, FX_DWORD dwGlobalLength, - FX_BYTE *pData, FX_DWORD dwLength, FX_INT32 nStreamType, std::list* pSymbolDictCache, IFX_Pause* pPause) +CJBig2_Context *CJBig2_Context::CreateContext(CJBig2_Module *pModule, uint8_t *pGlobalData, FX_DWORD dwGlobalLength, + uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std::list* pSymbolDictCache, IFX_Pause* pPause) { return new(pModule)CJBig2_Context(pGlobalData, dwGlobalLength, pData, dwLength, nStreamType, pSymbolDictCache, pPause); } @@ -34,8 +34,8 @@ void CJBig2_Context::DestroyContext(CJBig2_Context *pContext) delete pContext; } } -CJBig2_Context::CJBig2_Context(FX_BYTE *pGlobalData, FX_DWORD dwGlobalLength, - FX_BYTE *pData, FX_DWORD dwLength, FX_INT32 nStreamType, std::list* pSymbolDictCache, IFX_Pause* pPause) +CJBig2_Context::CJBig2_Context(uint8_t *pGlobalData, FX_DWORD dwGlobalLength, + uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std::list* pSymbolDictCache, IFX_Pause* pPause) { if(pGlobalData && (dwGlobalLength > 0)) { JBIG2_ALLOC(m_pGlobalContext, CJBig2_Context(NULL, 0, pGlobalData, dwGlobalLength, @@ -96,12 +96,12 @@ CJBig2_Context::~CJBig2_Context() } m_pSegmentList = NULL; } -FX_INT32 CJBig2_Context::decodeFile(IFX_Pause* pPause) +int32_t CJBig2_Context::decodeFile(IFX_Pause* pPause) { - FX_BYTE cFlags; + uint8_t cFlags; FX_DWORD dwTemp; - const FX_BYTE fileID[] = {0x97, 0x4A, 0x42, 0x32, 0x0D, 0x0A, 0x1A, 0x0A}; - FX_INT32 nRet; + const uint8_t fileID[] = {0x97, 0x4A, 0x42, 0x32, 0x0D, 0x0A, 0x1A, 0x0A}; + int32_t nRet; if(m_pStream->getByteLeft() < 8) { m_pModule->JBig2_Error("file header too short."); nRet = JBIG2_ERROR_TOO_SHORT; @@ -139,9 +139,9 @@ FX_INT32 CJBig2_Context::decodeFile(IFX_Pause* pPause) failed: return nRet; } -FX_INT32 CJBig2_Context::decode_SquentialOrgnazation(IFX_Pause* pPause) +int32_t CJBig2_Context::decode_SquentialOrgnazation(IFX_Pause* pPause) { - FX_INT32 nRet; + int32_t nRet; if(m_pStream->getByteLeft() > 0) { while(m_pStream->getByteLeft() >= JBIG2_MIN_SEGMENT_SIZE) { if(m_pSegment == NULL) { @@ -189,14 +189,14 @@ FX_INT32 CJBig2_Context::decode_SquentialOrgnazation(IFX_Pause* pPause) } return JBIG2_SUCCESS; } -FX_INT32 CJBig2_Context::decode_EmbedOrgnazation(IFX_Pause* pPause) +int32_t CJBig2_Context::decode_EmbedOrgnazation(IFX_Pause* pPause) { return decode_SquentialOrgnazation(pPause); } -FX_INT32 CJBig2_Context::decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause) +int32_t CJBig2_Context::decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause) { CJBig2_Segment *pSegment; - FX_INT32 nRet; + int32_t nRet; while(m_pStream->getByteLeft() > JBIG2_MIN_SEGMENT_SIZE) { JBIG2_ALLOC(pSegment, CJBig2_Segment()); nRet = parseSegmentHeader(pSegment); @@ -217,9 +217,9 @@ FX_INT32 CJBig2_Context::decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause) m_nSegmentDecoded = 0; return decode_RandomOrgnazation(pPause); } -FX_INT32 CJBig2_Context::decode_RandomOrgnazation(IFX_Pause* pPause) +int32_t CJBig2_Context::decode_RandomOrgnazation(IFX_Pause* pPause) { - FX_INT32 nRet; + int32_t nRet; for(; m_nSegmentDecoded < m_pSegmentList->getLength(); m_nSegmentDecoded++) { nRet = parseSegmentData(m_pSegmentList->getAt(m_nSegmentDecoded), pPause); if((nRet == JBIG2_END_OF_PAGE) || (nRet == JBIG2_END_OF_FILE)) { @@ -235,9 +235,9 @@ FX_INT32 CJBig2_Context::decode_RandomOrgnazation(IFX_Pause* pPause) } return JBIG2_SUCCESS; } -FX_INT32 CJBig2_Context::getFirstPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT32 stride, IFX_Pause* pPause) +int32_t CJBig2_Context::getFirstPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t stride, IFX_Pause* pPause) { - FX_INT32 nRet = 0; + int32_t nRet = 0; if(m_pGlobalContext) { nRet = m_pGlobalContext->decode_EmbedOrgnazation(pPause); if(nRet != JBIG2_SUCCESS) { @@ -260,10 +260,10 @@ FX_INT32 CJBig2_Context::getFirstPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 he int ret = Continue(pPause); return ret; } -FX_INT32 CJBig2_Context::Continue(IFX_Pause* pPause) +int32_t CJBig2_Context::Continue(IFX_Pause* pPause) { m_ProcessiveStatus = FXCODEC_STATUS_DECODE_READY; - FX_INT32 nRet; + int32_t nRet; if(m_PauseStep <= 1) { switch(m_nStreamType) { case JBIG2_FILE_STREAM: @@ -311,9 +311,9 @@ FX_INT32 CJBig2_Context::Continue(IFX_Pause* pPause) } return nRet; } -FX_INT32 CJBig2_Context::getNextPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT32 stride, IFX_Pause* pPause) +int32_t CJBig2_Context::getNextPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t stride, IFX_Pause* pPause) { - FX_INT32 nRet = JBIG2_ERROR_STREAM_TYPE; + int32_t nRet = JBIG2_ERROR_STREAM_TYPE; m_bFirstPage = FALSE; m_PauseStep = 0; if(m_pPage) { @@ -345,9 +345,9 @@ FX_INT32 CJBig2_Context::getNextPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 hei } return nRet; } -FX_INT32 CJBig2_Context::getFirstPage(CJBig2_Image **image, IFX_Pause* pPause) +int32_t CJBig2_Context::getFirstPage(CJBig2_Image **image, IFX_Pause* pPause) { - FX_INT32 nRet; + int32_t nRet; m_bFirstPage = TRUE; m_PauseStep = 0; if(m_pGlobalContext) { @@ -359,9 +359,9 @@ FX_INT32 CJBig2_Context::getFirstPage(CJBig2_Image **image, IFX_Pause* pPause) m_bBufSpecified = FALSE; return Continue(pPause); } -FX_INT32 CJBig2_Context::getNextPage(CJBig2_Image **image, IFX_Pause* pPause) +int32_t CJBig2_Context::getNextPage(CJBig2_Image **image, IFX_Pause* pPause) { - FX_INT32 nRet; + int32_t nRet; m_bBufSpecified = FALSE; m_bFirstPage = FALSE; m_PauseStep = 0; @@ -391,7 +391,7 @@ FX_INT32 CJBig2_Context::getNextPage(CJBig2_Image **image, IFX_Pause* pPause) CJBig2_Segment *CJBig2_Context::findSegmentByNumber(FX_DWORD dwNumber) { CJBig2_Segment *pSeg; - FX_INT32 i; + int32_t i; if(m_pGlobalContext) { pSeg = m_pGlobalContext->findSegmentByNumber(dwNumber); if(pSeg) { @@ -407,10 +407,10 @@ CJBig2_Segment *CJBig2_Context::findSegmentByNumber(FX_DWORD dwNumber) return NULL; } CJBig2_Segment *CJBig2_Context::findReferredSegmentByTypeAndIndex(CJBig2_Segment *pSegment, - FX_BYTE cType, FX_INT32 nIndex) + uint8_t cType, int32_t nIndex) { CJBig2_Segment *pSeg; - FX_INT32 i, count; + int32_t i, count; count = 0; for(i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { pSeg = findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]); @@ -424,10 +424,10 @@ CJBig2_Segment *CJBig2_Context::findReferredSegmentByTypeAndIndex(CJBig2_Segment } return NULL; } -FX_INT32 CJBig2_Context::parseSegmentHeader(CJBig2_Segment *pSegment) +int32_t CJBig2_Context::parseSegmentHeader(CJBig2_Segment *pSegment) { - FX_BYTE cSSize, cPSize; - FX_BYTE cTemp; + uint8_t cSSize, cPSize; + uint8_t cTemp; FX_WORD wTemp; FX_DWORD dwTemp; if((m_pStream->readInteger(&pSegment->m_dwNumber) != 0) @@ -457,7 +457,7 @@ FX_INT32 CJBig2_Context::parseSegmentHeader(CJBig2_Segment *pSegment) if(pSegment->m_nReferred_to_segment_count) { pSegment->m_pReferred_to_segment_numbers = (FX_DWORD*)m_pModule->JBig2_Malloc2( sizeof(FX_DWORD), pSegment->m_nReferred_to_segment_count); - for(FX_INT32 i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { + for(int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { switch(cSSize) { case 1: if(m_pStream->read1Byte(&cTemp) != 0) { @@ -504,15 +504,15 @@ failed: m_pModule->JBig2_Error("header too short."); return JBIG2_ERROR_TOO_SHORT; } -FX_INT32 CJBig2_Context::parseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause) +int32_t CJBig2_Context::parseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause) { - FX_INT32 ret = ProcessiveParseSegmentData(pSegment, pPause); + int32_t ret = ProcessiveParseSegmentData(pSegment, pPause); while(m_ProcessiveStatus == FXCODEC_STATUS_DECODE_TOBECONTINUE && m_pStream->getByteLeft() > 0) { ret = ProcessiveParseSegmentData(pSegment, pPause); } return ret; } -FX_INT32 CJBig2_Context::ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause) +int32_t CJBig2_Context::ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause) { switch(pSegment->m_cFlags.s.type) { case 0: @@ -613,13 +613,13 @@ failed2: m_pModule->JBig2_Error("segment syntax error."); return JBIG2_ERROR_FETAL; } -FX_INT32 CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPause) +int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPause) { FX_DWORD dwTemp; FX_WORD wFlags; - FX_BYTE cSDHUFFDH, cSDHUFFDW, cSDHUFFBMSIZE, cSDHUFFAGGINST; + uint8_t cSDHUFFDH, cSDHUFFDW, cSDHUFFBMSIZE, cSDHUFFAGGINST; CJBig2_HuffmanTable *Table_B1 = NULL, *Table_B2 = NULL, *Table_B3 = NULL, *Table_B4 = NULL, *Table_B5 = NULL; - FX_INT32 i, nIndex, nRet; + int32_t i, nIndex, nRet; CJBig2_Segment *pSeg = NULL, *pLRSeg = NULL; FX_BOOL bUsed; CJBig2_Image ** SDINSYMS = NULL; @@ -627,7 +627,7 @@ FX_INT32 CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pP JBig2ArithCtx *gbContext = NULL, *grContext = NULL; CJBig2_ArithDecoder *pArithDecoder; JBIG2_ALLOC(pSymbolDictDecoder, CJBig2_SDDProc()); - FX_BYTE *key = pSegment->m_pData; + uint8_t *key = pSegment->m_pData; FX_BOOL cache_hit = false; if(m_pStream->readShortInteger(&wFlags) != 0) { m_pModule->JBig2_Error("symbol dictionary segment : data header too short."); @@ -648,8 +648,8 @@ FX_INT32 CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pP } else { dwTemp = 2; } - for(i = 0; i < (FX_INT32)dwTemp; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&pSymbolDictDecoder->SDAT[i]) != 0) { + for(i = 0; i < (int32_t)dwTemp; i++) { + if(m_pStream->read1Byte((uint8_t*)&pSymbolDictDecoder->SDAT[i]) != 0) { m_pModule->JBig2_Error("symbol dictionary segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -658,7 +658,7 @@ FX_INT32 CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pP } if((pSymbolDictDecoder->SDREFAGG == 1) && (pSymbolDictDecoder->SDRTEMPLATE == 0)) { for(i = 0; i < 4; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&pSymbolDictDecoder->SDRAT[i]) != 0) { + if(m_pStream->read1Byte((uint8_t*)&pSymbolDictDecoder->SDRAT[i]) != 0) { m_pModule->JBig2_Error("symbol dictionary segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -917,12 +917,12 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment) { FX_DWORD dwTemp; FX_WORD wFlags; - FX_INT32 i, nIndex, nRet; + int32_t i, nIndex, nRet; JBig2RegionInfo ri; CJBig2_Segment *pSeg; CJBig2_Image **SBSYMS = NULL; JBig2HuffmanCode *SBSYMCODES = NULL; - FX_BYTE cSBHUFFFS, cSBHUFFDS, cSBHUFFDT, cSBHUFFRDW, cSBHUFFRDH, cSBHUFFRDX, cSBHUFFRDY, cSBHUFFRSIZE; + uint8_t cSBHUFFFS, cSBHUFFDS, cSBHUFFDT, cSBHUFFRDW, cSBHUFFRDH, cSBHUFFRDX, cSBHUFFRDY, cSBHUFFRSIZE; CJBig2_HuffmanTable *Table_B1 = NULL, *Table_B6 = NULL, *Table_B7 = NULL, @@ -976,7 +976,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment) } if((pTRD->SBREFINE == 1) && (pTRD->SBRTEMPLATE == 0)) { for(i = 0; i < 4; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&pTRD->SBRAT[i]) != 0) { + if(m_pStream->read1Byte((uint8_t*)&pTRD->SBRAT[i]) != 0) { m_pModule->JBig2_Error("text region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -1032,7 +1032,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment) while((FX_DWORD)(1 << dwTemp) < pTRD->SBNUMSYMS) { dwTemp ++; } - pTRD->SBSYMCODELEN = (FX_BYTE)dwTemp; + pTRD->SBSYMCODELEN = (uint8_t)dwTemp; } if(pTRD->SBHUFF == 1) { if((cSBHUFFFS == 2) || (cSBHUFFRDW == 2) || (cSBHUFFRDH == 2) @@ -1326,11 +1326,11 @@ failed: FX_BOOL CJBig2_Context::parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pPause) { FX_DWORD dwTemp; - FX_BYTE cFlags; + uint8_t cFlags; JBig2ArithCtx *gbContext; CJBig2_ArithDecoder *pArithDecoder; CJBig2_PDDProc *pPDD; - FX_INT32 nRet; + int32_t nRet; JBIG2_ALLOC(pPDD, CJBig2_PDDProc()); if((m_pStream->read1Byte(&cFlags) != 0) || (m_pStream->read1Byte(&pPDD->HDPW) != 0) @@ -1380,14 +1380,14 @@ failed: FX_BOOL CJBig2_Context::parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause) { FX_DWORD dwTemp; - FX_BYTE cFlags; + uint8_t cFlags; JBig2RegionInfo ri; CJBig2_Segment *pSeg; CJBig2_PatternDict *pPatternDict; JBig2ArithCtx *gbContext; CJBig2_ArithDecoder *pArithDecoder; CJBig2_HTRDProc *pHRD; - FX_INT32 nRet; + int32_t nRet; JBIG2_ALLOC(pHRD, CJBig2_HTRDProc()); if((parseRegionInfo(&ri) != JBIG2_SUCCESS) || (m_pStream->read1Byte(&cFlags) != 0) @@ -1474,8 +1474,8 @@ failed: FX_BOOL CJBig2_Context::parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause) { FX_DWORD dwTemp; - FX_BYTE cFlags; - FX_INT32 i, nRet; + uint8_t cFlags; + int32_t i, nRet; if(m_pGRD == NULL) { JBIG2_ALLOC(m_pGRD, CJBig2_GRDProc()); if((parseRegionInfo(&m_ri) != JBIG2_SUCCESS) @@ -1497,7 +1497,7 @@ FX_BOOL CJBig2_Context::parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* if(m_pGRD->MMR == 0) { if(m_pGRD->GBTEMPLATE == 0) { for(i = 0; i < 8; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&m_pGRD->GBAT[i]) != 0) { + if(m_pStream->read1Byte((uint8_t*)&m_pGRD->GBAT[i]) != 0) { m_pModule->JBig2_Error("generic region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -1505,7 +1505,7 @@ FX_BOOL CJBig2_Context::parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* } } else { for(i = 0; i < 2; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&m_pGRD->GBAT[i]) != 0) { + if(m_pStream->read1Byte((uint8_t*)&m_pGRD->GBAT[i]) != 0) { m_pModule->JBig2_Error("generic region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -1593,8 +1593,8 @@ FX_BOOL CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment *pSegment) FX_DWORD dwTemp; JBig2RegionInfo ri; CJBig2_Segment *pSeg; - FX_INT32 i, nRet; - FX_BYTE cFlags; + int32_t i, nRet; + uint8_t cFlags; JBig2ArithCtx *grContext; CJBig2_GRRDProc *pGRRD; CJBig2_ArithDecoder *pArithDecoder; @@ -1611,7 +1611,7 @@ FX_BOOL CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment *pSegment) pGRRD->TPGRON = (cFlags >> 1) & 0x01; if(pGRRD->GRTEMPLATE == 0) { for(i = 0; i < 4; i++) { - if(m_pStream->read1Byte((FX_BYTE*)&pGRRD->GRAT[i]) != 0) { + if(m_pStream->read1Byte((uint8_t*)&pGRRD->GRAT[i]) != 0) { m_pModule->JBig2_Error("generic refinement region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; @@ -1687,7 +1687,7 @@ FX_BOOL CJBig2_Context::parseTable(CJBig2_Segment *pSegment) m_pStream->alignByte(); return JBIG2_SUCCESS; } -FX_INT32 CJBig2_Context::parseRegionInfo(JBig2RegionInfo *pRI) +int32_t CJBig2_Context::parseRegionInfo(JBig2RegionInfo *pRI) { if((m_pStream->readInteger((FX_DWORD*)&pRI->width) != 0) || (m_pStream->readInteger((FX_DWORD*)&pRI->height) != 0) @@ -1702,9 +1702,9 @@ JBig2HuffmanCode *CJBig2_Context::decodeSymbolIDHuffmanTable(CJBig2_BitStream *p FX_DWORD SBNUMSYMS) { JBig2HuffmanCode *SBSYMCODES; - FX_INT32 runcodes[35], runcodes_len[35], runcode; - FX_INT32 i, j, nTemp, nVal, nBits; - FX_INT32 run; + int32_t runcodes[35], runcodes_len[35], runcode; + int32_t i, j, nTemp, nVal, nBits; + int32_t run; SBSYMCODES = (JBig2HuffmanCode*)m_pModule->JBig2_Malloc2(sizeof(JBig2HuffmanCode), SBNUMSYMS); for (i = 0; i < 35; i ++) { if(pStream->readNBits(4, &runcodes_len[i]) != 0) { diff --git a/core/src/fxcodec/jbig2/JBig2_Context.h b/core/src/fxcodec/jbig2/JBig2_Context.h index f46530e005..b12853accf 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.h +++ b/core/src/fxcodec/jbig2/JBig2_Context.h @@ -14,7 +14,7 @@ #include "../../../include/fxcodec/fx_codec_def.h" #include "../../../include/fxcrt/fx_basic.h" #include -typedef std::pair CJBig2_CachePair; +typedef std::pair CJBig2_CachePair; typedef enum { JBIG2_OUT_OF_PAGE = 0, JBIG2_IN_PAGE, @@ -37,64 +37,64 @@ class CJBig2_Context : public CJBig2_Object { public: - static CJBig2_Context *CreateContext(CJBig2_Module *pModule, FX_BYTE *pGlobalData, FX_DWORD dwGlobalLength, - FX_BYTE *pData, FX_DWORD dwLength, FX_INT32 nStreamType, std::list* pSymbolDictCache, IFX_Pause* pPause = NULL); + static CJBig2_Context *CreateContext(CJBig2_Module *pModule, uint8_t *pGlobalData, FX_DWORD dwGlobalLength, + uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std::list* pSymbolDictCache, IFX_Pause* pPause = NULL); static void DestroyContext(CJBig2_Context *pContext); - FX_INT32 getFirstPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT32 stride, IFX_Pause* pPause); + int32_t getFirstPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t stride, IFX_Pause* pPause); - FX_INT32 getNextPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT32 stride, IFX_Pause* pPause); + int32_t getNextPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t stride, IFX_Pause* pPause); - FX_INT32 getFirstPage(CJBig2_Image **image, IFX_Pause* pPause); + int32_t getFirstPage(CJBig2_Image **image, IFX_Pause* pPause); - FX_INT32 getNextPage(CJBig2_Image **image, IFX_Pause* pPause); - FX_INT32 Continue(IFX_Pause* pPause); + int32_t getNextPage(CJBig2_Image **image, IFX_Pause* pPause); + int32_t Continue(IFX_Pause* pPause); FXCODEC_STATUS GetProcessiveStatus() { return m_ProcessiveStatus; }; private: - CJBig2_Context(FX_BYTE *pGlobalData, FX_DWORD dwGlobalLength, - FX_BYTE *pData, FX_DWORD dwLength, FX_INT32 nStreamType, std::list* pSymbolDictCache, IFX_Pause* pPause); + CJBig2_Context(uint8_t *pGlobalData, FX_DWORD dwGlobalLength, + uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std::list* pSymbolDictCache, IFX_Pause* pPause); ~CJBig2_Context(); - FX_INT32 decodeFile(IFX_Pause* pPause); + int32_t decodeFile(IFX_Pause* pPause); - FX_INT32 decode_SquentialOrgnazation(IFX_Pause* pPause); + int32_t decode_SquentialOrgnazation(IFX_Pause* pPause); - FX_INT32 decode_EmbedOrgnazation(IFX_Pause* pPause); + int32_t decode_EmbedOrgnazation(IFX_Pause* pPause); - FX_INT32 decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause); + int32_t decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause); - FX_INT32 decode_RandomOrgnazation(IFX_Pause* pPause); + int32_t decode_RandomOrgnazation(IFX_Pause* pPause); CJBig2_Segment *findSegmentByNumber(FX_DWORD dwNumber); - CJBig2_Segment *findReferredSegmentByTypeAndIndex(CJBig2_Segment *pSegment, FX_BYTE cType, FX_INT32 nIndex); + CJBig2_Segment *findReferredSegmentByTypeAndIndex(CJBig2_Segment *pSegment, uint8_t cType, int32_t nIndex); - FX_INT32 parseSegmentHeader(CJBig2_Segment *pSegment); + int32_t parseSegmentHeader(CJBig2_Segment *pSegment); - FX_INT32 parseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 parseTextRegion(CJBig2_Segment *pSegment); + int32_t parseTextRegion(CJBig2_Segment *pSegment); - FX_INT32 parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause); - FX_INT32 parseGenericRefinementRegion(CJBig2_Segment *pSegment); + int32_t parseGenericRefinementRegion(CJBig2_Segment *pSegment); - FX_INT32 parseTable(CJBig2_Segment *pSegment); + int32_t parseTable(CJBig2_Segment *pSegment); - FX_INT32 parseRegionInfo(JBig2RegionInfo *pRI); + int32_t parseRegionInfo(JBig2RegionInfo *pRI); @@ -108,11 +108,11 @@ private: CJBig2_Context *m_pGlobalContext; - FX_INT32 m_nStreamType; + int32_t m_nStreamType; CJBig2_BitStream *m_pStream; - FX_INT32 m_nState; + int32_t m_nState; CJBig2_List *m_pSegmentList; @@ -122,9 +122,9 @@ private: FX_BOOL m_bBufSpecified; - FX_INT32 m_nSegmentDecoded; + int32_t m_nSegmentDecoded; IFX_Pause* m_pPause; - FX_INT32 m_PauseStep; + int32_t m_PauseStep; FXCODEC_STATUS m_ProcessiveStatus; FX_BOOL m_bFirstPage; CJBig2_ArithDecoder *m_pArithDecoder; diff --git a/core/src/fxcodec/jbig2/JBig2_Define.h b/core/src/fxcodec/jbig2/JBig2_Define.h index ccf15d07ba..46c6e2b532 100644 --- a/core/src/fxcodec/jbig2/JBig2_Define.h +++ b/core/src/fxcodec/jbig2/JBig2_Define.h @@ -13,15 +13,15 @@ #include "JBig2_Object.h" #define JBIG2_OOB 1 typedef struct { - FX_INT32 width, + int32_t width, height; - FX_INT32 x, + int32_t x, y; - FX_BYTE flags; + uint8_t flags; } JBig2RegionInfo; typedef struct { - FX_INT32 codelen; - FX_INT32 code; + int32_t codelen; + int32_t code; } JBig2HuffmanCode; extern "C" { void _FaxG4Decode(void *pModule, FX_LPCBYTE src_buf, FX_DWORD src_size, int* pbitpos, FX_LPBYTE dest_buf, int width, int height, int pitch = 0); diff --git a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp index a5928f9ea3..bad595e6b7 100644 --- a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp +++ b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp @@ -150,9 +150,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_opt2(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, cVal; - FX_INTPTR nStride, nStride2; - FX_INT32 nBits, k; + uint8_t *pLine, cVal; + intptr_t nStride, nStride2; + int32_t nBits, k; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -217,9 +217,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_opt3(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine, *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -401,9 +401,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_opt2(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, cVal; - FX_INTPTR nStride, nStride2; - FX_INT32 nBits, k; + uint8_t *pLine, cVal; + intptr_t nStride, nStride2; + int32_t nBits, k; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -468,9 +468,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_opt3(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine, *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -647,9 +647,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_opt2(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, cVal; - FX_INTPTR nStride, nStride2; - FX_INT32 nBits, k; + uint8_t *pLine, cVal; + intptr_t nStride, nStride2; + int32_t nBits, k; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -714,9 +714,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_opt3(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; - FX_BYTE *pLine, *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine, *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -887,9 +887,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_opt2(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1; - FX_BYTE *pLine, cVal; - FX_INTPTR nStride; - FX_INT32 nBits, k; + uint8_t *pLine, cVal; + intptr_t nStride; + int32_t nBits, k; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -945,9 +945,9 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_opt3(CJBig2_ArithDecoder *p FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1; - FX_BYTE *pLine, *pLine1, cVal; - FX_INT32 nStride, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine, *pLine1, cVal; + int32_t nStride, k; + int32_t nLineBytes, nBitsLeft, cc; LTP = 0; JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { @@ -1428,13 +1428,13 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithD FX_DWORD CONTEXT; CJBig2_Image *GRREG; FX_DWORD line1, line1_r, line2_r, line3_r; - FX_BYTE *pLine, *pLineR, cVal; - FX_INTPTR nStride, nStrideR, nOffset; - FX_INT32 k, nBits; - FX_INT32 GRWR, GRHR; - FX_INT32 GRW, GRH; - GRW = (FX_INT32)CJBig2_GRRDProc::GRW; - GRH = (FX_INT32)CJBig2_GRRDProc::GRH; + uint8_t *pLine, *pLineR, cVal; + intptr_t nStride, nStrideR, nOffset; + int32_t k, nBits; + int32_t GRWR, GRHR; + int32_t GRW, GRH; + GRW = (int32_t)CJBig2_GRRDProc::GRW; + GRH = (int32_t)CJBig2_GRRDProc::GRH; LTP = 0; JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH)); if (GRREG->m_pData == NULL) { @@ -1446,19 +1446,19 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithD pLineR = GRREFERENCE->m_pData; nStride = GRREG->m_nStride; nStrideR = GRREFERENCE->m_nStride; - GRWR = (FX_INT32)GRREFERENCE->m_nWidth; - GRHR = (FX_INT32)GRREFERENCE->m_nHeight; + GRWR = (int32_t)GRREFERENCE->m_nWidth; + GRHR = (int32_t)GRREFERENCE->m_nHeight; if (GRREFERENCEDY < -GRHR + 1 || GRREFERENCEDY > GRHR - 1) { GRREFERENCEDY = 0; } nOffset = -GRREFERENCEDY * nStrideR; - for (FX_INT32 h = 0; h < GRH; h++) { + for (int32_t h = 0; h < GRH; h++) { if(TPGRON) { SLTP = pArithDecoder->DECODE(&grContext[0x0010]); LTP = LTP ^ SLTP; } line1 = (h > 0) ? pLine[-nStride] << 4 : 0; - FX_INT32 reference_h = h - GRREFERENCEDY; + int32_t reference_h = h - GRREFERENCEDY; FX_BOOL line1_r_ok = (reference_h > 0 && reference_h < GRHR + 1); FX_BOOL line2_r_ok = (reference_h > -1 && reference_h < GRHR); FX_BOOL line3_r_ok = (reference_h > -2 && reference_h < GRHR - 1); @@ -1468,7 +1468,7 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithD if(LTP == 0) { CONTEXT = (line1 & 0x1c00) | (line1_r & 0x01c0) | ((line2_r >> 3) & 0x0038) | ((line3_r >> 6) & 0x0007); - for (FX_INT32 w = 0; w < GRW; w += 8) { + for (int32_t w = 0; w < GRW; w += 8) { nBits = GRW - w > 8 ? 8 : GRW - w; if (h > 0) line1 = (line1 << 8) | @@ -1506,7 +1506,7 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithD } else { CONTEXT = (line1 & 0x1c00) | (line1_r & 0x01c0) | ((line2_r >> 3) & 0x0038) | ((line3_r >> 6) & 0x0007); - for (FX_INT32 w = 0; w < GRW; w += 8) { + for (int32_t w = 0; w < GRW; w += 8) { nBits = GRW - w > 8 ? 8 : GRW - w; if (h > 0) line1 = (line1 << 8) | @@ -1637,13 +1637,13 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithD FX_DWORD CONTEXT; CJBig2_Image *GRREG; FX_DWORD line1, line1_r, line2_r, line3_r; - FX_BYTE *pLine, *pLineR, cVal; - FX_INTPTR nStride, nStrideR, nOffset; - FX_INT32 k, nBits; - FX_INT32 GRWR, GRHR; - FX_INT32 GRW, GRH; - GRW = (FX_INT32)CJBig2_GRRDProc::GRW; - GRH = (FX_INT32)CJBig2_GRRDProc::GRH; + uint8_t *pLine, *pLineR, cVal; + intptr_t nStride, nStrideR, nOffset; + int32_t k, nBits; + int32_t GRWR, GRHR; + int32_t GRW, GRH; + GRW = (int32_t)CJBig2_GRRDProc::GRW; + GRH = (int32_t)CJBig2_GRRDProc::GRH; LTP = 0; JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH)); if (GRREG->m_pData == NULL) { @@ -1655,19 +1655,19 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithD pLineR = GRREFERENCE->m_pData; nStride = GRREG->m_nStride; nStrideR = GRREFERENCE->m_nStride; - GRWR = (FX_INT32)GRREFERENCE->m_nWidth; - GRHR = (FX_INT32)GRREFERENCE->m_nHeight; + GRWR = (int32_t)GRREFERENCE->m_nWidth; + GRHR = (int32_t)GRREFERENCE->m_nHeight; if (GRREFERENCEDY < -GRHR + 1 || GRREFERENCEDY > GRHR - 1) { GRREFERENCEDY = 0; } nOffset = -GRREFERENCEDY * nStrideR; - for (FX_INT32 h = 0; h < GRH; h++) { + for (int32_t h = 0; h < GRH; h++) { if(TPGRON) { SLTP = pArithDecoder->DECODE(&grContext[0x0008]); LTP = LTP ^ SLTP; } line1 = (h > 0) ? pLine[-nStride] << 1 : 0; - FX_INT32 reference_h = h - GRREFERENCEDY; + int32_t reference_h = h - GRREFERENCEDY; FX_BOOL line1_r_ok = (reference_h > 0 && reference_h < GRHR + 1); FX_BOOL line2_r_ok = (reference_h > -1 && reference_h < GRHR); FX_BOOL line3_r_ok = (reference_h > -2 && reference_h < GRHR - 1); @@ -1677,7 +1677,7 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithD if(LTP == 0) { CONTEXT = (line1 & 0x0380) | ((line1_r >> 2) & 0x0020) | ((line2_r >> 4) & 0x001c) | ((line3_r >> 6) & 0x0003); - for (FX_INT32 w = 0; w < GRW; w += 8) { + for (int32_t w = 0; w < GRW; w += 8) { nBits = GRW - w > 8 ? 8 : GRW - w; if (h > 0) line1 = (line1 << 8) | @@ -1709,7 +1709,7 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithD } else { CONTEXT = (line1 & 0x0380) | ((line1_r >> 2) & 0x0020) | ((line2_r >> 4) & 0x001c) | ((line3_r >> 6) & 0x0003); - for (FX_INT32 w = 0; w < GRW; w += 8) { + for (int32_t w = 0; w < GRW; w += 8) { nBits = GRW - w > 8 ? 8 : GRW - w; if (h > 0) line1 = (line1 << 8) | @@ -1872,23 +1872,23 @@ CJBig2_Image *CJBig2_GRRDProc::decode_V1(CJBig2_ArithDecoder *pArithDecoder, JBi } CJBig2_Image *CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream *pStream, JBig2ArithCtx *grContext) { - FX_INT32 STRIPT, FIRSTS; + int32_t STRIPT, FIRSTS; FX_DWORD NINSTANCES; - FX_INT32 DT, DFS, CURS; - FX_BYTE CURT; - FX_INT32 SI, TI; + int32_t DT, DFS, CURS; + uint8_t CURT; + int32_t SI, TI; FX_DWORD IDI; CJBig2_Image *IBI; FX_DWORD WI, HI; - FX_INT32 IDS; + int32_t IDS; FX_BOOL RI; - FX_INT32 RDWI, RDHI, RDXI, RDYI; + int32_t RDWI, RDHI, RDXI, RDYI; CJBig2_Image *IBOI; FX_DWORD WOI, HOI; CJBig2_Image *SBREG; FX_BOOL bFirst; FX_DWORD nTmp; - FX_INT32 nVal, nBits; + int32_t nVal, nBits; CJBig2_HuffmanDecoder *pHuffmanDecoder; CJBig2_GRRDProc *pGRRD; CJBig2_ArithDecoder *pArithDecoder; @@ -2092,23 +2092,23 @@ failed: CJBig2_Image *CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *grContext, JBig2IntDecoderState *pIDS) { - FX_INT32 STRIPT, FIRSTS; + int32_t STRIPT, FIRSTS; FX_DWORD NINSTANCES; - FX_INT32 DT, DFS, CURS; - FX_INT32 CURT; - FX_INT32 SI, TI; + int32_t DT, DFS, CURS; + int32_t CURT; + int32_t SI, TI; FX_DWORD IDI; CJBig2_Image *IBI; FX_DWORD WI, HI; - FX_INT32 IDS; + int32_t IDS; FX_BOOL RI; - FX_INT32 RDWI, RDHI, RDXI, RDYI; + int32_t RDWI, RDHI, RDXI, RDYI; CJBig2_Image *IBOI; FX_DWORD WOI, HOI; CJBig2_Image *SBREG; FX_BOOL bFirst; - FX_INT32 nRet, nVal; - FX_INT32 bRetained; + int32_t nRet, nVal; + int32_t bRetained; CJBig2_ArithIntDecoder *IADT, *IAFS, *IADS, *IAIT, *IARI, *IARDW, *IARDH, *IARDX, *IARDY; CJBig2_ArithIaidDecoder *IAID; CJBig2_GRRDProc *pGRRD; @@ -2333,21 +2333,21 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecod { CJBig2_Image **SDNEWSYMS; FX_DWORD HCHEIGHT, NSYMSDECODED; - FX_INT32 HCDH; + int32_t HCDH; FX_DWORD SYMWIDTH, TOTWIDTH; - FX_INT32 DW; + int32_t DW; CJBig2_Image *BS; FX_DWORD I, J, REFAGGNINST; FX_BOOL *EXFLAGS; FX_DWORD EXINDEX; FX_BOOL CUREXFLAG; FX_DWORD EXRUNLENGTH; - FX_INT32 nVal; + int32_t nVal; FX_DWORD nTmp; FX_DWORD SBNUMSYMS; - FX_BYTE SBSYMCODELEN; + uint8_t SBSYMCODELEN; FX_DWORD IDI; - FX_INT32 RDXI, RDYI; + int32_t RDXI, RDYI; CJBig2_Image **SBSYMS; CJBig2_HuffmanTable *SBHUFFFS, *SBHUFFDS, *SBHUFFDT, *SBHUFFRDW, *SBHUFFRDH, *SBHUFFRDX, *SBHUFFRDY, *SBHUFFRSIZE; @@ -2374,7 +2374,7 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecod while((FX_DWORD)(1 << nTmp) < (SDNUMINSYMS + SDNUMNEWSYMS)) { nTmp ++; } - JBIG2_ALLOC(IAID, CJBig2_ArithIaidDecoder((FX_BYTE)nTmp)); + JBIG2_ALLOC(IAID, CJBig2_ArithIaidDecoder((uint8_t)nTmp)); SDNEWSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2(SDNUMNEWSYMS, sizeof(CJBig2_Image*)); FXSYS_memset32(SDNEWSYMS, 0 , SDNUMNEWSYMS * sizeof(CJBig2_Image*)); HCHEIGHT = 0; @@ -2458,7 +2458,7 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecod while((FX_DWORD)(1 << nTmp) < SBNUMSYMS) { nTmp ++; } - SBSYMCODELEN = (FX_BYTE)nTmp; + SBSYMCODELEN = (uint8_t)nTmp; pDecoder->SBSYMCODELEN = SBSYMCODELEN; SBSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2(SBNUMSYMS, sizeof(CJBig2_Image*)); JBIG2_memcpy(SBSYMS, SDINSYMS, SDNUMINSYMS * sizeof(CJBig2_Image*)); @@ -2671,22 +2671,22 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream *pStream, CJBig2_Image **SDNEWSYMS; FX_DWORD *SDNEWSYMWIDTHS; FX_DWORD HCHEIGHT, NSYMSDECODED; - FX_INT32 HCDH; + int32_t HCDH; FX_DWORD SYMWIDTH, TOTWIDTH, HCFIRSTSYM; - FX_INT32 DW; + int32_t DW; CJBig2_Image *BS, *BHC; FX_DWORD I, J, REFAGGNINST; FX_BOOL *EXFLAGS; FX_DWORD EXINDEX; FX_BOOL CUREXFLAG; FX_DWORD EXRUNLENGTH; - FX_INT32 nVal, nBits; + int32_t nVal, nBits; FX_DWORD nTmp; FX_DWORD SBNUMSYMS; - FX_BYTE SBSYMCODELEN; + uint8_t SBSYMCODELEN; JBig2HuffmanCode *SBSYMCODES; FX_DWORD IDI; - FX_INT32 RDXI, RDYI; + int32_t RDXI, RDYI; FX_DWORD BMSIZE; FX_DWORD stride; CJBig2_Image **SBSYMS; @@ -2843,7 +2843,7 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream *pStream, while((FX_DWORD)(1 << nTmp) < SBNUMSYMS) { nTmp ++; } - SBSYMCODELEN = (FX_BYTE)nTmp; + SBSYMCODELEN = (uint8_t)nTmp; SBSYMCODES = (JBig2HuffmanCode*)m_pModule->JBig2_Malloc2(SBNUMSYMS, sizeof(JBig2HuffmanCode)); for(I = 0; I < SBNUMSYMS; I++) { SBSYMCODES[I].codelen = SBSYMCODELEN; @@ -2931,7 +2931,7 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream *pStream, NSYMSDECODED = NSYMSDECODED + 1; } if(SDREFAGG == 0) { - if(pHuffmanDecoder->decodeAValue(SDHUFFBMSIZE, (FX_INT32*)&BMSIZE) != 0) { + if(pHuffmanDecoder->decodeAValue(SDHUFFBMSIZE, (int32_t*)&BMSIZE) != 0) { m_pModule->JBig2_Error("symbol dictionary decoding procedure (huffman): too short."); goto failed; } @@ -3042,7 +3042,7 @@ CJBig2_Image *CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause) { FX_DWORD ng, mg; - FX_INT32 x, y; + int32_t x, y; CJBig2_Image *HSKIP; FX_DWORD HBPP; FX_DWORD *GI; @@ -3057,8 +3057,8 @@ CJBig2_Image *CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, for(ng = 0; ng < HGW; ng++) { x = (HGX + mg * HRY + ng * HRX) >> 8; y = (HGY + mg * HRX - ng * HRY) >> 8; - if((x + HPW <= 0) | (x >= (FX_INT32)HBW) - | (y + HPH <= 0) | (y >= (FX_INT32)HPH)) { + if((x + HPW <= 0) | (x >= (int32_t)HBW) + | (y + HPH <= 0) | (y >= (int32_t)HPH)) { HSKIP->setPixel(ng, mg, 1); } else { HSKIP->setPixel(ng, mg, 0); @@ -3074,7 +3074,7 @@ CJBig2_Image *CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, pGID->GSMMR = HMMR; pGID->GSW = HGW; pGID->GSH = HGH; - pGID->GSBPP = (FX_BYTE)HBPP; + pGID->GSBPP = (uint8_t)HBPP; pGID->GSUSESKIP = HENABLESKIP; pGID->GSKIP = HSKIP; pGID->GSTEMPLATE = HTEMPLATE; @@ -3110,7 +3110,7 @@ failed: CJBig2_Image *CJBig2_HTRDProc::decode_MMR(CJBig2_BitStream *pStream, IFX_Pause* pPause) { FX_DWORD ng, mg; - FX_INT32 x, y; + int32_t x, y; FX_DWORD HBPP; FX_DWORD *GI; CJBig2_Image *HTREG; @@ -3125,7 +3125,7 @@ CJBig2_Image *CJBig2_HTRDProc::decode_MMR(CJBig2_BitStream *pStream, IFX_Pause* pGID->GSMMR = HMMR; pGID->GSW = HGW; pGID->GSH = HGH; - pGID->GSBPP = (FX_BYTE)HBPP; + pGID->GSBPP = (uint8_t)HBPP; pGID->GSUSESKIP = 0; GI = pGID->decode_MMR(pStream, pPause); if(GI == NULL) { @@ -3168,7 +3168,7 @@ CJBig2_PatternDict *CJBig2_PDDProc::decode_Arith(CJBig2_ArithDecoder *pArithDeco pGRD->GBTEMPLATE = HDTEMPLATE; pGRD->TPGDON = 0; pGRD->USESKIP = 0; - pGRD->GBAT[0] = -(FX_INT32)HDPW; + pGRD->GBAT[0] = -(int32_t)HDPW; pGRD->GBAT[1] = 0; if(pGRD->GBTEMPLATE == 0) { pGRD->GBAT[2] = -3; @@ -3237,7 +3237,7 @@ FX_DWORD *CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause) { CJBig2_Image **GSPLANES; - FX_INT32 J, K; + int32_t J, K; FX_DWORD x, y; FX_DWORD *GSVALS; CJBig2_GRDProc *pGRD; @@ -3318,7 +3318,7 @@ failed: FX_DWORD *CJBig2_GSIDProc::decode_MMR(CJBig2_BitStream *pStream, IFX_Pause* pPause) { CJBig2_Image **GSPLANES; - FX_INT32 J, K; + int32_t J, K; FX_DWORD x, y; FX_DWORD *GSVALS; CJBig2_GRDProc *pGRD; @@ -3808,9 +3808,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3(CJBig2_Image *pImage, FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1, line2; - FX_BYTE *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; if(m_pLine == NULL) { m_pLine = pImage->m_pData; } @@ -3949,9 +3949,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3(CJBig2_Image *pImage, FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1, line2; - FX_BYTE *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; if (!m_pLine) { m_pLine = pImage->m_pData; } @@ -4087,9 +4087,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3(CJBig2_Image *pImage, FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1, line2; - FX_BYTE *pLine1, *pLine2, cVal; - FX_INT32 nStride, nStride2, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine1, *pLine2, cVal; + int32_t nStride, nStride2, k; + int32_t nLineBytes, nBitsLeft, cc; if(!m_pLine) { m_pLine = pImage->m_pData; } @@ -4223,9 +4223,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3(CJBig2_Image *pImage, FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1; - FX_BYTE *pLine1, cVal; - FX_INT32 nStride, k; - FX_INT32 nLineBytes, nBitsLeft, cc; + uint8_t *pLine1, cVal; + int32_t nStride, k; + int32_t nLineBytes, nBitsLeft, cc; if (!m_pLine) { m_pLine = pImage->m_pData; } diff --git a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h index 3f43c979a5..45e2940d3a 100644 --- a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h +++ b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h @@ -68,7 +68,7 @@ private: FXCODEC_STATUS decode_Arith_Template3_opt3(CJBig2_Image *pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause); FXCODEC_STATUS decode_Arith_Template3_unopt(CJBig2_Image * pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause); FX_DWORD m_loopIndex; - FX_BYTE * m_pLine; + uint8_t * m_pLine; IFX_Pause* m_pPause; FXCODEC_STATUS m_ProssiveStatus; CJBig2_Image** m_pImage; @@ -114,7 +114,7 @@ public: FX_BOOL MMR; FX_DWORD GBW; FX_DWORD GBH; - FX_BYTE GBTEMPLATE; + uint8_t GBTEMPLATE; FX_BOOL TPGDON; FX_BOOL USESKIP; CJBig2_Image * SKIP; @@ -140,8 +140,8 @@ public: FX_DWORD GRH; FX_BOOL GRTEMPLATE; CJBig2_Image *GRREFERENCE; - FX_INT32 GRREFERENCEDX; - FX_INT32 GRREFERENCEDY; + int32_t GRREFERENCEDX; + int32_t GRREFERENCEDY; FX_BOOL TPGRON; signed char GRAT[4]; }; @@ -175,7 +175,7 @@ public: FX_DWORD SBNUMSYMS; JBig2HuffmanCode *SBSYMCODES; - FX_BYTE SBSYMCODELEN; + uint8_t SBSYMCODELEN; CJBig2_Image **SBSYMS; FX_BOOL SBDEFPIXEL; @@ -214,7 +214,7 @@ public: *SDHUFFDW, *SDHUFFBMSIZE, *SDHUFFAGGINST; - FX_BYTE SDTEMPLATE; + uint8_t SDTEMPLATE; signed char SDAT[8]; FX_BOOL SDRTEMPLATE; signed char SDRAT[4]; @@ -230,7 +230,7 @@ public: FX_DWORD HBW, HBH; FX_BOOL HMMR; - FX_BYTE HTEMPLATE; + uint8_t HTEMPLATE; FX_DWORD HNUMPATS; CJBig2_Image **HPATS; FX_BOOL HDEFPIXEL; @@ -238,11 +238,11 @@ public: FX_BOOL HENABLESKIP; FX_DWORD HGW, HGH; - FX_INT32 HGX, + int32_t HGX, HGY; FX_WORD HRX, HRY; - FX_BYTE HPW, + uint8_t HPW, HPH; }; class CJBig2_PDDProc : public CJBig2_Object @@ -254,10 +254,10 @@ public: CJBig2_PatternDict *decode_MMR(CJBig2_BitStream *pStream, IFX_Pause* pPause); public: FX_BOOL HDMMR; - FX_BYTE HDPW, + uint8_t HDPW, HDPH; FX_DWORD GRAYMAX; - FX_BYTE HDTEMPLATE; + uint8_t HDTEMPLATE; }; class CJBig2_GSIDProc : public CJBig2_Object { @@ -269,10 +269,10 @@ public: public: FX_BOOL GSMMR; FX_BOOL GSUSESKIP; - FX_BYTE GSBPP; + uint8_t GSBPP; FX_DWORD GSW, GSH; - FX_BYTE GSTEMPLATE; + uint8_t GSTEMPLATE; CJBig2_Image *GSKIP; }; #endif diff --git a/core/src/fxcodec/jbig2/JBig2_Image.cpp b/core/src/fxcodec/jbig2/JBig2_Image.cpp index f2cea597c1..044ccf7410 100644 --- a/core/src/fxcodec/jbig2/JBig2_Image.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Image.cpp @@ -11,7 +11,7 @@ #include "../../../include/fxcrt/fx_safe_types.h" #include "JBig2_Image.h" -CJBig2_Image::CJBig2_Image(FX_INT32 w, FX_INT32 h) +CJBig2_Image::CJBig2_Image(int32_t w, int32_t h) { m_nWidth = w; m_nHeight = h; @@ -22,13 +22,13 @@ CJBig2_Image::CJBig2_Image(FX_INT32 w, FX_INT32 h) } m_nStride = ((w + 31) >> 5) << 2; if (m_nStride * m_nHeight > 0 && 104857600 / (int)m_nStride > m_nHeight) { - m_pData = (FX_BYTE *)m_pModule->JBig2_Malloc2(m_nStride, m_nHeight); + m_pData = (uint8_t *)m_pModule->JBig2_Malloc2(m_nStride, m_nHeight); } else { m_pData = NULL; } m_bNeedFree = TRUE; } -CJBig2_Image::CJBig2_Image(FX_INT32 w, FX_INT32 h, FX_INT32 stride, FX_BYTE*pBuf) +CJBig2_Image::CJBig2_Image(int32_t w, int32_t h, int32_t stride, uint8_t*pBuf) { m_nWidth = w; m_nHeight = h; @@ -43,7 +43,7 @@ CJBig2_Image::CJBig2_Image(CJBig2_Image &im) m_nHeight = im.m_nHeight; m_nStride = im.m_nStride; if (im.m_pData) { - m_pData = (FX_BYTE*)m_pModule->JBig2_Malloc2(m_nStride, m_nHeight); + m_pData = (uint8_t*)m_pModule->JBig2_Malloc2(m_nStride, m_nHeight); JBIG2_memcpy(m_pData, im.m_pData, m_nStride * m_nHeight); } else { m_pData = NULL; @@ -56,12 +56,12 @@ CJBig2_Image::~CJBig2_Image() m_pModule->JBig2_Free(m_pData); } } -FX_BOOL CJBig2_Image::getPixel(FX_INT32 x, FX_INT32 y) +FX_BOOL CJBig2_Image::getPixel(int32_t x, int32_t y) { if (!m_pData) { return 0; } - FX_INT32 m, n; + int32_t m, n; if(x < 0 || x >= m_nWidth) { return 0; } @@ -73,12 +73,12 @@ FX_BOOL CJBig2_Image::getPixel(FX_INT32 x, FX_INT32 y) return ((m_pData[m] >> (7 - n)) & 1); } -FX_INT32 CJBig2_Image::setPixel(FX_INT32 x, FX_INT32 y, FX_BOOL v) +int32_t CJBig2_Image::setPixel(int32_t x, int32_t y, FX_BOOL v) { if (!m_pData) { return 0; } - FX_INT32 m, n; + int32_t m, n; if(x < 0 || x >= m_nWidth) { return 0; } @@ -94,7 +94,7 @@ FX_INT32 CJBig2_Image::setPixel(FX_INT32 x, FX_INT32 y, FX_BOOL v) } return 1; } -void CJBig2_Image::copyLine(FX_INT32 hTo, FX_INT32 hFrom) +void CJBig2_Image::copyLine(int32_t hTo, int32_t hFrom) { if (!m_pData) { return; @@ -112,14 +112,14 @@ void CJBig2_Image::fill(FX_BOOL v) } JBIG2_memset(m_pData, v ? 0xff : 0, m_nStride * m_nHeight); } -FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) { if (!m_pData) { return FALSE; } return composeTo_opt2(pDst, x, y, op); } -FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op, const FX_RECT* pSrcRect) +FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect) { if (!m_pData) { return FALSE; @@ -129,10 +129,10 @@ FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig } return composeTo_opt2(pDst, x, y, op, pSrcRect); } -FX_BOOL CJBig2_Image::composeTo_unopt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeTo_unopt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) { - FX_INT32 w, h, dx, dy; - FX_INT32 i, j; + int32_t w, h, dx, dy; + int32_t i, j; w = m_nWidth; h = m_nHeight; dx = dy = 0; @@ -196,10 +196,10 @@ FX_BOOL CJBig2_Image::composeTo_unopt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y return TRUE; } -FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) { - FX_INT32 x0, x1, y0, y1, xx, yy; - FX_BYTE *pLineSrc, *pLineDst, *srcPtr, *destPtr; + int32_t x0, x1, y0, y1, xx, yy; + uint8_t *pLineSrc, *pLineDst, *srcPtr, *destPtr; FX_DWORD src0, src1, src, dest, s1, s2, m1, m2, m3; FX_BOOL oneByte; if (!m_pData) { @@ -247,7 +247,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc; dest = *destPtr; dest |= (*srcPtr >> s1) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -259,7 +259,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc; dest = *destPtr; dest &= ((0xff00 | *srcPtr) >> s1) | m1; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -271,7 +271,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc; dest = *destPtr; dest ^= (*srcPtr >> s1) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -283,7 +283,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc; dest = *destPtr; dest ^= ((*srcPtr ^ 0xff) >> s1) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -295,7 +295,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc; dest = *destPtr; dest = (dest & ~m3) | ((*srcPtr >> s1) & m3); - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -310,7 +310,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc + (-x >> 3); dest = *destPtr; dest |= *srcPtr & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -322,7 +322,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc + (-x >> 3); dest = *destPtr; dest &= *srcPtr | m1; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -334,7 +334,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc + (-x >> 3); dest = *destPtr; dest ^= *srcPtr & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -346,7 +346,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc + (-x >> 3); dest = *destPtr; dest ^= (*srcPtr ^ 0xff) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -358,7 +358,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, srcPtr = pLineSrc + (-x >> 3); dest = *destPtr; dest = (*srcPtr & m2) | (dest & m1); - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -376,7 +376,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; dest = *destPtr; dest |= src1 >> s1; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; xx = x0 + 8; for (; xx < x1 - 8; xx += 8) { dest = *destPtr; @@ -384,7 +384,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest |= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -395,7 +395,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest |= src & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -408,7 +408,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; dest = *destPtr; dest &= (0xff00 | src1) >> s1; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; xx = x0 + 8; for (; xx < x1 - 8; xx += 8) { dest = *destPtr; @@ -416,7 +416,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest &= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -427,7 +427,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest &= src | m1; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -440,7 +440,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; dest = *destPtr; dest ^= src1 >> s1; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; xx = x0 + 8; for (; xx < x1 - 8; xx += 8) { dest = *destPtr; @@ -448,7 +448,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -459,7 +459,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -472,7 +472,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; dest = *destPtr; dest ^= (src1 ^ 0xff) >> s1; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; xx = x0 + 8; for (; xx < x1 - 8; xx += 8) { dest = *destPtr; @@ -480,7 +480,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src ^ 0xff; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -491,7 +491,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= (src ^ 0xff) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -504,7 +504,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; dest = *destPtr; dest = (dest & (0xff << s2)) | (src1 >> s1); - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; xx = x0 + 8; for (; xx < x1 - 8; xx += 8) { dest = *destPtr; @@ -512,7 +512,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest = src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -523,7 +523,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest = (src & m2) | (dest & m1); - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -544,7 +544,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest |= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -555,7 +555,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest |= src & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -573,7 +573,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest &= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -584,7 +584,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest &= src | m1; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -602,7 +602,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -613,7 +613,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -631,7 +631,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= src ^ 0xff; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -642,7 +642,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest ^= (src ^ 0xff) & m2; - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -660,7 +660,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, src1 = *srcPtr++; src = (((src0 << 8) | src1) >> s1) & 0xff; dest = src; - *destPtr++ = (FX_BYTE)dest; + *destPtr++ = (uint8_t)dest; } dest = *destPtr; src0 = src1; @@ -671,7 +671,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } src = (((src0 << 8) | src1) >> s1) & 0xff; dest = (src & m2) | (dest & m1); - *destPtr = (FX_BYTE)dest; + *destPtr = (uint8_t)dest; pLineDst += pDst->m_nStride; pLineSrc += m_nStride; } @@ -682,24 +682,24 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } return TRUE; } -FX_BOOL CJBig2_Image::composeFrom(FX_INT32 x, FX_INT32 y, CJBig2_Image *pSrc, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op) { if (!m_pData) { return FALSE; } return pSrc->composeTo(this, x, y, op); } -FX_BOOL CJBig2_Image::composeFrom(FX_INT32 x, FX_INT32 y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect) +FX_BOOL CJBig2_Image::composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect) { if (!m_pData) { return FALSE; } return pSrc->composeTo(this, x, y, op, pSrcRect); } -CJBig2_Image *CJBig2_Image::subImage_unopt(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT32 h) +CJBig2_Image *CJBig2_Image::subImage_unopt(int32_t x, int32_t y, int32_t w, int32_t h) { CJBig2_Image *pImage; - FX_INT32 i, j; + int32_t i, j; JBIG2_ALLOC(pImage, CJBig2_Image(w, h)); for(j = 0; j < h; j++) { for(i = 0; i < w; i++) { @@ -709,13 +709,13 @@ CJBig2_Image *CJBig2_Image::subImage_unopt(FX_INT32 x, FX_INT32 y, FX_INT32 w, F return pImage; } #define JBIG2_GETDWORD(buf) ((FX_DWORD)(((buf)[0] << 24) | ((buf)[1] << 16) | ((buf)[2] << 8) | (buf)[3])) -CJBig2_Image *CJBig2_Image::subImage(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT32 h) +CJBig2_Image *CJBig2_Image::subImage(int32_t x, int32_t y, int32_t w, int32_t h) { CJBig2_Image *pImage; - FX_INT32 m, n, j; - FX_BYTE *pLineSrc, *pLineDst; + int32_t m, n, j; + uint8_t *pLineSrc, *pLineDst; FX_DWORD wTmp; - FX_BYTE *pSrc, *pSrcEnd, *pDst, *pDstEnd; + uint8_t *pSrc, *pSrcEnd, *pDst, *pDstEnd; if (w == 0 || h == 0) { return NULL; } @@ -755,10 +755,10 @@ CJBig2_Image *CJBig2_Image::subImage(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT3 } else { wTmp = JBIG2_GETDWORD(pSrc) << n; } - pDst[0] = (FX_BYTE)(wTmp >> 24); - pDst[1] = (FX_BYTE)(wTmp >> 16); - pDst[2] = (FX_BYTE)(wTmp >> 8); - pDst[3] = (FX_BYTE)wTmp; + pDst[0] = (uint8_t)(wTmp >> 24); + pDst[1] = (uint8_t)(wTmp >> 16); + pDst[2] = (uint8_t)(wTmp >> 8); + pDst[3] = (uint8_t)wTmp; } pLineSrc += m_nStride; pLineDst += pImage->m_nStride; @@ -766,7 +766,7 @@ CJBig2_Image *CJBig2_Image::subImage(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT3 } return pImage; } -void CJBig2_Image::expand(FX_INT32 h, FX_BOOL v) +void CJBig2_Image::expand(int32_t h, FX_BOOL v) { if (!m_pData || h <= m_nHeight) { return; @@ -780,7 +780,7 @@ void CJBig2_Image::expand(FX_INT32 h, FX_BOOL v) return; } //The guaranteed reallocated memory is to be < 4GB (unsigned int). - m_pData = (FX_BYTE*)m_pModule->JBig2_Realloc(m_pData, safeMemSize.ValueOrDie()); + m_pData = (uint8_t*)m_pModule->JBig2_Realloc(m_pData, safeMemSize.ValueOrDie()); //The result of dwHeight * dwStride doesn't overflow after the //checking of safeMemSize. //The same as the result of (dwH - dwHeight) * dwStride) because @@ -789,15 +789,15 @@ void CJBig2_Image::expand(FX_INT32 h, FX_BOOL v) JBIG2_memset(m_pData + dwHeight * dwStride, v ? 0xff : 0, (dwH - dwHeight) * dwStride); m_nHeight = h; } -FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) { - FX_INT32 xs0 = 0, ys0 = 0, xs1 = 0, ys1 = 0, xd0 = 0, yd0 = 0, xd1 = 0, + int32_t xs0 = 0, ys0 = 0, xs1 = 0, ys1 = 0, xd0 = 0, yd0 = 0, xd1 = 0, yd1 = 0, xx = 0, yy = 0, w = 0, h = 0, middleDwords = 0, lineLeft = 0; FX_DWORD s1 = 0, d1 = 0, d2 = 0, shift = 0, shift1 = 0, shift2 = 0, tmp = 0, tmp1 = 0, tmp2 = 0, maskL = 0, maskR = 0, maskM = 0; - FX_BYTE *lineSrc = NULL, *lineDst = NULL, *sp = NULL, *dp = NULL; + uint8_t *lineSrc = NULL, *lineDst = NULL, *sp = NULL, *dp = NULL; if (!m_pData) { return FALSE; @@ -867,10 +867,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -896,10 +896,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -927,10 +927,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -963,10 +963,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -990,10 +990,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1018,10 +1018,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; @@ -1051,10 +1051,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1078,10 +1078,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1105,10 +1105,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; @@ -1140,10 +1140,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; dp += 4; } for(xx = 0; xx < middleDwords; xx++) { @@ -1166,10 +1166,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1194,10 +1194,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; @@ -1206,12 +1206,12 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, } return 1; } -FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op, const FX_RECT* pSrcRect) +FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect) { - FX_INT32 xs0, ys0, xs1, ys1, xd0, yd0, xd1, yd1, xx, yy, w, h, middleDwords, lineLeft; + int32_t xs0, ys0, xs1, ys1, xd0, yd0, xd1, yd1, xx, yy, w, h, middleDwords, lineLeft; FX_DWORD s1, d1, d2, shift, shift1, shift2, tmp, tmp1, tmp2, maskL, maskR, maskM; - FX_BYTE *lineSrc, *lineDst, *sp, *dp; - FX_INT32 sw, sh; + uint8_t *lineSrc, *lineDst, *sp, *dp; + int32_t sw, sh; if (!m_pData) { return FALSE; } @@ -1290,10 +1290,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -1319,10 +1319,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -1350,10 +1350,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskM) | (tmp1 & maskM); break; } - lineDst[0] = (FX_BYTE)(tmp >> 24); - lineDst[1] = (FX_BYTE)(tmp >> 16); - lineDst[2] = (FX_BYTE)(tmp >> 8); - lineDst[3] = (FX_BYTE)tmp; + lineDst[0] = (uint8_t)(tmp >> 24); + lineDst[1] = (uint8_t)(tmp >> 16); + lineDst[2] = (uint8_t)(tmp >> 8); + lineDst[3] = (uint8_t)tmp; lineSrc += m_nStride; lineDst += pDst->m_nStride; } @@ -1386,10 +1386,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1413,10 +1413,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1441,10 +1441,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; @@ -1474,10 +1474,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1501,10 +1501,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1528,10 +1528,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; @@ -1563,10 +1563,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskL) | (tmp1 & maskL); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; dp += 4; } for(xx = 0; xx < middleDwords; xx++) { @@ -1589,10 +1589,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = tmp1; break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; sp += 4; dp += 4; } @@ -1617,10 +1617,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, tmp = (tmp2 & ~maskR) | (tmp1 & maskR); break; } - dp[0] = (FX_BYTE)(tmp >> 24); - dp[1] = (FX_BYTE)(tmp >> 16); - dp[2] = (FX_BYTE)(tmp >> 8); - dp[3] = (FX_BYTE)tmp; + dp[0] = (uint8_t)(tmp >> 24); + dp[1] = (uint8_t)(tmp >> 16); + dp[2] = (uint8_t)(tmp >> 8); + dp[3] = (uint8_t)tmp; } lineSrc += m_nStride; lineDst += pDst->m_nStride; diff --git a/core/src/fxcodec/jbig2/JBig2_Image.h b/core/src/fxcodec/jbig2/JBig2_Image.h index 5d06695c7c..423bebcede 100644 --- a/core/src/fxcodec/jbig2/JBig2_Image.h +++ b/core/src/fxcodec/jbig2/JBig2_Image.h @@ -20,48 +20,48 @@ class CJBig2_Image : public CJBig2_Object { public: - CJBig2_Image(FX_INT32 w, FX_INT32 h); + CJBig2_Image(int32_t w, int32_t h); - CJBig2_Image(FX_INT32 w, FX_INT32 h, FX_INT32 stride, FX_BYTE*pBuf); + CJBig2_Image(int32_t w, int32_t h, int32_t stride, uint8_t*pBuf); CJBig2_Image(CJBig2_Image &im); ~CJBig2_Image(); - FX_BOOL getPixel(FX_INT32 x, FX_INT32 y); + FX_BOOL getPixel(int32_t x, int32_t y); - FX_INT32 setPixel(FX_INT32 x, FX_INT32 y, FX_BOOL v); + int32_t setPixel(int32_t x, int32_t y, FX_BOOL v); - void copyLine(FX_INT32 hTo, FX_INT32 hFrom); + void copyLine(int32_t hTo, int32_t hFrom); void fill(FX_BOOL v); - FX_BOOL composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op); - FX_BOOL composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op, const FX_RECT* pSrcRect); + FX_BOOL composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); + FX_BOOL composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect); - FX_BOOL composeTo_unopt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op); + FX_BOOL composeTo_unopt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); - FX_BOOL composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op); + FX_BOOL composeTo_opt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); - FX_BOOL composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op); - FX_BOOL composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op, const FX_RECT* pSrcRect); + FX_BOOL composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); + FX_BOOL composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect); - FX_BOOL composeFrom(FX_INT32 x, FX_INT32 y, CJBig2_Image *pSrc, JBig2ComposeOp op); - FX_BOOL composeFrom(FX_INT32 x, FX_INT32 y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect); - CJBig2_Image *subImage_unopt(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT32 h); + FX_BOOL composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op); + FX_BOOL composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect); + CJBig2_Image *subImage_unopt(int32_t x, int32_t y, int32_t w, int32_t h); - CJBig2_Image *subImage(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT32 h); + CJBig2_Image *subImage(int32_t x, int32_t y, int32_t w, int32_t h); - void expand(FX_INT32 h, FX_BOOL v); + void expand(int32_t h, FX_BOOL v); public: - FX_INT32 m_nWidth; + int32_t m_nWidth; - FX_INT32 m_nHeight; + int32_t m_nHeight; - FX_INT32 m_nStride; + int32_t m_nStride; - FX_BYTE *m_pData; + uint8_t *m_pData; FX_BOOL m_bNeedFree; }; diff --git a/core/src/fxcodec/jbig2/JBig2_List.h b/core/src/fxcodec/jbig2/JBig2_List.h index 9292724b1e..19f99dec3d 100644 --- a/core/src/fxcodec/jbig2/JBig2_List.h +++ b/core/src/fxcodec/jbig2/JBig2_List.h @@ -13,7 +13,7 @@ class CJBig2_List : public CJBig2_Object { public: - CJBig2_List(FX_INT32 nSize = 8) + CJBig2_List(int32_t nSize = 8) { m_nSize = nSize; m_pArray = (TYPE**)m_pModule->JBig2_Malloc2(sizeof(TYPE*), nSize); @@ -28,7 +28,7 @@ public: void clear() { - FX_INT32 i; + int32_t i; for(i = 0; i < m_nLength; i++) { delete m_pArray[i]; } @@ -45,12 +45,12 @@ public: } - FX_INT32 getLength() + int32_t getLength() { return m_nLength; } - TYPE *getAt(FX_INT32 nIndex) + TYPE *getAt(int32_t nIndex) { return m_pArray[nIndex]; } @@ -60,8 +60,8 @@ public: return m_pArray[m_nLength - 1]; } private: - FX_INT32 m_nSize; + int32_t m_nSize; TYPE **m_pArray; - FX_INT32 m_nLength; + int32_t m_nLength; }; #endif diff --git a/core/src/fxcodec/jbig2/JBig2_Module.h b/core/src/fxcodec/jbig2/JBig2_Module.h index 711cf4047b..aef31bb49f 100644 --- a/core/src/fxcodec/jbig2/JBig2_Module.h +++ b/core/src/fxcodec/jbig2/JBig2_Module.h @@ -22,7 +22,7 @@ public: virtual void JBig2_Free(FX_LPVOID pMem) = 0; - virtual void JBig2_Assert(FX_INT32 nExpression) {}; + virtual void JBig2_Assert(int32_t nExpression) {}; virtual void JBig2_Error(FX_LPCSTR format, ...) {}; diff --git a/core/src/fxcodec/jbig2/JBig2_Object.cpp b/core/src/fxcodec/jbig2/JBig2_Object.cpp index 2bb267b085..4bb00b897b 100644 --- a/core/src/fxcodec/jbig2/JBig2_Object.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Object.cpp @@ -36,9 +36,9 @@ void *CJBig2_Object::operator new[](size_t size, CJBig2_Module *pModule, size_t FX_LPCSTR filename, int line) { void *p; - FX_BYTE *pCur, *pEnd; - p = (FX_BYTE *)pModule->JBig2_Malloc((FX_DWORD)size); - pCur = (FX_BYTE *)p; + uint8_t *pCur, *pEnd; + p = (uint8_t *)pModule->JBig2_Malloc((FX_DWORD)size); + pCur = (uint8_t *)p; pEnd = pCur + size; for(; pCur < pEnd; pCur += unit_size) { ((CJBig2_Object *)pCur)->m_pModule = pModule; @@ -53,9 +53,9 @@ void CJBig2_Object::operator delete[](void *p, CJBig2_Module *pModule, size_t un void *CJBig2_Object::operator new[](size_t size, CJBig2_Module *pModule, size_t unit_size) { void *p; - FX_BYTE *pCur, *pEnd; - p = (FX_BYTE *)pModule->JBig2_Malloc((FX_DWORD)size); - pCur = (FX_BYTE *)p; + uint8_t *pCur, *pEnd; + p = (uint8_t *)pModule->JBig2_Malloc((FX_DWORD)size); + pCur = (uint8_t *)p; pEnd = pCur + size; for(; pCur < pEnd; pCur += unit_size) { ((CJBig2_Object *)pCur)->m_pModule = pModule; diff --git a/core/src/fxcodec/jbig2/JBig2_Page.h b/core/src/fxcodec/jbig2/JBig2_Page.h index d7399bd452..b07eba8a3a 100644 --- a/core/src/fxcodec/jbig2/JBig2_Page.h +++ b/core/src/fxcodec/jbig2/JBig2_Page.h @@ -12,7 +12,7 @@ struct JBig2PageInfo : public CJBig2_Object { m_dwHeight; FX_DWORD m_dwResolutionX, m_dwResolutionY; - FX_BYTE m_cFlags; + uint8_t m_cFlags; FX_BOOL m_bIsStriped; FX_WORD m_wMaxStripeSize; }; diff --git a/core/src/fxcodec/jbig2/JBig2_Segment.h b/core/src/fxcodec/jbig2/JBig2_Segment.h index 33ee721a1b..fe44bc962d 100644 --- a/core/src/fxcodec/jbig2/JBig2_Segment.h +++ b/core/src/fxcodec/jbig2/JBig2_Segment.h @@ -42,19 +42,19 @@ public: FX_DWORD m_dwNumber; union { struct { - FX_BYTE type : 6; - FX_BYTE page_association_size : 1; - FX_BYTE deferred_non_retain : 1; + uint8_t type : 6; + uint8_t page_association_size : 1; + uint8_t deferred_non_retain : 1; } s; - FX_BYTE c; + uint8_t c; } m_cFlags; - FX_INT32 m_nReferred_to_segment_count; + int32_t m_nReferred_to_segment_count; FX_DWORD * m_pReferred_to_segment_numbers; FX_DWORD m_dwPage_association; FX_DWORD m_dwData_length; FX_DWORD m_dwHeader_Length; - FX_BYTE *m_pData; + uint8_t *m_pData; JBig2_SegmentState m_State; JBig2_ResultType m_nResultType; union { diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h index ce66e26402..c2d72f4bf1 100644 --- a/core/src/fxcrt/extension.h +++ b/core/src/fxcrt/extension.h @@ -160,7 +160,7 @@ public: ~CFX_MemoryStream() { if (m_dwFlags & FX_MEMSTREAM_TakeOver) { - for (FX_INT32 i = 0; i < m_Blocks.GetSize(); i++) { + for (int32_t i = 0; i < m_Blocks.GetSize(); i++) { FX_Free((FX_LPBYTE)m_Blocks[i]); } } @@ -270,7 +270,7 @@ public: } } size_t nRead = FX_MIN(size, m_nCurSize - m_nCurPos); - if (!ReadBlock(buffer, (FX_INT32)m_nCurPos, nRead)) { + if (!ReadBlock(buffer, (int32_t)m_nCurPos, nRead)) { return 0; } return nRead; @@ -293,10 +293,10 @@ public: if (m_nCurPos > m_nTotalSize) { m_nTotalSize = (m_nCurPos + m_nGrowSize - 1) / m_nGrowSize * m_nGrowSize; if (m_Blocks.GetSize() < 1) { - void* block = FX_Alloc(FX_BYTE, m_nTotalSize); + void* block = FX_Alloc(uint8_t, m_nTotalSize); m_Blocks.Add(block); } else { - m_Blocks[0] = FX_Realloc(FX_BYTE, m_Blocks[0], m_nTotalSize); + m_Blocks[0] = FX_Realloc(uint8_t, m_Blocks[0], m_nTotalSize); } if (!m_Blocks[0]) { m_Blocks.RemoveAll(); @@ -347,7 +347,7 @@ public: { if (m_dwFlags & FX_MEMSTREAM_Consecutive) { if (m_Blocks.GetSize() < 1) { - FX_LPBYTE pBlock = FX_Alloc(FX_BYTE, FX_MAX(nInitSize, 4096)); + FX_LPBYTE pBlock = FX_Alloc(uint8_t, FX_MAX(nInitSize, 4096)); m_Blocks.Add(pBlock); } m_nGrowSize = FX_MAX(nGrowSize, 4096); @@ -400,11 +400,11 @@ protected: if (size <= m_nTotalSize) { return TRUE; } - FX_INT32 iCount = m_Blocks.GetSize(); + int32_t iCount = m_Blocks.GetSize(); size = (size - m_nTotalSize + m_nGrowSize - 1) / m_nGrowSize; - m_Blocks.SetSize(m_Blocks.GetSize() + (FX_INT32)size); + m_Blocks.SetSize(m_Blocks.GetSize() + (int32_t)size); while (size --) { - FX_LPBYTE pBlock = FX_Alloc(FX_BYTE, m_nGrowSize); + FX_LPBYTE pBlock = FX_Alloc(uint8_t, m_nGrowSize); m_Blocks.SetAt(iCount ++, pBlock); m_nTotalSize += m_nGrowSize; } @@ -431,7 +431,7 @@ typedef struct _FX_MTRANDOMCONTEXT { } FX_MTRANDOMCONTEXT, * FX_LPMTRANDOMCONTEXT; typedef FX_MTRANDOMCONTEXT const * FX_LPCMTRANDOMCONTEXT; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, FX_INT32 iCount); +FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, int32_t iCount); #endif #ifdef __cplusplus } diff --git a/core/src/fxcrt/fx_arabic.cpp b/core/src/fxcrt/fx_arabic.cpp index 04ce172c3f..30caa24ec2 100644 --- a/core/src/fxcrt/fx_arabic.cpp +++ b/core/src/fxcrt/fx_arabic.cpp @@ -24,8 +24,8 @@ CFX_BidiChar::CFX_BidiChar() FX_BOOL CFX_BidiChar::AppendChar(FX_WCHAR wch) { FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; - FX_INT32 iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; - FX_INT32 iContext = 0; + int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; + int32_t iContext = 0; switch (iBidiCls) { case FX_BIDICLASS_L: case FX_BIDICLASS_AN: @@ -69,7 +69,7 @@ FX_BOOL CFX_BidiChar::EndChar() m_iLastCount = m_iCurCount - m_iLastStart; return m_iLastCount > 0; } -FX_INT32 CFX_BidiChar::GetBidiInfo(FX_INT32 &iStart, FX_INT32 &iCount) +int32_t CFX_BidiChar::GetBidiInfo(int32_t &iStart, int32_t &iCount) { iStart = m_iLastStart; iCount = m_iLastCount; diff --git a/core/src/fxcrt/fx_arabic.h b/core/src/fxcrt/fx_arabic.h index 741bfb9c3d..081294605a 100644 --- a/core/src/fxcrt/fx_arabic.h +++ b/core/src/fxcrt/fx_arabic.h @@ -21,18 +21,18 @@ public: } virtual FX_BOOL AppendChar(FX_WCHAR wch) override; virtual FX_BOOL EndChar() override; - virtual FX_INT32 GetBidiInfo(FX_INT32 &iStart, FX_INT32 &iCount) override; + virtual int32_t GetBidiInfo(int32_t &iStart, int32_t &iCount) override; virtual void Reset() override; private: ~CFX_BidiChar() { } - FX_BOOL m_bSeparateNeutral; - FX_INT32 m_iCurStart; - FX_INT32 m_iCurCount; - FX_INT32 m_iCurBidi; - FX_INT32 m_iLastBidi; - FX_INT32 m_iLastStart; - FX_INT32 m_iLastCount; + FX_BOOL m_bSeparateNeutral; + int32_t m_iCurStart; + int32_t m_iCurCount; + int32_t m_iCurBidi; + int32_t m_iLastBidi; + int32_t m_iLastStart; + int32_t m_iLastCount; }; #endif // CORE_SRC_FXCRT_FX_ARABIC_H_ diff --git a/core/src/fxcrt/fx_basic_array.cpp b/core/src/fxcrt/fx_basic_array.cpp index 43a5417c00..315c83e53a 100644 --- a/core/src/fxcrt/fx_basic_array.cpp +++ b/core/src/fxcrt/fx_basic_array.cpp @@ -38,7 +38,7 @@ FX_BOOL CFX_BasicArray::SetSize(int nNewSize) m_nSize = m_nMaxSize = 0; return FALSE; } - m_pData = FX_Alloc(FX_BYTE, totalSize.ValueOrDie()); + m_pData = FX_Alloc(uint8_t, totalSize.ValueOrDie()); m_nSize = m_nMaxSize = nNewSize; } else if (nNewSize <= m_nMaxSize) { if (nNewSize > m_nSize) { @@ -52,7 +52,7 @@ FX_BOOL CFX_BasicArray::SetSize(int nNewSize) if (!totalSize.IsValid() || nNewMax < m_nSize) { return FALSE; } - FX_LPBYTE pNewData = FX_Realloc(FX_BYTE, m_pData, totalSize.ValueOrDie()); + FX_LPBYTE pNewData = FX_Realloc(uint8_t, m_pData, totalSize.ValueOrDie()); if (pNewData == NULL) { return FALSE; } @@ -185,7 +185,7 @@ void* CFX_BaseSegmentedArray::Add() if (m_DataSize % m_SegmentSize) { return GetAt(m_DataSize ++); } - void* pSegment = FX_Alloc2D(FX_BYTE, m_UnitSize, m_SegmentSize); + void* pSegment = FX_Alloc2D(uint8_t, m_UnitSize, m_SegmentSize); if (m_pIndex == NULL) { m_pIndex = pSegment; m_DataSize ++; @@ -315,8 +315,8 @@ void CFX_BaseSegmentedArray::Delete(int index, int count) } int i; for (i = index; i < m_DataSize - count; i ++) { - FX_BYTE* pSrc = (FX_BYTE*)GetAt(i + count); - FX_BYTE* pDest = (FX_BYTE*)GetAt(i); + uint8_t* pSrc = (uint8_t*)GetAt(i + count); + uint8_t* pDest = (uint8_t*)GetAt(i); for (int j = 0; j < m_UnitSize; j ++) { pDest[j] = pSrc[j]; } diff --git a/core/src/fxcrt/fx_basic_bstring.cpp b/core/src/fxcrt/fx_basic_bstring.cpp index 2377a6d624..78698fc6d0 100644 --- a/core/src/fxcrt/fx_basic_bstring.cpp +++ b/core/src/fxcrt/fx_basic_bstring.cpp @@ -72,7 +72,7 @@ CFX_ByteString::StringData* CFX_ByteString::StringData::Create(int nLen) int usableSize = totalSize - overhead; FXSYS_assert(usableSize >= nLen); - void* pData = FX_Alloc(FX_BYTE, totalSize); + void* pData = FX_Alloc(uint8_t, totalSize); return new (pData) StringData(nLen, usableSize); } CFX_ByteString::~CFX_ByteString() @@ -284,11 +284,11 @@ bool CFX_ByteString::EqualNoCase(FX_BSTR str) const FX_LPCBYTE pThat = str.GetPtr(); for (FX_STRSIZE i = 0; i < len; i ++) { if ((*pThis) != (*pThat)) { - FX_BYTE bThis = *pThis; + uint8_t bThis = *pThis; if (bThis >= 'A' && bThis <= 'Z') { bThis += 'a' - 'A'; } - FX_BYTE bThat = *pThat; + uint8_t bThat = *pThat; if (bThat >= 'A' && bThat <= 'Z') { bThat += 'a' - 'A'; } @@ -645,7 +645,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList) case 'X': case 'o': if (nModifier & FORCE_INT64) { - va_arg(argList, FX_INT64); + va_arg(argList, int64_t); } else { va_arg(argList, int); } @@ -936,7 +936,7 @@ CFX_WideString CFX_ByteString::UTF8Decode() const { CFX_UTF8Decoder decoder; for (FX_STRSIZE i = 0; i < GetLength(); i ++) { - decoder.Input((FX_BYTE)m_pData->m_String[i]); + decoder.Input((uint8_t)m_pData->m_String[i]); } return decoder.GetResult(); } @@ -969,9 +969,9 @@ int CFX_ByteString::Compare(FX_BSTR str) const int that_len = str.GetLength(); int min_len = this_len < that_len ? this_len : that_len; for (int i = 0; i < min_len; i ++) { - if ((FX_BYTE)m_pData->m_String[i] < str.GetAt(i)) { + if ((uint8_t)m_pData->m_String[i] < str.GetAt(i)) { return -1; - } else if ((FX_BYTE)m_pData->m_String[i] > str.GetAt(i)) { + } else if ((uint8_t)m_pData->m_String[i] > str.GetAt(i)) { return 1; } } diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp index 06ba9413a5..7d45a43128 100644 --- a/core/src/fxcrt/fx_basic_buffer.cpp +++ b/core/src/fxcrt/fx_basic_buffer.cpp @@ -18,7 +18,7 @@ CFX_BinaryBuf::CFX_BinaryBuf(FX_STRSIZE size) , m_DataSize(size) , m_AllocSize(size) { - m_pBuffer = FX_Alloc(FX_BYTE, size); + m_pBuffer = FX_Alloc(uint8_t, size); } CFX_BinaryBuf::~CFX_BinaryBuf() { @@ -84,9 +84,9 @@ void CFX_BinaryBuf::ExpandBuf(FX_STRSIZE add_size) new_size = (new_size + alloc_step - 1) / alloc_step * alloc_step; FX_LPBYTE pNewBuffer = m_pBuffer; if (pNewBuffer) { - pNewBuffer = FX_Realloc(FX_BYTE, m_pBuffer, new_size); + pNewBuffer = FX_Realloc(uint8_t, m_pBuffer, new_size); } else { - pNewBuffer = FX_Alloc(FX_BYTE, new_size); + pNewBuffer = FX_Alloc(uint8_t, new_size); } m_pBuffer = pNewBuffer; m_AllocSize = new_size; @@ -126,7 +126,7 @@ void CFX_BinaryBuf::InsertBlock(FX_STRSIZE pos, const void* pBuf, FX_STRSIZE siz } m_DataSize += size; } -void CFX_BinaryBuf::AppendFill(FX_BYTE byte, FX_STRSIZE count) +void CFX_BinaryBuf::AppendFill(uint8_t byte, FX_STRSIZE count) { ExpandBuf(count); if (!m_pBuffer) { @@ -242,7 +242,7 @@ CFX_WideStringC CFX_WideTextBuf::GetWideString() const { return CFX_WideStringC((FX_LPCWSTR)m_pBuffer, m_DataSize / sizeof(FX_WCHAR)); } -CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (FX_BYTE i) +CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (uint8_t i) { if (m_pStream) { m_pStream->WriteBlock(&i, 1); @@ -325,7 +325,7 @@ FX_BOOL CFX_ArchiveLoader::IsEOF() { return m_LoadingPos >= m_LoadingSize; } -CFX_ArchiveLoader& CFX_ArchiveLoader::operator >> (FX_BYTE& i) +CFX_ArchiveLoader& CFX_ArchiveLoader::operator >> (uint8_t& i) { if (m_LoadingPos >= m_LoadingSize) { return *this; @@ -447,13 +447,13 @@ FX_BOOL IFX_BufferArchive::Flush() m_Length = 0; return bRet; } -FX_INT32 IFX_BufferArchive::AppendBlock(const void* pBuf, size_t size) +int32_t IFX_BufferArchive::AppendBlock(const void* pBuf, size_t size) { if (!pBuf || size < 1) { return 0; } if (!m_pBuffer) { - m_pBuffer = FX_Alloc(FX_BYTE, m_BufSize); + m_pBuffer = FX_Alloc(uint8_t, m_BufSize); } FX_LPBYTE buffer = (FX_LPBYTE)pBuf; FX_STRSIZE temp_size = (FX_STRSIZE)size; @@ -469,19 +469,19 @@ FX_INT32 IFX_BufferArchive::AppendBlock(const void* pBuf, size_t size) temp_size -= buf_size; buffer += buf_size; } - return (FX_INT32)size; + return (int32_t)size; } -FX_INT32 IFX_BufferArchive::AppendByte(FX_BYTE byte) +int32_t IFX_BufferArchive::AppendByte(uint8_t byte) { return AppendBlock(&byte, 1); } -FX_INT32 IFX_BufferArchive::AppendDWord(FX_DWORD i) +int32_t IFX_BufferArchive::AppendDWord(FX_DWORD i) { char buf[32]; FXSYS_itoa(i, buf, 10); return AppendBlock(buf, (size_t)FXSYS_strlen(buf)); } -FX_INT32 IFX_BufferArchive::AppendString(FX_BSTR lpsz) +int32_t IFX_BufferArchive::AppendString(FX_BSTR lpsz) { return AppendBlock(lpsz.GetPtr(), lpsz.GetLength()); } diff --git a/core/src/fxcrt/fx_basic_coords.cpp b/core/src/fxcrt/fx_basic_coords.cpp index 8e7bb3e751..496b1443d1 100644 --- a/core/src/fxcrt/fx_basic_coords.cpp +++ b/core/src/fxcrt/fx_basic_coords.cpp @@ -430,7 +430,7 @@ FX_FLOAT CFX_Matrix::TransformXDistance(FX_FLOAT dx) const FX_FLOAT fx = a * dx, fy = b * dx; return FXSYS_sqrt(fx * fx + fy * fy); } -FX_INT32 CFX_Matrix::TransformXDistance(FX_INT32 dx) const +int32_t CFX_Matrix::TransformXDistance(int32_t dx) const { FX_FLOAT fx = a * dx, fy = b * dx; return FXSYS_round(FXSYS_sqrt(fx * fx + fy * fy)); @@ -440,7 +440,7 @@ FX_FLOAT CFX_Matrix::TransformYDistance(FX_FLOAT dy) const FX_FLOAT fx = c * dy, fy = d * dy; return FXSYS_sqrt(fx * fx + fy * fy); } -FX_INT32 CFX_Matrix::TransformYDistance(FX_INT32 dy) const +int32_t CFX_Matrix::TransformYDistance(int32_t dy) const { FX_FLOAT fx = c * dy, fy = d * dy; return FXSYS_round(FXSYS_sqrt(fx * fx + fy * fy)); @@ -450,7 +450,7 @@ FX_FLOAT CFX_Matrix::TransformDistance(FX_FLOAT dx, FX_FLOAT dy) const FX_FLOAT fx = a * dx + c * dy, fy = b * dx + d * dy; return FXSYS_sqrt(fx * fx + fy * fy); } -FX_INT32 CFX_Matrix::TransformDistance(FX_INT32 dx, FX_INT32 dy) const +int32_t CFX_Matrix::TransformDistance(int32_t dx, int32_t dy) const { FX_FLOAT fx = a * dx + c * dy, fy = b * dx + d * dy; return FXSYS_round(FXSYS_sqrt(fx * fx + fy * fy)); @@ -472,11 +472,11 @@ void CFX_Matrix::TransformVector(CFX_Vector &v) const v.x = FXSYS_round(fx); v.y = FXSYS_round(fy); } -void CFX_Matrix::TransformPoints(CFX_Point *points, FX_INT32 iCount) const +void CFX_Matrix::TransformPoints(CFX_Point *points, int32_t iCount) const { FXSYS_assert(iCount > 0); FX_FLOAT fx, fy; - for (FX_INT32 i = 0; i < iCount; i ++) { + for (int32_t i = 0; i < iCount; i ++) { fx = a * points->x + c * points->y + e; fy = b * points->x + d * points->y + f; points->x = FXSYS_round(fx); @@ -484,11 +484,11 @@ void CFX_Matrix::TransformPoints(CFX_Point *points, FX_INT32 iCount) const points ++; } } -void CFX_Matrix::TransformPoints(CFX_PointF *points, FX_INT32 iCount) const +void CFX_Matrix::TransformPoints(CFX_PointF *points, int32_t iCount) const { FXSYS_assert(iCount > 0); FX_FLOAT fx, fy; - for (FX_INT32 i = 0; i < iCount; i ++) { + for (int32_t i = 0; i < iCount; i ++) { fx = a * points->x + c * points->y + e; fy = b * points->x + d * points->y + f; points->x = fx, points->y = fy; @@ -501,7 +501,7 @@ void CFX_Matrix::TransformPoint(FX_FLOAT &x, FX_FLOAT &y) const FX_FLOAT fy = b * x + d * y + f; x = fx, y = fy; } -void CFX_Matrix::TransformPoint(FX_INT32 &x, FX_INT32 &y) const +void CFX_Matrix::TransformPoint(int32_t &x, int32_t &y) const { FX_FLOAT fx = a * x + c * y + e; FX_FLOAT fy = b * x + d * y + f; diff --git a/core/src/fxcrt/fx_basic_gcc.cpp b/core/src/fxcrt/fx_basic_gcc.cpp index 93c71ce660..caa99926a6 100644 --- a/core/src/fxcrt/fx_basic_gcc.cpp +++ b/core/src/fxcrt/fx_basic_gcc.cpp @@ -58,29 +58,29 @@ STR_T FXSYS_IntToStr(T value, STR_T string, int radix) #ifdef __cplusplus extern "C" { #endif -FX_INT32 FXSYS_atoi(FX_LPCSTR str) +int32_t FXSYS_atoi(FX_LPCSTR str) { - return FXSYS_StrToInt(str); + return FXSYS_StrToInt(str); } -FX_INT32 FXSYS_wtoi(FX_LPCWSTR str) +int32_t FXSYS_wtoi(FX_LPCWSTR str) { - return FXSYS_StrToInt(str); + return FXSYS_StrToInt(str); } -FX_INT64 FXSYS_atoi64(FX_LPCSTR str) +int64_t FXSYS_atoi64(FX_LPCSTR str) { - return FXSYS_StrToInt(str); + return FXSYS_StrToInt(str); } -FX_INT64 FXSYS_wtoi64(FX_LPCWSTR str) +int64_t FXSYS_wtoi64(FX_LPCWSTR str) { - return FXSYS_StrToInt(str); + return FXSYS_StrToInt(str); } -FX_LPCSTR FXSYS_i64toa(FX_INT64 value, FX_LPSTR str, int radix) +FX_LPCSTR FXSYS_i64toa(int64_t value, FX_LPSTR str, int radix) { - return FXSYS_IntToStr(value, str, radix); + return FXSYS_IntToStr(value, str, radix); } -FX_LPCWSTR FXSYS_i64tow(FX_INT64 value, FX_LPWSTR str, int radix) +FX_LPCWSTR FXSYS_i64tow(int64_t value, FX_LPWSTR str, int radix) { - return FXSYS_IntToStr(value, str, radix); + return FXSYS_IntToStr(value, str, radix); } #ifdef __cplusplus } @@ -194,7 +194,7 @@ int FXSYS_wcsicmp(const FX_WCHAR *dst, const FX_WCHAR *src) } char* FXSYS_itoa(int value, char* string, int radix) { - return FXSYS_IntToStr(value, string, radix); + return FXSYS_IntToStr(value, string, radix); } #ifdef __cplusplus } diff --git a/core/src/fxcrt/fx_basic_maps.cpp b/core/src/fxcrt/fx_basic_maps.cpp index 7fca42acde..c0c394583e 100644 --- a/core/src/fxcrt/fx_basic_maps.cpp +++ b/core/src/fxcrt/fx_basic_maps.cpp @@ -42,7 +42,7 @@ CFX_MapPtrToPtr::~CFX_MapPtrToPtr() } FX_DWORD CFX_MapPtrToPtr::HashKey(void* key) const { - return ((FX_DWORD)(FX_UINTPTR)key) >> 4; + return ((FX_DWORD)(uintptr_t)key) >> 4; } void CFX_MapPtrToPtr::GetNextAssoc(FX_POSITION& rNextPosition, void*& rKey, void*& rValue) const { @@ -377,10 +377,10 @@ FX_BOOL CFX_MapByteStringToPtr::RemoveKey(FX_BSTR key) return FALSE; } struct _CompactString { - FX_BYTE m_CompactLen; - FX_BYTE m_LenHigh; - FX_BYTE m_LenLow; - FX_BYTE m_Unused; + uint8_t m_CompactLen; + uint8_t m_LenHigh; + uint8_t m_LenLow; + uint8_t m_Unused; FX_LPBYTE m_pBuffer; }; static void _CompactStringRelease(_CompactString* pCompact) @@ -405,14 +405,14 @@ static FX_BOOL _CompactStringSame(_CompactString* pCompact, FX_LPCBYTE pStr, int static void _CompactStringStore(_CompactString* pCompact, FX_LPCBYTE pStr, int len) { if (len < (int)sizeof(_CompactString)) { - pCompact->m_CompactLen = (FX_BYTE)len; + pCompact->m_CompactLen = (uint8_t)len; FXSYS_memcpy32(&pCompact->m_LenHigh, pStr, len); return; } pCompact->m_CompactLen = 0xff; pCompact->m_LenHigh = len / 256; pCompact->m_LenLow = len % 256; - pCompact->m_pBuffer = FX_Alloc(FX_BYTE, len); + pCompact->m_pBuffer = FX_Alloc(uint8_t, len); FXSYS_memcpy32(pCompact->m_pBuffer, pStr, len); } static CFX_ByteStringC _CompactStringGet(_CompactString* pCompact) @@ -449,7 +449,7 @@ FX_POSITION CFX_CMapByteStringToPtr::GetStartPosition() const for (int i = 0; i < size; i ++) { _CompactString* pKey = (_CompactString*)m_Buffer.GetAt(i); if (pKey->m_CompactLen != 0xfe) { - return (FX_POSITION)(FX_UINTPTR)(i + 1); + return (FX_POSITION)(uintptr_t)(i + 1); } } return NULL; @@ -459,7 +459,7 @@ void CFX_CMapByteStringToPtr::GetNextAssoc(FX_POSITION& rNextPosition, CFX_ByteS if (rNextPosition == NULL) { return; } - int index = (int)(FX_UINTPTR)rNextPosition - 1; + int index = (int)(uintptr_t)rNextPosition - 1; _CompactString* pKey = (_CompactString*)m_Buffer.GetAt(index); rKey = _CompactStringGet(pKey); rValue = *(void**)(pKey + 1); @@ -468,7 +468,7 @@ void CFX_CMapByteStringToPtr::GetNextAssoc(FX_POSITION& rNextPosition, CFX_ByteS while (index < size) { pKey = (_CompactString*)m_Buffer.GetAt(index); if (pKey->m_CompactLen != 0xfe) { - rNextPosition = (FX_POSITION)(FX_UINTPTR)(index + 1); + rNextPosition = (FX_POSITION)(uintptr_t)(index + 1); return; } index ++; @@ -480,7 +480,7 @@ FX_LPVOID CFX_CMapByteStringToPtr::GetNextValue(FX_POSITION& rNextPosition) cons if (rNextPosition == NULL) { return NULL; } - int index = (int)(FX_UINTPTR)rNextPosition - 1; + int index = (int)(uintptr_t)rNextPosition - 1; _CompactString* pKey = (_CompactString*)m_Buffer.GetAt(index); FX_LPVOID rValue = *(void**)(pKey + 1); index ++; @@ -488,7 +488,7 @@ FX_LPVOID CFX_CMapByteStringToPtr::GetNextValue(FX_POSITION& rNextPosition) cons while (index < size) { pKey = (_CompactString*)m_Buffer.GetAt(index); if (pKey->m_CompactLen != 0xfe) { - rNextPosition = (FX_POSITION)(FX_UINTPTR)(index + 1); + rNextPosition = (FX_POSITION)(uintptr_t)(index + 1); return rValue; } index ++; @@ -601,7 +601,7 @@ void CFX_CMapDWordToDWord::GetNextAssoc(FX_POSITION& pos, FX_DWORD& key, FX_DWOR if (pos == 0) { return; } - FX_DWORD index = ((FX_DWORD)(FX_UINTPTR)pos) - 1; + FX_DWORD index = ((FX_DWORD)(uintptr_t)pos) - 1; FX_DWORD count = m_Buffer.GetSize() / sizeof(_DWordPair); _DWordPair* buf = (_DWordPair*)m_Buffer.GetBuffer(); key = buf[index].key; @@ -609,7 +609,7 @@ void CFX_CMapDWordToDWord::GetNextAssoc(FX_POSITION& pos, FX_DWORD& key, FX_DWOR if (index == count - 1) { pos = 0; } else { - pos = (FX_POSITION)((FX_UINTPTR)pos + 1); + pos = (FX_POSITION)((uintptr_t)pos + 1); } } void CFX_CMapDWordToDWord::SetAt(FX_DWORD key, FX_DWORD value) diff --git a/core/src/fxcrt/fx_basic_memmgr.cpp b/core/src/fxcrt/fx_basic_memmgr.cpp index 63c609daec..a381fa4ef5 100644 --- a/core/src/fxcrt/fx_basic_memmgr.cpp +++ b/core/src/fxcrt/fx_basic_memmgr.cpp @@ -63,7 +63,7 @@ void* CFX_GrowOnlyPool::Alloc(size_t size) pTrunk = pTrunk->m_pNext; } size_t alloc_size = size > m_TrunkSize ? size : m_TrunkSize; - pTrunk = (_FX_GrowOnlyTrunk*)FX_Alloc(FX_BYTE, sizeof(_FX_GrowOnlyTrunk) + alloc_size); + pTrunk = (_FX_GrowOnlyTrunk*)FX_Alloc(uint8_t, sizeof(_FX_GrowOnlyTrunk) + alloc_size); pTrunk->m_Size = alloc_size; pTrunk->m_Allocated = size; pTrunk->m_pNext = (_FX_GrowOnlyTrunk*)m_pFirstTrunk; diff --git a/core/src/fxcrt/fx_basic_plex.cpp b/core/src/fxcrt/fx_basic_plex.cpp index 78319bd5da..802429600a 100644 --- a/core/src/fxcrt/fx_basic_plex.cpp +++ b/core/src/fxcrt/fx_basic_plex.cpp @@ -8,7 +8,7 @@ #include "plex.h" CFX_Plex* CFX_Plex::Create(CFX_Plex*& pHead, FX_DWORD nMax, FX_DWORD cbElement) { - CFX_Plex* p = (CFX_Plex*)FX_Alloc(FX_BYTE, sizeof(CFX_Plex) + nMax * cbElement); + CFX_Plex* p = (CFX_Plex*)FX_Alloc(uint8_t, sizeof(CFX_Plex) + nMax * cbElement); p->pNext = pHead; pHead = p; return p; @@ -17,7 +17,7 @@ void CFX_Plex::FreeDataChain() { CFX_Plex* p = this; while (p != NULL) { - FX_BYTE* bytes = (FX_BYTE*)p; + uint8_t* bytes = (uint8_t*)p; CFX_Plex* pNext = p->pNext; FX_Free(bytes); p = pNext; diff --git a/core/src/fxcrt/fx_basic_utf.cpp b/core/src/fxcrt/fx_basic_utf.cpp index f52b83efda..1422b7abd4 100644 --- a/core/src/fxcrt/fx_basic_utf.cpp +++ b/core/src/fxcrt/fx_basic_utf.cpp @@ -14,7 +14,7 @@ void CFX_UTF8Decoder::AppendChar(FX_DWORD ch) { m_Buffer.AppendChar((FX_WCHAR)ch); } -void CFX_UTF8Decoder::Input(FX_BYTE byte) +void CFX_UTF8Decoder::Input(uint8_t byte) { if (byte < 0x80) { m_PendingBytes = 0; @@ -65,7 +65,7 @@ void CFX_UTF8Encoder::Input(FX_WCHAR unicode) } else { nbytes = 6; } - static FX_BYTE prefix[] = {0xc0, 0xe0, 0xf0, 0xf8, 0xfc}; + static uint8_t prefix[] = {0xc0, 0xe0, 0xf0, 0xf8, 0xfc}; int order = 1 << ((nbytes - 1) * 6); int code = unicode; m_Buffer.AppendChar(prefix[nbytes - 2] | (code / order)); diff --git a/core/src/fxcrt/fx_basic_util.cpp b/core/src/fxcrt/fx_basic_util.cpp index fd411919f1..4ccb93ccbb 100644 --- a/core/src/fxcrt/fx_basic_util.cpp +++ b/core/src/fxcrt/fx_basic_util.cpp @@ -187,22 +187,22 @@ void FXSYS_vsnprintf(char *str, size_t size, const char* fmt, va_list ap) } #endif // _FXM_PLATFORM_WINDOWS_ && _MSC_VER < 1900 -static FX_BOOL FX_IsDigit(FX_BYTE ch) +static FX_BOOL FX_IsDigit(uint8_t ch) { return (ch >= '0' && ch <= '9') ? TRUE : FALSE; } -static FX_BOOL FX_IsXDigit(FX_BYTE ch) +static FX_BOOL FX_IsXDigit(uint8_t ch) { return (FX_IsDigit(ch) || (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f')) ? TRUE : FALSE; } -static FX_BYTE FX_MakeUpper(FX_BYTE ch) +static uint8_t FX_MakeUpper(uint8_t ch) { if (ch < 'a' || ch > 'z') { return ch; } return ch - 32; } -static int FX_HexToI(FX_BYTE ch) +static int FX_HexToI(uint8_t ch) { ch = FX_MakeUpper(ch); return FX_IsDigit(ch) ? (ch - '0') : (ch - 55); @@ -237,7 +237,7 @@ CFX_ByteString FX_UrlEncode(const CFX_WideString& wsUrl) int nByte = bsUri.GetLength(); for (int j = 0; j < nByte; j++) { rUrl += '%'; - FX_BYTE code = bsUri.GetAt(j); + uint8_t code = bsUri.GetAt(j); rUrl += arDigits[code >> 4]; rUrl += arDigits[code & 0x0F]; } @@ -268,7 +268,7 @@ CFX_ByteString FX_EncodeURI(const CFX_WideString& wsURI) CFX_ByteString bsUri = wsURI.UTF8Encode(); int nLength = bsUri.GetLength(); for (int i = 0; i < nLength; i++) { - FX_BYTE code = bsUri.GetAt(i); + uint8_t code = bsUri.GetAt(i); if (code > 0x7F || url_encodeTable[code] == 1) { rURI += '%'; rURI += arDigits[code >> 4]; diff --git a/core/src/fxcrt/fx_basic_wstring.cpp b/core/src/fxcrt/fx_basic_wstring.cpp index 09e64e0c72..aeb366338e 100644 --- a/core/src/fxcrt/fx_basic_wstring.cpp +++ b/core/src/fxcrt/fx_basic_wstring.cpp @@ -33,7 +33,7 @@ CFX_WideString::StringData* CFX_WideString::StringData::Create(int nLen) int usableLen = (totalSize - overhead) / sizeof(FX_WCHAR); FXSYS_assert(usableLen >= nLen); - void* pData = FX_Alloc(FX_BYTE, iSize.ValueOrDie()); + void* pData = FX_Alloc(uint8_t, iSize.ValueOrDie()); return new (pData) StringData(nLen, usableLen); } CFX_WideString::~CFX_WideString() @@ -911,7 +911,7 @@ void CFX_WideString::FormatV(FX_LPCWSTR lpszFormat, va_list argList) case 'X': case 'o': if (nModifier & FORCE_INT64) { - va_arg(argList, FX_INT64); + va_arg(argList, int64_t); } else { va_arg(argList, int); } @@ -1068,7 +1068,7 @@ static const CFX_CharMap g_DefaultGBKMapper = {&_DefMap_GetWideString, &_DefMap_ static const CFX_CharMap g_DefaultJISMapper = {&_DefMap_GetWideString, &_DefMap_GetByteString, &_DefMap_GetJISCodePage}; static const CFX_CharMap g_DefaultUHCMapper = {&_DefMap_GetWideString, &_DefMap_GetByteString, &_DefMap_GetUHCCodePage}; static const CFX_CharMap g_DefaultBig5Mapper = {&_DefMap_GetWideString, &_DefMap_GetByteString, &_DefMap_GetBig5CodePage}; -CFX_CharMap* CFX_CharMap::GetDefaultMapper(FX_INT32 codepage) +CFX_CharMap* CFX_CharMap::GetDefaultMapper(int32_t codepage) { switch (codepage) { case 0: diff --git a/core/src/fxcrt/fx_extension.cpp b/core/src/fxcrt/fx_extension.cpp index 20e2e1a320..eeecc811c2 100644 --- a/core/src/fxcrt/fx_extension.cpp +++ b/core/src/fxcrt/fx_extension.cpp @@ -139,25 +139,25 @@ FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x) { return FXSYS_log(x) / FXSYS_log(b); } -FX_FLOAT FXSYS_strtof(FX_LPCSTR pcsStr, FX_INT32 iLength, FX_INT32 *pUsedLen) +FX_FLOAT FXSYS_strtof(FX_LPCSTR pcsStr, int32_t iLength, int32_t *pUsedLen) { FXSYS_assert(pcsStr != NULL); if (iLength < 0) { - iLength = (FX_INT32)FXSYS_strlen(pcsStr); + iLength = (int32_t)FXSYS_strlen(pcsStr); } CFX_WideString ws = CFX_WideString::FromLocal(pcsStr, iLength); return FXSYS_wcstof(ws.c_str(), iLength, pUsedLen); } -FX_FLOAT FXSYS_wcstof(FX_LPCWSTR pwsStr, FX_INT32 iLength, FX_INT32 *pUsedLen) +FX_FLOAT FXSYS_wcstof(FX_LPCWSTR pwsStr, int32_t iLength, int32_t *pUsedLen) { FXSYS_assert(pwsStr != NULL); if (iLength < 0) { - iLength = (FX_INT32)FXSYS_wcslen(pwsStr); + iLength = (int32_t)FXSYS_wcslen(pwsStr); } if (iLength == 0) { return 0.0f; } - FX_INT32 iUsedLen = 0; + int32_t iUsedLen = 0; FX_BOOL bNegtive = FALSE; switch (pwsStr[iUsedLen]) { case '-': @@ -202,7 +202,7 @@ FX_LPWSTR FXSYS_wcsncpy(FX_LPWSTR dstStr, FX_LPCWSTR srcStr, size_t count) } return dstStr; } -FX_INT32 FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count) +int32_t FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count) { FXSYS_assert(s1 != NULL && s2 != NULL && count > 0); FX_WCHAR wch1 = 0, wch2 = 0; @@ -215,7 +215,7 @@ FX_INT32 FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count) } return wch1 - wch2; } -FX_INT32 FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count) +int32_t FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count) { FXSYS_assert(s1 != NULL && s2 != NULL && count > 0); FX_CHAR ch1 = 0, ch2 = 0; @@ -228,11 +228,11 @@ FX_INT32 FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count) } return ch1 - ch2; } -FX_DWORD FX_HashCode_String_GetA(FX_LPCSTR pStr, FX_INT32 iLength, FX_BOOL bIgnoreCase) +FX_DWORD FX_HashCode_String_GetA(FX_LPCSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase) { FXSYS_assert(pStr != NULL); if (iLength < 0) { - iLength = (FX_INT32)FXSYS_strlen(pStr); + iLength = (int32_t)FXSYS_strlen(pStr); } FX_LPCSTR pStrEnd = pStr + iLength; FX_DWORD dwHashCode = 0; @@ -247,11 +247,11 @@ FX_DWORD FX_HashCode_String_GetA(FX_LPCSTR pStr, FX_INT32 iLength, FX_BOOL bIgno } return dwHashCode; } -FX_DWORD FX_HashCode_String_GetW(FX_LPCWSTR pStr, FX_INT32 iLength, FX_BOOL bIgnoreCase) +FX_DWORD FX_HashCode_String_GetW(FX_LPCWSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase) { FXSYS_assert(pStr != NULL); if (iLength < 0) { - iLength = (FX_INT32)FXSYS_wcslen(pStr); + iLength = (int32_t)FXSYS_wcslen(pStr); } FX_LPCWSTR pStrEnd = pStr + iLength; FX_DWORD dwHashCode = 0; @@ -321,7 +321,7 @@ void FX_Random_MT_Close(FX_LPVOID pContext) FXSYS_assert(pContext != NULL); FX_Free(pContext); } -void FX_Random_GenerateMT(FX_LPDWORD pBuffer, FX_INT32 iCount) +void FX_Random_GenerateMT(FX_LPDWORD pBuffer, int32_t iCount) { FX_DWORD dwSeed; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ @@ -337,7 +337,7 @@ void FX_Random_GenerateMT(FX_LPDWORD pBuffer, FX_INT32 iCount) } FX_Random_MT_Close(pContext); } -void FX_Random_GenerateBase(FX_LPDWORD pBuffer, FX_INT32 iCount) +void FX_Random_GenerateBase(FX_LPDWORD pBuffer, int32_t iCount) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ SYSTEMTIME st1, st2; @@ -358,7 +358,7 @@ void FX_Random_GenerateBase(FX_LPDWORD pBuffer, FX_INT32 iCount) } } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, FX_INT32 iCount) +FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, int32_t iCount) { HCRYPTPROV hCP = NULL; if (!::CryptAcquireContext(&hCP, NULL, NULL, PROV_RSA_FULL, 0) || hCP == NULL) { @@ -369,7 +369,7 @@ FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, FX_INT32 iCount) return TRUE; } #endif -void FX_Random_GenerateCrypto(FX_LPDWORD pBuffer, FX_INT32 iCount) +void FX_Random_GenerateCrypto(FX_LPDWORD pBuffer, int32_t iCount) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ FX_GenerateCryptoRandom(pBuffer, iCount); diff --git a/core/src/fxcrt/fx_unicode.cpp b/core/src/fxcrt/fx_unicode.cpp index aac6142ce4..0117c1ffc5 100644 --- a/core/src/fxcrt/fx_unicode.cpp +++ b/core/src/fxcrt/fx_unicode.cpp @@ -29,7 +29,7 @@ FX_BOOL FX_IsCombinationChar(FX_WCHAR wch) FX_BOOL FX_IsBidiChar(FX_WCHAR wch) { FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; - FX_INT32 iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; + int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; return (FX_BIDICLASS_R == iBidiCls || FX_BIDICLASS_AL == iBidiCls); } FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical) diff --git a/core/src/fxcrt/fx_xml_composer.cpp b/core/src/fxcrt/fx_xml_composer.cpp index 97c5dfd130..7858290f9a 100644 --- a/core/src/fxcrt/fx_xml_composer.cpp +++ b/core/src/fxcrt/fx_xml_composer.cpp @@ -11,7 +11,7 @@ void FX_XML_SplitQualifiedName(FX_BSTR bsFullName, CFX_ByteStringC &bsSpace, CFX if (bsFullName.IsEmpty()) { return; } - FX_INT32 iStart = 0; + int32_t iStart = 0; for (; iStart < bsFullName.GetLength(); iStart ++) { if (bsFullName.GetAt(iStart) == ':') { break; diff --git a/core/src/fxcrt/fx_xml_parser.cpp b/core/src/fxcrt/fx_xml_parser.cpp index 2c069cb132..5649a7db0e 100644 --- a/core/src/fxcrt/fx_xml_parser.cpp +++ b/core/src/fxcrt/fx_xml_parser.cpp @@ -64,7 +64,7 @@ FX_BOOL CXML_Parser::IsEOF() #define FXCRTM_XML_CHARTYPE_HexLowerLetter 0x40 #define FXCRTM_XML_CHARTYPE_HexUpperLetter 0x60 #define FXCRTM_XML_CHARTYPE_HexChar 0x60 -FX_BYTE g_FXCRT_XML_ByteTypes[256] = { +uint8_t g_FXCRT_XML_ByteTypes[256] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, @@ -82,27 +82,27 @@ FX_BYTE g_FXCRT_XML_ByteTypes[256] = { 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x01, 0x01, }; -FX_BOOL g_FXCRT_XML_IsWhiteSpace(FX_BYTE ch) +FX_BOOL g_FXCRT_XML_IsWhiteSpace(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_SpaceChar) != 0; } -FX_BOOL g_FXCRT_XML_IsLetter(FX_BYTE ch) +FX_BOOL g_FXCRT_XML_IsLetter(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_Letter) != 0; } -FX_BOOL g_FXCRT_XML_IsDigital(FX_BYTE ch) +FX_BOOL g_FXCRT_XML_IsDigital(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_Digital) != 0; } -FX_BOOL g_FXCRT_XML_IsNameIntro(FX_BYTE ch) +FX_BOOL g_FXCRT_XML_IsNameIntro(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_NameIntro) != 0; } -FX_BOOL g_FXCRT_XML_IsNameChar(FX_BYTE ch) +FX_BOOL g_FXCRT_XML_IsNameChar(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_NameChar) != 0; } -FX_BOOL g_FXCRT_XML_IsHexChar(FX_BYTE ch) +FX_BOOL g_FXCRT_XML_IsHexChar(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_HexChar) != 0; } @@ -129,7 +129,7 @@ void CXML_Parser::GetName(CFX_ByteString &space, CFX_ByteString &name) return; } CFX_ByteTextBuf buf; - FX_BYTE ch; + uint8_t ch; do { while (m_dwIndex < m_dwBufferSize) { ch = m_pBuffer[m_dwIndex]; @@ -156,7 +156,7 @@ void CXML_Parser::SkipLiterals(FX_BSTR str) if (IsEOF()) { return; } - FX_INT32 i = 0, iLen = str.GetLength(); + int32_t i = 0, iLen = str.GetLength(); do { while (m_dwIndex < m_dwBufferSize) { if (str.GetAt(i) != m_pBuffer[m_dwIndex ++]) { @@ -188,8 +188,8 @@ FX_DWORD CXML_Parser::GetCharRef() if (IsEOF()) { return 0; } - FX_BYTE ch; - FX_INT32 iState = 0; + uint8_t ch; + int32_t iState = 0; CFX_ByteTextBuf buf; FX_DWORD code = 0; do { @@ -246,7 +246,7 @@ FX_DWORD CXML_Parser::GetCharRef() iState = 10; break; } - FX_BYTE nHex = g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_HexChar; + uint8_t nHex = g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_HexChar; if (nHex) { if (nHex == FXCRTM_XML_CHARTYPE_HexDigital) { code = (code << 4) + ch - '0'; @@ -276,7 +276,7 @@ void CXML_Parser::GetAttrValue(CFX_WideString &value) return; } CFX_UTF8Decoder decoder; - FX_BYTE mark = 0, ch = 0; + uint8_t mark = 0, ch = 0; do { while (m_dwIndex < m_dwBufferSize) { ch = m_pBuffer[m_dwIndex]; @@ -317,8 +317,8 @@ void CXML_Parser::GetTagName(CFX_ByteString &space, CFX_ByteString &name, FX_BOO return; } bEndTag = FALSE; - FX_BYTE ch; - FX_INT32 iState = bStartTag ? 1 : 0; + uint8_t ch; + int32_t iState = bStartTag ? 1 : 0; do { while (m_dwIndex < m_dwBufferSize) { ch = m_pBuffer[m_dwIndex]; @@ -410,7 +410,7 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, FX_BOOL bStartTag if (IsEOF()) { return pElement; } - FX_BYTE ch = m_pBuffer[m_dwIndex ++]; + uint8_t ch = m_pBuffer[m_dwIndex ++]; if (ch == '/') { m_dwIndex ++; m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex; @@ -428,7 +428,7 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, FX_BOOL bStartTag CFX_UTF8Decoder decoder; CFX_WideTextBuf content; FX_BOOL bCDATA = FALSE; - FX_INT32 iState = 0; + int32_t iState = 0; do { while (m_dwIndex < m_dwBufferSize) { ch = m_pBuffer[m_dwIndex ++]; @@ -588,7 +588,7 @@ void CXML_Element::Empty() void CXML_Element::RemoveChildren() { for (int i = 0; i < m_Children.GetSize(); i += 2) { - ChildType type = (ChildType)(FX_UINTPTR)m_Children.GetAt(i); + ChildType type = (ChildType)(uintptr_t)m_Children.GetAt(i); if (type == Content) { CXML_Content* content = (CXML_Content*)m_Children.GetAt(i + 1); delete content; @@ -710,13 +710,13 @@ CXML_Element::ChildType CXML_Element::GetChildType(FX_DWORD index) const if (index >= (FX_DWORD)m_Children.GetSize()) { return Invalid; } - return (ChildType)(FX_UINTPTR)m_Children.GetAt(index); + return (ChildType)(uintptr_t)m_Children.GetAt(index); } CFX_WideString CXML_Element::GetContent(FX_DWORD index) const { index <<= 1; if (index >= (FX_DWORD)m_Children.GetSize() || - (ChildType)(FX_UINTPTR)m_Children.GetAt(index) != Content) { + (ChildType)(uintptr_t)m_Children.GetAt(index) != Content) { return CFX_WideString(); } CXML_Content* pContent = (CXML_Content*)m_Children.GetAt(index + 1); @@ -729,7 +729,7 @@ CXML_Element* CXML_Element::GetElement(FX_DWORD index) const { index <<= 1; if (index >= (FX_DWORD)m_Children.GetSize() || - (ChildType)(FX_UINTPTR)m_Children.GetAt(index) != Element) { + (ChildType)(uintptr_t)m_Children.GetAt(index) != Element) { return NULL; } return (CXML_Element*)m_Children.GetAt(index + 1); @@ -738,7 +738,7 @@ FX_DWORD CXML_Element::CountElements(FX_BSTR space, FX_BSTR tag) const { int count = 0; for (int i = 0; i < m_Children.GetSize(); i += 2) { - ChildType type = (ChildType)(FX_UINTPTR)m_Children.GetAt(i); + ChildType type = (ChildType)(uintptr_t)m_Children.GetAt(i); if (type != Element) { continue; } @@ -755,7 +755,7 @@ CXML_Element* CXML_Element::GetElement(FX_BSTR space, FX_BSTR tag, int index) co return NULL; } for (int i = 0; i < m_Children.GetSize(); i += 2) { - ChildType type = (ChildType)(FX_UINTPTR)m_Children.GetAt(i); + ChildType type = (ChildType)(uintptr_t)m_Children.GetAt(i); if (type != Element) { continue; } @@ -772,7 +772,7 @@ CXML_Element* CXML_Element::GetElement(FX_BSTR space, FX_BSTR tag, int index) co FX_DWORD CXML_Element::FindElement(CXML_Element *pChild) const { for (int i = 0; i < m_Children.GetSize(); i += 2) { - if ((ChildType)(FX_UINTPTR)m_Children.GetAt(i) == Element && + if ((ChildType)(uintptr_t)m_Children.GetAt(i) == Element && (CXML_Element*)m_Children.GetAt(i + 1) == pChild) { return (FX_DWORD)(i >> 1); } diff --git a/core/src/fxcrt/fxcrt_platforms.cpp b/core/src/fxcrt/fxcrt_platforms.cpp index 942d6a3c02..0810c2ff65 100644 --- a/core/src/fxcrt/fxcrt_platforms.cpp +++ b/core/src/fxcrt/fxcrt_platforms.cpp @@ -168,7 +168,7 @@ FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst) return FALSE; } FX_FILESIZE num = 0; - FX_LPBYTE pBuffer = FX_Alloc(FX_BYTE, 32768); + FX_LPBYTE pBuffer = FX_Alloc(uint8_t, 32768); while (num = src.Read(pBuffer, 32768)) { if (dst.Write(pBuffer, num) != num) { break; diff --git a/core/src/fxcrt/fxcrt_posix.cpp b/core/src/fxcrt/fxcrt_posix.cpp index 06d92c523d..b5fb0219af 100644 --- a/core/src/fxcrt/fxcrt_posix.cpp +++ b/core/src/fxcrt/fxcrt_posix.cpp @@ -11,7 +11,7 @@ IFXCRT_FileAccess* FXCRT_FileAccess_Create() { return new CFXCRT_FileAccess_Posix; } -void FXCRT_Posix_GetFileMode(FX_DWORD dwModes, FX_INT32 &nFlags, FX_INT32 &nMasks) +void FXCRT_Posix_GetFileMode(FX_DWORD dwModes, int32_t &nFlags, int32_t &nMasks) { nFlags = O_BINARY | O_LARGEFILE; if (dwModes & FX_FILEMODE_ReadOnly) { @@ -38,7 +38,7 @@ FX_BOOL CFXCRT_FileAccess_Posix::Open(FX_BSTR fileName, FX_DWORD dwMode) if (m_nFD > -1) { return FALSE; } - FX_INT32 nFlags, nMasks; + int32_t nFlags, nMasks; FXCRT_Posix_GetFileMode(dwMode, nFlags, nMasks); m_nFD = open(fileName.GetCStr(), nFlags, nMasks); return m_nFD > -1; @@ -164,7 +164,7 @@ FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst) return FALSE; } size_t num = 0; - FX_LPBYTE pBuffer = FX_Alloc(FX_BYTE, 32768); + FX_LPBYTE pBuffer = FX_Alloc(uint8_t, 32768); num = src.Read(pBuffer, 32768); while (num) { if (dst.Write(pBuffer, num) != num) { diff --git a/core/src/fxcrt/fxcrt_posix.h b/core/src/fxcrt/fxcrt_posix.h index 8c716cd6d6..0b4509ec73 100644 --- a/core/src/fxcrt/fxcrt_posix.h +++ b/core/src/fxcrt/fxcrt_posix.h @@ -29,7 +29,7 @@ public: virtual FX_BOOL Flush(); virtual FX_BOOL Truncate(FX_FILESIZE szFile); protected: - FX_INT32 m_nFD; + int32_t m_nFD; }; #endif diff --git a/core/src/fxcrt/xml_int.h b/core/src/fxcrt/xml_int.h index 7cfeec95f7..4155a39ffa 100644 --- a/core/src/fxcrt/xml_int.h +++ b/core/src/fxcrt/xml_int.h @@ -107,7 +107,7 @@ public: } m_dwSize = (size_t)FX_MIN(FX_XMLDATASTREAM_BufferSize, nLength - m_nStart); if (!m_pBuffer) { - m_pBuffer = FX_Alloc(FX_BYTE, m_dwSize); + m_pBuffer = FX_Alloc(uint8_t, m_dwSize); } return m_pFileRead->ReadBlock(m_pBuffer, m_nStart, m_dwSize); } diff --git a/core/src/fxge/agg/agg23/fx_agg_driver.cpp b/core/src/fxge/agg/agg23/fx_agg_driver.cpp index 08f76bf8e1..60843d7441 100644 --- a/core/src/fxge/agg/agg23/fx_agg_driver.cpp +++ b/core/src/fxge/agg/agg23/fx_agg_driver.cpp @@ -402,7 +402,7 @@ public: } else { src_alpha = m_Alpha; } - FX_BYTE dest_alpha = ori_scan[3] + src_alpha - ori_scan[3] * src_alpha / 255; + uint8_t dest_alpha = ori_scan[3] + src_alpha - ori_scan[3] * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (m_bFullCover) { @@ -476,7 +476,7 @@ public: dest_scan += 2; continue; } - FX_BYTE cover = cover_scan[col]; + uint8_t cover = cover_scan[col]; dest_scan[3] = FXDIB_ALPHA_MERGE(dest_scan[3], src_alpha, cover); *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, cover); dest_scan ++; @@ -535,7 +535,7 @@ public: } else { int index = 0; if (m_pDevice->GetPalette() == NULL) { - index = ((FX_BYTE)m_Color == 0xff) ? 1 : 0; + index = ((uint8_t)m_Color == 0xff) ? 1 : 0; } else { for (int i = 0; i < 2; i ++) if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) { @@ -573,7 +573,7 @@ public: dest_scan += col_start / 8; int index = 0; if (m_pDevice->GetPalette() == NULL) { - index = ((FX_BYTE)m_Color == 0xff) ? 1 : 0; + index = ((uint8_t)m_Color == 0xff) ? 1 : 0; } else { for (int i = 0; i < 2; i ++) if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) { @@ -628,7 +628,7 @@ public: *dest_scan = m_Gray; *dest_extra_alpha_scan = m_Alpha; } else { - FX_BYTE dest_alpha = (*dest_extra_alpha_scan) + src_alpha - + uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha - (*dest_extra_alpha_scan) * src_alpha / 255; *dest_extra_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; @@ -687,7 +687,7 @@ public: if (src_alpha == 255) { *(FX_DWORD*)dest_scan = m_Color; } else { - FX_BYTE dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255; + uint8_t dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio); @@ -730,7 +730,7 @@ public: dest_scan += 2; continue; } - FX_BYTE dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255; + uint8_t dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio); @@ -803,13 +803,13 @@ public: } if (src_alpha) { if (src_alpha == 255) { - *dest_scan++ = (FX_BYTE)m_Blue; - *dest_scan++ = (FX_BYTE)m_Green; - *dest_scan++ = (FX_BYTE)m_Red; - *dest_extra_alpha_scan++ = (FX_BYTE)m_Alpha; + *dest_scan++ = (uint8_t)m_Blue; + *dest_scan++ = (uint8_t)m_Green; + *dest_scan++ = (uint8_t)m_Red; + *dest_extra_alpha_scan++ = (uint8_t)m_Alpha; continue; } else { - FX_BYTE dest_alpha = (*dest_extra_alpha_scan) + src_alpha - + uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha - (*dest_extra_alpha_scan) * src_alpha / 255; *dest_extra_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; @@ -893,9 +893,9 @@ public: if (src_alpha) { if (src_alpha == 255) { *(FX_CMYK*)dest_scan = m_Color; - *dest_extra_alpha_scan = (FX_BYTE)m_Alpha; + *dest_extra_alpha_scan = (uint8_t)m_Alpha; } else { - FX_BYTE dest_alpha = (*dest_extra_alpha_scan) + src_alpha - + uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha - (*dest_extra_alpha_scan) * src_alpha / 255; *dest_extra_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; @@ -1029,13 +1029,13 @@ public: m_Gray = 255; } else { if (pIccTransform) { - FX_BYTE gray; + uint8_t gray; color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); pIccModule->TranslateScanline(pIccTransform, &gray, (FX_LPCBYTE)&color, 1); m_Gray = gray; } else { if (bObjectCMYK) { - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), FXSYS_GetYValue(color), FXSYS_GetKValue(color), r, g, b); m_Gray = FXRGB2GRAY(r, g, b); @@ -1080,7 +1080,7 @@ public: } } else { if (bObjectCMYK) { - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), FXSYS_GetYValue(color), FXSYS_GetKValue(color), r, g, b); m_Color = FXARGB_MAKE(m_Alpha, r, g, b); @@ -1192,7 +1192,7 @@ void RgbByteOrderSetPixel(CFX_DIBitmap* pBitmap, int x, int y, FX_DWORD argb) if (x < 0 || x >= pBitmap->GetWidth() || y < 0 || y >= pBitmap->GetHeight()) { return; } - FX_LPBYTE pos = (FX_BYTE*)pBitmap->GetBuffer() + y * pBitmap->GetPitch() + x * pBitmap->GetBPP() / 8; + FX_LPBYTE pos = (uint8_t*)pBitmap->GetBuffer() + y * pBitmap->GetPitch() + x * pBitmap->GetBPP() / 8; if (pBitmap->GetFormat() == FXDIB_Argb) { FXARGB_SETRGBORDERDIB(pos, ArgbGamma(argb)); } else { @@ -1215,7 +1215,7 @@ void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap, int left, int top, int wid int Bpp = pBitmap->GetBPP() / 8; FX_BOOL bAlpha = pBitmap->HasAlpha(); int dib_argb = FXARGB_TOBGRORDERDIB(argb); - FX_BYTE* pBuffer = pBitmap->GetBuffer(); + uint8_t* pBuffer = pBitmap->GetBuffer(); if (src_alpha == 255) { for (int row = rect.top; row < rect.bottom; row ++) { FX_LPBYTE dest_scan = pBuffer + row * pBitmap->GetPitch() + rect.left * Bpp; @@ -1241,13 +1241,13 @@ void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap, int left, int top, int wid FX_LPBYTE dest_scan = pBuffer + row * pBitmap->GetPitch() + rect.left * Bpp; if (bAlpha) { for (int col = 0; col < width; col ++) { - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); dest_scan += 4; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); @@ -1286,7 +1286,7 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t FXDIB_Format dest_format = pBitmap->GetFormat(); FXDIB_Format src_format = pSrcBitmap->GetFormat(); int pitch = pBitmap->GetPitch(); - FX_BYTE* buffer = pBitmap->GetBuffer(); + uint8_t* buffer = pBitmap->GetBuffer(); if (dest_format == src_format) { for (int row = 0; row < height; row ++) { FX_LPBYTE dest_scan = buffer + (dest_top + row) * pitch + dest_left * Bpp; @@ -1313,7 +1313,7 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t if (src_format == FXDIB_Rgb32) { for (int row = 0; row < height; row ++) { FX_LPBYTE dest_scan = dest_buf + row * pitch; - FX_LPBYTE src_scan = (FX_BYTE*)pSrcBitmap->GetScanline(src_top + row) + src_left * 4; + FX_LPBYTE src_scan = (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 4; for (int col = 0; col < width; col ++) { *dest_scan++ = src_scan[2]; *dest_scan++ = src_scan[1]; @@ -1327,8 +1327,8 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t } else if (dest_format == FXDIB_Argb || dest_format == FXDIB_Rgb32) { if (src_format == FXDIB_Rgb) { for (int row = 0; row < height; row ++) { - FX_BYTE* dest_scan = (FX_BYTE*)(dest_buf + row * pitch); - FX_LPBYTE src_scan = (FX_BYTE*)pSrcBitmap->GetScanline(src_top + row) + src_left * 3; + uint8_t* dest_scan = (uint8_t*)(dest_buf + row * pitch); + FX_LPBYTE src_scan = (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 3; if (src_format == FXDIB_Argb) { for (int col = 0; col < width; col ++) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, FX_GAMMA(src_scan[0]), FX_GAMMA(src_scan[1]), FX_GAMMA(src_scan[2]))); @@ -1359,9 +1359,9 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t ASSERT(FALSE); } } -FX_ARGB _DefaultCMYK2ARGB(FX_CMYK cmyk, FX_BYTE alpha) +FX_ARGB _DefaultCMYK2ARGB(FX_CMYK cmyk, uint8_t alpha) { - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk), FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), r, g, b); return ArgbEncode(alpha, r, g, b); diff --git a/core/src/fxge/android/fpf_skiafont.cpp b/core/src/fxge/android/fpf_skiafont.cpp index 97eeb2f683..290d989851 100644 --- a/core/src/fxge/android/fpf_skiafont.cpp +++ b/core/src/fxge/android/fpf_skiafont.cpp @@ -53,7 +53,7 @@ CFX_WideString CFPF_SkiaFont::GetPsName() } return CFX_WideString::FromLocal(FXFT_Get_Postscript_Name(m_Face)); } -FX_INT32 CFPF_SkiaFont::GetGlyphIndex(FX_WCHAR wUnicode) +int32_t CFPF_SkiaFont::GetGlyphIndex(FX_WCHAR wUnicode) { if (!m_Face) { return wUnicode; @@ -63,7 +63,7 @@ FX_INT32 CFPF_SkiaFont::GetGlyphIndex(FX_WCHAR wUnicode) } return FXFT_Get_Char_Index(m_Face, wUnicode); } -FX_INT32 CFPF_SkiaFont::GetGlyphWidth(FX_INT32 iGlyphIndex) +int32_t CFPF_SkiaFont::GetGlyphWidth(int32_t iGlyphIndex) { if (!m_Face) { return 0; @@ -73,21 +73,21 @@ FX_INT32 CFPF_SkiaFont::GetGlyphWidth(FX_INT32 iGlyphIndex) } return FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Glyph_HoriAdvance(m_Face)); } -FX_INT32 CFPF_SkiaFont::GetAscent() const +int32_t CFPF_SkiaFont::GetAscent() const { if (!m_Face) { return 0; } return FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Face_Ascender(m_Face)); } -FX_INT32 CFPF_SkiaFont::GetDescent() const +int32_t CFPF_SkiaFont::GetDescent() const { if (!m_Face) { return 0; } return FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Face_Descender(m_Face)); } -FX_BOOL CFPF_SkiaFont::GetGlyphBBox(FX_INT32 iGlyphIndex, FX_RECT &rtBBox) +FX_BOOL CFPF_SkiaFont::GetGlyphBBox(int32_t iGlyphIndex, FX_RECT &rtBBox) { if (!m_Face) { return FALSE; @@ -107,8 +107,8 @@ FX_BOOL CFPF_SkiaFont::GetGlyphBBox(FX_INT32 iGlyphIndex, FX_RECT &rtBBox) } FXFT_BBox cbox; FXFT_Glyph_Get_CBox(glyph, FXFT_GLYPH_BBOX_PIXELS, &cbox); - FX_INT32 x_ppem = m_Face->size->metrics.x_ppem; - FX_INT32 y_ppem = m_Face->size->metrics.y_ppem; + int32_t x_ppem = m_Face->size->metrics.x_ppem; + int32_t y_ppem = m_Face->size->metrics.y_ppem; rtBBox.left = FPF_EM_ADJUST(x_ppem, cbox.xMin); rtBBox.right = FPF_EM_ADJUST(x_ppem, cbox.xMax); rtBBox.top = FPF_EM_ADJUST(y_ppem, cbox.yMax); @@ -138,14 +138,14 @@ FX_BOOL CFPF_SkiaFont::GetBBox(FX_RECT &rtBBox) rtBBox.bottom = FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Face_yMax(m_Face)); return TRUE; } -FX_INT32 CFPF_SkiaFont::GetHeight() const +int32_t CFPF_SkiaFont::GetHeight() const { if (!m_Face) { return 0; } return FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Face_Height(m_Face)); } -FX_INT32 CFPF_SkiaFont::GetItalicAngle() const +int32_t CFPF_SkiaFont::GetItalicAngle() const { if (!m_Face) { return 0; @@ -166,7 +166,7 @@ FX_DWORD CFPF_SkiaFont::GetFontData(FX_DWORD dwTable, FX_LPBYTE pBuffer, FX_DWOR } return dwSize; } -FX_BOOL CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, FX_BSTR bsFamily, FX_DWORD dwStyle, FX_BYTE uCharset) +FX_BOOL CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, FX_BSTR bsFamily, FX_DWORD dwStyle, uint8_t uCharset) { if (!pFontMgr || !pFontDes) { return FALSE; diff --git a/core/src/fxge/android/fpf_skiafont.h b/core/src/fxge/android/fpf_skiafont.h index 135c830c95..72b569fe2e 100644 --- a/core/src/fxge/android/fpf_skiafont.h +++ b/core/src/fxge/android/fpf_skiafont.h @@ -28,30 +28,30 @@ public: { return m_dwStyle; } - virtual FX_BYTE GetCharset() const + virtual uint8_t GetCharset() const { return m_uCharset; } - virtual FX_INT32 GetGlyphIndex(FX_WCHAR wUnicode); - virtual FX_INT32 GetGlyphWidth(FX_INT32 iGlyphIndex); + virtual int32_t GetGlyphIndex(FX_WCHAR wUnicode); + virtual int32_t GetGlyphWidth(int32_t iGlyphIndex); - virtual FX_INT32 GetAscent() const; - virtual FX_INT32 GetDescent() const; + virtual int32_t GetAscent() const; + virtual int32_t GetDescent() const; - virtual FX_BOOL GetGlyphBBox(FX_INT32 iGlyphIndex, FX_RECT &rtBBox); + virtual FX_BOOL GetGlyphBBox(int32_t iGlyphIndex, FX_RECT &rtBBox); virtual FX_BOOL GetBBox(FX_RECT &rtBBox); - virtual FX_INT32 GetHeight() const; - virtual FX_INT32 GetItalicAngle() const; + virtual int32_t GetHeight() const; + virtual int32_t GetItalicAngle() const; virtual FX_DWORD GetFontData(FX_DWORD dwTable, FX_LPBYTE pBuffer, FX_DWORD dwSize); - FX_BOOL InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, FX_BSTR bsFamily, FX_DWORD dwStyle, FX_BYTE uCharset); + FX_BOOL InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, FX_BSTR bsFamily, FX_DWORD dwStyle, uint8_t uCharset); protected: CFPF_SkiaFontMgr *m_pFontMgr; CFPF_SkiaFontDescriptor *m_pFontDes; FXFT_Face m_Face; FX_DWORD m_dwStyle; - FX_BYTE m_uCharset; + uint8_t m_uCharset; FX_DWORD m_dwRefCount; }; #endif diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp index fc012ea9ac..ba1e12acaf 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.cpp +++ b/core/src/fxge/android/fpf_skiafontmgr.cpp @@ -64,10 +64,10 @@ static const FPF_SKIAFONTMAP g_SkiaFontmap[] = { }; FX_DWORD FPF_SkiaGetSubstFont(FX_DWORD dwHash) { - FX_INT32 iStart = 0; - FX_INT32 iEnd = sizeof(g_SkiaFontmap) / sizeof(FPF_SKIAFONTMAP); + int32_t iStart = 0; + int32_t iEnd = sizeof(g_SkiaFontmap) / sizeof(FPF_SKIAFONTMAP); while (iStart <= iEnd) { - FX_INT32 iMid = (iStart + iEnd) / 2; + int32_t iMid = (iStart + iEnd) / 2; FPF_LPCSKIAFONTMAP pItem = &g_SkiaFontmap[iMid]; if (dwHash < pItem->dwFamily) { iEnd = iMid - 1; @@ -88,10 +88,10 @@ static const FPF_SKIAFONTMAP g_SkiaSansFontMap[] = { }; FX_DWORD FPF_SkiaGetSansFont(FX_DWORD dwHash) { - FX_INT32 iStart = 0; - FX_INT32 iEnd = sizeof(g_SkiaSansFontMap) / sizeof(FPF_SKIAFONTMAP); + int32_t iStart = 0; + int32_t iEnd = sizeof(g_SkiaSansFontMap) / sizeof(FPF_SKIAFONTMAP); while (iStart <= iEnd) { - FX_INT32 iMid = (iStart + iEnd) / 2; + int32_t iMid = (iStart + iEnd) / 2; FPF_LPCSKIAFONTMAP pItem = &g_SkiaSansFontMap[iMid]; if (dwHash < pItem->dwFamily) { iEnd = iMid - 1; @@ -103,7 +103,7 @@ FX_DWORD FPF_SkiaGetSansFont(FX_DWORD dwHash) } return 0; } -static FX_UINT32 FPF_GetHashCode_StringA(FX_LPCSTR pStr, FX_INT32 iLength, FX_BOOL bIgnoreCase = FALSE) +static uint32_t FPF_GetHashCode_StringA(FX_LPCSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE) { if (!pStr) { return 0; @@ -112,7 +112,7 @@ static FX_UINT32 FPF_GetHashCode_StringA(FX_LPCSTR pStr, FX_INT32 iLength, FX_BO iLength = FXSYS_strlen(pStr); } FX_LPCSTR pStrEnd = pStr + iLength; - FX_UINT32 uHashCode = 0; + uint32_t uHashCode = 0; if (bIgnoreCase) { while (pStr < pStrEnd) { uHashCode = 31 * uHashCode + FXSYS_tolower(*pStr++); @@ -145,7 +145,7 @@ enum FPF_SKIACHARSET { FPF_SKIACHARSET_PC = 1 << 17, FPF_SKIACHARSET_OEM = 1 << 18, }; -static FX_DWORD FPF_SkiaGetCharset(FX_BYTE uCharset) +static FX_DWORD FPF_SkiaGetCharset(uint8_t uCharset) { switch (uCharset) { case FXFONT_ANSI_CHARSET: @@ -184,9 +184,9 @@ static FX_DWORD FPF_SkiaGetCharset(FX_BYTE uCharset) static FX_DWORD FPF_SKIANormalizeFontName(FX_BSTR bsfamily) { FX_DWORD dwHash = 0; - FX_INT32 iLength = bsfamily.GetLength(); + int32_t iLength = bsfamily.GetLength(); FX_LPCSTR pBuffer = bsfamily.GetCStr(); - for (FX_INT32 i = 0; i < iLength; i++) { + for (int32_t i = 0; i < iLength; i++) { FX_CHAR ch = pBuffer[i]; if (ch == ' ' || ch == '-' || ch == ',') { continue; @@ -195,7 +195,7 @@ static FX_DWORD FPF_SKIANormalizeFontName(FX_BSTR bsfamily) } return dwHash; } -static FX_DWORD FPF_SKIAGetFamilyHash(FX_BSTR bsFamily, FX_DWORD dwStyle, FX_BYTE uCharset) +static FX_DWORD FPF_SKIAGetFamilyHash(FX_BSTR bsFamily, FX_DWORD dwStyle, uint8_t uCharset) { CFX_ByteString bsFont(bsFamily); if (dwStyle & FXFONT_BOLD) { @@ -210,7 +210,7 @@ static FX_DWORD FPF_SKIAGetFamilyHash(FX_BSTR bsFamily, FX_DWORD dwStyle, FX_BYT bsFont += uCharset; return FPF_GetHashCode_StringA(bsFont.c_str(), bsFont.GetLength(), TRUE); } -static FX_BOOL FPF_SkiaIsCJK(FX_BYTE uCharset) +static FX_BOOL FPF_SkiaIsCJK(uint8_t uCharset) { return (uCharset == FXFONT_GB2312_CHARSET) || (uCharset == FXFONT_CHINESEBIG5_CHARSET) || (uCharset == FXFONT_HANGEUL_CHARSET) || (uCharset == FXFONT_SHIFTJIS_CHARSET); @@ -243,7 +243,7 @@ CFPF_SkiaFontMgr::~CFPF_SkiaFontMgr() } } m_FamilyFonts.RemoveAll(); - for (FX_INT32 i = m_FontFaces.GetUpperBound(); i >= 0; i--) { + for (int32_t i = m_FontFaces.GetUpperBound(); i >= 0; i--) { CFPF_SkiaFontDescriptor *pFont = (CFPF_SkiaFontDescriptor*)m_FontFaces.ElementAt(i); if (pFont) { delete pFont; @@ -279,11 +279,11 @@ void CFPF_SkiaFontMgr::LoadPrivateFont(FX_BSTR bsFileName) void CFPF_SkiaFontMgr::LoadPrivateFont(FX_LPVOID pBuffer, size_t szBuffer) { } -IFPF_Font* CFPF_SkiaFontMgr::CreateFont(FX_BSTR bsFamilyname, FX_BYTE uCharset, FX_DWORD dwStyle, FX_DWORD dwMatch) +IFPF_Font* CFPF_SkiaFontMgr::CreateFont(FX_BSTR bsFamilyname, uint8_t uCharset, FX_DWORD dwStyle, FX_DWORD dwMatch) { FX_DWORD dwHash = FPF_SKIAGetFamilyHash(bsFamilyname, dwStyle, uCharset); IFPF_Font *pFont = NULL; - if (m_FamilyFonts.Lookup((void*)(FX_UINTPTR)dwHash, (void*&)pFont)) { + if (m_FamilyFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) { if (pFont) { return pFont->Retain(); } @@ -297,16 +297,16 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(FX_BSTR bsFamilyname, FX_BYTE uCharset, } else if (uCharset == FXFONT_ANSI_CHARSET && (dwMatch & FPF_MATCHFONT_REPLACEANSI)) { uCharset = FXFONT_DEFAULT_CHARSET; } - FX_INT32 nExpectVal = FPF_SKIAMATCHWEIGHT_NAME1 + FPF_SKIAMATCHWEIGHT_1 * 3 + FPF_SKIAMATCHWEIGHT_2 * 2; - FX_INT32 nItem = -1; - FX_INT32 nMax = -1; - FX_INT32 nGlyphNum = 0; - for (FX_INT32 i = m_FontFaces.GetUpperBound(); i >= 0; i--) { + int32_t nExpectVal = FPF_SKIAMATCHWEIGHT_NAME1 + FPF_SKIAMATCHWEIGHT_1 * 3 + FPF_SKIAMATCHWEIGHT_2 * 2; + int32_t nItem = -1; + int32_t nMax = -1; + int32_t nGlyphNum = 0; + for (int32_t i = m_FontFaces.GetUpperBound(); i >= 0; i--) { CFPF_SkiaPathFont *pFontDes = (CFPF_SkiaPathFont*)m_FontFaces.ElementAt(i); if(!(pFontDes->m_dwCharsets & FPF_SkiaGetCharset(uCharset))) { continue; } - FX_INT32 nFind = 0; + int32_t nFind = 0; FX_DWORD dwSysFontName = FPF_SKIANormalizeFontName(pFontDes->m_pFamily); if (dwFaceName == dwSysFontName) { nFind += FPF_SKIAMATCHWEIGHT_NAME1; @@ -354,14 +354,14 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(FX_BSTR bsFamilyname, FX_BYTE uCharset, CFPF_SkiaFontDescriptor *pFontDes = (CFPF_SkiaFontDescriptor*)m_FontFaces.ElementAt(nItem); CFPF_SkiaFont *pFont = new CFPF_SkiaFont; if (pFont->InitFont(this, pFontDes, bsFamilyname, dwStyle, uCharset)) { - m_FamilyFonts.SetAt((void*)(FX_UINTPTR)dwHash, (void*)pFont); + m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); return pFont->Retain(); } pFont->Release(); } return NULL; } -FXFT_Face CFPF_SkiaFontMgr::GetFontFace(IFX_FileRead *pFileRead, FX_INT32 iFaceIndex) +FXFT_Face CFPF_SkiaFontMgr::GetFontFace(IFX_FileRead *pFileRead, int32_t iFaceIndex) { if (!pFileRead) { return NULL; @@ -388,7 +388,7 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(IFX_FileRead *pFileRead, FX_INT32 iFaceI FXFT_Set_Pixel_Sizes(face, 0, 64); return face; } -FXFT_Face CFPF_SkiaFontMgr::GetFontFace(FX_BSTR bsFile, FX_INT32 iFaceIndex ) +FXFT_Face CFPF_SkiaFontMgr::GetFontFace(FX_BSTR bsFile, int32_t iFaceIndex ) { if (bsFile.IsEmpty()) { return NULL; @@ -406,7 +406,7 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(FX_BSTR bsFile, FX_INT32 iFaceIndex ) FXFT_Set_Pixel_Sizes(face, 0, 64); return face; } -FXFT_Face CFPF_SkiaFontMgr::GetFontFace(FX_LPCBYTE pBuffer, size_t szBuffer, FX_INT32 iFaceIndex ) +FXFT_Face CFPF_SkiaFontMgr::GetFontFace(FX_LPCBYTE pBuffer, size_t szBuffer, int32_t iFaceIndex ) { if (!pBuffer || szBuffer < 1) { return NULL; @@ -505,7 +505,7 @@ static FX_DWORD FPF_SkiaGetFaceCharset(TT_OS2 *pOS2) { FX_DWORD dwCharset = 0; if (pOS2) { - for (FX_INT32 i = 0; i < 32; i++) { + for (int32_t i = 0; i < 32; i++) { if (pOS2->ulCodePageRange1 & (1 << i)) { dwCharset |= g_FPFSkiaFontCharsets[i]; } @@ -535,7 +535,7 @@ void CFPF_SkiaFontMgr::ReportFace(FXFT_Face face, CFPF_SkiaFontDescriptor *pFont pFontDesc->m_dwStyle |= FXFONT_SYMBOLIC; } if (pOS2->panose[0] == 2) { - FX_BYTE uSerif = pOS2->panose[1]; + uint8_t uSerif = pOS2->panose[1]; if ((uSerif > 1 && uSerif < 10) || uSerif > 13) { pFontDesc->m_dwStyle |= FXFONT_SERIF; } diff --git a/core/src/fxge/android/fpf_skiafontmgr.h b/core/src/fxge/android/fpf_skiafontmgr.h index 3c072fa186..44d427f8af 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.h +++ b/core/src/fxge/android/fpf_skiafontmgr.h @@ -22,7 +22,7 @@ public: FX_Free(m_pFamily); } } - virtual FX_INT32 GetType() const + virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Unknown; } @@ -31,16 +31,16 @@ public: if (m_pFamily) { FX_Free(m_pFamily); } - FX_INT32 iSize = FXSYS_strlen(pFamily); + int32_t iSize = FXSYS_strlen(pFamily); m_pFamily = FX_Alloc(FX_CHAR, iSize + 1); FXSYS_memcpy32(m_pFamily, pFamily, iSize * sizeof(FX_CHAR)); m_pFamily[iSize] = 0; } FX_LPSTR m_pFamily; FX_DWORD m_dwStyle; - FX_INT32 m_iFaceIndex; + int32_t m_iFaceIndex; FX_DWORD m_dwCharsets; - FX_INT32 m_iGlyphNum; + int32_t m_iGlyphNum; }; class CFPF_SkiaPathFont : public CFPF_SkiaFontDescriptor { @@ -52,7 +52,7 @@ public: FX_Free(m_pPath); } } - virtual FX_INT32 GetType() const + virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Path; } @@ -61,7 +61,7 @@ public: if (m_pPath) { FX_Free(m_pPath); } - FX_INT32 iSize = FXSYS_strlen(pPath); + int32_t iSize = FXSYS_strlen(pPath); m_pPath = FX_Alloc(FX_CHAR, iSize + 1); FXSYS_memcpy32(m_pPath, pPath, iSize * sizeof(FX_CHAR)); m_pPath[iSize] = 0; @@ -72,7 +72,7 @@ class CFPF_SkiaFileFont : public CFPF_SkiaFontDescriptor { public: CFPF_SkiaFileFont() : m_pFile(NULL) {} - virtual FX_INT32 GetType() const + virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_File; } @@ -82,7 +82,7 @@ class CFPF_SkiaBufferFont : public CFPF_SkiaFontDescriptor { public: CFPF_SkiaBufferFont() : m_pBuffer(NULL), m_szBuffer(0) {} - virtual FX_INT32 GetType() const + virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Buffer; } @@ -100,10 +100,10 @@ public: virtual void LoadPrivateFont(FX_BSTR bsFileName); virtual void LoadPrivateFont(FX_LPVOID pBuffer, size_t szBuffer); - virtual IFPF_Font* CreateFont(FX_BSTR bsFamilyname, FX_BYTE uCharset, FX_DWORD dwStyle, FX_DWORD dwMatch = 0); - FXFT_Face GetFontFace(IFX_FileRead *pFileRead, FX_INT32 iFaceIndex = 0); - FXFT_Face GetFontFace(FX_BSTR bsFile, FX_INT32 iFaceIndex = 0); - FXFT_Face GetFontFace(FX_LPCBYTE pBuffer, size_t szBuffer, FX_INT32 iFaceIndex = 0); + virtual IFPF_Font* CreateFont(FX_BSTR bsFamilyname, uint8_t uCharset, FX_DWORD dwStyle, FX_DWORD dwMatch = 0); + FXFT_Face GetFontFace(IFX_FileRead *pFileRead, int32_t iFaceIndex = 0); + FXFT_Face GetFontFace(FX_BSTR bsFile, int32_t iFaceIndex = 0); + FXFT_Face GetFontFace(FX_LPCBYTE pBuffer, size_t szBuffer, int32_t iFaceIndex = 0); protected: void ScanPath(FX_BSTR path); void ScanFile(FX_BSTR file); diff --git a/core/src/fxge/apple/apple_int.h b/core/src/fxge/apple/apple_int.h index 2466ecbc9a..6cd880603a 100644 --- a/core/src/fxge/apple/apple_int.h +++ b/core/src/fxge/apple/apple_int.h @@ -56,7 +56,7 @@ public: FX_FLOAT fontSize, FX_WORD* glyphIndices, CGPoint* glyphPositions, - FX_INT32 chars, + int32_t chars, FX_ARGB argb, CFX_AffineMatrix* matrix = NULL); void saveGraphicsState(void* graphics); @@ -81,7 +81,7 @@ public: class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver { public: - CFX_QuartzDeviceDriver(CGContextRef context, FX_INT32 deviceClass); + CFX_QuartzDeviceDriver(CGContextRef context, int32_t deviceClass); virtual ~CFX_QuartzDeviceDriver(); virtual int GetDeviceCaps(int caps_id); @@ -176,15 +176,15 @@ protected: CGContextRef _context; CGAffineTransform _foxitDevice2User; CGAffineTransform _user2FoxitDevice; - FX_INT32 m_saveCount; + int32_t m_saveCount; - FX_INT32 _width; - FX_INT32 _height; - FX_INT32 _bitsPerPixel; - FX_INT32 _deviceClass; - FX_INT32 _renderCaps; - FX_INT32 _horzSize; - FX_INT32 _vertSize; + int32_t _width; + int32_t _height; + int32_t _bitsPerPixel; + int32_t _deviceClass; + int32_t _renderCaps; + int32_t _horzSize; + int32_t _vertSize; }; class CFX_FontProvider final : public IFX_FileRead { @@ -239,10 +239,10 @@ private: int _tableCount; int _totalSize; }; -FX_UINT32 FX_GetHashCode( FX_LPCSTR pStr); +uint32_t FX_GetHashCode( FX_LPCSTR pStr); FX_DWORD FX_IOSGetMatchFamilyNameHashcode(FX_LPCSTR pFontName); -FX_UINT32 FX_IOSGetFamilyNamesCount(); -FX_LPCSTR FX_IOSGetFamilyName( FX_UINT32 uIndex); +uint32_t FX_IOSGetFamilyNamesCount(); +FX_LPCSTR FX_IOSGetFamilyName( uint32_t uIndex); #endif #endif // CORE_SRC_FXGE_APPLE_APPLE_INT_H_ diff --git a/core/src/fxge/apple/fx_quartz_device.cpp b/core/src/fxge/apple/fx_quartz_device.cpp index f7faee15b3..6a97c7baf2 100644 --- a/core/src/fxge/apple/fx_quartz_device.cpp +++ b/core/src/fxge/apple/fx_quartz_device.cpp @@ -81,7 +81,7 @@ FX_BOOL CQuartz2D::drawGraphicsString(void* graphics, FX_FLOAT fontSize, FX_WORD* glyphIndices, CGPoint* glyphPositions, - FX_INT32 charsCount, + int32_t charsCount, FX_ARGB argb, CFX_AffineMatrix* matrix ) { @@ -102,7 +102,7 @@ FX_BOOL CQuartz2D::drawGraphicsString(void* graphics, matrix->f)); CGContextSetTextMatrix(context, m); } - FX_INT32 a, r, g, b; + int32_t a, r, g, b; ArgbDecode(argb, a, r, g, b); CGContextSetRGBFillColor(context, r / 255.f, @@ -166,7 +166,7 @@ static CGContextRef createContextWithBitmap(CFX_DIBitmap* pBitmap) CGColorSpaceRelease(colorSpace); return context; } -CFX_QuartzDeviceDriver::CFX_QuartzDeviceDriver(CGContextRef context, FX_INT32 deviceClass) +CFX_QuartzDeviceDriver::CFX_QuartzDeviceDriver(CGContextRef context, int32_t deviceClass) { m_saveCount = 0; _context = context; @@ -438,7 +438,7 @@ FX_BOOL CFX_QuartzDeviceDriver::FillRect(const FX_RECT* rect, } CGRect rect_fx = CGRectMake(rect->left, rect->top, rect->Width(), rect->Height()); CGRect rect_usr = CGRectApplyAffineTransform(rect_fx, _foxitDevice2User); - FX_INT32 a, r, g, b; + int32_t a, r, g, b; ArgbDecode(fillArgb, a, r, g, b); CGContextSetRGBFillColor(_context, r / 255.f, @@ -470,7 +470,7 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, pt = CGPointApplyAffineTransform(CGPointMake(x2, y2), _foxitDevice2User); x2 = pt.x; y2 = pt.y; - FX_INT32 a, r, g, b; + int32_t a, r, g, b; ArgbDecode(argb, a, r, g, b); CGContextSetRGBStrokeColor(_context, r / 255.f, @@ -496,8 +496,8 @@ FX_BOOL CFX_QuartzDeviceDriver::GetClipBox(FX_RECT* rect) return TRUE; } FX_BOOL CFX_QuartzDeviceDriver::GetDIBits(CFX_DIBitmap* bitmap, - FX_INT32 left, - FX_INT32 top, + int32_t left, + int32_t top, void* pIccTransform, FX_BOOL bDEdge) { @@ -656,9 +656,9 @@ FX_BOOL CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, for (int row = 0; row < pBitmap1->GetHeight(); row ++) { FX_LPBYTE pScanline = (FX_LPBYTE)pBitmap1->GetScanline(row); for (int col = 0; col < pBitmap1->GetWidth(); col ++) { - pScanline[0] = (FX_BYTE)(pScanline[0] * pScanline[3] / 255.f + .5f); - pScanline[1] = (FX_BYTE)(pScanline[1] * pScanline[3] / 255.f + .5f); - pScanline[2] = (FX_BYTE)(pScanline[2] * pScanline[3] / 255.f + .5f); + pScanline[0] = (uint8_t)(pScanline[0] * pScanline[3] / 255.f + .5f); + pScanline[1] = (uint8_t)(pScanline[1] * pScanline[3] / 255.f + .5f); + pScanline[2] = (uint8_t)(pScanline[2] * pScanline[3] / 255.f + .5f); pScanline += 4; } } @@ -781,9 +781,9 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap, for (int row = 0; row < pBitmap1->GetHeight(); row ++) { FX_LPBYTE pScanline = (FX_LPBYTE)pBitmap1->GetScanline(row); for (int col = 0; col < pBitmap1->GetWidth(); col ++) { - pScanline[0] = (FX_BYTE)(pScanline[0] * pScanline[3] / 255.f + .5f); - pScanline[1] = (FX_BYTE)(pScanline[1] * pScanline[3] / 255.f + .5f); - pScanline[2] = (FX_BYTE)(pScanline[2] * pScanline[3] / 255.f + .5f); + pScanline[0] = (uint8_t)(pScanline[0] * pScanline[3] / 255.f + .5f); + pScanline[1] = (uint8_t)(pScanline[1] * pScanline[3] / 255.f + .5f); + pScanline[2] = (uint8_t)(pScanline[2] * pScanline[3] / 255.f + .5f); pScanline += 4; } } @@ -844,7 +844,7 @@ FX_BOOL CFX_QuartzDeviceDriver::CG_DrawGlypRun(int nChars CGContextSetTextMatrix(_context, matrix_cg); CGContextSetFont(_context, (CGFontRef)pFont->m_pPlatformFont); CGContextSetFontSize(_context, FXSYS_fabs(font_size)); - FX_INT32 a, r, g, b; + int32_t a, r, g, b; ArgbDecode(argb, a, r, g, b); CGContextSetRGBFillColor(_context, r / 255.f, @@ -897,7 +897,7 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawDeviceText(int nChars, SaveState(); CGContextSetTextDrawingMode(_context, kCGTextFillClip); FX_BOOL ret = FALSE; - FX_INT32 i = 0; + int32_t i = 0; while (i < nChars) { if (pCharPos[i].m_bGlyphAdjust || font_size < 0) { if (i > 0) { @@ -992,7 +992,7 @@ void CFX_QuartzDeviceDriver::setStrokeInfo(const CFX_GraphStateData* graphState, delete[] dashArray; #endif } - FX_INT32 a, r, g, b; + int32_t a, r, g, b; ArgbDecode(argb, a, r, g, b); CGContextSetRGBStrokeColor(_context, r / 255.f, @@ -1002,7 +1002,7 @@ void CFX_QuartzDeviceDriver::setStrokeInfo(const CFX_GraphStateData* graphState, } void CFX_QuartzDeviceDriver::setFillInfo(FX_ARGB argb) { - FX_INT32 a, r, g, b; + int32_t a, r, g, b; ArgbDecode(argb, a, r, g, b); CGContextSetRGBFillColor(_context, r / 255.f, @@ -1012,10 +1012,10 @@ void CFX_QuartzDeviceDriver::setFillInfo(FX_ARGB argb) } void CFX_QuartzDeviceDriver::setPathToContext(const CFX_PathData* pathData) { - FX_INT32 count = pathData->GetPointCount(); + int32_t count = pathData->GetPointCount(); FX_PATHPOINT* points = pathData->GetPoints(); CGContextBeginPath(_context); - for (FX_INT32 i = 0; i < count; i ++) { + for (int32_t i = 0; i < count; i ++) { switch (points[i].m_Flag & FXPT_TYPE) { case FXPT_MOVETO: CGContextMoveToPoint(_context, points[i].m_PointX, points[i].m_PointY); @@ -1090,7 +1090,7 @@ CGContextRef CFX_QuartzDevice::GetContext() { return m_pContext; } -FX_BOOL CFX_QuartzDevice::Attach(CGContextRef context, FX_INT32 nDeviceClass) +FX_BOOL CFX_QuartzDevice::Attach(CGContextRef context, int32_t nDeviceClass) { if (m_pContext) { CGContextRelease(m_pContext); @@ -1112,9 +1112,9 @@ FX_BOOL CFX_QuartzDevice::Attach(CFX_DIBitmap* pBitmap) SetDeviceDriver(pDriver); return TRUE; } -FX_BOOL CFX_QuartzDevice::Create(FX_INT32 width, FX_INT32 height, FXDIB_Format format) +FX_BOOL CFX_QuartzDevice::Create(int32_t width, int32_t height, FXDIB_Format format) { - if ((FX_BYTE)format < 32) { + if ((uint8_t)format < 32) { return FALSE; } CFX_DIBitmap* pBitmap = new CFX_DIBitmap; diff --git a/core/src/fxge/dib/fx_dib_composite.cpp b/core/src/fxge/dib/fx_dib_composite.cpp index e385bc9ffe..970325a2d4 100644 --- a/core/src/fxge/dib/fx_dib_composite.cpp +++ b/core/src/fxge/dib/fx_dib_composite.cpp @@ -7,7 +7,7 @@ #include "../../../include/fxge/fx_ge.h" #include "../../../include/fxcodec/fx_codec.h" #include "dib_int.h" -const FX_BYTE g_GammaRamp[256] = { +const uint8_t g_GammaRamp[256] = { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, @@ -25,7 +25,7 @@ const FX_BYTE g_GammaRamp[256] = { 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 229, 231, 233, 235, 237, 239, 242, 244, 246, 248, 250, 253, 255, }; -const FX_BYTE g_GammaInverse[256] = { +const uint8_t g_GammaInverse[256] = { 0, 13, 22, 28, 34, 38, 42, 46, 50, 53, 56, 59, 61, 64, 66, 69, 71, 73, 75, 77, 79, 81, 83, 85, 86, 88, 90, 92, 93, 95, 96, 98, 99, 101, 102, 104, 105, 106, 108, 109, 110, 112, 113, 114, 115, 117, 118, 119, @@ -43,7 +43,7 @@ const FX_BYTE g_GammaInverse[256] = { 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 246, 247, 247, 248, 248, 249, 249, 250, 250, 251, 251, 251, 252, 252, 253, 253, 254, 254, 255, 255, }; -const FX_BYTE _color_sqrt[256] = { +const uint8_t _color_sqrt[256] = { 0x00, 0x03, 0x07, 0x0B, 0x0F, 0x12, 0x16, 0x19, 0x1D, 0x20, 0x23, 0x26, 0x29, 0x2C, 0x2F, 0x32, 0x35, 0x37, 0x3A, 0x3C, 0x3F, 0x41, 0x43, 0x46, 0x48, 0x4A, 0x4C, 0x4E, 0x50, 0x52, 0x54, 0x56, 0x57, 0x59, 0x5B, 0x5C, 0x5E, 0x60, 0x61, 0x63, 0x64, 0x65, 0x67, 0x68, 0x69, 0x6B, 0x6C, 0x6D, @@ -227,7 +227,7 @@ static _RGB _SetSat(_RGB color, int s) } return color; } -void _RGB_Blend(int blend_mode, FX_LPCBYTE src_scan, FX_BYTE* dest_scan, int results[3]) +void _RGB_Blend(int blend_mode, FX_LPCBYTE src_scan, uint8_t* dest_scan, int results[3]) { _RGB src, back, result; src.red = src_scan[2]; @@ -262,7 +262,7 @@ inline void _CompositeRow_Argb2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, in if (clip_scan) { src_alpha = clip_scan[col] * src_alpha / 255; } - FX_BYTE back_alpha = *dest_scan; + uint8_t back_alpha = *dest_scan; if (!back_alpha) { *dest_scan = src_alpha; } else if (src_alpha) { @@ -279,7 +279,7 @@ void _CompositeRow_Rgba2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_alpha_scan, int if (clip_scan) { src_alpha = clip_scan[col] * src_alpha / 255; } - FX_BYTE back_alpha = *dest_scan; + uint8_t back_alpha = *dest_scan; if (!back_alpha) { *dest_scan = src_alpha; } else if (src_alpha) { @@ -312,7 +312,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe int blended_color; if (src_alpha_scan) { for (int col = 0; col < pixel_count; col ++) { - FX_BYTE back_alpha = *dst_alpha_scan; + uint8_t back_alpha = *dst_alpha_scan; if (back_alpha == 0) { int src_alpha = *src_alpha_scan++; if (clip_scan) { @@ -331,7 +331,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe src_scan += 3; continue; } - FX_BYTE src_alpha = *src_alpha_scan++; + uint8_t src_alpha = *src_alpha_scan++; if (clip_scan) { src_alpha = clip_scan[col] * src_alpha / 255; } @@ -343,7 +343,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe } *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha); int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan); - FX_BYTE gray; + uint8_t gray; if (pIccTransform) { pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); } else { @@ -360,7 +360,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe } } else for (int col = 0; col < pixel_count; col ++) { - FX_BYTE back_alpha = *dst_alpha_scan; + uint8_t back_alpha = *dst_alpha_scan; if (back_alpha == 0) { int src_alpha = src_scan[3]; if (clip_scan) { @@ -379,7 +379,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe src_scan += 4; continue; } - FX_BYTE src_alpha = src_scan[3]; + uint8_t src_alpha = src_scan[3]; if (clip_scan) { src_alpha = clip_scan[col] * src_alpha / 255; } @@ -391,7 +391,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe } *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha); int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan); - FX_BYTE gray; + uint8_t gray; if (pIccTransform) { pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); } else { @@ -406,7 +406,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe } if (src_alpha_scan) { for (int col = 0; col < pixel_count; col ++) { - FX_BYTE back_alpha = *dst_alpha_scan; + uint8_t back_alpha = *dst_alpha_scan; if (back_alpha == 0) { int src_alpha = *src_alpha_scan++; if (clip_scan) { @@ -425,7 +425,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe src_scan += 3; continue; } - FX_BYTE src_alpha = *src_alpha_scan++; + uint8_t src_alpha = *src_alpha_scan++; if (clip_scan) { src_alpha = clip_scan[col] * src_alpha / 255; } @@ -437,7 +437,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe } *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha); int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan); - FX_BYTE gray; + uint8_t gray; if (pIccTransform) { pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); } else { @@ -450,7 +450,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe } } else for (int col = 0; col < pixel_count; col ++) { - FX_BYTE back_alpha = *dst_alpha_scan; + uint8_t back_alpha = *dst_alpha_scan; if (back_alpha == 0) { int src_alpha = src_scan[3]; if (clip_scan) { @@ -469,7 +469,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe src_scan += 4; continue; } - FX_BYTE src_alpha = src_scan[3]; + uint8_t src_alpha = src_scan[3]; if (clip_scan) { src_alpha = clip_scan[col] * src_alpha / 255; } @@ -481,7 +481,7 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe } *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha); int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan); - FX_BYTE gray; + uint8_t gray; if (pIccTransform) { pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); } else { @@ -498,7 +498,7 @@ inline void _CompositeRow_Argb2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, in FX_LPCBYTE src_alpha_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = NULL; - FX_BYTE gray; + uint8_t gray; if (pIccTransform) { pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); } @@ -589,7 +589,7 @@ inline void _CompositeRow_Rgb2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int void* pIccTransform) { ICodec_IccModule* pIccModule = NULL; - FX_BYTE gray; + uint8_t gray; if (pIccTransform) { pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); } @@ -665,10 +665,10 @@ void _CompositeRow_Rgb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_B src_scan += src_Bpp; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; - FX_BYTE gray; + uint8_t gray; if (pIccTransform) { pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); } else { @@ -707,10 +707,10 @@ void _CompositeRow_Rgb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_B continue; } int back_alpha = *dest_alpha_scan; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; - FX_BYTE gray; + uint8_t gray; if (pIccTransform) { pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); } else { @@ -728,7 +728,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; if (dest_alpha_scan == NULL) { if (src_alpha_scan == NULL) { - FX_BYTE back_alpha = 0; + uint8_t back_alpha = 0; for (int col = 0; col < pixel_count; col ++) { back_alpha = dest_scan[3]; if (back_alpha == 0) { @@ -742,7 +742,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel src_scan += 4; continue; } - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan == NULL) { src_alpha = src_scan[3]; } else { @@ -753,7 +753,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel src_scan += 4; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { @@ -776,7 +776,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel } } else { for (int col = 0; col < pixel_count; col ++) { - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { if (clip_scan) { int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255; @@ -789,7 +789,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel src_alpha_scan ++; continue; } - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan == NULL) { src_alpha = *src_alpha_scan ++; } else { @@ -800,7 +800,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel src_scan += 3; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { @@ -824,7 +824,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel } else { if (src_alpha_scan) { for (int col = 0; col < pixel_count; col ++) { - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { if (clip_scan) { int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255; @@ -842,7 +842,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel src_alpha_scan ++; continue; } - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan == NULL) { src_alpha = *src_alpha_scan ++; } else { @@ -854,7 +854,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel dest_alpha_scan ++; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { @@ -875,7 +875,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel } } else { for (int col = 0; col < pixel_count; col ++) { - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { if (clip_scan) { int src_alpha = clip_scan[col] * src_scan[3] / 255; @@ -893,7 +893,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel src_scan ++; continue; } - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan == NULL) { src_alpha = src_scan[3]; } else { @@ -905,7 +905,7 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel dest_alpha_scan ++; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { @@ -936,7 +936,7 @@ void _CompositeRow_Rgb2Argb_Blend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE src_sca int src_gap = src_Bpp - 3; if (dest_alpha_scan == NULL) { for (int col = 0; col < width; col ++) { - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { if (src_Bpp == 4) { FXARGB_SETDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan)); @@ -964,7 +964,7 @@ void _CompositeRow_Rgb2Argb_Blend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE src_sca } } else { for (int col = 0; col < width; col ++) { - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { *dest_scan++ = *src_scan++; *dest_scan++ = *src_scan++; @@ -998,7 +998,7 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE sr if (dest_alpha_scan == NULL) { for (int col = 0; col < width; col ++) { int src_alpha = *clip_scan ++; - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { *dest_scan++ = *src_scan++; *dest_scan++ = *src_scan++; @@ -1012,7 +1012,7 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE sr src_scan += src_Bpp; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { @@ -1033,7 +1033,7 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE sr } else { for (int col = 0; col < width; col ++) { int src_alpha = *clip_scan ++; - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { *dest_scan++ = *src_scan++; *dest_scan++ = *src_scan++; @@ -1048,7 +1048,7 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE sr src_scan += src_Bpp; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { @@ -1088,7 +1088,7 @@ inline void _CompositeRow_Rgb2Argb_NoBlend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE continue; } int back_alpha = dest_scan[3]; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; for (int color = 0; color < 3; color ++) { @@ -1117,7 +1117,7 @@ inline void _CompositeRow_Rgb2Argb_NoBlend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE continue; } int back_alpha = *dest_alpha_scan; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; for (int color = 0; color < 3; color ++) { @@ -1161,7 +1161,7 @@ inline void _CompositeRow_Argb2Rgb_Blend(FX_LPBYTE dest_scan, FX_LPCBYTE src_sca int dest_gap = dest_Bpp - 3; if (src_alpha_scan == NULL) { for (int col = 0; col < width; col ++) { - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan) { src_alpha = src_scan[3] * (*clip_scan++) / 255; } else { @@ -1188,7 +1188,7 @@ inline void _CompositeRow_Argb2Rgb_Blend(FX_LPBYTE dest_scan, FX_LPCBYTE src_sca } } else { for (int col = 0; col < width; col ++) { - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan) { src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255; } else { @@ -1220,7 +1220,7 @@ inline void _CompositeRow_Argb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_s int dest_gap = dest_Bpp - 3; if (src_alpha_scan == NULL) { for (int col = 0; col < width; col ++) { - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan) { src_alpha = src_scan[3] * (*clip_scan++) / 255; } else { @@ -1249,7 +1249,7 @@ inline void _CompositeRow_Argb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_s } } else { for (int col = 0; col < width; col ++) { - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan) { src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255; } else { @@ -1306,7 +1306,7 @@ inline void _CompositeRow_Rgb2Rgb_Blend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE src int dest_gap = dest_Bpp - 3; int src_gap = src_Bpp - 3; for (int col = 0; col < width; col ++) { - FX_BYTE src_alpha = *clip_scan ++; + uint8_t src_alpha = *clip_scan ++; if (src_alpha == 0) { dest_scan += dest_Bpp; src_scan += src_Bpp; @@ -1396,7 +1396,7 @@ void _CompositeRow_Argb2Argb_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < pixel_count; col ++) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1); - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { if (clip_scan) { int src_alpha = clip_scan[col] * src_scan[3] / 255; @@ -1414,7 +1414,7 @@ void _CompositeRow_Argb2Argb_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, src_scan += 4; continue; } - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan == NULL) { src_alpha = src_scan[3]; } else { @@ -1427,7 +1427,7 @@ void _CompositeRow_Argb2Argb_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, dest_alpha_scan ++; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { @@ -1527,7 +1527,7 @@ inline void _CompositeRow_Argb2Rgb_Blend_Transform(FX_LPBYTE dest_scan, FX_LPCBY int dest_gap = dest_Bpp - 3; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1); - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan) { src_alpha = src_scan[3] * (*clip_scan++) / 255; } else { @@ -1566,7 +1566,7 @@ inline void _CompositeRow_Argb2Rgb_NoBlend_Transform(FX_LPBYTE dest_scan, FX_LPC int dest_gap = dest_Bpp - 3; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1); - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan) { src_alpha = src_scan[3] * (*clip_scan++) / 255; } else { @@ -1669,7 +1669,7 @@ inline void _CompositeRow_8bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = pPalette[*src_scan]; + uint8_t gray = pPalette[*src_scan]; int src_alpha = *src_alpha_scan++; if (clip_scan) { src_alpha = clip_scan[col] * src_alpha / 255; @@ -1689,7 +1689,7 @@ inline void _CompositeRow_8bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, return; } for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = pPalette[*src_scan]; + uint8_t gray = pPalette[*src_scan]; int src_alpha = *src_alpha_scan++; if (clip_scan) { src_alpha = clip_scan[col] * src_alpha / 255; @@ -1707,7 +1707,7 @@ inline void _CompositeRow_8bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = pPalette[*src_scan]; + uint8_t gray = pPalette[*src_scan]; if (bNonseparableBlend) { blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; } @@ -1723,7 +1723,7 @@ inline void _CompositeRow_8bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, return; } for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = pPalette[*src_scan]; + uint8_t gray = pPalette[*src_scan]; if (clip_scan && clip_scan[col] < 255) { *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); } else { @@ -1743,9 +1743,9 @@ inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = pPalette[*src_scan]; + uint8_t gray = pPalette[*src_scan]; src_scan ++; - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { int src_alpha = *src_alpha_scan ++; if (clip_scan) { @@ -1759,7 +1759,7 @@ inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan dest_alpha_scan ++; continue; } - FX_BYTE src_alpha = *src_alpha_scan++; + uint8_t src_alpha = *src_alpha_scan++; if (clip_scan) { src_alpha = clip_scan[col] * src_alpha / 255; } @@ -1781,9 +1781,9 @@ inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan return; } for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = pPalette[*src_scan]; + uint8_t gray = pPalette[*src_scan]; src_scan ++; - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { int src_alpha = *src_alpha_scan ++; if (clip_scan) { @@ -1797,7 +1797,7 @@ inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan dest_alpha_scan ++; continue; } - FX_BYTE src_alpha = *src_alpha_scan++; + uint8_t src_alpha = *src_alpha_scan++; if (clip_scan) { src_alpha = clip_scan[col] * src_alpha / 255; } @@ -1817,7 +1817,7 @@ inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = pPalette[*src_scan]; + uint8_t gray = pPalette[*src_scan]; src_scan ++; if (clip_scan == NULL || clip_scan[col] == 255) { *dest_scan++ = gray; @@ -1831,7 +1831,7 @@ inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan continue; } int back_alpha = *dest_alpha_scan; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { @@ -1844,7 +1844,7 @@ inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan return; } for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = pPalette[*src_scan]; + uint8_t gray = pPalette[*src_scan]; src_scan ++; if (clip_scan == NULL || clip_scan[col] == 255) { *dest_scan++ = gray; @@ -1858,7 +1858,7 @@ inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan continue; } int back_alpha = *dest_alpha_scan; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); @@ -1875,7 +1875,7 @@ inline void _CompositeRow_1bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) ? set_gray : reset_gray; + uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) ? set_gray : reset_gray; if (bNonseparableBlend) { blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; } @@ -1890,7 +1890,7 @@ inline void _CompositeRow_1bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, return; } for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) ? set_gray : reset_gray; + uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) ? set_gray : reset_gray; if (clip_scan && clip_scan[col] < 255) { *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); } else { @@ -1909,7 +1909,7 @@ inline void _CompositeRow_1bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int blended_color; for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) ? set_gray : reset_gray; + uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) ? set_gray : reset_gray; if (clip_scan == NULL || clip_scan[col] == 255) { *dest_scan++ = gray; *dest_alpha_scan ++ = 255; @@ -1922,7 +1922,7 @@ inline void _CompositeRow_1bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan continue; } int back_alpha = *dest_alpha_scan; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { @@ -1935,7 +1935,7 @@ inline void _CompositeRow_1bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan return; } for (int col = 0; col < pixel_count; col ++) { - FX_BYTE gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) ? set_gray : reset_gray; + uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) ? set_gray : reset_gray; if (clip_scan == NULL || clip_scan[col] == 255) { *dest_scan++ = gray; *dest_alpha_scan ++ = 255; @@ -1948,7 +1948,7 @@ inline void _CompositeRow_1bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan continue; } int back_alpha = *dest_alpha_scan; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); @@ -1968,7 +1968,7 @@ inline void _CompositeRow_8bppRgb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE sr int src_g = FXARGB_G(argb); int src_b = FXARGB_B(argb); src_scan ++; - FX_BYTE src_alpha = 0; + uint8_t src_alpha = 0; if (clip_scan) { src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255; } else { @@ -2069,7 +2069,7 @@ inline void _CompositeRow_8bppRgb2Argb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE s int src_r = FXARGB_R(argb); int src_g = FXARGB_G(argb); int src_b = FXARGB_B(argb); - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { if (clip_scan) { int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255; @@ -2081,7 +2081,7 @@ inline void _CompositeRow_8bppRgb2Argb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE s src_alpha_scan ++; continue; } - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan == NULL) { src_alpha = *src_alpha_scan ++; } else { @@ -2091,7 +2091,7 @@ inline void _CompositeRow_8bppRgb2Argb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE s dest_scan += 4; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); @@ -2123,7 +2123,7 @@ inline void _CompositeRow_8bppRgb2Argb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE s continue; } int back_alpha = dest_scan[3]; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); @@ -2147,7 +2147,7 @@ void _CompositeRow_8bppRgb2Rgba_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan int src_r = FXARGB_R(argb); int src_g = FXARGB_G(argb); int src_b = FXARGB_B(argb); - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { if (clip_scan) { int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255; @@ -2161,7 +2161,7 @@ void _CompositeRow_8bppRgb2Rgba_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan src_alpha_scan ++; continue; } - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan == NULL) { src_alpha = *src_alpha_scan++; } else { @@ -2172,7 +2172,7 @@ void _CompositeRow_8bppRgb2Rgba_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan dest_alpha_scan ++; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); @@ -2204,7 +2204,7 @@ void _CompositeRow_8bppRgb2Rgba_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan continue; } int back_alpha = *dest_alpha_scan; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); @@ -2251,7 +2251,7 @@ inline void _CompositeRow_1bppRgb2Argb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE s continue; } int back_alpha = dest_scan[3]; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); @@ -2300,7 +2300,7 @@ void _CompositeRow_1bppRgb2Rgba_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan continue; } int back_alpha = *dest_alpha_scan; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); @@ -2321,7 +2321,7 @@ void _CompositeRow_ByteMask2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m } else { src_alpha = mask_alpha * src_scan[col] / 255; } - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); dest_scan += 4; @@ -2331,12 +2331,12 @@ void _CompositeRow_ByteMask2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m dest_scan += 4; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { int blended_colors[3]; - FX_BYTE src_scan[3]; + uint8_t src_scan[3]; src_scan[0] = src_b; src_scan[1] = src_g; src_scan[2] = src_r; @@ -2379,7 +2379,7 @@ void _CompositeRow_ByteMask2Rgba(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m } else { src_alpha = mask_alpha * src_scan[col] / 255; } - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { *dest_scan ++ = src_b; *dest_scan ++ = src_g; @@ -2392,12 +2392,12 @@ void _CompositeRow_ByteMask2Rgba(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m dest_alpha_scan ++; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { int blended_colors[3]; - FX_BYTE src_scan[3]; + uint8_t src_scan[3]; src_scan[0] = src_b; src_scan[1] = src_g; src_scan[2] = src_r; @@ -2447,7 +2447,7 @@ void _CompositeRow_ByteMask2Rgb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma } if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { int blended_colors[3]; - FX_BYTE src_scan[3]; + uint8_t src_scan[3]; src_scan[0] = src_b; src_scan[1] = src_g; src_scan[2] = src_r; @@ -2486,7 +2486,7 @@ void _CompositeRow_ByteMask2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m } else { src_alpha = mask_alpha * src_scan[col] / 255; } - FX_BYTE back_alpha = *dest_scan; + uint8_t back_alpha = *dest_scan; if (!back_alpha) { *dest_scan = src_alpha; } else if (src_alpha) { @@ -2522,7 +2522,7 @@ void _CompositeRow_ByteMask2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int } else { src_alpha = mask_alpha * src_scan[col] / 255; } - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { *dest_scan ++ = src_gray; *dest_alpha_scan ++ = src_alpha; @@ -2533,7 +2533,7 @@ void _CompositeRow_ByteMask2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int dest_alpha_scan ++; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, alpha_ratio); @@ -2564,18 +2564,18 @@ void _CompositeRow_BitMask2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma } else { src_alpha = mask_alpha; } - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); dest_scan += 4; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { int blended_colors[3]; - FX_BYTE src_scan[3]; + uint8_t src_scan[3]; src_scan[0] = src_b; src_scan[1] = src_g; src_scan[2] = src_r; @@ -2636,7 +2636,7 @@ void _CompositeRow_BitMask2Rgba(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma } else { src_alpha = mask_alpha; } - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { *dest_scan ++ = src_b; *dest_scan ++ = src_g; @@ -2644,12 +2644,12 @@ void _CompositeRow_BitMask2Rgba(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma *dest_alpha_scan ++ = mask_alpha; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { int blended_colors[3]; - FX_BYTE src_scan[3]; + uint8_t src_scan[3]; src_scan[0] = src_b; src_scan[1] = src_g; src_scan[2] = src_r; @@ -2714,7 +2714,7 @@ void _CompositeRow_BitMask2Rgb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mas } if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { int blended_colors[3]; - FX_BYTE src_scan[3]; + uint8_t src_scan[3]; src_scan[0] = src_b; src_scan[1] = src_g; src_scan[2] = src_r; @@ -2757,7 +2757,7 @@ void _CompositeRow_BitMask2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma } else { src_alpha = mask_alpha; } - FX_BYTE back_alpha = *dest_scan; + uint8_t back_alpha = *dest_scan; if (!back_alpha) { *dest_scan = src_alpha; } else if (src_alpha) { @@ -2802,7 +2802,7 @@ void _CompositeRow_BitMask2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m } else { src_alpha = mask_alpha; } - FX_BYTE back_alpha = *dest_alpha_scan; + uint8_t back_alpha = *dest_alpha_scan; if (back_alpha == 0) { *dest_scan ++ = src_gray; *dest_alpha_scan ++ = src_alpha; @@ -2813,7 +2813,7 @@ void _CompositeRow_BitMask2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m dest_alpha_scan ++; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, alpha_ratio); @@ -2825,7 +2825,7 @@ void _CompositeRow_Argb2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_sc int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < pixel_count; col ++) { - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { if (clip_scan) { int src_alpha = clip_scan[col] * src_scan[3] / 255; @@ -2840,7 +2840,7 @@ void _CompositeRow_Argb2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_sc src_scan += 4; continue; } - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan == NULL) { src_alpha = src_scan[3]; } else { @@ -2851,11 +2851,11 @@ void _CompositeRow_Argb2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_sc src_scan += 4; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { - FX_BYTE dest_scan_o[3]; + uint8_t dest_scan_o[3]; dest_scan_o[0] = dest_scan[2]; dest_scan_o[1] = dest_scan[1]; dest_scan_o[2] = dest_scan[0]; @@ -2883,7 +2883,7 @@ void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LP FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int src_gap = src_Bpp - 3; for (int col = 0; col < width; col ++) { - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { if (src_Bpp == 4) { FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan)); @@ -2896,7 +2896,7 @@ void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LP } dest_scan[3] = 0xff; if (bNonseparableBlend) { - FX_BYTE dest_scan_o[3]; + uint8_t dest_scan_o[3]; dest_scan_o[0] = dest_scan[2]; dest_scan_o[1] = dest_scan[1]; dest_scan_o[2] = dest_scan[0]; @@ -2919,7 +2919,7 @@ inline void _CompositeRow_Argb2Rgb_Blend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LP int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < width; col ++) { - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan) { src_alpha = src_scan[3] * (*clip_scan++) / 255; } else { @@ -2931,7 +2931,7 @@ inline void _CompositeRow_Argb2Rgb_Blend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LP continue; } if (bNonseparableBlend) { - FX_BYTE dest_scan_o[3]; + uint8_t dest_scan_o[3]; dest_scan_o[0] = dest_scan[2]; dest_scan_o[1] = dest_scan[1]; dest_scan_o[2] = dest_scan[0]; @@ -2968,7 +2968,7 @@ inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, int src_gap = src_Bpp - 3; for (int col = 0; col < width; col ++) { if (bNonseparableBlend) { - FX_BYTE dest_scan_o[3]; + uint8_t dest_scan_o[3]; dest_scan_o[0] = dest_scan[2]; dest_scan_o[1] = dest_scan[1]; dest_scan_o[2] = dest_scan[0]; @@ -2990,7 +2990,7 @@ inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, inline void _CompositeRow_Argb2Rgb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int dest_Bpp, FX_LPCBYTE clip_scan) { for (int col = 0; col < width; col ++) { - FX_BYTE src_alpha; + uint8_t src_alpha; if (clip_scan) { src_alpha = src_scan[3] * (*clip_scan++) / 255; } else { @@ -3035,7 +3035,7 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, int src_gap = src_Bpp - 3; for (int col = 0; col < width; col ++) { int src_alpha = *clip_scan ++; - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { dest_scan[2] = FX_GAMMA(*src_scan++); dest_scan[1] = FX_GAMMA(*src_scan++); @@ -3049,11 +3049,11 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, src_scan += src_Bpp; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (bNonseparableBlend) { - FX_BYTE dest_scan_o[3]; + uint8_t dest_scan_o[3]; dest_scan_o[0] = dest_scan[2]; dest_scan_o[1] = dest_scan[1]; dest_scan_o[2] = dest_scan[0]; @@ -3078,14 +3078,14 @@ inline void _CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, F FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int src_gap = src_Bpp - 3; for (int col = 0; col < width; col ++) { - FX_BYTE src_alpha = *clip_scan ++; + uint8_t src_alpha = *clip_scan ++; if (src_alpha == 0) { dest_scan += dest_Bpp; src_scan += src_Bpp; continue; } if (bNonseparableBlend) { - FX_BYTE dest_scan_o[3]; + uint8_t dest_scan_o[3]; dest_scan_o[0] = dest_scan[2]; dest_scan_o[1] = dest_scan[1]; dest_scan_o[2] = dest_scan[0]; @@ -3124,7 +3124,7 @@ inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_RgbByteOrder(FX_LPBYTE dest_scan continue; } int back_alpha = dest_scan[3]; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; for (int color = 0; color < 3; color ++) { @@ -3247,7 +3247,7 @@ inline void _CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, continue; } int back_alpha = dest_scan[3]; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], FX_GAMMA(src_b), alpha_ratio); @@ -3298,7 +3298,7 @@ inline void _CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, continue; } int back_alpha = dest_scan[3]; - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], FX_GAMMA(src_b), alpha_ratio); @@ -3317,7 +3317,7 @@ void _CompositeRow_ByteMask2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE sr } else { src_alpha = mask_alpha * src_scan[col] / 255; } - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); dest_scan += 4; @@ -3327,13 +3327,13 @@ void _CompositeRow_ByteMask2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE sr dest_scan += 4; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { int blended_colors[3]; - FX_BYTE src_scan[3]; - FX_BYTE dest_scan_o[3]; + uint8_t src_scan[3]; + uint8_t dest_scan_o[3]; src_scan[0] = src_b; src_scan[1] = src_g; src_scan[2] = src_r; @@ -3378,8 +3378,8 @@ void _CompositeRow_ByteMask2Rgb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src } if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { int blended_colors[3]; - FX_BYTE src_scan[3]; - FX_BYTE dest_scan_o[3]; + uint8_t src_scan[3]; + uint8_t dest_scan_o[3]; src_scan[0] = src_b; src_scan[1] = src_g; src_scan[2] = src_r; @@ -3429,19 +3429,19 @@ void _CompositeRow_BitMask2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src } else { src_alpha = mask_alpha; } - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); dest_scan += 4; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { int blended_colors[3]; - FX_BYTE src_scan[3]; - FX_BYTE dest_scan_o[3]; + uint8_t src_scan[3]; + uint8_t dest_scan_o[3]; src_scan[0] = src_b; src_scan[1] = src_g; src_scan[2] = src_r; @@ -3501,8 +3501,8 @@ void _CompositeRow_BitMask2Rgb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_ } if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { int blended_colors[3]; - FX_BYTE src_scan[3]; - FX_BYTE dest_scan_o[3]; + uint8_t src_scan[3]; + uint8_t dest_scan_o[3]; src_scan[0] = src_b; src_scan[1] = src_g; src_scan[2] = src_r; @@ -3559,7 +3559,7 @@ inline FX_BOOL _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, int mask_red = dest_format & 0x0400 ? FX_CCOLOR(gray_p[0]) : gray_p[0]; } else { if (alpha_flag >> 8) { - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(mask_red, mask_green, mask_blue, mask_black, r, g, b); mask_red = FXRGB2GRAY(r, g, b); @@ -3600,7 +3600,7 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB if (pSrcPalette) { if ((dest_format & 0xff) == 8) { int pal_count = 1 << (src_format & 0xff); - FX_LPBYTE gray_pal = FX_Alloc(FX_BYTE, pal_count); + FX_LPBYTE gray_pal = FX_Alloc(uint8_t, pal_count); pDestPalette = (FX_DWORD*)gray_pal; for (int i = 0; i < pal_count; i ++) { FX_DWORD color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) : FXARGB_TODIB(pSrcPalette[i]); @@ -3618,7 +3618,7 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB } } else { int pal_count = 1 << (src_format & 0xff); - FX_LPBYTE gray_pal = FX_Alloc(FX_BYTE, pal_count); + FX_LPBYTE gray_pal = FX_Alloc(uint8_t, pal_count); if (pal_count == 2) { gray_pal[0] = 0; gray_pal[1] = 255; @@ -3643,12 +3643,12 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB if (pSrcPalette) { if ((dest_format & 0xff) == 8) { int pal_count = 1 << (src_format & 0xff); - FX_LPBYTE gray_pal = FX_Alloc(FX_BYTE, pal_count); + FX_LPBYTE gray_pal = FX_Alloc(uint8_t, pal_count); pDestPalette = (FX_DWORD*)gray_pal; if (isSrcCmyk) { for (int i = 0; i < pal_count; i ++) { FX_CMYK cmyk = pSrcPalette[i]; - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk), FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), r, g, b); *gray_pal ++ = FXRGB2GRAY(r, g, b); @@ -3666,7 +3666,7 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB } else { for (int i = 0; i < palsize; i ++) { FX_CMYK cmyk = pSrcPalette[i]; - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk), FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), r, g, b); pDestPalette[i] = FXARGB_MAKE(0xff, r, g, b); @@ -3676,7 +3676,7 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB } else { if ((dest_format & 0xff) == 8) { int pal_count = 1 << (src_format & 0xff); - FX_LPBYTE gray_pal = FX_Alloc(FX_BYTE, pal_count); + FX_LPBYTE gray_pal = FX_Alloc(uint8_t, pal_count); if (pal_count == 2) { gray_pal[0] = 0; gray_pal[1] = 255; @@ -3700,7 +3700,7 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB if (isSrcCmyk != isDstCmyk) { for (int i = 0; i < palsize; i ++) { FX_CMYK cmyk = pDestPalette[i]; - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk), FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), r, g, b); pDestPalette[i] = FXARGB_MAKE(0xff, r, g, b); @@ -3727,7 +3727,7 @@ CFX_ScanlineCompositor::~CFX_ScanlineCompositor() FX_Free(m_pCacheScanline); } } -FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_format, FX_INT32 width, FX_DWORD* pSrcPalette, +FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_format, int32_t width, FX_DWORD* pSrcPalette, FX_DWORD mask_color, int blend_type, FX_BOOL bClip, FX_BOOL bRgbByteOrder, int alpha_flag, void* pIccTransform) { m_SrcFormat = src_format; @@ -3861,7 +3861,7 @@ void CFX_ScanlineCompositor::CompositeRgbBitmapLine(FX_LPBYTE dest_scan, FX_LPCB } else { int dest_Size = width * dest_Bpp + 4; if (dest_Size > m_CacheSize) { - m_pCacheScanline = FX_Realloc(FX_BYTE, m_pCacheScanline, dest_Size); + m_pCacheScanline = FX_Realloc(uint8_t, m_pCacheScanline, dest_Size); if (!m_pCacheScanline) { return; } @@ -4158,7 +4158,7 @@ FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left, int dest_top, int width, int if (width == 0 || height == 0) { return TRUE; } - int src_alpha = (FX_BYTE)(alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color); + int src_alpha = (uint8_t)(alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color); if (src_alpha == 0) { return TRUE; } @@ -4214,19 +4214,19 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX } FX_LPBYTE color_p = (FX_LPBYTE)&dst_color; if (m_bpp == 8) { - FX_BYTE gray = 255; + uint8_t gray = 255; if (!IsAlphaMask()) { if (pIccTransform && CFX_GEModule::Get()->GetCodecModule() && CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); pIccModule->TranslateScanline(pIccTransform, &gray, color_p, 1); } else { if (alpha_flag >> 8) { - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(color_p[0], color_p[1], color_p[2], color_p[3], r, g, b); gray = FXRGB2GRAY(r, g, b); } else { - gray = (FX_BYTE)FXRGB2GRAY((int)color_p[2], color_p[1], color_p[0]); + gray = (uint8_t)FXRGB2GRAY((int)color_p[2], color_p[1], color_p[0]); } } if (IsCmykImage()) { @@ -4245,13 +4245,13 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX } return TRUE; } else if (m_bpp == 1) { - ASSERT(!IsCmykImage() && (FX_BYTE)(alpha_flag >> 8) == 0); + ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0); int left_shift = rect.left % 8; int right_shift = rect.right % 8; int width = rect.right / 8 - rect.left / 8; int index = 0; if (m_pPalette == NULL) { - index = ((FX_BYTE)color == 0xff) ? 1 : 0; + index = ((uint8_t)color == 0xff) ? 1 : 0; } else { for (int i = 0; i < 2; i ++) if (m_pPalette[i] == color) { @@ -4259,10 +4259,10 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX } } for (int row = rect.top; row < rect.bottom; row ++) { - FX_BYTE* dest_scan_top = (FX_BYTE*)GetScanline(row) + rect.left / 8; - FX_BYTE* dest_scan_top_r = (FX_BYTE*)GetScanline(row) + rect.right / 8; - FX_BYTE left_flag = *dest_scan_top & (255 << (8 - left_shift)); - FX_BYTE right_flag = *dest_scan_top_r & (255 >> right_shift); + uint8_t* dest_scan_top = (uint8_t*)GetScanline(row) + rect.left / 8; + uint8_t* dest_scan_top_r = (uint8_t*)GetScanline(row) + rect.right / 8; + uint8_t left_flag = *dest_scan_top & (255 << (8 - left_shift)); + uint8_t right_flag = *dest_scan_top_r & (255 >> right_shift); if (width) { FXSYS_memset8(dest_scan_top + 1, index ? 255 : 0, width - 1); if (!index) { @@ -4298,7 +4298,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX } } if(!IsCmykImage()) { - color_p[3] = (FX_BYTE)src_alpha; + color_p[3] = (uint8_t)src_alpha; } int Bpp = m_bpp / 8; FX_BOOL bAlpha = HasAlpha(); @@ -4330,13 +4330,13 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX if (bAlpha) { if (bArgb) { for (int col = 0; col < width; col ++) { - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, color_p[2], color_p[1], color_p[0])); dest_scan += 4; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; int alpha_ratio = src_alpha * 255 / dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[0], alpha_ratio); dest_scan ++; @@ -4349,14 +4349,14 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX } else { FX_LPBYTE dest_scan_alpha = (FX_LPBYTE)m_pAlphaMask->GetScanline(row) + rect.left; for (int col = 0; col < width; col ++) { - FX_BYTE back_alpha = *dest_scan_alpha; + uint8_t back_alpha = *dest_scan_alpha; if (back_alpha == 0) { *dest_scan_alpha++ = src_alpha; FXSYS_memcpy32(dest_scan, color_p, Bpp); dest_scan += Bpp; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; + uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; *dest_scan_alpha ++ = dest_alpha; int alpha_ratio = src_alpha * 255 / dest_alpha; for(int comps = 0; comps < Bpp; comps ++) { @@ -4437,14 +4437,14 @@ FX_BOOL CFX_BitmapComposer::SetInfo(int width, int height, FXDIB_Format src_form return FALSE; } if (m_bVertical) { - m_pScanlineV = FX_Alloc(FX_BYTE, m_pBitmap->GetBPP() / 8 * width + 4); - m_pClipScanV = FX_Alloc(FX_BYTE, m_pBitmap->GetHeight()); + m_pScanlineV = FX_Alloc(uint8_t, m_pBitmap->GetBPP() / 8 * width + 4); + m_pClipScanV = FX_Alloc(uint8_t, m_pBitmap->GetHeight()); if (m_pBitmap->m_pAlphaMask) { - m_pScanlineAlphaV = FX_Alloc(FX_BYTE, width + 4); + m_pScanlineAlphaV = FX_Alloc(uint8_t, width + 4); } } if (m_BitmapAlpha < 255) { - m_pAddClipScan = FX_Alloc(FX_BYTE, m_bVertical ? m_pBitmap->GetHeight() : m_pBitmap->GetWidth()); + m_pAddClipScan = FX_Alloc(uint8_t, m_bVertical ? m_pBitmap->GetHeight() : m_pBitmap->GetWidth()); } return TRUE; } diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp index dacc43db64..0f866a7cc7 100644 --- a/core/src/fxge/dib/fx_dib_convert.cpp +++ b/core/src/fxge/dib/fx_dib_convert.cpp @@ -117,7 +117,7 @@ public: { return m_aLut; } - FX_INT32 Getlut()const + int32_t Getlut()const { return m_lut; } @@ -159,11 +159,11 @@ void _Qsort(FX_DWORD* alut, FX_DWORD* clut, int l, int r) _Qsort(alut, clut, pI + 1, r); } } -void _ColorDecode(FX_DWORD pal_v, FX_BYTE& r, FX_BYTE& g, FX_BYTE& b) +void _ColorDecode(FX_DWORD pal_v, uint8_t& r, uint8_t& g, uint8_t& b) { - r = (FX_BYTE)((pal_v & 0xf00) >> 4); - g = (FX_BYTE)(pal_v & 0x0f0); - b = (FX_BYTE)((pal_v & 0x00f) << 4); + r = (uint8_t)((pal_v & 0xf00) >> 4); + g = (uint8_t)(pal_v & 0x0f0); + b = (uint8_t)((pal_v & 0x00f) << 4); } void _Obtain_Pal(FX_DWORD* aLut, FX_DWORD*cLut, FX_DWORD* dest_pal, int pal_type, FX_DWORD* win_mac_pal, FX_DWORD lut) { @@ -176,7 +176,7 @@ void _Obtain_Pal(FX_DWORD* aLut, FX_DWORD*cLut, FX_DWORD* dest_pal, int pal_type lut_offset += 256; } FX_DWORD color = cLut[lut_offset]; - FX_BYTE r, g, b; + uint8_t r, g, b; _ColorDecode(color, r, g, b); dest_pal[row] = ((FX_DWORD)r << 16) | ((FX_DWORD)g << 8) | b | 0xff000000; aLut[lut_offset] = row; @@ -187,15 +187,15 @@ void _Obtain_Pal(FX_DWORD* aLut, FX_DWORD*cLut, FX_DWORD* dest_pal, int pal_type if (lut_offset < 0) { lut_offset += 256; } - FX_BYTE r, g, b; + uint8_t r, g, b; _ColorDecode(cLut[lut_offset], r, g, b); int error, min_error = 1000000; int c_index = 0; for (col = 0; col < 256; col++) { FX_DWORD p_color = win_mac_pal[col]; - int d_r = r - (FX_BYTE)(p_color >> 16); - int d_g = g - (FX_BYTE)(p_color >> 8); - int d_b = b - (FX_BYTE)p_color; + int d_r = r - (uint8_t)(p_color >> 16); + int d_g = g - (uint8_t)(p_color >> 8); + int d_b = b - (uint8_t)p_color; error = d_r * d_r + d_g * d_g + d_b * d_b; if (error < min_error) { min_error = error; @@ -252,9 +252,9 @@ FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap, int pal_type) int row, col; m_lut = 0; for (row = 0; row < height; row++) { - FX_BYTE* scan_line = (FX_BYTE*)pBitmap->GetScanline(row); + uint8_t* scan_line = (uint8_t*)pBitmap->GetScanline(row); for (col = 0; col < width; col++) { - FX_BYTE* src_port = scan_line + col * bpp; + uint8_t* src_port = scan_line + col * bpp; FX_DWORD b = src_port[0] & 0xf0; FX_DWORD g = src_port[1] & 0xf0; FX_DWORD r = src_port[2] & 0xf0; @@ -282,7 +282,7 @@ FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap, int pal_type) FX_BOOL _ConvertBuffer_1bppMask2Gray(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top) { - FX_BYTE set_gray, reset_gray; + uint8_t set_gray, reset_gray; set_gray = 0xff; reset_gray = 0x00; for (int row = 0; row < height; row ++) { @@ -312,7 +312,7 @@ FX_BOOL _ConvertBuffer_1bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { FX_DWORD* src_plt = pSrcBitmap->GetPalette(); - FX_BYTE gray[2]; + uint8_t gray[2]; if (pIccTransform) { FX_DWORD plt[2]; if (pSrcBitmap->IsCmykImage()) { @@ -330,7 +330,7 @@ FX_BOOL _ConvertBuffer_1bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); pIccModule->TranslateScanline(pIccTransform, gray, (FX_LPCBYTE)plt, 2); } else { - FX_BYTE reset_r, reset_g, reset_b, + uint8_t reset_r, reset_g, reset_b, set_r, set_g, set_b; if (pSrcBitmap->IsCmykImage()) { AdobeCMYK_to_sRGB1(FXSYS_GetCValue(src_plt[0]), FXSYS_GetMValue(src_plt[0]), FXSYS_GetYValue(src_plt[0]), FXSYS_GetKValue(src_plt[0]), @@ -365,7 +365,7 @@ FX_BOOL _ConvertBuffer_8bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { FX_DWORD* src_plt = pSrcBitmap->GetPalette(); - FX_BYTE gray[256]; + uint8_t gray[256]; if (pIccTransform) { FX_DWORD plt[256]; if (pSrcBitmap->IsCmykImage()) { @@ -384,7 +384,7 @@ FX_BOOL _ConvertBuffer_8bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt pIccModule->TranslateScanline(pIccTransform, gray, (FX_LPCBYTE)plt, 256); } else { if (pSrcBitmap->IsCmykImage()) { - FX_BYTE r, g, b; + uint8_t r, g, b; for (int i = 0; i < 256; i ++) { AdobeCMYK_to_sRGB1(FXSYS_GetCValue(src_plt[i]), FXSYS_GetMValue(src_plt[i]), FXSYS_GetYValue(src_plt[i]), FXSYS_GetKValue(src_plt[i]), r, g, b); @@ -433,7 +433,7 @@ FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(FX_LPBYTE dest_buf, int dest_pitch, int wi FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 4; for (int col = 0; col < width; col ++) { - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(FXSYS_GetCValue((FX_DWORD)src_scan[0]), FXSYS_GetMValue((FX_DWORD)src_scan[1]), FXSYS_GetYValue((FX_DWORD)src_scan[2]), FXSYS_GetKValue((FX_DWORD)src_scan[3]), r, g, b); *dest_scan++ = FXRGB2GRAY(r, g, b); @@ -506,7 +506,7 @@ FX_BOOL _ConvertBuffer_Plt2PltRgb8(FX_LPBYTE dest_buf, int dest_pitch, int width } else { if (pSrcBitmap->IsCmykImage()) { for (int i = 0; i < plt_size; i ++) { - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(FXSYS_GetCValue(src_plt[i]), FXSYS_GetMValue(src_plt[i]), FXSYS_GetYValue(src_plt[i]), FXSYS_GetKValue(src_plt[i]), r, g, b); dst_plt[i] = FXARGB_MAKE(0xff, r, g, b); @@ -536,14 +536,14 @@ inline FX_BOOL _ConvertBuffer_Rgb2PltRgb8_NoTransform(FX_LPBYTE dest_buf, int de int lut_256 = lut - 256; for (row = 0; row < lut_256; row++) { min_err = 1000000; - FX_BYTE r, g, b; + uint8_t r, g, b; _ColorDecode(cLut[row], r, g, b); int clrindex = 0; for (int col = 0; col < 256; col++) { FX_DWORD p_color = *(pPalette + col); - int d_r = r - (FX_BYTE)(p_color >> 16); - int d_g = g - (FX_BYTE)(p_color >> 8); - int d_b = b - (FX_BYTE)(p_color); + int d_r = r - (uint8_t)(p_color >> 16); + int d_g = g - (uint8_t)(p_color >> 8); + int d_b = b - (uint8_t)(p_color); err = d_r * d_r + d_g * d_g + d_b * d_b; if (err < min_err) { min_err = err; @@ -553,19 +553,19 @@ inline FX_BOOL _ConvertBuffer_Rgb2PltRgb8_NoTransform(FX_LPBYTE dest_buf, int de aLut[row] = clrindex; } } - FX_INT32 lut_1 = lut - 1; + int32_t lut_1 = lut - 1; for (row = 0; row < height; row ++) { - FX_BYTE* src_scan = (FX_BYTE*)pSrcBitmap->GetScanline(src_top + row) + src_left; - FX_BYTE* dest_scan = dest_buf + row * dest_pitch; + uint8_t* src_scan = (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left; + uint8_t* dest_scan = dest_buf + row * dest_pitch; for (col = 0; col < width; col++) { - FX_BYTE* src_port = src_scan + col * bpp; + uint8_t* src_port = src_scan + col * bpp; int r = src_port[2] & 0xf0; int g = src_port[1] & 0xf0; int b = src_port[0] & 0xf0; FX_DWORD clrindex = (r << 4) + g + (b >> 4); for (int i = lut_1; i >= 0; i--) if (clrindex == cLut[i]) { - *(dest_scan + col) = (FX_BYTE)(aLut[i]); + *(dest_scan + col) = (uint8_t)(aLut[i]); break; } } @@ -592,7 +592,7 @@ FX_BOOL _ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top) { int comps = (dst_format & 0xff) / 8; - FX_BYTE set_gray, reset_gray; + uint8_t set_gray, reset_gray; set_gray = 0xff; reset_gray = 0x00; for (int row = 0; row < height; row ++) { @@ -620,7 +620,7 @@ FX_BOOL _ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, for (int row = 0; row < height; row ++) { FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; - FX_BYTE src_pixel; + uint8_t src_pixel; for (int col = 0; col < width; col ++) { src_pixel = *src_scan++; *dest_scan++ = src_pixel; @@ -996,7 +996,7 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransfor } int dest_bpp = dest_format & 0xff; int dest_pitch = (dest_bpp * m_Width + 31) / 32 * 4; - FX_LPBYTE dest_buf = FX_TryAlloc(FX_BYTE, dest_pitch * m_Height + 4); + FX_LPBYTE dest_buf = FX_TryAlloc(uint8_t, dest_pitch * m_Height + 4); if (dest_buf == NULL) { return FALSE; } @@ -1061,8 +1061,8 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransfor } m_bExtBuf = FALSE; m_pBuffer = dest_buf; - m_bpp = (FX_BYTE)dest_format; - m_AlphaFlag = (FX_BYTE)(dest_format >> 8); + m_bpp = (uint8_t)dest_format; + m_AlphaFlag = (uint8_t)(dest_format >> 8); m_Pitch = dest_pitch; return TRUE; } diff --git a/core/src/fxge/dib/fx_dib_engine.cpp b/core/src/fxge/dib/fx_dib_engine.cpp index b486def167..f52c30e95a 100644 --- a/core/src/fxge/dib/fx_dib_engine.cpp +++ b/core/src/fxge/dib/fx_dib_engine.cpp @@ -28,7 +28,7 @@ void CWeightTable::Calc(int dest_len, int dest_min, int dest_max, int src_len, i if ((dest_max - dest_min) > (int)((1U << 30) - 4) / m_ItemSize) { return; } - m_pWeightTables = FX_TryAlloc(FX_BYTE, (dest_max - dest_min) * m_ItemSize + 4); + m_pWeightTables = FX_TryAlloc(uint8_t, (dest_max - dest_min) * m_ItemSize + 4); if (m_pWeightTables == NULL) { return; } @@ -202,7 +202,7 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap, FXDIB_Format d } size += 31; size = size / 32 * 4; - m_pDestScanline = FX_TryAlloc(FX_BYTE, size); + m_pDestScanline = FX_TryAlloc(uint8_t, size); if (m_pDestScanline == NULL) { return; } @@ -373,7 +373,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) if (m_Flags & FXDIB_BICUBIC_INTERPOL) { dest_a = dest_a < 0 ? 0 : dest_a > 16711680 ? 16711680 : dest_a; } - *dest_scan++ = (FX_BYTE)(dest_a >> 16); + *dest_scan++ = (uint8_t)(dest_a >> 16); } break; } @@ -388,7 +388,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) if (m_Flags & FXDIB_BICUBIC_INTERPOL) { dest_a = dest_a < 0 ? 0 : dest_a > 16711680 ? 16711680 : dest_a; } - *dest_scan++ = (FX_BYTE)(dest_a >> 16); + *dest_scan++ = (uint8_t)(dest_a >> 16); } break; } @@ -406,8 +406,8 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) dest_r = dest_r < 0 ? 0 : dest_r > 16711680 ? 16711680 : dest_r; dest_a = dest_a < 0 ? 0 : dest_a > 65536 ? 65536 : dest_a; } - *dest_scan++ = (FX_BYTE)(dest_r >> 16); - *dest_scan_mask++ = (FX_BYTE)((dest_a * 255) >> 16); + *dest_scan++ = (uint8_t)(dest_r >> 16); + *dest_scan_mask++ = (uint8_t)((dest_a * 255) >> 16); } break; } @@ -419,13 +419,13 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart]; unsigned long argb_cmyk = m_pSrcPalette[src_scan[j]]; if (m_DestFormat == FXDIB_Rgb) { - dest_r_y += pixel_weight * (FX_BYTE)(argb_cmyk >> 16); - dest_g_m += pixel_weight * (FX_BYTE)(argb_cmyk >> 8); - dest_b_c += pixel_weight * (FX_BYTE)argb_cmyk; + dest_r_y += pixel_weight * (uint8_t)(argb_cmyk >> 16); + dest_g_m += pixel_weight * (uint8_t)(argb_cmyk >> 8); + dest_b_c += pixel_weight * (uint8_t)argb_cmyk; } else { - dest_b_c += pixel_weight * (FX_BYTE)(argb_cmyk >> 24); - dest_g_m += pixel_weight * (FX_BYTE)(argb_cmyk >> 16); - dest_r_y += pixel_weight * (FX_BYTE)(argb_cmyk >> 8); + dest_b_c += pixel_weight * (uint8_t)(argb_cmyk >> 24); + dest_g_m += pixel_weight * (uint8_t)(argb_cmyk >> 16); + dest_r_y += pixel_weight * (uint8_t)(argb_cmyk >> 8); } } if (m_Flags & FXDIB_BICUBIC_INTERPOL) { @@ -433,9 +433,9 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) dest_g_m = dest_g_m < 0 ? 0 : dest_g_m > 16711680 ? 16711680 : dest_g_m; dest_b_c = dest_b_c < 0 ? 0 : dest_b_c > 16711680 ? 16711680 : dest_b_c; } - *dest_scan++ = (FX_BYTE)(dest_b_c >> 16); - *dest_scan++ = (FX_BYTE)(dest_g_m >> 16); - *dest_scan++ = (FX_BYTE)(dest_r_y >> 16); + *dest_scan++ = (uint8_t)(dest_b_c >> 16); + *dest_scan++ = (uint8_t)(dest_g_m >> 16); + *dest_scan++ = (uint8_t)(dest_r_y >> 16); } break; } @@ -448,13 +448,13 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) pixel_weight = pixel_weight * src_scan_mask[j] / 255; unsigned long argb_cmyk = m_pSrcPalette[src_scan[j]]; if (m_DestFormat == FXDIB_Rgba) { - dest_r_y += pixel_weight * (FX_BYTE)(argb_cmyk >> 16); - dest_g_m += pixel_weight * (FX_BYTE)(argb_cmyk >> 8); - dest_b_c += pixel_weight * (FX_BYTE)argb_cmyk; + dest_r_y += pixel_weight * (uint8_t)(argb_cmyk >> 16); + dest_g_m += pixel_weight * (uint8_t)(argb_cmyk >> 8); + dest_b_c += pixel_weight * (uint8_t)argb_cmyk; } else { - dest_b_c += pixel_weight * (FX_BYTE)(argb_cmyk >> 24); - dest_g_m += pixel_weight * (FX_BYTE)(argb_cmyk >> 16); - dest_r_y += pixel_weight * (FX_BYTE)(argb_cmyk >> 8); + dest_b_c += pixel_weight * (uint8_t)(argb_cmyk >> 24); + dest_g_m += pixel_weight * (uint8_t)(argb_cmyk >> 16); + dest_r_y += pixel_weight * (uint8_t)(argb_cmyk >> 8); } dest_a += pixel_weight; } @@ -464,10 +464,10 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) dest_r_y = dest_r_y < 0 ? 0 : dest_r_y > 16711680 ? 16711680 : dest_r_y; dest_a = dest_a < 0 ? 0 : dest_a > 65536 ? 65536 : dest_a; } - *dest_scan++ = (FX_BYTE)(dest_b_c >> 16); - *dest_scan++ = (FX_BYTE)(dest_g_m >> 16); - *dest_scan++ = (FX_BYTE)(dest_r_y >> 16); - *dest_scan_mask++ = (FX_BYTE)((dest_a * 255) >> 16); + *dest_scan++ = (uint8_t)(dest_b_c >> 16); + *dest_scan++ = (uint8_t)(dest_g_m >> 16); + *dest_scan++ = (uint8_t)(dest_r_y >> 16); + *dest_scan_mask++ = (uint8_t)((dest_a * 255) >> 16); } break; } @@ -487,9 +487,9 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) dest_g_m = dest_g_m < 0 ? 0 : dest_g_m > 16711680 ? 16711680 : dest_g_m; dest_r_y = dest_r_y < 0 ? 0 : dest_r_y > 16711680 ? 16711680 : dest_r_y; } - *dest_scan++ = (FX_BYTE)((dest_b_c) >> 16); - *dest_scan++ = (FX_BYTE)((dest_g_m) >> 16); - *dest_scan++ = (FX_BYTE)((dest_r_y) >> 16); + *dest_scan++ = (uint8_t)((dest_b_c) >> 16); + *dest_scan++ = (uint8_t)((dest_g_m) >> 16); + *dest_scan++ = (uint8_t)((dest_r_y) >> 16); dest_scan += Bpp - 3; } break; @@ -517,14 +517,14 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) dest_b_c = dest_b_c < 0 ? 0 : dest_b_c > 16711680 ? 16711680 : dest_b_c; dest_a = dest_a < 0 ? 0 : dest_a > 65536 ? 65536 : dest_a; } - *dest_scan++ = (FX_BYTE)((dest_b_c) >> 16); - *dest_scan++ = (FX_BYTE)((dest_g_m) >> 16); - *dest_scan++ = (FX_BYTE)((dest_r_y) >> 16); + *dest_scan++ = (uint8_t)((dest_b_c) >> 16); + *dest_scan++ = (uint8_t)((dest_g_m) >> 16); + *dest_scan++ = (uint8_t)((dest_r_y) >> 16); if (m_DestFormat == FXDIB_Argb) { - *dest_scan = (FX_BYTE)((dest_a * 255) >> 16); + *dest_scan = (uint8_t)((dest_a * 255) >> 16); } if (dest_scan_mask) { - *dest_scan_mask++ = (FX_BYTE)((dest_a * 255) >> 16); + *dest_scan_mask++ = (uint8_t)((dest_a * 255) >> 16); } dest_scan += Bpp - 3; } @@ -564,7 +564,7 @@ void CStretchEngine::StretchVert() if (m_Flags & FXDIB_BICUBIC_INTERPOL) { dest_a = dest_a < 0 ? 0 : dest_a > 16711680 ? 16711680 : dest_a; } - *dest_scan = (FX_BYTE)(dest_a >> 16); + *dest_scan = (uint8_t)(dest_a >> 16); dest_scan += DestBpp; } break; @@ -583,9 +583,9 @@ void CStretchEngine::StretchVert() dest_k = dest_k < 0 ? 0 : dest_k > 16711680 ? 16711680 : dest_k; dest_a = dest_a < 0 ? 0 : dest_a > 16711680 ? 16711680 : dest_a; } - *dest_scan = (FX_BYTE)(dest_k >> 16); + *dest_scan = (uint8_t)(dest_k >> 16); dest_scan += DestBpp; - *dest_sacn_mask++ = (FX_BYTE)(dest_a >> 16); + *dest_sacn_mask++ = (uint8_t)(dest_a >> 16); } break; } @@ -606,9 +606,9 @@ void CStretchEngine::StretchVert() dest_g_m = dest_g_m < 0 ? 0 : dest_g_m > 16711680 ? 16711680 : dest_g_m; dest_b_c = dest_b_c < 0 ? 0 : dest_b_c > 16711680 ? 16711680 : dest_b_c; } - dest_scan[0] = (FX_BYTE)((dest_b_c) >> 16); - dest_scan[1] = (FX_BYTE)((dest_g_m) >> 16); - dest_scan[2] = (FX_BYTE)((dest_r_y) >> 16); + dest_scan[0] = (uint8_t)((dest_b_c) >> 16); + dest_scan[1] = (uint8_t)((dest_g_m) >> 16); + dest_scan[2] = (uint8_t)((dest_r_y) >> 16); dest_scan += DestBpp; } break; @@ -653,9 +653,9 @@ void CStretchEngine::StretchVert() dest_scan[2] = r > 255 ? 255 : r < 0 ? 0 : r; } if (m_DestFormat == FXDIB_Argb) { - dest_scan[3] = (FX_BYTE)((dest_a) >> 16); + dest_scan[3] = (uint8_t)((dest_a) >> 16); } else { - *dest_sacn_mask = (FX_BYTE)((dest_a) >> 16); + *dest_sacn_mask = (uint8_t)((dest_a) >> 16); } dest_scan += DestBpp; if (dest_sacn_mask) { @@ -795,9 +795,9 @@ FX_BOOL CFX_ImageStretcher::StartQuickStretch() return FALSE; } size *= m_DestBPP; - m_pScanline = FX_Alloc(FX_BYTE, (size / 8 + 3) / 4 * 4); + m_pScanline = FX_Alloc(uint8_t, (size / 8 + 3) / 4 * 4); if (m_pSource->m_pAlphaMask) { - m_pMaskScanline = FX_Alloc(FX_BYTE, (m_ClipRect.Width() + 3) / 4 * 4); + m_pMaskScanline = FX_Alloc(uint8_t, (m_ClipRect.Width() + 3) / 4 * 4); } if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH_PIXELS) { ContinueQuickStretch(NULL); diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp index f55b2f5737..f02dd6e382 100644 --- a/core/src/fxge/dib/fx_dib_main.cpp +++ b/core/src/fxge/dib/fx_dib_main.cpp @@ -62,8 +62,8 @@ CFX_DIBitmap::CFX_DIBitmap() FX_BOOL CFX_DIBitmap::Create(int width, int height, FXDIB_Format format, FX_LPBYTE pBuffer, int pitch) { m_pBuffer = NULL; - m_bpp = (FX_BYTE)format; - m_AlphaFlag = (FX_BYTE)(format >> 8); + m_bpp = (uint8_t)format; + m_AlphaFlag = (uint8_t)(format >> 8); m_Width = m_Height = m_Pitch = 0; if (width <= 0 || height <= 0 || pitch < 0) { return FALSE; @@ -84,12 +84,12 @@ FX_BOOL CFX_DIBitmap::Create(int width, int height, FXDIB_Format format, FX_LPBY int size = pitch * height + 4; int oomlimit = _MAX_OOM_LIMIT_; if (oomlimit >= 0 && size >= oomlimit) { - m_pBuffer = FX_TryAlloc(FX_BYTE, size); + m_pBuffer = FX_TryAlloc(uint8_t, size); if (m_pBuffer == NULL) { return FALSE; } } else { - m_pBuffer = FX_Alloc(FX_BYTE, size); + m_pBuffer = FX_Alloc(uint8_t, size); } } m_Width = width; @@ -267,14 +267,14 @@ int CFX_DIBSource::FindPalette(FX_DWORD color) const if (m_pPalette == NULL) { if (IsCmykImage()) { if (GetBPP() == 1) { - return ((FX_BYTE)color == 0xff) ? 0 : 1; + return ((uint8_t)color == 0xff) ? 0 : 1; } - return 0xff - (FX_BYTE)color; + return 0xff - (uint8_t)color; } if (GetBPP() == 1) { - return ((FX_BYTE)color == 0xff) ? 1 : 0; + return ((uint8_t)color == 0xff) ? 1 : 0; } - return (FX_BYTE)color; + return (uint8_t)color; } int palsize = (1 << GetBPP()); for (int i = 0; i < palsize; i ++) @@ -457,7 +457,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, int dest_top, int width, int h } } if(!IsCmykImage()) { - color_p[3] = (FX_BYTE)alpha; + color_p[3] = (uint8_t)alpha; } if (GetFormat() == FXDIB_Argb) { for (int row = 0; row < height; row ++) { @@ -877,12 +877,12 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) if (m_pPalette == NULL) { return FALSE; } - FX_BYTE gray[2]; + uint8_t gray[2]; for (int i = 0; i < 2; i ++) { - int r = (FX_BYTE)(m_pPalette[i] >> 16); - int g = (FX_BYTE)(m_pPalette[i] >> 8); - int b = (FX_BYTE)m_pPalette[i]; - gray[i] = (FX_BYTE)FXRGB2GRAY(r, g, b); + int r = (uint8_t)(m_pPalette[i] >> 16); + int g = (uint8_t)(m_pPalette[i] >> 8); + int b = (uint8_t)m_pPalette[i]; + gray[i] = (uint8_t)FXRGB2GRAY(r, g, b); } CFX_DIBitmap* pMask = new CFX_DIBitmap; if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { @@ -908,12 +908,12 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) if (m_pPalette == NULL) { return FALSE; } - FX_BYTE gray[256]; + uint8_t gray[256]; for (int i = 0; i < 256; i ++) { - int r = (FX_BYTE)(m_pPalette[i] >> 16); - int g = (FX_BYTE)(m_pPalette[i] >> 8); - int b = (FX_BYTE)m_pPalette[i]; - gray[i] = (FX_BYTE)FXRGB2GRAY(r, g, b); + int r = (uint8_t)(m_pPalette[i] >> 16); + int g = (uint8_t)(m_pPalette[i] >> 8); + int b = (uint8_t)m_pPalette[i]; + gray[i] = (uint8_t)FXRGB2GRAY(r, g, b); } CFX_DIBitmap* pMask = new CFX_DIBitmap; if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { @@ -1090,13 +1090,13 @@ void CFX_DIBitmap::SetPixel(int x, int y, FX_DWORD color) } break; case FXDIB_8bppMask: - *pos = (FX_BYTE)(color >> 24); + *pos = (uint8_t)(color >> 24); break; case FXDIB_8bppRgb: { if (m_pPalette) { for (int i = 0; i < 256; i ++) { if (m_pPalette[i] == color) { - *pos = (FX_BYTE)i; + *pos = (uint8_t)i; return; } } @@ -1225,7 +1225,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) int size = 1 << m_bpp; if (isCmykImage) { for (int i = 0; i < size; i ++) { - FX_BYTE b, g, r; + uint8_t b, g, r; AdobeCMYK_to_sRGB1(FXSYS_GetCValue(m_pPalette[i]), FXSYS_GetMValue(m_pPalette[i]), FXSYS_GetYValue(m_pPalette[i]), FXSYS_GetKValue(m_pPalette[i]), r, g, b); int gray = 255 - FXRGB2GRAY(r, g, b); @@ -1245,7 +1245,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) for (int row = 0; row < m_Height; row ++) { FX_LPBYTE scanline = m_pBuffer + row * m_Pitch; for (int col = 0; col < m_Width; col ++) { - FX_BYTE b, g, r; + uint8_t b, g, r; AdobeCMYK_to_sRGB1(scanline[0], scanline[1], scanline[2], scanline[3], r, g, b); *scanline ++ = 0; @@ -1274,7 +1274,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) for (int row = 0; row < m_Height; row ++) { FX_LPBYTE scanline = m_pBuffer + row * m_Pitch; for (int col = 0; col < m_Width; col ++) { - FX_BYTE b, g, r; + uint8_t b, g, r; AdobeCMYK_to_sRGB1(scanline[0], scanline[1], scanline[2], scanline[3], r, g, b); int gray = 255 - FXRGB2GRAY(r, g, b); @@ -1314,11 +1314,11 @@ FX_BOOL CFX_DIBitmap::DitherFS(const FX_DWORD* pPalette, int pal_size, const FX_ if (pRect) { rect.Intersect(*pRect); } - FX_BYTE translate[256]; + uint8_t translate[256]; for (int i = 0; i < 256; i ++) { int err2 = 65536; for (int j = 0; j < pal_size; j ++) { - FX_BYTE entry = (FX_BYTE)pPalette[j]; + uint8_t entry = (uint8_t)pPalette[j]; int err = (int)entry - i; if (err * err < err2) { err2 = err * err; @@ -1332,7 +1332,7 @@ FX_BOOL CFX_DIBitmap::DitherFS(const FX_DWORD* pPalette, int pal_size, const FX_ for (int col = rect.left; col < rect.right; col ++) { int src_pixel = scan[col]; int dest_pixel = translate[src_pixel]; - scan[col] = (FX_BYTE)dest_pixel; + scan[col] = (uint8_t)dest_pixel; int error = -dest_pixel + src_pixel; if (col < rect.right - 1) { int src = scan[col + 1]; @@ -1495,11 +1495,11 @@ void CFX_FilteredDIB::LoadSrc(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc) m_Width = pSrc->GetWidth(); m_Height = pSrc->GetHeight(); FXDIB_Format format = GetDestFormat(); - m_bpp = (FX_BYTE)format; - m_AlphaFlag = (FX_BYTE)(format >> 8); + m_bpp = (uint8_t)format; + m_AlphaFlag = (uint8_t)(format >> 8); m_Pitch = (m_Width * (format & 0xff) + 31) / 32 * 4; m_pPalette = GetDestPalette(); - m_pScanline = FX_Alloc(FX_BYTE, m_Pitch); + m_pScanline = FX_Alloc(uint8_t, m_Pitch); } FX_LPCBYTE CFX_FilteredDIB::GetScanline(int line) const { @@ -1611,7 +1611,7 @@ FX_BOOL CFX_ImageRenderer::Continue(IFX_Pause* pPause) if (pBitmap->IsAlphaMask()) { if (m_BitmapAlpha != 255) { if (m_AlphaFlag >> 8) { - m_AlphaFlag = (((FX_BYTE)((m_AlphaFlag & 0xff) * m_BitmapAlpha / 255)) | ((m_AlphaFlag >> 8) << 8)); + m_AlphaFlag = (((uint8_t)((m_AlphaFlag & 0xff) * m_BitmapAlpha / 255)) | ((m_AlphaFlag >> 8) << 8)); } else { m_MaskColor = FXARGB_MUL_ALPHA(m_MaskColor, m_BitmapAlpha); } diff --git a/core/src/fxge/dib/fx_dib_transform.cpp b/core/src/fxge/dib/fx_dib_transform.cpp index 4544506e7b..073248823d 100644 --- a/core/src/fxge/dib/fx_dib_transform.cpp +++ b/core/src/fxge/dib/fx_dib_transform.cpp @@ -256,7 +256,7 @@ FX_BOOL CFX_ImageTransformer::Start(const CFX_DIBSource* pSrc, const CFX_AffineM m_Status = 3; return TRUE; } -FX_BYTE _bilinear_interpol(FX_LPCBYTE buf, int row_offset_l, int row_offset_r, +uint8_t _bilinear_interpol(FX_LPCBYTE buf, int row_offset_l, int row_offset_r, int src_col_l, int src_col_r, int res_x, int res_y, int bpp, int c_offset) { @@ -269,23 +269,23 @@ FX_BYTE _bilinear_interpol(FX_LPCBYTE buf, int row_offset_l, int row_offset_r, FX_LPCBYTE src_pos1 = buf_u + col_bpp_r; FX_LPCBYTE src_pos2 = buf_d + col_bpp_l; FX_LPCBYTE src_pos3 = buf_d + col_bpp_r; - FX_BYTE r_pos_0 = (*src_pos0 * i_resx + *src_pos1 * res_x) >> 8; - FX_BYTE r_pos_1 = (*src_pos2 * i_resx + *src_pos3 * res_x) >> 8; + uint8_t r_pos_0 = (*src_pos0 * i_resx + *src_pos1 * res_x) >> 8; + uint8_t r_pos_1 = (*src_pos2 * i_resx + *src_pos3 * res_x) >> 8; return (r_pos_0 * (255 - res_y) + r_pos_1 * res_y) >> 8; } -FX_BYTE _bicubic_interpol(FX_LPCBYTE buf, int pitch, int pos_pixel[], int u_w[], int v_w[], int res_x, int res_y, +uint8_t _bicubic_interpol(FX_LPCBYTE buf, int pitch, int pos_pixel[], int u_w[], int v_w[], int res_x, int res_y, int bpp, int c_offset) { int s_result = 0; for (int i = 0; i < 4; i ++) { int a_result = 0; for (int j = 0; j < 4; j ++) { - a_result += u_w[j] * (*(FX_BYTE*)(buf + pos_pixel[i + 4] * pitch + pos_pixel[j] * bpp + c_offset)); + a_result += u_w[j] * (*(uint8_t*)(buf + pos_pixel[i + 4] * pitch + pos_pixel[j] * bpp + c_offset)); } s_result += a_result * v_w[i]; } s_result >>= 16; - return (FX_BYTE)(s_result < 0 ? 0 : s_result > 255 ? 255 : s_result); + return (uint8_t)(s_result < 0 ? 0 : s_result > 255 ? 255 : s_result); } void _bicubic_get_pos_weight(int pos_pixel[], int u_w[], int v_w[], int src_col_l, int src_row_l, int res_x, int res_y, int stretch_width, int stretch_height) @@ -384,7 +384,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) if (!(m_Flags & FXDIB_DOWNSAMPLE) && !(m_Flags & FXDIB_BICUBIC_INTERPOL)) { CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); for (int row = 0; row < m_ResultHeight; row ++) { - FX_BYTE* dest_pos_mask = (FX_BYTE*)pTransformed->m_pAlphaMask->GetScanline(row); + uint8_t* dest_pos_mask = (uint8_t*)pTransformed->m_pAlphaMask->GetScanline(row); for (int col = 0; col < m_ResultWidth; col ++) { int src_col_l, src_row_l, res_x, res_y; result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, res_y); @@ -413,7 +413,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) { CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); for (int row = 0; row < m_ResultHeight; row ++) { - FX_BYTE* dest_pos_mask = (FX_BYTE*)pTransformed->m_pAlphaMask->GetScanline(row); + uint8_t* dest_pos_mask = (uint8_t*)pTransformed->m_pAlphaMask->GetScanline(row); for (int col = 0; col < m_ResultWidth; col ++) { int src_col_l, src_row_l, res_x, res_y; result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, res_y); @@ -435,7 +435,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) } else { CPDF_FixedMatrix result2stretch_fix(result2stretch, 8); for (int row = 0; row < m_ResultHeight; row ++) { - FX_BYTE* dest_pos_mask = (FX_BYTE*)pTransformed->m_pAlphaMask->GetScanline(row); + uint8_t* dest_pos_mask = (uint8_t*)pTransformed->m_pAlphaMask->GetScanline(row); for (int col = 0; col < m_ResultWidth; col ++) { int src_col, src_row; result2stretch_fix.Transform(col, row, src_col, src_row); @@ -549,7 +549,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) if (!(m_Flags & FXDIB_DOWNSAMPLE) && !(m_Flags & FXDIB_BICUBIC_INTERPOL)) { CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); for (int row = 0; row < m_ResultHeight; row ++) { - FX_BYTE* dest_pos = (FX_BYTE*)pTransformed->GetScanline(row); + uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row); for (int col = 0; col < m_ResultWidth; col ++) { int src_col_l, src_row_l, res_x, res_y; result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, res_y); @@ -572,9 +572,9 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) int row_offset_r = src_row_r * stretch_pitch; FX_DWORD r_bgra_cmyk = argb[_bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, 1, 0)]; if (transformF == FXDIB_Rgba) { - dest_pos[0] = (FX_BYTE)(r_bgra_cmyk >> 24); - dest_pos[1] = (FX_BYTE)(r_bgra_cmyk >> 16); - dest_pos[2] = (FX_BYTE)(r_bgra_cmyk >> 8); + dest_pos[0] = (uint8_t)(r_bgra_cmyk >> 24); + dest_pos[1] = (uint8_t)(r_bgra_cmyk >> 16); + dest_pos[2] = (uint8_t)(r_bgra_cmyk >> 8); } else { *(FX_DWORD*)dest_pos = r_bgra_cmyk; } @@ -585,7 +585,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) { CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); for (int row = 0; row < m_ResultHeight; row ++) { - FX_BYTE* dest_pos = (FX_BYTE*)pTransformed->GetScanline(row); + uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row); for (int col = 0; col < m_ResultWidth; col ++) { int src_col_l, src_row_l, res_x, res_y; result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, res_y); @@ -601,9 +601,9 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) _bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l, res_x, res_y, stretch_width, stretch_height); FX_DWORD r_bgra_cmyk = argb[_bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, 1, 0)]; if (transformF == FXDIB_Rgba) { - dest_pos[0] = (FX_BYTE)(r_bgra_cmyk >> 24); - dest_pos[1] = (FX_BYTE)(r_bgra_cmyk >> 16); - dest_pos[2] = (FX_BYTE)(r_bgra_cmyk >> 8); + dest_pos[0] = (uint8_t)(r_bgra_cmyk >> 24); + dest_pos[1] = (uint8_t)(r_bgra_cmyk >> 16); + dest_pos[2] = (uint8_t)(r_bgra_cmyk >> 8); } else { *(FX_DWORD*)dest_pos = r_bgra_cmyk; } @@ -614,7 +614,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) } else { CPDF_FixedMatrix result2stretch_fix(result2stretch, 8); for (int row = 0; row < m_ResultHeight; row ++) { - FX_BYTE* dest_pos = (FX_BYTE*)pTransformed->GetScanline(row); + uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row); for (int col = 0; col < m_ResultWidth; col ++) { int src_col, src_row; result2stretch_fix.Transform(col, row, src_col, src_row); @@ -627,9 +627,9 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) } FX_DWORD r_bgra_cmyk = argb[stretch_buf[src_row * stretch_pitch + src_col]]; if (transformF == FXDIB_Rgba) { - dest_pos[0] = (FX_BYTE)(r_bgra_cmyk >> 24); - dest_pos[1] = (FX_BYTE)(r_bgra_cmyk >> 16); - dest_pos[2] = (FX_BYTE)(r_bgra_cmyk >> 8); + dest_pos[0] = (uint8_t)(r_bgra_cmyk >> 24); + dest_pos[1] = (uint8_t)(r_bgra_cmyk >> 16); + dest_pos[2] = (uint8_t)(r_bgra_cmyk >> 8); } else { *(FX_DWORD*)dest_pos = r_bgra_cmyk; } @@ -644,7 +644,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) if (!(m_Flags & FXDIB_DOWNSAMPLE) && !(m_Flags & FXDIB_BICUBIC_INTERPOL)) { CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); for (int row = 0; row < m_ResultHeight; row ++) { - FX_BYTE* dest_pos = (FX_BYTE*)pTransformed->GetScanline(row); + uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row); for (int col = 0; col < m_ResultWidth; col ++) { int src_col_l, src_row_l, res_x, res_y, r_pos_k_r = 0; result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, res_y); @@ -665,9 +665,9 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) } int row_offset_l = src_row_l * stretch_pitch; int row_offset_r = src_row_r * stretch_pitch; - FX_BYTE r_pos_red_y_r = _bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, Bpp, 2); - FX_BYTE r_pos_green_m_r = _bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, Bpp, 1); - FX_BYTE r_pos_blue_c_r = _bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, Bpp, 0); + uint8_t r_pos_red_y_r = _bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, Bpp, 2); + uint8_t r_pos_green_m_r = _bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, Bpp, 1); + uint8_t r_pos_blue_c_r = _bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, Bpp, 0); if (bHasAlpha) { if (transformF != FXDIB_Argb) { if (transformF == FXDIB_Rgba) { @@ -679,7 +679,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) *(FX_DWORD*)dest_pos = FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r, r_pos_red_y_r, r_pos_k_r)); } } else { - FX_BYTE r_pos_a_r = _bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, Bpp, 3); + uint8_t r_pos_a_r = _bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, Bpp, 3); *(FX_DWORD*)dest_pos = FXARGB_TODIB(FXARGB_MAKE(r_pos_a_r, r_pos_red_y_r, r_pos_green_m_r, r_pos_blue_c_r)); } } else { @@ -698,7 +698,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) { CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); for (int row = 0; row < m_ResultHeight; row ++) { - FX_BYTE* dest_pos = (FX_BYTE*)pTransformed->GetScanline(row); + uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row); for (int col = 0; col < m_ResultWidth; col ++) { int src_col_l, src_row_l, res_x, res_y, r_pos_k_r = 0; result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, res_y); @@ -712,9 +712,9 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) src_row_l--; } _bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l, res_x, res_y, stretch_width, stretch_height); - FX_BYTE r_pos_red_y_r = _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 2); - FX_BYTE r_pos_green_m_r = _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 1); - FX_BYTE r_pos_blue_c_r = _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 0); + uint8_t r_pos_red_y_r = _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 2); + uint8_t r_pos_green_m_r = _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 1); + uint8_t r_pos_blue_c_r = _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 0); if (bHasAlpha) { if (transformF != FXDIB_Argb) { if (transformF == FXDIB_Rgba) { @@ -726,7 +726,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) *(FX_DWORD*)dest_pos = FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r, r_pos_red_y_r, r_pos_k_r)); } } else { - FX_BYTE r_pos_a_r = _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 3); + uint8_t r_pos_a_r = _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 3); *(FX_DWORD*)dest_pos = FXARGB_TODIB(FXARGB_MAKE(r_pos_a_r, r_pos_red_y_r, r_pos_green_m_r, r_pos_blue_c_r)); } } else { @@ -745,7 +745,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) } else { CPDF_FixedMatrix result2stretch_fix(result2stretch, 8); for (int row = 0; row < m_ResultHeight; row ++) { - FX_BYTE* dest_pos = (FX_BYTE*)pTransformed->GetScanline(row); + uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row); for (int col = 0; col < m_ResultWidth; col ++) { int src_col, src_row; result2stretch_fix.Transform(col, row, src_col, src_row); diff --git a/core/src/fxge/ge/fx_ge.cpp b/core/src/fxge/ge/fx_ge.cpp index 755aad565e..dffc98962f 100644 --- a/core/src/fxge/ge/fx_ge.cpp +++ b/core/src/fxge/ge/fx_ge.cpp @@ -61,7 +61,7 @@ void CFX_GEModule::SetTextGamma(FX_FLOAT gammaValue) gammaValue /= 2.2f; int i = 0; while (i < 256) { - m_GammaValue[i] = (FX_BYTE)(FXSYS_pow((FX_FLOAT)i / 255, gammaValue) * 255.0f + 0.5f); + m_GammaValue[i] = (uint8_t)(FXSYS_pow((FX_FLOAT)i / 255, gammaValue) * 255.0f + 0.5f); i++; } } diff --git a/core/src/fxge/ge/fx_ge_device.cpp b/core/src/fxge/ge/fx_ge_device.cpp index 9c268b5606..0b4ffd5f4c 100644 --- a/core/src/fxge/ge/fx_ge_device.cpp +++ b/core/src/fxge/ge/fx_ge_device.cpp @@ -125,7 +125,7 @@ FX_BOOL CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData, FX_DWORD fill_color, FX_DWORD stroke_color, int fill_mode, int alpha_flag, void* pIccTransform, int blend_type) { - FX_BYTE fill_alpha, stroke_alpha; + uint8_t fill_alpha, stroke_alpha; if (FXGETFLAG_COLORTYPE(alpha_flag)) { fill_alpha = FXGETFLAG_ALPHA_FILL(alpha_flag); stroke_alpha = FXGETFLAG_ALPHA_STROKE(alpha_flag); diff --git a/core/src/fxge/ge/fx_ge_font.cpp b/core/src/fxge/ge/fx_ge_font.cpp index 1896218cbf..8928d25d4c 100644 --- a/core/src/fxge/ge/fx_ge_font.cpp +++ b/core/src/fxge/ge/fx_ge_font.cpp @@ -103,7 +103,7 @@ extern "C" { }; FX_BOOL _LoadFile(FXFT_Library library, FXFT_Face* Face, IFX_FileRead* pFile, FXFT_Stream* stream) { - FXFT_Stream stream1 = (FXFT_Stream)FX_Alloc(FX_BYTE, sizeof (FXFT_StreamRec)); + FXFT_Stream stream1 = (FXFT_Stream)FX_Alloc(uint8_t, sizeof (FXFT_StreamRec)); stream1->base = NULL; stream1->size = (unsigned long)pFile->GetSize(); stream1->pos = 0; @@ -173,7 +173,7 @@ static FXFT_Face FT_LoadFont(FX_LPBYTE pData, int size) } FX_BOOL CFX_Font::LoadEmbedded(FX_LPCBYTE data, FX_DWORD size) { - m_pFontDataAllocation = FX_Alloc(FX_BYTE, size); + m_pFontDataAllocation = FX_Alloc(uint8_t, size); FXSYS_memcpy32(m_pFontDataAllocation, data, size); m_Face = FT_LoadFont((FX_LPBYTE)m_pFontDataAllocation, size); m_pFontData = (FX_LPBYTE)m_pFontDataAllocation; diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp index c1ea5906ff..9bb53c638f 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -565,7 +565,7 @@ CFX_ByteString CFX_FontMapper::GetPSNameFromTT(void* hFont) CFX_ByteString result; FX_DWORD size = m_pFontInfo->GetFontData(hFont, 0x6e616d65, NULL, 0); if (size) { - FX_LPBYTE buffer = FX_Alloc(FX_BYTE, size); + FX_LPBYTE buffer = FX_Alloc(uint8_t, size); m_pFontInfo->GetFontData(hFont, 0x6e616d65, buffer, size); result = _FPDF_GetNameFromTT(buffer, 6); FX_Free(buffer); @@ -644,7 +644,7 @@ CFX_ByteString CFX_FontMapper::MatchInstalledFonts(const CFX_ByteString& norm_na return match; } typedef struct _CHARSET_MAP_ { - FX_BYTE charset; + uint8_t charset; FX_WORD codepage; } CHARSET_MAP; static const CHARSET_MAP g_Codepage2CharsetTable[] = { @@ -680,11 +680,11 @@ static const CHARSET_MAP g_Codepage2CharsetTable[] = { { 88, 10029 }, { 89, 10007 }, }; -FX_BYTE _GetCharsetFromCodePage(FX_WORD codepage) +uint8_t _GetCharsetFromCodePage(FX_WORD codepage) { - FX_INT32 iEnd = sizeof(g_Codepage2CharsetTable) / sizeof(CHARSET_MAP) - 1; + int32_t iEnd = sizeof(g_Codepage2CharsetTable) / sizeof(CHARSET_MAP) - 1; FXSYS_assert(iEnd >= 0); - FX_INT32 iStart = 0, iMid; + int32_t iStart = 0, iMid; do { iMid = (iStart + iEnd) / 2; const CHARSET_MAP & cp = g_Codepage2CharsetTable[iMid]; @@ -824,7 +824,7 @@ static CFX_ByteString _GetFontFamily(CFX_ByteString fontName, int nStyle) }; typedef struct _FX_FontStyle { FX_LPCSTR style; - FX_INT32 len; + int32_t len; } FX_FontStyle; const FX_FontStyle g_FontStyles[] = { { "Bold", 4 }, @@ -848,9 +848,9 @@ CFX_ByteString ParseStyle(FX_LPCSTR pStyle, int iLen, int iIndex) } return buf.GetByteString(); } -FX_INT32 GetStyleType(const CFX_ByteString &bsStyle, FX_BOOL bRevert) +int32_t GetStyleType(const CFX_ByteString &bsStyle, FX_BOOL bRevert) { - FX_INT32 iLen = bsStyle.GetLength(); + int32_t iLen = bsStyle.GetLength(); if (!iLen) { return -1; } @@ -968,7 +968,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru } if (!bHasHypen) { int nLen = family.GetLength(); - FX_INT32 nRet = GetStyleType(family, TRUE); + int32_t nRet = GetStyleType(family, TRUE); if (nRet > -1) { family = family.Left(nLen - g_FontStyles[nRet].len); if (nRet == 0) { @@ -1000,7 +1000,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru CFX_ByteString buf; while (i < nLen) { buf = ParseStyle(pStyle, nLen, i); - FX_INT32 nRet = GetStyleType(buf, FALSE); + int32_t nRet = GetStyleType(buf, FALSE); if ((i && !bStyleAvail) || (!i && nRet < 0)) { family = SubstName; iBaseFont = 12; @@ -1198,7 +1198,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru } FXFT_Face face = NULL; if (ttc_size) { - FX_BYTE temp[1024]; + uint8_t temp[1024]; m_pFontInfo->GetFontData(hFont, 0x74746366, temp, 1024); FX_DWORD checksum = 0; for (int i = 0; i < 256; i ++) { @@ -1207,7 +1207,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru FX_LPBYTE pFontData; face = m_pFontMgr->GetCachedTTCFace(ttc_size, checksum, ttc_size - font_size, pFontData); if (face == NULL) { - pFontData = FX_Alloc(FX_BYTE, ttc_size); + pFontData = FX_Alloc(uint8_t, ttc_size); m_pFontInfo->GetFontData(hFont, 0x74746366, pFontData, ttc_size); face = m_pFontMgr->AddCachedTTCFace(ttc_size, checksum, pFontData, ttc_size, ttc_size - font_size); @@ -1216,7 +1216,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru FX_LPBYTE pFontData; face = m_pFontMgr->GetCachedFace(SubstName, weight, bItalic, pFontData); if (face == NULL) { - pFontData = FX_Alloc(FX_BYTE, font_size); + pFontData = FX_Alloc(uint8_t, font_size); m_pFontInfo->GetFontData(hFont, 0, pFontData, font_size); face = m_pFontMgr->AddCachedFace(SubstName, weight, bItalic, pFontData, font_size, m_pFontInfo->GetFaceIndex(hFont)); } @@ -1357,7 +1357,7 @@ void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path) } FXSYS_fseek(pFile, 0, FXSYS_SEEK_END); FX_DWORD filesize = FXSYS_ftell(pFile); - FX_BYTE buffer[16]; + uint8_t buffer[16]; FXSYS_fseek(pFile, 0, FXSYS_SEEK_SET); size_t readCnt = FXSYS_fread(buffer, 12, 1, pFile); if (readCnt != 1) { @@ -1372,7 +1372,7 @@ void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path) return; } FX_DWORD face_bytes = nFaces * 4; - FX_LPBYTE offsets = FX_Alloc(FX_BYTE, face_bytes); + FX_LPBYTE offsets = FX_Alloc(uint8_t, face_bytes); readCnt = FXSYS_fread(offsets, face_bytes, 1, pFile); if (readCnt != face_bytes) { FX_Free(offsets); diff --git a/core/src/fxge/ge/fx_ge_linux.cpp b/core/src/fxge/ge/fx_ge_linux.cpp index b9cfc8ef54..e2ed84e081 100644 --- a/core/src/fxge/ge/fx_ge_linux.cpp +++ b/core/src/fxge/ge/fx_ge_linux.cpp @@ -56,7 +56,7 @@ static const FX_LPCSTR g_LinuxB5FontList[] = { static const FX_LPCSTR g_LinuxHGFontList[] = { "UnDotum", }; -static FX_INT32 GetJapanesePreference(FX_LPCSTR facearr, int weight, int picth_family) +static int32_t GetJapanesePreference(FX_LPCSTR facearr, int weight, int picth_family) { CFX_ByteString face = facearr; if (face.Find("Gothic") >= 0 || face.Find("\x83\x53\x83\x56\x83\x62\x83\x4e") >= 0) { @@ -94,35 +94,35 @@ void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int p FX_BOOL bCJK = TRUE; switch (charset) { case FXFONT_SHIFTJIS_CHARSET: { - FX_INT32 index = GetJapanesePreference(cstr_face, weight, pitch_family); + int32_t index = GetJapanesePreference(cstr_face, weight, pitch_family); if (index < 0) { break; } - for (FX_INT32 i = 0; i < LINUX_GPNAMESIZE; i++) + for (int32_t i = 0; i < LINUX_GPNAMESIZE; i++) if (m_FontList.Lookup(LinuxGpFontList[index].NameArr[i], p)) { return p; } } break; case FXFONT_GB2312_CHARSET: { - static FX_INT32 s_gbCount = sizeof(g_LinuxGbFontList) / sizeof(FX_LPCSTR); - for (FX_INT32 i = 0; i < s_gbCount; i++) + static int32_t s_gbCount = sizeof(g_LinuxGbFontList) / sizeof(FX_LPCSTR); + for (int32_t i = 0; i < s_gbCount; i++) if (m_FontList.Lookup(g_LinuxGbFontList[i], p)) { return p; } } break; case FXFONT_CHINESEBIG5_CHARSET: { - static FX_INT32 s_b5Count = sizeof(g_LinuxB5FontList) / sizeof(FX_LPCSTR); - for (FX_INT32 i = 0; i < s_b5Count; i++) + static int32_t s_b5Count = sizeof(g_LinuxB5FontList) / sizeof(FX_LPCSTR); + for (int32_t i = 0; i < s_b5Count; i++) if (m_FontList.Lookup(g_LinuxB5FontList[i], p)) { return p; } } break; case FXFONT_HANGEUL_CHARSET: { - static FX_INT32 s_hgCount = sizeof(g_LinuxHGFontList) / sizeof(FX_LPCSTR); - for (FX_INT32 i = 0; i < s_hgCount; i++) + static int32_t s_hgCount = sizeof(g_LinuxHGFontList) / sizeof(FX_LPCSTR); + for (int32_t i = 0; i < s_hgCount; i++) if (m_FontList.Lookup(g_LinuxHGFontList[i], p)) { return p; } @@ -157,9 +157,9 @@ static FX_DWORD _LinuxGetCharset(int charset) } return 0; } -static FX_INT32 _LinuxGetSimilarValue(int weight, FX_BOOL bItalic, int pitch_family, FX_DWORD style) +static int32_t _LinuxGetSimilarValue(int weight, FX_BOOL bItalic, int pitch_family, FX_DWORD style) { - FX_INT32 iSimilarValue = 0; + int32_t iSimilarValue = 0; if ((style & FXFONT_BOLD) == (weight > 400)) { iSimilarValue += 16; } @@ -181,7 +181,7 @@ void* CFX_LinuxFontInfo::FindFont(int weight, FX_BOOL bItalic, int charset, int { CFontFaceInfo* pFind = NULL; FX_DWORD charset_flag = _LinuxGetCharset(charset); - FX_INT32 iBestSimilar = 0; + int32_t iBestSimilar = 0; FX_POSITION pos = m_FontList.GetStartPosition(); while (pos) { CFX_ByteString bsName; @@ -190,8 +190,8 @@ void* CFX_LinuxFontInfo::FindFont(int weight, FX_BOOL bItalic, int charset, int if (!(pFont->m_Charsets & charset_flag) && charset != FXFONT_DEFAULT_CHARSET) { continue; } - FX_INT32 iSimilarValue = 0; - FX_INT32 index = bsName.Find(family); + int32_t iSimilarValue = 0; + int32_t index = bsName.Find(family); if (bMatchName && index < 0) { continue; } diff --git a/core/src/fxge/ge/fx_ge_ps.cpp b/core/src/fxge/ge/fx_ge_ps.cpp index e81b6bf362..1829386755 100644 --- a/core/src/fxge/ge/fx_ge_ps.cpp +++ b/core/src/fxge/ge/fx_ge_ps.cpp @@ -93,7 +93,7 @@ void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData, const CFX_AffineM CFX_ByteTextBuf buf; buf.EstimateSize(nPoints * 10); for (int i = 0; i < nPoints; i ++) { - FX_BYTE flag = pPathData->GetFlag(i); + uint8_t flag = pPathData->GetFlag(i); FX_FLOAT x = pPathData->GetPointX(i); FX_FLOAT y = pPathData->GetPointY(i); if (pObject2Device) { @@ -348,7 +348,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, if (pSource->GetBPP() == 1 && pSource->GetPalette() == NULL) { int pitch = (width + 7) / 8; FX_DWORD src_size = height * pitch; - FX_LPBYTE src_buf = FX_Alloc(FX_BYTE, src_size); + FX_LPBYTE src_buf = FX_Alloc(uint8_t, src_size); for (int row = 0; row < height; row ++) { FX_LPCBYTE src_scan = pSource->GetScanline(row); FXSYS_memcpy32(src_buf + row * pitch, src_scan, pitch); @@ -421,7 +421,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, if (filter == NULL) { int src_pitch = width * Bpp; output_size = height * src_pitch; - output_buf = FX_Alloc(FX_BYTE, output_size); + output_buf = FX_Alloc(uint8_t, output_size); for (int row = 0; row < height; row ++) { FX_LPCBYTE src_scan = pConverted->GetScanline(row); FX_LPBYTE dest_scan = output_buf + row * src_pitch; diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp index f6d2fa510f..0d9e985a8e 100644 --- a/core/src/fxge/ge/fx_ge_text.cpp +++ b/core/src/fxge/ge/fx_ge_text.cpp @@ -78,7 +78,7 @@ static void _AdjustGlyphSpace(FXTEXT_GLYPHPOS* pGlyphAndPos, int nChars) next_origin_f = this_origin_f; } } -static const FX_BYTE g_TextGammaAdjust[256] = { +static const uint8_t g_TextGammaAdjust[256] = { 0, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, @@ -97,7 +97,7 @@ static const FX_BYTE g_TextGammaAdjust[256] = { 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 250, 251, 252, 253, 254, 255, }; #define ADJUST_ALPHA(background, foreground, src_alpha, text_flags, a) \ - src_alpha = g_TextGammaAdjust[(FX_BYTE)src_alpha]; + src_alpha = g_TextGammaAdjust[(uint8_t)src_alpha]; void _Color2Argb(FX_ARGB& argb, FX_DWORD color, int alpha_flag, void* pIccTransform) { if (pIccTransform == NULL && !FXGETFLAG_COLORTYPE(alpha_flag)) { @@ -107,7 +107,7 @@ void _Color2Argb(FX_ARGB& argb, FX_DWORD color, int alpha_flag, void* pIccTransf if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { pIccTransform = NULL; } - FX_BYTE bgra[4]; + uint8_t bgra[4]; if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); color = FXGETFLAG_COLORTYPE(alpha_flag) ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); @@ -445,7 +445,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar int src_alpha1 = (src_scan[0] + src_scan[1] + src_scan[2]) / 3; ADJUST_ALPHA(dest_scan[2], r, src_alpha1, nativetext_flags, a); src_alpha1 = src_alpha1 * a / 255; - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha1, r, g, b)); dest_scan += 4; @@ -457,7 +457,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar src_scan += 3; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; + uint8_t dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha1 * 255 / dest_alpha; dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); @@ -492,11 +492,11 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar dest_scan += 4; src_scan += 3; } else { - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha1, r, g, b)); } else { - FX_BYTE dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; + uint8_t dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha1 * 255 / dest_alpha; dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); @@ -530,7 +530,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar int src_alpha1 = (src_scan[-1] + src_scan[0] + src_scan[1]) / 3; ADJUST_ALPHA(dest_scan[2], r, src_alpha1, nativetext_flags, a); src_alpha1 = src_alpha1 * a / 255; - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha1, r, g, b)); dest_scan += 4; @@ -542,7 +542,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar src_scan += 3; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; + uint8_t dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha1 * 255 / dest_alpha; dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); @@ -577,11 +577,11 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar dest_scan += 4; src_scan += 3; } else { - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha1, r, g, b)); } else { - FX_BYTE dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; + uint8_t dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha1 * 255 / dest_alpha; dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); @@ -615,7 +615,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar int src_alpha1 = (src_scan[-2] + src_scan[-1] + src_scan[0]) / 3; ADJUST_ALPHA(dest_scan[2], r, src_alpha1, nativetext_flags, a); src_alpha1 = src_alpha1 * a / 255; - FX_BYTE back_alpha = dest_scan[3]; + uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha1, r, g, b)); dest_scan += 4; @@ -627,7 +627,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar src_scan += 3; continue; } - FX_BYTE dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; + uint8_t dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha1 * 255 / dest_alpha; dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); @@ -1071,14 +1071,14 @@ CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap(CFX_Font* pFont, const CFX_Aff m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); } CFX_GlyphBitmap* pGlyphBitmap = NULL; - if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(FX_UINTPTR)glyph_index, (void*&)pGlyphBitmap)) { + if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(uintptr_t)glyph_index, (void*&)pGlyphBitmap)) { return pGlyphBitmap; } pGlyphBitmap = RenderGlyph(pFont, glyph_index, bFontStyle, pMatrix, dest_width, anti_alias); if (pGlyphBitmap == NULL) { return NULL; } - pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(FX_UINTPTR)glyph_index, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)glyph_index, pGlyphBitmap); return pGlyphBitmap; } const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD glyph_index, FX_BOOL bFontStyle, const CFX_AffineMatrix* pMatrix, @@ -1125,12 +1125,12 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD CFX_GlyphBitmap* pGlyphBitmap; CFX_SizeGlyphCache* pSizeCache = NULL; if (m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) { - if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(FX_UINTPTR)glyph_index, (void*&)pGlyphBitmap)) { + if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(uintptr_t)glyph_index, (void*&)pGlyphBitmap)) { return pGlyphBitmap; } pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_width, anti_alias); if (pGlyphBitmap) { - pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(FX_UINTPTR)glyph_index, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)glyph_index, pGlyphBitmap); return pGlyphBitmap; } } else { @@ -1138,7 +1138,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD if (pGlyphBitmap) { pSizeCache = new CFX_SizeGlyphCache; m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); - pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(FX_UINTPTR)glyph_index, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)glyph_index, pGlyphBitmap); return pGlyphBitmap; } } @@ -1209,7 +1209,7 @@ static const char g_AngleSkew[ANGLESKEW_ARRAY_SIZE] = { 36, 38, 40, 42, 45, 47, 49, 51, 53, 55, }; static const size_t WEIGHTPOW_ARRAY_SIZE = 100; -static const FX_BYTE g_WeightPow[WEIGHTPOW_ARRAY_SIZE] = { +static const uint8_t g_WeightPow[WEIGHTPOW_ARRAY_SIZE] = { 0, 3, 6, 7, 8, 9, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, @@ -1217,7 +1217,7 @@ static const FX_BYTE g_WeightPow[WEIGHTPOW_ARRAY_SIZE] = { 47, 47, 48, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, }; -static const FX_BYTE g_WeightPow_11[WEIGHTPOW_ARRAY_SIZE] = { +static const uint8_t g_WeightPow_11[WEIGHTPOW_ARRAY_SIZE] = { 0, 4, 7, 8, 9, 10, 12, 13, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 39, 39, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 46, @@ -1225,7 +1225,7 @@ static const FX_BYTE g_WeightPow_11[WEIGHTPOW_ARRAY_SIZE] = { 52, 52, 53, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 58, 58, 58, 58, 58, }; -static const FX_BYTE g_WeightPow_SHIFTJIS[WEIGHTPOW_ARRAY_SIZE] = { +static const uint8_t g_WeightPow_SHIFTJIS[WEIGHTPOW_ARRAY_SIZE] = { 0, 0, 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 21, 22, 24, 26, 28, 30, 32, 33, 35, 37, 39, 41, 43, 45, 48, 48, 48, 48, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 55, 55, @@ -1275,7 +1275,7 @@ static void _ContrastAdjust(FX_LPBYTE pDataIn, FX_LPBYTE pDataOut, int nWid, int } else if (temp < 0) { temp = 0; } - *pDstRow ++ = (FX_BYTE)temp; + *pDstRow ++ = (uint8_t)temp; } } } @@ -1365,13 +1365,13 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, FX_DWORD glyph_inde pGlyphBitmap->m_Top = FXFT_Get_Glyph_BitmapTop(m_Face); int dest_pitch = pGlyphBitmap->m_Bitmap.GetPitch(); int src_pitch = FXFT_Get_Bitmap_Pitch(FXFT_Get_Glyph_Bitmap(m_Face)); - FX_BYTE* pDestBuf = pGlyphBitmap->m_Bitmap.GetBuffer(); - FX_BYTE* pSrcBuf = (FX_BYTE*)FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(m_Face)); + uint8_t* pDestBuf = pGlyphBitmap->m_Bitmap.GetBuffer(); + uint8_t* pSrcBuf = (uint8_t*)FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(m_Face)); if (anti_alias != FXFT_RENDER_MODE_MONO && FXFT_Get_Bitmap_PixelMode(FXFT_Get_Glyph_Bitmap(m_Face)) == FXFT_PIXEL_MODE_MONO) { int bytes = anti_alias == FXFT_RENDER_MODE_LCD ? 3 : 1; for(int i = 0; i < bmheight; i++) for(int n = 0; n < bmwidth; n++) { - FX_BYTE data = (pSrcBuf[i * src_pitch + n / 8] & (0x80 >> (n % 8))) ? 255 : 0; + uint8_t data = (pSrcBuf[i * src_pitch + n / 8] & (0x80 >> (n % 8))) ? 255 : 0; for (int b = 0; b < bytes; b ++) { pDestBuf[i * dest_pitch + n * bytes + b] = data; } @@ -1485,11 +1485,11 @@ const CFX_PathData* CFX_FaceCache::LoadGlyphPath(CFX_Font* pFont, FX_DWORD glyph CFX_PathData* pGlyphPath = NULL; FX_LPVOID key; if (pFont->GetSubstFont()) - key = (FX_LPVOID)(FX_UINTPTR)(glyph_index + ((pFont->GetSubstFont()->m_Weight / 16) << 15) + + key = (FX_LPVOID)(uintptr_t)(glyph_index + ((pFont->GetSubstFont()->m_Weight / 16) << 15) + ((pFont->GetSubstFont()->m_ItalicAngle / 2) << 21) + ((dest_width / 16) << 25) + (pFont->IsVertical() << 31)); else { - key = (FX_LPVOID)(FX_UINTPTR)glyph_index; + key = (FX_LPVOID)(uintptr_t)glyph_index; } if (m_PathMap.Lookup(key, (FX_LPVOID&)pGlyphPath)) { return pGlyphPath; diff --git a/core/src/fxge/ge/text_int.h b/core/src/fxge/ge/text_int.h index 34496e8b13..32e1cd53f7 100644 --- a/core/src/fxge/ge/text_int.h +++ b/core/src/fxge/ge/text_int.h @@ -44,7 +44,7 @@ public: FXFT_Face m_pFaces[16]; } m_TTCFace; }; - FX_BYTE* m_pFontData; + uint8_t* m_pFontData; int m_RefCount; }; class CFX_UnicodeEncoding : public IFX_FontEncoding diff --git a/core/src/fxge/skia/fx_skia_blitter_new.cpp b/core/src/fxge/skia/fx_skia_blitter_new.cpp index a107485d72..3b3bd3349c 100644 --- a/core/src/fxge/skia/fx_skia_blitter_new.cpp +++ b/core/src/fxge/skia/fx_skia_blitter_new.cpp @@ -74,13 +74,13 @@ } /*---------------------------------------------------------------------------------------------------*/ void CFX_SkiaRenderer::CompositeSpan1bpp_0(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { ASSERT(!m_bRgbByteOrder); ASSERT(!m_pDevice->IsCmykImage()); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left/8; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left/8; int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -88,7 +88,7 @@ int index = 0; if (m_pDevice->GetPalette() == NULL) - index = ((FX_BYTE)m_Color == 0xff) ? 1 : 0; + index = ((uint8_t)m_Color == 0xff) ? 1 : 0; else { for (int i = 0; i < 2; i ++) if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) @@ -107,14 +107,14 @@ } } void CFX_SkiaRenderer::CompositeSpan1bpp_4(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { ASSERT(!m_bRgbByteOrder); ASSERT(!m_pDevice->IsCmykImage()); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left/8; - clip_scan = (FX_BYTE*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left/8; + clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -122,7 +122,7 @@ int index = 0; if (m_pDevice->GetPalette() == NULL) - index = ((FX_BYTE)m_Color == 0xff) ? 1 : 0; + index = ((uint8_t)m_Color == 0xff) ? 1 : 0; else { for (int i = 0; i < 2; i ++) if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) @@ -143,13 +143,13 @@ } /*-----------------------------------------------------------------------------------------------------*/ void CFX_SkiaRenderer::CompositeSpanGray_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); ASSERT(!m_bRgbByteOrder); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left; int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -165,14 +165,14 @@ } } void CFX_SkiaRenderer::CompositeSpanGray_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); ASSERT(!m_bRgbByteOrder); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left; - ori_scan = (FX_BYTE*)m_pOriDevice->GetScanline(span_top) + span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left; + ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span_left; int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -208,13 +208,13 @@ } void CFX_SkiaRenderer::CompositeSpanGray_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { ASSERT(!m_bRgbByteOrder); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left; - clip_scan = (FX_BYTE*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left; + clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -236,14 +236,14 @@ } void CFX_SkiaRenderer::CompositeSpanGray_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left; - ori_scan = (FX_BYTE*)m_pOriDevice->GetScanline(span_top) + span_left; - clip_scan = (FX_BYTE*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left; + ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span_left; + clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -296,11 +296,11 @@ /*--------------------------------------------------------------------------------------------------*/ void CFX_SkiaRenderer::CompositeSpanARGB_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + (span_left<<2); + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -331,7 +331,7 @@ dest_scan += 2; continue; } - FX_BYTE dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255; + uint8_t dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha*255/dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio); @@ -344,13 +344,13 @@ } void CFX_SkiaRenderer::CompositeSpanARGB_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + (span_left<<2); - //ori_scan = (FX_BYTE*)m_pOriDevice->GetScanline(span_top) + (span_left<<2); + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); + //ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left<<2); int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -393,12 +393,12 @@ } } void CFX_SkiaRenderer::CompositeSpanARGB_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + (span_left<<2); - clip_scan = (FX_BYTE*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); + clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -425,7 +425,7 @@ dest_scan += 2; continue; } - FX_BYTE dest_alpha = dest_scan[3] + src_alpha1 - dest_scan[3] * src_alpha1 / 255; + uint8_t dest_alpha = dest_scan[3] + src_alpha1 - dest_scan[3] * src_alpha1 / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha1*255/dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio); @@ -459,7 +459,7 @@ dest_scan += 2; continue; } - FX_BYTE dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255; + uint8_t dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha*255/dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio); @@ -492,7 +492,7 @@ dest_scan += 2; continue; } - FX_BYTE dest_alpha = dest_scan[3] + src_alpha1 - dest_scan[3] * src_alpha1 / 255; + uint8_t dest_alpha = dest_scan[3] + src_alpha1 - dest_scan[3] * src_alpha1 / 255; dest_scan[3] = dest_alpha; int alpha_ratio = src_alpha1*255/dest_alpha; *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio); @@ -508,14 +508,14 @@ } void CFX_SkiaRenderer::CompositeSpanARGB_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + (span_left<<2); - //ori_scan = (FX_BYTE*)m_pOriDevice->GetScanline(span_top) + (span_left<<2); - clip_scan = (FX_BYTE*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); + //ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left<<2); + clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -558,11 +558,11 @@ /*-----------------------------------------------------------------------------------------------------------*/ void CFX_SkiaRenderer::CompositeSpanRGB32_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + (span_left<<2); + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -589,12 +589,12 @@ } } void CFX_SkiaRenderer::CompositeSpanRGB32_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + (span_left<<2); - ori_scan = (FX_BYTE*)m_pOriDevice->GetScanline(span_top) + (span_left<<2); + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); + ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left<<2); int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -628,12 +628,12 @@ } } void CFX_SkiaRenderer::CompositeSpanRGB32_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + (span_left<<2); - clip_scan = (FX_BYTE*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); + clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -706,14 +706,14 @@ #endif } void CFX_SkiaRenderer::CompositeSpanRGB32_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + (span_left<<2); - ori_scan = (FX_BYTE*)m_pOriDevice->GetScanline(span_top) + (span_left<<2); - clip_scan = (FX_BYTE*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); + ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left<<2); + clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -785,11 +785,11 @@ } /*-----------------------------------------------------------------------------------------------------*/ void CFX_SkiaRenderer::CompositeSpanRGB24_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left + (span_left<<1); + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left + (span_left<<1); int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -819,13 +819,13 @@ } } void CFX_SkiaRenderer::CompositeSpanRGB24_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left + (span_left<<1); - ori_scan = (FX_BYTE*)m_pOriDevice->GetScanline(span_top) + span_left + (span_left<<1); + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left + (span_left<<1); + ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span_left + (span_left<<1); int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -860,12 +860,12 @@ } } void CFX_SkiaRenderer::CompositeSpanRGB24_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1); - clip_scan = (FX_BYTE*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1); + clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -940,14 +940,14 @@ #endif } void CFX_SkiaRenderer::CompositeSpanRGB24_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1); - ori_scan = (FX_BYTE*)m_pOriDevice->GetScanline(span_top) + span_left+(span_left<<1); - clip_scan = (FX_BYTE*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1); + ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span_left+(span_left<<1); + clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -1018,12 +1018,12 @@ #endif } void CFX_SkiaRenderer::CompositeSpanRGB24_10(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1); - dest_extra_alpha_scan = (FX_BYTE*)m_pDevice->m_pAlphaMask->GetScanline(span_top)+span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1); + dest_extra_alpha_scan = (uint8_t*)m_pDevice->m_pAlphaMask->GetScanline(span_top)+span_left; int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -1031,9 +1031,9 @@ #if 1 if (m_Alpha == 255 && cover_scan == 255) { for (int col = col_start; col < col_end; col ++) { - *dest_scan++ = (FX_BYTE)m_Blue; - *dest_scan++ = (FX_BYTE)m_Green; - *dest_scan++ = (FX_BYTE)m_Red; + *dest_scan++ = (uint8_t)m_Blue; + *dest_scan++ = (uint8_t)m_Green; + *dest_scan++ = (uint8_t)m_Red; *dest_extra_alpha_scan++ = 255; } return; @@ -1042,7 +1042,7 @@ for (int col = col_start; col < col_end; col ++) { // Dest format: Rgba // calculate destination alpha (it's union of source and dest alpha) - FX_BYTE dest_alpha = (*dest_extra_alpha_scan) + src_alpha - + uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha - (*dest_extra_alpha_scan) * src_alpha / 255; *dest_extra_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha*255/dest_alpha; @@ -1057,9 +1057,9 @@ if (m_bFullCover) { if (m_Alpha == 255) { for (int col = col_start; col < col_end; col ++) { - *dest_scan++ = (FX_BYTE)m_Blue; - *dest_scan++ = (FX_BYTE)m_Green; - *dest_scan++ = (FX_BYTE)m_Red; + *dest_scan++ = (uint8_t)m_Blue; + *dest_scan++ = (uint8_t)m_Green; + *dest_scan++ = (uint8_t)m_Red; *dest_extra_alpha_scan++ = 255; } return; @@ -1067,7 +1067,7 @@ for (int col = col_start; col < col_end; col ++) { // Dest format: Rgba // calculate destination alpha (it's union of source and dest alpha) - FX_BYTE dest_alpha = (*dest_extra_alpha_scan) + m_Alpha - + uint8_t dest_alpha = (*dest_extra_alpha_scan) + m_Alpha - (*dest_extra_alpha_scan) * m_Alpha / 255; *dest_extra_alpha_scan++ = dest_alpha; int alpha_ratio = m_Alpha*255/dest_alpha; @@ -1081,9 +1081,9 @@ } else { if (m_Alpha == 255 && cover_scan == 255) { for (int col = col_start; col < col_end; col ++) { - *dest_scan++ = (FX_BYTE)m_Blue; - *dest_scan++ = (FX_BYTE)m_Green; - *dest_scan++ = (FX_BYTE)m_Red; + *dest_scan++ = (uint8_t)m_Blue; + *dest_scan++ = (uint8_t)m_Green; + *dest_scan++ = (uint8_t)m_Red; *dest_extra_alpha_scan++ = 255; } return; @@ -1092,7 +1092,7 @@ for (int col = col_start; col < col_end; col ++) { // Dest format: Rgba // calculate destination alpha (it's union of source and dest alpha) - FX_BYTE dest_alpha = (*dest_extra_alpha_scan) + src_alpha - + uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha - (*dest_extra_alpha_scan) * src_alpha / 255; *dest_extra_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha*255/dest_alpha; @@ -1107,13 +1107,13 @@ #endif } void CFX_SkiaRenderer::CompositeSpanRGB24_14(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { - dest_scan = (FX_BYTE*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1); - dest_extra_alpha_scan = (FX_BYTE*)m_pDevice->m_pAlphaMask->GetScanline(span_top)+span_left; - clip_scan = (FX_BYTE*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; + dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1); + dest_extra_alpha_scan = (uint8_t*)m_pDevice->m_pAlphaMask->GetScanline(span_top)+span_left; + clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left; int col_start = span_left < clip_left ? clip_left - span_left : 0; int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); if (col_end < col_start) return; // do nothing. @@ -1128,14 +1128,14 @@ continue; } if (src_alpha1 == 255) { - *dest_scan++ = (FX_BYTE)m_Blue; - *dest_scan++ = (FX_BYTE)m_Green; - *dest_scan++ = (FX_BYTE)m_Red; - *dest_extra_alpha_scan++ = (FX_BYTE)m_Alpha; + *dest_scan++ = (uint8_t)m_Blue; + *dest_scan++ = (uint8_t)m_Green; + *dest_scan++ = (uint8_t)m_Red; + *dest_extra_alpha_scan++ = (uint8_t)m_Alpha; } else { // Dest format: Rgba // calculate destination alpha (it's union of source and dest alpha) - FX_BYTE dest_alpha = (*dest_extra_alpha_scan) + src_alpha1 - + uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha1 - (*dest_extra_alpha_scan) * src_alpha1 / 255; *dest_extra_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha1*255/dest_alpha; @@ -1157,14 +1157,14 @@ continue; } if (src_alpha == 255) { - *dest_scan++ = (FX_BYTE)m_Blue; - *dest_scan++ = (FX_BYTE)m_Green; - *dest_scan++ = (FX_BYTE)m_Red; - *dest_extra_alpha_scan++ = (FX_BYTE)m_Alpha; + *dest_scan++ = (uint8_t)m_Blue; + *dest_scan++ = (uint8_t)m_Green; + *dest_scan++ = (uint8_t)m_Red; + *dest_extra_alpha_scan++ = (uint8_t)m_Alpha; } else { // Dest format: Rgba // calculate destination alpha (it's union of source and dest alpha) - FX_BYTE dest_alpha = (*dest_extra_alpha_scan) + src_alpha - + uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha - (*dest_extra_alpha_scan) * src_alpha / 255; *dest_extra_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha*255/dest_alpha; @@ -1186,14 +1186,14 @@ continue; } if (src_alpha1 == 255) { - *dest_scan++ = (FX_BYTE)m_Blue; - *dest_scan++ = (FX_BYTE)m_Green; - *dest_scan++ = (FX_BYTE)m_Red; - *dest_extra_alpha_scan++ = (FX_BYTE)m_Alpha; + *dest_scan++ = (uint8_t)m_Blue; + *dest_scan++ = (uint8_t)m_Green; + *dest_scan++ = (uint8_t)m_Red; + *dest_extra_alpha_scan++ = (uint8_t)m_Alpha; } else { // Dest format: Rgba // calculate destination alpha (it's union of source and dest alpha) - FX_BYTE dest_alpha = (*dest_extra_alpha_scan) + src_alpha1 - + uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha1 - (*dest_extra_alpha_scan) * src_alpha1 / 255; *dest_extra_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha1*255/dest_alpha; @@ -1212,7 +1212,7 @@ // A general alpha merge function (with clipping mask). Cmyka/Cmyk device. void CFX_SkiaRenderer::CompositeSpanCMYK(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan) { @@ -1243,11 +1243,11 @@ if (src_alpha) { if (src_alpha == 255) { *(FX_CMYK*)dest_scan = m_Color; - *dest_extra_alpha_scan = (FX_BYTE)m_Alpha; + *dest_extra_alpha_scan = (uint8_t)m_Alpha; } else { // Dest format: Cmyka // calculate destination alpha (it's union of source and dest alpha) - FX_BYTE dest_alpha = (*dest_extra_alpha_scan) + src_alpha - + uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha - (*dest_extra_alpha_scan) * src_alpha / 255; *dest_extra_alpha_scan++ = dest_alpha; int alpha_ratio = src_alpha*255/dest_alpha; @@ -1351,13 +1351,13 @@ } else { //Gray(a) device if (pIccTransform) { - FX_BYTE gray; + uint8_t gray; color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); pIccModule->TranslateScanline(pIccTransform, &gray, (FX_LPCBYTE)&color, 1); m_Gray = gray; } else { if (bObjectCMYK) { - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), FXSYS_GetYValue(color), FXSYS_GetKValue(color), r, g, b); m_Gray = FXRGB2GRAY(r, g, b); @@ -1404,7 +1404,7 @@ } } else { if (bObjectCMYK) { - FX_BYTE r, g, b; + uint8_t r, g, b; AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), FXSYS_GetYValue(color), FXSYS_GetKValue(color), r, g, b); m_Color = FXARGB_MAKE(m_Alpha, r, g, b); @@ -1552,7 +1552,7 @@ col_end = col_end < m_dstWidth ? col_end - m_Left: m_pDevice->GetWidth(); int result = col_end - col_start; if (result > 0) { - FX_BYTE* dest_pos = dest_scan + col_start; + uint8_t* dest_pos = dest_scan + col_start; if (result >= 4) FXSYS_memset32(dest_pos, 0xffffffff,result); else diff --git a/core/src/fxge/skia/fx_skia_blitter_new.h b/core/src/fxge/skia/fx_skia_blitter_new.h index 1193e64c1c..a80e56b2aa 100644 --- a/core/src/fxge/skia/fx_skia_blitter_new.h +++ b/core/src/fxge/skia/fx_skia_blitter_new.h @@ -30,7 +30,7 @@ protected: FX_LPBYTE m_pOriScan; FX_LPBYTE m_pClipScan; - void (CFX_SkiaRenderer::*composite_span)(FX_LPBYTE,FX_LPBYTE,int,int,int,int,FX_BYTE,int,int,int,FX_LPBYTE,FX_LPBYTE); + void (CFX_SkiaRenderer::*composite_span)(FX_LPBYTE,FX_LPBYTE,int,int,int,int,uint8_t,int,int,int,FX_LPBYTE,FX_LPBYTE); public: //-------------------------------------------------------------------- @@ -43,35 +43,35 @@ public: /*------------------------------------------------------------------------------------------------------*/ // A general alpha merge function (with clipping mask). Gray device. void CompositeSpan1bpp_0(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpan1bpp_1(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpan1bpp_4(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpan1bpp_5(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpan1bpp_8(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpan1bpp_9(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpan1bpp_12(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpan1bpp_13(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); @@ -79,119 +79,119 @@ public: // A general alpha merge function (with clipping mask). Gray device. void CompositeSpanGray_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpanGray_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpanGray_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpanGray_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpanGray_10(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpanGray_11(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpanGray_14(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpanGray_15(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); /*--------------------------------------------------------------------------------------------------------*/ void CompositeSpanARGB_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpanARGB_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpanARGB_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpanARGB_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); // ... /*--------------------------------------------------------------------------------------------------------*/ void CompositeSpanRGB32_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpanRGB32_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpanRGB32_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpanRGB32_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); /*---------------------------------------------------------------------------------------------------------*/ void CompositeSpanRGB24_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpanRGB24_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpanRGB24_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpanRGB24_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpanRGB24_10(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpanRGB24_11(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpanRGB24_14(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); void CompositeSpanRGB24_15(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); @@ -199,7 +199,7 @@ public: // A general alpha merge function (with clipping mask). Cmyka/Cmyk device. void CompositeSpanCMYK(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, - int span_left, int span_len, int span_top, FX_BYTE cover_scan, + int span_left, int span_len, int span_top, uint8_t cover_scan, int clip_top, int clip_left, int clip_right, FX_LPBYTE clip_scan, FX_LPBYTE dest_extra_alpha_scan); diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp index 4bef988885..d2d83dea75 100644 --- a/core/src/fxge/win32/fx_win32_device.cpp +++ b/core/src/fxge/win32/fx_win32_device.cpp @@ -64,9 +64,9 @@ FX_BOOL CWin32FontInfo::IsOpenTypeFromDiv(const LOGFONTA *plf) FX_DWORD font_size = GetFontData(hFont, 0, NULL, 0); if (font_size != GDI_ERROR && font_size >= sizeof(FX_DWORD)) { FX_DWORD lVersion = 0; - GetFontData(hFont, 0, (FX_BYTE*)(&lVersion), sizeof(FX_DWORD)); - lVersion = (((FX_DWORD)(FX_BYTE)(lVersion)) << 24) | ((FX_DWORD)((FX_BYTE)(lVersion >> 8))) << 16 | - ((FX_DWORD)((FX_BYTE)(lVersion >> 16))) << 8 | ((FX_BYTE)(lVersion >> 24)); + GetFontData(hFont, 0, (uint8_t*)(&lVersion), sizeof(FX_DWORD)); + lVersion = (((FX_DWORD)(uint8_t)(lVersion)) << 24) | ((FX_DWORD)((uint8_t)(lVersion >> 8))) << 16 | + ((FX_DWORD)((uint8_t)(lVersion >> 16))) << 8 | ((uint8_t)(lVersion >> 24)); if (lVersion == TT_MAKE_TAG('O', 'T', 'T', 'O') || lVersion == 0x00010000 || lVersion == TT_MAKE_TAG('t', 't', 'c', 'f') || @@ -85,9 +85,9 @@ FX_BOOL CWin32FontInfo::IsSupportFontFormDiv(const LOGFONTA* plf) FX_DWORD font_size = GetFontData(hFont, 0, NULL, 0); if (font_size != GDI_ERROR && font_size >= sizeof(FX_DWORD)) { FX_DWORD lVersion = 0; - GetFontData(hFont, 0, (FX_BYTE*)(&lVersion), sizeof(FX_DWORD)); - lVersion = (((FX_DWORD)(FX_BYTE)(lVersion)) << 24) | ((FX_DWORD)((FX_BYTE)(lVersion >> 8))) << 16 | - ((FX_DWORD)((FX_BYTE)(lVersion >> 16))) << 8 | ((FX_BYTE)(lVersion >> 24)); + GetFontData(hFont, 0, (uint8_t*)(&lVersion), sizeof(FX_DWORD)); + lVersion = (((FX_DWORD)(uint8_t)(lVersion)) << 24) | ((FX_DWORD)((uint8_t)(lVersion >> 8))) << 16 | + ((FX_DWORD)((uint8_t)(lVersion >> 16))) << 8 | ((uint8_t)(lVersion >> 24)); if (lVersion == TT_MAKE_TAG('O', 'T', 'T', 'O') || lVersion == 0x00010000 || lVersion == TT_MAKE_TAG('t', 't', 'c', 'f') || @@ -145,7 +145,7 @@ FX_BOOL CWin32FontInfo::EnumFontList(CFX_FontMapper* pMapper) lf.lfCharSet = DEFAULT_CHARSET; lf.lfFaceName[0] = 0; lf.lfPitchAndFamily = 0; - EnumFontFamiliesExA(m_hDC, &lf, (FONTENUMPROCA)FontEnumProc, (FX_UINTPTR)this, 0); + EnumFontFamiliesExA(m_hDC, &lf, (FONTENUMPROCA)FontEnumProc, (uintptr_t)this, 0); if (pMapper->GetFontEnumerator()) { pMapper->GetFontEnumerator()->Finish(); } @@ -518,7 +518,7 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(const CFX_DIBitmap* pBitmap1, int de return FALSE; } CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); - if ((FX_INT64)abs(dest_width) * abs(dest_height) < (FX_INT64)pBitmap1->GetWidth() * pBitmap1->GetHeight() * 4 || + if ((int64_t)abs(dest_width) * abs(dest_height) < (int64_t)pBitmap1->GetWidth() * pBitmap1->GetHeight() * 4 || (flags & FXDIB_INTERPOL) || (flags & FXDIB_BICUBIC_INTERPOL)) { SetStretchBltMode(m_hDC, HALFTONE); } else { @@ -526,7 +526,7 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(const CFX_DIBitmap* pBitmap1, int de } CFX_DIBitmap* pToStrechBitmap = pBitmap; bool del = false; - if (m_DeviceClass == FXDC_PRINTER && ((FX_INT64)pBitmap->GetWidth() * pBitmap->GetHeight() > (FX_INT64)abs(dest_width) * abs(dest_height))) { + if (m_DeviceClass == FXDC_PRINTER && ((int64_t)pBitmap->GetWidth() * pBitmap->GetHeight() > (int64_t)abs(dest_width) * abs(dest_height))) { pToStrechBitmap = pBitmap->StretchTo(dest_width, dest_height); del = true; } diff --git a/core/src/fxge/win32/fx_win32_dib.cpp b/core/src/fxge/win32/fx_win32_dib.cpp index 47da880680..659e602e1a 100644 --- a/core/src/fxge/win32/fx_win32_dib.cpp +++ b/core/src/fxge/win32/fx_win32_dib.cpp @@ -68,7 +68,7 @@ CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, LPVOID pData, FX_BOOL } FXSYS_memcpy32(pBitmap->GetBuffer(), pData, pitch * height); if (bBottomUp) { - FX_LPBYTE temp_buf = FX_Alloc(FX_BYTE, pitch); + FX_LPBYTE temp_buf = FX_Alloc(uint8_t, pitch); int top = 0, bottom = height - 1; while (top < bottom) { FXSYS_memcpy32(temp_buf, pBitmap->GetBuffer() + top * pitch, pitch); @@ -196,7 +196,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC, HBITMAP hBitmap, FX_DWORD* pP if (bmih.biBitCount == 8) { size += sizeof (FX_DWORD) * 254; } - BITMAPINFO* pbmih = (BITMAPINFO*)FX_Alloc(FX_BYTE, size); + BITMAPINFO* pbmih = (BITMAPINFO*)FX_Alloc(uint8_t, size); pbmih->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); pbmih->bmiHeader.biBitCount = bmih.biBitCount; pbmih->bmiHeader.biCompression = BI_RGB; @@ -232,7 +232,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC, HBITMAP hBitmap, FX_DWORD* pP if (ret != 0 && bmih.biBitCount == 32) { int pitch = pDIBitmap->GetPitch(); for (int row = 0; row < height; row ++) { - FX_BYTE* dest_scan = (FX_BYTE*)(pDIBitmap->GetBuffer() + row * pitch); + uint8_t* dest_scan = (uint8_t*)(pDIBitmap->GetBuffer() + row * pitch); for (int col = 0; col < width; col++) { dest_scan[3] = 255; dest_scan += 4; diff --git a/core/src/fxge/win32/fx_win32_dwrite.cpp b/core/src/fxge/win32/fx_win32_dwrite.cpp index 0849583384..e2951e4d07 100644 --- a/core/src/fxge/win32/fx_win32_dwrite.cpp +++ b/core/src/fxge/win32/fx_win32_dwrite.cpp @@ -310,7 +310,7 @@ HRESULT STDMETHODCALLTYPE CDwFontFileStream::ReadFileFragment( { if (fileOffset <= resourceSize_ && fragmentSize <= resourceSize_ - fileOffset) { - *fragmentStart = static_cast(resourcePtr_) + static_cast(fileOffset); + *fragmentStart = static_cast(resourcePtr_) + static_cast(fileOffset); *fragmentContext = NULL; return S_OK; } else { diff --git a/core/src/fxge/win32/fx_win32_gdipext.cpp b/core/src/fxge/win32/fx_win32_gdipext.cpp index e36d283115..944266c1c9 100644 --- a/core/src/fxge/win32/fx_win32_gdipext.cpp +++ b/core/src/fxge/win32/fx_win32_gdipext.cpp @@ -220,7 +220,7 @@ typedef GpStatus (WINGDIPAPI *FuncType_GdipSetImagePalette)(GpImage *image, GDIP typedef GpStatus (WINGDIPAPI *FuncType_GdipSetInterpolationMode)(GpGraphics *graphics, InterpolationMode interpolationMode); typedef GpStatus (WINGDIPAPI *FuncType_GdipDrawImagePointsI)(GpGraphics *graphics, GpImage *image, GDIPCONST GpPoint *dstpoints, INT count); typedef GpStatus (WINGDIPAPI *FuncType_GdipCreateBitmapFromGdiDib)(GDIPCONST BITMAPINFO* gdiBitmapInfo, VOID* gdiBitmapData, GpBitmap** bitmap); -typedef Status (WINAPI *FuncType_GdiplusStartup)(OUT FX_UINTPTR *token, const GdiplusStartupInput *input, OUT GdiplusStartupOutput *output); +typedef Status (WINAPI *FuncType_GdiplusStartup)(OUT uintptr_t *token, const GdiplusStartupInput *input, OUT GdiplusStartupOutput *output); typedef GpStatus (WINGDIPAPI *FuncType_GdipDrawLineI)(GpGraphics *graphics, GpPen *pen, int x1, int y1, int x2, int y2); typedef GpStatus (WINGDIPAPI *FuncType_GdipResetClip)(GpGraphics *graphics); typedef GpStatus (WINGDIPAPI *FuncType_GdipCreatePath)(GpFillMode brushMode, GpPath **path); @@ -506,7 +506,7 @@ void CGdiplusExt::Load() return; } } - FX_UINTPTR gdiplusToken; + uintptr_t gdiplusToken; GdiplusStartupInput gdiplusStartupInput; ((FuncType_GdiplusStartup)m_Functions[FuncId_GdiplusStartup])(&gdiplusToken, &gdiplusStartupInput, NULL); m_GdiModule = LoadLibraryA("GDI32.DLL"); @@ -1044,7 +1044,7 @@ public: bytes_left = m_InterStream.GetLength() - m_ReadPos; bytes_out = FX_MIN(cb, bytes_left); FXSYS_memcpy32(Output, m_InterStream.GetBuffer() + m_ReadPos, bytes_out); - m_ReadPos += (FX_INT32)bytes_out; + m_ReadPos += (int32_t)bytes_out; if (pcbRead != NULL) { *pcbRead = (ULONG)bytes_out; } diff --git a/core/src/fxge/win32/fx_win32_print.cpp b/core/src/fxge/win32/fx_win32_print.cpp index d6a44b490f..7740fbd87a 100644 --- a/core/src/fxge/win32/fx_win32_print.cpp +++ b/core/src/fxge/win32/fx_win32_print.cpp @@ -294,7 +294,7 @@ FX_BOOL CPSPrinterDriver::Init(HDC hDC, int pslevel, FX_BOOL bCmykOutput) if (ret == 1) { ret = ::GetRegionData(hRgn, 0, NULL); if (ret) { - RGNDATA* pData = (RGNDATA*)FX_Alloc(FX_BYTE, ret); + RGNDATA* pData = (RGNDATA*)FX_Alloc(uint8_t, ret); ret = ::GetRegionData(hRgn, ret, pData); if (ret) { CFX_PathData path; diff --git a/core/src/fxge/win32/win32_int.h b/core/src/fxge/win32/win32_int.h index 7c5c0720b1..a3380f3b5b 100644 --- a/core/src/fxge/win32/win32_int.h +++ b/core/src/fxge/win32/win32_int.h @@ -29,7 +29,7 @@ public: int fill_mode ); - void* LoadMemFont(FX_BYTE* pData, FX_DWORD size); + void* LoadMemFont(uint8_t* pData, FX_DWORD size); void DeleteMemFont(void* pFontCollection); FX_BOOL GdipCreateFromImage(void* bitmap, void** graphics); void GdipDeleteGraphics(void* graphics); diff --git a/core/src/reflow/autoreflow.cpp b/core/src/reflow/autoreflow.cpp index a10175525c..a5285f375c 100644 --- a/core/src/reflow/autoreflow.cpp +++ b/core/src/reflow/autoreflow.cpp @@ -415,7 +415,7 @@ void CPDF_AutoReflowLayoutProvider::GenerateParagraph(CFX_PtrArray& cellArray) void CPDF_AutoReflowLayoutProvider::ProcessObj(CFX_PtrArray& cellArray, CPDF_PageObject* pObj, CFX_AffineMatrix matrix) { } -FX_INT32 CPDF_AutoReflowLayoutProvider::LogicPreObj(CPDF_PageObject* pObj) +int32_t CPDF_AutoReflowLayoutProvider::LogicPreObj(CPDF_PageObject* pObj) { CPDF_PageObject* pPreObj = m_pPreObj; m_pPreObj = pObj; diff --git a/core/src/reflow/autoreflow.h b/core/src/reflow/autoreflow.h index 95aebcfcdc..20babd72da 100644 --- a/core/src/reflow/autoreflow.h +++ b/core/src/reflow/autoreflow.h @@ -105,7 +105,7 @@ public: int GetRectHeight(FX_RECT rect); int GetRectWidth(FX_RECT rect); void ProcessObj(CFX_PtrArray& cellArray, CPDF_PageObject* pObj, CFX_AffineMatrix matrix); - FX_INT32 LogicPreObj(CPDF_PageObject* pObj); + int32_t LogicPreObj(CPDF_PageObject* pObj); CPDF_AutoReflowElement* m_pRoot; CPDF_AutoReflowElement* m_pCurrElm; diff --git a/core/src/reflow/layoutprocessor_reflow.cpp b/core/src/reflow/layoutprocessor_reflow.cpp index 218d301f0f..7e9ff42137 100644 --- a/core/src/reflow/layoutprocessor_reflow.cpp +++ b/core/src/reflow/layoutprocessor_reflow.cpp @@ -404,10 +404,10 @@ FX_BOOL IsSameLine(FX_BOOL bHorizontal, CFX_FloatRect Rect1, CFX_FloatRect Rect2 } return TRUE; } -FX_INT32 IsCanMergeParagraph(IPDF_LayoutElement* pPrevElement, IPDF_LayoutElement* pNextElement) +int32_t IsCanMergeParagraph(IPDF_LayoutElement* pPrevElement, IPDF_LayoutElement* pNextElement) { - FX_INT32 analogial = 100; - FX_INT32 nPrevObj = pPrevElement->CountObjects(), i; + int32_t analogial = 100; + int32_t nPrevObj = pPrevElement->CountObjects(), i; CPDF_PageObject* pPrevObj = NULL; CFX_FloatRect prevRect, rect; CFX_PtrArray prevLine, line; @@ -446,7 +446,7 @@ FX_INT32 IsCanMergeParagraph(IPDF_LayoutElement* pPrevElement, IPDF_LayoutElemen CPDF_PageObject* pObj = pPrevElement->GetObject(nPrevObj - 1); if(pObj->m_Type == PDFPAGE_TEXT) { CPDF_TextObject* pText = (CPDF_TextObject*)pObj; - FX_INT32 nItem = pText->CountItems(); + int32_t nItem = pText->CountItems(); CPDF_TextObjectItem item; pText->GetItemInfo(nItem - 1, &item); CFX_WideString wStr = pText->GetFont()->UnicodeFromCharCode(item.m_CharCode); @@ -468,7 +468,7 @@ FX_INT32 IsCanMergeParagraph(IPDF_LayoutElement* pPrevElement, IPDF_LayoutElemen prevLine.RemoveAll(); prevLine.Append(line); line.RemoveAll(); - FX_INT32 nNextObj = pNextElement->CountObjects(); + int32_t nNextObj = pNextElement->CountObjects(); pPrevObj = NULL; FX_BOOL bFirst = TRUE; for(i = 0; i < nNextObj; i++) { @@ -519,7 +519,7 @@ void CPDF_LayoutProcessor_Reflow::ProcessElement(IPDF_LayoutElement* pElement, F } if(m_Status == LayoutReady) { LayoutType layoutType = pElement->GetType(); - FX_INT32 ElementType = GetElementTypes(layoutType); + int32_t ElementType = GetElementTypes(layoutType); switch(ElementType) { case SST_IE: m_bIllustration = TRUE; @@ -639,7 +639,7 @@ void CPDF_LayoutProcessor_Reflow::ProcessElement(IPDF_LayoutElement* pElement, F if(m_Status == LayoutReady) { FX_FLOAT dx = 0; LayoutType layoutType = pElement->GetType(); - FX_INT32 ElementType = GetElementTypes(layoutType); + int32_t ElementType = GetElementTypes(layoutType); switch(ElementType) { case SST_IE: m_bIllustration = FALSE; @@ -705,7 +705,7 @@ void CPDF_LayoutProcessor_Reflow::ProcessElement(IPDF_LayoutElement* pElement, F m_PausePosition = 100; } } -FX_INT32 CPDF_LayoutProcessor_Reflow::GetElementTypes(LayoutType layoutType) +int32_t CPDF_LayoutProcessor_Reflow::GetElementTypes(LayoutType layoutType) { switch(layoutType) { case LayoutParagraph: @@ -1201,7 +1201,7 @@ int CPDF_LayoutProcessor_Reflow::ProcessInsertObject(CPDF_TextObject* pObj, CFX_ } return 0; } -FX_INT32 CPDF_LayoutProcessor_Reflow::LogicPreObj(CPDF_TextObject* pObj) +int32_t CPDF_LayoutProcessor_Reflow::LogicPreObj(CPDF_TextObject* pObj) { CPDF_TextObject* pPreObj = m_pPreObj; m_pPreObj = pObj; @@ -1338,7 +1338,7 @@ void CPDF_LayoutProcessor_Reflow::ProcessTextObject(CPDF_TextObject *pTextObj, F return; } CPDF_PageObject* pPreObj = m_pPreObj; - FX_INT32 logic = ProcessInsertObject(pTextObj, objMatrix); + int32_t logic = ProcessInsertObject(pTextObj, objMatrix); m_pPreObj = pTextObj; m_perMatrix.Copy(objMatrix); int size = m_pTempLine->GetSize(); @@ -1533,7 +1533,7 @@ void CPDF_LayoutProcessor_Reflow::ProcessUnitaryObjs(CPDF_PageObjects *pObjs, FX while(pos) { CPDF_PageObject* pObj = pObjs->GetNextObject(pos); if(pObj->m_Type == PDFPAGE_TEXT) { - FX_INT32 ret = LogicPreObj((CPDF_TextObject*)pObj); + int32_t ret = LogicPreObj((CPDF_TextObject*)pObj); if(ret == 1 || ret == 2) { continue; } diff --git a/core/src/reflow/reflowedpage.cpp b/core/src/reflow/reflowedpage.cpp index ba2667f074..1c78e75cbc 100644 --- a/core/src/reflow/reflowedpage.cpp +++ b/core/src/reflow/reflowedpage.cpp @@ -148,14 +148,14 @@ CPDF_Dictionary* CPDF_ReflowedPage::GetFormResDict(CPDF_PageObject* pObj) } return pPageInfo->GetFormDict(); } -void CPDF_ReflowedPage::GetDisplayMatrix(CFX_AffineMatrix& matrix, FX_INT32 xPos, FX_INT32 yPos, FX_INT32 xSize, FX_INT32 ySize, FX_INT32 iRotate, const CFX_AffineMatrix* pPageMatrix) +void CPDF_ReflowedPage::GetDisplayMatrix(CFX_AffineMatrix& matrix, int32_t xPos, int32_t yPos, int32_t xSize, int32_t ySize, int32_t iRotate, const CFX_AffineMatrix* pPageMatrix) { CFX_AffineMatrix display_matrix; if(m_PageHeight == 0) { matrix.Set(1, 0, 0, -1, 0, 0); return; } - FX_INT32 x0, y0, x1, y1, x2, y2; + int32_t x0, y0, x1, y1, x2, y2; iRotate %= 4; switch (iRotate) { case 0: @@ -204,7 +204,7 @@ FX_FLOAT CPDF_ReflowedPage::GetPageHeight() { return m_PageHeight; } -void CPDF_ReflowedPage::FocusGetData(const CFX_AffineMatrix matrix, FX_INT32 x, FX_INT32 y, CFX_ByteString& str) +void CPDF_ReflowedPage::FocusGetData(const CFX_AffineMatrix matrix, int32_t x, int32_t y, CFX_ByteString& str) { if (NULL == m_pReflowed) { return; @@ -215,8 +215,8 @@ void CPDF_ReflowedPage::FocusGetData(const CFX_AffineMatrix matrix, FX_INT32 x, revMatrix.Transform((float)x, (float)y, x1, y1); int count = m_pReflowed->GetSize(); FX_FLOAT dx = 1000, dy = 1000; - FX_INT32 pos = 0; - FX_INT32 i; + int32_t pos = 0; + int32_t i; for(i = 0; i < count; i++) { CRF_Data* pData = (*m_pReflowed)[i]; FX_FLOAT tempdy = FXSYS_fabs(pData->m_PosY - y1); @@ -263,12 +263,12 @@ void CPDF_ReflowedPage::FocusGetData(const CFX_AffineMatrix matrix, FX_INT32 x, } str.Format("%d", pos); } -FX_BOOL CPDF_ReflowedPage::FocusGetPosition(const CFX_AffineMatrix matrix, CFX_ByteString str, FX_INT32& x, FX_INT32& y) +FX_BOOL CPDF_ReflowedPage::FocusGetPosition(const CFX_AffineMatrix matrix, CFX_ByteString str, int32_t& x, int32_t& y) { if (NULL == m_pReflowed) { return FALSE; } - FX_INT32 pos = FXSYS_atoi(str); + int32_t pos = FXSYS_atoi(str); if(pos < 0 || pos >= m_pReflowed->GetSize()) { return FALSE; } @@ -423,7 +423,7 @@ CPDF_ProgressiveReflowPageRender::CPDF_ProgressiveReflowPageRender() m_pFontEncoding = NULL; m_DisplayColor = -1; } -static FX_FLOAT _CIDTransformToFloat(FX_BYTE ch) +static FX_FLOAT _CIDTransformToFloat(uint8_t ch) { if (ch < 128) { return ch * 1.0f / 127; diff --git a/core/src/reflow/reflowedpage.h b/core/src/reflow/reflowedpage.h index 3fef553d7a..79b4937bdb 100644 --- a/core/src/reflow/reflowedpage.h +++ b/core/src/reflow/reflowedpage.h @@ -48,14 +48,14 @@ protected: void ProcessTextObject(CPDF_TextObject *pObj, FX_FLOAT reflowWidth, CFX_AffineMatrix objMatrix); void ProcessPathObject(CPDF_PathObject *pObj, FX_FLOAT reflowWidth); void ProcessUnitaryObjs(CPDF_PageObjects *pObjs, FX_FLOAT reflowWidth, CFX_AffineMatrix objMatrix); - FX_INT32 LogicPreObj(CPDF_TextObject* pObj); + int32_t LogicPreObj(CPDF_TextObject* pObj); int ProcessInsertObject(CPDF_TextObject* pObj, CFX_AffineMatrix formMatrix); FX_WCHAR GetPreChar(); FX_BOOL IsSameTextObject(CPDF_TextObject* pTextObj1, CPDF_TextObject* pTextObj2); int GetCharWidth(FX_DWORD charCode, CPDF_Font* pFont) const; FX_BOOL IsCanBreakAfter(FX_DWORD unicode); FX_BOOL IsCanBreakBefore(FX_DWORD unicode); - FX_INT32 GetElementTypes(LayoutType layoutType); + int32_t GetElementTypes(LayoutType layoutType); void CreateRFData(CPDF_PageObject* pObj, CFX_AffineMatrix* pMatrix = NULL); CRF_CharState* GetCharState(CPDF_TextObject* pObj, CPDF_Font* pFont, FX_FLOAT fHeight, FX_ARGB color); FX_FLOAT ConverWidth(FX_FLOAT width); @@ -169,15 +169,15 @@ public: { return this; }; - void GetDisplayMatrix(CFX_AffineMatrix& matrix, FX_INT32 xPos, FX_INT32 yPos, FX_INT32 xSize, FX_INT32 ySize, FX_INT32 iRotate, const CFX_AffineMatrix* pPageMatrix); + void GetDisplayMatrix(CFX_AffineMatrix& matrix, int32_t xPos, int32_t yPos, int32_t xSize, int32_t ySize, int32_t iRotate, const CFX_AffineMatrix* pPageMatrix); FX_FLOAT GetPageHeight() ; FX_FLOAT GetPageWidth() { return m_PageWidth; }; - void FocusGetData(const CFX_AffineMatrix matrix, FX_INT32 x, FX_INT32 y, CFX_ByteString& str); - FX_BOOL FocusGetPosition(const CFX_AffineMatrix matrix, CFX_ByteString str, FX_INT32& x, FX_INT32& y); + void FocusGetData(const CFX_AffineMatrix matrix, int32_t x, int32_t y, CFX_ByteString& str); + FX_BOOL FocusGetPosition(const CFX_AffineMatrix matrix, CFX_ByteString str, int32_t& x, int32_t& y); CRF_DataPtrArray* m_pReflowed; FX_FLOAT m_PageWidth; FX_FLOAT m_PageHeight; diff --git a/core/src/reflow/reflowedtextpage.h b/core/src/reflow/reflowedtextpage.h index 288ceed48b..bb6e24a9cd 100644 --- a/core/src/reflow/reflowedtextpage.h +++ b/core/src/reflow/reflowedtextpage.h @@ -11,7 +11,7 @@ #include "../../src/reflow/reflowedpage.h" typedef CFX_SegmentedArray CRF_CharDataPtrArray; -typedef CFX_SegmentedArray CFX_CountBSINT32Array; +typedef CFX_SegmentedArray CFX_CountBSINT32Array; class CRF_TextPage : public IPDF_TextPage { public: diff --git a/fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h b/fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h index 5e596657ec..a51e9efbe1 100644 --- a/fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h +++ b/fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h @@ -29,12 +29,12 @@ public: void SetAPType(const CFX_ByteString& sAPType); protected: - virtual CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias, FX_INT32 nCharset); + virtual CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias, int32_t nCharset); virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias); virtual CPDF_Document* GetDocument(); private: CPDF_Font* FindResFontSameCharset(CPDF_Dictionary* pResDict, CFX_ByteString& sFontAlias, - FX_INT32 nCharset); + int32_t nCharset); CPDF_Font* GetAnnotDefaultFont(CFX_ByteString &csNameTag); void AddFontToAnnotDict(CPDF_Font* pFont, const CFX_ByteString& sAlias); diff --git a/fpdfsdk/include/formfiller/FFL_IFormFiller.h b/fpdfsdk/include/formfiller/FFL_IFormFiller.h index cccf84f7b4..52cf2ee80a 100644 --- a/fpdfsdk/include/formfiller/FFL_IFormFiller.h +++ b/fpdfsdk/include/formfiller/FFL_IFormFiller.h @@ -67,15 +67,15 @@ public: virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag); public: - virtual void QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX_FLOAT fPopupMax, FX_INT32 & nRet, FX_FLOAT & fPopupRet); - virtual void OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode, + virtual void QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX_FLOAT fPopupMax, int32_t & nRet, FX_FLOAT & fPopupRet); + virtual void OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, int32_t nKeyCode, CFX_WideString & strChange, const CFX_WideString& strChangeEx, int nSelStart, int nSelEnd, FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag); virtual void OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_BOOL & bExit, FX_DWORD nFlag) ; virtual void OnSetWindowRect(void* pPrivateData, const CPDF_Rect & rcWindow); - virtual void OnKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode, CFX_WideString & strChange, + virtual void OnKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, int32_t nKeyCode, CFX_WideString & strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit); public: diff --git a/fpdfsdk/include/formfiller/FFL_Notify.h b/fpdfsdk/include/formfiller/FFL_Notify.h index d1f43411ee..ea236defe1 100644 --- a/fpdfsdk/include/formfiller/FFL_Notify.h +++ b/fpdfsdk/include/formfiller/FFL_Notify.h @@ -49,7 +49,7 @@ private: FX_BOOL ExecuteAction(CPDF_AAction::AActionType eAAT,CPDF_Action & action,FX_BOOL& bExit); FX_BOOL m_bDoActioning; - FX_INT32 m_nNotifyFlag; + int32_t m_nNotifyFlag; }; #endif // FPDFSDK_INCLUDE_FORMFILLER_FFL_NOTIFY_H_ diff --git a/fpdfsdk/include/fsdk_baseannot.h b/fpdfsdk/include/fsdk_baseannot.h index dbd7e005b7..836190eae2 100644 --- a/fpdfsdk/include/fsdk_baseannot.h +++ b/fpdfsdk/include/fsdk_baseannot.h @@ -58,14 +58,14 @@ public: struct FX_DATETIME { - FX_SHORT year; - FX_BYTE month; - FX_BYTE day; - FX_BYTE hour; - FX_BYTE minute; - FX_BYTE second; - FX_INT8 tzHour; - FX_BYTE tzMinute; + int16_t year; + uint8_t month; + uint8_t day; + uint8_t hour; + uint8_t minute; + uint8_t second; + int8_t tzHour; + uint8_t tzMinute; }dt; }; diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h index 85ab3e6fd1..27ec143b35 100644 --- a/fpdfsdk/include/fsdk_baseform.h +++ b/fpdfsdk/include/fsdk_baseform.h @@ -128,8 +128,8 @@ public: void ClearAppModified(); FX_BOOL IsAppModified() const; - FX_INT32 GetAppearanceAge() const; - FX_INT32 GetValueAge() const; + int32_t GetAppearanceAge() const; + int32_t GetValueAge() const; private: void ResetAppearance_PushButton(); @@ -161,8 +161,8 @@ public: private: CPDFSDK_InterForm* m_pInterForm; FX_BOOL m_bAppModified; - FX_INT32 m_nAppAge; - FX_INT32 m_nValueAge; + int32_t m_nAppAge; + int32_t m_nValueAge; }; #define CPDFSDK_WidgetMap CFX_MapPtrTemplate @@ -245,13 +245,13 @@ private: public: FX_BOOL IsNeedHighLight(int nFieldType); void RemoveAllHighLight(); - void SetHighlightAlpha(FX_BYTE alpha) {m_iHighlightAlpha = alpha;} - FX_BYTE GetHighlightAlpha() {return m_iHighlightAlpha;} + void SetHighlightAlpha(uint8_t alpha) {m_iHighlightAlpha = alpha;} + uint8_t GetHighlightAlpha() {return m_iHighlightAlpha;} void SetHighlightColor(FX_COLORREF clr, int nFieldType); FX_COLORREF GetHighlightColor(int nFieldType); private: FX_COLORREF m_aHighlightColor[6]; - FX_BYTE m_iHighlightAlpha; + uint8_t m_iHighlightAlpha; FX_BOOL m_bNeedHightlight[6]; }; diff --git a/fpdfsdk/include/fx_systemhandler.h b/fpdfsdk/include/fx_systemhandler.h index f8df723ad0..276019eae5 100644 --- a/fpdfsdk/include/fx_systemhandler.h +++ b/fpdfsdk/include/fx_systemhandler.h @@ -9,7 +9,7 @@ typedef FX_LPVOID FX_HWND; typedef FX_LPVOID FX_HMENU; -typedef void (*TimerCallback)(FX_INT32 idEvent); +typedef void (*TimerCallback)(int32_t idEvent); typedef struct _FX_SYSTEMTIME { @@ -52,8 +52,8 @@ public: virtual CFX_WideString GetClipboardText(FX_HWND hWnd) = 0; virtual FX_BOOL SetClipboardText(FX_HWND hWnd, CFX_WideString string) = 0; - virtual void ClientToScreen(FX_HWND hWnd, FX_INT32& x, FX_INT32& y) = 0; - virtual void ScreenToClient(FX_HWND hWnd, FX_INT32& x, FX_INT32& y) = 0; + virtual void ClientToScreen(FX_HWND hWnd, int32_t& x, int32_t& y) = 0; + virtual void ScreenToClient(FX_HWND hWnd, int32_t& x, int32_t& y) = 0; /*cursor style FXCT_ARROW @@ -63,20 +63,20 @@ public: FXCT_HBEAM FXCT_HAND */ - virtual void SetCursor(FX_INT32 nCursorType) = 0; + virtual void SetCursor(int32_t nCursorType) = 0; virtual FX_HMENU CreatePopupMenu() = 0; - virtual FX_BOOL AppendMenuItem(FX_HMENU hMenu, FX_INT32 nIDNewItem, CFX_WideString string) = 0; - virtual FX_BOOL EnableMenuItem(FX_HMENU hMenu, FX_INT32 nIDItem, FX_BOOL bEnabled) = 0; - virtual FX_INT32 TrackPopupMenu(FX_HMENU hMenu, FX_INT32 x, FX_INT32 y, FX_HWND hParent) = 0; + virtual FX_BOOL AppendMenuItem(FX_HMENU hMenu, int32_t nIDNewItem, CFX_WideString string) = 0; + virtual FX_BOOL EnableMenuItem(FX_HMENU hMenu, int32_t nIDItem, FX_BOOL bEnabled) = 0; + virtual int32_t TrackPopupMenu(FX_HMENU hMenu, int32_t x, int32_t y, FX_HWND hParent) = 0; virtual void DestroyMenu(FX_HMENU hMenu) = 0; - virtual CFX_ByteString GetNativeTrueTypeFont(FX_INT32 nCharset) = 0; - virtual FX_BOOL FindNativeTrueTypeFont(FX_INT32 nCharset, CFX_ByteString sFontFaceName) = 0; - virtual CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, CFX_ByteString sFontFaceName, FX_BYTE nCharset) = 0; + virtual CFX_ByteString GetNativeTrueTypeFont(int32_t nCharset) = 0; + virtual FX_BOOL FindNativeTrueTypeFont(int32_t nCharset, CFX_ByteString sFontFaceName) = 0; + virtual CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, CFX_ByteString sFontFaceName, uint8_t nCharset) = 0; - virtual FX_INT32 SetTimer(FX_INT32 uElapse, TimerCallback lpTimerFunc) = 0; - virtual void KillTimer(FX_INT32 nID) = 0; + virtual int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc) = 0; + virtual void KillTimer(int32_t nID) = 0; virtual FX_BOOL IsSHIFTKeyDown(FX_DWORD nFlag) = 0; @@ -86,8 +86,8 @@ public: virtual FX_SYSTEMTIME GetLocalTime() = 0; - virtual FX_INT32 GetCharSet() = 0; - virtual void SetCharSet(FX_INT32 nCharSet) = 0; + virtual int32_t GetCharSet() = 0; + virtual void SetCharSet(int32_t nCharSet) = 0; }; #endif // FPDFSDK_INCLUDE_FX_SYSTEMHANDLER_H_ diff --git a/fpdfsdk/include/fxedit/fx_edit.h b/fpdfsdk/include/fxedit/fx_edit.h index 31ede0564b..0da6fe6f9e 100644 --- a/fpdfsdk/include/fxedit/fx_edit.h +++ b/fpdfsdk/include/fxedit/fx_edit.h @@ -65,15 +65,15 @@ class IFX_Edit_FontMap public: virtual ~IFX_Edit_FontMap() { } //map a fontindex to pdf font. - virtual CPDF_Font * GetPDFFont(FX_INT32 nFontIndex) = 0; + virtual CPDF_Font * GetPDFFont(int32_t nFontIndex) = 0; //get the alias of a pdf font. - virtual CFX_ByteString GetPDFFontAlias(FX_INT32 nFontIndex) = 0; + virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) = 0; //get the index of a font that can show a word. - virtual FX_INT32 GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex) = 0; + virtual int32_t GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex) = 0; //get the charcode of word from unicode - virtual FX_INT32 CharCodeFromUnicode(FX_INT32 nFontIndex, FX_WORD word) = 0; + virtual int32_t CharCodeFromUnicode(int32_t nFontIndex, FX_WORD word) = 0; //get the charset of unicode - virtual FX_INT32 CharSetFromUnicode(FX_WORD word, FX_INT32 nOldCharset) = 0; + virtual int32_t CharSetFromUnicode(FX_WORD word, int32_t nOldCharset) = 0; }; class IFX_Edit_Notify @@ -151,7 +151,7 @@ public: //get the information of the current section. virtual FX_BOOL GetSection(CPVT_Section & section) const = 0; //set the current position. - virtual void SetAt(FX_INT32 nWordIndex) = 0; + virtual void SetAt(int32_t nWordIndex) = 0; //set the current position. virtual void SetAt(const CPVT_WordPlace & place) = 0; //get the current position. @@ -200,19 +200,19 @@ public: virtual void SetScrollPos(const CPDF_Point & point) = 0; //set the horizontal text alignment in text box, nFormat (0:left 1:middle 2:right). - virtual void SetAlignmentH(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE) = 0; + virtual void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) = 0; //set the vertical text alignment in text box, nFormat (0:top 1:center 2:bottom). - virtual void SetAlignmentV(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE) = 0; + virtual void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) = 0; //if the text is shown in secret , set a character for substitute. virtual void SetPasswordChar(FX_WORD wSubWord = '*', FX_BOOL bPaint = TRUE) = 0; //set the maximal count of words of the text. - virtual void SetLimitChar(FX_INT32 nLimitChar = 0, FX_BOOL bPaint = TRUE) = 0; + virtual void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE) = 0; //if set the count of charArray , then all words is shown in equal space. - virtual void SetCharArray(FX_INT32 nCharArray = 0, FX_BOOL bPaint = TRUE) = 0; + virtual void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE) = 0; //set the space of two characters. virtual void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE) = 0; //set the horizontal scale of all characters. - virtual void SetHorzScale(FX_INT32 nHorzScale = 100, FX_BOOL bPaint = TRUE) = 0; + virtual void SetHorzScale(int32_t nHorzScale = 100, FX_BOOL bPaint = TRUE) = 0; //set the leading of all lines virtual void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE) = 0; //if set, CRLF is allowed. @@ -235,11 +235,11 @@ public: //set the fontsize of selected text. virtual FX_BOOL SetRichFontSize(FX_FLOAT fFontSize) = 0; //set the fontindex of selected text, user can change the font of selected text. - virtual FX_BOOL SetRichFontIndex(FX_INT32 nFontIndex) = 0; + virtual FX_BOOL SetRichFontIndex(int32_t nFontIndex) = 0; //set the textcolor of selected text. virtual FX_BOOL SetRichTextColor(FX_COLORREF dwColor) = 0; //set the text script type of selected text. (0:normal 1:superscript 2:subscript) - virtual FX_BOOL SetRichTextScript(FX_INT32 nScriptType) = 0; + virtual FX_BOOL SetRichTextScript(int32_t nScriptType) = 0; //set the bold font style of selected text. virtual FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE) = 0; //set the italic font style of selected text. @@ -251,25 +251,25 @@ public: //set the charspace of selected text, in user coordinate. virtual FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace) = 0; //set the horizontal scale of selected text, default value is 100. - virtual FX_BOOL SetRichTextHorzScale(FX_INT32 nHorzScale = 100) = 0; + virtual FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100) = 0; //set the leading of selected section, in user coordinate. virtual FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading) = 0; //set the indent of selected section, in user coordinate. virtual FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent) = 0; //set the alignment of selected section, nAlignment(0:left 1:middle 2:right) - virtual FX_BOOL SetRichTextAlignment(FX_INT32 nAlignment) = 0; + virtual FX_BOOL SetRichTextAlignment(int32_t nAlignment) = 0; //set the selected range of text. //if nStartChar == 0 and nEndChar == -1, select all the text. - virtual void SetSel(FX_INT32 nStartChar,FX_INT32 nEndChar) = 0; + virtual void SetSel(int32_t nStartChar,int32_t nEndChar) = 0; //get the selected range of text. - virtual void GetSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar) const = 0; + virtual void GetSel(int32_t & nStartChar, int32_t & nEndChar) const = 0; //select all the text. virtual void SelectAll() = 0; //set text is not selected. virtual void SelectNone() = 0; //get the caret position. - virtual FX_INT32 GetCaret() const = 0; + virtual int32_t GetCaret() const = 0; virtual CPVT_WordPlace GetCaretWordPlace() const = 0; //get the string of selected text. virtual CFX_WideString GetSelText() const = 0; @@ -309,14 +309,14 @@ public: virtual void OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) = 0; //put text into edit. - virtual void SetText(FX_LPCWSTR text,FX_INT32 charset = DEFAULT_CHARSET, + virtual void SetText(FX_LPCWSTR text,int32_t charset = DEFAULT_CHARSET, const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0; //insert a word into the edit. - virtual FX_BOOL InsertWord(FX_WORD word, FX_INT32 charset = DEFAULT_CHARSET, const CPVT_WordProps * pWordProps = NULL) = 0; + virtual FX_BOOL InsertWord(FX_WORD word, int32_t charset = DEFAULT_CHARSET, const CPVT_WordProps * pWordProps = NULL) = 0; //insert a return into the edit. virtual FX_BOOL InsertReturn(const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0; //insert text into the edit. - virtual FX_BOOL InsertText(FX_LPCWSTR text, FX_INT32 charset = DEFAULT_CHARSET, + virtual FX_BOOL InsertText(FX_LPCWSTR text, int32_t charset = DEFAULT_CHARSET, const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0; //do backspace operation. virtual FX_BOOL Backspace() = 0; @@ -330,7 +330,7 @@ public: //do Undo operation. virtual FX_BOOL Undo() = 0; //move caret - virtual void SetCaret(FX_INT32 nPos) = 0; + virtual void SetCaret(int32_t nPos) = 0; //arrange all words over again virtual void Paint() = 0; @@ -350,9 +350,9 @@ public: virtual void EnableOprNotify(FX_BOOL bNotify) = 0; //map word place to word index. - virtual FX_INT32 WordPlaceToWordIndex(const CPVT_WordPlace & place) const = 0; + virtual int32_t WordPlaceToWordIndex(const CPVT_WordPlace & place) const = 0; //map word index to word place. - virtual CPVT_WordPlace WordIndexToWordPlace(FX_INT32 index) const = 0; + virtual CPVT_WordPlace WordIndexToWordPlace(int32_t index) const = 0; //get the beginning position of a line virtual CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace & place) const = 0; @@ -374,9 +374,9 @@ public: //get the mask character. virtual FX_WORD GetPasswordChar() const = 0; //get the count of charArray - virtual FX_INT32 GetCharArray() const = 0; + virtual int32_t GetCharArray() const = 0; //get the horizontal scale of all characters - virtual FX_INT32 GetHorzScale() const = 0; + virtual int32_t GetHorzScale() const = 0; //get the space of two characters virtual FX_FLOAT GetCharSpace() const = 0; //get the latin words of specified range @@ -388,7 +388,7 @@ public: //if the content is changed after settext? virtual FX_BOOL IsModified() const = 0; //get the total words in edit - virtual FX_INT32 GetTotalWords() const = 0; + virtual int32_t GetTotalWords() const = 0; virtual void AddUndoItem(IFX_Edit_UndoItem* pUndoItem) = 0; @@ -449,29 +449,29 @@ public: virtual CPDF_Rect GetContentRect() const = 0; virtual FX_FLOAT GetFontSize() const = 0; - virtual IFX_Edit* GetItemEdit(FX_INT32 nIndex) const = 0; - virtual FX_INT32 GetCount() const = 0; - virtual FX_BOOL IsItemSelected(FX_INT32 nIndex) const = 0; + virtual IFX_Edit* GetItemEdit(int32_t nIndex) const = 0; + virtual int32_t GetCount() const = 0; + virtual FX_BOOL IsItemSelected(int32_t nIndex) const = 0; virtual FX_FLOAT GetFirstHeight() const = 0; virtual void SetMultipleSel(FX_BOOL bMultiple) = 0; virtual FX_BOOL IsMultipleSel() const = 0; - virtual FX_BOOL IsValid(FX_INT32 nItemIndex) const = 0; - virtual FX_INT32 FindNext(FX_INT32 nIndex,FX_WCHAR nChar) const = 0; + virtual FX_BOOL IsValid(int32_t nItemIndex) const = 0; + virtual int32_t FindNext(int32_t nIndex,FX_WCHAR nChar) const = 0; virtual void SetScrollPos(const CPDF_Point & point) = 0; - virtual void ScrollToListItem(FX_INT32 nItemIndex) = 0; - virtual CPDF_Rect GetItemRect(FX_INT32 nIndex) const = 0; - virtual FX_INT32 GetCaret() const = 0; - virtual FX_INT32 GetSelect() const = 0; - virtual FX_INT32 GetTopItem() const = 0; - virtual FX_INT32 GetItemIndex(const CPDF_Point & point) const = 0; - virtual FX_INT32 GetFirstSelected() const = 0; + virtual void ScrollToListItem(int32_t nItemIndex) = 0; + virtual CPDF_Rect GetItemRect(int32_t nIndex) const = 0; + virtual int32_t GetCaret() const = 0; + virtual int32_t GetSelect() const = 0; + virtual int32_t GetTopItem() const = 0; + virtual int32_t GetItemIndex(const CPDF_Point & point) const = 0; + virtual int32_t GetFirstSelected() const = 0; virtual void AddString(FX_LPCWSTR string) = 0; - virtual void SetTopItem(FX_INT32 nIndex) = 0; - virtual void Select(FX_INT32 nItemIndex) = 0; - virtual void SetCaret(FX_INT32 nItemIndex) = 0; + virtual void SetTopItem(int32_t nIndex) = 0; + virtual void Select(int32_t nItemIndex) = 0; + virtual void SetCaret(int32_t nItemIndex) = 0; virtual void Empty() = 0; virtual void Cancel() = 0; virtual CFX_WideString GetText() const = 0; @@ -485,7 +485,7 @@ public: virtual void OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) = 0; virtual void OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) = 0; virtual void OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) = 0; - virtual void OnVK(FX_INT32 nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl) = 0; + virtual void OnVK(int32_t nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl) = 0; virtual FX_BOOL OnChar(FX_WORD nChar,FX_BOOL bShift,FX_BOOL bCtrl) = 0; protected: diff --git a/fpdfsdk/include/fxedit/fxet_edit.h b/fpdfsdk/include/fxedit/fxet_edit.h index 237aa66b53..6fd7b9a4ee 100644 --- a/fpdfsdk/include/fxedit/fxet_edit.h +++ b/fpdfsdk/include/fxedit/fxet_edit.h @@ -111,7 +111,7 @@ public: void Empty() { - for (FX_INT32 i = 0, sz = m_LineRects.GetSize(); i < sz; i++) + for (int32_t i = 0, sz = m_LineRects.GetSize(); i < sz; i++) delete m_LineRects.GetAt(i); m_LineRects.RemoveAll(); @@ -125,7 +125,7 @@ public: void operator = (CFX_Edit_LineRectArray & rects) { Empty(); - for (FX_INT32 i = 0, sz = rects.GetSize(); i < sz; i++) + for (int32_t i = 0, sz = rects.GetSize(); i < sz; i++) m_LineRects.Add(rects.GetAt(i)); rects.RemoveAll(); @@ -137,12 +137,12 @@ public: m_LineRects.Add(pRect); } - FX_INT32 GetSize() const + int32_t GetSize() const { return m_LineRects.GetSize(); } - CFX_Edit_LineRect * GetAt(FX_INT32 nIndex) const + CFX_Edit_LineRect * GetAt(int32_t nIndex) const { if (nIndex < 0 || nIndex >= m_LineRects.GetSize()) return NULL; @@ -167,7 +167,7 @@ public: void Empty() { - for (FX_INT32 i = 0, sz = m_Rects.GetSize(); i < sz; i++) + for (int32_t i = 0, sz = m_Rects.GetSize(); i < sz; i++) delete m_Rects.GetAt(i); this->m_Rects.RemoveAll(); @@ -176,7 +176,7 @@ public: void Add(const CPDF_Rect & rect) { //check for overlaped area - for (FX_INT32 i = 0, sz = m_Rects.GetSize(); i < sz; i++) + for (int32_t i = 0, sz = m_Rects.GetSize(); i < sz; i++) if (CPDF_Rect * pRect = m_Rects.GetAt(i)) if (pRect->Contains(rect))return; @@ -184,12 +184,12 @@ public: m_Rects.Add(pNewRect); } - FX_INT32 GetSize() const + int32_t GetSize() const { return m_Rects.GetSize(); } - CPDF_Rect * GetAt(FX_INT32 nIndex) const + CPDF_Rect * GetAt(int32_t nIndex) const { if (nIndex < 0 || nIndex >= m_Rects.GetSize()) return NULL; @@ -209,7 +209,7 @@ public: void BeginRefresh(); void Push(const CPVT_WordRange & linerange,const CPDF_Rect & rect); void NoAnalyse(); - void Analyse(FX_INT32 nAlignment); + void Analyse(int32_t nAlignment); void AddRefresh(const CPDF_Rect & rect); const CFX_Edit_RectArray * GetRefreshRects() const; void EndRefresh(); @@ -285,7 +285,7 @@ public: class CFX_Edit_Undo { public: - CFX_Edit_Undo(FX_INT32 nBufsize = 10000); + CFX_Edit_Undo(int32_t nBufsize = 10000); virtual ~CFX_Edit_Undo(); void Undo(); @@ -300,13 +300,13 @@ public: void Reset(); - IFX_Edit_UndoItem* GetItem(FX_INT32 nIndex); - FX_INT32 GetItemCount(){return m_UndoItemStack.GetSize();} - FX_INT32 GetCurUndoPos(){return m_nCurUndoPos;} + IFX_Edit_UndoItem* GetItem(int32_t nIndex); + int32_t GetItemCount(){return m_UndoItemStack.GetSize();} + int32_t GetCurUndoPos(){return m_nCurUndoPos;} private: - void SetBufSize(FX_INT32 nSize){m_nBufSize = nSize;} - FX_INT32 GetBufSize(){return m_nBufSize;} + void SetBufSize(int32_t nSize){m_nBufSize = nSize;} + int32_t GetBufSize(){return m_nBufSize;} void RemoveHeads(); void RemoveTails(); @@ -314,8 +314,8 @@ private: private: CFX_ArrayTemplate m_UndoItemStack; - FX_INT32 m_nCurUndoPos; - FX_INT32 m_nBufSize; + int32_t m_nCurUndoPos; + int32_t m_nBufSize; FX_BOOL m_bModified; FX_BOOL m_bVirgin; FX_BOOL m_bWorking; @@ -362,7 +362,7 @@ class CFXEU_InsertWord : public CFX_Edit_UndoItem { public: CFXEU_InsertWord(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace, - FX_WORD word, FX_INT32 charset, const CPVT_WordProps * pWordProps); + FX_WORD word, int32_t charset, const CPVT_WordProps * pWordProps); virtual ~CFXEU_InsertWord(); void Redo(); @@ -374,7 +374,7 @@ private: CPVT_WordPlace m_wpOld; CPVT_WordPlace m_wpNew; FX_WORD m_Word; - FX_INT32 m_nCharset; + int32_t m_nCharset; CPVT_WordProps m_WordProps; }; @@ -401,7 +401,7 @@ class CFXEU_Backspace : public CFX_Edit_UndoItem { public: CFXEU_Backspace(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace, - FX_WORD word, FX_INT32 charset, + FX_WORD word, int32_t charset, const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps); virtual ~CFXEU_Backspace(); @@ -414,7 +414,7 @@ private: CPVT_WordPlace m_wpOld; CPVT_WordPlace m_wpNew; FX_WORD m_Word; - FX_INT32 m_nCharset; + int32_t m_nCharset; CPVT_SecProps m_SecProps; CPVT_WordProps m_WordProps; }; @@ -423,7 +423,7 @@ class CFXEU_Delete : public CFX_Edit_UndoItem { public: CFXEU_Delete(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace, - FX_WORD word, FX_INT32 charset, + FX_WORD word, int32_t charset, const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps, FX_BOOL bSecEnd); virtual ~CFXEU_Delete(); @@ -436,7 +436,7 @@ private: CPVT_WordPlace m_wpOld; CPVT_WordPlace m_wpNew; FX_WORD m_Word; - FX_INT32 m_nCharset; + int32_t m_nCharset; CPVT_SecProps m_SecProps; CPVT_WordProps m_WordProps; FX_BOOL m_bSecEnd; @@ -463,7 +463,7 @@ class CFXEU_ClearRich : public CFX_Edit_UndoItem public: CFXEU_ClearRich(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace, const CPVT_WordRange & wrSel, - FX_WORD word, FX_INT32 charset, + FX_WORD word, int32_t charset, const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps); virtual ~CFXEU_ClearRich(); @@ -477,7 +477,7 @@ private: CPVT_WordPlace m_wpNew; CPVT_WordRange m_wrSel; FX_WORD m_Word; - FX_INT32 m_nCharset; + int32_t m_nCharset; CPVT_SecProps m_SecProps; CPVT_WordProps m_WordProps; }; @@ -486,7 +486,7 @@ class CFXEU_InsertText : public CFX_Edit_UndoItem { public: CFXEU_InsertText(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace, - const CFX_WideString & swText, FX_INT32 charset, + const CFX_WideString & swText, int32_t charset, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps); virtual ~CFXEU_InsertText(); @@ -499,7 +499,7 @@ private: CPVT_WordPlace m_wpOld; CPVT_WordPlace m_wpNew; CFX_WideString m_swText; - FX_INT32 m_nCharset; + int32_t m_nCharset; CPVT_SecProps m_SecProps; CPVT_WordProps m_WordProps; }; @@ -578,13 +578,13 @@ public: void SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint = TRUE); void SetScrollPos(const CPDF_Point & point); - void SetAlignmentH(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE); - void SetAlignmentV(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE); + void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE); + void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE); void SetPasswordChar(FX_WORD wSubWord = '*', FX_BOOL bPaint = TRUE); - void SetLimitChar(FX_INT32 nLimitChar = 0, FX_BOOL bPaint = TRUE); - void SetCharArray(FX_INT32 nCharArray = 0, FX_BOOL bPaint = TRUE); + void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE); + void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE); void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE); - void SetHorzScale(FX_INT32 nHorzScale = 100, FX_BOOL bPaint = TRUE); + void SetHorzScale(int32_t nHorzScale = 100, FX_BOOL bPaint = TRUE); void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE); void SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE); void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE); @@ -596,18 +596,18 @@ public: FX_BOOL IsRichText() const; void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE); FX_BOOL SetRichFontSize(FX_FLOAT fFontSize); - FX_BOOL SetRichFontIndex(FX_INT32 nFontIndex); + FX_BOOL SetRichFontIndex(int32_t nFontIndex); FX_BOOL SetRichTextColor(FX_COLORREF dwColor); - FX_BOOL SetRichTextScript(FX_INT32 nScriptType); + FX_BOOL SetRichTextScript(int32_t nScriptType); FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE); FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE); FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE); FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE); FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace); - FX_BOOL SetRichTextHorzScale(FX_INT32 nHorzScale = 100); + FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100); FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading); FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent); - FX_BOOL SetRichTextAlignment(FX_INT32 nAlignment); + FX_BOOL SetRichTextAlignment(int32_t nAlignment); void OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl); void OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl); @@ -618,24 +618,24 @@ public: void OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl); void OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl); - void SetText(FX_LPCWSTR text,FX_INT32 charset = DEFAULT_CHARSET, + void SetText(FX_LPCWSTR text,int32_t charset = DEFAULT_CHARSET, const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL); - FX_BOOL InsertWord(FX_WORD word, FX_INT32 charset = DEFAULT_CHARSET, const CPVT_WordProps * pWordProps = NULL); + FX_BOOL InsertWord(FX_WORD word, int32_t charset = DEFAULT_CHARSET, const CPVT_WordProps * pWordProps = NULL); FX_BOOL InsertReturn(const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL); FX_BOOL Backspace(); FX_BOOL Delete(); FX_BOOL Clear(); FX_BOOL Empty(); - FX_BOOL InsertText(FX_LPCWSTR text, FX_INT32 charset = DEFAULT_CHARSET, + FX_BOOL InsertText(FX_LPCWSTR text, int32_t charset = DEFAULT_CHARSET, const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL); FX_BOOL Redo(); FX_BOOL Undo(); - CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place, FX_LPCWSTR text, FX_INT32 charset, + CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place, FX_LPCWSTR text, int32_t charset, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps); - FX_INT32 GetCharSetFromUnicode(FX_WORD word, FX_INT32 nOldCharset); + int32_t GetCharSetFromUnicode(FX_WORD word, int32_t nOldCharset); - FX_INT32 WordPlaceToWordIndex(const CPVT_WordPlace & place) const; - CPVT_WordPlace WordIndexToWordPlace(FX_INT32 index) const; + int32_t WordPlaceToWordIndex(const CPVT_WordPlace & place) const; + CPVT_WordPlace WordIndexToWordPlace(int32_t index) const; CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace & place) const; CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace & place) const; @@ -643,24 +643,24 @@ public: CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace & place) const; CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const; - FX_INT32 GetCaret() const; + int32_t GetCaret() const; CPVT_WordPlace GetCaretWordPlace() const; CFX_WideString GetSelText() const; CFX_WideString GetText() const; FX_FLOAT GetFontSize() const; FX_WORD GetPasswordChar() const; CPDF_Point GetScrollPos() const; - FX_INT32 GetCharArray() const; + int32_t GetCharArray() const; CPDF_Rect GetPlateRect() const; CPDF_Rect GetContentRect() const; CFX_WideString GetRangeText(const CPVT_WordRange & range) const; - FX_INT32 GetHorzScale() const; + int32_t GetHorzScale() const; FX_FLOAT GetCharSpace() const; - FX_INT32 GetTotalWords() const; - FX_INT32 GetTotalLines() const; + int32_t GetTotalWords() const; + int32_t GetTotalLines() const; - void SetSel(FX_INT32 nStartChar,FX_INT32 nEndChar); - void GetSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar) const; + void SetSel(int32_t nStartChar,int32_t nEndChar); + void GetSel(int32_t & nStartChar, int32_t & nEndChar) const; private: void SelectAll(); @@ -679,14 +679,14 @@ private: void SetContentChanged(); void EnableNotify(FX_BOOL bNotify); - void SetText(FX_LPCWSTR text,FX_INT32 charset, + void SetText(FX_LPCWSTR text,int32_t charset, const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint); - FX_BOOL InsertWord(FX_WORD word, FX_INT32 charset, const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint); + FX_BOOL InsertWord(FX_WORD word, int32_t charset, const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint); FX_BOOL InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint); FX_BOOL Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint); FX_BOOL Delete(FX_BOOL bAddUndo, FX_BOOL bPaint); FX_BOOL Clear(FX_BOOL bAddUndo, FX_BOOL bPaint); - FX_BOOL InsertText(FX_LPCWSTR text, FX_INT32 charset, + FX_BOOL InsertText(FX_LPCWSTR text, int32_t charset, const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint); FX_BOOL SetRichTextProps(EDIT_PROPS_E eProps, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps); @@ -708,7 +708,7 @@ private: void RefreshPushRandomRects(const CPVT_WordRange & wr); void RefreshWordRange(const CPVT_WordRange& wr); - void SetCaret(FX_INT32 nPos); + void SetCaret(int32_t nPos); void SetCaret(const CPVT_WordPlace & place); void SetCaretInfo(); void SetCaretOrigin(); @@ -756,7 +756,7 @@ private: CFX_Edit_Refresh m_Refresh; CPDF_Point m_ptCaret; CFX_Edit_Undo m_Undo; - FX_INT32 m_nAlignment; + int32_t m_nAlignment; FX_BOOL m_bNotifyFlag; FX_BOOL m_bEnableOverflow; FX_BOOL m_bEnableRefresh; @@ -785,7 +785,7 @@ public: FX_BOOL GetWord(CPVT_Word & word) const; FX_BOOL GetLine(CPVT_Line & line) const; FX_BOOL GetSection(CPVT_Section & section) const; - void SetAt(FX_INT32 nWordIndex); + void SetAt(int32_t nWordIndex); void SetAt(const CPVT_WordPlace & place); const CPVT_WordPlace & GetAt() const; IFX_Edit* GetEdit() const; @@ -803,11 +803,11 @@ public: IFX_Edit_FontMap* GetFontMap(); - FX_INT32 GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_INT32 nWordStyle); - FX_INT32 GetTypeAscent(FX_INT32 nFontIndex); - FX_INT32 GetTypeDescent(FX_INT32 nFontIndex); - FX_INT32 GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex); - FX_INT32 GetDefaultFontIndex(); + int32_t GetCharWidth(int32_t nFontIndex, FX_WORD word, int32_t nWordStyle); + int32_t GetTypeAscent(int32_t nFontIndex); + int32_t GetTypeDescent(int32_t nFontIndex); + int32_t GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex); + int32_t GetDefaultFontIndex(); FX_BOOL IsLatinWord(FX_WORD word); private: diff --git a/fpdfsdk/include/fxedit/fxet_list.h b/fpdfsdk/include/fxedit/fxet_list.h index 5c689ed439..b7888eaf3b 100644 --- a/fpdfsdk/include/fxedit/fxet_list.h +++ b/fpdfsdk/include/fxedit/fxet_list.h @@ -209,8 +209,8 @@ template class CLST_ArrayTemplate : public CFX_ArrayTemplate { public: FX_BOOL IsEmpty() { return CFX_ArrayTemplate::GetSize() <= 0; } - TYPE GetAt(FX_INT32 nIndex) const { if (nIndex >= 0 && nIndex < CFX_ArrayTemplate::GetSize()) return CFX_ArrayTemplate::GetAt(nIndex); return NULL;} - void RemoveAt(FX_INT32 nIndex){if (nIndex >= 0 && nIndex < CFX_ArrayTemplate::GetSize()) CFX_ArrayTemplate::RemoveAt(nIndex);} + TYPE GetAt(int32_t nIndex) const { if (nIndex >= 0 && nIndex < CFX_ArrayTemplate::GetSize()) return CFX_ArrayTemplate::GetAt(nIndex); return NULL;} + void RemoveAt(int32_t nIndex){if (nIndex >= 0 && nIndex < CFX_ArrayTemplate::GetSize()) CFX_ArrayTemplate::RemoveAt(nIndex);} }; class CFX_List : protected CFX_ListContainer , public IFX_List @@ -227,31 +227,31 @@ public: virtual CPDF_Rect GetContentRect() const; virtual FX_FLOAT GetFontSize() const; - virtual IFX_Edit* GetItemEdit(FX_INT32 nIndex) const; - virtual FX_INT32 GetCount() const; - virtual FX_BOOL IsItemSelected(FX_INT32 nIndex) const; + virtual IFX_Edit* GetItemEdit(int32_t nIndex) const; + virtual int32_t GetCount() const; + virtual FX_BOOL IsItemSelected(int32_t nIndex) const; virtual FX_FLOAT GetFirstHeight() const; virtual void SetMultipleSel(FX_BOOL bMultiple); virtual FX_BOOL IsMultipleSel() const; - virtual FX_BOOL IsValid(FX_INT32 nItemIndex) const; - virtual FX_INT32 FindNext(FX_INT32 nIndex,FX_WCHAR nChar) const; + virtual FX_BOOL IsValid(int32_t nItemIndex) const; + virtual int32_t FindNext(int32_t nIndex,FX_WCHAR nChar) const; protected: virtual void Empty(); void AddItem(FX_LPCWSTR str); - virtual void ReArrange(FX_INT32 nItemIndex); + virtual void ReArrange(int32_t nItemIndex); - virtual CPDF_Rect GetItemRect(FX_INT32 nIndex) const; - CFX_WideString GetItemText(FX_INT32 nIndex) const; + virtual CPDF_Rect GetItemRect(int32_t nIndex) const; + CFX_WideString GetItemText(int32_t nIndex) const; - void SetItemSelect(FX_INT32 nItemIndex, FX_BOOL bSelected); - void SetItemCaret(FX_INT32 nItemIndex, FX_BOOL bCaret); + void SetItemSelect(int32_t nItemIndex, FX_BOOL bSelected); + void SetItemCaret(int32_t nItemIndex, FX_BOOL bCaret); - virtual FX_INT32 GetItemIndex(const CPDF_Point & point) const; - FX_INT32 GetFirstSelected() const; - FX_INT32 GetLastSelected() const; + virtual int32_t GetItemIndex(const CPDF_Point & point) const; + int32_t GetFirstSelected() const; + int32_t GetLastSelected() const; FX_WCHAR Toupper(FX_WCHAR c) const; private: @@ -263,14 +263,14 @@ private: struct CPLST_Select_Item { - CPLST_Select_Item(FX_INT32 nItemIndex,FX_INT32 nState) + CPLST_Select_Item(int32_t nItemIndex,int32_t nState) { this->nItemIndex = nItemIndex; this->nState = nState; } - FX_INT32 nItemIndex; - FX_INT32 nState; //0:normal select -1:to deselect 1: to select + int32_t nItemIndex; + int32_t nState; //0:normal select -1:to deselect 1: to select }; class CPLST_Select @@ -280,15 +280,15 @@ public: virtual ~CPLST_Select(); public: - void Add(FX_INT32 nItemIndex); - void Add(FX_INT32 nBeginIndex, FX_INT32 nEndIndex); - void Sub(FX_INT32 nItemIndex); - void Sub(FX_INT32 nBeginIndex, FX_INT32 nEndIndex); - FX_BOOL IsExist(FX_INT32 nItemIndex) const; - FX_INT32 Find(FX_INT32 nItemIndex) const; - FX_INT32 GetCount() const; - FX_INT32 GetItemIndex(FX_INT32 nIndex) const; - FX_INT32 GetState(FX_INT32 nIndex) const; + void Add(int32_t nItemIndex); + void Add(int32_t nBeginIndex, int32_t nEndIndex); + void Sub(int32_t nItemIndex); + void Sub(int32_t nBeginIndex, int32_t nEndIndex); + FX_BOOL IsExist(int32_t nItemIndex) const; + int32_t Find(int32_t nItemIndex) const; + int32_t GetCount() const; + int32_t GetItemIndex(int32_t nIndex) const; + int32_t GetState(int32_t nIndex) const; void Done(); void DeselectAll(); @@ -313,7 +313,7 @@ public: void OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl); void OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl); void OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl); - void OnVK(FX_INT32 nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl); + void OnVK(int32_t nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl); FX_BOOL OnChar(FX_WORD nChar,FX_BOOL bShift,FX_BOOL bCtrl); virtual CPDF_Point InToOut(const CPDF_Point & point) const; @@ -323,41 +323,41 @@ public: virtual void SetPlateRect(const CPDF_Rect & rect); void SetScrollPos(const CPDF_Point & point); - void ScrollToListItem(FX_INT32 nItemIndex); - virtual CPDF_Rect GetItemRect(FX_INT32 nIndex) const; - FX_INT32 GetCaret() const {return m_nCaretIndex;} - FX_INT32 GetSelect() const {return m_nSelItem;} - FX_INT32 GetTopItem() const; + void ScrollToListItem(int32_t nItemIndex); + virtual CPDF_Rect GetItemRect(int32_t nIndex) const; + int32_t GetCaret() const {return m_nCaretIndex;} + int32_t GetSelect() const {return m_nSelItem;} + int32_t GetTopItem() const; virtual CPDF_Rect GetContentRect() const; - virtual FX_INT32 GetItemIndex(const CPDF_Point & point) const; + virtual int32_t GetItemIndex(const CPDF_Point & point) const; void AddString(FX_LPCWSTR string); - void SetTopItem(FX_INT32 nIndex); - void Select(FX_INT32 nItemIndex); - virtual void SetCaret(FX_INT32 nItemIndex); + void SetTopItem(int32_t nIndex); + void Select(int32_t nItemIndex); + virtual void SetCaret(int32_t nItemIndex); virtual void Empty(); virtual void Cancel(); CFX_WideString GetText() const; private: - void SetMultipleSelect(FX_INT32 nItemIndex, FX_BOOL bSelected); - void SetSingleSelect(FX_INT32 nItemIndex); - void InvalidateItem(FX_INT32 nItemIndex); + void SetMultipleSelect(int32_t nItemIndex, FX_BOOL bSelected); + void SetSingleSelect(int32_t nItemIndex); + void InvalidateItem(int32_t nItemIndex); void SelectItems(); - FX_BOOL IsItemVisible(FX_INT32 nItemIndex) const; + FX_BOOL IsItemVisible(int32_t nItemIndex) const; void SetScrollInfo(); void SetScrollPosY(FX_FLOAT fy); - virtual void ReArrange(FX_INT32 nItemIndex); + virtual void ReArrange(int32_t nItemIndex); private: IFX_List_Notify* m_pNotify; FX_BOOL m_bNotifyFlag; CPDF_Point m_ptScrollPos; CPLST_Select m_aSelItems; //for multiple - FX_INT32 m_nSelItem; //for single - FX_INT32 m_nFootIndex; //for multiple + int32_t m_nSelItem; //for single + int32_t m_nFootIndex; //for multiple FX_BOOL m_bCtrlSel; //for multiple - FX_INT32 m_nCaretIndex; //for multiple + int32_t m_nCaretIndex; //for multiple }; #endif // FPDFSDK_INCLUDE_FXEDIT_FXET_LIST_H_ diff --git a/fpdfsdk/include/javascript/Field.h b/fpdfsdk/include/javascript/Field.h index 0da08b6e95..573fb392c0 100644 --- a/fpdfsdk/include/javascript/Field.h +++ b/fpdfsdk/include/javascript/Field.h @@ -87,7 +87,7 @@ struct CJS_DelayData CFX_WideString sFieldName; int nControlIndex; enum FIELD_PROP eProp; - FX_INT32 num; + int32_t num; bool b; CFX_ByteString string; CFX_WideString widestring; @@ -244,7 +244,7 @@ protected: CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField); FX_BOOL ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel); - void AddDelay_Int(enum FIELD_PROP prop, FX_INT32 n); + void AddDelay_Int(enum FIELD_PROP prop, int32_t n); void AddDelay_Bool(enum FIELD_PROP prop,bool b); void AddDelay_String(enum FIELD_PROP prop, const CFX_ByteString& string); void AddDelay_WideString(enum FIELD_PROP prop, const CFX_WideString& string); diff --git a/fpdfsdk/include/javascript/IJavaScript.h b/fpdfsdk/include/javascript/IJavaScript.h index 0900109021..2495876941 100644 --- a/fpdfsdk/include/javascript/IJavaScript.h +++ b/fpdfsdk/include/javascript/IJavaScript.h @@ -106,7 +106,7 @@ private: FX_BOOL m_bInit; int m_nRef; CJS_GlobalData* m_pGlobalData; - FX_INT32 m_nGlobalDataCount; + int32_t m_nGlobalDataCount; }; #endif // FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ diff --git a/fpdfsdk/include/javascript/JS_Define.h b/fpdfsdk/include/javascript/JS_Define.h index 86c50f30a9..01952714ba 100644 --- a/fpdfsdk/include/javascript/JS_Define.h +++ b/fpdfsdk/include/javascript/JS_Define.h @@ -17,7 +17,7 @@ struct JSConstSpec const wchar_t* pName; double number; const wchar_t* string; - FX_BYTE t; //0:double 1:str + uint8_t t; //0:double 1:str }; struct JSPropertySpec diff --git a/fpdfsdk/include/javascript/JS_GlobalData.h b/fpdfsdk/include/javascript/JS_GlobalData.h index 276ff8cd4b..f19265c651 100644 --- a/fpdfsdk/include/javascript/JS_GlobalData.h +++ b/fpdfsdk/include/javascript/JS_GlobalData.h @@ -75,7 +75,7 @@ public: FX_BOOL SetGlobalVariablePersistent(FX_LPCSTR propname, FX_BOOL bPersistent); FX_BOOL DeleteGlobalVariable(FX_LPCSTR propname); - FX_INT32 GetSize() const; + int32_t GetSize() const; CJS_GlobalData_Element* GetAt(int index) const; private: @@ -85,8 +85,8 @@ private: CJS_GlobalData_Element* GetGlobalVariable(FX_LPCSTR propname); int FindGlobalVariable(FX_LPCSTR propname); - void LoadFileBuffer(FX_LPCWSTR sFilePath, FX_LPBYTE& pBuffer, FX_INT32& nLength); - void WriteFileBuffer(FX_LPCWSTR sFilePath, FX_LPCSTR pBuffer, FX_INT32 nLength); + void LoadFileBuffer(FX_LPCWSTR sFilePath, FX_LPBYTE& pBuffer, int32_t& nLength); + void WriteFileBuffer(FX_LPCWSTR sFilePath, FX_LPCSTR pBuffer, int32_t nLength); void MakeByteString(const CFX_ByteString& name, CJS_KeyValue* pData, CFX_BinaryBuf& sData); private: diff --git a/fpdfsdk/include/javascript/util.h b/fpdfsdk/include/javascript/util.h index b621067bc3..07f52ab8ce 100644 --- a/fpdfsdk/include/javascript/util.h +++ b/fpdfsdk/include/javascript/util.h @@ -45,6 +45,6 @@ public: JS_STATIC_METHOD(byteToChar, util); }; -FX_INT64 FX_atoi64(const char *nptr); +int64_t FX_atoi64(const char *nptr); #endif // FPDFSDK_INCLUDE_JAVASCRIPT_UTIL_H_ diff --git a/fpdfsdk/include/pdfwindow/PWL_Caret.h b/fpdfsdk/include/pdfwindow/PWL_Caret.h index b827f18d3f..8efbf79341 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Caret.h +++ b/fpdfsdk/include/pdfwindow/PWL_Caret.h @@ -46,7 +46,7 @@ private: CPDF_Point m_ptHead; CPDF_Point m_ptFoot; FX_FLOAT m_fWidth; - FX_INT32 m_nDelay; + int32_t m_nDelay; CPDF_Rect m_rcInvalid; }; diff --git a/fpdfsdk/include/pdfwindow/PWL_ComboBox.h b/fpdfsdk/include/pdfwindow/PWL_ComboBox.h index 826f4dcc3e..7abdeeffce 100644 --- a/fpdfsdk/include/pdfwindow/PWL_ComboBox.h +++ b/fpdfsdk/include/pdfwindow/PWL_ComboBox.h @@ -61,7 +61,7 @@ public: virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag); virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag); - virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0); + virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); virtual void CreateChildWnd(const PWL_CREATEPARAM & cp); virtual void RePosChildWnd(); @@ -80,11 +80,11 @@ public: void SetText(FX_LPCWSTR text); void AddString(FX_LPCWSTR string); - FX_INT32 GetSelect() const; - void SetSelect(FX_INT32 nItemIndex); + int32_t GetSelect() const; + void SetSelect(int32_t nItemIndex); - void SetEditSel(FX_INT32 nStartChar,FX_INT32 nEndChar); - void GetEditSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar ) const; + void SetEditSel(int32_t nStartChar,int32_t nEndChar); + void GetEditSel(int32_t & nStartChar, int32_t & nEndChar ) const; void Clear(); void SelectAll(); FX_BOOL IsPopup() const; @@ -105,8 +105,8 @@ private: FX_BOOL m_bPopup; CPDF_Rect m_rcOldWindow; - FX_INT32 m_nPopupWhere; - FX_INT32 m_nSelectItem; + int32_t m_nPopupWhere; + int32_t m_nSelectItem; IPWL_Filler_Notify* m_pFillerNotify; public: diff --git a/fpdfsdk/include/pdfwindow/PWL_Edit.h b/fpdfsdk/include/pdfwindow/PWL_Edit.h index 9a133d15cc..63625641ce 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Edit.h +++ b/fpdfsdk/include/pdfwindow/PWL_Edit.h @@ -20,8 +20,8 @@ class IPWL_Filler_Notify public: virtual ~IPWL_Filler_Notify() { } virtual void QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX_FLOAT fPopupMax, - FX_INT32 & nRet, FX_FLOAT & fPopupRet) = 0; //nRet: (0:bottom 1:top) - virtual void OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode, + int32_t & nRet, FX_FLOAT & fPopupRet) = 0; //nRet: (0:bottom 1:top) + virtual void OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, int32_t nKeyCode, CFX_WideString & strChange, const CFX_WideString& strChangeEx, int nSelStart, int nSelEnd, FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag) = 0; @@ -58,10 +58,10 @@ public: void SetAlignFormatH(PWL_EDIT_ALIGNFORMAT_H nFormat = PEAH_LEFT, FX_BOOL bPaint = TRUE); //0:left 1:right 2:middle void SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat = PEAV_TOP, FX_BOOL bPaint = TRUE); //0:top 1:bottom 2:center - void SetCharArray(FX_INT32 nCharArray); - void SetLimitChar(FX_INT32 nLimitChar); + void SetCharArray(int32_t nCharArray); + void SetLimitChar(int32_t nLimitChar); - void SetHorzScale(FX_INT32 nHorzScale, FX_BOOL bPaint = TRUE); + void SetHorzScale(int32_t nHorzScale, FX_BOOL bPaint = TRUE); void SetCharSpace(FX_FLOAT fCharSpace, FX_BOOL bPaint = TRUE); void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE); @@ -87,7 +87,7 @@ public: FX_BOOL IsTextFull() const; - static FX_FLOAT GetCharArrayAutoFontSize(CPDF_Font* pFont, const CPDF_Rect& rcPlate, FX_INT32 nCharArray); + static FX_FLOAT GetCharArrayAutoFontSize(CPDF_Font* pFont, const CPDF_Rect& rcPlate, int32_t nCharArray); void SetFillerNotify(IPWL_Filler_Notify* pNotify) {m_pFillerNotify = pNotify;} @@ -116,7 +116,7 @@ private: FX_BOOL IsVScrollBarVisible() const; void SetParamByFlag(); - FX_FLOAT GetCharArrayAutoFontSize(FX_INT32 nCharArray); + FX_FLOAT GetCharArrayAutoFontSize(int32_t nCharArray); CPDF_Point GetWordRightBottomPoint(const CPVT_WordPlace& wpWord); CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1, const CPVT_WordRange& wr2); diff --git a/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h b/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h index 600c348446..2eb779ddc8 100644 --- a/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h +++ b/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h @@ -37,7 +37,7 @@ class IPWL_Edit_Notify public: virtual ~IPWL_Edit_Notify() { } //when the position of caret is changed in edit - virtual void OnCaretMove(FX_INT32 x1, FX_INT32 y1, FX_INT32 x2, FX_INT32 y2) {} + virtual void OnCaretMove(int32_t x1, int32_t y1, int32_t x2, int32_t y2) {} virtual void OnContentChange(const CPDF_Rect& rcContent){} //OprType: 0 InsertWord //1 InsertReturn @@ -73,7 +73,7 @@ public: virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag); virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag); virtual FX_BOOL OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag); - virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0); + virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); virtual void CreateChildWnd(const PWL_CREATEPARAM & cp); virtual void RePosChildWnd(); @@ -88,20 +88,20 @@ public: virtual void CutText(); CPDF_Rect GetContentRect() const; - void GetCaretPos(FX_INT32& x, FX_INT32& y) const; + void GetCaretPos(int32_t& x, int32_t& y) const; FX_BOOL IsModified() const; CFX_WideString GetText() const; - void SetSel(FX_INT32 nStartChar,FX_INT32 nEndChar); - void GetSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar ) const; - void GetTextRange(const CPDF_Rect& rect, FX_INT32 & nStartChar, FX_INT32 & nEndChar) const; - CFX_WideString GetText(FX_INT32 & nStartChar, FX_INT32 & nEndChar) const; + void SetSel(int32_t nStartChar,int32_t nEndChar); + void GetSel(int32_t & nStartChar, int32_t & nEndChar ) const; + void GetTextRange(const CPDF_Rect& rect, int32_t & nStartChar, int32_t & nEndChar) const; + CFX_WideString GetText(int32_t & nStartChar, int32_t & nEndChar) const; void Clear(); void SelectAll(); - FX_INT32 GetCaret() const; - void SetCaret(FX_INT32 nPos); - FX_INT32 GetTotalWords() const; + int32_t GetCaret() const; + void SetCaret(int32_t nPos); + int32_t GetTotalWords() const; void Paint(); @@ -111,11 +111,11 @@ public: void SetEditNotify(IPWL_Edit_Notify* pNotify) {m_pEditNotify = pNotify;} - void SetCharSet(FX_BYTE nCharSet){m_nCharSet = nCharSet;} - FX_INT32 GetCharSet() const; + void SetCharSet(uint8_t nCharSet){m_nCharSet = nCharSet;} + int32_t GetCharSet() const; - void SetCodePage(FX_INT32 nCodePage){m_nCodePage = nCodePage;} - FX_INT32 GetCodePage() const {return m_nCodePage;} + void SetCodePage(int32_t nCodePage){m_nCodePage = nCodePage;} + int32_t GetCodePage() const {return m_nCodePage;} CPDF_Font * GetCaretFont() const; FX_FLOAT GetCaretFontSize() const; @@ -129,7 +129,7 @@ public: protected: virtual void ShowVScrollBar(FX_BOOL bShow); - virtual void InsertWord(FX_WORD word, FX_INT32 nCharset); + virtual void InsertWord(FX_WORD word, int32_t nCharset); virtual void InsertReturn(); virtual void InsertText(FX_LPCWSTR csText); @@ -169,8 +169,8 @@ protected: IPWL_Edit_Notify* m_pEditNotify; private: - FX_INT32 m_nCharSet; - FX_INT32 m_nCodePage; + int32_t m_nCharSet; + int32_t m_nCodePage; }; #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_EDITCTRL_H_ diff --git a/fpdfsdk/include/pdfwindow/PWL_FontMap.h b/fpdfsdk/include/pdfwindow/PWL_FontMap.h index cdce862b29..4f44660cb2 100644 --- a/fpdfsdk/include/pdfwindow/PWL_FontMap.h +++ b/fpdfsdk/include/pdfwindow/PWL_FontMap.h @@ -16,13 +16,13 @@ class IFX_SystemHandler; struct CPWL_FontMap_Data { CPDF_Font* pFont; - FX_INT32 nCharset; + int32_t nCharset; CFX_ByteString sFontName; }; struct CPWL_FontMap_Native { - FX_INT32 nCharset; + int32_t nCharset; CFX_ByteString sFontName; }; @@ -65,51 +65,51 @@ public: CPWL_FontMap(IFX_SystemHandler* pSystemHandler); virtual ~CPWL_FontMap(); - virtual CPDF_Font* GetPDFFont(FX_INT32 nFontIndex); - virtual CFX_ByteString GetPDFFontAlias(FX_INT32 nFontIndex); - virtual FX_INT32 GetWordFontIndex(FX_WORD word, FX_INT32 nCharset, FX_INT32 nFontIndex); - virtual FX_INT32 CharCodeFromUnicode(FX_INT32 nFontIndex, FX_WORD word); - virtual FX_INT32 CharSetFromUnicode(FX_WORD word, FX_INT32 nOldCharset); + virtual CPDF_Font* GetPDFFont(int32_t nFontIndex); + virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex); + virtual int32_t GetWordFontIndex(FX_WORD word, int32_t nCharset, int32_t nFontIndex); + virtual int32_t CharCodeFromUnicode(int32_t nFontIndex, FX_WORD word); + virtual int32_t CharSetFromUnicode(FX_WORD word, int32_t nOldCharset); public: virtual void Initial(FX_LPCSTR fontname = NULL); void SetSystemHandler(IFX_SystemHandler* pSystemHandler); - FX_INT32 GetFontMapCount() const; - const CPWL_FontMap_Data* GetFontMapData(FX_INT32 nIndex) const; + int32_t GetFontMapCount() const; + const CPWL_FontMap_Data* GetFontMapData(int32_t nIndex) const; public: - static FX_INT32 GetNativeCharset(); - CFX_ByteString GetNativeFontName(FX_INT32 nCharset); + static int32_t GetNativeCharset(); + CFX_ByteString GetNativeFontName(int32_t nCharset); - static CFX_ByteString GetDefaultFontByCharset(FX_INT32 nCharset); + static CFX_ByteString GetDefaultFontByCharset(int32_t nCharset); - CPDF_Font* AddFontToDocument(CPDF_Document* pDoc, CFX_ByteString& sFontName, FX_BYTE nCharset); + CPDF_Font* AddFontToDocument(CPDF_Document* pDoc, CFX_ByteString& sFontName, uint8_t nCharset); static FX_BOOL IsStandardFont(const CFX_ByteString& sFontName); CPDF_Font* AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName); CPDF_Font* AddSystemFont(CPDF_Document* pDoc, CFX_ByteString& sFontName, - FX_BYTE nCharset); + uint8_t nCharset); protected: - virtual CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias, FX_INT32 nCharset); + virtual CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias, int32_t nCharset); virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias); - FX_BOOL KnowWord(FX_INT32 nFontIndex, FX_WORD word); + FX_BOOL KnowWord(int32_t nFontIndex, FX_WORD word); virtual CPDF_Document* GetDocument(); void Empty(); - FX_INT32 GetFontIndex(const CFX_ByteString& sFontName, FX_INT32 nCharset, FX_BOOL bFind); - FX_INT32 GetPWLFontIndex(FX_WORD word, FX_INT32 nCharset); - FX_INT32 AddFontData(CPDF_Font* pFont, const CFX_ByteString& sFontAlias, FX_INT32 nCharset = DEFAULT_CHARSET); + int32_t GetFontIndex(const CFX_ByteString& sFontName, int32_t nCharset, FX_BOOL bFind); + int32_t GetPWLFontIndex(FX_WORD word, int32_t nCharset); + int32_t AddFontData(CPDF_Font* pFont, const CFX_ByteString& sFontAlias, int32_t nCharset = DEFAULT_CHARSET); - CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName, FX_INT32 nCharset); + CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName, int32_t nCharset); CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName); private: - CFX_ByteString GetFontName(FX_INT32 nFontIndex); - FX_INT32 FindFont(const CFX_ByteString& sFontName, FX_INT32 nCharset = DEFAULT_CHARSET); + CFX_ByteString GetFontName(int32_t nFontIndex); + int32_t FindFont(const CFX_ByteString& sFontName, int32_t nCharset = DEFAULT_CHARSET); - CFX_ByteString GetNativeFont(FX_INT32 nCharset); + CFX_ByteString GetNativeFont(int32_t nCharset); public: using CharsetFontMap = FPDF_CharsetFontMap; diff --git a/fpdfsdk/include/pdfwindow/PWL_Icon.h b/fpdfsdk/include/pdfwindow/PWL_Icon.h index cb56a9929e..c09f7a9fe8 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Icon.h +++ b/fpdfsdk/include/pdfwindow/PWL_Icon.h @@ -45,7 +45,7 @@ public: virtual void GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale); virtual void GetImageOffset(FX_FLOAT & x,FX_FLOAT & y); - FX_INT32 GetScaleMethod(); + int32_t GetScaleMethod(); FX_BOOL IsProportionalScale(); void GetIconPosition(FX_FLOAT & fLeft, FX_FLOAT & fBottom); FX_BOOL GetFittingBounds(); diff --git a/fpdfsdk/include/pdfwindow/PWL_IconList.h b/fpdfsdk/include/pdfwindow/PWL_IconList.h index d074b76be1..74438c2afd 100644 --- a/fpdfsdk/include/pdfwindow/PWL_IconList.h +++ b/fpdfsdk/include/pdfwindow/PWL_IconList.h @@ -21,7 +21,7 @@ class IPWL_IconList_Notify { public: virtual ~IPWL_IconList_Notify() { } - virtual void OnNoteListSelChanged(FX_INT32 nItemIndex) = 0; + virtual void OnNoteListSelChanged(int32_t nItemIndex) = 0; }; class CPWL_IconList_Item : public CPWL_Wnd @@ -37,7 +37,7 @@ public: void SetSelect(FX_BOOL bSelected); FX_BOOL IsSelected() const; void SetData(void* pData); - void SetIcon(FX_INT32 nIconIndex); + void SetIcon(int32_t nIconIndex); void SetText(const CFX_WideString& str); void SetIconFillColor(const CPWL_Color& color); CFX_WideString GetText() const; @@ -50,7 +50,7 @@ protected: virtual void OnDisabled(); private: - FX_INT32 m_nIconIndex; + int32_t m_nIconIndex; void* m_pData; FX_BOOL m_bSelected; CPWL_Label* m_pText; @@ -60,20 +60,20 @@ private: class CPWL_IconList_Content : public CPWL_ListCtrl { public: - CPWL_IconList_Content(FX_INT32 nListCount); + CPWL_IconList_Content(int32_t nListCount); virtual ~CPWL_IconList_Content(); - void SetSelect(FX_INT32 nIndex); - FX_INT32 GetSelect() const; + void SetSelect(int32_t nIndex); + int32_t GetSelect() const; void SetNotify(IPWL_IconList_Notify* pNotify); void EnableNotify(FX_BOOL bNotify); - void SetListData(FX_INT32 nItemIndex, void* pData); - void SetListIcon(FX_INT32 nItemIndex, FX_INT32 nIconIndex); - void SetListString(FX_INT32 nItemIndex, const CFX_WideString& str); + void SetListData(int32_t nItemIndex, void* pData); + void SetListIcon(int32_t nItemIndex, int32_t nIconIndex); + void SetListString(int32_t nItemIndex, const CFX_WideString& str); void SetIconFillColor(const CPWL_Color& color); - CFX_WideString GetListString(FX_INT32 nItemIndex) const; + CFX_WideString GetListString(int32_t nItemIndex) const; IPWL_IconList_Notify* GetNotify() const; - void ScrollToItem(FX_INT32 nItemIndex); + void ScrollToItem(int32_t nItemIndex); protected: virtual void CreateChildWnd(const PWL_CREATEPARAM & cp); @@ -83,46 +83,46 @@ protected: virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag); private: - CPWL_IconList_Item* GetListItem(FX_INT32 nItemIndex) const; - void SelectItem(FX_INT32 nItemIndex, FX_BOOL bSelect); - FX_INT32 FindItemIndex(const CPDF_Point& point); + CPWL_IconList_Item* GetListItem(int32_t nItemIndex) const; + void SelectItem(int32_t nItemIndex, FX_BOOL bSelect); + int32_t FindItemIndex(const CPDF_Point& point); FX_BOOL m_nSelectIndex; IPWL_IconList_Notify* m_pNotify; FX_BOOL m_bEnableNotify; FX_BOOL m_bMouseDown; - FX_INT32 m_nListCount; + int32_t m_nListCount; }; class PWL_CLASS CPWL_IconList : public CPWL_Wnd { public: - CPWL_IconList(FX_INT32 nListCount); + CPWL_IconList(int32_t nListCount); virtual ~CPWL_IconList(); virtual FX_BOOL OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag); - void SetSelect(FX_INT32 nIndex); - void SetTopItem(FX_INT32 nIndex); - FX_INT32 GetSelect() const; + void SetSelect(int32_t nIndex); + void SetTopItem(int32_t nIndex); + int32_t GetSelect() const; void SetNotify(IPWL_IconList_Notify* pNotify); void EnableNotify(FX_BOOL bNotify); - void SetListData(FX_INT32 nItemIndex, void* pData); - void SetListIcon(FX_INT32 nItemIndex, FX_INT32 nIconIndex); - void SetListString(FX_INT32 nItemIndex, const CFX_WideString& str); + void SetListData(int32_t nItemIndex, void* pData); + void SetListIcon(int32_t nItemIndex, int32_t nIconIndex); + void SetListString(int32_t nItemIndex, const CFX_WideString& str); void SetIconFillColor(const CPWL_Color& color); - CFX_WideString GetListString(FX_INT32 nItemIndex) const; + CFX_WideString GetListString(int32_t nItemIndex) const; protected: virtual void OnCreated(); virtual void RePosChildWnd(); virtual void CreateChildWnd(const PWL_CREATEPARAM & cp); - virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0); + virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); private: CPWL_IconList_Content* m_pListContent; - FX_INT32 m_nListCount; + int32_t m_nListCount; }; #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_ICONLIST_H_ diff --git a/fpdfsdk/include/pdfwindow/PWL_Label.h b/fpdfsdk/include/pdfwindow/PWL_Label.h index f724a0a82b..be083db486 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Label.h +++ b/fpdfsdk/include/pdfwindow/PWL_Label.h @@ -23,11 +23,11 @@ public: void SetText(FX_LPCWSTR csText); CFX_WideString GetText() const; - void SetLimitChar(FX_INT32 nLimitChar); - void SetHorzScale(FX_INT32 nHorzScale); + void SetLimitChar(int32_t nLimitChar); + void SetHorzScale(int32_t nHorzScale); void SetCharSpace(FX_FLOAT fCharSpace); CPDF_Rect GetContentRect() const; - FX_INT32 GetTotalWords(); + int32_t GetTotalWords(); CFX_ByteString GetTextAppearanceStream(const CPDF_Point & ptOffset) const; protected: diff --git a/fpdfsdk/include/pdfwindow/PWL_ListBox.h b/fpdfsdk/include/pdfwindow/PWL_ListBox.h index e8e9036b8e..c5a6df76dd 100644 --- a/fpdfsdk/include/pdfwindow/PWL_ListBox.h +++ b/fpdfsdk/include/pdfwindow/PWL_ListBox.h @@ -57,7 +57,7 @@ public: virtual FX_BOOL OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag); virtual void KillFocus(); - virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0); + virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); virtual void RePosChildWnd(); virtual void SetText(FX_LPCWSTR csText,FX_BOOL bRefresh = TRUE); virtual CFX_WideString GetText() const; @@ -68,21 +68,21 @@ public: void OnNotifySelChanged(FX_BOOL bKeyDown, FX_BOOL & bExit , FX_DWORD nFlag); void AddString(FX_LPCWSTR string); - void SetTopVisibleIndex(FX_INT32 nItemIndex); - void ScrollToListItem(FX_INT32 nItemIndex); + void SetTopVisibleIndex(int32_t nItemIndex); + void ScrollToListItem(int32_t nItemIndex); void ResetContent(); void Reset(); - void Select(FX_INT32 nItemIndex); - void SetCaret(FX_INT32 nItemIndex); + void Select(int32_t nItemIndex); + void SetCaret(int32_t nItemIndex); void SetHoverSel(FX_BOOL bHoverSel); - FX_INT32 GetCount() const; + int32_t GetCount() const; FX_BOOL IsMultipleSel() const; - FX_INT32 GetCaretIndex() const; - FX_INT32 GetCurSel() const; - FX_BOOL IsItemSelected(FX_INT32 nItemIndex) const; - FX_INT32 GetTopVisibleIndex() const; - FX_INT32 FindNext(FX_INT32 nIndex,FX_WCHAR nChar) const; + int32_t GetCaretIndex() const; + int32_t GetCurSel() const; + FX_BOOL IsItemSelected(int32_t nItemIndex) const; + int32_t GetTopVisibleIndex() const; + int32_t FindNext(int32_t nIndex,FX_WCHAR nChar) const; CPDF_Rect GetContentRect() const; FX_FLOAT GetFirstHeight() const; CPDF_Rect GetListRect() const; diff --git a/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h b/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h index 65df7aecfc..56a1fbf919 100644 --- a/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h +++ b/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h @@ -22,8 +22,8 @@ public: void SetTopSpace(FX_FLOAT fSpace); void SetBottomSpace(FX_FLOAT fSpace); void ResetFace(); - void ResetContent(FX_INT32 nStart); - FX_INT32 GetItemIndex(CPWL_Wnd* pItem); + void ResetContent(int32_t nStart); + int32_t GetItemIndex(CPWL_Wnd* pItem); FX_FLOAT GetContentsHeight(FX_FLOAT fLimitWidth); CPDF_Point InToOut(const CPDF_Point& point) const; CPDF_Point OutToIn(const CPDF_Point& point) const; @@ -35,7 +35,7 @@ protected: virtual void DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); private: - void ResetAll(FX_BOOL bMove,FX_INT32 nStart); + void ResetAll(FX_BOOL bMove,int32_t nStart); CPDF_Rect m_rcContent; CPDF_Point m_ptScroll; diff --git a/fpdfsdk/include/pdfwindow/PWL_Note.h b/fpdfsdk/include/pdfwindow/PWL_Note.h index c5cdc4dd9c..a9e6dda05b 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Note.h +++ b/fpdfsdk/include/pdfwindow/PWL_Note.h @@ -43,8 +43,8 @@ public: virtual void OnSetContents(IPWL_NoteItem* pItem) = 0; virtual void OnSetDateTime(IPWL_NoteItem* pItem) = 0; virtual void OnSetSubjectName(IPWL_NoteItem* pItem) = 0; - virtual void OnPopupMenu(FX_INT32 x, FX_INT32 y) = 0; - virtual void OnPopupMenu(IPWL_NoteItem* pItem, FX_INT32 x, FX_INT32 y) = 0; + virtual void OnPopupMenu(int32_t x, int32_t y) = 0; + virtual void OnPopupMenu(IPWL_NoteItem* pItem, int32_t x, int32_t y) = 0; }; class IPWL_NoteHandler @@ -66,8 +66,8 @@ public: virtual void SetContents(const CFX_WideString& sContents) = 0; virtual IPWL_NoteItem* CreateSubItem() = 0; - virtual FX_INT32 CountSubItems() const = 0; - virtual IPWL_NoteItem* GetSubItems(FX_INT32 index) const = 0; + virtual int32_t CountSubItems() const = 0; + virtual IPWL_NoteItem* GetSubItems(int32_t index) const = 0; virtual void DeleteSubItem(IPWL_NoteItem* pNoteItem) = 0; virtual void SetFocus() = 0; @@ -88,7 +88,7 @@ public: CPWL_Note_Icon(); virtual ~CPWL_Note_Icon(); - void SetIconType(FX_INT32 nType); + void SetIconType(int32_t nType); public: @@ -96,7 +96,7 @@ protected: virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); private: - FX_INT32 m_nType; + int32_t m_nType; }; class CPWL_Note_CloseBox : public CPWL_Button @@ -148,7 +148,7 @@ public: virtual void SetText(FX_LPCWSTR csText); protected: - virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0); + virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); virtual void RePosChildWnd(); virtual void OnSetFocus(); virtual void OnKillFocus(); @@ -187,7 +187,7 @@ public: virtual ~CPWL_Note_Contents(); virtual CFX_ByteString GetClassName() const; - virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0); + virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag); void SetEditFocus(FX_BOOL bLast); @@ -199,8 +199,8 @@ public: CPWL_NoteItem* CreateSubItem(); void DeleteSubItem(IPWL_NoteItem* pNoteItem); - FX_INT32 CountSubItems() const; - IPWL_NoteItem* GetSubItems(FX_INT32 index) const; + int32_t CountSubItems() const; + IPWL_NoteItem* GetSubItems(int32_t index) const; virtual IPWL_NoteItem* GetHitNoteItem(const CPDF_Point& point); void EnableRead(FX_BOOL bEnabled); @@ -228,8 +228,8 @@ public: virtual void SetContents(const CFX_WideString& sContents); virtual IPWL_NoteItem* CreateSubItem(); - virtual FX_INT32 CountSubItems() const; - virtual IPWL_NoteItem* GetSubItems(FX_INT32 index) const; + virtual int32_t CountSubItems() const; + virtual IPWL_NoteItem* GetSubItems(int32_t index) const; virtual void DeleteSubItem(IPWL_NoteItem* pNoteItem); virtual void SetFocus(){SetNoteFocus(FALSE);} @@ -250,7 +250,7 @@ public: virtual IPWL_NoteItem* GetHitNoteItem(const CPDF_Point& point); virtual IPWL_NoteItem* GetFocusedNoteItem() const; - virtual void ResetSubjectName(FX_INT32 nItemIndex); + virtual void ResetSubjectName(int32_t nItemIndex); void EnableRead(FX_BOOL bEnabled); void EnableModify(FX_BOOL bEnabled); @@ -258,7 +258,7 @@ protected: virtual void RePosChildWnd(); virtual void CreateChildWnd(const PWL_CREATEPARAM & cp); - virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0); + virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); public: virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth); @@ -304,7 +304,7 @@ public: virtual void SetAuthorName(const CFX_WideString& sName); virtual CFX_WideString GetAuthorName() const; virtual void SetBkColor(const CPWL_Color& color); - virtual void ResetSubjectName(FX_INT32 nItemIndex){} + virtual void ResetSubjectName(int32_t nItemIndex){} virtual FX_BOOL IsTopItem() const {return TRUE;} virtual const CPWL_Note* GetNote() const; virtual IPWL_NoteNotify* GetNoteNotify() const; @@ -312,7 +312,7 @@ public: public: IPWL_NoteItem* Reply(); void EnableNotify(FX_BOOL bEnabled); - void SetIconType(FX_INT32 nType); + void SetIconType(int32_t nType); void SetOptionsText(const CFX_WideString& sText); void EnableRead(FX_BOOL bEnabled); void EnableModify(FX_BOOL bEnabled); @@ -321,7 +321,7 @@ public: void SetReplyString(const CFX_WideString& string); //0-normal / 1-caption / 2-leftbottom corner / 3-rightbottom corner / 4-close / 5-options - FX_INT32 NoteHitTest(const CPDF_Point& point) const; + int32_t NoteHitTest(const CPDF_Point& point) const; CPDF_Rect GetCaptionRect() const {return m_rcCaption;} IPopup_Note* GetPopupNote() const {return m_pPopupNote;} @@ -334,7 +334,7 @@ protected: virtual void RePosChildWnd(); virtual void CreateChildWnd(const PWL_CREATEPARAM & cp); - virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0); + virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); FX_BOOL ResetScrollBar(); void RePosNoteChildren(); diff --git a/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h b/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h index 2f0473f1d2..bf92399e88 100644 --- a/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h +++ b/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h @@ -112,7 +112,7 @@ public: virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag); virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag); - virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0); + virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); virtual void CreateChildWnd(const PWL_CREATEPARAM & cp); diff --git a/fpdfsdk/include/pdfwindow/PWL_Utils.h b/fpdfsdk/include/pdfwindow/PWL_Utils.h index 51514f2513..9f121e80a8 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Utils.h +++ b/fpdfsdk/include/pdfwindow/PWL_Utils.h @@ -18,7 +18,7 @@ struct CPWL_Color; template T PWL_MIN (const T & i, const T & j) { return ((i < j) ? i : j); } template T PWL_MAX (const T & i, const T & j) { return ((i > j) ? i : j); } -#define PWL_PDF2WIN(color) (FX_BYTE(color*255)) +#define PWL_PDF2WIN(color) (uint8_t(color*255)) #define PWL_WIN2PDF(color) ((FX_FLOAT)((FX_FLOAT)color/255.0f)) #define PWL_MAKEDWORD(low,high) ((FX_DWORD)((FX_WORD)(low) | (FX_DWORD)(((FX_WORD)(high))<<16))) @@ -119,17 +119,17 @@ public: static CPDF_Rect MaxRect(const CPDF_Rect & rect1,const CPDF_Rect & rect2); static CPDF_Rect OffsetRect(const CPDF_Rect & rect,FX_FLOAT x,FX_FLOAT y); static CPDF_Point OffsetPoint(const CPDF_Point & point,FX_FLOAT x,FX_FLOAT y); - static FX_COLORREF PWLColorToFXColor(const CPWL_Color& color, FX_INT32 nTransparancy = 255); + static FX_COLORREF PWLColorToFXColor(const CPWL_Color& color, int32_t nTransparancy = 255); static FX_BOOL IsBlackOrWhite(const CPWL_Color& color); static CPWL_Color GetReverseColor(const CPWL_Color& color); static CFX_ByteString GetColorAppStream(const CPWL_Color & color,const FX_BOOL & bFillOrStroke = TRUE); static CFX_ByteString GetBorderAppStream(const CPDF_Rect & rect, FX_FLOAT fWidth, const CPWL_Color & color, const CPWL_Color & crLeftTop, const CPWL_Color & crRightBottom, - FX_INT32 nStyle, const CPWL_Dash & dash); + int32_t nStyle, const CPWL_Dash & dash); static CFX_ByteString GetCircleBorderAppStream(const CPDF_Rect & rect, FX_FLOAT fWidth, const CPWL_Color & color, const CPWL_Color & crLeftTop, const CPWL_Color & crRightBottom, - FX_INT32 nStyle, const CPWL_Dash & dash); + int32_t nStyle, const CPWL_Dash & dash); static CFX_ByteString GetRectFillAppStream(const CPDF_Rect & rect,const CPWL_Color & color); static CFX_ByteString GetCircleFillAppStream(const CPDF_Rect & rect,const CPWL_Color & color); @@ -140,12 +140,12 @@ public: const CFX_WideString & sLabel, const CPWL_Color & crText, FX_FLOAT fFontSize, - FX_INT32 nLayOut); + int32_t nLayOut); static CFX_ByteString GetCheckBoxAppStream(const CPDF_Rect & rcBBox, - FX_INT32 nStyle, + int32_t nStyle, const CPWL_Color & crText); static CFX_ByteString GetRadioButtonAppStream(const CPDF_Rect & rcBBox, - FX_INT32 nStyle, + int32_t nStyle, const CPWL_Color & crText); static CFX_ByteString GetEditAppStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange * pRange = NULL, @@ -156,12 +156,12 @@ public: const CPDF_Point & ptOffset, const CPVT_WordRange * pRange = NULL); static CFX_ByteString GetTextAppStream(const CPDF_Rect & rcBBox,IFX_Edit_FontMap * pFontMap, - const CFX_WideString & sText, FX_INT32 nAlignmentH, FX_INT32 nAlignmentV, + const CFX_WideString & sText, int32_t nAlignmentH, int32_t nAlignmentV, FX_FLOAT fFontSize, FX_BOOL bMultiLine, FX_BOOL bAutoReturn, const CPWL_Color & crText); static CFX_ByteString GetDropButtonAppStream(const CPDF_Rect & rcBBox); static void DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,const CPDF_Rect & rect, - const CPWL_Color & color, FX_INT32 nTransparancy); + const CPWL_Color & color, int32_t nTransparancy); static void DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, const CPDF_Rect & rect,const FX_COLORREF & color); static void DrawStrokeRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,const CPDF_Rect & rect, @@ -171,12 +171,12 @@ public: static void DrawBorder(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, const CPDF_Rect & rect, FX_FLOAT fWidth, const CPWL_Color & color, const CPWL_Color & crLeftTop, const CPWL_Color & crRightBottom, - FX_INT32 nStyle, const CPWL_Dash & dash, FX_INT32 nTransparancy); + int32_t nStyle, const CPWL_Dash & dash, int32_t nTransparancy); static void DrawFillArea(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, - const CPDF_Point* pPts, FX_INT32 nCount, const FX_COLORREF& color); + const CPDF_Point* pPts, int32_t nCount, const FX_COLORREF& color); static void DrawShadow(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, FX_BOOL bVertical, FX_BOOL bHorizontal, CPDF_Rect rect, - FX_INT32 nTransparancy, FX_INT32 nStartGray, FX_INT32 nEndGray); + int32_t nTransparancy, int32_t nStartGray, int32_t nEndGray); static void DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, IPWL_SpellCheck* pSpellCheck); @@ -190,18 +190,18 @@ public: static void ConvertCMYK2GRAY(FX_FLOAT dC,FX_FLOAT dM,FX_FLOAT dY,FX_FLOAT dK,FX_FLOAT &dGray); static void ConvertGRAY2CMYK(FX_FLOAT dGray,FX_FLOAT &dC,FX_FLOAT &dM,FX_FLOAT &dY,FX_FLOAT &dK); - static void PWLColorToARGB(const CPWL_Color& color, FX_INT32& alpha, FX_FLOAT& red, FX_FLOAT& green, FX_FLOAT& blue); + static void PWLColorToARGB(const CPWL_Color& color, int32_t& alpha, FX_FLOAT& red, FX_FLOAT& green, FX_FLOAT& blue); public: - static CFX_ByteString GetIconAppStream(FX_INT32 nType, const CPDF_Rect& rect, const CPWL_Color& crFill, + static CFX_ByteString GetIconAppStream(int32_t nType, const CPDF_Rect& rect, const CPWL_Color& crFill, const CPWL_Color& crStroke = PWL_DEFAULT_BLACKCOLOR); static void DrawIconAppStream(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, - FX_INT32 nType, const CPDF_Rect & rect, const CPWL_Color& crFill, - const CPWL_Color& crStroke, const FX_INT32 nTransparancy); + int32_t nType, const CPDF_Rect & rect, const CPWL_Color& crFill, + const CPWL_Color& crStroke, const int32_t nTransparancy); private: - static CFX_ByteString GetAppStreamFromArray(const CPWL_PathData* pPathData, FX_INT32 nCount); - static void GetPathDataFromArray(CFX_PathData& path, const CPWL_PathData* pPathData, FX_INT32 nCount); + static CFX_ByteString GetAppStreamFromArray(const CPWL_PathData* pPathData, int32_t nCount); + static void GetPathDataFromArray(CFX_PathData& path, const CPWL_PathData* pPathData, int32_t nCount); static CFX_ByteString GetAppStream_Check(const CPDF_Rect & rcBBox, const CPWL_Color & crText); static CFX_ByteString GetAppStream_Circle(const CPDF_Rect & rcBBox, const CPWL_Color & crText); diff --git a/fpdfsdk/include/pdfwindow/PWL_Wnd.h b/fpdfsdk/include/pdfwindow/PWL_Wnd.h index 4fa1c7639b..970480f14a 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/include/pdfwindow/PWL_Wnd.h @@ -107,25 +107,25 @@ class IPWL_SpellCheck; struct CPWL_Dash { - CPWL_Dash(FX_INT32 dash, FX_INT32 gap, FX_INT32 phase) : nDash(dash), nGap(gap), nPhase(phase) + CPWL_Dash(int32_t dash, int32_t gap, int32_t phase) : nDash(dash), nGap(gap), nPhase(phase) {} - FX_INT32 nDash; - FX_INT32 nGap; - FX_INT32 nPhase; + int32_t nDash; + int32_t nGap; + int32_t nPhase; }; struct PWL_CLASS CPWL_Color { - CPWL_Color(FX_INT32 type = COLORTYPE_TRANSPARENT, FX_FLOAT color1 = 0.0f, FX_FLOAT color2 = 0.0f, FX_FLOAT color3 = 0.0f, FX_FLOAT color4 = 0.0f) + CPWL_Color(int32_t type = COLORTYPE_TRANSPARENT, FX_FLOAT color1 = 0.0f, FX_FLOAT color2 = 0.0f, FX_FLOAT color3 = 0.0f, FX_FLOAT color4 = 0.0f) : nColorType(type), fColor1(color1), fColor2(color2), fColor3(color3), fColor4(color4) {} - CPWL_Color(FX_INT32 r, FX_INT32 g, FX_INT32 b) : + CPWL_Color(int32_t r, int32_t g, int32_t b) : nColorType(COLORTYPE_RGB), fColor1(r/255.0f), fColor2(g/255.0f), fColor3(b/255.0f), fColor4(0) {} - void ConvertColorType(FX_INT32 nColorType); + void ConvertColorType(int32_t nColorType); /* COLORTYPE_TRANSPARENT @@ -133,7 +133,7 @@ struct PWL_CLASS CPWL_Color COLORTYPE_CMYK COLORTYPE_GRAY */ - FX_INT32 nColorType; + int32_t nColorType; FX_FLOAT fColor1,fColor2,fColor3,fColor4; }; @@ -194,7 +194,7 @@ public: 5 L"&Delete" 6 L"&Select All\tCtrl+A" */ - virtual CFX_WideString LoadPopupMenuString(FX_INT32 nIndex) = 0; + virtual CFX_WideString LoadPopupMenuString(int32_t nIndex) = 0; }; class IPWL_FocusHandler @@ -242,18 +242,18 @@ public: CPWL_Color sBackgroundColor; //optional FX_HWND hAttachedWnd; //required for no-reader framework IPWL_SpellCheck* pSpellCheck; //required for spellchecking - FX_INT32 nBorderStyle; //optional - FX_INT32 dwBorderWidth; //optional + int32_t nBorderStyle; //optional + int32_t dwBorderWidth; //optional CPWL_Color sBorderColor; //optional CPWL_Color sTextColor; //optional CPWL_Color sTextStrokeColor; //optional - FX_INT32 nTransparency; //optional + int32_t nTransparency; //optional FX_FLOAT fFontSize; //optional CPWL_Dash sDash; //optional void* pAttachedData; //optional CPWL_Wnd* pParentWnd; //ignore CPWL_MsgControl* pMsgControl; //ignore - FX_INT32 eCursorType; //ignore + int32_t eCursorType; //ignore CPDF_Matrix mtChild; //ignore }; @@ -263,12 +263,12 @@ public: CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemHandler); virtual ~CPWL_Timer(); - FX_INT32 SetPWLTimer(FX_INT32 nElapse); + int32_t SetPWLTimer(int32_t nElapse); void KillPWLTimer(); - static void TimerProc(FX_INT32 idEvent); + static void TimerProc(int32_t idEvent); private: - FX_INT32 m_nTimerID; + int32_t m_nTimerID; CPWL_TimerHandler* m_pAttached; IFX_SystemHandler* m_pSystemHandler; }; @@ -279,7 +279,7 @@ public: CPWL_TimerHandler(); virtual ~CPWL_TimerHandler(); - void BeginTimer(FX_INT32 nElapse); + void BeginTimer(int32_t nElapse); void EndTimer(); virtual void TimerProc(); virtual IFX_SystemHandler* GetSystemHandler() const = 0; @@ -324,7 +324,7 @@ public: void SetCapture(); void ReleaseCapture(); - virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0); + virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); virtual void SetTextColor(const CPWL_Color & color); virtual void SetTextStrokeColor(const CPWL_Color & color); virtual void SetVisible(FX_BOOL bVisible); @@ -335,9 +335,9 @@ public: virtual CPWL_Color GetTextColor() const; virtual CPWL_Color GetTextStrokeColor() const; virtual FX_FLOAT GetFontSize() const; - virtual FX_INT32 GetInnerBorderWidth() const; - virtual CPWL_Color GetBorderLeftTopColor(FX_INT32 nBorderStyle) const; - virtual CPWL_Color GetBorderRightBottomColor(FX_INT32 nBorderStyle) const; + virtual int32_t GetInnerBorderWidth() const; + virtual CPWL_Color GetBorderLeftTopColor(int32_t nBorderStyle) const; + virtual CPWL_Color GetBorderRightBottomColor(int32_t nBorderStyle) const; virtual FX_BOOL IsModified() const {return FALSE;} @@ -345,9 +345,9 @@ public: void SetBackgroundColor(const CPWL_Color & color); void SetBorderColor(const CPWL_Color & color); - void SetBorderWidth(FX_INT32 nBorderWidth); + void SetBorderWidth(int32_t nBorderWidth); void SetClipRect(const CPDF_Rect & rect); - void SetBorderStyle(FX_INT32 eBorderStyle); + void SetBorderStyle(int32_t eBorderStyle); void SetBorderDash(const CPWL_Dash & sDash); CPDF_Rect GetOriginWindowRect() const; @@ -356,14 +356,14 @@ public: CPDF_Point GetCenterPoint() const; CPDF_Rect GetClientCenterSquare() const; CPDF_Rect GetWindowCenterSquare() const; - FX_INT32 GetBorderWidth() const; + int32_t GetBorderWidth() const; FX_BOOL IsVisible() const {return m_bVisible;} FX_BOOL HasFlag(FX_DWORD dwFlags) const; void AddFlag(FX_DWORD dwFlags); void RemoveFlag(FX_DWORD dwFlags); CPDF_Rect GetClipRect() const; CPWL_Wnd* GetParentWindow() const; - FX_INT32 GetBorderStyle() const; + int32_t GetBorderStyle() const; CPWL_Dash GetBorderDash() const; void* GetAttachedData() const; @@ -381,8 +381,8 @@ public: virtual IFX_SystemHandler* GetSystemHandler() const; IPWL_FocusHandler* GetFocusHandler() const; - FX_INT32 GetTransparency(); - void SetTransparency(FX_INT32 nTransparency); + int32_t GetTransparency(); + void SetTransparency(int32_t nTransparency); CPDF_Matrix GetChildToRoot() const; CPDF_Matrix GetChildMatrix() const; @@ -431,7 +431,7 @@ protected: void InvalidateRectMove(const CPDF_Rect & rcOld, const CPDF_Rect & rcNew); - void PWLtoWnd(const CPDF_Point & point, FX_INT32& x, FX_INT32& y) const; + void PWLtoWnd(const CPDF_Point & point, int32_t& x, int32_t& y) const; FX_RECT PWLtoWnd(const CPDF_Rect & rect) const; FX_HWND GetAttachedHWnd() const; diff --git a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp index 41112600de..11600b75f8 100644 --- a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp +++ b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp @@ -45,7 +45,7 @@ void CBA_FontMap::Reset() void CBA_FontMap::Initial(FX_LPCSTR fontname) { - FX_INT32 nCharset = DEFAULT_CHARSET; + int32_t nCharset = DEFAULT_CHARSET; if (!m_pDefaultFont) { @@ -83,13 +83,13 @@ void CBA_FontMap::SetDefaultFont(CPDF_Font * pFont, const CFX_ByteString & sFont // if (m_sDefaultFontName.IsEmpty()) // m_sDefaultFontName = pFont->GetFontTypeName(); - FX_INT32 nCharset = DEFAULT_CHARSET; + int32_t nCharset = DEFAULT_CHARSET; if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont()) nCharset = pSubstFont->m_Charset; AddFontData(m_pDefaultFont, m_sDefaultFontName, nCharset); } -CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias, FX_INT32 nCharset) +CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias, int32_t nCharset) { ASSERT(m_pAnnotDict != NULL); @@ -119,7 +119,7 @@ CPDF_Document* CBA_FontMap::GetDocument() } CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict, CFX_ByteString& sFontAlias, - FX_INT32 nCharset) + int32_t nCharset) { if (!pResDict) return NULL; @@ -187,7 +187,7 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont, const CFX_ByteString& sAl if (pStream == NULL) { pStream = new CPDF_Stream(NULL, 0, NULL); - FX_INT32 objnum = m_pDocument->AddIndirectObject(pStream); + int32_t objnum = m_pDocument->AddIndirectObject(pStream); pAPDict->SetAtReference(m_sAPType, m_pDocument, objnum); } @@ -214,7 +214,7 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont, const CFX_ByteString& sAl if (!pStreamResFontList) { pStreamResFontList = new CPDF_Dictionary; - FX_INT32 objnum = m_pDocument->AddIndirectObject(pStreamResFontList); + int32_t objnum = m_pDocument->AddIndirectObject(pStreamResFontList); pStreamResList->SetAtReference("Font", m_pDocument, objnum); } if (!pStreamResFontList->KeyExist(sAlias)) diff --git a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp index f8035c7ec9..dad485cac3 100644 --- a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp @@ -124,7 +124,7 @@ void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView) CPDF_FormField* pField = m_pWidget->GetFormField(); ASSERT(pField != NULL); - for (FX_INT32 i=0,sz=pField->CountControls(); iCountControls(); iGetControl(i)) { diff --git a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp index 012ed4a730..3c74c9f7e1 100644 --- a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp @@ -80,14 +80,14 @@ CPWL_Wnd* CFFL_ComboBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageVie CFFL_IFormFiller* pFormFiller = m_pApp->GetIFormFiller(); pWnd->SetFillerNotify(pFormFiller); - FX_INT32 nCurSel = m_pWidget->GetSelectedIndex(0); + int32_t nCurSel = m_pWidget->GetSelectedIndex(0); CFX_WideString swText; if (nCurSel < 0) swText = m_pWidget->GetValue(); else swText = m_pWidget->GetOptionLabel(nCurSel); - for (FX_INT32 i=0,sz=m_pWidget->CountOptions(); iCountOptions(); iAddString(m_pWidget->GetOptionLabel(i).c_str()); } @@ -107,7 +107,7 @@ FX_BOOL CFFL_ComboBox::IsDataChanged(CPDFSDK_PageView* pPageView) { if (CPWL_ComboBox * pWnd = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)) { - FX_INT32 nCurSel = pWnd->GetSelect(); + int32_t nCurSel = pWnd->GetSelect(); ASSERT(m_pWidget != NULL); @@ -138,7 +138,7 @@ void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) if (CPWL_ComboBox* pWnd = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)) { CFX_WideString swText = pWnd->GetText(); - FX_INT32 nCurSel = pWnd->GetSelect(); + int32_t nCurSel = pWnd->GetSelect(); //mantis:0004157 FX_BOOL bSetValue = TRUE; diff --git a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp index 530b80ce6f..1e2db7004a 100644 --- a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp +++ b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp @@ -9,9 +9,9 @@ #include "../../include/formfiller/FFL_Notify.h" #include "../../include/formfiller/FFL_CBA_Fontmap.h" -#define GetRed(rgb) ((FX_BYTE)(rgb)) -#define GetGreen(rgb) ((FX_BYTE)(((FX_WORD)(rgb)) >> 8)) -#define GetBlue(rgb) ((FX_BYTE)((rgb)>>16)) +#define GetRed(rgb) ((uint8_t)(rgb)) +#define GetGreen(rgb) ((uint8_t)(((FX_WORD)(rgb)) >> 8)) +#define GetBlue(rgb) ((uint8_t)((rgb)>>16)) #define FFL_HINT_ELAPSE 800 diff --git a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp index 1656ba5c5d..b2d80abc35 100644 --- a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp +++ b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp @@ -719,7 +719,7 @@ void CFFL_IFormFiller::SetFocusAnnotTab(CPDFSDK_Annot* pWidget, FX_BOOL bSameFie } -void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX_FLOAT fPopupMax, FX_INT32 & nRet, FX_FLOAT & fPopupRet) +void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX_FLOAT fPopupMax, int32_t & nRet, FX_FLOAT & fPopupRet) { ASSERT(pPrivateData != NULL); @@ -834,7 +834,7 @@ void CFFL_IFormFiller::OnSetWindowRect(void* pPrivateData, const CPDF_Rect & rcW } } -void CFFL_IFormFiller::OnKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode, CFX_WideString& strChange, +void CFFL_IFormFiller::OnKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, int32_t nKeyCode, CFX_WideString& strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit) { @@ -1097,7 +1097,7 @@ void CFFL_IFormFiller::DoPaste(CPDFSDK_Document* pDocument) { } -void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode, +void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, int32_t nKeyCode, CFX_WideString & strChange, const CFX_WideString& strChangeEx, int nSelStart, int nSelEnd, FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag) diff --git a/fpdfsdk/src/formfiller/FFL_ListBox.cpp b/fpdfsdk/src/formfiller/FFL_ListBox.cpp index dffd17538f..6b0aa1b347 100644 --- a/fpdfsdk/src/formfiller/FFL_ListBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_ListBox.cpp @@ -76,7 +76,7 @@ CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); pWnd->SetFillerNotify(pIFormFiller); - for (FX_INT32 i=0,sz=m_pWidget->CountOptions(); iCountOptions(); iAddString(m_pWidget->GetOptionLabel(i).c_str()); if (pWnd->HasFlag(PLBS_MULTIPLESEL)) @@ -84,7 +84,7 @@ CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView m_OriginSelections.RemoveAll(); FX_BOOL bSetCaret = FALSE; - for (FX_INT32 i=0,sz=m_pWidget->CountOptions(); iCountOptions(); iIsOptionSelected(i)) { @@ -130,7 +130,7 @@ FX_BOOL CFFL_ListBox::IsDataChanged(CPDFSDK_PageView* pPageView) if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) { int nSelCount = 0; - for (FX_INT32 i=0,sz=pListBox->GetCount(); iGetCount(); iIsItemSelected(i)) { @@ -172,13 +172,13 @@ void CFFL_ListBox::SaveData(CPDFSDK_PageView* pPageView) } - FX_INT32 nNewTopIndex = pListBox->GetTopVisibleIndex(); + int32_t nNewTopIndex = pListBox->GetTopVisibleIndex(); m_pWidget->ClearSelection(FALSE); if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) { - for (FX_INT32 i=0,sz=pListBox->GetCount(); iGetCount(); iIsItemSelected(i)) { @@ -215,7 +215,7 @@ void CFFL_ListBox::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AAct if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE)) { ASSERT(m_pWidget != NULL); - FX_INT32 nCurSel = pListBox->GetCurSel(); + int32_t nCurSel = pListBox->GetCurSel(); if (nCurSel >= 0) fa.sValue = m_pWidget->GetOptionLabel(nCurSel); } @@ -230,7 +230,7 @@ void CFFL_ListBox::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AAct else { ASSERT(m_pWidget != NULL); - FX_INT32 nCurSel = m_pWidget->GetSelectedIndex(0); + int32_t nCurSel = m_pWidget->GetSelectedIndex(0); if (nCurSel >= 0) fa.sValue = m_pWidget->GetOptionLabel(nCurSel); } @@ -252,7 +252,7 @@ void CFFL_ListBox::SaveState(CPDFSDK_PageView* pPageView) if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE)) { - for (FX_INT32 i=0,sz=pListBox->GetCount(); iGetCount(); iIsItemSelected(i)) { diff --git a/fpdfsdk/src/formfiller/FFL_Notify.cpp b/fpdfsdk/src/formfiller/FFL_Notify.cpp index 73ab5dbb85..406aa8d489 100644 --- a/fpdfsdk/src/formfiller/FFL_Notify.cpp +++ b/fpdfsdk/src/formfiller/FFL_Notify.cpp @@ -127,7 +127,7 @@ FX_BOOL CFFL_Notify::ExecuteActionTree(CPDF_AAction::AActionType eAAT,CPDF_Actio if (!ExecuteAction(eAAT,action,bExit)) return FALSE; if (bExit) return TRUE; - for (FX_INT32 i=0,sz=action.GetSubActionsCount(); iGetFormField(); ASSERT(pField != NULL); - for (FX_INT32 i=0,sz=pField->CountControls(); iCountControls(); iGetControl(i)) { diff --git a/fpdfsdk/src/formfiller/FFL_TextField.cpp b/fpdfsdk/src/formfiller/FFL_TextField.cpp index f488fac6ae..cd0299ce1b 100644 --- a/fpdfsdk/src/formfiller/FFL_TextField.cpp +++ b/fpdfsdk/src/formfiller/FFL_TextField.cpp @@ -114,7 +114,7 @@ CPWL_Wnd* CFFL_TextField::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageVi pWnd->SetFillerNotify(pIFormFiller); ASSERT(m_pWidget != NULL); - FX_INT32 nMaxLen = m_pWidget->GetMaxLen(); + int32_t nMaxLen = m_pWidget->GetMaxLen(); CFX_WideString swValue = m_pWidget->GetValue(); if (nMaxLen > 0) diff --git a/fpdfsdk/src/formfiller/FFL_Utils.cpp b/fpdfsdk/src/formfiller/FFL_Utils.cpp index 196102bfb4..2f988b2f0b 100644 --- a/fpdfsdk/src/formfiller/FFL_Utils.cpp +++ b/fpdfsdk/src/formfiller/FFL_Utils.cpp @@ -93,7 +93,7 @@ FX_BOOL CFFL_Utils::TraceObject(CPDF_Object* pObj) case PDFOBJ_BOOLEAN: break; case PDFOBJ_NUMBER: - //TRACE("%d\n",(FX_INT32)pObj); + //TRACE("%d\n",(int32_t)pObj); break; case PDFOBJ_STRING: //TRACE(((CPDF_String*)pObj)->GetString() + "\n"); diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp index e8bd76d414..2b583f038d 100644 --- a/fpdfsdk/src/fpdfppo.cpp +++ b/fpdfsdk/src/fpdfppo.cpp @@ -178,7 +178,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray* FX_DWORD dwOldPageObj = pSrcPageDict->GetObjNum(); FX_DWORD dwNewPageObj = pCurPageDict->GetObjNum(); - pMapPtrToPtr->SetAt((FX_LPVOID)(FX_UINTPTR)dwOldPageObj, (FX_LPVOID)(FX_UINTPTR)dwNewPageObj); + pMapPtrToPtr->SetAt((FX_LPVOID)(uintptr_t)dwOldPageObj, (FX_LPVOID)(uintptr_t)dwNewPageObj); this->UpdateReference(pCurPageDict, pDestPDFDoc, pMapPtrToPtr); curpage++; diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp index 159507080c..efb1148305 100644 --- a/fpdfsdk/src/fpdfview.cpp +++ b/fpdfsdk/src/fpdfview.cpp @@ -202,7 +202,7 @@ extern void CheckUnSupportError(CPDF_Document * pDoc, FX_DWORD err_code); class CMemFile final: public IFX_FileRead { public: - CMemFile(FX_BYTE* pBuf, FX_FILESIZE size):m_pBuf(pBuf),m_size(size) {} + CMemFile(uint8_t* pBuf, FX_FILESIZE size):m_pBuf(pBuf),m_size(size) {} virtual void Release() {delete this;} virtual FX_FILESIZE GetSize() {return m_size;} @@ -220,14 +220,14 @@ public: return TRUE; } private: - FX_BYTE* m_pBuf; + uint8_t* m_pBuf; FX_FILESIZE m_size; }; DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf, int size, FPDF_BYTESTRING password) { CPDF_Parser* pParser = new CPDF_Parser; pParser->SetPassword(password); - CMemFile* pMemFile = new CMemFile((FX_BYTE*)data_buf, size); + CMemFile* pMemFile = new CMemFile((uint8_t*)data_buf, size); FX_DWORD err_code = pParser->StartParse(pMemFile); if (err_code) { delete pParser; diff --git a/fpdfsdk/src/fsdk_actionhandler.cpp b/fpdfsdk/src/fsdk_actionhandler.cpp index fb8bcb2cb7..50d6b654f6 100644 --- a/fpdfsdk/src/fsdk_actionhandler.cpp +++ b/fpdfsdk/src/fsdk_actionhandler.cpp @@ -158,7 +158,7 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteDocumentOpenAction(const CPDF_Action& acti DoAction_NoJs(action, pDocument); } - for (FX_INT32 i=0,sz=action.GetSubActionsCount(); i= 0 ? 60 : -60); } -FX_BOOL _gAfxIsLeapYear(FX_SHORT year) +FX_BOOL _gAfxIsLeapYear(int16_t year) { return ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))); } -FX_WORD _gAfxGetYearDays(FX_SHORT year) +FX_WORD _gAfxGetYearDays(int16_t year) { return (_gAfxIsLeapYear(year) == TRUE ? 366 : 365); } -FX_BYTE _gAfxGetMonthDays(FX_SHORT year, FX_BYTE month) +uint8_t _gAfxGetMonthDays(int16_t year, uint8_t month) { - FX_BYTE mDays; + uint8_t mDays; switch (month) { case 1: @@ -117,12 +117,12 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::operator = (const FX_SYSTEMTIME& st) { tzset(); - dt.year = (FX_SHORT)st.wYear; - dt.month = (FX_BYTE)st.wMonth; - dt.day = (FX_BYTE)st.wDay; - dt.hour = (FX_BYTE)st.wHour; - dt.minute = (FX_BYTE)st.wMinute; - dt.second = (FX_BYTE)st.wSecond; + dt.year = (int16_t)st.wYear; + dt.month = (uint8_t)st.wMonth; + dt.day = (uint8_t)st.wDay; + dt.hour = (uint8_t)st.wHour; + dt.minute = (uint8_t)st.wMinute; + dt.second = (uint8_t)st.wSecond; // dt.tzHour = _timezone / 3600 * -1; // dt.tzMinute = (abs(_timezone) % 3600) / 60; return *this; @@ -234,7 +234,7 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(const CFX_ByteString& if (ch < '0' || ch > '9') break; i ++; } - dt.year = (FX_SHORT)k; + dt.year = (int16_t)k; if (i >= strLength || j < 4) return *this; j = 0; @@ -247,7 +247,7 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(const CFX_ByteString& if (ch < '0' || ch > '9') break; i ++; } - dt.month = (FX_BYTE)k; + dt.month = (uint8_t)k; if (i >= strLength || j < 2) return *this; j = 0; @@ -260,7 +260,7 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(const CFX_ByteString& if (ch < '0' || ch > '9') break; i ++; } - dt.day = (FX_BYTE)k; + dt.day = (uint8_t)k; if (i >= strLength || j < 2) return *this; j = 0; @@ -273,7 +273,7 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(const CFX_ByteString& if (ch < '0' || ch > '9') break; i ++; } - dt.hour = (FX_BYTE)k; + dt.hour = (uint8_t)k; if (i >= strLength || j < 2) return *this; j = 0; @@ -286,7 +286,7 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(const CFX_ByteString& if (ch < '0' || ch > '9') break; i ++; } - dt.minute = (FX_BYTE)k; + dt.minute = (uint8_t)k; if (i >= strLength || j < 2) return *this; j = 0; @@ -299,7 +299,7 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(const CFX_ByteString& if (ch < '0' || ch > '9') break; i ++; } - dt.second = (FX_BYTE)k; + dt.second = (uint8_t)k; if (i >= strLength || j < 2) return *this; ch = dtStr[i ++]; @@ -333,7 +333,7 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(const CFX_ByteString& if (ch < '0' || ch > '9') break; i ++; } - dt.tzMinute = (FX_BYTE)k; + dt.tzMinute = (uint8_t)k; if (i >= strLength || j < 2) return *this; } @@ -401,9 +401,9 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::AddDays(short days) { if (days == 0) return *this; - FX_SHORT y = dt.year, yy; - FX_BYTE m = dt.month; - FX_BYTE d = dt.day; + int16_t y = dt.year, yy; + uint8_t m = dt.month; + uint8_t d = dt.day; int mdays, ydays, ldays; ldays = days; @@ -489,11 +489,11 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::AddSeconds(int seconds) days = n / 86400; n %= 86400; } - dt.hour = (FX_BYTE)(n / 3600); + dt.hour = (uint8_t)(n / 3600); dt.hour %= 24; n %= 3600; - dt.minute = (FX_BYTE)(n / 60); - dt.second = (FX_BYTE)(n % 60); + dt.minute = (uint8_t)(n / 60); + dt.second = (uint8_t)(n % 60); if (days != 0) AddDays(days); return *this; @@ -965,7 +965,7 @@ void CPDFSDK_Annot::WriteAppearance(const CFX_ByteString& sAPType, const CPDF_Re { CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); pStream = new CPDF_Stream(NULL, 0, NULL); - FX_INT32 objnum = pDoc->AddIndirectObject(pStream); + int32_t objnum = pDoc->AddIndirectObject(pStream); pParentDict->SetAtReference(sAPType, pDoc, objnum); } @@ -985,7 +985,7 @@ void CPDFSDK_Annot::WriteAppearance(const CFX_ByteString& sAPType, const CPDF_Re pStreamDict->SetAtRect("BBox", rcBBox); } - pStream->SetData((FX_BYTE*)sContents.c_str(), sContents.GetLength(), FALSE, FALSE); + pStream->SetData((uint8_t*)sContents.c_str(), sContents.GetLength(), FALSE, FALSE); } #define BA_ANNOT_MINWIDTH 1 diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp index 8b0738a8d4..8d62a16ff4 100644 --- a/fpdfsdk/src/fsdk_baseform.cpp +++ b/fpdfsdk/src/fsdk_baseform.cpp @@ -456,7 +456,7 @@ void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice, CPDFSDK_PageView* pPa // { CPDF_Rect rc = GetRect(); FX_COLORREF color = m_pInterForm->GetHighlightColor(nFieldType); - FX_BYTE alpha = m_pInterForm->GetHighlightAlpha(); + uint8_t alpha = m_pInterForm->GetHighlightAlpha(); CFX_FloatRect rcDevice; ASSERT(m_pInterForm->GetDocument()); @@ -488,7 +488,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() CPDF_Rect rcWindow = GetRotatedRect(); - FX_INT32 nLayout = 0; + int32_t nLayout = 0; switch (pControl->GetTextPosition()) { @@ -529,7 +529,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); - FX_INT32 nBorderStyle = 0; + int32_t nBorderStyle = 0; CPWL_Dash dsBorder(3,0,0); CPWL_Color crLeftTop,crRightBottom; @@ -735,7 +735,7 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); - FX_INT32 nBorderStyle = 0; + int32_t nBorderStyle = 0; CPWL_Dash dsBorder(3,0,0); CPWL_Color crLeftTop,crRightBottom; @@ -775,7 +775,7 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); } - FX_INT32 nStyle = 0; + int32_t nStyle = 0; CFX_WideString csWCaption = pControl->GetNormalCaption(); if (csWCaption.GetLength() > 0) @@ -867,7 +867,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); - FX_INT32 nBorderStyle = 0; + int32_t nBorderStyle = 0; CPWL_Dash dsBorder(3,0,0); CPWL_Color crLeftTop,crRightBottom; @@ -907,7 +907,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); } - FX_INT32 nStyle = 0; + int32_t nStyle = 0; CFX_WideString csWCaption = pControl->GetNormalCaption(); if (csWCaption.GetLength() > 0) @@ -1069,7 +1069,7 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(FX_LPCWSTR sValue) pEdit->SetText(sValue); else { - FX_INT32 nCurSel = pField->GetSelectedIndex(0); + int32_t nCurSel = pField->GetSelectedIndex(0); if (nCurSel < 0) pEdit->SetText(pField->GetValue().c_str()); @@ -1143,14 +1143,14 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() CFX_ByteTextBuf sList; FX_FLOAT fy = rcClient.top; - FX_INT32 nTop = pField->GetTopVisibleIndex(); - FX_INT32 nCount = pField->CountOptions(); - FX_INT32 nSelCount = pField->CountSelectedItems(); + int32_t nTop = pField->GetTopVisibleIndex(); + int32_t nCount = pField->CountOptions(); + int32_t nSelCount = pField->CountSelectedItems(); - for (FX_INT32 i=nTop; iGetSelectedIndex(j) == i) { @@ -1310,7 +1310,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(FX_LPCWSTR sValue) sLines << "q\n" << GetBorderWidth() << " w\n" << CPWL_Utils::GetColorAppStream(GetBorderPWLColor(),FALSE) << " 2 J 0 j\n"; - for (FX_INT32 i=1;iGetDefaultAppearance(); if (da.HasColor()) { - FX_INT32 iColorType; + int32_t iColorType; FX_FLOAT fc[4]; da.GetColor(iColorType, fc); crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); @@ -1506,7 +1506,7 @@ CPWL_Color CPDFSDK_Widget::GetBorderPWLColor() const CPDF_FormControl* pFormCtrl = GetFormControl(); ASSERT(pFormCtrl != NULL); - FX_INT32 iColorType; + int32_t iColorType; FX_FLOAT fc[4]; pFormCtrl->GetOriginalBorderColor(iColorType, fc); if (iColorType > 0) @@ -1522,7 +1522,7 @@ CPWL_Color CPDFSDK_Widget::GetFillPWLColor() const CPDF_FormControl* pFormCtrl = GetFormControl(); ASSERT(pFormCtrl != NULL); - FX_INT32 iColorType; + int32_t iColorType; FX_FLOAT fc[4]; pFormCtrl->GetOriginalBackgroundColor(iColorType, fc); if (iColorType > 0) @@ -1643,12 +1643,12 @@ CFX_WideString CPDFSDK_Widget::GetAlternateName() const return pFormField->GetAlternateName(); } -FX_INT32 CPDFSDK_Widget::GetAppearanceAge() const +int32_t CPDFSDK_Widget::GetAppearanceAge() const { return m_nAppAge; } -FX_INT32 CPDFSDK_Widget::GetValueAge() const +int32_t CPDFSDK_Widget::GetValueAge() const { return m_nValueAge; } @@ -1898,7 +1898,7 @@ CPDF_Stream* CPDFSDK_InterForm::LoadImageFromFile(const CFX_WideString& sFile) pRetStream = new CPDF_Stream(NULL, 0, NULL); CFX_ByteString csStream; csStream.Format("q\n%d 0 0 %d 0 0 cm\n/Img Do\nQ", nWidth, nHeight); - pRetStream->InitStream((FX_BYTE*)csStream.c_str(), csStream.GetLength(), pStreamDict); + pRetStream->InitStream((uint8_t*)csStream.c_str(), csStream.GetLength(), pStreamDict); pDocument->AddIndirectObject(pRetStream); } @@ -2345,7 +2345,7 @@ FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(FX_LPBYTE& pBuf, FX_STRSIZE& nBuf } nBufSize = fdfEncodedData.GetLength(); - pBuf = FX_Alloc(FX_BYTE, nBufSize); + pBuf = FX_Alloc(uint8_t, nBufSize); FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize); } return TRUE; diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp index 7ac370ec43..36e48117ae 100644 --- a/fpdfsdk/src/fsdk_mgr.cpp +++ b/fpdfsdk/src/fsdk_mgr.cpp @@ -30,8 +30,8 @@ public: virtual CFX_WideString GetClipboardText(FX_HWND hWnd){return L"";} virtual FX_BOOL SetClipboardText(FX_HWND hWnd, CFX_WideString string) {return FALSE;} - virtual void ClientToScreen(FX_HWND hWnd, FX_INT32& x, FX_INT32& y) {} - virtual void ScreenToClient(FX_HWND hWnd, FX_INT32& x, FX_INT32& y) {} + virtual void ClientToScreen(FX_HWND hWnd, int32_t& x, int32_t& y) {} + virtual void ScreenToClient(FX_HWND hWnd, int32_t& x, int32_t& y) {} /*cursor style FXCT_ARROW @@ -41,20 +41,20 @@ public: FXCT_HBEAM FXCT_HAND */ - virtual void SetCursor(FX_INT32 nCursorType); + virtual void SetCursor(int32_t nCursorType); virtual FX_HMENU CreatePopupMenu() {return NULL;} - virtual FX_BOOL AppendMenuItem(FX_HMENU hMenu, FX_INT32 nIDNewItem, CFX_WideString string) {return FALSE;} - virtual FX_BOOL EnableMenuItem(FX_HMENU hMenu, FX_INT32 nIDItem, FX_BOOL bEnabled) {return FALSE;} - virtual FX_INT32 TrackPopupMenu(FX_HMENU hMenu, FX_INT32 x, FX_INT32 y, FX_HWND hParent) {return -1;} + virtual FX_BOOL AppendMenuItem(FX_HMENU hMenu, int32_t nIDNewItem, CFX_WideString string) {return FALSE;} + virtual FX_BOOL EnableMenuItem(FX_HMENU hMenu, int32_t nIDItem, FX_BOOL bEnabled) {return FALSE;} + virtual int32_t TrackPopupMenu(FX_HMENU hMenu, int32_t x, int32_t y, FX_HWND hParent) {return -1;} virtual void DestroyMenu(FX_HMENU hMenu) {} - virtual CFX_ByteString GetNativeTrueTypeFont(FX_INT32 nCharset); - virtual FX_BOOL FindNativeTrueTypeFont(FX_INT32 nCharset, CFX_ByteString sFontFaceName); - virtual CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, CFX_ByteString sFontFaceName, FX_BYTE nCharset); + virtual CFX_ByteString GetNativeTrueTypeFont(int32_t nCharset); + virtual FX_BOOL FindNativeTrueTypeFont(int32_t nCharset, CFX_ByteString sFontFaceName); + virtual CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, CFX_ByteString sFontFaceName, uint8_t nCharset); - virtual FX_INT32 SetTimer(FX_INT32 uElapse, TimerCallback lpTimerFunc) ; - virtual void KillTimer(FX_INT32 nID) ; + virtual int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc) ; + virtual void KillTimer(int32_t nID) ; virtual FX_BOOL IsSHIFTKeyDown(FX_DWORD nFlag) {return m_pEnv->FFI_IsSHIFTKeyDown(nFlag);} @@ -64,14 +64,14 @@ public: virtual FX_SYSTEMTIME GetLocalTime(); - virtual FX_INT32 GetCharSet() {return m_nCharSet;} - virtual void SetCharSet(FX_INT32 nCharSet) {m_nCharSet = nCharSet;} + virtual int32_t GetCharSet() {return m_nCharSet;} + virtual void SetCharSet(int32_t nCharSet) {m_nCharSet = nCharSet;} private: CPDFDoc_Environment* m_pEnv; int m_nCharSet; }; -void CFX_SystemHandler::SetCursor(FX_INT32 nCursorType) +void CFX_SystemHandler::SetCursor(int32_t nCursorType) { m_pEnv->FFI_SetCursor(nCursorType); @@ -132,12 +132,12 @@ FX_BOOL CFX_SystemHandler::IsSelectionImplemented() return FALSE; } -CFX_ByteString CFX_SystemHandler::GetNativeTrueTypeFont(FX_INT32 nCharset) +CFX_ByteString CFX_SystemHandler::GetNativeTrueTypeFont(int32_t nCharset) { return ""; } -FX_BOOL CFX_SystemHandler::FindNativeTrueTypeFont(FX_INT32 nCharset, CFX_ByteString sFontFaceName) +FX_BOOL CFX_SystemHandler::FindNativeTrueTypeFont(int32_t nCharset, CFX_ByteString sFontFaceName) { CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); // FXFT_Face nFace = pFontMgr->FindSubstFont(sFontFaceName,TRUE,0,0,0,0,NULL); @@ -182,7 +182,7 @@ static int CharSet2CP(int charset) return 0; } CPDF_Font* CFX_SystemHandler::AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, CFX_ByteString sFontFaceName, - FX_BYTE nCharset) + uint8_t nCharset) { if(pDoc) { @@ -197,11 +197,11 @@ CPDF_Font* CFX_SystemHandler::AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, CF } -FX_INT32 CFX_SystemHandler::SetTimer(FX_INT32 uElapse, TimerCallback lpTimerFunc) +int32_t CFX_SystemHandler::SetTimer(int32_t uElapse, TimerCallback lpTimerFunc) { return m_pEnv->FFI_SetTimer(uElapse, lpTimerFunc); } -void CFX_SystemHandler::KillTimer(FX_INT32 nID) +void CFX_SystemHandler::KillTimer(int32_t nID) { m_pEnv->FFI_KillTimer(nID); } diff --git a/fpdfsdk/src/fxedit/fxet_ap.cpp b/fpdfsdk/src/fxedit/fxet_ap.cpp index 92e5bfc1dd..10a76a7157 100644 --- a/fpdfsdk/src/fxedit/fxet_ap.cpp +++ b/fpdfsdk/src/fxedit/fxet_ap.cpp @@ -8,7 +8,7 @@ #include "../../include/fxedit/fx_edit.h" #include "../../include/fxedit/fxet_edit.h" -CFX_ByteString GetPDFWordString(IFX_Edit_FontMap * pFontMap, FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord) +CFX_ByteString GetPDFWordString(IFX_Edit_FontMap * pFontMap, int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord) { ASSERT (pFontMap != NULL); @@ -50,7 +50,7 @@ static CFX_ByteString GetWordRenderString(const CFX_ByteString & strWords) return ""; } -static CFX_ByteString GetFontSetString(IFX_Edit_FontMap * pFontMap, FX_INT32 nFontIndex, FX_FLOAT fFontSize) +static CFX_ByteString GetFontSetString(IFX_Edit_FontMap * pFontMap, int32_t nFontIndex, FX_FLOAT fFontSize) { CFX_ByteTextBuf sRet; @@ -71,7 +71,7 @@ CFX_ByteString IFX_Edit::GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Poi CFX_ByteTextBuf sEditStream, sWords; CPDF_Point ptOld(0.0f,0.0f),ptNew(0.0f,0.0f); - FX_INT32 nCurFontIndex = -1; + int32_t nCurFontIndex = -1; if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { @@ -171,7 +171,7 @@ CFX_ByteString IFX_Edit::GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Poi CFX_ByteTextBuf sAppStream; if (sEditStream.GetSize() > 0) { - FX_INT32 nHorzScale = pEdit->GetHorzScale(); + int32_t nHorzScale = pEdit->GetHorzScale(); if (nHorzScale != 100) { sAppStream << nHorzScale << " Tz\n"; diff --git a/fpdfsdk/src/fxedit/fxet_edit.cpp b/fpdfsdk/src/fxedit/fxet_edit.cpp index 0015c0f4ed..9415cefbe3 100644 --- a/fpdfsdk/src/fxedit/fxet_edit.cpp +++ b/fpdfsdk/src/fxedit/fxet_edit.cpp @@ -105,7 +105,7 @@ FX_BOOL CFX_Edit_Iterator::GetSection(CPVT_Section & section) const return FALSE; } -void CFX_Edit_Iterator::SetAt(FX_INT32 nWordIndex) +void CFX_Edit_Iterator::SetAt(int32_t nWordIndex) { ASSERT(m_pVTIterator != NULL); @@ -147,7 +147,7 @@ IFX_Edit_FontMap* CFX_Edit_Provider::GetFontMap() return m_pFontMap; } -FX_INT32 CFX_Edit_Provider::GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_INT32 nWordStyle) +int32_t CFX_Edit_Provider::GetCharWidth(int32_t nFontIndex, FX_WORD word, int32_t nWordStyle) { if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) { @@ -165,7 +165,7 @@ FX_INT32 CFX_Edit_Provider::GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_I return 0; } -FX_INT32 CFX_Edit_Provider::GetTypeAscent(FX_INT32 nFontIndex) +int32_t CFX_Edit_Provider::GetTypeAscent(int32_t nFontIndex) { if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) return pPDFFont->GetTypeAscent(); @@ -173,7 +173,7 @@ FX_INT32 CFX_Edit_Provider::GetTypeAscent(FX_INT32 nFontIndex) return 0; } -FX_INT32 CFX_Edit_Provider::GetTypeDescent(FX_INT32 nFontIndex) +int32_t CFX_Edit_Provider::GetTypeDescent(int32_t nFontIndex) { if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) return pPDFFont->GetTypeDescent(); @@ -181,12 +181,12 @@ FX_INT32 CFX_Edit_Provider::GetTypeDescent(FX_INT32 nFontIndex) return 0; } -FX_INT32 CFX_Edit_Provider::GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex) +int32_t CFX_Edit_Provider::GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex) { return m_pFontMap->GetWordFontIndex(word,charset,nFontIndex); } -FX_INT32 CFX_Edit_Provider::GetDefaultFontIndex() +int32_t CFX_Edit_Provider::GetDefaultFontIndex() { return 0; } @@ -220,26 +220,26 @@ void CFX_Edit_Refresh::Push(const CPVT_WordRange & linerange,const CPDF_Rect & r void CFX_Edit_Refresh::NoAnalyse() { { - for (FX_INT32 i = 0, sz = m_OldLineRects.GetSize(); i < sz; i++) + for (int32_t i = 0, sz = m_OldLineRects.GetSize(); i < sz; i++) if (CFX_Edit_LineRect * pOldRect = m_OldLineRects.GetAt(i)) m_RefreshRects.Add(pOldRect->m_rcLine); } { - for (FX_INT32 i = 0, sz = m_NewLineRects.GetSize(); i < sz; i++) + for (int32_t i = 0, sz = m_NewLineRects.GetSize(); i < sz; i++) if (CFX_Edit_LineRect * pNewRect = m_NewLineRects.GetAt(i)) m_RefreshRects.Add(pNewRect->m_rcLine); } } -void CFX_Edit_Refresh::Analyse(FX_INT32 nAlignment) +void CFX_Edit_Refresh::Analyse(int32_t nAlignment) { FX_BOOL bLineTopChanged = FALSE; CPDF_Rect rcResult; FX_FLOAT fWidthDiff; - FX_INT32 szMax = FX_EDIT_MAX(m_OldLineRects.GetSize(),m_NewLineRects.GetSize()); - FX_INT32 i = 0; + int32_t szMax = FX_EDIT_MAX(m_OldLineRects.GetSize(),m_NewLineRects.GetSize()); + int32_t i = 0; while (i < szMax) { @@ -346,7 +346,7 @@ void CFX_Edit_Refresh::EndRefresh() /* ------------------------------------- CFX_Edit_Undo ------------------------------------- */ -CFX_Edit_Undo::CFX_Edit_Undo(FX_INT32 nBufsize) : m_nCurUndoPos(0), +CFX_Edit_Undo::CFX_Edit_Undo(int32_t nBufsize) : m_nCurUndoPos(0), m_nBufSize(nBufsize), m_bModified(FALSE), m_bVirgin(TRUE), @@ -391,7 +391,7 @@ void CFX_Edit_Undo::Redo() { m_bWorking = TRUE; - FX_INT32 nStackSize = m_UndoItemStack.GetSize(); + int32_t nStackSize = m_UndoItemStack.GetSize(); if (m_nCurUndoPos < nStackSize) { @@ -441,7 +441,7 @@ FX_BOOL CFX_Edit_Undo::IsModified() const return TRUE; } -IFX_Edit_UndoItem* CFX_Edit_Undo::GetItem(FX_INT32 nIndex) +IFX_Edit_UndoItem* CFX_Edit_Undo::GetItem(int32_t nIndex) { if (nIndex>=0 && nIndex < m_UndoItemStack.GetSize()) return m_UndoItemStack.GetAt(nIndex); @@ -459,7 +459,7 @@ void CFX_Edit_Undo::RemoveHeads() void CFX_Edit_Undo::RemoveTails() { - for (FX_INT32 i = m_UndoItemStack.GetSize()-1; i >= m_nCurUndoPos; i--) + for (int32_t i = m_UndoItemStack.GetSize()-1; i >= m_nCurUndoPos; i--) { delete m_UndoItemStack.GetAt(i); m_UndoItemStack.RemoveAt(i); @@ -468,7 +468,7 @@ void CFX_Edit_Undo::RemoveTails() void CFX_Edit_Undo::Reset() { - for (FX_INT32 i=0, sz=m_UndoItemStack.GetSize(); i < sz; i++) + for (int32_t i=0, sz=m_UndoItemStack.GetSize(); i < sz; i++) { delete m_UndoItemStack.GetAt(i); } @@ -549,7 +549,7 @@ CFX_WideString CFX_Edit_GroupUndoItem::GetUndoTitle() /* ------------------------------------- CFX_Edit_UndoItem derived classes ------------------------------------- */ CFXEU_InsertWord::CFXEU_InsertWord(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace, - FX_WORD word, FX_INT32 charset, const CPVT_WordProps * pWordProps) + FX_WORD word, int32_t charset, const CPVT_WordProps * pWordProps) : m_pEdit(pEdit), m_wpOld(wpOldPlace), m_wpNew(wpNewPlace), m_Word(word), m_nCharset(charset), m_WordProps() { if (pWordProps) @@ -624,7 +624,7 @@ void CFXEU_InsertReturn::Undo() //CFXEU_Backspace CFXEU_Backspace::CFXEU_Backspace(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace, - FX_WORD word, FX_INT32 charset, + FX_WORD word, int32_t charset, const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps) : m_pEdit(pEdit), m_wpOld(wpOldPlace), @@ -671,7 +671,7 @@ void CFXEU_Backspace::Undo() //CFXEU_Delete CFXEU_Delete::CFXEU_Delete(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace, - FX_WORD word, FX_INT32 charset, + FX_WORD word, int32_t charset, const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps, FX_BOOL bSecEnd) : m_pEdit(pEdit), m_wpOld(wpOldPlace), @@ -754,7 +754,7 @@ void CFXEU_Clear::Undo() //CFXEU_ClearRich CFXEU_ClearRich::CFXEU_ClearRich(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace, - const CPVT_WordRange & wrSel, FX_WORD word, FX_INT32 charset, + const CPVT_WordRange & wrSel, FX_WORD word, int32_t charset, const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps) : m_pEdit(pEdit), m_wpOld(wpOldPlace), @@ -807,7 +807,7 @@ void CFXEU_ClearRich::Undo() //CFXEU_InsertText CFXEU_InsertText::CFXEU_InsertText(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace, - const CFX_WideString & swText, FX_INT32 charset, + const CFX_WideString & swText, int32_t charset, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps) : m_pEdit(pEdit), m_wpOld(wpOldPlace), @@ -1046,13 +1046,13 @@ void CFX_Edit::SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint/* = TRUE*/) if (bPaint) Paint(); } -void CFX_Edit::SetAlignmentH(FX_INT32 nFormat/* =0 */, FX_BOOL bPaint/* = TRUE*/) +void CFX_Edit::SetAlignmentH(int32_t nFormat/* =0 */, FX_BOOL bPaint/* = TRUE*/) { m_pVT->SetAlignment(nFormat); if (bPaint) Paint(); } -void CFX_Edit::SetAlignmentV(FX_INT32 nFormat/* =0 */, FX_BOOL bPaint/* = TRUE*/) +void CFX_Edit::SetAlignmentV(int32_t nFormat/* =0 */, FX_BOOL bPaint/* = TRUE*/) { m_nAlignment = nFormat; if (bPaint) Paint(); @@ -1064,13 +1064,13 @@ void CFX_Edit::SetPasswordChar(FX_WORD wSubWord/* ='*' */, FX_BOOL bPaint/* = TR if (bPaint) Paint(); } -void CFX_Edit::SetLimitChar(FX_INT32 nLimitChar/* =0 */, FX_BOOL bPaint/* = TRUE*/) +void CFX_Edit::SetLimitChar(int32_t nLimitChar/* =0 */, FX_BOOL bPaint/* = TRUE*/) { m_pVT->SetLimitChar(nLimitChar); if (bPaint) Paint(); } -void CFX_Edit::SetCharArray(FX_INT32 nCharArray/* =0 */, FX_BOOL bPaint/* = TRUE*/) +void CFX_Edit::SetCharArray(int32_t nCharArray/* =0 */, FX_BOOL bPaint/* = TRUE*/) { m_pVT->SetCharArray(nCharArray); if (bPaint) Paint(); @@ -1082,7 +1082,7 @@ void CFX_Edit::SetCharSpace(FX_FLOAT fCharSpace/* =0.0f */, FX_BOOL bPaint/* = T if (bPaint) Paint(); } -void CFX_Edit::SetHorzScale(FX_INT32 nHorzScale/* =100 */, FX_BOOL bPaint/* = TRUE*/) +void CFX_Edit::SetHorzScale(int32_t nHorzScale/* =100 */, FX_BOOL bPaint/* = TRUE*/) { m_pVT->SetHorzScale(nHorzScale); if (bPaint) Paint(); @@ -1130,7 +1130,7 @@ void CFX_Edit::SetTextOverflow(FX_BOOL bAllowed /*= FALSE*/, FX_BOOL bPaint/* = if (bPaint) Paint(); } -void CFX_Edit::SetSel(FX_INT32 nStartChar,FX_INT32 nEndChar) +void CFX_Edit::SetSel(int32_t nStartChar,int32_t nEndChar) { if (m_pVT->IsValid()) { @@ -1181,7 +1181,7 @@ void CFX_Edit::SetSel(const CPVT_WordPlace & begin,const CPVT_WordPlace & end) } } -void CFX_Edit::GetSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar) const +void CFX_Edit::GetSel(int32_t & nStartChar, int32_t & nEndChar) const { nStartChar = -1; nEndChar = -1; @@ -1209,7 +1209,7 @@ void CFX_Edit::GetSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar) const } } -FX_INT32 CFX_Edit::GetCaret() const +int32_t CFX_Edit::GetCaret() const { if (m_pVT->IsValid()) return m_pVT->WordPlaceToWordIndex(m_wpCaret); @@ -1319,14 +1319,14 @@ CFX_WideString CFX_Edit::GetSelText() const return GetRangeText(m_SelState.ConvertToWordRange()); } -FX_INT32 CFX_Edit::GetTotalWords() const +int32_t CFX_Edit::GetTotalWords() const { return m_pVT->GetTotalWords(); } -FX_INT32 CFX_Edit::GetTotalLines() const +int32_t CFX_Edit::GetTotalLines() const { - FX_INT32 nLines = 0; + int32_t nLines = 0; if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) { @@ -1379,7 +1379,7 @@ void CFX_Edit::SetRichText(FX_BOOL bRichText/* =TRUE */, FX_BOOL bPaint/* = TRUE if (bPaint) Paint(); } -FX_BOOL CFX_Edit::SetRichFontIndex(FX_INT32 nFontIndex) +FX_BOOL CFX_Edit::SetRichFontIndex(int32_t nFontIndex) { CPVT_WordProps WordProps; WordProps.nFontIndex = nFontIndex; @@ -1400,7 +1400,7 @@ FX_BOOL CFX_Edit::SetRichTextColor(FX_COLORREF dwColor) return SetRichTextProps(EP_WORDCOLOR,NULL,&WordProps); } -FX_BOOL CFX_Edit::SetRichTextScript(FX_INT32 nScriptType) +FX_BOOL CFX_Edit::SetRichTextScript(int32_t nScriptType) { CPVT_WordProps WordProps; WordProps.nScriptType = nScriptType; @@ -1446,7 +1446,7 @@ FX_BOOL CFX_Edit::SetRichTextCharSpace(FX_FLOAT fCharSpace) return SetRichTextProps(EP_CHARSPACE,NULL,&WordProps); } -FX_BOOL CFX_Edit::SetRichTextHorzScale(FX_INT32 nHorzScale /*= 100*/) +FX_BOOL CFX_Edit::SetRichTextHorzScale(int32_t nHorzScale /*= 100*/) { CPVT_WordProps WordProps; WordProps.nHorzScale = nHorzScale; @@ -1467,7 +1467,7 @@ FX_BOOL CFX_Edit::SetRichTextLineIndent(FX_FLOAT fLineIndent) return SetRichTextProps(EP_LINEINDENT,&SecProps,NULL); } -FX_BOOL CFX_Edit::SetRichTextAlignment(FX_INT32 nAlignment) +FX_BOOL CFX_Edit::SetRichTextAlignment(int32_t nAlignment) { CPVT_SecProps SecProps; SecProps.nAlignment = nAlignment; @@ -1921,13 +1921,13 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place return FALSE; } -void CFX_Edit::SetText(FX_LPCWSTR text,FX_INT32 charset /*= DEFAULT_CHARSET*/, +void CFX_Edit::SetText(FX_LPCWSTR text,int32_t charset /*= DEFAULT_CHARSET*/, const CPVT_SecProps * pSecProps /*= NULL*/,const CPVT_WordProps * pWordProps /*= NULL*/) { SetText(text,charset,pSecProps,pWordProps,TRUE,TRUE); } -FX_BOOL CFX_Edit::InsertWord(FX_WORD word, FX_INT32 charset /*= DEFAULT_CHARSET*/, const CPVT_WordProps * pWordProps /*= NULL*/) +FX_BOOL CFX_Edit::InsertWord(FX_WORD word, int32_t charset /*= DEFAULT_CHARSET*/, const CPVT_WordProps * pWordProps /*= NULL*/) { return InsertWord(word,charset,pWordProps,TRUE,TRUE); } @@ -1952,7 +1952,7 @@ FX_BOOL CFX_Edit::Clear() return Clear(TRUE,TRUE); } -FX_BOOL CFX_Edit::InsertText(FX_LPCWSTR text, FX_INT32 charset /*= DEFAULT_CHARSET*/, +FX_BOOL CFX_Edit::InsertText(FX_LPCWSTR text, int32_t charset /*= DEFAULT_CHARSET*/, const CPVT_SecProps * pSecProps /*= NULL*/,const CPVT_WordProps * pWordProps /*= NULL*/) { return InsertText(text,charset,pSecProps,pWordProps,TRUE,TRUE); @@ -1968,7 +1968,7 @@ FX_WORD CFX_Edit::GetPasswordChar() const return m_pVT->GetPasswordChar(); } -FX_INT32 CFX_Edit::GetCharArray() const +int32_t CFX_Edit::GetCharArray() const { return m_pVT->GetCharArray(); } @@ -1983,7 +1983,7 @@ CPDF_Rect CFX_Edit::GetContentRect() const return VTToEdit(m_pVT->GetContentRect()); } -FX_INT32 CFX_Edit::GetHorzScale() const +int32_t CFX_Edit::GetHorzScale() const { return m_pVT->GetHorzScale(); } @@ -2413,7 +2413,7 @@ void CFX_Edit::Refresh(REFRESH_PLAN_E ePlan,const CPVT_WordRange * pRange1,const m_bNotifyFlag = TRUE; if (const CFX_Edit_RectArray * pRects = m_Refresh.GetRefreshRects()) { - for (FX_INT32 i = 0, sz = pRects->GetSize(); i < sz; i++) + for (int32_t i = 0, sz = pRects->GetSize(); i < sz; i++) m_pNotify->IOnInvalidateRect(pRects->GetAt(i)); } m_bNotifyFlag = FALSE; @@ -2647,7 +2647,7 @@ void CFX_Edit::SetCaretChange() } } -void CFX_Edit::SetCaret(FX_INT32 nPos) +void CFX_Edit::SetCaret(int32_t nPos) { if (m_pVT->IsValid()) { @@ -2962,7 +2962,7 @@ void CFX_Edit::OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) } } -void CFX_Edit::SetText(FX_LPCWSTR text,FX_INT32 charset, +void CFX_Edit::SetText(FX_LPCWSTR text,int32_t charset, const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) { Empty(); @@ -2973,7 +2973,7 @@ void CFX_Edit::SetText(FX_LPCWSTR text,FX_INT32 charset, //if (bAddUndo) } -FX_BOOL CFX_Edit::InsertWord(FX_WORD word, FX_INT32 charset, const CPVT_WordProps * pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) +FX_BOOL CFX_Edit::InsertWord(FX_WORD word, int32_t charset, const CPVT_WordProps * pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) { if (IsTextOverflow()) return FALSE; @@ -3264,7 +3264,7 @@ FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) return FALSE; } -FX_BOOL CFX_Edit::InsertText(FX_LPCWSTR text, FX_INT32 charset, +FX_BOOL CFX_Edit::InsertText(FX_LPCWSTR text, int32_t charset, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) { if (IsTextOverflow()) return FALSE; @@ -3360,7 +3360,7 @@ void CFX_Edit::SetCaretOrigin() } } -FX_INT32 CFX_Edit::WordPlaceToWordIndex(const CPVT_WordPlace & place) const +int32_t CFX_Edit::WordPlaceToWordIndex(const CPVT_WordPlace & place) const { if (m_pVT->IsValid()) return m_pVT->WordPlaceToWordIndex(place); @@ -3368,7 +3368,7 @@ FX_INT32 CFX_Edit::WordPlaceToWordIndex(const CPVT_WordPlace & place) const return -1; } -CPVT_WordPlace CFX_Edit::WordIndexToWordPlace(FX_INT32 index) const +CPVT_WordPlace CFX_Edit::WordIndexToWordPlace(int32_t index) const { if (m_pVT->IsValid()) return m_pVT->WordIndexToWordPlace(index); @@ -3378,9 +3378,9 @@ CPVT_WordPlace CFX_Edit::WordIndexToWordPlace(FX_INT32 index) const FX_BOOL CFX_Edit::IsTextFull() const { - FX_INT32 nTotalWords = m_pVT->GetTotalWords(); - FX_INT32 nLimitChar = m_pVT->GetLimitChar(); - FX_INT32 nCharArray = m_pVT->GetCharArray(); + int32_t nTotalWords = m_pVT->GetTotalWords(); + int32_t nLimitChar = m_pVT->GetLimitChar(); + int32_t nCharArray = m_pVT->GetCharArray(); return IsTextOverflow() || (nLimitChar>0 && nTotalWords >= nLimitChar) || (nCharArray>0 && nTotalWords >= nCharArray); @@ -3510,7 +3510,7 @@ FX_FLOAT CFX_Edit::GetLineBottom(const CPVT_WordPlace& place) const return 0.0f; } -CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, FX_LPCWSTR text, FX_INT32 charset, +CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, FX_LPCWSTR text, int32_t charset, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps) { CPVT_WordPlace wp = place; @@ -3519,7 +3519,7 @@ CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, FX_LPCWSTR te { CFX_WideString sText = text; - for (FX_INT32 i = 0, sz = sText.GetLength(); i < sz; i++) + for (int32_t i = 0, sz = sText.GetLength(); i < sz; i++) { FX_WORD word = sText[i]; switch (word) @@ -3546,7 +3546,7 @@ CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, FX_LPCWSTR te return wp; } -FX_INT32 CFX_Edit::GetCharSetFromUnicode(FX_WORD word, FX_INT32 nOldCharset) +int32_t CFX_Edit::GetCharSetFromUnicode(FX_WORD word, int32_t nOldCharset) { if (IFX_Edit_FontMap* pFontMap = this->GetFontMap()) return pFontMap->CharSetFromUnicode(word, nOldCharset); diff --git a/fpdfsdk/src/fxedit/fxet_list.cpp b/fpdfsdk/src/fxedit/fxet_list.cpp index 64ed694d12..03b23020b4 100644 --- a/fpdfsdk/src/fxedit/fxet_list.cpp +++ b/fpdfsdk/src/fxedit/fxet_list.cpp @@ -130,7 +130,7 @@ CFX_List::~CFX_List() void CFX_List::Empty() { - for (FX_INT32 i=0,sz=m_aListItems.GetSize(); iGetRect().bottom; - for (FX_INT32 i=nItemIndex,sz=m_aListItems.GetSize(); i=0; i--) + for (int32_t i=m_aListItems.GetSize()-1; i>=0; i--) { if (CFX_ListItem * pListItem = m_aListItems.GetAt(i)) { @@ -286,11 +286,11 @@ FX_WCHAR CFX_List::Toupper(FX_WCHAR c) const return c; } -FX_INT32 CFX_List::FindNext(FX_INT32 nIndex,FX_WCHAR nChar) const +int32_t CFX_List::FindNext(int32_t nIndex,FX_WCHAR nChar) const { - FX_INT32 nCircleIndex = nIndex; + int32_t nCircleIndex = nIndex; - for (FX_INT32 i=0,sz=m_aListItems.GetSize(); i= sz) nCircleIndex = 0; @@ -305,7 +305,7 @@ FX_INT32 CFX_List::FindNext(FX_INT32 nIndex,FX_WCHAR nChar) const return nCircleIndex; } -CPDF_Rect CFX_List::GetItemRect(FX_INT32 nIndex) const +CPDF_Rect CFX_List::GetItemRect(int32_t nIndex) const { if (CFX_ListItem * pListItem = m_aListItems.GetAt(nIndex)) { @@ -318,7 +318,7 @@ CPDF_Rect CFX_List::GetItemRect(FX_INT32 nIndex) const return CPDF_Rect(); } -FX_BOOL CFX_List::IsItemSelected(FX_INT32 nIndex) const +FX_BOOL CFX_List::IsItemSelected(int32_t nIndex) const { if (CFX_ListItem * pListItem = m_aListItems.GetAt(nIndex)) { @@ -328,7 +328,7 @@ FX_BOOL CFX_List::IsItemSelected(FX_INT32 nIndex) const return FALSE; } -void CFX_List::SetItemSelect(FX_INT32 nItemIndex, FX_BOOL bSelected) +void CFX_List::SetItemSelect(int32_t nItemIndex, FX_BOOL bSelected) { if (CFX_ListItem * pListItem = m_aListItems.GetAt(nItemIndex)) { @@ -336,7 +336,7 @@ void CFX_List::SetItemSelect(FX_INT32 nItemIndex, FX_BOOL bSelected) } } -void CFX_List::SetItemCaret(FX_INT32 nItemIndex, FX_BOOL bCaret) +void CFX_List::SetItemCaret(int32_t nItemIndex, FX_BOOL bCaret) { if (CFX_ListItem * pListItem = m_aListItems.GetAt(nItemIndex)) { @@ -354,12 +354,12 @@ FX_BOOL CFX_List::IsMultipleSel() const return m_bMultiple; } -FX_BOOL CFX_List::IsValid(FX_INT32 nItemIndex) const +FX_BOOL CFX_List::IsValid(int32_t nItemIndex) const { return nItemIndex >= 0 && nItemIndex < m_aListItems.GetSize(); } -CFX_WideString CFX_List::GetItemText(FX_INT32 nIndex) const +CFX_WideString CFX_List::GetItemText(int32_t nIndex) const { if (CFX_ListItem * pListItem = m_aListItems.GetAt(nIndex)) { @@ -377,15 +377,15 @@ CPLST_Select::CPLST_Select() CPLST_Select::~CPLST_Select() { - for (FX_INT32 i=0,sz=m_aItems.GetSize(); i nEndIndex) { - FX_INT32 nTemp = nEndIndex; + int32_t nTemp = nEndIndex; nEndIndex = nBeginIndex; nBeginIndex = nTemp; } - for (FX_INT32 i=nBeginIndex; i<=nEndIndex; i++) Add(i); + for (int32_t i=nBeginIndex; i<=nEndIndex; i++) Add(i); } -void CPLST_Select::Sub(FX_INT32 nItemIndex) +void CPLST_Select::Sub(int32_t nItemIndex) { - for (FX_INT32 i=m_aItems.GetSize()-1; i>=0; i--) + for (int32_t i=m_aItems.GetSize()-1; i>=0; i--) { if (CPLST_Select_Item * pItem = m_aItems.GetAt(i)) if (pItem->nItemIndex == nItemIndex) @@ -420,21 +420,21 @@ void CPLST_Select::Sub(FX_INT32 nItemIndex) } } -void CPLST_Select::Sub(FX_INT32 nBeginIndex, FX_INT32 nEndIndex) +void CPLST_Select::Sub(int32_t nBeginIndex, int32_t nEndIndex) { if (nBeginIndex > nEndIndex) { - FX_INT32 nTemp = nEndIndex; + int32_t nTemp = nEndIndex; nEndIndex = nBeginIndex; nBeginIndex = nTemp; } - for (FX_INT32 i=nBeginIndex; i<=nEndIndex; i++) Sub(i); + for (int32_t i=nBeginIndex; i<=nEndIndex; i++) Sub(i); } -FX_INT32 CPLST_Select::Find(FX_INT32 nItemIndex) const +int32_t CPLST_Select::Find(int32_t nItemIndex) const { - for (FX_INT32 i=0,sz=m_aItems.GetSize(); i= 0; } -FX_INT32 CPLST_Select::GetCount() const +int32_t CPLST_Select::GetCount() const { return m_aItems.GetSize(); } -FX_INT32 CPLST_Select::GetItemIndex(FX_INT32 nIndex) const +int32_t CPLST_Select::GetItemIndex(int32_t nIndex) const { if (nIndex >= 0 && nIndex < m_aItems.GetSize()) if (CPLST_Select_Item * pItem = m_aItems.GetAt(nIndex)) @@ -465,7 +465,7 @@ FX_INT32 CPLST_Select::GetItemIndex(FX_INT32 nIndex) const return -1; } -FX_INT32 CPLST_Select::GetState(FX_INT32 nIndex) const +int32_t CPLST_Select::GetState(int32_t nIndex) const { if (nIndex >= 0 && nIndex < m_aItems.GetSize()) if (CPLST_Select_Item * pItem = m_aItems.GetAt(nIndex)) @@ -476,7 +476,7 @@ FX_INT32 CPLST_Select::GetState(FX_INT32 nIndex) const void CPLST_Select::DeselectAll() { - for (FX_INT32 i=0,sz=m_aItems.GetSize(); i=0; i--) + for (int32_t i=m_aItems.GetSize()-1; i>=0; i--) { if (CPLST_Select_Item * pItem = m_aItems.GetAt(i)) { @@ -559,7 +559,7 @@ CPDF_Rect CFX_ListCtrl::OutToIn(const CPDF_Rect & rect) const void CFX_ListCtrl::OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) { - FX_INT32 nHitIndex = this->GetItemIndex(point); + int32_t nHitIndex = this->GetItemIndex(point); if (IsMultipleSel()) { @@ -608,7 +608,7 @@ void CFX_ListCtrl::OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL b void CFX_ListCtrl::OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) { - FX_INT32 nHitIndex = this->GetItemIndex(point); + int32_t nHitIndex = this->GetItemIndex(point); if (IsMultipleSel()) { @@ -639,7 +639,7 @@ void CFX_ListCtrl::OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL b this->ScrollToListItem(nHitIndex); } -void CFX_ListCtrl::OnVK(FX_INT32 nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl) +void CFX_ListCtrl::OnVK(int32_t nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl) { if (IsMultipleSel()) { @@ -706,8 +706,8 @@ void CFX_ListCtrl::OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) FX_BOOL CFX_ListCtrl::OnChar(FX_WORD nChar,FX_BOOL bShift,FX_BOOL bCtrl) { - FX_INT32 nIndex = GetLastSelected(); - FX_INT32 nFindIndex = FindNext(nIndex,nChar); + int32_t nIndex = GetLastSelected(); + int32_t nFindIndex = FindNext(nIndex,nChar); if (nFindIndex != nIndex) { @@ -728,7 +728,7 @@ void CFX_ListCtrl::SetPlateRect(const CPDF_Rect & rect) InvalidateItem(-1); } -CPDF_Rect CFX_ListCtrl::GetItemRect(FX_INT32 nIndex) const +CPDF_Rect CFX_ListCtrl::GetItemRect(int32_t nIndex) const { return InToOut(CFX_List::GetItemRect(nIndex)); } @@ -739,7 +739,7 @@ void CFX_ListCtrl::AddString(FX_LPCWSTR string) ReArrange(GetCount() - 1); } -void CFX_ListCtrl::SetMultipleSelect(FX_INT32 nItemIndex, FX_BOOL bSelected) +void CFX_ListCtrl::SetMultipleSelect(int32_t nItemIndex, FX_BOOL bSelected) { if (!IsValid(nItemIndex)) return; @@ -758,7 +758,7 @@ void CFX_ListCtrl::SetMultipleSelect(FX_INT32 nItemIndex, FX_BOOL bSelected) } } -void CFX_ListCtrl::SetSingleSelect(FX_INT32 nItemIndex) +void CFX_ListCtrl::SetSingleSelect(int32_t nItemIndex) { if (!IsValid(nItemIndex)) return; @@ -776,13 +776,13 @@ void CFX_ListCtrl::SetSingleSelect(FX_INT32 nItemIndex) } } -void CFX_ListCtrl::SetCaret(FX_INT32 nItemIndex) +void CFX_ListCtrl::SetCaret(int32_t nItemIndex) { if (!IsValid(nItemIndex)) return; if (this->IsMultipleSel()) { - FX_INT32 nOldIndex = m_nCaretIndex; + int32_t nOldIndex = m_nCaretIndex; if (nOldIndex != nItemIndex) { @@ -797,7 +797,7 @@ void CFX_ListCtrl::SetCaret(FX_INT32 nItemIndex) } } -void CFX_ListCtrl::InvalidateItem(FX_INT32 nItemIndex) +void CFX_ListCtrl::InvalidateItem(int32_t nItemIndex) { if (m_pNotify) { @@ -831,10 +831,10 @@ void CFX_ListCtrl::InvalidateItem(FX_INT32 nItemIndex) void CFX_ListCtrl::SelectItems() { - for (FX_INT32 i=0,sz=m_aSelItems.GetCount(); iGetPlateRect(); CPDF_Rect rcItem = this->GetItemRect(nItemIndex); @@ -871,7 +871,7 @@ FX_BOOL CFX_ListCtrl::IsItemVisible(FX_INT32 nItemIndex) const return rcItem.bottom >= rcPlate.bottom && rcItem.top <= rcPlate.top; } -void CFX_ListCtrl::ScrollToListItem(FX_INT32 nItemIndex) +void CFX_ListCtrl::ScrollToListItem(int32_t nItemIndex) { if (!IsValid(nItemIndex)) return; @@ -960,13 +960,13 @@ CPDF_Rect CFX_ListCtrl::GetContentRect() const return InToOut(CFX_List::GetContentRect()); } -void CFX_ListCtrl::ReArrange(FX_INT32 nItemIndex) +void CFX_ListCtrl::ReArrange(int32_t nItemIndex) { CFX_List::ReArrange(nItemIndex); SetScrollInfo(); } -void CFX_ListCtrl::SetTopItem(FX_INT32 nIndex) +void CFX_ListCtrl::SetTopItem(int32_t nIndex) { if (IsValid(nIndex)) { @@ -976,9 +976,9 @@ void CFX_ListCtrl::SetTopItem(FX_INT32 nIndex) } } -FX_INT32 CFX_ListCtrl::GetTopItem() const +int32_t CFX_ListCtrl::GetTopItem() const { - FX_INT32 nItemIndex = this->GetItemIndex(this->GetBTPoint()); + int32_t nItemIndex = this->GetItemIndex(this->GetBTPoint()); if (!IsItemVisible(nItemIndex) && IsItemVisible(nItemIndex + 1)) nItemIndex += 1; @@ -997,7 +997,7 @@ void CFX_ListCtrl::Cancel() m_aSelItems.DeselectAll(); } -FX_INT32 CFX_ListCtrl::GetItemIndex(const CPDF_Point & point) const +int32_t CFX_ListCtrl::GetItemIndex(const CPDF_Point & point) const { return CFX_List::GetItemIndex(OutToIn(point)); } diff --git a/fpdfsdk/src/fxedit/fxet_pageobjs.cpp b/fpdfsdk/src/fxedit/fxet_pageobjs.cpp index 7b64b33ba1..6b597cabb9 100644 --- a/fpdfsdk/src/fxedit/fxet_pageobjs.cpp +++ b/fpdfsdk/src/fxedit/fxet_pageobjs.cpp @@ -11,7 +11,7 @@ #define FX_EDIT_UNDERLINEHALFWIDTH 0.5f #define FX_EDIT_CROSSOUTHALFWIDTH 0.5f -extern CFX_ByteString GetPDFWordString(IFX_Edit_FontMap * pFontMap, FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord); +extern CFX_ByteString GetPDFWordString(IFX_Edit_FontMap * pFontMap, int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord); CPDF_Rect GetUnderLineRect(const CPVT_Word& word) { @@ -26,7 +26,7 @@ CPDF_Rect GetCrossoutRect(const CPVT_Word& word) } static void DrawTextString(CFX_RenderDevice* pDevice, const CPDF_Point& pt, CPDF_Font* pFont, FX_FLOAT fFontSize, CPDF_Matrix* pUser2Device, - const CFX_ByteString& str, FX_ARGB crTextFill, FX_ARGB crTextStroke, FX_INT32 nHorzScale) + const CFX_ByteString& str, FX_ARGB crTextFill, FX_ARGB crTextStroke, int32_t nHorzScale) { FX_FLOAT x = pt.x, y = pt.y; pUser2Device->Transform(x, y); @@ -87,10 +87,10 @@ void IFX_Edit::DrawUnderline(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devic CPDF_Rect rcTemp = rcClip; pUser2Device->TransformRect(rcTemp); FX_RECT rcDevClip; - rcDevClip.left = (FX_INT32)rcTemp.left; - rcDevClip.right = (FX_INT32)rcTemp.right; - rcDevClip.top = (FX_INT32)rcTemp.top; - rcDevClip.bottom = (FX_INT32)rcTemp.bottom; + rcDevClip.left = (int32_t)rcTemp.left; + rcDevClip.right = (int32_t)rcTemp.right; + rcDevClip.top = (int32_t)rcTemp.top; + rcDevClip.bottom = (int32_t)rcTemp.bottom; pDevice->SetClip_Rect(&rcDevClip); } @@ -139,7 +139,7 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IF FX_WORD SubWord = pEdit->GetPasswordChar(); FX_FLOAT fFontSize = pEdit->GetFontSize(); CPVT_WordRange wrSelect = pEdit->GetSelectWordRange(); - FX_INT32 nHorzScale = pEdit->GetHorzScale(); + int32_t nHorzScale = pEdit->GetHorzScale(); FX_COLORREF crCurFill = crTextFill; FX_COLORREF crOldFill = crCurFill; @@ -149,7 +149,7 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IF const FX_COLORREF crSelBK = ArgbEncode(255,0,51,113); CFX_ByteTextBuf sTextBuf; - FX_INT32 nFontIndex = -1; + int32_t nFontIndex = -1; CPDF_Point ptBT(0.0f,0.0f); pDevice->SaveState(); @@ -159,10 +159,10 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IF CPDF_Rect rcTemp = rcClip; pUser2Device->TransformRect(rcTemp); FX_RECT rcDevClip; - rcDevClip.left = (FX_INT32)rcTemp.left; - rcDevClip.right = (FX_INT32)rcTemp.right; - rcDevClip.top = (FX_INT32)rcTemp.top; - rcDevClip.bottom = (FX_INT32)rcTemp.bottom; + rcDevClip.left = (int32_t)rcTemp.left; + rcDevClip.right = (int32_t)rcTemp.right; + rcDevClip.top = (int32_t)rcTemp.top; + rcDevClip.bottom = (int32_t)rcTemp.bottom; pDevice->SetClip_Rect(&rcDevClip); } @@ -293,10 +293,10 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device CPDF_Rect rcTemp = rcClip; pUser2Device->TransformRect(rcTemp); FX_RECT rcDevClip; - rcDevClip.left = (FX_INT32)rcTemp.left; - rcDevClip.right = (FX_INT32)rcTemp.right; - rcDevClip.top = (FX_INT32)rcTemp.top; - rcDevClip.bottom = (FX_INT32)rcTemp.bottom; + rcDevClip.left = (int32_t)rcTemp.left; + rcDevClip.right = (int32_t)rcTemp.right; + rcDevClip.top = (int32_t)rcTemp.top; + rcDevClip.bottom = (int32_t)rcTemp.bottom; pDevice->SetClip_Rect(&rcDevClip); } @@ -416,7 +416,7 @@ static void AddRectToPageObjects(CPDF_PageObjects* pPageObjs, FX_COLORREF crFill } static CPDF_TextObject* AddTextObjToPageObjects(CPDF_PageObjects* pPageObjs, FX_COLORREF crText, - CPDF_Font* pFont, FX_FLOAT fFontSize, FX_FLOAT fCharSpace, FX_INT32 nHorzScale, + CPDF_Font* pFont, FX_FLOAT fFontSize, FX_FLOAT fCharSpace, int32_t nHorzScale, const CPDF_Point& point, const CFX_ByteString& text) { CPDF_TextObject* pTxtObj = new CPDF_TextObject; @@ -452,7 +452,7 @@ void IFX_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEd { FX_FLOAT fFontSize = pEdit->GetFontSize(); - FX_INT32 nOldFontIndex = -1; + int32_t nOldFontIndex = -1; CFX_ByteTextBuf sTextBuf; CPDF_Point ptBT(0.0f,0.0f); diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp index 6a3d6e1e33..230a4ce49c 100644 --- a/fpdfsdk/src/javascript/Document.cpp +++ b/fpdfsdk/src/javascript/Document.cpp @@ -1223,7 +1223,7 @@ FX_BOOL Document::documentFileName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_Wid return FALSE; } CFX_WideString wsFilePath = m_pDocument->GetPath(); - FX_INT32 i = wsFilePath.GetLength() - 1; + int32_t i = wsFilePath.GetLength() - 1; for ( ; i >= 0; i-- ) { if ( wsFilePath.GetAt( i ) == L'\\' || wsFilePath.GetAt( i ) == L'/' ) diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp index 7476fa5728..c4936e3799 100644 --- a/fpdfsdk/src/javascript/Field.cpp +++ b/fpdfsdk/src/javascript/Field.cpp @@ -597,7 +597,7 @@ FX_BOOL Field::buttonAlignX(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString FX_FLOAT fLeft,fBottom; IconFit.GetIconPosition(fLeft,fBottom); - vp << (FX_INT32)fLeft; + vp << (int32_t)fLeft; } return TRUE; @@ -648,7 +648,7 @@ FX_BOOL Field::buttonAlignY(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString FX_FLOAT fLeft,fBottom; IconFit.GetIconPosition(fLeft,fBottom); - vp << (FX_INT32)fBottom; + vp << (int32_t)fBottom; } return TRUE; @@ -788,9 +788,9 @@ FX_BOOL Field::buttonScaleHow(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStri CPDF_IconFit IconFit = pFormControl->GetIconFit(); if (IconFit.IsProportionalScale()) - vp << (FX_INT32)0; + vp << (int32_t)0; else - vp << (FX_INT32)1; + vp << (int32_t)1; } return TRUE; @@ -841,16 +841,16 @@ FX_BOOL Field::buttonScaleWhen(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStr switch (ScaleM) { case CPDF_IconFit::Always : - vp << (FX_INT32) CPDF_IconFit::Always; + vp << (int32_t) CPDF_IconFit::Always; break; case CPDF_IconFit::Bigger : - vp << (FX_INT32) CPDF_IconFit::Bigger; + vp << (int32_t) CPDF_IconFit::Bigger; break; case CPDF_IconFit::Never : - vp << (FX_INT32) CPDF_IconFit::Never; + vp << (int32_t) CPDF_IconFit::Never; break; case CPDF_IconFit::Smaller : - vp << (FX_INT32) CPDF_IconFit::Smaller; + vp << (int32_t) CPDF_IconFit::Smaller; break; } } @@ -901,7 +901,7 @@ FX_BOOL Field::calcOrderIndex(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStri CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm(); ASSERT(pInterForm != NULL); - vp << (FX_INT32)pInterForm->FindFieldInCalculationOrder(pFormField); + vp << (int32_t)pInterForm->FindFieldInCalculationOrder(pFormField); } return TRUE; @@ -944,7 +944,7 @@ FX_BOOL Field::charLimit(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) return FALSE; - vp << (FX_INT32)pFormField->GetMaxLen(); + vp << (int32_t)pFormField->GetMaxLen(); } return TRUE; } @@ -1141,7 +1141,7 @@ void Field::SetCurrentValueIndices(CPDFSDK_Document* pDocument, const CFX_WideSt break; } - int iSelecting = (FX_INT32)array.GetAt(i); + int iSelecting = (int32_t)array.GetAt(i); if (iSelecting < pFormField->CountOptions() && !pFormField->IsItemSelected(iSelecting)) pFormField->SetItemSelection(iSelecting, TRUE); @@ -1365,7 +1365,7 @@ FX_BOOL Field::display(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr if (ANNOTFLAG_INVISIBLE & dwFlag || ANNOTFLAG_HIDDEN & dwFlag) { - vp << (FX_INT32)1; + vp << (int32_t)1; } else { @@ -1373,16 +1373,16 @@ FX_BOOL Field::display(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr { if (ANNOTFLAG_NOVIEW & dwFlag) { - vp << (FX_INT32)3; + vp << (int32_t)3; } else { - vp << (FX_INT32)0; + vp << (int32_t)0; } } else { - vp << (FX_INT32)2; + vp << (int32_t)2; } } } @@ -1932,7 +1932,7 @@ FX_BOOL Field::lineWidth(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormField->GetControl(0)); if (!pWidget) return FALSE; - vp << (FX_INT32)pWidget->GetBorderWidth(); + vp << (int32_t)pWidget->GetBorderWidth(); } return TRUE; @@ -2110,7 +2110,7 @@ FX_BOOL Field::numItems(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE if (!vp.IsGetting()) return FALSE; - vp << (FX_INT32)pFormField->CountOptions(); + vp << (int32_t)pFormField->CountOptions(); return TRUE; } @@ -2147,14 +2147,14 @@ FX_BOOL Field::page(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError if(!pPageView) return FALSE; - PageArray.SetElement(i, CJS_Value(m_isolate,(FX_INT32)pPageView->GetPageIndex())); + PageArray.SetElement(i, CJS_Value(m_isolate,(int32_t)pPageView->GetPageIndex())); } vp << PageArray; } else { - vp << (FX_INT32) -1; + vp << (int32_t) -1; } return TRUE; @@ -2407,10 +2407,10 @@ FX_BOOL Field::rect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError CFX_FloatRect crRect = pWidget->GetRect(); CJS_Value Upper_Leftx(m_isolate),Upper_Lefty(m_isolate),Lower_Rightx(m_isolate),Lower_Righty(m_isolate); - Upper_Leftx = (FX_INT32)crRect.left; - Upper_Lefty = (FX_INT32)crRect.top; - Lower_Rightx = (FX_INT32)crRect.right; - Lower_Righty = (FX_INT32)crRect.bottom; + Upper_Leftx = (int32_t)crRect.left; + Upper_Lefty = (int32_t)crRect.top; + Lower_Rightx = (int32_t)crRect.right; + Lower_Righty = (int32_t)crRect.bottom; CJS_Array rcArray(m_isolate); rcArray.SetElement(0,Upper_Leftx); @@ -2643,7 +2643,7 @@ FX_BOOL Field::rotation(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl)return FALSE; - vp << (FX_INT32)pFormControl->GetRotation(); + vp << (int32_t)pFormControl->GetRotation(); } return TRUE; @@ -2850,7 +2850,7 @@ FX_BOOL Field::textColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s FX_ARGB color; CPDF_DefaultAppearance FieldAppearance = pFormControl->GetDefaultAppearance(); FieldAppearance.GetColor(color, iColorType); - FX_INT32 a,r,g,b; + int32_t a,r,g,b; ArgbDecode(color, a, r, g, b); CPWL_Color crRet = CPWL_Color(COLORTYPE_RGB, r / 255.0f, @@ -3791,7 +3791,7 @@ FX_BOOL Field::setFocus(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); ASSERT(pFormField != NULL); - FX_INT32 nCount = pFormField->CountControls(); + int32_t nCount = pFormField->CountControls(); if (nCount < 1) return FALSE; @@ -3812,7 +3812,7 @@ FX_BOOL Field::setFocus(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val return FALSE; if (CPDFSDK_PageView* pCurPageView = m_pDocument->GetPageView(pPage)) { - for (FX_INT32 i=0; iGetWidget(pFormField->GetControl(i))) { @@ -3886,7 +3886,7 @@ FX_BOOL Field::source(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr /////////////////////////////////////////// delay ///////////////////////////////////////////// -void Field::AddDelay_Int(enum FIELD_PROP prop, FX_INT32 n) +void Field::AddDelay_Int(enum FIELD_PROP prop, int32_t n) { ASSERT(m_pJSDoc != NULL); diff --git a/fpdfsdk/src/javascript/JS_GlobalData.cpp b/fpdfsdk/src/javascript/JS_GlobalData.cpp index b4e4a5b108..450c7a1338 100644 --- a/fpdfsdk/src/javascript/JS_GlobalData.cpp +++ b/fpdfsdk/src/javascript/JS_GlobalData.cpp @@ -105,7 +105,7 @@ void CJS_GlobalVariableArray::Empty() #define PHANTOM_JS_GLOBALDATA_FILENAME L"Phantom_JsGlobal.Data" #define SDK_JS_GLOBALDATA_FILENAME L"SDK_JsGlobal.Data" -static const FX_BYTE JS_RC4KEY[] = {0x19,0xa8,0xe8,0x01,0xf6,0xa8,0xb6,0x4d,0x82,0x04, +static const uint8_t JS_RC4KEY[] = {0x19,0xa8,0xe8,0x01,0xf6,0xa8,0xb6,0x4d,0x82,0x04, 0x45,0x6d,0xb4,0xcf,0xd7,0x77,0x67,0xf9,0x75,0x9f, 0xf0,0xe0,0x1e,0x51,0xee,0x46,0xfd,0x0b,0xc9,0x93, 0x25,0x55,0x4a,0xee,0xe0,0x16,0xd0,0xdf,0x8c,0xfa, @@ -338,7 +338,7 @@ FX_BOOL CJS_GlobalData::DeleteGlobalVariable(FX_LPCSTR propname) return FALSE; } -FX_INT32 CJS_GlobalData::GetSize() const +int32_t CJS_GlobalData::GetSize() const { return m_arrayGlobalData.GetSize(); } @@ -351,7 +351,7 @@ CJS_GlobalData_Element* CJS_GlobalData::GetAt(int index) const void CJS_GlobalData::LoadGlobalPersistentVariables() { FX_LPBYTE pBuffer = NULL; - FX_INT32 nLength = 0; + int32_t nLength = 0; LoadFileBuffer(m_sFilePath.c_str(), pBuffer, nLength); CRYPT_ArcFourCryptBlock(pBuffer, nLength, JS_RC4KEY, sizeof(JS_RC4KEY)); @@ -379,7 +379,7 @@ void CJS_GlobalData::LoadGlobalPersistentVariables() if (dwSize == nLength - sizeof(FX_WORD) * 2 - sizeof(FX_DWORD)* 2) { - for (FX_INT32 i=0,sz=dwCount; i pBuffer + nLength) break; @@ -511,12 +511,12 @@ void CJS_GlobalData::SaveGlobalPersisitentVariables() WriteFileBuffer(m_sFilePath.c_str(), (FX_LPCSTR)sFile.GetBuffer(), sFile.GetSize()); } -void CJS_GlobalData::LoadFileBuffer(FX_LPCWSTR sFilePath, FX_LPBYTE& pBuffer, FX_INT32& nLength) +void CJS_GlobalData::LoadFileBuffer(FX_LPCWSTR sFilePath, FX_LPBYTE& pBuffer, int32_t& nLength) { //UnSupport. } -void CJS_GlobalData::WriteFileBuffer(FX_LPCWSTR sFilePath, FX_LPCSTR pBuffer, FX_INT32 nLength) +void CJS_GlobalData::WriteFileBuffer(FX_LPCWSTR sFilePath, FX_LPCSTR pBuffer, int32_t nLength) { //UnSupport. } diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp index 26c59a32ad..e051cda66e 100644 --- a/fpdfsdk/src/javascript/util.cpp +++ b/fpdfsdk/src/javascript/util.cpp @@ -603,10 +603,10 @@ FX_BOOL util::scand(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& return TRUE; } -FX_INT64 FX_atoi64(const char *nptr) +int64_t FX_atoi64(const char *nptr) { int c; /* current char */ - FX_INT64 total; /* current total */ + int64_t total; /* current total */ int sign; /* if '-', then negative, otherwise positive */ /* skip whitespace */ diff --git a/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp index 6627189bd7..51c4c185f9 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp @@ -256,12 +256,12 @@ void CPWL_ComboBox::AddString(FX_LPCWSTR string) m_pList->AddString(string); } -FX_INT32 CPWL_ComboBox::GetSelect() const +int32_t CPWL_ComboBox::GetSelect() const { return m_nSelectItem; } -void CPWL_ComboBox::SetSelect(FX_INT32 nItemIndex) +void CPWL_ComboBox::SetSelect(int32_t nItemIndex) { if (m_pList) m_pList->Select(nItemIndex); @@ -271,7 +271,7 @@ void CPWL_ComboBox::SetSelect(FX_INT32 nItemIndex) m_nSelectItem = nItemIndex; } -void CPWL_ComboBox::SetEditSel(FX_INT32 nStartChar,FX_INT32 nEndChar) +void CPWL_ComboBox::SetEditSel(int32_t nStartChar,int32_t nEndChar) { if (m_pEdit) { @@ -279,7 +279,7 @@ void CPWL_ComboBox::SetEditSel(FX_INT32 nStartChar,FX_INT32 nEndChar) } } -void CPWL_ComboBox::GetEditSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar) const +void CPWL_ComboBox::GetEditSel(int32_t & nStartChar, int32_t & nEndChar) const { nStartChar = -1; nEndChar = -1; @@ -502,7 +502,7 @@ void CPWL_ComboBox::SetPopup(FX_BOOL bPopup) { if (m_pFillerNotify) { - FX_INT32 nWhere = 0; + int32_t nWhere = 0; FX_FLOAT fPopupRet = 0.0f; FX_FLOAT fPopupMin = 0.0f; if (m_pList->GetCount() > 3) @@ -601,7 +601,7 @@ FX_BOOL CPWL_ComboBox::OnChar(FX_WORD nChar, FX_DWORD nFlag) } } -void CPWL_ComboBox::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam, FX_INTPTR lParam) +void CPWL_ComboBox::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t lParam) { switch (msg) { diff --git a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp index 83f7340fad..f50233ff1c 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp @@ -47,12 +47,12 @@ void CPWL_Edit::SetText(FX_LPCWSTR csText) if (CXML_Element * pXML = CXML_Element::Parse(sValue.c_str(), sValue.GetLength())) { - FX_INT32 nCount = pXML->CountChildren(); + int32_t nCount = pXML->CountChildren(); FX_BOOL bFirst = TRUE; swText.Empty(); - for (FX_INT32 i=0; iGetElement(i)) { @@ -61,7 +61,7 @@ void CPWL_Edit::SetText(FX_LPCWSTR csText) { int nChild = pSubElement->CountChildren(); CFX_WideString swSection; - for(FX_INT32 j=0; jGetContent(j); } @@ -119,12 +119,12 @@ CPDF_Rect CPWL_Edit::GetClientRect() const void CPWL_Edit::SetAlignFormatH(PWL_EDIT_ALIGNFORMAT_H nFormat, FX_BOOL bPaint/* = TRUE*/) { - m_pEdit->SetAlignmentH((FX_INT32)nFormat, bPaint); + m_pEdit->SetAlignmentH((int32_t)nFormat, bPaint); } void CPWL_Edit::SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat, FX_BOOL bPaint/* = TRUE*/) { - m_pEdit->SetAlignmentV((FX_INT32)nFormat, bPaint); + m_pEdit->SetAlignmentV((int32_t)nFormat, bPaint); } FX_BOOL CPWL_Edit::CanSelectAll() const @@ -298,7 +298,7 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) CPDF_Rect rcClient = GetClientRect(); CFX_ByteTextBuf sLine; - FX_INT32 nCharArray = m_pEdit->GetCharArray(); + int32_t nCharArray = m_pEdit->GetCharArray(); if (nCharArray > 0) { @@ -309,7 +309,7 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) sLine << "q\n" << GetBorderWidth() << " w\n" << CPWL_Utils::GetColorAppStream(GetBorderColor(),FALSE) << " 2 J 0 j\n"; - for (FX_INT32 i=1;iGetCharArray(); + int32_t nCharArray = m_pEdit->GetCharArray(); FX_SAFE_INT32 nCharArraySafe = nCharArray; nCharArraySafe -= 1; nCharArraySafe *= 2; @@ -428,7 +428,7 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser CFX_PathData path; path.SetPointCount(nCharArraySafe.ValueOrDie()); - for (FX_INT32 i=0; iSuggestWords(sLatin,sSuggestWords); - FX_INT32 nSuggest = sSuggestWords.GetSize(); + int32_t nSuggest = sSuggestWords.GetSize(); - for (FX_INT32 nWord=0; nWordAppendMenuItem(hPopup, WM_PWLEDIT_SUGGEST+nWord, sSuggestWords[nWord].UTF8Decode()); } @@ -643,11 +643,11 @@ FX_BOOL CPWL_Edit::OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag) pSH->EnableMenuItem(hPopup, WM_PWLEDIT_SELECTALL, FALSE); } - FX_INT32 x, y; + int32_t x, y; PWLtoWnd(ptPopup, x, y); pSH->ClientToScreen(GetAttachedHWnd(), x, y); pSH->SetCursor(FXCT_ARROW); - FX_INT32 nCmd = pSH->TrackPopupMenu(hPopup, + int32_t nCmd = pSH->TrackPopupMenu(hPopup, x, y, GetAttachedHWnd()); @@ -736,7 +736,7 @@ void CPWL_Edit::OnKillFocus() m_bFocus = FALSE; } -void CPWL_Edit::SetHorzScale(FX_INT32 nHorzScale, FX_BOOL bPaint/* = TRUE*/) +void CPWL_Edit::SetHorzScale(int32_t nHorzScale, FX_BOOL bPaint/* = TRUE*/) { m_pEdit->SetHorzScale(nHorzScale, bPaint); } @@ -761,8 +761,8 @@ CPVT_WordRange CPWL_Edit::GetSelectWordRange() const { if (m_pEdit->IsSelected()) { - FX_INT32 nStart = -1; - FX_INT32 nEnd = -1; + int32_t nStart = -1; + int32_t nEnd = -1; m_pEdit->GetSel(nStart, nEnd); @@ -821,7 +821,7 @@ FX_BOOL CPWL_Edit::IsTextFull() const return m_pEdit->IsTextFull(); } -FX_FLOAT CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont, const CPDF_Rect& rcPlate, FX_INT32 nCharArray) +FX_FLOAT CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont, const CPDF_Rect& rcPlate, int32_t nCharArray) { if (pFont && !pFont->IsStandardFont()) { @@ -838,7 +838,7 @@ FX_FLOAT CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont, const CPDF_Rect& return 0.0f; } -void CPWL_Edit::SetCharArray(FX_INT32 nCharArray) +void CPWL_Edit::SetCharArray(int32_t nCharArray) { if (HasFlag(PES_CHARARRAY) && nCharArray > 0) { @@ -860,7 +860,7 @@ void CPWL_Edit::SetCharArray(FX_INT32 nCharArray) } } -void CPWL_Edit::SetLimitChar(FX_INT32 nLimitChar) +void CPWL_Edit::SetLimitChar(int32_t nLimitChar) { m_pEdit->SetLimitChar(nLimitChar); } @@ -1016,7 +1016,7 @@ FX_BOOL CPWL_Edit::OnChar(FX_WORD nChar, FX_DWORD nFlag) if (m_pFillerNotify) { CFX_WideString swChange; - FX_INT32 nKeyCode; + int32_t nKeyCode; int nSelStart = 0; int nSelEnd = 0; @@ -1048,8 +1048,8 @@ FX_BOOL CPWL_Edit::OnChar(FX_WORD nChar, FX_DWORD nFlag) if (IFX_Edit_FontMap * pFontMap = GetFontMap()) { - FX_INT32 nOldCharSet = GetCharSet(); - FX_INT32 nNewCharSet = pFontMap->CharSetFromUnicode(nChar, DEFAULT_CHARSET); + int32_t nOldCharSet = GetCharSet(); + int32_t nNewCharSet = pFontMap->CharSetFromUnicode(nChar, DEFAULT_CHARSET); if(nOldCharSet != nNewCharSet) { SetCharSet(nNewCharSet); diff --git a/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp index 90a198a771..a38371c326 100644 --- a/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp @@ -81,7 +81,7 @@ void CPWL_EditCtrl::RePosChildWnd() m_pEdit->SetPlateRect(GetClientRect()); } -void CPWL_EditCtrl::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam, FX_INTPTR lParam) +void CPWL_EditCtrl::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t lParam) { CPWL_Wnd::OnNotify(pWnd,msg,wParam,lParam); @@ -409,7 +409,7 @@ void CPWL_EditCtrl::GetCaretInfo(CPDF_Point & ptHead, CPDF_Point & ptFoot) const } } -void CPWL_EditCtrl::GetCaretPos(FX_INT32& x, FX_INT32& y) const +void CPWL_EditCtrl::GetCaretPos(int32_t& x, int32_t& y) const { CPDF_Point ptHead(0,0), ptFoot(0,0); @@ -439,12 +439,12 @@ CFX_WideString CPWL_EditCtrl::GetText() const return m_pEdit->GetText(); } -void CPWL_EditCtrl::SetSel(FX_INT32 nStartChar,FX_INT32 nEndChar) +void CPWL_EditCtrl::SetSel(int32_t nStartChar,int32_t nEndChar) { m_pEdit->SetSel(nStartChar, nEndChar); } -void CPWL_EditCtrl::GetSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar ) const +void CPWL_EditCtrl::GetSel(int32_t & nStartChar, int32_t & nEndChar ) const { m_pEdit->GetSel(nStartChar, nEndChar); } @@ -472,7 +472,7 @@ void CPWL_EditCtrl::EnableRefresh(FX_BOOL bRefresh) m_pEdit->EnableRefresh(bRefresh); } -FX_INT32 CPWL_EditCtrl::GetCaret() const +int32_t CPWL_EditCtrl::GetCaret() const { if (m_pEdit) return m_pEdit->GetCaret(); @@ -480,13 +480,13 @@ FX_INT32 CPWL_EditCtrl::GetCaret() const return -1; } -void CPWL_EditCtrl::SetCaret(FX_INT32 nPos) +void CPWL_EditCtrl::SetCaret(int32_t nPos) { if (m_pEdit) m_pEdit->SetCaret(nPos); } -FX_INT32 CPWL_EditCtrl::GetTotalWords() const +int32_t CPWL_EditCtrl::GetTotalWords() const { if (m_pEdit) return m_pEdit->GetTotalWords(); @@ -510,7 +510,7 @@ CPDF_Point CPWL_EditCtrl::GetScrollPos() const CPDF_Font * CPWL_EditCtrl::GetCaretFont() const { - FX_INT32 nFontIndex = 0; + int32_t nFontIndex = 0; if (IFX_Edit_Iterator * pIterator = m_pEdit->GetIterator()) { @@ -588,7 +588,7 @@ void CPWL_EditCtrl::InsertText(FX_LPCWSTR csText) m_pEdit->InsertText(csText); } -void CPWL_EditCtrl::InsertWord(FX_WORD word, FX_INT32 nCharset) +void CPWL_EditCtrl::InsertWord(FX_WORD word, int32_t nCharset) { if (!IsReadOnly()) m_pEdit->InsertWord(word, nCharset); @@ -646,7 +646,7 @@ void CPWL_EditCtrl::IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, Info.fSmallStep = fSmallStep; Info.fBigStep = fBigStep; - this->OnNotify(this,PNM_SETSCROLLINFO,SBT_VSCROLL,(FX_INTPTR)&Info); + this->OnNotify(this,PNM_SETSCROLLINFO,SBT_VSCROLL,(intptr_t)&Info); // PWL_TRACE("set scroll info:%f\n",fContentMax - fContentMin); @@ -664,7 +664,7 @@ void CPWL_EditCtrl::IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, void CPWL_EditCtrl::IOnSetScrollPosY(FX_FLOAT fy) { // PWL_TRACE("set scroll position:%f\n",fy); - this->OnNotify(this,PNM_SETSCROLLPOS,SBT_VSCROLL,(FX_INTPTR)&fy); + this->OnNotify(this,PNM_SETSCROLLPOS,SBT_VSCROLL,(intptr_t)&fy); } void CPWL_EditCtrl::IOnSetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPDF_Point & ptFoot, const CPVT_WordPlace& place) @@ -674,7 +674,7 @@ void CPWL_EditCtrl::IOnSetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, con cInfo.ptHead = ptHead; cInfo.ptFoot = ptFoot; - this->OnNotify(this,PNM_SETCARETINFO,(FX_INTPTR)&cInfo,(FX_INTPTR)NULL); + this->OnNotify(this,PNM_SETCARETINFO,(intptr_t)&cInfo,(intptr_t)NULL); } void CPWL_EditCtrl::IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps) @@ -697,7 +697,7 @@ void CPWL_EditCtrl::IOnInvalidateRect(CPDF_Rect * pRect) this->InvalidateRect(pRect); } -FX_INT32 CPWL_EditCtrl::GetCharSet() const +int32_t CPWL_EditCtrl::GetCharSet() const { if (m_nCharSet < 0) return DEFAULT_CHARSET; @@ -705,13 +705,13 @@ FX_INT32 CPWL_EditCtrl::GetCharSet() const return m_nCharSet; } -void CPWL_EditCtrl::GetTextRange(const CPDF_Rect& rect, FX_INT32 & nStartChar, FX_INT32 & nEndChar) const +void CPWL_EditCtrl::GetTextRange(const CPDF_Rect& rect, int32_t & nStartChar, int32_t & nEndChar) const { nStartChar = m_pEdit->WordPlaceToWordIndex(m_pEdit->SearchWordPlace(CPDF_Point(rect.left, rect.top))); nEndChar = m_pEdit->WordPlaceToWordIndex(m_pEdit->SearchWordPlace(CPDF_Point(rect.right, rect.bottom))); } -CFX_WideString CPWL_EditCtrl::GetText(FX_INT32 & nStartChar, FX_INT32 & nEndChar) const +CFX_WideString CPWL_EditCtrl::GetText(int32_t & nStartChar, int32_t & nEndChar) const { CPVT_WordPlace wpStart = m_pEdit->WordIndexToWordPlace(nStartChar); CPVT_WordPlace wpEnd = m_pEdit->WordIndexToWordPlace(nEndChar); diff --git a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp index 578511359c..62811eaac1 100644 --- a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp @@ -49,7 +49,7 @@ CPDF_Document* CPWL_FontMap::GetDocument() return m_pPDFDoc; } -CPDF_Font* CPWL_FontMap::GetPDFFont(FX_INT32 nFontIndex) +CPDF_Font* CPWL_FontMap::GetPDFFont(int32_t nFontIndex) { if (nFontIndex >=0 && nFontIndex < m_aData.GetSize()) { @@ -62,7 +62,7 @@ CPDF_Font* CPWL_FontMap::GetPDFFont(FX_INT32 nFontIndex) return NULL; } -CFX_ByteString CPWL_FontMap::GetPDFFontAlias(FX_INT32 nFontIndex) +CFX_ByteString CPWL_FontMap::GetPDFFontAlias(int32_t nFontIndex) { if (nFontIndex >=0 && nFontIndex < m_aData.GetSize()) { @@ -75,7 +75,7 @@ CFX_ByteString CPWL_FontMap::GetPDFFontAlias(FX_INT32 nFontIndex) return ""; } -FX_BOOL CPWL_FontMap::KnowWord(FX_INT32 nFontIndex, FX_WORD word) +FX_BOOL CPWL_FontMap::KnowWord(int32_t nFontIndex, FX_WORD word) { if (nFontIndex >=0 && nFontIndex < m_aData.GetSize()) { @@ -88,7 +88,7 @@ FX_BOOL CPWL_FontMap::KnowWord(FX_INT32 nFontIndex, FX_WORD word) return FALSE; } -FX_INT32 CPWL_FontMap::GetWordFontIndex(FX_WORD word, FX_INT32 nCharset, FX_INT32 nFontIndex) +int32_t CPWL_FontMap::GetWordFontIndex(FX_WORD word, int32_t nCharset, int32_t nFontIndex) { if (nFontIndex > 0) { @@ -111,7 +111,7 @@ FX_INT32 CPWL_FontMap::GetWordFontIndex(FX_WORD word, FX_INT32 nCharset, FX_INT3 } } - FX_INT32 nNewFontIndex = -1; + int32_t nNewFontIndex = -1; nNewFontIndex = this->GetFontIndex(GetNativeFontName(nCharset), nCharset, TRUE); if (nNewFontIndex >= 0) @@ -130,7 +130,7 @@ FX_INT32 CPWL_FontMap::GetWordFontIndex(FX_WORD word, FX_INT32 nCharset, FX_INT3 return -1; } -FX_INT32 CPWL_FontMap::CharCodeFromUnicode(FX_INT32 nFontIndex, FX_WORD word) +int32_t CPWL_FontMap::CharCodeFromUnicode(int32_t nFontIndex, FX_WORD word) { if (CPWL_FontMap_Data* pData = m_aData.GetAt(nFontIndex)) { @@ -153,10 +153,10 @@ FX_INT32 CPWL_FontMap::CharCodeFromUnicode(FX_INT32 nFontIndex, FX_WORD word) return -1; } -CFX_ByteString CPWL_FontMap::GetNativeFontName(FX_INT32 nCharset) +CFX_ByteString CPWL_FontMap::GetNativeFontName(int32_t nCharset) { //searching native font is slow, so we must save time - for (FX_INT32 i=0,sz=m_aNativeFont.GetSize(); i= 0) return nFontIndex; // nFontIndex = FindFont("", nCharset); @@ -285,11 +285,11 @@ FX_INT32 CPWL_FontMap::GetFontIndex(const CFX_ByteString& sFontName, FX_INT32 nC return AddFontData(pFont, sAlias, nCharset); } -FX_INT32 CPWL_FontMap::GetPWLFontIndex(FX_WORD word, FX_INT32 nCharset) +int32_t CPWL_FontMap::GetPWLFontIndex(FX_WORD word, int32_t nCharset) { - FX_INT32 nFind = -1; + int32_t nFind = -1; - for (FX_INT32 i=0,sz=m_aData.GetSize(); ipFont = pFont; @@ -339,7 +339,7 @@ void CPWL_FontMap::AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias) { } -CFX_ByteString CPWL_FontMap::GetFontName(FX_INT32 nFontIndex) +CFX_ByteString CPWL_FontMap::GetFontName(int32_t nFontIndex) { if (nFontIndex >=0 && nFontIndex < m_aData.GetSize()) { @@ -352,7 +352,7 @@ CFX_ByteString CPWL_FontMap::GetFontName(FX_INT32 nFontIndex) return ""; } -CFX_ByteString CPWL_FontMap::GetNativeFont(FX_INT32 nCharset) +CFX_ByteString CPWL_FontMap::GetNativeFont(int32_t nCharset) { CFX_ByteString sFontName; @@ -372,7 +372,7 @@ CFX_ByteString CPWL_FontMap::GetNativeFont(FX_INT32 nCharset) return sFontName; } -CPDF_Font* CPWL_FontMap::AddFontToDocument(CPDF_Document* pDoc, CFX_ByteString& sFontName, FX_BYTE nCharset) +CPDF_Font* CPWL_FontMap::AddFontToDocument(CPDF_Document* pDoc, CFX_ByteString& sFontName, uint8_t nCharset) { if (IsStandardFont(sFontName)) return AddStandardFont(pDoc, sFontName); @@ -397,7 +397,7 @@ CPDF_Font* CPWL_FontMap::AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sF return pFont; } -CPDF_Font* CPWL_FontMap::AddSystemFont(CPDF_Document* pDoc, CFX_ByteString& sFontName, FX_BYTE nCharset) +CPDF_Font* CPWL_FontMap::AddSystemFont(CPDF_Document* pDoc, CFX_ByteString& sFontName, uint8_t nCharset) { if (!pDoc) return NULL; @@ -410,7 +410,7 @@ CPDF_Font* CPWL_FontMap::AddSystemFont(CPDF_Document* pDoc, CFX_ByteString& sFon return NULL; } -CFX_ByteString CPWL_FontMap::EncodeFontAlias(const CFX_ByteString& sFontName, FX_INT32 nCharset) +CFX_ByteString CPWL_FontMap::EncodeFontAlias(const CFX_ByteString& sFontName, int32_t nCharset) { CFX_ByteString sPostfix; sPostfix.Format("_%02X", nCharset); @@ -424,12 +424,12 @@ CFX_ByteString CPWL_FontMap::EncodeFontAlias(const CFX_ByteString& sFontName) return sRet; } -FX_INT32 CPWL_FontMap::GetFontMapCount() const +int32_t CPWL_FontMap::GetFontMapCount() const { return m_aData.GetSize(); } -const CPWL_FontMap_Data* CPWL_FontMap::GetFontMapData(FX_INT32 nIndex) const +const CPWL_FontMap_Data* CPWL_FontMap::GetFontMapData(int32_t nIndex) const { if (nIndex >=0 && nIndex < m_aData.GetSize()) { @@ -439,10 +439,10 @@ const CPWL_FontMap_Data* CPWL_FontMap::GetFontMapData(FX_INT32 nIndex) const return NULL; } -FX_INT32 CPWL_FontMap::GetNativeCharset() +int32_t CPWL_FontMap::GetNativeCharset() { - FX_BYTE nCharset = ANSI_CHARSET; - FX_INT32 iCodePage = FXSYS_GetACP(); + uint8_t nCharset = ANSI_CHARSET; + int32_t iCodePage = FXSYS_GetACP(); switch (iCodePage) { case 932://Japan @@ -513,7 +513,7 @@ const CPWL_FontMap::CharsetFontMap CPWL_FontMap::defaultTTFMap[] = { { -1, NULL } }; -CFX_ByteString CPWL_FontMap::GetDefaultFontByCharset(FX_INT32 nCharset) +CFX_ByteString CPWL_FontMap::GetDefaultFontByCharset(int32_t nCharset) { int i = 0; while (defaultTTFMap[i].charset != -1) { @@ -524,7 +524,7 @@ CFX_ByteString CPWL_FontMap::GetDefaultFontByCharset(FX_INT32 nCharset) return ""; } -FX_INT32 CPWL_FontMap::CharSetFromUnicode(FX_WORD word, FX_INT32 nOldCharset) +int32_t CPWL_FontMap::CharSetFromUnicode(FX_WORD word, int32_t nOldCharset) { if(m_pSystemHandler && (-1 != m_pSystemHandler->GetCharSet())) return m_pSystemHandler->GetCharSet(); diff --git a/fpdfsdk/src/pdfwindow/PWL_Icon.cpp b/fpdfsdk/src/pdfwindow/PWL_Icon.cpp index 5e3e6e5586..9426824c8e 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Icon.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Icon.cpp @@ -137,7 +137,7 @@ CPWL_Icon::~CPWL_Icon() { } -FX_INT32 CPWL_Icon::GetScaleMethod() +int32_t CPWL_Icon::GetScaleMethod() { if (m_pIconFit) return m_pIconFit->GetScaleMethod(); @@ -199,7 +199,7 @@ void CPWL_Icon::GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale) GetImageSize(fImageWidth,fImageHeight); - FX_INT32 nScaleMethod = this->GetScaleMethod(); + int32_t nScaleMethod = this->GetScaleMethod(); /* enum ScaleMethod diff --git a/fpdfsdk/src/pdfwindow/PWL_IconList.cpp b/fpdfsdk/src/pdfwindow/PWL_IconList.cpp index 990f8b893f..cbb94d23d7 100644 --- a/fpdfsdk/src/pdfwindow/PWL_IconList.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_IconList.cpp @@ -100,7 +100,7 @@ void CPWL_IconList_Item::SetData(void* pData) m_pData = pData; } -void CPWL_IconList_Item::SetIcon(FX_INT32 nIconIndex) +void CPWL_IconList_Item::SetIcon(int32_t nIconIndex) { m_nIconIndex = nIconIndex; } @@ -148,7 +148,7 @@ void CPWL_IconList_Item::OnDisabled() /* ----------------- CPWL_IconList_Content ----------------- */ -CPWL_IconList_Content::CPWL_IconList_Content(FX_INT32 nListCount) : +CPWL_IconList_Content::CPWL_IconList_Content(int32_t nListCount) : m_nSelectIndex(-1), m_pNotify(NULL), m_bEnableNotify(TRUE), @@ -163,7 +163,7 @@ CPWL_IconList_Content::~CPWL_IconList_Content() void CPWL_IconList_Content::CreateChildWnd(const PWL_CREATEPARAM & cp) { - for (FX_INT32 i=0; iOnNotify(this, PNM_SETSCROLLINFO, SBT_VSCROLL, (FX_INTPTR)&sInfo); + pParent->OnNotify(this, PNM_SETSCROLLINFO, SBT_VSCROLL, (intptr_t)&sInfo); } } @@ -199,7 +199,7 @@ FX_BOOL CPWL_IconList_Content::OnLButtonDown(const CPDF_Point & point, FX_DWORD SetCapture(); m_bMouseDown = TRUE; - FX_INT32 nItemIndex = FindItemIndex(point); + int32_t nItemIndex = FindItemIndex(point); SetSelect(nItemIndex); ScrollToItem(nItemIndex); @@ -218,7 +218,7 @@ FX_BOOL CPWL_IconList_Content::OnMouseMove(const CPDF_Point & point, FX_DWORD nF { if (m_bMouseDown) { - FX_INT32 nItemIndex = FindItemIndex(point); + int32_t nItemIndex = FindItemIndex(point); SetSelect(nItemIndex); ScrollToItem(nItemIndex); } @@ -233,7 +233,7 @@ FX_BOOL CPWL_IconList_Content::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) case FWL_VKEY_Up: if (m_nSelectIndex > 0) { - FX_INT32 nItemIndex = m_nSelectIndex - 1; + int32_t nItemIndex = m_nSelectIndex - 1; SetSelect(nItemIndex); ScrollToItem(nItemIndex); } @@ -241,7 +241,7 @@ FX_BOOL CPWL_IconList_Content::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) case FWL_VKEY_Down: if (m_nSelectIndex < m_nListCount-1) { - FX_INT32 nItemIndex = m_nSelectIndex + 1; + int32_t nItemIndex = m_nSelectIndex + 1; SetSelect(nItemIndex); ScrollToItem(nItemIndex); } @@ -251,10 +251,10 @@ FX_BOOL CPWL_IconList_Content::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) return FALSE; } -FX_INT32 CPWL_IconList_Content::FindItemIndex(const CPDF_Point& point) +int32_t CPWL_IconList_Content::FindItemIndex(const CPDF_Point& point) { - FX_INT32 nIndex = 0; - for (FX_INT32 i=0,sz=m_aChildren.GetSize(); iInvalidateRect(); if (CPWL_Wnd* pParent = this->GetParentWindow()) { - pParent->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (FX_INTPTR)&ptScroll.y); + pParent->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&ptScroll.y); } } } } -void CPWL_IconList_Content::SetSelect(FX_INT32 nIndex) +void CPWL_IconList_Content::SetSelect(int32_t nIndex) { if (m_nSelectIndex != nIndex) { @@ -316,7 +316,7 @@ void CPWL_IconList_Content::SetSelect(FX_INT32 nIndex) } } -FX_INT32 CPWL_IconList_Content::GetSelect() const +int32_t CPWL_IconList_Content::GetSelect() const { return m_nSelectIndex; } @@ -338,7 +338,7 @@ void CPWL_IconList_Content::EnableNotify(FX_BOOL bNotify) m_bEnableNotify = bNotify; } -void CPWL_IconList_Content::SelectItem(FX_INT32 nItemIndex, FX_BOOL bSelect) +void CPWL_IconList_Content::SelectItem(int32_t nItemIndex, FX_BOOL bSelect) { if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) { @@ -347,7 +347,7 @@ void CPWL_IconList_Content::SelectItem(FX_INT32 nItemIndex, FX_BOOL bSelect) } } -CPWL_IconList_Item* CPWL_IconList_Content::GetListItem(FX_INT32 nItemIndex) const +CPWL_IconList_Item* CPWL_IconList_Content::GetListItem(int32_t nItemIndex) const { if (nItemIndex >= 0 && nItemIndexSetData(pData); } -void CPWL_IconList_Content::SetListIcon(FX_INT32 nItemIndex, FX_INT32 nIconIndex) +void CPWL_IconList_Content::SetListIcon(int32_t nItemIndex, int32_t nIconIndex) { if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) pItem->SetIcon(nIconIndex); } -void CPWL_IconList_Content::SetListString(FX_INT32 nItemIndex, const CFX_WideString& str) +void CPWL_IconList_Content::SetListString(int32_t nItemIndex, const CFX_WideString& str) { if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) pItem->SetText(str); } -CFX_WideString CPWL_IconList_Content::GetListString(FX_INT32 nItemIndex) const +CFX_WideString CPWL_IconList_Content::GetListString(int32_t nItemIndex) const { if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) return pItem->GetText(); @@ -391,7 +391,7 @@ CFX_WideString CPWL_IconList_Content::GetListString(FX_INT32 nItemIndex) const void CPWL_IconList_Content::SetIconFillColor(const CPWL_Color& color) { - for (FX_INT32 i=0,sz=m_aChildren.GetSize(); iSetSelect(nIndex); } -void CPWL_IconList::SetTopItem(FX_INT32 nIndex) +void CPWL_IconList::SetTopItem(int32_t nIndex) { m_pListContent->ScrollToItem(nIndex); } -FX_INT32 CPWL_IconList::GetSelect() const +int32_t CPWL_IconList::GetSelect() const { return m_pListContent->GetSelect(); } @@ -527,22 +527,22 @@ void CPWL_IconList::EnableNotify(FX_BOOL bNotify) m_pListContent->EnableNotify(bNotify); } -void CPWL_IconList::SetListData(FX_INT32 nItemIndex, void* pData) +void CPWL_IconList::SetListData(int32_t nItemIndex, void* pData) { m_pListContent->SetListData(nItemIndex, pData); } -void CPWL_IconList::SetListIcon(FX_INT32 nItemIndex, FX_INT32 nIconIndex) +void CPWL_IconList::SetListIcon(int32_t nItemIndex, int32_t nIconIndex) { m_pListContent->SetListIcon(nItemIndex, nIconIndex); } -void CPWL_IconList::SetListString(FX_INT32 nItemIndex, const CFX_WideString& str) +void CPWL_IconList::SetListString(int32_t nItemIndex, const CFX_WideString& str) { m_pListContent->SetListString(nItemIndex, str); } -CFX_WideString CPWL_IconList::GetListString(FX_INT32 nItemIndex) const +CFX_WideString CPWL_IconList::GetListString(int32_t nItemIndex) const { return m_pListContent->GetListString(nItemIndex); } @@ -581,7 +581,7 @@ FX_BOOL CPWL_IconList::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_D m_pListContent->InvalidateRect(NULL); if (CPWL_ScrollBar* pScrollBar = this->GetVScrollBar()) - pScrollBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (FX_INTPTR)&ptNew.y); + pScrollBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&ptNew.y); return TRUE; } diff --git a/fpdfsdk/src/pdfwindow/PWL_Label.cpp b/fpdfsdk/src/pdfwindow/PWL_Label.cpp index 18580f3be7..f2f3929e3f 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Label.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Label.cpp @@ -132,7 +132,7 @@ IFX_SystemHandler* pSysHandler = GetSystemHandler(); rcClip, CPDF_Point(0.0f,0.0f), pRange,pSysHandler, NULL); } -void CPWL_Label::SetHorzScale(FX_INT32 nHorzScale) +void CPWL_Label::SetHorzScale(int32_t nHorzScale) { m_pEdit->SetHorzScale(nHorzScale); } @@ -172,12 +172,12 @@ CFX_WideString CPWL_Label::GetText() const return m_pEdit->GetText(); } -void CPWL_Label::SetLimitChar(FX_INT32 nLimitChar) +void CPWL_Label::SetLimitChar(int32_t nLimitChar) { m_pEdit->SetLimitChar(nLimitChar); } -FX_INT32 CPWL_Label::GetTotalWords() +int32_t CPWL_Label::GetTotalWords() { if (m_pEdit) return m_pEdit->GetTotalWords(); diff --git a/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp index 035d81959d..47c1c86123 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp @@ -40,7 +40,7 @@ void CPWL_List_Notify::IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, Info.fSmallStep = fSmallStep; Info.fBigStep = fBigStep; - m_pList->OnNotify(m_pList,PNM_SETSCROLLINFO,SBT_VSCROLL,(FX_INTPTR)&Info); + m_pList->OnNotify(m_pList,PNM_SETSCROLLINFO,SBT_VSCROLL,(intptr_t)&Info); if (CPWL_ScrollBar * pScroll = m_pList->GetVScrollBar()) { @@ -66,7 +66,7 @@ void CPWL_List_Notify::IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, void CPWL_List_Notify::IOnSetScrollPosY(FX_FLOAT fy) { - m_pList->OnNotify(m_pList,PNM_SETSCROLLPOS,SBT_VSCROLL,(FX_INTPTR)&fy); + m_pList->OnNotify(m_pList,PNM_SETSCROLLPOS,SBT_VSCROLL,(intptr_t)&fy); } void CPWL_List_Notify::IOnInvalidateRect(CPDF_Rect * pRect) @@ -139,7 +139,7 @@ void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) if (m_pList) { CPDF_Rect rcPlate = m_pList->GetPlateRect(); - for (FX_INT32 i=0,sz=m_pList->GetCount(); iGetCount(); iGetItemRect(i); @@ -191,7 +191,7 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pU CPDF_Rect rcList = GetListRect(); CPDF_Rect rcClient = GetClientRect(); - for (FX_INT32 i=0,sz=m_pList->GetCount(); iGetCount(); iGetItemRect(i); if (rcItem.bottom > rcPlate.top || rcItem.top < rcPlate.bottom) continue; @@ -356,7 +356,7 @@ FX_BOOL CPWL_ListBox::OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag) return TRUE; } -void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam, FX_INTPTR lParam) +void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t lParam) { CPWL_Wnd::OnNotify(pWnd,msg,wParam,lParam); @@ -406,7 +406,7 @@ void CPWL_ListBox::KillFocus() /* if (this->IsMultipleSel()) { - for(FX_INT32 i=0;iGetCount();i++) + for(int32_t i=0;iGetCount();i++) { if (this->IsListItemSelected(i)) { @@ -496,25 +496,25 @@ FX_FLOAT CPWL_ListBox::GetFontSize() const return 0.0f; } -void CPWL_ListBox::Select(FX_INT32 nItemIndex) +void CPWL_ListBox::Select(int32_t nItemIndex) { if (m_pList) m_pList->Select(nItemIndex); } -void CPWL_ListBox::SetCaret(FX_INT32 nItemIndex) +void CPWL_ListBox::SetCaret(int32_t nItemIndex) { if (m_pList) m_pList->SetCaret(nItemIndex); } -void CPWL_ListBox::SetTopVisibleIndex(FX_INT32 nItemIndex) +void CPWL_ListBox::SetTopVisibleIndex(int32_t nItemIndex) { if (m_pList) m_pList->SetTopItem(nItemIndex); } -void CPWL_ListBox::ScrollToListItem(FX_INT32 nItemIndex) +void CPWL_ListBox::ScrollToListItem(int32_t nItemIndex) { if (m_pList) m_pList->ScrollToListItem(nItemIndex); @@ -540,7 +540,7 @@ FX_BOOL CPWL_ListBox::IsMultipleSel() const return FALSE; } -FX_INT32 CPWL_ListBox::GetCaretIndex() const +int32_t CPWL_ListBox::GetCaretIndex() const { if (m_pList) return m_pList->GetCaret(); @@ -548,7 +548,7 @@ FX_INT32 CPWL_ListBox::GetCaretIndex() const return -1; } -FX_INT32 CPWL_ListBox::GetCurSel() const +int32_t CPWL_ListBox::GetCurSel() const { if (m_pList) return m_pList->GetSelect(); @@ -556,7 +556,7 @@ FX_INT32 CPWL_ListBox::GetCurSel() const return -1; } -FX_BOOL CPWL_ListBox::IsItemSelected(FX_INT32 nItemIndex) const +FX_BOOL CPWL_ListBox::IsItemSelected(int32_t nItemIndex) const { if (m_pList) return m_pList->IsItemSelected(nItemIndex); @@ -564,7 +564,7 @@ FX_BOOL CPWL_ListBox::IsItemSelected(FX_INT32 nItemIndex) const return FALSE; } -FX_INT32 CPWL_ListBox::GetTopVisibleIndex() const +int32_t CPWL_ListBox::GetTopVisibleIndex() const { if (m_pList) { @@ -575,7 +575,7 @@ FX_INT32 CPWL_ListBox::GetTopVisibleIndex() const return -1; } -FX_INT32 CPWL_ListBox::GetCount() const +int32_t CPWL_ListBox::GetCount() const { if (m_pList) return m_pList->GetCount(); @@ -583,7 +583,7 @@ FX_INT32 CPWL_ListBox::GetCount() const return 0; } -FX_INT32 CPWL_ListBox::FindNext(FX_INT32 nIndex,FX_WCHAR nChar) const +int32_t CPWL_ListBox::FindNext(int32_t nIndex,FX_WCHAR nChar) const { if (m_pList) return m_pList->FindNext(nIndex,nChar); diff --git a/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp b/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp index 9ac18fdc63..17d842165d 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp @@ -55,7 +55,7 @@ void CPWL_ListCtrl::ResetFace() ResetAll(FALSE, 0); } -void CPWL_ListCtrl::ResetContent(FX_INT32 nStart) +void CPWL_ListCtrl::ResetContent(int32_t nStart) { if (nStart < 0) nStart = 0; @@ -71,7 +71,7 @@ FX_FLOAT CPWL_ListCtrl::GetContentsHeight(FX_FLOAT fLimitWidth) if (fLimitWidth > fBorderWidth* 2) { - for (FX_INT32 i=0,sz=m_aChildren.GetSize(); iGetWindowRect().bottom - m_fItemSpace; - for (FX_INT32 i=nStart,sz=m_aChildren.GetSize(); iTransformRect(rcTemp); - FX_RECT rcClip((FX_INT32)rcTemp.left, - (FX_INT32)rcTemp.bottom, - (FX_INT32)rcTemp.right, - (FX_INT32)rcTemp.top); + FX_RECT rcClip((int32_t)rcTemp.left, + (int32_t)rcTemp.bottom, + (int32_t)rcTemp.right, + (int32_t)rcTemp.top); pDevice->SetClip_Rect(&rcClip); - for (FX_INT32 i=0,sz=m_aChildren.GetSize(); iRestoreState(); } -FX_INT32 CPWL_ListCtrl::GetItemIndex(CPWL_Wnd* pItem) +int32_t CPWL_ListCtrl::GetItemIndex(CPWL_Wnd* pItem) { - for (FX_INT32 i=0, sz=m_aChildren.GetSize(); iGetParentWindow()) { - pParent->OnNotify(this, PNM_SETCARETINFO, (FX_INTPTR)&newInfo, 0); + pParent->OnNotify(this, PNM_SETCARETINFO, (intptr_t)&newInfo, 0); } } break; @@ -340,7 +340,7 @@ CPWL_Note_Icon::~CPWL_Note_Icon() { } -void CPWL_Note_Icon::SetIconType(FX_INT32 nType) +void CPWL_Note_Icon::SetIconType(int32_t nType) { m_nType = nType; } @@ -481,14 +481,14 @@ CPWL_NoteItem* CPWL_Note_Contents::CreateSubItem() return pNoteItem; } -FX_INT32 CPWL_Note_Contents::CountSubItems() const +int32_t CPWL_Note_Contents::CountSubItems() const { return m_aChildren.GetSize() - 1; } -IPWL_NoteItem* CPWL_Note_Contents::GetSubItems(FX_INT32 index) const +IPWL_NoteItem* CPWL_Note_Contents::GetSubItems(int32_t index) const { - FX_INT32 nIndex = index + 1; + int32_t nIndex = index + 1; if (nIndex > 0 && nIndex < m_aChildren.GetSize()) if (CPWL_Wnd* pChild = m_aChildren.GetAt(nIndex)) @@ -502,7 +502,7 @@ IPWL_NoteItem* CPWL_Note_Contents::GetSubItems(FX_INT32 index) const void CPWL_Note_Contents::DeleteSubItem(IPWL_NoteItem* pNoteItem) { - FX_INT32 nIndex = this->GetItemIndex((CPWL_NoteItem*)pNoteItem); + int32_t nIndex = this->GetItemIndex((CPWL_NoteItem*)pNoteItem); if (nIndex > 0) { @@ -513,7 +513,7 @@ void CPWL_Note_Contents::DeleteSubItem(IPWL_NoteItem* pNoteItem) delete pPWLNoteItem; } - for (FX_INT32 i=nIndex,sz=m_aChildren.GetSize(); iParentToChild(point); - for (FX_INT32 i=0,sz=m_aChildren.GetSize(); iGetItemIndex(pWnd); + int32_t nIndex = this->GetItemIndex(pWnd); if (nIndex < 0) nIndex = 0; m_pEdit->EnableNotify(FALSE); this->ResetContent(nIndex); m_pEdit->EnableNotify(TRUE); - for (FX_INT32 i=nIndex+1, sz=m_aChildren.GetSize(); iOnNotify(this, PNM_NOTERESET, 0, 0); @@ -586,7 +586,7 @@ void CPWL_Note_Contents::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam if (CPWL_Wnd * pParent = this->GetParentWindow()) { - pParent->OnNotify(this, PNM_SETCARETINFO, (FX_INTPTR)&newInfo, 0); + pParent->OnNotify(this, PNM_SETCARETINFO, (intptr_t)&newInfo, 0); } } return; @@ -596,7 +596,7 @@ void CPWL_Note_Contents::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam this->ResetContent(0); m_pEdit->EnableNotify(TRUE); - for (FX_INT32 i=1, sz=m_aChildren.GetSize(); iOnNotify(this, PNM_NOTERESET, 0, 0); @@ -645,7 +645,7 @@ void CPWL_Note_Contents::EnableModify(FX_BOOL bEnabled) else m_pEdit->RemoveFlag(PWS_READONLY); - for (FX_INT32 i=0,sz=m_aChildren.GetSize(); iRemoveFlag(PES_NOREAD); - for (FX_INT32 i=0,sz=m_aChildren.GetSize(); iCountSubItems(); @@ -974,7 +974,7 @@ FX_INT32 CPWL_NoteItem::CountSubItems() const return 0; } -IPWL_NoteItem* CPWL_NoteItem::GetSubItems(FX_INT32 index) const +IPWL_NoteItem* CPWL_NoteItem::GetSubItems(int32_t index) const { if (m_pContents) return m_pContents->GetSubItems(index); @@ -1095,7 +1095,7 @@ FX_BOOL CPWL_NoteItem::OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag) return CPWL_Wnd::OnRButtonUp(point,nFlag); } -void CPWL_NoteItem::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam, FX_INTPTR lParam) +void CPWL_NoteItem::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t lParam) { switch (msg) { @@ -1117,7 +1117,7 @@ void CPWL_NoteItem::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam, FX_ if (CPWL_Wnd * pParent = this->GetParentWindow()) { - pParent->OnNotify(this, PNM_SETCARETINFO, (FX_INTPTR)&newInfo, 0); + pParent->OnNotify(this, PNM_SETCARETINFO, (intptr_t)&newInfo, 0); } } return; @@ -1135,7 +1135,7 @@ void CPWL_NoteItem::PopupNoteItemMenu(const CPDF_Point& point) { if (IPWL_NoteNotify* pNotify = GetNoteNotify()) { - FX_INT32 x,y; + int32_t x,y; PWLtoWnd(point, x, y); if (IFX_SystemHandler* pSH = GetSystemHandler()) pSH->ClientToScreen(GetAttachedHWnd(), x, y); @@ -1247,7 +1247,7 @@ void CPWL_Note::RePosChildWnd() } } //CPDF_Point ptNew = m_pContents->GetScrollPos(); - //m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (FX_INTPTR)&ptNew.y); + //m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&ptNew.y); } FX_BOOL CPWL_Note::ResetScrollBar() @@ -1420,7 +1420,7 @@ void CPWL_Note::RePosNoteChildren() } //0-normal / 1-caption / 2-leftbottom corner / 3-rightbottom corner / 4-close / 5-options -FX_INT32 CPWL_Note::NoteHitTest(const CPDF_Point& point) const +int32_t CPWL_Note::NoteHitTest(const CPDF_Point& point) const { ASSERT(m_pSubject != NULL); ASSERT(m_pDateTime != NULL); @@ -1570,8 +1570,8 @@ FX_BOOL CPWL_Note::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD if (ptNew.y != ptScroll.y) { m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0); - m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL, (FX_INTPTR)&ptNew.y); - m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (FX_INTPTR)&ptNew.y); + m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL, (intptr_t)&ptNew.y); + m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&ptNew.y); return TRUE; } @@ -1580,7 +1580,7 @@ FX_BOOL CPWL_Note::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD return FALSE; } -void CPWL_Note::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam, FX_INTPTR lParam) +void CPWL_Note::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t lParam) { switch (msg) { @@ -1615,7 +1615,7 @@ void CPWL_Note::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam, FX_INTP { if (m_pContentsBar->IsVisible()) { - m_pContentsBar->OnNotify(pWnd, PNM_SETSCROLLINFO, SBT_VSCROLL, (FX_INTPTR)&sInfo); + m_pContentsBar->OnNotify(pWnd, PNM_SETSCROLLINFO, SBT_VSCROLL, (intptr_t)&sInfo); m_OldScrollInfo = sInfo; CPDF_Point ptScroll = m_pContents->GetScrollPos(); @@ -1630,9 +1630,9 @@ void CPWL_Note::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam, FX_INTP if (ptOld.y != ptScroll.y) { - m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (FX_INTPTR)&ptScroll.y); + m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&ptScroll.y); m_pContentsBar->InvalidateRect(NULL); - m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL, (FX_INTPTR)&ptScroll.y); + m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL, (intptr_t)&ptScroll.y); } } } @@ -1662,10 +1662,10 @@ void CPWL_Note::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam, FX_INTP if (pInfo->ptHead.y > rcClient.top) { CPDF_Point pt = m_pContents->OutToIn(pInfo->ptHead); - m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL, (FX_INTPTR)&pt.y); + m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL, (intptr_t)&pt.y); CPDF_Point ptScroll = m_pContents->GetScrollPos(); - m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (FX_INTPTR)&ptScroll.y); + m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&ptScroll.y); return; } @@ -1674,10 +1674,10 @@ void CPWL_Note::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam, FX_INTP { CPDF_Point pt = m_pContents->OutToIn(pInfo->ptFoot); pt.y += rcClient.Height(); - m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL, (FX_INTPTR)&pt.y); + m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL, (intptr_t)&pt.y); CPDF_Point ptScroll = m_pContents->GetScrollPos(); - m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (FX_INTPTR)&ptScroll.y); + m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&ptScroll.y); return; } @@ -1717,7 +1717,7 @@ FX_BOOL CPWL_Note::OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) { if (IPWL_NoteNotify* pNotify = this->GetNoteNotify()) { - FX_INT32 x, y; + int32_t x, y; PWLtoWnd(point, x, y); if (IFX_SystemHandler* pSH = GetSystemHandler()) pSH->ClientToScreen(GetAttachedHWnd(), x, y); @@ -1749,7 +1749,7 @@ IPWL_NoteNotify* CPWL_Note::GetNoteNotify() const return NULL; } -void CPWL_Note::SetIconType(FX_INT32 nType) +void CPWL_Note::SetIconType(int32_t nType) { if (m_pIcon) m_pIcon->SetIconType(nType); diff --git a/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp index 772e184902..ad293bc578 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp @@ -281,7 +281,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p if (rectWnd.IsEmpty()) return; CPDF_Point ptCenter = this->GetCenterPoint(); - FX_INT32 nTransparancy = this->GetTransparency(); + int32_t nTransparancy = this->GetTransparency(); switch (this->m_eScrollBarType) { @@ -570,7 +570,7 @@ FX_BOOL CPWL_SBButton::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) CPWL_Wnd::OnLButtonDown(point,nFlag); if (CPWL_Wnd * pParent = GetParentWindow()) - pParent->OnNotify(this,PNM_LBUTTONDOWN,0,(FX_INTPTR)&point); + pParent->OnNotify(this,PNM_LBUTTONDOWN,0,(intptr_t)&point); m_bMouseDown = TRUE; SetCapture(); @@ -583,7 +583,7 @@ FX_BOOL CPWL_SBButton::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag) CPWL_Wnd::OnLButtonUp(point,nFlag); if (CPWL_Wnd * pParent = GetParentWindow()) - pParent->OnNotify(this,PNM_LBUTTONUP,0,(FX_INTPTR)&point); + pParent->OnNotify(this,PNM_LBUTTONUP,0,(intptr_t)&point); m_bMouseDown = FALSE; ReleaseCapture(); @@ -597,12 +597,12 @@ FX_BOOL CPWL_SBButton::OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag) if (CPWL_Wnd * pParent = GetParentWindow()) { - pParent->OnNotify(this,PNM_MOUSEMOVE,0,(FX_INTPTR)&point); + pParent->OnNotify(this,PNM_MOUSEMOVE,0,(intptr_t)&point); /* if (m_bMouseDown && (m_eSBButtonType == PSBT_MIN || m_eSBButtonType == PSBT_MAX)) { - if (!pParent->OnNotify(this,PNM_LBUTTONDOWN,nFlags,(FX_INTPTR)&point)) + if (!pParent->OnNotify(this,PNM_LBUTTONDOWN,nFlags,(intptr_t)&point)) return FALSE; } */ @@ -840,7 +840,7 @@ FX_BOOL CPWL_ScrollBar::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag) return TRUE; } -void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam, FX_INTPTR lParam) +void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t lParam) { CPWL_Wnd::OnNotify(pWnd,msg,wParam,lParam); @@ -1214,7 +1214,7 @@ void CPWL_ScrollBar::NotifyScrollWindow() fPos = m_OriginInfo.fContentMax - m_sData.fScrollPos; break; } - pParent->OnNotify(this,PNM_SCROLLWINDOW,(FX_INTPTR)m_sbType,(FX_INTPTR)&fPos); + pParent->OnNotify(this,PNM_SCROLLWINDOW,(intptr_t)m_sbType,(intptr_t)&fPos); } } diff --git a/fpdfsdk/src/pdfwindow/PWL_Signature.cpp b/fpdfsdk/src/pdfwindow/PWL_Signature.cpp index 5d79ce9cab..fe07630057 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Signature.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Signature.cpp @@ -42,8 +42,8 @@ void CPWL_Signature_Image::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Ma FX_FLOAT x, y; pUser2Device->Transform(rcClient.left, rcClient.top, x, y); - pDevice->StretchDIBits(m_pImage, (FX_INT32)x, (FX_INT32)y, - (FX_INT32)rcClient.Width(), (FX_INT32)rcClient.Height()); + pDevice->StretchDIBits(m_pImage, (int32_t)x, (int32_t)y, + (int32_t)rcClient.Width(), (int32_t)rcClient.Height()); } } diff --git a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp index b57f8e019d..884807364e 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp @@ -16,11 +16,11 @@ /* ---------------------------- CPWL_Utils ------------------------------ */ -CFX_ByteString CPWL_Utils::GetAppStreamFromArray(const CPWL_PathData* pPathData, FX_INT32 nCount) +CFX_ByteString CPWL_Utils::GetAppStreamFromArray(const CPWL_PathData* pPathData, int32_t nCount) { CFX_ByteTextBuf csAP; - for (FX_INT32 i=0; i= 5) nNext -= 5; @@ -476,7 +476,7 @@ static CFX_ByteString GetSquigglyAppearanceStream(FX_FLOAT fStartX, FX_FLOAT fEn sRet << "0 w\n" << fStartX << " " << fY << " m\n"; FX_FLOAT fx; - FX_INT32 i; + int32_t i; for (i=1,fx=fStartX+fStep; fxDrawPath(&path, pUser2Device, NULL, color, 0, FXFILL_ALTERNATE); @@ -1468,14 +1468,14 @@ void CPWL_Utils::DrawStrokeLine(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2De } void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,const CPDF_Rect & rect, - const CPWL_Color & color, FX_INT32 nTransparancy) + const CPWL_Color & color, int32_t nTransparancy) { CPWL_Utils::DrawFillRect(pDevice,pUser2Device,rect,PWLColorToFXColor(color,nTransparancy)); } void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, FX_BOOL bVertical, FX_BOOL bHorizontal, CPDF_Rect rect, - FX_INT32 nTransparancy, FX_INT32 nStartGray, FX_INT32 nEndGray) + int32_t nTransparancy, int32_t nStartGray, int32_t nEndGray) { FX_FLOAT fStepGray = 1.0f; @@ -1485,7 +1485,7 @@ void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device for (FX_FLOAT fy=rect.bottom+0.5f; fy<=rect.top-0.5f; fy+=1.0f) { - FX_INT32 nGray = nStartGray + (FX_INT32)(fStepGray * (fy-rect.bottom)); + int32_t nGray = nStartGray + (int32_t)(fStepGray * (fy-rect.bottom)); CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, CPDF_Point(rect.left, fy), CPDF_Point(rect.right, fy), ArgbEncode(nTransparancy, nGray, nGray, nGray), 1.5f); } @@ -1497,7 +1497,7 @@ void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device for (FX_FLOAT fx=rect.left+0.5f; fx<=rect.right-0.5f; fx+=1.0f) { - FX_INT32 nGray = nStartGray + (FX_INT32)(fStepGray * (fx-rect.left)); + int32_t nGray = nStartGray + (int32_t)(fStepGray * (fx-rect.left)); CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, CPDF_Point(fx, rect.bottom), CPDF_Point(fx, rect.top), ArgbEncode(nTransparancy, nGray, nGray, nGray), 1.5f); } @@ -1507,7 +1507,7 @@ void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, const CPDF_Rect & rect, FX_FLOAT fWidth, const CPWL_Color & color, const CPWL_Color & crLeftTop, const CPWL_Color & crRightBottom, - FX_INT32 nStyle, const CPWL_Dash & dash, FX_INT32 nTransparancy) + int32_t nStyle, const CPWL_Dash & dash, int32_t nTransparancy) { FX_FLOAT fLeft = rect.left; FX_FLOAT fRight = rect.right; @@ -1622,7 +1622,7 @@ static void AddSquigglyPath(CFX_PathData & PathData, FX_FLOAT fStartX, FX_FLOAT PathData.SetPoint(PathData.GetPointCount() - 1, fStartX, fY, FXPT_MOVETO); FX_FLOAT fx; - FX_INT32 i; + int32_t i; for (i=1,fx=fStartX+fStep; fxTransformRect(rcTemp); FX_RECT rcDevClip; - rcDevClip.left = (FX_INT32)rcTemp.left; - rcDevClip.right = (FX_INT32)rcTemp.right; - rcDevClip.top = (FX_INT32)rcTemp.top; - rcDevClip.bottom = (FX_INT32)rcTemp.bottom; + rcDevClip.left = (int32_t)rcTemp.left; + rcDevClip.right = (int32_t)rcTemp.right; + rcDevClip.top = (int32_t)rcTemp.top; + rcDevClip.bottom = (int32_t)rcTemp.bottom; pDevice->SetClip_Rect(&rcDevClip); } @@ -1848,7 +1848,7 @@ CPWL_Color CPWL_Utils::GetReverseColor(const CPWL_Color& color) return crRet; } -CFX_ByteString CPWL_Utils::GetIconAppStream(FX_INT32 nType, const CPDF_Rect& rect, const CPWL_Color& crFill, +CFX_ByteString CPWL_Utils::GetIconAppStream(int32_t nType, const CPDF_Rect& rect, const CPWL_Color& crFill, const CPWL_Color& crStroke) { CFX_ByteString sAppStream = CPWL_Utils::GetColorAppStream(crStroke, FALSE); @@ -1931,7 +1931,7 @@ CFX_ByteString CPWL_Utils::GetIconAppStream(FX_INT32 nType, const CPDF_Rect& rec } void CPWL_Utils::DrawIconAppStream(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, - FX_INT32 nType, const CPDF_Rect & rect, const CPWL_Color& crFill, const CPWL_Color& crStroke, const FX_INT32 nTransparancy) + int32_t nType, const CPDF_Rect & rect, const CPWL_Color& crFill, const CPWL_Color& crStroke, const int32_t nTransparancy) { CFX_GraphStateData gsd; gsd.m_LineWidth = 1.0f; @@ -2477,7 +2477,7 @@ void CPWL_Utils::GetGraphics_Star(CFX_ByteString& sPathData, CFX_PathData& path, FX_FLOAT fAngel = PWL_PI/10.0f; - for (FX_INT32 i=0; i<5; i++) + for (int32_t i=0; i<5; i++) { px1[i] = ptCenter.x + fLongRadius * (FX_FLOAT)cos(fAngel); py1[i] = ptCenter.y + fLongRadius * (FX_FLOAT)sin(fAngel); @@ -2487,7 +2487,7 @@ void CPWL_Utils::GetGraphics_Star(CFX_ByteString& sPathData, CFX_PathData& path, fAngel = PWL_PI/5.0f + PWL_PI/10.0f; - for (FX_INT32 j=0; j<5; j++) + for (int32_t j=0; j<5; j++) { px2[j] = ptCenter.x + fShortRadius * (FX_FLOAT)cos(fAngel); py2[j] = ptCenter.y + fShortRadius * (FX_FLOAT)sin(fAngel); @@ -2499,7 +2499,7 @@ void CPWL_Utils::GetGraphics_Star(CFX_ByteString& sPathData, CFX_PathData& path, PathArray[0] = CPWL_PathData(CPWL_Point(px1[0], py1[0]), PWLPT_MOVETO); PathArray[1] = CPWL_PathData(CPWL_Point(px2[0], py2[0]), PWLPT_LINETO); - for(FX_INT32 k = 0; k < 4; k++) + for(int32_t k = 0; k < 4; k++) { PathArray[(k+1)*2] = CPWL_PathData(CPWL_Point(px1[k+1], py1[k+1]), PWLPT_LINETO); PathArray[(k+1)*2 + 1] = CPWL_PathData(CPWL_Point(px2[k+1], py2[k+1]), PWLPT_LINETO); @@ -2795,7 +2795,7 @@ void CPWL_Utils::GetGraphics_Foxit(CFX_ByteString& sPathData, CFX_PathData& path GetPathDataFromArray(path, PathArray, 23); } -void CPWL_Color::ConvertColorType(FX_INT32 nColorType) +void CPWL_Color::ConvertColorType(int32_t nColorType) { switch (this->nColorType) { diff --git a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp index 69535d7d85..c621508885 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp @@ -11,10 +11,10 @@ /* -------------------------- CPWL_Timer -------------------------- */ -static CFX_MapPtrTemplate& GetPWLTimeMap() +static CFX_MapPtrTemplate& GetPWLTimeMap() { // Leak the object at shutdown. - static auto timeMap = new CFX_MapPtrTemplate; + static auto timeMap = new CFX_MapPtrTemplate; return *timeMap; } @@ -32,7 +32,7 @@ CPWL_Timer::~CPWL_Timer() KillPWLTimer(); } -FX_INT32 CPWL_Timer::SetPWLTimer(FX_INT32 nElapse) +int32_t CPWL_Timer::SetPWLTimer(int32_t nElapse) { if (m_nTimerID != 0) KillPWLTimer(); m_nTimerID = m_pSystemHandler->SetTimer(nElapse, TimerProc); @@ -50,7 +50,7 @@ void CPWL_Timer::KillPWLTimer() } } -void CPWL_Timer::TimerProc(FX_INT32 idEvent) +void CPWL_Timer::TimerProc(int32_t idEvent) { CPWL_Timer* pTimer = NULL; if (GetPWLTimeMap().Lookup(idEvent, pTimer)) @@ -74,7 +74,7 @@ CPWL_TimerHandler::~CPWL_TimerHandler() if (m_pTimer) delete m_pTimer; } -void CPWL_TimerHandler::BeginTimer(FX_INT32 nElapse) +void CPWL_TimerHandler::BeginTimer(int32_t nElapse) { if (!m_pTimer) m_pTimer = new CPWL_Timer(this, GetSystemHandler()); @@ -134,7 +134,7 @@ public: FX_BOOL IsWndCaptureMouse(const CPWL_Wnd * pWnd) const { if (pWnd) - for( FX_INT32 i=0,sz=m_aMousePath.GetSize(); i= 0; i --) + for (int32_t i = m_aChildren.GetSize()-1; i >= 0; i --) { if (CPWL_Wnd * pChild = m_aChildren[i]) { @@ -355,7 +355,7 @@ void CPWL_Wnd::InvalidateRectMove(const CPDF_Rect & rcOld, const CPDF_Rect & rc CPDF_Rect SubArray[4]; rcOld.Substract4(rcNew,SubArray); - for (FX_INT32 i=0;i<4;i++) + for (int32_t i=0;i<4;i++) { if (SubArray[i].left == 0 && SubArray[i].right == 0 && @@ -366,7 +366,7 @@ void CPWL_Wnd::InvalidateRectMove(const CPDF_Rect & rcOld, const CPDF_Rect & rc } rcNew.Substract4(rcOld,SubArray); - for (FX_INT32 j=0;j<4;j++) + for (int32_t j=0;j<4;j++) { if (SubArray[j].left == 0 && SubArray[j].right == 0 && @@ -423,7 +423,7 @@ void CPWL_Wnd::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) void CPWL_Wnd::GetChildAppearanceStream(CFX_ByteTextBuf & sAppStream) { - for (FX_INT32 i=0,sz=m_aChildren.GetSize(); i= 0; i --) + for (int32_t i = m_aChildren.GetSize()-1; i >= 0; i --) { if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { @@ -634,7 +634,7 @@ void CPWL_Wnd::RemoveChild(CPWL_Wnd * pWnd) } } -void CPWL_Wnd::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam, FX_INTPTR lParam) +void CPWL_Wnd::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t lParam) { switch (msg) { @@ -753,18 +753,18 @@ CPWL_Color CPWL_Wnd::GetTextStrokeColor() const return m_sPrivateParam.sTextStrokeColor; } -FX_INT32 CPWL_Wnd::GetBorderStyle() const +int32_t CPWL_Wnd::GetBorderStyle() const { return m_sPrivateParam.nBorderStyle; } -void CPWL_Wnd::SetBorderStyle(FX_INT32 nBorderStyle) +void CPWL_Wnd::SetBorderStyle(int32_t nBorderStyle) { if (HasFlag(PWS_BORDER)) m_sPrivateParam.nBorderStyle = nBorderStyle; } -FX_INT32 CPWL_Wnd::GetBorderWidth() const +int32_t CPWL_Wnd::GetBorderWidth() const { if (HasFlag(PWS_BORDER)) return m_sPrivateParam.dwBorderWidth; @@ -772,7 +772,7 @@ FX_INT32 CPWL_Wnd::GetBorderWidth() const return 0; } -FX_INT32 CPWL_Wnd::GetInnerBorderWidth() const +int32_t CPWL_Wnd::GetInnerBorderWidth() const { /* switch (GetBorderStyle()) @@ -785,7 +785,7 @@ FX_INT32 CPWL_Wnd::GetInnerBorderWidth() const return 0; } -void CPWL_Wnd::SetBorderWidth(FX_INT32 nBorderWidth) +void CPWL_Wnd::SetBorderWidth(int32_t nBorderWidth) { if (HasFlag(PWS_BORDER)) m_sPrivateParam.dwBorderWidth = nBorderWidth; @@ -861,7 +861,7 @@ void CPWL_Wnd::SetCapture() void CPWL_Wnd::ReleaseCapture() { - for (FX_INT32 i=0,sz=m_aChildren.GetSize(); iReleaseCapture(); @@ -918,7 +918,7 @@ void CPWL_Wnd::SetVisible(FX_BOOL bVisible) { if (IsValid()) { - for (FX_INT32 i=0,sz=m_aChildren.GetSize(); iGetCreationParam().eCursorType; + int32_t nCursorType = this->GetCreationParam().eCursorType; pSH->SetCursor(nCursorType); } } @@ -1063,7 +1063,7 @@ IFX_Edit_FontMap* CPWL_Wnd::GetFontMap() const return m_sPrivateParam.pFontMap; } -CPWL_Color CPWL_Wnd::GetBorderLeftTopColor(FX_INT32 nBorderStyle) const +CPWL_Color CPWL_Wnd::GetBorderLeftTopColor(int32_t nBorderStyle) const { CPWL_Color color; @@ -1086,7 +1086,7 @@ CPWL_Color CPWL_Wnd::GetBorderLeftTopColor(FX_INT32 nBorderStyle) const return color; } -CPWL_Color CPWL_Wnd::GetBorderRightBottomColor(FX_INT32 nBorderStyle) const +CPWL_Color CPWL_Wnd::GetBorderRightBottomColor(int32_t nBorderStyle) const { CPWL_Color color; @@ -1111,14 +1111,14 @@ CPWL_Color CPWL_Wnd::GetBorderRightBottomColor(FX_INT32 nBorderStyle) const /* ----------------------------------------------------------------- */ -FX_INT32 CPWL_Wnd::GetTransparency() +int32_t CPWL_Wnd::GetTransparency() { return m_sPrivateParam.nTransparency; } -void CPWL_Wnd::SetTransparency(FX_INT32 nTransparency) +void CPWL_Wnd::SetTransparency(int32_t nTransparency) { - for (FX_INT32 i=0,sz=m_aChildren.GetSize(); i + #include "fpdfview.h" // Define all types used in the SDK. Note they can be simply regarded as opaque pointers // or long integer numbers. -#define FPDF_ARGB(a,r,g,b) ((((FX_DWORD)(((FX_BYTE)(b)|((FX_WORD)((FX_BYTE)(g))<<8))|(((FX_DWORD)(FX_BYTE)(r))<<16)))) | (((FX_DWORD)(FX_BYTE)(a))<<24)) -#define FPDF_GetBValue(argb) ((FX_BYTE)(argb)) -#define FPDF_GetGValue(argb) ((FX_BYTE)(((FX_WORD)(argb)) >> 8)) -#define FPDF_GetRValue(argb) ((FX_BYTE)((argb)>>16)) -#define FPDF_GetAValue(argb) ((FX_BYTE)((argb)>>24)) +#define FPDF_ARGB(a,r,g,b) ((((uint32_t)(((uint8_t)(b)|((FX_WORD)((uint8_t)(g))<<8))|(((FX_DWORD)(uint8_t)(r))<<16)))) | (((FX_DWORD)(uint8_t)(a))<<24)) +#define FPDF_GetBValue(argb) ((uint8_t)(argb)) +#define FPDF_GetGValue(argb) ((uint8_t)(((uint16_t)(argb)) >> 8)) +#define FPDF_GetRValue(argb) ((uint8_t)((argb)>>16)) +#define FPDF_GetAValue(argb) ((uint8_t)((argb)>>24)) #ifdef __cplusplus extern "C" { -- cgit v1.2.3