diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-06-10 14:33:37 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-06-10 14:33:37 -0700 |
commit | d7e5cc754a937605d1f73db5e7967c58ddd80742 (patch) | |
tree | ed28e012c4d6a46b7f29f15a0c060474c27d4286 /core/src | |
parent | bfa9a824a20f37c2dd7111012b46c929cf2ed8a0 (diff) | |
download | pdfium-d7e5cc754a937605d1f73db5e7967c58ddd80742.tar.xz |
Merge to XFA: Remove typdefs for pointer types in fx_system.h.
Original Review URL: https://codereview.chromium.org/1171733003
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1178613002.
Diffstat (limited to 'core/src')
127 files changed, 2154 insertions, 2139 deletions
diff --git a/core/src/fdrm/crypto/fx_crypt.cpp b/core/src/fdrm/crypto/fx_crypt.cpp index da9fcc5693..f6b3148dba 100644 --- a/core/src/fdrm/crypto/fx_crypt.cpp +++ b/core/src/fdrm/crypto/fx_crypt.cpp @@ -14,7 +14,7 @@ extern "C" { struct rc4_state { int x, y, m[256]; }; -void CRYPT_ArcFourSetup(void* context, FX_LPCBYTE key, FX_DWORD length ) +void CRYPT_ArcFourSetup(void* context, const uint8_t* key, FX_DWORD length ) { rc4_state *s = (rc4_state*)context; int i, j, k, *m, a; @@ -53,7 +53,7 @@ void CRYPT_ArcFourCrypt(void* context, unsigned char *data, FX_DWORD length ) s->x = x; s->y = y; } -void CRYPT_ArcFourCryptBlock(FX_LPBYTE pData, FX_DWORD size, FX_LPCBYTE key, FX_DWORD keylen) +void CRYPT_ArcFourCryptBlock(uint8_t* pData, FX_DWORD size, const uint8_t* key, FX_DWORD keylen) { rc4_state s; CRYPT_ArcFourSetup(&s, key, keylen); @@ -193,7 +193,7 @@ void CRYPT_MD5Start(void* context) ctx->state[2] = 0x98BADCFE; ctx->state[3] = 0x10325476; } -void CRYPT_MD5Update(FX_LPVOID pctx, FX_LPCBYTE input, FX_DWORD length ) +void CRYPT_MD5Update(void* pctx, const uint8_t* input, FX_DWORD length ) { struct md5_context *ctx = (struct md5_context *)pctx; FX_DWORD left, fill; @@ -228,7 +228,7 @@ const uint8_t md5_padding[64] = { 0, 0, 0, 0, 0, 0, 0, 0, 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, uint8_t digest[16] ) +void CRYPT_MD5Finish(void* pctx, uint8_t digest[16] ) { struct md5_context *ctx = (struct md5_context *)pctx; FX_DWORD last, padn; @@ -244,15 +244,15 @@ void CRYPT_MD5Finish(FX_LPVOID pctx, uint8_t 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, uint8_t digest[16]) +void CRYPT_MD5Generate(const uint8_t* input, FX_DWORD length, uint8_t digest[16]) { md5_context ctx; CRYPT_MD5Start(&ctx); CRYPT_MD5Update(&ctx, input, length); CRYPT_MD5Finish(&ctx, digest); } -static FX_BOOL (*g_PubKeyDecryptor)(FX_LPCBYTE pData, FX_DWORD size, FX_LPBYTE data_buf, FX_DWORD& data_len) = NULL; -void CRYPT_SetPubKeyDecryptor(FX_BOOL (*func)(FX_LPCBYTE pData, FX_DWORD size, FX_LPBYTE data_buf, FX_DWORD& data_len)) +static FX_BOOL (*g_PubKeyDecryptor)(const uint8_t* pData, FX_DWORD size, uint8_t* data_buf, FX_DWORD& data_len) = NULL; +void CRYPT_SetPubKeyDecryptor(FX_BOOL (*func)(const uint8_t* pData, FX_DWORD size, uint8_t* data_buf, FX_DWORD& data_len)) { g_PubKeyDecryptor = func; } diff --git a/core/src/fdrm/crypto/fx_crypt_aes.cpp b/core/src/fdrm/crypto/fx_crypt_aes.cpp index 6efa935be3..4de0f7e752 100644 --- a/core/src/fdrm/crypto/fx_crypt_aes.cpp +++ b/core/src/fdrm/crypto/fx_crypt_aes.cpp @@ -989,22 +989,22 @@ static void aes_encrypt_cbc(unsigned char *dest, const unsigned char *src, int l } FXSYS_memcpy32(ctx->iv, iv, sizeof(iv)); } -void CRYPT_AESSetKey(FX_LPVOID context, FX_DWORD blocklen, FX_LPCBYTE key, FX_DWORD keylen, FX_BOOL bEncrypt) +void CRYPT_AESSetKey(void* context, FX_DWORD blocklen, const uint8_t* key, FX_DWORD keylen, FX_BOOL bEncrypt) { aes_setup((AESContext*)context, blocklen, key, keylen); } -void CRYPT_AESSetIV(FX_LPVOID context, FX_LPCBYTE iv) +void CRYPT_AESSetIV(void* context, const uint8_t* iv) { int i; for (i = 0; i < ((AESContext*)context)->Nb; i++) { ((AESContext*)context)->iv[i] = GET_32BIT_MSB_FIRST(iv + 4 * i); } } -void CRYPT_AESDecrypt(FX_LPVOID context, FX_LPBYTE dest, FX_LPCBYTE src, FX_DWORD len) +void CRYPT_AESDecrypt(void* context, uint8_t* dest, const uint8_t* src, FX_DWORD len) { aes_decrypt_cbc(dest, src, len, (AESContext*)context); } -void CRYPT_AESEncrypt(FX_LPVOID context, FX_LPBYTE dest, FX_LPCBYTE src, FX_DWORD len) +void CRYPT_AESEncrypt(void* context, uint8_t* dest, const uint8_t* src, FX_DWORD len) { aes_encrypt_cbc(dest, src, len, (AESContext*)context); } diff --git a/core/src/fdrm/crypto/fx_crypt_sha.cpp b/core/src/fdrm/crypto/fx_crypt_sha.cpp index 1a55d11633..55a3f0e5bf 100644 --- a/core/src/fdrm/crypto/fx_crypt_sha.cpp +++ b/core/src/fdrm/crypto/fx_crypt_sha.cpp @@ -82,14 +82,14 @@ static void SHATransform(unsigned int * digest, unsigned int * block) digest[3] += d; digest[4] += e; } -void CRYPT_SHA1Start(FX_LPVOID context) +void CRYPT_SHA1Start(void* context) { SHA_State * s = (SHA_State*)context; SHA_Core_Init(s->h); s->blkused = 0; s->lenhi = s->lenlo = 0; } -void CRYPT_SHA1Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size) +void CRYPT_SHA1Update(void* context, const uint8_t* data, FX_DWORD size) { SHA_State * s = (SHA_State*)context; unsigned char *q = (unsigned char *)data; @@ -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, uint8_t digest[20]) +void CRYPT_SHA1Finish(void* context, uint8_t digest[20]) { SHA_State * s = (SHA_State*)context; int i; @@ -154,7 +154,7 @@ void CRYPT_SHA1Finish(FX_LPVOID context, uint8_t digest[20]) digest[i * 4 + 3] = (s->h[i]) & 0xFF; } } -void CRYPT_SHA1Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[20]) +void CRYPT_SHA1Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[20]) { SHA_State s; CRYPT_SHA1Start(&s); @@ -181,7 +181,7 @@ sha256_context; (b)[(i) + 2] = (uint8_t) ( (n) >> 8 ); \ (b)[(i) + 3] = (uint8_t) ( (n) ); \ } -void CRYPT_SHA256Start( FX_LPVOID context ) +void CRYPT_SHA256Start( void* context ) { sha256_context *ctx = (sha256_context *)context; ctx->total[0] = 0; @@ -315,7 +315,7 @@ static void sha256_process( sha256_context *ctx, const uint8_t data[64] ) ctx->state[6] += G; ctx->state[7] += H; } -void CRYPT_SHA256Update( void* context, FX_LPCBYTE input, FX_DWORD length ) +void CRYPT_SHA256Update( void* context, const uint8_t* input, FX_DWORD length ) { sha256_context *ctx = (sha256_context *)context; FX_DWORD left, fill; @@ -353,7 +353,7 @@ static const uint8_t sha256_padding[64] = { 0, 0, 0, 0, 0, 0, 0, 0, 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, uint8_t digest[32] ) +void CRYPT_SHA256Finish( void* context, uint8_t digest[32] ) { sha256_context *ctx = (sha256_context *)context; FX_DWORD last, padn; @@ -377,7 +377,7 @@ void CRYPT_SHA256Finish( FX_LPVOID context, uint8_t 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, uint8_t digest[32]) +void CRYPT_SHA256Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[32]) { sha256_context ctx; CRYPT_SHA256Start(&ctx); @@ -389,7 +389,7 @@ typedef struct { uint64_t state[8]; uint8_t buffer[128]; } sha384_context; -uint64_t FX_ato64i(FX_LPCSTR str) +uint64_t FX_ato64i(const FX_CHAR* str) { FXSYS_assert(str != NULL); uint64_t ret = 0; @@ -411,7 +411,7 @@ uint64_t FX_ato64i(FX_LPCSTR str) } return ret; } -void CRYPT_SHA384Start(FX_LPVOID context) +void CRYPT_SHA384Start(void* context) { if (context == NULL) { return; @@ -452,7 +452,7 @@ static const uint8_t sha384_padding[128] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; #define SHA384_R(t) (W[t] = SHA384_S1(W[t - 2]) + W[t - 7] + SHA384_S0(W[t - 15]) + W[t - 16]) -static FX_LPCSTR constants[] = { +static const FX_CHAR* constants[] = { "428a2f98d728ae22", "7137449123ef65cd", "b5c0fbcfec4d3b2f", @@ -624,7 +624,7 @@ static void sha384_process( sha384_context *ctx, const uint8_t data[128] ) ctx->state[6] += G; ctx->state[7] += H; } -void CRYPT_SHA384Update(FX_LPVOID context, FX_LPCBYTE input, FX_DWORD length) +void CRYPT_SHA384Update(void* context, const uint8_t* input, FX_DWORD length) { sha384_context *ctx = (sha384_context *)context; FX_DWORD left, fill; @@ -655,7 +655,7 @@ void CRYPT_SHA384Update(FX_LPVOID context, FX_LPCBYTE input, FX_DWORD length) (void *) input, length ); } } -void CRYPT_SHA384Finish(FX_LPVOID context, uint8_t digest[48]) +void CRYPT_SHA384Finish(void* context, uint8_t digest[48]) { sha384_context *ctx = (sha384_context *)context; FX_DWORD last, padn; @@ -678,14 +678,14 @@ void CRYPT_SHA384Finish(FX_LPVOID context, uint8_t 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, uint8_t digest[64]) +void CRYPT_SHA384Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[64]) { sha384_context context; CRYPT_SHA384Start(&context); CRYPT_SHA384Update(&context, data, size); CRYPT_SHA384Finish(&context, digest); } -void CRYPT_SHA512Start(FX_LPVOID context) +void CRYPT_SHA512Start(void* context) { if (context == NULL) { return; @@ -701,11 +701,11 @@ void CRYPT_SHA512Start(FX_LPVOID context) ctx->state[6] = FX_ato64i("1f83d9abfb41bd6b"); ctx->state[7] = FX_ato64i("5be0cd19137e2179"); } -void CRYPT_SHA512Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size) +void CRYPT_SHA512Update(void* context, const uint8_t* data, FX_DWORD size) { CRYPT_SHA384Update(context, data, size); } -void CRYPT_SHA512Finish(FX_LPVOID context, uint8_t digest[64]) +void CRYPT_SHA512Finish(void* context, uint8_t digest[64]) { sha384_context *ctx = (sha384_context *)context; FX_DWORD last, padn; @@ -730,7 +730,7 @@ void CRYPT_SHA512Finish(FX_LPVOID context, uint8_t 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, uint8_t digest[64]) +void CRYPT_SHA512Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[64]) { sha384_context context; CRYPT_SHA512Start(&context); diff --git a/core/src/fpdfapi/fpdf_basic_module.cpp b/core/src/fpdfapi/fpdf_basic_module.cpp index d564bdb687..e3ec425ff6 100644 --- a/core/src/fpdfapi/fpdf_basic_module.cpp +++ b/core/src/fpdfapi/fpdf_basic_module.cpp @@ -50,18 +50,18 @@ CPDF_ModuleMgr::~CPDF_ModuleMgr() delete m_pRenderModule; } } -void CPDF_ModuleMgr::SetDownloadCallback(FX_BOOL (*callback)(FX_LPCSTR module_name)) +void CPDF_ModuleMgr::SetDownloadCallback(FX_BOOL (*callback)(const FX_CHAR* module_name)) { m_pDownloadCallback = callback; } -FX_BOOL CPDF_ModuleMgr::DownloadModule(FX_LPCSTR module_name) +FX_BOOL CPDF_ModuleMgr::DownloadModule(const FX_CHAR* module_name) { if (m_pDownloadCallback == NULL) { return FALSE; } return m_pDownloadCallback(module_name); } -void CPDF_ModuleMgr::NotifyModuleAvailable(FX_LPCSTR module_name) +void CPDF_ModuleMgr::NotifyModuleAvailable(const FX_CHAR* module_name) { if (FXSYS_strcmp(module_name, ADDIN_NAME_CJK) == 0) { m_pPageModule->NotifyCJKAvailable(); @@ -69,7 +69,7 @@ void CPDF_ModuleMgr::NotifyModuleAvailable(FX_LPCSTR module_name) m_pRenderModule->NotifyDecoderAvailable(); } } -void CPDF_ModuleMgr::RegisterSecurityHandler(FX_LPCSTR filter, CPDF_SecurityHandler * (*CreateHandler)(void* param), void* param) +void CPDF_ModuleMgr::RegisterSecurityHandler(const FX_CHAR* filter, CPDF_SecurityHandler * (*CreateHandler)(void* param), void* param) { if (CreateHandler == NULL) { m_SecurityHandlerMap.RemoveKey(filter); @@ -80,15 +80,15 @@ void CPDF_ModuleMgr::RegisterSecurityHandler(FX_LPCSTR filter, CPDF_SecurityHand m_SecurityHandlerMap.SetAt(FX_BSTRC("_param_") + filter, param); } } -void CPDF_ModuleMgr::SetPrivateData(FX_LPVOID module_id, FX_LPVOID pData, PD_CALLBACK_FREEDATA callback) +void CPDF_ModuleMgr::SetPrivateData(void* module_id, void* pData, PD_CALLBACK_FREEDATA callback) { m_privateData.SetPrivateData(module_id, pData, callback); } -FX_LPVOID CPDF_ModuleMgr::GetPrivateData(FX_LPVOID module_id) +void* CPDF_ModuleMgr::GetPrivateData(void* module_id) { return m_privateData.GetPrivateData(module_id); } -CPDF_SecurityHandler* CPDF_ModuleMgr::CreateSecurityHandler(FX_LPCSTR filter) +CPDF_SecurityHandler* CPDF_ModuleMgr::CreateSecurityHandler(const FX_CHAR* filter) { CPDF_SecurityHandler* (*CreateHandler)(void*) = NULL; if (!m_SecurityHandlerMap.Lookup(filter, (void*&)CreateHandler)) { diff --git a/core/src/fpdfapi/fpdf_edit/editint.h b/core/src/fpdfapi/fpdf_edit/editint.h index 38c33439ec..3a9d1588e0 100644 --- a/core/src/fpdfapi/fpdf_edit/editint.h +++ b/core/src/fpdfapi/fpdf_edit/editint.h @@ -15,7 +15,7 @@ public: FX_BOOL Start(); int32_t CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj); - int32_t CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize); + int32_t CompressIndirectObject(FX_DWORD dwObjNum, const uint8_t* pBuffer, FX_DWORD dwSize); FX_FILESIZE End(CPDF_Creator* pCreator); @@ -38,7 +38,7 @@ public: int32_t CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object *pObj, CPDF_Creator *pCreator); - int32_t CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator); + int32_t CompressIndirectObject(FX_DWORD dwObjNum, const uint8_t* pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator); FX_BOOL End(CPDF_Creator *pCreator, FX_BOOL bEOF = FALSE); FX_BOOL AddObjectNumberToIndexArray(FX_DWORD objnum); diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp index 65b482bf30..717386041d 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp @@ -99,7 +99,7 @@ void CPDF_PageContentGenerate::ProcessImage(CFX_ByteTextBuf& buf, CPDF_ImageObje buf << "/" << PDF_NameEncode(name) << " Do Q\n"; } } -void CPDF_PageContentGenerate::ProcessForm(CFX_ByteTextBuf& buf, FX_LPCBYTE data, FX_DWORD size, CFX_Matrix& matrix) +void CPDF_PageContentGenerate::ProcessForm(CFX_ByteTextBuf& buf, const uint8_t* data, FX_DWORD size, CFX_Matrix& matrix) { if (!data || !size) { return; @@ -111,7 +111,7 @@ void CPDF_PageContentGenerate::ProcessForm(CFX_ByteTextBuf& buf, FX_LPCBYTE data CFX_FloatRect bbox = m_pPage->GetPageBBox(); matrix.TransformRect(bbox); pFormDict->SetAtRect(FX_BSTR("BBox"), bbox); - pStream->InitStream((FX_LPBYTE)data, size, pFormDict); + pStream->InitStream((uint8_t*)data, size, pFormDict); buf << "q " << matrix << " cm "; CFX_ByteString name = RealizeResource(pStream, "XObject"); buf << "/" << PDF_NameEncode(name) << " Do Q\n"; @@ -142,7 +142,7 @@ void CPDF_PageContentGenerate::TransformContent(CFX_Matrix& matrix) size += pContentArray[i]->GetSize() + 1; } int pos = 0; - FX_LPBYTE pBuf = FX_Alloc(uint8_t, size); + uint8_t* 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 035baa398f..0091613120 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp @@ -8,9 +8,9 @@ #include "editint.h" #define PDF_OBJECTSTREAM_MAXLENGTH (256 * 1024) #define PDF_XREFSTREAM_MAXSIZE 10000 -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 void FlateEncode(const uint8_t* src_buf, FX_DWORD src_data, uint8_t*& dest_buf, FX_DWORD& dest_size); +extern void FlateEncode(const uint8_t* src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns, + uint8_t*& dest_buf, FX_DWORD& dest_size); extern FX_BOOL IsSignatureDict(const CPDF_Dictionary* pDict); int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive *pFile, FX_FILESIZE& offset) { @@ -283,12 +283,12 @@ int32_t PDF_CreatorWriteEncrypt(const CPDF_Dictionary* pEncryptDict, FX_DWORD dw offset += len + 6; return offset; } -FX_BOOL PDF_GenerateFileID(FX_DWORD dwSeed1, FX_DWORD dwSeed2, FX_LPDWORD pBuffer) +FX_BOOL PDF_GenerateFileID(FX_DWORD dwSeed1, FX_DWORD dwSeed2, FX_DWORD* pBuffer) { if (!pBuffer) { return FALSE; } - FX_LPVOID pContext = FX_Random_MT_Start(dwSeed1); + void* pContext = FX_Random_MT_Start(dwSeed1); int32_t i = 0; for (i = 0; i < 2; i++) { *pBuffer++ = FX_Random_MT_Generate(pContext); @@ -307,9 +307,9 @@ public: CPDF_FlateEncoder(); ~CPDF_FlateEncoder(); FX_BOOL Initialize(CPDF_Stream* pStream, FX_BOOL bFlateEncode); - FX_BOOL Initialize(FX_LPCBYTE pBuffer, FX_DWORD size, FX_BOOL bFlateEncode, FX_BOOL bXRefStream = FALSE); + FX_BOOL Initialize(const uint8_t* pBuffer, FX_DWORD size, FX_BOOL bFlateEncode, FX_BOOL bXRefStream = FALSE); void CloneDict(); - FX_LPBYTE m_pData; + uint8_t* m_pData; FX_DWORD m_dwSize; CPDF_Dictionary* m_pDict; FX_BOOL m_bCloned; @@ -339,13 +339,13 @@ FX_BOOL CPDF_FlateEncoder::Initialize(CPDF_Stream* pStream, FX_BOOL bFlateEncode CPDF_StreamAcc destAcc; destAcc.LoadAllData(pStream); m_dwSize = destAcc.GetSize(); - m_pData = (FX_LPBYTE)destAcc.DetachData(); + m_pData = (uint8_t*)destAcc.DetachData(); m_pDict = (CPDF_Dictionary*)pStream->GetDict()->Clone(); m_pDict->RemoveAt(FX_BSTRC("Filter")); m_bNewData = TRUE; m_bCloned = TRUE; } else { - m_pData = (FX_LPBYTE)m_Acc.GetData(); + m_pData = (uint8_t*)m_Acc.GetData(); m_dwSize = m_Acc.GetSize(); m_pDict = pStream->GetDict(); } @@ -362,10 +362,10 @@ FX_BOOL CPDF_FlateEncoder::Initialize(CPDF_Stream* pStream, FX_BOOL bFlateEncode m_pDict->RemoveAt("DecodeParms"); return TRUE; } -FX_BOOL CPDF_FlateEncoder::Initialize(FX_LPCBYTE pBuffer, FX_DWORD size, FX_BOOL bFlateEncode, FX_BOOL bXRefStream) +FX_BOOL CPDF_FlateEncoder::Initialize(const uint8_t* pBuffer, FX_DWORD size, FX_BOOL bFlateEncode, FX_BOOL bXRefStream) { if (!bFlateEncode) { - m_pData = (FX_LPBYTE)pBuffer; + m_pData = (uint8_t*)pBuffer; m_dwSize = size; return TRUE; } @@ -391,8 +391,8 @@ class CPDF_Encryptor public: CPDF_Encryptor(); ~CPDF_Encryptor(); - FX_BOOL Initialize(CPDF_CryptoHandler* pHandler, int objnum, FX_LPBYTE src_data, FX_DWORD src_size); - FX_LPBYTE m_pData; + FX_BOOL Initialize(CPDF_CryptoHandler* pHandler, int objnum, uint8_t* src_data, FX_DWORD src_size); + uint8_t* m_pData; FX_DWORD m_dwSize; FX_BOOL m_bNewBuf; }; @@ -402,13 +402,13 @@ CPDF_Encryptor::CPDF_Encryptor() m_dwSize = 0; m_bNewBuf = FALSE; } -FX_BOOL CPDF_Encryptor::Initialize(CPDF_CryptoHandler* pHandler, int objnum, FX_LPBYTE src_data, FX_DWORD src_size) +FX_BOOL CPDF_Encryptor::Initialize(CPDF_CryptoHandler* pHandler, int objnum, uint8_t* src_data, FX_DWORD src_size) { if (src_size == 0) { return TRUE; } if (pHandler == NULL) { - m_pData = (FX_LPBYTE)src_data; + m_pData = (uint8_t*)src_data; m_dwSize = src_size; m_bNewBuf = FALSE; return TRUE; @@ -446,7 +446,7 @@ int32_t CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_ m_Buffer << pObj; return 1; } -int32_t CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize) +int32_t CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, const uint8_t* pBuffer, FX_DWORD dwSize) { m_ObjNumArray.Add(dwObjNum); m_OffsetArray.Add(m_Buffer.GetLength()); @@ -564,7 +564,7 @@ int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Ob } return EndObjectStream(pCreator); } -int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, FX_LPCBYTE pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator) +int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, const uint8_t* pBuffer, FX_DWORD dwSize, CPDF_Creator *pCreator) { if (!pCreator) { return 0; @@ -958,7 +958,7 @@ int32_t CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) } return 0; } -int32_t CPDF_Creator::WriteIndirectObjectToStream(FX_DWORD objnum, FX_LPCBYTE pBuffer, FX_DWORD dwSize) +int32_t CPDF_Creator::WriteIndirectObjectToStream(FX_DWORD objnum, const uint8_t* pBuffer, FX_DWORD dwSize) { if (!m_pXRefStream) { return 1; @@ -1104,8 +1104,8 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, F break; } CPDF_Encryptor encryptor; - encryptor.Initialize(m_pCryptoHandler, objnum, (FX_LPBYTE)str.c_str(), str.GetLength()); - CFX_ByteString content = PDF_EncodeString(CFX_ByteString((FX_LPCSTR)encryptor.m_pData, encryptor.m_dwSize), bHex); + encryptor.Initialize(m_pCryptoHandler, objnum, (uint8_t*)str.c_str(), str.GetLength()); + CFX_ByteString content = PDF_EncodeString(CFX_ByteString((const FX_CHAR*)encryptor.m_pData, encryptor.m_dwSize), bHex); if ((len = m_File.AppendString(content)) < 0) { return -1; } @@ -1252,8 +1252,8 @@ int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) return 0; } m_ObjectOffset[objnum] = m_Offset; - FX_LPVOID valuetemp = NULL; - FX_BOOL bExistInMap = m_pDocument->m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, valuetemp); + void* valuetemp = NULL; + FX_BOOL bExistInMap = m_pDocument->m_IndirectObjs.Lookup((void*)(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); @@ -1326,7 +1326,7 @@ int32_t CPDF_Creator::WriteOldObjs(IFX_Pause *pPause) } m_ObjectSize[objnum] = (FX_DWORD)(m_Offset - m_ObjectOffset[objnum]); if (pPause && pPause->NeedToPauseNow()) { - m_Pos = (FX_LPVOID)(uintptr_t)(objnum + 1); + m_Pos = (void*)(uintptr_t)(objnum + 1); return 1; } } @@ -1339,7 +1339,7 @@ int32_t CPDF_Creator::WriteNewObjs(FX_BOOL bIncremental, IFX_Pause *pPause) while (index < iCount) { FX_DWORD objnum = m_NewObjNumArray.ElementAt(index); CPDF_Object *pObj = NULL; - m_pDocument->m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, (FX_LPVOID&)pObj); + m_pDocument->m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, (void*&)pObj); if (NULL == pObj) { ++index; continue; @@ -1390,7 +1390,7 @@ void CPDF_Creator::InitNewObjNumOffsets() while (pos) { size_t key = 0; CPDF_Object* pObj; - m_pDocument->m_IndirectObjs.GetNextAssoc(pos, (FX_LPVOID&)key, (FX_LPVOID&)pObj); + m_pDocument->m_IndirectObjs.GetNextAssoc(pos, (void*&)key, (void*&)pObj); FX_DWORD objnum = (FX_DWORD)key; if (pObj->GetObjNum() == -1) { continue; @@ -1517,7 +1517,7 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause) } else { IFX_FileRead* pSrcFile = m_pParser->GetFileAccess(); m_Offset = pSrcFile->GetSize(); - m_Pos = (FX_LPVOID)(uintptr_t)m_Offset; + m_Pos = (void*)(uintptr_t)m_Offset; m_iStage = 15; } } @@ -1536,7 +1536,7 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause) } src_size -= block_size; if (pPause && pPause->NeedToPauseNow()) { - m_Pos = (FX_LPVOID)(uintptr_t)src_size; + m_Pos = (void*)(uintptr_t)src_size; return 1; } } @@ -1569,7 +1569,7 @@ 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)(uintptr_t)0; + m_Pos = (void*)(uintptr_t)0; m_iStage = 21; } else { m_iStage = 25; @@ -1583,7 +1583,7 @@ int32_t CPDF_Creator::WriteDoc_Stage2(IFX_Pause *pPause) m_iStage = 25; } if (m_iStage == 25) { - m_Pos = (FX_LPVOID)(uintptr_t)0; + m_Pos = (void*)(uintptr_t)0; m_iStage = 26; } if (m_iStage == 26) { @@ -1630,13 +1630,13 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) if (m_File.AppendString(str) < 0) { return -1; } - m_Pos = (FX_LPVOID)(uintptr_t)1; + m_Pos = (void*)(uintptr_t)1; m_iStage = 81; } else { if (m_File.AppendString(FX_BSTRC("xref\r\n")) < 0) { return -1; } - m_Pos = (FX_LPVOID)(uintptr_t)0; + m_Pos = (void*)(uintptr_t)0; m_iStage = 82; } } else { @@ -1675,7 +1675,7 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) break; } if (pPause && pPause->NeedToPauseNow()) { - m_Pos = (FX_LPVOID)(uintptr_t)i; + m_Pos = (void*)(uintptr_t)i; return 1; } } @@ -1715,7 +1715,7 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) } } if (pPause && (i % 100) == 0 && pPause->NeedToPauseNow()) { - m_Pos = (FX_LPVOID)(uintptr_t)i; + m_Pos = (void*)(uintptr_t)i; return 1; } } @@ -1976,7 +1976,7 @@ void CPDF_Creator::Clear() m_pIDArray = NULL; } } -FX_BOOL CPDF_Creator::Create(FX_LPCSTR filename, FX_DWORD flags) +FX_BOOL CPDF_Creator::Create(const FX_CHAR* filename, FX_DWORD flags) { if (!m_File.AttachFile(filename)) { return FALSE; @@ -1987,7 +1987,7 @@ FX_BOOL CPDF_Creator::Create(FX_LPCSTR filename, FX_DWORD flags) } return bRet; } -FX_BOOL CPDF_Creator::Create(FX_LPCWSTR filename, FX_DWORD flags) +FX_BOOL CPDF_Creator::Create(const FX_WCHAR* filename, FX_DWORD flags) { if (!m_File.AttachFile(filename)) { return FALSE; @@ -2028,7 +2028,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault ) CPDF_Array* pOldIDArray = m_pParser ? m_pParser->GetIDArray() : NULL; FX_BOOL bNewId = !m_pIDArray; if (!m_pIDArray) { - FX_LPDWORD pBuffer = NULL; + FX_DWORD* pBuffer = NULL; m_pIDArray = CPDF_Array::Create(); CPDF_Object* pID1 = pOldIDArray ? pOldIDArray->GetElement(0) : NULL; if (pID1) { @@ -2036,7 +2036,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault ) } else { pBuffer = FX_Alloc(FX_DWORD, 4); PDF_GenerateFileID((FX_DWORD)(uintptr_t)this, m_dwLastObjNum, pBuffer); - CFX_ByteStringC bsBuffer((FX_LPCBYTE)pBuffer, 4 * sizeof(FX_DWORD)); + CFX_ByteStringC bsBuffer((const uint8_t*)pBuffer, 4 * sizeof(FX_DWORD)); m_pIDArray->Add(CPDF_String::Create(bsBuffer, TRUE), m_pDocument); } if (pBuffer) { @@ -2052,9 +2052,9 @@ void CPDF_Creator::InitID(FX_BOOL bDefault ) m_pIDArray->Add(pID2->Clone()); return; } - FX_LPDWORD pBuffer = FX_Alloc(FX_DWORD, 4); + FX_DWORD* pBuffer = FX_Alloc(FX_DWORD, 4); PDF_GenerateFileID((FX_DWORD)(uintptr_t)this, m_dwLastObjNum, pBuffer); - CFX_ByteStringC bsBuffer((FX_LPCBYTE)pBuffer, 4 * sizeof(FX_DWORD)); + CFX_ByteStringC bsBuffer((const uint8_t*)pBuffer, 4 * sizeof(FX_DWORD)); m_pIDArray->Add(CPDF_String::Create(bsBuffer, TRUE), m_pDocument); FX_Free(pBuffer); return; @@ -2065,7 +2065,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault ) CPDF_StandardSecurityHandler handler; CFX_ByteString user_pass = m_pParser->GetPassword(); FX_DWORD flag = PDF_ENCRYPT_CONTENT; - handler.OnCreate(m_pEncryptDict, m_pIDArray, (FX_LPCBYTE)user_pass, user_pass.GetLength(), flag); + handler.OnCreate(m_pEncryptDict, m_pIDArray, (const uint8_t*)user_pass, user_pass.GetLength(), flag); if (m_pCryptoHandler && m_bNewCrypto) { delete m_pCryptoHandler; } diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index d2d81d5566..7176a62435 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -226,7 +226,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTW* pLogFont, FX_BOOL bVert, FX_B FXSYS_strcpy(lfa.lfFaceName, face.c_str()); return AddWindowsFont(&lfa, bVert, bTranslateName); } -extern CFX_ByteString _FPDF_GetNameFromTT(FX_LPCBYTE name_table, FX_DWORD name); +extern CFX_ByteString _FPDF_GetNameFromTT(const uint8_t* name_table, FX_DWORD name); CFX_ByteString _FPDF_GetPSNameFromTT(HDC hDC) { CFX_ByteString result; @@ -429,11 +429,11 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, FX_BOOL bVert, FX_B } #endif #if (_FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_) -uint32_t FX_GetLangHashCode( FX_LPCSTR pStr) +uint32_t FX_GetLangHashCode( const FX_CHAR* pStr) { FXSYS_assert( pStr != NULL); int32_t iLength = FXSYS_strlen(pStr); - FX_LPCSTR pStrEnd = pStr + iLength; + const FX_CHAR* pStrEnd = pStr + iLength; uint32_t uHashCode = 0; while ( pStr < pStrEnd) { uHashCode = 31 * uHashCode + tolower(*pStr++); @@ -529,7 +529,7 @@ static FX_WORD FX_GetCsFromLangCode(uint32_t uCode) }; return 0; } -static FX_WORD FX_GetCharsetFromLang(FX_LPCSTR pLang, int32_t iLength) +static FX_WORD FX_GetCharsetFromLang(const FX_CHAR* pLang, int32_t iLength) { FXSYS_assert(pLang); if (iLength < 0) { @@ -545,7 +545,7 @@ static void _CFString2CFXByteString(CFStringRef src, CFX_ByteString &dest) CFIndex used = 0; UInt8* pBuffer = (UInt8*)calloc(len+1, sizeof(UInt8)); CFStringGetBytes(src, range, kCFStringEncodingASCII, 0, false, pBuffer, len, &used); - dest = (FX_LPSTR)pBuffer; + dest = (FX_CHAR*)pBuffer; free(pBuffer); } FX_BOOL IsHasCharSet(CFArrayRef languages, const CFX_DWordArray &charSets) @@ -1141,7 +1141,7 @@ CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) return pDict; } int _PDF_GetStandardFontName(CFX_ByteString& name); -CPDF_Font* CPDF_Document::AddStandardFont(FX_LPCSTR font, CPDF_FontEncoding* pEncoding) +CPDF_Font* CPDF_Document::AddStandardFont(const FX_CHAR* font, CPDF_FontEncoding* pEncoding) { CFX_ByteString name(font, -1); if (_PDF_GetStandardFontName(name) < 0) { diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp index 8d105a5bd8..fd715240a4 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp @@ -10,7 +10,7 @@ #include "../../../include/fpdfapi/fpdf_render.h" #include "../fpdf_page/pageint.h" #include "../fpdf_render/render_int.h" -CPDF_Dictionary* CPDF_Image::InitJPEG(FX_LPBYTE pData, FX_DWORD size) +CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, FX_DWORD size) { int32_t width, height, color_trans, num_comps, bits; if (!CPDF_ModuleMgr::Get()->GetJpegModule()-> @@ -22,7 +22,7 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(FX_LPBYTE pData, FX_DWORD size) pDict->SetAtName("Subtype", "Image"); pDict->SetAtInteger("Width", width); pDict->SetAtInteger("Height", height); - FX_LPCSTR csname = NULL; + const FX_CHAR* csname = NULL; if (num_comps == 1) { csname = "DeviceGray"; } else if (num_comps == 3) { @@ -52,7 +52,7 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(FX_LPBYTE pData, FX_DWORD size) } return pDict; } -void CPDF_Image::SetJpegImage(FX_LPBYTE pData, FX_DWORD size) +void CPDF_Image::SetJpegImage(uint8_t* pData, FX_DWORD size) { CPDF_Dictionary *pDict = InitJPEG(pData, size); if (!pDict) { @@ -70,7 +70,7 @@ void CPDF_Image::SetJpegImage(IFX_FileRead *pFile) if (dwEstimateSize > 8192) { dwEstimateSize = 8192; } - FX_LPBYTE pData = FX_Alloc(uint8_t, dwEstimateSize); + uint8_t* pData = FX_Alloc(uint8_t, dwEstimateSize); pFile->ReadBlock(pData, 0, dwEstimateSize); CPDF_Dictionary *pDict = InitJPEG(pData, dwEstimateSize); FX_Free(pData); @@ -85,10 +85,10 @@ void CPDF_Image::SetJpegImage(IFX_FileRead *pFile) } m_pStream->InitStream(pFile, pDict); } -void _DCTEncodeBitmap(CPDF_Dictionary *pBitmapDict, const CFX_DIBitmap* pBitmap, int quality, FX_LPBYTE &buf, FX_STRSIZE &size) +void _DCTEncodeBitmap(CPDF_Dictionary *pBitmapDict, const CFX_DIBitmap* pBitmap, int quality, uint8_t* &buf, FX_STRSIZE &size) { } -void _JBIG2EncodeBitmap(CPDF_Dictionary *pBitmapDict, const CFX_DIBitmap *pBitmap, CPDF_Document *pDoc, FX_LPBYTE &buf, FX_STRSIZE &size, FX_BOOL bLossLess) +void _JBIG2EncodeBitmap(CPDF_Dictionary *pBitmapDict, const CFX_DIBitmap *pBitmap, CPDF_Document *pDoc, uint8_t* &buf, FX_STRSIZE &size, FX_BOOL bLossLess) { } 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) @@ -98,7 +98,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi if (BitmapWidth < 1 || BitmapHeight < 1) { return; } - FX_LPBYTE src_buf = pBitmap->GetBuffer(); + uint8_t* src_buf = pBitmap->GetBuffer(); int32_t src_pitch = pBitmap->GetPitch(); int32_t bpp = pBitmap->GetBPP(); FX_BOOL bUseMatte = pParam && pParam->pMatteColor && (pBitmap->GetFormat() == FXDIB_Argb); @@ -107,7 +107,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi pDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Image")); pDict->SetAtInteger(FX_BSTRC("Width"), BitmapWidth); pDict->SetAtInteger(FX_BSTRC("Height"), BitmapHeight); - FX_LPBYTE dest_buf = NULL; + uint8_t* dest_buf = NULL; FX_STRSIZE dest_pitch = 0, dest_size = 0, opType = -1; if (bpp == 1) { int32_t reset_a = 0, reset_r = 0, reset_g = 0, reset_b = 0; @@ -130,7 +130,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi pCS->AddName(FX_BSTRC("DeviceRGB")); pCS->AddInteger(1); CFX_ByteString ct; - FX_LPSTR pBuf = ct.GetBuffer(6); + FX_CHAR* pBuf = ct.GetBuffer(6); pBuf[0] = (FX_CHAR)reset_r; pBuf[1] = (FX_CHAR)reset_g; pBuf[2] = (FX_CHAR)reset_b; @@ -156,8 +156,8 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi pCS->AddName(FX_BSTRC("Indexed")); pCS->AddName(FX_BSTRC("DeviceRGB")); pCS->AddInteger(iPalette - 1); - FX_LPBYTE pColorTable = FX_Alloc2D(uint8_t, iPalette, 3); - FX_LPBYTE ptr = pColorTable; + uint8_t* pColorTable = FX_Alloc2D(uint8_t, iPalette, 3); + uint8_t* ptr = pColorTable; for (int32_t i = 0; i < iPalette; i ++) { FX_DWORD argb = pBitmap->GetPaletteArgb(i); ptr[0] = (uint8_t)(argb >> 16); @@ -204,7 +204,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi if (pMaskBitmap) { int32_t maskWidth = pMaskBitmap->GetWidth(); int32_t maskHeight = pMaskBitmap->GetHeight(); - FX_LPBYTE mask_buf = NULL; + uint8_t* mask_buf = NULL; FX_STRSIZE mask_size; CPDF_Dictionary* pMaskDict = new CPDF_Dictionary; pMaskDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("XObject")); @@ -270,7 +270,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi if (bUseMatte) { CFX_DIBitmap *pNewBitmap = new CFX_DIBitmap(); pNewBitmap->Create(BitmapWidth, BitmapHeight, FXDIB_Argb); - FX_LPBYTE dst_buf = pNewBitmap->GetBuffer(); + uint8_t* dst_buf = pNewBitmap->GetBuffer(); int32_t src_offset = 0; for (int32_t row = 0; row < BitmapHeight; row ++) { src_offset = row * src_pitch; @@ -300,7 +300,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi dest_buf = FX_Alloc2D(uint8_t, dest_pitch, BitmapHeight); dest_size = dest_pitch * BitmapHeight; // Safe since checked alloc returned. } - FX_LPBYTE pDest = dest_buf; + uint8_t* pDest = dest_buf; for (int32_t i = 0; i < BitmapHeight; i ++) { if (!bStream) { FXSYS_memcpy32(pDest, src_buf, dest_pitch); @@ -317,7 +317,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress, IFX_Fi } else { dest_buf = FX_Alloc(uint8_t, dest_pitch); } - FX_LPBYTE pDest = dest_buf; + uint8_t* pDest = dest_buf; int32_t src_offset = 0; int32_t dest_offset = 0; for (int32_t row = 0; row < BitmapHeight; row ++) { diff --git a/core/src/fpdfapi/fpdf_font/font_int.h b/core/src/fpdfapi/fpdf_font/font_int.h index 1e52607d98..6f32f4fa98 100644 --- a/core/src/fpdfapi/fpdf_font/font_int.h +++ b/core/src/fpdfapi/fpdf_font/font_int.h @@ -12,7 +12,7 @@ class CPDF_CMapManager public: CPDF_CMapManager(); ~CPDF_CMapManager(); - FX_LPVOID GetPackage(FX_BOOL bPrompt); + void* GetPackage(FX_BOOL bPrompt); CPDF_CMap* GetPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPrompt); CPDF_CID2UnicodeMap* GetCID2UnicodeMap(int charset, FX_BOOL bPrompt); void ReloadAll(); @@ -44,7 +44,7 @@ public: } m_EmbeddedToUnicodes[NUMBER_OF_CIDSETS]; private: CFX_MapPtrToPtr m_pStockMap; - FX_LPBYTE m_pContrastRamps; + uint8_t* m_pContrastRamps; }; struct _CMap_CodeRange { int m_CharSize; @@ -81,7 +81,7 @@ class CPDF_CMap public: CPDF_CMap(); FX_BOOL LoadPredefined(CPDF_CMapManager* pMgr, const FX_CHAR* name, FX_BOOL bPromptCJK); - FX_BOOL LoadEmbedded(FX_LPCBYTE pData, FX_DWORD dwSize); + FX_BOOL LoadEmbedded(const uint8_t* pData, FX_DWORD dwSize); void Release(); FX_BOOL IsLoaded() const { @@ -98,9 +98,9 @@ public: FX_WORD CIDFromCharCode(FX_DWORD charcode) const; FX_DWORD CharCodeFromCID(FX_WORD CID) const; int GetCharSize(FX_DWORD charcode) const; - FX_DWORD GetNextChar(FX_LPCSTR pString, int nStrLen, int& offset) const; - int CountChar(FX_LPCSTR pString, int size) const; - int AppendChar(FX_LPSTR str, FX_DWORD charcode) const; + FX_DWORD GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const; + int CountChar(const FX_CHAR* pString, int size) const; + int AppendChar(FX_CHAR* str, FX_DWORD charcode) const; typedef enum {OneByte, TwoBytes, MixedTwoBytes, MixedFourBytes} CodingScheme; protected: ~CPDF_CMap(); @@ -115,7 +115,7 @@ protected: int m_nCodeRanges; uint8_t* m_pLeadingBytes; FX_WORD* m_pMapping; - FX_LPBYTE m_pAddMapping; + uint8_t* m_pAddMapping; FX_BOOL m_bLoaded; const FXCMAP_CMap* m_pEmbedMap; CPDF_CMap* m_pUseMap; @@ -123,7 +123,7 @@ protected: class CPDF_PredefinedCMap { public: - FX_LPCSTR m_pName; + const FX_CHAR* m_pName; int m_Charset; int m_Coding; CPDF_CMap::CodingScheme m_CodingScheme; diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp index 0058e140d4..c6922d11f8 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp @@ -205,7 +205,7 @@ CFX_WideString CPDF_Font::DecodeString(const CFX_ByteString& str) const CFX_WideString result; int src_len = str.GetLength(); result.Reserve(src_len); - FX_LPCSTR src_buf = str; + const FX_CHAR* src_buf = str; int src_pos = 0; while (src_pos < src_len) { FX_DWORD charcode = GetNextChar(src_buf, src_len, src_pos); @@ -222,8 +222,8 @@ CFX_ByteString CPDF_Font::EncodeString(const CFX_WideString& str) const { CFX_ByteString result; int src_len = str.GetLength(); - FX_LPSTR dest_buf = result.GetBuffer(src_len * 2); - FX_LPCWSTR src_buf = str.c_str(); + FX_CHAR* dest_buf = result.GetBuffer(src_len * 2); + const FX_WCHAR* src_buf = str.c_str(); int dest_pos = 0; for (int src_pos = 0; src_pos < src_len; src_pos ++) { FX_DWORD charcode = CharCodeFromUnicode(src_buf[src_pos]); @@ -289,7 +289,7 @@ void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) if (m_pFontFile == NULL) { return; } - FX_LPCBYTE pFontData = m_pFontFile->GetData(); + const uint8_t* pFontData = m_pFontFile->GetData(); FX_DWORD dwFontSize = m_pFontFile->GetSize(); m_Font.LoadEmbedded(pFontData, dwFontSize); if (m_Font.m_Face == NULL) { @@ -369,7 +369,7 @@ void CPDF_Font::LoadUnicodeMap() m_pToUnicodeMap = new CPDF_ToUnicodeMap; m_pToUnicodeMap->Load(pStream); } -int CPDF_Font::GetStringWidth(FX_LPCSTR pString, int size) +int CPDF_Font::GetStringWidth(const FX_CHAR* pString, int size) { int offset = 0; int width = 0; @@ -431,7 +431,7 @@ CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc, CPDF_Dictionary* pFontDic int i; int count = sizeof(ChineseFontNames) / sizeof(ChineseFontNames[0]); for (i = 0; i < count; ++i) { - if (tag == CFX_ByteString((FX_LPCSTR)ChineseFontNames[i])) { + if (tag == CFX_ByteString((const FX_CHAR*)ChineseFontNames[i])) { break; } } @@ -500,7 +500,7 @@ CFX_WideString CPDF_ToUnicodeMap::Lookup(FX_DWORD charcode) if (unicode != 0xffff) { return unicode; } - FX_LPCWSTR buf = m_MultiCharBuf.GetBuffer(); + const FX_WCHAR* buf = m_MultiCharBuf.GetBuffer(); FX_DWORD buf_len = m_MultiCharBuf.GetLength(); if (buf == NULL || buf_len == 0) { return CFX_WideString(); @@ -534,7 +534,7 @@ FX_DWORD CPDF_ToUnicodeMap::ReverseLookup(FX_WCHAR unicode) } static FX_DWORD _StringToCode(FX_BSTR str) { - FX_LPCSTR buf = str.GetCStr(); + const FX_CHAR* buf = str.GetCStr(); int len = str.GetLength(); if (len == 0) { return 0; @@ -586,7 +586,7 @@ static CFX_WideString _StringDataAdd(CFX_WideString str) } static CFX_WideString _StringToWideString(FX_BSTR str) { - FX_LPCSTR buf = str.GetCStr(); + const FX_CHAR* buf = str.GetCStr(); int len = str.GetLength(); if (len == 0) { return CFX_WideString(); @@ -816,7 +816,7 @@ FX_BOOL CPDF_Font::IsStandardFont() const } return TRUE; } -extern FX_LPCSTR PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode); +extern const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode); CPDF_SimpleFont::CPDF_SimpleFont(int fonttype) : CPDF_Font(fonttype) { FXSYS_memset8(m_CharBBox, 0xff, sizeof m_CharBBox); @@ -907,13 +907,13 @@ void CPDF_SimpleFont::GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level) rect.bottom = m_CharBBox[charcode].Bottom; rect.top = m_CharBBox[charcode].Top; } -FX_LPCSTR GetAdobeCharName(int iBaseEncoding, const CFX_ByteString* pCharNames, int charcode) +const FX_CHAR* GetAdobeCharName(int iBaseEncoding, const CFX_ByteString* pCharNames, int charcode) { ASSERT(charcode >= 0 && charcode < 256); if (charcode < 0 || charcode >= 256) { return NULL; } - FX_LPCSTR name = NULL; + const FX_CHAR* name = NULL; if (pCharNames) { name = pCharNames[charcode]; } @@ -1081,8 +1081,8 @@ int CPDF_Type1Font::GlyphFromCharCodeExt(FX_DWORD charcode) } #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ struct _GlyphNameMap { - FX_LPCSTR m_pStrAdobe; - FX_LPCSTR m_pStrUnicode; + const FX_CHAR* m_pStrAdobe; + const FX_CHAR* m_pStrUnicode; }; static const _GlyphNameMap g_GlyphNameSubsts[] = { {"ff", "uniFB00"}, @@ -1094,10 +1094,10 @@ static const _GlyphNameMap g_GlyphNameSubsts[] = { extern "C" { static int compareString(const void* key, const void* element) { - return FXSYS_stricmp((FX_LPCSTR)key, ((_GlyphNameMap*)element)->m_pStrAdobe); + return FXSYS_stricmp((const FX_CHAR*)key, ((_GlyphNameMap*)element)->m_pStrAdobe); } } -static FX_LPCSTR _GlyphNameRemap(FX_LPCSTR pStrAdobe) +static const FX_CHAR* _GlyphNameRemap(const FX_CHAR* pStrAdobe) { _GlyphNameMap* found = (_GlyphNameMap*)FXSYS_bsearch(pStrAdobe, g_GlyphNameSubsts, sizeof g_GlyphNameSubsts / sizeof(_GlyphNameMap), sizeof(_GlyphNameMap), @@ -1164,7 +1164,7 @@ void CPDF_Type1Font::LoadGlyphMap() m_BaseEncoding = PDFFONT_ENCODING_STANDARD; } for (int charcode = 0; charcode < 256; charcode ++) { - FX_LPCSTR name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); + const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); if (name == NULL) { continue; } @@ -1207,7 +1207,7 @@ void CPDF_Type1Font::LoadGlyphMap() if (bCoreText) { if (m_Flags & PDFFONT_SYMBOLIC) { for (int charcode = 0; charcode < 256; charcode ++) { - FX_LPCSTR name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); + const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); if (name) { m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); m_GlyphIndex[charcode] = FXFT_Get_Name_Index(m_Font.m_Face, (char*)name); @@ -1244,12 +1244,12 @@ void CPDF_Type1Font::LoadGlyphMap() bUnicode = TRUE; } for (int charcode = 0; charcode < 256; charcode ++) { - FX_LPCSTR name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); + const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); if (name == NULL) { continue; } m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); - FX_LPCSTR pStrUnicode = _GlyphNameRemap(name); + const FX_CHAR* pStrUnicode = _GlyphNameRemap(name); if (pStrUnicode && 0 == FXFT_Get_Name_Index(m_Font.m_Face, (char*)name)) { name = pStrUnicode; } @@ -1289,7 +1289,7 @@ void CPDF_Type1Font::LoadGlyphMap() #endif if (m_Flags & PDFFONT_SYMBOLIC) { for (int charcode = 0; charcode < 256; charcode ++) { - FX_LPCSTR name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); + const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); if (name) { m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); m_GlyphIndex[charcode] = FXFT_Get_Name_Index(m_Font.m_Face, (char*)name); @@ -1322,7 +1322,7 @@ void CPDF_Type1Font::LoadGlyphMap() bUnicode = TRUE; } for (int charcode = 0; charcode < 256; charcode ++) { - FX_LPCSTR name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); + const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); if (name == NULL) { continue; } @@ -1475,7 +1475,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() } FX_BOOL bToUnicode = m_pFontDict->KeyExist(FX_BSTRC("ToUnicode")); for (int charcode = 0; charcode < 256; charcode ++) { - FX_LPCSTR name = GetAdobeCharName(baseEncoding, m_pCharNames, charcode); + const FX_CHAR* name = GetAdobeCharName(baseEncoding, m_pCharNames, charcode); if (name == NULL) { m_GlyphIndex[charcode] = m_pFontFile ? FXFT_Get_Char_Index(m_Font.m_Face, charcode) : -1; continue; @@ -1540,7 +1540,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() if (bGotOne) { if (baseEncoding != PDFFONT_ENCODING_BUILTIN) { for (int charcode = 0; charcode < 256; charcode ++) { - FX_LPCSTR name = GetAdobeCharName(baseEncoding, m_pCharNames, charcode); + const FX_CHAR* name = GetAdobeCharName(baseEncoding, m_pCharNames, charcode); if (name == NULL) { continue; } @@ -1572,7 +1572,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() const FX_WORD* pUnicodes = PDF_UnicodesForPredefinedCharSet(baseEncoding); for (int charcode = 0; charcode < 256; charcode ++) { if (m_pFontFile == NULL) { - FX_LPCSTR name = GetAdobeCharName(0, m_pCharNames, charcode); + const FX_CHAR* name = GetAdobeCharName(0, m_pCharNames, charcode); if (name != NULL) { m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); } else if (pUnicodes) { @@ -1603,14 +1603,16 @@ CPDF_Type3Font::~CPDF_Type3Font() { FX_POSITION pos = m_CacheMap.GetStartPosition(); while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_CacheMap.GetNextAssoc(pos, key, value); delete (CPDF_Type3Char*)value; } m_CacheMap.RemoveAll(); pos = m_DeletedMap.GetStartPosition(); while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_DeletedMap.GetNextAssoc(pos, key, value); delete (CPDF_Type3Char*)key; } @@ -1671,15 +1673,15 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) return NULL; } CPDF_Type3Char* pChar = NULL; - if (m_CacheMap.Lookup((FX_LPVOID)(uintptr_t)charcode, (FX_LPVOID&)pChar)) { + if (m_CacheMap.Lookup((void*)(uintptr_t)charcode, (void*&)pChar)) { if (pChar->m_bPageRequired && m_pPageResources) { delete pChar; - m_CacheMap.RemoveKey((FX_LPVOID)(uintptr_t)charcode); + m_CacheMap.RemoveKey((void*)(uintptr_t)charcode); return LoadChar(charcode, level + 1); } return pChar; } - FX_LPCSTR name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); + const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); if (name == NULL) { return NULL; } @@ -1703,7 +1705,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)(uintptr_t)charcode, pChar); + m_CacheMap.SetAt((void*)(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 8e8fccd8a3..8d2f922fb1 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp @@ -264,7 +264,7 @@ const FX_WORD ZapfEncoding[256] = { 0x0000, 0x27B1, 0x27B2, 0x27B3, 0x27B4, 0x27B5, 0x27B6, 0x27B7, 0x27B8, 0x27B9, 0x27BA, 0x27BB, 0x27BC, 0x27BD, 0x27BE, 0x0000, }; -const FX_LPCSTR StandardEncodingNames[224] = { +const FX_CHAR* const StandardEncodingNames[224] = { "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", @@ -294,7 +294,7 @@ const FX_LPCSTR StandardEncodingNames[224] = { NULL, "ae", NULL, NULL, NULL, "dotlessi", NULL, NULL, "lslash", "oslash", "oe", "germandbls", NULL, NULL, NULL, NULL, }; -const FX_LPCSTR AdobeWinAnsiEncodingNames[224] = { +const FX_CHAR* const AdobeWinAnsiEncodingNames[224] = { "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", @@ -324,7 +324,7 @@ const FX_LPCSTR AdobeWinAnsiEncodingNames[224] = { "eth", "ntilde", "ograve", "oacute", "ocircumflex", "otilde", "odieresis", "divide", "oslash", "ugrave", "uacute", "ucircumflex", "udieresis", "yacute", "thorn", "ydieresis", }; -const FX_LPCSTR MacRomanEncodingNames[224] = { +const FX_CHAR* const MacRomanEncodingNames[224] = { "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", @@ -354,7 +354,7 @@ const FX_LPCSTR MacRomanEncodingNames[224] = { "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", }; -const FX_LPCSTR MacExpertEncodingNames[224] = { +const FX_CHAR* const MacExpertEncodingNames[224] = { "space", "exclamsmall", "Hungarumlautsmall", "centoldstyle", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", @@ -384,7 +384,7 @@ const FX_LPCSTR MacExpertEncodingNames[224] = { NULL, "lsuperior", "Ogoneksmall", "Brevesmall", "Macronsmall", "bsuperior", "nsuperior", "msuperior", "commasuperior", "periodsuperior", "Dotaccentsmall", "Ringsmall", NULL, NULL, NULL, NULL, }; -const FX_LPCSTR PDFDocEncodingNames[232] = { +const FX_CHAR* const PDFDocEncodingNames[232] = { "breve", "caron", "circumflex", "dotaccent", "hungarumlaut", "ogonek", "ring", "tilde", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", @@ -415,7 +415,7 @@ const FX_LPCSTR PDFDocEncodingNames[232] = { "eth", "ntilde", "ograve", "oacute", "ocircumflex", "otilde", "odieresis", "divide", "oslash", "ugrave", "uacute", "ucircumflex", "udieresis", "yacute", "thorn", "ydieresis", }; -const FX_LPCSTR AdobeSymbolEncodingNames[224] = { +const FX_CHAR* const AdobeSymbolEncodingNames[224] = { "space", "exclam", "universal", "numbersign", "existential", "percent", "ampersand", "suchthat", "parenleft", "parenright", "asteriskmath", "plus", "comma", "minus", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", @@ -445,7 +445,7 @@ const FX_LPCSTR AdobeSymbolEncodingNames[224] = { NULL, "angleright", "integral", "integraltp", "integralex", "integralbt", "parenrighttp", "parenrightex", "parenrightbt", "bracketrighttp", "bracketrightex", "bracketrightbt", "bracerighttp", "bracerightmid", "bracerightbt", NULL, }; -const FX_LPCSTR ZapfEncodingNames[224] = { +const FX_CHAR* const ZapfEncodingNames[224] = { "space", "a1", "a2", "a202", "a3", "a4", "a5", "a119", "a118", "a117", "a11", "a12", "a13", "a14", "a15", "a16", "a105", "a17", "a18", "a19", "a20", "a21", "a22", "a23", diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp index a6209cb536..bec2c90144 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -13,7 +13,7 @@ extern FX_DWORD FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode); extern short TT2PDF(int m, FXFT_Face face); extern FX_BOOL FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id); -extern FX_LPCSTR GetAdobeCharName(int iBaseEncoding, const CFX_ByteString* pCharNames, int charcode); +extern const FX_CHAR* GetAdobeCharName(int iBaseEncoding, const CFX_ByteString* pCharNames, int charcode); CPDF_CMapManager::CPDF_CMapManager() { m_bPrompted = FALSE; @@ -26,7 +26,7 @@ CPDF_CMapManager::~CPDF_CMapManager() CPDF_CMap* CPDF_CMapManager::GetPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPromptCJK) { CPDF_CMap* pCMap; - if (m_CMaps.Lookup(name, (FX_LPVOID&)pCMap)) { + if (m_CMaps.Lookup(name, (void*&)pCMap)) { return pCMap; } pCMap = LoadPredefinedCMap(name, bPromptCJK); @@ -39,14 +39,14 @@ CPDF_CMap* CPDF_CMapManager::GetPredefinedCMap(const CFX_ByteString& name, FX_BO CPDF_CMap* CPDF_CMapManager::LoadPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPromptCJK) { CPDF_CMap* pCMap = new CPDF_CMap; - FX_LPCSTR pname = name; + const FX_CHAR* pname = name; if (*pname == '/') { pname ++; } pCMap->LoadPredefined(this, pname, bPromptCJK); return pCMap; } -static const FX_LPCSTR g_CharsetNames[NUMBER_OF_CIDSETS] = {NULL, "GB1", "CNS1", "Japan1", "Korea1", "UCS" }; +static const FX_CHAR* const g_CharsetNames[NUMBER_OF_CIDSETS] = {NULL, "GB1", "CNS1", "Japan1", "Korea1", "UCS" }; static const int g_CharsetCPs[NUMBER_OF_CIDSETS] = {0, 936, 950, 932, 949, 1200 }; int _CharsetFromOrdering(const CFX_ByteString& Ordering) { @@ -66,7 +66,7 @@ void CPDF_CMapManager::DropAll(FX_BOOL bReload) while (pos) { CFX_ByteString name; CPDF_CMap* pCMap; - m_CMaps.GetNextAssoc(pos, name, (FX_LPVOID&)pCMap); + m_CMaps.GetNextAssoc(pos, name, (void*&)pCMap); if (pCMap == NULL) { continue; } @@ -347,7 +347,7 @@ const CPDF_PredefinedCMap g_PredefinedCMaps[] = { }; extern void FPDFAPI_FindEmbeddedCMap(const char* name, int charset, int coding, const FXCMAP_CMap*& pMap); extern FX_WORD FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, FX_DWORD charcode); -FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, FX_LPCSTR pName, FX_BOOL bPromptCJK) +FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, const FX_CHAR* pName, FX_BOOL bPromptCJK) { m_PredefinedCMap = pName; if (m_PredefinedCMap == FX_BSTRC("Identity-H") || m_PredefinedCMap == FX_BSTRC("Identity-V")) { @@ -396,7 +396,7 @@ extern "C" { return (*(FX_DWORD*)data1) - (*(FX_DWORD*)data2); } }; -FX_BOOL CPDF_CMap::LoadEmbedded(FX_LPCBYTE pData, FX_DWORD size) +FX_BOOL CPDF_CMap::LoadEmbedded(const uint8_t* pData, FX_DWORD size) { m_pMapping = FX_Alloc(FX_WORD, 65536); CPDF_CMapParser parser; @@ -462,7 +462,7 @@ FX_WORD CPDF_CMap::CIDFromCharCode(FX_DWORD charcode) const } return (FX_WORD)CID; } -static int _CheckCodeRange(FX_LPBYTE codes, int size, _CMap_CodeRange* pRanges, int nRanges) +static int _CheckCodeRange(uint8_t* codes, int size, _CMap_CodeRange* pRanges, int nRanges) { int iSeg = nRanges - 1; while (iSeg >= 0) { @@ -491,26 +491,26 @@ static int _CheckCodeRange(FX_LPBYTE codes, int size, _CMap_CodeRange* pRanges, } return 0; } -FX_DWORD CPDF_CMap::GetNextChar(FX_LPCSTR pString, int nStrLen, int& offset) const +FX_DWORD CPDF_CMap::GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const { switch (m_CodingScheme) { case OneByte: - return ((FX_LPBYTE)pString)[offset++]; + return ((uint8_t*)pString)[offset++]; case TwoBytes: offset += 2; - return ((FX_LPBYTE)pString)[offset - 2] * 256 + ((FX_LPBYTE)pString)[offset - 1]; + return ((uint8_t*)pString)[offset - 2] * 256 + ((uint8_t*)pString)[offset - 1]; case MixedTwoBytes: { - uint8_t byte1 = ((FX_LPBYTE)pString)[offset++]; + uint8_t byte1 = ((uint8_t*)pString)[offset++]; if (!m_pLeadingBytes[byte1]) { return byte1; } - uint8_t byte2 = ((FX_LPBYTE)pString)[offset++]; + uint8_t byte2 = ((uint8_t*)pString)[offset++]; return byte1 * 256 + byte2; } case MixedFourBytes: { uint8_t codes[4]; int char_size = 1; - codes[0] = ((FX_LPBYTE)pString)[offset++]; + codes[0] = ((uint8_t*)pString)[offset++]; _CMap_CodeRange* pRanges = (_CMap_CodeRange*)m_pLeadingBytes; while (1) { int ret = _CheckCodeRange(codes, char_size, pRanges, m_nCodeRanges); @@ -527,7 +527,7 @@ FX_DWORD CPDF_CMap::GetNextChar(FX_LPCSTR pString, int nStrLen, int& offset) con if (char_size == 4 || offset == nStrLen) { return 0; } - codes[char_size ++] = ((FX_LPBYTE)pString)[offset++]; + codes[char_size ++] = ((uint8_t*)pString)[offset++]; } break; } @@ -556,7 +556,7 @@ int CPDF_CMap::GetCharSize(FX_DWORD charcode) const } return 1; } -int CPDF_CMap::CountChar(FX_LPCSTR pString, int size) const +int CPDF_CMap::CountChar(const FX_CHAR* pString, int size) const { switch (m_CodingScheme) { case OneByte: @@ -567,7 +567,7 @@ int CPDF_CMap::CountChar(FX_LPCSTR pString, int size) const int count = 0; for (int i = 0; i < size; i ++) { count ++; - if (m_pLeadingBytes[((FX_LPBYTE)pString)[i]]) { + if (m_pLeadingBytes[((uint8_t*)pString)[i]]) { i ++; } } @@ -619,7 +619,7 @@ int _GetCharSize(FX_DWORD charcode, _CMap_CodeRange* pRanges, int iRangesSize) } return 1; } -int CPDF_CMap::AppendChar(FX_LPSTR str, FX_DWORD charcode) const +int CPDF_CMap::AppendChar(FX_CHAR* str, FX_DWORD charcode) const { switch (m_CodingScheme) { case OneByte: @@ -793,7 +793,7 @@ FX_WCHAR CPDF_CIDFont::_UnicodeFromCharCode(FX_DWORD charcode) const charcode = (charcode % 256) * 256 + (charcode / 256); charsize = 2; } - int ret = FXSYS_MultiByteToWideChar(g_CharsetCPs[m_pCMap->m_Coding], 0, (FX_LPCSTR)&charcode, charsize, &unicode, 1); + int ret = FXSYS_MultiByteToWideChar(g_CharsetCPs[m_pCMap->m_Coding], 0, (const FX_CHAR*)&charcode, charsize, &unicode, 1); if (ret != 1) { return 0; } @@ -1056,7 +1056,7 @@ void CPDF_CIDFont::GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level) } if (m_pFontFile == NULL && m_Charset == CIDSET_JAPAN1) { FX_WORD CID = CIDFromCharCode(charcode); - FX_LPCBYTE pTransform = GetCIDTransform(CID); + const uint8_t* pTransform = GetCIDTransform(CID); if (pTransform && !bVert) { CFX_AffineMatrix matrix(_CIDTransformToFloat(pTransform[0]), _CIDTransformToFloat(pTransform[1]), _CIDTransformToFloat(pTransform[2]), _CIDTransformToFloat(pTransform[3]), @@ -1222,7 +1222,7 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL *pVertGlyph) } else if (bMacRoman) { iBaseEncoding = PDFFONT_ENCODING_MACROMAN; } - FX_LPCSTR name = GetAdobeCharName(iBaseEncoding, NULL, charcode); + const FX_CHAR* name = GetAdobeCharName(iBaseEncoding, NULL, charcode); if (name == NULL) { return charcode == 0 ? -1 : (int)charcode; } @@ -1314,10 +1314,10 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL *pVertGlyph) if (byte_pos + 2 > m_pCIDToGIDMap->GetSize()) { return -1; } - FX_LPCBYTE pdata = m_pCIDToGIDMap->GetData() + byte_pos; + const uint8_t* pdata = m_pCIDToGIDMap->GetData() + byte_pos; return pdata[0] * 256 + pdata[1]; } -FX_DWORD CPDF_CIDFont::GetNextChar(FX_LPCSTR pString, int nStrLen, int& offset) const +FX_DWORD CPDF_CIDFont::GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const { return m_pCMap->GetNextChar(pString, nStrLen, offset); } @@ -1325,11 +1325,11 @@ int CPDF_CIDFont::GetCharSize(FX_DWORD charcode) const { return m_pCMap->GetCharSize(charcode); } -int CPDF_CIDFont::CountChar(FX_LPCSTR pString, int size) const +int CPDF_CIDFont::CountChar(const FX_CHAR* pString, int size) const { return m_pCMap->CountChar(pString, size); } -int CPDF_CIDFont::AppendChar(FX_LPSTR str, FX_DWORD charcode) const +int CPDF_CIDFont::AppendChar(FX_CHAR* str, FX_DWORD charcode) const { return m_pCMap->AppendChar(str, charcode); } @@ -1579,7 +1579,7 @@ Japan1_VertCIDs[] = { {8818, 0, 129, 127, 0, 19, 114}, {8819, 0, 129, 127, 0, 218, 108}, }; -FX_LPCBYTE CPDF_CIDFont::GetCIDTransform(FX_WORD CID) const +const uint8_t* CPDF_CIDFont::GetCIDTransform(FX_WORD CID) const { if (m_Charset != CIDSET_JAPAN1 || m_pFontFile != NULL) { return NULL; diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp index ab15c47cb3..b6b2f57c02 100644 --- a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp +++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp @@ -48,7 +48,7 @@ void CFX_GlyphMap::SetAt(int key, int value) } FX_BOOL CFX_GlyphMap::Lookup(int key, int &value) { - FX_LPVOID pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(), m_Buffer.GetSize() / sizeof(_IntPair), + void* pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(), m_Buffer.GetSize() / sizeof(_IntPair), sizeof(_IntPair), _CompareInt); if (pResult == NULL) { return FALSE; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp index 82f90d17a6..046cebeb98 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp @@ -242,7 +242,7 @@ void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs, FX_FLOAT* pKernin m_pCharPos = FX_Alloc(FX_FLOAT, m_nChars - 1); int index = 0; for (int i = 0; i < nsegs; i ++) { - FX_LPCSTR segment = pStrs[i]; + const FX_CHAR* segment = pStrs[i]; int offset = 0, len = pStrs[i].GetLength(); while (offset < len) { m_pCharCodes[index++] = pFont->GetNextChar(segment, len, offset); diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp index ea61078209..1b989be040 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp @@ -125,7 +125,7 @@ FX_BOOL CPDF_DeviceCS::v_SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOA } return FALSE; } -static void ReverseRGB(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels) +static void ReverseRGB(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels) { if (pDestBuf == pSrcBuf) for (int i = 0; i < pixels; i ++) { @@ -142,7 +142,7 @@ static void ReverseRGB(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels) pSrcBuf += 3; } } -void CPDF_DeviceCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const +void CPDF_DeviceCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const { if (bTransMask && m_Family == PDFCS_DEVICECMYK) { for (int i = 0; i < pixels; i ++) { @@ -267,7 +267,7 @@ public: CPDF_CalGray(); virtual FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray); virtual FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const; - virtual void TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; + virtual void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const; FX_FLOAT m_WhitePoint[3]; FX_FLOAT m_BlackPoint[3]; @@ -310,7 +310,7 @@ FX_BOOL CPDF_CalGray::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) return FALSE; } } -void CPDF_CalGray::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const +void CPDF_CalGray::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const { for (int i = 0; i < pixels; i ++) { *pDestBuf ++ = pSrcBuf[i]; @@ -324,7 +324,7 @@ public: CPDF_CalRGB(); virtual FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray); virtual FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const; - virtual void TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; + virtual void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const; FX_FLOAT m_WhitePoint[3]; FX_FLOAT m_BlackPoint[3]; @@ -399,7 +399,7 @@ FX_BOOL CPDF_CalRGB::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) pBuf[2] = B; return TRUE; } -void CPDF_CalRGB::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const +void CPDF_CalRGB::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const { if (bTransMask) { FX_FLOAT Cal[3]; @@ -430,7 +430,7 @@ public: virtual void GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOAT& max) const; virtual FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const; FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const; - virtual void TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; + virtual void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; FX_FLOAT m_WhitePoint[3]; FX_FLOAT m_BlackPoint[3]; FX_FLOAT m_Ranges[4]; @@ -505,7 +505,7 @@ FX_BOOL CPDF_LabCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) c { return FALSE; } -void CPDF_LabCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const +void CPDF_LabCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const { for (int i = 0; i < pixels; i ++) { FX_FLOAT lab[3]; @@ -521,7 +521,7 @@ void CPDF_LabCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pSrcBuf += 3; } } -CPDF_IccProfile::CPDF_IccProfile(FX_LPCBYTE pData, FX_DWORD dwSize): +CPDF_IccProfile::CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize): m_bsRGB(FALSE), m_pTransform(NULL), m_nSrcComponents(0) @@ -555,11 +555,11 @@ public: FX_BOOL v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const; FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const; virtual void EnableStdConversion(FX_BOOL bEnabled); - virtual void TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; + virtual void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; FX_FLOAT* m_pRanges; CPDF_IccProfile* m_pProfile; CPDF_ColorSpace* m_pAlterCS; - FX_LPBYTE m_pCache; + uint8_t* m_pCache; FX_BOOL m_bOwn; }; CPDF_ICCBasedCS::CPDF_ICCBasedCS() @@ -702,7 +702,7 @@ void CPDF_ICCBasedCS::EnableStdConversion(FX_BOOL bEnabled) m_pAlterCS->EnableStdConversion(bEnabled); } } -void CPDF_ICCBasedCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const +void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const { if (m_pProfile->m_bsRGB) { ReverseRGB(pDestBuf, pSrcBuf, pixels); @@ -716,8 +716,8 @@ void CPDF_ICCBasedCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, } else { if (m_pCache == NULL) { ((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; + uint8_t* temp_src = FX_Alloc2D(uint8_t, nMaxColors, m_nComponents); + uint8_t* pSrc = temp_src; for (int i = 0; i < nMaxColors; i ++) { FX_DWORD color = i; FX_DWORD order = nMaxColors / 52; @@ -839,7 +839,7 @@ FX_BOOL CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOA } CFX_FixedBufGrow<FX_FLOAT, 16> Comps(m_nBaseComponents); FX_FLOAT* comps = Comps; - FX_LPCBYTE pTable = m_Table; + const uint8_t* pTable = m_Table; for (int i = 0; i < m_nBaseComponents; i ++) { comps[i] = m_pCompMinMax[i * 2] + m_pCompMinMax[i * 2 + 1] * pTable[index * m_nBaseComponents + i] / 255; } @@ -1257,7 +1257,7 @@ int CPDF_ColorSpace::GetMaxIndex() const CPDF_IndexedCS* pCS = (CPDF_IndexedCS*)this; return pCS->m_MaxIndex; } -void CPDF_ColorSpace::TranslateImageLine(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const +void CPDF_ColorSpace::TranslateImageLine(uint8_t* dest_buf, const uint8_t* src_buf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const { CFX_FixedBufGrow<FX_FLOAT, 16> srcbuf(m_nComponents); FX_FLOAT* src = srcbuf; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp index dadf6bf9cb..2cfb02869c 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp @@ -64,10 +64,10 @@ CPDF_PSProc::~CPDF_PSProc() { int size = m_Operators.GetSize(); for (int i = 0; i < size; i ++) { - if (m_Operators[i] == (FX_LPVOID)PSOP_PROC) { + if (m_Operators[i] == (void*)PSOP_PROC) { delete (CPDF_PSProc*)m_Operators[i + 1]; i ++; - } else if (m_Operators[i] == (FX_LPVOID)PSOP_CONST) { + } else if (m_Operators[i] == (void*)PSOP_CONST) { FX_Free((FX_FLOAT*)m_Operators[i + 1]); i ++; } @@ -84,15 +84,15 @@ FX_BOOL CPDF_PSProc::Execute(CPDF_PSEngine* pEngine) pEngine->Push(*(FX_FLOAT*)m_Operators[i + 1]); i ++; } else if (op == PSOP_IF) { - if (i < 2 || m_Operators[i - 2] != (FX_LPVOID)PSOP_PROC) { + if (i < 2 || m_Operators[i - 2] != (void*)PSOP_PROC) { return FALSE; } if ((int)pEngine->Pop()) { ((CPDF_PSProc*)m_Operators[i - 1])->Execute(pEngine); } } else if (op == PSOP_IFELSE) { - if (i < 4 || m_Operators[i - 2] != (FX_LPVOID)PSOP_PROC || - m_Operators[i - 4] != (FX_LPVOID)PSOP_PROC) { + if (i < 4 || m_Operators[i - 2] != (void*)PSOP_PROC || + m_Operators[i - 4] != (void*)PSOP_PROC) { return FALSE; } if ((int)pEngine->Pop()) { @@ -147,7 +147,7 @@ const struct _PDF_PSOpName { }; FX_BOOL CPDF_PSEngine::Parse(const FX_CHAR* string, int size) { - CPDF_SimpleParser parser((FX_LPBYTE)string, size); + CPDF_SimpleParser parser((uint8_t*)string, size); CFX_ByteStringC word = parser.GetWord(); if (word != FX_BSTRC("{")) { return FALSE; @@ -166,7 +166,7 @@ FX_BOOL CPDF_PSProc::Parse(CPDF_SimpleParser& parser) } if (word == FX_BSTRC("{")) { CPDF_PSProc* pProc = new CPDF_PSProc; - m_Operators.Add((FX_LPVOID)PSOP_PROC); + m_Operators.Add((void*)PSOP_PROC); m_Operators.Add(pProc); if (!pProc->Parse(parser)) { return FALSE; @@ -175,7 +175,7 @@ FX_BOOL CPDF_PSProc::Parse(CPDF_SimpleParser& parser) int i = 0; while (_PDF_PSOpNames[i].name) { if (word == CFX_ByteStringC(_PDF_PSOpNames[i].name)) { - m_Operators.Add((FX_LPVOID)_PDF_PSOpNames[i].op); + m_Operators.Add((void*)_PDF_PSOpNames[i].op); break; } i ++; @@ -183,7 +183,7 @@ FX_BOOL CPDF_PSProc::Parse(CPDF_SimpleParser& parser) if (_PDF_PSOpNames[i].name == NULL) { FX_FLOAT* pd = FX_Alloc(FX_FLOAT, 1); *pd = FX_atof(word); - m_Operators.Add((FX_LPVOID)PSOP_CONST); + m_Operators.Add((void*)PSOP_CONST); m_Operators.Add(pd); } } @@ -424,7 +424,7 @@ static FX_FLOAT PDF_Interpolate(FX_FLOAT x, FX_FLOAT xmin, FX_FLOAT xmax, FX_FLO { return ((x - xmin) * (ymax - ymin) / (xmax - xmin)) + ymin; } -static FX_DWORD _GetBits32(FX_LPCBYTE pData, int bitpos, int nbits) +static FX_DWORD _GetBits32(const uint8_t* pData, int bitpos, int nbits) { int result = 0; for (int i = 0; i < nbits; i ++) @@ -561,7 +561,7 @@ FX_BOOL CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const if (!bitpos.IsValid()) { return FALSE; } - FX_LPCBYTE pSampleData = m_pSampleStream->GetData(); + const uint8_t* pSampleData = m_pSampleStream->GetData(); if (pSampleData == NULL) { return FALSE; } 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 bb4b9dee23..3ce4baf20c 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp @@ -349,7 +349,7 @@ FX_FLOAT CPDF_TextState::GetShearAngle() const CPDF_GeneralStateData::CPDF_GeneralStateData() { FXSYS_memset32(this, 0, sizeof(CPDF_GeneralStateData)); - FXSYS_strcpy((FX_LPSTR)m_BlendMode, "Normal"); + FXSYS_strcpy((FX_CHAR*)m_BlendMode, "Normal"); m_StrokeAlpha = 1.0f; m_FillAlpha = 1.0f; m_Flatness = 1.0f; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp index a92e9e783d..d898feecf4 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -113,7 +113,7 @@ int CPDF_StreamContentParser::GetNextParamPos() m_ParamCount ++; return index; } -void CPDF_StreamContentParser::AddNameParam(FX_LPCSTR name, int len) +void CPDF_StreamContentParser::AddNameParam(const FX_CHAR* name, int len) { int index = GetNextParamPos(); if (len > 32) { @@ -131,7 +131,7 @@ void CPDF_StreamContentParser::AddNameParam(FX_LPCSTR name, int len) } } } -void CPDF_StreamContentParser::AddNumberParam(FX_LPCSTR str, int len) +void CPDF_StreamContentParser::AddNumberParam(const FX_CHAR* str, int len) { int index = GetNextParamPos(); m_ParamBuf1[index].m_Type = PDFOBJ_NUMBER; @@ -321,7 +321,7 @@ const struct _OpCode { {FXBSTR_ID('w', 0, 0, 0), &CPDF_StreamContentParser::Handle_SetLineWidth}, {FXBSTR_ID('y', 0, 0, 0), &CPDF_StreamContentParser::Handle_CurveTo_13}, }; -FX_BOOL CPDF_StreamContentParser::OnOperator(FX_LPCSTR op) +FX_BOOL CPDF_StreamContentParser::OnOperator(const FX_CHAR* op) { int i = 0; FX_DWORD opid = 0; @@ -410,7 +410,7 @@ void CPDF_StreamContentParser::Handle_BeginMarkedContent() m_CurContentMark.GetModify()->AddMark(tag, NULL, FALSE); } struct _FX_BSTR { - FX_LPCSTR m_Ptr; + const FX_CHAR* m_Ptr; int m_Size; }; #define _FX_BSTRC(str) {str, sizeof(str)-1} @@ -1550,7 +1550,7 @@ CFX_ByteString _FPDF_ByteStringFromHex(CFX_BinaryBuf& src_buf) CFX_ByteTextBuf buf; FX_BOOL bFirst = TRUE; int code = 0; - FX_LPCBYTE str = src_buf.GetBuffer(); + const uint8_t* str = src_buf.GetBuffer(); FX_DWORD size = src_buf.GetSize(); for (FX_DWORD i = 0; i < size; i ++) { uint8_t ch = str[i]; 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 bc2138e19e..ec2b69f70b 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -9,7 +9,7 @@ #include "../../../include/fxcodec/fx_codec.h" #include "pageint.h" #include <limits.h> -extern const FX_LPCSTR _PDF_OpCharType = +const FX_CHAR* const _PDF_OpCharType = "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII" "IIVIIIIVIIVIIIIIVVIIIIIIIIIIIIII" "IIVVVVVVIVVVVVVIVVVVVIIVVIIIIIII" @@ -18,7 +18,7 @@ extern const FX_LPCSTR _PDF_OpCharType = "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII" "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII" "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII"; -FX_BOOL _PDF_HasInvalidOpChar(FX_LPCSTR op) +FX_BOOL _PDF_HasInvalidOpChar(const FX_CHAR* op) { if(!op) { return FALSE; @@ -41,7 +41,7 @@ class CPDF_StreamParserAutoClearer { private: CPDF_StreamParser** scoped_variable_; }; -FX_DWORD CPDF_StreamContentParser::Parse(FX_LPCBYTE pData, FX_DWORD dwSize, FX_DWORD max_cost) +FX_DWORD CPDF_StreamContentParser::Parse(const uint8_t* pData, FX_DWORD dwSize, FX_DWORD max_cost) { if (m_Level > _FPDF_MAX_FORM_LEVEL_) { return dwSize; @@ -71,7 +71,7 @@ FX_DWORD CPDF_StreamContentParser::Parse(FX_LPCBYTE pData, FX_DWORD dwSize, FX_D AddNumberParam((char*)syntax.GetWordBuf(), syntax.GetWordSize()); break; case CPDF_StreamParser::Name: - AddNameParam((FX_LPCSTR)syntax.GetWordBuf() + 1, syntax.GetWordSize() - 1); + AddNameParam((const FX_CHAR*)syntax.GetWordBuf() + 1, syntax.GetWordSize() - 1); break; default: AddObjectParam(syntax.GetObject()); @@ -97,7 +97,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() if (type != CPDF_StreamParser::Name) { break; } - CFX_ByteString key((FX_LPCSTR)m_pSyntax->GetWordBuf() + 1, m_pSyntax->GetWordSize() - 1); + CFX_ByteString key((const FX_CHAR*)m_pSyntax->GetWordBuf() + 1, m_pSyntax->GetWordSize() - 1); CPDF_Object* pObj = m_pSyntax->ReadNextObject(); if (!key.IsEmpty()) { pDict->SetAt(key, pObj, m_pDocument); @@ -248,7 +248,7 @@ CPDF_StreamParser::~CPDF_StreamParser() m_pLastObj->Release(); } } -FX_DWORD _DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +FX_DWORD _DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, uint8_t*& dest_buf, FX_DWORD& dest_size) { if (pDecoder == NULL) { return (FX_DWORD) - 1; @@ -265,7 +265,7 @@ FX_DWORD _DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, FX_LPBYTE& dest_b 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); + uint8_t* pLine = pDecoder->GetScanline(row); if (pLine == NULL) { break; } @@ -275,15 +275,15 @@ FX_DWORD _DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, FX_LPBYTE& dest_b delete pDecoder; return srcoff; } -ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, const 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 _A85Decode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); +FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& 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 estimated_size, uint8_t*& dest_buf, FX_DWORD& dest_size); 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) + CPDF_Dictionary* pParam, uint8_t*& dest_buf, FX_DWORD& dest_size) { if (decoder == FX_BSTRC("CCITTFaxDecode") || decoder == FX_BSTRC("CCF")) { ICodec_ScanlineDecoder* pDecoder = FPDFAPI_CreateFaxDecoder(src_buf, limit, width, height, pParam); @@ -367,7 +367,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CPDF_Dicti return NULL; } OrigSize *= height; - FX_LPBYTE pData = NULL; + uint8_t* pData = NULL; FX_DWORD dwStreamSize; if (Decoder.IsEmpty()) { if (OrigSize > m_Size - m_Pos) { @@ -1026,7 +1026,7 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, CPDF_AllStates* pGraphicStates, } else { m_pSingleStream->LoadAllData(pForm->m_pFormStream, FALSE); } - m_pData = (FX_LPBYTE)m_pSingleStream->GetData(); + m_pData = (uint8_t*)m_pSingleStream->GetData(); m_Size = m_pSingleStream->GetSize(); m_Status = ToBeContinued; m_InternalStage = PAGEPARSE_STAGE_PARSE; @@ -1060,7 +1060,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) FX_Free(m_pStreamArray); m_pStreamArray = NULL; } else { - m_pData = (FX_LPBYTE)m_pSingleStream->GetData(); + m_pData = (uint8_t*)m_pSingleStream->GetData(); m_Size = m_pSingleStream->GetSize(); } m_InternalStage = PAGEPARSE_STAGE_PARSE; diff --git a/core/src/fpdfapi/fpdf_page/pageint.h b/core/src/fpdfapi/fpdf_page/pageint.h index 1f5428d56f..9ff1c4cb11 100644 --- a/core/src/fpdfapi/fpdf_page/pageint.h +++ b/core/src/fpdfapi/fpdf_page/pageint.h @@ -23,7 +23,7 @@ public: typedef enum { EndOfData, Number, Keyword, Name, Others } SyntaxType; SyntaxType ParseNextElement(); - FX_LPBYTE GetWordBuf() + uint8_t* GetWordBuf() { return m_WordBuffer; } @@ -142,9 +142,9 @@ public: _ContentParam m_ParamBuf1[PARAM_BUF_SIZE]; FX_DWORD m_ParamStartPos; FX_DWORD m_ParamCount; - void AddNumberParam(FX_LPCSTR str, int len); + void AddNumberParam(const FX_CHAR* str, int len); void AddObjectParam(CPDF_Object* pObj); - void AddNameParam(FX_LPCSTR name, int size); + void AddNameParam(const FX_CHAR* name, int size); int GetNextParamPos(); void ClearAllParams(); CPDF_Object* GetObject(FX_DWORD index); @@ -155,7 +155,7 @@ public: { return (int32_t)(GetNumber(index)); } - FX_BOOL OnOperator(FX_LPCSTR op); + FX_BOOL OnOperator(const FX_CHAR* op); void BigCaseCaller(int index); FX_BOOL m_bAbort; CPDF_StreamParser* m_pSyntax; @@ -173,7 +173,7 @@ public: void ConvertUserSpace(FX_FLOAT& x, FX_FLOAT& y); void ConvertTextSpace(FX_FLOAT& x, FX_FLOAT& y); void OnChangeTextMatrix(); - FX_DWORD Parse(FX_LPCBYTE pData, FX_DWORD dwSize, FX_DWORD max_cost); + FX_DWORD Parse(const uint8_t* pData, FX_DWORD dwSize, FX_DWORD max_cost); void ParsePathObject(); int m_CompatCount; FX_PATHPOINT* m_pPathPoints; @@ -307,7 +307,7 @@ protected: CPDF_StreamAcc* m_pSingleStream; CPDF_StreamAcc** m_pStreamArray; FX_DWORD m_nStreams; - FX_LPBYTE m_pData; + uint8_t* m_pData; FX_DWORD m_Size; class CPDF_StreamContentParser* m_pParser; FX_DWORD m_CurrentOffset; @@ -420,11 +420,11 @@ protected: class CPDF_IccProfile { public: - CPDF_IccProfile(FX_LPCBYTE pData, FX_DWORD dwSize); + CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize); ~CPDF_IccProfile(); int32_t GetComponents() const { return m_nSrcComponents; } FX_BOOL m_bsRGB; - FX_LPVOID m_pTransform; + void* m_pTransform; private: int32_t m_nSrcComponents; }; @@ -436,7 +436,7 @@ public: FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const; FX_BOOL v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y, FX_FLOAT& k) const; FX_BOOL v_SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k) const; - virtual void TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; + virtual void TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) const; }; class CPDF_PatternCS : public CPDF_ColorSpace { @@ -461,7 +461,7 @@ public: int m_nIndex; }; ~CPDF_ResourceNaming(); - CFX_ByteString GetName(const CPDF_Dictionary* pResList, FX_LPCSTR szType); + CFX_ByteString GetName(const CPDF_Dictionary* pResList, const FX_CHAR* szType); protected: CFX_MapByteStringToPtr m_NamingCache; }; diff --git a/core/src/fpdfapi/fpdf_parser/filters_int.h b/core/src/fpdfapi/fpdf_parser/filters_int.h index 6652cc0ccc..38dcb171f5 100644 --- a/core/src/fpdfapi/fpdf_parser/filters_int.h +++ b/core/src/fpdfapi/fpdf_parser/filters_int.h @@ -12,10 +12,10 @@ class CPDF_DecryptFilter : public CFX_DataFilter public: CPDF_DecryptFilter(CPDF_CryptoHandler* pCryptoHandler, FX_DWORD objnum, FX_DWORD gennum); virtual ~CPDF_DecryptFilter(); - virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf); CPDF_CryptoHandler* m_pCryptoHandler; - FX_LPVOID m_pContext; + void* m_pContext; FX_DWORD m_ObjNum, m_GenNum; }; class CPDF_FlateFilter : public CFX_DataFilter @@ -23,7 +23,7 @@ class CPDF_FlateFilter : public CFX_DataFilter public: CPDF_FlateFilter(); virtual ~CPDF_FlateFilter(); - virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {} void* m_pContext; uint8_t m_DestBuffer[FPDF_FILTER_BUFFER_SIZE]; @@ -33,7 +33,7 @@ class CPDF_LzwFilter : public CFX_DataFilter public: CPDF_LzwFilter(FX_BOOL bEarlyChange); virtual ~CPDF_LzwFilter() {} - virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {} FX_BOOL m_bEarlyChange; FX_DWORD m_CodeArray[5021]; @@ -52,11 +52,12 @@ class CPDF_PredictorFilter : public CFX_DataFilter public: CPDF_PredictorFilter(int predictor, int colors, int bpc, int cols); virtual ~CPDF_PredictorFilter(); - virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {} FX_BOOL m_bTiff; FX_DWORD m_Pitch, m_Bpp; - FX_LPBYTE m_pRefLine, m_pCurLine; + uint8_t* m_pRefLine; + uint8_t* m_pCurLine; FX_DWORD m_iLine, m_LineInSize; }; class CPDF_AsciiHexFilter : public CFX_DataFilter @@ -64,7 +65,7 @@ class CPDF_AsciiHexFilter : public CFX_DataFilter public: CPDF_AsciiHexFilter(); virtual ~CPDF_AsciiHexFilter() {} - virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {} int m_State; int m_FirstDigit; @@ -74,7 +75,7 @@ class CPDF_Ascii85Filter : public CFX_DataFilter public: CPDF_Ascii85Filter(); virtual ~CPDF_Ascii85Filter() {} - virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {} int m_State; int m_CharCount; @@ -85,7 +86,7 @@ class CPDF_RunLenFilter : public CFX_DataFilter public: CPDF_RunLenFilter(); virtual ~CPDF_RunLenFilter() {} - virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {} int m_State; FX_DWORD m_Count; @@ -95,11 +96,11 @@ class CPDF_JpegFilter : public CFX_DataFilter public: CPDF_JpegFilter(); virtual ~CPDF_JpegFilter(); - virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {} void* m_pContext; CFX_BinaryBuf m_InputBuf; - FX_LPBYTE m_pScanline; + uint8_t* m_pScanline; int m_Pitch, m_Height, m_Width, m_nComps, m_iLine; FX_BOOL m_bGotHeader; }; @@ -109,16 +110,17 @@ public: CPDF_FaxFilter(); virtual ~CPDF_FaxFilter(); FX_BOOL Initialize(int Encoding, int bEndOfLine, int bByteAlign, int bBlack, int nRows, int nColumns); - virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf); int m_Encoding, m_bEndOfLine, m_bByteAlign, m_bBlack; int m_nRows, m_nColumns, m_Pitch, m_iRow; - FX_LPBYTE m_pScanlineBuf, m_pRefBuf; + uint8_t* m_pScanlineBuf; + uint8_t* m_pRefBuf; CFX_BinaryBuf m_InputBuf; int m_InputBitPos; - void ProcessData(FX_LPCBYTE src_buf, FX_DWORD src_size, int& bitpos, FX_BOOL bFinish, + void ProcessData(const uint8_t* src_buf, FX_DWORD src_size, int& bitpos, FX_BOOL bFinish, CFX_BinaryBuf& dest_buf); - FX_BOOL ReadLine(FX_LPCBYTE src_buf, int bitsize, int& bitpos); + FX_BOOL ReadLine(const uint8_t* src_buf, int bitsize, int& bitpos); }; #endif // CORE_SRC_FPDFAPI_FPDF_PARSER_FILTERS_INT_H_ diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp index b1fde0be71..bb490636a9 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp @@ -9,7 +9,7 @@ #include "../../../include/fxcodec/fx_codec.h" #include <limits.h> #define _STREAM_MAX_SIZE_ 20 * 1024 * 1024 -FX_DWORD _A85Decode(const uint8_t* 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, uint8_t*& dest_buf, FX_DWORD& dest_size) { dest_size = 0; dest_buf = NULL; @@ -82,7 +82,7 @@ FX_DWORD _A85Decode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b } return pos; } -FX_DWORD _HexDecode(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, uint8_t*& dest_buf, FX_DWORD& dest_size) { FX_DWORD i; for (i = 0; i < src_size; i ++) @@ -122,7 +122,7 @@ FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b } return i; } -FX_DWORD RunLengthDecode(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, uint8_t*& dest_buf, FX_DWORD& dest_size) { FX_DWORD i = 0; FX_DWORD old; @@ -182,7 +182,7 @@ FX_DWORD RunLengthDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& d } return ret; } -ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, const CPDF_Dictionary* pParams) { int K = 0; @@ -228,7 +228,7 @@ static FX_BOOL CheckFlateDecodeParams(int Colors, int BitsPerComponent, int Colu } return TRUE; } -ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, const CPDF_Dictionary* pParams) { int predictor = 0; @@ -246,7 +246,7 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD nComps, bpc, predictor, Colors, BitsPerComponent, Columns); } 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 estimated_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { int predictor = 0; FX_BOOL bEarlyChange = TRUE; @@ -265,8 +265,8 @@ FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD bEarlyChange, predictor, Colors, BitsPerComponent, Columns, estimated_size, dest_buf, dest_size); } -FX_BOOL PDF_DataDecode(FX_LPCBYTE src_buf, FX_DWORD src_size, const CPDF_Dictionary* pDict, - FX_LPBYTE& dest_buf, FX_DWORD& dest_size, CFX_ByteString& ImageEncoding, +FX_BOOL PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF_Dictionary* pDict, + uint8_t*& dest_buf, FX_DWORD& dest_size, CFX_ByteString& ImageEncoding, CPDF_Dictionary*& pImageParms, FX_DWORD last_estimated_size, FX_BOOL bImageAcc) { @@ -295,19 +295,19 @@ FX_BOOL PDF_DataDecode(FX_LPCBYTE src_buf, FX_DWORD src_size, const CPDF_Diction DecoderList.Add(pDecoder->GetConstString()); ParamList.Add(pParams ? pParams->GetDict() : NULL); } - FX_LPBYTE last_buf = (FX_LPBYTE)src_buf; + uint8_t* last_buf = (uint8_t*)src_buf; FX_DWORD last_size = src_size; for (int i = 0; i < DecoderList.GetSize(); i ++) { int estimated_size = i == DecoderList.GetSize() - 1 ? last_estimated_size : 0; CFX_ByteString decoder = DecoderList[i]; CPDF_Dictionary* pParam = (CPDF_Dictionary*)ParamList[i]; - FX_LPBYTE new_buf = NULL; + uint8_t* new_buf = NULL; FX_DWORD new_size = (FX_DWORD) - 1; int offset = -1; if (decoder == FX_BSTRC("FlateDecode") || decoder == FX_BSTRC("Fl")) { if (bImageAcc && i == DecoderList.GetSize() - 1) { ImageEncoding = FX_BSTRC("FlateDecode"); - dest_buf = (FX_LPBYTE)last_buf; + dest_buf = (uint8_t*)last_buf; dest_size = last_size; pImageParms = pParam; return TRUE; @@ -323,7 +323,7 @@ FX_BOOL PDF_DataDecode(FX_LPCBYTE src_buf, FX_DWORD src_size, const CPDF_Diction } else if (decoder == FX_BSTRC("RunLengthDecode") || decoder == FX_BSTRC("RL")) { if (bImageAcc && i == DecoderList.GetSize() - 1) { ImageEncoding = FX_BSTRC("RunLengthDecode"); - dest_buf = (FX_LPBYTE)last_buf; + dest_buf = (uint8_t*)last_buf; dest_size = last_size; pImageParms = pParam; return TRUE; @@ -339,7 +339,7 @@ FX_BOOL PDF_DataDecode(FX_LPCBYTE src_buf, FX_DWORD src_size, const CPDF_Diction } ImageEncoding = decoder; pImageParms = pParam; - dest_buf = (FX_LPBYTE)last_buf; + dest_buf = (uint8_t*)last_buf; dest_size = last_size; return TRUE; } @@ -386,7 +386,7 @@ extern const FX_WORD PDFDocEncoding[256] = { 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff }; -CFX_WideString PDF_DecodeText(FX_LPCBYTE src_data, FX_DWORD src_len, CFX_CharMap* pCharMap) +CFX_WideString PDF_DecodeText(const uint8_t* src_data, FX_DWORD src_len, CFX_CharMap* pCharMap) { CFX_WideString result; if (src_len >= 2 && ((src_data[0] == 0xfe && src_data[1] == 0xff) || (src_data[0] == 0xff && src_data[1] == 0xfe))) { @@ -398,8 +398,8 @@ CFX_WideString PDF_DecodeText(FX_LPCBYTE src_data, FX_DWORD src_len, CFX_CharMap if (src_data[0] == 0xff) { bBE = !src_data[2]; } - FX_LPWSTR dest_buf = result.GetBuffer(max_chars); - FX_LPCBYTE uni_str = src_data + 2; + FX_WCHAR* dest_buf = result.GetBuffer(max_chars); + const uint8_t* uni_str = src_data + 2; int dest_pos = 0; for (FX_DWORD i = 0; i < max_chars * 2; i += 2) { FX_WORD unicode = bBE ? (uni_str[i] << 8 | uni_str[i + 1]) : (uni_str[i + 1] << 8 | uni_str[i]); @@ -418,24 +418,24 @@ CFX_WideString PDF_DecodeText(FX_LPCBYTE src_data, FX_DWORD src_len, CFX_CharMap } result.ReleaseBuffer(dest_pos); } else if (pCharMap == NULL) { - FX_LPWSTR dest_buf = result.GetBuffer(src_len); + FX_WCHAR* dest_buf = result.GetBuffer(src_len); for (FX_DWORD i = 0; i < src_len; i ++) { dest_buf[i] = PDFDocEncoding[src_data[i]]; } result.ReleaseBuffer(src_len); } else { - return (*pCharMap->m_GetWideString)(pCharMap, CFX_ByteString((FX_LPCSTR)src_data, src_len)); + return (*pCharMap->m_GetWideString)(pCharMap, CFX_ByteString((const FX_CHAR*)src_data, src_len)); } return result; } -CFX_ByteString PDF_EncodeText(FX_LPCWSTR pString, int len, CFX_CharMap* pCharMap) +CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len, CFX_CharMap* pCharMap) { if (len == -1) { len = FXSYS_wcslen(pString); } CFX_ByteString result; if (pCharMap == NULL) { - FX_LPSTR dest_buf1 = result.GetBuffer(len); + FX_CHAR* dest_buf1 = result.GetBuffer(len); int i; for (i = 0; i < len; i ++) { int code; @@ -462,7 +462,7 @@ CFX_ByteString PDF_EncodeText(FX_LPCWSTR pString, int len, CFX_CharMap* pCharMap int encLen = len * 2 + 2; - FX_LPBYTE dest_buf2 = (FX_LPBYTE)result.GetBuffer(encLen); + uint8_t* dest_buf2 = (uint8_t*)result.GetBuffer(encLen); dest_buf2[0] = 0xfe; dest_buf2[1] = 0xff; dest_buf2 += 2; @@ -503,22 +503,22 @@ CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex) result.AppendChar(')'); return result.GetByteString(); } -void FlateEncode(const uint8_t* 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, uint8_t*& dest_buf, FX_DWORD& dest_size) { CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); if (pEncoders) { pEncoders->GetFlateModule()->Encode(src_buf, src_size, dest_buf, dest_size); } } -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) +void FlateEncode(const uint8_t* src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns, + uint8_t*& dest_buf, FX_DWORD& dest_size) { CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); if (pEncoders) { pEncoders->GetFlateModule()->Encode(src_buf, src_size, predictor, Colors, BitsPerComponent, Columns, dest_buf, dest_size); } } -FX_DWORD FlateDecode(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, uint8_t*& 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 f2643694ec..bd15c7587e 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)(uintptr_t)objnum, (FX_LPVOID&)pObj)) { + if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, (void*&)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 4ca97fe9e8..973a14e33b 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp @@ -13,8 +13,8 @@ const uint8_t defpasscode[32] = { 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80, 0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a }; -void CalcEncryptKey(CPDF_Dictionary* pEncrypt, FX_LPCBYTE password, FX_DWORD pass_size, - FX_LPBYTE key, int keylen, FX_BOOL bIgnoreMeta, CPDF_Array* pIdArray) +void CalcEncryptKey(CPDF_Dictionary* pEncrypt, const uint8_t* password, FX_DWORD pass_size, + uint8_t* key, int keylen, FX_BOOL bIgnoreMeta, CPDF_Array* pIdArray) { int revision = pEncrypt->GetInteger(FX_BSTRC("R")); uint8_t passcode[32]; @@ -25,16 +25,16 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt, FX_LPCBYTE password, FX_DWORD pas CRYPT_MD5Start(md5); CRYPT_MD5Update(md5, passcode, 32); CFX_ByteString okey = pEncrypt->GetString(FX_BSTRC("O")); - CRYPT_MD5Update(md5, (FX_LPBYTE)okey.c_str(), okey.GetLength()); + CRYPT_MD5Update(md5, (uint8_t*)okey.c_str(), okey.GetLength()); FX_DWORD perm = pEncrypt->GetInteger(FX_BSTRC("P")); - CRYPT_MD5Update(md5, (FX_LPBYTE)&perm, 4); + CRYPT_MD5Update(md5, (uint8_t*)&perm, 4); if (pIdArray) { CFX_ByteString id = pIdArray->GetString(0); - CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength()); + CRYPT_MD5Update(md5, (uint8_t*)id.c_str(), id.GetLength()); } if (!bIgnoreMeta && revision >= 3 && !pEncrypt->GetInteger(FX_BSTRC("EncryptMetadata"), 1)) { FX_DWORD tag = (FX_DWORD) - 1; - CRYPT_MD5Update(md5, (FX_LPBYTE)&tag, 4); + CRYPT_MD5Update(md5, (uint8_t*)&tag, 4); } uint8_t digest[16]; CRYPT_MD5Finish(md5, digest); @@ -189,7 +189,7 @@ FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict, FX return TRUE; return TRUE; } -FX_BOOL CPDF_StandardSecurityHandler::GetCryptInfo(int& cipher, FX_LPCBYTE& buffer, int& keylen) +FX_BOOL CPDF_StandardSecurityHandler::GetCryptInfo(int& cipher, const uint8_t*& buffer, int& keylen) { cipher = m_Cipher; buffer = m_EncryptKey; @@ -203,7 +203,7 @@ FX_BOOL CPDF_StandardSecurityHandler::GetCryptInfo(int& cipher, FX_LPCBYTE& buff | ( (uint64_t) (b)[(i) + 2] << 8 ) \ | ( (uint64_t) (b)[(i) + 3] )); \ } -int BigOrder64BitsMod3(FX_LPBYTE data) +int BigOrder64BitsMod3(uint8_t* data) { uint64_t ret = 0; for (int i = 0; i < 4; ++i) { @@ -215,7 +215,7 @@ int BigOrder64BitsMod3(FX_LPBYTE data) } return (int)ret; } -void Revision6_Hash(FX_LPCBYTE password, FX_DWORD size, FX_LPCBYTE salt, FX_LPCBYTE vector, FX_LPBYTE hash) +void Revision6_Hash(const uint8_t* password, FX_DWORD size, const uint8_t* salt, const uint8_t* vector, uint8_t* hash) { int iBlockSize = 32; uint8_t sha[128]; @@ -228,14 +228,14 @@ void Revision6_Hash(FX_LPCBYTE password, FX_DWORD size, FX_LPCBYTE salt, FX_LPCB uint8_t digest[32]; CRYPT_SHA256Finish(sha, digest); CFX_ByteTextBuf buf; - FX_LPBYTE input = digest; - FX_LPBYTE key = input; - FX_LPBYTE iv = input + 16; - FX_LPBYTE E = buf.GetBuffer(); + uint8_t* input = digest; + uint8_t* key = input; + uint8_t* iv = input + 16; + uint8_t* E = buf.GetBuffer(); int iBufLen = buf.GetLength(); CFX_ByteTextBuf interDigest; int i = 0; - FX_LPBYTE aes = FX_Alloc(uint8_t, 2048); + uint8_t* aes = FX_Alloc(uint8_t, 2048); while (i < 64 || i < E[iBufLen - 1] + 32) { int iRoundSize = size + iBlockSize; if (vector) { @@ -288,8 +288,8 @@ void Revision6_Hash(FX_LPCBYTE password, FX_DWORD size, FX_LPCBYTE salt, FX_LPCB FXSYS_memcpy32(hash, input, 32); } } -FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, FX_DWORD size, - FX_BOOL bOwner, FX_LPBYTE key) +FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(const uint8_t* password, FX_DWORD size, + FX_BOOL bOwner, uint8_t* key) { CFX_ByteString okey = m_pEncryptDict ? m_pEncryptDict->GetString(FX_BSTRC("O")) : CFX_ByteString(); if (okey.GetLength() < 48) { @@ -299,11 +299,11 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, if (ukey.GetLength() < 48) { return FALSE; } - FX_LPCBYTE pkey = bOwner ? (FX_LPCBYTE)okey : (FX_LPCBYTE)ukey; + const uint8_t* pkey = bOwner ? (const uint8_t*)okey : (const uint8_t*)ukey; 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); + Revision6_Hash(password, size, (const uint8_t*)pkey + 32, (bOwner ? (const uint8_t*)ukey : NULL), digest); } else { CRYPT_SHA256Start(sha); CRYPT_SHA256Update(sha, password, size); @@ -320,7 +320,7 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, return TRUE; } if (m_Revision >= 6) { - Revision6_Hash(password, size, (FX_LPCBYTE)pkey + 40, (bOwner ? (FX_LPCBYTE)ukey : NULL), digest); + Revision6_Hash(password, size, (const uint8_t*)pkey + 40, (bOwner ? (const uint8_t*)ukey : NULL), digest); } else { CRYPT_SHA256Start(sha); CRYPT_SHA256Update(sha, password, size); @@ -352,7 +352,7 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, if (copy_len > (FX_DWORD)perms.GetLength()) { copy_len = perms.GetLength(); } - FXSYS_memcpy32(perms_buf, (FX_LPCBYTE)perms, copy_len); + FXSYS_memcpy32(perms_buf, (const uint8_t*)perms, copy_len); uint8_t buf[16]; CRYPT_AESDecrypt(aes, buf, perms_buf, 16); FX_Free(aes); @@ -367,11 +367,11 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, } return TRUE; } -int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD pass_size, FX_BOOL bOwner, FX_LPBYTE key) +int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password, FX_DWORD pass_size, FX_BOOL bOwner, uint8_t* key) { 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, int32_t key_len) +int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password, FX_DWORD size, FX_BOOL bOwner, uint8_t* key, int32_t key_len) { if (m_Revision >= 5) { return AES256_CheckPassword(password, size, bOwner, key); @@ -385,8 +385,8 @@ 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, int32_t key_len) +FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(const uint8_t* password, FX_DWORD pass_size, + FX_BOOL bIgnoreEncryptMeta, uint8_t* key, int32_t key_len) { CalcEncryptKey(m_pEncryptDict, password, pass_size, key, key_len, bIgnoreEncryptMeta, m_pParser->GetIDArray()); @@ -419,21 +419,21 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_ CPDF_Array* pIdArray = m_pParser->GetIDArray(); if (pIdArray) { CFX_ByteString id = pIdArray->GetString(0); - CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength()); + CRYPT_MD5Update(md5, (uint8_t*)id.c_str(), id.GetLength()); } CRYPT_MD5Finish(md5, ukeybuf); return FXSYS_memcmp32(test, ukeybuf, 16) == 0; } - if (FXSYS_memcmp32((FX_LPVOID)ukey.c_str(), ukeybuf, 16) == 0) { + if (FXSYS_memcmp32((void*)ukey.c_str(), ukeybuf, 16) == 0) { return TRUE; } return FALSE; } -CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pass, FX_DWORD pass_size) +CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(const uint8_t* owner_pass, FX_DWORD pass_size) { return GetUserPassword(owner_pass, pass_size, m_KeyLen); } -CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pass, FX_DWORD pass_size, int32_t key_len) +CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(const uint8_t* owner_pass, FX_DWORD pass_size, int32_t key_len) { CFX_ByteString okey = m_pEncryptDict->GetString(FX_BSTRC("O")); uint8_t passcode[32]; @@ -480,8 +480,8 @@ 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, int32_t key_len) +FX_BOOL CPDF_StandardSecurityHandler::CheckOwnerPassword(const uint8_t* password, FX_DWORD pass_size, + uint8_t* 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)) { @@ -498,8 +498,8 @@ CPDF_SecurityHandler* FPDF_CreateStandardSecurityHandler() return new CPDF_StandardSecurityHandler; } void CPDF_StandardSecurityHandler::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) + const uint8_t* user_pass, FX_DWORD user_size, + const uint8_t* owner_pass, FX_DWORD owner_size, FX_BOOL bDefault, FX_DWORD type) { int cipher = 0, key_len = 0; if (!LoadDict(pEncryptDict, type, cipher, key_len)) { @@ -554,7 +554,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ } pEncryptDict->SetAtString(FX_BSTRC("O"), CFX_ByteString(passcode, 32)); } - CalcEncryptKey(m_pEncryptDict, (FX_LPBYTE)user_pass, user_size, m_EncryptKey, key_len, FALSE, pIdArray); + CalcEncryptKey(m_pEncryptDict, (uint8_t*)user_pass, user_size, m_EncryptKey, key_len, FALSE, pIdArray); if (m_Revision < 3) { uint8_t tempbuf[32]; FXSYS_memcpy32(tempbuf, defpasscode, 32); @@ -566,7 +566,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ CRYPT_MD5Update(md5, defpasscode, 32); if (pIdArray) { CFX_ByteString id = pIdArray->GetString(0); - CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength()); + CRYPT_MD5Update(md5, (uint8_t*)id.c_str(), id.GetLength()); } uint8_t digest[32]; CRYPT_MD5Finish(md5, digest); @@ -583,16 +583,16 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ } } void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, - FX_LPCBYTE user_pass, FX_DWORD user_size, - FX_LPCBYTE owner_pass, FX_DWORD owner_size, FX_DWORD type) + const uint8_t* user_pass, FX_DWORD user_size, + const uint8_t* owner_pass, FX_DWORD owner_size, FX_DWORD type) { OnCreate(pEncryptDict, pIdArray, user_pass, user_size, owner_pass, owner_size, TRUE, type); } -void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, FX_LPCBYTE user_pass, FX_DWORD user_size, FX_DWORD type) +void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, const uint8_t* user_pass, FX_DWORD user_size, FX_DWORD type) { OnCreate(pEncryptDict, pIdArray, user_pass, user_size, NULL, 0, FALSE, type); } -void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict, FX_LPCBYTE password, FX_DWORD size, FX_BOOL bOwner, FX_LPCBYTE key) +void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict, const uint8_t* password, FX_DWORD size, FX_BOOL bOwner, const uint8_t* key) { uint8_t sha[128]; CRYPT_SHA1Start(sha); @@ -603,7 +603,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD CFX_ByteString ukey = pEncryptDict->GetString(FX_BSTRC("U")); uint8_t digest1[48]; if (m_Revision >= 6) { - Revision6_Hash(password, size, digest, (bOwner ? (FX_LPCBYTE)ukey : NULL), digest1); + Revision6_Hash(password, size, digest, (bOwner ? (const uint8_t*)ukey : NULL), digest1); } else { CRYPT_SHA256Start(sha); CRYPT_SHA256Update(sha, password, size); @@ -616,7 +616,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD FXSYS_memcpy32(digest1 + 32, digest, 16); pEncryptDict->SetAtString(bOwner ? FX_BSTRC("O") : FX_BSTRC("U"), CFX_ByteString(digest1, 48)); if (m_Revision >= 6) { - Revision6_Hash(password, size, digest + 8, (bOwner ? (FX_LPCBYTE)ukey : NULL), digest1); + Revision6_Hash(password, size, digest + 8, (bOwner ? (const uint8_t*)ukey : NULL), digest1); } else { CRYPT_SHA256Start(sha); CRYPT_SHA256Update(sha, password, size); @@ -636,7 +636,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD pEncryptDict->SetAtString(bOwner ? FX_BSTRC("OE") : FX_BSTRC("UE"), CFX_ByteString(digest1, 32)); } void CPDF_StandardSecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict, FX_DWORD permissions, - FX_BOOL bEncryptMetadata, FX_LPCBYTE key) + FX_BOOL bEncryptMetadata, const uint8_t* key) { uint8_t buf[16]; buf[0] = (uint8_t)permissions; @@ -660,8 +660,8 @@ void CPDF_StandardSecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict FX_Free(aes); pEncryptDict->SetAtString(FX_BSTRC("Perms"), CFX_ByteString(buf1, 16)); } -void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, FX_DWORD gennum, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPBYTE dest_buf, FX_DWORD& dest_size) +void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, FX_DWORD gennum, const uint8_t* src_buf, FX_DWORD src_size, + uint8_t* dest_buf, FX_DWORD& dest_size) { if (m_Cipher == FXCIPHER_NONE) { FXSYS_memcpy32(dest_buf, src_buf, src_size); @@ -724,7 +724,7 @@ typedef struct _AESCryptContext { uint8_t m_Block[16]; FX_DWORD m_BlockOffset; } AESCryptContext; -FX_LPVOID CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennum, FX_BOOL bEncrypt) +void* CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennum, FX_BOOL bEncrypt) { if (m_Cipher == FXCIPHER_NONE) { return this; @@ -772,7 +772,7 @@ FX_LPVOID CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennu CRYPT_ArcFourSetup(pContext, realkey, realkeylen); return pContext; } -FX_BOOL CPDF_StandardCryptoHandler::CryptStream(FX_LPVOID context, FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt) +FX_BOOL CPDF_StandardCryptoHandler::CryptStream(void* context, const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt) { if (!context) { return FALSE; @@ -825,7 +825,7 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptStream(FX_LPVOID context, FX_LPCBYTE sr } return TRUE; } -FX_BOOL CPDF_StandardCryptoHandler::CryptFinish(FX_LPVOID context, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt) +FX_BOOL CPDF_StandardCryptoHandler::CryptFinish(void* context, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt) { if (!context) { return FALSE; @@ -858,7 +858,7 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptFinish(FX_LPVOID context, CFX_BinaryBuf FX_Free(pContext); return TRUE; } -FX_LPVOID CPDF_StandardCryptoHandler::DecryptStart(FX_DWORD objnum, FX_DWORD gennum) +void* CPDF_StandardCryptoHandler::DecryptStart(FX_DWORD objnum, FX_DWORD gennum) { return CryptStart(objnum, gennum, FALSE); } @@ -868,7 +868,7 @@ FX_DWORD CPDF_StandardCryptoHandler::DecryptGetSize(FX_DWORD src_size) } FX_BOOL CPDF_StandardCryptoHandler::Init(CPDF_Dictionary* pEncryptDict, CPDF_SecurityHandler* pSecurityHandler) { - FX_LPCBYTE key; + const uint8_t* key; if (!pSecurityHandler->GetCryptInfo(m_Cipher, key, m_KeyLen)) { return FALSE; } @@ -883,7 +883,7 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(CPDF_Dictionary* pEncryptDict, CPDF_Sec } return TRUE; } -FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher, FX_LPCBYTE key, int keylen) +FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher, const uint8_t* key, int keylen) { if (cipher == FXCIPHER_AES) { switch(keylen) { @@ -915,24 +915,24 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher, FX_LPCBYTE key, int keylen) } return TRUE; } -FX_BOOL CPDF_StandardCryptoHandler::DecryptStream(FX_LPVOID context, FX_LPCBYTE src_buf, FX_DWORD src_size, +FX_BOOL CPDF_StandardCryptoHandler::DecryptStream(void* context, const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { return CryptStream(context, src_buf, src_size, dest_buf, FALSE); } -FX_BOOL CPDF_StandardCryptoHandler::DecryptFinish(FX_LPVOID context, CFX_BinaryBuf& dest_buf) +FX_BOOL CPDF_StandardCryptoHandler::DecryptFinish(void* context, CFX_BinaryBuf& dest_buf) { return CryptFinish(context, dest_buf, FALSE); } -FX_DWORD CPDF_StandardCryptoHandler::EncryptGetSize(FX_DWORD objnum, FX_DWORD version, FX_LPCBYTE src_buf, FX_DWORD src_size) +FX_DWORD CPDF_StandardCryptoHandler::EncryptGetSize(FX_DWORD objnum, FX_DWORD version, const uint8_t* src_buf, FX_DWORD src_size) { if (m_Cipher == FXCIPHER_AES) { return src_size + 32; } return src_size; } -FX_BOOL CPDF_StandardCryptoHandler::EncryptContent(FX_DWORD objnum, FX_DWORD gennum, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPBYTE dest_buf, FX_DWORD& dest_size) +FX_BOOL CPDF_StandardCryptoHandler::EncryptContent(FX_DWORD objnum, FX_DWORD gennum, const uint8_t* src_buf, FX_DWORD src_size, + uint8_t* dest_buf, FX_DWORD& dest_size) { CryptBlock(TRUE, objnum, gennum, src_buf, src_size, dest_buf, dest_size); return TRUE; @@ -940,8 +940,8 @@ FX_BOOL CPDF_StandardCryptoHandler::EncryptContent(FX_DWORD objnum, FX_DWORD gen void CPDF_CryptoHandler::Decrypt(FX_DWORD objnum, FX_DWORD gennum, CFX_ByteString& str) { CFX_BinaryBuf dest_buf; - FX_LPVOID context = DecryptStart(objnum, gennum); - DecryptStream(context, (FX_LPCBYTE)str, str.GetLength(), dest_buf); + void* context = DecryptStart(objnum, gennum); + DecryptStream(context, (const uint8_t*)str, str.GetLength(), dest_buf); DecryptFinish(context, dest_buf); str = dest_buf; } diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp index 5bacfd7393..ceed675461 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp @@ -39,9 +39,9 @@ CFDF_Document* CFDF_Document::ParseFile(IFX_FileRead *pFile, FX_BOOL bOwnFile) } return pDoc; } -CFDF_Document* CFDF_Document::ParseMemory(FX_LPCBYTE pData, FX_DWORD size) +CFDF_Document* CFDF_Document::ParseMemory(const uint8_t* pData, FX_DWORD size) { - return CFDF_Document::ParseFile(FX_CreateMemoryStream((FX_LPBYTE)pData, size), TRUE); + return CFDF_Document::ParseFile(FX_CreateMemoryStream((uint8_t*)pData, size), TRUE); } void CFDF_Document::ParseStream(IFX_FileRead *pFile, FX_BOOL bOwnFile) { @@ -95,7 +95,7 @@ FX_BOOL CFDF_Document::WriteBuf(CFX_ByteTextBuf& buf) const while(pos) { size_t objnum; CPDF_Object* pObj; - m_IndirectObjs.GetNextAssoc(pos, (FX_LPVOID&)objnum, (FX_LPVOID&)pObj); + m_IndirectObjs.GetNextAssoc(pos, (void*&)objnum, (void*&)pObj); buf << (FX_DWORD)objnum << FX_BSTRC(" 0 obj\r\n") << pObj << FX_BSTRC("\r\nendobj\r\n\r\n"); } buf << FX_BSTRC("trailer\r\n<</Root ") << m_pRootDict->GetObjNum() << FX_BSTRC(" 0 R>>\r\n%%EOF\r\n"); @@ -113,7 +113,7 @@ CFX_WideString CFDF_Document::GetWin32Path() const } return FPDF_FileSpec_GetWin32Path(pFileSpec); } -static CFX_WideString ChangeSlash(FX_LPCWSTR str) +static CFX_WideString ChangeSlash(const FX_WCHAR* str) { CFX_WideString result; while (*str) { diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp index 8cb0cee82a..97e68b5c0c 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp @@ -29,7 +29,7 @@ void CFX_DataFilter::SetDestFilter(CFX_DataFilter* pFilter) m_pDestFilter = pFilter; } } -void CFX_DataFilter::FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) +void CFX_DataFilter::FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { if (m_bEOF) { return; @@ -199,7 +199,7 @@ CPDF_StreamFilter::~CPDF_StreamFilter() } } #define FPDF_FILTER_BUFFER_IN_SIZE FPDF_FILTER_BUFFER_SIZE -FX_DWORD CPDF_StreamFilter::ReadBlock(FX_LPBYTE buffer, FX_DWORD buf_size) +FX_DWORD CPDF_StreamFilter::ReadBlock(uint8_t* buffer, FX_DWORD buf_size) { if (m_pFilter == NULL) { FX_DWORD read_size = m_pStream->GetRawSize() - m_SrcOffset; @@ -249,7 +249,7 @@ FX_DWORD CPDF_StreamFilter::ReadBlock(FX_LPBYTE buffer, FX_DWORD buf_size) } return read_size + ReadLeftOver(buffer, buf_size); } -FX_DWORD CPDF_StreamFilter::ReadLeftOver(FX_LPBYTE buffer, FX_DWORD buf_size) +FX_DWORD CPDF_StreamFilter::ReadLeftOver(uint8_t* buffer, FX_DWORD buf_size) { FX_DWORD read_size = m_pBuffer->GetSize() - m_BufOffset; if (read_size > buf_size) { @@ -277,7 +277,7 @@ CPDF_DecryptFilter::~CPDF_DecryptFilter() m_pCryptoHandler->DecryptFinish(m_pContext, buf); } } -void CPDF_DecryptFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) +void CPDF_DecryptFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { if (m_pContext == NULL) { m_pContext = m_pCryptoHandler->DecryptStart(m_ObjNum, m_GenNum); @@ -320,7 +320,7 @@ CPDF_FlateFilter::~CPDF_FlateFilter() FPDFAPI_FlateEnd(m_pContext); } } -void CPDF_FlateFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) +void CPDF_FlateFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { if (m_pContext == NULL) { m_pContext = FPDFAPI_FlateInit(my_alloc_func, my_free_func); @@ -348,7 +348,7 @@ CPDF_LzwFilter::CPDF_LzwFilter(FX_BOOL bEarlyChange) m_LeftBits = 0; m_OldCode = (FX_DWORD) - 1; } -void CPDF_LzwFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) +void CPDF_LzwFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { for (FX_DWORD i = 0; i < src_size; i ++) { if (m_nLeftBits + 8 < m_CodeLen) { @@ -389,7 +389,7 @@ void CPDF_LzwFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_Binar DecodeString(code); } dest_buf.AppendBlock(NULL, m_StackLen); - FX_LPBYTE pOutput = dest_buf.GetBuffer() + dest_buf.GetSize() - m_StackLen; + uint8_t* pOutput = dest_buf.GetBuffer() + dest_buf.GetSize() - m_StackLen; for (FX_DWORD cc = 0; cc < m_StackLen; cc ++) { pOutput[cc] = m_DecodeStack[m_StackLen - cc - 1]; } @@ -475,7 +475,7 @@ static uint8_t PaethPredictor(int a, int b, int c) } return (uint8_t)c; } -static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, int Bpp) +static void PNG_PredictorLine(uint8_t* cur_buf, uint8_t* ref_buf, int pitch, int Bpp) { uint8_t tag = cur_buf[0]; if (tag == 0) { @@ -535,7 +535,7 @@ 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) +void CPDF_PredictorFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { if (m_pCurLine == NULL) { m_pCurLine = FX_Alloc(uint8_t, m_Pitch); @@ -564,7 +564,7 @@ void CPDF_PredictorFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX PNG_PredictorLine(m_pCurLine, m_iLine ? m_pRefLine : NULL, m_Pitch - 1, m_Bpp); dest_buf.AppendBlock(m_pCurLine + 1, m_Pitch - 1); m_iLine ++; - FX_LPBYTE temp = m_pCurLine; + uint8_t* temp = m_pCurLine; m_pCurLine = m_pRefLine; m_pRefLine = temp; } @@ -576,7 +576,7 @@ CPDF_Ascii85Filter::CPDF_Ascii85Filter() m_State = 0; m_CharCount = 0; } -void CPDF_Ascii85Filter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) +void CPDF_Ascii85Filter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { for (FX_DWORD i = 0; i < src_size; i ++) { uint8_t byte = src_buf[i]; @@ -635,7 +635,7 @@ CPDF_AsciiHexFilter::CPDF_AsciiHexFilter() { m_State = 0; } -void CPDF_AsciiHexFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) +void CPDF_AsciiHexFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { for (FX_DWORD i = 0; i < src_size; i ++) { uint8_t byte = src_buf[i]; @@ -670,7 +670,7 @@ CPDF_RunLenFilter::CPDF_RunLenFilter() m_State = 0; m_Count = 0; } -void CPDF_RunLenFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) +void CPDF_RunLenFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { for (FX_DWORD i = 0; i < src_size; i ++) { uint8_t byte = src_buf[i]; @@ -719,12 +719,12 @@ CPDF_JpegFilter::~CPDF_JpegFilter() CPDF_ModuleMgr::Get()->GetJpegModule()->Finish(m_pContext); } } -void CPDF_JpegFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) +void CPDF_JpegFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { if (m_pContext == NULL) { m_pContext = CPDF_ModuleMgr::Get()->GetJpegModule()->Start(); } - FX_LPCBYTE jpeg_src_buf; + const uint8_t* jpeg_src_buf; FX_DWORD jpeg_src_size; CFX_BinaryBuf temp_buf; if (m_InputBuf.GetSize()) { @@ -811,9 +811,9 @@ FX_BOOL CPDF_FaxFilter::Initialize(int Encoding, int bEndOfLine, int bByteAlign, m_InputBitPos = 0; return TRUE; } -void CPDF_FaxFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) +void CPDF_FaxFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) { - FX_LPCBYTE fax_src_buf; + const uint8_t* fax_src_buf; FX_DWORD fax_src_size; CFX_BinaryBuf temp_buf; int bitpos; @@ -840,9 +840,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 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, +FX_BOOL _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, const uint8_t* ref_buf, int columns); +FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, int columns); +void CPDF_FaxFilter::ProcessData(const uint8_t* src_buf, FX_DWORD src_size, int& bitpos, FX_BOOL bFinish, CFX_BinaryBuf& dest_buf) { int bitsize = src_size * 8; @@ -872,7 +872,7 @@ void CPDF_FaxFilter::ProcessData(FX_LPCBYTE src_buf, FX_DWORD src_size, int& bit } } } -FX_BOOL CPDF_FaxFilter::ReadLine(FX_LPCBYTE src_buf, int bitsize, int& bitpos) +FX_BOOL CPDF_FaxFilter::ReadLine(const uint8_t* src_buf, int bitsize, int& bitpos) { if (!_FaxSkipEOL(src_buf, bitsize, bitpos)) { return FALSE; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp index d636f96b68..5cc06e7929 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp @@ -51,7 +51,7 @@ CFX_ByteString CPDF_Object::GetString() const case PDFOBJ_NAME: return ((CPDF_Name*)this)->m_Name; case PDFOBJ_REFERENCE: { - CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this; + CPDF_Reference* pRef = (CPDF_Reference*)(void*)this; if (pRef->m_pObjList == NULL) { break; } @@ -68,11 +68,11 @@ CFX_ByteStringC CPDF_Object::GetConstString() const { switch (m_Type) { case PDFOBJ_STRING: - return CFX_ByteStringC((FX_LPCBYTE)((CPDF_String*)this)->m_String, ((CPDF_String*)this)->m_String.GetLength()); + return CFX_ByteStringC((const uint8_t*)((CPDF_String*)this)->m_String, ((CPDF_String*)this)->m_String.GetLength()); case PDFOBJ_NAME: - return CFX_ByteStringC((FX_LPCBYTE)((CPDF_Name*)this)->m_Name, ((CPDF_Name*)this)->m_Name.GetLength()); + return CFX_ByteStringC((const uint8_t*)((CPDF_Name*)this)->m_Name, ((CPDF_Name*)this)->m_Name.GetLength()); case PDFOBJ_REFERENCE: { - CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this; + CPDF_Reference* pRef = (CPDF_Reference*)(void*)this; if (pRef->m_pObjList == NULL) { break; } @@ -91,7 +91,7 @@ FX_FLOAT CPDF_Object::GetNumber() const case PDFOBJ_NUMBER: return ((CPDF_Number*)this)->GetNumber(); case PDFOBJ_REFERENCE: { - CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this; + CPDF_Reference* pRef = (CPDF_Reference*)(void*)this; if (pRef->m_pObjList == NULL) { break; } @@ -120,7 +120,7 @@ int CPDF_Object::GetInteger() const case PDFOBJ_NUMBER: return ((CPDF_Number*)this)->GetInteger(); case PDFOBJ_REFERENCE: { - CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this; + CPDF_Reference* pRef = (CPDF_Reference*)(void*)this; PARSE_CONTEXT context; FXSYS_memset32(&context, 0, sizeof(PARSE_CONTEXT)); if (pRef->m_pObjList == NULL) { @@ -233,7 +233,7 @@ CPDF_Object* CPDF_Object::GetDirect() const if (m_Type != PDFOBJ_REFERENCE) { return (CPDF_Object*)this; } - CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this; + CPDF_Reference* pRef = (CPDF_Reference*)(void*)this; if (pRef->m_pObjList == NULL) { return NULL; } @@ -331,13 +331,13 @@ CFX_WideString CPDF_Object::GetUnicodeText(CFX_CharMap* pCharMap) const } return CFX_WideString(); } -void CPDF_Object::SetUnicodeText(FX_LPCWSTR pUnicodes, int len) +void CPDF_Object::SetUnicodeText(const FX_WCHAR* pUnicodes, int len) { if (m_Type == PDFOBJ_STRING) { ((CPDF_String*)this)->m_String = PDF_EncodeText(pUnicodes, len); } else if (m_Type == PDFOBJ_STREAM) { CFX_ByteString result = PDF_EncodeText(pUnicodes, len); - ((CPDF_Stream*)this)->SetData((FX_LPBYTE)result.c_str(), result.GetLength(), FALSE, FALSE); + ((CPDF_Stream*)this)->SetData((uint8_t*)result.c_str(), result.GetLength(), FALSE, FALSE); } } @@ -570,7 +570,7 @@ CPDF_Dictionary::~CPDF_Dictionary() { FX_POSITION pos = m_Map.GetStartPosition(); while (pos) { - FX_LPVOID value = m_Map.GetNextValue(pos); + void* value = m_Map.GetNextValue(pos); if (value) ((CPDF_Object*)value)->Release(); } @@ -585,7 +585,7 @@ CPDF_Object* CPDF_Dictionary::GetNextElement(FX_POSITION& pos, CFX_ByteString& k return NULL; } CPDF_Object* p; - m_Map.GetNextAssoc(pos, key, (FX_LPVOID&)p); + m_Map.GetNextAssoc(pos, key, (void*&)p); return p; } CPDF_Object* CPDF_Dictionary::GetElement(FX_BSTR key) const @@ -736,7 +736,7 @@ CFX_AffineMatrix CPDF_Dictionary::GetMatrix(FX_BSTR key) const } FX_BOOL CPDF_Dictionary::KeyExist(FX_BSTR key) const { - FX_LPVOID value; + void* value; return m_Map.Lookup(key, value); } void CPDF_Dictionary::SetAt(FX_BSTR key, CPDF_Object* pObj, CPDF_IndirectObjects* pObjs) @@ -797,7 +797,7 @@ FX_BOOL CPDF_Dictionary::Identical(CPDF_Dictionary* pOther) const FX_POSITION pos = m_Map.GetStartPosition(); while (pos) { CFX_ByteString key; - FX_LPVOID value; + void* value; m_Map.GetNextAssoc(pos, key, value); if (!value) return FALSE; @@ -857,7 +857,7 @@ void CPDF_Dictionary::SetAtMatrix(FX_BSTR key, const CFX_AffineMatrix& matrix) pArray->AddNumber(matrix.f); SetAt(key, pArray); } -CPDF_Stream::CPDF_Stream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pDict) +CPDF_Stream::CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict) : CPDF_Object(PDFOBJ_STREAM) { m_pDict = pDict; m_dwSize = size; @@ -892,7 +892,7 @@ void CPDF_Stream::InitStream(CPDF_Dictionary* pDict) m_pCryptoHandler = NULL; m_FileOffset = 0; } -void CPDF_Stream::InitStream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pDict) +void CPDF_Stream::InitStream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict) { InitStream(pDict); m_GenNum = (FX_DWORD) - 1; @@ -905,7 +905,7 @@ void CPDF_Stream::InitStream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pD m_pDict->SetAtInteger(FX_BSTRC("Length"), size); } } -void CPDF_Stream::SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed, FX_BOOL bKeepBuf) +void CPDF_Stream::SetData(const uint8_t* pData, FX_DWORD size, FX_BOOL bCompressed, FX_BOOL bKeepBuf) { if (m_GenNum == (FX_DWORD) - 1) { if (m_pDataBuf) { @@ -916,7 +916,7 @@ void CPDF_Stream::SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed, m_pCryptoHandler = NULL; } if (bKeepBuf) { - m_pDataBuf = (FX_LPBYTE)pData; + m_pDataBuf = (uint8_t*)pData; } else { m_pDataBuf = FX_Alloc(uint8_t, size); if (pData) { @@ -933,7 +933,7 @@ void CPDF_Stream::SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed, m_pDict->RemoveAt(FX_BSTRC("DecodeParms")); } } -FX_BOOL CPDF_Stream::ReadRawData(FX_FILESIZE offset, FX_LPBYTE buf, FX_DWORD size) const +FX_BOOL CPDF_Stream::ReadRawData(FX_FILESIZE offset, uint8_t* buf, FX_DWORD size) const { if ((m_GenNum != (FX_DWORD) - 1) && m_pFile) { return m_pFile->ReadBlock(buf, m_FileOffset + offset, size); @@ -993,7 +993,7 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const } if (m_GenNum != (FX_DWORD) - 1 || pOther->m_GenNum != (FX_DWORD) - 1) { IFX_FileRead* pFile = NULL; - FX_LPBYTE pBuf = NULL; + uint8_t* pBuf = NULL; FX_DWORD offset = 0; if (m_GenNum != (FX_DWORD) - 1) { pFile = m_pFile; @@ -1024,7 +1024,7 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const } return FXSYS_memcmp32(m_pDataBuf, pOther->m_pDataBuf, m_dwSize) == 0; } -CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpfCallback, FX_LPVOID pUserData) const +CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpfCallback, void* pUserData) const { CPDF_Dictionary *pCloneDict = (CPDF_Dictionary*)m_pDict->Clone(bDirect); IFX_FileStream *pFS = NULL; @@ -1040,7 +1040,7 @@ CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpf CPDF_Stream* pObj = new CPDF_Stream(NULL, 0, NULL); CPDF_StreamFilter *pSF = GetStreamFilter(TRUE); if (pSF) { - FX_LPBYTE pBuf = FX_Alloc(uint8_t, 4096); + uint8_t* pBuf = FX_Alloc(uint8_t, 4096); FX_DWORD dwRead; do { dwRead = pSF->ReadBlock(pBuf, 4096); @@ -1055,8 +1055,8 @@ CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpf pObj->InitStream((IFX_FileRead*)pFS, pCloneDict); return pObj; } -extern FX_BOOL PDF_DataDecode(FX_LPCBYTE src_buf, FX_DWORD src_size, const CPDF_Dictionary* pDict, - FX_LPBYTE& dest_buf, FX_DWORD& dest_size, CFX_ByteString& ImageEncoding, +extern FX_BOOL PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF_Dictionary* pDict, + uint8_t*& dest_buf, FX_DWORD& dest_size, CFX_ByteString& ImageEncoding, CPDF_Dictionary*& pImageParms, FX_DWORD estimated_size, FX_BOOL bImageAcc); CPDF_StreamAcc::CPDF_StreamAcc() { @@ -1077,10 +1077,10 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, FX_BOOL bRawAccess, if (pStream->IsMemoryBased() && (!pStream->GetDict()->KeyExist(FX_BSTRC("Filter")) || bRawAccess)) { m_dwSize = pStream->m_dwSize; - m_pData = (FX_LPBYTE)pStream->m_pDataBuf; + m_pData = (uint8_t*)pStream->m_pDataBuf; return; } - FX_LPBYTE pSrcData; + uint8_t* pSrcData; FX_DWORD dwSrcSize = pStream->m_dwSize; if (dwSrcSize == 0) { return; @@ -1093,12 +1093,12 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, FX_BOOL bRawAccess, } else { pSrcData = pStream->m_pDataBuf; } - FX_LPBYTE pDecryptedData; + uint8_t* pDecryptedData; FX_DWORD dwDecryptedSize; if (pStream->m_pCryptoHandler) { CFX_BinaryBuf dest_buf; dest_buf.EstimateSize(pStream->m_pCryptoHandler->DecryptGetSize(dwSrcSize)); - FX_LPVOID context = pStream->m_pCryptoHandler->DecryptStart(pStream->GetObjNum(), pStream->m_GenNum); + void* context = pStream->m_pCryptoHandler->DecryptStart(pStream->GetObjNum(), pStream->m_GenNum); pStream->m_pCryptoHandler->DecryptStream(context, pSrcData, dwSrcSize, dest_buf); pStream->m_pCryptoHandler->DecryptFinish(context, dest_buf); pDecryptedData = dest_buf.GetBuffer(); @@ -1137,7 +1137,7 @@ CPDF_StreamAcc::~CPDF_StreamAcc() FX_Free(m_pSrcData); } } -FX_LPCBYTE CPDF_StreamAcc::GetData() const +const uint8_t* CPDF_StreamAcc::GetData() const { if (m_bNewBuf) { return m_pData; @@ -1157,15 +1157,15 @@ FX_DWORD CPDF_StreamAcc::GetSize() const } return m_pStream->m_dwSize; } -FX_LPBYTE CPDF_StreamAcc::DetachData() +uint8_t* CPDF_StreamAcc::DetachData() { if (m_bNewBuf) { - FX_LPBYTE p = m_pData; + uint8_t* p = m_pData; m_pData = NULL; m_dwSize = 0; return p; } - FX_LPBYTE p = FX_Alloc(uint8_t, m_dwSize); + uint8_t* p = FX_Alloc(uint8_t, m_dwSize); FXSYS_memcpy32(p, m_pData, m_dwSize); return p; } @@ -1188,7 +1188,8 @@ CPDF_IndirectObjects::~CPDF_IndirectObjects() { FX_POSITION pos = m_IndirectObjs.GetStartPosition(); while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_IndirectObjs.GetNextAssoc(pos, key, value); ((CPDF_Object*)value)->Destroy(); } @@ -1198,9 +1199,9 @@ CPDF_Object* CPDF_IndirectObjects::GetIndirectObject(FX_DWORD objnum, struct PAR if (objnum == 0) { return NULL; } - FX_LPVOID value; + void* value; { - if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { + if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) { if (((CPDF_Object*)value)->GetObjNum() == -1) { return NULL; } @@ -1218,18 +1219,18 @@ CPDF_Object* CPDF_IndirectObjects::GetIndirectObject(FX_DWORD objnum, struct PAR if (m_LastObjNum < objnum) { m_LastObjNum = objnum; } - if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { + if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) { if (value) { ((CPDF_Object *)value)->Destroy(); } } - m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)objnum, pObj); + m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); return pObj; } int CPDF_IndirectObjects::GetIndirectType(FX_DWORD objnum) { - FX_LPVOID value; - if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { + void* value; + if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) { return ((CPDF_Object*)value)->GetType(); } if (m_pParser) { @@ -1246,29 +1247,29 @@ FX_DWORD CPDF_IndirectObjects::AddIndirectObject(CPDF_Object* pObj) return pObj->m_ObjNum; } m_LastObjNum ++; - m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)m_LastObjNum, pObj); + m_IndirectObjs.SetAt((void*)(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)(uintptr_t)objnum, value)) { + void* value; + if (!m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) { return; } if (((CPDF_Object*)value)->GetObjNum() == -1) { return; } ((CPDF_Object*)value)->Destroy(); - m_IndirectObjs.RemoveKey((FX_LPVOID)(uintptr_t)objnum); + m_IndirectObjs.RemoveKey((void*)(uintptr_t)objnum); } void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pObj) { if (objnum == 0 || pObj == NULL) { return; } - FX_LPVOID value = NULL; - if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) { + void* value = NULL; + if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) { if (value) { if (pObj->GetGenNum() <= ((CPDF_Object*)value)->GetGenNum()) @@ -1278,7 +1279,7 @@ void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pO } } pObj->m_ObjNum = objnum; - m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)objnum, pObj); + m_IndirectObjs.SetAt((void*)(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 4afc3a668b..09c5c39e4f 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -88,7 +88,7 @@ void CPDF_Parser::CloseParser(FX_BOOL bReParse) } FX_POSITION pos = m_ObjectStreamMap.GetStartPosition(); while (pos) { - FX_LPVOID objnum; + void* objnum; CPDF_StreamAcc* pStream; m_ObjectStreamMap.GetNextAssoc(pos, objnum, (void*&)pStream); delete pStream; @@ -128,7 +128,7 @@ static int32_t GetHeaderOffset(IFX_FileRead* pFile) } return -1; } -FX_DWORD CPDF_Parser::StartParse(FX_LPCSTR filename, FX_BOOL bReParse) +FX_DWORD CPDF_Parser::StartParse(const FX_CHAR* filename, FX_BOOL bReParse) { IFX_FileRead* pFileAccess = FX_CreateFileRead(filename); if (!pFileAccess) { @@ -136,7 +136,7 @@ FX_DWORD CPDF_Parser::StartParse(FX_LPCSTR filename, FX_BOOL bReParse) } return StartParse(pFileAccess, bReParse); } -FX_DWORD CPDF_Parser::StartParse(FX_LPCWSTR filename, FX_BOOL bReParse) +FX_DWORD CPDF_Parser::StartParse(const FX_WCHAR* filename, FX_BOOL bReParse) { IFX_FileRead* pFileAccess = FX_CreateFileRead(filename); if (!pFileAccess) { @@ -183,7 +183,7 @@ FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse, FX FX_BOOL bXRefRebuilt = FALSE; if (m_Syntax.SearchWord(FX_BSTRC("startxref"), TRUE, FALSE, 4096)) { FX_FILESIZE startxref_offset = m_Syntax.SavePos(); - FX_LPVOID pResult = FXSYS_bsearch(&startxref_offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&startxref_offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_SortedOffset.Add(startxref_offset); } @@ -444,7 +444,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou { FX_FILESIZE dwStartPos = pos - m_Syntax.m_HeaderOffset; m_Syntax.RestorePos(dwStartPos); - FX_LPVOID pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_SortedOffset.Add(pos); } @@ -462,7 +462,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou FX_Free(pBuf); return FALSE; } - if (!m_Syntax.ReadBlock((FX_LPBYTE)pBuf, dwReadSize)) { + if (!m_Syntax.ReadBlock((uint8_t*)pBuf, dwReadSize)) { FX_Free(pBuf); return FALSE; } @@ -489,7 +489,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou } m_ObjVersion.SetAtGrow(objnum, version); if (m_CrossRef[objnum] < m_Syntax.m_FileLen) { - FX_LPVOID pResult = FXSYS_bsearch(&m_CrossRef[objnum], m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&m_CrossRef[objnum], m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_SortedOffset.Add(m_CrossRef[objnum]); } @@ -508,12 +508,12 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B if (m_Syntax.GetKeyword() != FX_BSTRC("xref")) { return FALSE; } - FX_LPVOID pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_SortedOffset.Add(pos); } if (streampos) { - FX_LPVOID pResult = FXSYS_bsearch(&streampos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&streampos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_SortedOffset.Add(streampos); } @@ -549,7 +549,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B FX_BOOL bFirstBlock = TRUE; 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); + m_Syntax.ReadBlock((uint8_t*)pBuf, block_size * recordsize); for (int32_t i = 0; i < block_size; i ++) { FX_DWORD objnum = start_objnum + block * 1024 + i; char* pEntry = pBuf + i * recordsize; @@ -585,7 +585,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B } m_ObjVersion.SetAtGrow(objnum, version); if (m_CrossRef[objnum] < m_Syntax.m_FileLen) { - FX_LPVOID pResult = FXSYS_bsearch(&m_CrossRef[objnum], m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&m_CrossRef[objnum], m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_SortedOffset.Add(m_CrossRef[objnum]); } @@ -634,7 +634,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() int32_t inside_index = 0; FX_DWORD objnum = 0, gennum = 0; int32_t depth = 0; - FX_LPBYTE buffer = FX_Alloc(uint8_t, 4096); + uint8_t* 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; @@ -780,7 +780,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() } FX_FILESIZE obj_pos = start_pos - m_Syntax.m_HeaderOffset; last_obj = start_pos; - FX_LPVOID pResult = FXSYS_bsearch(&obj_pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&obj_pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_SortedOffset.Add(obj_pos); } @@ -983,14 +983,14 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() last_trailer = m_Syntax.m_FileLen; } FX_FILESIZE offset = last_trailer - m_Syntax.m_HeaderOffset; - FX_LPVOID pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_SortedOffset.Add(offset); } FX_Free(buffer); return TRUE; } -static FX_DWORD _GetVarInt(FX_LPCBYTE p, int32_t n) +static FX_DWORD _GetVarInt(const uint8_t* p, int32_t n) { FX_DWORD result = 0; for (int32_t i = 0; i < n; i ++) { @@ -1071,7 +1071,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL FX_DWORD totalWidth = dwAccWidth.ValueOrDie(); CPDF_StreamAcc acc; acc.LoadAllData(pStream); - FX_LPCBYTE pData = acc.GetData(); + const uint8_t* pData = acc.GetData(); FX_DWORD dwTotalSize = acc.GetSize(); FX_DWORD segindex = 0; for (FX_DWORD i = 0; i < arrIndex.size(); i ++) { @@ -1087,7 +1087,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL if (!dwCaculatedSize.IsValid() || dwCaculatedSize.ValueOrDie() > dwTotalSize) { continue; } - FX_LPCBYTE segstart = pData + segindex * totalWidth; + const uint8_t* segstart = pData + segindex * totalWidth; FX_SAFE_DWORD dwMaxObjNum = startnum; dwMaxObjNum += count; FX_DWORD dwV5Size = pdfium::base::checked_cast<FX_DWORD, int32_t> (m_V5Type.GetSize()); @@ -1096,14 +1096,14 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL } for (FX_DWORD j = 0; j < count; j ++) { int32_t type = 1; - FX_LPCBYTE entrystart = segstart + j * totalWidth; + const uint8_t* entrystart = segstart + j * totalWidth; if (WidthArray[0]) { type = _GetVarInt(entrystart, WidthArray[0]); } if (m_V5Type[startnum + j] == 255) { FX_FILESIZE offset = _GetVarInt(entrystart + WidthArray[0], WidthArray[1]); m_CrossRef[startnum + j] = offset; - FX_LPVOID pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_SortedOffset.Add(offset); } @@ -1119,7 +1119,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL FX_FILESIZE offset = _GetVarInt(entrystart + WidthArray[0], WidthArray[1]); m_CrossRef[startnum + j] = offset; if (type == 1) { - FX_LPVOID pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_SortedOffset.Add(offset); } @@ -1181,7 +1181,7 @@ FX_BOOL CPDF_Parser::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) return TRUE; } FX_FILESIZE pos = m_CrossRef[objnum]; - FX_LPVOID pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { return TRUE; } @@ -1215,7 +1215,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX int32_t n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N")); int32_t offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First")); CPDF_SyntaxParser syntax; - CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream((FX_LPBYTE)pObjStream->GetData(), (size_t)pObjStream->GetSize(), FALSE)); + CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream((uint8_t*)pObjStream->GetData(), (size_t)pObjStream->GetSize(), FALSE)); syntax.InitParser(file.Get(), 0); CPDF_Object* pRet = NULL; while (n) { @@ -1260,7 +1260,7 @@ FX_FILESIZE CPDF_Parser::GetObjectSize(FX_DWORD objnum) if (offset == 0) { return 0; } - FX_LPVOID pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { return 0; } @@ -1271,7 +1271,7 @@ FX_FILESIZE CPDF_Parser::GetObjectSize(FX_DWORD objnum) } return 0; } -void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWORD& size) +void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD& size) { pBuffer = NULL; size = 0; @@ -1286,9 +1286,9 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR 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(); + const uint8_t* pData = pObjStream->GetData(); FX_DWORD totalsize = pObjStream->GetSize(); - CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream((FX_LPBYTE)pData, (size_t)totalsize, FALSE)); + CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream((uint8_t*)pData, (size_t)totalsize, FALSE)); syntax.InitParser(file.Get(), 0); while (n) { FX_DWORD thisnum = syntax.GetDirectNum(); @@ -1336,7 +1336,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR m_Syntax.RestorePos(SavedPos); return; } - FX_LPVOID pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { m_Syntax.RestorePos(SavedPos); return; @@ -1666,7 +1666,7 @@ FX_DWORD CPDF_Parser::LoadLinearizedMainXRefTable() m_LastXRefOffset += dwCount; FX_POSITION pos = m_ObjectStreamMap.GetStartPosition(); while (pos) { - FX_LPVOID objnum; + void* objnum; CPDF_StreamAcc* pStream; m_ObjectStreamMap.GetNextAssoc(pos, objnum, (void*&)pStream); delete pStream; @@ -1769,7 +1769,7 @@ FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch) ch = m_pFileBuf[pos - m_BufOffset]; return TRUE; } -FX_BOOL CPDF_SyntaxParser::ReadBlock(FX_LPBYTE pBuf, FX_DWORD size) +FX_BOOL CPDF_SyntaxParser::ReadBlock(uint8_t* pBuf, FX_DWORD size) { if (!m_pFileAccess->ReadBlock(pBuf, m_Pos + m_HeaderOffset, size)) { return FALSE; @@ -2051,12 +2051,12 @@ CFX_ByteString CPDF_SyntaxParser::GetNextWord(FX_BOOL& bIsNumber) { GetNextWord(); bIsNumber = m_bIsNumber; - return CFX_ByteString((FX_LPCSTR)m_WordBuffer, m_WordSize); + return CFX_ByteString((const FX_CHAR*)m_WordBuffer, m_WordSize); } CFX_ByteString CPDF_SyntaxParser::GetKeyword() { GetNextWord(); - return CFX_ByteString((FX_LPCSTR)m_WordBuffer, m_WordSize); + return CFX_ByteString((const FX_CHAR*)m_WordBuffer, m_WordSize); } CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWORD objnum, FX_DWORD gennum, PARSE_CONTEXT* pContext, FX_BOOL bDecrypt) { @@ -2481,12 +2481,12 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT m_Pos = StreamStartPos; } CPDF_Stream* pStream; - FX_LPBYTE pData = FX_Alloc(uint8_t, len); + uint8_t* pData = FX_Alloc(uint8_t, len); ReadBlock(pData, len); if (pCryptoHandler) { CFX_BinaryBuf dest_buf; dest_buf.EstimateSize(pCryptoHandler->DecryptGetSize(len)); - FX_LPVOID context = pCryptoHandler->DecryptStart(objnum, gennum); + void* context = pCryptoHandler->DecryptStart(objnum, gennum); pCryptoHandler->DecryptStream(context, pData, len, dest_buf); pCryptoHandler->DecryptFinish(context, dest_buf); FX_Free(pData); @@ -2526,9 +2526,9 @@ int32_t CPDF_SyntaxParser::GetDirectNum() return 0; } m_WordBuffer[m_WordSize] = 0; - return FXSYS_atoi((FX_LPCSTR)m_WordBuffer); + return FXSYS_atoi((const FX_CHAR*)m_WordBuffer); } -FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, FX_LPCBYTE tag, FX_DWORD taglen) +FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, const uint8_t* tag, FX_DWORD taglen) { uint8_t type = PDF_CharType[tag[0]]; FX_BOOL bCheckLeft = type != 'D' && type != 'W'; @@ -2560,7 +2560,7 @@ FX_BOOL CPDF_SyntaxParser::SearchWord(FX_BSTR tag, FX_BOOL bWholeWord, FX_BOOL b if (!bForward) { offset = taglen - 1; } - FX_LPCBYTE tag_data = tag.GetPtr(); + const uint8_t* tag_data = tag.GetPtr(); uint8_t byte; while (1) { if (bForward) { @@ -2616,7 +2616,7 @@ FX_BOOL CPDF_SyntaxParser::SearchWord(FX_BSTR tag, FX_BOOL bWholeWord, FX_BOOL b return FALSE; } struct _SearchTagRecord { - FX_LPCBYTE m_pTag; + const uint8_t* m_pTag; FX_DWORD m_Len; FX_DWORD m_Offset; }; @@ -2771,7 +2771,7 @@ protected: FX_BOOL CheckAllCrossRefStream(IFX_DownloadHints *pHints); int32_t CheckCrossRefStream(IFX_DownloadHints *pHints, FX_FILESIZE &xref_offset); - FX_BOOL IsLinearizedFile(FX_LPBYTE pData, FX_DWORD dwLen); + FX_BOOL IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen); void SetStartOffset(FX_FILESIZE dwOffset); FX_BOOL GetNextToken(CFX_ByteString &token); FX_BOOL GetNextChar(uint8_t &ch); @@ -3021,7 +3021,7 @@ FX_DWORD CPDF_DataAvail::GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset) if (offset == 0) { return 0; } - FX_LPVOID pResult = FXSYS_bsearch(&offset, pParser->m_SortedOffset.GetData(), pParser->m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); + void* pResult = FXSYS_bsearch(&offset, pParser->m_SortedOffset.GetData(), pParser->m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize); if (pResult == NULL) { return 0; } @@ -3710,7 +3710,7 @@ int32_t CPDF_DataAvail::IsLinearizedPDF() } return PDF_NOT_LINEARIZED; } -FX_BOOL CPDF_DataAvail::IsLinearizedFile(FX_LPBYTE pData, FX_DWORD dwLen) +FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen) { CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pData, (size_t)dwLen, FALSE)); int32_t offset = GetHeaderOffset(file.Get()); @@ -3794,7 +3794,7 @@ int32_t CPDF_DataAvail::CheckCrossRefStream(IFX_DownloadHints* pHints, FX_FILESI if (m_pFileAvail->IsDataAvail(m_Pos, req_size)) { int32_t iSize = (int32_t)(m_Pos + req_size - m_dwCurrentXRefSteam); CFX_BinaryBuf buf(iSize); - FX_LPBYTE pBuf = buf.GetBuffer(); + uint8_t* pBuf = buf.GetBuffer(); m_pFileRead->ReadBlock(pBuf, m_dwCurrentXRefSteam, iSize); CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pBuf, (size_t)iSize, FALSE)); m_parser.m_Syntax.InitParser(file.Get(), 0); @@ -4032,7 +4032,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints) if (m_pFileAvail->IsDataAvail(m_Pos, iTrailerSize)) { int32_t iSize = (int32_t)(m_Pos + iTrailerSize - m_dwTrailerOffset); CFX_BinaryBuf buf(iSize); - FX_LPBYTE pBuf = buf.GetBuffer(); + uint8_t* pBuf = buf.GetBuffer(); if (!pBuf) { m_docStatus = PDF_DATAAVAIL_ERROR; return FALSE; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp index b02139db0f..e6474550a2 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp @@ -43,7 +43,7 @@ const char PDF_CharType[256] = { #ifndef MAX_PATH #define MAX_PATH 4096 #endif -CPDF_SimpleParser::CPDF_SimpleParser(FX_LPCBYTE pData, FX_DWORD dwSize) +CPDF_SimpleParser::CPDF_SimpleParser(const uint8_t* pData, FX_DWORD dwSize) { m_pData = pData; m_dwSize = dwSize; @@ -55,7 +55,7 @@ CPDF_SimpleParser::CPDF_SimpleParser(FX_BSTR str) m_dwSize = str.GetLength(); m_dwCurPos = 0; } -void CPDF_SimpleParser::ParseWord(FX_LPCBYTE& pStart, FX_DWORD& dwSize, int& type) +void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, FX_DWORD& dwSize, int& type) { pStart = NULL; dwSize = 0; @@ -153,7 +153,7 @@ void CPDF_SimpleParser::ParseWord(FX_LPCBYTE& pStart, FX_DWORD& dwSize, int& typ } CFX_ByteStringC CPDF_SimpleParser::GetWord() { - FX_LPCBYTE pStart; + const uint8_t* pStart; FX_DWORD dwSize; int type; ParseWord(pStart, dwSize, type); @@ -290,13 +290,13 @@ static int _hex2dec(char ch) CFX_ByteString PDF_NameDecode(FX_BSTR bstr) { int size = bstr.GetLength(); - FX_LPCSTR pSrc = bstr.GetCStr(); + const FX_CHAR* pSrc = bstr.GetCStr(); if (FXSYS_memchr(pSrc, '#', size) == NULL) { return bstr; } CFX_ByteString result; - FX_LPSTR pDestStart = result.GetBuffer(size); - FX_LPSTR pDest = pDestStart; + FX_CHAR* pDestStart = result.GetBuffer(size); + FX_CHAR* pDest = pDestStart; for (int i = 0; i < size; i ++) { if (pSrc[i] == '#' && i < size - 2) { *pDest ++ = _hex2dec(pSrc[i + 1]) * 16 + _hex2dec(pSrc[i + 2]); @@ -317,7 +317,7 @@ CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig) } CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) { - FX_LPBYTE src_buf = (FX_LPBYTE)orig.c_str(); + uint8_t* src_buf = (uint8_t*)orig.c_str(); int src_len = orig.GetLength(); int dest_len = 0; int i; @@ -334,7 +334,7 @@ CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) return orig; } CFX_ByteString res; - FX_LPSTR dest_buf = res.GetBuffer(dest_len); + FX_CHAR* dest_buf = res.GetBuffer(dest_len); dest_len = 0; for (i = 0; i < src_len; i ++) { uint8_t ch = src_buf[i]; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp index d22bd4b760..46f1640793 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp @@ -29,7 +29,8 @@ void CPDF_PageRenderCache::ClearAll() { FX_POSITION pos = m_ImageCaches.GetStartPosition(); while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_ImageCaches.GetNextAssoc(pos, key, value); delete (CPDF_ImageCache*)value; } @@ -47,7 +48,8 @@ void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) FX_POSITION pos = m_ImageCaches.GetStartPosition(); int i = 0; while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_ImageCaches.GetNextAssoc(pos, key, value); pCACHEINFO[i].time = ((CPDF_ImageCache*)value)->GetTimeCount(); pCACHEINFO[i++].pStream = ((CPDF_ImageCache*)value)->GetStream(); @@ -72,7 +74,7 @@ void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) } void CPDF_PageRenderCache::ClearImageCache(CPDF_Stream* pStream) { - FX_LPVOID value = m_ImageCaches.GetValueAt(pStream); + void* value = m_ImageCaches.GetValueAt(pStream); if (value == NULL) { m_ImageCaches.RemoveKey(pStream); return; @@ -86,7 +88,8 @@ FX_DWORD CPDF_PageRenderCache::EstimateSize() FX_DWORD dwSize = 0; FX_POSITION pos = m_ImageCaches.GetStartPosition(); while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_ImageCaches.GetNextAssoc(pos, key, value); dwSize += ((CPDF_ImageCache*)value)->EstimateSize(); } @@ -99,7 +102,7 @@ FX_DWORD CPDF_PageRenderCache::GetCachedSize(CPDF_Stream* pStream) const return m_nCacheSize; } CPDF_ImageCache* pImageCache; - if (!m_ImageCaches.Lookup(pStream, (FX_LPVOID&)pImageCache)) { + if (!m_ImageCaches.Lookup(pStream, (void*&)pImageCache)) { return 0; } return pImageCache->EstimateSize(); @@ -109,7 +112,7 @@ void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*& int32_t downsampleWidth, int32_t downsampleHeight) { CPDF_ImageCache* pImageCache; - FX_BOOL bFind = m_ImageCaches.Lookup(pStream, (FX_LPVOID&)pImageCache); + FX_BOOL bFind = m_ImageCaches.Lookup(pStream, (void*&)pImageCache); if (!bFind) { pImageCache = new CPDF_ImageCache(m_pPage->m_pDocument, pStream); } @@ -124,7 +127,7 @@ void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*& } 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); + m_bCurFindCache = m_ImageCaches.Lookup(pStream, (void*&)m_pCurImageCache); if (!m_bCurFindCache) { m_pCurImageCache = new CPDF_ImageCache(m_pPage->m_pDocument, pStream); } @@ -159,7 +162,7 @@ FX_BOOL CPDF_PageRenderCache::Continue(IFX_Pause* pPause) void CPDF_PageRenderCache::ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap) { CPDF_ImageCache* pImageCache; - if (!m_ImageCaches.Lookup(pStream, (FX_LPVOID&)pImageCache)) { + if (!m_ImageCaches.Lookup(pStream, (void*&)pImageCache)) { if (pBitmap == NULL) { return; } @@ -209,7 +212,8 @@ void CPDF_PageRenderCache::ClearImageData() { FX_POSITION pos = m_ImageCaches.GetStartPosition(); while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_ImageCaches.GetNextAssoc(pos, key, value); ((CPDF_ImageCache*)value)->ClearImageData(); } diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp index 699f84830f..669ba4da49 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -141,7 +141,7 @@ CPDF_DIBTransferFunc::CPDF_DIBTransferFunc(const CPDF_TransferFunc* pTransferFun m_RampG = &pTransferFunc->m_Samples[256]; m_RampB = &pTransferFunc->m_Samples[512]; } -void CPDF_DIBTransferFunc::TranslateScanline(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf) const +void CPDF_DIBTransferFunc::TranslateScanline(uint8_t* dest_buf, const uint8_t* src_buf) const { int i; FX_BOOL bSkip = FALSE; @@ -234,7 +234,7 @@ void CPDF_DIBTransferFunc::TranslateScanline(FX_LPBYTE dest_buf, FX_LPCBYTE src_ break; } } -void CPDF_DIBTransferFunc::TranslateDownSamples(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf, int pixels, int Bpp) const +void CPDF_DIBTransferFunc::TranslateDownSamples(uint8_t* dest_buf, const uint8_t* src_buf, int pixels, int Bpp) const { if (Bpp == 8) { for (int i = 0; i < pixels; i ++) { @@ -519,8 +519,8 @@ FX_BOOL CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) int matte_g = FXARGB_G(m_Loader.m_MatteColor); int matte_b = FXARGB_B(m_Loader.m_MatteColor); for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = (FX_LPBYTE)bitmap_device1.GetBitmap()->GetScanline(row); - FX_LPCBYTE mask_scan = bitmap_device2.GetBitmap()->GetScanline(row); + uint8_t* dest_scan = (uint8_t*)bitmap_device1.GetBitmap()->GetScanline(row); + const uint8_t* mask_scan = bitmap_device2.GetBitmap()->GetScanline(row); for (int col = 0; col < width; col ++) { int alpha = *mask_scan ++; if (alpha) { @@ -606,8 +606,8 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() int matte_g = FXARGB_G(m_Loader.m_MatteColor); int matte_b = FXARGB_B(m_Loader.m_MatteColor); for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = (FX_LPBYTE)bitmap_device1.GetBitmap()->GetScanline(row); - FX_LPCBYTE mask_scan = bitmap_device2.GetBitmap()->GetScanline(row); + uint8_t* dest_scan = (uint8_t*)bitmap_device1.GetBitmap()->GetScanline(row); + const uint8_t* mask_scan = bitmap_device2.GetBitmap()->GetScanline(row); for (int col = 0; col < width; col ++) { int alpha = *mask_scan ++; if (alpha) { @@ -823,7 +823,7 @@ CPDF_QuickStretcher::~CPDF_QuickStretcher() delete m_pDecoder; } } -ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, const CPDF_Dictionary* pParams); FX_BOOL CPDF_QuickStretcher::Start(CPDF_ImageObject* pImageObj, CFX_AffineMatrix* pImage2Device, const FX_RECT* pClipBox) { @@ -903,7 +903,7 @@ FX_BOOL CPDF_QuickStretcher::Start(CPDF_ImageObject* pImageObj, CFX_AffineMatrix } FX_BOOL CPDF_QuickStretcher::Continue(IFX_Pause* pPause) { - FX_LPBYTE result_buf = m_pBitmap->GetBuffer(); + uint8_t* result_buf = m_pBitmap->GetBuffer(); int src_width = m_pDecoder ? m_pDecoder->GetWidth() : m_SrcWidth; int src_height = m_pDecoder ? m_pDecoder->GetHeight() : m_SrcHeight; int src_pitch = src_width * m_Bpp; @@ -916,7 +916,7 @@ FX_BOOL CPDF_QuickStretcher::Continue(IFX_Pause* pPause) dest_y = m_LineIndex; src_y = (dest_y + m_ClipTop) * src_height / m_DestHeight; } - FX_LPCBYTE src_scan; + const uint8_t* src_scan; if (m_pDecoder) { src_scan = m_pDecoder->GetScanline(src_y); if (src_scan == NULL) { @@ -929,11 +929,11 @@ FX_BOOL CPDF_QuickStretcher::Continue(IFX_Pause* pPause) } src_scan += src_y * src_pitch; } - FX_LPBYTE result_scan = result_buf + dest_y * m_pBitmap->GetPitch(); + uint8_t* result_scan = result_buf + dest_y * m_pBitmap->GetPitch(); for (int x = 0; x < m_ResultWidth; x ++) { int dest_x = m_ClipLeft + x; int src_x = (m_bFlipX ? (m_DestWidth - dest_x - 1) : dest_x) * src_width / m_DestWidth; - FX_LPCBYTE src_pixel = src_scan + src_x * m_Bpp; + const uint8_t* src_pixel = src_scan + src_x * m_Bpp; if (m_pCS == NULL) { *result_scan = src_pixel[2]; result_scan ++; @@ -1049,11 +1049,11 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, delete pMask; return NULL; } - FX_LPBYTE dest_buf = pMask->GetBuffer(); + uint8_t* dest_buf = pMask->GetBuffer(); int dest_pitch = pMask->GetPitch(); - FX_LPBYTE src_buf = bitmap.GetBuffer(); + uint8_t* src_buf = bitmap.GetBuffer(); int src_pitch = bitmap.GetPitch(); - FX_LPBYTE pTransfer = FX_Alloc(uint8_t, 256); + uint8_t* pTransfer = FX_Alloc(uint8_t, 256); if (pFunc) { CFX_FixedBufGrow<FX_FLOAT, 16> results(pFunc->CountOutputs()); for (int i = 0; i < 256; i ++) { @@ -1070,8 +1070,8 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, if (bLuminosity) { int Bpp = bitmap.GetBPP() / 8; for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_pos = dest_buf + row * dest_pitch; - FX_LPBYTE src_pos = src_buf + row * src_pitch; + uint8_t* dest_pos = dest_buf + row * dest_pitch; + uint8_t* src_pos = src_buf + row * src_pitch; for (int col = 0; col < width; col ++) { *dest_pos ++ = pTransfer[FXRGB2GRAY(src_pos[2], src_pos[1], *src_pos)]; src_pos += Bpp; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index d45cc1151f..2cbe2e8eb6 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -16,7 +16,7 @@ namespace { -unsigned int _GetBits8(FX_LPCBYTE pData, int bitpos, int nbits) +unsigned int _GetBits8(const uint8_t* pData, int bitpos, int nbits) { unsigned int byte = pData[bitpos / 8]; if (nbits == 8) { @@ -584,9 +584,9 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, FX } return pCompData; } -ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, const CPDF_Dictionary* pParams); -ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, const CPDF_Dictionary* pParams); int CPDF_DIBSource::CreateDecoder() { @@ -597,7 +597,7 @@ int CPDF_DIBSource::CreateDecoder() if (m_bDoBpcCheck && m_bpc == 0) { return 0; } - FX_LPCBYTE src_data = m_pStreamAcc->GetData(); + const uint8_t* src_data = m_pStreamAcc->GetData(); FX_DWORD src_size = m_pStreamAcc->GetSize(); const CPDF_Dictionary* pParams = m_pStreamAcc->GetImageParam(); if (decoder == FX_BSTRC("CCITTFaxDecode")) { @@ -750,7 +750,7 @@ void CPDF_DIBSource::LoadJpxBitmap() m_bpc < 8) { int scale = 8 - m_bpc; for (FX_DWORD row = 0; row < height; ++row) { - FX_LPBYTE scanline = (FX_LPBYTE)m_pCachedBitmap->GetScanline(row); + uint8_t* scanline = (uint8_t*)m_pCachedBitmap->GetScanline(row); for (FX_DWORD col = 0; col < width; ++col) { *scanline = (*scanline) >> scale; ++scanline; @@ -960,7 +960,7 @@ void CPDF_DIBSource::ValidateDictParam() } } #define NORMALCOLOR_MAX(color, max) (color) > (max) ? (max) : (color) < 0 ? 0 : (color); -void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan) const +void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan, const uint8_t* src_scan) const { if (m_bpc == 0) { return; @@ -968,7 +968,7 @@ void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_ int max_data = (1 << m_bpc) - 1; if (m_bDefaultDecode) { if (m_Family == PDFCS_DEVICERGB || m_Family == PDFCS_CALRGB) { - FX_LPCBYTE src_pos = src_scan; + const uint8_t* src_pos = src_scan; switch (m_bpc) { case 16: for (int col = 0; col < m_Width; col ++) { @@ -1070,14 +1070,14 @@ void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_ } } } -FX_LPBYTE CPDF_DIBSource::GetBuffer() const +uint8_t* CPDF_DIBSource::GetBuffer() const { if (m_pCachedBitmap) { return m_pCachedBitmap->GetBuffer(); } return NULL; } -FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const +const uint8_t* CPDF_DIBSource::GetScanline(int line) const { if (m_bpc == 0) { return NULL; @@ -1086,7 +1086,7 @@ FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const if (!src_pitch.IsValid()) return NULL; FX_DWORD src_pitch_value = src_pitch.ValueOrDie(); - FX_LPCBYTE pSrcLine = NULL; + const uint8_t* pSrcLine = NULL; if (m_pCachedBitmap) { if (line >= m_pCachedBitmap->GetHeight()) { line = m_pCachedBitmap->GetHeight() - 1; @@ -1100,7 +1100,7 @@ FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const } } if (pSrcLine == NULL) { - FX_LPBYTE pLineBuf = m_pMaskedLine ? m_pMaskedLine : m_pLineBuf; + uint8_t* pLineBuf = m_pMaskedLine ? m_pMaskedLine : m_pLineBuf; FXSYS_memset8(pLineBuf, 0xff, m_Pitch); return pLineBuf; } @@ -1152,8 +1152,8 @@ FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const } } if (m_bColorKey) { - FX_LPBYTE pDestPixel = m_pMaskedLine; - FX_LPCBYTE pSrcPixel = m_pLineBuf; + uint8_t* pDestPixel = m_pMaskedLine; + const uint8_t* pSrcPixel = m_pLineBuf; for (int col = 0; col < m_Width; col ++) { uint8_t index = *pSrcPixel++; if (m_pPalette) { @@ -1174,9 +1174,9 @@ FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const } if (m_bColorKey) { if (m_nComponents == 3 && m_bpc == 8) { - FX_LPBYTE alpha_channel = m_pMaskedLine + 3; + uint8_t* alpha_channel = m_pMaskedLine + 3; for (int col = 0; col < m_Width; col ++) { - FX_LPCBYTE pPixel = pSrcLine + col * 3; + const uint8_t* pPixel = pSrcLine + col * 3; alpha_channel[col * 4] = (pPixel[0] < m_pCompData[0].m_ColorKeyMin || pPixel[0] > m_pCompData[0].m_ColorKeyMax || pPixel[1] < m_pCompData[1].m_ColorKeyMin || pPixel[1] > m_pCompData[1].m_ColorKeyMax || pPixel[2] < m_pCompData[2].m_ColorKeyMin || pPixel[2] > m_pCompData[2].m_ColorKeyMax) ? 0xff : 0; @@ -1190,8 +1190,8 @@ FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const pSrcLine = m_pLineBuf; } if (m_bColorKey) { - FX_LPCBYTE pSrcPixel = pSrcLine; - FX_LPBYTE pDestPixel = m_pMaskedLine; + const uint8_t* pSrcPixel = pSrcLine; + uint8_t* pDestPixel = m_pMaskedLine; for (int col = 0; col < m_Width; col ++) { *pDestPixel++ = *pSrcPixel++; *pDestPixel++ = *pSrcPixel++; @@ -1209,7 +1209,7 @@ FX_BOOL CPDF_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const } return FALSE; } -void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_bpp, +void CPDF_DIBSource::DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const { if (line < 0 || dest_scan == NULL || dest_bpp <= 0 || @@ -1223,7 +1223,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ return; } - FX_LPCBYTE pSrcLine = NULL; + const uint8_t* pSrcLine = NULL; if (m_pCachedBitmap) { pSrcLine = m_pCachedBitmap->GetScanline(line); } else if (m_pDecoder) { @@ -1344,7 +1344,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_LPBYTE pDestPixel = dest_scan + i * 4; + uint8_t* pDestPixel = dest_scan + i * 4; uint8_t index = pSrcLine[src_x]; if (m_pPalette) { *pDestPixel++ = FXARGB_B(m_pPalette[index]); @@ -1386,13 +1386,13 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ int dest_x = clip_left + i; 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; + const uint8_t* pSrcPixel = NULL; if (m_bpc % 8 == 0) { pSrcPixel = pSrcLine + src_x * orig_Bpp; } else { pSrcPixel = pSrcLine + (int)(src_x * orig_Not8Bpp); } - FX_LPBYTE pDestPixel = dest_scan + i * dest_Bpp; + uint8_t* pDestPixel = dest_scan + i * dest_Bpp; FX_ARGB argb; if (src_x == last_src_x) { argb = last_argb; @@ -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, int32_t nDownsampleWidth, int32_t nDownsampleHeight) +FX_BOOL CPDF_ImageLoader::StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, void*& 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; @@ -1545,7 +1545,7 @@ FX_BOOL CPDF_ImageLoader::StartLoadImage(const CPDF_ImageObject* pImage, CPDF_Pa LoadHandle = pLoaderHandle; return ret; } -FX_BOOL CPDF_ImageLoader::Continue(FX_LPVOID LoadHandle, IFX_Pause* pPause) +FX_BOOL CPDF_ImageLoader::Continue(void* LoadHandle, IFX_Pause* pPause) { return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause); } diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index e02cd421ff..2243bff979 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -357,7 +357,7 @@ static void _DrawGouraud(CFX_DIBitmap* pBitmap, int alpha, CPDF_MeshVertex trian if (end_x > pBitmap->GetWidth()) { end_x = pBitmap->GetWidth(); } - FX_LPBYTE dib_buf = pBitmap->GetBuffer() + y * pBitmap->GetPitch() + start_x * 4; + uint8_t* dib_buf = pBitmap->GetBuffer() + y * pBitmap->GetPitch() + start_x * 4; FX_FLOAT r_unit = (r[end_index] - r[start_index]) / (max_x - min_x); FX_FLOAT g_unit = (g[end_index] - g[start_index]) / (max_x - min_x); FX_FLOAT b_unit = (b[end_index] - b[start_index]) / (max_x - min_x); @@ -1066,7 +1066,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, CPDF_Pag if (pPattern->m_bColored) { *dest_buf = *src_buf; } else { - *dest_buf = (*(FX_LPBYTE)src_buf << 24) | (fill_argb & 0xffffff); + *dest_buf = (*(uint8_t*)src_buf << 24) | (fill_argb & 0xffffff); } } else { if (pPattern->m_bColored) { diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp index 410e78a67b..e8ef861ba1 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -33,17 +33,17 @@ 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)(uintptr_t)charcode, (void*&)pGlyphBitmap)) { + if(pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)charcode, (void*&)pGlyphBitmap)) { return pGlyphBitmap; } pGlyphBitmap = RenderGlyph(pSizeCache, charcode, pMatrix, retinaScaleX, retinaScaleY); - pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)charcode, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)charcode, pGlyphBitmap); return pGlyphBitmap; } CPDF_Type3Glyphs::~CPDF_Type3Glyphs() { FX_POSITION pos = m_GlyphMap.GetStartPosition(); - FX_LPVOID Key; + void* Key; CFX_GlyphBitmap* pGlyphBitmap; while(pos) { m_GlyphMap.GetNextAssoc(pos, Key, (void*&)pGlyphBitmap); @@ -76,7 +76,7 @@ void CPDF_Type3Glyphs::AdjustBlue(FX_FLOAT top, FX_FLOAT bottom, int& top_line, top_line = _AdjustBlue(top, m_TopBlueCount, m_TopBlue); bottom_line = _AdjustBlue(bottom, m_BottomBlueCount, m_BottomBlue); } -static FX_BOOL _IsScanLine1bpp(FX_LPBYTE pBuf, int width) +static FX_BOOL _IsScanLine1bpp(uint8_t* pBuf, int width) { int size = width / 8; for (int i = 0; i < size; i ++) @@ -89,7 +89,7 @@ static FX_BOOL _IsScanLine1bpp(FX_LPBYTE pBuf, int width) } return FALSE; } -static FX_BOOL _IsScanLine8bpp(FX_LPBYTE pBuf, int width) +static FX_BOOL _IsScanLine8bpp(uint8_t* pBuf, int width) { for (int i = 0; i < width; i ++) if (pBuf[i] > 0x40) { @@ -104,7 +104,7 @@ static int _DetectFirstLastScan(const CFX_DIBitmap* pBitmap, FX_BOOL bFirst) if (bpp > 8) { width *= bpp / 8; } - FX_LPBYTE pBuf = pBitmap->GetBuffer(); + uint8_t* pBuf = pBitmap->GetBuffer(); int line = bFirst ? 0 : height - 1; int line_step = bFirst ? 1 : -1; int line_end = bFirst ? height : -1; @@ -564,7 +564,7 @@ void CPDF_CharPosList::Load(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pCharPos charpos.m_OriginX -= FontSize * vx / 1000; charpos.m_OriginY -= FontSize * vy / 1000; } - FX_LPCBYTE pTransform = pCIDFont->GetCIDTransform(CID); + const uint8_t* pTransform = pCIDFont->GetCIDTransform(CID); if (pTransform && !bVert) { charpos.m_AdjustMatrix[0] = _CIDTransformToFloat(pTransform[0]); charpos.m_AdjustMatrix[2] = _CIDTransformToFloat(pTransform[2]); diff --git a/core/src/fpdfapi/fpdf_render/render_int.h b/core/src/fpdfapi/fpdf_render/render_int.h index 0b6873409b..8d40b17f85 100644 --- a/core/src/fpdfapi/fpdf_render/render_int.h +++ b/core/src/fpdfapi/fpdf_render/render_int.h @@ -197,8 +197,8 @@ 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, int32_t nDownsampleWidth = 0, int32_t nDownsampleHeight = 0); - FX_BOOL Continue(FX_LPVOID LoadHandle, IFX_Pause* pPause); + FX_BOOL StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, void*& 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(void* LoadHandle, IFX_Pause* pPause); ~CPDF_ImageLoader(); CFX_DIBSource* m_pBitmap; CFX_DIBSource* m_pMask; @@ -250,8 +250,8 @@ protected: CPDF_QuickStretcher* m_pQuickStretcher; CFX_ImageTransformer* m_pTransformer; CPDF_ImageRenderer* m_pRenderer2; - FX_LPVOID m_DeviceHandle; - FX_LPVOID m_LoadHandle; + void* m_DeviceHandle; + void* m_LoadHandle; FX_BOOL m_bStdCS; int m_BlendType; FX_BOOL StartBitmapAlpha(); @@ -390,9 +390,9 @@ public: CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE); virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const; - virtual FX_LPBYTE GetBuffer() const; - virtual FX_LPCBYTE GetScanline(int line) const; - virtual void DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_bpp, + virtual uint8_t* GetBuffer() const; + virtual const uint8_t* GetScanline(int line) const; + virtual void DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const; virtual void SetDownSampleSize(int dest_width, int dest_height) const; CFX_DIBitmap* GetBitmap() const; @@ -410,7 +410,7 @@ public: CPDF_DIBSource* DetachMask(); CPDF_DIBSource* m_pMask; FX_DWORD m_MatteColor; - FX_LPVOID m_pJbig2Context; + void* m_pJbig2Context; CPDF_StreamAcc* m_pGlobalStream; FX_BOOL m_bStdCS; int m_Status; @@ -424,7 +424,7 @@ protected: void LoadJpxBitmap(); void LoadPalette(); int CreateDecoder(); - void TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan) const; + void TranslateScanline24bpp(uint8_t* dest_scan, const uint8_t* src_scan) const; void ValidateDictParam(); CPDF_Document* m_pDocument; const CPDF_Stream* m_pStream; @@ -442,8 +442,8 @@ protected: FX_BOOL m_bDoBpcCheck; FX_BOOL m_bColorKey; DIB_COMP_DATA* m_pCompData; - FX_LPBYTE m_pLineBuf; - FX_LPBYTE m_pMaskedLine; + uint8_t* m_pLineBuf; + uint8_t* m_pMaskedLine; nonstd::unique_ptr<CFX_DIBitmap> m_pCachedBitmap; ICodec_ScanlineDecoder* m_pDecoder; }; @@ -457,11 +457,11 @@ public: { return NULL; } - virtual void TranslateScanline(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf) const; - virtual void TranslateDownSamples(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf, int pixels, int Bpp) const; - FX_LPCBYTE m_RampR; - FX_LPCBYTE m_RampG; - FX_LPCBYTE m_RampB; + virtual void TranslateScanline(uint8_t* dest_buf, const uint8_t* src_buf) const; + virtual void TranslateDownSamples(uint8_t* dest_buf, const uint8_t* src_buf, int pixels, int Bpp) const; + const uint8_t* m_RampR; + const uint8_t* m_RampG; + const uint8_t* m_RampB; }; struct _CPDF_UniqueKeyGen { void Generate(int count, ...); diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp index ef6c34701b..a72285c478 100644 --- a/core/src/fpdfdoc/doc_annot.cpp +++ b/core/src/fpdfdoc/doc_annot.cpp @@ -129,7 +129,7 @@ void CPDF_AnnotList::DisplayAnnots(const CPDF_Page* pPage, CFX_RenderDevice* pDe int CPDF_AnnotList::GetIndex(CPDF_Annot* pAnnot) { for (int i = 0; i < m_AnnotList.GetSize(); ++i) - if (m_AnnotList[i] == (FX_LPVOID)pAnnot) { + if (m_AnnotList[i] == (void*)pAnnot) { return i; } return -1; diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp index dfa2e6718a..f9e692cb69 100644 --- a/core/src/fpdfdoc/doc_basic.cpp +++ b/core/src/fpdfdoc/doc_basic.cpp @@ -251,7 +251,7 @@ CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc, FX_BSTR sName) return NULL; } #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -static CFX_WideString ChangeSlashToPlatform(FX_LPCWSTR str) +static CFX_WideString ChangeSlashToPlatform(const FX_WCHAR* str) { CFX_WideString result; while (*str) { @@ -268,7 +268,7 @@ static CFX_WideString ChangeSlashToPlatform(FX_LPCWSTR str) } return result; } -static CFX_WideString ChangeSlashToPDF(FX_LPCWSTR str) +static CFX_WideString ChangeSlashToPDF(const FX_WCHAR* str) { CFX_WideString result; while (*str) { diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp index 0fbbd1d38f..8dab922d74 100644 --- a/core/src/fpdfdoc/doc_form.cpp +++ b/core/src/fpdfdoc/doc_form.cpp @@ -19,7 +19,7 @@ public: m_pEnd = m_pStart + full_name.GetLength(); m_pCur = m_pStart; } - void GetNext(FX_LPCWSTR &pSubName, FX_STRSIZE& size) + void GetNext(const FX_WCHAR* &pSubName, FX_STRSIZE& size) { pSubName = m_pCur; while (m_pCur < m_pEnd && m_pCur[0] != L'.') { @@ -31,9 +31,9 @@ public: } } protected: - FX_LPCWSTR m_pStart; - FX_LPCWSTR m_pEnd; - FX_LPCWSTR m_pCur; + const FX_WCHAR* m_pStart; + const FX_WCHAR* m_pEnd; + const FX_WCHAR* m_pCur; }; class CFieldTree { @@ -162,7 +162,7 @@ void CFieldTree::SetField(const CFX_WideString &full_name, CPDF_FormField *field return; } _CFieldNameExtractor name_extractor(full_name); - FX_LPCWSTR pName; + const FX_WCHAR* pName; FX_STRSIZE nLength; name_extractor.GetNext(pName, nLength); _Node *pNode = &m_Root, *pLast = NULL; @@ -185,7 +185,7 @@ CPDF_FormField *CFieldTree::GetField(const CFX_WideString &full_name) return NULL; } _CFieldNameExtractor name_extractor(full_name); - FX_LPCWSTR pName; + const FX_WCHAR* pName; FX_STRSIZE nLength; name_extractor.GetNext(pName, nLength); _Node *pNode = &m_Root, *pLast = NULL; @@ -203,7 +203,7 @@ CPDF_FormField *CFieldTree::RemoveField(const CFX_WideString & full_name) return NULL; } _CFieldNameExtractor name_extractor(full_name); - FX_LPCWSTR pName; + const FX_WCHAR* pName; FX_STRSIZE nLength; name_extractor.GetNext(pName, nLength); _Node *pNode = &m_Root, *pLast = NULL; @@ -233,7 +233,7 @@ CFieldTree::_Node *CFieldTree::FindNode(const CFX_WideString& full_name) return NULL; } _CFieldNameExtractor name_extractor(full_name); - FX_LPCWSTR pName; + const FX_WCHAR* pName; FX_STRSIZE nLength; name_extractor.GetNext(pName, nLength); _Node *pNode = &m_Root, *pLast = NULL; @@ -270,7 +270,8 @@ CPDF_InterForm::~CPDF_InterForm() { FX_POSITION pos = m_ControlMap.GetStartPosition(); while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_ControlMap.GetNextAssoc(pos, key, value); delete (CPDF_FormControl*)value; } @@ -292,7 +293,7 @@ void CPDF_InterForm::EnableUpdateAP(FX_BOOL bUpdateAP) { m_bUpdateAP = bUpdateAP; } -CFX_ByteString CPDF_InterForm::GenerateNewResourceName(const CPDF_Dictionary* pResDict, FX_LPCSTR csType, int iMinLen, FX_LPCSTR csPrefix) +CFX_ByteString CPDF_InterForm::GenerateNewResourceName(const CPDF_Dictionary* pResDict, const FX_CHAR* csType, int iMinLen, const FX_CHAR* csPrefix) { CFX_ByteString csStr = csPrefix; CFX_ByteString csBType = csType; @@ -476,7 +477,7 @@ CPDF_Font* CPDF_InterForm::AddStandardFont(const CPDF_Document* pDocument, CFX_B } return pFont; } -CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, FX_LPVOID pLogFont) +CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, void* pLogFont) { CFX_ByteString csFontName; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ @@ -513,7 +514,7 @@ CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, FX_LPVOID pLogFont #endif return csFontName; } -CFX_ByteString CPDF_InterForm::GetNativeFont(FX_LPVOID pLogFont) +CFX_ByteString CPDF_InterForm::GetNativeFont(void* pLogFont) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ uint8_t charSet = GetNativeCharSet(); @@ -698,7 +699,8 @@ FX_BOOL CPDF_InterForm::ValidateFieldName(const CPDF_FormControl* pControl, CFX_ } int CPDF_InterForm::CompareFieldName(const CFX_ByteString& name1, const CFX_ByteString& name2) { - FX_LPCSTR ptr1 = name1, ptr2 = name2; + const FX_CHAR* ptr1 = name1; + const FX_CHAR* ptr2 = name2; if (name1.GetLength() != name2.GetLength()) { int i = 0; while (ptr1[i] == ptr2[i]) { @@ -717,8 +719,8 @@ int CPDF_InterForm::CompareFieldName(const CFX_ByteString& name1, const CFX_Byte } int CPDF_InterForm::CompareFieldName(const CFX_WideString& name1, const CFX_WideString& name2) { - FX_LPCWSTR ptr1 = name1.c_str(); - FX_LPCWSTR ptr2 = name2.c_str(); + const FX_WCHAR* ptr1 = name1.c_str(); + const FX_WCHAR* ptr2 = name2.c_str(); if (name1.GetLength() != name2.GetLength()) { int i = 0; while (ptr1[i] == ptr2[i]) { @@ -822,7 +824,7 @@ FX_BOOL CPDF_InterForm::IsValidFormControl(const void* pControl) while (pos) { CPDF_Dictionary* pWidgetDict = NULL; void* pFormControl = NULL; - m_ControlMap.GetNextAssoc(pos, (FX_LPVOID&)pWidgetDict, pFormControl); + m_ControlMap.GetNextAssoc(pos, (void*&)pWidgetDict, pFormControl); if (pControl == pFormControl) { return TRUE; } @@ -842,7 +844,7 @@ int CPDF_InterForm::CountPageControls(CPDF_Page* pPage) const continue; } CPDF_FormControl* pControl; - if (!m_ControlMap.Lookup(pAnnot, (FX_LPVOID&)pControl)) { + if (!m_ControlMap.Lookup(pAnnot, (void*&)pControl)) { continue; } count ++; @@ -862,7 +864,7 @@ CPDF_FormControl* CPDF_InterForm::GetPageControl(CPDF_Page* pPage, int index) co continue; } CPDF_FormControl* pControl; - if (!m_ControlMap.Lookup(pAnnot, (FX_LPVOID&)pControl)) { + if (!m_ControlMap.Lookup(pAnnot, (void*&)pControl)) { continue; } if (index == count) { @@ -884,7 +886,7 @@ CPDF_FormControl* CPDF_InterForm::GetControlAtPoint(CPDF_Page* pPage, FX_FLOAT p continue; } CPDF_FormControl* pControl; - if (!m_ControlMap.Lookup(pAnnot, (FX_LPVOID&)pControl)) { + if (!m_ControlMap.Lookup(pAnnot, (void*&)pControl)) { continue; } CFX_FloatRect rect = pControl->GetRect(); @@ -897,7 +899,7 @@ CPDF_FormControl* CPDF_InterForm::GetControlAtPoint(CPDF_Page* pPage, FX_FLOAT p CPDF_FormControl* CPDF_InterForm::GetControlByDict(CPDF_Dictionary* pWidgetDict) const { CPDF_FormControl* pControl = NULL; - m_ControlMap.Lookup(pWidgetDict, (FX_LPVOID&)pControl); + m_ControlMap.Lookup(pWidgetDict, (void*&)pControl); return pControl; } FX_DWORD CPDF_InterForm::CountInternalFields(const CFX_WideString& csFieldName) const @@ -1205,7 +1207,7 @@ void CPDF_InterForm::ReloadForm() while (pos) { CPDF_Dictionary* pWidgetDict; CPDF_FormControl* pControl; - m_ControlMap.GetNextAssoc(pos, (FX_LPVOID&)pWidgetDict, (FX_LPVOID&)pControl); + m_ControlMap.GetNextAssoc(pos, (void*&)pWidgetDict, (void*&)pControl); delete pControl; } m_ControlMap.RemoveAll(); @@ -1471,7 +1473,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF(FX_WSTR pdf_path, CFX_PtrArray& field return pDoc; } const struct _SupportFieldEncoding { - FX_LPCSTR m_name; + const FX_CHAR* m_name; int32_t m_codePage; } g_fieldEncoding[] = { { "BigFive", 950 }, diff --git a/core/src/fpdfdoc/doc_link.cpp b/core/src/fpdfdoc/doc_link.cpp index 71be0c36ab..e614af3ec8 100644 --- a/core/src/fpdfdoc/doc_link.cpp +++ b/core/src/fpdfdoc/doc_link.cpp @@ -11,7 +11,8 @@ CPDF_LinkList::~CPDF_LinkList() { FX_POSITION pos = m_PageMap.GetStartPosition(); while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_PageMap.GetNextAssoc(pos, key, value); delete (CFX_PtrArray*)value; } @@ -23,12 +24,9 @@ CFX_PtrArray* CPDF_LinkList::GetPageLinks(CPDF_Page* pPage) return NULL; } CFX_PtrArray* pPageLinkList = NULL; - if (!m_PageMap.Lookup((FX_LPVOID)(uintptr_t)objnum, (FX_LPVOID&)pPageLinkList)) { - pPageLinkList = FX_NEW CFX_PtrArray; - if (pPageLinkList == NULL) { - return NULL; - } - m_PageMap.SetAt((FX_LPVOID)(uintptr_t)objnum, pPageLinkList); + if (!m_PageMap.Lookup((void*)(uintptr_t)objnum, (void*&)pPageLinkList)) { + pPageLinkList = new CFX_PtrArray; + m_PageMap.SetAt((void*)(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 677d0e91af..07cba96e61 100644 --- a/core/src/fpdfdoc/doc_metadata.cpp +++ b/core/src/fpdfdoc/doc_metadata.cpp @@ -13,7 +13,7 @@ typedef struct _PDFDOC_METADATA { CFX_CMapByteStringToPtr *m_pStringMap; } PDFDOC_METADATA, * PDFDOC_LPMETADATA; typedef PDFDOC_METADATA const * PDFDOC_LPCMETADATA; -const FX_LPCSTR gs_FPDFDOC_Metadata_Titles[] = { +const FX_CHAR* const gs_FPDFDOC_Metadata_Titles[] = { "Title", "title", "Subject", "description", "Author", "creator", @@ -61,7 +61,7 @@ void CPDF_Metadata::LoadDoc(CPDF_Document *pDoc) CPDF_StreamAcc acc; acc.LoadAllData(pStream, FALSE); int size = acc.GetSize(); - FX_LPCBYTE pBuf = acc.GetData(); + const uint8_t* pBuf = acc.GetData(); CXML_Element *&pXmlElmnt = ((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt; pXmlElmnt = CXML_Element::Parse(pBuf, size); if (!pXmlElmnt) { @@ -86,7 +86,7 @@ int32_t CPDF_Metadata::GetString(FX_BSTR bsItem, CFX_WideString &wsStr) if (!((PDFDOC_LPMETADATA)m_pData)->m_pStringMap->Lookup(bsItem, szTag)) { return -1; } - CFX_ByteString bsTag = (FX_LPCSTR)szTag; + CFX_ByteString bsTag = (const FX_CHAR*)szTag; wsStr = L""; CXML_Element *pElmntRdf = ((PDFDOC_LPMETADATA)m_pData)->m_pElmntRdf; if (!pElmntRdf) { diff --git a/core/src/fpdfdoc/doc_ocg.cpp b/core/src/fpdfdoc/doc_ocg.cpp index c2f77a58fa..318e9318ce 100644 --- a/core/src/fpdfdoc/doc_ocg.cpp +++ b/core/src/fpdfdoc/doc_ocg.cpp @@ -179,11 +179,11 @@ FX_BOOL CPDF_OCContext::GetOCGVisible(const CPDF_Dictionary *pOCGDict) if (!pOCGDict) { return FALSE; } - FX_LPVOID bState = NULL; + void* bState = NULL; if (m_OCGStates.Lookup(pOCGDict, bState)) { return (uintptr_t)bState != 0; } - bState = (FX_LPVOID)(uintptr_t)LoadOCGState(pOCGDict); + bState = (void*)(uintptr_t)LoadOCGState(pOCGDict); m_OCGStates.SetAt(pOCGDict, bState); return (uintptr_t)bState != 0; } diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp index c5fe39b6ee..0bf229e7d8 100644 --- a/core/src/fpdfdoc/doc_tagged.cpp +++ b/core/src/fpdfdoc/doc_tagged.cpp @@ -137,7 +137,7 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(CPDF_Dictionary* pDict, return NULL; } CPDF_StructElementImpl* pElement = NULL; - if (map.Lookup(pDict, (FX_LPVOID&)pElement)) { + if (map.Lookup(pDict, (void*&)pElement)) { return pElement; } pElement = FX_NEW CPDF_StructElementImpl(this, NULL, pDict); diff --git a/core/src/fpdfdoc/doc_vt.cpp b/core/src/fpdfdoc/doc_vt.cpp index 7ed5b4ad3c..94dc1126da 100644 --- a/core/src/fpdfdoc/doc_vt.cpp +++ b/core/src/fpdfdoc/doc_vt.cpp @@ -920,7 +920,7 @@ CPVT_WordPlace CPDF_VariableText::InsertSection(const CPVT_WordPlace & place, co } return newplace; } -CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace & place, FX_LPCWSTR text, int32_t charset, +CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace & place, const FX_WCHAR* text, int32_t charset, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pProps) { CFX_WideString swText = text; @@ -980,7 +980,7 @@ CPVT_WordPlace CPDF_VariableText::BackSpaceWord(const CPVT_WordPlace & place) { return ClearLeftWord(AjustLineHeader(place, TRUE)); } -void CPDF_VariableText::SetText(FX_LPCWSTR text, int32_t charset, const CPVT_SecProps * pSecProps, +void CPDF_VariableText::SetText(const FX_WCHAR* text, int32_t charset, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps) { DeleteWords(CPVT_WordRange(GetBeginWordPlace(), GetEndWordPlace())); diff --git a/core/src/fpdfdoc/pdf_vt.h b/core/src/fpdfdoc/pdf_vt.h index 5d8b20cf52..b66c2ed3b5 100644 --- a/core/src/fpdfdoc/pdf_vt.h +++ b/core/src/fpdfdoc/pdf_vt.h @@ -474,13 +474,13 @@ public: void RearrangeAll(); void RearrangePart(const CPVT_WordRange & PlaceRange); void ResetAll(); - void SetText(FX_LPCWSTR text, int32_t charset = 1, const CPVT_SecProps * pSecProps = NULL, + void SetText(const FX_WCHAR* 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, 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, int32_t charset = 1, + CPVT_WordPlace InsertText(const CPVT_WordPlace & place, const FX_WCHAR* 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); diff --git a/core/src/fpdftext/fpdf_text.cpp b/core/src/fpdftext/fpdf_text.cpp index 5efbe51c03..181118d2f0 100644 --- a/core/src/fpdftext/fpdf_text.cpp +++ b/core/src/fpdftext/fpdf_text.cpp @@ -9,14 +9,14 @@ #include "../../include/fpdftext/fpdf_text.h" #include "txtproc.h" #include "text_int.h" -extern FX_LPCSTR FCS_GetAltStr(FX_WCHAR); -CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode, int destcp, FX_LPCSTR defchar) +extern const FX_CHAR* FCS_GetAltStr(FX_WCHAR); +CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode, int destcp, const FX_CHAR* defchar) { if (destcp == 0) { if (unicode < 0x80) { return CFX_ByteString((char)unicode); } - FX_LPCSTR altstr = FCS_GetAltStr(unicode); + const FX_CHAR* altstr = FCS_GetAltStr(unicode); if (altstr) { return CFX_ByteString(altstr, -1); } @@ -28,7 +28,7 @@ CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode, int destcp, FX_LPCSTR defcha if (ret && !bDef) { return CFX_ByteString(buf, ret); } - FX_LPCSTR altstr = FCS_GetAltStr(unicode); + const FX_CHAR* altstr = FCS_GetAltStr(unicode); if (altstr) { return CFX_ByteString(altstr, -1); } @@ -176,7 +176,7 @@ CTextBaseLine* CTextPage::InsertTextBox(CTextBaseLine* pBaseLine, FX_FLOAT basey } } CFX_WideString text; - FX_LPCSTR pStr = str; + const FX_CHAR* pStr = str; int len = str.GetLength(), offset = 0; while (offset < len) { FX_DWORD ch = pFont->GetNextChar(pStr, len, offset); @@ -289,7 +289,7 @@ void CTextPage::WriteOutput(CFX_WideStringArray& lines, int iMinWidth) void NormalizeCompositeChar(FX_WCHAR wChar, CFX_WideString& sDest) { wChar = FX_GetMirrorChar(wChar, TRUE, FALSE); - FX_LPWSTR pDst = NULL; + FX_WCHAR* pDst = NULL; FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst); if (nCount < 1 ) { sDest += wChar; diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp index 10bd3c8b36..0bdbfa91ea 100644 --- a/core/src/fpdftext/fpdf_text_int.cpp +++ b/core/src/fpdftext/fpdf_text_int.cpp @@ -1163,7 +1163,7 @@ void CPDF_TextPage::AddCharInfoByLRDirection(CFX_WideString& str, int i) if(!IsControlChar(&Info)) { Info.m_Index = m_TextBuf.GetLength(); if (wChar >= 0xFB00 && wChar <= 0xFB06) { - FX_LPWSTR pDst = NULL; + FX_WCHAR* pDst = NULL; FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst); if (nCount >= 1) { pDst = FX_Alloc(FX_WCHAR, nCount); @@ -1195,7 +1195,7 @@ void CPDF_TextPage::AddCharInfoByRLDirection(CFX_WideString& str, int i) if(!IsControlChar(&Info)) { Info.m_Index = m_TextBuf.GetLength(); FX_WCHAR wChar = FX_GetMirrorChar(str.GetAt(i), TRUE, FALSE); - FX_LPWSTR pDst = NULL; + FX_WCHAR* pDst = NULL; FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst); if (nCount >= 1) { pDst = FX_Alloc(FX_WCHAR, nCount); @@ -2557,7 +2557,7 @@ FX_BOOL CPDF_TextPageFind::IsMatchWholeWord(const CFX_WideString& csPageText, in } return TRUE; } -FX_BOOL CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString, FX_LPCWSTR lpszFullString, +FX_BOOL CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString, const FX_WCHAR* lpszFullString, int iSubString, FX_WCHAR chSep) { if (lpszFullString == NULL) { @@ -2574,7 +2574,7 @@ FX_BOOL CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString, FX_LPCWSTR lpszFullString++; } } - FX_LPCWSTR lpchEnd = FXSYS_wcschr(lpszFullString, chSep); + const FX_WCHAR* lpchEnd = FXSYS_wcschr(lpszFullString, chSep); int nLen = (lpchEnd == NULL) ? (int)FXSYS_wcslen(lpszFullString) : (int)(lpchEnd - lpszFullString); ASSERT(nLen >= 0); diff --git a/core/src/fpdftext/text_int.h b/core/src/fpdftext/text_int.h index 03f6ce1dc8..f59d3513db 100644 --- a/core/src/fpdftext/text_int.h +++ b/core/src/fpdftext/text_int.h @@ -152,7 +152,7 @@ public: protected: void ExtractFindWhat(const CFX_WideString& findwhat); FX_BOOL IsMatchWholeWord(const CFX_WideString& csPageText, int startPos, int endPos); - FX_BOOL ExtractSubString(CFX_WideString& rString, FX_LPCWSTR lpszFullString, + FX_BOOL ExtractSubString(CFX_WideString& rString, const FX_WCHAR* lpszFullString, int iSubString, FX_WCHAR chSep); CFX_WideString MakeReverse(const CFX_WideString& str); int ReverseFind(const CFX_WideString& csPageText, const CFX_WideString& csWord, int nStartPos, int& WordLength); @@ -210,7 +210,7 @@ private: CFX_WideString m_strPageText; FX_BOOL m_IsParserd; }; -FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_LPWSTR pDst); +FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst); void NormalizeString(CFX_WideString& str); void NormalizeCompositeChar(FX_WCHAR wChar, CFX_WideString& sDest); diff --git a/core/src/fpdftext/unicodenormalization.cpp b/core/src/fpdftext/unicodenormalization.cpp index ad2f3f6aea..7b01830582 100644 --- a/core/src/fpdftext/unicodenormalization.cpp +++ b/core/src/fpdftext/unicodenormalization.cpp @@ -10,14 +10,14 @@ extern const FX_WCHAR g_UnicodeData_Normalization_Map1[]; extern const FX_WCHAR g_UnicodeData_Normalization_Map2[]; extern const FX_WCHAR g_UnicodeData_Normalization_Map3[]; extern const FX_WCHAR g_UnicodeData_Normalization_Map4[]; -FX_LPCWSTR g_UnicodeData_Normalization_Maps[5] = { +const FX_WCHAR* g_UnicodeData_Normalization_Maps[5] = { NULL, g_UnicodeData_Normalization_Map1, g_UnicodeData_Normalization_Map2, g_UnicodeData_Normalization_Map3, g_UnicodeData_Normalization_Map4 }; -FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_LPWSTR pDst) +FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst) { wch = wch & 0xFFFF; FX_WCHAR wFind = g_UnicodeData_Normalization[wch]; @@ -34,7 +34,7 @@ FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_LPWSTR pDst) wch = wFind & 0x0FFF; wFind >>= 12; } - FX_LPCWSTR pMap = g_UnicodeData_Normalization_Maps[wFind]; + const FX_WCHAR* pMap = g_UnicodeData_Normalization_Maps[wFind]; if (pMap == g_UnicodeData_Normalization_Map4) { pMap = g_UnicodeData_Normalization_Map4 + wch; wFind = (FX_WCHAR)(*pMap ++); @@ -49,7 +49,7 @@ FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_LPWSTR pDst) } return (FX_STRSIZE)wFind; } -FX_STRSIZE FX_WideString_GetNormalization(FX_WSTR wsSrc, FX_LPWSTR pDst) +FX_STRSIZE FX_WideString_GetNormalization(FX_WSTR wsSrc, FX_WCHAR* pDst) { FX_STRSIZE nCount = 0; for (FX_STRSIZE len = 0; len < wsSrc.GetLength(); len ++) { @@ -64,11 +64,11 @@ FX_STRSIZE FX_WideString_GetNormalization(FX_WSTR wsSrc, FX_LPWSTR pDst) } FX_STRSIZE FX_WideString_GetNormalization(FX_WSTR wsSrc, CFX_WideString &wsDst) { - FX_STRSIZE nLen = FX_WideString_GetNormalization(wsSrc, (FX_LPWSTR)NULL); + FX_STRSIZE nLen = FX_WideString_GetNormalization(wsSrc, (FX_WCHAR*)NULL); if (!nLen) { return 0; } - FX_LPWSTR pBuf = wsDst.GetBuffer(nLen); + FX_WCHAR* pBuf = wsDst.GetBuffer(nLen); FX_WideString_GetNormalization(wsSrc, pBuf); wsDst.ReleaseBuffer(nLen); return nLen; diff --git a/core/src/fxcodec/codec/codec_int.h b/core/src/fxcodec/codec/codec_int.h index c50faaa936..90e8b8c02c 100644 --- a/core/src/fxcodec/codec/codec_int.h +++ b/core/src/fxcodec/codec/codec_int.h @@ -17,11 +17,11 @@ class CCodec_BasicModule : public ICodec_BasicModule { public: - virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, + virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); - virtual FX_BOOL A85Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, + virtual FX_BOOL A85Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); - virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, + virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc); }; struct CCodec_ImageDataCache { @@ -44,7 +44,7 @@ public: virtual void DownScale(int dest_width, int dest_height); - FX_LPBYTE GetScanline(int line); + uint8_t* GetScanline(int line); FX_BOOL SkipToScanline(int line, IFX_Pause* pPause); @@ -100,39 +100,39 @@ protected: FX_BOOL m_bColorTransformed; - FX_LPBYTE ReadNextLine(); + uint8_t* ReadNextLine(); virtual FX_BOOL v_Rewind() = 0; - virtual FX_LPBYTE v_GetNextLine() = 0; + virtual uint8_t* v_GetNextLine() = 0; virtual void v_DownScale(int dest_width, int dest_height) = 0; int m_NextLine; - FX_LPBYTE m_pLastScanline; + uint8_t* m_pLastScanline; CCodec_ImageDataCache* m_pDataCache; }; class CCodec_FaxModule : public ICodec_FaxModule { public: - virtual ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, + virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows); - FX_BOOL Encode(FX_LPCBYTE src_buf, int width, int height, int pitch, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); + FX_BOOL Encode(const uint8_t* src_buf, int width, int height, int pitch, uint8_t*& dest_buf, FX_DWORD& dest_size); }; class CCodec_FlateModule : public ICodec_FlateModule { public: - virtual ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, + virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* 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 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); + FX_DWORD estimated_size, uint8_t*& dest_buf, FX_DWORD& dest_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); + uint8_t*& dest_buf, FX_DWORD& dest_size); + virtual FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); }; class CCodec_JpegModule : public ICodec_JpegModule { @@ -142,19 +142,19 @@ public: { m_pExtProvider = pJP; } - ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, + ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, FX_BOOL ColorTransform); - FX_BOOL LoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int& width, int& height, + FX_BOOL LoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height, int& num_components, int& bits_per_components, FX_BOOL& color_transform, - FX_LPBYTE* icc_buf_ptr, FX_DWORD* icc_length); - FX_BOOL Encode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_STRSIZE& dest_size, int quality, FX_LPCBYTE icc_buf, FX_DWORD icc_length); + uint8_t** icc_buf_ptr, FX_DWORD* icc_length); + FX_BOOL Encode(const CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, FX_DWORD icc_length); virtual void* Start(); virtual void Finish(void* pContext); - virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size); + virtual void Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size); virtual int ReadHeader(void* pContext, int* width, int* height, int* nComps, CFX_DIBAttribute* pAttribute = NULL); virtual FX_BOOL StartScanline(void* pContext, int down_scale); - virtual FX_BOOL ReadScanline(void* pContext, FX_LPBYTE dest_buf); - virtual FX_DWORD GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr); + virtual FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf); + virtual FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr); protected: IFX_JpegProvider* m_pExtProvider; }; @@ -169,7 +169,7 @@ public: virtual void* Start(void* pModule); virtual void Finish(void* pContext); - virtual FX_BOOL Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_DIBAttribute* pAttribute); + virtual FX_BOOL Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size, CFX_DIBAttribute* pAttribute); protected: FX_CHAR m_szLastError[PNG_ERROR_SIZE]; }; @@ -182,8 +182,8 @@ public: } virtual void* Start(void* pModule); virtual void Finish(void* pContext); - virtual FX_DWORD GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr); - virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size); + virtual FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr); + virtual void Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size); virtual int32_t ReadHeader(void* pContext, int* width, int* height, int* pal_num, void** pal_pp, int* bg_index, CFX_DIBAttribute* pAttribute); @@ -204,8 +204,8 @@ public: } virtual void* Start(void* pModule); virtual void Finish(void* pContext); - virtual FX_DWORD GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr); - virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size); + virtual FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr); + virtual void Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size); virtual int32_t ReadHeader(void* pContext, int32_t* width, int32_t* height, FX_BOOL* tb_flag, int32_t* components, int32_t* pal_num, FX_DWORD** pal_pp, CFX_DIBAttribute* pAttribute); virtual int32_t LoadImage(void* pContext); @@ -215,9 +215,9 @@ protected: class CCodec_IccModule : public ICodec_IccModule { public: - virtual IccCS GetProfileCS(FX_LPCBYTE pProfileData, unsigned int dwProfileSize); + virtual IccCS GetProfileCS(const uint8_t* pProfileData, unsigned int dwProfileSize); virtual IccCS GetProfileCS(IFX_FileRead* pFile); - virtual FX_LPVOID CreateTransform(ICodec_IccModule::IccParam* pInputParam, + virtual void* CreateTransform(ICodec_IccModule::IccParam* pInputParam, ICodec_IccModule::IccParam* pOutputParam, ICodec_IccModule::IccParam* pProofParam = NULL, FX_DWORD dwIntent = Icc_INTENT_PERCEPTUAL, @@ -225,16 +225,16 @@ 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, int32_t& nComponents, int32_t intent = 0, + virtual void* CreateTransform_sRGB(const uint8_t* 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, int32_t& nSrcComponents, - FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent = 0, + virtual void* CreateTransform_CMYK(const uint8_t* pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, + const uint8_t* pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent = 0, FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT ); - virtual void DestroyTransform(FX_LPVOID pTransform); - virtual void Translate(FX_LPVOID pTransform, FX_FLOAT* pSrcValues, FX_FLOAT* pDestValues); - virtual void TranslateScanline(FX_LPVOID pTransform, FX_LPBYTE pDest, FX_LPCBYTE pSrc, int pixels); + virtual void DestroyTransform(void* pTransform); + virtual void Translate(void* pTransform, FX_FLOAT* pSrcValues, FX_FLOAT* pDestValues); + virtual void TranslateScanline(void* pTransform, uint8_t* pDest, const uint8_t* pSrc, int pixels); virtual void SetComponents(FX_DWORD nComponents) {m_nComponents = nComponents;} virtual ~CCodec_IccModule(); protected: @@ -247,26 +247,26 @@ protected: Icc_CLASS_PROOF, Icc_CLASS_MAX } Icc_CLASS; - FX_LPVOID CreateProfile(ICodec_IccModule::IccParam* pIccParam, Icc_CLASS ic, CFX_BinaryBuf* pTransformKey); + void* CreateProfile(ICodec_IccModule::IccParam* pIccParam, Icc_CLASS ic, CFX_BinaryBuf* pTransformKey); }; class CCodec_JpxModule : public ICodec_JpxModule { public: CCodec_JpxModule(); - void* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_BOOL useColorSpace = FALSE); - void GetImageInfo(FX_LPVOID ctx, FX_DWORD& width, FX_DWORD& height, + void* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL useColorSpace = FALSE); + void GetImageInfo(void* ctx, FX_DWORD& width, FX_DWORD& height, FX_DWORD& codestream_nComps, FX_DWORD& output_nComps); - FX_BOOL Decode(void* ctx, FX_LPBYTE dest_data, int pitch, FX_BOOL bTranslateColor, FX_LPBYTE offsets); + FX_BOOL Decode(void* ctx, uint8_t* dest_data, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets); void DestroyDecoder(void* ctx); }; class CCodec_TiffModule : public ICodec_TiffModule { public: - virtual FX_LPVOID CreateDecoder(IFX_FileRead* file_ptr); - virtual void GetFrames(FX_LPVOID ctx, int32_t& frames); - virtual FX_BOOL LoadFrameInfo(FX_LPVOID ctx, int32_t frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute = NULL); - virtual FX_BOOL Decode(FX_LPVOID ctx, class CFX_DIBitmap* pDIBitmap); - virtual void DestroyDecoder(FX_LPVOID ctx); + virtual void* CreateDecoder(IFX_FileRead* file_ptr); + virtual void GetFrames(void* ctx, int32_t& frames); + virtual FX_BOOL LoadFrameInfo(void* ctx, int32_t frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute = NULL); + virtual FX_BOOL Decode(void* ctx, class CFX_DIBitmap* pDIBitmap); + virtual void DestroyDecoder(void* ctx); }; class CPDF_Jbig2Interface : public CJBig2_Module { @@ -293,11 +293,11 @@ public: } return FX_Alloc(uint8_t, num * size); } - virtual void *JBig2_Realloc(FX_LPVOID pMem, FX_DWORD dwSize) + virtual void *JBig2_Realloc(void* pMem, FX_DWORD dwSize) { return FX_Realloc(uint8_t, pMem, dwSize); } - virtual void JBig2_Free(FX_LPVOID pMem) + virtual void JBig2_Free(void* pMem) { FX_Free(pMem); } @@ -310,11 +310,11 @@ public: IFX_FileRead* m_file_ptr; FX_DWORD m_width; FX_DWORD m_height; - FX_LPBYTE m_src_buf; + uint8_t* m_src_buf; FX_DWORD m_src_size; - FX_LPCBYTE m_global_data; + const uint8_t* m_global_data; FX_DWORD m_global_size; - FX_LPBYTE m_dest_buf; + uint8_t* m_dest_buf; FX_DWORD m_dest_pitch; FX_BOOL m_bFileReader; IFX_Pause* m_pPause; @@ -326,16 +326,16 @@ class CCodec_Jbig2Module : public ICodec_Jbig2Module public: CCodec_Jbig2Module() {}; ~CCodec_Jbig2Module(); - FX_BOOL Decode(FX_DWORD width, FX_DWORD height, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPCBYTE global_data, FX_DWORD global_size, FX_LPBYTE dest_buf, FX_DWORD dest_pitch); + FX_BOOL Decode(FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, + const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch); FX_BOOL Decode(IFX_FileRead* file_ptr, - FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, FX_LPBYTE& dest_buf); + FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf); void* CreateJbig2Context(); - FXCODEC_STATUS StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPCBYTE global_data, FX_DWORD global_size, FX_LPBYTE dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause); + FXCODEC_STATUS StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, + const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause); FXCODEC_STATUS StartDecode(void* pJbig2Context, IFX_FileRead* file_ptr, - FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, FX_LPBYTE& dest_buf, IFX_Pause* pPause); + FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf, IFX_Pause* pPause); FXCODEC_STATUS ContinueDecode(void* pJbig2Context, IFX_Pause* pPause); void DestroyJbig2Context(void* pJbig2Context); CPDF_Jbig2Interface m_Module; @@ -347,24 +347,24 @@ class CFX_DIBAttributeExif : public IFX_DIBAttributeExif public: CFX_DIBAttributeExif(); ~CFX_DIBAttributeExif(); - virtual FX_BOOL GetInfo(FX_WORD tag, FX_LPVOID val); + virtual FX_BOOL GetInfo(FX_WORD tag, void* val); - FX_BOOL ParseExif(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* pHead, FX_LPBYTE data, FX_DWORD len, CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* pVal); + FX_BOOL ParseExif(CFX_MapPtrTemplate<FX_DWORD, uint8_t*>* pHead, uint8_t* data, FX_DWORD len, CFX_MapPtrTemplate<FX_DWORD, uint8_t*>* pVal); - typedef FX_WORD (*_Read2Bytes)(FX_LPBYTE data); - typedef FX_DWORD (*_Read4Bytes)(FX_LPBYTE data); - FX_LPBYTE ParseExifIFH(FX_LPBYTE data, FX_DWORD len, _Read2Bytes* pReadWord, _Read4Bytes* pReadDword); - FX_BOOL ParseExifIFD(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* pMap, FX_LPBYTE data, FX_DWORD len); + typedef FX_WORD (*_Read2Bytes)(uint8_t* data); + typedef FX_DWORD (*_Read4Bytes)(uint8_t* data); + uint8_t* ParseExifIFH(uint8_t* data, FX_DWORD len, _Read2Bytes* pReadWord, _Read4Bytes* pReadDword); + FX_BOOL ParseExifIFD(CFX_MapPtrTemplate<FX_DWORD, uint8_t*>* pMap, uint8_t* data, FX_DWORD len); - FX_LPBYTE m_pExifData; + uint8_t* m_pExifData; FX_DWORD m_dwExifDataLen; void clear(); _Read2Bytes m_readWord; _Read4Bytes m_readDword; - CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE> m_TagHead; - CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE> m_TagVal; + CFX_MapPtrTemplate<FX_DWORD, uint8_t*> m_TagHead; + CFX_MapPtrTemplate<FX_DWORD, uint8_t*> m_TagVal; }; struct DecodeData { diff --git a/core/src/fxcodec/codec/fx_codec.cpp b/core/src/fxcodec/codec/fx_codec.cpp index 5676e46be0..ed007fdcb1 100644 --- a/core/src/fxcodec/codec/fx_codec.cpp +++ b/core/src/fxcodec/codec/fx_codec.cpp @@ -51,7 +51,7 @@ CCodec_ScanlineDecoder::~CCodec_ScanlineDecoder() FX_Free(m_pDataCache); } } -FX_LPBYTE CCodec_ScanlineDecoder::GetScanline(int line) +uint8_t* CCodec_ScanlineDecoder::GetScanline(int line) { if (m_pDataCache && line < m_pDataCache->m_nCachedLines) { return &m_pDataCache->m_Data + line * m_Pitch; @@ -95,9 +95,9 @@ FX_BOOL CCodec_ScanlineDecoder::SkipToScanline(int line, IFX_Pause* pPause) } return FALSE; } -FX_LPBYTE CCodec_ScanlineDecoder::ReadNextLine() +uint8_t* CCodec_ScanlineDecoder::ReadNextLine() { - FX_LPBYTE pLine = v_GetNextLine(); + uint8_t* pLine = v_GetNextLine(); if (pLine == NULL) { return NULL; } @@ -131,7 +131,7 @@ void CCodec_ScanlineDecoder::DownScale(int dest_width, int dest_height) m_pDataCache->m_Width = m_OutputWidth; m_pDataCache->m_nCachedLines = 0; } -FX_BOOL CCodec_BasicModule::RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, +FX_BOOL CCodec_BasicModule::RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { return FALSE; @@ -240,7 +240,7 @@ extern "C" double FXstrtod(const char* nptr, char** endptr) } return is_negative ? -ret : ret; } -FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, +FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { return FALSE; @@ -283,7 +283,7 @@ void CFX_DIBAttributeExif::clear() } m_pExifData = NULL; FX_DWORD key = 0; - FX_LPBYTE buf = NULL; + uint8_t* buf = NULL; FX_POSITION pos = NULL; pos = m_TagHead.GetStartPosition(); while (pos) { @@ -302,29 +302,29 @@ void CFX_DIBAttributeExif::clear() } m_TagVal.RemoveAll(); } -static FX_WORD _Read2BytesL(FX_LPBYTE data) +static FX_WORD _Read2BytesL(uint8_t* data) { ASSERT(data); return data[0] | (data[1] << 8); } -static FX_WORD _Read2BytesB(FX_LPBYTE data) +static FX_WORD _Read2BytesB(uint8_t* data) { ASSERT(data); return data[1] | (data[0] << 8); } -static FX_DWORD _Read4BytesL(FX_LPBYTE data) +static FX_DWORD _Read4BytesL(uint8_t* data) { return _Read2BytesL(data) | (_Read2BytesL(data + 2) << 16); } -static FX_DWORD _Read4BytesB(FX_LPBYTE data) +static FX_DWORD _Read4BytesB(uint8_t* data) { return _Read2BytesB(data + 2) | (_Read2BytesB(data) << 16); } -typedef FX_WORD (*_Read2Bytes) (FX_LPBYTE data); -typedef FX_DWORD (*_Read4Bytes) (FX_LPBYTE data); -typedef void (*_Write2Bytes) (FX_LPBYTE data, FX_WORD val); -typedef void (*_Write4Bytes) (FX_LPBYTE data, FX_DWORD val); -FX_LPBYTE CFX_DIBAttributeExif::ParseExifIFH(FX_LPBYTE data, FX_DWORD len, _Read2Bytes* pReadWord, _Read4Bytes* pReadDword) +typedef FX_WORD (*_Read2Bytes) (uint8_t* data); +typedef FX_DWORD (*_Read4Bytes) (uint8_t* data); +typedef void (*_Write2Bytes) (uint8_t* data, FX_WORD val); +typedef void (*_Write4Bytes) (uint8_t* data, FX_DWORD val); +uint8_t* CFX_DIBAttributeExif::ParseExifIFH(uint8_t* data, FX_DWORD len, _Read2Bytes* pReadWord, _Read4Bytes* pReadDword) { if (len > 8) { FX_BOOL tag = FALSE; @@ -356,14 +356,14 @@ FX_LPBYTE CFX_DIBAttributeExif::ParseExifIFH(FX_LPBYTE data, FX_DWORD len, _Read } return data; } -FX_BOOL CFX_DIBAttributeExif::ParseExifIFD(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* pMap, FX_LPBYTE data, FX_DWORD len) +FX_BOOL CFX_DIBAttributeExif::ParseExifIFD(CFX_MapPtrTemplate<FX_DWORD, uint8_t*>* pMap, uint8_t* data, FX_DWORD len) { if (pMap && data) { if (len > 8) { FX_WORD wTagNum = m_readWord(data); data += 2; FX_DWORD wTag; - FX_LPBYTE buf; + uint8_t* buf; while (wTagNum--) { wTag = m_readWord(data); data += 2; @@ -417,11 +417,11 @@ enum FX_ExifDataType { FX_SignedFloat, FX_DoubleFloat }; -FX_BOOL CFX_DIBAttributeExif::ParseExif(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* pHead, FX_LPBYTE data, FX_DWORD len, CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* pVal) +FX_BOOL CFX_DIBAttributeExif::ParseExif(CFX_MapPtrTemplate<FX_DWORD, uint8_t*>* pHead, uint8_t* data, FX_DWORD len, CFX_MapPtrTemplate<FX_DWORD, uint8_t*>* pVal) { if (pHead && data && pVal) { if (len > 8) { - FX_LPBYTE old_data = data; + uint8_t* old_data = data; data = ParseExifIFH(data, len, &m_readWord, &m_readDword); if (data == old_data) { return FALSE; @@ -435,11 +435,13 @@ FX_BOOL CFX_DIBAttributeExif::ParseExif(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* FX_WORD type; FX_DWORD dwSize; FX_DWORD tag; - FX_LPBYTE head; + uint8_t* head; FX_POSITION pos = pHead->GetStartPosition(); while (pos) { pHead->GetNextAssoc(pos, tag, head); - FX_LPBYTE val = NULL, buf = NULL, temp = NULL; + uint8_t* val = NULL; + uint8_t* buf = NULL; + uint8_t* temp = NULL; int i; if (head) { type = m_readWord(head); @@ -558,14 +560,14 @@ FX_BOOL CFX_DIBAttributeExif::ParseExif(CFX_MapPtrTemplate<FX_DWORD, FX_LPBYTE>* return FALSE; } #define FXEXIF_INFOCONVERT(T) {T* src = (T*)ptr; T* dst = (T*)val; *dst = *src;} -FX_BOOL CFX_DIBAttributeExif::GetInfo( FX_WORD tag, FX_LPVOID val ) +FX_BOOL CFX_DIBAttributeExif::GetInfo( FX_WORD tag, void* val ) { if (m_TagVal.GetCount() == 0) { if (!ParseExif(&m_TagHead, m_pExifData, m_dwExifDataLen, &m_TagVal)) { return FALSE; } } - FX_LPBYTE ptr = NULL; + uint8_t* ptr = NULL; if (m_TagVal.Lookup(tag, ptr)) { switch (tag) { case EXIFTAG_USHORT_RESUNIT: @@ -583,7 +585,7 @@ FX_BOOL CFX_DIBAttributeExif::GetInfo( FX_WORD tag, FX_LPVOID val ) FXEXIF_INFOCONVERT(FX_WORD); break; default: { - FX_LPBYTE* dst = (FX_LPBYTE*)val; + uint8_t** dst = (uint8_t**)val; *dst = ptr; } } @@ -595,10 +597,10 @@ class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder public: CCodec_RLScanlineDecoder(); virtual ~CCodec_RLScanlineDecoder(); - FX_BOOL Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc); + FX_BOOL Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc); virtual void v_DownScale(int dest_width, int dest_height) {} virtual FX_BOOL v_Rewind(); - virtual FX_LPBYTE v_GetNextLine(); + virtual uint8_t* v_GetNextLine(); virtual FX_DWORD GetSrcOffset() { return m_SrcOffset; @@ -608,8 +610,8 @@ protected: void GetNextOperator(); void UpdateOperator(uint8_t used_bytes); - FX_LPBYTE m_pScanline; - FX_LPCBYTE m_pSrcBuf; + uint8_t* m_pScanline; + const uint8_t* m_pSrcBuf; FX_DWORD m_SrcSize; FX_DWORD m_dwLineBytes; FX_DWORD m_SrcOffset; @@ -661,7 +663,7 @@ FX_BOOL CCodec_RLScanlineDecoder::CheckDestSize() } return TRUE; } -FX_BOOL CCodec_RLScanlineDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc) +FX_BOOL CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc) { m_pSrcBuf = src_buf; m_SrcSize = src_size; @@ -684,7 +686,7 @@ FX_BOOL CCodec_RLScanlineDecoder::v_Rewind() m_Operator = 0; return TRUE; } -FX_LPBYTE CCodec_RLScanlineDecoder::v_GetNextLine() +uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() { if (m_SrcOffset == 0) { GetNextOperator(); @@ -768,7 +770,7 @@ void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) count -= used_bytes; m_Operator = 257 - count; } -ICodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc) { CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder; diff --git a/core/src/fxcodec/codec/fx_codec_bmp.cpp b/core/src/fxcodec/codec/fx_codec_bmp.cpp index 924eaa91a4..554ce358e0 100644 --- a/core/src/fxcodec/codec/fx_codec_bmp.cpp +++ b/core/src/fxcodec/codec/fx_codec_bmp.cpp @@ -28,12 +28,12 @@ extern "C" { }
}
};
-static void _bmp_error_data(bmp_decompress_struct_p bmp_ptr, FX_LPCSTR err_msg)
+static void _bmp_error_data(bmp_decompress_struct_p bmp_ptr, const FX_CHAR* err_msg)
{
FXSYS_strncpy((char*)bmp_ptr->err_ptr, err_msg, BMP_MAX_ERROR_SIZE - 1);
longjmp(bmp_ptr->jmpbuf, 1);
}
-static void _bmp_read_scanline(bmp_decompress_struct_p bmp_ptr, int32_t row_num, FX_LPBYTE row_buf)
+static void _bmp_read_scanline(bmp_decompress_struct_p bmp_ptr, int32_t row_num, uint8_t* row_buf)
{
FXBMP_Context* p = (FXBMP_Context*)bmp_ptr->context_ptr;
CCodec_BmpModule* pModule = (CCodec_BmpModule*)p->parent_ptr;
@@ -112,13 +112,13 @@ int32_t CCodec_BmpModule::LoadImage(void* pContext) }
return _bmp_decode_image(p->bmp_ptr);
}
-FX_DWORD CCodec_BmpModule::GetAvailInput(void* pContext, FX_LPBYTE* avial_buf_ptr)
+FX_DWORD CCodec_BmpModule::GetAvailInput(void* pContext, uint8_t** avial_buf_ptr)
{
FXBMP_Context* p = (FXBMP_Context*)pContext;
return _bmp_get_avail_input(p->bmp_ptr, avial_buf_ptr);
}
-void CCodec_BmpModule::Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size)
+void CCodec_BmpModule::Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size)
{
FXBMP_Context* p = (FXBMP_Context*)pContext;
- _bmp_input_buffer(p->bmp_ptr, (FX_LPBYTE)src_buf, src_size);
+ _bmp_input_buffer(p->bmp_ptr, (uint8_t*)src_buf, src_size);
}
diff --git a/core/src/fxcodec/codec/fx_codec_fax.cpp b/core/src/fxcodec/codec/fx_codec_fax.cpp index 869751e05b..40502362d5 100644 --- a/core/src/fxcodec/codec/fx_codec_fax.cpp +++ b/core/src/fxcodec/codec/fx_codec_fax.cpp @@ -48,7 +48,7 @@ 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; + const uint8_t* leading_pos = bit ? OneLeadPos : ZeroLeadPos; if (start_pos % 8) { uint8_t data = data_buf[start_pos / 8]; if (bit) { @@ -100,7 +100,7 @@ void _FaxG4FindB1B2(const uint8_t* ref_buf, int columns, int a0, FX_BOOL a0color } b2 = _FindBit(ref_buf, columns, b1 + 1, first_bit); } -void _FaxFillBits(FX_LPBYTE dest_buf, int columns, int startpos, int endpos) +void _FaxFillBits(uint8_t* dest_buf, int columns, int startpos, int endpos) { if (startpos < 0) { startpos = 0; @@ -375,7 +375,7 @@ static const uint8_t FaxWhiteRunIns[] = { 0x1f, 2560 % 256, 2560 / 256, 0xff, }; -int _FaxGetRun(FX_LPCBYTE ins_array, const uint8_t* src_buf, int& bitpos, int bitsize) +int _FaxGetRun(const uint8_t* ins_array, const uint8_t* src_buf, int& bitpos, int bitsize) { FX_DWORD code = 0; int ins_off = 0; @@ -400,7 +400,7 @@ int _FaxGetRun(FX_LPCBYTE ins_array, const uint8_t* src_buf, int& bitpos, int bi } } } -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 _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, const uint8_t* ref_buf, int columns) { int a0 = -1, a0color = 1; while (1) { @@ -536,7 +536,7 @@ FX_BOOL _FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos) } return FALSE; } -FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns) +FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, int columns) { int color = TRUE; int startpos = 0; @@ -577,17 +577,18 @@ class CCodec_FaxDecoder : public CCodec_ScanlineDecoder public: CCodec_FaxDecoder(); virtual ~CCodec_FaxDecoder(); - FX_BOOL Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, + FX_BOOL Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows); virtual void v_DownScale(int dest_width, int dest_height) {} virtual FX_BOOL v_Rewind(); - virtual FX_LPBYTE v_GetNextLine(); + virtual uint8_t* v_GetNextLine(); virtual FX_DWORD GetSrcOffset(); int m_Encoding, m_bEndOfLine, m_bByteAlign, m_bBlack; int bitpos; - FX_LPCBYTE m_pSrcBuf; + const uint8_t* m_pSrcBuf; FX_DWORD m_SrcSize; - FX_LPBYTE m_pScanlineBuf, m_pRefBuf; + uint8_t* m_pScanlineBuf; + uint8_t* m_pRefBuf; }; CCodec_FaxDecoder::CCodec_FaxDecoder() { @@ -603,7 +604,7 @@ CCodec_FaxDecoder::~CCodec_FaxDecoder() FX_Free(m_pRefBuf); } } -FX_BOOL CCodec_FaxDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +FX_BOOL CCodec_FaxDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows) { m_Encoding = K; @@ -636,7 +637,7 @@ FX_BOOL CCodec_FaxDecoder::v_Rewind() bitpos = 0; return TRUE; } -FX_LPBYTE CCodec_FaxDecoder::v_GetNextLine() +uint8_t* CCodec_FaxDecoder::v_GetNextLine() { int bitsize = m_SrcSize * 8; _FaxSkipEOL(m_pSrcBuf, bitsize, bitpos); @@ -693,16 +694,16 @@ FX_DWORD CCodec_FaxDecoder::GetSrcOffset() return ret; } extern "C" { - void _FaxG4Decode(void*, FX_LPCBYTE src_buf, FX_DWORD src_size, int* pbitpos, FX_LPBYTE dest_buf, int width, int height, int pitch) + void _FaxG4Decode(void*, const uint8_t* src_buf, FX_DWORD src_size, int* pbitpos, uint8_t* dest_buf, int width, int height, int pitch) { if (pitch == 0) { pitch = (width + 7) / 8; } - FX_LPBYTE ref_buf = FX_Alloc(uint8_t, pitch); + uint8_t* ref_buf = FX_Alloc(uint8_t, pitch); FXSYS_memset8(ref_buf, 0xff, pitch); int bitpos = *pbitpos; for (int iRow = 0; iRow < height; iRow ++) { - FX_LPBYTE line_buf = dest_buf + iRow * pitch; + uint8_t* line_buf = dest_buf + iRow * pitch; FXSYS_memset8(line_buf, 0xff, pitch); _FaxG4GetRow(src_buf, src_size << 3, bitpos, line_buf, ref_buf, width); FXSYS_memcpy32(ref_buf, line_buf, pitch); @@ -836,7 +837,7 @@ static const uint8_t WhiteRunMarkup[80] = { 0x1e, 12, 0x1f, 12, }; -static void _AddBitStream(FX_LPBYTE dest_buf, int& dest_bitpos, int data, int bitlen) +static void _AddBitStream(uint8_t* dest_buf, int& dest_bitpos, int data, int bitlen) { for (int i = bitlen - 1; i >= 0; i --) { if (data & (1 << i)) { @@ -845,7 +846,7 @@ static void _AddBitStream(FX_LPBYTE dest_buf, int& dest_bitpos, int data, int bi dest_bitpos ++; } } -static void _FaxEncodeRun(FX_LPBYTE dest_buf, int& dest_bitpos, int run, FX_BOOL bWhite) +static void _FaxEncodeRun(uint8_t* dest_buf, int& dest_bitpos, int run, FX_BOOL bWhite) { while (run >= 2560) { _AddBitStream(dest_buf, dest_bitpos, 0x1f, 12); @@ -853,16 +854,16 @@ static void _FaxEncodeRun(FX_LPBYTE dest_buf, int& dest_bitpos, int run, FX_BOOL } if (run >= 64) { int markup = run - run % 64; - FX_LPCBYTE p = bWhite ? WhiteRunMarkup : BlackRunMarkup; + const uint8_t* p = bWhite ? WhiteRunMarkup : BlackRunMarkup; p += (markup / 64 - 1) * 2; _AddBitStream(dest_buf, dest_bitpos, *p, p[1]); } run %= 64; - FX_LPCBYTE p = bWhite ? WhiteRunTerminator : BlackRunTerminator; + const uint8_t* p = bWhite ? WhiteRunTerminator : BlackRunTerminator; p += run * 2; _AddBitStream(dest_buf, dest_bitpos, *p, p[1]); } -static void _FaxEncode2DLine(FX_LPBYTE dest_buf, int& dest_bitpos, FX_LPCBYTE src_buf, FX_LPCBYTE ref_buf, int cols) +static void _FaxEncode2DLine(uint8_t* dest_buf, int& dest_bitpos, const uint8_t* src_buf, const uint8_t* ref_buf, int cols) { int a0 = -1, a0color = 1; while (1) { @@ -920,16 +921,17 @@ static void _FaxEncode2DLine(FX_LPBYTE dest_buf, int& dest_bitpos, FX_LPCBYTE sr class CCodec_FaxEncoder { public: - CCodec_FaxEncoder(FX_LPCBYTE src_buf, int width, int height, int pitch); + CCodec_FaxEncoder(const uint8_t* src_buf, int width, int height, int pitch); ~CCodec_FaxEncoder(); - void Encode(FX_LPBYTE& dest_buf, FX_DWORD& dest_size); - void Encode2DLine(FX_LPCBYTE scan_line); + void Encode(uint8_t*& dest_buf, FX_DWORD& dest_size); + void Encode2DLine(const uint8_t* scan_line); CFX_BinaryBuf m_DestBuf; - FX_LPBYTE m_pRefLine, m_pLineBuf; + uint8_t* m_pRefLine; + uint8_t* m_pLineBuf; int m_Cols, m_Rows, m_Pitch; - FX_LPCBYTE m_pSrcBuf; + const uint8_t* m_pSrcBuf; }; -CCodec_FaxEncoder::CCodec_FaxEncoder(FX_LPCBYTE src_buf, int width, int height, int pitch) +CCodec_FaxEncoder::CCodec_FaxEncoder(const uint8_t* src_buf, int width, int height, int pitch) { m_pSrcBuf = src_buf; m_Cols = width; @@ -949,12 +951,12 @@ CCodec_FaxEncoder::~CCodec_FaxEncoder() FX_Free(m_pLineBuf); } } -void CCodec_FaxEncoder::Encode(FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +void CCodec_FaxEncoder::Encode(uint8_t*& dest_buf, FX_DWORD& dest_size) { int dest_bitpos = 0; uint8_t last_byte = 0; for (int i = 0; i < m_Rows; i ++) { - FX_LPCBYTE scan_line = m_pSrcBuf + i * m_Pitch; + const uint8_t* scan_line = m_pSrcBuf + i * m_Pitch; FXSYS_memset32(m_pLineBuf, 0, m_Pitch * 8); m_pLineBuf[0] = last_byte; _FaxEncode2DLine(m_pLineBuf, dest_bitpos, scan_line, m_pRefLine, m_Cols); @@ -970,13 +972,13 @@ void CCodec_FaxEncoder::Encode(FX_LPBYTE& dest_buf, FX_DWORD& dest_size) dest_size = m_DestBuf.GetSize(); m_DestBuf.DetachBuffer(); } -FX_BOOL CCodec_FaxModule::Encode(FX_LPCBYTE src_buf, int width, int height, int pitch, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +FX_BOOL CCodec_FaxModule::Encode(const uint8_t* src_buf, int width, int height, int pitch, uint8_t*& dest_buf, FX_DWORD& dest_size) { CCodec_FaxEncoder encoder(src_buf, width, height, pitch); encoder.Encode(dest_buf, dest_size); return TRUE; } -ICodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows) { CCodec_FaxDecoder* pDecoder = new CCodec_FaxDecoder; diff --git a/core/src/fxcodec/codec/fx_codec_flate.cpp b/core/src/fxcodec/codec/fx_codec_flate.cpp index 9997a570d6..2e6cf4e8db 100644 --- a/core/src/fxcodec/codec/fx_codec_flate.cpp +++ b/core/src/fxcodec/codec/fx_codec_flate.cpp @@ -79,11 +79,11 @@ extern "C" class CLZWDecoder { public: - FX_BOOL Decode(FX_LPBYTE output, FX_DWORD& outlen, const uint8_t* input, FX_DWORD& size, FX_BOOL bEarlyChange); + FX_BOOL Decode(uint8_t* 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; + uint8_t* m_pOutput; const uint8_t* m_pInput; FX_BOOL m_Early; void AddCode(FX_DWORD prefix_code, uint8_t append_char); @@ -127,7 +127,7 @@ void CLZWDecoder::DecodeString(FX_DWORD code) } m_DecodeStack[m_StackLen++] = (uint8_t)code; } -int CLZWDecoder::Decode(FX_LPBYTE dest_buf, FX_DWORD& dest_size, const uint8_t* src_buf, FX_DWORD& src_size, FX_BOOL bEarlyChange) +int CLZWDecoder::Decode(uint8_t* dest_buf, FX_DWORD& dest_size, const uint8_t* src_buf, FX_DWORD& src_size, FX_BOOL bEarlyChange) { m_CodeLen = 9; m_InPos = 0; @@ -231,7 +231,7 @@ static uint8_t PaethPredictor(int a, int b, int c) } return (uint8_t)c; } -static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, +static FX_BOOL PNG_PredictorEncode(uint8_t*& data_buf, FX_DWORD& data_size, int predictor, int Colors, int BitsPerComponent, int Columns) { @@ -241,10 +241,10 @@ 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(uint8_t, row_size + 1, row_count); + uint8_t* 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; + uint8_t* pSrcData = data_buf; + uint8_t* pDestData = dest_buf; for (int row = 0; row < row_count; row++) { if (predictor == 10) { pDestData[0] = 0; @@ -323,7 +323,7 @@ static FX_BOOL PNG_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, data_size = (row_size + 1) * row_count - (last_row_size > 0 ? (row_size - last_row_size) : 0); return TRUE; } -static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE pLastLine, +static void PNG_PredictLine(uint8_t* pDestData, const uint8_t* pSrcData, const uint8_t* pLastLine, int bpc, int nColors, int nPixels) { int row_size = (nPixels * bpc * nColors + 7) / 8; @@ -386,7 +386,7 @@ static void PNG_PredictLine(FX_LPBYTE pDestData, FX_LPCBYTE pSrcData, FX_LPCBYTE } } } -static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, +static FX_BOOL PNG_Predictor(uint8_t*& data_buf, FX_DWORD& data_size, int Colors, int BitsPerComponent, int Columns) { const int BytesPerPixel = (Colors * BitsPerComponent + 7) / 8; @@ -395,10 +395,10 @@ 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(uint8_t, row_size, row_count); + uint8_t* dest_buf = FX_Alloc2D(uint8_t, row_size, row_count); int byte_cnt = 0; - FX_LPBYTE pSrcData = data_buf; - FX_LPBYTE pDestData = dest_buf; + uint8_t* pSrcData = data_buf; + uint8_t* pDestData = dest_buf; for (int row = 0; row < row_count; row ++) { uint8_t tag = pSrcData[0]; byte_cnt++; @@ -474,7 +474,7 @@ static FX_BOOL PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, data_size = row_size * row_count - (last_row_size > 0 ? (row_size + 1 - last_row_size) : 0); return TRUE; } -static void TIFF_PredictorEncodeLine(FX_LPBYTE dest_buf, int row_size, int BitsPerComponent, int Colors, int Columns) +static void TIFF_PredictorEncodeLine(uint8_t* dest_buf, int row_size, int BitsPerComponent, int Colors, int Columns) { int BytesPerPixel = BitsPerComponent * Colors / 8; if (BitsPerComponent < 8) { @@ -511,7 +511,7 @@ static void TIFF_PredictorEncodeLine(FX_LPBYTE dest_buf, int row_size, int BitsP } } } -static FX_BOOL TIFF_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, +static FX_BOOL TIFF_PredictorEncode(uint8_t*& data_buf, FX_DWORD& data_size, int Colors, int BitsPerComponent, int Columns) { int row_size = (Colors * BitsPerComponent * Columns + 7) / 8; @@ -520,7 +520,7 @@ static FX_BOOL TIFF_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, const int row_count = (data_size + row_size - 1) / row_size; const int last_row_size = data_size % row_size; for (int row = 0; row < row_count; row++) { - FX_LPBYTE scan_line = data_buf + row * row_size; + uint8_t* scan_line = data_buf + row * row_size; if ((row + 1) * row_size > (int)data_size) { row_size = last_row_size; } @@ -528,7 +528,7 @@ static FX_BOOL TIFF_PredictorEncode(FX_LPBYTE& data_buf, FX_DWORD& data_size, } return TRUE; } -static void TIFF_PredictLine(FX_LPBYTE dest_buf, int row_size, int BitsPerComponent, int Colors, int Columns) +static void TIFF_PredictLine(uint8_t* dest_buf, int row_size, int BitsPerComponent, int Colors, int Columns) { if (BitsPerComponent == 1) { int row_bits = FX_MIN(BitsPerComponent * Colors * Columns, row_size * 8); @@ -561,7 +561,7 @@ static void TIFF_PredictLine(FX_LPBYTE dest_buf, int row_size, int BitsPerCompon } } } -static FX_BOOL TIFF_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, +static FX_BOOL TIFF_Predictor(uint8_t*& data_buf, FX_DWORD& data_size, int Colors, int BitsPerComponent, int Columns) { int row_size = (Colors * BitsPerComponent * Columns + 7) / 8; @@ -570,7 +570,7 @@ static FX_BOOL TIFF_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size, const int row_count = (data_size + row_size - 1) / row_size; const int last_row_size = data_size % row_size; for (int row = 0; row < row_count; row ++) { - FX_LPBYTE scan_line = data_buf + row * row_size; + uint8_t* scan_line = data_buf + row * row_size; if ((row + 1) * row_size > (int)data_size) { row_size = last_row_size; } @@ -583,7 +583,7 @@ class CCodec_FlateScanlineDecoder : public CCodec_ScanlineDecoder public: CCodec_FlateScanlineDecoder(); ~CCodec_FlateScanlineDecoder(); - void Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, + void Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, int predictor, int Colors, int BitsPerComponent, int Columns); virtual void Destroy() { @@ -591,15 +591,15 @@ public: } virtual void v_DownScale(int dest_width, int dest_height) {} virtual FX_BOOL v_Rewind(); - virtual FX_LPBYTE v_GetNextLine(); + virtual uint8_t* v_GetNextLine(); virtual FX_DWORD GetSrcOffset(); void* m_pFlate; - FX_LPCBYTE m_SrcBuf; + const uint8_t* m_SrcBuf; FX_DWORD m_SrcSize; - FX_LPBYTE m_pScanline; - FX_LPBYTE m_pLastLine; - FX_LPBYTE m_pPredictBuffer; - FX_LPBYTE m_pPredictRaw; + uint8_t* m_pScanline; + uint8_t* m_pLastLine; + uint8_t* m_pPredictBuffer; + uint8_t* m_pPredictRaw; int m_Predictor; int m_Colors, m_BitsPerComponent, m_Columns, m_PredictPitch, m_LeftOver; }; @@ -630,7 +630,7 @@ CCodec_FlateScanlineDecoder::~CCodec_FlateScanlineDecoder() FPDFAPI_FlateEnd(m_pFlate); } } -void CCodec_FlateScanlineDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, int predictor, int Colors, int BitsPerComponent, int Columns) { m_SrcBuf = src_buf; @@ -678,7 +678,7 @@ FX_BOOL CCodec_FlateScanlineDecoder::v_Rewind() m_LeftOver = 0; return TRUE; } -FX_LPBYTE CCodec_FlateScanlineDecoder::v_GetNextLine() +uint8_t* CCodec_FlateScanlineDecoder::v_GetNextLine() { if (m_Predictor) { if (m_Pitch == m_PredictPitch) { @@ -722,8 +722,8 @@ FX_DWORD CCodec_FlateScanlineDecoder::GetSrcOffset() { return FPDFAPI_FlateGetTotalIn(m_pFlate); } -static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig_size, - FX_LPBYTE& dest_buf, FX_DWORD& dest_size, FX_DWORD& offset) +static void FlateUncompress(const uint8_t* src_buf, FX_DWORD src_size, FX_DWORD orig_size, + uint8_t*& dest_buf, FX_DWORD& dest_size, FX_DWORD& offset) { const FX_BOOL useOldImpl = src_size < 10240; FX_DWORD guess_size = orig_size ? orig_size : src_size * 2; @@ -737,8 +737,8 @@ 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(uint8_t, guess_size + 1); - FX_LPBYTE cur_buf = guess_buf; + uint8_t* guess_buf = FX_Alloc(uint8_t, guess_size + 1); + uint8_t* cur_buf = guess_buf; guess_buf[guess_size] = '\0'; context = FPDFAPI_FlateInit(my_alloc_func, my_free_func); if (!context) @@ -776,7 +776,7 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig } dest_buf = guess_buf; } else { - CFX_ArrayTemplate<FX_LPBYTE> result_tmp_bufs; + CFX_ArrayTemplate<uint8_t*> result_tmp_bufs; while (1) { int32_t ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size); int32_t avail_buf_size = FPDFAPI_FlateGetAvailOut(context); @@ -801,10 +801,10 @@ 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(uint8_t, dest_size); + uint8_t* result_buf = FX_Alloc(uint8_t, dest_size); FX_DWORD result_pos = 0; for (int32_t i = 0; i < result_tmp_bufs.GetSize(); i++) { - FX_LPBYTE tmp_buf = result_tmp_bufs[i]; + uint8_t* tmp_buf = result_tmp_bufs[i]; FX_DWORD tmp_buf_size = buf_size; if (i == result_tmp_bufs.GetSize() - 1) { tmp_buf_size = last_buf_size; @@ -825,7 +825,7 @@ fail: dest_size = 0; return; } -ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, int predictor, int Colors, int BitsPerComponent, int Columns) { CCodec_FlateScanlineDecoder* pDecoder = new CCodec_FlateScanlineDecoder; @@ -834,7 +834,7 @@ ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(FX_LPCBYTE src_buf, FX } 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) + FX_DWORD estimated_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { dest_buf = NULL; FX_DWORD offset = 0; @@ -881,12 +881,12 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_b } 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) + uint8_t*& dest_buf, FX_DWORD& dest_size) { if (predictor != 2 && predictor < 10) { return Encode(src_buf, src_size, dest_buf, dest_size); } - FX_LPBYTE pSrcBuf = NULL; + uint8_t* pSrcBuf = NULL; pSrcBuf = FX_Alloc(uint8_t, src_size); FXSYS_memcpy32(pSrcBuf, src_buf, src_size); FX_BOOL ret = TRUE; @@ -902,7 +902,7 @@ FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_Free(pSrcBuf); return ret; } -FX_BOOL CCodec_FlateModule::Encode(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { dest_size = src_size + src_size / 1000 + 12; dest_buf = FX_Alloc( uint8_t, dest_size); diff --git a/core/src/fxcodec/codec/fx_codec_gif.cpp b/core/src/fxcodec/codec/fx_codec_gif.cpp index 218b58a946..d22c156fdb 100644 --- a/core/src/fxcodec/codec/fx_codec_gif.cpp +++ b/core/src/fxcodec/codec/fx_codec_gif.cpp @@ -28,12 +28,12 @@ extern "C" { }
}
};
-static void _gif_error_data(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg)
+static void _gif_error_data(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg)
{
FXSYS_strncpy((char*)gif_ptr->err_ptr, err_msg, GIF_MAX_ERROR_SIZE - 1);
longjmp(gif_ptr->jmpbuf, 1);
}
-static FX_LPBYTE _gif_ask_buf_for_pal(gif_decompress_struct_p gif_ptr, int32_t pal_size)
+static uint8_t* _gif_ask_buf_for_pal(gif_decompress_struct_p gif_ptr, int32_t pal_size)
{
FXGIF_Context* p = (FXGIF_Context*)gif_ptr->context_ptr;
CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr;
@@ -47,7 +47,7 @@ static void _gif_record_current_position(gif_decompress_struct_p gif_ptr, FX_DWO CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr;
pModule->RecordCurrentPositionCallback(p->child_ptr, *cur_pos_ptr);
}
-static void _gif_read_scanline(gif_decompress_struct_p gif_ptr, int32_t row_num, FX_LPBYTE row_buf)
+static void _gif_read_scanline(gif_decompress_struct_p gif_ptr, int32_t row_num, uint8_t* row_buf)
{
FXGIF_Context* p = (FXGIF_Context*)gif_ptr->context_ptr;
CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr;
@@ -144,7 +144,7 @@ int32_t CCodec_GifModule::LoadFrame(void* pContext, int frame_num, CFX_DIBAttrib pAttribute->m_nGifTop = p->gif_ptr->img_ptr_arr_ptr->GetAt(frame_num)->image_info_ptr->top;
pAttribute->m_fAspectRatio = p->gif_ptr->pixel_aspect;
if (p->gif_ptr->cmt_data_ptr) {
- FX_LPCBYTE buf = (FX_LPCBYTE)p->gif_ptr->cmt_data_ptr->GetBuffer(0);
+ const uint8_t* buf = (const uint8_t*)p->gif_ptr->cmt_data_ptr->GetBuffer(0);
FX_DWORD len = p->gif_ptr->cmt_data_ptr->GetLength();
if (len > 21) {
uint8_t size = *buf++;
@@ -164,13 +164,13 @@ int32_t CCodec_GifModule::LoadFrame(void* pContext, int frame_num, CFX_DIBAttrib }
return ret;
}
-FX_DWORD CCodec_GifModule::GetAvailInput(void* pContext, FX_LPBYTE* avial_buf_ptr)
+FX_DWORD CCodec_GifModule::GetAvailInput(void* pContext, uint8_t** avial_buf_ptr)
{
FXGIF_Context* p = (FXGIF_Context*)pContext;
return _gif_get_avail_input(p->gif_ptr, avial_buf_ptr);
}
-void CCodec_GifModule::Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size)
+void CCodec_GifModule::Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size)
{
FXGIF_Context* p = (FXGIF_Context*)pContext;
- _gif_input_buffer(p->gif_ptr, (FX_LPBYTE)src_buf, src_size);
+ _gif_input_buffer(p->gif_ptr, (uint8_t*)src_buf, src_size);
}
diff --git a/core/src/fxcodec/codec/fx_codec_icc.cpp b/core/src/fxcodec/codec/fx_codec_icc.cpp index cde5d4c1bd..6fe92ff240 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, uint8_t ID[16] ) +FX_BOOL MD5ComputeID( const void* buf, FX_DWORD dwSize, uint8_t ID[16] ) { return cmsMD5computeIDExt(buf, dwSize, ID); } @@ -218,7 +218,7 @@ void IccLib_TranslateImage(void* pTransform, unsigned char* pDest, const unsigne { cmsDoTransform(((CLcmsCmm*)pTransform)->m_hTransform, (void*)pSrc, pDest, pixels); } -FX_LPVOID CreateProfile_Gray(double gamma) +void* CreateProfile_Gray(double gamma) { cmsCIExyY* D50 = (cmsCIExyY*)cmsD50_xyY(); if (!cmsWhitePointFromTemp(D50, 6504)) { @@ -228,11 +228,11 @@ FX_LPVOID CreateProfile_Gray(double gamma) if (curve == NULL) { return NULL; } - FX_LPVOID profile = cmsCreateGrayProfile(D50, curve); + void* profile = cmsCreateGrayProfile(D50, curve); cmsFreeToneCurve(curve); return profile; } -ICodec_IccModule::IccCS GetProfileCSFromHandle(FX_LPVOID pProfile) +ICodec_IccModule::IccCS GetProfileCSFromHandle(void* pProfile) { if (pProfile == NULL) { return ICodec_IccModule::IccCS_Unknown; @@ -264,7 +264,7 @@ ICodec_IccModule::IccCS GetProfileCSFromHandle(FX_LPVOID pProfile) return ICodec_IccModule::IccCS_Unknown; } } -ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize) +ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS(const uint8_t* pProfileData, FX_DWORD dwProfileSize) { ICodec_IccModule::IccCS cs; cmsHPROFILE hProfile = cmsOpenProfileFromMem((void*)pProfileData, dwProfileSize); @@ -284,13 +284,13 @@ 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(uint8_t, dwSize); + uint8_t* pBuf = FX_Alloc(uint8_t, dwSize); pFile->ReadBlock(pBuf, 0, dwSize); cs = GetProfileCS(pBuf, dwSize); FX_Free(pBuf); return cs; } -FX_DWORD TransferProfileType(FX_LPVOID pProfile, FX_DWORD dwFormat) +FX_DWORD TransferProfileType(void* pProfile, FX_DWORD dwFormat) { cmsColorSpaceSignature cs = cmsGetColorSpace(pProfile); switch (cs) { @@ -341,7 +341,7 @@ class CFX_IccProfileCache public: CFX_IccProfileCache(); ~CFX_IccProfileCache(); - FX_LPVOID m_pProfile; + void* m_pProfile; FX_DWORD m_dwRate; protected: void Purge(); @@ -365,7 +365,7 @@ class CFX_IccTransformCache public: CFX_IccTransformCache(CLcmsCmm* pCmm = NULL); ~CFX_IccTransformCache(); - FX_LPVOID m_pIccTransform; + void* m_pIccTransform; FX_DWORD m_dwRate; CLcmsCmm* m_pCmm; protected: @@ -400,7 +400,7 @@ CFX_ByteStringKey& CFX_ByteStringKey::operator << (FX_DWORD i) AppendBlock(&i, sizeof(FX_DWORD)); return *this; } -FX_LPVOID CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, Icc_CLASS ic, CFX_BinaryBuf* pTransformKey) +void* CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, Icc_CLASS ic, CFX_BinaryBuf* pTransformKey) { CFX_IccProfileCache* pCache = NULL; CFX_ByteStringKey key; @@ -431,7 +431,7 @@ FX_LPVOID CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, CFX_ByteString ProfileKey(key.GetBuffer(), key.GetSize()); ASSERT(pTransformKey); pTransformKey->AppendBlock(ProfileKey.GetBuffer(0), ProfileKey.GetLength()); - if (!m_MapProfile.Lookup(ProfileKey, (FX_LPVOID&)pCache)) { + if (!m_MapProfile.Lookup(ProfileKey, (void*&)pCache)) { pCache = new CFX_IccProfileCache; switch (pIccParam->dwProfileType) { case Icc_PARAMTYPE_BUFFER: @@ -458,7 +458,7 @@ FX_LPVOID CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, } return pCache->m_pProfile; } -FX_LPVOID CCodec_IccModule::CreateTransform(ICodec_IccModule::IccParam* pInputParam, +void* CCodec_IccModule::CreateTransform(ICodec_IccModule::IccParam* pInputParam, ICodec_IccModule::IccParam* pOutputParam, ICodec_IccModule::IccParam* pProofParam, FX_DWORD dwIntent, FX_DWORD dwFlag, FX_DWORD dwPrfIntent, FX_DWORD dwPrfFlag) @@ -466,11 +466,11 @@ FX_LPVOID CCodec_IccModule::CreateTransform(ICodec_IccModule::IccParam* pInputPa CLcmsCmm* pCmm = NULL; ASSERT(pInputParam && pOutputParam); CFX_ByteStringKey key; - FX_LPVOID pInputProfile = CreateProfile(pInputParam, Icc_CLASS_INPUT, &key); + void* pInputProfile = CreateProfile(pInputParam, Icc_CLASS_INPUT, &key); if (pInputProfile == NULL) { return NULL; } - FX_LPVOID pOutputProfile = CreateProfile(pOutputParam, Icc_CLASS_OUTPUT, &key); + void* pOutputProfile = CreateProfile(pOutputParam, Icc_CLASS_OUTPUT, &key); if (pOutputProfile == NULL) { return NULL; } @@ -479,14 +479,14 @@ FX_LPVOID CCodec_IccModule::CreateTransform(ICodec_IccModule::IccParam* pInputPa if (dwInputProfileType == 0 || dwOutputProfileType == 0) { return NULL; } - FX_LPVOID pProofProfile = NULL; + void* pProofProfile = NULL; if (pProofParam) { pProofProfile = CreateProfile(pProofParam, Icc_CLASS_PROOF, &key); } key << dwInputProfileType << dwOutputProfileType << dwIntent << dwFlag << (pProofProfile != NULL) << dwPrfIntent << dwPrfFlag; CFX_ByteStringC TransformKey(key.GetBuffer(), key.GetSize()); CFX_IccTransformCache* pTransformCache; - if (!m_MapTranform.Lookup(TransformKey, (FX_LPVOID&)pTransformCache)) { + if (!m_MapTranform.Lookup(TransformKey, (void*&)pTransformCache)) { pCmm = FX_Alloc(CLcmsCmm, 1); pCmm->m_nSrcComponents = T_CHANNELS(dwInputProfileType); pCmm->m_nDstComponents = T_CHANNELS(dwOutputProfileType); @@ -512,7 +512,7 @@ CCodec_IccModule::~CCodec_IccModule() CFX_ByteString key; CFX_IccProfileCache* pProfileCache; while (pos) { - m_MapProfile.GetNextAssoc(pos, key, (FX_LPVOID&)pProfileCache); + m_MapProfile.GetNextAssoc(pos, key, (void*&)pProfileCache); if (pProfileCache) { delete pProfileCache; } @@ -520,18 +520,18 @@ CCodec_IccModule::~CCodec_IccModule() pos = m_MapTranform.GetStartPosition(); CFX_IccTransformCache* pTransformCache; while (pos) { - m_MapTranform.GetNextAssoc(pos, key, (FX_LPVOID&)pTransformCache); + m_MapTranform.GetNextAssoc(pos, key, (void*&)pTransformCache); if (pTransformCache) { delete pTransformCache; } } } -void* CCodec_IccModule::CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent, FX_DWORD dwSrcFormat) +void* CCodec_IccModule::CreateTransform_sRGB(const uint8_t* 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, int32_t& nSrcComponents, - FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent, +void* CCodec_IccModule::CreateTransform_CMYK(const uint8_t* pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents, + const uint8_t* pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent, FX_DWORD dwSrcFormat , FX_DWORD dwDstFormat) { return IccLib_CreateTransform(pSrcProfileData, dwSrcProfileSize, nSrcComponents, @@ -545,7 +545,7 @@ 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, int32_t pixels) +void CCodec_IccModule::TranslateScanline(void* pTransform, uint8_t* pDest, const uint8_t* pSrc, int32_t pixels) { IccLib_TranslateImage(pTransform, pDest, pSrc, pixels); } diff --git a/core/src/fxcodec/codec/fx_codec_jbig.cpp b/core/src/fxcodec/codec/fx_codec_jbig.cpp index 622448d659..b908915227 100644 --- a/core/src/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/src/fxcodec/codec/fx_codec_jbig.cpp @@ -25,12 +25,12 @@ void CCodec_Jbig2Module::DestroyJbig2Context(void* pJbig2Content) } pJbig2Content = NULL; } -FX_BOOL CCodec_Jbig2Module::Decode(FX_DWORD width, FX_DWORD height, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPCBYTE global_data, FX_DWORD global_size, FX_LPBYTE dest_buf, FX_DWORD dest_pitch) +FX_BOOL CCodec_Jbig2Module::Decode(FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, + const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch) { FXSYS_memset32(dest_buf, 0, height * dest_pitch); CJBig2_Context* pContext = CJBig2_Context::CreateContext(&m_Module, - (FX_LPBYTE)global_data, global_size, (FX_LPBYTE)src_buf, src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache); + (uint8_t*)global_data, global_size, (uint8_t*)src_buf, src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache); if (pContext == NULL) { return FALSE; } @@ -47,12 +47,12 @@ FX_BOOL CCodec_Jbig2Module::Decode(FX_DWORD width, FX_DWORD height, FX_LPCBYTE s return TRUE; } FX_BOOL CCodec_Jbig2Module::Decode(IFX_FileRead* file_ptr, - FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, FX_LPBYTE& dest_buf) + FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf) { CJBig2_Context* pContext = NULL; CJBig2_Image* dest_image = NULL; FX_DWORD src_size = (FX_DWORD)file_ptr->GetSize(); - FX_LPBYTE src_buf = FX_Alloc(uint8_t, src_size); + uint8_t* src_buf = FX_Alloc(uint8_t, src_size); int ret = 0; if(!file_ptr->ReadBlock(src_buf, 0, src_size)) { goto failed; @@ -80,8 +80,8 @@ failed: } return FALSE; } -FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, FX_LPCBYTE src_buf, FX_DWORD src_size, - FX_LPCBYTE global_data, FX_DWORD global_size, FX_LPBYTE dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause) +FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, + const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause) { if(!pJbig2Context) { return FXCODEC_STATUS_ERR_PARAMS; @@ -99,7 +99,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, FX_DWORD wid m_pJbig2Context->m_bFileReader = FALSE; FXSYS_memset32(dest_buf, 0, height * dest_pitch); m_pJbig2Context->m_pContext = CJBig2_Context::CreateContext(&m_Module, - (FX_LPBYTE)global_data, global_size, (FX_LPBYTE)src_buf, src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache, pPause); + (uint8_t*)global_data, global_size, (uint8_t*)src_buf, src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache, pPause); if(!m_pJbig2Context->m_pContext) { return FXCODEC_STATUS_ERROR; } @@ -120,7 +120,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, FX_DWORD wid return m_pJbig2Context->m_pContext->GetProcessiveStatus(); } FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, IFX_FileRead* file_ptr, - FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, FX_LPBYTE& dest_buf, IFX_Pause* pPause) + FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf, IFX_Pause* pPause) { if(!pJbig2Context) { return FXCODEC_STATUS_ERR_PARAMS; diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp index 4d06a77067..df0ef5e9b6 100644 --- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp @@ -86,14 +86,14 @@ static FX_BOOL _JpegIsIccMarker(jpeg_saved_marker_ptr marker) } return FALSE; } -static FX_BOOL _JpegLoadIccProfile(j_decompress_ptr cinfo, FX_LPBYTE* icc_buf_ptr, FX_DWORD* icc_length) +static FX_BOOL _JpegLoadIccProfile(j_decompress_ptr cinfo, uint8_t** icc_buf_ptr, FX_DWORD* icc_length) { if(icc_buf_ptr == NULL || icc_length == NULL) { return FALSE; } *icc_buf_ptr = NULL; *icc_length = 0; - FX_LPBYTE icc_data_ptr = NULL; + uint8_t* icc_data_ptr = NULL; FX_DWORD icc_data_len = 0; uint8_t count_icc_marker = 0; uint8_t num_icc_marker = 0; @@ -139,7 +139,7 @@ static FX_BOOL _JpegLoadIccProfile(j_decompress_ptr cinfo, FX_LPBYTE* icc_buf_pt } return TRUE; } -static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo, FX_LPCBYTE icc_buf_ptr, FX_DWORD icc_length) +static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo, const uint8_t* icc_buf_ptr, FX_DWORD icc_length) { if(icc_buf_ptr == NULL || icc_length == 0) { return FALSE; @@ -150,7 +150,7 @@ 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(uint8_t, icc_data_length); + uint8_t* 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] = (uint8_t)icc_segment_num; for (uint8_t i = 0; i < (icc_segment_num - 1); i++) { @@ -175,7 +175,7 @@ extern "C" { } }; #define JPEG_BLOCK_SIZE 1048576 -static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_STRSIZE& dest_size, int quality, FX_LPCBYTE icc_buf, FX_DWORD icc_length) +static void _JpegEncode(const CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, FX_DWORD icc_length) { struct jpeg_error_mgr jerr; jerr.error_exit = _error_do_nothing; @@ -233,7 +233,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST } else { cinfo.in_color_space = JCS_CMYK; } - FX_LPBYTE line_buf = NULL; + uint8_t* line_buf = NULL; if (nComponents > 1) { line_buf = FX_Alloc2D(uint8_t, width, nComponents); } @@ -246,9 +246,9 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST JSAMPROW row_pointer[1]; JDIMENSION row; while (cinfo.next_scanline < cinfo.image_height) { - FX_LPCBYTE src_scan = pSource->GetScanline(cinfo.next_scanline); + const uint8_t* src_scan = pSource->GetScanline(cinfo.next_scanline); if (nComponents > 1) { - FX_LPBYTE dest_scan = line_buf; + uint8_t* dest_scan = line_buf; if (nComponents == 3) { for (int i = 0; i < width; i ++) { dest_scan[0] = src_scan[2]; @@ -264,7 +264,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_ST } row_pointer[0] = line_buf; } else { - row_pointer[0] = (FX_LPBYTE)src_scan; + row_pointer[0] = (uint8_t*)src_scan; } row = cinfo.next_scanline; jpeg_write_scanlines(&cinfo, row_pointer, 1); @@ -293,9 +293,9 @@ static void _JpegLoadAttribute(struct jpeg_decompress_struct* pInfo, CFX_DIBAttr pAttribute->m_wDPIUnit = pInfo->density_unit; } } -static FX_BOOL _JpegLoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int& width, int& height, +static FX_BOOL _JpegLoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height, int& num_components, int& bits_per_components, FX_BOOL& color_transform, - FX_LPBYTE* icc_buf_ptr, FX_DWORD* icc_length) + uint8_t** icc_buf_ptr, FX_DWORD* icc_length) { _JpegScanSOI(src_buf, src_size); struct jpeg_decompress_struct cinfo; @@ -353,7 +353,7 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder public: CCodec_JpegDecoder(); ~CCodec_JpegDecoder(); - FX_BOOL Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, + FX_BOOL Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, FX_BOOL ColorTransform, IFX_JpegProvider* pJP); virtual void Destroy() { @@ -361,15 +361,15 @@ public: } virtual void v_DownScale(int dest_width, int dest_height); virtual FX_BOOL v_Rewind(); - virtual FX_LPBYTE v_GetNextLine(); + virtual uint8_t* v_GetNextLine(); virtual FX_DWORD GetSrcOffset(); jmp_buf m_JmpBuf; struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr; struct jpeg_source_mgr src; - FX_LPCBYTE m_SrcBuf; + const uint8_t* m_SrcBuf; FX_DWORD m_SrcSize; - FX_LPBYTE m_pScanlineBuf; + uint8_t* m_pScanlineBuf; FX_BOOL InitDecode(); FX_BOOL m_bInited, m_bStarted, m_bJpegTransform; protected: @@ -439,7 +439,7 @@ FX_BOOL CCodec_JpegDecoder::InitDecode() m_nDefaultScaleDenom = cinfo.scale_denom; return TRUE; } -FX_BOOL CCodec_JpegDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +FX_BOOL CCodec_JpegDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, FX_BOOL ColorTransform, IFX_JpegProvider* pJP) { if (pJP) { @@ -462,8 +462,8 @@ FX_BOOL CCodec_JpegDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int wi src.resync_to_restart = _src_resync; m_bJpegTransform = ColorTransform; if(src_size > 1 && FXSYS_memcmp32(src_buf + src_size - 2, "\xFF\xD9", 2) != 0) { - ((FX_LPBYTE)src_buf)[src_size - 2] = 0xFF; - ((FX_LPBYTE)src_buf)[src_size - 1] = 0xD9; + ((uint8_t*)src_buf)[src_size - 2] = 0xFF; + ((uint8_t*)src_buf)[src_size - 1] = 0xD9; } m_OutputWidth = m_OrigWidth = width; m_OutputHeight = m_OrigHeight = height; @@ -543,7 +543,7 @@ FX_BOOL CCodec_JpegDecoder::v_Rewind() m_bStarted = TRUE; return TRUE; } -FX_LPBYTE CCodec_JpegDecoder::v_GetNextLine() +uint8_t* CCodec_JpegDecoder::v_GetNextLine() { if (m_pExtProvider) { return m_pExtProvider->GetNextLine(m_pExtContext); @@ -561,7 +561,7 @@ FX_DWORD CCodec_JpegDecoder::GetSrcOffset() } return (FX_DWORD)(m_SrcSize - src.bytes_in_buffer); } -ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, +ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, FX_BOOL ColorTransform) { if (src_buf == NULL || src_size == 0) { @@ -574,9 +574,9 @@ ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(FX_LPCBYTE src_buf, FX_ } return pDecoder; } -FX_BOOL CCodec_JpegModule::LoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int& width, int& height, +FX_BOOL CCodec_JpegModule::LoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height, int& num_components, int& bits_per_components, FX_BOOL& color_transform, - FX_LPBYTE* icc_buf_ptr, FX_DWORD* icc_length) + uint8_t** icc_buf_ptr, FX_DWORD* icc_length) { if (m_pExtProvider) { return m_pExtProvider->LoadInfo(src_buf, src_size, width, height, @@ -585,7 +585,7 @@ FX_BOOL CCodec_JpegModule::LoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int& } return _JpegLoadInfo(src_buf, src_size, width, height, num_components, bits_per_components, color_transform, icc_buf_ptr, icc_length); } -FX_BOOL CCodec_JpegModule::Encode(const CFX_DIBSource* pSource, FX_LPBYTE& dest_buf, FX_STRSIZE& dest_size, int quality, FX_LPCBYTE icc_buf, FX_DWORD icc_length) +FX_BOOL CCodec_JpegModule::Encode(const CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, FX_DWORD icc_length) { if (m_pExtProvider) { return m_pExtProvider->Encode(pSource, dest_buf, dest_size, quality, icc_buf, icc_length); @@ -736,7 +736,7 @@ FX_BOOL CCodec_JpegModule::ReadScanline(void* pContext, unsigned char* dest_buf) int nlines = jpeg_read_scanlines(&p->m_Info, &dest_buf, 1); return nlines == 1; } -FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr) +FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) { if (m_pExtProvider) { return m_pExtProvider->GetAvailInput(pContext, avail_buf_ptr); @@ -744,7 +744,7 @@ FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_p if(avail_buf_ptr != NULL) { *avail_buf_ptr = NULL; if(((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) { - *avail_buf_ptr = (FX_LPBYTE)((FXJPEG_Context*)pContext)->m_SrcMgr.next_input_byte; + *avail_buf_ptr = (uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.next_input_byte; } } return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; diff --git a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp index 01faf67a30..312ce78759 100644 --- a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp @@ -589,8 +589,8 @@ public: ~CJPX_Decoder(); FX_BOOL Init(const unsigned char* src_data, int src_size); void GetInfo(FX_DWORD& width, FX_DWORD& height, FX_DWORD& codestream_nComps, FX_DWORD& output_nComps); - FX_BOOL Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateColor, FX_LPBYTE offsets); - FX_LPCBYTE m_SrcData; + FX_BOOL Decode(uint8_t* dest_buf, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets); + const uint8_t* m_SrcData; int m_SrcSize; opj_image_t *image; opj_codec_t* l_codec; @@ -702,10 +702,12 @@ void CJPX_Decoder::GetInfo(FX_DWORD& width, FX_DWORD& height, FX_DWORD& codestre height = (FX_DWORD)image->y1; output_nComps = codestream_nComps = (FX_DWORD)image->numcomps; } -FX_BOOL CJPX_Decoder::Decode(FX_LPBYTE dest_buf, int pitch, FX_BOOL bTranslateColor, FX_LPBYTE offsets) +FX_BOOL CJPX_Decoder::Decode(uint8_t* dest_buf, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets) { int i, wid, hei, row, col, channel, src; - FX_LPBYTE pChannel, pScanline, pPixel; + uint8_t* pChannel; + uint8_t* pScanline; + uint8_t* pPixel; if(image->comps[0].w != image->x1 || image->comps[0].h != image->y1) { return FALSE; @@ -784,7 +786,7 @@ void initialize_sign_lut(); CCodec_JpxModule::CCodec_JpxModule() { } -void* CCodec_JpxModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size , FX_BOOL useColorSpace) +void* CCodec_JpxModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size , FX_BOOL useColorSpace) { CJPX_Decoder* pDecoder = new CJPX_Decoder; pDecoder->m_useColorSpace = useColorSpace; @@ -794,13 +796,13 @@ void* CCodec_JpxModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size , FX } return pDecoder; } -void CCodec_JpxModule::GetImageInfo(FX_LPVOID ctx, FX_DWORD& width, FX_DWORD& height, +void CCodec_JpxModule::GetImageInfo(void* ctx, FX_DWORD& width, FX_DWORD& height, FX_DWORD& codestream_nComps, FX_DWORD& output_nComps) { CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; pDecoder->GetInfo(width, height, codestream_nComps, output_nComps); } -FX_BOOL CCodec_JpxModule::Decode(void* ctx, FX_LPBYTE dest_data, int pitch, FX_BOOL bTranslateColor, FX_LPBYTE offsets) +FX_BOOL CCodec_JpxModule::Decode(void* ctx, uint8_t* dest_data, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets) { CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; return pDecoder->Decode(dest_data, pitch, bTranslateColor, offsets); diff --git a/core/src/fxcodec/codec/fx_codec_png.cpp b/core/src/fxcodec/codec/fx_codec_png.cpp index 8cb24ba2fa..55d66a3ccf 100644 --- a/core/src/fxcodec/codec/fx_codec_png.cpp +++ b/core/src/fxcodec/codec/fx_codec_png.cpp @@ -51,7 +51,7 @@ static void _png_load_bmp_attribute(png_structp png_ptr, png_infop info_ptr, CFX png_get_tIME(png_ptr, info_ptr, &t);
if (t) {
FXSYS_memset32(pAttribute->m_strTime, 0, sizeof(pAttribute->m_strTime));
- FXSYS_snprintf((FX_LPSTR)pAttribute->m_strTime, sizeof(pAttribute->m_strTime), "%4d:%2d:%2d %2d:%2d:%2d",
+ FXSYS_snprintf((FX_CHAR*)pAttribute->m_strTime, sizeof(pAttribute->m_strTime), "%4d:%2d:%2d %2d:%2d:%2d",
t->year, t->month, t->day, t->hour, t->minute, t->second);
pAttribute->m_strTime[sizeof(pAttribute->m_strTime) - 1] = 0;
bTime = 1;
@@ -60,7 +60,7 @@ static void _png_load_bmp_attribute(png_structp png_ptr, png_infop info_ptr, CFX #if defined(PNG_TEXT_SUPPORTED)
int i;
FX_DWORD len;
- FX_LPCSTR buf;
+ const FX_CHAR* buf;
int num_text;
png_textp text = NULL;
png_get_text(png_ptr, info_ptr, &text, &num_text);
@@ -77,7 +77,7 @@ static void _png_load_bmp_attribute(png_structp png_ptr, png_infop info_ptr, CFX buf = "Author";
if (!FXSYS_memcmp32(buf, text[i].key, FX_MIN(len, FXSYS_strlen(buf)))) {
pAttribute->m_strAuthor.Empty();
- pAttribute->m_strAuthor.Load((FX_LPBYTE)text[i].text, (FX_STRSIZE)text[i].text_length);
+ pAttribute->m_strAuthor.Load((uint8_t*)text[i].text, (FX_STRSIZE)text[i].text_length);
}
}
}
@@ -180,7 +180,7 @@ static void _png_get_row_func(png_structp png_ptr, png_bytep new_row, png_uint_3 return;
}
CCodec_PngModule* pModule = (CCodec_PngModule*)p->parent_ptr;
- FX_LPBYTE src_buf = NULL;
+ uint8_t* src_buf = NULL;
if(!pModule->AskScanlineBufCallback(p->child_ptr, row_num, src_buf)) {
png_error(png_ptr, "Ask Scanline buffer Callback Error");
}
@@ -234,7 +234,7 @@ void CCodec_PngModule::Finish(void* pContext) p->m_FreeFunc(p);
}
}
-FX_BOOL CCodec_PngModule::Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_DIBAttribute* pAttribute)
+FX_BOOL CCodec_PngModule::Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size, CFX_DIBAttribute* pAttribute)
{
FXPNG_Context* p = (FXPNG_Context*)pContext;
if(setjmp(png_jmpbuf(p->png_ptr))) {
@@ -243,6 +243,6 @@ FX_BOOL CCodec_PngModule::Input(void* pContext, FX_LPCBYTE src_buf, FX_DWORD src }
return FALSE;
}
- png_process_data(p->png_ptr, p->info_ptr, (FX_LPBYTE)src_buf, src_size);
+ png_process_data(p->png_ptr, p->info_ptr, (uint8_t*)src_buf, src_size);
return TRUE;
}
diff --git a/core/src/fxcodec/codec/fx_codec_progress.cpp b/core/src/fxcodec/codec/fx_codec_progress.cpp index d6ef06311c..da64eed42f 100644 --- a/core/src/fxcodec/codec/fx_codec_progress.cpp +++ b/core/src/fxcodec/codec/fx_codec_progress.cpp @@ -350,7 +350,7 @@ FX_BOOL CCodec_ProgressiveDecoder::PngReadHeaderFunc(void* pModule, int width, i *gamma = FXCODEC_PNG_GAMMA;
return TRUE;
}
-FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line, FX_LPBYTE& src_buf)
+FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line, uint8_t*& src_buf)
{
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
CFX_DIBitmap* pDIBitmap = pCodec->m_pDeviceBitmap;
@@ -361,8 +361,8 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line if(line >= pCodec->m_clipBox.top && line < pCodec->m_clipBox.bottom) {
double scale_y = (double)pCodec->m_sizeY / (double)pCodec->m_clipBox.Height();
int32_t row = (int32_t)((line - pCodec->m_clipBox.top) * scale_y) + pCodec->m_startY;
- FX_LPBYTE src_scan = (FX_LPBYTE)pDIBitmap->GetScanline(row);
- FX_LPBYTE des_scan = pCodec->m_pDecodeBuf;
+ uint8_t* src_scan = (uint8_t*)pDIBitmap->GetScanline(row);
+ uint8_t* des_scan = pCodec->m_pDecodeBuf;
src_buf = pCodec->m_pDecodeBuf;
int32_t src_Bpp = pDIBitmap->GetBPP() >> 3;
int32_t des_Bpp = (pCodec->m_SrcFormat & 0xff) >> 3;
@@ -393,11 +393,11 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line case FXDIB_Rgb:
case FXDIB_Rgb32: {
FX_DWORD des_b = 0, des_g = 0, des_r = 0;
- FX_LPCBYTE p = src_scan + src_col * src_Bpp;
+ const uint8_t* p = src_scan + src_col * src_Bpp;
des_b += pPixelWeights->m_Weights[0] * (*p++);
des_g += pPixelWeights->m_Weights[0] * (*p++);
des_r += pPixelWeights->m_Weights[0] * (*p);
- FX_LPBYTE pDes = &des_scan[pPixelWeights->m_SrcStart * des_Bpp];
+ uint8_t* pDes = &des_scan[pPixelWeights->m_SrcStart * des_Bpp];
*pDes++ = (uint8_t)((des_b) >> 16);
*pDes++ = (uint8_t)((des_g) >> 16);
*pDes = (uint8_t)((des_r) >> 16);
@@ -405,11 +405,11 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line break;
case FXDIB_Argb: {
FX_DWORD des_r = 0, des_g = 0, des_b = 0;
- FX_LPCBYTE p = src_scan + src_col * src_Bpp;
+ const uint8_t* p = src_scan + src_col * src_Bpp;
des_b += pPixelWeights->m_Weights[0] * (*p++);
des_g += pPixelWeights->m_Weights[0] * (*p++);
des_r += pPixelWeights->m_Weights[0] * (*p++);
- FX_LPBYTE pDes = &des_scan[pPixelWeights->m_SrcStart * des_Bpp];
+ uint8_t* pDes = &des_scan[pPixelWeights->m_SrcStart * des_Bpp];
*pDes++ = (uint8_t)((des_b) >> 16);
*pDes++ = (uint8_t)((des_g) >> 16);
*pDes++ = (uint8_t)((des_r) >> 16);
@@ -423,9 +423,9 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, int line }
return TRUE;
}
-void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap, int32_t des_line, FX_LPBYTE src_scan, FXCodec_Format src_format)
+void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap, int32_t des_line, uint8_t* src_scan, FXCodec_Format src_format)
{
- FX_LPBYTE des_scan = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_line);
+ uint8_t* des_scan = (uint8_t*)pDeviceBitmap->GetScanline(des_line);
int32_t src_Bpp = (m_SrcFormat & 0xff) >> 3;
int32_t des_Bpp = pDeviceBitmap->GetBPP() >> 3;
int32_t src_left = m_clipBox.left;
@@ -453,7 +453,7 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBi case FXDIB_Rgb:
case FXDIB_Rgb32: {
FX_DWORD des_b = 0, des_g = 0, des_r = 0;
- FX_LPCBYTE p = src_scan;
+ const uint8_t* p = src_scan;
p = src_scan + pPixelWeights->m_SrcStart * src_Bpp;
des_b += pPixelWeights->m_Weights[0] * (*p++);
des_g += pPixelWeights->m_Weights[0] * (*p++);
@@ -470,7 +470,7 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBi break;
case FXDIB_Argb: {
FX_DWORD des_a = 0, des_b = 0, des_g = 0, des_r = 0;
- FX_LPCBYTE p = src_scan;
+ const uint8_t* p = src_scan;
p = src_scan + pPixelWeights->m_SrcStart * src_Bpp;
des_b += pPixelWeights->m_Weights[0] * (*p++);
des_g += pPixelWeights->m_Weights[0] * (*p++);
@@ -560,7 +560,7 @@ void CCodec_ProgressiveDecoder::GifRecordCurrentPositionCallback(void* pModule, FX_DWORD remain_size = pCodec->m_pCodecMgr->GetGifModule()->GetAvailInput(pCodec->m_pGifContext);
cur_pos = pCodec->m_offSet - remain_size;
}
-FX_LPBYTE CCodec_ProgressiveDecoder::GifAskLocalPaletteBufCallback(void* pModule, int32_t frame_num, int32_t pal_size)
+uint8_t* CCodec_ProgressiveDecoder::GifAskLocalPaletteBufCallback(void* pModule, int32_t frame_num, int32_t pal_size)
{
return FX_Alloc(uint8_t, pal_size);
}
@@ -575,9 +575,9 @@ FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback(void* pModu if(!pCodec->GifReadMoreData(pCodec->m_pCodecMgr->GetGifModule(), error_status)) {
return FALSE;
}
- FX_LPBYTE pPalette = NULL;
+ uint8_t* pPalette = NULL;
if(pal_num != 0 && pal_ptr) {
- pPalette = (FX_LPBYTE)pal_ptr;
+ pPalette = (uint8_t*)pal_ptr;
} else {
pal_num = pCodec->m_GifPltNumber;
pPalette = pCodec->m_pGifPalette;
@@ -617,7 +617,7 @@ FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback(void* pModu int Bpp = pDevice->GetBPP() / 8;
FX_ARGB argb = pCodec->m_pSrcPalette[pal_index];
for (int row = 0; row < sizeY; row ++) {
- FX_LPBYTE pScanline = (FX_LPBYTE)pDevice->GetScanline(row + startY) + startX * Bpp;
+ uint8_t* pScanline = (uint8_t*)pDevice->GetScanline(row + startY) + startX * Bpp;
switch(pCodec->m_TransMethod) {
case 3: {
uint8_t gray = FXRGB2GRAY(FXARGB_R(argb), FXARGB_G(argb), FXARGB_B(argb));
@@ -644,14 +644,14 @@ FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback(void* pModu }
return TRUE;
}
-void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule, int32_t row_num, FX_LPBYTE row_buf)
+void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule, int32_t row_num, uint8_t* row_buf)
{
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
CFX_DIBitmap* pDIBitmap = pCodec->m_pDeviceBitmap;
ASSERT(pDIBitmap != NULL);
int32_t img_width = pCodec->m_GifFrameRect.Width();
if (!pDIBitmap->HasAlpha()) {
- FX_LPBYTE byte_ptr = row_buf;
+ uint8_t* byte_ptr = row_buf;
for (int i = 0; i < img_width; i++ ) {
if(*byte_ptr == pCodec->m_GifTransIndex) {
*byte_ptr = pCodec->m_GifBgIndex;
@@ -690,10 +690,10 @@ void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule, int32_t r int des_Bpp = pDIBitmap->GetBPP() >> 3;
FX_DWORD des_ScanOffet = pCodec->m_startX * des_Bpp;
if(des_row + (int)scale_y >= des_bottom - 1) {
- FX_LPBYTE scan_src = (FX_LPBYTE)pDIBitmap->GetScanline(des_row) + des_ScanOffet;
+ uint8_t* scan_src = (uint8_t*)pDIBitmap->GetScanline(des_row) + des_ScanOffet;
int cur_row = des_row;
while (++cur_row < des_bottom) {
- FX_LPBYTE scan_des = (FX_LPBYTE)pDIBitmap->GetScanline(cur_row) + des_ScanOffet;
+ uint8_t* scan_des = (uint8_t*)pDIBitmap->GetScanline(cur_row) + des_ScanOffet;
FX_DWORD size = pCodec->m_sizeX * des_Bpp;
FXSYS_memcpy32(scan_des, scan_src, size);
}
@@ -714,10 +714,10 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceB des_row_1 = des_top;
}
for (; des_row_1 < des_row; des_row_1++) {
- FX_LPBYTE scan_des = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row_1) + des_ScanOffet;
+ uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row_1) + des_ScanOffet;
PixelWeight* pWeight = m_WeightVert.GetPixelWeight(des_row_1 - des_top);
- FX_LPCBYTE scan_src1 = pDeviceBitmap->GetScanline(pWeight->m_SrcStart + des_top) + des_ScanOffet;
- FX_LPCBYTE scan_src2 = pDeviceBitmap->GetScanline(pWeight->m_SrcEnd + des_top) + des_ScanOffet;
+ const uint8_t* scan_src1 = pDeviceBitmap->GetScanline(pWeight->m_SrcStart + des_top) + des_ScanOffet;
+ const uint8_t* scan_src2 = pDeviceBitmap->GetScanline(pWeight->m_SrcEnd + des_top) + des_ScanOffet;
for (int des_col = 0; des_col < m_sizeX; des_col++) {
switch(pDeviceBitmap->GetFormat()) {
case FXDIB_Invalid:
@@ -823,7 +823,7 @@ FX_BOOL CCodec_ProgressiveDecoder::BmpInputImagePositionBufCallback(void* pModul }
return TRUE;
}
-void CCodec_ProgressiveDecoder::BmpReadScanlineCallback(void* pModule, int32_t row_num, FX_LPBYTE row_buf)
+void CCodec_ProgressiveDecoder::BmpReadScanlineCallback(void* pModule, int32_t row_num, uint8_t* row_buf)
{
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
CFX_DIBitmap* pDIBitmap = pCodec->m_pDeviceBitmap;
@@ -860,19 +860,19 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, doub int des_bottom = m_startY + m_sizeY;
int des_row_1 = des_row + int(scale_y);
if(des_row_1 >= des_bottom - 1) {
- FX_LPBYTE scan_src = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
+ uint8_t* scan_src = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
while (++des_row < des_bottom) {
- FX_LPBYTE scan_des = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
+ uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
FX_DWORD size = m_sizeX * des_Bpp;
FXSYS_memcpy32(scan_des, scan_src, size);
}
return;
}
for (; des_row_1 > des_row; des_row_1--) {
- FX_LPBYTE scan_des = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row_1) + des_ScanOffet;
+ uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row_1) + des_ScanOffet;
PixelWeight* pWeight = m_WeightVert.GetPixelWeight(des_row_1 - des_top);
- FX_LPCBYTE scan_src1 = pDeviceBitmap->GetScanline(pWeight->m_SrcStart + des_top) + des_ScanOffet;
- FX_LPCBYTE scan_src2 = pDeviceBitmap->GetScanline(pWeight->m_SrcEnd + des_top) + des_ScanOffet;
+ const uint8_t* scan_src1 = pDeviceBitmap->GetScanline(pWeight->m_SrcStart + des_top) + des_ScanOffet;
+ const uint8_t* scan_src2 = pDeviceBitmap->GetScanline(pWeight->m_SrcEnd + des_top) + des_ScanOffet;
for (int des_col = 0; des_col < m_sizeX; des_col++) {
switch(pDeviceBitmap->GetFormat()) {
case FXDIB_Invalid:
@@ -1377,7 +1377,7 @@ void CCodec_ProgressiveDecoder::GetTransMethod(FXDIB_Format des_format, FXCodec_ m_TransMethod = -1;
}
}
-void _RGB2BGR(FX_LPBYTE buffer, int width = 1)
+void _RGB2BGR(uint8_t* buffer, int width = 1)
{
if (buffer && width > 0) {
uint8_t temp;
@@ -1390,11 +1390,11 @@ void _RGB2BGR(FX_LPBYTE buffer, int width = 1) }
}
}
-void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, int des_line, FX_LPBYTE src_scan, FXCodec_Format src_format)
+void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, int des_line, uint8_t* src_scan, FXCodec_Format src_format)
{
int src_left = m_clipBox.left;
int des_left = m_startX;
- FX_LPBYTE des_scan = pDeviceBitmap->GetBuffer() + des_line * pDeviceBitmap->GetPitch();
+ uint8_t* des_scan = pDeviceBitmap->GetBuffer() + des_line * pDeviceBitmap->GetPitch();
int src_bpp = src_format & 0xff;
int des_bpp = pDeviceBitmap->GetBPP();
int src_Bpp = src_bpp >> 3;
@@ -1435,7 +1435,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in FX_DWORD des_b = 0, des_g = 0, des_r = 0;
for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) {
int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
- FX_LPCBYTE src_pixel = src_scan + j * src_Bpp;
+ const uint8_t* src_pixel = src_scan + j * src_Bpp;
des_b += pixel_weight * (*src_pixel++);
des_g += pixel_weight * (*src_pixel++);
des_r += pixel_weight * (*src_pixel);
@@ -1447,7 +1447,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in FX_DWORD des_b = 0, des_g = 0, des_r = 0;
for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) {
int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
- FX_LPCBYTE src_pixel = src_scan + j * src_Bpp;
+ const uint8_t* src_pixel = src_scan + j * src_Bpp;
uint8_t src_b = 0, src_g = 0, src_r = 0;
AdobeCMYK_to_sRGB1(255 - src_pixel[0], 255 - src_pixel[1], 255 - src_pixel[2], 255 - src_pixel[3],
src_r, src_g, src_b);
@@ -1520,7 +1520,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in FX_DWORD des_b = 0, des_g = 0, des_r = 0;
for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) {
int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
- FX_LPCBYTE src_pixel = src_scan + j * src_Bpp;
+ const uint8_t* src_pixel = src_scan + j * src_Bpp;
des_b += pixel_weight * (*src_pixel++);
des_g += pixel_weight * (*src_pixel++);
des_r += pixel_weight * (*src_pixel);
@@ -1535,7 +1535,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in FX_DWORD des_b = 0, des_g = 0, des_r = 0;
for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) {
int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
- FX_LPCBYTE src_pixel = src_scan + j * src_Bpp;
+ const uint8_t* src_pixel = src_scan + j * src_Bpp;
uint8_t src_b = 0, src_g = 0, src_r = 0;
AdobeCMYK_to_sRGB1(255 - src_pixel[0], 255 - src_pixel[1], 255 - src_pixel[2], 255 - src_pixel[3],
src_r, src_g, src_b);
@@ -1553,7 +1553,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, in FX_DWORD des_alpha = 0, des_r = 0, des_g = 0, des_b = 0;
for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j ++) {
int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
- FX_LPCBYTE src_pixel = src_scan + j * src_Bpp;
+ const uint8_t* src_pixel = src_scan + j * src_Bpp;
pixel_weight = pixel_weight * src_pixel[3] / 255;
des_b += pixel_weight * (*src_pixel++);
des_g += pixel_weight * (*src_pixel++);
@@ -1581,9 +1581,9 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, double if(des_row_1 < des_top) {
int des_bottom = des_top + m_sizeY;
if(des_row + (int)scale_y >= des_bottom - 1) {
- FX_LPBYTE scan_src = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
+ uint8_t* scan_src = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
while (++des_row < des_bottom) {
- FX_LPBYTE scan_des = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
+ uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
FX_DWORD size = m_sizeX * des_Bpp;
FXSYS_memcpy32(scan_des, scan_src, size);
}
@@ -1591,10 +1591,10 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, double return;
}
for (; des_row_1 < des_row; des_row_1++) {
- FX_LPBYTE scan_des = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row_1) + des_ScanOffet;
+ uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row_1) + des_ScanOffet;
PixelWeight* pWeight = m_WeightVert.GetPixelWeight(des_row_1 - des_top);
- FX_LPCBYTE scan_src1 = pDeviceBitmap->GetScanline(pWeight->m_SrcStart + des_top) + des_ScanOffet;
- FX_LPCBYTE scan_src2 = pDeviceBitmap->GetScanline(pWeight->m_SrcEnd + des_top) + des_ScanOffet;
+ const uint8_t* scan_src1 = pDeviceBitmap->GetScanline(pWeight->m_SrcStart + des_top) + des_ScanOffet;
+ const uint8_t* scan_src2 = pDeviceBitmap->GetScanline(pWeight->m_SrcEnd + des_top) + des_ScanOffet;
for (int des_col = 0; des_col < m_sizeX; des_col++) {
switch(pDeviceBitmap->GetFormat()) {
case FXDIB_Invalid:
@@ -1652,9 +1652,9 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, double }
int des_bottom = des_top + m_sizeY;
if(des_row + (int)scale_y >= des_bottom - 1) {
- FX_LPBYTE scan_src = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
+ uint8_t* scan_src = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
while (++des_row < des_bottom) {
- FX_LPBYTE scan_des = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
+ uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
FX_DWORD size = m_sizeX * des_Bpp;
FXSYS_memcpy32(scan_des, scan_src, size);
}
@@ -1663,18 +1663,18 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, double }
int multiple = (int)FXSYS_ceil((FX_FLOAT)scale_y - 1);
if(multiple > 0) {
- FX_LPBYTE scan_src = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
+ uint8_t* scan_src = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
for (int i = 1; i <= multiple; i++) {
if(des_row + i >= m_startY + m_sizeY) {
return;
}
- FX_LPBYTE scan_des = (FX_LPBYTE)pDeviceBitmap->GetScanline(des_row + i) + des_ScanOffet;
+ uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row + i) + des_ScanOffet;
FX_DWORD size = m_sizeX * des_Bpp;
FXSYS_memcpy32(scan_des, scan_src, size);
}
}
}
-void CCodec_ProgressiveDecoder::Resample(CFX_DIBitmap* pDeviceBitmap, int32_t src_line, FX_LPBYTE src_scan, FXCodec_Format src_format)
+void CCodec_ProgressiveDecoder::Resample(CFX_DIBitmap* pDeviceBitmap, int32_t src_line, uint8_t* src_scan, FXCodec_Format src_format)
{
int src_top = m_clipBox.top;
int des_top = m_startY;
@@ -2166,8 +2166,8 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) case FXDIB_8bppRgb:
case FXDIB_8bppMask: {
for (int32_t row = 0; row < pClipBitmap->GetHeight(); row++) {
- FX_LPBYTE src_line = (FX_LPBYTE)pClipBitmap->GetScanline(row);
- FX_LPBYTE des_line = (FX_LPBYTE)pFormatBitmap->GetScanline(row);
+ uint8_t* src_line = (uint8_t*)pClipBitmap->GetScanline(row);
+ uint8_t* des_line = (uint8_t*)pFormatBitmap->GetScanline(row);
for (int32_t col = 0; col < pClipBitmap->GetWidth(); col++) {
uint8_t _a = 255 - src_line[3];
uint8_t b = (src_line[0] * src_line[3] + 0xFF * _a) / 255;
@@ -2183,8 +2183,8 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) case FXDIB_Rgb32: {
int32_t desBpp = (m_pDeviceBitmap->GetFormat() == FXDIB_Rgb) ? 3 : 4;
for (int32_t row = 0; row < pClipBitmap->GetHeight(); row++) {
- FX_LPBYTE src_line = (FX_LPBYTE)pClipBitmap->GetScanline(row);
- FX_LPBYTE des_line = (FX_LPBYTE)pFormatBitmap->GetScanline(row);
+ uint8_t* src_line = (uint8_t*)pClipBitmap->GetScanline(row);
+ uint8_t* des_line = (uint8_t*)pFormatBitmap->GetScanline(row);
for (int32_t col = 0; col < pClipBitmap->GetWidth(); col++) {
uint8_t _a = 255 - src_line[3];
uint8_t b = (src_line[0] * src_line[3] + 0xFF * _a) / 255;
diff --git a/core/src/fxcodec/codec/fx_codec_progress.h b/core/src/fxcodec/codec/fx_codec_progress.h index e5a4e53376..8a32f97be4 100644 --- a/core/src/fxcodec/codec/fx_codec_progress.h +++ b/core/src/fxcodec/codec/fx_codec_progress.h @@ -38,7 +38,7 @@ public: }
int m_DestMin, m_ItemSize;
- FX_LPBYTE m_pWeightTables;
+ uint8_t* m_pWeightTables;
};
class CFXCODEC_HorzTable
{
@@ -61,7 +61,7 @@ public: }
int m_ItemSize;
- FX_LPBYTE m_pWeightTables;
+ uint8_t* m_pWeightTables;
};
class CFXCODEC_VertTable
{
@@ -82,7 +82,7 @@ public: return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize);
}
int m_ItemSize;
- FX_LPBYTE m_pWeightTables;
+ uint8_t* m_pWeightTables;
};
enum FXCodec_Format {
FXCodec_Invalid = 0,
@@ -137,41 +137,41 @@ protected: FX_BOOL DetectImageType(FXCODEC_IMAGE_TYPE imageType, CFX_DIBAttribute* pAttribute = NULL);
void GetDownScale(int& down_scale);
void GetTransMethod(FXDIB_Format des_format, FXCodec_Format src_format);
- void ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, int32_t des_line, FX_LPBYTE src_scan, FXCodec_Format src_format);
- void Resample(CFX_DIBitmap* pDeviceBitmap, int32_t src_line, FX_LPBYTE src_scan, FXCodec_Format src_format);
+ void ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, int32_t des_line, uint8_t* src_scan, FXCodec_Format src_format);
+ void Resample(CFX_DIBitmap* pDeviceBitmap, int32_t src_line, uint8_t* src_scan, FXCodec_Format src_format);
void ResampleVert(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
FX_BOOL JpegReadMoreData(ICodec_JpegModule* pJpegModule, FXCODEC_STATUS& err_status);
static FX_BOOL PngReadHeaderFunc(void* pModule, int width, int height, int bpc, int pass, int* color_type, double* gamma);
- static FX_BOOL PngAskScanlineBufFunc(void* pModule, int line, FX_LPBYTE& src_buf);
+ static FX_BOOL PngAskScanlineBufFunc(void* pModule, int line, uint8_t*& src_buf);
static void PngFillScanlineBufCompletedFunc(void* pModule, int pass, int line);
- void PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap, int32_t des_line, FX_LPBYTE src_scan, FXCodec_Format src_format);
+ void PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap, int32_t des_line, uint8_t* src_scan, FXCodec_Format src_format);
FX_BOOL GifReadMoreData(ICodec_GifModule* pGifModule, FXCODEC_STATUS& err_status);
static void GifRecordCurrentPositionCallback(void* pModule, FX_DWORD& cur_pos);
- static FX_LPBYTE GifAskLocalPaletteBufCallback(void* pModule, int32_t frame_num, int32_t pal_size);
+ static uint8_t* GifAskLocalPaletteBufCallback(void* pModule, int32_t frame_num, int32_t pal_size);
static FX_BOOL GifInputRecordPositionBufCallback(void* pModule, FX_DWORD rcd_pos, const FX_RECT& img_rc,
int32_t pal_num, void* pal_ptr,
int32_t delay_time, FX_BOOL user_input,
int32_t trans_index, int32_t disposal_method, FX_BOOL interlace);
- static void GifReadScanlineCallback(void* pModule, int32_t row_num, FX_LPBYTE row_buf);
+ static void GifReadScanlineCallback(void* pModule, int32_t row_num, uint8_t* row_buf);
void GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
FX_BOOL BmpReadMoreData(ICodec_BmpModule* pBmpModule, FXCODEC_STATUS& err_status);
static FX_BOOL BmpInputImagePositionBufCallback(void* pModule, FX_DWORD rcd_pos);
- static void BmpReadScanlineCallback(void* pModule, int32_t row_num, FX_LPBYTE row_buf);
+ static void BmpReadScanlineCallback(void* pModule, int32_t row_num, uint8_t* row_buf);
void ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
public:
IFX_FileRead* m_pFile;
CCodec_ModuleMgr* m_pCodecMgr;
- FX_LPVOID m_pJpegContext;
- FX_LPVOID m_pPngContext;
- FX_LPVOID m_pGifContext;
- FX_LPVOID m_pBmpContext;
- FX_LPVOID m_pTiffContext;
+ void* m_pJpegContext;
+ void* m_pPngContext;
+ void* m_pGifContext;
+ void* m_pBmpContext;
+ void* m_pTiffContext;
FXCODEC_IMAGE_TYPE m_imagType;
FX_DWORD m_offSet;
- FX_LPBYTE m_pSrcBuf;
+ uint8_t* m_pSrcBuf;
FX_DWORD m_SrcSize;
- FX_LPBYTE m_pDecodeBuf;
+ uint8_t* m_pDecodeBuf;
int m_ScanlineSize;
CFX_DIBitmap* m_pDeviceBitmap;
FX_BOOL m_bInterpol;
@@ -196,7 +196,7 @@ public: int m_FrameNumber;
int m_FrameCur;
int m_GifBgIndex;
- FX_LPBYTE m_pGifPalette;
+ uint8_t* m_pGifPalette;
int32_t m_GifPltNumber;
int m_GifTransIndex;
FX_RECT m_GifFrameRect;
diff --git a/core/src/fxcodec/codec/fx_codec_tiff.cpp b/core/src/fxcodec/codec/fx_codec_tiff.cpp index 8e9dd10f29..d057ff8020 100644 --- a/core/src/fxcodec/codec/fx_codec_tiff.cpp +++ b/core/src/fxcodec/codec/fx_codec_tiff.cpp @@ -223,7 +223,7 @@ void CCodec_TiffContext::GetFrames(int32_t& frames) (key) = NULL;
#define TIFF_EXIF_GETSTRINGINFO(key, tag) {\
FX_DWORD size = 0;\
- FX_LPBYTE buf = NULL;\
+ uint8_t* buf = NULL;\
TIFFGetField(tif_ctx,tag,&size, &buf);\
if (size && buf) {\
(key) = FX_Alloc(uint8_t,size);\
@@ -234,7 +234,7 @@ void CCodec_TiffContext::GetFrames(int32_t& frames) template <class T>
static FX_BOOL Tiff_Exif_GetInfo(TIFF* tif_ctx, ttag_t tag, CFX_DIBAttributeExif* pExif)
{
- FX_LPBYTE key = NULL;
+ uint8_t* key = NULL;
T val = (T)0;
TIFFGetField(tif_ctx, tag, &val);
if (val) {
@@ -251,8 +251,8 @@ static FX_BOOL Tiff_Exif_GetInfo(TIFF* tif_ctx, ttag_t tag, CFX_DIBAttributeExif }
static void Tiff_Exif_GetStringInfo(TIFF* tif_ctx, ttag_t tag, CFX_DIBAttributeExif* pExif)
{
- FX_LPSTR buf = NULL;
- FX_LPBYTE key = NULL;
+ FX_CHAR* buf = NULL;
+ uint8_t* key = NULL;
TIFFGetField(tif_ctx, tag, &buf);
if (buf) {
int32_t size = (int32_t)FXSYS_strlen(buf);
@@ -272,7 +272,7 @@ FX_BOOL CCodec_TiffContext::LoadFrameInfo(int32_t frame, FX_DWORD& width, FX_DWO }
FX_WORD tif_cs;
FX_DWORD tif_icc_size = 0;
- FX_LPBYTE tif_icc_buf = NULL;
+ uint8_t* tif_icc_buf = NULL;
FX_WORD tif_bpc = 0;
FX_WORD tif_cps;
FX_DWORD tif_rps;
@@ -313,7 +313,7 @@ FX_BOOL CCodec_TiffContext::LoadFrameInfo(int32_t frame, FX_DWORD& width, FX_DWO }
return TRUE;
}
-void _TiffBGRA2RGBA(FX_LPBYTE pBuf, int32_t pixel, int32_t spp)
+void _TiffBGRA2RGBA(uint8_t* pBuf, int32_t pixel, int32_t spp)
{
register uint8_t tmp;
for (int32_t n = 0; n < pixel; n++) {
@@ -383,12 +383,12 @@ FX_BOOL CCodec_TiffContext::Decode1bppRGB(CFX_DIBitmap* pDIBitmap, int32_t heigh }
SetPalette(pDIBitmap, bps);
int32_t size = (int32_t)TIFFScanlineSize(tif_ctx);
- FX_LPBYTE buf = (FX_LPBYTE)_TIFFmalloc(size);
+ uint8_t* buf = (uint8_t*)_TIFFmalloc(size);
if (buf == NULL) {
TIFFError(TIFFFileName(tif_ctx), "No space for scanline buffer");
return FALSE;
}
- FX_LPBYTE bitMapbuffer = (FX_LPBYTE)pDIBitmap->GetBuffer();
+ uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer();
FX_DWORD pitch = pDIBitmap->GetPitch();
for(int32_t row = 0; row < height; row++) {
TIFFReadScanline(tif_ctx, buf, row, 0);
@@ -406,12 +406,12 @@ FX_BOOL CCodec_TiffContext::Decode8bppRGB(CFX_DIBitmap* pDIBitmap, int32_t heigh }
SetPalette(pDIBitmap, bps);
int32_t size = (int32_t)TIFFScanlineSize(tif_ctx);
- FX_LPBYTE buf = (FX_LPBYTE)_TIFFmalloc(size);
+ uint8_t* buf = (uint8_t*)_TIFFmalloc(size);
if (buf == NULL) {
TIFFError(TIFFFileName(tif_ctx), "No space for scanline buffer");
return FALSE;
}
- FX_LPBYTE bitMapbuffer = (FX_LPBYTE)pDIBitmap->GetBuffer();
+ uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer();
FX_DWORD pitch = pDIBitmap->GetPitch();
for(int32_t row = 0; row < height; row++) {
TIFFReadScanline(tif_ctx, buf, row, 0);
@@ -436,12 +436,12 @@ FX_BOOL CCodec_TiffContext::Decode24bppRGB(CFX_DIBitmap* pDIBitmap, int32_t heig return FALSE;
}
int32_t size = (int32_t)TIFFScanlineSize(tif_ctx);
- FX_LPBYTE buf = (FX_LPBYTE)_TIFFmalloc(size);
+ uint8_t* buf = (uint8_t*)_TIFFmalloc(size);
if (buf == NULL) {
TIFFError(TIFFFileName(tif_ctx), "No space for scanline buffer");
return FALSE;
}
- FX_LPBYTE bitMapbuffer = (FX_LPBYTE)pDIBitmap->GetBuffer();
+ uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer();
FX_DWORD pitch = pDIBitmap->GetPitch();
for(int32_t row = 0; row < height; row++) {
TIFFReadScanline(tif_ctx, buf, row, 0);
@@ -471,7 +471,7 @@ FX_BOOL CCodec_TiffContext::Decode(CFX_DIBitmap* pDIBitmap) if(TIFFReadRGBAImageOriented(tif_ctx, img_wid, img_hei,
(uint32*)pDIBitmap->GetBuffer(), rotation, 1)) {
for (FX_DWORD row = 0; row < img_hei; row++) {
- FX_LPBYTE row_buf = (FX_LPBYTE)pDIBitmap->GetScanline(row);
+ uint8_t* row_buf = (uint8_t*)pDIBitmap->GetScanline(row);
_TiffBGRA2RGBA(row_buf, img_wid, 4);
}
return TRUE;
@@ -490,7 +490,7 @@ FX_BOOL CCodec_TiffContext::Decode(CFX_DIBitmap* pDIBitmap) }
return FALSE;
}
-FX_LPVOID CCodec_TiffModule::CreateDecoder(IFX_FileRead* file_ptr)
+void* CCodec_TiffModule::CreateDecoder(IFX_FileRead* file_ptr)
{
CCodec_TiffContext* pDecoder = new CCodec_TiffContext;
if (!pDecoder->InitDecoder(file_ptr)) {
@@ -499,12 +499,12 @@ FX_LPVOID CCodec_TiffModule::CreateDecoder(IFX_FileRead* file_ptr) }
return pDecoder;
}
-void CCodec_TiffModule::GetFrames(FX_LPVOID ctx, int32_t& frames)
+void CCodec_TiffModule::GetFrames(void* ctx, int32_t& frames)
{
CCodec_TiffContext* pDecoder = (CCodec_TiffContext*)ctx;
pDecoder->GetFrames(frames);
}
-FX_BOOL CCodec_TiffModule::LoadFrameInfo(FX_LPVOID ctx, int32_t frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute)
+FX_BOOL CCodec_TiffModule::LoadFrameInfo(void* ctx, int32_t frame, FX_DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute)
{
CCodec_TiffContext* pDecoder = (CCodec_TiffContext*)ctx;
return pDecoder->LoadFrameInfo(frame, width, height, comps, bpc, pAttribute);
diff --git a/core/src/fxcodec/jbig2/JBig2_Define.h b/core/src/fxcodec/jbig2/JBig2_Define.h index 46c6e2b532..cc1e3904bd 100644 --- a/core/src/fxcodec/jbig2/JBig2_Define.h +++ b/core/src/fxcodec/jbig2/JBig2_Define.h @@ -24,7 +24,7 @@ typedef struct { 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); + void _FaxG4Decode(void *pModule, const uint8_t* src_buf, FX_DWORD src_size, int* pbitpos, uint8_t* dest_buf, int width, int height, int pitch = 0); }; #define JBIG2_MAX_REFERRED_SEGMENT_COUNT 64 #define JBIG2_MAX_EXPORT_SYSMBOLS 65535 diff --git a/core/src/fxcodec/jbig2/JBig2_Module.h b/core/src/fxcodec/jbig2/JBig2_Module.h index aef31bb49f..5a96f4395e 100644 --- a/core/src/fxcodec/jbig2/JBig2_Module.h +++ b/core/src/fxcodec/jbig2/JBig2_Module.h @@ -18,16 +18,16 @@ public: virtual void *JBig2_Malloc3(FX_DWORD num, FX_DWORD dwSize, FX_DWORD dwSize2) = 0; - virtual void *JBig2_Realloc(FX_LPVOID pMem, FX_DWORD dwSize) = 0; + virtual void *JBig2_Realloc(void* pMem, FX_DWORD dwSize) = 0; - virtual void JBig2_Free(FX_LPVOID pMem) = 0; + virtual void JBig2_Free(void* pMem) = 0; virtual void JBig2_Assert(int32_t nExpression) {}; - virtual void JBig2_Error(FX_LPCSTR format, ...) {}; + virtual void JBig2_Error(const FX_CHAR* format, ...) {}; - virtual void JBig2_Warn(FX_LPCSTR format, ...) {}; + virtual void JBig2_Warn(const FX_CHAR* format, ...) {}; - virtual void JBig2_Log(FX_LPCSTR format, ...) {}; + virtual void JBig2_Log(const FX_CHAR* format, ...) {}; }; #endif diff --git a/core/src/fxcodec/jbig2/JBig2_Object.cpp b/core/src/fxcodec/jbig2/JBig2_Object.cpp index 4bb00b897b..1429a91644 100644 --- a/core/src/fxcodec/jbig2/JBig2_Object.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Object.cpp @@ -6,14 +6,14 @@ #include "JBig2_Object.h" #include "JBig2_Module.h" -void *CJBig2_Object::operator new(size_t size, CJBig2_Module *pModule, FX_LPCSTR filename, int line) +void *CJBig2_Object::operator new(size_t size, CJBig2_Module *pModule, const FX_CHAR* filename, int line) { CJBig2_Object *p; p = (CJBig2_Object *)pModule->JBig2_Malloc((FX_DWORD)size); p->m_pModule = pModule; return p; } -void CJBig2_Object::operator delete(void *p, CJBig2_Module *pModule, FX_LPCSTR filename, int line) +void CJBig2_Object::operator delete(void *p, CJBig2_Module *pModule, const FX_CHAR* filename, int line) { pModule->JBig2_Free(p); } @@ -33,7 +33,7 @@ void CJBig2_Object::operator delete(void *p, CJBig2_Module *pModule) pModule->JBig2_Free(p); } void *CJBig2_Object::operator new[](size_t size, CJBig2_Module *pModule, size_t unit_size, - FX_LPCSTR filename, int line) + const FX_CHAR* filename, int line) { void *p; uint8_t *pCur, *pEnd; @@ -46,7 +46,7 @@ void *CJBig2_Object::operator new[](size_t size, CJBig2_Module *pModule, size_t return p; } void CJBig2_Object::operator delete[](void *p, CJBig2_Module *pModule, size_t unit_size, - FX_LPCSTR filename, int line) + const FX_CHAR* filename, int line) { pModule->JBig2_Free(p); } diff --git a/core/src/fxcodec/jbig2/JBig2_Object.h b/core/src/fxcodec/jbig2/JBig2_Object.h index 23eecbf171..150a8e7e99 100644 --- a/core/src/fxcodec/jbig2/JBig2_Object.h +++ b/core/src/fxcodec/jbig2/JBig2_Object.h @@ -13,9 +13,9 @@ class CJBig2_Object { public: - void *operator new(size_t size, CJBig2_Module *pModule, FX_LPCSTR filename, int line); + void *operator new(size_t size, CJBig2_Module *pModule, const FX_CHAR* filename, int line); - void operator delete(void *p, CJBig2_Module *pModule, FX_LPCSTR filename, int line); + void operator delete(void *p, CJBig2_Module *pModule, const FX_CHAR* filename, int line); void *operator new(size_t size, CJBig2_Module *pModule); @@ -24,10 +24,10 @@ public: void operator delete(void *p, CJBig2_Module *pModule); void *operator new[](size_t size, CJBig2_Module *pModule, size_t unit_size, - FX_LPCSTR filename, int line); + const FX_CHAR* filename, int line); void operator delete[](void *p, CJBig2_Module *pModule, size_t unit_size, - FX_LPCSTR filename, int line); + const FX_CHAR* filename, int line); void *operator new[](size_t size, CJBig2_Module *pModule, size_t unit_size); diff --git a/core/src/fxcodec/jbig2/JBig2_Segment.h b/core/src/fxcodec/jbig2/JBig2_Segment.h index fe44bc962d..b61e8e5075 100644 --- a/core/src/fxcodec/jbig2/JBig2_Segment.h +++ b/core/src/fxcodec/jbig2/JBig2_Segment.h @@ -62,7 +62,7 @@ public: CJBig2_PatternDict *pd; CJBig2_Image *im; CJBig2_HuffmanTable *ht; - FX_LPVOID vd; + void* vd; } m_Result; }; #endif diff --git a/core/src/fxcodec/lbmp/fx_bmp.cpp b/core/src/fxcodec/lbmp/fx_bmp.cpp index 3a6e3816ff..986a3272c4 100644 --- a/core/src/fxcodec/lbmp/fx_bmp.cpp +++ b/core/src/fxcodec/lbmp/fx_bmp.cpp @@ -5,27 +5,27 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "fx_bmp.h"
-FX_DWORD _GetDWord_LSBFirst(FX_LPBYTE p)
+FX_DWORD _GetDWord_LSBFirst(uint8_t* p)
{
return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24);
}
-FX_WORD _GetWord_LSBFirst(FX_LPBYTE p)
+FX_WORD _GetWord_LSBFirst(uint8_t* p)
{
return p[0] | (p[1] << 8);
}
-void _SetDWord_LSBFirst(FX_LPBYTE p, FX_DWORD v)
+void _SetDWord_LSBFirst(uint8_t* p, FX_DWORD v)
{
p[0] = (uint8_t)v;
p[1] = (uint8_t)(v >> 8);
p[2] = (uint8_t)(v >> 16);
p[3] = (uint8_t)(v >> 24);
}
-void _SetWord_LSBFirst(FX_LPBYTE p, FX_WORD v)
+void _SetWord_LSBFirst(uint8_t* p, FX_WORD v)
{
p[0] = (uint8_t)v;
p[1] = (uint8_t)(v >> 8);
}
-void _bmp_error(bmp_decompress_struct_p bmp_ptr, FX_LPCSTR err_msg)
+void _bmp_error(bmp_decompress_struct_p bmp_ptr, const FX_CHAR* err_msg)
{
if(bmp_ptr != NULL && bmp_ptr->_bmp_error_fn != NULL) {
bmp_ptr->_bmp_error_fn(bmp_ptr, err_msg);
@@ -69,12 +69,12 @@ int32_t _bmp_read_header(bmp_decompress_struct_p bmp_ptr) if(bmp_ptr->decode_status == BMP_D_STATUS_HEADER) {
ASSERT(sizeof(BmpFileHeader) == 14);
BmpFileHeader* bmp_header_ptr = NULL;
- if(_bmp_read_data(bmp_ptr, (FX_LPBYTE*)&bmp_header_ptr, 14) == NULL) {
+ if(_bmp_read_data(bmp_ptr, (uint8_t**)&bmp_header_ptr, 14) == NULL) {
return 2;
}
- bmp_ptr->bmp_header_ptr->bfType = _GetWord_LSBFirst((FX_LPBYTE)&bmp_header_ptr->bfType);
- bmp_ptr->bmp_header_ptr->bfOffBits = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_header_ptr->bfOffBits);
- bmp_ptr->data_size = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_header_ptr->bfSize);
+ bmp_ptr->bmp_header_ptr->bfType = _GetWord_LSBFirst((uint8_t*)&bmp_header_ptr->bfType);
+ bmp_ptr->bmp_header_ptr->bfOffBits = _GetDWord_LSBFirst((uint8_t*)&bmp_header_ptr->bfOffBits);
+ bmp_ptr->data_size = _GetDWord_LSBFirst((uint8_t*)&bmp_header_ptr->bfSize);
if(bmp_ptr->bmp_header_ptr->bfType != BMP_SIGNATURE) {
_bmp_error(bmp_ptr, "Not A Bmp Image");
return 0;
@@ -91,30 +91,30 @@ int32_t _bmp_read_header(bmp_decompress_struct_p bmp_ptr) case FX_MIN(12, sizeof(BmpCoreHeader)): {
bmp_ptr->pal_type = 1;
BmpCoreHeaderPtr bmp_core_header_ptr = NULL;
- if(_bmp_read_data(bmp_ptr, (FX_LPBYTE*)&bmp_core_header_ptr, bmp_ptr->img_ifh_size) == NULL) {
+ if(_bmp_read_data(bmp_ptr, (uint8_t**)&bmp_core_header_ptr, bmp_ptr->img_ifh_size) == NULL) {
bmp_ptr->skip_size = skip_size_org;
return 2;
}
- bmp_ptr->width = (FX_DWORD)_GetWord_LSBFirst((FX_LPBYTE)&bmp_core_header_ptr->bcWidth);
- bmp_ptr->height = (FX_DWORD)_GetWord_LSBFirst((FX_LPBYTE)&bmp_core_header_ptr->bcHeight);
- bmp_ptr->bitCounts = _GetWord_LSBFirst((FX_LPBYTE)&bmp_core_header_ptr->bcBitCount);
+ bmp_ptr->width = (FX_DWORD)_GetWord_LSBFirst((uint8_t*)&bmp_core_header_ptr->bcWidth);
+ bmp_ptr->height = (FX_DWORD)_GetWord_LSBFirst((uint8_t*)&bmp_core_header_ptr->bcHeight);
+ bmp_ptr->bitCounts = _GetWord_LSBFirst((uint8_t*)&bmp_core_header_ptr->bcBitCount);
bmp_ptr->compress_flag = BMP_RGB;
bmp_ptr->imgTB_flag = FALSE;
}
break;
case FX_MIN(40, sizeof(BmpInfoHeader)): {
BmpInfoHeaderPtr bmp_info_header_ptr = NULL;
- if(_bmp_read_data(bmp_ptr, (FX_LPBYTE*)&bmp_info_header_ptr, bmp_ptr->img_ifh_size) == NULL) {
+ if(_bmp_read_data(bmp_ptr, (uint8_t**)&bmp_info_header_ptr, bmp_ptr->img_ifh_size) == NULL) {
bmp_ptr->skip_size = skip_size_org;
return 2;
}
- bmp_ptr->width = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biWidth);
- bmp_ptr->height = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biHeight);
- bmp_ptr->bitCounts = _GetWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biBitCount);
- bmp_ptr->compress_flag = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biCompression);
- bmp_ptr->color_used = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biClrUsed);
- bmp_ptr->dpi_x = (int32_t)_GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biXPelsPerMeter);
- bmp_ptr->dpi_y = (int32_t)_GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biYPelsPerMeter);
+ bmp_ptr->width = _GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biWidth);
+ bmp_ptr->height = _GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biHeight);
+ bmp_ptr->bitCounts = _GetWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biBitCount);
+ bmp_ptr->compress_flag = _GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biCompression);
+ bmp_ptr->color_used = _GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biClrUsed);
+ bmp_ptr->dpi_x = (int32_t)_GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biXPelsPerMeter);
+ bmp_ptr->dpi_y = (int32_t)_GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biYPelsPerMeter);
if(bmp_ptr->height < 0) {
bmp_ptr->height = -bmp_ptr->height;
bmp_ptr->imgTB_flag = TRUE;
@@ -124,19 +124,19 @@ int32_t _bmp_read_header(bmp_decompress_struct_p bmp_ptr) default: {
if(bmp_ptr->img_ifh_size > FX_MIN(40, sizeof(BmpInfoHeader))) {
BmpInfoHeaderPtr bmp_info_header_ptr = NULL;
- if(_bmp_read_data(bmp_ptr, (FX_LPBYTE*)&bmp_info_header_ptr, bmp_ptr->img_ifh_size) == NULL) {
+ if(_bmp_read_data(bmp_ptr, (uint8_t**)&bmp_info_header_ptr, bmp_ptr->img_ifh_size) == NULL) {
bmp_ptr->skip_size = skip_size_org;
return 2;
}
FX_WORD biPlanes;
- bmp_ptr->width = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biWidth);
- bmp_ptr->height = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biHeight);
- bmp_ptr->bitCounts = _GetWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biBitCount);
- bmp_ptr->compress_flag = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biCompression);
- bmp_ptr->color_used = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biClrUsed);
- biPlanes = _GetWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biPlanes);
- bmp_ptr->dpi_x = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biXPelsPerMeter);
- bmp_ptr->dpi_y = _GetDWord_LSBFirst((FX_LPBYTE)&bmp_info_header_ptr->biYPelsPerMeter);
+ bmp_ptr->width = _GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biWidth);
+ bmp_ptr->height = _GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biHeight);
+ bmp_ptr->bitCounts = _GetWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biBitCount);
+ bmp_ptr->compress_flag = _GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biCompression);
+ bmp_ptr->color_used = _GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biClrUsed);
+ biPlanes = _GetWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biPlanes);
+ bmp_ptr->dpi_x = _GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biXPelsPerMeter);
+ bmp_ptr->dpi_y = _GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biYPelsPerMeter);
if(bmp_ptr->height < 0) {
bmp_ptr->height = -bmp_ptr->height;
bmp_ptr->imgTB_flag = TRUE;
@@ -211,13 +211,13 @@ int32_t _bmp_read_header(bmp_decompress_struct_p bmp_ptr) return 0;
}
FX_DWORD* mask;
- if(_bmp_read_data(bmp_ptr, (FX_LPBYTE*)&mask, 3 * sizeof(FX_DWORD)) == NULL) {
+ if(_bmp_read_data(bmp_ptr, (uint8_t**)&mask, 3 * sizeof(FX_DWORD)) == NULL) {
bmp_ptr->skip_size = skip_size_org;
return 2;
}
- bmp_ptr->mask_red = _GetDWord_LSBFirst((FX_LPBYTE)&mask[0]);
- bmp_ptr->mask_green = _GetDWord_LSBFirst((FX_LPBYTE)&mask[1]);
- bmp_ptr->mask_blue = _GetDWord_LSBFirst((FX_LPBYTE)&mask[2]);
+ bmp_ptr->mask_red = _GetDWord_LSBFirst((uint8_t*)&mask[0]);
+ bmp_ptr->mask_green = _GetDWord_LSBFirst((uint8_t*)&mask[1]);
+ bmp_ptr->mask_blue = _GetDWord_LSBFirst((uint8_t*)&mask[2]);
if(bmp_ptr->mask_red & bmp_ptr->mask_green ||
bmp_ptr->mask_red & bmp_ptr->mask_blue ||
bmp_ptr->mask_green & bmp_ptr->mask_blue) {
@@ -246,9 +246,9 @@ int32_t _bmp_read_header(bmp_decompress_struct_p bmp_ptr) if(bmp_ptr->color_used != 0) {
bmp_ptr->pal_num = bmp_ptr->color_used;
}
- FX_LPBYTE src_pal_ptr = NULL;
+ uint8_t* src_pal_ptr = NULL;
FX_DWORD src_pal_size = bmp_ptr->pal_num * (bmp_ptr->pal_type ? 3 : 4);
- if(_bmp_read_data(bmp_ptr, (FX_LPBYTE*)&src_pal_ptr, src_pal_size) == NULL) {
+ if(_bmp_read_data(bmp_ptr, (uint8_t**)&src_pal_ptr, src_pal_size) == NULL) {
bmp_ptr->skip_size = skip_size_org;
return 2;
}
@@ -306,8 +306,8 @@ int32_t _bmp_decode_image(bmp_decompress_struct_p bmp_ptr) }
int32_t _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr)
{
- FX_LPBYTE row_buf = bmp_ptr->out_row_buffer;
- FX_LPBYTE des_buf = NULL;
+ uint8_t* row_buf = bmp_ptr->out_row_buffer;
+ uint8_t* des_buf = NULL;
while (bmp_ptr->row_num < bmp_ptr->height) {
if(_bmp_read_data(bmp_ptr, &des_buf, bmp_ptr->src_row_bytes) == NULL) {
return 2;
@@ -351,7 +351,7 @@ int32_t _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr) green_bits -= 8;
red_bits -= 8;
for (int32_t col = 0; col < bmp_ptr->width; col++) {
- *buf = _GetWord_LSBFirst((FX_LPBYTE)buf);
+ *buf = _GetWord_LSBFirst((uint8_t*)buf);
*row_buf++ = (uint8_t)((*buf & bmp_ptr->mask_blue) << blue_bits);
*row_buf++ = (uint8_t)((*buf & bmp_ptr->mask_green) >> green_bits);
*row_buf++ = (uint8_t)((*buf++ & bmp_ptr->mask_red) >> red_bits);
@@ -375,8 +375,8 @@ int32_t _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr) }
int32_t _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr)
{
- FX_LPBYTE first_byte_ptr = NULL;
- FX_LPBYTE second_byte_ptr = NULL;
+ uint8_t* first_byte_ptr = NULL;
+ uint8_t* second_byte_ptr = NULL;
bmp_ptr->col_num = 0;
while(TRUE) {
FX_DWORD skip_size_org = bmp_ptr->skip_size;
@@ -414,7 +414,7 @@ int32_t _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) return 1;
}
case RLE_DELTA: {
- FX_LPBYTE delta_ptr;
+ uint8_t* delta_ptr;
if(_bmp_read_data(bmp_ptr, &delta_ptr, 2) == NULL) {
bmp_ptr->skip_size = skip_size_org;
return 2;
@@ -468,8 +468,8 @@ int32_t _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) }
int32_t _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr)
{
- FX_LPBYTE first_byte_ptr = NULL;
- FX_LPBYTE second_byte_ptr = NULL;
+ uint8_t* first_byte_ptr = NULL;
+ uint8_t* second_byte_ptr = NULL;
bmp_ptr->col_num = 0;
while (TRUE) {
FX_DWORD skip_size_org = bmp_ptr->skip_size;
@@ -507,7 +507,7 @@ int32_t _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) return 1;
}
case RLE_DELTA: {
- FX_LPBYTE delta_ptr;
+ uint8_t* delta_ptr;
if(_bmp_read_data(bmp_ptr, &delta_ptr, 2) == NULL) {
bmp_ptr->skip_size = skip_size_org;
return 2;
@@ -576,7 +576,7 @@ int32_t _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) _bmp_error(bmp_ptr, "Any Uncontrol Error");
return 0;
}
-FX_LPBYTE _bmp_read_data(bmp_decompress_struct_p bmp_ptr, FX_LPBYTE* des_buf_pp, FX_DWORD data_size)
+uint8_t* _bmp_read_data(bmp_decompress_struct_p bmp_ptr, uint8_t** des_buf_pp, FX_DWORD data_size)
{
if(bmp_ptr == NULL ||
bmp_ptr->avail_in < bmp_ptr->skip_size + data_size) {
@@ -593,13 +593,13 @@ void _bmp_save_decoding_status(bmp_decompress_struct_p bmp_ptr, int32_t status) bmp_ptr->avail_in -= bmp_ptr->skip_size;
bmp_ptr->skip_size = 0;
}
-void _bmp_input_buffer(bmp_decompress_struct_p bmp_ptr, FX_LPBYTE src_buf, FX_DWORD src_size)
+void _bmp_input_buffer(bmp_decompress_struct_p bmp_ptr, uint8_t* src_buf, FX_DWORD src_size)
{
bmp_ptr->next_in = src_buf;
bmp_ptr->avail_in = src_size;
bmp_ptr->skip_size = 0;
}
-FX_DWORD _bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr, FX_LPBYTE* avial_buf_ptr)
+FX_DWORD _bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr, uint8_t** avial_buf_ptr)
{
if(avial_buf_ptr != NULL) {
*avial_buf_ptr = NULL;
@@ -627,7 +627,7 @@ void _bmp_destroy_compress(bmp_compress_struct_p bmp_ptr) FX_Free(bmp_ptr);
}
}
-static void WriteFileHeader(BmpFileHeaderPtr head_ptr, FX_LPBYTE dst_buf)
+static void WriteFileHeader(BmpFileHeaderPtr head_ptr, uint8_t* dst_buf)
{
FX_DWORD offset;
offset = 0;
@@ -642,7 +642,7 @@ static void WriteFileHeader(BmpFileHeaderPtr head_ptr, FX_LPBYTE dst_buf) _SetDWord_LSBFirst(&dst_buf[offset], head_ptr->bfOffBits);
offset += 4;
}
-static void WriteInfoHeader(BmpInfoHeaderPtr info_head_ptr, FX_LPBYTE dst_buf)
+static void WriteInfoHeader(BmpInfoHeaderPtr info_head_ptr, uint8_t* dst_buf)
{
FX_DWORD offset;
offset = sizeof(BmpFileHeader);
@@ -670,7 +670,7 @@ static void WriteInfoHeader(BmpInfoHeaderPtr info_head_ptr, FX_LPBYTE dst_buf) offset += 4;
}
#ifdef BMP_SUPPORT_BITFIELD
-static void _bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_size)
+static void _bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, FX_DWORD& dst_size)
{
if (bmp_ptr->info_header.biBitCount != 16 && bmp_ptr->info_header.biBitCount != 32) {
return;
@@ -753,7 +753,7 @@ static void _bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_ dst_size = dst_pos;
}
#endif
-static void _bmp_encode_rgb(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_size)
+static void _bmp_encode_rgb(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, FX_DWORD& dst_size)
{
if (bmp_ptr->info_header.biBitCount == 16) {
#ifdef BMP_SUPPORT_BITFIELD
@@ -777,7 +777,7 @@ static void _bmp_encode_rgb(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, F }
dst_size = dst_pos;
}
-static uint8_t _bmp_rle8_search(FX_LPCBYTE buf, int32_t len)
+static uint8_t _bmp_rle8_search(const uint8_t* buf, int32_t len)
{
uint8_t num;
num = 1;
@@ -789,7 +789,7 @@ static uint8_t _bmp_rle8_search(FX_LPCBYTE buf, int32_t len) }
return num;
}
-static void _bmp_encode_rle8(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_size)
+static void _bmp_encode_rle8(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, FX_DWORD& dst_size)
{
FX_DWORD size, dst_pos, index;
uint8_t rle[2] = {0};
@@ -825,7 +825,7 @@ static void _bmp_encode_rle8(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, dst_buf[dst_pos++] = RLE_EOI;
dst_size = dst_pos;
}
-static uint8_t _bmp_rle4_search(FX_LPCBYTE buf, int32_t len)
+static uint8_t _bmp_rle4_search(const uint8_t* buf, int32_t len)
{
uint8_t num;
num = 2;
@@ -837,7 +837,7 @@ static uint8_t _bmp_rle4_search(FX_LPCBYTE buf, int32_t len) }
return num;
}
-static void _bmp_encode_rle4(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_size)
+static void _bmp_encode_rle4(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, FX_DWORD& dst_size)
{
FX_DWORD size, dst_pos, index;
uint8_t rle[2] = {0};
@@ -874,7 +874,7 @@ static void _bmp_encode_rle4(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, dst_buf[dst_pos++] = RLE_EOI;
dst_size = dst_pos;
}
-FX_BOOL _bmp_encode_image( bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_size )
+FX_BOOL _bmp_encode_image( bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, FX_DWORD& dst_size )
{
FX_DWORD head_size = sizeof(BmpFileHeader) + sizeof(BmpInfoHeader);
FX_DWORD pal_size = sizeof(FX_DWORD) * bmp_ptr->pal_num;
diff --git a/core/src/fxcodec/lbmp/fx_bmp.h b/core/src/fxcodec/lbmp/fx_bmp.h index 553a1501db..f3c6e5b133 100644 --- a/core/src/fxcodec/lbmp/fx_bmp.h +++ b/core/src/fxcodec/lbmp/fx_bmp.h @@ -64,8 +64,8 @@ typedef bmp_decompress_struct *bmp_decompress_struct_p; typedef bmp_decompress_struct_p *bmp_decompress_struct_pp;
struct tag_bmp_decompress_struct {
jmp_buf jmpbuf;
- FX_LPSTR err_ptr;
- void (*_bmp_error_fn)(bmp_decompress_struct_p gif_ptr, FX_LPCSTR err_msg);
+ FX_CHAR* err_ptr;
+ void (*_bmp_error_fn)(bmp_decompress_struct_p gif_ptr, const FX_CHAR* err_msg);
void* context_ptr;
@@ -77,7 +77,7 @@ struct tag_bmp_decompress_struct { int32_t components;
int32_t src_row_bytes;
int32_t out_row_bytes;
- FX_LPBYTE out_row_buffer;
+ uint8_t* out_row_buffer;
FX_WORD bitCounts;
FX_DWORD color_used;
FX_BOOL imgTB_flag;
@@ -98,13 +98,13 @@ struct tag_bmp_decompress_struct { #endif
FX_BOOL (*_bmp_get_data_position_fn)(bmp_decompress_struct_p bmp_ptr, FX_DWORD cur_pos);
- void (*_bmp_get_row_fn)(bmp_decompress_struct_p bmp_ptr, int32_t row_num, FX_LPBYTE row_buf);
- FX_LPBYTE next_in;
+ void (*_bmp_get_row_fn)(bmp_decompress_struct_p bmp_ptr, int32_t row_num, uint8_t* row_buf);
+ uint8_t* next_in;
FX_DWORD avail_in;
FX_DWORD skip_size;
int32_t decode_status;
};
-void _bmp_error(bmp_decompress_struct_p bmp_ptr, FX_LPCSTR err_msg);
+void _bmp_error(bmp_decompress_struct_p bmp_ptr, const FX_CHAR* err_msg);
bmp_decompress_struct_p _bmp_create_decompress();
void _bmp_destroy_decompress(bmp_decompress_struct_pp bmp_ptr_ptr);
int32_t _bmp_read_header(bmp_decompress_struct_p bmp_ptr);
@@ -112,10 +112,10 @@ int32_t _bmp_decode_image(bmp_decompress_struct_p bmp_ptr); int32_t _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr);
int32_t _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr);
int32_t _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr);
-FX_LPBYTE _bmp_read_data(bmp_decompress_struct_p bmp_ptr, FX_LPBYTE* des_buf_pp, FX_DWORD data_size);
+uint8_t* _bmp_read_data(bmp_decompress_struct_p bmp_ptr, uint8_t** des_buf_pp, FX_DWORD data_size);
void _bmp_save_decoding_status(bmp_decompress_struct_p bmp_ptr, int32_t status);
-void _bmp_input_buffer(bmp_decompress_struct_p bmp_ptr, FX_LPBYTE src_buf, FX_DWORD src_size);
-FX_DWORD _bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr, FX_LPBYTE* avial_buf_ptr);
+void _bmp_input_buffer(bmp_decompress_struct_p bmp_ptr, uint8_t* src_buf, FX_DWORD src_size);
+FX_DWORD _bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr, uint8_t** avial_buf_ptr);
#define BMP_PTR_NOT_NULL(ptr,bmp_ptr) if(ptr == NULL){ \
_bmp_error(bmp_ptr,"Out Of Memory");\
return 0; \
@@ -126,7 +126,7 @@ typedef bmp_compress_struct_p *bmp_compress_struct_pp; struct tag_bmp_compress_struct {
BmpFileHeader file_header;
BmpInfoHeader info_header;
- FX_LPBYTE src_buf;
+ uint8_t* src_buf;
FX_DWORD src_pitch;
FX_DWORD src_row;
uint8_t src_bpp;
@@ -140,4 +140,4 @@ struct tag_bmp_compress_struct { };
bmp_compress_struct_p _bmp_create_compress();
void _bmp_destroy_compress(bmp_compress_struct_p bmp_ptr);
-FX_BOOL _bmp_encode_image(bmp_compress_struct_p bmp_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_size);
+FX_BOOL _bmp_encode_image(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, FX_DWORD& dst_size);
diff --git a/core/src/fxcodec/lgif/fx_gif.cpp b/core/src/fxcodec/lgif/fx_gif.cpp index 1eb4a75f1a..29e99f2abf 100644 --- a/core/src/fxcodec/lgif/fx_gif.cpp +++ b/core/src/fxcodec/lgif/fx_gif.cpp @@ -5,7 +5,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "fx_gif.h"
-void CGifLZWDecoder::Input(FX_LPBYTE src_buf, FX_DWORD src_size)
+void CGifLZWDecoder::Input(uint8_t* src_buf, FX_DWORD src_size)
{
next_in = src_buf;
avail_in = src_size;
@@ -65,7 +65,7 @@ void CGifLZWDecoder::AddCode(FX_WORD prefix_code, uint8_t append_char) }
}
}
-int32_t CGifLZWDecoder::Decode(FX_LPBYTE des_buf, FX_DWORD& des_size)
+int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, FX_DWORD& des_size)
{
if(des_size == 0) {
return 3;
@@ -144,7 +144,7 @@ int32_t CGifLZWDecoder::Decode(FX_LPBYTE des_buf, FX_DWORD& des_size) }
return 0;
}
-static FX_BOOL _gif_grow_buf(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD size)
+static FX_BOOL _gif_grow_buf(uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD size)
{
if (dst_len < size) {
FX_DWORD len_org = dst_len;
@@ -169,7 +169,7 @@ static inline void _gif_cut_index(uint8_t& val, FX_DWORD index, uint8_t index_bi FX_DWORD cut = ((1 << (index_bit - index_bit_use)) - 1) << index_bit_use;
val |= ((index & cut) >> index_bit_use) << bit_use;
}
-static inline uint8_t _gif_cut_buf(FX_LPCBYTE buf, FX_DWORD& offset, uint8_t bit_cut, uint8_t& bit_offset, FX_DWORD& bit_num)
+static inline uint8_t _gif_cut_buf(const uint8_t* buf, FX_DWORD& offset, uint8_t bit_cut, uint8_t& bit_offset, FX_DWORD& bit_num)
{
if (bit_cut != 8) {
FX_WORD index = 0;
@@ -206,7 +206,7 @@ void CGifLZWEncoder::ClearTable() code_table[i].suffix = 0;
}
}
-void CGifLZWEncoder::Start( uint8_t code_len, FX_LPCBYTE src_buf, FX_LPBYTE& dst_buf, FX_DWORD& offset)
+void CGifLZWEncoder::Start( uint8_t code_len, const uint8_t* src_buf, uint8_t*& dst_buf, FX_DWORD& offset)
{
code_size = code_len + 1;
src_bit_cut = code_size;
@@ -225,7 +225,7 @@ void CGifLZWEncoder::Start( uint8_t code_len, FX_LPCBYTE src_buf, FX_LPBYTE& dst code_table[index_num].prefix = _gif_cut_buf(src_buf, src_offset, src_bit_cut, src_bit_offset, src_bit_num);
code_table[index_num].suffix = _gif_cut_buf(src_buf, src_offset, src_bit_cut, src_bit_offset, src_bit_num);
}
-void CGifLZWEncoder::WriteBlock(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset)
+void CGifLZWEncoder::WriteBlock(uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset)
{
if (!_gif_grow_buf(dst_buf, dst_len, offset + GIF_DATA_BLOCK + 1)) {
longjmp(jmp, 1);
@@ -236,7 +236,7 @@ void CGifLZWEncoder::WriteBlock(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& FXSYS_memset32(index_buf, 0, GIF_DATA_BLOCK);
index_buf_len = 0;
}
-void CGifLZWEncoder::EncodeString( FX_DWORD index, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset )
+void CGifLZWEncoder::EncodeString( FX_DWORD index, uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset )
{
uint8_t index_bit_use;
index_bit_use = 0;
@@ -287,7 +287,7 @@ void CGifLZWEncoder::EncodeString( FX_DWORD index, FX_LPBYTE& dst_buf, FX_DWORD& index_bit_cur++;
}
}
-FX_BOOL CGifLZWEncoder::Encode( FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset )
+FX_BOOL CGifLZWEncoder::Encode( const uint8_t* src_buf, FX_DWORD src_len, uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset )
{
uint8_t suffix;
if (setjmp(jmp)) {
@@ -313,7 +313,7 @@ FX_BOOL CGifLZWEncoder::Encode( FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYTE& src_bit_num = 0;
return TRUE;
}
-FX_BOOL CGifLZWEncoder::LookUpInTable( FX_LPCBYTE buf, FX_DWORD& offset, uint8_t& bit_offset )
+FX_BOOL CGifLZWEncoder::LookUpInTable( const uint8_t* buf, FX_DWORD& offset, uint8_t& bit_offset )
{
for (FX_WORD i = table_cur; i < index_num; i++) {
if (code_table[i].prefix == code_table[index_num].prefix &&
@@ -327,7 +327,7 @@ FX_BOOL CGifLZWEncoder::LookUpInTable( FX_LPCBYTE buf, FX_DWORD& offset, uint8_t table_cur = code_end + 1;
return FALSE;
}
-void CGifLZWEncoder::Finish(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset)
+void CGifLZWEncoder::Finish(uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset)
{
EncodeString(code_table[index_num].prefix, dst_buf, dst_len, offset);
EncodeString(code_end, dst_buf, dst_len, offset);
@@ -532,13 +532,13 @@ void _gif_destroy_compress(gif_compress_struct_pp gif_ptr_ptr) #endif
FX_Free(gif_ptr);
}
-void _gif_error(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg)
+void _gif_error(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg)
{
if(gif_ptr != NULL && gif_ptr->_gif_error_fn != NULL) {
gif_ptr->_gif_error_fn(gif_ptr, err_msg);
}
}
-void _gif_warn(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg) {}
+void _gif_warn(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg) {}
int32_t _gif_read_header(gif_decompress_struct_p gif_ptr)
{
if(gif_ptr == NULL) {
@@ -547,7 +547,7 @@ int32_t _gif_read_header(gif_decompress_struct_p gif_ptr) FX_DWORD skip_size_org = gif_ptr->skip_size;
ASSERT(sizeof(GifHeader) == 6);
GifHeader* gif_header_ptr = NULL;
- if(_gif_read_data(gif_ptr, (FX_LPBYTE*)&gif_header_ptr, 6) == NULL) {
+ if(_gif_read_data(gif_ptr, (uint8_t**)&gif_header_ptr, 6) == NULL) {
return 2;
}
if(FXSYS_strncmp(gif_header_ptr->signature, GIF_SIGNATURE, 3) != 0 ||
@@ -558,7 +558,7 @@ int32_t _gif_read_header(gif_decompress_struct_p gif_ptr) }
ASSERT(sizeof(GifLSD) == 7);
GifLSD* gif_lsd_ptr = NULL;
- if(_gif_read_data(gif_ptr, (FX_LPBYTE*)&gif_lsd_ptr, 7) == NULL) {
+ if(_gif_read_data(gif_ptr, (uint8_t**)&gif_lsd_ptr, 7) == NULL) {
gif_ptr->skip_size = skip_size_org;
return 2;
}
@@ -566,7 +566,7 @@ int32_t _gif_read_header(gif_decompress_struct_p gif_ptr) gif_ptr->global_pal_num = 2 << ((GifGF*)&gif_lsd_ptr->global_flag)->pal_bits;
ASSERT(sizeof(GifPalette) == 3);
int32_t global_pal_size = gif_ptr->global_pal_num * 3;
- FX_LPBYTE global_pal_ptr = NULL;
+ uint8_t* global_pal_ptr = NULL;
if (_gif_read_data(gif_ptr, &global_pal_ptr, global_pal_size) == NULL) {
gif_ptr->skip_size = skip_size_org;
return 2;
@@ -581,8 +581,8 @@ int32_t _gif_read_header(gif_decompress_struct_p gif_ptr) GIF_PTR_NOT_NULL(gif_ptr->global_pal_ptr, gif_ptr);
FXSYS_memcpy32(gif_ptr->global_pal_ptr, global_pal_ptr, global_pal_size);
}
- gif_ptr->width = (int)_GetWord_LSBFirst((FX_LPBYTE)&gif_lsd_ptr->width);
- gif_ptr->height = (int)_GetWord_LSBFirst((FX_LPBYTE)&gif_lsd_ptr->height);
+ gif_ptr->width = (int)_GetWord_LSBFirst((uint8_t*)&gif_lsd_ptr->width);
+ gif_ptr->height = (int)_GetWord_LSBFirst((uint8_t*)&gif_lsd_ptr->height);
gif_ptr->bc_index = gif_lsd_ptr->bc_index;
gif_ptr->pixel_aspect = gif_lsd_ptr->pixel_aspect;
return 1;
@@ -598,7 +598,7 @@ int32_t _gif_get_frame(gif_decompress_struct_p gif_ptr) case GIF_D_STATUS_TAIL:
return 1;
case GIF_D_STATUS_SIG: {
- FX_LPBYTE sig_ptr = NULL;
+ uint8_t* sig_ptr = NULL;
if(_gif_read_data(gif_ptr, &sig_ptr, 1) == NULL) {
return 2;
}
@@ -623,7 +623,7 @@ int32_t _gif_get_frame(gif_decompress_struct_p gif_ptr) }
}
case GIF_D_STATUS_EXT: {
- FX_LPBYTE ext_ptr = NULL;
+ uint8_t* ext_ptr = NULL;
if(_gif_read_data(gif_ptr, &ext_ptr, 1) == NULL) {
return 2;
}
@@ -668,8 +668,8 @@ int32_t _gif_get_frame(gif_decompress_struct_p gif_ptr) continue;
}
case GIF_D_STATUS_IMG_DATA: {
- FX_LPBYTE data_size_ptr = NULL;
- FX_LPBYTE data_ptr = NULL;
+ uint8_t* data_size_ptr = NULL;
+ uint8_t* data_ptr = NULL;
FX_DWORD skip_size_org = gif_ptr->skip_size;
if(_gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
return 2;
@@ -711,15 +711,15 @@ void _gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr, GifGCE** gce_ptr_ptr }
int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr)
{
- FX_LPBYTE data_size_ptr = NULL;
- FX_LPBYTE data_ptr = NULL;
+ uint8_t* data_size_ptr = NULL;
+ uint8_t* data_ptr = NULL;
FX_DWORD skip_size_org = gif_ptr->skip_size;
switch(gif_ptr->decode_status) {
#ifdef GIF_SUPPORT_APPLICATION_EXTENSION
case GIF_D_STATUS_EXT_AE: {
ASSERT(sizeof(GifAE) == 12);
GifAE* gif_ae_ptr = NULL;
- if(_gif_read_data(gif_ptr, (FX_LPBYTE*)&gif_ae_ptr, 12) == NULL) {
+ if(_gif_read_data(gif_ptr, (uint8_t**)&gif_ae_ptr, 12) == NULL) {
return 2;
}
CFX_ByteString gif_ae_data_str;
@@ -734,7 +734,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) gif_ptr->skip_size = skip_size_org;
return 2;
}
- gif_ae_data_str += CFX_ByteString((FX_LPCBYTE)data_ptr, data_size);
+ gif_ae_data_str += CFX_ByteString((const uint8_t*)data_ptr, data_size);
}
FXSYS_memcpy32(gif_ptr->app_identify, gif_ae_ptr->app_identify, 8);
FXSYS_memcpy32(gif_ptr->app_authentication, gif_ae_ptr->app_authentication, 3);
@@ -745,7 +745,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) }
gif_ptr->app_data = FX_Alloc(uint8_t, gif_ptr->app_data_size);
GIF_PTR_NOT_NULL(gif_ptr->app_data, gif_ptr);
- FXSYS_memcpy32(gif_ptr->app_data, FX_LPCBYTE(gif_ae_data_str), gif_ptr->app_data_size);
+ FXSYS_memcpy32(gif_ptr->app_data, const uint8_t*(gif_ae_data_str), gif_ptr->app_data_size);
}
break;
#endif
@@ -763,7 +763,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) gif_ptr->skip_size = skip_size_org;
return 2;
}
- *(gif_ptr->cmt_data_ptr) += CFX_ByteString((FX_LPCSTR)data_ptr, data_size);
+ *(gif_ptr->cmt_data_ptr) += CFX_ByteString((const FX_CHAR*)data_ptr, data_size);
}
}
break;
@@ -772,7 +772,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) case GIF_D_STATUS_EXT_PTE: {
ASSERT(sizeof(GifPTE) == 13);
GifPTE* gif_pte_ptr = NULL;
- if(_gif_read_data(gif_ptr, (FX_LPBYTE*)&gif_pte_ptr, 13) == NULL) {
+ if(_gif_read_data(gif_ptr, (uint8_t**)&gif_pte_ptr, 13) == NULL) {
return 2;
}
GifPlainText* gif_pt_ptr = FX_Alloc(GifPlainText, 1);
@@ -784,10 +784,10 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) gif_pt_ptr->string_ptr = new CFX_ByteString;
GIF_PTR_NOT_NULL(gif_pt_ptr->string_ptr, gif_ptr);
gif_pt_ptr->pte_ptr->block_size = gif_pte_ptr->block_size;
- gif_pt_ptr->pte_ptr->grid_left = _GetWord_LSBFirst((FX_LPBYTE)&gif_pte_ptr->grid_left);
- gif_pt_ptr->pte_ptr->grid_top = _GetWord_LSBFirst((FX_LPBYTE)&gif_pte_ptr->grid_top);
- gif_pt_ptr->pte_ptr->grid_width = _GetWord_LSBFirst((FX_LPBYTE)&gif_pte_ptr->grid_width);
- gif_pt_ptr->pte_ptr->grid_height = _GetWord_LSBFirst((FX_LPBYTE)&gif_pte_ptr->grid_height);
+ gif_pt_ptr->pte_ptr->grid_left = _GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_left);
+ gif_pt_ptr->pte_ptr->grid_top = _GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_top);
+ gif_pt_ptr->pte_ptr->grid_width = _GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_width);
+ gif_pt_ptr->pte_ptr->grid_height = _GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_height);
gif_pt_ptr->pte_ptr->char_width = gif_pte_ptr->char_width;
gif_pt_ptr->pte_ptr->char_height = gif_pte_ptr->char_height;
gif_pt_ptr->pte_ptr->fc_index = gif_pte_ptr->fc_index;
@@ -827,7 +827,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) }
return 2;
}
- *(gif_pt_ptr->string_ptr) += CFX_ByteString((FX_LPCSTR)data_ptr, data_size);
+ *(gif_pt_ptr->string_ptr) += CFX_ByteString((const FX_CHAR*)data_ptr, data_size);
}
gif_ptr->pt_ptr_arr_ptr->Add(gif_pt_ptr);
}
@@ -837,7 +837,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) case GIF_D_STATUS_EXT_GCE: {
ASSERT(sizeof(GifGCE) == 5);
GifGCE* gif_gce_ptr = NULL;
- if(_gif_read_data(gif_ptr, (FX_LPBYTE*)&gif_gce_ptr, 6) == NULL) {
+ if(_gif_read_data(gif_ptr, (uint8_t**)&gif_gce_ptr, 6) == NULL) {
return 2;
}
if(gif_ptr->gce_ptr == NULL) {
@@ -846,7 +846,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) }
gif_ptr->gce_ptr->block_size = gif_gce_ptr->block_size;
gif_ptr->gce_ptr->gce_flag = gif_gce_ptr->gce_flag;
- gif_ptr->gce_ptr->delay_time = _GetWord_LSBFirst((FX_LPBYTE)&gif_gce_ptr->delay_time);
+ gif_ptr->gce_ptr->delay_time = _GetWord_LSBFirst((uint8_t*)&gif_gce_ptr->delay_time);
gif_ptr->gce_ptr->trans_index = gif_gce_ptr->trans_index;
}
break;
@@ -886,7 +886,7 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr) FX_DWORD skip_size_org = gif_ptr->skip_size;
ASSERT(sizeof(GifImageInfo) == 9);
GifImageInfo* gif_img_info_ptr = NULL;
- if(_gif_read_data(gif_ptr, (FX_LPBYTE*)&gif_img_info_ptr, 9) == NULL) {
+ if(_gif_read_data(gif_ptr, (uint8_t**)&gif_img_info_ptr, 9) == NULL) {
return 2;
}
GifImage* gif_image_ptr = (GifImage*)FX_Alloc(uint8_t, sizeof(GifImage));
@@ -894,10 +894,10 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr) FXSYS_memset32(gif_image_ptr, 0, sizeof(GifImage));
gif_image_ptr->image_info_ptr = (GifImageInfo*)FX_Alloc(uint8_t, sizeof(GifImageInfo));
GIF_PTR_NOT_NULL(gif_image_ptr->image_info_ptr, gif_ptr);
- gif_image_ptr->image_info_ptr->left = _GetWord_LSBFirst((FX_LPBYTE)&gif_img_info_ptr->left);
- gif_image_ptr->image_info_ptr->top = _GetWord_LSBFirst((FX_LPBYTE)&gif_img_info_ptr->top);
- gif_image_ptr->image_info_ptr->width = _GetWord_LSBFirst((FX_LPBYTE)&gif_img_info_ptr->width);
- gif_image_ptr->image_info_ptr->height = _GetWord_LSBFirst((FX_LPBYTE)&gif_img_info_ptr->height);
+ gif_image_ptr->image_info_ptr->left = _GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->left);
+ gif_image_ptr->image_info_ptr->top = _GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->top);
+ gif_image_ptr->image_info_ptr->width = _GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->width);
+ gif_image_ptr->image_info_ptr->height = _GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->height);
gif_image_ptr->image_info_ptr->local_flag = gif_img_info_ptr->local_flag;
if(gif_image_ptr->image_info_ptr->left + gif_image_ptr->image_info_ptr->width > gif_ptr->width ||
gif_image_ptr->image_info_ptr->top + gif_image_ptr->image_info_ptr->height > gif_ptr->height) {
@@ -915,7 +915,7 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr) if(gif_img_info_lf_ptr->local_pal) {
ASSERT(sizeof(GifPalette) == 3);
int32_t loc_pal_size = (2 << gif_img_info_lf_ptr->pal_bits) * 3;
- FX_LPBYTE loc_pal_ptr = NULL;
+ uint8_t* loc_pal_ptr = NULL;
if(_gif_read_data(gif_ptr, &loc_pal_ptr, loc_pal_size) == NULL) {
gif_ptr->skip_size = skip_size_org;
if(gif_image_ptr->image_info_ptr != NULL) {
@@ -929,10 +929,10 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr) }
gif_image_ptr->local_pal_ptr = (GifPalette*)gif_ptr->_gif_ask_buf_for_pal_fn(gif_ptr, loc_pal_size);
if(gif_image_ptr->local_pal_ptr != NULL) {
- FXSYS_memcpy32((FX_LPBYTE)gif_image_ptr->local_pal_ptr, loc_pal_ptr, loc_pal_size);
+ FXSYS_memcpy32((uint8_t*)gif_image_ptr->local_pal_ptr, loc_pal_ptr, loc_pal_size);
}
}
- FX_LPBYTE code_size_ptr = NULL;
+ uint8_t* code_size_ptr = NULL;
if(_gif_read_data(gif_ptr, &code_size_ptr, 1) == NULL) {
gif_ptr->skip_size = skip_size_org;
if(gif_image_ptr->image_info_ptr != NULL) {
@@ -963,8 +963,8 @@ int32_t _gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num) ) {
return 0;
}
- FX_LPBYTE data_size_ptr = NULL;
- FX_LPBYTE data_ptr = NULL;
+ uint8_t* data_size_ptr = NULL;
+ uint8_t* data_ptr = NULL;
FX_DWORD skip_size_org = gif_ptr->skip_size;
GifImage* gif_image_ptr = gif_ptr->img_ptr_arr_ptr->GetAt(frame_num);
FX_DWORD gif_img_row_bytes = gif_image_ptr->image_info_ptr->width;
@@ -1111,7 +1111,7 @@ void _gif_save_decoding_status(gif_decompress_struct_p gif_ptr, int32_t status) gif_ptr->avail_in -= gif_ptr->skip_size;
gif_ptr->skip_size = 0;
}
-FX_LPBYTE _gif_read_data(gif_decompress_struct_p gif_ptr, FX_LPBYTE* des_buf_pp, FX_DWORD data_size)
+uint8_t* _gif_read_data(gif_decompress_struct_p gif_ptr, uint8_t** des_buf_pp, FX_DWORD data_size)
{
if(gif_ptr == NULL ||
gif_ptr->avail_in < gif_ptr->skip_size + data_size) {
@@ -1121,13 +1121,13 @@ FX_LPBYTE _gif_read_data(gif_decompress_struct_p gif_ptr, FX_LPBYTE* des_buf_pp, gif_ptr->skip_size += data_size;
return *des_buf_pp;
}
-void _gif_input_buffer(gif_decompress_struct_p gif_ptr, FX_LPBYTE src_buf, FX_DWORD src_size)
+void _gif_input_buffer(gif_decompress_struct_p gif_ptr, uint8_t* src_buf, FX_DWORD src_size)
{
gif_ptr->next_in = src_buf;
gif_ptr->avail_in = src_size;
gif_ptr->skip_size = 0;
}
-FX_DWORD _gif_get_avail_input(gif_decompress_struct_p gif_ptr, FX_LPBYTE* avial_buf_ptr)
+FX_DWORD _gif_get_avail_input(gif_decompress_struct_p gif_ptr, uint8_t** avial_buf_ptr)
{
if(avial_buf_ptr != NULL) {
*avial_buf_ptr = NULL;
@@ -1141,7 +1141,7 @@ int32_t _gif_get_frame_num(gif_decompress_struct_p gif_ptr) {
return gif_ptr->img_ptr_arr_ptr->GetSize();
}
-static FX_BOOL _gif_write_header( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_len )
+static FX_BOOL _gif_write_header( gif_compress_struct_p gif_ptr, uint8_t*& dst_buf, FX_DWORD& dst_len )
{
if (gif_ptr->cur_offset) {
return TRUE;
@@ -1171,13 +1171,13 @@ static FX_BOOL _gif_write_header( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_ }
return TRUE;
}
-void interlace_buf(FX_LPCBYTE buf, FX_DWORD pitch, FX_DWORD height)
+void interlace_buf(const uint8_t* buf, FX_DWORD pitch, FX_DWORD height)
{
- CFX_ArrayTemplate<FX_LPBYTE> pass[4];
+ CFX_ArrayTemplate<uint8_t*> pass[4];
int i, j;
FX_DWORD row;
row = 0;
- FX_LPBYTE temp;
+ uint8_t* temp;
while (row < height) {
if (row % 8 == 0) {
j = 0;
@@ -1198,12 +1198,12 @@ void interlace_buf(FX_LPCBYTE buf, FX_DWORD pitch, FX_DWORD height) }
for (i = 0, row = 0; i < 4; i++) {
for (j = 0; j < pass[i].GetSize(); j++, row++) {
- FXSYS_memcpy32((FX_LPBYTE)&buf[pitch * row], pass[i].GetAt(j), pitch);
+ FXSYS_memcpy32((uint8_t*)&buf[pitch * row], pass[i].GetAt(j), pitch);
FX_Free(pass[i].GetAt(j));
}
}
}
-static void _gif_write_block_data(FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& dst_offset)
+static void _gif_write_block_data(const uint8_t* src_buf, FX_DWORD src_len, uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& dst_offset)
{
FX_DWORD src_offset = 0;
while (src_len > GIF_DATA_BLOCK) {
@@ -1217,7 +1217,7 @@ static void _gif_write_block_data(FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYT FXSYS_memcpy32(&dst_buf[dst_offset], &src_buf[src_offset], src_len);
dst_offset += src_len;
}
-static FX_BOOL _gif_write_data( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_len )
+static FX_BOOL _gif_write_data( gif_compress_struct_p gif_ptr, uint8_t*& dst_buf, FX_DWORD& dst_len )
{
if (!_gif_grow_buf(dst_buf, dst_len, gif_ptr->cur_offset + GIF_DATA_BLOCK)) {
return FALSE;
@@ -1326,7 +1326,7 @@ static FX_BOOL _gif_write_data( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_bu dst_buf[gif_ptr->cur_offset++] = GIF_SIG_TRAILER;
return TRUE;
}
-FX_BOOL _gif_encode( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_len )
+FX_BOOL _gif_encode( gif_compress_struct_p gif_ptr, uint8_t*& dst_buf, FX_DWORD& dst_len )
{
if (!_gif_write_header(gif_ptr, dst_buf, dst_len)) {
return FALSE;
diff --git a/core/src/fxcodec/lgif/fx_gif.h b/core/src/fxcodec/lgif/fx_gif.h index 10aaf5f98f..031e4a4f8f 100644 --- a/core/src/fxcodec/lgif/fx_gif.h +++ b/core/src/fxcodec/lgif/fx_gif.h @@ -8,10 +8,10 @@ #include "../../../include/fxcrt/fx_basic.h"
-extern FX_WORD _GetWord_LSBFirst(FX_LPBYTE p);
-extern void _SetWord_LSBFirst(FX_LPBYTE p, FX_WORD v);
-extern void _BpcConvert(FX_LPCBYTE src_buf, FX_DWORD src_len, int32_t src_bpc, int32_t dst_bpc,
- FX_LPBYTE& dst_buf, FX_DWORD& dst_len);
+extern FX_WORD _GetWord_LSBFirst(uint8_t* p);
+extern void _SetWord_LSBFirst(uint8_t* p, FX_WORD v);
+extern void _BpcConvert(const uint8_t* src_buf, FX_DWORD src_len, int32_t src_bpc, int32_t dst_bpc,
+ uint8_t*& dst_buf, FX_DWORD& dst_len);
#define GIF_SUPPORT_COMMENT_EXTENSION
#define GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION
#define GIF_SUPPORT_PLAIN_TEXT_EXTENSION
@@ -110,7 +110,7 @@ typedef struct tagGifImage { GifImageInfo* image_info_ptr;
uint8_t image_code_size;
FX_DWORD image_data_pos;
- FX_LPBYTE image_row_buf;
+ uint8_t* image_row_buf;
int32_t image_row_num;
} GifImage;
typedef struct tagGifPlainText {
@@ -125,15 +125,15 @@ public: FX_WORD prefix;
uint8_t suffix;
};
- CGifLZWDecoder(FX_LPSTR error_ptr = NULL)
+ CGifLZWDecoder(FX_CHAR* error_ptr = NULL)
{
err_msg_ptr = error_ptr;
}
void InitTable(uint8_t code_len);
- int32_t Decode(FX_LPBYTE des_buf, FX_DWORD& des_size);
+ int32_t Decode(uint8_t* des_buf, FX_DWORD& des_size);
- void Input(FX_LPBYTE src_buf, FX_DWORD src_size);
+ void Input(uint8_t* src_buf, FX_DWORD src_size);
FX_DWORD GetAvailInput();
private:
@@ -151,13 +151,13 @@ private: tag_Table code_table[GIF_MAX_LZW_CODE];
FX_WORD code_old;
- FX_LPBYTE next_in;
+ uint8_t* next_in;
FX_DWORD avail_in;
uint8_t bits_left;
FX_DWORD code_store;
- FX_LPSTR err_msg_ptr;
+ FX_CHAR* err_msg_ptr;
};
class CGifLZWEncoder
{
@@ -168,14 +168,14 @@ public: };
CGifLZWEncoder();
~CGifLZWEncoder();
- void Start(uint8_t code_len, FX_LPCBYTE src_buf, FX_LPBYTE& dst_buf, FX_DWORD& offset);
- FX_BOOL Encode(FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
- void Finish(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
+ void Start(uint8_t code_len, const uint8_t* src_buf, uint8_t*& dst_buf, FX_DWORD& offset);
+ FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_len, uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
+ void Finish(uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
private:
void ClearTable();
- FX_BOOL LookUpInTable(FX_LPCBYTE buf, FX_DWORD& offset, uint8_t& bit_offset);
- void EncodeString(FX_DWORD index, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
- void WriteBlock(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
+ FX_BOOL LookUpInTable(const uint8_t* buf, FX_DWORD& offset, uint8_t& bit_offset);
+ void EncodeString(FX_DWORD index, uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
+ void WriteBlock(uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset);
jmp_buf jmp;
FX_DWORD src_offset;
uint8_t src_bit_offset;
@@ -198,8 +198,8 @@ typedef gif_decompress_struct_p *gif_decompress_struct_pp; static int32_t s_gif_interlace_step[4] = {8, 8, 4, 2};
struct tag_gif_decompress_struct {
jmp_buf jmpbuf;
- FX_LPSTR err_ptr;
- void (*_gif_error_fn)(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg);
+ FX_CHAR* err_ptr;
+ void (*_gif_error_fn)(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg);
void* context_ptr;
int width;
int height;
@@ -215,13 +215,13 @@ struct tag_gif_decompress_struct { FX_DWORD img_row_avail_size;
uint8_t img_pass_num;
CFX_ArrayTemplate<GifImage*>* img_ptr_arr_ptr;
- FX_LPBYTE (*_gif_ask_buf_for_pal_fn)(gif_decompress_struct_p gif_ptr, int32_t pal_size);
- FX_LPBYTE next_in;
+ uint8_t* (*_gif_ask_buf_for_pal_fn)(gif_decompress_struct_p gif_ptr, int32_t pal_size);
+ uint8_t* next_in;
FX_DWORD avail_in;
int32_t decode_status;
FX_DWORD skip_size;
void (*_gif_record_current_position_fn)(gif_decompress_struct_p gif_ptr, FX_DWORD* cur_pos_ptr);
- void (*_gif_get_row_fn)(gif_decompress_struct_p gif_ptr, int32_t row_num, FX_LPBYTE row_buf);
+ void (*_gif_get_row_fn)(gif_decompress_struct_p gif_ptr, int32_t row_num, uint8_t* row_buf);
FX_BOOL (*_gif_get_record_position_fn)(gif_decompress_struct_p gif_ptr, FX_DWORD cur_pos,
int32_t left, int32_t top, int32_t width, int32_t height,
int32_t pal_num, void* pal_ptr,
@@ -231,7 +231,7 @@ struct tag_gif_decompress_struct { uint8_t app_identify[8];
uint8_t app_authentication[3];
FX_DWORD app_data_size;
- FX_LPBYTE app_data;
+ uint8_t* app_data;
#endif
#ifdef GIF_SUPPORT_COMMENT_EXTENSION
CFX_ByteString* cmt_data_ptr;
@@ -247,7 +247,7 @@ typedef struct tag_gif_compress_struct gif_compress_struct; typedef gif_compress_struct *gif_compress_struct_p;
typedef gif_compress_struct_p *gif_compress_struct_pp;
struct tag_gif_compress_struct {
- FX_LPCBYTE src_buf;
+ const uint8_t* src_buf;
FX_DWORD src_pitch;
FX_DWORD src_width;
FX_DWORD src_row;
@@ -265,11 +265,11 @@ struct tag_gif_compress_struct { uint8_t app_identify[8];
uint8_t app_authentication[3];
FX_DWORD app_data_size;
- FX_LPBYTE app_data;
+ uint8_t* app_data;
#endif
#ifdef GIF_SUPPORT_COMMENT_EXTENSION
- FX_LPBYTE cmt_data_ptr;
+ uint8_t* cmt_data_ptr;
FX_DWORD cmt_data_len;
#endif
@@ -279,12 +279,12 @@ struct tag_gif_compress_struct { #ifdef GIF_SUPPORT_PLAIN_TEXT_EXTENSION
GifPTE* pte_ptr;
- FX_LPCBYTE pte_data_ptr;
+ const uint8_t* pte_data_ptr;
FX_DWORD pte_data_len;
#endif
};
-void _gif_error(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg);
-void _gif_warn(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg);
+void _gif_error(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg);
+void _gif_warn(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg);
gif_decompress_struct_p _gif_create_decompress();
void _gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr);
gif_compress_struct_p _gif_create_compress();
@@ -296,12 +296,12 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr); int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr);
void _gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr, GifGCE** gce_ptr_ptr);
int32_t _gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num);
-FX_LPBYTE _gif_read_data(gif_decompress_struct_p gif_ptr, FX_LPBYTE* des_buf_pp, FX_DWORD data_size);
+uint8_t* _gif_read_data(gif_decompress_struct_p gif_ptr, uint8_t** des_buf_pp, FX_DWORD data_size);
void _gif_save_decoding_status(gif_decompress_struct_p gif_ptr, int32_t status);
-void _gif_input_buffer(gif_decompress_struct_p gif_ptr, FX_LPBYTE src_buf, FX_DWORD src_size);
-FX_DWORD _gif_get_avail_input(gif_decompress_struct_p gif_ptr, FX_LPBYTE* avial_buf_ptr);
-void interlace_buf(FX_LPCBYTE buf, FX_DWORD width, FX_DWORD height);
-FX_BOOL _gif_encode( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_len );
+void _gif_input_buffer(gif_decompress_struct_p gif_ptr, uint8_t* src_buf, FX_DWORD src_size);
+FX_DWORD _gif_get_avail_input(gif_decompress_struct_p gif_ptr, uint8_t** avial_buf_ptr);
+void interlace_buf(const uint8_t* buf, FX_DWORD width, FX_DWORD height);
+FX_BOOL _gif_encode( gif_compress_struct_p gif_ptr, uint8_t*& dst_buf, FX_DWORD& dst_len );
#define GIF_PTR_NOT_NULL(ptr,gif_ptr) if(ptr == NULL){ \
_gif_error(gif_ptr,"Out Of Memory");\
return 0; \
diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h index 99a5cf3c4e..c526a2ea6e 100644 --- a/core/src/fxcrt/extension.h +++ b/core/src/fxcrt/extension.h @@ -184,7 +184,7 @@ public: { m_dwFlags = FX_MEMSTREAM_TakeOver | (bConsecutive ? FX_MEMSTREAM_Consecutive : 0); } - CFX_MemoryStream(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver) + CFX_MemoryStream(uint8_t* pBuffer, size_t nSize, FX_BOOL bTakeOver) : m_dwCount(1) , m_nTotalSize(nSize) , m_nCurSize(nSize) @@ -199,7 +199,7 @@ public: { if (m_dwFlags & FX_MEMSTREAM_TakeOver) { for (int32_t i = 0; i < m_Blocks.GetSize(); i++) { - FX_Free((FX_LPBYTE)m_Blocks[i]); + FX_Free((uint8_t*)m_Blocks[i]); } } m_Blocks.RemoveAll(); @@ -278,7 +278,7 @@ public: m_nCurPos = newPos.ValueOrDie(); if (m_dwFlags & FX_MEMSTREAM_Consecutive) { - FXSYS_memcpy32(buffer, (FX_LPBYTE)m_Blocks[0] + (size_t)offset, size); + FXSYS_memcpy32(buffer, (uint8_t*)m_Blocks[0] + (size_t)offset, size); return TRUE; } size_t nStartBlock = (size_t)offset / m_nGrowSize; @@ -288,8 +288,8 @@ public: if (nRead > size) { nRead = size; } - FXSYS_memcpy32(buffer, (FX_LPBYTE)m_Blocks[(int)nStartBlock] + (size_t)offset, nRead); - buffer = ((FX_LPBYTE)buffer) + nRead; + FXSYS_memcpy32(buffer, (uint8_t*)m_Blocks[(int)nStartBlock] + (size_t)offset, nRead); + buffer = ((uint8_t*)buffer) + nRead; size -= nRead; nStartBlock ++; offset = 0; @@ -341,7 +341,7 @@ public: return FALSE; } } - FXSYS_memcpy32((FX_LPBYTE)m_Blocks[0] + (size_t)offset, buffer, size); + FXSYS_memcpy32((uint8_t*)m_Blocks[0] + (size_t)offset, buffer, size); if (m_nCurSize < m_nCurPos) { m_nCurSize = m_nCurPos; } @@ -365,8 +365,8 @@ public: if (nWrite > size) { nWrite = size; } - FXSYS_memcpy32((FX_LPBYTE)m_Blocks[(int)nStartBlock] + (size_t)offset, buffer, nWrite); - buffer = ((FX_LPBYTE)buffer) + nWrite; + FXSYS_memcpy32((uint8_t*)m_Blocks[(int)nStartBlock] + (size_t)offset, buffer, nWrite); + buffer = ((uint8_t*)buffer) + nWrite; size -= nWrite; nStartBlock ++; offset = 0; @@ -385,7 +385,7 @@ public: { if (m_dwFlags & FX_MEMSTREAM_Consecutive) { if (m_Blocks.GetSize() < 1) { - FX_LPBYTE pBlock = FX_Alloc(uint8_t, FX_MAX(nInitSize, 4096)); + uint8_t* pBlock = FX_Alloc(uint8_t, FX_MAX(nInitSize, 4096)); m_Blocks.Add(pBlock); } m_nGrowSize = FX_MAX(nGrowSize, 4096); @@ -393,11 +393,11 @@ public: m_nGrowSize = FX_MAX(nGrowSize, 4096); } } - virtual FX_LPBYTE GetBuffer() const override + virtual uint8_t* GetBuffer() const override { - return m_Blocks.GetSize() ? (FX_LPBYTE)m_Blocks[0] : NULL; + return m_Blocks.GetSize() ? (uint8_t*)m_Blocks[0] : NULL; } - virtual void AttachBuffer(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE) override + virtual void AttachBuffer(uint8_t* pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE) override { if (!(m_dwFlags & FX_MEMSTREAM_Consecutive)) { return; @@ -442,7 +442,7 @@ protected: size = (size - m_nTotalSize + m_nGrowSize - 1) / m_nGrowSize; m_Blocks.SetSize(m_Blocks.GetSize() + (int32_t)size); while (size --) { - FX_LPBYTE pBlock = FX_Alloc(uint8_t, m_nGrowSize); + uint8_t* pBlock = FX_Alloc(uint8_t, m_nGrowSize); m_Blocks.SetAt(iCount ++, pBlock); m_nTotalSize += m_nGrowSize; } @@ -469,7 +469,7 @@ typedef struct _FX_MTRANDOMCONTEXT { } FX_MTRANDOMCONTEXT, * FX_LPMTRANDOMCONTEXT; typedef FX_MTRANDOMCONTEXT const * FX_LPCMTRANDOMCONTEXT; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, int32_t iCount); +FX_BOOL FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount); #endif #ifdef __cplusplus } diff --git a/core/src/fxcrt/fx_arabic.cpp b/core/src/fxcrt/fx_arabic.cpp index 81c86542c7..b8e8f41612 100644 --- a/core/src/fxcrt/fx_arabic.cpp +++ b/core/src/fxcrt/fx_arabic.cpp @@ -312,9 +312,9 @@ void FX_BidiReverseString(CFX_WideString &wsText, int32_t iStart, int32_t iCount FXSYS_assert(iStart > -1 && iStart < wsText.GetLength()); FXSYS_assert(iCount >= 0 && iStart + iCount <= wsText.GetLength()); FX_WCHAR wch; - FX_LPWSTR pStart = (FX_LPWSTR)(FX_LPCWSTR)wsText; + FX_WCHAR* pStart = (FX_WCHAR*)(const FX_WCHAR*)wsText; pStart += iStart; - FX_LPWSTR pEnd = pStart + iCount - 1; + FX_WCHAR* pEnd = pStart + iCount - 1; while (pStart < pEnd) { wch = *pStart; *pStart ++ = *pEnd; @@ -355,7 +355,7 @@ void FX_BidiClassify(const CFX_WideString &wsText, CFX_Int32Array &classes, FX_B { FXSYS_assert(wsText.GetLength() == classes.GetSize()); int32_t iCount = wsText.GetLength(); - FX_LPCWSTR pwsStart = (FX_LPCWSTR)wsText; + const FX_WCHAR* pwsStart = (const FX_WCHAR*)wsText; FX_WCHAR wch; int32_t iCls; if (bWS) { diff --git a/core/src/fxcrt/fx_basic_array.cpp b/core/src/fxcrt/fx_basic_array.cpp index 315c83e53a..d21909f861 100644 --- a/core/src/fxcrt/fx_basic_array.cpp +++ b/core/src/fxcrt/fx_basic_array.cpp @@ -52,7 +52,7 @@ FX_BOOL CFX_BasicArray::SetSize(int nNewSize) if (!totalSize.IsValid() || nNewMax < m_nSize) { return FALSE; } - FX_LPBYTE pNewData = FX_Realloc(uint8_t, m_pData, totalSize.ValueOrDie()); + uint8_t* pNewData = FX_Realloc(uint8_t, m_pData, totalSize.ValueOrDie()); if (pNewData == NULL) { return FALSE; } @@ -83,7 +83,7 @@ FX_BOOL CFX_BasicArray::Copy(const CFX_BasicArray& src) FXSYS_memcpy32(m_pData, src.m_pData, src.m_nSize * m_nUnitSize); return TRUE; } -FX_LPBYTE CFX_BasicArray::InsertSpaceAt(int nIndex, int nCount) +uint8_t* CFX_BasicArray::InsertSpaceAt(int nIndex, int nCount) { if (nIndex < 0 || nCount <= 0) { return NULL; @@ -259,7 +259,7 @@ void** CFX_BaseSegmentedArray::GetIndex(int seg_index) const } return pSpot; } -void* CFX_BaseSegmentedArray::IterateSegment(FX_LPCBYTE pSegment, int count, FX_BOOL (*callback)(void* param, void* pData), void* param) const +void* CFX_BaseSegmentedArray::IterateSegment(const uint8_t* pSegment, int count, FX_BOOL (*callback)(void* param, void* pData), void* param) const { for (int i = 0; i < count; i ++) { if (!callback(param, (void*)(pSegment + i * m_UnitSize))) { @@ -276,7 +276,7 @@ void* CFX_BaseSegmentedArray::IterateIndex(int level, int& start, void** pIndex, count = m_SegmentSize; } start += count; - return IterateSegment((FX_LPCBYTE)pIndex, count, callback, param); + return IterateSegment((const uint8_t*)pIndex, count, callback, param); } for (int i = 0; i < m_IndexSize; i ++) { if (pIndex[i] == NULL) { @@ -303,10 +303,10 @@ void* CFX_BaseSegmentedArray::GetAt(int index) const return NULL; } if (m_IndexDepth == 0) { - return (FX_LPBYTE)m_pIndex + m_UnitSize * index; + return (uint8_t*)m_pIndex + m_UnitSize * index; } int seg_index = index / m_SegmentSize; - return (FX_LPBYTE)GetIndex(seg_index)[seg_index % m_IndexSize] + (index % m_SegmentSize) * m_UnitSize; + return (uint8_t*)GetIndex(seg_index)[seg_index % m_IndexSize] + (index % m_SegmentSize) * m_UnitSize; } void CFX_BaseSegmentedArray::Delete(int index, int count) { diff --git a/core/src/fxcrt/fx_basic_bstring.cpp b/core/src/fxcrt/fx_basic_bstring.cpp index 78698fc6d0..2baeb83b5d 100644 --- a/core/src/fxcrt/fx_basic_bstring.cpp +++ b/core/src/fxcrt/fx_basic_bstring.cpp @@ -22,7 +22,7 @@ static int _Buffer_itoa(char* buf, int i, FX_DWORD flags) u = -i; } int base = 10; - FX_LPCSTR string = "0123456789abcdef"; + const FX_CHAR* string = "0123456789abcdef"; if (flags & FXFORMAT_HEX) { base = 16; if (flags & FXFORMAT_CAPITAL) { @@ -81,7 +81,7 @@ CFX_ByteString::~CFX_ByteString() m_pData->Release(); } } -CFX_ByteString::CFX_ByteString(FX_LPCSTR lpsz, FX_STRSIZE nLen) +CFX_ByteString::CFX_ByteString(const FX_CHAR* lpsz, FX_STRSIZE nLen) { if (nLen < 0) { nLen = lpsz ? FXSYS_strlen(lpsz) : 0; @@ -95,7 +95,7 @@ CFX_ByteString::CFX_ByteString(FX_LPCSTR lpsz, FX_STRSIZE nLen) m_pData = NULL; } } -CFX_ByteString::CFX_ByteString(FX_LPCBYTE lpsz, FX_STRSIZE nLen) +CFX_ByteString::CFX_ByteString(const uint8_t* lpsz, FX_STRSIZE nLen) { if (nLen > 0) { m_pData = StringData::Create(nLen); @@ -150,7 +150,7 @@ CFX_ByteString::CFX_ByteString(FX_BSTR str1, FX_BSTR str2) FXSYS_memcpy32(m_pData->m_String + str1.GetLength(), str2.GetCStr(), str2.GetLength()); } } -const CFX_ByteString& CFX_ByteString::operator=(FX_LPCSTR lpsz) +const CFX_ByteString& CFX_ByteString::operator=(const FX_CHAR* lpsz) { if (lpsz == NULL || lpsz[0] == 0) { Empty(); @@ -192,7 +192,7 @@ const CFX_ByteString& CFX_ByteString::operator=(const CFX_BinaryBuf& buf) Load(buf.GetBuffer(), buf.GetSize()); return *this; } -void CFX_ByteString::Load(FX_LPCBYTE buf, FX_STRSIZE len) +void CFX_ByteString::Load(const uint8_t* buf, FX_STRSIZE len) { Empty(); if (len) { @@ -204,7 +204,7 @@ void CFX_ByteString::Load(FX_LPCBYTE buf, FX_STRSIZE len) m_pData = NULL; } } -const CFX_ByteString& CFX_ByteString::operator+=(FX_LPCSTR lpsz) +const CFX_ByteString& CFX_ByteString::operator+=(const FX_CHAR* lpsz) { if (lpsz) { ConcatInPlace(FXSYS_strlen(lpsz), lpsz); @@ -280,8 +280,8 @@ bool CFX_ByteString::EqualNoCase(FX_BSTR str) const if (m_pData->m_nDataLength != len) { return false; } - FX_LPCBYTE pThis = (FX_LPCBYTE)m_pData->m_String; - FX_LPCBYTE pThat = str.GetPtr(); + const uint8_t* pThis = (const uint8_t*)m_pData->m_String; + const uint8_t* pThat = str.GetPtr(); for (FX_STRSIZE i = 0; i < len; i ++) { if ((*pThis) != (*pThat)) { uint8_t bThis = *pThis; @@ -301,7 +301,7 @@ bool CFX_ByteString::EqualNoCase(FX_BSTR str) const } return true; } -void CFX_ByteString::AssignCopy(FX_STRSIZE nSrcLen, FX_LPCSTR lpszSrcData) +void CFX_ByteString::AssignCopy(FX_STRSIZE nSrcLen, const FX_CHAR* lpszSrcData) { AllocBeforeWrite(nSrcLen); FXSYS_memcpy32(m_pData->m_String, lpszSrcData, nSrcLen); @@ -336,7 +336,7 @@ void CFX_ByteString::ReleaseBuffer(FX_STRSIZE nNewLength) } CopyBeforeWrite(); if (nNewLength == -1) { - nNewLength = FXSYS_strlen((FX_LPCSTR)m_pData->m_String); + nNewLength = FXSYS_strlen((const FX_CHAR*)m_pData->m_String); } if (nNewLength == 0) { Empty(); @@ -351,7 +351,7 @@ void CFX_ByteString::Reserve(FX_STRSIZE len) GetBuffer(len); ReleaseBuffer(GetLength()); } -FX_LPSTR CFX_ByteString::GetBuffer(FX_STRSIZE nMinBufLength) +FX_CHAR* CFX_ByteString::GetBuffer(FX_STRSIZE nMinBufLength) { if (m_pData == NULL && nMinBufLength == 0) { return NULL; @@ -405,7 +405,7 @@ FX_STRSIZE CFX_ByteString::Delete(FX_STRSIZE nIndex, FX_STRSIZE nCount) } return m_pData->m_nDataLength; } -void CFX_ByteString::ConcatInPlace(FX_STRSIZE nSrcLen, FX_LPCSTR lpszSrcData) +void CFX_ByteString::ConcatInPlace(FX_STRSIZE nSrcLen, const FX_CHAR* lpszSrcData) { if (nSrcLen == 0 || lpszSrcData == NULL) { return; @@ -426,8 +426,8 @@ void CFX_ByteString::ConcatInPlace(FX_STRSIZE nSrcLen, FX_LPCSTR lpszSrcData) m_pData->m_String[m_pData->m_nDataLength] = 0; } } -void CFX_ByteString::ConcatCopy(FX_STRSIZE nSrc1Len, FX_LPCSTR lpszSrc1Data, - FX_STRSIZE nSrc2Len, FX_LPCSTR lpszSrc2Data) +void CFX_ByteString::ConcatCopy(FX_STRSIZE nSrc1Len, const FX_CHAR* lpszSrc1Data, + FX_STRSIZE nSrc2Len, const FX_CHAR* lpszSrc2Data) { int nNewLen = nSrc1Len + nSrc2Len; if (nNewLen <= 0) { @@ -486,7 +486,7 @@ void CFX_ByteString::AllocCopy(CFX_ByteString& dest, FX_STRSIZE nCopyLen, FX_STR #define FORCE_ANSI 0x10000 #define FORCE_UNICODE 0x20000 #define FORCE_INT64 0x40000 -void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList) +void CFX_ByteString::FormatV(const FX_CHAR* lpszFormat, va_list argList) { va_list argListSave; #if defined(__ARMCC_VERSION) || (!defined(_MSC_VER) && (_FX_CPU_ == _FX_X64_ || _FX_CPU_ == _FX_IA64_ || _FX_CPU_ == _FX_ARM64_)) || defined(__native_client__) @@ -495,7 +495,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList) argListSave = argList; #endif int nMaxLen = 0; - for (FX_LPCSTR lpsz = lpszFormat; *lpsz != 0; lpsz ++) { + for (const FX_CHAR* lpsz = lpszFormat; *lpsz != 0; lpsz ++) { if (*lpsz != '%' || *(lpsz = lpsz + 1) == '%') { nMaxLen += FXSYS_strlen(lpsz); continue; @@ -579,7 +579,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList) va_arg(argList, int); break; case 's': { - FX_LPCSTR pstrNextArg = va_arg(argList, FX_LPCSTR); + const FX_CHAR* pstrNextArg = va_arg(argList, const FX_CHAR*); if (pstrNextArg == NULL) { nItemLen = 6; } else { @@ -591,7 +591,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList) } break; case 'S': { - FX_LPWSTR pstrNextArg = va_arg(argList, FX_LPWSTR); + FX_WCHAR* pstrNextArg = va_arg(argList, FX_WCHAR*); if (pstrNextArg == NULL) { nItemLen = 6; } else { @@ -604,7 +604,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList) break; case 's'|FORCE_ANSI: case 'S'|FORCE_ANSI: { - FX_LPCSTR pstrNextArg = va_arg(argList, FX_LPCSTR); + const FX_CHAR* pstrNextArg = va_arg(argList, const FX_CHAR*); if (pstrNextArg == NULL) { nItemLen = 6; } else { @@ -617,7 +617,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList) break; case 's'|FORCE_UNICODE: case 'S'|FORCE_UNICODE: { - FX_LPWSTR pstrNextArg = va_arg(argList, FX_LPWSTR); + FX_WCHAR* pstrNextArg = va_arg(argList, FX_WCHAR*); if (pstrNextArg == NULL) { nItemLen = 6; } else { @@ -700,7 +700,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList) } va_end(argListSave); } -void CFX_ByteString::Format(FX_LPCSTR lpszFormat, ...) +void CFX_ByteString::Format(const FX_CHAR* lpszFormat, ...) { va_list argList; va_start(argList, lpszFormat); @@ -720,7 +720,7 @@ FX_STRSIZE CFX_ByteString::Insert(FX_STRSIZE nIndex, FX_CHAR ch) nNewLength++; if (m_pData == NULL || m_pData->m_nAllocLength < nNewLength) { StringData* pOldData = m_pData; - FX_LPCSTR pstr = m_pData->m_String; + const FX_CHAR* pstr = m_pData->m_String; m_pData = StringData::Create(nNewLength); if (!m_pData) { return 0; @@ -777,7 +777,7 @@ FX_STRSIZE CFX_ByteString::Find(FX_CHAR ch, FX_STRSIZE nStart) const if (nStart >= nLength) { return -1; } - FX_LPCSTR lpsz = FXSYS_strchr(m_pData->m_String + nStart, ch); + const FX_CHAR* lpsz = FXSYS_strchr(m_pData->m_String + nStart, ch); return (lpsz == NULL) ? -1 : (int)(lpsz - m_pData->m_String); } FX_STRSIZE CFX_ByteString::ReverseFind(FX_CHAR ch) const @@ -794,12 +794,12 @@ FX_STRSIZE CFX_ByteString::ReverseFind(FX_CHAR ch) const } return -1; } -FX_LPCSTR FX_strstr(FX_LPCSTR str1, int len1, FX_LPCSTR str2, int len2) +const FX_CHAR* FX_strstr(const FX_CHAR* str1, int len1, const FX_CHAR* str2, int len2) { if (len2 > len1 || len2 == 0) { return NULL; } - FX_LPCSTR end_ptr = str1 + len1 - len2; + const FX_CHAR* end_ptr = str1 + len1 - len2; while (str1 <= end_ptr) { int i = 0; while (1) { @@ -824,7 +824,7 @@ FX_STRSIZE CFX_ByteString::Find(FX_BSTR lpszSub, FX_STRSIZE nStart) const if (nStart > nLength) { return -1; } - FX_LPCSTR lpsz = FX_strstr(m_pData->m_String + nStart, m_pData->m_nDataLength - nStart, + const FX_CHAR* lpsz = FX_strstr(m_pData->m_String + nStart, m_pData->m_nDataLength - nStart, lpszSub.GetCStr(), lpszSub.GetLength()); return (lpsz == NULL) ? -1 : (int)(lpsz - m_pData->m_String); } @@ -859,9 +859,9 @@ FX_STRSIZE CFX_ByteString::Remove(FX_CHAR chRemove) if (GetLength() < 1) { return 0; } - FX_LPSTR pstrSource = m_pData->m_String; - FX_LPSTR pstrDest = m_pData->m_String; - FX_LPSTR pstrEnd = m_pData->m_String + m_pData->m_nDataLength; + FX_CHAR* pstrSource = m_pData->m_String; + FX_CHAR* pstrDest = m_pData->m_String; + FX_CHAR* pstrEnd = m_pData->m_String + m_pData->m_nDataLength; while (pstrSource < pstrEnd) { if (*pstrSource != chRemove) { *pstrDest = *pstrSource; @@ -885,10 +885,10 @@ FX_STRSIZE CFX_ByteString::Replace(FX_BSTR lpszOld, FX_BSTR lpszNew) FX_STRSIZE nSourceLen = lpszOld.GetLength(); FX_STRSIZE nReplacementLen = lpszNew.GetLength(); FX_STRSIZE nCount = 0; - FX_LPCSTR pStart = m_pData->m_String; - FX_LPSTR pEnd = m_pData->m_String + m_pData->m_nDataLength; + const FX_CHAR* pStart = m_pData->m_String; + FX_CHAR* pEnd = m_pData->m_String + m_pData->m_nDataLength; while (1) { - FX_LPCSTR pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart), lpszOld.GetCStr(), nSourceLen); + const FX_CHAR* pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart), lpszOld.GetCStr(), nSourceLen); if (pTarget == NULL) { break; } @@ -908,9 +908,9 @@ FX_STRSIZE CFX_ByteString::Replace(FX_BSTR lpszOld, FX_BSTR lpszNew) return 0; } pStart = m_pData->m_String; - FX_LPSTR pDest = pNewData->m_String; + FX_CHAR* pDest = pNewData->m_String; for (FX_STRSIZE i = 0; i < nCount; i ++) { - FX_LPCSTR pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart), lpszOld.GetCStr(), nSourceLen); + const FX_CHAR* pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart), lpszOld.GetCStr(), nSourceLen); FXSYS_memcpy32(pDest, pStart, pTarget - pStart); pDest += pTarget - pStart; FXSYS_memcpy32(pDest, lpszNew.GetCStr(), lpszNew.GetLength()); @@ -940,7 +940,7 @@ CFX_WideString CFX_ByteString::UTF8Decode() const } return decoder.GetResult(); } -CFX_ByteString CFX_ByteString::FromUnicode(FX_LPCWSTR str, FX_STRSIZE len) +CFX_ByteString CFX_ByteString::FromUnicode(const FX_WCHAR* str, FX_STRSIZE len) { if (len < 0) { len = FXSYS_wcslen(str); @@ -1078,7 +1078,7 @@ FX_DWORD CFX_ByteStringC::GetID(FX_STRSIZE start_pos) const } return strid; } -FX_STRSIZE FX_ftoa(FX_FLOAT d, FX_LPSTR buf) +FX_STRSIZE FX_ftoa(FX_FLOAT d, FX_CHAR* buf) { buf[0] = '0'; buf[1] = '\0'; diff --git a/core/src/fxcrt/fx_basic_bstring_unittest.cpp b/core/src/fxcrt/fx_basic_bstring_unittest.cpp index bcdd33b8b8..9d8f376544 100644 --- a/core/src/fxcrt/fx_basic_bstring_unittest.cpp +++ b/core/src/fxcrt/fx_basic_bstring_unittest.cpp @@ -278,7 +278,7 @@ TEST(fxcrt, ByteStringCNull) { EXPECT_EQ(null_string, assigned_null_string); CFX_ByteStringC assigned_nullptr_string("initially not NULL"); - assigned_nullptr_string = (FX_LPCSTR)nullptr; + assigned_nullptr_string = (const FX_CHAR*)nullptr; EXPECT_EQ(assigned_nullptr_string.GetPtr(), nullptr); EXPECT_EQ(assigned_nullptr_string.GetLength(), 0); EXPECT_TRUE(assigned_nullptr_string.IsEmpty()); diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp index 7d45a43128..f56c4299cc 100644 --- a/core/src/fxcrt/fx_basic_buffer.cpp +++ b/core/src/fxcrt/fx_basic_buffer.cpp @@ -5,7 +5,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/fxcrt/fx_basic.h" -FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_LPSTR buf); +FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); CFX_BinaryBuf::CFX_BinaryBuf() : m_AllocStep(0) , m_pBuffer(NULL) @@ -50,7 +50,7 @@ void CFX_BinaryBuf::AttachData(void* buffer, FX_STRSIZE size) FX_Free(m_pBuffer); } m_DataSize = size; - m_pBuffer = (FX_LPBYTE)buffer; + m_pBuffer = (uint8_t*)buffer; m_AllocSize = size; } void CFX_BinaryBuf::TakeOver(CFX_BinaryBuf& other) @@ -82,7 +82,7 @@ void CFX_BinaryBuf::ExpandBuf(FX_STRSIZE add_size) alloc_step = m_AllocStep; } new_size = (new_size + alloc_step - 1) / alloc_step * alloc_step; - FX_LPBYTE pNewBuffer = m_pBuffer; + uint8_t* pNewBuffer = m_pBuffer; if (pNewBuffer) { pNewBuffer = FX_Realloc(uint8_t, m_pBuffer, new_size); } else { @@ -202,7 +202,7 @@ CFX_WideTextBuf& CFX_WideTextBuf::operator << (int i) ExpandBuf(len * sizeof(FX_WCHAR)); } ASSERT(m_pBuffer != NULL); - FX_LPWSTR str = (FX_WCHAR*)(m_pBuffer + m_DataSize); + FX_WCHAR* str = (FX_WCHAR*)(m_pBuffer + m_DataSize); for (FX_STRSIZE j = 0; j < len; j ++) { *str ++ = buf[j]; } @@ -217,14 +217,14 @@ CFX_WideTextBuf& CFX_WideTextBuf::operator << (double f) ExpandBuf(len * sizeof(FX_WCHAR)); } ASSERT(m_pBuffer != NULL); - FX_LPWSTR str = (FX_WCHAR*)(m_pBuffer + m_DataSize); + FX_WCHAR* str = (FX_WCHAR*)(m_pBuffer + m_DataSize); for (FX_STRSIZE i = 0; i < len; i ++) { *str ++ = buf[i]; } m_DataSize += len * sizeof(FX_WCHAR); return *this; } -CFX_WideTextBuf& CFX_WideTextBuf::operator << (FX_LPCWSTR lpsz) +CFX_WideTextBuf& CFX_WideTextBuf::operator << (const FX_WCHAR* lpsz) { AppendBlock(lpsz, FXSYS_wcslen(lpsz)*sizeof(FX_WCHAR)); return *this; @@ -240,7 +240,7 @@ void CFX_WideTextBuf::operator =(FX_WSTR str) } CFX_WideStringC CFX_WideTextBuf::GetWideString() const { - return CFX_WideStringC((FX_LPCWSTR)m_pBuffer, m_DataSize / sizeof(FX_WCHAR)); + return CFX_WideStringC((const FX_WCHAR*)m_pBuffer, m_DataSize / sizeof(FX_WCHAR)); } CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (uint8_t i) { @@ -290,7 +290,7 @@ CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (FX_BSTR bstr) } return *this; } -CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (FX_LPCWSTR wstr) +CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (const FX_WCHAR* wstr) { FX_STRSIZE len = FXSYS_wcslen(wstr); if (m_pStream) { @@ -315,7 +315,7 @@ void CFX_ArchiveSaver::Write(const void* pData, FX_STRSIZE dwSize) m_SavingBuf.AppendBlock(pData, dwSize); } } -CFX_ArchiveLoader::CFX_ArchiveLoader(FX_LPCBYTE pData, FX_DWORD dwSize) +CFX_ArchiveLoader::CFX_ArchiveLoader(const uint8_t* pData, FX_DWORD dwSize) { m_pLoadingBuf = pData; m_LoadingPos = 0; @@ -359,7 +359,7 @@ CFX_ArchiveLoader& CFX_ArchiveLoader::operator >> (CFX_ByteString& str) if (len <= 0 || m_LoadingPos + len > m_LoadingSize) { return *this; } - FX_LPSTR buffer = str.GetBuffer(len); + FX_CHAR* buffer = str.GetBuffer(len); FXSYS_memcpy32(buffer, m_pLoadingBuf + m_LoadingPos, len); str.ReleaseBuffer(len); m_LoadingPos += len; @@ -381,7 +381,7 @@ FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize) m_LoadingPos += dwSize; return TRUE; } -void CFX_BitStream::Init(FX_LPCBYTE pData, FX_DWORD dwSize) +void CFX_BitStream::Init(const uint8_t* pData, FX_DWORD dwSize) { m_pData = pData; m_BitSize = dwSize * 8; @@ -455,7 +455,7 @@ int32_t IFX_BufferArchive::AppendBlock(const void* pBuf, size_t size) if (!m_pBuffer) { m_pBuffer = FX_Alloc(uint8_t, m_BufSize); } - FX_LPBYTE buffer = (FX_LPBYTE)pBuf; + uint8_t* buffer = (uint8_t*)pBuf; FX_STRSIZE temp_size = (FX_STRSIZE)size; while (temp_size > 0) { FX_STRSIZE buf_size = FX_MIN(m_BufSize - m_Length, (FX_STRSIZE)temp_size); @@ -516,7 +516,7 @@ FX_BOOL CFX_FileBufferArchive::AttachFile(IFX_StreamWrite *pFile, FX_BOOL bTakeo m_bTakeover = bTakeover; return TRUE; } -FX_BOOL CFX_FileBufferArchive::AttachFile(FX_LPCWSTR filename) +FX_BOOL CFX_FileBufferArchive::AttachFile(const FX_WCHAR* filename) { if (!filename) { return FALSE; @@ -531,7 +531,7 @@ FX_BOOL CFX_FileBufferArchive::AttachFile(FX_LPCWSTR filename) m_bTakeover = TRUE; return TRUE; } -FX_BOOL CFX_FileBufferArchive::AttachFile(FX_LPCSTR filename) +FX_BOOL CFX_FileBufferArchive::AttachFile(const FX_CHAR* filename) { if (!filename) { return FALSE; diff --git a/core/src/fxcrt/fx_basic_gcc.cpp b/core/src/fxcrt/fx_basic_gcc.cpp index caa99926a6..02a336af75 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 -int32_t FXSYS_atoi(FX_LPCSTR str) +int32_t FXSYS_atoi(const FX_CHAR* str) { - return FXSYS_StrToInt<int32_t, FX_LPCSTR>(str); + return FXSYS_StrToInt<int32_t, const FX_CHAR*>(str); } -int32_t FXSYS_wtoi(FX_LPCWSTR str) +int32_t FXSYS_wtoi(const FX_WCHAR* str) { - return FXSYS_StrToInt<int32_t, FX_LPCWSTR>(str); + return FXSYS_StrToInt<int32_t, const FX_WCHAR*>(str); } -int64_t FXSYS_atoi64(FX_LPCSTR str) +int64_t FXSYS_atoi64(const FX_CHAR* str) { - return FXSYS_StrToInt<int64_t, FX_LPCSTR>(str); + return FXSYS_StrToInt<int64_t, const FX_CHAR*>(str); } -int64_t FXSYS_wtoi64(FX_LPCWSTR str) +int64_t FXSYS_wtoi64(const FX_WCHAR* str) { - return FXSYS_StrToInt<int64_t, FX_LPCWSTR>(str); + return FXSYS_StrToInt<int64_t, const FX_WCHAR*>(str); } -FX_LPCSTR FXSYS_i64toa(int64_t value, FX_LPSTR str, int radix) +const FX_CHAR* FXSYS_i64toa(int64_t value, FX_CHAR* str, int radix) { - return FXSYS_IntToStr<int64_t, FX_LPSTR>(value, str, radix); + return FXSYS_IntToStr<int64_t, FX_CHAR*>(value, str, radix); } -FX_LPCWSTR FXSYS_i64tow(int64_t value, FX_LPWSTR str, int radix) +const FX_WCHAR* FXSYS_i64tow(int64_t value, FX_WCHAR* str, int radix) { - return FXSYS_IntToStr<int64_t, FX_LPWSTR>(value, str, radix); + return FXSYS_IntToStr<int64_t, FX_WCHAR*>(value, str, radix); } #ifdef __cplusplus } @@ -93,7 +93,7 @@ int FXSYS_GetACP() { return 0; } -FX_DWORD FXSYS_GetFullPathName(FX_LPCSTR filename, FX_DWORD buflen, FX_LPSTR buf, FX_LPSTR* filepart) +FX_DWORD FXSYS_GetFullPathName(const FX_CHAR* filename, FX_DWORD buflen, FX_CHAR* buf, FX_CHAR** filepart) { int srclen = FXSYS_strlen(filename); if (buf == NULL || (int)buflen < srclen + 1) { @@ -102,7 +102,7 @@ FX_DWORD FXSYS_GetFullPathName(FX_LPCSTR filename, FX_DWORD buflen, FX_LPSTR buf FXSYS_strcpy(buf, filename); return srclen; } -FX_DWORD FXSYS_GetModuleFileName(FX_LPVOID hModule, char* buf, FX_DWORD bufsize) +FX_DWORD FXSYS_GetModuleFileName(void* hModule, char* buf, FX_DWORD bufsize) { return (FX_DWORD) - 1; } @@ -114,7 +114,7 @@ FX_DWORD FXSYS_GetModuleFileName(FX_LPVOID hModule, char* buf, FX_DWORD bufsize) #ifdef __cplusplus extern "C" { #endif -FXSYS_FILE* FXSYS_wfopen(FX_LPCWSTR filename, FX_LPCWSTR mode) +FXSYS_FILE* FXSYS_wfopen(const FX_WCHAR* filename, const FX_WCHAR* mode) { return FXSYS_fopen(CFX_ByteString::FromUnicode(filename), CFX_ByteString::FromUnicode(mode)); } @@ -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<int32_t, FX_LPSTR>(value, string, radix); + return FXSYS_IntToStr<int32_t, FX_CHAR*>(value, string, radix); } #ifdef __cplusplus } @@ -204,8 +204,8 @@ char* FXSYS_itoa(int value, char* string, int radix) #ifdef __cplusplus extern "C" { #endif -int FXSYS_WideCharToMultiByte(FX_DWORD codepage, FX_DWORD dwFlags, FX_LPCWSTR wstr, int wlen, - FX_LPSTR buf, int buflen, FX_LPCSTR default_str, FX_BOOL* pUseDefault) +int FXSYS_WideCharToMultiByte(FX_DWORD codepage, FX_DWORD dwFlags, const FX_WCHAR* wstr, int wlen, + FX_CHAR* buf, int buflen, const FX_CHAR* default_str, FX_BOOL* pUseDefault) { int len = 0; for (int i = 0; i < wlen; i ++) { @@ -218,8 +218,8 @@ int FXSYS_WideCharToMultiByte(FX_DWORD codepage, FX_DWORD dwFlags, FX_LPCWSTR ws } return len; } -int FXSYS_MultiByteToWideChar(FX_DWORD codepage, FX_DWORD dwFlags, FX_LPCSTR bstr, int blen, - FX_LPWSTR buf, int buflen) +int FXSYS_MultiByteToWideChar(FX_DWORD codepage, FX_DWORD dwFlags, const FX_CHAR* bstr, int blen, + FX_WCHAR* buf, int buflen) { int wlen = 0; for (int i = 0; i < blen; i ++) { diff --git a/core/src/fxcrt/fx_basic_maps.cpp b/core/src/fxcrt/fx_basic_maps.cpp index c0c394583e..7df4cdb8ed 100644 --- a/core/src/fxcrt/fx_basic_maps.cpp +++ b/core/src/fxcrt/fx_basic_maps.cpp @@ -238,7 +238,7 @@ void CFX_MapByteStringToPtr::GetNextAssoc(FX_POSITION& rNextPosition, rKey = pAssocRet->key; rValue = pAssocRet->value; } -FX_LPVOID CFX_MapByteStringToPtr::GetNextValue(FX_POSITION& rNextPosition) const +void* CFX_MapByteStringToPtr::GetNextValue(FX_POSITION& rNextPosition) const { ASSERT(m_pHashTable != NULL); CAssoc* pAssocRet = (CAssoc*)rNextPosition; @@ -352,7 +352,7 @@ inline FX_DWORD CFX_MapByteStringToPtr::HashKey(FX_BSTR key) const { FX_DWORD nHash = 0; int len = key.GetLength(); - FX_LPCBYTE buf = key.GetPtr(); + const uint8_t* buf = key.GetPtr(); for (int i = 0; i < len; i ++) { nHash = (nHash << 5) + nHash + buf[i]; } @@ -381,7 +381,7 @@ struct _CompactString { uint8_t m_LenHigh; uint8_t m_LenLow; uint8_t m_Unused; - FX_LPBYTE m_pBuffer; + uint8_t* m_pBuffer; }; static void _CompactStringRelease(_CompactString* pCompact) { @@ -389,7 +389,7 @@ static void _CompactStringRelease(_CompactString* pCompact) FX_Free(pCompact->m_pBuffer); } } -static FX_BOOL _CompactStringSame(_CompactString* pCompact, FX_LPCBYTE pStr, int len) +static FX_BOOL _CompactStringSame(_CompactString* pCompact, const uint8_t* pStr, int len) { if (len < sizeof(_CompactString)) { if (pCompact->m_CompactLen != len) { @@ -402,7 +402,7 @@ static FX_BOOL _CompactStringSame(_CompactString* pCompact, FX_LPCBYTE pStr, int } return FXSYS_memcmp32(pCompact->m_pBuffer, pStr, len) == 0; } -static void _CompactStringStore(_CompactString* pCompact, FX_LPCBYTE pStr, int len) +static void _CompactStringStore(_CompactString* pCompact, const uint8_t* pStr, int len) { if (len < (int)sizeof(_CompactString)) { pCompact->m_CompactLen = (uint8_t)len; @@ -475,14 +475,14 @@ void CFX_CMapByteStringToPtr::GetNextAssoc(FX_POSITION& rNextPosition, CFX_ByteS } rNextPosition = NULL; } -FX_LPVOID CFX_CMapByteStringToPtr::GetNextValue(FX_POSITION& rNextPosition) const +void* CFX_CMapByteStringToPtr::GetNextValue(FX_POSITION& rNextPosition) const { if (rNextPosition == NULL) { return NULL; } int index = (int)(uintptr_t)rNextPosition - 1; _CompactString* pKey = (_CompactString*)m_Buffer.GetAt(index); - FX_LPVOID rValue = *(void**)(pKey + 1); + void* rValue = *(void**)(pKey + 1); index ++; int size = m_Buffer.GetSize(); while (index < size) { @@ -580,7 +580,7 @@ struct _DWordPair { }; FX_BOOL CFX_CMapDWordToDWord::Lookup(FX_DWORD key, FX_DWORD& value) const { - FX_LPVOID pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(), m_Buffer.GetSize() / sizeof(_DWordPair), + void* pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(), m_Buffer.GetSize() / sizeof(_DWordPair), sizeof(_DWordPair), _CompareDWord); if (pResult == NULL) { return FALSE; diff --git a/core/src/fxcrt/fx_basic_memmgr.cpp b/core/src/fxcrt/fx_basic_memmgr.cpp index a381fa4ef5..2ae9075f04 100644 --- a/core/src/fxcrt/fx_basic_memmgr.cpp +++ b/core/src/fxcrt/fx_basic_memmgr.cpp @@ -56,7 +56,7 @@ void* CFX_GrowOnlyPool::Alloc(size_t size) _FX_GrowOnlyTrunk* pTrunk = (_FX_GrowOnlyTrunk*)m_pFirstTrunk; while (pTrunk) { if (pTrunk->m_Size - pTrunk->m_Allocated >= size) { - void* p = (FX_LPBYTE)(pTrunk + 1) + pTrunk->m_Allocated; + void* p = (uint8_t*)(pTrunk + 1) + pTrunk->m_Allocated; pTrunk->m_Allocated += size; return p; } diff --git a/core/src/fxcrt/fx_basic_utf.cpp b/core/src/fxcrt/fx_basic_utf.cpp index 1422b7abd4..5413ead0d5 100644 --- a/core/src/fxcrt/fx_basic_utf.cpp +++ b/core/src/fxcrt/fx_basic_utf.cpp @@ -76,7 +76,7 @@ void CFX_UTF8Encoder::Input(FX_WCHAR unicode) } } } -CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len) +CFX_ByteString FX_UTF8Encode(const FX_WCHAR* pwsStr, FX_STRSIZE len) { FXSYS_assert(pwsStr != NULL); if (len < 0) { diff --git a/core/src/fxcrt/fx_basic_util.cpp b/core/src/fxcrt/fx_basic_util.cpp index 615b297421..5870baa020 100644 --- a/core/src/fxcrt/fx_basic_util.cpp +++ b/core/src/fxcrt/fx_basic_util.cpp @@ -26,7 +26,7 @@ void FX_PRIVATEDATA::FreeData() m_pCallback(m_pData); } } -void CFX_PrivateData::AddData(FX_LPVOID pModuleId, FX_LPVOID pData, PD_CALLBACK_FREEDATA callback, FX_BOOL bSelfDestruct) +void CFX_PrivateData::AddData(void* pModuleId, void* pData, PD_CALLBACK_FREEDATA callback, FX_BOOL bSelfDestruct) { if (pModuleId == NULL) { return; @@ -44,15 +44,15 @@ void CFX_PrivateData::AddData(FX_LPVOID pModuleId, FX_LPVOID pData, PD_CALLBACK_ FX_PRIVATEDATA data = {pModuleId, pData, callback, bSelfDestruct}; m_DataList.Add(data); } -void CFX_PrivateData::SetPrivateData(FX_LPVOID pModuleId, FX_LPVOID pData, PD_CALLBACK_FREEDATA callback) +void CFX_PrivateData::SetPrivateData(void* pModuleId, void* pData, PD_CALLBACK_FREEDATA callback) { AddData(pModuleId, pData, callback, FALSE); } -void CFX_PrivateData::SetPrivateObj(FX_LPVOID pModuleId, CFX_DestructObject* pObj) +void CFX_PrivateData::SetPrivateObj(void* pModuleId, CFX_DestructObject* pObj) { AddData(pModuleId, pObj, NULL, TRUE); } -FX_BOOL CFX_PrivateData::RemovePrivateData(FX_LPVOID pModuleId) +FX_BOOL CFX_PrivateData::RemovePrivateData(void* pModuleId) { if (pModuleId == NULL) { return FALSE; @@ -67,7 +67,7 @@ FX_BOOL CFX_PrivateData::RemovePrivateData(FX_LPVOID pModuleId) } return FALSE; } -FX_LPVOID CFX_PrivateData::GetPrivateData(FX_LPVOID pModuleId) +void* CFX_PrivateData::GetPrivateData(void* pModuleId) { if (pModuleId == NULL) { return NULL; @@ -95,7 +95,7 @@ void FX_atonum(FX_BSTR strc, FX_BOOL& bInteger, void* pData) if (FXSYS_memchr(strc.GetPtr(), '.', strc.GetLength()) == NULL) { bInteger = TRUE; int cc = 0, integer = 0; - FX_LPCSTR str = strc.GetCStr(); + const FX_CHAR* str = strc.GetCStr(); int len = strc.GetLength(); FX_BOOL bNegative = FALSE; if (str[0] == '+') { @@ -130,7 +130,7 @@ FX_FLOAT FX_atof(FX_BSTR strc) } int cc = 0; FX_BOOL bNegative = FALSE; - FX_LPCSTR str = strc.GetCStr(); + const FX_CHAR* str = strc.GetCStr(); int len = strc.GetLength(); if (str[0] == '+') { cc++; @@ -314,7 +314,7 @@ public: WIN32_FIND_DATAW m_FindData; }; #endif -void* FX_OpenFolder(FX_LPCSTR path) +void* FX_OpenFolder(const FX_CHAR* path) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ #ifndef _WIN32_WCE @@ -345,7 +345,7 @@ void* FX_OpenFolder(FX_LPCSTR path) return dir; #endif } -void* FX_OpenFolder(FX_LPCWSTR path) +void* FX_OpenFolder(const FX_WCHAR* path) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ CFindFileDataW* pData = FX_NEW CFindFileDataW; diff --git a/core/src/fxcrt/fx_basic_wstring.cpp b/core/src/fxcrt/fx_basic_wstring.cpp index aeb366338e..1108a3ca52 100644 --- a/core/src/fxcrt/fx_basic_wstring.cpp +++ b/core/src/fxcrt/fx_basic_wstring.cpp @@ -56,7 +56,7 @@ CFX_WideString::CFX_WideString(const CFX_WideString& stringSrc) *this = stringSrc; } } -CFX_WideString::CFX_WideString(FX_LPCWSTR lpsz, FX_STRSIZE nLen) { +CFX_WideString::CFX_WideString(const FX_WCHAR* lpsz, FX_STRSIZE nLen) { if (nLen < 0) { nLen = lpsz ? FXSYS_wcslen(lpsz) : 0; } @@ -117,7 +117,7 @@ void CFX_WideString::ReleaseBuffer(FX_STRSIZE nNewLength) m_pData->m_nDataLength = nNewLength; m_pData->m_String[nNewLength] = 0; } -const CFX_WideString& CFX_WideString::operator=(FX_LPCWSTR lpsz) +const CFX_WideString& CFX_WideString::operator=(const FX_WCHAR* lpsz) { if (lpsz == NULL || lpsz[0] == 0) { Empty(); @@ -159,7 +159,7 @@ const CFX_WideString& CFX_WideString::operator+=(FX_WCHAR ch) ConcatInPlace(1, &ch); return *this; } -const CFX_WideString& CFX_WideString::operator+=(FX_LPCWSTR lpsz) +const CFX_WideString& CFX_WideString::operator+=(const FX_WCHAR* lpsz) { if (lpsz) { ConcatInPlace(FXSYS_wcslen(lpsz), lpsz); @@ -221,7 +221,7 @@ void CFX_WideString::Empty() m_pData = NULL; } } -void CFX_WideString::ConcatInPlace(FX_STRSIZE nSrcLen, FX_LPCWSTR lpszSrcData) +void CFX_WideString::ConcatInPlace(FX_STRSIZE nSrcLen, const FX_WCHAR* lpszSrcData) { if (nSrcLen == 0 || lpszSrcData == NULL) { return; @@ -241,8 +241,8 @@ void CFX_WideString::ConcatInPlace(FX_STRSIZE nSrcLen, FX_LPCWSTR lpszSrcData) m_pData->m_String[m_pData->m_nDataLength] = 0; } } -void CFX_WideString::ConcatCopy(FX_STRSIZE nSrc1Len, FX_LPCWSTR lpszSrc1Data, - FX_STRSIZE nSrc2Len, FX_LPCWSTR lpszSrc2Data) +void CFX_WideString::ConcatCopy(FX_STRSIZE nSrc1Len, const FX_WCHAR* lpszSrc1Data, + FX_STRSIZE nSrc2Len, const FX_WCHAR* lpszSrc2Data) { FX_STRSIZE nNewLen = nSrc1Len + nSrc2Len; if (nNewLen <= 0) { @@ -278,14 +278,14 @@ void CFX_WideString::AllocBeforeWrite(FX_STRSIZE nLen) Empty(); m_pData = StringData::Create(nLen); } -void CFX_WideString::AssignCopy(FX_STRSIZE nSrcLen, FX_LPCWSTR lpszSrcData) +void CFX_WideString::AssignCopy(FX_STRSIZE nSrcLen, const FX_WCHAR* lpszSrcData) { AllocBeforeWrite(nSrcLen); FXSYS_memcpy32(m_pData->m_String, lpszSrcData, nSrcLen * sizeof(FX_WCHAR)); m_pData->m_nDataLength = nSrcLen; m_pData->m_String[nSrcLen] = 0; } -int CFX_WideString::Compare(FX_LPCWSTR lpsz) const +int CFX_WideString::Compare(const FX_WCHAR* lpsz) const { if (m_pData == NULL) { return (lpsz == NULL || lpsz[0] == 0) ? 0 : -1; @@ -303,7 +303,7 @@ CFX_ByteString CFX_WideString::UTF16LE_Encode() const } int len = m_pData->m_nDataLength; CFX_ByteString result; - FX_LPSTR buffer = result.GetBuffer(len * 2 + 2); + FX_CHAR* buffer = result.GetBuffer(len * 2 + 2); for (int i = 0; i < len; i ++) { buffer[i * 2] = m_pData->m_String[i] & 0xff; buffer[i * 2 + 1] = m_pData->m_String[i] >> 8; @@ -325,7 +325,7 @@ void CFX_WideString::Reserve(FX_STRSIZE len) GetBuffer(len); ReleaseBuffer(GetLength()); } -FX_LPWSTR CFX_WideString::GetBuffer(FX_STRSIZE nMinBufLength) +FX_WCHAR* CFX_WideString::GetBuffer(FX_STRSIZE nMinBufLength) { if (m_pData == NULL && nMinBufLength == 0) { return NULL; @@ -471,7 +471,7 @@ CFX_WideString CFX_WideString::Right(FX_STRSIZE nCount) const AllocCopy(dest, nCount, m_pData->m_nDataLength - nCount); return dest; } -int CFX_WideString::CompareNoCase(FX_LPCWSTR lpsz) const +int CFX_WideString::CompareNoCase(const FX_WCHAR* lpsz) const { if (m_pData == NULL) { return (lpsz == NULL || lpsz[0] == 0) ? 0 : -1; @@ -537,13 +537,13 @@ void CFX_WideString::MakeUpper() } FXSYS_wcsupr(m_pData->m_String); } -FX_STRSIZE CFX_WideString::Find(FX_LPCWSTR lpszSub, FX_STRSIZE nStart) const +FX_STRSIZE CFX_WideString::Find(const FX_WCHAR* lpszSub, FX_STRSIZE nStart) const { FX_STRSIZE nLength = GetLength(); if (nLength < 1 || nStart > nLength) { return -1; } - FX_LPCWSTR lpsz = FXSYS_wcsstr(m_pData->m_String + nStart, lpszSub); + const FX_WCHAR* lpsz = FXSYS_wcsstr(m_pData->m_String + nStart, lpszSub); return (lpsz == NULL) ? -1 : (int)(lpsz - m_pData->m_String); } FX_STRSIZE CFX_WideString::Find(FX_WCHAR ch, FX_STRSIZE nStart) const @@ -555,10 +555,10 @@ FX_STRSIZE CFX_WideString::Find(FX_WCHAR ch, FX_STRSIZE nStart) const if (nStart >= nLength) { return -1; } - FX_LPCWSTR lpsz = FXSYS_wcschr(m_pData->m_String + nStart, ch); + const FX_WCHAR* lpsz = FXSYS_wcschr(m_pData->m_String + nStart, ch); return (lpsz == NULL) ? -1 : (int)(lpsz - m_pData->m_String); } -void CFX_WideString::TrimRight(FX_LPCWSTR lpszTargetList) +void CFX_WideString::TrimRight(const FX_WCHAR* lpszTargetList) { FXSYS_assert(lpszTargetList != NULL); if (m_pData == NULL || *lpszTargetList == 0) { @@ -590,7 +590,7 @@ void CFX_WideString::TrimRight() { TrimRight(L"\x09\x0a\x0b\x0c\x0d\x20"); } -void CFX_WideString::TrimLeft(FX_LPCWSTR lpszTargets) +void CFX_WideString::TrimLeft(const FX_WCHAR* lpszTargets) { FXSYS_assert(lpszTargets != NULL); if (m_pData == NULL || *lpszTargets == 0) { @@ -600,7 +600,7 @@ void CFX_WideString::TrimLeft(FX_LPCWSTR lpszTargets) if (GetLength() < 1) { return; } - FX_LPCWSTR lpsz = m_pData->m_String; + const FX_WCHAR* lpsz = m_pData->m_String; while (*lpsz != 0) { if (FXSYS_wcschr(lpszTargets, *lpsz) == NULL) { break; @@ -622,7 +622,7 @@ void CFX_WideString::TrimLeft() { TrimLeft(L"\x09\x0a\x0b\x0c\x0d\x20"); } -FX_STRSIZE CFX_WideString::Replace(FX_LPCWSTR lpszOld, FX_LPCWSTR lpszNew) +FX_STRSIZE CFX_WideString::Replace(const FX_WCHAR* lpszOld, const FX_WCHAR* lpszNew) { if (GetLength() < 1) { return 0; @@ -636,11 +636,11 @@ FX_STRSIZE CFX_WideString::Replace(FX_LPCWSTR lpszOld, FX_LPCWSTR lpszNew) } FX_STRSIZE nReplacementLen = lpszNew ? FXSYS_wcslen(lpszNew) : 0; FX_STRSIZE nCount = 0; - FX_LPWSTR lpszStart = m_pData->m_String; - FX_LPWSTR lpszEnd = m_pData->m_String + m_pData->m_nDataLength; - FX_LPWSTR lpszTarget; + FX_WCHAR* lpszStart = m_pData->m_String; + FX_WCHAR* lpszEnd = m_pData->m_String + m_pData->m_nDataLength; + FX_WCHAR* lpszTarget; { - while ((lpszTarget = (FX_LPWSTR)FXSYS_wcsstr(lpszStart, lpszOld)) != NULL && lpszStart < lpszEnd) { + while ((lpszTarget = (FX_WCHAR*)FXSYS_wcsstr(lpszStart, lpszOld)) != NULL && lpszStart < lpszEnd) { nCount++; lpszStart = lpszTarget + nSourceLen; } @@ -651,7 +651,7 @@ FX_STRSIZE CFX_WideString::Replace(FX_LPCWSTR lpszOld, FX_LPCWSTR lpszNew) FX_STRSIZE nNewLength = nOldLength + (nReplacementLen - nSourceLen) * nCount; if (m_pData->m_nAllocLength < nNewLength || m_pData->m_nRefs > 1) { StringData* pOldData = m_pData; - FX_LPCWSTR pstr = m_pData->m_String; + const FX_WCHAR* pstr = m_pData->m_String; m_pData = StringData::Create(nNewLength); if (!m_pData) { return 0; @@ -662,7 +662,7 @@ FX_STRSIZE CFX_WideString::Replace(FX_LPCWSTR lpszOld, FX_LPCWSTR lpszNew) lpszStart = m_pData->m_String; lpszEnd = m_pData->m_String + FX_MAX(m_pData->m_nDataLength, nNewLength); { - while ((lpszTarget = (FX_LPWSTR)FXSYS_wcsstr(lpszStart, lpszOld)) != NULL && lpszStart < lpszEnd) { + while ((lpszTarget = (FX_WCHAR*)FXSYS_wcsstr(lpszStart, lpszOld)) != NULL && lpszStart < lpszEnd) { FX_STRSIZE nBalance = nOldLength - (FX_STRSIZE)(lpszTarget - m_pData->m_String + nSourceLen); FXSYS_memmove32(lpszTarget + nReplacementLen, lpszTarget + nSourceLen, nBalance * sizeof(FX_WCHAR)); FXSYS_memcpy32(lpszTarget, lpszNew, nReplacementLen * sizeof(FX_WCHAR)); @@ -689,7 +689,7 @@ FX_STRSIZE CFX_WideString::Insert(FX_STRSIZE nIndex, FX_WCHAR ch) nNewLength++; if (m_pData == NULL || m_pData->m_nAllocLength < nNewLength) { StringData* pOldData = m_pData; - FX_LPCWSTR pstr = m_pData->m_String; + const FX_WCHAR* pstr = m_pData->m_String; m_pData = StringData::Create(nNewLength); if (!m_pData) { return 0; @@ -734,9 +734,9 @@ FX_STRSIZE CFX_WideString::Remove(FX_WCHAR chRemove) if (GetLength() < 1) { return 0; } - FX_LPWSTR pstrSource = m_pData->m_String; - FX_LPWSTR pstrDest = m_pData->m_String; - FX_LPWSTR pstrEnd = m_pData->m_String + m_pData->m_nDataLength; + FX_WCHAR* pstrSource = m_pData->m_String; + FX_WCHAR* pstrDest = m_pData->m_String; + FX_WCHAR* pstrEnd = m_pData->m_String + m_pData->m_nDataLength; while (pstrSource < pstrEnd) { if (*pstrSource != chRemove) { *pstrDest = *pstrSource; @@ -752,7 +752,7 @@ FX_STRSIZE CFX_WideString::Remove(FX_WCHAR chRemove) #define FORCE_ANSI 0x10000 #define FORCE_UNICODE 0x20000 #define FORCE_INT64 0x40000 -void CFX_WideString::FormatV(FX_LPCWSTR lpszFormat, va_list argList) +void CFX_WideString::FormatV(const FX_WCHAR* lpszFormat, va_list argList) { va_list argListSave; #if defined(__ARMCC_VERSION) || (!defined(_MSC_VER) && (_FX_CPU_ == _FX_X64_ || _FX_CPU_ == _FX_IA64_ || _FX_CPU_ == _FX_ARM64_)) || defined(__native_client__) @@ -761,7 +761,7 @@ void CFX_WideString::FormatV(FX_LPCWSTR lpszFormat, va_list argList) argListSave = argList; #endif int nMaxLen = 0; - for (FX_LPCWSTR lpsz = lpszFormat; *lpsz != 0; lpsz ++) { + for (const FX_WCHAR* lpsz = lpszFormat; *lpsz != 0; lpsz ++) { if (*lpsz != '%' || *(lpsz = lpsz + 1) == '%') { nMaxLen += FXSYS_wcslen(lpsz); continue; @@ -845,7 +845,7 @@ void CFX_WideString::FormatV(FX_LPCWSTR lpszFormat, va_list argList) va_arg(argList, int); break; case 's': { - FX_LPCWSTR pstrNextArg = va_arg(argList, FX_LPCWSTR); + const FX_WCHAR* pstrNextArg = va_arg(argList, const FX_WCHAR*); if (pstrNextArg == NULL) { nItemLen = 6; } else { @@ -857,7 +857,7 @@ void CFX_WideString::FormatV(FX_LPCWSTR lpszFormat, va_list argList) } break; case 'S': { - FX_LPCSTR pstrNextArg = va_arg(argList, FX_LPCSTR); + const FX_CHAR* pstrNextArg = va_arg(argList, const FX_CHAR*); if (pstrNextArg == NULL) { nItemLen = 6; } else { @@ -870,7 +870,7 @@ void CFX_WideString::FormatV(FX_LPCWSTR lpszFormat, va_list argList) break; case 's'|FORCE_ANSI: case 'S'|FORCE_ANSI: { - FX_LPCSTR pstrNextArg = va_arg(argList, FX_LPCSTR); + const FX_CHAR* pstrNextArg = va_arg(argList, const FX_CHAR*); if (pstrNextArg == NULL) { nItemLen = 6; } else { @@ -883,7 +883,7 @@ void CFX_WideString::FormatV(FX_LPCWSTR lpszFormat, va_list argList) break; case 's'|FORCE_UNICODE: case 'S'|FORCE_UNICODE: { - FX_LPWSTR pstrNextArg = va_arg(argList, FX_LPWSTR); + FX_WCHAR* pstrNextArg = va_arg(argList, FX_WCHAR*); if (pstrNextArg == NULL) { nItemLen = 6; } else { @@ -964,14 +964,14 @@ void CFX_WideString::FormatV(FX_LPCWSTR lpszFormat, va_list argList) } va_end(argListSave); } -void CFX_WideString::Format(FX_LPCWSTR lpszFormat, ...) +void CFX_WideString::Format(const FX_WCHAR* lpszFormat, ...) { va_list argList; va_start(argList, lpszFormat); FormatV(lpszFormat, argList); va_end(argList); } -FX_FLOAT FX_wtof(FX_LPCWSTR str, int len) +FX_FLOAT FX_wtof(const FX_WCHAR* str, int len) { if (len == 0) { return 0.0; @@ -1028,7 +1028,7 @@ static CFX_ByteString _DefMap_GetByteString(CFX_CharMap* pCharMap, const CFX_Wid return CFX_ByteString(); } CFX_ByteString bytestr; - FX_LPSTR dest_buf = bytestr.GetBuffer(dest_len); + FX_CHAR* dest_buf = bytestr.GetBuffer(dest_len); FXSYS_WideCharToMultiByte(codepage, 0, widestr.c_str(), src_len, dest_buf, dest_len, NULL, NULL); bytestr.ReleaseBuffer(dest_len); return bytestr; @@ -1042,7 +1042,7 @@ static CFX_WideString _DefMap_GetWideString(CFX_CharMap* pCharMap, const CFX_Byt return CFX_WideString(); } CFX_WideString widestr; - FX_LPWSTR dest_buf = widestr.GetBuffer(dest_len); + FX_WCHAR* dest_buf = widestr.GetBuffer(dest_len); FXSYS_MultiByteToWideChar(codepage, 0, bytestr, src_len, dest_buf, dest_len); widestr.ReleaseBuffer(dest_len); return widestr; diff --git a/core/src/fxcrt/fx_extension.cpp b/core/src/fxcrt/fx_extension.cpp index 9490f3603c..21aeffddc6 100644 --- a/core/src/fxcrt/fx_extension.cpp +++ b/core/src/fxcrt/fx_extension.cpp @@ -80,19 +80,19 @@ FX_BOOL FX_File_Truncate(FX_HFILE hFile, FX_FILESIZE szFile) FXSYS_assert(hFile != NULL); return ((IFXCRT_FileAccess*)hFile)->Truncate(szFile); } -IFX_FileAccess* FX_CreateDefaultFileAccess(FX_WSTR wsPath)
-{
- if (wsPath.GetLength() == 0)
- return NULL;
-
- CFX_CRTFileAccess* pFA = NULL;
- pFA = FX_NEW CFX_CRTFileAccess;
- if (NULL == pFA) return NULL;
-
- pFA->Init(wsPath);
- return pFA;
-}
-IFX_FileStream* FX_CreateFileStream(FX_LPCSTR filename, FX_DWORD dwModes) +IFX_FileAccess* FX_CreateDefaultFileAccess(FX_WSTR wsPath) +{ + if (wsPath.GetLength() == 0) + return NULL; + + CFX_CRTFileAccess* pFA = NULL; + pFA = FX_NEW CFX_CRTFileAccess; + if (NULL == pFA) return NULL; + + pFA->Init(wsPath); + return pFA; +} +IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, FX_DWORD dwModes) { IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create(); if (!pFA) { @@ -104,7 +104,7 @@ IFX_FileStream* FX_CreateFileStream(FX_LPCSTR filename, FX_DWORD dwModes) } return FX_NEW CFX_CRTFileStream(pFA); } -IFX_FileStream* FX_CreateFileStream(FX_LPCWSTR filename, FX_DWORD dwModes) +IFX_FileStream* FX_CreateFileStream(const FX_WCHAR* filename, FX_DWORD dwModes) { IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create(); if (!pFA) { @@ -116,23 +116,23 @@ IFX_FileStream* FX_CreateFileStream(FX_LPCWSTR filename, FX_DWORD dwModes) } return FX_NEW CFX_CRTFileStream(pFA); } -IFX_FileWrite* FX_CreateFileWrite(FX_LPCSTR filename) +IFX_FileWrite* FX_CreateFileWrite(const FX_CHAR* filename) { return FX_CreateFileStream(filename, FX_FILEMODE_Truncate); } -IFX_FileWrite* FX_CreateFileWrite(FX_LPCWSTR filename) +IFX_FileWrite* FX_CreateFileWrite(const FX_WCHAR* filename) { return FX_CreateFileStream(filename, FX_FILEMODE_Truncate); } -IFX_FileRead* FX_CreateFileRead(FX_LPCSTR filename) +IFX_FileRead* FX_CreateFileRead(const FX_CHAR* filename) { return FX_CreateFileStream(filename, FX_FILEMODE_ReadOnly); } -IFX_FileRead* FX_CreateFileRead(FX_LPCWSTR filename) +IFX_FileRead* FX_CreateFileRead(const FX_WCHAR* filename) { return FX_CreateFileStream(filename, FX_FILEMODE_ReadOnly); } -IFX_MemoryStream* FX_CreateMemoryStream(FX_LPBYTE pBuffer, size_t dwSize, FX_BOOL bTakeOver) +IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer, size_t dwSize, FX_BOOL bTakeOver) { return FX_NEW CFX_MemoryStream(pBuffer, dwSize, bTakeOver); } @@ -151,7 +151,7 @@ FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x) { return FXSYS_log(x) / FXSYS_log(b); } -FX_FLOAT FXSYS_strtof(FX_LPCSTR pcsStr, int32_t iLength, int32_t *pUsedLen) +FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr, int32_t iLength, int32_t *pUsedLen) { FXSYS_assert(pcsStr != NULL); if (iLength < 0) { @@ -160,7 +160,7 @@ FX_FLOAT FXSYS_strtof(FX_LPCSTR pcsStr, int32_t iLength, int32_t *pUsedLen) CFX_WideString ws = CFX_WideString::FromLocal(pcsStr, iLength); return FXSYS_wcstof(ws.c_str(), iLength, pUsedLen); } -FX_FLOAT FXSYS_wcstof(FX_LPCWSTR pwsStr, int32_t iLength, int32_t *pUsedLen) +FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, int32_t iLength, int32_t *pUsedLen) { FXSYS_assert(pwsStr != NULL); if (iLength < 0) { @@ -205,7 +205,7 @@ FX_FLOAT FXSYS_wcstof(FX_LPCWSTR pwsStr, int32_t iLength, int32_t *pUsedLen) } return bNegtive ? -fValue : fValue; } -FX_LPWSTR FXSYS_wcsncpy(FX_LPWSTR dstStr, FX_LPCWSTR srcStr, size_t count) +FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr, const FX_WCHAR* srcStr, size_t count) { FXSYS_assert(dstStr != NULL && srcStr != NULL && count > 0); for (size_t i = 0; i < count; ++i) @@ -214,7 +214,7 @@ FX_LPWSTR FXSYS_wcsncpy(FX_LPWSTR dstStr, FX_LPCWSTR srcStr, size_t count) } return dstStr; } -int32_t FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count) +int32_t FXSYS_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count) { FXSYS_assert(s1 != NULL && s2 != NULL && count > 0); FX_WCHAR wch1 = 0, wch2 = 0; @@ -227,7 +227,7 @@ int32_t FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count) } return wch1 - wch2; } -int32_t FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count) +int32_t FXSYS_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count) { FXSYS_assert(s1 != NULL && s2 != NULL && count > 0); FX_CHAR ch1 = 0, ch2 = 0; @@ -240,13 +240,13 @@ int32_t FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count) } return ch1 - ch2; } -FX_DWORD FX_HashCode_String_GetA(FX_LPCSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase) +FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase) { FXSYS_assert(pStr != NULL); if (iLength < 0) { iLength = (int32_t)FXSYS_strlen(pStr); } - FX_LPCSTR pStrEnd = pStr + iLength; + const FX_CHAR* pStrEnd = pStr + iLength; FX_DWORD dwHashCode = 0; if (bIgnoreCase) { while (pStr < pStrEnd) { @@ -259,13 +259,13 @@ FX_DWORD FX_HashCode_String_GetA(FX_LPCSTR pStr, int32_t iLength, FX_BOOL bIgnor } return dwHashCode; } -FX_DWORD FX_HashCode_String_GetW(FX_LPCWSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase) +FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase) { FXSYS_assert(pStr != NULL); if (iLength < 0) { iLength = (int32_t)FXSYS_wcslen(pStr); } - FX_LPCWSTR pStrEnd = pStr + iLength; + const FX_WCHAR* pStrEnd = pStr + iLength; FX_DWORD dwHashCode = 0; if (bIgnoreCase) { while (pStr < pStrEnd) { @@ -284,26 +284,26 @@ FX_DWORD FX_HashCode_String_GetW(FX_LPCWSTR pStr, int32_t iLength, FX_BOOL bIgno #ifdef __cplusplus extern "C" { #endif -FX_LPVOID FX_Random_MT_Start(FX_DWORD dwSeed) +void* FX_Random_MT_Start(FX_DWORD dwSeed) { FX_LPMTRANDOMCONTEXT pContext = FX_Alloc(FX_MTRANDOMCONTEXT, 1); pContext->mt[0] = dwSeed; FX_DWORD &i = pContext->mti; - FX_LPDWORD pBuf = pContext->mt; + FX_DWORD* pBuf = pContext->mt; for (i = 1; i < MT_N; i ++) { pBuf[i] = (1812433253UL * (pBuf[i - 1] ^ (pBuf[i - 1] >> 30)) + i); } pContext->bHaveSeed = TRUE; return pContext; } -FX_DWORD FX_Random_MT_Generate(FX_LPVOID pContext) +FX_DWORD FX_Random_MT_Generate(void* pContext) { FXSYS_assert(pContext != NULL); FX_LPMTRANDOMCONTEXT pMTC = (FX_LPMTRANDOMCONTEXT)pContext; FX_DWORD v; static FX_DWORD mag[2] = {0, MT_Matrix_A}; FX_DWORD &mti = pMTC->mti; - FX_LPDWORD pBuf = pMTC->mt; + FX_DWORD* pBuf = pMTC->mt; if ((int)mti < 0 || mti >= MT_N) { if (mti > MT_N && !pMTC->bHaveSeed) { return 0; @@ -328,12 +328,12 @@ FX_DWORD FX_Random_MT_Generate(FX_LPVOID pContext) v ^= (v >> 18); return v; } -void FX_Random_MT_Close(FX_LPVOID pContext) +void FX_Random_MT_Close(void* pContext) { FXSYS_assert(pContext != NULL); FX_Free(pContext); } -void FX_Random_GenerateMT(FX_LPDWORD pBuffer, int32_t iCount) +void FX_Random_GenerateMT(FX_DWORD* pBuffer, int32_t iCount) { FX_DWORD dwSeed; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ @@ -343,13 +343,13 @@ void FX_Random_GenerateMT(FX_LPDWORD pBuffer, int32_t iCount) #else FX_Random_GenerateBase(&dwSeed, 1); #endif - FX_LPVOID pContext = FX_Random_MT_Start(dwSeed); + void* pContext = FX_Random_MT_Start(dwSeed); while (iCount -- > 0) { *pBuffer ++ = FX_Random_MT_Generate(pContext); } FX_Random_MT_Close(pContext); } -void FX_Random_GenerateBase(FX_LPDWORD pBuffer, int32_t iCount) +void FX_Random_GenerateBase(FX_DWORD* pBuffer, int32_t iCount) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ SYSTEMTIME st1, st2; @@ -357,8 +357,8 @@ void FX_Random_GenerateBase(FX_LPDWORD pBuffer, int32_t iCount) do { ::GetSystemTime(&st2); } while (FXSYS_memcmp32(&st1, &st2, sizeof(SYSTEMTIME)) == 0); - FX_DWORD dwHash1 = FX_HashCode_String_GetA((FX_LPCSTR)&st1, sizeof(st1), TRUE); - FX_DWORD dwHash2 = FX_HashCode_String_GetA((FX_LPCSTR)&st2, sizeof(st2), TRUE); + FX_DWORD dwHash1 = FX_HashCode_String_GetA((const FX_CHAR*)&st1, sizeof(st1), TRUE); + FX_DWORD dwHash2 = FX_HashCode_String_GetA((const FX_CHAR*)&st2, sizeof(st2), TRUE); ::srand((dwHash1 << 16) | (FX_DWORD)dwHash2); #else time_t tmLast = time(NULL), tmCur; @@ -370,18 +370,18 @@ void FX_Random_GenerateBase(FX_LPDWORD pBuffer, int32_t iCount) } } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, int32_t iCount) +FX_BOOL FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount) { HCRYPTPROV hCP = NULL; if (!::CryptAcquireContext(&hCP, NULL, NULL, PROV_RSA_FULL, 0) || hCP == NULL) { return FALSE; } - ::CryptGenRandom(hCP, iCount * sizeof(FX_DWORD), (FX_LPBYTE)pBuffer); + ::CryptGenRandom(hCP, iCount * sizeof(FX_DWORD), (uint8_t*)pBuffer); ::CryptReleaseContext(hCP, 0); return TRUE; } #endif -void FX_Random_GenerateCrypto(FX_LPDWORD pBuffer, int32_t iCount) +void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ FX_GenerateCryptoRandom(pBuffer, iCount); @@ -399,25 +399,25 @@ void FX_GUID_CreateV4(FX_LPGUID pGUID) {
#if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || _FX_OS_ == _FX_WIN64_)
#ifdef _FX_WINAPI_PARTITION_DESKTOP_
- if (!FX_GenerateCryptoRandom((FX_LPDWORD)pGUID, 4)) {
- FX_Random_GenerateMT((FX_LPDWORD)pGUID, 4);
+ if (!FX_GenerateCryptoRandom((FX_DWORD*)pGUID, 4)) {
+ FX_Random_GenerateMT((FX_DWORD*)pGUID, 4);
}
#else
- FX_Random_GenerateMT((FX_LPDWORD)pGUID, 4);
+ FX_Random_GenerateMT((FX_DWORD*)pGUID, 4);
#endif
#else
- FX_Random_GenerateMT((FX_LPDWORD)pGUID, 4);
+ FX_Random_GenerateMT((FX_DWORD*)pGUID, 4);
#endif
- uint8_t &b = ((FX_LPBYTE)pGUID)[6];
+ uint8_t &b = ((uint8_t*)pGUID)[6];
b = (b & 0x0F) | 0x40;
}
-FX_LPCSTR gs_FX_pHexChars = "0123456789ABCDEF";
+const FX_CHAR* gs_FX_pHexChars = "0123456789ABCDEF";
void FX_GUID_ToString(FX_LPCGUID pGUID, CFX_ByteString &bsStr, FX_BOOL bSeparator)
{
- FX_LPSTR pBuf = bsStr.GetBuffer(40);
+ FX_CHAR* pBuf = bsStr.GetBuffer(40);
uint8_t b;
for (int32_t i = 0; i < 16; i ++) {
- b = ((FX_LPCBYTE)pGUID)[i];
+ b = ((const uint8_t*)pGUID)[i];
*pBuf ++ = gs_FX_pHexChars[b >> 4];
*pBuf ++ = gs_FX_pHexChars[b & 0x0F];
if (bSeparator && (i == 3 || i == 5 || i == 7 || i == 9)) {
diff --git a/core/src/fxcrt/fx_xml_parser.cpp b/core/src/fxcrt/fx_xml_parser.cpp index 040fefab63..1eec20c371 100644 --- a/core/src/fxcrt/fx_xml_parser.cpp +++ b/core/src/fxcrt/fx_xml_parser.cpp @@ -12,7 +12,7 @@ CXML_Parser::~CXML_Parser() m_pDataAcc->Release(); } } -FX_BOOL CXML_Parser::Init(FX_LPBYTE pBuffer, size_t size) +FX_BOOL CXML_Parser::Init(uint8_t* pBuffer, size_t size) { m_pDataAcc = FX_NEW CXML_DataBufAcc(pBuffer, size); if (!m_pDataAcc) { @@ -485,7 +485,7 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, FX_BOOL bStartTag break; } pSubElement->m_pParent = pElement; - pElement->m_Children.Add((FX_LPVOID)CXML_Element::Element); + pElement->m_Children.Add((void*)CXML_Element::Element); pElement->m_Children.Add(pSubElement); SkipWhiteSpaces(); } @@ -535,7 +535,7 @@ void CXML_Parser::InsertContentSegment(FX_BOOL bCDATA, FX_WSTR content, CXML_Ele return; } pContent->Set(bCDATA, content); - pElement->m_Children.Add((FX_LPVOID)CXML_Element::Content); + pElement->m_Children.Add((void*)CXML_Element::Content); pElement->m_Children.Add(pContent); } static CXML_Element* XML_ContinueParse(CXML_Parser &parser, FX_BOOL bSaveSpaceChars, FX_FILESIZE* pParsedSize) @@ -550,7 +550,7 @@ static CXML_Element* XML_ContinueParse(CXML_Parser &parser, FX_BOOL bSaveSpaceCh CXML_Element* CXML_Element::Parse(const void* pBuffer, size_t size, FX_BOOL bSaveSpaceChars, FX_FILESIZE* pParsedSize) { CXML_Parser parser; - if (!parser.Init((FX_LPBYTE)pBuffer, size)) { + if (!parser.Init((uint8_t*)pBuffer, size)) { return NULL; } return XML_ContinueParse(parser, bSaveSpaceChars, pParsedSize); diff --git a/core/src/fxcrt/fxcrt_platforms.cpp b/core/src/fxcrt/fxcrt_platforms.cpp index 74affbe4b9..e5259c2b54 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(uint8_t, 32768); + uint8_t* 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 701c910551..dd2aaf27d0 100644 --- a/core/src/fxcrt/fxcrt_posix.cpp +++ b/core/src/fxcrt/fxcrt_posix.cpp @@ -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(uint8_t, 32768); + uint8_t* 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_windows.h b/core/src/fxcrt/fxcrt_windows.h index 1919f3e4d7..32531d568f 100644 --- a/core/src/fxcrt/fxcrt_windows.h +++ b/core/src/fxcrt/fxcrt_windows.h @@ -29,7 +29,7 @@ public: virtual FX_BOOL Flush(); virtual FX_BOOL Truncate(FX_FILESIZE szFile); protected: - FX_LPVOID m_hFile; + void* m_hFile; }; #endif diff --git a/core/src/fxcrt/xml_int.h b/core/src/fxcrt/xml_int.h index 4155a39ffa..0220301d17 100644 --- a/core/src/fxcrt/xml_int.h +++ b/core/src/fxcrt/xml_int.h @@ -10,7 +10,7 @@ class CXML_DataBufAcc : public IFX_BufferRead { public: - CXML_DataBufAcc(FX_LPCBYTE pBuffer, size_t size) + CXML_DataBufAcc(const uint8_t* pBuffer, size_t size) : m_pBuffer(pBuffer) , m_dwSize(size) , m_dwCurPos(0) @@ -44,7 +44,7 @@ public: } return FALSE; } - virtual FX_LPCBYTE GetBlockBuffer() + virtual const uint8_t* GetBlockBuffer() { return m_pBuffer; } @@ -57,7 +57,7 @@ public: return 0; } protected: - FX_LPCBYTE m_pBuffer; + const uint8_t* m_pBuffer; size_t m_dwSize; size_t m_dwCurPos; }; @@ -111,9 +111,9 @@ public: } return m_pFileRead->ReadBlock(m_pBuffer, m_nStart, m_dwSize); } - virtual FX_LPCBYTE GetBlockBuffer() + virtual const uint8_t* GetBlockBuffer() { - return (FX_LPCBYTE)m_pBuffer; + return (const uint8_t*)m_pBuffer; } virtual size_t GetBlockSize() { @@ -125,7 +125,7 @@ public: } protected: IFX_FileRead *m_pFileRead; - FX_LPBYTE m_pBuffer; + uint8_t* m_pBuffer; FX_FILESIZE m_nStart; size_t m_dwSize; }; @@ -137,11 +137,11 @@ public: FX_BOOL m_bOwnedStream; FX_FILESIZE m_nOffset; FX_BOOL m_bSaveSpaceChars; - FX_LPCBYTE m_pBuffer; + const uint8_t* m_pBuffer; size_t m_dwBufferSize; FX_FILESIZE m_nBufferOffset; size_t m_dwIndex; - FX_BOOL Init(FX_LPBYTE pBuffer, size_t size); + FX_BOOL Init(uint8_t* pBuffer, size_t size); FX_BOOL Init(IFX_FileRead *pFileRead); FX_BOOL Init(IFX_BufferRead *pBuffer); FX_BOOL Init(FX_BOOL bOwndedStream); diff --git a/core/src/fxge/agg/agg23/fx_agg_driver.cpp b/core/src/fxge/agg/agg23/fx_agg_driver.cpp index 978756cd64..e11259e07d 100644 --- a/core/src/fxge/agg/agg23/fx_agg_driver.cpp +++ b/core/src/fxge/agg/agg23/fx_agg_driver.cpp @@ -385,12 +385,12 @@ private: const CFX_DIBitmap* m_pClipMask; CFX_DIBitmap* m_pDevice; const CFX_ClipRgn* m_pClipRgn; - void (CFX_Renderer::*composite_span)(FX_LPBYTE, int, int, int, FX_LPBYTE, int, int, FX_LPBYTE, FX_LPBYTE); + void (CFX_Renderer::*composite_span)(uint8_t*, int, int, int, uint8_t*, int, int, uint8_t*, uint8_t*); public: void prepare(unsigned) {} - void CompositeSpan(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan, int Bpp, FX_BOOL bDestAlpha, - int span_left, int span_len, FX_LPBYTE cover_scan, - int clip_left, int clip_right, FX_LPBYTE clip_scan) + void CompositeSpan(uint8_t* dest_scan, uint8_t* ori_scan, int Bpp, FX_BOOL bDestAlpha, + int span_left, int span_len, uint8_t* cover_scan, + int clip_left, int clip_right, uint8_t* clip_scan) { ASSERT(!m_pDevice->IsCmykImage()); int col_start = span_left < clip_left ? clip_left - span_left : 0; @@ -551,7 +551,7 @@ public: index = i; } } - FX_LPBYTE dest_scan1 = dest_scan; + uint8_t* dest_scan1 = dest_scan; for (int col = col_start; col < col_end; col ++) { int src_alpha; if (clip_scan) { @@ -570,10 +570,10 @@ public: } } } - void CompositeSpan1bpp(FX_LPBYTE dest_scan, int Bpp, - int span_left, int span_len, FX_LPBYTE cover_scan, - int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + void CompositeSpan1bpp(uint8_t* dest_scan, int Bpp, + int span_left, int span_len, uint8_t* cover_scan, + int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_bRgbByteOrder); ASSERT(!m_pDevice->IsCmykImage()); @@ -589,7 +589,7 @@ public: index = i; } } - FX_LPBYTE dest_scan1 = dest_scan; + uint8_t* dest_scan1 = dest_scan; for (int col = col_start; col < col_end; col ++) { int src_alpha; if (clip_scan) { @@ -607,10 +607,10 @@ public: dest_scan1 = dest_scan + (span_left % 8 + col - col_start + 1) / 8; } } - void CompositeSpanGray(FX_LPBYTE dest_scan, int Bpp, - int span_left, int span_len, FX_LPBYTE cover_scan, - int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + void CompositeSpanGray(uint8_t* dest_scan, int Bpp, + int span_left, int span_len, uint8_t* cover_scan, + int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_bRgbByteOrder); int col_start = span_left < clip_left ? clip_left - span_left : 0; @@ -668,10 +668,10 @@ public: } } } - void CompositeSpanARGB(FX_LPBYTE dest_scan, int Bpp, - int span_left, int span_len, FX_LPBYTE cover_scan, - int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + void CompositeSpanARGB(uint8_t* dest_scan, int Bpp, + int span_left, int span_len, uint8_t* cover_scan, + int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { 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); @@ -754,10 +754,10 @@ public: dest_scan += Bpp; } } - void CompositeSpanRGB(FX_LPBYTE dest_scan, int Bpp, - int span_left, int span_len, FX_LPBYTE cover_scan, - int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + void CompositeSpanRGB(uint8_t* dest_scan, int Bpp, + int span_left, int span_len, uint8_t* cover_scan, + int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { 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); @@ -874,10 +874,10 @@ public: } } } - void CompositeSpanCMYK(FX_LPBYTE dest_scan, int Bpp, - int span_left, int span_len, FX_LPBYTE cover_scan, - int clip_left, int clip_right, FX_LPBYTE clip_scan, - FX_LPBYTE dest_extra_alpha_scan) + void CompositeSpanCMYK(uint8_t* dest_scan, int Bpp, + int span_left, int span_len, uint8_t* cover_scan, + int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_bRgbByteOrder); int col_start = span_left < clip_left ? clip_left - span_left : 0; @@ -958,13 +958,13 @@ public: if (y < m_ClipBox.top || y >= m_ClipBox.bottom) { return; } - FX_LPBYTE dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * y; - FX_LPBYTE dest_scan_extra_alpha = NULL; + uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * y; + uint8_t* dest_scan_extra_alpha = NULL; CFX_DIBitmap* pAlphaMask = m_pDevice->m_pAlphaMask; if (pAlphaMask) { dest_scan_extra_alpha = pAlphaMask->GetBuffer() + pAlphaMask->GetPitch() * y; } - FX_LPBYTE ori_scan = NULL; + uint8_t* ori_scan = NULL; if (m_pOriDevice) { ori_scan = m_pOriDevice->GetBuffer() + m_pOriDevice->GetPitch() * y; } @@ -975,9 +975,9 @@ public: while (1) { int x = span->x; ASSERT(span->len > 0); - FX_LPBYTE dest_pos = NULL; - FX_LPBYTE dest_extra_alpha_pos = NULL; - FX_LPBYTE ori_pos = NULL; + uint8_t* dest_pos = NULL; + uint8_t* dest_extra_alpha_pos = NULL; + uint8_t* ori_pos = NULL; if (Bpp) { ori_pos = ori_scan ? ori_scan + x * Bpp : NULL; dest_pos = dest_scan + x * Bpp; @@ -986,7 +986,7 @@ public: dest_pos = dest_scan + x / 8; ori_pos = ori_scan ? ori_scan + x / 8 : NULL; } - FX_LPBYTE clip_pos = NULL; + uint8_t* clip_pos = NULL; if (m_pClipMask) { clip_pos = m_pClipMask->GetBuffer() + (y - m_ClipBox.top) * m_pClipMask->GetPitch() + x - m_ClipBox.left; } @@ -1040,7 +1040,7 @@ public: if (pIccTransform) { uint8_t gray; color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); - pIccModule->TranslateScanline(pIccTransform, &gray, (FX_LPCBYTE)&color, 1); + pIccModule->TranslateScanline(pIccTransform, &gray, (const uint8_t*)&color, 1); m_Gray = gray; } else { if (bObjectCMYK) { @@ -1061,28 +1061,28 @@ public: if (bObjectCMYK) { m_Color = FXCMYK_TODIB(color); if (pIccTransform) { - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&m_Color, (FX_LPCBYTE)&m_Color, 1); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&m_Color, 1); } } else { if (!pIccTransform) { return FALSE; } color = FXARGB_TODIB(color); - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&m_Color, (FX_LPCBYTE)&color, 1); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&color, 1); } - m_Red = ((FX_LPBYTE)&m_Color)[0]; - m_Green = ((FX_LPBYTE)&m_Color)[1]; - m_Blue = ((FX_LPBYTE)&m_Color)[2]; - m_Gray = ((FX_LPBYTE)&m_Color)[3]; + m_Red = ((uint8_t*)&m_Color)[0]; + m_Green = ((uint8_t*)&m_Color)[1]; + m_Blue = ((uint8_t*)&m_Color)[2]; + m_Gray = ((uint8_t*)&m_Color)[3]; } else { composite_span = (pDevice->GetFormat() == FXDIB_Argb) ? &CFX_Renderer::CompositeSpanARGB : &CFX_Renderer::CompositeSpanRGB; if (pIccTransform) { color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&m_Color, (FX_LPCBYTE)&color, 1); - ((FX_LPBYTE)&m_Color)[3] = m_Alpha; - m_Red = ((FX_LPBYTE)&m_Color)[2]; - m_Green = ((FX_LPBYTE)&m_Color)[1]; - m_Blue = ((FX_LPBYTE)&m_Color)[0]; + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&color, 1); + ((uint8_t*)&m_Color)[3] = m_Alpha; + m_Red = ((uint8_t*)&m_Color)[2]; + m_Green = ((uint8_t*)&m_Color)[1]; + m_Blue = ((uint8_t*)&m_Color)[0]; if (m_bRgbByteOrder) { m_Color = FXARGB_TODIB(m_Color); m_Color = FXARGB_TOBGRORDERDIB(m_Color); @@ -1201,7 +1201,7 @@ void RgbByteOrderSetPixel(CFX_DIBitmap* pBitmap, int x, int y, FX_DWORD argb) if (x < 0 || x >= pBitmap->GetWidth() || y < 0 || y >= pBitmap->GetHeight()) { return; } - FX_LPBYTE pos = (uint8_t*)pBitmap->GetBuffer() + y * pBitmap->GetPitch() + x * pBitmap->GetBPP() / 8; + uint8_t* pos = (uint8_t*)pBitmap->GetBuffer() + y * pBitmap->GetPitch() + x * pBitmap->GetBPP() / 8; if (pBitmap->GetFormat() == FXDIB_Argb) { FXARGB_SETRGBORDERDIB(pos, ArgbGamma(argb)); } else { @@ -1227,7 +1227,7 @@ void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap, int left, int top, int wid 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; + uint8_t* dest_scan = pBuffer + row * pBitmap->GetPitch() + rect.left * Bpp; if (Bpp == 4) { FX_DWORD* scan = (FX_DWORD*)dest_scan; for (int col = 0; col < width; col ++) { @@ -1247,7 +1247,7 @@ void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap, int left, int top, int wid src_g = FX_GAMMA(src_g); src_b = FX_GAMMA(src_b); for (int row = rect.top; row < rect.bottom; row ++) { - FX_LPBYTE dest_scan = pBuffer + row * pBitmap->GetPitch() + rect.left * Bpp; + uint8_t* dest_scan = pBuffer + row * pBitmap->GetPitch() + rect.left * Bpp; if (bAlpha) { for (int col = 0; col < width; col ++) { uint8_t back_alpha = dest_scan[3]; @@ -1298,8 +1298,8 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t 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; - FX_LPBYTE src_scan = (FX_LPBYTE)pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp; + uint8_t* dest_scan = buffer + (dest_top + row) * pitch + dest_left * Bpp; + uint8_t* src_scan = (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp; if (Bpp == 4) { for (int col = 0; col < width; col ++) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_scan[3], src_scan[0], src_scan[1], src_scan[2])); @@ -1317,12 +1317,12 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t } return; } - FX_LPBYTE dest_buf = buffer + dest_top * pitch + dest_left * Bpp; + uint8_t* dest_buf = buffer + dest_top * pitch + dest_left * Bpp; if (dest_format == FXDIB_Rgb) { if (src_format == FXDIB_Rgb32) { for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * pitch; - FX_LPBYTE src_scan = (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 4; + uint8_t* dest_scan = dest_buf + row * pitch; + uint8_t* 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]; @@ -1337,7 +1337,7 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t if (src_format == FXDIB_Rgb) { for (int row = 0; row < height; row ++) { uint8_t* dest_scan = (uint8_t*)(dest_buf + row * pitch); - FX_LPBYTE src_scan = (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 3; + uint8_t* 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]))); @@ -1355,8 +1355,8 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t } else if (src_format == FXDIB_Rgb32) { ASSERT(dest_format == FXDIB_Argb); for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * pitch; - FX_LPBYTE src_scan = (FX_LPBYTE)(pSrcBitmap->GetScanline(src_top + row) + src_left * 4); + uint8_t* dest_scan = dest_buf + row * pitch; + uint8_t* src_scan = (uint8_t*)(pSrcBitmap->GetScanline(src_top + row) + src_left * 4); for (int col = 0; col < width; col++) { FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[0], src_scan[1], src_scan[2])); src_scan += 4; @@ -1382,7 +1382,7 @@ FX_BOOL _DibSetPixel(CFX_DIBitmap* pDevice, int x, int y, FX_DWORD color, int al if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); color = bObjCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&color, (FX_LPBYTE)&color, 1); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&color, (uint8_t*)&color, 1); color = bObjCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); if (!pDevice->IsCmykImage()) { color = (color & 0xffffff) | (alpha << 24); @@ -1559,7 +1559,7 @@ FX_BOOL CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWOR return TRUE; } FX_BOOL CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_alpha, FX_DWORD argb, - const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type) { if (m_pBitmap->GetBuffer() == NULL) { @@ -1573,14 +1573,14 @@ FX_BOOL CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int bitma handle = pRenderer; return TRUE; } -FX_BOOL CFX_AggDeviceDriver::ContinueDIBits(FX_LPVOID pHandle, IFX_Pause* pPause) +FX_BOOL CFX_AggDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) { if (m_pBitmap->GetBuffer() == NULL) { return TRUE; } return ((CFX_ImageRenderer*)pHandle)->Continue(pPause); } -void CFX_AggDeviceDriver::CancelDIBits(FX_LPVOID pHandle) +void CFX_AggDeviceDriver::CancelDIBits(void* pHandle) { if (m_pBitmap->GetBuffer() == NULL) { return; diff --git a/core/src/fxge/agg/include/fx_agg_driver.h b/core/src/fxge/agg/include/fx_agg_driver.h index f4b9368eff..803227e044 100644 --- a/core/src/fxge/agg/include/fx_agg_driver.h +++ b/core/src/fxge/agg/include/fx_agg_driver.h @@ -86,10 +86,10 @@ public: int alpha_flag, void* pIccTransform, int blend_type); virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, - const CFX_AffineMatrix* pMatrix, FX_DWORD flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type); - virtual FX_BOOL ContinueDIBits(FX_LPVOID handle, IFX_Pause* pPause); - virtual void CancelDIBits(FX_LPVOID handle); + virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause); + virtual void CancelDIBits(void* handle); virtual FX_BOOL DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color, @@ -99,7 +99,7 @@ public: void SetClipMask(FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa)& rasterizer); - virtual FX_LPBYTE GetBuffer() const + virtual uint8_t* GetBuffer() const { return m_pBitmap->GetBuffer(); } diff --git a/core/src/fxge/android/fpf_skiafont.cpp b/core/src/fxge/android/fpf_skiafont.cpp index 290d989851..213a6595aa 100644 --- a/core/src/fxge/android/fpf_skiafont.cpp +++ b/core/src/fxge/android/fpf_skiafont.cpp @@ -156,7 +156,7 @@ int32_t CFPF_SkiaFont::GetItalicAngle() const } return 0; } -FX_DWORD CFPF_SkiaFont::GetFontData(FX_DWORD dwTable, FX_LPBYTE pBuffer, FX_DWORD dwSize) +FX_DWORD CFPF_SkiaFont::GetFontData(FX_DWORD dwTable, uint8_t* pBuffer, FX_DWORD dwSize) { if (!m_Face) { return FALSE; @@ -184,7 +184,7 @@ FX_BOOL CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescrip break; case FPF_SKIAFONTTYPE_Buffer: { CFPF_SkiaBufferFont *pFont = (CFPF_SkiaBufferFont*)pFontDes; - m_Face = pFontMgr->GetFontFace((FX_LPCBYTE)pFont->m_pBuffer, pFont->m_szBuffer, pFont->m_iFaceIndex); + m_Face = pFontMgr->GetFontFace((const uint8_t*)pFont->m_pBuffer, pFont->m_szBuffer, pFont->m_iFaceIndex); } break; default: diff --git a/core/src/fxge/android/fpf_skiafont.h b/core/src/fxge/android/fpf_skiafont.h index 72b569fe2e..af33402846 100644 --- a/core/src/fxge/android/fpf_skiafont.h +++ b/core/src/fxge/android/fpf_skiafont.h @@ -44,7 +44,7 @@ public: virtual int32_t GetHeight() const; virtual int32_t GetItalicAngle() const; - virtual FX_DWORD GetFontData(FX_DWORD dwTable, FX_LPBYTE pBuffer, FX_DWORD dwSize); + virtual FX_DWORD GetFontData(FX_DWORD dwTable, uint8_t* pBuffer, FX_DWORD dwSize); FX_BOOL InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, FX_BSTR bsFamily, FX_DWORD dwStyle, uint8_t uCharset); protected: CFPF_SkiaFontMgr *m_pFontMgr; diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp index 6b27f073e5..df9ce8983a 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.cpp +++ b/core/src/fxge/android/fpf_skiafontmgr.cpp @@ -103,7 +103,7 @@ FX_DWORD FPF_SkiaGetSansFont(FX_DWORD dwHash) } return 0; } -static uint32_t FPF_GetHashCode_StringA(FX_LPCSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE) +static uint32_t FPF_GetHashCode_StringA(const FX_CHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE) { if (!pStr) { return 0; @@ -111,7 +111,7 @@ static uint32_t FPF_GetHashCode_StringA(FX_LPCSTR pStr, int32_t iLength, FX_BOOL if (iLength < 0) { iLength = FXSYS_strlen(pStr); } - FX_LPCSTR pStrEnd = pStr + iLength; + const FX_CHAR* pStrEnd = pStr + iLength; uint32_t uHashCode = 0; if (bIgnoreCase) { while (pStr < pStrEnd) { @@ -185,7 +185,7 @@ static FX_DWORD FPF_SKIANormalizeFontName(FX_BSTR bsfamily) { FX_DWORD dwHash = 0; int32_t iLength = bsfamily.GetLength(); - FX_LPCSTR pBuffer = bsfamily.GetCStr(); + const FX_CHAR* pBuffer = bsfamily.GetCStr(); for (int32_t i = 0; i < iLength; i++) { FX_CHAR ch = pBuffer[i]; if (ch == ' ' || ch == '-' || ch == ',') { @@ -276,7 +276,7 @@ void CFPF_SkiaFontMgr::LoadPrivateFont(IFX_FileRead* pFontFile) void CFPF_SkiaFontMgr::LoadPrivateFont(FX_BSTR bsFileName) { } -void CFPF_SkiaFontMgr::LoadPrivateFont(FX_LPVOID pBuffer, size_t szBuffer) +void CFPF_SkiaFontMgr::LoadPrivateFont(void* pBuffer, size_t szBuffer) { } IFPF_Font* CFPF_SkiaFontMgr::CreateFont(FX_BSTR bsFamilyname, uint8_t uCharset, FX_DWORD dwStyle, FX_DWORD dwMatch) @@ -417,7 +417,7 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(FX_BSTR bsFile, int32_t iFaceIndex ) FXFT_Set_Pixel_Sizes(face, 0, 64); return face; } -FXFT_Face CFPF_SkiaFontMgr::GetFontFace(FX_LPCBYTE pBuffer, size_t szBuffer, int32_t iFaceIndex ) +FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const uint8_t* pBuffer, size_t szBuffer, int32_t iFaceIndex ) { if (!pBuffer || szBuffer < 1) { return NULL; diff --git a/core/src/fxge/android/fpf_skiafontmgr.h b/core/src/fxge/android/fpf_skiafontmgr.h index 44d427f8af..ba9ea9134a 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.h +++ b/core/src/fxge/android/fpf_skiafontmgr.h @@ -26,7 +26,7 @@ public: { return FPF_SKIAFONTTYPE_Unknown; } - void SetFamily(FX_LPCSTR pFamily) + void SetFamily(const FX_CHAR* pFamily) { if (m_pFamily) { FX_Free(m_pFamily); @@ -36,7 +36,7 @@ public: FXSYS_memcpy32(m_pFamily, pFamily, iSize * sizeof(FX_CHAR)); m_pFamily[iSize] = 0; } - FX_LPSTR m_pFamily; + FX_CHAR* m_pFamily; FX_DWORD m_dwStyle; int32_t m_iFaceIndex; FX_DWORD m_dwCharsets; @@ -56,7 +56,7 @@ public: { return FPF_SKIAFONTTYPE_Path; } - void SetPath(FX_LPCSTR pPath) + void SetPath(const FX_CHAR* pPath) { if (m_pPath) { FX_Free(m_pPath); @@ -66,7 +66,7 @@ public: FXSYS_memcpy32(m_pPath, pPath, iSize * sizeof(FX_CHAR)); m_pPath[iSize] = 0; } - FX_LPSTR m_pPath; + FX_CHAR* m_pPath; }; class CFPF_SkiaFileFont : public CFPF_SkiaFontDescriptor { @@ -86,7 +86,7 @@ public: { return FPF_SKIAFONTTYPE_Buffer; } - FX_LPVOID m_pBuffer; + void* m_pBuffer; size_t m_szBuffer; }; class CFPF_SkiaFontMgr : public IFPF_FontMgr @@ -98,12 +98,12 @@ public: virtual void LoadSystemFonts(); virtual void LoadPrivateFont(IFX_FileRead* pFontFile); virtual void LoadPrivateFont(FX_BSTR bsFileName); - virtual void LoadPrivateFont(FX_LPVOID pBuffer, size_t szBuffer); + virtual void LoadPrivateFont(void* pBuffer, size_t szBuffer); 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); + FXFT_Face GetFontFace(const uint8_t* 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/android/fx_android_font.cpp b/core/src/fxge/android/fx_android_font.cpp index 5f8aafc393..48331c2dd0 100644 --- a/core/src/fxge/android/fx_android_font.cpp +++ b/core/src/fxge/android/fx_android_font.cpp @@ -23,7 +23,7 @@ FX_BOOL CFX_AndroidFontInfo::EnumFontList(CFX_FontMapper* pMapper) { return FALSE; } -void* CFX_AndroidFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR face, FX_BOOL& bExact) +void* CFX_AndroidFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact) { if (!m_pFontMgr) { return NULL; @@ -46,11 +46,11 @@ void* CFX_AndroidFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int } return m_pFontMgr->CreateFont(face, charset, dwStyle, FPF_MATCHFONT_REPLACEANSI); } -void* CFX_AndroidFontInfo::GetFont(FX_LPCSTR face) +void* CFX_AndroidFontInfo::GetFont(const FX_CHAR* face) { return NULL; } -FX_DWORD CFX_AndroidFontInfo::GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffer, FX_DWORD size) +FX_DWORD CFX_AndroidFontInfo::GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer, FX_DWORD size) { if (!hFont) { return 0; diff --git a/core/src/fxge/android/fx_android_font.h b/core/src/fxge/android/fx_android_font.h index fb7ff7cd92..0e79abaa9f 100644 --- a/core/src/fxge/android/fx_android_font.h +++ b/core/src/fxge/android/fx_android_font.h @@ -20,10 +20,10 @@ public: virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper); - virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR face, FX_BOOL& bExact); + virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact); - virtual void* GetFont(FX_LPCSTR face); - virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffer, FX_DWORD size); + virtual void* GetFont(const FX_CHAR* face); + virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer, FX_DWORD size); virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name); virtual FX_BOOL GetFontCharset(void* hFont, int& charset); diff --git a/core/src/fxge/apple/apple_int.h b/core/src/fxge/apple/apple_int.h index 6cd880603a..1e620a3a4f 100644 --- a/core/src/fxge/apple/apple_int.h +++ b/core/src/fxge/apple/apple_int.h @@ -48,7 +48,7 @@ public: void* createGraphics(CFX_DIBitmap* bitmap); void destroyGraphics(void* graphics); - void* CreateFont(FX_LPCBYTE pFontData, FX_DWORD dwFontSize); + void* CreateFont(const uint8_t* pFontData, FX_DWORD dwFontSize); void DestroyFont(void* pFont); void setGraphicsTextMatrix(void* graphics, CFX_AffineMatrix* matrix); FX_BOOL drawGraphicsString(void* graphics, @@ -141,17 +141,17 @@ public: int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL); virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, - const CFX_AffineMatrix* pMatrix, FX_DWORD flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD flags, void*& handle, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL) { return FALSE; } - virtual FX_BOOL ContinueDIBits(FX_LPVOID handle, IFX_Pause* pPause) + virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) { return FALSE; } - virtual void CancelDIBits(FX_LPVOID handle) {} + virtual void CancelDIBits(void* handle) {} virtual FX_BOOL DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color, int alpha_flag = 0, void* pIccTransform = NULL); @@ -239,10 +239,10 @@ private: int _tableCount; int _totalSize; }; -uint32_t FX_GetHashCode( FX_LPCSTR pStr); -FX_DWORD FX_IOSGetMatchFamilyNameHashcode(FX_LPCSTR pFontName); +uint32_t FX_GetHashCode( const FX_CHAR* pStr); +FX_DWORD FX_IOSGetMatchFamilyNameHashcode(const FX_CHAR* pFontName); uint32_t FX_IOSGetFamilyNamesCount(); -FX_LPCSTR FX_IOSGetFamilyName( uint32_t uIndex); +const FX_CHAR* FX_IOSGetFamilyName( uint32_t uIndex); #endif #endif // CORE_SRC_FXGE_APPLE_APPLE_INT_H_ diff --git a/core/src/fxge/apple/fx_mac_imp.cpp b/core/src/fxge/apple/fx_mac_imp.cpp index 5acedc0bd9..41b8632965 100644 --- a/core/src/fxge/apple/fx_mac_imp.cpp +++ b/core/src/fxge/apple/fx_mac_imp.cpp @@ -8,8 +8,8 @@ #include "apple_int.h" #if _FX_OS_ == _FX_MACOSX_ static const struct { - FX_LPCSTR m_pName; - FX_LPCSTR m_pSubstName; + const FX_CHAR* m_pName; + const FX_CHAR* m_pSubstName; } Base14Substs[] = { {"Courier", "Courier New"}, @@ -28,7 +28,7 @@ Base14Substs[] = { class CFX_MacFontInfo : public CFX_FolderFontInfo { public: - virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR family, FX_BOOL& bExact); + virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL& bExact); }; #define JAPAN_GOTHIC "Hiragino Kaku Gothic Pro W6" #define JAPAN_MINCHO "Hiragino Mincho Pro W6" @@ -44,7 +44,7 @@ static void GetJapanesePreference(CFX_ByteString& face, int weight, int picth_fa face = JAPAN_MINCHO; } } -void* CFX_MacFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR cstr_face, FX_BOOL& bExact) +void* CFX_MacFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* cstr_face, FX_BOOL& bExact) { CFX_ByteString face = cstr_face; int iBaseFont; @@ -57,7 +57,7 @@ void* CFX_MacFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pit if (iBaseFont < 12) { return GetFont(face); } - FX_LPVOID p; + void* p; if (m_FontList.Lookup(face, p)) { return p; } diff --git a/core/src/fxge/apple/fx_quartz_device.cpp b/core/src/fxge/apple/fx_quartz_device.cpp index fa63d22028..7ecce7e0ef 100644 --- a/core/src/fxge/apple/fx_quartz_device.cpp +++ b/core/src/fxge/apple/fx_quartz_device.cpp @@ -48,7 +48,7 @@ void CQuartz2D::destroyGraphics(void* graphics) CGContextRelease((CGContextRef) graphics); } } -void* CQuartz2D::CreateFont(FX_LPCBYTE pFontData, FX_DWORD dwFontSize) +void* CQuartz2D::CreateFont(const uint8_t* pFontData, FX_DWORD dwFontSize) { CGDataProviderRef pDataProvider = CGDataProviderCreateWithData(NULL, pFontData, (size_t)dwFontSize, NULL); if (NULL == pDataProvider) { @@ -541,7 +541,7 @@ FX_BOOL CFX_QuartzDeviceDriver::GetDIBits(CFX_DIBitmap* bitmap, CGImageRelease(image); if (bitmap->HasAlpha()) { for (int row = 0; row < bitmap->GetHeight(); row ++) { - FX_LPBYTE pScanline = (FX_LPBYTE)bitmap->GetScanline(row); + uint8_t* pScanline = (uint8_t*)bitmap->GetScanline(row); for (int col = 0; col < bitmap->GetWidth(); col ++) { if (pScanline[3] > 0) { pScanline[0] = (pScanline[0] * 255.f / pScanline[3] + .5f); @@ -654,7 +654,7 @@ 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); + uint8_t* pScanline = (uint8_t*)pBitmap1->GetScanline(row); for (int col = 0; col < pBitmap1->GetWidth(); col ++) { pScanline[0] = (uint8_t)(pScanline[0] * pScanline[3] / 255.f + .5f); pScanline[1] = (uint8_t)(pScanline[1] * pScanline[3] / 255.f + .5f); @@ -779,7 +779,7 @@ 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); + uint8_t* pScanline = (uint8_t*)pBitmap1->GetScanline(row); for (int col = 0; col < pBitmap1->GetWidth(); col ++) { pScanline[0] = (uint8_t)(pScanline[0] * pScanline[3] / 255.f + .5f); pScanline[1] = (uint8_t)(pScanline[1] * pScanline[3] / 255.f + .5f); diff --git a/core/src/fxge/dib/dib_int.h b/core/src/fxge/dib/dib_int.h index c82a0378b8..9eeb0fddc0 100644 --- a/core/src/fxge/dib/dib_int.h +++ b/core/src/fxge/dib/dib_int.h @@ -54,7 +54,7 @@ public: return (PixelWeight*)(m_pWeightTables + (pixel - m_DestMin) * m_ItemSize); } int m_DestMin, m_ItemSize; - FX_LPBYTE m_pWeightTables; + uint8_t* m_pWeightTables; }; class CStretchEngine { @@ -70,8 +70,8 @@ public: IFX_ScanlineComposer* m_pDestBitmap; int m_DestWidth, m_DestHeight; FX_RECT m_DestClip; - FX_LPBYTE m_pDestScanline; - FX_LPBYTE m_pDestMaskScanline; + uint8_t* m_pDestScanline; + uint8_t* m_pDestMaskScanline; FX_RECT m_SrcClip; const CFX_DIBSource* m_pSource; FX_DWORD* m_pSrcPalette; diff --git a/core/src/fxge/dib/fx_dib_composite.cpp b/core/src/fxge/dib/fx_dib_composite.cpp index 970325a2d4..aeee91bb4b 100644 --- a/core/src/fxge/dib/fx_dib_composite.cpp +++ b/core/src/fxge/dib/fx_dib_composite.cpp @@ -227,7 +227,7 @@ static _RGB _SetSat(_RGB color, int s) } return color; } -void _RGB_Blend(int blend_mode, FX_LPCBYTE src_scan, uint8_t* dest_scan, int results[3]) +void _RGB_Blend(int blend_mode, const uint8_t* src_scan, uint8_t* dest_scan, int results[3]) { _RGB src, back, result; src.red = src_scan[2]; @@ -254,7 +254,7 @@ void _RGB_Blend(int blend_mode, FX_LPCBYTE src_scan, uint8_t* dest_scan, int res results[1] = result.green; results[2] = result.red; } -inline void _CompositeRow_Argb2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel_count, FX_LPCBYTE clip_scan) +inline void _CompositeRow_Argb2Mask(uint8_t* dest_scan, const uint8_t* src_scan, int pixel_count, const uint8_t* clip_scan) { src_scan += 3; for (int col = 0; col < pixel_count; col ++) { @@ -272,7 +272,7 @@ inline void _CompositeRow_Argb2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, in src_scan += 4; } } -void _CompositeRow_Rgba2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_alpha_scan, int pixel_count, FX_LPCBYTE clip_scan) +void _CompositeRow_Rgba2Mask(uint8_t* dest_scan, const uint8_t* src_alpha_scan, int pixel_count, const uint8_t* clip_scan) { for (int col = 0; col < pixel_count; col ++) { int src_alpha = *src_alpha_scan++; @@ -288,7 +288,7 @@ void _CompositeRow_Rgba2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_alpha_scan, int dest_scan ++; } } -void _CompositeRow_Rgb2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, FX_LPCBYTE clip_scan) +void _CompositeRow_Rgb2Mask(uint8_t* dest_scan, const uint8_t* src_scan, int width, const uint8_t* clip_scan) { if (clip_scan) { for (int i = 0; i < width; i ++) { @@ -300,8 +300,8 @@ void _CompositeRow_Rgb2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, FXSYS_memset8(dest_scan, 0xff, width); } } -void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel_count, int blend_type, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_alpha_scan, FX_LPBYTE dst_alpha_scan, void* pIccTransform) +void _CompositeRow_Argb2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int pixel_count, int blend_type, const uint8_t* clip_scan, + const uint8_t* src_alpha_scan, uint8_t* dst_alpha_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = NULL; if (pIccTransform) { @@ -493,9 +493,9 @@ void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe src_scan += 4; } } -inline void _CompositeRow_Argb2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel_count, - int blend_type, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_alpha_scan, void* pIccTransform) +inline void _CompositeRow_Argb2Gray(uint8_t* dest_scan, const uint8_t* src_scan, int pixel_count, + int blend_type, const uint8_t* clip_scan, + const uint8_t* src_alpha_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = NULL; uint8_t gray; @@ -584,8 +584,8 @@ inline void _CompositeRow_Argb2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, in src_scan += 4; } } -inline void _CompositeRow_Rgb2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_Bpp, int pixel_count, - int blend_type, FX_LPCBYTE clip_scan, +inline void _CompositeRow_Rgb2Gray(uint8_t* dest_scan, const uint8_t* src_scan, int src_Bpp, int pixel_count, + int blend_type, const uint8_t* clip_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = NULL; @@ -631,9 +631,9 @@ inline void _CompositeRow_Rgb2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_scan += src_Bpp; } } -void _CompositeRow_Rgb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_Bpp, int pixel_count, - int blend_type, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan, void* pIccTransform) +void _CompositeRow_Rgb2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int src_Bpp, int pixel_count, + int blend_type, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = NULL; if (pIccTransform) { @@ -721,8 +721,8 @@ void _CompositeRow_Rgb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_B src_scan += src_Bpp; } } -void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel_count, int blend_type, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan, FX_LPCBYTE src_alpha_scan) +void _CompositeRow_Argb2Argb(uint8_t* dest_scan, const uint8_t* src_scan, int pixel_count, int blend_type, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan, const uint8_t* src_alpha_scan) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -928,8 +928,8 @@ void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel } } } -void _CompositeRow_Rgb2Argb_Blend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int src_Bpp, - FX_LPBYTE dest_alpha_scan) +void _CompositeRow_Rgb2Argb_Blend_NoClip(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int src_Bpp, + uint8_t* dest_alpha_scan) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -989,8 +989,8 @@ void _CompositeRow_Rgb2Argb_Blend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE src_sca } } } -inline void _CompositeRow_Rgb2Argb_Blend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int src_Bpp, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan) +inline void _CompositeRow_Rgb2Argb_Blend_Clip(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int src_Bpp, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -1067,8 +1067,8 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE sr } } } -inline void _CompositeRow_Rgb2Argb_NoBlend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int src_Bpp, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan) +inline void _CompositeRow_Rgb2Argb_NoBlend_Clip(uint8_t* dest_scan, const uint8_t* src_scan, int width, int src_Bpp, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan) { int src_gap = src_Bpp - 3; if (dest_alpha_scan == NULL) { @@ -1129,8 +1129,8 @@ inline void _CompositeRow_Rgb2Argb_NoBlend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE } } } -inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int src_Bpp, - FX_LPBYTE dest_alpha_scan) +inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip(uint8_t* dest_scan, const uint8_t* src_scan, int width, int src_Bpp, + uint8_t* dest_alpha_scan) { if (dest_alpha_scan == NULL) { for (int col = 0; col < width; col ++) { @@ -1153,8 +1153,8 @@ inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYT } } } -inline void _CompositeRow_Argb2Rgb_Blend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_alpha_scan) +inline void _CompositeRow_Argb2Rgb_Blend(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, const uint8_t* clip_scan, + const uint8_t* src_alpha_scan) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -1214,8 +1214,8 @@ inline void _CompositeRow_Argb2Rgb_Blend(FX_LPBYTE dest_scan, FX_LPCBYTE src_sca } } } -inline void _CompositeRow_Argb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int dest_Bpp, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_alpha_scan) +inline void _CompositeRow_Argb2Rgb_NoBlend(uint8_t* dest_scan, const uint8_t* src_scan, int width, int dest_Bpp, const uint8_t* clip_scan, + const uint8_t* src_alpha_scan) { int dest_gap = dest_Bpp - 3; if (src_alpha_scan == NULL) { @@ -1276,7 +1276,7 @@ inline void _CompositeRow_Argb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_s } } } -inline void _CompositeRow_Rgb2Rgb_Blend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp) +inline void _CompositeRow_Rgb2Rgb_Blend_NoClip(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -1299,7 +1299,7 @@ inline void _CompositeRow_Rgb2Rgb_Blend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE s src_scan += src_gap; } } -inline void _CompositeRow_Rgb2Rgb_Blend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_Rgb2Rgb_Blend_Clip(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, const uint8_t* clip_scan) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -1328,7 +1328,7 @@ inline void _CompositeRow_Rgb2Rgb_Blend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE src src_scan += src_gap; } } -inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int dest_Bpp, int src_Bpp) +inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip(uint8_t* dest_scan, const uint8_t* src_scan, int width, int dest_Bpp, int src_Bpp) { if (dest_Bpp == src_Bpp) { FXSYS_memcpy32(dest_scan, src_scan, width * dest_Bpp); @@ -1342,7 +1342,7 @@ inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan += src_Bpp; } } -inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int dest_Bpp, int src_Bpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip(uint8_t* dest_scan, const uint8_t* src_scan, int width, int dest_Bpp, int src_Bpp, const uint8_t* clip_scan) { for (int col = 0; col < width; col ++) { int src_alpha = clip_scan[col]; @@ -1366,10 +1366,10 @@ inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE s src_scan += src_Bpp; } } -void _CompositeRow_Argb2Argb_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel_count, int blend_type, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan, FX_LPCBYTE src_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform) +void _CompositeRow_Argb2Argb_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int pixel_count, int blend_type, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan, const uint8_t* src_alpha_scan, uint8_t* src_cache_scan, void* pIccTransform) { - FX_LPBYTE dp = src_cache_scan; + uint8_t* dp = src_cache_scan; ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_alpha_scan) { if (dest_alpha_scan == NULL) { @@ -1451,14 +1451,14 @@ void _CompositeRow_Argb2Argb_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, } _CompositeRow_Argb2Argb(dest_scan, src_cache_scan, pixel_count, blend_type, clip_scan, dest_alpha_scan, src_alpha_scan); } -void _CompositeRow_Rgb2Argb_Blend_NoClip_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int src_Bpp, - FX_LPBYTE dest_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform) +void _CompositeRow_Rgb2Argb_Blend_NoClip_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int src_Bpp, + uint8_t* dest_alpha_scan, uint8_t* src_cache_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_Bpp == 3) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, width); } else { - FX_LPBYTE dp = src_cache_scan; + uint8_t* dp = src_cache_scan; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); src_scan += 4; @@ -1467,14 +1467,14 @@ void _CompositeRow_Rgb2Argb_Blend_NoClip_Transform(FX_LPBYTE dest_scan, FX_LPCBY } _CompositeRow_Rgb2Argb_Blend_NoClip(dest_scan, src_cache_scan, width, blend_type, 3, dest_alpha_scan); } -inline void _CompositeRow_Rgb2Argb_Blend_Clip_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int src_Bpp, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform) +inline void _CompositeRow_Rgb2Argb_Blend_Clip_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int src_Bpp, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan, uint8_t* src_cache_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_Bpp == 3) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, width); } else { - FX_LPBYTE dp = src_cache_scan; + uint8_t* dp = src_cache_scan; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); src_scan += 4; @@ -1483,14 +1483,14 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip_Transform(FX_LPBYTE dest_scan, FX_ } _CompositeRow_Rgb2Argb_Blend_Clip(dest_scan, src_cache_scan, width, blend_type, 3, clip_scan, dest_alpha_scan); } -inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int src_Bpp, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform) +inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int width, int src_Bpp, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan, uint8_t* src_cache_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_Bpp == 3) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, width); } else { - FX_LPBYTE dp = src_cache_scan; + uint8_t* dp = src_cache_scan; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); src_scan += 4; @@ -1499,14 +1499,14 @@ inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_Transform(FX_LPBYTE dest_scan, F } _CompositeRow_Rgb2Argb_NoBlend_Clip(dest_scan, src_cache_scan, width, 3, clip_scan, dest_alpha_scan); } -inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int src_Bpp, - FX_LPBYTE dest_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform) +inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int width, int src_Bpp, + uint8_t* dest_alpha_scan, uint8_t* src_cache_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_Bpp == 3) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, width); } else { - FX_LPBYTE dp = src_cache_scan; + uint8_t* dp = src_cache_scan; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); src_scan += 4; @@ -1515,8 +1515,8 @@ inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_Transform(FX_LPBYTE dest_scan, } _CompositeRow_Rgb2Argb_NoBlend_NoClip(dest_scan, src_cache_scan, width, 3, dest_alpha_scan); } -inline void _CompositeRow_Argb2Rgb_Blend_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform) +inline void _CompositeRow_Argb2Rgb_Blend_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, const uint8_t* clip_scan, + const uint8_t* src_alpha_scan, uint8_t* src_cache_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_alpha_scan) { @@ -1556,8 +1556,8 @@ inline void _CompositeRow_Argb2Rgb_Blend_Transform(FX_LPBYTE dest_scan, FX_LPCBY } _CompositeRow_Argb2Rgb_Blend(dest_scan, src_cache_scan, width, blend_type, dest_Bpp, clip_scan, src_alpha_scan); } -inline void _CompositeRow_Argb2Rgb_NoBlend_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int dest_Bpp, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform) +inline void _CompositeRow_Argb2Rgb_NoBlend_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int width, int dest_Bpp, const uint8_t* clip_scan, + const uint8_t* src_alpha_scan, uint8_t* src_cache_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_alpha_scan) { @@ -1596,14 +1596,14 @@ inline void _CompositeRow_Argb2Rgb_NoBlend_Transform(FX_LPBYTE dest_scan, FX_LPC } _CompositeRow_Argb2Rgb_NoBlend(dest_scan, src_cache_scan, width, dest_Bpp, clip_scan, src_alpha_scan); } -inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, - FX_LPBYTE src_cache_scan, void* pIccTransform) +inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, + uint8_t* src_cache_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_Bpp == 3) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, width); } else { - FX_LPBYTE dp = src_cache_scan; + uint8_t* dp = src_cache_scan; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); src_scan += 4; @@ -1612,14 +1612,14 @@ inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_Transform(FX_LPBYTE dest_scan, FX } _CompositeRow_Rgb2Rgb_Blend_NoClip(dest_scan, src_cache_scan, width, blend_type, dest_Bpp, 3); } -inline void _CompositeRow_Rgb2Rgb_Blend_Clip_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, FX_LPCBYTE clip_scan, - FX_LPBYTE src_cache_scan, void* pIccTransform) +inline void _CompositeRow_Rgb2Rgb_Blend_Clip_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, const uint8_t* clip_scan, + uint8_t* src_cache_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_Bpp == 3) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, width); } else { - FX_LPBYTE dp = src_cache_scan; + uint8_t* dp = src_cache_scan; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); src_scan += 4; @@ -1628,14 +1628,14 @@ inline void _CompositeRow_Rgb2Rgb_Blend_Clip_Transform(FX_LPBYTE dest_scan, FX_L } _CompositeRow_Rgb2Rgb_Blend_Clip(dest_scan, src_cache_scan, width, blend_type, dest_Bpp, 3, clip_scan); } -inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int dest_Bpp, int src_Bpp, - FX_LPBYTE src_cache_scan, void* pIccTransform) +inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int width, int dest_Bpp, int src_Bpp, + uint8_t* src_cache_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_Bpp == 3) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, width); } else { - FX_LPBYTE dp = src_cache_scan; + uint8_t* dp = src_cache_scan; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); src_scan += 4; @@ -1644,14 +1644,14 @@ inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_Transform(FX_LPBYTE dest_scan, } _CompositeRow_Rgb2Rgb_NoBlend_NoClip(dest_scan, src_cache_scan, width, dest_Bpp, 3); } -inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int dest_Bpp, int src_Bpp, FX_LPCBYTE clip_scan, - FX_LPBYTE src_cache_scan, void* pIccTransform) +inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip_Transform(uint8_t* dest_scan, const uint8_t* src_scan, int width, int dest_Bpp, int src_Bpp, const uint8_t* clip_scan, + uint8_t* src_cache_scan, void* pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (src_Bpp == 3) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, width); } else { - FX_LPBYTE dp = src_cache_scan; + uint8_t* dp = src_cache_scan; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); src_scan += 4; @@ -1660,9 +1660,9 @@ inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip_Transform(FX_LPBYTE dest_scan, FX } _CompositeRow_Rgb2Rgb_NoBlend_Clip(dest_scan, src_cache_scan, width, dest_Bpp, 3, clip_scan); } -inline void _CompositeRow_8bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, FX_LPCBYTE pPalette, int pixel_count, - int blend_type, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_alpha_scan) +inline void _CompositeRow_8bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_scan, const uint8_t* pPalette, int pixel_count, + int blend_type, const uint8_t* clip_scan, + const uint8_t* src_alpha_scan) { if (src_alpha_scan) { if (blend_type) { @@ -1734,9 +1734,9 @@ inline void _CompositeRow_8bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, } } } -inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, FX_LPCBYTE pPalette, int pixel_count, - int blend_type, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan, FX_LPCBYTE src_alpha_scan) +inline void _CompositeRow_8bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_scan, const uint8_t* pPalette, int pixel_count, + int blend_type, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan, const uint8_t* src_alpha_scan) { if (src_alpha_scan) { if (blend_type) { @@ -1866,8 +1866,8 @@ inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan } } } -inline void _CompositeRow_1bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, - FX_LPCBYTE pPalette, int pixel_count, int blend_type, FX_LPCBYTE clip_scan) +inline void _CompositeRow_1bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, + const uint8_t* pPalette, int pixel_count, int blend_type, const uint8_t* clip_scan) { int reset_gray = pPalette[0]; int set_gray = pPalette[1]; @@ -1899,9 +1899,9 @@ inline void _CompositeRow_1bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, dest_scan ++; } } -inline void _CompositeRow_1bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, - FX_LPCBYTE pPalette, int pixel_count, int blend_type, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan) +inline void _CompositeRow_1bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, + const uint8_t* pPalette, int pixel_count, int blend_type, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan) { int reset_gray = pPalette[0]; int set_gray = pPalette[1]; @@ -1955,9 +1955,9 @@ inline void _CompositeRow_1bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan dest_scan ++; } } -inline void _CompositeRow_8bppRgb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, FX_DWORD* pPalette, int pixel_count, - int DestBpp, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_alpha_scan) +inline void _CompositeRow_8bppRgb2Rgb_NoBlend(uint8_t* dest_scan, const uint8_t* src_scan, FX_DWORD* pPalette, int pixel_count, + int DestBpp, const uint8_t* clip_scan, + const uint8_t* src_alpha_scan) { if (src_alpha_scan) { int dest_gap = DestBpp - 3; @@ -2019,8 +2019,8 @@ inline void _CompositeRow_8bppRgb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE sr } } } -inline void _CompositeRow_1bppRgb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, - FX_DWORD* pPalette, int pixel_count, int DestBpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_1bppRgb2Rgb_NoBlend(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, + FX_DWORD* pPalette, int pixel_count, int DestBpp, const uint8_t* clip_scan) { int reset_r, reset_g, reset_b; int set_r, set_g, set_b; @@ -2058,9 +2058,9 @@ inline void _CompositeRow_1bppRgb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE sr } } } -inline void _CompositeRow_8bppRgb2Argb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, - FX_DWORD* pPalette, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_alpha_scan) +inline void _CompositeRow_8bppRgb2Argb_NoBlend(uint8_t* dest_scan, const uint8_t* src_scan, int width, + FX_DWORD* pPalette, const uint8_t* clip_scan, + const uint8_t* src_alpha_scan) { if (src_alpha_scan) { for (int col = 0; col < width; col ++) { @@ -2136,9 +2136,9 @@ inline void _CompositeRow_8bppRgb2Argb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE s src_scan ++; } } -void _CompositeRow_8bppRgb2Rgba_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, - FX_DWORD* pPalette, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan, FX_LPCBYTE src_alpha_scan) +void _CompositeRow_8bppRgb2Rgba_NoBlend(uint8_t* dest_scan, const uint8_t* src_scan, int width, + FX_DWORD* pPalette, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan, const uint8_t* src_alpha_scan) { if (src_alpha_scan) { for (int col = 0; col < width; col ++) { @@ -2216,8 +2216,8 @@ void _CompositeRow_8bppRgb2Rgba_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan src_scan ++; } } -inline void _CompositeRow_1bppRgb2Argb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, int width, - FX_DWORD* pPalette, FX_LPCBYTE clip_scan) +inline void _CompositeRow_1bppRgb2Argb_NoBlend(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, int width, + FX_DWORD* pPalette, const uint8_t* clip_scan) { int reset_r, reset_g, reset_b; int set_r, set_g, set_b; @@ -2263,9 +2263,9 @@ inline void _CompositeRow_1bppRgb2Argb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE s dest_scan ++; } } -void _CompositeRow_1bppRgb2Rgba_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, int width, - FX_DWORD* pPalette, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan) +void _CompositeRow_1bppRgb2Rgba_NoBlend(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, int width, + FX_DWORD* pPalette, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan) { int reset_r, reset_g, reset_b; int set_r, set_g, set_b; @@ -2311,8 +2311,8 @@ void _CompositeRow_1bppRgb2Rgba_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan dest_scan ++; } } -void _CompositeRow_ByteMask2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, - int blend_type, FX_LPCBYTE clip_scan) +void _CompositeRow_ByteMask2Argb(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, + int blend_type, const uint8_t* clip_scan) { for (int col = 0; col < pixel_count; col ++) { int src_alpha; @@ -2368,9 +2368,9 @@ void _CompositeRow_ByteMask2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m dest_scan += 2; } } -void _CompositeRow_ByteMask2Rgba(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, - int blend_type, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan) +void _CompositeRow_ByteMask2Rgba(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, + int blend_type, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan) { for (int col = 0; col < pixel_count; col ++) { int src_alpha; @@ -2431,8 +2431,8 @@ void _CompositeRow_ByteMask2Rgba(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m } } } -void _CompositeRow_ByteMask2Rgb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, - int blend_type, int Bpp, FX_LPCBYTE clip_scan) +void _CompositeRow_ByteMask2Rgb(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, + int blend_type, int Bpp, const uint8_t* clip_scan) { for (int col = 0; col < pixel_count; col ++) { int src_alpha; @@ -2476,8 +2476,8 @@ void _CompositeRow_ByteMask2Rgb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma dest_scan += Bpp - 2; } } -void _CompositeRow_ByteMask2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int pixel_count, - FX_LPCBYTE clip_scan) +void _CompositeRow_ByteMask2Mask(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int pixel_count, + const uint8_t* clip_scan) { for (int col = 0; col < pixel_count; col ++) { int src_alpha; @@ -2495,8 +2495,8 @@ void _CompositeRow_ByteMask2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m dest_scan ++; } } -void _CompositeRow_ByteMask2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_gray, - int pixel_count, FX_LPCBYTE clip_scan) +void _CompositeRow_ByteMask2Gray(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_gray, + int pixel_count, const uint8_t* clip_scan) { for (int col = 0; col < pixel_count; col ++) { int src_alpha; @@ -2511,9 +2511,9 @@ void _CompositeRow_ByteMask2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m dest_scan ++; } } -void _CompositeRow_ByteMask2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_gray, - int pixel_count, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan) +void _CompositeRow_ByteMask2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_gray, + int pixel_count, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan) { for (int col = 0; col < pixel_count; col ++) { int src_alpha; @@ -2540,8 +2540,8 @@ void _CompositeRow_ByteMask2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int dest_scan ++; } } -void _CompositeRow_BitMask2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_r, int src_g, int src_b, - int src_left, int pixel_count, int blend_type, FX_LPCBYTE clip_scan) +void _CompositeRow_BitMask2Argb(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_r, int src_g, int src_b, + int src_left, int pixel_count, int blend_type, const uint8_t* clip_scan) { if (blend_type == FXDIB_BLEND_NORMAL && clip_scan == NULL && mask_alpha == 255) { FX_ARGB argb = FXARGB_MAKE(0xff, src_r, src_g, src_b); @@ -2607,9 +2607,9 @@ void _CompositeRow_BitMask2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma dest_scan += 2; } } -void _CompositeRow_BitMask2Rgba(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_r, int src_g, int src_b, - int src_left, int pixel_count, int blend_type, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan) +void _CompositeRow_BitMask2Rgba(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_r, int src_g, int src_b, + int src_left, int pixel_count, int blend_type, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan) { if (blend_type == FXDIB_BLEND_NORMAL && clip_scan == NULL && mask_alpha == 255) { for (int col = 0; col < pixel_count; col ++) { @@ -2683,8 +2683,8 @@ void _CompositeRow_BitMask2Rgba(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma } } } -void _CompositeRow_BitMask2Rgb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_r, int src_g, int src_b, - int src_left, int pixel_count, int blend_type, int Bpp, FX_LPCBYTE clip_scan) +void _CompositeRow_BitMask2Rgb(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_r, int src_g, int src_b, + int src_left, int pixel_count, int blend_type, int Bpp, const uint8_t* clip_scan) { if (blend_type == FXDIB_BLEND_NORMAL && clip_scan == NULL && mask_alpha == 255) { for (int col = 0; col < pixel_count; col ++) { @@ -2743,8 +2743,8 @@ void _CompositeRow_BitMask2Rgb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mas dest_scan += Bpp - 2; } } -void _CompositeRow_BitMask2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_left, - int pixel_count, FX_LPCBYTE clip_scan) +void _CompositeRow_BitMask2Mask(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_left, + int pixel_count, const uint8_t* clip_scan) { for (int col = 0; col < pixel_count; col ++) { if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) { @@ -2766,8 +2766,8 @@ void _CompositeRow_BitMask2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma dest_scan ++; } } -void _CompositeRow_BitMask2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_gray, - int src_left, int pixel_count, FX_LPCBYTE clip_scan) +void _CompositeRow_BitMask2Gray(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_gray, + int src_left, int pixel_count, const uint8_t* clip_scan) { for (int col = 0; col < pixel_count; col ++) { if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) { @@ -2786,9 +2786,9 @@ void _CompositeRow_BitMask2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma dest_scan ++; } } -void _CompositeRow_BitMask2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_gray, - int src_left, int pixel_count, FX_LPCBYTE clip_scan, - FX_LPBYTE dest_alpha_scan) +void _CompositeRow_BitMask2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_gray, + int src_left, int pixel_count, const uint8_t* clip_scan, + uint8_t* dest_alpha_scan) { for (int col = 0; col < pixel_count; col ++) { if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) { @@ -2820,7 +2820,7 @@ void _CompositeRow_BitMask2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m dest_scan ++; } } -void _CompositeRow_Argb2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel_count, int blend_type, FX_LPCBYTE clip_scan) +void _CompositeRow_Argb2Argb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int pixel_count, int blend_type, const uint8_t* clip_scan) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -2877,7 +2877,7 @@ void _CompositeRow_Argb2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_sc src_scan++; } } -void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int src_Bpp) +void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int src_Bpp) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -2914,7 +2914,7 @@ void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LP src_scan += src_gap; } } -inline void _CompositeRow_Argb2Rgb_Blend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_Argb2Rgb_Blend_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, const uint8_t* clip_scan) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -2949,7 +2949,7 @@ inline void _CompositeRow_Argb2Rgb_Blend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LP src_scan ++; } } -inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int src_Bpp) +inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int src_Bpp) { for (int col = 0; col < width; col ++) { if (src_Bpp == 4) { @@ -2961,7 +2961,7 @@ inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_RgbByteOrder(FX_LPBYTE dest_sc src_scan += src_Bpp; } } -inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp) +inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -2987,7 +2987,7 @@ inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, src_scan += src_gap; } } -inline void _CompositeRow_Argb2Rgb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int dest_Bpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_Argb2Rgb_NoBlend_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int dest_Bpp, const uint8_t* clip_scan) { for (int col = 0; col < width; col ++) { uint8_t src_alpha; @@ -3018,7 +3018,7 @@ inline void _CompositeRow_Argb2Rgb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, FX_ src_scan ++; } } -inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int dest_Bpp, int src_Bpp) +inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int dest_Bpp, int src_Bpp) { for (int col = 0; col < width; col ++) { dest_scan[2] = src_scan[0]; @@ -3028,7 +3028,7 @@ inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_RgbByteOrder(FX_LPBYTE dest_sca src_scan += src_Bpp; } } -inline void _CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int src_Bpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int src_Bpp, const uint8_t* clip_scan) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -3072,7 +3072,7 @@ inline void _CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, src_scan += src_gap; } } -inline void _CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, const uint8_t* clip_scan) { int blended_colors[3]; FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; @@ -3104,7 +3104,7 @@ inline void _CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, F src_scan += src_gap; } } -inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int src_Bpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int src_Bpp, const uint8_t* clip_scan) { int src_gap = src_Bpp - 3; for (int col = 0; col < width; col ++) { @@ -3136,7 +3136,7 @@ inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_RgbByteOrder(FX_LPBYTE dest_scan src_scan += src_gap; } } -inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int dest_Bpp, int src_Bpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int dest_Bpp, int src_Bpp, const uint8_t* clip_scan) { for (int col = 0; col < width; col ++) { int src_alpha = clip_scan[col]; @@ -3158,8 +3158,8 @@ inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, src_scan += src_Bpp; } } -inline void _CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, FX_ARGB* pPalette, int pixel_count, - int DestBpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, FX_ARGB* pPalette, int pixel_count, + int DestBpp, const uint8_t* clip_scan) { for (int col = 0; col < pixel_count; col ++) { FX_ARGB argb = pPalette ? pPalette[*src_scan] : (*src_scan) * 0x010101; @@ -3179,8 +3179,8 @@ inline void _CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, src_scan ++; } } -inline void _CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, - FX_ARGB* pPalette, int pixel_count, int DestBpp, FX_LPCBYTE clip_scan) +inline void _CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, + FX_ARGB* pPalette, int pixel_count, int DestBpp, const uint8_t* clip_scan) { int reset_r, reset_g, reset_b; int set_r, set_g, set_b; @@ -3218,8 +3218,8 @@ inline void _CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, dest_scan += DestBpp; } } -inline void _CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, - FX_ARGB* pPalette, FX_LPCBYTE clip_scan) +inline void _CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, + FX_ARGB* pPalette, const uint8_t* clip_scan) { for (int col = 0; col < width; col ++) { int src_r, src_g, src_b; @@ -3257,8 +3257,8 @@ inline void _CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, src_scan ++; } } -inline void _CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, int width, - FX_ARGB* pPalette, FX_LPCBYTE clip_scan) +inline void _CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, int width, + FX_ARGB* pPalette, const uint8_t* clip_scan) { int reset_r, reset_g, reset_b; int set_r, set_g, set_b; @@ -3307,8 +3307,8 @@ inline void _CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, dest_scan += 4; } } -void _CompositeRow_ByteMask2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, - int blend_type, FX_LPCBYTE clip_scan) +void _CompositeRow_ByteMask2Argb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, + int blend_type, const uint8_t* clip_scan) { for (int col = 0; col < pixel_count; col ++) { int src_alpha; @@ -3362,8 +3362,8 @@ void _CompositeRow_ByteMask2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE sr dest_scan += 4; } } -void _CompositeRow_ByteMask2Rgb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, - int blend_type, int Bpp, FX_LPCBYTE clip_scan) +void _CompositeRow_ByteMask2Rgb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, + int blend_type, int Bpp, const uint8_t* clip_scan) { for (int col = 0; col < pixel_count; col ++) { int src_alpha; @@ -3405,8 +3405,8 @@ void _CompositeRow_ByteMask2Rgb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src dest_scan += Bpp; } } -void _CompositeRow_BitMask2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_r, int src_g, int src_b, - int src_left, int pixel_count, int blend_type, FX_LPCBYTE clip_scan) +void _CompositeRow_BitMask2Argb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_r, int src_g, int src_b, + int src_left, int pixel_count, int blend_type, const uint8_t* clip_scan) { if (blend_type == FXDIB_BLEND_NORMAL && clip_scan == NULL && mask_alpha == 255) { FX_ARGB argb = FXARGB_MAKE(0xff, src_r, src_g, src_b); @@ -3470,8 +3470,8 @@ void _CompositeRow_BitMask2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src dest_scan += 4; } } -void _CompositeRow_BitMask2Rgb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mask_alpha, int src_r, int src_g, int src_b, - int src_left, int pixel_count, int blend_type, int Bpp, FX_LPCBYTE clip_scan) +void _CompositeRow_BitMask2Rgb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int mask_alpha, int src_r, int src_g, int src_b, + int src_left, int pixel_count, int blend_type, int Bpp, const uint8_t* clip_scan) { if (blend_type == FXDIB_BLEND_NORMAL && clip_scan == NULL && mask_alpha == 255) { for (int col = 0; col < pixel_count; col ++) { @@ -3554,7 +3554,7 @@ inline FX_BOOL _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, int if ((dest_format & 0xff) == 8) { if (pIccTransform) { mask_color = (alpha_flag >> 8) ? FXCMYK_TODIB(mask_color) : FXARGB_TODIB(mask_color); - FX_LPBYTE gray_p = (FX_LPBYTE)&mask_color; + uint8_t* gray_p = (uint8_t*)&mask_color; pIccModule->TranslateScanline(pIccTransform, gray_p, gray_p, 1); mask_red = dest_format & 0x0400 ? FX_CCOLOR(gray_p[0]) : gray_p[0]; } else { @@ -3571,7 +3571,7 @@ inline FX_BOOL _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, int } } } else { - FX_LPBYTE mask_color_p = (FX_LPBYTE)&mask_color; + uint8_t* mask_color_p = (uint8_t*)&mask_color; mask_color = (alpha_flag >> 8) ? FXCMYK_TODIB(mask_color) : FXARGB_TODIB(mask_color); if (pIccTransform) { pIccModule->TranslateScanline(pIccTransform, mask_color_p, mask_color_p, 1); @@ -3600,11 +3600,11 @@ 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(uint8_t, pal_count); + uint8_t* 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]); - pIccModule->TranslateScanline(pIccTransform, gray_pal, (FX_LPCBYTE)&color, 1); + pIccModule->TranslateScanline(pIccTransform, gray_pal, (const uint8_t*)&color, 1); gray_pal ++; } } else { @@ -3612,13 +3612,13 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB pDestPalette = FX_Alloc(FX_DWORD, palsize); for (int i = 0; i < palsize; i ++) { FX_DWORD color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) : FXARGB_TODIB(pSrcPalette[i]); - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&color, (FX_LPCBYTE)&color, 1); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&color, (const uint8_t*)&color, 1); pDestPalette[i] = isDstCmyk ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); } } } else { int pal_count = 1 << (src_format & 0xff); - FX_LPBYTE gray_pal = FX_Alloc(uint8_t, pal_count); + uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); if (pal_count == 2) { gray_pal[0] = 0; gray_pal[1] = 255; @@ -3633,7 +3633,7 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB } else { pDestPalette = FX_Alloc(FX_DWORD, pal_count); for (int i = 0; i < pal_count; i ++) { - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&pDestPalette[i], &gray_pal[i], 1); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&pDestPalette[i], &gray_pal[i], 1); pDestPalette[i] = isDstCmyk ? FXCMYK_TODIB(pDestPalette[i]) : FXARGB_TODIB(pDestPalette[i]); } FX_Free(gray_pal); @@ -3643,7 +3643,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(uint8_t, pal_count); + uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); pDestPalette = (FX_DWORD*)gray_pal; if (isSrcCmyk) { for (int i = 0; i < pal_count; i ++) { @@ -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(uint8_t, pal_count); + uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); if (pal_count == 2) { gray_pal[0] = 0; gray_pal[1] = 255; @@ -3774,8 +3774,8 @@ FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_ + (pIccTransform ? 64 : 0); return TRUE; } -void CFX_ScanlineCompositor::CompositeRgbBitmapLine(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_extra_alpha, FX_LPBYTE dst_extra_alpha) +void CFX_ScanlineCompositor::CompositeRgbBitmapLine(uint8_t* dest_scan, const uint8_t* src_scan, int width, const uint8_t* clip_scan, + const uint8_t* src_extra_alpha, uint8_t* dst_extra_alpha) { int src_Bpp = (m_SrcFormat & 0xff) >> 3; int dest_Bpp = (m_DestFormat & 0xff) >> 3; @@ -3967,8 +3967,8 @@ void CFX_ScanlineCompositor::CompositeRgbBitmapLine(FX_LPBYTE dest_scan, FX_LPCB } } } -void CFX_ScanlineCompositor::CompositePalBitmapLine(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, int width, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_extra_alpha, FX_LPBYTE dst_extra_alpha) +void CFX_ScanlineCompositor::CompositePalBitmapLine(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, int width, const uint8_t* clip_scan, + const uint8_t* src_extra_alpha, uint8_t* dst_extra_alpha) { if (m_bRgbByteOrder) { if (m_SrcFormat == FXDIB_1bppRgb) { @@ -3996,16 +3996,16 @@ void CFX_ScanlineCompositor::CompositePalBitmapLine(FX_LPBYTE dest_scan, FX_LPCB } else if ((m_DestFormat & 0xff) == 8) { if (m_Transparency & 8) { if (m_DestFormat & 0x0200) { - _CompositeRow_1bppPal2Graya(dest_scan, src_scan, src_left, (FX_LPCBYTE)m_pSrcPalette, width, m_BlendType, clip_scan, dst_extra_alpha); + _CompositeRow_1bppPal2Graya(dest_scan, src_scan, src_left, (const uint8_t*)m_pSrcPalette, width, m_BlendType, clip_scan, dst_extra_alpha); } else { - _CompositeRow_1bppPal2Gray(dest_scan, src_scan, src_left, (FX_LPCBYTE)m_pSrcPalette, width, m_BlendType, clip_scan); + _CompositeRow_1bppPal2Gray(dest_scan, src_scan, src_left, (const uint8_t*)m_pSrcPalette, width, m_BlendType, clip_scan); } } else { if (m_DestFormat & 0x0200) - _CompositeRow_8bppPal2Graya(dest_scan, src_scan, (FX_LPCBYTE)m_pSrcPalette, width, m_BlendType, clip_scan, + _CompositeRow_8bppPal2Graya(dest_scan, src_scan, (const uint8_t*)m_pSrcPalette, width, m_BlendType, clip_scan, dst_extra_alpha, src_extra_alpha); else - _CompositeRow_8bppPal2Gray(dest_scan, src_scan, (FX_LPCBYTE)m_pSrcPalette, width, m_BlendType, clip_scan, + _CompositeRow_8bppPal2Gray(dest_scan, src_scan, (const uint8_t*)m_pSrcPalette, width, m_BlendType, clip_scan, src_extra_alpha); } } else { @@ -4036,8 +4036,8 @@ void CFX_ScanlineCompositor::CompositePalBitmapLine(FX_LPBYTE dest_scan, FX_LPCB } } } -void CFX_ScanlineCompositor::CompositeByteMaskLine(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, FX_LPCBYTE clip_scan, - FX_LPBYTE dst_extra_alpha) +void CFX_ScanlineCompositor::CompositeByteMaskLine(uint8_t* dest_scan, const uint8_t* src_scan, int width, const uint8_t* clip_scan, + uint8_t* dst_extra_alpha) { if (m_DestFormat == FXDIB_8bppMask) { _CompositeRow_ByteMask2Mask(dest_scan, src_scan, m_MaskAlpha, width, clip_scan); @@ -4065,8 +4065,8 @@ void CFX_ScanlineCompositor::CompositeByteMaskLine(FX_LPBYTE dest_scan, FX_LPCBY _CompositeRow_ByteMask2Rgba(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, width, m_BlendType, clip_scan, dst_extra_alpha); } -void CFX_ScanlineCompositor::CompositeBitMaskLine(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, int width, FX_LPCBYTE clip_scan, - FX_LPBYTE dst_extra_alpha) +void CFX_ScanlineCompositor::CompositeBitMaskLine(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, int width, const uint8_t* clip_scan, + uint8_t* dst_extra_alpha) { if (m_DestFormat == FXDIB_8bppMask) { _CompositeRow_BitMask2Mask(dest_scan, src_scan, m_MaskAlpha, src_left, width, clip_scan); @@ -4126,11 +4126,11 @@ FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left, int dest_top, int width, in FX_BOOL bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage(); CFX_DIBitmap* pSrcAlphaMask = pSrcBitmap->m_pAlphaMask; for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * dest_Bpp; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * src_Bpp; - FX_LPCBYTE src_scan_extra_alpha = pSrcAlphaMask ? pSrcAlphaMask->GetScanline(src_top + row) + src_left : NULL; - FX_LPBYTE dst_scan_extra_alpha = m_pAlphaMask ? (FX_LPBYTE)m_pAlphaMask->GetScanline(dest_top + row) + dest_left : NULL; - FX_LPCBYTE clip_scan = NULL; + uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * dest_Bpp; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * src_Bpp; + const uint8_t* src_scan_extra_alpha = pSrcAlphaMask ? pSrcAlphaMask->GetScanline(src_top + row) + src_left : NULL; + uint8_t* dst_scan_extra_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left : NULL; + const uint8_t* clip_scan = NULL; if (pClipMask) { clip_scan = pClipMask->m_pBuffer + (dest_top + row - clip_box.top) * pClipMask->m_Pitch + (dest_left - clip_box.left); } @@ -4176,10 +4176,10 @@ FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left, int dest_top, int width, int return FALSE; } for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * Bpp; - FX_LPCBYTE src_scan = pMask->GetScanline(src_top + row); - FX_LPBYTE dst_scan_extra_alpha = m_pAlphaMask ? (FX_LPBYTE)m_pAlphaMask->GetScanline(dest_top + row) + dest_left : NULL; - FX_LPCBYTE clip_scan = NULL; + uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * Bpp; + const uint8_t* src_scan = pMask->GetScanline(src_top + row); + uint8_t* dst_scan_extra_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left : NULL; + const uint8_t* clip_scan = NULL; if (pClipMask) { clip_scan = pClipMask->m_pBuffer + (dest_top + row - clip_box.top) * pClipMask->m_Pitch + (dest_left - clip_box.left); } @@ -4212,7 +4212,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX } else { dst_color = FXARGB_TODIB(color); } - FX_LPBYTE color_p = (FX_LPBYTE)&dst_color; + uint8_t* color_p = (uint8_t*)&dst_color; if (m_bpp == 8) { uint8_t gray = 255; if (!IsAlphaMask()) { @@ -4234,7 +4234,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX } } for (int row = rect.top; row < rect.bottom; row ++) { - FX_LPBYTE dest_scan = m_pBuffer + row * m_Pitch + rect.left; + uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left; if (src_alpha == 255) { FXSYS_memset8(dest_scan, gray, width); } else @@ -4305,8 +4305,8 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX FX_BOOL bArgb = GetFormat() == FXDIB_Argb ? TRUE : FALSE; if (src_alpha == 255) { for (int row = rect.top; row < rect.bottom; row ++) { - FX_LPBYTE dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; - FX_LPBYTE dest_scan_alpha = m_pAlphaMask ? (FX_LPBYTE)m_pAlphaMask->GetScanline(row) + rect.left : NULL; + uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; + uint8_t* dest_scan_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->GetScanline(row) + rect.left : NULL; if (dest_scan_alpha) { FXSYS_memset8(dest_scan_alpha, 0xff, width); } @@ -4326,7 +4326,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX return TRUE; } for (int row = rect.top; row < rect.bottom; row ++) { - FX_LPBYTE dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; + uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; if (bAlpha) { if (bArgb) { for (int col = 0; col < width; col ++) { @@ -4347,7 +4347,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX *dest_scan++ = dest_alpha; } } else { - FX_LPBYTE dest_scan_alpha = (FX_LPBYTE)m_pAlphaMask->GetScanline(row) + rect.left; + uint8_t* dest_scan_alpha = (uint8_t*)m_pAlphaMask->GetScanline(row) + rect.left; for (int col = 0; col < width; col ++) { uint8_t back_alpha = *dest_scan_alpha; if (back_alpha == 0) { @@ -4448,8 +4448,8 @@ FX_BOOL CFX_BitmapComposer::SetInfo(int width, int height, FXDIB_Format src_form } return TRUE; } -void CFX_BitmapComposer::DoCompose(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int dest_width, FX_LPCBYTE clip_scan, - FX_LPCBYTE src_extra_alpha, FX_LPBYTE dst_extra_alpha) +void CFX_BitmapComposer::DoCompose(uint8_t* dest_scan, const uint8_t* src_scan, int dest_width, const uint8_t* clip_scan, + const uint8_t* src_extra_alpha, uint8_t* dst_extra_alpha) { if (m_BitmapAlpha < 255) { if (clip_scan) { @@ -4469,31 +4469,31 @@ void CFX_BitmapComposer::DoCompose(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m_Compositor.CompositeRgbBitmapLine(dest_scan, src_scan, dest_width, clip_scan, src_extra_alpha, dst_extra_alpha); } } -void CFX_BitmapComposer::ComposeScanline(int line, FX_LPCBYTE scanline, FX_LPCBYTE scan_extra_alpha) +void CFX_BitmapComposer::ComposeScanline(int line, const uint8_t* scanline, const uint8_t* scan_extra_alpha) { if (m_bVertical) { ComposeScanlineV(line, scanline, scan_extra_alpha); return; } - FX_LPCBYTE clip_scan = NULL; + const uint8_t* clip_scan = NULL; if (m_pClipMask) clip_scan = m_pClipMask->GetBuffer() + (m_DestTop + line - m_pClipRgn->GetBox().top) * m_pClipMask->GetPitch() + (m_DestLeft - m_pClipRgn->GetBox().left); - FX_LPBYTE dest_scan = (FX_LPBYTE)m_pBitmap->GetScanline(line + m_DestTop) + + uint8_t* dest_scan = (uint8_t*)m_pBitmap->GetScanline(line + m_DestTop) + m_DestLeft * m_pBitmap->GetBPP() / 8; - FX_LPBYTE dest_alpha_scan = m_pBitmap->m_pAlphaMask ? - (FX_LPBYTE)m_pBitmap->m_pAlphaMask->GetScanline(line + m_DestTop) + m_DestLeft : NULL; + uint8_t* dest_alpha_scan = m_pBitmap->m_pAlphaMask ? + (uint8_t*)m_pBitmap->m_pAlphaMask->GetScanline(line + m_DestTop) + m_DestLeft : NULL; DoCompose(dest_scan, scanline, m_DestWidth, clip_scan, scan_extra_alpha, dest_alpha_scan); } -void CFX_BitmapComposer::ComposeScanlineV(int line, FX_LPCBYTE scanline, FX_LPCBYTE scan_extra_alpha) +void CFX_BitmapComposer::ComposeScanlineV(int line, const uint8_t* scanline, const uint8_t* scan_extra_alpha) { int i; int Bpp = m_pBitmap->GetBPP() / 8; int dest_pitch = m_pBitmap->GetPitch(); int dest_alpha_pitch = m_pBitmap->m_pAlphaMask ? m_pBitmap->m_pAlphaMask->GetPitch() : 0; int dest_x = m_DestLeft + (m_bFlipX ? (m_DestWidth - line - 1) : line); - FX_LPBYTE dest_buf = m_pBitmap->GetBuffer() + dest_x * Bpp + m_DestTop * dest_pitch; - FX_LPBYTE dest_alpha_buf = m_pBitmap->m_pAlphaMask ? + uint8_t* dest_buf = m_pBitmap->GetBuffer() + dest_x * Bpp + m_DestTop * dest_pitch; + uint8_t* dest_alpha_buf = m_pBitmap->m_pAlphaMask ? m_pBitmap->m_pAlphaMask->GetBuffer() + dest_x + m_DestTop * dest_alpha_pitch : NULL; if (m_bFlipY) { dest_buf += dest_pitch * (m_DestHeight - 1); @@ -4505,27 +4505,27 @@ void CFX_BitmapComposer::ComposeScanlineV(int line, FX_LPCBYTE scanline, FX_LPCB y_step = -y_step; y_alpha_step = -y_alpha_step; } - FX_LPBYTE src_scan = m_pScanlineV; - FX_LPBYTE dest_scan = dest_buf; + uint8_t* src_scan = m_pScanlineV; + uint8_t* dest_scan = dest_buf; for (i = 0; i < m_DestHeight; i ++) { for (int j = 0; j < Bpp; j ++) { *src_scan++ = dest_scan[j]; } dest_scan += y_step; } - FX_LPBYTE src_alpha_scan = m_pScanlineAlphaV; - FX_LPBYTE dest_alpha_scan = dest_alpha_buf; + uint8_t* src_alpha_scan = m_pScanlineAlphaV; + uint8_t* dest_alpha_scan = dest_alpha_buf; if (dest_alpha_scan) { for (i = 0; i < m_DestHeight; i ++) { *src_alpha_scan++ = *dest_alpha_scan; dest_alpha_scan += y_alpha_step; } } - FX_LPBYTE clip_scan = NULL; + uint8_t* clip_scan = NULL; if (m_pClipMask) { clip_scan = m_pClipScanV; int clip_pitch = m_pClipMask->GetPitch(); - FX_LPCBYTE src_clip = m_pClipMask->GetBuffer() + (m_DestTop - m_pClipRgn->GetBox().top) * + const uint8_t* src_clip = m_pClipMask->GetBuffer() + (m_DestTop - m_pClipRgn->GetBox().top) * clip_pitch + (dest_x - m_pClipRgn->GetBox().left); if (m_bFlipY) { src_clip += clip_pitch * (m_DestHeight - 1); diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp index b4fdd3a1ba..ef4f7e40b5 100644 --- a/core/src/fxge/dib/fx_dib_convert.cpp +++ b/core/src/fxge/dib/fx_dib_convert.cpp @@ -279,16 +279,16 @@ FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap, int pal_type) _Obtain_Pal(m_aLut, m_cLut, m_pPalette, pal_type, win_mac_pal, m_lut); return TRUE; } -FX_BOOL _ConvertBuffer_1bppMask2Gray(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top) { uint8_t set_gray, reset_gray; set_gray = 0xff; reset_gray = 0x00; for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; + uint8_t* dest_scan = dest_buf + row * dest_pitch; FXSYS_memset8(dest_scan, reset_gray, width); - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row); + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row); for (int col = src_left; col < src_left + width; col ++) { if (src_scan[col / 8] & (1 << (7 - col % 8))) { *dest_scan = set_gray; @@ -298,17 +298,17 @@ FX_BOOL _ConvertBuffer_1bppMask2Gray(FX_LPBYTE dest_buf, int dest_pitch, int wid } return TRUE; } -FX_BOOL _ConvertBuffer_8bppMask2Gray(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_8bppMask2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top) { 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; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; FXSYS_memcpy32(dest_scan, src_scan, width); } return TRUE; } -FX_BOOL _ConvertBuffer_1bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { FX_DWORD* src_plt = pSrcBitmap->GetPalette(); @@ -319,7 +319,7 @@ FX_BOOL _ConvertBuffer_1bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt plt[0] = FXCMYK_TODIB(src_plt[0]); plt[1] = FXCMYK_TODIB(src_plt[1]); } else { - FX_LPBYTE bgr_ptr = (FX_LPBYTE)plt; + uint8_t* bgr_ptr = (uint8_t*)plt; bgr_ptr[0] = FXARGB_B(src_plt[0]); bgr_ptr[1] = FXARGB_G(src_plt[0]); bgr_ptr[2] = FXARGB_R(src_plt[0]); @@ -328,7 +328,7 @@ FX_BOOL _ConvertBuffer_1bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt bgr_ptr[5] = FXARGB_R(src_plt[1]); } ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); - pIccModule->TranslateScanline(pIccTransform, gray, (FX_LPCBYTE)plt, 2); + pIccModule->TranslateScanline(pIccTransform, gray, (const uint8_t*)plt, 2); } else { uint8_t reset_r, reset_g, reset_b, set_r, set_g, set_b; @@ -349,9 +349,9 @@ FX_BOOL _ConvertBuffer_1bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt gray[1] = FXRGB2GRAY(set_r, set_g, set_b); } for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; + uint8_t* dest_scan = dest_buf + row * dest_pitch; FXSYS_memset8(dest_scan, gray[0], width); - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row); + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row); for (int col = src_left; col < src_left + width; col ++) { if (src_scan[col / 8] & (1 << (7 - col % 8))) { *dest_scan = gray[1]; @@ -361,7 +361,7 @@ FX_BOOL _ConvertBuffer_1bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt } return TRUE; } -FX_BOOL _ConvertBuffer_8bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { FX_DWORD* src_plt = pSrcBitmap->GetPalette(); @@ -373,7 +373,7 @@ FX_BOOL _ConvertBuffer_8bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt plt[i] = FXCMYK_TODIB(src_plt[i]); } } else { - FX_LPBYTE bgr_ptr = (FX_LPBYTE)plt; + uint8_t* bgr_ptr = (uint8_t*)plt; for (int i = 0; i < 256; i ++) { *bgr_ptr++ = FXARGB_B(src_plt[i]); *bgr_ptr++ = FXARGB_G(src_plt[i]); @@ -381,7 +381,7 @@ FX_BOOL _ConvertBuffer_8bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt } } ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); - pIccModule->TranslateScanline(pIccTransform, gray, (FX_LPCBYTE)plt, 256); + pIccModule->TranslateScanline(pIccTransform, gray, (const uint8_t*)plt, 256); } else { if (pSrcBitmap->IsCmykImage()) { uint8_t r, g, b; @@ -396,15 +396,15 @@ FX_BOOL _ConvertBuffer_8bppPlt2Gray(FX_LPBYTE dest_buf, int dest_pitch, int widt } } 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; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; for (int col = 0; col < width; col ++) { *dest_scan++ = gray[*src_scan++]; } } return TRUE; } -FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { int Bpp = pSrcBitmap->GetBPP() / 8; @@ -412,14 +412,14 @@ FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(FX_LPBYTE dest_buf, int dest_pitch, int wi ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (Bpp == 3 || pSrcBitmap->IsCmykImage()) { 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 * Bpp; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp; pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, width); } } else { 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 * 4; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 4; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1); dest_scan++; @@ -430,8 +430,8 @@ FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(FX_LPBYTE dest_buf, int dest_pitch, int wi } else { if (pSrcBitmap->IsCmykImage()) { 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 * 4; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 4; for (int col = 0; col < width; col ++) { 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]), @@ -442,8 +442,8 @@ FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(FX_LPBYTE dest_buf, int dest_pitch, int wi } } else { 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 * Bpp; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp; for (int col = 0; col < width; col ++) { *dest_scan++ = FXRGB2GRAY(src_scan[2], src_scan[1], src_scan[0]); src_scan += Bpp; @@ -453,14 +453,14 @@ FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(FX_LPBYTE dest_buf, int dest_pitch, int wi } return TRUE; } -inline void _ConvertBuffer_IndexCopy(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +inline void _ConvertBuffer_IndexCopy(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top) { if (pSrcBitmap->GetBPP() == 1) { for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; + uint8_t* dest_scan = dest_buf + row * dest_pitch; FXSYS_memset32(dest_scan, 0, width); - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row); + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row); for (int col = src_left; col < src_left + width; col ++) { if (src_scan[col / 8] & (1 << (7 - col % 8))) { *dest_scan = 1; @@ -470,13 +470,13 @@ inline void _ConvertBuffer_IndexCopy(FX_LPBYTE dest_buf, int dest_pitch, int wid } } else { 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; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; FXSYS_memcpy32(dest_scan, src_scan, width); } } } -FX_BOOL _ConvertBuffer_Plt2PltRgb8(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, FX_DWORD* dst_plt, void* pIccTransform) { _ConvertBuffer_IndexCopy(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top); @@ -484,7 +484,7 @@ FX_BOOL _ConvertBuffer_Plt2PltRgb8(FX_LPBYTE dest_buf, int dest_pitch, int width int plt_size = pSrcBitmap->GetPaletteSize(); if (pIccTransform) { FX_DWORD plt[256]; - FX_LPBYTE bgr_ptr = (FX_LPBYTE)plt; + uint8_t* bgr_ptr = (uint8_t*)plt; if (pSrcBitmap->IsCmykImage()) { for (int i = 0; i < plt_size; i ++) { plt[i] = FXCMYK_TODIB(src_plt[i]); @@ -495,10 +495,10 @@ FX_BOOL _ConvertBuffer_Plt2PltRgb8(FX_LPBYTE dest_buf, int dest_pitch, int width *bgr_ptr++ = FXARGB_G(src_plt[i]); *bgr_ptr++ = FXARGB_R(src_plt[i]); } - bgr_ptr = (FX_LPBYTE)plt; + bgr_ptr = (uint8_t*)plt; } ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)plt, (FX_LPCBYTE)plt, plt_size); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)plt, (const uint8_t*)plt, plt_size); for (int i = 0; i < plt_size; i ++) { dst_plt[i] = FXARGB_MAKE(0xff, bgr_ptr[2], bgr_ptr[1], bgr_ptr[0]); bgr_ptr += 3; @@ -517,7 +517,7 @@ FX_BOOL _ConvertBuffer_Plt2PltRgb8(FX_LPBYTE dest_buf, int dest_pitch, int width } return TRUE; } -inline FX_BOOL _ConvertBuffer_Rgb2PltRgb8_NoTransform(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +inline FX_BOOL _ConvertBuffer_Rgb2PltRgb8_NoTransform(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, FX_DWORD* dst_plt) { int bpp = pSrcBitmap->GetBPP() / 8; @@ -573,7 +573,7 @@ inline FX_BOOL _ConvertBuffer_Rgb2PltRgb8_NoTransform(FX_LPBYTE dest_buf, int de FXSYS_memcpy32(dst_plt, pPalette, sizeof(FX_DWORD) * 256); return TRUE; } -FX_BOOL _ConvertBuffer_Rgb2PltRgb8(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, FX_DWORD* dst_plt, void* pIccTransform) { ICodec_IccModule* pIccModule = NULL; @@ -586,13 +586,13 @@ FX_BOOL _ConvertBuffer_Rgb2PltRgb8(FX_LPBYTE dest_buf, int dest_pitch, int width for (int i = 0; i < 256; i++) { FX_ARGB* plt = dst_plt + i; FX_ARGB plt_entry = FXARGB_TODIB(*plt); - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&plt_entry, (FX_LPCBYTE)&plt_entry, 1); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&plt_entry, (const uint8_t*)&plt_entry, 1); *plt = FXARGB_TODIB(plt_entry); } } return ret; } -FX_BOOL _ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top) { int comps = (dst_format & 0xff) / 8; @@ -600,8 +600,8 @@ FX_BOOL _ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, set_gray = 0xff; reset_gray = 0x00; 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); + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row); for (int col = src_left; col < src_left + width; col ++) { if (src_scan[col / 8] & (1 << (7 - col % 8))) { dest_scan[0] = set_gray; @@ -617,13 +617,13 @@ FX_BOOL _ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, } return TRUE; } -FX_BOOL _ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top) { int comps = (dst_format & 0xff) / 8; 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; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; uint8_t src_pixel; for (int col = 0; col < width; col ++) { src_pixel = *src_scan++; @@ -635,13 +635,13 @@ FX_BOOL _ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, } return TRUE; } -FX_BOOL _ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { int comps = (dst_format & 0xff) / 8; FX_DWORD* src_plt = pSrcBitmap->GetPalette(); FX_DWORD plt[2]; - FX_LPBYTE bgr_ptr = (FX_LPBYTE)plt; + uint8_t* bgr_ptr = (uint8_t*)plt; if (pSrcBitmap->IsCmykImage()) { plt[0] = FXCMYK_TODIB(src_plt[0]); plt[1] = FXCMYK_TODIB(src_plt[1]); @@ -655,7 +655,7 @@ FX_BOOL _ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, } if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)plt, (FX_LPCBYTE)plt, 2); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)plt, (const uint8_t*)plt, 2); } else { 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]), @@ -665,8 +665,8 @@ FX_BOOL _ConvertBuffer_1bppPlt2Rgb(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); + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row); for (int col = src_left; col < src_left + width; col ++) { if (src_scan[col / 8] & (1 << (7 - col % 8))) { *dest_scan++ = bgr_ptr[3]; @@ -682,20 +682,20 @@ FX_BOOL _ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, } return TRUE; } -FX_BOOL _ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { int comps = (dst_format & 0xff) / 8; FX_DWORD* src_plt = pSrcBitmap->GetPalette(); FX_DWORD plt[256]; - FX_LPBYTE bgr_ptr = (FX_LPBYTE)plt; + uint8_t* bgr_ptr = (uint8_t*)plt; if (!pSrcBitmap->IsCmykImage()) { for (int i = 0; i < 256; i++) { *bgr_ptr++ = FXARGB_B(src_plt[i]); *bgr_ptr++ = FXARGB_G(src_plt[i]); *bgr_ptr++ = FXARGB_R(src_plt[i]); } - bgr_ptr = (FX_LPBYTE)plt; + bgr_ptr = (uint8_t*)plt; } if (pIccTransform) { if (pSrcBitmap->IsCmykImage()) { @@ -704,7 +704,7 @@ FX_BOOL _ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, } } ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)plt, (FX_LPCBYTE)plt, 256); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)plt, (const uint8_t*)plt, 256); } else { if (pSrcBitmap->IsCmykImage()) { for (int i = 0; i < 256; i++) { @@ -712,14 +712,14 @@ FX_BOOL _ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, bgr_ptr[2], bgr_ptr[1], bgr_ptr[0]); bgr_ptr += 3; } - bgr_ptr = (FX_LPBYTE)plt; + bgr_ptr = (uint8_t*)plt; } } 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; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; for (int col = 0; col < width; col ++) { - FX_LPBYTE src_pixel = bgr_ptr + 3 * (*src_scan++); + uint8_t* src_pixel = bgr_ptr + 3 * (*src_scan++); *dest_scan++ = *src_pixel++; *dest_scan++ = *src_pixel++; *dest_scan = *src_pixel++; @@ -728,31 +728,31 @@ FX_BOOL _ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, FX_LPBYTE dest_buf, } return TRUE; } -FX_BOOL _ConvertBuffer_24bppRgb2Rgb24(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_24bppRgb2Rgb24(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); 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 * 3; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 3; pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, width); } } else { 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 * 3; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 3; FXSYS_memcpy32(dest_scan, src_scan, width * 3); } } return TRUE; } -FX_BOOL _ConvertBuffer_32bppRgb2Rgb24(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { 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 * 4; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 4; for (int col = 0; col < width; col ++) { *dest_scan++ = *src_scan++; *dest_scan++ = *src_scan++; @@ -763,21 +763,21 @@ FX_BOOL _ConvertBuffer_32bppRgb2Rgb24(FX_LPBYTE dest_buf, int dest_pitch, int wi if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; + uint8_t* dest_scan = dest_buf + row * dest_pitch; pIccModule->TranslateScanline(pIccTransform, dest_scan, dest_scan, width); } } return TRUE; } -FX_BOOL _ConvertBuffer_Rgb2Rgb32(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { int comps = pSrcBitmap->GetBPP() / 8; if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); 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 * comps; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * comps; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1); dest_scan += 4; @@ -786,8 +786,8 @@ FX_BOOL _ConvertBuffer_Rgb2Rgb32(FX_LPBYTE dest_buf, int dest_pitch, int width, } } else { 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 * comps; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * comps; for (int col = 0; col < width; col ++) { *dest_scan++ = *src_scan++; *dest_scan++ = *src_scan++; @@ -799,14 +799,14 @@ FX_BOOL _ConvertBuffer_Rgb2Rgb32(FX_LPBYTE dest_buf, int dest_pitch, int width, } return TRUE; } -FX_BOOL _ConvertBuffer_32bppCmyk2Rgb32(FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL _ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, void* pIccTransform) { if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); 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 * 4; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 4; for (int col = 0; col < width; col ++) { pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1); dest_scan += 4; @@ -815,8 +815,8 @@ FX_BOOL _ConvertBuffer_32bppCmyk2Rgb32(FX_LPBYTE dest_buf, int dest_pitch, int w } } else { 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 * 4; + uint8_t* dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 4; for (int col = 0; col < width; col ++) { AdobeCMYK_to_sRGB1(src_scan[0], src_scan[1], src_scan[2], src_scan[3], dest_scan[2], dest_scan[1], dest_scan[0]); @@ -827,7 +827,7 @@ FX_BOOL _ConvertBuffer_32bppCmyk2Rgb32(FX_LPBYTE dest_buf, int dest_pitch, int w } return TRUE; } -FX_BOOL ConvertBuffer(FXDIB_Format dest_format, FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, FX_DWORD*& d_pal, void* pIccTransform) { FXDIB_Format src_format = pSrcBitmap->GetFormat(); @@ -993,7 +993,7 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransfor if (dest_format == FXDIB_Argb && src_format == FXDIB_Rgb32 && pIccTransform == NULL) { m_AlphaFlag = 2; for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE scanline = m_pBuffer + row * m_Pitch + 3; + uint8_t* scanline = m_pBuffer + row * m_Pitch + 3; for (int col = 0; col < m_Width; col ++) { *scanline = 0xff; scanline += 4; @@ -1003,7 +1003,7 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransfor } int dest_bpp = dest_format & 0xff; int dest_pitch = (dest_bpp * m_Width + 31) / 32 * 4; - FX_LPBYTE dest_buf = FX_TryAlloc(uint8_t, dest_pitch * m_Height + 4); + uint8_t* dest_buf = FX_TryAlloc(uint8_t, dest_pitch * m_Height + 4); if (dest_buf == NULL) { return FALSE; } @@ -1012,8 +1012,8 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransfor FXSYS_memset8(dest_buf, 0xff, dest_pitch * m_Height + 4); if (m_pAlphaMask) { for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE pDstScanline = dest_buf + row * dest_pitch + 3; - FX_LPCBYTE pSrcScanline = m_pAlphaMask->GetScanline(row); + uint8_t* pDstScanline = dest_buf + row * dest_pitch + 3; + const uint8_t* pSrcScanline = m_pAlphaMask->GetScanline(row); for (int col = 0; col < m_Width; col ++) { *pDstScanline = *pSrcScanline++; pDstScanline += 4; diff --git a/core/src/fxge/dib/fx_dib_engine.cpp b/core/src/fxge/dib/fx_dib_engine.cpp index e0b21d2f59..fc36b95581 100644 --- a/core/src/fxge/dib/fx_dib_engine.cpp +++ b/core/src/fxge/dib/fx_dib_engine.cpp @@ -350,10 +350,10 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) rows_to_go = FX_STRECH_PAUSE_ROWS; } } - FX_LPCBYTE src_scan = m_pSource->GetScanline(m_CurRow); - FX_LPBYTE dest_scan = m_pInterBuf + (m_CurRow - m_SrcClip.top) * m_InterPitch; - FX_LPCBYTE src_scan_mask = NULL; - FX_LPBYTE dest_scan_mask = NULL; + const uint8_t* src_scan = m_pSource->GetScanline(m_CurRow); + uint8_t* dest_scan = m_pInterBuf + (m_CurRow - m_SrcClip.top) * m_InterPitch; + const uint8_t* src_scan_mask = NULL; + uint8_t* dest_scan_mask = NULL; if (m_pExtraAlphaBuf) { src_scan_mask = m_pSource->m_pAlphaMask->GetScanline(m_CurRow); dest_scan_mask = m_pExtraAlphaBuf + (m_CurRow - m_SrcClip.top) * m_ExtraMaskPitch; @@ -477,7 +477,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) int dest_r_y = 0, dest_g_m = 0, dest_b_c = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j ++) { int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart]; - FX_LPCBYTE src_pixel = src_scan + j * Bpp; + const uint8_t* src_pixel = src_scan + j * Bpp; dest_b_c += pixel_weight * (*src_pixel++); dest_g_m += pixel_weight * (*src_pixel++); dest_r_y += pixel_weight * (*src_pixel); @@ -500,7 +500,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) int dest_a = 0, dest_r_y = 0, dest_g_m = 0, dest_b_c = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j ++) { int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart]; - FX_LPCBYTE src_pixel = src_scan + j * Bpp; + const uint8_t* src_pixel = src_scan + j * Bpp; if (m_DestFormat == FXDIB_Argb) { pixel_weight = pixel_weight * src_pixel[3] / 255; } else { @@ -596,7 +596,7 @@ void CStretchEngine::StretchVert() int dest_r_y = 0, dest_g_m = 0, dest_b_c = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j ++) { int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart]; - FX_LPCBYTE src_pixel = src_scan + (j - m_SrcClip.top) * m_InterPitch; + const uint8_t* src_pixel = src_scan + (j - m_SrcClip.top) * m_InterPitch; dest_b_c += pixel_weight * (*src_pixel++); dest_g_m += pixel_weight * (*src_pixel++); dest_r_y += pixel_weight * (*src_pixel); @@ -624,7 +624,7 @@ void CStretchEngine::StretchVert() int dest_a = 0, dest_r_y = 0, dest_g_m = 0, dest_b_c = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j ++) { int pixel_weight = pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart]; - FX_LPCBYTE src_pixel = src_scan + (j - m_SrcClip.top) * m_InterPitch; + const uint8_t* src_pixel = src_scan + (j - m_SrcClip.top) * m_InterPitch; int mask_v = 255; if (src_scan_mask) { mask_v = src_scan_mask[(j - m_SrcClip.top) * m_ExtraMaskPitch]; diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp index 74c4276695..db9b43412a 100644 --- a/core/src/fxge/dib/fx_dib_main.cpp +++ b/core/src/fxge/dib/fx_dib_main.cpp @@ -9,7 +9,7 @@ #include "../../../include/fxcodec/fx_codec.h" #include "dib_int.h" #include <limits.h> -FX_BOOL ConvertBuffer(FXDIB_Format dest_format, FX_LPBYTE dest_buf, int dest_pitch, int width, int height, +FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitch, int width, int height, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, FX_DWORD*& pal, void* pIccTransform); void CmykDecode(FX_DWORD cmyk, int& c, int& m, int& y, int& k) { @@ -59,7 +59,7 @@ CFX_DIBitmap::CFX_DIBitmap() m_pPalette = NULL; } #define _MAX_OOM_LIMIT_ 12000000 -FX_BOOL CFX_DIBitmap::Create(int width, int height, FXDIB_Format format, FX_LPBYTE pBuffer, int pitch) +FX_BOOL CFX_DIBitmap::Create(int width, int height, FXDIB_Format format, uint8_t* pBuffer, int pitch) { m_pBuffer = NULL; m_bpp = (uint8_t)format; @@ -191,8 +191,8 @@ CFX_DIBitmap* CFX_DIBSource::Clone(const FX_RECT* pClip) const copy_len = m_Pitch; } for (int row = rect.top; row < rect.bottom; row ++) { - FX_LPCBYTE src_scan = GetScanline(row) + rect.left * m_bpp / 8; - FX_LPBYTE dest_scan = (FX_LPBYTE)pNewBitmap->GetScanline(row - rect.top); + const uint8_t* src_scan = GetScanline(row) + rect.left * m_bpp / 8; + uint8_t* dest_scan = (uint8_t*)pNewBitmap->GetScanline(row - rect.top); FXSYS_memcpy32(dest_scan, src_scan, copy_len); } } @@ -392,8 +392,8 @@ FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left, int dest_top, int width, int if (dest_format == src_format && pIccTransform == NULL) { if (GetBPP() == 1) { for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = m_pBuffer + (dest_top + row) * m_Pitch; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row); + uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row); for (int col = 0; col < width; col ++) { if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) { dest_scan[(dest_left + col) / 8] |= 1 << (7 - (dest_left + col) % 8); @@ -405,8 +405,8 @@ FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left, int dest_top, int width, int } else { int Bpp = GetBPP() / 8; for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * Bpp; - FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp; + uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * Bpp; + const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp; FXSYS_memcpy32(dest_scan, src_scan, width * Bpp); } } @@ -417,7 +417,7 @@ FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left, int dest_top, int width, int if (m_bpp == 8) { dest_format = FXDIB_8bppMask; } - FX_LPBYTE dest_buf = m_pBuffer + dest_top * m_Pitch + dest_left * GetBPP() / 8; + uint8_t* dest_buf = m_pBuffer + dest_top * m_Pitch + dest_left * GetBPP() / 8; FX_DWORD* d_plt = NULL; if(!ConvertBuffer(dest_format, dest_buf, m_Pitch, width, height, pSrcBitmap, src_left, src_top, d_plt, pIccTransform)) { return FALSE; @@ -450,7 +450,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, int dest_top, int width, int h alpha = FXARGB_A(color); dst_color = FXARGB_TODIB(color); } - FX_LPBYTE color_p = (FX_LPBYTE)&dst_color; + uint8_t* color_p = (uint8_t*)&dst_color; if (pIccTransform && CFX_GEModule::Get()->GetCodecModule() && CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); pIccModule->TranslateScanline(pIccTransform, color_p, color_p, 1); @@ -468,7 +468,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, int dest_top, int width, int h if (GetFormat() == FXDIB_Argb) { for (int row = 0; row < height; row ++) { FX_DWORD* dest_pos = (FX_DWORD*)(m_pBuffer + (dest_top + row) * m_Pitch + dest_left * 4); - FX_LPCBYTE src_scan = pMask->GetScanline(src_top + row); + const uint8_t* src_scan = pMask->GetScanline(src_top + row); if (src_bpp == 1) { for (int col = 0; col < width; col ++) { int src_bitpos = src_left + col; @@ -491,9 +491,9 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, int dest_top, int width, int h } else { int comps = m_bpp / 8; for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_color_pos = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * comps; - FX_LPBYTE dest_alpha_pos = (FX_LPBYTE)m_pAlphaMask->GetScanline(dest_top + row) + dest_left; - FX_LPCBYTE src_scan = pMask->GetScanline(src_top + row); + uint8_t* dest_color_pos = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * comps; + uint8_t* dest_alpha_pos = (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left; + const uint8_t* src_scan = pMask->GetScanline(src_top + row); if (src_bpp == 1) { for (int col = 0; col < width; col ++) { int src_bitpos = src_left + col; @@ -574,8 +574,8 @@ CFX_DIBitmap* CFX_DIBSource::GetAlphaMask(const FX_RECT* pClip) const return NULL; } for (int row = rect.top; row < rect.bottom; row ++) { - FX_LPCBYTE src_scan = GetScanline(row) + rect.left * 4 + 3; - FX_LPBYTE dest_scan = (FX_LPBYTE)pMask->GetScanline(row - rect.top); + const uint8_t* src_scan = GetScanline(row) + rect.left * 4 + 3; + uint8_t* dest_scan = (uint8_t*)pMask->GetScanline(row - rect.top); for (int col = rect.left; col < rect.right; col ++) { *dest_scan ++ = *src_scan; src_scan += 4; @@ -734,8 +734,8 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource int srcBytes = pSrcClone->GetBPP() / 8; int destBytes = pDst->GetBPP() / 8; for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE dest_pos = (FX_LPBYTE)pDst->GetScanline(row) + destOffset; - FX_LPCBYTE src_pos = pSrcClone->GetScanline(row) + srcOffset; + uint8_t* dest_pos = (uint8_t*)pDst->GetScanline(row) + destOffset; + const uint8_t* src_pos = pSrcClone->GetScanline(row) + srcOffset; for (int col = 0; col < m_Width; col ++) { *dest_pos = *src_pos; dest_pos += destBytes; @@ -800,7 +800,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) return TRUE; } for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE scan_line = m_pBuffer + row * m_Pitch + destOffset; + uint8_t* scan_line = m_pBuffer + row * m_Pitch + destOffset; for (int col = 0; col < m_Width; col ++) { *scan_line = value; scan_line += Bpp; @@ -836,8 +836,8 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) return FALSE; } for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE dest_scan = m_pBuffer + m_Pitch * row; - FX_LPBYTE src_scan = pSrcClone->m_pBuffer + pSrcClone->m_Pitch * row; + uint8_t* dest_scan = m_pBuffer + m_Pitch * row; + uint8_t* src_scan = pSrcClone->m_pBuffer + pSrcClone->m_Pitch * row; if (pSrcClone->GetBPP() == 1) { for (int col = 0; col < m_Width; col ++) { if (!((1 << (7 - col % 8)) & src_scan[col / 8])) { @@ -860,8 +860,8 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) return FALSE; } for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE dest_scan = m_pBuffer + m_Pitch * row + 3; - FX_LPBYTE src_scan = pSrcClone->m_pBuffer + pSrcClone->m_Pitch * row; + uint8_t* dest_scan = m_pBuffer + m_Pitch * row + 3; + uint8_t* src_scan = pSrcClone->m_pBuffer + pSrcClone->m_Pitch * row; for (int col = 0; col < m_Width; col ++) { *dest_scan = (*dest_scan) * src_scan[col] / 255; dest_scan += 4; @@ -903,8 +903,8 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) } FXSYS_memset8(pMask->GetBuffer(), gray[0], pMask->GetPitch() * m_Height); for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE src_pos = m_pBuffer + row * m_Pitch; - FX_LPBYTE dest_pos = (FX_LPBYTE)pMask->GetScanline(row); + uint8_t* src_pos = m_pBuffer + row * m_Pitch; + uint8_t* dest_pos = (uint8_t*)pMask->GetScanline(row); for (int col = 0; col < m_Width; col ++) { if (src_pos[col / 8] & (1 << (7 - col % 8))) { *dest_pos = gray[1]; @@ -936,8 +936,8 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) return FALSE; } for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE dest_pos = pMask->GetBuffer() + row * pMask->GetPitch(); - FX_LPBYTE src_pos = m_pBuffer + row * m_Pitch; + uint8_t* dest_pos = pMask->GetBuffer() + row * pMask->GetPitch(); + uint8_t* src_pos = m_pBuffer + row * m_Pitch; for (int col = 0; col < m_Width; col ++) { *dest_pos ++ = gray[*src_pos ++]; } @@ -956,8 +956,8 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) return FALSE; } for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE src_pos = m_pBuffer + row * m_Pitch; - FX_LPBYTE dest_pos = pMask->GetBuffer() + row * pMask->GetPitch(); + uint8_t* src_pos = m_pBuffer + row * m_Pitch; + uint8_t* dest_pos = pMask->GetBuffer() + row * pMask->GetPitch(); for (int col = 0; col < m_Width; col ++) { *dest_pos ++ = FXRGB2GRAY(src_pos[2], src_pos[1], *src_pos); src_pos += 3; @@ -977,8 +977,8 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) return FALSE; } for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE src_pos = m_pBuffer + row * m_Pitch; - FX_LPBYTE dest_pos = pMask->GetBuffer() + row * pMask->GetPitch(); + uint8_t* src_pos = m_pBuffer + row * m_Pitch; + uint8_t* dest_pos = pMask->GetBuffer() + row * pMask->GetPitch(); for (int col = 0; col < m_Width; col ++) { *dest_pos ++ = FXRGB2GRAY(src_pos[2], src_pos[1], *src_pos); src_pos += 4; @@ -1007,7 +1007,7 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(int alpha) break; case FXDIB_8bppMask: { for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE scan_line = m_pBuffer + row * m_Pitch; + uint8_t* scan_line = m_pBuffer + row * m_Pitch; for (int col = 0; col < m_Width; col ++) { scan_line[col] = scan_line[col] * alpha / 255; } @@ -1016,7 +1016,7 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(int alpha) } case FXDIB_Argb: { for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE scan_line = m_pBuffer + row * m_Pitch + 3; + uint8_t* scan_line = m_pBuffer + row * m_Pitch + 3; for (int col = 0; col < m_Width; col ++) { *scan_line = (*scan_line) * alpha / 255; scan_line += 4; @@ -1047,7 +1047,7 @@ FX_DWORD CFX_DIBitmap::GetPixel(int x, int y) const if (m_pBuffer == NULL) { return 0; } - FX_LPBYTE pos = m_pBuffer + y * m_Pitch + x * GetBPP() / 8; + uint8_t* pos = m_pBuffer + y * m_Pitch + x * GetBPP() / 8; switch (GetFormat()) { case FXDIB_1bppMask: { if ((*pos) & (1 << (7 - x % 8))) { @@ -1086,7 +1086,7 @@ void CFX_DIBitmap::SetPixel(int x, int y, FX_DWORD color) if (x < 0 || x >= m_Width || y < 0 || y >= m_Height) { return; } - FX_LPBYTE pos = m_pBuffer + y * m_Pitch + x * GetBPP() / 8; + uint8_t* pos = m_pBuffer + y * m_Pitch + x * GetBPP() / 8; switch (GetFormat()) { case FXDIB_1bppMask: if (color >> 24) { @@ -1148,14 +1148,14 @@ void CFX_DIBitmap::SetPixel(int x, int y, FX_DWORD color) break; } } -void CFX_DIBitmap::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_bpp, +void CFX_DIBitmap::DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const { if (m_pBuffer == NULL) { return; } int src_Bpp = m_bpp / 8; - FX_LPBYTE scanline = m_pBuffer + line * m_Pitch; + uint8_t* scanline = m_pBuffer + line * m_Pitch; if (src_Bpp == 0) { for (int i = 0; i < clip_width; i ++) { FX_DWORD dest_x = clip_left + i; @@ -1264,7 +1264,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) if (isCmykImage) { if (forecolor == 0xff && backcolor == 0x00) { for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE scanline = m_pBuffer + row * m_Pitch; + uint8_t* scanline = m_pBuffer + row * m_Pitch; for (int col = 0; col < m_Width; col ++) { uint8_t b, g, r; AdobeCMYK_to_sRGB1(scanline[0], scanline[1], scanline[2], scanline[3], @@ -1279,7 +1279,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) } } else if (forecolor == 0 && backcolor == 0xffffff) { for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE scanline = m_pBuffer + row * m_Pitch; + uint8_t* scanline = m_pBuffer + row * m_Pitch; int gap = m_bpp / 8 - 2; for (int col = 0; col < m_Width; col ++) { int gray = FXRGB2GRAY(scanline[2], scanline[1], scanline[0]); @@ -1293,7 +1293,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) } if (isCmykImage) { for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE scanline = m_pBuffer + row * m_Pitch; + uint8_t* scanline = m_pBuffer + row * m_Pitch; for (int col = 0; col < m_Width; col ++) { uint8_t b, g, r; AdobeCMYK_to_sRGB1(scanline[0], scanline[1], scanline[2], scanline[3], @@ -1307,7 +1307,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor) } } else { for (int row = 0; row < m_Height; row ++) { - FX_LPBYTE scanline = m_pBuffer + row * m_Pitch; + uint8_t* scanline = m_pBuffer + row * m_Pitch; int gap = m_bpp / 8 - 2; for (int col = 0; col < m_Width; col ++) { int gray = FXRGB2GRAY(scanline[2], scanline[1], scanline[0]); @@ -1348,8 +1348,8 @@ FX_BOOL CFX_DIBitmap::DitherFS(const FX_DWORD* pPalette, int pal_size, const FX_ } } for (int row = rect.top; row < rect.bottom; row ++) { - FX_LPBYTE scan = m_pBuffer + row * m_Pitch; - FX_LPBYTE next_scan = m_pBuffer + (row + 1) * m_Pitch; + uint8_t* scan = m_pBuffer + row * m_Pitch; + uint8_t* next_scan = m_pBuffer + (row + 1) * m_Pitch; for (int col = rect.left; col < rect.right; col ++) { int src_pixel = scan[col]; int dest_pixel = translate[src_pixel]; @@ -1414,11 +1414,11 @@ CFX_DIBitmap* CFX_DIBSource::FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const return NULL; } pFlipped->CopyPalette(m_pPalette); - FX_LPBYTE pDestBuffer = pFlipped->GetBuffer(); + uint8_t* pDestBuffer = pFlipped->GetBuffer(); int Bpp = m_bpp / 8; for (int row = 0; row < m_Height; row ++) { - FX_LPCBYTE src_scan = GetScanline(row); - FX_LPBYTE dest_scan = pDestBuffer + m_Pitch * (bYFlip ? (m_Height - row - 1) : row); + const uint8_t* src_scan = GetScanline(row); + uint8_t* dest_scan = pDestBuffer + m_Pitch * (bYFlip ? (m_Height - row - 1) : row); if (!bXFlip) { FXSYS_memcpy32(dest_scan, src_scan, m_Pitch); continue; @@ -1460,8 +1460,8 @@ CFX_DIBitmap* CFX_DIBSource::FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const pDestBuffer = pFlipped->m_pAlphaMask->GetBuffer(); FX_DWORD dest_pitch = pFlipped->m_pAlphaMask->GetPitch(); for (int row = 0; row < m_Height; row ++) { - FX_LPCBYTE src_scan = m_pAlphaMask->GetScanline(row); - FX_LPBYTE dest_scan = pDestBuffer + dest_pitch * (bYFlip ? (m_Height - row - 1) : row); + const uint8_t* src_scan = m_pAlphaMask->GetScanline(row); + uint8_t* dest_scan = pDestBuffer + dest_pitch * (bYFlip ? (m_Height - row - 1) : row); if (!bXFlip) { FXSYS_memcpy32(dest_scan, src_scan, dest_pitch); continue; @@ -1528,12 +1528,12 @@ void CFX_FilteredDIB::LoadSrc(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc) m_pPalette = GetDestPalette(); m_pScanline = FX_Alloc(uint8_t, m_Pitch); } -FX_LPCBYTE CFX_FilteredDIB::GetScanline(int line) const +const uint8_t* CFX_FilteredDIB::GetScanline(int line) const { TranslateScanline(m_pScanline, m_pSrc->GetScanline(line)); return m_pScanline; } -void CFX_FilteredDIB::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_bpp, +void CFX_FilteredDIB::DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const { m_pSrc->DownSampleScanline(line, dest_scan, dest_bpp, dest_width, bFlipX, clip_left, clip_width); @@ -1684,11 +1684,11 @@ void CFX_BitmapStorer::Replace(CFX_DIBitmap* pBitmap) } m_pBitmap = pBitmap; } -void CFX_BitmapStorer::ComposeScanline(int line, FX_LPCBYTE scanline, FX_LPCBYTE scan_extra_alpha) +void CFX_BitmapStorer::ComposeScanline(int line, const uint8_t* scanline, const uint8_t* scan_extra_alpha) { - FX_LPBYTE dest_buf = (FX_LPBYTE)m_pBitmap->GetScanline(line); - FX_LPBYTE dest_alpha_buf = m_pBitmap->m_pAlphaMask ? - (FX_LPBYTE)m_pBitmap->m_pAlphaMask->GetScanline(line) : NULL; + uint8_t* dest_buf = (uint8_t*)m_pBitmap->GetScanline(line); + uint8_t* dest_alpha_buf = m_pBitmap->m_pAlphaMask ? + (uint8_t*)m_pBitmap->m_pAlphaMask->GetScanline(line) : NULL; if (dest_buf) { FXSYS_memcpy32(dest_buf, scanline, m_pBitmap->GetPitch()); } diff --git a/core/src/fxge/dib/fx_dib_transform.cpp b/core/src/fxge/dib/fx_dib_transform.cpp index 7d91cdba4b..b8109756e7 100644 --- a/core/src/fxge/dib/fx_dib_transform.cpp +++ b/core/src/fxge/dib/fx_dib_transform.cpp @@ -74,7 +74,7 @@ CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, FX_BOOL bYFlip, const FX_REC } pTransBitmap->CopyPalette(m_pPalette); int dest_pitch = pTransBitmap->GetPitch(); - FX_LPBYTE dest_buf = pTransBitmap->GetBuffer(); + uint8_t* dest_buf = pTransBitmap->GetBuffer(); int row_start = bXFlip ? m_Height - dest_clip.right : dest_clip.left; int row_end = bXFlip ? m_Height - dest_clip.left : dest_clip.right; int col_start = bYFlip ? m_Width - dest_clip.bottom : dest_clip.top; @@ -82,9 +82,9 @@ CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, FX_BOOL bYFlip, const FX_REC if (GetBPP() == 1) { FXSYS_memset8(dest_buf, 0xff, dest_pitch * result_height); for (int row = row_start; row < row_end; row ++) { - FX_LPCBYTE src_scan = GetScanline(row); + const uint8_t* src_scan = GetScanline(row); int dest_col = (bXFlip ? dest_clip.right - (row - row_start) - 1 : row) - dest_clip.left; - FX_LPBYTE dest_scan = dest_buf; + uint8_t* dest_scan = dest_buf; if (bYFlip) { dest_scan += (result_height - 1) * dest_pitch; } @@ -104,7 +104,7 @@ CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, FX_BOOL bYFlip, const FX_REC } for (int row = row_start; row < row_end; row ++) { int dest_col = (bXFlip ? dest_clip.right - (row - row_start) - 1 : row) - dest_clip.left; - FX_LPBYTE dest_scan = dest_buf + dest_col * nBytes; + uint8_t* dest_scan = dest_buf + dest_col * nBytes; if (bYFlip) { dest_scan += (result_height - 1) * dest_pitch; } @@ -115,7 +115,7 @@ CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, FX_BOOL bYFlip, const FX_REC dest_scan += dest_step; } } else { - FX_LPCBYTE src_scan = GetScanline(row) + col_start * nBytes; + const uint8_t* src_scan = GetScanline(row) + col_start * nBytes; if (nBytes == 1) for (int col = col_start; col < col_end; col ++) { *dest_scan = *src_scan++; @@ -137,11 +137,11 @@ CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, FX_BOOL bYFlip, const FX_REC int dest_step = bYFlip ? -dest_pitch : dest_pitch; for (int row = row_start; row < row_end; row ++) { int dest_col = (bXFlip ? dest_clip.right - (row - row_start) - 1 : row) - dest_clip.left; - FX_LPBYTE dest_scan = dest_buf + dest_col; + uint8_t* dest_scan = dest_buf + dest_col; if (bYFlip) { dest_scan += (result_height - 1) * dest_pitch; } - FX_LPCBYTE src_scan = m_pAlphaMask->GetScanline(row) + col_start; + const uint8_t* src_scan = m_pAlphaMask->GetScanline(row) + col_start; for (int col = col_start; col < col_end; col ++) { *dest_scan = *src_scan++; dest_scan += dest_step; @@ -259,24 +259,24 @@ FX_BOOL CFX_ImageTransformer::Start(const CFX_DIBSource* pSrc, const CFX_AffineM m_Status = 3; return TRUE; } -uint8_t _bilinear_interpol(FX_LPCBYTE buf, int row_offset_l, int row_offset_r, +uint8_t _bilinear_interpol(const uint8_t* 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) { int i_resx = 255 - res_x; int col_bpp_l = src_col_l * bpp; int col_bpp_r = src_col_r * bpp; - FX_LPCBYTE buf_u = buf + row_offset_l + c_offset; - FX_LPCBYTE buf_d = buf + row_offset_r + c_offset; - FX_LPCBYTE src_pos0 = buf_u + col_bpp_l; - 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; + const uint8_t* buf_u = buf + row_offset_l + c_offset; + const uint8_t* buf_d = buf + row_offset_r + c_offset; + const uint8_t* src_pos0 = buf_u + col_bpp_l; + const uint8_t* src_pos1 = buf_u + col_bpp_r; + const uint8_t* src_pos2 = buf_d + col_bpp_l; + const uint8_t* src_pos3 = buf_d + col_bpp_r; 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; } -uint8_t _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(const uint8_t* 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; @@ -361,8 +361,8 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) if (m_Storer.GetBitmap() == NULL) { return FALSE; } - FX_LPCBYTE stretch_buf = m_Storer.GetBitmap()->GetBuffer(); - FX_LPCBYTE stretch_buf_mask = NULL; + const uint8_t* stretch_buf = m_Storer.GetBitmap()->GetBuffer(); + const uint8_t* stretch_buf_mask = NULL; if (m_Storer.GetBitmap()->m_pAlphaMask) { stretch_buf_mask = m_Storer.GetBitmap()->m_pAlphaMask->GetBuffer(); } @@ -463,7 +463,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_LPBYTE dest_scan = (FX_LPBYTE)pTransformed->GetScanline(row); + uint8_t* dest_scan = (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); @@ -492,7 +492,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_LPBYTE dest_scan = (FX_LPBYTE)pTransformed->GetScanline(row); + uint8_t* dest_scan = (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); @@ -514,7 +514,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_LPBYTE dest_scan = (FX_LPBYTE)pTransformed->GetScanline(row); + uint8_t* dest_scan = (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); @@ -525,7 +525,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) if (src_row == stretch_height) { src_row --; } - FX_LPCBYTE src_pixel = stretch_buf + stretch_pitch * src_row + src_col; + const uint8_t* src_pixel = stretch_buf + stretch_pitch * src_row + src_col; *dest_scan = *src_pixel; } dest_scan ++; @@ -762,7 +762,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) if (src_row == stretch_height) { src_row --; } - FX_LPCBYTE src_pos = stretch_buf + src_row * stretch_pitch + src_col * Bpp; + const uint8_t* src_pos = stretch_buf + src_row * stretch_pitch + src_col * Bpp; if (bHasAlpha) { if (transformF != FXDIB_Argb) { if (transformF == FXDIB_Rgba) { diff --git a/core/src/fxge/ge/fx_ge.cpp b/core/src/fxge/ge/fx_ge.cpp index 4cfa95b881..5a9c8f53e5 100644 --- a/core/src/fxge/ge/fx_ge.cpp +++ b/core/src/fxge/ge/fx_ge.cpp @@ -68,7 +68,7 @@ void CFX_GEModule::SetTextGamma(FX_FLOAT gammaValue) i++; } } -FX_LPCBYTE CFX_GEModule::GetTextGammaTable() +const uint8_t* CFX_GEModule::GetTextGammaTable() { return m_GammaValue; } diff --git a/core/src/fxge/ge/fx_ge_device.cpp b/core/src/fxge/ge/fx_ge_device.cpp index 0b4ffd5f4c..8461396c1f 100644 --- a/core/src/fxge/ge/fx_ge_device.cpp +++ b/core/src/fxge/ge/fx_ge_device.cpp @@ -390,16 +390,16 @@ FX_BOOL CFX_RenderDevice::StretchBitMask(const CFX_DIBSource* pBitmap, int left, return m_pDeviceDriver->StretchDIBits(pBitmap, argb, left, top, dest_width, dest_height, &clip_box, flags, alpha_flag, pIccTransform); } FX_BOOL CFX_RenderDevice::StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD argb, - const CFX_AffineMatrix* pMatrix, FX_DWORD flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_mode) { return m_pDeviceDriver->StartDIBits(pBitmap, bitmap_alpha, argb, pMatrix, flags, handle, alpha_flag, pIccTransform, blend_mode); } -FX_BOOL CFX_RenderDevice::ContinueDIBits(FX_LPVOID handle, IFX_Pause* pPause) +FX_BOOL CFX_RenderDevice::ContinueDIBits(void* handle, IFX_Pause* pPause) { return m_pDeviceDriver->ContinueDIBits(handle, pPause); } -void CFX_RenderDevice::CancelDIBits(FX_LPVOID handle) +void CFX_RenderDevice::CancelDIBits(void* handle) { m_pDeviceDriver->CancelDIBits(handle); } diff --git a/core/src/fxge/ge/fx_ge_font.cpp b/core/src/fxge/ge/fx_ge_font.cpp index 4c6da4edc3..c61119d5fe 100644 --- a/core/src/fxge/ge/fx_ge_font.cpp +++ b/core/src/fxge/ge/fx_ge_font.cpp @@ -8,7 +8,7 @@ #include "../../../include/fxge/fx_freetype.h" #include "text_int.h" #define EM_ADJUST(em, a) (em == 0?(a): (a)*1000/em) -extern void _FPDFAPI_GetInternalFontData(int id1, FX_LPCBYTE& data, FX_DWORD& size); +extern void _FPDFAPI_GetInternalFontData(int id1, const uint8_t*& data, FX_DWORD& size); CFX_Font::CFX_Font() { m_pSubstFont = NULL; @@ -189,7 +189,7 @@ int CFX_Font::GetGlyphWidth(FX_DWORD glyph_index) int width = EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Glyph_HoriAdvance(m_Face)); return width; } -static FXFT_Face FT_LoadFont(FX_LPBYTE pData, int size) +static FXFT_Face FT_LoadFont(uint8_t* pData, int size) { FXFT_Library library; if (CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary == NULL) { @@ -207,12 +207,12 @@ static FXFT_Face FT_LoadFont(FX_LPBYTE pData, int size) } return face; } -FX_BOOL CFX_Font::LoadEmbedded(FX_LPCBYTE data, FX_DWORD size) +FX_BOOL CFX_Font::LoadEmbedded(const uint8_t* data, FX_DWORD 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; + m_Face = FT_LoadFont((uint8_t*)m_pFontDataAllocation, size); + m_pFontData = (uint8_t*)m_pFontDataAllocation; m_bEmbedded = TRUE; m_dwSize = size; return m_Face != NULL; @@ -540,7 +540,7 @@ FX_BOOL CFX_FontEncodingEX::IsUnicodeCompatible() const { return m_nEncodingID == FXFM_ENCODING_UNICODE; } -FX_DWORD CFX_FontEncodingEX::GlyphIndexFromName(FX_LPCSTR pStrName) +FX_DWORD CFX_FontEncodingEX::GlyphIndexFromName(const FX_CHAR* pStrName) { FXFT_Face face = m_pFont->m_Face; return FT_Get_Name_Index(face, (FT_String*)pStrName); @@ -550,7 +550,7 @@ CFX_ByteString CFX_FontEncodingEX::NameFromGlyphIndex(FX_DWORD dwGlyphIndex) FXFT_Face face = m_pFont->m_Face; CFX_ByteString glyphName(" "); if (FT_HAS_GLYPH_NAMES(((FT_Face)face))) { - if (FT_Get_Glyph_Name((FT_Face)face, dwGlyphIndex, (FT_Pointer)(FX_LPCSTR)glyphName, 16)) { + if (FT_Get_Glyph_Name((FT_Face)face, dwGlyphIndex, (FT_Pointer)(const FX_CHAR*)glyphName, 16)) { glyphName.Empty(); return glyphName; } diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp index 4df7def3b9..620b82953c 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -120,7 +120,7 @@ FXFT_Face CFX_FontMgr::FindSubstFont(const CFX_ByteString& face_name, FX_BOOL bT CharsetCP, pSubstFont); } FXFT_Face CFX_FontMgr::GetCachedFace(const CFX_ByteString& face_name, - int weight, FX_BOOL bItalic, FX_LPBYTE& pFontData) + int weight, FX_BOOL bItalic, uint8_t*& pFontData) { CFX_ByteString key(face_name); key += ','; @@ -136,7 +136,7 @@ FXFT_Face CFX_FontMgr::GetCachedFace(const CFX_ByteString& face_name, return NULL; } FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name, - int weight, FX_BOOL bItalic, FX_LPBYTE pData, FX_DWORD size, int face_index) + int weight, FX_BOOL bItalic, uint8_t* pData, FX_DWORD size, int face_index) { CTTFontDesc* pFontDesc = FX_NEW CTTFontDesc; if (!pFontDesc) { @@ -170,7 +170,7 @@ FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name, m_FaceMap.SetAt(key, pFontDesc); return pFontDesc->m_SingleFace.m_pFace; } -const FX_LPCSTR g_Base14FontNames[14] = { +const FX_CHAR* const g_Base14FontNames[14] = { "Courier", "Courier-Bold", "Courier-BoldOblique", @@ -284,7 +284,7 @@ g_AltFontNames[] = { extern "C" { static int compareString(const void* key, const void* element) { - return FXSYS_stricmp((FX_LPCSTR)key, ((_AltFontName*)element)->m_pName); + return FXSYS_stricmp((const FX_CHAR*)key, ((_AltFontName*)element)->m_pName); } } int _PDF_GetStandardFontName(CFX_ByteString& name) @@ -297,10 +297,10 @@ int _PDF_GetStandardFontName(CFX_ByteString& name) name = g_Base14FontNames[found->m_Index]; return found->m_Index; } -int GetTTCIndex(FX_LPCBYTE pFontData, FX_DWORD ttc_size, FX_DWORD font_offset) +int GetTTCIndex(const uint8_t* pFontData, FX_DWORD ttc_size, FX_DWORD font_offset) { int face_index = 0; - FX_LPCBYTE p = pFontData + 8; + const uint8_t* p = pFontData + 8; FX_DWORD nfont = GET_TT_LONG(p); FX_DWORD index; for (index = 0; index < nfont; index ++) { @@ -317,7 +317,7 @@ int GetTTCIndex(FX_LPCBYTE pFontData, FX_DWORD ttc_size, FX_DWORD font_offset) return face_index; } FXFT_Face CFX_FontMgr::GetCachedTTCFace(int ttc_size, FX_DWORD checksum, - int font_offset, FX_LPBYTE& pFontData) + int font_offset, uint8_t*& pFontData) { CFX_ByteString key; key.Format("%d:%d", ttc_size, checksum); @@ -335,7 +335,7 @@ FXFT_Face CFX_FontMgr::GetCachedTTCFace(int ttc_size, FX_DWORD checksum, return pFontDesc->m_TTCFace.m_pFaces[face_index]; } FXFT_Face CFX_FontMgr::AddCachedTTCFace(int ttc_size, FX_DWORD checksum, - FX_LPBYTE pData, FX_DWORD size, int font_offset) + uint8_t* pData, FX_DWORD size, int font_offset) { CFX_ByteString key; key.Format("%d:%d", ttc_size, checksum); @@ -355,7 +355,7 @@ FXFT_Face CFX_FontMgr::AddCachedTTCFace(int ttc_size, FX_DWORD checksum, pFontDesc->m_TTCFace.m_pFaces[face_index] = GetFixedFace(pFontDesc->m_pFontData, ttc_size, face_index); return pFontDesc->m_TTCFace.m_pFaces[face_index]; } -FXFT_Face CFX_FontMgr::GetFixedFace(FX_LPCBYTE pData, FX_DWORD size, int face_index) +FXFT_Face CFX_FontMgr::GetFixedFace(const uint8_t* pData, FX_DWORD size, int face_index) { FXFT_Library library; if (m_FTLibrary == NULL) { @@ -373,7 +373,7 @@ FXFT_Face CFX_FontMgr::GetFixedFace(FX_LPCBYTE pData, FX_DWORD size, int face_in } return face; } -FXFT_Face CFX_FontMgr::GetFileFace(FX_LPCSTR filename, int face_index) +FXFT_Face CFX_FontMgr::GetFileFace(const FX_CHAR* filename, int face_index) { FXFT_Library library; if (m_FTLibrary == NULL) { @@ -448,11 +448,11 @@ const FoxitFonts g_FoxitFonts[14] = { {g_FoxitSymbolFontData, 16729}, {g_FoxitDingbatsFontData, 29513}, }; -void _FPDFAPI_GetInternalFontData(int id, FX_LPCBYTE& data, FX_DWORD& size) +void _FPDFAPI_GetInternalFontData(int id, const uint8_t*& data, FX_DWORD& size) { CFX_GEModule::Get()->GetFontMgr()->GetStandardFont(data, size, id); } -FX_BOOL CFX_FontMgr::GetStandardFont(FX_LPCBYTE& pFontData, FX_DWORD& size, int index) +FX_BOOL CFX_FontMgr::GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index) { if (index > 15 || index < 0) { return FALSE; @@ -507,7 +507,7 @@ void CFX_FontMapper::SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) } m_pFontInfo = pFontInfo; } -static CFX_ByteString _TT_NormalizeName(FX_LPCSTR family) +static CFX_ByteString _TT_NormalizeName(const FX_CHAR* family) { CFX_ByteString norm(family, -1); norm.Remove(' '); @@ -520,12 +520,12 @@ static CFX_ByteString _TT_NormalizeName(FX_LPCSTR family) norm.MakeLower(); return norm; } -CFX_ByteString _FPDF_GetNameFromTT(FX_LPCBYTE name_table, FX_DWORD name_id) +CFX_ByteString _FPDF_GetNameFromTT(const uint8_t* name_table, FX_DWORD name_id) { - FX_LPCBYTE ptr = name_table + 2; + const uint8_t* ptr = name_table + 2; int name_count = GET_TT_SHORT(ptr); int string_offset = GET_TT_SHORT(ptr + 2); - FX_LPCBYTE string_ptr = name_table + string_offset; + const uint8_t* string_ptr = name_table + string_offset; ptr += 4; for (int i = 0; i < name_count; i ++) { if (GET_TT_SHORT(ptr + 6) == name_id && GET_TT_SHORT(ptr) == 1 && GET_TT_SHORT(ptr + 2) == 0) { @@ -544,10 +544,10 @@ static CFX_ByteString _FPDF_ReadStringFromFile(FXSYS_FILE* pFile, FX_DWORD size) buffer.ReleaseBuffer(size); return buffer; } -CFX_ByteString _FPDF_LoadTableFromTT(FXSYS_FILE* pFile, FX_LPCBYTE pTables, FX_DWORD nTables, FX_DWORD tag) +CFX_ByteString _FPDF_LoadTableFromTT(FXSYS_FILE* pFile, const uint8_t* pTables, FX_DWORD nTables, FX_DWORD tag) { for (FX_DWORD i = 0; i < nTables; i ++) { - FX_LPCBYTE p = pTables + i * 16; + const uint8_t* p = pTables + i * 16; if (GET_TT_LONG(p) == tag) { FX_DWORD offset = GET_TT_LONG(p + 8); FX_DWORD size = GET_TT_LONG(p + 12); @@ -557,10 +557,10 @@ CFX_ByteString _FPDF_LoadTableFromTT(FXSYS_FILE* pFile, FX_LPCBYTE pTables, FX_D } return CFX_ByteString(); } -CFX_ByteString _FPDF_LoadTableFromTTStreamFile(IFX_FileStream* pFile, FX_LPCBYTE pTables, FX_DWORD nTables, FX_DWORD tag) +CFX_ByteString _FPDF_LoadTableFromTTStreamFile(IFX_FileStream* pFile, const uint8_t* pTables, FX_DWORD nTables, FX_DWORD tag) { for (FX_DWORD i = 0; i < nTables; i ++) { - FX_LPCBYTE p = pTables + i * 16; + const uint8_t* p = pTables + i * 16; if (GET_TT_LONG(p) == tag) { FX_DWORD offset = GET_TT_LONG(p + 8); FX_DWORD size = GET_TT_LONG(p + 12); @@ -582,7 +582,7 @@ CFX_ByteString CFX_FontMapper::GetPSNameFromTT(void* hFont) CFX_ByteString result; FX_DWORD size = m_pFontInfo->GetFontData(hFont, 0x6e616d65, NULL, 0); if (size) { - FX_LPBYTE buffer = FX_Alloc(uint8_t, size); + uint8_t* buffer = FX_Alloc(uint8_t, size); m_pFontInfo->GetFontData(hFont, 0x6e616d65, buffer, size); result = _FPDF_GetNameFromTT(buffer, 6); FX_Free(buffer); @@ -601,7 +601,7 @@ void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) if (name == m_LastFamily) { return; } - FX_LPCBYTE ptr = name; + const uint8_t* ptr = name; FX_BOOL bLocalized = FALSE; for (int i = 0; i < name.GetLength(); i ++) if (ptr[i] > 0x80) { @@ -761,7 +761,7 @@ FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont, int iBaseF if (m_FoxitFaces[iBaseFont]) { return m_FoxitFaces[iBaseFont]; } - FX_LPCBYTE pFontData = NULL; + const uint8_t* pFontData = NULL; FX_DWORD size = 0; if (m_pFontMgr->GetStandardFont(pFontData, size, iBaseFont)) { m_FoxitFaces[iBaseFont] = m_pFontMgr->GetFixedFace(pFontData, size, 0); @@ -779,7 +779,7 @@ FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont, int iBaseF if (m_MMFaces[1]) { return m_MMFaces[1]; } - FX_LPCBYTE pFontData = NULL; + const uint8_t* pFontData = NULL; FX_DWORD size; m_pFontMgr->GetStandardFont(pFontData, size, 14); m_MMFaces[1] = m_pFontMgr->GetFixedFace(pFontData, size, 0); @@ -789,15 +789,15 @@ FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont, int iBaseF if (m_MMFaces[0]) { return m_MMFaces[0]; } - FX_LPCBYTE pFontData = NULL; + const uint8_t* pFontData = NULL; FX_DWORD size = 0; m_pFontMgr->GetStandardFont(pFontData, size, 15); m_MMFaces[0] = m_pFontMgr->GetFixedFace(pFontData, size, 0); return m_MMFaces[0]; } const struct _AltFontFamily { - FX_LPCSTR m_pFontName; - FX_LPCSTR m_pFontFamily; + const FX_CHAR* m_pFontName; + const FX_CHAR* m_pFontFamily; } g_AltFontFamilies[] = { {"AGaramondPro", "Adobe Garamond Pro"}, @@ -807,11 +807,11 @@ g_AltFontFamilies[] = { extern "C" { static int compareFontFamilyString(const void* key, const void* element) { - CFX_ByteString str_key((FX_LPCSTR)key); + CFX_ByteString str_key((const FX_CHAR*)key); if (str_key.Find(((_AltFontFamily*)element)->m_pFontName) != -1) { return 0; } - return FXSYS_stricmp((FX_LPCSTR)key, ((_AltFontFamily*)element)->m_pFontName); + return FXSYS_stricmp((const FX_CHAR*)key, ((_AltFontFamily*)element)->m_pFontName); } } #define FX_FONT_STYLE_None 0x00 @@ -840,7 +840,7 @@ static CFX_ByteString _GetFontFamily(CFX_ByteString fontName, int nStyle) return found->m_pFontFamily; }; typedef struct _FX_FontStyle { - FX_LPCSTR style; + const FX_CHAR* style; int32_t len; } FX_FontStyle; const FX_FontStyle g_FontStyles[] = { @@ -850,7 +850,7 @@ const FX_FontStyle g_FontStyles[] = { { "Reg", 3 }, { "Regular", 7 }, }; -CFX_ByteString ParseStyle(FX_LPCSTR pStyle, int iLen, int iIndex) +CFX_ByteString ParseStyle(const FX_CHAR* pStyle, int iLen, int iIndex) { CFX_ByteTextBuf buf; if (!iLen || iLen <= iIndex) { @@ -920,7 +920,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru if (m_FoxitFaces[12]) { return m_FoxitFaces[12]; } - FX_LPCBYTE pFontData = NULL; + const uint8_t* pFontData = NULL; FX_DWORD size = 0; m_pFontMgr->GetStandardFont(pFontData, size, 12); m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0); @@ -933,7 +933,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru if (m_FoxitFaces[13]) { return m_FoxitFaces[13]; } - FX_LPCBYTE pFontData = NULL; + const uint8_t* pFontData = NULL; FX_DWORD size = 0; m_pFontMgr->GetStandardFont(pFontData, size, 13); m_FoxitFaces[13] = m_pFontMgr->GetFixedFace(pFontData, size, 0); @@ -1011,7 +1011,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru } if (!style.IsEmpty()) { int nLen = style.GetLength(); - FX_LPCSTR pStyle = style; + const FX_CHAR* pStyle = style; int i = 0; FX_BOOL bFirstItem = TRUE; CFX_ByteString buf; @@ -1176,7 +1176,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru if (m_FoxitFaces[12]) { return m_FoxitFaces[12]; } - FX_LPCBYTE pFontData = NULL; + const uint8_t* pFontData = NULL; FX_DWORD size = 0; m_pFontMgr->GetStandardFont(pFontData, size, 12); m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0); @@ -1224,7 +1224,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru for (int i = 0; i < 256; i ++) { checksum += ((FX_DWORD*)temp)[i]; } - FX_LPBYTE pFontData; + uint8_t* pFontData; face = m_pFontMgr->GetCachedTTCFace(ttc_size, checksum, ttc_size - font_size, pFontData); if (face == NULL) { pFontData = FX_Alloc(uint8_t, ttc_size); @@ -1233,7 +1233,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru ttc_size - font_size); } } else { - FX_LPBYTE pFontData; + uint8_t* pFontData; face = m_pFontMgr->GetCachedFace(SubstName, weight, bItalic, pFontData); if (face == NULL) { pFontData = FX_Alloc(uint8_t, font_size); @@ -1309,7 +1309,7 @@ FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(FX_DWORD dwUnicode, FX_DWORD fl for (int i = 0; i < 256; i ++) {
checksum += ((FX_DWORD*)temp)[i];
}
- FX_LPBYTE pFontData;
+ uint8_t* pFontData;
face = m_pFontMgr->GetCachedTTCFace(ttc_size, checksum, ttc_size - font_size, pFontData);
if (face == NULL) {
pFontData = FX_Alloc(uint8_t, ttc_size);
@@ -1322,7 +1322,7 @@ FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(FX_DWORD dwUnicode, FX_DWORD fl } else {
CFX_ByteString SubstName;
m_pFontInfo->GetFaceName(hFont, SubstName);
- FX_LPBYTE pFontData;
+ uint8_t* pFontData;
face = m_pFontMgr->GetCachedFace(SubstName, weight, bItalic, pFontData);
if (face == NULL) {
pFontData = FX_Alloc(uint8_t, font_size);
@@ -1390,7 +1390,7 @@ CFX_FolderFontInfo::~CFX_FolderFontInfo() FX_POSITION pos = m_FontList.GetStartPosition(); while (pos) { CFX_ByteString key; - FX_LPVOID value; + void* value; m_FontList.GetNextAssoc(pos, key, value); delete (CFontFaceInfo*)value; } @@ -1469,7 +1469,7 @@ void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path) return; } FX_DWORD face_bytes = nFaces * 4; - FX_LPBYTE offsets = FX_Alloc(uint8_t, face_bytes); + uint8_t* offsets = FX_Alloc(uint8_t, face_bytes); readCnt = FXSYS_fread(offsets, face_bytes, 1, pFile); if (readCnt != face_bytes) { FX_Free(offsets); @@ -1477,7 +1477,7 @@ void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path) return; } for (FX_DWORD i = 0; i < nFaces; i ++) { - FX_LPBYTE p = offsets + i * 4; + uint8_t* p = offsets + i * 4; ReportFace(path, pFile, filesize, GET_TT_LONG(p)); } FX_Free(offsets); @@ -1504,7 +1504,7 @@ void CFX_FolderFontInfo::ReportFace(CFX_ByteString& path, FXSYS_FILE* pFile, FX_ if (style != "Regular") { facename += " " + style; } - FX_LPVOID p; + void* p; if (m_FontList.Lookup(facename, p)) { return; } @@ -1520,7 +1520,7 @@ void CFX_FolderFontInfo::ReportFace(CFX_ByteString& path, FXSYS_FILE* pFile, FX_ pInfo->m_Charsets = 0; CFX_ByteString os2 = _FPDF_LoadTableFromTT(pFile, tables, nTables, 0x4f532f32); if (os2.GetLength() >= 86) { - FX_LPCBYTE p = (FX_LPCBYTE)os2 + 78; + const uint8_t* p = (const uint8_t*)os2 + 78; FX_DWORD codepages = GET_TT_LONG(p); if (codepages & (1 << 17)) { m_pMapper->AddInstalledFont(facename, FXFONT_SHIFTJIS_CHARSET); @@ -1557,23 +1557,23 @@ void CFX_FolderFontInfo::ReportFace(CFX_ByteString& path, FXSYS_FILE* pFile, FX_ } m_FontList.SetAt(facename, pInfo); } -void* CFX_FolderFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR family, FX_BOOL& bExact) +void* CFX_FolderFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL& bExact) { return NULL; } void* CFX_FolderFontInfo::MapFontByUnicode(FX_DWORD dwUnicode, int weight, FX_BOOL bItalic, int pitch_family)
-{
- return NULL;
-}
-void* CFX_FolderFontInfo::GetFont(FX_LPCSTR face) { - FX_LPVOID p; + return NULL; +} +void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) +{ + void* p; if (!m_FontList.Lookup(face, p)) { return NULL; } return p; } -FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffer, FX_DWORD size) +FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer, FX_DWORD size) { if (hFont == NULL) { return 0; @@ -1597,7 +1597,7 @@ FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE } else { FX_DWORD nTables = pFont->m_FontTables.GetLength() / 16; for (FX_DWORD i = 0; i < nTables; i ++) { - FX_LPCBYTE p = (FX_LPCBYTE)pFont->m_FontTables + i * 16; + const uint8_t* p = (const uint8_t*)pFont->m_FontTables + i * 16; if (GET_TT_LONG(p) == table) { offset = GET_TT_LONG(p + 8); datasize = GET_TT_LONG(p + 12); diff --git a/core/src/fxge/ge/fx_ge_linux.cpp b/core/src/fxge/ge/fx_ge_linux.cpp index 5a0f0dffa5..5eac00f8dd 100644 --- a/core/src/fxge/ge/fx_ge_linux.cpp +++ b/core/src/fxge/ge/fx_ge_linux.cpp @@ -9,8 +9,8 @@ #include "text_int.h" #if _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ static const struct { - FX_LPCSTR m_pName; - FX_LPCSTR m_pSubstName; + const FX_CHAR* m_pName; + const FX_CHAR* m_pSubstName; } Base14Substs[] = { {"Courier", "Courier New"}, @@ -29,13 +29,13 @@ Base14Substs[] = { class CFX_LinuxFontInfo : public CFX_FolderFontInfo { public: - virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR family, FX_BOOL& bExact); + virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL& bExact); FX_BOOL ParseFontCfg(); - void* FindFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR family, FX_BOOL bMatchName); + void* FindFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL bMatchName); }; #define LINUX_GPNAMESIZE 6 static const struct { - FX_LPCSTR NameArr[LINUX_GPNAMESIZE]; + const FX_CHAR* NameArr[LINUX_GPNAMESIZE]; } LinuxGpFontList[] = { {{"TakaoPGothic", "VL PGothic", "IPAPGothic", "VL Gothic", "Kochi Gothic", "VL Gothic regular"}}, @@ -43,20 +43,20 @@ LinuxGpFontList[] = { {{"TakaoPMincho", "IPAPMincho", "VL Gothic", "Kochi Mincho", NULL, "VL Gothic regular"}}, {{"TakaoMincho", "IPAMincho", "VL Gothic", "Kochi Mincho", NULL, "VL Gothic regular"}}, }; -static const FX_LPCSTR g_LinuxGbFontList[] = { +static const FX_CHAR* const g_LinuxGbFontList[] = { "AR PL UMing CN Light", "WenQuanYi Micro Hei", "AR PL UKai CN", }; -static const FX_LPCSTR g_LinuxB5FontList[] = { +static const FX_CHAR* const g_LinuxB5FontList[] = { "AR PL UMing TW Light", "WenQuanYi Micro Hei", "AR PL UKai TW", }; -static const FX_LPCSTR g_LinuxHGFontList[] = { +static const FX_CHAR* const g_LinuxHGFontList[] = { "UnDotum", }; -static int32_t GetJapanesePreference(FX_LPCSTR facearr, int weight, int picth_family) +static int32_t GetJapanesePreference(const FX_CHAR* 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) { @@ -77,7 +77,7 @@ static int32_t GetJapanesePreference(FX_LPCSTR facearr, int weight, int picth_fa } return 2; } -void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR cstr_face, FX_BOOL& bExact) +void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* cstr_face, FX_BOOL& bExact) { CFX_ByteString face = cstr_face; int iBaseFont; @@ -90,7 +90,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int p if (iBaseFont < 12) { return GetFont(face); } - FX_LPVOID p = NULL; + void* p = NULL; FX_BOOL bCJK = TRUE; switch (charset) { case FXFONT_SHIFTJIS_CHARSET: { @@ -105,7 +105,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int p } break; case FXFONT_GB2312_CHARSET: { - static int32_t s_gbCount = sizeof(g_LinuxGbFontList) / sizeof(FX_LPCSTR); + static int32_t s_gbCount = sizeof(g_LinuxGbFontList) / sizeof(const FX_CHAR*); for (int32_t i = 0; i < s_gbCount; i++) if (m_FontList.Lookup(g_LinuxGbFontList[i], p)) { return p; @@ -113,7 +113,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int p } break; case FXFONT_CHINESEBIG5_CHARSET: { - static int32_t s_b5Count = sizeof(g_LinuxB5FontList) / sizeof(FX_LPCSTR); + static int32_t s_b5Count = sizeof(g_LinuxB5FontList) / sizeof(const FX_CHAR*); for (int32_t i = 0; i < s_b5Count; i++) if (m_FontList.Lookup(g_LinuxB5FontList[i], p)) { return p; @@ -121,7 +121,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int p } break; case FXFONT_HANGEUL_CHARSET: { - static int32_t s_hgCount = sizeof(g_LinuxHGFontList) / sizeof(FX_LPCSTR); + static int32_t s_hgCount = sizeof(g_LinuxHGFontList) / sizeof(const FX_CHAR*); for (int32_t i = 0; i < s_hgCount; i++) if (m_FontList.Lookup(g_LinuxHGFontList[i], p)) { return p; @@ -177,7 +177,7 @@ static int32_t _LinuxGetSimilarValue(int weight, FX_BOOL bItalic, int pitch_fami } return iSimilarValue; } -void* CFX_LinuxFontInfo::FindFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR family, FX_BOOL bMatchName) +void* CFX_LinuxFontInfo::FindFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL bMatchName) { CFontFaceInfo* pFind = NULL; FX_DWORD charset_flag = _LinuxGetCharset(charset); @@ -186,7 +186,7 @@ void* CFX_LinuxFontInfo::FindFont(int weight, FX_BOOL bItalic, int charset, int while (pos) { CFX_ByteString bsName; CFontFaceInfo* pFont = NULL; - m_FontList.GetNextAssoc(pos, bsName, (FX_LPVOID&)pFont); + m_FontList.GetNextAssoc(pos, bsName, (void*&)pFont); if (!(pFont->m_Charsets & charset_flag) && charset != FXFONT_DEFAULT_CHARSET) { continue; } diff --git a/core/src/fxge/ge/fx_ge_path.cpp b/core/src/fxge/ge/fx_ge_path.cpp index 51d5908a81..4ae7b42b39 100644 --- a/core/src/fxge/ge/fx_ge_path.cpp +++ b/core/src/fxge/ge/fx_ge_path.cpp @@ -65,8 +65,8 @@ void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect, FX_RECT mask_rect, CFX_DIBitma } new_dib->Create(m_Box.Width(), m_Box.Height(), FXDIB_8bppMask); for (int row = m_Box.top; row < m_Box.bottom; row ++) { - FX_LPBYTE dest_scan = new_dib->GetBuffer() + new_dib->GetPitch() * (row - m_Box.top); - FX_LPBYTE src_scan = mask_dib->GetBuffer() + mask_dib->GetPitch() * (row - mask_rect.top); + uint8_t* dest_scan = new_dib->GetBuffer() + new_dib->GetPitch() * (row - m_Box.top); + uint8_t* src_scan = mask_dib->GetBuffer() + mask_dib->GetPitch() * (row - mask_rect.top); for (int col = m_Box.left; col < m_Box.right; col ++) { dest_scan[col - m_Box.left] = src_scan[col - mask_rect.left]; } @@ -98,9 +98,9 @@ void CFX_ClipRgn::IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask) new_dib->Create(new_box.Width(), new_box.Height(), FXDIB_8bppMask); const CFX_DIBitmap* old_dib = m_Mask; for (int row = new_box.top; row < new_box.bottom; row ++) { - FX_LPBYTE old_scan = old_dib->GetBuffer() + (row - m_Box.top) * old_dib->GetPitch(); - FX_LPBYTE mask_scan = mask_dib->GetBuffer() + (row - top) * mask_dib->GetPitch(); - FX_LPBYTE new_scan = new_dib->GetBuffer() + (row - new_box.top) * new_dib->GetPitch(); + uint8_t* old_scan = old_dib->GetBuffer() + (row - m_Box.top) * old_dib->GetPitch(); + uint8_t* mask_scan = mask_dib->GetBuffer() + (row - top) * mask_dib->GetPitch(); + uint8_t* new_scan = new_dib->GetBuffer() + (row - new_box.top) * new_dib->GetPitch(); for (int col = new_box.left; col < new_box.right; col ++) { new_scan[col - new_box.left] = old_scan[col - m_Box.left] * mask_scan[col - left] / 255; } diff --git a/core/src/fxge/ge/fx_ge_ps.cpp b/core/src/fxge/ge/fx_ge_ps.cpp index 4ff40211d0..0e25d7e2e8 100644 --- a/core/src/fxge/ge/fx_ge_ps.cpp +++ b/core/src/fxge/ge/fx_ge_ps.cpp @@ -131,7 +131,7 @@ void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData, const CFX_AffineM } } } - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); } void CFX_PSRenderer::SetClip_PathFill(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, @@ -163,7 +163,7 @@ void CFX_PSRenderer::SetClip_PathStroke(const CFX_PathData* pPathData, buf << FX_BSTRC("mx Cm [") << pObject2Device->a << FX_BSTRC(" ") << pObject2Device->b << FX_BSTRC(" ") << pObject2Device->c << FX_BSTRC(" ") << pObject2Device->d << FX_BSTRC(" ") << pObject2Device->e << FX_BSTRC(" ") << pObject2Device->f << FX_BSTRC("]cm "); - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); } OutputPath(pPathData, NULL); CFX_FloatRect rect = pPathData->GetBoundingBox(pGraphState->m_LineWidth, pGraphState->m_MiterLimit); @@ -204,7 +204,7 @@ FX_BOOL CFX_PSRenderer::DrawPath(const CFX_PathData* pPathData, buf << FX_BSTRC("mx Cm [") << pObject2Device->a << FX_BSTRC(" ") << pObject2Device->b << FX_BSTRC(" ") << pObject2Device->c << FX_BSTRC(" ") << pObject2Device->d << FX_BSTRC(" ") << pObject2Device->e << FX_BSTRC(" ") << pObject2Device->f << FX_BSTRC("]cm "); - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); } } OutputPath(pPathData, stroke_alpha ? NULL : pObject2Device); @@ -261,10 +261,10 @@ void CFX_PSRenderer::SetGraphState(const CFX_GraphStateData* pGraphState) m_CurGraphState.Copy(*pGraphState); m_bGraphStateSet = TRUE; if (buf.GetSize()) { - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); } } -static void FaxCompressData(FX_LPBYTE src_buf, int width, int height, FX_LPBYTE& dest_buf, FX_DWORD& dest_size) +static void FaxCompressData(uint8_t* src_buf, int width, int height, uint8_t*& dest_buf, FX_DWORD& dest_size) { CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); if (width * height > 128 && pEncoders && pEncoders->GetFaxModule()->Encode(src_buf, width, height, (width + 7) / 8, dest_buf, dest_size)) { @@ -274,8 +274,8 @@ static void FaxCompressData(FX_LPBYTE src_buf, int width, int height, FX_LPBYTE& dest_size = (width + 7) / 8 * height; } } -static void PSCompressData(int PSLevel, FX_LPBYTE src_buf, FX_DWORD src_size, - FX_LPBYTE& output_buf, FX_DWORD& output_size, FX_LPCSTR& filter) +static void PSCompressData(int PSLevel, uint8_t* src_buf, FX_DWORD src_size, + uint8_t*& output_buf, FX_DWORD& output_size, const FX_CHAR*& filter) { output_buf = src_buf; output_size = src_size; @@ -284,7 +284,7 @@ static void PSCompressData(int PSLevel, FX_LPBYTE src_buf, FX_DWORD src_size, return; } CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); - FX_LPBYTE dest_buf = NULL; + uint8_t* dest_buf = NULL; FX_DWORD dest_size = src_size; if (PSLevel >= 3) { if (pEncoders && pEncoders->GetFlateModule()->Encode(src_buf, src_size, dest_buf, dest_size)) { @@ -348,12 +348,12 @@ 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(uint8_t, src_size); + uint8_t* src_buf = FX_Alloc(uint8_t, src_size); for (int row = 0; row < height; row ++) { - FX_LPCBYTE src_scan = pSource->GetScanline(row); + const uint8_t* src_scan = pSource->GetScanline(row); FXSYS_memcpy32(src_buf + row * pitch, src_scan, pitch); } - FX_LPBYTE output_buf; + uint8_t* output_buf; FX_DWORD output_size; FaxCompressData(src_buf, width, height, output_buf, output_size); if (pSource->IsAlphaMask()) { @@ -373,7 +373,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, } else { buf << FX_BSTRC("false 1 colorimage\n"); } - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); WritePSBinary(output_buf, output_size); FX_Free(output_buf); } else { @@ -409,9 +409,9 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, return FALSE; } int Bpp = pConverted->GetBPP() / 8; - FX_LPBYTE output_buf = NULL; + uint8_t* output_buf = NULL; FX_STRSIZE output_size = 0; - FX_LPCSTR filter = NULL; + const FX_CHAR* filter = NULL; if (flags & FXRENDER_IMAGE_LOSSY) { CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); if (pEncoders && pEncoders->GetJpegModule()->Encode(pConverted, output_buf, output_size)) { @@ -423,8 +423,8 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, output_size = height * src_pitch; 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; + const uint8_t* src_scan = pConverted->GetScanline(row); + uint8_t* dest_scan = output_buf + row * src_pitch; if (Bpp == 3) { for (int col = 0; col < width; col ++) { *dest_scan++ = src_scan[2]; @@ -436,7 +436,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, FXSYS_memcpy32(dest_scan, src_scan, src_pitch); } } - FX_LPBYTE compressed_buf; + uint8_t* compressed_buf; FX_DWORD compressed_size; PSCompressData(m_PSLevel, output_buf, output_size, compressed_buf, compressed_size, filter); if (output_buf != compressed_buf) { @@ -457,7 +457,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, FX_DWORD color, } buf << FX_BSTRC("false ") << Bpp; buf << FX_BSTRC(" colorimage\n"); - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); WritePSBinary(output_buf, output_size); FX_Free(output_buf); } @@ -473,7 +473,7 @@ void CFX_PSRenderer::SetColor(FX_DWORD color, int alpha_flag, void* pIccTransfor if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); color = FXGETFLAG_COLORTYPE(alpha_flag) ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); - FX_LPBYTE pColor = (FX_LPBYTE)&color; + uint8_t* pColor = (uint8_t*)&color; pIccModule->TranslateScanline(pIccTransform, pColor, pColor, 1); color = m_bCmykOutput ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); bCMYK = m_bCmykOutput; @@ -493,7 +493,7 @@ void CFX_PSRenderer::SetColor(FX_DWORD color, int alpha_flag, void* pIccTransfor m_bColorSet = TRUE; m_LastColor = color; } - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); } } void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache, CFX_Font* pFont, const FXTEXT_CHARPOS& charpos, @@ -530,7 +530,7 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache, CFX_Font* pFont, "/BuildChar{1 index/Encoding get exch get 1 index/BuildGlyph get exec}bind def\n" "currentdict end\n"); buf << FX_BSTRC("/X") << m_PSFontList.GetSize() - 1 << FX_BSTRC(" exch definefont pop\n"); - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); buf.Clear(); } ps_fontnum = m_PSFontList.GetSize() - 1; @@ -589,7 +589,7 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache, CFX_Font* pFont, buf << FX_BSTRC("}bind def end\n"); buf << FX_BSTRC("/X") << ps_fontnum << FX_BSTRC(" Ff/Encoding get ") << ps_glyphindex << FX_BSTRC("/") << ps_glyphindex << FX_BSTRC(" put\n"); - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); } FX_BOOL CFX_PSRenderer::DrawText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, @@ -630,18 +630,18 @@ FX_BOOL CFX_PSRenderer::DrawText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX buf << hex << FX_BSTRC("Tj\n"); } buf << FX_BSTRC("Q\n"); - m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); + m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); return TRUE; } -void CFX_PSRenderer::WritePSBinary(FX_LPCBYTE data, int len) +void CFX_PSRenderer::WritePSBinary(const uint8_t* data, int len) { - FX_LPBYTE dest_buf; + uint8_t* dest_buf; FX_DWORD dest_size; CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); if (pEncoders && pEncoders->GetBasicModule()->A85Encode(data, len, dest_buf, dest_size)) { - m_pOutput->OutputPS((FX_LPCSTR)dest_buf, dest_size); + m_pOutput->OutputPS((const FX_CHAR*)dest_buf, dest_size); FX_Free(dest_buf); } else { - m_pOutput->OutputPS((FX_LPCSTR)data, len); + m_pOutput->OutputPS((const FX_CHAR*)data, len); } } diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp index 1aabbedd5b..151b7099a5 100644 --- a/core/src/fxge/ge/fx_ge_text.cpp +++ b/core/src/fxge/ge/fx_ge_text.cpp @@ -111,7 +111,7 @@ void _Color2Argb(FX_ARGB& argb, FX_DWORD color, int alpha_flag, void* pIccTransf if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); color = FXGETFLAG_COLORTYPE(alpha_flag) ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); - pIccModule->TranslateScanline(pIccTransform, bgra, (FX_LPCBYTE)&color, 1); + pIccModule->TranslateScanline(pIccTransform, bgra, (const uint8_t*)&color, 1); bgra[3] = FXGETFLAG_COLORTYPE(alpha_flag) ? (alpha_flag >> 24) ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXGETFLAG_ALPHA_STROKE(alpha_flag) : FXARGB_A(color); @@ -294,7 +294,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar } } int dest_width = pixel_width; - FX_LPBYTE dest_buf = bitmap.GetBuffer(); + uint8_t* dest_buf = bitmap.GetBuffer(); int dest_pitch = bitmap.GetPitch(); int Bpp = bitmap.GetBPP() / 8; int a, r, g, b; @@ -326,7 +326,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar FX_BOOL bBGRStripe = text_flags & FXTEXT_BGR_STRIPE; ncols /= 3; int x_subpixel = (int)(glyph.m_fOriginX * 3) % 3; - FX_LPBYTE src_buf = pGlyph->GetBuffer(); + uint8_t* src_buf = pGlyph->GetBuffer(); int src_pitch = pGlyph->GetPitch(); int start_col = left; if (start_col < 0) { @@ -345,8 +345,8 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar if (dest_row < 0 || dest_row >= bitmap.GetHeight()) { continue; } - FX_LPBYTE src_scan = src_buf + row * src_pitch + (start_col - left) * 3; - FX_LPBYTE dest_scan = dest_buf + dest_row * dest_pitch + (start_col << 2); + uint8_t* src_scan = src_buf + row * src_pitch + (start_col - left) * 3; + uint8_t* dest_scan = dest_buf + dest_row * dest_pitch + (start_col << 2); if (bBGRStripe) { if (x_subpixel == 0) { for (int col = start_col; col < end_col; col ++) { @@ -658,8 +658,8 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar if (dest_row < 0 || dest_row >= bitmap.GetHeight()) { continue; } - FX_LPBYTE src_scan = src_buf + row * src_pitch + (start_col - left) * 3; - FX_LPBYTE dest_scan = dest_buf + dest_row * dest_pitch + start_col * Bpp; + uint8_t* src_scan = src_buf + row * src_pitch + (start_col - left) * 3; + uint8_t* dest_scan = dest_buf + dest_row * dest_pitch + start_col * Bpp; if (bBGRStripe) { if (x_subpixel == 0) { for (int col = start_col; col < end_col; col ++) { @@ -1052,10 +1052,10 @@ CFX_FaceCache::~CFX_FaceCache() } m_SizeMap.RemoveAll(); pos = m_PathMap.GetStartPosition(); - FX_LPVOID key1; + void* key1; CFX_PathData* pPath; while (pos) { - m_PathMap.GetNextAssoc(pos, key1, (FX_LPVOID&)pPath); + m_PathMap.GetNextAssoc(pos, key1, (void*&)pPath); delete pPath; } if (m_pBitmap) { @@ -1081,14 +1081,14 @@ CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap(CFX_Font* pFont, const CFX_Aff m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); } CFX_GlyphBitmap* pGlyphBitmap = NULL; - if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(uintptr_t)glyph_index, (void*&)pGlyphBitmap)) { + if (pSizeCache->m_GlyphMap.Lookup((void*)(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)(uintptr_t)glyph_index, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap); return pGlyphBitmap; } const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD glyph_index, FX_BOOL bFontStyle, const CFX_AffineMatrix* pMatrix, @@ -1135,12 +1135,12 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD CFX_GlyphBitmap* pGlyphBitmap; CFX_SizeGlyphCache* pSizeCache = NULL; if (m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) { - if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(uintptr_t)glyph_index, (void*&)pGlyphBitmap)) { + if (pSizeCache->m_GlyphMap.Lookup((void*)(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)(uintptr_t)glyph_index, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap); return pGlyphBitmap; } } else { @@ -1151,7 +1151,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD return NULL; } m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); - pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)glyph_index, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap); return pGlyphBitmap; } } @@ -1171,7 +1171,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD CFX_SizeGlyphCache::~CFX_SizeGlyphCache() { FX_POSITION pos = m_GlyphMap.GetStartPosition(); - FX_LPVOID Key; + void* Key; CFX_GlyphBitmap* pGlyphBitmap = NULL; while(pos) { m_GlyphMap.GetNextAssoc(pos, Key, (void*&)pGlyphBitmap); @@ -1245,20 +1245,20 @@ static const uint8_t g_WeightPow_SHIFTJIS[WEIGHTPOW_ARRAY_SIZE] = { 55, 55, 55, 56, 56, 56, 56, 56 , 56, 57, 57, 57 , 57 , 57, 57, 57, 58, 58, 58, 58, 58, 58, 58, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 60, }; -static void _GammaAdjust(FX_LPBYTE pData, int nWid, int nHei, int src_pitch, FX_LPCBYTE gammaTable) +static void _GammaAdjust(uint8_t* pData, int nWid, int nHei, int src_pitch, const uint8_t* gammaTable) { int count = nHei * src_pitch; for(int i = 0; i < count; i++) { pData[i] = gammaTable[pData[i]]; } } -static void _ContrastAdjust(FX_LPBYTE pDataIn, FX_LPBYTE pDataOut, int nWid, int nHei, int nSrcRowBytes, int nDstRowBytes) +static void _ContrastAdjust(uint8_t* pDataIn, uint8_t* pDataOut, int nWid, int nHei, int nSrcRowBytes, int nDstRowBytes) { int col, row, temp; int max = 0, min = 255; FX_FLOAT rate; for (row = 0; row < nHei; row ++) { - FX_LPBYTE pRow = pDataIn + row * nSrcRowBytes; + uint8_t* pRow = pDataIn + row * nSrcRowBytes; for (col = 0; col < nWid; col++) { temp = *pRow ++; if (temp > max) { @@ -1279,8 +1279,8 @@ static void _ContrastAdjust(FX_LPBYTE pDataIn, FX_LPBYTE pDataOut, int nWid, int } rate = 255.f / temp; for (row = 0; row < nHei; row ++) { - FX_LPBYTE pSrcRow = pDataIn + row * nSrcRowBytes; - FX_LPBYTE pDstRow = pDataOut + row * nDstRowBytes; + uint8_t* pSrcRow = pDataIn + row * nSrcRowBytes; + uint8_t* pDstRow = pDataOut + row * nDstRowBytes; for (col = 0; col < nWid; col ++) { temp = (int)((*(pSrcRow++) - min) * rate + 0.5); if (temp > 255) { @@ -1423,15 +1423,15 @@ FX_BOOL _OutputGlyph(void* dib, int x, int y, CFX_Font* pFont, int bmheight = FXFT_Get_Bitmap_Rows(FXFT_Get_Glyph_Bitmap(face)); int left = FXFT_Get_Glyph_BitmapLeft(face); int top = FXFT_Get_Glyph_BitmapTop(face); - FX_LPCBYTE src_buf = (FX_LPCBYTE)FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(face)); + const uint8_t* src_buf = (const uint8_t*)FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(face)); int src_pitch = FXFT_Get_Bitmap_Pitch(FXFT_Get_Glyph_Bitmap(face)); CFX_DIBitmap mask; mask.Create(bmwidth, bmheight, FXDIB_8bppMask); - FX_LPBYTE dest_buf = mask.GetBuffer(); + uint8_t* dest_buf = mask.GetBuffer(); int dest_pitch = mask.GetPitch(); for (int row = 0; row < bmheight; row ++) { - FX_LPCBYTE src_scan = src_buf + row * src_pitch; - FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; + const uint8_t* src_scan = src_buf + row * src_pitch; + uint8_t* dest_scan = dest_buf + row * dest_pitch; FXSYS_memcpy32(dest_scan, src_scan, dest_pitch); } pDib->CompositeMask(x + left, y - top, bmwidth, bmheight, &mask, argb, 0, 0); @@ -1499,15 +1499,15 @@ const CFX_PathData* CFX_FaceCache::LoadGlyphPath(CFX_Font* pFont, FX_DWORD glyph return NULL; } CFX_PathData* pGlyphPath = NULL; - FX_LPVOID key; + void* key; if (pFont->GetSubstFont()) - key = (FX_LPVOID)(uintptr_t)(glyph_index + ((pFont->GetSubstFont()->m_Weight / 16) << 15) + + key = (void*)(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)(uintptr_t)glyph_index; + key = (void*)(uintptr_t)glyph_index; } - if (m_PathMap.Lookup(key, (FX_LPVOID&)pGlyphPath)) { + if (m_PathMap.Lookup(key, (void*&)pGlyphPath)) { return pGlyphPath; } pGlyphPath = pFont->LoadGlyphPath(glyph_index, dest_width); diff --git a/core/src/fxge/ge/text_int.h b/core/src/fxge/ge/text_int.h index 39f6cb8567..bcc2b05042 100644 --- a/core/src/fxge/ge/text_int.h +++ b/core/src/fxge/ge/text_int.h @@ -106,7 +106,7 @@ class CFX_FontEncodingEX : public IFX_FontEncodingEx public:
CFX_FontEncodingEX();
FX_BOOL Init(CFX_Font* pFont, FX_DWORD EncodingID);
- virtual FX_DWORD GlyphIndexFromName(FX_LPCSTR pStrName);
+ virtual FX_DWORD GlyphIndexFromName(const FX_CHAR* pStrName);
virtual CFX_ByteString NameFromGlyphIndex(FX_DWORD dwGlyphIndex);
virtual FX_DWORD CharCodeFromGlyphIndex(FX_DWORD dwGlyphIndex);
virtual FX_DWORD GlyphFromCharCode(FX_DWORD charcode);
diff --git a/core/src/fxge/skia/fx_skia_blitter_new.cpp b/core/src/fxge/skia/fx_skia_blitter_new.cpp index 3b3bd3349c..362e8bf59f 100644 --- a/core/src/fxge/skia/fx_skia_blitter_new.cpp +++ b/core/src/fxge/skia/fx_skia_blitter_new.cpp @@ -73,10 +73,10 @@ blitV(x, y, height, rightAlpha); } /*---------------------------------------------------------------------------------------------------*/ - void CFX_SkiaRenderer::CompositeSpan1bpp_0(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpan1bpp_0(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_bRgbByteOrder); ASSERT(!m_pDevice->IsCmykImage()); @@ -94,7 +94,7 @@ if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) index = i; } - FX_LPBYTE dest_scan1 = dest_scan; + uint8_t* dest_scan1 = dest_scan; int src_alpha = m_Alpha * cover_scan / 255; for (int col = col_start; col < col_end; col ++) { if (src_alpha) { @@ -106,10 +106,10 @@ dest_scan1 = dest_scan+(span_left%8+col-col_start+1)/8; } } - void CFX_SkiaRenderer::CompositeSpan1bpp_4(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpan1bpp_4(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_bRgbByteOrder); ASSERT(!m_pDevice->IsCmykImage()); @@ -128,7 +128,7 @@ if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) index = i; } - FX_LPBYTE dest_scan1 = dest_scan; + uint8_t* dest_scan1 = dest_scan; int src_alpha = m_Alpha * cover_scan / 255; for (int col = col_start; col < col_end; col ++) { int src_alpha1 = src_alpha * clip_scan[col] / 255; @@ -142,10 +142,10 @@ } } /*-----------------------------------------------------------------------------------------------------*/ - void CFX_SkiaRenderer::CompositeSpanGray_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanGray_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); ASSERT(!m_bRgbByteOrder); @@ -164,10 +164,10 @@ dest_scan++; } } - void CFX_SkiaRenderer::CompositeSpanGray_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanGray_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); ASSERT(!m_bRgbByteOrder); @@ -207,10 +207,10 @@ } } - void CFX_SkiaRenderer::CompositeSpanGray_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanGray_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_bRgbByteOrder); dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left; @@ -235,10 +235,10 @@ } } - void CFX_SkiaRenderer::CompositeSpanGray_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanGray_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left; @@ -295,10 +295,10 @@ } /*--------------------------------------------------------------------------------------------------*/ - void CFX_SkiaRenderer::CompositeSpanARGB_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanARGB_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); int col_start = span_left < clip_left ? clip_left - span_left : 0; @@ -343,10 +343,10 @@ } } - void CFX_SkiaRenderer::CompositeSpanARGB_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanARGB_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); @@ -392,10 +392,10 @@ dest_scan += 2; } } - void CFX_SkiaRenderer::CompositeSpanARGB_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanARGB_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { 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; @@ -507,10 +507,10 @@ #endif } - void CFX_SkiaRenderer::CompositeSpanARGB_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanARGB_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); @@ -557,10 +557,10 @@ } /*-----------------------------------------------------------------------------------------------------------*/ - void CFX_SkiaRenderer::CompositeSpanRGB32_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanRGB32_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); int col_start = span_left < clip_left ? clip_left - span_left : 0; @@ -588,10 +588,10 @@ dest_scan += 2; } } - void CFX_SkiaRenderer::CompositeSpanRGB32_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanRGB32_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left<<2); @@ -627,10 +627,10 @@ dest_scan += 2; } } - void CFX_SkiaRenderer::CompositeSpanRGB32_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanRGB32_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { 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; @@ -705,10 +705,10 @@ } #endif } - void CFX_SkiaRenderer::CompositeSpanRGB32_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanRGB32_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2); @@ -784,10 +784,10 @@ #endif } /*-----------------------------------------------------------------------------------------------------*/ - void CFX_SkiaRenderer::CompositeSpanRGB24_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanRGB24_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { 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; @@ -818,10 +818,10 @@ dest_scan ++; } } - void CFX_SkiaRenderer::CompositeSpanRGB24_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanRGB24_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left + (span_left<<1); @@ -859,10 +859,10 @@ dest_scan ++; } } - void CFX_SkiaRenderer::CompositeSpanRGB24_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanRGB24_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { 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; @@ -939,10 +939,10 @@ } #endif } - void CFX_SkiaRenderer::CompositeSpanRGB24_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanRGB24_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_pDevice->IsCmykImage()); dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1); @@ -1017,10 +1017,10 @@ } #endif } - void CFX_SkiaRenderer::CompositeSpanRGB24_10(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanRGB24_10(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { 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; @@ -1106,10 +1106,10 @@ } #endif } - void CFX_SkiaRenderer::CompositeSpanRGB24_14(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CFX_SkiaRenderer::CompositeSpanRGB24_14(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { 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; @@ -1211,10 +1211,10 @@ /*-----------------------------------------------------------------------------------------------------*/ // 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, + void CFX_SkiaRenderer::CompositeSpanCMYK(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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) + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan) { ASSERT(!m_bRgbByteOrder); // Cmyk(a) @@ -1353,7 +1353,7 @@ if (pIccTransform) { uint8_t gray; color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); - pIccModule->TranslateScanline(pIccTransform, &gray, (FX_LPCBYTE)&color, 1); + pIccModule->TranslateScanline(pIccTransform, &gray, (const uint8_t*)&color, 1); m_Gray = gray; } else { if (bObjectCMYK) { @@ -1374,31 +1374,31 @@ if (bObjectCMYK) { m_Color = FXCMYK_TODIB(color); if (pIccTransform) - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&m_Color, (FX_LPCBYTE)&m_Color, 1); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&m_Color, 1); } else { // Object RGB if (!pIccTransform) return FALSE; color = FXARGB_TODIB(color); - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&m_Color, (FX_LPCBYTE)&color, 1); + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&color, 1); } - m_Red = ((FX_LPBYTE)&m_Color)[0]; - m_Green = ((FX_LPBYTE)&m_Color)[1]; - m_Blue = ((FX_LPBYTE)&m_Color)[2]; - m_Gray = ((FX_LPBYTE)&m_Color)[3]; + m_Red = ((uint8_t*)&m_Color)[0]; + m_Green = ((uint8_t*)&m_Color)[1]; + m_Blue = ((uint8_t*)&m_Color)[2]; + m_Gray = ((uint8_t*)&m_Color)[3]; return TRUE; } else { if (pIccTransform) { color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); - pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&m_Color, (FX_LPCBYTE)&color, 1); - ((FX_LPBYTE)&m_Color)[3] = m_Alpha; - m_Red = ((FX_LPBYTE)&m_Color)[2]; - m_Green = ((FX_LPBYTE)&m_Color)[1]; - m_Blue = ((FX_LPBYTE)&m_Color)[0]; + pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&color, 1); + ((uint8_t*)&m_Color)[3] = m_Alpha; + m_Red = ((uint8_t*)&m_Color)[2]; + m_Green = ((uint8_t*)&m_Color)[1]; + m_Blue = ((uint8_t*)&m_Color)[0]; // Need Johnson to improvement it. if (m_bRgbByteOrder) { // swap - m_Red = ((FX_LPBYTE)&m_Color)[0]; - m_Blue = ((FX_LPBYTE)&m_Color)[2]; + m_Red = ((uint8_t*)&m_Color)[0]; + m_Blue = ((uint8_t*)&m_Color)[2]; m_Color = FXARGB_TODIB(m_Color); m_Color = FXARGB_TOBGRORDERDIB(m_Color); } @@ -1509,8 +1509,8 @@ if (dst_y < 0 || dst_y >= m_pDevice->GetHeight()) return; - FX_LPBYTE dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * dst_y; - FX_LPBYTE dest_pos = dest_scan; + uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * dst_y; + uint8_t* dest_pos = dest_scan; while (1) { if (x >= m_dstWidth) @@ -1546,7 +1546,7 @@ return; if (x >= m_dstWidth) return; - FX_LPBYTE dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * dst_y; + uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * dst_y; int col_start = x < m_Left ? 0 : x - m_Left; int col_end = x + width; col_end = col_end < m_dstWidth ? col_end - m_Left: m_pDevice->GetWidth(); diff --git a/core/src/fxge/skia/fx_skia_blitter_new.h b/core/src/fxge/skia/fx_skia_blitter_new.h index a80e56b2aa..8372ca3355 100644 --- a/core/src/fxge/skia/fx_skia_blitter_new.h +++ b/core/src/fxge/skia/fx_skia_blitter_new.h @@ -25,12 +25,12 @@ protected: const CFX_ClipRgn* m_pClipRgn; const CFX_DIBitmap* m_pClipMask; - FX_LPBYTE m_pDestScan; - FX_LPBYTE m_pDestExtraAlphaScan; - FX_LPBYTE m_pOriScan; - FX_LPBYTE m_pClipScan; + uint8_t* m_pDestScan; + uint8_t* m_pDestExtraAlphaScan; + uint8_t* m_pOriScan; + uint8_t* m_pClipScan; - void (CFX_SkiaRenderer::*composite_span)(FX_LPBYTE,FX_LPBYTE,int,int,int,int,uint8_t,int,int,int,FX_LPBYTE,FX_LPBYTE); + void (CFX_SkiaRenderer::*composite_span)(uint8_t*,uint8_t*,int,int,int,int,uint8_t,int,int,int,uint8_t*,uint8_t*); public: //-------------------------------------------------------------------- @@ -42,166 +42,166 @@ public: /*------------------------------------------------------------------------------------------------------*/ // A general alpha merge function (with clipping mask). Gray device. - void CompositeSpan1bpp_0(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpan1bpp_0(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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 clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpan1bpp_1(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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 clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpan1bpp_4(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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 clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpan1bpp_5(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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 clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpan1bpp_8(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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 clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpan1bpp_9(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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 clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpan1bpp_12(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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 clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpan1bpp_13(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); /*--------------------------------------------------------------------------------------------------------*/ // A general alpha merge function (with clipping mask). Gray device. - void CompositeSpanGray_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanGray_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); - void CompositeSpanGray_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanGray_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); - void CompositeSpanGray_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanGray_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); - void CompositeSpanGray_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanGray_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); - void CompositeSpanGray_10(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanGray_10(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); - void CompositeSpanGray_11(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanGray_11(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); - void CompositeSpanGray_14(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanGray_14(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); - void CompositeSpanGray_15(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanGray_15(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); /*--------------------------------------------------------------------------------------------------------*/ - void CompositeSpanARGB_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanARGB_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); - void CompositeSpanARGB_3(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanARGB_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); - void CompositeSpanARGB_6(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanARGB_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); - void CompositeSpanARGB_7(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanARGB_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); // ... /*--------------------------------------------------------------------------------------------------------*/ - void CompositeSpanRGB32_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanRGB32_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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 clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpanRGB32_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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 clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpanRGB32_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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 clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpanRGB32_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); /*---------------------------------------------------------------------------------------------------------*/ - void CompositeSpanRGB24_2(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanRGB24_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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 clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpanRGB24_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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 clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpanRGB24_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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 clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpanRGB24_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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 clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpanRGB24_10(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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 clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpanRGB24_11(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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 clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpanRGB24_14(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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 clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); + void CompositeSpanRGB24_15(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); /*----------------------------------------------------------------------------------------------------------*/ // A general alpha merge function (with clipping mask). Cmyka/Cmyk device. - void CompositeSpanCMYK(FX_LPBYTE dest_scan, FX_LPBYTE ori_scan,int Bpp, + void CompositeSpanCMYK(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 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); + int clip_top, int clip_left, int clip_right, uint8_t* clip_scan, + uint8_t* dest_extra_alpha_scan); //-------------------------------------------------------------------- diff --git a/core/src/fxge/skia/fx_skia_device.cpp b/core/src/fxge/skia/fx_skia_device.cpp index 00c981c9e8..cc9730b49f 100644 --- a/core/src/fxge/skia/fx_skia_device.cpp +++ b/core/src/fxge/skia/fx_skia_device.cpp @@ -478,19 +478,19 @@ FX_BOOL CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWO } FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_alpha, FX_DWORD argb, - const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform) { return m_pAggDriver->StartDIBits(pSource, bitmap_alpha, argb, pMatrix, render_flags, handle, alpha_flag, pIccTransform); } -FX_BOOL CFX_SkiaDeviceDriver::ContinueDIBits(FX_LPVOID pHandle, IFX_Pause* pPause) +FX_BOOL CFX_SkiaDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) { return m_pAggDriver->ContinueDIBits(pHandle, pPause); } -void CFX_SkiaDeviceDriver::CancelDIBits(FX_LPVOID pHandle) +void CFX_SkiaDeviceDriver::CancelDIBits(void* pHandle) { m_pAggDriver->CancelDIBits(pHandle); } diff --git a/core/src/fxge/skia/fx_skia_device.h b/core/src/fxge/skia/fx_skia_device.h index 7ae019c124..582b844fb9 100644 --- a/core/src/fxge/skia/fx_skia_device.h +++ b/core/src/fxge/skia/fx_skia_device.h @@ -67,10 +67,10 @@ public: int alpha_flag = 0, void* pIccTransform = NULL); virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, - const CFX_AffineMatrix* pMatrix, FX_DWORD flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD flags, void*& handle, int alpha_flag = 0, void* pIccTransform = NULL); - virtual FX_BOOL ContinueDIBits(FX_LPVOID handle, IFX_Pause* pPause); - virtual void CancelDIBits(FX_LPVOID handle); + virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause); + virtual void CancelDIBits(void* handle); virtual FX_BOOL DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FIXFLOAT font_size, FX_DWORD color, @@ -82,7 +82,7 @@ public: int alpha_flag, void* pIccTransform, FX_BOOL bFill = TRUE); void SetClipMask(rasterizer_scanline_aa& rasterizer); void SetClipMask(SkPath& skPath, SkPaint* spaint); - virtual FX_LPBYTE GetBuffer() const {return m_pAggDriver->GetBuffer();} + virtual uint8_t* GetBuffer() const {return m_pAggDriver->GetBuffer();} CFX_AggDeviceDriver* m_pAggDriver; }; diff --git a/core/src/fxge/win32/dwrite_int.h b/core/src/fxge/win32/dwrite_int.h index d95f115fbc..4192fb74ae 100644 --- a/core/src/fxge/win32/dwrite_int.h +++ b/core/src/fxge/win32/dwrite_int.h @@ -40,7 +40,7 @@ public: return m_pDWriteFactory != NULL; } - void* DwCreateFontFaceFromStream(FX_LPBYTE pData, FX_DWORD size, int simulation_style); + void* DwCreateFontFaceFromStream(uint8_t* pData, FX_DWORD size, int simulation_style); FX_BOOL DwCreateRenderingTarget(CFX_DIBitmap* pSrc, void** renderTarget); void DwDeleteRenderingTarget(void* renderTarget); FX_BOOL DwRendingString(void* renderTarget, CFX_ClipRgn* pClipRgn, FX_RECT& stringRect, CFX_AffineMatrix* pMatrix, diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp index 7ebdcb380e..5fb9036381 100644 --- a/core/src/fxge/win32/fx_win32_device.cpp +++ b/core/src/fxge/win32/fx_win32_device.cpp @@ -23,12 +23,12 @@ public: ~CWin32FontInfo(); virtual void Release(); virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper); - virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR face, FX_BOOL& bExact); - virtual void* GetFont(FX_LPCSTR face) + virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact); + virtual void* GetFont(const FX_CHAR* face) { return NULL; } - virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffer, FX_DWORD size); + virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer, FX_DWORD size); virtual void DeleteFont(void* hFont); virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name); virtual FX_BOOL GetFontCharset(void* hFont, int& charset); @@ -152,15 +152,15 @@ FX_BOOL CWin32FontInfo::EnumFontList(CFX_FontMapper* pMapper) return TRUE; } static const struct { - FX_LPCSTR m_pFaceName; - FX_LPCSTR m_pVariantName; + const FX_CHAR* m_pFaceName; + const FX_CHAR* m_pVariantName; } VariantNames[] = { {"DFKai-SB", "\x19\x6A\x77\x69\xD4\x9A"}, }; static const struct { - FX_LPCSTR m_pName; - FX_LPCSTR m_pWinName; + const FX_CHAR* m_pName; + const FX_CHAR* m_pWinName; FX_BOOL m_bBold; FX_BOOL m_bItalic; } @@ -197,8 +197,8 @@ CFX_ByteString CWin32FontInfo::FindFont(const CFX_ByteString& name) return CFX_ByteString(); } struct _FontNameMap { - FX_LPCSTR m_pSubFontName; - FX_LPCSTR m_pSrcFontName; + const FX_CHAR* m_pSubFontName; + const FX_CHAR* m_pSrcFontName; }; const _FontNameMap g_JpFontNameMap[] = { {"MS Mincho", "Heiseimin-W3"}, @@ -207,7 +207,7 @@ const _FontNameMap g_JpFontNameMap[] = { extern "C" { static int compareString(const void* key, const void* element) { - return FXSYS_stricmp((FX_LPCSTR)key, ((_FontNameMap*)element)->m_pSrcFontName); + return FXSYS_stricmp((const FX_CHAR*)key, ((_FontNameMap*)element)->m_pSrcFontName); } } FX_BOOL _GetSubFontName(CFX_ByteString& name) @@ -282,7 +282,7 @@ void CWin32FontInfo::GetJapanesePreference(CFX_ByteString& face, int weight, int face = "MS PMincho"; } } -void* CWin32FontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR cstr_face, FX_BOOL& bExact) +void* CWin32FontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* cstr_face, FX_BOOL& bExact) { CFX_ByteString face = cstr_face; int iBaseFont; @@ -359,7 +359,7 @@ void CWin32FontInfo::DeleteFont(void* hFont) { ::DeleteObject(hFont); } -FX_DWORD CWin32FontInfo::GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffer, FX_DWORD size) +FX_DWORD CWin32FontInfo::GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer, FX_DWORD size) { HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont); table = FXDWORD_FROM_MSBFIRST(table); @@ -459,14 +459,14 @@ int CGdiDeviceDriver::GetDeviceCaps(int caps_id) } return 0; } -FX_LPVOID CGdiDeviceDriver::GetClipRgn() +void* CGdiDeviceDriver::GetClipRgn() { HRGN hClipRgn = CreateRectRgn(0, 0, 1, 1); if (::GetClipRgn(m_hDC, hClipRgn) == 0) { DeleteObject(hClipRgn); hClipRgn = NULL; } - return (FX_LPVOID)hClipRgn; + return (void*)hClipRgn; } FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(const CFX_DIBitmap* pBitmap1, const FX_RECT* pSrcRect, int left, int top, void* pIccTransform) { @@ -600,7 +600,7 @@ BOOL CGdiDeviceDriver::GetClipBox(FX_RECT* pRect) { return ::GetClipBox(m_hDC, (RECT*)pRect); } -FX_BOOL CGdiDeviceDriver::SetClipRgn(FX_LPVOID hRgn) +FX_BOOL CGdiDeviceDriver::SetClipRgn(void* hRgn) { ::SelectClipRgn(m_hDC, (HRGN)hRgn); return TRUE; @@ -930,7 +930,7 @@ FX_BOOL CGdiDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2 DeleteObject(hPen); return TRUE; } -FX_BOOL CGdiDeviceDriver::DeleteDeviceRgn(FX_LPVOID pRgn) +FX_BOOL CGdiDeviceDriver::DeleteDeviceRgn(void* pRgn) { DeleteObject((HGDIOBJ)pRgn); return TRUE; @@ -1182,8 +1182,8 @@ CFX_WinBitmapDevice::CFX_WinBitmapDevice(int width, int height, FXDIB_Format for bmih.biHeight = -height; bmih.biPlanes = 1; bmih.biWidth = width; - FX_LPBYTE pBuffer; - m_hBitmap = CreateDIBSection(NULL, (BITMAPINFO*)&bmih, DIB_RGB_COLORS, (FX_LPVOID*)&pBuffer, NULL, 0); + uint8_t* pBuffer; + m_hBitmap = CreateDIBSection(NULL, (BITMAPINFO*)&bmih, DIB_RGB_COLORS, (void**)&pBuffer, NULL, 0); if (m_hBitmap == NULL) { return; } diff --git a/core/src/fxge/win32/fx_win32_dib.cpp b/core/src/fxge/win32/fx_win32_dib.cpp index 7706ee289e..a3ec5cd6f0 100644 --- a/core/src/fxge/win32/fx_win32_dib.cpp +++ b/core/src/fxge/win32/fx_win32_dib.cpp @@ -71,7 +71,7 @@ CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, LPVOID pData, FX_BOOL } FXSYS_memcpy32(pBitmap->GetBuffer(), pData, pitch * height); if (bBottomUp) { - FX_LPBYTE temp_buf = FX_Alloc(uint8_t, pitch); + uint8_t* 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); @@ -113,7 +113,7 @@ void GetBitmapSize(HBITMAP hBitmap, int& w, int& h) w = bmp.bmWidth; h = bmp.bmHeight; } -CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(FX_LPCWSTR filename) +CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(const FX_WCHAR* filename) { CWin32Platform* pPlatform = (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData(); if (pPlatform->m_GdiplusExt.IsAvailable()) { @@ -267,7 +267,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC, HBITMAP hBitmap, FX_DWORD* pP } CFX_WindowsDIB::CFX_WindowsDIB(HDC hDC, int width, int height) { - Create(width, height, FXDIB_Rgb, (FX_LPBYTE)1); + Create(width, height, FXDIB_Rgb, (uint8_t*)1); BITMAPINFOHEADER bmih; FXSYS_memset32(&bmih, 0, sizeof bmih); bmih.biSize = sizeof bmih; diff --git a/core/src/fxge/win32/fx_win32_dwrite.cpp b/core/src/fxge/win32/fx_win32_dwrite.cpp index 2a490a62a4..ffecc0de72 100644 --- a/core/src/fxge/win32/fx_win32_dwrite.cpp +++ b/core/src/fxge/win32/fx_win32_dwrite.cpp @@ -129,7 +129,7 @@ CDWriteExt::~CDWriteExt() { Unload(); } -LPVOID CDWriteExt::DwCreateFontFaceFromStream(FX_LPBYTE pData, FX_DWORD size, int simulation_style) +LPVOID CDWriteExt::DwCreateFontFaceFromStream(uint8_t* pData, FX_DWORD size, int simulation_style) { IDWriteFactory* pDwFactory = (IDWriteFactory*)m_pDWriteFactory; IDWriteFontFile* pDwFontFile = NULL; @@ -440,7 +440,7 @@ STDMETHODIMP CDwGdiTextRenderer::DrawGlyphRun( bitmap.bmWidth, bitmap.bmHeight, bitmap.bmBitsPixel == 24 ? FXDIB_Rgb : FXDIB_Rgb32, - (FX_LPBYTE)bitmap.bmBits + (uint8_t*)bitmap.bmBits ); dib.CompositeBitmap( text_bbox.left, diff --git a/core/src/fxge/win32/fx_win32_gdipext.cpp b/core/src/fxge/win32/fx_win32_gdipext.cpp index fd31d2da66..68a27ab38f 100644 --- a/core/src/fxge/win32/fx_win32_gdipext.cpp +++ b/core/src/fxge/win32/fx_win32_gdipext.cpp @@ -352,7 +352,7 @@ static void OutputImageMask(GpGraphics* pGraphics, BOOL bMonoDevice, const CFX_D CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; int src_width = pBitmap->GetWidth(), src_height = pBitmap->GetHeight(); int src_pitch = pBitmap->GetPitch(); - FX_LPBYTE scan0 = pBitmap->GetBuffer(); + uint8_t* scan0 = pBitmap->GetBuffer(); if (src_width == 1 && src_height == 1) { if ((scan0[0] & 0x80) == 0) { return; @@ -433,7 +433,7 @@ static void OutputImage(GpGraphics* pGraphics, const CFX_DIBitmap* pBitmap, cons return; } int src_pitch = pBitmap->GetPitch(); - FX_LPBYTE scan0 = pBitmap->GetBuffer() + pSrcRect->top * src_pitch + pBitmap->GetBPP() * pSrcRect->left / 8; + uint8_t* scan0 = pBitmap->GetBuffer() + pSrcRect->top * src_pitch + pBitmap->GetBPP() * pSrcRect->left / 8; GpBitmap* bitmap = NULL; switch (pBitmap->GetFormat()) { case FXDIB_Argb: @@ -572,7 +572,7 @@ FX_BOOL CGdiplusExt::GdipCreateFromImage(void* bitmap, void** graphics) } return FALSE; } -FX_BOOL CGdiplusExt::GdipCreateFontFamilyFromName(FX_LPCWSTR name, void* pFontCollection, void**pFamily) +FX_BOOL CGdiplusExt::GdipCreateFontFamilyFromName(const FX_WCHAR* name, void* pFontCollection, void**pFamily) { CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; GpStatus status = CallFunc(GdipCreateFontFamilyFromName)((GDIPCONST WCHAR *)name, (GpFontCollection*)pFontCollection, (GpFontFamily**)pFamily); diff --git a/core/src/fxge/win32/fx_win32_print.cpp b/core/src/fxge/win32/fx_win32_print.cpp index 4ebeab9023..4600d186a6 100644 --- a/core/src/fxge/win32/fx_win32_print.cpp +++ b/core/src/fxge/win32/fx_win32_print.cpp @@ -121,7 +121,7 @@ static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, const CFX_Af return NULL; } int src_width = pSrcBitmap->GetWidth(), src_height = pSrcBitmap->GetHeight(); - FX_LPBYTE src_buf = pSrcBitmap->GetBuffer(); + uint8_t* src_buf = pSrcBitmap->GetBuffer(); FX_DWORD src_pitch = pSrcBitmap->GetPitch(); FX_FLOAT dest_area = pDestMatrix->GetUnitArea(); FX_FLOAT area_scale = FXSYS_Div((FX_FLOAT)(src_width * src_height), dest_area); @@ -158,12 +158,12 @@ static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, const CFX_Af return NULL; } pTempBitmap->CopyPalette(pSrc->GetPalette()); - FX_LPBYTE dest_buf = pTempBitmap->GetBuffer(); + uint8_t* dest_buf = pTempBitmap->GetBuffer(); int dest_pitch = pTempBitmap->GetPitch(); FXSYS_memset8(dest_buf, pSrc->IsAlphaMask() ? 0 : 0xff, dest_pitch * result_height); if (pSrcBitmap->IsAlphaMask()) { for (int dest_y = 0; dest_y < result_height; dest_y ++) { - FX_LPBYTE dest_scan = dest_buf + dest_y * dest_pitch; + uint8_t* dest_scan = dest_buf + dest_y * dest_pitch; for (int dest_x = 0; dest_x < result_width; dest_x ++) { int src_x, src_y; result2src_fix.Transform(dest_x, dest_y, src_x, src_y); @@ -178,7 +178,7 @@ static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, const CFX_Af } } else { for (int dest_y = 0; dest_y < result_height; dest_y ++) { - FX_LPBYTE dest_scan = dest_buf + dest_y * dest_pitch; + uint8_t* dest_scan = dest_buf + dest_y * dest_pitch; for (int dest_x = 0; dest_x < result_width; dest_x ++) { int src_x, src_y; result2src_fix.Transform(dest_x, dest_y, src_x, src_y); @@ -198,7 +198,7 @@ static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, const CFX_Af return pTempBitmap; } FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_alpha, FX_DWORD color, - const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type) { if (bitmap_alpha < 255 || pSource->HasAlpha() || (pSource->IsAlphaMask() && (pSource->GetBPP() != 1 || !m_bSupportROP))) { @@ -256,7 +256,7 @@ void CPSOutput::Init() { m_pBuf = FX_Alloc(FX_CHAR, 1026); } -void CPSOutput::OutputPS(FX_LPCSTR string, int len) +void CPSOutput::OutputPS(const FX_CHAR* string, int len) { if (len < 0) { len = (int)FXSYS_strlen(string); @@ -402,7 +402,7 @@ FX_BOOL CPSPrinterDriver::StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD c return m_PSRenderer.StretchDIBits(pBitmap, color, dest_left, dest_top, dest_width, dest_height, flags, alpha_flag, pIccTransform); } FX_BOOL CPSPrinterDriver::StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, - const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type) { if (blend_type != FXDIB_BLEND_NORMAL) { diff --git a/core/src/fxge/win32/win32_int.h b/core/src/fxge/win32/win32_int.h index a3380f3b5b..1f8f5d7995 100644 --- a/core/src/fxge/win32/win32_int.h +++ b/core/src/fxge/win32/win32_int.h @@ -41,7 +41,7 @@ public: void GdipDeleteBrush(void* pBrush); void GdipCreateMatrix(FX_FLOAT a, FX_FLOAT b, FX_FLOAT c, FX_FLOAT d, FX_FLOAT e, FX_FLOAT f, void** matrix); void GdipDeleteMatrix(void* matrix); - FX_BOOL GdipCreateFontFamilyFromName(FX_LPCWSTR name, void* pFontCollection, void**pFamily); + FX_BOOL GdipCreateFontFamilyFromName(const FX_WCHAR* name, void* pFontCollection, void**pFamily); void GdipDeleteFontFamily(void* pFamily); FX_BOOL GdipCreateFontFromFamily(void* pFamily, FX_FLOAT font_size, int fontstyle, int flag, void** pFont); void* GdipCreateFontFromCollection(void* pFontCollection, FX_FLOAT font_size, int fontstyle); @@ -105,10 +105,10 @@ protected: int alpha_flag, void* pIccTransform, int blend_type); virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, FX_DWORD color, int alpha_flag, void* pIccTransform, int blend_type); - virtual FX_LPVOID GetClipRgn() ; - virtual FX_BOOL SetClipRgn(FX_LPVOID pRgn) ; + virtual void* GetClipRgn() ; + virtual FX_BOOL SetClipRgn(void* pRgn) ; virtual FX_BOOL GetClipBox(FX_RECT* pRect); - virtual FX_BOOL DeleteDeviceRgn(FX_LPVOID pRgn); + virtual FX_BOOL DeleteDeviceRgn(void* pRgn); virtual void DrawLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2); virtual void* GetPlatformSurface() { @@ -140,7 +140,7 @@ protected: int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag, void* pIccTransform, int blend_type); virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, - const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type) { return FALSE; @@ -161,7 +161,7 @@ protected: int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag, void* pIccTransform, int blend_type); virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, - const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type); int m_HorzSize, m_VertSize; FX_BOOL m_bSupportROP; @@ -176,9 +176,9 @@ public: delete this; } void Init(); - virtual void OutputPS(FX_LPCSTR string, int len); + virtual void OutputPS(const FX_CHAR* string, int len); HDC m_hDC; - FX_LPSTR m_pBuf; + FX_CHAR* m_pBuf; }; class CPSPrinterDriver : public IFX_RenderDeviceDriver { @@ -221,7 +221,7 @@ protected: int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag, void* pIccTransform, int blend_type); virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, - const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, FX_LPVOID& handle, + const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type); virtual FX_BOOL DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color, |